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
65b54beb65748b57289bb81157512541fe4abf97
2,675
h
C
export/release/windows/obj/include/openfl/display3D/_Context3DTriangleFace/Context3DTriangleFace_Impl_.h
SamuraiOfSecrets/Goatmeal-Time-v0.2
7b89cbaf6895495b90ee1a5679e9cc696a7fbb53
[ "Apache-2.0" ]
null
null
null
export/release/windows/obj/include/openfl/display3D/_Context3DTriangleFace/Context3DTriangleFace_Impl_.h
SamuraiOfSecrets/Goatmeal-Time-v0.2
7b89cbaf6895495b90ee1a5679e9cc696a7fbb53
[ "Apache-2.0" ]
null
null
null
export/release/windows/obj/include/openfl/display3D/_Context3DTriangleFace/Context3DTriangleFace_Impl_.h
SamuraiOfSecrets/Goatmeal-Time-v0.2
7b89cbaf6895495b90ee1a5679e9cc696a7fbb53
[ "Apache-2.0" ]
null
null
null
// Generated by Haxe 4.2.2 #ifndef INCLUDED_openfl_display3D__Context3DTriangleFace_Context3DTriangleFace_Impl_ #define INCLUDED_openfl_display3D__Context3DTriangleFace_Context3DTriangleFace_Impl_ #ifndef HXCPP_H #include <hxcpp.h> #endif HX_DECLARE_CLASS3(openfl,display3D,_Context3DTriangleFace,Context3DTriangleFace_Impl_) namespace openfl{ namespace display3D{ namespace _Context3DTriangleFace{ class HXCPP_CLASS_ATTRIBUTES Context3DTriangleFace_Impl__obj : public ::hx::Object { public: typedef ::hx::Object super; typedef Context3DTriangleFace_Impl__obj OBJ_; Context3DTriangleFace_Impl__obj(); public: enum { _hx_ClassId = 0x4c963b00 }; void __construct(); inline void *operator new(size_t inSize, bool inContainer=false,const char *inName="openfl.display3D._Context3DTriangleFace.Context3DTriangleFace_Impl_") { return ::hx::Object::operator new(inSize,inContainer,inName); } inline void *operator new(size_t inSize, int extra) { return ::hx::Object::operator new(inSize+extra,false,"openfl.display3D._Context3DTriangleFace.Context3DTriangleFace_Impl_"); } inline static ::hx::ObjectPtr< Context3DTriangleFace_Impl__obj > __new() { ::hx::ObjectPtr< Context3DTriangleFace_Impl__obj > __this = new Context3DTriangleFace_Impl__obj(); __this->__construct(); return __this; } inline static ::hx::ObjectPtr< Context3DTriangleFace_Impl__obj > __alloc(::hx::Ctx *_hx_ctx) { Context3DTriangleFace_Impl__obj *__this = (Context3DTriangleFace_Impl__obj*)(::hx::Ctx::alloc(_hx_ctx, sizeof(Context3DTriangleFace_Impl__obj), false, "openfl.display3D._Context3DTriangleFace.Context3DTriangleFace_Impl_")); *(void **)__this = Context3DTriangleFace_Impl__obj::_hx_vtable; return __this; } static void * _hx_vtable; static Dynamic __CreateEmpty(); static Dynamic __Create(::hx::DynamicArray inArgs); //~Context3DTriangleFace_Impl__obj(); HX_DO_RTTI_ALL; static bool __GetStatic(const ::String &inString, Dynamic &outValue, ::hx::PropertyAccess inCallProp); static void __register(); bool _hx_isInstanceOf(int inClassId); ::String __ToString() const { return HX_("Context3DTriangleFace_Impl_",45,42,51,8c); } static void __boot(); static ::Dynamic BACK; static ::Dynamic FRONT; static ::Dynamic FRONT_AND_BACK; static ::Dynamic NONE; static ::Dynamic fromString(::String value); static ::Dynamic fromString_dyn(); static ::String toString( ::Dynamic this1); static ::Dynamic toString_dyn(); }; } // end namespace openfl } // end namespace display3D } // end namespace _Context3DTriangleFace #endif /* INCLUDED_openfl_display3D__Context3DTriangleFace_Context3DTriangleFace_Impl_ */
36.643836
226
0.783178
a918bde0391b25a54fde3caac01c393840510886
1,067
h
C
dir600b_v2.03/kernels/rt305x/include/linux/pim.h
ghsecuritylab/DIR600B2
78510ce13e037c430c84b4cdc7f49939481fe894
[ "BSD-2-Clause" ]
1
2019-07-21T01:58:19.000Z
2019-07-21T01:58:19.000Z
dir600b_v2.03/kernels/rt305x/include/linux/pim.h
ghsecuritylab/DIR600B2
78510ce13e037c430c84b4cdc7f49939481fe894
[ "BSD-2-Clause" ]
null
null
null
dir600b_v2.03/kernels/rt305x/include/linux/pim.h
ghsecuritylab/DIR600B2
78510ce13e037c430c84b4cdc7f49939481fe894
[ "BSD-2-Clause" ]
2
2020-03-06T22:45:39.000Z
2021-12-23T13:58:14.000Z
#ifndef __LINUX_PIM_H #define __LINUX_PIM_H #include <asm/byteorder.h> #ifndef __KERNEL__ struct pim { #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 pim_type:4, /* PIM message type */ pim_ver:4; /* PIM version */ #elif defined(__BIG_ENDIAN_BITFIELD) __u8 pim_ver:4; /* PIM version */ pim_type:4; /* PIM message type */ #endif __u8 pim_rsv; /* Reserved */ __be16 pim_cksum; /* Checksum */ }; #define PIM_MINLEN 8 #endif /* Message types - V1 */ #define PIM_V1_VERSION __constant_htonl(0x10000000) #define PIM_V1_REGISTER 1 /* Message types - V2 */ #define PIM_VERSION 2 #define PIM_REGISTER 1 #if defined(__KERNEL__) #define PIM_NULL_REGISTER __constant_htonl(0x40000000) /* PIMv2 register message header layout (ietf-draft-idmr-pimvsm-v2-00.ps */ struct pimreghdr { __u8 type; __u8 reserved; __be16 csum; __be32 flags; }; struct sk_buff; extern int pim_rcv_v1(struct sk_buff *); #endif #endif
23.195652
75
0.633552
a9fd5ee40179ed791f0781fff1cc578c0fb6a1de
4,116
h
C
zircon/system/ulib/storage-metrics/include/storage-metrics/fs-metrics.h
opensource-assist/fuschia
66646c55b3d0b36aae90a4b6706b87f1a6261935
[ "BSD-3-Clause" ]
14
2020-10-25T05:48:36.000Z
2021-09-20T02:46:20.000Z
zircon/system/ulib/storage-metrics/include/storage-metrics/fs-metrics.h
DamieFC/fuchsia
f78a4a1326f4a4bb5834500918756173c01bab4f
[ "BSD-2-Clause" ]
1
2022-01-14T23:38:40.000Z
2022-01-14T23:38:40.000Z
zircon/system/ulib/storage-metrics/include/storage-metrics/fs-metrics.h
DamieFC/fuchsia
f78a4a1326f4a4bb5834500918756173c01bab4f
[ "BSD-2-Clause" ]
4
2020-12-28T17:04:45.000Z
2022-03-12T03:20:44.000Z
// Copyright 2019 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 ZIRCON_SYSTEM_ULIB_STORAGE_METRICS_FS_METRICS_H_ #define ZIRCON_SYSTEM_ULIB_STORAGE_METRICS_FS_METRICS_H_ #include <atomic> #include <stdio.h> #include <fbl/macros.h> #include <fuchsia/minfs/c/fidl.h> #include <fuchsia/minfs/llcpp/fidl.h> #include <storage-metrics/storage-metrics.h> namespace storage_metrics { using storage_metrics::Metrics; // FsMetrics is common metrics that can be used across filesystems. The members // are internded to stay generic. class FsMetrics : public Metrics { public: DISALLOW_COPY_ASSIGN_AND_MOVE(FsMetrics); FsMetrics() = default; explicit FsMetrics(const ::llcpp::fuchsia::storage::metrics::FsMetrics* metrics); explicit FsMetrics(const fuchsia_storage_metrics_FsMetrics* metrics); ~FsMetrics() = default; // Copies to fields of fidl structure the corresponding fields of FsMetrics. void CopyToFidl(::llcpp::fuchsia::storage::metrics::FsMetrics* metrics) const; // Copies to fields of fidl structure the corresponding fields of FsMetrics. void CopyToFidl(fuchsia_storage_metrics_FsMetrics* metrics) const; // Prints all CallStat fields to file |stream|. Passes |success| to // CallStat::Dump. See CallStat::Dump. void Dump(FILE* stream, std::optional<bool> success = std::nullopt) const; // Following Updata*Stat functions take |success|, which denotes whether the // call was successful or not, |delta_time| is the time takes complete the call // and bytes transferred // On success, bytes transferred is number bytes returned to caller. It is // NOT the number of bytes fetched from underlying subsystem and it // is NOT number of bytes requested by the caller. // On failure, bytes_transferred is the number of bytes requested by the // caller. void UpdateCreateStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } create_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateReadStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } read_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateWriteStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } write_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateTruncateStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } truncate_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateUnlinkStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } unlink_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateRenameStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } rename_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateLookupStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } lookup_.UpdateCallStat(success, delta_time, bytes_transferred); } void UpdateOpenStat(bool success, zx_ticks_t delta_time, uint64_t bytes_transferred) { if (Enabled() == false) { return; } open_.UpdateCallStat(success, delta_time, bytes_transferred); } private: CallStat create_ = {}; // stats for create CallStat read_ = {}; // stats for read CallStat write_ = {}; // stats for write CallStat truncate_ = {}; // stats for truncate CallStat unlink_ = {}; // stats for unlink CallStat rename_ = {}; // stats for rename CallStat lookup_ = {}; // stats for lookup CallStat open_ = {}; // stats for open }; } // namespace storage_metrics #endif // ZIRCON_SYSTEM_ULIB_STORAGE_METRICS_FS_METRICS_H_
35.179487
92
0.723275
10ef17027d7717f070d7fa5feab0e5ed3f48de53
50,005
h
C
thrift/lib/cpp2/reflection/reflection.h
laohubuzaijia/fbthrift
ab263311864ec93b8e52665dad954264f094137f
[ "Apache-2.0" ]
null
null
null
thrift/lib/cpp2/reflection/reflection.h
laohubuzaijia/fbthrift
ab263311864ec93b8e52665dad954264f094137f
[ "Apache-2.0" ]
null
null
null
thrift/lib/cpp2/reflection/reflection.h
laohubuzaijia/fbthrift
ab263311864ec93b8e52665dad954264f094137f
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef THRIFT_FATAL_REFLECTION_H_ #define THRIFT_FATAL_REFLECTION_H_ 1 #include <cstdint> #include <type_traits> #include <utility> #include <fatal/type/conditional.h> #include <fatal/type/convert.h> #include <fatal/type/data_member_getter.h> #include <fatal/type/enum.h> #include <fatal/type/foreach.h> #include <fatal/type/get.h> #include <fatal/type/get_type.h> #include <fatal/type/list.h> #include <fatal/type/pair.h> #include <fatal/type/registry.h> #include <fatal/type/search.h> #include <fatal/type/traits.h> #include <fatal/type/transform.h> #include <fatal/type/variant_traits.h> #include <folly/CppAttributes.h> #include <folly/Traits.h> #include <folly/functional/Invoke.h> #include <thrift/lib/cpp2/TypeClass.h> #include <thrift/lib/cpp2/reflection/internal/reflection-inl-pre.h> #if !defined(_MSC_VER) || _MSC_VER >= 2000 static_assert(__cplusplus >= 201703L, "__cplusplus >= 201703L"); #endif namespace apache { namespace thrift { /** * READ ME FIRST: this file is divided into sections for each specific * reflection API. * * To quickly navigate this file, look for the string "SECTION: " without the * quotes. * * Note that the compile-time reflection API depends on metadata that's * generated by the Thrift compiler. In order to have this metadata available, * there are three simple but necessary steps: * * - enable code generation for `cpp2` as the target language; * - enable `reflection` as one of the `thrift_cpp2_options` flags; * - include the appropriate file containing the metadata (say your module is * defined in `some_dir/Module.thrift`, corresponding files can be included * from `some_dir/gen-cpp2/`): * * - Module_fatal.h: general module metadata * - Module_fatal_struct.h: metadata for all structures * - Module_fatal_enum.h: metadata for all enumerations * - Module_fatal_union.h: metadata for all variants (Thrift unions) * - Module_fatal_types.h: convenience header that includes metadata for * modules, structures, enumerations and variants * - Module_fatal_all.h: convenience header that includes all the * metadata generated by the Thrift compiler * * Thrift breaks the metadata up in several files to help reduce compilation * times by including only what's needed. * * @author: Marcelo Juchem <marcelo@fb.com> */ ////////////////////////////////////////////// // SECTION: IMPORTANT NOTES AND CONVENTIONS // ////////////////////////////////////////////// /** * NOTE ON COMPILE-TIME STRINGS: many strings found in the Thrift file are * converted to compile-time strings in the form of a `fatal::sequence` * of `char`. * * They are often represented as general C++ identifiers. Not all strings are * directly representable as C++ identifiers though, given that not all * characters are accepted as identifier names, only [_a-zA-Z0-9]. When that's * the case, the invalid characters are replaced by an underscode (_). * * Names starting with numbers are prefixed with 's_'. For example, the string * "42 is it" could be represented by the identifier 's_42_is_it'. * * Collisions are solved by appending a positive integer starting at 1 and * growing by 1 per collision, in the order the identifiers appear. For * instance, say there are three strings "a_", "a " and "a.". "a_" could be * represented by the identifier 'a_' while "a " could be represented by 'a_1' * and "a." could be 'a_2'. * * @author: Marcelo Juchem <marcelo@fb.com> */ //////////////////////////////////////////// // SECTION: TYPE ALIASES AND ENUMERATIONS // //////////////////////////////////////////// /** * An alias to the type used by Thrift as a struct's field ID. * * @author: Marcelo Juchem <marcelo@fb.com> */ using field_id_t = std::int16_t; /** * An alias to the type used by Thrift as a type's unique identifier. * * NOTE: this is a legacy feature and should be avoided on new code. * * @author: Marcelo Juchem <marcelo@fb.com> */ using legacy_type_id_t = std::uint64_t; /** * Represents whether a field is required to be set in a given structure or not. * * @author: Marcelo Juchem <marcelo@fb.com> */ enum class optionality { /** * Field is required. * * @author: Marcelo Juchem <marcelo@fb.com> */ required, /** * Field is optional. * * @author: Marcelo Juchem <marcelo@fb.com> */ optional, /** * Field is optional on the reading side but required on the writing side. * * @author: Marcelo Juchem <marcelo@fb.com> */ required_of_writer }; ///////////////////////////// // SECTION: TYPE CLASS API // ///////////////////////////// /** * Returns the type class of a thrift class, which is either a structure, a * variant, or an exception. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * typedef list<string> MyList; * * ///////////// * // foo.cpp // * ///////////// * * // yields `type_class::structure` * using result1 = reflect_type_class_of_thrift_class<MyStruct>; * * // yields `type_class::variant` * using result1 = reflect_type_class_of_thrift_class<MyUnion>; * * // yields `type_class::unknown` * using result2 = reflect_type_class_of_thrift_class<MyEnum>; * * // yields `type_class::unknown` * using result3 = reflect_type_class_of_thrift_class<MyList>; * * // yields `type_class::unknown` * using result4 = reflect_type_class_of_thrift_class<void>; */ template <typename T> using reflect_type_class_of_thrift_class = typename detail::reflect_type_class_of_thrift_class_impl<T>::type; /** * Returns the type class of a thrift class, which is either a structure, a * variant, or an exception, or of a thrift enum. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * typedef list<string> MyList; * * ///////////// * // foo.cpp // * ///////////// * * // yields `type_class::structure` * using result1 = reflect_type_class_of_thrift_class_enum<MyStruct>; * * // yields `type_class::variant` * using result1 = reflect_type_class_of_thrift_class_enum<MyUnion>; * * // yields `type_class::enumeration` * using result2 = reflect_type_class_of_thrift_class_enum<MyEnum>; * * // yields `type_class::unknown` * using result3 = reflect_type_class_of_thrift_class_enum<MyList>; * * // yields `type_class::unknown` * using result4 = reflect_type_class_of_thrift_class_enum<void>; */ template <typename T> using reflect_type_class_of_thrift_class_enum = typename detail::reflect_type_class_of_thrift_class_enum_impl<T>::type; /** * Returns the type class of a thrift class, which is either a structure, a * variant, or an exception, or of a thrift enum. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * typedef list<string> MyList; * * ///////////// * // foo.cpp // * ///////////// * * // yields `type_class::structure` * using result1 = reflect_type_class_of_thrift_class_enum<MyStruct>; * * // yields `type_class::variant` * using result1 = reflect_type_class_of_thrift_class_enum<MyUnion>; * * // yields `type_class::enumeration` * using result2 = reflect_type_class_of_thrift_class_enum<MyEnum>; * * // yields `type_class::unknown` * using result3 = reflect_type_class_of_thrift_class_enum<MyList>; * * // yields `type_class::unknown` * using result4 = reflect_type_class_of_thrift_class_enum<void>; */ template <typename T> using reflect_type_class_of_thrift_class_enum = typename detail::reflect_type_class_of_thrift_class_enum_impl<T>::type; ///////////////////////// // SECTION: MODULE API // ///////////////////////// /** * Holds reflection metadata for stuff defined in a Thrift file. * * NOTE: this class template is only intended to be instantiated by Thrift. * Users should ignore the template parameters taken by it and focus simply on * the members provided. * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Traits> struct reflected_module { /** * The name. * * A `fatal::constant_sequence` (compile-time string) representing the module * name. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * struct MyStruct {} * * // C++ * * using info = reflect_module<My::Namespace::MyModule_tags::module>; * using name = typename info::name; * // yields `fatal::constant_sequence< * // char, 'M', 'y', 'M', 'o', 'd', 'u', 'l', 'e', * // >` */ using name = typename Traits::name; /** * The map from language to namespace. * * A `fatal::list` of `fatal::pair` where the key is a `fatal::sequence` * (compile-time string) representing the language, associated with a * compile-time string representing the namespace. * * Example: * * // MyModule.thrift * * namespace cpp My.NamespaceCpp * namespace cpp2 My.Namespace * namespace java My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * // C++ * * using info = reflect_module<My::Namespace::MyModule_tags::module>; * * FATAL_S(cpp, "cpp"); * FATAL_S(cpp2, "cpp2"); * FATAL_S(java, "java"); * * // yields `fatal::sequence< * // char, * // 'M', 'y', ':', ':', 'N', 'a', 'm', 'e', * // 's', 'p', 'a', 'c', 'e', 'C', 'p', 'p' * // >` * using result1 = fatal::get<info::namespaces, cpp>; * * // yields `fatal::sequence< * // char, 'M', 'y', ':', ':', 'N', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e' * // >` * using result2 = fatal::get<info::namespaces, cpp2>; * * // yields `fatal::sequence< * // char, 'M', 'y', '.', 'N', 'a', 'm', 'e', 's', 'p', 'a', 'c', 'e' * // >` * using result3 = fatal::get<info::namespaces, java>; * * @author: Marcelo Juchem <marcelo@fb.com> */ using namespaces = typename Traits::namespaces; /** * The list of enumerations with reflection metadata available. * * A `fatal::list` of `fatal::pair` where the first type is the one generated * by the Thrift compiler for each enumeration, and the second one is the * compile-time string (`fatal::sequence`) representing the enumeration name. * * Use `fatal::enum_traits` to retrieve reflection information for each * enumeration (fatal/type/enum.h). * * @author: Marcelo Juchem <marcelo@fb.com> */ using enums = typename Traits::enums; /** * The list of unions with reflection metadata available. * * A `fatal::list` of `fatal::pair` where the first type is the one generated * by the Thrift compiler for each union, and the second one is the * compile-time string (`fatal::sequence`) representing the union name. * * Use `fatal::variant_traits` to retrieve reflection information for each * union (fatal/type/variant_traits.h). * * @author: Marcelo Juchem <marcelo@fb.com> */ using unions = typename Traits::unions; /** * The list of structs with reflection metadata available. * * A `fatal::list` of `fatal::pair` where the first type is the one generated * by the Thrift compiler for each struct, and the second one is the * compile-time string (`fatal::sequence`) representing the struct name. * * @author: Marcelo Juchem <marcelo@fb.com> */ using structs = typename Traits::structs; /** * The list of services with reflection metadata available. * * A `fatal::list` of compile-time strings * (`fatal::sequence`) representing each service name. * * @author: Marcelo Juchem <marcelo@fb.com> */ using services = typename Traits::services; }; /** * Retrieves reflection metadata (as a `reflected_module`) associated with the * given reflection metadata tag. * * The Thrift compiler generates a reflection metadata tag for each Thrift file * named `namespace::thriftfilename_tags::module`. * * If the given tag does not represent a Thrift module, or if there's no * reflection metadata available for it, compilation will fail. * * See the documentation on `reflected_module` (above) for more information on * the returned type. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * enum MyEnum1 { a, b, c } * enum MyEnum2 { x, y, x } * * ////////////////// * // whatever.cpp // * ////////////////// * using info = reflect_module<My::Namespace::MyModule_tags::module>; * * // yields `2` * auto result1 = info::enums::size; * * // fails compilation * using result2 = reflect_module<void>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Tag> using reflect_module = fatal:: registry_lookup<apache::thrift::detail::reflection_metadata_tag, Tag>; /** * Retrieves reflection metadata (as a `reflected_module`) associated with the * given reflection metadata tag. * * The Thrift compiler generates a reflection metadata tag for each Thrift file * named `namespace::thriftfilename_tags::module`. * * If the given tag does not represent a Thrift module, or if there's no * reflection metadata available for it, `Default` will be returned.s If * `Default` is not specified, it defaults to void. * * See the documentation on `reflected_module` (above) for more information on * the returned type. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * enum MyEnum1 { a, b, c } * enum MyEnum2 { x, y, x } * * ////////////////// * // whatever.cpp // * ////////////////// * using info = try_reflect_module< * My::Namespace::MyModule_tags::module, * void * >; * * // yields `2` * auto result1 = info::enums::size; * * // yields `void` * using result2 = try_reflect_module<int>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Tag, typename Default = void> using try_reflect_module = fatal::try_registry_lookup< apache::thrift::detail::reflection_metadata_tag, Tag, Default>; /** * Tells whether the given type is a tag that represents the reflection metadata * of the types declared in a Thrift file. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * ///////////// * // foo.cpp // * ///////////// * * // yields `std::true_type` * using result1 = is_reflectable_module<MyModule_tags::module>; * * // yields `std::false_type` * using result2 = is_reflectable_module<MyStruct>; * * // yields `std::false_type` * using result3 = is_reflectable_module<void>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using is_reflectable_module = std::integral_constant< bool, !std::is_same<try_reflect_module<T, void>, void>::value>; /** * Gets the reflection metadata tag for the Thrift file where the type `T` is * declared. * * The type `T` must be either a struct, enum or union. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * // C++ * * // yields `My::Namespace::MyModule_tags::module` * using result1 = reflect_module_tag<MyStruct>; * * // yields `My::Namespace::MyModule_tags::module` * using result2 = reflect_module_tag<MyEnum>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using reflect_module_tag = typename apache::thrift::detail::reflect_module_tag_selector< reflect_type_class_of_thrift_class_enum<T>, T, false>::type; /** * Tries to get the reflection metadata tag for the Thrift file where the type * `T` is declared. * e: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * // C++ * * // yields `My::Namespace::MyModule_tags::module` * using result1 = reflect_module_tag<MyStruct, void>; * * // yields `My::Namespace::MyModule_tags::module` * using result2 = reflect_module_tag<MyEnum, void>; * * // yields `void` * using result3 = reflect_module_tag<int, void>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T, typename Default = void> using try_reflect_module_tag = typename apache::thrift::detail::reflect_module_tag_selector< reflect_type_class_of_thrift_class_enum<T>, T, true, Default>::type; /** * Represents an annotation from `reflected_annotations::map`. * * For the examples below, consider code generated for this Thrift file: * * struct Foo { * 1: i32 z * } ( * a = '{not a valid format}', * b = '{"valid": "format", "foo": 10, "bar": true, "x": [-5, 0, 5]}', * c = '"hello"' * } * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Key, typename Value> struct annotation { /** * Represents the annotation key as a compile-time string, in the form of a * `fatal::sequence` of type `char`. * * @author: Marcelo Juchem <marcelo@fb.com> */ using key = Key; /** * Represents the annotation value as a compile-time string, in the form of a * `fatal::sequence` of type `char`. * * @author: Marcelo Juchem <marcelo@fb.com> */ using value = Value; }; /** * Holds reflection metadata for annotations. * * For the examples below, consider code generated for this Thrift file: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } ( * some.annotation = "some value", * another.annotation = "another value", * ) * * NOTE: this class template is only intended to be instantiated by Thrift. * Users should ignore the template parameters taken by it and focus simply on * the members provided. * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Metadata> struct reflected_annotations { /** * An implementation defined type that provides the names for each annotation * key as a member type alias named after the key. * * These type aliases are used as the key for the `map` member. * * Look for 'NOTE ON COMPILE-TIME STRINGS' for how the strings are converted * to C++ identifiers - caveat: instead of using the order they appear as the * precedence for collision resolution, it uses lexicographical order of the * keys. * * Example: * * using annotations = reflect_struct<MyStruct>::annotations; * * // yields `fatal::sequence<char, * // 's', 'o', 'm', 'e', '.', * // 'a', 'n', 'n', 'o', 't', 'a', 't', 'i', 'o', 'n' * // >` * using result1 = annotations::keys::some_annotation; * * @author: Marcelo Juchem <marcelo@fb.com> */ using keys = typename Metadata::keys; /** * An implementation defined type that provides the names for each annotation * value as a member type alias named after the key. * * These type aliases are used as the value for the `map` member. * * Look for 'NOTE ON COMPILE-TIME STRINGS' for how the strings are converted * to C++ identifiers - caveat: instead of using the order they appear as the * precedence for collision resolution, it uses lexicographical order of the * keys. * * Example: * * using annotations = reflect_struct<MyStruct>::annotations; * * // yields `fatal::sequence<char, * // 's', 'o', 'm', 'e', ' ', 'v', 'a', 'l', 'u', 'e' * // >` * using result1 = annotations::values::some_annotation; * * @author: Marcelo Juchem <marcelo@fb.com> */ using values = typename Metadata::values; /** * A list of `annotation` representing the annotations declared in the Thrift * file, sorted by keys. * * See the `annotation` type for more information. * * Example: * * // yields an instantiation of the `reflected_annotations` template * using annotations = reflect_struct<MyStruct>::annotations; * * FATAL_S(key, "another.annotation"); * * // yields `fatal::sequence<char, * // 'a', 'n', 'o', 't', 'h', 'e', 'r', ' ', 'v', 'a', 'l', 'u', 'e' * // >` * using result1 = fatal::get<annotations::map, key>::value; * * // yields `fatal::sequence<char, * // 's', 'o', 'm', 'e', ' ', 'v', 'a', 'l', 'u', 'e' * // >` * using result2 = fatal::get< * annotations::map, * annotations::keys::some_annotation * >::value; * * @author: Marcelo Juchem <marcelo@fb.com> */ using map = typename Metadata::map; }; //////////////////////////// // SECTION: STRUCTURE API // //////////////////////////// /** * Holds reflection metadata for a given struct. * * NOTE: this class template is only intended to be instantiated by Thrift. * Users should ignore the template parameters taken by it and focus simply on * the members provided. * * For the examples below, consider code generated for this Thrift file: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c ( * member.note = "member text", * another.member.note = "another member text", * ) * } ( * some.annotation = "some value", * another.annotation = "another value", * ) * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Traits> struct reflected_struct { /** * A type alias for the struct itself. * * Example: * * using info = reflect_struct<MyStruct>; * * // yields `MyStruct` * using result = info::type; * * @author: Marcelo Juchem <marcelo@fb.com> */ using type = typename Traits::type; /** * A compile-time string representing the struct name. * * Example: * * using info = reflect_struct<MyStruct>; * * // yields `fatal::sequence< * // char, * // 'M', 'y', 'S', 't', 'r', 'u', 'c', 't' * // >` * using result = info::name; * * @author: Marcelo Juchem <marcelo@fb.com> */ using name = typename Traits::name; /** * The reflection metadata tag for the Thrift file where this structure is * declared. * * Example: * * using info = reflect_struct<MyStruct>; * * // yields `My::Namespace::MyModule_tags::module` * using result = info::module; * * @author: Marcelo Juchem <marcelo@fb.com> */ using module = typename Traits::metadata::module; /** * An implementation defined type template that provides the appropriate * `reflected_struct_data_member` for each data member as a member type alias * with the same name. * * These type aliases are used as the type mapped by the `members` member * offered by the `reflected_struct` class. * * An optional transform can be specified, which will be applied on top of the * members' `reflected_struct_data_member`. * * Example: * * using info = reflect_struct<MyStruct>; * * // yields `fatal::sequence<char, 'a'>` * using result1 = info::member::a::name; * * // yields `std::int32_t` * using result2 = info::member::a::type; * * // yields `1` * using result3 = info::member::a::id::value; * * @author: Marcelo Juchem <marcelo@fb.com> */ using member = typename Traits::member; /** * A `fatal::list` of `reflected_struct_data_member` representing each member. * * See the documentation for `reflected_struct_data_member` (below) for more * information on its members. * * Example: * * struct visitor { * template <typename MemberInfo> * void operator ()(fatal::tag<MemberInfo>) { * using name = typename MemberInfo::name; * std::cout << "- member: " << fatal::z_data<name>() << '\n'; * } * }; * * using info = reflect_struct<MyStruct>; * * // prints the names of all members of `MyStruct` * fatal::foreach<info::members>(visitor()); * * @author: Marcelo Juchem <marcelo@fb.com> */ using members = typename Traits::members; /** * An instantiation of `reflected_annotations` representing the annotations * declared for this type in the Thrift file. * * Example: * * using info = reflect_struct<MyStruct>; * * // yields `fatal::sequence<char, * // 'a', 'n', 'o', 't', 'h', 'e', 'r', ' ', 'v', 'a', 'l', 'u', 'e' * // >` * using result = info::annotations::values::another_annotation; * * @author: Marcelo Juchem <marcelo@fb.com> */ using annotations = typename Traits::metadata::annotations; /** * An implementation defined type that provides the annotations for each * member of the struct. Each member's annotations are represented by an * instance of `reflected_annotations` named after the member itself. * * Example: * * using info = reflect_struct<MyStruct>; * * // yields `fatal::sequence<char, * // 'm', 'e', 'm', 'b', 'e', 'r', ' ', 't', 'e', 'x', 't' * // >` * using result1 = info::members_annotations::c::values::member_note * * @author: Marcelo Juchem <marcelo@fb.com> */ using members_annotations = typename Traits::members_annotations; /** * A unique identifier generated by thrift for this structure. * * NOTE: this is a legacy feature and should be avoided on new code. * * @author: Marcelo Juchem <marcelo@fb.com> */ using legacy_id = typename Traits::metadata::legacy_id; }; /** * Holds reflection metadata for a given struct's data member. * * NOTE: this class template is only intended to be instantiated by Thrift. * Users should ignore the template parameters taken by it and focus simply on * the members provided. * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Traits> struct reflected_struct_data_member { /** * A `fatal::sequence` of `char` representing the data member name as * a compile-time string. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 fieldA * 2: string fieldB * 3: double fieldC * } * * // C++ * * using info = reflect_struct<MyStruct>; * using member = info::member::fieldC; * * // yields `fatal::sequence<char, 'f', 'i', 'e', 'l', 'd', 'C'>` * using result1 = member::name; * * // yields "fieldC" * auto result2 = fatal::z_data<result1>(); * * @author: Marcelo Juchem <marcelo@fb.com> */ using name = typename Traits::name; /** * The type of the data member. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 fieldA * 2: string fieldB * 3: double fieldC * } * * // C++ * * using info = reflect_struct<MyStruct>; * using member = info::member::fieldC; * * // yields `double` * using result1 = member::type; * * @author: Marcelo Juchem <marcelo@fb.com> */ using type = typename Traits::type; /** * A `std::integral_constant` of type `field_id_t` representing the Thrift * field id for the data member. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 fieldA * 2: string fieldB * 3: double fieldC * } * * // C++ * * using info = reflect_struct<MyStruct>; * using member = info::member::fieldC; * * // yields `std::integral_constant<field_id_t, 3>` * using result1 = member::id; * * // yields `3` * auto result2 = result1::value; * * @author: Marcelo Juchem <marcelo@fb.com> */ using id = std::integral_constant<field_id_t, Traits::id>; /** * A `std::integral_constant` of type `optionality` representing whether a * field is qualified as required or optional. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: required i32 fieldA * 2: optional string fieldB * 3: double fieldC * } * * // C++ * * using info = reflect_struct<MyStruct>; * using a = info::member::fieldA; * using b = info::member::fieldB; * using c = info::member::fieldC; * * // yields `std::integral_constant<optionality, optionality::required>` * using result1 = a::required; * * // yields `std::integral_constant<optionality, optionality::optional>` * using result2 = b::required; * * // yields `std::integral_constant< * // optionality, * // optionality::required_of_writer * // >` * using result3 = c::required; * * @author: Marcelo Juchem <marcelo@fb.com> */ using optional = std::integral_constant<optionality, Traits::optional>; /** * A type that works as a getter for the data member. * * See also Fatal's documentation on `FATAL_DATA_MEMBER_GETTER` in * `fatal/type/traits.h` for more information on how to make the most out of * the data member getter. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 fieldA * 2: string fieldB * 3: double fieldC * } * * // C++ * * using info = reflect_struct<MyStruct>; * using member = info::member::fieldC; * using getter = member::getter; * * MyStruct pod; * * pod.fieldC = 7.2; * * // yields `7.2` * auto result1 = getter{}(pod); * * // sets `5.6` on `pod.fieldC` * getter{}(pod) = 5.6; * * // yields `5.6` * auto result2 = pod.fieldC; * * @author: Marcelo Juchem <marcelo@fb.com> */ using getter = typename Traits::getter; /** * Similar to getter, but return `(optional_)?field_ref` instead. */ using field_ref_getter = typename Traits::field_ref_getter; /** * The type class for this member. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 fieldA * 2: string fieldB * 3: double fieldC * } * * // C++ * * using info = reflect_struct<MyStruct>; * using member = info::member::fieldC; * * // yields `type_class::floating_point` * using result1 = member::type_class; * * @author: Marcelo Juchem <marcelo@fb.com> */ using type_class = typename Traits::type_class; /** * An instantiation of `reflected_annotations` representing the annotations * declared for this member in the Thrift file. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 fieldA * 2: string fieldB * 3: double fieldC (field.note = "some notes") * } * * // MyModule.cpp * * using info = reflect_struct<MyStruct>; * using member = info::member::fieldC; * * // yields `fatal::sequence<char, * // 's', 'o', 'm', 'e', ' ', 'n', 'o', 't', 'e', 's' * // >` * using result = member::annotations::values::field_note; * * @author: Marcelo Juchem <marcelo@fb.com> */ using annotations = typename Traits::annotations; /** * Checks whether the member represented by this metadata is set in the given * object. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: optional i32 field * } * * // MyModule.cpp * * using info = reflect_struct<MyStruct>; * using member = info::member::field; * * MyStruct pod; * * // yields `false` * bool result1 = member::is_set(pod); * * pod.set_field(42); * * // yields `true` * bool result2 = member::is_set(pod); * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> static constexpr inline bool is_set(T const& owner) { namespace impl = apache::thrift::detail::reflection_impl; using direct_getter = impl::getter_direct_getter_t<getter>; return impl::isset<typename Traits::owner, direct_getter>::check(owner); } /** * Marks the member as being either set or not set on the parent object. * * Example: * * // MyModule.thrift * * namespace cpp2 My.Namespace * * struct MyStruct { * 1: optional i32 field * } * * // MyModule.cpp * * using info = reflect_struct<MyStruct>; * using member = info::types::members<info::member::field::name>; * * MyStruct pod; * * // mark `field` as being set * member::mark_set(pod, true) * * * @author: Dylan Knutson <dymk@fb.com> */ template <typename T> static constexpr inline bool mark_set(T& owner, bool set) { namespace impl = apache::thrift::detail::reflection_impl; using direct_getter = impl::getter_direct_getter_t<getter>; return impl::isset<typename Traits::owner, direct_getter>::mark(owner, set); } }; /** * Retrieves reflection metadata (as a `reflected_struct`) associated with the * given struct. * * If the given type is not a Thrift struct, or if there's no reflection * metadata available for it, compilation will fail. * * See the documentation on `reflected_struct` (above) for more information on * the returned type. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * ////////////////// * // whatever.cpp // * ////////////////// * using info = reflect_struct<My::Namespace::MyStruct>; * * // yields `3` * auto result = fatal::size<info::members>::value; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Struct> using reflect_struct = fatal:: registry_lookup<apache::thrift::detail::struct_traits_metadata_tag, Struct>; /** * Retrieves reflection metadata (as a `reflected_struct`) associated with the * given struct. * * If the given type is not a Thrift struct, or if there's no reflection * metadata available for it, `Default` will be returned. If `Default` is not * specified, it defaults to void. * * See the documentation on `reflected_struct` (above) for more information on * the returned type. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * ////////////////// * // whatever.cpp // * ////////////////// * using info = reflect_struct<My::Namespace::MyStruct>; * * // yields `3` * auto result = fatal::size<info::members>::value; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Struct, typename Default = void> using try_reflect_struct = fatal::try_registry_lookup< apache::thrift::detail::struct_traits_metadata_tag, Struct, Default>; /** * Tells whether the given type is a Thrift struct with compile-time reflection * support. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * struct MyStruct { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * ///////////// * // foo.cpp // * ///////////// * * // yields `std::true_type` * using result1 = is_reflectable_struct<MyStruct>; * * // yields `std::false_type` * using result2 = is_reflectable_struct<MyEnum>; * * // yields `std::false_type` * using result3 = is_reflectable_struct<void>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using is_reflectable_struct = std::integral_constant< bool, !std::is_same<try_reflect_struct<T, void>, void>::value>; ////////////////////////////// // SECTION: ENUMERATION API // ////////////////////////////// /** * Holds reflection metadata for a given enumeration. * * NOTE: this class template is only intended to be instantiated by Thrift. * Users should ignore the template parameters taken by it and focus simply on * the members provided. * * For the examples below, consider code generated for this Thrift file: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * enum MyEnum { * a, b, c * } ( * some.annotation = "some value", * another.annotation = "another value", * ) * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> struct reflected_enum { /** * A type alias for the enumeration itself. * * Example: * * using info = reflect_enum<MyEnum>; * * // yields `MyEnum` * using result = info::type; * * @author: Marcelo Juchem <marcelo@fb.com> */ using type = T; /** * An alias to `fatal::enum_traits`. * * See `fatal::enum_traits`, from the Fatal library, for more information. * * Example: * * using info = reflect_enum<MyEnum>; * using traits = info::traits; * * // yields "a" * auto result = traits::to_string(MyEnum::a); * * @author: Marcelo Juchem <marcelo@fb.com> */ using traits = fatal::enum_traits<type>; /** * The reflection metadata tag for the Thrift file where this enumeration is * declared. * * Example: * * using info = reflect_enum<MyEnum>; * * // yields `My::Namespace::MyModule_tags::module` * using result = info::module; * * @author: Marcelo Juchem <marcelo@fb.com> */ using module = typename traits::metadata::module; /** * An instantiation of `reflected_annotations` representing the annotations * declared for this type in the Thrift file. * * Example: * * using info = reflect_enum<MyEnum>; * * // yields `fatal::sequence<char, * // 'a', 'n', 'o', 't', 'h', 'e', 'r', ' ', 'v', 'a', 'l', 'u', 'e' * // >` * using result = info::annotations::values::another_annotation; * * @author: Marcelo Juchem <marcelo@fb.com> */ using annotations = typename traits::metadata::annotations; /** * A unique identifier generated by thrift for this structure. * * NOTE: this is a legacy feature and should be avoided on new code. * * @author: Marcelo Juchem <marcelo@fb.com> */ using legacy_id = typename traits::metadata::legacy_id; }; /** * Retrieves reflection metadata (as a `reflected_enum`) associated with the * given enumeration. * * If the given type is not a Thrift enumeration, or if there's no reflection * metadata available for it, compilation will fail. * * See the documentation on `reflected_enum` (above) for more information on * the returned type. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * enum MyEnum { a, b, c } * * ////////////////// * // whatever.cpp // * ////////////////// * using info = reflect_enum<My::Namespace::MyEnum>; * * // yields `MyEnum` * auto result = info::type; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using reflect_enum = reflected_enum<T>; /** * Tells whether the given type is a Thrift enum with compile-time reflection * support. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * ///////////// * // foo.cpp // * ///////////// * * // yields `std::true_type` * using result1 = is_reflectable_enum<MyEnum>; * * // yields `std::false_type` * using result2 = is_reflectable_enum<MyUnion>; * * // yields `std::false_type` * using result3 = is_reflectable_enum<void>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using is_reflectable_enum = fatal::has_enum_traits<T>; ////////////////////////////////// // SECTION: VARIANT (UNION) API // ////////////////////////////////// /** * Holds reflection metadata for a given union. * * NOTE: this class template is only intended to be instantiated by Thrift. * Users should ignore the template parameters taken by it and focus simply on * the members provided. * * For the examples below, consider code generated for this Thrift file: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } ( * some.annotation = "some value", * another.annotation = "another value", * ) * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> struct reflected_variant { /** * A type alias for the union itself. * * Example: * * using info = reflect_variant<MyUnion>; * * // yields `MyUnion` * using result = info::type; * * @author: Marcelo Juchem <marcelo@fb.com> */ using type = T; /** * An alias to `fatal::variant_traits`. * * See `fatal::variant_traits`, from the Fatal library, for more information. * * Example: * * using info = reflect_variant<MyUnion>; * using traits = info::traits; * * // yields `MyUnion::Type::a` * auto result = traits::array::ids::data[0]; * * @author: Marcelo Juchem <marcelo@fb.com> */ using traits = fatal::variant_traits<type>; /** * The reflection metadata tag for the Thrift file where this union is * declared. * * Example: * * using info = reflect_variant<MyUnion>; * * // yields `My::Namespace::MyModule_tags::module` * using result = info::module; * * @author: Marcelo Juchem <marcelo@fb.com> */ using module = typename traits::metadata::module; /** * An instantiation of `reflected_annotations` representing the annotations * declared for this type in the Thrift file. * * Example: * * using info = reflect_variant<MyUnion>; * * // yields `fatal::sequence<char, * // 'a', 'n', 'o', 't', 'h', 'e', 'r', ' ', 'v', 'a', 'l', 'u', 'e' * // >` * using result = info::annotations::values::another_annotation; * * @author: Marcelo Juchem <marcelo@fb.com> */ using annotations = typename traits::metadata::annotations; /** * A unique identifier generated by thrift for this structure. * * NOTE: this is a legacy feature and should be avoided on new code. * * @author: Marcelo Juchem <marcelo@fb.com> */ using legacy_id = typename traits::metadata::legacy_id; /** * Gets the member descriptor for the field with given `Name`. * * See `fatal::variant_type_descriptor`, from the Fatal library, for more * information. * * Example: * * using id_traits = fatal::enum_traits<MyUnion::Type>; * using info = reflect_variant<MyUnion>; * using member_info = info::by_name<id_traits::str::a>; * * MyUnion u; * u.set_a(10); * * // yields `10` * auto result = member_info::get(u); * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Name> using by_name = fatal::get< typename traits::descriptors, Name, apache::thrift::detail::reflection_impl::variant_member_name>; /** * Gets the member descriptor for the field with given `TypeId`. * * See `fatal::variant_type_descriptor`, from the Fatal library, for more * information. * * Example: * * using id_traits = fatal::enum_traits<MyUnion::Type>; * using info = reflect_variant<MyUnion>; * using member_info = info::by_type_id<MyUnion::Type::a>; * * MyUnion u; * u.set_a(10); * * // yields `10` * auto result = member_info::get(u); * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename type::Type TypeId> using by_type_id = fatal::get< typename traits::descriptors, std::integral_constant<typename type::Type, TypeId>, fatal::get_type::id>; /** * Gets the member descriptor for the field with given `FieldId`. * * See `fatal::variant_type_descriptor`, from the Fatal library, for more * information. * * Example: * * using id_traits = fatal::enum_traits<MyUnion::Type>; * using info = reflect_variant<MyUnion>; * using member_info = info::by_field_id<1>; * * MyUnion u; * u.set_a(10); * * // yields `10` * auto result = member_info::get(u); * * @author: Marcelo Juchem <marcelo@fb.com> */ template <field_id_t FieldId> using by_field_id = fatal::get< typename traits::descriptors, std::integral_constant<field_id_t, FieldId>, apache::thrift::detail::reflection_impl::variant_member_field_id>; }; /** * Retrieves reflection metadata (as a `reflected_variant`) associated with the * given union. * * If the given type is not a Thrift union, or if there's no reflection * metadata available for it, compilation will fail. * * See the documentation on `reflected_variant` (above) for more information on * the returned type. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * ////////////////// * // whatever.cpp // * ////////////////// * using info = reflect_variant<My::Namespace::MyUnion>; * * // yields `MyUnion` * auto result = info::type; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using reflect_variant = reflected_variant<T>; /** * Represents Thrift specific metadata for a given union's member. * * This is exposed as the metadata for Fatal's `variant_member_descriptor`. * * For the examples below, consider code generated for this Thrift file: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * Example: * * ////////////////// * // whatever.cpp // * ////////////////// * using info = reflect_variant<My::Namespace::MyUnion>; * using metadata = info::by_type<double>::metadata; * * // yields "c" * auto result = fatal::z_data<metadata::name>(); * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename Traits> struct reflected_variant_member_metadata { /** * A compile-time string representing the name of this member. * * Example: * * using info = reflect_variant<My::Namespace::MyUnion>; * * // yields "c" * auto result = fatal::z_data<info::by_type<double>::metadata::name>(); * * @author: Marcelo Juchem <marcelo@fb.com> */ using name = typename Traits::name; /** * A `std::integral_constant` of type `field_id_t` representing the Thrift * field id for this member. * * Example: * * using info = reflect_variant<My::Namespace::MyUnion>; * * // yields `3` * auto result = info::by_type<double>::metadata::id::value; * * @author: Marcelo Juchem <marcelo@fb.com> */ using id = std::integral_constant<field_id_t, Traits::id>; /** * The type class for this member. * * Example: * * using info = reflect_variant<My::Namespace::MyUnion>; * * // yields `type_class::floating_point` * auto result = info::by_type<double>::metadata::id; * * @author: Marcelo Juchem <marcelo@fb.com> */ using type_class = typename Traits::type_class; }; /** * Tells whether the given type is a Thrift union with compile-time reflection * support. * * Example: * * ///////////////////// * // MyModule.thrift // * ///////////////////// * namespace cpp2 My.Namespace * * union MyUnion { * 1: i32 a * 2: string b * 3: double c * } * * enum MyEnum { a, b, c } * * ///////////// * // foo.cpp // * ///////////// * * // yields `std::true_type` * using result1 = is_reflectable_union<MyUnion>; * * // yields `std::false_type` * using result2 = is_reflectable_union<MyEnum>; * * // yields `std::false_type` * using result3 = is_reflectable_union<void>; * * @author: Marcelo Juchem <marcelo@fb.com> */ template <typename T> using is_reflectable_union = fatal::has_variant_traits<T>; } // namespace thrift } // namespace apache #include <thrift/lib/cpp2/reflection/internal/reflection-inl-post.h> #endif // THRIFT_FATAL_REFLECTION_H_
26.235572
80
0.608319
b782ad0f2eaca38c1117f5c9005de201c26b2d28
643
c
C
lib/wizards/aarrgh/nyxi/obj/belt.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
lib/wizards/aarrgh/nyxi/obj/belt.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
lib/wizards/aarrgh/nyxi/obj/belt.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
inherit "obj/armour"; reset(arg) { ::reset(arg); set_name("belt"); set_alias("belt"); set_short("A dusty belt made of bones"); set_long("This plated belt is covered with dust. The buckle holds a polished human skull in it and\n" "there is a certain magical energy flowing in the belt. The wearer of this belt is known to\n" "gain some special abilities through it. This belt is more heavier than normal belts."); set_ac(5); set_value(5000); set_weight(150); set_stats("int", 3); set_stats("wis", 4); set_stats("con", 3); set_stats("spr", 10); set_slot("belt"); }
30.619048
107
0.63297
b7ccf50a87fddee6dff56926689974a59dbff1b1
521
h
C
StRoot/StiSsd/StiSstDetectorBuilder1.h
xiaohaijin/RHIC-STAR
a305cb0a6ac15c8165bd8f0d074d7075d5e58752
[ "MIT" ]
2
2018-12-24T19:37:00.000Z
2022-02-28T06:57:20.000Z
StRoot/StiSsd/StiSstDetectorBuilder1.h
xiaohaijin/RHIC-STAR
a305cb0a6ac15c8165bd8f0d074d7075d5e58752
[ "MIT" ]
null
null
null
StRoot/StiSsd/StiSstDetectorBuilder1.h
xiaohaijin/RHIC-STAR
a305cb0a6ac15c8165bd8f0d074d7075d5e58752
[ "MIT" ]
null
null
null
#ifndef StiSstDetectorBuilder1_H #define StiSstDetectorBuilder1_H #include "StiSsd/StiSstDetectorBuilder.h" #include "StDetectorDbMaker/StiHitErrorCalculator.h" #include "StSsdDbMaker/StSstDbMaker.h" class StiDetector; class StiSstDetectorBuilder1 : public StiSstDetectorBuilder { public: StiSstDetectorBuilder1(bool active, bool buildIdealGeom=true); virtual ~StiSstDetectorBuilder1(); protected: virtual void buildInactiveVolumes(); private: void segmentSFMOVolume(StiDetector* stiSFMO); }; #endif
19.296296
65
0.8119
317cfe89bb7eac8ae7e1497faceba7d5898222d2
1,981
h
C
monitor/MonitorCore.h
NiklasWang/Uranium
dee2480496ccf4a5aa11502d0b9ed2fdfeb647fe
[ "Apache-2.0" ]
1
2019-07-10T05:14:54.000Z
2019-07-10T05:14:54.000Z
monitor/MonitorCore.h
NiklasWang/Uranium
dee2480496ccf4a5aa11502d0b9ed2fdfeb647fe
[ "Apache-2.0" ]
4
2019-05-27T05:43:16.000Z
2019-08-27T13:59:22.000Z
monitor/MonitorCore.h
NiklasWang/Uranium
dee2480496ccf4a5aa11502d0b9ed2fdfeb647fe
[ "Apache-2.0" ]
1
2019-05-31T04:29:25.000Z
2019-05-31T04:29:25.000Z
#ifndef __MONITORCORE_H__ #define __MONITORCORE_H__ #include <functional> #include <pthread.h> #include "common.h" #include "threads/ThreadPoolEx.h" #include "MonitorUtils.h" #include "FileManager.h" namespace uranium { class MonitorUtils; class FileManager; class MonitorCore { public: bool monitorDirNotExit(void); bool monitorDirCompareWithLocal(const std::string file, \ std::map<std::string, uint32_t> &diffFile); int32_t monitorTarExec(const std::string &files, const std::string &dirPath, std::function<int32_t (void)> cb); int32_t monitorUntarExec(const std::string &files, const std::string &dirPath, std::function<int32_t (void)> cb); int32_t monitorDirInfosSave(const std::string path, std::function<int32_t (void)> cb); int32_t monitorDirInfosLoad(const std::string path); int32_t monitorDirInfosScan(); int32_t monitorDirInfosScan(const std::string &moPath); public: int32_t monitorDirStart(void); int32_t monitorDirStop(void); public: int32_t monitorLoopProcess(std::function<int32_t (std::map<std::string, uint32_t>&) > cb); int32_t monitorLoopStop(void); public: int32_t construct(); int32_t destruct(); MonitorCore(std::string monitorPath); virtual ~MonitorCore(); private: MonitorCore() = delete; MonitorCore(const MonitorCore &rhs) = delete; MonitorCore &operator=(const MonitorCore &rhs) = delete; void processHandle(const std::vector<event>& events); private: bool mConstructed; bool mLoopRuning; bool mMoniStarFlag; ModuleType mModule; MonitorUtils *mMonitor; FileManager *mFileMage; // std::string mFileMagePath; std::string mMonitorPath; ThreadPoolEx *mThreads; ThreadPoolEx *mLoopThreads; std::map<std::string, MONITOR_FILES_T> mFileModify; pthread_mutex_t infoMutex; }; // class MonitorCore } #endif //__MONITORCORE_H__
29.567164
117
0.696618
4e5d89de4faaa1e9dd1fb55dcd479d9327aaaabf
3,558
c
C
unsfilter.c
urjaman/nschrooter
6fd93f069afec30053a639bed95562e16203ed96
[ "BSD-2-Clause" ]
null
null
null
unsfilter.c
urjaman/nschrooter
6fd93f069afec30053a639bed95562e16203ed96
[ "BSD-2-Clause" ]
null
null
null
unsfilter.c
urjaman/nschrooter
6fd93f069afec30053a639bed95562e16203ed96
[ "BSD-2-Clause" ]
null
null
null
/* See LICENSE. */ #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> #include <sched.h> #include <sys/mount.h> #include <stdarg.h> #include <string.h> #include <errno.h> #include <unistd.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdint.h> #include <seccomp.h> static void perror_msg_and_die2(const char* msg, const char *extra) { if (extra) fprintf(stderr,"%s: ", extra); perror(msg); exit(1); } static void perror_msg_and_die(const char* msg) { perror_msg_and_die2(msg, NULL); } static void error_msg_and_die(const char* msg) { fprintf(stderr,"%s\n", msg); exit(1); } static void run_prog(char **argv) { execvp(argv[0], argv); perror("execvp"); exit(127); /* Specific code for failure to run command. */ } static void apply_seccomp(void) { int r = 0; scmp_filter_ctx c = seccomp_init(SCMP_ACT_ALLOW); if (!c) error_msg_and_die("seccomp_init failed"); /* chown */ if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(chown), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(chown32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(fchown), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(fchown32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(fchownat), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(lchown), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(lchown32), 0)) < 0) goto err_r; /* set*id, etc. Change of groups or user/fs/etc ids... */ if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setfsgid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setfsgid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setfsuid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setfsuid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setgid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setgid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setgroups), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setgroups32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setregid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setregid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setresgid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setresgid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setresuid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setresuid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setreuid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setreuid32), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setuid), 0)) < 0) goto err_r; if ((r = seccomp_rule_add(c, SCMP_ACT_ERRNO(0), SCMP_SYS(setuid32), 0)) < 0) goto err_r; if ((r = seccomp_load(c)) < 0) goto err_r; seccomp_release(c); return; err_r: errno = -r; perror_msg_and_die("seccomp"); } int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr,"usage: %s <command> [parameters..]\n", argv[0]); exit(1); } apply_seccomp(); run_prog(argv+1); }
35.58
92
0.681563
08b042266e8e77f5f5a2182f45c22d1f8077f826
17,883
c
C
stackdriver_debugger_snapshot.c
frost-byte/stackdriver-debugger-php-extension
bfc88af1e616824a0c6c307d573b3afcb40d3586
[ "Apache-2.0" ]
29
2017-12-04T13:58:19.000Z
2021-11-15T07:45:30.000Z
stackdriver_debugger_snapshot.c
frost-byte/stackdriver-debugger-php-extension
bfc88af1e616824a0c6c307d573b3afcb40d3586
[ "Apache-2.0" ]
31
2017-10-30T20:34:05.000Z
2022-03-03T17:15:35.000Z
stackdriver_debugger_snapshot.c
frost-byte/stackdriver-debugger-php-extension
bfc88af1e616824a0c6c307d573b3afcb40d3586
[ "Apache-2.0" ]
16
2017-12-01T08:26:49.000Z
2021-08-12T09:55:16.000Z
/* * Copyright 2017 Google 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. */ #include "php.h" #include "php_stackdriver_debugger.h" #include "stackdriver_debugger_ast.h" #include "stackdriver_debugger_snapshot.h" #include "zend_exceptions.h" #include "stackdriver_debugger_random.h" #include "spl/php_spl.h" /* Initialize an empty, allocated variable */ static void init_variable(stackdriver_debugger_variable_t *variable) { variable->name = NULL; ZVAL_NULL(&variable->value); variable->indirect = 0; } /* Cleanup an allocated variable including freeing memory */ static void destroy_variable(stackdriver_debugger_variable_t *variable) { if (variable->name) { zend_string_release(variable->name); } efree(variable); } static void stackframe_locals_dtor(zval *zv) { stackdriver_debugger_variable_t *variable = (stackdriver_debugger_variable_t *)Z_PTR_P(zv); destroy_variable(variable); ZVAL_PTR_DTOR(zv); } /* Initialize an empty, allocated stackframe */ static void init_stackframe(stackdriver_debugger_stackframe_t *stackframe) { stackframe->function = NULL; stackframe->filename = NULL; stackframe->lineno = -1; ALLOC_HASHTABLE(stackframe->locals); zend_hash_init(stackframe->locals, 16, NULL, stackframe_locals_dtor, 0); } /* Cleanup an allocated stackframe including freeing memory */ static void destroy_stackframe(stackdriver_debugger_stackframe_t *stackframe) { int i; if (stackframe->function && (int)stackframe->function != -1) { zend_string_release(stackframe->function); } if (stackframe->filename) { zend_string_release(stackframe->filename); } zend_hash_destroy(stackframe->locals); FREE_HASHTABLE(stackframe->locals); efree(stackframe); } static void stackframes_dtor(zval *zv) { stackdriver_debugger_stackframe_t *sf = (stackdriver_debugger_stackframe_t *)Z_PTR_P(zv); destroy_stackframe(sf); ZVAL_PTR_DTOR(zv); } /* Initialize an empty, allocated snapshot */ static void init_snapshot(stackdriver_debugger_snapshot_t *snapshot) { snapshot->id = NULL; snapshot->filename = NULL; snapshot->lineno = -1; snapshot->condition = NULL; snapshot->fulfilled = 0; ALLOC_HASHTABLE(snapshot->expressions); zend_hash_init(snapshot->expressions, 16, NULL, ZVAL_PTR_DTOR, 0); ALLOC_HASHTABLE(snapshot->evaluated_expressions); zend_hash_init(snapshot->evaluated_expressions, 16, NULL, ZVAL_PTR_DTOR, 0); ALLOC_HASHTABLE(snapshot->stackframes); zend_hash_init(snapshot->stackframes, 16, NULL, stackframes_dtor, 0); ZVAL_NULL(&snapshot->callback); } /* Cleanup an allocated snapshot including freeing memory */ static void destroy_snapshot(stackdriver_debugger_snapshot_t *snapshot) { int i; zend_string_release(snapshot->id); zend_string_release(snapshot->filename); if (snapshot->condition) { zend_string_release(snapshot->condition); } zend_hash_destroy(snapshot->expressions); FREE_HASHTABLE(snapshot->expressions); zend_hash_destroy(snapshot->evaluated_expressions); FREE_HASHTABLE(snapshot->evaluated_expressions); zend_hash_destroy(snapshot->stackframes); FREE_HASHTABLE(snapshot->stackframes); if (Z_TYPE(snapshot->callback) != IS_NULL) { ZVAL_DESTRUCTOR(&snapshot->callback); } efree(snapshot); } /** * Convert a collected stackdriver_debugger_variable_t into an array zval with * keys of name and value. */ static void variable_to_zval(zval *return_value, stackdriver_debugger_variable_t *variable) { zend_string *hash = NULL; array_init(return_value); add_assoc_str(return_value, "name", variable->name); add_assoc_zval(return_value, "value", &variable->value); switch (Z_TYPE(variable->value)) { case IS_OBJECT: /* Use the spl_object_hash value */ hash = php_spl_object_hash(&variable->value); break; case IS_ARRAY: /* Use the memory address of the zend_array */ hash = strpprintf(16, "%016zx", Z_ARR(variable->value)); break; case IS_STRING: /* Use the internal HashTable value */ hash = strpprintf(32, "%016zx", ZSTR_HASH(Z_STR(variable->value))); break; } if (hash != NULL) { add_assoc_str(return_value, "id", hash); } } /* Capture a variable with provided name and zval into a collected variable */ static stackdriver_debugger_variable_t *create_variable(zend_string *name, zval *zv) { stackdriver_debugger_variable_t *variable = (stackdriver_debugger_variable_t *)emalloc(sizeof(stackdriver_debugger_variable_t)); init_variable(variable); variable->name = zend_string_dup(name, 0); /* If the zval is an indirect, dereference it */ while (Z_TYPE_P(zv) == IS_INDIRECT) { variable->indirect = 1; zv = Z_INDIRECT_P(zv); } ZVAL_COPY(&variable->value, zv); return variable; } /** * Convert a collected stackdriver_debugger_stackframe_t into an array zval * with function, filename, line, and locals. */ static void stackframe_to_zval(zval *return_value, stackdriver_debugger_stackframe_t *stackframe) { int i; array_init(return_value); if (stackframe->function) { add_assoc_str(return_value, "function", zend_string_dup(stackframe->function, 0)); } add_assoc_str(return_value, "filename", zend_string_copy(stackframe->filename)); add_assoc_long(return_value, "line", stackframe->lineno); zval locals; array_init(&locals); stackdriver_debugger_variable_t *local_variable; ZEND_HASH_FOREACH_PTR(stackframe->locals, local_variable) { zval local; variable_to_zval(&local, local_variable); add_next_index_zval(&locals, &local); } ZEND_HASH_FOREACH_END(); add_assoc_zval(return_value, "locals", &locals); } /** * Convert a collected stackdriver_debugger_snapshot_t into an array zval * of arrays converted from the contained stackframes */ static void stackframes_to_zval(zval *return_value, stackdriver_debugger_snapshot_t *snapshot) { int i; array_init(return_value); stackdriver_debugger_stackframe_t *stackframe; ZEND_HASH_FOREACH_PTR(snapshot->stackframes, stackframe) { zval zstackframe; stackframe_to_zval(&zstackframe, stackframe); add_next_index_zval(return_value, &zstackframe); } ZEND_HASH_FOREACH_END(); } /** * Convert a collected evaluated_expressions into an array zval of values. */ static void expressions_to_zval(zval *return_value, stackdriver_debugger_snapshot_t *snapshot) { array_init(return_value); zend_hash_copy(Z_ARR_P(return_value), snapshot->evaluated_expressions, NULL); } static void snapshot_to_zval(zval *return_value, stackdriver_debugger_snapshot_t *snapshot) { zval zstackframes, zexpressions; array_init(return_value); stackframes_to_zval(&zstackframes, snapshot); expressions_to_zval(&zexpressions, snapshot); add_assoc_str(return_value, "id", snapshot->id); add_assoc_zval(return_value, "stackframes", &zstackframes); add_assoc_zval(return_value, "evaluatedExpressions", &zexpressions); } /** * Given a provided zend_execute_data, find or rebuild the HashTable of * local variables at that moment. */ static int execute_data_to_symbol_table(zend_execute_data *execute_data, zend_array **symbol_table_p) { zend_op_array *op_array = &execute_data->func->op_array; #if PHP_VERSION_ID < 70100 if (execute_data->symbol_table) { #else if (ZEND_CALL_INFO(execute_data) & ZEND_CALL_HAS_SYMBOL_TABLE) { #endif *symbol_table_p = execute_data->symbol_table; return 0; } else { int i; zend_array *symbol_table; ALLOC_HASHTABLE(symbol_table); zend_hash_init(symbol_table, op_array->last_var, NULL, ZVAL_PTR_DTOR, 0); zend_string *name; for (i = 0; i < op_array->last_var; i++) { zval copy, *var; name = op_array->vars[i]; var = ZEND_CALL_VAR_NUM(execute_data, i); if (Z_TYPE_P(var) == IS_UNDEF) { ZVAL_NULL(&copy); } else { ZVAL_COPY(&copy, ZEND_CALL_VAR_NUM(execute_data, i)); } zend_hash_add(symbol_table, name, &copy); } *symbol_table_p = symbol_table; return 1; } } /** * Capture all local variables at the given execution scope from `execute_data` * into the provided stackframe struct. */ static void capture_locals(zend_execute_data *execute_data, stackdriver_debugger_stackframe_t *stackframe) { zend_array *symbol_table; zend_string *name; zval *value; int i = 0; int allocated = execute_data_to_symbol_table(execute_data, &symbol_table); ZEND_HASH_FOREACH_STR_KEY_VAL(symbol_table, name, value) { stackdriver_debugger_variable_t *local = create_variable(name, value); zend_hash_next_index_insert_ptr(stackframe->locals, local); } ZEND_HASH_FOREACH_END(); /* Free symbol table if necessary (potential memory leak) */ if (allocated != 0) { zend_hash_destroy(symbol_table); FREE_HASHTABLE(symbol_table); } } /** * Capture the execution state from `execute_data` */ static stackdriver_debugger_stackframe_t *execute_data_to_stackframe(zend_execute_data *execute_data, int capture_variables) { stackdriver_debugger_stackframe_t *stackframe; zend_op_array *op_array; zend_string *funcname; if (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type)) { return NULL; } stackframe = (stackdriver_debugger_stackframe_t *)emalloc(sizeof(stackdriver_debugger_stackframe_t)); init_stackframe(stackframe); op_array = &execute_data->func->op_array; funcname = op_array->function_name; stackframe->function = NULL; if (funcname != NULL) { stackframe->function = zend_string_copy(funcname); } stackframe->filename = zend_string_copy(op_array->filename); stackframe->lineno = execute_data->opline->lineno; if (capture_variables == 1) { capture_locals(execute_data, stackframe); } return stackframe; } /** * Registers a snapshot for recording. We store the snapshot configuration in a * request global HashTable by file which is consulted during file compilation. */ int register_snapshot(zend_string *snapshot_id, zend_string *filename, zend_long lineno, zend_string *condition, HashTable *expressions, zval *callback, zend_long max_stack_eval_depth) { HashTable *snapshots; stackdriver_debugger_snapshot_t *snapshot; snapshot = emalloc(sizeof(stackdriver_debugger_snapshot_t)); init_snapshot(snapshot); if (snapshot_id == NULL) { snapshot->id = generate_breakpoint_id(); } else { snapshot->id = zend_string_copy(snapshot_id); } snapshot->filename = zend_string_copy(filename); snapshot->lineno = lineno; snapshot->max_stack_eval_depth = max_stack_eval_depth; if (condition != NULL && ZSTR_LEN(condition) > 0) { if (valid_debugger_statement(condition) != SUCCESS) { destroy_snapshot(snapshot); return FAILURE; } snapshot->condition = zend_string_copy(condition); } if (expressions != NULL) { zval *expression; ZEND_HASH_FOREACH_VAL(expressions, expression) { if (valid_debugger_statement(Z_STR_P(expression)) != SUCCESS) { destroy_snapshot(snapshot); return FAILURE; } zend_hash_next_index_insert(snapshot->expressions, expression); } ZEND_HASH_FOREACH_END(); } if (callback != NULL) { ZVAL_COPY(&snapshot->callback, callback); } snapshots = zend_hash_find_ptr(STACKDRIVER_DEBUGGER_G(snapshots_by_file), filename); if (snapshots == NULL) { ALLOC_HASHTABLE(snapshots); zend_hash_init(snapshots, 4, NULL, ZVAL_PTR_DTOR, 0); zend_hash_update_ptr(STACKDRIVER_DEBUGGER_G(snapshots_by_file), filename, snapshots); } zend_hash_next_index_insert_ptr(snapshots, snapshot); zend_hash_update_ptr(STACKDRIVER_DEBUGGER_G(snapshots_by_id), snapshot->id, snapshot); return SUCCESS; } /** * Capture the full execution state into the provided snapshot */ static void capture_execution_state(zend_execute_data *execute_data, stackdriver_debugger_snapshot_t *snapshot) { zend_execute_data *ptr = execute_data; stackdriver_debugger_stackframe_t *stackframe; int i = 0; while (ptr) { if (snapshot->max_stack_eval_depth == 0 || i < snapshot->max_stack_eval_depth) { stackframe = execute_data_to_stackframe(ptr, 1); } else { stackframe = execute_data_to_stackframe(ptr, 0); } if (stackframe != NULL) { zend_hash_next_index_insert_ptr(snapshot->stackframes, stackframe); i++; } ptr = ptr->prev_execute_data; } } /** * Evaluate each provided expression and capture the result into the * provided snapshot data struct. */ static void capture_expressions(zend_execute_data *execute_data, stackdriver_debugger_snapshot_t *snapshot) { zval *expression; ZEND_HASH_FOREACH_VAL(snapshot->expressions, expression) { zval retval; if (zend_eval_string(Z_STRVAL_P(expression), &retval, "expression evaluation") == SUCCESS) { zend_hash_add(snapshot->evaluated_expressions, Z_STR_P(expression), &retval); } else { ZVAL_STRING(&retval, "ERROR"); zend_hash_add(snapshot->evaluated_expressions, Z_STR_P(expression), &retval); } } ZEND_HASH_FOREACH_END(); } static int handle_snapshot_callback(zval *callback, stackdriver_debugger_snapshot_t *snapshot) { zval zsnapshot, callback_result; snapshot_to_zval(&zsnapshot, snapshot); int call_result = call_user_function_ex(EG(function_table), NULL, callback, &callback_result, 1, &zsnapshot, 0, NULL); ZVAL_DESTRUCTOR(&zsnapshot); ZVAL_DESTRUCTOR(&callback_result); return call_result; } /** * Evaluate the provided snapshot in the provided execution scope. */ void evaluate_snapshot(zend_execute_data *execute_data, stackdriver_debugger_snapshot_t *snapshot) { if (snapshot->fulfilled) { return; } snapshot->fulfilled = 1; /* collect locals at each level of the backtrace */ capture_execution_state(execute_data, snapshot); /* evaluate and collect expressions */ capture_expressions(execute_data, snapshot); /* record as collected */ if (Z_TYPE(snapshot->callback) != IS_NULL) { if (handle_snapshot_callback(&snapshot->callback, snapshot) != SUCCESS) { php_error_docref(NULL, E_WARNING, "Error running snapshot callback."); } if (EG(exception) != NULL) { zend_clear_exception(); php_error_docref(NULL, E_WARNING, "Error running snapshot callback."); } } else { zend_hash_update_ptr(STACKDRIVER_DEBUGGER_G(collected_snapshots_by_id), snapshot->id, snapshot); } } /** * Fetch the list of collected snapshots and return as an array of data */ void list_snapshots(zval *return_value) { stackdriver_debugger_snapshot_t *snapshot; ZEND_HASH_FOREACH_PTR(STACKDRIVER_DEBUGGER_G(collected_snapshots_by_id), snapshot) { zval zsnapshot; snapshot_to_zval(&zsnapshot, snapshot); add_next_index_zval(return_value, &zsnapshot); } ZEND_HASH_FOREACH_END(); } /** * Destructor for cleaning up a zval pointer which contains a manually * emalloc'ed snapshot pointer. This should efree all manually emalloc'ed data * within the snapshot and also call the zval's normal destructor as well. */ static void snapshot_dtor(zval *zv) { stackdriver_debugger_snapshot_t *snapshot = (stackdriver_debugger_snapshot_t *)Z_PTR_P(zv); destroy_snapshot(snapshot); ZVAL_PTR_DTOR(zv); } static void snapshots_by_file_dtor(zval *zv) { HashTable *ht = (HashTable *)Z_PTR_P(zv); zend_hash_destroy(ht); FREE_HASHTABLE(ht); ZVAL_PTR_DTOR(zv); } /** * Request initialization lifecycle hook. Initializes request global variables. */ int stackdriver_debugger_snapshot_rinit(TSRMLS_D) { ALLOC_HASHTABLE(STACKDRIVER_DEBUGGER_G(snapshots_by_id)); zend_hash_init(STACKDRIVER_DEBUGGER_G(snapshots_by_id), 16, NULL, snapshot_dtor, 0); ALLOC_HASHTABLE(STACKDRIVER_DEBUGGER_G(snapshots_by_file)); zend_hash_init(STACKDRIVER_DEBUGGER_G(snapshots_by_file), 16, NULL, snapshots_by_file_dtor, 0); ALLOC_HASHTABLE(STACKDRIVER_DEBUGGER_G(collected_snapshots_by_id)); zend_hash_init(STACKDRIVER_DEBUGGER_G(collected_snapshots_by_id), 16, NULL, ZVAL_PTR_DTOR, 0); return SUCCESS; } /** * Request shutdown lifecycle hook. Destroys request global variables. */ int stackdriver_debugger_snapshot_rshutdown(TSRMLS_D) { zend_hash_destroy(STACKDRIVER_DEBUGGER_G(collected_snapshots_by_id)); FREE_HASHTABLE(STACKDRIVER_DEBUGGER_G(collected_snapshots_by_id)); zend_hash_destroy(STACKDRIVER_DEBUGGER_G(snapshots_by_file)); FREE_HASHTABLE(STACKDRIVER_DEBUGGER_G(snapshots_by_file)); zend_hash_destroy(STACKDRIVER_DEBUGGER_G(snapshots_by_id)); FREE_HASHTABLE(STACKDRIVER_DEBUGGER_G(snapshots_by_id)); return SUCCESS; }
32.994465
132
0.715708
645f77e859535f60284770933c0d2746e3c03c15
1,512
h
C
GdiFallback.h
zhuman/foo_wave_seekbar
e53d99a5d7fe451a36299a4c2e58210ad21ebfd5
[ "BSL-1.0" ]
null
null
null
GdiFallback.h
zhuman/foo_wave_seekbar
e53d99a5d7fe451a36299a4c2e58210ad21ebfd5
[ "BSL-1.0" ]
null
null
null
GdiFallback.h
zhuman/foo_wave_seekbar
e53d99a5d7fe451a36299a4c2e58210ad21ebfd5
[ "BSL-1.0" ]
null
null
null
// Copyright Lars Viklund 2008 - 2011. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #pragma once #include "frontend_sdk/VisualFrontend.h" #include "waveform_sdk/Optional.h" namespace wave { struct mem_dc : CDC { CBitmap bmp; CBitmapHandle old_bmp; CSize size; explicit mem_dc(HDC src_dc) { CreateCompatibleDC(src_dc); } mem_dc(HDC src_dc, wave::size s) { CreateCompatibleDC(src_dc); bmp.CreateCompatibleBitmap(src_dc, s.cx, s.cy); old_bmp = SelectBitmap(bmp); } ~mem_dc() { SelectBitmap(old_bmp); } }; struct gdi_fallback_frontend : visual_frontend { gdi_fallback_frontend(HWND wnd, wave::size, visual_frontend_callback& callback, visual_frontend_config& conf); ~gdi_fallback_frontend(); void clear(); void draw(); void present(); void on_state_changed(state s); private: void create_objects(); void release_objects(); void update_data(); void update_positions(); CPoint orientate(CPoint); CWindow wnd; bool cached_rects_valid; wave::optional<CRect> last_play_rect; wave::optional<CRect> last_seek_rect; std::unique_ptr<mem_dc> wave_dc, shaded_wave_dc; std::unique_ptr<CPen> pen_foreground, pen_highlight, pen_selection; std::unique_ptr<CBrush> brush_background; visual_frontend_callback& callback; }; } extern "C" __declspec(dllexport) frontend_entrypoint* _cdecl g_gdi_entrypoint();
22.909091
112
0.727513
d6fc16ee83f844ac337a21ba1bc2c8ce713ad22c
9,697
c
C
Tga3D/Source/External/ffmpeg-2.0/libavformat/cafenc.c
sarisman84/C-CommonUtilities
a3649c32232ec342c25b804001c16c295885ce0c
[ "MIT" ]
1
2022-03-10T11:43:24.000Z
2022-03-10T11:43:24.000Z
Tga3D/Source/External/ffmpeg-2.0/libavformat/cafenc.c
sarisman84/C-CommonUtilities
a3649c32232ec342c25b804001c16c295885ce0c
[ "MIT" ]
null
null
null
Tga3D/Source/External/ffmpeg-2.0/libavformat/cafenc.c
sarisman84/C-CommonUtilities
a3649c32232ec342c25b804001c16c295885ce0c
[ "MIT" ]
null
null
null
/* * Core Audio Format muxer * Copyright (c) 2011 Carl Eugen Hoyos * * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "avformat.h" #include "caf.h" #include "isom.h" #include "avio_internal.h" #include "libavutil/intfloat.h" #include "libavutil/dict.h" typedef struct { int64_t data; uint8_t *pkt_sizes; int size_buffer_size; int size_entries_used; int packets; } CAFContext; static uint32_t codec_flags(enum AVCodecID codec_id) { switch (codec_id) { case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_F64BE: return 1; //< kCAFLinearPCMFormatFlagIsFloat case AV_CODEC_ID_PCM_S16LE: case AV_CODEC_ID_PCM_S24LE: case AV_CODEC_ID_PCM_S32LE: return 2; //< kCAFLinearPCMFormatFlagIsLittleEndian case AV_CODEC_ID_PCM_F32LE: case AV_CODEC_ID_PCM_F64LE: return 3; //< kCAFLinearPCMFormatFlagIsFloat | kCAFLinearPCMFormatFlagIsLittleEndian default: return 0; } } static uint32_t samples_per_packet(enum AVCodecID codec_id, int channels) { switch (codec_id) { case AV_CODEC_ID_PCM_S8: case AV_CODEC_ID_PCM_S16LE: case AV_CODEC_ID_PCM_S16BE: case AV_CODEC_ID_PCM_S24LE: case AV_CODEC_ID_PCM_S24BE: case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_S32BE: case AV_CODEC_ID_PCM_F32LE: case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_F64LE: case AV_CODEC_ID_PCM_F64BE: case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: return 1; case AV_CODEC_ID_MACE3: case AV_CODEC_ID_MACE6: return 6; case AV_CODEC_ID_ADPCM_IMA_QT: return 64; case AV_CODEC_ID_AMR_NB: case AV_CODEC_ID_GSM: case AV_CODEC_ID_ILBC: case AV_CODEC_ID_QCELP: return 160; case AV_CODEC_ID_GSM_MS: return 320; case AV_CODEC_ID_MP1: return 384; case AV_CODEC_ID_MP2: case AV_CODEC_ID_MP3: return 1152; case AV_CODEC_ID_AC3: return 1536; case AV_CODEC_ID_QDM2: return 2048 * channels; case AV_CODEC_ID_ALAC: return 4096; case AV_CODEC_ID_ADPCM_IMA_WAV: return (1024 - 4 * channels) * 8 / (4 * channels) + 1; case AV_CODEC_ID_ADPCM_MS: return (1024 - 7 * channels) * 2 / channels + 2; default: return 0; } } static int caf_write_header(AVFormatContext *s) { AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; CAFContext *caf = s->priv_data; AVDictionaryEntry *t = NULL; unsigned int codec_tag = ff_codec_get_tag(ff_codec_caf_tags, enc->codec_id); int64_t chunk_size = 0; switch (enc->codec_id) { case AV_CODEC_ID_AAC: case AV_CODEC_ID_AC3: av_log(s, AV_LOG_ERROR, "muxing codec currently unsupported\n"); return AVERROR_PATCHWELCOME; } switch (enc->codec_id) { case AV_CODEC_ID_PCM_S8: case AV_CODEC_ID_PCM_S16LE: case AV_CODEC_ID_PCM_S16BE: case AV_CODEC_ID_PCM_S24LE: case AV_CODEC_ID_PCM_S24BE: case AV_CODEC_ID_PCM_S32LE: case AV_CODEC_ID_PCM_S32BE: case AV_CODEC_ID_PCM_F32LE: case AV_CODEC_ID_PCM_F32BE: case AV_CODEC_ID_PCM_F64LE: case AV_CODEC_ID_PCM_F64BE: case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: codec_tag = MKTAG('l','p','c','m'); } if (!codec_tag) { av_log(s, AV_LOG_ERROR, "unsupported codec\n"); return AVERROR_INVALIDDATA; } if (!enc->block_align && !pb->seekable) { av_log(s, AV_LOG_ERROR, "Muxing variable packet size not supported on non seekable output\n"); return AVERROR_INVALIDDATA; } ffio_wfourcc(pb, "caff"); //< mFileType avio_wb16(pb, 1); //< mFileVersion avio_wb16(pb, 0); //< mFileFlags ffio_wfourcc(pb, "desc"); //< Audio Description chunk avio_wb64(pb, 32); //< mChunkSize avio_wb64(pb, av_double2int(enc->sample_rate)); //< mSampleRate avio_wl32(pb, codec_tag); //< mFormatID avio_wb32(pb, codec_flags(enc->codec_id)); //< mFormatFlags avio_wb32(pb, enc->block_align); //< mBytesPerPacket avio_wb32(pb, samples_per_packet(enc->codec_id, enc->channels)); //< mFramesPerPacket avio_wb32(pb, enc->channels); //< mChannelsPerFrame avio_wb32(pb, av_get_bits_per_sample(enc->codec_id)); //< mBitsPerChannel if (enc->channel_layout) { ffio_wfourcc(pb, "chan"); avio_wb64(pb, 12); ff_mov_write_chan(pb, enc->channel_layout); } if (enc->codec_id == AV_CODEC_ID_ALAC) { ffio_wfourcc(pb, "kuki"); avio_wb64(pb, 12 + enc->extradata_size); avio_write(pb, "\0\0\0\14frmaalac", 12); avio_write(pb, enc->extradata, enc->extradata_size); } else if (enc->codec_id == AV_CODEC_ID_AMR_NB) { ffio_wfourcc(pb, "kuki"); avio_wb64(pb, 29); avio_write(pb, "\0\0\0\14frmasamr", 12); avio_wb32(pb, 0x11); /* size */ avio_write(pb, "samrFFMP", 8); avio_w8(pb, 0); /* decoder version */ avio_wb16(pb, 0x81FF); /* Mode set (all modes for AMR_NB) */ avio_w8(pb, 0x00); /* Mode change period (no restriction) */ avio_w8(pb, 0x01); /* Frames per sample */ } else if (enc->codec_id == AV_CODEC_ID_QDM2) { ffio_wfourcc(pb, "kuki"); avio_wb64(pb, enc->extradata_size); avio_write(pb, enc->extradata, enc->extradata_size); } if (av_dict_count(s->metadata)) { ffio_wfourcc(pb, "info"); //< Information chunk while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) { chunk_size += strlen(t->key) + strlen(t->value) + 2; } avio_wb64(pb, chunk_size + 4); avio_wb32(pb, av_dict_count(s->metadata)); t = NULL; while ((t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX))) { avio_put_str(pb, t->key); avio_put_str(pb, t->value); } } ffio_wfourcc(pb, "data"); //< Audio Data chunk caf->data = avio_tell(pb); avio_wb64(pb, -1); //< mChunkSize avio_wb32(pb, 0); //< mEditCount avio_flush(pb); return 0; } static int caf_write_packet(AVFormatContext *s, AVPacket *pkt) { CAFContext *caf = s->priv_data; avio_write(s->pb, pkt->data, pkt->size); if (!s->streams[0]->codec->block_align) { void *pkt_sizes = caf->pkt_sizes; int i, alloc_size = caf->size_entries_used + 5; if (alloc_size < 0) { caf->pkt_sizes = NULL; } else { caf->pkt_sizes = av_fast_realloc(caf->pkt_sizes, &caf->size_buffer_size, alloc_size); } if (!caf->pkt_sizes) { av_free(pkt_sizes); return AVERROR(ENOMEM); } for (i = 4; i > 0; i--) { unsigned top = pkt->size >> i * 7; if (top) caf->pkt_sizes[caf->size_entries_used++] = 128 | top; } caf->pkt_sizes[caf->size_entries_used++] = pkt->size & 127; caf->packets++; } return 0; } static int caf_write_trailer(AVFormatContext *s) { CAFContext *caf = s->priv_data; AVIOContext *pb = s->pb; AVCodecContext *enc = s->streams[0]->codec; if (pb->seekable) { int64_t file_size = avio_tell(pb); avio_seek(pb, caf->data, SEEK_SET); avio_wb64(pb, file_size - caf->data - 8); avio_seek(pb, file_size, SEEK_SET); if (!enc->block_align) { ffio_wfourcc(pb, "pakt"); avio_wb64(pb, caf->size_entries_used + 24); avio_wb64(pb, caf->packets); ///< mNumberPackets avio_wb64(pb, caf->packets * samples_per_packet(enc->codec_id, enc->channels)); ///< mNumberValidFrames avio_wb32(pb, 0); ///< mPrimingFrames avio_wb32(pb, 0); ///< mRemainderFrames avio_write(pb, caf->pkt_sizes, caf->size_entries_used); caf->size_buffer_size = 0; } avio_flush(pb); } av_freep(&caf->pkt_sizes); return 0; } AVOutputFormat ff_caf_muxer = { .name = "caf", .long_name = NULL_IF_CONFIG_SMALL("Apple CAF (Core Audio Format)"), .mime_type = "audio/x-caf", .extensions = "caf", .priv_data_size = sizeof(CAFContext), .audio_codec = AV_CODEC_ID_PCM_S16BE, .video_codec = AV_CODEC_ID_NONE, .write_header = caf_write_header, .write_packet = caf_write_packet, .write_trailer = caf_write_trailer, .codec_tag = (const AVCodecTag* const []){ff_codec_caf_tags, 0}, };
34.508897
116
0.608126
03c82e171a8e7b09e3a39b67fd986be6adb54b58
563
h
C
BTICoreDataKitDemoProject/Pods/BTIKit/BTIKit/Helpers/BTIFileUtilities.h
BriTerIdeas/BTICoreDataKit
e65fd639c83b7eb821941e638b7dbe0842518d65
[ "MIT" ]
null
null
null
BTICoreDataKitDemoProject/Pods/BTIKit/BTIKit/Helpers/BTIFileUtilities.h
BriTerIdeas/BTICoreDataKit
e65fd639c83b7eb821941e638b7dbe0842518d65
[ "MIT" ]
null
null
null
BTICoreDataKitDemoProject/Pods/BTIKit/BTIKit/Helpers/BTIFileUtilities.h
BriTerIdeas/BTICoreDataKit
e65fd639c83b7eb821941e638b7dbe0842518d65
[ "MIT" ]
null
null
null
// // BTIKit -- [https://github.com/BriTerIdeas/BTIKit] // v1.6 // // Created by Brian Slick. Copyright (c) 2015 BriTer Ideas LLC. All rights reserved. // // Libraries #import <Foundation/Foundation.h> // Classes and Forward Declarations // Public Constants // Protocols @interface BTIFileUtilities : NSObject // Public Properties // Public Methods // Directories + (nullable NSURL *)documentsDirectoryURL; + (nullable NSURL *)libraryDirectoryURL; + (nullable NSURL *)cacheDirectoryURL; + (nullable NSURL *)libraryApplicationSupportDirectoryURL; @end
18.766667
85
0.737123
239e5f6248f2ad9562721c0c44285e26bcfc6eb6
483
h
C
IngenicoDirectSDK/IDPreferredInputType.h
Ingenico/direct-sdk-client-objc
aa2a0e3b8c771fcf8b8d3174651502b717be365f
[ "MIT" ]
null
null
null
IngenicoDirectSDK/IDPreferredInputType.h
Ingenico/direct-sdk-client-objc
aa2a0e3b8c771fcf8b8d3174651502b717be365f
[ "MIT" ]
null
null
null
IngenicoDirectSDK/IDPreferredInputType.h
Ingenico/direct-sdk-client-objc
aa2a0e3b8c771fcf8b8d3174651502b717be365f
[ "MIT" ]
null
null
null
// // Do not remove or alter the notices in this preamble. // This software code is created for Ingencio ePayments on 17/07/2020 // Copyright © 2020 Global Collect Services. All rights reserved. // #ifndef IngenicoDirectSDK_IDPreferredInputType_h #define IngenicoDirectSDK_IDPreferredInputType_h typedef enum { IDStringKeyboard, IDIntegerKeyboard, IDEmailAddressKeyboard, IDPhoneNumberKeyboard, IDDateKeyboard, IDNoKeyboard } IDPreferredInputType; #endif
24.15
69
0.782609
8ae3889d8d8fde8f15bb5804b8cd1fe968d77fe4
2,071
h
C
livox_ros_driver/common/comm/comm_device.h
Drone-Research-Lab/livox_ros_driver
c12956f3c40beda9e78e06ba78485e5b7ff2f982
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause" ]
1
2020-09-21T07:35:11.000Z
2020-09-21T07:35:11.000Z
livox_ros_driver/common/comm/comm_device.h
Drone-Research-Lab/livox_ros_driver
c12956f3c40beda9e78e06ba78485e5b7ff2f982
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause" ]
null
null
null
livox_ros_driver/common/comm/comm_device.h
Drone-Research-Lab/livox_ros_driver
c12956f3c40beda9e78e06ba78485e5b7ff2f982
[ "BSL-1.0", "Apache-2.0", "BSD-3-Clause" ]
2
2021-06-02T07:29:54.000Z
2021-12-01T22:28:58.000Z
// // The MIT License (MIT) // // Copyright (c) 2019 Livox. All rights reserved. // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. // #ifndef COMM_COMM_DEVICE_H_ #define COMM_COMM_DEVICE_H_ #include <stdint.h> namespace livox_ros { const uint32_t kDevNameLengthMax = 256; /** Communication device type define */ enum CommDeviceType { kCommDevUart, kCommDevUsb, kCommDevCan, kCommDevEthernet, kCommDevUndef }; /** Communication device uart config */ struct CommDevUartConfig { uint8_t baudrate; uint8_t parity; }; /** Communication device usb config */ struct CommDevUsbConfig { void *data; }; /** Communication device can config */ struct CommDevCanConfig { void *data; }; /** Communication device config */ typedef struct { uint8_t type; char name[kDevNameLengthMax]; union { CommDevUartConfig uart; CommDevUsbConfig usb; CommDevCanConfig can; } config; } CommDevConfig; } // namespace livox_ros #endif // COMM_COMM_DEVICE_H_
28.763889
81
0.723322
6c9858b517b4daed60dea19a4142ced2c7eb5aa9
604
h
C
Source/ThirdParty/EASTL/test/packages/EAStdC/include/EAStdC/EADateTime.h
carlcc/rbfx
7e525b5be34356726e9f172f34b872c97d5d29ac
[ "MIT" ]
null
null
null
Source/ThirdParty/EASTL/test/packages/EAStdC/include/EAStdC/EADateTime.h
carlcc/rbfx
7e525b5be34356726e9f172f34b872c97d5d29ac
[ "MIT" ]
1
2019-11-29T02:19:09.000Z
2019-11-29T02:19:09.000Z
Source/ThirdParty/EASTL/test/packages/EAStdC/include/EAStdC/EADateTime.h
mostafa901/rbfx
8176ac6094bb738ef7ab5716d05ecd96771bbb8f
[ "MIT" ]
1
2020-04-30T13:57:35.000Z
2020-04-30T13:57:35.000Z
/////////////////////////////////////////////////////////////////////////////// // EADateTime.h // // Copyright (c) Electronic Arts. All rights reserved. /////////////////////////////////////////////////////////////////////////////// #ifndef EASTDC_EADATETIME_H #define EASTDC_EADATETIME_H #include <chrono> #include "EAStdCAPI.h" namespace EA { namespace StdC { inline EASTDC_API uint64_t GetTime() { using namespace std::chrono; nanoseconds ns = duration_cast<nanoseconds>(system_clock::now().time_since_epoch()); return ns.count(); } }} // namespace EA::StdC #endif // EASTDC_EADATETIME_H
21.571429
85
0.546358
23fa9bfdefb8b43fb3902ee7bc9638a6f5d85b2d
220
h
C
LZColorDetector/LZColorDetector/Classes/Controllers/ViewController.h
comst007/ColorDetector
8268d7eeb26f5d7d3e509f596a30571967f8aaba
[ "MIT" ]
null
null
null
LZColorDetector/LZColorDetector/Classes/Controllers/ViewController.h
comst007/ColorDetector
8268d7eeb26f5d7d3e509f596a30571967f8aaba
[ "MIT" ]
null
null
null
LZColorDetector/LZColorDetector/Classes/Controllers/ViewController.h
comst007/ColorDetector
8268d7eeb26f5d7d3e509f596a30571967f8aaba
[ "MIT" ]
null
null
null
// // ViewController.h // LZColorDetector // // Created by comst on 16/3/31. // Copyright © 2016年 com.comst1314. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
13.75
57
0.695455
9b2a8348eb42b3dd156998c1ab0f5c2374c967d0
288
h
C
uickit/UICTableViewControllerSelect.h
joshix/identilion
aeecaa177136d8b541d3e176a6ec05dc2965cc72
[ "BSD-3-Clause" ]
30
2015-02-15T02:16:37.000Z
2021-07-06T05:20:39.000Z
Classes/uickit/UICTableViewControllerSelect.h
kirara397/ntlniph
95d3eae5ea68dd55df0ca17b4097fd74a15a5e79
[ "BSD-3-Clause" ]
null
null
null
Classes/uickit/UICTableViewControllerSelect.h
kirara397/ntlniph
95d3eae5ea68dd55df0ca17b4097fd74a15a5e79
[ "BSD-3-Clause" ]
23
2015-01-19T06:35:19.000Z
2017-05-25T20:17:50.000Z
#import <UIKit/UIKit.h> #import "UICTableViewController.h" #import "UICPrototypeTableCellSelect.h" @interface UICTableViewControllerSelect : UICTableViewController { UICPrototypeTableCellSelect *prototype; } @property (readwrite, retain) UICPrototypeTableCellSelect *prototype; @end
24
70
0.822917
88981bff58156f5a0e01982dd72ba6e7db4106be
578
h
C
postgresql/src/include/executor/functions.h
anjingbin/starccm
70db48004aa20bbb82cc24de80802b40c7024eff
[ "BSD-3-Clause" ]
2
2020-01-06T07:43:30.000Z
2020-07-11T20:53:53.000Z
postgresql/src/include/executor/functions.h
anjingbin/starccm
70db48004aa20bbb82cc24de80802b40c7024eff
[ "BSD-3-Clause" ]
null
null
null
postgresql/src/include/executor/functions.h
anjingbin/starccm
70db48004aa20bbb82cc24de80802b40c7024eff
[ "BSD-3-Clause" ]
null
null
null
/*------------------------------------------------------------------------- * * functions.h * Declarations for execution of SQL-language functions. * * * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * $Id: functions.h,v 1.2 2004/07/05 08:55:58 SuLiang Exp $ * *------------------------------------------------------------------------- */ #ifndef FUNCTIONS_H #define FUNCTIONS_H #include "fmgr.h" extern Datum fmgr_sql(PG_FUNCTION_ARGS); #endif /* FUNCTIONS_H */
26.272727
75
0.529412
88da0139f2970e11aa68b3a548405e4821afd8f1
422
h
C
end_node/include/server.h
Alejo2313/LSEL2021-E3-Domotic
15f23e77ae2ae7885fabaaa8364ad2c402454ab9
[ "MIT" ]
null
null
null
end_node/include/server.h
Alejo2313/LSEL2021-E3-Domotic
15f23e77ae2ae7885fabaaa8364ad2c402454ab9
[ "MIT" ]
null
null
null
end_node/include/server.h
Alejo2313/LSEL2021-E3-Domotic
15f23e77ae2ae7885fabaaa8364ad2c402454ab9
[ "MIT" ]
null
null
null
#ifndef __SERVER_H__ #define __SERVER_H__ #include <esp_wifi.h> #include <esp_event.h> #include <esp_log.h> #include <esp_system.h> #include <nvs_flash.h> #include <sys/param.h> #include "nvs_flash.h" #include "esp_netif.h" #include "esp_eth.h" #include "html_src.h" #include "defines.h" #include "platform.h" #include <esp_http_server.h> void stop_webserver(void); void start_webserver(void); #endif // !__SERVER_H__
18.347826
28
0.748815
f06baa6290622bc833003edb7078be3884b02123
761
h
C
DS18B20_TemperatureSensors/DS18B20_TemperatureSensors.h
collab-project/arduino-lib
f20aeabb922693ac2f0a2caaba6c62a4c8b56239
[ "MIT" ]
2
2020-06-28T15:42:02.000Z
2020-08-10T18:30:54.000Z
DS18B20_TemperatureSensors/DS18B20_TemperatureSensors.h
collab-project/arduino-lib
f20aeabb922693ac2f0a2caaba6c62a4c8b56239
[ "MIT" ]
null
null
null
DS18B20_TemperatureSensors/DS18B20_TemperatureSensors.h
collab-project/arduino-lib
f20aeabb922693ac2f0a2caaba6c62a4c8b56239
[ "MIT" ]
null
null
null
/* DS18B20_TemperatureSensors.h - Control up to 8 DS18B20 temperature sensors using 1 GPIO connection. */ #ifndef DS18B20_TemperatureSensors_h #define DS18B20_TemperatureSensors_h #include <Arduino.h> #include <OneWire.h> #include <ArduinoLog.h> #include <DallasTemperature.h> class DS18B20_TemperatureSensors { public: DS18B20_TemperatureSensors() {}; DS18B20_TemperatureSensors( int oneWire_pin ); int totalTempSensors; void begin(); void loop(); void scan(); void printAddress(DeviceAddress deviceAddress); float getTemperatureByIndex(int index); private: OneWire* _oneWire; DallasTemperature* _tempSensors; DeviceAddress _tempDeviceAddress; int _oneWirePin; int _deviceIndex; }; #endif
22.382353
101
0.74113
b72f3ccabcc47b6614a81a974f3ea14b0ded3e47
738
h
C
include/onmt/nn/Tanh.h
jhnwnd/CTranslate
b9c85a4ccf3e0c38cc8691e1eaaafcb51086d33d
[ "MIT" ]
86
2017-01-10T00:35:40.000Z
2022-01-12T18:55:35.000Z
include/onmt/nn/Tanh.h
jhnwnd/CTranslate
b9c85a4ccf3e0c38cc8691e1eaaafcb51086d33d
[ "MIT" ]
41
2017-01-10T16:37:37.000Z
2020-04-07T09:10:45.000Z
include/onmt/nn/Tanh.h
jhnwnd/CTranslate
b9c85a4ccf3e0c38cc8691e1eaaafcb51086d33d
[ "MIT" ]
60
2017-01-06T17:03:41.000Z
2021-06-04T02:09:48.000Z
#pragma once #include "onmt/nn/Module.h" namespace onmt { namespace nn { template <typename MatFwd, typename MatIn, typename MatEmb, typename ModelT> class Tanh: public Module<MatFwd, MatIn, MatEmb, ModelT> { public: Tanh() : Module<MatFwd, MatIn, MatEmb, ModelT>("nn.Tanh") { } Tanh(const Tanh& other) : Module<MatFwd, MatIn, MatEmb, ModelT>(other) { } Module<MatFwd, MatIn, MatEmb, ModelT>* clone(const ModuleFactory<MatFwd, MatIn, MatEmb, ModelT>*) const override { return new Tanh(*this); } void forward_impl(const MatFwd& input) override { this->_output = input.array().tanh().matrix(); } }; } }
19.945946
118
0.588076
49436961b00bdf48506d88150c1ee2d90e076818
838
h
C
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/O2OTipCollectionViewCell.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
5
2020-03-29T12:08:37.000Z
2021-05-26T05:20:11.000Z
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/O2OTipCollectionViewCell.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
null
null
null
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/O2OTipCollectionViewCell.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 <UIKit/UICollectionViewCell.h> @class O2OTagInfo, UILabel; @interface O2OTipCollectionViewCell : UICollectionViewCell { _Bool _selectedStatus; UILabel *_textLabel; O2OTagInfo *_tagInfo; } + (struct CGSize)sizeWithText:(id)arg1 constrainedSize:(struct CGSize)arg2; @property(retain, nonatomic) O2OTagInfo *tagInfo; // @synthesize tagInfo=_tagInfo; @property(nonatomic) _Bool selectedStatus; // @synthesize selectedStatus=_selectedStatus; @property(retain, nonatomic) UILabel *textLabel; // @synthesize textLabel=_textLabel; - (void).cxx_destruct; - (void)setTipSelected:(_Bool)arg1; - (id)initWithFrame:(struct CGRect)arg1; @end
29.928571
90
0.749403
a5d322f58b6dcae63e648c54102384b299f88671
1,238
c
C
Projects/Group/FT_DB/libft/srcs/ft_wcsnew.c
SpeedFireSho/42-1
5d7ce17910794a28ca44d937651b961feadcff11
[ "MIT" ]
84
2020-10-13T14:50:11.000Z
2022-01-11T11:19:36.000Z
Projects/Group/FT_DB/libft/srcs/ft_wcsnew.c
SpeedFireSho/42-1
5d7ce17910794a28ca44d937651b961feadcff11
[ "MIT" ]
null
null
null
Projects/Group/FT_DB/libft/srcs/ft_wcsnew.c
SpeedFireSho/42-1
5d7ce17910794a28ca44d937651b961feadcff11
[ "MIT" ]
43
2020-09-10T19:26:37.000Z
2021-12-28T13:53:55.000Z
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ft_wcsnew.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: rtorres- <rtorres-@student.42.us.org> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/02/19 07:33:42 by rtorres- #+# #+# */ /* Updated: 2020/08/13 21:35:52 by rtorres- ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft.h" /* ** Allocates with malloc() and returns a “fresh” wide string ending with ’\0’. ** Each character of the string is initialized at ’\0’. ** If the allocation fails the function returns NULL. */ wchar_t *ft_wcsnew(size_t size) { wchar_t *wcs; wcs = ft_memalloc(sizeof(wchar_t) * size + sizeof(wchar_t)); return (wcs); }
44.214286
80
0.276252
53ed1e1033420d906ca328e9d64584c4ef88281f
928
h
C
libraries/escreen/escreen_spi.h
jamisonderek/qr-wifi
ce4802fd61506331960c03ad2ca5df5803158f22
[ "MIT" ]
null
null
null
libraries/escreen/escreen_spi.h
jamisonderek/qr-wifi
ce4802fd61506331960c03ad2ca5df5803158f22
[ "MIT" ]
2
2022-02-24T00:37:41.000Z
2022-02-24T00:47:07.000Z
libraries/escreen/escreen_spi.h
jamisonderek/qr-wifi
ce4802fd61506331960c03ad2ca5df5803158f22
[ "MIT" ]
1
2022-02-24T00:29:23.000Z
2022-02-24T00:29:23.000Z
#ifndef ESCREEN_SPI_H #define ESCREEN_SPI_H #ifdef ARDUINO #if (ARDUINO >= 100) #include <Arduino.h> #else #include <WProgram.h> #include <pins_arduino.h> #endif #endif #include "escreen_image.h" class EScreenSpi : WriteData { public: EScreenSpi(uint16_t din, uint16_t clk, uint16_t cs, uint16_t cmd); ~EScreenSpi(); void initAllPinsHigh(void); void send(uint8_t cmd); void send(uint8_t cmd, uint8_t data1); void send(uint8_t cmd, uint8_t data1, uint8_t data2); void send(uint8_t cmd, uint8_t data1, uint8_t data2, uint8_t data3); void send(uint8_t cmd, uint8_t data1, uint8_t data2, uint8_t data3, uint8_t data4); void send_image(uint8_t cmd, const EScreenImage* image); void write(uint8_t d); private: void spi_write(uint8_t d); void spi_write_backwards(uint8_t d); const uint16_t pinData; const uint16_t pinClock; const uint16_t pinChipSelect; const uint16_t pinDataCommand; }; #endif
22.095238
85
0.748922
53f64d6eb18784c83fad37d7f4d38e64bcea1de0
494
h
C
nflib/include/nf_mixedbg.h
hako/ArtofExternalTrollingFootage
6c87572ae2f87cef5bc701bf47f5a03956182c2c
[ "WTFPL" ]
1
2019-11-17T07:57:11.000Z
2019-11-17T07:57:11.000Z
nflib/include/nf_mixedbg.h
hako/ArtofExternalTrollingFootage
6c87572ae2f87cef5bc701bf47f5a03956182c2c
[ "WTFPL" ]
null
null
null
nflib/include/nf_mixedbg.h
hako/ArtofExternalTrollingFootage
6c87572ae2f87cef5bc701bf47f5a03956182c2c
[ "WTFPL" ]
null
null
null
#ifndef __NF_MIXEDBG_H__ #define __NF_MIXEDBG_H__ // NightFox LIB - Include de Fondos mixtos (Tiled / Bitmap 8 bits) // Requiere DevkitARM // Codigo por NightFox // http://www.nightfoxandco.com/ // Version 20110911 // Includes devKitPro #include <nds.h> // Funcion NF_InitMixedBgSys(); void NF_InitMixedBgSys(u8 screen); // Inicializa el modo mixto para fondo (Tiled BG + Bitmap 8 bits) // Capas 0 a 2 - Tiled // Capa 3 - Bitmap 8 bits #endif
14.529412
67
0.661943
990db3fc292656cf2ba899dd7528769f6638c15c
1,100
c
C
src/PJ/drivekit/torture/flicinfo.c
AnimatorPro/Animator-Pro
6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb
[ "BSD-3-Clause" ]
119
2015-01-10T15:13:50.000Z
2022-01-24T04:54:34.000Z
src/PJ/drivekit/torture/flicinfo.c
AnimatorPro/Animator-Pro
6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb
[ "BSD-3-Clause" ]
6
2015-10-22T20:14:59.000Z
2021-07-10T03:25:21.000Z
src/PJ/drivekit/torture/flicinfo.c
AnimatorPro/Animator-Pro
6d0b68cd94bb5cfde2cdd05e9a7c8ee1e1cb3cbb
[ "BSD-3-Clause" ]
27
2015-04-24T22:55:30.000Z
2022-01-21T13:54:00.000Z
#include "torture.h" #include "fli.h" #include "animinfo.h" Errcode get_flic_info(char *filename, struct anim_info *pinf) /***************************************************************************** * return information about an open flic. ****************************************************************************/ { Errcode err = Success; Fli_head flichead; FILE *f = NULL; if (NULL == (f = fopen(filename, "rb"))) { err = Err_nogood; goto ERROR_EXIT; } if (1 != fread(&flichead, sizeof(flichead), 1, f)) { err = Err_nogood; goto ERROR_EXIT; } if (flichead.type != FLIH_MAGIC && flichead.type != FLIHR_MAGIC) { err = Err_bad_magic; goto ERROR_EXIT; } pinf->width = flichead.width; pinf->height = flichead.height; pinf->x = 0; pinf->y = 0; pinf->num_frames = flichead.frame_count; pinf->depth = flichead.bits_a_pixel; pinf->aspect_dx = flichead.aspect_dx; pinf->aspect_dy = flichead.aspect_dy; pinf->millisec_per_frame = flichead.speed; ERROR_EXIT: if (f != NULL) fclose(f); return err; }
23.404255
79
0.545455
3e55fa8d93e9e567817fae390953b86c834e9b35
13,116
c
C
emulator/main.c
MilanMijatov/Chip-8-Emulator
c8b81be1d56c8935c569ce13f97d0b7515d50de9
[ "BSD-3-Clause" ]
null
null
null
emulator/main.c
MilanMijatov/Chip-8-Emulator
c8b81be1d56c8935c569ce13f97d0b7515d50de9
[ "BSD-3-Clause" ]
null
null
null
emulator/main.c
MilanMijatov/Chip-8-Emulator
c8b81be1d56c8935c569ce13f97d0b7515d50de9
[ "BSD-3-Clause" ]
null
null
null
/* Copyright (c) 2019, MilanMijatov */ #include <SDL2/SDL.h> #include <stdio.h> #include <stdlib.h> #include <math.h> #include <unistd.h> #include <fcntl.h> #include <ctype.h> #include <stdint.h> #include <string.h> #include <time.h> #define PIXEL_SCALE 10 int op_zero(uint16_t); int op_one(uint16_t); int op_two(uint16_t); int op_three(uint16_t); int op_four(uint16_t); int op_five(uint16_t); int op_six(uint16_t); int op_seven(uint16_t); int op_eight(uint16_t); int op_nine(uint16_t); int op_ten(uint16_t); int op_eleven(uint16_t); int op_twelve(uint16_t); int op_thirteen(uint16_t); int op_fourteen(uint16_t); int op_fifteen(uint16_t); int start_SDL(); int main_loop(); int draw_scaled_pixel(int_fast16_t, int_fast16_t, uint_fast8_t); const int (*p[16]) (uint16_t) = {op_zero, op_one, op_two, op_three, op_four, op_five, op_six, op_seven, op_eight, op_nine, op_ten, op_eleven, op_twelve, op_thirteen, op_fourteen, op_fifteen}; uint16_t pc; uint8_t mem[4096] = {0xF0,0x90,0x90,0x90,0xF0,0x20,0x60,0x20,0x20,0x70,0xF0,0x10,0xF0,0x80,0xF0,0xF0,0x10,0xF0,0x10,0xF0,0x90,0x90,0xF0,0x10,0x10,0xF0,0x80,0xF0,0x10,0xF0,0xF0,0x80,0xF0,0x90,0xF0,0xF0,0x10,0x20,0x40,0x40,0xF0,0x90,0xF0,0x90,0xF0,0xF0,0x90,0xF0,0x10,0xF0,0xF0,0x90,0xF0,0x90,0x90,0xE0,0x90,0xE0,0x90,0xE0,0xF0,0x80,0x80,0x80,0xF0,0xE0,0x90,0x90,0x90,0xE0,0xF0,0x80,0xF0,0x80,0xF0,0xF0,0x80,0xF0,0x80,0x80}; /* define all 0x1000 1 byte memory locations */ uint8_t scrn[32][64]; uint8_t v[16]; /* define all 0x10 8-bit data registers */ uint16_t I; /* define the address register, 16 bits wide */ uint16_t stack[16]; uint16_t *stackptr = stack; uint32_t timer; uint32_t starttime; uint_fast8_t k[16]; /* begin SDL2 declations */ const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 320; SDL_Window *window = NULL; SDL_Surface *screenSurface = NULL; int quit = 0; SDL_Event event; int main(int argc, char *argv[]) { int result, i; //FILE *ptr; //unsigned char buffer[1000] = {-1}; //ptr = fopen("pong.rom","rb"); // r for read, b for binary int a = open(argv[1] ,O_RDONLY); int num = read(a,mem+0x200,1000); close(a); //fclose(ptr); //size_t num = fread(buffer,sizeof(buffer),1,ptr); /* pc = 0x200; pc += 10; printf("%u\n",mem[pc]); */ start_SDL(); SDL_DestroyWindow(window); SDL_Quit(); } int start_SDL() { if(SDL_Init( SDL_INIT_VIDEO ) < 0 ) { printf("SDL could not initialize! SDL_Error: %s/n", SDL_GetError()); } else { window = SDL_CreateWindow("SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN); if(!window) printf("Window could not be created! SDL_Error: %s\n", SDL_GetError()); else { screenSurface = SDL_GetWindowSurface( window ); SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0x00, 0x00, 0x00)); main_loop(); } } } int main_loop() { int i,b,d,c,result; for(pc = 0x200, i = 0; /*i < 52 /* i < 0x200 + num */ !quit; i += 2, pc += 2) { /* interpretor lol */ printf("PC:%d\t", pc); b = mem[pc]; //printf("%u\t",b >> 4); d = mem[pc + 1]; c = (b << 8 ) | (d & 0xff); result = (*p[b >> 4]) (c); while( SDL_PollEvent( &event ) != 0 ) { //User requests quit if( event.type == SDL_QUIT ) { quit = 1; } else if( event.type == SDL_KEYDOWN ) { //Select surfaces based on key press switch( event.key.keysym.sym ) { case SDLK_1: k[1] = 1; break; case SDLK_4: k[4] = 1; break; case SDLK_c: k[12] = 1; break; case SDLK_d: k[13] = 1; break; } } } SDL_Delay(5); //SDL_WaitEvent(&event); /* while (event.type != SDL_MOUSEBUTTONDOWN) { SDL_WaitEvent(&event); if( event.type == SDL_QUIT ) { quit = 1; } while( SDL_PollEvent( &event ) != 0 ) { //User requests quit if( event.type == SDL_QUIT ) { quit = 1; } } } */ } printf("\n"); for(i = 0; i < 32; i++) { for(result = 0; result < 64; result++) printf("%u ", scrn[i][result]); printf("\n"); } } int update_timer() { } int draw_scaled_pixel(int_fast16_t x, int_fast16_t y, uint_fast8_t c) { SDL_Rect PIXELRect; PIXELRect.h = PIXEL_SCALE; PIXELRect.w = PIXEL_SCALE; PIXELRect.x = x * PIXEL_SCALE; PIXELRect.y = y * PIXEL_SCALE; if(c) SDL_FillRect(screenSurface, &PIXELRect, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF)); else SDL_FillRect(screenSurface, &PIXELRect, SDL_MapRGB( screenSurface->format, 0x00, 0x00, 0x00)); SDL_UpdateWindowSurface(window); } int op_zero(uint16_t a) { a = a & 0x00FF; if(a == 0xEE) { stackptr--; pc = *stackptr; printf("Return to %d\n", pc); } else if((a & 0x00F0) == 0xE0) { /* for(a = 0; a < 32; a++) memset(scrn[a], 0, sizeof scrn[a]); */ memset(scrn, 0, sizeof scrn); SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0x00, 0x00, 0x00)); } else EXIT_FAILURE; } int op_one(uint16_t a) { pc = a & 0x0FFF; pc -= 2; return 0; } int op_two(uint16_t a) { *stackptr = pc; stackptr++; pc = a & 0x0FFF; printf("PC(%d) added to stack, PC is now %d\n",*(stackptr-1), a & 0x0FFF); pc -= 2; return 0; } int op_three(uint16_t a) { uint8_t n1 = v[(a & 0x0F00) >> 8]; uint8_t n2 = a & 0x00FF; if(n1 == n2) { printf("%u == %u\n",v[(a & 0x0F00) >> 8],a & 0x00FF); pc += 2; printf("pc is now %d\n",pc); } else printf("%u != %u\n",v[(a & 0x0F00) >> 8],a & 0x00FF); return 0; } int op_four(uint16_t a) { uint8_t n1 = v[(a & 0x0F00) >> 8]; uint8_t n2 = a & 0x00FF; if(n1 != n2) { printf("%u != %u\n",v[(a & 0x0F00) >> 8],a & 0x00FF); pc += 2; printf("pc is now %d\n",pc); } else printf("%u == %u\n",v[(a & 0x0F00) >> 8],a & 0x00FF); return 0; } int op_five(uint16_t a) { uint8_t n1 = v[(a & 0x0F00) >> 8]; uint8_t n2 = v[(a & 0x00F0) >> 4]; if(n1 == n2) pc += 2; return 0; } int op_six(uint16_t a) { v[(a & 0x0F00) >> 8] = a & 0x00FF; //printf("Register %d\n", a); printf("Register %d = %d\n",(a & 0x0F00) >> 8, a & 0x00FF); //printf("Register %d = %d\n",(a & 0x0F00) >> 8, v[(a & 0x0F00) >> 8]); return 0; } int op_seven(uint16_t a) { v[(a & 0x0F00) >> 8] += a & 0x00FF; printf("v%d: %d + %d = %d\n", (a & 0x0F00) >> 8, v[(a & 0x0F00) >> 8] - a & 0x00FF, a & 0x00FF, v[(a & 0x0F00) >> 8]); return 0; } int op_eight(uint16_t a) { switch (a & 0x000F) { case 0x0: v[(a & 0x0F00) >> 8] = v[(a & 0x00F0) >> 4]; break; case 0x1: v[(a & 0x0F00) >> 8] |= v[(a & 0x00F0) >> 4]; break; case 0x2: printf("v%u(%u) is now ",(a & 0x0F00) >> 8 ,v[(a & 0x0F00) >> 8]); v[(a & 0x0F00) >> 8] &= v[(a & 0x00F0) >> 4]; printf("%u after being ANDed by %u", v[(a & 0x0F00) >> 8], v[(a & 0x00F0) >> 4]); break; case 0x3: v[(a & 0x0F00) >> 8] ^= v[(a & 0x00F0) >> 4]; break; case 0x4: /* v[(a & 0x0F00) >> 8] += v[(a & 0x00F0) >> 4]; uint16_t w = 0; w += v[(a & 0x00F0) >> 4]; w += v[(a & 0x0F00) >> 8]; if(v[(a & 0x0F00) >> 8] != w) { v[0xF] = 1; v[(a & 0x0F00) >> 8] = w & 0x00FF; } v[0xF] = 0; */ if(v[(a & 0x0F00) >> 8] + v[(a & 0x00F0) >> 4] > 255) v[0xF] = 1; else v[0xF] = 0; v[(a & 0x0F00) >> 8] += v[(a & 0x00F0) >> 4]; break; case 0x5: if(v[(a & 0x0F00) >> 8] > v[(a & 0x00F0) >> 4]) v[0xF] = 1; else v[0xF] = 0; v[(a & 0x0F00) >> 8] -= v[(a & 0x00F0) >> 4]; break; case 0x6: v[0xF] = v[(a & 0x00F0) >> 4] & 0b00000001; v[(a & 0x0F00) >> 8] = v[(a & 0x00F0) >> 4] >> 1; break; case 0x7: if(v[(a & 0x0F00) >> 8] < v[(a & 0x00F0) >> 4]) v[0xF] = 1; else v[0xF] = 0; v[(a & 0x0F00) >> 8] = v[(a & 0x00F0) >> 4] - v[(a & 0x0F00) >> 8]; break; case 0xE: v[0xF] = (v[(a & 0x00F0) >> 4] & 0b10000000) >> 7; v[(a & 0x0F00) >> 8] = v[(a & 0x00F0) >> 4] << 1; break; default: EXIT_FAILURE; } return 0; } int op_nine(uint16_t a) { uint8_t n1 = v[(a & 0x0F00) >> 8]; uint8_t n2 = v[(a & 0x00F0) >> 4]; if(n1 != n2) pc += 2; return 0; } int op_ten(uint16_t a) { I = a & 0x0FFF; printf("Register I = %d\n", I); return 0; } int op_eleven(uint16_t a) { pc = (a & 0x0FFF) + v[0]; pc -= 2; return 0; } int op_twelve(uint16_t a) { srand(time(NULL)); int r = rand() % 256; v[(a & 0x0F00) >> 8] = r & (a & 0x00FF); return 0; } int op_thirteen(uint16_t a) { printf("Display sprites\n"); int i, k; uint8_t x, y, b; x = (a & 0x0F00) >> 8; y = (a & 0x00F0) >> 4; x = v[x] % 64; y = v[y] % 32; uint8_t ab[8] = {0b10000000, 0b01000000, 0b00100000, 0b00010000, 0b00001000, 0b00000100, 0b00000010, 0b00000001}; for(i = 0, a = a & 0x000F; i < a; i++, y++) for(k = 0; k < 8; k++) if(mem[I + i] & ab[k]) { b = scrn[y][x + k]; scrn[y][x + k] = scrn[y][x + k] ^ 1; if(b == 1 && scrn[y][x + k] != 1) v[0xF] = 1; draw_scaled_pixel(x + k, y, scrn[y][x + k]); } return 0; } int op_fourteen(uint16_t a) { switch(a & 0x00FF) { case 0x9E: if(k[v[(a & 0xF00) >> 8]]) { pc += 2; k[v[(a & 0xF00) >> 8]] = 0; } break; case 0xA1: if(k[v[(a & 0xF00) >> 8]]) { pc += 2; k[v[(a & 0xF00) >> 8]] = 0; } break; } return 0; } int op_fifteen(uint16_t a) { int i, k; uint32_t j; uint8_t b; switch (a & 0x00FF) { case 0x07: j = SDL_GetTicks() - starttime; if(!timer) { v[(a & 0x0F00) >> 8] = 0; } else if(j > timer) { v[(a & 0x0F00) >> 8] = 0; timer = 0; } else { v[(a & 0x0F00) >> 8] = timer - j; } printf("Read the delay timer: %d\n", v[(a & 0x0F00) >> 8]); break; case 0x0A: /* code */ break; case 0x15: timer = v[(a & 0x0F00) >> 8] * 16; starttime = SDL_GetTicks(); printf("Write to the delay time: %d\n", v[(a & 0x0F00) >> 8]); break; case 0x18: /* code */ break; case 0x1E: I += v[(a & 0x0F00) >> 8]; break; case 0x29: I = v[(a & 0x0F00) >> 8] * 5; printf("I = %d\n", v[(a & 0x0F00) >> 8] * 5); break; case 0x33: b = v[(a & 0x0F00) >> 8]; mem[I] = b /100; mem[I + 1] = (b % 100)/10; mem[I + 2] = b % 10; printf("Allocated %u, %u, %u\n", mem[I], mem[I+1], mem[I+2], I, I+1, I+2); break; case 0x55: for(i = 0, k = (a & 0x0F00) >> 8; i <= k; i++) mem[I+i] = v[i]; break; case 0x65: for(i = 0, k = (a & 0x0F00) >> 8; i <= k; i++) v[i] = mem[I+i]; printf("0x65\n"); break; default: EXIT_FAILURE; } return 0; }
26.49697
423
0.440912
c490a3d33fcf8a0d70d6b7da30d1da0bcc526fe8
293
c
C
benchmarks/toplas/Fluctuat/rigidBody2.c
monadius/FPTaylor
55214506eaf1a5fbbecf098221b81c4cc375ac6f
[ "MIT" ]
21
2015-11-24T20:52:23.000Z
2022-02-18T15:04:48.000Z
benchmarks/toplas/Fluctuat/rigidBody2.c
oanaoana/FPTaylor
c14d05eb9dc59a1736f043789e9f8d2659f742a0
[ "MIT" ]
24
2016-10-31T16:46:00.000Z
2021-04-07T04:35:37.000Z
benchmarks/toplas/Fluctuat/rigidBody2.c
oanaoana/FPTaylor
c14d05eb9dc59a1736f043789e9f8d2659f742a0
[ "MIT" ]
7
2018-01-11T17:52:41.000Z
2021-08-24T01:52:59.000Z
#include "daed_builtins.h" int main(void) { double x1, x2, x3; double res; x1 = DBETWEEN_WITH_ULP(-15.0, 15.0); x2 = DBETWEEN_WITH_ULP(-15.0, 15.0); x3 = DBETWEEN_WITH_ULP(-15.0, 15.0); res = 2*x1*x2*x3 + 3*x3*x3 - x2*x1*x2*x3 + 3*x3*x3 - x2; DSENSITIVITY(res); return 0; }
18.3125
58
0.614334
3fc352a71dd2556631ae1d65c0d0fe5550207ae9
881
h
C
components/wallpaper/wallpaper_export.h
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
777
2017-08-29T15:15:32.000Z
2022-03-21T05:29:41.000Z
components/wallpaper/wallpaper_export.h
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
66
2017-08-30T18:31:18.000Z
2021-08-02T10:59:35.000Z
components/wallpaper/wallpaper_export.h
kjthegod/chromium
cf940f7f418436b77e15b1ea23e6fa100ca1c91a
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
123
2017-08-30T01:19:34.000Z
2022-03-17T22:55:31.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 COMPONENTS_WALLPAPER_EXPORT_H_ #define COMPONENTS_WALLPAPER_EXPORT_H_ // Defines WALLPAPER_EXPORT so that functionality implemented by the wallpaper // module can be exported to consumers. #if defined(COMPONENT_BUILD) #if defined(WIN32) #if defined(WALLPAPER_IMPLEMENTATION) #define WALLPAPER_EXPORT __declspec(dllexport) #else #define WALLPAPER_EXPORT __declspec(dllimport) #endif // defined(WALLPAPER_IMPLEMENTATION) #else // defined(WIN32) #if defined(WALLPAPER_IMPLEMENTATION) #define WALLPAPER_EXPORT __attribute__((visibility("default"))) #else #define WALLPAPER_EXPORT #endif #endif #else // defined(COMPONENT_BUILD) #define WALLPAPER_EXPORT #endif #endif // COMPONENTS_WALLPAPER_EXPORT_H_
26.69697
78
0.808173
e907dd63a5755cc256319250880af4aa96c1d9cf
1,337
h
C
TBVTableViewAdapter/Classes/Core/TBVTableViewAdapter.h
tobevoid/TBVTableViewAdapter
fd2595f43ba63e798ea2be248633a134c977c89c
[ "MIT" ]
null
null
null
TBVTableViewAdapter/Classes/Core/TBVTableViewAdapter.h
tobevoid/TBVTableViewAdapter
fd2595f43ba63e798ea2be248633a134c977c89c
[ "MIT" ]
null
null
null
TBVTableViewAdapter/Classes/Core/TBVTableViewAdapter.h
tobevoid/TBVTableViewAdapter
fd2595f43ba63e798ea2be248633a134c977c89c
[ "MIT" ]
null
null
null
// // TBVTableViewAdapter.h // TBVTableViewAdapter // // Created by tripleCC on 2017/6/16. // Copyright © 2017年 tripleCC. All rights reserved. // #import <UIKit/UIKit.h> #import "TBVTableViewAdapterMacro.h" #import "TBVTableViewCellProtocol.h" #import "TBVTableViewSection.h" #import "TBVTableViewItem.h" TBV_SUBCLASSING_RESTRICTED NS_ASSUME_NONNULL_BEGIN NS_SWIFT_NAME(TableViewAdapter) @interface TBVTableViewAdapter : NSObject @property (nullable, weak, nonatomic, readonly) UITableView *tableView; @property (nullable, strong, nonatomic, readonly) NSArray <TBVTableViewSection *> *sections; @property (nullable, strong, nonatomic, readonly) NSSet <Class> *registeredCellClasses; @property (nullable, strong, nonatomic, readonly) NSDictionary <NSString *, NSString *> *itemMapping; @property (nullable, weak, nonatomic) id <UITableViewDelegate> tableViewDelegate; - (instancetype)initWithTableView:(nonnull UITableView *)tableView; - (void)addSection:(nonnull TBVTableViewSection *)section; - (void)removeSection:(nonnull TBVTableViewSection *)section; - (void)registerItem:(nonnull Class)item withCell:(nonnull Class)cell; - (void)registerItems:(nonnull NSArray <Class> *)items; - (void)registerAllItems; - (void)reload; - (instancetype)init NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE; @end NS_ASSUME_NONNULL_END
32.609756
101
0.788332
6b3cdda38509f041664765624e5c1ebf4df578e8
117
c
C
libcheckext/checkext.c
davidschwartz1/FFT-C
a9f19a75ca234e30c4df62592fd7088d777d8f8c
[ "MIT" ]
7
2020-12-17T03:47:17.000Z
2021-10-17T20:41:20.000Z
libcheckext/checkext.c
davidschwartz1/FFT-C
a9f19a75ca234e30c4df62592fd7088d777d8f8c
[ "MIT" ]
2
2021-03-23T18:55:59.000Z
2021-08-01T03:06:20.000Z
libcheckext/checkext.c
davidschwartz1/FFT-C
a9f19a75ca234e30c4df62592fd7088d777d8f8c
[ "MIT" ]
4
2021-02-10T06:24:33.000Z
2022-01-25T08:29:33.000Z
#include "checkext.h" /* * Nothing to see here for time being. All functionality is in the header file macros. */
19.5
86
0.709402
758bc809c6be0a7aac33cc6d4a708067cad25dc2
160
h
C
iprecio.h
cbaldini/idr
e6baf30747d7ebc9c4504983fef241adad92b0f9
[ "CC0-1.0" ]
null
null
null
iprecio.h
cbaldini/idr
e6baf30747d7ebc9c4504983fef241adad92b0f9
[ "CC0-1.0" ]
null
null
null
iprecio.h
cbaldini/idr
e6baf30747d7ebc9c4504983fef241adad92b0f9
[ "CC0-1.0" ]
null
null
null
#ifndef IPRECIO_H #define IPRECIO_H class IPrecio { public: IPrecio(); void CalcularPrecio(double a); double Resultado(); }; #endif // IPRECIO_H
11.428571
34
0.68125
18cf8f3d2a3d35e75d4a44d1bfda0f303367e850
5,862
h
C
TheCProgrammingLanguage/SqliteCustomFunctions/SqliteCustomFunctions/nunicode/libnu/config.h
khindemit/Learning
3d52e573ae3a3464d6f31e93faa247aecf99a393
[ "MIT" ]
null
null
null
TheCProgrammingLanguage/SqliteCustomFunctions/SqliteCustomFunctions/nunicode/libnu/config.h
khindemit/Learning
3d52e573ae3a3464d6f31e93faa247aecf99a393
[ "MIT" ]
null
null
null
TheCProgrammingLanguage/SqliteCustomFunctions/SqliteCustomFunctions/nunicode/libnu/config.h
khindemit/Learning
3d52e573ae3a3464d6f31e93faa247aecf99a393
[ "MIT" ]
null
null
null
#ifndef NU_BUILD_CONFIG_H #define NU_BUILD_CONFIG_H /** @file config.h * * This file list available build options and provide some shortcuts, * like NU_WITH_UTF16 will enable NU_WITH_UTF16LE + NU_WITH_UTF16BE. * * At build time you might set either particular option or shortcut. Either * way you don't have to and shouldn't modify this file, just set build flags * at the environment. * * This file will also enable several dependencies for you: case-mapping * depends on NU_WITH_UDB, NU_UTF8_READER and so. */ /* Definitions not covered in this file which should be defined * externally. * * NU_BUILD_STATIC: will change functions visibility to "hidden" (GCC). * @see defines.h * * NU_DISABLE_CONTRACTIONS: disables forward-reading during collation, * only weights of a single codepoints will be compared (enabled in release build) */ /* Enable everything, see below for details on a specific option */ #ifdef NU_WITH_EVERYTHING # define NU_WITH_UTF8 # define NU_WITH_CESU8 # define NU_WITH_UTF16 # define NU_WITH_UTF16HE # define NU_WITH_UTF32 # define NU_WITH_UTF32HE # define NU_WITH_STRINGS # define NU_WITH_EXTRA # define NU_WITH_REVERSE_READ # define NU_WITH_VALIDATION # define NU_WITH_COLLATION # define NU_WITH_CASEMAP # define NU_WITH_UNACCENT #endif /* NU_WITH_EVERYTHING */ /* Enable UTF-8 decoding and encoding */ #ifdef NU_WITH_UTF8 # define NU_WITH_UTF8_READER /* UTF-8 decoding functions */ # define NU_WITH_UTF8_WRITER /* UTF-8 encoding functions */ #endif /* NU_WITH_UTF8 */ /* Enable CESU-8 decoding and encoding */ #ifdef NU_WITH_CESU8 # define NU_WITH_CESU8_READER # define NU_WITH_CESU8_WRITER #endif /* NU_WITH_CESU8 */ /* Enable UTF-16LE decoding and encoding */ #ifdef NU_WITH_UTF16LE # define NU_WITH_UTF16LE_READER # define NU_WITH_UTF16LE_WRITER #endif /* NU_WITH_UTF16LE */ /* Enable UTF-16BE decoding and encoding */ #ifdef NU_WITH_UTF16BE # define NU_WITH_UTF16BE_READER # define NU_WITH_UTF16BE_WRITER #endif /* NU_WITH_UTF16BE */ /* Enable UTF-16HE decoding and encoding */ #ifdef NU_WITH_UTF16HE # define NU_WITH_UTF16HE_READER # define NU_WITH_UTF16HE_WRITER #endif /* NU_WITH_UTF16HE */ /* Enable all UTF-16 options */ #ifdef NU_WITH_UTF16 # define NU_WITH_UTF16_READER # define NU_WITH_UTF16_WRITER #endif /* NU_WITH_UTF16 */ /* Enable UTF-16LE and BE decoders of UTF-16 decoder is requested */ #ifdef NU_WITH_UTF16_READER # define NU_WITH_UTF16LE_READER # define NU_WITH_UTF16BE_READER #endif /* NU_WITH_UTF16_READER */ /* Enable UTF-16LE and BE encoders of UTF-16 encoder is requested */ #ifdef NU_WITH_UTF16_WRITER # define NU_WITH_UTF16LE_WRITER # define NU_WITH_UTF16BE_WRITER #endif /* NU_WITH_UTF16_WRITER */ /* Enable UTF-32LE decoding and encoding */ #ifdef NU_WITH_UTF32LE # define NU_WITH_UTF32LE_READER # define NU_WITH_UTF32LE_WRITER #endif /* NU_WITH_UTF32LE */ /* Enable UTF-32BE decoding and encoding */ #ifdef NU_WITH_UTF32BE # define NU_WITH_UTF32BE_READER # define NU_WITH_UTF32BE_WRITER #endif /* NU_WITH_UTF32BE */ /* Enable UTF-32HE decoding and encoding */ #ifdef NU_WITH_UTF32HE # define NU_WITH_UTF32HE_READER # define NU_WITH_UTF32HE_WRITER #endif /* NU_WITH_UTF32HE */ /* Enable all UTF-32 options */ #ifdef NU_WITH_UTF32 # define NU_WITH_UTF32_READER # define NU_WITH_UTF32_WRITER #endif /* NU_WITH_UTF32 */ /* Enable UTF-32LE and BE decoders of UTF-32 decoder is requested */ #ifdef NU_WITH_UTF32_READER # define NU_WITH_UTF32LE_READER # define NU_WITH_UTF32BE_READER #endif /* NU_WITH_UTF32_READER */ /* Enable UTF-32LE and BE encoders of UTF-32 encoder is requested */ #ifdef NU_WITH_UTF32_WRITER # define NU_WITH_UTF32LE_WRITER # define NU_WITH_UTF32BE_WRITER #endif /* NU_WITH_UTF32_WRITER */ /* Shortcut for all string functions */ #ifdef NU_WITH_STRINGS # define NU_WITH_Z_STRINGS /* 0-terminated string functions */ # define NU_WITH_N_STRINGS /* unterminated string functions */ #endif /* NU_WITH_STRINGS */ /* Shortcut for extra string functions */ #ifdef NU_WITH_EXTRA # define NU_WITH_Z_EXTRA /* extra functions for 0-terminated strings */ # define NU_WITH_N_EXTRA /* extra functions for unterminated strings */ #endif /* NU_WITH_STRINGS */ /* Enable collation functions */ #ifdef NU_WITH_COLLATION # define NU_WITH_Z_COLLATION /* collation functions for 0-terminated strings */ # define NU_WITH_N_COLLATION /* collation functions for unterminated strings */ #endif /* NU_WITH_COLLATION */ /* Requirements for collation functions on 0-terminated strings */ #ifdef NU_WITH_Z_COLLATION # define NU_WITH_Z_STRINGS # define NU_WITH_TOUPPER /* nu_toupper() */ #endif /* Requirements for collation functions * on unterminated strings */ #ifdef NU_WITH_N_COLLATION # define NU_WITH_N_STRINGS # define NU_WITH_TOUPPER #endif /* Requirements for casemap functions */ #ifdef NU_WITH_CASEMAP # define NU_WITH_TOLOWER /* nu_tolower() */ # define NU_WITH_TOUPPER # define NU_WITH_TOFOLD #endif /* NU_WITH_CASEMAP */ /* More requirements for collation functions all collation functions depends * on NU_WITH_DUCET */ #if (defined NU_WITH_Z_COLLATION) || (defined NU_WITH_N_COLLATION) # ifndef NU_WITH_DUCET # define NU_WITH_DUCET # endif #endif /* All collation and casemapping functions depends on NU_WITH_UDB */ #if (defined NU_WITH_Z_COLLATION) || (defined NU_WITH_N_COLLATION) \ || (defined NU_WITH_TOLOWER) || (defined NU_WITH_TOUPPER) || (defined NU_WITH_TOFOLD) \ || (defined NU_WITH_UNACCENT) # ifndef NU_WITH_UDB # define NU_WITH_UDB /* nu_udb_* functions, pretty much internal stuff */ # endif /* NU_WITH_UDB */ #endif /* DUCET implementation depends on NU_WITH_UDB */ #ifdef NU_WITH_DUCET # define NU_WITH_UDB #endif /* NU_WITH_DUCET */ /* NU_WITH_UDB depends on NU_WITH_UTF8_READER because internal encoding * of UDB is UTF-8 */ #ifdef NU_WITH_UDB # define NU_WITH_UTF8_READER #endif /* NU_WITH_UDB */ #endif /* NU_BUILD_CONFIG_H */
30.061538
87
0.781303
b724d0e839cd446f7caeb4686f18ad30e35b3ccd
6,642
h
C
AdskLogo/StdAfx.h
MadhukarMoogala/adn_adskLogo
e491636f4e0ff29be5e10a0fd375277b48c6bb83
[ "MIT" ]
1
2021-07-20T01:13:28.000Z
2021-07-20T01:13:28.000Z
AdskLogo/StdAfx.h
MadhukarMoogala/adn_adskLogo
e491636f4e0ff29be5e10a0fd375277b48c6bb83
[ "MIT" ]
null
null
null
AdskLogo/StdAfx.h
MadhukarMoogala/adn_adskLogo
e491636f4e0ff29be5e10a0fd375277b48c6bb83
[ "MIT" ]
4
2019-03-21T13:33:36.000Z
2020-06-14T03:43:03.000Z
// (C) Copyright 2002-2012 by Autodesk, Inc. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted, // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM "AS IS" AND WITH ALL FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. // //----------------------------------------------------------------------------- //- StdAfx.h : include file for standard system include files, //- or project specific include files that are used frequently, //- but are changed infrequently //----------------------------------------------------------------------------- #pragma once #define ADSKLOGO_MODULE #ifndef _ALLOW_RTCc_IN_STL #define _ALLOW_RTCc_IN_STL #endif #pragma pack (push, 8) #pragma warning(disable: 4786 4996) //#pragma warning(disable: 4098) //----------------------------------------------------------------------------- #define STRICT #ifndef VC_EXTRALEAN #define VC_EXTRALEAN //- Exclude rarely-used stuff from Windows headers #endif //- Modify the following defines if you have to target a platform prior to the ones specified below. //- Refer to MSDN for the latest info on corresponding values for different platforms. #ifndef WINVER //- Allow use of features specific to Windows 95 and Windows NT 4 or later. #define WINVER 0x0601 //- Change this to the appropriate value to target Windows 98 and Windows 2000 or later. #endif #ifndef _WIN32_WINNT #define _WIN32_WINNT 0x0601 #endif //- ObjectARX and OMF headers needs this #include <map> //----------------------------------------------------------------------------- #include <afxwin.h> //- MFC core and standard components #include <afxext.h> //- MFC extensions #include <afxcmn.h> //- MFC support for Windows Common Controls //----------------------------------------------------------------------------- //- Include ObjectDBX/ObjectARX headers //- Uncomment one of the following lines to bring a given library in your project. //#define _BREP_SUPPORT_ //- Support for the BRep API //#define _HLR_SUPPORT_ //- Support for the Hidden Line Removal API //#define _AMODELER_SUPPORT_ //- Support for the AModeler API //#define _ASE_SUPPORT_ //- Support for the ASI/ASE API //#define _RENDER_SUPPORT_ //- Support for the AutoCAD Render API //#define _ARX_CUSTOM_DRAG_N_DROP_ //- Support for the ObjectARX Drag'n Drop API //#define _INC_LEAGACY_HEADERS_ //- Include legacy headers in this project #include "arxHeaders.h" #include <Ac64BitHelpers.h> //----------------------------------------------------------------------------- #include "DocData.h" //- Your document specific data class holder //- Declare it as an extern here so that it becomes available in all modules extern AcApDataManager<CDocData> DocVars ; /**************************************************************************** ** ** CLASS SdStrObjIdNode: ** ** **jma ** *************************************/ class SdStrObjIdNode { friend class SdStrObjIdList; friend class SdStrObjIdListIterator; private: // constructors/destructors SdStrObjIdNode(LPCTSTR name, const AcDbObjectId& objId); // data members CString m_name; AcDbObjectId m_objid; // outlawed functions SdStrObjIdNode(const SdStrObjIdNode& copy); SdStrObjIdNode& operator=(const SdStrObjIdNode& copy); }; /**************************************************************************** ** ** CLASS SdStrObjIdList: ** ** **jma ** *************************************/ class SdStrObjIdList { friend class SdStrObjIdListIterator; // allow direct access to underlying list public: // constructors/destructors SdStrObjIdList(BOOL caseSensitive = TRUE); virtual ~SdStrObjIdList(); // operations int Count() const { // 64Bit: I don't think we'll ever need THAT many (2 billion) // objects, especially in samples (this class isn't used any- // where else). Keep it as it is for now until I hear shouting. return AcIntPtrToInt(m_list.GetCount()); } virtual POSITION AddHead(LPCTSTR str, const AcDbObjectId& objId); virtual POSITION AddTail(LPCTSTR str, const AcDbObjectId& objId); virtual POSITION AddAlpha(LPCTSTR str, const AcDbObjectId& objId); virtual BOOL GetAtIndex(int index, CString& str, AcDbObjectId& objId) const; virtual BOOL GetIndexFor(const CString& str, int& index) const; virtual BOOL GetIndexFor(const AcDbObjectId& objId, int& index) const; virtual BOOL GetMatchFor(const AcDbObjectId& objId, CString& str) const; virtual BOOL GetMatchFor(const CString& str, AcDbObjectId& objId) const; virtual BOOL Rename(const CString& oldName, const CString& newName); virtual void RemoveAt(int index); virtual void RemoveAll(); private: // data members CPtrList m_list; BOOL m_caseSensitive; // outlawed functions SdStrObjIdList(const SdStrObjIdList&); SdStrObjIdList& operator=(const SdStrObjIdList&); }; /**************************************************************************** ** ** CLASS SdStrObjIdListIterator: ** ** **jma ** *************************************/ class SdStrObjIdListIterator { public: // constructors/destructor SdStrObjIdListIterator(const SdStrObjIdList& list); virtual ~SdStrObjIdListIterator() {}; virtual void toFirst() { m_pos = m_list.GetHeadPosition(); } virtual void toLast() { m_pos = m_list.GetTailPosition(); } virtual void previous() { m_list.GetPrev(m_pos); } virtual void next() { m_list.GetNext(m_pos); } virtual void item(CString& name, AcDbObjectId& objId) const; virtual BOOL done() const { return(m_pos == NULL); } private: // data members POSITION m_pos; const CPtrList& m_list; // outlawed functions (for now) SdStrObjIdListIterator(const SdStrObjIdListIterator&); SdStrObjIdListIterator& operator=(const SdStrObjIdListIterator&); }; #pragma pack (pop)
34.061538
112
0.636555
764f66e5a9cec5df06f41adff32a67d4245ec8dc
420
h
C
mclient/Controllers/MessageList/MCLMessageListLoadingViewController.h
Stitch7/mclient
adda57fadc9b045535e609fe2d8e20c4cfa11fb0
[ "MIT" ]
5
2017-01-03T21:56:00.000Z
2020-05-10T20:17:20.000Z
mclient/Controllers/MessageList/MCLMessageListLoadingViewController.h
Stitch7/mclient
adda57fadc9b045535e609fe2d8e20c4cfa11fb0
[ "MIT" ]
1
2019-11-25T09:41:03.000Z
2019-11-25T09:41:03.000Z
mclient/Controllers/MessageList/MCLMessageListLoadingViewController.h
Stitch7/mclient
adda57fadc9b045535e609fe2d8e20c4cfa11fb0
[ "MIT" ]
2
2017-01-06T14:27:25.000Z
2019-11-23T11:00:13.000Z
// // MCLMessageListLoadingViewController.h // mclient // // Copyright © 2014 - 2019 Christopher Reitz. Licensed under the MIT license. // See LICENSE file in the project root for full license information. // #import "MCLLoadingViewController.h" @protocol MCLDependencyBag; @class MCLThread; @interface MCLMessageListLoadingViewController : MCLLoadingViewController - (void)loadThread:(MCLThread *)thread; @end
22.105263
78
0.77619
49622c50824a923217fb0799d41d68c79efb1b3a
849
h
C
StripeTastic.Firmware/lib/StripeBridge/Models/StripeInformation.h
Ruffo324/StripeTastic
8925edd4ff4b16e91d327a83ff9c63ee0e367d16
[ "MIT" ]
1
2020-10-28T19:36:46.000Z
2020-10-28T19:36:46.000Z
StripeTastic.Firmware/lib/StripeBridge/Models/StripeInformation.h
Ruffo324/StripeTastic
8925edd4ff4b16e91d327a83ff9c63ee0e367d16
[ "MIT" ]
null
null
null
StripeTastic.Firmware/lib/StripeBridge/Models/StripeInformation.h
Ruffo324/StripeTastic
8925edd4ff4b16e91d327a83ff9c63ee0e367d16
[ "MIT" ]
null
null
null
#pragma once namespace StripeBridge { namespace Models { /** * Contains some "real-life" informations about the stripe. Used GPIO pin, connected led count, etc.. * TODO: Better name for this. * */ struct StripeInformation { /// GPIO of the stripe data connection. int GPIOPin; /// Total amount of single LED on the used stripe. int PixelCount; int PixelCountTwoColors() { return PixelCount / 2; } int PixelCountThreeColors() { return PixelCount / 3; } int PixelCountTop() // TODO: Warum? { return PixelCount + 2; } }; } // namespace Models } // namespace StripeBridge
24.257143
110
0.487633
e45dff6f9a465a563f7b0df2c8bc54e1f7c37755
3,903
c
C
util.c
refexchange/addressbook
e52e518ff92bd298c5145061293da6487a543cd5
[ "MIT" ]
null
null
null
util.c
refexchange/addressbook
e52e518ff92bd298c5145061293da6487a543cd5
[ "MIT" ]
null
null
null
util.c
refexchange/addressbook
e52e518ff92bd298c5145061293da6487a543cd5
[ "MIT" ]
null
null
null
// Super fast integer to string converts. Up to 23x faster than sprintf. #include <stdlib.h> #include <stdio.h> #include "util.h" const char gDigitsLut[200] = { '0','0','0','1','0','2','0','3','0','4','0','5','0','6','0','7','0','8','0','9', '1','0','1','1','1','2','1','3','1','4','1','5','1','6','1','7','1','8','1','9', '2','0','2','1','2','2','2','3','2','4','2','5','2','6','2','7','2','8','2','9', '3','0','3','1','3','2','3','3','3','4','3','5','3','6','3','7','3','8','3','9', '4','0','4','1','4','2','4','3','4','4','4','5','4','6','4','7','4','8','4','9', '5','0','5','1','5','2','5','3','5','4','5','5','5','6','5','7','5','8','5','9', '6','0','6','1','6','2','6','3','6','4','6','5','6','6','6','7','6','8','6','9', '7','0','7','1','7','2','7','3','7','4','7','5','7','6','7','7','7','8','7','9', '8','0','8','1','8','2','8','3','8','4','8','5','8','6','8','7','8','8','8','9', '9','0','9','1','9','2','9','3','9','4','9','5','9','6','9','7','9','8','9','9' }; #define BEGIN2(n) \ do { \ int t = (n); \ if(t < 10) *p++ = '0' + t; \ else { \ t *= 2; \ *p++ = gDigitsLut[t]; \ *p++ = gDigitsLut[t + 1]; \ } \ } while(0) #define MIDDLE2(n) \ do { \ int t = (n) * 2; \ *p++ = gDigitsLut[t]; \ *p++ = gDigitsLut[t + 1]; \ } while(0) #define BEGIN4(n) \ do { \ int t4 = (n); \ if(t4 < 100) BEGIN2(t4); \ else { BEGIN2(t4 / 100); MIDDLE2(t4 % 100); } \ } while(0) #define MIDDLE4(n) \ do { \ int t4 = (n); \ MIDDLE2(t4 / 100); MIDDLE2(t4 % 100); \ } while(0) #define BEGIN8(n) \ do { \ uint32_t t8 = (n); \ if(t8 < 10000) BEGIN4(t8); \ else { BEGIN4(t8 / 10000); MIDDLE4(t8 % 10000); } \ } while(0) #define MIDDLE8(n) \ do { \ uint32_t t8 = (n); \ MIDDLE4(t8 / 10000); MIDDLE4(t8 % 10000); \ } while(0) #define MIDDLE16(n) \ do { \ uint64_t t16 = (n); \ MIDDLE8(t16 / 100000000); MIDDLE8(t16 % 100000000); \ } while(0) void u32toa(uint32_t x, char* p) { if(x < 100000000) BEGIN8(x); else { BEGIN2(x / 100000000); MIDDLE8(x % 100000000); } *p = 0; } void i32toa(int32_t x, char* p) { uint64_t t; if(x >= 0) t = x; else *p++ = '-', t = -(uint32_t)(x); u32toa(t, p); } void u64toa(uint64_t x, char* p) { if(x < 100000000) BEGIN8(x); else if(x < 10000000000000000) { BEGIN8(x / 100000000); MIDDLE8(x % 100000000); } else { BEGIN4(x / 10000000000000000); MIDDLE16(x % 10000000000000000); } *p = 0; } void i64toa(int64_t x, char* p) { uint64_t t; if(x >= 0) t = x; else *p++ = '-', t = -(uint64_t)(x); u64toa(t, p); } int isEnglishName(const char *name) { if (!name) { return 0; } for (int i = 0; name[i] != '\0'; i++) { if (!isalpha(name[i])) { return 0; } } return 1; } void utilFreeStrv(int argc, char **argv) { while (--argc) free(argv[argc]); } size_t getFileSize(const char *filename) { size_t return_value; FILE *fp = fopen(filename, "r"); fseek(fp, 0, SEEK_END); return_value = (size_t)ftell(fp); return return_value; } size_t rewriteFile(const char *filename, const char *content) { FILE *fp = fopen(filename, "w"); size_t return_value = strlen(content); fwrite(content, sizeof(char), (size_t)return_value, fp); fclose(fp); return return_value; } char *getFileContent(const char *filename, size_t *size) { FILE *fp = fopen(filename, "r"); if (!fp) return NULL; fseek(fp, 0, SEEK_END); *size = (size_t)ftell(fp); fseek(fp, 0, SEEK_SET); char *dest = stralloc((size_t)(*size) + 1); fread(dest, sizeof(char), (size_t)*size, fp); fclose(fp); return dest; }
25.509804
88
0.45401
9d4ca4789dc93e306b27c4ebadca5adf64748a62
1,240
c
C
software/kummer/arm-m25519/dh.c
joostrenes/web
41197df82af97d8fedca9324f4214f0ff5058283
[ "MIT" ]
null
null
null
software/kummer/arm-m25519/dh.c
joostrenes/web
41197df82af97d8fedca9324f4214f0ff5058283
[ "MIT" ]
null
null
null
software/kummer/arm-m25519/dh.c
joostrenes/web
41197df82af97d8fedca9324f4214f0ff5058283
[ "MIT" ]
null
null
null
#include "dh.h" int dh_keygen( unsigned char *pk, unsigned char *sk ) { /* * Generate a public key x-coordinate on the Montgomery curve. * The secret key is clamped before usage. * * Input: * sk (32 bytes): 32 bytes of randomness * * Output: * pk (32 bytes): Public key, x-coordinate (no sign bit) */ ecp R; fe25519 rx; group_scalar d; sk[0] &= 248; sk[31] &= 127; sk[31] |= 64; group_scalar_get32(&d, sk); ladder_base(&R, &d); compress(&rx, &R); fe25519_pack(pk, &rx); return 0; } int dh_exchange( unsigned char *ss, unsigned char *pk, unsigned char *sk ) { /* * Generate a shared secret * * Input: * sk (32 bytes): 32 bytes of randomness * pk (32 bytes): Public key, x-coordinate (no sign bit) * * Output: * ss (32 bytes): Shared secret, x-coordinate (no sign bit) */ ecp SS, R; fe25519 rx; group_scalar d; fe25519_unpack(&rx, pk); decompress(&R, &rx); group_scalar_get32(&d, sk); ladder(&SS, &R, &rx, &d); compress(&rx, &SS); fe25519_pack(ss, &rx); return 0; }
18.507463
68
0.518548
4f85018e95ffd51f9735e2f82d927fc9158cf9e8
12,698
c
C
QP/v5.4.2/qpcpp/examples/embos/arm-cm/dpp_stm32f429-discovery/iar/Setup/JLINKMEM_Process.c
hyller/GladiatorCots
36a69df68675bb40b562081c531e6674037192a8
[ "Unlicense" ]
null
null
null
QP/v5.4.2/qpcpp/examples/embos/arm-cm/dpp_stm32f429-discovery/iar/Setup/JLINKMEM_Process.c
hyller/GladiatorCots
36a69df68675bb40b562081c531e6674037192a8
[ "Unlicense" ]
null
null
null
QP/v5.4.2/qpcpp/examples/embos/arm-cm/dpp_stm32f429-discovery/iar/Setup/JLINKMEM_Process.c
hyller/GladiatorCots
36a69df68675bb40b562081c531e6674037192a8
[ "Unlicense" ]
null
null
null
/********************************************************************* * SEGGER MICROCONTROLLER GmbH & Co KG * * Solutions for real time microcontroller applications * ********************************************************************** * * * (c) 1995 - 2014 SEGGER Microcontroller GmbH & Co KG * * * * www.segger.com Support: support@segger.com * * * ********************************************************************** * * * embOS * Real time operating system for microcontrollers * * * * * * Please note: * * * * Knowledge of this file may under no circumstances * * be used to write a similar product or a real-time * * operating system for in-house use. * * * * Thank you for your fairness ! * * * ********************************************************************** * * * OS version: 4.00 * * * ********************************************************************** ---------------------------------------------------------------------- File : JLINKMEM_Process.c Purpose : Data handler for ARM J-Link communication over memory Layout of communication area: +----------+ TOS - TX_SIZE - RX_SIZE - 6 | | | RX_BUF | | | +----------+ TOS - TX_SIZE - 6 | RX_CNT | +----------+ TOS - TX_SIZE - 5 | HOST_ACT | +----------+ TOS - TX_SIZE - 4 | TX_CNT | +----------+ TOS - TX_SIZE - 3 | | | TX_BUF | | | +----------+ TOS - 3 | TX_SIZE | +----------+ TOS - 2 | RX_SIZE | +----------+ TOS - 1 | PROT_ID | +----------+ TOS TOS Initial top of stack as defined by linker settings (top of CSTACK) PROT_ID Magic number indicating the start of communication area RX_SIZE Size of receiving buffer in bytes TX_SIZE Size of sending buffer in bytes TX_BUF Sending buffer TX_CNT Number of bytes in sending buffer HOST_ACT Set to oen by host to indicate it is still active RX_CNT Number of bytes in the receiving buffer RX_BUF Receiving buffer ---------------------------END-OF-HEADER------------------------------ */ #include "RTOS.h" #include "JLINKMEM.h" /********************************************************************* * * Defines, configurable * ********************************************************************** */ /********************************************************************* * * Sizes of receiving and sending buffer. * * NOTE: * Before you change any of these values make sure OS_Start() * reserves enough bytes for the communication area. */ #define RX_BUF_SIZE 8 #define TX_BUF_SIZE 18 /********************************************************************* * * Defines, non- configurable * ********************************************************************** */ #define U8 unsigned char #define U16 unsigned short #define U32 unsigned int #define MAGIC_NUM 0x52 /* Identifies the start of our communication area. */ #define PROT_ID (*(volatile U8 *)(_BaseAddr - 1)) /* Id of the protocol. Always set to MAGIC_NUM */ #define RX_SIZE (*(volatile U8 *)(_BaseAddr - 2)) /* Size of receiving buffer in bytes */ #define TX_SIZE (*(volatile U8 *)(_BaseAddr - 3)) /* Size of sending buffer in bytes */ #define TX_CNT (*(volatile U8 *)(_BaseAddr - TX_BUF_SIZE - 4)) /* Stores the number of bytes we send to host */ /* Set by host to a non-null value when it connects to target. * The target sets this to null when it detects a communication timeout. */ #define HOST_CON (*(volatile U8 *)(_BaseAddr - TX_BUF_SIZE - 5)) #define RX_CNT (*(volatile U8 *)(_BaseAddr - TX_BUF_SIZE - 6)) /* Stores the number of bytes the host sent to us */ #define TX_TIMEOUT 1000 /* Time to wait for host to fetch the data from sending buffer (in ms) */ #define VTOR_ADDR (*(volatile OS_U32*) (0xE000ED08)) /* Vector table base register address */ /********************************************************************* * * Static data * ********************************************************************** */ /* Pointer to user callbacks */ void (* _pfOnRx) (U8 Data); void (* _pfOnTx) (void); OS_INT (* _pfGetNextChar) (void); static U32 _BaseAddr; static int _TxIsPending; /* Set when there is a character waiting to be sent */ static U8 _TxPendingData; /* Holds tha character waiting to be sent */ static int _IsInited; /* Set when the communication is initialised */ static U8* _pRxBuf; /* Start of receiving buffer */ static U8* _pTxBuf; /* Start of sending buffer */ /* Supervises the connection to host */ static int _TxTimeout; /* Set when the host fails to fetch our data */ static int _TxTimeoutTimer; static int _TxBufLocked; /* Serialises the access to our sending buffer */ /********************************************************************* * * Static code * ********************************************************************** */ /********************************************************************* * * _RetriggerTimer * * Function description */ static void _RetriggerTimer(void) { _TxTimeoutTimer = TX_TIMEOUT; } /********************************************************************* * * _HandleTxTimeout * * Function description * Sets the connection to host to inactive when the host fails to * fetch the data we send to it. Called when the send timeout * expires. */ static void _StopTimer(void) { _TxTimeoutTimer = 0; } /********************************************************************* * * _Init * * Function description * Performs initalisation of memory locations used for communication. */ static void _Init(void) { OS_U32 VectorTableBaseAddr; /* On Cortex-M initial top of stack is stored at address defined by VTOR */ VectorTableBaseAddr = VTOR_ADDR; VectorTableBaseAddr &= ~(0x3FuL); // Mask b6..b0 as those might not be zero ARM DDI 0403D chapter B3.2.5 page B3-716 _BaseAddr = (*(OS_U32*)VectorTableBaseAddr); HOST_CON = 0; RX_SIZE = RX_BUF_SIZE; TX_SIZE = TX_BUF_SIZE; RX_CNT = 0; TX_CNT = 0; PROT_ID = MAGIC_NUM; _pTxBuf = (U8 *)(_BaseAddr - TX_BUF_SIZE - 3); _pRxBuf = (U8 *)(_BaseAddr - TX_BUF_SIZE - RX_BUF_SIZE - 6); _TxIsPending = 0; } /********************************************************************* * * _LockTxBuf * * Function description * Gains exclusive access to sending buffer. * * Return value * 1 Sending buffer locked * 0 Sending buffer couldn't be locked as already in use. */ static int _LockTxBuf(void) { int Locked = 0; OS_DI(); if (!_TxBufLocked) { _TxBufLocked = 1; Locked = 1; } OS_RestoreI(); return Locked; } /********************************************************************* * * _UnlockTxBuf * * Function description * Releases the exclusive access to sending buffer. */ static void _UnlockTxBuf(void) { _TxBufLocked = 0; } /********************************************************************* * * _Receive * * Function description * Performs Command / data read from host */ static void _Receive(void) { int i; U8 *pBuf; if (RX_CNT > 0) { /* Data received ? */ if (_pfOnRx != NULL) { pBuf = _pRxBuf + (RX_BUF_SIZE - RX_CNT); for (i = 0; i < RX_CNT; ++i) { _pfOnRx(*pBuf); ++pBuf; } } RX_CNT = 0; } } /********************************************************************* * * _FillTxBuf * * Function description * Stores bytes in the sending buffer. */ static void _FillTxBuf(U8 Data) { int Cnt = 0; OS_INT Byte; U8 *pBuf; pBuf = _pTxBuf; *pBuf = Data; ++pBuf; ++Cnt; if (_pfGetNextChar != NULL) { /* Get more bytes from the communication state machine * until the sending buffer is full. */ while (1) { if (Cnt >= TX_BUF_SIZE) { break; } Byte = _pfGetNextChar(); if (Byte < 0) { break; } *pBuf = (U8)Byte; ++pBuf; ++Cnt; } } OS_DI(); _RetriggerTimer(); TX_CNT = (U8)Cnt; OS_RestoreI(); } /********************************************************************* * * _DropTxData * * Function description * Empties the sending buffer of embOS. */ static void _DropTxData(void) { if (_pfGetNextChar != NULL) { while (_pfGetNextChar() >= 0) { ; } } } /********************************************************************* * * _Send * * Function description * Sends data back to host if embOSView is ready to receive data. */ static void _Send(void) { if (TX_CNT == 0) { /* Can we send data? */ _StopTimer(); if (_TxIsPending) { _FillTxBuf(_TxPendingData); _TxIsPending = 0; } else { if (_pfOnTx != NULL) { if (_LockTxBuf()) { _pfOnTx(); _UnlockTxBuf(); } } } } } /********************************************************************* * * Public code * ********************************************************************** */ /********************************************************************* * * JLINKMEM_Process * * Function description * This function should be called more or less regularily to allow * memory reads while the application progam is running. * The more often it is called, the higher the transfer speed. */ void JLINKMEM_Process(void) { if (OS_IsRunning()) { /* No communication until the embOS starts */ if (!_IsInited) { _Init(); _IsInited = 1; } if (HOST_CON) { /* Do nothing until the host connects to us */ // // Handle Timeout timer // if (_TxTimeoutTimer != 0) { _TxTimeoutTimer--; if (_TxTimeoutTimer == 0) { _TxTimeout = 1; } } if (_TxTimeout) { HOST_CON = 0; _TxTimeout = 0; _TxIsPending = 0; _DropTxData(); RX_CNT = 0; /* Drop all bytes form receiving buffer. */ } else { _Receive(); _Send(); } } } } /********************************************************************* * * JLINKMEM_SendChar * * Function description * Send data to the host. This function is non-blocking. * If data can not be send it is stored in a buffer * and sent later, when the handler is called. */ void JLINKMEM_SendChar(U8 Data) { if (OS_IsRunning()) { /* No communication until the embOS starts */ if (!_IsInited) { _Init(); _IsInited = 1; } if (HOST_CON) { /* Do nothing until embOSView connects to us */ if (TX_CNT == 0) { if (_LockTxBuf()) { _FillTxBuf(Data); _UnlockTxBuf(); } else { _TxIsPending = 1; _TxPendingData = Data; } } else { _TxIsPending = 1; _TxPendingData = Data; } } else { // // Host not connected, drop characters // _DropTxData(); } } else { // // embOS not started, drop characters // _DropTxData(); } } /********************************************************************* * * JLINKMEM_SetpfOnRx */ void JLINKMEM_SetpfOnRx(void (* pf)(U8 Data)) { _pfOnRx = pf; } /********************************************************************* * * JLINKMEM_SetpfOnTx */ void JLINKMEM_SetpfOnTx(void (* pf)(void)) { _pfOnTx = pf; } /********************************************************************* * * JLINKMEM_SetpfGetNextChar */ void JLINKMEM_SetpfGetNextChar(OS_INT (* pf)(void)) { _pfGetNextChar = pf; } /*************************** end of file ****************************/
28.470852
120
0.444322
8b0408be8d362fd0714c8c2f6874b7d2fb69a78c
1,019
h
C
Engine/source/shaderGen/shaderDependency.h
fr1tz/alux3d
249a3b51751ce3184d52879b481f83eabe89e7e3
[ "MIT" ]
46
2015-01-05T17:34:43.000Z
2022-01-04T04:03:09.000Z
Engine/source/shaderGen/shaderDependency.h
fr1tz/alux3d
249a3b51751ce3184d52879b481f83eabe89e7e3
[ "MIT" ]
10
2015-01-20T23:14:46.000Z
2019-04-05T22:04:15.000Z
Engine/source/shaderGen/shaderDependency.h
fr1tz/terminal-overload
85f0689a40022e5eb7e54dcb6ddfb5ddd82a0a60
[ "CC-BY-4.0" ]
9
2015-08-08T18:46:06.000Z
2021-02-01T13:53:20.000Z
// Copyright information can be found in the file named COPYING // located in the root directory of this distribution. #ifndef _SHADER_DEPENDENCY_H_ #define _SHADER_DEPENDENCY_H_ #ifndef _PATH_H_ #include "core/util/path.h" #endif class Stream; /// The base class for shader dependencies class ShaderDependency { public: virtual ~ShaderDependency() {} /// Compare this dependency to another one. virtual bool operator==( const ShaderDependency &cmpTo ) const { return this == &cmpTo; } /// Print the dependency into the header of a shader. virtual void print( Stream &s ) const = 0; }; /// A shader dependency for adding #include's into shadergen shaders. class ShaderIncludeDependency : public ShaderDependency { protected: Torque::Path mIncludePath; public: ShaderIncludeDependency( const Torque::Path &pathToInclude ); virtual bool operator==( const ShaderDependency &cmpTo ) const; virtual void print( Stream &s ) const; }; #endif // _SHADER_DEPENDENCY_H_
21.680851
69
0.730128
a073adfa58727554c950e4d8e13d2f952da90fbf
11,602
c
C
clicks/matrixr/lib/src/matrixr.c
StrahinjaJacimovic/mikrosdk_click_v2
f8002047c96605f340957a0d3fdbde33706d02ac
[ "MIT" ]
31
2020-10-02T14:15:14.000Z
2022-03-24T08:33:21.000Z
clicks/matrixr/lib/src/matrixr.c
greghol/mikrosdk_click_v2
76e5dec265dce5fca72c4b93f77afd668dde5dfa
[ "MIT" ]
4
2020-10-27T14:05:00.000Z
2022-03-10T09:38:57.000Z
clicks/matrixr/lib/src/matrixr.c
greghol/mikrosdk_click_v2
76e5dec265dce5fca72c4b93f77afd668dde5dfa
[ "MIT" ]
32
2020-11-28T07:56:42.000Z
2022-03-14T19:42:29.000Z
/**************************************************************************** ** Copyright (C) 2020 MikroElektronika d.o.o. ** Contact: https://www.mikroe.com/contact ** ** 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. ****************************************************************************/ /*! * @file matrixr.c * @brief Matrix R Click Driver. */ #include "matrixr.h" // ------------------------------------------------------------- PRIVATE MACROS #define MATRIXR_DUMMY 0 // ------------------------------------------------------------------ CONSTANTS static const uint8_t matrix_ascii[][ 8 ] = { { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, // space -- 32 { 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x08 }, // ! -- 33 { 0x00, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x40 }, // " -- 34 { 0x00, 0x14, 0x14, 0x3E, 0x14, 0x3E, 0x14, 0x54 }, // # -- 35 { 0x00, 0x08, 0x1E, 0x28, 0x1C, 0x0A, 0x3C, 0x08 }, // $ -- 36 { 0x00, 0x30, 0x32, 0x04, 0x08, 0x10, 0x26, 0x46 }, // % -- 37 { 0x00, 0x18, 0x24, 0x28, 0x10, 0x2A, 0x24, 0x5A }, // & -- 38 { 0x00, 0x0C, 0x04, 0x08, 0x00, 0x00, 0x00, 0x40 }, // ' -- 39 { 0x00, 0x08, 0x10, 0x20, 0x20, 0x20, 0x10, 0x08 }, // ( -- 40 { 0x00, 0x08, 0x04, 0x02, 0x02, 0x02, 0x04, 0x08 }, // ) -- 41 { 0x00, 0x00, 0x08, 0x1C, 0x3E, 0x1C, 0x08, 0x00 }, // * -- 42 { 0x00, 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00 }, // + -- 43 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10 }, // , -- 44 { 0x00, 0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00 }, // - -- 45 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08 }, // . -- 46 { 0x00, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00 }, // / -- 47 { 0x00, 0x1C, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C }, // 0 -- 48 { 0x00, 0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08 }, // 1 -- 49 { 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x10, 0x20, 0x3E }, // 2 -- 50 { 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x02, 0x22, 0x1C }, // 3 -- 51 { 0x00, 0x04, 0x0C, 0x14, 0x24, 0x1E, 0x04, 0x04 }, // 4 -- 52 { 0x00, 0x3E, 0x20, 0x20, 0x3E, 0x02, 0x02, 0x7E }, // 5 -- 53 { 0x00, 0x0C, 0x10, 0x20, 0x3C, 0x22, 0x22, 0x1C }, // 6 -- 54 { 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x10, 0x50 }, // 7 -- 55 { 0x00, 0x1C, 0x22, 0x22, 0x1C, 0x22, 0x22, 0x5C }, // 8 -- 56 { 0x00, 0x1C, 0x22, 0x22, 0x1E, 0x02, 0x02, 0x5C }, // 9 -- 57 { 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00 }, // : -- 58 { 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x10 }, // ; -- 59 { 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04 }, // < -- 60 { 0x00, 0x00, 0x00, 0x3E, 0x00, 0x3E, 0x00, 0x00 }, // = -- 61 { 0x00, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10 }, // > -- 62 { 0x00, 0x1C, 0x22, 0x02, 0x0C, 0x08, 0x00, 0x08 }, // ? -- 63 { 0x00, 0x1C, 0x22, 0x02, 0x1A, 0x2A, 0x2A, 0x1C }, // @ -- 64 { 0x00, 0x1C, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22 }, // A -- 65 { 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x22, 0x22, 0x3C }, // B -- 66 { 0x00, 0x1C, 0x22, 0x20, 0x20, 0x20, 0x22, 0x1C }, // C -- 67 { 0x00, 0x38, 0x24, 0x22, 0x22, 0x22, 0x24, 0x38 }, // D -- 68 { 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x3E }, // E -- 69 { 0x00, 0x3E, 0x20, 0x20, 0x3C, 0x20, 0x20, 0x20 }, // F -- 70 { 0x00, 0x1C, 0x22, 0x20, 0x2E, 0x22, 0x22, 0x1E }, // G -- 71 { 0x00, 0x22, 0x22, 0x22, 0x3E, 0x22, 0x22, 0x22 }, // H -- 72 { 0x00, 0x1C, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C }, // I -- 73 { 0x00, 0x0E, 0x04, 0x04, 0x04, 0x04, 0x24, 0x18 }, // J -- 74 { 0x00, 0x22, 0x24, 0x28, 0x30, 0x28, 0x24, 0x22 }, // K -- 75 { 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3E }, // L -- 76 { 0x00, 0x22, 0x36, 0x2A, 0x2A, 0x22, 0x22, 0x22 }, // M -- 77 { 0x00, 0x22, 0x22, 0x32, 0x2A, 0x26, 0x22, 0x22 }, // N -- 78 { 0x00, 0x1C, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C }, // O -- 79 { 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x20, 0x20, 0x20 }, // P -- 80 { 0x00, 0x1C, 0x22, 0x22, 0x22, 0x2A, 0x24, 0x1A }, // Q -- 81 { 0x00, 0x3C, 0x22, 0x22, 0x3C, 0x28, 0x24, 0x22 }, // R -- 82 { 0x00, 0x1E, 0x20, 0x20, 0x1C, 0x02, 0x02, 0x3C }, // S -- 83 { 0x00, 0x3E, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, // T -- 84 { 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x1C }, // U -- 85 { 0x00, 0x22, 0x22, 0x22, 0x22, 0x22, 0x14, 0x08 }, // V -- 86 { 0x00, 0x22, 0x22, 0x22, 0x2A, 0x2A, 0x2A, 0x14 }, // W -- 87 { 0x00, 0x22, 0x22, 0x14, 0x08, 0x14, 0x22, 0x22 }, // X -- 88 { 0x00, 0x22, 0x22, 0x22, 0x1C, 0x08, 0x08, 0x08 }, // Y -- 89 { 0x00, 0x3E, 0x02, 0x04, 0x08, 0x10, 0x20, 0x3E }, // Z -- 90 { 0x00, 0x30, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30 }, // [ -- 91 { 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00 }, // \ -- 92 { 0x00, 0x0E, 0x02, 0x02, 0x02, 0x02, 0x02, 0x0E }, // ] -- 93 { 0x00, 0x08, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ^ -- 94 { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3E }, // _ -- 95 { 0x00, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00 }, // ` -- 96 { 0x00, 0x00, 0x00, 0x1C, 0x02, 0x1E, 0x22, 0x1E }, // a -- 97 { 0x00, 0x20, 0x20, 0x20, 0x2C, 0x32, 0x22, 0x3C }, // b -- 98 { 0x00, 0x00, 0x00, 0x3C, 0x20, 0x20, 0x22, 0x3C }, // c -- 99 { 0x00, 0x02, 0x02, 0x02, 0x1A, 0x26, 0x22, 0x1E }, // d -- 100 { 0x00, 0x00, 0x00, 0x1C, 0x22, 0x3E, 0x20, 0x1C }, // e -- 101 { 0x00, 0x0C, 0x12, 0x10, 0x38, 0x10, 0x10, 0x10 }, // f -- 102 { 0x00, 0x00, 0x1E, 0x22, 0x22, 0x1E, 0x02, 0x1C }, // g -- 103 { 0x00, 0x20, 0x20, 0x20, 0x2C, 0x32, 0x22, 0x22 }, // h -- 104 { 0x00, 0x00, 0x08, 0x00, 0x08, 0x08, 0x08, 0x08 }, // i -- 105 { 0x00, 0x04, 0x00, 0x0C, 0x04, 0x04, 0x24, 0x18 }, // j -- 106 { 0x00, 0x20, 0x20, 0x24, 0x28, 0x30, 0x28, 0x24 }, // k -- 107 { 0x00, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1C }, // l -- 108 { 0x00, 0x00, 0x00, 0x34, 0x2A, 0x2A, 0x22, 0x22 }, // m -- 109 { 0x00, 0x00, 0x00, 0x2C, 0x32, 0x22, 0x22, 0x22 }, // n -- 110 { 0x00, 0x00, 0x00, 0x1C, 0x22, 0x22, 0x22, 0x1C }, // o -- 111 { 0x00, 0x00, 0x00, 0x3C, 0x22, 0x3C, 0x20, 0x20 }, // p -- 112 { 0x00, 0x00, 0x00, 0x1A, 0x26, 0x1E, 0x02, 0x02 }, // q -- 113 { 0x00, 0x00, 0x00, 0x2C, 0x32, 0x20, 0x20, 0x20 }, // r -- 114 { 0x00, 0x00, 0x00, 0x1C, 0x20, 0x1C, 0x02, 0x3C }, // s -- 115 { 0x00, 0x10, 0x10, 0x38, 0x10, 0x10, 0x12, 0x0C }, // t -- 116 { 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x26, 0x1A }, // u -- 117 { 0x00, 0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x28 }, // v -- 118 { 0x00, 0x00, 0x00, 0x22, 0x22, 0x2A, 0x2A, 0x1C }, // w -- 119 { 0x00, 0x00, 0x00, 0x22, 0x14, 0x08, 0x14, 0x22 }, // x -- 120 { 0x00, 0x00, 0x00, 0x22, 0x22, 0x1E, 0x02, 0x1C }, // y -- 121 { 0x00, 0x00, 0x00, 0x3E, 0x04, 0x08, 0x10, 0x3E } // z -- 121 }; // ---------------------------------------------- PRIVATE FUNCTION DECLARATIONS static void dev_display_left ( matrixr_t *ctx, uint8_t row, uint8_t column ); static void dev_display_right ( matrixr_t *ctx, uint8_t row, uint8_t column ); // ------------------------------------------------ PUBLIC FUNCTION DEFINITIONS void matrixr_cfg_setup ( matrixr_cfg_t *cfg ) { // Communication gpio pins cfg->sck = HAL_PIN_NC; cfg->miso = HAL_PIN_NC; cfg->mosi = HAL_PIN_NC; cfg->cs = HAL_PIN_NC; // Additional gpio pins cfg->csn = HAL_PIN_NC; cfg->spi_speed = 100000; cfg->spi_mode = SPI_MASTER_MODE_0; cfg->cs_polarity = SPI_MASTER_CHIP_SELECT_POLARITY_ACTIVE_LOW; } MATRIXR_RETVAL matrixr_init ( matrixr_t *ctx, matrixr_cfg_t *cfg ) { spi_master_config_t spi_cfg; spi_master_configure_default( &spi_cfg ); spi_cfg.speed = cfg->spi_speed; spi_cfg.sck = cfg->sck; spi_cfg.miso = cfg->miso; spi_cfg.mosi = cfg->mosi; spi_cfg.default_write_data = MATRIXR_DUMMY; digital_out_init( &ctx->cs, cfg->cs ); ctx->chip_select = cfg->cs; if ( spi_master_open( &ctx->spi, &spi_cfg ) == SPI_MASTER_ERROR ) { return MATRIXR_INIT_ERROR; } spi_master_set_default_write_data( &ctx->spi, MATRIXR_DUMMY ); spi_master_set_speed( &ctx->spi, cfg->spi_speed ); spi_master_set_mode( &ctx->spi, cfg->spi_mode ); spi_master_set_chip_select_polarity( cfg->cs_polarity ); // Output pins digital_out_init( &ctx->csn , cfg->csn ); return MATRIXR_OK; } void matrixr_display_characters ( matrixr_t *ctx, uint8_t left_char, uint8_t right_char ) { int8_t i; for( i = 7; i >= 0; i-- ) { dev_display_left( ctx, matrix_ascii[ left_char - 32 ][ i ], 7 - i ); } for( i = 7; i >= 0; i-- ) { dev_display_right( ctx, matrix_ascii[ right_char - 32 ][ i ], 7 - i ); } } void matrixr_write_reg ( matrixr_t *ctx, uint8_t address, uint8_t input_data ) { spi_master_select_device( ctx->chip_select ); spi_master_write( &ctx->spi, &address, 1 ); spi_master_write( &ctx->spi, &input_data, 1 ); spi_master_deselect_device( ctx->chip_select ); digital_out_low( &ctx->csn ); spi_master_write( &ctx->spi, &address, 1 ); spi_master_write( &ctx->spi, &input_data, 1 ); digital_out_high( &ctx->csn ); } void matrixr_default_cfg ( matrixr_t *ctx ) { matrixr_write_reg( ctx, MATRIXR_DECODE_MODE_REG, MATRIXR_NO_DECODE ); matrixr_write_reg( ctx, MATRIXR_INTENSITY_REG, MATRIXR_INTEN_LVL_3 ); matrixr_write_reg( ctx, MATRIXR_SCAN_LIMIT_REG, MATRIXR_DISPLAY_DIGIT_0_6 ); matrixr_write_reg( ctx, MATRIXR_SHUTDOWN_REG, MATRIXR_NORMAL_OPERATION ); } void matrixr_set_csn_high ( matrixr_t *ctx ) { digital_out_high( &ctx->csn ); } void matrixr_set_csn_low ( matrixr_t *ctx ) { digital_out_low( &ctx->csn ); } // ----------------------------------------------- PRIVATE FUNCTION DEFINITIONS static void dev_display_left ( matrixr_t *ctx, uint8_t row, uint8_t column ) { spi_master_select_device( ctx->chip_select ); spi_master_write( &ctx->spi, &++column, 1 ); spi_master_write( &ctx->spi, &row, 1 ); spi_master_deselect_device( ctx->chip_select ); } static void dev_display_right ( matrixr_t *ctx, uint8_t row, uint8_t column ) { digital_out_low( &ctx->csn ); spi_master_write( &ctx->spi, &++column, 1 ); spi_master_write( &ctx->spi, &row, 1 ); digital_out_high( &ctx->csn ); } // ------------------------------------------------------------------------- END
45.677165
91
0.5593
e2a6d56369fb33a04641065b5476f50ef4737027
9,532
c
C
tools/sslio.c
nogoegst/bearssl
6a1dab03beac9a324fdaed36ffdeb5081ac64b9a
[ "MIT" ]
24
2016-11-09T12:51:48.000Z
2022-02-09T20:55:42.000Z
tools/sslio.c
nogoegst/bearssl
6a1dab03beac9a324fdaed36ffdeb5081ac64b9a
[ "MIT" ]
3
2017-08-09T07:17:39.000Z
2021-12-25T11:29:52.000Z
tools/sslio.c
nogoegst/bearssl
6a1dab03beac9a324fdaed36ffdeb5081ac64b9a
[ "MIT" ]
7
2016-11-12T22:50:36.000Z
2021-09-24T23:14:44.000Z
/* * Copyright (c) 2016 Thomas Pornin <pornin@bolet.org> * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <netdb.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <fcntl.h> #include <poll.h> #include "brssl.h" #include "bearssl.h" static void dump_blob(const char *name, const void *data, size_t len) { const unsigned char *buf; size_t u; buf = data; fprintf(stderr, "%s (len = %lu)", name, (unsigned long)len); for (u = 0; u < len; u ++) { if ((u & 15) == 0) { fprintf(stderr, "\n%08lX ", (unsigned long)u); } else if ((u & 7) == 0) { fprintf(stderr, " "); } fprintf(stderr, " %02x", buf[u]); } fprintf(stderr, "\n"); } /* * Inspect the provided data in case it is a "command" to trigger a * special behaviour. If the command is recognised, then it is executed * and this function returns 1. Otherwise, this function returns 0. */ static int run_command(br_ssl_engine_context *cc, unsigned char *buf, size_t len) { /* * A single static slot for saving session parameters. */ static br_ssl_session_parameters slot; static int slot_used = 0; size_t u; if (len < 2 || len > 3) { return 0; } if (len == 3 && (buf[1] != '\r' || buf[2] != '\n')) { return 0; } if (len == 2 && buf[1] != '\n') { return 0; } switch (buf[0]) { case 'Q': fprintf(stderr, "closing...\n"); br_ssl_engine_close(cc); return 1; case 'R': if (br_ssl_engine_renegotiate(cc)) { fprintf(stderr, "renegotiating...\n"); } else { fprintf(stderr, "not renegotiating.\n"); } return 1; case 'F': /* * Session forget is nominally client-only. But the * session parameters are in the engine structure, which * is the first field of the client context, so the cast * still works properly. On the server, this forgetting * has no effect. */ fprintf(stderr, "forgetting session...\n"); br_ssl_client_forget_session((br_ssl_client_context *)cc); return 1; case 'S': fprintf(stderr, "saving session parameters...\n"); br_ssl_engine_get_session_parameters(cc, &slot); fprintf(stderr, " id = "); for (u = 0; u < slot.session_id_len; u ++) { fprintf(stderr, "%02X", slot.session_id[u]); } fprintf(stderr, "\n"); slot_used = 1; return 1; case 'P': if (slot_used) { fprintf(stderr, "restoring session parameters...\n"); fprintf(stderr, " id = "); for (u = 0; u < slot.session_id_len; u ++) { fprintf(stderr, "%02X", slot.session_id[u]); } fprintf(stderr, "\n"); br_ssl_engine_set_session_parameters(cc, &slot); return 1; } return 0; default: return 0; } } /* see brssl.h */ int run_ssl_engine(br_ssl_engine_context *cc, int fd, unsigned flags) { int hsdetails; int retcode; int verbose; int trace; hsdetails = 0; retcode = 0; verbose = (flags & RUN_ENGINE_VERBOSE) != 0; trace = (flags & RUN_ENGINE_TRACE) != 0; /* * Make sure that stdin and stdout are non-blocking. */ fcntl(0, F_SETFL, O_NONBLOCK); fcntl(1, F_SETFL, O_NONBLOCK); /* * Perform the loop. */ for (;;) { unsigned st; int sendrec, recvrec, sendapp, recvapp; struct pollfd pfd[3]; int n; size_t u, k_fd, k_in, k_out; /* * Get current engine state. */ st = br_ssl_engine_current_state(cc); if (st == BR_SSL_CLOSED) { int err; err = br_ssl_engine_last_error(cc); if (err == BR_ERR_OK) { if (verbose) { fprintf(stderr, "SSL closed normally\n"); } retcode = 0; goto engine_exit; } else { fprintf(stderr, "ERROR: SSL error %d", err); retcode = err; if (err >= BR_ERR_SEND_FATAL_ALERT) { err -= BR_ERR_SEND_FATAL_ALERT; fprintf(stderr, " (sent alert %d)\n", err); } else if (err >= BR_ERR_RECV_FATAL_ALERT) { err -= BR_ERR_RECV_FATAL_ALERT; fprintf(stderr, " (received alert %d)\n", err); } else { const char *ename; ename = find_error_name(err, NULL); if (ename == NULL) { ename = "unknown"; } fprintf(stderr, " (%s)\n", ename); } goto engine_exit; } } /* * Compute descriptors that must be polled, depending * on engine state. */ sendrec = ((st & BR_SSL_SENDREC) != 0); recvrec = ((st & BR_SSL_RECVREC) != 0); sendapp = ((st & BR_SSL_SENDAPP) != 0); recvapp = ((st & BR_SSL_RECVAPP) != 0); if (verbose && sendapp && !hsdetails) { char csn[80]; const char *pname; fprintf(stderr, "Handshake completed\n"); fprintf(stderr, " version: "); switch (cc->session.version) { case BR_SSL30: fprintf(stderr, "SSL 3.0"); break; case BR_TLS10: fprintf(stderr, "TLS 1.0"); break; case BR_TLS11: fprintf(stderr, "TLS 1.1"); break; case BR_TLS12: fprintf(stderr, "TLS 1.2"); break; default: fprintf(stderr, "unknown (0x%04X)", (unsigned)cc->session.version); break; } fprintf(stderr, "\n"); get_suite_name_ext( cc->session.cipher_suite, csn, sizeof csn); fprintf(stderr, " cipher suite: %s\n", csn); fprintf(stderr, " secure renegotiation: %s\n", cc->reneg == 1 ? "no" : "yes"); pname = br_ssl_engine_get_selected_protocol(cc); if (pname != NULL) { fprintf(stderr, " protocol name (ALPN): %s\n", pname); } hsdetails = 1; } k_fd = 0; k_in = 0; k_out = 0; u = 0; if (sendrec || recvrec) { pfd[u].fd = fd; pfd[u].revents = 0; pfd[u].events = 0; if (sendrec) { pfd[u].events |= POLLOUT; } if (recvrec) { pfd[u].events |= POLLIN; } k_fd = u; u ++; } if (sendapp) { pfd[u].fd = 0; pfd[u].revents = 0; pfd[u].events = POLLIN; k_in = u; u ++; } if (recvapp) { pfd[u].fd = 1; pfd[u].revents = 0; pfd[u].events = POLLOUT; k_out = u; u ++; } n = poll(pfd, u, -1); if (n < 0) { if (errno == EINTR) { continue; } perror("ERROR: poll()"); retcode = -2; goto engine_exit; } if (n == 0) { continue; } /* * We transform closures/errors into read+write accesses * so as to force the read() or write() call that will * detect the situation. */ while (u -- > 0) { if (pfd[u].revents & (POLLERR | POLLHUP)) { pfd[u].revents |= POLLIN | POLLOUT; } } /* * We give preference to outgoing data, on stdout and on * the socket. */ if (recvapp) { if (pfd[k_out].revents & POLLOUT) { unsigned char *buf; size_t len; ssize_t wlen; buf = br_ssl_engine_recvapp_buf(cc, &len); wlen = write(1, buf, len); if (wlen <= 0) { if (verbose) { fprintf(stderr, "stdout closed...\n"); } retcode = -2; goto engine_exit; } br_ssl_engine_recvapp_ack(cc, wlen); continue; } } if (sendrec) { if (pfd[k_fd].revents & POLLOUT) { unsigned char *buf; size_t len; ssize_t wlen; buf = br_ssl_engine_sendrec_buf(cc, &len); wlen = write(fd, buf, len); if (wlen <= 0) { if (verbose) { fprintf(stderr, "socket closed...\n"); } retcode = -1; goto engine_exit; } if (trace) { dump_blob("Outgoing bytes", buf, wlen); } br_ssl_engine_sendrec_ack(cc, wlen); continue; } } if (recvrec) { if (pfd[k_fd].revents & POLLIN) { unsigned char *buf; size_t len; ssize_t rlen; buf = br_ssl_engine_recvrec_buf(cc, &len); rlen = read(fd, buf, len); if (rlen <= 0) { if (verbose) { fprintf(stderr, "socket closed...\n"); } retcode = -1; goto engine_exit; } if (trace) { dump_blob("Incoming bytes", buf, rlen); } br_ssl_engine_recvrec_ack(cc, rlen); continue; } } if (sendapp) { if (pfd[k_in].revents & POLLIN) { unsigned char *buf; size_t len; ssize_t rlen; buf = br_ssl_engine_sendapp_buf(cc, &len); rlen = read(0, buf, len); if (rlen <= 0) { if (verbose) { fprintf(stderr, "stdin closed...\n"); } br_ssl_engine_close(cc); } else if (!run_command(cc, buf, rlen)) { br_ssl_engine_sendapp_ack(cc, rlen); } br_ssl_engine_flush(cc, 0); continue; } } /* We should never reach that point. */ fprintf(stderr, "ERROR: poll() misbehaves\n"); retcode = -2; goto engine_exit; } /* * Release allocated structures. */ engine_exit: return retcode; }
23.079903
73
0.60449
3e75f4b02132cdd255f641cbbe1dc73e1bd21bf4
253
c
C
4_Filas/16/quantidadeDeImpares.c
Ellian-aragao/IFB-EDA
82d28cf3afe59d3595a2741d84e296755600c93a
[ "Unlicense" ]
null
null
null
4_Filas/16/quantidadeDeImpares.c
Ellian-aragao/IFB-EDA
82d28cf3afe59d3595a2741d84e296755600c93a
[ "Unlicense" ]
null
null
null
4_Filas/16/quantidadeDeImpares.c
Ellian-aragao/IFB-EDA
82d28cf3afe59d3595a2741d84e296755600c93a
[ "Unlicense" ]
null
null
null
#include "quantidadeDeImpares.h" u_long quantidadeDeImpares(Queue *queue) { Queue *q = copyQueue(queue); u_long mod = 0; while (getTamQueue(q)) { mod += *(int*)getItemQueue(q) % 2; removeQueue(q); } destroyQueue(q); return mod; }
16.866667
40
0.644269
3faf359d85371d6670c0b960c57694cede457bef
1,175
c
C
MCU/Fpga_wifi_link/application/src/timer_app.c
pseudoincorrect/FPGA_MCU_wifi
1e1fa36e547dfdfbfcb4cdf4a8c0300543d7cdc4
[ "MIT" ]
1
2021-04-13T08:33:44.000Z
2021-04-13T08:33:44.000Z
MCU/Fpga_wifi_link/application/src/timer_app.c
pseudoincorrect/FPGA_MCU_wifi
1e1fa36e547dfdfbfcb4cdf4a8c0300543d7cdc4
[ "MIT" ]
null
null
null
MCU/Fpga_wifi_link/application/src/timer_app.c
pseudoincorrect/FPGA_MCU_wifi
1e1fa36e547dfdfbfcb4cdf4a8c0300543d7cdc4
[ "MIT" ]
1
2020-10-12T07:08:40.000Z
2020-10-12T07:08:40.000Z
#include "timer_app.h" #if (WITHOUT_FPGA) /*88888 888b 888 8888888 88888888888 888 8888b 888 888 888 888 88888b 888 888 888 888 888Y88b 888 888 888 888 888 Y88b888 888 888 888 888 Y88888 888 888 888 888 Y8888 888 888 8888888 888 Y888 8888888 8*/ //**************************************************************************** // //! \brief This function Initialize the timer that will produce a //! periodic interrupt used to create fake data for testing purposes //! //! \param[in] No lne //! //! \return None // //**************************************************************************** void Timer_init(void TimerBaseIntHandler (void)) { unsigned long BaseTimer; // Base address for first timer BaseTimer = TIMERA0_BASE; // Configuring the timers Timer_IF_Init(PRCM_TIMERA0, BaseTimer, TIMER_CFG_PERIODIC, TIMER_A, 0); // Setup the interrupts for the timer timeouts. Timer_IF_IntSetup(BaseTimer, TIMER_A, TimerBaseIntHandler); // Turn on the timers feeding values in mSec Timer_IF_Start(BaseTimer, TIMER_A, 2); } #endif
27.97619
78
0.565957
421277f593fb2a60770efbafb85257919f7c7966
4,431
c
C
Serial_Interface.X/mcc_generated_files/pin_manager.c
olivierjan/6502
5abb41636fbf404a0af629f90e1a9308f8a603a1
[ "MIT" ]
2
2019-10-18T23:29:11.000Z
2021-05-24T05:48:30.000Z
Serial_Interface.X/mcc_generated_files/pin_manager.c
olivierjan/6502
5abb41636fbf404a0af629f90e1a9308f8a603a1
[ "MIT" ]
null
null
null
Serial_Interface.X/mcc_generated_files/pin_manager.c
olivierjan/6502
5abb41636fbf404a0af629f90e1a9308f8a603a1
[ "MIT" ]
1
2021-09-02T15:33:34.000Z
2021-09-02T15:33:34.000Z
/** Generated Pin Manager File Company: Microchip Technology Inc. File Name: pin_manager.c Summary: This is the Pin Manager file generated using PIC10 / PIC12 / PIC16 / PIC18 MCUs Description: This header file provides implementations for pin APIs for all pins selected in the GUI. Generation Information : Product Revision : PIC10 / PIC12 / PIC16 / PIC18 MCUs - 1.65.2 Device : PIC18F46K42 Driver Version : 2.11 The generated drivers are tested against the following: Compiler : XC8 1.45 MPLAB : MPLAB X 4.15 Copyright (c) 2013 - 2015 released Microchip Technology Inc. All rights reserved. */ /* (c) 2018 Microchip Technology Inc. and its subsidiaries. Subject to your compliance with these terms, you may use Microchip software and any derivatives exclusively with Microchip products. It is your responsibility to comply with third party license terms applicable to your use of third party software (including open source software) that may accompany Microchip software. THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY, THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE. */ #include <xc.h> #include "pin_manager.h" #include "stdbool.h" void (*IOCBF1_InterruptHandler)(void); void PIN_MANAGER_Initialize(void) { /** LATx registers */ LATE = 0x00; LATD = 0x02; LATA = 0x00; LATB = 0x00; LATC = 0x00; /** TRISx registers */ TRISE = 0x07; TRISA = 0xFF; TRISB = 0xFA; TRISC = 0xFF; TRISD = 0xFF; /** ANSELx registers */ ANSELD = 0xFE; ANSELC = 0x81; ANSELB = 0xF0; ANSELE = 0x07; ANSELA = 0x00; /** WPUx registers */ WPUD = 0x00; WPUE = 0x00; WPUB = 0x01; WPUA = 0x00; WPUC = 0x00; /** ODx registers */ ODCONE = 0x00; ODCONA = 0x00; ODCONB = 0x00; ODCONC = 0x00; ODCOND = 0x00; /** SLRCONx registers */ SLRCONA = 0xFF; SLRCONB = 0xFF; SLRCONC = 0xFF; SLRCOND = 0xFF; SLRCONE = 0x07; /** IOCx registers */ //interrupt on change for group IOCBF - flag IOCBFbits.IOCBF1 = 0; //interrupt on change for group IOCBN - negative IOCBNbits.IOCBN1 = 1; //interrupt on change for group IOCBP - positive IOCBPbits.IOCBP1 = 0; // register default IOC callback functions at runtime; use these methods to register a custom function IOCBF1_SetInterruptHandler(IOCBF1_DefaultInterruptHandler); // Enable IOCI interrupt PIE0bits.IOCIE = 1; CLCIN0PPS = 0x12; //RC2->CLC1:CLCIN0; RB2PPS = 0x13; //RB2->UART1:TX1; CLCIN2PPS = 0x18; //RD0->CLC1:CLCIN2; CLCIN1PPS = 0x13; //RC3->CLC1:CLCIN1; U1RXPPS = 0x0B; //RB3->UART1:RX1; } void PIN_MANAGER_IOC(void) { // interrupt on change for pin IOCBF1 if(IOCBFbits.IOCBF1 == 1) { IOCBF1_ISR(); } } /** IOCBF1 Interrupt Service Routine */ void IOCBF1_ISR(void) { // Add custom IOCBF1 code // Call the interrupt handler for the callback registered at runtime if(IOCBF1_InterruptHandler) { IOCBF1_InterruptHandler(); } IOCBFbits.IOCBF1 = 0; } /** Allows selecting an interrupt handler for IOCBF1 at application runtime */ void IOCBF1_SetInterruptHandler(void (* InterruptHandler)(void)){ IOCBF1_InterruptHandler = InterruptHandler; } /** Default interrupt handler for IOCBF1 */ void IOCBF1_DefaultInterruptHandler(void){ // add your IOCBF1 interrupt custom code // or set custom function using IOCBF1_SetInterruptHandler() } /** End of File */
24.213115
106
0.65132
e91215972962237c006d13726c87b9fd3b0744a1
3,683
c
C
CassettePlus/scripts/4_World/RPL_WalkieTalkie.c
benedikz/RevivalPlus
b51d90ede21f457d78aba8e175e7c9463678cac1
[ "MIT" ]
null
null
null
CassettePlus/scripts/4_World/RPL_WalkieTalkie.c
benedikz/RevivalPlus
b51d90ede21f457d78aba8e175e7c9463678cac1
[ "MIT" ]
null
null
null
CassettePlus/scripts/4_World/RPL_WalkieTalkie.c
benedikz/RevivalPlus
b51d90ede21f457d78aba8e175e7c9463678cac1
[ "MIT" ]
null
null
null
/* * Addon: RevivalPlus * Script: RPL_Radio.c * Author: Tomáš "benedi.kz" Benedikt * * © 2020 Tomáš "benedi.kz" Benedikt * * This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License. * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/. * * <summary>Adds RPL_Radio item functionality into the game</summary> * */ modded class PlayerBase { override void Init() { if ( !GetGame().IsServer() || !GetGame().IsMultiplayer() ) { DayzPlayerItemBehaviorCfg toolsOneHanded = new DayzPlayerItemBehaviorCfg; toolsOneHanded.SetToolsOneHanded(); GetDayZPlayerType().AddItemInHandsProfileIK("RPL_PersonalRadio", "dz/anims/workspaces/player/player_main/player_main_1h.asi", toolsOneHanded, "dz/anims/anm/player/ik/gear/walkie_talkie.anm"); } super.Init(); } } class RPL_PersonalRadio extends ItemBase { // Sound Effects const string SOUND_TURN_ON = "RPL_SoundSet_WalkieTalkieOn"; const string SOUND_TURN_OFF = "RPL_SoundSet_WalkieTalkieOff"; // Musical Tracks (Fair Use) const string CHATTER_RU = "RPL_SoundSet_RussianChatter"; ref protected EffectSound RPLA_Track; ref protected EffectSound RPLA_TrackLoop; protected EffectSound RPLA_SoundTurnOn; protected EffectSound RPLA_SoundTurnOff; override void SetActions() { super.SetActions(); AddAction(ActionTurnOnWhileInHands); AddAction(ActionTurnOffWhileInHands); } void OnSwitchOn() { super.OnSwitchOn(); TurnOn_Sound(); Play_Cassette(); } override void OnSwitchOff() { super.OnSwitchOff(); Stop_Cassette(); TurnOff_Sound(); } // Restricts attaching attachments if ruined. override bool CanReceiveAttachment(EntityAI attachment, int slotId) { ItemBase item = ItemBase.Cast(attachment); if (!item.IsRuined() && !this.GetCompEM().IsWorking()) { return true; } return false; } // Locks the Attachment inside, when running. override bool CanReleaseAttachment(EntityAI attachment) { if (this.GetCompEM().IsWorking()) { return false; } return true; } void Play_Cassette() { Entity Attached_Cassette = EntityAI.Cast(this.FindAttachmentBySlotName("Cassette")); if (Attached_Cassette == NULL) { Print("[DEBUG] ::: No Cassettes Attached (0)"); } else { string CassetteType = Attached_Cassette.GetType(); switch (CassetteType) { case "RPL_Cassette_RussianChatter": { Print("[DEBUG] ::: Playing 'CHATTER_RU' (1)"); PlaySoundSet(RPLA_Track, CHATTER_RU, 0.5, 0.6); } break; default: { Print("[DEBUG] ::: Unknown Error whilst playing Cassette (-1)"); } break; } } } void Stop_Cassette() { if (GetGame().IsMultiplayer() && GetGame().IsServer()) { Print("[DEBUG] ::: Transmission Device Turned Off (0)"); StopSoundSet(RPLA_Track); } else if (GetGame().IsMultiplayer() && GetGame().IsClient()) { Print("[DEBUG] ::: Transmission Device Turned Off (0)"); StopSoundSet(RPLA_Track); } } protected void TurnOn_Sound() { PlaySoundSet(RPLA_SoundTurnOn, SOUND_TURN_ON, 0.0, 0.0); } protected void TurnOff_Sound() { PlaySoundSet(RPLA_SoundTurnOff, SOUND_TURN_OFF, 0.0, 0.0); } }
25.576389
203
0.616345
8f332beb5e0372703b4025a5dcfa03903082c419
1,024
c
C
src/input.c
danilo94/Sega-Genesis-CHIP-8
f087142af406a38b3f52ea1fbe7feb01838e46bd
[ "MIT" ]
9
2021-12-03T10:18:29.000Z
2022-03-23T10:37:28.000Z
src/input.c
danilo94/Sega-Genesis-CHIP-8
f087142af406a38b3f52ea1fbe7feb01838e46bd
[ "MIT" ]
null
null
null
src/input.c
danilo94/Sega-Genesis-CHIP-8
f087142af406a38b3f52ea1fbe7feb01838e46bd
[ "MIT" ]
null
null
null
#include "input.h" void initJoyHandler(){ JOY_init(); JOY_setEventHandler( &joyHandler ); } void joyHandler( u16 joy, u16 changed, u16 state){ u16 key =0x0; if (joy == JOY_1) { clearkeys(); if (state & BUTTON_UP) { key = UP; } else if (state & BUTTON_DOWN) { key = DOWN; } else if (state & BUTTON_LEFT){ key = LEFT; } else if (state & BUTTON_RIGHT){ key = RIGHT; } else if (state & BUTTON_A){ key = A; } else if (state & BUTTON_B){ key = B; } else if (state & BUTTON_C){ key =C; } else if (state & BUTTON_START){ key = RESET; } if (myGameController.gameInProgress){ if (key != RESET){ myChip8.key[key]=1; } else{ moveMenuCursor(key); } } else{ moveMenuCursor(key); } } }
20.48
50
0.431641
754bd3e960dab527f0e1a55d01fdf2c4a1de10b3
88
h
C
sys/arch/macppc/include/kbio.h
ArrogantWombatics/openbsd-src
75721e1d44322953075b7c4b89337b163a395291
[ "BSD-3-Clause" ]
91
2015-01-05T15:18:31.000Z
2022-03-11T16:43:28.000Z
sys/arch/macppc/include/kbio.h
ArrogantWombatics/openbsd-src
75721e1d44322953075b7c4b89337b163a395291
[ "BSD-3-Clause" ]
1
2016-02-25T15:57:55.000Z
2016-02-25T16:01:02.000Z
sys/arch/macppc/include/kbio.h
ArrogantWombatics/openbsd-src
75721e1d44322953075b7c4b89337b163a395291
[ "BSD-3-Clause" ]
21
2015-02-07T08:23:07.000Z
2021-12-14T06:01:49.000Z
/* $OpenBSD: kbio.h,v 1.1 2001/09/01 15:49:06 drahn Exp $ */ #include <powerpc/kbio.h>
22
60
0.636364
e08b230f5bd35c41068e98c1f9d80c255a07598d
1,564
c
C
c/scons/money-check/src/check_money.c
dkandalov/katas
1c040f5cbc5fb10c11df3f2738814701f7b777b8
[ "Unlicense" ]
7
2015-05-03T16:57:24.000Z
2020-07-02T19:35:14.000Z
c/scons/money-check/src/check_money.c
dkandalov/katas
1c040f5cbc5fb10c11df3f2738814701f7b777b8
[ "Unlicense" ]
15
2015-10-18T09:09:43.000Z
2022-02-01T00:57:47.000Z
c/scons/money-check/src/check_money.c
dkandalov/katas
1c040f5cbc5fb10c11df3f2738814701f7b777b8
[ "Unlicense" ]
3
2017-08-17T18:25:46.000Z
2021-02-07T10:59:40.000Z
#include <stdlib.h> #include <check.h> #include "money.h" Money *five_dollars; void setup(void) { five_dollars = money_create(5, "USD"); } void teardown(void) { money_free(five_dollars); } START_TEST (test_money_create) { fail_unless (money_amount(five_dollars) == 5, "Amount not set correctly on creation"); fail_unless (strcmp (money_currency(five_dollars), "USD") == 0, "Currency not set correctly on creation"); } END_TEST START_TEST (test_money_create_neg) { Money *m = money_create (-1, "USD"); fail_unless (m == NULL, "NULL should be returned on attempt to create with " "a negative amount"); } END_TEST START_TEST (test_money_create_zero) { Money *m = money_create(0, "USD"); fail_unless (money_amount(m) == 0, "Zero is a valid amount of money"); } END_TEST Suite *money_suite (void) { Suite *s = suite_create ("Money"); /* Core test case */ TCase *tc_core = tcase_create ("Core"); tcase_add_checked_fixture (tc_core, setup, teardown); tcase_add_test (tc_core, test_money_create); suite_add_tcase (s, tc_core); /* Limits test case */ TCase *tc_limits = tcase_create ("Limits"); tcase_add_test (tc_limits, test_money_create_neg); tcase_add_test (tc_limits, test_money_create_zero); suite_add_tcase (s, tc_limits); return s; } int main (void) { int number_failed; Suite *s = money_suite(); SRunner *sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); number_failed = srunner_ntests_failed(sr); srunner_free(sr); return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE; }
26.508475
108
0.707801
724f42a1f5ee64e9b3a9faf4b999f7c1b3c60930
545
h
C
src/DataVisualizerGraphAxisCursor.h
LaCocoRoco/DataVisualizer
0eb201696c1a08ff48e82507c2deadf0a24cf6b9
[ "MIT" ]
4
2019-08-08T22:11:37.000Z
2022-02-25T09:12:29.000Z
src/DataVisualizerGraphAxisCursor.h
LaCocoRoco/arduino-data-visualizer
0eb201696c1a08ff48e82507c2deadf0a24cf6b9
[ "MIT" ]
1
2019-11-22T23:05:38.000Z
2020-02-03T18:26:09.000Z
src/DataVisualizerGraphAxisCursor.h
LaCocoRoco/arduino-data-visualizer
0eb201696c1a08ff48e82507c2deadf0a24cf6b9
[ "MIT" ]
1
2019-05-30T03:26:58.000Z
2019-05-30T03:26:58.000Z
#ifndef DATA_VISUALIZER_GRAPH_AXIS_CURSOR_H #define DATA_VISUALIZER_GRAPH_AXIS_CURSOR_H #include "DataVisualizer.h" struct DataPacket; class DataVisualizer; class DataVisualizerGraphAxisCursor { friend class DataVisualizer; friend class DataVisualizerGraphAxis; private: uint16_t id; DataPacket* packet; DataVisualizer* visualizer; public: DataVisualizerGraphAxisCursor(void); bool feed(void); int32_t read(void); }; typedef DataVisualizerGraphAxisCursor GraphAxisCursor; #endif /* DATA_VISUALIZER_GRAPH_AXIS_CURSOR_H */
20.961538
54
0.818349
edb28ca22de6d720c56682ae68d42944d49def7a
11,616
c
C
src/doRender.c
Atrej3000/Ucode_Endgame
c6e5149ce508de6e31e260b30428e0e815754bd9
[ "MIT" ]
null
null
null
src/doRender.c
Atrej3000/Ucode_Endgame
c6e5149ce508de6e31e260b30428e0e815754bd9
[ "MIT" ]
null
null
null
src/doRender.c
Atrej3000/Ucode_Endgame
c6e5149ce508de6e31e260b30428e0e815754bd9
[ "MIT" ]
null
null
null
#include "header.h" void doRender(SDL_Renderer *renderer, GameState *game) { if (game->statusState == STATUS_STATE_GAME) { /* SDL_Rect srcRectBack = {2 * game->CurrentSpriteBack, 0, WIDTH, HEIGHT}; SDL_Rect backRect = {0, 0, WIDTH, HEIGHT}; SDL_RenderCopyEx(renderer, game->sheetTextureBack, &srcRectBack, &backRect, 0, NULL, SDL_FLIP_NONE); */ //Andrew back SDL_Rect backRect = {0, 0, 1280, 720}; SDL_RenderCopy(renderer, game->sheetTextureBack, NULL, &backRect); SDL_Rect backSunRect = {0, 0, 1280, 720}; SDL_RenderCopy(renderer, game->sheetTextureSun, NULL, &backSunRect); //Clouds SDL_Rect cloudPos1 = {game->cloud1.x, game->cloud1.y, 312, 104}; //78x26 SDL_RenderCopy(renderer, game->cloud1.sheetTextureCloud1, NULL, &cloudPos1); SDL_Rect cloudPos2 = {game->cloud2.x, game->cloud2.y, 416, 88}; //104x22 SDL_RenderCopy(renderer, game->cloud2.sheetTextureCloud2, NULL, &cloudPos2); SDL_Rect cloudPos3 = {game->cloud3.x, game->cloud3.y, 280, 56}; //70x14 SDL_RenderCopy(renderer, game->cloud3.sheetTextureCloud3, NULL, &cloudPos3); SDL_Rect cloudPos4 = {game->cloud4.x, game->cloud4.y, 292, 64}; //68x16 SDL_RenderCopy(renderer, game->cloud4.sheetTextureCloud4, NULL, &cloudPos4); SDL_Rect cloudPos5 = {game->cloud5.x, game->cloud5.y, 216, 48}; //54x12 SDL_RenderCopy(renderer, game->cloud5.sheetTextureCloud5, NULL, &cloudPos5); SDL_Rect cloudPos6 = {game->cloud6.x, game->cloud6.y, 162, 32}; //38x8 SDL_RenderCopy(renderer, game->cloud6.sheetTextureCloud6, NULL, &cloudPos6); SDL_Rect cloudPos7 = {game->cloud7.x, game->cloud7.y, 264, 32}; //66x8 SDL_RenderCopy(renderer, game->cloud7.sheetTextureCloud7, NULL, &cloudPos7); SDL_Rect cloudPos8 = {game->cloud8.x, game->cloud8.y, 352, 40}; //88x10 SDL_RenderCopy(renderer, game->cloud8.sheetTextureCloud8, NULL, &cloudPos8); //Buildings SDL_Rect backRectfront = {0, 0, 1280, 720}; SDL_RenderCopy(renderer, game->sheetTextureBack2, NULL, &backRectfront); //Train SDL_Rect trainPos = {game->train.x, game->train.y, 480, 16}; SDL_RenderCopy(renderer, game->train.textureTrain, NULL, &trainPos); // //Set the drawing color to blue // SDL_SetRenderDrawColor(renderer, 128, 128, 255, 255); // //Clear the screen (to blue) // SDL_RenderClear(renderer); // //Set drawing color to white // SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); for (int i = 0; i < 24; i++) { SDL_Rect ledgeRect = {game->ledges[i].x, game->ledges[i].y, game->ledges[i].w, game->ledges[i].h}; SDL_RenderCopy(renderer, game->brick, NULL, &ledgeRect); } for (int i = 24; i < 40; i++) { SDL_Rect ledgeRect = {game->ledges[i].x, game->ledges[i].y, game->ledges[i].w, game->ledges[i].h}; SDL_RenderCopy(renderer, game->brick_block, NULL, &ledgeRect); } for (int i = 40; i < 100; i++) { SDL_Rect ledgeRect = {game->ledges[i].x, game->ledges[i].y, game->ledges[i].w, game->ledges[i].h}; SDL_RenderCopy(renderer, game->copper_block, NULL, &ledgeRect); } //SMART ENEMY RUN for (int i = 0; i < NUM_SMART_ENEMIES; i++) if (game->smartEnemies[i].visible) { SDL_Rect srcRect = {88 * game->enemy.currentSpriteRun2, 0, 44, 26}; SDL_Rect rect = {game->smartEnemies[i].x, game->smartEnemies[i].y, 85, 50}; SDL_RenderCopyEx(renderer, game->enemy.sheetTextureRun2, &srcRect, &rect, 0, NULL, SDL_FLIP_HORIZONTAL); } //ENEMY RUN for (int i = 0; i < NUM_ENEMIES; i++) if (game->enemyValues[i].visible) { SDL_Rect srcRect = {64 * game->enemy.currentSpriteRun, 0, 32, 32}; SDL_Rect rect = {game->enemyValues[i].x, game->enemyValues[i].y, 55, 55}; SDL_RenderCopyEx(renderer, game->enemy.sheetTextureRun, &srcRect, &rect, 0, NULL, SDL_FLIP_HORIZONTAL); } // BOSS RENDER ____________________________ for (int j = 0; j < 2; j++) { if (game->boss[j].visible) { SDL_Rect srcRect = {88 * game->CurrentSheetBoss, 0, 44, 30}; SDL_Rect rect = {game->boss[j].x, game->boss[j].y, 81, 55}; SDL_RenderCopyEx(renderer, game->bossTexture, &srcRect, &rect, 0, NULL, SDL_FLIP_HORIZONTAL); } } // BUllets for (int i = 0; i < MAX_BULLETS; i++) if (game->bullets[i] && game->bullets[i]->unvisible == 0) { SDL_Rect srcRect = {32 * game->CurrentSheetBullet, 0, 32, 32}; SDL_Rect rect = {game->bullets[i]->x, game->bullets[i]->y, 32, 32}; SDL_RenderCopyEx(renderer, game->bulletTexture, &srcRect, &rect, 0, NULL, (game->man.facingLeft == 1)); } if (game->multiPlayer) { for (int i = 0; i < MAX_BULLETS; i++) { if (game->secondBullets[i] && game->secondBullets[i]->unvisible == 0) { SDL_Rect srcRect = {32 * game->CurrentSheetBullet2, 0, 32, 32}; SDL_Rect rect = {game->secondBullets[i]->x, game->secondBullets[i]->y, 32, 32}; SDL_RenderCopyEx(renderer, game->secondBulletTexture, &srcRect, &rect, 0, NULL, (game->secondPlayer.facingLeft == 1)); } } } //HERO RUN if (game->man.visible0 && game->man.onLedge) { SDL_Rect srcRect = {64 * game->man.currentSpriteRun, 0, 32, 32}; SDL_Rect rect = {game->man.x, game->man.y, 55, 55}; SDL_RenderCopyEx(renderer, game->man.sheetTextureRun, &srcRect, &rect, 0, NULL, (game->man.facingLeft == 1)); } //HERO JUMP if (game->man.visible0 && !game->man.onLedge) { SDL_Rect srcRect = {64 * game->man.currentSpriteJump, 0, 32, 32}; SDL_Rect rect = {game->man.x, game->man.y, 55, 55}; SDL_RenderCopyEx(renderer, game->man.sheetTextureJump, &srcRect, &rect, 0, NULL, (game->man.facingLeft == 1)); } //SECOND HERO RUN if (game->multiPlayer) { if (game->man.visible0 && game->secondPlayer.onLedge) { SDL_Rect srcRect2 = {64 * game->secondPlayer.currentSpriteRun2, 0, 32, 32}; SDL_Rect rect2 = {game->secondPlayer.x, game->secondPlayer.y, 55, 55}; SDL_RenderCopyEx(renderer, game->secondPlayer.sheetTextureRun2, &srcRect2, &rect2, 0, NULL, (game->secondPlayer.facingLeft == 1)); } } //SECOND HERO JUMP if (game->multiPlayer) { if (game->man.visible0 && !game->secondPlayer.onLedge) { SDL_Rect srcRect2 = {64 * game->secondPlayer.currentSpriteJump2, 0, 32, 32}; SDL_Rect rect2 = {game->secondPlayer.x, game->secondPlayer.y, 55, 55}; SDL_RenderCopyEx(renderer, game->secondPlayer.sheetTextureJump2, &srcRect2, &rect2, 0, NULL, (game->secondPlayer.facingLeft == 1)); } } // if (game->man.visible0 && game->man.onLedge && game->man.attack) // { // SDL_Rect srcRect = {128 * game->man.currentSpriteAttack1, 0, 128, 32}; // SDL_Rect rect = {game->man.x, game->man.y, 225, 55}; // SDL_RenderCopyEx(renderer, game->man.sheetTextureAttack1, &srcRect, &rect, 0, NULL, (game->man.facingLeft == 1)); // } if (game->man.isDead) { SDL_Rect rect = {game->man.x, game->man.y - 10, 38, 83}; SDL_RenderCopyEx(renderer, game->death, NULL, &rect, 0, NULL, (game->time % 20 < 10)); } } //draw the trap image // for (int i = 0; i < 100; i++) // { // SDL_Rect starRect = {game->stars[i].x, game->stars[i].y, 56, 56}; // SDL_RenderCopy(renderer, game->star, NULL, &starRect); // } if (game->statusState == STATUS_STATE_LIVES) { draw_status_lives(game); } //show us our Lives in game init_status_lives(game); draw_status_lives2(game); //score of kills init_status_kills(game); draw_status_kills(game); //We are done drawing, "present" or show to the screen what wer've drawn SDL_RenderPresent(renderer); } void doRender2(SDL_Renderer *renderer, GameState *game) { if (game->statusState == STATUS_STATE_GAME) { SDL_Rect fon = {0, 0, 1280, 720}; SDL_RenderCopy(renderer, game->fon, NULL, &fon); /* //Set the drawing color to blue SDL_SetRenderDrawColor(renderer, 128, 128, 255, 255); //Clear the screen (to blue) SDL_RenderClear(renderer); //Set drawing color to white SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255); */ if (game->multiPlayer) { SDL_Rect scdPlr = {game->scrollX + game->secondPlayer.x, game->secondPlayer.y, 54, 54}; SDL_RenderCopyEx(renderer, game->secondPlayerFrames[game->secondPlayer.animFrameSecond], NULL, &scdPlr, 0, NULL, (game->secondPlayer.facingLeft == 1)); // SDL_Rect rect = {game->scrollX + game->man.x, game->man.y, 54, 54}; // SDL_RenderCopyEx(renderer, game->manFrames[game->man.animFrame], NULL, &rect, 0, NULL, (game->man.facingLeft == 1)); // if (game->man.isDead) // { // SDL_Rect rect = {game->scrollX + game->man.x, game->man.y - 10, 38, 83}; // SDL_RenderCopyEx(renderer, game->death, NULL, &rect, 0, NULL, (game->time % 20 < 10)); // //_______________________________________________________________________death from stars // game->gameLives--; // game->man.isDead = 0; // game->man.y = 0; // } } for (int i = 0; i < 100; i++) { SDL_Rect ledgeRect = {game->scrollX + game->ledges[i].x, game->ledges[i].y, game->ledges[i].w, game->ledges[i].h}; SDL_RenderCopy(renderer, game->brick, NULL, &ledgeRect); } //HERO ANIMATION SDL_Rect rect = {game->scrollX + game->man.x, game->man.y, 54, 54}; SDL_RenderCopyEx(renderer, game->manFrames[game->man.animFrame], NULL, &rect, 0, NULL, (game->man.facingLeft == 1)); if (game->man.isDead) { SDL_Rect rect = {game->scrollX + game->man.x, game->man.y - 10, 38, 83}; SDL_RenderCopyEx(renderer, game->death, NULL, &rect, 0, NULL, (game->time % 20 < 10)); //_______________________________________________________________________death from stars game->gameLives--; game->man.isDead = 0; game->man.y = 0; } } //draw the trap image for (int i = 0; i < 100; i++) { SDL_Rect starRect = {game->scrollX + game->stars[i].x, game->stars[i].y, 56, 56}; SDL_RenderCopy(renderer, game->star, NULL, &starRect); } if (game->statusState == STATUS_STATE_LIVES) { draw_status_lives(game); } //lifes init_status_lives(game); draw_status_lives2(game); //score of kills init_status_x(game); draw_status_x(game); //We are done drawing, "present" or show to the screen what wer've drawn SDL_RenderPresent(renderer); // system("leaks -q endgame"); }
41.191489
159
0.575069
8ec4973e90d1af70508c44bcb620a2dd425af07e
457
h
C
usr/libexec/coreidvd/OZRXp7MLSzffIeLD.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
usr/libexec/coreidvd/OZRXp7MLSzffIeLD.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
usr/libexec/coreidvd/OZRXp7MLSzffIeLD.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 Steve Nygard. // #import <objc/NSObject.h> @interface OZRXp7MLSzffIeLD : NSObject { } - (void)t5yVezCKaX2Zrwrw:(id)arg1 uXxcS3vcKdsH38zZ:(CDUnknownBlockType)arg2; // IMP=0x000000010017b12c - (void)MypqGKKWznx4xnYa:(id)arg1 ygOPXTiKN0J02x0j:(CDUnknownBlockType)arg2; // IMP=0x000000010017ab0c @end
25.388889
120
0.746171
f102b9360b1e9febdb3ced6a7ce7de687d1c866c
547
h
C
include/labeling_sauf_4c_tree.inc.h
attltb/YACCLAB
54daa48bc44331897051b392f30cab760573e913
[ "BSD-3-Clause" ]
147
2016-05-29T22:10:43.000Z
2022-03-28T15:39:06.000Z
include/labeling_sauf_4c_tree.inc.h
attltb/YACCLAB
54daa48bc44331897051b392f30cab760573e913
[ "BSD-3-Clause" ]
13
2016-11-25T15:27:55.000Z
2021-12-22T09:41:21.000Z
include/labeling_sauf_4c_tree.inc.h
attltb/YACCLAB
54daa48bc44331897051b392f30cab760573e913
[ "BSD-3-Clause" ]
38
2016-04-13T07:42:31.000Z
2022-03-31T07:48:27.000Z
// Copyright (c) 2020, the YACCLAB contributors, as // shown by the AUTHORS file. All rights reserved. // // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. if (CONDITION_X) { if (CONDITION_Q) { if (CONDITION_S) { // x <- q + s ACTION_5 }else{ // x <- q ACTION_3 } } else { // q = 0 if (CONDITION_S) { // x <- s ACTION_4 } else{ // new label ACTION_2 } } } else { // Nothing to do, x is a background pixel ACTION_1 }
17.09375
53
0.563071
61f650b809a43494776ad95ecbd4af2f594c70a8
3,488
c
C
main.c
pmkenned/tetris
f7ccaa689a58ba5b83dc74c2a93afff48d437e74
[ "MIT" ]
null
null
null
main.c
pmkenned/tetris
f7ccaa689a58ba5b83dc74c2a93afff48d437e74
[ "MIT" ]
null
null
null
main.c
pmkenned/tetris
f7ccaa689a58ba5b83dc74c2a93afff48d437e74
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <time.h> #if OSX # include <SDL2/SDL.h> #else # include <SDL.h> #endif #include "main.h" #include "tetris.h" #define UNUSED(expr) do { (void)(expr); } while (0) enum { DEFAULT_SCREEN_WIDTH = 640, DEFAULT_SCREEN_HEIGHT = 480, }; static SDL_Window * win; static SDL_Renderer * ren; int done = 0; int win_w = 0; int win_h = 0; int sq = 0; int use_seed = 1; int seed = 0; static void set_w_h() { SDL_DisplayMode mode; if (SDL_GetWindowDisplayMode(win, &mode)) { fprintf(stderr, "SDL_GetWindowDisplayMode(): %s\n", SDL_GetError()); SDL_Quit(); exit(EXIT_FAILURE); } win_w = mode.w; win_h = mode.h; sq = win_h / 22; } void toggle_fullscreen() { SDL_SetWindowFullscreen(win, SDL_GetWindowFlags(win)^SDL_WINDOW_FULLSCREEN_DESKTOP); set_w_h(); } void init_program() { if (SDL_Init(SDL_INIT_VIDEO) != 0) { fprintf(stderr, "SDL_Init(): %s\n", SDL_GetError()); exit(EXIT_FAILURE); } uint32_t flags = SDL_WINDOW_FULLSCREEN_DESKTOP; win = SDL_CreateWindow("Tetris", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT, flags); if (win == NULL) { fprintf(stderr, "SDL_CreateWindow(): %s\n", SDL_GetError()); SDL_Quit(); exit(EXIT_FAILURE); } set_w_h(); ren = SDL_CreateRenderer(win, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC); if (ren == NULL) { fprintf(stderr, "SDL_CreateRenderer(): %s\n", SDL_GetError()); SDL_DestroyWindow(win); SDL_Quit(); exit(EXIT_FAILURE); } } struct timespec gettime() { struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) { perror("clock_gettime()"); exit(EXIT_FAILURE); } return ts; } long long int diff_ns(struct timespec end, struct timespec begin) { long long int sec = end.tv_sec - begin.tv_sec; long long int nsec = end.tv_nsec - begin.tv_nsec; return sec*1000000000 + nsec; } void loop() { uint32_t ticks_start, ticks_end; uint32_t frame_num = 0, num_dropped = 0; while (!done) { const uint32_t ms_per_frame = (int) (1000.0/FPS); uint32_t sleep_dur, used_time; int dropped; UNUSED(sleep_dur); ticks_start = SDL_GetTicks(); tetris_handle_inputs(frame_num); tetris_update(frame_num, ms_per_frame); // TODO: calculate accurate dt_ms //struct timespec begin_ts = gettime(); //if (frame_num % (int)(FPS/10.0) == 0) tetris_render(ren); //struct timespec end_ts = gettime(); //long long int dt_ns = diff_ns(end_ts, begin_ts); //printf("dt_ms: %ld\n", (long) (dt_ns/1000000.0)); ticks_end = SDL_GetTicks(); used_time = (ticks_end - ticks_start); dropped = (used_time > ms_per_frame) ? 1 : 0; sleep_dur = dropped ? 0: ms_per_frame - used_time; SDL_Delay(sleep_dur); if (dropped) { num_dropped++; printf("Dropped frames: %u\n", num_dropped); } frame_num++; if (frame_num % FPS == 0) { // } }} int main(int argc, char * argv[]) { UNUSED(argc); UNUSED(argv); init_program(); tetris_init_game(); //tetris_replay_game("inputs.dat"); loop(); SDL_DestroyRenderer(ren); SDL_DestroyWindow(win); SDL_Quit(); return 0; }
21.937107
139
0.614392
52b6bb7cd9e64b19286e6093a1633ea14f31f522
790
h
C
Frameworks/CoreUI.framework/Headers/CUIMutableThemeRendition.h
CarlAmbroselli/barcelona
9bd087575935485a4c26674c2414d7ef20d7e168
[ "Apache-2.0" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
Frameworks/CoreUI.framework/Headers/CUIMutableThemeRendition.h
CarlAmbroselli/barcelona
9bd087575935485a4c26674c2414d7ef20d7e168
[ "Apache-2.0" ]
20
2021-09-03T13:38:34.000Z
2022-03-17T13:24:39.000Z
Frameworks/CoreUI.framework/Headers/CUIMutableThemeRendition.h
CarlAmbroselli/barcelona
9bd087575935485a4c26674c2414d7ef20d7e168
[ "Apache-2.0" ]
2
2022-02-13T08:35:11.000Z
2022-03-17T01:56:47.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import <CoreUI/CUIThemeRendition.h> @class CUIRenditionMetrics, CUIRenditionSliceInformation; __attribute__((visibility("hidden"))) @interface CUIMutableThemeRendition : CUIThemeRendition { struct _renditionkeytoken *_renditionKey; struct CGImage *_image; CUIRenditionSliceInformation *_sliceInformation; CUIRenditionMetrics *_renditionMetrics; } - (id)metrics; - (id)sliceInformation; - (struct CGImage *)unslicedImage; - (const struct _renditionkeytoken *)key; - (void)setName:(id)arg1; - (void)dealloc; - (id)initWithCGImage:(struct CGImage *)arg1 withDescription:(id)arg2 forKey:(const struct _renditionkeytoken *)arg3; @end
26.333333
117
0.750633
da4f6a065317b99a8e85a080a93fd28197df7dcf
1,590
h
C
kernel-hotpatch/kpatch/kmod/patch/kpatch-patch.h
yifengyou/hotpatch
a47e7eec4e5fea108d9a495c5a5095b5e4e2b519
[ "Unlicense" ]
null
null
null
kernel-hotpatch/kpatch/kmod/patch/kpatch-patch.h
yifengyou/hotpatch
a47e7eec4e5fea108d9a495c5a5095b5e4e2b519
[ "Unlicense" ]
null
null
null
kernel-hotpatch/kpatch/kmod/patch/kpatch-patch.h
yifengyou/hotpatch
a47e7eec4e5fea108d9a495c5a5095b5e4e2b519
[ "Unlicense" ]
null
null
null
/* * kpatch-patch.h * * Copyright (C) 2014 Josh Poimboeuf <jpoimboe@redhat.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <https://www.gnu.org/licenses/>. * * Contains the structs used for the patch module special sections */ #ifndef _KPATCH_PATCH_H_ #define _KPATCH_PATCH_H_ struct kpatch_patch_func { unsigned long new_addr; unsigned long new_size; unsigned long old_addr; unsigned long old_size; unsigned long sympos; char *name; char *objname; }; struct kpatch_patch_dynrela { unsigned long dest; unsigned long src; unsigned long type; unsigned long sympos; char *name; char *objname; int external; long addend; }; struct kpatch_pre_patch_callback { int (*callback)(void *obj); char *objname; }; struct kpatch_post_patch_callback { void (*callback)(void *obj); char *objname; }; struct kpatch_pre_unpatch_callback { void (*callback)(void *obj); char *objname; }; struct kpatch_post_unpatch_callback { void (*callback)(void *obj); char *objname; }; #endif /* _KPATCH_PATCH_H_ */
24.84375
72
0.743396
74cca8a52dd129a9e6f34accab97b9390f0da487
129
h
C
tensorflow-yolo-ios/dependencies/google/protobuf/any.h
initialz/tensorflow-yolo-face-ios
ba74cf39168d0128e91318e65a1b88ce4d65a167
[ "MIT" ]
27
2017-06-07T19:07:32.000Z
2020-10-15T10:09:12.000Z
tensorflow-yolo-ios/dependencies/google/protobuf/any.h
initialz/tensorflow-yolo-face-ios
ba74cf39168d0128e91318e65a1b88ce4d65a167
[ "MIT" ]
3
2017-08-25T17:39:46.000Z
2017-11-18T03:40:55.000Z
tensorflow-yolo-ios/dependencies/google/protobuf/any.h
initialz/tensorflow-yolo-face-ios
ba74cf39168d0128e91318e65a1b88ce4d65a167
[ "MIT" ]
10
2017-06-16T18:04:45.000Z
2018-07-05T17:33:01.000Z
version https://git-lfs.github.com/spec/v1 oid sha256:f27ace584fc49d3613ea25c9d470c95bd0ace1b96ad63d16e0de812db92206d6 size 4724
32.25
75
0.883721
1f891b8662b46f9291a042f5f14f5f2be2a1a377
23,207
c
C
trab.c
bibarTheDev/trabalho-mnc
27f8ff68769b7587fe3b1c4a487f1e5314692a7f
[ "MIT" ]
null
null
null
trab.c
bibarTheDev/trabalho-mnc
27f8ff68769b7587fe3b1c4a487f1e5314692a7f
[ "MIT" ]
null
null
null
trab.c
bibarTheDev/trabalho-mnc
27f8ff68769b7587fe3b1c4a487f1e5314692a7f
[ "MIT" ]
null
null
null
/* Felipe Correa RA: Lucca Bibar RA: Lucas Bertoni RA: Victor Bueno RA: */ #include<stdio.h> #include<stdlib.h> #include<math.h> #define MAXSIZE 100 float coeficiente[MAXSIZE][MAXSIZE]; float Dinv[MAXSIZE][MAXSIZE]; float approx[MAXSIZE][1]; float R[MAXSIZE][MAXSIZE]; float matrizRes[MAXSIZE][1]; float b[MAXSIZE][1]; float temp[MAXSIZE][1]; int linha,coluna,size,navigate; // = funcoes de calculo = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = int checarFloatZero(float f) { return (fabs(f) < 0.00001) ? 1 : 0; } void leMatriz(float mat[MAXSIZE][MAXSIZE], int size) { int i, j; for(i = 0; i != size; i++){ for(j = 0; j != size; j++){ scanf("%f", &mat[i][j]); } } } void leVetor(float vet[MAXSIZE], int size) { int i; for(i = 0; i != size; i++){ scanf("%f", &vet[i]); } } void imprimeMatriz(float mat[MAXSIZE][MAXSIZE], int size) { int i, j; for(i = 0; i != size; i++){ printf("["); for(j = 0; j != size; j++){ printf(" %5.2f", mat[i][j]); } printf(" ]\n"); } printf("\n"); } void imprimeVetor(float vet[MAXSIZE], int size) { int i; printf("["); for(i = 0; i != size; i++){ printf(" %5.2f", vet[i]); } printf(" ]\n"); } void imprimeVetorPrecisao(float vet[MAXSIZE], int size) { int i; printf("["); for(i = 0; i != size; i++){ printf(" %5.4f", vet[i]); } printf(" ]\n"); } int checkDiagNaoNula(float mat[MAXSIZE][MAXSIZE], int size) { int i; // itera sobre a matriz for(i = 0; i != size; i++){ if(checarFloatZero(mat[i][i]) == 1){ return 0; } } return 1; } int checarTriangularInferior(float mat[MAXSIZE][MAXSIZE], int size) { int i, j; // itera sobre a matriz for(i = 0; i != size; i++){ for(j = 0; j != size; j++){ // se algum elemento acima da diagonal for diferente de zero, retorna falso if(j > i && checarFloatZero(mat[i][j]) == 0){ return 0; } // se algum elemento da diagoal eh zero else if(j == i && checarFloatZero(mat[i][j]) == 1){ return 0; } } } return 1; } int checarTriangularSuperior(float mat[MAXSIZE][MAXSIZE], int size) { int i, j; // itera sobre a matriz for(i = 0; i != size; i++){ for(j = 0; j != size; j++){ // se algum elemento acima da diagonal for diferente de zero, retorna falso if(j < i && checarFloatZero(mat[i][j]) == 0){ return 0; } // se algum elemento da diagoal eh zero else if(j == i && checarFloatZero(mat[i][j]) == 1){ return 0; } } } return 1; } float determinante(float mat[MAXSIZE][MAXSIZE], int size) { // condicao de saida if(size == 1){ return mat[0][0]; } int i, j, k; float det = 0; float matAux[MAXSIZE][MAXSIZE]; int pulouCol = 0; // calcula o determinante, utlizando a linha 1 pra multiplicar seus elementos por seus cofatores e soma-los for(i = 0; i != size; i++){ pulouCol = 0; //gera matriz auxiliar pra obter o determinante for(j = 0; j != size; j++){ if(i == j){ pulouCol = 1; continue; } for(k = 1; k != size; k++){ matAux[k - 1][j - pulouCol] = mat[k][j]; } } det += mat[0][i] * determinante(matAux, size - 1) * ((1 + (i + 1)) % 2 == 0 ? 1 : -1); } return det; } void triangularInferior(float mat[MAXSIZE][MAXSIZE], int size, float termos[MAXSIZE], float s[MAXSIZE]) { int i, j; for(i = 0; i != size; i++){ s[i] = termos[i]; for(j = 0; j != i; j++){ s[i] -= mat[i][j] * s[j]; } s[i] /= mat[i][i]; } } void triangularSuperior(float mat[MAXSIZE][MAXSIZE], int size, float termos[MAXSIZE], float s[MAXSIZE]) { int i, j; for(i = (size - 1); i != -1; i--){ s[i] = termos[i]; for(j = (size - 1); j != i; j--){ s[i] -= mat[i][j] * s[j]; } s[i] /= mat[i][i]; } } void multiply(float matrizA[][MAXSIZE],float matrizB[][1]){ int ctr,ictr; for(ctr=0;ctr<size;ctr++){ matrizRes[ctr][0]=0; for(navigate=0;navigate<size;navigate++) matrizRes[ctr][0]=matrizRes[ctr][0]+matrizA[ctr][navigate]*matrizB[navigate][0]; } } int checkPositivaDefinida(float mat[MAXSIZE][MAXSIZE], int size) { int c; for(c = 1; c != (size + 1); c++){ if(determinante(mat, c) == 0){ return 0; } } return 1; } void decomporEmLU(float mat[MAXSIZE][MAXSIZE], int size, float l[MAXSIZE][MAXSIZE], float u[MAXSIZE][MAXSIZE]) { int i, j, k; // itera por COLUNAS, nao linhas for(j = 0; j != size; j++){ for(i = 0; i != size; i++){ // acima da diagonal if(i < j){ l[i][j] = 0; // Uij = Aij - SUM(k=1, i-1, Lik * Ukj) u[i][j] = mat[i][j]; for(k = 0; k <= (i - 1); k++){ u[i][j] -= (l[i][k] * u[k][j]); } } // diagonal else if(i == j){ l[i][j] = 1; // Uij = Aij - SUM(k=1, i-1, Lik * Ukj) u[i][j] = mat[i][j]; for(k = 0; k <= (i - 1); k++){ u[i][j] -= (l[i][k] * u[k][j]); } } // abaixo da diagonal else{ u[i][j] = 0; // Lij = (Aij - SUM(k=1, j-1, Lik * Ukj))/ Ujj l[i][j] = mat[i][j]; for(k = 0; k <= (j - 1); k++){ l[i][j] -= (l[i][k] * u[k][j]); } l[i][j] /= u[j][j]; } } } } void decomporEmLUCompacto(float mat[MAXSIZE][MAXSIZE], int size, float lu[MAXSIZE][MAXSIZE]) { int i, j, k; // itera por COLUNAS, nao linhas for(j = 0; j != (size + 1); j++){ for(i = 0; i != size; i++){ // acima da diagonal if(i < j){ // Uij = Aij - SUM(k=1, i-1, Lik * Ukj) lu[i][j] = mat[i][j]; for(k = 0; k <= (i - 1); k++){ lu[i][j] -= (lu[i][k] * lu[k][j]); } } // diagonal else if(i == j){ // Uij = Aij - SUM(k=1, i-1, Lik * Ukj) lu[i][j] = mat[i][j]; for(k = 0; k <= (i - 1); k++){ lu[i][j] -= (lu[i][k] * lu[k][j]); } } // abaixo da diagonal else{ // Lij = (Aij - SUM(k=1, j-1, Lik * Ukj))/ Ujj lu[i][j] = mat[i][j]; for(k = 0; k <= (j - 1); k++){ lu[i][j] -= (lu[i][k] * lu[k][j]); } lu[i][j] /= lu[j][j]; } } } } void decomposicaoLU(float mat[MAXSIZE][MAXSIZE], int size, float termos[MAXSIZE], float s[MAXSIZE]) { float y[MAXSIZE]; float l[MAXSIZE][MAXSIZE], u[MAXSIZE][MAXSIZE]; // define L e U decomporEmLU(mat, size, l, u); // resolve a equacao triangularInferior(l, size, termos, y); triangularSuperior(u, size, y, s); } void decomposicaoGaussCompacto(float mat[MAXSIZE][MAXSIZE], int size, float s[MAXSIZE]) { int i; float y[MAXSIZE]; float lu[MAXSIZE][MAXSIZE]; // define LU decomporEmLUCompacto(mat, size, lu); // extrai a ultima coluna pra nao reescrever uma funcao inteira de triangular superior for(i = 0; i < size; i++){ y[i] = lu[i][size]; } // resolve a equacao triangularSuperior(lu, size, y, s); } int convergenciaCriterioLinhas(float mat[MAXSIZE][MAXSIZE], int size) { int i, j; float lin, beta = -999999999; // max (0 -> size) for (i = 0; i < size; i++){ lin = 0; // sum(j -> size) for (j = 0; j < size; j++){ if(i == j){ continue; } lin += fabs(mat[i][j] / mat[i][i]); } // se estourou 1, retorna falso beta = (beta > lin) ? beta : lin; if(beta >= 1){ return 0; } } return 1; } int convergenciaCriterioSassenfeld(float mat[MAXSIZE][MAXSIZE], int size) { int i, j; float lin, max = -999999999; float beta[MAXSIZE]; // max (0 -> size) for (i = 0; i < size; i++){ lin = 0; // sum(j -> i - 1) for(j = 0; j < i; j++){ lin += fabs(mat[i][j] / mat[i][i]) * beta[j]; } // sum(i + i -> size) for(j = i + 1; j < size; j++){ lin += fabs(mat[i][j] / mat[i][i]); } // se estourou 1, retorna falso if(lin >= 1){ return 0; } beta[i] = lin; } return 1; } void aproximacaoGaussSeidel(float mat[MAXSIZE][MAXSIZE], int size, float termos[MAXSIZE], float aprox[MAXSIZE], float aproxAnt[MAXSIZE]) { int i, j; for (i = 0; i < size; i++){ aprox[i] = aproxAnt[i]; } for(i = 0; i < size; i++){ aprox[i] = termos[i]; for(j = 0; j < size; j++){ if(i == j){ continue; } aprox[i] -= (mat[i][j] * aprox[j]); } aprox[i] /= mat[i][i]; } } int CPGaussSeidel(float aprox[MAXSIZE], int size, float aproxAnt[MAXSIZE], float epsilon) { int i; float n, d, num = -1, den = -1; for(i = 0; i < size; i++){ n = fabs(aprox[i] - aproxAnt[i]); num = (num > n) ? num : n; d = fabs(aprox[i]); den = (den > d) ? den : d; } printf("%f / %f = %f\n", num, den, num/den); return ((num / den) < epsilon) ? 1 : 0; } // = funcoes de rotinas = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = void rotinaDeterminante() { system("cls"); int size; float mat[MAXSIZE][MAXSIZE]; printf("insira a ordem da matriz: "); scanf("%d", &size); printf("insira a matriz: \n"); leMatriz(mat, size); printf("\n"); printf("o determinante da matriz eh: %f\n", determinante(mat, size)); printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaSistemaTriangularInferior() { system("cls"); int size; float termos[MAXSIZE], s[MAXSIZE]; float mat[MAXSIZE][MAXSIZE]; printf("insira a ordem da matriz: "); scanf("%d", &size); printf("insira a matriz: \n"); leMatriz(mat, size); printf("\n"); if(checarTriangularInferior(mat, size) != 1){ printf("esta matriz nao eh triangular inferior\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } printf("insira o vetor de termos independentes: \n"); leVetor(termos, size); printf("\n"); triangularInferior(mat, size, termos, s); printf("o vetor solucao da matriz eh: \n"); imprimeVetor(s, size); printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaSistemaTriangularSuperior() { system("cls"); int size; float termos[MAXSIZE], s[MAXSIZE]; float mat[MAXSIZE][MAXSIZE]; printf("insira a ordem da matriz: "); scanf("%d", &size); printf("insira a matriz: \n"); leMatriz(mat, size); printf("\n"); if(checarTriangularSuperior(mat, size) != 1){ printf("esta matriz nao eh triangular superior\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } printf("insira o vetor de termos independentes: \n"); leVetor(termos, size); printf("\n"); triangularSuperior(mat, size, termos, s); printf("o vetor solucao da matriz eh: \n"); imprimeVetor(s, size); printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaDecomposicaoLU() { system("cls"); int size; float termos[MAXSIZE], s[MAXSIZE]; float mat[MAXSIZE][MAXSIZE]; printf("insira a ordem da matriz: "); scanf("%d", &size); printf("insira a matriz: \n"); leMatriz(mat, size); printf("\n"); if(checkPositivaDefinida(mat, size) != 1){ printf("esta matriz nao eh positiva definida (para todo Ak, k = {1, 2, ..., n} | det(Ak) != 0)\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } printf("insira o vetor de termos independentes: \n"); leVetor(termos, size); printf("\n"); decomposicaoLU(mat, size, termos, s); printf("o vetor solucao da matriz eh: \n"); imprimeVetor(s, size); printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaCholesky() { system("cls"); int i, j, size, k = 0, sim = 1; printf("\nDigite o tamanho da matriz: \n"); scanf("%d", &size); float mat[MAXSIZE][MAXSIZE], A[MAXSIZE][MAXSIZE], vet[MAXSIZE] ; printf("\nDigite os valores da matriz: "); for (i = 0; i != size; i++){ for (j = 0; j != size; j++){ scanf("%f", &mat[i][j]); } } for(sim = 1; sim != size; sim++) { if(mat[0][sim] != mat[sim][0]) { printf("Matriz nao simetrica!\n"); } else { A[0][0] = sqrt(mat[0][0]); for(i = 1; i != size; i++) { A[i][0] = (mat[i][0])/(A[0][0]); } for(i = 1, k =0; i != size; i++) { A[i][i] = sqrt(mat[i][i] - A[i][k] * A[i][k]); } for (j = 1; j != size; j++) { for(i = 0; i != size; i++) { A[i][j] = (mat[i][j] - A[i][k] * A[j][k])/(A[j][j]); } } for (i = 2; i != size; i++) { for(j = 1; j != size; j++) { A[i][j] = (mat[i][j] - A[i][k] * A[j][k])/(A[j][j]); } } printf("\nMatriz G: \n"); for(i = 0; i != size; i++){ for (j = 0; j != size; j++){ printf ("%.2f", A[i][j]); if(j != size - 1) printf("\t"); else printf("\n"); } } printf("\nMatriz G transposta: \n"); for(i = 0; i != size; i++){ for (j = 0; j != size; j++){ printf ("%.2f", A[j][i]); if(j != size - 1) printf("\t"); else printf("\n"); } } } } printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaGaussCompacto() { system("cls"); int i, size; float termos[MAXSIZE], s[MAXSIZE]; float mat[MAXSIZE][MAXSIZE]; printf("insira a ordem da matriz: "); scanf("%d", &size); printf("insira a matriz: \n"); leMatriz(mat, size); printf("\n"); if(checkPositivaDefinida(mat, size) != 1){ printf("esta matriz nao eh positiva definida (para todo Ak, k = {1, 2, ..., n} | det(Ak) != 0)\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } printf("insira o vetor de termos independentes: \n"); leVetor(termos, size); printf("\n"); for(i = 0; i < size; i++){ mat[i][size] = termos[i]; } decomposicaoGaussCompacto(mat, size, s); printf("o vetor solucao da matriz eh: \n"); imprimeVetor(s, size); printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaGaussJordan() { system("cls"); int i, j, k, n, l; float A[MAXSIZE][MAXSIZE], c, x[MAXSIZE]; printf("\nDigite o tamanho da matriz: "); scanf_s("%d", &n); printf("\nDigite os elementos da matriz:\n"); for(i=1; i<=n; i++){ for(j=1; j<=(n+1); j++){ scanf_s("%f", &A[i][j]); } } printf("\nDigite o valor do vetor dos termos independentes: "); scanf_s("%d", &l); for(j=1; j<=n; j++){ for(i=1; i<=n; i++){ if(i!=j){ c=A[i][j]/A[j][j]; for(k=1; k<=n+1; k++){ A[i][k] = A[i][k] - c * A[j][k]; } } } } printf("\nA solucao eh:\n"); for(i=1; i<=n; i++){ x[i] = A[i][n+1]/A[i][i]; printf("\n x%d=%f\n", i, x[i]); } } void rotinaJacobi() { system("cls"); printf("Digite o tamanho da matriz\n"); scanf("%d",&size); printf("Digite os elementos da matriz\n"); for(linha=0;linha<size;linha++) for(coluna=0;coluna<size;coluna++) scanf("%f",&coeficiente[linha][coluna]); printf("Digite a primeira aproximacao\n"); for(linha=0;linha<size;linha++) scanf("%f",&approx[linha][0]); printf("Digite o coeficiente\n"); for(linha=0;linha<size;linha++) scanf("%f",&b[linha][0]); for(linha=0;linha<size;linha++) for(coluna=0;coluna<size;coluna++){ if(linha==coluna) Dinv[linha][coluna]=1/coeficiente[linha][coluna]; else Dinv[linha][coluna]=0; } for(linha=0;linha<size;linha++) for(coluna=0;coluna<size;coluna++){ if(linha==coluna) R[linha][coluna]=0; else if(linha!=coluna) R[linha][coluna]=coeficiente[linha][coluna]; } int iter; printf("Digite o numero de iteracoes:\n"); scanf("%d",&iter); int ctr=1; int octr; while(ctr<=iter){ multiply(R,approx); for(linha=0;linha<size;linha++) temp[linha][0]=b[linha][0]-matrizRes[linha][0]; multiply(Dinv,temp); for(octr=0;octr<size;octr++) approx[octr][0]=matrizRes[octr][0]; printf("O valor apos a iteracao %d eh\n",ctr); for(linha=0;linha<size;linha++) printf("%.3f\n",approx[linha][0]); ctr++; } getch(); } void rotinaGaussSeidel() { system("cls"); int i, j, k, maxK, size, prec, cp; float epsilon; float termos[MAXSIZE], aproxAnt[MAXSIZE], aprox[MAXSIZE]; float mat[MAXSIZE][MAXSIZE]; printf("Digite o tamanho da matriz\n"); scanf("%d", &size); printf("Digite os elementos da matriz\n"); leMatriz(mat, size); printf("\n"); // diag principal != 0 if(checkDiagNaoNula(mat, size) != 1){ printf("esta matriz tem a diagonal nula\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } // det != 0 if(checarFloatZero(determinante(mat, size)) == 1){ printf("esta matriz tem o determinante nulo\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } // verificar convergencia if(convergenciaCriterioLinhas(mat, size) == 0 && convergenciaCriterioSassenfeld(mat, size) == 0){ printf("esta matriz nao tem covergencia garantida\n"); printf("pressione qualquer tecla para continuar...\n"); getch(); return; } printf("insira o vetor de termos independentes: \n"); leVetor(termos, size); printf("\n"); printf("Digite a aproximacao inicial\n"); leVetor(aproxAnt, size); printf("\n"); printf("Digite a precisao (numero de casas decimais)\n"); do{ scanf("%d", &prec); }while(prec <= 0); printf("\n"); epsilon = 1; for(i = 0; i < prec; i++){ epsilon /= 10; } printf("Digite o maximo de iteracoes\n"); do{ scanf("%d", &maxK); }while(maxK <= 0); printf("\n"); k = 0; do{ aproximacaoGaussSeidel(mat, size, termos, aprox, aproxAnt); if(CPGaussSeidel(aprox, size, aproxAnt, epsilon) == 1){ break; } for(i = 0; i < size; i++){ aproxAnt[i] = aprox[i]; } k++; }while(k < maxK); printf("Apos %d iteracoes:\n", k); imprimeVetorPrecisao(aprox, size); printf("pressione qualquer tecla para continuar...\n"); getch(); } void rotinaMatrizInversa() { system("cls"); int i, j, size, k = 0; printf("\nDigite o tamanho da matriz: \n"); scanf("%d",&size); float mat[MAXSIZE][MAXSIZE], ident[MAXSIZE][MAXSIZE], pivo, p = 1, m = 0; for(i = 0; i != size; i++) { for(j = 0; j != size; j++) { if(i == j){ ident[i][j] = 1; } else ident[i][j] = 0; } } printf("\nDigite os valores da matriz: "); for (i = 0; i != size; i++){ for (j = 0; j != size; j++){ scanf("%f",&mat[i][j]); } } if(determinante(mat, size) == 0) { printf("\nDeterminante = 0, Inversa impossivel\n\n"); } else { for(j = 0; j != size; j++){ pivo = mat[j][j]; for(k = j; k != size; k++) { mat[j][k] = (mat[j][k])/(pivo); ident[j][k] = (ident[j][k])/(pivo); } for(i = 0; i != size; i++){ if(i != j){ m = mat[i][j]/p; for(k = 0; k != size; k++){ mat[i][k] = (mat[i][k]) - (m * mat[j][k]); ident[i][k] = (ident[i][k]) - (m * ident[j][k]); } } } } printf("\nMatriz Inversa: \n"); for(i = 0; i != size; i++){ for (j = 0; j != size; j++){ printf ("%.2f",ident[i][j]); if(j != size - 1) printf("\t"); else printf("\n"); } } } printf("pressione qualquer tecla para continuar...\n"); getch(); } // = main e funcoes gerais = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = int main() { int op; do{ system("cls"); printf("selecione uma opcao:\n"); printf("-------------------------\n"); printf("\n"); printf("01 - Calcular determinante\n"); printf("02 - Calcular sistema triangular superior\n"); printf("03 - Calcular sistema triangular inferior\n"); printf("04 - Calcular decomposicao LU\n"); printf("05 - Calcular rotina Cholesky\n"); printf("06 - Calcular rotina Gauss Compacto\n"); printf("07 - Calcular rotina Gauss Jordan\n"); printf("08 - Calcular rotina Jacobi\n"); printf("09 - Calcular rotina Gauss Seidel\n"); printf("10 - Calcular matriz inversa\n"); printf("11 - Sair\n"); printf("\nOpcao: "); scanf("%d", &op); switch(op){ case 1: rotinaDeterminante(); break; case 2: rotinaSistemaTriangularInferior(); break; case 3: rotinaSistemaTriangularSuperior(); break; case 4: rotinaDecomposicaoLU(); break; case 5: rotinaCholesky(); break; case 6: rotinaGaussCompacto(); break; case 7: rotinaGaussJordan(); break; case 8: rotinaJacobi(); break; case 9: rotinaGaussSeidel(); break; case 10: rotinaMatrizInversa(); break; } }while(op != 11); return 0; }
24.048705
136
0.47197
dd4b288b00330dea27c42d3153fd39269f794d6a
2,269
c
C
coro_pthread.c
jiixyj/fifo-kqueue-tests
f826555c044a25b868de408e7d0b62a1fc8d3b7c
[ "BSD-2-Clause", "MIT" ]
null
null
null
coro_pthread.c
jiixyj/fifo-kqueue-tests
f826555c044a25b868de408e7d0b62a1fc8d3b7c
[ "BSD-2-Clause", "MIT" ]
1
2019-02-12T22:26:10.000Z
2019-02-12T23:08:34.000Z
coro_pthread.c
jiixyj/fifo-kqueue-tests
f826555c044a25b868de408e7d0b62a1fc8d3b7c
[ "BSD-2-Clause", "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <pthread.h> #include "coro.h" struct coro_pthread { pthread_t thread; pthread_cond_t *cond; pthread_mutex_t *mutex; void (*fun)(Coro, void *); void **arg_ptr; }; static _Thread_local pthread_cond_t cond = PTHREAD_COND_INITIALIZER; static _Thread_local pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; static _Thread_local void *my_arg; static void * trampoline(void *thread_arg) { struct coro_pthread **coros = (struct coro_pthread **)thread_arg; void (*fun)(Coro, void *); void *arg; struct coro_pthread parent_coro = *coros[1]; pthread_mutex_lock(&mutex); { pthread_mutex_lock(parent_coro.mutex); coros[0]->cond = &cond; coros[0]->mutex = &mutex; coros[0]->arg_ptr = &my_arg; fun = coros[0]->fun; pthread_cond_signal(parent_coro.cond); pthread_mutex_unlock(parent_coro.mutex); } pthread_cond_wait(&cond, &mutex); arg = my_arg; pthread_mutex_unlock(&mutex); fun(&parent_coro, arg); return (NULL); } Coro coro_create(size_t size, void (*fun)(Coro, void *)) { struct coro_pthread *coros[2]; struct coro_pthread my_coro = { .cond = &cond, .mutex = &mutex, .arg_ptr = &my_arg }; (void)size; coros[0] = malloc(sizeof(struct coro_pthread)); if (!coros[0]) { return (NULL); } coros[1] = &my_coro; pthread_mutex_lock(&mutex); { coros[0]->fun = fun; if (pthread_create(&coros[0]->thread, NULL, /**/ trampoline, coros) < 0) { pthread_mutex_unlock(&mutex); free(coros[0]); return (NULL); } } pthread_cond_wait(&cond, &mutex); pthread_mutex_unlock(&mutex); return (coros[0]); } void * coro_transfer(Coro coro_p, void *arg) { struct coro_pthread *coro = (struct coro_pthread *)coro_p; void *arg_local; pthread_mutex_lock(&mutex); { pthread_mutex_lock(coro->mutex); *coro->arg_ptr = arg; pthread_cond_signal(coro->cond); pthread_mutex_unlock(coro->mutex); } pthread_cond_wait(&cond, &mutex); arg_local = my_arg; pthread_mutex_unlock(&mutex); return (arg_local); } void coro_destroy(Coro coro_p) { struct coro_pthread *coro = (struct coro_pthread *)coro_p; { pthread_mutex_lock(coro->mutex); pthread_cond_signal(coro->cond); pthread_mutex_unlock(coro->mutex); } pthread_join(coro->thread, NULL); free(coro_p); }
20.079646
71
0.702071
973a7eea379ba8a4d670ae65f689bb5817d1603a
961
h
C
MFXTester/MFXTester/Preferences.h
mobfox/MFX-iOS-SDK
e88a3fa9890e27312199cb4d8bcc202df12332ba
[ "Apache-2.0" ]
null
null
null
MFXTester/MFXTester/Preferences.h
mobfox/MFX-iOS-SDK
e88a3fa9890e27312199cb4d8bcc202df12332ba
[ "Apache-2.0" ]
3
2019-09-16T08:39:19.000Z
2021-03-28T18:07:37.000Z
MFXTester/MFXTester/Preferences.h
mobfox/MFX-iOS-SDK
e88a3fa9890e27312199cb4d8bcc202df12332ba
[ "Apache-2.0" ]
1
2021-11-10T10:49:42.000Z
2021-11-10T10:49:42.000Z
// // Preferences.h // MFXTester // // Created by Shimon Shnitzer on 31/03/2020. // Copyright © 2020 MobFox Mobile Advertising GmbH. All rights reserved. // #import <Foundation/Foundation.h> NS_ASSUME_NONNULL_BEGIN #define kPref_HandleSubjectToGDPR @"kPref_HandleSubjectToGDPR" #define kPref_HandleGDPRString @"kPref_HandleGDPRString" #define kPref_HandleCOPPA @"kPref_HandleCOPPA" #define kPref_HandleCCPA @"kPref_HandleCCPA" @interface Preferences : NSObject { NSMutableDictionary *prefsDict; NSString *prefsFilePath; } @property (nonatomic,retain) NSMutableDictionary *prefsDict; @property (nonatomic,retain) NSString *prefsFilePath; + (Preferences *)sharedInstance; - (void)savePrefs; - (NSInteger)getPrefIntByKey:(NSString *)prefKey; - (NSInteger)getPrefIntByKey:(NSString *)prefKey defVal:(NSInteger)defVal; - (void)setPrefIntBykey:(NSString *)prefKey newVal:(NSInteger)newVal; @end NS_ASSUME_NONNULL_END
25.972973
74
0.762747
3f03236d5e1abbbf2cee9e4c41897a79f1749395
1,552
h
C
cmds/idmap2/include/idmap2/FileUtils.h
rio-31/android_frameworks_base-1
091a068a3288d27d77636708679dde58b7b7fd25
[ "Apache-2.0" ]
164
2015-01-05T16:49:11.000Z
2022-03-29T20:40:27.000Z
cmds/idmap2/include/idmap2/FileUtils.h
rio-31/android_frameworks_base-1
091a068a3288d27d77636708679dde58b7b7fd25
[ "Apache-2.0" ]
127
2015-01-12T12:02:32.000Z
2021-11-28T08:46:25.000Z
cmds/idmap2/include/idmap2/FileUtils.h
rio-31/android_frameworks_base-1
091a068a3288d27d77636708679dde58b7b7fd25
[ "Apache-2.0" ]
1,141
2015-01-01T22:54:40.000Z
2022-02-09T22:08:26.000Z
/* * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef IDMAP2_INCLUDE_IDMAP2_FILEUTILS_H_ #define IDMAP2_INCLUDE_IDMAP2_FILEUTILS_H_ #include <sys/types.h> #include <functional> #include <memory> #include <string> #include <vector> namespace android::idmap2::utils { constexpr const char* kIdmapCacheDir = "/data/resource-cache"; constexpr const mode_t kIdmapFilePermissionMask = 0133; // u=rw,g=r,o=r typedef std::function<bool(unsigned char type /* DT_* from dirent.h */, const std::string& path)> FindFilesPredicate; std::unique_ptr<std::vector<std::string>> FindFiles(const std::string& root, bool recurse, const FindFilesPredicate& predicate); std::unique_ptr<std::string> ReadFile(int fd); std::unique_ptr<std::string> ReadFile(const std::string& path); bool UidHasWriteAccessToPath(uid_t uid, const std::string& path); } // namespace android::idmap2::utils #endif // IDMAP2_INCLUDE_IDMAP2_FILEUTILS_H_
33.73913
97
0.728737
c1f62527e6ceb5cc8e4b3de37dd5ab9dec3d48a4
3,020
h
C
acsl/libraries/libc/include/__fc_define_stat.h
davidcok/annotationsforall
16024a9ffecdb72b638e1f942c567f8815183e89
[ "Apache-2.0" ]
4
2016-06-16T21:03:57.000Z
2021-02-06T10:20:14.000Z
acsl/libraries/libc/include/__fc_define_stat.h
davidcok/annotationsforall
16024a9ffecdb72b638e1f942c567f8815183e89
[ "Apache-2.0" ]
null
null
null
acsl/libraries/libc/include/__fc_define_stat.h
davidcok/annotationsforall
16024a9ffecdb72b638e1f942c567f8815183e89
[ "Apache-2.0" ]
1
2021-06-09T07:00:34.000Z
2021-06-09T07:00:34.000Z
/**************************************************************************/ /* */ /* This file is part of Frama-C. */ /* */ /* Copyright (C) 2007-2015 */ /* CEA (Commissariat à l'énergie atomique et aux énergies */ /* alternatives) */ /* */ /* 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, version 2.1. */ /* */ /* It 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. */ /* */ /* See the GNU Lesser General Public License version 2.1 */ /* for more details (enclosed in the file licenses/LGPLv2.1). */ /* */ /**************************************************************************/ #ifndef __FC_DEFINE_STAT_H #define __FC_DEFINE_STAT_H #include "features.h" #include "__fc_define_ino_t.h" #include "__fc_define_uid_and_gid.h" #include "__fc_define_time_t.h" #include "__fc_define_blkcnt_t.h" #include "__fc_define_blksize_t.h" #include "__fc_define_dev_t.h" #include "__fc_define_mode_t.h" #include "__fc_define_nlink_t.h" #include "__fc_define_off_t.h" __BEGIN_DECLS struct stat { dev_t st_dev; ino_t st_ino; mode_t st_mode; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; dev_t st_rdev; off_t st_size; time_t st_atime; time_t st_mtime; time_t st_ctime; blksize_t st_blksize; blkcnt_t st_blocks; // These are not part of the spec, but exist in practice - usually a macro for st_atime etc. struct timespec st_atim; unsigned long int st_atime_usec; struct timespec st_mtim; unsigned long int st_mtime_usec; struct timespec st_ctim; unsigned long int st_ctime_usec; }; /* GNU Extensions */ struct stat64 { mode_t st_mode; ino64_t st_ino; dev_t st_dev; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; off64_t st_size; time_t st_atime; unsigned long int st_atime_usec; time_t st_mtime; unsigned long int st_mtime_usec; time_t st_ctime; unsigned long int st_ctime_usec; blkcnt64_t st_blocks; unsigned int st_blksize; }; __END_DECLS #endif
34.712644
94
0.501987
f50bb5e60059c2c3630197c38f966af5ee516322
521
h
C
Think Golf/Libs/3rd Party/SwiftKeychainWrapper/SwiftKeychainWrapper.h
imohsinj/_Think
13d2730cd2eac4837794dbd13aafb3263f322cc9
[ "Apache-2.0" ]
null
null
null
Think Golf/Libs/3rd Party/SwiftKeychainWrapper/SwiftKeychainWrapper.h
imohsinj/_Think
13d2730cd2eac4837794dbd13aafb3263f322cc9
[ "Apache-2.0" ]
null
null
null
Think Golf/Libs/3rd Party/SwiftKeychainWrapper/SwiftKeychainWrapper.h
imohsinj/_Think
13d2730cd2eac4837794dbd13aafb3263f322cc9
[ "Apache-2.0" ]
null
null
null
// // SwiftKeychainWrapper.h // SwiftKeychainWrapper // // Created by Jason Rendel on 1/13/15. // // #import <UIKit/UIKit.h> //! Project version number for SwiftKeychainWrapper. FOUNDATION_EXPORT double SwiftKeychainWrapperVersionNumber; //! Project version string for SwiftKeychainWrapper. FOUNDATION_EXPORT const unsigned char SwiftKeychainWrapperVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <SwiftKeychainWrapper/PublicHeader.h>
26.05
145
0.792706
bcd94ad66a4824eab099af9e14d8dc01d404030d
801
h
C
src/autopilot_hinf/autopilot_hinf_types.h
catou93/firefly_catherine_2
b1892fe86dd3d52caed0b1c5ed7d35405d74332f
[ "BSD-3-Clause" ]
null
null
null
src/autopilot_hinf/autopilot_hinf_types.h
catou93/firefly_catherine_2
b1892fe86dd3d52caed0b1c5ed7d35405d74332f
[ "BSD-3-Clause" ]
null
null
null
src/autopilot_hinf/autopilot_hinf_types.h
catou93/firefly_catherine_2
b1892fe86dd3d52caed0b1c5ed7d35405d74332f
[ "BSD-3-Clause" ]
null
null
null
/* * autopilot_hinf_types.h * * Code generation for model "autopilot_hinf". * * Model version : 1.460 * Simulink Coder version : 8.11 (R2016b) 25-Aug-2016 * C++ source code generated on : Thu Aug 02 13:27:01 2018 * * Target selection: grt.tlc * Note: GRT includes extra infrastructure and instrumentation for prototyping * Embedded hardware selection: 32-bit Generic * Code generation objective: Execution efficiency * Validation result: Passed (9), Warnings (3), Error (0) */ #ifndef RTW_HEADER_autopilot_hinf_types_h_ #define RTW_HEADER_autopilot_hinf_types_h_ /* Forward declaration for rtModel */ typedef struct tag_RTM_autopilot_hinf_T RT_MODEL_autopilot_hinf_T; #endif /* RTW_HEADER_autopilot_hinf_types_h_ */
33.375
80
0.70412
87cc36ab8abc6e364dac430edb12d7768d216e9a
3,676
h
C
Windows/WTextView.h
cas-nctu/multispec
0bc840bdb073b5feaeec650c2da762cfa34ee37d
[ "Apache-2.0" ]
11
2020-03-10T02:06:00.000Z
2022-02-17T19:59:50.000Z
Windows/WTextView.h
cas-nctu/multispec
0bc840bdb073b5feaeec650c2da762cfa34ee37d
[ "Apache-2.0" ]
null
null
null
Windows/WTextView.h
cas-nctu/multispec
0bc840bdb073b5feaeec650c2da762cfa34ee37d
[ "Apache-2.0" ]
5
2020-05-30T00:59:22.000Z
2021-12-06T01:37:05.000Z
// MultiSpec // // Copyright 1988-2020 Purdue Research Foundation // // 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: https://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. // // MultiSpec is curated by the Laboratory for Applications of Remote Sensing at // Purdue University in West Lafayette, IN and licensed by Larry Biehl. // // File: WTextView.h // Implementation: WTextView.cpp // // Authors: Larry L. Biehl // // Language: C++ // // System: Windows Operating System // // Brief description: Header file for the CMTextView class // // Written By: Larry L. Biehl Date: ??/??/1995? // Revised By: Larry L. Biehl Date: 03/27/2017 // //------------------------------------------------------------------------------------ #pragma once class CMTextView : public CEditView { DECLARE_DYNCREATE (CMTextView) protected: CMTextView (); // protected constructor used by dynamic creation virtual ~CMTextView (); virtual void OnInitialUpdate (); // first time after construct virtual void OnActivateView ( BOOL bActivate, CView* pActivateView, CView* pDeactiveView); virtual BOOL PreCreateWindow ( CREATESTRUCT& cs); // Generated message map functions //{{AFX_MSG (CMTextView) afx_msg void OnChar ( UINT nChar, UINT nRepCnt, UINT nFlags); afx_msg int OnCreate ( LPCREATESTRUCT lpCreateStruct); afx_msg void OnFilePrintPreview (); afx_msg void OnMouseMove ( UINT nFlags, CPoint point); afx_msg BOOL OnSetCursor ( CWnd* pWnd, UINT nHitTest, UINT message); afx_msg void OnUpdateEditClear ( CCmdUI* pCmdUI); afx_msg void OnUpdateEditCopy ( CCmdUI* pCmdUI); afx_msg void OnUpdateEditCut ( CCmdUI* pCmdUI); afx_msg void OnUpdateEditPaste ( CCmdUI* pCmdUI); afx_msg void OnUpdateEditSelectAll ( CCmdUI* pCmdUI); afx_msg void OnUpdateFileClose ( CCmdUI* pCmdUI); afx_msg void OnUpdateFilePrint ( CCmdUI* pCmdUI); afx_msg void OnUpdateFilePrintPreview ( CCmdUI* pCmdUI); afx_msg void OnUpdateFilePrintSetup ( CCmdUI* pCmdUI); afx_msg void OnUpdateFileSave ( CCmdUI* pCmdUI); afx_msg void OnUpdateFileSaveAs ( CCmdUI* pCmdUI); //}}AFX_MSG DECLARE_MESSAGE_MAP () #ifdef _DEBUG virtual void AssertValid () const; virtual void Dump ( CDumpContext& dc) const; #endif CFont m_font; static LOGFONT NEAR m_lfDefFont; // Flag indicated whether this view is active Boolean m_activeFlag; // Attributes public: CMTextDoc* GetDocument (); SInt32 GetTextBufferLength (void); Boolean ListString ( HPtr textPtr, UInt32 textLength, SInt16 charFormatCode=kASCIICharString); }; // end class CMTextView #ifndef _DEBUG // debug version in mspecvw.cpp inline CMTextDoc* CMTextView::GetDocument () { return (CMTextDoc*)m_pDocument; } #endif
25.351724
86
0.619151
407f4fd0e8cadb79ed9610866b450ab8371fb0f8
1,567
h
C
EpicForceEngine/MagnumEngineLib/MagnumCore/AudioListenerBase.h
MacgyverLin/MagnumEngine
975bd4504a1e84cb9698c36e06bd80c7b8ced0ff
[ "MIT" ]
1
2021-03-30T06:28:32.000Z
2021-03-30T06:28:32.000Z
EpicForceEngine/MagnumEngineLib/MagnumCore/AudioListenerBase.h
MacgyverLin/MagnumEngine
975bd4504a1e84cb9698c36e06bd80c7b8ced0ff
[ "MIT" ]
null
null
null
EpicForceEngine/MagnumEngineLib/MagnumCore/AudioListenerBase.h
MacgyverLin/MagnumEngine
975bd4504a1e84cb9698c36e06bd80c7b8ced0ff
[ "MIT" ]
null
null
null
/////////////////////////////////////////////////////////////////////////////////// // Copyright(c) 2016, Lin Koon Wing Macgyver, macgyvercct@yahoo.com.hk // // // // Author : Mac Lin // // Module : Magnum Engine v1.0.0 // // Date : 14/Jun/2016 // // // /////////////////////////////////////////////////////////////////////////////////// #ifndef _AudioListenerBase_h_ #define _AudioListenerBase_h_ #include "Stage.h" #include "Audio.h" #include "AudioComponent.h" using namespace Magnum; namespace Magnum { /** * AudioListenerBase. * AudioListenerBase is the base class of all Audio Listener component. * @see AudioComponent */ class AudioListenerBase : public AudioComponent { friend class Audio::Manager; public: //////////////////////////////////////////////////////////////// /** * AudioListenerBase Constructor. * To Construct the AudioListenerBase for the owner. * @param owner_, the Component::Owner which owns this component. */ AudioListenerBase(Component::Owner &owner_); /** * AudioListenerBase Destructor. * To Destruct AudioListenerBase and remove from its owner. */ virtual ~AudioListenerBase(); //////////////////////////////////////////////////////////////// DECLARE_COMPONENT(AudioListenerBase, AudioComponent, false) //////////////////////////////////////////////////////////////// protected: private: //////////////////////////////////////////////////////////////// public: protected: private: }; }; #endif
27.017241
83
0.480536
7bcab2c19b04778047da21865bce4f85c210d626
528
h
C
include/GUI/LootWindow.h
tizian/Cendric2
5b0438c73a751bcc0d63c3af839af04ab0fb21a3
[ "MIT" ]
279
2015-05-06T19:04:07.000Z
2022-03-21T21:33:38.000Z
include/GUI/LootWindow.h
tizian/Cendric2
5b0438c73a751bcc0d63c3af839af04ab0fb21a3
[ "MIT" ]
222
2016-10-26T15:56:25.000Z
2021-10-03T15:30:18.000Z
include/GUI/LootWindow.h
tizian/Cendric2
5b0438c73a751bcc0d63c3af839af04ab0fb21a3
[ "MIT" ]
49
2015-10-01T21:23:03.000Z
2022-03-19T20:11:31.000Z
#pragma once #include "global.h" #include "GUI/Window.h" #include "GUI/BitmapText.h" #include "World/Item.h" class LootWindow final : public Window { public: LootWindow(); ~LootWindow(); void render(sf::RenderTarget& renderTarget) override; void setLoot(const std::map<std::string, int>& loot, int gold); void setPosition(const sf::Vector2f& position) override; private: BitmapText* m_lootText = nullptr; void loadItemNames(const std::map<std::string, int>& loot, std::map<std::string, std::string>& names) const; };
25.142857
109
0.727273
1bb9d86f13d93f0333bce8d8b69681e7f12b4f54
958
h
C
songs/controllers/ZDAddInsertBarsController.h
jjorgemoura/songs
de2cec9b9ab5b702b31220c4082da9a87249f17a
[ "MIT" ]
null
null
null
songs/controllers/ZDAddInsertBarsController.h
jjorgemoura/songs
de2cec9b9ab5b702b31220c4082da9a87249f17a
[ "MIT" ]
null
null
null
songs/controllers/ZDAddInsertBarsController.h
jjorgemoura/songs
de2cec9b9ab5b702b31220c4082da9a87249f17a
[ "MIT" ]
null
null
null
// // ZDAddInsertBarsController.h // songs // // Created by Jorge Moura on 08/08/14. // Copyright (c) 2014 Jorge Moura. All rights reserved. // #import <Foundation/Foundation.h> @class ZDBar; @class ZDSongBlock; @class ZDAddInsertBarsController; @protocol ZDAddInsertBarsControllerDelegate <NSObject> @optional - (void)viewController:(ZDAddInsertBarsController *)viewController willInsertXBars:(NSNumber *)barsQuantity ofType:(ZDSongBlock *)barBlockType beforeTheCurrentBar:(BOOL)before; - (void)viewController:(ZDAddInsertBarsController *)viewController didInsertXBars:(NSNumber *)barsQuantity ofType:(ZDSongBlock *)barBlockType beforeTheCurrentBar:(BOOL)before; - (void)viewControllerXBarsDidCancel:(ZDAddInsertBarsController *)viewController; @end @interface ZDAddInsertBarsController : UIViewController @property (nonatomic, strong) ZDBar *theSelectedZDBar; @property (nonatomic, weak) id <ZDAddInsertBarsControllerDelegate> delegate; @end
29.9375
176
0.806889
29781f4e0777c3badcb9efefb2e8c9b706e349db
2,697
h
C
src/ui/c_builder_view.h
Mankio/Wakfu-Builder
d2ce635dde2da21eee3639cf3facebd07750ab78
[ "MIT" ]
null
null
null
src/ui/c_builder_view.h
Mankio/Wakfu-Builder
d2ce635dde2da21eee3639cf3facebd07750ab78
[ "MIT" ]
null
null
null
src/ui/c_builder_view.h
Mankio/Wakfu-Builder
d2ce635dde2da21eee3639cf3facebd07750ab78
[ "MIT" ]
null
null
null
#ifndef C_BUILDER_VIEW_H #define C_BUILDER_VIEW_H #include <QWidget> #include <QPropertyAnimation> #include <QTimer> #include "utilities/c_dbmanager.h" #include "utilities/c_build.h" #include "c_result_display.h" #include "c_status_build.h" #include "c_elements_display.h" #include "c_build_display.h" #include "c_search_widget.h" #include "utilities/c_io_manager.h" #include "c_aptitudes_display.h" #include "c_element_popup_widget.h" #include "utilities/c_calcul.h" #include "ui/c_class_selection.h" #include "ui/c_theory_craft_resume.h" #include "ui/c_enchantement_display.h" namespace Ui { class c_builder_view; } class MainWindow; class c_builder_view : public QWidget { Q_OBJECT public: explicit c_builder_view(c_dbmanager *_manager, QCompleter* search_completer, QWidget *parent = nullptr); ~c_builder_view(); c_status_build *getStatus_build() const; c_build_display *getBuild_display() const; c_elements_display *getElement_display() const; c_aptitudes_display *getAptitude_display() const; c_enchantement_display *getEnchantement_display() const; int getId() const; void setId(int value); QString getPath() const; void setPath(const QString &value); MainWindow *getParent() const; virtual void resizeEvent(QResizeEvent *event); private: Ui::c_builder_view *ui; c_dbmanager *manager; c_build *build; c_result_display *result_display; c_status_build *status_build; c_elements_display *element_display; c_build_display *build_display; c_search_widget *search_widget; c_aptitudes_display *aptitude_display; c_enchantement_display *enchantement_display; int id; // -1 if comes or saved as a file, >0 if comes from or saved in the database, else 0 QString path; MainWindow *parent; int state_column_number; int state_element; c_element_popup_widget *element_popup; QPropertyAnimation* animation1; QTimer timer; c_calcul *calcul; c_class_selection *class_selection_popup; c_theory_craft_resume *tc_resume; public slots: void slot_save(c_io_manager::jsonformat format, QString path = QString()); bool slot_load(c_io_manager::jsonformat format, QString path = QString()); bool slot_loadFrom(c_io_manager::jsonformat format, QString path_json, int id); void slot_update(c_io_manager::jsonformat format); void slot_show_element_popup(); void slot_hide_element_popup(); void slot_show_class_popup(); void slot_hide_class_popup(); // virtual void keyPressEvent(QKeyEvent *event); // virtual void keyReleaseEvent(QKeyEvent *event); signals: void shift_pressed(bool state); }; #endif // C_BUILDER_VIEW_H
28.389474
108
0.756025
5db05619560b50af1adbd6d2b812c7b642dc3eec
492
h
C
framework/render_core/excludeFromBuild/handlers/MotionHandler.h
Hurleyworks/Ketone
97c0c730a6e3155154a0ccb87a535e109dfa3c7d
[ "Apache-2.0" ]
1
2021-04-01T01:16:33.000Z
2021-04-01T01:16:33.000Z
framework/render_core/excludeFromBuild/handlers/MotionHandler.h
Hurleyworks/Ketone
97c0c730a6e3155154a0ccb87a535e109dfa3c7d
[ "Apache-2.0" ]
null
null
null
framework/render_core/excludeFromBuild/handlers/MotionHandler.h
Hurleyworks/Ketone
97c0c730a6e3155154a0ccb87a535e109dfa3c7d
[ "Apache-2.0" ]
null
null
null
// This header file was auto-generated by ClassMate++ // Created: 8 Sep 2020 8:44:40 pm // Copyright (c) 2020, HurleyWorks #pragma once using MotionHandlerRef = std::shared_ptr<class MotionHandler>; class MotionHandler { public: static MotionHandlerRef create (OptiXStateRef state) { return std::make_shared<MotionHandler> (state); } public: MotionHandler (OptiXStateRef state); ~MotionHandler(); private: OptiXStateRef state = nullptr; }; // end class MotionHandler
22.363636
108
0.73374
098dc6e495dc43bce7ac8e8ae41f2fedf0888c8b
302
c
C
install_dependencies/xianyi-OpenBLAS-6d2da63/interface/CMakeFiles/clauum.c
lanl/DnMFkCPP
a6bca290bf7d57be07f7a80d049d6b7714fbdc61
[ "BSD-3-Clause", "Unlicense" ]
1
2021-07-29T21:56:02.000Z
2021-07-29T21:56:02.000Z
install_dependencies/xianyi-OpenBLAS-6d2da63/interface/CMakeFiles/clauum.c
rvangara/DnMFk
a6bca290bf7d57be07f7a80d049d6b7714fbdc61
[ "BSD-3-Clause", "Unlicense" ]
null
null
null
install_dependencies/xianyi-OpenBLAS-6d2da63/interface/CMakeFiles/clauum.c
rvangara/DnMFk
a6bca290bf7d57be07f7a80d049d6b7714fbdc61
[ "BSD-3-Clause", "Unlicense" ]
2
2021-07-29T21:55:33.000Z
2021-08-02T21:30:15.000Z
#define ASMNAME clauum #define ASMFNAME clauum_ #define NAME clauum_ #define CNAME clauum #define CHAR_NAME "clauum_" #define CHAR_CNAME "clauum" #define COMPLEX #include "/lustre/scratch3/turquoise/rvangara/RD100/distnnmfkcpp_Src/install_dependencies/xianyi-OpenBLAS-6d2da63/interface/lapack/zlauum.c"
37.75
140
0.837748
51b06df104a8f3fd9374c8dc4184349ecc26c2aa
3,050
h
C
src/ui/tableview2d.h
Hayesie88/emstudio
0ae4353e5dcaa76b6306ff0aabd5a89999c4dc1b
[ "MIT" ]
8
2015-11-16T19:15:55.000Z
2021-02-17T23:58:33.000Z
src/ui/tableview2d.h
Hayesie88/emstudio
0ae4353e5dcaa76b6306ff0aabd5a89999c4dc1b
[ "MIT" ]
5
2015-11-12T00:19:59.000Z
2020-03-23T10:18:19.000Z
src/ui/tableview2d.h
Hayesie88/emstudio
0ae4353e5dcaa76b6306ff0aabd5a89999c4dc1b
[ "MIT" ]
11
2015-03-15T23:02:48.000Z
2021-09-05T14:17:13.000Z
/************************************************************************************ * EMStudio - Open Source ECU tuning software * * Copyright (C) 2020 Michael Carpenter (malcom2073@gmail.com) * * * * This file is a part of EMStudio is licensed MIT as * * defined in LICENSE.md at the top level of this repository * ************************************************************************************/ #ifndef TABLEVIEW2D_H #define TABLEVIEW2D_H #include <QWidget> #include <QResizeEvent> #include <QKeyEvent> #include <QClipboard> #include <table2ddata.h> #include <QPair> #include "ui_tableview2d.h" #include "dataview.h" class TableView2D : public DataView { Q_OBJECT public: explicit TableView2D(QWidget *parent = 0); ~TableView2D(); //bool setData(unsigned short locationid,QByteArray data,TableData *newtableData=0); //bool setData(unsigned short locationid,QByteArray data,Table2DMetaData metadata,TableData *newtableData); //bool setData(unsigned short locationid,QByteArray rawdata); void setMetaData(Table2DMetaData metadata); bool setData(unsigned short locationid,DataBlock *data); bool setData(QString name,DataBlock *data); //void passData(unsigned short locationid,Table2DData data); void passDatalog(QVariantMap data); private: bool m_isSignedData; bool m_isFlashOnly; bool m_tracingEnabled; bool metaDataValid; Table2DData *tableData; void setSilentValue(int row,int column,QString value); Table2DMetaData m_metaData; Ui::TableView2D ui; unsigned short m_locationid; int m_physicalid; double currentvalue; void resizeColumnWidths(); int m_currRow; int m_currCol; void exportJson(QString filename); void setValue(int row, int column,double value); void writeTable(bool ram); QList<QPair<int,int> > m_highlightItemList; int m_oldXLoc; void setRange(QList<QPair<QPair<int,int>,double> > data); QString formatNumber(double num,int prec); QString verifyValue(int row,int column,QString item); void reColorTable(int rownum,int colnum); //QCPAxisRect *m_wideAxisRect; protected: void resizeEvent(QResizeEvent *evt); void keyPressEvent(QKeyEvent *event); public slots: bool updateTable(); private slots: void tracingCheckBoxStateChanged(int newstate); void exportClicked(); void importClicked(); void saveClicked(); void loadFlashClicked(); void loadRamClicked(); void tableCellChanged(int row,int column); void tableCurrentCellChanged(int currentrow,int currentcolumn,int prevrow,int prevcolumn); void hotKeyPressed(int key,Qt::KeyboardModifiers modifier); signals: void saveToFlash(unsigned short locationid); void saveData(unsigned short locationid,QByteArray data,int phyiscallocation); void saveSingleData(unsigned short locationid,QByteArray data, unsigned short offset, unsigned short size); void reloadTableData(unsigned short locationid,bool ram); }; #endif // TABLEVIEW2D_H
36.746988
108
0.695082
66575dfb78de999b1f09fc3334d9859d64d27846
1,506
h
C
src/eyespark/resource/mesh/PlaneMesh.h
rayferric/learnopengl-attempt
5465ee2d33c03944359c5e48e0c49bf2eb4e0cc8
[ "MIT" ]
null
null
null
src/eyespark/resource/mesh/PlaneMesh.h
rayferric/learnopengl-attempt
5465ee2d33c03944359c5e48e0c49bf2eb4e0cc8
[ "MIT" ]
null
null
null
src/eyespark/resource/mesh/PlaneMesh.h
rayferric/learnopengl-attempt
5465ee2d33c03944359c5e48e0c49bf2eb4e0cc8
[ "MIT" ]
null
null
null
#ifndef EYESPARK_PLANEMESH_H #define EYESPARK_PLANEMESH_H #include "../../resource/mesh/Mesh.h" #include "../../util/Vector2.h" class PlaneMesh : public Mesh { public: PlaneMesh(Vector2 size) { size *= 0.5; unsigned int vertexCount = 4; float *vertexData = new float[vertexCount*8] { -size.x, -size.y, 0, 0, 0, 0, 0, 1, size.x, -size.y, 0, 1, 0, 0, 0, 1, size.x, size.y, 0, 1, 1, 0, 0, 1, -size.x, size.y, 0, 0, 1, 0, 0, 1 }; indexCount = 6; unsigned int *indices = new unsigned int[indexCount] { 0, 1, 2, 2, 3, 0 }; glEnableVertexAttribArray(0); glEnableVertexAttribArray(1); glEnableVertexAttribArray(2); glBindBuffer(GL_ARRAY_BUFFER, vbos[0]); glBufferData(GL_ARRAY_BUFFER, vertexCount*sizeof(float)*8, vertexData, GL_STATIC_DRAW); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (const void *)0); glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 8*sizeof(float), (const void *)(sizeof(float)*3)); glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 8*sizeof(float), (const void *)(sizeof(float)*5)); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vbos[1]); glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexCount*sizeof(unsigned int), indices, GL_STATIC_DRAW); delete[] vertexData; delete[] indices; } }; #endif // EYESPARK_PLANEMESH_H
32.73913
106
0.596282
22114bb4702213bc0cc9d54c8690a39fe756309e
1,897
c
C
d/newbie/rooms/town/old/erstreet3.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-07-19T05:24:44.000Z
2021-11-18T04:08:19.000Z
d/newbie/rooms/town/old/erstreet3.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
4
2021-03-15T18:56:39.000Z
2021-08-17T17:08:22.000Z
d/newbie/rooms/town/old/erstreet3.c
Dbevan/SunderingShadows
6c15ec56cef43c36361899bae6dc08d0ee907304
[ "MIT" ]
13
2019-09-12T06:22:38.000Z
2022-01-31T01:15:12.000Z
#include <std.h> #include "../../newbie.h" inherit INH"townmove.c"; void create() { ::create(); set_terrain(CITY); set_travel(PAVED_ROAD); set_name("Starlight Avenue in Offestry"); set_short("Starlight Avenue in Offestry"); set_long( @NEWBIE You are walking on Starlight Court, in the middle of a residential area. This area seems to be relaxed and laid-back, with neighbors talking over fences and children playing wherever there is an empty space. There is little traffic along this sidestreet, mostly residents going to and from their houses. Every once in a while someone calls a friendly greeting to you. The house to the south has a %^BOLD%^%^GREEN%^green door%^RESET%^ and to the north is a house with a %^YELLOW%^yellow door%^RESET%^. NEWBIE ); set("night long", ""+TO->query_long()+"\n%^BOLD%^The street light glows brightly and lights your way."); set_listen("default","You hear the sounds of children playing and neighbors chatting."); set_smell("default","The air is fresh and clean."); set_property("light",2); set_items(([ "streets":"The streets are cobbled and new. They lead throughout the city.", "houses":"The houses appear to be living space for small families. Most likely those who work in the city have their residences in this area.", ])); set_exits(([ "west":MAINTOWN"erstreet2", "east":MAINTOWN"erstreet4", "north":MAINTOWN"ehouse5", "south":MAINTOWN"ehouse1", ])); set_door("yellow door","/d/newbie/rooms/town/ehouse5","north",0); set_door("green door","/d/newbie/rooms/town/ehouse1","south",0); set_open("yellow door",0); "/d/newbie/rooms/town/ehouse5"->set_open("yellow door",0); set_open("green door",0); "/d/newbie/rooms/town/ehouse1"->set_open("green door",0); } void reset(){ ::reset(); if(!present("street_light",TO)) new(MISCDIR+"street_light")->move(TO); }
43.113636
501
0.694254
796d4f28b75777ca82aad696bceceec4727b8f16
2,811
h
C
src/rx/core/types.h
BuckeyeSoftware/rex
a0380e2e3ce26e610b4c9fcbe0ece19ecc8c3531
[ "MIT" ]
37
2019-02-17T06:31:22.000Z
2022-01-13T12:08:13.000Z
src/rx/core/types.h
BuckeyeSoftware/rex
a0380e2e3ce26e610b4c9fcbe0ece19ecc8c3531
[ "MIT" ]
47
2019-10-28T07:23:41.000Z
2020-07-25T22:36:16.000Z
src/rx/core/types.h
BuckeyeSoftware/rex
a0380e2e3ce26e610b4c9fcbe0ece19ecc8c3531
[ "MIT" ]
7
2019-03-03T12:08:52.000Z
2020-11-21T22:01:51.000Z
#ifndef RX_FOUNDATION_TYPES_H #define RX_FOUNDATION_TYPES_H #include "rx/core/config.h" #include "rx/core/traits/conditional.h" /// \file types.h /// Root namespace. namespace Rx { /// An alias for \c size_t using Size = decltype(sizeof 0); /// An alias for \c bool using Bool = bool; /// A type which represents a byte. using Byte = unsigned char; /// Signed 8-bit integer. using Sint8 = signed char; /// Unsigned 8-bit integer. using Uint8 = unsigned char; /// Signed 16-bit integer. using Sint16 = signed short; /// Unsigned 16-bit integer. using Uint16 = unsigned short; /// Signed 32-bit integer. using Sint32 = signed int; /// Unsigned 32-bit integer. using Uint32 = unsigned int; /// Signed 64-bit integer. using Sint64 = Rx::Traits::Conditional<sizeof(signed long) == 8, signed long, signed long long>; /// Unsigned 64-bit integer. using Uint64 = Rx::Traits::Conditional<sizeof(unsigned long) == 8, unsigned long, unsigned long long>; /// 32-bit float. using Float32 = float; /// 64-bit float. using Float64 = double; /// The different of two pointers. using PtrDiff = decltype((Byte*)0 - (Byte*)0); /// Unsigned integer large enough to hold a pointer. using UintPtr = decltype(sizeof 0); /// Alias for \c nullptr_t. using NullPointer = decltype(nullptr); /// The type 32-bit floating point arithmetic is evaluated in on the hardware. using Float32Eval = Float32; /// The type 64-bit floating point arithmetic is evaluated in on the hardware. using Float64Eval = Float64; /// Convenience user-defined literal for producing Size literals. constexpr Size operator"" _z(unsigned long long _value) { return static_cast<Size>(_value); } /// Convenience user-defined literal for producing Uint8 literals. constexpr Uint8 operator"" _u8(unsigned long long _value) { return static_cast<Uint8>(_value); } /// Convenience user-defined literal for producing Uint16 literals. constexpr Uint16 operator"" _u16(unsigned long long _value) { return static_cast<Uint16>(_value); } /// Convenience user-defined literal for producing Uint32 literals. constexpr Uint32 operator"" _u32(unsigned long long _value) { return static_cast<Uint32>(_value); } /// Convenience user-defined literal for producing Uint64 literals. constexpr Uint64 operator"" _u64(unsigned long long _value) { return static_cast<Uint64>(_value); } /// Convenience user-defined literal for KiB to bytes. constexpr auto operator""_KiB(unsigned long long _value) { return _value * 1024ul; } /// Convienence user-defined literal for MiB to bytes. constexpr auto operator""_MiB(unsigned long long _value) { return _value * 1024_KiB; } /// Convienence user-defined literal for GiB to bytes. constexpr auto operator""_GiB(unsigned long long _value) { return _value * 1024_MiB; } } // namespace Rx #endif // RX_FOUNDATION_TYPES_H
30.89011
102
0.743863
d7a773ad9943d9cbe45080411abdb77a36a5fdb9
1,026
h
C
Aplicacion Movil/generated/bundles/login-transition/build/Android/Preview/app/src/main/include/Fuse.Reactive.ISubscription.h
marferfer/SpinOff-LoL
a9dba8ac9dd476ec1ef94712d9a8e76d3b45aca8
[ "Apache-2.0" ]
null
null
null
Aplicacion Movil/generated/bundles/login-transition/build/Android/Preview/app/src/main/include/Fuse.Reactive.ISubscription.h
marferfer/SpinOff-LoL
a9dba8ac9dd476ec1ef94712d9a8e76d3b45aca8
[ "Apache-2.0" ]
null
null
null
Aplicacion Movil/generated/bundles/login-transition/build/Android/Preview/app/src/main/include/Fuse.Reactive.ISubscription.h
marferfer/SpinOff-LoL
a9dba8ac9dd476ec1ef94712d9a8e76d3b45aca8
[ "Apache-2.0" ]
null
null
null
// This file was generated based on C:/Users/JuanJose/AppData/Local/Fusetools/Packages/Fuse.Reactive/1.9.0/IObservable.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.IDisposable.h> #include <Uno.Object.h> namespace g{ namespace Fuse{ namespace Reactive{ // internal abstract interface ISubscription :131 // { uInterfaceType* ISubscription_typeof(); struct ISubscription { void(*fp_ClearExclusive)(uObject*); void(*fp_ReplaceAllExclusive)(uObject*, uObject*); void(*fp_SetExclusive)(uObject*, uObject*); static void ClearExclusive(const uInterface& __this) { __this.VTable<ISubscription>()->fp_ClearExclusive(__this); } static void ReplaceAllExclusive(const uInterface& __this, uObject* values) { __this.VTable<ISubscription>()->fp_ReplaceAllExclusive(__this, values); } static void SetExclusive(const uInterface& __this, uObject* newValue) { __this.VTable<ISubscription>()->fp_SetExclusive(__this, newValue); } }; // } }}} // ::g::Fuse::Reactive
36.642857
154
0.753411
c7d2077d8dd064df8c5685a1dfb33d85a6424da5
1,937
h
C
components/cboy/video.h
hex007/esp32-cboy
317a880a7715920c0d9fa4a5e3490bfc18f5e4e7
[ "Apache-2.0" ]
1
2019-01-30T09:20:12.000Z
2019-01-30T09:20:12.000Z
components/cboy/video.h
hex007/esp32-cboy
317a880a7715920c0d9fa4a5e3490bfc18f5e4e7
[ "Apache-2.0" ]
null
null
null
components/cboy/video.h
hex007/esp32-cboy
317a880a7715920c0d9fa4a5e3490bfc18f5e4e7
[ "Apache-2.0" ]
null
null
null
/************************************************************************* * Cboy, a Game Boy emulator * Copyright (C) 2012 jkbenaim * * 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 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. ************************************************************************/ #include "types.h" #ifndef _VIDEO_H_ #define _VIDEO_H_ #ifdef __cplusplus extern "C" { #endif // Sprite attribute flags #define SPRITE_PRIORITY 0x80 // 0=Sprite above BG, 1=Sprite behind BG color 1-3 #define SPRITE_YFLIP 0x40 // 0=Normal, 1=Vertically mirrored #define SPRITE_XFLIP 0x20 // 0=Normal, 1=Horizontally mirrored #define SPRITE_DMG_PAL 0x10 // 0=OBP0, 1=OBP1 #define SPRITE_VRAM_BANK 0x08 // 0=Bank 0, 1=Bank 1 (CGB only) #define SPRITE_CGB_PAL_MASK 0x07 // OBP0-7 (CGB only) // Background map attribute flags (CGB only) #define BG_OAM_PRIORITY 0x80 // 0=Use OAM priority bit, 1=BG priority #define BG_YFLIP 0x40 // 0=Normal, 1=Vertically mirrored #define BG_XFLIP 0x20 // 0=Normal, 1=Horizontally mirrored #define BG_NOTUSED 0x10 #define BG_VRAM_BANK 0x08 // 0=Bank 0, 1=Bank 1 #define BG_CGB_PAL_MASK 0x07 // BGP0-7 extern char inval_palette; void vid_init( void ); void vid_waitForNextFrame(); void vid_render_line(); void vid_frame(); extern pixel_t palette[4]; #ifdef __cplusplus } #endif #endif // _VIDEO_H_
35.218182
83
0.67682
a7633dd4c0bea17b104da44f1ae46fc3b2d5296c
9,091
h
C
src/public/src/ysclass/src/ysbigint.h
rothberg-cmu/rothberg-run
a42df5ca9fae97de77753864f60d05295d77b59f
[ "MIT" ]
1
2019-08-10T00:24:09.000Z
2019-08-10T00:24:09.000Z
src/public/src/ysclass/src/ysbigint.h
rothberg-cmu/rothberg-run
a42df5ca9fae97de77753864f60d05295d77b59f
[ "MIT" ]
null
null
null
src/public/src/ysclass/src/ysbigint.h
rothberg-cmu/rothberg-run
a42df5ca9fae97de77753864f60d05295d77b59f
[ "MIT" ]
2
2019-05-01T03:11:10.000Z
2019-05-01T03:30:35.000Z
/* //////////////////////////////////////////////////////////// File Name: ysbigint.h Copyright (c) 2017 Soji Yamakawa. All rights reserved. http://www.ysflight.com Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. //////////////////////////////////////////////////////////// */ #ifndef YSBIGINT_IS_INCLUDED #define YSBIGINT_IS_INCLUDED /* { */ class YsBigInt { public: enum { INTHIGHBIT=(int)((unsigned int)((unsigned int)(~0)&(~(((unsigned int)(~0))>>1)))>>1), UINTHIGHBIT=((unsigned int)((unsigned int)(~0)&(~(((unsigned int)(~0))>>1)))) }; YsBigInt(); YsBigInt(int x); YsBigInt(unsigned int x); int upper; unsigned int lower; inline const YsBigInt &operator+=(const YsBigInt &a); inline const YsBigInt &operator-=(const YsBigInt &a); inline const YsBigInt &operator*=(const YsBigInt &a); inline const YsBigInt &operator/=(const YsBigInt &a); inline const YsBigInt &operator>>=(int n); inline const YsBigInt &operator<<=(int n); inline const YsBigInt &Atoi(const char str[]); inline const char *Itoa(char str[],int nBufLen) const; inline const YsBigInt &Negate(void); inline const YsBigInt &Multiply(YsBigInt &mul,const YsBigInt &a,const YsBigInt &b); inline const YsBigInt &Divide(YsBigInt &div,YsBigInt &mod,const YsBigInt &denom); protected: inline void InduceDivisionByZeroException(void) const; }; inline YsBigInt::YsBigInt() { } inline YsBigInt::YsBigInt(int x) { upper=(x>=0 ? 0 : ~0); lower=(unsigned)x; } inline YsBigInt::YsBigInt(unsigned int x) { upper=0; lower=x; } inline const YsBigInt &YsBigInt::operator+=(const YsBigInt &a) { unsigned prevLower; prevLower=lower; lower+=a.lower; upper+=a.upper; if(lower<prevLower && lower<a.lower) // Overflow? { upper++; } return *this; } inline const YsBigInt &YsBigInt::operator-=(const YsBigInt &a) { if(a.lower>lower) // Underflow { upper--; } lower-=a.lower; upper-=a.upper; return *this; } inline const YsBigInt &YsBigInt::operator*=(const YsBigInt &a) { YsBigInt c; Multiply(c,*this,a); *this=c; return *this; } inline const YsBigInt &YsBigInt::operator/=(const YsBigInt &a) { YsBigInt div,mod; Divide(div,mod,a); *this=div; return *this; } inline const YsBigInt &YsBigInt::operator>>=(int n) { if(n<0) { return (*this)<<=n; } else if(n>0) { int i; unsigned orBit,mask; orBit=0; mask=1; for(i=0; i<n; i++) { orBit>>=1; if(upper&mask) { orBit|=UINTHIGHBIT; } mask<<=1; } lower>>=n; lower|=orBit; upper>>=n; } return *this; } inline const YsBigInt &YsBigInt::operator<<=(int n) { if(n<0) { return (*this)>>=n; } else if(n>0) { int i; unsigned orBit,mask; orBit=0; mask=UINTHIGHBIT; for(i=0; i<n; i++) { orBit<<=1; if(lower&mask) { orBit|=1; } mask>>=1; } lower<<=n; upper<<=n; upper|=orBit; } return *this; } inline YsBigInt operator+(const YsBigInt &a,const YsBigInt &b) { YsBigInt x; x.lower=a.lower+b.lower; x.upper=a.upper+b.upper; if(x.lower<a.lower && x.lower<b.lower) // Overflow? { x.upper++; } return x; } inline const YsBigInt &operator+(const YsBigInt &a) { return a; } inline YsBigInt operator-(const YsBigInt &a,const YsBigInt &b) { YsBigInt x; x.lower=a.lower-b.lower; x.upper=a.upper-b.upper; if(x.lower>a.lower && x.lower>b.lower) // Underflow? { x.upper--; } return x; } inline YsBigInt operator*(const YsBigInt &a,const YsBigInt &b) { YsBigInt c; c=a; c*=b; return c; } inline YsBigInt operator/(const YsBigInt &a,const YsBigInt &b) { YsBigInt c; c=a; c/=b; return c; } inline YsBigInt operator-(const YsBigInt &a) { YsBigInt x; unsigned *lowbit; x=a; lowbit=(unsigned *)&x.lower; (*lowbit)=~(*lowbit); x.upper=~x.upper; x.lower++; if(x.lower==0) { x.upper++; } return x; } inline YsBigInt operator<<(const YsBigInt &a,int n) { YsBigInt x; x=a; x<<=n; return x; } inline YsBigInt operator>>(const YsBigInt &a,int n) { YsBigInt x; x=a; x>>=n; return x; } inline int operator==(const YsBigInt &a,const YsBigInt &b) { return (a.lower==b.lower && a.upper==b.upper); } inline int operator!=(const YsBigInt &a,const YsBigInt &b) { return (a.lower!=b.lower || a.upper!=b.upper); } inline int operator>(const YsBigInt &a,const YsBigInt &b) { if(a.upper!=b.upper) { return a.upper>b.upper; } else { return a.lower>b.lower; } } inline int operator<(const YsBigInt &a,const YsBigInt &b) { if(a.upper!=b.upper) { return a.upper<b.upper; } else { return a.lower<b.lower; } } inline int operator<=(const YsBigInt &a,const YsBigInt &b) { if(a.upper==b.upper) { return a.lower<=b.lower; } else { return a.upper<b.upper; } } inline int operator>=(const YsBigInt &a,const YsBigInt &b) { if(a.upper==b.upper) { return a.lower>=b.lower; } else { return a.upper>b.upper; } } inline YsBigInt operator&(const YsBigInt &a,const YsBigInt &b) { YsBigInt c; c.upper=(a.upper&b.upper); c.lower=(a.lower&b.lower); return c; } inline YsBigInt operator|(const YsBigInt &a,const YsBigInt &b) { YsBigInt c; c.upper=(a.upper|b.upper); c.lower=(a.lower|b.lower); return c; } inline YsBigInt operator^(const YsBigInt &a,const YsBigInt &b) { YsBigInt c; c.upper=(a.upper^b.upper); c.lower=(a.lower^b.lower); return c; } inline const YsBigInt &YsBigInt::Atoi(const char str[]) { int i; int sgn; sgn=1; i=0; upper=0; lower=0; for(i=0; str[i]=='-' || str[i]=='+'; i++) { if(str[i]=='-') { sgn=-1; } } if('0'<=str[i] && str[i]<='9') { lower=(str[i]-'0'); i++; while('0'<=str[i] && str[i]<='9' && i<10) { lower*=10; lower+=(str[i]-'0'); i++; } while('0'<=str[i] && str[i]<='9') { (*this)*=10; (*this)+=(str[i]-'0'); i++; } } if(sgn<0) { (*this)=-(*this); } return *this; } inline const char *YsBigInt::Itoa(char str[],int nBufLen) const { if(nBufLen>0) { if(upper==0 && lower==0) { str[0]='0'; str[1]=0; return str; } int i,i0,n,sgn; YsBigInt a,div,mod; i=0; i0=0; sgn=1; a=*this; if(a.upper<0) { a=-a; sgn=-1; str[i]='-'; i++; } i0=i; n=0; while(i<nBufLen-1 && a>0) { a.Divide(div,mod,10); str[i++]='0'+mod.lower; a=div; n++; } str[i]=0; for(i=0; i<n/2; i++) { char swp; swp=str[i+i0]; str[i0+i]=str[i0+n-1-i]; str[i0+n-1-i]=swp; } } return str; } inline const YsBigInt &YsBigInt::Negate(void) { upper=~upper; lower=~lower; lower++; if(lower==0) { upper++; } return *this; } inline const YsBigInt &YsBigInt::Multiply(YsBigInt &mul,const YsBigInt &_a,const YsBigInt &_b) { YsBigInt a,b,tst; int sgn; sgn=1; a=_a; if(a.upper<0) { a.Negate(); sgn=-sgn; } b=_b; if(b.upper<0) { b.Negate(); sgn=-sgn; } mul=0; tst=1; while(tst!=YsBigInt(0)) { if((tst&a)!=0) { mul+=b; } tst<<=1; b<<=1; } return mul; } inline const YsBigInt &YsBigInt::Divide(YsBigInt &div,YsBigInt &mod,const YsBigInt &_denom) { int sgn; YsBigInt denom,numer; numer=*this; sgn=1; if(numer.upper<0) { sgn=-1; numer.Negate(); } denom=_denom; if(_denom.upper<0) { sgn=-sgn; denom.Negate(); } if(denom==0) { InduceDivisionByZeroException(); } if(numer<denom) { div=0; mod=*this; } else { YsBigInt highBit,divBit; highBit.upper=INTHIGHBIT; highBit.lower=0; while((highBit&numer)==0) { highBit>>=1; if(highBit==0) { InduceDivisionByZeroException(); } } divBit=1; div=0; mod=0; while((denom&highBit)==0) { denom<<=1; divBit<<=1; } while(1) { if(denom<=numer) { div+=divBit; numer-=denom; } divBit>>=1; if(divBit==0) { break; } denom>>=1; } mod=numer; if(sgn<0) { div.Negate(); mod.Negate(); } } return div; } inline void YsBigInt::InduceDivisionByZeroException(void) const { int a,b; a=10; b=0; a/=b; } /* } */ #endif
15.64716
94
0.624464
6873a453d78d225d76dad1851056c95f902f75f8
513
h
C
src/functional/defs.h
hieuhoang/marian-dev
f2347a827fcfd7eebaaa552e2b3c2461f8ea45c2
[ "MIT" ]
829
2017-06-05T12:14:34.000Z
2022-03-29T17:24:03.000Z
src/functional/defs.h
hieuhoang/marian-dev
f2347a827fcfd7eebaaa552e2b3c2461f8ea45c2
[ "MIT" ]
732
2017-07-21T15:32:27.000Z
2022-03-22T10:26:09.000Z
src/functional/defs.h
hieuhoang/marian-dev
f2347a827fcfd7eebaaa552e2b3c2461f8ea45c2
[ "MIT" ]
192
2017-06-27T10:17:26.000Z
2022-03-28T05:33:11.000Z
#pragma once #ifdef __CUDACC__ // Compiling with NVCC, host or device code #include <cuda.h> #define HOST __host__ #define DEVICE __device__ #define DEVICE_INLINE __device__ inline #define HOST_INLINE __host__ inline #define HOST_DEVICE __host__ __device__ #define HOST_DEVICE_INLINE __host__ __device__ inline #else // Compiling with GCC or other host compiler #define HOST #define DEVICE #define DEVICE_INLINE inline #define HOST_INLINE inline #define HOST_DEVICE #define HOST_DEVICE_INLINE inline #endif
22.304348
62
0.818713
9c032dc61da3e19777315cf8e59ca1500ad48a01
578
h
C
src/lib/crypto/yarrow/ylock.h
zapfbandit/krb5
02f6ef7257c2b2d5a2db3d570944ba3cfa9319ee
[ "MIT", "Unlicense" ]
null
null
null
src/lib/crypto/yarrow/ylock.h
zapfbandit/krb5
02f6ef7257c2b2d5a2db3d570944ba3cfa9319ee
[ "MIT", "Unlicense" ]
null
null
null
src/lib/crypto/yarrow/ylock.h
zapfbandit/krb5
02f6ef7257c2b2d5a2db3d570944ba3cfa9319ee
[ "MIT", "Unlicense" ]
null
null
null
/* -*- Mode: C; c-file-style: "bsd" -*- */ #ifndef YLOCK_H #define YLOCK_H #include "yarrow.h" /* these functions should return: * * YARROW_OK on success * and YARROW_LOCKING on failure */ #if 0 static int LOCK( void ) { return (YARROW_OK); } static int UNLOCK( void ) { return (YARROW_OK); } #else #include "k5-thread.h" extern k5_mutex_t krb5int_yarrow_lock; #define LOCK() (k5_mutex_lock(&krb5int_yarrow_lock) ? YARROW_LOCKING : YARROW_OK) #define UNLOCK() (k5_mutex_unlock(&krb5int_yarrow_lock) ? YARROW_LOCKING : YARROW_OK) #endif #endif /* YLOCK_H */
23.12
85
0.697232
ec2d90100ddfa1f4908be8f09e6e35cd0022897d
1,165
h
C
PCCWFoundation/ViewModels/PCCWMenuViewModel.h
lizhihui0215/PCCWFoundation
4007bd0fb65118f32e101c61a77e5047e9136796
[ "MIT" ]
1
2018-01-05T17:36:45.000Z
2018-01-05T17:36:45.000Z
PCCWFoundation/ViewModels/PCCWMenuViewModel.h
lizhihui0215/PCCWFoundation
4007bd0fb65118f32e101c61a77e5047e9136796
[ "MIT" ]
null
null
null
PCCWFoundation/ViewModels/PCCWMenuViewModel.h
lizhihui0215/PCCWFoundation
4007bd0fb65118f32e101c61a77e5047e9136796
[ "MIT" ]
null
null
null
// // PCCWMenuViewModel.h // NM // // Created by 李智慧 on 23/11/2016. // Copyright © 2016 PCCW. All rights reserved. // #import "PCCWListViewModel.h" NS_ASSUME_NONNULL_BEGIN @protocol PCCWMenuViewModelProtocol <NSObject> - (NSDictionary <NSNumber *, NSString *> *)segueIdentifiers; - (NSDictionary<NSNumber *, UIImage *> *)itemImages; - (NSArray<NSNumber *> *)items; @optional - (NSDictionary <NSNumber *, NSString *> *)itemNames; - (UIImage *)imageAtIndexPath:(NSIndexPath *)indexPath; - (NSString *)nameAtIndexPath:(NSIndexPath *)indexPath; - (NSString *)identifierAtIndexPath:(NSIndexPath *)indexPath; @end @interface PCCWMenuItem : NSObject @property (nonatomic, strong) UIImage *image; @property (nonatomic, copy) NSString *segueIdentifier; @property (nonatomic, copy) NSString *name; - (instancetype)initWithImage:(UIImage *)image name:(NSString *)name segueIdentifier:(NSString *)segueIdentifier; @end @interface PCCWMenuViewModel : PCCWListViewModel<PCCWMenuViewModelProtocol> - (void)reloadMenuItems; - (PCCWMenuItem *)menuItemAtIndexPath:(NSIndexPath *)indexPath; @end NS_ASSUME_NONNULL_END
20.803571
75
0.725322
84d0320c1b6c6d9d1044b53a09c33b281826a7ea
436
h
C
FastPix3D/Path.h
bytecode-77/fastpix3d
77657c4c12fd5886e864314b20eceff4392faf48
[ "BSD-2-Clause" ]
15
2018-12-03T23:57:56.000Z
2022-01-15T10:42:44.000Z
FastPix3D/Path.h
bytecode-77/fastpix3d
77657c4c12fd5886e864314b20eceff4392faf48
[ "BSD-2-Clause" ]
null
null
null
FastPix3D/Path.h
bytecode-77/fastpix3d
77657c4c12fd5886e864314b20eceff4392faf48
[ "BSD-2-Clause" ]
2
2021-09-05T16:17:49.000Z
2021-11-30T04:10:29.000Z
class FASTPIX3D_API Path { public: static string GetWorkingDirectory(); static string GetStartupPath(); static string GetExecutablePath(); static string Combine(string path1, string path2); static string GetFileName(string path); static string GetDirectoryName(string path); static string GetExtension(string path); static bool HasExtension(string path); static string GetFileNameWithoutExtension(string path); };
31.142857
57
0.78211
7e3b0831ec89e8a2bb486cd4c4d5a9f7d6d6ed4d
2,852
h
C
stm32/system/STM32F0/stm32_chip/stm32_USART_variant_13.h
BSFrance/BSFrance
db1da987a84a60f568c5a4c79635d596e8ceb88b
[ "MIT" ]
8
2018-02-23T18:48:24.000Z
2021-02-13T23:57:27.000Z
stm32/system/STM32F0/stm32_chip/stm32_USART_variant_13.h
BSFrance/BSFrance
db1da987a84a60f568c5a4c79635d596e8ceb88b
[ "MIT" ]
2
2018-03-11T07:14:30.000Z
2019-02-17T20:05:26.000Z
stm32/system/STM32F0/stm32_chip/stm32_USART_variant_13.h
BSFrance/BSFrance
db1da987a84a60f568c5a4c79635d596e8ceb88b
[ "MIT" ]
4
2018-05-01T14:53:34.000Z
2021-04-06T12:31:05.000Z
const stm32_af_pin_list_type chip_af_usart_rx [] = { //USART1 { USART1, GPIOA, GPIO_PIN_10 , GPIO_AF1_USART1}, { USART1, GPIOB, GPIO_PIN_7 , GPIO_AF0_USART1}, //USART2 { USART2, GPIOA, GPIO_PIN_3 , GPIO_AF1_USART2}, { USART2, GPIOA, GPIO_PIN_15 , GPIO_AF1_USART2}, { USART2, GPIOD, GPIO_PIN_6 , GPIO_AF0_USART2}, //USART3 { USART3, GPIOB, GPIO_PIN_11 , GPIO_AF4_USART3}, { USART3, GPIOC, GPIO_PIN_5 , GPIO_AF1_USART3}, { USART3, GPIOC, GPIO_PIN_11 , GPIO_AF1_USART3}, { USART3, GPIOD, GPIO_PIN_9 , GPIO_AF0_USART3}, //USART4 { USART4, GPIOA, GPIO_PIN_1 , GPIO_AF4_USART4}, { USART4, GPIOC, GPIO_PIN_11 , GPIO_AF0_USART4}, { USART4, GPIOE, GPIO_PIN_9 , GPIO_AF1_USART4}, //USART5 { USART5, GPIOB, GPIO_PIN_4 , GPIO_AF4_USART5}, { USART5, GPIOD, GPIO_PIN_2 , GPIO_AF2_USART5}, { USART5, GPIOE, GPIO_PIN_11 , GPIO_AF1_USART5}, //USART6 { USART6, GPIOA, GPIO_PIN_5 , GPIO_AF5_USART6}, { USART6, GPIOC, GPIO_PIN_1 , GPIO_AF2_USART6}, { USART6, GPIOF, GPIO_PIN_10 , GPIO_AF1_USART6}, //USART7 { USART7, GPIOC, GPIO_PIN_1 , GPIO_AF1_USART7}, { USART7, GPIOC, GPIO_PIN_7 , GPIO_AF1_USART7}, { USART7, GPIOF, GPIO_PIN_3 , GPIO_AF1_USART7}, //USART8 { USART8, GPIOC, GPIO_PIN_3 , GPIO_AF2_USART8}, { USART8, GPIOC, GPIO_PIN_9 , GPIO_AF1_USART8}, { USART8, GPIOD, GPIO_PIN_14 , GPIO_AF0_USART8}, }; const stm32_af_pin_list_type chip_af_usart_tx [] = { //USART1 { USART1, GPIOA, GPIO_PIN_9 , GPIO_AF1_USART1}, { USART1, GPIOB, GPIO_PIN_6 , GPIO_AF0_USART1}, //USART2 { USART2, GPIOA, GPIO_PIN_2 , GPIO_AF1_USART2}, { USART2, GPIOA, GPIO_PIN_14 , GPIO_AF1_USART2}, { USART2, GPIOD, GPIO_PIN_5 , GPIO_AF0_USART2}, //USART3 { USART3, GPIOB, GPIO_PIN_10 , GPIO_AF4_USART3}, { USART3, GPIOC, GPIO_PIN_4 , GPIO_AF1_USART3}, { USART3, GPIOC, GPIO_PIN_10 , GPIO_AF1_USART3}, { USART3, GPIOD, GPIO_PIN_8 , GPIO_AF0_USART3}, //USART4 { USART4, GPIOA, GPIO_PIN_0 , GPIO_AF4_USART4}, { USART4, GPIOC, GPIO_PIN_10 , GPIO_AF0_USART4}, { USART4, GPIOE, GPIO_PIN_8 , GPIO_AF1_USART4}, //USART5 { USART5, GPIOB, GPIO_PIN_3 , GPIO_AF4_USART5}, { USART5, GPIOC, GPIO_PIN_12 , GPIO_AF2_USART5}, { USART5, GPIOE, GPIO_PIN_10 , GPIO_AF1_USART5}, //USART6 { USART6, GPIOA, GPIO_PIN_4 , GPIO_AF5_USART6}, { USART6, GPIOC, GPIO_PIN_0 , GPIO_AF2_USART6}, { USART6, GPIOF, GPIO_PIN_9 , GPIO_AF1_USART6}, //USART7 { USART7, GPIOC, GPIO_PIN_0 , GPIO_AF1_USART7}, { USART7, GPIOC, GPIO_PIN_6 , GPIO_AF1_USART7}, { USART7, GPIOF, GPIO_PIN_2 , GPIO_AF1_USART7}, //USART8 { USART8, GPIOC, GPIO_PIN_2 , GPIO_AF2_USART8}, { USART8, GPIOC, GPIO_PIN_8 , GPIO_AF1_USART8}, { USART8, GPIOD, GPIO_PIN_13 , GPIO_AF0_USART8}, };
40.169014
53
0.674965
bbfee735c31247076fa1f9e4fe5f049d92fd23e1
217
h
C
MyHealthModule/Classes/MHMBaseViewController.h
UEdge/Pedometer
e39a72adf84dec8d7bc195af2815b3cb42932a53
[ "Apache-2.0" ]
1
2018-03-28T02:49:25.000Z
2018-03-28T02:49:25.000Z
MyHealthModule/Classes/MHMBaseViewController.h
UEdge/Pedometer
e39a72adf84dec8d7bc195af2815b3cb42932a53
[ "Apache-2.0" ]
null
null
null
MyHealthModule/Classes/MHMBaseViewController.h
UEdge/Pedometer
e39a72adf84dec8d7bc195af2815b3cb42932a53
[ "Apache-2.0" ]
null
null
null
// // ViewController.h // MyHealthModule // // Created by ChenWeidong on 16/2/26. // Copyright © 2016年. All rights reserved. // #import <UIKit/UIKit.h> @interface MHMBaseViewController : UIViewController @end
14.466667
51
0.705069
00b1ee55426d5cceee48bcd402df21776ec13236
14,696
h
C
libraries/Card/SecureDigital/HardwareSDIO.h
betovar/libmaple
65d6001f5f78340e77459caf73866150dcea0c4f
[ "MIT" ]
1
2021-12-07T12:15:53.000Z
2021-12-07T12:15:53.000Z
libraries/Card/SecureDigital/HardwareSDIO.h
betovar/libmaple
65d6001f5f78340e77459caf73866150dcea0c4f
[ "MIT" ]
null
null
null
libraries/Card/SecureDigital/HardwareSDIO.h
betovar/libmaple
65d6001f5f78340e77459caf73866150dcea0c4f
[ "MIT" ]
null
null
null
/****************************************************************************** * The MIT License * * Copyright (c) 2012 LeafLabs, LLC * * 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. *****************************************************************************/ /** * @file HardwareSDIO.h * @author Brian E Tovar <betovar@leaflabs.com> * @brief Wirish SD Memory Card implementation * @note These devices share DMA Channel4: TIM5_CH2 SDIO TIM7_UP/DAC_Channel2 */ #include <libmaple/libmaple_types.h> #include <Card/SecureDigital/commands.h> #include <libmaple/sdio.h> #ifndef _HARDWARESDIO_H_ #define _HARDWARESDIO_H_ /* * SDIO Enumerations */ typedef enum SDIOBusMode { SDIO_BUS_1BIT = 0, SDIO_BUS_4BIT = 1 //SDIO_BUS_8BIT = 2 // used for UHS cards } SDIOBusMode; typedef enum SDIOClockFrequency { //SDIO_36_MHZ = 0, // High Speed Mode not yet supported SDIO_24_MHZ = 1, SDIO_18_MHZ = 2, SDIO_12_MHZ = 4, SDIO_6_MHZ = 10, SDIO_3_MHZ = 22, SDIO_2_MHZ = 34, SDIO_1_MHZ = 70, SDIO_500_KHZ = 142, SDIO_400_KHZ = 178, SDIO_300_KHZ = 238, SDIO_CLK_INIT = SDIO_300_KHZ //254 //281,250 Hz } SDIOClockFrequency; typedef enum SDIOBlockSize { SDIO_BKSZ_1 = 0, SDIO_BKSZ_2 = 1, SDIO_BKSZ_4 = 2, SDIO_BKSZ_8 = 3, SDIO_BKSZ_16 = 4, SDIO_BKSZ_32 = 5, SDIO_BKSZ_64 = 6, SDIO_BKSZ_128 = 7, SDIO_BKSZ_256 = 8, SDIO_BKSZ_512 = 9, SDIO_BKSZ_1024 = 10, SDIO_BKSZ_2048 = 11, SDIO_BKSZ_4096 = 12, SDIO_BKSZ_8192 = 13, SDIO_BKSZ_16384 = 14, SDIO_BKSZ_DEFAULT = 9 } SDIOBlockSize; /* * SD Structure Specific Enumerations */ typedef enum SdCardCapacity { //FIXME: don't see the need to use this SD_CAP_UNDEF = 0, SD_CAP_SDSC = 1, SD_CAP_SDHC = 2, SD_CAP_SDXC = 3 } SdCardCapacity; typedef enum SDIOStatusResponseTag { //CardStatusResponse Tags SDIO_CSR_NO_ERROR = 0, SDIO_CSR_ERROR = 1, SDIO_CSR_NOT_PROTECTED = 0, SDIO_CSR_PROTECTED = 1, SDIO_CSR_CARD_UNLOCKED = 0, SDIO_CSR_CARD_LOCKED = 1, SDIO_CSR_SUCCESS = 0, SDIO_CSR_FAILURE = 1, SDIO_CSR_ECC_ENABLED = 0, SDIO_CSR_ECC_DISABLED = 1, SDIO_CSR_CLEARED = 0, SDIO_CSR_SET = 1, SDIO_CSR_IDLE = 0, SDIO_CSR_NOT_READY = 0, SDIO_CSR_READY = 1, SDIO_CSR_IDENT = 2, SDIO_CSR_STBY = 3, SDIO_CSR_TRAN = 4, SDIO_CSR_DATA = 5, SDIO_CSR_RCV = 6, SDIO_CSR_PRG = 7, SDIO_CSR_DIS = 8, SDIO_CSR_IO_MODE = 15, SDIO_CSR_DISABLED = 0, SDIO_CSR_ENABLED = 1, //SdStatusResponse Tags SDIO_SSR_1BIT_WIDTH = 0, SDIO_SSR_4BIT_WIDTH = 2, SDIO_SSR_NOT_SECURED = 0, SDIO_SSR_SECURED = 1, SDIO_SSR_REG_CARD = 0, SDIO_SSR_ROM_CARD = 1, SDIO_SSR_OTP_CARD = 2, SDIO_SSR_SPEED_CLASS_0 = 0, SDIO_SSR_SPEED_CLASS_2 = 1, SDIO_SSR_SPEED_CLASS_4 = 2, SDIO_SSR_SPEED_CLASS_6 = 3, SDIO_SSR_SPEED_CLASS_10 = 4, SDIO_SSR_AU_SIZE_NOT_DEF = 0, SDIO_SSR_AU_SIZE_16KB = 1, SDIO_SSR_AU_SIZE_32KB = 2, SDIO_SSR_AU_SIZE_64KB = 3, SDIO_SSR_AU_SIZE_128KB = 4, SDIO_SSR_AU_SIZE_256KB = 5, SDIO_SSR_AU_SIZE_512KB = 6, SDIO_SSR_AU_SIZE_1MB = 7, SDIO_SSR_AU_SIZE_2MB = 8, SDIO_SSR_AU_SIZE_4MB = 9, SDIO_SSR_AU_SIZE_8MB = 10, SDIO_SSR_AU_SIZE_12MB = 11, SDIO_SSR_AU_SIZE_16MB = 12, SDIO_SSR_AU_SIZE_24MB = 13, SDIO_SSR_AU_SIZE_32MB = 14, SDIO_SSR_AU_SIZE_64MB = 15, } SDIOStatusResponseTag; /* * SD Register Structures */ typedef struct InterfaceConditionResponse { //unsigned Reserved :20; unsigned VOLTAGE_ACCEPTED :4; unsigned CHECK_PATTERN :8; } icr; typedef struct OperationConditionsRegister { //MSBit first /* Card power up status bit: This bit is set to LOW if * the card has not finished the power up routine. */ unsigned BUSY :1; /* Card Capacity Status: This bit is valid only when * the card power up status bit is set. * SDHC and SDXC use the 32-bit argument of memory access commands as * block address format. Block length is fixed to 512 bytes regardless * CMD16, SDSC uses the 32-bit argument of memory access commands as byte * address format. Block length is determined by CMD16 */ unsigned CCS :1; /* Switch to 1.8v Accepted: * Only UHS-I card supports this bit */ unsigned S18A :1; unsigned VOLTAGE_WINDOW :16; // 2.7v - 3.6v //unsigned Reserved :8; // Reserved for low voltage range } ocr; typedef struct product_revision { unsigned N :4; unsigned M :4; }__attribute__((packed)) prod_revn; typedef struct manufacturing_date { unsigned YEAR :8; unsigned MONTH :4; }__attribute__((packed)) manu_date; typedef struct CardIdentificationNumber { //MSBit first /* An 8-bit binary number that identifies the card manufacturer */ uint8 MID; // Manufacturer ID /* A 2-character ASCII string that identifies the card OEM */ char OID[3]; // OEM/Application ID, modified to be a NULL terminated string /** The product name is a string, 5-character ASCII string */ char PNM[6]; // Product Name, modified to be a NULL terminated string /* The Serial Number is 32 bits of a binary number */ uint32 PSN; // Product Serial Number /* The product revision is composed of two Binary Coded Decimal (BCD) * digits, four bits each, repre- senting an "n.m" revision number. * The "n" is the most significant nibble and "m" is the least * significant nibble */ prod_revn PRV; // Product Revision Number //unsigned Reserved1 :4; /* The manufacturing date is composed of two hexadecimal digits, one * is 8 bits representing the year(y) and the other is 4 bits representing * the month (m). The "m" field [11:8] is the month code. 1 = January. * The "y" field [19:12] is the year code. 0 = 2000. */ manu_date MDT; // Manufacturing Date, most significant 4 bits are reserved /** CRC7 checksum (7 bits) */ unsigned CRC :7; /* ST specific: The SDIO_RESP4 register LSBit is always 0b */ //unsigned Always1 :1; } cid; typedef struct RelativeCardAddress { //MSBit first uint16 RCA; unsigned COM_CRC_ERROR :1; unsigned ILLEGAL_COMMAND :1; unsigned ERROR :1; unsigned CURRENT_STATE :4; unsigned READY_FOR_DATA :1; //unsigned Reserved3 :2; //copied from CSR unsigned APP_CMD :1; //unsigned Reserved4 :1; unsigned AKE_SEQ_ERROR :1; //unsigned Reserved5 :1; //unsigned Reserved6 :2; } rca; typedef uint16 dsr; // DriverStageRegister is optional typedef struct CardSpecificData { SdCardCapacity capacity; unsigned CSD_STRUCTURE :2; //unsigned Reserved1 :6; uint8 TAAC; uint8 NSAC; uint8 TRAN_SPEED; unsigned CCC :12; unsigned READ_BL_LEN :4; unsigned READ_BL_PARTIAL :1; unsigned WRITE_BLK_MISALIGN :1; unsigned READ_BLK_MISALIGN :1; unsigned DSR_IMP :1; unsigned C_SIZE :22; // hack: ver1 cards C_SIZE is 12-bits unsigned VDD_R_CURR_MIN :3; // hack: available on ver1 cards only unsigned VDD_R_CURR_MAX :3; // hack: available on ver1 cards only unsigned VDD_W_CURR_MIN :3; // hack: available on ver1 cards only unsigned VDD_W_CURR_MAX :3; // hack: available on ver1 cards only unsigned C_SIZE_MULT :3; // hack: available on ver1 cards only unsigned ERASE_BLK_EN :1; unsigned SECTOR_SIZE :7; unsigned WP_GRP_SIZE :7; unsigned WP_GRP_ENABLE :1; unsigned R2W_FACTOR :3; unsigned WRITE_BL_LEN :4; unsigned WRITE_BL_PARTIAL :1; unsigned FILE_FORMAT_GRP :1; unsigned COPY :1; unsigned PERM_WRITE_PROTECT :1; unsigned TMP_WRITE_PROTECT :1; unsigned FILE_FORMAT :2; unsigned CRC :7; //unsigned Always1 :1; } csd; typedef struct SdConfigurationRegister { //MSBit first /* value 0 is for physical layer spec 1.01-3.01 */ unsigned SCR_STRUCTURE :4; /* SD Memory Card - Spec. Version */ unsigned SD_SPEC :4; /* The data status is card vendor dependent */ unsigned DATA_STAT_AFTER_ERASE :1; /* CPRM Security Specification Version */ unsigned SD_SECURITY :3; /* DAT bus widths that are supported by the card */ unsigned SD_BUS_WIDTHS :4; /* Spec. Version 3.00 or higher */ unsigned SD_SPEC3 :1; /* Extended Security support */ unsigned EX_SECURITY :4; //unsigned Reserved1 :9; /* new command support for newer cards */ unsigned CMD_SUPPORT :2; //uint32 Reserved2; // Reserved for manufacturer } scr; /* * Response Structures */ typedef struct CardStatusResponse { //MSBit first unsigned OUT_OF_RANGE :1; unsigned ADDRESS_ERROR :1; unsigned BLOCK_LEN_ERROR :1; unsigned ERASE_SEQ_ERROR :1; unsigned ERASE_PARAM :1; unsigned WP_VIOLATION :1; unsigned CARD_IS_LOCKED :1; unsigned LOCK_UNLOCK_FAILED :1; unsigned COM_CRC_ERROR :1; unsigned ILLEGAL_COMMAND :1; unsigned CARD_ECC_FAILED :1; unsigned CC_ERROR :1; unsigned ERROR :1; //unsigned Reserved1 :1; //unsigned Reserved2 :1; //DEFERRED_RESPONSE unsigned CSD_OVERWRITE :1; unsigned WP_ERASE_SKIP :1; unsigned CARD_ECC_DISABLED :1; unsigned ERASE_RESET :1; unsigned CURRENT_STATE :4; unsigned READY_FOR_DATA :1; //unsigned Reserved3 :2; unsigned APP_CMD :1; //unsigned Reserved4 :1; unsigned AKE_SEQ_ERROR :1; //unsigned Reserved5 :1; //unsigned Reserved6 :2; } csr; typedef struct SdStatusResponse { //MSBit first for Wide Width Data unsigned DAT_BUS_WIDTH :2; unsigned SECURED_MODE :1; //Reserved1 :7; //Reserved for Security Functions //Reserved2 :6; uint16 SD_CARD_TYPE; uint32 SIZE_OF_PROTECTED_AREA; uint8 SPEED_CLASS; uint8 PERFORMANCE_MOVE; unsigned AU_SIZE :4; //unsigned Reserved3 :4; uint16 ERASE_SIZE; unsigned ERASE_TIMEOUT :6; unsigned ERASE_OFFSET :2; unsigned UHS_SPEED_GRADE :4; unsigned UHS_AU_SIZE :4; //uint8 Reserved4[10]; //uint8 Reserved5[39]; //Reserved for Manufacturer } ssr; /* SDIO Card Structures, TBD //CardCommonControlRegister typedef struct CardCommonControlRegister {} cccr; //FunctionBasicRegister typedef struct FunctionBasicRegister {} fbr; //CardInformationStructure typedef struct CardInformationStructure {} cis; /CodeStorageArea typedef struct CodeStorageArea {} csa; */ class HardwareSDIO { public: icr ICR; ocr OCR; cid CID; csd CSD; rca RCA; scr SCR; ssr SSR; dsr DSR; // Default is 0x0404 csr CSR; SDAppCommand appCmd; SDIOClockFrequency clkFreq; SDIOBlockSize blkSize; HardwareSDIO(void); /*----------------------------------------------------- public functions */ void begin(SDIOClockFrequency); void begin(void); void end(void); //void read(uint32, uint32*); void read(uint32, uint32*, uint32); //void write(uint32, uint32*); void write(uint32, uint32*, uint32); //protected: /*--------------------------------------- card register access functions */ void getICR(uint32); void getOCR(uint32); void newRCA(void); void getCID(void); void getCSD(void); void setDSR(void); void getSCR(void); void getSSR(void); void getCSR(void); /*----------------------------------------- card register save functions */ void convert(ocr*); void convert(csr*, uint32); void convert(csd*); void convert(cid*); void convert(rca*); /*------------------------------------------------ convenience functions */ void idle(void); void initialization(void); void clockFreq(SDIOClockFrequency); void busMode(SDIOBusMode); void blockSize(SDIOBlockSize); void select(uint16); void select(void); void deselect(void); /*------------------------------------------------- basic data functions */ void stop(void); void readBlock(uint32, uint32*); void writeBlock(uint32, uint32*); //private: /*---------------------------------------------------- command functions */ void command(SDCommand, uint32); void command(SDAppCommand, uint32); void response(SDCommand); void response(SDAppCommand); }; #endif
34.742317
79
0.599483
6d21b982b4c26d033bec785b98e00ad4389ab4e8
151
h
C
project859/src/component1074/headers/component1074/lib5.h
gradle/perf-native-large
af00fd258fbe9c7d274f386e46847fe12062cc71
[ "Apache-2.0" ]
2
2016-11-23T17:25:24.000Z
2016-11-23T17:25:27.000Z
project859/src/component1074/headers/component1074/lib5.h
gradle/perf-native-large
af00fd258fbe9c7d274f386e46847fe12062cc71
[ "Apache-2.0" ]
15
2016-09-15T03:19:32.000Z
2016-09-17T09:15:32.000Z
project859/src/component1074/headers/component1074/lib5.h
gradle/perf-native-large
af00fd258fbe9c7d274f386e46847fe12062cc71
[ "Apache-2.0" ]
2
2019-11-09T16:26:55.000Z
2021-01-13T10:51:09.000Z
#ifndef PROJECT_HEADER_component1074_5_H #define PROJECT_HEADER_component1074_5_H int component1074_5(); #endif // PROJECT_HEADER_component1074_5_H
18.875
42
0.86755
922e5aa34761dc9c4098de6c0c8b7e275edcce23
358
h
C
FSCalendarDemo/FSCalendarDemo/FSCalendar/FSCalendarDayModel.h
coderYB/FSCalendarDemo
decbf2d04a49e1c8cfd34b9ff86c91c07563aa74
[ "MIT" ]
41
2019-05-18T03:39:02.000Z
2021-11-05T10:23:47.000Z
FSCalendarDemo/FSCalendarDemo/FSCalendar/FSCalendarDayModel.h
coderYB/FSCalendarDemo
decbf2d04a49e1c8cfd34b9ff86c91c07563aa74
[ "MIT" ]
1
2020-08-02T03:13:15.000Z
2020-08-02T03:13:15.000Z
FSCalendarDemo/FSCalendarDemo/FSCalendar/FSCalendarDayModel.h
coderYB/FSCalendarDemo
decbf2d04a49e1c8cfd34b9ff86c91c07563aa74
[ "MIT" ]
7
2019-05-20T08:20:45.000Z
2022-01-17T06:48:59.000Z
// // FSCalendarDayModel.h // Test // // Created by 樊盛 on 2019/4/30. // Copyright © 2019年 樊盛. All rights reserved. // 每一天对应的model #import <Foundation/Foundation.h> @interface FSCalendarDayModel : NSObject /** 阳历日期 */ @property (nonatomic, strong) NSString *solarDateString; /** 农历日期 */ @property (nonatomic, strong) NSString *lunarDateString; @end
17.9
56
0.703911
f3c31c66eb55aaee44b7651857a3aa411a3f554b
333
c
C
tests/unitTests/nestedLoop.c
daejunpark/c-semantics
e3fd72bdb8cece8279dbffb86feecdb76e0990e2
[ "MIT" ]
1
2016-08-10T15:41:53.000Z
2016-08-10T15:41:53.000Z
tests/unitTests/nestedLoop.c
daejunpark/c-semantics
e3fd72bdb8cece8279dbffb86feecdb76e0990e2
[ "MIT" ]
null
null
null
tests/unitTests/nestedLoop.c
daejunpark/c-semantics
e3fd72bdb8cece8279dbffb86feecdb76e0990e2
[ "MIT" ]
1
2021-07-31T21:55:35.000Z
2021-07-31T21:55:35.000Z
#include <stdio.h> int sec26(void){ int y1[4][3] = { {1, 3, 5}, {2, 4, 6}, {3, 5, 7}, }; for (int i = 0; i < 4; i = i + 1){ for (int j = 0; j < 3; j = j + 1){ printf("(i, j)=(%d, %d)", i, j); if (y1[i][j] != y1[i][j]) { return 1; } } } return 0; } int main(void){ if (sec26()) {return 26;} return 0; }
14.478261
36
0.408408
1a9de29492e7bc9b1d860a64fe757028a9a3b828
2,760
h
C
core/module_interface.h
lebedyanka/refactoring
aac80aee26c6f4f49bb7552da49bae1abdef30b1
[ "MIT" ]
null
null
null
core/module_interface.h
lebedyanka/refactoring
aac80aee26c6f4f49bb7552da49bae1abdef30b1
[ "MIT" ]
null
null
null
core/module_interface.h
lebedyanka/refactoring
aac80aee26c6f4f49bb7552da49bae1abdef30b1
[ "MIT" ]
null
null
null
#ifndef PROWOGENE_CORE_MODULE_INTERFACE_H_ #define PROWOGENE_CORE_MODULE_INTERFACE_H_ #include <list> #include <string> #include "settings_interface.h" #include "storage.h" namespace prowogene { /** @brief Module interface which describes separate step of generation. Allows to integrate module to generator. Also contains a few usefull methods for work with settings and data from storage. */ class IModule { public: /** Initialize own module values. */ virtual void Init() {}; /** Deinitialize own module values. */ virtual void Deinit() {}; /** Attach needed data from storage. @param [in] storage - Instance that has access to neeeded data. */ virtual void SetStorage(Storage* storage) = 0; /** Launch generation step @return @c true is step completed successfully, @c false when errors occurs during processing. */ virtual bool Process() = 0; /** Get needed data keys of data which be attached from storage. @return List of data keys. */ virtual std::list<std::string> GetNeededData() const = 0; /** Get needed settings keys that need to be attached. @return List of settings keys. */ virtual std::list<std::string> GetNeededSettings() const = 0; /** Fill single settings entity if settings with it's key is required. */ virtual void ApplySettings(ISettings* settings) { }; /** Get module's name. @return Name of module. */ virtual std::string GetName() const = 0; /** Get text of module's status. @return Status text. */ virtual std::string GetStatus() const { return status_; } protected: /** Copy settings from source to destination if source's key is equal to given. @param [in] src - Source of copying settings entity. @param [out] dst - Destination of copying settings entity. Must be derived from ISettings. */ template<typename T> static void CopySettings(const ISettings* src, T& dst) { if (src) { if (src->GetName() == dst.GetName()) { T* casted = (T*)(src); dst = *casted; } } } /** Add pointer to transferable data to local storage. @param [out] dst - Destination of copying data pointer. @param [in] storage - Instance that has access to neeeded data. @param [in] key - Transferable data key. */ template<typename T> static void LinkData(T*& dst, Storage* s, const std::string& key) { dst = s->GetData<T>(key); } /** Status text. */ std::string status_ = "Success."; }; } // namespace prowogene #endif // PROWOGENE_CORE_MODULE_INTERFACE_H_
31.363636
79
0.625362
1a59bdf5123f8e0ae2c4f6a859807f90eab4083e
358
h
C
booster/booster/shared_ptr.h
gatehouse/cppcms
61da055ffeb349b4eda14bc9ac393af9ce842364
[ "MIT" ]
null
null
null
booster/booster/shared_ptr.h
gatehouse/cppcms
61da055ffeb349b4eda14bc9ac393af9ce842364
[ "MIT" ]
null
null
null
booster/booster/shared_ptr.h
gatehouse/cppcms
61da055ffeb349b4eda14bc9ac393af9ce842364
[ "MIT" ]
null
null
null
#ifndef BOOSTER_SMART_PTR_SHARED_PTR_HPP_INCLUDED #define BOOSTER_SMART_PTR_SHARED_PTR_HPP_INCLUDED #include <memory> namespace booster { template <typename T> using shared_ptr = std::shared_ptr<T>; using std::dynamic_pointer_cast; using std::static_pointer_cast; } // namespace booster #endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
18.842105
58
0.810056
a21ea9695f5344ea40d0d9d02f3c42f4f9b568eb
863
h
C
noko/src/jvmMain/cpp/util/log.h
linroid/noko
fb0d2b16cb7d4b089508a383c3fe6c13e03ef6f0
[ "Apache-2.0" ]
7
2022-03-08T03:36:16.000Z
2022-03-19T02:35:49.000Z
noko/src/jvmMain/cpp/util/log.h
linroid/noko
fb0d2b16cb7d4b089508a383c3fe6c13e03ef6f0
[ "Apache-2.0" ]
null
null
null
noko/src/jvmMain/cpp/util/log.h
linroid/noko
fb0d2b16cb7d4b089508a383c3fe6c13e03ef6f0
[ "Apache-2.0" ]
null
null
null
#ifndef NOKO_JS_LOG_H #define NOKO_JS_LOG_H #ifdef __ANDROID__ #include "android/log.h" #define LOG_TAG "Node" #define LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__) #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__) #define LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__) #define LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__) #else #include "stdio.h" #define LOGV(...) printf(__VA_ARGS__); printf("\n") #define LOGD(...) printf(__VA_ARGS__); printf("\n") #define LOGI(...) printf(__VA_ARGS__); printf("\n") #define LOGW(...) fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n") #define LOGE(...) fprintf(stderr, __VA_ARGS__); fprintf(stderr, "\n") #endif #endif //NOKO_JS_LOG_H
33.192308
80
0.74971
9aecb36f1b087a95d89093917822265ecc1895c9
30,681
c
C
src/core/stream_recv.c
majacQ/msquic
93421037862a5e72ce6e2508d1322e990862ebb0
[ "MIT" ]
null
null
null
src/core/stream_recv.c
majacQ/msquic
93421037862a5e72ce6e2508d1322e990862ebb0
[ "MIT" ]
null
null
null
src/core/stream_recv.c
majacQ/msquic
93421037862a5e72ce6e2508d1322e990862ebb0
[ "MIT" ]
null
null
null
/*++ Copyright (c) Microsoft Corporation. Licensed under the MIT License. Abstract: A stream manages the send and receive queues for application data. This file contains the receive specific logic for the stream. --*/ #include "precomp.h" #ifdef QUIC_CLOG #include "stream_recv.c.clog.h" #endif _IRQL_requires_max_(PASSIVE_LEVEL) BOOLEAN QuicStreamReceiveComplete( _In_ QUIC_STREAM* Stream, _In_ uint64_t BufferLength ); _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamRecvShutdown( _In_ QUIC_STREAM* Stream, _In_ BOOLEAN Silent, _In_ QUIC_VAR_INT ErrorCode ) { if (Silent) { // // If we are silently closing, implicitly consider the remote stream as // closed and acknowledged as such. // Stream->Flags.SentStopSending = TRUE; Stream->Flags.RemoteCloseAcked = TRUE; Stream->Flags.ReceiveEnabled = FALSE; Stream->Flags.ReceiveDataPending = FALSE; Stream->Flags.ReceiveCallPending = FALSE; goto Exit; } if (Stream->Flags.RemoteCloseAcked || Stream->Flags.RemoteCloseFin || Stream->Flags.RemoteCloseReset) { // // The peer already closed (graceful or abortive). Nothing else to be // done. // goto Exit; } // // Disable all future receive events. // Stream->Flags.ReceiveEnabled = FALSE; Stream->Flags.ReceiveDataPending = FALSE; Stream->Flags.ReceiveCallPending = FALSE; if (Stream->RecvMaxLength != UINT64_MAX) { // // The peer has already gracefully closed, but we just haven't drained // the receives to that point. Ignore this abort from the app and jump // right to the closed state. // Stream->Flags.RemoteCloseFin = TRUE; Stream->Flags.RemoteCloseAcked = TRUE; Silent = TRUE; // To indicate we try to shutdown complete. goto Exit; } Stream->SendCloseErrorCode = ErrorCode; Stream->Flags.SentStopSending = TRUE; // // Queue up a stop sending frame to be sent. // QuicSendSetStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_RECV_ABORT, FALSE); // // Remove any flags we shouldn't be sending now the receive direction is // closed. // QuicSendClearStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_MAX_DATA); Exit: QuicTraceEvent( StreamRecvState, "[strm][%p] Recv State: %hhu", Stream, QuicStreamRecvGetState(Stream)); if (Silent) { QuicStreamTryCompleteShutdown(Stream); } } _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamRecvQueueFlush( _In_ QUIC_STREAM* Stream ) { // // The caller has indicated data is ready to be indicated to the // application. Queue a FLUSH_RECV if one isn't already queued. // if (Stream->Flags.ReceiveEnabled && Stream->Flags.ReceiveDataPending && !Stream->Flags.ReceiveCallPending && !Stream->Flags.ReceiveFlushQueued) { QuicTraceLogStreamVerbose( QueueRecvFlush, Stream, "Queuing recv flush"); QUIC_OPERATION* Oper; if ((Oper = QuicOperationAlloc(Stream->Connection->Worker, QUIC_OPER_TYPE_FLUSH_STREAM_RECV)) != NULL) { Oper->FLUSH_STREAM_RECEIVE.Stream = Stream; QuicStreamAddRef(Stream, QUIC_STREAM_REF_OPERATION); QuicConnQueueOper(Stream->Connection, Oper); Stream->Flags.ReceiveFlushQueued = TRUE; } else { QuicTraceEvent( AllocFailure, "Allocation of '%s' failed. (%llu bytes)", "Flush Stream Recv operation", 0); } } } // // Processes a received RESET_STREAM frame's payload. // _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamProcessResetFrame( _In_ QUIC_STREAM* Stream, _In_ uint64_t FinalSize, _In_ QUIC_VAR_INT ErrorCode ) { // // Make sure the stream is remotely closed if not already. // Stream->Flags.RemoteCloseReset = TRUE; if (!Stream->Flags.RemoteCloseAcked) { Stream->Flags.RemoteCloseAcked = TRUE; Stream->Flags.ReceiveEnabled = FALSE; Stream->Flags.ReceiveDataPending = FALSE; uint64_t TotalRecvLength = QuicRecvBufferGetTotalLength(&Stream->RecvBuffer); if (TotalRecvLength > FinalSize) { // // The peer indicated a final offset less than what they have // already sent to us. Kill the connection. // QuicTraceLogStreamWarning( ResetEarly, Stream, "Tried to reset at earlier final size!"); QuicConnTransportError(Stream->Connection, QUIC_ERROR_FINAL_SIZE_ERROR); return; } if (TotalRecvLength < FinalSize) { // // The final offset is indicating that more data was sent than we // have actually received. Make sure to update our flow control // accounting so we stay in sync with the peer. // uint64_t FlowControlIncrease = FinalSize - TotalRecvLength; Stream->Connection->Send.OrderedStreamBytesReceived += FlowControlIncrease; if (Stream->Connection->Send.OrderedStreamBytesReceived < FlowControlIncrease || Stream->Connection->Send.OrderedStreamBytesReceived > Stream->Connection->Send.MaxData) { // // The peer indicated a final offset more than allowed. Kill the // connection. // QuicTraceLogStreamWarning( ResetTooBig, Stream, "Tried to reset with too big final size!"); QuicConnTransportError(Stream->Connection, QUIC_ERROR_FINAL_SIZE_ERROR); return; } } QuicTraceEvent( StreamRecvState, "[strm][%p] Recv State: %hhu", Stream, QuicStreamRecvGetState(Stream)); if (!Stream->Flags.SentStopSending) { QuicTraceLogStreamInfo( RemoteCloseReset, Stream, "Closed remotely (reset)"); QUIC_STREAM_EVENT Event; Event.Type = QUIC_STREAM_EVENT_PEER_SEND_ABORTED; Event.PEER_SEND_ABORTED.ErrorCode = ErrorCode; QuicTraceLogStreamVerbose( IndicatePeerSendAbort, Stream, "Indicating QUIC_STREAM_EVENT_PEER_SEND_ABORTED (0x%llX)", ErrorCode); (void)QuicStreamIndicateEvent(Stream, &Event); } // // Remove any flags we shouldn't be sending now that the receive // direction is closed. // QuicSendClearStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_MAX_DATA | QUIC_STREAM_SEND_FLAG_RECV_ABORT); QuicStreamTryCompleteShutdown(Stream); } } // // Processes a received STOP_SENDING frame's payload. // _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamProcessStopSendingFrame( _In_ QUIC_STREAM* Stream, _In_ QUIC_VAR_INT ErrorCode ) { if (!Stream->Flags.LocalCloseAcked && !Stream->Flags.LocalCloseReset) { // // The STOP_SENDING frame only triggers a state change if we aren't // completely closed gracefully (i.e. our close has been acknowledged) // or if we have already been reset (abortive closure). // QuicTraceLogStreamInfo( LocalCloseStopSending, Stream, "Closed locally (stop sending)"); Stream->Flags.ReceivedStopSending = TRUE; QUIC_STREAM_EVENT Event; Event.Type = QUIC_STREAM_EVENT_PEER_RECEIVE_ABORTED; Event.PEER_RECEIVE_ABORTED.ErrorCode = ErrorCode; QuicTraceLogStreamVerbose( IndicatePeerReceiveAborted, Stream, "Indicating QUIC_STREAM_EVENT_PEER_RECEIVE_ABORTED (0x%llX)", ErrorCode); (void)QuicStreamIndicateEvent(Stream, &Event); // // The peer has requested that we stop sending. Close abortively. // QuicStreamSendShutdown( Stream, FALSE, FALSE, FALSE, QUIC_ERROR_NO_ERROR); } } // // Processes a STREAM frame. // _IRQL_requires_max_(PASSIVE_LEVEL) QUIC_STATUS QuicStreamProcessStreamFrame( _In_ QUIC_STREAM* Stream, _In_ BOOLEAN EncryptedWith0Rtt, _In_ const QUIC_STREAM_EX* Frame ) { QUIC_STATUS Status; BOOLEAN ReadyToDeliver = FALSE; uint64_t EndOffset = Frame->Offset + Frame->Length; if (Stream->Flags.RemoteNotAllowed) { QuicTraceEvent( StreamError, "[strm][%p] ERROR, %s.", Stream, "Receive on unidirectional stream"); Status = QUIC_STATUS_INVALID_STATE; goto Error; } if (Stream->Flags.RemoteCloseFin || Stream->Flags.RemoteCloseReset || Stream->Flags.SentStopSending) { // // Ignore the data if we are already closed remotely. Likely means we received // a copy of already processed data that was resent. // QuicTraceLogStreamVerbose( IgnoreRecvAfterClose, Stream, "Ignoring recv after close"); Status = QUIC_STATUS_SUCCESS; goto Error; } if (Frame->Fin && Stream->RecvMaxLength != UINT64_MAX && EndOffset != Stream->RecvMaxLength) { // // FIN disagrees with previous FIN. // Status = QUIC_STATUS_INVALID_PARAMETER; goto Error; } if (EndOffset > Stream->RecvMaxLength) { // // Frame goes past the FIN. // Status = QUIC_STATUS_INVALID_PARAMETER; goto Error; } if (EndOffset > QUIC_VAR_INT_MAX) { // // Stream data cannot exceed VAR_INT_MAX because it's impossible // to provide flow control credit for that data. // QuicConnTransportError(Stream->Connection, QUIC_ERROR_FLOW_CONTROL_ERROR); Status = QUIC_STATUS_INVALID_PARAMETER; goto Error; } if (Frame->Length == 0) { Status = QUIC_STATUS_SUCCESS; } else { // // This is initialized to inform QuicRecvBufferWrite of the // max number of allowed bytes per connection flow control. // On return from QuicRecvBufferWrite, this represents the // actual number of bytes written. // uint64_t WriteLength = Stream->Connection->Send.MaxData - Stream->Connection->Send.OrderedStreamBytesReceived; // // Write any nonduplicate data to the receive buffer. // QuicRecvBufferWrite will indicate if there is data to deliver. // Status = QuicRecvBufferWrite( &Stream->RecvBuffer, Frame->Offset, (uint16_t)Frame->Length, Frame->Data, &WriteLength, &ReadyToDeliver); if (QUIC_FAILED(Status)) { goto Error; } // // Keep track of the total ordered bytes received. // Stream->Connection->Send.OrderedStreamBytesReceived += WriteLength; CXPLAT_DBG_ASSERT(Stream->Connection->Send.OrderedStreamBytesReceived < Stream->Connection->Send.MaxData); CXPLAT_DBG_ASSERT(Stream->Connection->Send.OrderedStreamBytesReceived >= WriteLength); if (QuicRecvBufferGetTotalLength(&Stream->RecvBuffer) == Stream->MaxAllowedRecvOffset) { QuicTraceLogStreamVerbose( FlowControlExhausted, Stream, "Flow control window exhausted!"); } if (EncryptedWith0Rtt) { // // Keep track of the maximum length of the 0-RTT payload so that we // can indicate that appropriately to the API client. // if (EndOffset > Stream->RecvMax0RttLength) { Stream->RecvMax0RttLength = EndOffset; } } Stream->Connection->Stats.Recv.TotalStreamBytes += Frame->Length; } if (Frame->Fin) { Stream->RecvMaxLength = EndOffset; if (Stream->RecvBuffer.BaseOffset == Stream->RecvMaxLength) { // // All data delivered. Deliver the FIN. // ReadyToDeliver = TRUE; } } if (ReadyToDeliver) { Stream->Flags.ReceiveDataPending = TRUE; QuicStreamRecvQueueFlush(Stream); } QuicTraceLogStreamVerbose( Receive, Stream, "Received %hu bytes, offset=%llu Ready=%hhu", (uint16_t)Frame->Length, Frame->Offset, ReadyToDeliver); Error: if (Status == QUIC_STATUS_INVALID_PARAMETER) { QuicTraceLogStreamWarning( ReceiveTooBig, Stream, "Tried to write beyond end of buffer!"); QuicConnTransportError(Stream->Connection, QUIC_ERROR_FINAL_SIZE_ERROR); } else if (Status == QUIC_STATUS_BUFFER_TOO_SMALL) { QuicTraceLogStreamWarning( ReceiveBeyondFlowControl, Stream, "Tried to write beyond flow control limit!"); QuicConnTransportError(Stream->Connection, QUIC_ERROR_FLOW_CONTROL_ERROR); } return Status; } _IRQL_requires_max_(PASSIVE_LEVEL) QUIC_STATUS QuicStreamRecv( _In_ QUIC_STREAM* Stream, _In_ BOOLEAN EncryptedWith0Rtt, _In_ QUIC_FRAME_TYPE FrameType, _In_ uint16_t BufferLength, _In_reads_bytes_(BufferLength) const uint8_t * const Buffer, _Inout_ uint16_t* Offset, _Inout_ BOOLEAN* UpdatedFlowControl ) { QUIC_STATUS Status = QUIC_STATUS_SUCCESS; switch (FrameType) { case QUIC_FRAME_RESET_STREAM: { QUIC_RESET_STREAM_EX Frame; if (!QuicResetStreamFrameDecode(BufferLength, Buffer, Offset, &Frame)) { return QUIC_STATUS_INVALID_PARAMETER; } QuicStreamProcessResetFrame( Stream, Frame.FinalSize, Frame.ErrorCode); break; } case QUIC_FRAME_STOP_SENDING: { QUIC_STOP_SENDING_EX Frame; if (!QuicStopSendingFrameDecode(BufferLength, Buffer, Offset, &Frame)) { return QUIC_STATUS_INVALID_PARAMETER; } QuicStreamProcessStopSendingFrame( Stream, Frame.ErrorCode); break; } case QUIC_FRAME_MAX_STREAM_DATA: { QUIC_MAX_STREAM_DATA_EX Frame; if (!QuicMaxStreamDataFrameDecode(BufferLength, Buffer, Offset, &Frame)) { return QUIC_STATUS_INVALID_PARAMETER; } if (Stream->MaxAllowedSendOffset < Frame.MaximumData) { Stream->MaxAllowedSendOffset = Frame.MaximumData; *UpdatedFlowControl = TRUE; // // NB: If there are ACK frames that advance UnAckedOffset after this // MAX_STREAM_DATA frame in the current packet, then SendWindow will // overestimate the peer's flow control window. If the peer is // MSQUIC, this problem will not occur because ACK frames always // come first. Other implementations will probably do the same. // This potential problem could be fixed by moving the SendWindow // update to the end of packet processing, but that would require // tracking the set of streams for which the packet advanced // MAX_STREAM_DATA. // Stream->SendWindow = (uint32_t)min(Stream->MaxAllowedSendOffset - Stream->UnAckedOffset, UINT32_MAX); QuicSendBufferStreamAdjust(Stream); // // The peer has given us more allowance. In case the stream was // queued and blocked, schedule a send flush. // QuicStreamRemoveOutFlowBlockedReason( Stream, QUIC_FLOW_BLOCKED_STREAM_FLOW_CONTROL); QuicSendClearStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_DATA_BLOCKED); QuicStreamSendDumpState(Stream); QuicSendQueueFlush( &Stream->Connection->Send, REASON_STREAM_FLOW_CONTROL); } break; } case QUIC_FRAME_STREAM_DATA_BLOCKED: { QUIC_STREAM_DATA_BLOCKED_EX Frame; if (!QuicStreamDataBlockedFrameDecode(BufferLength, Buffer, Offset, &Frame)) { return QUIC_STATUS_INVALID_PARAMETER; } QuicTraceLogStreamVerbose( RemoteBlocked, Stream, "Remote FC blocked (%llu)", Frame.StreamDataLimit); QuicSendSetStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_MAX_DATA, FALSE); break; } default: // QUIC_FRAME_STREAM* { QUIC_STREAM_EX Frame; if (!QuicStreamFrameDecode(FrameType, BufferLength, Buffer, Offset, &Frame)) { return QUIC_STATUS_INVALID_PARAMETER; } Status = QuicStreamProcessStreamFrame( Stream, EncryptedWith0Rtt, &Frame); break; } } return Status; } // // Generally, every time bytes are delivered to the application we update our max // data (stream and connection) values and queue an update to be sent to the // peer. It is done every time, because nearly always an ACK frame is also // ready to be sent out, so we might as well take advantage of that packet to // send this data as well. If we don't have an ACK ready to be sent out // immediately then we only update the values if we have reached the drain // limit. // _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamOnBytesDelivered( _In_ QUIC_STREAM* Stream, _In_ uint64_t BytesDelivered ) { const uint64_t RecvBufferDrainThreshold = Stream->RecvBuffer.VirtualBufferLength / QUIC_RECV_BUFFER_DRAIN_RATIO; Stream->RecvWindowBytesDelivered += BytesDelivered; Stream->Connection->Send.MaxData += BytesDelivered; if (Stream->RecvWindowBytesDelivered >= RecvBufferDrainThreshold) { uint32_t TimeNow = CxPlatTimeUs32(); // // Limit stream FC window growth by the connection FC window size. // if (Stream->RecvBuffer.VirtualBufferLength < Stream->Connection->Settings.ConnFlowControlWindow) { uint32_t TimeThreshold = (uint32_t) ((Stream->RecvWindowBytesDelivered * Stream->Connection->Paths[0].SmoothedRtt) / RecvBufferDrainThreshold); if (CxPlatTimeDiff32(Stream->RecvWindowLastUpdate, TimeNow) <= TimeThreshold) { // // Buffer tuning: // // VirtualBufferLength limits the connection's throughput to: // R = VirtualBufferLength / RTT // // We've delivered data at an average rate of at least: // R / QUIC_RECV_BUFFER_DRAIN_RATIO // // Double VirtualBufferLength to make sure it doesn't limit // throughput. // // Mainly people complain about flow control when it limits // throughput. But if we grow the buffer limit and then the app // stops receiving data, bytes will pile up in the buffer. We could // add logic to shrink the buffer when the app absorb rate is too // low. // QuicTraceLogStreamVerbose( IncreaseRxBuffer, Stream, "Increasing max RX buffer size to %u (MinRtt=%u; TimeNow=%u; LastUpdate=%u)", Stream->RecvBuffer.VirtualBufferLength * 2, Stream->Connection->Paths[0].MinRtt, TimeNow, Stream->RecvWindowLastUpdate); QuicRecvBufferSetVirtualBufferLength( &Stream->RecvBuffer, Stream->RecvBuffer.VirtualBufferLength * 2); } } Stream->RecvWindowLastUpdate = TimeNow; Stream->RecvWindowBytesDelivered = 0; } else if (!(Stream->Connection->Send.SendFlags & QUIC_CONN_SEND_FLAG_ACK)) { // // We haven't hit the drain limit AND we don't have any ACKs to send // immediately, so we don't need to immediately update the max data // values. // return; } // // Advance MaxAllowedRecvOffset. // QuicTraceLogStreamVerbose( UpdateFlowControl, Stream, "Updating flow control window"); CXPLAT_DBG_ASSERT( Stream->RecvBuffer.BaseOffset + Stream->RecvBuffer.VirtualBufferLength > Stream->MaxAllowedRecvOffset); Stream->MaxAllowedRecvOffset = Stream->RecvBuffer.BaseOffset + Stream->RecvBuffer.VirtualBufferLength; QuicSendSetSendFlag( &Stream->Connection->Send, QUIC_CONN_SEND_FLAG_MAX_DATA); QuicSendSetStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_MAX_DATA, FALSE); } _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamRecvFlush( _In_ QUIC_STREAM* Stream ) { Stream->Flags.ReceiveFlushQueued = FALSE; if (!Stream->Flags.ReceiveEnabled) { QuicTraceLogStreamVerbose( IgnoreRecvFlush, Stream, "Ignoring recv flush (recv disabled)"); return; } CXPLAT_TEL_ASSERT(Stream->Flags.ReceiveDataPending); CXPLAT_TEL_ASSERT(!Stream->Flags.ReceiveCallPending); BOOLEAN FlushRecv = TRUE; while (FlushRecv) { CXPLAT_DBG_ASSERT(!Stream->Flags.SentStopSending); QUIC_BUFFER RecvBuffers[2]; QUIC_STREAM_EVENT Event = {0}; Event.Type = QUIC_STREAM_EVENT_RECEIVE; Event.RECEIVE.BufferCount = 2; Event.RECEIVE.Buffers = RecvBuffers; // // Try to read the next available buffers. // BOOLEAN DataAvailable = QuicRecvBufferRead( &Stream->RecvBuffer, &Event.RECEIVE.AbsoluteOffset, &Event.RECEIVE.BufferCount, RecvBuffers); if (DataAvailable) { for (uint32_t i = 0; i < Event.RECEIVE.BufferCount; ++i) { Event.RECEIVE.TotalBufferLength += RecvBuffers[i].Length; } CXPLAT_DBG_ASSERT(Event.RECEIVE.TotalBufferLength != 0); if (Event.RECEIVE.AbsoluteOffset < Stream->RecvMax0RttLength) { // // This data includes data encrypted with 0-RTT key. // Event.RECEIVE.Flags |= QUIC_RECEIVE_FLAG_0_RTT; // // TODO - Split mixed 0-RTT and 1-RTT data? // } if (Event.RECEIVE.AbsoluteOffset + Event.RECEIVE.TotalBufferLength == Stream->RecvMaxLength) { // // This data goes all the way to the FIN. // Event.RECEIVE.Flags |= QUIC_RECEIVE_FLAG_FIN; } } else { // // FIN only case. // Event.RECEIVE.AbsoluteOffset = Stream->RecvMaxLength; Event.RECEIVE.BufferCount = 0; Event.RECEIVE.Flags |= QUIC_RECEIVE_FLAG_FIN; // TODO - 0-RTT flag? } Stream->Flags.ReceiveEnabled = FALSE; Stream->Flags.ReceiveCallPending = TRUE; Stream->RecvPendingLength = Event.RECEIVE.TotalBufferLength; QuicTraceLogStreamVerbose( IndicateReceive, Stream, "Indicating QUIC_STREAM_EVENT_RECEIVE [%llu bytes, %u buffers, 0x%x flags]", Event.RECEIVE.TotalBufferLength, Event.RECEIVE.BufferCount, Event.RECEIVE.Flags); QUIC_STATUS Status = QuicStreamIndicateEvent(Stream, &Event); if (Stream->Flags.SentStopSending || Stream->Flags.RemoteCloseFin) { // // The app has aborted their receive path. No need to process any // more. // break; } if (Status == QUIC_STATUS_PENDING) { if (Stream->Flags.ReceiveCallPending) { // // If the pending call wasn't completed inline, then receive // callbacks MUST be disabled still. // CXPLAT_TEL_ASSERTMSG_ARGS( !Stream->Flags.ReceiveEnabled, "App pended recv AND enabled additional recv callbacks", Stream->Connection->Registration->AppName, 0, 0); Stream->Flags.ReceiveEnabled = FALSE; } break; } if (Status == QUIC_STATUS_CONTINUE) { CXPLAT_DBG_ASSERT(!Stream->Flags.SentStopSending); // // The app has explicitly indicated it wants to continue to // receive callbacks, even if all the data wasn't drained. // Stream->Flags.ReceiveEnabled = TRUE; } else { // // All other failure status returns are ignored and shouldn't be // used by the app. // CXPLAT_TEL_ASSERTMSG_ARGS( QUIC_SUCCEEDED(Status), "App failed recv callback", Stream->Connection->Registration->AppName, Status, 0); } CXPLAT_TEL_ASSERTMSG_ARGS( Stream->Flags.ReceiveCallPending, "App completed async recv without pending it", Stream->Connection->Registration->AppName, 0, 0); FlushRecv = QuicStreamReceiveComplete(Stream, Event.RECEIVE.TotalBufferLength); } } _IRQL_requires_max_(PASSIVE_LEVEL) void QuicStreamReceiveCompletePending( _In_ QUIC_STREAM* Stream, _In_ uint64_t BufferLength ) { if (QuicStreamReceiveComplete(Stream, BufferLength)) { QuicStreamRecvFlush(Stream); } } _IRQL_requires_max_(PASSIVE_LEVEL) BOOLEAN QuicStreamReceiveComplete( _In_ QUIC_STREAM* Stream, _In_ uint64_t BufferLength ) { if (!Stream->Flags.ReceiveCallPending) { return FALSE; } QuicPerfCounterAdd(QUIC_PERF_COUNTER_APP_RECV_BYTES, BufferLength); CXPLAT_FRE_ASSERTMSG( BufferLength <= Stream->RecvPendingLength, "App overflowed read buffer!"); Stream->Flags.ReceiveCallPending = FALSE; QuicTraceLogStreamVerbose( ReceiveComplete, Stream, "Recv complete (%llu bytes)", BufferLength); // // Reclaim any buffer space comsumed by the app. // if (Stream->RecvPendingLength == 0 || QuicRecvBufferDrain(&Stream->RecvBuffer, BufferLength)) { // // No more pending data to deliver. // Stream->Flags.ReceiveDataPending = FALSE; } if (BufferLength != 0) { QuicStreamOnBytesDelivered(Stream, BufferLength); } if (BufferLength == Stream->RecvPendingLength) { CXPLAT_DBG_ASSERT(!Stream->Flags.SentStopSending); // // All data was drained from the callback, so additional callbacks can // continue to be delivered. // Stream->Flags.ReceiveEnabled = TRUE; } if (!Stream->Flags.ReceiveEnabled) { // // The application layer can't drain any more right now. Pause the // receive callbacks until the application re-enables them. // QuicTraceEvent( StreamRecvState, "[strm][%p] Recv State: %hhu", Stream, QuicStreamRecvGetState(Stream)); return FALSE; } if (Stream->Flags.ReceiveDataPending) { // // There is still more data for the app to process and it still has // receive callbacks enabled, so do another recv flush. // return TRUE; } if (Stream->RecvBuffer.BaseOffset == Stream->RecvMaxLength) { CXPLAT_DBG_ASSERT(!Stream->Flags.ReceiveDataPending); // // We have delivered all the payload that needs to be delivered. Deliver // the graceful close event now. // Stream->Flags.RemoteCloseFin = TRUE; Stream->Flags.RemoteCloseAcked = TRUE; QuicTraceEvent( StreamRecvState, "[strm][%p] Recv State: %hhu", Stream, QuicStreamRecvGetState(Stream)); QUIC_STREAM_EVENT Event; Event.Type = QUIC_STREAM_EVENT_PEER_SEND_SHUTDOWN; QuicTraceLogStreamVerbose( IndicatePeerSendShutdown, Stream, "Indicating QUIC_STREAM_EVENT_PEER_SEND_SHUTDOWN"); (void)QuicStreamIndicateEvent(Stream, &Event); // // Now that the close event has been delivered to the app, we can shut // down the stream. // QuicStreamTryCompleteShutdown(Stream); // // Remove any flags we shouldn't be sending now that the receive // direction is closed. // QuicSendClearStreamSendFlag( &Stream->Connection->Send, Stream, QUIC_STREAM_SEND_FLAG_MAX_DATA | QUIC_STREAM_SEND_FLAG_RECV_ABORT); } return FALSE; } _IRQL_requires_max_(PASSIVE_LEVEL) QUIC_STATUS QuicStreamRecvSetEnabledState( _In_ QUIC_STREAM* Stream, _In_ BOOLEAN NewRecvEnabled ) { if (Stream->Flags.RemoteNotAllowed || Stream->Flags.RemoteCloseFin || Stream->Flags.RemoteCloseReset || Stream->Flags.SentStopSending) { return QUIC_STATUS_INVALID_STATE; } if (Stream->Flags.ReceiveEnabled != NewRecvEnabled) { CXPLAT_DBG_ASSERT(!Stream->Flags.SentStopSending); Stream->Flags.ReceiveEnabled = NewRecvEnabled; if (Stream->Flags.Started && NewRecvEnabled) { // // The application just resumed receive callbacks. Queue a // flush receive operation to start draining the receive buffer. // QuicTraceEvent( StreamRecvState, "[strm][%p] Recv State: %hhu", Stream, QuicStreamRecvGetState(Stream)); QuicStreamRecvQueueFlush(Stream); } } return QUIC_STATUS_SUCCESS; }
31.243381
123
0.601903
36de22ec18976b0a5dd9d09dade1518dd2317fe8
1,890
h
C
qmk_firmware/keyboards/afternoonlabs/oceanbreeze/rev1/rev1.h
DanTupi/personal_setup
911b4951e4d8b78d6ea8ca335229e2e970fda871
[ "MIT" ]
null
null
null
qmk_firmware/keyboards/afternoonlabs/oceanbreeze/rev1/rev1.h
DanTupi/personal_setup
911b4951e4d8b78d6ea8ca335229e2e970fda871
[ "MIT" ]
null
null
null
qmk_firmware/keyboards/afternoonlabs/oceanbreeze/rev1/rev1.h
DanTupi/personal_setup
911b4951e4d8b78d6ea8ca335229e2e970fda871
[ "MIT" ]
null
null
null
/* Copyright 2021 Afternoon Labs * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "oceanbreeze.h" #include "quantum.h" #define XXX KC_NO #define LAYOUT( \ L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, MC0, MC1, MC2, \ L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, MC3, MC4, MC5, \ L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, AUP, \ L30, L31, L32, L33, L34, L35, LT4, RT1, R30, R31, R32, R33, R34, R35, ALT, ADN, ART, \ LT0, LT1, LT2, LT3, RT2, RT3, RT4, RT5 \ ) { \ { L05, L04, L03, L02, L01, L00, XXX, XXX, XXX }, \ { L15, L14, L13, L12, L11, L10, XXX, XXX, XXX }, \ { L25, L24, L23, L22, L21, L20, XXX, XXX, XXX }, \ { L35, L34, L33, L32, L31, L30, XXX, XXX, XXX }, \ { LT3, LT2, LT1, LT0, XXX, XXX, XXX, XXX, XXX }, \ { LT4, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX }, \ { R00, R01, R02, R03, R04, R05, MC0, MC1, MC2 }, \ { R10, R11, R12, R13, R14, R15, MC3, MC4, MC5 }, \ { R20, R21, R22, R23, R24, R25, XXX, AUP, XXX }, \ { R30, R31, R32, R33, R34, R35, ALT, ADN, ART }, \ { RT2, RT3, RT4, RT5, XXX, XXX, XXX, XXX, XXX }, \ { RT1, XXX, XXX, XXX, XXX, XXX, XXX, XXX, XXX } \ }
42
94
0.587302
65fb3d49552db036aea0633dd459116c8278c562
946
h
C
ft/hb_face.h
turbolent/laf
75f29b27c661e66e1549dc6e6a172f284cd9326b
[ "MIT" ]
null
null
null
ft/hb_face.h
turbolent/laf
75f29b27c661e66e1549dc6e6a172f284cd9326b
[ "MIT" ]
null
null
null
ft/hb_face.h
turbolent/laf
75f29b27c661e66e1549dc6e6a172f284cd9326b
[ "MIT" ]
null
null
null
// LAF FreeType Wrapper // Copyright (c) 2017 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef FT_HB_FACE_H_INCLUDED #define FT_HB_FACE_H_INCLUDED #pragma once #include "base/string.h" #include "ft/face.h" #include <hb.h> #include <hb-ft.h> namespace ft { template<typename FaceFT> class HBFace : public FaceFT { public: HBFace(FT_Face face) : FaceFT(face) { m_font = (face ? hb_ft_font_create((FT_Face)face, nullptr): nullptr); m_buffer = (face ? hb_buffer_create(): nullptr); } ~HBFace() { if (m_buffer) hb_buffer_destroy(m_buffer); if (m_font) hb_font_destroy(m_font); } hb_font_t* font() const { return m_font; } hb_buffer_t* buffer() const { return m_buffer; } private: hb_buffer_t* m_buffer; hb_font_t* m_font; }; typedef HBFace<FaceFT<SimpleCache> > Face; } // namespace ft #endif
21.022222
75
0.679704
d66861a3c9cdd68b73fe7f67cc1cd085a903cb51
630
h
C
runtime/util/stringCompare.h
etaoins/llambda
a2a5c212ebb56701fa28649c377d0ddd8b67da0b
[ "Apache-2.0" ]
68
2015-01-17T10:42:00.000Z
2021-11-18T02:48:01.000Z
runtime/util/stringCompare.h
etaoins/llambda
a2a5c212ebb56701fa28649c377d0ddd8b67da0b
[ "Apache-2.0" ]
15
2015-01-05T07:59:33.000Z
2018-01-05T02:58:10.000Z
runtime/util/stringCompare.h
etaoins/llambda
a2a5c212ebb56701fa28649c377d0ddd8b67da0b
[ "Apache-2.0" ]
7
2015-04-22T06:21:47.000Z
2021-08-23T07:15:13.000Z
#ifndef _LLIBY_UTIL_STRINGCOMPARE_H #define _LLIBY_UTIL_STRINGCOMPARE_H #include "binding/StringCell.h" #include "binding/ProperList.h" using namespace lliby; namespace { template<class Comparator> bool stringCompare(StringCell *value1, StringCell *value2, ProperList<StringCell> *argList, Comparator stringCompare) { auto argListIt = argList->begin(); while(true) { if (!stringCompare(value1, value2)) { return false; } if (argListIt == argList->end()) { // All done! return true; } // Move the the next string pair value1 = value2; value2 = (*argListIt++); } } } #endif
17.027027
118
0.685714
a978c07d606f53fda7fafbbe83db43e2707837c8
162
h
C
src/examples/12_module/07_arrays_dyn_ch/arrays_dyn_ch.h
acc-cosc-1337-fall-2019/acc-cosc-1337-fall-2019-shanebrown20
703958464896e251e649c23a3fedc395c71a892c
[ "MIT" ]
null
null
null
src/examples/12_module/07_arrays_dyn_ch/arrays_dyn_ch.h
acc-cosc-1337-fall-2019/acc-cosc-1337-fall-2019-shanebrown20
703958464896e251e649c23a3fedc395c71a892c
[ "MIT" ]
null
null
null
src/examples/12_module/07_arrays_dyn_ch/arrays_dyn_ch.h
acc-cosc-1337-fall-2019/acc-cosc-1337-fall-2019-shanebrown20
703958464896e251e649c23a3fedc395c71a892c
[ "MIT" ]
null
null
null
//dynamic array allocation and deallocation functions //use getline to end char w \0 auto and show example of manual char termination void dynamic_char_array();
40.5
80
0.802469
106d49b726adde1c47269a061a178e9e01d30f06
3,159
h
C
src/mongoc/mongoc-cursor.h
Antoha-GS/mongo-c-driver
8f11ee6b9958656fe2a185332cbc21405fa271d1
[ "Apache-2.0" ]
14
2018-06-16T04:49:50.000Z
2021-04-10T03:18:40.000Z
src/mongoc/mongoc-cursor.h
Antoha-GS/mongo-c-driver
8f11ee6b9958656fe2a185332cbc21405fa271d1
[ "Apache-2.0" ]
null
null
null
src/mongoc/mongoc-cursor.h
Antoha-GS/mongo-c-driver
8f11ee6b9958656fe2a185332cbc21405fa271d1
[ "Apache-2.0" ]
7
2018-06-14T10:15:32.000Z
2020-11-06T17:07:09.000Z
/* * Copyright 2013 MongoDB, 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. */ #ifndef MONGOC_CURSOR_H #define MONGOC_CURSOR_H #if !defined(MONGOC_INSIDE) && !defined(MONGOC_COMPILATION) #error "Only <mongoc.h> can be included directly." #endif #include <bson.h> #include "mongoc-macros.h" #include "mongoc-host-list.h" BSON_BEGIN_DECLS typedef struct _mongoc_cursor_t mongoc_cursor_t; /* forward decl */ struct _mongoc_client_t; MONGOC_EXPORT (mongoc_cursor_t *) mongoc_cursor_clone (const mongoc_cursor_t *cursor) BSON_GNUC_WARN_UNUSED_RESULT; MONGOC_EXPORT (void) mongoc_cursor_destroy (mongoc_cursor_t *cursor); MONGOC_EXPORT (bool) mongoc_cursor_more (mongoc_cursor_t *cursor); MONGOC_EXPORT (bool) mongoc_cursor_next (mongoc_cursor_t *cursor, const bson_t **bson); MONGOC_EXPORT (bool) mongoc_cursor_error (mongoc_cursor_t *cursor, bson_error_t *error); MONGOC_EXPORT (bool) mongoc_cursor_error_document (mongoc_cursor_t *cursor, bson_error_t *error, const bson_t **doc); MONGOC_EXPORT (void) mongoc_cursor_get_host (mongoc_cursor_t *cursor, mongoc_host_list_t *host); MONGOC_EXPORT (bool) mongoc_cursor_is_alive (const mongoc_cursor_t *cursor) BSON_GNUC_DEPRECATED_FOR (mongoc_cursor_more); MONGOC_EXPORT (const bson_t *) mongoc_cursor_current (const mongoc_cursor_t *cursor); MONGOC_EXPORT (void) mongoc_cursor_set_batch_size (mongoc_cursor_t *cursor, uint32_t batch_size); MONGOC_EXPORT (uint32_t) mongoc_cursor_get_batch_size (const mongoc_cursor_t *cursor); MONGOC_EXPORT (bool) mongoc_cursor_set_limit (mongoc_cursor_t *cursor, int64_t limit); MONGOC_EXPORT (int64_t) mongoc_cursor_get_limit (const mongoc_cursor_t *cursor); /* These names include the term "hint" for backward compatibility, should be * mongoc_cursor_get_server_id, mongoc_cursor_set_server_id. */ MONGOC_EXPORT (bool) mongoc_cursor_set_hint (mongoc_cursor_t *cursor, uint32_t server_id); MONGOC_EXPORT (uint32_t) mongoc_cursor_get_hint (const mongoc_cursor_t *cursor); MONGOC_EXPORT (int64_t) mongoc_cursor_get_id (const mongoc_cursor_t *cursor); MONGOC_EXPORT (void) mongoc_cursor_set_max_await_time_ms (mongoc_cursor_t *cursor, uint32_t max_await_time_ms); MONGOC_EXPORT (uint32_t) mongoc_cursor_get_max_await_time_ms (const mongoc_cursor_t *cursor); MONGOC_EXPORT (mongoc_cursor_t *) mongoc_cursor_new_from_command_reply (struct _mongoc_client_t *client, bson_t *reply, uint32_t server_id) BSON_GNUC_WARN_UNUSED_RESULT; BSON_END_DECLS #endif /* MONGOC_CURSOR_H */
34.714286
76
0.767331
a10a7b39e523c8a498e25113004ea418100301f6
3,431
h
C
external_software/relion/src/Healpix_2.15a/pointing.h
leschzinerlab/cryoem-cloud-tools
d2d310423f406535a4b5f5ea78deaf2767e93348
[ "MIT" ]
7
2017-12-04T13:41:32.000Z
2021-07-12T02:33:20.000Z
external_software/relion/src/Healpix_2.15a/pointing.h
cianfrocco-lab/cryoem-cloud-tools
d2d310423f406535a4b5f5ea78deaf2767e93348
[ "MIT" ]
61
2017-04-02T05:50:44.000Z
2017-11-22T02:32:43.000Z
external_software/relion/src/Healpix_2.15a/pointing.h
leschzinerlab/AWS
d2d310423f406535a4b5f5ea78deaf2767e93348
[ "MIT" ]
9
2017-08-20T00:06:46.000Z
2021-09-23T06:50:15.000Z
/* * This file is part of Healpix_cxx. * * Healpix_cxx 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. * * Healpix_cxx 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 Healpix_cxx; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * For more information about HEALPix, see http://healpix.jpl.nasa.gov */ /* * Healpix_cxx is being developed at the Max-Planck-Institut fuer Astrophysik * and financially supported by the Deutsches Zentrum fuer Luft- und Raumfahrt * (DLR). */ /*! \file src/Healpix_2.15a/cxxsupport/pointing.h * Class representing a direction in 3D space * * Copyright (C) 2003 Max-Planck-Society * \author Martin Reinecke */ #ifndef PLANCK_POINTING_H #define PLANCK_POINTING_H #include <cmath> #include "src/Healpix_2.15a/vec3.h" #include "src/Healpix_2.15a/cxxutils.h" /*! \defgroup pointinggroup Pointings */ /*! \{ */ /*! Class representing a direction in 3D space or a location on the unit sphere. */ class pointing { public: /*! Colatitude of the pointing (i.e. the North pole is at \a theta=0). */ double theta; /*! Longitude of the pointing. */ double phi; /*! Default constructor. \a theta and \a phi are not initialized. */ pointing() {} /*! Creates a pointing with \a Theta and \a Phi. */ pointing (double Theta, double Phi) : theta(Theta), phi(Phi) {} // FIXME: should become "explicit" some time /*! Creates a pointing from the vector \a inp. \a inp need not be normalized. */ pointing (const vec3 &inp) { using namespace std; theta = atan2(sqrt(inp.x*inp.x+inp.y*inp.y),inp.z); phi = safe_atan2 (inp.y,inp.x); if (phi<0) phi += twopi; } // FIXME: should be removed some time /*! Returns a normalized vector pointing in the same direction. */ operator vec3() const { double st=sin(theta); return vec3 (st*cos(phi), st*sin(phi), cos(theta)); } /*! Returns a normalized vector pointing in the same direction. */ vec3 to_vec3() const { double st=sin(theta); return vec3 (st*cos(phi), st*sin(phi), cos(theta)); } /*! Changes the angles so that \a 0<=theta<=pi and \a 0<=phi<2*pi. */ void normalize() { theta=fmodulo(theta,twopi); if (theta>pi) { phi+=pi; theta=twopi-theta; } phi=fmodulo(phi,twopi); } }; /*! Converts \a vec to \a ptg. \a vec need not be normalized. \relates pointing */ inline void vec2pnt(const vec3 &vec, pointing &ptg) { using namespace std; ptg.theta = atan2(sqrt(vec.x*vec.x+vec.y*vec.y),vec.z); ptg.phi = safe_atan2 (vec.y,vec.x); if (ptg.phi<0) ptg.phi += twopi; } /*! Writes \a p to \a os. \relates pointing */ inline std::ostream &operator<< (std::ostream &os, const pointing &p) { os << p.theta << ", " << p.phi << std::endl; return os; } /*! \} */ #endif
29.577586
79
0.643836
a2b4eda3f72574d7808bfc8e6e76442f86e698d4
4,524
h
C
System/Library/Frameworks/ModelIO.framework/MDLTSUZipWriter.h
lechium/iPhoneOS_12.1.1_Headers
aac688b174273dfcbade13bab104461f463db772
[ "MIT" ]
12
2019-06-02T02:42:41.000Z
2021-04-13T07:22:20.000Z
System/Library/Frameworks/ModelIO.framework/MDLTSUZipWriter.h
lechium/iPhoneOS_12.1.1_Headers
aac688b174273dfcbade13bab104461f463db772
[ "MIT" ]
null
null
null
System/Library/Frameworks/ModelIO.framework/MDLTSUZipWriter.h
lechium/iPhoneOS_12.1.1_Headers
aac688b174273dfcbade13bab104461f463db772
[ "MIT" ]
3
2019-06-11T02:46:10.000Z
2019-12-21T14:58:16.000Z
/* * This header is generated by classdump-dyld 1.0 * on Saturday, June 1, 2019 at 6:44:18 PM Mountain Standard Time * Operating System: Version 12.1.1 (Build 16C5050a) * Image Source: /System/Library/Frameworks/ModelIO.framework/ModelIO * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ @protocol OS_dispatch_queue, MDLTSURandomWriteChannel, OS_dispatch_semaphore, OS_dispatch_data; @class NSObject, NSMutableArray, NSArray, NSMutableDictionary, MDLTSUZipWriterEntry, NSDate, NSError; @interface MDLTSUZipWriter : NSObject { unsigned long long _options; NSObject*<OS_dispatch_queue> _channelQueue; id<MDLTSURandomWriteChannel> _writeChannel; NSObject*<OS_dispatch_semaphore> _writeChannelCompletionSemaphore; NSMutableArray* _entries; NSArray* _sortedEntries; NSMutableDictionary* _entriesMap; MDLTSUZipWriterEntry* _currentEntry; BOOL _isClosed; BOOL _calculateSize; BOOL _force32BitSize; BOOL _calculateCRC; unsigned long long _sizeToMatch; unsigned _CRCToMatch; NSDate* _lastModificationDateIfSizeAndCRCMatches; NSDate* _newEntryLastModificationDate; long long _currentOffset; NSObject*<OS_dispatch_data> _localFileHeaderData; NSMutableArray* _entryDatas; unsigned long long _entryDataSize; NSObject*<OS_dispatch_queue> _writeQueue; long long _writtenOffset; NSError* _error; } @property (readonly) unsigned long long archiveLength; @property (readonly) unsigned long long entriesCount; @property (readonly) NSArray * sortedEntries; @property (readonly) BOOL isClosed; -(BOOL)isClosed; -(unsigned long long)entriesCount; -(void)writeData:(id)arg1 ; -(void)addExistingEntry:(id)arg1 ; -(void)setEntryInsertionOffset:(long long)arg1 ; -(void)truncateToOffsetImpl:(long long)arg1 completion:(/*^block*/id)arg2 ; -(unsigned long long)entriesCountImpl; -(id)p_writeChannel; -(void)addExistingEntryImpl:(id)arg1 ; -(void)setEntryInsertionOffsetImpl:(long long)arg1 ; -(id)sortedEntriesImpl; -(void)truncateToNumberOfEntriesImpl:(unsigned long long)arg1 completion:(/*^block*/id)arg2 ; -(void)flushCurrentEntryWithQueue:(id)arg1 completion:(/*^block*/id)arg2 ; -(NSArray *)sortedEntries; -(void)truncateToNumberOfEntries:(unsigned long long)arg1 completion:(/*^block*/id)arg2 ; -(void)truncateToOffset:(long long)arg1 completion:(/*^block*/id)arg2 ; -(void)enumerateEntriesUsingBlock:(/*^block*/id)arg1 ; -(void)addData:(id)arg1 ; -(id)entryWithName:(id)arg1 ; -(void)finishEntry; -(void)writeZip64EndOfCentralDirectoryLocatorWithOffset:(long long)arg1 ; -(void)addBarrier:(/*^block*/id)arg1 ; -(void)beginEntryWithNameImpl:(id)arg1 force32BitSize:(BOOL)arg2 lastModificationDate:(id)arg3 size:(unsigned long long)arg4 CRC:(unsigned)arg5 forceCalculatingSizeAndCRCForPreservingLastModificationDate:(BOOL)arg6 ; -(id)localFileHeaderDataForEntry:(id)arg1 ; -(void)addData:(id)arg1 queue:(id)arg2 completion:(/*^block*/id)arg3 ; -(void)addDataImpl:(id)arg1 queue:(id)arg2 completion:(/*^block*/id)arg3 ; -(void)flushEntryData; -(void)writeData:(id)arg1 queue:(id)arg2 completion:(/*^block*/id)arg3 ; -(void)handleWriteError:(id)arg1 ; -(void)writeData:(id)arg1 offset:(long long)arg2 ; -(void)writeEntryWithName:(id)arg1 force32BitSize:(BOOL)arg2 lastModificationDate:(id)arg3 size:(unsigned long long)arg4 CRC:(unsigned)arg5 fromReadChannel:(id)arg6 completion:(/*^block*/id)arg7 ; -(void)writeCentralDirectory; -(void)writeCentralFileHeaderDataForEntry:(id)arg1 ; -(void)writeEndOfCentralDirectoryDataWithOffset:(long long)arg1 size:(long long)arg2 entryCount:(unsigned long long)arg3 ; -(void)writeZip64EndOfCentralDirectoryWithOffset:(long long)arg1 size:(long long)arg2 entryCount:(unsigned long long)arg3 ; -(void)p_writeData:(id)arg1 offset:(long long)arg2 completion:(/*^block*/id)arg3 ; -(void)beginEntryWithName:(id)arg1 force32BitSize:(BOOL)arg2 lastModificationDate:(id)arg3 size:(unsigned long long)arg4 CRC:(unsigned)arg5 forceCalculatingSizeAndCRCForPreservingLastModificationDate:(BOOL)arg6 ; -(void)writeEntryWithName:(id)arg1 force32BitSize:(BOOL)arg2 fromReadChannel:(id)arg3 completion:(/*^block*/id)arg4 ; -(void)writeEntryWithName:(id)arg1 force32BitSize:(BOOL)arg2 lastModificationDate:(id)arg3 size:(unsigned long long)arg4 CRC:(unsigned)arg5 fromReadChannel:(id)arg6 writeHandler:(/*^block*/id)arg7 ; -(void)closeWithQueue:(id)arg1 completion:(/*^block*/id)arg2 ; -(id)prepareWriteChannelWithCloseCompletionHandler:(/*^block*/id)arg1 ; -(unsigned long long)archiveLength; -(id)init; -(id)initWithOptions:(unsigned long long)arg1 ; @end
49.714286
216
0.794209
081f857599c415175a0a3410e7ea7c451e8b9ae6
6,690
c
C
blatSrc/lib/sqlNum.c
zrhanna/blatq
52aca91382dd17255e83bc95a9fa567c11a29d1f
[ "MIT" ]
31
2016-04-05T09:58:29.000Z
2022-01-18T11:58:30.000Z
blatSrc/lib/sqlNum.c
calacademy-research/BLATq
52aca91382dd17255e83bc95a9fa567c11a29d1f
[ "MIT" ]
49
2015-09-15T19:50:13.000Z
2022-01-06T18:17:35.000Z
blatSrc/lib/sqlNum.c
calacademy-research/BLATq
52aca91382dd17255e83bc95a9fa567c11a29d1f
[ "MIT" ]
14
2017-02-08T09:38:57.000Z
2020-09-16T02:32:46.000Z
/* sqlnum.c - Routines to convert from ascii to integer * representation of numbers. * * This file is copyright 2002 Jim Kent, but license is hereby * granted for all use - public, private or commercial. */ #include "common.h" #include "sqlNum.h" /* The sql<Type>InList functions allow for fast thread-safe processing of dynamic arrays in sqlList */ unsigned sqlUnsigned(char *s) /* Convert series of digits to unsigned integer about * twice as fast as atoi (by not having to skip white * space or stop except at the null byte.) */ { unsigned res = 0; char *p = s; char c; while (((c = *(p++)) >= '0') && (c <= '9')) { res *= 10; res += c - '0'; } --p; /* test for invalid character or empty */ if ((c != '\0') || (p == s)) errAbort("invalid unsigned integer: \"%s\"", s); return res; } unsigned sqlUnsignedInList(char **pS) /* Convert series of digits to unsigned integer about * twice as fast as atoi (by not having to skip white * space or stop except at the null byte.) * All of string is number. Number may be delimited by a comma. * Returns the position of the delimiter or the terminating 0. */ { char *s = *pS; unsigned res = 0; char *p = s; char c; while (((c = *(p++)) >= '0') && (c <= '9')) { res *= 10; res += c - '0'; } --p; if (!(c == '\0' || c == ',') || (p == s)) { char *e = strchr(s, ','); if (e) *e = 0; errAbort("invalid unsigned integer: \"%s\"", s); } *pS = p; return res; } unsigned long sqlUnsignedLong(char *s) /* Convert series of digits to unsigned long about * twice as fast as atol (by not having to skip white * space or stop except at the null byte.) */ { unsigned long res = 0; char *p = s; char c; while (((c = *(p++)) >= '0') && (c <= '9')) { res *= 10; res += c - '0'; } --p; if ((c != '\0') || (p == s)) errAbort("invalid unsigned long: \"%s\"", s); return res; } unsigned long sqlUnsignedLongInList(char **pS) /* Convert series of digits to unsigned long about * twice as fast as atol (by not having to skip white * space or stop except at the null byte.) * All of string is number. Number may be delimited by a comma. * Returns the position of the delimiter or the terminating 0. */ { char *s = *pS; unsigned long res = 0; char *p = s; char c; while (((c = *(p++)) >= '0') && (c <= '9')) { res *= 10; res += c - '0'; } --p; if (!(c == '\0' || c == ',') || (p == s)) { char *e = strchr(s, ','); if (e) *e = 0; errAbort("invalid unsigned long: \"%s\"", s); } *pS = p; return res; } int sqlSigned(char *s) /* Convert string to signed integer. Unlike atol assumes * all of string is number. */ { int res = 0; char *p, *p0 = s; if (*p0 == '-') p0++; p = p0; while ((*p >= '0') && (*p <= '9')) { res *= 10; res += *p - '0'; p++; } /* test for invalid character, empty, or just a minus */ if ((*p != '\0') || (p == p0)) errAbort("invalid signed integer: \"%s\"", s); if (*s == '-') return -res; else return res; } int sqlSignedInList(char **pS) /* Convert string to signed integer. Unlike atol assumes * all of string is number. Number may be delimited by a comma. * Returns the position of the delimiter or the terminating 0. */ { char *s = *pS; int res = 0; char *p, *p0 = s; if (*p0 == '-') p0++; p = p0; while ((*p >= '0') && (*p <= '9')) { res *= 10; res += *p - '0'; p++; } /* test for invalid character, empty, or just a minus */ if (!(*p == '\0' || *p == ',') || (p == p0)) { char *e = strchr(s, ','); if (e) *e = 0; errAbort("invalid signed integer: \"%s\"", s); } *pS = p; if (*s == '-') return -res; else return res; } long long sqlLongLong(char *s) /* Convert string to a long long. Unlike atol assumes all of string is * number. */ { long long res = 0; char *p, *p0 = s; if (*p0 == '-') p0++; p = p0; while ((*p >= '0') && (*p <= '9')) { res *= 10; res += *p - '0'; p++; } /* test for invalid character, empty, or just a minus */ if ((*p != '\0') || (p == p0)) errAbort("invalid signed long long: \"%s\"", s); if (*s == '-') return -res; else return res; } long long sqlLongLongInList(char **pS) /* Convert string to a long long. Unlike atol, assumes * all of string is number. Number may be delimited by a comma. * Returns the position of the delimiter or the terminating 0. */ { char *s = *pS; long long res = 0; char *p, *p0 = s; if (*p0 == '-') p0++; p = p0; while ((*p >= '0') && (*p <= '9')) { res *= 10; res += *p - '0'; p++; } /* test for invalid character, empty, or just a minus */ if (!(*p == '\0' || *p == ',') || (p == p0)) { char *e = strchr(s, ','); if (e) *e = 0; errAbort("invalid signed long long: \"%s\"", s); } *pS = p; if (*s == '-') return -res; else return res; } float sqlFloat(char *s) /* Convert string to a float. Assumes all of string is number * and aborts on an error. */ { char* end; /* used to have an ifdef here to use strtof() but that doesn't * actually exist on all systems and since strtod() does, may as * well use it since it will do the job here. */ float val = (float) strtod(s, &end); if ((end == s) || (*end != '\0')) errAbort("invalid float: %s", s); return val; } float sqlFloatInList(char **pS) /* Convert string to a float. Assumes all of string is number * and aborts on an error. * Number may be delimited by a comma. * Returns the position of the delimiter or the terminating 0. */ { char *s = *pS; char* end; /* used to have an ifdef here to use strtof() but that doesn't * actually exist on all systems and since strtod() does, may as * well use it since it will do the job here. */ float val = (float) strtod(s, &end); if ((end == s) || !(*end == '\0' || *end == ',')) { char *e = strchr(s, ','); if (e) *e = 0; errAbort("invalid float: %s", s); } *pS = end; return val; } double sqlDouble(char *s) /* Convert string to a double. Assumes all of string is number * and aborts on an error. */ { char* end; double val = strtod(s, &end); if ((end == s) || (*end != '\0')) errAbort("invalid double: %s", s); return val; } double sqlDoubleInList(char **pS) /* Convert string to a double. Assumes all of string is number * and aborts on an error. * Number may be delimited by a comma. * Returns the position of the delimiter or the terminating 0. */ { char *s = *pS; char* end; double val = strtod(s, &end); if ((end == s) || !(*end == '\0' || *end == ',')) { char *e = strchr(s, ','); if (e) *e = 0; errAbort("invalid double: %s", s); } *pS = end; return val; }
22.152318
102
0.556502