hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
588 values
lang
stringclasses
305 values
max_stars_repo_path
stringlengths
3
363
max_stars_repo_name
stringlengths
5
118
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:00:35
2022-03-31 23:43:49
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 12:37:38
2022-03-31 23:59:52
max_issues_repo_path
stringlengths
3
363
max_issues_repo_name
stringlengths
5
118
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
363
max_forks_repo_name
stringlengths
5
135
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:02
2022-03-31 23:27:27
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 08:55:07
2022-03-31 23:59:24
content
stringlengths
5
1.05M
avg_line_length
float64
1.13
1.04M
max_line_length
int64
1
1.05M
alphanum_fraction
float64
0
1
81d579e4699bd0c028a31b72947a6e9865ca82d9
1,172
h
C
Classes/Read Classes/EndPageMoreAppsViewController.h
beherana/AngelinaNewteacher
3be0b541d518c672f31f8e06154adc6a806a7885
[ "MIT" ]
1
2015-05-14T02:45:16.000Z
2015-05-14T02:45:16.000Z
Classes/Read Classes/EndPageMoreAppsViewController.h
beherana/AngelinaNewteacher
3be0b541d518c672f31f8e06154adc6a806a7885
[ "MIT" ]
null
null
null
Classes/Read Classes/EndPageMoreAppsViewController.h
beherana/AngelinaNewteacher
3be0b541d518c672f31f8e06154adc6a806a7885
[ "MIT" ]
null
null
null
// // EndPageMoreAppsViewController.h // Angelina-New-Teacher-Universal // // Created by Martin Kamara on 2011-11-23. // Copyright 2011 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> #import "CustomAlertViewController.h" @interface EndPageMoreAppsViewController : UIViewController<CustomAlertViewControllerDelegate> { UIImageView *noConnectionImage; UIActivityIndicatorView *xSellActivityIndicator; UITableView *xSellTableView; UIScrollView *xSellScrollView; } @property (nonatomic, retain) IBOutlet UIImageView *noConnectionImage; @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *xSellActivityIndicator; @property (retain) NSArray* xSellApps; @property (nonatomic, retain) IBOutlet UITableView *xSellTableView; @property (nonatomic, retain) IBOutlet UIScrollView *xSellScrollView; @property (retain) NSURL *willOpenUrl; @property (retain, nonatomic) IBOutlet UIView *fadeView; - (IBAction)backButtonAction:(id)sender; - (IBAction)giftButtonAction:(id)sender; -(void) xSellDidReload; -(void)reloadXSell; -(void)openUrl:(NSURL *)url; - (void)showLeavingAppAlert; -(void)setScrollView; -(void) resetScroll; @end
30.051282
96
0.788396
fc31d4b3515b92af47745776abc98ee74b89f4a7
631
h
C
misc/gl2imgui/render_imgui.h
PINTO0309/tflite_gles_app
d7fda686d096712c49ad4f5dfca8b8e9a3d88956
[ "MIT" ]
388
2019-11-06T05:09:56.000Z
2022-03-28T11:09:03.000Z
misc/gl2imgui/render_imgui.h
PINTO0309/tflite_gles_app
d7fda686d096712c49ad4f5dfca8b8e9a3d88956
[ "MIT" ]
28
2020-05-21T16:23:03.000Z
2021-09-30T15:46:37.000Z
misc/gl2imgui/render_imgui.h
PINTO0309/tflite_gles_app
d7fda686d096712c49ad4f5dfca8b8e9a3d88956
[ "MIT" ]
102
2019-11-21T05:41:25.000Z
2022-03-15T14:07:39.000Z
/* ------------------------------------------------ * * The MIT License (MIT) * Copyright (c) 2020 terryky1220@gmail.com * ------------------------------------------------ */ #ifndef UTIL_IMGUI_H_ #define UTIL_IMGUI_H_ #ifdef __cplusplus extern "C" { #endif typedef struct _imgui_data_t { float clear_color[4]; float grid_alpha; } imgui_data_t; int init_imgui (int width, int height); void imgui_mousebutton (int button, int state, int x, int y); void imgui_mousemove (int x, int y); int invoke_imgui (imgui_data_t *imgui_data); #ifdef __cplusplus } #endif #endif /* UTIL_IMGUI_H_ */
21.758621
62
0.576862
11d4682778d5546383b5ae53055d825079e4b0f3
22,593
c
C
Model-code/DAYCENT/SOURCE/initsite_tg.c
bsulman/INTERFACE-model-experiment-synthesis
a20eebe34f9271233ecc4e7c84403b805bb0b523
[ "MIT" ]
1
2018-11-13T17:03:43.000Z
2018-11-13T17:03:43.000Z
Model-code/DAYCENT/SOURCE/initsite_tg.c
yuanhongdeng/INTERFACE-model-experiment-synthesis
a20eebe34f9271233ecc4e7c84403b805bb0b523
[ "MIT" ]
null
null
null
Model-code/DAYCENT/SOURCE/initsite_tg.c
yuanhongdeng/INTERFACE-model-experiment-synthesis
a20eebe34f9271233ecc4e7c84403b805bb0b523
[ "MIT" ]
3
2018-11-04T14:40:41.000Z
2021-07-16T11:33:52.000Z
/* Copyright 1993 Colorado State University */ /* All Rights Reserved */ /***************************************************************************** ** ** FILE: initsite_tg.c ** ** FUNCTION: void initsite() ** ** PURPOSE: Read in site specific parameters (from sitepar.in) ** ** AUTHOR: Susan Chaffee March 10, 1992 ** ** REWRITE: Melannie Hartman 9/9/93 - 9/23/93 ** ** HISTORY: ** 8/13/92 (SLC) - Change the way the parameter for minimum soil water ** content is used. No longer a function of wilting point, ** now it simply gives the percent of water at each layer. ** 5/08/08 (CAK) - Add checks for end of file, if the end of the file is ** reached before all of the variables have been read and ** initialized this will result in a fatal error. ** ** INPUTS: ** flags - structure containing debugging flags ** flags->debug - flag to set debugging mode, 0 = off, 1 = on ** flags->verbose - flag to set verbose debugging mode, 0 = off, 1 = on ** sitename - data file name containing site parameters ** sitepar - site specific parameters structure for soil water model ** layers - soil water soil layer structure ** ** GLOBAL VARIABLES: ** INPTSTRLEN - maximum length of input file line (120) ** NTDEPTHS - maximum number of soil regions (4) ** ** LOCAL VARIABLES: ** errmsg[] - string containing error message ** fp_in - pointer to input file ** imo - current month (1..12) ** inptline[] - line read from input file ** m - month ** ** OUTPUTS: ** Read from file sitename: ** bioabsorp - litter biomass at full absorption of radiation ** (grams biomass) ** maxphoto - maximum carbon loss due to photodecomposition ** (ug C/KJ srad) ** sitepar->albedo - fraction of light reflected by snow ** sitepar->aspect - site aspect (degrees) ** sitepar->cldcov[] - average cloud cover for the month (%, 1..100) ** sitepar->dmp - damping factor for calculating soil temperature ** by layer ** sitepar->dmpflux - damping factor for soil water flux (in h2oflux) ** sitepar->drainlag - number of days that soil drainage should lag ** behind rain/irrigation/melt events (1-5) ** sitepar->ehoriz - site east horizon, degrees ** sitepar->elevation - site elevation (meters) ** sitepar->fswcinit - initial soil water content, fraction of field ** capacity (0.0 - 1.0) ** sitepar->hours_rain - the duration of the rainfall/snowmelt event ** (hours) ** sitepar->hpotdeep - hydraulic water potential of deep storage ** layer, the more negative the number the dryer ** the soil layer (units?) ** sitepar->jdayEnd - the Julian day to end the turning off of the ** restriction of the CO2 effect on ** denitrification ** sitepar->jdayStart - the Julian day to start the turning off of the ** restriction of the CO2 effect on ** denitrification ** sitepar->ksatdeep - saturated hydraulic conductivity of deep ** storage layer (cm/sec) ** sitepar->N2Oadjust - nitrification N2O adjustment factor (0.0-1.0) ** sitepar->Ncoeff - minimum water/temperature limitation ** coefficient for nitrification ** sitepar->reflec - fraction of light reflected by vegetation ** sitepar->slope - site slope (degrees) ** sitepar->sublimscale - multiplier to scale sublimation ** sitepar->tbotmn - minimum emperature for bottom soil layer ** (degrees C) ** sitepar->tbotmx - maximum emperature for bottom soil layer ** (degrees C) ** sitepar->texture - texture classification for trace gas model ** (1 = coarse, 2 = medium, 3 = fine) ** sitepar->timlag - days from Jan 1 to coolest temp at bottom of ** soil (days) ** sitepar->usexdrvrs - 0 = use air temperature to drive PET rates ** 1 = use extra weather drivers (solrad, rhumid, ** windsp) for PET calculation ** 2 = use extra weather drivers (srad, vpd) ** for photosynthesis calculation ** 3 = use extra drivers for both PET and ** photosynthesis calculations ** sitepar->watertable[] - 1 = simulate water table, 0 = no water table ** sitepar->whoriz - site west horizon, degrees ** sradadj[] - solar radiation adjustment for cloud cover and ** transmission coeffient ** tminintercept - intercept used to adjust minimum temperature ** for calculating VPD at dewpoint ** tminslope - slope used to adjust minimum temperature ** for calculating VPD at dewpoint ** ** EXAMPLE INPUT FILE: ** 0 / 0 = don't use extra weather drivers for PET ** 1 = use extra weather drivers for PET (solrad, rhumid, windsp) ** 2 = use extra weather drivers (solrad, vpd) for photosynthesis ** 3 = use extra drivers for both PET and photosynthesis ** 1.0 / sublimscale ** 0.18 / reflec - vegetation reflectivity/albedo (frac) ** 0.65 / albedo - snow albedo (frac) ** 0.90 / fswcinit - initial swc, fraction of field capacity ** 0.000001 / dmpflux - in h2oflux routine (0.000001 = original value) ** 4 / hours_rain - duration of each rain event ** 0 / # of days between rainfall event and drainage of soil (-1=computed) ** 1 0 / watertable[month] - 0 = no water table, 1 = water table ** 2 0 ** 3 0 ** 4 0 ** 5 0 ** 6 0 ** 7 0 ** 8 0 ** 9 0 ** 10 0 ** 11 0 ** 12 0 ** -200 / hpotdeep - hydraulic water potential of deep storage layer ** (units?) ** 0.0002 / ksatdeep - saturated hydraulic conductivity of deep storage ** layer (cm/sec) ** 1 58 / cldcov[month] - cloud cover (%) ** 2 58 ** 3 58 ** 4 58 ** 5 58 ** 6 58 ** 7 58 ** 8 58 ** 9 58 ** 10 58 ** 11 58 ** 12 58 ** 5.0 16.4 / min and max temperature for bottom soil layer (degrees C) ** 0.003 / damping factor for calculating soil temperature by layer ** 30.0 / timlag, days from Jan 1 to coolest temp at bottom of soil (days) ** 0.03 / min water/temperature limitation coefficient for nitrify ** 0 0 / turn off resp restraint on denit between these days of the year ** 0.8 / nitrification N2O adjustment factor (0.0-1.0) ** 1525 / elevation, meters ** 0.0 / site slope, degrees ** 0.0 / site aspect, degrees ** 0.0 / site east horizon, degrees ** 0.0 / site west horizon, degrees ** 1 0.63 / sradadj[month] srad adjust for cloud cover & transmission coeff ** 2 0.63 ** 3 0.63 ** 4 0.63 ** 5 0.63 ** 6 0.63 ** 7 0.63 ** 8 0.63 ** 9 0.63 ** 10 0.63 ** 11 0.63 ** 12 0.63 ** 1.0 / slope for adjusting minimum temperature for VPD dewpoint calc ** 0.0 / intercept for adjusting minimum temperature for VPD dewpoint calc ** 1.16 / maximum carbon loss due to photodecomposition (ug C/KJ srad) ** 200.0 / litter biomass for full absorption of solar radiation (g biomass) ** ** CALLED BY: ** initsw() ** ** CALLS: ** None ** *****************************************************************************/ #include "soilwater.h" #include <stdlib.h> #include <stdio.h> void initsite(char *sitename, SITEPAR_SPT sitepar, LAYERPAR_SPT layers, FLAG_SPT flags, double sradadj[NMONTH], double *tminslope, double *tminintercept, double *maxphoto, double *bioabsorp) { int imo, m; char inptline[INPTSTRLEN]; char errmsg[INPTSTRLEN]; FILE *fp_in; if (flags->debug) { printf("Entering function initsite\n"); } if ((fp_in = fopen(sitename, "r")) == NULL) { sprintf(errmsg, "Cannot open file %s\n", sitename); perror(errmsg); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%d", &sitepar->usexdrvrs); if (flags->debug) { printf("usexdrvrs: %1d\n", sitepar->usexdrvrs); } } else { printf("ERROR: Missing extra weather drivers value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->sublimscale); if (flags->debug) { printf("sublimscale: %lf\n", sitepar->sublimscale); } } else { printf("ERROR: Missing sublimation scalar value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->reflec); if (flags->debug) { printf("reflec: %lf\n", sitepar->reflec); } } else { printf("ERROR: Missing fraction of light reflected by vegetation\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->albedo); if (flags->debug) { printf("albedo: %lf\n", sitepar->albedo); } } else { printf("ERROR: Missing fraction of light reflected by\n"); printf("snow value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->fswcinit); if (flags->debug) { printf("fswcinit: %lf\n", sitepar->fswcinit); } } else { printf("ERROR: Missing initial soil water content value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->dmpflux); if (flags->debug) { printf("dmpflux: %lf\n", sitepar->dmpflux); } } else { printf("ERROR: Missing damping factor for soil water flux value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->hours_rain); if (flags->debug) { printf("hours_rain: %lf\n", sitepar->hours_rain); } } else { printf("ERROR: Missing duration of the rainfall/snowmelt event\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } /* Allow user to set number of days between rainfall event and */ /* drainage of soil profile. If a value of -1 is entered set the */ /* number of days to drainage based in the soil texture. Constrain */ /* the number of days to drainage to be <=5 to prevent numerical */ /* instabilities in the h2oflux subroutine. cak - 02/13/04 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%d", &sitepar->drainlag); if (sitepar->drainlag < 0) { sitepar->drainlag = sitepar->texture - 1; } if (sitepar->drainlag > 5) { printf("lag period for drainage too long, setting to max value\n"); sitepar->drainlag = 5; } if (flags->debug) { printf("drainlag: %d\n", sitepar->drainlag); } } else { printf("ERROR: Missing number of days that soil drainage should\n"); printf("lag behind rain/irrigation/melt events value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } for(imo=1; imo<=12; imo++) { if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%d %d", &m, &sitepar->watertable[imo]); if (flags->debug) { printf("watertable: %d %d\n", imo, sitepar->watertable[imo]); } } else { printf("ERROR: Missing simulate water table flag\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->hpotdeep); if (flags->debug) { printf("hpotdeep: %lf\n", sitepar->hpotdeep); } } else { printf("ERROR: Missing hydraulic water potential of deep storage\n"); printf("layer value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->ksatdeep); if (flags->debug) { printf("ksatdeep: %lf\n", sitepar->ksatdeep); printf("Cloud cover:\n"); } } else { printf("ERROR: Missing saturated hydraulic conductivity of deep\n"); printf("storage layer value in sitepar.in file.\n"); printf("Ending simulation!\n"); exit(1); } for(imo=1; imo<=12; imo++) { if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%d %lf", &m, &sitepar->cldcov[imo]); if (flags->debug) { printf("cloud cover: %d %6.2lf\n", imo, sitepar->cldcov[imo]); } } else { printf("ERROR: Missing average cloud cover value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } } /* The texture parameter is being set in the initlyrs subroutine */ /* CAK - 05/31/01 */ /* The texture parameter has been replaced by the minimum and */ /* maximum temperature values for the bottom soil layer */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { /* sscanf(inptline, "%d", &sitepar->texture); */ sscanf(inptline, "%lf %lf", &sitepar->tbotmn, &sitepar->tbotmx); if (flags->debug) { printf("tbotmn: %lf\n", sitepar->tbotmn); printf("tbotmx: %lf\n", sitepar->tbotmx); } if (sitepar->tbotmn > sitepar->tbotmx) { fprintf(stderr, "Error in input file %s.\n", sitename); fprintf(stderr, "the minimum soil temperature at the bottom of\n"); fprintf(stderr, "the soil is greater than the maximum soil\n"); fprintf(stderr, "temperature at the bottom of the soil.\n"); exit(1); } } else { printf("ERROR: Missing minimum and maximum temperature for\n"); printf("bottom soil layer values in sitepar.in file.\n"); printf("Ending simulation!\n"); exit(1); } /* Added dmp parameter to the sitepar.in file, read in the value */ /* for this parameter, cak - 12/16/02 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->dmp); if (flags->debug) { printf("damping factor: %lf\n", sitepar->dmp); } } else { printf("ERROR: Missing damping factor for calculating soil\n"); printf("temperature value in sitepar.in file. Ending simulation!\n"); exit(1); } /* Added timlag parameter to the sitepar.in file, read in the value */ /* for this parameter, cak - 04/24/03 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->timlag); if (flags->debug) { printf("lag time: %lf\n", sitepar->timlag); } } else { printf("ERROR: Missing days from Jan 1 to coolest temp at bottom\n"); printf("of soil value in sitepar.in file. Ending simulation!\n"); exit(1); } /* Added Ncoeff parameter to the sitepar.in file, read in the value */ /* for this parameter, cak - 04/08/03 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->Ncoeff); if (flags->debug) { printf("water/temp coeff: %lf\n", sitepar->Ncoeff); } } else { printf("ERROR: Missing coefficient for nitrification value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%d %d", &sitepar->jdayStart, &sitepar->jdayEnd); if (flags->debug) { printf("jdayStart: %d\n", sitepar->jdayStart); printf("jdayEnd: %d\n", sitepar->jdayEnd); } } else { printf("ERROR: Missing days of year to turn off respiration\n"); printf("restraint on denitrification value in sitepar.in file.\n"); printf("Ending simulation!\n"); exit(1); } /* Added nitrification N2O adjustment factor to sitepar.in file, */ /* cak - 05/15/2007 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->N2Oadjust); if (flags->debug) { printf("N2O adjustment factor: %lf\n", sitepar->N2Oadjust); } } else { printf("ERROR: Missing N2O adjustment factor value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } /* Added elevation (meters) to sitepar.in file, */ /* cak - 04/15/2009 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->elevation); if (flags->debug) { printf("Elevation (meters): %lf\n", sitepar->elevation); } } else { printf("ERROR: Missing elevation (meters) value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } /* Added site slope, aspect, east horizon, and west horizon */ /* to sitepar.in file, */ /* cak - 05/08/2009 */ if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->slope); if (flags->debug) { printf("Site slope (degrees): %lf\n", sitepar->slope); } } else { printf("ERROR: Missing site slope (degrees) value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->aspect); if (flags->debug) { printf("Site aspect (degrees): %lf\n", sitepar->aspect); } } else { printf("ERROR: Missing site aspect (degrees) value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->ehoriz); if (flags->debug) { printf("Site east horizon (degrees): %lf\n", sitepar->ehoriz); } } else { printf("ERROR: Missing site east horizon (degrees) value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", &sitepar->whoriz); if (flags->debug) { printf("Site west horizon (degrees): %lf\n", sitepar->whoriz); } } else { printf("ERROR: Missing site west horizon (degrees) value\n"); printf("in sitepar.in file. Ending simulation!\n"); exit(1); } for(imo=1; imo<=12; imo++) { if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%d %lf", &m, &sradadj[imo-1]); if (flags->debug) { printf("Solar radiation adjustment factor: %d %lf\n", imo, sradadj[imo-1]); } } else { printf("ERROR: Missing solar radiation adjustment factor\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", tminslope); if (flags->debug) { printf("Slope for VPD min temp adjustment: %lf\n", *tminslope); } } else { printf("ERROR: Slope for VPD minimum temperature adjustment\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", tminintercept); if (flags->debug) { printf("Slope for VPD min temp adjustment: %lf\n", *tminintercept); } } else { printf("ERROR: Intercept for VPD minimum temperature adjustment\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", maxphoto); /* Convert ug C to grams C */ *maxphoto *= 0.000001; if (flags->debug) { printf("Maximum carbon loss due to photodecomp: %lf\n", *maxphoto); } } else { printf("ERROR: Missing maximum carbon loss due to photodecomp\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { sscanf(inptline, "%lf", bioabsorp); if (flags->debug) { printf("Litter biomass at full absorption of radiation: %lf\n", *bioabsorp); } } else { printf("ERROR: Missing litter biomass at full absorption of srad\n"); printf("value in sitepar.in file. Ending simulation!\n"); exit(1); } if (fgets(inptline, INPTSTRLEN, fp_in) != NULL) { printf("ERROR: Incorrect number of lines in sitepar.in file.\n"); printf("Ending simulation!\n"); exit(1); } fclose(fp_in); if (flags->debug) { printf("Exiting function initsite\n"); } return; }
38.886403
82
0.549418
26f8be28910a973dc198f64fd41bd485cdfffb78
2,269
h
C
Sources/SQPProperty.h
christopherney/SQPersist
df0a9dcbfbee8b0420813579955420c2c343cf07
[ "MIT" ]
33
2015-01-07T23:07:08.000Z
2021-12-01T07:28:45.000Z
Sources/SQPProperty.h
christopherney/SQPersist
df0a9dcbfbee8b0420813579955420c2c343cf07
[ "MIT" ]
7
2015-01-12T14:31:34.000Z
2021-06-15T22:35:12.000Z
Sources/SQPProperty.h
christopherney/SQPersist
df0a9dcbfbee8b0420813579955420c2c343cf07
[ "MIT" ]
16
2015-01-22T10:45:02.000Z
2020-08-26T03:50:03.000Z
// // SQPProperty.h // SQPersist // // Created by Christopher Ney on 29/10/2014. // Copyright (c) 2014 Christopher Ney. All rights reserved. // #import <Foundation/Foundation.h> #import <objc/runtime.h> /** Objective-C types of property. */ typedef enum SQPPropertyType : NSUInteger { kPropertyTypeInt, kPropertyTypeLong, kPropertyTypeLongLong, kPropertyTypeBool, kPropertyTypeDouble, kPropertyTypeFloat, kPropertyTypeChar, kPropertyTypeShort, kPropertyTypeNumber, kPropertyTypeDecimalNumber, kPropertyTypeString, kPropertyTypeDate, kPropertyTypeData, kPropertyTypeArray, kPropertyTypeMutableArray, kPropertyTypeImage, kPropertyTypeURL, kPropertyTypeObject } SQPPropertyType; /** * Informations of one property of an entity object. */ @interface SQPProperty : NSObject /** * Property name. */ @property (nonatomic, strong) NSString *name; /** * Property value. */ @property (nonatomic, strong) id value; /** * Property type (enum SQPPropertyType). */ @property (nonatomic) SQPPropertyType type; /** * Indicate if the property is a primitive type (not complex). */ @property (nonatomic) BOOL isPrimitive; /** * Indicate that is nonatomic property. */ @property (nonatomic) BOOL isNonatomic; /** * Indicate that the property is a SQPObject type (entity object). */ @property (nonatomic) BOOL isSQPObject; /** * Indicate if the property is compatible for storage in SQLite database. */ @property (nonatomic) BOOL isCompatibleType; /** * Indicate that is retain (strong) property. */ @property (nonatomic) BOOL isRetain; /** * Indicate that is copy property. */ @property (nonatomic) BOOL isCopy; /** * Indicate that is readonly property. */ @property (nonatomic) BOOL isReadonly; /** * If property if complex type, this member return the name of the complex type. */ @property (nonatomic, strong) NSString *complexTypeName; /** * Build the SQPProperty with the attribute informations. * * @param attributes Attribut informations. */ - (void)getPropertyType:(const char *)attributes; /** * Return the SQLite type equal to the Objective-C type. * * @return SQLite Type (INTEGER|REAL|TEXT|BLOB). */ - (NSString*)getSQLiteType; @end
20.441441
81
0.710004
ddd69eab37b12da55e9bb3d398bb663bb8f2a5e2
296
h
C
ports/vega-pulpino/icon/icon.h
open-isa-cn/Micropython-vega
7ca131afffd9b438c969e8dce3ec442bf830d8fb
[ "MIT" ]
2
2019-04-26T06:15:53.000Z
2019-08-01T03:11:48.000Z
ports/vega-pulpino/icon/icon.h
open-isa-cn/Micropython-vega
7ca131afffd9b438c969e8dce3ec442bf830d8fb
[ "MIT" ]
null
null
null
ports/vega-pulpino/icon/icon.h
open-isa-cn/Micropython-vega
7ca131afffd9b438c969e8dce3ec442bf830d8fb
[ "MIT" ]
null
null
null
#include "stdint.h" extern const uint16_t big[]; extern const uint16_t big_w; extern const uint16_t big_h; extern const uint16_t medium[]; extern const uint16_t medium_w; extern const uint16_t medium_h; extern const uint16_t small[]; extern const uint16_t small_w; extern const uint16_t small_h;
26.909091
31
0.807432
a17b969a4ab7428d7e4e3b669144594a8fb41102
26
h
C
test/big/1/1/h11.h
vladshiryaev/cx
7f7f8b85b7922084a704a5ba08eec71a913daf5e
[ "MIT" ]
1
2022-03-27T20:10:41.000Z
2022-03-27T20:10:41.000Z
test/big/1/1/h11.h
vladshiryaev/cx
7f7f8b85b7922084a704a5ba08eec71a913daf5e
[ "MIT" ]
null
null
null
test/big/1/1/h11.h
vladshiryaev/cx
7f7f8b85b7922084a704a5ba08eec71a913daf5e
[ "MIT" ]
null
null
null
#pragma once int f11();
5.2
12
0.615385
b8022043f9b684fd2121d1925072bbe1d9600968
706
h
C
include/config/SkUserConfig.h
derp-caf/external_skia
b09dc92e00edce8366085aaad7dcce94ceb11b69
[ "BSD-3-Clause" ]
1
2019-05-29T09:54:38.000Z
2019-05-29T09:54:38.000Z
include/config/SkUserConfig.h
derp-caf/external_skia
b09dc92e00edce8366085aaad7dcce94ceb11b69
[ "BSD-3-Clause" ]
null
null
null
include/config/SkUserConfig.h
derp-caf/external_skia
b09dc92e00edce8366085aaad7dcce94ceb11b69
[ "BSD-3-Clause" ]
8
2019-01-12T23:06:45.000Z
2021-09-03T00:15:46.000Z
// DO NOT MODIFY! This file is autogenerated by gn_to_bp.py. // If need to change a define, modify SkUserConfigManual.h #ifndef SkUserConfig_DEFINED #define SkUserConfig_DEFINED #include "SkUserConfigManual.h" #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 #define SK_CODEC_DECODES_RAW #define SK_ENABLE_DISCRETE_GPU #define SK_GAMMA_APPLY_TO_A8 #define SK_GAMMA_CONTRAST 0.0 #define SK_GAMMA_EXPONENT 1.4 #define SK_HAS_HEIF_LIBRARY #define SK_HAS_JPEG_LIBRARY #define SK_HAS_PNG_LIBRARY #define SK_HAS_WEBP_LIBRARY #define SK_PDF_USE_SFNTLY #define SK_SUPPORT_PDF #define SK_VULKAN #define SK_VULKAN_HEADER "Skia_Vulkan_Android.h" #define SK_XML #endif//SkUserConfig_DEFINED
32.090909
60
0.818697
5ad09c9afa6b0dd739d5890af97ed1130a49f777
1,124
c
C
usr/src/tools/smatch/src/smatch_parameter_names.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/tools/smatch/src/smatch_parameter_names.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
null
null
null
usr/src/tools/smatch/src/smatch_parameter_names.c
AsahiOS/gate
283d47da4e17a5871d9d575e7ffb81e8f6c52e51
[ "MIT" ]
1
2020-12-30T00:04:16.000Z
2020-12-30T00:04:16.000Z
/* * Copyright (C) 2017 Oracle. * * 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, see http://www.gnu.org/copyleft/gpl.txt */ #include "smatch.h" static void match_def(struct symbol *sym) { struct symbol *param; int i; if (__inline_fn) return; i = -1; FOR_EACH_PTR(cur_func_sym->ctype.base_type->arguments, param) { i++; if (!param->ident) continue; sql_insert_parameter_name(i, param->ident->name); } END_FOR_EACH_PTR(param); } void register_parameter_names(int id) { if (!option_info) return; add_hook(&match_def, FUNC_DEF_HOOK); }
25.545455
75
0.727758
8703d38bf26b24b9ced00d3fc80040cfce253e47
3,105
c
C
gui/gui.c
squirrelcom/dennix
efeb5f2d57cf0618132dde5ffe4f3959d2351c49
[ "0BSD" ]
99
2016-11-02T20:04:44.000Z
2022-03-29T07:27:46.000Z
gui/gui.c
squirrelcom/dennix
efeb5f2d57cf0618132dde5ffe4f3959d2351c49
[ "0BSD" ]
30
2017-08-10T18:31:55.000Z
2022-03-01T14:10:25.000Z
gui/gui.c
squirrelcom/dennix
efeb5f2d57cf0618132dde5ffe4f3959d2351c49
[ "0BSD" ]
9
2016-11-01T09:16:42.000Z
2022-02-10T14:10:44.000Z
/* Copyright (c) 2020, 2021 Dennis Wölfing * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* gui/gui.c * Graphical User Interface. */ #include <signal.h> #include <stdlib.h> #include <unistd.h> #include "window.h" dxui_context* context; dxui_window* compositorWindow; dxui_color* lfb; dxui_dim guiDim; static void shutdown(void) { dxui_shutdown(context); } static void onSignal(int signo) { signal(signo, SIG_DFL); shutdown(); raise(signo); } static void handleClose(dxui_window* window) { (void) window; for (struct Window* win = topWindow; win; win = win->below) { closeWindow(win); } exit(0); } static void initialize(void) { atexit(shutdown); signal(SIGABRT, onSignal); signal(SIGBUS, onSignal); signal(SIGFPE, onSignal); signal(SIGILL, onSignal); signal(SIGINT, SIG_IGN); signal(SIGPIPE, SIG_IGN); signal(SIGQUIT, SIG_IGN); signal(SIGSEGV, onSignal); signal(SIGTERM, onSignal); context = dxui_initialize(DXUI_INIT_CURSOR); if (!context) dxui_panic(NULL, "Failed to initialize dxui"); dxui_rect rect; rect.x = -1; rect.y = -1; dxui_dim displayDim = dxui_get_display_dim(context); if (dxui_is_standalone(context)) { rect.dim = displayDim; } else { rect.width = 4 * displayDim.width / 5; rect.height = 4 * displayDim.height / 5; } compositorWindow = dxui_create_window(context, rect, "GUI", DXUI_WINDOW_COMPOSITOR); if (!compositorWindow) dxui_panic(context, "Failed to create a window"); dxui_set_background(compositorWindow, backgroundColor); dxui_set_event_handler(compositorWindow, DXUI_EVENT_MOUSE, handleMouse); dxui_set_event_handler(compositorWindow, DXUI_EVENT_KEY, handleKey); dxui_set_event_handler(compositorWindow, DXUI_EVENT_WINDOW_RESIZED, handleResize); dxui_set_event_handler(compositorWindow, DXUI_EVENT_WINDOW_CLOSE, handleClose); guiDim = rect.dim; lfb = dxui_get_framebuffer(compositorWindow, guiDim); if (!lfb) dxui_panic(context, "Failed to create window framebuffer"); dxui_show(compositorWindow); initializeDisplay(); initializeServer(); } int main(void) { initialize(); dxui_rect rect = { .pos = {0, 0}, .dim = guiDim }; addDamageRect(rect); composit(); while (true) { pollEvents(); composit(); } }
28.227273
76
0.696296
f51e55ae84a99422d59e7be7ac7610761aac342a
674
h
C
ZJDKit/Classes/ZJD/ZJD_MultiTextView.h
Sdfeidong/ZJDKit
2f52944b284a1b57cb96c50612dba59e8ec19e5c
[ "MIT" ]
null
null
null
ZJDKit/Classes/ZJD/ZJD_MultiTextView.h
Sdfeidong/ZJDKit
2f52944b284a1b57cb96c50612dba59e8ec19e5c
[ "MIT" ]
null
null
null
ZJDKit/Classes/ZJD/ZJD_MultiTextView.h
Sdfeidong/ZJDKit
2f52944b284a1b57cb96c50612dba59e8ec19e5c
[ "MIT" ]
null
null
null
// // ZJD_MultiTextView.h // DKT4.0 // // Created by aidong on 15/6/1. // Copyright (c) 2015年 aidong. All rights reserved. // #import <UIKit/UIKit.h> /* 本类的作用: 显示不同类型的字符串[字体大小、颜色等等] @1.0:目前只支持在同一行显示 */ typedef enum _MutiTextAlignmentType { Muti_Alignment_Left_Type = 0x20, Muti_Alignment_Mid_Type = 0x21, Muti_Alignment_Right_Type = 0x22, }MutiTextAlignmentType; @interface ZJD_MultiTextView : UIView @property(nonatomic)MutiTextAlignmentType alignmentType; /* @text : 要显示的分割字符,以|号隔开 ps:xxx|xxx|xxx @setDictionary:每个字符的设置项目 [NSDictionary] Color:[字体的颜色] Font:[字体的大小] */ -(void)setShowText:(NSString*)text Setting:(NSArray*)setDictionary; @end
18.216216
67
0.731454
679b37c6ff2a186afa163eae9a523b4e47136b1f
316
c
C
games/backgammon/backgammon/version.c
weiss/original-bsd
b44636d7febc9dcf553118bd320571864188351d
[ "Unlicense" ]
114
2015-01-18T22:55:52.000Z
2022-02-17T10:45:02.000Z
games/backgammon/backgammon/version.c
JamesLinus/original-bsd
b44636d7febc9dcf553118bd320571864188351d
[ "Unlicense" ]
null
null
null
games/backgammon/backgammon/version.c
JamesLinus/original-bsd
b44636d7febc9dcf553118bd320571864188351d
[ "Unlicense" ]
29
2015-11-03T22:05:22.000Z
2022-02-08T15:36:37.000Z
/* * Copyright (c) 1980, 1987, 1993 * The Regents of the University of California. All rights reserved. * * %sccs.include.redist.c% */ #ifndef lint static char sccsid[] = "@(#)version.c 8.1 (Berkeley) 05/31/93"; #endif /* not lint */ char *message[] = { "Last updated on Saturday, January 11, 1986.", 0 };
19.75
69
0.639241
40892f6037ffaa6483116a96998e71fe831dbcf1
128
c
C
tools-src/gnu/gcc/gcc/testsuite/gcc.c-torture/unsorted/run.c
enfoTek/tomato.linksys.e2000.nvram-mod
2ce3a5217def49d6df7348522e2bfda702b56029
[ "FSFAP" ]
178
2016-03-03T12:31:18.000Z
2021-11-05T22:36:55.000Z
tools-src/gnu/gcc/gcc/testsuite/gcc.c-torture/unsorted/run.c
unforgiven512/tomato
96f09fab4929c6ddde5c9113f1b2476ad37133c4
[ "FSFAP" ]
106
2016-03-03T13:11:42.000Z
2018-09-27T13:01:51.000Z
tools-src/gnu/gcc/gcc/testsuite/gcc.c-torture/unsorted/run.c
unforgiven512/tomato
96f09fab4929c6ddde5c9113f1b2476ad37133c4
[ "FSFAP" ]
69
2015-01-02T10:45:56.000Z
2021-09-06T07:52:13.000Z
main () { typedef short int xtype; xtype i; xtype ii; for (i = 0; i < 100; i++) for (ii = 65535; --ii;) ; }
10.666667
27
0.460938
5666978edc858e903773b9ace4385b62b361d664
559
h
C
src/dir.h
jprjr/lua-music-visualizer
bdfe77c642e8924a8f2a9be04199c667e23a4635
[ "MIT" ]
4
2019-11-18T17:28:36.000Z
2021-11-20T21:07:08.000Z
src/dir.h
jprjr/lua-music-visualizer
bdfe77c642e8924a8f2a9be04199c667e23a4635
[ "MIT" ]
2
2020-09-08T12:32:12.000Z
2021-08-13T20:11:42.000Z
src/dir.h
jprjr/lua-music-visualizer
bdfe77c642e8924a8f2a9be04199c667e23a4635
[ "MIT" ]
null
null
null
#ifndef JPR_DIR_H #define JPR_DIR_H #include "int.h" /* Public-domain/CC0 - see https://creativecommons.org/publicdomain/zero/1.0/ */ typedef struct jpr_dir_s jpr_dir; typedef struct jpr_dire_s jpr_dire; struct jpr_dire_s { char *filename; char *path; int is_file; int is_dir; jpr_int64 mtime; jpr_uint64 size; }; #ifdef __cplusplus extern "C" { #endif jpr_dir *dir_open(const char *filename); int dir_close(jpr_dir *dir); jpr_dire *dir_read(jpr_dir *dir); void dire_free(jpr_dire *entry); #ifdef __cplusplus } #endif #endif
15.971429
80
0.72093
714900047767e7df2d36a5a880be3338ee252715
495
h
C
libs/sge_utils/src/sge_utils/utils/StringRegister.h
Alekssasho/sge_source
2db4ae08f7b3434d32dd9767fe1136234cb70b83
[ "MIT" ]
34
2021-06-15T10:24:49.000Z
2022-03-22T19:20:23.000Z
libs/sge_utils/src/sge_utils/utils/StringRegister.h
Alekssasho/sge_source
2db4ae08f7b3434d32dd9767fe1136234cb70b83
[ "MIT" ]
9
2021-03-04T21:34:03.000Z
2021-05-04T18:33:47.000Z
libs/sge_utils/src/sge_utils/utils/StringRegister.h
Alekssasho/sge_source
2db4ae08f7b3434d32dd9767fe1136234cb70b83
[ "MIT" ]
2
2021-12-29T01:15:22.000Z
2022-02-01T10:53:15.000Z
#pragma once #include <algorithm> #include <map> #include <string> namespace sge { // A class assigning a unique id for every requested string. // The zero is reserved and no string will be assigned with that variable. struct StringRegister { int getIndex(const std::string& str) { unsigned res = strings[str]; if (res != 0) return res; strings[str] = (int)strings.size(); return (int)strings.size(); } private: std::map<std::string, int> strings; }; } // namespace sge
17.068966
74
0.682828
ad65167c85391a6e24ac90f4658356fb83604e4e
631
h
C
ZLMLogManagerFramework.framework/Headers/ZLMLogManagerFramework.h
554277227/ZLMLogFramework
a154c5b640e2c618f373f9dc352dbf6d7f538101
[ "MIT" ]
null
null
null
ZLMLogManagerFramework.framework/Headers/ZLMLogManagerFramework.h
554277227/ZLMLogFramework
a154c5b640e2c618f373f9dc352dbf6d7f538101
[ "MIT" ]
null
null
null
ZLMLogManagerFramework.framework/Headers/ZLMLogManagerFramework.h
554277227/ZLMLogFramework
a154c5b640e2c618f373f9dc352dbf6d7f538101
[ "MIT" ]
null
null
null
// // ZLMLogManagerFramework.h // ZLMLogManagerFramework // // Created by 088 on 2018/8/3. // Copyright © 2018年 088. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for ZLMLogManagerFramework. FOUNDATION_EXPORT double ZLMLogManagerFrameworkVersionNumber; //! Project version string for ZLMLogManagerFramework. FOUNDATION_EXPORT const unsigned char ZLMLogManagerFrameworkVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <ZLMLogManagerFramework/PublicHeader.h> #import <ZLMLogManagerFramework/TestPodFrameworkManager.h>
30.047619
147
0.801902
42e81bc4e239fda7d6de7c151fd03ee9811121f7
3,725
c
C
tizen/workspace/TatySoundService/src/communication.c
maartenweyn/teamscheire_tatjana
35e8b6b57a0d7acfbf2c45c4800659d94ee6bd7c
[ "Apache-2.0" ]
4
2020-05-21T14:16:17.000Z
2020-10-27T16:26:19.000Z
tizen/workspace/TatySoundService/src/communication.c
maartenweyn/teamscheire_tatjana
35e8b6b57a0d7acfbf2c45c4800659d94ee6bd7c
[ "Apache-2.0" ]
8
2020-05-19T05:11:11.000Z
2020-10-12T13:14:25.000Z
tizen/workspace/TatySoundService/src/communication.c
maartenweyn/teamscheire_tatjana
35e8b6b57a0d7acfbf2c45c4800659d94ee6bd7c
[ "Apache-2.0" ]
null
null
null
/* * communication.c * * Created on: May 27, 2019 * Author: maartenweyn */ #include "communication.h" #include "tatysoundservice.h" #include <curl/curl.h> #include <net_connection.h> #include <Ecore.h> struct MemoryStruct { char *memory; size_t size; }; struct MemoryStruct chunk; static size_t read_callback(void *contents, size_t size, size_t nmemb, void *userp) { size_t realsize = size * nmemb; dlog_print(DLOG_INFO, LOG_TAG, "read_callback size: %d", realsize); dlog_print(DLOG_INFO, LOG_TAG, "read_callback %s", (char*) contents); return realsize; } int post_to_thingsboard(post_data_s data[], int lenght) { /* Initialize CURL */ CURL *curlHandler = curl_easy_init(); connection_h connection; int conn_err; conn_err = connection_create(&connection); if (conn_err != CONNECTION_ERROR_NONE) { /* Error handling */ return 1; } char *proxy_address; conn_err = connection_get_proxy(connection, CONNECTION_ADDRESS_FAMILY_IPV4, &proxy_address); if(curlHandler) { if (conn_err == CONNECTION_ERROR_NONE && proxy_address) curl_easy_setopt(curlHandler, CURLOPT_PROXY, proxy_address); /* Set CURL parameters */ curl_easy_setopt(curlHandler, CURLOPT_URL, thingsboard_url); struct curl_slist *list = NULL; list = curl_slist_append(list, "Content-Type: application/json"); curl_easy_setopt(curlHandler, CURLOPT_HTTPHEADER, list); curl_easy_setopt(curlHandler, CURLOPT_READFUNCTION, read_callback); curl_easy_setopt(curlHandler, CURLOPT_READDATA, (void *)&chunk); curl_easy_setopt(curlHandler, CURLOPT_TIMEOUT, 5); /* Now specify the POST data */ char json[300]; while (lenght > 0) { //int temp_length = snprintf(json, sizeof(json), "{\"ts\":%.0f,\"values\":{\"sound_level\":%.4f,\"min\":%.1f, \"hour\":%.1f,\"8hours\":%.1f,\"day\":%.1f,\"id\":%d,\"length\":%d,\"resp\":%d}}", data[lenght-1].ts * 1000, data[lenght-1].sound_level, data[lenght-1].leq_min, data[lenght-1].leq_hour, data[lenght-1].leq_8hours, data[lenght-1].leq_day, data[lenght-1].id, lenght, data[lenght-1].response); dlog_print(DLOG_INFO, LOG_TAG, "json %s", json); curl_easy_setopt(curlHandler, CURLOPT_POSTFIELDS, json); /* Perform the request */ CURLcode res = curl_easy_perform(curlHandler); if(res != CURLE_OK) { fprintf(stderr, "CURL failed: %s\n", curl_easy_strerror(res)); break; } lenght--; //todo delay needed? } // for (int i = 0; i < lenght; i++) { // char temp[200]; // //dlog_print(DLOG_INFO, LOG_TAG, "ts %f %.0f", data[i].ts, data[i].ts * 1000); // int temp_length = snprintf(temp, sizeof(temp), "{\"ts\":%.0f,\"values\":{\"sound_level\":%.4f,\"min\":%.1f, \"hour\":%.1f,\"8hours\":%.1f,\"day\":%.1f,\"id\":%d,\"length\":%d,\"resp\":%d}}", data[i].ts * 1000, data[i].sound_level, data[i].leq_min, data[i].leq_hour, data[i].leq_8hours, data[i].leq_day, data[i].id, lenght, data[i].response); // memcpy(&json[current_length], temp, temp_length); // current_length += temp_length; // if (i + 1 < lenght) { // json[current_length++] = ','; // } else { // json[current_length++] = ']'; // json[current_length++] = '\0'; // } // } // dlog_print(DLOG_INFO, LOG_TAG, "json %s", json); // // curl_easy_setopt(curlHandler, CURLOPT_POSTFIELDS, json); // //curl_easy_setopt(curlHandler, CURLOPT_VERBOSE, 1L); // // /* Perform the request */ // CURLcode res = curl_easy_perform(curlHandler); // // /* Check for errors */ // if(res != CURLE_OK) // fprintf(stderr, "CURL failed: %s\n", curl_easy_strerror(res)); /* Clean up */ curl_easy_cleanup(curlHandler); free(chunk.memory); connection_destroy(connection); if (lenght == 0) return 0; else return 1; //free(jObj); } return 2; }
29.330709
382
0.667919
1fb1bf326bc5db561abad52d4a31c65a78873ab7
2,936
h
C
TPUIKit/Classes/Tabbar/TPUITabItem.h
Topredator/TPUIKIt
6bb0584ac8181a748d22d69c88400e5a5d0803fa
[ "MIT" ]
2
2019-03-05T01:16:13.000Z
2021-12-10T06:27:24.000Z
TPUIKit/Classes/Tabbar/TPUITabItem.h
Topredator/TPUIKit
6bb0584ac8181a748d22d69c88400e5a5d0803fa
[ "MIT" ]
null
null
null
TPUIKit/Classes/Tabbar/TPUITabItem.h
Topredator/TPUIKit
6bb0584ac8181a748d22d69c88400e5a5d0803fa
[ "MIT" ]
null
null
null
// // TPUITabItem.h // TPUIKit // // Created by Topredator on 2020/8/22. // #import <UIKit/UIKit.h> // // TPUITabItem.h // TPUIKit // // Created by Topredator on 2019/6/22. // typedef NS_ENUM(NSInteger, TPUITabItemBadgeStyle) { TPUITabItemBadgeStyleNumber = 0, // 数字样式 TPUITabItemBadgeStyleDot = 1, // 圆点样式 }; /** 多选框item */ @interface TPUITabItem : UIButton /// 在父视图中的下标 @property (nonatomic, assign) NSUInteger index; /// 文字 @property (nonatomic, copy) NSString *title; /// 文字颜色 @property (nonatomic, strong) UIColor *titleColor; /// 选中的文字颜色 @property (nonatomic, strong) UIColor *titleSelectedColor; /// 文字font @property (nonatomic, strong) UIFont *titleFont; /// 选中的文字font @property (nonatomic, strong) UIFont *titleSelectedFont; /// 文字的宽 @property (nonatomic, assign, readonly) CGFloat titleWidth; /// 图片 @property (nonatomic, strong) UIImage *image; /// 选中时的图片 @property (nonatomic, strong) UIImage *selectedImage; /// badge类型 2种:数字,小圆点 @property (nonatomic, assign) TPUITabItemBadgeStyle badgeStyle; /** * 如果badgeStyle == XHXTabItemBadgeStyleNumber时,可设置此属性,显示badge值 * badge > 99, 显示99+ * badge <= 99 且 badge > 0, 显示具体数值 * badge <= 0, 不显示 */ @property (nonatomic, assign) NSInteger badge; /// badge背景颜色 @property (nonatomic, strong) UIColor *badgeBackgroundColor; /// badge文字颜色 @property (nonatomic, strong) UIColor *badgeTitleColor; /// badge文字font @property (nonatomic, strong) UIFont *badgeTitleFont; @property (nonatomic, assign) CGSize size; /// 设置指示器的边距嵌入 @property (nonatomic, assign) UIEdgeInsets indicatorInsets; /// 指示器的位置 @property (nonatomic, assign, readonly) CGRect indicatorFrame; /** * 用于记录tabItem在缩放前的frame, * 在tabBar的属性itemFontChangeFollowContentScroll == YES时会用到 */ @property (nonatomic, assign, readonly) CGRect frameWithOutTransform; /// 设置 Image与title 水平居中 @property (nonatomic, assign, getter=isContentHorizontalCenter) BOOL contentHorizontalCenter; /** * 设置Image和Title水平居中 * * @param verticalOffset 竖直方向的偏移量 * @param spacing Image与Title的间距 */ - (void)setContentHorizontalCenterWithVerticalOffset:(CGFloat)verticalOffset spacing:(CGFloat)spacing; /** * 设置数字Badge的位置 * * @param marginTop 与TabItem顶部的距离 * @param centerMarginRight 中心与TabItem右侧的距离 * @param titleHorizonalSpace 标题水平方向的空间 * @param titleVerticalSpace 标题竖直方向的空间 */ - (void)setNumberBadgeMarginTop:(CGFloat)marginTop centerMarginRight:(CGFloat)centerMarginRight titleHorizonalSpace:(CGFloat)titleHorizonalSpace titleVerticalSpace:(CGFloat)titleVerticalSpace; /** * 设置小圆点Badge的位置 * * @param marginTop 与TabItem顶部的距离 * @param centerMarginRight 中心与TabItem右侧的距离 * @param sideLength 小圆点的边长 */ - (void)setDotBadgeMarginTop:(CGFloat)marginTop centerMarginRight:(CGFloat)centerMarginRight sideLength:(CGFloat)sideLength; @end
26.93578
93
0.712875
b65f5a9efb7d45314ebd4103659f558375a91744
673
h
C
list/list.h
patdhlk/c
8890500930db5a6a10a74d600f0eed2843800259
[ "MIT" ]
null
null
null
list/list.h
patdhlk/c
8890500930db5a6a10a74d600f0eed2843800259
[ "MIT" ]
null
null
null
list/list.h
patdhlk/c
8890500930db5a6a10a74d600f0eed2843800259
[ "MIT" ]
null
null
null
// // Created by patrick on 09.11.2016. // #ifndef LIST_LIST_H #define LIST_LIST_H struct ListNode{ int id; char *name; struct ListNode *next; }; typedef struct ListNode *Node; extern Node CreateNode(int id, const char *name); extern void FreeNode(Node node); extern void Prepend(Node *head, Node node); extern void Append(Node *head, Node node); extern int Insert(Node *head, Node node, int pos); extern Node Find(Node head, int id, const char *name); extern void Remove(Node *head, Node node); extern void Print(Node node); extern void PrintList(Node head); extern void Clear(Node head); #ifdef _CH_ #pragma importf <list.c> #endif #endif //LIST_LIST_H
21.03125
54
0.726597
825532fece142af33ec805c8377802794508a60f
196
h
C
utils/includes/boost.h
CarlosPena00/VSS-Simulator
25ee8a36c77d44c5ff92afddda355115a9244f90
[ "MIT" ]
null
null
null
utils/includes/boost.h
CarlosPena00/VSS-Simulator
25ee8a36c77d44c5ff92afddda355115a9244f90
[ "MIT" ]
null
null
null
utils/includes/boost.h
CarlosPena00/VSS-Simulator
25ee8a36c77d44c5ff92afddda355115a9244f90
[ "MIT" ]
1
2018-09-05T20:29:07.000Z
2018-09-05T20:29:07.000Z
#ifndef _BOOSTS_H_ #define _BOOSTS_H_ #include <boost/program_options.hpp> #include <boost/algorithm/string.hpp> #include <boost/make_shared.hpp> namespace bpo = boost::program_options; #endif
17.818182
39
0.790816
05a2cb770a8223a377d747365850eb1e00b99dee
13,669
h
C
src/server/og.h
kojojacob/Krypto-trading-bot
cca784debc5c56072be5ca84d2c2bb23d3cf0ea5
[ "0BSD", "MIT" ]
null
null
null
src/server/og.h
kojojacob/Krypto-trading-bot
cca784debc5c56072be5ca84d2c2bb23d3cf0ea5
[ "0BSD", "MIT" ]
null
null
null
src/server/og.h
kojojacob/Krypto-trading-bot
cca784debc5c56072be5ca84d2c2bb23d3cf0ea5
[ "0BSD", "MIT" ]
null
null
null
#ifndef K_OG_H_ #define K_OG_H_ namespace K { class OG: public Klass, public Broker { public: OG() { broker = this; }; protected: void load() { for (json &it : sqlite->select(mMatter::Trades)) tradesHistory.push_back(it); screen->log("DB", string("loaded ") + to_string(tradesHistory.size()) + " historical Trades"); }; void waitData() { gw->evDataOrder = [&](mOrder k) { _debugEvent_ debug(string("reply ") + k.orderId + "::" + k.exchangeId + " [" + to_string((int)k.orderStatus) + "]: " + FN::str8(k.quantity) + "/" + FN::str8(k.tradeQuantity) + " at price " + FN::str8(k.price)); updateOrderState(k); }; }; void waitUser() { client->welcome(mMatter::Trades, &helloTrades); client->welcome(mMatter::OrderStatusReports, &helloOrders); client->clickme(mMatter::SubmitNewOrder, &kissSubmitNewOrder); client->clickme(mMatter::CancelOrder, &kissCancelOrder); client->clickme(mMatter::CancelAllOrders, &kissCancelAllOrders); client->clickme(mMatter::CleanAllClosedTrades, &kissCleanAllClosedTrades); client->clickme(mMatter::CleanAllTrades, &kissCleanAllTrades); client->clickme(mMatter::CleanTrade, &kissCleanTrade); }; void run() { if (args.debugOrders) return; debug = [](const string &k) {}; }; public: void sendOrder( vector<mRandId> toCancel, const mSide &side , const mPrice &price , const mAmount &qty , const mOrderType &type , const mTimeInForce &tif , const bool &isPong , const bool &postOnly ) { mRandId replaceOrderId; if (!toCancel.empty()) { replaceOrderId = side == mSide::Bid ? toCancel.back() : toCancel.front(); toCancel.erase(side == mSide::Bid ? toCancel.end()-1 : toCancel.begin()); for (mRandId &it : toCancel) cancelOrder(it); } if (gw->replace and !replaceOrderId.empty()) { if (!orders[replaceOrderId].exchangeId.empty()) { debug(string("update ") + (side == mSide::Bid ? "BID" : "ASK") + " id " + replaceOrderId + ": at price " + FN::str8(price) + " " + gw->quote); orders[replaceOrderId].price = price; gw->replace(orders[replaceOrderId].exchangeId, FN::str8(price)); } } else { if (args.testChamber != 1) cancelOrder(replaceOrderId); mRandId newOrderId = gw->randId(); updateOrderState(mOrder( newOrderId, mPair(gw->base, gw->quote), side, qty, type, isPong, price, tif, mStatus::New, postOnly )); mOrder *o = &orders[newOrderId]; debug(string(" send ") + replaceOrderId + "> " + (o->side == mSide::Bid ? "BID" : "ASK") + " id " + o->orderId + ": " + FN::str8(o->quantity) + " " + o->pair.base + " at price " + FN::str8(o->price) + " " + o->pair.quote); gw->place( o->orderId, o->side, FN::str8(o->price), FN::str8(o->quantity), o->type, o->timeInForce, o->preferPostOnly, o->time ); if (args.testChamber == 1) cancelOrder(replaceOrderId); } engine->orders_60s++; }; void cancelOrder(const mRandId &orderId) { if (orderId.empty()) return; mOrder *o = &orders[orderId]; if (o->exchangeId.empty() or o->_waitingCancel + 3e+3 > _Tstamp_) return; o->_waitingCancel = _Tstamp_; debug(string("cancel ") + (o->side == mSide::Bid ? "BID id " : "ASK id ") + o->orderId + "::" + o->exchangeId); gw->cancel(o->orderId, o->exchangeId); }; void cleanOrder(const mRandId &orderId) { debug(string("remove ") + orderId); map<mRandId, mOrder>::iterator it = orders.find(orderId); if (it != orders.end()) orders.erase(it); }; private: function<void(json*)> helloTrades = [&](json *welcome) { for (mTrade &it : tradesHistory) it.loadedFromDB = true; *welcome = tradesHistory; }; function<void(json*)> helloOrders = [&](json *welcome) { for (map<mRandId, mOrder>::value_type &it : orders) if (mStatus::Working == it.second.orderStatus) welcome->push_back(it.second); }; function<void(const json&)> kissCancelAllOrders = [&](const json &butterfly) { cancelOpenOrders(); }; function<void(const json&)> kissCleanAllClosedTrades = [&](const json &butterfly) { cleanClosedTrades(); }; function<void(const json&)> kissCleanAllTrades = [&](const json &butterfly) { cleanTrade(); }; function<void(const json&)> kissCleanTrade = [&](const json &butterfly) { if (butterfly.is_object() and butterfly["tradeId"].is_string()) cleanTrade(butterfly["tradeId"].get<string>()); }; function<void(const json&)> kissCancelOrder = [&](const json &butterfly) { mRandId orderId = (butterfly.is_object() and butterfly["orderId"].is_string()) ? butterfly["orderId"].get<mRandId>() : ""; if (orderId.empty() or orders.find(orderId) == orders.end()) return; cancelOrder(orderId); }; function<void(const json&)> kissSubmitNewOrder = [&](const json &butterfly) { sendOrder( vector<mRandId>(), butterfly.value("side", "") == "Bid" ? mSide::Bid : mSide::Ask, butterfly.value("price", 0.0), butterfly.value("quantity", 0.0), butterfly.value("orderType", "") == "Limit" ? mOrderType::Limit : mOrderType::Market, butterfly.value("timeInForce", "") == "GTC" ? mTimeInForce::GTC : (butterfly.value("timeInForce", "") == "FOK" ? mTimeInForce::FOK : mTimeInForce::IOC), false, false ); }; void updateOrderState(mOrder k) { bool saved = k.orderStatus != mStatus::New, working = k.orderStatus == mStatus::Working; if (!saved) orders[k.orderId] = k; else if (k.orderId.empty() and !k.exchangeId.empty()) for (map<mRandId, mOrder>::value_type &it : orders) if (k.exchangeId == it.second.exchangeId) { k.orderId = it.first; break; } if (k.orderId.empty() or orders.find(k.orderId) == orders.end()) return; mOrder *o = &orders[k.orderId]; o->orderStatus = k.orderStatus; if (!k.exchangeId.empty()) o->exchangeId = k.exchangeId; if (k.price) o->price = k.price; if (k.quantity) o->quantity = k.quantity; if (k.time) o->time = k.time; if (k.latency) o->latency = k.latency; if (!o->time) o->time = _Tstamp_; if (!o->latency and working) o->latency = _Tstamp_ - o->time; if (o->latency) o->time = _Tstamp_; if (k.tradeQuantity) { toHistory(o, k.tradeQuantity); gw->refreshWallet = true; } k.side = o->side; if (saved and !working) cleanOrder(o->orderId); else debug(string(" saved ") + (o->side == mSide::Bid ? "BID id " : "ASK id ") + o->orderId + "::" + o->exchangeId + " [" + to_string((int)o->orderStatus) + "]: " + FN::str8(o->quantity) + " " + o->pair.base + " at price " + FN::str8(o->price) + " " + o->pair.quote); debug(string("memory ") + to_string(orders.size())); if (saved) { wallet->calcWalletAfterOrder(k.side); toClient(working); } }; void cancelOpenOrders() { for (map<mRandId, mOrder>::value_type &it : orders) if (mStatus::New == it.second.orderStatus or mStatus::Working == it.second.orderStatus) cancelOrder(it.first); }; void cleanClosedTrades() { for (vector<mTrade>::iterator it = tradesHistory.begin(); it != tradesHistory.end();) if (it->Kqty < it->quantity) ++it; else { it->Kqty = -1; client->send(mMatter::Trades, *it); sqlite->insert(mMatter::Trades, {}, false, it->tradeId); it = tradesHistory.erase(it); } }; void cleanTrade(string k = "") { bool all = k.empty(); for (vector<mTrade>::iterator it = tradesHistory.begin(); it != tradesHistory.end();) if (!all and it->tradeId != k) ++it; else { it->Kqty = -1; client->send(mMatter::Trades, *it); sqlite->insert(mMatter::Trades, {}, false, it->tradeId); it = tradesHistory.erase(it); if (!all) break; } }; inline void toClient(bool working) { screen->log(orders, working); json k = json::array(); for (map<mRandId, mOrder>::value_type &it : orders) if (it.second.orderStatus == mStatus::Working) k.push_back(it.second); client->send(mMatter::OrderStatusReports, k); }; inline void toHistory(mOrder *o, double tradeQuantity) { mAmount fee = 0; mTrade trade( to_string(_Tstamp_), o->pair, o->price, tradeQuantity, o->side, o->time, abs(o->price * tradeQuantity), 0, 0, 0, 0, 0, fee, false ); wallet->calcSafetyAfterTrade(trade); screen->log(trade, o->isPong); if (qp._matchPings) { mPrice widthPong = qp.widthPercentage ? qp.widthPongPercentage * trade.price / 100 : qp.widthPong; map<mPrice, string> matches; for (mTrade &it : tradesHistory) if (it.quantity - it.Kqty > 0 and it.side != trade.side and (qp.pongAt == mPongAt::AveragePingFair or qp.pongAt == mPongAt::AveragePingAggressive or (trade.side == mSide::Bid ? (it.price > trade.price + widthPong) : (it.price < trade.price - widthPong) ) ) ) matches[it.price] = it.tradeId; matchPong( matches, trade, (qp.pongAt == mPongAt::LongPingFair or qp.pongAt == mPongAt::LongPingAggressive) ? trade.side == mSide::Ask : trade.side == mSide::Bid ); } else { client->send(mMatter::Trades, trade); sqlite->insert(mMatter::Trades, trade, false, trade.tradeId); tradesHistory.push_back(trade); } client->send(mMatter::TradesChart, { {"price", trade.price}, {"side", trade.side}, {"quantity", trade.quantity}, {"value", trade.value}, {"pong", o->isPong} }); if (qp.cleanPongsAuto) cleanAuto(trade.time); }; void matchPong(map<mPrice, string> matches, mTrade pong, bool reverse) { if (reverse) for (map<mPrice, string>::reverse_iterator it = matches.rbegin(); it != matches.rend(); ++it) { if (!matchPong(it->second, &pong)) break; } else for (map<mPrice, string>::iterator it = matches.begin(); it != matches.end(); ++it) if (!matchPong(it->second, &pong)) break; if (pong.quantity > 0) { bool eq = false; for (mTrade &it : tradesHistory) { if (it.price!=pong.price or it.side!=pong.side or it.quantity<=it.Kqty) continue; eq = true; it.time = pong.time; it.quantity = it.quantity + pong.quantity; it.value = it.value + pong.value; it.loadedFromDB = false; client->send(mMatter::Trades, it); sqlite->insert(mMatter::Trades, it, false, it.tradeId); break; } if (!eq) { client->send(mMatter::Trades, pong); sqlite->insert(mMatter::Trades, pong, false, pong.tradeId); tradesHistory.push_back(pong); } } }; bool matchPong(string match, mTrade* pong) { for (mTrade &it : tradesHistory) { if (it.tradeId != match) continue; mAmount Kqty = fmin(pong->quantity, it.quantity - it.Kqty); it.Ktime = pong->time; it.Kprice = ((Kqty*pong->price) + (it.Kqty*it.Kprice)) / (it.Kqty+Kqty); it.Kqty = it.Kqty + Kqty; it.Kvalue = abs(it.Kqty*it.Kprice); pong->quantity = pong->quantity - Kqty; pong->value = abs(pong->price*pong->quantity); if (it.quantity<=it.Kqty) it.Kdiff = abs(it.quantity * it.price - it.Kqty * it.Kprice); it.loadedFromDB = false; client->send(mMatter::Trades, it); sqlite->insert(mMatter::Trades, it, false, it.tradeId); break; } return pong->quantity > 0; }; void cleanAuto(mClock now) { mClock pT_ = now - (abs(qp.cleanPongsAuto) * 86400e3); for (vector<mTrade>::iterator it = tradesHistory.begin(); it != tradesHistory.end();) if ((it->Ktime?:it->time) < pT_ and (qp.cleanPongsAuto < 0 or it->Kqty >= it->quantity)) { it->Kqty = -1; client->send(mMatter::Trades, *it); sqlite->insert(mMatter::Trades, {}, false, it->tradeId); it = tradesHistory.erase(it); } else ++it; }; function<void(const string&)> debug = [&](const string &k) { screen->log("DEBUG", string("OG ") + k); }; }; } #endif
42.450311
275
0.534494
197869edee461bbb310a9ebdc21d59ff2443058a
5,293
h
C
StoreExportPanel/Mocha.framework/Versions/Current/PrivateHeaders/MOBridgeSupportSymbol.h
stormbuster/sketch-localise
48a999884ffb611239afee5ef6b5fc3a43ef03ef
[ "MIT" ]
538
2015-01-05T15:28:58.000Z
2022-02-17T21:27:39.000Z
StoreExportPanel/Mocha.framework/Versions/Current/PrivateHeaders/MOBridgeSupportSymbol.h
stormbuster/sketch-localise
48a999884ffb611239afee5ef6b5fc3a43ef03ef
[ "MIT" ]
40
2015-01-20T22:42:47.000Z
2021-09-07T14:49:32.000Z
StoreExportPanel/Mocha.framework/Versions/Current/PrivateHeaders/MOBridgeSupportSymbol.h
stormbuster/sketch-localise
48a999884ffb611239afee5ef6b5fc3a43ef03ef
[ "MIT" ]
52
2015-02-18T20:46:38.000Z
2021-12-25T01:06:22.000Z
// // MOBridgeSupportSymbol.h // Mocha // // Created by Logan Collins on 5/11/12. // Copyright (c) 2012 Sunflower Softworks. All rights reserved. // #import <Foundation/Foundation.h> @class MOBridgeSupportArgument; /*! * @class MOBridgeSupportSymbol * @abstract Abstract superclass of all symbols */ @interface MOBridgeSupportSymbol : NSObject @property (copy) NSString *name; @end /*! * @class MOBridgeSupportStruct * @abstract Describes a C struct */ @interface MOBridgeSupportStruct : MOBridgeSupportSymbol @property (copy) NSString *type; @property (copy) NSString *type64; @property (getter=isOpaque) BOOL opaque; @end /*! * @class MOBridgeSupportCFType * @abstract Describes a Core Foundation-based type */ @interface MOBridgeSupportCFType : MOBridgeSupportSymbol @property (copy) NSString *type; @property (copy) NSString *type64; @property (copy) NSString *tollFreeBridgedClassName; @property (copy) NSString *getTypeIDFunctionName; @end /*! * @class MOBridgeSupportOpaque * @abstract Describes an opaque type, most generally a C pointer to a C opaque structure */ @interface MOBridgeSupportOpaque : MOBridgeSupportSymbol @property (copy) NSString *type; @property (copy) NSString *type64; @property BOOL hasMagicCookie; @end /*! * @class MOBridgeSupportConstant * @abstract Describes a C constant */ @interface MOBridgeSupportConstant : MOBridgeSupportSymbol @property (copy) NSString *type; @property (copy) NSString *type64; @property BOOL hasMagicCookie; @end /*! * @class MOBridgeSupportStringConstant * @abstract Describes a string constant */ @interface MOBridgeSupportStringConstant : MOBridgeSupportSymbol @property (copy) NSString *value; @property BOOL hasNSString; @end /*! * @class MOBridgeSupportEnum * @abstract Describes a C enumeration */ @interface MOBridgeSupportEnum : MOBridgeSupportSymbol @property (copy) NSNumber *value; @property (copy) NSNumber *value64; @property (getter=isIgnored) BOOL ignored; @property (copy) NSString *suggestion; @end /*! * @class MOBridgeSupportFunction * @abstract Describes a C function */ @interface MOBridgeSupportFunction : MOBridgeSupportSymbol @property (getter=isVariadic) BOOL variadic; @property (copy) NSNumber *sentinel; @property (getter=isInlineFunction) BOOL inlineFunction; @property (copy) NSArray *arguments; - (void)addArgument:(MOBridgeSupportArgument *)argument; - (void)removeArgument:(MOBridgeSupportArgument *)argument; @property (strong) MOBridgeSupportArgument *returnValue; @end /*! * @class MOBridgeSupportFunctionAlias * @abstract Describes an alias or shortcut to a C function */ @interface MOBridgeSupportFunctionAlias : MOBridgeSupportSymbol @property (copy) NSString *original; @end @class MOBridgeSupportMethod; /*! * @class MOBridgeSupportClass * @abstract Describes an Objective-C class */ @interface MOBridgeSupportClass : MOBridgeSupportSymbol @property (copy) NSArray *methods; - (void)addMethod:(MOBridgeSupportMethod *)method; - (void)removeMethod:(MOBridgeSupportMethod *)method; - (MOBridgeSupportMethod *)methodWithSelector:(SEL)selector; @end /*! * @class MOBridgeSupportInformalProtocol * @abstract Describes an Objective-C informal protocol */ @interface MOBridgeSupportInformalProtocol : MOBridgeSupportSymbol @property (copy) NSArray *methods; - (void)addMethod:(MOBridgeSupportMethod *)method; - (void)removeMethod:(MOBridgeSupportMethod *)method; - (MOBridgeSupportMethod *)methodWithSelector:(SEL)selector; @end /*! * @class MOBridgeSupportMethod * @abstract Describes an Objective-C method */ @interface MOBridgeSupportMethod : MOBridgeSupportSymbol @property SEL selector; @property (copy) NSString *type; @property (copy) NSString *type64; @property (copy) NSArray *arguments; - (void)addArgument:(MOBridgeSupportArgument *)argument; - (void)removeArgument:(MOBridgeSupportArgument *)argument; @property (strong) MOBridgeSupportArgument *returnValue; @property (getter=isClassMethod) BOOL classMethod; @property (getter=isVariadic) BOOL variadic; @property (copy) NSNumber *sentinel; @property (getter=isIgnored) BOOL ignored; @property (copy) NSString *suggestion; @end /*! * @class MOBridgeSupportArgument * @abstract Describes an argument or return value */ @interface MOBridgeSupportArgument : NSObject @property (copy) NSString *type; @property (copy) NSString *type64; @property (copy) NSString *typeModifier; @property (copy) NSString *signature; @property (copy) NSString *signature64; @property (copy) NSString *cArrayLengthInArg; @property (getter=isCArrayOfFixedLength) BOOL cArrayOfFixedLength; @property (getter=isCArrayDelimitedByNull) BOOL cArrayDelimitedByNull; @property (getter=isCArrayOfVariableLength) BOOL cArrayOfVariableLength; @property (getter=isCArrayLengthInReturnValue) BOOL cArrayLengthInReturnValue; @property NSUInteger index; @property BOOL acceptsNull; @property BOOL acceptsPrintfFormat; @property (getter=isAlreadyRetained) BOOL alreadyRetained; @property (getter=isFunctionPointer) BOOL functionPointer; @property (copy) NSArray *arguments; - (void)addArgument:(MOBridgeSupportArgument *)argument; - (void)removeArgument:(MOBridgeSupportArgument *)argument; @property (strong) MOBridgeSupportArgument *returnValue; @end
22.427966
89
0.778764
c96b5ca39be62bdeda4071ce6c46280f458c4449
68
c
C
vendor/grep-2.21/gnulib-tests/inttostr.c
junsulee/c-goof
240c979dd014ed3bb9c8dddf5d0e66afb6a8c2f2
[ "Apache-2.0" ]
432
2015-01-03T20:05:29.000Z
2022-03-24T16:39:09.000Z
vendor/grep-2.21/gnulib-tests/inttostr.c
junsulee/c-goof
240c979dd014ed3bb9c8dddf5d0e66afb6a8c2f2
[ "Apache-2.0" ]
8
2015-12-03T15:45:38.000Z
2020-12-25T15:42:08.000Z
external/gnu-coreutils/lib/inttostr.c
ucsd-progsys/csolve-bak
89cfeb5403e617f45ece4bae9f88f8e6cd7ca934
[ "BSD-3-Clause" ]
114
2015-01-07T16:23:00.000Z
2022-03-23T18:26:01.000Z
#define anytostr inttostr #define inttype int #include "anytostr.c"
17
25
0.794118
c727b71944aeff9a87a8b62a59c33566ed79b4b5
3,160
h
C
Android/widget/HeaderViewListAdapter.h
mxenabled/androidpp
5fd587157232d1d92bcc9402c0b9acfb5e65034b
[ "ICU", "BSD-3-Clause", "Apache-2.0", "MIT" ]
3
2016-03-25T14:11:57.000Z
2021-08-24T19:46:11.000Z
Android/widget/HeaderViewListAdapter.h
mxenabled/androidpp
5fd587157232d1d92bcc9402c0b9acfb5e65034b
[ "ICU", "BSD-3-Clause", "Apache-2.0", "MIT" ]
null
null
null
Android/widget/HeaderViewListAdapter.h
mxenabled/androidpp
5fd587157232d1d92bcc9402c0b9acfb5e65034b
[ "ICU", "BSD-3-Clause", "Apache-2.0", "MIT" ]
2
2018-01-18T04:38:16.000Z
2019-05-29T02:20:44.000Z
// // HeaderViewListAdapter.h // Androidpp // // Created by Saul Howard on 2/11/14. // Copyright (c) 2014 MoneyDesktop. All rights reserved. // #ifndef __Androidpp__HeaderViewListAdapter__ #define __Androidpp__HeaderViewListAdapter__ #include "AndroidMacros.h" #include "Android/widget/Filterable.h" #include "Android/widget/ListView.h" #include "Android/widget/WrapperListAdapter.h" #include <memory> #include <vector> using namespace std; ANDROID_BEGIN class Filter; class Object; class View; /** * ListAdapter used when a ListView has header views. This ListAdapter * wraps another one and also keeps track of the header views and their * associated data objects. *<p>This is intended as a base class; you will probably not need to * use this class directly in your own code. */ class HeaderViewListAdapter : public WrapperListAdapter, public Filterable { private: shared_ptr<ListAdapter> mAdapter; shared_ptr<Filterable> mFilterableAdapter; /** * The item view type returned by {@link Adapter#getItemViewType(int)} when * the item is a header or footer. */ static const int ITEM_VIEW_TYPE_HEADER_OR_FOOTER = -2; protected: // These two vector are assumed to NOT be NULL. // They are indeed created when declared in ListView and then shared. vector<ListView::FixedViewInfo> &mHeaderViewInfos; vector<ListView::FixedViewInfo> &mFooterViewInfos; // Used as a placeholder in case the provided info views are indeed NULL. // Currently only used by some CTS tests, which may be removed. static vector<ListView::FixedViewInfo> EMPTY_INFO_LIST; bool mAreAllFixedViewsSelectable; private: bool mIsFilterable = false; public: HeaderViewListAdapter(vector<ListView::FixedViewInfo> &headerViewInfos, vector<ListView::FixedViewInfo> &footerViewInfos, shared_ptr<ListAdapter> adapter); int getHeadersCount() { return mHeaderViewInfos.size(); } int getFootersCount() { return mFooterViewInfos.size(); } bool isEmpty() { return mAdapter == NULL || mAdapter->isEmpty(); } private: bool areAllListInfosSelectable(vector<ListView::FixedViewInfo> infos); public: bool removeHeader(shared_ptr<View> v); bool removeFooter(shared_ptr<View> v); int getCount(); bool areAllItemsEnabled(); bool isEnabled(int position); shared_ptr<Object> getItem(int position); long getItemId(int position); bool hasStableIds(); shared_ptr<View> getView(int position, shared_ptr<View> convertView, ViewGroup *parent); int getItemViewType(int position); int getViewTypeCount(); void registerDataSetObserver(DataSetObserver *observer); void unregisterDataSetObserver(DataSetObserver *observer); shared_ptr<Filter> getFilter(); shared_ptr<ListAdapter> getWrappedAdapter() { return mAdapter; } }; ANDROID_END #endif /* defined(__Androidpp__HeaderViewListAdapter__) */
25.079365
92
0.687025
24347c268ab5fa88f1a845e8fa1e854b0bcaf6fd
3,638
h
C
Source/SprueEngine/EventBus.h
Qt-Widgets/TexGraph
8fe72cea1afcf5e235c810003bf4ee062bb3fc13
[ "MIT" ]
35
2017-04-07T22:49:41.000Z
2021-08-03T13:59:20.000Z
Source/SprueEngine/EventBus.h
Qt-Widgets/TexGraph
8fe72cea1afcf5e235c810003bf4ee062bb3fc13
[ "MIT" ]
1
2017-04-13T17:43:54.000Z
2017-04-15T04:17:37.000Z
Source/SprueEngine/EventBus.h
Qt-Widgets/TexGraph
8fe72cea1afcf5e235c810003bf4ee062bb3fc13
[ "MIT" ]
7
2019-03-11T19:26:53.000Z
2021-03-04T07:17:10.000Z
#pragma once #include <SprueEngine/Variant.h> #include <functional> #include <unordered_map> namespace SprueEngine { typedef void (*SPRUE_EVENT_FUNCTION)(unsigned, VariantMap&); class EventBus; class SPRUE EventReceiver { friend class EventBus; bool ignoreRemoval_ = false; std::vector< std::pair<EventBus*, unsigned> > listeningTo_; void Event_AddBus(EventBus* bus); public: virtual ~EventReceiver(); void Event_Remove(EventBus* listeningTo); }; /// General purpose event dispatcher. May place on anything that needs to send events. /// Event_XXX function naming to minimize name collision possibilities. class SPRUE EventBus { struct EventDispatch { virtual void Dispatch(void* object, unsigned eventID, VariantMap& data) = 0; }; struct EventRecord { EventBus* bus = 0x0; EventReceiver* object = 0x0; SPRUE_EVENT_FUNCTION function = 0x0; EventDispatch* dispatch = 0x0; EventRecord(EventBus* bus, EventReceiver* object, SPRUE_EVENT_FUNCTION func, EventDispatch* disp) : bus(bus), object(object), function(func), dispatch(disp) { } ~EventRecord(); void Dispatch(unsigned eventID, VariantMap& data); }; template<typename T> struct EventDispatchImpl { typedef void(T::*CALL_METHOD)(unsigned, VariantMap&); EventDispatchImpl(CALL_METHOD call) : call_(call) { } CALL_METHOD call_; virtual void Dispatch(void* object, unsigned eventID, VariantMap& data) override { (((T*)object)->*call_)(eventID, data); } }; /// Handle subscription of arbitrary EventDispatchImpl void Event_Subscribe(EventReceiver* object, unsigned eventID, EventDispatch* dispatch); public: /// Clean up all events. virtual ~EventBus(); /// Subscribe a free-function to an event. void Event_Subscribe(unsigned eventID, SPRUE_EVENT_FUNCTION func); /// Subscribe a class method and instance to an event. template<typename T> void Event_Subscribe(T* listener, unsigned eventID, int (T::*METHOD)(char, float)) { Event_Subscribe(listener, eventID, new EventDispatchImpl<T>(METHOD)); } /// Send an event that lacks data. void Event_Send(unsigned eventID); /// Send an event with the given data map. void Event_Send(unsigned eventID, VariantMap& eventMap); /// Remove any events from the given listener for an Event ID void Event_Remove(EventReceiver* listener, unsigned eventID); /// Remove any events from the given function for an Event ID void Event_Remove(SPRUE_EVENT_FUNCTION func, unsigned eventID); /// Remove all events for the given ID void Event_RemoveAll(unsigned eventID); /// Remove all events associated with the given listener void Event_RemoveAll(EventReceiver* listener); /// Remove ALL events. Period. void Event_Clear(); /// Get a static shared eventdata map for loading. static VariantMap& Event_GetEventDataMap() { return eventDataMap_; } private: std::unordered_map<unsigned, std::vector<EventRecord> > eventRecords_; static VariantMap eventDataMap_; }; }
34.647619
113
0.607477
db68af9b74c7bc3d0e8bdae003a40a4727415f53
534
h
C
src/van_lex.h
liufeigit/Van-lang
f22cb6a3b0ae80914d7679319cf7c075f7009f94
[ "MIT" ]
7
2019-08-07T02:38:19.000Z
2021-01-16T13:54:05.000Z
src/van_lex.h
liufeigit/Van
f22cb6a3b0ae80914d7679319cf7c075f7009f94
[ "MIT" ]
null
null
null
src/van_lex.h
liufeigit/Van
f22cb6a3b0ae80914d7679319cf7c075f7009f94
[ "MIT" ]
2
2019-08-07T07:19:12.000Z
2019-12-20T23:21:35.000Z
#ifndef VAN_LEX_H #define VAN_LEX_H #ifdef __cplusplus extern "C" { #endif #include <stdio.h> #include "van_enum.h" typedef struct Token{ TokenType type; TokenSubType subType; union { long long l; double d; } value; // int/float char *data; // indentify/string struct Token *next; struct Token *pre; unsigned int row; unsigned int column; } Token; int lexStr(char *str,Token **headToken,Token **tailToken); void freeToken(Token *token); void debugToken(Token *token); #ifdef __cplusplus } #endif #endif
12.136364
58
0.70412
57eb3f8ad64451c94cabb10c21833d6eadd1b4da
209
h
C
NewRetail-iOS/NewRetail-iOS/ViewController.h
yuankai1993/develop
d7ed6b6e0fe32349306f521df92ad5b654caac73
[ "Apache-2.0" ]
null
null
null
NewRetail-iOS/NewRetail-iOS/ViewController.h
yuankai1993/develop
d7ed6b6e0fe32349306f521df92ad5b654caac73
[ "Apache-2.0" ]
null
null
null
NewRetail-iOS/NewRetail-iOS/ViewController.h
yuankai1993/develop
d7ed6b6e0fe32349306f521df92ad5b654caac73
[ "Apache-2.0" ]
null
null
null
// // ViewController.h // NewRetail-iOS // // Created by HJL on 2018/11/21. // Copyright © 2018年 HJL. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
13.0625
47
0.679426
b96a733f572d26bc03d06d0e05e64ab2b71828ef
9,763
c
C
src/vita/container/vec.c
kirillsaidov/vita
f6d27f0eb8f8ef9fdd1273e4da16960e77069cbb
[ "MIT" ]
null
null
null
src/vita/container/vec.c
kirillsaidov/vita
f6d27f0eb8f8ef9fdd1273e4da16960e77069cbb
[ "MIT" ]
null
null
null
src/vita/container/vec.c
kirillsaidov/vita
f6d27f0eb8f8ef9fdd1273e4da16960e77069cbb
[ "MIT" ]
null
null
null
#include "vita/container/vec.h" vec_t *vec_new(void) { vec_t *v = malloc(sizeof(vec_t)); if(v == NULL) { return NULL; } // default-init *v = (vec_t) {}; return v; } enum VitaError vec_ctor(vec_t *const v, const size_t n, const size_t elsize) { // check if v was allocated if(v == NULL) { return ve_error_is_null; } // vec_t init *v = (vec_t) { .ptr = calloc(n, elsize), .len = 0, .capacity = n, .elsize = elsize, }; // checking if v->ptr was allocated if(v->ptr == NULL) { return ve_error_allocation; } return ve_operation_success; } vec_t *vec_dup(const vec_t *const v) { if(v == NULL) { return NULL; } // allocate a new vec_t instance vec_t *vdup = vec_new(); if(vdup == NULL) { return NULL; } // construct vdup and resize it if(vec_ctor(vdup, v->capacity, v->elsize) != ve_operation_success || vec_resize(vdup, v->len) != ve_operation_success) { vec_free(vdup); return NULL; } // copy values memcpy(vdup->ptr, v->ptr, v->len * v->elsize); return vdup; } void vec_dtor(vec_t *const v) { // if NULL, exit if(v == NULL) { return; } // free vec_t contents free(v->ptr); // default-init *v = (vec_t) {}; } void vec_free(vec_t *v) { // if NULL, exit if(v == NULL) { return; } // free the vec_t free(v); // reset to NULL v = NULL; } vec_t *vec_create(const size_t n, const size_t elsize) { vec_t *v = vec_new(); if(v == NULL) { return NULL; } if(vec_ctor(v, n, elsize) != ve_operation_success) { vec_free(v); return NULL; } return v; } void vec_destroy(vec_t *v) { vec_dtor(v); vec_free(v); } size_t vec_len(const vec_t *const v) { return v->len; } size_t vec_capacity(const vec_t *const v) { return v->capacity; } size_t vec_has_space(const vec_t *const v) { return (v->capacity - v->len); } bool vec_is_empty(const vec_t *const v) { return !(v->len); } enum VitaError vec_shrink(vec_t *const v) { if(v == NULL) { return ve_error_is_null; } // if length and capacity are the same, exit the function if(v->len == v->capacity) { return ve_operation_success; } // shrink the array capacity to length void *newptr = realloc(v->ptr, v->len * v->elsize); if(newptr == NULL) { return ve_error_allocation; } // update values v->ptr = newptr; v->capacity = v->len; return ve_operation_success; } enum VitaError vec_clear(vec_t *const v) { if(v == NULL) { return ve_error_is_null; } // update length v->len = 0; return ve_operation_success; } enum VitaError vec_reserve(vec_t *const v, const size_t n) { if(v == NULL || !n) { return ve_error_is_null; } // reserve memory for additional n elements void *newptr = realloc(v->ptr, (v->capacity + n) * v->elsize); if(newptr == NULL) { return ve_error_allocation; } // update values v->ptr = newptr; v->capacity += n; return ve_operation_success; } enum VitaError vec_resize(vec_t *const v, const size_t n) { if(v == NULL) { return ve_error_is_null; } // cannot resize to 0 if(n == 0) { return ve_operation_failure; } if(n == v->capacity) { v->len = v->capacity; return ve_operation_success; } // resize vec_t void *newptr = realloc(v->ptr, n * v->elsize); if(newptr == NULL) { return ve_error_allocation; } // update values v->ptr = newptr; v->len = v->capacity = n; return ve_operation_success; } enum VitaError vec_push(vec_t *const v, const void *const val) { if(v == NULL || val == NULL) { return ve_error_is_null; } // check if new memory needs to be allocated if(!vec_has_space(v) && vec_reserve(v, v->capacity * CONTAINER_GROWTH_RATE) != ve_operation_success) { return ve_error_allocation; } // copy val to vec_t memcpy((v->ptr + v->len++ * v->elsize), val, v->elsize); return ve_operation_success; } enum VitaError vec_pushi32(vec_t *const v, const int val) { if(v == NULL) { return ve_error_is_null; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_push(v, &val); } enum VitaError vec_pushi64(vec_t *const v, const long val) { if(v == NULL) { return ve_error_is_null; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_push(v, &val); } enum VitaError vec_pushf(vec_t *const v, const float val) { if(v == NULL) { return ve_error_is_null; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_push(v, &val); } enum VitaError vec_pushd(vec_t *const v, const double val) { if(v == NULL) { return ve_error_is_null; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_push(v, &val); } enum VitaError vec_pop(vec_t *const v) { if(v == NULL) { return ve_error_is_null; } // update length v->len--; return ve_operation_success; } void *vec_pop_get(vec_t *const v) { if(v == NULL) { return NULL; } // pop the last element return (v->ptr + --v->len * v->elsize); } enum VitaError vec_set(vec_t *const v, const void *const val, const size_t at) { if(v == NULL || val == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } // copy val data to str_t memcpy((v->ptr + at * v->elsize), val, v->elsize); return ve_operation_success; } enum VitaError vec_seti32(vec_t *const v, const int val, const size_t at) { if(v == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_set(v, &val, at); } enum VitaError vec_seti64(vec_t *const v, const long val, const size_t at) { if(v == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_set(v, &val, at); } enum VitaError vec_setf(vec_t *const v, const float val, const size_t at) { if(v == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_set(v, &val, at); } enum VitaError vec_setd(vec_t *const v, const double val, const size_t at) { if(v == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } if(v->elsize != sizeof(val)) { return ve_error_incompatible_datatype; } return vec_set(v, &val, at); } void *vec_get(const vec_t *const v, const size_t at) { if(v == NULL || !(at < v->len)) { return NULL; } return (v->ptr + at * v->elsize); } int32_t vec_geti32(const vec_t *const v, const size_t at) { return *(int32_t*)(vec_get(v, at)); } int64_t vec_geti64(const vec_t *const v, const size_t at) { return *(int64_t*)(vec_get(v, at)); } float vec_getf(const vec_t *const v, const size_t at) { return *(float*)(vec_get(v, at)); } double vec_getd(const vec_t *const v, const size_t at) { return *(double*)(vec_get(v, at)); } enum VitaError vec_insert(vec_t *const v, const void *const val, const size_t at) { if(v == NULL || val == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } // check if new memory needs to be allocated if(!vec_has_space(v) && !vec_reserve(v, v->capacity * CONTAINER_GROWTH_RATE)) { return ve_error_allocation; } // shift values by one value to the end of the vec_t memmove((v->ptr + (at + 1) * v->elsize), (v->ptr + at * v->elsize), ((v->len - at) * v->elsize)); // copy the str contents to str from the specified index memcpy((v->ptr + at * v->elsize), val, v->elsize); // set new length v->len++; return ve_operation_success; } enum VitaError vec_remove(vec_t *const v, const size_t at, const enum RemoveStrategy rs) { if(v == NULL) { return ve_error_is_null; } if(!(at < v->len)) { return ve_error_out_of_bounds_access; } // check remove strategy if(rs == rs_stable) { memmove(v->ptr + at * v->elsize, v->ptr + (at + 1) * v->elsize, (v->len - at) * v->elsize); } else { gswap(v->ptr + at * v->elsize, v->ptr + (v->len - 1) * v->elsize, v->elsize); } // set new length v->len--; return ve_operation_success; } int64_t vec_contains(const vec_t *const v, const void *const val) { if(v == NULL || val == NULL) { return -1; } size_t i = 0; for (void *iter = v->ptr; iter != v->ptr + v->len * v->elsize; iter += v->elsize, i++) { if(memcmp(iter, val, v->elsize) == 0) { return i; } } return -1; } void vec_foreach(const vec_t *const v, void (*func)(void*, size_t)) { if(v == NULL || func == NULL) { return; } size_t i = 0; for(void *iter = v->ptr; iter != v->ptr + v->len * v->elsize; iter += v->elsize, i++) { func(iter, i); } }
21.177874
124
0.578203
3b4ccd8528aa23a3e920f50c1fffcbdd214c7051
1,960
h
C
include/nwc-toolkit/token-trie.h
tkubotake/nwc-toolkit
0f15669cf70b767724a11cb73f8e634765fee365
[ "BSD-3-Clause" ]
6
2017-04-06T01:49:36.000Z
2021-03-14T15:01:59.000Z
include/nwc-toolkit/token-trie.h
tkubotake/nwc-toolkit
0f15669cf70b767724a11cb73f8e634765fee365
[ "BSD-3-Clause" ]
null
null
null
include/nwc-toolkit/token-trie.h
tkubotake/nwc-toolkit
0f15669cf70b767724a11cb73f8e634765fee365
[ "BSD-3-Clause" ]
1
2021-12-24T22:23:29.000Z
2021-12-24T22:23:29.000Z
// Copyright 2010 Susumu Yata <syata@acm.org> #ifndef NWC_TOOLKIT_TOKEN_TRIE_H_ #define NWC_TOOLKIT_TOKEN_TRIE_H_ #include <utility> #include <vector> #include "./token-trie-node.h" namespace nwc_toolkit { class TokenTrie { public: enum { MIN_MAX_DEPTH = 1, MIN_MEMORY_USAGE = 1 << 20, DEFAULT_MAX_DEPTH = 5, DEFAULT_MEMORY_USAGE = 256 << 20 }; enum { ROOT_NODE_ID = 0, INVALID_NODE_ID = TokenTrieNode::INVALID_NODE_ID, INVALID_TOKEN_ID = TokenTrieNode::INVALID_TOKEN_ID, }; TokenTrie(); ~TokenTrie() { Clear(); } std::size_t max_depth() const { return max_depth_; } std::size_t memory_usage() const { return memory_usage_; } std::size_t table_size() const { return table_.size(); } std::size_t num_nodes() const { return num_nodes_; } std::size_t total_length() const { return total_length_; } int max_freq() const { return max_freq_; } const TokenTrieNode &node(std::size_t node_id) const { return table_[node_id]; } bool is_empty() const { return num_nodes_ == 0; } void Reset(std::size_t max_depth = 0, std::size_t memory_usage = 0); void Clear(); void Insert(const int *tokens, std::size_t num_tokens); private: std::size_t max_depth_; std::size_t memory_usage_; std::vector<TokenTrieNode> table_; std::size_t num_nodes_; std::size_t total_length_; int max_freq_; void InitTable(); std::pair<int, bool> InsertNode(int prev_node_id, int token_id); int FindNext(int prev_node_id, int token_id) const; static unsigned int Hash(unsigned long long x) { x = (~x) + (x << 18); x = x ^ (x >> 31); x = x * 21; x = x ^ (x >> 11); x = x + (x << 6); x = x ^ (x >> 22); return static_cast<unsigned int>(x); } // Disallows copy and assignment. TokenTrie(const TokenTrie &); TokenTrie &operator=(const TokenTrie &); }; } // namespace nwc_toolkit #endif // NWC_TOOLKIT_TOKEN_TRIE_H_
21.075269
70
0.657143
fe09cd3876e1f97124a0eccfb94190c9c3b5dbf9
5,367
c
C
src/parse.c
free-unife/operating-systems-and-lab
10a75d1233d72b2a0d44b502dafac17cafce4077
[ "WTFPL" ]
null
null
null
src/parse.c
free-unife/operating-systems-and-lab
10a75d1233d72b2a0d44b502dafac17cafce4077
[ "WTFPL" ]
null
null
null
src/parse.c
free-unife/operating-systems-and-lab
10a75d1233d72b2a0d44b502dafac17cafce4077
[ "WTFPL" ]
null
null
null
/* * parse.c * * Copyright © 2017 Franco Masotti <franco.masotti@student.unife.it> * This work is free. You can redistribute it and/or modify it under the * terms of the Do What The Fuck You Want To Public License, Version 2, * as published by Sam Hocevar. See the LICENSE file for more details. */ /* * parse_and_demar.c * * Il file contiene la funzione get_and_parse_cmd, condivisa da client e server. * La funzione legge i dati in entrata dal socket, ne controlla la validità, * poi chiama la funzione demar (specifica per server e client) che scompone * e salva il messaggio. * */ #include "main_includes.h" /* * Funzione di lettura e parsing dal socket. * La funzione si mette immediatamente in lettura sul socket, aspettando di leggere il primo byte dummy_byte, * in modo da rendere la chiamata a ioctl bloccante. la variabile total_msglen conterrà la lunghezza totale * del messaggio escluso il primo byte. Questo serve per la malloc del buff_msg. * Successivamente viene controllato il formato del messaggio con la variabile total_msglen. * Viene letto il messaggio e salvato in buff_msg. Vengono controllati il numero dei ':' nel messaggio, che * non devono essere meno di 4, attravero la variabile occur. * Infine viene tolto il carattere '\n' o '\r', se presenti, dal buffer msg e viene chiamata la funzione demar * (specifica per il client e il server) per il demarshalling. * * Valori di ritorno * ================= * * 0 = OK * 1 = errore fatale / socket chiuso / chiusura forzata * 2 = comando sconosciuto * 3 = errore formato */ int get_and_parse_cmd (msg_t *msg_t_local, int csd_local) { ssize_t ret_io_bytes; // usata da ioctl char *buff_msg; // buffer che contiene messaggio in entrata int total_msglen = 0, i = 0, occur = 0; // variabili usate per controllo stringa letta dal socket char dummy_byte[2]; // byte fittizio per rendere la ioctl bloccante int ret_demar; // intero di ritorno per la funzione demar const char ctrl_c = -1; // se un client collegato con telnet fa ctrl-c deve uscire. CTRL-C è il carattere 0x03 ma viene letto come -1 in questo caso bzero ((void *) dummy_byte, 2); // azzero il dummy byte ret_io_bytes = read (csd_local, dummy_byte, 1); // viene letto il primo byte (dummy) del messaggio. Con questa read si rende ioctl bloccante if (ret_io_bytes == 0 || errno == EINVAL) // quando un client si disconnette allora viene chiuso csd. In quel momento la read ritona immediatamente (che ha letto 0 byte) e il ciclo while continua all'infinito.... return 1; // ...per questo ci deve essere il ritorno della funzione ret_io_bytes = ioctl (csd_local, FIONREAD, &total_msglen); // funzione che dice quanti byte sono disponibli nel buffer, NON bloccante, conta sia il '\n' che il '\0' buff_msg = (char *) malloc (sizeof (char) * total_msglen); // allocazione dinamica del buffer in base ai byte presenti nel socket. if (buff_msg == NULL) err_handler (E_MALLOC, 'x', 'w'); bzero ((void *) buff_msg, total_msglen); // azzero la nuova stringa if (ret_io_bytes == -1) err_handler (E_IOCTL, 'x', 'w'); else { if (dummy_byte[0] == '\0') // controllo se la stringa è vuota per evitare eventuali crash. Dovrebbe arrivare qui solo se il client chiude immediatamente la connessione dopo avere mandato un msg return 1; // ritorna chiusura forzata if (strcmp (dummy_byte, ":") != 0) // controllo formato: anche il dummy byte deve essere uguale a -1 { if (dummy_byte[0] == ctrl_c) // questo controlla se l'utente ha premuto CTRL-C (ASCII 3) return 1; // ritorna chiusura forzata ret_io_bytes = read (csd_local, buff_msg, total_msglen); if (ret_io_bytes != (ssize_t) total_msglen) err_handler (E_READ_SOCK, 'x', 'w'); free (buff_msg); return 3; // formato non valido } } if (total_msglen < 5) // primo controllo formato msg. 5 = 1 carattere per il comando + almeno 4 ':'. - 1 perchè non va considerato il newline { read (csd_local, buff_msg, (size_t) total_msglen); // flush socket altrimenti la funzione viene chiamata di nuovo con i dati vecchi free (buff_msg); return 2; // bad cmd } ret_io_bytes = read (csd_local, buff_msg, total_msglen); // copia comando client in un buffer locale msg_buff if (ret_io_bytes != (ssize_t) total_msglen) err_handler (E_READ_SOCK, 'x', 'w'); // secondo controllo formato i = 0; while (buff_msg[i] != '\0') // conto numero di ':' presenti nel mesaggio { if (buff_msg[i] == ':') occur++; i++; } if (occur < 4) // se il messaggio non ha almeno 4 ':' return 2; // ritorna unnown cmd i = 0; while (buff_msg[i] != '\n' && buff_msg[i] != '\r' && buff_msg[i] != '\0') // trova la posizione di '\n' o '\r' i++; if (buff_msg[i] == '\n' || buff_msg[i] == '\r') // Si prevede che gli ultimi due caratteri siano '\n' e '\r', quindi copio la sringa escludendo '\n' e '\r' (se esistenti) buff_msg[i] = '\0'; ret_demar = demar (buff_msg, msg_t_local); // demarshalling msg free (buff_msg); if (ret_demar == 2) // comando sconosciuto return 2; // ritorna comando sconosciuto else if (ret_demar == 3) // formato messaggo non valido return 3; // ritorna formato non valido /*else if (ret_demar == 65) // se il client ha mandato keepalive allora viene inviato indietro write_sock (NULL, ":A::::", csd_local); // manda messaggio keepalive al client*/ return 0; // OK }
41.929688
213
0.701137
47dd59401062a1160e9edc53d8892d64aceb3e80
2,134
c
C
src/uhook.c
qgymib/inline_hook
ab0bdabef4246732e3c10f252f84920a470a45e4
[ "MIT" ]
null
null
null
src/uhook.c
qgymib/inline_hook
ab0bdabef4246732e3c10f252f84920a470a45e4
[ "MIT" ]
null
null
null
src/uhook.c
qgymib/inline_hook
ab0bdabef4246732e3c10f252f84920a470a45e4
[ "MIT" ]
null
null
null
#include "uhook.h" #include <string.h> #include "once.h" #include "os/elf.h" #include "arch/arm.h" #include "arch/x86_64.h" #define INLINE_HOOK_DEBUG #include "log.h" #define UHOOK_ATTR_INLINE 1 #define UHOOK_ATTR_GOTPLT 2 typedef int (*uhook_inject_fn)(void** token, void** fcall, void* target, void* detour); typedef void (*uhook_uninject_fn)(void* token); int uhook_inject(uhook_token_t* token, void* target, void* detour) { void* inject_token = NULL; void* inject_call = NULL; uhook_inject_fn fn_inject = #if defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64) uhook_x86_64_inject #elif defined(__arm__) uhook_arm_inject #else # error "unsupport hardware platform" NULL #endif ; int ret = fn_inject(&inject_token, &inject_call, target, detour); if (ret != UHOOK_SUCCESS) { return ret; } token->fcall = inject_call; token->token = inject_token; token->attrs = UHOOK_ATTR_INLINE; return UHOOK_SUCCESS; } int uhook_inject_got(uhook_token_t* token, const char* name, void* detour) { void* inject_token = NULL; void* inject_call = NULL; int ret = elf_inject_got_patch(&inject_token, &inject_call, name, detour); if (ret != UHOOK_SUCCESS) { return ret; } token->fcall = inject_call; token->attrs = UHOOK_ATTR_GOTPLT; token->token = inject_token; return UHOOK_SUCCESS; } void uhook_uninject(uhook_token_t* token) { uhook_uninject_fn fn_uninject = #if defined(__i386__) || defined(__amd64__) || defined(_M_IX86) || defined(_M_AMD64) uhook_x86_64_uninject #elif defined(__arm__) uhook_arm_uninject #else # error "unsupport hardware platform" NULL #endif ; if (token->attrs & UHOOK_ATTR_GOTPLT) { elf_inject_got_unpatch(token->token); goto fin; } if (token->attrs & UHOOK_ATTR_INLINE) { fn_uninject(token->token); goto fin; } fin: memset(token, 0, sizeof(*token)); }
22.702128
88
0.636364
631882285d0652874143e60dced9c1f630a0697f
210
h
C
vyruss/c/minispi.h
alecu/ventilastation
db8cb6f4bbc77f8f9e03d26bd7cc6bd36bc34220
[ "Apache-2.0" ]
2
2019-04-03T01:10:00.000Z
2019-11-18T15:31:32.000Z
vyruss/c/minispi.h
alecu/ventilastation
db8cb6f4bbc77f8f9e03d26bd7cc6bd36bc34220
[ "Apache-2.0" ]
null
null
null
vyruss/c/minispi.h
alecu/ventilastation
db8cb6f4bbc77f8f9e03d26bd7cc6bd36bc34220
[ "Apache-2.0" ]
2
2019-03-02T20:27:31.000Z
2019-11-17T23:21:50.000Z
// Mini SPI driver // based on https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-spi.c void spiStartBuses(uint32_t freq); void spiWriteNL(int bus, const void * data_in, size_t len);
35
94
0.766667
7d353da63b3b8949918d5c8598106812509925b8
8,185
h
C
ext/hal/altera/include/nios2.h
dmgerman/zephyrd3
b6a23cc9c5d534c352e33fd18fff7799ac3c2886
[ "Apache-2.0" ]
null
null
null
ext/hal/altera/include/nios2.h
dmgerman/zephyrd3
b6a23cc9c5d534c352e33fd18fff7799ac3c2886
[ "Apache-2.0" ]
null
null
null
ext/hal/altera/include/nios2.h
dmgerman/zephyrd3
b6a23cc9c5d534c352e33fd18fff7799ac3c2886
[ "Apache-2.0" ]
null
null
null
DECL|NIOS2_BREAK|macro|NIOS2_BREAK DECL|NIOS2_BSTATUS|macro|NIOS2_BSTATUS DECL|NIOS2_CONFIG_REG_ANI_MASK|macro|NIOS2_CONFIG_REG_ANI_MASK DECL|NIOS2_CONFIG_REG_ANI_OFST|macro|NIOS2_CONFIG_REG_ANI_OFST DECL|NIOS2_CONFIG_REG_ECCEN_MASK|macro|NIOS2_CONFIG_REG_ECCEN_MASK DECL|NIOS2_CONFIG_REG_ECCEN_OFST|macro|NIOS2_CONFIG_REG_ECCEN_OFST DECL|NIOS2_CONFIG_REG_ECCEXC_MASK|macro|NIOS2_CONFIG_REG_ECCEXC_MASK DECL|NIOS2_CONFIG_REG_ECCEXC_OFST|macro|NIOS2_CONFIG_REG_ECCEXC_OFST DECL|NIOS2_CONFIG_REG_PE_MASK|macro|NIOS2_CONFIG_REG_PE_MASK DECL|NIOS2_CONFIG_REG_PE_OFST|macro|NIOS2_CONFIG_REG_PE_OFST DECL|NIOS2_CPUID|macro|NIOS2_CPUID DECL|NIOS2_ECCINJ_REG_DCDAT_MASK|macro|NIOS2_ECCINJ_REG_DCDAT_MASK DECL|NIOS2_ECCINJ_REG_DCDAT_OFST|macro|NIOS2_ECCINJ_REG_DCDAT_OFST DECL|NIOS2_ECCINJ_REG_DCTAG_MASK|macro|NIOS2_ECCINJ_REG_DCTAG_MASK DECL|NIOS2_ECCINJ_REG_DCTAG_OFST|macro|NIOS2_ECCINJ_REG_DCTAG_OFST DECL|NIOS2_ECCINJ_REG_DTCM0_MASK|macro|NIOS2_ECCINJ_REG_DTCM0_MASK DECL|NIOS2_ECCINJ_REG_DTCM0_OFST|macro|NIOS2_ECCINJ_REG_DTCM0_OFST DECL|NIOS2_ECCINJ_REG_DTCM1_MASK|macro|NIOS2_ECCINJ_REG_DTCM1_MASK DECL|NIOS2_ECCINJ_REG_DTCM1_OFST|macro|NIOS2_ECCINJ_REG_DTCM1_OFST DECL|NIOS2_ECCINJ_REG_DTCM2_MASK|macro|NIOS2_ECCINJ_REG_DTCM2_MASK DECL|NIOS2_ECCINJ_REG_DTCM2_OFST|macro|NIOS2_ECCINJ_REG_DTCM2_OFST DECL|NIOS2_ECCINJ_REG_DTCM3_MASK|macro|NIOS2_ECCINJ_REG_DTCM3_MASK DECL|NIOS2_ECCINJ_REG_DTCM3_OFST|macro|NIOS2_ECCINJ_REG_DTCM3_OFST DECL|NIOS2_ECCINJ_REG_ICDAT_MASK|macro|NIOS2_ECCINJ_REG_ICDAT_MASK DECL|NIOS2_ECCINJ_REG_ICDAT_OFST|macro|NIOS2_ECCINJ_REG_ICDAT_OFST DECL|NIOS2_ECCINJ_REG_ICTAG_MASK|macro|NIOS2_ECCINJ_REG_ICTAG_MASK DECL|NIOS2_ECCINJ_REG_ICTAG_OFST|macro|NIOS2_ECCINJ_REG_ICTAG_OFST DECL|NIOS2_ECCINJ_REG_RF_MASK|macro|NIOS2_ECCINJ_REG_RF_MASK DECL|NIOS2_ECCINJ_REG_RF_OFST|macro|NIOS2_ECCINJ_REG_RF_OFST DECL|NIOS2_ECCINJ_REG_TLB_MASK|macro|NIOS2_ECCINJ_REG_TLB_MASK DECL|NIOS2_ECCINJ_REG_TLB_OFST|macro|NIOS2_ECCINJ_REG_TLB_OFST DECL|NIOS2_ESTATUS|macro|NIOS2_ESTATUS DECL|NIOS2_EXCEPTION_REG_CAUSE_MASK|macro|NIOS2_EXCEPTION_REG_CAUSE_MASK DECL|NIOS2_EXCEPTION_REG_CAUSE_OFST|macro|NIOS2_EXCEPTION_REG_CAUSE_OFST DECL|NIOS2_EXCEPTION_REG_ECCFTL_MASK|macro|NIOS2_EXCEPTION_REG_ECCFTL_MASK DECL|NIOS2_EXCEPTION_REG_ECCFTL_OFST|macro|NIOS2_EXCEPTION_REG_ECCFTL_OFST DECL|NIOS2_IENABLE|macro|NIOS2_IENABLE DECL|NIOS2_IPENDING|macro|NIOS2_IPENDING DECL|NIOS2_MPUACC_C_MASK|macro|NIOS2_MPUACC_C_MASK DECL|NIOS2_MPUACC_C_OFST|macro|NIOS2_MPUACC_C_OFST DECL|NIOS2_MPUACC_LIMIT_MASK|macro|NIOS2_MPUACC_LIMIT_MASK DECL|NIOS2_MPUACC_LIMIT_OFST|macro|NIOS2_MPUACC_LIMIT_OFST DECL|NIOS2_MPUACC_MASK_MASK|macro|NIOS2_MPUACC_MASK_MASK DECL|NIOS2_MPUACC_MASK_OFST|macro|NIOS2_MPUACC_MASK_OFST DECL|NIOS2_MPUACC_PERM_MASK|macro|NIOS2_MPUACC_PERM_MASK DECL|NIOS2_MPUACC_PERM_OFST|macro|NIOS2_MPUACC_PERM_OFST DECL|NIOS2_MPUACC_RD_MASK|macro|NIOS2_MPUACC_RD_MASK DECL|NIOS2_MPUACC_RD_OFST|macro|NIOS2_MPUACC_RD_OFST DECL|NIOS2_MPUACC_WR_MASK|macro|NIOS2_MPUACC_WR_MASK DECL|NIOS2_MPUACC_WR_OFST|macro|NIOS2_MPUACC_WR_OFST DECL|NIOS2_MPUBASE_BASE_ADDR_MASK|macro|NIOS2_MPUBASE_BASE_ADDR_MASK DECL|NIOS2_MPUBASE_BASE_ADDR_OFST|macro|NIOS2_MPUBASE_BASE_ADDR_OFST DECL|NIOS2_MPUBASE_D_MASK|macro|NIOS2_MPUBASE_D_MASK DECL|NIOS2_MPUBASE_D_OFST|macro|NIOS2_MPUBASE_D_OFST DECL|NIOS2_MPUBASE_INDEX_MASK|macro|NIOS2_MPUBASE_INDEX_MASK DECL|NIOS2_MPUBASE_INDEX_OFST|macro|NIOS2_MPUBASE_INDEX_OFST DECL|NIOS2_NIRQ|macro|NIOS2_NIRQ DECL|NIOS2_PTEADDR_REG_PTBASE_MASK|macro|NIOS2_PTEADDR_REG_PTBASE_MASK DECL|NIOS2_PTEADDR_REG_PTBASE_OFST|macro|NIOS2_PTEADDR_REG_PTBASE_OFST DECL|NIOS2_PTEADDR_REG_VPN_MASK|macro|NIOS2_PTEADDR_REG_VPN_MASK DECL|NIOS2_PTEADDR_REG_VPN_OFST|macro|NIOS2_PTEADDR_REG_VPN_OFST DECL|NIOS2_READ_BADADDR|macro|NIOS2_READ_BADADDR DECL|NIOS2_READ_BSTATUS|macro|NIOS2_READ_BSTATUS DECL|NIOS2_READ_CONFIG|macro|NIOS2_READ_CONFIG DECL|NIOS2_READ_CPUID|macro|NIOS2_READ_CPUID DECL|NIOS2_READ_ECCINJ|macro|NIOS2_READ_ECCINJ DECL|NIOS2_READ_ESTATUS|macro|NIOS2_READ_ESTATUS DECL|NIOS2_READ_ET|macro|NIOS2_READ_ET DECL|NIOS2_READ_EXCEPTION|macro|NIOS2_READ_EXCEPTION DECL|NIOS2_READ_IENABLE|macro|NIOS2_READ_IENABLE DECL|NIOS2_READ_IPENDING|macro|NIOS2_READ_IPENDING DECL|NIOS2_READ_MPUACC|macro|NIOS2_READ_MPUACC DECL|NIOS2_READ_MPUBASE|macro|NIOS2_READ_MPUBASE DECL|NIOS2_READ_PTEADDR|macro|NIOS2_READ_PTEADDR DECL|NIOS2_READ_SP|macro|NIOS2_READ_SP DECL|NIOS2_READ_STATUS|macro|NIOS2_READ_STATUS DECL|NIOS2_READ_TLBACC|macro|NIOS2_READ_TLBACC DECL|NIOS2_READ_TLBMISC|macro|NIOS2_READ_TLBMISC DECL|NIOS2_REPORT_STACK_OVERFLOW|macro|NIOS2_REPORT_STACK_OVERFLOW DECL|NIOS2_STATUS_CRS_MSK|macro|NIOS2_STATUS_CRS_MSK DECL|NIOS2_STATUS_CRS_OFST|macro|NIOS2_STATUS_CRS_OFST DECL|NIOS2_STATUS_EH_MSK|macro|NIOS2_STATUS_EH_MSK DECL|NIOS2_STATUS_EH_OFST|macro|NIOS2_STATUS_EH_OFST DECL|NIOS2_STATUS_IH_MSK|macro|NIOS2_STATUS_IH_MSK DECL|NIOS2_STATUS_IH_OFST|macro|NIOS2_STATUS_IH_OFST DECL|NIOS2_STATUS_IL_MSK|macro|NIOS2_STATUS_IL_MSK DECL|NIOS2_STATUS_IL_OFST|macro|NIOS2_STATUS_IL_OFST DECL|NIOS2_STATUS_NMI_MSK|macro|NIOS2_STATUS_NMI_MSK DECL|NIOS2_STATUS_NMI_OFST|macro|NIOS2_STATUS_NMI_OFST DECL|NIOS2_STATUS_PIE_MSK|macro|NIOS2_STATUS_PIE_MSK DECL|NIOS2_STATUS_PIE_OFST|macro|NIOS2_STATUS_PIE_OFST DECL|NIOS2_STATUS_PRS_MSK|macro|NIOS2_STATUS_PRS_MSK DECL|NIOS2_STATUS_PRS_OFST|macro|NIOS2_STATUS_PRS_OFST DECL|NIOS2_STATUS_RSIE_MSK|macro|NIOS2_STATUS_RSIE_MSK DECL|NIOS2_STATUS_RSIE_OFST|macro|NIOS2_STATUS_RSIE_OFST DECL|NIOS2_STATUS_SRS_MSK|macro|NIOS2_STATUS_SRS_MSK DECL|NIOS2_STATUS_SRS_OFST|macro|NIOS2_STATUS_SRS_OFST DECL|NIOS2_STATUS_U_MSK|macro|NIOS2_STATUS_U_MSK DECL|NIOS2_STATUS_U_OFST|macro|NIOS2_STATUS_U_OFST DECL|NIOS2_STATUS|macro|NIOS2_STATUS DECL|NIOS2_TLBACC_REG_C_MASK|macro|NIOS2_TLBACC_REG_C_MASK DECL|NIOS2_TLBACC_REG_C_OFST|macro|NIOS2_TLBACC_REG_C_OFST DECL|NIOS2_TLBACC_REG_G_MASK|macro|NIOS2_TLBACC_REG_G_MASK DECL|NIOS2_TLBACC_REG_G_OFST|macro|NIOS2_TLBACC_REG_G_OFST DECL|NIOS2_TLBACC_REG_IG_MASK|macro|NIOS2_TLBACC_REG_IG_MASK DECL|NIOS2_TLBACC_REG_IG_OFST|macro|NIOS2_TLBACC_REG_IG_OFST DECL|NIOS2_TLBACC_REG_PFN_MASK|macro|NIOS2_TLBACC_REG_PFN_MASK DECL|NIOS2_TLBACC_REG_PFN_OFST|macro|NIOS2_TLBACC_REG_PFN_OFST DECL|NIOS2_TLBACC_REG_R_MASK|macro|NIOS2_TLBACC_REG_R_MASK DECL|NIOS2_TLBACC_REG_R_OFST|macro|NIOS2_TLBACC_REG_R_OFST DECL|NIOS2_TLBACC_REG_W_MASK|macro|NIOS2_TLBACC_REG_W_MASK DECL|NIOS2_TLBACC_REG_W_OFST|macro|NIOS2_TLBACC_REG_W_OFST DECL|NIOS2_TLBACC_REG_X_MASK|macro|NIOS2_TLBACC_REG_X_MASK DECL|NIOS2_TLBACC_REG_X_OFST|macro|NIOS2_TLBACC_REG_X_OFST DECL|NIOS2_TLBMISC_REG_BAD_MASK|macro|NIOS2_TLBMISC_REG_BAD_MASK DECL|NIOS2_TLBMISC_REG_BAD_OFST|macro|NIOS2_TLBMISC_REG_BAD_OFST DECL|NIOS2_TLBMISC_REG_DBL_MASK|macro|NIOS2_TLBMISC_REG_DBL_MASK DECL|NIOS2_TLBMISC_REG_DBL_OFST|macro|NIOS2_TLBMISC_REG_DBL_OFST DECL|NIOS2_TLBMISC_REG_D_MASK|macro|NIOS2_TLBMISC_REG_D_MASK DECL|NIOS2_TLBMISC_REG_D_OFST|macro|NIOS2_TLBMISC_REG_D_OFST DECL|NIOS2_TLBMISC_REG_EE_MASK|macro|NIOS2_TLBMISC_REG_EE_MASK DECL|NIOS2_TLBMISC_REG_EE_OFST|macro|NIOS2_TLBMISC_REG_EE_OFST DECL|NIOS2_TLBMISC_REG_PERM_MASK|macro|NIOS2_TLBMISC_REG_PERM_MASK DECL|NIOS2_TLBMISC_REG_PERM_OFST|macro|NIOS2_TLBMISC_REG_PERM_OFST DECL|NIOS2_TLBMISC_REG_PID_MASK|macro|NIOS2_TLBMISC_REG_PID_MASK DECL|NIOS2_TLBMISC_REG_PID_OFST|macro|NIOS2_TLBMISC_REG_PID_OFST DECL|NIOS2_TLBMISC_REG_RD_MASK|macro|NIOS2_TLBMISC_REG_RD_MASK DECL|NIOS2_TLBMISC_REG_RD_OFST|macro|NIOS2_TLBMISC_REG_RD_OFST DECL|NIOS2_TLBMISC_REG_WAY_MASK|macro|NIOS2_TLBMISC_REG_WAY_MASK DECL|NIOS2_TLBMISC_REG_WAY_OFST|macro|NIOS2_TLBMISC_REG_WAY_OFST DECL|NIOS2_TLBMISC_REG_WE_MASK|macro|NIOS2_TLBMISC_REG_WE_MASK DECL|NIOS2_TLBMISC_REG_WE_OFST|macro|NIOS2_TLBMISC_REG_WE_OFST DECL|NIOS2_WRITE_CONFIG|macro|NIOS2_WRITE_CONFIG DECL|NIOS2_WRITE_ECCINJ|macro|NIOS2_WRITE_ECCINJ DECL|NIOS2_WRITE_ET|macro|NIOS2_WRITE_ET DECL|NIOS2_WRITE_IENABLE|macro|NIOS2_WRITE_IENABLE DECL|NIOS2_WRITE_MPUACC|macro|NIOS2_WRITE_MPUACC DECL|NIOS2_WRITE_MPUBASE|macro|NIOS2_WRITE_MPUBASE DECL|NIOS2_WRITE_PTEADDR|macro|NIOS2_WRITE_PTEADDR DECL|NIOS2_WRITE_STATUS|macro|NIOS2_WRITE_STATUS DECL|NIOS2_WRITE_TLBACC|macro|NIOS2_WRITE_TLBACC DECL|NIOS2_WRITE_TLBMISC|macro|NIOS2_WRITE_TLBMISC DECL|__NIOS2_H__|macro|__NIOS2_H__
56.840278
74
0.930116
7d67a89540150771df2845c0dba12f289afbddaf
498
c
C
external/src/zlib/zlib_unity.c
inogroup/SLib
6c053c8f47f04240b8444eac5f316effdee2eb01
[ "MIT" ]
2
2021-07-29T18:29:25.000Z
2021-09-07T08:51:14.000Z
external/src/zlib/zlib_unity.c
inogroup/SLib
6c053c8f47f04240b8444eac5f316effdee2eb01
[ "MIT" ]
1
2021-07-29T18:22:35.000Z
2021-07-29T18:59:41.000Z
external/src/zlib/zlib_unity.c
inogroup/SLib
6c053c8f47f04240b8444eac5f316effdee2eb01
[ "MIT" ]
3
2021-07-29T17:08:12.000Z
2021-12-14T06:21:41.000Z
#ifdef _MSC_VER #pragma warning (disable: 4996) #pragma warning (disable: 4267) #endif #include "trees.c" #include "adler32.c" #include "compress.c" #undef DO1 #undef DO8 #include "crc32.c" #include "deflate.c" #undef GZIP #include "gzclose.c" #include "gzlib.c" #include "gzread.c" #include "gzwrite.c" #undef COPY #include "infback.c" #include "inffast.c" #define fixedtables inflate_fixedtables #undef PULLBYTE #include "inflate.c" #include "inftrees.c" #include "uncompr.c" #include "zutil.c"
18.444444
39
0.736948
d166e0727437bed97b50744750a532f21131e06f
215
h
C
HotFix/HotFix/Dog.h
emiyagjy/iOS-HotFix
1446eb0ef812f5786c01348075ae9d112e0b4e2c
[ "Apache-2.0" ]
null
null
null
HotFix/HotFix/Dog.h
emiyagjy/iOS-HotFix
1446eb0ef812f5786c01348075ae9d112e0b4e2c
[ "Apache-2.0" ]
null
null
null
HotFix/HotFix/Dog.h
emiyagjy/iOS-HotFix
1446eb0ef812f5786c01348075ae9d112e0b4e2c
[ "Apache-2.0" ]
null
null
null
// // Dog.h // HotFix // // Created by GujyHy on 2018/3/22. // Copyright © 2018年 Gujy. All rights reserved. // #import <Foundation/Foundation.h> @interface Dog : NSObject + (void) run; - (void) eat; @end
11.315789
48
0.618605
60393a588344bf0f166a6073ade1c36c98ca41cd
114
c
C
tests/ex_cycle_dependency.4.c
wcy123/exec_once
1f9f7d1c25a3ff42231ada3db99a4b052f66af40
[ "MIT" ]
null
null
null
tests/ex_cycle_dependency.4.c
wcy123/exec_once
1f9f7d1c25a3ff42231ada3db99a4b052f66af40
[ "MIT" ]
null
null
null
tests/ex_cycle_dependency.4.c
wcy123/exec_once
1f9f7d1c25a3ff42231ada3db99a4b052f66af40
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #define EXEC_ONCE_TU_NAME "tu4" #include "ex_simple_dependency_common.inc"
22.8
42
0.789474
605b5b9fa7be152f9e24f8ce130e29bcc0a0b730
238
c
C
sources/config.c
martawiszowata2000/demon-1
f7bc73109d264673781cb0e6bc37f5b3cbe8a9e6
[ "MIT" ]
null
null
null
sources/config.c
martawiszowata2000/demon-1
f7bc73109d264673781cb0e6bc37f5b3cbe8a9e6
[ "MIT" ]
null
null
null
sources/config.c
martawiszowata2000/demon-1
f7bc73109d264673781cb0e6bc37f5b3cbe8a9e6
[ "MIT" ]
2
2021-04-20T10:46:38.000Z
2021-04-27T15:10:23.000Z
#include "config.h" config default_config(){ config DEFAULT_CONFIG = { false, 300, false, 4194304, NULL, NULL }; // invalid, 300s = 5min, non recursive, 4194304 = 2^22 = 4MB, brak katalogu, brak katalogu return DEFAULT_CONFIG; }
34
162
0.697479
93fdb746d46e5a150be7a453d883a281a8c0f026
5,394
h
C
DigitalWorkprint/lib/common/include/mle/DwpFile.h
magic-lantern-studio/mle-core-dwp
c9d7dcf0295f961baa3e23ffea1aa1c446ea2baa
[ "MIT" ]
null
null
null
DigitalWorkprint/lib/common/include/mle/DwpFile.h
magic-lantern-studio/mle-core-dwp
c9d7dcf0295f961baa3e23ffea1aa1c446ea2baa
[ "MIT" ]
null
null
null
DigitalWorkprint/lib/common/include/mle/DwpFile.h
magic-lantern-studio/mle-core-dwp
c9d7dcf0295f961baa3e23ffea1aa1c446ea2baa
[ "MIT" ]
null
null
null
/** @defgroup MleDWPAccess Magic Lantern Digital Workprint Library API - Base */ /** * @file DwpFile.h * @ingroup MleDWPAccess * * This file defines the File workprint item. */ // COPYRIGHT_BEGIN // // The MIT License (MIT) // // Copyright (c) 2015-2020 Wizzer Works // // 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. // // For information concerning this header file, contact Mark S. Millard, // of Wizzer Works at msm@wizzerworks.com. // // More information concerning Wizzer Works may be found at // // http://www.wizzerworks.com // // COPYRIGHT_END #ifndef __MLE_DWP_FILE_H_ #define __MLE_DWP_FILE_H_ // Include Digital Workprint header files. #include "mle/Dwp.h" #include "mle/DwpItem.h" /** * @brief This defines a file inclusion. * * A file inclusion is itself a workprint item and exists in the tree * structure. At read time, the items in the included file are parented * to the file item. At write time, the items under the file item are * written out to the file specified. * <p> * Note that the filename in the workprint can have some ambiguity. For * example, if it contains "foo.wp", it could be read from a number of * different places - the directory the application was run from, the * directory the current workprint file is in, etc. The search policy * of <code>MleDwpInput::openFile()</code> is used. * </p><p> * The result of the search policy is a path, and that is kept with * the file item but is not written into the workprint. The path * may be specified by the application as well, to disambiguate the * filename. On write, the path is used if it exists, else the * filename is used as a path. * </p><p> * @verbatim * WORKPRINT SYNTAX * Syntax: (File filename) * <filename> file to include at this point (char *) * * * Contained by: all * Contains: none * * EXAMPLE * END * @endverbatim * </p><p> * The name field (getName(), setName()) is used to store the filename. * </p> */ class MLE_DWP_API MleDwpFile : public MleDwpItem { // Include mandatory workprint header macro. MLE_DWP_HEADER(MleDwpFile); public: /** * @brief Default constructor. */ MleDwpFile(void); /** * @brief The destructor. */ ~MleDwpFile(); /** * @brief Set the path of the file. * * The path is a specific file specifier for this item. This * is not the filename that is kept in the workprint, but an * interpretation of that filename. The filename can have * ambiguity as to which directory it refers to. That is why * there is a policy in <code>MleDwpInput</code> as to how directories are * searched to open new files. The path, if it exists, is * used to disambiguate this directory. <code>mlFOpen()</code> is called * directly on the path. * </p><p> * The path is automatically set when this item is loaded * from file. An application may also set the path to direct * writing to a specific file. If the path is not set, the * filename is used as the path. * </p> * * @param path A pointer to a character array identifying the * file path. */ void setPath(const char *path); /** * @brief Set the path of the file. * * @return A pointer to a character array identifying the file * path is returned. */ const char *getPath(void) const; /** * Override operator new. * * @param tSize The size, in bytes, to allocate. */ void* operator new(size_t tSize); /** * Override operator delete. * * @param p A pointer to the memory to delete. */ void operator delete(void *p); protected: /** * @brief Read the contents of the workprint item. * * @param in A pointer to an workprint input object. * * @return If the contents are successfully read, then <b>TRUE</b> * will be returned. Otherwise, <b>FALSE</b> will be returned. */ virtual int readContents(MleDwpInput *in); /** * @brief Write the contents of the workprint item. * * @param out A pointer to an workprint output object * to write to. * @param writeChildren A flag indicating whether to write * the children also. * * @return If the contents are successfully written, then <b>TRUE</b> * will be returned. Otherwise, <b>FALSE</b> will be returned. */ virtual int write(MleDwpOutput *out,int writeChildren = 1); char *m_path; /**< The file path. */ }; #endif /* __MLE_DWP_FILE_H_ */
30.134078
81
0.698739
7830e8679ef15141db890046992f3f3d487dce45
966
c
C
src/input.c
anima-libera/Gravinyon
f6ae1f904cc04b98df8036cc7499bfc5f09fdae1
[ "Unlicense" ]
4
2021-04-07T18:28:58.000Z
2021-04-10T21:27:49.000Z
src/input.c
anima-libera/Gravinyon
f6ae1f904cc04b98df8036cc7499bfc5f09fdae1
[ "Unlicense" ]
null
null
null
src/input.c
anima-libera/Gravinyon
f6ae1f904cc04b98df8036cc7499bfc5f09fdae1
[ "Unlicense" ]
null
null
null
#include "input.h" #include "window.h" void apply_input_commands(commands_t* commands) { SDL_Event event; while (SDL_PollEvent(&event)) { switch (event.type) { case SDL_QUIT: commands->is_quitting = 1; break; case SDL_KEYDOWN: case SDL_KEYUP: switch (event.key.keysym.sym) { case SDLK_ESCAPE: commands->is_escaping = event.type == SDL_KEYDOWN; break; case SDLK_s: commands->debug_spawn_ships = event.type == SDL_KEYDOWN; break; case SDLK_e: commands->debug_spawn_enemies = event.type == SDL_KEYDOWN; break; } break; case SDL_MOUSEMOTION: commands->inwindow_cursor_x = event.motion.x; commands->inwindow_cursor_y = event.motion.y; break; case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: switch (event.button.button) { case SDL_BUTTON_LEFT: commands->is_firing = event.type == SDL_MOUSEBUTTONDOWN; break; } break; } } }
18.941176
64
0.656315
7a925f9b4a7cac598fb6bd449a384e490090d9c5
2,238
h
C
include/tmech/tensor/positive_negative_decomposition_dneg_wrapper_meat.h
petlenz/tmech
bce181ead98d07b45a3f8fc32878b10d9c5680a8
[ "BSD-3-Clause" ]
null
null
null
include/tmech/tensor/positive_negative_decomposition_dneg_wrapper_meat.h
petlenz/tmech
bce181ead98d07b45a3f8fc32878b10d9c5680a8
[ "BSD-3-Clause" ]
null
null
null
include/tmech/tensor/positive_negative_decomposition_dneg_wrapper_meat.h
petlenz/tmech
bce181ead98d07b45a3f8fc32878b10d9c5680a8
[ "BSD-3-Clause" ]
null
null
null
/*************************************************************************** * Copyright (c) Peter Lenz * * * * Distributed under the terms of the BSD 3-Clause License. * * * * The full license is in the file LICENSE, distributed with this software. * ****************************************************************************/ #ifndef POSITIVE_NEGATIVE_DECOMPOSITION_DNEG_WRAPPER_MEAT_H #define POSITIVE_NEGATIVE_DECOMPOSITION_DNEG_WRAPPER_MEAT_H namespace detail { template <typename Base, typename Tensor> positive_negative_decomposition_dneg_wrapper<Base, Tensor>::positive_negative_decomposition_dneg_wrapper(Base const& __base, Tensor const& __V)noexcept: base(__base), V(__V) {} template <typename Base, typename Tensor> positive_negative_decomposition_dneg_wrapper<Base, Tensor>::positive_negative_decomposition_dneg_wrapper(positive_negative_decomposition_dneg_wrapper const & __data)noexcept: base(__data.base), V(__data.V) {} template <typename Base, typename Tensor> constexpr inline auto const& positive_negative_decomposition_dneg_wrapper<Base, Tensor>::operator()(size_type const i, size_type const j, size_type const k, size_type const l)const noexcept{ return V(i,j,k,l); } template <typename Base, typename Tensor> constexpr inline auto positive_negative_decomposition_dneg_wrapper<Base, Tensor>::dimension()noexcept{ return Tensor::dimension(); } template <typename Base, typename Tensor> constexpr inline auto positive_negative_decomposition_dneg_wrapper<Base, Tensor>::rank()noexcept{ return Tensor::rank(); } template <typename Base, typename Tensor> constexpr inline auto positive_negative_decomposition_dneg_wrapper<Base, Tensor>::evaluate()noexcept{ const_cast<Base&>(base).evaluate_dnegative(); } template <typename Base, typename Tensor> constexpr inline auto positive_negative_decomposition_dneg_wrapper<Base, Tensor>::raw_data()const noexcept{ return V.raw_data(); } } // NAMESPACE DETAIL #endif // POSITIVE_NEGATIVE_DECOMPOSITION_DNEG_WRAPPER_MEAT_H
42.226415
190
0.67471
2b1ce872fb4ef6fc092fd04e138f17cc164b2fb7
10,066
c
C
test/binary_test.c
pedrovitti/libmalelf
d5eaa31b4a48b91cbc26bb9a3a2d33af86d58194
[ "Apache-2.0" ]
1
2015-08-13T12:46:41.000Z
2015-08-13T12:46:41.000Z
test/binary_test.c
pedrovitti/libmalelf
d5eaa31b4a48b91cbc26bb9a3a2d33af86d58194
[ "Apache-2.0" ]
null
null
null
test/binary_test.c
pedrovitti/libmalelf
d5eaa31b4a48b91cbc26bb9a3a2d33af86d58194
[ "Apache-2.0" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> #include <CUnit/Basic.h> #include <CUnit/CUnit.h> #include "binary_test.h" static void malelf_binary_open_mmap_TEST(void) { MalelfBinary bin; _i32 result; malelf_binary_init(&bin); result = malelf_binary_open("bintest/uninfected", &bin); CU_ASSERT(result == MALELF_SUCCESS); CU_ASSERT(NULL != bin.fname); CU_ASSERT(bin.fd > 2); CU_ASSERT(NULL != bin.mem); CU_ASSERT(bin.size > 0); CU_ASSERT(NULL != MALELF_ELF_DATA(&bin.ehdr)); CU_ASSERT(NULL != MALELF_ELF_DATA(&bin.phdr)); CU_ASSERT(NULL != MALELF_ELF_DATA(&bin.shdr)); CU_ASSERT(bin.alloc_type == MALELF_ALLOC_MMAP); CU_ASSERT(bin.class == MALELF_ELF32 || bin.class == MALELF_ELF64); result = malelf_binary_close(&bin); CU_ASSERT(result == MALELF_SUCCESS); CU_ASSERT(NULL == bin.fname); CU_ASSERT(bin.fd == -1); CU_ASSERT(NULL == bin.mem); CU_ASSERT(bin.size == 0); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.ehdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.phdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.shdr)); CU_ASSERT(bin.alloc_type == MALELF_ALLOC_NONE); CU_ASSERT(bin.class == MALELF_ELFNONE); malelf_binary_init(&bin); /* Should fail */ result = malelf_binary_open("/wrong/path/uninfected", &bin); CU_ASSERT(result == MALELF_ENOENT); CU_ASSERT(NULL == bin.fname); CU_ASSERT(bin.fd == -1); CU_ASSERT(NULL == bin.mem); CU_ASSERT(bin.size == 0); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.ehdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.phdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.shdr)); CU_ASSERT(bin.alloc_type == MALELF_ALLOC_MMAP); CU_ASSERT(bin.class == MALELF_ELFNONE); result = malelf_binary_close(&bin); /* munmap on a non allocated memory area. */ CU_ASSERT(result == MALELF_EINVAL); } static void malelf_binary_open_malloc_TEST(void) { MalelfBinary bin; _i32 result; malelf_binary_init(&bin); malelf_binary_set_alloc_type(&bin, MALELF_ALLOC_MALLOC); result = malelf_binary_open("bintest/uninfected", &bin); CU_ASSERT(result == MALELF_SUCCESS); CU_ASSERT(NULL != bin.fname); CU_ASSERT(bin.fd > 2); CU_ASSERT(NULL != bin.mem); CU_ASSERT(bin.size > 0); CU_ASSERT(NULL != MALELF_ELF_DATA(&bin.ehdr)); CU_ASSERT(NULL != MALELF_ELF_DATA(&bin.phdr)); CU_ASSERT(NULL != MALELF_ELF_DATA(&bin.shdr)); CU_ASSERT(bin.alloc_type == MALELF_ALLOC_MALLOC); CU_ASSERT(bin.class == MALELF_ELF32 || bin.class == MALELF_ELF64); result = malelf_binary_close(&bin); CU_ASSERT(result == MALELF_SUCCESS); malelf_binary_init(&bin); malelf_binary_set_alloc_type(&bin, MALELF_ALLOC_MALLOC); result = malelf_binary_open("/wrong/path/uninfected", &bin); CU_ASSERT(result == MALELF_ENOENT); CU_ASSERT(NULL == bin.fname); CU_ASSERT(bin.fd == -1); CU_ASSERT(NULL == bin.mem); CU_ASSERT(bin.size == 0); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.ehdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.phdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.shdr)); CU_ASSERT(bin.alloc_type == MALELF_ALLOC_MALLOC); CU_ASSERT(bin.class == MALELF_ELFNONE); result = malelf_binary_close(&bin); CU_ASSERT(result == MALELF_SUCCESS); CU_ASSERT(NULL == bin.fname); CU_ASSERT(bin.fd == -1); CU_ASSERT(NULL == bin.mem); CU_ASSERT(bin.size == 0); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.ehdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.phdr)); CU_ASSERT(NULL == MALELF_ELF_DATA(&bin.shdr)); CU_ASSERT(bin.alloc_type == MALELF_ALLOC_NONE); CU_ASSERT(bin.class == MALELF_ELFNONE); } static void malelf_binary_get_section_name_TEST() { MalelfBinary bin; _i32 result; char *name = NULL; malelf_binary_init(&bin); result = malelf_binary_open("bintest/uninfected", &bin); CU_ASSERT(result == MALELF_SUCCESS); CU_ASSERT(NULL != bin.fname); result = malelf_binary_get_section_name(&bin, 1, &name); CU_ASSERT(MALELF_SUCCESS == result); CU_ASSERT_STRING_EQUAL(".interp", name); result = malelf_binary_get_section_name(&bin, 2, &name); CU_ASSERT(MALELF_SUCCESS == result); CU_ASSERT_STRING_EQUAL(".note.ABI-tag", name); result = malelf_binary_get_section_name(&bin, 12, &name); CU_ASSERT(MALELF_SUCCESS == result); CU_ASSERT_STRING_EQUAL(".init", name); malelf_binary_close(&bin); } static void malelf_binary_get_section_TEST() { MalelfBinary bin; _i32 result; MalelfSection section; malelf_binary_init(&bin); result = malelf_binary_open("bintest/uninfected", &bin); CU_ASSERT(result == MALELF_SUCCESS); CU_ASSERT(NULL != bin.fname); result = malelf_binary_get_section(&bin, 1, &section); CU_ASSERT(MALELF_SUCCESS == result); CU_ASSERT_STRING_EQUAL(section.name, ".interp"); CU_ASSERT(section.offset == 0x134); CU_ASSERT(section.size == 0x13); CU_ASSERT(section.shdr != NULL); result = malelf_binary_get_section(&bin, 2, &section); CU_ASSERT(MALELF_SUCCESS == result); CU_ASSERT_STRING_EQUAL(section.name, ".note.ABI-tag"); CU_ASSERT(section.offset == 0x148); CU_ASSERT(section.size == 0x20); CU_ASSERT(section.shdr != NULL); result = malelf_binary_get_section(&bin, 14, &section); CU_ASSERT(MALELF_SUCCESS == result); CU_ASSERT_STRING_EQUAL(section.name, ".text"); CU_ASSERT(section.offset == 0x320); CU_ASSERT(section.size == 0x170); CU_ASSERT(section.shdr != NULL); malelf_binary_close(&bin); } void malelf_binary_write_TEST() { int error = MALELF_SUCCESS; MalelfBinary bin, bin2; struct stat st_info; malelf_binary_init(&bin); error = malelf_binary_open("bintest/uninfected", &bin); CU_ASSERT(MALELF_SUCCESS == error); error = malelf_binary_write(&bin, "bintest/uninfected_copy"); CU_ASSERT(MALELF_SUCCESS == error); CU_ASSERT(0 == stat("bintest/uninfected_copy", &st_info)); CU_ASSERT(st_info.st_size > 0); CU_ASSERT(st_info.st_size == bin.size); malelf_binary_init(&bin2); error = malelf_binary_open("bintest/uninfected_copy", &bin2); CU_ASSERT(MALELF_SUCCESS == error); CU_ASSERT(bin2.size == bin.size); CU_ASSERT(bin2.class == bin.class); CU_ASSERT(bin.alloc_type == bin2.alloc_type); int i; switch (bin2.class) { case MALELF_ELF32: { Elf32_Ehdr *ehdr = (Elf32_Ehdr *) MALELF_ELF_DATA(&bin.ehdr); Elf32_Ehdr *ehdr2 = (Elf32_Ehdr *) MALELF_ELF_DATA(&bin2.ehdr); CU_ASSERT(NULL != ehdr2); CU_ASSERT(NULL != ehdr); for (i = 0; i < 16; i++) { CU_ASSERT(ehdr->e_ident[i] == ehdr2->e_ident[i]); } CU_ASSERT(ehdr->e_type == ehdr2->e_type); CU_ASSERT(ehdr->e_machine == ehdr2->e_machine); CU_ASSERT(ehdr->e_version == ehdr2->e_version); CU_ASSERT(ehdr->e_entry == ehdr2->e_entry); CU_ASSERT(ehdr->e_phoff == ehdr2->e_phoff); CU_ASSERT(ehdr->e_shoff == ehdr2->e_shoff); CU_ASSERT(ehdr->e_flags == ehdr2->e_flags); CU_ASSERT(ehdr->e_ehsize == ehdr2->e_ehsize); CU_ASSERT(ehdr->e_phentsize == ehdr2->e_phentsize); CU_ASSERT(ehdr->e_phnum == ehdr2->e_phnum); CU_ASSERT(ehdr->e_shentsize == ehdr2->e_shentsize); CU_ASSERT(ehdr->e_shnum == ehdr2->e_shnum); CU_ASSERT(ehdr->e_shstrndx == ehdr2->e_shstrndx); break; } case MALELF_ELF64: { Elf64_Ehdr *ehdr = (Elf64_Ehdr *) MALELF_ELF_DATA(&bin.ehdr); Elf64_Ehdr *ehdr2 = (Elf64_Ehdr *) MALELF_ELF_DATA(&bin2.ehdr); CU_ASSERT(NULL != ehdr2); CU_ASSERT(NULL != ehdr); for (i = 0; i < 16; i++) { CU_ASSERT(ehdr->e_ident[i] == ehdr2->e_ident[i]); } CU_ASSERT(ehdr->e_type == ehdr2->e_type); CU_ASSERT(ehdr->e_machine == ehdr2->e_machine); CU_ASSERT(ehdr->e_version == ehdr2->e_version); CU_ASSERT(ehdr->e_entry == ehdr2->e_entry); CU_ASSERT(ehdr->e_phoff == ehdr2->e_phoff); CU_ASSERT(ehdr->e_shoff == ehdr2->e_shoff); CU_ASSERT(ehdr->e_flags == ehdr2->e_flags); CU_ASSERT(ehdr->e_ehsize == ehdr2->e_ehsize); CU_ASSERT(ehdr->e_phentsize == ehdr2->e_phentsize); CU_ASSERT(ehdr->e_phnum == ehdr2->e_phnum); CU_ASSERT(ehdr->e_shentsize == ehdr2->e_shentsize); CU_ASSERT(ehdr->e_shnum == ehdr2->e_shnum); CU_ASSERT(ehdr->e_shstrndx == ehdr2->e_shstrndx); break; } default: CU_ASSERT(0); } CU_ASSERT(memcmp(bin.mem, bin2.mem, bin2.size) == 0); malelf_binary_close(&bin); malelf_binary_close(&bin2); unlink("bintest/uninfected_copy"); } CU_ErrorCode binary_get_test_suite(CU_pSuite *rsuite) { CU_pSuite suite = NULL; if (NULL == rsuite) { return -1; } suite = CU_add_suite("Class Binary", NULL, NULL); if(NULL == suite) { *rsuite = NULL; return CU_get_error(); } if ((NULL == CU_add_test(suite, "malelf_binary_open_mmap_TEST", malelf_binary_open_mmap_TEST)) || (NULL == CU_add_test(suite, "malelf_binary_open_malloc_TEST", malelf_binary_open_malloc_TEST)) || (NULL == CU_add_test(suite, "malelf_binary_get_section_name_TEST", malelf_binary_get_section_name_TEST)) || (NULL == CU_add_test(suite, "malelf_binary_get_section_TEST", malelf_binary_get_section_TEST)) || (NULL == CU_add_test(suite, "malelf_binary_write_TEST", malelf_binary_write_TEST))) { *rsuite = NULL; return CU_get_error(); } *rsuite = suite; return CUE_SUCCESS; }
31.654088
72
0.637989
a2466aa0263e7e800a8275f37df4043992d8e1cb
6,000
c
C
ImperasLib/source/atmel.ovpworld.org/peripheral/TimerCounter/1.0/pse/user.c
emanuellucas2/OVPsimProject
6c9f5bfaaa135fa63d63746bacf5759c6d6c0e9e
[ "TCL" ]
null
null
null
ImperasLib/source/atmel.ovpworld.org/peripheral/TimerCounter/1.0/pse/user.c
emanuellucas2/OVPsimProject
6c9f5bfaaa135fa63d63746bacf5759c6d6c0e9e
[ "TCL" ]
null
null
null
ImperasLib/source/atmel.ovpworld.org/peripheral/TimerCounter/1.0/pse/user.c
emanuellucas2/OVPsimProject
6c9f5bfaaa135fa63d63746bacf5759c6d6c0e9e
[ "TCL" ]
null
null
null
/* * Copyright (c) 2005-2021 Imperas Software Ltd., www.imperas.com * * 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 "pse.igen.h" #define FUNC_NAME __FUNCTION__ #define TODO bhmMessage("F", "TC", "TODO"); struct { Uns32 pins; Uns32 activeInt; Uns32 irq0, irq1, irq2; } state; // // Write the irq0-2 if the value changes // void write_irq0(Uns32 value) { if (state.irq0 != value) { state.irq0 = value; if (PSE_DIAG_HIGH) bhmMessage("I", "TC", "Setting Interrupt IRQ0=%d\n", state.irq0); ppmWriteNet(handles.IRQ0, state.irq0); } } void write_irq1(Uns32 value) { if (state.irq1 != value) { state.irq1 = value; if (PSE_DIAG_HIGH) bhmMessage("I", "TC", "Setting Interrupt IRQ1=%d\n", state.irq1); ppmWriteNet(handles.IRQ1, state.irq1); } } void write_irq2(Uns32 value) { if (state.irq2 != value) { state.irq2 = value; if (PSE_DIAG_HIGH) bhmMessage("I", "TC", "Setting Interrupt IRQ2=%d\n", state.irq2); ppmWriteNet(handles.IRQ2, state.irq2); } } static bhmThreadHandle timerThreadHandle = 0; static Uns64 threadDelay; static void timerThread(void *user) { while (1) { bhmWaitDelay(threadDelay); if (PSE_DIAG_HIGH) bhmMessage("I", "TC", "Start Timer Expired"); write_irq1(1); write_irq1(0); } // Call info //bhmTriggerEvent(timerFired); // Cease to exist. } static void stopTimer(void) { if (timerThreadHandle) { bhmDeleteThread(timerThreadHandle); timerThreadHandle = 0; } } static void startTimer(Uns64 delay) { stopTimer(); threadDelay = delay; if (PSE_DIAG_HIGH) bhmMessage("I", "TC", "Start Timer for %lldus", delay); timerThreadHandle = bhmCreateThread(timerThread, 0, "timer", 0); } //////////////////////////////// Callback stubs //////////////////////////////// PPM_REG_WRITE_CB(TC_BCR_wcb) { // YOUR CODE HERE (TC_BCR_wcb) bp1_REG_data.TC_BCR.value = data; } PPM_REG_WRITE_CB(TC_BMR_wcb) { // YOUR CODE HERE (TC_BMR_wcb) bp1_REG_data.TC_BMR.value = data; } PPM_REG_WRITE_CB(TC_CCR_wcb0) { // YOUR CODE HERE (TC_CCR_wcb0) bp1_REG_data.TC_CCR0.value = data; if (bp1_REG_data.TC_CCR0.bits.SWTRG == 1) { write_irq0(1); write_irq0(0); } } PPM_REG_WRITE_CB(TC_CCR_wcb1) { // YOUR CODE HERE (TC_CCR_wcb1) bp1_REG_data.TC_CCR1.value = data; if (bp1_REG_data.TC_CCR1.bits.SWTRG == 1) { write_irq1(1); write_irq1(0); } } PPM_REG_WRITE_CB(TC_CCR_wcb2) { // YOUR CODE HERE (TC_CCR_wcb2) bp1_REG_data.TC_CCR2.value = data; if (bp1_REG_data.TC_CCR2.bits.SWTRG == 1) { write_irq2(1); write_irq2(0); } } PPM_REG_WRITE_CB(TC_CMR_wcb0) { // YOUR CODE HERE (TC_CMR_wcb0) bp1_REG_data.TC_CMR0.value = data; } PPM_REG_WRITE_CB(TC_CMR_wcb1) { // YOUR CODE HERE (TC_CMR_wcb1) bp1_REG_data.TC_CMR1.value = data; } PPM_REG_WRITE_CB(TC_CMR_wcb2) { // YOUR CODE HERE (TC_CMR_wcb2) bp1_REG_data.TC_CMR2.value = data; } PPM_REG_WRITE_CB(TC_CVR_wcb0) { // YOUR CODE HERE (TC_CVR_wcb0) bp1_REG_data.TC_CVR0.value = data; } PPM_REG_WRITE_CB(TC_CVR_wcb1) { // YOUR CODE HERE (TC_CVR_wcb1) bp1_REG_data.TC_CVR1.value = data; } PPM_REG_WRITE_CB(TC_CVR_wcb2) { // YOUR CODE HERE (TC_CVR_wcb2) bp1_REG_data.TC_CVR2.value = data; } PPM_REG_WRITE_CB(TC_IDR_wcb0) { // YOUR CODE HERE (TC_IDR_wcb0) bp1_REG_data.TC_IDR0.value = data; } PPM_REG_WRITE_CB(TC_IDR_wcb1) { // YOUR CODE HERE (TC_IDR_wcb1) bp1_REG_data.TC_IDR1.value = data; } PPM_REG_WRITE_CB(TC_IDR_wcb2) { // YOUR CODE HERE (TC_IDR_wcb2) bp1_REG_data.TC_IDR2.value = data; } PPM_REG_WRITE_CB(TC_IER_wcb0) { // YOUR CODE HERE (TC_IER_wcb0) bp1_REG_data.TC_IER0.value = data; } PPM_REG_WRITE_CB(TC_IER_wcb1) { // YOUR CODE HERE (TC_IER_wcb1) bp1_REG_data.TC_IER1.value = data; } PPM_REG_WRITE_CB(TC_IER_wcb2) { // YOUR CODE HERE (TC_IER_wcb2) bp1_REG_data.TC_IER2.value = data; } PPM_REG_WRITE_CB(TC_RA_wcb0) { // YOUR CODE HERE (TC_RA_wcb0) bp1_REG_data.TC_RA0.value = data; } PPM_REG_WRITE_CB(TC_RA_wcb1) { // YOUR CODE HERE (TC_RA_wcb1) bp1_REG_data.TC_RA1.value = data; } PPM_REG_WRITE_CB(TC_RA_wcb2) { // YOUR CODE HERE (TC_RA_wcb2) bp1_REG_data.TC_RA2.value = data; } PPM_REG_WRITE_CB(TC_RB_wcb0) { // YOUR CODE HERE (TC_RB_wcb0) bp1_REG_data.TC_RB0.value = data; } PPM_REG_WRITE_CB(TC_RB_wcb1) { // YOUR CODE HERE (TC_RB_wcb1) bp1_REG_data.TC_RB1.value = data; } PPM_REG_WRITE_CB(TC_RB_wcb2) { // YOUR CODE HERE (TC_RB_wcb2) bp1_REG_data.TC_RB2.value = data; } PPM_REG_WRITE_CB(TC_RC_wcb0) { // YOUR CODE HERE (TC_RC_wcb0) bp1_REG_data.TC_RC0.value = data; } PPM_REG_WRITE_CB(TC_RC_wcb1) { // YOUR CODE HERE (TC_RC_wcb1) bp1_REG_data.TC_RC1.value = data; // Set a callback startTimer(data << bp1_REG_data.TC_CMR1.bits.TCCLKS); } PPM_REG_WRITE_CB(TC_RC_wcb2) { // YOUR CODE HERE (TC_RC_wcb2) bp1_REG_data.TC_RC2.value = data; } PPM_CONSTRUCTOR_CB(constructor) { // YOUR CODE HERE (pre constructor) periphConstructor(); // YOUR CODE HERE (post constructor) write_irq0(0); write_irq1(0); write_irq2(0); } PPM_SAVE_STATE_FN(peripheralSaveState) { // YOUR CODE HERE (peripheralSaveState) } PPM_RESTORE_STATE_FN(peripheralRestoreState) { // YOUR CODE HERE (peripheralRestoreState) }
23.904382
92
0.6705
d630304f91659399ec0028edd516b43790cfb417
77
h
C
released_plugins/v3d_plugins/neurontracing_neutube/src_neutube/neurolabi/gui/ztreeiterator.h
zzhmark/vaa3d_tools
3ca418add85a59ac7e805d55a600b78330d7e53d
[ "MIT" ]
1
2021-12-27T19:14:03.000Z
2021-12-27T19:14:03.000Z
released_plugins/v3d_plugins/neurontracing_neutube/src_neutube/neurolabi/gui/ztreeiterator.h
zzhmark/vaa3d_tools
3ca418add85a59ac7e805d55a600b78330d7e53d
[ "MIT" ]
1
2016-12-03T05:33:13.000Z
2016-12-03T05:33:13.000Z
released_plugins/v3d_plugins/neurontracing_neutube/src_neutube/neurolabi/gui/ztreeiterator.h
zzhmark/vaa3d_tools
3ca418add85a59ac7e805d55a600b78330d7e53d
[ "MIT" ]
null
null
null
#ifndef ZTREEITERATOR_H #define ZTREEITERATOR_H #endif // ZTREEITERATOR_H
11
25
0.805195
c5b44af93dbb4bfce8637f3d170b73a0c7f92031
5,049
h
C
src/osp/Active/SysHierarchy.h
EhWhoAmI/osp-magnum
c4054cd6c4924c37d96c2ef3d628765317778ac9
[ "MIT" ]
null
null
null
src/osp/Active/SysHierarchy.h
EhWhoAmI/osp-magnum
c4054cd6c4924c37d96c2ef3d628765317778ac9
[ "MIT" ]
null
null
null
src/osp/Active/SysHierarchy.h
EhWhoAmI/osp-magnum
c4054cd6c4924c37d96c2ef3d628765317778ac9
[ "MIT" ]
null
null
null
/** * Open Space Program * Copyright © 2019-2020 Open Space Program Project * * MIT License * * 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. */ #pragma once #include "ActiveScene.h" namespace osp::active { class SysHierarchy { public: /** * Add hierarchy component to root entity in scene * * @param rScene [ref] scene with no hierarchy yet */ static void setup(ActiveScene& rScene); /** * Create a new entity, and add a ACompHierarchy to it * * @param rScene [ref] Scene with hierarchy * @param parent [in] Entity to assign as parent * @param name [in] Name of entity * @return New entity created */ static ActiveEnt create_child(ActiveScene& rScene, ActiveEnt parent, std::string const& name = {}); /** * Set parent-child relationship between two nodes containing an * ACompHierarchy * * @param rScene [ref] Scene with hierarchy * @param parent [in] * @param child [in] */ static void set_parent_child(ActiveScene& rScene, ActiveEnt parent, ActiveEnt child); /** * Mark a hierarchy entity for deletion, and cut it out of the hierarchy * * @param rScene [ref] Scene with hierarchy * @param ent [in] Entity to delete */ static void mark_delete_cut(ActiveScene& rScene, ActiveEnt ent) { cut(rScene, ent); rScene.mark_delete(ent); } /** * Cut an entity out of the hierarchy. * * @param rScene [ref] Scene with hierarchy * @param ent [in] */ static void cut(ActiveScene& rScene, ActiveEnt ent); /** * Traverse the scene hierarchy * * Calls the specified callable on each entity of the scene hierarchy * * @param rScene [ref] Scene with hierarchy * @param root The entity whose sub-tree to traverse * @param callable A function that accepts an ActiveEnt as an argument and * returns false if traversal should stop, true otherwise */ template <typename FUNC_T> static void traverse(ActiveScene& rScene, ActiveEnt root, FUNC_T callable); /** * Sort hierarchy component pool * * @param rScene [ref] Scene with hierarchy */ static void sort(ActiveScene& rScene); /** * Mark descendents of deleted hierarchy entities as deleted too * * @param rScene [ref] Scene with hierarchy */ static void update_delete(ActiveScene& rScene); }; template<typename FUNC_T> void SysHierarchy::traverse(ActiveScene& rScene, ActiveEnt root, FUNC_T callable) { using osp::active::ACompHierarchy; std::stack<ActiveEnt> parentNextSibling; ActiveEnt currentEnt = root; unsigned int rootLevel = rScene.reg_get<ACompHierarchy>(root).m_level; while (true) { ACompHierarchy &hier = rScene.reg_get<ACompHierarchy>(currentEnt); if (callable(currentEnt) == EHierarchyTraverseStatus::Stop) { return; } if (hier.m_childCount > 0) { // entity has some children currentEnt = hier.m_childFirst; // Save next sibling for later if it exists // Don't check siblings of the root node if ((hier.m_siblingNext != entt::null) && (hier.m_level > rootLevel)) { parentNextSibling.push(hier.m_siblingNext); } } else if ((hier.m_siblingNext != entt::null) && (hier.m_level > rootLevel)) { // no children, move to next sibling currentEnt = hier.m_siblingNext; } else if (parentNextSibling.size() > 0) { // last sibling, and not done yet // is last sibling, move to parent's (or ancestor's) next sibling currentEnt = parentNextSibling.top(); parentNextSibling.pop(); } else { break; } } } }
30.97546
82
0.632204
c5d562f1e0852735c2be913a6af9d126adc4a690
1,535
c
C
software/firmware/linuxdoom-1.10/i_main_badge.c
netik/dc28_badge
356ba57b4d1e83c310cc6136bd7f038df7533031
[ "Apache-2.0" ]
1
2020-08-29T03:33:14.000Z
2020-08-29T03:33:14.000Z
software/firmware/linuxdoom-1.10/i_main_badge.c
netik/dc28_badge
356ba57b4d1e83c310cc6136bd7f038df7533031
[ "Apache-2.0" ]
null
null
null
software/firmware/linuxdoom-1.10/i_main_badge.c
netik/dc28_badge
356ba57b4d1e83c310cc6136bd7f038df7533031
[ "Apache-2.0" ]
null
null
null
// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // $Id:$ // // Copyright (C) 1993-1996 by id Software, Inc. // // This source is available for distribution and/or modification // only under the terms of the DOOM Source Code License as // published by id Software. All rights reserved. // // The source is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License // for more details. // // $Log:$ // // DESCRIPTION: // Main program, simply calls D_DoomMain high level loop. // //----------------------------------------------------------------------------- static const char rcsid[] = "$Id: i_main.c,v 1.4 1997/02/03 22:45:10 b1 Exp $"; #include <stdlib.h> #include <unistd.h> #include "doomdef.h" #include "m_argv.h" #include "d_main.h" #include "i_net.h" #include "i_system.h" #include "w_wad.h" #include "doomstat.h" jmp_buf exit_env; int doom_main ( int argc, char** argv ) { int i; myargc = argc; myargv = argv; if (setjmp (exit_env) != 0) goto doom_exit; D_DoomMain (); doom_exit: if (doomcom != NULL) { free (doomcom); doomcom = NULL; } if (lumpinfo != NULL) { free (lumpinfo); lumpinfo = NULL; } if (lumpcache != NULL) { free (lumpcache); lumpcache = NULL; } for (i = 3; i < 8; i++) close (i); I_ShutdownNetwork (); return 0; }
19.43038
79
0.565472
684866c208f9d9306bfc5cc81ec9ceba71263efd
2,955
h
C
Pods/NCMB/NCMB/NCMBTwitter/NCMBOAConsumer/NCMBOAMutableURLRequest.h
FromF/nifty_mobilebackend_demo
a9e9551660991938943efbca41a7425d2b3735ff
[ "MIT" ]
1
2017-04-28T04:02:26.000Z
2017-04-28T04:02:26.000Z
NCMB/NCMBTwitter/NCMBOAConsumer/NCMBOAMutableURLRequest.h
FujikawaKei/ncmb_ios
2db843144160d7b3542380decb3457b3e0ea76d9
[ "Apache-2.0" ]
null
null
null
NCMB/NCMBTwitter/NCMBOAConsumer/NCMBOAMutableURLRequest.h
FujikawaKei/ncmb_ios
2db843144160d7b3542380decb3457b3e0ea76d9
[ "Apache-2.0" ]
1
2020-10-08T07:29:25.000Z
2020-10-08T07:29:25.000Z
/* Copyright 2014 NIFTY Corporation All Rights Reserved. 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. */ // // OAMutableURLRequest.h // OAuthConsumer // // Created by Jon Crosby on 10/19/07. // Copyright 2007 Kaboomerang LLC. All rights reserved. // // 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. #import <Foundation/Foundation.h> #import "NCMBOAConsumer.h" #import "NCMBOAToken.h" #import "NCMBOASignatureProviding.h" #import "NCMBOAHMAC_SHA1SignatureProvider.h" #import "NCMBOASignatureProviding.h" #import "NSMutableURLRequestParameters.h" #import "NSURLBase.h" @interface NCMBOAMutableURLRequest : NSMutableURLRequest { @protected NCMBOAConsumer *consumer; NCMBOAToken *token; id<NCMBOASignatureProviding> signatureProvider; NSString *realm; NSString *signature; NSString *nonce; NSString *timestamp; } @property(readonly) NSString *signature; @property(readonly) NSString *nonce; - (id)initWithURL:(NSURL *)aUrl consumer:(NCMBOAConsumer *)aConsumer token:(NCMBOAToken *)aToken realm:(NSString *)aRealm signatureProvider:(id<NCMBOASignatureProviding>)aProvider; - (id)initWithURL:(NSURL *)aUrl consumer:(NCMBOAConsumer *)aConsumer token:(NCMBOAToken *)aToken realm:(NSString *)aRealm signatureProvider:(id<NCMBOASignatureProviding>)aProvider nonce:(NSString *)aNonce timestamp:(NSString *)aTimestamp; - (void)prepare; @end
35.178571
81
0.752961
d03cec36304ef0b23a94c81be4a5572a42845857
7,603
h
C
applications/ShallowWaterApplication/custom_elements/boussinesq_element.h
clazaro/Kratos
b947b82c90dfcbf13d60511427f85990d36b90be
[ "BSD-4-Clause" ]
null
null
null
applications/ShallowWaterApplication/custom_elements/boussinesq_element.h
clazaro/Kratos
b947b82c90dfcbf13d60511427f85990d36b90be
[ "BSD-4-Clause" ]
null
null
null
applications/ShallowWaterApplication/custom_elements/boussinesq_element.h
clazaro/Kratos
b947b82c90dfcbf13d60511427f85990d36b90be
[ "BSD-4-Clause" ]
null
null
null
// | / | // ' / __| _` | __| _ \ __| // . \ | ( | | ( |\__ ` // _|\_\_| \__,_|\__|\___/ ____/ // Multi-Physics // // License: BSD License // Kratos default license: kratos/license.txt // // Main authors: Miguel Maso Sotomayor // #ifndef KRATOS_BOUSSINESQ_ELEMENT_H_INCLUDED #define KRATOS_BOUSSINESQ_ELEMENT_H_INCLUDED // System includes // External includes // Project includes #include "wave_element.h" namespace Kratos { ///@addtogroup ShallowWaterApplication ///@{ ///@name Kratos Globals ///@{ ///@} ///@name Type Definitions ///@{ ///@} ///@name Enum's ///@{ ///@} ///@name Functions ///@{ ///@} ///@name Kratos Classes ///@{ ///@brief Implementation of a linear element for shallow water problems template<std::size_t TNumNodes> class BoussinesqElement : public WaveElement<TNumNodes> { public: ///@name Type Definitions ///@{ typedef std::size_t IndexType; typedef Node<3> NodeType; typedef Geometry<NodeType> GeometryType; typedef WaveElement<TNumNodes> WaveElementType; typedef typename WaveElementType::VectorType VectorType; typedef typename WaveElementType::NodesArrayType NodesArrayType; typedef typename WaveElementType::PropertiesType PropertiesType; typedef typename WaveElementType::ElementData ElementData; typedef typename WaveElementType::LocalMatrixType LocalMatrixType; typedef typename WaveElementType::LocalVectorType LocalVectorType; typedef typename WaveElementType::ShapeFunctionsGradientsType ShapeFunctionsGradientsType; ///@} ///@name Pointer definition ///@{ KRATOS_CLASS_INTRUSIVE_POINTER_DEFINITION(BoussinesqElement); ///@} ///@name Life Cycle ///@{ /** * @brief Default constructor */ BoussinesqElement() : WaveElementType(){} /** * @brief Constructor using an array of nodes */ BoussinesqElement(IndexType NewId, const NodesArrayType& ThisNodes) : WaveElementType(NewId, ThisNodes){} /** * @brief Constructor using Geometry */ BoussinesqElement(IndexType NewId, GeometryType::Pointer pGeometry) : WaveElementType(NewId, pGeometry){} /** * @brief Constructor using Geometry and Properties */ BoussinesqElement(IndexType NewId, GeometryType::Pointer pGeometry, typename PropertiesType::Pointer pProperties) : WaveElementType(NewId, pGeometry, pProperties){} /** * @brief Destructor */ ~ BoussinesqElement() override {}; ///@} ///@name Operations ///@{ /** * @brief Create a new element pointer * @param NewId: the ID of the new element * @param ThisNodes: the nodes of the new element * @param pProperties: the properties assigned to the new element * @return a Pointer to the new element */ Element::Pointer Create(IndexType NewId, NodesArrayType const& ThisNodes, typename PropertiesType::Pointer pProperties) const override { return Kratos::make_intrusive<BoussinesqElement<TNumNodes>>(NewId, this->GetGeometry().Create(ThisNodes), pProperties); } /** * @brief Create a new element pointer * @param NewId: the ID of the new element * @param pGeom: the geometry to be employed * @param pProperties: the properties assigned to the new element * @return a Pointer to the new element */ Element::Pointer Create(IndexType NewId, GeometryType::Pointer pGeom, typename PropertiesType::Pointer pProperties) const override { return Kratos::make_intrusive<BoussinesqElement<TNumNodes>>(NewId, pGeom, pProperties); } /** * @brief Create a new element pointer and clone the previous element data * @param NewId the ID of the new element * @param rThisNodes the nodes of the new element * @return a Pointer to the new element */ Element::Pointer Clone(IndexType NewId, NodesArrayType const& ThisNodes) const override { Element::Pointer p_new_elem = Create(NewId, this->GetGeometry().Create(ThisNodes), this->pGetProperties()); p_new_elem->SetData(this->GetData()); p_new_elem->Set(Flags(*this)); return p_new_elem; } /** * @brief Calculate the velocity laplacian projection * @param rCurrentProcessInfo Reference to the ProcessInfo from the ModelPart containing the elements */ void InitializeNonLinearIteration(const ProcessInfo& rCurrentProcessInfo) override; /** * @brief Calculate the rhs according to the Adams-Moulton scheme * @param rRightHandSideVector Elemental right hand side vector * @param rCurrentProcessInfo Reference to the ProcessInfo from the ModelPart containing the element * @see ResidualBasedAdamsMoultonScheme */ void CalculateRightHandSide(VectorType& rRightHandSideVector, const ProcessInfo& rCurrentProcessInfo) override; /** * @brief Add the explicit contribution according to the Adams-Bashforth scheme * @param rCurrentProcessInfo the current process info instance */ void AddExplicitContribution(const ProcessInfo& rCurrentProcessInfo) override; ///@} ///@name Input and output ///@{ /** * @brief Turn back information as a string. */ std::string Info() const override { return "BoussinesqElement"; } ///@} protected: ///@name Protected static Member Variables ///@{ static constexpr IndexType mLocalSize = WaveElementType::mLocalSize; ///@} ///@name Protected Operations ///@{ void AddRightHandSide( LocalVectorType& rRHS, ElementData& rData, const Matrix& rNContainer, const ShapeFunctionsGradientsType& rDN_DXContainer, const Vector& rWeights); void AddAuxiliaryLaplacian( LocalMatrixType& rLaplacian, const ElementData& rData, const array_1d<double,TNumNodes>& rN, const BoundedMatrix<double,TNumNodes,2>& rDN_DX, const double Weight = 1.0); const Variable<double>& GetUnknownComponent(int Index) const override; LocalVectorType GetUnknownVector(const ElementData& rData) const override; void GetNodalData(ElementData& rData, const GeometryType& rGeometry, int Step = 0) override; void UpdateGaussPointData(ElementData& rData, const array_1d<double,TNumNodes>& rN) override; double StabilizationParameter(const ElementData& rData) const override; void AddDispersiveTerms( LocalVectorType& rVector, const ElementData& rData, const array_1d<double,TNumNodes>& rN, const BoundedMatrix<double,TNumNodes,2>& rDN_DX, const double Weight = 1.0) override; void AddMassTerms( LocalMatrixType& rMatrix, const ElementData& rData, const array_1d<double,TNumNodes>& rN, const BoundedMatrix<double,TNumNodes,2>& rDN_DX, const double Weight = 1.0) override; ///@} private: ///@name Serialization ///@{ friend class Serializer; void save(Serializer& rSerializer) const override { KRATOS_SERIALIZE_SAVE_BASE_CLASS(rSerializer, Element); } void load(Serializer& rSerializer) override { KRATOS_SERIALIZE_LOAD_BASE_CLASS(rSerializer, Element); } ///@} ///@name Private Inquiry ///@{ ///@} ///@name Un accessible methods ///@{ ///@} }; // Class BoussinesqElement ///@} ///@name Input and output ///@{ ///@} ///@} addtogroup block } // namespace Kratos. #endif // KRATOS_BOUSSINESQ_ELEMENT_H_INCLUDED defined
26.960993
168
0.673944
fdad41612ef70cd3ab7e373e84a86d2630c82d9b
4,061
h
C
COGengine/src/Graphics/SheetAnim.h
dodoknight/CogEngine
fda1193c2d1258ba9780e1025933d33a8dce2284
[ "MIT" ]
3
2016-06-01T10:14:00.000Z
2016-10-11T15:53:45.000Z
COGengine/src/Graphics/SheetAnim.h
dormantor/ofxCogEngine
fda1193c2d1258ba9780e1025933d33a8dce2284
[ "MIT" ]
null
null
null
COGengine/src/Graphics/SheetAnim.h
dormantor/ofxCogEngine
fda1193c2d1258ba9780e1025933d33a8dce2284
[ "MIT" ]
1
2020-08-15T17:01:00.000Z
2020-08-15T17:01:00.000Z
#pragma once #include "GeneralAnim.h" namespace Cog { /** * Entity for sprite sheet animations */ class SheetAnim : public GeneralAnim { protected: // path to sheet string sheetPath = ""; // number of frames per one line the sprite sheet contains int frames = 1; // number of lines in spritesheet int lines = 1; // start frame int start = 1; // final frame int end = 1; // sequence increment (e.g. value of 2 switches to new frame every second Draw loop) int increment = 1; // list of paths to sheets this animation contains vector<string> sheets; // indicator whether the sheet array has been initialized bool sheetInit = false; public: SheetAnim() { } /** * Creates a new sheet animation * @param name animation name * @param sheetPath path to sheet * @param ref name of referenced animation * @param frames number of frames per one line the sprite sheet contains * @param lines number of lines in sprite sheet * @param start starting fram,e * @param end final frame * @param increment sequence increment (e.g. value of 2 switches to new frame every second Draw loop) * @param speed animation speed * @param repeat number of repetitions (0 for infinite) * @param isRevert indicator whether the animation is inverted */ SheetAnim(string name, string sheetPath, string ref, int frames, int lines, int start, int end, int increment, float speed, int repeat, bool isRevert); SheetAnim(const SheetAnim& copy) { sheetPath = copy.sheetPath; frames = copy.frames; lines = copy.lines; start = copy.start; end = copy.end; increment = copy.increment; sheets = copy.sheets; sheetInit = copy.sheetInit; } /** * Copies all parameters from other animation */ void GetParametersFromReference(spt<GeneralAnim> reference); virtual void LoadAttributesFromXml(xml_node& xml); /** * Initializes list of paths to all sheets this animation contains */ void InitSheets(); /** * Gets sheet name at selected index */ string GetSheet(int frameIndex) { if (!sheetInit) InitSheets(); return sheets[frameIndex]; } virtual bool IsAnimatable() { return HasSheets(); } virtual bool IsContinous() { return false; } virtual int GetDuration() { return GetTotalFrames(); } /** * Returns true, if this animation has sheet(s) */ bool HasSheets() { return sheetPath.length() != 0; } /** * Gets path to the animation sheet */ const string GetSheetPath() const { return sheetPath; } /** * Sets path to the animation sheet */ void SetSheetPath(string sheetPath) { this->sheetPath = sheetPath; } /** * Gets number of frames in one line in the sprite sheet */ int GetFrames() const { return frames; } /** * Gets total number of frames */ int GetTotalFrames() const { return (end - start + 1 + (increment - 1)) / increment; } /** * Sets number of frames in one line in the sprite sheet */ void SetFrames(int frames) { this->frames = frames; } /** * Gets number of lines in spritesheet */ int GetLines() const { return lines; } /** * Sets number of lines in spritesheet */ void SetLines(int lines) { this->lines = lines; } /** * Gets starting frame */ int GetStart() const { return start; } /** * Sets starting frame */ void SetStart(int start) { this->start = start; } /** * Gets ending frame */ int GetEnd() const { return end; } /** * Sets ending frame */ void SetEnd(int end) { this->end = end; } /** * Gets increment value */ int GetIncrement() const { return increment; } /** * Sets increment value */ void SetIncrement(int increment) { this->increment = increment; } /** * Gets collection of paths to all sheets */ vector<string>& GetSheetPaths() { if (!sheetInit) InitSheets(); return sheets; } /** * Preloads all images */ void PreloadImages(); virtual spt<GeneralAnim> Clone(); }; }// namespace
19.246445
102
0.64787
457c0ad6e1175732f05312dc0172f0d8cd2f997e
1,174
h
C
Other/Headers/GroupItem.h
XWJACK/WeChatPlugin-MacOS
4241ddb10ccce9484fcf6d5bd51a6afa3b446632
[ "MIT" ]
2
2019-01-11T02:02:55.000Z
2020-04-23T02:42:01.000Z
Other/Headers/GroupItem.h
XWJACK/WeChatPlugin-MacOS
4241ddb10ccce9484fcf6d5bd51a6afa3b446632
[ "MIT" ]
null
null
null
Other/Headers/GroupItem.h
XWJACK/WeChatPlugin-MacOS
4241ddb10ccce9484fcf6d5bd51a6afa3b446632
[ "MIT" ]
1
2021-01-09T14:54:27.000Z
2021-01-09T14:54:27.000Z
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import "PBGeneratedMessage.h" @class NSString; @interface GroupItem : PBGeneratedMessage { unsigned int hasGroupKey:1; unsigned int hasGroupId:1; unsigned int hasInvoiceUrl:1; unsigned int groupId; NSString *groupKey; NSString *invoiceUrl; } + (id)parseFromData:(id)arg1; @property(retain, nonatomic, setter=SetInvoiceUrl:) NSString *invoiceUrl; // @synthesize invoiceUrl; @property(readonly, nonatomic) BOOL hasInvoiceUrl; // @synthesize hasInvoiceUrl; @property(nonatomic, setter=SetGroupId:) unsigned int groupId; // @synthesize groupId; @property(readonly, nonatomic) BOOL hasGroupId; // @synthesize hasGroupId; @property(retain, nonatomic, setter=SetGroupKey:) NSString *groupKey; // @synthesize groupKey; @property(readonly, nonatomic) BOOL hasGroupKey; // @synthesize hasGroupKey; - (void).cxx_destruct; - (id)mergeFromCodedInputStream:(id)arg1; - (int)serializedSize; - (void)writeToCodedOutputStream:(id)arg1; - (BOOL)isInitialized; - (id)init; @end
31.72973
100
0.741056
a502895209850011de62b92d847c87a943da9ae0
2,898
h
C
jni/mcpe/block/entity/BlockEntity.h
SmartDEVTeam/ExNihiloPE
8a3636ff72456a6ae156f23ea79d871fa3721754
[ "Apache-2.0" ]
5
2017-03-02T18:58:02.000Z
2017-07-14T06:26:52.000Z
jni/mcpe/block/entity/BlockEntity.h
Virtualoso/ExNihiloPE
8a3636ff72456a6ae156f23ea79d871fa3721754
[ "Apache-2.0" ]
3
2017-03-06T19:37:43.000Z
2017-06-09T17:48:39.000Z
jni/mcpe/block/entity/BlockEntity.h
Virtualoso/ExNihiloPE
8a3636ff72456a6ae156f23ea79d871fa3721754
[ "Apache-2.0" ]
5
2017-03-05T03:50:19.000Z
2017-06-12T09:57:31.000Z
#pragma once #include <string> #include <vector> #include "BlockEntityType.h" #include "../../level/BlockPos.h" #include "../../math/AABB.h" #include "../../packet/BlockEntityDataPacket.h" class Block; class CompoundTag; class BlockSource; enum class BlockEntityRendererId : int { DEFAULT, SIGN, //TODO: Need more research }; class BlockEntity { public: /* 0x04 */ int unknown1; /* 0x08 */ Block* blockOwner; /* 0x0C */ int unknown2; /* 0x10 */ char filler2[12]; // Vec3? /* 0x1C */ int unknown3; /* 0x20 */ BlockPos pos; /* 0x2C */ AABB aabb; /* 0x48 */ int data; /* 0x4C */ BlockEntityType type; /* 0x50 */ int runningId; /* 0x54 */ bool clientSideOnly; /* 0x55 */ bool movable; /* 0x56 */ bool customNameSaved; /* 0x58 */ BlockEntityRendererId rendererId; /* 0x5C */ char customName[4]; /* 0x60 */ bool renderCustomName; /* 0x61 */ bool changed; /* size = 0x60 */ // virtual virtual ~BlockEntity(); virtual void load(CompoundTag const&); virtual bool save(CompoundTag&) const; virtual void* saveItemInstanceData(CompoundTag&); virtual void* saveBlockData(CompoundTag&, BlockSource&) const; virtual void loadBlockData(const CompoundTag&, BlockSource&); virtual void tick(BlockSource&); virtual bool isFinished(); virtual void onChanged(BlockSource&); virtual bool isMovable(); virtual bool isCustomNameSaved(); virtual BlockEntityDataPacket* getUpdatePacket(BlockSource&); virtual void onPlace(BlockSource&); virtual void onUpdatePacket(CompoundTag const&, BlockSource&); virtual void onMove(); virtual void onRemoved(BlockSource&); virtual void triggerEvent(int, int); virtual BlockEntity* clearCache(); virtual void onNeighborChanged(BlockSource&, BlockPos const&); virtual int getShadowRadius(BlockSource&) const; virtual bool hasAlphaLayer() const; virtual void* getCrackEntity(BlockSource&, BlockPos const&); virtual std::string getDebugText(std::vector<std::string>&); virtual std::string getCustomName() const; virtual std::string getName() const; // non virtual BlockEntity(BlockEntityType, BlockPos const&, std::string const&); void _destructionWobble(float&, float&, float&); void _resetAABB(); float distanceToSqr(Vec3 const&); AABB getAABB(); Block* getBlock(); int getData(); BlockPos getPosition(); BlockEntityRendererId getRendererId(); int getRunningId(); BlockEntityType getType() const; bool isClientSideOnly(); bool isInWorld(); bool isType(BlockEntityType); void moveTo(BlockPos const&); void setBB(AABB); void setChanged(); void setClientSideOnly(bool); void setData(int); void setMovable(bool); void setRendererId(BlockEntityRendererId); void setRunningId(int); void stopDestroy(); // static static void initBlockEntities(); static bool isType(BlockEntity&, BlockEntityType); static BlockEntity* loadStatic(CompoundTag const&); static void setId(BlockEntityType, std::string const&); };
28.135922
67
0.733954
b749eee16afe51cf7b8f9d138455a1715229ca70
7,224
h
C
src/aton_node.h
mtb-tools/Aton
ec6f2adc7ecacce2ac47035beb6b0965a7dd2e12
[ "BSD-3-Clause" ]
102
2016-01-19T22:54:08.000Z
2022-01-25T18:07:02.000Z
src/aton_node.h
ZBYVFX/Aton
2d9d511ee2ea721d852d7d06482a90985565fe95
[ "BSD-3-Clause" ]
52
2015-12-14T16:24:40.000Z
2022-01-13T15:43:13.000Z
src/aton_node.h
ZBYVFX/Aton
2d9d511ee2ea721d852d7d06482a90985565fe95
[ "BSD-3-Clause" ]
24
2016-01-21T04:46:43.000Z
2021-12-13T22:45:17.000Z
/* Copyright (c) 2019, Dan Bethell, Johannes Saam, Vahan Sosoyan. All rights reserved. See COPYING.txt for more details. */ #ifndef Aton_h #define Aton_h #include <DDImage/Iop.h> #include <DDImage/Row.h> #include <DDImage/Knobs.h> #include <DDImage/Thread.h> #include <DDImage/Version.h> #include <DDImage/TableKnobI.h> #include <DDImage/MetaData.h> using namespace DD::Image; #include "aton_client.h" #include "aton_server.h" #include "aton_framebuffer.h" // Class name static const char* const CLASS = "Aton"; // Help static const char* const HELP = "Aton v1.3.7 \n" "Listens for renders coming from the Aton display driver. " "For more info go to http://sosoyan.github.io/Aton/"; std::string get_date() { // Returns date and time time_t rawtime; struct tm *timeinfo; char time_buffer[15]; time (&rawtime); timeinfo = localtime(&rawtime); // Setting up the Date and Time format style strftime(time_buffer, 20, "%m.%d_%H:%M:%S", timeinfo); return std::string(time_buffer); } // Nuke node class Aton: public Iop { public: Aton* m_node; // First node pointer Server m_server; // Aton::Server ReadWriteLock m_mutex; // Mutex for locking the pixel buffer Format m_fmt; // The nuke display format FormatPair m_fmtp; // Buffer format (knob) ChannelSet m_channels; // Channels aka AOVs object int m_port; // Port we're listening on (knob) int m_output_changed; // If Snapshots needs to be updated float m_cam_fov; // Default Camera fov float m_cam_matrix; // Default Camera matrix value bool m_multiframes; // Enable Multiple Frames toogle bool m_write_frames; // Write AOVs bool m_enable_aovs; // Enable AOVs toogle bool m_live_camera; // Enable Live Camera toogle bool m_inError; // Error handling bool m_format_exists; // If the format was already exist bool m_capturing; // Capturing signal bool m_legit; // Used to throw the threads bool m_running; // Thread Rendering unsigned int m_hash_count; // Refresh hash counter const char* m_path; // Default path for Write node double m_region[4]; // Render Region Data std::string m_node_name; // Node name std::string m_status; // Status bar text std::string m_connection_error; // Connection error report Knob* m_outputKnob; // Shapshots Knob std::vector<FrameBuffer> m_framebuffers; // Framebuffers List MetaData::Bundle m_metadata; // Metadata object Aton(Node* node): Iop(node), m_node(first_node()), m_fmt(Format(0, 0, 1.0)), m_channels(Mask_RGBA), m_port(get_port()), m_cam_fov(0), m_cam_matrix(0), m_output_changed(0), m_multiframes(false), m_enable_aovs(true), m_live_camera(false), m_write_frames(false), m_inError(false), m_format_exists(false), m_capturing(false), m_legit(false), m_running(false), m_path(""), m_node_name(""), m_status(""), m_connection_error("") { inputs(0); m_region[0] = m_region[1] = m_region[2] = m_region[3] = 0.0f; } ~Aton() { disconnect(); } Aton* first_node() { return dynamic_cast<Aton*>(firstOp()); } void attach(); void detach(); void append(Hash& hash); void _validate(bool for_real); const MetaData::Bundle& _fetchMetaData(const char* keyname); void engine(int y, int x, int r, ChannelMask channels, Row& out); void knobs(Knob_Callback f); int knob_changed(Knob* _knob); enum KnobChanged { item_not_changed = 0, item_added, item_copied, item_moved_up, item_moved_down, item_removed }; int get_port(); std::string get_path(); void disconnect(); void change_port(int port); void flag_update(const Box& box = Box(0,0,0,0)); FrameBuffer* add_framebuffer(); FrameBuffer* current_framebuffer(); FrameBuffer* get_framebuffer(const long long& session); RenderBuffer* current_renderbuffer(); int current_fb_index(bool direction = true); std::vector<int> selected_fb_indexes(); void set_outputs(); void set_format(const int& width, const int& height, const float& pixel_aspect); void set_channels(std::vector<std::string>& aovs, const bool& ready); void reset_channels(ChannelSet& channels); void set_camera(const float& fov, const Matrix4& matrix); void set_current_frame(const double& frame); void set_status(const long long& progress = 0, const long long& ram = 0, const long long& p_ram = 0, const double& frame = 0, const char* time = "", const char* version = "", const char* samples = "", const char* output = ""); void live_camera_toogle(); bool path_valid(std::string path); std::vector<std::string> get_captures(); void multiframe_cmd(); void select_output_cmd(); void snapshot_cmd(); void move_cmd(bool direction); void remove_selected_cmd(); void reset_region_cmd(); void fit_region_cmd(); void copy_region_cmd(); void capture_cmd(); void import_cmd(bool all); bool firstEngineRendersWholeRequest() const { return true; } const char* Class() const { return CLASS; } const char* displayName() const { return CLASS; } const char* node_help() const { return HELP; } static const Iop::Description desc; }; #endif /* Aton_h */
38.222222
93
0.499862
b77226eac36ee7e1814b95f152c34d4cb202cc47
12,349
c
C
ledmgr_rtmsg.c
rdkcmf/rdkc-ledmgr
f3b59d80f51ae160aced7705e151b96ca6e21912
[ "Apache-2.0" ]
null
null
null
ledmgr_rtmsg.c
rdkcmf/rdkc-ledmgr
f3b59d80f51ae160aced7705e151b96ca6e21912
[ "Apache-2.0" ]
null
null
null
ledmgr_rtmsg.c
rdkcmf/rdkc-ledmgr
f3b59d80f51ae160aced7705e151b96ca6e21912
[ "Apache-2.0" ]
null
null
null
#include "ledmgr_rtmsg.h" #include "ledhal.h" #include <string.h> #include "ledmgrlogger.h" void rtConnection_Init() { LEDMGR_LOG_INFO("Led Communicates via secure path \n"); rtConnection_Create(&con, "XCAM_LED", "tcp://127.0.0.1:10001"); } void rtConnection_leddestroy() { rtConnection_Destroy(con); } int xw_isconnected() { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval=1; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_isconnected"); err = rtConnection_SendRequest(con, req, "XW4.ISCONNECTED", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetString(res,"state",&state); rtMessage_GetInt32(res,"retval",&retval); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_file_get() { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval=0; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_file_get"); err = rtConnection_SendRequest(con, req, "XW4.FILEGET", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); if(retval == 1) { FILE *ptr = fopen("/opt/usr_config/xwsystem.conf","w"); for(int i=0;i<5;i++) { rtMessage temp; char const *val = NULL; rtMessage_GetMessageItem(res,"ledarr",i,&temp); rtMessage_GetString(temp,"led",&val); rtLog_Debug("val:%s \n",val); fputs(val, ptr); } fclose(ptr); } } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_init(int ledId) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_init"); rtMessage_SetInt32(req, "ledid",ledId); err = rtConnection_SendRequest(con, req, "XW4.LEDINIT", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetString(res,"state",&state); rtMessage_GetInt32(res,"retval",&retval); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_reset(int ledId) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_reset"); rtMessage_SetInt32(req, "ledid",ledId); err = rtConnection_SendRequest(con, req, "XW4.LEDRESET", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Info("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_resetAll() { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_resetAll"); err = rtConnection_SendRequest(con, req, "XW4.LEDRESETALL", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetString(res,"state",&state); rtMessage_GetInt32(res,"retval",&retval); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_setEnable(int ledid,int enable) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_setEnable"); rtMessage_SetInt32(req, "ledid", ledid); rtMessage_SetInt32(req, "enable",enable); err = rtConnection_SendRequest(con, req, "XW4.LEDSETENABLE", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_setColor(int ledid,uint8_t R, uint8_t G, uint8_t B) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_Color"); rtMessage_SetInt32(req, "ledid",ledid); rtMessage_SetInt32(req, "R", R); rtMessage_SetInt32(req, "G", G); rtMessage_SetInt32(req, "B", B); err = rtConnection_SendRequest(con, req, "XW4.LEDSETCOLOR", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_setBrightness(int ledid,uint8_t R, uint8_t G, uint8_t B) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_setBrightness"); rtMessage_SetInt32(req, "ledid",ledid); rtMessage_SetInt32(req, "R", R); rtMessage_SetInt32(req, "G", G); rtMessage_SetInt32(req, "B", B); err = rtConnection_SendRequest(con, req, "XW4.LEDSETBRIGHTNESS", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_setBlink(int ledid,uint32_t offtime, uint32_t ontime) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_setBlink"); rtMessage_SetInt32(req, "ledid",ledid); rtMessage_SetInt32(req, "ontime", ontime); rtMessage_SetInt32(req, "offtime", offtime); err = rtConnection_SendRequest(con, req, "XW4.LEDSETBLINK", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_setBlinkSequence(int ledid,uint32_t ontime, uint32_t offtime1, uint32_t count, uint32_t offtime2) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_setBlinkSequence"); rtMessage_SetInt32(req, "ledid",ledid); rtMessage_SetInt32(req, "ontime", ontime); rtMessage_SetInt32(req, "count", count); rtMessage_SetInt32(req, "offtime", offtime1); rtMessage_SetInt32(req, "offtime", offtime2); err = rtConnection_SendRequest(con, req, "XW4.LEDSETBLINKSEQUENCE", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_setOnOff(int ledid,const char* onoff) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval,ret; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_setOnOff"); rtMessage_SetInt32(req, "ledid",ledid); rtMessage_SetString(req,"onoff",onoff); err = rtConnection_SendRequest(con, req, "XW4.LEDSETONOFF", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_applySettings(int ledid) { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_applySettings"); rtMessage_SetInt32(req, "ledid",ledid); err = rtConnection_SendRequest(con, req, "XW4.LEDAPPLYSETTINGS", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_applyAllSettings() { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_led_applyAllSettings"); err = rtConnection_SendRequest(con, req, "XW4.LEDAPPLYALLSETTINGS", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; } int xw_led_getErrorMsg() { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; int errval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_ledgetErrorMsg"); err = rtConnection_SendRequest(con, req, "XW4.LEDGETERRORMSG", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetInt32(res,"errval",&errval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s %d \n",retval,state,errval); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return errval; } int xw_led_getVersion() { rtMessage res=NULL; rtMessage req=NULL; rtError err; int retval; char const* state = NULL; rtMessage_Create(&req); rtMessage_SetString(req, "fname", "xw_ledgetVersion"); err = rtConnection_SendRequest(con, req, "XW4.LEDGETVERSION", &res, 2000); rtLog_Debug("SendRequest:%s", rtStrError(err)); if (err == RT_OK) { char* p = NULL; uint32_t len = 0; rtMessage_ToString(res, &p, &len); rtLog_Debug("\tres:%.*s\n", len, p); free(p); rtMessage_GetInt32(res,"retval",&retval); rtMessage_GetString(res,"state",&state); rtLog_Debug("returnval: %d %s \n",retval,state); } rtMessage_Release(req); if(res != NULL) rtMessage_Release(res); return retval; }
24.947475
108
0.693335
a24b233b0e7b57dd3284c78f2646caec064c6834
885
h
C
src/gui/shelloptions.h
khaotik/neovim-qt
101e0a15948c6632bb1f572dc2f3500419702f92
[ "0BSD" ]
null
null
null
src/gui/shelloptions.h
khaotik/neovim-qt
101e0a15948c6632bb1f572dc2f3500419702f92
[ "0BSD" ]
null
null
null
src/gui/shelloptions.h
khaotik/neovim-qt
101e0a15948c6632bb1f572dc2f3500419702f92
[ "0BSD" ]
null
null
null
#pragma once namespace NeovimQt { class ShellOptions final { public: bool IsTablineEnabled() const noexcept { return m_isTablineEnabled; } bool IsPopupmenuEnabled() const noexcept { return m_isPopupmenuEnabled; } bool IsLineGridEnabled() const noexcept { return m_isLineGridEnabled; } int GetOptionShowTabline() const noexcept { return m_showtabline; } void SetIsTablineEnabled(bool isEnabled) noexcept { m_isTablineEnabled = isEnabled; } void SetIsPopupmenuEnabled(bool isEnabled) noexcept { m_isPopupmenuEnabled = isEnabled; } void SetIsLineGridEnabled(bool isEnabled) noexcept { m_isLineGridEnabled = isEnabled; } void SetOptionShowTabline(int value) noexcept { m_showtabline = value; } private: bool m_isTablineEnabled{ false }; bool m_isPopupmenuEnabled{ false }; bool m_isLineGridEnabled{ true }; int m_showtabline{ 1 /*TwoOrMore*/ }; }; } // namespace NeovimQt
35.4
90
0.787571
2ec895545e871c3c1c78a9e2e4ef17136b553c3e
6,640
h
C
src/core/MergeableTask.h
Opticalp/instrumentall
f952c1cd54f375dc4cb258fec5af34d14c2b8044
[ "MIT" ]
1
2020-05-19T02:06:55.000Z
2020-05-19T02:06:55.000Z
src/core/MergeableTask.h
Opticalp/instrumentall
f952c1cd54f375dc4cb258fec5af34d14c2b8044
[ "MIT" ]
16
2015-11-18T13:25:30.000Z
2018-05-17T19:25:46.000Z
src/core/MergeableTask.h
Opticalp/instrumentall
f952c1cd54f375dc4cb258fec5af34d14c2b8044
[ "MIT" ]
null
null
null
/** * @file src/core/MergeableTask.h * @date May 2016 * @author Applied Informatics Software Engineering GmbH and contributors * * Original Poco::Task code checked out from https://github.com/pocoproject/poco * commit d6ebf591 (May 2016) */ // // Task.h // // $Id: //poco/1.4/Foundation/include/Poco/Task.h#2 $ // // Library: Foundation // Package: Tasks // Module: Tasks // // Definition of the Task class. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // SPDX-License-Identifier: BSL-1.0 // #ifndef SRC_MERGEABLETASK_H_ #define SRC_MERGEABLETASK_H_ #include "Poco/Runnable.h" #include "Poco/RefCountedObject.h" #include "Poco/AutoPtr.h" #include "Poco/Mutex.h" #include "Poco/RWLock.h" #include "Poco/Event.h" #include "Poco/Timestamp.h" #include <set> class TaskManager; #include "ExecutionAbortedException.h" POCO_DECLARE_EXCEPTION(, TaskMergedException, Poco::Exception) /** * MergeableTask * * Re-implementation of Poco::Task: * > A Task is a subclass of Runnable that has a name * > and supports progress reporting and cancellation. * > A TaskManager object can be used to take care of the * > lifecycle of a Task. * * The MergeableTask is a Poco::Task which derived class ModuleTask * will control a Module execution. * It expends the Poco::Task by allowing to virtually merge tasks * (see slavedTasks and masterTask). * * In the frame of InstrumentAll, those tasks are designed to be used once, * then deleted. run() is not supposed to be called simultaneously. * But as run() can produce multiple threads, the access to setProgress, * etc is thread safe. */ class MergeableTask: public Poco::Runnable, public Poco::RefCountedObject { public: enum TaskState { TASK_IDLE, TASK_FALSE_START, TASK_STARTING, TASK_RUNNING, TASK_CANCELLING, TASK_FINISHED, TASK_MERGED }; MergeableTask(); virtual std::string name() = 0; /** * Return the task's progress * * The value will be between 0.0 (just started) * and 1.0 (completed). */ float getProgress() const; /** * Request the task to cancel itself. * * For cancellation to work, the task's runTask() method * must periodically call isCancelled() and react accordingly. * Can be overridden to implement custom behavior, * but the base class implementation of cancel() should * be called to ensure proper behavior. */ virtual void cancel(); /** * Return true if cancellation of the task has been requested. * * A Task's runTask() method should periodically * call this method and stop whatever it is doing in an * orderly way when this method returns true. */ bool isCancelled() const; /** * Return the task's current state. */ TaskState getState() const; /** * Method called after the finishedNotification is dispatched. * * Could be used to run some cleaning, etc * * Default implementation: do nothing. * * Shall not throw exceptions. */ virtual void leaveTask() { } /** * Runnable::run method implementation * * duplicate() has to be called previously because release() is called * at the end */ void run(); /** * method used to launch the runnable synchronously. * duplicate() is called there */ void runSync() { duplicate(); run(); } /** * Retrieve task unique ID */ size_t id() { return taskIndex; } /** * Add a slave in the slavedTasks list * * and call the slave setMaster() */ void merge(Poco::AutoPtr<MergeableTask>& slave); /** * Check if this task is a slave task. */ bool isSlave() { return !masterTask.isNull(); } protected: /** * Suspend the current thread for the specified * amount of time. * * If the task is cancelled while it is sleeping, * sleep() will return immediately and the return * value will be true. If the time interval * passes without the task being cancelled, the * return value is false. * * A Task should use this method in favor of Thread::sleep(). */ bool sleep(long milliseconds); /** * Yield cpu to other threads * * If the task is cancelled while it is suspended, * yield() will return true. If the tasks resumes * without being cancelled, the return value is false. * * A Task should use this method in favor of Thread::yield(). */ bool yield(); /** * Set the task's progress. * * The value should be between 0.0 (just started) * and 1.0 (completed). */ void setProgress(float progress); // /// Post a notification to the task manager's // /// notification center. // /// // /// A task can use this method to post custom // /// notifications about its getProgress. // virtual void postNotification(Poco::Notification* pNf); /** * Set the (optional) owner of the task. */ void setOwner(TaskManager* pOwner); /** * Return the owner of the task, which may be NULL. */ TaskManager* getOwner() const; /** * Set the task's state. * * Run tests to verify the workflow: * - if TASK_CANCELlING, TASK_FINISHED is the only allowed next value * - if TASk_MERGED, TASK_FINISHED is the only allowed next value * - TASK_STARTING after TASK_IDLE * - TASK_RUNNING after TASK_STARTING */ void setState(TaskState state); /** * Method called before runTask: * * - the task state is TASK_STARTING * - this method change the state to TASK_RUNNING * * can be used to wait for an event, lock/unlock mutexes, ... * * Default implementation: just change the state to TASK_RUNNING. * * Exception throwing is safe. */ virtual void prepareTask() { setState(TASK_RUNNING); } /** * Do whatever the task needs to do. Must * be overridden by subclasses. * * Exception throwing is safe. * * @throw ExecutionAbortedException on task cancellation detection */ virtual void runTask() = 0; virtual ~MergeableTask(); private: MergeableTask(const MergeableTask&); MergeableTask& operator = (const MergeableTask&); static size_t nextAvailableIndex; ///< next index that can be used size_t taskIndex; /// to be called by the master task void setMaster(MergeableTask* master); std::set< Poco::AutoPtr<MergeableTask> > slavedTasks; Poco::AutoPtr<MergeableTask> masterTask; void taskFinishedBroadcast(TaskManager* pTm); Poco::Timestamp t0; /// creation time Poco::Timestamp tBegin; /// beginning of run time Poco::Timestamp tEnd; /// end of run time TaskManager* pOwner; float progress; TaskState state; Poco::Event cancelEvent; mutable Poco::FastMutex mainMutex; mutable Poco::RWLock mergeAccess; friend class TaskManager; }; #endif /* SRC_MERGEABLETASK_H_ */
23.971119
80
0.694277
2399457b81b57c14762b03abcb266ff881ca5f83
1,212
c
C
third_libs/libgd-2.2.3/examples/flip.c
WinterW/crawler_cpp
e0c8dba77233005b1ab13731d1cbcce274b70778
[ "Apache-2.0" ]
2
2018-06-15T08:32:44.000Z
2019-01-12T03:20:41.000Z
openresty-win32-build/thirdparty/libgd-gd-2.2.5/examples/flip.c
nneesshh/openresty-oss
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
[ "MIT" ]
1
2018-11-28T14:01:20.000Z
2018-11-28T14:01:20.000Z
openresty-win32-build/thirdparty/libgd-gd-2.2.5/examples/flip.c
nneesshh/openresty-oss
bfbb9d7526020eda1788a0ed24f2be3c8be5c1c3
[ "MIT" ]
2
2020-09-12T13:50:38.000Z
2020-09-16T15:55:14.000Z
/* $Id$ */ #include "gd.h" #include <stdio.h> #include <stdlib.h> gdImagePtr loadImage(const char *name) { FILE *fp; gdImagePtr im; fp = fopen(name, "rb"); if (!fp) { fprintf(stderr, "Can't open jpeg file\n"); return NULL; } im = gdImageCreateFromJpeg(fp); fclose(fp); return im; } int savePngImage(gdImagePtr im, const char *name) { FILE *fp; fp = fopen(name, "wb"); if (!fp) { fprintf(stderr, "Can't save png image fromtiff.png\n"); return 0; } gdImagePng(im, fp); fclose(fp); return 1; } int main(int argc, char **arg) { gdImagePtr im; int returncode = 0; if (argc < 2) { fprintf(stderr, "Usage: flip [filename.png]\n"); return 1; } im = loadImage(arg[1]); if (!im) goto error; gdImageFlipHorizontal(im); if (!savePngImage(im, "flip_horizontal.png")) { goto error; } gdImageDestroy(im); im = loadImage(arg[1]); if (!im) goto error; gdImageFlipVertical(im); if (!savePngImage(im, "flip_vertical.png")) { goto error; } gdImageDestroy(im); im = loadImage(arg[1]); if (!im) goto error; gdImageFlipBoth(im); if (!savePngImage(im, "flip_both.png")) { goto error; } gdImageDestroy(im); goto done; error: returncode = 1; done: return returncode; }
15.947368
57
0.643564
143df58b23d1ebdc331631c3f9eb8913e213edb9
3,569
h
C
srcs/apt-1.0.9.2/apt-pkg/contrib/cmndline.h
Ziul/tcc1
97dc2b9afcd6736aa8158066b95a698301629543
[ "CC-BY-3.0" ]
null
null
null
srcs/apt-1.0.9.2/apt-pkg/contrib/cmndline.h
Ziul/tcc1
97dc2b9afcd6736aa8158066b95a698301629543
[ "CC-BY-3.0" ]
2
2015-11-21T02:30:20.000Z
2015-11-21T02:30:35.000Z
srcs/apt-1.0.9.2/apt-pkg/contrib/cmndline.h
Ziul/tcc1
97dc2b9afcd6736aa8158066b95a698301629543
[ "CC-BY-3.0" ]
null
null
null
// -*- mode: cpp; mode: fold -*- // Description /*{{{*/ // $Id: cmndline.h,v 1.7 1999/10/31 06:32:28 jgg Exp $ /* ###################################################################### Command Line Class - Sophisticated command line parser This class provides a unified command line parser/option handliner/ configuration mechanism. It allows the caller to specify the option set and map the option set into the configuration class or other special functioning. Filenames are stripped from the option stream and put into their own array. The argument descriptor array can be initialized as: CommandLine::Args Args[] = {{'q',"quiet","apt::get::quiet",CommandLine::IntLevel}, {0,0,0,0}}; The flags mean, HasArg - Means the argument has a value IntLevel - Means the argument is an integer level indication, the following -qqqq (+3) -q5 (=5) -q=5 (=5) are valid Boolean - Means it is true/false or yes/no. -d (true) --no-d (false) --yes-d (true) --long (true) --no-long (false) --yes-long (true) -d=yes (true) -d=no (false) Words like enable, disable, true false, yes no and on off are recognized in logical places. InvBoolean - Same as boolean but the case with no specified sense (first case) is set to false. ConfigFile - Means this flag should be interprited as the name of a config file to read in at this point in option processing. Implies HasArg. ArbItem - Means the item is an arbitrary configuration string of the form item=value, where item is passed directly to the configuration class. The default, if the flags are 0 is to use Boolean ##################################################################### */ /*}}}*/ #ifndef PKGLIB_CMNDLINE_H #define PKGLIB_CMNDLINE_H #include <apt-pkg/macros.h> #ifndef APT_8_CLEANER_HEADERS #include <apt-pkg/configuration.h> #endif class Configuration; class CommandLine { public: struct Args; struct Dispatch; protected: Args *ArgList; Configuration *Conf; bool HandleOpt(int &I,int argc,const char *argv[], const char *&Opt,Args *A,bool PreceedeMatch = false); void static SaveInConfig(unsigned int const &argc, char const * const * const argv); public: enum AFlags { HasArg = (1 << 0), IntLevel = (1 << 1), Boolean = (1 << 2), InvBoolean = (1 << 3), ConfigFile = (1 << 4) | HasArg, ArbItem = (1 << 5) | HasArg }; const char **FileList; bool Parse(int argc,const char **argv); void ShowHelp(); unsigned int FileSize() const APT_PURE; bool DispatchArg(Dispatch *List,bool NoMatch = true); static char const * GetCommand(Dispatch const * const Map, unsigned int const argc, char const * const * const argv) APT_PURE; static CommandLine::Args MakeArgs(char ShortOpt, char const *LongOpt, char const *ConfName, unsigned long Flags) APT_CONST; CommandLine(Args *AList,Configuration *Conf); ~CommandLine(); }; struct CommandLine::Args { char ShortOpt; const char *LongOpt; const char *ConfName; unsigned long Flags; inline bool end() {return ShortOpt == 0 && LongOpt == 0;}; inline bool IsBoolean() {return Flags == 0 || (Flags & (Boolean|InvBoolean)) != 0;}; }; struct CommandLine::Dispatch { const char *Match; bool (*Handler)(CommandLine &); }; #endif
30.767241
87
0.606612
6c464ae28a439c8e9ee8e39ff599e49e721d700d
2,159
h
C
include/CML/operate.h
Chaphlagical/CML
8ed87555548982e57316c985c1ff94b1c92ba113
[ "MIT" ]
null
null
null
include/CML/operate.h
Chaphlagical/CML
8ed87555548982e57316c985c1ff94b1c92ba113
[ "MIT" ]
null
null
null
include/CML/operate.h
Chaphlagical/CML
8ed87555548982e57316c985c1ff94b1c92ba113
[ "MIT" ]
1
2021-02-16T02:37:39.000Z
2021-02-16T02:37:39.000Z
#pragma once #include <iostream> namespace Chaf { template<class F, typename T, size_t N > struct Operate1D { friend const F operator+(const F& a, const F& b) { F tmp; for (size_t i = 0; i < N; i++)tmp[i] = a[i] + b[i]; return tmp; } friend const F operator-(const F& a, const F& b) { F tmp; for (size_t i = 0; i < N; i++)tmp[i] = a[i] - b[i]; return tmp; } friend const F operator*(const F& a, const T& t) { F tmp; for (size_t i = 0; i < N; i++)tmp[i] = a[i] * t; return tmp; } friend const F operator*(const T& t, const F& a) { return a * t; } friend const F operator/(const F& a, const T& t) { return a * (1 / t); } }; template<class F, typename T, size_t M, size_t N > struct Operate2D { friend const F operator+(const F& a, const F& b) { F tmp; for (size_t i = 0; i < N; i++) for (size_t j = 0; j < M; j++) tmp(i, j) = a(i, j) + b(i, j); return tmp; } friend const F operator-(const F& a, const F& b) { F tmp; for (size_t i = 0; i < N; i++) for (size_t j = 0; j < M; j++) tmp(i, j) = a(i, j) - b(i, j); return tmp; } friend const F operator*(const F& a, const T& t) { F tmp; for (size_t i = 0; i < N; i++) for (size_t j = 0; j < M; j++) tmp(i, j) = a(i, j) * t; return tmp; } friend const F operator*(const T& t, const F& a) { return a * t; } friend const F operator/(const F& a, const T& t) { return a * (1 / t); } }; template<class F, typename T, size_t N > struct Stream1D { friend std::ostream& operator<<(std::ostream& os, const F& a) { os << "Type: " << typeid(F).name() << std::endl << "Data:" << std::endl; for (size_t i = 0; i < N; i++) os << a[i] << " "; os << std::endl; return os; } }; template<class F, typename T, size_t M, size_t N > struct Stream2D { friend std::ostream& operator<<(std::ostream& os, const F& a) { os << "Type: " << typeid(F).name() << std::endl << "Data:" << std::endl; for (size_t i = 0; i < M; i++) { for (size_t j = 0; j < N; j++) os << a(i, j) << " "; os << std::endl; } return os; } }; }
21.376238
75
0.510885
88a08e5fd2a71f6176d03c6e386f57ff1b86b7a2
5,797
h
C
graphics/cgal/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel.h
hlzz/dotfiles
0591f71230c919c827ba569099eb3b75897e163e
[ "BSD-3-Clause" ]
4
2016-03-30T14:31:52.000Z
2019-02-02T05:01:32.000Z
graphics/cgal/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel.h
hlzz/dotfiles
0591f71230c919c827ba569099eb3b75897e163e
[ "BSD-3-Clause" ]
null
null
null
graphics/cgal/Circular_kernel_2/doc/Circular_kernel_2/Concepts/CircularKernel.h
hlzz/dotfiles
0591f71230c919c827ba569099eb3b75897e163e
[ "BSD-3-Clause" ]
null
null
null
/*! \ingroup PkgCircularKernel2GeometricConcepts \cgalConcept \cgalRefines `Kernel` \cgalHasModel `CGAL::Circular_kernel_2<Kernel,AlgebraicKernelForCircles>` \cgalHasModel `CGAL::Exact_circular_kernel_2` \sa `Kernel` */ class CircularKernel { public: /// \name Types /// A model of `CircularKernel` is supposed to provide some basic /// types and to define the following geometric objects Moreover, a /// model of `CircularKernel` must provide predicates, constructions /// and other functionalities. /// @{ /*! Model of `LinearKernel`. */ typedef unspecified_type Linear_kernel; /*! Model of `AlgebraicKernelForCircles`. */ typedef unspecified_type Algebraic_kernel; /*! Model of `RingNumberType`. */ typedef unspecified_type RT; /*! Model of `FieldNumberType`. */ typedef unspecified_type FT; /*! Model of `RootOf_2`. */ typedef unspecified_type Root_of_2; /*! Model of `AlgebraicKernelForCircles::RootForCircles_2_2`. */ typedef unspecified_type Root_for_circles_2_2; /*! Model of `AlgebraicKernelForCircles::Polynomial_1_2`. */ typedef unspecified_type Polynomial_1_2; /*! Model of `AlgebraicKernelForCircles::PolynomialForCircles_2_2`. */ typedef unspecified_type Polynomial_for_circles_2_2; /*! Model of `Kernel::Point_2`. */ typedef unspecified_type Point_2; /*! Model of `Kernel::Line_2`. */ typedef unspecified_type Line_2; /*! Model of `Kernel::Circle_2`. */ typedef unspecified_type Circle_2; /*! Model of `CircularKernel::LineArc_2`. */ typedef unspecified_type Line_arc_2; /*! Model of `CircularKernel::CircularArc_2`. */ typedef unspecified_type Circular_arc_2; /*! Model of `CircularKernel::CircularArcPoint_2`. */ typedef unspecified_type Circular_arc_point_2; /// @} /// \name Predicates /// @{ /*! Model of `CircularKernel::CompareX_2`. */ typedef unspecified_type Compare_x_2; /*! Model of `CircularKernel::CompareY_2`. */ typedef unspecified_type Compare_y_2; /*! Model of `CircularKernel::CompareXY_2`. */ typedef unspecified_type Compare_xy_2; /*! Model of `CircularKernel::Equal_2`. */ typedef unspecified_type Equal_2; /*! Model of `CircularKernel::CompareYatX_2`. */ typedef unspecified_type Compare_y_at_x_2; /*! Model of `CircularKernel::CompareYtoRight_2`. */ typedef unspecified_type Compare_y_to_right_2; /*! Model of `CircularKernel::HasOn_2`. */ typedef unspecified_type Has_on_2; /*! Model of `CircularKernel::DoOverlap_2`. */ typedef unspecified_type Do_overlap_2; /*! Model of `CircularKernel::DoIntersect_2`. */ typedef unspecified_type Do_intersect_2; /*! Model of `CircularKernel::BoundedSide_2`. */ typedef unspecified_type Bounded_side_2; /*! Model of `CircularKernel::HasOnBoundedSide_2`. */ typedef unspecified_type Has_on_bounded_side_2; /*! Model of `CircularKernel::HasOnUnboundedSide_2`. */ typedef unspecified_type Has_on_unbounded_side_2; /*! Model of `CircularKernel::InXRange_2`. */ typedef unspecified_type In_x_range_2; /*! Model of `CircularKernel::IsVertical_2`. */ typedef unspecified_type Is_vertical_2; /*! Model of `CircularKernel::IsXMonotone_2`. */ typedef unspecified_type Is_x_monotone_2; /*! Model of `CircularKernel::IsYMonotone_2`. */ typedef unspecified_type Is_y_monotone_2; /// @} /// \name Constructions /// @{ /*! Model of `CircularKernel::ConstructLine_2`. */ typedef unspecified_type Construct_line_2; /*! Model of `CircularKernel::ConstructCircle_2`. */ typedef unspecified_type Construct_circle_2; /*! Model of `CircularKernel::ConstructBbox_2`. */ typedef unspecified_type Construct_bbox_2; /*! Model of `CircularKernel::ConstructCircularArcPoint_2`. */ typedef unspecified_type Construct_circular_arc_point_2; /*! Model of `CircularKernel::ConstructLineArc_2`. */ typedef unspecified_type Construct_line_arc_2; /*! Model of `CircularKernel::ConstructCircularArc_2`. */ typedef unspecified_type Construct_circular_arc_2; /*! Model of `CircularKernel::ComputeCircularX_2` */ typedef unspecified_type Compute_circular_x_2; /*! Model of `CircularKernel::ComputeCircularY_2` */ typedef unspecified_type Compute_circular_y_2; /*! Model of `CircularKernel::ConstructCircularMinVertex_2`. */ typedef unspecified_type Construct_circular_min_vertex_2; /*! Model of `CircularKernel::ConstructCircularMaxVertex_2`. */ typedef unspecified_type Construct_circular_max_vertex_2; /*! Model of `CircularKernel::ConstructCircularSourceVertex_2`. */ typedef unspecified_type Construct_circular_source_vertex_2; /*! Model of `CircularKernel::ConstructCircularTargetVertex_2`. */ typedef unspecified_type Construct_circular_target_vertex_2; /*! Model of `CircularKernel::Intersect_2`. */ typedef unspecified_type Intersect_2; /*! Model of `CircularKernel::Split_2`. */ typedef unspecified_type Split_2; /*! Model of `CircularKernel::MakeXMonotone_2`. */ typedef unspecified_type Make_x_monotone_2; /*! Model of `CircularKernel::MakeXYMonotone_2`. */ typedef unspecified_type Make_xy_monotone_2; /// @} /// \name Link with the algebraic kernel /// @{ /*! Model of `CircularKernel::GetEquation`. */ typedef unspecified_type Get_equation; /// @} /// \name Operations /// As in the `Kernel` concept, for each of the function objects /// above, there must exist a member function that requires no /// arguments and returns an instance of that function object. The /// name of the member function is the uncapitalized name of the type /// returned with the suffix `_object` appended. For example, for the /// function object `CircularKernel::Construct_circular_arc_2` the /// following member function must exist: /// @{ /*! */ Construct_circular_arc_2 construct_circular_arc_2_object() const; /// @} }; /* end CircularKernel */
19.584459
74
0.752458
154aac0de6362d107ee49a93b22cc4833afa7df6
22,583
c
C
forwarder.c
vitalyvch/glonassd
560f0d8c7b21dd6df3d80f97b7d4c4af3f93d439
[ "MIT" ]
null
null
null
forwarder.c
vitalyvch/glonassd
560f0d8c7b21dd6df3d80f97b7d4c4af3f93d439
[ "MIT" ]
null
null
null
forwarder.c
vitalyvch/glonassd
560f0d8c7b21dd6df3d80f97b7d4c4af3f93d439
[ "MIT" ]
null
null
null
/* forwarder.c forward packets from this server to another, repack if needded help: http://rsdn.ru/article/unix/sockets.xml http://man7.org/linux/man-pages/man7/unix.7.html http://man7.org/linux/man-pages/man2/sendmsg.2.html http://www.faqs.org/faqs/unix-faq/socket/ http://www.opennet.ru/cgi-bin/opennet/man.cgi?topic=select&category=2 http://www.opennet.ru/man.shtml?topic=poll&category=2 http://man7.org/linux/man-pages/man2/poll.2.html http://www.redov.ru/kompyutery_i_internet/osnovy_programmirovanija_v_linux/p19.php#metkadoc18 http://www.cyberforum.ru/c-linux/thread241842.html */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include <sys/syscall.h> /* syscall */ #include <stdlib.h> /* malloc */ #include <string.h> /* memset */ #include <unistd.h> /* close, fork */ #include <errno.h> /* errno */ #include <pthread.h> /* syslog */ #include <time.h> #include <syslog.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <fcntl.h> #include "glonassd.h" #include "forwarder.h" #include "lib.h" #include "de.h" #include "logger.h" /* treads shared globals */ #define CONNECT_SOCKET_TIMEOUT (5) // socket timeout in seconds for connect() /* thread locals */ static __thread unsigned long long int disconnect_time = 0; // time in seconds when out socket disconnected static __thread int out_connected = 0; // out connection established flag static __thread int log_server_answer = 0; // flag for log remote server to file /* utility functions */ /* reset logged flag to "no" for all terminals called when socket to remote server disconnect */ static void terimal_reset_logged(char *forward_name) { unsigned int i; for(i = 0; i < stForwarders.listcount; i++) { if( forward_name[0] == stForwarders.terminals[i].forward[0] ) { if( !strcmp(forward_name, stForwarders.terminals[i].forward) ) { stForwarders.terminals[i].logged = 0; } } } // for(i = 0; i < stForwarders.listcount; i++) } //------------------------------------------------------------------------------ /* test: logged terminal on remote server or not always set logged flag to "yes" */ static int terimal_logged(char *imei, char *forward_name) { unsigned int i, retval = 1; if( imei ){ for(i = 0; i < stForwarders.listcount; i++) { if( forward_name[0] == stForwarders.terminals[i].forward[0] && imei[0] == stForwarders.terminals[i].imei[0] ) { if( !strcmp(forward_name, stForwarders.terminals[i].forward) && !strcmp(imei, stForwarders.terminals[i].imei) ) { retval = stForwarders.terminals[i].logged; stForwarders.terminals[i].logged = 1; break; } } } // for(i = 0; i < stForwarders.listcount; i++) } // if( imei ) return retval; } //------------------------------------------------------------------------------ /* save forwarding data to file (!!! data encoded to required protocol !!!) config_name - name of the forwarder imei - IMEI saved terminal content - encoded data content_size - size of data */ static void data_save(char *config_name, char *imei, char *content, ssize_t content_size) { int fHandle; time_t t; char fName[FILENAME_MAX]; ST_FORWARD_MSG msg; if( content && content_size ) { time(&t); snprintf(fName, FILENAME_MAX, "%s/%s_%llu.bin", stConfigServer.forward_files, config_name, (unsigned long long)t); if( (fHandle = open(fName, O_CREAT | O_WRONLY | O_NOATIME | O_TRUNC, S_IRWXU | S_IRGRP | S_IROTH)) != -1 ) { // create header memset(&msg, 0, sizeof(ST_FORWARD_MSG)); // msg.encode = 0 if(imei && imei[0]) { memcpy(msg.imei, imei, SIZE_TRACKER_FIELD); } msg.len = content_size; // write header write(fHandle, &msg, sizeof(ST_FORWARD_MSG)); // write data write(fHandle, content, content_size); close(fHandle); if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: data_save: written %ld bytes to file\n", config_name, syscall(SYS_gettid), content_size); } else if( stConfigServer.log_enable ) logging("forwarder[%s][%ld]: data_save: open(%s) error %d: %s\n", config_name, syscall(SYS_gettid), fName, errno, strerror(errno)); } // if( content && content_size ) else if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: data_save: content is NULL or content_size=%ld\n", config_name, syscall(SYS_gettid), content_size); } //--------------------------------------------------------------------------- // set up out connected socket static int set_out_socket(ST_FORWARDER *config, int create) { struct sockaddr_in addr_in; struct timeval tv = {0}; disconnect_time = seconds(); if( create ) { // create socket if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: start connect to remote host %s:%d\n", config->name, syscall(SYS_gettid), config->server, config->port); if( config->sockets[OUT_SOCKET] == BAD_OBJ ) { config->sockets[OUT_SOCKET] = socket(AF_INET, config->protocol, 0); if( config->sockets[OUT_SOCKET] < 0 ) { logging("forwarder[%s][%ld]: socket() error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); return 0; } // set non-blocking mode if( fcntl(config->sockets[OUT_SOCKET], F_SETFL, O_NONBLOCK) < 0 ) { logging("forwarder[%s][%ld]: fcntl(OUT_SOCKET, O_NONBLOCK) error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); close(config->sockets[OUT_SOCKET]); config->sockets[OUT_SOCKET] = BAD_OBJ; return 0; } // set reuse address for reconnect if (setsockopt(config->sockets[OUT_SOCKET], SOL_SOCKET, SO_REUSEADDR, &(int){1}, sizeof(int)) < 0) { logging("forwarder[%s][%ld]: setsockopt(SO_REUSEADDR) error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); } #ifdef SO_REUSEPORT if (setsockopt(config->sockets[OUT_SOCKET], SOL_SOCKET, SO_REUSEPORT, &(int){1}, sizeof(int)) < 0) { logging("forwarder[%s][%ld]: setsockopt(SO_REUSEPORT) error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); } #endif // set connect timeout // http://stackoverflow.com/questions/15243988/connect-returns-operation-now-in-progress-on-blocking-socket tv.tv_sec = CONNECT_SOCKET_TIMEOUT; if( (setsockopt(config->sockets[OUT_SOCKET], SOL_SOCKET, SO_RCVTIMEO, (char *)&tv, sizeof(struct timeval)) < 0) || (setsockopt(config->sockets[OUT_SOCKET], SOL_SOCKET, SO_SNDTIMEO, (char *)&tv, sizeof(struct timeval))) ) { logging("forwarder[%s][%ld]: setsockopt(SO_RCVTIMEO) error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); /* close(config->sockets[OUT_SOCKET]); config->sockets[OUT_SOCKET] = -1; return 0; */ } // if( (setsockopt(config->sockets[OUT_SOCKET] // bind socket to internal address memset(&addr_in, 0, sizeof(struct sockaddr_in)); addr_in.sin_family = AF_INET; addr_in.sin_port = 0; inet_aton(stConfigServer.transmit, &addr_in.sin_addr); if( bind(config->sockets[OUT_SOCKET], (struct sockaddr *)&addr_in, sizeof(struct sockaddr_in)) < 0 ) { logging("forwarder[%s][%ld]: bind(%s) error %d: %s\n", config->name, syscall(SYS_gettid), stConfigServer.transmit, errno, strerror(errno)); close(config->sockets[OUT_SOCKET]); config->sockets[OUT_SOCKET] = BAD_OBJ; return 0; } } // if( config->sockets[OUT_SOCKET] == BAD_OBJ ) // connect socket to external address memset(&addr_in, 0, sizeof(struct sockaddr_in)); addr_in.sin_family = AF_INET; addr_in.sin_port = htons(config->port); inet_aton(config->server, &addr_in.sin_addr); if( connect(config->sockets[OUT_SOCKET], (struct sockaddr *)&addr_in, sizeof(struct sockaddr_in)) < 0 ) { if( errno != EINPROGRESS ) { // non-blocking socket, connection not in progress (error) logging("forwarder[%s][%ld]: connect(%s:%d) error %d: %s\n", config->name, syscall(SYS_gettid), config->server, config->port, errno, strerror(errno)); close(config->sockets[OUT_SOCKET]); config->sockets[OUT_SOCKET] = BAD_OBJ; } // else connection in progress, see result of poll() } // if( connect( } // if( create ) else { // destroy socket out_connected = 0; // reset connetion established flag shutdown(config->sockets[OUT_SOCKET], SHUT_RDWR); close(config->sockets[OUT_SOCKET]); config->sockets[OUT_SOCKET] = BAD_OBJ; terimal_reset_logged(config->name); } return( create ? (config->sockets[OUT_SOCKET] != BAD_OBJ) : 1); } //------------------------------------------------------------------------------ /* process terminal data bufer - ST_FORWARD_MSG* size - length of the bufer */ static void process_terminal(ST_FORWARDER *config, char *bufer, ssize_t size) { ST_FORWARD_MSG *msg; ssize_t data_len = 0, sended = 0; char l2fname[FILENAME_MAX]; // terminal log file name if( !bufer ){ if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: process_terminal %s: bufer is NULL\n", config->name, syscall(SYS_gettid), msg->imei); return; } if( !size ){ if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: process_terminal %s: size = 0\n", config->name, syscall(SYS_gettid), msg->imei); return; } msg = (ST_FORWARD_MSG *)bufer; if( !msg->len ){ if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: process_terminal %s: msg->len = 0\n", config->name, syscall(SYS_gettid), msg->imei); return; } if( msg->encode ) { // encode need, data = ST_RECORD*, msg->len = number of the records in data /* check: terminal authentificated or no on remote server, if no (ST_FORWARD_TERMINAL[imei][config->name].logged == 0) then set msg->len = -1 * msg->len else msg->len not change */ if( !terimal_logged(msg->imei, config->name) ) msg->len *= -1; pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); // do not disturb :) data_len = config->terminal_encode((ST_RECORD*)&bufer[sizeof(ST_FORWARD_MSG)], msg->len, config->buffers[OUT_WRBUF], SOCKET_BUF_SIZE); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); // can disturb :) } else { // data = raw terminal data, msg->len = data size // copy data part to out buffer memcpy(config->buffers[OUT_WRBUF], &bufer[sizeof(ST_FORWARD_MSG)], msg->len); data_len = msg->len; } // else if(msg->encode) if( data_len ) { if( out_connected ) { sended = send(config->sockets[OUT_SOCKET], config->buffers[OUT_WRBUF], data_len, 0); if( sended <= 0 ) { // socket error or disconnect logging("forwarder[%s][%ld]: process_terminal: send() error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); set_out_socket(config, 0); // disconnect outer socket } // if( sended <= 0 ) else { // log terminal message to remote server if( stConfigServer.log_imei[0] && stConfigServer.log_imei[0] == msg->imei[0] ){ if( !strcmp(stConfigServer.log_imei, msg->imei) ){ snprintf(l2fname, FILENAME_MAX, "%s/logs/%s_%s_prcl", stParams.start_path, msg->imei, config->name); log2file(l2fname, config->buffers[OUT_WRBUF], data_len); // flag for log remote server answer to file, // if forwarder protocol EGTS, then flag = EGTS_RECORD_HEADER.RN (record number) // else 1 simply if( strstr(config->name, "egts") ) log_server_answer = *(uint16_t*)&config->buffers[OUT_WRBUF][13]; // EGTS_RECORD_HEADER.RN else log_server_answer = 1; } // if( !strcmp(stConfigServer.log_imei, msg->imei) ) } // if( stConfigServer.log_imei[0] if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: process_terminal %s: sended %ld bytes to remote server\n", config->name, syscall(SYS_gettid), msg->imei, sended); } // else if( sended <= 0 ) } // if( out_connected ) if( sended <= 0 ) // save buffer to file for send later data_save(config->name, msg->imei, config->buffers[OUT_WRBUF], data_len); } // if( data_len ) else if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: process_terminal %s: data_len=%ld\n", config->name, syscall(SYS_gettid), msg->imei, data_len); } //------------------------------------------------------------------------------ // set up inner listener socket static int set_listen_socket(ST_FORWARDER *config) { // create socket config->sockets[IN_SOCKET] = socket(AF_UNIX, SOCK_DGRAM, 0); if( config->sockets[IN_SOCKET] < 0 ) { logging("forwarder[%s][%ld]: socket() error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); return 0; } // set non-blocking mode if( fcntl(config->sockets[IN_SOCKET], F_SETFL, O_NONBLOCK) < 0 ) { logging("forwarder[%s][%ld]: fcntl(IN_SOCKET, O_NONBLOCK) error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); close(config->sockets[IN_SOCKET]); config->sockets[IN_SOCKET] = -1; return 0; } // bind socket memset(&config->addr_un, 0, sizeof(struct sockaddr_un)); config->addr_un.sun_family = AF_UNIX; snprintf(config->addr_un.sun_path, 108, "/%s", config->name); // http://man7.org/linux/man-pages/man7/unix.7.html unlink(config->addr_un.sun_path); // if exists because crash if( bind(config->sockets[IN_SOCKET], (struct sockaddr *)&config->addr_un, sizeof(struct sockaddr_un)) < 0 ) { logging("forwarder[%s][%ld]: bind(%s) error %d: %s\n", config->name, syscall(SYS_gettid), config->addr_un.sun_path, errno, strerror(errno)); close(config->sockets[IN_SOCKET]); config->sockets[IN_SOCKET] = -1; } return(config->sockets[IN_SOCKET] != -1); } //------------------------------------------------------------------------------ // wait sockets activity static int wait_sockets(ST_FORWARDER *config) { unsigned int cnt; struct timeval tv; // test out socket and reconnect if disconnected if( config->sockets[OUT_SOCKET] == BAD_OBJ && (seconds() - disconnect_time >= stConfigServer.forward_wait)) { set_out_socket(config, 1); } FD_ZERO(&config->fdset[0]); // read FD_ZERO(&config->fdset[1]); // write FD_SET(config->sockets[IN_SOCKET], &config->fdset[0]); if( config->sockets[OUT_SOCKET] != BAD_OBJ ) { if( out_connected ) FD_SET(config->sockets[OUT_SOCKET], &config->fdset[0]); // read else FD_SET(config->sockets[OUT_SOCKET], &config->fdset[1]); // write } tv.tv_sec = stConfigServer.forward_timeout; tv.tv_usec = 0; cnt = config->sockets[OUT_SOCKET] > config->sockets[IN_SOCKET] ? config->sockets[OUT_SOCKET] : config->sockets[IN_SOCKET]; return select(cnt + 1, &config->fdset[0], &config->fdset[1], NULL, &tv); } //------------------------------------------------------------------------------ /* main thread function */ void *forwarder_thread(void *st_forwarder) { static __thread ST_FORWARDER *config; // configuration static __thread ST_ANSWER answer; static __thread int i, fHandle, so_error; static __thread socklen_t so_error_len = sizeof(int); static __thread ssize_t bytes_read = 0; static __thread char fName[FILENAME_MAX]; static __thread struct dirent *result; // eror handler: void exit_forwarder_thread(void * arg) { unsigned int i; // clear sockets for(i = 0; i < CNT_SOCKETS; i++ ) { if( config->sockets[i] != BAD_OBJ ) { shutdown(config->sockets[i], SHUT_RDWR); close(config->sockets[i]); config->sockets[i] = BAD_OBJ; } } /* When no longer required, the socket pathname, should be deleted using unlink(2) or remove(3) */ if( strlen(config->addr_un.sun_path) ) unlink(config->addr_un.sun_path); if( config->data_dir ) closedir(config->data_dir); terimal_reset_logged(config->name); logging("forwarder[%s][%ld] destroyed\n", config->name, syscall(SYS_gettid)); } // exit_forwarder_thread // install error handler: pthread_cleanup_push(exit_forwarder_thread, NULL); /* initialization */ config = (ST_FORWARDER *)st_forwarder; if( !config ) { logging("forwarder[%ld]: configuration not passed, exit\n", syscall(SYS_gettid)); exit_forwarder_thread(NULL); return NULL; } // set inner listener socket config->sockets[IN_SOCKET] = BAD_OBJ; if( !set_listen_socket(config) ) { exit_forwarder_thread(NULL); return NULL; } // set outer server socket config->sockets[OUT_SOCKET] = BAD_OBJ; set_out_socket(config, 1); // if not connected, will retry memset(&answer, 0, sizeof(ST_ANSWER)); logging("forwarder[%s][%ld] started\n", config->name, syscall(SYS_gettid)); /* main cycle */ while( 1 ) { pthread_testcancel(); switch( wait_sockets(config) ) { case -1: // select() error logging("forwarder[%s][%ld]: select() error %d: %s\n", config->name, syscall(SYS_gettid), errno, strerror(errno)); exit_forwarder_thread(NULL); return NULL; case 0: // timeout if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: read and send saved parcels\n", config->name, syscall(SYS_gettid)); /* read saved parcels and send to destination */ if( out_connected && config->data_dir ) { rewinddir(config->data_dir); // resets the position of the directory stream to the beginning of the directory i = 0; // number of files to read // iterate files in directory while( (result = readdir(config->data_dir)) != NULL ) { // is file name OK & contain this forwarder name & contain ".bin"? if( strlen(result->d_name) && strstr(result->d_name, config->name) && strstr(result->d_name, ".bin") ) { // generate full file name snprintf(fName, FILENAME_MAX, "%s/%s", stConfigServer.forward_files, result->d_name); // open file for read if( (fHandle = open(fName, O_RDONLY | O_NOATIME)) != -1 ) { bytes_read = read(fHandle, config->buffers[IN_RDBUF], SOCKET_BUF_SIZE); if( bytes_read > 0 ) process_terminal(config, config->buffers[IN_RDBUF], bytes_read); close(fHandle); if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: send saved file %s\n", config->name, syscall(SYS_gettid), result->d_name); } // if( (fHandle = open(fName else if( stConfigServer.log_enable > 1 ) logging("forwarder[%s][%ld]: read saved file %s error: %d: %s\n", config->name, syscall(SYS_gettid), result->d_name, errno, strerror(errno)); // delete file unlink(fName); if( ++i >= CNT_FILES_SEND ) break; // max files reached, cancel } // if( strlen(result->d_name) && } // while( (result = readdir(config->data_dir)) != NULL ) } // if( out_connected && config->data_dir ) else if( !config->data_dir ){ logging("forwarder[%s][%ld]: directory %s is not opened\n", config->name, syscall(SYS_gettid), stConfigServer.forward_files); } // else if( data_dir ) break; default: // number of ready file descriptors // OUT_SOCKET if( FD_ISSET(config->sockets[OUT_SOCKET], &config->fdset[1]) ) { // connection to remote server complete if( !getsockopt(config->sockets[OUT_SOCKET], SOL_SOCKET, SO_ERROR, &so_error, &so_error_len) ) out_connected = !so_error; if( out_connected ) logging("forwarder[%s][%ld]: remote host %s:%d connected\n", config->name, syscall(SYS_gettid), config->server, config->port); else { switch(so_error){ case 0: // Sucess if( errno != EINPROGRESS ){ logging("forwarder[%s][%ld]: remote host %s:%d connection error %d: %s\n", config->name, syscall(SYS_gettid), config->server, config->port, errno, strerror(errno)); set_out_socket(config, 0); } break; default: logging("forwarder[%s][%ld]: remote host %s:%d %s (%d)\n", config->name, syscall(SYS_gettid), config->server, config->port, strerror(so_error), so_error); set_out_socket(config, 0); } // switch(so_error) } // else if( out_connected ) } // if( FD_ISSET(config->sockets[OUT_SOCKET], &config->fdset[1]) ) else if( FD_ISSET(config->sockets[OUT_SOCKET], &config->fdset[0]) ) { // has incoming messages from remote server if( out_connected ){ // receive data memset(config->buffers[OUT_RDBUF], 0, SOCKET_BUF_SIZE); bytes_read = recv(config->sockets[OUT_SOCKET], config->buffers[OUT_RDBUF], SOCKET_BUF_SIZE, 0); if( bytes_read > 0 ) { // data // decode server answer if( config->terminal_decode ) { pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL); // do not disturb :) config->terminal_decode(config->buffers[OUT_RDBUF], bytes_read, &answer); pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); // can disturb :) } // if( config->terminal_decode ) if( answer.size ) { // send answer to terminal } // if( answer.size ) // log remote server answer to file if( log_server_answer ){ // if forwarder protocol EGTS, then flag = EGTS_RECORD_HEADER.RN (record number) // else 1 simply if( strstr(config->name, "egts") ){ // and log_server_answer == EGTS_RECORD_HEADER.RN if( *(uint16_t*)&config->buffers[OUT_RDBUF][14] == log_server_answer ){ // EGTS_SR_RECORD_RESPONSE.CRN log_server_answer = 0; // and reset log flag snprintf(fName, FILENAME_MAX, "%s/logs/%s_answ", stParams.start_path, config->name); log2file(fName, config->buffers[OUT_RDBUF], bytes_read); } } else { log_server_answer = 0; // and reset log flag snprintf(fName, FILENAME_MAX, "%s/logs/%s_answ", stParams.start_path, config->name); log2file(fName, config->buffers[OUT_RDBUF], bytes_read); } } // if( log_server_answer ) } // if( bytes_read > 0 ) else { logging("forwarder[%s][%ld]: remote host %s:%d %s (%d)\n", config->name, syscall(SYS_gettid), config->server, config->port, strerror(errno), errno); set_out_socket(config, 0); } } // if( out_connected ) } // if( FD_ISSET(config->sockets[OUT_SOCKET], &config->fdset[0]) ) // IN_SOCKET if( FD_ISSET(config->sockets[IN_SOCKET], &config->fdset[0]) ) { // messages from workers memset(config->buffers[IN_RDBUF], 0, SOCKET_BUF_SIZE); bytes_read = recv(config->sockets[IN_SOCKET], config->buffers[IN_RDBUF], SOCKET_BUF_SIZE, 0); if( bytes_read > 0 ) process_terminal(config, config->buffers[IN_RDBUF], bytes_read); // else worker terminated } // if( FD_ISSET(config->sockets[IN_SOCKET], &config->fdset[0]) ) } // switch( wait_sockets(config) ) } // while(1) // clear error handler with run it (0 - not run, 1 - run) pthread_cleanup_pop(1); return NULL; } // void *forwarder_thread //------------------------------------------------------------------------------
36.07508
171
0.652393
18b5c7491b37e7027017a0ed0602905e405f006b
1,623
h
C
modules/prediction/container/obstacles/obstacle_clusters.h
zhuyawen/apollo
91c1811970edf0a43f2b4c3b6070c171e11e646d
[ "Apache-2.0" ]
2
2021-04-26T00:13:07.000Z
2022-02-20T07:08:31.000Z
modules/prediction/container/obstacles/obstacle_clusters.h
zhuyawen/apollo
91c1811970edf0a43f2b4c3b6070c171e11e646d
[ "Apache-2.0" ]
2
2022-01-27T16:14:38.000Z
2022-02-11T00:10:28.000Z
modules/prediction/container/obstacles/obstacle_clusters.h
zhuyawen/apollo
91c1811970edf0a43f2b4c3b6070c171e11e646d
[ "Apache-2.0" ]
1
2021-03-30T07:50:50.000Z
2021-03-30T07:50:50.000Z
/****************************************************************************** * Copyright 2017 The Apollo Authors. All Rights Reserved. * * 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 MODULES_PREDICTION_CONTAINER_OBSTACLES_OBSTACLE_CLUSTERS_H_ #define MODULES_PREDICTION_CONTAINER_OBSTACLES_OBSTACLE_CLUSTERS_H_ #include <string> #include <unordered_map> #include <utility> #include <memory> #include "modules/common/macro.h" #include "modules/map/hdmap/hdmap_common.h" #include "modules/prediction/proto/lane_graph.pb.h" namespace apollo { namespace prediction { class ObstacleClusters { public: ObstacleClusters() = default; void Init(); const LaneGraph& GetLaneGraph( const double start_s, const double length, std::shared_ptr<const apollo::hdmap::LaneInfo> lane_info_ptr); private: void Clear(); private: std::unordered_map<std::string, LaneGraph> lane_graphs_; }; } // namespace prediction } // namespace apollo #endif // MODULES_PREDICTION_CONTAINER_OBSTACLES_OBSTACLE_CLUSTERS_H_
30.622642
79
0.693161
18c8785e7c2094d3e1f8cadaba035e191195a7bf
1,176
h
C
Xcode Project/Amphetamine Enhancer/AppDelegate.h
vkaif22/Amphetamine-Enhancer
88937ec827fcd0c19344af05ada76ef356ff676b
[ "MIT" ]
582
2019-10-12T03:00:12.000Z
2022-03-31T04:20:02.000Z
Xcode Project/Amphetamine Enhancer/AppDelegate.h
vkaif22/Amphetamine-Enhancer
88937ec827fcd0c19344af05ada76ef356ff676b
[ "MIT" ]
19
2019-11-14T23:27:50.000Z
2022-02-19T02:37:08.000Z
Xcode Project/Amphetamine Enhancer/AppDelegate.h
vkaif22/Amphetamine-Enhancer
88937ec827fcd0c19344af05ada76ef356ff676b
[ "MIT" ]
35
2020-02-04T07:42:57.000Z
2022-03-22T11:52:38.000Z
// // AppDelegate.h // Amphetamine Enhancer // // Created by William Gustafson on 9/30/19. // Copyright © 2019 William Gustafson. All rights reserved. // #import <Cocoa/Cocoa.h> #include <CoreFoundation/CoreFoundation.h> #include <sys/sysctl.h> @import LetsMove; //@import Sparkle; #define kClosedDisplay @"amphetamine-enhancer-cdmManager" #define kClosedDisplayPlist @"amphetamine-enhancer-cdmManager.plist" #define kAllProcesses @"amphetamine-enhancer-allProcesses" #define kAllProcessesPlist @"amphetamine-enhancer-allProcesses.plist" @interface AppDelegate : NSObject <NSApplicationDelegate,NSTableViewDelegate> // WINDOWS @property (strong) IBOutlet NSWindow *preferencesWindow; @property (strong) IBOutlet NSWindow *mainWindow; @property (strong) IBOutlet NSWindow *aboutWindow; // ENHANCEMENT WINDOW (MAIN WINDOW) @property (strong) IBOutlet NSTextField *enhancementDescription; @property (strong) IBOutlet NSTextField *enhancementStatus; @property (strong) IBOutlet NSButton *enhancementAction; // ENHANCEMENT TABLE @property (strong) IBOutlet NSArrayController *enhancementArrayController; @property (strong) IBOutlet NSTableView *enhancementTable; @end
30.153846
77
0.798469
c0ef3483bb377eee81b9139c653c360dfe19dae5
1,402
c
C
StructQueue/main.c
Harshpathakjnp/CCodings
b9873c4341b01bba54f5af5a1f18bc02a9c12ec9
[ "MIT" ]
null
null
null
StructQueue/main.c
Harshpathakjnp/CCodings
b9873c4341b01bba54f5af5a1f18bc02a9c12ec9
[ "MIT" ]
null
null
null
StructQueue/main.c
Harshpathakjnp/CCodings
b9873c4341b01bba54f5af5a1f18bc02a9c12ec9
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #define size 10 typedef struct{ int a[10]; int top; }stack; void init(stack* st); void push(stack* st,int data); int pop(stack* st); void enque(int value); int deque(); int count =0; int isEmpty(stack st); int main() { int i; stack s1,s2; init(&s1); init(&s2); for(i=1;i<=10;i++) { if(i % 2==0) push(&s1,i); else push(&s2,i); } while(!isEmpty(s1)) { printf("%d,",pop(&s1)); } printf("\n"); while(!isEmpty(s2)) { printf("%d,",pop(&s2)); } return 0; } void init(stack* st) { st->top=0; } void push(stack* st,int data) { if(st->top>=size) { printf("Stack is full\n"); return; } st->a[st->top]=data; st->top++; } int pop(stack* st) { if(st->top<=0) { printf("Stack is empty\n"); return -1; } st->top--; return st->a[st->top]; } int isEmpty(stack st) { if(st.top<=0) return 1; else return 0; } void enque(int value) { if(count>=10) { printf("Queue is Full "); return; } queue[back]=value; back=(back + 1) % n; count++; } int deque() { int x; if(count<=0) { printf("Queue is empty\n"); return -1; } x=queue[front]; front=(front + 1) % n; count--; return x; }
12.981481
35
0.472896
8d100ae21af1e3322b24d405cb2255d7736a2550
699
c
C
examples/singleended_rpi.c
heegard/Adafruit_ADS1X15_RPi
8062da6a59e69a1815eb6e080140ff1fe5a68ace
[ "BSD-3-Clause" ]
8
2019-06-05T10:11:38.000Z
2022-02-15T20:59:38.000Z
examples/singleended_rpi.c
heegard/Adafruit_ADS1X15_RPi
8062da6a59e69a1815eb6e080140ff1fe5a68ace
[ "BSD-3-Clause" ]
1
2020-11-20T09:49:31.000Z
2020-11-20T09:49:31.000Z
examples/singleended_rpi.c
heegard/Adafruit_ADS1X15_RPi
8062da6a59e69a1815eb6e080140ff1fe5a68ace
[ "BSD-3-Clause" ]
5
2020-06-27T17:40:48.000Z
2021-02-25T17:33:08.000Z
#include <stdio.h> #include <unistd.h> #include "../Adafruit_ADS1015.h" void printBits(size_t const size, void const * const ptr); Adafruit_ADS1115 ads; int main(int argc, char *argv[]) { uint16_t adc0; ads.setGain(GAIN_EIGHT); ads.begin(); while (true) { adc0 = ads.readADC_SingleEnded(0); printBits(sizeof(adc0), &adc0); printf(" *** %d\n", adc0); usleep(100000); } } //assumes little endian void printBits(size_t const size, void const * const ptr) { unsigned char *b = (unsigned char*) ptr; unsigned char byte; int i, j; for (i=size-1;i>=0;i--) { for (j=7;j>=0;j--) { byte = (b[i] >> j) & 1; printf("%u", byte); } } //puts(""); }
17.923077
58
0.595136
777375b6d5286d2587ef1abd6e530d0643785e92
26,001
c
C
node_modules/bcrypto/deps/torsion/src/kdf.c
pradyuman-verma/bcoin
acdeb84767f3ceb82b4a75931fe353229c3bc7b5
[ "MIT" ]
6
2021-11-18T04:10:14.000Z
2021-11-25T22:29:03.000Z
node_modules/bcrypto/deps/torsion/src/kdf.c
pradyuman-verma/bcoin
acdeb84767f3ceb82b4a75931fe353229c3bc7b5
[ "MIT" ]
1
2019-09-25T19:50:00.000Z
2019-09-25T19:50:00.000Z
node_modules/bcrypto/deps/torsion/src/kdf.c
pradyuman-verma/bcoin
acdeb84767f3ceb82b4a75931fe353229c3bc7b5
[ "MIT" ]
2
2022-02-28T14:10:08.000Z
2022-03-22T14:13:15.000Z
/*! * kdf.c - kdf for libtorsion * Copyright (c) 2020, Christopher Jeffrey (MIT License). * https://github.com/bcoin-org/libtorsion * * Parts of this software are based on Tarsnap/scrypt: * Copyright (c) 2005-2016, Colin Percival. All rights reserved. * Copyright (c) 2005-2016, Tarsnap Backup Inc. All rights reserved. * Copyright (c) 2014, Sean Kelly. All rights reserved. * https://github.com/Tarsnap/scrypt * * Parts of this software are based on joyent/node-bcrypt-pbkdf: * Copyright (c) 2016, Joyent Inc * https://github.com/joyent/node-bcrypt-pbkdf * * Parts of this software are based on golang/crypto: * Copyright (c) 2009 The Go Authors. All rights reserved. * https://github.com/golang/crypto */ #include <limits.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include <torsion/cipher.h> #include <torsion/hash.h> #include <torsion/kdf.h> #include <torsion/util.h> #include "bf.h" #include "bio.h" /* * Bcrypt * * Resources: * https://en.wikipedia.org/wiki/Bcrypt * http://www.usenix.org/events/usenix99/provos/provos_html/node1.html * https://hackernoon.com/the-bcrypt-protocol-is-kind-of-a-mess-4aace5eb31bd * https://github.com/openbsd/src/blob/master/lib/libc/crypt/bcrypt.c * https://github.com/openssh/openssh-portable * https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/bcrypt_pbkdf.c * https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/blowfish.c * https://github.com/joyent/node-bcrypt-pbkdf/blob/master/index.js */ #define BCRYPT_VERSION '2' #define BCRYPT_CIPHERTEXT192 "OrpheanBeholderScryDoubt" #define BCRYPT_BLOCKS192 6 #define BCRYPT_SIZE192 24 #define BCRYPT_SALT192 16 #define BCRYPT_HASH192 23 #define BCRYPT_CIPHERTEXT256 "OxychromaticBlowfishSwatDynamite" #define BCRYPT_BLOCKS256 8 #define BCRYPT_SIZE256 32 static const char base64_charset[] = "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; static const int8_t base64_table[256] = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, -1, -1, -1, -1, -1, -1, -1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, -1, -1, -1, -1, -1, -1, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }; static char * base64_encode(char *dst, const uint8_t *src, size_t len) { uint8_t c1, c2; size_t i = 0; size_t j = 0; while (i < len) { c1 = src[i++]; dst[j++] = base64_charset[c1 >> 2]; c1 = (c1 & 3) << 4; if (i >= len) { dst[j++] = base64_charset[c1]; break; } c2 = src[i++]; c1 |= (c2 >> 4) & 15; dst[j++] = base64_charset[c1]; c1 = (c2 & 15) << 2; if (i >= len) { dst[j++] = base64_charset[c1]; break; } c2 = src[i++]; c1 |= (c2 >> 6) & 3; dst[j++] = base64_charset[c1]; dst[j++] = base64_charset[c2 & 63]; } dst[j] = '\0'; return dst + j; } static const char * base64_decode(uint8_t *dst, size_t len, const char *src) { uint8_t c1, c2, c3, c4; size_t i = 0; size_t j = 0; while (j < len) { c1 = base64_table[(uint8_t)src[i++]]; if (c1 & 0x80) return NULL; c2 = base64_table[(uint8_t)src[i++]]; if (c2 & 0x80) return NULL; dst[j++] = (c1 << 2) | ((c2 & 48) >> 4); if (j >= len) break; c3 = base64_table[(uint8_t)src[i++]]; if (c3 & 0x80) return NULL; dst[j++] = ((c2 & 15) << 4) | ((c3 & 60) >> 2); if (j >= len) break; c4 = base64_table[(uint8_t)src[i++]]; if (c4 & 0x80) return NULL; dst[j++] = ((c3 & 3) << 6) | c4; } return src + i; } static void bcrypt_encode(char *out, char minor, unsigned int rounds, const unsigned char *salt, const unsigned char *hash) { ASSERT(rounds >= 4 && rounds <= 31); *out++ = '$'; *out++ = BCRYPT_VERSION; *out++ = minor; *out++ = '$'; *out++ = '0' + (rounds / 10); *out++ = '0' + (rounds % 10); *out++ = '$'; out = base64_encode(out, salt, BCRYPT_SALT192); out = base64_encode(out, hash, BCRYPT_HASH192); } static int bcrypt_decode(char *minor, unsigned int *rounds, unsigned char *salt, unsigned char *hash, const char *str) { int hi, lo; if (str[0] != '$' || str[1] != BCRYPT_VERSION) return 0; *minor = str[2]; if (*minor != 'a' && *minor != 'b') return 0; if (str[3] != '$') return 0; if (str[4] == '\0' || str[5] == '\0') return 0; hi = (int)str[4] - 0x30; lo = (int)str[5] - 0x30; if (hi < 0 || hi > 9 || lo < 0 || lo > 9) return 0; *rounds = hi * 10 + lo; if (*rounds < 4 || *rounds > 31) return 0; if (str[6] != '$') return 0; str += 7; str = base64_decode(salt, BCRYPT_SALT192, str); if (str == NULL) return 0; str = base64_decode(hash, BCRYPT_HASH192, str); if (str == NULL) return 0; if (*str != '\0') return 0; return 1; } void bcrypt_hash192(unsigned char *out, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, unsigned int rounds) { static const unsigned char ciphertext[] = BCRYPT_CIPHERTEXT192; uint32_t cdata[BCRYPT_BLOCKS192]; blowfish_t state; uint32_t i; size_t off; int j; if (rounds < 4) rounds = 4; else if (rounds > 31) rounds = 31; blowfish_init(&state, pass, pass_len, salt, salt_len); for (i = 0; i < (UINT32_C(1) << rounds); i++) { blowfish_expand0state(&state, pass, pass_len); blowfish_expand0state(&state, salt, salt_len); } off = 0; for (j = 0; j < BCRYPT_BLOCKS192; j++) cdata[j] = blowfish_stream2word(ciphertext, BCRYPT_SIZE192, &off); for (j = 0; j < 64; j++) blowfish_enc(&state, cdata, BCRYPT_BLOCKS192); for (j = 0; j < BCRYPT_BLOCKS192; j++) write32be(out + j * 4, cdata[j]); torsion_memzero(cdata, sizeof(cdata)); torsion_memzero(&state, sizeof(state)); } void bcrypt_hash256(unsigned char *out, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, unsigned int rounds) { static const unsigned char ciphertext[] = BCRYPT_CIPHERTEXT256; uint32_t cdata[BCRYPT_BLOCKS256]; blowfish_t state; uint32_t i; size_t off; int j; if (rounds < 4) rounds = 4; else if (rounds > 31) rounds = 31; blowfish_init(&state, pass, pass_len, salt, salt_len); for (i = 0; i < (UINT32_C(1) << rounds); i++) { blowfish_expand0state(&state, salt, salt_len); blowfish_expand0state(&state, pass, pass_len); } off = 0; for (j = 0; j < BCRYPT_BLOCKS256; j++) cdata[j] = blowfish_stream2word(ciphertext, BCRYPT_SIZE256, &off); for (j = 0; j < 64; j++) blowfish_enc(&state, cdata, BCRYPT_BLOCKS256); for (j = 0; j < BCRYPT_BLOCKS256; j++) write32le(out + j * 4, cdata[j]); torsion_memzero(cdata, sizeof(cdata)); torsion_memzero(&state, sizeof(state)); } int bcrypt_pbkdf(unsigned char *key, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, unsigned int rounds, size_t size) { size_t i, j, stride, amount, keylen, amt, count, dest; unsigned char out[BCRYPT_SIZE256]; unsigned char tmpout[BCRYPT_SIZE256]; unsigned char sha2pass[64]; unsigned char sha2salt[64]; unsigned char ctr[4]; sha512_t shash, hash; if (rounds == 0 || pass_len == 0 || salt_len == 0 || size == 0 || size > (BCRYPT_SIZE256 * BCRYPT_SIZE256) || salt_len > ((size_t)1 << 20)) { return 0; } stride = (size + BCRYPT_SIZE256 - 1) / BCRYPT_SIZE256; amount = (size + stride - 1) / stride; sha512_init(&hash); sha512_update(&hash, pass, pass_len); sha512_final(&hash, sha2pass); /* Zero for struct assignment. */ memset(&shash, 0, sizeof(shash)); sha512_init(&shash); sha512_update(&shash, salt, salt_len); keylen = size; amt = amount; for (count = 1; keylen > 0; count++) { write32be(ctr, count); hash = shash; sha512_update(&hash, ctr, 4); sha512_final(&hash, sha2salt); bcrypt_hash256(tmpout, sha2pass, 64, sha2salt, 64, 6); memcpy(out, tmpout, BCRYPT_SIZE256); for (i = 1; i < rounds; i++) { sha512_init(&hash); sha512_update(&hash, tmpout, BCRYPT_SIZE256); sha512_final(&hash, sha2salt); bcrypt_hash256(tmpout, sha2pass, 64, sha2salt, 64, 6); for (j = 0; j < BCRYPT_SIZE256; j++) out[j] ^= tmpout[j]; } if (amt > keylen) amt = keylen; for (i = 0; i < amt; i++) { dest = i * stride + (count - 1); if (dest >= size) break; key[dest] = out[i]; } keylen -= i; } torsion_memzero(out, sizeof(out)); torsion_memzero(tmpout, sizeof(tmpout)); torsion_memzero(sha2pass, sizeof(sha2pass)); torsion_memzero(sha2salt, sizeof(sha2salt)); torsion_memzero(&shash, sizeof(shash)); torsion_memzero(&hash, sizeof(hash)); return 1; } int bcrypt_derive(unsigned char *out, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, unsigned int rounds, char minor) { unsigned char tmp[BCRYPT_SIZE192]; unsigned char key[255]; size_t key_len; if (rounds < 4 || rounds > 31) return 0; if (salt_len != BCRYPT_SALT192) return 0; if (pass_len >= 255) { memcpy(key, pass, 255); } else { if (pass_len > 0) memcpy(key, pass, pass_len); key[pass_len] = 0; } switch (minor) { case 'a': key_len = (pass_len + 1) & 0xff; break; case 'b': key_len = pass_len; if (key_len > 72) key_len = 72; key_len += 1; break; default: return 0; } bcrypt_hash192(tmp, key, key_len, salt, salt_len, rounds); memcpy(out, tmp, BCRYPT_HASH192); torsion_memzero(tmp, sizeof(tmp)); torsion_memzero(key, sizeof(key)); return 1; } int bcrypt_generate(char *out, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, unsigned int rounds, char minor) { unsigned char hash[BCRYPT_HASH192]; if (!bcrypt_derive(hash, pass, pass_len, salt, salt_len, rounds, minor)) return 0; bcrypt_encode(out, minor, rounds, salt, hash); return 1; } int bcrypt_generate_with_salt64(char *out, const unsigned char *pass, size_t pass_len, const char *salt64, unsigned int rounds, char minor) { /* Useful for testing. */ unsigned char salt[BCRYPT_SALT192]; salt64 = base64_decode(salt, BCRYPT_SALT192, salt64); if (salt64 == NULL) return 0; if (*salt64 != '\0') return 0; return bcrypt_generate(out, pass, pass_len, salt, sizeof(salt), rounds, minor); } int bcrypt_verify(const unsigned char *pass, size_t pass_len, const char *record) { char minor; unsigned int rounds; unsigned char salt[BCRYPT_SALT192]; unsigned char expect[BCRYPT_HASH192]; unsigned char hash[BCRYPT_HASH192]; if (!bcrypt_decode(&minor, &rounds, salt, expect, record)) return 0; if (!bcrypt_derive(hash, pass, pass_len, salt, sizeof(salt), rounds, minor)) return 0; return torsion_memequal(hash, expect, BCRYPT_HASH192); } /* * EB2K (OpenSSL Legacy) * * Resources: * https://github.com/openssl/openssl/blob/2e9d61e/crypto/evp/evp_key.c */ int eb2k_derive(unsigned char *key, unsigned char *iv, hash_id_t type, const unsigned char *passwd, size_t passwd_len, const unsigned char *salt, size_t salt_len, size_t key_len, size_t iv_len) { size_t hash_size = hash_output_size(type); unsigned char prev[HASH_MAX_OUTPUT_SIZE]; unsigned char *block; size_t block_len, want; size_t prev_len = 0; hash_t hash; if (salt_len > 8) salt_len = 8; if (!hash_has_backend(type)) return 0; if (salt_len != 0 && salt_len != 8) return 0; if (key_len + iv_len < iv_len) return 0; while (key_len + iv_len > 0) { hash_init(&hash, type); hash_update(&hash, prev, prev_len); hash_update(&hash, passwd, passwd_len); hash_update(&hash, salt, salt_len); hash_final(&hash, prev, hash_size); prev_len = hash_size; block = prev; block_len = prev_len; if (key_len > 0) { want = block_len; if (want > key_len) want = key_len; memcpy(key, block, want); key += want; key_len -= want; block += want; block_len -= want; } if (iv_len > 0) { want = block_len; if (want > iv_len) want = iv_len; memcpy(iv, block, want); iv += want; iv_len -= want; } } torsion_memzero(prev, sizeof(prev)); torsion_memzero(&hash, sizeof(hash)); return 1; } /* * HKDF * * Resources: * https://en.wikipedia.org/wiki/HKDF * https://tools.ietf.org/html/rfc5869 */ int hkdf_extract(unsigned char *out, hash_id_t type, const unsigned char *ikm, size_t ikm_len, const unsigned char *salt, size_t salt_len) { hmac_t hmac; if (!hash_has_backend(type)) return 0; hmac_init(&hmac, type, salt, salt_len); hmac_update(&hmac, ikm, ikm_len); hmac_final(&hmac, out); return 1; } int hkdf_expand(unsigned char *out, hash_id_t type, const unsigned char *prk, const unsigned char *info, size_t info_len, size_t len) { size_t hash_size = hash_output_size(type); unsigned char prev[HASH_MAX_OUTPUT_SIZE]; size_t prev_len = 0; hmac_t pmac, hmac; size_t i, blocks; uint8_t ctr = 0; if (!hash_has_backend(type)) return 0; if (len + hash_size - 1 < len) return 0; blocks = (len + hash_size - 1) / hash_size; if (blocks > 255) return 0; if (len == 0) return 1; /* Zero for struct assignment. */ memset(&pmac, 0, sizeof(pmac)); hmac_init(&pmac, type, prk, hash_size); for (i = 0; i < blocks; i++) { ctr += 1; hmac = pmac; hmac_update(&hmac, prev, prev_len); hmac_update(&hmac, info, info_len); hmac_update(&hmac, &ctr, 1); hmac_final(&hmac, prev); prev_len = hash_size; if (hash_size > len) hash_size = len; memcpy(out, prev, hash_size); out += hash_size; len -= hash_size; } torsion_memzero(prev, sizeof(prev)); torsion_memzero(&pmac, sizeof(pmac)); torsion_memzero(&hmac, sizeof(hmac)); return 1; } /* * PBKDF2 * * Resources: * https://en.wikipedia.org/wiki/PBKDF2 * https://tools.ietf.org/html/rfc2898 * https://tools.ietf.org/html/rfc2898#section-5.2 * https://tools.ietf.org/html/rfc6070 * https://www.emc.com/collateral/white-papers/h11302-pkcs5v2-1-password-based-cryptography-standard-wp.pdf * http://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf */ int pbkdf2_derive(unsigned char *out, hash_id_t type, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, uint32_t iter, size_t len) { size_t hash_size = hash_output_size(type); unsigned char block[HASH_MAX_OUTPUT_SIZE]; unsigned char mac[HASH_MAX_OUTPUT_SIZE]; unsigned char ctr[4]; hmac_t pmac, smac, hmac; size_t i, k, blocks; uint32_t j; if (!hash_has_backend(type)) return 0; if (len + hash_size - 1 < len) return 0; blocks = (len + hash_size - 1) / hash_size; if (blocks > UINT32_MAX) return 0; if (len == 0) return 1; /* Zero for struct assignment. */ memset(&pmac, 0, sizeof(pmac)); memset(&smac, 0, sizeof(smac)); hmac_init(&pmac, type, pass, pass_len); smac = pmac; hmac_update(&smac, salt, salt_len); for (i = 0; i < blocks; i++) { write32be(ctr, i + 1); hmac = smac; hmac_update(&hmac, ctr, 4); hmac_final(&hmac, block); memcpy(mac, block, hash_size); for (j = 1; j < iter; j++) { hmac = pmac; hmac_update(&hmac, mac, hash_size); hmac_final(&hmac, mac); for (k = 0; k < hash_size; k++) block[k] ^= mac[k]; } if (hash_size > len) hash_size = len; memcpy(out, block, hash_size); out += hash_size; len -= hash_size; } torsion_memzero(block, sizeof(block)); torsion_memzero(mac, sizeof(mac)); torsion_memzero(&pmac, sizeof(pmac)); torsion_memzero(&smac, sizeof(smac)); torsion_memzero(&hmac, sizeof(hmac)); return 1; } /* * PGPDF * * Resources: * https://github.com/golang/crypto/tree/master/openpgp */ int pgpdf_derive_simple(unsigned char *out, hash_id_t type, const unsigned char *pass, size_t pass_len, size_t len) { return pgpdf_derive_salted(out, type, pass, pass_len, NULL, 0, len); } int pgpdf_derive_salted(unsigned char *out, hash_id_t type, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, size_t len) { static const unsigned char zero = 0; size_t hash_size = hash_output_size(type); unsigned char buf[HASH_MAX_OUTPUT_SIZE]; size_t i, j; hash_t hash; if (!hash_has_backend(type)) return 0; i = 0; while (len > 0) { hash_init(&hash, type); for (j = 0; j < i; j++) hash_update(&hash, &zero, 1); hash_update(&hash, salt, salt_len); hash_update(&hash, pass, pass_len); hash_final(&hash, buf, hash_size); if (hash_size > len) hash_size = len; memcpy(out, buf, hash_size); out += hash_size; len -= hash_size; i += 1; } torsion_memzero(buf, sizeof(buf)); torsion_memzero(&hash, sizeof(hash)); return 1; } int pgpdf_derive_iterated(unsigned char *out, hash_id_t type, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, size_t count, size_t len) { static const unsigned char zero = 0; size_t hash_size = hash_output_size(type); unsigned char buf[HASH_MAX_OUTPUT_SIZE]; size_t i, j, w, combined, todo; hash_t hash; if (!hash_has_backend(type)) return 0; combined = salt_len + pass_len; if (combined < salt_len) return 0; if (count < combined) count = combined; if (count + combined < count) return 0; i = 0; while (len > 0) { hash_init(&hash, type); for (j = 0; j < i; j++) hash_update(&hash, &zero, 1); w = 0; while (w < count) { if (w + combined > count) { todo = count - w; if (todo < salt_len) { hash_update(&hash, salt, todo); } else { hash_update(&hash, salt, salt_len); hash_update(&hash, pass, todo - salt_len); } break; } hash_update(&hash, salt, salt_len); hash_update(&hash, pass, pass_len); w += combined; } hash_final(&hash, buf, hash_size); if (hash_size > len) hash_size = len; memcpy(out, buf, hash_size); out += hash_size; len -= hash_size; i += 1; } torsion_memzero(buf, sizeof(buf)); torsion_memzero(&hash, sizeof(hash)); return 1; } /* * Scrypt * * Resources: * https://en.wikipedia.org/wiki/Scrypt * http://www.tarsnap.com/scrypt.html * http://www.tarsnap.com/scrypt/scrypt.pdf * https://github.com/Tarsnap/scrypt/blob/master/lib/crypto/crypto_scrypt-ref.c */ static void blkcpy(uint8_t *, const uint8_t *, size_t); static void blkxor(uint8_t *, const uint8_t *, size_t); static void salsa20_8(uint8_t *); static void blockmix_salsa8(uint8_t *, uint8_t *, size_t); static uint64_t integerify(const uint8_t *, size_t); static void smix(uint8_t *, size_t, uint64_t, uint8_t *, uint8_t *); int scrypt_derive(unsigned char *out, const unsigned char *pass, size_t pass_len, const unsigned char *salt, size_t salt_len, uint64_t N, uint32_t r, uint32_t p, size_t len) { hash_id_t t = HASH_SHA256; uint8_t *B = NULL; uint8_t *V = NULL; uint8_t *XY = NULL; size_t R = r; size_t P = p; int ret = 0; size_t i; if (N == 0 || R == 0 || P == 0) return 0; if (len + 31 < len || (len + 31) / 32 > UINT32_MAX) return 0; if ((uint64_t)R * (uint64_t)P >= (UINT64_C(1) << 30)) return 0; if (R > SIZE_MAX / 128 / P) return 0; if (R > SIZE_MAX / 256) return 0; if (N > SIZE_MAX / 128 / R) return 0; if ((N & (N - 1)) != 0) return 0; if (len == 0) return 1; B = (uint8_t *)malloc(128 * R * P); XY = (uint8_t *)malloc(256 * R); V = (uint8_t *)malloc(128 * R * N); if (B == NULL || XY == NULL || V == NULL) goto fail; if (!pbkdf2_derive(B, t, pass, pass_len, salt, salt_len, 1, P * 128 * R)) goto fail; for (i = 0; i < P; i++) smix(&B[i * 128 * R], R, N, V, XY); if (!pbkdf2_derive(out, t, pass, pass_len, B, P * 128 * R, 1, len)) goto fail; ret = 1; fail: if (B != NULL) { torsion_memzero(B, 128 * R * P); free(B); } if (XY != NULL) { torsion_memzero(XY, 256 * R); free(XY); } if (V != NULL) { torsion_memzero(V, 128 * R * N); free(V); } return ret; } static void blkcpy(uint8_t *dst, const uint8_t *src, size_t len) { size_t i; for (i = 0; i < len; i++) dst[i] = src[i]; } static void blkxor(uint8_t *dst, const uint8_t *src, size_t len) { size_t i; for (i = 0; i < len; i++) dst[i] ^= src[i]; } static void salsa20_8(uint8_t *B) { uint32_t B32[16]; uint32_t x[16]; int i; /* Convert little-endian values in. */ for (i = 0; i < 16; i++) B32[i] = read32le(&B[i * 4]); /* Compute x = doubleround^4(B32). */ for (i = 0; i < 16; i++) x[i] = B32[i]; for (i = 0; i < 8; i += 2) { #define R(a, b) (((a) << (b)) | ((a) >> (32 - (b)))) /* Operate on columns. */ x[ 4] ^= R(x[ 0] + x[12], 7); x[ 8] ^= R(x[ 4] + x[ 0], 9); x[12] ^= R(x[ 8] + x[ 4], 13); x[ 0] ^= R(x[12] + x[ 8], 18); x[ 9] ^= R(x[ 5] + x[ 1], 7); x[13] ^= R(x[ 9] + x[ 5], 9); x[ 1] ^= R(x[13] + x[ 9], 13); x[ 5] ^= R(x[ 1] + x[13], 18); x[14] ^= R(x[10] + x[ 6], 7); x[ 2] ^= R(x[14] + x[10], 9); x[ 6] ^= R(x[ 2] + x[14], 13); x[10] ^= R(x[ 6] + x[ 2], 18); x[ 3] ^= R(x[15] + x[11], 7); x[ 7] ^= R(x[ 3] + x[15], 9); x[11] ^= R(x[ 7] + x[ 3], 13); x[15] ^= R(x[11] + x[ 7], 18); /* Operate on rows. */ x[ 1] ^= R(x[ 0] + x[ 3], 7); x[ 2] ^= R(x[ 1] + x[ 0], 9); x[ 3] ^= R(x[ 2] + x[ 1], 13); x[ 0] ^= R(x[ 3] + x[ 2], 18); x[ 6] ^= R(x[ 5] + x[ 4], 7); x[ 7] ^= R(x[ 6] + x[ 5], 9); x[ 4] ^= R(x[ 7] + x[ 6], 13); x[ 5] ^= R(x[ 4] + x[ 7], 18); x[11] ^= R(x[10] + x[ 9], 7); x[ 8] ^= R(x[11] + x[10], 9); x[ 9] ^= R(x[ 8] + x[11], 13); x[10] ^= R(x[ 9] + x[ 8], 18); x[12] ^= R(x[15] + x[14], 7); x[13] ^= R(x[12] + x[15], 9); x[14] ^= R(x[13] + x[12], 13); x[15] ^= R(x[14] + x[13], 18); #undef R } /* Compute B32 = B32 + x. */ for (i = 0; i < 16; i++) B32[i] += x[i]; /* Convert little-endian values out. */ for (i = 0; i < 16; i++) write32le(&B[4 * i], B32[i]); } static void blockmix_salsa8(uint8_t *B, uint8_t *Y, size_t r) { uint8_t X[64]; size_t i; /* 1: X <-- B_{2r - 1} */ blkcpy(X, &B[(2 * r - 1) * 64], 64); /* 2: for i = 0 to 2r - 1 do */ for (i = 0; i < 2 * r; i++) { /* 3: X <-- H(X \xor B_i) */ blkxor(X, &B[i * 64], 64); salsa20_8(X); /* 4: Y_i <-- X */ blkcpy(&Y[i * 64], X, 64); } /* 6: B' <-- (Y_0, Y_2 ... Y_{2r-2}, Y_1, Y_3 ... Y_{2r-1}) */ for (i = 0; i < r; i++) blkcpy(&B[i * 64], &Y[(i * 2) * 64], 64); for (i = 0; i < r; i++) blkcpy(&B[(i + r) * 64], &Y[(i * 2 + 1) * 64], 64); } static uint64_t integerify(const uint8_t *B, size_t r) { const uint8_t *X = &B[(2 * r - 1) * 64]; return read64le(X); } static void smix(uint8_t *B, size_t r, uint64_t N, uint8_t *V, uint8_t *XY) { uint8_t *X = XY; uint8_t *Y = &XY[128 * r]; uint64_t i; uint64_t j; /* 1: X <-- B */ blkcpy(X, B, 128 * r); /* 2: for i = 0 to N - 1 do */ for (i = 0; i < N; i++) { /* 3: V_i <-- X */ blkcpy(&V[i * (128 * r)], X, 128 * r); /* 4: X <-- H(X) */ blockmix_salsa8(X, Y, r); } /* 6: for i = 0 to N - 1 do */ for (i = 0; i < N; i++) { /* 7: j <-- Integerify(X) mod N */ j = integerify(X, r) & (N - 1); /* 8: X <-- H(X \xor V_j) */ blkxor(X, &V[j * (128 * r)], 128 * r); blockmix_salsa8(X, Y, r); } /* 10: B' <-- X */ blkcpy(B, X, 128 * r); }
22.531196
109
0.551286
cba13d071c30023f92aacb10bb53709f82a403fe
4,259
h
C
aws-cpp-sdk-iam/include/aws/iam/model/ListServiceSpecificCredentialsResult.h
capeanalytics/aws-sdk-cpp
e88f75add5a9433601b6d46fe738e493da56ac3b
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-iam/include/aws/iam/model/ListServiceSpecificCredentialsResult.h
capeanalytics/aws-sdk-cpp
e88f75add5a9433601b6d46fe738e493da56ac3b
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-iam/include/aws/iam/model/ListServiceSpecificCredentialsResult.h
capeanalytics/aws-sdk-cpp
e88f75add5a9433601b6d46fe738e493da56ac3b
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file 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. */ #pragma once #include <aws/iam/IAM_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/iam/model/ResponseMetadata.h> #include <aws/iam/model/ServiceSpecificCredentialMetadata.h> #include <utility> namespace Aws { template<typename RESULT_TYPE> class AmazonWebServiceResult; namespace Utils { namespace Xml { class XmlDocument; } // namespace Xml } // namespace Utils namespace IAM { namespace Model { class AWS_IAM_API ListServiceSpecificCredentialsResult { public: ListServiceSpecificCredentialsResult(); ListServiceSpecificCredentialsResult(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result); ListServiceSpecificCredentialsResult& operator=(const AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result); /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline const Aws::Vector<ServiceSpecificCredentialMetadata>& GetServiceSpecificCredentials() const{ return m_serviceSpecificCredentials; } /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline void SetServiceSpecificCredentials(const Aws::Vector<ServiceSpecificCredentialMetadata>& value) { m_serviceSpecificCredentials = value; } /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline void SetServiceSpecificCredentials(Aws::Vector<ServiceSpecificCredentialMetadata>&& value) { m_serviceSpecificCredentials = std::move(value); } /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline ListServiceSpecificCredentialsResult& WithServiceSpecificCredentials(const Aws::Vector<ServiceSpecificCredentialMetadata>& value) { SetServiceSpecificCredentials(value); return *this;} /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline ListServiceSpecificCredentialsResult& WithServiceSpecificCredentials(Aws::Vector<ServiceSpecificCredentialMetadata>&& value) { SetServiceSpecificCredentials(std::move(value)); return *this;} /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline ListServiceSpecificCredentialsResult& AddServiceSpecificCredentials(const ServiceSpecificCredentialMetadata& value) { m_serviceSpecificCredentials.push_back(value); return *this; } /** * <p>A list of structures that each contain details about a service-specific * credential.</p> */ inline ListServiceSpecificCredentialsResult& AddServiceSpecificCredentials(ServiceSpecificCredentialMetadata&& value) { m_serviceSpecificCredentials.push_back(std::move(value)); return *this; } inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; } inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; } inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); } inline ListServiceSpecificCredentialsResult& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;} inline ListServiceSpecificCredentialsResult& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;} private: Aws::Vector<ServiceSpecificCredentialMetadata> m_serviceSpecificCredentials; ResponseMetadata m_responseMetadata; }; } // namespace Model } // namespace IAM } // namespace Aws
38.718182
201
0.756516
997462e6b4dd6b8ace491b7d653b8a13e1baabad
2,467
h
C
system/autoware_state_monitor/include/autoware_state_monitor/autoware_state.h
hamlinzheng/AutowareArchitectureProposal.iv
8a1343019aca3a648754fa50e6cab72b98db2df5
[ "Apache-2.0" ]
null
null
null
system/autoware_state_monitor/include/autoware_state_monitor/autoware_state.h
hamlinzheng/AutowareArchitectureProposal.iv
8a1343019aca3a648754fa50e6cab72b98db2df5
[ "Apache-2.0" ]
9
2021-08-09T14:15:58.000Z
2021-08-19T07:56:14.000Z
system/autoware_state_monitor/include/autoware_state_monitor/autoware_state.h
hamlinzheng/AutowareArchitectureProposal.iv
8a1343019aca3a648754fa50e6cab72b98db2df5
[ "Apache-2.0" ]
1
2021-02-09T01:24:13.000Z
2021-02-09T01:24:13.000Z
/* * Copyright 2020 Tier IV, Inc. All rights reserved. * * 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. */ #pragma once #include <string> #include <autoware_system_msgs/AutowareState.h> enum class AutowareState : int8_t { InitializingVehicle, WaitingForRoute, Planning, WaitingForEngage, Driving, ArrivedGoal, Emergency, Finalizing, }; inline AutowareState fromString(const std::string & state) { using StateMessage = autoware_system_msgs::AutowareState; if (state == StateMessage::InitializingVehicle) return AutowareState::InitializingVehicle; if (state == StateMessage::WaitingForRoute) return AutowareState::WaitingForRoute; if (state == StateMessage::Planning) return AutowareState::Planning; if (state == StateMessage::WaitingForEngage) return AutowareState::WaitingForEngage; if (state == StateMessage::Driving) return AutowareState::Driving; if (state == StateMessage::ArrivedGoal) return AutowareState::ArrivedGoal; if (state == StateMessage::Emergency) return AutowareState::Emergency; if (state == StateMessage::Finalizing) return AutowareState::Finalizing; throw std::runtime_error("invalid state"); } inline std::string toString(const AutowareState & state) { using StateMessage = autoware_system_msgs::AutowareState; if (state == AutowareState::InitializingVehicle) return StateMessage::InitializingVehicle; if (state == AutowareState::WaitingForRoute) return StateMessage::WaitingForRoute; if (state == AutowareState::Planning) return StateMessage::Planning; if (state == AutowareState::WaitingForEngage) return StateMessage::WaitingForEngage; if (state == AutowareState::Driving) return StateMessage::Driving; if (state == AutowareState::ArrivedGoal) return StateMessage::ArrivedGoal; if (state == AutowareState::Emergency) return StateMessage::Emergency; if (state == AutowareState::Finalizing) return StateMessage::Finalizing; throw std::runtime_error("invalid state"); }
37.953846
92
0.766113
3e7178576277491fcbc8d12e238bd2eafb4337a3
5,488
c
C
enclave/core/strtoul.c
jbdelcuv/openenclave
c2e9cfabd788597f283c8dd39edda5837b1b1339
[ "MIT" ]
617
2019-06-19T22:08:04.000Z
2022-03-25T09:21:03.000Z
enclave/core/strtoul.c
jbdelcuv/openenclave
c2e9cfabd788597f283c8dd39edda5837b1b1339
[ "MIT" ]
2,545
2019-06-18T21:46:10.000Z
2022-03-31T23:26:51.000Z
enclave/core/strtoul.c
jbdelcuv/openenclave
c2e9cfabd788597f283c8dd39edda5837b1b1339
[ "MIT" ]
292
2019-07-02T15:40:35.000Z
2022-03-27T13:27:10.000Z
// Copyright (c) Open Enclave SDK contributors. // Licensed under the MIT License. #include <openenclave/bits/defs.h> #include <openenclave/bits/types.h> #include <openenclave/corelibc/ctype.h> #include <openenclave/corelibc/stdlib.h> // // If c is a digit character: // then: _digit[c] yields the integer value for that digit character. // else: _digit[c] yields 0xFF. // // Digit characters fall within these ranges: ['0'-'9'] and ['A'-'Z']. // // Examples: // _digit['9'] => 9 // _digit['A'] => 10 // _digit['Z'] => 35 // _digit['?'] => 0xFF // static const unsigned char _digit[256] = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, }; /* Return true if c is a digit character within the given base */ OE_INLINE bool _isdigit(char c, int base) { return _digit[(unsigned char)c] < base; } unsigned long int oe_strtoul(const char* nptr, char** endptr, int base) { const char* p; unsigned long x = 0; bool negative = false; if (endptr) *endptr = (char*)nptr; if (!nptr || base < 0) return 0; /* Set scanning pointer to nptr */ p = nptr; /* Skip any leading whitespace */ while (oe_isspace(*p)) p++; /* Handle '+' and '-' */ if (p[0] == '+') { p++; } else if (p[0] == '-') { negative = true; p++; } /* If base is zero, deduce the base from the prefix. */ if (base == 0) { if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { base = 16; } else if (p[0] == '0') { base = 8; } else { base = 10; } } /* Remove any base 16 prefix. */ if (base == 16) { if (p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { p += 2; } } /* Remove any base 8 prefix. */ if (base == 8) { if (p[0] == '0') { p++; } } for (; *p && _isdigit(*p, base); p++) { /* Multiply by base */ { /* Check for overflow */ if (x > OE_UINT64_MAX / (unsigned long)base) { if (endptr) *endptr = (char*)p; return OE_UINT64_MAX; } x = x * (unsigned long)base; } /* Add digit */ { const unsigned long digit = _digit[(unsigned char)*p]; /* Check for overflow */ if (digit > OE_ULONG_MAX - x) { if (endptr) *endptr = (char*)p; return OE_UINT64_MAX; } x += digit; } } /* Return zero if no digits were found */ if (p == nptr) return 0; if (endptr) *endptr = (char*)p; /* Invert if negative */ if (negative) { if (x > OE_LONG_MAX) { if (x == (unsigned long)OE_LONG_MAX + 1) return x; else return 0; } x = (unsigned long)-(long)x; } return x; } /* **============================================================================== ** ** Use the following functions to generate the _digit[] table above. ** **============================================================================== */ #if defined(OE_NEED_STRTOUL_GENERATOR) void __oe_gen_strtoul_table(void) { for (int i = 0; i < 256; i++) { if (i >= '0' && i <= '9') { oe_printf("0x%02x,\n", i - '0'); } else if (i >= 'A' && i <= 'Z') { oe_printf("0x%02x,\n", i - 'A' + 10); } else if (i >= 'a' && i <= 'z') { oe_printf("0x%02x,\n", i - 'a' + 10); } else { oe_printf("0xFF,\n"); } } } #endif /* defined(OE_NEED_STRTOUL_GENERATOR) */
26.384615
80
0.479956
c4a9b2c8339ecd58fc8100b1a55ab33e2c18defd
1,255
h
C
TAO/TAO_IDL/be_include/be_visitor_decl.h
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
36
2015-01-10T07:27:33.000Z
2022-03-07T03:32:08.000Z
TAO/TAO_IDL/be_include/be_visitor_decl.h
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
2
2018-08-13T07:30:51.000Z
2019-02-25T03:04:31.000Z
TAO/TAO_IDL/be_include/be_visitor_decl.h
cflowe/ACE
5ff60b41adbe1772372d1a43bcc1f2726ff8f810
[ "DOC" ]
38
2015-01-08T14:12:06.000Z
2022-01-19T08:33:00.000Z
/* -*- c++ -*- */ //============================================================================= /** * @file be_visitor_decl.h * * $Id: be_visitor_decl.h 91742 2010-09-13 18:23:17Z johnnyw $ * * Concrete visitor for the base "BE_Decl" node * * * @author Aniruddha Gokhale and Carlos O'Ryan */ //============================================================================= #ifndef TAO_BE_VISITOR_DECL_H #define TAO_BE_VISITOR_DECL_H #include "be_visitor.h" #include "be_codegen.h" #include "be_helper.h" /** * @class be_visitor_decl * * @brief be_visitor_decl * * This is a concrete visitor for the be_decl node. Its only purpose is to * maintain state information for the derived visitor */ class be_visitor_decl : public be_visitor { public: be_visitor_decl (be_visitor_context *ctx); ~be_visitor_decl (void); be_visitor_context *ctx (void); protected: /// Any context information required by the visitor. be_visitor_context *ctx_; /// Factors out common code used when one anonymous type is /// contained by another. int gen_anonymous_base_type (be_type *bt, TAO_CodeGen::CG_STATE cg_state); /// Our file stream. TAO_OutStream &os_; }; #endif // TAO_BE_VISITOR_DECL_H
23.679245
79
0.606375
16602a29972e7fde9de99f09e4ee5bb82667617b
87
c
C
src/sdk/src/libc/src/ctype/isblank.c
cmejj/How-to-Make-a-Computer-Operating-System
eb30f8802fac9f0f1c28d3a96bb3d402bdfc4687
[ "Apache-2.0" ]
16,500
2015-01-01T00:47:42.000Z
2022-03-31T17:12:02.000Z
src/sdk/src/libc/src/ctype/isblank.c
yongpingkan/How-to-Make-a-Computer-Operating-System
eb30f8802fac9f0f1c28d3a96bb3d402bdfc4687
[ "Apache-2.0" ]
66
2015-01-08T15:22:11.000Z
2021-12-16T09:04:37.000Z
src/sdk/src/libc/src/ctype/isblank.c
yongpingkan/How-to-Make-a-Computer-Operating-System
eb30f8802fac9f0f1c28d3a96bb3d402bdfc4687
[ "Apache-2.0" ]
3,814
2015-01-01T12:42:31.000Z
2022-03-31T14:26:50.000Z
#include <ctype.h> int isblank( int c ) { return ( c == ' ' || c == '\t' ); }
9.666667
37
0.413793
8f70d61679449d0fd81999fe4e1ad9ff4af107c5
495
h
C
CVSym/CVSym/Error.h
WebFreak001/mago
50ba766aabf5d395c3d15aaf080665906b76008b
[ "Apache-2.0" ]
39
2015-02-26T10:22:42.000Z
2021-11-13T23:07:57.000Z
CVSym/CVSym/Error.h
WebFreak001/mago
50ba766aabf5d395c3d15aaf080665906b76008b
[ "Apache-2.0" ]
29
2015-12-02T12:38:57.000Z
2021-03-31T16:43:34.000Z
CVSym/CVSym/Error.h
WebFreak001/mago
50ba766aabf5d395c3d15aaf080665906b76008b
[ "Apache-2.0" ]
15
2015-03-03T07:28:43.000Z
2021-03-30T14:22:00.000Z
/* Copyright (c) 2010 Aldo J. Nunez Licensed under the Apache License, Version 2.0. See the LICENSE text file for details. */ #pragma once const HRESULT E_ALREADY_INIT = HRESULT_FROM_WIN32( ERROR_ALREADY_INITIALIZED ); const HRESULT E_NOT_FOUND = HRESULT_FROM_WIN32( ERROR_NOT_FOUND ); const HRESULT E_INSUFFICIENT_BUFFER = HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER ); const HRESULT E_BAD_FORMAT = HRESULT_FROM_WIN32( ERROR_BAD_FORMAT );
33
87
0.731313
fef81fc4b0bd28dad46de0bfc80dc3100c41c530
13,469
c
C
third_party/gst-plugins-base/ext/gl/gstglfilterglass.c
isabella232/aistreams
209f4385425405676a581a749bb915e257dbc1c1
[ "Apache-2.0" ]
6
2020-09-22T18:07:15.000Z
2021-10-21T01:34:04.000Z
third_party/gst-plugins-base/ext/gl/gstglfilterglass.c
isabella232/aistreams
209f4385425405676a581a749bb915e257dbc1c1
[ "Apache-2.0" ]
2
2020-11-10T13:17:39.000Z
2022-03-30T11:22:14.000Z
third_party/gst-plugins-base/ext/gl/gstglfilterglass.c
isabella232/aistreams
209f4385425405676a581a749bb915e257dbc1c1
[ "Apache-2.0" ]
3
2020-09-26T08:40:35.000Z
2021-10-21T01:33:56.000Z
/* * GStreamer * Copyright (C) 2008 Julien Isorce <julien.isorce@gmail.com> * Inspired from http://www.mdk.org.pl/2007/11/17/gl-colorspace-conversions * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301, USA. */ /** * SECTION:element-glfilterglass * @title: glfilterglass * * Map textures on moving glass. * * ## Examples * |[ * gst-launch-1.0 -v videotestsrc ! glfilterglass ! glimagesink * ]| A pipeline inspired from http://www.mdk.org.pl/2007/11/17/gl-colorspace-conversions * FBO is required. * |[ * gst-launch-1.0 -v videotestsrc ! glfilterglass ! video/x-raw, width=640, height=480 ! glimagesink * ]| The scene is greater than the input size. * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <math.h> #include <gst/gl/gstglfuncs.h> #include "gstglfilterglass.h" #include "gstglutils.h" #define GST_CAT_DEFAULT gst_gl_filter_glass_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); enum { PROP_0 }; #define DEBUG_INIT \ GST_DEBUG_CATEGORY_INIT (gst_gl_filter_glass_debug, "glfilterglass", 0, "glfilterglass element"); #define gst_gl_filter_glass_parent_class parent_class G_DEFINE_TYPE_WITH_CODE (GstGLFilterGlass, gst_gl_filter_glass, GST_TYPE_GL_FILTER, DEBUG_INIT); static void gst_gl_filter_glass_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec); static void gst_gl_filter_glass_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec); static gboolean gst_gl_filter_glass_reset (GstBaseTransform * trans); static gboolean gst_gl_filter_glass_init_shader (GstGLFilter * filter); static gboolean gst_gl_filter_glass_filter_texture (GstGLFilter * filter, GstGLMemory * in_tex, GstGLMemory * out_tex); static void gst_gl_filter_glass_draw_background_gradient (); static void gst_gl_filter_glass_draw_video_plane (GstGLFilter * filter, gint width, gint height, guint texture, gfloat center_x, gfloat center_y, gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation); static gboolean gst_gl_filter_glass_callback (gpointer stuff); /* *INDENT-OFF* */ static const gchar *glass_fragment_source = "uniform sampler2D tex;\n" "varying float alpha;\n" "void main () {\n" " float p = 0.0525;\n" " float L1 = p*1.0;\n" " float L2 = 1.0 - L1;\n" " float L3 = 1.0 - L1;\n" " float w = 1.0;\n" " float r = L1;\n" " if (gl_TexCoord[0].x < L1 && gl_TexCoord[0].y < L1)\n" " r = sqrt( (gl_TexCoord[0].x - L1) * (gl_TexCoord[0].x - L1) + (gl_TexCoord[0].y - L1) * (gl_TexCoord[0].y - L1) );\n" " else if (gl_TexCoord[0].x > L2 && gl_TexCoord[0].y < L1)\n" " r = sqrt( (gl_TexCoord[0].x - L2) * (gl_TexCoord[0].x - L2) + (gl_TexCoord[0].y - L1) * (gl_TexCoord[0].y - L1) );\n" " else if (gl_TexCoord[0].x > L2 && gl_TexCoord[0].y > L3)\n" " r = sqrt( (gl_TexCoord[0].x - L2) * (gl_TexCoord[0].x - L2) + (gl_TexCoord[0].y - L3) * (gl_TexCoord[0].y - L3) );\n" " else if (gl_TexCoord[0].x < L1 && gl_TexCoord[0].y > L3)\n" " r = sqrt( (gl_TexCoord[0].x - L1) * (gl_TexCoord[0].x - L1) + (gl_TexCoord[0].y - L3) * (gl_TexCoord[0].y - L3) );\n" " if (r > L1)\n" " w = 0.0;\n" " vec4 color = texture2D (tex, gl_TexCoord[0].st);\n" " gl_FragColor = vec4(color.rgb, alpha * w);\n" "}\n"; static const gchar *glass_vertex_source = "uniform float yrot;\n" "uniform float aspect;\n" "const float fovy = 80.0;\n" "const float znear = 1.0;\n" "const float zfar = 5000.0;\n" "varying float alpha;\n" "void main () {\n" " float f = 1.0/(tan(radians(fovy/2.0)));\n" " float rot = radians (yrot);\n" " // replacement for gluPerspective\n" " mat4 perspective = mat4 (\n" " f/aspect, 0.0, 0.0, 0.0,\n" " 0.0, f, 0.0, 0.0,\n" " 0.0, 0.0, (znear+zfar)/(znear-zfar), 2.0*znear*zfar/(znear-zfar),\n" " 0.0, 0.0, -1.0, 0.0 );\n" " mat4 trans = mat4 (\n" " 1.0, 0.0, 0.0, 0.0,\n" " 0.0, 1.0, 0.0, 0.0,\n" " 0.0, 0.0, 1.0, -3.0,\n" " 0.0, 0.0, 0.0, 1.0 );\n" " mat4 rotation = mat4 (\n" " cos(rot), 0.0, sin(rot), 0.0,\n" " 0.0, 1.0, 0.0, 0.0,\n" " -sin(rot), 0.0, cos(rot), 0.0,\n" " 0.0, 0.0, 0.0, 1.0 );\n" " gl_Position = trans * perspective * rotation * gl_ModelViewProjectionMatrix * gl_Vertex;\n" " gl_TexCoord[0] = gl_MultiTexCoord0;\n" " alpha = gl_Color.a;\n" "}\n"; static const gchar * passthrough_vertex = "void main () {\n" " gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" " gl_FrontColor = gl_Color;\n" "}\n"; static const gchar * passthrough_fragment = "void main () {\n" " gl_FragColor = gl_Color;\n" "}\n"; /* *INDENT-ON* */ static void gst_gl_filter_glass_class_init (GstGLFilterGlassClass * klass) { GObjectClass *gobject_class; GstElementClass *element_class; gobject_class = (GObjectClass *) klass; element_class = GST_ELEMENT_CLASS (klass); gst_gl_filter_add_rgba_pad_templates (GST_GL_FILTER_CLASS (klass)); gobject_class->set_property = gst_gl_filter_glass_set_property; gobject_class->get_property = gst_gl_filter_glass_get_property; gst_element_class_set_metadata (element_class, "OpenGL glass filter", "Filter/Effect/Video", "Glass Filter", "Julien Isorce <julien.isorce@gmail.com>"); GST_GL_FILTER_CLASS (klass)->filter_texture = gst_gl_filter_glass_filter_texture; GST_GL_FILTER_CLASS (klass)->init_fbo = gst_gl_filter_glass_init_shader; GST_BASE_TRANSFORM_CLASS (klass)->stop = gst_gl_filter_glass_reset; GST_GL_BASE_FILTER_CLASS (klass)->supported_gl_api = GST_GL_API_OPENGL; } static void gst_gl_filter_glass_init (GstGLFilterGlass * filter) { filter->shader = NULL; filter->timestamp = 0; } static gboolean gst_gl_filter_glass_reset (GstBaseTransform * trans) { GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (trans); //blocking call, wait the opengl thread has destroyed the shader if (glass_filter->shader) gst_object_unref (glass_filter->shader); glass_filter->shader = NULL; if (glass_filter->passthrough_shader) gst_object_unref (glass_filter->passthrough_shader); glass_filter->passthrough_shader = NULL; glass_filter->start_time = 0; return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (trans); } static void gst_gl_filter_glass_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { //GstGLFilterGlass *filter = GST_GL_FILTER_GLASS (object); switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static void gst_gl_filter_glass_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { //GstGLFilterGlass *filter = GST_GL_FILTER_GLASS (object); switch (prop_id) { default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } static gboolean gst_gl_filter_glass_init_shader (GstGLFilter * filter) { gboolean ret; GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (filter); //blocking call, wait the opengl thread has compiled the shader ret = gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, glass_vertex_source, glass_fragment_source, &glass_filter->shader); if (ret) ret = gst_gl_context_gen_shader (GST_GL_BASE_FILTER (filter)->context, passthrough_vertex, passthrough_fragment, &glass_filter->passthrough_shader); return ret; } static gboolean gst_gl_filter_glass_filter_texture (GstGLFilter * filter, GstGLMemory * in_tex, GstGLMemory * out_tex) { GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (filter); glass_filter->in_tex = in_tex; gst_gl_framebuffer_draw_to_texture (filter->fbo, out_tex, gst_gl_filter_glass_callback, glass_filter); return TRUE; } static gint64 get_time (void) { return g_get_real_time (); } static void gst_gl_filter_glass_draw_background_gradient (GstGLFilterGlass * glass) { GstGLFilter *filter = GST_GL_FILTER (glass); GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable; /* *INDENT-OFF* */ gfloat mesh[] = { /* | Vertex | Color | */ -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.8f, 0.0f, 0.0f, 0.0f, 0.2f, 1.0f, -1.0f, 0.8f, 0.0f, 0.0f, 0.0f, 0.2f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.2f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.2f, 1.0f, }; /* *INDENT-ON* */ GLushort indices[] = { 0, 1, 2, 0, 2, 3, 2, 3, 4, 2, 4, 5 }; gl->ClientActiveTexture (GL_TEXTURE0); gl->EnableClientState (GL_VERTEX_ARRAY); gl->EnableClientState (GL_COLOR_ARRAY); gl->VertexPointer (3, GL_FLOAT, 7 * sizeof (gfloat), mesh); gl->ColorPointer (4, GL_FLOAT, 7 * sizeof (gfloat), &mesh[3]); gl->DrawElements (GL_TRIANGLES, 12, GL_UNSIGNED_SHORT, indices); gl->DisableClientState (GL_VERTEX_ARRAY); gl->DisableClientState (GL_COLOR_ARRAY); } static void gst_gl_filter_glass_draw_video_plane (GstGLFilter * filter, gint width, gint height, guint texture, gfloat center_x, gfloat center_y, gfloat start_alpha, gfloat stop_alpha, gboolean reversed, gfloat rotation) { GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (filter); GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable; gfloat topy = reversed ? center_y - 1.0f : center_y + 1.0f; gfloat bottomy = reversed ? center_y + 1.0f : center_y - 1.0f; /* *INDENT-OFF* */ gfloat mesh[] = { /*| Vertex |TexCoord0| Colour |*/ center_x-1.6, topy, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, start_alpha, center_x+1.6, topy, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, start_alpha, center_x+1.6, bottomy, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, stop_alpha, center_x-1.6, bottomy, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, stop_alpha, }; /* *INDENT-ON* */ GLushort indices[] = { 0, 1, 2, 0, 2, 3 }; gl->ActiveTexture (GL_TEXTURE0); gl->BindTexture (GL_TEXTURE_2D, texture); gst_gl_shader_set_uniform_1i (glass_filter->shader, "tex", 0); gst_gl_shader_set_uniform_1f (glass_filter->shader, "yrot", rotation); gst_gl_shader_set_uniform_1f (glass_filter->shader, "aspect", (gfloat) width / (gfloat) height); gl->ClientActiveTexture (GL_TEXTURE0); gl->EnableClientState (GL_TEXTURE_COORD_ARRAY); gl->EnableClientState (GL_VERTEX_ARRAY); gl->EnableClientState (GL_COLOR_ARRAY); gl->VertexPointer (3, GL_FLOAT, 9 * sizeof (gfloat), mesh); gl->TexCoordPointer (2, GL_FLOAT, 9 * sizeof (gfloat), &mesh[3]); gl->ColorPointer (4, GL_FLOAT, 9 * sizeof (gfloat), &mesh[5]); gl->DrawElements (GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, indices); gl->DisableClientState (GL_TEXTURE_COORD_ARRAY); gl->DisableClientState (GL_VERTEX_ARRAY); gl->DisableClientState (GL_COLOR_ARRAY); } static gboolean gst_gl_filter_glass_callback (gpointer stuff) { gfloat rotation; GstGLFilter *filter = GST_GL_FILTER (stuff); GstGLFilterGlass *glass_filter = GST_GL_FILTER_GLASS (stuff); GstGLFuncs *gl = GST_GL_BASE_FILTER (filter)->context->gl_vtable; gint width = GST_VIDEO_INFO_WIDTH (&filter->out_info); gint height = GST_VIDEO_INFO_HEIGHT (&filter->out_info); guint texture = glass_filter->in_tex->tex_id; if (glass_filter->start_time == 0) glass_filter->start_time = get_time (); else { gint64 time_left = (glass_filter->timestamp / 1000) - (get_time () - glass_filter->start_time); time_left -= 1000000 / 25; if (time_left > 2000) { GST_LOG ("escape"); return FALSE; } } gst_gl_shader_use (glass_filter->passthrough_shader); gst_gl_filter_glass_draw_background_gradient (glass_filter); //Rotation if (glass_filter->start_time != 0) { gint64 time_passed = get_time () - glass_filter->start_time; rotation = sin (time_passed / 1200000.0) * 45.0f; } else { rotation = 0.0f; } gl->Enable (GL_BLEND); gl->BlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); gst_gl_shader_use (glass_filter->shader); //Reflection gst_gl_filter_glass_draw_video_plane (filter, width, height, texture, 0.0f, 2.0f, 0.3f, 0.0f, TRUE, rotation); //Main video gst_gl_filter_glass_draw_video_plane (filter, width, height, texture, 0.0f, 0.0f, 1.0f, 1.0f, FALSE, rotation); gst_gl_context_clear_shader (GST_GL_BASE_FILTER (filter)->context); gl->Disable (GL_BLEND); return TRUE; }
32.691748
128
0.668869
5c4dd84e6b2578c88daad9c0e626e1babc9e9348
300
h
C
src/db/db_instance.h
JAkutenshi/thesaurus_qt
31cc7f1b271d5809c08a0181807c427b1a1ad896
[ "MIT" ]
null
null
null
src/db/db_instance.h
JAkutenshi/thesaurus_qt
31cc7f1b271d5809c08a0181807c427b1a1ad896
[ "MIT" ]
null
null
null
src/db/db_instance.h
JAkutenshi/thesaurus_qt
31cc7f1b271d5809c08a0181807c427b1a1ad896
[ "MIT" ]
null
null
null
#ifndef DB_INSTANCE_H #define DB_INSTANCE_H #include <string> class DBInstance { public: DBInstance(); bool isDBexists(); bool isDBexists(std::string path); DBInstance& connect(); DBInstance& connect(std::string path); bool closeConection(); }; #endif // DB_INSTANCE_H
13.636364
42
0.686667
55ef54d80aba1be1c7e8fe602d1ff9b243255c17
2,191
h
C
vtkm/filter/Probe.h
rushah05/VTKm_FP16
487819a1dbdd8dc3f95cca2942e3f2706a2514b5
[ "BSD-3-Clause" ]
14
2019-10-25T03:25:47.000Z
2022-01-19T02:14:53.000Z
vtkm/filter/Probe.h
rushah05/VTKm_FP16
487819a1dbdd8dc3f95cca2942e3f2706a2514b5
[ "BSD-3-Clause" ]
2
2020-11-18T16:50:34.000Z
2022-01-21T13:31:47.000Z
vtkm/filter/Probe.h
rushah05/VTKm_FP16
487819a1dbdd8dc3f95cca2942e3f2706a2514b5
[ "BSD-3-Clause" ]
5
2020-10-02T10:14:35.000Z
2022-03-10T07:50:22.000Z
//============================================================================ // Copyright (c) Kitware, Inc. // All rights reserved. // See LICENSE.txt for details. // // This software is distributed WITHOUT ANY WARRANTY; without even // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR // PURPOSE. See the above copyright notice for more information. //============================================================================ #ifndef vtk_m_filter_Probe_h #define vtk_m_filter_Probe_h #include <vtkm/filter/FilterDataSet.h> #include <vtkm/worklet/Probe.h> namespace vtkm { namespace filter { class Probe : public vtkm::filter::FilterDataSet<Probe> { public: VTKM_CONT void SetGeometry(const vtkm::cont::DataSet& geometry); VTKM_CONT const vtkm::cont::DataSet& GetGeometry() const; VTKM_CONT void SetInvalidValue(vtkm::Float64 invalidValue) { this->InvalidValue = invalidValue; } VTKM_CONT vtkm::Float64 GetInvalidValue() const { return this->InvalidValue; } template <typename DerivedPolicy> VTKM_CONT vtkm::cont::DataSet DoExecute(const vtkm::cont::DataSet& input, vtkm::filter::PolicyBase<DerivedPolicy> policy); //Map a new field onto the resulting dataset after running the filter //this call is only valid after calling DoExecute. template <typename DerivedPolicy> VTKM_CONT bool MapFieldOntoOutput(vtkm::cont::DataSet& result, const vtkm::cont::Field& field, vtkm::filter::PolicyBase<DerivedPolicy>); template <typename T, typename StorageType, typename DerivedPolicy> VTKM_CONT bool DoMapField(vtkm::cont::DataSet& result, const vtkm::cont::ArrayHandle<T, StorageType>& input, const vtkm::filter::FieldMetadata& fieldMeta, vtkm::filter::PolicyBase<DerivedPolicy> policy); private: vtkm::cont::DataSet Geometry; vtkm::worklet::Probe Worklet; vtkm::Float64 InvalidValue = vtkm::Nan64(); }; } } // vtkm::filter #ifndef vtk_m_filter_Probe_hxx #include <vtkm/filter/Probe.hxx> #endif #endif // vtk_m_filter_Probe_h
34.777778
99
0.639434
1dc5cd8e394e8e3f313f39a44cd8efd7280caec7
1,049
c
C
ft_lstiter.c
europaplus/lib_ft
cbec5f5af75b9c29e667adbfcca8bcb24a454e98
[ "Unlicense" ]
null
null
null
ft_lstiter.c
europaplus/lib_ft
cbec5f5af75b9c29e667adbfcca8bcb24a454e98
[ "Unlicense" ]
null
null
null
ft_lstiter.c
europaplus/lib_ft
cbec5f5af75b9c29e667adbfcca8bcb24a454e98
[ "Unlicense" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_lstiter.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: knfonda <knfonda@student.21-school> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/11/03 10:34:45 by knfonda #+# #+# */ /* Updated: 2020/11/03 10:36:56 by knfonda ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_lstiter(t_list *lst, void (*f)(void *)) { if (!lst || !f) return ; while (lst) { f(lst->content); lst = lst->next; } }
41.96
80
0.181125
3d697a75d33f8aa175b47014021a6afe9c8d1315
3,313
c
C
src/x509req.c
beargiles/pgopenssltypes
7f89bf03d6c0d7ee7a1fbac03276490d575b0037
[ "PostgreSQL" ]
null
null
null
src/x509req.c
beargiles/pgopenssltypes
7f89bf03d6c0d7ee7a1fbac03276490d575b0037
[ "PostgreSQL" ]
null
null
null
src/x509req.c
beargiles/pgopenssltypes
7f89bf03d6c0d7ee7a1fbac03276490d575b0037
[ "PostgreSQL" ]
null
null
null
#include <stdio.h> #include "postgres.h" #include "fmgr.h" #include <postgresql/internal/c.h> #include <openssl/bio.h> #include <openssl/x509.h> #include <openssl/pem.h> #include "pgopenssltypes.h" // X509_REQ_get_version // X509_REQ_get_subject_name // X509_REQ_extract_key // X509_REQ_sign(REQ, PKEY, md) // X509_REQ_sign_ctx(REQ, EVP_MD_CTX) // X509_REQ_verify(X509_REQ *, EVP_PKEY *) /* * Wrappers for OpenSSL 'x509_req' functions. */ static X509_REQ * x509_req_from_string(const char *txt); static X509_REQ * x509_req_from_bytea(const bytea *raw); static char * x509_req_to_string(const X509_REQ *x509_req); static bytea * x509_req_to_bytea(const X509_REQ *x509_req); /* * Read PEM format. */ PG_FUNCTION_INFO_V1( x509_req_in); Datum x509_req_in( PG_FUNCTION_ARGS) { char *txt; bytea *result; X509_REQ *x509_req; // check for null input txt = PG_GETARG_CSTRING(0); if (txt == NULL || strlen(txt) == 0) { PG_RETURN_NULL(); } // write X509_REQ into buffer x509_req = x509_req_from_string(txt); result = x509_req_to_bytea(x509_req); X509_REQ_free(x509_req); // return bytea PG_RETURN_BYTEA_P(result); } /* * Write PEM format. */ PG_FUNCTION_INFO_V1( x509_req_out); Datum x509_req_out( PG_FUNCTION_ARGS) { bytea *raw; char *result; X509_REQ *x509_req; // check for null value. raw = PG_GETARG_BYTEA_P(0); if (raw == NULL || VARSIZE(raw) == VARHDRSZ) { PG_RETURN_NULL(); } // write X509_REQ into buffer x509_req = x509_req_from_bytea(raw); result = x509_req_to_string(x509_req); X509_REQ_free(x509_req); PG_RETURN_CSTRING(result); } /* * Convert string to X509_REQ. */ static X509_REQ * x509_req_from_string(const char *txt) { BIO *inp; X509_REQ *x509_req; x509_req = X509_REQ_new(); inp = BIO_new_mem_buf((char *) txt, strlen(txt)); PEM_read_bio_X509_REQ(inp, &x509_req, 0, NULL); BIO_free(inp); return x509_req; } /* * Convert bytea to X509_REQ. */ static X509_REQ * x509_req_from_bytea(const bytea *raw) { BIO *bio; X509_REQ *x509_req; // convert into X509_REQ bio = BIO_new_mem_buf(VARDATA(raw), VARSIZE(raw) - VARHDRSZ); BIO_set_close(bio, BIO_NOCLOSE); x509_req = X509_REQ_new(); d2i_X509_REQ_bio(bio, &x509_req); BIO_free(bio); if (x509_req == NULL) { ereport(ERROR, (errcode(ERRCODE_DATA_CORRUPTED), errmsg( "unable to decode X509_REQ record"))); } return x509_req; } /* * Convert X509_REQ to string. */ static char * x509_req_to_string(const X509_REQ *x509_req) { BIO *bio; int len; char *ptr, *result; // write X509_REQ into buffer bio = BIO_new(BIO_s_mem()); PEM_write_bio_X509_REQ(bio, (X509_REQ *) x509_req); // create results. len = BIO_number_written(bio); BIO_get_mem_data(bio, &ptr); result = palloc(len + 1); strncpy(result, ptr, len); result[len] = '\0'; BIO_free(bio); return result; } /* * Convert X509_REQ to bytea. */ static bytea * x509_req_to_bytea(const X509_REQ *x509_req) { BIO *bio; int len; bytea *result; char *ptr; // write X509_REQ into buffer bio = BIO_new(BIO_s_mem()); i2d_X509_REQ_bio(bio, (X509_REQ *) x509_req); // create bytea results. len = BIO_number_written(bio); BIO_get_mem_data(bio, &ptr); result = (bytea *) palloc(len + VARHDRSZ); memcpy(VARDATA(result), ptr, len); SET_VARSIZE(result, len + VARHDRSZ); BIO_free(bio); return result; }
20.836478
62
0.712647
cea9ed71c8c07781d35f0a61eb0925d46a2030eb
2,726
h
C
src/plugins/nat/lib/lib.h
xerothermic/vpp
25a52a2c9c3e77acaf06a68a98be46fae254083d
[ "Apache-2.0" ]
751
2017-07-13T06:16:46.000Z
2022-03-30T09:14:35.000Z
src/plugins/nat/lib/lib.h
xerothermic/vpp
25a52a2c9c3e77acaf06a68a98be46fae254083d
[ "Apache-2.0" ]
15
2018-03-19T15:20:07.000Z
2022-03-18T19:48:21.000Z
src/plugins/nat/lib/lib.h
xerothermic/vpp
25a52a2c9c3e77acaf06a68a98be46fae254083d
[ "Apache-2.0" ]
479
2017-07-13T06:17:26.000Z
2022-03-31T18:20:43.000Z
/* * Copyright (c) 2020 Cisco and/or its affiliates. * 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. */ /** * @file * @brief NAT port/address allocation lib */ #ifndef included_nat_lib_h__ #define included_nat_lib_h__ #include <vlibapi/api.h> /* NAT API Configuration flags */ #define foreach_nat_config_flag \ _(0x01, IS_TWICE_NAT) \ _(0x02, IS_SELF_TWICE_NAT) \ _(0x04, IS_OUT2IN_ONLY) \ _(0x08, IS_ADDR_ONLY) \ _(0x10, IS_OUTSIDE) \ _(0x20, IS_INSIDE) \ _(0x40, IS_STATIC) \ _(0x80, IS_EXT_HOST_VALID) typedef enum nat_config_flags_t_ { #define _(n,f) NAT_API_##f = n, foreach_nat_config_flag #undef _ } nat_config_flags_t; #define foreach_nat_counter _ (tcp) _ (udp) _ (icmp) _ (other) _ (drops) #define foreach_nat_error \ _ (VALUE_EXIST, -1, "Value already exists") \ _ (NO_SUCH_ENTRY, -2, "No such entry") \ _ (UNKNOWN_PROTOCOL, -3, "Unknown protocol") \ _ (OUT_OF_TRANSLATIONS, -4, "Out of translations") typedef enum { #define _(N, i, s) NAT_ERROR_##N = i, foreach_nat_error #undef _ } nat_error_t; /* default protocol timeouts */ #define NAT_UDP_TIMEOUT 300 #define NAT_TCP_TRANSITORY_TIMEOUT 240 #define NAT_TCP_ESTABLISHED_TIMEOUT 7440 #define NAT_ICMP_TIMEOUT 60 typedef struct { struct { u32 established; u32 transitory; } tcp; u32 udp; u32 icmp; } nat_timeouts_t; static_always_inline void nat_reset_timeouts (nat_timeouts_t * timeouts) { timeouts->udp = NAT_UDP_TIMEOUT; timeouts->tcp.established = NAT_TCP_ESTABLISHED_TIMEOUT; timeouts->tcp.transitory = NAT_TCP_TRANSITORY_TIMEOUT; timeouts->icmp = NAT_ICMP_TIMEOUT; } static_always_inline u32 nat_calc_bihash_buckets (u32 n_elts) { n_elts = n_elts / 2.5; u64 lower_pow2 = 1; while (lower_pow2 * 2 < n_elts) { lower_pow2 = 2 * lower_pow2; } u64 upper_pow2 = 2 * lower_pow2; if ((upper_pow2 - n_elts) < (n_elts - lower_pow2)) { if (upper_pow2 <= UINT32_MAX) { return upper_pow2; } } return lower_pow2; } #endif /* included_nat_lib_h__ */ /* * fd.io coding-style-patch-verification: ON * * Local Variables: * eval: (c-set-style "gnu") * End: */
24.123894
75
0.689288
771f86a109ef04c227c8b82814737e939cc4a6e2
4,749
c
C
Firmware/functions.c
gnoya/Laboratorio-Proyectos-III
37e4bea21a36b88a7f96e65a4bb2a0222a5f6c9f
[ "MIT" ]
null
null
null
Firmware/functions.c
gnoya/Laboratorio-Proyectos-III
37e4bea21a36b88a7f96e65a4bb2a0222a5f6c9f
[ "MIT" ]
null
null
null
Firmware/functions.c
gnoya/Laboratorio-Proyectos-III
37e4bea21a36b88a7f96e65a4bb2a0222a5f6c9f
[ "MIT" ]
null
null
null
#include "AS1.h" #include "AS2.h" #include "Cpu.h" #include "Bit1.h" #include "Bit2.h" #include "PWM1.h" #include "PWM2.h" #include <string.h> #include <Math.h> extern char redRange[10]; extern char greenRange[10]; extern char blueRange[10]; extern char TC[40]; int motor; int direction; int pwm; void delayMS(int ms){ Cpu_Delay100US(10*ms); } void sendString(char string[], int choice){ int i; //char carry = 0x0D; //string[5] = (char) 13; for(i = 0; i < strlen(string); i++){ if(choice == 1){ AS1_SendChar(string[i]); } else if (choice == 2){ AS2_SendChar(string[i]); } else{ AS1_SendChar(string[i]); AS2_SendChar(string[i]); } } delayMS(20); if(choice == 1){ AS1_SendChar(13); // \r. } else if(choice == 2){ AS2_SendChar(13); // \r. } else if(choice == 3){ AS1_SendChar(13); // \r. AS2_SendChar(13); // \r. } else{ } } void sendString2(char string[], int choice){ int i; //char carry = 0x0D; //string[5] = (char) 13; for(i = 0; i < strlen(string); i++){ if(choice == 1){ AS1_SendChar(string[i]); } else if (choice == 2){ AS2_SendChar(string[i]); } else{ AS1_SendChar(string[i]); AS2_SendChar(string[i]); } } //AS2_SendChar(13); // \r. } int asciiToInt(char ascii){ return ascii - '0'; } void getCoordinates(char line[], int *x, int *y){ int i = 0; int j = 2; *x = 0; *y = 0; while(line[j] != ' '){ j++; } j--; i = j; while(line[i] != ' '){ *x += asciiToInt(line[i]) * pow(10, j - i); i--; } j += 2; while(line[j] != ' '){ j++; } j--; i = j; while(line[i] != ' '){ *y += asciiToInt(line[i]) * pow(10, j - i); i--; } } int intToAscii(int number){ unsigned char ascii = number + '0'; return ascii; } void sendBigNumber(int number){ int i; int L; int digit; int digits[40] = {0}; char string[40]; i = 0; while (number > 0) { digit = number % 10; digits[i] = digit; number = number / 10; i++; } L = i; for(i = 0; i < L; i++){ string[L - i - 1] = intToAscii(digits[i]); } sendString(string, 2); } void sendSerial(char ascii){ AS1_SendChar(ascii); AS2_SendChar(ascii); } void readLine(char line[]){ unsigned char charact; int i = 0; int carryReturn = 13; for(i = 0; i < 50; i++){ line[i] = 0; } i = 0; while(1){ //AS2_SendChar('w'); if(AS1_RecvChar(&charact) != ERR_RXEMPTY){ if((int)charact == carryReturn) { AS2_SendChar(charact); break; } AS2_SendChar(charact); line[i] = charact; i++; //AS2_SendChar(charact); } } } void readLine2(char line[]){ unsigned char charact; int i = 0; for(i = 0; i < 50; i++){ line[i] = 0; } i = 0; while(1){ if(AS2_RecvChar(&charact) != ERR_RXEMPTY){ if((int)charact == 65) { // A line[i] = charact; break; } line[i] = charact; i++; } } } void initialize(char line[]){ // Asi se hace el reset. AS1_ClearRxBuf(); AS1_SendChar(13); // \r. sendString("RS", 3); delayMS(100); //AS1_ClearRxBuf(); strcat(TC, redRange); strcat(TC, greenRange); strcat(TC, blueRange); } void getMassCenter(char line[]){ AS1_ClearRxBuf(); sendString(TC, 3); //readLine(line); // ACK //readLine(line); // Paquete M. delayMS(100); AS1_SendChar(13); // Detenemos el envio de la camara //readLine(line); // : } // Definicion void setRightPWM(unsigned short porcentaje, bool dir){ unsigned short parametro; parametro = 65535*(porcentaje)/100; PWM1_SetRatio16(parametro); Bit1_PutVal(dir); } void setLeftPWM(unsigned short porcentaje, bool dir){ unsigned short parametro; parametro = (65535*(porcentaje)/100); PWM2_SetRatio16(parametro); Bit2_PutVal(dir); } void Set_PWM(unsigned short porcentaje1, unsigned short porcentaje2, bool dir1, bool dir2){ if(dir1){ setRightPWM(100 - porcentaje1, dir1); } else{ setRightPWM(porcentaje1, dir1); } if(dir2){ setLeftPWM(100 - porcentaje2, dir2); } else{ setLeftPWM(porcentaje2, dir2); } } void setPWM(unsigned short leftPWM, unsigned short rightPWM, unsigned short leftDir, unsigned short rightDir){ if(leftDir == 1){ setLeftPWM(leftPWM, 0); } else { setLeftPWM(100 - leftPWM, 1); } if(rightDir == 1){ setRightPWM(rightPWM, 0); } else { setRightPWM(100 - rightPWM, 1); } } int getMotorData(char line[], unsigned short *leftPWM, unsigned short *rightPWM, unsigned short *leftDir, unsigned short *rightDir){ if((int)line[0] != 70) return 0; motor = asciiToInt(line[1]); direction = asciiToInt(line[2]); pwm = asciiToInt(line[3])*10 + asciiToInt(line[4]); if(motor == 0){ *leftDir = direction; *leftPWM = pwm; } else if (motor == 1){ *rightDir = direction; *rightPWM = pwm; } return 1; }
16.960714
132
0.598231
81c65265759d9dbaffddce3d4772e2c8a2a4cfce
2,039
h
C
include/audiosessiontypes.h
vitorhnn/wine
4c39ad6569552b562fe14d43e6d59650e7f9e5d6
[ "MIT" ]
3
2020-07-21T08:26:19.000Z
2021-05-31T05:26:54.000Z
include/audiosessiontypes.h
vitorhnn/wine
4c39ad6569552b562fe14d43e6d59650e7f9e5d6
[ "MIT" ]
null
null
null
include/audiosessiontypes.h
vitorhnn/wine
4c39ad6569552b562fe14d43e6d59650e7f9e5d6
[ "MIT" ]
1
2020-07-21T08:26:21.000Z
2020-07-21T08:26:21.000Z
/* * Core Audio audio session types definitions * * Copyright 2009 Maarten Lankhorst * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library 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 * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ #ifndef __AUDIOSESSIONTYPES__ #define __AUDIOSESSIONTYPES__ typedef enum _AUDCLNT_SHAREMODE { AUDCLNT_SHAREMODE_SHARED, AUDCLNT_SHAREMODE_EXCLUSIVE, } AUDCLNT_SHAREMODE; #define AUDCLNT_STREAMFLAGS_CROSSPROCESS 0x00010000 #define AUDCLNT_STREAMFLAGS_LOOPBACK 0x00020000 #define AUDCLNT_STREAMFLAGS_EVENTCALLBACK 0x00040000 #define AUDCLNT_STREAMFLAGS_NOPERSIST 0x00080000 #define AUDCLNT_STREAMFLAGS_RATEADJUST 0x00100000 #define AUDCLNT_STREAMFLAGS_SRC_DEFAULT_QUALITY 0x08000000 #define AUDCLNT_SESSIONFLAGS_EXPIREWHENUNOWNED 0x10000000 #define AUDCLNT_SESSIONFLAGS_DISPLAY_HIDE 0x20000000 #define AUDCLNT_SESSIONFLAGS_DISPLAY_HIDEWHENEXPIRED 0x40000000 #define AUDCLNT_STREAMFLAGS_AUTOCONVERTPCM 0x80000000 typedef enum _AudioSessionState { AudioSessionStateInactive = 0, AudioSessionStateActive, AudioSessionStateExpired, } AudioSessionState; typedef enum _AUDIO_STREAM_CATEGORY { AudioCategory_Other = 0, AudioCategory_ForegroundOnlyMedia, AudioCategory_BackgroundCapableMedia, AudioCategory_Communications, AudioCategory_Alerts, AudioCategory_SoundEffects, AudioCategory_GameEffects, AudioCategory_GameMedia } AUDIO_STREAM_CATEGORY; #endif
32.365079
76
0.816086
81ca7c152d43338f5347ebdea233d8166d853c60
12,666
h
C
dev/Code/Tools/SceneAPI/SceneCore/Containers/Views/PairIterator.h
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
1,738
2017-09-21T10:59:12.000Z
2022-03-31T21:05:46.000Z
dev/Code/Tools/SceneAPI/SceneCore/Containers/Views/PairIterator.h
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
427
2017-09-29T22:54:36.000Z
2022-02-15T19:26:50.000Z
dev/Code/Tools/SceneAPI/SceneCore/Containers/Views/PairIterator.h
jeikabu/lumberyard
07228c605ce16cbf5aaa209a94a3cb9d6c1a4115
[ "AML" ]
671
2017-09-21T08:04:01.000Z
2022-03-29T14:30:07.000Z
#pragma once /* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ #include <utility> #include <AzCore/std/utils.h> #include <AzCore/std/typetraits/is_same.h> #include <AzCore/std/typetraits/is_base_of.h> #include <AzCore/std/iterator.h> #include <SceneAPI/SceneCore/Containers/Views/View.h> #include <SceneAPI/SceneCore/Containers/Utilities/ProxyPointer.h> namespace AZ { namespace SceneAPI { namespace Containers { namespace Views { // Merges two iterators together that have a pair relation. // Both iterators must point to the same relative entry and must contain // the same amount of remaining increments (and decrements if appropriate). // If the categories of the given iterators differ the PairIterator // will only support functionality shared between them. The categories // must be implementations of or be related to the categories defined by // the C++ standard. // Example: // vector<string> names; // vector<int> values; // auto view = MakePairView(names.begin(), names.end(), values.begin(), values.end()); // for(auto it : view) // { // printf("%s has value %i\n", it.first.c_str(), it.second); // } namespace Internal { template<typename FirstIterator, typename SecondIterator> struct PairIteratorCategory { static const bool s_sameCategory = AZStd::is_same< typename AZStd::iterator_traits<FirstIterator>::iterator_category, typename AZStd::iterator_traits<SecondIterator>::iterator_category>::value; // True if both categories are the same. // True if FirstIterator has the lower category in the hierarchy // False if ValueItator has the lower category or is unrelated. static const bool s_firstIteratorCategoryIsBaseOfSecondIterator = AZStd::is_base_of< typename AZStd::iterator_traits<FirstIterator>::iterator_category, typename AZStd::iterator_traits<SecondIterator>::iterator_category>::value; // True if both categories are the same. // True if SecondIterator has the lower category in the hierarchy // False if FirstItator has the lower category or is unrelated. static const bool s_SecondIteratorCategoryIsBaseOfFirstIterator = AZStd::is_base_of< typename AZStd::iterator_traits<SecondIterator>::iterator_category, typename AZStd::iterator_traits<FirstIterator>::iterator_category>::value; static_assert(s_sameCategory || (s_firstIteratorCategoryIsBaseOfSecondIterator != s_SecondIteratorCategoryIsBaseOfFirstIterator), "The iterator categories for the first and second in the PairIterator are unrelated categories."); using Category = typename AZStd::conditional<s_firstIteratorCategoryIsBaseOfSecondIterator, typename AZStd::iterator_traits<FirstIterator>::iterator_category, typename AZStd::iterator_traits<SecondIterator>::iterator_category>::type; }; } template<typename FirstIterator, typename SecondIterator, typename Category = typename Internal::PairIteratorCategory<FirstIterator, SecondIterator>::Category> class PairIterator { }; // // Base iterator // template<typename FirstIterator, typename SecondIterator> class PairIterator<FirstIterator, SecondIterator, void> { public: using value_type = AZStd::pair<typename AZStd::iterator_traits<FirstIterator>::value_type, typename AZStd::iterator_traits<SecondIterator>::value_type>; using difference_type = AZStd::ptrdiff_t; using reference = AZStd::pair<typename AZStd::iterator_traits<FirstIterator>::reference, typename AZStd::iterator_traits<SecondIterator>::reference>; using pointer = ProxyPointer<reference>; using iterator_category = typename Internal::PairIteratorCategory<FirstIterator, SecondIterator>::Category; using RootIterator = PairIterator<FirstIterator, SecondIterator, iterator_category>; PairIterator(FirstIterator First, SecondIterator second); PairIterator(const PairIterator&) = default; PairIterator& operator=(const PairIterator&) = default; RootIterator& operator++(); RootIterator operator++(int); const FirstIterator& GetFirstIterator(); const SecondIterator& GetSecondIterator(); protected: FirstIterator m_first; SecondIterator m_second; }; // // Input iterator // template<typename FirstIterator, typename SecondIterator> class PairIterator<FirstIterator, SecondIterator, AZStd::input_iterator_tag> : public PairIterator<FirstIterator, SecondIterator, void> { public: using super = PairIterator<FirstIterator, SecondIterator, void>; PairIterator(FirstIterator first, SecondIterator second); PairIterator(const PairIterator& rhs) = default; bool operator==(const typename super::RootIterator& rhs) const; bool operator!=(const typename super::RootIterator& rhs) const; typename super::reference operator*(); typename super::pointer operator->(); }; // // Forward iterator // template<typename FirstIterator, typename SecondIterator> class PairIterator<FirstIterator, SecondIterator, AZStd::forward_iterator_tag> : public PairIterator<FirstIterator, SecondIterator, AZStd::input_iterator_tag> { public: using super = PairIterator<FirstIterator, SecondIterator, AZStd::input_iterator_tag>; PairIterator(FirstIterator first, SecondIterator second); PairIterator(const PairIterator& rhs) = default; PairIterator(); }; // // Bidirectional iterator // template<typename FirstIterator, typename SecondIterator> class PairIterator<FirstIterator, SecondIterator, AZStd::bidirectional_iterator_tag> : public PairIterator<FirstIterator, SecondIterator, AZStd::forward_iterator_tag> { public: using super = PairIterator<FirstIterator, SecondIterator, AZStd::forward_iterator_tag>; PairIterator(FirstIterator first, SecondIterator second); PairIterator(const PairIterator& rhs) = default; PairIterator(); typename super::RootIterator& operator--(); typename super::RootIterator operator--(int); }; // // Random Access iterator // template<typename FirstIterator, typename SecondIterator> class PairIterator<FirstIterator, SecondIterator, AZStd::random_access_iterator_tag> : public PairIterator<FirstIterator, SecondIterator, AZStd::bidirectional_iterator_tag> { public: using super = PairIterator<FirstIterator, SecondIterator, AZStd::bidirectional_iterator_tag>; PairIterator(FirstIterator first, SecondIterator second); PairIterator(const PairIterator& rhs) = default; PairIterator(); typename super::reference operator[](size_t index); bool operator<(const typename super::RootIterator& rhs) const; bool operator>(const typename super::RootIterator& rhs) const; bool operator<=(const typename super::RootIterator& rhs) const; bool operator>=(const typename super::RootIterator& rhs) const; typename super::RootIterator operator+(size_t n) const; typename super::RootIterator operator-(size_t n) const; typename super::difference_type operator-(const typename super::RootIterator& rhs) const; typename super::RootIterator& operator+=(size_t n); typename super::RootIterator& operator-=(size_t n); }; // // Continuous Random Access iterator // template<typename FirstIterator, typename SecondIterator> class PairIterator<FirstIterator, SecondIterator, AZStd::continuous_random_access_iterator_tag> : public PairIterator<FirstIterator, SecondIterator, AZStd::random_access_iterator_tag> { public: using super = PairIterator<FirstIterator, SecondIterator, AZStd::random_access_iterator_tag>; PairIterator(FirstIterator first, SecondIterator second); PairIterator(const PairIterator& rhs) = default; PairIterator(); }; // // Utility functions // template<typename FirstIterator, typename SecondIterator> PairIterator<FirstIterator, SecondIterator> MakePairIterator(FirstIterator first, SecondIterator second); template<typename FirstIterator, typename SecondIterator> View<PairIterator<FirstIterator, SecondIterator>> MakePairView(FirstIterator firstBegin, FirstIterator firstEnd, SecondIterator secondBegin, SecondIterator secondEnd); template<typename FirstView, typename SecondView> View<PairIterator<typename FirstView::iterator, typename SecondView::iterator>> MakePairView(FirstView& firstView, SecondView& secondView); template<typename FirstView, typename SecondView> View<PairIterator<typename FirstView::const_iterator, typename SecondView::iterator>> MakePairView(const FirstView& firstView, SecondView& secondView); template<typename FirstView, typename SecondView> View<PairIterator<typename FirstView::iterator, typename SecondView::const_iterator>> MakePairView(FirstView& firstView, const SecondView& secondView); template<typename FirstView, typename SecondView> View<PairIterator<typename FirstView::const_iterator, typename SecondView::const_iterator>> MakePairView(const FirstView& firstView, const SecondView& secondView); } // Views } // Containers } // SceneAPI } // AZ namespace AZStd { // iterator swap template<typename First, typename Second> void iter_swap(AZ::SceneAPI::Containers::Views::PairIterator<First, Second> lhs, AZ::SceneAPI::Containers::Views::PairIterator<First, Second> rhs); } #include <SceneAPI/SceneCore/Containers/Views/PairIterator.inl>
50.86747
172
0.593558
dcc8732b4c95474762ae045cab4613d14fd91e45
152
h
C
src/char_filter.h
davidjulien/ouroboros
834f70487fbc1d7538998247037ba6ae2eff4dab
[ "BSD-3-Clause" ]
1
2016-01-15T21:16:37.000Z
2016-01-15T21:16:37.000Z
src/char_filter.h
davidjulien/ouroboros
834f70487fbc1d7538998247037ba6ae2eff4dab
[ "BSD-3-Clause" ]
null
null
null
src/char_filter.h
davidjulien/ouroboros
834f70487fbc1d7538998247037ba6ae2eff4dab
[ "BSD-3-Clause" ]
null
null
null
int islatin1(int c); int everything(int c); int islatin1_or_space(int c); unsigned char stable_transform(int c); unsigned char latin1_to_ascii(int c);
21.714286
38
0.782895
986831790ea3d4d4721dbc87bc0e865281094ded
294
h
C
perceptron/sample_1/inc/func.h
a2gs/AI
b75d0e85f06999c4591bf07eaaf2593d72b43024
[ "MIT" ]
null
null
null
perceptron/sample_1/inc/func.h
a2gs/AI
b75d0e85f06999c4591bf07eaaf2593d72b43024
[ "MIT" ]
null
null
null
perceptron/sample_1/inc/func.h
a2gs/AI
b75d0e85f06999c4591bf07eaaf2593d72b43024
[ "MIT" ]
null
null
null
#ifndef __AI_FUNC__ #define __AI_FUNC__ float weight(float prevWeight, float learningRate, float error, float input); float activationFunction(float weights[], unsigned int wLen); float deltaErrorCorrection(float prevError, float desired); float TransferFunction_BinaryStep(float af); #endif
29.4
77
0.823129
54b5d539ae31e1fa32c2913f164dbcd3a0f5f10f
601
h
C
src/Game.h
artegful/Voxel-Space-Rendering
17f8fb5a755e97654bd3a4f83e0397ecae35b4cf
[ "MIT" ]
null
null
null
src/Game.h
artegful/Voxel-Space-Rendering
17f8fb5a755e97654bd3a4f83e0397ecae35b4cf
[ "MIT" ]
null
null
null
src/Game.h
artegful/Voxel-Space-Rendering
17f8fb5a755e97654bd3a4f83e0397ecae35b4cf
[ "MIT" ]
null
null
null
#pragma once #include "entt.hpp" #include "Systems/RendererSystem.h" #include "Systems/ControllerSystem.h" namespace Voxel { class Game { public: explicit Game(); void Update(); bool IsRunning() { return renderer.IsOpen(); } private: entt::registry registry; sf::Clock deltaClock; Systems::RendererSystem renderer; Systems::ControllerSystem controller; void ProcessInput(); void PopulateEntities(); float CalculateDeltaTime(); float WaitForTargetFpsIfNeeded(float deltaTime); }; }
21.464286
56
0.625624
54e382e8ddfedcafb2e390a1476cec36c8f7a38e
7,841
h
C
mt-drivers/mt7603e/src/mt7603_wifi/include/mac/mac_ral/omac/ral_omac_pci.h
bearking1069/openwrt-packages
eb78e080d5e3a022aa5a3acaff492283306cfc6b
[ "Apache-2.0" ]
4
2020-12-30T12:46:48.000Z
2021-01-04T08:28:13.000Z
mt-drivers/mt7603e/src/mt7603_wifi/include/mac/mac_ral/omac/ral_omac_pci.h
bearking1069/openwrt-packages
eb78e080d5e3a022aa5a3acaff492283306cfc6b
[ "Apache-2.0" ]
null
null
null
mt-drivers/mt7603e/src/mt7603_wifi/include/mac/mac_ral/omac/ral_omac_pci.h
bearking1069/openwrt-packages
eb78e080d5e3a022aa5a3acaff492283306cfc6b
[ "Apache-2.0" ]
1
2021-11-20T13:44:32.000Z
2021-11-20T13:44:32.000Z
/**************************************************************************** * Ralink Tech Inc. * 4F, No. 2 Technology 5th Rd. * Science-based Industrial Park * Hsin-chu, Taiwan, R.O.C. * (c) Copyright 2002, Ralink Technology, Inc. * * All rights reserved. Ralink's source code is an unpublished work and the * use of a copyright notice does not imply otherwise. This source code * contains confidential trade secret material of Ralink Tech. Any attemp * or participation in deciphering, decoding, reverse engineering or in any * way altering the source code is stricitly prohibited, unless the prior * written consent of Ralink Technology, Inc. is obtained. **************************************************************************** Module Name: ral_omac_pci.h Abstract: Revision History: Who When What --------- ---------- ---------------------------------------------- */ #ifndef __RAL_OMAC_PCI_H__ #define __RAL_OMAC_PCI_H__ #define RTMP_INT_RX_DLY (1<<0) /* bit 0 */ #define RTMP_INT_TX_DLY (1<<1) /* bit 1 */ #define RTMP_INT_RX_DONE (1<<2) /* bit 2 */ #define RTMP_INT_AC0_DMA_DONE (1<<3) /* bit 3 */ #define RTMP_INT_AC1_DMA_DONE (1<<4) /* bit 4 */ #define RTMP_INT_AC2_DMA_DONE (1<<5) /* bit 5 */ #define RTMP_INT_AC3_DMA_DONE (1<<6) /* bit 6 */ #define RTMP_INT_HCCA_DMA_DONE (1<<7) /* bit 7 */ #define RTMP_INT_MGMT_DONE (1<<8) /* bit 8 */ #define RTMP_INT_MCU_CMD (1<<9) #define RTMP_INT_ANY_COHERENT (1<<10) #define RTMP_INT_TBTT (1<<11) #define RTMP_INT_PRE_TBTT (1<<12) #define RTMP_INT_FIFO_STAT (1<<13) #define RTMP_INT_AUTO_WAKEUP (1<<14) #define RTMP_INT_GPIO_TIMER (1<<15) #define RTMP_INT_RX_COHERENT (1<<16) #define RTMP_INT_TX_COHERENT (1<<17) #define RTMP_INT_TONE_RADAR (1<<20) /* bit 20 */ #define RTMP_RxINT (RTMP_INT_RX_DLY | RTMP_INT_RX_DONE) /* 0x00000005 */ /* Delayed Rx or indivi rx */ #define RTMP_TxDataInt (RTMP_INT_TX_DLY |\ RTMP_INT_AC0_DMA_DONE | \ RTMP_INT_AC1_DMA_DONE | \ RTMP_INT_AC2_DMA_DONE | \ RTMP_INT_AC3_DMA_DONE | \ RTMP_INT_HCCA_DMA_DONE) /* 0x000000fa */ /* Delayed Tx or indivi tx */ #define RTMP_TxMgmtInt (RTMP_INT_TX_DLY | RTMP_INT_MGMT_DONE) /* 0x00000102 */ /* Delayed Tx or indivi tx */ #define RTMP_TxCoherent (RTMP_INT_TX_COHERENT) /* 0x00020000 */ /* tx coherent */ #define RTMP_RxCoherent (RTMP_INT_RX_COHERENT) /* 0x00010000 */ /* rx coherent */ #define RTMP_TxRxCoherent (RTMP_INT_ANY_COHERENT) /* 0x00000400 */ /* tx rx coherent */ #define RTMP_McuCommand (RTMP_INT_MCU_CMD) /* 0x00000200 */ /* mcu */ #define RTMP_PreTBTTInt (RTMP_INT_PRE_TBTT) /* 0x00001000 */ /* Pre-TBTT interrupt */ #define RTMP_TBTTInt (RTMP_INT_TBTT) /* 0x00000800 */ /* TBTT interrupt */ #define RTMP_GPTimeOutInt (RTMP_INT_GPIO_TIMER) /* 0x00008000 */ /* GPtimeout interrupt */ #define RTMP_AutoWakeupInt (RTMP_INT_AUTO_WAKEUP) /* 0x00004000 */ /* AutoWakeupInt interrupt */ #define RTMP_FifoStaFullInt (RTMP_INT_FIFO_STAT) /* 0x00002000 */ /* fifo statistics full interrupt */ #define RTMP_RadarInt (RTMP_INT_TONE_RADAR) /* 0x00100000 */ #define RTMP_INT_RX RTMP_INT_RX_DONE #define RTMP_INT_AC0_DLY (RTMP_INT_AC0_DMA_DONE) /*| RTMP_INT_TX_DLY) */ #define RTMP_INT_AC1_DLY (RTMP_INT_AC1_DMA_DONE) /*| RTMP_INT_TX_DLY) */ #define RTMP_INT_AC2_DLY (RTMP_INT_AC2_DMA_DONE) /*| RTMP_INT_TX_DLY) */ #define RTMP_INT_AC3_DLY (RTMP_INT_AC3_DMA_DONE) /*| RTMP_INT_TX_DLY) */ #define RTMP_INT_HCCA_DLY (RTMP_INT_HCCA_DMA_DONE) /*| RTMP_INT_TX_DLY) */ #define RTMP_INT_MGMT_DLY (RTMP_INT_MGMT_DONE) #ifdef CARRIER_DETECTION_SUPPORT #define RTMP_DELAYINTMASK (0x0003FFFB | (RTMP_RadarInt)) #define RTMP_INTMASK (0x0003FFFB | (RTMP_RadarInt)) #else #define RTMP_DELAYINTMASK 0x0003FFFB #define RTMP_INTMASK 0x0003FFFB #endif /* CARRIER_DETECTION_SUPPORT */ /* INT_SOURCE_CSR: Interrupt source register. Write one to clear corresponding bit Refer to INT_SOURCE_CSR(0x200) */ #ifdef RT_BIG_ENDIAN typedef union _RTMP_INT_SOURCE_CSR_STRUC { struct { UINT32 rsv21:11; UINT32 RadarINT:1; UINT32 rsv18:2; UINT32 TxCoherent:1; UINT32 RxCoherent:1; UINT32 GPTimer:1; UINT32 AutoWakeup:1;/*bit14 */ UINT32 TXFifoStatusInt:1;/*FIFO Statistics is full, sw should read 0x171c */ UINT32 PreTBTT:1; UINT32 TBTTInt:1; UINT32 RxTxCoherent:1; UINT32 MCUCommandINT:1; UINT32 MgmtDmaDone:1; UINT32 HccaDmaDone:1; UINT32 Ac3DmaDone:1; UINT32 Ac2DmaDone:1; UINT32 Ac1DmaDone:1; UINT32 Ac0DmaDone:1; UINT32 RxDone:1; UINT32 TxDelayINT:1; /*delayed interrupt, not interrupt until several int or time limit hit */ UINT32 RxDelayINT:1; /*dealyed interrupt */ } field; UINT32 word; } RTMP_INT_SOURCE_CSR_STRUC; #else typedef union _RTMP_INT_SOURCE_CSR_STRUC { struct { UINT32 RxDelayINT:1; UINT32 TxDelayINT:1; UINT32 RxDone:1; UINT32 Ac0DmaDone:1;/*4 */ UINT32 Ac1DmaDone:1; UINT32 Ac2DmaDone:1; UINT32 Ac3DmaDone:1; UINT32 HccaDmaDone:1; /* bit7 */ UINT32 MgmtDmaDone:1; UINT32 MCUCommandINT:1;/*bit 9 */ UINT32 RxTxCoherent:1; UINT32 TBTTInt:1; UINT32 PreTBTT:1; UINT32 TXFifoStatusInt:1;/*FIFO Statistics is full, sw should read 0x171c */ UINT32 AutoWakeup:1;/*bit14 */ UINT32 GPTimer:1; UINT32 RxCoherent:1;/*bit16 */ UINT32 TxCoherent:1; UINT32 rsv18:2; UINT32 RadarINT:1; UINT32 rsv21:11; } field; UINT32 word; } RTMP_INT_SOURCE_CSR_STRUC; #endif /* INT_MASK_CSR: Interrupt MASK register. 1: the interrupt is mask OFF Refer to INT_MASK_CSR(0x204) */ #ifdef RT_BIG_ENDIAN typedef union _INT_MASK_CSR_STRUC { struct { UINT32 TxCoherent:1; UINT32 RxCoherent:1; UINT32 :9; UINT32 RadarINT:1; UINT32 rsv:10; UINT32 MCUCommandINT:1; UINT32 MgmtDmaDone:1; UINT32 HccaDmaDone:1; UINT32 Ac3DmaDone:1; UINT32 Ac2DmaDone:1; UINT32 Ac1DmaDone:1; UINT32 Ac0DmaDone:1; UINT32 RxDone:1; UINT32 TxDelay:1; UINT32 RXDelay_INT_MSK:1; } field; UINT32 word; }INT_MASK_CSR_STRUC; #else typedef union _INT_MASK_CSR_STRUC { struct { UINT32 RXDelay_INT_MSK:1; UINT32 TxDelay:1; UINT32 RxDone:1; UINT32 Ac0DmaDone:1; UINT32 Ac1DmaDone:1; UINT32 Ac2DmaDone:1; UINT32 Ac3DmaDone:1; UINT32 HccaDmaDone:1; UINT32 MgmtDmaDone:1; UINT32 MCUCommandINT:1; UINT32 rsv:10; UINT32 RadarINT:1; UINT32 :9; UINT32 RxCoherent:1; UINT32 TxCoherent:1; } field; UINT32 word; } INT_MASK_CSR_STRUC; #endif #define RINGREG_DIFF 0x10 #define TX_BASE_PTR0 0x0230 /*AC_BK base address */ #define TX_MAX_CNT0 0x0234 #define TX_CTX_IDX0 0x0238 #define TX_DTX_IDX0 0x023c #define TX_BASE_PTR1 0x0240 /*AC_BE base address */ #define TX_MAX_CNT1 0x0244 #define TX_CTX_IDX1 0x0248 #define TX_DTX_IDX1 0x024c #define TX_BASE_PTR2 0x0250 /*AC_VI base address */ #define TX_MAX_CNT2 0x0254 #define TX_CTX_IDX2 0x0258 #define TX_DTX_IDX2 0x025c #define TX_BASE_PTR3 0x0260 /*AC_VO base address */ #define TX_MAX_CNT3 0x0264 #define TX_CTX_IDX3 0x0268 #define TX_DTX_IDX3 0x026c #define TX_BASE_PTR4 0x0270 /*HCCA base address */ #define TX_MAX_CNT4 0x0274 #define TX_CTX_IDX4 0x0278 #define TX_DTX_IDX4 0x027c #define TX_BASE_PTR5 0x0280 /*MGMT base address */ #define TX_MAX_CNT5 0x0284 #define TX_CTX_IDX5 0x0288 #define TX_DTX_IDX5 0x028c #define TX_MGMTMAX_CNT TX_MAX_CNT5 #define TX_MGMTCTX_IDX TX_CTX_IDX5 #define TX_MGMTDTX_IDX TX_DTX_IDX5 #define RX_BASE_PTR 0x0290 /*RX base address */ #define RX_MAX_CNT 0x0294 #define RX_CRX_IDX 0x0298 #define RX_DRX_IDX 0x029c #endif /*__RAL_OMAC_PCI_H__ */
33.508547
110
0.690473
60d4be2cb783edf5aa9fcd812405a872808577b0
442
c
C
acsl/libraries/libc/test/math/power/test_powl.c
davidcok/annotationsforall
16024a9ffecdb72b638e1f942c567f8815183e89
[ "Apache-2.0" ]
4
2016-06-16T21:03:57.000Z
2021-02-06T10:20:14.000Z
acsl/libraries/libc/test/math/power/test_powl.c
davidcok/annotationsforall
16024a9ffecdb72b638e1f942c567f8815183e89
[ "Apache-2.0" ]
null
null
null
acsl/libraries/libc/test/math/power/test_powl.c
davidcok/annotationsforall
16024a9ffecdb72b638e1f942c567f8815183e89
[ "Apache-2.0" ]
1
2021-06-09T07:00:34.000Z
2021-06-09T07:00:34.000Z
#include "../../../test_common.h" #include <math.h> #include <float.h> #include <errno.h> void runSuccess() { powl(5.0L,6.0L); powl(1.2L,6.7L); powl(0.0L,2.0L); powl(4.45L,0.0L); powl(anylongdouble(),anylongdouble()); } void runFailure() { } int f; void testValues() { f = 2; long double result; powl(anylongdouble(),anylongdouble()); //@ assert f == 2; //@ assert vacuous: \false; }
15.785714
42
0.561086
8e7a3c93b416ffeef4b9e953df5b994f9c99a063
54,653
c
C
testsuite/EXP_3/test462.c
ishiura-compiler/CF3
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
[ "MIT" ]
34
2017-07-04T14:16:12.000Z
2021-04-22T21:04:43.000Z
testsuite/EXP_3/test462.c
ishiura-compiler/CF3
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
[ "MIT" ]
1
2017-07-06T03:43:44.000Z
2017-07-06T03:43:44.000Z
testsuite/EXP_3/test462.c
ishiura-compiler/CF3
0718aa176d0303a4ea8a46bd6c794997cbb8fabb
[ "MIT" ]
6
2017-07-04T16:30:42.000Z
2019-10-16T05:37:29.000Z
/* CF3 Copyright (c) 2015 ishiura-lab. Released under the MIT license. https://github.com/ishiura-compiler/CF3/MIT-LICENSE.md */ #include<stdio.h> #include<stdint.h> #include<stdlib.h> #include"test1.h" static volatile uint32_t t0 = 3489U; static int8_t x10 = -9; int8_t x12 = -1; static int64_t x13 = INT64_MIN; uint8_t x15 = UINT8_MAX; int8_t x30 = -1; uint32_t t5 = 3346880U; int8_t x35 = INT8_MIN; int8_t x36 = 27; volatile int64_t t6 = -65010116946LL; static uint8_t x49 = 56U; volatile uint64_t t10 = 49LLU; uint32_t x62 = 38U; volatile int8_t x70 = INT8_MIN; static int64_t t13 = -3446LL; uint32_t x77 = 6391276U; int8_t x86 = -34; uint8_t x87 = 2U; static int16_t x100 = -1; static int64_t x101 = INT64_MIN; int16_t x102 = INT16_MAX; static int64_t x109 = -186LL; volatile uint64_t x111 = 383931LLU; uint8_t x112 = 38U; volatile uint32_t t25 = 1446U; uint16_t x131 = UINT16_MAX; int64_t t26 = 398158LL; volatile int16_t x135 = -1; volatile uint64_t t27 = 1817LLU; volatile uint64_t x139 = 1638298423601LLU; int16_t x140 = INT16_MAX; int64_t x149 = INT64_MAX; int64_t x151 = -6LL; int8_t x153 = INT8_MAX; int8_t x155 = 1; static int32_t x160 = -183319428; static volatile int64_t t33 = -26542174LL; int8_t x183 = INT8_MAX; volatile uint64_t t40 = 2233561996LLU; static uint8_t x191 = 37U; int32_t x194 = 133080910; volatile uint64_t t42 = 8343729LLU; int16_t x205 = INT16_MIN; uint16_t x209 = UINT16_MAX; volatile int16_t x241 = INT16_MIN; volatile int8_t x242 = -1; volatile int16_t x243 = INT16_MAX; int16_t x244 = INT16_MAX; uint32_t x245 = UINT32_MAX; volatile int16_t x250 = 1; int64_t x257 = -281242940440722LL; static uint64_t x260 = UINT64_MAX; int16_t x265 = -1; int8_t x271 = INT8_MIN; static int32_t x277 = 8714; int64_t x281 = -173LL; uint32_t x282 = UINT32_MAX; uint64_t x289 = 733107389302842LLU; volatile int16_t x298 = INT16_MAX; uint16_t x306 = 2U; volatile int32_t t63 = -1; uint32_t x322 = 1U; volatile int8_t x332 = -2; uint64_t t66 = 704046LLU; volatile uint8_t x341 = UINT8_MAX; static volatile int16_t x346 = INT16_MAX; int64_t x347 = -1LL; int16_t x351 = -15; uint32_t x363 = 3U; int64_t t71 = -6867LL; int32_t x365 = INT32_MAX; static volatile int16_t x369 = INT16_MIN; uint64_t t73 = 114729LLU; int8_t x373 = -1; uint8_t x375 = 123U; int64_t x390 = INT64_MIN; volatile int64_t x392 = 116611876900104LL; static volatile int32_t x398 = INT32_MIN; static uint32_t x405 = UINT32_MAX; uint32_t x411 = UINT32_MAX; static int16_t x412 = -1; static int32_t x415 = -3659; int16_t x419 = -1; uint8_t x423 = UINT8_MAX; int32_t t82 = 142536; volatile int8_t x431 = INT8_MIN; int16_t x441 = INT16_MAX; int32_t x442 = -1; static int32_t x443 = INT32_MAX; uint16_t x445 = 22396U; volatile int32_t t85 = 597; uint32_t x453 = 40U; uint64_t x465 = 1765869LLU; static uint16_t x475 = 20348U; static int32_t x478 = INT32_MIN; int8_t x489 = 5; volatile int8_t x495 = INT8_MIN; volatile int16_t x517 = 1146; static int32_t x523 = 15585; int32_t t100 = -1030800280; uint16_t x529 = UINT16_MAX; int64_t x530 = -3923025573LL; uint16_t x534 = 47U; static volatile uint8_t x540 = 13U; uint32_t x541 = 7906930U; static volatile uint16_t x545 = UINT16_MAX; static volatile uint64_t t105 = 53884476826360LLU; int16_t x552 = -1232; uint16_t x553 = 7U; int64_t x556 = -1LL; int32_t x561 = INT32_MIN; int64_t x576 = 0LL; volatile int64_t t111 = 3303793103681432LL; uint32_t x582 = 73467667U; volatile uint64_t t113 = 1934218694LLU; uint64_t t114 = 39LLU; static volatile int64_t x602 = 20251891152135278LL; int8_t x605 = -13; uint8_t x607 = 2U; static uint16_t x610 = UINT16_MAX; int32_t x611 = INT32_MIN; static volatile uint64_t t117 = 1LLU; uint8_t x615 = 1U; int16_t x628 = INT16_MIN; static volatile int32_t t120 = 9988; int16_t x632 = INT16_MIN; int16_t x644 = INT16_MIN; static volatile uint8_t x653 = 3U; int64_t x656 = -1LL; static uint16_t x669 = 194U; volatile int16_t x678 = INT16_MIN; static int64_t t129 = -20658559LL; int16_t x687 = INT16_MIN; int64_t x690 = 932772836LL; volatile uint32_t t132 = 63584U; int64_t x701 = INT64_MAX; int8_t x702 = -1; volatile int64_t t133 = 6420662308963515LL; static int16_t x709 = -1; volatile int32_t t135 = -62487; volatile int16_t x716 = INT16_MIN; volatile int32_t t136 = 6361571; int64_t x721 = INT64_MIN; volatile int8_t x723 = INT8_MAX; int16_t x725 = -1; int8_t x728 = INT8_MIN; static int8_t x737 = INT8_MIN; static uint64_t x740 = 58673360795933987LLU; static int8_t x752 = -1; volatile uint64_t t142 = 26703985LLU; int16_t x756 = INT16_MIN; volatile int32_t t143 = -652337836; uint8_t x765 = 0U; int8_t x776 = 2; int16_t x784 = -1; int32_t t148 = -163806619; uint32_t x786 = 39528558U; int64_t x790 = INT64_MIN; volatile uint16_t x791 = 2108U; volatile int32_t x794 = INT32_MIN; uint8_t x798 = UINT8_MAX; int16_t x799 = -1027; uint16_t x815 = 750U; int8_t x825 = 0; uint8_t x854 = 1U; int32_t x858 = INT32_MIN; int8_t x859 = INT8_MAX; volatile int64_t x865 = INT64_MIN; uint16_t x866 = 6644U; uint8_t x868 = 21U; int16_t x871 = INT16_MIN; int8_t x872 = -1; volatile int64_t t165 = 34317LL; volatile uint16_t x873 = 12U; volatile int16_t x875 = INT16_MIN; uint16_t x884 = UINT16_MAX; uint8_t x888 = 51U; static uint64_t t169 = 158030LLU; uint64_t x896 = 8011LLU; static int16_t x902 = INT16_MIN; static int8_t x904 = INT8_MIN; int64_t x914 = INT64_MAX; uint16_t x915 = 0U; int64_t x918 = -1LL; int8_t x925 = INT8_MAX; uint16_t x958 = 208U; volatile int16_t x960 = INT16_MIN; int32_t x961 = -1; volatile int64_t t182 = 495397321514047LL; volatile int32_t x977 = -1; volatile uint8_t x981 = 6U; volatile uint8_t x982 = 2U; static int8_t x995 = INT8_MIN; static volatile int64_t x1000 = INT64_MAX; static uint64_t x1011 = 1606136620715248LLU; int32_t x1020 = INT32_MIN; static uint32_t t191 = 43674U; uint64_t x1021 = 180261126990LLU; volatile int8_t x1024 = -1; volatile uint32_t x1036 = UINT32_MAX; volatile uint32_t t193 = 4U; uint16_t x1037 = 10U; volatile int32_t t194 = 55492; volatile int64_t t195 = -4784LL; uint8_t x1045 = 5U; int8_t x1052 = -29; static int64_t x1057 = INT64_MIN; void f0(void) { int32_t x1 = 3622666; volatile uint32_t x2 = 765367U; int16_t x3 = INT16_MIN; static int16_t x4 = INT16_MIN; t0 = ((x1%x2)^(x3*x4)); if (t0 != 1074303022U) { NG(); } else { ; } } void f1(void) { int64_t x9 = -1906973001LL; static uint32_t x11 = 4459U; int64_t t1 = 12760887012096366LL; t1 = ((x9%x10)^(x11*x12)); if (t1 != 4294962837LL) { NG(); } else { ; } } void f2(void) { uint16_t x14 = UINT16_MAX; volatile int16_t x16 = INT16_MIN; volatile int64_t t2 = 115142736835LL; t2 = ((x13%x14)^(x15*x16)); if (t2 != 8323072LL) { NG(); } else { ; } } void f3(void) { volatile int16_t x21 = INT16_MAX; int32_t x22 = INT32_MIN; static uint8_t x23 = UINT8_MAX; volatile uint8_t x24 = 1U; volatile int32_t t3 = -64149; t3 = ((x21%x22)^(x23*x24)); if (t3 != 32512) { NG(); } else { ; } } void f4(void) { uint16_t x25 = 384U; static int64_t x26 = INT64_MAX; int64_t x27 = -561463940LL; int32_t x28 = INT32_MIN; volatile int64_t t4 = 601466LL; t4 = ((x25%x26)^(x27*x28)); if (t4 != 1205734630091653504LL) { NG(); } else { ; } } void f5(void) { int16_t x29 = 542; int32_t x31 = INT32_MAX; uint32_t x32 = 92807U; t5 = ((x29%x30)^(x31*x32)); if (t5 != 2147390841U) { NG(); } else { ; } } void f6(void) { int64_t x33 = -1LL; static uint8_t x34 = 94U; t6 = ((x33%x34)^(x35*x36)); if (t6 != 3455LL) { NG(); } else { ; } } void f7(void) { int16_t x37 = INT16_MIN; volatile uint8_t x38 = UINT8_MAX; uint32_t x39 = 4131299U; int16_t x40 = INT16_MIN; static volatile uint32_t t7 = 26493005U; t7 = ((x37%x38)^(x39*x40)); if (t7 != 2230419328U) { NG(); } else { ; } } void f8(void) { static uint32_t x45 = UINT32_MAX; int32_t x46 = INT32_MAX; uint16_t x47 = 0U; uint8_t x48 = UINT8_MAX; volatile uint32_t t8 = 116U; t8 = ((x45%x46)^(x47*x48)); if (t8 != 1U) { NG(); } else { ; } } void f9(void) { int32_t x50 = INT32_MIN; volatile int16_t x51 = INT16_MAX; uint64_t x52 = 1614816043937775421LLU; volatile uint64_t t9 = 331720641LLU; t9 = ((x49%x50)^(x51*x52)); if (t9 != 7415308310093185275LLU) { NG(); } else { ; } } void f10(void) { int64_t x53 = INT64_MIN; volatile int16_t x54 = 10; uint64_t x55 = 19709965396LLU; static volatile int64_t x56 = -1LL; t10 = ((x53%x54)^(x55*x56)); if (t10 != 19709965396LLU) { NG(); } else { ; } } void f11(void) { int8_t x57 = -6; uint8_t x58 = UINT8_MAX; int32_t x59 = -1; volatile uint64_t x60 = 48LLU; uint64_t t11 = 27LLU; t11 = ((x57%x58)^(x59*x60)); if (t11 != 42LLU) { NG(); } else { ; } } void f12(void) { uint64_t x61 = 38336769426440LLU; uint32_t x63 = UINT32_MAX; uint64_t x64 = 7453916960925712LLU; uint64_t t12 = 16686905271LLU; t12 = ((x61%x62)^(x63*x64)); if (t12 != 5226898799135021054LLU) { NG(); } else { ; } } void f13(void) { volatile int32_t x69 = -1; int64_t x71 = -28981761158570LL; static uint16_t x72 = 29U; t13 = ((x69%x70)^(x71*x72)); if (t13 != 840471073598529LL) { NG(); } else { ; } } void f14(void) { volatile int64_t x73 = -28952678973LL; volatile int64_t x74 = -1LL; uint16_t x75 = 23U; int16_t x76 = INT16_MIN; int64_t t14 = -1104118280296LL; t14 = ((x73%x74)^(x75*x76)); if (t14 != -753664LL) { NG(); } else { ; } } void f15(void) { int64_t x78 = INT64_MAX; uint8_t x79 = 22U; volatile int64_t x80 = -1LL; int64_t t15 = -16804255193548LL; t15 = ((x77%x78)^(x79*x80)); if (t15 != -6391290LL) { NG(); } else { ; } } void f16(void) { uint16_t x85 = UINT16_MAX; int16_t x88 = 0; int32_t t16 = -10119144; t16 = ((x85%x86)^(x87*x88)); if (t16 != 17) { NG(); } else { ; } } void f17(void) { int16_t x89 = INT16_MIN; int64_t x90 = INT64_MIN; volatile int16_t x91 = INT16_MIN; int8_t x92 = -1; static int64_t t17 = -2355LL; t17 = ((x89%x90)^(x91*x92)); if (t17 != -65536LL) { NG(); } else { ; } } void f18(void) { static uint32_t x97 = 224375629U; static volatile int16_t x98 = 1; static volatile uint64_t x99 = 224032LLU; volatile uint64_t t18 = 1784382629985686370LLU; t18 = ((x97%x98)^(x99*x100)); if (t18 != 18446744073709327584LLU) { NG(); } else { ; } } void f19(void) { volatile int16_t x103 = 1; uint32_t x104 = UINT32_MAX; int64_t t19 = 1LL; t19 = ((x101%x102)^(x103*x104)); if (t19 != -4294967289LL) { NG(); } else { ; } } void f20(void) { volatile int8_t x105 = INT8_MAX; int32_t x106 = 473108068; volatile uint64_t x107 = 26461698083LLU; uint8_t x108 = 10U; volatile uint64_t t20 = 2962127883058LLU; t20 = ((x105%x106)^(x107*x108)); if (t20 != 264616980769LLU) { NG(); } else { ; } } void f21(void) { volatile int16_t x110 = INT16_MIN; static volatile uint64_t t21 = 0LLU; t21 = ((x109%x110)^(x111*x112)); if (t21 != 18446744073694962308LLU) { NG(); } else { ; } } void f22(void) { uint16_t x113 = UINT16_MAX; volatile uint16_t x114 = 2U; int64_t x115 = INT64_MAX; int32_t x116 = -1; static int64_t t22 = INT64_MIN; t22 = ((x113%x114)^(x115*x116)); if (t22 != INT64_MIN) { NG(); } else { ; } } void f23(void) { int64_t x117 = INT64_MIN; int64_t x118 = 239073LL; volatile int64_t x119 = INT64_MIN; uint64_t x120 = 932509134412LLU; volatile uint64_t t23 = 124200457788LLU; t23 = ((x117%x118)^(x119*x120)); if (t23 != 18446744073709367336LLU) { NG(); } else { ; } } void f24(void) { uint8_t x121 = 0U; uint32_t x122 = 73256U; uint64_t x123 = UINT64_MAX; uint16_t x124 = 135U; volatile uint64_t t24 = 6LLU; t24 = ((x121%x122)^(x123*x124)); if (t24 != 18446744073709551481LLU) { NG(); } else { ; } } void f25(void) { int16_t x125 = INT16_MIN; volatile int32_t x126 = -1; uint32_t x127 = 2U; volatile uint8_t x128 = 2U; t25 = ((x125%x126)^(x127*x128)); if (t25 != 4U) { NG(); } else { ; } } void f26(void) { volatile int64_t x129 = INT64_MIN; int32_t x130 = INT32_MIN; int64_t x132 = -159359844LL; t26 = ((x129%x130)^(x131*x132)); if (t26 != -10443647376540LL) { NG(); } else { ; } } void f27(void) { int8_t x133 = -14; uint64_t x134 = UINT64_MAX; int16_t x136 = INT16_MIN; t27 = ((x133%x134)^(x135*x136)); if (t27 != 18446744073709518834LLU) { NG(); } else { ; } } void f28(void) { uint32_t x137 = 98974705U; int32_t x138 = INT32_MIN; uint64_t t28 = 80351189LLU; t28 = ((x137%x138)^(x139*x140)); if (t28 != 53682124397499710LLU) { NG(); } else { ; } } void f29(void) { static uint16_t x141 = UINT16_MAX; int32_t x142 = INT32_MAX; uint64_t x143 = UINT64_MAX; uint32_t x144 = 15730312U; volatile uint64_t t29 = 8LLU; t29 = ((x141%x142)^(x143*x144)); if (t29 != 18446744073693759111LLU) { NG(); } else { ; } } void f30(void) { int8_t x145 = -1; int64_t x146 = -117867758709690LL; int16_t x147 = 2008; volatile int8_t x148 = INT8_MIN; volatile int64_t t30 = -11110353LL; t30 = ((x145%x146)^(x147*x148)); if (t30 != 257023LL) { NG(); } else { ; } } void f31(void) { int64_t x150 = INT64_MIN; volatile int32_t x152 = -2178; static int64_t t31 = 960309296LL; t31 = ((x149%x150)^(x151*x152)); if (t31 != 9223372036854762739LL) { NG(); } else { ; } } void f32(void) { int8_t x154 = -1; int16_t x156 = 3199; int32_t t32 = 9; t32 = ((x153%x154)^(x155*x156)); if (t32 != 3199) { NG(); } else { ; } } void f33(void) { static int64_t x157 = INT64_MIN; int32_t x158 = -1; volatile uint32_t x159 = 17U; t33 = ((x157%x158)^(x159*x160)); if (t33 != 1178537020LL) { NG(); } else { ; } } void f34(void) { uint16_t x161 = 314U; volatile uint16_t x162 = 41U; int16_t x163 = -1007; uint16_t x164 = 5798U; static int32_t t34 = -68469; t34 = ((x161%x162)^(x163*x164)); if (t34 != -5838563) { NG(); } else { ; } } void f35(void) { static int16_t x165 = -1; int16_t x166 = 12; uint64_t x167 = 9062767193867LLU; int8_t x168 = -1; uint64_t t35 = 11187LLU; t35 = ((x165%x166)^(x167*x168)); if (t35 != 9062767193866LLU) { NG(); } else { ; } } void f36(void) { static uint16_t x169 = 1155U; int8_t x170 = INT8_MAX; uint16_t x171 = 1U; int8_t x172 = 30; static int32_t t36 = -7244117; t36 = ((x169%x170)^(x171*x172)); if (t36 != 18) { NG(); } else { ; } } void f37(void) { volatile uint16_t x173 = 2U; int8_t x174 = INT8_MIN; int32_t x175 = -1; volatile int8_t x176 = -2; volatile int32_t t37 = -1; t37 = ((x173%x174)^(x175*x176)); if (t37 != 0) { NG(); } else { ; } } void f38(void) { int8_t x177 = INT8_MIN; int32_t x178 = 124; static int64_t x179 = -1LL; uint64_t x180 = 116649390802662LLU; volatile uint64_t t38 = 1281156711054LLU; t38 = ((x177%x178)^(x179*x180)); if (t38 != 116649390802662LLU) { NG(); } else { ; } } void f39(void) { uint8_t x181 = UINT8_MAX; uint64_t x182 = 2LLU; int64_t x184 = -1LL; uint64_t t39 = 164236337197485889LLU; t39 = ((x181%x182)^(x183*x184)); if (t39 != 18446744073709551488LLU) { NG(); } else { ; } } void f40(void) { uint8_t x185 = 6U; uint64_t x186 = 31401971634859LLU; int64_t x187 = -1LL; int16_t x188 = 12; t40 = ((x185%x186)^(x187*x188)); if (t40 != 18446744073709551602LLU) { NG(); } else { ; } } void f41(void) { uint32_t x189 = UINT32_MAX; int16_t x190 = -1; volatile int8_t x192 = -1; uint32_t t41 = 291U; t41 = ((x189%x190)^(x191*x192)); if (t41 != 4294967259U) { NG(); } else { ; } } void f42(void) { volatile uint64_t x193 = UINT64_MAX; uint8_t x195 = UINT8_MAX; int32_t x196 = 0; t42 = ((x193%x194)^(x195*x196)); if (t42 != 81904145LLU) { NG(); } else { ; } } void f43(void) { static int8_t x201 = INT8_MIN; static volatile uint64_t x202 = 185289419LLU; uint8_t x203 = 0U; static volatile int16_t x204 = -1; uint64_t t43 = 5296366983625736411LLU; t43 = ((x201%x202)^(x203*x204)); if (t43 != 61304642LLU) { NG(); } else { ; } } void f44(void) { int16_t x206 = -2959; int32_t x207 = INT32_MIN; static volatile uint32_t x208 = 13368678U; uint32_t t44 = 116U; t44 = ((x205%x206)^(x207*x208)); if (t44 != 4294967077U) { NG(); } else { ; } } void f45(void) { static int16_t x210 = INT16_MIN; int32_t x211 = 105335; volatile int16_t x212 = 8120; volatile int32_t t45 = 947; t45 = ((x209%x210)^(x211*x212)); if (t45 != 855333239) { NG(); } else { ; } } void f46(void) { uint8_t x221 = 13U; int8_t x222 = INT8_MAX; int8_t x223 = INT8_MIN; uint32_t x224 = 0U; volatile uint32_t t46 = 470U; t46 = ((x221%x222)^(x223*x224)); if (t46 != 13U) { NG(); } else { ; } } void f47(void) { uint32_t x229 = 173U; int32_t x230 = -1; uint64_t x231 = UINT64_MAX; uint8_t x232 = 2U; static uint64_t t47 = 25175974790LLU; t47 = ((x229%x230)^(x231*x232)); if (t47 != 18446744073709551443LLU) { NG(); } else { ; } } void f48(void) { uint32_t x233 = UINT32_MAX; int64_t x234 = INT64_MAX; uint32_t x235 = UINT32_MAX; volatile int16_t x236 = -1; int64_t t48 = 7514291814313LL; t48 = ((x233%x234)^(x235*x236)); if (t48 != 4294967294LL) { NG(); } else { ; } } void f49(void) { volatile int32_t t49 = 1; t49 = ((x241%x242)^(x243*x244)); if (t49 != 1073676289) { NG(); } else { ; } } void f50(void) { int16_t x246 = INT16_MIN; static int8_t x247 = INT8_MIN; static uint8_t x248 = 13U; static uint32_t t50 = 115U; t50 = ((x245%x246)^(x247*x248)); if (t50 != 4294936191U) { NG(); } else { ; } } void f51(void) { int64_t x249 = -24827511784LL; uint64_t x251 = 821053496LLU; static int64_t x252 = -1257815356709985898LL; uint64_t t51 = 15091LLU; t51 = ((x249%x250)^(x251*x252)); if (t51 != 3000243225994823888LLU) { NG(); } else { ; } } void f52(void) { int64_t x258 = -1LL; static uint16_t x259 = 2U; static uint64_t t52 = 98772924029384967LLU; t52 = ((x257%x258)^(x259*x260)); if (t52 != 18446744073709551614LLU) { NG(); } else { ; } } void f53(void) { static int64_t x266 = INT64_MIN; volatile int32_t x267 = -178; volatile int8_t x268 = -1; static int64_t t53 = 6356LL; t53 = ((x265%x266)^(x267*x268)); if (t53 != -179LL) { NG(); } else { ; } } void f54(void) { int16_t x269 = 468; static int16_t x270 = INT16_MAX; int16_t x272 = INT16_MIN; int32_t t54 = -2888; t54 = ((x269%x270)^(x271*x272)); if (t54 != 4194772) { NG(); } else { ; } } void f55(void) { static uint8_t x278 = 2U; uint64_t x279 = 234857LLU; int8_t x280 = -44; volatile uint64_t t55 = 12083721085653274LLU; t55 = ((x277%x278)^(x279*x280)); if (t55 != 18446744073699217908LLU) { NG(); } else { ; } } void f56(void) { int16_t x283 = INT16_MIN; volatile int8_t x284 = INT8_MAX; int64_t t56 = 148063147LL; t56 = ((x281%x282)^(x283*x284)); if (t56 != 4161363LL) { NG(); } else { ; } } void f57(void) { uint32_t x285 = UINT32_MAX; uint32_t x286 = 93U; int8_t x287 = -1; static volatile int32_t x288 = -1; static volatile uint32_t t57 = 31970167U; t57 = ((x285%x286)^(x287*x288)); if (t57 != 2U) { NG(); } else { ; } } void f58(void) { int8_t x290 = INT8_MAX; uint64_t x291 = 1504556LLU; uint16_t x292 = 4916U; uint64_t t58 = 210LLU; t58 = ((x289%x290)^(x291*x292)); if (t58 != 7396397210LLU) { NG(); } else { ; } } void f59(void) { uint8_t x293 = UINT8_MAX; int64_t x294 = INT64_MAX; uint32_t x295 = UINT32_MAX; int32_t x296 = INT32_MIN; int64_t t59 = 17708138222LL; t59 = ((x293%x294)^(x295*x296)); if (t59 != 2147483903LL) { NG(); } else { ; } } void f60(void) { int32_t x297 = INT32_MIN; int32_t x299 = -867825; uint8_t x300 = 118U; static volatile int32_t t60 = 1; t60 = ((x297%x298)^(x299*x300)); if (t60 != 102403348) { NG(); } else { ; } } void f61(void) { int8_t x305 = 4; uint64_t x307 = 14845457334127781LLU; int32_t x308 = INT32_MAX; volatile uint64_t t61 = 217928890411043511LLU; t61 = ((x305%x306)^(x307*x308)); if (t61 != 12772815976640164699LLU) { NG(); } else { ; } } void f62(void) { volatile uint16_t x309 = 25U; int16_t x310 = INT16_MIN; int32_t x311 = 19; int8_t x312 = -1; int32_t t62 = -232; t62 = ((x309%x310)^(x311*x312)); if (t62 != -12) { NG(); } else { ; } } void f63(void) { uint16_t x313 = 0U; volatile int16_t x314 = INT16_MAX; static int8_t x315 = INT8_MIN; uint16_t x316 = 0U; t63 = ((x313%x314)^(x315*x316)); if (t63 != 0) { NG(); } else { ; } } void f64(void) { static int16_t x317 = -2016; int8_t x318 = INT8_MAX; int16_t x319 = INT16_MIN; static int8_t x320 = -11; int32_t t64 = 1010; t64 = ((x317%x318)^(x319*x320)); if (t64 != -360559) { NG(); } else { ; } } void f65(void) { int8_t x321 = INT8_MAX; static uint16_t x323 = 11U; int8_t x324 = 0; volatile uint32_t t65 = 56915387U; t65 = ((x321%x322)^(x323*x324)); if (t65 != 0U) { NG(); } else { ; } } void f66(void) { uint64_t x329 = 10LLU; uint64_t x330 = 126476366425134300LLU; static int8_t x331 = INT8_MIN; t66 = ((x329%x330)^(x331*x332)); if (t66 != 266LLU) { NG(); } else { ; } } void f67(void) { static volatile int64_t x342 = INT64_MIN; uint64_t x343 = 388LLU; uint8_t x344 = UINT8_MAX; uint64_t t67 = 2303800658926087345LLU; t67 = ((x341%x342)^(x343*x344)); if (t67 != 98947LLU) { NG(); } else { ; } } void f68(void) { static volatile uint8_t x345 = 16U; static volatile int32_t x348 = INT32_MIN; volatile int64_t t68 = -102203798324LL; t68 = ((x345%x346)^(x347*x348)); if (t68 != 2147483664LL) { NG(); } else { ; } } void f69(void) { uint64_t x349 = UINT64_MAX; static uint8_t x350 = 69U; int32_t x352 = -1; uint64_t t69 = 116LLU; t69 = ((x349%x350)^(x351*x352)); if (t69 != 60LLU) { NG(); } else { ; } } void f70(void) { int8_t x353 = INT8_MIN; int64_t x354 = 1632816342012945624LL; volatile uint64_t x355 = UINT64_MAX; int32_t x356 = -659628136; uint64_t t70 = 8677301378769033LLU; t70 = ((x353%x354)^(x355*x356)); if (t70 != 18446744073049923560LLU) { NG(); } else { ; } } void f71(void) { uint16_t x361 = 249U; static int32_t x362 = INT32_MIN; volatile int64_t x364 = -96766913421522624LL; t71 = ((x361%x362)^(x363*x364)); if (t71 != -290300740264568007LL) { NG(); } else { ; } } void f72(void) { static uint16_t x366 = 38U; int16_t x367 = INT16_MIN; uint8_t x368 = 21U; static volatile int32_t t72 = 33635; t72 = ((x365%x366)^(x367*x368)); if (t72 != -688107) { NG(); } else { ; } } void f73(void) { uint64_t x370 = 27971154LLU; uint64_t x371 = UINT64_MAX; static volatile int32_t x372 = INT32_MIN; t73 = ((x369%x370)^(x371*x372)); if (t73 != 2167826554LLU) { NG(); } else { ; } } void f74(void) { uint16_t x374 = UINT16_MAX; int8_t x376 = -12; volatile int32_t t74 = 29; t74 = ((x373%x374)^(x375*x376)); if (t74 != 1475) { NG(); } else { ; } } void f75(void) { int8_t x381 = -1; int32_t x382 = 113470009; int8_t x383 = 1; static uint32_t x384 = 393U; volatile uint32_t t75 = 98U; t75 = ((x381%x382)^(x383*x384)); if (t75 != 4294966902U) { NG(); } else { ; } } void f76(void) { static int64_t x389 = 441197LL; volatile int32_t x391 = -1; int64_t t76 = 21LL; t76 = ((x389%x390)^(x391*x392)); if (t76 != -116611876484715LL) { NG(); } else { ; } } void f77(void) { uint16_t x397 = 0U; int32_t x399 = INT32_MAX; int16_t x400 = -1; volatile int32_t t77 = 1; t77 = ((x397%x398)^(x399*x400)); if (t77 != -2147483647) { NG(); } else { ; } } void f78(void) { int64_t x406 = INT64_MIN; int64_t x407 = -6539018LL; uint16_t x408 = 24U; int64_t t78 = 590157673950950767LL; t78 = ((x405%x406)^(x407*x408)); if (t78 != -4138030865LL) { NG(); } else { ; } } void f79(void) { static volatile uint32_t x409 = UINT32_MAX; int16_t x410 = INT16_MIN; uint32_t t79 = 12U; t79 = ((x409%x410)^(x411*x412)); if (t79 != 32766U) { NG(); } else { ; } } void f80(void) { uint8_t x413 = 0U; int64_t x414 = INT64_MIN; int64_t x416 = 3388376LL; int64_t t80 = -1428879862508LL; t80 = ((x413%x414)^(x415*x416)); if (t80 != -12398067784LL) { NG(); } else { ; } } void f81(void) { volatile int8_t x417 = 20; int8_t x418 = -9; uint16_t x420 = UINT16_MAX; int32_t t81 = -579345833; t81 = ((x417%x418)^(x419*x420)); if (t81 != -65533) { NG(); } else { ; } } void f82(void) { int32_t x421 = INT32_MAX; int16_t x422 = 88; volatile int8_t x424 = INT8_MAX; t82 = ((x421%x422)^(x423*x424)); if (t82 != 32406) { NG(); } else { ; } } void f83(void) { volatile int16_t x429 = -1; volatile uint8_t x430 = UINT8_MAX; int8_t x432 = INT8_MAX; volatile int32_t t83 = -1677; t83 = ((x429%x430)^(x431*x432)); if (t83 != 16255) { NG(); } else { ; } } void f84(void) { int32_t x444 = -1; int32_t t84 = -24; t84 = ((x441%x442)^(x443*x444)); if (t84 != -2147483647) { NG(); } else { ; } } void f85(void) { int16_t x446 = -1; volatile int8_t x447 = -5; static volatile int32_t x448 = -1; t85 = ((x445%x446)^(x447*x448)); if (t85 != 5) { NG(); } else { ; } } void f86(void) { int16_t x449 = 2; int16_t x450 = -1; volatile uint8_t x451 = 101U; uint64_t x452 = 28LLU; volatile uint64_t t86 = 87471214564827912LLU; t86 = ((x449%x450)^(x451*x452)); if (t86 != 2828LLU) { NG(); } else { ; } } void f87(void) { uint8_t x454 = UINT8_MAX; int8_t x455 = -1; int16_t x456 = -1; static uint32_t t87 = 1951U; t87 = ((x453%x454)^(x455*x456)); if (t87 != 41U) { NG(); } else { ; } } void f88(void) { int16_t x461 = INT16_MAX; int16_t x462 = INT16_MAX; int32_t x463 = INT32_MIN; int16_t x464 = 1; int32_t t88 = INT32_MIN; t88 = ((x461%x462)^(x463*x464)); if (t88 != INT32_MIN) { NG(); } else { ; } } void f89(void) { int16_t x466 = INT16_MAX; static uint32_t x467 = 23879U; static int16_t x468 = -15271; uint64_t t89 = 31LLU; t89 = ((x465%x466)^(x467*x468)); if (t89 != 3930307469LLU) { NG(); } else { ; } } void f90(void) { int16_t x469 = INT16_MAX; int16_t x470 = INT16_MAX; volatile int64_t x471 = -1LL; int64_t x472 = INT64_MAX; static int64_t t90 = -4223231777617846LL; t90 = ((x469%x470)^(x471*x472)); if (t90 != -9223372036854775807LL) { NG(); } else { ; } } void f91(void) { int64_t x473 = INT64_MAX; int8_t x474 = 9; volatile int16_t x476 = INT16_MAX; volatile int64_t t91 = -4LL; t91 = ((x473%x474)^(x475*x476)); if (t91 != 666742915LL) { NG(); } else { ; } } void f92(void) { int8_t x477 = -1; static int8_t x479 = -1; int16_t x480 = INT16_MIN; int32_t t92 = -1804341; t92 = ((x477%x478)^(x479*x480)); if (t92 != -32769) { NG(); } else { ; } } void f93(void) { int32_t x490 = 48; volatile uint64_t x491 = UINT64_MAX; static int16_t x492 = INT16_MIN; uint64_t t93 = 45735187960644LLU; t93 = ((x489%x490)^(x491*x492)); if (t93 != 32773LLU) { NG(); } else { ; } } void f94(void) { int32_t x493 = INT32_MIN; static int32_t x494 = 2854347; int16_t x496 = INT16_MIN; int32_t t94 = 10161137; t94 = ((x493%x494)^(x495*x496)); if (t94 != -5209008) { NG(); } else { ; } } void f95(void) { volatile int32_t x497 = -1; volatile uint32_t x498 = UINT32_MAX; volatile int8_t x499 = INT8_MIN; static volatile int32_t x500 = -7856; static uint32_t t95 = 4510U; t95 = ((x497%x498)^(x499*x500)); if (t95 != 1005568U) { NG(); } else { ; } } void f96(void) { int16_t x501 = 1; volatile uint16_t x502 = 124U; uint8_t x503 = 26U; volatile uint8_t x504 = 1U; int32_t t96 = 0; t96 = ((x501%x502)^(x503*x504)); if (t96 != 27) { NG(); } else { ; } } void f97(void) { int8_t x505 = INT8_MIN; int32_t x506 = -62439; uint64_t x507 = 7435860LLU; static int32_t x508 = -364160010; volatile uint64_t t97 = 7697896915LLU; t97 = ((x505%x506)^(x507*x508)); if (t97 != 2707842851958584LLU) { NG(); } else { ; } } void f98(void) { int64_t x518 = -1LL; int16_t x519 = INT16_MIN; volatile int8_t x520 = INT8_MIN; volatile int64_t t98 = -28931115910624LL; t98 = ((x517%x518)^(x519*x520)); if (t98 != 4194304LL) { NG(); } else { ; } } void f99(void) { uint64_t x521 = 198298LLU; int64_t x522 = INT64_MAX; static int8_t x524 = INT8_MIN; volatile uint64_t t99 = 8LLU; t99 = ((x521%x522)^(x523*x524)); if (t99 != 18446744073707620634LLU) { NG(); } else { ; } } void f100(void) { int8_t x525 = -5; volatile int16_t x526 = 290; int16_t x527 = 1876; int16_t x528 = -4; t100 = ((x525%x526)^(x527*x528)); if (t100 != 7499) { NG(); } else { ; } } void f101(void) { volatile int32_t x531 = 5949829; uint8_t x532 = UINT8_MAX; int64_t t101 = -1LL; t101 = ((x529%x530)^(x531*x532)); if (t101 != 1517175940LL) { NG(); } else { ; } } void f102(void) { static volatile uint64_t x533 = 103799790LLU; static int16_t x535 = INT16_MAX; static int16_t x536 = INT16_MIN; volatile uint64_t t102 = 16832356994783LLU; t102 = ((x533%x534)^(x535*x536)); if (t102 != 18446744072635842568LLU) { NG(); } else { ; } } void f103(void) { int16_t x537 = -1; int8_t x538 = -1; uint32_t x539 = UINT32_MAX; uint32_t t103 = 1U; t103 = ((x537%x538)^(x539*x540)); if (t103 != 4294967283U) { NG(); } else { ; } } void f104(void) { int16_t x542 = 59; uint64_t x543 = 1LLU; volatile int8_t x544 = -1; volatile uint64_t t104 = 472570679663LLU; t104 = ((x541%x542)^(x543*x544)); if (t104 != 18446744073709551570LLU) { NG(); } else { ; } } void f105(void) { volatile uint8_t x546 = 8U; int16_t x547 = -3342; uint64_t x548 = UINT64_MAX; t105 = ((x545%x546)^(x547*x548)); if (t105 != 3337LLU) { NG(); } else { ; } } void f106(void) { int64_t x549 = INT64_MIN; volatile uint16_t x550 = 2336U; uint64_t x551 = UINT64_MAX; volatile uint64_t t106 = 6135316577838324LLU; t106 = ((x549%x550)^(x551*x552)); if (t106 != 18446744073709550288LLU) { NG(); } else { ; } } void f107(void) { int8_t x554 = INT8_MIN; static int8_t x555 = -1; int64_t t107 = 61142898732763126LL; t107 = ((x553%x554)^(x555*x556)); if (t107 != 6LL) { NG(); } else { ; } } void f108(void) { int16_t x557 = -1; static int64_t x558 = INT64_MIN; uint64_t x559 = 267180813984LLU; int32_t x560 = INT32_MIN; volatile uint64_t t108 = 6410380048285495LLU; t108 = ((x557%x558)^(x559*x560)); if (t108 != 1917362804973633535LLU) { NG(); } else { ; } } void f109(void) { volatile int8_t x562 = -1; int8_t x563 = INT8_MIN; int32_t x564 = -3075182; static int32_t t109 = -4539537; t109 = ((x561%x562)^(x563*x564)); if (t109 != 393623296) { NG(); } else { ; } } void f110(void) { static volatile uint16_t x569 = 0U; static uint32_t x570 = 10422U; int32_t x571 = -1; volatile int32_t x572 = INT32_MAX; uint32_t t110 = 6U; t110 = ((x569%x570)^(x571*x572)); if (t110 != 2147483649U) { NG(); } else { ; } } void f111(void) { int64_t x573 = INT64_MIN; volatile int8_t x574 = INT8_MIN; int16_t x575 = INT16_MAX; t111 = ((x573%x574)^(x575*x576)); if (t111 != 0LL) { NG(); } else { ; } } void f112(void) { int32_t x581 = -1; uint8_t x583 = UINT8_MAX; static int8_t x584 = 37; uint32_t t112 = 1473774875U; t112 = ((x581%x582)^(x583*x584)); if (t112 != 33833322U) { NG(); } else { ; } } void f113(void) { int64_t x589 = INT64_MIN; static uint8_t x590 = UINT8_MAX; int32_t x591 = INT32_MIN; uint64_t x592 = UINT64_MAX; t113 = ((x589%x590)^(x591*x592)); if (t113 != 18446744071562067840LLU) { NG(); } else { ; } } void f114(void) { uint32_t x597 = 971656504U; uint64_t x598 = 7500985089LLU; uint8_t x599 = 1U; volatile uint8_t x600 = 6U; t114 = ((x597%x598)^(x599*x600)); if (t114 != 971656510LLU) { NG(); } else { ; } } void f115(void) { uint16_t x601 = 265U; static volatile int64_t x603 = INT64_MAX; volatile int16_t x604 = -1; volatile int64_t t115 = -57035776872825614LL; t115 = ((x601%x602)^(x603*x604)); if (t115 != -9223372036854775544LL) { NG(); } else { ; } } void f116(void) { int32_t x606 = -1; uint32_t x608 = 91947U; volatile uint32_t t116 = 551U; t116 = ((x605%x606)^(x607*x608)); if (t116 != 183894U) { NG(); } else { ; } } void f117(void) { uint8_t x609 = 2U; volatile uint64_t x612 = 49179LLU; t117 = ((x609%x610)^(x611*x612)); if (t117 != 18446638462611226626LLU) { NG(); } else { ; } } void f118(void) { int32_t x613 = 15903798; int32_t x614 = -525323051; int8_t x616 = 1; int32_t t118 = 22730; t118 = ((x613%x614)^(x615*x616)); if (t118 != 15903799) { NG(); } else { ; } } void f119(void) { volatile int32_t x617 = 29; int32_t x618 = INT32_MAX; uint8_t x619 = 1U; int8_t x620 = INT8_MIN; volatile int32_t t119 = 2173; t119 = ((x617%x618)^(x619*x620)); if (t119 != -99) { NG(); } else { ; } } void f120(void) { int8_t x625 = -7; int32_t x626 = -2; int8_t x627 = INT8_MIN; t120 = ((x625%x626)^(x627*x628)); if (t120 != -4194305) { NG(); } else { ; } } void f121(void) { int32_t x629 = INT32_MIN; int8_t x630 = INT8_MIN; uint32_t x631 = UINT32_MAX; volatile uint32_t t121 = 428U; t121 = ((x629%x630)^(x631*x632)); if (t121 != 32768U) { NG(); } else { ; } } void f122(void) { volatile int16_t x641 = 2035; int32_t x642 = INT32_MAX; static int8_t x643 = INT8_MAX; volatile int32_t t122 = -2351603; t122 = ((x641%x642)^(x643*x644)); if (t122 != -4159501) { NG(); } else { ; } } void f123(void) { static uint8_t x645 = 67U; int8_t x646 = INT8_MIN; static uint64_t x647 = 20086611LLU; volatile uint64_t x648 = 59LLU; static uint64_t t123 = 60294676529260LLU; t123 = ((x645%x646)^(x647*x648)); if (t123 != 1185110114LLU) { NG(); } else { ; } } void f124(void) { uint64_t x654 = 4003123014LLU; int16_t x655 = INT16_MIN; uint64_t t124 = 81757122804LLU; t124 = ((x653%x654)^(x655*x656)); if (t124 != 32771LLU) { NG(); } else { ; } } void f125(void) { volatile int8_t x661 = -1; volatile uint16_t x662 = 11U; uint16_t x663 = 7U; int16_t x664 = INT16_MAX; int32_t t125 = -1268; t125 = ((x661%x662)^(x663*x664)); if (t125 != -229370) { NG(); } else { ; } } void f126(void) { uint8_t x665 = UINT8_MAX; int16_t x666 = INT16_MIN; uint16_t x667 = 104U; static uint32_t x668 = UINT32_MAX; uint32_t t126 = 33U; t126 = ((x665%x666)^(x667*x668)); if (t126 != 4294967143U) { NG(); } else { ; } } void f127(void) { static int64_t x670 = INT64_MIN; static int16_t x671 = INT16_MIN; static int8_t x672 = -1; volatile int64_t t127 = 811765313990886512LL; t127 = ((x669%x670)^(x671*x672)); if (t127 != 32962LL) { NG(); } else { ; } } void f128(void) { int16_t x673 = INT16_MIN; int32_t x674 = -1; volatile uint32_t x675 = 27875948U; static uint8_t x676 = 6U; uint32_t t128 = 3U; t128 = ((x673%x674)^(x675*x676)); if (t128 != 167255688U) { NG(); } else { ; } } void f129(void) { int64_t x677 = 68810440215489LL; int8_t x679 = 0; uint16_t x680 = 65U; t129 = ((x677%x678)^(x679*x680)); if (t129 != 3009LL) { NG(); } else { ; } } void f130(void) { int64_t x685 = INT64_MIN; volatile int8_t x686 = INT8_MIN; int32_t x688 = -1; volatile int64_t t130 = 2458213067022955LL; t130 = ((x685%x686)^(x687*x688)); if (t130 != 32768LL) { NG(); } else { ; } } void f131(void) { int64_t x689 = 58668756LL; uint32_t x691 = 1715U; static int16_t x692 = -1; static int64_t t131 = 1617LL; t131 = ((x689%x690)^(x691*x692)); if (t131 != 4236300185LL) { NG(); } else { ; } } void f132(void) { uint16_t x697 = 11U; uint16_t x698 = UINT16_MAX; int32_t x699 = -1; volatile uint32_t x700 = 6301829U; t132 = ((x697%x698)^(x699*x700)); if (t132 != 4288665456U) { NG(); } else { ; } } void f133(void) { static volatile int16_t x703 = 95; int16_t x704 = -1; t133 = ((x701%x702)^(x703*x704)); if (t133 != -95LL) { NG(); } else { ; } } void f134(void) { uint8_t x705 = 2U; static int16_t x706 = -1; int8_t x707 = INT8_MIN; int8_t x708 = INT8_MAX; volatile int32_t t134 = -1355490; t134 = ((x705%x706)^(x707*x708)); if (t134 != -16256) { NG(); } else { ; } } void f135(void) { int32_t x710 = INT32_MIN; uint8_t x711 = UINT8_MAX; static uint8_t x712 = UINT8_MAX; t135 = ((x709%x710)^(x711*x712)); if (t135 != -65026) { NG(); } else { ; } } void f136(void) { int8_t x713 = INT8_MIN; static int32_t x714 = INT32_MIN; int32_t x715 = 367; t136 = ((x713%x714)^(x715*x716)); if (t136 != 12025728) { NG(); } else { ; } } void f137(void) { static volatile int32_t x717 = -1; int16_t x718 = INT16_MIN; static int16_t x719 = INT16_MIN; int8_t x720 = INT8_MIN; volatile int32_t t137 = -119; t137 = ((x717%x718)^(x719*x720)); if (t137 != -4194305) { NG(); } else { ; } } void f138(void) { static volatile int8_t x722 = INT8_MIN; int16_t x724 = INT16_MAX; volatile int64_t t138 = 246367396242161603LL; t138 = ((x721%x722)^(x723*x724)); if (t138 != 4161409LL) { NG(); } else { ; } } void f139(void) { static int64_t x726 = INT64_MAX; volatile int16_t x727 = INT16_MAX; int64_t t139 = 18LL; t139 = ((x725%x726)^(x727*x728)); if (t139 != 4194175LL) { NG(); } else { ; } } void f140(void) { static int16_t x729 = 7614; int32_t x730 = INT32_MIN; uint16_t x731 = UINT16_MAX; static int16_t x732 = INT16_MAX; int32_t t140 = -96; t140 = ((x729%x730)^(x731*x732)); if (t140 != 2147392959) { NG(); } else { ; } } void f141(void) { int8_t x738 = INT8_MAX; volatile int32_t x739 = 96; volatile uint64_t t141 = 146572LLU; t141 = ((x737%x738)^(x739*x740)); if (t141 != 12814101437299888863LLU) { NG(); } else { ; } } void f142(void) { uint64_t x749 = 2175043599918755195LLU; volatile int64_t x750 = INT64_MIN; uint64_t x751 = UINT64_MAX; t142 = ((x749%x750)^(x751*x752)); if (t142 != 2175043599918755194LLU) { NG(); } else { ; } } void f143(void) { int16_t x753 = INT16_MIN; int32_t x754 = INT32_MAX; uint16_t x755 = 98U; t143 = ((x753%x754)^(x755*x756)); if (t143 != 3178496) { NG(); } else { ; } } void f144(void) { int64_t x761 = -1LL; int16_t x762 = INT16_MAX; int64_t x763 = INT64_MAX; int64_t x764 = -1LL; volatile int64_t t144 = -20LL; t144 = ((x761%x762)^(x763*x764)); if (t144 != 9223372036854775806LL) { NG(); } else { ; } } void f145(void) { int64_t x766 = INT64_MIN; uint64_t x767 = 12050718720LLU; static int32_t x768 = -1; static volatile uint64_t t145 = 1975379628419238722LLU; t145 = ((x765%x766)^(x767*x768)); if (t145 != 18446744061658832896LLU) { NG(); } else { ; } } void f146(void) { int8_t x769 = -8; int16_t x770 = INT16_MIN; static int64_t x771 = INT64_MIN; static int64_t x772 = 1LL; static int64_t t146 = 1LL; t146 = ((x769%x770)^(x771*x772)); if (t146 != 9223372036854775800LL) { NG(); } else { ; } } void f147(void) { uint16_t x773 = UINT16_MAX; static int16_t x774 = INT16_MIN; uint8_t x775 = 7U; volatile int32_t t147 = -15; t147 = ((x773%x774)^(x775*x776)); if (t147 != 32753) { NG(); } else { ; } } void f148(void) { int32_t x781 = -1; int16_t x782 = -7; int16_t x783 = -1; t148 = ((x781%x782)^(x783*x784)); if (t148 != -2) { NG(); } else { ; } } void f149(void) { int8_t x785 = 0; static int64_t x787 = -1LL; uint32_t x788 = 847014604U; volatile int64_t t149 = 7662LL; t149 = ((x785%x786)^(x787*x788)); if (t149 != -847014604LL) { NG(); } else { ; } } void f150(void) { volatile int32_t x789 = 124016; int16_t x792 = INT16_MAX; static int64_t t150 = -2387LL; t150 = ((x789%x790)^(x791*x792)); if (t150 != 68948916LL) { NG(); } else { ; } } void f151(void) { uint16_t x793 = 7314U; uint32_t x795 = 38165U; int32_t x796 = -1; uint32_t t151 = 48288U; t151 = ((x793%x794)^(x795*x796)); if (t151 != 4294932089U) { NG(); } else { ; } } void f152(void) { int16_t x797 = -1; int8_t x800 = INT8_MIN; volatile int32_t t152 = -1098263; t152 = ((x797%x798)^(x799*x800)); if (t152 != -131457) { NG(); } else { ; } } void f153(void) { int8_t x805 = INT8_MIN; volatile int16_t x806 = INT16_MIN; uint8_t x807 = 1U; uint32_t x808 = 2U; uint32_t t153 = 1710275U; t153 = ((x805%x806)^(x807*x808)); if (t153 != 4294967170U) { NG(); } else { ; } } void f154(void) { uint8_t x809 = UINT8_MAX; int64_t x810 = -459077015584955LL; uint64_t x811 = 1319271975898681414LLU; uint16_t x812 = UINT16_MAX; static volatile uint64_t t154 = 65209579711LLU; t154 = ((x809%x810)^(x811*x812)); if (t154 != 17046211117127593797LLU) { NG(); } else { ; } } void f155(void) { uint32_t x813 = 25214U; int16_t x814 = -1; int32_t x816 = 8; static volatile uint32_t t155 = 500524875U; t155 = ((x813%x814)^(x815*x816)); if (t155 != 29966U) { NG(); } else { ; } } void f156(void) { uint64_t x817 = 4908031044LLU; int32_t x818 = INT32_MIN; int32_t x819 = -1; volatile int8_t x820 = INT8_MIN; volatile uint64_t t156 = 22373898489LLU; t156 = ((x817%x818)^(x819*x820)); if (t156 != 4908031172LLU) { NG(); } else { ; } } void f157(void) { int64_t x821 = -1LL; uint64_t x822 = UINT64_MAX; uint8_t x823 = UINT8_MAX; volatile int16_t x824 = -1755; volatile uint64_t t157 = 330429LLU; t157 = ((x821%x822)^(x823*x824)); if (t157 != 18446744073709104091LLU) { NG(); } else { ; } } void f158(void) { static uint8_t x826 = 20U; static volatile uint64_t x827 = 717088676423645LLU; volatile int32_t x828 = 1951286; volatile uint64_t t158 = 0LLU; t158 = ((x825%x826)^(x827*x828)); if (t158 != 15739289535772186270LLU) { NG(); } else { ; } } void f159(void) { int32_t x829 = INT32_MAX; static int16_t x830 = INT16_MAX; int16_t x831 = INT16_MIN; int32_t x832 = -43836; volatile int32_t t159 = 507405943; t159 = ((x829%x830)^(x831*x832)); if (t159 != 1436418049) { NG(); } else { ; } } void f160(void) { volatile uint16_t x837 = UINT16_MAX; int8_t x838 = -1; uint64_t x839 = 9862342600425LLU; volatile int8_t x840 = INT8_MIN; static volatile uint64_t t160 = 14733575547857LLU; t160 = ((x837%x838)^(x839*x840)); if (t160 != 18445481693856697216LLU) { NG(); } else { ; } } void f161(void) { int8_t x841 = INT8_MAX; int32_t x842 = INT32_MIN; int16_t x843 = 15156; uint8_t x844 = 28U; volatile int32_t t161 = 55162; t161 = ((x841%x842)^(x843*x844)); if (t161 != 424399) { NG(); } else { ; } } void f162(void) { int64_t x853 = INT64_MIN; int16_t x855 = INT16_MIN; volatile int16_t x856 = INT16_MIN; volatile int64_t t162 = -524980426387LL; t162 = ((x853%x854)^(x855*x856)); if (t162 != 1073741824LL) { NG(); } else { ; } } void f163(void) { volatile uint8_t x857 = 63U; uint64_t x860 = UINT64_MAX; volatile uint64_t t163 = 1922191738716LLU; t163 = ((x857%x858)^(x859*x860)); if (t163 != 18446744073709551550LLU) { NG(); } else { ; } } void f164(void) { int8_t x867 = INT8_MAX; static volatile int64_t t164 = -19180896290LL; t164 = ((x865%x866)^(x867*x868)); if (t164 != -2669LL) { NG(); } else { ; } } void f165(void) { int64_t x869 = INT64_MIN; uint16_t x870 = UINT16_MAX; t165 = ((x869%x870)^(x871*x872)); if (t165 != -65536LL) { NG(); } else { ; } } void f166(void) { static volatile uint16_t x874 = 28U; static volatile uint8_t x876 = 113U; int32_t t166 = 179912625; t166 = ((x873%x874)^(x875*x876)); if (t166 != -3702772) { NG(); } else { ; } } void f167(void) { int8_t x877 = -10; static int16_t x878 = INT16_MIN; int64_t x879 = -1638436253809310LL; int32_t x880 = 1; int64_t t167 = -149LL; t167 = ((x877%x878)^(x879*x880)); if (t167 != 1638436253809300LL) { NG(); } else { ; } } void f168(void) { int64_t x881 = -1LL; uint8_t x882 = 17U; int8_t x883 = INT8_MIN; int64_t t168 = 271587658LL; t168 = ((x881%x882)^(x883*x884)); if (t168 != 8388479LL) { NG(); } else { ; } } void f169(void) { static uint64_t x885 = 17957567315703LLU; int16_t x886 = INT16_MIN; static int16_t x887 = -14; t169 = ((x885%x886)^(x887*x888)); if (t169 != 18446726116142236609LLU) { NG(); } else { ; } } void f170(void) { static int32_t x893 = -1; static uint64_t x894 = UINT64_MAX; int64_t x895 = 34LL; volatile uint64_t t170 = 2395021894869LLU; t170 = ((x893%x894)^(x895*x896)); if (t170 != 272374LLU) { NG(); } else { ; } } void f171(void) { int32_t x897 = -2074378; int16_t x898 = -1; int8_t x899 = -1; static int16_t x900 = INT16_MIN; volatile int32_t t171 = -895164312; t171 = ((x897%x898)^(x899*x900)); if (t171 != 32768) { NG(); } else { ; } } void f172(void) { int32_t x901 = INT32_MAX; int32_t x903 = 1; volatile int32_t t172 = 3545767; t172 = ((x901%x902)^(x903*x904)); if (t172 != -32641) { NG(); } else { ; } } void f173(void) { int8_t x913 = INT8_MIN; int16_t x916 = INT16_MIN; volatile int64_t t173 = 605418336430LL; t173 = ((x913%x914)^(x915*x916)); if (t173 != -128LL) { NG(); } else { ; } } void f174(void) { int64_t x917 = 79269LL; uint8_t x919 = 1U; volatile int16_t x920 = INT16_MIN; static volatile int64_t t174 = 10653289LL; t174 = ((x917%x918)^(x919*x920)); if (t174 != -32768LL) { NG(); } else { ; } } void f175(void) { volatile int8_t x926 = -11; static volatile int64_t x927 = -1LL; int16_t x928 = INT16_MAX; volatile int64_t t175 = -477995072LL; t175 = ((x925%x926)^(x927*x928)); if (t175 != -32761LL) { NG(); } else { ; } } void f176(void) { int32_t x933 = -1; uint16_t x934 = 7062U; uint32_t x935 = 3U; uint64_t x936 = 1171096014535387LLU; static volatile uint64_t t176 = 269LLU; t176 = ((x933%x934)^(x935*x936)); if (t176 != 18443230785665945454LLU) { NG(); } else { ; } } void f177(void) { volatile uint64_t x945 = 32LLU; int32_t x946 = 50314317; static int32_t x947 = INT32_MIN; volatile uint32_t x948 = 23425874U; uint64_t t177 = 31466570761485615LLU; t177 = ((x945%x946)^(x947*x948)); if (t177 != 32LLU) { NG(); } else { ; } } void f178(void) { volatile uint32_t x949 = 1707987U; volatile int16_t x950 = -691; volatile uint8_t x951 = 1U; static volatile uint8_t x952 = 3U; uint32_t t178 = 14U; t178 = ((x949%x950)^(x951*x952)); if (t178 != 1707984U) { NG(); } else { ; } } void f179(void) { volatile uint16_t x957 = UINT16_MAX; uint64_t x959 = 12335125LLU; volatile uint64_t t179 = 863LLU; t179 = ((x957%x958)^(x959*x960)); if (t179 != 18446743669512175631LLU) { NG(); } else { ; } } void f180(void) { uint32_t x962 = 13103744U; volatile int8_t x963 = INT8_MIN; int32_t x964 = 17; static uint32_t t180 = 7470130U; t180 = ((x961%x962)^(x963*x964)); if (t180 != 4284926463U) { NG(); } else { ; } } void f181(void) { int64_t x969 = INT64_MIN; uint64_t x970 = 45LLU; int8_t x971 = 7; volatile uint16_t x972 = 0U; volatile uint64_t t181 = 317979494253519LLU; t181 = ((x969%x970)^(x971*x972)); if (t181 != 8LLU) { NG(); } else { ; } } void f182(void) { int16_t x973 = -1; volatile int64_t x974 = INT64_MIN; uint8_t x975 = 1U; volatile uint16_t x976 = 1U; t182 = ((x973%x974)^(x975*x976)); if (t182 != -2LL) { NG(); } else { ; } } void f183(void) { uint16_t x978 = 14U; uint8_t x979 = 95U; uint64_t x980 = 464LLU; volatile uint64_t t183 = 1422300355899789026LLU; t183 = ((x977%x978)^(x979*x980)); if (t183 != 18446744073709507535LLU) { NG(); } else { ; } } void f184(void) { int64_t x983 = 1949260744123LL; static int16_t x984 = INT16_MIN; static int64_t t184 = 722LL; t184 = ((x981%x982)^(x983*x984)); if (t184 != -63873376063422464LL) { NG(); } else { ; } } void f185(void) { int64_t x985 = INT64_MAX; int32_t x986 = 349314; uint64_t x987 = 788448056826734LLU; int32_t x988 = INT32_MIN; uint64_t t185 = 3541300779910105583LLU; t185 = ((x985%x986)^(x987*x988)); if (t185 != 10435704866289608103LLU) { NG(); } else { ; } } void f186(void) { uint64_t x989 = 6342195577246878LLU; int16_t x990 = INT16_MIN; static int32_t x991 = INT32_MIN; int64_t x992 = -1LL; uint64_t t186 = 88275714LLU; t186 = ((x989%x990)^(x991*x992)); if (t186 != 6342197724730526LLU) { NG(); } else { ; } } void f187(void) { int16_t x993 = INT16_MIN; int8_t x994 = -11; volatile uint8_t x996 = UINT8_MAX; volatile int32_t t187 = 495622549; t187 = ((x993%x994)^(x995*x996)); if (t187 != 32630) { NG(); } else { ; } } void f188(void) { uint8_t x997 = 0U; volatile uint16_t x998 = 242U; int16_t x999 = -1; int64_t t188 = 0LL; t188 = ((x997%x998)^(x999*x1000)); if (t188 != -9223372036854775807LL) { NG(); } else { ; } } void f189(void) { uint32_t x1005 = 39801008U; int8_t x1006 = INT8_MAX; int16_t x1007 = INT16_MIN; int8_t x1008 = INT8_MIN; uint32_t t189 = 1650777U; t189 = ((x1005%x1006)^(x1007*x1008)); if (t189 != 4194401U) { NG(); } else { ; } } void f190(void) { volatile uint16_t x1009 = 22U; volatile int8_t x1010 = INT8_MIN; int16_t x1012 = 13; uint64_t t190 = 661297916565302LLU; t190 = ((x1009%x1010)^(x1011*x1012)); if (t190 != 20879776069298214LLU) { NG(); } else { ; } } void f191(void) { int16_t x1017 = INT16_MIN; int8_t x1018 = -1; uint32_t x1019 = UINT32_MAX; t191 = ((x1017%x1018)^(x1019*x1020)); if (t191 != 2147483648U) { NG(); } else { ; } } void f192(void) { uint8_t x1022 = UINT8_MAX; uint16_t x1023 = 7584U; uint64_t t192 = 1577678647785LLU; t192 = ((x1021%x1022)^(x1023*x1024)); if (t192 != 18446744073709543994LLU) { NG(); } else { ; } } void f193(void) { uint8_t x1033 = 15U; uint32_t x1034 = 177U; int32_t x1035 = -75065536; t193 = ((x1033%x1034)^(x1035*x1036)); if (t193 != 75065551U) { NG(); } else { ; } } void f194(void) { int16_t x1038 = INT16_MIN; static volatile uint8_t x1039 = UINT8_MAX; volatile int8_t x1040 = INT8_MIN; t194 = ((x1037%x1038)^(x1039*x1040)); if (t194 != -32630) { NG(); } else { ; } } void f195(void) { int64_t x1041 = -362810LL; int64_t x1042 = -52786LL; static volatile int64_t x1043 = -232470066588LL; volatile int64_t x1044 = -14347LL; t195 = ((x1041%x1042)^(x1043*x1044)); if (t195 != -3335248045300154LL) { NG(); } else { ; } } void f196(void) { int16_t x1046 = INT16_MIN; volatile uint16_t x1047 = UINT16_MAX; uint8_t x1048 = 1U; volatile int32_t t196 = -404319; t196 = ((x1045%x1046)^(x1047*x1048)); if (t196 != 65530) { NG(); } else { ; } } void f197(void) { int32_t x1049 = INT32_MIN; uint32_t x1050 = UINT32_MAX; int16_t x1051 = INT16_MAX; uint32_t t197 = 100105887U; t197 = ((x1049%x1050)^(x1051*x1052)); if (t197 != 2146533405U) { NG(); } else { ; } } void f198(void) { static uint32_t x1053 = 2340U; int64_t x1054 = -1LL; static volatile uint16_t x1055 = UINT16_MAX; int16_t x1056 = INT16_MAX; volatile int64_t t198 = -61095367150LL; t198 = ((x1053%x1054)^(x1055*x1056)); if (t198 != 2147385345LL) { NG(); } else { ; } } void f199(void) { int32_t x1058 = -393204; int16_t x1059 = INT16_MAX; int64_t x1060 = -813LL; static volatile int64_t t199 = -98763283451008LL; t199 = ((x1057%x1058)^(x1059*x1060)); if (t199 != 26639573LL) { NG(); } else { ; } } int main(void) { f0(); f1(); f2(); f3(); f4(); f5(); f6(); f7(); f8(); f9(); f10(); f11(); f12(); f13(); f14(); f15(); f16(); f17(); f18(); f19(); f20(); f21(); f22(); f23(); f24(); f25(); f26(); f27(); f28(); f29(); f30(); f31(); f32(); f33(); f34(); f35(); f36(); f37(); f38(); f39(); f40(); f41(); f42(); f43(); f44(); f45(); f46(); f47(); f48(); f49(); f50(); f51(); f52(); f53(); f54(); f55(); f56(); f57(); f58(); f59(); f60(); f61(); f62(); f63(); f64(); f65(); f66(); f67(); f68(); f69(); f70(); f71(); f72(); f73(); f74(); f75(); f76(); f77(); f78(); f79(); f80(); f81(); f82(); f83(); f84(); f85(); f86(); f87(); f88(); f89(); f90(); f91(); f92(); f93(); f94(); f95(); f96(); f97(); f98(); f99(); f100(); f101(); f102(); f103(); f104(); f105(); f106(); f107(); f108(); f109(); f110(); f111(); f112(); f113(); f114(); f115(); f116(); f117(); f118(); f119(); f120(); f121(); f122(); f123(); f124(); f125(); f126(); f127(); f128(); f129(); f130(); f131(); f132(); f133(); f134(); f135(); f136(); f137(); f138(); f139(); f140(); f141(); f142(); f143(); f144(); f145(); f146(); f147(); f148(); f149(); f150(); f151(); f152(); f153(); f154(); f155(); f156(); f157(); f158(); f159(); f160(); f161(); f162(); f163(); f164(); f165(); f166(); f167(); f168(); f169(); f170(); f171(); f172(); f173(); f174(); f175(); f176(); f177(); f178(); f179(); f180(); f181(); f182(); f183(); f184(); f185(); f186(); f187(); f188(); f189(); f190(); f191(); f192(); f193(); f194(); f195(); f196(); f197(); f198(); f199(); return 0; }
19.353045
61
0.604615
880ab5661cd17368aaed8bf5ca9f3d457c82a615
1,751
h
C
cl/dsi.h
Jimmy-Z/bfCL
687acab0c8e21e47253babeea12ec0537a822317
[ "Apache-2.0" ]
10
2017-11-03T14:58:57.000Z
2021-03-28T14:18:10.000Z
cl/dsi.h
Jimmy-Z/bfCL
687acab0c8e21e47253babeea12ec0537a822317
[ "Apache-2.0" ]
4
2018-03-22T01:44:11.000Z
2018-11-24T08:02:33.000Z
cl/dsi.h
Jimmy-Z/bfCL
687acab0c8e21e47253babeea12ec0537a822317
[ "Apache-2.0" ]
4
2018-01-21T23:43:14.000Z
2022-03-18T00:06:42.000Z
// more about this: https://github.com/Jimmy-Z/TWLbf/blob/master/dsi.c __constant static const u64 DSi_KEY_Y[2] = {0xbd4dc4d30ab9dc76ul, 0xe1a00005202ddd1dul}; __constant static const u64 DSi_KEY_MAGIC[2] = {0x2a680f5f1a4f3e79ul, 0xfffefb4e29590258ul}; // CAUTION this one doesn't work in-place inline void byte_reverse_16(u8 *out, const u8 *in){ out[0] = in[15]; out[1] = in[14]; out[2] = in[13]; out[3] = in[12]; out[4] = in[11]; out[5] = in[10]; out[6] = in[9]; out[7] = in[8]; out[8] = in[7]; out[9] = in[6]; out[10] = in[5]; out[11] = in[4]; out[12] = in[3]; out[13] = in[2]; out[14] = in[1]; out[15] = in[0]; } inline void add_128_64(u64 *a, u64 b){ a[0] += b; if(a[0] < b){ a[1] += 1; } } inline void sub_128_64(u64 *a, u64 b) { if (a[0] < b) { a[1] -= 1; } a[0] -= b; } // Answer to life, universe and everything. inline void rol42_128(u64 *a){ u64 t = a[1]; a[1] = (t << 42 ) | (a[0] >> 22); a[0] = (a[0] << 42 ) | (t >> 22); } // eMMC Encryption for MBR/Partitions (AES-CTR, with console-specific key) inline void dsi_make_key(u64 *key, u64 console_id){ u32 h = console_id >> 32, l = (u32)console_id; #ifdef CTR u32 key_x[4] = {(l ^ 0xb358a6af) | 0x80000000, 0x544e494e, 0x4f444e45, h ^ 0x08c267b7}; #else u32 key_x[4] = {l, l ^ 0x24ee6906, h ^ 0xe65b601d, h}; #endif // Key = ((Key_X XOR Key_Y) + FFFEFB4E295902582A680F5F1A4F3E79h) ROL 42 // equivalent to F_XY in twltool/f_xy.c // xor_128(key, (u64*)key_x, DSi_KEY_Y); key[0] = ((u64*)key_x)[0] ^ DSi_KEY_Y[0]; key[1] = ((u64*)key_x)[1] ^ DSi_KEY_Y[1]; // add_128(key, DSi_KEY_MAGIC); key[0] += DSi_KEY_MAGIC[0]; if(key[0] < DSi_KEY_MAGIC[0]){ key[1] += DSi_KEY_MAGIC[1] + 1; }else{ key[1] += DSi_KEY_MAGIC[1]; } rol42_128(key); }
23.662162
88
0.609366
32cfb49b5a53eb277e20e784037a6c9e8bf62515
17,581
c
C
shadowsocks-libev/shadowsocks-libev/libipset/bdd/write.c
ChenSee/taichi-iOS
622751a7d02d544a897b52c17f6b83c4df96e870
[ "Apache-2.0" ]
11
2016-05-17T16:39:31.000Z
2021-06-01T14:35:43.000Z
shadowsocks-libev/shadowsocks-libev/libipset/bdd/write.c
taichisocks/taichi-iOS
622751a7d02d544a897b52c17f6b83c4df96e870
[ "Apache-2.0" ]
null
null
null
shadowsocks-libev/shadowsocks-libev/libipset/bdd/write.c
taichisocks/taichi-iOS
622751a7d02d544a897b52c17f6b83c4df96e870
[ "Apache-2.0" ]
9
2016-04-07T00:21:29.000Z
2019-09-26T11:29:18.000Z
/* -*- coding: utf-8 -*- * ---------------------------------------------------------------------- * Copyright © 2010-2013, RedJack, LLC. * All rights reserved. * * Please see the LICENSE.txt file in this distribution for license * details. * ---------------------------------------------------------------------- */ #include "libcork/core.h" #include "libcork/helpers/errors.h" #include "ipset/bdd/nodes.h" #include "ipset/logging.h" /*----------------------------------------------------------------------- * Generic saving logic */ /** * On disk, we use a different node ID scheme than we do in memory. * Terminal node IDs are non-negative, and are equal to the terminal * value. Nonterminal node IDs are negative, starting with -1. * Nonterminal -1 appears first on disk, then nonterminal -2, and so * on. */ typedef int serialized_id; /* forward declaration */ struct save_data; /** * A callback that outputs any necessary header. Should return an int * status code indicating whether the write was successful. */ typedef int (*write_header_func)(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root); /** * A callback that outputs any necessary footer. Should return an int * status code indicating whether the write was successful. */ typedef int (*write_footer_func)(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root); /** * A callback that actually outputs a terminal node to disk. Should * return an int status code indicating whether the write was successful. */ typedef int (*write_terminal_func)(struct save_data *save_data, ipset_value terminal_value); /** * A callback that actually outputs a nonterminal node to disk. * Should return an int status code indicating whether the write was * successful. */ typedef int (*write_nonterminal_func)(struct save_data *save_data, serialized_id serialized_node, ipset_variable variable, serialized_id serialized_low, serialized_id serialized_high); /** * A helper struct containing all of the persistent data items needed * during the execution of a save. */ struct save_data { /* The node cache that we're saving nodes from. */ struct ipset_node_cache *cache; /* The output stream to save the data to. */ struct cork_stream_consumer *stream; /* The cache of serialized IDs for any nonterminals that we've * encountered so far. */ struct cork_hash_table *serialized_ids; /* The serialized ID to use for the next nonterminal that we * encounter. */ serialized_id next_serialized_id; /* The callback used to write the file header to the stream. */ write_header_func write_header; /* The callback used to write the file footer to the stream. */ write_footer_func write_footer; /* The callback used to write terminals to the stream. */ write_terminal_func write_terminal; /* The callback used to write nonterminals to the stream. */ write_nonterminal_func write_nonterminal; /* A pointer to any additional data needed by the callbacks. */ void *user_data; }; /** * A helper function for ipset_node_save(). Outputs a nonterminal * node in a BDD tree, if we haven't done so already. Ensures that * the children of the nonterminal are output before the nonterminal * is. Returns the serialized ID of this node. */ static int save_visit_node(struct save_data *save_data, ipset_node_id node_id, serialized_id *dest) { /* Check whether we've already serialized this node. */ struct cork_hash_table_entry *entry; bool is_new; entry = cork_hash_table_get_or_create (save_data->serialized_ids, (void *) (uintptr_t) node_id, &is_new); if (!is_new) { *dest = (intptr_t) entry->value; return 0; } else { if (ipset_node_get_type(node_id) == IPSET_TERMINAL_NODE) { /* For terminals, there isn't really anything to do — we * just output the terminal node and use its value as the * serialized ID. */ ipset_value value = ipset_terminal_value(node_id); DEBUG("Writing terminal(%d)", value); rii_check(save_data->write_terminal(save_data, value)); entry->value = (void *) (intptr_t) value; *dest = value; return 0; } else { /* For nonterminals, we drill down into the node's children * first, then output the nonterminal node. */ struct ipset_node *node = ipset_node_cache_get_nonterminal(save_data->cache, node_id); DEBUG("Visiting node %u nonterminal(x%u? %u: %u)", node_id, node->variable, node->high, node->low); /* Output the node's nonterminal children before we output * the node itself. */ serialized_id serialized_low; serialized_id serialized_high; rii_check(save_visit_node(save_data, node->low, &serialized_low)); rii_check(save_visit_node(save_data, node->high, &serialized_high)); /* Output the nonterminal */ serialized_id result = save_data->next_serialized_id--; DEBUG("Writing node %u as serialized node %d = (x%u? %d: %d)", node_id, result, node->variable, serialized_low, serialized_high); entry->value = (void *) (intptr_t) result; *dest = result; return save_data->write_nonterminal (save_data, result, node->variable, serialized_low, serialized_high); } } } static int save_bdd(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root) { /* First, output the file header. */ DEBUG("Writing file header"); rii_check(save_data->write_header(save_data, cache, root)); /* The serialized node IDs are different than the in-memory node * IDs. This means that, for our nonterminal nodes, we need a * mapping from internal node ID to serialized node ID. */ DEBUG("Creating file caches"); save_data->serialized_ids = cork_pointer_hash_table_new(0, 0); save_data->next_serialized_id = -1; /* Trace down through the BDD tree, outputting each terminal and * nonterminal node as they're encountered. */ DEBUG("Writing nodes"); serialized_id last_serialized_id; ei_check(save_visit_node(save_data, root, &last_serialized_id)); /* Finally, output the file footer and cleanup. */ DEBUG("Writing file footer"); ei_check(save_data->write_footer(save_data, cache, root)); DEBUG("Freeing file caches"); cork_hash_table_free(save_data->serialized_ids); return 0; error: /* If there's an error, clean up the objects that we've created * before returning. */ cork_hash_table_free(save_data->serialized_ids); return -1; } /*----------------------------------------------------------------------- * Helper functions */ /** * Write a NUL-terminated string to a stream. If we can't write the * string for some reason, return an error. */ static int write_string(struct cork_stream_consumer *stream, const char *str) { size_t len = strlen(str); return cork_stream_consumer_data(stream, str, len, false); } /** * Write a big-endian uint8 to a stream. If we can't write the * integer for some reason, return an error. */ static int write_uint8(struct cork_stream_consumer *stream, uint8_t val) { /* for a byte, we don't need to endian-swap */ return cork_stream_consumer_data(stream, &val, sizeof(uint8_t), false); } /** * Write a big-endian uint16 to a stream. If we can't write the * integer for some reason, return an error. */ static int write_uint16(struct cork_stream_consumer *stream, uint16_t val) { CORK_UINT16_HOST_TO_BIG_IN_PLACE(val); return cork_stream_consumer_data(stream, &val, sizeof(uint16_t), false); } /** * Write a big-endian uint32 to a stream. If we can't write the * integer for some reason, return an error. */ static int write_uint32(struct cork_stream_consumer *stream, uint32_t val) { CORK_UINT32_HOST_TO_BIG_IN_PLACE(val); return cork_stream_consumer_data(stream, &val, sizeof(uint32_t), false); } /** * Write a big-endian uint64 to a stream. If we can't write the * integer for some reason, return an error. */ static int write_uint64(struct cork_stream_consumer *stream, uint64_t val) { CORK_UINT64_HOST_TO_BIG_IN_PLACE(val); return cork_stream_consumer_data(stream, &val, sizeof(uint64_t), false); } /*----------------------------------------------------------------------- * V1 BDD file */ static const char MAGIC_NUMBER[] = "IP set"; static const size_t MAGIC_NUMBER_LENGTH = sizeof(MAGIC_NUMBER) - 1; static int write_header_v1(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root) { /* Output the magic number for an IP set, and the file format * version that we're going to write. */ rii_check(cork_stream_consumer_data(save_data->stream, NULL, 0, true)); rii_check(write_string(save_data->stream, MAGIC_NUMBER)); rii_check(write_uint16(save_data->stream, 0x0001)); /* Determine how many reachable nodes there are, to calculate the * size of the set. */ size_t nonterminal_count = ipset_node_reachable_count(cache, root); size_t set_size = MAGIC_NUMBER_LENGTH + /* magic number */ sizeof(uint16_t) + /* version number */ sizeof(uint64_t) + /* length of set */ sizeof(uint32_t) + /* number of nonterminals */ (nonterminal_count * /* for each nonterminal: */ (sizeof(uint8_t) + /* variable number */ sizeof(uint32_t) + /* low pointer */ sizeof(uint32_t) /* high pointer */ )); /* If the root is a terminal, we need to add 4 bytes to the set * size, for storing the terminal value. */ if (ipset_node_get_type(root) == IPSET_TERMINAL_NODE) { set_size += sizeof(uint32_t); } rii_check(write_uint64(save_data->stream, set_size)); rii_check(write_uint32(save_data->stream, nonterminal_count)); return 0; } static int write_footer_v1(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root) { /* If the root is a terminal node, then we output the terminal value * in place of the (nonexistent) list of nonterminal nodes. */ if (ipset_node_get_type(root) == IPSET_TERMINAL_NODE) { ipset_value value = ipset_terminal_value(root); return write_uint32(save_data->stream, value); } return 0; } static int write_terminal_v1(struct save_data *save_data, ipset_value terminal_value) { /* We don't have to write anything out for a terminal in a V1 file, * since the terminal's value will be encoded into the node ID * wherever it's used. */ return 0; } static int write_nonterminal_v1(struct save_data *save_data, serialized_id serialized_node, ipset_variable variable, serialized_id serialized_low, serialized_id serialized_high) { rii_check(write_uint8(save_data->stream, variable)); rii_check(write_uint32(save_data->stream, serialized_low)); rii_check(write_uint32(save_data->stream, serialized_high)); return 0; } int ipset_node_cache_save(struct cork_stream_consumer *stream, struct ipset_node_cache *cache, ipset_node_id node) { struct save_data save_data; save_data.cache = cache; save_data.stream = stream; save_data.write_header = write_header_v1; save_data.write_footer = write_footer_v1; save_data.write_terminal = write_terminal_v1; save_data.write_nonterminal = write_nonterminal_v1; return save_bdd(&save_data, cache, node); } /*----------------------------------------------------------------------- * GraphViz dot file */ static const char *GRAPHVIZ_HEADER = "strict digraph bdd {\n"; static const char *GRAPHVIZ_FOOTER = "}\n"; struct dot_data { /* The terminal value to leave out of the dot file. This should be * the default value of the set or map. */ ipset_value default_value; /* A scratch buffer */ struct cork_buffer scratch; }; static int write_header_dot(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root) { /* Output the opening clause of the GraphViz script. */ rii_check(cork_stream_consumer_data(save_data->stream, NULL, 0, true)); return write_string(save_data->stream, GRAPHVIZ_HEADER); } static int write_footer_dot(struct save_data *save_data, struct ipset_node_cache *cache, ipset_node_id root) { /* Output the closing clause of the GraphViz script. */ return write_string(save_data->stream, GRAPHVIZ_FOOTER); } static int write_terminal_dot(struct save_data *save_data, ipset_value terminal_value) { struct dot_data *dot_data = save_data->user_data; /* If this terminal has the default value, skip it. */ if (terminal_value == dot_data->default_value) { return 0; } /* Output a node for the terminal value. */ cork_buffer_printf (&dot_data->scratch, " t%d [shape=box, label=%d];\n", terminal_value, terminal_value); return write_string(save_data->stream, dot_data->scratch.buf); } static int write_nonterminal_dot(struct save_data *save_data, serialized_id serialized_node, ipset_variable variable, serialized_id serialized_low, serialized_id serialized_high) { struct dot_data *dot_data = save_data->user_data; /* Include a node for the nonterminal value. */ cork_buffer_printf (&dot_data->scratch, " n%d [shape=circle,label=%u];\n", (-serialized_node), variable); /* Include an edge for the low pointer. */ if (serialized_low < 0) { /* The low pointer is a nonterminal. */ cork_buffer_append_printf (&dot_data->scratch, " n%d -> n%d", (-serialized_node), (-serialized_low)); } else { /* The low pointer is a terminal. */ ipset_value low_value = (ipset_value) serialized_low; if (low_value == dot_data->default_value) { /* The terminal is the default value, so instead of a real * terminal, connect this pointer to a dummy circle node. */ cork_buffer_append_printf (&dot_data->scratch, " low%d [shape=circle,label=\"\"]\n" " n%d -> low%d", (-serialized_node), (-serialized_node), (-serialized_node)); } else { /* The terminal isn't a default, so go ahead and output it. */ cork_buffer_append_printf (&dot_data->scratch, " n%d -> t%d", (-serialized_node), serialized_low); } } cork_buffer_append_printf (&dot_data->scratch, " [style=dashed,color=red]\n"); /* Include an edge for the high pointer. */ if (serialized_high < 0) { /* The high pointer is a nonterminal. */ cork_buffer_append_printf (&dot_data->scratch, " n%d -> n%d", (-serialized_node), (-serialized_high)); } else { /* The high pointer is a terminal. */ ipset_value high_value = (ipset_value) serialized_high; if (high_value == dot_data->default_value) { /* The terminal is the default value, so instead of a real * terminal, connect this pointer to a dummy circle node. */ cork_buffer_append_printf (&dot_data->scratch, " high%d " "[shape=circle," "fixedsize=true," "height=0.25," "width=0.25," "label=\"\"]\n" " n%d -> high%d", (-serialized_node), (-serialized_node), (-serialized_node)); } else { /* The terminal isn't a default, so go ahead and output it. */ cork_buffer_append_printf (&dot_data->scratch, " n%d -> t%d", (-serialized_node), serialized_high); } } cork_buffer_append_printf (&dot_data->scratch, " [style=solid,color=black]\n"); /* Output the clauses to the stream. */ return write_string(save_data->stream, dot_data->scratch.buf); } int ipset_node_cache_save_dot(struct cork_stream_consumer *stream, struct ipset_node_cache *cache, ipset_node_id node) { struct dot_data dot_data = { 0 /* default value */ }; struct save_data save_data; save_data.cache = cache; save_data.stream = stream; save_data.write_header = write_header_dot; save_data.write_footer = write_footer_dot; save_data.write_terminal = write_terminal_dot; save_data.write_nonterminal = write_nonterminal_dot; save_data.user_data = &dot_data; return save_bdd(&save_data, cache, node); }
31.563734
90
0.627609
f1108ca9c56de42c5169b80daaf0f5bc6800dad6
380
h
C
iOS/SocketIO_Chat_Example/SocketIO_Chat_Example/WebSocketViewController.h
CoderLanni/Socket
4e88a6ce0b7534e09a7e7a500f309aadc545b19a
[ "Apache-2.0" ]
null
null
null
iOS/SocketIO_Chat_Example/SocketIO_Chat_Example/WebSocketViewController.h
CoderLanni/Socket
4e88a6ce0b7534e09a7e7a500f309aadc545b19a
[ "Apache-2.0" ]
null
null
null
iOS/SocketIO_Chat_Example/SocketIO_Chat_Example/WebSocketViewController.h
CoderLanni/Socket
4e88a6ce0b7534e09a7e7a500f309aadc545b19a
[ "Apache-2.0" ]
null
null
null
// // WebSocketViewController.h // SocketIO_Chat_Example // // Created by yiniansiji on 2020/2/10. // Copyright © 2020 逸年四季. All rights reserved. // #import <UIKit/UIKit.h> NS_ASSUME_NONNULL_BEGIN typedef enum : NSUInteger { disConnectByUser , disConnectByServer, } DisConnectType; @interface WebSocketViewController : UIViewController @end NS_ASSUME_NONNULL_END
17.272727
53
0.757895
525280e8165a6d4678022c659fe39b7312c80f28
231
h
C
include/qtvp_global.h
WizzerWorks/QtVp
1d9d27026867941c95edb9730b2eb3f6c8cabeb0
[ "MIT" ]
1
2018-06-29T13:59:40.000Z
2018-06-29T13:59:40.000Z
include/qtvp_global.h
WizzerWorks/QtVp
1d9d27026867941c95edb9730b2eb3f6c8cabeb0
[ "MIT" ]
null
null
null
include/qtvp_global.h
WizzerWorks/QtVp
1d9d27026867941c95edb9730b2eb3f6c8cabeb0
[ "MIT" ]
1
2019-09-25T11:40:39.000Z
2019-09-25T11:40:39.000Z
#ifndef __QTVP_GLOBAL_H_ #define __QTVP_GLOBAL_H_ #include <QtCore/qglobal.h> #if defined(QTVP_LIBRARY) # define QTVPSHARED_EXPORT Q_DECL_EXPORT #else # define QTVPSHARED_EXPORT Q_DECL_IMPORT #endif #endif // __QTVP_GLOBAL_H_
17.769231
41
0.813853
f832e532c52557dd082e8d423b552bd7ba6be6f8
751
c
C
test4.c
zeebraa00/xv6_project
010844031b150937acb07f45cabb3159eb7db623
[ "MIT-0" ]
null
null
null
test4.c
zeebraa00/xv6_project
010844031b150937acb07f45cabb3159eb7db623
[ "MIT-0" ]
null
null
null
test4.c
zeebraa00/xv6_project
010844031b150937acb07f45cabb3159eb7db623
[ "MIT-0" ]
null
null
null
#include "types.h" #include "stat.h" #include "user.h" int main (int argc, char **argv) { int child; if((child = fork()) == 0) { printf(1, "\t<<state5>>\n"); if((child = fork()) == 0) { printf(1, "\t<<state7>>\n"); } else { printf(1, "\t<<state6>>\n"); setnice(child, 18); printf(1, "\t<<state8>>\n"); wait(); } } else { setnice(child, 21); printf(1, "\t<<state1>>\n"); if ((child = fork()) == 0) { printf(1, "\t<<state9>>\n"); } else { setnice(child, 22); printf(1, "\t<<state2>>\n"); if((child = fork()) == 0) { printf(1, "\t<<state4>>\n"); } else { printf(1, "\t<<state3>>\n"); setnice(child, 17); wait(); } wait(); } wait(); } exit(); }
13.654545
32
0.455393
0a097aa8c772562fd6b0473f26c6f9ce65e3d3e7
2,319
h
C
chaos/network/buffer_list.h
lchb369/chaos
95dff372002c4a04ee45b62568d46a4f50d793e4
[ "BSD-3-Clause" ]
60
2015-01-28T08:17:45.000Z
2021-02-18T06:19:15.000Z
chaos/network/buffer_list.h
lyjdamzwf/chaos
95dff372002c4a04ee45b62568d46a4f50d793e4
[ "BSD-3-Clause" ]
null
null
null
chaos/network/buffer_list.h
lyjdamzwf/chaos
95dff372002c4a04ee45b62568d46a4f50d793e4
[ "BSD-3-Clause" ]
39
2015-05-22T06:31:12.000Z
2020-03-15T13:34:27.000Z
/* * Copyright 2012, Yunjie Lu. All rights reserved. * https://github.com/lyjdamzwf/chaos * * Use of this source code is governed by a BSD-style * license that can be found in the License file. */ #ifndef _CHAOS_BUFFER_LIST_H_ #define _CHAOS_BUFFER_LIST_H_ /*! * @file buffer_list.h * @author yunjie.lu * @email lyjdamzwf@gmail.com * @weibo http://weibo.com/crazyprogramerlyj * @date 2012.6.23 * @brief buffer list * @last changed * */ #include <list> using namespace std; #include <chaos/network/msg_buffer.h> #ifndef BUF_STAT #define BUF_STAT 1 #endif namespace chaos { namespace network { #define DEFAULT_MAX_MOVE_BYTES (16*1024) class buffer_list_t { public: typedef list<msg_buffer_t>::iterator iterator_t; typedef list<msg_buffer_t>::const_iterator const_iterator_t; public: buffer_list_t(); //! yunjie: 当前read iterator指向的buffer数据地址 const char* data() const { return m_read_it->data(); } //! yunjie: 当前read iterator指向的buffer的数据字节数 uint32_t size() const { return m_read_it->size(); } //! yunjie: 当前read iterator指向的buffer的剩余可使 //! 用空间字节数 uint32_t remain_tail_capacity() const { return m_read_it->remain_tail_capacity(); } //! yunjie: 当前read iterator指向的buffer是否已经 //! 没有任何可用空间 bool is_full() const { return m_read_it->is_full(); } void set_buffer_max_limit(uint32_t size_limit_); int append( const char* data_, uint32_t size_ ); int recv_to_buffer(fd_t fd_, int& recv_ret_); void set_max_move_bytes(uint32_t bytes_); uint32_t drain_size(uint32_t size_); void clear(); string format_buffer_list_info() const; private: list<msg_buffer_t> m_buffer_list; iterator_t m_read_it; iterator_t m_write_it; uint32_t m_max_move_bytes; uint32_t m_buffer_max_limit; //! yunjie: 统计信息 uint32_t m_the_biggest_buffer_size; uint32_t m_the_biggest_list; }; } } #endif //! _CHAOS_BUFFER_LIST_H_
22.085714
73
0.597671
92ff020a18b3f4cc95b69f4cea76aa890e95479e
5,498
h
C
src/private.h
jcubic/Sparkling
b1e1688904fcffcce2aff465053d9e3d5f00a6e4
[ "BSD-2-Clause" ]
1
2019-04-27T20:22:09.000Z
2019-04-27T20:22:09.000Z
src/private.h
jcubic/Sparkling
b1e1688904fcffcce2aff465053d9e3d5f00a6e4
[ "BSD-2-Clause" ]
null
null
null
src/private.h
jcubic/Sparkling
b1e1688904fcffcce2aff465053d9e3d5f00a6e4
[ "BSD-2-Clause" ]
null
null
null
/* * private.h * Sparkling, a lightweight C-style scripting language * * Created by Árpád Goretity on 14/09/2013 * Licensed under the 2-clause BSD License * * Private parts of the Sparkling API */ #ifndef SPN_PRIVATE_H #define SPN_PRIVATE_H #include <assert.h> #include <stdarg.h> #include "api.h" #include "str.h" #if USE_DYNAMIC_LOADING #ifdef _WIN32 #include <Windows.h> #else /* _WIN32 */ #include <dlfcn.h> #endif /* _WIN32 */ #endif /* USE_DYNAMIC_LOADING */ /* convenience SpnValue-related re-defines. For internal use only! */ #define isnil(val) spn_isnil(val) #define isbool(val) spn_isbool(val) #define isnum(val) spn_isnumber(val) #define isstring(val) spn_isstring(val) #define isarray(val) spn_isarray(val) #define ishashmap(val) spn_ishashmap(val) #define isfunc(val) spn_isfunc(val) #define isuserinfo(val) spn_isuserinfo(val) #define isobject(val) spn_isobject(val) #define typetag(t) spn_typetag(t) #define typeflag(t) spn_typeflag(t) #define valtype(val) spn_valtype(val) #define valflag(val) spn_valflag(val) #define notnil(val) spn_notnil(val) #define isint(val) spn_isint(val) #define isfloat(val) spn_isfloat(val) #define isweakuserinfo(val) spn_isweakuserinfo(val) #define isstrguserinfo(val) spn_isstrguserinfo(val) #define boolvalue(val) spn_boolvalue(val) #define intvalue(val) spn_intvalue(val) #define floatvalue(val) spn_floatvalue(val) #define ptrvalue(val) spn_ptrvalue(val) #define objvalue(val) spn_objvalue(val) #define stringvalue(val) spn_stringvalue(val) #define arrayvalue(val) spn_arrayvalue(val) #define hashmapvalue(val) spn_hashmapvalue(val) #define funcvalue(val) spn_funcvalue(val) #define makebool(b) spn_makebool(b) #define makeint(i) spn_makeint(i) #define makefloat(f) spn_makefloat(f) #define makescriptfunc(n, b, e) spn_makescriptfunc((n), (b), (e)) #define maketopprgfunc(n, b, w) spn_maketopprgfunc((n), (b), (w)) #define makenativefunc(n, f) spn_makenativefunc((n), (f)) #define makeweakuserinfo(p) spn_makeweakuserinfo(p) #define makestrguserinfo(o) spn_makestrguserinfo(o) #define makeclosure(p) spn_makeclosure(p) /* invokes spn_string_new(s) */ #define makestring(s) spn_makestring(s) /* this invokes spn_string_new_nocopy(s, 0) */ #define makestring_nocopy(s) spn_makestring_nocopy(s) /* invokes spn_makestring_len((s), (n)) */ #define makestring_len(s, n) spn_makestring_len((s), (n)) /* and this invokes spn_string_new_nocopy_len(s, n, d) */ #define makestring_nocopy_len(s, n, d) spn_makestring_nocopy_len((s), (n), (d)) #define makearray() spn_makearray() #define makehashmap() spn_makehashmap() /* the following stuff is primarily (not exlusively) for use in the VM */ /* you shall not pass! (assertion for unreachable code paths) */ #define SHANT_BE_REACHED() assert(((void)("code path must not be reached"), 0)) /* number of elements in an array */ #define COUNT(a) (sizeof(a) / sizeof(a[0])) /* miminal number of n-byte long elements an s-byte long element fits into */ #define ROUNDUP(s, n) (((s) + (n) - 1) / (n)) /* macros for extracting information from a VM instruction */ #define OPCODE(i) (((i) >> 0) & 0x000000ff) #define OPA(i) (((i) >> 8) & 0x000000ff) #define OPB(i) (((i) >> 16) & 0x000000ff) #define OPC(i) (((i) >> 24) & 0x000000ff) #define OPMID(i) (((i) >> 16) & 0x0000ffff) #define OPLONG(i) (((i) >> 8) & 0x00ffffff) /* maximal number of registers per stack frame in the VM. Do not change * or hell breaks loose -- the instruction format depends on this. */ #define MAX_REG_FRAME 256 /* this is a common function so that the disassembler can use it too */ SPN_API int nth_arg_idx(spn_uword *ip, int idx); /* "safe" allocator functions */ SPN_API void *spn_malloc(size_t n); SPN_API void *spn_realloc(void *p, size_t n); SPN_API void *spn_calloc(size_t nelem, size_t elsize); /* fatal failure: prints formatted error message and 'abort()'s */ #ifdef __GNUC__ __attribute__((__noreturn__, __format__(__printf__, 1, 2))) #endif /* __GNUC__ */ SPN_API void spn_die(const char *fmt, ...); /* guess what this one does */ #ifdef __GNUC__ __attribute__((__noreturn__, __format__(__printf__, 1, 0))) #endif /* __GNUC__ */ SPN_API void spn_diev(const char *fmt, va_list args); /* this is a helper class for the virtual machine, * used for representing a pending (unresolved) symbol * "stub" in the local symbol table. */ typedef struct SymbolStub { SpnObject base; const char *name; } SymbolStub; /* creates a SymbolStub value. Does _not_ copy 'name'. */ SPN_API SpnValue make_symstub(const char *name); /* returns nonzero if 'val' represents an unresolved symbol, 0 otherwise */ SPN_API int is_symstub(const SpnValue *val); /* yields the symbol stub object of an SpnValue */ #define symstubvalue(val) ((SymbolStub *)((val)->v.o)) /* Dynamic loading support */ #if USE_DYNAMIC_LOADING #if defined(_WIN32) #define LIBRARY_EXTENSION ".dll" #elif defined(__APPLE__) #define LIBRARY_EXTENSION ".dylib" #else /* GNU/Linux and others use "so" */ #define LIBRARY_EXTENSION ".so" #endif SPN_API void *spn_open_library(SpnString *modname); SPN_API void spn_close_library(void *handle); SPN_API void *spn_get_symbol(void *handle, const char *symname); SPN_API const char *spn_dynamic_load_error(void); #endif /* USE_DYNAMIC_LOADING */ #endif /* SPN_PRIVATE_H */
32.72619
79
0.70753
363e914c036aee1cab3cfbcfc53de96d827ae1b2
367
h
C
include/codegen/codegen.h
PrinceDhaliwal/copta
396404bc7ecc3e28cc2582acd9d1c19857e6b471
[ "MIT" ]
14
2016-09-13T09:01:20.000Z
2020-07-30T08:48:32.000Z
include/codegen/codegen.h
PrinceDhaliwal/copta
396404bc7ecc3e28cc2582acd9d1c19857e6b471
[ "MIT" ]
3
2017-01-20T14:27:24.000Z
2018-05-01T14:42:41.000Z
include/codegen/codegen.h
PrinceDhaliwal/copta
396404bc7ecc3e28cc2582acd9d1c19857e6b471
[ "MIT" ]
6
2017-01-20T07:15:29.000Z
2020-05-25T03:17:40.000Z
#ifndef CODEGEN_H_ #define CODEGEN_H_ #include "jast/astvisitor.h" namespace jast { class CodeGeneratorInternal; class CodeGenerator : public ASTVisitor { public: CodeGenerator(); void Visit(IntegralLiteral *literal); void Visit(BlockStatement *statement); static void Initialize(); private: CodeGeneratorInternal *internal_; }; } #endif
14.115385
42
0.73842
1d42ba00ae6b0ceb30ea5991bbb55af12be3b494
1,787
c
C
week1/day05/tests/ex16.c
kyyninen/42-c-basecamp
d8441bb424867b94c47de96e51a8df10697d677b
[ "Unlicense" ]
2
2021-06-17T08:03:09.000Z
2021-06-17T08:03:53.000Z
week1/day05/tests/ex16.c
kyyninen/42-c-basecamp
d8441bb424867b94c47de96e51a8df10697d677b
[ "Unlicense" ]
null
null
null
week1/day05/tests/ex16.c
kyyninen/42-c-basecamp
d8441bb424867b94c47de96e51a8df10697d677b
[ "Unlicense" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ex16.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: tpolonen <tpolonen@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/06/01 04:57:38 by tpolonen #+# #+# */ /* Updated: 2021/06/01 05:32:05 by tpolonen ### ########.fr */ /* */ /* ************************************************************************** */ #include <string.h> #include <stdio.h> char *ft_strcat(char *dest, char *src); int main(void) { char src[] = "in much the same way that bricks don\'t."; char test1a[65] = "The ships hung in the sky "; char test1b[65] = "The ships hung in the sky "; char test2a[28] = "The ships hung in the sky "; char test2b[28] = "The ships hung in the sky "; printf("Strings to concatenate:\n\"%s\" (size 65)\n\"%s\"\n\n", test1a, src); printf("strcat:\n%s\nft_strcat:\n%s\n", strcat(test1a, src), ft_strcat(test1b, src)); if (strcmp(test1a, test1b) == 0) printf("It's a match :D\n\n"); else printf("KO D:\n\n"); printf("Strings to concatenate:\n\"%s\" (size 28)\n\"%s\"\n\n", test2a, src); printf("strcat:\n%s\nft_strcat:\n%s\n", strcat(test2a, src), ft_strcat(test2b, src)); if (strcmp(test2a, test2b) == 0) printf("It's a match :D\n\n"); else printf("KO D:\n\n"); return (0); }
43.585366
86
0.368215
0df92909f00227db1649ac53611eac0b6f3b0718
4,042
h
C
examples/flt2vrml/bsptree.h
billsix/profit
c01f10655d43c868b382e45361d885d2e2be6119
[ "BSD-3-Clause" ]
null
null
null
examples/flt2vrml/bsptree.h
billsix/profit
c01f10655d43c868b382e45361d885d2e2be6119
[ "BSD-3-Clause" ]
2
2021-03-17T23:30:42.000Z
2021-03-21T12:49:35.000Z
examples/flt2vrml/bsptree.h
billsix/profit
c01f10655d43c868b382e45361d885d2e2be6119
[ "BSD-3-Clause" ]
2
2020-01-01T15:24:46.000Z
2020-09-05T03:11:42.000Z
/************************************************************************** * * bsptree - the generalized alternative to quad-, and octtree datatypes. * **************************************************************************/ /**************************************************************************\ * Copyright (c) Kongsberg Oil & Gas Technologies AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \**************************************************************************/ #ifndef _SIM_BSP_TREE_H_ #define _SIM_BSP_TREE_H_ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include <profit/basics.h> /* * array arguments that are to be returned are of the type pointer to pointer * to growable arrays (the type found in array.h). */ /**************************************************************************/ void * bsp_create( int dimensions ); /* bool_t bsp_configure( void * handle, ... ); */ void bsp_destroy( void * handle ); void bsp_clear( void * handle, int approxpoints ); int bsp_get_num_points( void * handle ); int bsp_get_dimensions( void * handle ); void bsp_get_boundaries( void * handle, float * boundaries ); float ** bsp_get_point_arrays( void * handle ); void ** bsp_get_user_data_array( void * handle ); void bsp_get_point( void * handle, int idx, float * point ); void * bsp_get_user_data( void * handle, int idx ); void bsp_set_user_data( void * handle, int idx, void * user ); int bsp_add_point( void * handle, float * pos ); int bsp_remove_point( void * handle, float * pos ); void bsp_remove_point_by_idx( void * handle, int idx ); int bsp_find_point( void * handle, float * point ); void bsp_find_points( void * handle, float * point, float radius, int ** idxarray ); int bsp_find_closest( void * handle, float * point ); int bsp_find_closest_points( void * handle, float * point, float radius, int ** pointarray ); /**************************************************************************/ #define BSP_CONF_MAX_DEPTH 0x64707468 /* 'dpth' */ #define BSP_CONF_MAX_NODE_POINTS 0x706e7473 /* 'pnts' */ #define BSP_CONF_MEMORY_POOLING 0x706f6f6c /* 'pool' */ #define BSP_CONF_SPLIT_POSITION_STRATEGY 0x73706f73 /* 'spos' */ #define BSP_CONF_SPLIT_DIMENSION_STRATEGY 0x7364696d /* 'sdim' */ /**************************************************************************/ #ifdef __cplusplus }; /* extern "C" */ #endif /* __cplusplus */ #endif /* ! _SIM_BSP_TREE_H_ */
39.627451
77
0.622464
c02df1a3211ff80a849e782d84acb3fd05e35325
140
h
C
main/main.h
thebombshell/atlas_x
962c264cdb758ac53f92513dffc4f4026b82c59d
[ "MIT" ]
null
null
null
main/main.h
thebombshell/atlas_x
962c264cdb758ac53f92513dffc4f4026b82c59d
[ "MIT" ]
null
null
null
main/main.h
thebombshell/atlas_x
962c264cdb758ac53f92513dffc4f4026b82c59d
[ "MIT" ]
null
null
null
#include <stdio.h> #include <ctype.h> #define CLOCKS_PER_SECOND 60 char is_key_down(char t_key); #define VK_CHAR(T_X) (char)tolower(T_X)
15.555556
39
0.75
35c1262a44ff4c68a28e851715922631ef40a945
328
h
C
arcane/src/arcane/hyoda/gui/QHyodaToolMatrix.h
cedricga91/framework
143eeccb5bf375df4a3f11b888681f84f60380c6
[ "Apache-2.0" ]
null
null
null
arcane/src/arcane/hyoda/gui/QHyodaToolMatrix.h
cedricga91/framework
143eeccb5bf375df4a3f11b888681f84f60380c6
[ "Apache-2.0" ]
null
null
null
arcane/src/arcane/hyoda/gui/QHyodaToolMatrix.h
cedricga91/framework
143eeccb5bf375df4a3f11b888681f84f60380c6
[ "Apache-2.0" ]
null
null
null
#ifndef Q_HYODA_JOB_TOOL_MATRIX_H #define Q_HYODA_JOB_TOOL_MATRIX_H #include <QtWidgets> #include "QHyodaIceT.h" #include "ui_hyodaMatrix.h" class QHyodaToolMatrix: public QWidget, public Ui::toolMatrixWidget{ Q_OBJECT public: QHyodaToolMatrix(QTabWidget*); ~QHyodaToolMatrix(); }; #endif // Q_HYODA_JOB_TOOL_MATRIX_H
21.866667
69
0.79878
a36973f4634f17d4b3671652a60514280a39a219
4,212
h
C
B2G/hardware/ti/wlan/wl1271/stad/src/Connection_Managment/smePrivate.h
wilebeast/FireFox-OS
43067f28711d78c429a1d6d58c77130f6899135f
[ "Apache-2.0" ]
3
2015-08-31T15:24:31.000Z
2020-04-24T20:31:29.000Z
B2G/hardware/ti/wlan/wl1271/stad/src/Connection_Managment/smePrivate.h
wilebeast/FireFox-OS
43067f28711d78c429a1d6d58c77130f6899135f
[ "Apache-2.0" ]
null
null
null
B2G/hardware/ti/wlan/wl1271/stad/src/Connection_Managment/smePrivate.h
wilebeast/FireFox-OS
43067f28711d78c429a1d6d58c77130f6899135f
[ "Apache-2.0" ]
3
2015-07-29T07:17:15.000Z
2020-11-04T06:55:37.000Z
/* * smePrivate.h * * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name Texas Instruments nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** \file smePrivate.h * \brief SME private declaratnions * * \see sme.c, sme.h, smeSm.c */ #ifndef __SME_PRIVATE_H__ #define __SME_PRIVATE_H__ #include "tidef.h" #include "TWDriver.h" #include "sme.h" #include "scanResultTable.h" typedef struct { mgmtStatus_e eMgmtStatus; /* Contains the last DisAssociation reason towards upper layer */ TI_UINT32 uStatusCode; /* Extra information to the reason. i.e. packet status code or roaming trigger */ } TDisAssocReason; typedef struct { /* Handles to other modules */ TI_HANDLE hOS; TI_HANDLE hReport; TI_HANDLE hScanCncn; TI_HANDLE hApConn; TI_HANDLE hConn; TI_HANDLE hScr; TI_HANDLE hRegDomain; TI_HANDLE hEvHandler; TI_HANDLE hSiteMgr; TI_HANDLE hRsn; TI_HANDLE hScanResultTable; /* Working table - points to one of the next two tables */ TI_HANDLE hSmeScanResultTable; /* Sme local table */ TI_HANDLE hScanCncnScanResulTable; /* Scan Cncn table - table used by the application */ TI_HANDLE hSmeSm; TI_HANDLE hDrvMain; TI_HANDLE hTwd; /* parameters */ TI_BOOL bRadioOn; EConnectMode eConnectMode; ScanBssType_e eBssType; TMacAddr tBssid; ESsidType eSsidType; TSsid tSsid; /* internal state-machine variables */ TI_BOOL bConnectRequired; TI_BOOL bRunning; EConnectMode eLastConnectMode; TI_BOOL bAuthSent; TI_UINT32 uScanCount; TI_BOOL bReselect; /* for SG Avalanche */ TI_BOOL bConstantScan; /* scan constantly, for WSC PB mode */ TSiteEntry *pCandidate; TSiteEntry tCandidate; /* used to store the selected entry of sme_Select*/ TDisAssocReason tDisAssoc; TSmeInitParams tInitParams; TPeriodicScanParams tScanParams; /* temporary storage for scan command */ } TSme; TSiteEntry *sme_Select (TI_HANDLE hSme); #endif /* __SME_PRIVATE_H__ */
40.114286
119
0.610636
0d59221b1343710abc962a8a4721dbd5a29d240e
279
c
C
recipes/tree-sitter/all/test_package/test_package.c
dvirtz/conan-center-index
2e7a6337804325616f8d97e3a5b6f66cc72699cb
[ "MIT" ]
562
2019-09-04T12:23:43.000Z
2022-03-29T16:41:43.000Z
recipes/tree-sitter/all/test_package/test_package.c
dvirtz/conan-center-index
2e7a6337804325616f8d97e3a5b6f66cc72699cb
[ "MIT" ]
9,799
2019-09-04T12:02:11.000Z
2022-03-31T23:55:45.000Z
recipes/tree-sitter/all/test_package/test_package.c
dvirtz/conan-center-index
2e7a6337804325616f8d97e3a5b6f66cc72699cb
[ "MIT" ]
1,126
2019-09-04T11:57:46.000Z
2022-03-31T16:43:38.000Z
#include <tree_sitter/api.h> #include <stdio.h> //More datailed example search at https://tree-sitter.github.io/tree-sitter/using-parsers#getting-started int main() { TSParser *parser = ts_parser_new(); ts_parser_delete(parser); printf( "Test package\n" ); return 0; }
23.25
105
0.724014
0d70d33cce88ba2d31be6be637f41255303626ca
1,455
h
C
SMCCP/SMCCP/Defines.h
TobiasNienhaus/SMCCP
76eba4638e75be9fafdd92445e0eb043b9025e01
[ "BSD-3-Clause" ]
null
null
null
SMCCP/SMCCP/Defines.h
TobiasNienhaus/SMCCP
76eba4638e75be9fafdd92445e0eb043b9025e01
[ "BSD-3-Clause" ]
null
null
null
SMCCP/SMCCP/Defines.h
TobiasNienhaus/SMCCP
76eba4638e75be9fafdd92445e0eb043b9025e01
[ "BSD-3-Clause" ]
1
2017-03-20T22:50:19.000Z
2017-03-20T22:50:19.000Z
#pragma once #include <Windows.h> #include <functional> //Max length of name //Will fit in all name boxes (15) #define MAX_NAME_LENGTH 15 #define VERSION "v3.0.0a1" //#define FONT_NORM "GOTHIC.TTF" //#define FONT_BOLD "GOTHICB.TTF" //#define FONT_IT "GOTHICI.TTF" //#define FONT_BOLD_IT "GOTHICBI.TTF" //#define FONT_NORM "times.ttf" //#define FONT_BOLD "timesbd.ttf" //#define FONT_NORM "HTOWERT.ttf" //#define FONT_BOLD "GOTHICB.TTF" //#define FONT_IT "HTOWERTI.ttf" //#define FONT_BOLD_IT "GOTHICBI.TTF" #define FONT_NORM "IBMPlexSans-Regular.ttf" #define FONT_BOLD "IBMPlexSans-Bold.ttf" #define FONT_IT "IBMPLexSans-Italic.ttf" #define FONT_BOLD_IT "IBMPlexSans-BoldItalic.ttf" #define FONT_UNICODE "unifont-9.0.06.ttf" //INFO: using whirlpool hash //can be replaced with any string can only be used by server in code due to things that are added in user accesible functions #define SHUTDOWN_MSG "53f433188a63f84e5486e5ab0118731b939fd3ac5990f9e1b46c162b50dc620832a11636331d22530e5689b4ae6f94972812834adf3151c9fddb65d85a03beac" //send this at the start of the message, if the client should not play a sound on receiving #define NO_SOUND_MSG "SljyXBZyQq" #define NO_SOUND_MSG_LENGTH 10 constexpr auto DEFAULT_PORT = 1234; //TODO have as Setting in extra window //#define DISCORD_RICH_PRESENCE #ifdef DISCORD_RICH_PRESENCE #define DISCORD_CLIENT_ID "471051566816952331" #define DISCORD_CLIENT_SECRET "HipSuS-T48DtHBmViqGvkgUzAl12et0Y" #endif
32.333333
151
0.797251
b89ea531d833c937bd3c0b34ede85ddc7318440c
5,653
h
C
src/LRRMonitor/Gods98My/Viewports.h
trigger-segfault/legorockraiders-analysis
38a3dd5dd35c141f1acbdbe320e11adc1f3e9660
[ "MIT" ]
9
2021-09-03T23:52:55.000Z
2022-03-19T01:05:40.000Z
src/LRRMonitor/Gods98My/Viewports.h
trigger-segfault/legorockraiders-analysis
38a3dd5dd35c141f1acbdbe320e11adc1f3e9660
[ "MIT" ]
null
null
null
src/LRRMonitor/Gods98My/Viewports.h
trigger-segfault/legorockraiders-analysis
38a3dd5dd35c141f1acbdbe320e11adc1f3e9660
[ "MIT" ]
null
null
null
#pragma once #include "../framework.h" #include "Maths.h" namespace Gods98 {; // !<--- /********************************************************************************** ******** Forward Declarations **********************************************************************************/ #pragma region Forward Declarations struct Container; #pragma endregion /********************************************************************************** ******** Function Typedefs **********************************************************************************/ #pragma region Function Typedefs #pragma endregion /********************************************************************************** ******** Constants **********************************************************************************/ #pragma region Constants #define VIEWPORT_MAXLISTS 32 // 2^32 - 1 possible viewports... #pragma endregion /********************************************************************************** ******** Enumerations **********************************************************************************/ #pragma region Enums #define VIEWPORT_FLAG_INITIALISED 0x00000001 #pragma endregion /********************************************************************************** ******** Structures **********************************************************************************/ #pragma region Structs typedef struct Viewport { /*00,4*/ float xoffset; /*04,4*/ float yoffset; // Position on viewport normalised to between 0.0 and 1.0 /*08,4*/ float width; /*0c,4*/ float height; // Width and height of the viewport normalised as above /*10,4*/ IDirect3DRMViewport2* lpVP; // Pointer to D3D viewport interface /*14,4*/ float smoothFOV; /*18,4*/ BOOL rendering; /*1c,4*/ Viewport* nextFree; /*20*/ } Viewport, *lpViewport; static_assert(sizeof(Viewport) == 0x20, ""); typedef struct Viewport_PickInfo { /*00,4*/ Container* pickCont; /*04,4*/ unsigned long group; /*08,4*/ unsigned long face; /*0c,c*/ VECTOR3D position; /*18*/ } Viewport_PickInfo, *lpViewport_PickInfo; static_assert(sizeof(Viewport_PickInfo) == 0x18, ""); typedef struct Viewport_Pick { /*0,4*/ Viewport_PickInfo* pickArray; /*4,4*/ unsigned long pickCount; /*8*/ } Viewport_Pick, *lpViewport_Pick; static_assert(sizeof(Viewport_Pick) == 0x8, ""); typedef struct Viewport_Globs { /*00,80*/ Viewport* listSet[VIEWPORT_MAXLISTS]; /*80,4*/ Viewport* freeList; /*84,4*/ unsigned long listCount; /*88,4*/ unsigned long flags; /*8c*/ } Viewport_Globs; static_assert(sizeof(Viewport_Globs) == 0x8c, ""); #pragma endregion /********************************************************************************** ******** Globals **********************************************************************************/ #pragma region Globals // <LegoRR.exe @0076bce0> extern Viewport_Globs viewportGlobs; #pragma endregion /********************************************************************************** ******** Macros **********************************************************************************/ #pragma region Macros #ifdef DEBUG #define Viewport_CheckInit() if (!(viewportGlobs.flags & VIEWPORT_FLAG_INITIALISED)) Error_Fatal(TRUE, "Error: Viewport_Intitialise() Has Not Been Called"); #else #define Viewport_CheckInit() #endif #pragma endregion /********************************************************************************** ******** Functions **********************************************************************************/ #pragma region Functions // <LegoRR.exe @00477010> void __cdecl Viewport_Initialise(void); // <LegoRR.exe @00477040> void __cdecl Viewport_Shutdown(void); // <LegoRR.exe @00477080> Viewport* __cdecl Viewport_Create(float xPos, float yPos, float width, float height, Container* camera); // <LegoRR.exe @00477110> Viewport* __cdecl Viewport_CreatePixel(long xPos, long yPos, unsigned long width, unsigned long height, Container* camera); // <LegoRR.exe @004771d0> void __cdecl Viewport_GetSize(Viewport* vp, OUT unsigned long* width, OUT unsigned long* height); // <LegoRR.exe @00477210> void __cdecl Viewport_SetCamera(Viewport* vp, Container* cont); // <LegoRR.exe @00477230> Container* __cdecl Viewport_GetCamera(Viewport* vp); // <LegoRR.exe @00477270> Container* __cdecl Viewport_SetBackClip(Viewport* vp, float dist); // <LegoRR.exe @00477290> float __cdecl Viewport_GetBackClip(Viewport* vp); // <LegoRR.exe @004772b0> float __cdecl Viewport_GetFrontClip(Viewport* vp); // <LegoRR.exe @004772d0> void __cdecl Viewport_Clear(Viewport* vp, BOOL full); // <LegoRR.exe @00477410> void __cdecl Viewport_Clear(Viewport* vp, Container* root, float delta); // <LegoRR.exe @004774e0> void __cdecl Viewport_Remove(Viewport* dead); // <LegoRR.exe @00477500> void __cdecl Viewport_SmoothSetField(Viewport* vp, float fov); // <LegoRR.exe @00477510> void __cdecl Viewport_SetField(Viewport* vp, float fov); // <LegoRR.exe @00477530> float __cdecl Viewport_GetField(Viewport* vp); // <LegoRR.exe @00477550> void __cdecl Viewport_InverseTransform(Viewport* vp, OUT VECTOR3D* dest, const VECTOR4D* src); // <LegoRR.exe @00477570> void __cdecl Viewport_Transform(Viewport* vp, OUT VECTOR4D* dest, const VECTOR3D* src); // <LegoRR.exe @00477590> VECTOR2D* __cdecl Viewport_WorldToScreen(Viewport* vp, OUT VECTOR2D* screen, const VECTOR3D* world); // <LegoRR.exe @004775d0> IDirect3DRMFrame3* __cdecl Viewport_GetScene(Viewport* vp); // <LegoRR.exe @00477630> void __cdecl Viewport_AddList(void); // <LegoRR.exe @004776a0> void __cdecl Viewport_RemoveAll(void); #pragma endregion }
28.124378
159
0.556696