hexsha
stringlengths
40
40
size
int64
5
1.05M
ext
stringclasses
588 values
lang
stringclasses
305 values
max_stars_repo_path
stringlengths
3
363
max_stars_repo_name
stringlengths
5
118
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
10
max_stars_count
float64
1
191k
max_stars_repo_stars_event_min_datetime
stringdate
2015-01-01 00:00:35
2022-03-31 23:43:49
max_stars_repo_stars_event_max_datetime
stringdate
2015-01-01 12:37:38
2022-03-31 23:59:52
max_issues_repo_path
stringlengths
3
363
max_issues_repo_name
stringlengths
5
118
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
10
max_issues_count
float64
1
134k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
363
max_forks_repo_name
stringlengths
5
135
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
10
max_forks_count
float64
1
105k
max_forks_repo_forks_event_min_datetime
stringdate
2015-01-01 00:01:02
2022-03-31 23:27:27
max_forks_repo_forks_event_max_datetime
stringdate
2015-01-03 08:55:07
2022-03-31 23:59:24
content
stringlengths
5
1.05M
avg_line_length
float64
1.13
1.04M
max_line_length
int64
1
1.05M
alphanum_fraction
float64
0
1
7fe3c9720944921eb6a72cc1b1e0b2b0b471d6f3
374
h
C
BouncingBalls/camera.h
orangeblock/bouncing-balls
25e6cb24d5a8e8a83f010892cd2fcc00079722d9
[ "Apache-2.0" ]
null
null
null
BouncingBalls/camera.h
orangeblock/bouncing-balls
25e6cb24d5a8e8a83f010892cd2fcc00079722d9
[ "Apache-2.0" ]
null
null
null
BouncingBalls/camera.h
orangeblock/bouncing-balls
25e6cb24d5a8e8a83f010892cd2fcc00079722d9
[ "Apache-2.0" ]
null
null
null
#pragma once #include "vector.h" class Camera3D { public: Camera3D(float velocity = 0.3) : Camera3D(0, 0, 0, velocity) {} Camera3D(float x, float y, float z, float velocity = 0.3) : x(x), y(y), z(z), rotX(0), rotY(0), v(velocity) {} Camera3D(Vec3f& xyz, float velocity = 0.3) : Camera3D(xyz.x, xyz.y, xyz.z, velocity) {} float x, y, z; float rotX, rotY; float v; };
26.714286
111
0.63369
36e8e4f88baba400b9dad6a932200c844b083d62
1,810
h
C
ash/highlighter/highlighter_view.h
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
ash/highlighter/highlighter_view.h
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
ash/highlighter/highlighter_view.h
metux/chromium-deb
3c08e9b89a1b6f95f103a61ff4f528dbcd57fc42
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ASH_HIGHLIGHTER_HIGHLIGHTER_VIEW_H_ #define ASH_HIGHLIGHTER_HIGHLIGHTER_VIEW_H_ #include <vector> #include "ash/fast_ink/fast_ink_points.h" #include "ash/fast_ink/fast_ink_view.h" #include "base/time/time.h" namespace aura { class Window; } namespace gfx { class PointF; } namespace ash { enum class HighlighterGestureType; // HighlighterView displays the highlighter palette tool. It draws the // highlighter stroke which consists of a series of thick lines connecting // touch points. class HighlighterView : public FastInkView { public: static const SkColor kPenColor; static const gfx::SizeF kPenTipSize; HighlighterView(const base::TimeDelta presentation_delay, aura::Window* root_window); ~HighlighterView() override; const FastInkPoints& points() const { return points_; } bool animating() const { return animation_timer_.get(); } void AddNewPoint(const gfx::PointF& new_point, const base::TimeTicks& time); void AddGap(); void Animate(const gfx::PointF& pivot, HighlighterGestureType gesture_type, const base::Closure& done); private: friend class HighlighterControllerTestApi; void OnRedraw(gfx::Canvas& canvas) override; void FadeOut(const gfx::PointF& pivot, HighlighterGestureType gesture_type, const base::Closure& done); FastInkPoints points_; FastInkPoints predicted_points_; const base::TimeDelta presentation_delay_; std::unique_ptr<base::OneShotTimer> animation_timer_; DISALLOW_COPY_AND_ASSIGN(HighlighterView); }; } // namespace ash #endif // ASH_HIGHLIGHTER_HIGHLIGHTER_VIEW_H_
25.492958
78
0.744751
322b12ca504d6f62919a2f6630f4fcc0d80d9ea6
22,965
h
C
runtime/test/ompt/callback.h
sshudler/llvm-omp-chunks
6263bbf27e9e1de53be6a19429b8b20ec9a5eccd
[ "MIT" ]
null
null
null
runtime/test/ompt/callback.h
sshudler/llvm-omp-chunks
6263bbf27e9e1de53be6a19429b8b20ec9a5eccd
[ "MIT" ]
null
null
null
runtime/test/ompt/callback.h
sshudler/llvm-omp-chunks
6263bbf27e9e1de53be6a19429b8b20ec9a5eccd
[ "MIT" ]
1
2018-11-09T10:51:42.000Z
2018-11-09T10:51:42.000Z
#include <stdio.h> #include <inttypes.h> #include <omp.h> #include <ompt.h> #include <execinfo.h> #ifdef OMPT_USE_LIBUNWIND #define UNW_LOCAL_ONLY #include <libunwind.h> #endif static const char* ompt_thread_type_t_values[] = { NULL, "ompt_thread_initial", "ompt_thread_worker", "ompt_thread_other" }; static const char* ompt_task_type_t_values[] = { NULL, "ompt_task_initial", "ompt_task_implicit", "ompt_task_explicit", "ompt_task_target" }; static ompt_get_task_info_t ompt_get_task_info; static ompt_get_thread_data_t ompt_get_thread_data; static ompt_get_parallel_info_t ompt_get_parallel_info; static ompt_get_unique_id_t ompt_get_unique_id; static void print_ids(int level) { ompt_frame_t* frame ; ompt_data_t* parallel_data; ompt_data_t* task_data; int exists_parallel = ompt_get_parallel_info(level, &parallel_data, NULL); int exists_task = ompt_get_task_info(level, NULL, &task_data, &frame, NULL, NULL); if (frame) { printf("%" PRIu64 ": task level %d: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", exit_frame=%p, reenter_frame=%p\n", ompt_get_thread_data()->value, level, exists_parallel ? parallel_data->value : 0, exists_task ? task_data->value : 0, frame->exit_runtime_frame, frame->reenter_runtime_frame); // printf("%" PRIu64 ": parallel level %d: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", exit_frame=%p, reenter_frame=%p\n", ompt_get_thread_data()->value, level, exists_parallel ? parallel_data->value : 0, exists_task ? task_data->value : 0, frame->exit_runtime_frame, frame->reenter_runtime_frame); } else printf("%" PRIu64 ": task level %d: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", frame=%p\n", ompt_get_thread_data()->value, level, exists_parallel ? parallel_data->value : 0, exists_task ? task_data->value : 0, frame); } /* #define print_frame(level)\ do {\ unw_cursor_t cursor;\ unw_context_t uc;\ unw_word_t fp;\ unw_getcontext(&uc);\ unw_init_local(&cursor, &uc);\ int tmp_level = level;\ unw_get_reg(&cursor, UNW_REG_SP, &fp);\ printf("callback %p\n", (void*)fp);\ while (tmp_level > 0 && unw_step(&cursor) > 0)\ {\ unw_get_reg(&cursor, UNW_REG_SP, &fp);\ printf("callback %p\n", (void*)fp);\ tmp_level--;\ }\ if(tmp_level == 0)\ printf("%" PRIu64 ": __builtin_frame_address(%d)=%p\n", ompt_get_thread_data()->value, level, (void*)fp);\ else\ printf("%" PRIu64 ": __builtin_frame_address(%d)=%p\n", ompt_get_thread_data()->value, level, NULL);\ } while(0) */ #define print_frame(level)\ do {\ printf("%" PRIu64 ": __builtin_frame_address(%d)=%p\n", ompt_get_thread_data()->value, level, __builtin_frame_address(level));\ } while(0) static void print_current_address() { int real_level = 2; void *array[real_level]; size_t size; void *address; size = backtrace (array, real_level); if(size == real_level) address = array[real_level-1]-4; else address = NULL; printf("%" PRIu64 ": current_address=%p\n", ompt_get_thread_data()->value, address); } static void on_ompt_callback_mutex_acquire( ompt_mutex_kind_t kind, unsigned int hint, unsigned int impl, ompt_wait_id_t wait_id, const void *codeptr_ra) { switch(kind) { case ompt_mutex_lock: printf("%" PRIu64 ": ompt_event_wait_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; case ompt_mutex_nest_lock: printf("%" PRIu64 ": ompt_event_wait_nest_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; case ompt_mutex_critical: printf("%" PRIu64 ": ompt_event_wait_critical: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; case ompt_mutex_atomic: printf("%" PRIu64 ": ompt_event_wait_atomic: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; case ompt_mutex_ordered: printf("%" PRIu64 ": ompt_event_wait_ordered: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; default: break; } } static void on_ompt_callback_mutex_acquired( ompt_mutex_kind_t kind, ompt_wait_id_t wait_id, const void *codeptr_ra) { switch(kind) { case ompt_mutex_lock: printf("%" PRIu64 ": ompt_event_acquired_lock: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_nest_lock: printf("%" PRIu64 ": ompt_event_acquired_nest_lock_first: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_critical: printf("%" PRIu64 ": ompt_event_acquired_critical: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_atomic: printf("%" PRIu64 ": ompt_event_acquired_atomic: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_ordered: printf("%" PRIu64 ": ompt_event_acquired_ordered: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; default: break; } } static void on_ompt_callback_mutex_released( ompt_mutex_kind_t kind, ompt_wait_id_t wait_id, const void *codeptr_ra) { switch(kind) { case ompt_mutex_lock: printf("%" PRIu64 ": ompt_event_release_lock: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_nest_lock: printf("%" PRIu64 ": ompt_event_release_nest_lock_last: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_critical: printf("%" PRIu64 ": ompt_event_release_critical: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_atomic: printf("%" PRIu64 ": ompt_event_release_atomic: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_ordered: printf("%" PRIu64 ": ompt_event_release_ordered: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; default: break; } } static void on_ompt_callback_nest_lock( ompt_scope_endpoint_t endpoint, ompt_wait_id_t wait_id, const void *codeptr_ra) { switch(endpoint) { case ompt_scope_begin: printf("%" PRIu64 ": ompt_event_acquired_nest_lock_next: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_scope_end: printf("%" PRIu64 ": ompt_event_release_nest_lock_prev: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; } } static void on_ompt_callback_sync_region( ompt_sync_region_kind_t kind, ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, const void *codeptr_ra) { switch(endpoint) { case ompt_scope_begin: switch(kind) { case ompt_sync_region_barrier: printf("%" PRIu64 ": ompt_event_barrier_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", return_address=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra); print_ids(0); break; case ompt_sync_region_taskwait: break; case ompt_sync_region_taskgroup: break; } break; case ompt_scope_end: switch(kind) { case ompt_sync_region_barrier: printf("%" PRIu64 ": ompt_event_barrier_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", return_address=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra); break; case ompt_sync_region_taskwait: break; case ompt_sync_region_taskgroup: break; } break; } } static void on_ompt_callback_sync_region_wait( ompt_sync_region_kind_t kind, ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, const void *codeptr_ra) { switch(endpoint) { case ompt_scope_begin: switch(kind) { case ompt_sync_region_barrier: printf("%" PRIu64 ": ompt_event_wait_barrier_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", return_address=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra); break; case ompt_sync_region_taskwait: break; case ompt_sync_region_taskgroup: break; } break; case ompt_scope_end: switch(kind) { case ompt_sync_region_barrier: printf("%" PRIu64 ": ompt_event_wait_barrier_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", return_address=%p\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, codeptr_ra); break; case ompt_sync_region_taskwait: break; case ompt_sync_region_taskgroup: break; } break; } } static void on_ompt_event_control( uint64_t command, uint64_t modifier) { printf("%" PRIu64 ": ompt_event_control: command=%" PRIu64 ", modifier=%" PRIu64 "\n", ompt_get_thread_data()->value, command, modifier); } static void on_ompt_callback_flush( ompt_data_t *thread_data, const void *codeptr_ra) { printf("%" PRIu64 ": ompt_event_flush: codeptr_ra=%p\n", thread_data->value, codeptr_ra); } static void on_ompt_callback_cancel( ompt_data_t *task_data, int flags, const void *codeptr_ra) { printf("%" PRIu64 ": ompt_event_cancel: task_data=%" PRIu64 ", flags=%" PRIu32 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, task_data->value, flags, codeptr_ra); } static void on_ompt_callback_idle( ompt_scope_endpoint_t endpoint) { switch(endpoint) { case ompt_scope_begin: printf("%" PRIu64 ": ompt_event_idle_begin:\n", ompt_get_thread_data()->value); //printf("%" PRIu64 ": ompt_event_idle_begin: thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, thread_data.value); break; case ompt_scope_end: printf("%" PRIu64 ": ompt_event_idle_end:\n", ompt_get_thread_data()->value); //printf("%" PRIu64 ": ompt_event_idle_end: thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, thread_data.value); break; } } static void on_ompt_callback_implicit_task( ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, unsigned int team_size, unsigned int thread_num) { switch(endpoint) { case ompt_scope_begin: task_data->value = ompt_get_unique_id(); printf("%" PRIu64 ": ompt_event_implicit_task_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", team_size=%" PRIu32 ", thread_num=%" PRIu32 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, team_size, thread_num); break; case ompt_scope_end: printf("%" PRIu64 ": ompt_event_implicit_task_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", team_size=%" PRIu32 ", thread_num=%" PRIu32 "\n", ompt_get_thread_data()->value, (parallel_data)?parallel_data->value:0, task_data->value, team_size, thread_num); break; } } static void on_ompt_callback_lock_init( ompt_mutex_kind_t kind, unsigned int hint, unsigned int impl, ompt_wait_id_t wait_id, const void *codeptr_ra) { switch(kind) { case ompt_mutex_lock: printf("%" PRIu64 ": ompt_event_init_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; case ompt_mutex_nest_lock: printf("%" PRIu64 ": ompt_event_init_nest_lock: wait_id=%" PRIu64 ", hint=%" PRIu32 ", impl=%" PRIu32 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, hint, impl, codeptr_ra); break; default: break; } } static void on_ompt_callback_lock_destroy( ompt_mutex_kind_t kind, ompt_wait_id_t wait_id, const void *codeptr_ra) { switch(kind) { case ompt_mutex_lock: printf("%" PRIu64 ": ompt_event_destroy_lock: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; case ompt_mutex_nest_lock: printf("%" PRIu64 ": ompt_event_destroy_nest_lock: wait_id=%" PRIu64 ", return_address=%p \n", ompt_get_thread_data()->value, wait_id, codeptr_ra); break; default: break; } } static void on_ompt_callback_work( ompt_work_type_t wstype, ompt_scope_endpoint_t endpoint, ompt_data_t *parallel_data, ompt_data_t *task_data, uint64_t count, const void *codeptr_ra) { switch(endpoint) { case ompt_scope_begin: switch(wstype) { case ompt_work_loop: printf("%" PRIu64 ": ompt_event_loop_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", workshare_function=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count); break; case ompt_work_sections: //impl break; case ompt_work_single_executor: printf("%" PRIu64 ": ompt_event_single_in_block_begin: parallel_id=%" PRIu64 ", parent_task_id=%" PRIu64 ", workshare_function=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count); break; case ompt_work_single_other: printf("%" PRIu64 ": ompt_event_single_others_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", workshare_function=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count); break; case ompt_work_workshare: //impl break; case ompt_work_distribute: //impl break; case ompt_work_taskloop: //impl break; } break; case ompt_scope_end: switch(wstype) { case ompt_work_loop: printf("%" PRIu64 ": ompt_event_loop_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", workshare_function=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count); break; case ompt_work_sections: //impl break; case ompt_work_single_executor: printf("%" PRIu64 ": ompt_event_single_in_block_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", workshare_function=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count); break; case ompt_work_single_other: printf("%" PRIu64 ": ompt_event_single_others_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", workshare_function=%p, count=%" PRIu64 "\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra, count); break; case ompt_work_workshare: //impl break; case ompt_work_distribute: //impl break; case ompt_work_taskloop: //impl break; } break; } } static void on_ompt_callback_master( ompt_scope_endpoint_t endpoint, ompt_parallel_data_t *parallel_data, ompt_task_data_t *task_data, const void *codeptr_ra) { switch(endpoint) { case ompt_scope_begin: printf("%" PRIu64 ": ompt_event_master_begin: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra); break; case ompt_scope_end: printf("%" PRIu64 ": ompt_event_master_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, codeptr_ra); break; } } static void on_ompt_callback_parallel_begin( ompt_data_t *parent_task_data, const ompt_frame_t *parent_task_frame, ompt_data_t* parallel_data, uint32_t requested_team_size, // uint32_t actual_team_size, ompt_invoker_t invoker, const void *codeptr_ra) { parallel_data->value = ompt_get_unique_id(); printf("%" PRIu64 ": ompt_event_parallel_begin: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, parallel_id=%" PRIu64 ", requested_team_size=%" PRIu32 ", parallel_function=%p, invoker=%d\n", ompt_get_thread_data()->value, parent_task_data->value, parent_task_frame->exit_runtime_frame, parent_task_frame->reenter_runtime_frame, parallel_data->value, requested_team_size, codeptr_ra, invoker); } static void on_ompt_callback_parallel_end( ompt_data_t *parallel_data, ompt_task_data_t *task_data, ompt_invoker_t invoker, const void *codeptr_ra) { printf("%" PRIu64 ": ompt_event_parallel_end: parallel_id=%" PRIu64 ", task_id=%" PRIu64 ", invoker=%d, codeptr_ra=%p\n", ompt_get_thread_data()->value, parallel_data->value, task_data->value, invoker, codeptr_ra); } static void on_ompt_callback_task_create( ompt_task_data_t *parent_task_data, /* id of parent task */ const ompt_frame_t *parent_frame, /* frame data for parent task */ ompt_task_data_t* new_task_data, /* id of created task */ ompt_task_type_t type, int has_dependences, const void *codeptr_ra) /* pointer to outlined function */ { new_task_data->value = ompt_get_unique_id(); printf("%" PRIu64 ": ompt_event_task_create: parent_task_id=%" PRIu64 ", parent_task_frame.exit=%p, parent_task_frame.reenter=%p, new_task_id=%" PRIu64 ", parallel_function=%p, task_type=%s=%d, has_dependences=%s\n", ompt_get_thread_data()->value, parent_task_data ? parent_task_data->value : 0, parent_frame ? parent_frame->exit_runtime_frame : NULL, parent_frame ? parent_frame->reenter_runtime_frame : NULL, new_task_data->value, codeptr_ra, ompt_task_type_t_values[type], type, has_dependences ? "yes" : "no"); } static void on_ompt_callback_task_schedule( ompt_task_data_t *first_task_data, ompt_task_status_t prior_task_status, ompt_task_data_t *second_task_data) { printf("%" PRIu64 ": ompt_event_task_schedule: first_task_id=%" PRIu64 ", second_task_id=%" PRIu64 ", prior_task_status=%d\n", ompt_get_thread_data()->value, first_task_data->value, second_task_data->value, prior_task_status); if(prior_task_status == ompt_task_complete) { printf("%" PRIu64 ": ompt_event_task_end: task_id=%" PRIu64 "\n", ompt_get_thread_data()->value, first_task_data->value); } } static void on_ompt_callback_task_dependences( ompt_task_data_t *task_data, const ompt_task_dependence_t *deps, int ndeps) { printf("%" PRIu64 ": ompt_event_task_dependences: task_id=%" PRIu64 ", deps=%p, ndeps=%d\n", ompt_get_thread_data()->value, task_data->value, (void *)deps, ndeps); } static void on_ompt_callback_task_dependence( ompt_task_data_t *first_task_data, ompt_task_data_t *second_task_data) { printf("%" PRIu64 ": ompt_event_task_dependence_pair: first_task_id=%" PRIu64 ", second_task_id=%" PRIu64 "\n", ompt_get_thread_data()->value, first_task_data->value, second_task_data->value); } static void on_ompt_callback_thread_begin( ompt_thread_type_t thread_type, ompt_data_t *thread_data) { thread_data->value = ompt_get_unique_id(); printf("%" PRIu64 ": ompt_event_thread_begin: thread_type=%s=%d, thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, ompt_thread_type_t_values[thread_type], thread_type, thread_data->value); } static void on_ompt_callback_thread_end( ompt_data_t *thread_data) { printf("%" PRIu64 ": ompt_event_thread_end: thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, thread_data->value); //printf("%" PRIu64 ": ompt_event_thread_end: thread_type=%s=%d, thread_id=%" PRIu64 "\n", ompt_get_thread_data()->value, ompt_thread_type_t_values[thread_type], thread_type, thread_data->value); } #define register_callback_t(name, type) \ do{ \ type f_##name = &on_##name; \ if (ompt_set_callback(name, (ompt_callback_t)f_##name) == \ ompt_set_never) \ printf("0: Could not register callback '" #name "'\n"); \ }while(0) #define register_callback(name) register_callback_t(name, name##_t) int ompt_initialize( ompt_function_lookup_t lookup, ompt_fns_t* fns) { ompt_set_callback_t ompt_set_callback = (ompt_set_callback_t) lookup("ompt_set_callback"); ompt_get_task_info = (ompt_get_task_info_t) lookup("ompt_get_task_info"); ompt_get_thread_data = (ompt_get_thread_data_t) lookup("ompt_get_thread_data"); ompt_get_parallel_info = (ompt_get_parallel_info_t) lookup("ompt_get_parallel_info"); ompt_get_unique_id = (ompt_get_unique_id_t) lookup("ompt_get_unique_id"); register_callback(ompt_callback_mutex_acquire); register_callback_t(ompt_callback_mutex_acquired, ompt_callback_mutex_t); register_callback_t(ompt_callback_mutex_released, ompt_callback_mutex_t); register_callback(ompt_callback_nest_lock); register_callback(ompt_callback_sync_region); register_callback_t(ompt_callback_sync_region_wait, ompt_callback_sync_region_t); // register_callback(ompt_event_control); register_callback(ompt_callback_flush); register_callback(ompt_callback_cancel); register_callback(ompt_callback_idle); register_callback(ompt_callback_implicit_task); register_callback(ompt_callback_lock_init); register_callback(ompt_callback_lock_destroy); register_callback(ompt_callback_work); register_callback(ompt_callback_master); register_callback(ompt_callback_parallel_begin); register_callback(ompt_callback_parallel_end); register_callback(ompt_callback_task_create); register_callback(ompt_callback_task_schedule); register_callback(ompt_callback_task_dependences); register_callback(ompt_callback_task_dependence); register_callback(ompt_callback_thread_begin); register_callback(ompt_callback_thread_end); printf("0: NULL_POINTER=%p\n", NULL); return 1; //success } void ompt_finalize(ompt_fns_t* fns) { printf("%d: ompt_event_runtime_shutdown\n", omp_get_thread_num()); } ompt_fns_t* ompt_start_tool( unsigned int omp_version, const char *runtime_version) { static ompt_fns_t ompt_fns = {&ompt_initialize,&ompt_finalize}; return &ompt_fns; }
38.40301
516
0.706379
2caf3a6e7804b3aa5e42c5b1c34e2db2cc95d9e8
456
h
C
include/infos/fs/exec/elf-loader.h
Siliconlad/infos-1
9416552cb225fb2be1be6adcdb034f246d7c44b7
[ "MIT" ]
26
2019-01-14T22:00:53.000Z
2022-02-28T06:47:09.000Z
include/infos/fs/exec/elf-loader.h
Siliconlad/infos-1
9416552cb225fb2be1be6adcdb034f246d7c44b7
[ "MIT" ]
15
2020-09-25T14:16:42.000Z
2021-04-11T16:11:51.000Z
include/infos/fs/exec/elf-loader.h
Siliconlad/infos-1
9416552cb225fb2be1be6adcdb034f246d7c44b7
[ "MIT" ]
20
2018-11-01T09:19:43.000Z
2022-03-01T15:20:08.000Z
/* SPDX-License-Identifier: MIT */ #pragma once #include <infos/fs/exec/loader.h> #include <infos/kernel/log.h> namespace infos { namespace fs { class File; namespace exec { class ElfLoader : public Loader { public: ElfLoader(File& f); virtual ~ElfLoader() { } kernel::Process* load(const util::String& cmdline) override; private: File& _file; }; extern kernel::ComponentLog elf_log; } } }
14.709677
64
0.622807
82b27ac07be47f4127a40abaf565139ad8b9a2b2
1,035
h
C
RealtimeBreathing/cv-plot-1.2/CvPlot/inc/CvPlot/core/Drawable.h
NiliStein/librealsense
4ec77a10018b2f2f62b89e52b3bd55e453cc107b
[ "Apache-2.0" ]
null
null
null
RealtimeBreathing/cv-plot-1.2/CvPlot/inc/CvPlot/core/Drawable.h
NiliStein/librealsense
4ec77a10018b2f2f62b89e52b3bd55e453cc107b
[ "Apache-2.0" ]
null
null
null
RealtimeBreathing/cv-plot-1.2/CvPlot/inc/CvPlot/core/Drawable.h
NiliStein/librealsense
4ec77a10018b2f2f62b89e52b3bd55e453cc107b
[ "Apache-2.0" ]
1
2019-05-26T09:03:18.000Z
2019-05-26T09:03:18.000Z
// CvPlot - https://github.com/Profactor/cv-plot // Copyright (c) 2019 by PROFACTOR GmbH - https://www.profactor.at/ #pragma once #include <CvPlot/libdef.h> #include <opencv2/core.hpp> #include <CvPlot/core/RenderTarget.h> #include <CvPlot/Internal/no_warning.h> #include <CvPlot/Internal/Pimpl.h> #include <string> namespace CvPlot { class CVPLOT_LIBRARY_INTERFACE Drawable { public: Drawable(std::string name = ""); Drawable(Drawable &&a); virtual ~Drawable(); virtual void render(RenderTarget &renderTarget); virtual bool getBoundingRect(cv::Rect2d &rect); Drawable& setName(std::string name); const std::string& getName(); private: class Impl; CVPLOT_NO_WARNING_DLL_INTERFACE(Internal::Pimpl<Impl>, impl); }; template<typename Derived> class DrawableSub :public Drawable { public: using Drawable::Drawable; Derived& setName(std::string name) { return static_cast<Derived&>(Drawable::setName(name)); } }; } #ifdef CVPLOT_HEADER_ONLY #include <CvPlot/imp/Drawable.ipp> #endif
24.069767
67
0.722705
d61d28fdcf7e98993dc57b7c6e2319825b1fe71a
474
h
C
RSDKFramework.framework/Headers/ShareWrapper.h
zoumingming/raymingming
9810b0e2e5724005609a5df11adcfbd608dc1b36
[ "MIT" ]
null
null
null
RSDKFramework.framework/Headers/ShareWrapper.h
zoumingming/raymingming
9810b0e2e5724005609a5df11adcfbd608dc1b36
[ "MIT" ]
null
null
null
RSDKFramework.framework/Headers/ShareWrapper.h
zoumingming/raymingming
9810b0e2e5724005609a5df11adcfbd608dc1b36
[ "MIT" ]
null
null
null
// // ShareWrapper.h // PluginProtocol // // Created by cocos2dx on 14-11-12. // Copyright (c) 2014年 zhangbin. All rights reserved. // #import <Foundation/Foundation.h> typedef enum : NSUInteger { SHARERESULT_SUCCESS = 0, SHARERESULT_FAIL, SHARERESULT_CANCEL, SHARERESULT_NETWORK_ERROR } SHARE_ACTION_RET; @interface ShareWrapper : NSObject /*! * @abstract 分享回调方法. */ +(void)onShareResult:(id)pPlugin retCode:(int)ret retMsg:(NSString* )msg; @end
18.230769
73
0.71097
302698f39d32899e745beed75b295dfa02b0ad36
672
h
C
MailHeaders/Sierra/MailFW/NSKeyedUnarchiverDelegate-Protocol.h
waleedsamy/GPGMail
bfe077f87315e1cbe5bf1b80ece30f848b97f61b
[ "Xnet", "X11" ]
null
null
null
MailHeaders/Sierra/MailFW/NSKeyedUnarchiverDelegate-Protocol.h
waleedsamy/GPGMail
bfe077f87315e1cbe5bf1b80ece30f848b97f61b
[ "Xnet", "X11" ]
null
null
null
MailHeaders/Sierra/MailFW/NSKeyedUnarchiverDelegate-Protocol.h
waleedsamy/GPGMail
bfe077f87315e1cbe5bf1b80ece30f848b97f61b
[ "Xnet", "X11" ]
null
null
null
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // //#import "NSObject.h" @class NSArray, NSKeyedUnarchiver, NSString; @protocol NSKeyedUnarchiverDelegate <NSObject> @optional - (void)unarchiverDidFinish:(NSKeyedUnarchiver *)arg1; - (void)unarchiverWillFinish:(NSKeyedUnarchiver *)arg1; - (void)unarchiver:(NSKeyedUnarchiver *)arg1 willReplaceObject:(id)arg2 withObject:(id)arg3; - (id)unarchiver:(NSKeyedUnarchiver *)arg1 didDecodeObject:(id)arg2; - (Class)unarchiver:(NSKeyedUnarchiver *)arg1 cannotDecodeObjectOfClassName:(NSString *)arg2 originalClasses:(NSArray *)arg3; @end
32
125
0.75744
d05325753b6a458c56ac65b4061cea2457e3b5e5
7,116
h
C
mps/include/tencentcloud/mps/v20190612/model/LiveStreamTaskNotifyConfig.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
43
2019-08-14T08:14:12.000Z
2022-03-30T12:35:09.000Z
mps/include/tencentcloud/mps/v20190612/model/LiveStreamTaskNotifyConfig.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
12
2019-07-15T10:44:59.000Z
2021-11-02T12:35:00.000Z
mps/include/tencentcloud/mps/v20190612/model/LiveStreamTaskNotifyConfig.h
suluner/tencentcloud-sdk-cpp
a56c73cc3f488c4d1e10755704107bb15c5e000d
[ "Apache-2.0" ]
28
2019-07-12T09:06:22.000Z
2022-03-30T08:04:18.000Z
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TENCENTCLOUD_MPS_V20190612_MODEL_LIVESTREAMTASKNOTIFYCONFIG_H_ #define TENCENTCLOUD_MPS_V20190612_MODEL_LIVESTREAMTASKNOTIFYCONFIG_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Mps { namespace V20190612 { namespace Model { /** * 任务处理的事件通知配置。 */ class LiveStreamTaskNotifyConfig : public AbstractModel { public: LiveStreamTaskNotifyConfig(); ~LiveStreamTaskNotifyConfig() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取CMQ 的模型,有 Queue 和 Topic 两种,目前仅支持 Queue。 * @return CmqModel CMQ 的模型,有 Queue 和 Topic 两种,目前仅支持 Queue。 */ std::string GetCmqModel() const; /** * 设置CMQ 的模型,有 Queue 和 Topic 两种,目前仅支持 Queue。 * @param CmqModel CMQ 的模型,有 Queue 和 Topic 两种,目前仅支持 Queue。 */ void SetCmqModel(const std::string& _cmqModel); /** * 判断参数 CmqModel 是否已赋值 * @return CmqModel 是否已赋值 */ bool CmqModelHasBeenSet() const; /** * 获取CMQ 的园区,如 sh,bj 等。 * @return CmqRegion CMQ 的园区,如 sh,bj 等。 */ std::string GetCmqRegion() const; /** * 设置CMQ 的园区,如 sh,bj 等。 * @param CmqRegion CMQ 的园区,如 sh,bj 等。 */ void SetCmqRegion(const std::string& _cmqRegion); /** * 判断参数 CmqRegion 是否已赋值 * @return CmqRegion 是否已赋值 */ bool CmqRegionHasBeenSet() const; /** * 获取当模型为 Queue 时有效,表示接收事件通知的 CMQ 的队列名。 * @return QueueName 当模型为 Queue 时有效,表示接收事件通知的 CMQ 的队列名。 */ std::string GetQueueName() const; /** * 设置当模型为 Queue 时有效,表示接收事件通知的 CMQ 的队列名。 * @param QueueName 当模型为 Queue 时有效,表示接收事件通知的 CMQ 的队列名。 */ void SetQueueName(const std::string& _queueName); /** * 判断参数 QueueName 是否已赋值 * @return QueueName 是否已赋值 */ bool QueueNameHasBeenSet() const; /** * 获取当模型为 Topic 时有效,表示接收事件通知的 CMQ 的主题名。 * @return TopicName 当模型为 Topic 时有效,表示接收事件通知的 CMQ 的主题名。 */ std::string GetTopicName() const; /** * 设置当模型为 Topic 时有效,表示接收事件通知的 CMQ 的主题名。 * @param TopicName 当模型为 Topic 时有效,表示接收事件通知的 CMQ 的主题名。 */ void SetTopicName(const std::string& _topicName); /** * 判断参数 TopicName 是否已赋值 * @return TopicName 是否已赋值 */ bool TopicNameHasBeenSet() const; /** * 获取通知类型,默认CMQ,指定URL时HTTP回调推送到 NotifyUrl 指定的地址。 * @return NotifyType 通知类型,默认CMQ,指定URL时HTTP回调推送到 NotifyUrl 指定的地址。 */ std::string GetNotifyType() const; /** * 设置通知类型,默认CMQ,指定URL时HTTP回调推送到 NotifyUrl 指定的地址。 * @param NotifyType 通知类型,默认CMQ,指定URL时HTTP回调推送到 NotifyUrl 指定的地址。 */ void SetNotifyType(const std::string& _notifyType); /** * 判断参数 NotifyType 是否已赋值 * @return NotifyType 是否已赋值 */ bool NotifyTypeHasBeenSet() const; /** * 获取HTTP回调地址,NotifyType为URL时必填。 * @return NotifyUrl HTTP回调地址,NotifyType为URL时必填。 */ std::string GetNotifyUrl() const; /** * 设置HTTP回调地址,NotifyType为URL时必填。 * @param NotifyUrl HTTP回调地址,NotifyType为URL时必填。 */ void SetNotifyUrl(const std::string& _notifyUrl); /** * 判断参数 NotifyUrl 是否已赋值 * @return NotifyUrl 是否已赋值 */ bool NotifyUrlHasBeenSet() const; private: /** * CMQ 的模型,有 Queue 和 Topic 两种,目前仅支持 Queue。 */ std::string m_cmqModel; bool m_cmqModelHasBeenSet; /** * CMQ 的园区,如 sh,bj 等。 */ std::string m_cmqRegion; bool m_cmqRegionHasBeenSet; /** * 当模型为 Queue 时有效,表示接收事件通知的 CMQ 的队列名。 */ std::string m_queueName; bool m_queueNameHasBeenSet; /** * 当模型为 Topic 时有效,表示接收事件通知的 CMQ 的主题名。 */ std::string m_topicName; bool m_topicNameHasBeenSet; /** * 通知类型,默认CMQ,指定URL时HTTP回调推送到 NotifyUrl 指定的地址。 */ std::string m_notifyType; bool m_notifyTypeHasBeenSet; /** * HTTP回调地址,NotifyType为URL时必填。 */ std::string m_notifyUrl; bool m_notifyUrlHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_MPS_V20190612_MODEL_LIVESTREAMTASKNOTIFYCONFIG_H_
35.227723
116
0.462479
a9396ff5a30af87eb441ffdc607beb782def798f
8,597
h
C
include/phast_tree_likelihoods.h
nileshpatra/phast
66262df1b8cf7141426a9db40c4602c81435e088
[ "BSD-3-Clause" ]
null
null
null
include/phast_tree_likelihoods.h
nileshpatra/phast
66262df1b8cf7141426a9db40c4602c81435e088
[ "BSD-3-Clause" ]
null
null
null
include/phast_tree_likelihoods.h
nileshpatra/phast
66262df1b8cf7141426a9db40c4602c81435e088
[ "BSD-3-Clause" ]
null
null
null
/*************************************************************************** * PHAST: PHylogenetic Analysis with Space/Time models * Copyright (c) 2002-2005 University of California, 2006-2010 Cornell * University. All rights reserved. * * This source code is distributed under a BSD-style license. See the * file LICENSE.txt for details. ***************************************************************************/ /** @file tree_likelihoods.h Computation of likelihoods for columns of a given multiple alignment, according to a given tree model. @ingroup phylo */ #ifndef TREE_LIK_H #define TREE_LIK_H #include <phast_tree_model.h> #include <phast_msa.h> #include <math.h> #include <phast_misc.h> /** Structure for information related to posterior probability of tree model wrt an alignment. Each array is indexed as appropriate for rate categories, bases in the alignment (indexed according to a model's inv_states; with higher order models, actually tuples of bases), nodes or edges in the tree (indexed by node ids; a node is associated with the edge that connects it to its parent), and column tuples in a "sufficient statistics" representation of the alignment (all quantities will be the same for all instances of a column tuple). */ struct tp_struct { double ****base_probs; /**< Posterior probability of each base given a node, a column tuple, and a rate category. - First index is rate category - Second is base - Third is node - Fourth is column tuple */ double *****subst_probs; /**< Posterior probability of a substitution of each base for each other, given a branch, column tuple, and rate category. - First index is rate category - Second is original base - Third is replacement base - Fourth is branch - Fifth is column tuple */ double ***expected_nsubst; /**< Expected number of substitutions for each branch x column tuple, given a rate category (conditioned on rate category in case posterior probabilities of rate categories depend on an HMM or similar). - First index is rate category - Second is branch - Third is column tuple */ double ****expected_nsubst_tot; /**< Total expected number of substitutions of each type along each branch for each rate category, summed over all column tuples (considering the number of instances of each tuple). These are the sufficient statistics for computing the likelihood of a tree model. Note that they are based on *joint* probabilities with rate categories, rather than being conditioned on rate categories (the posterior probability of each rate at each site in incorporated). - First index is rate category - Second is original base - Third is replacement base - Fourth is branch */ double *****expected_nsubst_col; /**< Expected number of substitutions of each type along each branch for each rate category, for each tuple column. - First index is rate category - Second is branch - Third is tuple - Fourth is original base - Fifth is replacement base */ double **rcat_probs; /**< Posterior probability of each rate category for each column tuple. - First index is rate category - Second is column tuple */ double *rcat_expected_nsites; /**< Expected number of sites in each rate category */ }; typedef struct tp_struct TreePosteriors; /* see incomplete type in tree_model.h */ #define NULL_LOG_LIKELIHOOD 1 /** Safe value for null when dealing with log likelihoods (should always be <= 0) FIXME? */ /* does not appear to be implemented */ void tl_dump_matrices(TreeModel *mod, double **inside_vals, double **outside_vals, double **posterior_probs); /** Compute the likelihood of a tree model with respect to an alignment; Optionally retain column-by-column likelihoods and/or posterior probabilities. @param[in] mod Tree Model to compute likelihood for @param[in] msa Multiple Alignment containing data related to tree model @param[out] col_scores (Optional) Log likelihood score per column @param[out] tuple_scores (Optional) Log likelihood score per tuple @param[in] cat Whether to use categories @param[out] post (Optional) Computed posterior probabilities; If NULL, no posterior probabilities (or related quantities) will be computed. If non-NULL each of its attributes must either be NULL or previously allocated to the required size. @result Log likelihood of entire tree model specified */ double tl_compute_log_likelihood(TreeModel *mod, MSA *msa, double *col_scores, double *tuple_scores, int cat, TreePosteriors *post); /** Create a new TreePosteriors object. @param mod Tree Model of which the posterior probabilities are calculated @param msa Multiple Alignment @param do_bases Whether to allocate space for base probabilities @param do_subst Whether to allocate space for substitution probabilities @param do_expected_nsubst Whether to allocate space for expected number of substitutions matrix @param do_expected_nsubst_tot Whether to allocate space for total expected number of substitutions @param do_expected_nsubst_col Whether to allocate space for expected number of substitutions per column @param do_rate_cats Whether to allocate space for rate categories @param do_rate_cats_exp Whether to allocate space for expected rate categories @result Newly allocated TreePosteriors object */ TreePosteriors *tl_new_tree_posteriors(TreeModel *mod, MSA *msa, int do_bases, int do_substs, int do_expected_nsubst, int do_expected_nsubst_tot, int do_expected_nsubst_col, int do_rate_cats, int do_rate_cats_exp); /** Free TreePosteriors object @param mod Tree model of which posterior are calculated @param msa Multiple Alignment @param tp TreePosteriors object to free */ void tl_free_tree_posteriors(TreeModel *mod, MSA *msa, TreePosteriors *tp); /** Compute the expected (posterior) complete log likelihood of a tree model based on a TreePosteriors object. @param[in] mod Tree Model @param[in] post Pre-calculated posterior probabilities @note Equilibrium frequencies are not considered @result Log Likelihood of tree */ double tl_compute_partial_ll_suff_stats(TreeModel *mod, TreePosteriors *post); /* Could not find implementation */ double tl_compute_ll_suff_stats(TreeModel *mod, MSA *msa, TreePosteriors *post); /** Given an alphabet, a tuple size, and a vector of equilibrium frequencies, create a new vector of marginal equilibrium frequencies describing the space of "meta-tuples", which contain actual characters *or* missing data characters. Each meta-tuple is given an equilibrium frequency equal to the sum of the frequencies of all "matching" ordinary tuples. Missing data characters are assumed to be gap characters or Ns. @param alphabet List of possible characters @param tuple_size Size of tuples @param eq_freqs Equilibrium frequencies @param New vector of marginal equilibrium frequencies */ Vector *get_marginal_eq_freqs (char *alphabet, int tuple_size, Vector *eq_freqs); #endif
45.973262
107
0.614284
a9c5554e771cf43dba068fbda69e158549348a40
7,960
h
C
aws-cpp-sdk-servicecatalog/include/aws/servicecatalog/model/DescribeServiceActionExecutionParametersRequest.h
orinem/aws-sdk-cpp
f38413cc1f278689ef14e9ebdd74a489a48776be
[ "Apache-2.0" ]
1
2020-03-11T05:36:20.000Z
2020-03-11T05:36:20.000Z
aws-cpp-sdk-servicecatalog/include/aws/servicecatalog/model/DescribeServiceActionExecutionParametersRequest.h
novaquark/aws-sdk-cpp
a0969508545bec9ae2864c9e1e2bb9aff109f90c
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-servicecatalog/include/aws/servicecatalog/model/DescribeServiceActionExecutionParametersRequest.h
novaquark/aws-sdk-cpp
a0969508545bec9ae2864c9e1e2bb9aff109f90c
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma once #include <aws/servicecatalog/ServiceCatalog_EXPORTS.h> #include <aws/servicecatalog/ServiceCatalogRequest.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <utility> namespace Aws { namespace ServiceCatalog { namespace Model { /** */ class AWS_SERVICECATALOG_API DescribeServiceActionExecutionParametersRequest : public ServiceCatalogRequest { public: DescribeServiceActionExecutionParametersRequest(); // Service request name is the Operation name which will send this request out, // each operation should has unique request name, so that we can get operation's name from this request. // Note: this is not true for response, multiple operations may have the same response name, // so we can not get operation's name from response. inline virtual const char* GetServiceRequestName() const override { return "DescribeServiceActionExecutionParameters"; } Aws::String SerializePayload() const override; Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override; /** * <p>The identifier of the provisioned product.</p> */ inline const Aws::String& GetProvisionedProductId() const{ return m_provisionedProductId; } /** * <p>The identifier of the provisioned product.</p> */ inline bool ProvisionedProductIdHasBeenSet() const { return m_provisionedProductIdHasBeenSet; } /** * <p>The identifier of the provisioned product.</p> */ inline void SetProvisionedProductId(const Aws::String& value) { m_provisionedProductIdHasBeenSet = true; m_provisionedProductId = value; } /** * <p>The identifier of the provisioned product.</p> */ inline void SetProvisionedProductId(Aws::String&& value) { m_provisionedProductIdHasBeenSet = true; m_provisionedProductId = std::move(value); } /** * <p>The identifier of the provisioned product.</p> */ inline void SetProvisionedProductId(const char* value) { m_provisionedProductIdHasBeenSet = true; m_provisionedProductId.assign(value); } /** * <p>The identifier of the provisioned product.</p> */ inline DescribeServiceActionExecutionParametersRequest& WithProvisionedProductId(const Aws::String& value) { SetProvisionedProductId(value); return *this;} /** * <p>The identifier of the provisioned product.</p> */ inline DescribeServiceActionExecutionParametersRequest& WithProvisionedProductId(Aws::String&& value) { SetProvisionedProductId(std::move(value)); return *this;} /** * <p>The identifier of the provisioned product.</p> */ inline DescribeServiceActionExecutionParametersRequest& WithProvisionedProductId(const char* value) { SetProvisionedProductId(value); return *this;} /** * <p>The self-service action identifier.</p> */ inline const Aws::String& GetServiceActionId() const{ return m_serviceActionId; } /** * <p>The self-service action identifier.</p> */ inline bool ServiceActionIdHasBeenSet() const { return m_serviceActionIdHasBeenSet; } /** * <p>The self-service action identifier.</p> */ inline void SetServiceActionId(const Aws::String& value) { m_serviceActionIdHasBeenSet = true; m_serviceActionId = value; } /** * <p>The self-service action identifier.</p> */ inline void SetServiceActionId(Aws::String&& value) { m_serviceActionIdHasBeenSet = true; m_serviceActionId = std::move(value); } /** * <p>The self-service action identifier.</p> */ inline void SetServiceActionId(const char* value) { m_serviceActionIdHasBeenSet = true; m_serviceActionId.assign(value); } /** * <p>The self-service action identifier.</p> */ inline DescribeServiceActionExecutionParametersRequest& WithServiceActionId(const Aws::String& value) { SetServiceActionId(value); return *this;} /** * <p>The self-service action identifier.</p> */ inline DescribeServiceActionExecutionParametersRequest& WithServiceActionId(Aws::String&& value) { SetServiceActionId(std::move(value)); return *this;} /** * <p>The self-service action identifier.</p> */ inline DescribeServiceActionExecutionParametersRequest& WithServiceActionId(const char* value) { SetServiceActionId(value); return *this;} /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline const Aws::String& GetAcceptLanguage() const{ return m_acceptLanguage; } /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline bool AcceptLanguageHasBeenSet() const { return m_acceptLanguageHasBeenSet; } /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline void SetAcceptLanguage(const Aws::String& value) { m_acceptLanguageHasBeenSet = true; m_acceptLanguage = value; } /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline void SetAcceptLanguage(Aws::String&& value) { m_acceptLanguageHasBeenSet = true; m_acceptLanguage = std::move(value); } /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline void SetAcceptLanguage(const char* value) { m_acceptLanguageHasBeenSet = true; m_acceptLanguage.assign(value); } /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline DescribeServiceActionExecutionParametersRequest& WithAcceptLanguage(const Aws::String& value) { SetAcceptLanguage(value); return *this;} /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline DescribeServiceActionExecutionParametersRequest& WithAcceptLanguage(Aws::String&& value) { SetAcceptLanguage(std::move(value)); return *this;} /** * <p>The language code.</p> <ul> <li> <p> <code>en</code> - English (default)</p> * </li> <li> <p> <code>jp</code> - Japanese</p> </li> <li> <p> <code>zh</code> - * Chinese</p> </li> </ul> */ inline DescribeServiceActionExecutionParametersRequest& WithAcceptLanguage(const char* value) { SetAcceptLanguage(value); return *this;} private: Aws::String m_provisionedProductId; bool m_provisionedProductIdHasBeenSet; Aws::String m_serviceActionId; bool m_serviceActionIdHasBeenSet; Aws::String m_acceptLanguage; bool m_acceptLanguageHasBeenSet; }; } // namespace Model } // namespace ServiceCatalog } // namespace Aws
39.8
165
0.670477
aa69b24525be4ef4f8913d185f749267660bf36f
3,960
h
C
third_party/motive/spline_anim_generated.h
jjzhang166/lullaby
d9b11ea811cb5869b46165b9b9537b6063c6cbae
[ "Apache-2.0" ]
null
null
null
third_party/motive/spline_anim_generated.h
jjzhang166/lullaby
d9b11ea811cb5869b46165b9b9537b6063c6cbae
[ "Apache-2.0" ]
null
null
null
third_party/motive/spline_anim_generated.h
jjzhang166/lullaby
d9b11ea811cb5869b46165b9b9537b6063c6cbae
[ "Apache-2.0" ]
null
null
null
/* Copyright 2017 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS-IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ // automatically generated by the FlatBuffers compiler, do not modify #ifndef FLATBUFFERS_GENERATED_SPLINEANIM_MOTIVE_H_ #define FLATBUFFERS_GENERATED_SPLINEANIM_MOTIVE_H_ #include "flatbuffers/flatbuffers.h" #include "compact_spline_generated.h" namespace motive { struct CompactSplineAnimFloatFb; struct CompactSplineAnimFloatFb FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { enum { VT_SPLINES = 4 }; const flatbuffers::Vector<flatbuffers::Offset<motive::CompactSplineFloatFb>> *splines() const { return GetPointer<const flatbuffers::Vector<flatbuffers::Offset<motive::CompactSplineFloatFb>> *>(VT_SPLINES); } bool Verify(flatbuffers::Verifier &verifier) const { return VerifyTableStart(verifier) && VerifyOffset(verifier, VT_SPLINES) && verifier.Verify(splines()) && verifier.VerifyVectorOfTables(splines()) && verifier.EndTable(); } }; struct CompactSplineAnimFloatFbBuilder { flatbuffers::FlatBufferBuilder &fbb_; flatbuffers::uoffset_t start_; void add_splines(flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<motive::CompactSplineFloatFb>>> splines) { fbb_.AddOffset(CompactSplineAnimFloatFb::VT_SPLINES, splines); } CompactSplineAnimFloatFbBuilder(flatbuffers::FlatBufferBuilder &_fbb) : fbb_(_fbb) { start_ = fbb_.StartTable(); } CompactSplineAnimFloatFbBuilder &operator=(const CompactSplineAnimFloatFbBuilder &); flatbuffers::Offset<CompactSplineAnimFloatFb> Finish() { const auto end = fbb_.EndTable(start_, 1); auto o = flatbuffers::Offset<CompactSplineAnimFloatFb>(end); return o; } }; inline flatbuffers::Offset<CompactSplineAnimFloatFb> CreateCompactSplineAnimFloatFb( flatbuffers::FlatBufferBuilder &_fbb, flatbuffers::Offset<flatbuffers::Vector<flatbuffers::Offset<motive::CompactSplineFloatFb>>> splines = 0) { CompactSplineAnimFloatFbBuilder builder_(_fbb); builder_.add_splines(splines); return builder_.Finish(); } inline flatbuffers::Offset<CompactSplineAnimFloatFb> CreateCompactSplineAnimFloatFbDirect( flatbuffers::FlatBufferBuilder &_fbb, const std::vector<flatbuffers::Offset<motive::CompactSplineFloatFb>> *splines = nullptr) { return motive::CreateCompactSplineAnimFloatFb( _fbb, splines ? _fbb.CreateVector<flatbuffers::Offset<motive::CompactSplineFloatFb>>(*splines) : 0); } inline const motive::CompactSplineAnimFloatFb *GetCompactSplineAnimFloatFb(const void *buf) { return flatbuffers::GetRoot<motive::CompactSplineAnimFloatFb>(buf); } inline const char *CompactSplineAnimFloatFbIdentifier() { return "SPLN"; } inline bool CompactSplineAnimFloatFbBufferHasIdentifier(const void *buf) { return flatbuffers::BufferHasIdentifier( buf, CompactSplineAnimFloatFbIdentifier()); } inline bool VerifyCompactSplineAnimFloatFbBuffer( flatbuffers::Verifier &verifier) { return verifier.VerifyBuffer<motive::CompactSplineAnimFloatFb>(CompactSplineAnimFloatFbIdentifier()); } inline const char *CompactSplineAnimFloatFbExtension() { return "motivespline"; } inline void FinishCompactSplineAnimFloatFbBuffer( flatbuffers::FlatBufferBuilder &fbb, flatbuffers::Offset<motive::CompactSplineAnimFloatFb> root) { fbb.Finish(root, CompactSplineAnimFloatFbIdentifier()); } } // namespace motive #endif // FLATBUFFERS_GENERATED_SPLINEANIM_MOTIVE_H_
35.357143
121
0.77904
a60587e7d1afea2bff8daa8cc18101ad82b61f36
276
h
C
xen-4.6.0/xen/include/asm-arm/nmi.h
StanPlatinum/VMI-as-a-Service
5828a9c73815ad7e043428e7e56dc0715aaa60a1
[ "MIT" ]
3
2019-08-31T19:58:24.000Z
2020-10-02T06:50:22.000Z
xen-4.6.0/xen/include/asm-arm/nmi.h
StanPlatinum/VMI-as-a-Service
5828a9c73815ad7e043428e7e56dc0715aaa60a1
[ "MIT" ]
1
2020-10-16T19:13:49.000Z
2020-10-16T19:13:49.000Z
xen-4.6.0/xen/include/asm-arm/nmi.h
StanPlatinum/ROP-detection-inside-VMs
7b39298dd0791711cbd78fd0730b819b755cc995
[ "MIT" ]
1
2021-06-06T21:10:21.000Z
2021-06-06T21:10:21.000Z
#ifndef ASM_NMI_H #define ASM_NMI_H #define register_guest_nmi_callback(a) (-ENOSYS) #define unregister_guest_nmi_callback() (-ENOSYS) #endif /* ASM_NMI_H */ /* * Local variables: * mode: C * c-file-style: "BSD" * c-basic-offset: 4 * indent-tabs-mode: nil * End: */
17.25
49
0.688406
10f6c45e486c8fbcc04cb6cda6234fae7057b84b
2,015
h
C
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.h
windystrife/UnrealEngine_NVIDIAGameWork
b50e6338a7c5b26374d66306ebc7807541ff815e
[ "MIT" ]
1
2022-01-29T18:36:12.000Z
2022-01-29T18:36:12.000Z
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.h
windystrife/UnrealEngine_NVIDIAGameWork
b50e6338a7c5b26374d66306ebc7807541ff815e
[ "MIT" ]
null
null
null
Engine/Source/Runtime/Apple/MetalRHI/Private/MetalRenderCommandEncoder.h
windystrife/UnrealEngine_NVIDIAGameWork
b50e6338a7c5b26374d66306ebc7807541ff815e
[ "MIT" ]
null
null
null
// Copyright 1998-2016 Epic Games, Inc. All Rights Reserved. #pragma once #include "MetalDebugCommandEncoder.h" NS_ASSUME_NONNULL_BEGIN @class FMetalShaderPipeline; @protocol IMetalRenderCommandEncoder <MTLRenderCommandEncoder> - (void)setViewports:(const MTLViewport [])viewports count:(NSUInteger)count; - (void)setScissorRects:(const MTLScissorRect [])scissorRects count:(NSUInteger)count; @end @interface FMetalDebugRenderCommandEncoder : FMetalDebugCommandEncoder<MTLRenderCommandEncoder> { @private #pragma mark - Private Member Variables - #if METAL_DEBUG_OPTIONS FMetalDebugShaderResourceMask ResourceMask[EMetalShaderRenderNum]; FMetalDebugBufferBindings ShaderBuffers[EMetalShaderRenderNum]; FMetalDebugTextureBindings ShaderTextures[EMetalShaderRenderNum]; FMetalDebugSamplerBindings ShaderSamplers[EMetalShaderRenderNum]; id<MTLRenderPipelineState> DebugState; #endif MTLRenderPassDescriptor* RenderPassDesc; } /** The wrapped native command-encoder for which we collect debug information. */ @property (readonly, retain) id<MTLRenderCommandEncoder> Inner; @property (readonly, retain) FMetalDebugCommandBuffer* Buffer; @property (nonatomic, retain) FMetalShaderPipeline* Pipeline; /** Initialise the wrapper with the provided command-buffer. */ -(id)initWithEncoder:(id<MTLRenderCommandEncoder>)Encoder fromDescriptor:(MTLRenderPassDescriptor*)RenderPassDesc andCommandBuffer:(FMetalDebugCommandBuffer*)Buffer; /** Validates the pipeline/binding state */ -(bool)validateFunctionBindings:(EMetalShaderFrequency)Frequency; -(void)validate; @end NS_ASSUME_NONNULL_END #if METAL_DEBUG_OPTIONS #define METAL_SET_RENDER_REFLECTION(Encoder, InPipeline) \ if (GetMetalDeviceContext().GetCommandQueue().GetRuntimeDebuggingLevel() >= EMetalDebugLevelFastValidation) \ { \ ((FMetalDebugRenderCommandEncoder*)Encoder).Pipeline = InPipeline; \ } #else #define METAL_SET_RENDER_REFLECTION(Encoder, InPipeline) #endif
36.636364
165
0.799007
e7535e51cf953cc05b9b440841736b09a3ae88ac
14,501
h
C
examples/Sonoff_basic_web/spiffs_webserver.h
arihantdaga/ESPHap
fd11b7c8a7075e2eedcd77aa54fca7c9d92bf67e
[ "MIT" ]
193
2020-01-09T00:36:55.000Z
2022-03-31T15:59:48.000Z
examples/Sonoff_basic_web/spiffs_webserver.h
arihantdaga/ESPHap
fd11b7c8a7075e2eedcd77aa54fca7c9d92bf67e
[ "MIT" ]
104
2020-03-28T18:01:49.000Z
2022-03-23T06:32:43.000Z
examples/Sonoff_basic_web/spiffs_webserver.h
arihantdaga/ESPHap
fd11b7c8a7075e2eedcd77aa54fca7c9d92bf67e
[ "MIT" ]
56
2020-01-09T12:56:40.000Z
2022-01-26T15:56:54.000Z
// *************************************************************************** // SPIFFS Webserver // Source: https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser // *************************************************************************** #pragma once /* FSWebServer - Example WebServer with SPIFFS backend for esp8266 Copyright (c) 2015 Hristo Gochkov. All rights reserved. This file is part of the ESP8266WebServer library for Arduino environment. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA upload the contents of the data folder with MkSPIFFS Tool ("ESP8266 Sketch Data Upload" in Tools menu in Arduino IDE) or you can upload the contents of a folder if you CD in that folder and run the following command: for file in `ls -A1`; do curl -F "file=@$PWD/$file" esp8266fs.local/edit; done access the sample web page at http://esp8266fs.local edit the page by going to http://esp8266fs.local/edit */ #ifndef DBG_OUTPUT_PORT #define DBG_OUTPUT_PORT Serial #endif #include "filebrowse.h" #include "sonoff_index_html.h" const char FILE_BROWSE_FILE [] PROGMEM ="/filebrowse.html"; const char FILE_INDEX [] PROGMEM ="index.html"; const char TEXT_PLAIN [] PROGMEM ="text/plain"; #define SETUP_FILEHANDLES server.on("/list", HTTP_GET, handleFileList); \ server.on("/edit", HTTP_GET, []() { \ if (!handleFileRead("/edit.htm")) server.send(404, FPSTR(TEXT_PLAIN), "FileNotFound"); \ }); \ server.on(PSTR("/edit"), HTTP_PUT, handleFileCreate); \ server.on(PSTR("/restartesp"), HTTP_GET, [](){ESP.restart();}); \ server.on(PSTR("/edit"), HTTP_DELETE, handleFileDelete); \ server.on(PSTR("/edit"), HTTP_POST, []() { \ server.sendHeader(PSTR("Access-Control-Allow-Origin"), "*"); \ server.send(200, FPSTR(TEXT_PLAIN), ""); \ }, handleFileUpload); \ server.on(PSTR("/jsonsave"), handleJsonSave); \ server.on(PSTR("/jsonload"), handleJsonLoad); \ server.on(PSTR("/upload"), HTTP_POST, []() { server.send(200, FPSTR(TEXT_PLAIN), ""); }, handleFileUpload); \ server.on(PSTR("/browse"), handleFileBrowser); \ server.onNotFound([]() { \ if (!handleFileRead(server.uri())) \ handleNotFound(); \ }); \ saveIndex(); File fsUploadFile; unsigned char h2int(char c) { if (c >= '0' && c <= '9') { return((unsigned char)c - '0'); } if (c >= 'a' && c <= 'f') { return((unsigned char)c - 'a' + 10); } if (c >= 'A' && c <= 'F') { return((unsigned char)c - 'A' + 10); } return(0); } String urldecode(String input) // (based on https://code.google.com/p/avr-netino/) { char c; String ret = ""; for (byte t = 0; t<input.length(); t++) { c = input[t]; if (c == '+') c = ' '; if (c == '%') { t++; c = input[t]; t++; c = (h2int(c) << 4) | h2int(input[t]); } ret.concat(c); } return ret; } String urlencode(String str) { String encodedString = ""; char c; char code0; char code1; //char code2; for (unsigned int i = 0; i < str.length(); i++) { c = str.charAt(i); if (c == ' ') { encodedString += '+'; } else if (isalnum(c)) { encodedString += c; } else { code1 = (c & 0xf) + '0'; if ((c & 0xf) >9) { code1 = (c & 0xf) - 10 + 'A'; } c = (c >> 4) & 0xf; code0 = c + '0'; if (c > 9) { code0 = c - 10 + 'A'; } //code2 = '\0'; encodedString += '%'; encodedString += code0; encodedString += code1; //encodedString+=code2; } yield(); } return encodedString; } //format bytes String formatBytes(size_t bytes) { if (bytes < 1024) { return String(bytes) + "B"; } else if (bytes < (1024 * 1024)) { return String(bytes / 1024.0) + "KB"; } else if (bytes < (1024 * 1024 * 1024)) { return String(bytes / 1024.0 / 1024.0) + "MB"; } else { return String(bytes / 1024.0 / 1024.0 / 1024.0) + "GB"; } } String getContentType(String filename) { if (server.hasArg("download")) return PSTR("application/octet-stream"); else if (filename.endsWith(PSTR(".htm"))) return PSTR("text/html"); else if (filename.endsWith(PSTR(".html"))) return PSTR("text/html"); else if (filename.endsWith(PSTR(".css"))) return PSTR("text/css"); else if (filename.endsWith(PSTR(".js"))) return PSTR("application/javascript"); else if (filename.endsWith(PSTR(".png"))) return PSTR("image/png"); else if (filename.endsWith(PSTR(".gif"))) return PSTR("image/gif"); else if (filename.endsWith(PSTR(".jpg"))) return PSTR("image/jpeg"); else if (filename.endsWith(PSTR(".ico"))) return PSTR("image/x-icon"); else if (filename.endsWith(PSTR(".xml"))) return PSTR("text/xml"); else if (filename.endsWith(PSTR(".pdf"))) return PSTR("application/x-pdf"); else if (filename.endsWith(PSTR(".zip"))) return PSTR("application/x-zip"); else if (filename.endsWith(PSTR(".gz"))) return PSTR("application/x-gzip"); return "text/plain"; } bool handleFileRead(String path) { // DBG_OUTPUT_PORT.println("handleFileRead: " + path); if (path.endsWith("/")) path += FPSTR(FILE_INDEX); if(path.indexOf(".")==-1) path += FPSTR(FILE_INDEX); //some body asking non existing service. can happen as well with react routing String contentType = getContentType(path); path= urldecode(path); String pathWithGz = path + ".gz"; if (SPIFFS.exists(pathWithGz) || SPIFFS.exists(path)) { if (SPIFFS.exists(pathWithGz)) path += ".gz"; File file = SPIFFS.open(path, "r"); server.sendHeader(PSTR("Access-Control-Allow-Origin"), "*"); size_t sent = server.streamFile(file, contentType); file.close(); return true; } return false; } void handleFileUpload() { // DBG_OUTPUT_PORT.println("file upload start"); if (server.uri() != "/upload") return; HTTPUpload& upload = server.upload(); if (upload.status == UPLOAD_FILE_START) { String filename = upload.filename; if (!filename.startsWith("/")) filename = "/" + filename; String dirname = ""; if (server.hasArg("dir")) { dirname = server.arg("dir"); if (dirname.length() > 0) { if (!dirname.startsWith("/")) dirname = "/" + dirname; filename = dirname + filename; } } //DBG_OUTPUT_PORT.print("handleFileUpload filename: "); //DBG_OUTPUT_PORT.println(filename); fsUploadFile = SPIFFS.open(filename, "w"); filename = String(); } else if (upload.status == UPLOAD_FILE_WRITE) { //DBG_OUTPUT_PORT.print("handleFileUpload Data: "); DBG_OUTPUT_PORT.println(upload.currentSize); if (fsUploadFile) fsUploadFile.write(upload.buf, upload.currentSize); } else if (upload.status == UPLOAD_FILE_END) { if (fsUploadFile) fsUploadFile.close(); // DBG_OUTPUT_PORT.print(PSTR("handleFileUpload Size: ")); DBG_OUTPUT_PORT.println(upload.totalSize); } } bool handleFileDownload(const char* szName=NULL) { String path; if(szName==NULL){ if (server.args() == 0) { server.send(500, FPSTR(TEXT_PLAIN), PSTR("BAD ARGS")); return false; } path = server.arg(0); } else{ path=szName; } // DBG_OUTPUT_PORT.print("handleFileDownload: " + path); String contentType = "application/octet-stream"; path = "/" + path; path = urldecode(path); //check if a public file. if (SPIFFS.exists(path)) { File file = SPIFFS.open(path, "r"); server.streamFile(file, contentType); file.close(); return true; } return false; } void handleFileDeleteByName(String path) { // DBG_OUTPUT_PORT.println("handleFileDeleteByName: " + path); if (path == "/") return server.send(500, FPSTR(TEXT_PLAIN), PSTR("BAD PATH")); String filetodel= path; if(!filetodel.startsWith("/")) filetodel="/"+filetodel; if (!SPIFFS.exists(filetodel)) return server.send(404, FPSTR(TEXT_PLAIN), PSTR("FileNotFound")); SPIFFS.remove(filetodel); server.send(200, "text/plain", ""); } void handleFileDelete() { String path; //DBG_OUTPUT_PORT.println("handleFileDeleteByName start"); if (server.args() == 0) return server.send(500, FPSTR(TEXT_PLAIN), PSTR("BAD ARGS")); path = server.arg(0); handleFileDeleteByName(path); path = String(); } void handleFileCreate() { if (server.args() == 0) return server.send(500, FPSTR(TEXT_PLAIN), "BAD ARGS"); String path = server.arg(0); //DBG_OUTPUT_PORT.println("handleFileCreate: " + path); if (path == "/") return server.send(500, FPSTR(TEXT_PLAIN), PSTR("BAD PATH")); if (SPIFFS.exists(path)) return server.send(500, FPSTR(TEXT_PLAIN), PSTR("FILE EXISTS")); File file = SPIFFS.open(path, "w"); if (file) file.close(); else return server.send(500, FPSTR(TEXT_PLAIN), PSTR("CREATE FAILED")); server.send(200, FPSTR(TEXT_PLAIN), ""); path = String(); } void handleFileList() { String path = "/"; if (server.hasArg("dir")) { //server.send(500, FPSTR(TEXT_PLAIN), PSTR("BAD ARGS")); //return; path = server.arg("dir"); } #if defined(ESP8266) Dir dir = SPIFFS.openDir(path); #else File root = SPIFFS.open(path); if (!root) { //DBG_OUTPUT_PORT.println("- failed to open directory"); return; } if (!root.isDirectory()) { // DBG_OUTPUT_PORT.println(" - not a directory"); return; } #endif String output = "{\"success\":true, \"is_writable\" : true, \"results\" :["; bool firstrec = true; #if !defined(ESP8266) File file = root.openNextFile(); while (file){ #else while (dir.next()) { #endif if (!firstrec) { output += ','; } //add comma between recs (not first rec) else { firstrec = false; } #if !defined(ESP8266) //if (file.isDirectory()) // continue; String fn = file.name(); #else String fn = dir.fileName(); #endif #if !defined(ESP8266) fn.remove(0, 1); //remove slash if (file.isDirectory()) { output += "{\"is_dir\":true"; } else { output += "{\"is_dir\":false"; } #else fn.remove(0, 1); //remove slash output += "{\"is_dir\":false"; #endif output += ",\"name\":\"" + fn; #if !defined(ESP8266) output += "\",\"size\":" + String(file.size()); #else output += "\",\"size\":" + String(dir.fileSize()); #endif output += ",\"path\":\""; output += "\",\"is_deleteable\":true"; output += ",\"is_readable\":true"; output += ",\"is_writable\":true"; output += ",\"is_executable\":true"; output += ",\"mtime\":1452813740"; //dummy time output += "}"; #if !defined(ESP8266) file = root.openNextFile(); #endif } output += "]}"; //DebugPrintln("got list >"+output); server.send(200, "text/json", output); /* //String path = server.arg("dir"); DBG_OUTPUT_PORT.println("handleFileList: " + path); Dir dir = SPIFFS.openDir(path); path = String(); String output = "["; while (dir.next()) { File entry = dir.openFile("r"); if (output != "[") output += ','; bool isDir = false; output += "{\"type\":\""; output += (isDir) ? "dir" : "file"; output += "\",\"name\":\""; output += String(entry.name()).substring(1); output += "\"}"; entry.close(); } output += "]"; server.sendHeader("Access-Control-Allow-Origin", "*"); server.send(200, "text/json", output); */ } void saveFileBrowse(){ //DBG_OUTPUT_PORT.println("saveFileBrowse: " ); String data=FPSTR(FILE_BROWSE_HTML); File fb = SPIFFS.open(FPSTR(FILE_BROWSE_FILE), "w"); if(fb) fb.print(data); if(fb) fb.close(); // DBG_OUTPUT_PORT.println("saveFileBrowse: " ); } void saveIndex(){ String data=FPSTR(INDEX_HTML); File fb = SPIFFS.open(String("/")+String(FPSTR(FILE_INDEX)), "w"); if(fb) fb.print(data); if(fb) fb.close(); } void handleFileBrowser() { if (server.arg("do") == "list") { handleFileList(); } else if (server.arg("do") == "delete") { handleFileDeleteByName(server.arg("file").c_str()); } else if (server.arg("do") == "download") { handleFileDownload(server.arg("file").c_str()); } else { SPIFFS.remove(FPSTR(FILE_BROWSE_FILE)); if (!SPIFFS.exists(FPSTR(FILE_BROWSE_FILE))){ saveFileBrowse(); } if (!handleFileRead(FPSTR(FILE_BROWSE_FILE))) { //send GZ version of embedded browser //server.sendHeader("Content-Encoding", "gzip"); //server.send_P(200, "text/html", PAGE_FSBROWSE, sizeof(PAGE_FSBROWSE)); server.send(500, FPSTR(TEXT_PLAIN), "handleFileBrowser can't proceed"); } //MyWebServer.isDownloading = true; //need to stop all cloud services from doing anything! crashes on upload with mqtt... } } void handleJsonSave() { if (server.args() == 0) return server.send(500, FPSTR(TEXT_PLAIN), PSTR("BAD JsonSave ARGS")); String fname = "/" + server.arg(0); fname = urldecode(fname); //DBG_OUTPUT_PORT.println("handleJsonSave: " + fname); File file = SPIFFS.open(fname, "w"); if (file) { file.println(server.arg(1)); //save json data file.close(); } else //cant create file return server.send(500, FPSTR(TEXT_PLAIN), PSTR("JSONSave FAILED")); server.send(200, FPSTR(TEXT_PLAIN), ""); } void handleJsonLoad() { if (server.args() == 0) return server.send(500, "text/plain", "BAD JsonLoad ARGS"); String fname = "/" + server.arg(0); fname = urldecode(fname); //DBG_OUTPUT_PORT.println("handleJsonRead: " + fname); File file = SPIFFS.open(fname, "r"); if (file) { server.streamFile(file, "application/json"); file.close(); } } void handleNotFound() { String message = "File Not Found\n\n"; message += "URI: "; message += server.uri(); message += "\nMethod: "; message += (server.method() == HTTP_GET) ? "GET" : "POST"; message += "\nArguments: "; message += server.args(); message += "\n"; for (uint8_t i = 0; i < server.args(); i++) { message += " " + server.argName(i) + ": " + server.arg(i) + "\n"; } server.send(404, "text/plain", message); }
29.533605
132
0.619819
b7b92d28a193d76ed908b3472e02164a06e8cc00
17,480
c
C
nRF5_SDK_17.0.0_9d13099/components/serialization/common/transport/ser_hal_transport.c
Michaelhobo/nrf5_sdk17.0.0
1ac0daa9b6a4f359cefb6feda4ea38335f53b14d
[ "MIT" ]
13
2019-07-31T00:41:38.000Z
2022-01-29T07:37:10.000Z
nRF5_SDK_17.0.0_9d13099/components/serialization/common/transport/ser_hal_transport.c
Michaelhobo/nrf5_sdk17.0.0
1ac0daa9b6a4f359cefb6feda4ea38335f53b14d
[ "MIT" ]
7
2019-09-27T21:36:46.000Z
2021-01-20T09:03:02.000Z
nRF5_SDK_17.0.0_9d13099/components/serialization/common/transport/ser_hal_transport.c
Michaelhobo/nrf5_sdk17.0.0
1ac0daa9b6a4f359cefb6feda4ea38335f53b14d
[ "MIT" ]
14
2019-10-14T21:54:05.000Z
2021-12-12T00:39:27.000Z
/** * Copyright (c) 2014 - 2020, Nordic Semiconductor ASA * * 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, except as embedded into a Nordic * Semiconductor ASA integrated circuit in a product or a software update for * such product, 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. * * 3. Neither the name of Nordic Semiconductor ASA nor the names of its * contributors may be used to endorse or promote products derived from this * software without specific prior written permission. * * 4. This software, with or without modification, must only be used with a * Nordic Semiconductor ASA integrated circuit. * * 5. Any software provided in binary form under this license must not be reverse * engineered, decompiled, modified and/or disassembled. * * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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. * */ #include <stdbool.h> #include <string.h> #include "app_error.h" #include "sdk_config.h" #include "ser_config.h" #include "ser_phy.h" #include "ser_hal_transport.h" #if defined(APP_SCHEDULER_WITH_PAUSE) && APP_SCHEDULER_WITH_PAUSE #include "app_scheduler.h" #endif #define NRF_LOG_MODULE_NAME ser_hal_transport #if SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED #define NRF_LOG_LEVEL SER_HAL_TRANSPORT_CONFIG_LOG_LEVEL #define NRF_LOG_INFO_COLOR SER_HAL_TRANSPORT_CONFIG_INFO_COLOR #define NRF_LOG_DEBUG_COLOR SER_HAL_TRANSPORT_CONFIG_DEBUG_COLOR #else //SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED #define NRF_LOG_LEVEL 0 #endif //SER_HAL_TRANSPORT_CONFIG_LOG_ENABLED #include "nrf_log.h" NRF_LOG_MODULE_REGISTER(); /** * @brief States of the RX state machine. */ typedef enum { HAL_TRANSP_RX_STATE_CLOSED = 0, HAL_TRANSP_RX_STATE_IDLE, HAL_TRANSP_RX_STATE_RECEIVING, HAL_TRANSP_RX_STATE_DROPPING, HAL_TRANSP_RX_STATE_RECEIVED, HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ, HAL_TRANSP_RX_STATE_RECEIVED_DROPPING, HAL_TRANSP_RX_STATE_MAX }ser_hal_transp_rx_states_t; /** * @brief States of the TX state machine. */ typedef enum { HAL_TRANSP_TX_STATE_CLOSED = 0, HAL_TRANSP_TX_STATE_IDLE, HAL_TRANSP_TX_STATE_TX_ALLOCATED, HAL_TRANSP_TX_STATE_TRANSMITTING, HAL_TRANSP_TX_STATE_TRANSMITTED, HAL_TRANSP_TX_STATE_MAX }ser_hal_transp_tx_states_t; /** * @brief RX state. */ static ser_hal_transp_rx_states_t m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; /** * @brief TX state. */ static ser_hal_transp_tx_states_t m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; /** * @brief Transmission buffer. */ static uint8_t m_tx_buffer[SER_HAL_TRANSPORT_TX_MAX_PKT_SIZE]; /** * @brief Reception buffer. */ static uint8_t m_rx_buffer[SER_HAL_TRANSPORT_RX_MAX_PKT_SIZE]; /** * @brief Callback function handler for Serialization HAL Transport layer events. */ static ser_hal_transport_events_handler_t m_events_handler = NULL; /** * @brief A callback function to be used to handle a PHY module events. This function is called in * an interrupt context. */ static void phy_events_handler(ser_phy_evt_t phy_event) { uint32_t err_code = 0; ser_hal_transport_evt_t hal_transp_event; memset(&hal_transp_event, 0, sizeof (ser_hal_transport_evt_t)); hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TYPE_MAX; NRF_LOG_INFO("phy evt:%d", phy_event.evt_type); switch (phy_event.evt_type) { case SER_PHY_EVT_TX_PKT_SENT: { if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state) { m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED; NRF_LOG_INFO("tx free"); err_code = ser_hal_transport_tx_pkt_free(m_tx_buffer); APP_ERROR_CHECK(err_code); /* An event to an upper layer that a packet has been transmitted. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_TX_PKT_SENT; m_events_handler(hal_transp_event); } else { /* Lower layer should not generate this event in current state. */ APP_ERROR_CHECK_BOOL(false); } break; } case SER_PHY_EVT_RX_BUF_REQUEST: { /* An event to an upper layer that a packet is being scheduled to receive or to drop. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_RECEIVING; /* Receive or drop a packet. */ if (phy_event.evt_params.rx_buf_request.num_of_bytes <= sizeof (m_rx_buffer)) { if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state) { m_events_handler(hal_transp_event); err_code = ser_phy_rx_buf_set(m_rx_buffer); APP_ERROR_CHECK(err_code); m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING; } else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) { /* It is OK to get know higher layer at this point that we are going to receive * a new packet even though we will start receiving when rx buffer is freed. */ m_events_handler(hal_transp_event); m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ; } else { /* Lower layer should not generate this event in current state. */ APP_ERROR_CHECK_BOOL(false); } } else { /* There is not enough memory but packet has to be received to dummy location. */ if (HAL_TRANSP_RX_STATE_IDLE == m_rx_state) { m_events_handler(hal_transp_event); err_code = ser_phy_rx_buf_set(NULL); APP_ERROR_CHECK(err_code); m_rx_state = HAL_TRANSP_RX_STATE_DROPPING; } else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) { m_events_handler(hal_transp_event); err_code = ser_phy_rx_buf_set(NULL); APP_ERROR_CHECK(err_code); m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED_DROPPING; } else { /* Lower layer should not generate this event in current state. */ APP_ERROR_CHECK_BOOL(false); } } break; } case SER_PHY_EVT_RX_PKT_RECEIVED: { if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state) { m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; /* Generate the event to an upper layer. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_RECEIVED; hal_transp_event.evt_params.rx_pkt_received.p_buffer = phy_event.evt_params.rx_pkt_received.p_buffer; hal_transp_event.evt_params.rx_pkt_received.num_of_bytes = phy_event.evt_params.rx_pkt_received.num_of_bytes; m_events_handler(hal_transp_event); } else { /* Lower layer should not generate this event in current state. */ APP_ERROR_CHECK_BOOL(false); } break; } case SER_PHY_EVT_RX_PKT_DROPPED: { if (HAL_TRANSP_RX_STATE_DROPPING == m_rx_state) { /* Generate the event to an upper layer. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED; m_events_handler(hal_transp_event); m_rx_state = HAL_TRANSP_RX_STATE_IDLE; } else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state) { /* Generate the event to an upper layer. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_RX_PKT_DROPPED; m_events_handler(hal_transp_event); m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; } else { /* Lower layer should not generate this event in current state. */ APP_ERROR_CHECK_BOOL(false); } break; } case SER_PHY_EVT_RX_OVERFLOW_ERROR: { /* Generate the event to an upper layer. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; hal_transp_event.evt_params.phy_error.error_type = SER_HAL_TRANSP_PHY_ERROR_RX_OVERFLOW; m_events_handler(hal_transp_event); break; } case SER_PHY_EVT_TX_OVERREAD_ERROR: { /* Generate the event to an upper layer. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; hal_transp_event.evt_params.phy_error.error_type = SER_HAL_TRANSP_PHY_ERROR_TX_OVERREAD; m_events_handler(hal_transp_event); break; } case SER_PHY_EVT_HW_ERROR: { /* Generate the event to an upper layer. */ hal_transp_event.evt_type = SER_HAL_TRANSP_EVT_PHY_ERROR; hal_transp_event.evt_params.phy_error.error_type = SER_HAL_TRANSP_PHY_ERROR_HW_ERROR; hal_transp_event.evt_params.phy_error.hw_error_code = phy_event.evt_params.hw_error.error_code; if (HAL_TRANSP_TX_STATE_TRANSMITTING == m_tx_state) { m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTED; err_code = ser_hal_transport_tx_pkt_free(phy_event.evt_params.hw_error.p_buffer); APP_ERROR_CHECK(err_code); #if defined(APP_SCHEDULER_WITH_PAUSE) && APP_SCHEDULER_WITH_PAUSE app_sched_resume(); #endif /* An event to an upper layer that a packet has been transmitted. */ } else if (HAL_TRANSP_RX_STATE_RECEIVING == m_rx_state) { m_rx_state = HAL_TRANSP_RX_STATE_RECEIVED; err_code = ser_hal_transport_rx_pkt_free(phy_event.evt_params.hw_error.p_buffer); APP_ERROR_CHECK(err_code); } m_events_handler(hal_transp_event); break; } default: { APP_ERROR_CHECK_BOOL(false); break; } } } void ser_hal_transport_reset(void) { m_rx_state = HAL_TRANSP_RX_STATE_IDLE; m_tx_state = HAL_TRANSP_TX_STATE_IDLE; } uint32_t ser_hal_transport_open(ser_hal_transport_events_handler_t events_handler) { uint32_t err_code = NRF_SUCCESS; if ((HAL_TRANSP_RX_STATE_CLOSED != m_rx_state) || (HAL_TRANSP_TX_STATE_CLOSED != m_tx_state)) { err_code = NRF_ERROR_INVALID_STATE; } else if (NULL == events_handler) { err_code = NRF_ERROR_NULL; } else { /* We have to change states before calling lower layer because ser_phy_open() function is * going to enable interrupts. On success an event from PHY layer can be emitted immediately * after return from ser_phy_open(). */ m_rx_state = HAL_TRANSP_RX_STATE_IDLE; m_tx_state = HAL_TRANSP_TX_STATE_IDLE; m_events_handler = events_handler; /* Initialize a PHY module. */ err_code = ser_phy_open(phy_events_handler); if (NRF_SUCCESS != err_code) { m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; m_events_handler = NULL; if (NRF_ERROR_INVALID_PARAM != err_code) { err_code = NRF_ERROR_INTERNAL; } } } return err_code; } void ser_hal_transport_close(void) { /* Reset generic handler for all events, reset internal states and close PHY module. */ ser_phy_interrupts_disable(); m_rx_state = HAL_TRANSP_RX_STATE_CLOSED; m_tx_state = HAL_TRANSP_TX_STATE_CLOSED; m_events_handler = NULL; ser_phy_close(); } uint32_t ser_hal_transport_rx_pkt_free(uint8_t * p_buffer) { NRF_LOG_INFO("rx pkt free:%d", p_buffer); uint32_t err_code = NRF_SUCCESS; ser_phy_interrupts_disable(); if (NULL == p_buffer) { err_code = NRF_ERROR_NULL; } else if (p_buffer != m_rx_buffer) { err_code = NRF_ERROR_INVALID_ADDR; } else if (HAL_TRANSP_RX_STATE_RECEIVED == m_rx_state) { m_rx_state = HAL_TRANSP_RX_STATE_IDLE; } else if (HAL_TRANSP_RX_STATE_RECEIVED_DROPPING == m_rx_state) { m_rx_state = HAL_TRANSP_RX_STATE_DROPPING; } else if (HAL_TRANSP_RX_STATE_RECEIVED_PENDING_BUF_REQ == m_rx_state) { err_code = ser_phy_rx_buf_set(m_rx_buffer); if (NRF_SUCCESS == err_code) { m_rx_state = HAL_TRANSP_RX_STATE_RECEIVING; } else { err_code = NRF_ERROR_INTERNAL; } } else { /* Upper layer should not call this function in current state. */ err_code = NRF_ERROR_INVALID_STATE; } ser_phy_interrupts_enable(); return err_code; } uint32_t ser_hal_transport_tx_pkt_alloc(uint8_t * * pp_memory, uint16_t * p_num_of_bytes) { uint32_t err_code = NRF_SUCCESS; if ((NULL == pp_memory) || (NULL == p_num_of_bytes)) { err_code = NRF_ERROR_NULL; } else if (HAL_TRANSP_TX_STATE_CLOSED == m_tx_state) { err_code = NRF_ERROR_INVALID_STATE; } else if (HAL_TRANSP_TX_STATE_IDLE == m_tx_state) { m_tx_state = HAL_TRANSP_TX_STATE_TX_ALLOCATED; *pp_memory = &m_tx_buffer[0]; *p_num_of_bytes = (uint16_t)sizeof (m_tx_buffer); } else { err_code = NRF_ERROR_NO_MEM; } return err_code; } uint32_t ser_hal_transport_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes) { uint32_t err_code = NRF_SUCCESS; /* The buffer provided to this function must be allocated through ser_hal_transport_tx_alloc() * function - this assures correct state and that correct memory buffer is used. */ if (NULL == p_buffer) { err_code = NRF_ERROR_NULL; } else if (0 == num_of_bytes) { err_code = NRF_ERROR_INVALID_PARAM; } else if (p_buffer != m_tx_buffer) { err_code = NRF_ERROR_INVALID_ADDR; } else if (num_of_bytes > sizeof (m_tx_buffer)) { err_code = NRF_ERROR_DATA_SIZE; } else if (HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) { ser_phy_interrupts_disable(); err_code = ser_phy_tx_pkt_send(p_buffer, num_of_bytes); if (NRF_SUCCESS == err_code) { m_tx_state = HAL_TRANSP_TX_STATE_TRANSMITTING; } else { if (NRF_ERROR_BUSY != err_code) { err_code = NRF_ERROR_INTERNAL; } } ser_phy_interrupts_enable(); } else { err_code = NRF_ERROR_INVALID_STATE; } return err_code; } uint32_t ser_hal_transport_tx_pkt_free(uint8_t * p_buffer) { uint32_t err_code = NRF_SUCCESS; if (NULL == p_buffer) { err_code = NRF_ERROR_NULL; } else if (p_buffer != m_tx_buffer) { err_code = NRF_ERROR_INVALID_ADDR; } else if ((HAL_TRANSP_TX_STATE_TX_ALLOCATED == m_tx_state) || (HAL_TRANSP_TX_STATE_TRANSMITTED == m_tx_state)) { /* Release TX buffer for use. */ m_tx_state = HAL_TRANSP_TX_STATE_IDLE; } else { err_code = NRF_ERROR_INVALID_STATE; } return err_code; }
33.941748
101
0.617334
4e09191ae0738f40870fc9a2e15094058ba972b2
1,950
h
C
winsdkfb-master/FBWinSDK/FBWinSDK/FBWinSDK.Shared/FacebookProfilePictureControl.xaml.h
NestedWorld/NestedWorld-Windows-10
96e9e8d8b97199bc1d9ce3f8cd5133e63db513a5
[ "MIT" ]
null
null
null
winsdkfb-master/FBWinSDK/FBWinSDK/FBWinSDK.Shared/FacebookProfilePictureControl.xaml.h
NestedWorld/NestedWorld-Windows-10
96e9e8d8b97199bc1d9ce3f8cd5133e63db513a5
[ "MIT" ]
null
null
null
winsdkfb-master/FBWinSDK/FBWinSDK/FBWinSDK.Shared/FacebookProfilePictureControl.xaml.h
NestedWorld/NestedWorld-Windows-10
96e9e8d8b97199bc1d9ce3f8cd5133e63db513a5
[ "MIT" ]
null
null
null
//****************************************************************************** // // Copyright (c) 2015 Microsoft Corporation. All rights reserved. // // This code is licensed under the MIT License (MIT). // // 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. // //****************************************************************************** // // ProfilePictureControl.xaml.h // Declaration of the ProfilePictureControl class // #pragma once #include "FacebookProfilePictureControl.g.h" #include "FBProfilePicture.h" #include "FacebookResult.h" using namespace Platform; using namespace Windows::UI::Xaml::Controls; namespace Facebook { public enum class CroppingType { Square = 0, Original = 1 }; [Windows::Foundation::Metadata::WebHostHidden] public ref class ProfilePictureControl sealed { public: ProfilePictureControl(); property String^ UserId { String^ get(); void set(String^ value); } property CroppingType CropMode { CroppingType get(); void set(CroppingType value); } private: void SetImageSourceFromUserId( ); void SetImageSourceFromResource( ); void Update( ); concurrency::task<Facebook::FBResult^> GetProfilePictureInfo( int width, int height ); bool _userIdValid; String^ _UserId; CroppingType _CropMode; }; }
25
81
0.592308
4369373919dbfb1f936de49691ab6392502e298b
1,762
h
C
src/cc/customcc.h
dimxy/sfusd-core
cd8b2368dde92cac6fdbda3925e31d56ab98a19e
[ "MIT" ]
1
2021-09-26T23:30:41.000Z
2021-09-26T23:30:41.000Z
src/cc/customcc.h
dimxy/sfusd-core
cd8b2368dde92cac6fdbda3925e31d56ab98a19e
[ "MIT" ]
1
2020-12-06T11:34:14.000Z
2020-12-06T11:34:14.000Z
src/cc/customcc.h
dimxy/sfusd-core
cd8b2368dde92cac6fdbda3925e31d56ab98a19e
[ "MIT" ]
3
2020-12-03T13:01:04.000Z
2021-03-17T17:51:02.000Z
/* to create a custom libcc.so: 1. change "func0" and "func1" to method names that fit your custom cc. Of course, you can create more functions by adding another entry to RPC_FUNCS. there is not any practical limit to the number of methods. 2. For each method make sure there is a UniValue function declaration and CUSTOM_DISPATCH has an if statement checking for it that calls the custom_func 3. write the actual custom_func0, custom_func1 and custom_validate in customcc.cpp 4. ./makecustom, which builds cclib.cpp with -DBUILD_CUSTOMCC and puts the libcc.so in ~/komodo/src and rebuilds komodod 5. launch your chain with -ac_cclib=customcc -ac_cc=2 */ std::string MYCCLIBNAME = (char *)"customcc"; #define EVAL_CUSTOM (EVAL_FAUCET2+1) #define CUSTOM_TXFEE 10000 #define MYCCNAME "custom" #define RPC_FUNCS \ { (char *)MYCCNAME, (char *)"func0", (char *)"<parameter help>", 1, 1, '0', EVAL_CUSTOM }, \ { (char *)MYCCNAME, (char *)"func1", (char *)"<no args>", 0, 0, '1', EVAL_CUSTOM }, bool custom_validate(struct CCcontract_info *cp,int32_t height,Eval *eval,const CTransaction tx); UniValue custom_func0(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); UniValue custom_func1(uint64_t txfee,struct CCcontract_info *cp,cJSON *params); #define CUSTOM_DISPATCH \ if ( cp->evalcode == EVAL_CUSTOM ) \ { \ if ( strcmp(method,"func0") == 0 ) \ return(custom_func0(txfee,cp,params)); \ else if ( strcmp(method,"func1") == 0 ) \ return(custom_func1(txfee,cp,params)); \ else \ { \ result.push_back(Pair("result","error")); \ result.push_back(Pair("error","invalid customcc method")); \ result.push_back(Pair("method",method)); \ return(result); \ } \ }
38.304348
209
0.694665
ffc1f573686de90a4eaede0c5665029f44c4aa7f
380
c
C
initfb.c
junhuanchen/framebuffer-go
503255091bf0825e156191650ffe6535cc419053
[ "0BSD" ]
2
2018-10-28T09:56:09.000Z
2021-09-05T13:18:09.000Z
initfb.c
junhuanchen/framebuffer-go
503255091bf0825e156191650ffe6535cc419053
[ "0BSD" ]
null
null
null
initfb.c
junhuanchen/framebuffer-go
503255091bf0825e156191650ffe6535cc419053
[ "0BSD" ]
3
2017-04-03T05:13:47.000Z
2018-09-09T08:48:30.000Z
#include "fb.h" #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> int initfb(char *filename, fb_info_t *fbinfo) { fbinfo->fd = open(filename, O_RDWR); if(fbinfo->fd < 0) { return -1; } if(ioctl(fbinfo->fd, FBIOGET_FSCREENINFO, &fbinfo->fix_info) < 0) { return -1; } if(ioctl(fbinfo->fd, FBIOGET_VSCREENINFO, &fbinfo->var_info) < 0) { return -1; } }
18.095238
68
0.647368
94f0f6cb82b150d7eec0f2d70b68201e0bbb25f0
7,479
c
C
Boss2D/addon/boss_integration_curl-7.51.0.c
Yash-Wasalwar-07/Boss2D
37c5ba0f1c83c89810359a207cabfa0905f803d2
[ "MIT" ]
null
null
null
Boss2D/addon/boss_integration_curl-7.51.0.c
Yash-Wasalwar-07/Boss2D
37c5ba0f1c83c89810359a207cabfa0905f803d2
[ "MIT" ]
null
null
null
Boss2D/addon/boss_integration_curl-7.51.0.c
Yash-Wasalwar-07/Boss2D
37c5ba0f1c83c89810359a207cabfa0905f803d2
[ "MIT" ]
null
null
null
#include <boss.h> #if BOSS_NEED_ADDON_CURL #if BOSS_WINDOWS #pragma comment(lib, "ws2_32.lib") #pragma comment(lib, "wldap32.lib") #endif #pragma warning(disable : 4090) #if BOSS_ARM #define _M_ARM #endif #if !BOSS_WINDOWS | BOSS_NEED_FORCED_FAKEWIN #define __pragma(...) #define struct_stat_BOSS struct boss_fakewin_struct_stat64 #else #define struct_stat_BOSS struct stat #endif #include "boss_integration_curl-7.51.0.h" #define delay Sleep #include <addon/curl-7.51.0_for_boss/lib/amigaos.c> #include <addon/curl-7.51.0_for_boss/lib/asyn-ares.c> #include <addon/curl-7.51.0_for_boss/lib/asyn-thread.c> #include <addon/curl-7.51.0_for_boss/lib/base64.c> #include <addon/curl-7.51.0_for_boss/lib/conncache.c> #include <addon/curl-7.51.0_for_boss/lib/connect.c> #include <addon/curl-7.51.0_for_boss/lib/content_encoding.c> #include <addon/curl-7.51.0_for_boss/lib/cookie.c> #include <addon/curl-7.51.0_for_boss/lib/curl_addrinfo.c> #include <addon/curl-7.51.0_for_boss/lib/curl_des.c> #include <addon/curl-7.51.0_for_boss/lib/curl_endian.c> #include <addon/curl-7.51.0_for_boss/lib/curl_fnmatch.c> #include <addon/curl-7.51.0_for_boss/lib/curl_gethostname.c> #include <addon/curl-7.51.0_for_boss/lib/curl_gssapi.c> #include <addon/curl-7.51.0_for_boss/lib/curl_memrchr.c> #include <addon/curl-7.51.0_for_boss/lib/curl_multibyte.c> #include <addon/curl-7.51.0_for_boss/lib/curl_ntlm_core.c> #include <addon/curl-7.51.0_for_boss/lib/curl_ntlm_wb.c> #include <addon/curl-7.51.0_for_boss/lib/curl_rtmp.c> #include <addon/curl-7.51.0_for_boss/lib/curl_sasl.c> #include <addon/curl-7.51.0_for_boss/lib/curl_sspi.c> #include <addon/curl-7.51.0_for_boss/lib/curl_threads.c> #include <addon/curl-7.51.0_for_boss/lib/dict.c> #include <addon/curl-7.51.0_for_boss/lib/dotdot.c> #include <addon/curl-7.51.0_for_boss/lib/easy.c> #include <addon/curl-7.51.0_for_boss/lib/escape.c> #include <addon/curl-7.51.0_for_boss/lib/file.c> #include <addon/curl-7.51.0_for_boss/lib/fileinfo.c> #include <addon/curl-7.51.0_for_boss/lib/formdata.c> #include <addon/curl-7.51.0_for_boss/lib/ftp.c> #include <addon/curl-7.51.0_for_boss/lib/ftplistparser.c> #include <addon/curl-7.51.0_for_boss/lib/getenv.c> #include <addon/curl-7.51.0_for_boss/lib/getinfo.c> #include <addon/curl-7.51.0_for_boss/lib/gopher.c> #include <addon/curl-7.51.0_for_boss/lib/hash.c> #include <addon/curl-7.51.0_for_boss/lib/hmac.c> #include <addon/curl-7.51.0_for_boss/lib/hostasyn.c> #include <addon/curl-7.51.0_for_boss/lib/hostcheck.c> #include <addon/curl-7.51.0_for_boss/lib/hostip.c> #include <addon/curl-7.51.0_for_boss/lib/hostip4.c> #include <addon/curl-7.51.0_for_boss/lib/hostip6.c> #include <addon/curl-7.51.0_for_boss/lib/hostsyn.c> #include <addon/curl-7.51.0_for_boss/lib/http.c> #include <addon/curl-7.51.0_for_boss/lib/http2.c> #include <addon/curl-7.51.0_for_boss/lib/http_chunks.c> #include <addon/curl-7.51.0_for_boss/lib/http_digest.c> #include <addon/curl-7.51.0_for_boss/lib/http_negotiate.c> #include <addon/curl-7.51.0_for_boss/lib/http_ntlm.c> #include <addon/curl-7.51.0_for_boss/lib/http_proxy.c> #include <addon/curl-7.51.0_for_boss/lib/idn_win32.c> #include <addon/curl-7.51.0_for_boss/lib/if2ip.c> #include <addon/curl-7.51.0_for_boss/lib/imap.c> #include <addon/curl-7.51.0_for_boss/lib/inet_ntop.c> #include <addon/curl-7.51.0_for_boss/lib/inet_pton.c> #include <addon/curl-7.51.0_for_boss/lib/krb5.c> #include <addon/curl-7.51.0_for_boss/lib/ldap.c> #include <addon/curl-7.51.0_for_boss/lib/llist.c> #include <addon/curl-7.51.0_for_boss/lib/md4.c> #include <addon/curl-7.51.0_for_boss/lib/md5.c> #include <addon/curl-7.51.0_for_boss/lib/memdebug.c> #include <addon/curl-7.51.0_for_boss/lib/mprintf.c> #include <addon/curl-7.51.0_for_boss/lib/multi.c> #include <addon/curl-7.51.0_for_boss/lib/netrc.c> #include <addon/curl-7.51.0_for_boss/lib/non-ascii.c> #include <addon/curl-7.51.0_for_boss/lib/nonblock.c> #include <addon/curl-7.51.0_for_boss/lib/nwlib.c> #include <addon/curl-7.51.0_for_boss/lib/nwos.c> #include <addon/curl-7.51.0_for_boss/lib/openldap.c> #include <addon/curl-7.51.0_for_boss/lib/parsedate.c> #include <addon/curl-7.51.0_for_boss/lib/pingpong.c> #include <addon/curl-7.51.0_for_boss/lib/pipeline.c> #include <addon/curl-7.51.0_for_boss/lib/pop3.c> #include <addon/curl-7.51.0_for_boss/lib/progress.c> #include <addon/curl-7.51.0_for_boss/lib/rtsp.c> #include <addon/curl-7.51.0_for_boss/lib/security.c> #include <addon/curl-7.51.0_for_boss/lib/select.c> #include <addon/curl-7.51.0_for_boss/lib/sendf.c> #include <addon/curl-7.51.0_for_boss/lib/share.c> #include <addon/curl-7.51.0_for_boss/lib/slist.c> #include <addon/curl-7.51.0_for_boss/lib/smb.c> #include <addon/curl-7.51.0_for_boss/lib/smtp.c> #include <addon/curl-7.51.0_for_boss/lib/socks.c> #include <addon/curl-7.51.0_for_boss/lib/socks_gssapi.c> #include <addon/curl-7.51.0_for_boss/lib/socks_sspi.c> #include <addon/curl-7.51.0_for_boss/lib/speedcheck.c> #include <addon/curl-7.51.0_for_boss/lib/splay.c> #include <addon/curl-7.51.0_for_boss/lib/ssh.c> #include <addon/curl-7.51.0_for_boss/lib/strcase.c> #include <addon/curl-7.51.0_for_boss/lib/strdup.c> #include <addon/curl-7.51.0_for_boss/lib/strerror.c> #include <addon/curl-7.51.0_for_boss/lib/strtok.c> #include <addon/curl-7.51.0_for_boss/lib/strtoofft.c> #include <addon/curl-7.51.0_for_boss/lib/system_win32.c> #include <addon/curl-7.51.0_for_boss/lib/telnet.c> #include <addon/curl-7.51.0_for_boss/lib/tftp.c> #include <addon/curl-7.51.0_for_boss/lib/timeval.c> #include <addon/curl-7.51.0_for_boss/lib/transfer.c> #include <addon/curl-7.51.0_for_boss/lib/url.c> #define protocols protocols_version_BOSS #include <addon/curl-7.51.0_for_boss/lib/version.c> #undef protocols #undef read #undef write #include <addon/curl-7.51.0_for_boss/lib/warnless.c> #include <addon/curl-7.51.0_for_boss/lib/wildcard.c> #include <addon/curl-7.51.0_for_boss/lib/x509asn1.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/cleartext.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/cram.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/digest.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/digest_sspi.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/krb5_gssapi.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/krb5_sspi.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/ntlm.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/ntlm_sspi.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/oauth2.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/spnego_gssapi.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/spnego_sspi.c> #include <addon/curl-7.51.0_for_boss/lib/vauth/vauth.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/axtls.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/cyassl.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/darwinssl.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/gskit.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/gtls.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/mbedtls.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/nss.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/openssl.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/polarssl.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/polarssl_threadlock.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/schannel.c> #include <addon/curl-7.51.0_for_boss/lib/vtls/vtls.c> #endif
46.74375
69
0.753978
cfdf970c5800fecbeee270bae96c14448a39f8a5
2,883
c
C
openeuler-kernel/sound/soc/intel/boards/sof_sdw_max98373.c
Ddnirvana/test-CI
dd7a0a71281075e8ab300bddbab4a9fa039958f0
[ "MulanPSL-1.0" ]
31
2021-04-27T08:50:40.000Z
2022-03-01T02:26:21.000Z
kernel/sound/soc/intel/boards/sof_sdw_max98373.c
SFIP/SFIP
e428a425d2d0e287f23d49f3dd583617ebd2e4a3
[ "Zlib" ]
13
2021-07-10T04:36:17.000Z
2022-03-03T10:50:05.000Z
kernel/sound/soc/intel/boards/sof_sdw_max98373.c
SFIP/SFIP
e428a425d2d0e287f23d49f3dd583617ebd2e4a3
[ "Zlib" ]
12
2021-04-06T02:23:10.000Z
2022-02-28T11:43:19.000Z
// SPDX-License-Identifier: GPL-2.0-only // Copyright (c) 2020 Intel Corporation // // sof_sdw_max98373 - Helpers to handle 2x MAX98373 // codec devices from generic machine driver #include <linux/device.h> #include <linux/errno.h> #include <sound/control.h> #include <sound/soc.h> #include <sound/soc-acpi.h> #include <sound/soc-dapm.h> #include "sof_sdw_common.h" #include "sof_maxim_common.h" static const struct snd_soc_dapm_widget mx8373_widgets[] = { SND_SOC_DAPM_SPK("Left Spk", NULL), SND_SOC_DAPM_SPK("Right Spk", NULL), }; static const struct snd_kcontrol_new mx8373_controls[] = { SOC_DAPM_PIN_SWITCH("Left Spk"), SOC_DAPM_PIN_SWITCH("Right Spk"), }; static int spk_init(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_card *card = rtd->card; int ret; card->components = devm_kasprintf(card->dev, GFP_KERNEL, "%s spk:mx8373", card->components); if (!card->components) return -ENOMEM; ret = snd_soc_add_card_controls(card, mx8373_controls, ARRAY_SIZE(mx8373_controls)); if (ret) { dev_err(card->dev, "mx8373 ctrls addition failed: %d\n", ret); return ret; } ret = snd_soc_dapm_new_controls(&card->dapm, mx8373_widgets, ARRAY_SIZE(mx8373_widgets)); if (ret) { dev_err(card->dev, "mx8373 widgets addition failed: %d\n", ret); return ret; } ret = snd_soc_dapm_add_routes(&card->dapm, max_98373_dapm_routes, 2); if (ret) dev_err(rtd->dev, "failed to add first SPK map: %d\n", ret); return ret; } static int max98373_sdw_trigger(struct snd_pcm_substream *substream, int cmd) { int ret; switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* enable max98373 first */ ret = max98373_trigger(substream, cmd); if (ret < 0) break; ret = sdw_trigger(substream, cmd); break; case SNDRV_PCM_TRIGGER_STOP: case SNDRV_PCM_TRIGGER_SUSPEND: case SNDRV_PCM_TRIGGER_PAUSE_PUSH: ret = sdw_trigger(substream, cmd); if (ret < 0) break; ret = max98373_trigger(substream, cmd); break; default: ret = -EINVAL; break; } return ret; } static const struct snd_soc_ops max_98373_sdw_ops = { .startup = sdw_startup, .prepare = sdw_prepare, .trigger = max98373_sdw_trigger, .hw_free = sdw_hw_free, .shutdown = sdw_shutdown, }; int sof_sdw_mx8373_init(const struct snd_soc_acpi_link_adr *link, struct snd_soc_dai_link *dai_links, struct sof_sdw_codec_info *info, bool playback) { info->amp_num++; if (info->amp_num == 2) dai_links->init = spk_init; info->late_probe = true; dai_links->ops = &max_98373_sdw_ops; return 0; } int sof_sdw_mx8373_late_probe(struct snd_soc_card *card) { struct snd_soc_dapm_context *dapm = &card->dapm; /* Disable Left and Right Spk pin after boot */ snd_soc_dapm_disable_pin(dapm, "Left Spk"); snd_soc_dapm_disable_pin(dapm, "Right Spk"); return snd_soc_dapm_sync(dapm); }
23.439024
77
0.729102
9ab5ebfeaf609ef7a8acad09fd41a71f6edc78a0
1,717
h
C
Tools/ReleaseDMG/BaseTen-dmg-build/Release/BaseTen.ibplugin/Contents/Frameworks/BaseTen.framework/Versions/A/PrivateHeaders/PGTSInvocationRecorder.h
romanbsd/baseten
538e07f68cf69c17fc2646f3d97a9a8abeddd59a
[ "Apache-2.0" ]
null
null
null
Tools/ReleaseDMG/BaseTen-dmg-build/Release/BaseTen.ibplugin/Contents/Frameworks/BaseTen.framework/Versions/A/PrivateHeaders/PGTSInvocationRecorder.h
romanbsd/baseten
538e07f68cf69c17fc2646f3d97a9a8abeddd59a
[ "Apache-2.0" ]
2
2015-07-10T17:23:25.000Z
2016-03-13T08:54:20.000Z
Tools/ReleaseDMG/BaseTen-dmg-build/Release/BaseTen.ibplugin/Contents/Frameworks/BaseTen.framework/Versions/A/PrivateHeaders/PGTSInvocationRecorder.h
romanbsd/baseten
538e07f68cf69c17fc2646f3d97a9a8abeddd59a
[ "Apache-2.0" ]
6
2015-03-16T21:32:55.000Z
2021-01-26T16:49:40.000Z
// // PGTSInvocationRecorder.h // BaseTen // // Copyright 2008-2010 Marko Karppinen & Co. LLC. // // 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. // #import <Foundation/Foundation.h> @class PGTSInvocationRecorderHelper; @interface PGTSInvocationRecorder : NSObject { PGTSInvocationRecorderHelper* mHelper; NSInvocation** mOutInvocation; } - (void) setTarget: (id) target; - (NSInvocation *) invocation; - (id) record; - (id) recordWithTarget: (id) target; - (id) recordWithTarget: (id) target outInvocation: (NSInvocation **) outInvocation; + (id) recordWithTarget: (id) target outInvocation: (NSInvocation **) outInvocation; @end @interface PGTSPersistentTargetInvocationRecorder : PGTSInvocationRecorder { } @end @interface PGTSCallbackInvocationRecorder : PGTSInvocationRecorder { id mUserInfo; id mCallbackTarget; SEL mCallback; } - (void) setCallbackTarget: (id) target; - (void) setCallback: (SEL) callback; //- (void) myCallback: (NSInvocation *) invocation userInfo: (id) userInfo; - (void) setUserInfo: (id) anObject; - (id) userInfo; @end @interface PGTSHOMInvocationRecorder : PGTSCallbackInvocationRecorder { } - (void) setCallback: (SEL) callback target: (id) target; @end
24.884058
113
0.743739
3c14323a39e070dda2903f9bbc6d3aec83c6600f
2,463
h
C
strongswan/strongswan-5.3.2/src/libcharon/attributes/attribute_handler.h
SECURED-FP7/secured-mobility-ned
36fdbfee58a31d42f7047f7a7eaa1b2b70246151
[ "Apache-2.0" ]
2
2017-10-16T07:51:18.000Z
2019-06-16T12:07:52.000Z
strongswan/strongswan-5.3.2/src/libcharon/attributes/attribute_handler.h
SECURED-FP7/secured-mobility-ned
36fdbfee58a31d42f7047f7a7eaa1b2b70246151
[ "Apache-2.0" ]
null
null
null
strongswan/strongswan-5.3.2/src/libcharon/attributes/attribute_handler.h
SECURED-FP7/secured-mobility-ned
36fdbfee58a31d42f7047f7a7eaa1b2b70246151
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2009 Martin Willi * Hochschule fuer Technik Rapperswil * * 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. See <http://www.fsf.org/copyleft/gpl.txt>. * * 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. */ /** * @defgroup attribute_handler attribute_handler * @{ @ingroup attributes */ #ifndef ATTRIBUTE_HANDLER_H_ #define ATTRIBUTE_HANDLER_H_ typedef struct attribute_handler_t attribute_handler_t; #include <sa/ike_sa.h> #include <utils/chunk.h> #include <collections/linked_list.h> #include "attributes.h" /** * Interface to handle configuration payload attributes. */ struct attribute_handler_t { /** * Handle a configuration attribute. * * After receiving a configuration attriubte, it is passed to each * attribute handler until it is handled. * * @param ike_sa IKE_SA under which attribute is received * @param type type of configuration attribute to handle * @param data associated attribute data * @return TRUE if attribute handled */ bool (*handle)(attribute_handler_t *this, ike_sa_t *ike_sa, configuration_attribute_type_t type, chunk_t data); /** * Release an attribute handled during handle(). * * A handler that handle()d an attribute gets a call to release() when the * connection gets closed. Depending on the implementation, this is required * to remove the attribute. * * @param ike_sa IKE_SA which releases attribute * @param type type of configuration attribute to release * @param data associated attribute data */ void (*release)(attribute_handler_t *this, ike_sa_t *ike_sa, configuration_attribute_type_t type, chunk_t data); /** * Enumerate attributes to request from a server. * * @param ike_sa IKE_SA to request attributes for * @param vips list of virtual IPs (host_t*) we are requesting * @return enumerator (configuration_attribute_type_t, chunk_t) */ enumerator_t* (*create_attribute_enumerator)(attribute_handler_t *this, ike_sa_t *ike_sa, linked_list_t *vips); }; #endif /** ATTRIBUTE_HANDLER_H_ @}*/
31.987013
77
0.739342
2c65ca441d7619048b0fdd59af975ba9a0f56610
17,203
h
C
CallTraceForWeChat/CallTraceForWeChat/WeChat_Headers/MPLandingVideoPageViewController.h
ceekay1991/CallTraceForWeChat
5767cb6f781821b6bf9facc8c87e58e15fa88541
[ "MIT" ]
30
2020-03-22T12:30:21.000Z
2022-02-09T08:49:13.000Z
CallTraceForWeChat/CallTraceForWeChat/WeChat_Headers/MPLandingVideoPageViewController.h
ceekay1991/CallTraceForWeChat
5767cb6f781821b6bf9facc8c87e58e15fa88541
[ "MIT" ]
null
null
null
CallTraceForWeChat/CallTraceForWeChat/WeChat_Headers/MPLandingVideoPageViewController.h
ceekay1991/CallTraceForWeChat
5767cb6f781821b6bf9facc8c87e58e15fa88541
[ "MIT" ]
8
2020-03-22T12:30:23.000Z
2020-09-22T04:01:47.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 "MMUIViewController.h" #import "CNetworkStatusExt-Protocol.h" #import "EnterpriseConnectorLogicDelegate-Protocol.h" #import "ForwardMessageLogicDelegate-Protocol.h" #import "MMExposeViewControllerDelegate-Protocol.h" #import "MMScrollActionSheetDelegate-Protocol.h" #import "MMUIViewControllerExt-Protocol.h" #import "MPCustomInteractiveHandlerDelegate-Protocol.h" #import "MPLandingCommonSharePageLogicDelegate-Protocol.h" #import "MPLandingPageMinimizeProtocol-Protocol.h" #import "MPLandingPageTransitionCrontrollerDelegate-Protocol.h" #import "MPLandingVideoPlayerViewDelegate-Protocol.h" #import "MPLeftEdgeLeaveGestureHandlerDelegate-Protocol.h" #import "MPSystemPushAnimatedTransitioningDelegate-Protocol.h" #import "MPVideoDismissAnimatedTransitioninigDelegate-Protocol.h" #import "MPVideoPushAnimatedTransitioningDelegate-Protocol.h" #import "MinimizationMaximizeTransitionDelegate-Protocol.h" #import "UIScrollViewDelegate-Protocol.h" #import "WCActionSheetDelegate-Protocol.h" #import "WCCommitViewResultDelegate-Protocol.h" @class ForwardMessageLogicController, MMScrollActionSheet, MMUIButton, MMUILabel, MMWebViewController, MPCustomInteractiveHandler, MPLandingCommonSharePageLogic, MPLandingPageCgiHandler, MPLandingPageOpenParameter, MPLandingPageReportLogic, MPLandingPageRespInitParam, MPLandingPageTransitionCrontroller, MPLandingVideoPageContext, MPLandingVideoPlayerView, MPLeftEdgeLeaveGestureHandler, NSString, UIView; @interface MPLandingVideoPageViewController : MMUIViewController <MMScrollActionSheetDelegate, EnterpriseConnectorLogicDelegate, MMExposeViewControllerDelegate, ForwardMessageLogicDelegate, WCCommitViewResultDelegate, MPVideoPushAnimatedTransitioningDelegate, MPCustomInteractiveHandlerDelegate, MPLeftEdgeLeaveGestureHandlerDelegate, MPLandingPageTransitionCrontrollerDelegate, MPLandingPageMinimizeProtocol, MinimizationMaximizeTransitionDelegate, MPVideoDismissAnimatedTransitioninigDelegate, MPSystemPushAnimatedTransitioningDelegate, MPLandingVideoPlayerViewDelegate, UIScrollViewDelegate, MPLandingCommonSharePageLogicDelegate, WCActionSheetDelegate, CNetworkStatusExt, MMUIViewControllerExt> { _Bool _bPlayerViewInserted; _Bool _bPlayerSuckEdge; _Bool _isFirstPresentTransitionFinished; _Bool _needResumeWhenAppear; _Bool _isScrollingToTop; _Bool _isWebviewLoading; _Bool _hasBeenRedirectedToUrl; _Bool _isGettingPageData; _Bool _isSwitchVideo; _Bool _hasActivateMinimizeArea; _Bool _isShareFromJSAPI; unsigned int _sessionId; unsigned int _enterId; UIView *_navBgView; MMUIButton *_closeBtn; MMUIButton *_moreBtn; MMUILabel *_titleLabel; MPLandingVideoPlayerView *_playerView; MPLandingPageTransitionCrontroller *_transitionController; NSString *_minimizeTaskBizKey; MPLandingVideoPageContext *_videoPageContext; NSString *_commonShareForceUrl; MPLandingPageCgiHandler *_cgiHandler; ForwardMessageLogicController *_forwardMsgLogic; MMScrollActionSheet *_scrollActionSheet; UIView *_transitionStatusMaskView; MPCustomInteractiveHandler *_interactiveHandler; MPLeftEdgeLeaveGestureHandler *_leftEdgeLeaveGestureHandler; MPLandingCommonSharePageLogic *_commonSharePageLogic; MMWebViewController *_adWebViewController; MPLandingPageReportLogic *_reportLogic; struct CGRect _playerInsertRect; } @property(retain, nonatomic) MPLandingPageReportLogic *reportLogic; // @synthesize reportLogic=_reportLogic; @property(retain, nonatomic) MMWebViewController *adWebViewController; // @synthesize adWebViewController=_adWebViewController; @property(retain, nonatomic) MPLandingCommonSharePageLogic *commonSharePageLogic; // @synthesize commonSharePageLogic=_commonSharePageLogic; @property(retain, nonatomic) MPLeftEdgeLeaveGestureHandler *leftEdgeLeaveGestureHandler; // @synthesize leftEdgeLeaveGestureHandler=_leftEdgeLeaveGestureHandler; @property(retain, nonatomic) MPCustomInteractiveHandler *interactiveHandler; // @synthesize interactiveHandler=_interactiveHandler; @property(retain, nonatomic) UIView *transitionStatusMaskView; // @synthesize transitionStatusMaskView=_transitionStatusMaskView; @property(nonatomic) _Bool isShareFromJSAPI; // @synthesize isShareFromJSAPI=_isShareFromJSAPI; @property(retain, nonatomic) MMScrollActionSheet *scrollActionSheet; // @synthesize scrollActionSheet=_scrollActionSheet; @property(retain, nonatomic) ForwardMessageLogicController *forwardMsgLogic; // @synthesize forwardMsgLogic=_forwardMsgLogic; @property(retain, nonatomic) MPLandingPageCgiHandler *cgiHandler; // @synthesize cgiHandler=_cgiHandler; @property(copy, nonatomic) NSString *commonShareForceUrl; // @synthesize commonShareForceUrl=_commonShareForceUrl; @property(retain, nonatomic) MPLandingVideoPageContext *videoPageContext; // @synthesize videoPageContext=_videoPageContext; @property(copy, nonatomic) NSString *minimizeTaskBizKey; // @synthesize minimizeTaskBizKey=_minimizeTaskBizKey; @property(nonatomic) _Bool hasActivateMinimizeArea; // @synthesize hasActivateMinimizeArea=_hasActivateMinimizeArea; @property(retain, nonatomic) MPLandingPageTransitionCrontroller *transitionController; // @synthesize transitionController=_transitionController; @property(nonatomic) unsigned int enterId; // @synthesize enterId=_enterId; @property(nonatomic) _Bool isSwitchVideo; // @synthesize isSwitchVideo=_isSwitchVideo; @property(nonatomic) _Bool isGettingPageData; // @synthesize isGettingPageData=_isGettingPageData; @property(nonatomic) _Bool hasBeenRedirectedToUrl; // @synthesize hasBeenRedirectedToUrl=_hasBeenRedirectedToUrl; @property(nonatomic) _Bool isWebviewLoading; // @synthesize isWebviewLoading=_isWebviewLoading; @property(nonatomic) _Bool isScrollingToTop; // @synthesize isScrollingToTop=_isScrollingToTop; @property(nonatomic) _Bool needResumeWhenAppear; // @synthesize needResumeWhenAppear=_needResumeWhenAppear; @property(nonatomic) _Bool isFirstPresentTransitionFinished; // @synthesize isFirstPresentTransitionFinished=_isFirstPresentTransitionFinished; @property(nonatomic) _Bool bPlayerSuckEdge; // @synthesize bPlayerSuckEdge=_bPlayerSuckEdge; @property(nonatomic) struct CGRect playerInsertRect; // @synthesize playerInsertRect=_playerInsertRect; @property(nonatomic) _Bool bPlayerViewInserted; // @synthesize bPlayerViewInserted=_bPlayerViewInserted; @property(retain, nonatomic) MPLandingVideoPlayerView *playerView; // @synthesize playerView=_playerView; @property(retain, nonatomic) MMUILabel *titleLabel; // @synthesize titleLabel=_titleLabel; @property(retain, nonatomic) MMUIButton *moreBtn; // @synthesize moreBtn=_moreBtn; @property(retain, nonatomic) MMUIButton *closeBtn; // @synthesize closeBtn=_closeBtn; @property(retain, nonatomic) UIView *navBgView; // @synthesize navBgView=_navBgView; @property(nonatomic) unsigned int sessionId; // @synthesize sessionId=_sessionId; - (void).cxx_destruct; - (_Bool)shouldShowOversizeTips; - (void)checkShowOrHideOversizeTips; - (void)onSimCardNetTypeChange; - (void)ReachabilityChange:(unsigned int)arg1; - (_Bool)interactivePopGestureRecognizerShouldBegin:(id)arg1; - (unsigned long long)supportedInterfaceOrientations; - (void)refreshDefaultResolutionIndex; - (_Bool)isInChangeDefinitonProcess; - (void)onVideoChangeDefinitionBeginWithNewInfo:(id)arg1 oldInfo:(id)arg2 oldPlayedTimeInSecond:(double)arg3; - (void)onVideoClickDefinitionBtn; - (double)dotAdViewMinShowHeight; - (void)updateDotAdViewPosInfo:(id)arg1; - (void)updateSliderBarMarkArr:(id)arg1; - (void)closeDotAdView:(id)arg1 isDotViewReady:(_Bool)arg2; - (void)onDotAdViewNeedClose:(id)arg1; - (void)showDotAdView:(id)arg1 posInfo:(id)arg2; - (void)onDotAdViewReady:(id)arg1; - (void)onDotAdViewLoadFinish:(id)arg1; - (void)addDotAdViewToBack:(id)arg1; - (void)onDotAdViewSetScripData:(id)arg1; - (void)closeWowRecommendEditView; - (void)closeCommentEditView; - (_Bool)isForbidInteractiveClose; - (void)resumeMusic; - (void)onLoadThumbImageOk:(id)arg1; - (_Bool)isCurrVideoVertical; - (void)onVideoClickIgnoreOverSize:(unsigned long long)arg1; - (void)onVideoShowOverSizeTipsViewHidden:(_Bool)arg1; - (void)onVideoErrViewRetryBtnClicked; - (void)onVideoControlsHidden:(_Bool)arg1 animated:(_Bool)arg2; - (void)onVideoWillBeginExitFullScreen:(long long)arg1 video:(id)arg2; - (void)onVideoWillBeginEnterFullScreen:(long long)arg1 video:(id)arg2; - (void)onVideoPlayerOccurAction:(unsigned long long)arg1; - (void)onSeekBarProcessCurrTime:(double)arg1 totalDuration:(double)arg2; - (void)onVideoProcessCurrTime:(double)arg1 totalDuration:(double)arg2; - (void)onVideoPlayFail:(int)arg1 LocalizedErrorDes:(id)arg2; - (void)onVideoBeginSeek; - (void)onVideoEndBuffering; - (void)onVideoBeginBuffering; - (void)onVideoFinishPlay; - (void)onVideoBeginPlay; - (void)onVideoStateChange:(long long)arg1; - (id)getPlayerHalfScreenContainerView; - (id)getPlayerFullScreenContainerView; - (void)calPlayerFrameWithWebOffsetY:(double)arg1 pGetY:(double *)arg2 pGetHeight:(double *)arg3 pGetIsTopSuck:(_Bool *)arg4 pGetIsBottomSuck:(_Bool *)arg5; - (void)updatePlayerViewSizeIfNeedWhenScroll; - (void)scrollViewDidEndScrollingAnimation:(id)arg1; - (void)scrollViewDidScroll:(id)arg1; - (void)scrollWebviewToTopByCustomIfNeed; - (_Bool)scrollViewShouldScrollToTop:(id)arg1; - (void)showAdWebViewIfNeed; - (void)removeAdWebview; - (void)onAdViewNeedClose:(id)arg1; - (void)onAdViewReady:(id)arg1; - (void)onAdViewLoadFinish:(id)arg1; - (void)onAdViewCreated:(id)arg1; - (id)errorWithCode:(long long)arg1 description:(id)arg2; - (_Bool)canAdViewCreated:(id)arg1 error:(id *)arg2; - (struct CGRect)currentAdViewBounds; - (void)resetPlayerViewWithOpenParam; - (void)resetVCState; - (void)onOpPlayer:(id)arg1; - (void)onInsertVideoNativeViewX:(double)arg1 y:(double)arg2 width:(double)arg3 height:(double)arg4 landingPageType:(unsigned int)arg5; - (void)switchVideoWithOpenParam:(id)arg1; - (id)onSwitchVideo:(id)arg1 srcUserName:(id)arg2 srcDisplayName:(id)arg3 title:(id)arg4 digest:(id)arg5 cover:(id)arg6 vid:(id)arg7 pubTime:(unsigned int)arg8 duration:(unsigned int)arg9 videoWidth:(unsigned int)arg10 videoHeight:(unsigned int)arg11 scene:(unsigned int)arg12 subscene:(unsigned int)arg13 channelSessionId:(id)arg14; - (id)MPPlayerVideoState; - (id)onCommonSharePageGetShareFuncFlag; - (void)onCommonSharePageRecievedForceUrl:(id)arg1; - (void)onCommonSharePageLoadFail; - (void)onCommonSharePageLoadFinish; - (void)onCommonSharePageStartLoad; - (void)actionSheet:(id)arg1 clickedButtonAtIndex:(long long)arg2; - (void)onCommonSharePageDoShareAction; - (void)onCommonSharePageHaokanStateChanged; - (id)commonSharePageWebviewBackgroundColor; - (id)commonSharePageBackgroundColor; - (void)initWebView; - (void)initCommonSharePageLogic; - (_Bool)isCommonShareFastLoad; - (void)redirectToUrl:(id)arg1; - (void)showGetPageInitParamFail:(id)arg1; - (void)startVideoPlayByForce:(_Bool)arg1; - (void)handlePlayerWithInitParamIfNeed; - (void)handlePageInitParam; - (struct CGSize)getPlayerViewMinimalSize; - (struct CGSize)getPlayerViewMaxSize; - (void)stop; - (void)pause; - (void)resumePlay; - (void)startPlay; - (void)setPlayerViewFrame:(struct CGRect)arg1; - (void)setPlayerViewHeight:(double)arg1; - (void)setPlayerViewY:(double)arg1; - (void)initPlayerView; - (void)onClose; - (id)navigationBarBackgroundColor; - (void)observeValueForKeyPath:(id)arg1 ofObject:(id)arg2 change:(id)arg3 context:(void *)arg4; - (void)initCustomNavigationBar; - (id)commonShareWebScrollView; - (void)viewDidPush:(_Bool)arg1; - (void)viewWillAppear:(_Bool)arg1; - (void)layoutNavBar; - (void)viewDidLayoutSubviews; - (void)viewDidBeDismissed:(_Bool)arg1; - (void)viewDidBePoped:(_Bool)arg1; - (void)delayShowPlayerLoadingIfNeed; - (void)doEveryPresentTransitionFinishedAction; - (void)doRecoverPresentTransitionFinishedAction; - (void)doInitPresentTransitionFinishedAction; - (void)handlePresentAnimatedTransitionFinish; - (void)MMUIViewControllerDidDisappear:(id)arg1; - (void)MMUIViewControllerDidAppear:(id)arg1; - (void)viewDidDisappear:(_Bool)arg1; - (void)viewDidAppear:(_Bool)arg1; - (void)viewDidLoad; - (void)resetIngoreOversizeInfo; - (void)updateIgnoreOversizeInfo:(unsigned long long)arg1; - (id)loadReqExtInfo; @property(readonly, nonatomic) MPLandingPageRespInitParam *respInitParam; @property(readonly, nonatomic) MPLandingPageOpenParameter *openParam; - (void)reqPageData; - (void)initViews; - (void)initDataWithOpenParam:(id)arg1; - (id)initWithOpenParam:(id)arg1; - (void)reportEventWhenPageLeave; - (void)reportEventWhenDealloc; - (_Bool)useBlackStatusbar; - (void)dealloc; - (_Bool)shoudlDisableMenuItem:(id)arg1; - (_Bool)isShowMenuItem:(id)arg1; - (void)didSelecteMenuItem:(id)arg1; - (void)scrollActionSheet:(id)arg1 didSelecteItem:(id)arg2; - (id)setupRow1; - (id)setupRow2; - (id)setupIconActionSheetCells; - (id)setupHalfIconActionSheet; - (id)setupPreShowIconActionSheet; - (void)onShowMenuAction; - (void)reloadMenuActionSheetIfNeeded; - (id)buildMenuItems; - (void)addMinimizationButtonWithArray:(id)arg1; - (void)addViewBrandContactButtonWithArrary:(id)arg1; - (id)getBizContonct; - (void)addExposeButtonWithArray:(id)arg1; - (void)addFavouriteButtonWithArray:(id)arg1; - (void)addCopyToPasteboardButtonWithArray:(id)arg1; - (id)AddNewActionSheetCell2Array:(id)arg1 WithText:(id)arg2 WithImage:(id)arg3 disable:(_Bool)arg4 userInfo:(id)arg5; - (id)AddNewActionSheetCell2Array:(id)arg1 WithText:(id)arg2 WithImage:(id)arg3 disable:(_Bool)arg4; - (id)AddNewActionSheetCell2Array:(id)arg1 WithText:(id)arg2 WithImage:(id)arg3; - (void)exposeArticle; - (void)copyToPasteBoard; - (void)doShareWithAppMessage:(id)arg1 isFromJSAPI:(_Bool)arg2; - (void)shareWithAppMessage:(id)arg1 isFromJSAPI:(_Bool)arg2; - (void)cancelShareToGoodLook; - (void)onMenuWowCommitBtnClickWithContent:(id)arg1; - (void)presentShareToGoodLookDialogWithTitle:(id)arg1 thumbImage:(id)arg2 thumbImageURL:(id)arg3; - (void)shareToGoodLook; - (void)shareToTimeline:(_Bool)arg1; - (void)addFavWithUrl:(id)arg1 title:(id)arg2 desc:(id)arg3 imageUrl:(id)arg4 extraDic:(id)arg5; - (void)onCancelForwardForForwardView:(id)arg1; - (void)onDoneForwardForForwardView:(id)arg1; - (id)getCurrentViewController; - (void)shareTimelineWithUrl:(id)arg1 title:(id)arg2 desc:(id)arg3 thumbData:(id)arg4 size:(struct CGSize)arg5 isFromJSAPI:(_Bool)arg6 extraDic:(id)arg7; - (void)OnForwardMessageSend:(id)arg1; - (void)shareToFiendWithUrl:(id)arg1 title:(id)arg2 desc:(id)arg3 thumbUrl:(id)arg4 isFromJSAPI:(_Bool)arg5 extraDic:(id)arg6; - (id)getFavAppMsgShareItem; - (id)getWCAppMsgShareInfo; - (id)getAppMsgShareItem; - (id)getShareThumbUrl; - (id)getShareDesc; - (id)getShareTitle; - (id)getShareUrl; - (id)getCopyUrl; - (_Bool)isAddedToGookLook; - (_Bool)shouldShowGoodLookItem; - (_Bool)isBlockJumpBizProfile; - (_Bool)isBlockCopyLink; - (_Bool)isBlockShareFavorites; - (_Bool)isBlockShareToTimeline; - (_Bool)isBlockShareToFriend; - (id)pushAnimatedTransitionContentViewForFading; - (double)pushAnimatedTransitionVideoAspectRatio; - (struct CGRect)pushAnimatedTransitionTargetRect; - (struct CGRect)pushAnimatedTransitionOriginRect; - (id)pushAnimatedTransitionThumbImage; - (void)onPushAnimatedTransitionFinish; - (void)onPushAnimatedTransitionBegin; - (id)dismissTransitionMaskView; - (void)onMaximizeTransitionEnd; - (void)onMaximizeTransitionBegin; - (void)onMPSystemPushTransitioningFinish; - (_Bool)isMinimized; - (id)interactionHandler; - (id)dismissAnimation; - (id)presentAnimation; - (id)minimizedAnimation; - (id)maximizeAnimation; - (void)willLeavePageByMinimization; - (id)arrLandingPageWebViewControllers; - (unsigned int)landingPageReportType; - (id)landingPageTitle; - (id)landingPageIconUrl; - (id)landingPageTransitionController; - (id)landingPageOpenParam; - (void)updateTaskBizKey:(id)arg1; - (id)taskBizKey; - (_Bool)scrollViewDragDownGestureHandler:(id)arg1 shouldReceiveTouch:(id)arg2; - (_Bool)leftEdgeLeaveGestureHandler:(id)arg1 shouldReceiveTouch:(id)arg2; - (_Bool)dragDownGestureHandler:(id)arg1 shouldReceiveTouch:(id)arg2; - (void)delayShow:(id)arg1; - (void)beginFirstPageMinimizationTansitionAnimationWithGesture:(id)arg1 percent:(double)arg2; - (void)onCustomInteractiveTransitioningDidEnd:(id)arg1 isComplete:(_Bool)arg2 panGesture:(id)arg3; - (void)onCustomInteractiveTransitioningWillEnd:(id)arg1 isComplete:(_Bool)arg2 panGesture:(id)arg3; - (void)onCustomInteractiveTransitioningUpdated:(id)arg1 progress:(double)arg2 panGesture:(id)arg3; - (void)onCustomInteractiveTransitioningBegin:(id)arg1; - (void)tryRescueMinimizeSelfWhenViewDidBeDismissed; - (void)setPageChildWebsMinimizationState:(_Bool)arg1; - (void)tryUnminimizedSelf; - (void)doMinimizeSelfIfFromTransition:(_Bool)arg1; - (void)tryMinimizeSelfOnClose; - (void)setupLeaveGesture; - (void)initTransitionStatusMaskView; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly, copy) NSString *description; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
51.97281
698
0.820438
aaceee8ebaad0e31facf0ff73588ece65c38ece9
4,894
h
C
components/sync/engine/model_safe_worker.h
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
components/sync/engine/model_safe_worker.h
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
components/sync/engine/model_safe_worker.h
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
// Copyright 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ #define COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_ #include <map> #include <memory> #include <string> #include "base/callback.h" #include "base/callback_helpers.h" #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/synchronization/lock.h" #include "base/synchronization/waitable_event.h" #include "components/sync/base/model_type.h" #include "components/sync/base/syncer_error.h" namespace base { class DictionaryValue; } // namespace base namespace syncer { using WorkCallback = base::OnceCallback<enum SyncerError(void)>; enum ModelSafeGroup { GROUP_PASSIVE = 0, // Models that are just "passively" being synced; e.g. // changes to these models don't need to be pushed to a // native model. GROUP_UI, // Models that live on UI thread and are being synced. GROUP_DB, // Models that live on DB thread and are being synced. GROUP_FILE, // Models that live on FILE thread and are being synced. GROUP_HISTORY, // Models that live on history thread and are being // synced. GROUP_PASSWORD, // Models that live on the password thread and are // being synced. On windows and linux, this runs on the // DB thread. GROUP_NON_BLOCKING, // Models that correspond to non-blocking types. These // models always stay in GROUP_NON_BLOCKING; changes are // forwarded to these models without ModelSafeWorker/ // SyncBackendRegistrar involvement. }; std::string ModelSafeGroupToString(ModelSafeGroup group); // The Syncer uses a ModelSafeWorker for all tasks that could potentially // modify syncable entries (e.g under a WriteTransaction). The ModelSafeWorker // only knows how to do one thing, and that is take some work (in a fully // pre-bound callback) and have it performed (as in Run()) from a thread which // is guaranteed to be "model-safe", where "safe" refers to not allowing us to // cause an embedding application model to fall out of sync with the // syncable::Directory due to a race. Each ModelSafeWorker is affiliated with // a thread and does actual work on that thread. class ModelSafeWorker : public base::RefCountedThreadSafe<ModelSafeWorker> { public: // If not stopped, calls ScheduleWork() to schedule |work| and waits until it // is done or abandoned. Otherwise, returns CANNOT_DO_WORK. SyncerError DoWorkAndWaitUntilDone(WorkCallback work); // Soft stop worker by setting stopped_ flag. Called when sync is disabled // or browser is shutting down. Called on UI loop. virtual void RequestStop(); virtual ModelSafeGroup GetModelSafeGroup() = 0; // Returns true if called on the sequence this worker works on. virtual bool IsOnModelSequence() = 0; protected: ModelSafeWorker(); virtual ~ModelSafeWorker(); private: friend class base::RefCountedThreadSafe<ModelSafeWorker>; // Schedules |work| on the appropriate sequence. virtual void ScheduleWork(base::OnceClosure work) = 0; void DoWork(WorkCallback work, base::ScopedClosureRunner scoped_closure_runner, SyncerError* error, bool* did_run); // Synchronizes access to all members. base::Lock lock_; // Signaled when DoWorkAndWaitUntilDone() can return, either because the work // is done, the work has been abandoned or RequestStop() was called while no // work was running. Reset at the beginning of DoWorkAndWaitUntilDone(). base::WaitableEvent work_done_or_abandoned_; // Whether a WorkCallback is currently running. bool is_work_running_ = false; // Whether the worker was stopped. No WorkCallback can start running when this // is true. bool stopped_ = false; DISALLOW_COPY_AND_ASSIGN(ModelSafeWorker); }; // A map that details which ModelSafeGroup each ModelType // belongs to. Routing info can change in response to the user enabling / // disabling sync for certain types, as well as model association completions. using ModelSafeRoutingInfo = std::map<ModelType, ModelSafeGroup>; // Caller takes ownership of return value. std::unique_ptr<base::DictionaryValue> ModelSafeRoutingInfoToValue( const ModelSafeRoutingInfo& routing_info); std::string ModelSafeRoutingInfoToString( const ModelSafeRoutingInfo& routing_info); ModelTypeSet GetRoutingInfoTypes(const ModelSafeRoutingInfo& routing_info); ModelSafeGroup GetGroupForModelType(const ModelType type, const ModelSafeRoutingInfo& routes); } // namespace syncer #endif // COMPONENTS_SYNC_ENGINE_MODEL_SAFE_WORKER_H_
39.152
80
0.724969
cf7b6542993940d36267afc9876dcd1bcd8b72a0
3,648
c
C
lib/quirc.c
driedler/quirc
d48ae314db3b5301c9a16e513a65c83beaa21533
[ "0BSD" ]
null
null
null
lib/quirc.c
driedler/quirc
d48ae314db3b5301c9a16e513a65c83beaa21533
[ "0BSD" ]
null
null
null
lib/quirc.c
driedler/quirc
d48ae314db3b5301c9a16e513a65c83beaa21533
[ "0BSD" ]
null
null
null
/* quirc -- QR-code recognition library * Copyright (C) 2010-2012 Daniel Beer <dlbeer@gmail.com> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include <stdlib.h> #include <string.h> #include "quirc_internal.h" #include "esp_heap_caps.h" const char *quirc_version(void) { return "1.0"; } struct quirc *quirc_new(void) { struct quirc *q = heap_caps_malloc(sizeof(*q), MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT); if (!q) return NULL; memset(q, 0, sizeof(*q)); return q; } void quirc_destroy(struct quirc *q) { free(q->image); /* q->pixels may alias q->image when their type representation is of the same size, so we need to be careful here to avoid a double free */ if (!QUIRC_PIXEL_ALIAS_IMAGE) free(q->pixels); free(q); } int quirc_resize(struct quirc *q, int w, int h) { uint8_t *image = NULL; quirc_pixel_t *pixels = NULL; /* * XXX: w and h should be size_t (or at least unsigned) as negatives * values would not make much sense. The downside is that it would break * both the API and ABI. Thus, at the moment, let's just do a sanity * check. */ if (w < 0 || h < 0) goto fail; /* * alloc a new buffer for q->image. We avoid realloc(3) because we want * on failure to be leave `q` in a consistant, unmodified state. */ image = heap_caps_malloc(w*h, MALLOC_CAP_SPIRAM|MALLOC_CAP_8BIT); if (!image) goto fail; /* compute the "old" (i.e. currently allocated) and the "new" (i.e. requested) image dimensions */ size_t olddim = q->w * q->h; size_t newdim = w * h; size_t min = (olddim < newdim ? olddim : newdim); /* * copy the data into the new buffer, avoiding (a) to read beyond the * old buffer when the new size is greater and (b) to write beyond the * new buffer when the new size is smaller, hence the min computation. */ (void)memcpy(image, q->image, min); /* alloc a new buffer for q->pixels if needed */ if (!QUIRC_PIXEL_ALIAS_IMAGE) { pixels = calloc(newdim, sizeof(quirc_pixel_t)); if (!pixels) goto fail; } /* alloc succeeded, update `q` with the new size and buffers */ q->w = w; q->h = h; free(q->image); q->image = image; if (!QUIRC_PIXEL_ALIAS_IMAGE) { free(q->pixels); q->pixels = pixels; } return 0; /* NOTREACHED */ fail: free(image); free(pixels); return -1; } int quirc_count(const struct quirc *q) { return q->num_grids; } static const char *const error_table[] = { [QUIRC_SUCCESS] = "Success", [QUIRC_ERROR_INVALID_GRID_SIZE] = "Invalid grid size", [QUIRC_ERROR_INVALID_VERSION] = "Invalid version", [QUIRC_ERROR_FORMAT_ECC] = "Format data ECC failure", [QUIRC_ERROR_DATA_ECC] = "ECC failure", [QUIRC_ERROR_UNKNOWN_DATA_TYPE] = "Unknown data type", [QUIRC_ERROR_DATA_OVERFLOW] = "Data overflow", [QUIRC_ERROR_DATA_UNDERFLOW] = "Data underflow" }; const char *quirc_strerror(quirc_decode_error_t err) { if (err >= 0 && err < sizeof(error_table) / sizeof(error_table[0])) return error_table[err]; return "Unknown error"; }
27.223881
83
0.702851
5cad428fdd0b0a7d5965692047f329a236edc84f
18,294
h
C
kernel/nvidia/drivers/net/wireless/realtek/rtl8822ce/include/Hal8188FPwrSeq.h
rubedos/l4t_R32.5.1_viper
6aed0062084d9031546f946e63fc74303555e0a6
[ "MIT" ]
1,144
2018-12-18T09:46:47.000Z
2022-03-07T14:51:46.000Z
include/Hal8188FPwrSeq.h
pbielinux/RTL8192EU
5cd928c8ea45889bc4926f7372d357c87ebdf919
[ "MIT" ]
25
2019-12-08T15:38:36.000Z
2022-01-15T21:28:33.000Z
include/Hal8188FPwrSeq.h
pbielinux/RTL8192EU
5cd928c8ea45889bc4926f7372d357c87ebdf919
[ "MIT" ]
129
2018-12-18T09:46:50.000Z
2022-03-30T07:30:13.000Z
/****************************************************************************** * * Copyright(c) 2016 - 2017 Realtek Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * 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. * *****************************************************************************/ #ifndef REALTEK_POWER_SEQUENCE_8188F #define REALTEK_POWER_SEQUENCE_8188F #include "HalPwrSeqCmd.h" /* Check document WM-20130815-JackieLau-RTL8188F_Power_Architecture v08.vsd There are 6 HW Power States: 0: POFF--Power Off 1: PDN--Power Down 2: CARDEMU--Card Emulation 3: ACT--Active Mode 4: LPS--Low Power State 5: SUS--Suspend The transision from different states are defined below TRANS_CARDEMU_TO_ACT TRANS_ACT_TO_CARDEMU TRANS_CARDEMU_TO_SUS TRANS_SUS_TO_CARDEMU TRANS_CARDEMU_TO_PDN TRANS_ACT_TO_LPS TRANS_LPS_TO_ACT TRANS_END */ #define RTL8188F_TRANS_CARDEMU_TO_ACT_STEPS 13 #define RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS 15 #define RTL8188F_TRANS_CARDEMU_TO_SUS_STEPS 14 #define RTL8188F_TRANS_SUS_TO_CARDEMU_STEPS 15 #define RTL8188F_TRANS_CARDEMU_TO_PDN_STEPS 15 #define RTL8188F_TRANS_PDN_TO_CARDEMU_STEPS 15 #define RTL8188F_TRANS_ACT_TO_LPS_STEPS 11 #define RTL8188F_TRANS_LPS_TO_ACT_STEPS 13 #define RTL8188F_TRANS_ACT_TO_SWLPS_STEPS 21 #define RTL8188F_TRANS_SWLPS_TO_ACT_STEPS 14 #define RTL8188F_TRANS_END_STEPS 1 #define RTL8188F_TRANS_CARDEMU_TO_ACT \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, 0},/* disable SW LPS 0x04[10]=0*/ \ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT1, BIT1},/* wait till 0x04[17] = 1 power ready*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0},/* disable HWPDN 0x04[15]=0*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, (BIT3), 0},/* 0x4[11]=1'b0 disable WL suspend*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0},/* 0x4[8]=1 polling until return 0*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT0, 0},/**/ \ {0x0027, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0x35}, /*0x27<=35 to reduce RF noise*/ #define RTL8188F_TRANS_ACT_TO_CARDEMU \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x001F, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0},/*0x1F[7:0] = 0 turn off RF*/ \ {0x004E, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0},/*0x4C[23] = 0x4E[7] = 0, switch DPDT_SEL_P output from register 0x65[2] */\ {0x0027, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0x34}, /*0x27 <= 34, xtal_qsel = 0 to xtal bring up*/\ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1}, /*0x04[9] = 1 turn off MAC by HW state machine*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT1, 0}, /*wait till 0x04[9] = 0 polling until return 0 to disable*/ \ #define RTL8188F_TRANS_CARDEMU_TO_SUS \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00}, /*0x07 = 0x00 , SOP option to disable BG/MB*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3 | BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ \ {0x00C4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4},/* 0xC4[4] <= 1, turn off USB APHY LDO under suspend mode*/ #define RTL8188F_TRANS_SUS_TO_CARDEMU \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3 | BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ \ {0x00C4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0},/* 0xC4[4] <= 1, turn off USB APHY LDO under suspend mode*/ #define RTL8188F_TRANS_CARDEMU_TO_CARDDIS \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0007, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x00}, /*0x07 = 0x00 , SOP option to disable BG/MB*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK | PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3 | BIT4, BIT3}, /*0x04[12:11] = 2b'01 enable WL suspend*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, BIT0}, /*Set SDIO suspend local register*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, 0}, /*wait power state to suspend*/ \ {0x00C4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, BIT4},/* 0xC4[4] <= 1, turn off USB APHY LDO under suspend mode*/ #define RTL8188F_TRANS_CARDDIS_TO_CARDEMU \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, BIT0, 0}, /*Set SDIO suspend local register*/ \ {0x0086, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_POLLING, BIT1, BIT1}, /*wait power state to suspend*/\ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT3 | BIT4, 0}, /*0x04[12:11] = 2b'01enable WL suspend*/ \ {0x00C4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT4, 0},/* 0xC4[4] <= 1, turn off USB APHY LDO under suspend mode*/ #define RTL8188F_TRANS_CARDEMU_TO_PDN \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0006, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0},/* 0x04[16] = 0*/\ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, BIT7},/* 0x04[15] = 1*/ #define RTL8188F_TRANS_PDN_TO_CARDEMU \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0005, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0},/* 0x04[15] = 0*/ #define RTL8188F_TRANS_ACT_TO_LPS \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0139, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0},/*set RPWM IMR*/ \ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled, and clock are gated*/ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ #define RTL8188F_TRANS_LPS_TO_ACT \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_SDIO, PWR_CMD_WRITE, 0xFF, 0x84}, /*SDIO RPWM*/\ {0xFE58, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x84}, /*USB RPWM*/\ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_MS}, /*Delay*/\ {0x0027, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0x35},/*xtal_qsel = 1 for low noise*/ \ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT7, 0}, /*Polling 0x109[7]=0 TSF in 40M*/\ {0x002B, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x1c, 0x1c}, /*. 0x2b[4:2] = 3b'111 to enable BB, AFE clock*/\ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1*/\ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1 | BIT0, BIT1 | BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ #define RTL8188F_TRANS_ACT_TO_SWLPS \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0139, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0},/*set RPWM IMR*/ \ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF},/*Tx Pause*/ \ {0x05F8, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ {0x05F9, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ {0x05FA, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, 0xFF, 0},/*Should be zero if no packet is transmitting*/ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0},/*CCK and OFDM are disabled, and clock are gated*/ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_DELAY, 0, PWRSEQ_DELAY_US},/*Delay 1us*/ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0},/*Whole BB is reset*/ \ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x3F},/*Reset MAC TRX*/ \ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, 0},/*check if removed later*/ \ {0x0553, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, BIT5},/*Respond TxOK to scheduler*/ \ {0x002b, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0x1C, 0x00},/*0x2b[4:2]<=0 to gated BB, AFE clock*/ \ {0x0027, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0x34},/*xtal_qsel = 0 for bring up*/ \ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0x00},/* sdio LPS option*/ \ {0x0093, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0x83},/* usb LPS option, open bandgap, xtal*/ \ {0x00C4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT5, 0}, /* 0xC4[5]<=0, digital LDO no standby mode*/ \ {0x00C4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, BIT7}, /* 0xC4[7]<=1, on domain voltage adjust*/ \ {0x00a7, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0xe0}, /* low power LPS enable for sdio*/ \ {0x00a7, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_USB_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xff, 0xe4}, /* low power LPS enable for usb*/ \ {0x0090, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0}, /* enable WL_LPS_EN*/ #define RTL8188F_TRANS_SWLPS_TO_ACT \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0x0109, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT7, 0},/*polling TSF stable*/\ {0x0101, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1}, /*. 0x101[1] = 1, enable security engine*/\ {0x0100, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0xFF}, /*. 0x100[7:0] = 0xFF enable WMAC TRX*/\ {0x06B7, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x09}, /*. reset MAC rx state machine*/\ {0x06B4, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0x86}, /*. reset MAC rx state machine*/\ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT1, BIT1},/* set CPU RAM code ready*/ \ {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, 0},/*Reset CPU IO Wrapper*/ \ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, 0},/* Enable CPU*/ \ {0x001D, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0},/*enable CPU IO Wrapper*/ \ {0x0003, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT2, BIT2},/* Enable CPU*/ \ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT7, BIT7},/*polling FW init ready */ \ {0x0080, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_POLLING, BIT6, BIT6},/*polling FW init ready */ \ {0x0002, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, BIT0, BIT0}, /*. 0x02[1:0] = 2b'11 enable BB macro*/\ {0x0522, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_SDIO_MSK, PWR_BASEADDR_MAC, PWR_CMD_WRITE, 0xFF, 0}, /*. 0x522 = 0*/ #define RTL8188F_TRANS_END \ /* format */ \ /* { offset, cut_msk, fab_msk|interface_msk, base|cmd, msk, value }, // comments here*/ \ {0xFFFF, PWR_CUT_ALL_MSK, PWR_FAB_ALL_MSK, PWR_INTF_ALL_MSK, 0, PWR_CMD_END, 0, 0}, extern WLAN_PWR_CFG rtl8188F_power_on_flow[RTL8188F_TRANS_CARDEMU_TO_ACT_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_radio_off_flow[RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_card_disable_flow[RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188F_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_card_enable_flow[RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188F_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_suspend_flow[RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188F_TRANS_CARDEMU_TO_SUS_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_resume_flow[RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188F_TRANS_CARDEMU_TO_SUS_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_hwpdn_flow[RTL8188F_TRANS_ACT_TO_CARDEMU_STEPS + RTL8188F_TRANS_CARDEMU_TO_PDN_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_enter_lps_flow[RTL8188F_TRANS_ACT_TO_LPS_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_leave_lps_flow[RTL8188F_TRANS_LPS_TO_ACT_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_enter_swlps_flow[RTL8188F_TRANS_ACT_TO_SWLPS_STEPS + RTL8188F_TRANS_END_STEPS]; extern WLAN_PWR_CFG rtl8188F_leave_swlps_flow[RTL8188F_TRANS_SWLPS_TO_ACT_STEPS + RTL8188F_TRANS_END_STEPS]; #endif
85.887324
180
0.754455
d03bed217e182bf03cc5a9fbc14a6fed57646f84
3,030
h
C
source/luiRoot.h
Sporadica-IS/LUI
35035090590c5cde8b725edea8eb9bf6c6c2ad33
[ "MIT" ]
86
2015-01-16T08:23:51.000Z
2022-02-21T13:21:14.000Z
source/luiRoot.h
Sporadica-IS/LUI
35035090590c5cde8b725edea8eb9bf6c6c2ad33
[ "MIT" ]
49
2015-02-25T18:36:05.000Z
2020-12-23T14:49:43.000Z
source/luiRoot.h
tobspr/LUI
35035090590c5cde8b725edea8eb9bf6c6c2ad33
[ "MIT" ]
32
2015-02-25T15:35:03.000Z
2021-04-07T13:46:22.000Z
// Filename: luiRoot.h // Created by: tobspr (28Aug14) // #ifndef LUI_ROOT_H #define LUI_ROOT_H #include "pandabase.h" #include "pandasymbols.h" #include "luse.h" #include "referenceCount.h" #include "config_lui.h" #include "luiBaseElement.h" #include "luiObject.h" #include "luiVertexPool.h" #include "luiAtlas.h" #include "geomVertexFormat.h" #include "geomVertexData.h" #include "geomVertexWriter.h" #include "geomVertexArrayFormat.h" #include "geomTriangles.h" #include "omniBoundingVolume.h" #include "geom.h" class LUIObject; class LUIBaseElement; typedef vector<Texture*> LUITextureVector; typedef vector<LUISprite*> LUISpriteVector; typedef set<LUIBaseElement*> LUIEventObjectSet; class EXPCL_LUI LUIRoot : public ReferenceCount { friend class LUIRegion; PUBLISHED: LUIRoot(float width, float height); ~LUIRoot(); INLINE PT(LUIObject) node(); static INLINE void set_use_glsl_130(bool use_glsl_130); public: INLINE int alloc_index_by_texture(Texture* tex); INLINE void register_event_object(LUIBaseElement* event_object); INLINE void unregister_event_object(LUIBaseElement* event_object); INLINE bool request_focus(LUIBaseElement* elem); INLINE LUIBaseElement* get_requested_focus() const; INLINE void set_requested_focus(LUIBaseElement* elem); INLINE void request_explicit_blur(); INLINE void clear_explicit_blur(); INLINE bool get_explicit_blur() const; INLINE LUIEventObjectSet::iterator get_event_objects_begin(); INLINE LUIEventObjectSet::iterator get_event_objects_end(); INLINE int register_sprite(LUISprite* sprite); INLINE void unregister_sprite(int position); INLINE void* get_sprite_vertex_pointer(int position) const; INLINE void add_sprite_to_render_list(int position); INLINE int allocate_render_index(); INLINE Geom* get_geom() const; void prepare_render(); INLINE int get_frame_index() const; INLINE int get_num_textures() const; INLINE Texture* get_texture(int index) const; PT(Shader) create_object_shader(); private: static bool _use_glsl_130; PT(GeomVertexData) _vertex_data; PT(GeomTriangles) _triangles; PT(Geom) _geom; LUISpriteVector _sprites; LUITextureVector _textures; int _sprites_rendered; int _frame_count; int _render_index; struct LUITriangleIndex { uint16_t vertices[3]; }; void* _sprite_vertex_pointer; int _min_rendered_vertex; int _max_rendered_vertex; LUITriangleIndex* _triangle_index_buffer; int _index_buffer_size; vector<int> _topmost_sprites; // We store a private root node. // With this, we don't have to inherit from LUIObject, but // can maintain the ability to attach nodes directly to the // root PT(LUIObject) _root; // Event objects are not stored reference counted, it is expected that the // LUIBaseElement unregisters before destruction. LUIEventObjectSet _event_objects; // Store the focus requests LUIBaseElement* _requested_focus; // Explicit blur requests bool _explicit_blur; }; #include "luiRoot.I" #endif
22.954545
76
0.771617
fda4804d70fcd1e046b307be578bbf23cd2aa9c2
2,339
h
C
Source/FSD/Public/FSDPostProcessingActor.h
trumank/DRG-Mods
2febc879f2ffe83498ac913c114d0e933427e93e
[ "MIT" ]
null
null
null
Source/FSD/Public/FSDPostProcessingActor.h
trumank/DRG-Mods
2febc879f2ffe83498ac913c114d0e933427e93e
[ "MIT" ]
null
null
null
Source/FSD/Public/FSDPostProcessingActor.h
trumank/DRG-Mods
2febc879f2ffe83498ac913c114d0e933427e93e
[ "MIT" ]
null
null
null
#pragma once #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "EPostProcessingType.h" #include "Engine/Scene.h" #include "FSDPostProcessingActor.generated.h" class UPostProcessComponent; class APostProcessingManager; class UObject; class UBlendableInterface; class IBlendableInterface; class UMaterialInstanceDynamic; class UMaterialInterface; UCLASS(Abstract, Blueprintable) class AFSDPostProcessingActor : public AActor { GENERATED_BODY() public: protected: UPROPERTY(BlueprintReadWrite, EditAnywhere, meta=(AllowPrivateAccess=true)) EPostProcessingType PostProcessingType; UPROPERTY(BlueprintReadWrite, EditAnywhere, Export, Transient, meta=(AllowPrivateAccess=true)) UPostProcessComponent* PostProcessComponent; UPROPERTY(BlueprintReadWrite, EditAnywhere, Transient, meta=(AllowPrivateAccess=true)) FWeightedBlendables InitialBlendables; public: AFSDPostProcessingActor(); UFUNCTION(BlueprintCallable) static void UnapplyPostProcessingBlendablesByType(UObject* WorldContext, EPostProcessingType Type); UFUNCTION(BlueprintCallable) static void UnapplyPostProcessingBlendablesByID(UObject* WorldContext, const FName InID); UFUNCTION(BlueprintCallable) static void UnapplyPostProcessingBlendable(UObject* WorldContext, EPostProcessingType Type, TScriptInterface<IBlendableInterface> InBlendableObject); UFUNCTION(BlueprintCallable) static void UnapplyAllPostProcessingBlendables(UObject* WorldContext); protected: UFUNCTION(BlueprintCallable) void SetupHDRColorGamma(); UFUNCTION(BlueprintCallable) void SetPostProcessManager(APostProcessingManager* InManager); public: UFUNCTION(BlueprintCallable, BlueprintPure) static UMaterialInstanceDynamic* GetPostProcessingMaterialInstance(UObject* WorldContext, UMaterialInterface* Material); UFUNCTION(BlueprintCallable) static UMaterialInstanceDynamic* ApplyPostProcessingMaterial(UObject* WorldContext, EPostProcessingType Type, UMaterialInterface* Material, float InWeight, const FName InID); UFUNCTION(BlueprintCallable) static void ApplyPostProcessingBlendable(UObject* WorldContext, EPostProcessingType Type, TScriptInterface<IBlendableInterface> InBlendableObject, float InWeight, const FName InID); };
37.126984
185
0.806327
fdcea58de8eb575242fcb8d089608c10dd9a851d
464
h
C
src/smt/smt_lookahead.h
SweetVishnya/z3
0f8f886389557b001e09a5e88c99e9cd5988a383
[ "MIT" ]
55
2015-08-15T22:37:02.000Z
2022-03-27T03:08:02.000Z
src/smt/smt_lookahead.h
ekpyron/z3
28cb13fb96c15714eb244bf05d1d7f56e84cda5e
[ "MIT" ]
16
2016-04-13T23:48:33.000Z
2020-02-02T12:38:52.000Z
src/smt/smt_lookahead.h
ekpyron/z3
28cb13fb96c15714eb244bf05d1d7f56e84cda5e
[ "MIT" ]
18
2015-08-11T08:37:41.000Z
2021-09-16T14:24:04.000Z
/*++ Copyright (c) 2006 Microsoft Corporation Module Name: smt_lookahead.h Abstract: Lookahead solver for SMT Author: nbjorner 2019-05-27. Revision History: --*/ #pragma once #include "ast/ast.h" namespace smt { class context; class lookahead { context& ctx; ast_manager& m; struct compare; double get_score(); public: lookahead(context& ctx); expr_ref choose(); }; }
11.317073
40
0.592672
b7756b6d95f9783b3bd8362c83c93f9be8351409
2,454
h
C
engines/ep/src/progress_tracker.h
trondn/kv_engine
c0d4366e2feb8e7e64be7e3c6c9fc3cfd68a97c6
[ "BSD-3-Clause" ]
null
null
null
engines/ep/src/progress_tracker.h
trondn/kv_engine
c0d4366e2feb8e7e64be7e3c6c9fc3cfd68a97c6
[ "BSD-3-Clause" ]
null
null
null
engines/ep/src/progress_tracker.h
trondn/kv_engine
c0d4366e2feb8e7e64be7e3c6c9fc3cfd68a97c6
[ "BSD-3-Clause" ]
null
null
null
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* * Copyright 2017 Couchbase, Inc * * 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 "config.h" #include <platform/processclock.h> /** * Helper class used by objects which want to track their progress (how long * they have been running for) in an efficient way; without having to check * clock::now() on every iteration. * * Example usage: * * // Create a ProcessTracker with a deadline of 10ms from now. * ProgressTracker tracker; * tracker.setDeadline(ProcessClock::now + std::chrono::milliseconds(10)); * * // Loop doing some work; where you want to stop after some time limit. * for (size_t ii = 0; ii < ...; ii++) { * doSomeWork(); * if (tracker.shouldContinueVisiting(ii)) { * break; * } * } */ class ProgressTracker { public: ProgressTracker(); void setDeadline(ProcessClock::time_point new_deadline); /** * Inform the progress tracker that work has been done, and if visiting * should continue. * * @param visited_items Number of items visited by the visitor so far in * this run (i.e. running total). * @return true if visiting should continue, or false if it should be * paused. */ bool shouldContinueVisiting(size_t visited_items); private: // After how many visited items should the time be first checked? static const size_t INITIAL_VISIT_COUNT_CHECK = 100; // When we can only visit less than this number of items, pause. static const size_t MINIMUM_VISIT_COUNT_BEFORE_PAUSE = 10; // Do we need to capture an initial time for measuring progress? bool need_initial_time; size_t next_visit_count_check; ProcessClock::time_point deadline; ProcessClock::time_point previous_time; size_t previous_visited; };
32.289474
79
0.677669
b7ab06c271437e27f54959808c1d090574362be7
5,844
h
C
Core/Code/DataManagement/mitkImageStatisticsHolder.h
danielknorr/MITK
b1b9780b2a6671d8118313c5ef71e9aa128362be
[ "BSD-3-Clause" ]
null
null
null
Core/Code/DataManagement/mitkImageStatisticsHolder.h
danielknorr/MITK
b1b9780b2a6671d8118313c5ef71e9aa128362be
[ "BSD-3-Clause" ]
null
null
null
Core/Code/DataManagement/mitkImageStatisticsHolder.h
danielknorr/MITK
b1b9780b2a6671d8118313c5ef71e9aa128362be
[ "BSD-3-Clause" ]
null
null
null
/*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKIMAGESTATISTICSHOLDER_H #define MITKIMAGESTATISTICSHOLDER_H #include <MitkCoreExports.h> #include "mitkImage.h" #include "mitkImageTimeSelector.h" #ifndef __itkHistogram_h #include <itkHistogram.h> #endif namespace mitk { /** @brief Class holding the statistics informations about a single mitk::Image This computation was previously directly included in the definition and implementation of the mitk::Image class but for having a clear interface, all statistics computation is moved to the ImageStatisticsHolder class. Each mitk::Image holds a normal pointer to its StatisticsHolder object. To get access to the methods, use the GetStatistics() method in mitk::Image class. */ class MITK_CORE_EXPORT ImageStatisticsHolder { public: /** Constructor */ ImageStatisticsHolder(mitk::Image* image); /** Desctructor */ virtual ~ImageStatisticsHolder(); typedef itk::Statistics::Histogram<double> HistogramType; virtual const HistogramType* GetScalarHistogram(int t=0, unsigned int component=0); //##Documentation //## \brief Get the minimum for scalar images virtual ScalarType GetScalarValueMin(int t=0, unsigned int component=0); //##Documentation //## \brief Get the maximum for scalar images virtual ScalarType GetScalarValueMax(int t=0, unsigned int component=0); //##Documentation //## \brief Get the second smallest value for scalar images virtual ScalarType GetScalarValue2ndMin(int t=0, unsigned int component=0); //##Documentation //## \brief Get the smallest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValueMinNoRecompute( unsigned int t = 0 ) const { if ( t < m_ScalarMin.size() ) return m_ScalarMin[t]; else return itk::NumericTraits<ScalarType>::max(); } //##Documentation //## \brief Get the second smallest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValue2ndMinNoRecompute( unsigned int t = 0 ) const { if ( t < m_Scalar2ndMin.size() ) return m_Scalar2ndMin[t]; else return itk::NumericTraits<ScalarType>::max(); } //##Documentation //## \brief Get the second largest value for scalar images virtual ScalarType GetScalarValue2ndMax(int t=0, unsigned int component=0); //##Documentation //## \brief Get the largest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValueMaxNoRecompute( unsigned int t = 0 ) { if ( t < m_ScalarMax.size() ) return m_ScalarMax[t]; else return itk::NumericTraits<ScalarType>::NonpositiveMin(); } //##Documentation //## \brief Get the second largest value for scalar images, but do not recompute it first virtual mitk::ScalarType GetScalarValue2ndMaxNoRecompute( unsigned int t = 0 ) { if ( t < m_Scalar2ndMax.size() ) return m_Scalar2ndMax[t]; else return itk::NumericTraits<ScalarType>::NonpositiveMin(); } //##Documentation //## \brief Get the count of voxels with the smallest scalar value in the dataset mitk::ScalarType GetCountOfMinValuedVoxels(int t = 0, unsigned int component=0); //##Documentation //## \brief Get the count of voxels with the largest scalar value in the dataset mitk::ScalarType GetCountOfMaxValuedVoxels(int t = 0, unsigned int component=0); //##Documentation //## \brief Get the count of voxels with the largest scalar value in the dataset virtual unsigned int GetCountOfMaxValuedVoxelsNoRecompute( unsigned int t = 0 ) { if ( t < m_CountOfMaxValuedVoxels.size() ) return m_CountOfMaxValuedVoxels[t]; else return 0; } //##Documentation //## \brief Get the count of voxels with the smallest scalar value in the dataset virtual unsigned int GetCountOfMinValuedVoxelsNoRecompute( unsigned int t = 0 ) const { if ( t < m_CountOfMinValuedVoxels.size() ) return m_CountOfMinValuedVoxels[t]; else return 0; } bool IsValidTimeStep( int t) const; template < typename ItkImageType > friend void _ComputeExtremaInItkImage( const ItkImageType* itkImage, mitk::ImageStatisticsHolder* statisticsHolder, int t); template < typename ItkImageType > friend void _ComputeExtremaInItkVectorImage( const ItkImageType* itkImage, mitk::ImageStatisticsHolder* statisticsHolder, int t, unsigned int component); protected: virtual void ResetImageStatistics(); virtual void ComputeImageStatistics(int t=0, unsigned int component=0); virtual void Expand( unsigned int timeSteps ); ImageTimeSelector::Pointer GetTimeSelector(); mitk::Image* m_Image; mutable itk::Object::Pointer m_HistogramGeneratorObject; mutable itk::Object::Pointer m_TimeSelectorForExtremaObject; mutable std::vector<unsigned int> m_CountOfMinValuedVoxels; mutable std::vector<unsigned int> m_CountOfMaxValuedVoxels; mutable std::vector<ScalarType> m_ScalarMin; mutable std::vector<ScalarType> m_ScalarMax; mutable std::vector<ScalarType> m_Scalar2ndMin; mutable std::vector<ScalarType> m_Scalar2ndMax; itk::TimeStamp m_LastRecomputeTimeStamp; }; } //end namespace #endif // MITKIMAGESTATISTICSHOLDER_H
35.204819
159
0.707221
a127a3b1d36f6388d31ec78418bf4c193fc0fd39
1,082
h
C
System/Library/Frameworks/Foundation.framework/NSFilesystemItemLinkOperation.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/Frameworks/Foundation.framework/NSFilesystemItemLinkOperation.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/Frameworks/Foundation.framework/NSFilesystemItemLinkOperation.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:38:34 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/Frameworks/Foundation.framework/Foundation * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <Foundation/Foundation-Structs.h> #import <Foundation/NSFilesystemItemCopyOperation.h> @interface NSFilesystemItemLinkOperation : NSFilesystemItemCopyOperation +(id)filesystemItemLinkOperationWithSourcePath:(id)arg1 destinationPath:(id)arg2 ; +(id)_errorWithErrno:(int)arg1 sourcePath:(id)arg2 destinationPath:(id)arg3 ; +(BOOL)_needsStatInfo; -(BOOL)_shouldProceedAfterErrno:(int)arg1 linkingItemAtPath:(const char*)arg2 toPath:(const char*)arg3 ; -(BOOL)_validatePaths:(id*)arg1 ; -(BOOL)shouldProceedAfterError:(id)arg1 linkingItemAtPath:(id)arg2 toPath:(id)arg3 ; -(void)_handleFTSEntry:(ftsent*)arg1 ; -(BOOL)_shouldLinkItemAtPath:(const char*)arg1 toPath:(const char*)arg2 ; -(BOOL)shouldLinkItemAtPath:(id)arg1 toPath:(id)arg2 ; @end
45.083333
104
0.792052
3167d0db93ded80a9b123295c179ea4f5e18c740
679
h
C
couchbasejs/node_modules/couchbase/iojs-1.2.8/src/req-wrap.h
Jacqueline95/nosql
30de35ac22cda872fcc7330f28632f50692c2218
[ "MIT" ]
null
null
null
couchbasejs/node_modules/couchbase/iojs-1.2.8/src/req-wrap.h
Jacqueline95/nosql
30de35ac22cda872fcc7330f28632f50692c2218
[ "MIT" ]
null
null
null
couchbasejs/node_modules/couchbase/iojs-1.2.8/src/req-wrap.h
Jacqueline95/nosql
30de35ac22cda872fcc7330f28632f50692c2218
[ "MIT" ]
null
null
null
#ifndef SRC_REQ_WRAP_H_ #define SRC_REQ_WRAP_H_ #include "async-wrap.h" #include "env.h" #include "util.h" #include "v8.h" namespace node { template <typename T> class ReqWrap : public AsyncWrap { public: inline ReqWrap(Environment* env, v8::Local<v8::Object> object, AsyncWrap::ProviderType provider); inline ~ReqWrap() override; inline void Dispatched(); // Call this after the req has been dispatched. private: friend class Environment; ListNode<ReqWrap> req_wrap_queue_; public: T req_; // Must be last. TODO(bnoordhuis) Make private. }; } // namespace node #endif // SRC_REQ_WRAP_H_
21.903226
77
0.658321
c81cb98c076975ae0e38c8a9df85b4a9d6f8f091
5,323
h
C
src/include/utils/workfile_mgr.h
lintzc/GPDB
b48c8b97da18f495c10065d0853db87960aebae2
[ "PostgreSQL", "Apache-2.0" ]
null
null
null
src/include/utils/workfile_mgr.h
lintzc/GPDB
b48c8b97da18f495c10065d0853db87960aebae2
[ "PostgreSQL", "Apache-2.0" ]
null
null
null
src/include/utils/workfile_mgr.h
lintzc/GPDB
b48c8b97da18f495c10065d0853db87960aebae2
[ "PostgreSQL", "Apache-2.0" ]
null
null
null
/*------------------------------------------------------------------------- * * workfile_mgr.h * Interface for workfile manager and workfile caching. * * * Copyright (c) 2011, EMC Corp. * * *------------------------------------------------------------------------- */ #ifndef __WORKFILE_MGR_H__ #define __WORKFILE_MGR_H__ #include "postgres.h" #include "executor/execWorkfile.h" #include "utils/sharedcache.h" #include "nodes/execnodes.h" #include "utils/timestamp.h" /* * Workfile management default parameters */ /* Other constants */ #define WORKFILE_SET_PREFIX "workfile_set" /* Fixed workfile numbers common for all operators */ #define WORKFILE_NUM_ALL_PLAN 0 /* Fixed workfile numbers for each operator type */ #define WORKFILE_NUM_HASHJOIN_METADATA 1 #define WORKFILE_NUM_HASHAGG_METADATA 1 #define WORKFILE_NUM_MKSORT_METADATA 1 #define WORKFILE_NUM_MKSORT_TAPESET 2 #define WORKFILE_NUM_TUPLESTORE_DATA 1 #define WORKFILE_NUM_TUPLESTORE_LOB 2 typedef struct { /* number of buckets in a spilled hashtable */ uint32 buckets; /* number of leaf (that did not re-spill) files for a hashagg operator */ uint32 num_leaf_files; /* type of work files used by this operator */ enum ExecWorkFileType type; /* compression level used by bfz if applicable */ int bfz_compress_type; /* work_mem for this operator at the time of the spill */ uint64 operator_work_mem; } workfile_set_op_metadata; typedef uint32 workfile_set_hashkey_t; typedef struct workfile_set { /* hash value of this workfile set metadata */ workfile_set_hashkey_t key; /* Number of files in set */ uint32 no_files; /* Size in bytes of the files in this workfile set */ int64 size; /* Real-time size of the set as it is being created (for reporting only) */ int64 in_progress_size; /* Prefix of files in the workfile set */ char path[MAXPGPATH]; /* Type of operator creating the workfile set */ NodeTag node_type; /* Slice in which the spilling operator was */ int slice_id; /* Session id for the query creating the workfile set */ int session_id; /* Command count for the query creating the workfile set */ int command_count; /* Timestamp when the workfile set was created */ TimestampTz session_start_time; /* Operator-specific metadata */ workfile_set_op_metadata metadata; } workfile_set; /* The key for an entry stored in the Queryspace Hashtable */ typedef struct Queryspace_HashKey { int session_id; int command_count; } Queryspace_HashKey; /* * (key, value) structure that is stored in the Queryspace Hashtable * * The value contains measurements of all per-query resources tracked */ typedef struct QueryspaceDesc { Queryspace_HashKey key; int32 pinCount; /* Total disk space used for workfiles for this query */ int64 queryDiskspace; /* Number of memory chunks reserved for per-query QEs in this segment */ int chunksReserved; /* Number of workfiles this query has created */ int32 workfilesCreated; } QueryspaceDesc; /* Workfile Set operations */ workfile_set *workfile_mgr_create_set(enum ExecWorkFileType type, bool can_be_reused, PlanState *ps); void workfile_mgr_close_set(workfile_set *work_set); void workfile_mgr_cleanup(void); bool workfile_mgr_can_reuse(workfile_set *work_set, PlanState *ps); Size workfile_mgr_shmem_size(void); void workfile_mgr_cache_init(void); void workfile_mgr_mark_complete(workfile_set *work_set); Cache *workfile_mgr_get_cache(void); int32 workfile_mgr_clear_cache(int seg_id); void workfile_set_update_in_progress_size(workfile_set *work_set, int64 size); /* Workfile File operations */ ExecWorkFile *workfile_mgr_create_file(workfile_set *work_set); ExecWorkFile *workfile_mgr_create_fileno(workfile_set *work_set, uint32 file_no); int64 workfile_mgr_close_file(workfile_set *work_set, ExecWorkFile *file); /* Workfile diskspace operations */ void WorkfileDiskspace_Init(void); Size WorkfileDiskspace_ShMemSize(void); bool WorkfileDiskspace_Reserve(int64 bytes); void WorkfileDiskspace_Commit(int64 commit_bytes, int64 reserved_bytes, bool update_query_space); void WorkfileDiskspace_SetFull(bool isFull); bool WorkfileDiskspace_IsFull(void); /* Workfile segspace operations */ void WorkfileSegspace_Init(void); Size WorkfileSegspace_ShMemSize(void); bool WorkfileSegspace_Reserve(int64 bytes); void WorkfileSegspace_Commit(int64 commit_bytes, int64 reserved_bytes); int64 WorkfileSegspace_GetSize(void); /* Workfile queryspace operations */ void WorkfileQueryspace_Init(void); Size WorkfileQueryspace_ShMemSize(void); int64 WorkfileQueryspace_GetSize(int session_id, int command_count); bool WorkfileQueryspace_Reserve(int64 bytes_to_reserve); void WorkfileQueryspace_Commit(int64 commit_bytes, int64 reserved_bytes); QueryspaceDesc *WorkfileQueryspace_InitEntry(int session_id, int command_count); void WorkfileQueryspace_ReleaseEntry(void); bool WorkfileQueryspace_AddWorkfile(void); void WorkfileQueryspace_SubtractWorkfile(int32 nFiles); /* Workfile error reporting */ typedef enum WorkfileError { WORKFILE_ERROR_LIMIT_PER_QUERY, WORKFILE_ERROR_LIMIT_PER_SEGMENT, WORKFILE_ERROR_LIMIT_FILES_PER_QUERY, WORKFILE_ERROR_UNKNOWN, } WorkfileError; /* Holds latest workfile error type */ extern WorkfileError workfileError; void workfile_mgr_report_error(void); #endif /* __WORKFILE_MGR_H__ */ /* EOF */
28.31383
97
0.774939
bd2801fe657d305e7de2905d03375668905926b9
2,279
h
C
src/media/playback/mediaplayer/ffmpeg/ffmpeg_video_decoder.h
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
210
2019-02-05T12:45:09.000Z
2022-03-28T07:59:06.000Z
src/media/playback/mediaplayer/ffmpeg/ffmpeg_video_decoder.h
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
56
2021-06-03T03:16:25.000Z
2022-03-20T01:07:44.000Z
src/media/playback/mediaplayer/ffmpeg/ffmpeg_video_decoder.h
allansrc/fuchsia
a2c235b33fc4305044d496354a08775f30cdcf37
[ "BSD-2-Clause" ]
73
2019-03-06T18:55:23.000Z
2022-03-26T12:04:51.000Z
// Copyright 2016 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SRC_MEDIA_PLAYBACK_MEDIAPLAYER_FFMPEG_FFMPEG_VIDEO_DECODER_H_ #define SRC_MEDIA_PLAYBACK_MEDIAPLAYER_FFMPEG_FFMPEG_VIDEO_DECODER_H_ #include <lib/sync/completion.h> #include "lib/media/cpp/timeline_rate.h" #include "src/media/playback/mediaplayer/ffmpeg/ffmpeg_decoder_base.h" namespace media_player { // Processor implementation employing and ffmpeg video decoder. class FfmpegVideoDecoder : public FfmpegDecoderBase { public: static std::shared_ptr<Processor> Create(AvCodecContextPtr av_codec_context); FfmpegVideoDecoder(AvCodecContextPtr av_codec_context); ~FfmpegVideoDecoder() override; // Node implementation. void ConfigureConnectors() override; void OnOutputConnectionReady(size_t output_index) override; protected: // FfmpegDecoderBase overrides. void OnNewInputPacket(const PacketPtr& packet) override; int BuildAVFrame(const AVCodecContext& av_codec_context, AVFrame* av_frame) override; PacketPtr CreateOutputPacket(const AVFrame& av_frame, fbl::RefPtr<PayloadBuffer> payload_buffer) override; const char* label() const override; private: // Frame buffers must be aligned on 32-byte boundaries to enable SIMD // operations. static const int kFrameBufferAlign = 32; // Indicates whether the decoder has a non-zero coded size. bool has_size() const { return aligned_width_ != 0 && aligned_height_ != 0; } // Updates |buffer_size_|, |aligned_width_| and |aligned_height_| based on // |av_codec_context|. Returns true if those values change, false if not. // Specifying a changed size is fine. Specifying a changed pix_fmt is not. bool UpdateSize(const AVCodecContext& av_codec_context); // Calls |ConfigureOutputToUseLocalMemory|. void ConfigureOutput(size_t buffer_size); size_t buffer_size_ = 0; uint32_t aligned_width_ = 0; uint32_t aligned_height_ = 0; size_t configured_output_buffer_size_ = 0; std::unique_ptr<StreamType> revised_stream_type_; sync_completion completion_; }; } // namespace media_player #endif // SRC_MEDIA_PLAYBACK_MEDIAPLAYER_FFMPEG_FFMPEG_VIDEO_DECODER_H_
33.514706
87
0.780167
bd2d8b0042238868e44fab7ef946dd1016a4c9bc
3,878
c
C
si/sibldpol.c
ScottDaniels/libs
a7a556d48890eea8d7dbbdafc0171ebed6dc8375
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
si/sibldpol.c
ScottDaniels/libs
a7a556d48890eea8d7dbbdafc0171ebed6dc8375
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
si/sibldpol.c
ScottDaniels/libs
a7a556d48890eea8d7dbbdafc0171ebed6dc8375
[ "BSD-2-Clause-FreeBSD" ]
null
null
null
/* ================================================================================================= (c) Copyright 1995-2011 By E. Scott Daniels. 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 E. Scott Daniels ``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 E. Scott Daniels 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. The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of E. Scott Daniels. ================================================================================================= */ /* ***************************************************************************** * Mnemonic: SIbldpoll * Abstract: This routine will fill in the read and write fdsets in the * general info struct based on the current transport provider * list. Those tb blocks that have something queued to send will * be added to the write fdset. The fdcount variable will be set to * the highest sid + 1 and it can be passed to the select system * call when it is made. * Parms: gptr - Pointer to the general info structure * Returns: Nothing * Date: 26 March 1995 * Author: E. Scott Daniels * *************************************************************************** */ #include "sisetup.h" /* get definitions etc */ extern void SIbldpoll( struct ginfo_blk* gptr ) { struct tp_blk *tpptr; /* pointer into tp list */ struct tp_blk *nextb; /* pointer into tp list */ gptr->fdcount = -1; /* reset largest sid found */ FD_ZERO( &gptr->readfds ); /* reset the read and write sets */ FD_ZERO( &gptr->writefds ); FD_ZERO( &gptr->execpfds ); for( tpptr = gptr->tplist; tpptr != NULL; tpptr = nextb ) { nextb = tpptr->next; if( tpptr->flags & TPF_DELETE ) { SIterm( tpptr ); } else { if( tpptr->fd >= OK ) /* if valid file descriptor */ { if( tpptr->fd >= gptr->fdcount ) gptr->fdcount = tpptr->fd + 1; /* save largest fd (+1) for select */ FD_SET( tpptr->fd, &gptr->execpfds ); /* set all fds for execpts */ if( !(tpptr->flags & TPF_DRAIN) ) /* if not draining */ FD_SET( tpptr->fd, &gptr->readfds ); /* set test for data flag */ if( tpptr->squeue != NULL ) /* stuff pending to send ? */ FD_SET( tpptr->fd, &gptr->writefds ); /* set flag to see if writable */ } } } if( gptr->kbfile >= 0 ) /* if we have input open */ FD_SET( 0, &gptr->readfds ); /* set to check stdin for read stuff */ } /* SIbldpoll */
44.068182
97
0.594121
64a2b414b1bfcf43056c48b531372067b1aca881
10,499
h
C
Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/twoWayDopplerPartial.h
sebranchett/tudat
24e5f3cc85c250fcbed0aac37f026c1dd7fd6c44
[ "BSD-3-Clause" ]
null
null
null
Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/twoWayDopplerPartial.h
sebranchett/tudat
24e5f3cc85c250fcbed0aac37f026c1dd7fd6c44
[ "BSD-3-Clause" ]
null
null
null
Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/twoWayDopplerPartial.h
sebranchett/tudat
24e5f3cc85c250fcbed0aac37f026c1dd7fd6c44
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2010-2019, Delft University of Technology * All rigths reserved * * This file is part of the Tudat. Redistribution and use in source and * binary forms, with or without modification, are permitted exclusively * under the terms of the Modified BSD license. You should have received * a copy of the license with this file. If not, please or visit: * http://tudat.tudelft.nl/LICENSE. */ #ifndef TUDAT_TWOWAYDOPPLERPARTIAL_H #define TUDAT_TWOWAYDOPPLERPARTIAL_H #include <functional> #include <Eigen/Core> #include "Tudat/Astrodynamics/BasicAstrodynamics/physicalConstants.h" #include "Tudat/Astrodynamics/OrbitDetermination/EstimatableParameters/estimatableParameter.h" #include "Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/observationPartial.h" #include "Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/oneWayDopplerPartial.h" #include "Tudat/Astrodynamics/OrbitDetermination/ObservationPartials/oneWayRangePartial.h" #include "Tudat/Astrodynamics/ObservationModels/linkTypeDefs.h" namespace tudat { namespace observation_partials { class TwoWayDopplerScaling: public PositionPartialScaling { public: //! Constructor /*! * Constructor * \param dopplerScalings List of consitutent one-way Doppler scaling objects, with entry i indicating link i * (0=transmitter to reflector, etc.) * \param rangeScalings List of consitutent one-way range scaling objects, with entry i indicating link i * (0=transmitter to reflector, etc.) * \param oneWayDopplerModels List of double precision observation functions for one-way Doppler, with entry i indicating * link i (0=transmitter to reflector, etc.) */ TwoWayDopplerScaling( const std::vector< std::shared_ptr< OneWayDopplerScaling > > dopplerScalings, const std::vector< std::shared_ptr< OneWayRangeScaling > > rangeScalings, const std::vector< std::function< double( const double, const observation_models::LinkEndType ) > > oneWayDopplerModels ) { if( dopplerScalings.size( ) != 2 ) { throw std::runtime_error( "Error when making two-way Doppler scaling, one-way Doppler scaling size is inconsistent" ); } uplinkDopplerScaling_ = dopplerScalings.at( 0 ); downlinkDopplerScaling_ = dopplerScalings.at( 1 ); if( rangeScalings.size( ) != 2 ) { throw std::runtime_error( "Error when making two-way Doppler scaling, one-way range scaling size is inconsistent" ); } uplinkRangeScaling_ = rangeScalings.at( 0 ); downlinkRangeScaling_ = rangeScalings.at( 1 ); if( oneWayDopplerModels.size( ) != 2 ) { throw std::runtime_error( "Error when making two-way Doppler scaling, one-way modelg size is inconsistent" ); } uplinkDopplerModel_ = oneWayDopplerModels.at( 0 ); downlinkDopplerModel_ = oneWayDopplerModels.at( 1 ); } //! Update the scaling object to the current times and states /*! * Update the scaling object to the current times and states * \param linkEndStates List of states at each link end during observation Index of vector maps to link end for a * given ObsevableType through getLinkEndIndex function. * \param times List of times at each link end during observation. * \param fixedLinkEnd Link end at which observation time is defined, i.e. link end for which associated time * is kept constant when computing observable. * \param currentObservation Value of observation for which partial scaling is to be computed */ void update( const std::vector< Eigen::Vector6d >& linkEndStates, const std::vector< double >& times, const observation_models::LinkEndType fixedLinkEnd, const Eigen::VectorXd currentObservation ); //! Funtion to get the relevant derivative of one-way Doppler observation, when setting up tow-way Doppler mode /*! * Funtion to get the relevant derivative of one-way Doppler observation, when setting up tow-way Doppler mode. For a fixed * transmitter, this is the downlink, for a fixed receiver it is the uplink. For a fixed reflector, no derivatives are * relevant and zero is returned * \param fixedLinkEnd Link end that is fixed when computing the two-way observable * \return Relevant one-way link Doppler obervation partial (multiplied by -1 if relevant partial derivative). */ double getRelevantOneWayDopplerTimePartial( const observation_models::LinkEndType fixedLinkEnd ) { if( fixedLinkEnd == observation_models::transmitter ) { return downlinkOneWayDopplerTimeDerivative_; } else if( fixedLinkEnd == observation_models::receiver ) { return -uplinkOneWayDopplerTimeDerivative_; } else { return 0.0; } } //! Function to get value by which to scale a constituent one-way Doppler partial for it to be put into two-way Doppler partial. /*! * Function to get value by which to scale a constituent one-way Doppler partial for it to be put into two-way Doppler partial, * for a single constituent one-way Doppler (as computed by last call to update function). * \param linkIndex Index of link for which scaling is to be returned. * \return Value by which to scale a constituent one-way Doppler partial for it to be put into two-way Doppler partial. */ double getProjectedRelativeVelocityRatio( const int linkIndex ) { return projectedRelativeVelocityRatios_.at( linkIndex ); } private: //! One-way Doppler partial scaling object for uplink std::shared_ptr< OneWayDopplerScaling > uplinkDopplerScaling_; //! One-way Doppler partial scaling object for downlink std::shared_ptr< OneWayDopplerScaling > downlinkDopplerScaling_; //! One-way range partial scaling object for uplink std::shared_ptr< OneWayRangeScaling > uplinkRangeScaling_; //! One-way range partial scaling object for downlink std::shared_ptr< OneWayRangeScaling > downlinkRangeScaling_; //! Function to return the uplink one-way Doppler observation std::function< double( const double, const observation_models::LinkEndType ) > uplinkDopplerModel_; //! Function to return the downlink one-way Doppler observation std::function< double( const double, const observation_models::LinkEndType ) > downlinkDopplerModel_; //! Current partial time derivative of one-way Doppler for uplink. double uplinkOneWayDopplerTimeDerivative_; //! Current partial time derivative of one-way Doppler for downlink. double downlinkOneWayDopplerTimeDerivative_; //! List of values by which to scale constituent one-way ranges partials for it to be put into two-way range partial. std::map< int, double > projectedRelativeVelocityRatios_; }; //! Class to compute the partial derivatives of an two-way range observation partial. class TwoWayDopplerPartial: public ObservationPartial< 1 > { public: typedef std::vector< std::pair< Eigen::Matrix< double, 1, Eigen::Dynamic >, double > > TwoWayDopplerPartialReturnType; //! Constructor /*! * Constructor * \param twoWayDopplerScaler Scaling object used for mapping partials of one-way ranges to partials of observable * \param dopplerPartialList List of one-way range partials per link index. * \param rangePartialList List of one-way range per link index. * \param parameterIdentifier Id of parameter for which instance of class computes partial derivatives. * \param numberOfLinkEnds Number of link ends in two-way observable */ TwoWayDopplerPartial( const std::shared_ptr< TwoWayDopplerScaling > twoWayDopplerScaler, const std::map< int, std::shared_ptr< ObservationPartial< 1 > > >& dopplerPartialList, const std::map< int, std::shared_ptr< ObservationPartial< 1 > > >& rangePartialList, const estimatable_parameters::EstimatebleParameterIdentifier parameterIdentifier, const int numberOfLinkEnds ): ObservationPartial< 1 >( parameterIdentifier ), twoWayDopplerScaler_( twoWayDopplerScaler ), dopplerPartialList_( dopplerPartialList ), rangePartialList_( rangePartialList ), numberOfLinkEnds_( numberOfLinkEnds ){ } //! Destructor ~TwoWayDopplerPartial( ) { } //! Function to calculate the observation partial(s) at required time and state /*! * Function to calculate the observation partial(s) at required time and state. State and time * are typically obtained from evaluation of observation model. * \param states Link end states. Index maps to link end for a given ObsevableType through getLinkEndIndex function. * \param times Link end time. * \param linkEndOfFixedTime Link end that is kept fixed when computing the observable. * \param currentObservation Value of the observation for which the partial is to be computed (default NaN for * compatibility purposes) * \return Vector of pairs containing partial values and associated times. */ TwoWayDopplerPartialReturnType calculatePartial( const std::vector< Eigen::Vector6d >& states, const std::vector< double >& times, const observation_models::LinkEndType linkEndOfFixedTime, const Eigen::Vector1d& currentObservation = Eigen::Vector1d::Constant( TUDAT_NAN ) ); protected: //! Scaling object used for mapping partials of one-way ranges to partials of observable std::shared_ptr< TwoWayDopplerScaling > twoWayDopplerScaler_; //! List of one-way range partials per link index. std::map< int, std::shared_ptr< ObservationPartial< 1 > > > dopplerPartialList_; //! Predeclared iterator std::map< int, std::shared_ptr< ObservationPartial< 1 > > >::iterator dopplerPartialIterator_; //! List of one-way range partials per link index. std::map< int, std::shared_ptr< ObservationPartial< 1 > > > rangePartialList_; //! Predeclared iterator std::map< int, std::shared_ptr< ObservationPartial< 1 > > >::iterator rangePartialIterator_; //! Number of link ends in two-way observable int numberOfLinkEnds_; }; } } #endif // TUDAT_TWOWAYDOPPLERPARTIAL_H
45.060086
143
0.711211
d938b3a7b6539131a8ff288b7e2d50b1b8e4efc2
1,606
c
C
uboot/board/renesas/rsk7264/rsk7264.c
bingchunjin/1806_SDK
d5ed0258fc22f60e00ec025b802d175f33da6e41
[ "MIT" ]
35
2019-04-26T04:00:10.000Z
2022-03-30T11:37:06.000Z
uboot/board/renesas/rsk7264/rsk7264.c
bingchunjin/1806_SDK
d5ed0258fc22f60e00ec025b802d175f33da6e41
[ "MIT" ]
4
2016-08-30T11:30:25.000Z
2020-12-27T09:58:07.000Z
uboot/board/renesas/rsk7264/rsk7264.c
bingchunjin/1806_SDK
d5ed0258fc22f60e00ec025b802d175f33da6e41
[ "MIT" ]
11
2020-01-07T05:39:10.000Z
2021-12-26T07:27:21.000Z
/* * Copyright (C) 2011 Renesas Electronics Europe Ltd. * Copyright (C) 2008 Renesas Solutions Corp. * Copyright (C) 2008 Nobuhiro Iwamatsu * * Based on u-boot/board/rsk7264/rsk7203.c * * SPDX-License-Identifier: GPL-2.0+ */ #include <common.h> #include <net.h> #include <netdev.h> #include <asm/io.h> #include <asm/processor.h> DECLARE_GLOBAL_DATA_PTR; int checkboard(void) { puts("BOARD: Renesas Technology RSK7264\n"); return 0; } int board_init(void) { return 0; } int dram_init(void) { gd->bd->bi_memstart = CONFIG_SYS_SDRAM_BASE; gd->bd->bi_memsize = CONFIG_SYS_SDRAM_SIZE; printf("DRAM: %dMB\n", CONFIG_SYS_SDRAM_SIZE / (1024 * 1024)); return 0; } void led_set_state(unsigned short value) { } /* * The RSK board has the SMSC89218 wired up 'incorrectly'. * Byte-swapping is necessary, and so poor performance is inevitable. * This problem cannot evade by the swap function of CHIP, this can * evade by software Byte-swapping. * And this has problem by FIFO access only. pkt_data_pull/pkt_data_push * functions necessary to solve this problem. */ u32 pkt_data_pull(struct eth_device *dev, u32 addr) { volatile u16 *addr_16 = (u16 *)(dev->iobase + addr); return (u32)((swab16(*addr_16) << 16) & 0xFFFF0000)\ | swab16(*(addr_16 + 1)); } void pkt_data_push(struct eth_device *dev, u32 addr, u32 val) { addr += dev->iobase; *(volatile u16 *)(addr + 2) = swab16((u16)val); *(volatile u16 *)(addr) = swab16((u16)(val >> 16)); } int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_SMC911X rc = smc911x_initialize(0, CONFIG_SMC911X_BASE); #endif return rc; }
22.305556
72
0.703611
030d9c73d40c2ab747db70d26499dc7b25675683
713
h
C
Headers/SBUIStarkStartupAnimation.h
MoTheNerd/oledlock
b1a79668a8f31d0c8cdfea11e14d5dc19654f380
[ "MIT" ]
null
null
null
Headers/SBUIStarkStartupAnimation.h
MoTheNerd/oledlock
b1a79668a8f31d0c8cdfea11e14d5dc19654f380
[ "MIT" ]
null
null
null
Headers/SBUIStarkStartupAnimation.h
MoTheNerd/oledlock
b1a79668a8f31d0c8cdfea11e14d5dc19654f380
[ "MIT" ]
1
2018-03-05T19:20:57.000Z
2018-03-05T19:20:57.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "SBUIStarkScreenAnimationController.h" @class UIView; @interface SBUIStarkStartupAnimation : SBUIStarkScreenAnimationController { UIView *_fromLockoutView; } @property(readonly, nonatomic) UIView *fromLockoutView; // @synthesize fromLockoutView=_fromLockoutView; - (void).cxx_destruct; - (void)_abortAnimation; - (void)_cleanupAnimation; - (void)_begin; - (id)_getTransitionWindow; - (id)initWithApplicationSceneEntity:(id)arg1 fromLockoutView:(id)arg2 starkScreenController:(id)arg3; - (id)initFromLockoutView:(id)arg1 starkScreenController:(id)arg2; @end
26.407407
104
0.764376
23b58b555e2cd3696455577759f1b9c1c715682e
3,376
h
C
System/Library/PrivateFrameworks/AppleDepth.framework/ADCameraCalibration.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
System/Library/PrivateFrameworks/AppleDepth.framework/ADCameraCalibration.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/AppleDepth.framework/ADCameraCalibration.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
/* * This header is generated by classdump-dyld 1.5 * on Wednesday, October 27, 2021 at 3:23:38 PM Mountain Standard Time * Operating System: Version 13.5.1 (Build 17F80) * Image Source: /System/Library/PrivateFrameworks/AppleDepth.framework/AppleDepth * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ @protocol ADLensDistortionModel; #import <AppleDepth/AppleDepth-Structs.h> @interface ADCameraCalibration : NSObject { float _pixelSize; id<ADLensDistortionModel> _distortionModel; CGSize _referenceDimensions; SCD_Struct_AD12 _intrinsicMatrix; SCD_Struct_AD5 _cameraToPlatformTransform; } @property (nonatomic,readonly) SCD_Struct_AD12 intrinsicMatrix; //@synthesize intrinsicMatrix=_intrinsicMatrix - In the implementation block @property (nonatomic,readonly) CGSize referenceDimensions; //@synthesize referenceDimensions=_referenceDimensions - In the implementation block @property (nonatomic,readonly) SCD_Struct_AD5 cameraToPlatformTransform; //@synthesize cameraToPlatformTransform=_cameraToPlatformTransform - In the implementation block @property (nonatomic,readonly) float pixelSize; //@synthesize pixelSize=_pixelSize - In the implementation block @property (nonatomic,readonly) id<ADLensDistortionModel> distortionModel; //@synthesize distortionModel=_distortionModel - In the implementation block +(void)transform:(unsigned long long)arg1 points:(const 2*)arg2 with:(SCD_Struct_AD5)arg3 outPoints:(9*)arg4 ; -(id)ar_initWithImageData:(id)arg1 calibrationData:(id)arg2 ; -(id)ar_initWithImageData:(id)arg1 cameraToPlatformTransform:(SCD_Struct_AD5)arg2 pixelSize:(double)arg3 referenceDimensions:(CGSize)arg4 distortionCenter:(CGPoint)arg5 lensDistortionLookupTable:(id)arg6 inverseLensDistortionLookupTable:(id)arg7 ; -(id)ar_initWithImageData:(id)arg1 calibrationData:(id)arg2 cameraToPlatformTransform:(SCD_Struct_AD5)arg3 ; -(SCD_Struct_AD12)intrinsicMatrix; -(float)pixelSize; -(SCD_Struct_AD5)cameraToPlatformTransform; -(CGSize)referenceDimensions; -(id)initWithIntrinsics:(SCD_Struct_AD12)arg1 cameraToPlatformTransform:(SCD_Struct_AD5)arg2 pixelSize:(double)arg3 forReferenceDimensions:(CGSize)arg4 withDistortionModel:(id)arg5 ; -(SCD_Struct_AD5)getTransformationTo:(id)arg1 ; -(void)project:(unsigned long long)arg1 points:(const 2*)arg2 outUndistortedPixels:(CGPoint*)arg3 outR:(float*)arg4 ; -(void)distort:(unsigned long long)arg1 undistortedPixels:(const CGPoint*)arg2 outDistorted:(CGPoint*)arg3 ; -(void)transform:(unsigned long long)arg1 points:(const 2*)arg2 toCamera:(id)arg3 outPoints:(4*)arg4 ; -(void)project:(unsigned long long)arg1 points:(const 2*)arg2 outUndistortedPixels:(CGPoint*)arg3 ; -(void)backProject:(unsigned long long)arg1 undistortedPixels:(const CGPoint*)arg2 withZ:(const float*)arg3 outPoints:(4*)arg4 ; -(void)backProject:(unsigned long long)arg1 undistortedPixels:(const CGPoint*)arg2 withR:(const float*)arg3 outPoints:(4*)arg4 ; -(void)undistort:(unsigned long long)arg1 distortedPixels:(const CGPoint*)arg2 outUndistorted:(CGPoint*)arg3 ; -(id<ADLensDistortionModel>)distortionModel; @end
71.829787
247
0.756813
26df7f6f7cea46e363f6b96ffbfcaa0ca8a61589
9,661
c
C
third_party/mesa/src/src/gallium/drivers/identity/id_screen.c
zipated/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
2,151
2020-04-18T07:31:17.000Z
2022-03-31T08:39:18.000Z
third_party/mesa/src/src/gallium/drivers/identity/id_screen.c
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
395
2020-04-18T08:22:18.000Z
2021-12-08T13:04:49.000Z
third_party/mesa/src/src/gallium/drivers/identity/id_screen.c
cangulcan/src
2b8388091c71e442910a21ada3d97ae8bc1845d3
[ "BSD-3-Clause" ]
338
2020-04-18T08:03:10.000Z
2022-03-29T12:33:22.000Z
/************************************************************************** * * Copyright 2009 VMware, Inc. * All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, 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 (including the * next paragraph) 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 NON-INFRINGEMENT. * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS 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 "pipe/p_screen.h" #include "pipe/p_state.h" #include "util/u_memory.h" #include "id_public.h" #include "id_screen.h" #include "id_context.h" #include "id_objects.h" static void identity_screen_destroy(struct pipe_screen *_screen) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; screen->destroy(screen); FREE(id_screen); } static const char * identity_screen_get_name(struct pipe_screen *_screen) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->get_name(screen); } static const char * identity_screen_get_vendor(struct pipe_screen *_screen) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->get_vendor(screen); } static int identity_screen_get_param(struct pipe_screen *_screen, enum pipe_cap param) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->get_param(screen, param); } static int identity_screen_get_shader_param(struct pipe_screen *_screen, unsigned shader, enum pipe_shader_cap param) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->get_shader_param(screen, shader, param); } static float identity_screen_get_paramf(struct pipe_screen *_screen, enum pipe_capf param) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->get_paramf(screen, param); } static boolean identity_screen_is_format_supported(struct pipe_screen *_screen, enum pipe_format format, enum pipe_texture_target target, unsigned sample_count, unsigned tex_usage) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->is_format_supported(screen, format, target, sample_count, tex_usage); } static struct pipe_context * identity_screen_context_create(struct pipe_screen *_screen, void *priv) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; struct pipe_context *result; result = screen->context_create(screen, priv); if (result) return identity_context_create(_screen, result); return NULL; } static struct pipe_resource * identity_screen_resource_create(struct pipe_screen *_screen, const struct pipe_resource *templat) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; struct pipe_resource *result; result = screen->resource_create(screen, templat); if (result) return identity_resource_create(id_screen, result); return NULL; } static struct pipe_resource * identity_screen_resource_from_handle(struct pipe_screen *_screen, const struct pipe_resource *templ, struct winsys_handle *handle) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; struct pipe_resource *result; /* TODO trace call */ result = screen->resource_from_handle(screen, templ, handle); result = identity_resource_create(identity_screen(_screen), result); return result; } static boolean identity_screen_resource_get_handle(struct pipe_screen *_screen, struct pipe_resource *_resource, struct winsys_handle *handle) { struct identity_screen *id_screen = identity_screen(_screen); struct identity_resource *id_resource = identity_resource(_resource); struct pipe_screen *screen = id_screen->screen; struct pipe_resource *resource = id_resource->resource; /* TODO trace call */ return screen->resource_get_handle(screen, resource, handle); } static void identity_screen_resource_destroy(struct pipe_screen *screen, struct pipe_resource *_resource) { identity_resource_destroy(identity_resource(_resource)); } static void identity_screen_flush_frontbuffer(struct pipe_screen *_screen, struct pipe_resource *_resource, unsigned level, unsigned layer, void *context_private) { struct identity_screen *id_screen = identity_screen(_screen); struct identity_resource *id_resource = identity_resource(_resource); struct pipe_screen *screen = id_screen->screen; struct pipe_resource *resource = id_resource->resource; screen->flush_frontbuffer(screen, resource, level, layer, context_private); } static void identity_screen_fence_reference(struct pipe_screen *_screen, struct pipe_fence_handle **ptr, struct pipe_fence_handle *fence) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; screen->fence_reference(screen, ptr, fence); } static boolean identity_screen_fence_signalled(struct pipe_screen *_screen, struct pipe_fence_handle *fence) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->fence_signalled(screen, fence); } static boolean identity_screen_fence_finish(struct pipe_screen *_screen, struct pipe_fence_handle *fence, uint64_t timeout) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->fence_finish(screen, fence, timeout); } static uint64_t identity_screen_get_timestamp(struct pipe_screen *_screen) { struct identity_screen *id_screen = identity_screen(_screen); struct pipe_screen *screen = id_screen->screen; return screen->get_timestamp(screen); } struct pipe_screen * identity_screen_create(struct pipe_screen *screen) { struct identity_screen *id_screen; id_screen = CALLOC_STRUCT(identity_screen); if (!id_screen) { return NULL; } id_screen->base.destroy = identity_screen_destroy; id_screen->base.get_name = identity_screen_get_name; id_screen->base.get_vendor = identity_screen_get_vendor; id_screen->base.get_param = identity_screen_get_param; id_screen->base.get_shader_param = identity_screen_get_shader_param; id_screen->base.get_paramf = identity_screen_get_paramf; id_screen->base.is_format_supported = identity_screen_is_format_supported; id_screen->base.context_create = identity_screen_context_create; id_screen->base.resource_create = identity_screen_resource_create; id_screen->base.resource_from_handle = identity_screen_resource_from_handle; id_screen->base.resource_get_handle = identity_screen_resource_get_handle; id_screen->base.resource_destroy = identity_screen_resource_destroy; id_screen->base.flush_frontbuffer = identity_screen_flush_frontbuffer; id_screen->base.fence_reference = identity_screen_fence_reference; id_screen->base.fence_signalled = identity_screen_fence_signalled; id_screen->base.fence_finish = identity_screen_fence_finish; id_screen->base.get_timestamp = identity_screen_get_timestamp; id_screen->screen = screen; return &id_screen->base; }
33.77972
79
0.672601
8c0c75deb5e78c8c76e448c488b6543744f65cfe
1,948
h
C
chrome/browser/ui/webui/version/version_handler.h
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/ui/webui/version/version_handler.h
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/ui/webui/version/version_handler.h
Ron423c/chromium
2edf7b980065b648f8b2a6e52193d83832fe36b7
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
1
2021-03-07T14:20:02.000Z
2021-03-07T14:20:02.000Z
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_BROWSER_UI_WEBUI_VERSION_VERSION_HANDLER_H_ #define CHROME_BROWSER_UI_WEBUI_VERSION_VERSION_HANDLER_H_ #include <vector> #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/values.h" #include "content/public/browser/web_ui_message_handler.h" // Handler class for Version page operations. class VersionHandler : public content::WebUIMessageHandler { public: VersionHandler(); ~VersionHandler() override; // content::WebUIMessageHandler implementation. void RegisterMessages() override; // Callback for the "requestVersionInfo" message sent by |chrome.send| in JS. // This is still supported for platform-specific asynchronous calls (see // derived classes) but the main version information is now retrieved with // below messages using |cr.sendWithPromise|. virtual void HandleRequestVersionInfo(const base::ListValue* args); // Callback for the "requestVariationInfo" message. This resolves immediately // with variations list as well as command variations if requested. virtual void HandleRequestVariationInfo(const base::ListValue* args); // Callback for the "requestPathInfo" message. This resolves asynchronously // with |OnGotFilePaths|. virtual void HandleRequestPathInfo(const base::ListValue* args); private: // Callback which handles returning the executable and profile paths to the // front end. void OnGotFilePaths(std::string callback_id, base::string16* executable_path_data, base::string16* profile_path_data); // Factory for the creating refs in callbacks. base::WeakPtrFactory<VersionHandler> weak_ptr_factory_{this}; DISALLOW_COPY_AND_ASSIGN(VersionHandler); }; #endif // CHROME_BROWSER_UI_WEBUI_VERSION_VERSION_HANDLER_H_
37.461538
79
0.769507
e7c051ef5e0e908e3e75701c16c76f21c0122544
25,001
c
C
blinky/blinky/asf-3.21.0/sam/drivers/spi/unit_tests/unit_tests.c
femtoio/femtousb-blink-example
5e166bdee500f67142d0ee83a1a169bab57fe142
[ "MIT" ]
null
null
null
blinky/blinky/asf-3.21.0/sam/drivers/spi/unit_tests/unit_tests.c
femtoio/femtousb-blink-example
5e166bdee500f67142d0ee83a1a169bab57fe142
[ "MIT" ]
null
null
null
blinky/blinky/asf-3.21.0/sam/drivers/spi/unit_tests/unit_tests.c
femtoio/femtousb-blink-example
5e166bdee500f67142d0ee83a1a169bab57fe142
[ "MIT" ]
null
null
null
/** * \file * * \brief Unit tests for SPI driver. * * Copyright (c) 2011-2014 Atmel Corporation. All rights reserved. * * \asf_license_start * * \page License * * 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. * * 3. The name of Atmel may not be used to endorse or promote products derived * from this software without specific prior written permission. * * 4. This software may only be redistributed and used in connection with an * Atmel microcontroller product. * * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * * \asf_license_stop * */ /** * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> */ #include <stdint.h> #include <stdbool.h> #include <board.h> #include <sysclk.h> #include <spi.h> #include <string.h> #include <unit_test/suite.h> #include <stdio_serial.h> #include <conf_test.h> #include <conf_board.h> /** * \mainpage * * \section intro Introduction * This is the unit test application for the SPI driver. * It consists of test cases for the following functionalities: * - SPI Reset/Enable/Disable * - SPI Tx/Rx (loopback) * - SPI DataFlash operations (if there is DataFlash on board) * - SPI Write Protection * * \section files Main Files * - \ref unit_tests.c * - \ref conf_test.h * - \ref conf_board.h * - \ref conf_clock.h * - \ref conf_usart_serial.h * * \section device_info Device Info * All SAM devices can be used. * This example has been tested with the following setup: * - sam3n4c_sam3n_ek * - sam3s4c_sam3s_ek * - sam3sd8c_sam3s_ek2 * - sam3u4e_sam3u_ek * - sam3x8h_sam3x_ek * - sam4s16c_sam4s_ek * - sam4sd32c_sam4s_ek2 * - sam4e16e_sam4e_ek * - sam4lc4c_sam4l_ek * - sam4lc4c_sam4l_xplained_pro * - sam4lc8c_sam4l8_xplained_pro * - sam4n16c_sam4n_xplained_pro * - sam4c16c_sam4c_ek * - sam4cp16b_sam4cp16bmb * - sam4cmp16c_sam4cmp_db * - sam4cms16c_sam4cms_db * * \section compinfo Compilation info * This software was written for the GNU GCC and IAR for ARM. Other compilers * may or may not work. * * \section contactinfo Contact Information * For further information, visit <a href="http://www.atmel.com/">Atmel</a>.\n * Support and FAQ: http://www.atmel.com/design-support/ */ //! \name Unit test configuration //@{ /** * \def CONF_TEST_SPI * \brief SPI instance to perform unit tests on. */ /** * \def CONF_TEST_USART * \brief USART to redirect STDIO to. */ /** * \def CONF_TEST_BAUDRATE * \brief Baudrate of USART. */ /** * \def CONF_TEST_CHARLENGTH * \brief Character length (bits) of USART. */ /** * \def CONF_TEST_PARITY * \brief Parity mode of USART. */ /** * \def CONF_TEST_STOPBITS * \brief Stopbit configuration of USART. */ /** * \def CONF_TEST_SPI * \brief SPI base for test. */ /** * \def CONF_TEST_SPI_ID * \brief SPI ID for test. */ /** * \def CONF_TEST_SPI_NPCS * \brief NPCS used for test. */ /** * \def CONF_TEST_SPI_HANDLER * \brief SPI handler for vector table. * \see exceptions.h */ /** * \def CONF_TEST_DF * \brief Defined to enable on-board dataflash test. * \note DataFlash test will use the previously defined Base and ID of SPI. * \note The following *_DF_* is used only when \ref CONF_TEST_DF is defined. */ /** * \def CONF_TEST_DF_NPCS * \brief NPCS used for SPI to communicate with DataFlash. */ /** * \def CONF_TEST_DF_ID * \brief DataFlash ID expected. */ /** * \def CONF_TEST_DF_PAGE_SIZE * \brief Page size for the DataFlash. */ /** * \def CONF_TEST_DF_ADDRESS * \brief DataFlash address used for Erase-Write-Read test. */ //@} /** Convert ns to SPI DLYBS */ #define ns_to_dlybs(ck, ns) ((((ns) * ((ck) / 1000000)) / 1000) + 1) /** Convert ns to SPI DLYBCT */ #define ns_to_dlybct(ck, ns) ((((ns) / 32 * ((ck) / 1000000)) / 1000) + 1) /** Clock polarity */ #define SPI_CLK_POLARITY 1 /** Clock phase */ #define SPI_CLK_PHASE 0 /** Delay before SPCK */ #define SPI_DLYBS 0x40 /** Delay between consecutive transfers */ #define SPI_DLYBCT 0x10 /** PCS to use for test */ #define TEST_PCS ((~(1u << CONF_TEST_SPI_NPCS)) & 0xF) /** Byte to transfer for test */ #define TEST_PATTERN 0xA5 /** Test SPI clock */ #define TEST_CLOCK 10000000 #ifdef CONF_TEST_DF /** PCS to use for DF test */ # define TEST_DF_PCS ((~(1u << CONF_TEST_DF_NPCS)) & 0xF) /** DLYBS to use for DF */ # define TEST_DF_DLYBS ns_to_dlybs(sysclk_get_cpu_hz(), 10) /** DLYBCT to use for DF */ # define TEST_DF_DLYBCT ns_to_dlybct(sysclk_get_cpu_hz(), 5) #endif /** Register offset for _MR */ #define OFFSET_MR 0x04 /** Register offset for _IMR */ #define OFFSET_IER 0x14 /** Register offset for _CSR */ #define OFFSET_CSR 0x30 /** TX interrupt occurred */ volatile bool g_b_spi_interrupt_tx_ready = false; /** RX interrupt occurred */ volatile bool g_b_spi_interrupt_rx_ready = false; /** * \brief Test SPI interrupt handler. */ void CONF_TEST_SPI_HANDLER(void) { uint32_t status = spi_read_status(CONF_TEST_SPI); if (status & SPI_SR_TDRE) { g_b_spi_interrupt_tx_ready = true; spi_disable_interrupt(CONF_TEST_SPI, SPI_IDR_TDRE); } if (status & SPI_SR_RDRF) { g_b_spi_interrupt_rx_ready = true; spi_disable_interrupt(CONF_TEST_SPI, SPI_IDR_RDRF); } } /** * \brief Test SPI setting. * * This test tests SPI reset/enable/disable. * * \param test Current test case. */ static void run_spi_ctrl_test(const struct test_case *test) { spi_enable_clock(CONF_TEST_SPI); /* Test enable */ spi_enable(CONF_TEST_SPI); test_assert_true(test, spi_is_enabled(CONF_TEST_SPI), "Test SPI enable: enable failed"); /* Test reset */ spi_reset(CONF_TEST_SPI); test_assert_true(test, !spi_is_enabled(CONF_TEST_SPI) && CONF_TEST_SPI->SPI_MR == 0 && CONF_TEST_SPI->SPI_IMR == 0 && CONF_TEST_SPI->SPI_CSR[0] == 0 && CONF_TEST_SPI->SPI_CSR[1] == 0 && CONF_TEST_SPI->SPI_CSR[2] == 0 && CONF_TEST_SPI->SPI_CSR[3] == 0 && #if SAM4L CONF_TEST_SPI->SPI_WPCR == 0, #else CONF_TEST_SPI->SPI_WPMR == 0, #endif "Test SPI reset: should have read 0"); } /** * \brief Test SPI transfer. * * This test tests SPI read/write. * * \param test Current test case. */ static void run_spi_trans_test(const struct test_case *test) { spi_status_t rc; uint16_t spi_data; uint8_t spi_pcs; spi_reset(CONF_TEST_SPI); spi_set_lastxfer(CONF_TEST_SPI); spi_set_master_mode(CONF_TEST_SPI); spi_disable_mode_fault_detect(CONF_TEST_SPI); spi_set_peripheral_chip_select_value(CONF_TEST_SPI, CONF_TEST_SPI_NPCS); spi_set_clock_polarity(CONF_TEST_SPI, CONF_TEST_SPI_NPCS, SPI_CLK_POLARITY); spi_set_clock_phase(CONF_TEST_SPI, CONF_TEST_SPI_NPCS, SPI_CLK_PHASE); spi_set_bits_per_transfer(CONF_TEST_SPI, CONF_TEST_SPI_NPCS, SPI_CSR_BITS_8_BIT); spi_set_baudrate_div(CONF_TEST_SPI, CONF_TEST_SPI_NPCS, (sysclk_get_cpu_hz() / TEST_CLOCK)); spi_set_transfer_delay(CONF_TEST_SPI, CONF_TEST_SPI_NPCS, SPI_DLYBS, SPI_DLYBCT); spi_set_variable_peripheral_select(CONF_TEST_SPI); spi_enable_loopback(CONF_TEST_SPI); /* Test read/write timeout: should return SPI_ERROR_TIMEOUT. */ rc = spi_write(CONF_TEST_SPI, TEST_PATTERN, TEST_PCS, 1); test_assert_true(test, rc == SPI_ERROR_TIMEOUT, "Test SPI Write timeout: return code should not be %d", rc); rc = spi_read(CONF_TEST_SPI, &spi_data, &spi_pcs); test_assert_true(test, rc == SPI_ERROR_TIMEOUT, "Test SPI Read timeout: return code should not be %d", rc); spi_enable(CONF_TEST_SPI); spi_enable_interrupt(CONF_TEST_SPI, SPI_IER_TDRE|SPI_IER_RDRF); NVIC_EnableIRQ((IRQn_Type)CONF_TEST_SPI_ID); /* Test write: should return OK. */ rc = spi_write(CONF_TEST_SPI, TEST_PATTERN, TEST_PCS, 1); test_assert_true(test, rc == SPI_OK, "Test SPI Write: return code should not be %d", rc); /* Test read: should return OK with what is sent. */ rc = spi_read(CONF_TEST_SPI, &spi_data, &spi_pcs); test_assert_true(test, rc == SPI_OK, "Test SPI Read: return code should not be %d", rc); test_assert_true(test, spi_data == TEST_PATTERN, "Unexpected SPI data: %x, should be %x", spi_data, TEST_PATTERN); test_assert_true(test, spi_pcs == TEST_PCS, "Unexpected SPI PCS: %x, should be %x", spi_pcs, TEST_PCS); /* Check interrupts. */ test_assert_true(test, g_b_spi_interrupt_tx_ready, "Test SPI TX interrupt not detected"); test_assert_true(test, g_b_spi_interrupt_rx_ready, "Test SPI RX interrupt not detected"); /* Done, disable SPI and all interrupts. */ spi_disable_loopback(CONF_TEST_SPI); spi_disable(CONF_TEST_SPI); spi_disable_interrupt(CONF_TEST_SPI, 0xFFFFFFFF); NVIC_DisableIRQ((IRQn_Type)CONF_TEST_SPI_ID); } #ifdef CONF_TEST_DF /** SPI command to send */ typedef struct spi_command { uint8_t* data; uint8_t* cmd; uint16_t data_size; uint8_t cmd_size:7, cmd_rx:1; uint8_t dummy_size; } spi_cmd_t; /** AT25 command struct */ typedef struct at25_command { uint32_t op_code:8, /** Opcode */ address_h:8, /** Address high byte */ address_m:8, /** Address medium byte */ address_l; /** Address low byte */ } at25_cmd_t; /** Device ready/busy status bit. */ #define AT25_STATUS_RDYBSY (1 << 0) /** Device is ready. */ #define AT25_STATUS_RDYBSY_READY (0 << 0) /** Device is busy with internal operations. */ #define AT25_STATUS_RDYBSY_BUSY (1 << 0) /** Write enable latch status bit. */ #define AT25_STATUS_WEL (1 << 1) /** Device is not write enabled. */ #define AT25_STATUS_WEL_DISABLED (0 << 1) /** Device is write enabled. */ #define AT25_STATUS_WEL_ENABLED (1 << 1) /** Software protection status bitfield. */ #define AT25_STATUS_SWP (3 << 2) /** All sectors are software protected. */ #define AT25_STATUS_SWP_PROTALL (3 << 2) /** Some sectors are software protected. */ #define AT25_STATUS_SWP_PROTSOME (1 << 2) /** No sector is software protected. */ #define AT25_STATUS_SWP_PROTNONE (0 << 2) /** Write protect pin status bit. */ #define AT25_STATUS_WPP (1 << 4) /** Write protect signal is not asserted. */ #define AT25_STATUS_WPP_NOTASSERTED (0 << 4) /** Write protect signal is asserted. */ #define AT25_STATUS_WPP_ASSERTED (1 << 4) /** Erase/program error bit. */ #define AT25_STATUS_EPE (1 << 5) /** Erase or program operation is successful. */ #define AT25_STATUS_EPE_SUCCESS (0 << 5) /** Erase or program error detected. */ #define AT25_STATUS_EPE_ERROR (1 << 5) /** Sector protection registers locked bit. */ #define AT25_STATUS_SPRL (1 << 7) /** Sector protection registers are unlocked. */ #define AT25_STATUS_SPRL_UNLOCKED (0 << 7) /** Sector protection registers are locked. */ #define AT25_STATUS_SPRL_LOCKED (1 << 7) /** Read array command code. */ #define AT25_READ_ARRAY 0x0B /** Read array (low frequency) command code. */ #define AT25_READ_ARRAY_LF 0x03 /** Block erase command code (4K block). */ #define AT25_BLOCK_ERASE_4K 0x20 /** Block erase command code (32K block). */ #define AT25_BLOCK_ERASE_32K 0x52 /** Block erase command code (64K block). */ #define AT25_BLOCK_ERASE_64K 0xD8 /** Chip erase command code 1. */ #define AT25_CHIP_ERASE_1 0x60 /** Chip erase command code 2. */ #define AT25_CHIP_ERASE_2 0xC7 /** Byte/page program command code. */ #define AT25_BYTE_PAGE_PROGRAM 0x02 /** Sequential program mode command code 1. */ #define AT25_SEQUENTIAL_PROGRAM_1 0xAD /** Sequential program mode command code 2. */ #define AT25_SEQUENTIAL_PROGRAM_2 0xAF /** Write enable command code. */ #define AT25_WRITE_ENABLE 0x06 /** Write disable command code. */ #define AT25_WRITE_DISABLE 0x04 /** Protect sector command code. */ #define AT25_PROTECT_SECTOR 0x36 /** Unprotect sector command code. */ #define AT25_UNPROTECT_SECTOR 0x39 /** Read sector protection registers command code. */ #define AT25_READ_SECTOR_PROT 0x3C /** Read status register command code. */ #define AT25_READ_STATUS 0x05 /** Write status register command code. */ #define AT25_WRITE_STATUS 0x01 /** Read manufacturer and device ID command code. */ #define AT25_READ_JEDEC_ID 0x9F /** Deep power-down command code. */ #define AT25_DEEP_PDOWN 0xB9 /** Resume from deep power-down command code. */ #define AT25_RES_DEEP_PDOWN 0xAB /** * \brief Send command to dataflash. * \return True for OK. */ static bool spi_send_cmd(spi_cmd_t *p_cmd) { spi_status_t rc; int i; uint16_t data; uint8_t pcs, last = 0; /* Clear dummy byte */ if (spi_is_rx_full(CONF_TEST_SPI)) spi_read(CONF_TEST_SPI, &data, &pcs); /* Wait until no activity on bus */ while(!spi_is_tx_empty(CONF_TEST_SPI)); /* Send command */ for (i = 0; i < p_cmd->cmd_size; i ++) { last = (i == (p_cmd->cmd_size-1)) && (p_cmd->dummy_size == 0) && (p_cmd->data_size == 0); rc = spi_write(CONF_TEST_SPI, p_cmd->cmd[i], TEST_DF_PCS, last); if (p_cmd->cmd_rx) rc |= spi_read(CONF_TEST_SPI, &data, &pcs); if (rc != SPI_OK) return false; } /* Send dummy clocks */ for (i = 0; i < p_cmd->dummy_size; i ++) { rc = spi_write(CONF_TEST_SPI, 0xFF, TEST_DF_PCS, 0); if (p_cmd->cmd_rx) rc |= spi_read(CONF_TEST_SPI, &data, &pcs); if (rc != SPI_OK) return false; } if (p_cmd->data_size == 0) return true; /* Read/Write data */ for (i = 0; i < p_cmd->data_size; i ++) { last = (i == (p_cmd->data_size-1)); rc = spi_write(CONF_TEST_SPI, p_cmd->data[i], TEST_DF_PCS, last); if (p_cmd->cmd_rx) rc |= spi_read(CONF_TEST_SPI, &data, &pcs); if (rc != SPI_OK) return false; if (p_cmd->cmd_rx) p_cmd->data[i] = (uint8_t)data; } return true; } /** * \brief Read status register of serial flash. * \param p_status Pointer to fill status result. * \return True if OK. */ static bool at25_read_status(uint8_t *p_status) { at25_cmd_t at25_cmd = { .op_code = AT25_READ_STATUS, }; spi_cmd_t spi_cmd = { .data = p_status, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 1, .cmd_rx = 1, .dummy_size = 1, .data_size = 1 }; return spi_send_cmd(&spi_cmd); } /** * \brief Wait until serial flash is ready. * \param p_status Optional pointer to return the latest status. * \return True if OK. */ static bool at25_wait(uint8_t *p_status) { uint8_t status = AT25_STATUS_RDYBSY; while (status & AT25_STATUS_RDYBSY) { if (at25_read_status(&status) == false) return false; } if (p_status) *p_status = status; return true; } /** * \brief Read the ID of serial flash. * \param p_id Pointer to fill ID result (word of 4 bytes). * \return True if OK. */ static bool at25_read_id(uint32_t *p_id) { at25_cmd_t at25_cmd = { .op_code = AT25_READ_JEDEC_ID, }; spi_cmd_t spi_cmd = { .data = (uint8_t*)p_id, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 1, .cmd_rx = 1, .dummy_size = 0, .data_size = 4 }; return spi_send_cmd(&spi_cmd); } /** * \brief Enable serial flash write. * \return True if OK. */ static bool at25_enable_write(void) { at25_cmd_t at25_cmd = { .op_code = AT25_WRITE_ENABLE, }; spi_cmd_t spi_cmd = { .data = NULL, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 1, .cmd_rx = 0, .dummy_size = 0, .data_size = 0 }; return spi_send_cmd(&spi_cmd); } /** * \brief Erase 4K block. * \param address Serial flash internal address. * \return True if OK. */ static bool at25_erase_block_4k(const uint32_t address) { bool rc; uint8_t status; at25_cmd_t at25_cmd = { .op_code = AT25_BLOCK_ERASE_4K }; spi_cmd_t spi_cmd = { .data = NULL, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 4, .cmd_rx = 0, .dummy_size = 0, .data_size = 0 }; at25_cmd.address_h = (address & 0xFF0000) >> 16; at25_cmd.address_m = (address & 0x00FF00) >> 8; at25_cmd.address_l = (address & 0x0000FF) >> 0; rc = at25_enable_write(); if (!rc) return false; rc = spi_send_cmd(&spi_cmd); if (!rc) return false; rc = at25_wait(&status); if (!rc) return false; if (status & AT25_STATUS_EPE) return false; return true; } /** * \brief Unprotect a sector. * \param address Serial flash internal address. * \return True if OK. */ static bool at25_unprotect_sector(const uint32_t address) { bool rc; uint8_t status; at25_cmd_t at25_cmd = { .op_code = AT25_UNPROTECT_SECTOR }; spi_cmd_t spi_cmd = { .data = NULL, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 4, .cmd_rx = 0, .dummy_size = 0, .data_size = 0 }; at25_cmd.address_h = (address & 0xFF0000) >> 16; at25_cmd.address_m = (address & 0x00FF00) >> 8; at25_cmd.address_l = (address & 0x0000FF) >> 0; rc = at25_enable_write(); if (!rc) return false; rc = spi_send_cmd(&spi_cmd); if (!rc) return false; rc = at25_wait(&status); if (!rc) return false; if (status & AT25_STATUS_EPE) return false; return true; } /** * \brief Read from serial flash. * \param address Serial flash internal address. * \param p_buf Pointer to data buffer to fill. * \param size Data buffer size. * \return True if OK. */ static bool at25_read(const uint32_t address, uint8_t *p_buf, uint32_t size) { at25_cmd_t at25_cmd = { .op_code = AT25_READ_ARRAY }; spi_cmd_t spi_cmd = { .data = p_buf, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 4, .cmd_rx = 1, .dummy_size = 1, .data_size = size }; at25_cmd.address_h = (address & 0xFF0000) >> 16; at25_cmd.address_m = (address & 0x00FF00) >> 8; at25_cmd.address_l = (address & 0x0000FF) >> 0; return spi_send_cmd(&spi_cmd); } /** * \brief Write to serial flash. * \param address Serial flash internal address. * \param p_buf Pointer to data buffer to send. * \param size Data buffer size. * \return True if OK. */ static bool at25_write(const uint32_t address, uint8_t *p_buf, uint32_t size) { bool rc; uint8_t status; at25_cmd_t at25_cmd = { .op_code = AT25_BYTE_PAGE_PROGRAM }; spi_cmd_t spi_cmd = { .data = p_buf, .cmd = (uint8_t*)&at25_cmd, .cmd_size = 4, .cmd_rx = 0, .dummy_size = 0, .data_size = size }; at25_cmd.address_h = (address & 0xFF0000) >> 16; at25_cmd.address_m = (address & 0x00FF00) >> 8; at25_cmd.address_l = (address & 0x0000FF) >> 0; rc = at25_enable_write(); if (!rc) return false; rc = spi_send_cmd(&spi_cmd); if (!rc) return false; rc = at25_wait(&status); if (!rc) return false; if (status & AT25_STATUS_EPE) return false; return true; } /** * \brief Test SPI dataflash operations. * \param test Current test case. */ static void run_spi_dataflash_test(const struct test_case *test) { bool rc; uint32_t spi_id; uint8_t status = 0; uint8_t pageBuffer[CONF_TEST_DF_PAGE_SIZE]; uint32_t i; /* Initialize SPI for dataflash access */ spi_set_master_mode(CONF_TEST_SPI); spi_set_variable_peripheral_select(CONF_TEST_SPI); spi_set_peripheral_chip_select_value(CONF_TEST_SPI, CONF_TEST_DF_NPCS); spi_set_clock_polarity(CONF_TEST_SPI, CONF_TEST_DF_NPCS, SPI_CLK_POLARITY); spi_set_clock_phase(CONF_TEST_SPI, CONF_TEST_DF_NPCS, SPI_CLK_PHASE); spi_set_bits_per_transfer(CONF_TEST_SPI, CONF_TEST_DF_NPCS, SPI_CSR_BITS_8_BIT); spi_set_baudrate_div(CONF_TEST_SPI, CONF_TEST_DF_NPCS, (sysclk_get_cpu_hz() / TEST_CLOCK)); spi_set_transfer_delay(CONF_TEST_SPI, CONF_TEST_DF_NPCS, TEST_DF_DLYBS, TEST_DF_DLYBCT); spi_configure_cs_behavior(CONF_TEST_SPI, CONF_TEST_DF_NPCS, SPI_CS_KEEP_LOW); spi_enable(CONF_TEST_SPI); /* Read ID test */ rc = at25_read_id(&spi_id); spi_id &= 0x00FFFFFF; test_assert_true(test, rc, "DataFlash ReadID failed"); test_assert_true(test, spi_id == CONF_TEST_DF_ID, "DataFlash ID %x but expected is %x", spi_id, CONF_TEST_DF_ID); /* Unprotect flash */ rc = at25_enable_write(); test_assert_true(test, rc, "DataFlash enable Write failed"); rc = at25_read_status(&status); test_assert_true(test, rc, "DataFlash read status failed"); /* Unprotect sector */ rc = at25_unprotect_sector(CONF_TEST_DF_ADDRESS); test_assert_true(test, rc, "DataFlash Unprotect sector failed"); /* Erase a block for test */ rc = at25_erase_block_4k(CONF_TEST_DF_ADDRESS); test_assert_true(test, rc, "DataFlash Erase4K failed"); /* Read the page */ rc = at25_read(CONF_TEST_DF_ADDRESS, pageBuffer, CONF_TEST_DF_PAGE_SIZE); test_assert_true(test, rc, "DataFlash Read failed"); /* Blank check */ for (i = 0; i < CONF_TEST_DF_PAGE_SIZE; i ++) { test_assert_true(test, pageBuffer[i] == 0xFF, "Page data @ %d is %x, expected 0xFF", i, pageBuffer[i]); } /* Program page test */ for (i = 0; i < CONF_TEST_DF_PAGE_SIZE; i ++) { pageBuffer[i] = i; } rc = at25_write(CONF_TEST_DF_ADDRESS, pageBuffer, CONF_TEST_DF_PAGE_SIZE); test_assert_true(test, rc, "DataFlash Write failed"); /* Check bytes */ rc = at25_read(CONF_TEST_DF_ADDRESS, pageBuffer, CONF_TEST_DF_PAGE_SIZE); test_assert_true(test, rc, "DataFlash Read failed"); for (i = 0; i < CONF_TEST_DF_PAGE_SIZE; i ++) { test_assert_true(test, pageBuffer[i] == i, "DataFlash data is not what expected, " "expected %x but got %x", i, pageBuffer[i]); } } #endif /* CONF_TEST_DF */ /** * \brief Test SPI write protection. * \param test Current test case. */ static void run_spi_writeprotect_test(const struct test_case *test) { uint32_t wp_status; uint32_t wp_vsrc; uint32_t reg_backup; /* Enable write protect */ spi_set_writeprotect(CONF_TEST_SPI, 1); /* Access _MR to generate violation */ reg_backup = CONF_TEST_SPI->SPI_MR; CONF_TEST_SPI->SPI_MR = 0xFF; wp_status = spi_get_writeprotect_status(CONF_TEST_SPI); wp_vsrc = (wp_status&SPI_WPSR_WPVSRC_Msk) >> SPI_WPSR_WPVSRC_Pos; test_assert_true(test, (wp_status & SPI_WPSR_WPVS_Msk), "WriteProtection on _MR not detected"); test_assert_true(test, wp_vsrc == OFFSET_MR, "WriteProtection on _MR src error, " "got %x but expect %x", wp_vsrc, OFFSET_MR); test_assert_true(test, reg_backup == CONF_TEST_SPI->SPI_MR, "_MR write not blocked"); /* Access _CSR to generate violation */ reg_backup = CONF_TEST_SPI->SPI_CSR[CONF_TEST_SPI_NPCS]; CONF_TEST_SPI->SPI_CSR[CONF_TEST_SPI_NPCS] = 0; wp_status = spi_get_writeprotect_status(CONF_TEST_SPI); wp_vsrc = (wp_status&SPI_WPSR_WPVSRC_Msk) >> SPI_WPSR_WPVSRC_Pos; test_assert_true(test, (wp_status & SPI_WPSR_WPVS_Msk), "WriteProtection on _CS not detected"); test_assert_true(test, wp_vsrc == (OFFSET_CSR + 4 * CONF_TEST_SPI_NPCS), "WriteProtection on _CSR src error, " "got %x but expect %x", wp_vsrc, (OFFSET_CSR + 4 * CONF_TEST_SPI_NPCS)); test_assert_true(test, reg_backup == CONF_TEST_SPI->SPI_CSR[CONF_TEST_SPI_NPCS], "_CSR write not blocked"); /* Disable write protect */ spi_set_writeprotect(CONF_TEST_SPI, 0); } /** * \brief Run SPI driver unit test. */ int main(void) { const usart_serial_options_t usart_serial_options = { .baudrate = CONF_TEST_BAUDRATE, .charlength = CONF_TEST_CHARLENGTH, .paritytype = CONF_TEST_PARITY, .stopbits = CONF_TEST_STOPBITS }; sysclk_init(); board_init(); stdio_serial_init(CONF_TEST_USART, &usart_serial_options); /* Define all the test cases */ DEFINE_TEST_CASE(spi_ctrl_test, NULL, run_spi_ctrl_test, NULL, "SPI enable/disable and reset"); DEFINE_TEST_CASE(spi_trans_test, NULL, run_spi_trans_test, NULL, "SPI transfer"); #ifdef CONF_TEST_DF DEFINE_TEST_CASE(spi_dataflash_test, NULL, run_spi_dataflash_test, NULL, "SPI flash"); #endif DEFINE_TEST_CASE(spi_wp_test, NULL, run_spi_writeprotect_test, NULL, "SPI write protection"); /* Put test case addresses in an array */ DEFINE_TEST_ARRAY(spi_tests) = { &spi_ctrl_test, &spi_trans_test, #ifdef CONF_TEST_DF &spi_dataflash_test, #endif &spi_wp_test }; /* Define the test suite */ DEFINE_TEST_SUITE(spi_suite, spi_tests, "SAM SPI driver test suite"); /* Run all tests in the test suite */ test_suite_run(&spi_suite); while (1) { /* Busy-wait forever */ } }
26.568544
90
0.703212
9f0e132e614665cf92d64778251d12a67abd4c7a
7,252
c
C
src/util.c
carlilek/io500-app
3dc15f283a050c29e720777e862c6ad54e0a109f
[ "MIT" ]
null
null
null
src/util.c
carlilek/io500-app
3dc15f283a050c29e720777e862c6ad54e0a109f
[ "MIT" ]
null
null
null
src/util.c
carlilek/io500-app
3dc15f283a050c29e720777e862c6ad54e0a109f
[ "MIT" ]
null
null
null
#include <stdlib.h> #include <string.h> #include <stdarg.h> #include <sys/stat.h> #include <unistd.h> #include <sys/types.h> #include <errno.h> #include <assert.h> #include <aiori.h> #include <io500-util.h> #include <io500-opt.h> /** * rotate the value and add the current character */ static uint32_t rotladd (uint32_t x, char c){ return ((x<<2) | (x>>(32-2))) + c; } uint32_t u_hash_update(uint32_t hash, char const * str){ for(char const * c = str; *c != 0; c++){ hash = rotladd(hash, *c); } return hash; } void u_hash_update_key_val(uint32_t * hash, char const * key, char const * val){ uint32_t hsh = 0; hsh = u_hash_update(hsh, key); hsh = u_hash_update(hsh, val); *hash = *hash ^ hsh; // DEBUG_ALL //printf("\nhash current: %X update with (%s,%s)\n", (int)*hash, key, val); } void u_hash_update_key_val_dbl(uint32_t * hash, char const * key, double val){ char str[40]; sprintf(str, "%f", val); u_hash_update_key_val(hash, key, str); } void u_hash_print(FILE * file, uint32_t hash){ fprintf(file, "%X", (int) hash); } void u_call_cmd(char const * str){ int ret = system(str); if (ret != 0) { WARNING("Calling \"%s\" returned %d\n", str, ret); } } void u_purge_datadir(char const * dir){ char d[2048]; sprintf(d, "%s/%s", opt.datadir, dir); DEBUG_INFO("Removing dir %s\n", d); opt.aiori->rmdir(d, & opt.aiori_params); } void u_purge_file(char const * file){ char f[2048]; sprintf(f, "%s/%s", opt.datadir, file); DEBUG_INFO("Removing file %s\n", f); opt.aiori->delete(f, & opt.aiori_params); } void u_create_datadir(char const * dir){ if(opt.rank != 0){ return; } char d[2048]; sprintf(d, "%s/%s", opt.datadir, dir); u_create_dir_recursive(d, opt.api); } void u_create_dir_recursive(char const * dir, char const * api){ char * d = strdup(dir); char outdir[2048]; char * wp = outdir; if (dir[0] == '/'){ wp += sprintf(wp, "/"); } char * next = strtok(d, "/"); while(next){ if(*next == '/' || *next == 0) continue; wp += sprintf(wp, "%s/", next); struct stat sb; int ret = stat(outdir, & sb); if(ret != 0){ DEBUG_INFO("Creating dir %s\n", outdir); ret = opt.aiori->mkdir(outdir, S_IRWXU, NULL); if(ret != 0){ FATAL("Couldn't create directory %s (Error: %s)\n", outdir, strerror(errno)); } } next = strtok(NULL, "/"); } free(d); } u_argv_t * u_argv_create(void){ u_argv_t * p = u_malloc(sizeof(u_argv_t)); memset(p, 0, sizeof(u_argv_t)); return p; } void u_argv_free(u_argv_t * argv){ for(int i=0; i < argv->size; i++){ free(argv->vector[i]); } free(argv); } void u_argv_push(u_argv_t * argv, char const * str){ int size = ++argv->size; argv->vector = realloc(argv->vector, size * sizeof(void*)); argv->vector[argv->size - 1] = strdup(str); } void u_argv_push_default_if_set_bool(u_argv_t * argv, char * const arg, int dflt, int var){ if(var != INI_UNSET_BOOL){ if((int) var) u_argv_push(argv, arg); }else if(dflt != INI_UNSET_BOOL){ if((int) dflt) u_argv_push(argv, arg); } } void u_argv_push_default_if_set(u_argv_t * argv, char * const arg, char const * dflt, char const * var){ if(var != INI_UNSET_STRING){ u_argv_push(argv, arg); u_argv_push(argv, var); }else if(dflt != INI_UNSET_STRING){ u_argv_push(argv, arg); u_argv_push(argv, dflt); } } void u_argv_push_printf(u_argv_t * argv, char const * format, ...){ char buff[2048]; va_list args; va_start(args, format); vsprintf(buff, format, args); va_end (args); u_argv_push(argv, buff); } char * u_flatten_argv(u_argv_t * argv){ char command[2048]; char * p = command; *p = '\0'; for(int i = 0; i < argv->size; i++){ if(i != 0) p+= sprintf(p, " "); p += sprintf(p, "%s", argv->vector[i]); } return strdup(command); } void * u_malloc(int size){ char * buff = malloc(size); if(! buff){ FATAL("Cannot malloc();") } return buff; } void u_print_timestamp(FILE * out){ char buffer[30]; struct tm* tm_info; time_t timer; time(&timer); tm_info = localtime(&timer); strftime(buffer, 30, "%Y-%m-%d %H:%M:%S", tm_info); fprintf(out, "%s", buffer); } FILE * u_res_file_prep(char const * name){ FILE * out = stdout; if(opt.rank == 0){ char fname[2048]; sprintf(fname, "%s/%s.txt", opt.resdir, name); INFO_PAIR("result-file", "%s\n", fname); out = fopen(fname, "w"); if( out == NULL ){ FATAL("Couldn't create results file: %s (Error: %s)\n", fname, strerror(errno)); } } return out; } void u_res_file_close(FILE * out){ if(opt.rank == 0){ fclose(out); } } typedef struct{ uint32_t score_hash; char const * cfg_hash_read; char const * score_hash_read; } res_file_data_t ; static res_file_data_t res_data; static void hash_func(bool is_section, char const * key, char const * val){ static char const * last_section = NULL; if(is_section){ last_section = key; return; } if(strcmp(key, "version") == 0){ printf("result file ver = %s\n", val); if(strcmp(val, VERSION) != 0){ WARNING("Verify the output with the matching version of the benchmark.\n"); } u_hash_update_key_val(& res_data.score_hash, key, val); return; } if(strcmp(key, "config-hash") == 0){ res_data.cfg_hash_read = strdup(val); return; } if(! last_section) return; if(strcmp(last_section, "SCORE") == 0){ if(strcmp(key, "SCORE") == 0){ // might be followed with the info INVALID char * strippedScore = strtok((char*)val, " "); u_hash_update_key_val(& res_data.score_hash, key, strippedScore); }else if(strcmp(key, "hash") == 0){ res_data.score_hash_read = strdup(val); }else{ u_hash_update_key_val(& res_data.score_hash, key, val); } return; } if(strcmp(key, "score") == 0){ u_hash_update_key_val(& res_data.score_hash, last_section, val); return; } DEBUG_INFO("ignored: [%s] %s %s\n", last_section, key, val); } void u_verify_result_files(ini_section_t ** cfg, char const * result){ uint32_t hash = 0; int error = 0; hash = u_ini_gen_hash(cfg); u_ini_parse_file(result, NULL, hash_func, NULL); printf("config-hash = %s\n", res_data.cfg_hash_read); printf("score-hash = %s\n", res_data.score_hash_read); if(res_data.cfg_hash_read == NULL){ FATAL("ERROR: Empty config hash read\n"); } char hash_str[30]; sprintf(hash_str, "%X", hash); if(strcmp(hash_str, res_data.cfg_hash_read) != 0){ printf("ERROR: Configuration hash expected: %s read: %s\n", hash_str, res_data.cfg_hash_read); error = 1; } sprintf(hash_str, "%X", res_data.score_hash); // check if this is a valid run if(strcmp(hash_str, res_data.score_hash_read) != 0){ char const * shash = strdup(hash_str); u_hash_update_key_val(& res_data.score_hash, "valid", "NO"); sprintf(hash_str, "%X", res_data.score_hash); error = 1; if(strcmp(hash_str, res_data.score_hash_read) != 0){ printf("\nERROR: Score hash expected: \"%s\" read: \"%s\"\n", shash, res_data.score_hash_read); }else{ printf("\n[OK] But this is an invalid run!\n"); } } if(error == 0){ printf("\n[OK]\n"); } exit(error); }
24.5
104
0.622173
3796fa70b0338dab6e701ee8077201c6394d9ef5
552
h
C
oni/stasis.h
declarativitydotnet/p2
59fa258b222a5ff0e6930da4f08acd6155cd378e
[ "BSD-3-Clause" ]
3
2016-01-26T22:19:12.000Z
2019-07-10T02:12:38.000Z
oni/stasis.h
declarativitydotnet/p2
59fa258b222a5ff0e6930da4f08acd6155cd378e
[ "BSD-3-Clause" ]
null
null
null
oni/stasis.h
declarativitydotnet/p2
59fa258b222a5ff0e6930da4f08acd6155cd378e
[ "BSD-3-Clause" ]
null
null
null
#ifndef _ONISTASIS_H_ #define _ONISTASIS_H_ #include "oni.h" #include <stasis/transactional.h> #undef end #undef try #ifdef __cplusplus extern "C" { #endif val_t * alloc_Val_recordid(recordid rid); void free_Val_recordid(val_t* v); void Tup_Push_recordid(tup_t * tup, recordid rid); recordid recordid_Val(val_t * val); byte * colsBytes_Tup(tup_t* tup, unsigned int startCol, unsigned int count, size_t * buf_len); void Tup_Push_colsBytes(tup_t* tup, const byte * buf, size_t buf_len); #ifdef __cplusplus } #endif #endif // _ONISTASIS_H_
24
96
0.753623
8893d350fc9dfd3d7354d3235a3b55e4d959c748
5,784
h
C
aws-cpp-sdk-glue/include/aws/glue/model/WorkflowRunStatistics.h
derpferd/aws-sdk-cpp
daf01b788cfe074ffcd788174c0538256afc40e3
[ "Apache-2.0" ]
1
2020-03-11T05:36:20.000Z
2020-03-11T05:36:20.000Z
aws-cpp-sdk-glue/include/aws/glue/model/WorkflowRunStatistics.h
novaquark/aws-sdk-cpp
a0969508545bec9ae2864c9e1e2bb9aff109f90c
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-glue/include/aws/glue/model/WorkflowRunStatistics.h
novaquark/aws-sdk-cpp
a0969508545bec9ae2864c9e1e2bb9aff109f90c
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma once #include <aws/glue/Glue_EXPORTS.h> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Glue { namespace Model { /** * <p>Workflow run statistics provides statistics about the workflow * run.</p><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/glue-2017-03-31/WorkflowRunStatistics">AWS * API Reference</a></p> */ class AWS_GLUE_API WorkflowRunStatistics { public: WorkflowRunStatistics(); WorkflowRunStatistics(Aws::Utils::Json::JsonView jsonValue); WorkflowRunStatistics& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>Total number of Actions in the workflow run.</p> */ inline int GetTotalActions() const{ return m_totalActions; } /** * <p>Total number of Actions in the workflow run.</p> */ inline bool TotalActionsHasBeenSet() const { return m_totalActionsHasBeenSet; } /** * <p>Total number of Actions in the workflow run.</p> */ inline void SetTotalActions(int value) { m_totalActionsHasBeenSet = true; m_totalActions = value; } /** * <p>Total number of Actions in the workflow run.</p> */ inline WorkflowRunStatistics& WithTotalActions(int value) { SetTotalActions(value); return *this;} /** * <p>Total number of Actions which timed out.</p> */ inline int GetTimeoutActions() const{ return m_timeoutActions; } /** * <p>Total number of Actions which timed out.</p> */ inline bool TimeoutActionsHasBeenSet() const { return m_timeoutActionsHasBeenSet; } /** * <p>Total number of Actions which timed out.</p> */ inline void SetTimeoutActions(int value) { m_timeoutActionsHasBeenSet = true; m_timeoutActions = value; } /** * <p>Total number of Actions which timed out.</p> */ inline WorkflowRunStatistics& WithTimeoutActions(int value) { SetTimeoutActions(value); return *this;} /** * <p>Total number of Actions which have failed.</p> */ inline int GetFailedActions() const{ return m_failedActions; } /** * <p>Total number of Actions which have failed.</p> */ inline bool FailedActionsHasBeenSet() const { return m_failedActionsHasBeenSet; } /** * <p>Total number of Actions which have failed.</p> */ inline void SetFailedActions(int value) { m_failedActionsHasBeenSet = true; m_failedActions = value; } /** * <p>Total number of Actions which have failed.</p> */ inline WorkflowRunStatistics& WithFailedActions(int value) { SetFailedActions(value); return *this;} /** * <p>Total number of Actions which have stopped.</p> */ inline int GetStoppedActions() const{ return m_stoppedActions; } /** * <p>Total number of Actions which have stopped.</p> */ inline bool StoppedActionsHasBeenSet() const { return m_stoppedActionsHasBeenSet; } /** * <p>Total number of Actions which have stopped.</p> */ inline void SetStoppedActions(int value) { m_stoppedActionsHasBeenSet = true; m_stoppedActions = value; } /** * <p>Total number of Actions which have stopped.</p> */ inline WorkflowRunStatistics& WithStoppedActions(int value) { SetStoppedActions(value); return *this;} /** * <p>Total number of Actions which have succeeded.</p> */ inline int GetSucceededActions() const{ return m_succeededActions; } /** * <p>Total number of Actions which have succeeded.</p> */ inline bool SucceededActionsHasBeenSet() const { return m_succeededActionsHasBeenSet; } /** * <p>Total number of Actions which have succeeded.</p> */ inline void SetSucceededActions(int value) { m_succeededActionsHasBeenSet = true; m_succeededActions = value; } /** * <p>Total number of Actions which have succeeded.</p> */ inline WorkflowRunStatistics& WithSucceededActions(int value) { SetSucceededActions(value); return *this;} /** * <p>Total number Actions in running state.</p> */ inline int GetRunningActions() const{ return m_runningActions; } /** * <p>Total number Actions in running state.</p> */ inline bool RunningActionsHasBeenSet() const { return m_runningActionsHasBeenSet; } /** * <p>Total number Actions in running state.</p> */ inline void SetRunningActions(int value) { m_runningActionsHasBeenSet = true; m_runningActions = value; } /** * <p>Total number Actions in running state.</p> */ inline WorkflowRunStatistics& WithRunningActions(int value) { SetRunningActions(value); return *this;} private: int m_totalActions; bool m_totalActionsHasBeenSet; int m_timeoutActions; bool m_timeoutActionsHasBeenSet; int m_failedActions; bool m_failedActionsHasBeenSet; int m_stoppedActions; bool m_stoppedActionsHasBeenSet; int m_succeededActions; bool m_succeededActionsHasBeenSet; int m_runningActions; bool m_runningActionsHasBeenSet; }; } // namespace Model } // namespace Glue } // namespace Aws
29.212121
115
0.680498
000bb896cb6d8e298b6033c641f4eac6736df796
9,642
c
C
src/modules/sih/sih_params.c
mgkim3070/Drone_Firmware
6843061ce5eb573424424598cf3bac33e037d4d0
[ "BSD-3-Clause" ]
null
null
null
src/modules/sih/sih_params.c
mgkim3070/Drone_Firmware
6843061ce5eb573424424598cf3bac33e037d4d0
[ "BSD-3-Clause" ]
null
null
null
src/modules/sih/sih_params.c
mgkim3070/Drone_Firmware
6843061ce5eb573424424598cf3bac33e037d4d0
[ "BSD-3-Clause" ]
null
null
null
/**************************************************************************** * * Copyright (c) 2013-2019 PX4 Development Team. 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. * 3. Neither the name PX4 nor the names of its contributors may be * used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************/ /** * @file sih_params.c * Parameters for quadcopter X simulator in hardware. * * @author Romain Chiappinelli <romain.chiap@gmail.com> * February 2019 */ /** * Vehicle mass * * This value can be measured by weighting the quad on a scale. * * @unit kg * @min 0.0 * @decimal 2 * @increment 0.1 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_MASS, 1.0f); /** * Vehicle inertia about X axis * * The intertia is a 3 by 3 symmetric matrix. * It represents the difficulty of the vehicle to modify its angular rate. * * @unit kg*m*m * @min 0.0 * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_IXX, 0.025f); /** * Vehicle inertia about Y axis * * The intertia is a 3 by 3 symmetric matrix. * It represents the difficulty of the vehicle to modify its angular rate. * * @unit kg*m*m * @min 0.0 * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_IYY, 0.025f); /** * Vehicle inertia about Z axis * * The intertia is a 3 by 3 symmetric matrix. * It represents the difficulty of the vehicle to modify its angular rate. * * @unit kg*m*m * @min 0.0 * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_IZZ, 0.030f); /** * Vehicle cross term inertia xy * * The intertia is a 3 by 3 symmetric matrix. * This value can be set to 0 for a quad symmetric about its center of mass. * * @unit kg*m*m * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_IXY, 0.0f); /** * Vehicle cross term inertia xz * * The intertia is a 3 by 3 symmetric matrix. * This value can be set to 0 for a quad symmetric about its center of mass. * * @unit kg*m*m * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_IXZ, 0.0f); /** * Vehicle cross term inertia yz * * The intertia is a 3 by 3 symmetric matrix. * This value can be set to 0 for a quad symmetric about its center of mass. * * @unit kg*m*m * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_IYZ, 0.0f); /** * Max propeller thrust force * * This is the maximum force delivered by one propeller * when the motor is running at full speed. * * This value is usually about 5 times the mass of the quadrotor. * * @unit N * @min 0.0 * @decimal 2 * @increment 0.5 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_T_MAX, 5.0f); /** * Max propeller torque * * This is the maximum torque delivered by one propeller * when the motor is running at full speed. * * This value is usually about few percent of the maximum thrust force. * * @unit Nm * @min 0.0 * @decimal 3 * @increment 0.05 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_Q_MAX, 0.1f); /** * Roll arm length * * This is the arm length generating the rolling moment * * This value can be measured with a ruler. * This corresponds to half the distance between the left and right motors. * * @unit m * @min 0.0 * @decimal 2 * @increment 0.05 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_L_ROLL, 0.2f); /** * Pitch arm length * * This is the arm length generating the pitching moment * * This value can be measured with a ruler. * This corresponds to half the distance between the front and rear motors. * * @unit m * @min 0.0 * @decimal 2 * @increment 0.05 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_L_PITCH, 0.2f); /** * First order drag coefficient * * Physical coefficient representing the friction with air particules. * The greater this value, the slower the quad will move. * * Drag force function of velocity: D=-KDV*V. * The maximum freefall velocity can be computed as V=10*MASS/KDV [m/s] * * @unit N/(m/s) * @min 0.0 * @decimal 2 * @increment 0.05 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_KDV, 1.0f); /** * First order angular damper coefficient * * Physical coefficient representing the friction with air particules during rotations. * The greater this value, the slower the quad will rotate. * * Aerodynamic moment function of body rate: Ma=-KDW*W_B. * This value can be set to 0 if unknown. * * @unit Nm/(rad/s) * @min 0.0 * @decimal 3 * @increment 0.005 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_KDW, 0.025f); /** * Initial geodetic latitude * * This value represents the North-South location on Earth where the simulation begins. * A value of 45 deg should be written 450000000. * * LAT0, LON0, H0, MU_X, MU_Y, and MU_Z should ideally be consistent among each others * to represent a physical ground location on Earth. * * @unit 1e-7 deg * @min -850000000 * @max 850000000 * @group Simulation In Hardware */ PARAM_DEFINE_INT32(SIH_LOC_LAT0, 454671160); /** * Initial geodetic longitude * * This value represents the East-West location on Earth where the simulation begins. * A value of 45 deg should be written 450000000. * * LAT0, LON0, H0, MU_X, MU_Y, and MU_Z should ideally be consistent among each others * to represent a physical ground location on Earth. * * @unit 1e-7 deg * @min -1800000000 * @max 1800000000 * @group Simulation In Hardware */ PARAM_DEFINE_INT32(SIH_LOC_LON0, -737578370); /** * Initial AMSL ground altitude * * This value represents the Above Mean Sea Level (AMSL) altitude where the simulation begins. * * If using FlightGear as a visual animation, * this value can be tweaked such that the vehicle lies on the ground at takeoff. * * LAT0, LON0, H0, MU_X, MU_Y, and MU_Z should ideally be consistent among each others * to represent a physical ground location on Earth. * * * @unit m * @min -420.0 * @max 8848.0 * @decimal 2 * @increment 0.01 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_LOC_H0, 32.34f); /** * North magnetic field at the initial location * * This value represents the North magnetic field at the initial location. * * A magnetic field calculator can be found on the NOAA website * Note, the values need to be converted from nano Tesla to Gauss * * LAT0, LON0, H0, MU_X, MU_Y, and MU_Z should ideally be consistent among each others * to represent a physical ground location on Earth. * * @unit Gauss * @min -1.0 * @max 1.0 * @decimal 2 * @increment 0.001 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_LOC_MU_X, 0.179f); /** * East magnetic field at the initial location * * This value represents the East magnetic field at the initial location. * * A magnetic field calculator can be found on the NOAA website * Note, the values need to be converted from nano Tesla to Gauss * * LAT0, LON0, H0, MU_X, MU_Y, and MU_Z should ideally be consistent among each others * to represent a physical ground location on Earth. * * @unit Gauss * @min -1.0 * @max 1.0 * @decimal 2 * @increment 0.001 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_LOC_MU_Y, -0.045f); /** * Down magnetic field at the initial location * * This value represents the Down magnetic field at the initial location. * * A magnetic field calculator can be found on the NOAA website * Note, the values need to be converted from nano Tesla to Gauss * * LAT0, LON0, H0, MU_X, MU_Y, and MU_Z should ideally be consistent among each others * to represent a physical ground location on Earth. * * @unit Gauss * @min -1.0 * @max 1.0 * @decimal 2 * @increment 0.001 * @group Simulation In Hardware */ PARAM_DEFINE_FLOAT(SIH_LOC_MU_Z, 0.504f);
27.867052
95
0.674549
18dd7e8ab07c478c548168627d34fa422dc01bbd
455
h
C
FBG/Main/View/DBHBaseTableViewCell.h
InWeCrypto/wallet_ios
9332e2b03c567796174b66bc7c4a0b35c3ead034
[ "MIT" ]
1
2018-05-07T09:14:41.000Z
2018-05-07T09:14:41.000Z
FBG/Main/View/DBHBaseTableViewCell.h
InWeCrypto/wallet_ios
9332e2b03c567796174b66bc7c4a0b35c3ead034
[ "MIT" ]
1
2017-11-03T10:16:56.000Z
2017-11-03T10:16:56.000Z
FBG/Main/View/DBHBaseTableViewCell.h
InWeCrypto/wallet_ios
9332e2b03c567796174b66bc7c4a0b35c3ead034
[ "MIT" ]
7
2017-10-27T08:14:03.000Z
2018-06-21T10:01:50.000Z
// // DBHBaseTableViewCell.h // Trinity // // Created by 邓毕华 on 2017/12/26. // Copyright © 2017年 邓毕华. All rights reserved. // #import <UIKit/UIKit.h> @interface DBHBaseTableViewCell : UITableViewCell /** 是否隐藏灰色分隔线 */ @property (nonatomic, assign) BOOL isHideBottomLineView; /** 分隔线宽度 默认比屏宽小30 */ @property (nonatomic, assign) CGFloat bottomLineWidth; /** 分隔线颜色 默认 F6F6F6 */ @property (nonatomic, strong) UIColor *bottomLineViewColor; @end
15.689655
59
0.712088
4958cd98ca48f1249d1d3ac445d3fc7ff7d28076
4,172
h
C
test/unit-tests/test-observer.h
malachi-iot/mc-coap
425b5b77e1474a9ad34aaf6d56df8bd76a1acf39
[ "MIT" ]
3
2019-11-15T19:38:41.000Z
2020-08-08T14:46:14.000Z
test/unit-tests/test-observer.h
malachi-iot/mc-coap
425b5b77e1474a9ad34aaf6d56df8bd76a1acf39
[ "MIT" ]
null
null
null
test/unit-tests/test-observer.h
malachi-iot/mc-coap
425b5b77e1474a9ad34aaf6d56df8bd76a1acf39
[ "MIT" ]
null
null
null
/** * @file * @author Malachi Burke */ #pragma once #include <catch.hpp> #include "coap-dispatcher.h" #include <coap/decoder/subject.h> // for event definitions #include "coap/experimental-observer.h" #include <coap/decoder/netbuf.h> #include <exp/netbuf.h> #include "test-data.h" using namespace moducom::coap; using namespace moducom::coap::experimental; using namespace moducom::pipeline; /// @brief designed specifically to test against "buffer_16bit_delta" buffer /// @remarks the whole DecoderObserverBase chain is deprecated /// @deprecated /// \tparam TRequestContext template <class TRequestContext> class Buffer16BitDeltaObserver : public DecoderObserverBase<TRequestContext> { int option_test_number; typedef DecoderObserverBase<TRequestContext> base_t; public: typedef TRequestContext request_context_t; typedef typename base_t::number_t number_t; typedef typename base_t::InterestedEnum interested_t; Buffer16BitDeltaObserver(request_context_t& dummy) : base_t(base_t::Always), option_test_number(0) {} Buffer16BitDeltaObserver(interested_t i = base_t::Always) : base_t(i), option_test_number(0) {} virtual void on_header(Header header) OVERRIDE { REQUIRE(header.is_request()); } virtual void on_token(const MemoryChunk::readonly_t& token_part, bool last_chunk) OVERRIDE { FAIL("Should not reach here"); } virtual void on_option(number_t number, uint16_t length) OVERRIDE { switch(option_test_number) { case 0: REQUIRE(number == 270); REQUIRE(length == 1); break; case 1: REQUIRE(number == 271); REQUIRE(length == 2); break; } } virtual void on_option(number_t number, const MemoryChunk::readonly_t& option_value_part, bool last_chunk) OVERRIDE { switch(option_test_number++) { case 0: REQUIRE(option_value_part[0] == 3); REQUIRE(option_value_part.length() == 1); break; case 1: REQUIRE(option_value_part[0] == 4); REQUIRE(option_value_part[1] == 5); REQUIRE(option_value_part.length() == 2); break; } } virtual void on_payload(const MemoryChunk::readonly_t& payload_part, bool last_chunk) OVERRIDE { REQUIRE(payload_part[0] == buffer_16bit_delta[12]); REQUIRE(payload_part[1] == buffer_16bit_delta[13]); REQUIRE(payload_part[payload_part.length()] == buffer_16bit_delta[12 + payload_part.length()]); } }; template <class TIncomingContext> class EmptyObserver : public MessageObserverBase <TIncomingContext> { public: }; // simplistic memorychunk-mapped NetBuf. Eventually put this into mcmem itself // FIX: this one is hardwired to read operations - not a crime, but needs more // architectual planning to actually be used elsewhere class NetBufReadOnlyMemory : public moducom::io::experimental::NetBufMemoryTemplate<moducom::pipeline::MemoryChunk::readonly_t > { typedef moducom::pipeline::MemoryChunk::readonly_t chunk_t; typedef moducom::io::experimental::NetBufMemoryTemplate<chunk_t> base_t; public: template <size_t N> NetBufReadOnlyMemory(const uint8_t (&a) [N]) : base_t(chunk_t(a, N)) { } NetBufReadOnlyMemory(const NetBufReadOnlyMemory& copy_from) : base_t(copy_from) { } #ifdef FEATURE_CPP_MOVESEMANTIC #endif // FIX: hard wiring this to a read-oriented NetBuf // there's some mild indication this isn't ideal since conjunctive decoder // still needs to maintain a pos to read through this size_t length_processed() const { return base_t::_chunk.length(); } }; struct test_observer { int counter; test_observer() : counter(0) {} void on_notify(event::completed) { REQUIRE(counter >= 2); counter++; } void on_notify(const event::option& e) { REQUIRE(e.option_number >= 270); counter++; } };
26.238994
119
0.655801
e4ade23b4a3939cfc9938ffa1f3c85a0ecc36c66
4,529
c
C
FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/AtmelFiles/drivers/peripherals/uart.c
JVVJV/FreeRTOS
2b956b97c76f48053e87b89df39afb2b9426eee5
[ "MIT" ]
2,603
2019-10-09T04:47:13.000Z
2022-03-31T13:59:08.000Z
FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/AtmelFiles/drivers/peripherals/uart.c
JVVJV/FreeRTOS
2b956b97c76f48053e87b89df39afb2b9426eee5
[ "MIT" ]
296
2019-11-22T03:29:07.000Z
2022-03-21T23:23:01.000Z
FreeRTOS/Demo/CORTEX_A5_SAMA5D2x_Xplained_IAR/AtmelFiles/drivers/peripherals/uart.c
JVVJV/FreeRTOS
2b956b97c76f48053e87b89df39afb2b9426eee5
[ "MIT" ]
1,040
2019-09-26T20:18:24.000Z
2022-03-30T08:12:34.000Z
/* ---------------------------------------------------------------------------- * SAM Software Package License * ---------------------------------------------------------------------------- * Copyright (c) 2015, Atmel Corporation * * 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 disclaimer below. * * Atmel's name may not be used to endorse or promote products derived from * this software without specific prior written permission. * * DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE * DISCLAIMED. IN NO EVENT SHALL ATMEL 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. * ---------------------------------------------------------------------------- */ /*------------------------------------------------------------------------------ * Headers *------------------------------------------------------------------------------*/ #include "chip.h" #include "peripherals/uart.h" #include "peripherals/pmc.h" #include <stdint.h> /*------------------------------------------------------------------------------ * Exported functions *------------------------------------------------------------------------------*/ /* * Initializes the UART with the given parameters, and enables both the * transmitter and the receiver. The mode parameter contains the value of the * UART_MR register. * Value UART_STANDARD can be used for mode to get the most common configuration * (i.e. aysnchronous, 8bits, no parity, 1 stop bit, no flow control). * \param mode Operating mode to configure. * \param baudrate Desired baudrate (e.g. 115200). * \param mck Frequency of the system master clock in Hz. */ void uart_configure(Uart* pUart, uint32_t mode, uint32_t baudrate) { uint32_t uart_id = get_uart_id_from_addr(pUart); // Reset & disable receiver and transmitter, disable interrupts pUart->UART_CR = UART_CR_RSTRX | UART_CR_RSTTX | UART_CR_RXDIS | UART_CR_TXDIS | UART_CR_RSTSTA; pUart->UART_IDR = 0xFFFFFFFF; // Configure baud rate pUart->UART_BRGR = pmc_get_peripheral_clock(uart_id) / (baudrate * 16); // Configure mode register pUart->UART_MR = mode; // Enable receiver and transmitter pUart->UART_CR = UART_CR_RXEN | UART_CR_TXEN; } /* Enable transmitter * */ void uart_set_transmitter_enabled (Uart* pUart, uint8_t enabled) { if (enabled) pUart->UART_CR = UART_CR_TXEN; else pUart->UART_CR = UART_CR_TXDIS; } /* Enable receiver * */ void uart_set_receiver_enabled (Uart* pUart, uint8_t enabled) { if (enabled) pUart->UART_CR = UART_CR_RXEN; else pUart->UART_CR = UART_CR_RXDIS; } /* Set interrupt register * */ void uart_set_int (Uart* pUart, uint32_t int_mask) { pUart->UART_IER |= int_mask; } /** * Outputs a character on the UART line. * \note This function is synchronous (i.e. uses polling). * \param c Character to send. */ void uart_put_char(Uart* pUart, uint8_t c) { // Wait for the transmitter to be ready while ((pUart->UART_SR & UART_SR_TXEMPTY) == 0); // Send character pUart->UART_THR = c; } /** * Return 1 if a character can be read in UART */ uint32_t uart_is_rx_ready(Uart* pUart) { return (pUart->UART_SR & UART_SR_RXRDY); } /** * Return 1 if a character can be write in UART */ uint32_t uart_is_tx_ready(Uart* pUart) { return (pUart->UART_SR & UART_SR_TXRDY); } /** * \brief Reads and returns a character from the UART. * \note This function is synchronous (i.e. uses polling). * \return Character received. */ uint8_t uart_get_char(Uart* pUart) { while ((pUart->UART_SR & UART_SR_RXRDY) == 0); return pUart->UART_RHR; }
33.301471
83
0.618459
c4cdb15f11a7b8cbdd31743bb4e613b7b21e1676
7,186
c
C
C/game_of_life.c
kruschk/etc
fd11bf4e5b01b40e89b218a4d85c195cea2527ec
[ "MIT" ]
null
null
null
C/game_of_life.c
kruschk/etc
fd11bf4e5b01b40e89b218a4d85c195cea2527ec
[ "MIT" ]
null
null
null
C/game_of_life.c
kruschk/etc
fd11bf4e5b01b40e89b218a4d85c195cea2527ec
[ "MIT" ]
null
null
null
#define _POSIX_C_SOURCE 199309L #include <time.h> #include <curses.h> #include <stdlib.h> #define ALIVE 'o' #define DEAD ' ' /* initialize_map: initialize the map to contain only DEAD cells */ void initialize_map(void) { int y; for (y = 0; y < LINES; y++) { mvhline(y, 0, DEAD, COLS); } } /* add_glider: adds a glider at x, y, where x and y are the leftmost and * uppermost corner of the object */ void add_glider(int y, const int x) { /* make sure there's enough space */ if (y > LINES - 3 || x > COLS - 3) { endwin(); perror("add_glider: insufficient screen space"); exit(EXIT_FAILURE); } /* top row */ mvaddch(y, x, DEAD); mvaddch(y, x+1, ALIVE); mvaddch(y, x+2, DEAD); /* middle row */ y++; mvaddch(y, x, DEAD); mvaddch(y, x+1, DEAD); mvaddch(y, x+2, ALIVE); /* bottom row */ y++; mvaddch(y, x, ALIVE); mvaddch(y, x+1, ALIVE); mvaddch(y, x+2, ALIVE); refresh(); } /* add_small_exploder: adds a small exploder at x, y, where x and y are the * leftmost and uppermost corner of the object */ void add_small_exploder(int y, const int x) { if (y > LINES - 4 || x > COLS - 3) { endwin(); perror("add_small_exploder: insufficient screen space"); exit(EXIT_FAILURE); } /* top row */ mvaddch(y, x, DEAD); mvaddch(y, x+1, ALIVE); mvaddch(y, x+2, DEAD); /* mid-top row */ y++; mvaddch(y, x, ALIVE); mvaddch(y, x+1, ALIVE); mvaddch(y, x+2, ALIVE); /* mid-bottom row */ y++; mvaddch(y, x, ALIVE); mvaddch(y, x+1, DEAD); mvaddch(y, x+2, ALIVE); /* bottom row */ y++; mvaddch(y, x, DEAD); mvaddch(y, x+1, ALIVE); mvaddch(y, x+2, DEAD); refresh(); } void make_being(int y, int x, bool being[]); #define CHECK_AND_INC(y, x)\ if (mvinch((y), (x)) == ALIVE) {\ count++;\ } /* count_neighbours: counts the number of neighbours that are alive */ unsigned int count_neighbours(int y, int x) { unsigned int count = 0; /* normal case, need to check all 8 neighbors */ if (y != 0 && y != LINES - 1 && x != 0 && x != COLS - 1) { CHECK_AND_INC(y-1, x-1) /* up-left */ CHECK_AND_INC(y-1, x) /* up */ CHECK_AND_INC(y-1, x+1) /* up-right */ CHECK_AND_INC( y, x-1) /* left */ CHECK_AND_INC( y, x+1) /* right */ CHECK_AND_INC(y+1, x-1) /* down-left */ CHECK_AND_INC(y+1, x) /* down */ CHECK_AND_INC(y+1, x+1) /* down-right */ } /* want edges to wrap so that the top connects to the bottom, left to * right, etc. */ /* top edge */ else if (y == 0 && x != 0 && x != COLS - 1) { CHECK_AND_INC(LINES-1, x-1) /* up-left becomes bottom edge-left */ CHECK_AND_INC(LINES-1, x) /* up becomes bottom */ CHECK_AND_INC(LINES-1, x+1) /* up-right becomes bottom-right */ CHECK_AND_INC( y, x-1) /* left */ CHECK_AND_INC( y, x+1) /* right */ CHECK_AND_INC( y+1, x-1) /* down-left */ CHECK_AND_INC( y+1, x) /* down */ CHECK_AND_INC( y+1, x+1) /* down-right */ } /* left edge */ else if (x == 0 && y != 0 && y != LINES - 1) { CHECK_AND_INC(y-1, COLS-1) /* up-left becomes up-right edge */ CHECK_AND_INC(y-1, x) /* up */ CHECK_AND_INC(y-1, x+1) /* up-right */ CHECK_AND_INC( y, COLS-1) /* left becomes right edge */ CHECK_AND_INC( y, x+1) /* right */ CHECK_AND_INC(y+1, COLS-1) /* down-left becomes down-right edge */ CHECK_AND_INC(y+1, x) /* down */ CHECK_AND_INC(y+1, x+1) /* down-right */ } /* right edge */ else if (x == COLS - 1 && y != 0 && y != LINES - 1) { CHECK_AND_INC(y-1, x-1) /* etc. */ CHECK_AND_INC(y-1, x) CHECK_AND_INC(y-1, 0) CHECK_AND_INC( y, x-1) CHECK_AND_INC( y, 0) CHECK_AND_INC(y+1, x-1) CHECK_AND_INC(y+1, x) CHECK_AND_INC(y+1, 0) } /* bottom edge */ else if (y == LINES - 1 && x != 0 && x != COLS - 1) { CHECK_AND_INC(y-1, x-1) CHECK_AND_INC(y-1, x) CHECK_AND_INC(y-1, x+1) CHECK_AND_INC( y, x-1) CHECK_AND_INC( y, x+1) CHECK_AND_INC( 0, x-1) CHECK_AND_INC( 0, x) CHECK_AND_INC( 0, x+1) } /* top-left corner */ else if (y == 0 && x == 0) { CHECK_AND_INC(LINES-1, COLS-1) /* up-left becomes bottom edge-right edge */ CHECK_AND_INC(LINES-1, x) /* up becomes bottom-edge */ CHECK_AND_INC(LINES-1, x+1) /* up-right becomes bottom edge-right */ CHECK_AND_INC( y, COLS-1) /* left becomes right edge */ CHECK_AND_INC( y, x+1) /* right */ CHECK_AND_INC( y+1, COLS-1) /* down-left becomes down-right edge */ CHECK_AND_INC( y+1, x) /* down */ CHECK_AND_INC( y+1, x+1) /* down-right */ } /* top-right corner */ else if (y == 0 && x == COLS - 1) { CHECK_AND_INC(LINES-1, x-1) /* etc. */ CHECK_AND_INC(LINES-1, x) CHECK_AND_INC(LINES-1, 0) CHECK_AND_INC( y, x-1) CHECK_AND_INC( y, 0) CHECK_AND_INC( y+1, x-1) CHECK_AND_INC( y+1, x) CHECK_AND_INC( y+1, 0) } /* bottom-left corner */ else if (y == LINES - 1 && x == 0) { CHECK_AND_INC(y-1, COLS-1) CHECK_AND_INC(y-1, x) CHECK_AND_INC(y-1, x+1) CHECK_AND_INC( y, COLS-1) CHECK_AND_INC( y, x+1) CHECK_AND_INC( 0, COLS-1) CHECK_AND_INC( 0, x) CHECK_AND_INC( 0, x+1) } /* bottom-right corner */ else if (y == LINES - 1 && x == COLS - 1) { CHECK_AND_INC(y-1, x-1) CHECK_AND_INC(y-1, x) CHECK_AND_INC(y-1, 0) CHECK_AND_INC( y, x-1) CHECK_AND_INC( y, 0) CHECK_AND_INC( 0, x-1) CHECK_AND_INC( 0, x) CHECK_AND_INC( 0, 0) } return count; } void update_cell(chtype testch, unsigned int count, int y, int x) { if (testch == ALIVE) { if (count <= 1) { mvaddch(y, x, DEAD); /* cell dies if it has 0 or 1 neighbour */ } else if (count >= 4) { mvaddch(y, x, DEAD); /* cell dies if it has 4 or more neighbours */ } else { ; /* cell survives if it has 2 or 3 neighbours */ } } else if (testch == DEAD) { if (count == 3) { mvaddch(y, x, ALIVE); /* cell becomes populated */ } else { ; /* cell stays dead */ } } } int main(void) { const struct timespec ts = {0, 5000000}; int *neighbour_count; /* initialize curses */ initscr(); cbreak(); noecho(); curs_set(0); clear(); printw("LINES: %d, COLS: %d\n", LINES, COLS); refresh(); /* initialize the game of life */ initialize_map(); add_glider(0, 80); add_glider(0, 70); add_glider(0, 60); add_small_exploder(25, 105); add_small_exploder(40, 15); refresh(); /* main loop to update the screen */ while (true) { int x, y; neighbour_count = malloc(LINES*COLS*(sizeof *neighbour_count)); /* generate the neighbour_count array */ for (y = 0; y < LINES; y++) { for (x = 0; x < COLS; x++) { /* equivalent to neighbour_count[y][x], alternate form: *neighbour_count[y*COLS+x] = count_neighbours(y, x); */ *(neighbour_count + y*COLS + x) = count_neighbours(y, x); } } /* revive or kill each cell based on its neighbour count */ for (y = 0; y < LINES; y++) { for (x = 0; x < COLS; x++) { chtype testch = mvinch(y, x) & A_CHARTEXT; int count = *(neighbour_count + y*COLS + x); update_cell(testch, count, y, x); } } nanosleep(&ts, NULL); refresh(); } /* release malloc'd memory */ free(neighbour_count); /* make ncurses clean up */ endwin(); exit(EXIT_SUCCESS); }
25.942238
75
0.586557
e32df4104a963e61e84160daaf00abb901f73c0c
2,684
h
C
CoreSuggestionsInternals.framework/SGDCKLocation.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
4
2021-10-06T12:15:26.000Z
2022-02-21T02:26:00.000Z
CoreSuggestionsInternals.framework/SGDCKLocation.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
null
null
null
CoreSuggestionsInternals.framework/SGDCKLocation.h
reels-research/iOS-Private-Frameworks
9a4f4534939310a51fdbf5a439dd22487efb0f01
[ "MIT" ]
1
2021-10-08T07:40:53.000Z
2021-10-08T07:40:53.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/CoreSuggestionsInternals.framework/CoreSuggestionsInternals */ @interface SGDCKLocation : PBCodable <NSCopying> { double _accuracy; NSString * _address; NSString * _airportCode; NSData * _handle; struct { unsigned int accuracy : 1; unsigned int latitude : 1; unsigned int longitude : 1; unsigned int quality : 1; unsigned int locationType : 1; } _has; NSString * _label; double _latitude; unsigned long long _locationType; double _longitude; double _quality; } @property (nonatomic) double accuracy; @property (nonatomic, retain) NSString *address; @property (nonatomic, retain) NSString *airportCode; @property (nonatomic, retain) NSData *handle; @property (nonatomic) bool hasAccuracy; @property (nonatomic, readonly) bool hasAddress; @property (nonatomic, readonly) bool hasAirportCode; @property (nonatomic, readonly) bool hasHandle; @property (nonatomic, readonly) bool hasLabel; @property (nonatomic) bool hasLatitude; @property (nonatomic) bool hasLocationType; @property (nonatomic) bool hasLongitude; @property (nonatomic) bool hasQuality; @property (nonatomic, retain) NSString *label; @property (nonatomic) double latitude; @property (nonatomic) unsigned long long locationType; @property (nonatomic) double longitude; @property (nonatomic) double quality; - (void).cxx_destruct; - (unsigned long long)StringAsLocationType:(id)arg1; - (double)accuracy; - (id)address; - (id)airportCode; - (void)copyTo:(id)arg1; - (id)copyWithZone:(struct _NSZone { }*)arg1; - (id)description; - (id)dictionaryRepresentation; - (id)handle; - (bool)hasAccuracy; - (bool)hasAddress; - (bool)hasAirportCode; - (bool)hasHandle; - (bool)hasLabel; - (bool)hasLatitude; - (bool)hasLocationType; - (bool)hasLongitude; - (bool)hasQuality; - (unsigned long long)hash; - (bool)isEqual:(id)arg1; - (id)label; - (double)latitude; - (unsigned long long)locationType; - (id)locationTypeAsString:(unsigned long long)arg1; - (double)longitude; - (void)mergeFrom:(id)arg1; - (double)quality; - (bool)readFrom:(id)arg1; - (void)setAccuracy:(double)arg1; - (void)setAddress:(id)arg1; - (void)setAirportCode:(id)arg1; - (void)setHandle:(id)arg1; - (void)setHasAccuracy:(bool)arg1; - (void)setHasLatitude:(bool)arg1; - (void)setHasLocationType:(bool)arg1; - (void)setHasLongitude:(bool)arg1; - (void)setHasQuality:(bool)arg1; - (void)setLabel:(id)arg1; - (void)setLatitude:(double)arg1; - (void)setLocationType:(unsigned long long)arg1; - (void)setLongitude:(double)arg1; - (void)setQuality:(double)arg1; - (void)writeTo:(id)arg1; @end
30.157303
103
0.72839
e333aa0bb08b53566def71533f7f5d4f65363312
2,919
h
C
Sidecar/CRLSystemSound.h
ValCapri/Sidecar
fad1e4abb30074d6fa8a61f17cafbc90acab1137
[ "MIT" ]
null
null
null
Sidecar/CRLSystemSound.h
ValCapri/Sidecar
fad1e4abb30074d6fa8a61f17cafbc90acab1137
[ "MIT" ]
null
null
null
Sidecar/CRLSystemSound.h
ValCapri/Sidecar
fad1e4abb30074d6fa8a61f17cafbc90acab1137
[ "MIT" ]
null
null
null
// Sidecar // Copyright (c) 2014, Crush & Lovely <engineering@crushlovely.com> // Under the MIT License; see LICENSE file for details. #import <Foundation/Foundation.h> /** This is a simple wrapper around AudioServicesCreateSystemSoundID and AudioServicesPlaySystemSound. You should read the docs surrounding limitations on those, but the gist is that you should only use this interface for short sound effects (<30 seconds) in caf, wav, or aif format. Instances retain themselves so that they can continue playing until they complete. That is, you can treat the methods of this class as fire-and-forget; you don't have to hold on to the instances after calling a play method unless you may need to stop them before they finish or poll their playing state. Attempting to play an instance that is already playing has no effect, but you may call a play method on a previously completed SBSystemSound to play it again. Note that if the user's device is muted, the sound will not play. In this case, the completion block will be called instantly rather than waiting the duration of the sound. Also of note for developers is that this class has specific hooks to work in the simulator regardless of your sound settings in System Preferences. Also +playVibrationOrBeep:YES will play the default OSX alert sound in the simulator. */ @interface CRLSystemSound : NSObject /** Triggers the device's vibration function, or optionally plays a system alert beep on devices that do not support vibration. @param beepOnUnsupportedDevices If YES, will trigger the system alert beep on devices that do not support vibration. */ +(void)vibrateOrBeep:(BOOL)beepOnUnsupportedDevices; // These class-level methods and the associated -init methods will return // nil if the given path or resource could not be loaded. +(CRLSystemSound *)playFileAtPath:(NSString *)path completion:(void (^)(CRLSystemSound *sound))completion; +(CRLSystemSound *)playFileAtPath:(NSString *)path; // The resource initializers retrieve the path for the given resource // from [NSBundle mainBundle]. +(CRLSystemSound *)playResource:(NSString *)name extension:(NSString *)extension completion:(void (^)(CRLSystemSound *sound))completion; +(CRLSystemSound *)playResource:(NSString *)name extension:(NSString *)extension; -(CRLSystemSound *)initWithFileURL:(NSURL *)URL; -(CRLSystemSound *)initWithFileAtPath:(NSString *)path; -(CRLSystemSound *)initWithResource:(NSString *)name extension:(NSString *)extension; // Calling these on an instance that's already playing will have no effect. -(void)playWithCompletion:(void (^)(CRLSystemSound *sound))completion; -(void)play; // Same as above with nil completion block @property (nonatomic, assign, readonly, getter=isPlaying) BOOL playing; /** Stops playback of the sound, or does nothing if it is not playing. The completion block will not be called. */ -(void)stop; @end
41.7
136
0.776636
e22284ab5e93ba013a484eb1bce71bbdabad37ab
600
h
C
ios-sdk-ui/OcUILibrary/framework/TongDaoSDK.framework/Headers/TdStartLocation.h
tongrd/ios-demo
48955b5da014c5f087adc0334d4e4df92725d762
[ "MIT" ]
null
null
null
ios-sdk-ui/OcUILibrary/framework/TongDaoSDK.framework/Headers/TdStartLocation.h
tongrd/ios-demo
48955b5da014c5f087adc0334d4e4df92725d762
[ "MIT" ]
null
null
null
ios-sdk-ui/OcUILibrary/framework/TongDaoSDK.framework/Headers/TdStartLocation.h
tongrd/ios-demo
48955b5da014c5f087adc0334d4e4df92725d762
[ "MIT" ]
null
null
null
// // TdStartLocation.h // TongDaoOcSdk // // Created by bin jin on 15/7/16. // Copyright (c) 2015年 Tongdao. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreLocation/CoreLocation.h> #import "TdLocationCallback.h" #import "Singleton.h" @interface TdStartLocation : NSObject<CLLocationManagerDelegate> singleton_interface(TdStartLocation) @property(nonatomic,strong)CLLocationManager* manager; @property(nonatomic)id<TdLocationCallback>tdLocationCallback; @property(nonatomic,assign)BOOL isFistLocationManager; -(void)start:(id<TdLocationCallback>)tdLocationCallback; @end
28.571429
64
0.798333
2735c5e25cd8be797779210d5c30b50c22252cea
964
h
C
music.h
tk512/msp430-music-mouse
8ac8fd8b1b660050ab6f5152407a71d5fdcd971e
[ "Artistic-2.0" ]
null
null
null
music.h
tk512/msp430-music-mouse
8ac8fd8b1b660050ab6f5152407a71d5fdcd971e
[ "Artistic-2.0" ]
null
null
null
music.h
tk512/msp430-music-mouse
8ac8fd8b1b660050ab6f5152407a71d5fdcd971e
[ "Artistic-2.0" ]
null
null
null
#ifndef MUSIC_H_ #define MUSIC_H_ #define DEAD_TIME_MS 20 #define TICKS_PER_BEAT 4 #define E3 3033 #define Fs3 2703 #define G3 2551 #define Gs3 2408 #define A3 2273 #define As3 2145 #define B3 2025 #define Cb4 #define C4 1911 #define Cs4 1804 #define Db4 1804 #define D4 1703 #define Ds4 1607 #define Eb4 1607 #define E4 1517 #define F4 1432 #define Fs4 1351 #define Gb4 1351 #define G4 1276 #define Gs4 1204 #define Ab4 1204 #define A4 1136 #define As4 1073 #define Bb4 1073 #define B4 1012 #define C5 956 #define Cs5 902 #define Db5 902 #define D5 851 #define Ds5 804 #define Eb5 804 #define E5 758 #define F5 716 #define Fs5 676 #define Gb5 676 #define G5 638 #define Gs5 602 #define Ab5 602 #define A5 568 extern volatile unsigned int sound_enabled; extern volatile unsigned int current_note; extern volatile unsigned int ms_elapsed; void song_play(); void set_bpm(unsigned int bpm); void play(unsigned int note, unsigned int duration_ticks); #endif
16.066667
58
0.76971
8f2dec121df33d1d43b0486bb9b3d415293f9b23
2,719
h
C
PrivateFrameworks/PAImaging/PAImageCacheEntry.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/PAImaging/PAImageCacheEntry.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/PAImaging/PAImageCacheEntry.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" #import "NSCopying.h" #import "PAImageResponseInternal.h" @class IPAColorProfile, NSDictionary, NSError, NSString, NSURL, PA2DBuffer, PAImageCacheEntrySharedValid, PAImageRequest; @interface PAImageCacheEntry : NSObject <PAImageResponseInternal, NSCopying> { PAImageCacheEntrySharedValid *_sharedValid; PAImageRequest *_imageRequest; id _cacheKey; id _invalidationKey; NSError *_error; PA2DBuffer *_buffer; BOOL _scaled; NSDictionary *_cgImageProperties; IPAColorProfile *_colorProfile; int _format; long long _masterToRasterOrientation; long long _rasterToDisplayOrientation; unsigned long long _requestedSubsampleFactor; BOOL _endAccessOnDealloc; NSURL *_imageURL; } @property long long rasterToDisplayOrientation; // @synthesize rasterToDisplayOrientation=_rasterToDisplayOrientation; @property long long masterToRasterOrientation; // @synthesize masterToRasterOrientation=_masterToRasterOrientation; @property(nonatomic) BOOL endAccessOnDealloc; // @synthesize endAccessOnDealloc=_endAccessOnDealloc; @property int format; // @synthesize format=_format; @property(retain) id invalidationKey; // @synthesize invalidationKey=_invalidationKey; @property(retain, nonatomic) NSURL *imageURL; // @synthesize imageURL=_imageURL; - (void).cxx_destruct; @property(readonly, copy) NSString *description; - (unsigned long long)accessCount; - (struct CGImage *)newCGImageWithMaxSize:(struct PFIntSize_st)arg1 cropCenter:(struct CGPoint)arg2; - (struct CGImage *)newCGImage; @property(readonly) IPAColorProfile *colorProfile; @property(readonly) NSDictionary *cgImageProperties; @property(readonly) BOOL scaled; @property(readonly) PA2DBuffer *buffer; @property(readonly) unsigned long long requestedSubsampleFactor; @property(readonly) struct PFIntSize_st size; @property(readonly) id cacheKey; @property(readonly) PAImageRequest *imageRequest; - (id)error; - (void)transferAccess; - (void)endAccess; - (BOOL)beginAccess; - (void)dealloc; - (id)copyWithImageRequest:(id)arg1; - (id)copyWithZone:(struct _NSZone *)arg1; - (id)initWithImageRequest:(id)arg1 cacheKey:(id)arg2 invalidationKey:(id)arg3 buffer:(id)arg4 scaled:(BOOL)arg5 cgImageProperties:(id)arg6 colorProfile:(id)arg7 masterToRasterOrientation:(long long)arg8 rasterToDisplayOrientation:(long long)arg9 requestedSubsampleFactor:(unsigned long long)arg10 error:(id)arg11; // Remaining properties @property(readonly, copy) NSString *debugDescription; @property(readonly) unsigned long long hash; @property(readonly) Class superclass; @end
39.985294
314
0.790732
6a1aaed5d73e3b7b0878f22d9c6b1eb0e48568ff
2,728
h
C
mozilla/gfx/layers/ipc/ShadowLayerUtilsGralloc.h
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
5
2016-12-20T15:48:05.000Z
2020-05-01T20:12:09.000Z
mozilla/gfx/layers/ipc/ShadowLayerUtilsGralloc.h
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
null
null
null
mozilla/gfx/layers/ipc/ShadowLayerUtilsGralloc.h
naver/webgraphics
4f9b9aa6a13428b5872dd020eaf34ec77b33f240
[ "MS-PL" ]
2
2016-12-20T15:48:13.000Z
2019-12-10T15:15:05.000Z
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: sw=2 ts=8 et : */ /* 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/. */ #ifndef mozilla_layers_ShadowLayerUtilsGralloc_h #define mozilla_layers_ShadowLayerUtilsGralloc_h #include <unistd.h> #include <ui/GraphicBuffer.h> #include "base/process.h" #include "ipc/IPCMessageUtils.h" #define MOZ_HAVE_SURFACEDESCRIPTORGRALLOC #define MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS namespace mozilla { namespace layers { class MaybeMagicGrallocBufferHandle; class SurfaceDescriptor; struct GrallocBufferRef { base::ProcessId mOwner; int64_t mKey; GrallocBufferRef() : mOwner(0) , mKey(-1) { } bool operator== (const GrallocBufferRef rhs) const{ return mOwner == rhs.mOwner && mKey == rhs.mKey; } }; /** * This class exists to share the underlying GraphicBuffer resources * from one thread context to another. This requires going through * slow paths in the kernel so can be somewhat expensive. * * This is not just platform-specific, but also * gralloc-implementation-specific. */ struct MagicGrallocBufferHandle { typedef android::GraphicBuffer GraphicBuffer; MagicGrallocBufferHandle() {} MagicGrallocBufferHandle(const android::sp<GraphicBuffer>& aGraphicBuffer, GrallocBufferRef ref); // Default copy ctor and operator= are OK bool operator==(const MagicGrallocBufferHandle& aOther) const { return mGraphicBuffer == aOther.mGraphicBuffer; } android::sp<GraphicBuffer> mGraphicBuffer; GrallocBufferRef mRef; }; /** * Util function to find GraphicBuffer from SurfaceDescriptor, caller of this function should check origin * to make sure not corrupt others buffer */ android::sp<android::GraphicBuffer> GetGraphicBufferFrom(MaybeMagicGrallocBufferHandle aHandle); android::sp<android::GraphicBuffer> GetGraphicBufferFromDesc(SurfaceDescriptor aDesc); } // namespace layers } // namespace mozilla namespace IPC { template <> struct ParamTraits<mozilla::layers::MagicGrallocBufferHandle> { typedef mozilla::layers::MagicGrallocBufferHandle paramType; static void Write(Message* aMsg, const paramType& aParam); static bool Read(const Message* aMsg, void** aIter, paramType* aResult); }; template<> struct ParamTraits<mozilla::layers::GrallocBufferRef> { typedef mozilla::layers::GrallocBufferRef paramType; static void Write(Message* aMsg, const paramType& aParam); static bool Read(const Message* aMsg, void** aIter, paramType* aResult); }; } // namespace IPC #endif // mozilla_layers_ShadowLayerUtilsGralloc_h
28.416667
106
0.759531
ac69e056b7da9adc7ea0430b473bcec4b01c2cc0
869
h
C
src/slPostProcessing.h
pneumad/scanline
15e9125efb3f342f8ee84c0268f9ff2496e0fef7
[ "MIT" ]
null
null
null
src/slPostProcessing.h
pneumad/scanline
15e9125efb3f342f8ee84c0268f9ff2496e0fef7
[ "MIT" ]
null
null
null
src/slPostProcessing.h
pneumad/scanline
15e9125efb3f342f8ee84c0268f9ff2496e0fef7
[ "MIT" ]
null
null
null
#pragma once #include "defines.h" #include "ofMain.h" /* #include "ofxPostProcessing.h" #define DEFAULT_POSTPROC_CONTRAST 1.25 #define DEFAULT_POSTPROC_BRIGHTNESS 1.5 //1.5 #define DEFAULT_FXAA_ON FALSE #define DEFAULT_BLOOM_ON FALSE #define DEFAULT_CONTRAST_ON TRUE #define DEFAULT_POSTPROC_SETFLIP TRUE class slPostProcessing { public: slPostProcessing(); virtual ~slPostProcessing(); void update(); void draw(); void begin(); void end(); ofxPostProcessing post_runtime; FxaaPass::Ptr Fxaa_runtime; BloomPass::Ptr Bloom_runtime; ContrastPass::Ptr Contrast_runtime; private: }; */
22.282051
49
0.536249
ac846bb612893150315549b1d4d2a5a21735905e
841
h
C
test-code/x86-decoder/x86_instructions.tbl.h
pi3orama/Snitchaser
99145955cd278c3f85be455ee039f44050de4d15
[ "MIT" ]
null
null
null
test-code/x86-decoder/x86_instructions.tbl.h
pi3orama/Snitchaser
99145955cd278c3f85be455ee039f44050de4d15
[ "MIT" ]
null
null
null
test-code/x86-decoder/x86_instructions.tbl.h
pi3orama/Snitchaser
99145955cd278c3f85be455ee039f44050de4d15
[ "MIT" ]
1
2021-01-10T08:43:02.000Z
2021-01-10T08:43:02.000Z
/* * x86_instructions.tbl.h * by WN @ Jan. 18, 2010 */ #ifndef X86_INSTRUCTIONS_TBL_H #define X86_INSTRUCTIONS_TBL_H enum _operator_type { _OPERATOR_NORMAL, _OPERATOR_SPECIAL, } operator_type; enum _operade_type { _OPERADE_NORMAL, _OPERADE_CONSTANT, _OPERADE_REGISTERS, }; struct _regs { const char * r1; const char * r2; }; struct _operade { enum _operade_type type; union { struct _regs regs; const char * normal; int constant; } u; }; struct _hint { const char * hint; }; struct _entry_rng { int start; int end; }; extern void add_descriptor( const char * table, int head, const char * operator, struct _entry_rng rng, const char * specprefix, int nr_operades, struct _operade * operades, int nr_hints, struct _hint * hints, int jmpnote); extern void print_table(void); #endif // vim:ts=4:sw=4
14.016667
30
0.714625
6b975df864a20320876f25a12ebe0bf8f474185c
1,323
h
C
pkg/s1ap/asn1/E-RABAdmittedList.h
coreswitch/coreswitch
69839bcdb18dbb0774da1458b4ffd20c16764e81
[ "Apache-2.0" ]
5
2019-09-06T06:45:28.000Z
2021-01-26T17:15:11.000Z
pkg/s1ap/asn1/E-RABAdmittedList.h
coreswitch/coreswitch
69839bcdb18dbb0774da1458b4ffd20c16764e81
[ "Apache-2.0" ]
1
2021-07-21T04:59:52.000Z
2021-07-21T04:59:52.000Z
pkg/s1ap/asn1/E-RABAdmittedList.h
coreswitch/coreswitch
69839bcdb18dbb0774da1458b4ffd20c16764e81
[ "Apache-2.0" ]
1
2020-04-27T08:48:53.000Z
2020-04-27T08:48:53.000Z
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" * found in "r14.4.0/36413-e40.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps -no-gen-example` */ #ifndef _E_RABAdmittedList_H_ #define _E_RABAdmittedList_H_ #include <asn_application.h> /* Including external dependencies */ #include "E-RAB-IE-ContainerList.h" #ifdef __cplusplus extern "C" { #endif /* E-RABAdmittedList */ typedef E_RAB_IE_ContainerList_1142P2_t E_RABAdmittedList_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_E_RABAdmittedList; asn_struct_free_f E_RABAdmittedList_free; asn_struct_print_f E_RABAdmittedList_print; asn_constr_check_f E_RABAdmittedList_constraint; ber_type_decoder_f E_RABAdmittedList_decode_ber; der_type_encoder_f E_RABAdmittedList_encode_der; xer_type_decoder_f E_RABAdmittedList_decode_xer; xer_type_encoder_f E_RABAdmittedList_encode_xer; oer_type_decoder_f E_RABAdmittedList_decode_oer; oer_type_encoder_f E_RABAdmittedList_encode_oer; per_type_decoder_f E_RABAdmittedList_decode_uper; per_type_encoder_f E_RABAdmittedList_encode_uper; per_type_decoder_f E_RABAdmittedList_decode_aper; per_type_encoder_f E_RABAdmittedList_encode_aper; #ifdef __cplusplus } #endif #endif /* _E_RABAdmittedList_H_ */ #include <asn_internal.h>
28.76087
89
0.842026
361d01e9752a59f152b77af6ce62be7c80ba94b8
3,476
h
C
remoting/base/oauth_token_getter.h
mghgroup/Glide-Browser
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
575
2015-06-18T23:58:20.000Z
2022-03-23T09:32:39.000Z
remoting/base/oauth_token_getter.h
mghgroup/Glide-Browser
6a4c1eaa6632ec55014fee87781c6bbbb92a2af5
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
113
2015-05-04T09:58:14.000Z
2022-01-31T19:35:03.000Z
remoting/base/oauth_token_getter.h
DamieFC/chromium
54ce2d3c77723697efd22cfdb02aea38f9dfa25c
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
52
2015-07-14T10:40:50.000Z
2022-03-15T01:11:49.000Z
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef REMOTING_BASE_OAUTH_TOKEN_GETTER_H_ #define REMOTING_BASE_OAUTH_TOKEN_GETTER_H_ #include <string> #include "base/callback.h" #include "base/macros.h" namespace remoting { // OAuthTokenGetter caches OAuth access tokens and refreshes them as needed. class OAuthTokenGetter { public: // Status of the refresh token attempt. enum Status { // Success, credentials in user_email/access_token. SUCCESS, // Network failure (caller may retry). NETWORK_ERROR, // Authentication failure (permanent). AUTH_ERROR, }; typedef base::OnceCallback<void(Status status, const std::string& user_email, const std::string& access_token)> TokenCallback; typedef base::RepeatingCallback<void(const std::string& user_email, const std::string& refresh_token)> CredentialsUpdatedCallback; // This structure contains information required to perform authorization // with the authorization server. struct OAuthAuthorizationCredentials { // |login| is used to valdiate |refresh_token| match. // |is_service_account| should be True if the OAuth refresh token is for a // service account, False for a user account, to allow the correct client-ID // to be used. OAuthAuthorizationCredentials(const std::string& login, const std::string& refresh_token, bool is_service_account); ~OAuthAuthorizationCredentials(); // The user's account name (i.e. their email address). std::string login; // Token delegating authority to us to act as the user. std::string refresh_token; // Whether these credentials belong to a service account. bool is_service_account; }; // This structure contains information required to perform authentication // with the authorization server. struct OAuthIntermediateCredentials { // |authorization_code| is a one time use code used to authenticate with // the authorization server. // |is_service_account| should be True if the OAuth refresh token is for a // service account, False for a user account, to allow the correct client-ID // to be used. OAuthIntermediateCredentials(const std::string& authorization_code, bool is_service_account); ~OAuthIntermediateCredentials(); // Code used to check out a access token from the authrozation service. std::string authorization_code; // Override uri for oauth redirect. This is used for client accounts only // and is optionally set to override the default used for authentication. std::string oauth_redirect_uri; // Whether these credentials belong to a service account. bool is_service_account; }; OAuthTokenGetter() {} virtual ~OAuthTokenGetter() {} // Call |on_access_token| with an access token, or the failure status. virtual void CallWithToken( OAuthTokenGetter::TokenCallback on_access_token) = 0; // Invalidates the cache, so the next CallWithToken() will get a fresh access // token. virtual void InvalidateCache() = 0; DISALLOW_COPY_AND_ASSIGN(OAuthTokenGetter); }; } // namespace remoting #endif // REMOTING_BASE_OAUTH_TOKEN_GETTER_H_
34.415842
80
0.697929
d9f900def900dc4d38b74b03736508413e905ff7
384
h
C
src/Win/NoteButton.h
dconnet/AgilityBook
4804c79079d6109294a6d377fb6ebda70bcb30a1
[ "MIT" ]
1
2020-11-23T20:33:41.000Z
2020-11-23T20:33:41.000Z
src/Win/NoteButton.h
dconnet/AgilityBook
4804c79079d6109294a6d377fb6ebda70bcb30a1
[ "MIT" ]
null
null
null
src/Win/NoteButton.h
dconnet/AgilityBook
4804c79079d6109294a6d377fb6ebda70bcb30a1
[ "MIT" ]
3
2020-05-04T19:42:26.000Z
2022-03-08T09:36:54.000Z
#pragma once /* * Copyright (c) David Connet. All Rights Reserved. * * License: See License.txt */ /** * @file * @brief Special button for invoking notes. * @author David Connet * * Revision History * 2009-02-11 Ported to wxWidgets. * 2005-12-12 Created */ #include <wx/imaglist.h> class CNoteButton : public wxBitmapButton { public: CNoteButton(wxWindow* parent); };
15.36
51
0.684896
ce131368b8c3ab43e558455bf1854f2ba05f1781
1,481
c
C
src/microgl_driver.c
Twinklebear/microGL
e63dd814f21f55ba71f3ecb7a498e7a49573bd9e
[ "MIT" ]
1
2015-10-09T21:20:07.000Z
2015-10-09T21:20:07.000Z
src/microgl_driver.c
Twinklebear/microGL
e63dd814f21f55ba71f3ecb7a498e7a49573bd9e
[ "MIT" ]
null
null
null
src/microgl_driver.c
Twinklebear/microGL
e63dd814f21f55ba71f3ecb7a498e7a49573bd9e
[ "MIT" ]
null
null
null
#include <stdlib.h> #include <string.h> #include "microgl.h" #include "microgl_driver.h" microgl_driver_t* microgl_driver_new(uint32_t width, uint32_t height){ microgl_driver_t *driver = (microgl_driver_t*)malloc(sizeof(microgl_driver_t)); if (!driver){ return NULL; } driver->model_view.top = NULL; driver->projection.top = NULL; driver->stack_ptr = &driver->model_view; driver->vertex_list = vertex_list_new(128); driver->mode = TRIANGLES; driver->active_color = vector4f_new(0, 0, 0, 0); driver->width = width; driver->height = height; driver->color_buffer = (uint32_t*)malloc(sizeof(uint32_t) * width * height); driver->depth_buffer = (float*)malloc(sizeof(float) * width * height); return driver; } void microgl_driver_destroy(microgl_driver_t *driver){ if (!driver){ return; } matrix4f_stack_clear(&driver->model_view); matrix4f_stack_clear(&driver->projection); vertex_list_destroy(&driver->vertex_list); free(driver->color_buffer); free(driver->depth_buffer); free(driver); } void microgl_driver_use(microgl_driver_t *driver){ extern microgl_driver_t *mgl_active_driver; mgl_active_driver = driver; //Clear color and depth buffers for (size_t i = 0; i < driver->width * driver->height; ++i){ driver->color_buffer[i] = 0; driver->depth_buffer[i] = 1.f; } matrix4f_stack_push(&driver->model_view, matrix4f_identity()); matrix4f_stack_push(&driver->projection, matrix4f_identity()); driver->active_color = vector4f_new(1, 1, 1, 1); }
30.22449
80
0.742066
381d14651199e01eb4d3ea2ecf50a498eaebad24
540
h
C
usr/libexec/carkitd/CARVehicleState-Protocol.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
usr/libexec/carkitd/CARVehicleState-Protocol.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
usr/libexec/carkitd/CARVehicleState-Protocol.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 "NSObject-Protocol.h" @class NSString; @protocol CARVehicleState <NSObject> @property(readonly) NSString *vehicleStateDebugDescription; @property(readonly, copy) NSString *deviceID; @property(readonly) unsigned long long vehicleOperatorState; @property(readonly) unsigned long long vehicularHints; @property(readonly) unsigned long long vehicleState; @end
28.421053
120
0.77037
3853189756cb35aa27955860fc30456f575350b8
587
h
C
iOS/10.0.2/PrivateFrameworks/CVML.framework/CVMLImageBufferManager.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
30
2016-10-09T20:13:00.000Z
2022-01-24T04:14:57.000Z
iOS/10.0.2/PrivateFrameworks/CVML.framework/CVMLImageBufferManager.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
null
null
null
iOS/10.0.2/PrivateFrameworks/CVML.framework/CVMLImageBufferManager.h
onmyway133/Runtime-Headers
e9b80e7ab9103f37ad421ad6b8b58ee06369d21f
[ "MIT" ]
7
2017-08-29T14:41:25.000Z
2022-01-19T17:14:54.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/CVML.framework/CVML */ @interface CVMLImageBufferManager : NSObject { NSHashTable * activeImageBuffers; NSLock * bufferTableLock; CIContext * lowPriorityCIContext; <MTLDevice> * lowPriorityCIContextMetalDevice; CIContext * mainCIContext; <MTLDevice> * mainCIContextMetalDevice; } + (id)manager; - (void).cxx_destruct; - (void)addImageBuffer:(id)arg1; - (void)dealloc; - (id)init; - (void)purgeAllCaches; - (void)removeBuffer:(id)arg1; - (id)sharedCIContextWithOptions:(id)arg1; @end
23.48
63
0.737649
c03d16f2149164fe8295f81a51dd6b8db4161a39
1,851
h
C
PrivateFrameworks/CoreUtils/CUNetLinkManager.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/CoreUtils/CUNetLinkManager.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/CoreUtils/CUNetLinkManager.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" @class NSObject<OS_dispatch_queue>, NSObject<OS_dispatch_source>, NSString; @interface CUNetLinkManager : NSObject { struct NSMutableSet *_endpoints; unsigned int _endpointChanges; BOOL _hasIPv4Endpoint; BOOL _hasIPv6Endpoint; BOOL _invalidateCalled; BOOL _invalidateDone; NSObject<OS_dispatch_source> *_pollTimer; int _probeSocketV4; NSObject<OS_dispatch_source> *_probeSourceV4; int _probeSocketV6; NSObject<OS_dispatch_source> *_probeSourceV6; unsigned int _reReachableCount; unsigned int _rxCount; unsigned int _txCount; unsigned int _txErrors; struct LogCategory *_ucat; unsigned int _unreachableCount; NSObject<OS_dispatch_queue> *_dispatchQueue; CDUnknownBlockType _invalidationHandler; NSString *_label; } @property(copy, nonatomic) NSString *label; // @synthesize label=_label; @property(copy, nonatomic) CDUnknownBlockType invalidationHandler; // @synthesize invalidationHandler=_invalidationHandler; @property(retain, nonatomic) NSObject<OS_dispatch_queue> *dispatchQueue; // @synthesize dispatchQueue=_dispatchQueue; - (void).cxx_destruct; - (void)_monitorSendPacketToEndpoint:(id)arg1; - (void)_monitorReadPacket:(int)arg1; - (void)_monitorSetupSocket:(int)arg1; - (void)_monitorEnsureStopped; - (void)_monitorEnsureStarted; - (void)_updateEndpoint:(id)arg1 state:(int)arg2; - (void)_updateNDP; - (void)_updateARP; - (void)_updateEndpoints; - (void)_update; - (void)removeEndpoint:(id)arg1; - (void)addEndpoint:(id)arg1; - (void)_invalidated; - (void)_invalidate; - (void)invalidate; - (void)activate; - (id)descriptionWithLevel:(int)arg1; - (id)description; - (void)dealloc; - (id)init; @end
29.854839
123
0.752026
0e0bd687aa7c657514d0dfd0e3a0a2b34fb55260
3,651
h
C
PyCommon/external_libraries/VirtualPhysics/vpRenderer/vpBasicRenderer.h
snumrl/DataDrivenBipedController
68ecaa17790ebf3039ae8c0b91d21fab4829bb8c
[ "Apache-2.0", "MIT" ]
7
2018-08-17T10:25:56.000Z
2021-09-01T11:28:56.000Z
PyCommon/external_libraries/VirtualPhysics/vpRenderer/vpBasicRenderer.h
snumrl/DataDrivenBipedController
68ecaa17790ebf3039ae8c0b91d21fab4829bb8c
[ "Apache-2.0", "MIT" ]
null
null
null
PyCommon/external_libraries/VirtualPhysics/vpRenderer/vpBasicRenderer.h
snumrl/DataDrivenBipedController
68ecaa17790ebf3039ae8c0b91d21fab4829bb8c
[ "Apache-2.0", "MIT" ]
5
2017-01-05T09:22:58.000Z
2021-07-26T15:13:19.000Z
#ifndef _VP_BASIC_RENDERER_ #define _VP_BASIC_RENDERER_ #include <GL/glut.h> #define VP_BASIC_RENDERER_WORLD(world) { _pWorld = &world; } void initialize(void); void frame(void); void keyboard(unsigned char key, int x, int y); vpWorld *_pWorld = NULL; GLuint list_id; GLdouble world_radius; GLdouble view_angle[2] = { 0.5f, 0.5f }; GLfloat _color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; Vec3 world_center; void reshapeFunc(int w, int h) { glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45.0, (GLdouble)w / (GLdouble)h, 0.1 * world_radius, 2.0 * world_radius); glMatrixMode(GL_MODELVIEW); glViewport(0, 0, w, h); } void _init(void) { initialize(); glEnable(GL_DEPTH_TEST); glEnable(GL_LIGHTING); glEnable(GL_LIGHT0); world_radius = _pWorld->GetBoundingSphere(world_center); list_id = glGenLists(_pWorld->GetNumBody()); GLdouble _T[16], _val[3]; char type; GLUquadricObj *qobj = gluNewQuadric(); for ( int i = 0; i < _pWorld->GetNumBody(); i++ ) { glNewList(list_id + i, GL_COMPILE); for ( int j = 0; j < 3; j++ ) _color[j] = 0.3f + 0.5f * (float)rand() / (float)RAND_MAX; glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, _color); for ( int j = 0; j < _pWorld->GetBody(i)->GetNumGeometry(); j++ ) { _pWorld->GetBody(i)->GetGeometry(j)->GetShape(&type, _val); _pWorld->GetBody(i)->GetGeometry(j)->GetLocalFrame().ToArray(_T); glPushMatrix(); glMultMatrixd(_T); switch ( type ) { case 'S': gluSphere(qobj, _val[0], 12, 12); break; case 'B': glScaled(_val[0], _val[1], _val[2]); glutSolidCube(1.0); break; case 'C': _val[1] -= 2.0 * _val[0]; glTranslated(0.0, 0.0, -SCALAR_1_2 * _val[1]); gluSphere(qobj, _val[0], 12, 12); gluCylinder(qobj, _val[0], _val[0], _val[1], 12, 1); glTranslated(0.0, 0.0, _val[1]); gluSphere(qobj, _val[0], 12, 12); break; } glPopMatrix(); } glEndList(); } reshapeFunc(512, 512); } void _displayFunc(void) { frame(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); gluLookAt(world_radius * cos(view_angle[0]) * cos(view_angle[1]), world_radius * sin(view_angle[0]) * cos(view_angle[1]), world_radius * sin(view_angle[1]), world_center[0], world_center[1], world_center[2], 0, 0, 1); GLdouble _T[16]; for ( int i = 0; i < _pWorld->GetNumBody(); i++ ) { _pWorld->GetBody(i)->GetFrame().ToArray(_T); glPushMatrix(); glMultMatrixd(_T); glCallList(list_id + i); glPopMatrix(); } glutSwapBuffers(); } void idleFunc(void) { glutPostRedisplay(); } void specialFunc(int key, int x, int y) { switch ( key ) { case GLUT_KEY_LEFT: view_angle[0] += 0.1; break; case GLUT_KEY_RIGHT: view_angle[0] -= 0.1; break; case GLUT_KEY_DOWN: view_angle[1] += 0.1; break; case GLUT_KEY_UP: view_angle[1] -= 0.1; break; case GLUT_KEY_PAGE_DOWN: world_radius *= 0.99; break; case GLUT_KEY_PAGE_UP: world_radius *= 1.01; break; } } void keyboardFunc(unsigned char key, int x, int y) { switch ( key ) { case 27: exit(0); break; default: keyboard(key, x, y); } } int main(int argc, char **argv) { glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_DEPTH | GLUT_RGB); glutInitWindowSize(512, 512); glutCreateWindow("VirtualPhysics"); glutSpecialFunc(specialFunc); glutKeyboardFunc(keyboardFunc); glutDisplayFunc(_displayFunc); glutReshapeFunc(reshapeFunc); glutIdleFunc(idleFunc); _init(); glutMainLoop(); return 0; } #endif
21.350877
219
0.633525
cd9c2d240183eabfdfeca54f59193994552cdadb
820
h
C
twtsidemenu-storyboard/YANAppDelegate.h
samuil-yanovski/twtsidemenu-storyboard
af5fc3ed755de6e2637500d4759d99f89348d065
[ "MIT" ]
1
2016-02-23T11:02:38.000Z
2016-02-23T11:02:38.000Z
twtsidemenu-storyboard/YANAppDelegate.h
samuil-yanovski/twtsidemenu-storyboard
af5fc3ed755de6e2637500d4759d99f89348d065
[ "MIT" ]
null
null
null
twtsidemenu-storyboard/YANAppDelegate.h
samuil-yanovski/twtsidemenu-storyboard
af5fc3ed755de6e2637500d4759d99f89348d065
[ "MIT" ]
null
null
null
// // YANAppDelegate.h // twtsidemenu-storyboard // // Created by mac on 7/18/14. // // #import <UIKit/UIKit.h> @class TWTSideMenuViewController; @interface YANAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; @property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; @property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; @property (strong, nonatomic) UIViewController* mainViewController; @property (strong, nonatomic) UIViewController* menuViewController; @property (strong, nonatomic) TWTSideMenuViewController* sideMenuViewController; - (void)saveContext; - (NSURL *)applicationDocumentsDirectory; @end
28.275862
97
0.80122
cddd526c9753f35c5224120502e4455b2338deeb
5,841
c
C
packages/PIPS/pips/src/Libs/sac/operatorid.c
DVSR1966/par4all
86b33ca9da736e832b568c5637a2381f360f1996
[ "MIT" ]
51
2015-01-31T01:51:39.000Z
2022-02-18T02:01:50.000Z
packages/PIPS/pips/src/Libs/sac/operatorid.c
DVSR1966/par4all
86b33ca9da736e832b568c5637a2381f360f1996
[ "MIT" ]
7
2017-05-29T09:29:00.000Z
2019-03-11T16:01:39.000Z
packages/PIPS/pips/src/Libs/sac/operatorid.c
DVSR1966/par4all
86b33ca9da736e832b568c5637a2381f360f1996
[ "MIT" ]
12
2015-03-26T08:05:38.000Z
2022-02-18T02:01:51.000Z
/* $Id$ Copyright 1989-2014 MINES ParisTech This file is part of PIPS. PIPS 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 3 of the License, or any later version. PIPS 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 PIPS. If not, see <http://www.gnu.org/licenses/>. */ #ifdef HAVE_CONFIG_H #include "pips_config.h" #endif #include "genC.h" #include "linear.h" #include "ri.h" #include "effects.h" #include "resources.h" #include "misc.h" #include "ri-util.h" #include "effects-util.h" #include "sac.h" #include "patterns.h" #include "pipsdbm.h" static operator_id_tree mappings = NULL; void set_simd_operator_mappings(void * m) { pips_assert("not already set",mappings==NULL); mappings=m; } void reset_simd_operator_mappings() { pips_assert("already set",mappings); mappings=NULL; } /* * we manipulate tokens from * either the `ri' * or from the pattern lexer * binding is done here */ typedef struct { char* name; int id; } oper_id_mapping; static oper_id_mapping operators[] = { { ASSIGN_OPERATOR_NAME, ASSIGN_OPERATOR_TOK }, { PLUS_OPERATOR_NAME, PLUS_OPERATOR_TOK }, { PLUS_C_OPERATOR_NAME, PLUS_OPERATOR_TOK }, { MINUS_OPERATOR_NAME, MINUS_OPERATOR_TOK }, { COS_OPERATOR_NAME, COS_OPERATOR_TOK }, { SIN_OPERATOR_NAME, SIN_OPERATOR_TOK }, { UNARY_MINUS_OPERATOR_NAME, UNARY_MINUS_OPERATOR_TOK }, { MULTIPLY_OPERATOR_NAME, MULTIPLY_OPERATOR_TOK }, { DIVIDE_OPERATOR_NAME, DIVIDE_OPERATOR_TOK }, { INVERSE_OPERATOR_NAME, INVERSE_OPERATOR_TOK }, { POWER_OPERATOR_NAME, POWER_OPERATOR_TOK }, { MODULO_OPERATOR_NAME, MODULO_OPERATOR_TOK }, { MIN_OPERATOR_NAME, MIN_OPERATOR_TOK }, { MIN0_OPERATOR_NAME, MIN0_OPERATOR_TOK }, { AMIN1_OPERATOR_NAME, AMIN1_OPERATOR_TOK }, { DMIN1_OPERATOR_NAME, DMIN1_OPERATOR_TOK }, { MAX_OPERATOR_NAME, MAX_OPERATOR_TOK }, { MAX0_OPERATOR_NAME, MAX0_OPERATOR_TOK }, { AMAX1_OPERATOR_NAME, AMAX1_OPERATOR_TOK }, { DMAX1_OPERATOR_NAME, DMAX1_OPERATOR_TOK }, { ABS_OPERATOR_NAME, ABS_OPERATOR_TOK }, { IABS_OPERATOR_NAME, IABS_OPERATOR_TOK }, { DABS_OPERATOR_NAME, DABS_OPERATOR_TOK }, { CABS_OPERATOR_NAME, CABS_OPERATOR_TOK }, { AND_OPERATOR_NAME, AND_OPERATOR_TOK }, { OR_OPERATOR_NAME, OR_OPERATOR_TOK }, { NOT_OPERATOR_NAME, NOT_OPERATOR_TOK }, { NON_EQUAL_OPERATOR_NAME, NON_EQUAL_OPERATOR_TOK }, { EQUIV_OPERATOR_NAME, EQUIV_OPERATOR_TOK }, { NON_EQUIV_OPERATOR_NAME, NON_EQUIV_OPERATOR_TOK }, { TRUE_OPERATOR_NAME, TRUE_OPERATOR_TOK }, { FALSE_OPERATOR_NAME, FALSE_OPERATOR_TOK }, { C_GREATER_OR_EQUAL_OPERATOR_NAME, GREATER_OR_EQUAL_OPERATOR_TOK }, { C_GREATER_THAN_OPERATOR_NAME, GREATER_THAN_OPERATOR_TOK }, { C_LESS_OR_EQUAL_OPERATOR_NAME, LESS_OR_EQUAL_OPERATOR_TOK }, { C_LESS_THAN_OPERATOR_NAME, LESS_THAN_OPERATOR_TOK }, { C_EQUAL_OPERATOR_NAME, EQUAL_OPERATOR_TOK }, { CONDITIONAL_OPERATOR_NAME, PHI_TOK }, { "__PIPS_SAC_MULADD", MULADD_OPERATOR_TOK }, { NULL, UNKNOWN_TOK } }; static void insert_mapping(oper_id_mapping* item) { char * s; operator_id_tree t; t = mappings; for(s = item->name; *s != 0; s++) { operator_id_tree next; intptr_t c = *s; next = (operator_id_tree)hash_get(operator_id_tree_sons(t), (void*)c); if (next == HASH_UNDEFINED_VALUE) { next = make_operator_id_tree(UNKNOWN_TOK,hash_table_make(hash_int,HASH_DEFAULT_SIZE)); hash_put(operator_id_tree_sons(t), (void *)c, (void*)next); } t = next; } if (operator_id_tree_id(t) != UNKNOWN_TOK) pips_user_warning("overwriting previous mapping...\n"); operator_id_tree_id(t) = item->id; } static int do_get_operator_id(const char* ename) { operator_id_tree t = mappings; for(const char *s = ename; *s != 0; s++) { operator_id_tree next; intptr_t c = *s; next = (operator_id_tree)hash_get(operator_id_tree_sons(t), (void*)c); if (next == HASH_UNDEFINED_VALUE) { return UNKNOWN_TOK; } t = next; } return operator_id_tree_id(t); } int get_operator_id(entity e) { const char* ename = entity_local_name(e); int res = do_get_operator_id(ename); if(res == UNKNOWN_TOK ) { /* retry with uppercase version, cos -> COS :) */ ename = strupper(strdup(ename),ename); res = do_get_operator_id(ename); } return res; } bool simd_operator_mappings(__attribute__((unused)) char * module_name) { /* create a new operator id */ operator_id_tree m= make_operator_id_tree(UNKNOWN_TOK,hash_table_make(hash_int,HASH_DEFAULT_SIZE)); set_simd_operator_mappings(m); for(size_t i=0; operators[i].name != NULL; i++) insert_mapping(&operators[i]); /* put it in pipsdbm */ DB_PUT_MEMORY_RESOURCE(DBR_SIMD_OPERATOR_MAPPINGS,"",m); reset_simd_operator_mappings(); return true; }
30.742105
103
0.645609
075a21da48b42534621e99548665f1056c135c84
21,758
c
C
bootstrap-runtime/test/runtime/test-pcode-validation.c
AltSysrq/avalanche
a3f4bfd6138a5ea4a9b176aa851345ffda361fd4
[ "0BSD" ]
null
null
null
bootstrap-runtime/test/runtime/test-pcode-validation.c
AltSysrq/avalanche
a3f4bfd6138a5ea4a9b176aa851345ffda361fd4
[ "0BSD" ]
null
null
null
bootstrap-runtime/test/runtime/test-pcode-validation.c
AltSysrq/avalanche
a3f4bfd6138a5ea4a9b176aa851345ffda361fd4
[ "0BSD" ]
null
null
null
/*- * Copyright (c) 2015, 2016, Jason Lingle * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "test.c" #include <string.h> #define AVA__INTERNAL_INCLUDE 1 #include "runtime/avalanche/defs.h" #include "runtime/avalanche/string.h" #include "runtime/avalanche/list.h" #include "runtime/avalanche/map.h" #include "runtime/avalanche/pcode.h" #include "runtime/avalanche/errors.h" #include "runtime/avalanche/pcode-validation.h" /* Tests for low-level aspects of the P-Code to X-Code transformation. Things which can be adequately tested by compiling Avalanche code to P-Code are generally not included here; the main purpose of these tests is to test situations that should never occur when the P-Code generator functions correctly. */ defsuite(pcode_validation); static ava_xcode_global_list* make_xcode( const char* pcode_str, ava_compile_error_list* errors ) { ava_pcode_global_list* pcode = ava_pcode_global_list_of_string( ava_string_of_cstring(pcode_str)); return ava_xcode_from_pcode(pcode, errors, ava_empty_map()); } static ava_xcode_global_list* make_xcode_ok(const char* pcode_str) { ava_compile_error_list errors; ava_xcode_global_list* ret; TAILQ_INIT(&errors); ret = make_xcode(pcode_str, &errors); if (!TAILQ_EMPTY(&errors)) { ck_abort_msg("P-Code rejected unexpectly.\n%s", ava_string_to_cstring( ava_error_list_to_string(&errors, 50, ava_false))); } ck_assert_ptr_ne(NULL, ret); return ret; } static ava_xcode_function* make_xcode_fun(const char* pcode_str) { ava_xcode_global_list* xc; xc = make_xcode_ok(pcode_str); ck_assert_int_eq(1, xc->length); ck_assert_ptr_ne(NULL, xc->elts[0].fun); return xc->elts[0].fun; } static void xcode_fail_with( const char* message, const char* pcode_str ) { ava_pcode_global_list* pcode; ava_compile_error_list errors; const char* text; TAILQ_INIT(&errors); pcode = ava_pcode_global_list_of_string( ava_string_of_cstring(pcode_str)); (void)ava_xcode_from_pcode(pcode, &errors, ava_empty_map()); if (TAILQ_EMPTY(&errors)) { ck_abort_msg("P-Code unexpectedly accepted."); } else { text = ava_string_to_cstring( ava_error_list_to_string(&errors, 50, ava_false)); if (!strstr(text, message)) ck_abort_msg( "P-Code rejected, but expected message \"%s\" not found.\n%s", message, text); } } #define VERB(...) " \\{" __VA_ARGS__ "\\} " #define FUN_FOO "fun false \"ava foo\" " #define ONE_ARG " \"ava pos\" " #define NO_VAR " \\{\\{\\}\\} " #define INSTR(type,blkix,iix) \ ((const ava_pcx_##type*)assert_type_is( \ fun->blocks[blkix]->elts[iix], ava_pcxt_##type)) static const ava_pcode_exe* assert_type_is( const ava_pcode_exe* instr, ava_pcode_exe_type type ) { ck_assert_int_eq(instr->type, type); return instr; } deftest(trivial_function) { ava_xcode_function* fun; fun = make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB())); ck_assert_int_eq(0, fun->num_blocks); } deftest(identity_function) { ava_xcode_function* fun; fun = make_xcode_fun( VERB(FUN_FOO ONE_ARG VERB("x") VERB( VERB("ret v0")))); ck_assert_int_eq(1, fun->num_blocks); ck_assert_ptr_ne(NULL, fun->blocks[0]); ck_assert_int_eq(1, fun->blocks[0]->length); ck_assert_int_eq(ava_pcxt_ret, fun->blocks[0]->elts[0]->type); } deftest(simple_reg_rename) { ava_xcode_function* fun; fun = make_xcode_fun( VERB(FUN_FOO ONE_ARG VERB("x") VERB( VERB("push d 1") /* 0,0 */ VERB("push i 1") VERB("push l 1") VERB("push p 1") VERB("push f 1") VERB("ld-reg-s d0 v0") /* 0,5 */ VERB("ld-reg-d i0 d0") /* 1,0 ! */ VERB("ld-reg-d l0 d0") /* 2,0 ! */ VERB("ld-parm p0 d0 false") /* 2,1 */ VERB("ld-reg-d f0 d0") /* 3,0 ! */ VERB("invoke-dd d0 f0 0 1") /* 4,0 ! */ VERB("ret d0") VERB("pop f 1") VERB("pop p 1") VERB("pop l 1") VERB("pop i 1") /* 4,5 */ VERB("pop d 1")))); ck_assert_int_eq(0, INSTR(ld_reg_s, 0, 5)->src.index); ck_assert_int_eq(1, INSTR(ld_reg_s, 0, 5)->dst.index); ck_assert_int_eq(1, INSTR(ld_reg_d, 1, 0)->src.index); ck_assert_int_eq(2, INSTR(ld_reg_d, 1, 0)->dst.index); ck_assert_int_eq(1, INSTR(ld_reg_d, 2, 0)->src.index); ck_assert_int_eq(3, INSTR(ld_reg_d, 2, 0)->dst.index); ck_assert_int_eq(1, INSTR(ld_parm, 2, 1)->src.index); ck_assert_int_eq(4, INSTR(ld_parm, 2, 1)->dst.index); ck_assert_int_eq(1, INSTR(ld_reg_d, 3, 0)->src.index); ck_assert_int_eq(5, INSTR(ld_reg_d, 3, 0)->dst.index); ck_assert_int_eq(5, INSTR(invoke_dd, 4, 0)->fun.index); ck_assert_int_eq(4, INSTR(invoke_dd, 4, 0)->base); ck_assert_int_eq(1, INSTR(invoke_dd, 4, 0)->dst.index); ck_assert_int_eq(1, INSTR(ret, 4, 1)->return_value.index); } deftest(sectioned_reg_rename) { ava_xcode_function* fun; fun = make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("ld-imm-vd d0 foo") VERB("pop d 1") VERB("push d 1") VERB("ld-imm-vd d0 bar") VERB("pop d 1")))); ck_assert_int_eq(1, INSTR(ld_imm_vd, 0, 1)->dst.index); ck_assert_int_eq(2, INSTR(ld_imm_vd, 0, 4)->dst.index); } deftest(loop_initialisation) { (void)make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("ld-imm-i i0 42") VERB("label 1") VERB("branch i0 42 false 1") VERB("pop i 1")))); } deftest(dupe_label) { xcode_fail_with( "X9000", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("label 1") VERB("label 1")))); } deftest(pop_underflow) { xcode_fail_with( "X9001", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("pop d 1")))); } deftest(reg_nxread) { xcode_fail_with( "X9002", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("pop d 1") VERB("ret d0")))); } deftest(reg_nxwrite) { xcode_fail_with( "X9002", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("pop d 1") VERB("ld-imm-vd d0 foo")))); } deftest(reg_nxdrange) { xcode_fail_with( "X9002", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("invoke-ss d0 0 0 2") VERB("pop d 1")))); } deftest(reg_nxprange) { xcode_fail_with( "X9002", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push p 1") VERB("push d 1") VERB("invoke-sd d0 0 0 2") VERB("pop d 1") VERB("pop p 1")))); } deftest(jump_nxlabel) { xcode_fail_with( "X9003", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("goto 0") VERB("label 1")))); } deftest(local_uninit_reg) { xcode_fail_with( "X9004", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("ld-reg-s d0 d0") VERB("pop d 1")))); } deftest(block_fallthrough_uninit_reg) { xcode_fail_with( "X9004", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("goto 1") VERB("label 1") VERB("ld-reg-s d0 d0") VERB("pop d 1")))); } deftest(maybe_uninit_reg) { xcode_fail_with( "X9004", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 2") VERB("ld-imm-i i0 42") VERB("branch i0 42 false 1") VERB("ld-imm-i i1 0") VERB("label 1") VERB("ld-reg-s i0 i1") VERB("pop i 2")))); } deftest(uninit_var) { xcode_fail_with( "X9005", VERB(FUN_FOO ONE_ARG VERB("foo bar") VERB( VERB("ret v1")))); } deftest(missing_pop) { xcode_fail_with( "X9006", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1")))); } deftest(global_global_fun_oob_ref) { xcode_fail_with( "X9007", VERB("init 42")); } deftest(global_global_entity_oob_ref) { xcode_fail_with( "X9007", VERB("export 42 true foo")); } deftest(global_global_fun_nonfun_ref) { xcode_fail_with( "X9008", VERB("init 0")); } deftest(global_global_entity_nonentity_ref) { xcode_fail_with( "X9008", VERB("export 0 true foo")); } deftest(global_init_extfun_ref) { xcode_fail_with( "X9008", VERB("ext-fun" VERB("ava foo") VERB("ava pos")) VERB("init 0")); } deftest(global_bss_oob_ref) { xcode_fail_with( "X9007", VERB("S-bss 99 true [ava foo] false")); } deftest(global_bss_ref_non_sxt) { xcode_fail_with( "X9008", VERB("S-bss 0 true [ava foo] false")); } deftest(global_bss_t_ref_non_tail) { xcode_fail_with( "X9008", VERB("S-bss-t 1 true [ava foo] false 42") VERB("decl-sxt true [[struct foo] [value x]]")); } deftest(global_bss_t_ref_empty) { xcode_fail_with( "X9008", VERB("S-bss-t 1 true [ava foo] false 42") VERB("decl-sxt true [[struct foo]]")); } deftest(global_init_bad_arg_count) { xcode_fail_with( "X9008", VERB(FUN_FOO VERB("ava pos pos") VERB("foo bar") VERB()) VERB("init 0")); } deftest(local_global_var_oob_ref) { xcode_fail_with( "X9007", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("set-glob 42 v0")))); } deftest(local_global_fun_oob_ref) { xcode_fail_with( "X9007", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("ld-imm-vd d0 foo") VERB("invoke-ss d0 42 0 1") VERB("pop d 1")))); } deftest(local_global_var_nonvar_ref) { xcode_fail_with( "X9008", VERB("init 1") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("set-glob 0 v0")))); } deftest(set_glob_on_ext_var) { xcode_fail_with( "X9008", VERB("ext-var [ava some-var]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("set-glob 0 v0")))); } deftest(local_global_fun_nonfun_ref) { xcode_fail_with( "X9008", VERB("init 1") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("ld-imm-vd d0 foo") VERB("invoke-ss d0 0 0 1") VERB("pop d 1")))); } deftest(invoke_ss_with_wrong_arg_count) { xcode_fail_with( "X9009", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 2") VERB("ld-imm-vd d0 foo") VERB("ld-imm-vd d1 bar") VERB("invoke-ss d0 0 0 2") VERB("pop d 2")))); } deftest(try_nxlabel) { xcode_fail_with( "X9003", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 99") VERB("yrt")))); } deftest(unclosed_try_at_ret) { xcode_fail_with( "X9015", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("ret v0") VERB("label 1")))); } deftest(unclosed_try_at_fall_off) { xcode_fail_with( "X9015", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("goto 2") VERB("label 1") VERB("yrt") VERB("ret v0") VERB("label 2")))); } deftest(yrt_underflow) { xcode_fail_with( "X9014", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("yrt")))); } deftest(rethrow_without_exception) { xcode_fail_with( "X9016", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("rethrow") VERB("yrt") VERB("ret v0") VERB("label 1") VERB("yrt")))); } deftest(exception_conflict_lp_vs_ce) { xcode_fail_with( "X9013", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("label 1") VERB("ret v0")))); } deftest(exception_conflict_sibling_tries_same_lp) { xcode_fail_with( "X9013", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("yrt") VERB("try true 1") VERB("yrt") VERB("ret v0") VERB("label 1") VERB("yrt")))); } deftest(exception_conflict_nested_tries_same_lp) { xcode_fail_with( "X9013", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("try true 1") VERB("yrt") VERB("yrt") VERB("ret v0") VERB("label 1") VERB("yrt")))); } deftest(exception_conflict_colliding_tries) { xcode_fail_with( "X9013", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("ld-reg-d i0 v0") VERB("branch i0 0 false 1") VERB("try true 2") VERB("goto 3") VERB("label 1") VERB("try true 4") VERB("goto 3") VERB("label 3") VERB("yrt") VERB("ret v0") VERB("label 2") VERB("yrt") VERB("ret v0") VERB("label 4") VERB("yrt") VERB("ret v0") VERB("pop i 1")))); } deftest(exception_conflict_infinite_try) { xcode_fail_with( "X9013", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("label 0") VERB("try true 1") VERB("goto 0") VERB("label 1") VERB("yrt")))); } deftest(exception_conflict_infinite_catch) { xcode_fail_with( "X9013", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("label 0") VERB("try true 1") VERB("yrt") VERB("ret v0") VERB("label 1") VERB("goto 0")))); } deftest(accepts_try_join) { (void)make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("ld-reg-d i0 v0") VERB("branch i0 0 false 1") VERB("try true 2") VERB("yrt") VERB("goto 3") VERB("label 2") VERB("yrt") VERB("goto 3") VERB("label 1") VERB("try true 4") VERB("yrt") VERB("goto 3") VERB("label 4") VERB("yrt") VERB("label 3") VERB("pop i 1") VERB("ret v0")))); } deftest(try_not_phi_to_catch) { (void)make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push d 1") VERB("try true 1") VERB("ld-imm-vd d0 foo") VERB("push i 1") VERB("ld-reg-d i0 d0") VERB("yrt") VERB("goto 2") VERB("label 1") VERB("yrt") VERB("label 2") VERB("ret d0") VERB("pop i 1") VERB("pop d 1")))); } deftest(landing_pad_jump_over_init_use_after_yrt) { xcode_fail_with( "X9004", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("try true 1") VERB("ld-reg-d i0 v0") VERB("yrt") VERB("ret v0") VERB("label 1") VERB("yrt") VERB("ld-reg-u v0 i0") VERB("ret v0") VERB("pop i 1")))); } deftest(reg_init_in_try_and_lp) { (void)make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("try true 1") VERB("ld-reg-d i0 v0") VERB("yrt") VERB("goto 2") VERB("label 1") VERB("ld-imm-i i0 42") VERB("yrt") VERB("label 2") VERB("ld-reg-u v0 i0") VERB("ret v0") VERB("pop i 1")))); } deftest(yrt_at_end_of_function) { (void)make_xcode_fun( VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("try true 1") VERB("yrt") VERB("ret v0") VERB("label 1") VERB("yrt")))); } deftest(negative_struct_ref) { xcode_fail_with( "X9007", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-new-s v0 -1 true")))); } deftest(oob_struct_ref) { xcode_fail_with( "X9007", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-new-s v0 99 true")))); } deftest(struct_ref_to_non_struct) { xcode_fail_with( "X9008", VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-new-s v0 0 true")))); } #define STRUCT_FOO(body) VERB("decl-sxt true [[struct foo] " body "]") deftest(tail_ref_to_struct_with_no_fields) { xcode_fail_with( "X9008", STRUCT_FOO("") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("ld-imm-i i0 0") VERB("S-new-st v0 0 i0 true") VERB("pop i 1")))); } deftest(tail_ref_to_struct_with_non_tail) { xcode_fail_with( "X9008", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("ld-imm-i i0 0") VERB("S-new-st v0 0 i0 true") VERB("pop i 1")))); } deftest(tail_ref_to_struct_with_tail) { (void)make_xcode_ok( STRUCT_FOO("[tail [[struct bar]] t]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("ld-imm-i i0 0") VERB("S-new-st v0 0 i0 true") VERB("pop i 1")))); } deftest(negative_struct_field_ref) { xcode_fail_with( "X9017", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-v-st v0 0 -1 v0 false")))); } deftest(oob_struct_field_ref) { xcode_fail_with( "X9017", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-v-st v0 0 99 v0 false")))); } deftest(int_ref_to_non_int_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("S-i-ld i0 v0 0 0 false") VERB("pop i 1")))); } deftest(real_ref_to_non_real_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-r-ld v0 v0 0 0 false")))); } deftest(value_ref_to_non_value_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[hybrid FILE* v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-v-ld v0 v0 0 0 false")))); } deftest(ph_ref_to_non_ph_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-p-ld v0 v0 0 0 false")))); } deftest(ph_ref_to_pointer_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[ptr FILE* true v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-p-ld v0 v0 0 0 false")))); } deftest(ph_ref_to_hybrid_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[hybrid FILE* v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-p-ld v0 v0 0 0 false")))); } deftest(hybrid_ref_to_non_hybrid_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[ptr FILE* false v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("S-hy-intp i0 v0 0 0 false") VERB("pop i 1")))); } deftest(composite_ref_to_noncomposite_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-gfp v0 v0 0 0")))); } deftest(composite_ref_to_compose_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[compose [[struct bar]] v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-gfp v0 v0 0 0")))); } deftest(composite_ref_to_array_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[array [[struct bar]] 1 v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-gfp v0 v0 0 0")))); } deftest(composite_ref_to_tail_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[tail [[struct bar]] v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-gfp v0 v0 0 0")))); } deftest(atomic_int_ref_to_non_int_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[value v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("S-ia-ld i0 v0 0 0 true seqcst") VERB("pop i 1")))); } deftest(atomic_int_ref_to_nonatomic_int_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[int word true false 15 native v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("S-ia-ld i0 v0 0 0 true seqcst") VERB("pop i 1")))); } deftest(atomic_int_ref_to_atomic_int_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[int word true true 15 native v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("push i 1") VERB("S-ia-ld i0 v0 0 0 true seqcst") VERB("pop i 1")))); } deftest(atomic_ptr_ref_to_nonptr_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[hybrid FILE* v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-pa-ld v0 v0 0 0 true seqcst")))); } deftest(atomic_ptr_ref_to_nonatomic_ptr_struct_field) { xcode_fail_with( "X9018", STRUCT_FOO("[ptr FILE* false v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-pa-ld v0 v0 0 0 true seqcst")))); } deftest(atomic_ptr_ref_to_atomic_ptr_struct_field) { (void)make_xcode_ok( STRUCT_FOO("[ptr FILE* true v]") VERB(FUN_FOO ONE_ARG NO_VAR VERB( VERB("S-pa-ld v0 v0 0 0 true seqcst")))); }
25.537559
79
0.588243
07e0c8277b840d42dbc7ec30dc09d2e7eed87e15
718
h
C
utility/ino-file.h
fabricocouto/libembroidery
281d7f076303630233e3a7359b2b22b51d87fce9
[ "Zlib" ]
null
null
null
utility/ino-file.h
fabricocouto/libembroidery
281d7f076303630233e3a7359b2b22b51d87fce9
[ "Zlib" ]
null
null
null
utility/ino-file.h
fabricocouto/libembroidery
281d7f076303630233e3a7359b2b22b51d87fce9
[ "Zlib" ]
null
null
null
/*! @file ino-file.h */ #ifndef INO_FILE_H #define INO_FILE_H #ifdef __cplusplus extern "C" { #endif typedef struct InoFile_ InoFile; typedef InoFile EmbFile; InoFile* inoFile_open(const char* fileName, const char* mode); int inoFile_close(InoFile* stream); int inoFile_eof(InoFile* stream); int inoFile_getc(InoFile* stream); int inoFile_seek(InoFile* stream, long offset, int origin); long inoFile_tell(InoFile* stream); InoFile* inoFile_tmpfile(void); int inoFile_putc(int ch, InoFile* stream); int inoFile_printf(InoFile* stream, const char* msg); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* INO_FILE_H */ /* kate: bom off; indent-mode cstyle; indent-width 4; replace-trailing-space-save on; */
23.933333
88
0.754875
c414f905565de8f91fee22c3be75b3464d95339e
2,978
h
C
include/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.h
lukhnos/objclucene
29c7189a0b30ab3d3dd4c8ed148235ee296128b7
[ "MIT" ]
9
2016-01-13T05:38:05.000Z
2020-06-04T23:05:03.000Z
include/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.h
lukhnos/objclucene
29c7189a0b30ab3d3dd4c8ed148235ee296128b7
[ "MIT" ]
4
2016-05-12T10:40:53.000Z
2016-06-11T19:08:33.000Z
include/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.h
lukhnos/objclucene
29c7189a0b30ab3d3dd4c8ed148235ee296128b7
[ "MIT" ]
5
2016-01-13T05:37:39.000Z
2019-07-27T16:53:10.000Z
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: ./analysis/common/src/java/org/apache/lucene/analysis/ar/ArabicStemFilterFactory.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_OrgApacheLuceneAnalysisArArabicStemFilterFactory") #ifdef RESTRICT_OrgApacheLuceneAnalysisArArabicStemFilterFactory #define INCLUDE_ALL_OrgApacheLuceneAnalysisArArabicStemFilterFactory 0 #else #define INCLUDE_ALL_OrgApacheLuceneAnalysisArArabicStemFilterFactory 1 #endif #undef RESTRICT_OrgApacheLuceneAnalysisArArabicStemFilterFactory #if __has_feature(nullability) #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wnullability" #pragma GCC diagnostic ignored "-Wnullability-completeness" #endif #if !defined (OrgApacheLuceneAnalysisArArabicStemFilterFactory_) && (INCLUDE_ALL_OrgApacheLuceneAnalysisArArabicStemFilterFactory || defined(INCLUDE_OrgApacheLuceneAnalysisArArabicStemFilterFactory)) #define OrgApacheLuceneAnalysisArArabicStemFilterFactory_ #define RESTRICT_OrgApacheLuceneAnalysisUtilTokenFilterFactory 1 #define INCLUDE_OrgApacheLuceneAnalysisUtilTokenFilterFactory 1 #include "org/apache/lucene/analysis/util/TokenFilterFactory.h" @class OrgApacheLuceneAnalysisArArabicStemFilter; @class OrgApacheLuceneAnalysisTokenStream; @protocol JavaUtilMap; /*! @brief Factory for <code>ArabicStemFilter</code>. <pre class="prettyprint"> &lt;fieldType name="text_arstem" class="solr.TextField" positionIncrementGap="100"&gt; &lt;analyzer&gt; &lt;tokenizer class="solr.StandardTokenizerFactory"/&gt; &lt;filter class="solr.ArabicNormalizationFilterFactory"/&gt; &lt;filter class="solr.ArabicStemFilterFactory"/&gt; &lt;/analyzer&gt; &lt;/fieldType&gt; @endcode */ @interface OrgApacheLuceneAnalysisArArabicStemFilterFactory : OrgApacheLuceneAnalysisUtilTokenFilterFactory #pragma mark Public /*! @brief Creates a new ArabicStemFilterFactory */ - (instancetype __nonnull)initWithJavaUtilMap:(id<JavaUtilMap>)args; - (OrgApacheLuceneAnalysisArArabicStemFilter *)createWithOrgApacheLuceneAnalysisTokenStream:(OrgApacheLuceneAnalysisTokenStream *)input; @end J2OBJC_EMPTY_STATIC_INIT(OrgApacheLuceneAnalysisArArabicStemFilterFactory) FOUNDATION_EXPORT void OrgApacheLuceneAnalysisArArabicStemFilterFactory_initWithJavaUtilMap_(OrgApacheLuceneAnalysisArArabicStemFilterFactory *self, id<JavaUtilMap> args); FOUNDATION_EXPORT OrgApacheLuceneAnalysisArArabicStemFilterFactory *new_OrgApacheLuceneAnalysisArArabicStemFilterFactory_initWithJavaUtilMap_(id<JavaUtilMap> args) NS_RETURNS_RETAINED; FOUNDATION_EXPORT OrgApacheLuceneAnalysisArArabicStemFilterFactory *create_OrgApacheLuceneAnalysisArArabicStemFilterFactory_initWithJavaUtilMap_(id<JavaUtilMap> args); J2OBJC_TYPE_LITERAL_HEADER(OrgApacheLuceneAnalysisArArabicStemFilterFactory) #endif #if __has_feature(nullability) #pragma clang diagnostic pop #endif #pragma pop_macro("INCLUDE_ALL_OrgApacheLuceneAnalysisArArabicStemFilterFactory")
39.706667
199
0.860645
895a87278b8e5226e42d38679586c82c73e6653d
2,516
h
C
includes/shm_queue.h
haeckir91/smelt-consensus
7260397b329509c0202e2a6eafe12f3c96149847
[ "MIT" ]
1
2021-05-19T17:05:07.000Z
2021-05-19T17:05:07.000Z
includes/shm_queue.h
haeckir91/smelt-consensus
7260397b329509c0202e2a6eafe12f3c96149847
[ "MIT" ]
1
2020-07-27T15:22:20.000Z
2020-07-27T15:22:20.000Z
includes/shm_queue.h
haeckir91/smelt-consensus
7260397b329509c0202e2a6eafe12f3c96149847
[ "MIT" ]
null
null
null
/** * \file * \brief Interface for a shared memory queue */ /* * Copyright (c) 2015, ETH Zurich. * All rights reserved. * * This file is distributed under the terms in the attached LICENSE file. * If you do not find this file, copies can be found by writing to: * ETH Zurich D-INFK, CAB F.78, Universitaetstr. 6, CH-8092 Zurich, * Attn: Systems Group. */ #ifndef _shm_queue_h #define _shm_queue_h 1 #include <stdio.h> #include <stdint.h> #include <stdbool.h> #include <pthread.h> //#define DEBUG_SHM /** * \brief initializing a shared memory queue writer * * \param replica_id for multiple instances of this SHM queue, the replica_id prevents * these isntances to communicate with each other. In the consensus implementatio * used for differentiating between nodes * \param current_core the core on which the writer should run * \param num_replicas number of readers for setting up the memory * \param num_clients number of clients that connect to the leader * \param slot_size Size of a slot of the queue * \param shared_mem the shared memory used for the queue * \param node_level Is this writer running on the node level? * \param exec_fn execution function */ void init_shm_writer(uint8_t replica_id, uint8_t current_core, uint8_t num_clients, uint8_t num_replicas, uint64_t slot_size, bool node_level, void* shared_mem, void (*exec_fn)(void *)); /** * \brief initializing a shared memory queue reader * * \param id the readers id * \param current_core the core on which the writer should be started * \param num_replicas the number of replicas (require for setting up the shared * memory) * \param slot_size the size of the slots of the queue * \param node_level Is this reader running on the node level? * \param started_from the replica id which started the readers * \param shared_mem the shared memory used for the queue * \param exec_fn execution function */ void init_shm_reader(uint8_t id, uint8_t current_core, uint8_t num_replicas, uint64_t slot_size, bool node_level, uint8_t started_from, void* shared_mem, void (*exec_fn)(void* addr)); void shm_write(void* addr); void* shm_read(void); void set_execution_fn_shm(void (*execute)(void * addr)); void poll_and_execute(void); #endif // _shm_queue_h
32.675325
86
0.677266
3751653c6db18e1a29f07dc754aaaa0186aacbf8
726
h
C
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APMetalContext.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
5
2020-03-29T12:08:37.000Z
2021-05-26T05:20:11.000Z
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APMetalContext.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
null
null
null
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APMetalContext.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 <objc/NSObject.h> @protocol MTLCommandQueue, MTLDevice, MTLLibrary; @interface APMetalContext : NSObject { id <MTLDevice> _device; id <MTLLibrary> _library; id <MTLCommandQueue> _commandQueue; } + (id)newContext; @property(retain) id <MTLCommandQueue> commandQueue; // @synthesize commandQueue=_commandQueue; @property(retain) id <MTLLibrary> library; // @synthesize library=_library; @property(retain) id <MTLDevice> device; // @synthesize device=_device; - (void).cxx_destruct; - (id)initWithDevice:(id)arg1; @end
26.888889
95
0.720386
0a98204bdc04d1b96dd721fcca7ad68e82d49ae0
9,666
h
C
StripLights_v2_3/API/SLights.h
dogtopus/StripLightLib.cylib
b0eb2679a8ff212e1c59180eddbe574b1393f7dd
[ "Xnet", "X11" ]
1
2020-09-26T22:35:26.000Z
2020-09-26T22:35:26.000Z
StripLights_v2_3/API/SLights.h
dogtopus/StripLightLib.cylib
b0eb2679a8ff212e1c59180eddbe574b1393f7dd
[ "Xnet", "X11" ]
null
null
null
StripLights_v2_3/API/SLights.h
dogtopus/StripLightLib.cylib
b0eb2679a8ff212e1c59180eddbe574b1393f7dd
[ "Xnet", "X11" ]
null
null
null
/* ======================================== * * Strip Light Controller * By Mark Hastings * * 05/27/2013 v1.0 Mark Hastings Initial working version * * ======================================== */ #if (!defined(CY_SLIGHTS_`$INSTANCE_NAME`_H)) #define CY_SLIGHTS_`$INSTANCE_NAME`_H #include "cytypes.h" #include "cyfitter.h" /* Function Prototypes - API */ void `$INSTANCE_NAME`_Start(void); void `$INSTANCE_NAME`_Stop(void); void `$INSTANCE_NAME`_WriteColor(uint32 color); void `$INSTANCE_NAME`_DisplayClear(uint32 color); void `$INSTANCE_NAME`_MemClear(uint32 color); void `$INSTANCE_NAME`_Trigger(uint32 rst); uint32 `$INSTANCE_NAME`_Ready(void); void `$INSTANCE_NAME`_DrawRect(int32 x0, int32 y0, int32 x1, int32 y1, int32 fill, uint32 color); void `$INSTANCE_NAME`_DrawLine(int32 x0, int32 y0, int32 x1, int32 y1, uint32 color); void `$INSTANCE_NAME`_DrawCircle (int32 x0, int32 y0, int32 radius, uint32 color); void `$INSTANCE_NAME`_Pixel(int32 x, int32 y, uint32 color); uint32 `$INSTANCE_NAME`_GetPixel(int32 x, int32 y); uint32 `$INSTANCE_NAME`_ColorInc(uint32 incValue); void `$INSTANCE_NAME`_Dim(uint32 dimLevel); #define `$INSTANCE_NAME`_DimLevel_0 0 #define `$INSTANCE_NAME`_DimLevel_1 1 #define `$INSTANCE_NAME`_DimLevel_2 2 #define `$INSTANCE_NAME`_DimLevel_3 3 #define `$INSTANCE_NAME`_DimLevel_4 4 /* Function Prototypes - ISR */ #if `$INSTANCE_NAME`_TRANSFER == `$INSTANCE_NAME`_TRANSFER_ISR #define `$INSTANCE_NAME`_CIRQ_Enable() CyIntEnable(`$INSTANCE_NAME`_CIRQ__INTC_NUMBER ); #define `$INSTANCE_NAME`_CIRQ_Disable() CyIntDisable(`$INSTANCE_NAME`_CIRQ__INTC_NUMBER ); CY_ISR_PROTO(`$INSTANCE_NAME`_CISR); #define `$INSTANCE_NAME`_FIRQ_Enable() CyIntEnable(`$INSTANCE_NAME`_FIRQ__INTC_NUMBER ); #define `$INSTANCE_NAME`_FIRQ_Disable() CyIntDisable(`$INSTANCE_NAME`_FIRQ__INTC_NUMBER ); CY_ISR_PROTO(`$INSTANCE_NAME`_FISR); #elif `$INSTANCE_NAME`_TRANSFER == `$INSTANCE_NAME`_TRANSFER_DMA #define `$INSTANCE_NAME`_CIRQ_Enable() CyIntEnable(`$INSTANCE_NAME`_CIRQ__INTC_NUMBER ); #define `$INSTANCE_NAME`_CIRQ_Disable() CyIntDisable(`$INSTANCE_NAME`_CIRQ__INTC_NUMBER ); CY_ISR_PROTO(`$INSTANCE_NAME`_CISR); #endif /* Register Definitions */ #define `$INSTANCE_NAME`_DATA (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_dshifter_u0__F0_REG) #define `$INSTANCE_NAME`_DATA_PTR ((reg8 *) `$INSTANCE_NAME`_B_WS2811_dshifter_u0__F0_REG) #define `$INSTANCE_NAME`_CONTROL (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_ctrl__CONTROL_REG) #define `$INSTANCE_NAME`_STATUS (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_StatusReg__STATUS_REG) #define `$INSTANCE_NAME`_Period (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__F0_REG) #define `$INSTANCE_NAME`_Period_PTR ((reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__F0_REG) #define `$INSTANCE_NAME`_Compare0 (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__D0_REG) #define `$INSTANCE_NAME`_Compare1 (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__D1_REG) #define `$INSTANCE_NAME`_Period2 (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__F1_REG) #define `$INSTANCE_NAME`_Period2_PTR ((reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__F1_REG) #define `$INSTANCE_NAME`_ACTL0_REG (*(reg8 *) `$INSTANCE_NAME`_B_WS2811_pwm8_u0__DP_AUX_CTL_REG) #define `$INSTANCE_NAME`_DISABLE_FIFO 0x03 #define `$INSTANCE_NAME`_Channel (*(reg8 *) `$INSTANCE_NAME`_StringSel_Sync_ctrl_reg__CONTROL_REG) #define `$INSTANCE_NAME`_Channel_PTR ((reg8 *) `$INSTANCE_NAME`_StringSel_Sync_ctrl_reg__CONTROL_REG) /* Status Register Constants */ #define `$INSTANCE_NAME`_FIFO_EMPTY 0x01 #define `$INSTANCE_NAME`_FIFO_NOT_FULL 0x02 #define `$INSTANCE_NAME`_STATUS_ENABLE 0x80 #define `$INSTANCE_NAME`_STATUS_XFER_CMPT 0x40 /* Control Register Constants */ #define `$INSTANCE_NAME`_ENABLE 0x01 #define `$INSTANCE_NAME`_DISABLE 0x00 #define `$INSTANCE_NAME`_RESTART 0x02 #define `$INSTANCE_NAME`_CNTL 0x04 #define `$INSTANCE_NAME`_FIFO_IRQ_EN 0x08 #define `$INSTANCE_NAME`_XFRCMPT_IRQ_EN 0x10 #define `$INSTANCE_NAME`_ALL_IRQ_EN 0x18 #define `$INSTANCE_NAME`_NEXT_ROW 0x20 #define `$INSTANCE_NAME`_TRANSFER `$Transfer_Method` #define `$INSTANCE_NAME`_TRANSFER_FIRMWARE 0 #define `$INSTANCE_NAME`_TRANSFER_ISR 1 #define `$INSTANCE_NAME`_TRANSFER_DMA 2 #define `$INSTANCE_NAME`_DMA_STRAT `$DMAStrategy` #define `$INSTANCE_NAME`_DMA_STRAT_PER_LED 0 #define `$INSTANCE_NAME`_DMA_STRAT_ALL 1 #define `$INSTANCE_NAME`_SPEED `$SPEED` #define `$INSTANCE_NAME`_SPEED_400KHZ 0 #define `$INSTANCE_NAME`_SPEED_800KHZ 1 #define `$INSTANCE_NAME`_MEMORY_TYPE `$Display_Memory` #define `$INSTANCE_NAME`_MEMORY_RGB 0 #define `$INSTANCE_NAME`_MEMORY_LUT 1 #if (CY_PSOC3 || CY_PSOC5LP) #define `$INSTANCE_NAME`_PERIOD ((BCLK__BUS_CLK__KHZ)/`$ClockSpeedKhz`) #elif (CY_PSOC4) #define `$INSTANCE_NAME`_PERIOD ((CYDEV_BCLK__HFCLK__KHZ)/`$ClockSpeedKhz`) #endif /* CY_PSOC5A */ #define `$INSTANCE_NAME`_DATA_ZERO ((`$INSTANCE_NAME`_PERIOD * 20)/25) #define `$INSTANCE_NAME`_DATA_ONE ((`$INSTANCE_NAME`_PERIOD * 12)/25) #if (`$INSTANCE_NAME`_SPEED_800KHZ) #define `$INSTANCE_NAME`_BYTE_TIME_US 10u #define `$INSTANCE_NAME`_WORD_TIME_US 30u #else #define `$INSTANCE_NAME`_BYTE_TIME_US 20u #define `$INSTANCE_NAME`_WORD_TIME_US 60u #endif #define `$INSTANCE_NAME`_COLUMNS `$LEDs_per_Strip` #define `$INSTANCE_NAME`_ROWS `$Channels` #define `$INSTANCE_NAME`_TOTAL_LEDS (`$INSTANCE_NAME`_COLUMNS*`$INSTANCE_NAME`_ROWS) #define `$INSTANCE_NAME`_ARRAY_COLS (int32)(`$LEDs_per_Strip`) #define `$INSTANCE_NAME`_ARRAY_ROWS (int32)(`$Channels`) #define `$INSTANCE_NAME`_CHIP (`$WS281x_Type`) #define `$INSTANCE_NAME`_CHIP_WS2811 1 #define `$INSTANCE_NAME`_CHIP_WS2812 2 #define `$INSTANCE_NAME`_MIN_X (int32)0u #define `$INSTANCE_NAME`_MAX_X (int32)(`$INSTANCE_NAME`_COLUMNS - 1) #define `$INSTANCE_NAME`_MIN_Y (int32)0u #define `$INSTANCE_NAME`_MAX_Y (int32)(`$INSTANCE_NAME`_ROWS - 1) //#define `$INSTANCE_NAME`_RBCOLORS 48 #define `$INSTANCE_NAME`_COLOR_WHEEL_SIZE 24 #if(`$INSTANCE_NAME`_CHIP == `$INSTANCE_NAME`_CHIP_WS2812) #define `$INSTANCE_NAME`_RED_MASK 0x0000FF00 #define `$INSTANCE_NAME`_GREEN_MASK 0x000000FF #define `$INSTANCE_NAME`_BLUE_MASK 0x00FF0000 #else #define `$INSTANCE_NAME`_RED_MASK 0x000000FF #define `$INSTANCE_NAME`_GREEN_MASK 0x0000FF00 #define `$INSTANCE_NAME`_BLUE_MASK 0x00FF0000 #endif #if(`$INSTANCE_NAME`_MEMORY_TYPE == `$INSTANCE_NAME`_MEMORY_RGB) #define `$INSTANCE_NAME`_getColor( a ) `$INSTANCE_NAME`_CLUT[a] #else /* Else use lookup table */ #define `$INSTANCE_NAME`_getColor( a ) a #endif #define `$INSTANCE_NAME`_CWHEEL_SIZE 24 #define `$INSTANCE_NAME`_YELLOW `$INSTANCE_NAME`_getColor(1) #define `$INSTANCE_NAME`_GREEN `$INSTANCE_NAME`_getColor((70 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_ORANGE `$INSTANCE_NAME`_getColor(20) #define `$INSTANCE_NAME`_BLACK `$INSTANCE_NAME`_getColor((0 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_OFF `$INSTANCE_NAME`_getColor((0 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_LTBLUE `$INSTANCE_NAME`_getColor((1 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_MBLUE `$INSTANCE_NAME`_getColor((2 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_BLUE `$INSTANCE_NAME`_getColor((3 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_LTGREEN `$INSTANCE_NAME`_getColor((4 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_MGREEN `$INSTANCE_NAME`_getColor((8 + `$INSTANCE_NAME`_CWHEEL_SIZE)) //#define `$INSTANCE_NAME`_GREEN (12 + `$INSTANCE_NAME`_CWHEEL_SIZE) #define `$INSTANCE_NAME`_LTRED `$INSTANCE_NAME`_getColor((16 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_LTYELLOW `$INSTANCE_NAME`_getColor((20 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_MGRED `$INSTANCE_NAME`_getColor((32 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_RED `$INSTANCE_NAME`_getColor((48 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_MAGENTA `$INSTANCE_NAME`_getColor((51 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_WHITE `$INSTANCE_NAME`_getColor((63 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_SPRING_GREEN `$INSTANCE_NAME`_getColor((64 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_TURQUOSE `$INSTANCE_NAME`_getColor((65 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_CYAN `$INSTANCE_NAME`_getColor((66 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_OCEAN `$INSTANCE_NAME`_getColor((67 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_VIOLET `$INSTANCE_NAME`_getColor((68 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_RASPBERRY `$INSTANCE_NAME`_getColor((69 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_DIM_WHITE `$INSTANCE_NAME`_getColor((71 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_DIM_BLUE `$INSTANCE_NAME`_getColor((72 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_INVISIBLE `$INSTANCE_NAME`_getColor((73 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_COLD_TEMP `$INSTANCE_NAME`_getColor((80 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_HOT_TEMP `$INSTANCE_NAME`_getColor((95 + `$INSTANCE_NAME`_CWHEEL_SIZE)) #define `$INSTANCE_NAME`_CLUT_SIZE (96 + `$INSTANCE_NAME`_CWHEEL_SIZE) #define `$INSTANCE_NAME`_RESET_DELAY_US 55 #endif /* CY_SLIGHTS_`$INSTANCE_NAME`_H */ //[] END OF FILE
45.380282
103
0.743948
0aace29a6fc919a3097e9e4ec1d30bbb64d32002
7,847
c
C
io.c
CTSRD-CHERI/sqlbox
b2afe81525d694176c8dcdd5a59e0effce58be39
[ "0BSD" ]
8
2019-10-15T14:43:17.000Z
2021-07-31T22:03:19.000Z
io.c
CTSRD-CHERI/sqlbox
b2afe81525d694176c8dcdd5a59e0effce58be39
[ "0BSD" ]
null
null
null
io.c
CTSRD-CHERI/sqlbox
b2afe81525d694176c8dcdd5a59e0effce58be39
[ "0BSD" ]
3
2020-02-27T09:58:12.000Z
2020-06-08T17:30:43.000Z
/* $Id$ */ /* * Copyright (c) 2019 Kristaps Dzonsons <kristaps@bsd.lv> * * 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 AUTHORS DISCLAIM ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS 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 "config.h" #if HAVE_SYS_QUEUE # include <sys/queue.h> #endif #include <sys/socket.h> #include COMPAT_ENDIAN_H #include <assert.h> #include <poll.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <sqlite3.h> #include "sqlbox.h" #include "extern.h" /* * This is called by both the client and the server, so it can't contain * any specifities. * Simply performs a blocking write of the sized buffer, which must not * be zero-length. * Returns FALSE on failure, TRUE on success. */ int sqlbox_write(struct sqlbox *box, const char *buf, size_t sz) { struct pollfd pfd = { .fd = box->fd, .events = POLLOUT }; ssize_t wsz; size_t tsz = 0; int rc = 0, fl = 0; #ifdef MSG_NOSIGNAL fl = MSG_NOSIGNAL; #endif /* MSG_NOSIGNAL */ for (;;) { if (poll(&pfd, 1, INFTIM) == -1) { sqlbox_warn(&box->cfg, "ppoll (write)"); break; } else if ((pfd.revents & (POLLNVAL|POLLERR))) { sqlbox_warnx(&box->cfg, "ppoll (write): nval"); break; } else if ((pfd.revents & POLLHUP)) { sqlbox_warnx(&box->cfg, "ppoll (write): hangup"); break; } else if (!(POLLOUT & pfd.revents)) { sqlbox_warnx(&box->cfg, "ppoll (write): bad revent"); break; } /* * Use send(2) with MSG_NOSIGNAL instead of write(2) because we * can avoid masking SIGPIPE in the event that the child closes * its part of the socket *after* the poll(2), above. */ wsz = send(pfd.fd, buf + tsz, sz - tsz, fl); if (wsz == -1) { sqlbox_warn(&box->cfg, "send"); return 0; } else if ((tsz += wsz) == sz) { rc = 1; break; } } return rc; } /* * Called by the client only, so it doesn't respond to end of file in * any but erroring out. * Performs a non-blocking read of the sized buffer, which must not be * zero-length. * Returns FALSE on failure, TRUE on success. */ int sqlbox_read(struct sqlbox *box, char *buf, size_t sz) { struct pollfd pfd = { .fd = box->fd, .events = POLLIN }; ssize_t rsz; size_t tsz = 0; assert(sz > 0); /* * On most systems (OpenBSD, FreeBSD, Linux, etc.), poll(2) sets * POLLHUP when the descriptor closes. * On SunOS, however, POLLIN is returned with an EOF returned by the * read(2). */ for (;;) { if (poll(&pfd, 1, INFTIM) == -1) { sqlbox_warn(&box->cfg, "ppoll (read)"); return 0; } else if ((pfd.revents & (POLLNVAL|POLLERR))) { sqlbox_warnx(&box->cfg, "poll (read): nval"); return 0; } else if ((pfd.revents & POLLHUP)) { sqlbox_warnx(&box->cfg, "poll (read): hangup"); return 0; } else if (!(POLLIN & pfd.revents)) { sqlbox_warnx(&box->cfg, "poll (read): bad revent"); return 0; } if ((rsz = read(pfd.fd, buf + tsz, sz - tsz)) == -1) { sqlbox_warn(&box->cfg, "read"); return 0; } else if (rsz == 0) { sqlbox_warnx(&box->cfg, "read: eof"); return 0; } else if ((tsz += rsz) == sz) break; } return 1; } /* * Read a single frame, which is of size at least the baseline frame. * The frame is set in "frame" and is of length "framesz", both of which * are initialised to NULL and 0, respectively. * Return <0 on failure, 0 on EOF without data, >0 on success. */ int sqlbox_read_frame(struct sqlbox *box, char **buf, size_t *bufsz, const char **frame, size_t *framesz) { struct pollfd pfd = { .fd = box->fd, .events = POLLIN }; ssize_t rsz; size_t sz = 0, bsz; void *pp; *frame = NULL; *framesz = 0; /* * We want to read at least a frame size of data. * Frame sizes are SQLBOX_FRAME bytes. */ bsz = SQLBOX_FRAME; if (*bufsz == 0) { assert(*buf == NULL); if ((*buf = malloc(bsz)) == NULL) { sqlbox_warn(&box->cfg, "malloc"); return -1; } *bufsz = bsz; } assert(*bufsz >= bsz); /* * Start by reading the frame basis, which is always of size * SQLBOX_FRAME bytes. * This will also contain the real size of the frame, which, if * greater than 1020 bytes, will involve the reading of * subsequent frames. */ while (sz < bsz) { if (poll(&pfd, 1, INFTIM) == -1) { sqlbox_warn(&box->cfg, "ppoll"); return -1; } else if ((pfd.revents & (POLLNVAL|POLLERR))) { sqlbox_warnx(&box->cfg, "ppoll: nval"); return -1; } else if ((pfd.revents & POLLHUP) && !(pfd.revents & POLLIN)) { sqlbox_warnx(&box->cfg, "ppoll: hup"); break; } else if (!(POLLIN & pfd.revents)) { sqlbox_warnx(&box->cfg, "ppoll: bad event"); return -1; } rsz = read(pfd.fd, *buf + sz, bsz - sz); if (rsz == -1) { sqlbox_warn(&box->cfg, "read"); return -1; } else if (rsz == 0 && sz == 0) { return 0; } else if (rsz == 0) break; /* * Make sure we've read the entire initial frame. * The whole point is that it should come in one packet, * so warn here if it doesn't. */ if ((sz += rsz) < bsz) sqlbox_warnx(&box->cfg, "read: frame basis " "fragmented (%zd B < %zu B)", rsz, bsz); } if (sz < bsz) { sqlbox_warnx(&box->cfg, "read: eof with " "unfinished frame(%zu B < %zu B)", sz, bsz); return -1; } /* * Reallocate the extended buffer, if necessary. * Remember that the frame size does NOT include the size of the * frame size integer. */ *framesz = le32toh(*(uint32_t *)*buf); bsz = *framesz + sizeof(uint32_t); if (bsz > *bufsz) { if ((pp = realloc(*buf, bsz)) == NULL) { sqlbox_warn(&box->cfg, "realloc"); return -1; } *buf = pp; *bufsz = bsz; } *frame = *buf + sizeof(uint32_t); /* Everything was in the first frame. */ if (bsz <= SQLBOX_FRAME) return 1; /* Now read the rest of the frame. */ while (sz < bsz) { if (poll(&pfd, 1, INFTIM) == -1) { sqlbox_warn(&box->cfg, "ppoll"); return -1; } else if ((pfd.revents & (POLLNVAL|POLLERR))) { sqlbox_warnx(&box->cfg, "ppoll: nval"); return -1; } else if ((pfd.revents & POLLHUP) && !(pfd.revents & POLLIN)) { sqlbox_warnx(&box->cfg, "ppoll: hup"); break; } else if (!(POLLIN & pfd.revents)) { sqlbox_warnx(&box->cfg, "ppoll: bad event"); return -1; } rsz = read(pfd.fd, *buf + sz, bsz - sz); if (rsz == -1) { sqlbox_warn(&box->cfg, "read"); return -1; } else if (rsz == 0) { sqlbox_warnx(&box->cfg, "read: eof"); return -1; } sz += rsz; } return 1; } /* * Write a buffer "buf" of length "sz" into a frame of type "op". * FIXME: for the time being, "sz" must fit in SQLBOX_FRAME - 8 bytes * (the latter for 2 32-bit integers). * Return TRUE on success, FALSE on failure. */ int sqlbox_write_frame(struct sqlbox *box, enum sqlbox_op op, const char *buf, size_t sz) { char frame[SQLBOX_FRAME]; uint32_t tmp; memset(frame, 0, sizeof(frame)); /* Account for operation... */ tmp = htole32(sz + sizeof(uint32_t)); memcpy(frame, &tmp, sizeof(uint32_t)); tmp = htole32(op); memcpy(frame + sizeof(uint32_t), &tmp, sizeof(uint32_t)); assert(sz <= SQLBOX_FRAME - sizeof(uint32_t) * 2); memcpy(frame + sizeof(uint32_t) * 2, buf, sz); return sqlbox_write(box, frame, sizeof(frame)); }
24.832278
75
0.619855
fd75f6bc8b105aa25b2efa3314e22a16001b06b9
30,008
h
C
RegistryRT/Registry.h
IstvanKor/WinverUWP
d2eb4c135bf8a3f5a4431325e811321283702e77
[ "MIT" ]
95
2021-09-24T02:46:59.000Z
2022-03-28T10:27:38.000Z
RegistryRT/Registry.h
IstvanKor/WinverUWP
d2eb4c135bf8a3f5a4431325e811321283702e77
[ "MIT" ]
21
2021-11-22T15:31:44.000Z
2022-03-25T19:30:56.000Z
RegistryRT/Registry.h
Surfndez/WinverUWP
8eb8f22c0a08fb5ddcb25f30e0b3e9aa79d17ae3
[ "MIT" ]
39
2021-10-08T13:55:02.000Z
2022-03-27T13:42:24.000Z
/* MIT License Copyright (c) 2019 Gustave Monce - @gus33000 - gus33000.me Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #pragma once #include <collection.h> #include <windows.h> namespace RegistryRT { public enum class RegistryType { None = REG_NONE, String = REG_SZ, VariableString = REG_EXPAND_SZ, Binary = REG_BINARY, Integer = REG_DWORD, IntegerBigEndian = REG_DWORD_BIG_ENDIAN, SymbolicLink = REG_LINK, MultiString = REG_MULTI_SZ, ResourceList = REG_RESOURCE_LIST, HardwareResourceList = REG_FULL_RESOURCE_DESCRIPTOR, ResourceRequirement = REG_RESOURCE_REQUIREMENTS_LIST, Long = REG_QWORD }; #undef HKEY_CLASSES_ROOT #undef HKEY_CURRENT_USER #undef HKEY_LOCAL_MACHINE #undef HKEY_USERS #undef HKEY_CURRENT_CONFIG #undef HKEY_CURRENT_USER_LOCAL_SETTINGS public enum class RegistryHive { HKEY_CLASSES_ROOT, HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_CONFIG, HKEY_CURRENT_USER_LOCAL_SETTINGS }; typedef DWORD ULONG; typedef WORD USHORT, *USHORT_PTR; typedef ULONG NTSTATUS, *PNTSTATUS; typedef ULONG ACCESS_MASK, *PACCESS_MASK; #define FILE_SUPERSEDE 0x00000000 #define FILE_OPEN 0x00000001 #define FILE_CREATE 0x00000002 #define FILE_OPEN_IF 0x00000003 #define FILE_OVERWRITE 0x00000004 #define FILE_OVERWRITE_IF 0x00000005 #define FILE_MAXIMUM_DISPOSITION 0x00000005 #define ERROR_FUNCTION_FAILED 1627L #define FILE_DIRECTORY_FILE 0x00000001 #define FILE_WRITE_THROUGH 0x00000002 #define FILE_SEQUENTIAL_ONLY 0x00000004 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 #define FILE_NON_DIRECTORY_FILE 0x00000040 #define FILE_CREATE_TREE_CONNECTION 0x00000080 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100 #define FILE_NO_EA_KNOWLEDGE 0x00000200 #define FILE_OPEN_FOR_RECOVERY 0x00000400 #define FILE_RANDOM_ACCESS 0x00000800 #define FILE_DELETE_ON_CLOSE 0x00001000 #define FILE_OPEN_BY_FILE_ID 0x00002000 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 #define FILE_NO_COMPRESSION 0x00008000 #define FILE_RESERVE_OPFILTER 0x00100000 #define FILE_OPEN_REPARSE_POINT 0x00200000 #define FILE_OPEN_NO_RECALL 0x00400000 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041 #define FILE_STRUCTURED_STORAGE 0x00000441 #define FILE_VALID_OPTION_FLAGS 0x00ffffff #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 #define FILE_VALID_SET_FLAGS 0x00000036 #define STATUS_SUCCESS ((NTSTATUS)0x00000000L) // ntsubauth #define STATUS_BUFFER_OVERFLOW ((NTSTATUS)0x80000005L) #define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL) #define STATUS_ACCESS_DENIED ((NTSTATUS)0xC0000022L) #define STATUS_NO_MORE_ENTRIES ((NTSTATUS)0x8000001AL) #define STATUS_OBJECT_TYPE_MISMATCH ((NTSTATUS)0xC0000024L) #define NT_SUCCESS(Status) ((NTSTATUS)(Status) == STATUS_SUCCESS) #define HKU HKEY_USERS #define HKLM HKEY_LOCAL_MACHINE #define HKCU HKEY_CURRENT_USER #define HKCC HKEY_CURRENT_CONFIG #define HKCR HKEY_CLASSES_ROOT typedef struct _OBJECT_BASIC_INFORMATION { ULONG Attributes; ACCESS_MASK GrantedAccess; ULONG HandleCount; ULONG PointerCount; ULONG PagedPoolUsage; ULONG NonPagedPoolUsage; ULONG Reserved[3]; ULONG NameInformationLength; ULONG TypeInformationLength; ULONG SecurityDescriptorLength; LARGE_INTEGER CreateTime; } OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION; typedef struct _UNICODE_STRING { USHORT Length; USHORT MaximumLength; PWSTR Buffer; } UNICODE_STRING; typedef UNICODE_STRING *PUNICODE_STRING; // InitializeUnicodeStrings (WCHAR wstr, BOOL hidden, UNICODE_STRING* us); #define InitializeUnicodeStrings( wstr, hidden, us ) { \ (us)->Buffer = (PWSTR)wstr; \ (us)->Length = (USHORT)(wcslen((const wchar_t *)wstr) * sizeof(WCHAR)) + (sizeof(WCHAR) * hidden); \ (us)->MaximumLength = (us)->Length+4; \ } typedef struct _STRING { USHORT Length; USHORT MaximumLength; //#ifdef MIDL_PASS // [size_is(MaximumLength), length_is(Length) ] //#endif // MIDL_PASS PCHAR Buffer; } STRING; typedef STRING *PSTRING; typedef STRING OEM_STRING; typedef STRING *POEM_STRING; typedef STRING ANSI_STRING; typedef STRING *PANSI_STRING; typedef struct _KEY_BASIC_INFORMATION { LARGE_INTEGER LastWriteTime;// The last time the key or any of its values changed. ULONG TitleIndex; // Device and intermediate drivers should ignore this member. ULONG NameLength; // The size in bytes of the following name, including the zero-terminating character. WCHAR Name[1]; // A zero-terminated Unicode string naming the key. } KEY_BASIC_INFORMATION; typedef KEY_BASIC_INFORMATION *PKEY_BASIC_INFORMATION; typedef struct _KEY_FULL_INFORMATION { LARGE_INTEGER LastWriteTime;// The last time the key or any of its values changed. ULONG TitleIndex; // Device and intermediate drivers should ignore this member. ULONG ClassOffset; // The offset from the start of this structure to the Class member. ULONG ClassLength; // The number of bytes in the Class name. ULONG SubKeys; // The number of subkeys for the key. ULONG MaxNameLen; // The maximum length of any name for a subkey. ULONG MaxClassLen; // The maximum length for a Class name. ULONG Values; // The number of value entries. ULONG MaxValueNameLen; // The maximum length of any value entry name. ULONG MaxValueDataLen; // The maximum length of any value entry data field. WCHAR Class[1]; // A zero-terminated Unicode string naming the class of the key. } KEY_FULL_INFORMATION; typedef KEY_FULL_INFORMATION *PKEY_FULL_INFORMATION; typedef struct _KEY_NODE_INFORMATION { LARGE_INTEGER LastWriteTime;// The last time the key or any of its values changed. ULONG TitleIndex; // Device and intermediate drivers should ignore this member. ULONG ClassOffset; // The offset from the start of this structure to the Class member. ULONG ClassLength; // The number of bytes in the Class name. ULONG NameLength; // The size in bytes of the following name, including the zero-terminating character. WCHAR Name[1]; // A zero-terminated Unicode string naming the key. } KEY_NODE_INFORMATION; typedef KEY_NODE_INFORMATION *PKEY_NODE_INFORMATION; // end_wdm typedef struct _KEY_NAME_INFORMATION { ULONG NameLength; WCHAR Name[1]; // Variable length string } KEY_NAME_INFORMATION, *PKEY_NAME_INFORMATION; typedef KEY_NAME_INFORMATION *PKEY_NAME_INFORMATION; // begin_wdm typedef enum _KEY_INFORMATION_CLASS { KeyBasicInformation, KeyNodeInformation, KeyFullInformation // end_wdm , KeyNameInformation // begin_wdm } KEY_INFORMATION_CLASS; typedef struct _KEY_WRITE_TIME_INFORMATION { LARGE_INTEGER LastWriteTime; } KEY_WRITE_TIME_INFORMATION; typedef KEY_WRITE_TIME_INFORMATION *PKEY_WRITE_TIME_INFORMATION; typedef enum _KEY_SET_INFORMATION_CLASS { KeyWriteTimeInformation } KEY_SET_INFORMATION_CLASS; typedef struct _KEY_VALUE_BASIC_INFORMATION { ULONG TitleIndex; // Device and intermediate drivers should ignore this member. ULONG Type; // The system-defined type for the registry value in the // Data member (see the values above). ULONG NameLength; // The size in bytes of the following value entry name, // including the zero-terminating character. WCHAR Name[1]; // A zero-terminated Unicode string naming a value entry of // the key. } KEY_VALUE_BASIC_INFORMATION; typedef KEY_VALUE_BASIC_INFORMATION *PKEY_VALUE_BASIC_INFORMATION; typedef struct _KEY_VALUE_FULL_INFORMATION { ULONG TitleIndex; // Device and intermediate drivers should ignore this member. ULONG Type; // The system-defined type for the registry value in the // Data member (see the values above). ULONG DataOffset; // The offset from the start of this structure to the data // immediately following the Name string. ULONG DataLength; // The number of bytes of registry information for the value // entry identified by Name. ULONG NameLength; // The size in bytes of the following value entry name, // including the zero-terminating character. WCHAR Name[1]; // A zero-terminated Unicode string naming a value entry of // the key. // WCHAR Data[1]; // Variable size data not declared } KEY_VALUE_FULL_INFORMATION; typedef KEY_VALUE_FULL_INFORMATION *PKEY_VALUE_FULL_INFORMATION; typedef struct _KEY_VALUE_PARTIAL_INFORMATION { ULONG TitleIndex; // Device and intermediate drivers should ignore this member. ULONG Type; // The system-defined type for the registry value in the // Data member (see the values above). ULONG DataLength; // The size in bytes of the Data member. UCHAR Data[1]; // A value entry of the key. } KEY_VALUE_PARTIAL_INFORMATION; typedef KEY_VALUE_PARTIAL_INFORMATION *PKEY_VALUE_PARTIAL_INFORMATION; typedef struct _KEY_VALUE_ENTRY { PUNICODE_STRING ValueName; ULONG DataLength; ULONG DataOffset; ULONG Type; } KEY_VALUE_ENTRY; typedef KEY_VALUE_ENTRY *PKEY_VALUE_ENTRY; typedef enum _KEY_VALUE_INFORMATION_CLASS { KeyValueBasicInformation, KeyValueFullInformation, KeyValuePartialInformation, } KEY_VALUE_INFORMATION_CLASS; typedef struct _KEY_MULTIPLE_VALUE_INFORMATION { PUNICODE_STRING ValueName; ULONG DataLength; ULONG DataOffset; ULONG Type; } KEY_MULTIPLE_VALUE_INFORMATION; typedef KEY_MULTIPLE_VALUE_INFORMATION *PKEY_MULTIPLE_VALUE_INFORMATION; typedef struct _IO_STATUS_BLOCK { union { NTSTATUS Status; PVOID Pointer; }; ULONG_PTR Information; } IO_STATUS_BLOCK; typedef IO_STATUS_BLOCK *PIO_STATUS_BLOCK; typedef void (NTAPI *PIO_APC_ROUTINE) ( IN PVOID ApcContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG Reserved ); typedef struct _CLIENT_ID { HANDLE UniqueProcess; HANDLE UniqueThread; } CLIENT_ID; typedef CLIENT_ID *PCLIENT_ID; #define OBJ_INHERIT 0x00000002L #define OBJ_PERMANENT 0x00000010L #define OBJ_EXCLUSIVE 0x00000020L #define OBJ_CASE_INSENSITIVE 0x00000040 #define OBJ_OPENIF 0x00000080L #define OBJ_KERNEL_HANDLE 0x00000200L #define OBJ_FORCE_ACCESS_CHECK 0x00000400L #define OBJ_VALID_ATTRIBUTES 0x000007F2L typedef struct _OBJECT_ATTRIBUTES { ULONG Length; HANDLE RootDirectory; PUNICODE_STRING ObjectName; ULONG Attributes; PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE } OBJECT_ATTRIBUTES; typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES; #define InitializeObjectAttributes( p, n, a, r, s ) { \ (p)->Length = sizeof( OBJECT_ATTRIBUTES ); \ (p)->RootDirectory = r; \ (p)->Attributes = a; \ (p)->ObjectName = n; \ (p)->SecurityDescriptor = s; \ (p)->SecurityQualityOfService = NULL; \ } #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length)) #define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) typedef NTSTATUS(STDAPICALLTYPE RTLINITSTRING) ( IN OUT PSTRING DestinationString, IN LPCSTR SourceString ); typedef RTLINITSTRING FAR * LPRTLINITSTRING; typedef NTSTATUS(STDAPICALLTYPE RTLINITANSISTRING) ( IN OUT PANSI_STRING DestinationString, IN LPCSTR SourceString ); typedef RTLINITANSISTRING FAR * LPRTLINITANSISTRING; typedef NTSTATUS(STDAPICALLTYPE RTLINITUNICODESTRING) ( IN OUT PUNICODE_STRING DestinationString, IN LPCWSTR SourceString ); typedef RTLINITUNICODESTRING FAR * LPRTLINITUNICODESTRING; typedef NTSTATUS(STDAPICALLTYPE RTLANSISTRINGTOUNICODESTRING) ( IN OUT PUNICODE_STRING DestinationString, IN PANSI_STRING SourceString, IN BOOLEAN AllocateDestinationString ); typedef RTLANSISTRINGTOUNICODESTRING FAR * LPRTLANSISTRINGTOUNICODESTRING; typedef NTSTATUS(STDAPICALLTYPE RTLUNICODESTRINGTOANSISTRING) ( IN OUT PANSI_STRING DestinationString, IN PUNICODE_STRING SourceString, IN BOOLEAN AllocateDestinationString ); typedef RTLUNICODESTRINGTOANSISTRING FAR * LPRTLUNICODESTRINGTOANSISTRING; typedef NTSTATUS(STDAPICALLTYPE RTLFREEANSISTRING) ( IN PANSI_STRING AnsiString ); typedef RTLFREEANSISTRING FAR * LPRTLFREEANSISTRING; typedef NTSTATUS(STDAPICALLTYPE RTLFREEUNICODESTRING) ( IN PUNICODE_STRING UnicodeString ); typedef RTLFREEUNICODESTRING FAR * LPRTLFREEUNICODESTRING; typedef NTSTATUS(STDAPICALLTYPE RTLCONVERTSIDTOUNICODESTRING)( OUT PUNICODE_STRING UnicodeString, IN PSID Sid, IN BOOLEAN AllocateDestinationString ); typedef RTLCONVERTSIDTOUNICODESTRING FAR * LPRTLCONVERTSIDTOUNICODESTRING; typedef BOOL(WINAPI GETTOKENINFORMATION) ( _In_ HANDLE TokenHandle, _In_ TOKEN_INFORMATION_CLASS TokenInformationClass, _Out_opt_ LPVOID TokenInformation, _In_ DWORD TokenInformationLength, _Out_ PDWORD ReturnLength ); typedef GETTOKENINFORMATION FAR * LPGETTOKENINFORMATION; typedef BOOL(WINAPI OPENPROCESSTOKEN) ( _In_ HANDLE ProcessHandle, _In_ DWORD DesiredAccess, _Out_ PHANDLE TokenHandle ); typedef OPENPROCESSTOKEN FAR * LPOPENPROCESSTOKEN; typedef BOOL(WINAPI OPENTHREADTOKEN) ( _In_ HANDLE ThreadHandle, _In_ DWORD DesiredAccess, _In_ BOOL OpenAsSelf, _Out_ PHANDLE TokenHandle ); typedef OPENTHREADTOKEN FAR * LPOPENTHREADTOKEN; typedef NTSTATUS(STDAPICALLTYPE NTCREATEKEY) ( IN HANDLE KeyHandle, IN ULONG DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG TitleIndex, IN PUNICODE_STRING Class, /* optional*/ IN ULONG CreateOptions, OUT PULONG Disposition /* optional*/ ); typedef NTCREATEKEY FAR * LPNTCREATEKEY; typedef NTSTATUS(STDAPICALLTYPE NTOPENKEY) ( IN HANDLE KeyHandle, IN ULONG DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes ); typedef NTOPENKEY FAR * LPNTOPENKEY; typedef NTSTATUS(STDAPICALLTYPE NTFLUSHKEY) ( IN HANDLE KeyHandle ); typedef NTFLUSHKEY FAR * LPNTFLUSHKEY; typedef NTSTATUS(STDAPICALLTYPE NTDELETEKEY) ( IN HANDLE KeyHandle ); typedef NTDELETEKEY FAR * LPNTDELETEKEY; typedef NTSTATUS(STDAPICALLTYPE NTSETVALUEKEY) ( IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN ULONG TitleIndex, /* optional */ IN ULONG Type, IN PVOID Data, IN ULONG DataSize ); typedef NTSETVALUEKEY FAR * LPNTSETVALUEKEY; typedef NTSTATUS(STDAPICALLTYPE NTQUERYVALUEKEY) ( // Is the handle, returned by a successful // call to NtCreateKey or NtOpenKey, of key // for which value entries are to be read. IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG Length, OUT PULONG ResultLength ); typedef NTQUERYVALUEKEY FAR * LPNTQUERYVALUEKEY; typedef NTSTATUS(STDAPICALLTYPE NTSETINFORMATIONKEY) ( IN HANDLE KeyHandle, IN KEY_SET_INFORMATION_CLASS KeyInformationClass, IN PVOID KeyInformation, IN ULONG KeyInformationLength ); typedef NTSETINFORMATIONKEY FAR * LPNTSETINFORMATIONKEY; typedef NTSTATUS(STDAPICALLTYPE NTQUERYKEY) ( IN HANDLE KeyHandle, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG KeyInformationLength, OUT PULONG ResultLength ); typedef NTQUERYKEY FAR * LPNTQUERYKEY; typedef NTSTATUS(STDAPICALLTYPE NTENUMERATEKEY) ( IN HANDLE KeyHandle, IN ULONG Index, IN KEY_INFORMATION_CLASS KeyInformationClass, OUT PVOID KeyInformation, IN ULONG KeyInformationLength, OUT PULONG ResultLength ); typedef NTENUMERATEKEY FAR * LPNTENUMERATEKEY; typedef NTSTATUS(STDAPICALLTYPE NTDELETEVALUEKEY) ( IN HANDLE KeyHandle, IN PUNICODE_STRING ValueName ); typedef NTDELETEVALUEKEY FAR * LPNTDELETEVALUEKEY; typedef NTSTATUS(STDAPICALLTYPE NTENUMERATEVALUEKEY) ( IN HANDLE KeyHandle, IN ULONG Index, IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass, OUT PVOID KeyValueInformation, IN ULONG KeyValueInformationLength, OUT PULONG ResultLength ); typedef NTENUMERATEVALUEKEY FAR * LPNTENUMERATEVALUEKEY; typedef NTSTATUS(STDAPICALLTYPE NTQUERYMULTIPLEVALUEKEY) ( IN HANDLE KeyHandle, IN OUT PKEY_MULTIPLE_VALUE_INFORMATION ValuesList, IN ULONG NumberOfValues, OUT PVOID DataBuffer, IN OUT ULONG BufferLength, OUT PULONG RequiredLength /* optional */ ); typedef NTQUERYMULTIPLEVALUEKEY FAR * LPNTQUERYMULTIPLEVALUEKEY; typedef NTSTATUS(STDAPICALLTYPE NTNOTIFYCHANGEKEY) ( IN HANDLE KeyHandle, IN HANDLE EventHandle, IN PIO_APC_ROUTINE ApcRoutine, IN PVOID ApcRoutineContext, IN PIO_STATUS_BLOCK IoStatusBlock, IN ULONG NotifyFilter, IN BOOLEAN WatchSubtree, OUT PVOID RegChangesDataBuffer, IN ULONG RegChangesDataBufferLength, IN BOOLEAN Asynchronous ); typedef NTNOTIFYCHANGEKEY FAR * LPNTNOTIFYCHANGEKEY; typedef NTSTATUS(STDAPICALLTYPE NTRENAMEKEY) ( IN HANDLE KeyHandle, IN PUNICODE_STRING ReplacementName ); typedef NTRENAMEKEY FAR * LPNTRENAMEKEY; typedef NTSTATUS(STDAPICALLTYPE NTRESTOREKEY) ( IN HANDLE KeyHandle, IN HANDLE FileHandle, IN ULONG RestoreOption ); typedef NTRESTOREKEY FAR * LPNTRESTOREKEY; typedef NTSTATUS(STDAPICALLTYPE NTSAVEKEY) ( IN HANDLE KeyHandle, IN HANDLE FileHandle ); typedef NTSAVEKEY FAR * LPNTSAVEKEY; typedef NTSTATUS(STDAPICALLTYPE NTLOADKEY) ( IN POBJECT_ATTRIBUTES DestinationKeyName, // - and HANDLE to root key. // Root can be \registry\machine // or \registry\user. // All other keys are invalid. IN POBJECT_ATTRIBUTES HiveFileName // - Hive file path and name ); typedef NTLOADKEY FAR * LPNTLOADKEY; typedef NTSTATUS(STDAPICALLTYPE NTLOADKEY2) ( IN POBJECT_ATTRIBUTES DestinationKeyName, IN POBJECT_ATTRIBUTES HiveFileName, IN ULONG Flags // Flags can be 0x0000 or REG_NO_LAZY_FLUSH (0x0004) ); typedef NTLOADKEY2 FAR * LPNTLOADKEY2; typedef NTSTATUS(STDAPICALLTYPE NTREPLACEKEY) ( IN POBJECT_ATTRIBUTES NewHiveFileName, IN HANDLE KeyHandle, IN POBJECT_ATTRIBUTES BackupHiveFileName ); typedef NTREPLACEKEY FAR * LPNTREPLACEKEY; typedef NTSTATUS(STDAPICALLTYPE NTUNLOADKEY) ( IN POBJECT_ATTRIBUTES DestinationKeyName ); typedef NTUNLOADKEY FAR * LPNTUNLOADKEY; typedef NTSTATUS(STDAPICALLTYPE NTCLOSE) ( IN HANDLE KeyHandle ); typedef NTCLOSE FAR * LPNTCLOSE; typedef NTSTATUS(STDAPICALLTYPE NTCREATEFILE) ( OUT PHANDLE FileHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK IoStatusBlock, IN PLARGE_INTEGER AllocationSize, /* optional */ IN ULONG FileAttributes, IN ULONG ShareAccess, IN ULONG CreateDisposition, IN ULONG CreateOptions, IN PVOID EaBuffer, /* optional */ IN ULONG EaLength ); typedef NTCREATEFILE FAR * LPNTCREATEFILE; typedef NTSTATUS(STDAPICALLTYPE NTOPENTHREAD) ( OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId /* optional*/ ); typedef NTOPENTHREAD FAR * LPNTOPENTHREAD; typedef NTSTATUS(STDAPICALLTYPE NTOPENPROCESSTOKEN) ( IN HANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, OUT PHANDLE TokenHandle ); typedef NTOPENPROCESSTOKEN FAR * LPNTOPENPROCESSTOKEN; typedef NTSTATUS(STDAPICALLTYPE NTADJUSTPRIVILEGESTOKEN) ( IN HANDLE TokenHandle, IN BOOLEAN DisableAllPrivileges, IN PTOKEN_PRIVILEGES TokenPrivileges, IN ULONG PreviousPrivilegesLength, OUT PTOKEN_PRIVILEGES PreviousPrivileges, /* optional */ OUT PULONG RequiredLength /* optional */ ); typedef NTADJUSTPRIVILEGESTOKEN FAR * LPNTADJUSTPRIVILEGESTOKEN; typedef NTSTATUS(STDAPICALLTYPE NTQUERYINFORMATIONTOKEN) ( IN HANDLE TokenHandle, IN TOKEN_INFORMATION_CLASS TokenInformationClass, OUT PVOID TokenInformation, IN ULONG TokenInformationLength, OUT PULONG ReturnLength ); typedef NTQUERYINFORMATIONTOKEN FAR * LPNTQUERYINFORMATIONTOKEN; typedef NTSTATUS(STDAPICALLTYPE RTLALLOCATEHEAP) ( IN PVOID HeapHandle, IN ULONG Flags, IN ULONG Size ); typedef RTLALLOCATEHEAP FAR * LPRTLALLOCATEHEAP; typedef NTSTATUS(STDAPICALLTYPE RTLFREEHEAP) ( IN PVOID HeapHandle, IN ULONG Flags, /* optional */ IN PVOID MemoryPointer ); typedef RTLFREEHEAP FAR * LPRTLFREEHEAP; typedef NTSTATUS(STDAPICALLTYPE NTCOMPACTKEYS) ( IN ULONG NrOfKeys, IN HANDLE KeysArray ); typedef NTCOMPACTKEYS FAR * LPNTCOMPACTKEYS; typedef NTSTATUS(STDAPICALLTYPE NTCOMPRESSKEY) ( IN HANDLE Key ); typedef NTCOMPRESSKEY FAR * LPNTCOMPRESSKEY; typedef NTSTATUS(STDAPICALLTYPE NTLOCKREGISTRYKEY) ( IN HANDLE KeyHandle ); typedef NTLOCKREGISTRYKEY FAR * LPNTLOCKREGISTRYKEY; typedef NTSTATUS(STDAPICALLTYPE NTQUERYOPENSUBKEYSEX) ( IN POBJECT_ATTRIBUTES TargetKey, IN ULONG BufferLength, IN PVOID Buffer, IN PULONG RequiredSize ); typedef NTQUERYOPENSUBKEYSEX FAR * LPNTQUERYOPENSUBKEYSEX; typedef NTSTATUS(STDAPICALLTYPE NTSAVEKEYEX) ( IN HANDLE KeyHandle, IN HANDLE FileHandle, IN ULONG Flags ); typedef NTSAVEKEYEX FAR * LPNTSAVEKEYEX; typedef NTSTATUS(STDAPICALLTYPE NTLOADKEYEX) ( IN POBJECT_ATTRIBUTES TargetKey, IN POBJECT_ATTRIBUTES SourceFile, IN ULONG Flags, IN HANDLE TrustClassKey ); typedef NTLOADKEYEX FAR * LPNTLOADKEYEX; typedef NTSTATUS(STDAPICALLTYPE NTUNLOADKEY2) ( IN POBJECT_ATTRIBUTES TargetKey, IN ULONG Flags ); typedef NTUNLOADKEY2 FAR * LPNTUNLOADKEY2; typedef NTSTATUS(STDAPICALLTYPE NTUNLOADKEYEX) ( IN POBJECT_ATTRIBUTES TargetKey, IN HANDLE Event ); typedef NTUNLOADKEYEX FAR * LPNTUNLOADKEYEX; typedef enum _OBJECT_INFORMATION_CLASS { ObjectBasicInformation = 0, ObjectTypeInformation = 2 } OBJECT_INFORMATION_CLASS; typedef NTSTATUS(STDAPICALLTYPE NTQUERYOBJECT) ( _In_opt_ HANDLE Handle, _In_ OBJECT_INFORMATION_CLASS ObjectInformationClass, _Out_opt_ PVOID ObjectInformation, _In_ ULONG ObjectInformationLength, _Out_opt_ PULONG ReturnLength ); typedef NTQUERYOBJECT FAR * LPNTQUERYOBJECT; public ref class Registry sealed { private: property LPGETTOKENINFORMATION GetTokenInformation; property LPOPENPROCESSTOKEN OpenProcessToken; property LPOPENTHREADTOKEN OpenThreadToken; property LPNTCREATEKEY NtCreateKey; property LPNTOPENKEY NtOpenKey; property LPNTDELETEKEY NtDeleteKey; property LPNTFLUSHKEY NtFlushKey; property LPNTQUERYKEY NtQueryKey; property LPNTENUMERATEKEY NtEnumerateKey; property LPNTSETVALUEKEY NtSetValueKey; property LPNTSETINFORMATIONKEY NtSetInformationKey; property LPNTQUERYVALUEKEY NtQueryValueKey; property LPNTENUMERATEVALUEKEY NtEnumerateValueKey; property LPNTDELETEVALUEKEY NtDeleteValueKey; property LPNTQUERYMULTIPLEVALUEKEY NtQueryMultipleValueKey; property LPNTRENAMEKEY NtRenameKey; property LPNTCOMPACTKEYS NtCompactKeys; property LPNTCOMPRESSKEY NtCompressKey; property LPNTLOCKREGISTRYKEY NtLockRegistryKey; property LPNTQUERYOPENSUBKEYSEX NtQueryOpenSubKeysEx; property LPNTSAVEKEYEX NtSaveKeyEx; property LPNTLOADKEYEX NtLoadKeyEx; property LPNTUNLOADKEY2 NtUnloadKey2; property LPNTUNLOADKEYEX NtUnloadKeyEx; property LPNTSAVEKEY NtSaveKey; property LPNTRESTOREKEY NtRestoreKey; property LPNTLOADKEY NtLoadKey; property LPNTLOADKEY2 NtLoadKey2; property LPNTREPLACEKEY NtReplaceKey; property LPNTUNLOADKEY NtUnloadKey; property LPNTCLOSE NtClose; property LPNTNOTIFYCHANGEKEY NtNotifyChangeKey; property LPNTOPENTHREAD NtOpenThread; property LPNTCREATEFILE NtCreateFile; property LPNTOPENPROCESSTOKEN NtOpenProcessToken; property LPNTADJUSTPRIVILEGESTOKEN NtAdjustPrivilegesToken; property LPNTQUERYINFORMATIONTOKEN NtQueryInformationToken; property LPRTLINITSTRING RtlInitString; property LPRTLINITANSISTRING RtlInitAnsiString; property LPRTLINITUNICODESTRING RtlInitUnicodeString; property LPRTLANSISTRINGTOUNICODESTRING RtlAnsiStringToUnicodeString; property LPRTLUNICODESTRINGTOANSISTRING RtlUnicodeStringToAnsiString; property LPRTLFREEANSISTRING RtlFreeAnsiString; property LPRTLFREEUNICODESTRING RtlFreeUnicodeString; property LPRTLCONVERTSIDTOUNICODESTRING RtlConvertSidToUnicodeString; property LPRTLALLOCATEHEAP RtlAllocateHeap; property LPRTLFREEHEAP RtlFreeHeap; property LPNTQUERYOBJECT NtQueryObject; public: Registry(); void Registry::InitNTDLLEntryPoints(); RegistryType Registry::GetValueInfo(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, int nSize); Platform::Boolean Registry::GetSubKeyList(RegistryHive Hive, Platform::String^ Key, Platform::Array<Platform::String^> ^*csaSubkeys); Platform::Boolean Registry::GetValueList(RegistryHive Hive, Platform::String^ Key, Platform::Array<Platform::String^> ^*csaValues); Platform::Boolean Registry::ValueExists(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name); Platform::Boolean Registry::WriteValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, const Platform::Array<uint8>^ csaValue, RegistryType type); Platform::Boolean Registry::QueryValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, RegistryType* RegType, Platform::Array<uint8>^* RetBuffer); Platform::Boolean Registry::RenameKey(RegistryHive Hive, Platform::String^ Key, Platform::String^ csNewKeyName); Platform::Boolean Registry::DeleteKey(RegistryHive Hive, Platform::String^ Key); Platform::Boolean Registry::DeleteKeysRecursive(RegistryHive Hive, Platform::String^ Key); Platform::Boolean Registry::CreateKey(RegistryHive Hive, Platform::String^ Key); Platform::Boolean Registry::DeleteValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name); unsigned int Registry::GetKeyStatus(RegistryHive Hive, Platform::String^ Key); Platform::Boolean Registry::FindHiddenKeys(RegistryHive Hive, Platform::String^ Key, Platform::Array<Platform::String^> ^*csaSubkeys); Platform::Boolean Registry::IsKeyHidden(RegistryHive Hive, Platform::String^ Key); Platform::Boolean Registry::GetKeyLastWriteTime(RegistryHive Hive, Platform::String^ Key, int64 *LastWriteTime); //Customs Platform::Boolean Registry::WriteValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, const Platform::Array<uint8>^ csaValue, uint32 type); unsigned int Registry::GetValueInfo2(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, int nSize); Platform::Boolean Registry::QueryValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, uint32* RegType, Platform::Array<uint8>^* RetBuffer); Platform::Boolean Registry::LoadHive(Platform::String^ HiveFile, Platform::String^ MountName, Platform::Boolean InUser); Platform::Boolean Registry::UnloadHive(Platform::String^ KeyPath, Platform::Boolean InUser); private: Platform::String^ Registry::GetCurrentUserSID(); Platform::String^ Registry::GetRootPathFor(RegistryHive hRoot); BOOL Registry::ReadValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, RegistryType RegType, KEY_VALUE_PARTIAL_INFORMATION** retInfo); Platform::Boolean Registry::WriteValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, PVOID pValue, ULONG ulValueLength, RegistryType dwRegType); // Customs Platform::Boolean Registry::WriteValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, PVOID pValue, RegistryRT::ULONG ulValueLength, DWORD dwRegType); BOOL Registry::ReadValue(RegistryHive Hive, Platform::String^ Key, Platform::String^ Name, uint32 RegType, KEY_VALUE_PARTIAL_INFORMATION** retInfo); }; }
34.061294
171
0.756865
13667616010432b62314bfebcc22c9b3d6fbac25
1,020
h
C
include/target/cpu/amd64/cpu_defs.h
aguinet/shell-factory
25639dd517ace9a9292db38f8ca423808317de65
[ "MIT" ]
108
2017-02-22T13:28:39.000Z
2022-03-24T23:39:28.000Z
include/target/cpu/amd64/cpu_defs.h
aguinet/shell-factory
25639dd517ace9a9292db38f8ca423808317de65
[ "MIT" ]
null
null
null
include/target/cpu/amd64/cpu_defs.h
aguinet/shell-factory
25639dd517ace9a9292db38f8ca423808317de65
[ "MIT" ]
22
2017-02-23T17:17:05.000Z
2020-11-19T12:55:28.000Z
#ifndef CPU_REGS_H_ #define CPU_REGS_H_ #include <cstdint> #define SP_REGISTER "rsp" namespace CPU { using reg_t = uint64_t; using addr_t = uint64_t; using word_t = uint64_t; enum registers { // General registers. CPU_REG_RAX, CPU_REG_RBX, CPU_REG_RCX, CPU_REG_RDX, CPU_REG_RSI, CPU_REG_RDI, CPU_REG_RBP, CPU_REG_RSP, CPU_REG_R8, CPU_REG_R9, CPU_REG_R10, CPU_REG_R11, CPU_REG_R12, CPU_REG_R13, CPU_REG_R14, CPU_REG_R15, CPU_REG_RIP, // Flags. CPU_REG_RFLAGS, // Segment selectors. CPU_REG_CS, CPU_REG_DS, CPU_REG_ES, CPU_REG_FS, CPU_REG_GS, CPU_REG_SS, // Debug registers. CPU_REG_DR0, CPU_REG_DR1, CPU_REG_DR2, CPU_REG_DR3, CPU_REG_DR4, CPU_REG_DR5, CPU_REG_DR6, CPU_REG_DR7, }; } #endif
17.288136
31
0.541176
fb62256cfa375292d3f22228b759d2ae5b2acb48
146
h
C
gmath/gmath.h
HoRangDev/gmath
04503a4eec019dac591bf7f8889fb468bcb0a0ba
[ "MIT" ]
null
null
null
gmath/gmath.h
HoRangDev/gmath
04503a4eec019dac591bf7f8889fb468bcb0a0ba
[ "MIT" ]
null
null
null
gmath/gmath.h
HoRangDev/gmath
04503a4eec019dac591bf7f8889fb468bcb0a0ba
[ "MIT" ]
null
null
null
#pragma once #include "Vector2.h" #include "Vector3.h" #include "Vector4.h" #include "Quaternion.h" #include "Matrix4x4.h" #include "Interp.h"
13.272727
23
0.712329
a1e53edf51d1e2d289e8c9b08dca2c6eb5224df0
1,021
h
C
class/CCAirBLEManager.h
183959633/CCBLEManager
756f3488934ac7270f9afd933b9368b42720e13c
[ "Apache-2.0" ]
null
null
null
class/CCAirBLEManager.h
183959633/CCBLEManager
756f3488934ac7270f9afd933b9368b42720e13c
[ "Apache-2.0" ]
null
null
null
class/CCAirBLEManager.h
183959633/CCBLEManager
756f3488934ac7270f9afd933b9368b42720e13c
[ "Apache-2.0" ]
null
null
null
// // CCAirBLEManager.h // tt // // Created by Wang youdong on 2019/7/31. // Copyright © 2019 Jack. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreBluetooth/CoreBluetooth.h> NS_ASSUME_NONNULL_BEGIN static NSString * const airName =@"C-AIR"; @interface CCAirBLEManager : NSObject<CBCentralManagerDelegate,CBPeripheralDelegate> + (CCAirBLEManager *)instance; //手机设备 @property (nonatomic, strong) CBCentralManager *airCentral; //外设设备 @property (nonatomic, strong) CBPeripheral *airPeripheral; //特征值 @property (nonatomic, strong) CBCharacteristic *airCharacteristic; //服务 @property (nonatomic, strong) CBService *airService; //描述 @property (nonatomic, strong) CBDescriptor *airDescriptor; //开始扫描 + (void)startScan; //停止扫描 + (void)stopScan; //开启一档 + (void)firstGear; //开启二档 + (void)secondGear; //开启三档 + (void)thirdGear; //开启自动档 + (void)automaticGear; //开关机 + (void)switchingMachine; //查询寿命 + (void)queryLife; //查询空气质量和灰尘浓度 + (void)queryAirQualityAndDustConcentration; @end NS_ASSUME_NONNULL_END
22.195652
84
0.756121
20bbd4864363dd3c637549d0026666b067a6b392
23,019
h
C
include/camera/CameraParametersExtra.h
XPerience-AOSP-Lollipop/android_device_htc_a5
04a767970cc24c0092942d6fb23e8748f4496297
[ "FTL" ]
9
2015-01-03T18:51:55.000Z
2016-11-17T01:56:38.000Z
include/camera/CameraParametersExtra.h
XPerience-AOSP-Lollipop/android_device_htc_a5
04a767970cc24c0092942d6fb23e8748f4496297
[ "FTL" ]
null
null
null
include/camera/CameraParametersExtra.h
XPerience-AOSP-Lollipop/android_device_htc_a5
04a767970cc24c0092942d6fb23e8748f4496297
[ "FTL" ]
29
2015-01-03T02:28:57.000Z
2020-01-15T17:41:05.000Z
/* * Copyright (C) 2014 The CyanogenMod 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. */ #define CAMERA_PARAMETERS_EXTRA_C \ const char CameraParameters::AE_BRACKET_HDR_OFF[] = "Off"; \ const char CameraParameters::AE_BRACKET_HDR[] = "HDR"; \ const char CameraParameters::AE_BRACKET[] = "AE-Bracket"; \ const char CameraParameters::APP_OIS_SETTING_FALSE[] = "false"; \ const char CameraParameters::APP_OIS_SETTING_TRUE[] = "true"; \ const char CameraParameters::AUTO_EXPOSURE_CENTER_WEIGHTED[] = "center-weighted"; \ const char CameraParameters::AUTO_EXPOSURE_FRAME_AVG[] = "frame-average"; \ const char CameraParameters::AUTO_EXPOSURE_SPOT_METERING[] = "spot-metering"; \ const char CameraParameters::BURST_MODE_LIMIT20[] = "limit-20"; \ const char CameraParameters::BURST_MODE_UNLIMITED[] = "unlimited"; \ const char CameraParameters::CAPTURE_MODE_CONTI_BURST_ONE_SHOT[] = "contiburst-one-shot"; \ const char CameraParameters::CAPTURE_MODE_CONTI_BURST[] = "contiburst"; \ const char CameraParameters::CAPTURE_MODE_CONTI_ZOE[] = "contizoe"; \ const char CameraParameters::CAPTURE_MODE_EIS[] = "eis"; \ const char CameraParameters::CAPTURE_MODE_HDR[] = "hdr"; \ const char CameraParameters::CAPTURE_MODE_NORMAL[] = "normal"; \ const char CameraParameters::CAPTURE_MODE_PANORAMA[] = "panorama"; \ const char CameraParameters::CAPTURE_MODE_ZOE[] = "zoe"; \ const char CameraParameters::CONTI_BURST_CAPTURE_DONE[] = "contiburst-done"; \ const char CameraParameters::CONTI_BURST_CAPTURING[] = "contiburst-capturing"; \ const char CameraParameters::DENOISE_OFF[] = "denoise-off"; \ const char CameraParameters::DENOISE_ON[] = "denoise-on"; \ const char CameraParameters::EFFECT_EMBOSS[] = "emboss"; \ const char CameraParameters::EFFECT_NEON[] = "neon"; \ const char CameraParameters::EFFECT_SKETCH[] = "sketch"; \ const char CameraParameters::FACE_DETECTION_OFF[] = "off"; \ const char CameraParameters::FACE_DETECTION_ON[] = "on"; \ const char CameraParameters::FOCUS_MODE_NORMAL[] = "normal"; \ const char CameraParameters::HDR_DISABLE[] = "disable"; \ const char CameraParameters::HDR_ENABLE[] = "enable"; \ const char CameraParameters::HISTOGRAM_DISABLE[] = "disable"; \ const char CameraParameters::HISTOGRAM_ENABLE[] = "enable"; \ const char CameraParameters::ISO_100[] = "ISO100"; \ const char CameraParameters::ISO_1600[] = "ISO1600"; \ const char CameraParameters::ISO_200[] = "ISO200"; \ const char CameraParameters::ISO_3200[] = "ISO3200"; \ const char CameraParameters::ISO_400[] = "ISO400"; \ const char CameraParameters::ISO_6400[] = "ISO6400"; \ const char CameraParameters::ISO_800[] = "ISO800"; \ const char CameraParameters::ISO_AUTO[] = "auto"; \ const char CameraParameters::ISO_HJR[] = "ISO_HJR"; \ const char CameraParameters::KEY_AE_BRACKET_HDR[] = "ae-bracket-hdr"; \ const char CameraParameters::KEY_APP_OIS_SETTING[] = "ois-setting"; \ const char CameraParameters::KEY_AUTO_EXPOSURE[] = "auto-exposure"; \ const char CameraParameters::KEY_CAMERA_MODE[] = "camera-mode"; \ const char CameraParameters::KEY_CAPTURE_MODE[] = "capture-mode"; \ const char CameraParameters::KEY_CONTI_BURST_STATE[] = "contiburst-state"; \ const char CameraParameters::KEY_CONTIBURST_TYPE[] = "contiburst-type"; \ const char CameraParameters::KEY_CONTRAST[] = "contrast"; \ const char CameraParameters::KEY_DEF_CONTRAST[] = "contrast-def"; \ const char CameraParameters::KEY_DEF_SATURATION[] = "saturation-def"; \ const char CameraParameters::KEY_DEF_SHARPNESS[] = "sharpness-def"; \ const char CameraParameters::KEY_DENOISE[] = "denoise"; \ const char CameraParameters::KEY_EXIF_DATETIME[] = "exif-datetime"; \ const char CameraParameters::KEY_FACE_DETECTION[] = "face-detection"; \ const char CameraParameters::KEY_FORCE_USE_AUDIO_ENABLED[] = "forceuseaudio"; \ const char CameraParameters::KEY_GPS_ALTITUDE_REF[] = "gps-altitude-ref"; \ const char CameraParameters::KEY_GPS_LATITUDE_REF[] = "gps-latitude-ref"; \ const char CameraParameters::KEY_GPS_LONGITUDE_REF[] = "gps-longitude-ref"; \ const char CameraParameters::KEY_GPS_STATUS[] = "gps-status"; \ const char CameraParameters::KEY_GPU_EFFECT_PARAM_0[] = "GE-param0"; \ const char CameraParameters::KEY_GPU_EFFECT_PARAM_1[] = "GE-param1"; \ const char CameraParameters::KEY_GPU_EFFECT_PARAM_2[] = "GE-param2"; \ const char CameraParameters::KEY_GPU_EFFECT_PARAM_3[] = "GE-param3"; \ const char CameraParameters::KEY_GPU_EFFECT[] = "GPU-effect"; \ const char CameraParameters::KEY_HIGH_DYNAMIC_RANGE_IMAGING[] = "hdr"; \ const char CameraParameters::KEY_HISTOGRAM[] = "histogram"; \ const char CameraParameters::KEY_ISO_MODE[] = "iso"; \ const char CameraParameters::KEY_LENSSHADE[] = "lensshade"; \ const char CameraParameters::KEY_MAX_CONTRAST[] = "max-contrast"; \ const char CameraParameters::KEY_MAX_SATURATION[] = "max-saturation"; \ const char CameraParameters::KEY_MAX_SHARPNESS[] = "max-sharpness"; \ const char CameraParameters::KEY_MEMORY_COLOR_ENHANCEMENT[] = "mce"; \ const char CameraParameters::KEY_MIN_CONTRAST[] = "contrast-min"; \ const char CameraParameters::KEY_MIN_SATURATION[] = "saturation-min"; \ const char CameraParameters::KEY_MIN_SHARPNESS[] = "sharpness-min"; \ const char CameraParameters::KEY_OIS_MODE[] = "ois_mode"; \ const char CameraParameters::KEY_OIS_SUPPORT[] = "ois_support"; \ const char CameraParameters::KEY_POWER_MODE_SUPPORTED[] = "power-mode-supported"; \ const char CameraParameters::KEY_POWER_MODE[] = "power-mode"; \ const char CameraParameters::KEY_PREVIEW_FRAME_RATE_AUTO_MODE[] = "frame-rate-auto"; \ const char CameraParameters::KEY_PREVIEW_FRAME_RATE_FIXED_MODE[] = "frame-rate-fixed"; \ const char CameraParameters::KEY_PREVIEW_FRAME_RATE_MODE[] = "preview-frame-rate-mode"; \ const char CameraParameters::KEY_REDEYE_REDUCTION[] = "redeye-reduction"; \ const char CameraParameters::KEY_SATURATION[] = "saturation"; \ const char CameraParameters::KEY_SCENE_DETECT[] = "scene-detect"; \ const char CameraParameters::KEY_SELECTABLE_ZONE_AF[] = "selectable-zone-af"; \ const char CameraParameters::KEY_SHARPNESS[] = "sharpness"; \ const char CameraParameters::KEY_SINGLE_ISP_OUTPUT_ENABLED[] = "single-isp-output-enabled"; \ const char CameraParameters::KEY_SKIN_TONE_ENHANCEMENT[] = "skinToneEnhancement"; \ const char CameraParameters::KEY_SUPPORTED_AUTO_EXPOSURE[] = "auto-exposure-values"; \ const char CameraParameters::KEY_SUPPORTED_CAPTURE_MODES[] = "capture-mode-values"; \ const char CameraParameters::KEY_SUPPORTED_DENOISE[] = "denoise-values"; \ const char CameraParameters::KEY_SUPPORTED_FACE_DETECTION[] = "face-detection-values"; \ const char CameraParameters::KEY_SUPPORTED_HDR_IMAGING_MODES[] = "hdr-values"; \ const char CameraParameters::KEY_SUPPORTED_HFR_SIZES[] = "hfr-size-values"; \ const char CameraParameters::KEY_SUPPORTED_HISTOGRAM_MODES[] = "histogram-values"; \ const char CameraParameters::KEY_SUPPORTED_ISO_MODES[] = "iso-values"; \ const char CameraParameters::KEY_SUPPORTED_LENSSHADE_MODES[] = "lensshade-values"; \ const char CameraParameters::KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[] = "mce-values"; \ const char CameraParameters::KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[] = "preview-frame-rate-modes"; \ const char CameraParameters::KEY_SUPPORTED_REDEYE_REDUCTION[] = "redeye-reduction-values"; \ const char CameraParameters::KEY_SUPPORTED_SCENE_DETECT[] = "scene-detect-values"; \ const char CameraParameters::KEY_SUPPORTED_SELECTABLE_ZONE_AF[] = "selectable-zone-af-values"; \ const char CameraParameters::KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[] = "skinToneEnhancement-values"; \ const char CameraParameters::KEY_SUPPORTED_TOUCH_AF_AEC[] = "touch-af-aec-values"; \ const char CameraParameters::KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[] = "video-hfr-values"; \ const char CameraParameters::KEY_SUPPORTED_ZSL_MODES[] = "zsl-values"; \ const char CameraParameters::KEY_TIME_CONS_POST_PROCESSING[] = "time-cons-post-processing"; \ const char CameraParameters::KEY_TOUCH_AF_AEC[] = "touch-af-aec"; \ const char CameraParameters::KEY_TOUCH_INDEX_AEC[] = "touch-index-aec"; \ const char CameraParameters::KEY_TOUCH_INDEX_AF[] = "touch-index-af"; \ const char CameraParameters::KEY_VIDEO_HIGH_FRAME_RATE[] = "video-hfr"; \ const char CameraParameters::KEY_ZSL[] = "zsl"; \ const char CameraParameters::LENSSHADE_DISABLE[] = "disable"; \ const char CameraParameters::LENSSHADE_ENABLE[] = "enable"; \ const char CameraParameters::LOW_POWER[] = "Low_Power"; \ const char CameraParameters::MCE_DISABLE[] = "disable"; \ const char CameraParameters::MCE_ENABLE[] = "enable"; \ const char CameraParameters::NORMAL_POWER[] = "Normal_Power"; \ const char CameraParameters::OIS_MODE_OFF[] = "off"; \ const char CameraParameters::OIS_MODE_ON[] = "on"; \ const char CameraParameters::PIXEL_FORMAT_NV12[] = "nv12"; \ const char CameraParameters::PIXEL_FORMAT_RAW[] = "raw"; \ const char CameraParameters::PIXEL_FORMAT_YUV420SP_ADRENO[] = "yuv420sp-adreno"; \ const char CameraParameters::PIXEL_FORMAT_YV12[] = "yuv420p"; \ const char CameraParameters::POST_PROCESSING_BYPASS[] = "bypass"; \ const char CameraParameters::POST_PROCESSING_DELAY[] = "delay"; \ const char CameraParameters::POST_PROCESSING_ENABLE[] = "enable"; \ const char CameraParameters::REDEYE_REDUCTION_DISABLE[] = "disable"; \ const char CameraParameters::REDEYE_REDUCTION_ENABLE[] = "enable"; \ const char CameraParameters::SCENE_DETECT_OFF[] = "off"; \ const char CameraParameters::SCENE_DETECT_ON[] = "on"; \ const char CameraParameters::SCENE_MODE_AR[] = "AR"; \ const char CameraParameters::SCENE_MODE_BACKLIGHT[] = "backlight"; \ const char CameraParameters::SCENE_MODE_FLOWERS[] = "flowers"; \ const char CameraParameters::SCENE_MODE_OFF[] = "off"; \ const char CameraParameters::SCENE_MODE_TEXT[] = "text"; \ const char CameraParameters::SELECTABLE_ZONE_AF_AUTO[] = "auto"; \ const char CameraParameters::SELECTABLE_ZONE_AF_CENTER_WEIGHTED[] = "center-weighted"; \ const char CameraParameters::SELECTABLE_ZONE_AF_FRAME_AVERAGE[] = "frame-average"; \ const char CameraParameters::SELECTABLE_ZONE_AF_SPOT_METERING[] = "spot-metering"; \ const char CameraParameters::SKIN_TONE_ENHANCEMENT_DISABLE[] = "disable"; \ const char CameraParameters::SKIN_TONE_ENHANCEMENT_ENABLE[] = "enable"; \ const char CameraParameters::TOUCH_AF_AEC_OFF[] = "touch-off"; \ const char CameraParameters::TOUCH_AF_AEC_ON[] = "touch-on"; \ const char CameraParameters::VIDEO_HFR_2X[] = "60"; \ const char CameraParameters::VIDEO_HFR_3X[] = "90"; \ const char CameraParameters::VIDEO_HFR_4X[] = "120"; \ const char CameraParameters::VIDEO_HFR_OFF[] = "off"; \ const char CameraParameters::ZSL_OFF[] = "off"; \ const char CameraParameters::ZSL_ON[] = "on"; \ static const char* portrait = "portrait"; \ static const char* landscape = "landscape"; \ static int parse_pair(const char *str, int *first, int *second, char delim, char **endptr); \ static void parseSizesList(const char *sizesStr, Vector<Size> &sizes); \ static int parseNDimVector(const char *str, int *num, int N, char delim = ',') \ { \ char *start, *end; \ if(num == NULL) { \ ALOGE("Invalid output array (num == NULL)"); \ return -1; \ }\ if(str[0] != '(' || str[strlen(str)-1] != ')') { \ ALOGE("Invalid format of string %s, valid format is (n1, n2, n3, n4 ...)", str); \ return -1; \ } \ start = (char*) str; \ start++; \ for(int i=0; i<N; i++) { \ *(num+i) = (int) strtol(start, &end, 10); \ if(*end != delim && i < N-1) { \ ALOGE("Cannot find delimeter '%c' in string \"%s\". end = %c", delim, str, *end); \ return -1; \ } \ start = end+1; \ } \ return 0; \ } \ int CameraParameters::getOrientation() const \ { \ const char* orientation = get("orientation"); \ if (orientation && !strcmp(orientation, portrait)) \ return CAMERA_ORIENTATION_PORTRAIT; \ return CAMERA_ORIENTATION_LANDSCAPE; \ } \ void CameraParameters::setOrientation(int orientation) \ { \ if (orientation == CAMERA_ORIENTATION_PORTRAIT) { \ set("orientation", portrait); \ } else { \ set("orientation", landscape); \ } \ } \ void CameraParameters::getSupportedHfrSizes(Vector<Size> &sizes) const \ { \ const char *hfrSizesStr = get(KEY_SUPPORTED_HFR_SIZES); \ parseSizesList(hfrSizesStr, sizes); \ } \ void CameraParameters::setPreviewFpsRange(int minFPS, int maxFPS) \ { \ char str[32]; \ snprintf(str, sizeof(str), "%d,%d",minFPS,maxFPS); \ set(KEY_PREVIEW_FPS_RANGE,str); \ } \ void CameraParameters::getBrightnessLumaTargetSet(int *magic __unused, int *sauce __unused) const \ { \ } \ void CameraParameters::getRawSize(int *magic __unused, int *sauce __unused) const \ { \ } \ void CameraParameters::setPreviewFrameRateMode(const char *mode) \ { \ set(KEY_PREVIEW_FRAME_RATE_MODE, mode); \ } \ const char *CameraParameters::getPreviewFrameRateMode() const \ { \ return get(KEY_PREVIEW_FRAME_RATE_MODE); \ } \ void CameraParameters::setTouchIndexAec(int x, int y) \ { \ char str[32]; \ snprintf(str, sizeof(str), "%dx%d", x, y); \ set(KEY_TOUCH_INDEX_AEC, str); \ } \ void CameraParameters::getTouchIndexAec(int *x, int *y) const \ { \ *x = -1; \ *y = -1; \ const char *p = get(KEY_TOUCH_INDEX_AEC); \ if (p == 0) \ return; \ int tempX, tempY; \ if (parse_pair(p, &tempX, &tempY, 'x', NULL) == 0) { \ *x = tempX; \ *y = tempY; \ } \ } \ void CameraParameters::setTouchIndexAf(int x, int y) \ { \ char str[32]; \ snprintf(str, sizeof(str), "%dx%d", x, y); \ set(KEY_TOUCH_INDEX_AF, str); \ } \ void CameraParameters::getMeteringAreaCenter(int *x, int *y) const \ { \ *x = -2000; \ *y = -2000; \ const char *p = get(KEY_METERING_AREAS); \ if(p != NULL) { \ int arr[5] = {-2000, -2000, -2000, -2000, 0}; \ parseNDimVector(p, arr, 5, ','); \ *x = (arr[0] + arr[2])/2; \ *y = (arr[1] + arr[3])/2; \ } \ } \ void CameraParameters::getTouchIndexAf(int *x, int *y) const \ { \ *x = -1; \ *y = -1; \ const char *p = get(KEY_TOUCH_INDEX_AF); \ if (p == 0) \ return; \ int tempX, tempY; \ if (parse_pair(p, &tempX, &tempY, 'x', NULL) == 0) { \ *x = tempX; \ *y = tempY; \ } \ } \ #define CAMERA_PARAMETERS_EXTRA_H \ struct FPSRange{ \ int minFPS; \ int maxFPS; \ FPSRange(){ \ minFPS=0; \ maxFPS=0; \ }; \ FPSRange(int min,int max){ \ minFPS=min; \ maxFPS=max; \ }; \ }; \ void getBrightnessLumaTargetSet(int *magic, int *sauce) const; \ void getRawSize(int *magic, int *sauce) const; \ void setPreviewFrameRateMode(const char *mode); \ const char *getPreviewFrameRateMode() const; \ void setTouchIndexAec(int x, int y); \ void getTouchIndexAec(int *x, int *y) const; \ void setTouchIndexAf(int x, int y); \ void getTouchIndexAf(int *x, int *y) const; \ static const char AE_BRACKET_HDR_OFF[]; \ static const char AE_BRACKET_HDR[]; \ static const char AE_BRACKET[]; \ static const char APP_OIS_SETTING_FALSE[]; \ static const char APP_OIS_SETTING_TRUE[]; \ static const char AUTO_EXPOSURE_CENTER_WEIGHTED[]; \ static const char AUTO_EXPOSURE_FRAME_AVG[]; \ static const char AUTO_EXPOSURE_SPOT_METERING[]; \ static const char BURST_MODE_LIMIT20[]; \ static const char BURST_MODE_UNLIMITED[]; \ static const char CAPTURE_MODE_CONTI_BURST_ONE_SHOT[]; \ static const char CAPTURE_MODE_CONTI_BURST[]; \ static const char CAPTURE_MODE_CONTI_ZOE[]; \ static const char CAPTURE_MODE_EIS[]; \ static const char CAPTURE_MODE_HDR[]; \ static const char CAPTURE_MODE_NORMAL[]; \ static const char CAPTURE_MODE_PANORAMA[]; \ static const char CAPTURE_MODE_ZOE[]; \ static const char CONTI_BURST_CAPTURE_DONE[]; \ static const char CONTI_BURST_CAPTURING[]; \ static const char DENOISE_OFF[]; \ static const char DENOISE_ON[]; \ static const char EFFECT_EMBOSS[]; \ static const char EFFECT_NEON[]; \ static const char EFFECT_SKETCH[]; \ static const char FACE_DETECTION_OFF[]; \ static const char FACE_DETECTION_ON[]; \ static const char FOCUS_MODE_NORMAL[]; \ static const char HDR_DISABLE[]; \ static const char HDR_ENABLE[]; \ static const char HISTOGRAM_DISABLE[]; \ static const char HISTOGRAM_ENABLE[]; \ static const char ISO_100[]; \ static const char ISO_1600[]; \ static const char ISO_200[] ; \ static const char ISO_3200[]; \ static const char ISO_400[]; \ static const char ISO_6400[]; \ static const char ISO_800[]; \ static const char ISO_AUTO[]; \ static const char ISO_HJR[] ; \ static const char KEY_AE_BRACKET_HDR[]; \ static const char KEY_APP_OIS_SETTING[]; \ static const char KEY_AUTO_EXPOSURE[]; \ static const char KEY_CAMERA_MODE[]; \ static const char KEY_CAPTURE_MODE[]; \ static const char KEY_CONTI_BURST_STATE[]; \ static const char KEY_CONTIBURST_TYPE[]; \ static const char KEY_CONTRAST[]; \ static const char KEY_DEF_CONTRAST[]; \ static const char KEY_DEF_SATURATION[]; \ static const char KEY_DEF_SHARPNESS[]; \ static const char KEY_DENOISE[]; \ static const char KEY_EXIF_DATETIME[]; \ static const char KEY_FACE_DETECTION[]; \ static const char KEY_FORCE_USE_AUDIO_ENABLED[]; \ static const char KEY_GPS_ALTITUDE_REF[]; \ static const char KEY_GPS_LATITUDE_REF[]; \ static const char KEY_GPS_LONGITUDE_REF[]; \ static const char KEY_GPS_STATUS[]; \ static const char KEY_GPU_EFFECT_PARAM_0[]; \ static const char KEY_GPU_EFFECT_PARAM_1[]; \ static const char KEY_GPU_EFFECT_PARAM_2[]; \ static const char KEY_GPU_EFFECT_PARAM_3[]; \ static const char KEY_GPU_EFFECT[]; \ static const char KEY_HIGH_DYNAMIC_RANGE_IMAGING[]; \ static const char KEY_HISTOGRAM[] ; \ static const char KEY_ISO_MODE[]; \ static const char KEY_LENSSHADE[] ; \ static const char KEY_MAX_CONTRAST[]; \ static const char KEY_MAX_SATURATION[]; \ static const char KEY_MAX_SHARPNESS[]; \ static const char KEY_MEMORY_COLOR_ENHANCEMENT[]; \ static const char KEY_MIN_CONTRAST[]; \ static const char KEY_MIN_SATURATION[]; \ static const char KEY_MIN_SHARPNESS[]; \ static const char KEY_OIS_MODE[]; \ static const char KEY_OIS_SUPPORT[]; \ static const char KEY_POWER_MODE_SUPPORTED[]; \ static const char KEY_POWER_MODE[]; \ static const char KEY_PREVIEW_FRAME_RATE_AUTO_MODE[]; \ static const char KEY_PREVIEW_FRAME_RATE_FIXED_MODE[]; \ static const char KEY_PREVIEW_FRAME_RATE_MODE[]; \ static const char KEY_REDEYE_REDUCTION[]; \ static const char KEY_SATURATION[]; \ static const char KEY_SCENE_DETECT[]; \ static const char KEY_SELECTABLE_ZONE_AF[]; \ static const char KEY_SHARPNESS[]; \ static const char KEY_SINGLE_ISP_OUTPUT_ENABLED[]; \ static const char KEY_SKIN_TONE_ENHANCEMENT[]; \ static const char KEY_SUPPORTED_AUTO_EXPOSURE[]; \ static const char KEY_SUPPORTED_CAPTURE_MODES[]; \ static const char KEY_SUPPORTED_DENOISE[]; \ static const char KEY_SUPPORTED_FACE_DETECTION[]; \ static const char KEY_SUPPORTED_HDR_IMAGING_MODES[]; \ static const char KEY_SUPPORTED_HFR_SIZES[]; \ static const char KEY_SUPPORTED_HISTOGRAM_MODES[] ; \ static const char KEY_SUPPORTED_ISO_MODES[]; \ static const char KEY_SUPPORTED_LENSSHADE_MODES[] ; \ static const char KEY_SUPPORTED_MEM_COLOR_ENHANCE_MODES[]; \ static const char KEY_SUPPORTED_PREVIEW_FRAME_RATE_MODES[]; \ static const char KEY_SUPPORTED_REDEYE_REDUCTION[]; \ static const char KEY_SUPPORTED_SCENE_DETECT[]; \ static const char KEY_SUPPORTED_SELECTABLE_ZONE_AF[]; \ static const char KEY_SUPPORTED_SKIN_TONE_ENHANCEMENT_MODES[]; \ static const char KEY_SUPPORTED_TOUCH_AF_AEC[]; \ static const char KEY_SUPPORTED_VIDEO_HIGH_FRAME_RATE_MODES[]; \ static const char KEY_SUPPORTED_ZSL_MODES[]; \ static const char KEY_TIME_CONS_POST_PROCESSING[]; \ static const char KEY_TOUCH_AF_AEC[]; \ static const char KEY_TOUCH_INDEX_AEC[]; \ static const char KEY_TOUCH_INDEX_AF[]; \ static const char KEY_VIDEO_HIGH_FRAME_RATE[]; \ static const char KEY_ZSL[]; \ static const char LENSSHADE_DISABLE[] ; \ static const char LENSSHADE_ENABLE[] ; \ static const char LOW_POWER[]; \ static const char MCE_DISABLE[]; \ static const char MCE_ENABLE[]; \ static const char NORMAL_POWER[]; \ static const char OIS_MODE_OFF[]; \ static const char OIS_MODE_ON[]; \ static const char PIXEL_FORMAT_NV12[]; \ static const char PIXEL_FORMAT_RAW[]; \ static const char PIXEL_FORMAT_YUV420SP_ADRENO[]; \ static const char PIXEL_FORMAT_YV12[]; \ static const char POST_PROCESSING_BYPASS[]; \ static const char POST_PROCESSING_DELAY[]; \ static const char POST_PROCESSING_ENABLE[]; \ static const char REDEYE_REDUCTION_DISABLE[]; \ static const char REDEYE_REDUCTION_ENABLE[]; \ static const char SCENE_DETECT_OFF[]; \ static const char SCENE_DETECT_ON[]; \ static const char SCENE_MODE_AR[]; \ static const char SCENE_MODE_BACKLIGHT[]; \ static const char SCENE_MODE_FLOWERS[]; \ static const char SCENE_MODE_OFF[]; \ static const char SCENE_MODE_TEXT[]; \ static const char SELECTABLE_ZONE_AF_AUTO[]; \ static const char SELECTABLE_ZONE_AF_CENTER_WEIGHTED[]; \ static const char SELECTABLE_ZONE_AF_FRAME_AVERAGE[]; \ static const char SELECTABLE_ZONE_AF_SPOT_METERING[]; \ static const char SKIN_TONE_ENHANCEMENT_DISABLE[]; \ static const char SKIN_TONE_ENHANCEMENT_ENABLE[]; \ static const char TOUCH_AF_AEC_OFF[] ; \ static const char TOUCH_AF_AEC_ON[] ; \ static const char VIDEO_HFR_2X[]; \ static const char VIDEO_HFR_3X[]; \ static const char VIDEO_HFR_4X[]; \ static const char VIDEO_HFR_OFF[]; \ static const char ZSL_OFF[]; \ static const char ZSL_ON[]; \ enum { \ CAMERA_ORIENTATION_UNKNOWN = 0, \ CAMERA_ORIENTATION_PORTRAIT = 1, \ CAMERA_ORIENTATION_LANDSCAPE = 2, \ }; \ int getOrientation() const; \ void setOrientation(int orientation); \ void setPreviewFpsRange(int minFPS,int maxFPS); \ void getSupportedHfrSizes(Vector<Size> &sizes) const; \ void getMeteringAreaCenter(int * x, int *y) const; \
48.872611
106
0.718102
de17a499c840c71d0ea7c01f8e8aebbf6bbf6fb9
1,545
c
C
chapter-01/exercise-01-14/main.c
GiorgiBeriashvili/the-c-programming-language-second-edition-solutions
12b9471354a7df65950979efddc5013726ed0196
[ "Apache-2.0", "MIT" ]
null
null
null
chapter-01/exercise-01-14/main.c
GiorgiBeriashvili/the-c-programming-language-second-edition-solutions
12b9471354a7df65950979efddc5013726ed0196
[ "Apache-2.0", "MIT" ]
null
null
null
chapter-01/exercise-01-14/main.c
GiorgiBeriashvili/the-c-programming-language-second-edition-solutions
12b9471354a7df65950979efddc5013726ed0196
[ "Apache-2.0", "MIT" ]
null
null
null
/* Write a program to print a histogram of the frequencies of different * characters in its input. */ #include <stdio.h> #define START_CODE 33 #define END_CODE 126 #define MAXIMUM_LENGTH (END_CODE - START_CODE) int main() { int input, character_frequencies[MAXIMUM_LENGTH]; for (int index = 0; index < MAXIMUM_LENGTH; index++) { character_frequencies[index] = 0; } printf("Please enter characters (Ctrl + D to submit): "); while ((input = getchar()) != EOF) { if (input >= START_CODE && input <= END_CODE) { character_frequencies[input - START_CODE]++; } } int maximum_frequency = 0; for (int index = 0; index < MAXIMUM_LENGTH; index++) { if (maximum_frequency < character_frequencies[index]) { maximum_frequency = character_frequencies[index]; } } printf("\n\nCharacter frequency histogram (vertical orientation):\n\n"); for (int index = maximum_frequency; index != 0; index--) { printf("%3d |", index); for (int length = 0; length < MAXIMUM_LENGTH; length++) { if (index <= character_frequencies[length]) { putchar('*'); } else { putchar(' '); } } printf("\n"); } printf(" "); for (int index = START_CODE; index <= END_CODE; index++) { putchar('-'); } printf("\n "); for (int index = START_CODE; index <= END_CODE; index++) { putchar(index); } putchar('\n'); }
24.52381
76
0.563754
e12162a21e4d6959bc746723edb18b0f217090d6
413
h
C
HDNetwork/JSON/HDBaseJSONPageParam.h
zhangdadi/HDNetwork
449200e4af1ccb2d62fea75e5c9e1dd9ce0464a6
[ "MIT" ]
null
null
null
HDNetwork/JSON/HDBaseJSONPageParam.h
zhangdadi/HDNetwork
449200e4af1ccb2d62fea75e5c9e1dd9ce0464a6
[ "MIT" ]
null
null
null
HDNetwork/JSON/HDBaseJSONPageParam.h
zhangdadi/HDNetwork
449200e4af1ccb2d62fea75e5c9e1dd9ce0464a6
[ "MIT" ]
null
null
null
// // BaseJSONPageParam.h // HDServices // // Created by zhangdadi on 15/6/30. // Copyright (c) 2015年 HD. All rights reserved. // #import "HDBaseJSONParam.h" @interface HDBaseJSONPageParam : HDBaseJSONParam @property (nonatomic, assign) NSInteger pageIndex; //默认为1 /** * 子类修改默认的分页大小时在Init方法里调用,外部不要调用。 * * @param pageSize 分页大小,默认为10 * */ - (instancetype)initWithPageSize:(NSInteger)pageSize; @end
17.208333
57
0.714286
f55b91846af9d719c5f37ce118d488dfac8ea51b
2,257
h
C
PrivateFrameworks/ChatKit.framework/CKAudioController.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
36
2016-04-20T04:19:04.000Z
2018-10-08T04:12:25.000Z
PrivateFrameworks/ChatKit.framework/CKAudioController.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
null
null
null
PrivateFrameworks/ChatKit.framework/CKAudioController.h
shaojiankui/iOS10-Runtime-Headers
6b0d842bed0c52c2a7c1464087b3081af7e10c43
[ "MIT" ]
10
2016-06-16T02:40:44.000Z
2019-01-15T03:31:45.000Z
/* Generated by RuntimeBrowser Image: /System/Library/PrivateFrameworks/ChatKit.framework/ChatKit */ @interface CKAudioController : NSObject <CKAudioPlayerDelegate> { CKAudioPlayer * _audioPlayer; unsigned long long _currentIndex; <CKAudioControllerDelegate> * _delegate; bool _interrupted; CKAudioPlayer * _listenAudioPlayer; NSMutableArray * _mediaObjects; bool _paused; bool _playing; bool _shouldUseSpeaker; } @property (setter=_setMediaObjects:, nonatomic, retain) NSMutableArray *_mediaObjects; @property (nonatomic, retain) CKAudioPlayer *audioPlayer; @property (nonatomic, readonly) CKMediaObject *currentMediaObject; @property (nonatomic, readonly) double currentMediaObjectDuration; @property (nonatomic, readonly) double currentMediaObjectTime; @property (readonly, copy) NSString *debugDescription; @property (nonatomic) <CKAudioControllerDelegate> *delegate; @property (readonly, copy) NSString *description; @property (readonly) unsigned long long hash; @property (nonatomic) bool interrupted; @property (nonatomic, readonly) NSArray *mediaObjects; @property (getter=isPaused, nonatomic) bool paused; @property (getter=isPlaying, nonatomic) bool playing; @property (nonatomic) bool shouldUseSpeaker; @property (readonly) Class superclass; - (void).cxx_destruct; - (id)_mediaObjects; - (void)_setMediaObjects:(id)arg1; - (void)addMediaObject:(id)arg1; - (void)addMediaObjects:(id)arg1; - (id)audioPlayer; - (void)audioPlayerCurrentTimeDidChange:(id)arg1; - (void)audioPlayerDidFinishPlaying:(id)arg1; - (void)audioSessionInterruption:(id)arg1; - (id)currentMediaObject; - (double)currentMediaObjectDuration; - (double)currentMediaObjectTime; - (void)dealloc; - (id)delegate; - (id)initWithMediaObjects:(id)arg1; - (bool)interrupted; - (bool)isPaused; - (bool)isPlaying; - (id)mediaObjects; - (void)pause; - (void)play; - (void)playAfterDelay:(double)arg1; - (void)playListenEndSound:(id /* block */)arg1; - (void)playListenSound:(id /* block */)arg1; - (void)setAudioPlayer:(id)arg1; - (void)setDelegate:(id)arg1; - (void)setInterrupted:(bool)arg1; - (void)setPaused:(bool)arg1; - (void)setPlaying:(bool)arg1; - (void)setShouldUseSpeaker:(bool)arg1; - (bool)shouldUseSpeaker; - (void)stop; @end
33.686567
86
0.763846
67253a7de500bcd73dffdfb158fc4831202f60e4
6,210
h
C
graph/igraph-0.6/include/igraph_structural.h
FlyerMaxwell/Bubble
70ca988bca3a5debce5d9c61f203b08005bdefaf
[ "MIT" ]
4
2016-03-30T14:31:52.000Z
2019-02-02T05:01:32.000Z
graph/igraph-0.6/include/igraph_structural.h
FlyerMaxwell/Bubble
70ca988bca3a5debce5d9c61f203b08005bdefaf
[ "MIT" ]
null
null
null
graph/igraph-0.6/include/igraph_structural.h
FlyerMaxwell/Bubble
70ca988bca3a5debce5d9c61f203b08005bdefaf
[ "MIT" ]
1
2019-03-05T06:24:02.000Z
2019-03-05T06:24:02.000Z
/* -*- mode: C -*- */ /* IGraph library. Copyright (C) 2009-2012 Gabor Csardi <csardi.gabor@gmail.com> 334 Harvard street, Cambridge, MA 02139 USA 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef IGRAPH_STRUCTURAL_H #define IGRAPH_STRUCTURAL_H #undef __BEGIN_DECLS #undef __END_DECLS #ifdef __cplusplus # define __BEGIN_DECLS extern "C" { # define __END_DECLS } #else # define __BEGIN_DECLS /* empty */ # define __END_DECLS /* empty */ #endif #include "igraph_constants.h" #include "igraph_types.h" #include "igraph_vector.h" #include "igraph_matrix.h" #include "igraph_datatype.h" #include "igraph_iterators.h" #include "igraph_attributes.h" #include "igraph_sparsemat.h" __BEGIN_DECLS /* -------------------------------------------------- */ /* Basic query functions */ /* -------------------------------------------------- */ int igraph_are_connected(const igraph_t *graph, igraph_integer_t v1, igraph_integer_t v2, igraph_bool_t *res); /* -------------------------------------------------- */ /* Structural properties */ /* -------------------------------------------------- */ int igraph_minimum_spanning_tree(const igraph_t *graph, igraph_vector_t *res, const igraph_vector_t *weights); int igraph_minimum_spanning_tree_unweighted(const igraph_t *graph, igraph_t *mst); int igraph_minimum_spanning_tree_prim(const igraph_t *graph, igraph_t *mst, const igraph_vector_t *weights); int igraph_subcomponent(const igraph_t *graph, igraph_vector_t *res, igraph_real_t vid, igraph_neimode_t mode); int igraph_rewire(igraph_t *graph, igraph_integer_t n, igraph_rewiring_t mode); int igraph_subgraph(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids); int igraph_induced_subgraph_map(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids, igraph_subgraph_implementation_t impl, igraph_vector_t *map, igraph_vector_t *invmap); int igraph_induced_subgraph(const igraph_t *graph, igraph_t *res, const igraph_vs_t vids, igraph_subgraph_implementation_t impl); int igraph_subgraph_edges(const igraph_t *graph, igraph_t *res, const igraph_es_t eids, igraph_bool_t delete_vertices); int igraph_simplify(igraph_t *graph, igraph_bool_t multiple, igraph_bool_t loops, const igraph_attribute_combination_t *edge_comb); int igraph_reciprocity(const igraph_t *graph, igraph_real_t *res, igraph_bool_t ignore_loops, igraph_reciprocity_t mode); int igraph_maxdegree(const igraph_t *graph, igraph_integer_t *res, igraph_vs_t vids, igraph_neimode_t mode, igraph_bool_t loops); int igraph_density(const igraph_t *graph, igraph_real_t *res, igraph_bool_t loops); int igraph_is_loop(const igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); int igraph_is_simple(const igraph_t *graph, igraph_bool_t *res); int igraph_has_multiple(const igraph_t *graph, igraph_bool_t *res); int igraph_is_multiple(const igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); int igraph_count_multiple(const igraph_t *graph, igraph_vector_t *res, igraph_es_t es); int igraph_girth(const igraph_t *graph, igraph_integer_t *girth, igraph_vector_t *circle); int igraph_add_edge(igraph_t *graph, igraph_integer_t from, igraph_integer_t to); int igraph_unfold_tree(const igraph_t *graph, igraph_t *tree, igraph_neimode_t mode, const igraph_vector_t *roots, igraph_vector_t *vertex_index); int igraph_is_mutual(igraph_t *graph, igraph_vector_bool_t *res, igraph_es_t es); int igraph_maximum_cardinality_search(const igraph_t *graph, igraph_vector_t *alpha, igraph_vector_t *alpham1); int igraph_is_chordal(const igraph_t *graph, const igraph_vector_t *alpha, const igraph_vector_t *alpham1, igraph_bool_t *chordal, igraph_vector_t *fill_in, igraph_t *newgraph); int igraph_avg_nearest_neighbor_degree(const igraph_t *graph, igraph_vs_t vids, igraph_vector_t *knn, igraph_vector_t *knnk, const igraph_vector_t *weights); int igraph_contract_vertices(igraph_t *graph, const igraph_vector_t *mapping, const igraph_attribute_combination_t *vertex_comb); int igraph_transitive_closure_dag(const igraph_t *graph, igraph_t *closure); int igraph_feedback_arc_set(const igraph_t *graph, igraph_vector_t *result, const igraph_vector_t *weights, igraph_fas_algorithm_t algo); int igraph_diversity(igraph_t *graph, const igraph_vector_t *weights, igraph_vector_t *res, const igraph_vs_t vs); /* -------------------------------------------------- */ /* Spectral Properties */ /* -------------------------------------------------- */ int igraph_laplacian(const igraph_t *graph, igraph_matrix_t *res, igraph_sparsemat_t *sparseres, igraph_bool_t normalized, const igraph_vector_t *weights); /* -------------------------------------------------- */ /* Internal functions, may change any time */ /* -------------------------------------------------- */ int igraph_i_feedback_arc_set_undirected(const igraph_t *graph, igraph_vector_t *result, const igraph_vector_t *weights, igraph_vector_t *layering); int igraph_i_feedback_arc_set_eades(const igraph_t *graph, igraph_vector_t *result, const igraph_vector_t *weights, igraph_vector_t *layering); __END_DECLS #endif
39.303797
110
0.69211
679360227d7c491156fc2f814244f392ed904094
6,571
h
C
include/osdp_conformance.h
JixunW-BSquare/libosdp-conformance
f6d0c981ffbb46762c171f11aba6e36d34bf5c9d
[ "Apache-2.0" ]
null
null
null
include/osdp_conformance.h
JixunW-BSquare/libosdp-conformance
f6d0c981ffbb46762c171f11aba6e36d34bf5c9d
[ "Apache-2.0" ]
null
null
null
include/osdp_conformance.h
JixunW-BSquare/libosdp-conformance
f6d0c981ffbb46762c171f11aba6e36d34bf5c9d
[ "Apache-2.0" ]
null
null
null
/* osdp_conformance.h - conformance metrics per profiles (C)Copyright 2014-2017 Smithee,Spelvin,Agnew & Plinge, Inc. 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. Support provided by the Security Industry Association http://www.securityindustry.org */ #pragma once #ifdef __cplusplus extern "C" { #endif #include "open-osdp.h" #define OCONFORM_UNTESTED (0) #define OCONFORM_EXERCISED (1) #define OCONFORM_EX_GOOD_ONLY (2) #define OCONFORM_FAIL (3) #define OCONFORM_SKIP (4) typedef struct osdp_conform { unsigned char test_status; } OSDP_CONFORM; typedef struct osdp_interop_assessment { int pass; int fail; int untested; int skipped; int conforming_messages; int last_unknown_command; // 2-x OSDP_CONFORM physical_interface; // 2-1-1 OSDP_CONFORM signalling; // 2-2-1 OSDP_CONFORM alt_speed_2; // 2-2-2 OSDP_CONFORM alt_speed_3; // 2-2-3 OSDP_CONFORM alt_speed_4; // 2-2-4 OSDP_CONFORM character_encoding; // 2-3-1 OSDP_CONFORM channel_access; // 2-4-1 OSDP_CONFORM timeout_resend; // 2-4-2 OSDP_CONFORM busy_resend; // 2-4-3 OSDP_CONFORM new_on_busy; // 2-4-4 OSDP_CONFORM multibyte_data_encoding; // 2-5-1 OSDP_CONFORM packet_size_limits; // 2-6-1 OSDP_CONFORM packet_size_from_pd; // 2-6-2 OSDP_CONFORM packet_size_stress_cp; // 2-6-3 OSDP_CONFORM timing; // 2-7-1 OSDP_CONFORM max_delay; // 2-7-2 OSDP_CONFORM offline_test; // 2-7-3 OSDP_CONFORM message_synchronization; // 2-8-1 OSDP_CONFORM packet_format; // 2-9-1 OSDP_CONFORM SOM; // 2-10-1 OSDP_CONFORM SOM_sent; // 2-10-2 OSDP_CONFORM ADDR; // 2-11-1 OSDP_CONFORM address_2; // 2-11-2 OSDP_CONFORM address_config; // 2-11-3 OSDP_CONFORM LEN; // 2-12-1 OSDP_CONFORM CTRL; // 2-13-1 OSDP_CONFORM control_2; // 2-13-2 OSDP_CONFORM scb_absent; // 2-13-3 OSDP_CONFORM ctl_seq; // 2-13-4 OSDP_CONFORM security_block; // 2-14-1 OSDP_CONFORM CMND_REPLY; // 2-15-1 OSDP_CONFORM invalid_command; // 2-15-2 OSDP_CONFORM CHKSUM_CRC16; // 2-16-1 OSDP_CONFORM checksum; // 2-16-2 OSDP_CONFORM multipart; // 2.17 // 3-x OSDP_CONFORM cmd_poll; // 3-1-1 OSDP_CONFORM cmd_poll_raw; // 3-1-2 OSDP_CONFORM cmd_poll_lstatr; // 3-1-3 OSDP_CONFORM cmd_poll_response_4; // 3-1-4 OSDP_CONFORM cmd_id; // 3-2-1 OSDP_CONFORM cmd_pdcap; // 3-3-1 OSDP_CONFORM cmd_diag; // 3-4-1 OSDP_CONFORM cmd_lstat; // 3-5-1 OSDP_CONFORM cmd_istat; // 3-6-1 OSDP_CONFORM cmd_ostat; // 3-7-1 OSDP_CONFORM cmd_ostat_ack; // 3-7-2 OSDP_CONFORM cmd_rstat; // 3-8-1 OSDP_CONFORM cmd_out; // 3-9-1 OSDP_CONFORM cmd_led_red; // 3-10-1 OSDP_CONFORM cmd_led_green; // 3-10-2 OSDP_CONFORM cmd_buz; // 3-11-1 OSDP_CONFORM cmd_text; // 3-12-1 OSDP_CONFORM cmd_comset; // 3-13-1 OSDP_CONFORM cmd_prompt; // 3-16-1 OSDP_CONFORM cmd_bioread; // 3-17-1 OSDP_CONFORM cmd_biomatch; // 3-18-1 OSDP_CONFORM cmd_keyset; // 3-??-1 OSDP_CONFORM cmd_chlng; // 3-??-1 OSDP_CONFORM cmd_scrypt; // 3-??-1 // OSDP_CONFORM cmd_cont; // 3-19-1 OSDP_CONFORM cmd_mfg; // 3-20-1 OSDP_CONFORM cmd_stop_multi; // 3-21-1 OSDP_CONFORM cmd_max_rec; // 3-22-1 // 4-x Replies OSDP_CONFORM rep_ack; // 4-1-1 OSDP_CONFORM rep_nak; // 4-2-1 OSDP_CONFORM rep_device_ident; // 4-3-1 OSDP_CONFORM resp_ident_consistent; // 4-3-2 OSDP_CONFORM rep_device_capas; // 4-4-1 OSDP_CONFORM rep_capas_consistent; // 4-4-2 OSDP_CONFORM resp_lstatr; // 4-5-1 OSDP_CONFORM resp_lstatr_tamper; // 4-5-2 OSDP_CONFORM resp_lstatr_power; // 4-5-3 OSDP_CONFORM resp_input_stat; // 4-6-1 OSDP_CONFORM resp_input_consistent; // 4-6-2 OSDP_CONFORM resp_output_stat; // 4-7-1 OSDP_CONFORM resp_ostatr_poll; // 4-7-2 OSDP_CONFORM resp_ostatr_range; // 4-7-3 OSDP_CONFORM resp_rstatr; // 4-8-1 OSDP_CONFORM rep_raw; // 4-9 OSDP_CONFORM rep_formatted; // 4-10-1 OSDP_CONFORM resp_keypad; // 4-11-1 OSDP_CONFORM resp_com; // 4-12-1 OSDP_CONFORM rep_scan_send; // 4-13 OSDP_CONFORM rep_scan_match; // 4-14 OSDP_CONFORM rep_ccrypt; // 4-?? OSDP_CONFORM resp_mfg; // 4-15-1 OSDP_CONFORM resp_busy; // 4-16-1 } OSDP_INTEROP_ASSESSMENT; #define PARAM_MMT (8) // minimum message thresshold #define SET_PASS(ctx, testnum) \ { \ (void)osdp_conform_confirm(testnum); \ fprintf(stderr, "********Test %s PASSED********\n", testnum); \ fprintf(ctx->log, "********Test %s PASSED********\n", testnum); \ ctx->test_in_progress[0] = 0; \ }; #define SET_FAIL(ctx, testnum) \ { \ (void)osdp_conform_fail(testnum); \ fprintf(stderr, "********Test %s FAILED********\n", testnum); \ fprintf(ctx->log, "********Test %s FAILED********\n", testnum); \ ctx->test_in_progress[0] = 0; \ }; void dump_conformance(OSDP_CONTEXT* ctx, OSDP_INTEROP_ASSESSMENT* oconf); int osdp_conform_confirm(char* test); int osdp_conform_fail(char* test); #ifdef __cplusplus } #endif
38.881657
74
0.57419
9137abd1fe2f710fb4284017e6ffe1d5201b2ea6
1,010
c
C
libft/ft_memdel.c
HarpyWar/sh21
88b3e6dfca97fb4933c0f057dd276c612bde27a9
[ "MIT" ]
null
null
null
libft/ft_memdel.c
HarpyWar/sh21
88b3e6dfca97fb4933c0f057dd276c612bde27a9
[ "MIT" ]
null
null
null
libft/ft_memdel.c
HarpyWar/sh21
88b3e6dfca97fb4933c0f057dd276c612bde27a9
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_memdel.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: kemmeric <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/23 18:53:35 by kemmeric #+# #+# */ /* Updated: 2018/11/24 14:18:37 by kemmeric ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" void ft_memdel(void **ap) { if (ap == NULL || *ap == NULL) return ; free(*ap); *ap = NULL; }
45.909091
80
0.156436
0b233f306baed52018516514cbe8bc991081abe3
2,529
h
C
SerialPort/SerialPort/TinyStream.h
00steve/IOLib
fcbc5adde6b24e597a65ff7e012acc962ea1b468
[ "MIT" ]
null
null
null
SerialPort/SerialPort/TinyStream.h
00steve/IOLib
fcbc5adde6b24e597a65ff7e012acc962ea1b468
[ "MIT" ]
null
null
null
SerialPort/SerialPort/TinyStream.h
00steve/IOLib
fcbc5adde6b24e597a65ff7e012acc962ea1b468
[ "MIT" ]
null
null
null
#pragma once #define DATAFLOWDIRECTION_NONE 0 #define DATAFLOWDIRECTION_WRITE 1 #define DATAFLOWDIRECTION_READ 2 #define DATAFLOWDIRECTION_BIDIRECTIONAL 3 /* HOW DATA IS INTERPRETED: - Send out a ping to see if it gets a reply. - If a valid reply is recieved, send a request for the stream properties - The foreign device should send back some bytes formatted like so: byte[n0] : pair request byte[no{0,1}] : x00xxxxxx: 0 = greeting (are you there?) x01xxxxxx: 1 = reply (include what type of information flow should be included [n0{2,3}] x10xxxxxx: 2 = update (include extra data that will change the contract) byte[n0{2,3}] : x0000xxxx: 0 = greeting (just send back that you exist) x0001xxxx:16: 1 = greeting (reply to me) x0100xxxx: 0 = reply (no data flow) x0101xxxx: 1 = reply (sending information) x0110xxxx: 2 = reply (receiving information) x0111xxxx: 3 = reply (bi-directional data flow) x1000xxxx: 0 = update if a reply is recieved of 3, we should expect that the data flow being sent will be sent, but that we should send back any data that we are going to send in the other direction. byte[n0] : streamCount = how many data streams there are (0-255) byte[n1-streamCount-n1^]: byte[n1] : streamNameLength = length of name of stream byte[n2-streamNameLength+n1] : characters of name of stream byte[n3{0}] : is array byte[n3{1}] : is array variable length byte[n3{2,3}] : if array, set data type to use to get the number of objects in the array to return, or the data type that is used to count the current number of items to return if variable size array byte[n3{4,5,6}] : type of data (up to 8 values) 0 = bit stream (1 bit)(boolean) 1 = char (1 byte) 2 = short (2 bytes) 3 = int (4 bytes) 4 = long (8 bytes) 5 = float (4 bytes) 6 = double (8 bytes) 7 = long double (12 byte) byte[n3{7}] : sub-type of data (doesn't really matter for how the data is stored) 0 = char[unsigned], short[unsigned], int[unsigned], long[unsigned] 1 = char[signed], short[signed], int[signed], long[signed] */ #include <iostream> #include "IIO.h" class TinyStream{ private: unsigned char dataFlowDirection; IIO* IO; unsigned char state; public: void SetDataFlowDirection(const unsigned char dataFlowDirection); bool SetInput(IIO* IO); TinyStream(); ~TinyStream(); /*do everything it needs to do, based on the state it's in. If it hasn't paired with anything, set up the contract, if it has, try to read data from it.*/ bool Update(); };
28.1
99
0.709767
21ec5e41a4ffcd7d838e32de761822467a8f31ef
4,143
h
C
fblualib/LuaUtils.h
waderly/fblualib
bf629daf05a178234bc09edb4ca0821e1da2cd14
[ "BSD-3-Clause" ]
1
2015-11-05T18:34:22.000Z
2015-11-05T18:34:22.000Z
fblualib/LuaUtils.h
waderly/fblualib
bf629daf05a178234bc09edb4ca0821e1da2cd14
[ "BSD-3-Clause" ]
null
null
null
fblualib/LuaUtils.h
waderly/fblualib
bf629daf05a178234bc09edb4ca0821e1da2cd14
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2014, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. * */ #ifndef FBLUA_LUAUTILS_H_ #define FBLUA_LUAUTILS_H_ #include <lua.hpp> #include <thpp/Tensor.h> #include <folly/Optional.h> #include <folly/Range.h> namespace fblualib { // Functions without a Checked suffix return an Optional<T> for an appropriate // T. The Optional will be empty on failure. Functions with a Checked suffix // return T and raise a Lua error on failure. // // Functions without GetFieldIf in the name return the object at the // requested index on the lua stack, and leave the stack unchanged. Functions // with GetFieldIf return the object from a field in the table at the // requested index, and also push the returned object on the stack. // // Note that the GetString functions may return references to the stack. // Retrieve string. // strict = require that it's an actual string (and not a number // convertible to a string) // Even though those functions return StringPiece (which is usually not // null-terminated), these functions guarantee that the returned string is // null-terminated. folly::Optional<folly::StringPiece> luaGetString(lua_State* L, int ud, bool strict=false); folly::StringPiece luaGetStringChecked(lua_State* L, int ud, bool strict=false); folly::Optional<folly::StringPiece> luaGetFieldIfString(lua_State* L, int ud, bool strict=false); folly::StringPiece luaGetFieldIfStringChecked(lua_State* L, int ud, const char* field, bool strict=false); // Retrieve number // strict = require that it's an actual number (and not a string // convertible to a number) template <class NT> folly::Optional<NT> luaGetNumber(lua_State* L, int ud, bool strict=false); template <class NT> NT luaGetNumberChecked(lua_State* L, int ud, bool strict=false); template <class NT> folly::Optional<NT> luaGetFieldIfNumber( lua_State* L, int ud, const char* field, bool strict=false); template <class NT> NT luaGetFieldIfNumberChecked(lua_State* L, int ud, const char* field, bool strict=false); // Retrieve tensor template <class NT> folly::Optional<thpp::Tensor<NT>> luaGetTensor(lua_State* L, int ud); template <class NT> thpp::Tensor<NT> luaGetTensorChecked(lua_State* L, int ud); template <class NT> folly::Optional<thpp::Tensor<NT>> luaGetFieldIfTensor( lua_State* L, int ud, const char* field); template <class NT> thpp::Tensor<NT> luaGetFieldIfTensorChecked(lua_State* L, int ud, const char* field); // Push a tensor onto the stack template <class NT> void luaPushTensor(lua_State* L, thpp::Tensor<NT> tensor); // Retrieve storage template <class NT> folly::Optional<thpp::Storage<NT>> luaGetStorage(lua_State* L, int ud); template <class NT> thpp::Storage<NT> luaGetStorageChecked(lua_State* L, int ud); template <class NT> folly::Optional<thpp::Storage<NT>> luaGetFieldIfStorage( lua_State* L, int ud, const char* field); template <class NT> thpp::Storage<NT> luaGetFieldIfStorageChecked( lua_State* L, int ud, const char* field); // Push a storage onto the stack template <class NT> void luaPushStorage(lua_State* L, thpp::Storage<NT> storage); // Return the length of a list-like table at the given stack index. // Different from lua_objlen in that it guarantees that it will return the // smallest N for which all indexes i, 1 <= i <= N, exist in the table, // but O(N) (as it iterates through the table), unlike lua_objlen, which may // be faster. folly::Optional<size_t> luaListSize(lua_State* L, int ud); size_t luaListSizeChecked(lua_State* L, int ud); } // namespaces #include <fblualib/LuaUtils-inl.h> #endif /* FBLUA_LUAUTILS_H_ */
38.009174
79
0.691769
42eee0789e460866eb184bfd13e2bb196c33dce2
2,061
c
C
cmake_targets/lte_build_oai/build/CMakeFiles/ue_ip/ue_ip.mod.c
1245405062/openairinterface5g
8968bbc3361d53fac63b4474f9b1c2e7ee5001ec
[ "Apache-2.0" ]
1
2019-02-22T21:34:04.000Z
2019-02-22T21:34:04.000Z
cmake_targets/oaisim_build_oai/build/CMakeFiles/ue_ip/ue_ip.mod.c
1245405062/openairinterface5g
8968bbc3361d53fac63b4474f9b1c2e7ee5001ec
[ "Apache-2.0" ]
null
null
null
cmake_targets/oaisim_build_oai/build/CMakeFiles/ue_ip/ue_ip.mod.c
1245405062/openairinterface5g
8968bbc3361d53fac63b4474f9b1c2e7ee5001ec
[ "Apache-2.0" ]
null
null
null
#include <linux/module.h> #include <linux/vermagic.h> #include <linux/compiler.h> MODULE_INFO(vermagic, VERMAGIC_STRING); __visible struct module __this_module __attribute__((section(".gnu.linkonce.this_module"))) = { .name = KBUILD_MODNAME, .init = init_module, #ifdef CONFIG_MODULE_UNLOAD .exit = cleanup_module, #endif .arch = MODULE_ARCH_INIT, }; static const struct modversion_info ____versions[] __used __attribute__((section("__versions"))) = { { 0x320bde84, __VMLINUX_SYMBOL_STR(module_layout) }, { 0xda3e43d1, __VMLINUX_SYMBOL_STR(_raw_spin_unlock) }, { 0xc996d097, __VMLINUX_SYMBOL_STR(del_timer) }, { 0x593a99b, __VMLINUX_SYMBOL_STR(init_timer_key) }, { 0x91715312, __VMLINUX_SYMBOL_STR(sprintf) }, { 0x7d11c268, __VMLINUX_SYMBOL_STR(jiffies) }, { 0x964f919a, __VMLINUX_SYMBOL_STR(__netdev_alloc_skb) }, { 0x6e337b9c, __VMLINUX_SYMBOL_STR(netif_rx) }, { 0xe471a929, __VMLINUX_SYMBOL_STR(netif_tx_wake_queue) }, { 0x27e1a049, __VMLINUX_SYMBOL_STR(printk) }, { 0x54f0a0, __VMLINUX_SYMBOL_STR(netlink_kernel_release) }, { 0xfbe2a179, __VMLINUX_SYMBOL_STR(free_netdev) }, { 0xabb6c586, __VMLINUX_SYMBOL_STR(register_netdev) }, { 0x16305289, __VMLINUX_SYMBOL_STR(warn_slowpath_null) }, { 0x1de39e5d, __VMLINUX_SYMBOL_STR(netlink_unicast) }, { 0xbe2c0274, __VMLINUX_SYMBOL_STR(add_timer) }, { 0x47eee06c, __VMLINUX_SYMBOL_STR(init_net) }, { 0x3d0bbd1a, __VMLINUX_SYMBOL_STR(__alloc_skb) }, { 0xdb7305a1, __VMLINUX_SYMBOL_STR(__stack_chk_fail) }, { 0x25ee7bf8, __VMLINUX_SYMBOL_STR(alloc_netdev_mqs) }, { 0xbdfb6dbb, __VMLINUX_SYMBOL_STR(__fentry__) }, { 0xd52bf1ce, __VMLINUX_SYMBOL_STR(_raw_spin_lock) }, { 0xc46deeed, __VMLINUX_SYMBOL_STR(__netlink_kernel_create) }, { 0x69acdf38, __VMLINUX_SYMBOL_STR(memcpy) }, { 0x6dee8cbf, __VMLINUX_SYMBOL_STR(unregister_netdev) }, { 0xcd14794f, __VMLINUX_SYMBOL_STR(consume_skb) }, { 0xac65652, __VMLINUX_SYMBOL_STR(skb_put) }, }; static const char __module_depends[] __used __attribute__((section(".modinfo"))) = "depends="; MODULE_INFO(srcversion, "533BB7E5866E52F63B9ACCB");
36.803571
63
0.785541
abd0c7415dcdb1f55c602f54f1df760b6307dbc0
118
c
C
regression/cbmc/pointer-primitive-check-02/main.c
remi-delmas-3000/cbmc
08d5056b83948e8af96bca7766ef3b10b5063611
[ "BSD-4-Clause" ]
412
2016-04-02T01:14:27.000Z
2022-03-27T09:24:09.000Z
regression/cbmc/pointer-primitive-check-02/main.c
remi-delmas-3000/cbmc
08d5056b83948e8af96bca7766ef3b10b5063611
[ "BSD-4-Clause" ]
4,671
2016-02-25T13:52:16.000Z
2022-03-31T22:14:46.000Z
regression/cbmc/pointer-primitive-check-02/main.c
remi-delmas-3000/cbmc
08d5056b83948e8af96bca7766ef3b10b5063611
[ "BSD-4-Clause" ]
266
2016-02-23T12:48:00.000Z
2022-03-22T18:15:51.000Z
#include <stdlib.h> char *p1; void main() { __CPROVER_r_ok(p1, 1); char *p2 = NULL; __CPROVER_r_ok(p2, 1); }
9.833333
24
0.610169
869857180a649c18fad74f2993455ef188aa8342
2,924
h
C
kaplademo/source/kaplaDemo/Fracture/Compound.h
ceti-dev/PhysX
c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa
[ "BSD-3-Clause" ]
2,372
2018-12-20T18:01:39.000Z
2022-03-31T09:58:37.000Z
kaplademo/source/kaplaDemo/Fracture/Compound.h
ceti-dev/PhysX
c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa
[ "BSD-3-Clause" ]
534
2018-12-20T20:04:42.000Z
2022-03-31T19:00:50.000Z
kaplademo/source/kaplaDemo/Fracture/Compound.h
ceti-dev/PhysX
c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa
[ "BSD-3-Clause" ]
694
2018-12-20T18:32:36.000Z
2022-03-16T03:45:42.000Z
// // 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. // // Copyright (c) 2018 NVIDIA Corporation. All rights reserved. #ifndef COMPOUND #define COMPOUND #include <foundation/PxVec3.h> #include <foundation/PxPlane.h> #include <foundation/PxBounds3.h> #include <foundation/PxTransform.h> #include <PsArray.h> #include <PxRigidDynamic.h> #include "Shader.h" #include "CompoundBase.h" using namespace physx; class Convex; class Particles; class Mesh; class SimScene; class CompoundGeometry; class XMLParser; class ShaderShadow; using namespace physx::fracture; class Compound : public base::Compound { friend class SimScene; protected: Compound(SimScene* scene, PxReal contactOffset = 0.005f, PxReal restOffset = -0.001f): physx::fracture::base::Compound((base::SimScene*)scene,contactOffset,restOffset) {} public: virtual void convexAdded(base::Convex* c, Shader* shader); virtual void convexRemoved(base::Convex* c); bool createFromXml(XMLParser *p, float scale, const PxTransform &trans, bool ignoreVisualMesh = false); void setShader(Shader* shader, const ShaderMaterial &mat) { mShader = shader; mShaderMat = mat; } Shader* getShader() const { return mShader; } const ShaderMaterial& getShaderMat() { return mShaderMat; } virtual void draw(bool useShader, bool debug = false); virtual void clear(); virtual void copyShaders(base::Compound*); protected: virtual float getSleepingThresholdRB(); Shader *mShader; ShaderMaterial mShaderMat; }; #endif
33.609195
104
0.764706
58a7f7e3c173c4bb3812cd24641af2186e7bef11
26
h
C
tests/test-c/unbal3.h
schra/pcpp
456ba646e5325bbf3c80e65c42cde7662e7132d6
[ "BSD-3-Clause" ]
146
2017-02-08T01:03:30.000Z
2022-03-29T07:54:59.000Z
tests/test-c/unbal3.h
schra/pcpp
456ba646e5325bbf3c80e65c42cde7662e7132d6
[ "BSD-3-Clause" ]
67
2017-07-22T11:08:05.000Z
2022-01-21T14:12:22.000Z
tests/test-c/unbal3.h
schra/pcpp
456ba646e5325bbf3c80e65c42cde7662e7132d6
[ "BSD-3-Clause" ]
47
2017-04-19T07:35:07.000Z
2022-02-17T18:59:52.000Z
/* unbal3.h */ int unbal3;
13
14
0.615385
417e8afc6e40856dcc71d64d451bfb80155afe89
3,256
c
C
src/Ngap_TNGF-ID.c
neonkingfr/oai-libngapcodec
a36b8c44cdd8f9aee88527ad1d3c74d4caf8f9c4
[ "Apache-2.0" ]
2
2019-12-06T14:24:00.000Z
2021-02-25T05:55:58.000Z
src/Ngap_TNGF-ID.c
neonkingfr/oai-libngapcodec
a36b8c44cdd8f9aee88527ad1d3c74d4caf8f9c4
[ "Apache-2.0" ]
null
null
null
src/Ngap_TNGF-ID.c
neonkingfr/oai-libngapcodec
a36b8c44cdd8f9aee88527ad1d3c74d4caf8f9c4
[ "Apache-2.0" ]
6
2019-12-06T14:23:59.000Z
2021-04-08T06:33:21.000Z
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "NGAP-IEs" * found in "asn.1/Information Element Definitions.asn1" * `asn1c -pdu=all -fcompound-names -fno-include-deps -findirect-choice -gen-PER -D src` */ #include "Ngap_TNGF-ID.h" #include "Ngap_ProtocolIE-SingleContainer.h" static int memb_Ngap_tNGF_ID_constraint_1(const asn_TYPE_descriptor_t *td, const void *sptr, asn_app_constraint_failed_f *ctfailcb, void *app_key) { const BIT_STRING_t *st = (const BIT_STRING_t *)sptr; size_t size; if(!sptr) { ASN__CTFAIL(app_key, td, sptr, "%s: value not given (%s:%d)", td->name, __FILE__, __LINE__); return -1; } if(st->size > 0) { /* Size in bits */ size = 8 * st->size - (st->bits_unused & 0x07); } else { size = 0; } if((size == 32)) { /* Constraint check succeeded */ return 0; } else { ASN__CTFAIL(app_key, td, sptr, "%s: constraint failed (%s:%d)", td->name, __FILE__, __LINE__); return -1; } } static asn_oer_constraints_t asn_OER_memb_Ngap_tNGF_ID_constr_2 CC_NOTUSED = { { 0, 0 }, -1 /* (SIZE(0..MAX)) */}; static asn_per_constraints_t asn_PER_memb_Ngap_tNGF_ID_constr_2 CC_NOTUSED = { { APC_UNCONSTRAINED, -1, -1, 0, 0 }, { APC_CONSTRAINED | APC_EXTENSIBLE, 0, 0, 32, 32 } /* (SIZE(32..32,...)) */, 0, 0 /* No PER value map */ }; static asn_oer_constraints_t asn_OER_type_Ngap_TNGF_ID_constr_1 CC_NOTUSED = { { 0, 0 }, -1}; asn_per_constraints_t asn_PER_type_Ngap_TNGF_ID_constr_1 CC_NOTUSED = { { APC_CONSTRAINED, 1, 1, 0, 1 } /* (0..1) */, { APC_UNCONSTRAINED, -1, -1, 0, 0 }, 0, 0 /* No PER value map */ }; asn_TYPE_member_t asn_MBR_Ngap_TNGF_ID_1[] = { { ATF_NOFLAGS, 0, offsetof(struct Ngap_TNGF_ID, choice.tNGF_ID), (ASN_TAG_CLASS_CONTEXT | (0 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_BIT_STRING, 0, { &asn_OER_memb_Ngap_tNGF_ID_constr_2, &asn_PER_memb_Ngap_tNGF_ID_constr_2, memb_Ngap_tNGF_ID_constraint_1 }, 0, 0, /* No default value */ "tNGF-ID" }, { ATF_POINTER, 0, offsetof(struct Ngap_TNGF_ID, choice.choice_Extensions), (ASN_TAG_CLASS_CONTEXT | (1 << 2)), -1, /* IMPLICIT tag at current level */ &asn_DEF_Ngap_ProtocolIE_SingleContainer_127P40, 0, { 0, 0, 0 }, 0, 0, /* No default value */ "choice-Extensions" }, }; static const asn_TYPE_tag2member_t asn_MAP_Ngap_TNGF_ID_tag2el_1[] = { { (ASN_TAG_CLASS_CONTEXT | (0 << 2)), 0, 0, 0 }, /* tNGF-ID */ { (ASN_TAG_CLASS_CONTEXT | (1 << 2)), 1, 0, 0 } /* choice-Extensions */ }; asn_CHOICE_specifics_t asn_SPC_Ngap_TNGF_ID_specs_1 = { sizeof(struct Ngap_TNGF_ID), offsetof(struct Ngap_TNGF_ID, _asn_ctx), offsetof(struct Ngap_TNGF_ID, present), sizeof(((struct Ngap_TNGF_ID *)0)->present), asn_MAP_Ngap_TNGF_ID_tag2el_1, 2, /* Count of tags in the map */ 0, 0, -1 /* Extensions start */ }; asn_TYPE_descriptor_t asn_DEF_Ngap_TNGF_ID = { "TNGF-ID", "TNGF-ID", &asn_OP_CHOICE, 0, /* No effective tags (pointer) */ 0, /* No effective tags (count) */ 0, /* No tags (pointer) */ 0, /* No tags (count) */ { &asn_OER_type_Ngap_TNGF_ID_constr_1, &asn_PER_type_Ngap_TNGF_ID_constr_1, CHOICE_constraint }, asn_MBR_Ngap_TNGF_ID_1, 2, /* Elements count */ &asn_SPC_Ngap_TNGF_ID_specs_1 /* Additional specs */ };
30.716981
112
0.681818
41c0037d9ce2cd1bf953fb0f4d2bdd714c95ae82
988
h
C
interface/efficiency.h
cms-ttbarAC/CyMiniAna
405b1ac6639f8a93297e847180b5a6ab58f9a06c
[ "MIT" ]
null
null
null
interface/efficiency.h
cms-ttbarAC/CyMiniAna
405b1ac6639f8a93297e847180b5a6ab58f9a06c
[ "MIT" ]
31
2017-10-26T16:11:32.000Z
2018-08-13T14:39:56.000Z
CyMiniAna/interface/efficiency.h
cms-ttbarAC/Analysis
d0d3a4c3f79c7ae46711e661842c5af19ce99e32
[ "MIT" ]
1
2018-07-24T20:32:35.000Z
2018-07-24T20:32:35.000Z
#ifndef EFFICIENCY_H #define EFFICIENCY_H #include "TROOT.h" #include "TFile.h" #include "TH1.h" #include "TH2.h" #include "TSystem.h" #include "TEfficiency.h" #include "TTreeReader.h" #include "TTreeReaderValue.h" #include "TTreeReaderArray.h" #include <string> #include <map> #include <vector> #include "Analysis/CyMiniAna/interface/efficiencyBase.h" #include "Analysis/CyMiniAna/interface/tools.h" #include "Analysis/CyMiniAna/interface/Event.h" #include "Analysis/CyMiniAna/interface/configuration.h" class efficiency : public efficiencyBase { public: // Default efficiency(configuration &cmaConfig); // Default - so we can clean up; virtual ~efficiency(); /* Book efficiencies */ virtual void initialize( TFile& outputFile ); /* fill efficiencies */ virtual void fill( Event &event, const std::vector<unsigned int>& evtsel_decisions=std::vector<unsigned int>()); protected: bool m_isTtbar; bool m_isOneLeptonAnalysis; }; #endif
21.955556
116
0.726721
709a5ecfecf3f5e5817f46bc15262aafb38efb3b
9,639
c
C
Software code/Images and source code/Calendar1.c
YogeshKMeena/PV-Tiles
d31ad88948a1b1d2b04ffde7775f9123d1273b78
[ "MIT" ]
null
null
null
Software code/Images and source code/Calendar1.c
YogeshKMeena/PV-Tiles
d31ad88948a1b1d2b04ffde7775f9123d1273b78
[ "MIT" ]
null
null
null
Software code/Images and source code/Calendar1.c
YogeshKMeena/PV-Tiles
d31ad88948a1b1d2b04ffde7775f9123d1273b78
[ "MIT" ]
1
2021-01-28T10:48:46.000Z
2021-01-28T10:48:46.000Z
// This image has been created by ImageDog using 'Calendar1.PNG' const uint8_t image[] = { 0x6c, // Image width in pixels 0x0e, // Image height in rows (1 row = 8 pixels) 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1f, 0x3f, 0x7f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0x3f, 0x3f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x03, 0x01, 0x00, 0x80, 0xe0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0x00, 0x00, 0x01, 0x03, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x07, 0x01, 0x00, 0x80, 0xe0, 0xf8, 0xf8, 0xfc, 0xfc, 0xfe, 0xfe, 0xfe, 0xfe, 0xfc, 0xfc, 0xf8, 0xf0, 0xe0, 0x00, 0x00, 0x01, 0x03, 0x3f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x3f, 0x1f, 0x1f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x1f, 0x1f, 0x3f, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0, 0xf0 };
94.5
99
0.640004
f3459c1cab9a2d324b5aa3d5142963334dd9626a
1,150
h
C
src/function_keys.h
tchaikov/scim-googlepinyin
0b9407ef8e4e5fbf74d5ff4e42ea20025a1483fc
[ "Apache-2.0" ]
43
2015-04-23T13:08:45.000Z
2021-10-02T10:29:10.000Z
src/function_keys.h
batermj/scim-googlepinyin
57d5b125d903e234b584b8da78aca551d2eca526
[ "Apache-2.0" ]
1
2018-09-01T05:30:34.000Z
2018-09-01T05:30:34.000Z
src/function_keys.h
batermj/scim-googlepinyin
57d5b125d903e234b584b8da78aca551d2eca526
[ "Apache-2.0" ]
24
2015-03-17T07:31:13.000Z
2019-12-24T08:36:26.000Z
#ifndef FUNCTION_KEYS_H #define FUNCTION_KEYS_H #define Uses_SCIM_EVENT #include <scim.h> #include <vector> using namespace scim; class FunctionKeys { std::vector<KeyEvent> m_mode_switch_keys; std::vector<KeyEvent> m_page_up_keys; std::vector<KeyEvent> m_page_down_keys; std::vector<KeyEvent> m_full_width_punct_keys; KeyEvent m_prev_key; public: FunctionKeys(); void set_mode_switch_key(const KeyEvent&, bool enabled); void set_page_up_key(const KeyEvent&, bool enabled); void set_page_down_key(const KeyEvent&, bool enabled); bool is_mode_switch_key(const KeyEvent&) const; bool is_page_up_key(const KeyEvent&) const; bool is_page_down_key(const KeyEvent&) const; bool is_full_width_punct_key(const KeyEvent&) const; void remember_last_key(const KeyEvent&); private: bool match_key_event(const std::vector<KeyEvent>& , const KeyEvent& ) const; /** * add the key into keys if enabled is true, otherwise try to remove key from keys */ void update_keys(std::vector<KeyEvent>& keys, const KeyEvent& key, bool enabled); }; #endif // FUNCTION_KEYS_H
28.04878
86
0.728696
b461f1a3391bda9768e3257eb2cad6ed3e57bccb
2,183
h
C
src/blsct/aggregationsession.h
mellowsharp/navcoin-core
6d4c580efa1e73791a18d8d2d8e9c9e90fd8e780
[ "MIT" ]
null
null
null
src/blsct/aggregationsession.h
mellowsharp/navcoin-core
6d4c580efa1e73791a18d8d2d8e9c9e90fd8e780
[ "MIT" ]
null
null
null
src/blsct/aggregationsession.h
mellowsharp/navcoin-core
6d4c580efa1e73791a18d8d2d8e9c9e90fd8e780
[ "MIT" ]
2
2020-09-06T20:02:00.000Z
2020-11-19T18:47:42.000Z
// Copyright (c) 2020 The NavCoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef AGGREGATIONSESSION_H #define AGGREGATIONSESSION_H #include <blsct/ephemeralserver.h> #include <blsct/key.h> #include <blsct/transaction.h> #include <net.h> #include <random.h> #include <util.h> #include <utilstrencodings.h> #include <utiltime.h> #include <wallet/wallet.h> #define DEFAULT_MIX_FEE 10000000 #define DEFAULT_MIN_OUTPUT_AMOUNT 10000000000 #define DEFAULT_MAX_MIX_FEE 100000000 #define DEFAULT_TX_MIXCOINS 10 #define DEFAULT_MIX true class AggregationSesion { public: AggregationSesion(const CStateViewCache* inputs); bool Start(); void Stop(); static CAmount GetDefaultFee(); static CAmount GetMaxFee(); static bool IsKnown(const AggregationSesion& ms); bool GetState() const; void AnnounceHiddenService(); bool AddCandidateTransaction(const std::vector<unsigned char>& v); bool SelectCandidates(CandidateTransaction& ret); uint256 GetHash() const { return SerializeHash(*this); } std::string GetHiddenService() const { return sHiddenService; } std::vector<CandidateTransaction> GetTransactionCandidates() const { return vTransactionCandidates; } bool Join() const; friend inline bool operator==(const AggregationSesion& a, const AggregationSesion& b) { return a.GetHiddenService() == b.GetHiddenService(); } friend inline bool operator<(const AggregationSesion& a, const AggregationSesion& b) { return a.GetHiddenService() < b.GetHiddenService(); } ADD_SERIALIZE_METHODS; template <typename Stream, typename Operation> inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) { READWRITE(this->nVersion); READWRITE(sHiddenService); } private: EphemeralServer *es; const CStateViewCache* inputs; std::string sHiddenService; int fState; bool lock; int nVersion; std::vector<CandidateTransaction> vTransactionCandidates; }; #endif // AGGREGATIONSESSION_H
25.383721
147
0.728814
df8e50976694e5837e588d16b36743ab831c93ac
3,407
h
C
src/mongo/base/string_data-inl.h
oferei/mongo-cxx-driver
f98f3eafc90ad98bdb16182b8df536562f66d487
[ "Apache-2.0" ]
8
2015-03-30T05:51:38.000Z
2021-05-19T20:46:49.000Z
src/mongo/base/string_data-inl.h
oferei/mongo-cxx-driver
f98f3eafc90ad98bdb16182b8df536562f66d487
[ "Apache-2.0" ]
8
2015-05-08T03:15:33.000Z
2019-04-15T10:47:02.000Z
src/mongo/base/string_data-inl.h
oferei/mongo-cxx-driver
f98f3eafc90ad98bdb16182b8df536562f66d487
[ "Apache-2.0" ]
3
2015-07-09T16:09:28.000Z
2016-10-22T16:50:20.000Z
// string_data_inline.h /* Copyright 2010 10gen Inc. * * 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. */ // this should never be included directly #include <stdexcept> namespace mongo { inline int StringData::compare(const StringData& other) const { int res = memcmp(_data, other._data, std::min(_size, other._size)); if (res != 0) { return res > 0 ? 1 : -1; } else if (_size == other._size) { return 0; } else { return _size > other._size ? 1 : -1; } } inline bool StringData::equalCaseInsensitive(const StringData& other) const { if (other.size() != size()) return false; for (size_t x = 0; x < size(); x++) { char a = _data[x]; char b = other._data[x]; if (a == b) continue; if (tolower(a) == tolower(b)) continue; return false; } return true; } inline void StringData::copyTo(char* dest, bool includeEndingNull) const { memcpy(dest, _data, size()); if (includeEndingNull) dest[size()] = 0; } inline size_t StringData::find(char c, size_t fromPos) const { if (fromPos >= size()) return std::string::npos; const void* x = memchr(_data + fromPos, c, _size - fromPos); if (x == 0) return std::string::npos; return static_cast<size_t>(static_cast<const char*>(x) - _data); } inline size_t StringData::find(const StringData& needle) const { size_t mx = size(); size_t needleSize = needle.size(); if (needleSize == 0) return 0; else if (needleSize > mx) return std::string::npos; mx -= needleSize; for (size_t i = 0; i <= mx; i++) { if (memcmp(_data + i, needle._data, needleSize) == 0) return i; } return std::string::npos; } inline size_t StringData::rfind(char c, size_t fromPos) const { const size_t sz = size(); if (fromPos > sz) fromPos = sz; for (const char* cur = _data + fromPos; cur > _data; --cur) { if (*(cur - 1) == c) return (cur - _data) - 1; } return std::string::npos; } inline StringData StringData::substr(size_t pos, size_t n) const { if (pos > size()) throw std::out_of_range("out of range"); // truncate to end of string if (n > size() - pos) n = size() - pos; return StringData(_data + pos, n); } inline bool StringData::startsWith(const StringData& prefix) const { // TODO: Investigate an optimized implementation. return substr(0, prefix.size()) == prefix; } inline bool StringData::endsWith(const StringData& suffix) const { // TODO: Investigate an optimized implementation. const size_t thisSize = size(); const size_t suffixSize = suffix.size(); if (suffixSize > thisSize) return false; return substr(thisSize - suffixSize) == suffix; } } // namespace mongo
27.475806
78
0.615791
4ab74cdecac4abe048c2c65b9f4b2fc2282816e3
528
h
C
Thirdparty/liblfds/src/ringbuffer/ringbuffer_internal.h
Playermet/open-game-libraries
924ee63147de36faffa50d30c18ff04802c47748
[ "Zlib" ]
4
2015-01-01T11:29:38.000Z
2016-04-28T03:35:44.000Z
Thirdparty/liblfds/src/ringbuffer/ringbuffer_internal.h
ensiform/open-game-libraries
265c0d13198bd1910fe3c253b4ac04d55016b73f
[ "Zlib" ]
null
null
null
Thirdparty/liblfds/src/ringbuffer/ringbuffer_internal.h
ensiform/open-game-libraries
265c0d13198bd1910fe3c253b4ac04d55016b73f
[ "Zlib" ]
null
null
null
/***** the library wide include file *****/ #include "liblfds_internal.h" /***** defines *****/ /***** structures *****/ #pragma pack( push, ALIGN_DOUBLE_POINTER ) struct ringbuffer_state { struct queue_state *qs; struct freelist_state *fs; }; #pragma pack( pop ) /***** externs *****/ /***** private prototypes *****/ void ringbuffer_internal_validate( struct ringbuffer_state *rs, struct validation_info *vi, enum data_structure_validity *queue_validity, enum data_structure_validity *freelist_validity );
21.12
188
0.689394