hexsha stringlengths 40 40 | size int64 5 2.72M | ext stringclasses 5
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 976 | max_stars_repo_name stringlengths 5 113 | max_stars_repo_head_hexsha stringlengths 40 78 | 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:01:43 2022-03-31 23:59:48 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 00:06:24 2022-03-31 23:59:53 ⌀ | max_issues_repo_path stringlengths 3 976 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | 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 976 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | 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:19 2022-03-31 23:59:49 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 12:00:57 2022-03-31 23:59:49 ⌀ | content stringlengths 5 2.72M | avg_line_length float64 1.38 573k | max_line_length int64 2 1.01M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
4dd4747f989444ff1e24482553f687162b217058 | 165 | h | C | b.h | urbasus/cpp-include-once | 42e80b73bfa5b5cd088726f9fd032d8bd737a78f | [
"MIT"
] | null | null | null | b.h | urbasus/cpp-include-once | 42e80b73bfa5b5cd088726f9fd032d8bd737a78f | [
"MIT"
] | null | null | null | b.h | urbasus/cpp-include-once | 42e80b73bfa5b5cd088726f9fd032d8bd737a78f | [
"MIT"
] | null | null | null | // include null file next time
#undef B_H
#define B_H NULL_H
// include "c.h", or null if already included
#include C_H
static inline int b()
{
return c() + 3;
}
| 13.75 | 45 | 0.678788 |
060bba92ea4fbeead93d025174b99f3598d11f79 | 207 | h | C | flowkit/utils_c_ext/utils.h | whitews/FlowK | d4e43a0488606ce5479b5110486dc3db128f6a87 | [
"BSD-3-Clause"
] | 73 | 2019-02-18T01:03:06.000Z | 2022-03-18T14:03:01.000Z | flowkit/utils_c_ext/utils.h | whitews/FlowK | d4e43a0488606ce5479b5110486dc3db128f6a87 | [
"BSD-3-Clause"
] | 90 | 2019-01-28T22:04:04.000Z | 2022-03-31T16:40:14.000Z | flowkit/utils_c_ext/utils.h | whitews/FlowK | d4e43a0488606ce5479b5110486dc3db128f6a87 | [
"BSD-3-Clause"
] | 8 | 2019-08-19T16:58:48.000Z | 2022-01-11T08:55:23.000Z | int calc_wind_count(double point_x, double point_y, int vert_count, double *poly_vertices);
int * points_in_polygon(int *wind_counts, double *poly_vertices, int vert_count, double *points, int point_count);
| 69 | 114 | 0.811594 |
0611ec70bbeeecbef2ace4ec503d5350cc5bd379 | 885 | h | C | libcamera/utils.h | KB-JetDroid/android_device_samsung_jet | d05bd991a58765e048e85ecf02b08dbaabb7b4a3 | [
"Apache-2.0"
] | 1 | 2015-09-26T20:30:02.000Z | 2015-09-26T20:30:02.000Z | libcamera/utils.h | KB-JetDroid/android_device_samsung_jet | d05bd991a58765e048e85ecf02b08dbaabb7b4a3 | [
"Apache-2.0"
] | null | null | null | libcamera/utils.h | KB-JetDroid/android_device_samsung_jet | d05bd991a58765e048e85ecf02b08dbaabb7b4a3 | [
"Apache-2.0"
] | null | null | null | #ifndef _LIBCAMERA_UTILS_H_
#define _LIBCAMERA_UTILS_H_
#define DEBUG
#define DEBUG_TRACE
#ifdef DEBUG
#define DBG(format, ...) \
LOGD("DBG(%s): " format, __func__, ##__VA_ARGS__)
#else
#define DBG(format, ...)
#endif
#ifdef DEBUG_TRACE
class Tracer {
const char *name;
static int level;
public:
Tracer(const char *name) :
name(name)
{
++level;
LOG(LOG_VERBOSE, "Tracer", "%*s %s enter", 2*level, ">", name);
}
~Tracer()
{
LOG(LOG_VERBOSE, "Tracer", "%*s %s leave", 2*level, "<", name);
--level;
}
};
#define TRACE() \
Tracer __tracer__LINE__(__func__)
#else
#define TRACE()
#endif
#define ERR(format, ...) \
LOGE("ERR(%s): " format, __func__, ##__VA_ARGS__)
template <typename T>
static inline T max(const T &a, const T &b)
{
if (b > a)
return b;
return a;
}
#define ARRAY_SIZE(x) (sizeof((x)) / sizeof((x)[0]))
#endif /* _LIBCAMERA_UTILS_H_ */
| 17.019231 | 65 | 0.640678 |
061370665e01c6c6768f52e01f6dfb7116e82a5f | 541 | c | C | src/009-special-pythagorean-triplet/c/test/solve_test.c | xfbs/ProjectEulerRust | e26768c56ff87b029cb2a02f56dc5cd32e1f7c87 | [
"MIT"
] | 1 | 2018-01-26T21:18:12.000Z | 2018-01-26T21:18:12.000Z | src/009-special-pythagorean-triplet/c/test/solve_test.c | xfbs/ProjectEulerRust | e26768c56ff87b029cb2a02f56dc5cd32e1f7c87 | [
"MIT"
] | 3 | 2017-12-09T14:49:30.000Z | 2017-12-09T14:59:39.000Z | src/009-special-pythagorean-triplet/c/test/solve_test.c | xfbs/ProjectEulerRust | e26768c56ff87b029cb2a02f56dc5cd32e1f7c87 | [
"MIT"
] | null | null | null | #define EULER_TEST_MAIN
#include "solve.h"
#include <euler/test.h>
void test_solve() { assert(60 == solve(12)); }
void test_is_pythagorean_triplet() {
assert(is_pythagorean_triplet(3, 4, 5) == true);
assert(is_pythagorean_triplet(3, 4, 6) == false);
assert(is_pythagorean_triplet(4, 3, 5) == false);
assert(is_pythagorean_triplet(20, 21, 29) == true);
assert(is_pythagorean_triplet(48, 55, 73) == true);
assert(is_pythagorean_triplet(48, 55, 74) == false);
}
TESTS() {
RUN(test_solve);
RUN(test_is_pythagorean_triplet);
}
| 27.05 | 54 | 0.704251 |
06139ff5beaf2a4b5674ce5d5637462c7103d1af | 107 | h | C | src/qt/src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/profiler/Profiler.h | ant0ine/phantomjs | 8114d44a28134b765ab26b7e13ce31594fa81253 | [
"BSD-3-Clause"
] | 46 | 2015-01-08T14:32:34.000Z | 2022-02-05T16:48:26.000Z | src/qt/src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/profiler/Profiler.h | ant0ine/phantomjs | 8114d44a28134b765ab26b7e13ce31594fa81253 | [
"BSD-3-Clause"
] | 7 | 2015-01-20T14:28:12.000Z | 2017-01-18T17:21:44.000Z | src/qt/src/3rdparty/webkit/Source/WebCore/ForwardingHeaders/profiler/Profiler.h | ant0ine/phantomjs | 8114d44a28134b765ab26b7e13ce31594fa81253 | [
"BSD-3-Clause"
] | 14 | 2015-10-27T06:17:48.000Z | 2020-03-03T06:15:50.000Z | #ifndef WebCore_FWD_Profiler_h
#define WebCore_FWD_Profiler_h
#include <JavaScriptCore/Profiler.h>
#endif
| 17.833333 | 36 | 0.850467 |
0613e0982b8f0bf9db8318ab31b9b13a4c7406ba | 1,166 | c | C | srcs/libft/ft_strncmp.c | Imgox/Fractol_1337 | 31e5e0c0802f864b9d46eeb58134067cae6227d0 | [
"MIT"
] | null | null | null | srcs/libft/ft_strncmp.c | Imgox/Fractol_1337 | 31e5e0c0802f864b9d46eeb58134067cae6227d0 | [
"MIT"
] | null | null | null | srcs/libft/ft_strncmp.c | Imgox/Fractol_1337 | 31e5e0c0802f864b9d46eeb58134067cae6227d0 | [
"MIT"
] | 2 | 2019-10-31T22:03:53.000Z | 2020-01-07T19:41:07.000Z | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strncmp.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: slaanani <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/05/26 04:41:50 by slaanani #+# #+# */
/* Updated: 2019/05/26 04:41:52 by slaanani ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
int ft_strncmp(const char *s1, const char *s2, size_t n)
{
size_t i;
i = 0;
while (i <= ft_strlen(s1) && i < n)
{
if ((unsigned char)s1[i] != (unsigned char)s2[i])
return ((unsigned char)s1[i] - (unsigned char)s2[i]);
i++;
}
return (0);
}
| 41.642857 | 80 | 0.217839 |
0617d1a000dc94e0f2b9ea8826a6bb393fae9be3 | 398 | h | C | project/Component/NefCarbon/Support Files/NefCarbon.h | chenrui333/nef | cc9210bb4151cb502a71e5b7a1e6166735f834b5 | [
"Apache-2.0"
] | 265 | 2018-12-19T16:17:22.000Z | 2022-03-29T07:39:00.000Z | project/Component/NefCarbon/Support Files/NefCarbon.h | chenrui333/nef | cc9210bb4151cb502a71e5b7a1e6166735f834b5 | [
"Apache-2.0"
] | 73 | 2019-01-02T12:17:18.000Z | 2022-01-19T18:55:43.000Z | project/Component/NefCarbon/Support Files/NefCarbon.h | chenrui333/nef | cc9210bb4151cb502a71e5b7a1e6166735f834b5 | [
"Apache-2.0"
] | 11 | 2019-04-18T12:31:38.000Z | 2022-01-29T15:01:48.000Z | // Copyright © 2019 The nef Authors.
#import <Cocoa/Cocoa.h>
//! Project version number for NefCarbon.
FOUNDATION_EXPORT double NefCarbonVersionNumber;
//! Project version string for NefCarbon.
FOUNDATION_EXPORT const unsigned char NefCarbonVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <NefCarbon/PublicHeader.h>
| 33.166667 | 134 | 0.79397 |
061845535ec1a403022d64fd26961df39e4c1dd5 | 1,188 | c | C | libft/ft_memcpy.c | svassal/Wolf_3D | 7b2ba1e8b313ed0cec62be43d221f40ea4ee66e7 | [
"MIT"
] | null | null | null | libft/ft_memcpy.c | svassal/Wolf_3D | 7b2ba1e8b313ed0cec62be43d221f40ea4ee66e7 | [
"MIT"
] | null | null | null | libft/ft_memcpy.c | svassal/Wolf_3D | 7b2ba1e8b313ed0cec62be43d221f40ea4ee66e7 | [
"MIT"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_memcpy.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: svassal <svassal@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/03/03 14:42:30 by svassal #+# #+# */
/* Updated: 2016/03/10 12:58:57 by svassal ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void *ft_memcpy(void *dst, const void *src, size_t n)
{
size_t index;
unsigned char *cpy;
unsigned char *cpy2;
index = 0;
cpy = (unsigned char *)dst;
cpy2 = (unsigned char *)src;
while (index < n)
{
*cpy = *cpy2;
cpy++;
cpy2++;
index++;
}
return (dst);
}
| 36 | 80 | 0.231481 |
061b2bb228b8be9b088ff16a475d47cc275e1189 | 6,985 | c | C | Openharmony v1.0/third_party/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c | clkbit123/TheOpenHarmony | 0e6bcd9dee9f1a2481d762966b8bbd24baad6159 | [
"MIT"
] | 1 | 2022-02-15T08:51:55.000Z | 2022-02-15T08:51:55.000Z | hihope_neptune-oh_hid/00_src/v0.3/third_party/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c | dawmlight/vendor_oh_fun | bc9fb50920f06cd4c27399f60076f5793043c77d | [
"Apache-2.0"
] | null | null | null | hihope_neptune-oh_hid/00_src/v0.3/third_party/ltp/testcases/kernel/syscalls/clock_adjtime/clock_adjtime01.c | dawmlight/vendor_oh_fun | bc9fb50920f06cd4c27399f60076f5793043c77d | [
"Apache-2.0"
] | null | null | null | // SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (c) 2019 Linaro Limited. All rights reserved.
* Author: Rafael David Tinoco <rafael.tinoco@linaro.org>
*/
/*
* clock_adjtime() syscall might have as execution path:
*
* 1) a regular POSIX clock (only REALTIME clock implements adjtime())
* - will behave exactly like adjtimex() system call.
* - only one being tested here.
*
* 2) a dynamic POSIX clock (which ops are implemented by PTP clocks)
* - will trigger the PTP clock driver function "adjtime()"
* - different implementations from one PTP clock to another
* - might return EOPNOTSUPP (like ptp_kvm_caps, for example)
* - no entry point for clock_adjtime(), missing "CLOCK_PTP" model
*
* so it is sane to check possible adjustments:
*
* - ADJ_OFFSET - usec or nsec, kernel adjusts time gradually by offset
* (-512000 < offset < 512000)
* - ADJ_FREQUENCY - system clock frequency offset
* - ADJ_MAXERROR - maximum error (usec)
* - ADJ_ESTERROR - estimated time error in us
* - ADJ_STATUS - clock command/status of ntp implementation
* - ADJ_TIMECONST - PLL stiffness (jitter dependent) + poll int for PLL
* - ADJ_TICK - us between clock ticks
* (>= 900000/HZ, <= 1100000/HZ)
*
* and also the standalone ones (using .offset variable):
*
* - ADJ_OFFSET_SINGLESHOT - behave like adjtime()
* - ADJ_OFFSET_SS_READ - ret remaining time for completion after SINGLESHOT
*
* For ADJ_STATUS, consider the following flags:
*
* rw STA_PLL - enable phase-locked loop updates (ADJ_OFFSET)
* rw STA_PPSFREQ - enable PPS (pulse-per-second) freq discipline
* rw STA_PPSTIME - enable PPS time discipline
* rw STA_FLL - select freq-locked loop mode.
* rw STA_INS - ins leap sec after the last sec of UTC day (all days)
* rw STA_DEL - del leap sec at last sec of UTC day (all days)
* rw STA_UNSYNC - clock unsynced
* rw STA_FREQHOLD - hold freq. ADJ_OFFSET made w/out auto small adjs
* ro STA_PPSSIGNAL - valid PPS (pulse-per-second) signal is present
* ro STA_PPSJITTER - PPS signal jitter exceeded.
* ro STA_PPSWANDER - PPS signal wander exceeded.
* ro STA_PPSERROR - PPS signal calibration error.
* ro STA_CLOKERR - clock HW fault.
* ro STA_NANO - 0 = us, 1 = ns (set = ADJ_NANO, cl = ADJ_MICRO)
* rw STA_MODE - mode: 0 = phased locked loop. 1 = freq locked loop
* ro STA_CLK - clock source. unused.
*/
#include "clock_adjtime.h"
static long hz;
static struct tst_timex saved, ttxc;
static int supported;
struct test_case {
unsigned int modes;
long highlimit;
long delta;
};
struct test_case tc[] = {
{
.modes = ADJ_OFFSET_SINGLESHOT,
},
{
.modes = ADJ_OFFSET_SS_READ,
},
{
.modes = ADJ_ALL,
},
{
.modes = ADJ_OFFSET,
.highlimit = 500000,
.delta = 10000,
},
{
.modes = ADJ_FREQUENCY,
.delta = 100,
},
{
.modes = ADJ_MAXERROR,
.delta = 100,
},
{
.modes = ADJ_ESTERROR,
.delta = 100,
},
{
.modes = ADJ_TIMECONST,
.delta = 1,
},
{
.modes = ADJ_TICK,
.highlimit = 1100000,
.delta = 1000,
},
};
static struct test_variants {
int (*clock_adjtime)(clockid_t clk_id, void *timex);
enum tst_timex_type type;
char *desc;
} variants[] = {
#if (__NR_clock_adjtime != __LTP__NR_INVALID_SYSCALL)
{.clock_adjtime = sys_clock_adjtime, .type = TST_KERN_OLD_TIMEX, .desc = "syscall with old kernel spec"},
#endif
#if (__NR_clock_adjtime64 != __LTP__NR_INVALID_SYSCALL)
{.clock_adjtime = sys_clock_adjtime64, .type = TST_KERN_TIMEX, .desc = "syscall time64 with kernel spec"},
#endif
};
static void verify_clock_adjtime(unsigned int i)
{
struct test_variants *tv = &variants[tst_variant];
struct tst_timex verify;
long long val;
int rval;
memset(&ttxc, 0, sizeof(ttxc));
memset(&verify, 0, sizeof(verify));
ttxc.type = verify.type = tv->type;
rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&ttxc));
if (rval < 0) {
tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
return;
}
timex_show("GET", &ttxc);
timex_set_field_uint(&ttxc, ADJ_MODES, tc[i].modes);
if (tc[i].delta) {
val = timex_get_field_long(&ttxc, tc[i].modes);
val += tc[i].delta;
/* fix limits, if existent, so no errors occur */
if (tc[i].highlimit && val >= tc[i].highlimit)
val = tc[i].highlimit;
timex_set_field_long(&ttxc, tc[i].modes, val);
}
rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&ttxc));
if (rval < 0) {
tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
return;
}
timex_show("SET", &ttxc);
rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&verify));
if (rval < 0) {
tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
return;
}
timex_show("VERIFY", &verify);
if (tc[i].delta &&
timex_get_field_long(&ttxc, tc[i].modes) !=
timex_get_field_long(&verify, tc[i].modes)) {
tst_res(TFAIL, "clock_adjtime(): could not set value (mode=%x)",
tc[i].modes);
}
if (TST_RET < 0) {
tst_res(TFAIL | TTERRNO, "clock_adjtime(): mode=%x, returned "
"error", tc[i].modes);
}
tst_res(TPASS, "clock_adjtime(): success (mode=%x)", tc[i].modes);
}
static void setup(void)
{
struct test_variants *tv = &variants[tst_variant];
size_t i;
int rval;
tst_res(TINFO, "Testing variant: %s", tv->desc);
saved.type = tv->type;
rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
if (rval < 0) {
tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
return;
}
supported = 1;
if (rval != TIME_OK && rval != TIME_ERROR) {
timex_show("SAVE_STATUS", &saved);
tst_brk(TBROK | TTERRNO, "clock has on-going leap changes, "
"returned: %i", rval);
}
hz = SAFE_SYSCONF(_SC_CLK_TCK);
for (i = 0; i < ARRAY_SIZE(tc); i++) {
/* fix high and low limits by dividing it per HZ value */
if (tc[i].modes == ADJ_TICK)
tc[i].highlimit /= hz;
/* fix usec as being test default resolution */
if (timex_get_field_uint(&saved, ADJ_MODES) & ADJ_NANO) {
if (tc[i].modes == ADJ_OFFSET) {
tc[i].highlimit *= 1000;
tc[i].delta *= 1000;
}
}
}
}
static void cleanup(void)
{
struct test_variants *tv = &variants[tst_variant];
unsigned int modes = ADJ_ALL;
int rval;
if (supported == 0)
return;
/* restore clock resolution based on original status flag */
if (timex_get_field_uint(&saved, ADJ_STATUS) & STA_NANO)
modes |= ADJ_NANO;
else
modes |= ADJ_MICRO;
timex_set_field_uint(&saved, ADJ_MODES, modes);
/* restore original clock flags */
rval = tv->clock_adjtime(CLOCK_REALTIME, tst_timex_get(&saved));
if (rval < 0) {
tst_res(TFAIL | TERRNO, "clock_adjtime() failed %i", rval);
return;
}
}
static struct tst_test test = {
.test = verify_clock_adjtime,
.setup = setup,
.cleanup = cleanup,
.tcnt = ARRAY_SIZE(tc),
.test_variants = ARRAY_SIZE(variants),
.needs_root = 1,
.restore_wallclock = 1,
};
| 26.458333 | 107 | 0.65927 |
061bba27125f0d2f28c11d911fd4fbbeaf2356ba | 5,512 | h | C | include/pottery/intro_sort/impl/pottery_intro_sort_config_lifecycle.t.h | ludocode/pottery | 437b071ee8dd496a8a2d47c1db2643eaa82dc34d | [
"MIT"
] | 85 | 2020-12-17T01:21:32.000Z | 2022-03-25T10:47:00.000Z | include/pottery/intro_sort/impl/pottery_intro_sort_config_lifecycle.t.h | ludocode/pottery | 437b071ee8dd496a8a2d47c1db2643eaa82dc34d | [
"MIT"
] | 3 | 2020-12-20T16:09:37.000Z | 2022-03-19T18:58:14.000Z | include/pottery/intro_sort/impl/pottery_intro_sort_config_lifecycle.t.h | ludocode/pottery | 437b071ee8dd496a8a2d47c1db2643eaa82dc34d | [
"MIT"
] | 4 | 2020-12-17T02:13:40.000Z | 2022-01-24T03:58:36.000Z | /*
* MIT License
*
* Copyright (c) 2020-2021 11037650 Canada Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef POTTERY_INTRO_SORT_IMPL
#error "This is header internal to Pottery. Do not include it."
#endif
#include "pottery/pottery_dependencies.h"
#define POTTERY_LIFECYCLE_PREFIX POTTERY_CONCAT(POTTERY_INTRO_SORT_PREFIX, _lifecycle)
#define POTTERY_LIFECYCLE_EXTERNAL_CONTAINER_TYPES POTTERY_INTRO_SORT_PREFIX
#define POTTERY_LIFECYCLE_CLEANUP 0
// Forward types
//!!! AUTOGENERATED:container_types/forward.m.h SRC:POTTERY_INTRO_SORT DEST:POTTERY_LIFECYCLE
// This block is auto-generated. Do not modify until END_AUTOGENERATED.
// Forwards container_types configuration from POTTERY_INTRO_SORT to POTTERY_LIFECYCLE
// Forward the types
#if defined(POTTERY_INTRO_SORT_VALUE_TYPE)
#define POTTERY_LIFECYCLE_VALUE_TYPE POTTERY_INTRO_SORT_VALUE_TYPE
#endif
#if defined(POTTERY_INTRO_SORT_REF_TYPE)
#define POTTERY_LIFECYCLE_REF_TYPE POTTERY_INTRO_SORT_REF_TYPE
#endif
#if defined(POTTERY_INTRO_SORT_KEY_TYPE)
#define POTTERY_LIFECYCLE_KEY_TYPE POTTERY_INTRO_SORT_KEY_TYPE
#endif
#ifdef POTTERY_INTRO_SORT_CONTEXT_TYPE
#define POTTERY_LIFECYCLE_CONTEXT_TYPE POTTERY_INTRO_SORT_CONTEXT_TYPE
#endif
// Forward the conversion and comparison expressions
#if defined(POTTERY_INTRO_SORT_REF_KEY)
#define POTTERY_LIFECYCLE_REF_KEY POTTERY_INTRO_SORT_REF_KEY
#endif
#if defined(POTTERY_INTRO_SORT_REF_EQUAL)
#define POTTERY_LIFECYCLE_REF_EQUAL POTTERY_INTRO_SORT_REF_EQUAL
#endif
//!!! END_AUTOGENERATED
// Forward lifecycle configuration
//!!! AUTOGENERATED:lifecycle/forward.m.h SRC:POTTERY_INTRO_SORT_LIFECYCLE DEST:POTTERY_LIFECYCLE
// This block is auto-generated. Do not modify until END_AUTOGENERATED.
// Forwards lifecycle configuration from POTTERY_INTRO_SORT_LIFECYCLE to POTTERY_LIFECYCLE
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_BY_VALUE
#define POTTERY_LIFECYCLE_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_DESTROY
#define POTTERY_LIFECYCLE_DESTROY POTTERY_INTRO_SORT_LIFECYCLE_DESTROY
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_DESTROY_BY_VALUE
#define POTTERY_LIFECYCLE_DESTROY_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_DESTROY_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_INIT
#define POTTERY_LIFECYCLE_INIT POTTERY_INTRO_SORT_LIFECYCLE_INIT
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_INIT_BY_VALUE
#define POTTERY_LIFECYCLE_INIT_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_INIT_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_INIT_COPY
#define POTTERY_LIFECYCLE_INIT_COPY POTTERY_INTRO_SORT_LIFECYCLE_INIT_COPY
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_INIT_COPY_BY_VALUE
#define POTTERY_LIFECYCLE_INIT_COPY_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_INIT_COPY_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_INIT_STEAL
#define POTTERY_LIFECYCLE_INIT_STEAL POTTERY_INTRO_SORT_LIFECYCLE_INIT_STEAL
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_INIT_STEAL_BY_VALUE
#define POTTERY_LIFECYCLE_INIT_STEAL_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_INIT_STEAL_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_MOVE
#define POTTERY_LIFECYCLE_MOVE POTTERY_INTRO_SORT_LIFECYCLE_MOVE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_MOVE_BY_VALUE
#define POTTERY_LIFECYCLE_MOVE_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_MOVE_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_COPY
#define POTTERY_LIFECYCLE_COPY POTTERY_INTRO_SORT_LIFECYCLE_COPY
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_COPY_BY_VALUE
#define POTTERY_LIFECYCLE_COPY_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_COPY_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_STEAL
#define POTTERY_LIFECYCLE_STEAL POTTERY_INTRO_SORT_LIFECYCLE_STEAL
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_STEAL_BY_VALUE
#define POTTERY_LIFECYCLE_STEAL_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_STEAL_BY_VALUE
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_SWAP
#define POTTERY_LIFECYCLE_SWAP POTTERY_INTRO_SORT_LIFECYCLE_SWAP
#endif
#ifdef POTTERY_INTRO_SORT_LIFECYCLE_SWAP_BY_VALUE
#define POTTERY_LIFECYCLE_SWAP_BY_VALUE POTTERY_INTRO_SORT_LIFECYCLE_SWAP_BY_VALUE
#endif
//!!! END_AUTOGENERATED
| 41.134328 | 102 | 0.805515 |
061bc24f35cf5fe8aa47f860ad6df8b6706b80ad | 405 | h | C | VideoPlayer/VideoPlayer/VideoPlayerAppDelegate.h | apperian/template-apps | b886ad7cea7715d991b05c039de389e983302969 | [
"MIT"
] | null | null | null | VideoPlayer/VideoPlayer/VideoPlayerAppDelegate.h | apperian/template-apps | b886ad7cea7715d991b05c039de389e983302969 | [
"MIT"
] | null | null | null | VideoPlayer/VideoPlayer/VideoPlayerAppDelegate.h | apperian/template-apps | b886ad7cea7715d991b05c039de389e983302969 | [
"MIT"
] | null | null | null | //
// VideoPlayerAppDelegate.h
// VideoPlayer
//
// Created by Jeremy Debate on 5/31/11.
// Copyright 2011 Apperian. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
@interface VideoPlayerAppDelegate : NSObject <UIApplicationDelegate> {
MPMoviePlayerViewController *movieViewController_;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
| 19.285714 | 70 | 0.74321 |
061d6ae85af0c313de83c6b5065add14200f8664 | 26,146 | h | C | src/DialLexer.h | Belovedbb/DialLexer | 0ab00be22f9de556487495feb5bf360066a51299 | [
"MIT"
] | 3 | 2020-12-21T09:40:01.000Z | 2020-12-25T21:19:16.000Z | src/DialLexer.h | Belovedbb/DialLexer | 0ab00be22f9de556487495feb5bf360066a51299 | [
"MIT"
] | null | null | null | src/DialLexer.h | Belovedbb/DialLexer | 0ab00be22f9de556487495feb5bf360066a51299 | [
"MIT"
] | null | null | null | /*
Dial Lexing library
Copyright (c) 2020 - present, Oluwadare Beloved
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE
*/
#ifndef LEXER_LIB
#define LEXER_LIB
#include <vector>
#include <string>
#include <regex>
#include <algorithm>
#include <functional>
namespace dial {
using std::back_inserter;
using std::copy;
using std::string;
using std::vector;
//@DialLexerException Custom exception type for lexer
struct DialLexerException : public std::runtime_error
{
string build_error_message(string message, size_t line, size_t position, bool is_validating) {
string error_message = "";
error_message.append(message);
if (is_validating) {
error_message.append(" occured while validating tokens ");
}
else {
error_message.append(" at position ").append(std::to_string(position).append(" at line ").append(std::to_string(line)));
}
return error_message;
}
DialLexerException() : std::runtime_error(build_error_message("", -1, -1, false)) {
}
DialLexerException(std::string const& message, size_t line, size_t position, bool is_validating)
: std::runtime_error("")
{
add_info(message, line, position, is_validating);
}
void add_info(std::string const& message, size_t line, size_t position, bool is_validating) {
error_message.append(build_error_message(message, line, position, is_validating));
}
const char* what() const noexcept override {
return error_message.c_str();
}
private:
string error_message = "Lexer Error :\n";
};
//@TokenType -> Prototype constant to be overriden by user
enum class TokenType : int;
const string IS_NUMBER = "IS_NUMBER";
const string IS_IDENTIFIER_ALPHA_NUM = "IS_IDENTIFIER_ALPHA_NUM";
const string IS_IDENTIFIER_ALPHA_LOWER = "IS_IDENTIFIER_ALPHA_LOWER";
const string IS_IDENTIFIER_ALPHA_UPPER = "IS_IDENTIFIER_ALPHA_UPPER";
//@DIAL_LEXER_VALUE Semantic value type
//
//@DIAL_NONE -> type NONE with no semantic value associate
//@DIAL_NUMBER_DOUBLE -> type DOUBLE with number type value associate
//@DIAL_IDENTIFIER -> type IDENTIFIER with identifier type value associate
//@DIAL_STRING_START -> type STRING_START will resolve to @DIAL_STRING start
//@DIAL_STRING_END -> type STRING_END will resolve to @DIAL_STRING end
//@DIAL_STRING -> type STRING with string type value associate
enum class DIAL_LEXER_VALUE : int {
DIAL_NONE,
DIAL_NUMBER_DOUBLE,
DIAL_IDENTIFIER,
DIAL_STRING_START,
DIAL_STRING_END,
DIAL_STRING
};
//@LexerType Type for lexer
//
//@REGEX -> Regex type
//@RAW -> Hand crafted lexer type
enum class LexerType {
REGEX,
RAW
};
//@Token Represent the token
class Token {
public:
//@type User defined type
//@lexeme String content representing the value
//@value Semantic meaning for value
Token(TokenType type, string lexeme, DIAL_LEXER_VALUE value)
{
this->type = type;
this->lexeme = lexeme;
this->value = value;
}
// Represent empty token
Token()
{
this->line = -1;
this->lexeme = "";
this->value = static_cast<DIAL_LEXER_VALUE>(-1);
this->type = static_cast<TokenType>(-1);
}
//@get_type returns token type
TokenType get_type()
{
return this->type;
}
//@get_value returns token value
DIAL_LEXER_VALUE get_value()
{
return this->value;
}
//@get_lexeme returns token lexeme
string get_lexeme()
{
return this->lexeme;
}
//@get_line returns token line
int get_line()
{
return this->line;
}
void set_line(int line)
{
this->line = line;
}
//@== token comparison
bool operator==(const Token& other)
{
return other.lexeme == lexeme && other.type == type && other.line == line;
}
private:
int line;
TokenType type;
string lexeme;
DIAL_LEXER_VALUE value;
};
DialLexerException lex_exception = DialLexerException();
//@contains_ele utility function to check if a value exist in a container
//
//@list containter holding values
//@value value item searched for
template<typename C>
bool contains_ele(const std::vector<C>& list, const C& value) {
for (auto iter = list.begin(); iter < list.end(); iter++) {
if (value != *iter)
continue;
else
return true;
}
return false;
}
//@split_by_delimeter utility function to split a string object in respect to a char delimeter
//
//@txt elements to be splitted
//@strs container to split @txt into
//@ch delimeter used for splitting
size_t split_by_delimeter(const std::string& txt, std::vector<std::string>& strs, char ch)
{
size_t pos = txt.find(ch), init_pos = 0;
strs.clear();
while (pos != std::string::npos) {
strs.push_back(txt.substr(init_pos, pos - init_pos));
init_pos = pos + 1;
pos = txt.find(ch, init_pos);
}
string final_val = txt.substr(init_pos, std::min(pos, txt.size()) - init_pos + 1);
if (!final_val.empty()) {
strs.push_back(final_val);
}
return strs.size();
}
//@validate_double utility function to validate double precision value
//from a string value by extracting
//
//@val value to be extracted
bool validate_double(string val) {
double rez = 0, factor = 1;
size_t counter = 0;
if (val.at(counter) == '-') {
counter++;
factor = -1;
}
if (val.at(counter) == '.' || isdigit(val.at(counter))) {
bool decimal_point = false;
for (counter; counter < val.size(); counter++) {
if (val.at(counter) == '.') {
continue;
}
int digit = val.at(counter) - '0';
if (digit >= 0 && digit <= 9) {
if (decimal_point) {
factor /= 10.0f;
}
rez = rez * 10.0f + float(digit);
}
else {
return false;
}
}
return true;
}
return false;
};
//@get_token utility function to get a Token object using lexer value @key_val as key
//
//@tokens a list of input tokens
//@key_val a key used in retrieving a token
[[nodiscard]] Token get_token(vector<Token>& tokens, const DIAL_LEXER_VALUE key_val) {
auto type_ptr = std::find_if(tokens.begin(), tokens.end(), [&](Token token) { return token.get_value() == key_val; });
return type_ptr != tokens.end() ? (*type_ptr) : Token();
}
//@get_type utility function to get a TokenType using lexer value @key_val as key
//
//@tokens a list of input tokens
//@key_val a key used in retrieving a token
[[nodiscard]] TokenType get_type(vector<Token>& tokens, const DIAL_LEXER_VALUE key_val) {
auto token = get_token(tokens, key_val);
return token == Token() ? TokenType() : token.get_type();
}
//@verify_raw_tokens_integrity utility function to validate a list of input token for raw lexer type
//
//@input_tokens a list of input tokens
//@except a string containing exception message
//@identifiers a list of identifier token filtered for it's lexeme
//@comment_start begining of comment token value
//@comment_end end of comment token value
bool verify_raw_tokens_integrity(vector<Token>& input_tokens, string& except, vector<string>& identifiers, string comment_start, string comment_end) {
string initial_content = string(except);
TokenType start_type = get_type(input_tokens, DIAL_LEXER_VALUE::DIAL_STRING_START);
TokenType end_type = get_type(input_tokens, DIAL_LEXER_VALUE::DIAL_STRING_END);
if ((start_type != TokenType() && end_type == TokenType()) || (start_type == TokenType() && end_type != TokenType())) {
except.append("string tokens must have starting and ending tokens \n ");
}
TokenType string_type = get_type(input_tokens, DIAL_LEXER_VALUE::DIAL_STRING);
if (string_type != TokenType()) {
except.append("string token is not valid for use \n ");
}
if (!comment_start.empty() && comment_end == comment_start) {
except.append("cant have same token as start and end comment");
}
for (auto token : input_tokens) {
int counter = 0;
for (auto token_2 : input_tokens) {
if (token.get_value() == token_2.get_value()) {
++counter;
}
}
if (counter > 1 && !(token.get_value() == DIAL_LEXER_VALUE::DIAL_NONE)) {
except.append("tokens must be unique except for NONE value -> " + token.get_lexeme() + "\n");
}
}
Token identifier_token = get_token(input_tokens, DIAL_LEXER_VALUE::DIAL_IDENTIFIER);
if (!(identifier_token == Token())) {
identifiers.clear();
string lex = identifier_token.get_lexeme();
size_t n_split = split_by_delimeter(lex, identifiers, '|');
if (n_split < 1) {
except.append("token identifier must have identifiable characters or use the special constant values \n");
}
else {
for (string ident : identifiers) {
int counter = 0;
for (auto ident_2 : identifiers) {
if (ident_2 == ident) {
++counter;
}
}
if (counter > 1) {
except.append("identifier constants must be unique except \n");
}
}
bool mixed_up_identifier = (contains_ele(identifiers, string("IS_IDENTIFIER_ALPHA_NUM")) && contains_ele(identifiers, string("IS_IDENTIFIER_ALPHA_LOWER"))) ||
(contains_ele(identifiers, string("IS_IDENTIFIER_ALPHA_NUM")) && contains_ele(identifiers, string("IS_IDENTIFIER_ALPHA_UPPER")));
if (mixed_up_identifier) {
except.append("identifier reserved must not use 'IS_IDENTIFIER_ALPHA_NUM' with the others \n ");
}
}
}
return initial_content == except;
}
//@get_filtered_token utility function to get a list of filtered token by key value @value
//
//@tokens a list of input tokens
//@value a key used in filtering for the list of tokens
vector<Token> get_filtered_token(const vector<Token> tokens, DIAL_LEXER_VALUE value) {
vector<Token> vec;
std::copy_if(tokens.begin(), tokens.end(), std::back_inserter(vec), [&](Token token) {return token.get_value() == value; });
return vec;
}
//@trim utility function for a trimmed representation of an input string
//
//@val input string to be trimmed
string trim(string val) {
std::regex reg("^\\s+|\\s+$");
return regex_replace(val, reg, "");
}
//@verify_regex_tokens_integrity utility function to validate a list of input token for regex lexer type
//
//@input_tokens a list of input tokens
//@except a string containing exception message
bool verify_regex_tokens_integrity(vector<Token>& input_tokens, string& except) {
string initial_content = string(except);
for (auto token : input_tokens) {
int counter = 0;
for (auto token_2 : input_tokens) {
if (token.get_lexeme() == token_2.get_lexeme()) {
++counter;
}
}
if (counter > 1 && !(token.get_value() == DIAL_LEXER_VALUE::DIAL_NONE)) {
except.append("regex tokens must be unique -> " + token.get_lexeme() + "\n");
}
}
return initial_content == except;
}
//@get_matched_token utility function to retrieve a token from a list @input_tokens based on a regex matcher @matcher
//
//@input_tokens a list of input tokens
//@matcher an instance of std::regex matcher
Token get_matched_token(std::smatch& matcher, vector<Token>& input_tokens) {
for (size_t i = 1; i < matcher.size(); i++) {
string content = trim(matcher.str(i));
if (!content.empty()) {
return input_tokens.at(i - 1);
}
}
return Token();
}
//@get_error_token utility function to get error token value
//@val input string to be tested for error
string get_error_token(const string& val) {
std::string error_token;
error_token.reserve(val.size());
std::remove_copy_if(
begin(val), end(val),
std::back_inserter(error_token),
[l = std::locale{}](auto ch) { return std::isspace(ch, l); }
);
return error_token;
}
//@DialLexer Lexer class for validating and splitting input based on predefined token rules
//
class DialLexer {
public:
//@add_token method to add a token to a list @input_tokens
//
//@token token to be added to @input_tokens
void add_token(Token token)
{
this->input_tokens.push_back(token);
}
//@split method to split a source content @raw based on the lexer type
//
//@raw source content to be splitted
vector<Token> split(string raw)
{
reset_state();
this->source = raw;
vector<Token> tokens = this->type == LexerType::RAW ? raw_splitter() : regex_splitter();
return tokens;
}
//@Lexer-constructor takes in a lexer type defaulted at @raw
//
//@type type of lexer to be used for splitting
DialLexer(LexerType type = LexerType::RAW) : type(type)
{
}
//@input_token_size get the size of input token list
//
size_t input_token_size()
{
return input_tokens.size();
}
//@set_comment set the value of @comment_begin and @comment_end
//
//@begin begining of comment token
//@end end of comment token
void set_comment(string begin, string end = "\n") {
this->comment_begin = begin;
this->comment_end = end;
}
private:
LexerType type;
string source;
int current = 0, line = 1;
string comment_begin = "", comment_end = "";
//@advance move by one char in @source content
//
char advance()
{
++current;
return current < get_eof() ? this->source[current] : -1;
}
//@advance operation function on @source content with line aware attribute
//
//@func a function implementing @source operation
char advance_with_line(std::function<char(void)> func)
{
char c = func();
if (c == '\n') {
line++;
}
return c;
}
//@peek look ahead at position 1 from @source
//
char peek()
{
return peek_lookahead(1);
}
bool has_error = false;
//@match match the current character from @source with an expected character
//
//@expected a function implementing @source operation
bool match(char expected)
{
return current < get_eof() ? this->source[current] == expected : false;
}
//@match_comment match the current character from @source with a comment start or end token
//
//@handle_start a condition representing matching start or end comment
bool match_comment(bool handle_start) {
vector<char> c_container_;
string lex = handle_start ? this->comment_begin : this->comment_end;
copy(lex.begin(), lex.end(), back_inserter(c_container_));
int size_ = c_container_.size();
bool matched = false;
int inner_count = 0;
for (int i = 0; i < size_; i++) {
if (!is_eof() && (peek_lookahead(i) == c_container_.at(i))) {
inner_count++;
}
else if (is_eof() && !handle_start) {
has_error = true;
return false;
}
else {
return false;
}
}
matched = inner_count == size_;
return matched;
}
//@match_word match the current characters from @source with expected characters
//
//@word word to be matched against
bool match_word(string word) {
vector<char> c_container_;
copy(word.begin(), word.end(), back_inserter(c_container_));
int size_ = c_container_.size();
int inner_count = 0;
for (int i = 0; i < size_; i++) {
if (!is_eof() && (peek_lookahead(i) == c_container_.at(i))) {
inner_count++;
}
else {
return false;
}
}
return inner_count == size_;
}
//@match_identifiers match the identifiers from validated @unknown_identifiers
//
//@identifier_cont container for identifier
//@identifier current identifier to be matched
//@watcher replica of @identifier
//@start value to determine if it is the start of matching
void match_identifiers(vector<string>& identifier_cont, string& identifier, string& watcher, bool start) {
std::for_each(identifier_cont.begin(), identifier_cont.end(), [&](string& lexeme) {
if (lexeme == dial::IS_IDENTIFIER_ALPHA_NUM) {
string content = match_get_alnum_ident();
if (!content.empty()) {
std::for_each(content.begin(), content.end(), [&](char& ele) { advance(); });
identifier.append(content);
}
}
if (lexeme == dial::IS_IDENTIFIER_ALPHA_LOWER) {
string content = match_get_alpha_lower_ident();
if (!content.empty()) {
std::for_each(content.begin(), content.end(), [&](char& ele) { advance(); });
identifier.append(content);
}
}
if (lexeme == dial::IS_IDENTIFIER_ALPHA_UPPER) {
string content = match_get_alpha_upper_ident();
if (!content.empty()) {
std::for_each(content.begin(), content.end(), [&](char& ele) { advance(); });
identifier.append(content);
}
}
if (match_word(lexeme)) {
std::for_each(lexeme.begin(), lexeme.end(), [&](char& ele) { advance(); });
identifier.append(lexeme);
}
});
if (watcher != identifier) {
watcher = identifier;
match_identifiers(identifier_cont, identifier, watcher, false);
}
else if (start) {
match_identifiers(identifier_cont, identifier, watcher, false);
}
}
//@reset_state reset @input_tokens, @current, @line state
//
void reset_state()
{
output_tokens.clear();
current = 0;
line = 1;
}
//@match_get_double match double value starting from current character
//
string match_get_double() {
string appended_double = "", current_lex = "";
for (int i = 0; i < get_eof(); i++) {
char prob_double = peek_lookahead(i);
current_lex.push_back(prob_double);
bool is_double = validate_double(current_lex);
if (is_double) {
appended_double = current_lex;
continue;
}
else {
break;
}
}
return appended_double;
}
//@match_get_alnum_ident match alphanumeric identifiers from validated @unknown_identifiers
//
string match_get_alnum_ident() {
string appended_identifier = "";
for (int i = 0; i < get_eof(); i++) {
char prob_ident = peek_lookahead(i);
if (isalnum(prob_ident)) {
appended_identifier.push_back(prob_ident);
}
else {
break;
}
}
return appended_identifier;
}
//@match_get_alpha_lower_ident match lower case alphabet identifiers from validated @unknown_identifiers
//
string match_get_alpha_lower_ident() {
string appended_identifier = "";
for (int i = 0; i < get_eof(); i++) {
char prob_ident = peek_lookahead(i);
if (isalpha(prob_ident) && islower(prob_ident)) {
appended_identifier.push_back(prob_ident);
}
else {
break;
}
}
return appended_identifier;
}
//@match_get_alpha_upper_ident match upper case alphabet identifiers from validated @unknown_identifiers
//
string match_get_alpha_upper_ident() {
string appended_identifier = "";
for (int i = 0; i < get_eof(); i++) {
char prob_ident = peek_lookahead(i);
if (isalpha(prob_ident) && isupper(prob_ident)) {
appended_identifier.push_back(prob_ident);
}
else {
break;
}
}
return appended_identifier;
}
//@get_eof get @source size
//
int const get_eof() const
{
return this->source.size();
}
//@is_eof determine if the current pointer is at end of file
//
bool const is_eof()
{
return current >= get_eof();
}
//@peek_lookahead look ahead to any given point from @source
//
char const peek_lookahead(int offset) const
{
int position = current + offset;
return position < get_eof() ? this->source[position] : -1;
}
//@regex_splitter split @source content based on regex tokens
//
vector<Token> regex_splitter()
{
string exception_message = "";
bool status_good = verify_regex_tokens_integrity(input_tokens, exception_message);
if (!status_good) {
has_error = true;
throw DialLexerException(exception_message, line, current, true);
}
std::smatch matcher;
string patterns = "";
for (Token token : input_tokens) {
patterns.append("(").append(token.get_lexeme()).append(")|");
}
string content = string(source);
patterns.pop_back();
std::regex reg(patterns, std::regex::extended);
while (std::regex_search(content, matcher, reg))
{
int split_pos = matcher.position();
current += (matcher.length() + split_pos);
string rem = content.substr(0, split_pos);
Token matched_token = get_matched_token(matcher, input_tokens);
if (matched_token == Token()) {
has_error = true;
lex_exception.add_info("can't match whitespaces", line, current, false);
}
std::string error_token = get_error_token(rem);
if (!error_token.empty()) {
has_error = true;
lex_exception.add_info(rem, line, current, false);
}
for (auto t : rem) {
if (t == '\n') {
++line;
}
}
Token token_ = Token(matched_token.get_type(), matcher.str(), matched_token.get_value());
token_.set_line(line);
output_tokens.push_back(token_);
content = content.substr(split_pos + matcher.length());
}
std::string error_token = get_error_token(content);
if (!error_token.empty()) {
has_error = true;
lex_exception.add_info(content, line, current, false);
}
if (has_error) {
throw lex_exception;
}
return output_tokens;
}
//@raw_splitter split @source content based on raw hand crafted tokenizer
//
vector<Token> raw_splitter()
{
string exception_message = "";
vector<Token> vec = std::move(get_filtered_token(this->input_tokens, DIAL_LEXER_VALUE::DIAL_STRING_END));
Token end_token = !vec.empty() ? vec.at(0) : Token{};
bool status_good = verify_raw_tokens_integrity(input_tokens, exception_message, unknown_identifiers, comment_begin, comment_end);
if (!status_good) {
has_error = true;
throw DialLexerException(exception_message, line, current, true);
}
while (current < get_eof()) {
int previous_counter = current;
switch (peek_lookahead(0)) {
case ' ': {
advance();
while (match(' ')) {
advance();
}
break;
}
case '\n': {
line++;
advance();
}
break;
}
if (comment_begin != "") {
if (match_comment(true)) {
while (!is_eof() && !match_comment(false)) {
char c = advance();
if (c == '\n') {
line++;
}
}
//pull out of comment token
if (!is_eof()) {
for (size_t i = 0; i < comment_end.size(); i++) {
advance();
}
}
}
}
for (vector<Token>::iterator token_iter = input_tokens.begin(); token_iter < input_tokens.end(); token_iter++) {
Token token = *token_iter;
string start_lex = token.get_lexeme();
size_t token_len = start_lex.size();
//match keywords
//handle string offset
bool is_string = static_cast<int>(token.get_value()) == static_cast<int>(DIAL_LEXER_VALUE::DIAL_STRING_START) ||
static_cast<int>(token.get_value()) == static_cast<int>(DIAL_LEXER_VALUE::DIAL_STRING_END);
if (!is_string) {
bool matched_all = token_len > 0 ? true : false;
for (size_t i = 0; i < token_len; i++) {
char ff_char = peek_lookahead(i);
if (ff_char != start_lex[i]) {
matched_all = false;
break;
}
}
if (matched_all) {
for (size_t i = 0; i < token_len; i++) {
advance();
}
Token matched_token = token;
matched_token.set_line(line);
output_tokens.push_back(matched_token);
break;
}
}
switch (token.get_value()) {
case DIAL_LEXER_VALUE::DIAL_STRING_START: {
string word;
if (match_word(start_lex)) {
char c_f = advance();
word.push_back(c_f);
while (!is_eof() && !match_word(end_token.get_lexeme())) {
char c = peek();
if (c == '\n') {
line++;
}
word.push_back(c);
advance();
}
//pull out of the last string token
advance();
Token token_ = Token(token.get_type(), start_lex + word, DIAL_LEXER_VALUE::DIAL_STRING);
token_.set_line(line);
output_tokens.push_back(token_);
}
}
case DIAL_LEXER_VALUE::DIAL_NUMBER_DOUBLE: {
string double_content = match_get_double();
if (!double_content.empty()) {
std::for_each(double_content.begin(), double_content.end(), [&](char& ele) { advance(); });
Token token_ = Token(get_type(input_tokens, DIAL_LEXER_VALUE::DIAL_NUMBER_DOUBLE), double_content, DIAL_LEXER_VALUE::DIAL_NUMBER_DOUBLE);
token_.set_line(line);
output_tokens.push_back(token_);
}
}
case DIAL_LEXER_VALUE::DIAL_IDENTIFIER: {
string identifier = "", watcher = "";
match_identifiers(unknown_identifiers, identifier, watcher, true);
if (!identifier.empty()) {
Token token_ = Token(get_type(input_tokens, DIAL_LEXER_VALUE::DIAL_IDENTIFIER), identifier, DIAL_LEXER_VALUE::DIAL_IDENTIFIER);
token_.set_line(line);
output_tokens.push_back(token_);
identifier.clear();
}
}
}
}
if (previous_counter == current) {
//handle error
has_error = true;
//already at new line
if (match('\n')) {
exception_message.push_back('\n');
advance();
continue;
}
string error_token = { peek_lookahead(0) };
char a = ' ';
while (((a = advance()), a != '\n') && !is_eof()) {
error_token.push_back(a);
}
lex_exception.add_info(error_token, line, current, false);
line++;//using new line or eof as breakpoint
advance();
}
}
if (has_error) {
throw lex_exception;
}
return output_tokens;
}
vector<Token> input_tokens;
vector<Token> output_tokens;
vector<string> unknown_identifiers;
};
}//end namespace dial
#endif // end lexer lib | 30.402326 | 162 | 0.665991 |
06202eaf8cc48c633f431a3afcd8e4545fdae531 | 1,638 | c | C | source/TextureList.c | ftraple/WolfensteinEngine | 84226a97ef5c98293b5f39c12d8a923f25da0264 | [
"MIT"
] | 1 | 2018-10-03T10:41:13.000Z | 2018-10-03T10:41:13.000Z | source/TextureList.c | ftraple/WolfensteinEngine | 84226a97ef5c98293b5f39c12d8a923f25da0264 | [
"MIT"
] | null | null | null | source/TextureList.c | ftraple/WolfensteinEngine | 84226a97ef5c98293b5f39c12d8a923f25da0264 | [
"MIT"
] | null | null | null |
#include "TextureList.h"
struct w3d_TextureListSt {
w3d_Texture** texture;
uint16_t size;
};
/*################################################################################*/
w3d_TextureList* w3d_TextureList_Create(uint16_t initialSize) {
w3d_TextureList* textureList = (w3d_TextureList*)malloc(sizeof(w3d_TextureList));
if (textureList == NULL) {
return NULL;
}
textureList->size = initialSize;
textureList->texture = (w3d_Texture**)malloc(initialSize*sizeof(w3d_Texture*));
if (textureList->texture == NULL) {
free(textureList);
return NULL;
}
memset(textureList->texture, 0, initialSize*sizeof(w3d_Texture*));
return textureList;
}
/*################################################################################*/
void w3d_TextureList_Destroy(w3d_TextureList* textureList) {
assert(textureList != NULL);
free(textureList->texture);
free(textureList);
}
/*################################################################################*/
uint16_t w3d_TextureList_Pop(w3d_TextureList* textureList, w3d_Texture* texture) {
assert(textureList != NULL);
uint16_t index;
for (index = 0; index < textureList->size; index++) {
if (textureList->texture[index] == NULL) {
textureList->texture[index] = texture;
break;
}
}
return index;
}
/*################################################################################*/
w3d_Texture* w3d_TextureList_GetByIndex(w3d_TextureList* textureList, uint16_t index) {
assert(textureList != NULL);
if (index >= textureList->size) {
return NULL;
}
return textureList->texture[index];
}
| 28.736842 | 87 | 0.557998 |
0620f414988dd8639c6b9f39a7983b194955e029 | 1,691 | h | C | Debugging/WinDbg/headers/DumpHeader32.h | matthew6868/tools_tip | 47cafd5c0eb2e0bddaadb87f0c17c3f8e8f3f9e3 | [
"Apache-2.0"
] | null | null | null | Debugging/WinDbg/headers/DumpHeader32.h | matthew6868/tools_tip | 47cafd5c0eb2e0bddaadb87f0c17c3f8e8f3f9e3 | [
"Apache-2.0"
] | null | null | null | Debugging/WinDbg/headers/DumpHeader32.h | matthew6868/tools_tip | 47cafd5c0eb2e0bddaadb87f0c17c3f8e8f3f9e3 | [
"Apache-2.0"
] | null | null | null | typedef struct _DUMP_HEADER32 {
/* 0x000 */ ULONG Signature;
/* 0x004 */ ULONG ValidDump;
/* 0x008 */ ULONG MajorVersion;
/* 0x00C */ ULONG MinorVersion;
/* 0x010 */ ULONG DirectoryTableBase;
/* 0x014 */ ULONG PfnDataBase;
/* 0x018 */ PLIST_ENTRY PsLoadedModuleList;
/* 0x01C */ PLIST_ENTRY PsActiveProcessHead;
/* 0x020 */ ULONG MachineImageType;
/* 0x024 */ ULONG NumberOfProcessors;
/* 0x028 */ ULONG BugCheckCode;
/* 0x02C */ ULONG BugCheckParameter1;
/* 0x030 */ ULONG BugCheckParameter2;
/* 0x034 */ ULONG BugCheckParameter3;
/* 0x038 */ ULONG BugCheckParameter4;
/* 0x03C */ UCHAR VersionUser[32];
/* 0x05C */ UCHAR PaeEnabled;
/* 0x05d */ UCHAR KdSecondaryVersion;
/* 0x05e */ UCHAR Spare3[2];
/* 0x060 */ PKDDEBUGGER_DATA64
KdDebuggerDataBlock;
union {
/* 0x064 */ PHYSICAL_MEMORY_DESCRIPTOR32
PhysicalMemoryBlock;
/* 0x064 */ UCHAR
PhysicalMemoryBlockBuffer[700];
}
union {
/* 0x320 */ CONTEXT Context;
/* 0x320 */ UCHAR ContextRecord[120];
}
/* 0x7d0 */ EXCEPTION_RECORD32 Exception;
/* 0x820 */ UCHAR Comment[128];
/* 0x8a0 */ UCHAR _reserved0[1768];
/* 0xf88 */ ULONG DumpType;
/* 0xf8c */ ULONG MiniDumpFields;
/* 0xf90 */ ULONG SecondaryDataState;
/* 0xf94 */ ULONG ProductType;
/* 0xf98 */ ULONG SuiteMask;
/* 0xf9c */ ULONG WriterStatus;
/* 0xfa0 */ LARGE_INTEGER RequiredDumpSpace;
/* 0xfa8 */ UCHAR _reserved2[16];
/* 0xfb8 */ LARGE_INTEGER SystemUpTime;
/* 0xfc0 */ LARGE_INTEGER SystemTime;
/* 0xfc8 */ UCHAR _reserved3[56];
} DUMP_HEADER32, *PDUMP_HEADER32; | 35.978723 | 48 | 0.628031 |
0624f0af663032743f26c3fd12ff8c82364ae5d7 | 26,819 | h | C | arch/PowerPC/CapstonePPCModule.h | Phosphorus15/Capstone | 1bca4211bd7c132c57d0006a26de57d42a4bcdb9 | [
"BSD-3-Clause"
] | null | null | null | arch/PowerPC/CapstonePPCModule.h | Phosphorus15/Capstone | 1bca4211bd7c132c57d0006a26de57d42a4bcdb9 | [
"BSD-3-Clause"
] | 4 | 2021-12-06T13:41:54.000Z | 2021-12-09T14:59:13.000Z | arch/PowerPC/CapstonePPCModule.h | Phosphorus15/Capstone | 1bca4211bd7c132c57d0006a26de57d42a4bcdb9 | [
"BSD-3-Clause"
] | null | null | null | //
// Created by Phosphorus15 on 2021/7/12.
//
#ifndef CAPSTONE_CAPSTONEPPCMODULE_H
#define CAPSTONE_CAPSTONEPPCMODULE_H
static void llvm_unreachable(const char *info) {}
static void assert(int val) {}
#define PPC_REGS0_31(X) \
{ \
X##0, X##1, X##2, X##3, X##4, X##5, X##6, X##7, X##8, X##9, X##10, X##11, \
X##12, X##13, X##14, X##15, X##16, X##17, X##18, X##19, X##20, X##21, \
X##22, X##23, X##24, X##25, X##26, X##27, X##28, X##29, X##30, X##31 \
}
#define PPC_REGS_NO0_31(Z, X) \
{ \
Z, X##1, X##2, X##3, X##4, X##5, X##6, X##7, X##8, X##9, X##10, X##11, \
X##12, X##13, X##14, X##15, X##16, X##17, X##18, X##19, X##20, X##21, \
X##22, X##23, X##24, X##25, X##26, X##27, X##28, X##29, X##30, X##31 \
}
#define PPC_REGS0_7(X) \
{ X##0, X##1, X##2, X##3, X##4, X##5, X##6, X##7 }
static DecodeStatus decodeCondBrTarget(MCInst *Inst, unsigned Imm,
uint64_t Address,
void *Decoder);
static DecodeStatus decodeDirectBrTarget(MCInst *Inst, unsigned Imm,
uint64_t Address,
void *Decoder);
static DecodeStatus decodeRegisterClass(MCInst *Inst, uint64_t RegNo,
const unsigned *Regs);
static DecodeStatus DecodeCRRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeCRBITRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeF4RCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeF8RCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeVFRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeVRRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeVSRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeVSFRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeVSSRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeGPRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeGPRC_NOR0RegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeG8RCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeG8pRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeG8RC_NOX0RegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeSPERCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeACCRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus DecodeVSRpRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus decodeUImmOperand(MCInst *Inst, uint64_t Imm,
int64_t Address, void *Decoder,
int);
static DecodeStatus decodeSImmOperand(MCInst *Inst, uint64_t Imm,
int64_t Address, void *Decoder,
unsigned N);
static DecodeStatus decodeImmZeroOperand(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeVSRpEvenOperands(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder);
static DecodeStatus decodeMemRIOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeMemRIXOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeMemRIHashOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeMemRIX16Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeMemRI34PCRelOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeMemRI34Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeSPE8Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeSPE4Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeSPE2Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
static DecodeStatus decodeCRBitMOperand(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder);
#define GET_REGINFO_ENUM
#define GET_INSTRINFO_ENUM
#define MIPS_GET_DISASSEMBLER
#define GET_REGINFO_MC_DESC
#include "PPCGenDisassemblerTables.inc"
FieldFromInstruction(fieldFromInstruction4, uint64_t)
DecodeToMCInst(decodeToMCInst4, fieldFromInstruction4, uint64_t)
DecodeInstruction(decodeInstruction4, fieldFromInstruction4,
decodeToMCInst4, uint64_t)
static const unsigned RRegs[32] = PPC_REGS0_31(PPC_R);
static const unsigned RRegsNoR0[32] = PPC_REGS_NO0_31(PPC_ZERO, PPC_R);
static const unsigned XRegs[32] = PPC_REGS0_31(PPC_X);
static const unsigned XRegsNoX0[32] = PPC_REGS_NO0_31(PPC_ZERO8, PPC_X);
static const unsigned VSRpRegs[32] = PPC_REGS0_31(PPC_VSRp);
static const unsigned ACCRegs[8] = PPC_REGS0_7(PPC_ACC);
static const unsigned CRRegs[] = {PPC_CR0, PPC_CR1, PPC_CR2, PPC_CR3,
PPC_CR4, PPC_CR5, PPC_CR6, PPC_CR7};
static const unsigned CRBITRegs[] = {
PPC_CR0LT, PPC_CR0GT, PPC_CR0EQ, PPC_CR0UN, PPC_CR1LT, PPC_CR1GT, PPC_CR1EQ,
PPC_CR1UN, PPC_CR2LT, PPC_CR2GT, PPC_CR2EQ, PPC_CR2UN, PPC_CR3LT, PPC_CR3GT,
PPC_CR3EQ, PPC_CR3UN, PPC_CR4LT, PPC_CR4GT, PPC_CR4EQ, PPC_CR4UN, PPC_CR5LT,
PPC_CR5GT, PPC_CR5EQ, PPC_CR5UN, PPC_CR6LT, PPC_CR6GT, PPC_CR6EQ, PPC_CR6UN,
PPC_CR7LT, PPC_CR7GT, PPC_CR7EQ, PPC_CR7UN};
static const unsigned FRegs[] = {
PPC_F0, PPC_F1, PPC_F2, PPC_F3, PPC_F4, PPC_F5, PPC_F6, PPC_F7,
PPC_F8, PPC_F9, PPC_F10, PPC_F11, PPC_F12, PPC_F13, PPC_F14, PPC_F15,
PPC_F16, PPC_F17, PPC_F18, PPC_F19, PPC_F20, PPC_F21, PPC_F22, PPC_F23,
PPC_F24, PPC_F25, PPC_F26, PPC_F27, PPC_F28, PPC_F29, PPC_F30, PPC_F31};
static const unsigned VFRegs[] = {
PPC_VF0, PPC_VF1, PPC_VF2, PPC_VF3, PPC_VF4, PPC_VF5, PPC_VF6,
PPC_VF7, PPC_VF8, PPC_VF9, PPC_VF10, PPC_VF11, PPC_VF12, PPC_VF13,
PPC_VF14, PPC_VF15, PPC_VF16, PPC_VF17, PPC_VF18, PPC_VF19, PPC_VF20,
PPC_VF21, PPC_VF22, PPC_VF23, PPC_VF24, PPC_VF25, PPC_VF26, PPC_VF27,
PPC_VF28, PPC_VF29, PPC_VF30, PPC_VF31};
static const unsigned VRegs[] = {
PPC_V0, PPC_V1, PPC_V2, PPC_V3, PPC_V4, PPC_V5, PPC_V6, PPC_V7,
PPC_V8, PPC_V9, PPC_V10, PPC_V11, PPC_V12, PPC_V13, PPC_V14, PPC_V15,
PPC_V16, PPC_V17, PPC_V18, PPC_V19, PPC_V20, PPC_V21, PPC_V22, PPC_V23,
PPC_V24, PPC_V25, PPC_V26, PPC_V27, PPC_V28, PPC_V29, PPC_V30, PPC_V31};
static const unsigned VSRegs[] = {
PPC_VSL0, PPC_VSL1, PPC_VSL2, PPC_VSL3, PPC_VSL4, PPC_VSL5, PPC_VSL6,
PPC_VSL7, PPC_VSL8, PPC_VSL9, PPC_VSL10, PPC_VSL11, PPC_VSL12, PPC_VSL13,
PPC_VSL14, PPC_VSL15, PPC_VSL16, PPC_VSL17, PPC_VSL18, PPC_VSL19, PPC_VSL20,
PPC_VSL21, PPC_VSL22, PPC_VSL23, PPC_VSL24, PPC_VSL25, PPC_VSL26, PPC_VSL27,
PPC_VSL28, PPC_VSL29, PPC_VSL30, PPC_VSL31,
PPC_V0, PPC_V1, PPC_V2, PPC_V3, PPC_V4, PPC_V5, PPC_V6,
PPC_V7, PPC_V8, PPC_V9, PPC_V10, PPC_V11, PPC_V12, PPC_V13,
PPC_V14, PPC_V15, PPC_V16, PPC_V17, PPC_V18, PPC_V19, PPC_V20,
PPC_V21, PPC_V22, PPC_V23, PPC_V24, PPC_V25, PPC_V26, PPC_V27,
PPC_V28, PPC_V29, PPC_V30, PPC_V31};
static const unsigned VSFRegs[] = {
PPC_F0, PPC_F1, PPC_F2, PPC_F3, PPC_F4, PPC_F5, PPC_F6,
PPC_F7, PPC_F8, PPC_F9, PPC_F10, PPC_F11, PPC_F12, PPC_F13,
PPC_F14, PPC_F15, PPC_F16, PPC_F17, PPC_F18, PPC_F19, PPC_F20,
PPC_F21, PPC_F22, PPC_F23, PPC_F24, PPC_F25, PPC_F26, PPC_F27,
PPC_F28, PPC_F29, PPC_F30, PPC_F31,
PPC_VF0, PPC_VF1, PPC_VF2, PPC_VF3, PPC_VF4, PPC_VF5, PPC_VF6,
PPC_VF7, PPC_VF8, PPC_VF9, PPC_VF10, PPC_VF11, PPC_VF12, PPC_VF13,
PPC_VF14, PPC_VF15, PPC_VF16, PPC_VF17, PPC_VF18, PPC_VF19, PPC_VF20,
PPC_VF21, PPC_VF22, PPC_VF23, PPC_VF24, PPC_VF25, PPC_VF26, PPC_VF27,
PPC_VF28, PPC_VF29, PPC_VF30, PPC_VF31};
static const unsigned VSSRegs[] = {
PPC_F0, PPC_F1, PPC_F2, PPC_F3, PPC_F4, PPC_F5, PPC_F6,
PPC_F7, PPC_F8, PPC_F9, PPC_F10, PPC_F11, PPC_F12, PPC_F13,
PPC_F14, PPC_F15, PPC_F16, PPC_F17, PPC_F18, PPC_F19, PPC_F20,
PPC_F21, PPC_F22, PPC_F23, PPC_F24, PPC_F25, PPC_F26, PPC_F27,
PPC_F28, PPC_F29, PPC_F30, PPC_F31,
PPC_VF0, PPC_VF1, PPC_VF2, PPC_VF3, PPC_VF4, PPC_VF5, PPC_VF6,
PPC_VF7, PPC_VF8, PPC_VF9, PPC_VF10, PPC_VF11, PPC_VF12, PPC_VF13,
PPC_VF14, PPC_VF15, PPC_VF16, PPC_VF17, PPC_VF18, PPC_VF19, PPC_VF20,
PPC_VF21, PPC_VF22, PPC_VF23, PPC_VF24, PPC_VF25, PPC_VF26, PPC_VF27,
PPC_VF28, PPC_VF29, PPC_VF30, PPC_VF31};
static const unsigned GPRegs[] = {
PPC_R0, PPC_R1, PPC_R2, PPC_R3, PPC_R4, PPC_R5, PPC_R6, PPC_R7,
PPC_R8, PPC_R9, PPC_R10, PPC_R11, PPC_R12, PPC_R13, PPC_R14, PPC_R15,
PPC_R16, PPC_R17, PPC_R18, PPC_R19, PPC_R20, PPC_R21, PPC_R22, PPC_R23,
PPC_R24, PPC_R25, PPC_R26, PPC_R27, PPC_R28, PPC_R29, PPC_R30, PPC_R31};
static const unsigned GP0Regs[] = {
PPC_ZERO, PPC_R1, PPC_R2, PPC_R3, PPC_R4, PPC_R5, PPC_R6, PPC_R7,
PPC_R8, PPC_R9, PPC_R10, PPC_R11, PPC_R12, PPC_R13, PPC_R14, PPC_R15,
PPC_R16, PPC_R17, PPC_R18, PPC_R19, PPC_R20, PPC_R21, PPC_R22, PPC_R23,
PPC_R24, PPC_R25, PPC_R26, PPC_R27, PPC_R28, PPC_R29, PPC_R30, PPC_R31};
static const unsigned G8Regs[] = {
PPC_X0, PPC_X1, PPC_X2, PPC_X3, PPC_X4, PPC_X5, PPC_X6, PPC_X7,
PPC_X8, PPC_X9, PPC_X10, PPC_X11, PPC_X12, PPC_X13, PPC_X14, PPC_X15,
PPC_X16, PPC_X17, PPC_X18, PPC_X19, PPC_X20, PPC_X21, PPC_X22, PPC_X23,
PPC_X24, PPC_X25, PPC_X26, PPC_X27, PPC_X28, PPC_X29, PPC_X30, PPC_X31};
static const unsigned G80Regs[] = {
PPC_ZERO8, PPC_X1, PPC_X2, PPC_X3, PPC_X4, PPC_X5, PPC_X6, PPC_X7,
PPC_X8, PPC_X9, PPC_X10, PPC_X11, PPC_X12, PPC_X13, PPC_X14, PPC_X15,
PPC_X16, PPC_X17, PPC_X18, PPC_X19, PPC_X20, PPC_X21, PPC_X22, PPC_X23,
PPC_X24, PPC_X25, PPC_X26, PPC_X27, PPC_X28, PPC_X29, PPC_X30, PPC_X31};
static const unsigned SPERegs[] = {
PPC_S0, PPC_S1, PPC_S2, PPC_S3, PPC_S4, PPC_S5, PPC_S6, PPC_S7,
PPC_S8, PPC_S9, PPC_S10, PPC_S11, PPC_S12, PPC_S13, PPC_S14, PPC_S15,
PPC_S16, PPC_S17, PPC_S18, PPC_S19, PPC_S20, PPC_S21, PPC_S22, PPC_S23,
PPC_S24, PPC_S25, PPC_S26, PPC_S27, PPC_S28, PPC_S29, PPC_S30, PPC_S31};
static DecodeStatus decodeCondBrTarget(MCInst *Inst, unsigned Imm,
uint64_t Address,
void *Decoder) {
MCOperand_CreateImm0(Inst, SignExtend32(Imm, 14));
return MCDisassembler_Success;
}
static DecodeStatus decodeDirectBrTarget(MCInst *Inst, unsigned Imm,
uint64_t Address,
void *Decoder) {
int32_t Offset = SignExtend32(Imm, 24);
MCOperand_CreateImm0(Inst, Offset);
return MCDisassembler_Success;
}
static DecodeStatus decodeRegisterClass(MCInst *Inst, uint64_t RegNo,
const unsigned *Regs) {
MCOperand_CreateReg0(Inst, Regs[RegNo]);
return MCDisassembler_Success;
}
static DecodeStatus DecodeCRRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, CRRegs);
}
static DecodeStatus DecodeCRBITRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, CRBITRegs);
}
static DecodeStatus DecodeF4RCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, FRegs);
}
static DecodeStatus DecodeF8RCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, FRegs);
}
static DecodeStatus DecodeVFRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, VFRegs);
}
static DecodeStatus DecodeVRRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, VRegs);
}
static DecodeStatus DecodeVSRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, VSRegs);
}
static DecodeStatus DecodeVSFRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, VSFRegs);
}
static DecodeStatus DecodeVSSRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, VSSRegs);
}
static DecodeStatus DecodeGPRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, RRegs);
}
static DecodeStatus DecodeGPRC_NOR0RegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, RRegsNoR0);
}
static DecodeStatus DecodeG8RCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, XRegs);
}
static DecodeStatus DecodeG8pRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, XRegs);
}
static DecodeStatus DecodeG8RC_NOX0RegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, XRegsNoX0);
}
static DecodeStatus DecodeSPERCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, SPERegs);
}
static DecodeStatus DecodeACCRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, ACCRegs);
}
static DecodeStatus DecodeVSRpRCRegisterClass(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
return decodeRegisterClass(Inst, RegNo, VSRpRegs);
}
static DecodeStatus decodeUImmOperand(MCInst *Inst, uint64_t Imm,
int64_t Address, void *Decoder,
int N) {
// assert(isUInt(Imm, N) && "Invalid immediate");
MCOperand_CreateImm0(Inst, Imm);
return MCDisassembler_Success;
}
static DecodeStatus decodeSImmOperand(MCInst *Inst, uint64_t Imm,
int64_t Address, void *Decoder,
unsigned N) {
// assert(isUInt(Imm, N) && "Invalid immediate");
MCOperand_CreateImm0(Inst, SignExtend64(Imm, N));
return MCDisassembler_Success;
}
static DecodeStatus decodeImmZeroOperand(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
if (Imm != 0)
return MCDisassembler_Fail;
MCOperand_CreateImm0(Inst, Imm);
return MCDisassembler_Success;
}
static DecodeStatus decodeVSRpEvenOperands(MCInst *Inst, uint64_t RegNo,
uint64_t Address,
void *Decoder) {
if (RegNo & 1)
return MCDisassembler_Fail;
MCOperand_CreateReg0(Inst, VSRpRegs[RegNo >> 1]);
return MCDisassembler_Success;
}
static DecodeStatus decodeMemRIOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the memri field (imm, reg), which has the low 16-bits as the
// displacement and the next 5 bits as the register #.
uint64_t Base = Imm >> 16;
uint64_t Disp = Imm & 0xFFFF;
assert(Base < 32 && "Invalid base register");
switch (MCInst_getOpcode(Inst)) {
default:
break;
case PPC_LBZU:
case PPC_LHAU:
case PPC_LHZU:
case PPC_LWZU:
case PPC_LFSU:
case PPC_LFDU:
// Add the tied output operand.
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
break;
case PPC_STBU:
case PPC_STHU:
case PPC_STWU:
case PPC_STFSU:
case PPC_STFDU:
MCInst_insert0(Inst, 0, MCOperand_CreateReg1(Inst, RRegsNoR0[Base]));
break;
}
MCOperand_CreateImm0(Inst, SignExtend64(Disp, 16));
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeMemRIXOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the memrix field (imm, reg), which has the low 14-bits as the
// displacement and the next 5 bits as the register #.
uint64_t Base = Imm >> 14;
uint64_t Disp = Imm & 0x3FFF;
assert(Base < 32 && "Invalid base register");
if (MCInst_getOpcode(Inst) == PPC_LDU)
// Add the tied output operand.
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
else if (MCInst_getOpcode(Inst) == PPC_STDU)
MCInst_insert0(Inst, 0, MCOperand_CreateReg1(Inst, RRegsNoR0[Base]));
MCOperand_CreateImm0(Inst, SignExtend64(Disp << 2, 16));
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeMemRIHashOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the memrix field for a hash store or hash check operation.
// The field is composed of a register and an immediate value that is 6 bits
// and covers the range -8 to -512. The immediate is always negative and 2s
// complement which is why we sign extend a 7 bit value.
const uint64_t Base = Imm >> 6;
const int64_t Disp = SignExtend64((Imm & 0x3F, 7) + 64, 64) * 8;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, Disp);
MCOperand_CreateReg0(Inst, RRegs[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeMemRIX16Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the memrix16 field (imm, reg), which has the low 12-bits as the
// displacement with 16-byte aligned, and the next 5 bits as the register #.
uint64_t Base = Imm >> 12;
uint64_t Disp = Imm & 0xFFF;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, SignExtend64(Disp << 4, 16));
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeMemRI34PCRelOperands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the memri34_pcrel field (imm, reg), which has the low 34-bits as the
// displacement, and the next 5 bits as an immediate 0.
uint64_t Base = Imm >> 34;
uint64_t Disp = Imm & 0x3FFFFFFFFUL;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, SignExtend64(Disp, 34));
return decodeImmZeroOperand(Inst, Base, Address, Decoder);
}
static DecodeStatus decodeMemRI34Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the memri34 field (imm, reg), which has the low 34-bits as the
// displacement, and the next 5 bits as the register #.
uint64_t Base = Imm >> 34;
uint64_t Disp = Imm & 0x3FFFFFFFFUL;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, SignExtend64(Disp, 34));
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeSPE8Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the spe8disp field (imm, reg), which has the low 5-bits as the
// displacement with 8-byte aligned, and the next 5 bits as the register #.
uint64_t Base = Imm >> 5;
uint64_t Disp = Imm & 0x1F;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, Disp << 3);
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeSPE4Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the spe4disp field (imm, reg), which has the low 5-bits as the
// displacement with 4-byte aligned, and the next 5 bits as the register #.
uint64_t Base = Imm >> 5;
uint64_t Disp = Imm & 0x1F;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, Disp << 2);
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeSPE2Operands(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// Decode the spe2disp field (imm, reg), which has the low 5-bits as the
// displacement with 2-byte aligned, and the next 5 bits as the register #.
uint64_t Base = Imm >> 5;
uint64_t Disp = Imm & 0x1F;
assert(Base < 32 && "Invalid base register");
MCOperand_CreateImm0(Inst, Disp << 1);
MCOperand_CreateReg0(Inst, RRegsNoR0[Base]);
return MCDisassembler_Success;
}
static DecodeStatus decodeCRBitMOperand(MCInst *Inst, uint64_t Imm,
int64_t Address,
void *Decoder) {
// The cr bit encoding is 0x80 >> cr_reg_num.
unsigned Zeros = CountTrailingZeros_64(Imm);
assert(Zeros < 8 && "Invalid CR bit value");
MCOperand_CreateReg0(Inst, CRRegs[7 - Zeros]);
return MCDisassembler_Success;
}
#endif // CAPSTONE_CAPSTONEPPCMODULE_H
| 43.117363 | 80 | 0.571871 |
062758bdaea13be817d8352884b7799362eeacb6 | 755 | h | C | include/riku/net.h | maihd/riku | daca9172f4ee0e303060796e86859247e4306dcc | [
"Unlicense"
] | 2 | 2019-03-22T05:01:03.000Z | 2020-05-07T11:26:03.000Z | include/riku/net.h | maihd/riku | daca9172f4ee0e303060796e86859247e4306dcc | [
"Unlicense"
] | null | null | null | include/riku/net.h | maihd/riku | daca9172f4ee0e303060796e86859247e4306dcc | [
"Unlicense"
] | null | null | null | // Copyright (c) 2019, MaiHD. All right reversed.
// License: Unlicensed
#pragma once
#include "./core.h"
namespace net
{
struct Socket
{
public:
int handle;
bool is_server;
public:
RIKU_API Socket(void);
RIKU_API ~Socket(void);
public:
RIKU_API void close(void);
RIKU_API Socket accept(void);
RIKU_API int recv(void* buffer, int length);
RIKU_API int send(const void* buffer, int length);
};
RIKU_API bool is_ip(const char* input);
RIKU_API bool is_ipv4(const char* input);
RIKU_API bool is_ipv6(const char* input);
RIKU_API Socket connect(const char* host, int port);
RIKU_API Socket create_server(const char* host, int port);
} | 22.878788 | 62 | 0.631788 |
0629021241c85757577d86aa3fc47c7e95ce4d8d | 289 | h | C | ImageView01/ImageModel.h | WYPRita/ImageView | ca6fec90e20e580e4a324c5b2e18e30836981090 | [
"Apache-2.0"
] | null | null | null | ImageView01/ImageModel.h | WYPRita/ImageView | ca6fec90e20e580e4a324c5b2e18e30836981090 | [
"Apache-2.0"
] | null | null | null | ImageView01/ImageModel.h | WYPRita/ImageView | ca6fec90e20e580e4a324c5b2e18e30836981090 | [
"Apache-2.0"
] | null | null | null | //
// ImageModel.h
// ImageView01
//
// Created by wxweven on 16/5/3.
// Copyright © 2016年 wxweven. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ImageModel : NSObject
@property(nonatomic,copy) NSString *icon;
@property(nonatomic,copy) NSString *desc;
@end
| 16.055556 | 51 | 0.709343 |
06293420a040f29c5afdeba2dbafe4d50c01374d | 286 | h | C | Onyx2D/O2Font+PDF.h | bamwu/cocotron | 9cda7d719428a8ff940b134e391e511104ee0b5d | [
"MIT"
] | 374 | 2015-03-20T03:04:04.000Z | 2022-03-23T11:49:51.000Z | Onyx2D/O2Font+PDF.h | bamwu/cocotron | 9cda7d719428a8ff940b134e391e511104ee0b5d | [
"MIT"
] | 8 | 2015-05-01T17:10:19.000Z | 2018-03-10T13:51:52.000Z | Onyx2D/O2Font+PDF.h | bamwu/cocotron | 9cda7d719428a8ff940b134e391e511104ee0b5d | [
"MIT"
] | 99 | 2015-03-20T03:04:12.000Z | 2022-03-15T03:09:07.000Z | #import <Onyx2D/O2Font.h>
@class O2PDFObject, O2PDFContext;
@interface O2Font (PDF)
- (void)getMacRomanBytes:(unsigned char *)bytes forGlyphs:(const O2Glyph *)glyphs length:(unsigned)length;
- (O2PDFObject *)encodeReferenceWithContext:(O2PDFContext *)context size:(O2Float)size;
@end
| 31.777778 | 106 | 0.77972 |
062ab937de499368a6f199de01a64484e461da57 | 1,086 | h | C | System/Library/PrivateFrameworks/NewsCore.framework/FCABConfig.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 12 | 2019-06-02T02:42:41.000Z | 2021-04-13T07:22:20.000Z | System/Library/PrivateFrameworks/NewsCore.framework/FCABConfig.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/NewsCore.framework/FCABConfig.h | lechium/iPhoneOS_12.1.1_Headers | aac688b174273dfcbade13bab104461f463db772 | [
"MIT"
] | 3 | 2019-06-11T02:46:10.000Z | 2019-12-21T14:58:16.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Saturday, June 1, 2019 at 6:47:46 PM Mountain Standard Time
* Operating System: Version 12.1.1 (Build 16C5050a)
* Image Source: /System/Library/PrivateFrameworks/NewsCore.framework/NewsCore
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@class NSString;
@interface FCABConfig : NSObject {
unsigned long long _configID;
NSString* _title;
NSString* _configLog;
}
@property (nonatomic,readonly) unsigned long long configID; //@synthesize configID=_configID - In the implementation block
@property (nonatomic,readonly) NSString * title; //@synthesize title=_title - In the implementation block
@property (nonatomic,readonly) NSString * configLog; //@synthesize configLog=_configLog - In the implementation block
-(id)initWithConfigID:(unsigned long long)arg1 title:(id)arg2 configLog:(id)arg3 ;
-(unsigned long long)configID;
-(NSString *)configLog;
-(BOOL)isEqual:(id)arg1 ;
-(unsigned long long)hash;
-(NSString *)title;
@end
| 35.032258 | 137 | 0.725599 |
062de93faa80b04062f35fd1937141663bfbb07d | 897 | h | C | System/Library/PrivateFrameworks/PhotosUICore.framework/PXGDataSourceDrivenLayout.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | 1 | 2020-11-04T15:43:01.000Z | 2020-11-04T15:43:01.000Z | System/Library/PrivateFrameworks/PhotosUICore.framework/PXGDataSourceDrivenLayout.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/PhotosUICore.framework/PXGDataSourceDrivenLayout.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | /*
* This header is generated by classdump-dyld 1.0
* on Monday, September 28, 2020 at 5:54:57 PM Mountain Standard Time
* Operating System: Version 14.0 (Build 18A373)
* Image Source: /System/Library/PrivateFrameworks/PhotosUICore.framework/PhotosUICore
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
@protocol PXGDataSourceDrivenLayout <NSObject>
@required
-(void)applySectionedChangeDetails:(id)arg1 dataSourceAfterChanges:(id)arg2 sublayoutProvider:(id)arg3 outChangedSections:(id*)arg4 outSectionsWithItemChanges:(id*)arg5 changeMediaVersionHandler:(/*^block*/id)arg6;
-(void)applySectionedChangeDetailsForSingleSection:(id)arg1 dataSourceAfterChanges:(id)arg2 changeMediaVersionHandler:(/*^block*/id)arg3;
@end
| 52.764706 | 214 | 0.683389 |
062f90fbebd574de6f6126cdb93874237d45328c | 878 | h | C | MidtransCoreKit/MidtransCoreKit/MidtransPromo.h | denistirta/Veritrans-ios-sdk | fb98bd9e7579939f6c5be903ed9d124f617b5fd5 | [
"MIT"
] | 12 | 2016-10-05T05:25:33.000Z | 2021-02-12T07:08:19.000Z | MidtransCoreKit/MidtransCoreKit/MidtransPromo.h | denistirta/Veritrans-ios-sdk | fb98bd9e7579939f6c5be903ed9d124f617b5fd5 | [
"MIT"
] | 114 | 2016-06-07T10:01:35.000Z | 2022-03-28T06:08:26.000Z | MidtransCoreKit/MidtransCoreKit/MidtransPromo.h | denistirta/Veritrans-ios-sdk | fb98bd9e7579939f6c5be903ed9d124f617b5fd5 | [
"MIT"
] | 35 | 2016-06-02T15:44:43.000Z | 2022-03-25T06:56:19.000Z | //
// MidtransPromo.h
//
// Created by Nanang on 2/6/17
// Copyright (c) 2017 Zahir. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface MidtransPromo : NSObject <NSCoding, NSCopying>
@property (nonatomic) id sponsorMessageEn;
@property (nonatomic, strong) NSString *promoCode;
@property (nonatomic, strong) NSString *discountType;
@property (nonatomic, assign) double promoIdentifier;
@property (nonatomic, strong) NSString *sponsorName;
@property (nonatomic, strong) NSArray *bins;
@property (nonatomic, strong) NSString *startDate;
@property (nonatomic) id sponsorMessageId;
@property (nonatomic, assign) double discountAmount;
@property (nonatomic, strong) NSString *endDate;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
| 29.266667 | 63 | 0.771071 |
0630eee0106423443e92c64ba4dba697aa70f162 | 11,418 | c | C | src/sdes.c | Sholde/des | b213f3339ae8ee89efeaefb58c96cebd45aae06b | [
"MIT"
] | 2 | 2020-05-22T22:09:01.000Z | 2020-05-27T20:39:48.000Z | src/sdes.c | Sholde/des | b213f3339ae8ee89efeaefb58c96cebd45aae06b | [
"MIT"
] | 2 | 2020-05-24T22:02:52.000Z | 2020-05-25T13:27:24.000Z | src/sdes.c | Sholde/des | b213f3339ae8ee89efeaefb58c96cebd45aae06b | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sdes.h"
/* Global tab */
const int IP[64] = {58, 50, 42, 34, 26, 18, 10, 2,
60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6,
64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1,
59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5,
63, 55, 47, 39, 31, 23, 15, 7};
const int IP_1[64] = {40, 8, 48, 16, 56, 24, 64, 32,
39, 7, 47, 15, 55, 23, 63, 31,
38, 6, 46, 14, 54, 22, 62, 30,
37, 5, 45, 13, 53, 21, 61, 29,
36, 4, 44, 12, 52, 20, 60, 28,
35, 3, 43, 11, 51, 19, 59, 27,
34, 2, 42, 10, 50, 18, 58, 26,
33, 1, 41, 9, 49, 17, 57, 25};
const int E[48] = { 32, 1, 2, 3, 4, 5,
4, 5, 6, 7, 8, 9,
8, 9, 10, 11, 12, 13,
12, 13, 14, 15, 16, 17,
16, 17, 18, 19, 20, 21,
20, 21, 22, 23, 24, 25,
24, 25, 26, 27, 28, 29,
28, 29, 30, 31, 32, 1};
const int S1[64] = {14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13};
const int S2[64] = {15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9};
const int S3[64] = {10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12};
const int S4[64] = { 7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14};
const int S5[64] = { 2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3};
const int S6[64] = {12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13};
const int S7[64] = { 4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12};
const int S8[64] = {13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11};
const int P[32] = {16, 7, 20, 21,
29, 12, 28, 17,
1, 15, 23, 26,
5, 18, 31, 10,
2, 8, 24, 14,
32, 27, 3, 9,
19, 13, 30, 6,
22, 11, 4, 25};
/* Function */
des_t *des_set_str(const char *s, const char *type)
{
if(strcmp(type, "str") == 0)
{
int len = strlen(s);
des_t *m = malloc(sizeof(des_t));
m->size = len / 8;
if((len * 8) % 64)
m->size++;
m->tab = malloc(sizeof(u64) * m->size);
int count = 0;
for(int i = 0; i < len; i++)
{
count = (i * 8) / 64;
m->tab[count] <<= 8;
m->tab[count] ^= s[i];
}
m->tab[count] <<= 64 - (len * 8) % 64;
return m;
}
else if(strcmp(type, "hex") == 0)
{
int len = strlen(s);
des_t *m = malloc(sizeof(des_t));
m->size = len / 4;
if((len * 4) % 64)
m->size++;
m->tab = malloc(sizeof(u64) * m->size);
int count = 0;
for(int i = 0; i < len; i++)
{
u64 tmp = s[i];
if(tmp >= 48 && tmp <= 57) {
tmp -= 48;
}
else if (tmp >= 97 && tmp <= 102) {
tmp -= (97 - 10);
}
else {
exit(666);
}
count = (i * 4) / 64;
m->tab[count] <<= 4;
m->tab[count] ^= tmp;
}
m->tab[count] <<= 64 - (len * 4) % 64;
return m;
}
else
{
printf("Format not supported. Use str or hexa\n");
exit(666);
}
}
char *des_get_str(des_t *m, const char *type)
{
if(strcmp(type, "str") == 0)
{
int len = m->size * 8;
char *ret = malloc(sizeof(char) * (len + 1));
ret[len] = '\0';
for(int i = 0; i < m->size; i++)
{
for(int j = 0; j < 8; j++)
{
ret[i*8+j] = (m->tab[i] >> (64 - (j + 1) * 8)) & 0xFF;
}
}
return ret;
}
else if(strcmp(type, "hex") == 0)
{
int len = m->size * 16;
char *ret = malloc(sizeof(char) * (len + 1));
ret[len] = '\0';
for(int i = 0; i < m->size; i++)
{
for(int j = 0; j < 16; j++)
{
u8 tmp = (m->tab[i] >> (64 - (j + 1) * 4)) & 0xF;
if(tmp > 15 || tmp < 0) {
exit(666);
}
if(tmp < 10) {
tmp += 48;
}
else {
tmp += 87;
}
ret[i*16+j] = tmp;
}
}
return ret;
}
else
{
printf("Format not supported. Use str or hexa\n");
exit(666);
}
}
des_t *des_init(u64 size)
{
des_t *m = malloc(sizeof(des_t));
m->tab = malloc(sizeof(u64) * size);
m->size = size;
return m;
}
void des_free(des_t *d)
{
free(d->tab);
free(d);
}
void swap_32(u32 *l, u32 *r)
{
u32 tmp = *l;
*l = *r;
*r = tmp;
}
void swap_48(u48 *a, u48 *b)
{
u48 tmp = *a;
*a = *b;
*b = tmp;
}
u64 generate_key_des(const char *s)
{
u64 key = 0;
int length = strlen(s);
for(int i = 0; i < length; i++)
{
key ^= (s[i] << (8 * (i % 8)));
}
return key;
}
u64 *generate_key_3des(const char *s)
{
u64 *key = malloc(sizeof(u64) * 3);
int length = strlen(s);
key[0] = 0; key[1] = 0; key[2] = 0;
for(int i = 0; i < length; i++)
{
key[(i%8)%3] ^= (s[i] << (8 * (i % 8)));
}
return key;
}
u48 *generate_sub_keys(const u64 key) {
u48 *sub_keys = malloc(sizeof(u48) * 16);
sub_keys[0] = key;
for(int i = 1; i < 16; i++)
{
sub_keys[i] = rrot64(key, i*4) % 0xFFFFFFFFFF;
}
return sub_keys;
}
void rotate_sub_keys(u48 *sub_keys)
{
swap_48(&sub_keys[0], &sub_keys[15]);
swap_48(&sub_keys[1], &sub_keys[14]);
swap_48(&sub_keys[2], &sub_keys[13]);
swap_48(&sub_keys[3], &sub_keys[12]);
swap_48(&sub_keys[4], &sub_keys[11]);
swap_48(&sub_keys[5], &sub_keys[10]);
swap_48(&sub_keys[6], &sub_keys[9]);
swap_48(&sub_keys[7], &sub_keys[8]);
}
u32 s_box(const u48 n)
{
u8 s1 = n >> 42;
u8 s2 = (n >> 36) & 0x3F;
u8 s3 = (n >> 30) & 0x3F;
u8 s4 = (n >> 24) & 0x3F;
u8 s5 = (n >> 18) & 0x3F;
u8 s6 = (n >> 12) & 0x3F;
u8 s7 = (n >> 6) & 0x3F;
u8 s8 = n & 0x3F;
u32 res = 0;
res ^= S1[(s1 >> 4) * 16 + (s1 & 0xF)];
res <<= 4;
res ^= S2[(s2 >> 4) * 16 + (s2 & 0xF)];
res <<= 4;
res ^= S3[(s3 >> 4) * 16 + (s3 & 0xF)];
res <<= 4;
res ^= S4[(s4 >> 4) * 16 + (s4 & 0xF)];
res <<= 4;
res ^= S5[(s5 >> 4) * 16 + (s5 & 0xF)];
res <<= 4;
res ^= S6[(s6 >> 4) * 16 + (s6 & 0xF)];
res <<= 4;
res ^= S7[(s7 >> 4) * 16 + (s7 & 0xF)];
res <<= 4;
res ^= S8[(s8 >> 4) * 16 + (s8 & 0xF)];
return res;
}
u64 permutation(const int *tab, const u64 n, const int size)
{
u64 res = 0;
for(int i = 0; i < size; i++)
{
res <<= 1;
res ^= des_test_bit(n, tab[i], size);
}
return res;
}
u32 function_f(const u32 r0, const u48 sub_key)
{
u48 r0_exp = permutation(E, r0, 48);
r0_exp ^= sub_key;
u32 res_s_box = s_box(r0_exp);
u32 res_permutation = permutation(P, res_s_box, 32);
return res_permutation;
}
u64 des_block(const u48 *sub_keys, const u64 input)
{
u64 res = permutation(IP, input, 64);
u32 l = res >> 32;
u32 r = res & 0xFFFFFFFF;
for(int i = 0; i < 16; i++)
{
u32 tmp = r;
r = l ^ function_f(r, sub_keys[i]);
l = tmp;
}
swap_32(&l, &r);
res = ((u64)l << 32) ^ (u64)r;
res = permutation(IP_1, res, 64);
return res;
}
des_t *des(const u48 *sub_keys, des_t *input)
{
des_t *m = des_init(input->size);
for(int i = 0; i < m->size; i++)
{
m->tab[i] = des_block(sub_keys, input->tab[i]);
}
return m;
}
char *encrypt_des(const char *pw, const char *message)
{
u64 key = generate_key_des(pw);
u48 *sub_keys = generate_sub_keys(key);
des_t *m = des_set_str(message, "str");
des_t *c = des(sub_keys, m);
char *cipher = des_get_str(c, "hex");
// Clear
des_free(m);
des_free(c);
free(sub_keys);
return cipher;
}
char *decrypt_des(const char *pw, const char *cipher)
{
u64 key = generate_key_des(pw);
u48 *sub_keys = generate_sub_keys(key);
rotate_sub_keys(sub_keys);
des_t *c = des_set_str(cipher, "hex");
des_t *d = des(sub_keys, c);
char *decipher = des_get_str(d, "str");
// Clear
des_free(c);
des_free(d);
free(sub_keys);
return decipher;
}
char *encrypt_3des(const char *pw, const char *message)
{
u64 *key = generate_key_3des(pw);
des_t *m = des_set_str(message, "str");
u48 *sub_keys0 = generate_sub_keys(key[0]);
des_t *c0 = des(sub_keys0, m);
u48 *sub_keys1 = generate_sub_keys(key[1]);
rotate_sub_keys(sub_keys1);
des_t *c1 = des(sub_keys1, c0);
u48 *sub_keys2 = generate_sub_keys(key[2]);
des_t *c2 = des(sub_keys2, c1);
char *cipher = des_get_str(c2, "hex");
// Clear
des_free(m);
des_free(c0);
des_free(c1);
des_free(c2);
free(key);
free(sub_keys0);
free(sub_keys1);
free(sub_keys2);
return cipher;
}
char *decrypt_3des(const char *pw, const char *cipher)
{
u64 *key = generate_key_3des(pw);
des_t *m = des_set_str(cipher, "hex");
u48 *sub_keys2 = generate_sub_keys(key[2]);
rotate_sub_keys(sub_keys2);
des_t *d2 = des(sub_keys2, m);
u48 *sub_keys1 = generate_sub_keys(key[1]);
des_t *d1 = des(sub_keys1, d2);
u48 *sub_keys0 = generate_sub_keys(key[0]);
rotate_sub_keys(sub_keys0);
des_t *d0 = des(sub_keys0, d1);
char *decipher = des_get_str(d0, "str");
// Clear
des_free(m);
des_free(d0);
des_free(d1);
des_free(d2);
free(key);
free(sub_keys0);
free(sub_keys1);
free(sub_keys2);
return decipher;
} | 24.930131 | 84 | 0.440708 |
0634ad217943f4c18fc84b514ce6ae0e9d40f744 | 1,598 | c | C | rank.c | freebee-game/console-client | f956adc1ca5bda73c91a11bae856e64e37d702db | [
"0BSD"
] | 5 | 2020-07-18T05:54:09.000Z | 2022-03-02T21:43:05.000Z | rank.c | freebee-game/console-client | f956adc1ca5bda73c91a11bae856e64e37d702db | [
"0BSD"
] | 1 | 2022-03-05T15:35:32.000Z | 2022-03-05T15:35:32.000Z | rank.c | freebee-game/console-client | f956adc1ca5bda73c91a11bae856e64e37d702db | [
"0BSD"
] | 2 | 2022-03-02T23:51:39.000Z | 2022-03-05T15:07:24.000Z | /*
* Copyright (c) 2020 Brian Callahan <bcallah@openbsd.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND 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.
*/
#include <limits.h>
#include <stdio.h>
#include "freebee.h"
const char *
rank(void)
{
if (points >= queen)
return "Queen Bee!";
else if (points >= outstanding)
return "Outstanding";
else if (points >= marvellous)
return "Marvellous";
else if (points >= superb)
return "Superb";
else if (points >= excellent)
return "Excellent";
else if (points >= skilled)
return "Skilled";
else if (points >= fine)
return "Fine";
else if (points >= novice)
return "Novice";
return "Newbie";
}
/*
* I did the math on an NYT game.
* These were the results.
*/
void
set_rank(void)
{
novice = total * 0.02;
fine = total * 0.05;
skilled = total * 0.08;
excellent = total * 0.15;
superb = total * 0.25;
marvellous = total * 0.40;
outstanding = total * 0.50;
queen = total * 0.70;
}
| 25.365079 | 75 | 0.70025 |
063656a2ce3e9d05abe65a637dc02d5036362fe9 | 1,065 | h | C | plugin_III/game_III/CDirectory.h | gta-chaos-mod/plugin-sdk | e3bf176337774a2afc797a47825f81adde78e899 | [
"Zlib"
] | 368 | 2015-01-01T21:42:00.000Z | 2022-03-29T06:22:22.000Z | plugin_III/game_III/CDirectory.h | SteepCheat/plugin-sdk | a17c5d933cb8b06e4959b370092828a6a7aa00ef | [
"Zlib"
] | 89 | 2016-05-08T06:42:36.000Z | 2022-03-29T06:49:09.000Z | plugin_III/game_III/CDirectory.h | SteepCheat/plugin-sdk | a17c5d933cb8b06e4959b370092828a6a7aa00ef | [
"Zlib"
] | 179 | 2015-02-03T23:41:17.000Z | 2022-03-26T08:27:16.000Z | /*
Plugin-SDK (Grand Theft Auto 3) header file
Authors: GTA Community. See more here
https://github.com/DK22Pac/plugin-sdk
Do not delete this comment block. Respect others' work!
*/
#pragma once
#include "PluginBase.h"
//! http://www.gtamodding.com/wiki/IMG_archive#Version_1_-_GTA_III_.26_VC
class PLUGIN_API CDirectory {
PLUGIN_NO_DEFAULT_CONSTRUCTION(CDirectory)
public:
struct PLUGIN_API DirectoryInfo {
unsigned int m_nOffset;
unsigned int m_nSize;
char m_szName[24];
};
DirectoryInfo *m_pEntries;
int m_nCapacity;
int m_nNumEntries;
SUPPORTED_10EN_11EN_STEAM void AddItem(CDirectory::DirectoryInfo const &entry);
SUPPORTED_10EN_11EN_STEAM bool FindItem(char const *name, unsigned int &outOffset, unsigned int &outSize);
SUPPORTED_10EN_11EN_STEAM void ReadDirFile(char const *fileName);
SUPPORTED_10EN_11EN_STEAM bool WriteDirFile(char const *fileName);
};
VALIDATE_SIZE(CDirectory::DirectoryInfo, 0x20);
VALIDATE_SIZE(CDirectory, 0xC);
#include "meta/meta.CDirectory.h"
| 28.783784 | 110 | 0.74554 |
0637a012054cf115d2f5390ba2a536e579910e80 | 5,139 | h | C | bitnumber/Flags.h | basicpp17/cpp17_flags | fcb45ff5fca54ee16cfc0a8dd9b90d6d6e0466e5 | [
"Apache-2.0"
] | 17 | 2017-12-14T15:20:00.000Z | 2021-11-19T12:14:15.000Z | bitnumber/Flags.h | arBmind/cpp17_flags | fcb45ff5fca54ee16cfc0a8dd9b90d6d6e0466e5 | [
"Apache-2.0"
] | null | null | null | bitnumber/Flags.h | arBmind/cpp17_flags | fcb45ff5fca54ee16cfc0a8dd9b90d6d6e0466e5 | [
"Apache-2.0"
] | 1 | 2019-01-11T21:18:46.000Z | 2019-01-11T21:18:46.000Z | #pragma once
#include <cinttypes>
#include <initializer_list>
#include <type_traits>
namespace bitnumber {
#define ENABLE_BITNUMBER_FLAGS_OP(T) \
constexpr auto operator|(T::EnumType e1, T::EnumType e2) noexcept->T { return T(e1) | e2; }
template<class T, class V = uint64_t>
struct Flags {
using This = Flags;
static_assert(std::is_enum_v<T>, "flags only works for enums!");
using EnumType = T;
using ValueType = std::underlying_type_t<T>;
using BitType = V;
constexpr Flags(T v) noexcept
: Flags(BitType{1} << static_cast<ValueType>(v)) {}
template<class... Args>
constexpr Flags(T v, Args... args) noexcept
: Flags(build(v, args...)) {}
constexpr Flags() noexcept = default;
~Flags() noexcept = default;
constexpr Flags(const This &) noexcept = default;
constexpr Flags(This &&) noexcept = default;
constexpr auto operator=(const This &) noexcept -> This & = default;
constexpr auto operator=(This &&) noexcept -> This & = default;
constexpr void swap(This &fl) noexcept { std::swap(v, fl.v); }
constexpr bool operator==(const This &f) const noexcept { return v == f.v; }
constexpr bool operator!=(const This &f) const noexcept { return v != f.v; }
template<class B>
constexpr bool operator[](T t) const noexcept {
return (v & This{t}.v) != BitType{};
}
constexpr bool all(This b) const noexcept { return (v & b.v) == b.v; }
template<class... Args>
constexpr bool all(T b, Args... args) const noexcept {
return all(build(b, args...));
}
constexpr bool any(This f) const noexcept { return (v & f.v) != BitType{}; }
template<class... Args>
constexpr bool any(T b, Args... args) const noexcept {
return any(build(b, args...));
}
constexpr bool none() const noexcept { return v == 0; }
constexpr bool none(This f) const noexcept { return (v & f.v) == BitType{}; }
template<class... Args>
constexpr bool none(T b, Args... args) const noexcept {
return none(build(b, args...));
}
constexpr static auto resetAll() noexcept -> This { return Flags{}; }
constexpr auto set(This b) const noexcept -> This { return This{v | b.v}; }
template<class... Args>
constexpr auto set(T b, Args... args) const noexcept -> This {
return set(build(b, args...));
}
constexpr auto reset(This b) const noexcept -> This { return This{v & ~b.v}; }
template<class... Args>
constexpr auto reset(T b, Args... args) const noexcept -> This {
return reset(build(b, args...));
}
constexpr auto flip(This b) const noexcept -> This { return This{v ^ b.v}; }
template<class... Args>
constexpr auto flip(T b, Args... args) const noexcept -> This {
return flip(build(b, args...));
}
constexpr auto mask(This b) const noexcept -> This { return This{v & b.v}; }
template<class... Args>
constexpr auto mask(T b, Args... args) const noexcept -> This {
return mask(build(b, args...));
}
constexpr This operator|(const This &f) const noexcept { return {v | f.v}; }
constexpr Flags clear(const Flags &f) const noexcept { return {v & ~f.v}; }
template<class... Args>
constexpr bool clear(const T &v, Args &&... args) const noexcept {
return clear(build(v, args...));
}
template<class B>
constexpr auto operator|(B b) const noexcept -> This {
return set(b);
}
template<class B>
constexpr auto operator&(B b) const noexcept -> This {
return mask(b);
}
template<class B>
constexpr auto operator^(B b) const noexcept -> This {
return flip(b);
}
template<class B>
constexpr auto operator|=(B b) noexcept -> This & {
return *this = set(b);
}
template<class B>
constexpr auto operator&=(B b) noexcept -> This & {
return *this = mask(b);
}
template<class B>
constexpr auto operator^=(B b) noexcept -> This & {
return *this = flip(b);
}
template<class F>
constexpr void each_set(F &&f) const noexcept {
auto vt = ValueType{};
while (true) {
const auto t = static_cast<T>(vt);
const auto ft = Flags{t};
if (ft.v > v) break;
if (any(t)) f(t);
vt++;
}
}
private:
constexpr Flags(BitType v) noexcept
: v(v) {}
template<class... Args>
static constexpr auto build(Args... args) noexcept -> Flags {
return Flags{(... | Flags{args})};
}
private:
BitType v{};
};
template<class Out, class T>
auto operator<<(Out &out, Flags<T> f)
-> std::enable_if_t<std::is_same_v<decltype(out << std::declval<T>()), decltype(out)>, decltype(out)> //
{
using flags_type = Flags<T>;
if (f == flags_type{}) return out << "<None>";
f.each_set([&, first = true](T t) mutable {
if (!first)
out << " | ";
else
first = false;
out << t;
});
return out;
}
} // namespace bitnumber
| 30.957831 | 120 | 0.580074 |
063966672f7745eba209808ecee7775f96671094 | 10,441 | h | C | Boards/LDM-uROB-K1986BE1QI/LedBlink/SPL/inc/MDR32F9Qx_power.h | L-proger/Milandr.Examples | 671763dc4a3cbb5acd08386453ec3c30afae7e28 | [
"MIT"
] | null | null | null | Boards/LDM-uROB-K1986BE1QI/LedBlink/SPL/inc/MDR32F9Qx_power.h | L-proger/Milandr.Examples | 671763dc4a3cbb5acd08386453ec3c30afae7e28 | [
"MIT"
] | null | null | null | Boards/LDM-uROB-K1986BE1QI/LedBlink/SPL/inc/MDR32F9Qx_power.h | L-proger/Milandr.Examples | 671763dc4a3cbb5acd08386453ec3c30afae7e28 | [
"MIT"
] | null | null | null | /**
******************************************************************************
* @file MDR32F9Qx_power.h
* @author Milandr Application Team
* @version V2.0.0
* @date 06/05/2021
* @brief This file contains all the functions prototypes for the POWER
* firmware library.
******************************************************************************
* <br><br>
*
* THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
* WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
* TIME. AS A RESULT, MILANDR SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT
* OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
* FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
* CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
*
* <h2><center>© COPYRIGHT 2021 Milandr</center></h2>
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MDR32F9Qx_POWER_H
#define __MDR32F9Qx_POWER_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "MDR32F9Qx_config.h"
/** @addtogroup __MDR32Fx_StdPeriph_Driver MDR32Fx Standard Peripherial Driver
* @{
*/
/** @addtogroup POWER
* @{
*/
/** @defgroup POWER_Exported_Types POWER Exported Types
* @{
*/
#if defined (MDR_LEGACY_SUPPORT) && (MDR_LEGACY_SUPPORT) == 153
#define POWER_DUCC_MODE(par) ((uint32_t)((par << 3)|(par)))
/**
* @brief POWER Ducc Mode
*/
typedef enum
{
POWER_DUcc_upto_10MHz = POWER_DUCC_MODE(0), /*!< system clock is up to 10 MHz */
POWER_DUcc_upto_200kHz = POWER_DUCC_MODE(1), /*!< system clock is up to 200 kHz */
POWER_DUcc_upto_500kHz = POWER_DUCC_MODE(2), /*!< system clock is up to 500 kHz */
POWER_DUcc_upto_1MHz = POWER_DUCC_MODE(3), /*!< system clock is up to 1 MHz */
POWER_DUcc_clk_off = POWER_DUCC_MODE(4), /*!< all clocks are switched off */
POWER_DUcc_upto_40MHz = POWER_DUCC_MODE(5), /*!< system clock is up to 40 MHz */
POWER_DUcc_upto_80MHz = POWER_DUCC_MODE(6), /*!< system clock is up to 80 MHz */
POWER_DUcc_over_80MHz = POWER_DUCC_MODE(7) /*!< system clock is over 80 MHz */
} PWR_DUcc_Mode;
#define IS_POWER_DUCC_MODE(MODE) (((MODE) == POWER_DUcc_upto_10MHz) || \
((MODE) == POWER_DUcc_upto_200kHz)|| \
((MODE) == POWER_DUcc_upto_500kHz)|| \
((MODE) == POWER_DUcc_clk_off) || \
((MODE) == POWER_DUcc_upto_1MHz) || \
((MODE) == POWER_DUcc_upto_40MHz) || \
((MODE) == POWER_DUcc_upto_80MHz) || \
((MODE) == POWER_DUcc_over_80MHz))
/**
* @brief POWER Ducc Trim
*/
typedef enum
{
POWER_DUcc_plus_100mV = ((uint32_t)(0x0000 << 8)), /*!< trim DUcc with + 100mV */
POWER_DUcc_plus_060mV = ((uint32_t)(0x0001 << 8)), /*!< trim DUcc with + 060mV */
POWER_DUcc_plus_040mV = ((uint32_t)(0x0002 << 8)), /*!< trim DUcc with + 040mV */
POWER_DUcc_plus_010mV = ((uint32_t)(0x0003 << 8)), /*!< trim DUcc with + 010mV */
POWER_DUcc_minus_010mV = ((uint32_t)(0x0004 << 8)), /*!< trim DUcc with - 010mV */
POWER_DUcc_minus_040mV = ((uint32_t)(0x0005 << 8)), /*!< trim DUcc with - 040mV */
POWER_DUcc_minus_060mV = ((uint32_t)(0x0006 << 8)), /*!< trim DUcc with - 060mV */
POWER_DUcc_minus_100mV = ((uint32_t)(0x0007 << 8)) /*!< trim DUcc with - 100mV */
} PWR_DUcc_Trim;
#define IS_POWER_DUCC_TRIM(TRIM) (((TRIM) == POWER_DUcc_plus_100mV) || \
((TRIM) == POWER_DUcc_plus_060mV) || \
((TRIM) == POWER_DUcc_plus_040mV) || \
((TRIM) == POWER_DUcc_plus_010mV) || \
((TRIM) == POWER_DUcc_minus_010mV)|| \
((TRIM) == POWER_DUcc_minus_040mV)|| \
((TRIM) == POWER_DUcc_minus_060mV)|| \
((TRIM) == POWER_DUcc_minus_100mV))
#endif /* MDR_LEGACY_SUPPORT 153 */
/**
* @brief POWER Voltage Detector Level
*/
typedef enum
{
PWR_PVDlevel_2V0 = ((uint32_t)(0x00 << 3)), /*!< PVD detection level set to 2.0V */
PWR_PVDlevel_2V2 = ((uint32_t)(0x01 << 3)), /*!< PVD detection level set to 2.2V */
PWR_PVDlevel_2V4 = ((uint32_t)(0x02 << 3)), /*!< PVD detection level set to 2.4V */
PWR_PVDlevel_2V6 = ((uint32_t)(0x03 << 3)), /*!< PVD detection level set to 2.6V */
PWR_PVDlevel_2V8 = ((uint32_t)(0x04 << 3)), /*!< PVD detection level set to 2.8V */
PWR_PVDlevel_3V0 = ((uint32_t)(0x05 << 3)), /*!< PVD detection level set to 3.0V */
PWR_PVDlevel_3V2 = ((uint32_t)(0x06 << 3)), /*!< PVD detection level set to 3.2V */
PWR_PVDlevel_3V4 = ((uint32_t)(0x07 << 3)) /*!< PVD detection level set to 3.4V */
} PWR_Voltage_Detector_Lvl;
#define IS_POWER_PVD_LEVEL(LVL) (((LVL) == PWR_PVDlevel_2V0) || \
((LVL) == PWR_PVDlevel_2V2) || \
((LVL) == PWR_PVDlevel_2V4) || \
((LVL) == PWR_PVDlevel_2V6) || \
((LVL) == PWR_PVDlevel_2V8) || \
((LVL) == PWR_PVDlevel_3V0) || \
((LVL) == PWR_PVDlevel_3V2) || \
((LVL) == PWR_PVDlevel_3V4))
/**
* @brief POWER Battery Voltage Detector Level
*/
typedef enum
{
PWR_PVBDlevel_1V8 = ((uint32_t)(0x00 << 1)), /*!< PVBD detection level set to 1.8V */
PWR_PVBDlevel_2V2 = ((uint32_t)(0x01 << 1)), /*!< PVBD detection level set to 2.2V */
PWR_PVBDlevel_2V6 = ((uint32_t)(0x02 << 1)), /*!< PVBD detection level set to 2.6V */
PWR_PVBDlevel_3V0 = ((uint32_t)(0x03 << 1)) /*!< PVBD detection level set to 3.0V */
} PWR_Batt_Voltage_Detector_Lvl;
#define IS_POWER_PVBD_LEVEL(LVL) (((LVL) == PWR_PVBDlevel_1V8) || \
((LVL) == PWR_PVBDlevel_2V2) || \
((LVL) == PWR_PVBDlevel_2V6) || \
((LVL) == PWR_PVBDlevel_3V0))
/**
* @brief POWER Voltage Detector Output Flags
*/
typedef enum
{
POWER_FLAG_PVD = ((uint32_t)POWER_PVDCS_PVD), /*!< Power voltage detection flag */
POWER_FLAG_PVBD = ((uint32_t)POWER_PVDCS_PVBD) /*!< Battery voltage detection flag */
} PWR_Voltage_Detector_Flags;
#define IS_POWER_FLAG(F) (((F) == POWER_FLAG_PVD) || ((F) == POWER_FLAG_PVBD))
#define IS_POWER_FLAGS(F) (((F) == POWER_FLAG_PVD) || \
((F) == POWER_FLAG_PVBD) || \
((F) == (POWER_FLAG_PVD & POWER_FLAG_PVBD)))
/**
* @brief POWER Voltage Detector Interrupt Enable
*/
typedef enum
{
POWER_PVD_IT = ((uint32_t)POWER_PVDCS_IEPVD), /*!< PVD interrupt enable */
POWER_PVBD_IT = ((uint32_t)POWER_PVDCS_IEPVBD) /*!< PVBD interrupt enable */
} PWR_Voltage_Detector_ITEnable;
#define IS_POWER_PVD_IT(F) (((F) == POWER_PVD_IT) || ((F) == POWER_PVBD_IT))
/**
* @brief POWER Voltage Detector Interrupt Inversion
*/
typedef enum
{
POWER_PVD_INV = ((uint32_t)POWER_PVDCS_INV), /*!< PVD inversion enable */
POWER_PVBD_INV = ((uint32_t)POWER_PVDCS_INVB) /*!< PVBD inversion enable */
} PWR_Voltage_Detector_IT_Inversion;
#define IS_POWER_PVD_INV(F) (((F) == POWER_PVD_INV) || ((F) == POWER_PVBD_INV))
#if defined (MDR_LEGACY_SUPPORT) && (MDR_LEGACY_SUPPORT) == 153
#if defined (USE_MDR1986VE1T) || defined (USE_MDR1986VE3)
/**
* @brief POWER Trim
*/
typedef enum
{
POWER_TRIM_1_8_V = (0 << BKP_REG_0E_TRIM_34_Pos),
POWER_TRIM_1_6_V = (1 << BKP_REG_0E_TRIM_34_Pos),
POWER_TRIM_1_4_V = (2 << BKP_REG_0E_TRIM_34_Pos)
} PWR_Trim;
#define IS_POWER_TRIM(TRIM) (((TRIM) == POWER_TRIM_1_4_V) || \
((TRIM) == POWER_TRIM_1_6_V) || \
((TRIM) == POWER_TRIM_1_8_V))
#endif /* #if defined (USE_MDR1986VE1T) || defined (USE_MDR1986VE3) */
#if defined (USE_MDR1986VE9x) || defined (USE_MDR1901VC1T)
/**
* @brief POWER Stop Entry Mode
*/
typedef enum
{
POWER_STOPentry_WFE = ((uint32_t)0x00), /*!< enter STOP mode with WFE instruction */
POWER_STOPentry_WFI = ((uint32_t)0x01) /*!< enter STOP mode with WFI instruction */
} PWR_Stop_Entry_Mode;
#define IS_POWER_STOP_ENTRY(F) (((F) == POWER_STOPentry_WFI) || \
((F) == POWER_STOPentry_WFE))
#endif /* #if defined (USE_MDR1986VE9x) || defined (USE_MDR1901VC1T) */
#endif /* MDR_LEGACY_SUPPORT 153 */
/** @} */ /* End of group POWER_Exported_Types */
/** @defgroup POWER_Exported_Functions POWER Exported Functions
* @{
*/
void POWER_DeInit(void);
#if defined (MDR_LEGACY_SUPPORT) && (MDR_LEGACY_SUPPORT) == 153
void POWER_DUccMode(PWR_DUcc_Mode DUccMode);
void POWER_DUccTrim(PWR_DUcc_Trim DUccTrim);
void POWER_DUccStandby(void);
void POWER_EnterSTANDBYMode(void);
void POWER_SetFlagPOR(void);
ErrorStatus POWER_FlagPORstatus(void);
#if defined (USE_MDR1986VE9x) || defined (USE_MDR1901VC1T)
void POWER_EnterSTOPMode(FunctionalState POWER_Regulator_state, PWR_Stop_Entry_Mode POWER_STOPEntry);
#elif defined (USE_MDR1986VE1T) || defined (USE_MDR1986VE3)
void POWER_EnterSLEEPMode(void);
void POWER_SetTrim(PWR_Trim ducc_trim);
#endif
#endif /* MDR_LEGACY_SUPPORT 153 */
void POWER_PVDenable(FunctionalState NewState);
void POWER_PVDlevelConfig(PWR_Voltage_Detector_Lvl POWER_PVDlevel);
void POWER_PVBDlevelConfig(PWR_Batt_Voltage_Detector_Lvl POWER_PVBDlevel);
FlagStatus POWER_GetFlagStatus(PWR_Voltage_Detector_Flags POWER_FLAG);
void POWER_ClearFlag(uint32_t POWER_FLAG);
void POWER_PVD_ITconfig(uint32_t POWER_IT, FunctionalState NewState);
void POWER_PVD_INVconfig(uint32_t POWER_INV, FunctionalState NewState);
/** @} */ /* End of group POWER_Exported_Functions */
/** @} */ /* End of group POWER */
/** @} */ /* End of group __MDR32Fx_StdPeriph_Driver */
#ifdef __cplusplus
} // extern "C" block end
#endif
#endif /* __MDR32F9Qx_POWER_H */
/*********************** (C) COPYRIGHT 2021 Milandr ****************************
*
* END OF FILE MDR32F9Qx_power.h */
| 40.157692 | 105 | 0.597357 |
063a1d5f4743e5eb4617fb8e6557510ffbea729d | 3,112 | c | C | UDTswap_scripts/UDTswap_lock_udt_based.c | GrowFi-labs/UDTswap | fff0f31450468a8978108380fba24a1d1eff917e | [
"MIT"
] | null | null | null | UDTswap_scripts/UDTswap_lock_udt_based.c | GrowFi-labs/UDTswap | fff0f31450468a8978108380fba24a1d1eff917e | [
"MIT"
] | null | null | null | UDTswap_scripts/UDTswap_lock_udt_based.c | GrowFi-labs/UDTswap | fff0f31450468a8978108380fba24a1d1eff917e | [
"MIT"
] | null | null | null | #include <memory.h>
#include "ckb_syscalls.h"
#include "udtswap_common.h"
/*
* @dev check UDTswap type script
* check UDTswap type script code hash
* check all 3 lock script hash
*
* @param index UDTswap cell index
* @param current_script_hash_buf UDTswap lock script hash
*/
int check_udtswap_type(size_t index, uint8_t current_script_hash_buf[]) {
uint8_t script_buf[UDTSWAP_TYPE_SCRIPT_SIZE];
uint8_t *code_hash_buf;
uint64_t len = UDTSWAP_TYPE_SCRIPT_SIZE;
int ret = ckb_load_cell_by_field(script_buf, &len, 0, index, CKB_SOURCE_INPUT, CKB_CELL_FIELD_TYPE);
if (ret != CKB_SUCCESS) {
return UDTSWAP_SYSCALL_ERROR - UDTSWAP_LOCK_ERROR_IDX - ret;
}
if (len != UDTSWAP_TYPE_SCRIPT_SIZE) {
return UDTSWAP_TYPE_SCRIPT_SIZE_NOT_CORRECT_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
code_hash_buf = &script_buf[CODE_HASH_START];
if (memcmp(code_hash_buf, udtswap_type_script_code_hash_buf, CODE_HASH_SIZE) != 0) {
return SCRIPT_NOT_MATCH_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
//udtswap type code hash checked
uint8_t script_buf2[SCRIPT_HASH_SIZE];
size_t i = 0;
while(i<3) {
len = SCRIPT_HASH_SIZE;
ret = ckb_load_cell_by_field(script_buf2, &len, 0, index + i, CKB_SOURCE_INPUT, CKB_CELL_FIELD_LOCK_HASH);
if(ret != CKB_SUCCESS) {
return UDTSWAP_SYSCALL_ERROR - UDTSWAP_LOCK_ERROR_IDX - ret;
}
if(len != SCRIPT_HASH_SIZE) {
return SCRIPT_HASH_SIZE_NOT_CORRECT_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
if(memcmp(current_script_hash_buf, script_buf2, SCRIPT_HASH_SIZE)!=0) {
return SCRIPT_NOT_MATCH_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
i+=1;
}
//lock script hash checked
return CKB_SUCCESS;
}
/*
* @dev check UDTswap lock script
* check group
* check UDTswap type script
*/
int main(int argc, char* argv[]) {
uint64_t len = 0;
uint8_t script_buf[SCRIPT_HASH_SIZE];
size_t group_cnt = 1;
size_t i = 3;
int ret = ckb_load_cell_by_field(NULL, &len, 0, 3, CKB_SOURCE_GROUP_INPUT, CKB_CELL_FIELD_LOCK_HASH);
if (ret != INDEX_OUT_OF_BOUND_ERROR) {
if(ret == CKB_SUCCESS) {
i = 6;
while(1) {
ret = ckb_load_cell_by_field(NULL, &len, 0, i, CKB_SOURCE_GROUP_INPUT, CKB_CELL_FIELD_LOCK_HASH);
if (ret == INDEX_OUT_OF_BOUND_ERROR) {
break;
}
if (ret != CKB_SUCCESS) {
return UDTSWAP_SYSCALL_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
i += 3;
}
group_cnt = i / 3;
} else {
return TOO_MANY_GROUP_CELL_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
}
len = SCRIPT_HASH_SIZE;
ret = ckb_load_cell_by_field(script_buf, &len, 0, i - 1, CKB_SOURCE_GROUP_INPUT, CKB_CELL_FIELD_LOCK_HASH);
if (ret != CKB_SUCCESS) {
return NOT_ENOUGH_GROUP_CELL_ERROR - UDTSWAP_LOCK_ERROR_IDX;
}
//only 3n (same pair, different pools) input with current lock checked
i = 0;
while(1) {
ret = check_udtswap_type(i, script_buf);
if(ret==CKB_SUCCESS) {
group_cnt -= 1;
if(group_cnt == 0) return CKB_SUCCESS;
}
if(ret==INDEX_OUT_OF_BOUND_ERROR) {
break;
}
i+=3;
}
return CANNOT_UNLOCK_ERROR;
} | 29.084112 | 110 | 0.698586 |
063b03b26ed7c51e0b57969befa17d22789c7f20 | 286 | c | C | c/70_climbing_stairs.c | axzxc1236/leetcode | cb257b91267b4cd5445b597a378d83af4ad78370 | [
"MIT"
] | 1 | 2016-09-27T17:57:01.000Z | 2016-09-27T17:57:01.000Z | c/70_climbing_stairs.c | axzxc1236/leetcode | cb257b91267b4cd5445b597a378d83af4ad78370 | [
"MIT"
] | null | null | null | c/70_climbing_stairs.c | axzxc1236/leetcode | cb257b91267b4cd5445b597a378d83af4ad78370 | [
"MIT"
] | null | null | null | //question : https://leetcode.com/problems/climbing-stairs/
//runtime : 0ms
int climbStairs(int n) {
//Yes, it is almost Fibonacci sequence.
int i,num1=0,num2=1,num3;
for (i=0;i<n;i++) {
num3=num1+num2;
num1=num2;
num2=num3;
}
return num3;
} | 23.833333 | 59 | 0.587413 |
063b31980841da5e6c4371aa10f5679ceba8e764 | 2,518 | c | C | bspwc/output.c | colemickens/bspwc | 4e47a7ec720db2dbc667523c3884bd5d487b8f05 | [
"MIT"
] | 1 | 2019-04-14T20:19:10.000Z | 2019-04-14T20:19:10.000Z | bspwc/output.c | colemickens/bspwc | 4e47a7ec720db2dbc667523c3884bd5d487b8f05 | [
"MIT"
] | null | null | null | bspwc/output.c | colemickens/bspwc | 4e47a7ec720db2dbc667523c3884bd5d487b8f05 | [
"MIT"
] | null | null | null | #include "bspwc/output.h"
void output_destroy_notify(struct wl_listener* listener, void* data)
{
struct output* output = wl_container_of(listener, output, destroy);
wlr_output_layout_remove(output->server->output_layout, output->wlr_output);
wl_list_remove(&output->link);
wl_list_remove(&output->destroy.link);
wl_list_remove(&output->frame.link);
free(output);
}
void output_frame_notify(struct wl_listener* listener, void* data)
{
struct output *output = wl_container_of(listener, output, frame);
struct wlr_output *wlr_output = data;
struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend);
// Render loop
wlr_output_make_current(wlr_output, NULL);
wlr_renderer_begin(renderer, wlr_output->width, wlr_output->height);
float color[4] = {0.23f, 0.26f, 0.32f, 1.0f};
wlr_renderer_clear(renderer, color);
render_tree(output->desktop->root);
wlr_output_render_software_cursors(wlr_output, NULL);
wlr_output_swap_buffers(wlr_output, NULL, NULL);
wlr_renderer_end(renderer);
}
void new_output_notify(struct wl_listener* listener, void* data)
{
struct backend* backend = wl_container_of(listener, backend, new_output);
struct wlr_output* wlr_output = data;
if (!wl_list_empty(&wlr_output->modes))
{
struct wlr_output_mode* mode = wl_container_of(wlr_output->modes.prev, mode, link);
wlr_output_set_mode(wlr_output, mode);
}
struct output* output = calloc(1, sizeof(struct output));
if (output == NULL)
{
wlr_log(WLR_ERROR, "Failed to create output %s", wlr_output->name);
}
wlr_log(WLR_DEBUG, "Output '%s' added", wlr_output->name);
wlr_log(WLR_DEBUG, "%s %s", wlr_output->make, wlr_output->model);
wlr_log(WLR_DEBUG, "%s %"PRId32"mm x %"PRId32"mm", wlr_output->serial, wlr_output->phys_width, wlr_output->phys_height);
clock_gettime(CLOCK_MONOTONIC, &output->last_frame);
output->server = backend->server;
output->wlr_output = wlr_output;
wl_list_insert(&backend->outputs, &output->link);
output->destroy.notify = output_destroy_notify;
wl_signal_add(&wlr_output->events.destroy, &output->destroy);
output->frame.notify = output_frame_notify;
wl_signal_add(&wlr_output->events.frame, &output->frame);
// TODO : make output position rearrangeable
wlr_output_layout_add_auto(output->server->output_layout, output->wlr_output);
wlr_output_create_global(wlr_output);
output->desktop = create_desktop(output);
if (output->desktop == NULL)
{
wlr_log(WLR_ERROR, "Failed to create default desktop for %s", wlr_output->name);
}
}
| 31.475 | 121 | 0.758539 |
063d97f02d1434aa3b06e7ca97c9a71542c6c6fc | 123 | h | C | vos/p2/inc/zphist.h | NASA-AMMOS/VICAR | 4504c1f558855d9c6eaef89f4460217aa4909f8e | [
"BSD-3-Clause"
] | 16 | 2020-10-21T05:56:26.000Z | 2022-03-31T10:02:01.000Z | vos/p2/inc/zphist.h | NASA-AMMOS/VICAR | 4504c1f558855d9c6eaef89f4460217aa4909f8e | [
"BSD-3-Clause"
] | null | null | null | vos/p2/inc/zphist.h | NASA-AMMOS/VICAR | 4504c1f558855d9c6eaef89f4460217aa4909f8e | [
"BSD-3-Clause"
] | 2 | 2021-03-09T01:51:08.000Z | 2021-03-23T00:23:24.000Z | #ifndef _ZPHIST_H_
#define _ZPHIST_H_
void zphist(int *freq, int ns, int ilow, int ihigh, int ispike, int imode);
#endif
| 17.571429 | 75 | 0.739837 |
063dc47738c17a4d98a014168ff47f29a21a4d7e | 2,637 | c | C | SourceCode/scripts/4_World/Plugins/PluginBase/PluginDeveloper/DeveloperTeleport.c | DevulTj/DayZOfflineMode | 0ba7e58858c7cd62e6a08f451ba60a3961575353 | [
"MIT"
] | 1 | 2018-12-17T01:52:23.000Z | 2018-12-17T01:52:23.000Z | SourceCode/scripts/4_World/Plugins/PluginBase/PluginDeveloper/DeveloperTeleport.c | DevulTj/DayZOfflineMode | 0ba7e58858c7cd62e6a08f451ba60a3961575353 | [
"MIT"
] | null | null | null | SourceCode/scripts/4_World/Plugins/PluginBase/PluginDeveloper/DeveloperTeleport.c | DevulTj/DayZOfflineMode | 0ba7e58858c7cd62e6a08f451ba60a3961575353 | [
"MIT"
] | null | null | null | class DeveloperTeleport
{
protected static const int TELEPORT_DISTANCE_MAX = 1000;
static void TeleportAtCursor()
{
if ( !DeveloperFreeCamera.IsFreeCameraEnabled() )
{
PlayerBase player = PlayerBase.Cast( GetGame().GetPlayer() );
vector pos_player = player.GetPosition();
vector rayStart = GetGame().GetCurrentCameraPosition();
vector rayEnd = rayStart + GetGame().GetCurrentCameraDirection() * 1000;
vector hitPos;
vector hitNormal;
int hitComponentIndex;
DayZPhysics.RaycastRV(rayStart, rayEnd, hitPos, hitNormal, hitComponentIndex, NULL, NULL, player);
float distance = vector.Distance( pos_player, hitPos );
if ( distance < TELEPORT_DISTANCE_MAX )
{
SetPlayerPosition(PlayerBase.Cast( GetGame().GetPlayer() ), hitPos);
}
else
{
Debug.LogWarning("Distance for teleportation is too far!");
}
}
}
// Set Player Position (MP support)
static void SetPlayerPosition(PlayerBase player, vector position)
{
if ( GetGame().IsServer() )
{
player.SetPosition(position);
}
else
{
ref Param3<float, float, float> params = new Param3<float, float, float>(position[0], position[1], position[2]);
player.RPCSingleParam(ERPCs.DEV_RPC_TELEPORT, params, true);
}
}
// Set Player Direction (MP support)
static void SetPlayerDirection(PlayerBase player, vector direction)
{
if ( GetGame().IsServer() )
{
player.SetDirection(direction);
}
else
{
ref Param3<float, float, float> params = new Param3<float, float, float>(direction[0], direction[1], direction[2]);
player.RPCSingleParam(ERPCs.DEV_RPC_SET_PLAYER_DIRECTION, params, true);
}
}
static void OnRPC(PlayerBase player, int rpc_type, ParamsReadContext ctx)
{
if ( !GetGame().IsDebug() )
{
return;
}
if ( rpc_type == ERPCs.DEV_RPC_TELEPORT )
{
OnRPCSetPlayerPosition(player, ctx);
}
else if ( rpc_type == ERPCs.DEV_RPC_SET_PLAYER_DIRECTION )
{
OnRPCSetPlayerDirection(player, ctx);
}
}
static protected void OnRPCSetPlayerPosition(PlayerBase player, ParamsReadContext ctx)
{
ref Param3<float, float, float> p = new Param3<float, float, float>(0, 0, 0);
if (ctx.Read(p))
{
vector v = "0 0 0";
v[0] = p.param1;
v[1] = p.param2;
v[2] = p.param3;
SetPlayerPosition(player, v);
}
}
static protected void OnRPCSetPlayerDirection(PlayerBase player, ParamsReadContext ctx)
{
ref Param3<float, float, float> p = new Param3<float, float, float>(0, 0, 0);
if (ctx.Read(p))
{
vector v = "0 0 0";
v[0] = p.param1;
v[1] = p.param2;
v[2] = p.param3;
SetPlayerDirection(player, v);
}
}
} | 25.852941 | 118 | 0.678802 |
0640a4e5d0e804744808c6d0062bbb6523f6580e | 3,338 | h | C | StdAfx.h | IvarJonsson/Project-Unknown | 4675b41bbb5e90135c7bf3aded2c2e262b50f351 | [
"BSL-1.0"
] | null | null | null | StdAfx.h | IvarJonsson/Project-Unknown | 4675b41bbb5e90135c7bf3aded2c2e262b50f351 | [
"BSL-1.0"
] | null | null | null | StdAfx.h | IvarJonsson/Project-Unknown | 4675b41bbb5e90135c7bf3aded2c2e262b50f351 | [
"BSL-1.0"
] | null | null | null | // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
/*************************************************************************
-------------------------------------------------------------------------
$Id$
$DateTime$
Description: include file for standard system include files, or project
specific include files that are used frequently, but are
changed infrequently
-------------------------------------------------------------------------
History:
- 20:7:2004 10:51 : Created by Marco Koegler
- 3:8:2004 15:00 : Taken-over by Márcio Martins
*************************************************************************/
#if !defined(AFX_STDAFX_H__B36C365D_F0EA_4545_B3BC_1E0EAB3B5E43__INCLUDED_)
#define AFX_STDAFX_H__B36C365D_F0EA_4545_B3BC_1E0EAB3B5E43__INCLUDED_
//#define _CRTDBG_MAP_ALLOC
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include <CryCore/Project/CryModuleDefs.h>
#define eCryModule eCryM_Game
#define RWI_NAME_TAG "RayWorldIntersection(Game)"
#define PWI_NAME_TAG "PrimitiveWorldIntersection(Game)"
// Insert your headers here
#include <CryCore/Platform/platform.h>
#include <algorithm>
#include <vector>
#include <memory>
#include <list>
#include <map>
#include <functional>
#include <limits>
#include <CryCore/smartptr.h>
#include <CryCore/Containers/VectorSet.h>
#include <CryCore/StlUtils.h>
#include <CryMath/Cry_Math.h>
#include <CryMath/Cry_Camera.h>
#include <CryCore/Containers/CryListenerSet.h>
#include <CrySystem/ISystem.h>
#include <Cry3DEngine/I3DEngine.h>
#include <CryParticleSystem/IParticles.h>
#include <CryInput/IInput.h>
#include <CrySystem/IConsole.h>
#include <CrySystem/ITimer.h>
#include <CrySystem/ILog.h>
#include <IGameplayRecorder.h>
#include <CryNetwork/ISerialize.h>
#include <CryMath/Random.h>
#include "CryMacros.h"
#include <CryGame/GameUtils.h>
#include <CrySystem/Profilers/FrameProfiler/FrameProfiler_JobSystem.h> // to be removed
#ifndef GAMEDLL_EXPORTS
#define GAMEDLL_EXPORTS
#endif
#ifdef GAMEDLL_EXPORTS
#define GAME_API DLL_EXPORT
#else
#define GAME_API
#endif
# ifdef _DEBUG
# ifndef DEBUG
# define DEBUG
# endif
#endif
#define MAX_PLAYER_LIMIT 16
#include "Game.h"
//////////////////////////////////////////////////////////////////////////
//! Reports a Game Warning to validator with WARNING severity.
inline void GameWarning( const char *format,... ) PRINTF_PARAMS(1, 2);
inline void GameWarning( const char *format,... )
{
if (!format)
return;
va_list args;
va_start(args, format);
GetISystem()->WarningV( VALIDATOR_MODULE_GAME,VALIDATOR_WARNING,0,NULL,format,args );
va_end(args);
}
extern struct SCVars *g_pGameCVars;
//---------------------------------------------------------------------
inline float LinePointDistanceSqr(const Line& line, const Vec3& point, float zScale = 1.0f)
{
Vec3 x0=point;
Vec3 x1=line.pointonline;
Vec3 x2=line.pointonline+line.direction;
x0.z*=zScale;
x1.z*=zScale;
x2.z*=zScale;
return ((x2-x1).Cross(x1-x0)).GetLengthSquared()/(x2-x1).GetLengthSquared();
}
#if !defined(_RELEASE)
# define ENABLE_DEBUG_FLASH_PLAYBACK
#endif
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__B36C365D_F0EA_4545_B3BC_1E0EAB3B5E43__INCLUDED_)
| 26.283465 | 97 | 0.666267 |
064494d89a3c9d209ed0238f3cbba969254c391d | 442 | h | C | mille-feuille_ATMEGASample/mille-feuile_IRsend/IRSEND.h | yoshinarikou/MilleFeuilleATMEGA328P | 53f1ed302e564a5dab8bcf82736b8862c1005c0a | [
"MIT"
] | null | null | null | mille-feuille_ATMEGASample/mille-feuile_IRsend/IRSEND.h | yoshinarikou/MilleFeuilleATMEGA328P | 53f1ed302e564a5dab8bcf82736b8862c1005c0a | [
"MIT"
] | null | null | null | mille-feuille_ATMEGASample/mille-feuile_IRsend/IRSEND.h | yoshinarikou/MilleFeuilleATMEGA328P | 53f1ed302e564a5dab8bcf82736b8862c1005c0a | [
"MIT"
] | null | null | null | #ifndef IRSEND_H
#define IRSEND_H
#include <inttypes.h>
class IRSEND {
public:
// constructor
IRSEND(uint8_t ledPin);
void sendNECCommand(uint8_t data, uint8_t custom0, uint8_t custom1);
void sendData(uint8_t date);
private:
uint8_t _ledPin; // the pin number which the LED is connected
uint8_t _custom0; // custom code
uint8_t _custom1; // custom code
void on(int num);
};
#endif
| 23.263158 | 73 | 0.662896 |
0644992d34b5d51f956a0f719136490767dfbb19 | 2,720 | c | C | main.c | Napster653/uc3m-dso-p1 | 4a071b88a65694800961fcc5d932c4de91f23989 | [
"MIT"
] | 1 | 2019-04-23T07:30:14.000Z | 2019-04-23T07:30:14.000Z | main.c | Napster653/uc3m-dso-p1 | 4a071b88a65694800961fcc5d932c4de91f23989 | [
"MIT"
] | null | null | null | main.c | Napster653/uc3m-dso-p1 | 4a071b88a65694800961fcc5d932c4de91f23989 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <sys/time.h>
#include <signal.h>
#include <stdlib.h>
#include <ucontext.h>
#include <unistd.h>
#include "mythread.h"
void fun1 (int global_index)
{
int a=0, b=0;
read_network ();
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<25000000; ++b);
}
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<25000000; ++b);
}
mythread_exit ();
return;
}
void fun2 (int global_index)
{
int a=0, b=0;
read_network ();
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<18000000; ++b);
}
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<18000000; ++b);
}
mythread_exit ();
return;
}
void fun3 (int global_index)
{
int a=0, b=0;
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<40000000; ++b);
}
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<40000000; ++b);
}
mythread_exit ();
return;
}
int main (int argc, char *argv[])
{
int i,j,k,l,m,a,b=0;
mythread_setpriority (HIGH_PRIORITY);
read_network ();
if ((i = mythread_create (fun1,LOW_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
read_network();
if ((j = mythread_create (fun2,LOW_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
if ((k = mythread_create (fun3,LOW_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
if ((l = mythread_create (fun1,HIGH_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
if ((m = mythread_create (fun2,HIGH_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
for (a=0; a<10; ++a)
{
// printf ("Thread %d with priority %d\t from fun2 a = %d\tb = %d\n", mythread_gettid(), mythread_getpriority(), a, b);
for (b=0; b<30000000; ++b);
}
if ((a = mythread_create (fun1,HIGH_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
if ((b = mythread_create (fun1,HIGH_PRIORITY)) == -1)
{
printf ("thread failed to initialize\n");
exit (-1);
}
mythread_exit ();
printf ("This program should never come here\n");
return 0;
} | 22.857143 | 121 | 0.601103 |
06449ab6d5103bf079d9c1e858b5c75dee868b86 | 4,556 | h | C | deps/CustomOps/RollingFunctions/RollingFunctions.h | ziyiyin97/ADCME.jl | 1c9b2c1ae63059d79a5a6a7b86eee64796868755 | [
"MIT"
] | 202 | 2019-06-12T18:42:20.000Z | 2022-03-24T16:56:46.000Z | deps/CustomOps/RollingFunctions/RollingFunctions.h | ziyiyin97/ADCME.jl | 1c9b2c1ae63059d79a5a6a7b86eee64796868755 | [
"MIT"
] | 46 | 2019-08-19T19:37:52.000Z | 2022-03-27T11:17:50.000Z | deps/CustomOps/RollingFunctions/RollingFunctions.h | jiaqiwang969/ADCME.jl | 33e8d39ab18274c98e11330d5d3e65f7a9ed8e99 | [
"MIT"
] | 56 | 2019-07-30T05:50:55.000Z | 2022-03-28T02:41:07.000Z |
void RollingSumFunctionForward(
double *out, const double *u, int window, int n){
for(int i = 0; i < window; i++)
out[0] += u[i];
for (int i = window; i < n; i++){
out[i - (window-1)] = out[i-window] + u[i] - u[i-window];
}
}
void RollingSumFunctionBackward(
double *grad_u,
const double *grad_out,
const double *out, const double *u, int window, int n){
int N = n - window + 1;
grad_u[0] = grad_out[0];
for (int i = 1; i < n; i++){
if (i < window){
if (i < N)
grad_u[i] = grad_u[i-1] + grad_out[i];
else
grad_u[i] = grad_u[i-1];
}else{
if (i < N)
grad_u[i] = grad_u[i-1] - grad_out[i-window] + grad_out[i];
else {
grad_u[i] = grad_u[i-1] - grad_out[i-window];
}
}
}
}
void RollingMeanFunctionForward(
double *out, const double *u, int window, int n
){
for(int i = 0; i < window; i++)
out[0] += u[i];
out[0] /= window;
for (int i = window; i < n; i++){
out[i - (window-1)] = (out[i-window] * window + u[i] - u[i-window])/window;
}
}
void RollingMeanFunctionBackward(
double *grad_u,
const double *grad_out,
const double *out, const double *u, int window, int n){
RollingSumFunctionBackward(grad_u, grad_out, out, u, window, n);
for(int i = 0; i < n; i++){
grad_u[i] = grad_u[i] / window;
}
}
double __var_window(const double *u, const double mean, int window){
double out = 0.0;
for(int i = 0; i < window; i++){
out += (u[i] - mean)*(u[i]-mean);
}
return out / (window - 1);
}
void __var_window_backward(double * grad_u, double grad_out, const double *u, const double mean, int window){
for(int i = 0; i < window; i++){
for (int j = 0; j < window; j++){
grad_u[j] += 2 * (mean-u[i]) * 1.0 / window * grad_out / (window-1);
}
grad_u[i] += 2 * (u[i] - mean) * grad_out / (window-1);
}
}
void RollingVarFunctionBackward(
double *grad_u,
const double *grad_out,
const double *out, const double *u, int window, int n
){
auto mean = new double[n-window+1];
RollingMeanFunctionForward(mean, u, window, n);
for (int i = window-1; i < n; i++){
__var_window_backward(grad_u+i-window+1, grad_out[i-window+1], u+i-window+1, mean[i-window+1], window);
}
delete [] mean;
}
void RollingVarFunctionForward(
double *out, const double *u, int window, int n
){
RollingMeanFunctionForward(out, u, window, n);
for (int i = window-1; i < n; i++){
out[i-window+1] = __var_window(u+i-window+1, out[i-window+1], window);
}
}
void RollingStdFunctionForward(
double *out, const double *u, int window, int n
){
RollingVarFunctionForward(out, u, window, n);
for(int i = 0; i < n - window+1; i++)
out[i] = sqrt(out[i]);
}
void RollingStdFunctionBackward(
double *grad_u,
const double *grad_out,
const double *out, const double *u, int window, int n
){
auto mean = new double[n-window+1];
RollingMeanFunctionForward(mean, u, window, n);
for (int i = window-1; i < n; i++){
__var_window_backward(grad_u+i-window+1, grad_out[i-window+1] * 1.0/2.0/out[i-window+1], u+i-window+1, mean[i-window+1], window);
}
delete [] mean;
}
void RollingFunctionForward(
double *out, const double *u, int window, int n, string op
){
if(op.compare("sum")==0){
RollingSumFunctionForward(out, u, window, n);
}else if(op.compare("mean")==0){
RollingMeanFunctionForward(out, u, window, n);
}else if(op.compare("var")==0){
RollingVarFunctionForward(out, u, window, n);
}else if(op.compare("std")==0){
RollingStdFunctionForward(out, u, window, n);
}else{
throw "invalid op in rolling function";
}
}
void RollingFunctionBackward(
double *grad_u,
const double *grad_out,
const double *out, const double *u, int window, int n, string op
){
if(op.compare("sum")==0){
RollingSumFunctionBackward(grad_u, grad_out, out, u, window, n);
}else if(op.compare("mean")==0){
RollingMeanFunctionBackward(grad_u, grad_out, out, u, window, n);
}else if(op.compare("var")==0){
RollingVarFunctionBackward(grad_u, grad_out, out, u, window, n);
}else if(op.compare("std")==0){
RollingStdFunctionBackward(grad_u, grad_out, out, u, window, n);
}else{
throw "invalid op in rolling function";
}
} | 30.783784 | 137 | 0.576822 |
0646d603e66f0cd19f23bcaa7eac8750076435ad | 491 | h | C | src/scomponents/io/brush.h | guillaume-haerinck/voxel-editor | 78c2db3e7f33a1944ef6202c8ae33f4008695153 | [
"MIT"
] | 7 | 2019-12-30T21:01:06.000Z | 2022-02-24T07:41:52.000Z | src/scomponents/io/brush.h | guillaume-haerinck/voxel-editor | 78c2db3e7f33a1944ef6202c8ae33f4008695153 | [
"MIT"
] | null | null | null | src/scomponents/io/brush.h | guillaume-haerinck/voxel-editor | 78c2db3e7f33a1944ef6202c8ae33f4008695153 | [
"MIT"
] | 1 | 2020-04-26T22:02:29.000Z | 2020-04-26T22:02:29.000Z | #pragma once
enum class BrushType {
VOXEL = 0,
FACE,
BOX,
LINE,
CIRCLE
};
enum class BrushUse {
ADD = 0,
REMOVE,
PAINT,
SELECT
};
class Brush {
public:
Brush() {};
BrushType type() const { return m_type; }
BrushUse usage() const { return m_usage; }
bool started() const { return m_started; }
private:
BrushType m_type = BrushType::VOXEL;
BrushUse m_usage = BrushUse::ADD;
bool m_started = false;
private:
friend class BrushGui;
friend class App;
};
| 14.028571 | 46 | 0.655804 |
064794c1482c6f0827b61240463edb3d37a7f6ef | 1,881 | h | C | include/org/w3c/dom/ls/LSParser.h | iFindTA/PBJ2Objc | 014bd0f99b129cb094ee35e472802fd38c5c0f87 | [
"MIT"
] | null | null | null | include/org/w3c/dom/ls/LSParser.h | iFindTA/PBJ2Objc | 014bd0f99b129cb094ee35e472802fd38c5c0f87 | [
"MIT"
] | null | null | null | include/org/w3c/dom/ls/LSParser.h | iFindTA/PBJ2Objc | 014bd0f99b129cb094ee35e472802fd38c5c0f87 | [
"MIT"
] | null | null | null | //
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: android/libcore/luni/src/main/java/org/w3c/dom/ls/LSParser.java
//
#ifndef _OrgW3cDomLsLSParser_H_
#define _OrgW3cDomLsLSParser_H_
#include "J2ObjC_header.h"
@protocol OrgW3cDomDOMConfiguration;
@protocol OrgW3cDomDocument;
@protocol OrgW3cDomLsLSInput;
@protocol OrgW3cDomLsLSParserFilter;
@protocol OrgW3cDomNode;
#define OrgW3cDomLsLSParser_ACTION_APPEND_AS_CHILDREN 1
#define OrgW3cDomLsLSParser_ACTION_REPLACE_CHILDREN 2
#define OrgW3cDomLsLSParser_ACTION_INSERT_BEFORE 3
#define OrgW3cDomLsLSParser_ACTION_INSERT_AFTER 4
#define OrgW3cDomLsLSParser_ACTION_REPLACE 5
@protocol OrgW3cDomLsLSParser < NSObject, JavaObject >
- (id<OrgW3cDomDOMConfiguration>)getDomConfig;
- (id<OrgW3cDomLsLSParserFilter>)getFilter;
- (void)setFilterWithOrgW3cDomLsLSParserFilter:(id<OrgW3cDomLsLSParserFilter>)filter;
- (jboolean)getAsync;
- (jboolean)getBusy;
- (id<OrgW3cDomDocument>)parseWithOrgW3cDomLsLSInput:(id<OrgW3cDomLsLSInput>)input;
- (id<OrgW3cDomDocument>)parseURIWithNSString:(NSString *)uri;
- (id<OrgW3cDomNode>)parseWithContextWithOrgW3cDomLsLSInput:(id<OrgW3cDomLsLSInput>)input
withOrgW3cDomNode:(id<OrgW3cDomNode>)contextArg
withShort:(jshort)action;
- (void)abort;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgW3cDomLsLSParser)
J2OBJC_STATIC_FIELD_GETTER(OrgW3cDomLsLSParser, ACTION_APPEND_AS_CHILDREN, jshort)
J2OBJC_STATIC_FIELD_GETTER(OrgW3cDomLsLSParser, ACTION_REPLACE_CHILDREN, jshort)
J2OBJC_STATIC_FIELD_GETTER(OrgW3cDomLsLSParser, ACTION_INSERT_BEFORE, jshort)
J2OBJC_STATIC_FIELD_GETTER(OrgW3cDomLsLSParser, ACTION_INSERT_AFTER, jshort)
J2OBJC_STATIC_FIELD_GETTER(OrgW3cDomLsLSParser, ACTION_REPLACE, jshort)
J2OBJC_TYPE_LITERAL_HEADER(OrgW3cDomLsLSParser)
#endif // _OrgW3cDomLsLSParser_H_
| 30.33871 | 89 | 0.809144 |
06479a3fba691179673b3b867b97ac167e1b04ad | 3,145 | h | C | libintrinsic3d/include/nv/mesh/marching_cubes.h | dazinovic/intrinsic3d | 4e5ea3b3d81b4174f33765e1d3dd0b24c2716c06 | [
"BSD-3-Clause"
] | 370 | 2019-01-03T23:22:40.000Z | 2022-03-09T12:40:03.000Z | libintrinsic3d/include/nv/mesh/marching_cubes.h | jtpils/intrinsic3d | 3f94bc59dba6d77981aad1c8f38531706e51078f | [
"BSD-3-Clause"
] | 16 | 2019-02-13T10:15:19.000Z | 2021-11-10T10:22:47.000Z | libintrinsic3d/include/nv/mesh/marching_cubes.h | jtpils/intrinsic3d | 3f94bc59dba6d77981aad1c8f38531706e51078f | [
"BSD-3-Clause"
] | 66 | 2019-02-28T06:19:55.000Z | 2022-03-10T10:06:35.000Z | /**
* This file is part of Intrinsic3D.
*
* Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2019, Technical University of Munich. 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 NVIDIA CORPORATION 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 "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.
*/
#pragma once
#include <nv/mat.h>
#include <nv/mesh.h>
#include <nv/sparse_voxel_grid.h>
#include "omp.h"
namespace nv
{
/**
* @brief Implementation of the Marching Cubes algorithm for
* extracting the Iso-Surface from a Sparse Voxel Grid
* @author Robert Maier <robert.maier@tum.de>
* @author Matthias Niessner <niessner@tum.de>
*/
template <class T>
class MarchingCubes
{
public:
static Mesh* extractSurface(const SparseVoxelGrid<T>& grid);
private:
MarchingCubes();
MarchingCubes(const MarchingCubes&);
MarchingCubes& operator=(const MarchingCubes&);
~MarchingCubes();
struct Vertex
{
Vec3f p;
Vec3f c;
};
struct Triangle
{
Vertex v0;
Vertex v1;
Vertex v2;
};
Mesh* extractMesh(const SparseVoxelGrid<T>& grid);
Mesh* merge(const std::vector< std::vector<Triangle> > &results) const;
void extractSurfaceAt(const Vec3i& voxel, const SparseVoxelGrid<T>& grid, std::vector<Triangle>& result);
int computeLutIndex(const SparseVoxelGrid<T>& grid, int i, int j, int k, float iso_value);
Vec3f interpolate(float tsdf0, float tsdf1, const Vec3f &val0, const Vec3f &val1, float iso_value);
typename MarchingCubes::Vertex getVertex(const SparseVoxelGrid<T>& grid, int i1, int j1, int k1, int i2, int j2, int k2, float iso_value);
const static int edge_table_[256];
const static int triangle_table_[256][16];
};
} // namespace nv
| 35.738636 | 146 | 0.725278 |
064be4a8b15bee8a39629aa2ea7b92d054ad57ff | 980 | c | C | ft_printf/ft_strclr.c | NowakAydm/anowak | 9ffcf8d6ec7a72fcacbed0cc6f766041914f3b27 | [
"CC0-1.0"
] | null | null | null | ft_printf/ft_strclr.c | NowakAydm/anowak | 9ffcf8d6ec7a72fcacbed0cc6f766041914f3b27 | [
"CC0-1.0"
] | null | null | null | ft_printf/ft_strclr.c | NowakAydm/anowak | 9ffcf8d6ec7a72fcacbed0cc6f766041914f3b27 | [
"CC0-1.0"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_strclr.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: anowak <anowak@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/11/12 16:11:30 by anowak #+# #+# */
/* Updated: 2015/01/21 05:13:45 by anowak ### ########.fr */
/* */
/* ************************************************************************** */
#include "libftprintf.h"
void ft_strclr(char *s)
{
if (s)
while (*s)
*s++ = 0;
}
| 46.666667 | 80 | 0.145918 |
064fdc0a045860c597e070190560aee059ff5098 | 298 | h | C | Pods/EasyLibs/Framework/EServiceSDK.framework/Headers/UIImage+ScanExtend.h | EasySnail/TokenKit | c94f77aa1712c978bb660105a0f3f2b419601693 | [
"MIT"
] | null | null | null | Pods/EasyLibs/Framework/EServiceSDK.framework/Headers/UIImage+ScanExtend.h | EasySnail/TokenKit | c94f77aa1712c978bb660105a0f3f2b419601693 | [
"MIT"
] | null | null | null | Pods/EasyLibs/Framework/EServiceSDK.framework/Headers/UIImage+ScanExtend.h | EasySnail/TokenKit | c94f77aa1712c978bb660105a0f3f2b419601693 | [
"MIT"
] | null | null | null | //
// UIImage+ScanExtend.h
// ScanManager
//
// Created by Easy on 2017/12/28.
// Copyright © 2017年 Easy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (ScanExtend)
+ (UIImage *)imageWithCIImage:(CIImage *)ciimage fromOrect:(CGRect)orect contentRect:(CGRect)crect;
@end
| 19.866667 | 99 | 0.711409 |
06506eca0401f299c3951228e3b42c7c79514232 | 2,501 | h | C | dev/Code/Sandbox/Plugins/DeploymentTool/DeployWorker_devicefarm.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 1,738 | 2017-09-21T10:59:12.000Z | 2022-03-31T21:05:46.000Z | dev/Code/Sandbox/Plugins/DeploymentTool/DeployWorker_devicefarm.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 427 | 2017-09-29T22:54:36.000Z | 2022-02-15T19:26:50.000Z | dev/Code/Sandbox/Plugins/DeploymentTool/DeployWorker_devicefarm.h | jeikabu/lumberyard | 07228c605ce16cbf5aaa209a94a3cb9d6c1a4115 | [
"AML"
] | 671 | 2017-09-21T08:04:01.000Z | 2022-03-29T14:30:07.000Z | /*
* 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.
*
*/
#pragma once
#include "DeployWorkerBase.h"
#include "DeviceFarmDriver.h"
namespace DeployTool
{
//
//! Deploy worker for Device Farm
/*!
* Utility to build/deploy projects to the Aws Device Farm
*/
class DeployWorkerDeviceFarm : public DeployWorkerBase
{
// States for "Deploying" an app to the Aws Device Farm
enum class DeviceFarmDeployState
{
Idle,
UploadCreate,
UploadCreating,
UploadCreated,
UploadSending,
UploadCheckingStatus,
UploadCheckedStatus,
SchedulingRun
};
public:
DeployWorkerDeviceFarm(
std::shared_ptr<DeployTool::DeviceFarmDriver> deviceFarmDriver,
int timeoutInMinutes,
const AZStd::string& projectArn,
const AZStd::string& devicePoolArn);
~DeployWorkerDeviceFarm();
const char* GetSystemConfigFileName() const override;
bool GetConnectedDevices(DeviceMap& connectedDevices) const override;
protected:
AZStd::string GetWafBuildArgs() const override;
AZStd::string GetWafDeployArgs() const override;
StringOutcome Prepare() override;
void StartDeploy() override;
StringOutcome Launch() override;
// Deploy state update functions
void DeployStateUpdateUploadCreate();
void DeployStateUpdateUploadCreated();
void DeployStateUpdateUploadCheckedStatus();
private:
AZ_DISABLE_COPY_MOVE(DeployWorkerDeviceFarm);
// Main update loop while Launching (deploying to device farm).
void Update();
AZStd::string m_appPath;
DeviceFarmDeployState m_deviceFarmDeployState = DeviceFarmDeployState::Idle;
std::shared_ptr<DeployTool::DeviceFarmDriver> m_deviceFarmDriver;
DeployTool::DeviceFarmDriver::Upload m_deviceFarmUpload;
int m_timeoutInMinutes;
AZStd::string m_projectArn;
AZStd::string m_devicePoolArn;
// Run the deploy worker in a thread so it doesn't freeze up the UI
AZStd::thread m_deployWorkerThread;
};
} // namespace DeployTool | 29.77381 | 85 | 0.732507 |
065195cbf04f60252bbe8ce707cffe2c2d4460e1 | 492 | h | C | src/entities/Bullet.h | haviital/GalaxyFighter_Pokitto | bbb8d6519585928f7e26399efa87566589bf2209 | [
"BSD-3-Clause"
] | 3 | 2020-01-10T18:06:25.000Z | 2020-11-10T01:17:54.000Z | src/entities/Bullet.h | haviital/GalaxyFighter_Pokitto | bbb8d6519585928f7e26399efa87566589bf2209 | [
"BSD-3-Clause"
] | null | null | null | src/entities/Bullet.h | haviital/GalaxyFighter_Pokitto | bbb8d6519585928f7e26399efa87566589bf2209 | [
"BSD-3-Clause"
] | 2 | 2020-01-14T12:27:52.000Z | 2022-02-18T14:32:08.000Z | #pragma once
#include "Pokitto.h"
#include "../utils/Constants.h"
#include "../utils/Enums.h"
#include "../utils/Structs.h"
class Bullet {
public:
Bullet();
// Properties ..
uint8_t getX();
uint8_t getY();
bool isEnabled();
void setX(uint8_t x);
void setY(uint8_t y);
void setEnabled(bool enabled);
private:
uint8_t x = 0;
uint8_t y= 0;
bool enabled = false;
}; | 15.870968 | 38 | 0.510163 |
0654630e978ee041dce043a65cef04087fba2e5d | 3,549 | c | C | kapps/artii.c | Unluckiestnoob/AhnTri | 2e7842300adde22590bcfb124445da4b5f11c2c6 | [
"Apache-2.0"
] | 1 | 2021-07-11T11:21:03.000Z | 2021-07-11T11:21:03.000Z | kapps/artii.c | Unluckiestnoob/AhnTri | 2e7842300adde22590bcfb124445da4b5f11c2c6 | [
"Apache-2.0"
] | null | null | null | kapps/artii.c | Unluckiestnoob/AhnTri | 2e7842300adde22590bcfb124445da4b5f11c2c6 | [
"Apache-2.0"
] | null | null | null | #include "../kernel.h"
#include "../libc/atclib.h"
void plant() {
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("dddddddmmmdddmmmmmNNN", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("hsyyh", RED, BLACK);
suspend(1);
os_print_color("ddmNNNNNNNmNNmNNNNNNNNNN\n", GREEN, BLACK);
suspend(1);
os_print_color("ddddddmmmmmdddmmNNNNNd", GREEN, BLACK);
suspend(1);
os_print_color("ossyh", RED, BLACK);
suspend(1);
os_print_color("mNNNNNNNNmmmmmNNNmNNNNN\n", GREEN, BLACK);
suspend(1);
}
| 31.40708 | 60 | 0.744999 |
06548f9c816f00e275a669126ff5dce213846985 | 862 | h | C | KD_Tree/kd_tree.h | changzeng/BasicML | 0124be866b241af039773b9f71c06c3eba4339b4 | [
"MIT"
] | null | null | null | KD_Tree/kd_tree.h | changzeng/BasicML | 0124be866b241af039773b9f71c06c3eba4339b4 | [
"MIT"
] | null | null | null | KD_Tree/kd_tree.h | changzeng/BasicML | 0124be866b241af039773b9f71c06c3eba4339b4 | [
"MIT"
] | null | null | null | //
// Created by pc-20171125 on 2019/1/21.
//
#ifndef KD_TREE_KD_TREE_H
#define KD_TREE_KD_TREE_H
#include <memory>
#include <vector>
#include <random>
using namespace std;
class Point{
private:
int dim;
vector<double> values;
default_random_engine randint;
public:
explicit Point(int dim);
double get(int i);
};
class Node{
public:
shared_ptr<Node> left, right;
vector<shared_ptr<Point>> point_list;
int split_index, point_num;
double split_value;
Node(vector<shared_ptr<Point>> &dataset);
int get_point_num(){return this->point_list.size();}
};
class KDTree{
private:
int dim;
shared_ptr<Node> root;
public:
KDTree(int dim);
void split(shared_ptr<Node> & node);
void fit(vector<shared_ptr<Point>> &dataset, int point_num);
void knn(Point & point, int k);
};
#endif //KD_TREE_KD_TREE_H
| 18.73913 | 64 | 0.690255 |
065566342929f45b314d6605da0f80a09dff4da4 | 1,452 | c | C | Lab3/main4.c | rhazra-003/OSLab | 1c9c6dea71d67c60fd6062f78ef472f2e1e3fa9f | [
"MIT"
] | 1 | 2022-01-31T15:03:46.000Z | 2022-01-31T15:03:46.000Z | Lab3/main4.c | rhazra-003/OSLab | 1c9c6dea71d67c60fd6062f78ef472f2e1e3fa9f | [
"MIT"
] | null | null | null | Lab3/main4.c | rhazra-003/OSLab | 1c9c6dea71d67c60fd6062f78ef472f2e1e3fa9f | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#define __USE_GNU 1
#include <pthread.h>
#include <errno.h>
#include <string.h>
static int x = 0;
void *func(void *arg)
{
char *ret;
ret = (char *)malloc(20);
if ((int *)arg)
printf("Created Detached Thread\n");
else
printf("Created Joinable Thread\n");
sprintf(ret, "Thread#%d", x);
x++;
pthread_exit(ret);
}
int main()
{
pthread_attr_t attr;
int status, n, i;
printf("Enter number of Threads: ");
scanf("%d", &n);
pthread_t *tid = (pthread_t *)malloc(sizeof(pthread_t) * n);
status = pthread_attr_init(&attr);
if (status != 0)
{
printf("Error initalizing attributes");
exit(0);
}
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
for (i = 0; i < n; i++)
{
if (i % 2 == 1)
status = pthread_create(&tid[i], &attr, &func, (void *)1);
else
status = pthread_create(&tid[i], NULL, &func, (void *)0);
if (status != 0)
printf("Error creating thread");
void *retval = NULL;
status = pthread_join(tid[i], &retval);
if (status == EINVAL)
printf("Detached Thread#%d === Return Value: %s --- Status: %d\n", i, (char *)retval, status);
else if (status == 0)
printf("Joinable Thread#%d === Return Value: %s --- Status: %d\n", i, (char *)retval, status);
}
return (0);
}
| 22.6875 | 106 | 0.544766 |
06556dfbf3ee598f25a3bdcc848b201454fc1026 | 435 | h | C | qemu/target/m68k/cpu-param.h | hyunjoy/scripts | 01114d3627730d695b5ebe61093c719744432ffa | [
"Apache-2.0"
] | 44 | 2022-03-16T08:32:31.000Z | 2022-03-31T16:02:35.000Z | qemu/target/m68k/cpu-param.h | hyunjoy/scripts | 01114d3627730d695b5ebe61093c719744432ffa | [
"Apache-2.0"
] | 1 | 2022-03-29T02:30:28.000Z | 2022-03-30T03:40:46.000Z | qemu/target/m68k/cpu-param.h | hyunjoy/scripts | 01114d3627730d695b5ebe61093c719744432ffa | [
"Apache-2.0"
] | 18 | 2022-03-19T04:41:04.000Z | 2022-03-31T03:32:12.000Z | /*
* m68k cpu parameters for qemu.
*
* Copyright (c) 2005-2007 CodeSourcery
* SPDX-License-Identifier: LGPL-2.0+
*/
#ifndef M68K_CPU_PARAM_H
#define M68K_CPU_PARAM_H 1
#define TARGET_LONG_BITS 32
/*
* Coldfire Linux uses 8k pages
* and m68k linux uses 4k pages
* use the smallest one
*/
#define TARGET_PAGE_BITS 12
#define TARGET_PHYS_ADDR_SPACE_BITS 32
#define TARGET_VIRT_ADDR_SPACE_BITS 32
#define NB_MMU_MODES 2
#endif
| 18.913043 | 39 | 0.763218 |
0659618b34c371a1518330519f97e1ff45e48a17 | 468 | h | C | Sources/DNWebSocket.h | dvt282/DNWebSocket | bcd1394bf79b2cee7abb20f7b4901df71df67aff | [
"MIT"
] | 35 | 2018-02-11T16:51:07.000Z | 2022-01-29T17:51:43.000Z | Sources/DNWebSocket.h | dvt282/DNWebSocket | bcd1394bf79b2cee7abb20f7b4901df71df67aff | [
"MIT"
] | null | null | null | Sources/DNWebSocket.h | dvt282/DNWebSocket | bcd1394bf79b2cee7abb20f7b4901df71df67aff | [
"MIT"
] | 5 | 2018-08-27T07:07:57.000Z | 2022-01-29T17:51:48.000Z | //
// DNWebSocket.h
// DNWebSocket
//
// Created by Gleb Radchenko on 2/2/18.
//
#import <Foundation/Foundation.h>
//! Project version number for DNWebSocket.
FOUNDATION_EXPORT double DNWebSocket_VersionNumber;
//! Project version string for DNWebSocket.
FOUNDATION_EXPORT const unsigned char DNWebSocket_VersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <DNWebSocket/PublicHeader.h>
| 24.631579 | 136 | 0.775641 |
065c8800384c5eb7e64e8a1e53d5db3a3c2a1e3d | 626 | h | C | Util/Tools/JKMarketManager/JKMarketManager.h | baodieppro/101 | 2aadda95a766aa8bbf96e8fe7e55ef260df6987f | [
"Apache-2.0"
] | 1 | 2021-06-24T06:14:34.000Z | 2021-06-24T06:14:34.000Z | Util/Tools/JKMarketManager/JKMarketManager.h | Gongshaopeng/MyBrowser | 8f816491b26bc96d22443bcdf34189320b414193 | [
"Apache-2.0"
] | null | null | null | Util/Tools/JKMarketManager/JKMarketManager.h | Gongshaopeng/MyBrowser | 8f816491b26bc96d22443bcdf34189320b414193 | [
"Apache-2.0"
] | null | null | null | //
// MarketManager.h
// MT
//
// Created by jianjie on 16/6/24.
// Copyright © 2016年 jianjie. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "JKMarketDefine.h"
typedef enum : NSUInteger {
JKMarketSizeTypeFour,
JKMarketSizeTypeSix,
JKMarketSizeTypePlus,
JKMarketSizeTypeXR,
JKMarketSizeTypeXMS,
JKMarketSizeTypeX
} JKMarketSizeType;
@interface JKMarketManager : NSObject
+ (instancetype)showJKMarketManager;
- (CGFloat)translationSize:(CGFloat)pxSize;
- (CGFloat)translationSize:(CGFloat)pxSize marketSizeType:(JKMarketSizeType)marketSizeType;
@end
| 20.866667 | 91 | 0.753994 |
065cbabf9a7b094c9f5e3a5e458681b99eb9a95c | 4,093 | h | C | fastinterp/wasm_common_ops_helper.h | ngaut/WasmNow | 28bdf8e33b56d6c6e5d0fec58264fda0f58b5d59 | [
"MIT"
] | 3 | 2021-09-16T14:39:15.000Z | 2021-10-03T07:41:03.000Z | fastinterp/wasm_common_ops_helper.h | ngaut/WasmNow | 28bdf8e33b56d6c6e5d0fec58264fda0f58b5d59 | [
"MIT"
] | null | null | null | fastinterp/wasm_common_ops_helper.h | ngaut/WasmNow | 28bdf8e33b56d6c6e5d0fec58264fda0f58b5d59 | [
"MIT"
] | 1 | 2021-10-02T15:16:03.000Z | 2021-10-02T15:16:03.000Z | #pragma once
#include "fastinterp_tpl_common.hpp"
// All common wasm opcodes share the same placeholder configuration
// DATA_0: int stack top
// DATA_1: float stack top
// DATA_2: constant
// DATA_8: a fake operand which always equals DATA_0 + 8
// DATA_9: a fake operand which always equals DATA_0 - 8
// DATA_10: a fake operand which always equals DATA_0 - 16
// DATA_11: a fake operand which always equals DATA_1 + 8
// DATA_12: a fake operand which always equals DATA_1 - 8
//
namespace PochiVM
{
#define INT_TOP 0
#define INT_PUSH 8
#define INT_2ND_TOP 9
#define INT_3RD_TOP 10
#define FLOAT_TOP 1
#define FLOAT_PUSH 11
#define FLOAT_2ND_TOP 12
#define DEF_DATA(x) INTERNAL_DEFINE_INDEX_CONSTANT_PLACEHOLDER(x)
#define GET_DATA(x) TOKEN_PASTE(CONSTANT_PLACEHOLDER_, x)
namespace internal
{
template<typename T>
T* ALWAYS_INLINE WARN_UNUSED GetStackTop(uintptr_t stackframe)
{
if constexpr(!std::is_floating_point<T>::value)
{
DEF_DATA(INT_TOP);
return GetLocalVarAddress<T>(stackframe, GET_DATA(INT_TOP));
}
else
{
DEF_DATA(FLOAT_TOP);
return GetLocalVarAddress<T>(stackframe, GET_DATA(FLOAT_TOP));
}
}
template<typename T>
T* ALWAYS_INLINE WARN_UNUSED GetStack2ndTop(uintptr_t stackframe)
{
if constexpr(!std::is_floating_point<T>::value)
{
DEF_DATA(INT_2ND_TOP);
return GetLocalVarAddress<T>(stackframe, GET_DATA(INT_2ND_TOP));
}
else
{
DEF_DATA(FLOAT_2ND_TOP);
return GetLocalVarAddress<T>(stackframe, GET_DATA(FLOAT_2ND_TOP));
}
}
template<typename T>
T* ALWAYS_INLINE WARN_UNUSED GetStack3rdTop(uintptr_t stackframe)
{
static_assert(!std::is_floating_point<T>::value);
DEF_DATA(INT_3RD_TOP);
return GetLocalVarAddress<T>(stackframe, GET_DATA(INT_3RD_TOP));
}
template<typename T>
T* ALWAYS_INLINE WARN_UNUSED GetStackPush(uintptr_t stackframe)
{
if constexpr(!std::is_floating_point<T>::value)
{
DEF_DATA(INT_PUSH);
return GetLocalVarAddress<T>(stackframe, GET_DATA(INT_PUSH));
}
else
{
DEF_DATA(FLOAT_PUSH);
return GetLocalVarAddress<T>(stackframe, GET_DATA(FLOAT_PUSH));
}
}
} // namespace internal
// A class handling the most common kind of opcodes: it takes several inputs
// of same type, and produce zero or one output
//
template<typename InputType, int numInputOnStack, typename OutputType>
struct StackMachineAccessor
{
static_assert(numInputOnStack >= 0);
static_assert(numInputOnStack <= 2); // support later if we need more
// 0 is stack top, 1 is next top, etc
//
template<int inputOrd>
static InputType ALWAYS_INLINE WARN_UNUSED GetInput(uintptr_t stackframe)
{
static_assert(inputOrd >= 0 && inputOrd < numInputOnStack);
if constexpr(inputOrd == 0)
{
return *internal::GetStackTop<InputType>(stackframe);
}
else
{
static_assert(inputOrd == 1);
return *internal::GetStack2ndTop<InputType>(stackframe);
}
}
static OutputType* ALWAYS_INLINE WARN_UNUSED GetOutputLoc(uintptr_t stackframe)
{
static_assert(!std::is_same<OutputType, void>::value);
if constexpr(std::is_floating_point<InputType>::value != std::is_floating_point<OutputType>::value)
{
// Input and output are on different stacks
//
return internal::GetStackPush<OutputType>(stackframe);
}
else if constexpr(numInputOnStack == 0)
{
return internal::GetStackPush<OutputType>(stackframe);
}
else if constexpr(numInputOnStack == 1)
{
return internal::GetStackTop<OutputType>(stackframe);
}
else
{
static_assert(numInputOnStack == 2);
return internal::GetStack2ndTop<OutputType>(stackframe);
}
}
};
#undef INT_TOP
#undef INT_PUSH
#undef INT_2ND_TOP
#undef INT_3RD_TOP
#undef FLOAT_TOP
#undef FLOAT_PUSH
#undef FLOAT_2ND_TOP
#undef DEF_DATA
#undef GET_DATA
} // namespace PochiVM
| 25.905063 | 107 | 0.683606 |
065d8deb50862573d3f3fe7daeb25979ff6c08d8 | 1,177 | h | C | pkcs11-gui/inc/p11core.h | T-Bonhagen/pkcs11-gui | 95eed0e907235af826d79a58531dca07b77cca5d | [
"Apache-2.0"
] | 7 | 2018-06-06T12:53:46.000Z | 2022-02-28T16:42:09.000Z | pkcs11-gui/inc/p11core.h | n3wtron/pkcs11-gui | faccbaa79dd58d803d8466ae28af7098c3a8e92a | [
"Apache-2.0"
] | 4 | 2020-07-28T06:46:28.000Z | 2021-01-22T09:55:13.000Z | pkcs11-gui/inc/p11core.h | n3wtron/pkcs11-gui | faccbaa79dd58d803d8466ae28af7098c3a8e92a | [
"Apache-2.0"
] | 4 | 2018-04-25T16:57:55.000Z | 2021-01-21T19:59:11.000Z | /*
* Copyright 2017 Igor Maculan <n3wtron@gmail.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.
*
*/
#ifndef P11CORE_H
#define P11CORE_H
#include <libp11.h>
#include <neither/either.hpp>
#include <QObject>
#include <QList>
#include <smartcardreader.h>
using namespace neither;
class P11Core : public QObject
{
Q_OBJECT
public:
P11Core(QObject* parent);
~P11Core();
Either<QString,QList<SmartCardReader*>> loadSmartCardReaders();
QList<SmartCardReader*> getSmartCardReaders();
Either<QString,bool> init(QString driver);
private:
PKCS11_CTX *p11Context=NULL;
QList<SmartCardReader*> slotList;
};
#endif // SMARTCARDREADER_H
| 27.372093 | 75 | 0.734919 |
0662b63142f93b45d2492652ba621b866cc1c81f | 345 | h | C | headers/masked_sbox_lin.h | NicsTr/better_cortexm | 7ada0e1934928fe074a6cb137f741936d3505f8c | [
"MIT"
] | null | null | null | headers/masked_sbox_lin.h | NicsTr/better_cortexm | 7ada0e1934928fe074a6cb137f741936d3505f8c | [
"MIT"
] | null | null | null | headers/masked_sbox_lin.h | NicsTr/better_cortexm | 7ada0e1934928fe074a6cb137f741936d3505f8c | [
"MIT"
] | null | null | null | #ifndef MASKED_SBOX_LIN_H
#define MASKED_SBOX_LIN_H
#include <stdint.h>
void masked_sbox_l1(uint16_t all_tmp[21][D + 1], const uint16_t state[8][D+1]);
void masked_sbox_l2(uint16_t state[8][D+1], uint16_t all_tmp[18][D + 1]);
void masked_sbox_l_int0(uint16_t state[7][D+1], const uint16_t all_tmp[2][D + 1]);
#endif /* MASKED_SBOX_LIN_H */
| 34.5 | 83 | 0.736232 |
06643ad1774980309e58424e742a00b298e312a4 | 1,941 | c | C | ex1-4.c | koreakimbing/20220211 | 3a108ed167042153a7032ec001da8b420a9cd3f0 | [
"Apache-2.0"
] | null | null | null | ex1-4.c | koreakimbing/20220211 | 3a108ed167042153a7032ec001da8b420a9cd3f0 | [
"Apache-2.0"
] | null | null | null | ex1-4.c | koreakimbing/20220211 | 3a108ed167042153a7032ec001da8b420a9cd3f0 | [
"Apache-2.0"
] | null | null | null | // SAVING SIMULATION WITH RANDOM VARIABLES //
// PERINC : increment of salary, uniform random number //
// PERINT : increment of savings, 9% compounded //
// YEAR : current year of simulation //
// PERLOW : lower bound 0% //
// PERHIG : upper bound 10% //
// SEED : seed for the random number generator //
// U : uniform random number [0,1) //
// PROGRAM EX1-4 //
#include<stdio.h>
#include<math.h>
#define perint 0.09
#define SEED 35213
// RANDOM NUMBER GENERATOR //
void random(long *np, float *up)
{
*np = *np * 843314861 + 453816693;
if(*np < 0)
{ *np = *np +2147483647;
*np = *np + 1;
}
*up = *np * 0.4656612e-9;
}
// MAIN PROGRAM //
void main()
{
int year;
long n=SEED;
float salary,saving,perinc,u=0,perlow=0, perhig=10;
FILE *output;
output=fopen("c:\\work\\ex1-4.out","wt");
salary=12000000.0;
saving=0.0;
perinc=0;
year=0;
fprintf(output,"SALARY INCREASE RATE IS %3.1f - %4.1f \n",perlow,perhig);
fprintf(output,"INTEREST RATE ON SAVINGS %4.2f \n",perint);
fprintf(output,"\nYEAR SALARY.INC.RATE SALARY SAVING\n");
fprintf(output," %2d %4.2f %10.0f %10.0f\n",year,perinc,salary,saving);
while (year < 30)
{
++year;
saving = saving + perint * saving + 0.10 * salary;
random(&n,&u);
perinc = (int)(u * (perhig+1-perlow) + perlow);
perinc = perinc * 0.01;
salary = salary + perinc * salary;
fprintf(output," %2d %4.2f %10.0f %10.0f\n",year,perinc,salary,saving);
}
fclose(output);
}
| 30.328125 | 98 | 0.473982 |
0666b8dbf53f9587dd0db8df9d3799f32ee89aec | 3,907 | h | C | mbed-gr-libs/GraphicsFramework/TARGET_RZA1H/RGA/inc/window_surfaces_inline.h | h7ga40/PeachCam | 06d023a908dc38228e77b47f80bc8496a4d35806 | [
"Apache-2.0"
] | 1 | 2019-12-13T05:51:34.000Z | 2019-12-13T05:51:34.000Z | mbed-gr-libs/GraphicsFramework/TARGET_RZA1H/RGA/inc/window_surfaces_inline.h | h7ga40/PeachCam | 06d023a908dc38228e77b47f80bc8496a4d35806 | [
"Apache-2.0"
] | null | null | null | mbed-gr-libs/GraphicsFramework/TARGET_RZA1H/RGA/inc/window_surfaces_inline.h | h7ga40/PeachCam | 06d023a908dc38228e77b47f80bc8496a4d35806 | [
"Apache-2.0"
] | 1 | 2021-09-17T15:41:36.000Z | 2021-09-17T15:41:36.000Z | /*******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
* Copyright (C) 2012 - 2014 Renesas Electronics Corporation. All rights reserved.
*******************************************************************************/
/**
* @file window_surfaces_inline.h
* @brief $Module: CLibCommon $ $PublicVersion: 1.00 $ (=CLIB_VERSION)
* $Rev: 47 $
* $Date:: 2014-01-06 18:18:48 +0900#$
*/
/* This file is included from "window_surfaces.h" */
#ifndef WINDOW_SURFACES_INLINE_H
#define WINDOW_SURFACES_INLINE_H
#ifndef NOT_DEFINE_INLINE_FUNCTION
/******************************************************************************
Includes <System Includes> , "Project Includes"
******************************************************************************/
#include <stdint.h>
#include "clib_drivers_typedef.h"
#include "frame_buffer_typedef.h"
#include "r_multi_compiler_typedef.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/******************************************************************************
Typedef definitions
******************************************************************************/
/******************************************************************************
Macro definitions
******************************************************************************/
/******************************************************************************
Variable Externs
******************************************************************************/
/******************************************************************************
Functions Prototypes
******************************************************************************/
/**
* @brief Get color
*
* @param Red Red.
* @param Green Green.
* @param Blue Blue.
* @param Alpha Alpha.
* @return Color code as "r8g8b8a8_t"
*/
INLINE r8g8b8a8_t R_RGA_Get_R8G8B8A8( int_fast32_t const Red,
int_fast32_t const Green,
int_fast32_t const Blue,
int_fast32_t const Alpha )
{
r8g8b8a8_t color_; /* _ is for MISRA 5.6 */
/* ->QAC 3198 */
color_.Value = DUMMY_INITIAL_VALUE; /* for avoid ARMCC warning C4017W */
/* <-QAC 3198 */
color_.u.Red = (uint8_t) Red;
color_.u.Green = (uint8_t) Green;
color_.u.Blue = (uint8_t) Blue;
color_.u.Alpha = (uint8_t) Alpha;
return color_;
}
#ifdef __cplusplus
} /* extern "C" */
#endif /* __cplusplus */
#endif /* NOT_DEFINE_INLINE_FUNCTION */
#endif
| 38.303922 | 82 | 0.518556 |
06695f5ff792dbcb6c17c81dacdab1271ae1dc9b | 414 | h | C | ired6 1.0.0/ired6/Classes/Mine/Views/SQMyOrderView.h | zc150815/ired6-1.0.0 | 0422c295445d9b59f59d90d8c9f87f270a0e556a | [
"MIT"
] | null | null | null | ired6 1.0.0/ired6/Classes/Mine/Views/SQMyOrderView.h | zc150815/ired6-1.0.0 | 0422c295445d9b59f59d90d8c9f87f270a0e556a | [
"MIT"
] | null | null | null | ired6 1.0.0/ired6/Classes/Mine/Views/SQMyOrderView.h | zc150815/ired6-1.0.0 | 0422c295445d9b59f59d90d8c9f87f270a0e556a | [
"MIT"
] | null | null | null | //
// SQMyOrderView.h
// SQ565
//
// Created by zhangchong on 16/12/13.
// Copyright © 2016年 Online Community Of China. All rights reserved.
//
#import <UIKit/UIKit.h>
@class SQMyOrderView;
@protocol SQMyOrderViewDelegate<NSObject>
-(void)myOrderView:(SQMyOrderView*)myOrderView myOrderButtonActiton:(UIButton*)sender;
@end
@interface SQMyOrderView : UIView
@property (nonatomic, weak) id delegate;
@end
| 19.714286 | 86 | 0.746377 |
066c29f1547d7ac101b65ae99273884991b3f2d1 | 2,169 | h | C | Core/DianYing/Include/Dy/Meta/Information/ElementLevelMetaInfo.h | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | 4 | 2019-03-17T19:46:54.000Z | 2019-12-09T20:11:01.000Z | Core/DianYing/Include/Dy/Meta/Information/ElementLevelMetaInfo.h | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | null | null | null | Core/DianYing/Include/Dy/Meta/Information/ElementLevelMetaInfo.h | liliilli/DianYing | 6e19f67e5d932e346a0ce63a648bed1a04ef618e | [
"MIT"
] | null | null | null | #ifndef GUARD_DY_ELELMENT_DESCRIPTOR_LEVELDESCRIPTOR_H
#define GUARD_DY_ELELMENT_DESCRIPTOR_LEVELDESCRIPTOR_H
///
/// MIT License
/// Copyright (c) 2018-2019 Jongmin Yun
///
/// 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.
///
#include <any>
#include <vector>
#include <unordered_set>
#include <nlohmann/json_fwd.hpp>
#include <Dy/Helper/Type/DColorRGBA.h>
#include <Dy/Helper/Type/DColorRGB24.h>
#include <Dy/Meta/Type/DDyResourceName.h>
#include <Dy/Meta/Information/ElementObjectMetaInfo.h>
//!
//! Implementation
//!
namespace dy
{
///
/// @struct PDyLevelConstructMetaInfo
/// @brief Level construction descriptor.
///
struct PDyLevelConstructMetaInfo final
{
PDyLevelConstructMetaInfo() = default;
MDY_ONLY_MOVEABLE_PROPERTIES_DEFAULT(PDyLevelConstructMetaInfo);
struct DMeta final
{
/// Initial level name
std::string mLevelName;
/// Initial background of scene to create
DColorRGB mLevelBackgroundColor = DColorRGB{1, 1, 1};
};
/// DMeta scene common information.
DMeta mMeta = {};
/// Object meta information
TObjectMetaInfoList mLevelObjectMetaInfoList = {};
/// @brief Get level resource set.
/// Duplicated resource speicifer on this level is shrinked into one.
TDDyResourceNameSet GetLevelResourceSet() const noexcept;
};
void to_json (_MINOUT_ nlohmann::json& j, _MIN_ const PDyLevelConstructMetaInfo& p);
void from_json(_MIN_ const nlohmann::json& j, _MINOUT_ PDyLevelConstructMetaInfo& p);
void to_json (_MINOUT_ nlohmann::json& j, _MIN_ const PDyLevelConstructMetaInfo::DMeta& p);
void from_json(_MIN_ const nlohmann::json& j, _MINOUT_ PDyLevelConstructMetaInfo::DMeta& p);
} /// ::dy namespace
#endif /// GUARD_DY_ELELMENT_DESCRIPTOR_LEVELDESCRIPTOR_H | 31.897059 | 95 | 0.757953 |
066cae4685d95751bab8b283cb44b846f430f25e | 259 | h | C | particlefilter-hip/kernel_sum.h | BeauJoh/HeCBench | 594b845171d686dc951971ce36ed59cf114dd2b4 | [
"BSD-3-Clause"
] | 58 | 2020-08-06T18:53:44.000Z | 2021-10-01T07:59:46.000Z | particlefilter-hip/kernel_sum.h | BeauJoh/HeCBench | 594b845171d686dc951971ce36ed59cf114dd2b4 | [
"BSD-3-Clause"
] | 2 | 2020-12-04T12:35:02.000Z | 2021-03-04T22:49:25.000Z | particlefilter-hip/kernel_sum.h | BeauJoh/HeCBench | 594b845171d686dc951971ce36ed59cf114dd2b4 | [
"BSD-3-Clause"
] | 13 | 2020-08-19T13:44:18.000Z | 2021-09-08T04:25:34.000Z | __global__ void
kernel_sum (float* partial_sums, const int Nparticles)
{
int x;
float sum = 0;
int num_blocks = (Nparticles + BLOCK_SIZE - 1) / BLOCK_SIZE;
for (x = 0; x < num_blocks; x++) {
sum += partial_sums[x];
}
partial_sums[0] = sum;
}
| 19.923077 | 62 | 0.637066 |
066f9d7f67427eba58574802ee20a75e2d81e4c6 | 1,308 | h | C | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/ARTVCMCUReplyRequest.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-03-29T12:08:37.000Z | 2021-05-26T05:20:11.000Z | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/ARTVCMCUReplyRequest.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | null | null | null | AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/ARTVCMCUReplyRequest.h | ceekay1991/AliPayForDebug | 5795e5db31e5b649d4758469b752585e63e84d94 | [
"MIT"
] | 5 | 2020-04-17T03:24:04.000Z | 2022-03-30T05:42:17.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 "ARTVCMCUBasicRequest.h"
@class ARTVCMCUInviteInfo, NSDictionary, NSString;
@interface ARTVCMCUReplyRequest : ARTVCMCUBasicRequest
{
int _reply;
NSString *_uid;
NSString *_inviter;
NSString *_bizName;
NSString *_subBiz;
NSString *_roomId;
NSString *_inviteId;
ARTVCMCUInviteInfo *_inviteInfo;
NSDictionary *_extra;
}
@property(retain, nonatomic) NSDictionary *extra; // @synthesize extra=_extra;
@property(retain, nonatomic) ARTVCMCUInviteInfo *inviteInfo; // @synthesize inviteInfo=_inviteInfo;
@property(copy, nonatomic) NSString *inviteId; // @synthesize inviteId=_inviteId;
@property(nonatomic) int reply; // @synthesize reply=_reply;
@property(copy, nonatomic) NSString *roomId; // @synthesize roomId=_roomId;
@property(copy, nonatomic) NSString *subBiz; // @synthesize subBiz=_subBiz;
@property(copy, nonatomic) NSString *bizName; // @synthesize bizName=_bizName;
@property(copy, nonatomic) NSString *inviter; // @synthesize inviter=_inviter;
@property(copy, nonatomic) NSString *uid; // @synthesize uid=_uid;
- (void).cxx_destruct;
- (id)jsonString;
- (id)init;
@end
| 33.538462 | 99 | 0.736239 |
067102d7c1a395e92b673cd175e88fb74f8b7727 | 552 | c | C | Strings/ex_2.c | dibyanshushekhardey/Quiestion-Bank-C-Program-KGEC | 0dba700ddddaa3248749978ad5e6eab394768995 | [
"MIT"
] | null | null | null | Strings/ex_2.c | dibyanshushekhardey/Quiestion-Bank-C-Program-KGEC | 0dba700ddddaa3248749978ad5e6eab394768995 | [
"MIT"
] | null | null | null | Strings/ex_2.c | dibyanshushekhardey/Quiestion-Bank-C-Program-KGEC | 0dba700ddddaa3248749978ad5e6eab394768995 | [
"MIT"
] | null | null | null | #include<stdio.h>
#include<string.h>
void main()
{
char str1[50],str2[50];
int i,j,n,m,l;
printf("Enter the string\n");
gets(str1); //scanf ("%s",str1);
printf("Enter the position of the required character: ");
scanf("%d",&n);
printf("Enter the required number of characters to be extracted: ");
scanf("%d",&m);
l=strlen(str1);
if(m+n-1<l)
{
for(i=n-1;i<m+n-1;i++)
{
for(j=0;j<i;j++)
{
str2[j]=str1[i];
str2[j]='\0';
}
}
printf ("The extracted string is: %s",str2);
}
else
printf ("string extraction is not possible");
} | 19.714286 | 68 | 0.599638 |
9448fa10383acea5964e33f42dcf2c11bdc33541 | 372 | h | C | lexer.h | mizkichan/hacek | a61a4085994e4d890e2d35e00f2c030712284a94 | [
"CC0-1.0"
] | null | null | null | lexer.h | mizkichan/hacek | a61a4085994e4d890e2d35e00f2c030712284a94 | [
"CC0-1.0"
] | null | null | null | lexer.h | mizkichan/hacek | a61a4085994e4d890e2d35e00f2c030712284a94 | [
"CC0-1.0"
] | null | null | null | #ifndef LEXER_H
#define LEXER_H
struct Line **split_source_into_lines(const char *) __attribute__((nonnull));
void reconstruct_lines(struct Line **) __attribute__((nonnull));
void replace_comments(struct Line **) __attribute__((nonnull));
struct PPTokenLine **tokenize(struct Line **)
__attribute__((returns_nonnull, nonnull));
#endif
// vim: set ft=c ts=2 sw=2 et:
| 31 | 77 | 0.755376 |
944b3a65e0bb5213e6041fbb9acc62b52ecb11ef | 328 | h | C | Pods/Target Support Files/Pods-ezTippinTests/Pods-ezTippinTests-umbrella.h | catekat16/ezTippin | 8851274be78a963fdb8d14375e58125c0b36d8a5 | [
"Apache-2.0"
] | null | null | null | Pods/Target Support Files/Pods-ezTippinTests/Pods-ezTippinTests-umbrella.h | catekat16/ezTippin | 8851274be78a963fdb8d14375e58125c0b36d8a5 | [
"Apache-2.0"
] | null | null | null | Pods/Target Support Files/Pods-ezTippinTests/Pods-ezTippinTests-umbrella.h | catekat16/ezTippin | 8851274be78a963fdb8d14375e58125c0b36d8a5 | [
"Apache-2.0"
] | null | null | null | #ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double Pods_ezTippinTestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_ezTippinTestsVersionString[];
| 19.294118 | 72 | 0.835366 |
944de417f58239f36be0d69fa169efb988f99fe9 | 1,103 | c | C | c6/reading-client.c | stevedh/readingdb | 5ebc06c567becb84a7eeaade9d5ebce3f13210ef | [
"BSD-2-Clause"
] | 14 | 2015-02-07T16:04:57.000Z | 2020-01-07T11:44:34.000Z | c6/reading-client.c | cbs-iiith/readingdb | 5ebc06c567becb84a7eeaade9d5ebce3f13210ef | [
"BSD-2-Clause"
] | 1 | 2018-10-03T06:56:18.000Z | 2018-10-03T06:56:18.000Z | c6/reading-client.c | cbs-iiith/readingdb | 5ebc06c567becb84a7eeaade9d5ebce3f13210ef | [
"BSD-2-Clause"
] | 6 | 2016-03-18T01:06:02.000Z | 2020-01-07T11:43:27.000Z | #include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/ipc.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <semaphore.h>
#include <string.h>
#include <signal.h>
#include <time.h>
#include "readingdb.h"
#include "util.h"
int main() {
IPC *ipp = ipc_open(0, 0);
struct ipc_command *c = ipp->shm;
struct ipc_reply *r = ipp->shm;
int i;
sem_wait(ipp->mutex_caller);
printf("GOT CALLER\n");
c->command = COMMAND_SYNC;
sem_post(ipp->mutex_server);
sem_wait(ipp->mutex_reply);
sem_post(ipp->mutex_caller);
// try querying
sem_wait(ipp->mutex_caller);
c->command = COMMAND_QUERY;
c->args.query.streamid = 320;
c->args.query.starttime = 0;
c->args.query.endtime = time(NULL);
sem_post(ipp->mutex_server);
sem_wait(ipp->mutex_reply);
printf("got reply: %i records\n", r->data.query.nrecs);
for (i = 0; i < r->data.query.nrecs; i++) {
printf("%i %f\n", r->data.query.pts[i].timestamp,
r->data.query.pts[i].reading);
}
sem_post(ipp->mutex_caller);
ipc_close(ipp);
return 0;
}
| 22.510204 | 57 | 0.653672 |
945136f0d642c57c238d2fbdddf2a7d18b45e328 | 21,413 | c | C | sh2emu/btesh2/btesh2_opjmp.c | cr88192/bgbtech_shxemu | 0e8c2de32c94631a1c18df17f23385235dc67879 | [
"MIT"
] | 5 | 2017-02-23T21:23:16.000Z | 2018-04-12T20:42:03.000Z | sh2emu/btesh2/btesh2_opjmp.c | cr88192/bgbtech_shxemu | 0e8c2de32c94631a1c18df17f23385235dc67879 | [
"MIT"
] | null | null | null | sh2emu/btesh2/btesh2_opjmp.c | cr88192/bgbtech_shxemu | 0e8c2de32c94631a1c18df17f23385235dc67879 | [
"MIT"
] | null | null | null | void BTSH_Op_UpdateForSr(BTESH2_CpuState *cpu);
void BTSH_Op_BF_Abs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
if(!(i&1))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
// cpu->trnext=NULL;
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BFS_Abs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
if(!(i&1))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
// cpu->trnext=NULL;
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BT_Abs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
if(i&1)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
// cpu->trnext=NULL;
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BTS_Abs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
if(i&1)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
// cpu->trnext=NULL;
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRA_Abs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=NULL;
// cpu->trnext=cpu->trjmpnext;
}
void BTSH_Op_BSR_Abs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u64 i;
i=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
// cpu->regs[BTESH2_REG_PR]=i;
BTESH2_SetRegQWord(cpu, BTESH2_REG_PR, i);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
// cpu->trnext=NULL;
cpu->trnext=cpu->trjmpnext;
}
void BTSH_Op_BRAF_Reg(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u64 i;
i=BTESH2_GetRegQWord(cpu, op->rm);
// cpu->regs[BTESH2_REG_PC]=op->pc+i+2;
// cpu->regs[BTESH2_REG_PC]=op->pc+i+4;
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->pc+i+4);
cpu->trnext=NULL;
}
void BTSH_Op_BSRF_Reg(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u64 i, j;
i=BTESH2_GetRegQWord(cpu, op->rm);
j=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
// BTESH2_SetRegQWord(cpu, BTESH2_REG_PR, j);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PR, j);
// cpu->regs[BTESH2_REG_PC]=op->pc+i+2;
// cpu->regs[BTESH2_REG_PC]=op->pc+i+4;
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->pc+i+4);
cpu->trnext=NULL;
}
void BTSH_Op_BREQ_RegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rn);
if(i==0)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRNE_RegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rn);
if(i!=0)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRGT_RegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rn);
if(((s32)i)>0)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRLE_RegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rn);
if(((s32)i)<=0)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRGE_RegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rn);
if(((s32)i)>=0)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRLT_RegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rn);
if(((s32)i)<0)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BREQ_RegRegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rn);
j=BTESH2_GetRegQWord(cpu, op->rm);
if(((s32)i)==((s32)j))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRNE_RegRegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rn);
j=BTESH2_GetRegQWord(cpu, op->rm);
if(((s32)i)!=((s32)j))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRLT_RegRegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rn);
j=BTESH2_GetRegQWord(cpu, op->rm);
if(((s32)i)<((s32)j))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRGT_RegRegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rn);
j=BTESH2_GetRegQWord(cpu, op->rm);
if(((s32)i)>((s32)j))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRLE_RegRegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rn);
j=BTESH2_GetRegQWord(cpu, op->rm);
if(((s32)i)<=((s32)j))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_BRGE_RegRegAbs(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rn);
j=BTESH2_GetRegQWord(cpu, op->rm);
if(((s32)i)>=((s32)j))
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, op->imm);
cpu->trnext=cpu->trjmpnext;
}
}
void BTSH_Op_JMP_Reg(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, op->rm);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, i);
cpu->trnext=NULL;
}
void BTSH_Op_JSR_Reg(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i, j;
i=BTESH2_GetRegQWord(cpu, op->rm);
j=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PR, j);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, i);
cpu->trnext=NULL;
}
void BTSH_Op_RTS_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, BTESH2_REG_PR);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, i);
cpu->trnext=NULL;
}
void BTSH_Op_CLRT_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
i=i&(~1);
BTESH2_SetRegDWordL(cpu, BTESH2_REG_SR, i);
}
void BTSH_Op_SETT_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
i=i|1;
BTESH2_SetRegDWordL(cpu, BTESH2_REG_SR, i);
}
void BTSH_Op_CLRMAC_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
// cpu->regs[BTESH2_REG_MACL]=0;
// cpu->regs[BTESH2_REG_MACH]=0;
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_MACL]=0;
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_MACH]=0;
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_MACL]=0;
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_MACH]=0;
BTESH2_SetRegQWord(cpu, BTESH2_REG_MACL, 0);
BTESH2_SetRegQWord(cpu, BTESH2_REG_MACH, 0);
}
void BTSH_Op_CLRS_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
i=i&(~2);
BTESH2_SetRegDWordL(cpu, BTESH2_REG_SR, i);
}
void BTSH_Op_SETS_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
i=i|2;
BTESH2_SetRegDWordL(cpu, BTESH2_REG_SR, i);
}
void BTSH_Op_ICLRMD_Imm(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
// i=i&(~1);
if(op->imm&1)i&=~BTESH2_SRFL_DQ;
if(op->imm&2)i&=~BTESH2_SRFL_JQ;
BTESH2_SetRegDWordL(cpu, BTESH2_REG_SR, i);
// BTSH_Op_UpdateForSr(cpu);
if(i&BTESH2_SRFL_JQ)
{ cpu->csfl|=BTESH2_CSFL_SRJQ; }
else
{ cpu->csfl&=~BTESH2_CSFL_SRJQ; }
if(i&BTESH2_SRFL_DQ)
{ cpu->csfl|=BTESH2_CSFL_SRDQ; }
else
{ cpu->csfl&=~BTESH2_CSFL_SRDQ; }
}
void BTSH_Op_ISETMD_Imm(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
// i=i|1;
if(op->imm&1)i|=BTESH2_SRFL_DQ;
if(op->imm&2)i|=BTESH2_SRFL_JQ;
BTESH2_SetRegDWordL(cpu, BTESH2_REG_SR, i);
// BTSH_Op_UpdateForSr(cpu);
if(i&BTESH2_SRFL_JQ)
{ cpu->csfl|=BTESH2_CSFL_SRJQ; }
else
{ cpu->csfl&=~BTESH2_CSFL_SRJQ; }
if(i&BTESH2_SRFL_DQ)
{ cpu->csfl|=BTESH2_CSFL_SRDQ; }
else
{ cpu->csfl&=~BTESH2_CSFL_SRDQ; }
}
void BTSH_Op_TRAPSP_SET_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP);
BTESH2_SetAddrDWord(cpu, i-4, 0x12345678);
}
void BTSH_Op_TRAPSP_CLR_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 i;
i=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP);
i=BTESH2_GetAddrDWord(cpu, i-4);
if(i!=0x12345678)
{ cpu->status=BTESH2_EXC_STACK2; }
}
void BTSH_Op_NOP_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
}
void BTSH_Op_SLEEP_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
// printf("Sleep\n");
cpu->status=BTESH2_EXC_TRAPSLEEP;
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
void BTSH_Op_SetRegBankSwap(BTESH2_CpuState *cpu)
{
// u32 i0, i1, i2, i3;
// u32 j0, j1, j2, j3;
u64 i0, i1, j0, j1;
int i;
#if 0
i0=cpu->regs[BTESH2_REG_R0]; j0=cpu->regs[BTESH2_REG_RBANK+0];
i1=cpu->regs[BTESH2_REG_R1]; j1=cpu->regs[BTESH2_REG_RBANK+1];
i2=cpu->regs[BTESH2_REG_R2]; j2=cpu->regs[BTESH2_REG_RBANK+2];
i3=cpu->regs[BTESH2_REG_R3]; j3=cpu->regs[BTESH2_REG_RBANK+3];
cpu->regs[BTESH2_REG_R0]=j0; cpu->regs[BTESH2_REG_RBANK+0]=i0;
cpu->regs[BTESH2_REG_R1]=j1; cpu->regs[BTESH2_REG_RBANK+1]=i1;
cpu->regs[BTESH2_REG_R2]=j2; cpu->regs[BTESH2_REG_RBANK+2]=i2;
cpu->regs[BTESH2_REG_R3]=j3; cpu->regs[BTESH2_REG_RBANK+3]=i3;
i0=cpu->regs[BTESH2_REG_R4]; j0=cpu->regs[BTESH2_REG_RBANK+4];
i1=cpu->regs[BTESH2_REG_R5]; j1=cpu->regs[BTESH2_REG_RBANK+5];
i2=cpu->regs[BTESH2_REG_R6]; j2=cpu->regs[BTESH2_REG_RBANK+6];
i3=cpu->regs[BTESH2_REG_R7]; j3=cpu->regs[BTESH2_REG_RBANK+7];
cpu->regs[BTESH2_REG_R4]=j0; cpu->regs[BTESH2_REG_RBANK+4]=i0;
cpu->regs[BTESH2_REG_R5]=j1; cpu->regs[BTESH2_REG_RBANK+5]=i1;
cpu->regs[BTESH2_REG_R6]=j2; cpu->regs[BTESH2_REG_RBANK+6]=i2;
cpu->regs[BTESH2_REG_R7]=j3; cpu->regs[BTESH2_REG_RBANK+7]=i3;
#endif
#if 0
for(i=0; i<8; i++)
{
i0=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_R0+i];
i1=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_R0+i];
i2=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_R16+i];
i3=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_R16+i];
j0=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_RBANK+i];
j1=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_RBANK+i];
j2=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_RBANK2+i];
j3=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_RBANK2+i];
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_R0+i]=j0;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_R0+i]=j1;
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_R16+i]=j2;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_R16+i]=j3;
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_RBANK+i]=i0;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_RBANK+i]=i1;
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_RBANK2+i]=i2;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_RBANK2+i]=i3;
}
#endif
#if 1
for(i=0; i<8; i++)
{
i0=BTESH2_GetRegQWord(cpu, BTESH2_REG_R0+i);
i1=BTESH2_GetRegQWord(cpu, BTESH2_REG_R16+i);
j0=BTESH2_GetRegQWord(cpu, BTESH2_REG_RBANK+i);
j1=BTESH2_GetRegQWord(cpu, BTESH2_REG_RBANK2+i);
BTESH2_SetRegQWord(cpu, BTESH2_REG_R0+i, j0);
BTESH2_SetRegQWord(cpu, BTESH2_REG_R16+i, j1);
BTESH2_SetRegQWord(cpu, BTESH2_REG_RBANK+i, i0);
BTESH2_SetRegQWord(cpu, BTESH2_REG_RBANK2+i, i1);
}
#endif
}
void BTSH_Op_SetRegBank(BTESH2_CpuState *cpu, int rb)
{
// rb=(rb!=0);
if(rb)
{
if(!(cpu->ctfl&1))
{
BTSH_Op_SetRegBankSwap(cpu);
cpu->ctfl|=1;
}
}else
{
if(cpu->ctfl&1)
{
BTSH_Op_SetRegBankSwap(cpu);
cpu->ctfl&=~1;
}
}
}
void BTSH_Op_UpdateForSr(BTESH2_CpuState *cpu)
{
u32 v;
// v=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SR];
v=BTESH2_GetRegDWord(cpu, BTESH2_REG_SR);
if(v&BTESH2_SRFL_JQ)
{ cpu->csfl|=BTESH2_CSFL_SRJQ; }
else
{
// __debugbreak();
cpu->csfl&=~BTESH2_CSFL_SRJQ;
}
if(v&BTESH2_SRFL_DQ)
{ cpu->csfl|=BTESH2_CSFL_SRDQ; }
else
{ cpu->csfl&=~BTESH2_CSFL_SRDQ; }
}
void BTSH_Op_RTE_Z(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u64 pc, sr, sp;
// u32 pcl, pch, srl, srh;
// int sp;
if(cpu->arch==BTESH2_ARCH_SH4)
// if(0)
{
pc=BTESH2_GetRegQWord(cpu, BTESH2_REG_SPC);
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SSR);
BTSH_Op_SetRegBank(cpu,
sr&BTESH2_SRFL_RB);
// BTSH_Op_SetRegBank(cpu,
// cpu->regs[BTESH2_REG_SSR]&BTESH2_SRFL_RB);
// cpu->regs[BTESH2_REG_PC]=cpu->regs[BTESH2_REG_SPC];
// cpu->regs[BTESH2_REG_SR]=cpu->regs[BTESH2_REG_SSR];
// pcl=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SPC];
// pch=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SPC];
// srl=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SSR];
// srh=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SSR];
// if(!(srl&BTESH2_SRFL_JQ))
// {
// __debugbreak();
// }
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_PC]=pcl;
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_PC]=pch;
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SR]=srl;
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SR]=srh;
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR, sr);
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_PC]=
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SPC];
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_PC]=
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SPC];
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SR]=
// cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SSR];
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SR]=
// cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SSR];
BTSH_Op_UpdateForSr(cpu);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
return;
}
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SP, sp+8);
pc=BTESH2_GetAddrDWord(cpu, sp+0);
sr=BTESH2_GetAddrDWord(cpu, sp+4);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR, sr);
// sp=cpu->regs[BTESH2_REG_SP];
// cpu->regs[BTESH2_REG_SP]=sp+8;
// cpu->regs[BTESH2_REG_PC]=BTESH2_GetAddrDWord(cpu, sp+0);
// cpu->regs[BTESH2_REG_SR]=BTESH2_GetAddrDWord(cpu, sp+4);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
void BTSH_Op_TRAPA_Imm(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
// u32 pc, sr, pch, srh, sph;
// u32 sp, vbr;
u64 pc, sr;
u64 sp, vbr;
if(cpu->arch==BTESH2_ARCH_SH4)
// if(0)
{
vbr=BTESH2_GetRegQWord(cpu, BTESH2_REG_VBR);
pc=vbr+0x100;
BTESH2_SetRegQWord(cpu, BTESH2_REG_EXPEVT, 0x160);
BTESH2_SetRegQWord(cpu, BTESH2_REG_TRAEVT, op->ro);
if(!pc || !vbr)
{
BTESH2_ThrowTrap(cpu, op->ro);
return;
}
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SSR, sr);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SGR, sp);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SPC, op->pc+2);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR,
sr|BTESH2_SRFL_BL|BTESH2_SRFL_MD|BTESH2_SRFL_RB);
BTSH_Op_SetRegBank(cpu, 1);
BTSH_Op_UpdateForSr(cpu);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
return;
}
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP)-8;
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
BTESH2_SetAddrDWord(cpu, sp+4, sr);
BTESH2_SetAddrDWord(cpu, sp+0, op->pc+2);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SP, sp);
vbr=BTESH2_GetRegQWord(cpu, BTESH2_REG_VBR);
pc=BTESH2_GetAddrDWord(cpu, vbr+(op->ro<<2));
if(pc)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}else
{
BTESH2_ThrowTrap(cpu, op->ro);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
}
void BTSH_Op_TrapInt(BTESH2_CpuState *cpu, int ro)
{
u64 vbr, pc, spc;
u64 sp, sr, im, exp;
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
vbr=BTESH2_GetRegQWord(cpu, BTESH2_REG_VBR);
if(sr&BTESH2_SRFL_BL)
{
BTESH2_ThrowTrap(cpu, ro);
return;
}
if(cpu->arch==BTESH2_ARCH_SH4)
{
exp=0;
switch(ro)
{
case BTESH2_EXC_UDINST: exp=0x180; break;
case BTESH2_EXC_SLUDINST: exp=0x1A0; break;
case BTESH2_EXC_INVADDR: exp=0x0E0; break;
default:
break;
}
if(!vbr)
{
BTESH2_ThrowTrap(cpu, ro);
return;
}
// vbrl=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_VBR];
// vbrh=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_VBR];
// vbr=((u64)vbrl)|(((u64)vbrh)<<32);
pc=vbr+0x100;
BTESH2_SetRegQWord(cpu, BTESH2_REG_EXPEVT, exp);
BTESH2_SetRegQWord(cpu, BTESH2_REG_TRAEVT, ro);
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP);
spc=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SSR, sr);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SGR, sp);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SPC, spc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR,
sr|BTESH2_SRFL_BL|BTESH2_SRFL_MD|BTESH2_SRFL_RB);
#if 0
cpu->regs[BTESH2_REG_EXPEVT]=exp;
cpu->regs[BTESH2_REG_INTEVT]=ro;
sr=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SR];
sp=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SP];
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SPC]=
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_PC];
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SPC]=
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_PC];
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SSR]=sr;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SSR]=srh;
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SGR]=sp;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SGR]=sph;
sr&=~(BTESH2_SRFL_JQ|BTESH2_SRFL_DQ);
sr|=srh&(BTESH2_SRFL_JQ|BTESH2_SRFL_DQ);
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_PC]=pc;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_PC]=pc>>32;
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SR]=
sr|BTESH2_SRFL_BL|BTESH2_SRFL_MD|BTESH2_SRFL_RB;
#endif
BTSH_Op_SetRegBank(cpu, 1);
BTSH_Op_UpdateForSr(cpu);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
return;
}
pc=BTESH2_GetAddrDWord(cpu, vbr+(ro<<2));
if(!pc)
{
// cpu->status=ro;
BTESH2_ThrowTrap(cpu, ro);
return;
}
// sp=cpu->regs[BTESH2_REG_SP]-8;
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP)-8;
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
spc=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
// BTESH2_SetAddrDWord(cpu, sp+4, cpu->regs[BTESH2_REG_SR]);
// BTESH2_SetAddrDWord(cpu, sp+0, cpu->regs[BTESH2_REG_PC]);
BTESH2_SetAddrDWord(cpu, sp+4, sr);
BTESH2_SetAddrDWord(cpu, sp+0, spc);
// cpu->regs[BTESH2_REG_SP]=sp;
BTESH2_SetRegQWord(cpu, BTESH2_REG_SP, sp);
cpu->status=0;
if(pc)
{
// cpu->regs[BTESH2_REG_SR]=sr|BTESH2_SRFL_BL;
// cpu->regs[BTESH2_REG_PC]=pc;
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR,
sr|BTESH2_SRFL_BL);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
}
void BTSH_Op_TRAP_UD(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 pc;
int sp, vbr;
int ro;
BTSH_Op_TrapInt(cpu, BTESH2_EXC_UDINST);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
void BTSH_Op_TRAP_UDLY(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 pc;
int sp, vbr;
int ro;
BTSH_Op_TrapInt(cpu, BTESH2_EXC_SLUDINST);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
void BTSH_Op_TRAP_BRK(BTESH2_CpuState *cpu, BTESH2_Opcode *op)
{
u32 pc;
int sp, vbr;
int ro;
// BTSH_Op_TrapInt(cpu, BTESH2_EXC_BREAK);
BTESH2_ThrowTrap(cpu, BTESH2_EXC_BREAK);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
void BTSH_Op_TrapIntIrq(BTESH2_CpuState *cpu, int irq)
{
u64 pc, spc;
u64 sp, vbr, sr, im;
// u32 sph, srh, pch;
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
// vbr=cpu->regs[BTESH2_REG_VBR];
vbr=BTESH2_GetRegQWord(cpu, BTESH2_REG_VBR);
// if(!vbr)
// return;
if(sr&BTESH2_SRFL_BL)
return;
im=(sr>>4)&15;
if(im>8)
return;
// if(!vbr || (vbr==0xFAFAFAFAU))
// if(vbr==0xFAFAFAFAU)
// return;
pc=BTESH2_GetAddrDWord(cpu, vbr+(irq<<2));
if(!pc)
return;
if(cpu->arch==BTESH2_ARCH_SH4)
// if(0)
{
if(!vbr)
return;
// pc=vbr+0x100;
pc=vbr+0x600;
// BTESH2_SetRegQWord(cpu, BTESH2_REG_EXPEVT, exp);
// BTESH2_SetRegQWord(cpu, BTESH2_REG_TRAEVT, ro);
BTESH2_SetRegQWord(cpu, BTESH2_REG_INTEVT, irq);
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP);
spc=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SSR, sr);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SGR, sp);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SPC, spc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR,
sr|BTESH2_SRFL_BL|BTESH2_SRFL_MD|BTESH2_SRFL_RB);
#if 0
cpu->regs[BTESH2_REG_INTEVT]=irq;
sr=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SR];
sp=cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SP];
srh=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SR];
sph=cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SP];
// if(!(sr&BTESH2_SRFL_JQ))
// {
// __debugbreak();
// }
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SPC]=
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_PC];
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SPC]=
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_PC];
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SSR]=sr;
cpu->regs[BTESH2_REG_RLO+BTESH2_REG_SGR]=sp;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SSR]=srh;
cpu->regs[BTESH2_REG_RHI+BTESH2_REG_SGR]=sph;
sr&=~(BTESH2_SRFL_JQ|BTESH2_SRFL_DQ);
sr|=srh&(BTESH2_SRFL_JQ|BTESH2_SRFL_DQ);
cpu->regs[BTESH2_REG_PC]=pc;
cpu->regs[BTESH2_REG_SR]=sr|BTESH2_SRFL_BL|
BTESH2_SRFL_MD|BTESH2_SRFL_RB;
#endif
BTSH_Op_SetRegBank(cpu, 1);
BTSH_Op_UpdateForSr(cpu);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
return;
}
pc=BTESH2_GetAddrDWord(cpu, vbr+(irq<<2));
if(!pc)
return;
#if 1
sp=BTESH2_GetRegQWord(cpu, BTESH2_REG_SP)-8;
sr=BTESH2_GetRegQWord(cpu, BTESH2_REG_SR);
spc=BTESH2_GetRegQWord(cpu, BTESH2_REG_PC);
BTESH2_SetAddrDWord(cpu, sp+4, sr);
BTESH2_SetAddrDWord(cpu, sp+0, spc);
BTESH2_SetRegQWord(cpu, BTESH2_REG_SP, sp);
cpu->status=0;
if(pc)
{
BTESH2_SetRegQWord(cpu, BTESH2_REG_SR, sr|BTESH2_SRFL_BL);
BTESH2_SetRegQWord(cpu, BTESH2_REG_PC, pc);
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
#endif
#if 0
sp=cpu->regs[BTESH2_REG_SP]-8;
BTESH2_SetAddrDWord(cpu, sp+4, cpu->regs[BTESH2_REG_SR]);
BTESH2_SetAddrDWord(cpu, sp+0, cpu->regs[BTESH2_REG_PC]);
cpu->regs[BTESH2_REG_SP]=sp;
if(pc)
{
// cpu->regs[BTESH2_REG_SR]=sr|BTESH2_SRFL_BL;
cpu->regs[BTESH2_REG_SR]=sr;
cpu->regs[BTESH2_REG_PC]=pc;
cpu->trnext=NULL;
cpu->trjmpnext=NULL;
}
#endif
}
| 23.739468 | 68 | 0.726241 |
94514b38d2c916dd4a29c9b53754780f24b3f71f | 1,493 | h | C | include/MusicLibrary/MLGeniusPlaylistController.h | iMokhles/MyTheosHeaders | 2c263362a8a6f947b1a868e03983ed188ead6539 | [
"MIT"
] | 7 | 2016-07-22T14:29:58.000Z | 2021-03-19T05:31:48.000Z | iphone-private-frameworks-master/MusicLibrary/MLGeniusPlaylistController.h | tt295362026/demo | 7d6e9e75f29c992ea9c5693d38f76e0012bbbf15 | [
"BSD-4-Clause"
] | null | null | null | iphone-private-frameworks-master/MusicLibrary/MLGeniusPlaylistController.h | tt295362026/demo | 7d6e9e75f29c992ea9c5693d38f76e0012bbbf15 | [
"BSD-4-Clause"
] | 3 | 2017-02-06T23:58:01.000Z | 2017-10-31T03:47:52.000Z | /**
* This header is generated by class-dump-z 0.2a.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*
* Source: /System/Library/PrivateFrameworks/MusicLibrary.framework/MusicLibrary
*/
#import <Foundation/NSObject.h>
@class NSMutableData;
@interface MLGeniusPlaylistController : NSObject {
@private
void* _echo;
void* _echo_library;
void* _echo_cluster_playlist;
NSMutableData* _sharedBlobMutableData;
}
+(void)ignoreUnusedWarnings;
+(BOOL)useFakeGeniusData;
+(BOOL)hasGeniusDataAvailable;
+(BOOL)hasGeniusCapableiTunes;
+(BOOL)hasGeniusFeatureEnabled;
+(unsigned)defaultMinTrackCount;
+(unsigned)defaultTrackCount;
+(BOOL)populatePlaylist:(id)playlist withSeedTrack:(id)seedTrack playlistItemMin:(unsigned)min playlistItemMax:(unsigned)max error:(id*)error;
+(id)playlistControllerWithSeedTracks:(id)seedTracks error:(id*)error;
-(id)init;
-(void)dealloc;
-(id)_sharedBlobMutableData;
-(BOOL)_canIncludeTrackInGeniusPlaylist:(id)geniusPlaylist;
-(BOOL)_populatePlaylist:(id)playlist seedTrack:(id)track playlistItemMin:(unsigned)min playlistItemMax:(unsigned)max error:(id*)error;
-(BOOL)_fakePopulatePlaylist:(id)playlist seedTrack:(id)track playlistItemMin:(unsigned)min playlistItemMax:(unsigned)max error:(id*)error;
-(id)tracksFromClusterForCount:(unsigned)count error:(id*)error;
-(BOOL)_createClusterPlaylistWithSeedTracks:(id)seedTracks error:(id*)error;
-(id)_tracksFromClusterForPlaylistItemMax:(unsigned)playlistItemMax error:(id*)error;
@end
| 38.282051 | 142 | 0.80509 |
94593c6c50432b12d07215f215a8685a2f18baa5 | 2,377 | h | C | src/atlas/io/types/scalar.h | twsearle/atlas | a1916fd521f9935f846004e6194f80275de4de83 | [
"Apache-2.0"
] | 67 | 2018-03-01T06:56:49.000Z | 2022-03-08T18:44:47.000Z | src/atlas/io/types/scalar.h | twsearle/atlas | a1916fd521f9935f846004e6194f80275de4de83 | [
"Apache-2.0"
] | 93 | 2018-12-07T17:38:04.000Z | 2022-03-31T10:04:51.000Z | src/atlas/io/types/scalar.h | twsearle/atlas | a1916fd521f9935f846004e6194f80275de4de83 | [
"Apache-2.0"
] | 33 | 2018-02-28T17:06:19.000Z | 2022-01-20T12:12:27.000Z | /*
* (C) Copyright 2020 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
* In applying this licence, ECMWF does not waive the privileges and immunities
* granted to it by virtue of its status as an intergovernmental organisation
* nor does it submit to any jurisdiction.
*/
#pragma once
#include "atlas/io/Data.h"
#include "atlas/io/Metadata.h"
namespace atlas {
namespace io {
//---------------------------------------------------------------------------------------------------------------------
size_t encode_metadata(const int&, atlas::io::Metadata&);
size_t encode_metadata(const long&, atlas::io::Metadata&);
size_t encode_metadata(const long long&, atlas::io::Metadata&);
size_t encode_metadata(const unsigned long&, atlas::io::Metadata&);
size_t encode_metadata(const unsigned long long&, atlas::io::Metadata&);
size_t encode_metadata(const float&, atlas::io::Metadata&);
size_t encode_metadata(const double&, atlas::io::Metadata&);
//---------------------------------------------------------------------------------------------------------------------
void encode_data(const int&, atlas::io::Data&);
void encode_data(const long&, atlas::io::Data&);
void encode_data(const long long&, atlas::io::Data&);
void encode_data(const unsigned long&, atlas::io::Data&);
void encode_data(const unsigned long long&, atlas::io::Data&);
void encode_data(const float&, atlas::io::Data&);
void encode_data(const double&, atlas::io::Data&);
//---------------------------------------------------------------------------------------------------------------------
void decode(const atlas::io::Metadata&, const atlas::io::Data&, int&);
void decode(const atlas::io::Metadata&, const atlas::io::Data&, long&);
void decode(const atlas::io::Metadata&, const atlas::io::Data&, long long&);
void decode(const atlas::io::Metadata&, const atlas::io::Data&, unsigned long&);
void decode(const atlas::io::Metadata&, const atlas::io::Data&, unsigned long long&);
void decode(const atlas::io::Metadata&, const atlas::io::Data&, float&);
void decode(const atlas::io::Metadata&, const atlas::io::Data&, double&);
//---------------------------------------------------------------------------------------------------------------------
} // namespace io
} // namespace atlas
| 44.849057 | 119 | 0.581826 |
945af63b83530b4d804129468c47a308cb98976a | 2,171 | c | C | src/life.c | cjglo/GameOfLifeVisualizer | d07a5a166d3093bab34a701e8102e9606cc3c3b5 | [
"MIT"
] | null | null | null | src/life.c | cjglo/GameOfLifeVisualizer | d07a5a166d3093bab34a701e8102e9606cc3c3b5 | [
"MIT"
] | null | null | null | src/life.c | cjglo/GameOfLifeVisualizer | d07a5a166d3093bab34a701e8102e9606cc3c3b5 | [
"MIT"
] | null | null | null | #include "../inc/draw_callback.h"
#include "../inc/selecting_cells.h"
#include "../inc/const.h"
// quick helper functions to trigger draw and game start
gboolean timeout(GtkWidget *widget);
gboolean on_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data);
gint main(int argc,char *argv[])
{
// matrix that holds game-state data
struct matrix* mat = init_matrix(MATRIX_HEIGHT, MATRIX_LENGTH);
// typical gtk window set-up
GtkWidget *window, *drawing_area, *label;
gtk_init(&argc, &argv);
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window),"Game of Life Visualizer: Click the screen to customize then click space!");
g_signal_connect(window, "destroy", G_CALLBACK (gtk_main_quit), NULL); // exit function
// typical gtk drawing area set-up
drawing_area = gtk_drawing_area_new();
gtk_container_add(GTK_CONTAINER (window), drawing_area);
gtk_widget_set_size_request(drawing_area, WINDOW_HEIGHT, WINDOW_LENGTH);
g_signal_connect(G_OBJECT(drawing_area), "draw", G_CALLBACK(draw_callback), mat); // draw call, spring board for game logic I impl
gtk_widget_show_all (window);
// pre-game phase logic, where I let user choose cells
g_signal_connect(G_OBJECT(window),
"button-press-event",
G_CALLBACK(selecting_cells),
mat);
// starts game, ends selecting
g_signal_connect (G_OBJECT(window),
"key_press_event",
G_CALLBACK(on_key_press),
mat);
g_timeout_add(250, (GSourceFunc)timeout, window); // timer to call draw every quarter second
gtk_main (); // loop that runs gtk
// free matrix
for(int i = 0; i<MATRIX_HEIGHT; i++) {
free(mat->data[i]);
}
free(mat->data);
free(mat);
return 0;
}
gboolean timeout(GtkWidget *widget)
{
gtk_widget_queue_draw(widget);
return TRUE;
}
gboolean on_key_press (GtkWidget *widget, GdkEventKey *event, gpointer data)
{
struct matrix* m = data;
if(event->keyval == GDK_KEY_space) {
m->game_has_started = TRUE;
}
return TRUE;
} | 31.014286 | 134 | 0.669737 |
94616a45e10563ad2c848be8e8118368194c31a1 | 3,618 | h | C | usr/libexec/wifivelocityd/W5WiFiInterface.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | 1 | 2020-11-04T15:43:01.000Z | 2020-11-04T15:43:01.000Z | usr/libexec/wifivelocityd/W5WiFiInterface.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | usr/libexec/wifivelocityd/W5WiFiInterface.h | zhangkn/iOS14Header | 4323e9459ed6f6f5504ecbea2710bfd6c3d7c946 | [
"MIT"
] | null | null | null | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@class CWFInterface, NSData, NSMutableArray, NSMutableDictionary, NSString;
@protocol OS_dispatch_queue;
@interface W5WiFiInterface : NSObject
{
NSObject<OS_dispatch_queue> *_eventQueue; // 8 = 0x8
NSObject<OS_dispatch_queue> *_queue; // 16 = 0x10
struct _Apple80211 *_a11Ref; // 24 = 0x18
struct __SCDynamicStore *_storeRef; // 32 = 0x20
CWFInterface *_corewifi; // 40 = 0x28
_Bool _isMonitoringEvents; // 48 = 0x30
NSMutableArray *_linkQualityUpdates; // 56 = 0x38
NSData *_lastAssociatedSSID; // 64 = 0x40
NSString *_lastAssociatedSSIDString; // 72 = 0x48
NSMutableDictionary *_cachedPreferredNetworksListUUIDMap; // 80 = 0x50
_Bool _isAWDLRealTimeMode; // 88 = 0x58
CDUnknownBlockType _updatedWiFiCallback; // 96 = 0x60
NSString *_interfaceName; // 104 = 0x68
}
@property(readonly, nonatomic) _Bool isAWDLRealTimeMode; // @synthesize isAWDLRealTimeMode=_isAWDLRealTimeMode;
@property(readonly, copy, nonatomic) NSString *interfaceName; // @synthesize interfaceName=_interfaceName;
@property(copy, nonatomic) CDUnknownBlockType updatedWiFiCallback; // @synthesize updatedWiFiCallback=_updatedWiFiCallback;
- (_Bool)isUsingCustomProxySetting; // IMP=0x0000000100036e50
- (_Bool)isUsingCustomDNSSettings; // IMP=0x0000000100036d74
- (long long)ipv4ConfigMethod; // IMP=0x0000000100036b48
- (long long)ipv6ConfigMethod; // IMP=0x0000000100036974
- (id)__proxiesSetupConfig; // IMP=0x00000001000368bc
- (id)__dnsSetupConfig; // IMP=0x0000000100036804
- (id)__dnsStateConfig; // IMP=0x000000010003674c
- (id)__ipv6SetupConfig; // IMP=0x0000000100036694
- (id)__ipv4SetupConfig; // IMP=0x00000001000365dc
- (id)__ipv6StateConfig; // IMP=0x0000000100036524
- (id)__ipv4StateConfig; // IMP=0x000000010003646c
- (void)clearCachedPreferredNetworksListWithUUID:(id)arg1; // IMP=0x00000001000363d0
- (id)cachedPreferredNetworksListWithUUID:(id)arg1; // IMP=0x0000000100036260
- (id)currentPreferredNetwork; // IMP=0x0000000100036240
- (id)currentNetwork; // IMP=0x0000000100036220
- (long long)security; // IMP=0x0000000100036128
- (id)scanCache:(_Bool)arg1; // IMP=0x0000000100035f20
- (_Bool)setChannel:(id)arg1; // IMP=0x0000000100035e88
- (void)disassociate; // IMP=0x0000000100035e74
- (id)performScanOnChannels:(id)arg1 translate:(_Bool)arg2; // IMP=0x0000000100035478
- (id)channel; // IMP=0x0000000100035458
- (id)lastAssociatedSSIDString; // IMP=0x0000000100035348
- (id)lastAssociatedSSID; // IMP=0x0000000100035238
- (id)supportedChannels; // IMP=0x0000000100035054
- (id)linkQualityUpdates; // IMP=0x0000000100034f28
- (void)__addlinkQualityUpdate:(id)arg1; // IMP=0x0000000100034e60
- (void)__clearLinkQualityUpdates; // IMP=0x0000000100034dcc
- (void)__updateLastAssociatedSSID; // IMP=0x0000000100034cdc
- (void)__updateAWDLRealTimeMode:(_Bool)arg1; // IMP=0x0000000100034c54
- (void)stopEventMonitoring; // IMP=0x0000000100034b9c
- (void)__stopEventMonitoring; // IMP=0x0000000100034adc
- (void)startEventMonitoring; // IMP=0x0000000100034a20
- (void)__startEventMonitoring; // IMP=0x0000000100033c38
- (id)preferredNetworksList; // IMP=0x0000000100033868
- (int)role; // IMP=0x0000000100033858
- (void)dealloc; // IMP=0x00000001000337b8
- (void)setUpdatedWiFiInterfaceCallback:(CDUnknownBlockType)arg1; // IMP=0x00000001000336dc
- (id)init; // IMP=0x00000001000336a4
- (id)initWithInterfaceName:(id)arg1 corewifi:(id)arg2; // IMP=0x0000000100033460
@end
| 48.891892 | 123 | 0.774461 |
946384c32c9f81dadf514922f077ede6fcb9bbfd | 20 | h | C | plugins/mtrace.h | gili-yankovitch/mambo-cfi | 4bca7a8c9c54f7f1254f5bdbfd310e96866b01eb | [
"Apache-2.0"
] | 237 | 2016-04-22T10:33:57.000Z | 2022-03-31T15:39:58.000Z | plugins/mtrace.h | gili-yankovitch/mambo-cfi | 4bca7a8c9c54f7f1254f5bdbfd310e96866b01eb | [
"Apache-2.0"
] | 55 | 2017-02-02T14:34:37.000Z | 2022-03-25T14:12:45.000Z | plugins/mtrace.h | gili-yankovitch/mambo-cfi | 4bca7a8c9c54f7f1254f5bdbfd310e96866b01eb | [
"Apache-2.0"
] | 46 | 2017-02-01T19:31:50.000Z | 2022-03-23T16:15:58.000Z | #define BUFLEN 2047
| 10 | 19 | 0.8 |
94655767971d8e18536a7d65b7967137f5537582 | 243 | h | C | protocols/GEOServiceGap.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 36 | 2016-04-20T04:19:04.000Z | 2018-10-08T04:12:25.000Z | protocols/GEOServiceGap.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | null | null | null | protocols/GEOServiceGap.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 10 | 2016-06-16T02:40:44.000Z | 2019-01-15T03:31:45.000Z | /* Generated by RuntimeBrowser.
*/
@protocol GEOServiceGap <NSObject>
@required
- (<GEOServerFormattedString> *)displayMessagFormatString;
- (NSDate *)endDate;
- (unsigned long long)routeListInsertBeforeIndex;
- (NSDate *)startDate;
@end
| 17.357143 | 58 | 0.757202 |
94670076d32ba0ec2cf13cc4a798cde3362962db | 2,874 | c | C | release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/rt2860/common/eeprom.c | afeng11/tomato-arm | 1ca18a88480b34fd495e683d849f46c2d47bb572 | [
"FSFAP"
] | 21 | 2021-01-22T06:47:38.000Z | 2022-03-20T14:24:29.000Z | release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/rt2860/common/eeprom.c | afeng11/tomato-arm | 1ca18a88480b34fd495e683d849f46c2d47bb572 | [
"FSFAP"
] | 1 | 2021-02-24T05:16:58.000Z | 2021-02-24T05:16:58.000Z | release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/staging/rt2860/common/eeprom.c | afeng11/tomato-arm | 1ca18a88480b34fd495e683d849f46c2d47bb572 | [
"FSFAP"
] | 12 | 2021-01-22T14:59:28.000Z | 2022-02-22T04:03:31.000Z | /*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, Inc.
*
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
* *
*************************************************************************
Module Name:
eeprom.c
Abstract:
Revision History:
Who When What
-------- ---------- ----------------------------------------------
Name Date Modification logs
*/
#include "../rt_config.h"
int RtmpChipOpsEepromHook(struct rt_rtmp_adapter *pAd, int infType)
{
struct rt_rtmp_chip_op *pChipOps = &pAd->chipOps;
#ifdef RT30xx
#ifdef RTMP_EFUSE_SUPPORT
u32 eFuseCtrl, MacCsr0;
int index;
index = 0;
do {
RTMP_IO_READ32(pAd, MAC_CSR0, &MacCsr0);
pAd->MACVersion = MacCsr0;
if ((pAd->MACVersion != 0x00)
&& (pAd->MACVersion != 0xFFFFFFFF))
break;
RTMPusecDelay(10);
} while (index++ < 100);
pAd->bUseEfuse = FALSE;
RTMP_IO_READ32(pAd, EFUSE_CTRL, &eFuseCtrl);
pAd->bUseEfuse = ((eFuseCtrl & 0x80000000) == 0x80000000) ? 1 : 0;
if (pAd->bUseEfuse) {
pChipOps->eeinit = eFuse_init;
pChipOps->eeread = rtmp_ee_efuse_read16;
return 0;
} else
DBGPRINT(RT_DEBUG_TRACE, ("NVM is EEPROM\n"));
#endif /* RTMP_EFUSE_SUPPORT // */
#endif /* RT30xx // */
switch (infType) {
#ifdef RTMP_PCI_SUPPORT
case RTMP_DEV_INF_PCI:
pChipOps->eeinit = NULL;
pChipOps->eeread = rtmp_ee_prom_read16;
break;
#endif /* RTMP_PCI_SUPPORT // */
#ifdef RTMP_USB_SUPPORT
case RTMP_DEV_INF_USB:
pChipOps->eeinit = NULL;
pChipOps->eeread = RTUSBReadEEPROM16;
break;
#endif /* RTMP_USB_SUPPORT // */
default:
DBGPRINT(RT_DEBUG_ERROR, ("RtmpChipOpsEepromHook() failed!\n"));
break;
}
return 0;
}
| 31.23913 | 74 | 0.551844 |
946cc6638184a83d5ca11481af4c3b217ce3c48d | 1,516 | h | C | usr/libexec/backupd/MBCKCodeLongLivedOperator.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | usr/libexec/backupd/MBCKCodeLongLivedOperator.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | usr/libexec/backupd/MBCKCodeLongLivedOperator.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
#import "MBCKLongLivedOperator-Protocol.h"
@class NSString;
@interface MBCKCodeLongLivedOperator : NSObject <MBCKLongLivedOperator>
{
NSString *_serviceName; // 8 = 0x8
NSString *_functionName; // 16 = 0x10
Class _responseType; // 24 = 0x18
CDUnknownBlockType _responseCallback; // 32 = 0x20
}
- (void).cxx_destruct; // IMP=0x00000001001d80b4
@property(copy, nonatomic) CDUnknownBlockType responseCallback; // @synthesize responseCallback=_responseCallback;
@property(readonly, nonatomic) Class responseType; // @synthesize responseType=_responseType;
@property(readonly, nonatomic) NSString *functionName; // @synthesize functionName=_functionName;
@property(readonly, nonatomic) NSString *serviceName; // @synthesize serviceName=_serviceName;
- (id)longLivedOperationForRequest:(id)arg1; // IMP=0x00000001001d7f5c
- (id)operationIdentifier; // IMP=0x00000001001d7eb8
- (_Bool)reconfigureLongLivedOperation:(id)arg1; // IMP=0x00000001001d7d1c
- (id)initWithService:(id)arg1 function:(id)arg2 responseType:(Class)arg3 callback:(CDUnknownBlockType)arg4; // IMP=0x00000001001d7c04
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
| 38.871795 | 134 | 0.773747 |
946e3c28799d5e61e1c7be42943daf76573a9df4 | 257 | h | C | Hummer/Classes/Component/Image/HMImageView.h | xiaohongjun0509/hummer-ios | 33889f5ecffbf73d77846ecafee57d7043ff58b4 | [
"Apache-2.0"
] | 2 | 2020-08-05T07:47:33.000Z | 2020-10-29T11:30:38.000Z | Hummer/Classes/Component/Image/HMImageView.h | xiaohongjun0509/hummer-ios | 33889f5ecffbf73d77846ecafee57d7043ff58b4 | [
"Apache-2.0"
] | 2 | 2020-10-29T11:33:36.000Z | 2020-10-29T11:33:36.000Z | Hummer/Classes/Component/Image/HMImageView.h | xiaohongjun0509/hummer-ios | 33889f5ecffbf73d77846ecafee57d7043ff58b4 | [
"Apache-2.0"
] | 2 | 2020-08-02T13:38:47.000Z | 2020-08-19T10:30:18.000Z | //
// HMImageView.h
// Hummer
//
// Copyright © 2019年 huangjy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HMImageView : UIImageView
@property (nonatomic, copy) NSString *imageURL;
@property (nonatomic, copy) NSString *imageName;
@end
| 16.0625 | 51 | 0.708171 |
946f0cbea6852f8d79c4bbe3e6ae031e089f0345 | 4,796 | h | C | DataCollector/mozilla/xulrunner-sdk/include/GMPVideoDecoder.h | andrasigneczi/TravelOptimiser | b08805f97f0823fd28975a36db67193386aceb22 | [
"Apache-2.0"
] | 1 | 2016-04-20T08:35:44.000Z | 2016-04-20T08:35:44.000Z | DataCollector/mozilla/xulrunner-sdk/include/GMPVideoDecoder.h | andrasigneczi/TravelOptimiser | b08805f97f0823fd28975a36db67193386aceb22 | [
"Apache-2.0"
] | null | null | null | DataCollector/mozilla/xulrunner-sdk/include/GMPVideoDecoder.h | andrasigneczi/TravelOptimiser | b08805f97f0823fd28975a36db67193386aceb22 | [
"Apache-2.0"
] | null | null | null | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(GMPVideoDecoder_h_)
#define GMPVideoDecoder_h_
#include "GMPVideoDecoderProxy.h"
#include "ImageContainer.h"
#include "MediaDataDecoderProxy.h"
#include "PlatformDecoderModule.h"
#include "mozIGeckoMediaPluginService.h"
#include "MediaInfo.h"
namespace mozilla {
class VideoCallbackAdapter : public GMPVideoDecoderCallbackProxy {
public:
VideoCallbackAdapter(MediaDataDecoderCallbackProxy* aCallback,
VideoInfo aVideoInfo,
layers::ImageContainer* aImageContainer)
: mCallback(aCallback)
, mLastStreamOffset(0)
, mVideoInfo(aVideoInfo)
, mImageContainer(aImageContainer)
{}
// GMPVideoDecoderCallbackProxy
virtual void Decoded(GMPVideoi420Frame* aDecodedFrame) override;
virtual void ReceivedDecodedReferenceFrame(const uint64_t aPictureId) override;
virtual void ReceivedDecodedFrame(const uint64_t aPictureId) override;
virtual void InputDataExhausted() override;
virtual void DrainComplete() override;
virtual void ResetComplete() override;
virtual void Error(GMPErr aErr) override;
virtual void Terminated() override;
void SetLastStreamOffset(int64_t aStreamOffset) {
mLastStreamOffset = aStreamOffset;
}
private:
MediaDataDecoderCallbackProxy* mCallback;
int64_t mLastStreamOffset;
VideoInfo mVideoInfo;
nsRefPtr<layers::ImageContainer> mImageContainer;
};
class GMPVideoDecoder : public MediaDataDecoder {
protected:
GMPVideoDecoder(const VideoInfo& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aTaskQueue,
MediaDataDecoderCallbackProxy* aCallback,
VideoCallbackAdapter* aAdapter)
: mConfig(aConfig)
, mCallback(aCallback)
, mGMP(nullptr)
, mHost(nullptr)
, mAdapter(aAdapter)
, mConvertNALUnitLengths(false)
{
}
public:
GMPVideoDecoder(const VideoInfo& aConfig,
layers::LayersBackend aLayersBackend,
layers::ImageContainer* aImageContainer,
MediaTaskQueue* aTaskQueue,
MediaDataDecoderCallbackProxy* aCallback)
: mConfig(aConfig)
, mCallback(aCallback)
, mGMP(nullptr)
, mHost(nullptr)
, mAdapter(new VideoCallbackAdapter(aCallback,
VideoInfo(aConfig.mDisplay.width,
aConfig.mDisplay.height),
aImageContainer))
, mConvertNALUnitLengths(false)
{
}
virtual nsresult Init() override;
virtual nsresult Input(MediaRawData* aSample) override;
virtual nsresult Flush() override;
virtual nsresult Drain() override;
virtual nsresult Shutdown() override;
protected:
virtual void InitTags(nsTArray<nsCString>& aTags);
virtual nsCString GetNodeId();
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
private:
class GMPInitDoneRunnable : public nsRunnable
{
public:
GMPInitDoneRunnable()
: mInitDone(false),
mThread(do_GetCurrentThread())
{
}
NS_IMETHOD Run()
{
mInitDone = true;
return NS_OK;
}
void Dispatch()
{
mThread->Dispatch(this, NS_DISPATCH_NORMAL);
}
bool IsDone()
{
MOZ_ASSERT(nsCOMPtr<nsIThread>(do_GetCurrentThread()) == mThread);
return mInitDone;
}
private:
bool mInitDone;
nsCOMPtr<nsIThread> mThread;
};
void GetGMPAPI(GMPInitDoneRunnable* aInitDone);
class GMPInitDoneCallback : public GetGMPVideoDecoderCallback
{
public:
GMPInitDoneCallback(GMPVideoDecoder* aDecoder,
GMPInitDoneRunnable* aGMPInitDone)
: mDecoder(aDecoder)
, mGMPInitDone(aGMPInitDone)
{
}
virtual void Done(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost)
{
if (aGMP) {
mDecoder->GMPInitDone(aGMP, aHost);
}
mGMPInitDone->Dispatch();
}
private:
nsRefPtr<GMPVideoDecoder> mDecoder;
nsRefPtr<GMPInitDoneRunnable> mGMPInitDone;
};
void GMPInitDone(GMPVideoDecoderProxy* aGMP, GMPVideoHost* aHost);
const VideoInfo& mConfig;
MediaDataDecoderCallbackProxy* mCallback;
nsCOMPtr<mozIGeckoMediaPluginService> mMPS;
GMPVideoDecoderProxy* mGMP;
GMPVideoHost* mHost;
nsAutoPtr<VideoCallbackAdapter> mAdapter;
bool mConvertNALUnitLengths;
};
} // namespace mozilla
#endif // GMPVideoDecoder_h_
| 28.547619 | 81 | 0.69141 |
947a793b96a6db21db6f4a6627e398071a17e230 | 1,786 | c | C | src/conversions/c_ftoe.c | juliuskoskela/libft | 011737822b644f900b88ee802a3d85ef12607a75 | [
"Xnet",
"X11"
] | null | null | null | src/conversions/c_ftoe.c | juliuskoskela/libft | 011737822b644f900b88ee802a3d85ef12607a75 | [
"Xnet",
"X11"
] | null | null | null | src/conversions/c_ftoe.c | juliuskoskela/libft | 011737822b644f900b88ee802a3d85ef12607a75 | [
"Xnet",
"X11"
] | null | null | null | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* c_ftoe.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jkoskela <jkoskela@student.hive.fi> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/11/02 08:16:06 by jkoskela #+# #+# */
/* Updated: 2021/02/01 10:51:34 by jkoskela ### ########.fr */
/* */
/* ************************************************************************** */
#include "../../inc/libft.h"
static char *check_naninf(double nbr)
{
if (nbr != nbr)
return (s_dup("nan"));
if (nbr == POS_INF)
return (s_dup("inf"));
if (nbr == NEG_INF)
return (s_dup("-inf"));
return (NULL);
}
char *c_ftoe(long double nbr, size_t p)
{
char *out;
char *tmp;
long double sign;
int i;
i = 0;
sign = 1;
if ((tmp = check_naninf(nbr)))
return (tmp);
if (nbr < 0)
sign = -1;
nbr = m_fabs(nbr);
while (nbr >= 10.0)
{
nbr /= 10.0;
i++;
}
nbr = nbr * sign;
tmp = c_ftoa(nbr, p);
out = s_join_free(tmp, "e+0", 1);
tmp = s_join_free(out, c_itoa_base(i, 10), 2);
free(out);
return (tmp);
}
/*
** ----------------------------------------------------------------------------
**
** C_ftoe
**
** Convert long double `nbr` into scientific notation in ascii.
**
** ----------------------------------------------------------------------------
*/
| 28.806452 | 80 | 0.290034 |
947c0b1d91aefc3e13a54b2ab23929fb8f136a9e | 285 | h | C | source/ThirdParty/gtm-oauth2/Source/Touch/ApigeeGTMOAuth2ViewControllerTouch.h | RobertWalsh/apigee-ios-sdk | f23ca1fa4eed88de2f5c260a47cefe7f57701e06 | [
"Apache-2.0"
] | null | null | null | source/ThirdParty/gtm-oauth2/Source/Touch/ApigeeGTMOAuth2ViewControllerTouch.h | RobertWalsh/apigee-ios-sdk | f23ca1fa4eed88de2f5c260a47cefe7f57701e06 | [
"Apache-2.0"
] | null | null | null | source/ThirdParty/gtm-oauth2/Source/Touch/ApigeeGTMOAuth2ViewControllerTouch.h | RobertWalsh/apigee-ios-sdk | f23ca1fa4eed88de2f5c260a47cefe7f57701e06 | [
"Apache-2.0"
] | null | null | null | //
// ApigeeGTMOAuth2ViewControllerTouch.h
// ApigeeiOSSDK
//
// Created by Robert Walsh on 11/7/14.
// Copyright (c) 2014 Apigee. All rights reserved.
//
#import "GTMOAuth2ViewControllerTouch.h"
@interface ApigeeGTMOAuth2ViewControllerTouch : GTMOAuth2ViewControllerTouch
@end
| 20.357143 | 76 | 0.77193 |
94813ed7f2a48c0943d4b61e3fa2a4d12c2703ea | 1,596 | h | C | include/Camera.h | hkzhugc/Scan-Zbuffer | 48a9c8bb2c0c4b28c15a69a3ae50b6f0028525e6 | [
"MIT"
] | 4 | 2019-01-12T10:46:31.000Z | 2019-11-18T06:24:51.000Z | include/Camera.h | hkzhugc/Scan-Zbuffer | 48a9c8bb2c0c4b28c15a69a3ae50b6f0028525e6 | [
"MIT"
] | null | null | null | include/Camera.h | hkzhugc/Scan-Zbuffer | 48a9c8bb2c0c4b28c15a69a3ae50b6f0028525e6 | [
"MIT"
] | null | null | null | #pragma once
#include "glm/vec3.hpp"
#include "glm/mat4x4.hpp"
#include <glm/gtc/type_ptr.hpp>
class Camera
{
public:
Camera(){};
~Camera(){};
inline void set_camera(glm::vec3 position = glm::vec3(0, 0, 0), glm::vec3 view_dir = glm::vec3(0, 0, 0), glm::vec3 up = glm::vec3(0, 0, 0))
{
_position = position;
_view_dir = view_dir;
_up = up;
float mat_src[16] = {
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
-_position.x, -_position.y, -_position.z, 1
};//simple translate, no rotation
view_mat = glm::make_mat4(mat_src);
//view_mat = glm::translate(view_mat, position);
}
inline void scale(float scale_fac)
{
view_mat = glm::scale(view_mat, glm::vec3(scale_fac, scale_fac, scale_fac));
}
inline void rotate(float angle, glm::vec3 axis)
{
view_mat = glm::rotate(view_mat, angle, axis);
}
inline void translate(glm::vec3 position)
{
view_mat = glm::translate(view_mat, position);
}
inline void set_pspt_prj(float fovy, float aspect, float znear, float zfar)
{
float ymax = znear * tanf(glm::radians(fovy));
float xmax = ymax * aspect;
float temp, temp2, temp3, temp4;
temp = 2.0f * znear;
temp2 = 2.0f * xmax;
temp3 = 2.0f * ymax;
temp4 = zfar - znear;
float mat_src[16] = {
temp / temp2, 0, 0, 0,
0, temp / temp3, 0, 0,
0, 0, (-zfar - znear) / temp4, -1,
0, 0, (-temp * zfar) / temp4, 0
};
pspt_prj_mat = glm::make_mat4(mat_src);
}
glm::vec3 transform(glm::vec3 v);
glm::vec3 pspt_prj(glm::vec3 v);
private:
glm::vec3 _position;
glm::vec3 _view_dir;
glm::vec3 _up;
glm::mat4x4 view_mat;
glm::mat4x4 pspt_prj_mat;
};
| 24.9375 | 141 | 0.640351 |
9481dc13f7c25262c85ffbabee8c7fa2637bd339 | 660 | c | C | 2021-2/2021-2-uff-prog-estr/listas1-3/L2.Ex1.c | joaog314/uff-projects | 417895d5b7c6fd88e9c67c925e7c6a4abb6bb6f4 | [
"MIT"
] | null | null | null | 2021-2/2021-2-uff-prog-estr/listas1-3/L2.Ex1.c | joaog314/uff-projects | 417895d5b7c6fd88e9c67c925e7c6a4abb6bb6f4 | [
"MIT"
] | null | null | null | 2021-2/2021-2-uff-prog-estr/listas1-3/L2.Ex1.c | joaog314/uff-projects | 417895d5b7c6fd88e9c67c925e7c6a4abb6bb6f4 | [
"MIT"
] | null | null | null | #include <stdio.h>
int main() {
int primo, i;
printf("insira o numero que voce queira saber se eh primo ou nao: ");
scanf("%d", &primo);
if (primo == 1 || primo == 2){
//já tiramos 1 e 2 da jogada
printf("NUMERO PRIMO");
}
else{
for (i=2; i < primo; i++) {
//iterar de 2 até primo-1
//se for divisível por i, quebra o loop e já diz que é primo
if (primo%i==0){
printf("NUMERO NAO PRIMO");
break;
}
else if (i == primo - 1){
printf("NUMERO PRIMO");
}
}
}
} | 28.695652 | 74 | 0.430303 |
9482893df4fd46ad113fea77e0e6e8ac583e1198 | 88 | h | C | src/xml/saxparser.h | torsten-schenk/gla | 099f025936f48db9e1ad787b9d791095e8d42097 | [
"MIT"
] | null | null | null | src/xml/saxparser.h | torsten-schenk/gla | 099f025936f48db9e1ad787b9d791095e8d42097 | [
"MIT"
] | null | null | null | src/xml/saxparser.h | torsten-schenk/gla | 099f025936f48db9e1ad787b9d791095e8d42097 | [
"MIT"
] | null | null | null | #pragma once
#include "common.h"
int gla_mod_xml_saxparser_cbridge(
gla_rt_t *rt);
| 11 | 34 | 0.75 |
94849feca8640cb3cdbf44bc4bae5b6164655ab5 | 12,791 | h | C | src/canvasimpl.h | vgui/kcanvas | 3b88116ac995ff9c919d2ab0e1457a765e202d04 | [
"BSD-3-Clause"
] | 30 | 2016-06-25T12:27:58.000Z | 2022-03-06T13:23:36.000Z | src/canvasimpl.h | vgui/kcanvas | 3b88116ac995ff9c919d2ab0e1457a765e202d04 | [
"BSD-3-Clause"
] | 14 | 2015-04-29T20:29:26.000Z | 2017-09-06T18:15:48.000Z | src/canvasimpl.h | vgui/kcanvas | 3b88116ac995ff9c919d2ab0e1457a765e202d04 | [
"BSD-3-Clause"
] | 14 | 2016-04-13T02:03:27.000Z | 2022-01-21T21:06:04.000Z | /*
KCANVAS PROJECT
Common 2D graphics API abstraction with multiple back-end support
(c) livingcreative, 2015 - 2017
https://github.com/livingcreative/kcanvas
canvasimpl.h
basic API objects implementation interfaces
defines interfaces for platform independend API functionality
*/
#pragma once
#include "canvastypes.h"
#include "canvasresources.h"
#include <vector>
#include <string>
namespace k_canvas
{
namespace impl
{
/*
-------------------------------------------------------------------------------
kGradientImpl
-------------------------------------------------------------------------------
interface for kGradient implementation
*/
class kGradientImpl : public kRefcounted
{
public:
virtual void Initialize(const kGradientStop *stops, size_t count, kExtendType extend) = 0;
};
/*
-------------------------------------------------------------------------------
kPathImpl
-------------------------------------------------------------------------------
interface for kPath implementation
*/
class kPathImpl : public kRefcounted
{
public:
virtual void MoveTo(const kPoint &point) = 0;
virtual void LineTo(const kPoint &point) = 0;
virtual void BezierTo(const kPoint &p1, const kPoint &p2, const kPoint &p3) = 0;
virtual void PolyLineTo(const kPoint *points, size_t count) = 0;
virtual void PolyBezierTo(const kPoint *points, size_t count) = 0;
virtual void Text(const char *text, int count, const kFontBase *font, kTextOrigin origin) = 0;
virtual void Close() = 0;
virtual void Clear() = 0;
virtual void Commit() = 0;
virtual void FromPath(const kPathImpl *source, const kTransform &transform) = 0;
};
/*
-------------------------------------------------------------------------------
kPathImplDefault
-------------------------------------------------------------------------------
default implementation for kPathImpl interface
used for back-ends without own path object
*/
class kPathImplDefault : public kPathImpl
{
public:
kPathImplDefault();
~kPathImplDefault() override;
void MoveTo(const kPoint &p) override;
void LineTo(const kPoint &p) override;
void BezierTo(const kPoint &p1, const kPoint &p2, const kPoint &p3) override;
void PolyLineTo(const kPoint *points, size_t count) override;
void PolyBezierTo(const kPoint *points, size_t count) override;
void Text(const char *text, int count, const kFontBase *font, kTextOrigin origin) override;
void Close() override;
void Clear() override;
void Commit() override;
protected:
enum CommandType
{
PC_MOVETO,
PC_LINETO,
PC_BEZIERTO,
PC_POLYLINETO,
PC_POLYBEZIERTO,
PC_TEXT,
PC_CLOSE
};
struct Command
{
Command();
Command(CommandType _command, int _start_index = -1, size_t _element_count = 0, kResourceObject *_font = nullptr);
~Command();
Command& operator=(const Command &source);
CommandType command;
int start_index;
size_t element_count;
kResourceObject *font;
};
void AddCommand(CommandType command, size_t point_count);
void AddCommand(const char *text, const kFontBase *font);
void AddPoint(const kPoint &point);
protected:
std::vector<Command> p_commands;
size_t p_curr_command;
std::vector<kPoint> p_points;
size_t p_curr_point;
std::vector<std::string> p_text;
size_t p_curr_text;
};
/*
-------------------------------------------------------------------------------
kBitmapImpl
-------------------------------------------------------------------------------
interface for kBitmap implementation
*/
class kBitmapImpl : public kRefcounted
{
public:
virtual void Initialize(size_t width, size_t height, kBitmapFormat format) = 0;
virtual void Update(const kRectInt *updaterect, kBitmapFormat sourceformat, size_t sourceputch, const void *data) = 0;
};
/*
-------------------------------------------------------------------------------
kCanvasImpl
-------------------------------------------------------------------------------
interface for kCanvas implementation
*/
class kCanvasImpl
{
public:
virtual ~kCanvasImpl();
virtual bool BindToBitmap(const kBitmapImpl *target, const kRectInt *rect) = 0;
virtual bool BindToContext(kContext context, const kRectInt *rect) = 0;
virtual bool BindToPrinter(kPrinter printer) = 0;
virtual bool Unbind() = 0;
virtual void Line(const kPoint &a, const kPoint &b, const kPenBase *pen) = 0;
virtual void Bezier(const kPoint &p1, const kPoint &p2, const kPoint &p3, const kPoint &p4, const kPenBase *pen) = 0;
virtual void PolyLine(const kPoint *points, size_t count, const kPenBase *pen) = 0;
virtual void PolyBezier(const kPoint *points, size_t count, const kPenBase *pen) = 0;
virtual void Rectangle(const kRect &rect, const kPenBase *pen, const kBrushBase *brush) = 0;
virtual void RoundedRectangle(const kRect &rect, const kSize &round, const kPenBase *pen, const kBrushBase *brush) = 0;
virtual void Ellipse(const kRect &rect, const kPenBase *pen, const kBrushBase *brush) = 0;
virtual void Polygon(const kPoint *points, size_t count, const kPenBase *pen, const kBrushBase *brush) = 0;
virtual void PolygonBezier(const kPoint *points, size_t count, const kPenBase *pen, const kBrushBase *brush) = 0;
virtual void DrawPath(const kPathImpl *path, const kPenBase *pen, const kBrushBase *brush) = 0;
virtual void DrawPath(const kPathImpl *path, const kPenBase *pen, const kBrushBase *brush, const kTransform &transform) = 0;
virtual void DrawBitmap(const kBitmapImpl *bitmap, const kPoint &origin, const kSize &destsize, const kPoint &source, const kSize &sourcesize, kScalar sourcealpha) = 0;
virtual void DrawMask(const kBitmapImpl *mask, kBrushBase *brush, const kPoint &origin, const kSize &destsize, const kPoint &source, const kSize &sourcesize) = 0;
virtual void GetFontMetrics(const kFontBase *font, kFontMetrics &metrics) = 0;
virtual void GetGlyphMetrics(const kFontBase *font, size_t first, size_t last, kGlyphMetrics *metrics) = 0;
virtual kSize TextSize(const char *text, size_t count, const kFontBase *font) = 0;
virtual void Text(const kPoint &p, const char *text, size_t count, const kFontBase *font, const kBrushBase *brush, kTextOrigin origin) = 0;
virtual void BeginClippedDrawingByMask(const kBitmapImpl *mask, const kTransform &transform, kExtendType xextend, kExtendType yextend) = 0;
virtual void BeginClippedDrawingByPath(const kPathImpl *clip, const kTransform &transform) = 0;
virtual void BeginClippedDrawingByRect(const kRect &clip) = 0;
virtual void EndClippedDrawing() = 0;
virtual void SetTransform(const kTransform &transform) = 0;
protected:
// access to resource data
template <typename T, typename R>
static inline const T& resourceData(const R *resource)
{
return resource->data();
}
// access to resource native pointers
template <typename T>
static inline void** native(const T *resource)
{
return resource->native();
}
};
/*
-------------------------------------------------------------------------------
CanvasFactory
-------------------------------------------------------------------------------
abstract implementation factory
*/
class CanvasFactory
{
public:
static void setImpl(Impl impl);
static Impl getImpl();
static kGradientImpl* CreateGradient();
static kPathImpl* CreatePath();
static kBitmapImpl* CreateBitmap();
static kCanvasImpl* CreateCanvas();
template <typename T>
static kResourceObject* GetResource(const T &data)
{
return getFactory()->getResource(data);
}
static void destroyFactory();
protected:
virtual bool initialized() = 0;
virtual kGradientImpl* CreateGradientImpl() = 0;
virtual kPathImpl* CreatePathImpl() = 0;
virtual kBitmapImpl* CreateBitmapImpl() = 0;
virtual kCanvasImpl* CreateCanvasImpl() = 0;
virtual kResourceObject* getResource(const StrokeData &data) = 0;
virtual kResourceObject* getResource(const PenData &data) = 0;
virtual kResourceObject* getResource(const BrushData &data) = 0;
virtual kResourceObject* getResource(const FontData &data) = 0;
virtual void destroyResources() = 0;
protected:
CanvasFactory();
virtual ~CanvasFactory();
static CanvasFactory* getFactory();
private:
static CanvasFactory *factory;
static Impl current_impl;
};
/*
-------------------------------------------------------------------------------
CanvasFactoryImpl
-------------------------------------------------------------------------------
factory implementation template
*/
#define FACTORY_RESOURCE_MANAGER(name, allocator, res) \
public:\
kResourceObject* getResource(const name##Data &data) override\
{\
return allocator::createResource(data);\
}\
private:\
template <
typename Tgradientimpl,
typename Tpathimpl,
typename Tbitmapimpl,
typename Tcanvasimpl,
typename Tstrokeallocator,
typename Tpenallocator,
typename Tbrushallocator,
typename Tfontallocator,
typename Tstroke,
typename Tpen,
typename Tbrush,
typename Tfont
>
class CanvasFactoryImpl : public CanvasFactory {
protected:
kGradientImpl* CreateGradientImpl() override { return new Tgradientimpl(); }
kPathImpl* CreatePathImpl() override { return new Tpathimpl(); }
kBitmapImpl* CreateBitmapImpl() override { return new Tbitmapimpl(); }
kCanvasImpl* CreateCanvasImpl() override { return new Tcanvasimpl(this); }
void destroyResources() override
{
// TODO: implement resource management
}
FACTORY_RESOURCE_MANAGER(Stroke, Tstrokeallocator, Tstroke)
FACTORY_RESOURCE_MANAGER(Pen, Tpenallocator, Tpen)
FACTORY_RESOURCE_MANAGER(Brush, Tbrushallocator, Tbrush)
FACTORY_RESOURCE_MANAGER(Font, Tfontallocator, Tfont)
};
#undef FACTORY_RESOURCE_MANAGER
typedef CanvasFactory* (*CanvasFactoryCreateProc)();
struct CanvasImplDesc
{
CanvasImplDesc(Impl impl_, CanvasFactoryCreateProc proc_) :
implementation(impl_),
createproc(proc_)
{}
Impl implementation;
CanvasFactoryCreateProc createproc;
};
extern const CanvasImplDesc factory_descriptors[];
#define FACTORY_DESCRIPTORS_BEGIN() const CanvasImplDesc factory_descriptors[] = {
#define FACTORY_DESCRIPTOR(impl_, proc_) CanvasImplDesc(impl_, proc_),
#define FACTORY_DESCRIPTORS_END() CanvasImplDesc(IMPL_NONE, nullptr) };
} // namespace impl
} // namespace k_canvas
| 39.236196 | 180 | 0.537253 |
948572129384b3c2549e54dc6c43b39726355ad5 | 1,162 | c | C | src/mx_cmnd_cd.c | yohrudkov/Ush | f9723519397b6b770bc35d0eaace9bef427e9a2c | [
"MIT"
] | null | null | null | src/mx_cmnd_cd.c | yohrudkov/Ush | f9723519397b6b770bc35d0eaace9bef427e9a2c | [
"MIT"
] | null | null | null | src/mx_cmnd_cd.c | yohrudkov/Ush | f9723519397b6b770bc35d0eaace9bef427e9a2c | [
"MIT"
] | null | null | null | #include "../inc/header.h"
bool check_char(char c) {
if (c == 'P'
|| c == 's'
|| c == '-') {
return true;
}
return false;
}
int mx_flagscd(char *str) {
for (char *s = str; *s; s++) {
if (!check_char(*s)) {
return mx_error_return("cd: illegal flags\n", -1);
}
}
if (mx_get_char_index(str, 's') >= 0) {
return 0;
}
if (mx_get_char_index(str, 'P') >= 0) {
return 1;
}
return 2;
}
int mx_cmnd_cd(t_built *u) {
int i = mx_len_of_array(u->commands);
if (i > 3 || (u->commands[1] && u->commands[1][0] != '-' && i == 3)) {
mx_printerr("u$h: cd: too many arguments\n");
return 1;
}
if (u->commands[1] && u->commands[1][0] == '-')
return mx_cmnd_cd_flags(u);
else {
if (!u->commands[1])
return mx_cmnd_do_cd(u, mx_correct_ctlg(u, u->home_catalog));
else
return mx_cmnd_do_cd(u, mx_correct_ctlg(u, u->commands[1]));
}
}
int mx_cd(char **argv, t_ost *tost) {
int result = 0;
tost->built->commands = argv;
result = mx_cmnd_cd(tost->built);
return result;
}
| 22.784314 | 74 | 0.503442 |
948652d95530555c4c487c4a30710795e71d6588 | 768 | h | C | Sources/Geometrics/Builders/TransformBase.h | IvanPleshkov/RedLiliumEngine | 5e7c14d9c750db8054bde53b772e30e3682c2f1d | [
"Apache-2.0"
] | null | null | null | Sources/Geometrics/Builders/TransformBase.h | IvanPleshkov/RedLiliumEngine | 5e7c14d9c750db8054bde53b772e30e3682c2f1d | [
"Apache-2.0"
] | 1 | 2019-02-09T09:53:01.000Z | 2019-02-09T09:53:01.000Z | Sources/Geometrics/Builders/TransformBase.h | IvanPleshkov/RedLiliumEngine | 5e7c14d9c750db8054bde53b772e30e3682c2f1d | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <Render/RenderCommon.h>
#include "BuilderBase.h"
namespace RED_LILIUM_NAMESPACE
{
namespace Geometrics
{
template <class T>
class TransformBase : public BuilderBase<T>
{
public:
TransformBase(Context& context)
: BuilderBase(context)
{}
T& position(const vec3& position)
{
RED_LILIUM_NOT_IMPLEMENTED();
return getThis();
}
T& scale(const vec3& scale)
{
RED_LILIUM_NOT_IMPLEMENTED();
return getThis();
}
T& rotation(const quat& rotation)
{
RED_LILIUM_NOT_IMPLEMENTED();
return getThis();
}
T& transform(const mat4& transform)
{
RED_LILIUM_NOT_IMPLEMENTED();
return getThis();
}
protected:
vec3 m_position;
vec3 m_scale;
quat m_rotation;
};
} // namespace Geometrics
} // namespace RED_LILIUM_NAMESPACE
| 14.490566 | 43 | 0.723958 |
948a6e087136e989d851c543fa509a6a0e04c9a1 | 467 | h | C | mainapp/Classes/Common/Basic/NodeScopeGuard.h | JaagaLabs/GLEXP-Team-KitkitSchool | f94ea3e53bd05fdeb2a9edcc574bc054e575ecc0 | [
"Apache-2.0"
] | 45 | 2019-05-16T20:49:31.000Z | 2021-11-05T21:40:54.000Z | mainapp/Classes/Common/Basic/NodeScopeGuard.h | rdsmarketing/GLEXP-Team-KitkitSchool | 6ed6b76d17fd7560abc35dcdf7cf4a44ce70745e | [
"Apache-2.0"
] | 123 | 2019-05-28T14:03:04.000Z | 2019-07-12T04:23:26.000Z | pehlaschool/Classes/Common/Basic/NodeScopeGuard.h | maqsoftware/Pehla-School-Hindi | 61aeae0f1d91952b44eaeaff5d2f6ec1d5aa3c43 | [
"Apache-2.0"
] | 29 | 2019-05-16T17:49:26.000Z | 2021-12-30T16:36:24.000Z | //
// NodeScopeGuard.h -- Temporarily increase the reference count in the scope
// TodoSchool on Sep 16, 2016
//
// Copyright (c) 2016 Enuma, Inc. All rights reserved.
// See LICENSE.md for more details.
//
#pragma once
#include "ScopeGuard.h"
#include <cocos/2d/CCNode.h>
class NodeScopeGuard {
// NB(xenosoz, 2016): Weak reference to the node
cocos2d::Node* TheNode;
ScopeGuard TheScopeGuard;
public:
NodeScopeGuard(cocos2d::Node* N);
};
| 18.68 | 77 | 0.691649 |
948b1b238a6286e62f75655c4af60ff70de38247 | 5,125 | h | C | System/Library/PrivateFrameworks/GeoServices.framework/GEOTraceRouteSimulator.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 11 | 2019-11-06T04:48:48.000Z | 2022-02-09T17:48:15.000Z | System/Library/PrivateFrameworks/GeoServices.framework/GEOTraceRouteSimulator.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 1 | 2020-04-16T01:41:56.000Z | 2020-04-16T04:32:00.000Z | System/Library/PrivateFrameworks/GeoServices.framework/GEOTraceRouteSimulator.h | lechium/tvOS130Headers | 6b47cdcd4a6f453b399aa9d742b5d0f7e3f732fd | [
"MIT"
] | 3 | 2019-12-22T20:17:53.000Z | 2021-01-25T09:47:49.000Z | /*
* This header is generated by classdump-dyld 1.0
* on Tuesday, November 5, 2019 at 2:41:11 AM Mountain Standard Time
* Operating System: Version 13.0 (Build 17J586)
* Image Source: /System/Library/PrivateFrameworks/GeoServices.framework/GeoServices
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos.
*/
#import <GeoServices/GeoServices-Structs.h>
@class NSDate, GEOComposedRoute, GEODirectionsRequest, GEODirectionsResponse, GEORouteAttributes, NSMutableArray, NSArray, NSDictionary;
@interface GEOTraceRouteSimulator : NSObject {
double _deltaT;
double _horizontalAccuracy;
double _verticalAccuracy;
NSDate* _startTime;
GEOComposedRoute* _route;
GEODirectionsRequest* _request;
GEODirectionsResponse* _response;
GEORouteAttributes* _routeAttributes;
unsigned _routeIndex;
SCD_Struct_GE33 _walkingStart;
SCD_Struct_GE33 _walkingEnd;
SCD_Struct_GE33 _origin;
SCD_Struct_GE33 _destination;
NSMutableArray* _mutableLocations;
NSArray* _locations;
NSDictionary* _pointTimestamps;
double _duration;
}
@property (nonatomic,readonly) GEOComposedRoute * route; //@synthesize route=_route - In the implementation block
@property (nonatomic,readonly) GEODirectionsRequest * request; //@synthesize request=_request - In the implementation block
@property (nonatomic,readonly) GEODirectionsResponse * response; //@synthesize response=_response - In the implementation block
@property (nonatomic,readonly) GEORouteAttributes * routeAttributes; //@synthesize routeAttributes=_routeAttributes - In the implementation block
@property (nonatomic,readonly) unsigned routeIndex; //@synthesize routeIndex=_routeIndex - In the implementation block
@property (assign,nonatomic) SCD_Struct_GE33 origin; //@synthesize origin=_origin - In the implementation block
@property (assign,nonatomic) SCD_Struct_GE33 destination; //@synthesize destination=_destination - In the implementation block
@property (nonatomic,retain) NSMutableArray * mutableLocations; //@synthesize mutableLocations=_mutableLocations - In the implementation block
@property (nonatomic,retain) NSArray * locations; //@synthesize locations=_locations - In the implementation block
@property (assign,nonatomic) double duration; //@synthesize duration=_duration - In the implementation block
@property (assign,nonatomic) double deltaT; //@synthesize deltaT=_deltaT - In the implementation block
@property (assign,nonatomic) double horizontalAccuracy; //@synthesize horizontalAccuracy=_horizontalAccuracy - In the implementation block
@property (assign,nonatomic) double verticalAccuracy; //@synthesize verticalAccuracy=_verticalAccuracy - In the implementation block
@property (nonatomic,retain) NSDate * startTime; //@synthesize startTime=_startTime - In the implementation block
@property (assign,nonatomic) SCD_Struct_GE33 walkingStart; //@synthesize walkingStart=_walkingStart - In the implementation block
@property (assign,nonatomic) SCD_Struct_GE33 walkingEnd; //@synthesize walkingEnd=_walkingEnd - In the implementation block
@property (nonatomic,readonly) NSDictionary * pointTimestamps; //@synthesize pointTimestamps=_pointTimestamps - In the implementation block
-(GEODirectionsRequest *)request;
-(NSDate *)startTime;
-(GEODirectionsResponse *)response;
-(void)setStartTime:(NSDate *)arg1 ;
-(double)duration;
-(void)setDestination:(SCD_Struct_GE33)arg1 ;
-(SCD_Struct_GE33)destination;
-(void)setDuration:(double)arg1 ;
-(void)setHorizontalAccuracy:(double)arg1 ;
-(double)horizontalAccuracy;
-(NSArray *)locations;
-(void)setLocations:(NSArray *)arg1 ;
-(SCD_Struct_GE33)origin;
-(void)setOrigin:(SCD_Struct_GE33)arg1 ;
-(void)setVerticalAccuracy:(double)arg1 ;
-(double)verticalAccuracy;
-(unsigned)routeIndex;
-(GEORouteAttributes *)routeAttributes;
-(GEOComposedRoute *)route;
-(id)initWithRoute:(id)arg1 request:(id)arg2 response:(id)arg3 routeAttributes:(id)arg4 routeIndex:(unsigned)arg5 ;
-(NSMutableArray *)mutableLocations;
-(SCD_Struct_GE33)walkingStart;
-(SCD_Struct_GE33)walkingEnd;
-(double)deltaT;
-(void)addLocation:(SCD_Struct_GE33)arg1 withCourse:(double)arg2 altitude:(double)arg3 speed:(double)arg4 transport:(int)arg5 ;
-(void)generateLocationsWithSpeedOverride:(double)arg1 ;
-(double)estimateDuration;
-(void)simulateWalkingFrom:(SCD_Struct_GE33)arg1 to:(SCD_Struct_GE33)arg2 ;
-(id)initWithRoute:(id)arg1 request:(id)arg2 response:(id)arg3 routeAttributes:(id)arg4 routeIndex:(unsigned)arg5 locations:(id)arg6 ;
-(void)generateLocations;
-(void)setDeltaT:(double)arg1 ;
-(void)setWalkingStart:(SCD_Struct_GE33)arg1 ;
-(void)setWalkingEnd:(SCD_Struct_GE33)arg1 ;
-(void)setMutableLocations:(NSMutableArray *)arg1 ;
-(NSDictionary *)pointTimestamps;
@end
| 57.58427 | 164 | 0.742049 |
948c2a12117bd89569a0b0476e2168b6a3231d44 | 2,834 | h | C | src/java.desktop/share/native/common/java2d/opengl/OGLPaints.h | siweilxy/openjdkstudy | 8597674ec1d6809faf55cbee1f45f4e9149d670d | [
"Apache-2.0"
] | 2 | 2018-06-19T05:43:32.000Z | 2018-06-23T10:04:56.000Z | src/java.desktop/share/native/common/java2d/opengl/OGLPaints.h | siweilxy/openjdkstudy | 8597674ec1d6809faf55cbee1f45f4e9149d670d | [
"Apache-2.0"
] | 1 | 2020-12-26T04:57:19.000Z | 2020-12-26T04:57:19.000Z | src/java.desktop/share/native/common/java2d/opengl/OGLPaints.h | siweilxy/openjdkstudy | 8597674ec1d6809faf55cbee1f45f4e9149d670d | [
"Apache-2.0"
] | 1 | 2021-12-06T01:13:18.000Z | 2021-12-06T01:13:18.000Z | /*
* Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code 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
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
*/
#ifndef OGLPaints_h_Included
#define OGLPaints_h_Included
#include "OGLContext.h"
void OGLPaints_ResetPaint(OGLContext *oglc);
void OGLPaints_SetColor(OGLContext *oglc, jint pixel);
void OGLPaints_SetGradientPaint(OGLContext *oglc,
jboolean useMask, jboolean cyclic,
jdouble p0, jdouble p1, jdouble p3,
jint pixel1, jint pixel2);
void OGLPaints_SetLinearGradientPaint(OGLContext *oglc, OGLSDOps *dstOps,
jboolean useMask, jboolean linear,
jint cycleMethod, jint numStops,
jfloat p0, jfloat p1, jfloat p3,
void *fractions, void *pixels);
void OGLPaints_SetRadialGradientPaint(OGLContext *oglc, OGLSDOps *dstOps,
jboolean useMask, jboolean linear,
jint cycleMethod, jint numStops,
jfloat m00, jfloat m01, jfloat m02,
jfloat m10, jfloat m11, jfloat m12,
jfloat focusX,
void *fractions, void *pixels);
void OGLPaints_SetTexturePaint(OGLContext *oglc,
jboolean useMask,
jlong pSrcOps, jboolean filter,
jdouble xp0, jdouble xp1, jdouble xp3,
jdouble yp0, jdouble yp1, jdouble yp3);
#endif /* OGLPaints_h_Included */
| 44.28125 | 76 | 0.609739 |
948d8c89477a25dd24f8edca374701b42c8de5e4 | 1,005 | h | C | paddle/phi/kernels/selected_rows/isfinite_kernel.h | Li-fAngyU/Paddle | e548f65f96697830035a28f9070b40829408ccdb | [
"Apache-2.0"
] | 11 | 2016-08-29T07:43:26.000Z | 2016-08-29T07:51:24.000Z | paddle/phi/kernels/selected_rows/isfinite_kernel.h | Li-fAngyU/Paddle | e548f65f96697830035a28f9070b40829408ccdb | [
"Apache-2.0"
] | 1 | 2022-01-28T07:23:22.000Z | 2022-01-28T07:23:22.000Z | paddle/phi/kernels/selected_rows/isfinite_kernel.h | Li-fAngyU/Paddle | e548f65f96697830035a28f9070b40829408ccdb | [
"Apache-2.0"
] | 1 | 2021-09-24T11:23:36.000Z | 2021-09-24T11:23:36.000Z | /* Copyright (c) 2021 PaddlePaddle 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. */
#pragma once
#include "paddle/phi/core/selected_rows.h"
namespace phi {
#define DEFINE_ISFINITE_SR(isfinite_sr) \
template <typename T, typename Context> \
void isfinite_sr( \
const Context& ctx, const SelectedRows& x, SelectedRows* out);
DEFINE_ISFINITE_SR(IsinfSR)
DEFINE_ISFINITE_SR(IsnanSR)
DEFINE_ISFINITE_SR(IsfiniteSR)
#undef DEFINE_ISFINITE_SR
} // namespace phi
| 31.40625 | 72 | 0.761194 |
9491e6a79ceb6ed3196ceebae83f8e802d07f5e0 | 3,230 | h | C | trial/fs.h | louis-tru/Ngui | c1f25d8b6c42e873d5969fb588af22f428c58d4c | [
"BSD-3-Clause-Clear"
] | 86 | 2017-11-21T01:05:30.000Z | 2020-05-21T12:30:31.000Z | trial/fs.h | louis-tru/Ngui | c1f25d8b6c42e873d5969fb588af22f428c58d4c | [
"BSD-3-Clause-Clear"
] | 14 | 2020-10-16T11:30:57.000Z | 2021-04-16T06:10:06.000Z | trial/fs.h | louis-tru/Ngui | c1f25d8b6c42e873d5969fb588af22f428c58d4c | [
"BSD-3-Clause-Clear"
] | 13 | 2017-11-21T10:18:53.000Z | 2019-10-18T09:15:55.000Z | /* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2015, xuewen.chu
* 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 xuewen.chu 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 xuewen.chu 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.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __ftr__trial__fs__
#define __ftr__trial__fs__
#include "ftr/util/fs.h"
/**
* @ns ftr
*/
FX_NS(ftr)
/**
* @class FileSearch # Resources files search
*/
class FX_EXPORT FileSearch: public Object {
FX_HIDDEN_ALL_COPY(FileSearch);
public:
FileSearch();
/**
* @destructor
*/
virtual ~FileSearch();
/**
* 添加一个搜索路径,路径必需存在
*/
void add_search_path(cString& path);
/**
* @func add_zip_search_path() 添加一个zip包内的搜索路径,只能添加没加密的zip包
*/
void add_zip_search_path(cString& zip_path, cString& path);
/**
* @func get_search_paths() Gets the array of search paths.
*/
Array<String> get_search_paths() const;
/**
* @func remove_search_path() remove search path
*/
void remove_search_path(cString& path);
/**
* @func remove_all_search_path() Removes all search paths.
*/
void remove_all_search_path();
/**
*
* To obtain the absolute path to the file already exists.
* If no such file returns the empty string ""
* If it is a zip package path, will return with the prefix "zip:///home/xxx/test.apk?/assets/bb.jpg"
* @func get_absolute_path
*/
String get_absolute_path(cString& path) const;
/**
* @func exists # Find the file exists
*/
bool exists(cString& path) const;
/**
* @func read_file Read the all file data and return Data
*/
Buffer read(cString& path) const;
/**
* @func share # Gets the instance of FileSearch.
*/
static FileSearch* shared();
private:
class SearchPath;
class ZipInSearchPath;
List<SearchPath*> m_search_paths; // Search path list
};
FX_END
#endif | 28.839286 | 102 | 0.713622 |
94933fd64388c00d002cd541b6ab3561dc85c62f | 2,172 | h | C | include/network/CConnection.h | lirizhong/easygo | cd3a3656d94da0f915c67e871b85d40c9bc4aac0 | [
"Apache-2.0"
] | 1 | 2018-07-21T15:51:55.000Z | 2018-07-21T15:51:55.000Z | include/network/CConnection.h | lirizhong/easygo | cd3a3656d94da0f915c67e871b85d40c9bc4aac0 | [
"Apache-2.0"
] | null | null | null | include/network/CConnection.h | lirizhong/easygo | cd3a3656d94da0f915c67e871b85d40c9bc4aac0 | [
"Apache-2.0"
] | null | null | null | #ifndef EASYGO_NETWORK_CCONNECTION_H
#define EASYGO_NETWORK_CCONNECTION_H
#include <mutex>
#include <vector>
#include <queue>
#include <deque>
#include "../include/network/NetType.h"
#include "../include/base/CCounter.h"
#include "../include/thread/CThread.h"
#include "../include/network/CSocket.h"
#include "../include/network/CNetBuffer.h"
#include "../include/declexport.h"
#include "../include/base/CBase.h"
#ifndef EASYGO_NETWORK_DECL
# ifdef EASYGO_DYNAMIC_LINK
# if defined(EXPORT_NETWORK)
# define EASYGO_NETWORK_DECL EASYGO_DECL_EXPORT
# else
# define EASYGO_NETWORK_DECL EASYGO_DECL_IMPORT
# endif
# else
# define EASYGO_NETWORK_DECL
# endif
#endif
#define MAX_RW_SIZE 1024
#define MAX_CACHE_SIZE 4096
namespace easygo {
namespace network {
class CConnector;
typedef easygo::base::CBase<CConnector> PCConnector;
class CNetBase;
typedef easygo::base::CBase<CNetBase> PCNetBase;
class CListener;
typedef easygo::base::CBase<CListener> PCListener;
class CNetBuffer;
typedef easygo::base::CBase<CNetBuffer> PCNetBuffer;
}
}
namespace easygo {
namespace network {
class EASYGO_NETWORK_DECL CConnection : public CSocket
{
public:
CConnection(PCNetBase netBase);
virtual ~CConnection();
public:
bool Write(const char* buf, int len);
bool Post(int len);
void SetAutoPost(bool autoPost);
bool GetAutoPost();
void SetMaxCacheSize(unsigned int maxCacheSize = MAX_CACHE_SIZE);
unsigned int GetMaxCacheSize();
std::string GetUUID() const;
public:
virtual void OnConnectComplete() = 0;
virtual void OnReadComplete(const char* buf, int len) = 0;
virtual void OnWriteComplete(int len) = 0;
virtual void OnCloseComplete() = 0;
private:
virtual void OnConnect();
virtual void OnRead();
virtual void OnWrite();
virtual void OnClose();
private:
std::string m_uuid;
bool m_autoPost;
unsigned int m_maxCacheSize;
PCNetBuffer m_recvBuffer;
std::queue<PCNetBuffer> m_sendBufferQueue;
std::recursive_mutex m_sendQueueMutex;
std::recursive_mutex m_recvBufferMutex;
};
} // namespace network
} // namespace easygo
#endif // EASYGO_NETWORK_CCONNECTION_H
| 25.255814 | 68 | 0.741252 |
94947a1650636caddde668ffb701f83d27a1f4af | 1,259 | h | C | Markov/Markov.h | TexAgg/MarkovTextGenerator | ed1b260da8cd6a015a422a332102c34226de52ba | [
"MIT"
] | 3 | 2016-08-20T02:10:57.000Z | 2019-02-04T21:12:47.000Z | Markov/Markov.h | TexAgg/MarkovTextGenerator | ed1b260da8cd6a015a422a332102c34226de52ba | [
"MIT"
] | null | null | null | Markov/Markov.h | TexAgg/MarkovTextGenerator | ed1b260da8cd6a015a422a332102c34226de52ba | [
"MIT"
] | null | null | null | #ifndef MARKOV_H
#define MARKOV_H
#include <vector>
#include <string>
#include <map>
#include "Utility.h"
namespace markov
{
class Markov
{
private:
/** Number of words to use as current state. */
int order;
/** A vector of all the input texts. */
std::vector<std::string> input_texts;
/**
* A map of strings to a vector of strings.
* Also, the frequency table.
*/
std::map<std::string, std::vector<std::string>> chain;
/** Maximum number of words generated, to prevent infinite loops. */
int limit;
// All of the possible strings to start the generated text with.
std::vector<std::string> start_points;
public:
/**
* Constructor for Markov object.
*
* @param string input The string to use as an
* initial state.
* @param int ord The order of the Markov Chain.
* Defaults to 1.
*/
Markov(std::string input = " ", int ord = 1);
~Markov();
/** Add an additional text to analyze. */
void add_input(std::string input);
/**
* Create output roughly lim words long.
* For some reason it isn't exact,
* which needs to be fixed.
*
* @param int lim The length of the output.
*/
std::string generate(int lim);
/** Create output. */
std::string generate();
}; // !Markov class
} // !Namespace markov
#endif // !MARKOV_H | 20.639344 | 69 | 0.669579 |
94979cb16ef74b090001e76770b48cf6dc8d171b | 1,658 | h | C | sources/thelib/include/streaming/hls/fileaacsegment.h | rdkcmf/rdkc-rms | 65ab1efcee9e3de46a888c125f591cd48b815601 | [
"Apache-2.0"
] | 3 | 2020-07-30T19:41:00.000Z | 2020-10-28T12:52:37.000Z | sources/thelib/include/streaming/hls/fileaacsegment.h | rdkcmf/rdkc-rms | 65ab1efcee9e3de46a888c125f591cd48b815601 | [
"Apache-2.0"
] | null | null | null | sources/thelib/include/streaming/hls/fileaacsegment.h | rdkcmf/rdkc-rms | 65ab1efcee9e3de46a888c125f591cd48b815601 | [
"Apache-2.0"
] | 2 | 2020-05-11T03:19:00.000Z | 2021-07-07T17:40:47.000Z | /**
##########################################################################
# If not stated otherwise in this file or this component's LICENSE
# file the following copyright and licenses apply:
#
# Copyright 2019 RDK Management
#
# 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.
##########################################################################
**/
#ifdef HAS_PROTOCOL_HLS
#ifndef _FILEAACSEGMENT_H
#define _FILEAACSEGMENT_H
#include "common.h"
#include "streaming/hls/filesegment.h"
#include "streaming/hls/baseaacsegment.h"
class DLLEXP FileAACSegment
: public BaseAACSegment, public FileSegment {
public:
FileAACSegment(IOBuffer &audioBuffer, string const& drmType);
virtual ~FileAACSegment();
bool WritePacket(uint8_t *pBuffer, uint32_t size);
bool FlushPacket();
bool CreateKey(unsigned char * pKey, unsigned char * pIV);
bool PushAudioData(IOBuffer &buffer, int64_t pts, int64_t dts);
bool PushVideoData(IOBuffer &buffer, int64_t pts, int64_t dts);
bool Init(Variant &settings, StreamCapabilities *pCapabilities,
unsigned char *pKey = NULL, unsigned char *pIV = NULL);
};
#endif /* _FILEAACSEGMENT_H */
#endif /* HAS_PROTOCOL_HLS */
| 36.043478 | 74 | 0.699638 |
9498f4c3fcf051d8da5282a858ec64ae3d119168 | 3,162 | c | C | target_fn.c | ewust/speculake | dff8da69c765cb5f30288eee93cb8f740539df8d | [
"MIT"
] | 15 | 2019-02-26T03:19:21.000Z | 2020-12-12T05:29:15.000Z | target_fn.c | ewust/speculake | dff8da69c765cb5f30288eee93cb8f740539df8d | [
"MIT"
] | null | null | null | target_fn.c | ewust/speculake | dff8da69c765cb5f30288eee93cb8f740539df8d | [
"MIT"
] | 4 | 2019-03-01T20:53:31.000Z | 2019-08-31T09:54:12.000Z | #include <unistd.h>
#include <stdint.h>
extern uint8_t *probe_buf;
extern uint64_t cur_probe_space;
extern uint64_t signal_idx;
uint64_t try_decrypt(void);
__uint128_t aes_ctr(uint64_t ctr);
extern uint8_t *turing_tape;
extern uint8_t turing_state;
// This will be an int 0-255 typically...
inline void signal(uint64_t state) __attribute__((always_inline));
void signal(uint64_t state)
{
asm volatile ("mov (%%rcx), %%rax" :: "c"(&probe_buf[state*cur_probe_space]) : "rax");
}
void signal32(uint32_t state)
{
uint32_t a, b, c, d;
a = state & 0xFF;
b = state>>8 & 0xFF | 0x100;
c = state>>16 & 0xFF| 0x200;
d = state>>24 & 0xFF| 0x300;
asm volatile (
"mov (%0), %%rax\n"
"mov (%1), %%rbx\n"
"mov (%2), %%rcx\n"
"mov (%3), %%rdx\n"
:: "r"(&probe_buf[a*cur_probe_space]),
"r"(&probe_buf[b*cur_probe_space]),
"r"(&probe_buf[c*cur_probe_space]),
"r"(&probe_buf[d*cur_probe_space]) : "rax", "rbx", "rcx", "rdx");
}
void signal40(uint64_t state)
{
uint32_t a, b, c, d, e, f, g, h;
a = state & 0x1F;
b = state>>0x05 & 0x1F | 0x20;
c = state>>0x0A & 0x1F | 0x40;
d = state>>0x0F & 0x1F | 0x60;
e = state>>0x14 & 0x1F | 0x80;
f = state>>0x19 & 0x1F | 0xA0;
g = state>>0x1E & 0x1F | 0xC0;
h = state>>0x23 & 0x1F | 0xE0;
asm volatile (
"mov (%0), %%rax\n"
"mov (%1), %%rbx\n"
"mov (%2), %%rcx\n"
"mov (%3), %%rdx\n"
"mov (%4), %%rsi\n"
"mov (%5), %%rdi\n"
"mov (%6), %%r8\n"
"mov (%7), %%r9\n"
:: "r"(&probe_buf[a*cur_probe_space]),
"r"(&probe_buf[b*cur_probe_space]),
"r"(&probe_buf[c*cur_probe_space]),
"r"(&probe_buf[d*cur_probe_space]),
"r"(&probe_buf[e*cur_probe_space]),
"r"(&probe_buf[f*cur_probe_space]),
"r"(&probe_buf[g*cur_probe_space]),
"r"(&probe_buf[h*cur_probe_space])
: "rax", "rbx", "rcx", "rdx");
}
void target_fn(void) __attribute__((section(".targetfn")));
void target_fn(void)
{
// register uint8_t *pb = (uint8_t*)*((uint8_t**)0x480000); // probe_buf
// register uint64_t cps = *((uint64_t*)0x480010); // cur_probe_space
// asm volatile ("mov (%%rcx), %%rax" :: "c"(&pb[13*cps]) : "rax");
//*/
//while(1);
//*(uint8_t*)(0);
/*
asm volatile("pop %%rbx\n" // From target_fn
"pop %%r12\n" // From target_fn
"pop %%rbp\n" // From target_fn
"pop %%rbx\n" // From indirect_camellia
"pop %%rbp\n" // From indirect_camellia
"retq\n"
:::);
*/
signal(0x11);
// signal(0x23);
// signal(0x37);
// signal32(0xDEADBEEF);
// signal40(0xDEADBEEF44);
// __uint128_t register pt = aes_ctr(signal_idx / 16);
// signal(pt >> ((signal_idx % 16)*8) & 0xff);
// __uint128_t register pt = aes_ctr(signal_idx / 4);
// signal32(pt >> ((signal_idx % 4)*32));
}
void end_target_fn(void) __attribute__((section(".targetfn")));
void end_target_fn(void) {
}
| 27.495652 | 90 | 0.534788 |
94996d4a820ee92026c7e78ce00d08ba186a124f | 3,520 | c | C | nitan/adm/daemons/base64d.c | cantona/NT6 | 073f4d491b3cfe6bfbe02fbad12db8983c1b9201 | [
"MIT"
] | 1 | 2019-03-27T07:25:16.000Z | 2019-03-27T07:25:16.000Z | nitan/adm/daemons/base64d.c | cantona/NT6 | 073f4d491b3cfe6bfbe02fbad12db8983c1b9201 | [
"MIT"
] | null | null | null | nitan/adm/daemons/base64d.c | cantona/NT6 | 073f4d491b3cfe6bfbe02fbad12db8983c1b9201 | [
"MIT"
] | null | null | null | /****************************************
* base64_d.c *
* *
* BASE64 編碼和解碼。我是為了 ESMTP 協 *
* 議的認證信息寫的這個玩意,因為我們是 *
* 要用的。 *
* *
* by Find@TX. *
****************************************/
#define IN_TEST
protected string base64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
protected string four_to_three(string base);
protected string three_to_four(string asc);
void create()
{
seteuid(getuid());
}
/* 對傳入的字符串進行 BASE64 編碼 */
string encode(string ascii)
{
int l,b;
string out = "";
#ifndef IN_TEST
if( previous_object()
&& (geteuid(previous_object()) != ROOT_UID))
return "";
#endif
if(!stringp(ascii) || ascii == "")
return "";
l = strlen(ascii);
b = l/3;
if(l%3)
b++;
for(int i=0;i<b;i++)
{
int start = i*3;
if( (start+2) > l )
out += three_to_four(ascii[start..]);
else
out += three_to_four(ascii[start..(start+2)]);
}
return out;
}
/* 對傳入的 BASE64 編碼字符串進行解碼 */
string decode(string b64)
{
int l,b;
string out = "";
#ifndef IN_TEST
if( previous_object()
&& (geteuid(previous_object()) != ROOT_UID))
return "";
#endif
if(!stringp(b64) || b64 == "")
return "";
l = strlen(b64);
if( l%4 ) // 錯誤!
return "";
b = l/4;
for(int i=0;i<b;i++)
{
int start = i*4;
out += four_to_three(b64[start..(start+3)]);
}
return out;
}
protected string four_to_three(string base)
{
string out;
int a1,a2,a3,a4,end,o1,o2,o3,n;
if( strlen(base) != 4)
return "";
a1 = strsrch(base64,base[0..0]);
a2 = strsrch(base64,base[1..1]);
if(base[2] != '=')
{
a3 = strsrch(base64,base[2..2]);
if(base[3] != '=')
a4 = strsrch(base64,base[3..3]);
else
n = 2;
}
else
n = 1;
end = (a1<<6)|a2;
end = (end<<6)|a3;
end = (end<<6)|a4;
o1 = end>>16;
o2 = (end>>8)&255;
o3 = end&255;
if(n == 1)
out = sprintf("%c",o1);
else if( n == 2 )
out = sprintf("%c%c",o1,o2);
else
out = sprintf("%c%c%c",o1,o2,o3);
return out;
}
protected string three_to_four(string asc)
{
int a1,a2,a3,end,o1,o2,o3,o4,n;
string out;
if(!stringp(asc) || asc =="")
return "";
n = strlen(asc);
a1 = asc[0];
if( n > 1 )
a2 = asc[1];
if( n > 2 )
a3 = asc[2];
end = (a1<<8)|a2;
end = (end<<8)|a3;
o1 = end>>18;
o2 = (end>>12)&63;
o3 = (end>>6)&63;
o4 = end&63;
if( n == 1 )
out = sprintf("%c%c==",base64[o1],base64[o2]);
else if( n == 2 )
out = sprintf("%c%c%c=",base64[o1],base64[o2],base64[o3]);
else
out = sprintf("%c%c%c%c",base64[o1],base64[o2],base64[o3],base64[o4]);
return out;
} | 22.278481 | 93 | 0.392614 |
9499a6da37dbcf804d32f597de590dd2fe6d24b4 | 192 | h | C | src/net/method.h | panda-factory/cpp-improvement-tutorial | 6e9256d5cdab46e320a9aab0a29ccd1af4ec5079 | [
"BSD-2-Clause"
] | null | null | null | src/net/method.h | panda-factory/cpp-improvement-tutorial | 6e9256d5cdab46e320a9aab0a29ccd1af4ec5079 | [
"BSD-2-Clause"
] | null | null | null | src/net/method.h | panda-factory/cpp-improvement-tutorial | 6e9256d5cdab46e320a9aab0a29ccd1af4ec5079 | [
"BSD-2-Clause"
] | null | null | null | //
// Created by admin on 2021/1/10.
//
#ifndef TEST_METHOD_H
#define TEST_METHOD_H
#include <string>
namespace net {
using Method = std::string;
} //namespace net
#endif //TEST_METHOD_H
| 12 | 33 | 0.708333 |
949a3b01fff254e7a6f5496aaf79a198a9ead65b | 2,775 | h | C | lib/jxl/enc_heuristics.h | krinfels/jpeg-xl | c8b827fdffaacfd2dd6fab9a34659d3b415350b6 | [
"Apache-2.0"
] | 1 | 2021-04-26T19:19:08.000Z | 2021-04-26T19:19:08.000Z | lib/jxl/enc_heuristics.h | krinfels/jpeg-xl | c8b827fdffaacfd2dd6fab9a34659d3b415350b6 | [
"Apache-2.0"
] | null | null | null | lib/jxl/enc_heuristics.h | krinfels/jpeg-xl | c8b827fdffaacfd2dd6fab9a34659d3b415350b6 | [
"Apache-2.0"
] | 1 | 2021-06-17T15:55:20.000Z | 2021-06-17T15:55:20.000Z | // Copyright (c) the JPEG XL Project
//
// 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 LIB_JXL_ENC_HEURISTICS_H_
#define LIB_JXL_ENC_HEURISTICS_H_
// Hook for custom encoder heuristics (VarDCT only for now).
#include <stddef.h>
#include <stdint.h>
#include <string>
#include "lib/jxl/aux_out_fwd.h"
#include "lib/jxl/base/data_parallel.h"
#include "lib/jxl/base/status.h"
#include "lib/jxl/image.h"
#include "lib/jxl/modular/encoding/ma.h"
namespace jxl {
struct PassesEncoderState;
class ImageBundle;
class ModularFrameEncoder;
class EncoderHeuristics {
public:
virtual ~EncoderHeuristics() = default;
// Initializes encoder structures in `enc_state` using the original (linear
// sRGB) image data in `linear`, and the XYB image data in `opsin`. Also
// modifies the `opsin` image by applying Gaborish, and doing other
// modifications if necessary.
// `pool` is used for running the computations on multiple threads. `aux_out`
// collects statistics and can be used to print debug images.
virtual Status LossyFrameHeuristics(
PassesEncoderState* enc_state, ModularFrameEncoder* modular_frame_encoder,
const ImageBundle* linear, Image3F* opsin, ThreadPool* pool,
AuxOut* aux_out) = 0;
// Custom fixed tree for lossless mode. Must set `tree` to a valid tree if
// the function returns true.
virtual bool CustomFixedTreeLossless(const FrameDimensions& frame_dim,
Tree* tree) {
return false;
}
};
class DefaultEncoderHeuristics : public EncoderHeuristics {
public:
Status LossyFrameHeuristics(PassesEncoderState* enc_state,
ModularFrameEncoder* modular_frame_encoder,
const ImageBundle* linear, Image3F* opsin,
ThreadPool* pool, AuxOut* aux_out) override;
};
class FastEncoderHeuristics : public EncoderHeuristics {
public:
Status LossyFrameHeuristics(PassesEncoderState* enc_state,
ModularFrameEncoder* modular_frame_encoder,
const ImageBundle* linear, Image3F* opsin,
ThreadPool* pool, AuxOut* aux_out) override;
};
} // namespace jxl
#endif // LIB_JXL_ENC_HEURISTICS_H_
| 35.576923 | 80 | 0.702703 |
949a9f6c22449d23389702b63d2d9a280e2734f3 | 1,035 | h | C | src/client/windows/client-service/io-cache.h | dschwoerer/orangefs | 386a12df2b0310ec2e0d37aba092204d9490c7be | [
"Apache-2.0"
] | 44 | 2018-10-11T23:16:42.000Z | 2022-03-16T11:23:49.000Z | src/client/windows/client-service/io-cache.h | dschwoerer/orangefs | 386a12df2b0310ec2e0d37aba092204d9490c7be | [
"Apache-2.0"
] | 84 | 2018-05-31T20:14:51.000Z | 2021-09-05T19:37:51.000Z | src/client/windows/client-service/io-cache.h | dschwoerer/orangefs | 386a12df2b0310ec2e0d37aba092204d9490c7be | [
"Apache-2.0"
] | 7 | 2018-10-23T13:40:21.000Z | 2021-09-26T07:19:44.000Z | /*
* (C) 2010-2013 Clemson University and Omnibond Systems, LLC
*
* See COPYING in top-level directory.
*/
/*
* IO cache declarations
*/
#ifndef __IO_CACHE_H
#define __IO_CACHE_H
#include <Windows.h>
#include "pvfs2.h"
#include "quickhash.h"
#define IO_CACHE_HIT 0
#define IO_CACHE_MISS 1
#define IO_CACHE_NO_UPDATE 0
#define IO_CACHE_UPDATE 1
struct io_cache_entry
{
struct qhash_head hash_link;
ULONG64 context;
PVFS_object_ref object_ref;
enum PVFS_io_type io_type;
int update_flag;
};
int io_cache_compare(void *key,
struct qhash_head *link);
int io_cache_add(ULONG64 context,
PVFS_object_ref *object_ref,
enum PVFS_io_type io_type,
int update_flag);
int io_cache_remove(ULONG64 context);
int io_cache_get(ULONG64 context,
PVFS_object_ref *object_ref,
enum PVFS_io_type *io_type,
int *update_flag);
#endif | 21.122449 | 62 | 0.626087 |
949dd6cebe1121ddff3a0e076f65f143d614de98 | 494 | h | C | src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/rate_control.h | mtdxc/cpp_media_server | 98e267e712690c2fe36796ce752fcc1b969afa24 | [
"MIT"
] | null | null | null | src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/rate_control.h | mtdxc/cpp_media_server | 98e267e712690c2fe36796ce752fcc1b969afa24 | [
"MIT"
] | null | null | null | src/net/webrtc/libwebrtc/modules/remote_bitrate_estimator/rate_control.h | mtdxc/cpp_media_server | 98e267e712690c2fe36796ce752fcc1b969afa24 | [
"MIT"
] | null | null | null | #ifndef RATE_CONTROL_H
#define RATE_CONTROL_H
#include "include/bwe_defines.h"
#include <stdint.h>
#include <stddef.h>
namespace webrtc {
class RateControl
{
public:
RateControl();
~RateControl();
public:
bool update(int64_t rate, BandwidthUsage state);
int64_t get_target_bitrate() { return target_bitrate_; }
private:
int64_t max_bitrate_;
int64_t min_bitrate_;
int64_t target_bitrate_;
BandwidthUsage last_state_ = BandwidthUsage::kBwNormal;
};
}
#endif | 17.642857 | 60 | 0.738866 |
949e8bd7c0aef4d15379abb22adb0f1f3392463f | 1,454 | h | C | lite/kernels/arm/fc_compute.h | wanglei91/Paddle-Lite | 8b2479f4cdd6970be507203d791bede5a453c09d | [
"Apache-2.0"
] | 1,799 | 2019-08-19T03:29:38.000Z | 2022-03-31T14:30:50.000Z | lite/kernels/arm/fc_compute.h | wanglei91/Paddle-Lite | 8b2479f4cdd6970be507203d791bede5a453c09d | [
"Apache-2.0"
] | 3,767 | 2019-08-19T03:36:04.000Z | 2022-03-31T14:37:26.000Z | lite/kernels/arm/fc_compute.h | yingshengBD/Paddle-Lite | eea59b66f61bb2acad471010c9526eeec43a15ca | [
"Apache-2.0"
] | 798 | 2019-08-19T02:28:23.000Z | 2022-03-31T08:31:54.000Z | // Copyright (c) 2019 PaddlePaddle 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.
#pragma once
#include <stdint.h>
#include <vector>
#include "lite/backends/arm/math/funcs.h"
#include "lite/backends/arm/math/type_trans.h"
#include "lite/core/kernel.h"
namespace paddle {
namespace lite {
namespace kernels {
namespace arm {
template <PrecisionType PType, PrecisionType OutType>
class FcCompute : public KernelLite<TARGET(kARM), PType> {
public:
using param_t = operators::FcParam;
virtual void ReInitWhenNeeded();
virtual void PrepareForRun();
virtual void Run();
~FcCompute() = default;
private:
DDim last_shape_;
Tensor weights_;
Tensor bias_;
bool flag_trans_weights_{false};
bool flag_trans_bias_{false};
bool flag_gemm_{true};
int m_;
int n_;
int k_;
std::vector<float> scale_;
};
} // namespace arm
} // namespace kernels
} // namespace lite
} // namespace paddle
| 26.436364 | 75 | 0.732462 |
94a27aebc29bb624719d43e48b532e42174fdcae | 2,441 | h | C | cpp/tracereading/TraceReaderAndCleaner.h | serik1987/ihna_kozhuhov_image_analysis | ccfb3b48cbf6b351acb10f8b99315c65281f8ab8 | [
"Unlicense"
] | null | null | null | cpp/tracereading/TraceReaderAndCleaner.h | serik1987/ihna_kozhuhov_image_analysis | ccfb3b48cbf6b351acb10f8b99315c65281f8ab8 | [
"Unlicense"
] | null | null | null | cpp/tracereading/TraceReaderAndCleaner.h | serik1987/ihna_kozhuhov_image_analysis | ccfb3b48cbf6b351acb10f8b99315c65281f8ab8 | [
"Unlicense"
] | null | null | null | //
// Created by serik1987 on 12.01.2020.
//
#ifndef IHNA_KOZHUKHOV_IMAGE_ANALYSIS_TRACEREADERANDCLEANER_H
#define IHNA_KOZHUKHOV_IMAGE_ANALYSIS_TRACEREADERANDCLEANER_H
#include "TraceReader.h"
#include "../isolines/Isoline.h"
namespace GLOBAL_NAMESPACE {
/**
* This is a derived class from the TraceReader. Instead of TraceReader this also cleans
* the trace by application of a certain isoline which shall be set by the setIsoline method
*/
class TraceReaderAndCleaner: public TraceReader {
private:
double* tracesBeforeRemove;
double* isolines;
Isoline* isolineRemover;
int offsetFrame;
bool cleaned;
void newBuffers();
public:
explicit TraceReaderAndCleaner(StreamFileTrain& train);
TraceReaderAndCleaner(const TraceReaderAndCleaner& other) = delete;
TraceReaderAndCleaner(TraceReaderAndCleaner&& other) noexcept;
~TraceReaderAndCleaner() override;
TraceReaderAndCleaner& operator=(const TraceReaderAndCleaner& other) = delete;
TraceReaderAndCleaner& operator=(TraceReaderAndCleaner&& other) noexcept;
/**
* Sets the Isoline object that will remove isolines from given traces
*
* @param isoline reference to the object
*/
void setIsolineRemover(Isoline& isoline) { isolineRemover = &isoline; }
/**
*
* @return true if all isolines were successfully read and cleaned
*/
[[nodiscard]] bool isCleaned() const { return hasRead() && cleaned; }
/**
*
* @return a 2D C-type array containing all isolines for all data pixels and native signals
* for data pixels
*/
[[nodiscard]] const double* getIsolines() const;
/**
* Reads the traces and cleans them from the trash;
*/
void read() override;
/**
* Clears the state from the previous reading
*/
void clearState() override;
/**
*
* @return traces before remove
*/
[[nodiscard]] const double* getTracesBeforeRemove() const;
[[nodiscard]] const char* getReaderName() const override { return "TRACE READER AND CLEANER"; };
friend std::ostream& operator<<(std::ostream& out, TraceReaderAndCleaner& reader);
};
}
#endif //IHNA_KOZHUKHOV_IMAGE_ANALYSIS_TRACEREADERANDCLEANER_H
| 29.768293 | 104 | 0.644818 |
94a72eb7132a98e5792924951aa79de9aa19a9eb | 94 | c | C | test_sunifdef/test_cases/test0073.c | HaomingJu/sunifdef | 67c6b3ae5f3e20e1dbf5c4e4e47c7e08b7e4d815 | [
"BSD-3-Clause"
] | 3 | 2019-08-08T08:17:05.000Z | 2021-09-10T01:57:40.000Z | test_sunifdef/test_cases/test0073.c | HaomingJu/sunifdef | 67c6b3ae5f3e20e1dbf5c4e4e47c7e08b7e4d815 | [
"BSD-3-Clause"
] | null | null | null | test_sunifdef/test_cases/test0073.c | HaomingJu/sunifdef | 67c6b3ae5f3e20e1dbf5c4e4e47c7e08b7e4d815 | [
"BSD-3-Clause"
] | 2 | 2021-06-17T04:28:28.000Z | 2022-01-19T11:26:17.000Z | /**ARGS: -DFOO1 -UFOO2 */
/**SYSCODE: = 1 | 16 */
#ifdef FOO1
KEEPME
#else
#undef FOO1
#endif
| 11.75 | 25 | 0.606383 |
94a930755ac0c062b76b84e6ba72deac3e6188c1 | 4,787 | h | C | p4bridge/OutStr.h | septag/p4api.net | ac6b2391aa086b9325466a8357c375846f8899ad | [
"BSD-3-Clause"
] | null | null | null | p4bridge/OutStr.h | septag/p4api.net | ac6b2391aa086b9325466a8357c375846f8899ad | [
"BSD-3-Clause"
] | null | null | null | p4bridge/OutStr.h | septag/p4api.net | ac6b2391aa086b9325466a8357c375846f8899ad | [
"BSD-3-Clause"
] | null | null | null | /*******************************************************************************
Copyright (c) 2010, Perforce Software, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
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 PERFORCE SOFTWARE, INC. 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.
*******************************************************************************/
/*******************************************************************************
* Name : StrRef.h
*
* Author : Duncan Barbee <dbarbee@perforce.com>
*
* Description : A set of classes used to return strings.
*
******************************************************************************/
#pragma once
class StrPtr;
/******************************************************************************
// StrRef is an abstract base class for any reference to text data that needs
// to be returned from the bridge. It provides a char* + length interface so
// that it can easily be returned in a preallocated buffer by first reading
// the length, allocating the buffer, then fetching string data.
******************************************************************************/
class OutStr abstract: public p4base
{
public:
OutStr(void) : p4base(Type()) {};
virtual ~OutStr(void) {};
virtual int Type(void) { return tOutStr; }
void CopyToBuff( void * buff, int length);
// Get the Text data and it's length
virtual int IsUnicode() = 0;
virtual const char * Text() = 0;
virtual int Length() = 0;
};
/******************************************************************************
// StrPtrRef is wrap a StrPtr object, so that it can easily be returned in a
// preallocated buffer by first reading the length, allocating the buffer,
// then fetching string data.
******************************************************************************/
class OutStrPtr : public OutStr
{
public:
OutStrPtr(const StrPtr &pval, int isUni);
virtual ~OutStrPtr(void);
// Get the Text data and it's length
virtual int IsUnicode() { return isUnicode; }
virtual const char * Text();
virtual int Length();
private:
// Don't allow uninitialized references
//StrPtrRef(void) {};
int isUnicode;
const StrPtr &value;
};
/******************************************************************************
// CharPtrRef is wrap a char *, so that it can easily be returned in a
// preallocated buffer by first reading the length, allocating the buffer,
// then fetching string data.
******************************************************************************/
class OutCharPtr : public OutStr
{
public:
OutCharPtr(char * pval);
virtual ~OutCharPtr(void);
// Get the Text data and it's length
virtual int IsUnicode() { return 0; }
virtual const char * Text();
virtual int Length();
private:
// Don't allow uninitialized references
OutCharPtr(void) {};
char * value;
int length;
};
/******************************************************************************
// CharPtrRef is wrap a char *, so that it can easily be returned in a
// preallocated buffer by first reading the length, allocating the buffer,
// then fetching string data.
******************************************************************************/
class OutWCharPtr : public OutStr
{
public:
OutWCharPtr(WCHAR * pval);
virtual ~OutWCharPtr(void);
// Get the Text data and it's length
virtual int IsUnicode() { return 1; }
virtual const char * Text();
virtual int Length();
private:
// Don't allow uninitialized references
OutWCharPtr(void) {};
WCHAR * value;
int length;
};
| 35.459259 | 80 | 0.572801 |
94abd68e662f210976e858771e0054ed0c57cbc6 | 2,007 | c | C | examples/common/iota_receiver.c | francescolavra/iota-c-client | e4997bb4eae25faf3406cbd29e8bdb40de24d584 | [
"MIT"
] | 1 | 2019-03-14T13:07:46.000Z | 2019-03-14T13:07:46.000Z | examples/common/iota_receiver.c | francescolavra/iota-c-client | e4997bb4eae25faf3406cbd29e8bdb40de24d584 | [
"MIT"
] | 1 | 2020-01-14T16:03:25.000Z | 2020-01-20T14:36:05.000Z | examples/common/iota_receiver.c | francescolavra/iota-c-client | e4997bb4eae25faf3406cbd29e8bdb40de24d584 | [
"MIT"
] | null | null | null | /*
* MIT License
*
* Copyright (c) 2019 Francesco Lavra <francescolavra.fl@gmail.com>
* and Contributors
*
* 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.
*/
#include <stdio.h>
#include <string.h>
#include <iota_client.h>
#include <iota_wallet.h>
#include "iota_examples.h"
void iota_receiver(const char *seed)
{
iota_addr_t addr;
int ret;
uint64_t balance;
if (iota_wallet_setup(seed, "https://nodes.thetangle.org") < 0) {
printf("Cannot initialize IOTA wallet\n");
return;
}
ret = iota_wallet_get_receive_addr(&addr, 1, (unsigned int) -1, NULL);
if (ret == IOTA_OK) {
printf("Please send IOTAs to this address: %s\n", addr.str);
addr.str[81] = '\0'; /* remove address checksum */
}
else {
printf("Couldn't get receive address\n");
return;
}
while (1) {
ret = iota_client_get_balances(&addr, 1, &balance);
if (ret == 0) {
printf("Got %llu IOTAs so far\n", balance);
}
else {
printf("Couldn't get balance\n");
}
delay(10000);
}
}
| 31.359375 | 80 | 0.716492 |
94ae3aaf643559dfafcf815a7a86c2b1300f4892 | 959 | h | C | Plugins/VoxelPlugin-master/Source/Voxel/Public/VoxelData/VoxelDataImpl.h | drakelinglabs/breakup | 04cc209605082a61399f52a174057eda56b797f2 | [
"MIT"
] | 3 | 2020-10-05T18:52:08.000Z | 2020-12-01T15:14:36.000Z | Plugins/VoxelPlugin-master/Source/Voxel/Public/VoxelData/VoxelDataImpl.h | Bluedrake42/breakup | 04cc209605082a61399f52a174057eda56b797f2 | [
"MIT"
] | null | null | null | Plugins/VoxelPlugin-master/Source/Voxel/Public/VoxelData/VoxelDataImpl.h | Bluedrake42/breakup | 04cc209605082a61399f52a174057eda56b797f2 | [
"MIT"
] | 2 | 2020-10-10T20:16:12.000Z | 2020-11-01T13:11:40.000Z | // Copyright 2020 Phyronnaz
#pragma once
#include "CoreMinimal.h"
class FVoxelData;
struct FVoxelIntBox;
struct FModifiedValueDummy
{
template<typename... TArgs>
FModifiedValueDummy(TArgs...) {}
};
template<typename TModifiedValue = FModifiedValueDummy, typename TOtherModifiedValue = FModifiedValueDummy>
class TVoxelDataImpl
{
public:
FVoxelData& Data;
const bool bMultiThreadedEdits;
const bool bRecordModifiedValues;
TArray<TModifiedValue> ModifiedValues;
TArray<TOtherModifiedValue> OtherModifiedValues;
explicit TVoxelDataImpl(FVoxelData& Data, bool bMultiThreadedEdits = false, bool bRecordModifiedValues = true)
: Data(Data)
, bMultiThreadedEdits(bMultiThreadedEdits)
, bRecordModifiedValues(bRecordModifiedValues)
{
}
template<typename T, typename TLambda>
void Set(const FVoxelIntBox& Bounds, TLambda Lambda);
template<typename TA, typename TB, typename TLambda>
void Set(const FVoxelIntBox& Bounds, TLambda Lambda);
}; | 25.236842 | 111 | 0.798749 |