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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0f470c0a176cd6b4d0b19cc47578f6a6fa874839 | 309 | h | C | protocols/CoreRCInterfaceListenerDelegate.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 36 | 2016-04-20T04:19:04.000Z | 2018-10-08T04:12:25.000Z | protocols/CoreRCInterfaceListenerDelegate.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | null | null | null | protocols/CoreRCInterfaceListenerDelegate.h | shaojiankui/iOS10-Runtime-Headers | 6b0d842bed0c52c2a7c1464087b3081af7e10c43 | [
"MIT"
] | 10 | 2016-06-16T02:40:44.000Z | 2019-01-15T03:31:45.000Z | /* Generated by RuntimeBrowser.
*/
@protocol CoreRCInterfaceListenerDelegate <NSObject>
@required
- (void)interfaceListener:(CoreRCInterfaceListener *)arg1 didAddInterface:(CoreRCInterface *)arg2;
- (void)interfaceListener:(CoreRCInterfaceListener *)arg1 didRemoveInterface:(CoreRCInterface *)arg2;
@end
| 25.75 | 101 | 0.809061 |
c7d62591c113703e7d3abec5c1a12c5512a71d2f | 899 | h | C | envoy/network/hash_policy.h | giantcroc/envoy | c535d5abf8d106925070fe6fd018a716e6bf2bf1 | [
"Apache-2.0"
] | 17,703 | 2017-09-14T18:23:43.000Z | 2022-03-31T22:04:17.000Z | envoy/network/hash_policy.h | giantcroc/envoy | c535d5abf8d106925070fe6fd018a716e6bf2bf1 | [
"Apache-2.0"
] | 15,957 | 2017-09-14T16:38:22.000Z | 2022-03-31T23:56:30.000Z | envoy/network/hash_policy.h | giantcroc/envoy | c535d5abf8d106925070fe6fd018a716e6bf2bf1 | [
"Apache-2.0"
] | 3,780 | 2017-09-14T18:58:47.000Z | 2022-03-31T17:10:47.000Z | #pragma once
#include "envoy/network/connection.h"
#include "absl/types/optional.h"
namespace Envoy {
namespace Network {
/**
* Hash policy for transport layer protocol.
*/
class HashPolicy {
public:
virtual ~HashPolicy() = default;
/**
* @param connection is the raw downstream connection. Different implementations of HashPolicy can
* compute hashes based on different data accessible from the connection (e.g. IP address,
* filter state, etc.).
* @return absl::optional<uint64_t> an optional hash value to route on. A hash value might not be
* returned if the hash policy implementation doesn't find the expected data in the connection
* (e.g. IP address is null, filter state is not populated, etc.).
*/
virtual absl::optional<uint64_t> generateHash(const Network::Connection& connection) const PURE;
};
} // namespace Network
} // namespace Envoy
| 32.107143 | 100 | 0.720801 |
be4f5374f62a23f488832939ab51228adaeb23fb | 5,046 | h | C | 2.4/include/org/apache/xalan/templates/ElemCopyOf.h | yaohb/J2ObjCAuto | 8b5252896999f367066e3f68226620f78c020923 | [
"MIT"
] | null | null | null | 2.4/include/org/apache/xalan/templates/ElemCopyOf.h | yaohb/J2ObjCAuto | 8b5252896999f367066e3f68226620f78c020923 | [
"MIT"
] | null | null | null | 2.4/include/org/apache/xalan/templates/ElemCopyOf.h | yaohb/J2ObjCAuto | 8b5252896999f367066e3f68226620f78c020923 | [
"MIT"
] | null | null | null | //
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Users/antoniocortes/j2objcprj/relases/j2objc/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemCopyOf.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_OrgApacheXalanTemplatesElemCopyOf")
#ifdef RESTRICT_OrgApacheXalanTemplatesElemCopyOf
#define INCLUDE_ALL_OrgApacheXalanTemplatesElemCopyOf 0
#else
#define INCLUDE_ALL_OrgApacheXalanTemplatesElemCopyOf 1
#endif
#undef RESTRICT_OrgApacheXalanTemplatesElemCopyOf
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#if __has_feature(nullability)
#pragma clang diagnostic push
#pragma GCC diagnostic ignored "-Wnullability"
#pragma GCC diagnostic ignored "-Wnullability-completeness"
#endif
#if !defined (OrgApacheXalanTemplatesElemCopyOf_) && (INCLUDE_ALL_OrgApacheXalanTemplatesElemCopyOf || defined(INCLUDE_OrgApacheXalanTemplatesElemCopyOf))
#define OrgApacheXalanTemplatesElemCopyOf_
#define RESTRICT_OrgApacheXalanTemplatesElemTemplateElement 1
#define INCLUDE_OrgApacheXalanTemplatesElemTemplateElement 1
#include "org/apache/xalan/templates/ElemTemplateElement.h"
@class OrgApacheXalanTemplatesStylesheetRoot;
@class OrgApacheXalanTemplatesXSLTVisitor;
@class OrgApacheXalanTransformerTransformerImpl;
@class OrgApacheXpathXPath;
/*!
@brief Implement xsl:copy-of.
@code
<!ELEMENT xsl:copy-of EMPTY>
<!ATTLIST xsl:copy-of select %expr; #REQUIRED>
@endcode
- seealso: <a href="http://www.w3.org/TR/xslt#copy-of">copy-of in XSLT Specification</a>
*/
@interface OrgApacheXalanTemplatesElemCopyOf : OrgApacheXalanTemplatesElemTemplateElement {
@public
/*!
@brief The required select attribute contains an expression.
*/
OrgApacheXpathXPath *m_selectExpression_;
}
@property (readonly, class) jlong serialVersionUID NS_SWIFT_NAME(serialVersionUID);
+ (jlong)serialVersionUID;
#pragma mark Public
- (instancetype __nonnull)init;
/*!
@brief Add a child to the child list.
@param newChild Child to add to this node's child list
@return Child just added to child list
*/
- (OrgApacheXalanTemplatesElemTemplateElement *)appendChildWithOrgApacheXalanTemplatesElemTemplateElement:(OrgApacheXalanTemplatesElemTemplateElement *)newChild;
/*!
@brief This function is called after everything else has been
recomposed, and allows the template to set remaining
values that may be based on some other property that
depends on recomposition.
*/
- (void)composeWithOrgApacheXalanTemplatesStylesheetRoot:(OrgApacheXalanTemplatesStylesheetRoot *)sroot;
/*!
@brief The xsl:copy-of element can be used to insert a result tree
fragment into the result tree, without first converting it to
a string as xsl:value-of does (see [7.6.1 Generating Text with
xsl:value-of]).
@param transformer non-null reference to the the current transform-time state.
@throw TransformerException
*/
- (void)executeWithOrgApacheXalanTransformerTransformerImpl:(OrgApacheXalanTransformerTransformerImpl *)transformer;
/*!
@brief Return the node name.
@return The element's name
*/
- (NSString *)getNodeName;
/*!
@brief Get the "select" attribute.
The required select attribute contains an expression.
@return Expression for select attribute
*/
- (OrgApacheXpathXPath *)getSelect;
/*!
@brief Get an int constant identifying the type of element.
- seealso: org.apache.xalan.templates.Constants
@return The token ID for this element
*/
- (jint)getXSLToken;
/*!
@brief Set the "select" attribute.
The required select attribute contains an expression.
@param expr Expression for select attribute
*/
- (void)setSelectWithOrgApacheXpathXPath:(OrgApacheXpathXPath *)expr;
#pragma mark Protected
/*!
@brief Call the children visitors.
@param visitor The visitor whose appropriate method will be called.
*/
- (void)callChildVisitorsWithOrgApacheXalanTemplatesXSLTVisitor:(OrgApacheXalanTemplatesXSLTVisitor *)visitor
withBoolean:(jboolean)callAttrs;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgApacheXalanTemplatesElemCopyOf)
J2OBJC_FIELD_SETTER(OrgApacheXalanTemplatesElemCopyOf, m_selectExpression_, OrgApacheXpathXPath *)
inline jlong OrgApacheXalanTemplatesElemCopyOf_get_serialVersionUID(void);
#define OrgApacheXalanTemplatesElemCopyOf_serialVersionUID -7433828829497411127LL
J2OBJC_STATIC_FIELD_CONSTANT(OrgApacheXalanTemplatesElemCopyOf, serialVersionUID, jlong)
FOUNDATION_EXPORT void OrgApacheXalanTemplatesElemCopyOf_init(OrgApacheXalanTemplatesElemCopyOf *self);
FOUNDATION_EXPORT OrgApacheXalanTemplatesElemCopyOf *new_OrgApacheXalanTemplatesElemCopyOf_init(void) NS_RETURNS_RETAINED;
FOUNDATION_EXPORT OrgApacheXalanTemplatesElemCopyOf *create_OrgApacheXalanTemplatesElemCopyOf_init(void);
J2OBJC_TYPE_LITERAL_HEADER(OrgApacheXalanTemplatesElemCopyOf)
#endif
#if __has_feature(nullability)
#pragma clang diagnostic pop
#endif
#pragma clang diagnostic pop
#pragma pop_macro("INCLUDE_ALL_OrgApacheXalanTemplatesElemCopyOf")
| 33.64 | 169 | 0.816686 |
9c0026d0ff56dbe8d0520c91b2fe603a5356f4a4 | 15,515 | h | C | pgssapi/pgss-dispatch.h | OneIdentity/rc-legacy | 6e247f55b7df6b1022819810ba3363a2db401f08 | [
"Apache-2.0"
] | null | null | null | pgssapi/pgss-dispatch.h | OneIdentity/rc-legacy | 6e247f55b7df6b1022819810ba3363a2db401f08 | [
"Apache-2.0"
] | null | null | null | pgssapi/pgss-dispatch.h | OneIdentity/rc-legacy | 6e247f55b7df6b1022819810ba3363a2db401f08 | [
"Apache-2.0"
] | null | null | null | /*
* GSSAPI library dispatch structure.
*/
typedef void *D_gss_name_t;
typedef void *D_gss_cred_id_t;
typedef void *D_gss_ctx_id_t;
typedef OM_uint32 (*gss_acquire_cred_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* desired_name */
OM_uint32, /* time_req */
const gss_OID_set, /* desired_mechs */
gss_cred_usage_t, /* cred_usage */
D_gss_cred_id_t *, /* output_cred_handle */
gss_OID_set *, /* actual_mechs */
OM_uint32 * /* time_rec */
);
typedef OM_uint32 (*gss_release_cred_t)
(OM_uint32 *, /* minor_status */
D_gss_cred_id_t * /* cred_handle */
);
typedef OM_uint32 (*gss_init_sec_context_t)
(OM_uint32 *, /* minor_status */
const D_gss_cred_id_t, /* initiator_cred_handle */
D_gss_ctx_id_t *, /* context_handle */
const D_gss_name_t, /* target_name */
const gss_OID, /* mech_type */
OM_uint32, /* req_flags */
OM_uint32, /* time_req */
const gss_channel_bindings_t,
/* input_chan_bindings */
const gss_buffer_t, /* input_token */
gss_OID *, /* actual_mech_type */
gss_buffer_t, /* output_token */
OM_uint32 *, /* ret_flags */
OM_uint32 * /* time_rec */
);
typedef OM_uint32 (*gss_accept_sec_context_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t *, /* context_handle */
const D_gss_cred_id_t, /* acceptor_cred_handle */
const gss_buffer_t, /* input_token_buffer */
const gss_channel_bindings_t,
/* input_chan_bindings */
D_gss_name_t *, /* src_name */
gss_OID *, /* mech_type */
gss_buffer_t, /* output_token */
OM_uint32 *, /* ret_flags */
OM_uint32 *, /* time_rec */
D_gss_cred_id_t * /* delegated_cred_handle */
);
typedef OM_uint32 (*gss_process_context_token_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
const gss_buffer_t /* token_buffer */
);
typedef OM_uint32 (*gss_delete_sec_context_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t *, /* context_handle */
gss_buffer_t /* output_token */
);
typedef OM_uint32 (*gss_context_time_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
OM_uint32 * /* time_rec */
);
typedef OM_uint32 (*gss_get_mic_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
gss_qop_t, /* qop_req */
const gss_buffer_t, /* message_buffer */
gss_buffer_t /* message_token */
);
typedef OM_uint32 (*gss_verify_mic_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
const gss_buffer_t, /* message_buffer */
const gss_buffer_t, /* token_buffer */
gss_qop_t * /* qop_state */
);
typedef OM_uint32 (*gss_wrap_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
int, /* conf_req_flag */
gss_qop_t, /* qop_req */
const gss_buffer_t, /* input_message_buffer */
int *, /* conf_state */
gss_buffer_t /* output_message_buffer */
);
typedef OM_uint32 (*gss_unwrap_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
const gss_buffer_t, /* input_message_buffer */
gss_buffer_t, /* output_message_buffer */
int *, /* conf_state */
gss_qop_t * /* qop_state */
);
typedef OM_uint32 (*gss_display_status_t)
(OM_uint32 *, /* minor_status */
OM_uint32, /* status_value */
int, /* status_type */
const gss_OID, /* mech_type */
OM_uint32 *, /* message_context */
gss_buffer_t /* status_string */
);
typedef OM_uint32 (*gss_indicate_mechs_t)
(OM_uint32 *, /* minor_status */
gss_OID_set * /* mech_set */
);
typedef OM_uint32 (*gss_compare_name_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* name1 */
const D_gss_name_t, /* name2 */
int * /* name_equal */
);
typedef OM_uint32 (*gss_display_name_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* input_name */
gss_buffer_t, /* output_name_buffer */
gss_OID * /* output_name_type */
);
typedef OM_uint32 (*gss_import_name_t)
(OM_uint32 *, /* minor_status */
const gss_buffer_t, /* input_name_buffer */
const gss_OID, /* input_name_type */
D_gss_name_t * /* output_name */
);
typedef OM_uint32 (*gss_export_name_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* input_name */
gss_buffer_t /* exported_name */
);
typedef OM_uint32 (*gss_release_name_t)
(OM_uint32 *, /* minor_status */
D_gss_name_t * /* input_name */
);
typedef OM_uint32 (*gss_release_buffer_t)
(OM_uint32 *, /* minor_status */
gss_buffer_t /* buffer */
);
typedef OM_uint32 (*gss_release_oid_set_t)
(OM_uint32 *, /* minor_status */
gss_OID_set * /* set */
);
typedef OM_uint32 (*gss_inquire_cred_t)
(OM_uint32 *, /* minor_status */
const D_gss_cred_id_t, /* cred_handle */
D_gss_name_t *, /* name */
OM_uint32 *, /* lifetime */
gss_cred_usage_t *, /* cred_usage */
gss_OID_set * /* mechanisms */
);
typedef OM_uint32 (*gss_inquire_context_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
D_gss_name_t *, /* src_name */
D_gss_name_t *, /* targ_name */
OM_uint32 *, /* lifetime_rec */
gss_OID *, /* mech_type */
OM_uint32 *, /* ctx_flags */
int *, /* locally_initiated */
int * /* open */
);
typedef OM_uint32 (*gss_wrap_size_limit_t)
(OM_uint32 *, /* minor_status */
const D_gss_ctx_id_t, /* context_handle */
int, /* conf_req_flag */
gss_qop_t, /* qop_req */
OM_uint32, /* req_output_size */
OM_uint32 * /* max_input_size */
);
typedef OM_uint32 (*gss_add_cred_t)
(OM_uint32 *, /* minor_status */
const D_gss_cred_id_t, /* input_cred_handle */
const D_gss_name_t, /* desired_name */
const gss_OID, /* desired_mech */
gss_cred_usage_t, /* cred_usage */
OM_uint32, /* initiator_time_req */
OM_uint32 *, /* acceptor_time_req */
D_gss_cred_id_t *, /* output_cred_handle */
gss_OID_set *, /* actual_mechs */
OM_uint32 *, /* initiator_time_rec */
OM_uint32 * /* acceptor_time_rec */
);
typedef OM_uint32 (*gss_inquire_cred_by_mech_t)
(OM_uint32 *, /* minor_status */
const D_gss_cred_id_t, /* cred_handle */
const gss_OID, /* mech_type */
D_gss_name_t *, /* name */
OM_uint32 *, /* initiator_lifetime */
OM_uint32 *, /* acceptor_lifetime */
gss_cred_usage_t * /* cred_usage */
);
typedef OM_uint32 (*gss_export_sec_context_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t, /* context_handle */
gss_buffer_t /* interprocess_token */
);
typedef OM_uint32 (*gss_import_sec_context_t)
(OM_uint32 *, /* minor_status */
const gss_buffer_t, /* interprocess_token */
D_gss_ctx_id_t * /* context_handle */
);
typedef OM_uint32 (*gss_create_empty_oid_set_t)
(OM_uint32 *, /* minor_status */
gss_OID_set * /* oid_set */
);
typedef OM_uint32 (*gss_add_oid_set_member_t)
(OM_uint32 *, /* minor_status */
const gss_OID, /* member_oid */
gss_OID_set * /* oid_set */
);
typedef OM_uint32 (*gss_test_oid_set_member_t)
(OM_uint32 *, /* minor_status */
const gss_OID, /* member */
const gss_OID_set, /* set */
int * /* present */
);
typedef OM_uint32 (*gss_inquire_names_for_mech_t)
(OM_uint32 *, /* minor_status */
const gss_OID, /* mechanism */
gss_OID_set * /* name_types */
);
typedef OM_uint32 (*gss_inquire_mechs_for_name_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* input_name */
gss_OID_set * /* mech_types */
);
typedef OM_uint32 (*gss_canonicalize_name_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* input_name */
const gss_OID, /* mech_type */
D_gss_name_t * /* output_name */
);
typedef OM_uint32 (*gss_duplicate_name_t)
(OM_uint32 *, /* minor_status */
const D_gss_name_t, /* src_name */
D_gss_name_t * /* dest_name */
);
typedef OM_uint32 (*gss_sign_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t, /* context_handle */
int, /* qop_req */
gss_buffer_t, /* message_buffer */
gss_buffer_t /* message_token */
);
typedef OM_uint32 (*gss_verify_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t, /* context_handle */
gss_buffer_t, /* message_buffer */
gss_buffer_t, /* token_buffer */
int * /* qop_state */
);
typedef OM_uint32 (*gss_seal_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t, /* context_handle */
int, /* conf_req_flag */
int, /* qop_req */
gss_buffer_t, /* input_message_buffer */
int *, /* conf_state */
gss_buffer_t /* output_message_buffer */
);
typedef OM_uint32 (*gss_unseal_t)
(OM_uint32 *, /* minor_status */
D_gss_ctx_id_t, /* context_handle */
gss_buffer_t, /* input_message_buffer */
gss_buffer_t, /* output_message_buffer */
int *, /* conf_state */
int * /* qop_state */
);
typedef OM_uint32 (*pgss_ctl_t)
(OM_uint32 *, /* minor_status */
gss_OID, /* mechanism */
OM_uint32, /* operation */
gss_buffer_t /* data_buffer */
);
struct pgss_dispatch {
gss_acquire_cred_t gss_acquire_cred;
gss_release_cred_t gss_release_cred;
gss_init_sec_context_t gss_init_sec_context;
gss_accept_sec_context_t gss_accept_sec_context;
gss_process_context_token_t gss_process_context_token;
gss_delete_sec_context_t gss_delete_sec_context;
gss_context_time_t gss_context_time;
gss_get_mic_t gss_get_mic;
gss_verify_mic_t gss_verify_mic;
gss_wrap_t gss_wrap;
gss_unwrap_t gss_unwrap;
gss_display_status_t gss_display_status;
gss_indicate_mechs_t gss_indicate_mechs;
gss_compare_name_t gss_compare_name;
gss_display_name_t gss_display_name;
gss_import_name_t gss_import_name;
gss_export_name_t gss_export_name;
gss_release_name_t gss_release_name;
gss_release_buffer_t gss_release_buffer;
gss_release_oid_set_t gss_release_oid_set;
gss_inquire_cred_t gss_inquire_cred;
gss_inquire_context_t gss_inquire_context;
gss_wrap_size_limit_t gss_wrap_size_limit;
gss_add_cred_t gss_add_cred;
gss_inquire_cred_by_mech_t gss_inquire_cred_by_mech;
gss_export_sec_context_t gss_export_sec_context;
gss_import_sec_context_t gss_import_sec_context;
gss_create_empty_oid_set_t gss_create_empty_oid_set;
gss_add_oid_set_member_t gss_add_oid_set_member;
gss_test_oid_set_member_t gss_test_oid_set_member;
gss_inquire_names_for_mech_t gss_inquire_names_for_mech;
gss_inquire_mechs_for_name_t gss_inquire_mechs_for_name;
gss_canonicalize_name_t gss_canonicalize_name;
gss_duplicate_name_t gss_duplicate_name;
gss_sign_t gss_sign;
gss_verify_t gss_verify;
gss_seal_t gss_seal;
gss_unseal_t gss_unseal;
pgss_ctl_t pgss_ctl;
};
struct config;
struct pgss_dispatch *_pgss_dl_provider(struct config *config);
| 42.04607 | 66 | 0.478247 |
3b84867c55b148e32bab323472071a58f2ce3f0d | 1,671 | c | C | samples/01_HelloWorld/hello.c | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | 1 | 2016-04-09T02:58:13.000Z | 2016-04-09T02:58:13.000Z | samples/01_HelloWorld/hello.c | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | samples/01_HelloWorld/hello.c | vidkidz/crossbridge | ba0bf94aee0ce6cf7eb5be882382e52bc57ba396 | [
"MIT"
] | null | null | null | // Copyright (c) 2013 Adobe Systems Inc
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#include <stdio.h>
int main(int argc, char **argv)
{
// flascc comes with a normal BSD libc so everything you would expect to
// be present should work out-of-the-box. This example just shows a
// simple message formatted using printf.
//
// When compiled as a projector this message will be to stdout just like
// a normal commandline application. When compiled to a SWF it will be
// displayed in a textfield on the stage. This behavior is overrideable
// as you will see in later samples.
printf("Hello World\n");
}
| 46.416667 | 80 | 0.743866 |
7b0282eee44621cac7024a203e80bae3f9a74791 | 10,485 | c | C | plat/arm/css/common/css_pm.c | virtualopensystems-kchappuis/handle-fiq-el3 | aaa0567c38ea6f08d68ce64210800b51a8872c13 | [
"BSD-3-Clause"
] | null | null | null | plat/arm/css/common/css_pm.c | virtualopensystems-kchappuis/handle-fiq-el3 | aaa0567c38ea6f08d68ce64210800b51a8872c13 | [
"BSD-3-Clause"
] | null | null | null | plat/arm/css/common/css_pm.c | virtualopensystems-kchappuis/handle-fiq-el3 | aaa0567c38ea6f08d68ce64210800b51a8872c13 | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2015, ARM Limited and Contributors. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of ARM nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific
* prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <assert.h>
#include <arch_helpers.h>
#include <arm_gic.h>
#include <cci.h>
#include <css_def.h>
#include <debug.h>
#include <errno.h>
#include <plat_arm.h>
#include <platform.h>
#include <platform_def.h>
#include <psci.h>
#include "css_scpi.h"
/*******************************************************************************
* Private function to program the mailbox for a cpu before it is released
* from reset.
******************************************************************************/
static void css_program_mailbox(uint64_t mpidr, uint64_t address)
{
uint64_t linear_id;
uint64_t mbox;
linear_id = platform_get_core_pos(mpidr);
mbox = TRUSTED_MAILBOXES_BASE + (linear_id << TRUSTED_MAILBOX_SHIFT);
*((uint64_t *) mbox) = address;
flush_dcache_range(mbox, sizeof(mbox));
}
/*******************************************************************************
* Handler called when an affinity instance is about to be turned on. The
* level and mpidr determine the affinity instance.
******************************************************************************/
int32_t css_affinst_on(uint64_t mpidr,
uint64_t sec_entrypoint,
uint32_t afflvl,
uint32_t state)
{
/*
* SCP takes care of powering up higher affinity levels so we
* only need to care about level 0
*/
if (afflvl != MPIDR_AFFLVL0)
return PSCI_E_SUCCESS;
/*
* Setup mailbox with address for CPU entrypoint when it next powers up
*/
css_program_mailbox(mpidr, sec_entrypoint);
scpi_set_css_power_state(mpidr, scpi_power_on, scpi_power_on,
scpi_power_on);
return PSCI_E_SUCCESS;
}
/*******************************************************************************
* Handler called when an affinity instance has just been powered on after
* being turned off earlier. The level and mpidr determine the affinity
* instance. The 'state' arg. allows the platform to decide whether the cluster
* was turned off prior to wakeup and do what's necessary to setup it up
* correctly.
******************************************************************************/
void css_affinst_on_finish(uint32_t afflvl, uint32_t state)
{
unsigned long mpidr;
/* Determine if any platform actions need to be executed. */
if (arm_do_affinst_actions(afflvl, state) == -EAGAIN)
return;
/* Get the mpidr for this cpu */
mpidr = read_mpidr_el1();
/*
* Perform the common cluster specific operations i.e enable coherency
* if this cluster was off.
*/
if (afflvl != MPIDR_AFFLVL0)
cci_enable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(mpidr));
/* Enable the gic cpu interface */
arm_gic_cpuif_setup();
/* todo: Is this setup only needed after a cold boot? */
arm_gic_pcpu_distif_setup();
/* Clear the mailbox for this cpu. */
css_program_mailbox(mpidr, 0);
}
/*******************************************************************************
* Common function called while turning a cpu off or suspending it. It is called
* from css_off() or css_suspend() when these functions in turn are called for
* the highest affinity level which will be powered down. It performs the
* actions common to the OFF and SUSPEND calls.
******************************************************************************/
static void css_power_down_common(uint32_t afflvl)
{
uint32_t cluster_state = scpi_power_on;
/* Prevent interrupts from spuriously waking up this cpu */
arm_gic_cpuif_deactivate();
/* Cluster is to be turned off, so disable coherency */
if (afflvl > MPIDR_AFFLVL0) {
cci_disable_snoop_dvm_reqs(MPIDR_AFFLVL1_VAL(read_mpidr()));
cluster_state = scpi_power_off;
}
/*
* Ask the SCP to power down the appropriate components depending upon
* their state.
*/
scpi_set_css_power_state(read_mpidr_el1(),
scpi_power_off,
cluster_state,
scpi_power_on);
}
/*******************************************************************************
* Handler called when an affinity instance is about to be turned off. The
* level and mpidr determine the affinity instance. The 'state' arg. allows the
* platform to decide whether the cluster is being turned off and take
* appropriate actions.
*
* CAUTION: There is no guarantee that caches will remain turned on across calls
* to this function as each affinity level is dealt with. So do not write & read
* global variables across calls. It will be wise to do flush a write to the
* global to prevent unpredictable results.
******************************************************************************/
static void css_affinst_off(uint32_t afflvl, uint32_t state)
{
/* Determine if any platform actions need to be executed */
if (arm_do_affinst_actions(afflvl, state) == -EAGAIN)
return;
css_power_down_common(afflvl);
}
/*******************************************************************************
* Handler called when an affinity instance is about to be suspended. The
* level and mpidr determine the affinity instance. The 'state' arg. allows the
* platform to decide whether the cluster is being turned off and take apt
* actions. The 'sec_entrypoint' determines the address in BL3-1 from where
* execution should resume.
*
* CAUTION: There is no guarantee that caches will remain turned on across calls
* to this function as each affinity level is dealt with. So do not write & read
* global variables across calls. It will be wise to do flush a write to the
* global to prevent unpredictable results.
******************************************************************************/
static void css_affinst_suspend(uint64_t sec_entrypoint,
uint32_t afflvl,
uint32_t state)
{
/* Determine if any platform actions need to be executed */
if (arm_do_affinst_actions(afflvl, state) == -EAGAIN)
return;
/*
* Setup mailbox with address for CPU entrypoint when it next powers up.
*/
css_program_mailbox(read_mpidr_el1(), sec_entrypoint);
css_power_down_common(afflvl);
}
/*******************************************************************************
* Handler called when an affinity instance has just been powered on after
* having been suspended earlier. The level and mpidr determine the affinity
* instance.
* TODO: At the moment we reuse the on finisher and reinitialize the secure
* context. Need to implement a separate suspend finisher.
******************************************************************************/
static void css_affinst_suspend_finish(uint32_t afflvl,
uint32_t state)
{
css_affinst_on_finish(afflvl, state);
}
/*******************************************************************************
* Handlers to shutdown/reboot the system
******************************************************************************/
static void __dead2 css_system_off(void)
{
uint32_t response;
/* Send the power down request to the SCP */
response = scpi_sys_power_state(scpi_system_shutdown);
if (response != SCP_OK) {
ERROR("CSS System Off: SCP error %u.\n", response);
panic();
}
wfi();
ERROR("CSS System Off: operation not handled.\n");
panic();
}
static void __dead2 css_system_reset(void)
{
uint32_t response;
/* Send the system reset request to the SCP */
response = scpi_sys_power_state(scpi_system_reboot);
if (response != SCP_OK) {
ERROR("CSS System Reset: SCP error %u.\n", response);
panic();
}
wfi();
ERROR("CSS System Reset: operation not handled.\n");
panic();
}
/*******************************************************************************
* Handler called when an affinity instance is about to enter standby.
******************************************************************************/
void css_affinst_standby(unsigned int power_state)
{
unsigned int scr;
scr = read_scr_el3();
/* Enable PhysicalIRQ bit for NS world to wake the CPU */
write_scr_el3(scr | SCR_IRQ_BIT);
isb();
dsb();
wfi();
/*
* Restore SCR to the original value, synchronisation of scr_el3 is
* done by eret while el3_exit to save some execution cycles.
*/
write_scr_el3(scr);
}
/*******************************************************************************
* Export the platform handlers to enable psci to invoke them
******************************************************************************/
static const plat_pm_ops_t css_ops = {
.affinst_on = css_affinst_on,
.affinst_on_finish = css_affinst_on_finish,
.affinst_off = css_affinst_off,
.affinst_standby = css_affinst_standby,
.affinst_suspend = css_affinst_suspend,
.affinst_suspend_finish = css_affinst_suspend_finish,
.system_off = css_system_off,
.system_reset = css_system_reset,
.validate_power_state = arm_validate_power_state
};
/*******************************************************************************
* Export the platform specific power ops.
******************************************************************************/
int32_t platform_setup_pm(const plat_pm_ops_t **plat_ops)
{
*plat_ops = &css_ops;
return 0;
}
| 36.155172 | 80 | 0.62556 |
7e84ed4d7f1b7781738f413b1be8d14217406e7d | 474 | h | C | Sources/MooApi.h | eCrowdMedia/MooApi | 71dd7e5f881127568a293cf4d994d0d8b0cbac85 | [
"MIT"
] | 2 | 2018-04-07T03:41:07.000Z | 2019-02-09T15:25:01.000Z | Sources/MooApi.h | eCrowdMedia/MooApi | 71dd7e5f881127568a293cf4d994d0d8b0cbac85 | [
"MIT"
] | null | null | null | Sources/MooApi.h | eCrowdMedia/MooApi | 71dd7e5f881127568a293cf4d994d0d8b0cbac85 | [
"MIT"
] | null | null | null | //
// MooApi.h
// MooApi
//
// Created by Arco on 14/03/2017.
// Copyright © 2017 ecrowdmedia.com. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for MooApi.
FOUNDATION_EXPORT double MooApiVersionNumber;
//! Project version string for MooApi.
FOUNDATION_EXPORT const unsigned char MooApiVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <MooApi/PublicHeader.h>
| 23.7 | 131 | 0.748945 |
dfa882b9053659b15032899580c7dc11766f7e99 | 396 | c | C | Matrix/static_matrix.c | Daniel-0liver/Advanced-C-curse | b36be78a77286cc47111b3bdb3f1e90127aa5064 | [
"MIT"
] | null | null | null | Matrix/static_matrix.c | Daniel-0liver/Advanced-C-curse | b36be78a77286cc47111b3bdb3f1e90127aa5064 | [
"MIT"
] | null | null | null | Matrix/static_matrix.c | Daniel-0liver/Advanced-C-curse | b36be78a77286cc47111b3bdb3f1e90127aa5064 | [
"MIT"
] | null | null | null | #include <stdio.h>
int main() {
int n_rows = 2;
int n_cols = 3;
int m[2][3] = {{0, 1, 2}, {3, 4, 5}};
printf("&m = %p, m = %p\n\n", &m, m);
for (int i = 0; i < n_rows; i++)
{
for (int j = 0; j < n_cols; j++)
{
printf("&m[%d][%d] = %p, m[%d][%d] = %d\n", i, j, &m[i][j], i, j, m[i][j]);
}
puts("");
}
return 0;
} | 18.857143 | 87 | 0.338384 |
2a835b856fa3e5d48b82a0767de0cd093f8d1a2a | 2,523 | h | C | include/CustomLibrary/SDL/SDLWindow.h | floppyMike/CustomLibrary | 019122e8794e3b8e580e3c61b51b0f7c7dad16ff | [
"MIT"
] | 2 | 2020-07-27T17:25:13.000Z | 2020-11-15T15:05:19.000Z | include/CustomLibrary/SDL/SDLWindow.h | floppyMike/CustomLibrary | 019122e8794e3b8e580e3c61b51b0f7c7dad16ff | [
"MIT"
] | null | null | null | include/CustomLibrary/SDL/SDLWindow.h | floppyMike/CustomLibrary | 019122e8794e3b8e580e3c61b51b0f7c7dad16ff | [
"MIT"
] | null | null | null | #pragma once
#include "Camera2D.h"
#include "Engine.h"
#include "Render.h"
#include "Renderer.h"
#include "State.h"
#include "Window.h"
#include "../Error.h"
namespace ctl::sdl
{
/**
* @brief Stock general SDL2 Window
*/
class SDLWindow : public IWindow
{
public:
/**
* @brief Initialize Window and Renderer
*
* @param name Name of the window
* @param dim Size of the window
* @param windowFlags window init flags https://wiki.libsdl.org/SDL_WindowFlags#Values
* @param rendererFlags renderer init flags https://wiki.libsdl.org/SDL_RendererFlags#Values
*/
SDLWindow(const char *name, const mth::Dim<int> &dim, const Uint32 &windowFlags = SDL_WINDOW_SHOWN,
const Uint32 &rendererFlags = SDL_RENDERER_ACCELERATED)
: m_win(name, dim, windowFlags)
, m_renderer(&m_win, rendererFlags)
{
m_renderer.logical_size(m_win.dim());
}
~SDLWindow() { destroy(); }
/**
* @brief Close and deallocate the window
*/
void destroy()
{
m_win.destroy();
m_renderer.destroy();
}
/**
* @brief Queue a state change
* The state change will take place when a new loop iteration takes place. Keep in mind that the previous state
* IS DEALLOCATED when the construction is takeing place.
* @tparam State State type to change to
* @param args Arguments to construct the new state
*/
template<typename State, typename... _Args>
void queue_state(_Args &&... args)
{
m_state.set<State>(std::forward<_Args>(args)...);
}
/**
* @brief Get the renderer
* @return Renderer&
*/
constexpr auto renderer() noexcept -> auto & { return m_renderer; }
/**
* @brief Get the window
* @return Window&
*/
constexpr auto window() noexcept -> auto & { return m_win; }
/**
* @brief Get the camera
* @return Camera2D&
*/
constexpr auto camera() noexcept -> auto & { return m_cam; }
void pre_pass() override { m_state.update(); }
void event(const SDL_Event &e) override
{
if (e.window.windowID == m_win.ID())
{
m_state->input(e);
m_state->event(e);
}
}
void update() override { m_state->update(); }
void fixed_update() override { m_state->fixed_update(); }
void render() override
{
if (m_renderer.will_render())
{
auto r = sdl::render(&m_renderer);
r.fill(sdl::WHITE);
m_state->draw();
r.locking_render();
}
}
private:
Window m_win;
sdl::Delayed<sdl::Renderer> m_renderer;
Camera2D m_cam;
StateManager<IState> m_state;
};
} // namespace ctl::sdl
| 23.146789 | 113 | 0.651209 |
019b9e0b5f89a37b33669db52916e27b5e275834 | 154 | h | C | boot2dump/src/elf.h | Passw/kerla | a188653f677de8dee143fa374258ca34a6e2325b | [
"MIT"
] | 2 | 2021-11-19T21:14:17.000Z | 2021-12-21T04:12:56.000Z | boot2dump/src/elf.h | Passw/kerla | a188653f677de8dee143fa374258ca34a6e2325b | [
"MIT"
] | null | null | null | boot2dump/src/elf.h | Passw/kerla | a188653f677de8dee143fa374258ca34a6e2325b | [
"MIT"
] | null | null | null | #ifndef __ELF_H__
#define __ELF_H__
#include <types.h>
struct elf64_rela {
uint64_t r_offset;
uint64_t r_info;
int64_t r_addend;
};
#endif
| 11.846154 | 22 | 0.707792 |
cc51486dbcfca7b09b2911e39223c78067e9f9ed | 407 | h | C | pi2c.h | vbloodv/pi2c | a5f9981554471d8119791947703e3b969b3b0db3 | [
"Apache-2.0"
] | null | null | null | pi2c.h | vbloodv/pi2c | a5f9981554471d8119791947703e3b969b3b0db3 | [
"Apache-2.0"
] | null | null | null | pi2c.h | vbloodv/pi2c | a5f9981554471d8119791947703e3b969b3b0db3 | [
"Apache-2.0"
] | 1 | 2021-02-05T09:55:12.000Z | 2021-02-05T09:55:12.000Z | #include <iostream>
#include <linux/i2c-dev.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/ioctl.h>
class Pi2c
{
public:
Pi2c();
~Pi2c();
bool initialize(int address, bool revision = 1);
void status();
bool is_connect() const;
int read_block(char* data, int length);
int write_block(char* data, int length);
private:
int m_address;
int m_handle;
bool m_is_connect;
}; | 17.695652 | 49 | 0.670762 |
629459825cb7ff57fc6706b711e6fbb4ef321abb | 308 | h | C | Toolbar.h | mcmarius/forme-geometrice-1512-2021 | c94ccb56b20fcca6207e65c15bce8c478a0687bb | [
"Unlicense"
] | null | null | null | Toolbar.h | mcmarius/forme-geometrice-1512-2021 | c94ccb56b20fcca6207e65c15bce8c478a0687bb | [
"Unlicense"
] | null | null | null | Toolbar.h | mcmarius/forme-geometrice-1512-2021 | c94ccb56b20fcca6207e65c15bce8c478a0687bb | [
"Unlicense"
] | null | null | null | //
// Created by marius on 2021-03-10.
//
#ifndef FORME_GEOMETRICE_1512_2021_TOOLBAR_H
#define FORME_GEOMETRICE_1512_2021_TOOLBAR_H
class Toolbar {
bool hidden = false;
public:
Toolbar(); // = default;
bool isHidden() const;
void toggle();
};
#endif //FORME_GEOMETRICE_1512_2021_TOOLBAR_H
| 18.117647 | 45 | 0.727273 |
9235780f6c7892fb0f489b0a2403bbbc4debe9a6 | 1,344 | h | C | tknlib.h | mhrnshrf/Computer-Network-CA2 | ba8a5d5677d4c82551dddd2ec07a801782db936b | [
"MIT"
] | null | null | null | tknlib.h | mhrnshrf/Computer-Network-CA2 | ba8a5d5677d4c82551dddd2ec07a801782db936b | [
"MIT"
] | null | null | null | tknlib.h | mhrnshrf/Computer-Network-CA2 | ba8a5d5677d4c82551dddd2ec07a801782db936b | [
"MIT"
] | null | null | null | #ifndef _TOKEN_
#define _TOKEN_
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <map>
using namespace std;
extern void padding(char* in, int len);
extern int parse(char *line, char **words);
extern int length(char* s);
extern void itoa(int i,char* characters);
extern int char_s_to_int(char *char_s);
extern void encaps(const char* type, const char* cmd, const char* dst, const char* src, const char* data, char* packet);
extern int route(char* packet, char *port[], int portcount);
extern bool issw(char* packet);
extern bool iscl(char* packet);
extern bool issr(char* packet);
extern bool issp(char* packet);
extern bool isap(char* packet);
extern bool isfirst(char* packet);
extern bool reqlist(char* packet);
extern bool reqrd(char* packet);
extern bool reqwr(char* packet);
extern bool reqap(char* packet);
extern bool reqacc(char* packet);
extern int getdst(char* packet);
extern int getsrc(char* packet);
extern int getcmd(char* packet);
extern int ttl(char* packet);
extern void chdst(char* buf, char* dst);
extern void chsrc(char* buf, char* src);
extern void chtype(char* buf, char* type);
extern void chcmd(char* buf, char* cmd);
extern void chdata(char* buf, char* data);
extern void chdir(char* buf);
extern void decttl(char* buf);
#endif
| 29.866667 | 120 | 0.735119 |
93738eaedcd251b60f8cfb139e8ae1b0f86d4ce1 | 7,468 | c | C | mt-drivers/mt7615d/src/mt_wifi/embedded/hw_ctrl/hdev/wmm_ctrl.c | bearking1069/openwrt-packages | eb78e080d5e3a022aa5a3acaff492283306cfc6b | [
"Apache-2.0"
] | 4 | 2020-12-30T12:46:48.000Z | 2021-01-04T08:28:13.000Z | mt-drivers/mt7615d/src/mt_wifi/embedded/hw_ctrl/hdev/wmm_ctrl.c | bearking1069/openwrt-packages | eb78e080d5e3a022aa5a3acaff492283306cfc6b | [
"Apache-2.0"
] | null | null | null | mt-drivers/mt7615d/src/mt_wifi/embedded/hw_ctrl/hdev/wmm_ctrl.c | bearking1069/openwrt-packages | eb78e080d5e3a022aa5a3acaff492283306cfc6b | [
"Apache-2.0"
] | null | null | null | /*
***************************************************************************
* MediaTek Inc.
* 4F, No. 2 Technology 5th Rd.
* Science-based Industrial Park
* Hsin-chu, Taiwan, R.O.C.
*
* (c) Copyright 1997-2012, MediaTek, Inc.
*
* All rights reserved. MediaTek source code is an unpublished work and the
* use of a copyright notice does not imply otherwise. This source code
* contains confidential trade secret material of MediaTek. Any attemp
* or participation in deciphering, decoding, reverse engineering or in any
* way altering the source code is stricitly prohibited, unless the prior
* written consent of MediaTek Technology, Inc. is obtained.
***************************************************************************
*/
#include "rt_config.h"
#include "hdev/hdev.h"
/*WMM control*/
/*Local functions*/
static BOOLEAN wcCompareEdca(EDCA_PARM *pEdcaParm, EDCA_PARM *pEdca)
{
if ((!pEdcaParm->bValid) || (!pEdca->bValid))
return FALSE;
if ((pEdca->BandIdx != pEdcaParm->BandIdx))
return FALSE;
if (os_cmp_mem(pEdca->Aifsn, pEdcaParm->Aifsn, 4))
return FALSE;
if (os_cmp_mem(pEdca->Txop, pEdcaParm->Txop, sizeof(USHORT)*4))
return FALSE;
if (os_cmp_mem(pEdca->Cwmax, pEdcaParm->Cwmax, 4))
return FALSE;
if (os_cmp_mem(pEdca->Cwmin, pEdcaParm->Cwmin, 4))
return FALSE;
return TRUE;
}
/*Export Functions*/
/*
*
*/
UINT32 WcGetWmmNum(struct hdev_ctrl *ctrl)
{
struct _RTMP_CHIP_CAP *cap = &ctrl->chip_cap;
return cap->WmmHwNum;
}
/*
*
*/
EDCA_PARM *WcGetWmmByIdx(struct hdev_ctrl *ctrl, UINT32 Idx)
{
return &ctrl->HwResourceCfg.WmmCtrl.pWmmSet[Idx];
}
/*
*
*/
VOID WcReleaseEdca(struct hdev_obj *obj)
{
EDCA_PARM *pEdca;
struct radio_dev *rdev = NULL;
struct hdev_ctrl *ctrl = NULL;
UINT32 WmmIdx;
/* TODO: Star, should remove it. */
RTMP_ADAPTER *pAd;
if (!obj || !obj->bWmmAcquired) {
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_INFO, ("%s(): Can't find HdevObj or Edca not required\n", __func__));
return;
}
rdev = obj->rdev;
ctrl = rdev->priv;
pAd = (RTMP_ADAPTER *) ctrl->priv;
pEdca = WcGetWmmByIdx(ctrl, obj->WmmIdx);
if (!pEdca || !pEdca->bValid) {
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_INFO, ("%s(): Can't find Edca for rdev: %d, Obj: %d\n",
__func__, rdev->Idx, obj->Idx));
return;
}
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_INFO,
("%s(): ObjIdx=%d,WmmIdx=%d\n", __func__, obj->Idx, obj->WmmIdx));
WmmIdx = pEdca->WmmSet;
pEdca->RefCnt--;
if (pEdca->RefCnt <= 0) {
os_zero_mem(pEdca, sizeof(EDCA_PARM));
pEdca->bValid = FALSE;
pEdca->RefCnt = 0;
pEdca->WmmSet = WmmIdx;
AsicSetEdcaParm(pAd, pEdca, pAd->wdev_list[obj->Idx]);
}
obj->WmmIdx = 0;
obj->bWmmAcquired = FALSE;
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_INFO, ("Release a WMM for ObjIdx: %d\n", obj->Idx));
}
/*
*
*/
VOID WcAcquiredEdca(struct hdev_obj *obj, EDCA_PARM *pEdcaParm)
{
struct radio_dev *rdev;
struct hdev_ctrl *ctrl;
INT32 i;
UINT32 NumOfWmm;
EDCA_PARM *pEdca, ReleaseEdca;
/* TODO: Star, should remove it. */
if (!obj) {
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_INFO, ("%s(): Can't find HdevObj\n", __func__));
return;
}
rdev = obj->rdev;
ctrl = rdev->priv;
NumOfWmm = WcGetWmmNum(ctrl);
os_zero_mem(&ReleaseEdca, sizeof(EDCA_PARM));
/*if input edca is all zero, assign default APEdca parameter*/
if (!os_cmp_mem(&ReleaseEdca, pEdcaParm, sizeof(EDCA_PARM)) || pEdcaParm->bValid != TRUE)
set_default_sta_edca_param(pEdcaParm);
pEdcaParm->BandIdx = RcGetBandIdx(rdev);
/*if can't search and WmmAcquired is not found*/
if (obj->bWmmAcquired) {
pEdca = WcGetWmmByIdx(ctrl, obj->WmmIdx);
if (wcCompareEdca(pEdca, pEdcaParm)) {
/*do nothing*/
return;
}
/*Reacquire wmm*/
WcReleaseEdca(obj);
}
for (i = 0; i < NumOfWmm; i++) {
pEdca = WcGetWmmByIdx(ctrl, i);
if (wcCompareEdca(pEdca, pEdcaParm)) {
pEdca->RefCnt++;
obj->WmmIdx = i;
obj->bWmmAcquired = TRUE;
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_INFO,
("WMM already created, assign WmmIdx:%d to ObjIdx: %d\n", i, obj->Idx));
return;
}
}
/*Bind a new WMM for band*/
for (i = 0; i < NumOfWmm; i++) {
pEdca = WcGetWmmByIdx(ctrl, i);
if (!pEdca->bValid) {
obj->WmmIdx = i;
obj->bWmmAcquired = TRUE;
os_move_mem(pEdca->Aifsn, pEdcaParm->Aifsn, 4);
os_move_mem(pEdca->Cwmax, pEdcaParm->Cwmax, 4);
os_move_mem(pEdca->Cwmin, pEdcaParm->Cwmin, 4);
os_move_mem(pEdca->Txop, pEdcaParm->Txop, sizeof(USHORT)*4);
pEdca->RefCnt = 1;
pEdca->bValid = TRUE;
pEdca->BandIdx = RcGetBandIdx(rdev);
pEdcaParm->WmmSet = i;
MTWF_LOG(DBG_CAT_HW, DBG_SUBCAT_ALL, DBG_LVL_INFO,
("Create a new WmmIdx:%d to ObjIdx: %d\n", i, obj->Idx));
return;
}
}
/*allocate a default wmm set when obj can't allocate a new once*/
for (i = 0; i < NumOfWmm; i++) {
pEdca = WcGetWmmByIdx(ctrl, i);
if (pEdca->bValid && pEdca->BandIdx == RcGetBandIdx(rdev)) {
obj->WmmIdx = i;
obj->bWmmAcquired = TRUE;
pEdca->RefCnt++;
pEdcaParm->WmmSet = i;
MTWF_LOG(DBG_CAT_HW, DBG_SUBCAT_ALL, DBG_LVL_INFO,
("assign a old WmmIdx:%d to ObjIdx: %d, but not apply new parameter\n", i, obj->Idx));
return;
}
}
MTWF_LOG(DBG_CAT_HW, DBG_SUBCAT_ALL, DBG_LVL_INFO,
("Allocate WmmSet to ObjIdx:%d fail since Wmm is full and no WmmSet can match band\n", obj->Idx));
}
/*
*
*/
VOID WcSetEdca(struct hdev_obj *obj)
{
struct radio_dev *rdev;
struct hdev_ctrl *ctrl;
EDCA_PARM *pEdca;
RTMP_ADAPTER *pAd;
rdev = obj->rdev;
ctrl = (struct hdev_ctrl *)rdev->priv;
pAd = (RTMP_ADAPTER *) ctrl->priv;
if (obj->bWmmAcquired) {
pEdca = WcGetWmmByIdx(ctrl, obj->WmmIdx);
/*set EDCA parameters from AP*/
AsicSetEdcaParm(pAd, pEdca, pAd->wdev_list[obj->Idx]);
/*Update band control */
RcUpdateWmmEntry(rdev, obj, obj->WmmIdx);
}
}
/*
*
*/
INT32 WcInit(struct hdev_ctrl *ctrl, WMM_CTRL_T *pWmmCtrl)
{
INT32 NumOfWmm = WcGetWmmNum(ctrl);
EDCA_PARM *pEdcaArray = NULL;
INT32 i = 0;
os_alloc_mem(NULL, (UCHAR **)&pEdcaArray, sizeof(EDCA_PARM)*NumOfWmm);
if (pEdcaArray == NULL)
return -1;
os_zero_mem(pEdcaArray, sizeof(EDCA_PARM)*NumOfWmm);
pWmmCtrl->pWmmSet = pEdcaArray;
for (i = 0; i < NumOfWmm; i++) {
pEdcaArray[i].bValid = FALSE;
pEdcaArray[i].WmmSet = i;
pEdcaArray[i].RefCnt = 0;
}
return 0;
}
/*
*
*/
INT32 WcExit(WMM_CTRL_T *pWmmCtrl)
{
if (pWmmCtrl->pWmmSet) {
os_free_mem(pWmmCtrl->pWmmSet);
pWmmCtrl->pWmmSet = NULL;
}
return 0;
}
/*
*
*/
VOID WcShowEdca(struct hdev_ctrl *ctrl)
{
INT i;
EDCA_PARM *pEdca = NULL;
INT32 NumOfWmm = WcGetWmmNum(ctrl);
for (i = 0; i < NumOfWmm; i++) {
pEdca = WcGetWmmByIdx(ctrl, i);
if (pEdca->bValid) {
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\tEdcaIdx: %d,BandIdx: %d, RfCnt: %d\n", pEdca->WmmSet, pEdca->BandIdx, pEdca->RefCnt));
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\tAifs: %d/%d/%d/%d\n",
pEdca->Aifsn[0], pEdca->Aifsn[1], pEdca->Aifsn[2], pEdca->Aifsn[3]));
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\tTxop: %d/%d/%d/%d\n",
pEdca->Txop[0], pEdca->Txop[1], pEdca->Txop[2], pEdca->Txop[3]));
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\tCwmin: %d/%d/%d/%d\n",
pEdca->Cwmin[0], pEdca->Cwmin[1], pEdca->Cwmin[2], pEdca->Cwmin[3]));
MTWF_LOG(DBG_CAT_ALL, DBG_SUBCAT_ALL, DBG_LVL_OFF, ("\tCwmax: %d/%d/%d/%d\n",
pEdca->Cwmax[0], pEdca->Cwmax[1], pEdca->Cwmax[2], pEdca->Cwmax[3]));
}
}
}
| 24.168285 | 144 | 0.654794 |
2b3d8c3c7d6c226dd0d050b60df60a8163c3a335 | 215 | h | C | src/gfx/defeat_tilemap.h | Narkhos/gb-tharsei | 0347b4afba10f27395e0d296da08e12dc51a23d7 | [
"MIT"
] | null | null | null | src/gfx/defeat_tilemap.h | Narkhos/gb-tharsei | 0347b4afba10f27395e0d296da08e12dc51a23d7 | [
"MIT"
] | null | null | null | src/gfx/defeat_tilemap.h | Narkhos/gb-tharsei | 0347b4afba10f27395e0d296da08e12dc51a23d7 | [
"MIT"
] | null | null | null | // This file was generated by img2gb, DO NOT EDIT
#ifndef _DEFEAT_TILEMAP_H
#define _DEFEAT_TILEMAP_H
extern const UINT8 DEFEAT_TILEMAP[];
#define DEFEAT_TILEMAP_WIDTH 20
#define DEFEAT_TILEMAP_HEIGHT 12
#endif
| 17.916667 | 49 | 0.813953 |
4dc0c8ff20a0b6f22be6ba1ff41c4ea10786edb1 | 284 | h | C | UC.Utils/UC.CommandFunctionType.h | oicawa/undercover | 816dd703200810dc77ecb9496ff6128d462eae0d | [
"MIT"
] | null | null | null | UC.Utils/UC.CommandFunctionType.h | oicawa/undercover | 816dd703200810dc77ecb9496ff6128d462eae0d | [
"MIT"
] | null | null | null | UC.Utils/UC.CommandFunctionType.h | oicawa/undercover | 816dd703200810dc77ecb9496ff6128d462eae0d | [
"MIT"
] | null | null | null | #pragma once
#include <vector>
#include <atlstr.h>
#include <functional>
typedef HRESULT(*UCCommandFunctionPointer)(const std::vector<CString>& parameters, CString& output);
using UCCommandFunction = std::function<HRESULT(const std::vector<CString>& parameters, CString& output)>;
| 28.4 | 106 | 0.774648 |
ff920f2daa76f5d1006d261f602e6a658aa6225d | 550 | h | C | Source/GUI/Button.h | Hopson97/Temp-Minecraft-Clone-Prototype | d7866fa7628a0978a0fd86b15ef330a2d8794f2d | [
"MIT"
] | 2 | 2016-10-02T16:22:52.000Z | 2016-10-02T17:36:58.000Z | Source/GUI/Button.h | Hopson97/Temp-Minecraft-Clone-Prototype | d7866fa7628a0978a0fd86b15ef330a2d8794f2d | [
"MIT"
] | null | null | null | Source/GUI/Button.h | Hopson97/Temp-Minecraft-Clone-Prototype | d7866fa7628a0978a0fd86b15ef330a2d8794f2d | [
"MIT"
] | null | null | null | #ifndef BUTTON_H
#define BUTTON_H
#include <functional>
#include "Component.h"
namespace GUI
{
class Button : public Component
{
public:
Button(const sf::RectangleShape& rect);
private:
void input (const sf::Event& e) override;
void update () {}
virtual void onClick() = 0;
virtual void onMouseTouch() = 0;
virtual void onNoInteract() = 0;
const sf::RectangleShape& m_rShape;
};
}
#endif // BUTTON_H
| 18.965517 | 57 | 0.532727 |
94e763718ce4ef484ebd2be282f95f703efd2a43 | 1,782 | h | C | XHDemo/XHDemo/General/Externs/LXHOther.h | moxuyou/XHDemo | 57d7720e506d7776da361caca36a87f109dc81f7 | [
"Apache-2.0"
] | 4 | 2017-02-14T03:37:46.000Z | 2017-02-14T04:03:25.000Z | XHDemo/XHDemo/General/Externs/LXHOther.h | moxuyou/XHDemo | 57d7720e506d7776da361caca36a87f109dc81f7 | [
"Apache-2.0"
] | null | null | null | XHDemo/XHDemo/General/Externs/LXHOther.h | moxuyou/XHDemo | 57d7720e506d7776da361caca36a87f109dc81f7 | [
"Apache-2.0"
] | null | null | null | //
// LXHOther.h
// moxuyou_Base
//
// Created by moxuyou on 2016/11/2.
// Copyright © 2016年 moxuyou. All rights reserved.
//
// 服务器地址
#define MLBApiServerAddress @"http://v3.wufazhuce.com:8000/api"
// 自定义打印 CocoaLumberjack专门用来打印日志
#define LOG_MAYBE(async, lvl, flg, ctx, tag, fnct, frmt, ...) \
do { if(lvl & flg) LOG_MACRO(async, lvl, flg, ctx, tag, fnct, frmt, ##__VA_ARGS__); } while(0)
#define LOG_LEVEL_DEF ddLogLevel
#import <CocoaLumberjack/CocoaLumberjack.h>
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
#define DDLogError(frmt, ...) LOG_MAYBE(NO, LOG_LEVEL_DEF, DDLogFlagError, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
#define DDLogWarn(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagWarning, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
#define DDLogInfo(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagInfo, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
#define DDLogDebug(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagDebug, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
#define DDLogVerbose(frmt, ...) LOG_MAYBE(LOG_ASYNC_ENABLED, LOG_LEVEL_DEF, DDLogFlagVerbose, 0, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__)
//自定义打印
#ifdef DEBUG
# define LXHLog(fmt, ...) NSLog((@"[文件名:%s], " "[函数名:%s], " "[行号:%d], [时间:%@]\n打印内容:" fmt), [[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String], __FUNCTION__, __LINE__, [LXHTools getTodayDetailDateString], ##__VA_ARGS__);
#else
# define LXHLog(...);
#endif
#ifdef Is_Release
#define NSLog(...)
#define debugMethod()
#else
#define NSLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#endif
//系统当前版本
#define lastVersion @"systemLastVersion"
| 39.6 | 243 | 0.717172 |
7fdcaefdc7d3b20c4604dd3c3c092f4fba72524f | 443 | h | C | src/plugins/opengl/src/gl_buffer.h | sunhay/halley | fc4f153956cc34d7fa02b76850e22183b8e30e25 | [
"Apache-2.0"
] | 3,262 | 2016-04-10T15:24:10.000Z | 2022-03-31T17:47:08.000Z | src/plugins/opengl/src/gl_buffer.h | sunhay/halley | fc4f153956cc34d7fa02b76850e22183b8e30e25 | [
"Apache-2.0"
] | 53 | 2016-10-09T16:25:04.000Z | 2022-01-10T13:52:37.000Z | src/plugins/opengl/src/gl_buffer.h | sunhay/halley | fc4f153956cc34d7fa02b76850e22183b8e30e25 | [
"Apache-2.0"
] | 193 | 2017-10-23T06:08:41.000Z | 2022-03-22T12:59:58.000Z | #pragma once
#include "halley_gl.h"
#include <gsl/gsl>
namespace Halley
{
class GLBuffer
{
public:
GLBuffer();
~GLBuffer();
void bind();
void bindToTarget(GLuint index);
void init(GLenum target, GLenum usage = GL_STREAM_DRAW);
void setData(gsl::span<const gsl::byte> data);
size_t getSize() const;
private:
GLenum target = 0;
GLenum usage = 0;
GLuint name = 0;
size_t capacity = 0;
size_t size = 0;
};
}
| 15.821429 | 58 | 0.656885 |
cfb9968a609fda2a3461e4daf36501fa1b281c86 | 586 | h | C | src/models/copyprofile.h | atomicparade/sticker-book-qt | 58f6f603e835a4ecfac5b58b58b87458e3fefbe6 | [
"MIT"
] | null | null | null | src/models/copyprofile.h | atomicparade/sticker-book-qt | 58f6f603e835a4ecfac5b58b58b87458e3fefbe6 | [
"MIT"
] | null | null | null | src/models/copyprofile.h | atomicparade/sticker-book-qt | 58f6f603e835a4ecfac5b58b58b87458e3fefbe6 | [
"MIT"
] | null | null | null | #ifndef COPYPROFILE_H
#define COPYPROFILE_H
#include <QString>
class CopyProfile
{
public:
enum Role
{
IsActualSizeRole = Qt::UserRole
};
CopyProfile() = default;
CopyProfile(int width, int height, bool scaleUp);
bool operator==(const CopyProfile &other) const;
int width() const;
int height() const;
bool scaleUp() const;
bool isActualSize() const;
QString name() const;
void retranslate();
private:
int _width;
int _height;
bool _scaleUp;
bool _isActualSize;
QString _name;
};
#endif // COPYPROFILE_H
| 16.742857 | 53 | 0.653584 |
320fbb250747bb0657d8ffedab74b003cf05a474 | 3,234 | c | C | ext/src/RetryPolicy/Logging.c | dave-d-code/cassandra-php-driver | 29e32d501b144b1071896c2228c32f1af6e1efcd | [
"Apache-2.0"
] | null | null | null | ext/src/RetryPolicy/Logging.c | dave-d-code/cassandra-php-driver | 29e32d501b144b1071896c2228c32f1af6e1efcd | [
"Apache-2.0"
] | null | null | null | ext/src/RetryPolicy/Logging.c | dave-d-code/cassandra-php-driver | 29e32d501b144b1071896c2228c32f1af6e1efcd | [
"Apache-2.0"
] | null | null | null | /**
* Copyright 2015-2016 DataStax, 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_driver.h"
#include "php_driver_types.h"
#include "util/types.h"
zend_class_entry *php_driver_retry_policy_logging_ce = NULL;
PHP_METHOD(Logging, __construct)
{
zval *child_policy = NULL;
php_driver_retry_policy *self, *retry_policy;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O",
&child_policy, php_driver_retry_policy_ce) == FAILURE) {
return;
}
if (instanceof_function(Z_OBJCE_P(child_policy),
php_driver_retry_policy_logging_ce TSRMLS_CC)) {
zend_throw_exception_ex(php_driver_invalid_argument_exception_ce, 0 TSRMLS_CC,
"Cannot add a " PHP_DRIVER_NAMESPACE "\\Logging as child policy of " PHP_DRIVER_NAMESPACE "\\Logging");
return;
}
self = PHP_DRIVER_GET_RETRY_POLICY(getThis());
retry_policy = PHP_DRIVER_GET_RETRY_POLICY(child_policy);
self->policy = cass_retry_policy_logging_new(retry_policy->policy);
}
ZEND_BEGIN_ARG_INFO_EX(arginfo__construct, 0, ZEND_RETURN_VALUE, 1)
PHP_DRIVER_NAMESPACE_ZEND_ARG_OBJ_INFO(0, childPolicy, RetryPolicy, 0)
ZEND_END_ARG_INFO()
static zend_function_entry php_driver_retry_policy_logging_methods[] = {
PHP_ME(Logging, __construct, arginfo__construct, ZEND_ACC_CTOR|ZEND_ACC_PUBLIC)
PHP_FE_END
};
static zend_object_handlers php_driver_retry_policy_logging_handlers;
static void
php_driver_retry_policy_logging_free(php5to7_zend_object_free *object TSRMLS_DC)
{
php_driver_retry_policy *self = PHP5TO7_ZEND_OBJECT_GET(retry_policy, object);
if (self->policy) {
cass_retry_policy_free(self->policy);
}
zend_object_std_dtor(&self->zval TSRMLS_CC);
PHP5TO7_MAYBE_EFREE(self);
}
static php5to7_zend_object
php_driver_retry_policy_logging_new(zend_class_entry *ce TSRMLS_DC)
{
php_driver_retry_policy *self = PHP5TO7_ZEND_OBJECT_ECALLOC(retry_policy, ce);
self->policy = NULL;
PHP5TO7_ZEND_OBJECT_INIT_EX(retry_policy, retry_policy_logging, self, ce);
}
void php_driver_define_RetryPolicyLogging(TSRMLS_D)
{
zend_class_entry ce;
INIT_CLASS_ENTRY(ce, PHP_DRIVER_NAMESPACE "\\RetryPolicy\\Logging", php_driver_retry_policy_logging_methods);
php_driver_retry_policy_logging_ce = zend_register_internal_class(&ce TSRMLS_CC);
zend_class_implements(php_driver_retry_policy_logging_ce TSRMLS_CC, 1, php_driver_retry_policy_ce);
php_driver_retry_policy_logging_ce->ce_flags |= PHP5TO7_ZEND_ACC_FINAL;
php_driver_retry_policy_logging_ce->create_object = php_driver_retry_policy_logging_new;
memcpy(&php_driver_retry_policy_logging_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
}
| 35.538462 | 131 | 0.785405 |
1910ee2d61bdbf807394c0caff8693b3f8ba30db | 3,092 | h | C | FECore/FEClosestPointProjection.h | AlexandraAllan23/FEBio | c94a1c30e0bae5f285c0daae40a7e893e63cff3c | [
"MIT"
] | 59 | 2020-06-15T12:38:49.000Z | 2022-03-29T19:14:47.000Z | FECore/FEClosestPointProjection.h | AlexandraAllan23/FEBio | c94a1c30e0bae5f285c0daae40a7e893e63cff3c | [
"MIT"
] | 36 | 2020-06-14T21:10:01.000Z | 2022-03-12T12:03:14.000Z | FECore/FEClosestPointProjection.h | AlexandraAllan23/FEBio | c94a1c30e0bae5f285c0daae40a7e893e63cff3c | [
"MIT"
] | 26 | 2020-06-25T15:02:13.000Z | 2022-03-10T09:14:03.000Z | /*This file is part of the FEBio source code and is licensed under the MIT license
listed below.
See Copyright-FEBio.txt for details.
Copyright (c) 2020 University of Utah, The Trustees of Columbia University in
the City of New York, and others.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.*/
#pragma once
#include "FESurface.h"
#include "FENNQuery.h"
#include "FEElemElemList.h"
#include "FENodeElemList.h"
//-----------------------------------------------------------------------------
// This class can be used to find the closest point projection of a point
// onto a surface.
class FECORE_API FEClosestPointProjection
{
public:
//! constructor
FEClosestPointProjection(FESurface& s);
//! Initialization
bool Init();
//! Project a point onto surface
FESurfaceElement* Project(const vec3d& x, vec3d& q, vec2d& r);
//! Project a node onto a surface
FESurfaceElement* Project(int n, vec3d& q, vec2d& r);
//! Project a point of a surface element onto a surface
FESurfaceElement* Project(FESurfaceElement* pse, int intgrPoint, vec3d& q, vec2d& r);
public:
//! Set the projection tolerance
void SetTolerance(double t) { m_tol = t; }
//! get the projection tolerance
double GetTolerance() { return m_tol; }
//! Set the search radius (used in self-projection)
void SetSearchRadius(double s) { m_rad = s; }
//! set if the projection should handle special cases
void HandleSpecialCases(bool b) { m_bspecial = b; }
//! set if boundary projections are allowed
void AllowBoundaryProjections(bool b) { m_projectBoundary = b; }
private:
bool ContainsElement(FESurfaceElement* el);
FESurfaceElement* ProjectSpecial(int closestPoint, const vec3d& x, vec3d& q, vec2d& r);
protected:
double m_tol; //!< projection tolerance
double m_rad; //!< search radius
bool m_bspecial; //!< try to handle special cases
bool m_projectBoundary; //!< allow boundary projections
protected:
FESurface& m_surf; //!< reference to surface
FENNQuery m_SNQ; //!< used to find the nearest neighbour
FENodeElemList m_NEL; //!< node-element tree
FEElemElemList m_EEL; //!< element neighbor list
};
| 35.136364 | 88 | 0.741591 |
aababba2740963a685c8dea1336a2ef5562c718e | 1,929 | h | C | engine/internal_cmd.h | cristivlas/zerobugs | 5f080c8645b123d7887fd8a64f60e8d226e3b1d5 | [
"BSL-1.0"
] | 2 | 2018-03-19T23:27:47.000Z | 2018-06-24T16:15:19.000Z | engine/internal_cmd.h | cristivlas/zerobugs | 5f080c8645b123d7887fd8a64f60e8d226e3b1d5 | [
"BSL-1.0"
] | null | null | null | engine/internal_cmd.h | cristivlas/zerobugs | 5f080c8645b123d7887fd8a64f60e8d226e3b1d5 | [
"BSL-1.0"
] | 1 | 2021-11-28T05:39:05.000Z | 2021-11-28T05:39:05.000Z | #ifndef INTERNAL_COMMAND_H__0B135951_4AC0_450A_9380_E7E10DD2A3FA
#define INTERNAL_COMMAND_H__0B135951_4AC0_450A_9380_E7E10DD2A3FA
//
// $Id$
//
// -------------------------------------------------------------------------
// This file is part of ZeroBugs, Copyright (c) 2010 Cristian L. Vlasceanu
//
// 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)
// -------------------------------------------------------------------------
#include <vector>
#include <string>
#include "zdk/command.h"
#include "zdk/zero.h"
class DebuggerShell;
typedef bool
(DebuggerShell::*CommandFun)(Thread*, const std::vector<std::string>& args);
// Auto-completion hook for readline().
// First parameter is currently typed word, second param is a
// list of possible matches to be filled out by the hook function
typedef void
(*AutoCompleteHook)(const char*, std::vector<std::string>&);
class ZDK_LOCAL InternalCommand : public ZObjectImpl<DebuggerCommand>
{
public:
explicit InternalCommand(const Command&);
virtual ~InternalCommand() throw();
protected:
const char* name() const { return name_; }
const char* help() const { return help_; }
void auto_complete(const char*, EnumCallback<const char*>*) const;
bool execute(Thread*, const char* const*, Unknown2*);
BEGIN_INTERFACE_MAP(InternalCommand)
INTERFACE_ENTRY(DebuggerCommand)
END_INTERFACE_MAP()
private:
const char* name_;
const char* help_;
CommandFun fun_;
AutoCompleteHook hook_;
};
struct ZDK_LOCAL Command
{
const char* name;
CommandFun fun;
AutoCompleteHook autoComplete;
const char* help;
//InternalCommand* construct() const
//{ return new InternalCommand(*this); }
};
#endif // INTERNAL_COMMAND_H__0B135951_4AC0_450A_9380_E7E10DD2A3FA
// vim: tabstop=4:softtabstop=4:expandtab:shiftwidth=4
| 25.381579 | 76 | 0.681182 |
5cf029f0bebfe3c4aa3c7bdd99cccea57bc9b6d3 | 785 | h | C | src/cpp/include/nodegui/QtGui/QEvent/QMouseEvent/qmouseevent_wrap.h | blncd2020/nodegui | a0522ccce399cf92b455a3f0e2ee2d7109ce914f | [
"MIT"
] | null | null | null | src/cpp/include/nodegui/QtGui/QEvent/QMouseEvent/qmouseevent_wrap.h | blncd2020/nodegui | a0522ccce399cf92b455a3f0e2ee2d7109ce914f | [
"MIT"
] | null | null | null | src/cpp/include/nodegui/QtGui/QEvent/QMouseEvent/qmouseevent_wrap.h | blncd2020/nodegui | a0522ccce399cf92b455a3f0e2ee2d7109ce914f | [
"MIT"
] | null | null | null | #pragma once
#include <napi.h>
#include <QMouseEvent>
#include "core/Component/component_macro.h"
class QMouseEventWrap : public Napi::ObjectWrap<QMouseEventWrap> {
COMPONENT_WRAPPED_METHODS_DECLARATION
private:
QMouseEvent* instance;
public:
static Napi::Object init(Napi::Env env, Napi::Object exports);
QMouseEventWrap(const Napi::CallbackInfo& info);
~QMouseEventWrap();
QMouseEvent* getInternalInstance();
// class constructor
static Napi::FunctionReference constructor;
// wrapped methods
Napi::Value button(const Napi::CallbackInfo& info);
Napi::Value x(const Napi::CallbackInfo& info);
Napi::Value y(const Napi::CallbackInfo& info);
Napi::Value globalX(const Napi::CallbackInfo& info);
Napi::Value globalY(const Napi::CallbackInfo& info);
}; | 28.035714 | 66 | 0.75414 |
65e51a4832ce32ced8b2b761e168f71b93d8a436 | 4,072 | h | C | shared/lib/netxduo/addons/azure_iot/azure_iot_security_module/iot-security-module-core/deps/flatcc/include/flatcc/portable/pstdalign.h | likidu/stm32u5-getting-started | 619888cef6d6117b3212ff5b12f4b5b3e7041f7a | [
"MIT"
] | null | null | null | shared/lib/netxduo/addons/azure_iot/azure_iot_security_module/iot-security-module-core/deps/flatcc/include/flatcc/portable/pstdalign.h | likidu/stm32u5-getting-started | 619888cef6d6117b3212ff5b12f4b5b3e7041f7a | [
"MIT"
] | null | null | null | shared/lib/netxduo/addons/azure_iot/azure_iot_security_module/iot-security-module-core/deps/flatcc/include/flatcc/portable/pstdalign.h | likidu/stm32u5-getting-started | 619888cef6d6117b3212ff5b12f4b5b3e7041f7a | [
"MIT"
] | null | null | null | #ifndef PSTDALIGN_H
#define PSTDALIGN_H
/*
* NOTE: aligned_alloc is defined via paligned_alloc.h
* and requires aligned_free to be fully portable although
* free also works on C11 and platforms with posix_memalign.
*
* NOTE: C++11 defines alignas as a keyword but then also defines
* __alignas_is_defined.
*
* C++14 does not define __alignas_is_defined, at least sometimes.
*
* GCC 8.3 reverts on this and makes C++11 behave the same as C++14
* preventing a simple __cplusplus version check from working.
*
* Clang C++ without std=c++11 or std=c++14 does define alignas
* but does so incorrectly wrt. C11 and C++11 semantics because
* `alignas(4) float x;` is not recognized.
* To fix such issues, either move to a std version, or
* include a working stdalign.h for the given compiler before
* this file.
*
* newlib defines _Alignas and _Alignof in sys/cdefs but rely on
* gcc version for <stdaligh.h> which can lead to conflicts if
* stdalign is not included.
*
* newlibs need for <stdalign.h> conflicts with broken C++ stdalign
* but this can be fixed be using std=C++11 or newer.
*
* MSVC does not support <stdalign.h> at least up to MSVC 2015,
* but does appear to support alignas and alignof keywords in
* recent standard C++.
*
* If stdalign.h is supported but heuristics in this file are
* insufficient to detect this, try including <stdaligh.h> manually
* or define HAVE_STDALIGN_H.
*/
/* https://github.com/dvidelabs/flatcc/issues/130 */
#ifndef __alignas_is_defined
#if defined(__cplusplus)
#if __cplusplus == 201103 && !defined(__clang__) && ((__GNUC__ > 8) || (__GNUC__ == 8 && __GNUC_MINOR__ >= 3))
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#include <stdalign.h>
#endif
#endif
#endif
/* Allow for alternative solution to be included first. */
#ifndef __alignas_is_defined
#ifdef __cplusplus
#if defined(PORTABLE_PATCH_CPLUSPLUS_STDALIGN)
#include <stdalign.h>
#undef alignas
#define alignas(t) __attribute__((__aligned__(t)))
#endif
#endif
#if !defined(PORTABLE_HAS_INCLUDE_STDALIGN)
#if defined(__has_include)
#if __has_include(<stdalign.h>)
#define PORTABLE_HAS_INCLUDE_STDALIGN 1
#else
#define PORTABLE_HAS_INCLUDE_STDALIGN 0
#endif
#endif
#endif
/* https://lists.gnu.org/archive/html/bug-gnulib/2015-08/msg00003.html */
#if defined(__cplusplus)
#if !defined(_MSC_VER)
#include <stdalign.h>
#endif
#if __cplusplus > 201103
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#endif
#elif PORTABLE_HAS_INCLUDE_STDALIGN
#include <stdalign.h>
#elif !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
#include <stdalign.h>
#elif defined(HAVE_STDALIGN_H)
#include <stdaligh.h>
#endif
#endif /* __alignas_is_defined */
#ifndef __alignas_is_defined
#ifdef __cplusplus
extern "C" {
#endif
#if (!defined(__clang__) && defined(__GNUC__) && \
((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)))
#undef PORTABLE_C11_STDALIGN_MISSING
#define PORTABLE_C11_STDALIGN_MISSING
#endif
#if defined(__IBMC__)
#undef PORTABLE_C11_STDALIGN_MISSING
#define PORTABLE_C11_STDALIGN_MISSING
#endif
#if ((defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && \
!defined(PORTABLE_C11_STDALIGN_MISSING))
/* C11 or newer */
#include <stdalign.h>
#else
#if defined(__GNUC__) || defined(__IBM_ALIGNOF__) || defined(__clang__)
#ifndef _Alignas
#define _Alignas(t) __attribute__((__aligned__(t)))
#endif
#ifndef _Alignof
#define _Alignof(t) __alignof__(t)
#endif
#elif defined(_MSC_VER)
#define _Alignas(t) __declspec (align(t))
#define _Alignof(t) __alignof(t)
#elif defined(__CCRX__)
#define alignas(t)
#define alignof(t)
#else
#error please update pstdalign.h with support for current compiler and library
#endif
#endif /* __STDC__ */
#ifndef alignas
#define alignas _Alignas
#endif
#ifndef alignof
#define alignof _Alignof
#endif
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#ifdef __cplusplus
}
#endif
#endif /* __alignas__is_defined */
#include "paligned_alloc.h"
#endif /* PSTDALIGN_H */
| 26.102564 | 110 | 0.750982 |
d06f3cba78c185c6c73019ded1ed46215b8b9b99 | 99 | c | C | packages/PIPS/validation/Semantics-New/Pointer.sub/return01.c | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
] | 51 | 2015-01-31T01:51:39.000Z | 2022-02-18T02:01:50.000Z | packages/PIPS/validation/Semantics-New/Pointer.sub/return01.c | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
] | 7 | 2017-05-29T09:29:00.000Z | 2019-03-11T16:01:39.000Z | packages/PIPS/validation/Semantics-New/Pointer.sub/return01.c | DVSR1966/par4all | 86b33ca9da736e832b568c5637a2381f360f1996 | [
"MIT"
] | 12 | 2015-03-26T08:05:38.000Z | 2022-02-18T02:01:51.000Z | // Verify that we return *p=i=0
int main()
{
int i = 0;
int *p;
p=&i;
return *p;
}
| 7.615385 | 31 | 0.464646 |
d0acccf92a4cb2d789028e171ae96785ed80c9e5 | 5,836 | h | C | src/node.h | gitqifan/jittor | 0a5bd61bf46179c1316b66d5e26498960bbd3b88 | [
"Apache-2.0"
] | null | null | null | src/node.h | gitqifan/jittor | 0a5bd61bf46179c1316b66d5e26498960bbd3b88 | [
"Apache-2.0"
] | null | null | null | src/node.h | gitqifan/jittor | 0a5bd61bf46179c1316b66d5e26498960bbd3b88 | [
"Apache-2.0"
] | null | null | null | // ***************************************************************
// Copyright (c) 2020 Jittor. Authors: Dun Liang <randonlang@gmail.com>. All Rights Reserved.
// This file is subject to the terms and conditions defined in
// file 'LICENSE.txt', which is part of this source code package.
// ***************************************************************
#pragma once
#include "common.h"
#include "misc/nano_string.h"
#include "misc/nano_vector.h"
#include "pybind/py_var_tracer.h"
namespace jittor {
extern unordered_map<void*, int64> lived_nodes;
extern int64 total_node;
struct NodeFlags {
typedef uint16 nf_t;
nf_t flags=0;
enum Flags {
// bit0: is_var
_var=0,
// bit1: state
_finished=1,
// bit2: stop grad
_stop_grad=2,
// bit3: is fetch
_fetch=3,
_n=4,
// var related flags
_force_fuse=_n+0,
_stop_fuse=_n+1,
_in_update_queue=_n+2,
// op related flags
// bit0: support cpu
_cpu=_n+0,
// bit1: support cuda
_cuda=_n+1,
// bit2: forward op
_forwarded=_n+2,
// bit3: vary shape op
_vary_shape=_n+3,
// bit4~5: op type
_op_type=_n+4, _op_type_nbits=2,
};
inline void set(Flags f, int a=1, int nbits=1) {
nf_t mask = (((1u<<nbits)-1)<<f);
flags = (flags & ~mask) | ((a<<f)&mask);
}
inline nf_t get(Flags f, int nbits=1) const {
return (flags>>f) & ((1u<<nbits)-1);
}
};
struct Node {
struct input_t;
struct output_t;
struct var_output_t {
Op* op;
int index;
};
struct input_t {
Node* node;
list<output_t>::iterator back;
input_t(Node* n) : node(n) {}
operator Node*() { return node; }
operator Op*() { return (Op*)node; }
operator Var*() { return (Var*)node; }
};
struct output_t {
Node* node;
int index;
list<input_t>::iterator back;
output_t(Node* n, int i) : node(n), index(i) {}
operator Node*() { return node; }
operator Op*() { return (Op*)node; }
operator Var*() { return (Var*)node; }
operator var_output_t() { return {(Op*)node, index}; }
};
static int64_t tflag_count;
NodeFlags flags;
NanoString ns;
inline bool is_var() const { return flags.get(NodeFlags::_var); }
inline bool is_stop_grad() const { return flags.get(NodeFlags::_stop_grad); }
inline bool is_finished() const { return flags.get(NodeFlags::_finished); }
// forward_liveness can propergate forward(from input to output)
// f1. var_holder contrib one forward_liveness
// f2. var ptr contrib one forward_liveness
// f3. input(has_grad and f>0) contrib one forward_liveness
int forward_liveness = 0;
// forward_liveness can propergate backward(from output to input)
// b1. var ptr contrib one backward_liveness
// b2. var holder contrib one backward_liveness
// b3. output(b>0) contrib one backward_liveness
int backward_liveness = 0;
// pending liveness can propergate backward(from output to input)
// p1: pending and f>0 and b>0 contrib pending_liveness
// p2: output(p>0 and pending) contrib pending_liveness
int pending_liveness = 0;
inline bool need_free()
{ return !pending_liveness && (!forward_liveness || !backward_liveness); }
int64_t tflag = 0;
int64_t custom_data;
list<input_t> _inputs;
list<output_t> _outputs;
#ifdef NODE_MEMCHECK
inline Node() {
lived_nodes[(void*)this] = ++total_node;
registe_node_trace(this);
}
inline virtual ~Node() {
lived_nodes.erase((void*)this);
unregiste_node_trace(this);
}
#else
inline Node() {};
inline virtual ~Node() {};
#endif
inline Var* var() { return (Var*)this; }
inline Op* op() { return (Op*)this; }
inline Node* node() { return this; }
void free();
// this function is used for debug memory
inline bool exist() const {
#ifdef NODE_MEMCHECK
return lived_nodes.count((void*)this);
#else
return true;
#endif
}
void memcheck_all_exist() const;
inline int64 __id() const {
#ifdef NODE_MEMCHECK
return lived_nodes.at((void*)this);
#else
return 0;
#endif
}
// release from counter and memory checker
void __release();
#define CHECK_NODE_EXIST(node) \
ASSERT(node->exist()) << "Node("#node")" << (void*)node << "not exist."
#define CHECK_EXIST CHECK_NODE_EXIST(this)
#define CHECK_NODE_EXIST2(a,b) \
CHECK_NODE_EXIST(a); CHECK_NODE_EXIST(b);
#define CHECK_NODE_EXIST3(a,b,c) \
CHECK_NODE_EXIST2(a,b); CHECK_NODE_EXIST(c);
inline Caster<Node*, Node::input_t> inputs() { CHECK_EXIST; return &_inputs; }
inline Caster<Node*, Node::output_t> outputs() { CHECK_EXIST; return &_outputs; }
inline Node* input(uint i) {
CHECK_EXIST;
auto iter = _inputs.begin();
while (i--) iter++;
return iter->node;
}
inline Node* output(uint i) {
CHECK_EXIST;
auto iter = _outputs.begin();
while (i--) iter++;
return iter->node;
}
void release_inputs();
void set_inputs(list<Node*> nodes);
void add_inputs(const vector<Node*>& nodes);
void add_inputs(const vector<Var*>& nodes);
void release_forward_liveness();
void own_forward_liveness();
void release_backward_liveness();
void own_backward_liveness();
void release_pending_liveness();
void own_pending_liveness();
void release_both_liveness();
void own_both_liveness();
void finish_pending_liveness();
void set_stop_grad();
};
std::ostream& operator<<(std::ostream& os, const Node* node);
} // jittor | 30.878307 | 93 | 0.601782 |
456f9f0a065a9ad230fb5e76e262a4748815ccca | 1,043 | c | C | Pods/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c | Neilcc/ss-iOS | cf2a9d8ca02ead10b0edf6f94917e2357dec37cb | [
"Apache-2.0"
] | 11,356 | 2017-12-08T19:42:32.000Z | 2022-03-31T16:55:25.000Z | Pods/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c | hdw09/shadowsocks-iOS | 76ed99f6daf1368993b7cebbe6fb5bab39cea2eb | [
"Apache-2.0"
] | 2,402 | 2017-12-08T22:31:01.000Z | 2022-03-28T19:25:52.000Z | Pods/libsodium/src/libsodium/crypto_secretbox/crypto_secretbox.c | hdw09/shadowsocks-iOS | 76ed99f6daf1368993b7cebbe6fb5bab39cea2eb | [
"Apache-2.0"
] | 1,343 | 2017-12-08T19:47:19.000Z | 2022-03-26T11:31:36.000Z |
#include "crypto_secretbox.h"
size_t
crypto_secretbox_keybytes(void)
{
return crypto_secretbox_KEYBYTES;
}
size_t
crypto_secretbox_noncebytes(void)
{
return crypto_secretbox_NONCEBYTES;
}
size_t
crypto_secretbox_zerobytes(void)
{
return crypto_secretbox_ZEROBYTES;
}
size_t
crypto_secretbox_boxzerobytes(void)
{
return crypto_secretbox_BOXZEROBYTES;
}
size_t
crypto_secretbox_macbytes(void)
{
return crypto_secretbox_MACBYTES;
}
const char *
crypto_secretbox_primitive(void)
{
return crypto_secretbox_PRIMITIVE;
}
int
crypto_secretbox(unsigned char *c, const unsigned char *m,
unsigned long long mlen, const unsigned char *n,
const unsigned char *k)
{
return crypto_secretbox_xsalsa20poly1305(c, m, mlen, n, k);
}
int
crypto_secretbox_open(unsigned char *m, const unsigned char *c,
unsigned long long clen, const unsigned char *n,
const unsigned char *k)
{
return crypto_secretbox_xsalsa20poly1305_open(m, c, clen, n, k);
}
| 18.963636 | 70 | 0.723873 |
e75b71275dd345338c4402f78e1f7152106fcc7e | 2,726 | h | C | arch/mips/xburst/common/mips_types.h | flyghost/OneOS-V2.1.0 | 6fedab0558c07fe679d63ba1eb8ee9992c044d86 | [
"Apache-2.0"
] | 1 | 2022-03-26T09:59:37.000Z | 2022-03-26T09:59:37.000Z | arch/mips/xburst/common/mips_types.h | flyghost/OneOS-V2.1.0 | 6fedab0558c07fe679d63ba1eb8ee9992c044d86 | [
"Apache-2.0"
] | 1 | 2021-06-24T04:27:40.000Z | 2021-06-24T04:27:40.000Z | arch/mips/xburst/common/mips_types.h | flyghost/OneOS-V2.1.0 | 6fedab0558c07fe679d63ba1eb8ee9992c044d86 | [
"Apache-2.0"
] | 2 | 2021-06-24T04:08:28.000Z | 2022-03-07T06:37:24.000Z | /**
***********************************************************************************************************************
* Copyright (c) 2020, China Mobile Communications Group Co.,Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*
* @file mips_types.h
*
* @brief This file is part of OneOS.
*
* @revision
* Date Author Notes
* 2020-11-17 OneOS Team First version.
***********************************************************************************************************************
*/
#ifndef _MIPS_TYPES_H_
#define _MIPS_TYPES_H_
#ifndef __ASSEMBLY__
typedef unsigned short umode_t;
/*
* __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
* header files exported to user space
*/
typedef __signed__ char __s8;
typedef unsigned char __u8;
typedef __signed__ short __s16;
typedef unsigned short __u16;
typedef __signed__ int __s32;
typedef unsigned int __u32;
#if (_MIPS_SZLONG == 64)
typedef __signed__ long __s64;
typedef unsigned long __u64;
#else
#if defined(__GNUC__)
__extension__ typedef __signed__ long long __s64;
__extension__ typedef unsigned long long __u64;
#endif
#endif
/*
* These aren't exported outside the kernel to avoid name space clashes
*/
#define BITS_PER_LONG _MIPS_SZLONG
typedef __signed char s8;
typedef unsigned char u8;
typedef __signed short s16;
typedef unsigned short u16;
typedef __signed int s32;
typedef unsigned int u32;
#if (_MIPS_SZLONG == 64)
typedef __signed__ long s64;
typedef unsigned long u64;
#else
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
typedef __signed__ long long s64;
typedef unsigned long long u64;
#endif
#endif
#if (defined(CONFIG_HIGHMEM) && defined(CONFIG_64BIT_PHYS_ADDR)) \
|| defined(CONFIG_64BIT)
typedef u64 dma_addr_t;
typedef u64 phys_addr_t;
typedef u64 phys_size_t;
#else
typedef u32 dma_addr_t;
typedef u32 phys_addr_t;
typedef u32 phys_size_t;
#endif
typedef u64 dma64_addr_t;
/*
* Don't use phys_t. You've been warned.
*/
#ifdef CONFIG_64BIT_PHYS_ADDR
typedef unsigned long long phys_t;
#else
typedef unsigned long phys_t;
#endif
#endif /* __ASSEMBLY__ */
#endif /* _MIPS_TYPES_H_ */
| 23.101695 | 120 | 0.668379 |
e77060b47d4f26fcdbc2b57d8dc8c2cd3f999212 | 2,017 | h | C | winrt/impl/Windows.Networking.1.h | mthiesen/xbocontroller-winapi | b4a1e053476f200877bcfaeb564c59cd024a697b | [
"MIT"
] | null | null | null | winrt/impl/Windows.Networking.1.h | mthiesen/xbocontroller-winapi | b4a1e053476f200877bcfaeb564c59cd024a697b | [
"MIT"
] | null | null | null | winrt/impl/Windows.Networking.1.h | mthiesen/xbocontroller-winapi | b4a1e053476f200877bcfaeb564c59cd024a697b | [
"MIT"
] | null | null | null | // WARNING: Please don't edit this file. It was generated by C++/WinRT v2.3.4.5
#ifndef WINRT_Windows_Networking_1_H
#define WINRT_Windows_Networking_1_H
#include "winrt/impl/Windows.Networking.0.h"
WINRT_EXPORT namespace winrt::Windows::Networking
{
struct __declspec(empty_bases) IEndpointPair :
Windows::Foundation::IInspectable,
impl::consume_t<IEndpointPair>
{
IEndpointPair(std::nullptr_t = nullptr) noexcept {}
IEndpointPair(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) IEndpointPairFactory :
Windows::Foundation::IInspectable,
impl::consume_t<IEndpointPairFactory>
{
IEndpointPairFactory(std::nullptr_t = nullptr) noexcept {}
IEndpointPairFactory(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) IHostName :
Windows::Foundation::IInspectable,
impl::consume_t<IHostName>
{
IHostName(std::nullptr_t = nullptr) noexcept {}
IHostName(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) IHostNameFactory :
Windows::Foundation::IInspectable,
impl::consume_t<IHostNameFactory>
{
IHostNameFactory(std::nullptr_t = nullptr) noexcept {}
IHostNameFactory(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
};
struct __declspec(empty_bases) IHostNameStatics :
Windows::Foundation::IInspectable,
impl::consume_t<IHostNameStatics>
{
IHostNameStatics(std::nullptr_t = nullptr) noexcept {}
IHostNameStatics(void* ptr, take_ownership_from_abi_t) noexcept : Windows::Foundation::IInspectable(ptr, take_ownership_from_abi) {}
};
}
#endif
| 44.822222 | 144 | 0.722856 |
2ed959ad9040e7122acb64d0cf8c13d22d011511 | 110 | h | C | project/ST32F103/drive/pwm_dac/pwm_dac.h | sizebyte/DouDou | c760a9d24e779164d14537011abe8ca5556e3408 | [
"MIT"
] | null | null | null | project/ST32F103/drive/pwm_dac/pwm_dac.h | sizebyte/DouDou | c760a9d24e779164d14537011abe8ca5556e3408 | [
"MIT"
] | null | null | null | project/ST32F103/drive/pwm_dac/pwm_dac.h | sizebyte/DouDou | c760a9d24e779164d14537011abe8ca5556e3408 | [
"MIT"
] | null | null | null | #ifndef _pwm_dac_H
#define _pwm_dac_H
#include "system.h"
void TIM4_CH1_PWM_Init(u16 arr,u16 psc);
#endif
| 11 | 40 | 0.763636 |
4e42168124f9e63712fb29d07d0efe98f1bf0b8b | 97 | c | C | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/cpp/if-div.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/cpp/if-div.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/cpp/if-div.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | /* { dg-do preprocess } */
/* Test that this preprocesses without error. */
#if (-1)/2
#endif
| 13.857143 | 49 | 0.608247 |
bd242d1f90d782a64ac6622a67f92db230ad4c88 | 6,035 | h | C | include/lib/clx/lexical_cast.h | ry-shika/Geister-cpp-lib | d8630185e19fe06c5b2bf63ee0f37d665d7f357b | [
"BSL-1.0"
] | 1 | 2019-11-27T14:41:28.000Z | 2019-11-27T14:41:28.000Z | include/lib/clx/lexical_cast.h | ry-shika/Geister-cpp-lib | d8630185e19fe06c5b2bf63ee0f37d665d7f357b | [
"BSL-1.0"
] | 40 | 2019-06-19T04:54:55.000Z | 2020-10-25T17:58:31.000Z | include/lib/clx/lexical_cast.h | ry-shika/Geister-cpp-lib | d8630185e19fe06c5b2bf63ee0f37d665d7f357b | [
"BSL-1.0"
] | 3 | 2021-05-25T08:26:26.000Z | 2021-06-22T08:26:39.000Z | /* ------------------------------------------------------------------------- */
/*
* lexical_cast.h
*
* Copyright (c) 2004 - 2008, clown. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - No names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* 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)
*
* Last-modified: Tue 26 Aug 2008 07:06:00 JST
*/
/* ------------------------------------------------------------------------- */
#ifndef CLX_LEXICAL_CAST_H
#define CLX_LEXICAL_CAST_H
#include "config.h"
#include <sstream>
#include <string>
#include <ios>
#include <iomanip>
#include <iostream>
#include <typeinfo>
namespace clx {
/* --------------------------------------------------------------------- */
// bad_lexical_cast
/* --------------------------------------------------------------------- */
class bad_lexical_cast : public std::bad_cast {
public:
bad_lexical_cast() : source_(&typeid(void)), target_(&typeid(void)) {}
explicit bad_lexical_cast(const std::type_info& source, const std::type_info& target) :
source_(&source), target_(&target) {}
virtual ~bad_lexical_cast() throw() {}
const std::type_info& source_type() const { return *source_; }
const std::type_info& target_type() const { return *target_; }
virtual const char* what() const throw() {
return "bad lexical cast";
}
private:
const std::type_info* source_;
const std::type_info* target_;
};
namespace detail {
/* ----------------------------------------------------------------- */
// stream_char
/* ----------------------------------------------------------------- */
template <typename Type>
struct stream_char {
typedef char type;
};
/* ----------------------------------------------------------------- */
// widest_char
/* ----------------------------------------------------------------- */
template <typename TypeChar, typename SourceChar>
struct widest_char {
typedef TypeChar type;
};
#ifdef CLX_USE_WCHAR
/* ----------------------------------------------------------------- */
// wchar_t support
/* ----------------------------------------------------------------- */
template <class CharT, class Traits, class Alloc>
struct stream_char<std::basic_string<CharT, Traits, Alloc> > {
typedef CharT type;
};
template <>
struct stream_char<wchar_t> {
typedef wchar_t type;
};
template <>
struct stream_char<wchar_t*> {
typedef wchar_t type;
};
template <>
struct stream_char<const wchar_t*> {
typedef wchar_t type;
};
template <>
struct widest_char<char, wchar_t> {
typedef wchar_t type;
};
#endif // CLX_USE_WCHAR
};
/* --------------------------------------------------------------------- */
// cast_stream
/* --------------------------------------------------------------------- */
template <class Type, class Source>
class cast_stream {
public:
typedef Source src_type;
typedef Type dest_type;
typedef typename detail::widest_char<
typename detail::stream_char<Type>::type,
typename detail::stream_char<Source>::type
>::type char_type;
typedef std::basic_string<char_type> string_type;
typedef std::basic_stringstream<char_type> internal_stream;
// constructor and destructor
explicit cast_stream(std::ios::fmtflags base = std::ios::dec) : ss_() {
ss_.setf(base, std::ios::basefield);
}
virtual ~cast_stream() {}
// operator
bool operator<<(const src_type& src) {
ss_ << std::setiosflags(std::ios::fixed);
return !(ss_ << src).fail();
}
template <class ValueT>
bool operator>>(ValueT& dest) {
return !(ss_ >> dest).fail();
}
// speciallized for string_type;
bool operator>>(string_type& dest) {
dest = ss_.str();
return true;
}
private:
internal_stream ss_;
};
/* --------------------------------------------------------------------- */
/*!
* lexical_cast
*
* The lexical_cast class is a sub-set class of boost::lexical_cast.
* Scale back the function of wide string support.
*/
/* --------------------------------------------------------------------- */
template <class Type, class Source>
inline Type lexical_cast(const Source& src, std::ios::fmtflags base = std::ios::dec) {
Type dest;
if (typeid(Source) == typeid(Type)) return *((Type*)&src); // no needs to convert
cast_stream<Type, Source> ss(base);
if(!(ss << src && ss >> dest)) {
throw bad_lexical_cast(typeid(Source), typeid(Type));
}
return dest;
}
}
#endif // CLX_LEXICAL_CAST_H
| 32.621622 | 89 | 0.576802 |
ae7af4624cd87a5188cb6dcbce770e907377777e | 2,489 | h | C | features/lorawan/lorastack/phy/LoRaPHYKR920.h | pattyolanterns/mbed-os | f05af9a870580a0a81688e4d8f94cf72ca17a4d6 | [
"Apache-2.0"
] | 3,897 | 2015-09-04T13:42:23.000Z | 2022-03-30T16:53:07.000Z | features/lorawan/lorastack/phy/LoRaPHYKR920.h | pattyolanterns/mbed-os | f05af9a870580a0a81688e4d8f94cf72ca17a4d6 | [
"Apache-2.0"
] | 13,030 | 2015-09-17T10:30:05.000Z | 2022-03-31T13:36:44.000Z | features/lorawan/lorastack/phy/LoRaPHYKR920.h | pattyolanterns/mbed-os | f05af9a870580a0a81688e4d8f94cf72ca17a4d6 | [
"Apache-2.0"
] | 2,950 | 2015-09-08T19:07:05.000Z | 2022-03-31T13:37:23.000Z | /**
* @file LoRaPHYKR920.h
*
* @brief Implements LoRaPHY for Korean 920 MHz band
*
* \code
* ______ _
* / _____) _ | |
* ( (____ _____ ____ _| |_ _____ ____| |__
* \____ \| ___ | (_ _) ___ |/ ___) _ \
* _____) ) ____| | | || |_| ____( (___| | | |
* (______/|_____)_|_|_| \__)_____)\____)_| |_|
* (C)2013 Semtech
* ___ _____ _ ___ _ _____ ___ ___ ___ ___
* / __|_ _/_\ / __| |/ / __/ _ \| _ \/ __| __|
* \__ \ | |/ _ \ (__| ' <| _| (_) | / (__| _|
* |___/ |_/_/ \_\___|_|\_\_| \___/|_|_\\___|___|
* embedded.connectivity.solutions===============
*
* \endcode
*
*
* License: Revised BSD License, see LICENSE.TXT file include in the project
*
* Maintainer: Miguel Luis ( Semtech ), Gregory Cristian ( Semtech ) and Daniel Jaeckle ( STACKFORCE )
*
* Copyright (c) 2017, Arm Limited and affiliates.
* SPDX-License-Identifier: BSD-3-Clause
*
*/
#ifndef MBED_OS_LORAPHY_KR920_H_
#define MBED_OS_LORAPHY_KR920_H_
#if !(DOXYGEN_ONLY)
#include "LoRaPHY.h"
/*!
* LoRaMac maximum number of channels
*/
#define KR920_MAX_NB_CHANNELS 16
/*!
* Maximum number of bands
*/
#define KR920_MAX_NB_BANDS 1
#define KR920_CHANNEL_MASK_SIZE 1
class LoRaPHYKR920 : public LoRaPHY {
public:
LoRaPHYKR920();
virtual ~LoRaPHYKR920();
virtual bool verify_frequency_for_band(uint32_t freq, uint8_t band) const;
virtual bool tx_config(tx_config_params_t *config, int8_t *tx_power,
lorawan_time_t *tx_toa);
virtual lorawan_status_t set_next_channel(channel_selection_params_t *params, uint8_t *channel,
lorawan_time_t *time,
lorawan_time_t *aggregate_timeOff);
virtual void set_tx_cont_mode(cw_mode_params_t *continuousWave,
uint32_t frequency = 0);
private:
int8_t get_max_eirp(uint32_t freq);
/**
* LoRaMAC channels
*/
channel_params_t channels[KR920_MAX_NB_CHANNELS];
/**
* LoRaMac bands
*/
band_t bands[KR920_MAX_NB_BANDS];
/**
* LoRaMac channel mask
*/
uint16_t channel_mask[KR920_CHANNEL_MASK_SIZE];
/**
* LoRaMac default channel mask
*/
uint16_t default_channel_mask[KR920_CHANNEL_MASK_SIZE];
};
#endif /* DOXYGEN_ONLY */
#endif // MBED_OS_LORAPHY_KR920_H_
| 24.89 | 102 | 0.583367 |
ae8e788853ffaaf05fadbe211e6352516cd859bd | 519 | c | C | commands/example/test_human_readable.c | zsaleeba/gosh | 300e3daae6cd2c02f114de00f28dfbb0fcd2f4c7 | [
"BSD-3-Clause"
] | 5 | 2016-09-09T06:40:03.000Z | 2021-05-09T19:19:24.000Z | commands/example/test_human_readable.c | zsaleeba/gosh | 300e3daae6cd2c02f114de00f28dfbb0fcd2f4c7 | [
"BSD-3-Clause"
] | null | null | null | commands/example/test_human_readable.c | zsaleeba/gosh | 300e3daae6cd2c02f114de00f28dfbb0fcd2f4c7 | [
"BSD-3-Clause"
] | 2 | 2017-01-04T21:34:43.000Z | 2017-07-02T19:43:30.000Z | /* test_human_readable.c - Expose lib/lib.c human_readable() for testing.
*
* Copyright 2015 Rob Landley <rob@landley.net>
USE_TEST_HUMAN_READABLE(NEWTOY(test_human_readable, "<1>1ibs", 0))
config TEST_HUMAN_READABLE
bool "test_human_readable"
default n
help
usage: test_human_readable [-sbi] NUMBER
*/
#define FOR_test_human_readable
#include "toys.h"
void test_human_readable_main(void)
{
char *c;
human_readable(toybuf, strtoll(*toys.optargs, &c, 0), toys.optflags);
printf("%s\n", toybuf);
}
| 21.625 | 73 | 0.739884 |
aee5acad204984e13a999385d47f258806dd93ce | 3,828 | c | C | src/bowcaster/contrib/C/vulnerable.c | zcutlip/bowcaster | 17d69c1ad973356b1ea42ee9cb80525bfef8c255 | [
"MIT"
] | 108 | 2015-01-17T14:04:43.000Z | 2021-03-11T12:18:46.000Z | src/bowcaster/contrib/C/vulnerable.c | zcutlip/bowcaster | 17d69c1ad973356b1ea42ee9cb80525bfef8c255 | [
"MIT"
] | 1 | 2015-01-20T02:45:10.000Z | 2015-01-20T02:45:10.000Z | src/bowcaster/contrib/C/vulnerable.c | zcutlip/bowcaster | 17d69c1ad973356b1ea42ee9cb80525bfef8c255 | [
"MIT"
] | 33 | 2015-01-04T21:27:53.000Z | 2021-02-14T01:26:37.000Z | /*
* Copyright (c) 2013
* - Zachary Cutlip <uid000@gmail.com>
* - Tactical Network Solutions, LLC
*
* See LICENSE.txt for more details.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <netdb.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
int accept_remote(const char *local_port);
int receive_data(int sockfd);
int use_stack_space(int sockfd);
int main(int argc, char **argv)
{
int sockfd;
char *local_port;
int bytes_received;
if(argc != 2)
{
printf("Please specify local port.\n");
exit(1);
}
local_port=argv[1];
sockfd=accept_remote(local_port);
if(sockfd < 0)
{
printf("Failed to accept connection.\n");
exit(1);
}
bytes_received=use_stack_space(sockfd);
printf("recieved %d bytes\n",bytes_received);
shutdown(sockfd,SHUT_RDWR);
close(sockfd);
return 0;
}
int use_stack_space(int sockfd)
{
/* allocate a bunch of space on the stack
* before calling the vulnerable function.
* so we can overflow with a larger buffer.
*/
char buf[2048];
memset(buf,1,sizeof(buf));
return receive_data(sockfd);
}
/*
* vulnerable function.
* reads up to 2048 off a socket onto a small buffer on the stack.
*/
int receive_data(int sockfd)
{
int read_bytes;
char buf[512];
if(sockfd < 0)
{
return -1;
}
read_bytes=recv(sockfd,buf,2048,0);
if(read_bytes < 0)
{
perror("recv");
}else
{
printf("read %d bytes.\n",read_bytes);
}
return read_bytes;
}
int accept_remote(const char *local_port)
{
int server_sockfd;
int connection_sockfd;
socklen_t sin_size;
struct addrinfo hints;
struct addrinfo *srvinfo;
struct addrinfo *p;
struct sockaddr_storage their_addr;
int yes=1;
char s[INET6_ADDRSTRLEN];
int rv;
if(NULL == local_port)
{
printf("Invalid parameter: local_port string was NULL.\n");
return -1;
}
memset(&hints,0,sizeof(hints));
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = AI_PASSIVE; //use my ip
if((rv = getaddrinfo(NULL,local_port,&hints,&srvinfo)) != 0)
{
printf("getaddrinfo: %s\n",gai_strerror(rv));
return -1;
}
for(p=srvinfo; p != NULL; p=p->ai_next)
{
if((server_sockfd = socket(p->ai_family,p->ai_socktype,
p->ai_protocol)) == -1)
{
printf("server: socket %s",strerror(errno));
continue;
}
if(setsockopt(server_sockfd, SOL_SOCKET,SO_REUSEADDR,&yes,sizeof(int)) == -1)
{
printf("setsockopt: %s",strerror(errno));
return -1;
}
if(bind(server_sockfd,p->ai_addr, p->ai_addrlen) == -1)
{
printf("server: bind %s",strerror(errno));
close(server_sockfd);
continue;
}
break;
}
if(NULL == p)
{
printf("server: failed to bind.");
return -1;
}
freeaddrinfo(srvinfo);
if(listen(server_sockfd,1) == -1)
{
printf("listen=: %s",strerror(errno));
return -1;
}
while(1)
{
sin_size=sizeof(their_addr);
connection_sockfd = accept(server_sockfd,(struct sockaddr *)&their_addr,&sin_size);
if(connection_sockfd == -1)
{
printf("accept: %s",strerror(errno));
continue;
}
inet_ntop(their_addr.ss_family,
&(((struct sockaddr_in *)&their_addr)->sin_addr),
s,sizeof(s));
printf("Connection from %s",s);
close(server_sockfd); //done with listener
return connection_sockfd;
}
}
| 20.580645 | 91 | 0.578631 |
233b9fec689bf5695a93faa0db7cfd8ac5e8665b | 6,862 | c | C | src/eos_utils.c | LedgerHQ/ledger-fio | 9d99f9d38b68b9629859c6ddb09d378d1db060d1 | [
"Apache-2.0"
] | null | null | null | src/eos_utils.c | LedgerHQ/ledger-fio | 9d99f9d38b68b9629859c6ddb09d378d1db060d1 | [
"Apache-2.0"
] | 1 | 2021-09-06T15:12:54.000Z | 2021-09-06T15:12:54.000Z | src/eos_utils.c | LedgerHQ/ledger-fio | 9d99f9d38b68b9629859c6ddb09d378d1db060d1 | [
"Apache-2.0"
] | 2 | 2021-09-06T14:46:59.000Z | 2021-12-03T16:48:15.000Z | /*******************************************************************************
* Taras Shchybovyk
* (c) 2018 Taras Shchybovyk
*
* 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 <string.h>
#include "eos_utils.h"
#include "os.h"
#include "cx.h"
#include "utils.h"
/**
* EOS way to check if a signature is canonical :/
*/
unsigned char check_canonical(uint8_t *rs)
{
return !(rs[0] & 0x80)
&& !(rs[0] == 0 && !(rs[1] & 0x80))
&& !(rs[32] & 0x80)
&& !(rs[32] == 0 && !(rs[33] & 0x80));
}
int ecdsa_der_to_sig(const uint8_t *der, uint8_t *sig)
{
int length;
int offset = 2;
int delta = 0;
if (der[offset + 2] == 0) {
length = der[offset + 1] - 1;
offset += 3;
} else {
length = der[offset + 1];
offset += 2;
}
if ((length < 0) || (length > 32)) {
return 0;
}
while ((length + delta) < 32) {
sig[delta++] = 0;
}
memcpy(sig + delta, der + offset, length);
delta = 0;
offset += length;
if (der[offset + 2] == 0) {
length = der[offset + 1] - 1;
offset += 3;
} else {
length = der[offset + 1];
offset += 2;
}
if ((length < 0) || (length > 32)) {
return 0;
}
while ((length + delta) < 32) {
sig[32 + delta++] = 0;
}
memcpy(sig + 32 + delta, der + offset, length);
return 1;
}
/**
* The nonce generated by internal library CX_RND_RFC6979 is not compatible
* with EOS. So this is the way to generate nonve for EOS.
* Arguments (by rele):
* - rnd - out
* - h1 - hash, in
* - x - private key, in
* - x_len - private key length
* - q - SECP256K1_N, in
* - q_len - 32, in
* - V, out
* - K, out
*/
void rng_rfc6979(unsigned char *rnd,
unsigned char *h1,
unsigned char *x, unsigned int x_len,
const unsigned char *q, unsigned int q_len,
unsigned char *V, unsigned char *K)
{
unsigned int h_len, found, i;
cx_hmac_sha256_t hmac;
h_len = 32;
//a. h1 as input
//loop for a candidate
found = 0;
while (!found) {
if (x) {
//b. Set: V = 0x01 0x01 0x01 ... 0x01
memset(V, 0x01, h_len);
//c. Set: K = 0x00 0x00 0x00 ... 0x00
memset(K, 0x00, h_len);
//d. Set: K = HMAC_K(V || 0x00 || int2octets(x) || bits2octets(h1))
V[h_len] = 0;
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, 0, V, h_len + 1, K, 32);
cx_hmac((cx_hmac_t *)&hmac, 0, x, x_len, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, h1, h_len, K, 32);
//e. Set: V = HMAC_K(V)
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, V, h_len, V, 32);
//f. Set: K = HMAC_K(V || 0x01 || int2octets(x) || bits2octets(h1))
V[h_len] = 1;
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, 0, V, h_len + 1, K, 32);
cx_hmac((cx_hmac_t *)&hmac, 0, x, x_len, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, h1, h_len, K, 32);
//g. Set: V = HMAC_K(V) --
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, V, h_len, V, 32);
// initial setup only once
x = NULL;
} else {
// h.3 K = HMAC_K(V || 0x00)
V[h_len] = 0;
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, V, h_len + 1, K, 32);
// h.3 V = HMAC_K(V)
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, V, h_len, V, 32);
}
//generate candidate
/* Shortcut: As only secp256k1/sha256 is supported, the step h.2 :
* While tlen < qlen, do the following:
* V = HMAC_K(V)
* T = T || V
* is replace by
* V = HMAC_K(V)
*/
x_len = q_len;
while (x_len) {
if (x_len < h_len) {
h_len = x_len;
}
cx_hmac_sha256_init(&hmac, K, 32);
cx_hmac((cx_hmac_t *)&hmac, CX_LAST, V, h_len, V, 32);
memcpy(rnd, V, h_len);
x_len -= h_len;
}
// h.3 Check T is < n
for (i = 0; i < q_len; i++) {
if (V[i] < q[i]) {
found = 1;
break;
}
}
}
}
unsigned char const BASE58ALPHABET[58] = {
'1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
bool b58enc(uint8_t *bin, uint32_t binsz, char *b58, uint32_t *b58sz)
{
int carry;
uint32_t i, j, high, zcount = 0;
uint32_t size;
while (zcount < binsz && !bin[zcount])
++zcount;
size = (binsz - zcount) * 138 / 100 + 1;
uint8_t buf[size];
memset(buf, 0, size);
for (i = zcount, high = size - 1; i < binsz; ++i, high = j)
{
for (carry = bin[i], j = size - 1; (j > high) || carry; --j)
{
ASSERT(j < size);
carry += 256 * buf[j];
buf[j] = carry % 58;
carry /= 58;
if (!j) {
// Otherwise j wraps to maxint which is > high
break;
}
}
}
for (j = 0; j < size && !buf[j]; ++j);
if (*b58sz <= zcount + size - j)
{
*b58sz = zcount + size - j + 1;
return false;
}
if (zcount)
memset(b58, '1', zcount);
for (i = zcount; j < size; ++i, ++j) {
ASSERT(buf[j] < 58);
ASSERT(i < *b58sz);
b58[i] = BASE58ALPHABET[buf[j]];
}
b58[i] = '\0';
*b58sz = i + 1;
return true;
}
uint32_t compressed_public_key_to_wif(const uint8_t *publicKey, uint32_t keyLength, char *out, uint32_t outLength) {
ASSERT(publicKey != NULL);
ASSERT(keyLength >= 33);
ASSERT(outLength >= 40);
uint8_t temp[37];
memset(temp, 0, sizeof(temp));
memcpy(temp, publicKey, 33);
uint8_t check[20];
cx_ripemd160_t riprip;
cx_ripemd160_init(&riprip);
cx_hash(&riprip.header, CX_LAST, temp, 33, check, sizeof(check));
memcpy(temp + 33, check, 4);
memset(out, 0, outLength);
out[0] = 'F';
out[1] = 'I';
out[2] = 'O';
uint32_t addressLen = outLength - 3;
b58enc(temp, sizeof(temp), out + 3, &addressLen);
ASSERT(addressLen +3 < outLength);
return addressLen + 3;
}
uint32_t public_key_to_wif(const uint8_t *publicKey, uint32_t keyLength, char *out, uint32_t outLength) {
ASSERT(publicKey != NULL);
ASSERT(keyLength >= 33);
ASSERT(outLength >= 40);
uint8_t temp[33];
// is even?
temp[0] = (publicKey[64] & 0x1) ? 0x03 : 0x02;
memcpy(temp + 1, publicKey + 1, 32);
return compressed_public_key_to_wif(temp, sizeof(temp), out, outLength);
}
| 26.596899 | 116 | 0.554503 |
9cbfce3f0a36cfade9d21aa9ab426e0405a2ac5c | 211 | c | C | tests/bmc/ptrs/basic/provenance_equality_uintptr_t_auto_yx.c | talsewell/cerberus | c8c6d25f0cb8d4cd2672ffd0790fb0de3f2a51e3 | [
"BSD-2-Clause"
] | 12 | 2020-09-03T09:57:26.000Z | 2022-01-28T04:28:00.000Z | tests/bmc/ptrs/basic/provenance_equality_uintptr_t_auto_yx.c | talsewell/cerberus | c8c6d25f0cb8d4cd2672ffd0790fb0de3f2a51e3 | [
"BSD-2-Clause"
] | 182 | 2021-02-26T23:07:40.000Z | 2022-02-10T12:33:45.000Z | tests/bmc/ptrs/basic/provenance_equality_uintptr_t_auto_yx.c | talsewell/cerberus | c8c6d25f0cb8d4cd2672ffd0790fb0de3f2a51e3 | [
"BSD-2-Clause"
] | 4 | 2020-09-02T11:54:39.000Z | 2022-03-16T23:23:11.000Z | #include <inttypes.h>
int main() {
int y=2, x=1;
uintptr_t p = (uintptr_t)(&x + 1);
uintptr_t q = (uintptr_t)&y;
_Bool b = (p==q);
// can this be false even with identical addresses?
return 0;
}
| 19.181818 | 53 | 0.597156 |
96c44ef3fc7fb3b857629cacb55cbe03db52c77f | 11,019 | h | C | nuparu/include/openvdb/include/openvdb/metadata/Metadata.h | jumokbap/Practice_CentOS | df38220f326e24a0df9e16326b7ae4aa67252fe9 | [
"MIT"
] | 9 | 2017-09-18T21:37:12.000Z | 2021-09-05T23:11:53.000Z | nuparu/include/openvdb/include/openvdb/metadata/Metadata.h | jumokbap/Practice_CentOS | df38220f326e24a0df9e16326b7ae4aa67252fe9 | [
"MIT"
] | null | null | null | nuparu/include/openvdb/include/openvdb/metadata/Metadata.h | jumokbap/Practice_CentOS | df38220f326e24a0df9e16326b7ae4aa67252fe9 | [
"MIT"
] | 6 | 2016-04-11T19:42:09.000Z | 2022-03-04T16:17:41.000Z | ///////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2012-2016 DreamWorks Animation LLC
//
// All rights reserved. This software is distributed under the
// Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
//
// Redistributions of source code must retain the above copyright
// and license notice and the following restrictions and disclaimer.
//
// * Neither the name of DreamWorks Animation nor the names of
// its contributors may be used to endorse or promote products derived
// from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY 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.
// IN NO EVENT SHALL THE COPYRIGHT HOLDERS' AND CONTRIBUTORS' AGGREGATE
// LIABILITY FOR ALL CLAIMS REGARDLESS OF THEIR BASIS EXCEED US$250.00.
//
///////////////////////////////////////////////////////////////////////////
#ifndef OPENVDB_METADATA_METADATA_HAS_BEEN_INCLUDED
#define OPENVDB_METADATA_METADATA_HAS_BEEN_INCLUDED
#include <iostream>
#include <string>
#include <openvdb/Types.h>
#include <openvdb/math/Math.h> // for math::isZero()
#include <openvdb/util/Name.h>
#include <openvdb/Exceptions.h>
#include <boost/shared_ptr.hpp>
#include <boost/cstdint.hpp>
namespace openvdb {
OPENVDB_USE_VERSION_NAMESPACE
namespace OPENVDB_VERSION_NAME {
/// @brief Base class for storing metadata information in a grid.
class OPENVDB_API Metadata
{
public:
typedef boost::shared_ptr<Metadata> Ptr;
typedef boost::shared_ptr<const Metadata> ConstPtr;
Metadata() {}
virtual ~Metadata() {}
/// Return the type name of the metadata.
virtual Name typeName() const = 0;
/// Return a copy of the metadata.
virtual Metadata::Ptr copy() const = 0;
/// Copy the given metadata into this metadata.
virtual void copy(const Metadata& other) = 0;
/// Return a textual representation of this metadata.
virtual std::string str() const = 0;
/// Return the boolean representation of this metadata (empty strings
/// and zeroVals evaluate to false; most other values evaluate to true).
virtual bool asBool() const = 0;
/// Return @c true if the given metadata is equivalent to this metadata.
bool operator==(const Metadata& other) const;
/// Return @c true if the given metadata is different from this metadata.
bool operator!=(const Metadata& other) const { return !(*this == other); }
/// Return the size of this metadata in bytes.
virtual Index32 size() const = 0;
/// Unserialize this metadata from a stream.
void read(std::istream&);
/// Serialize this metadata to a stream.
void write(std::ostream&) const;
/// Create new metadata of the given type.
static Metadata::Ptr createMetadata(const Name& typeName);
/// Return @c true if the given type is known by the metadata type registry.
static bool isRegisteredType(const Name& typeName);
/// Clear out the metadata registry.
static void clearRegistry();
/// Register the given metadata type along with a factory function.
static void registerType(const Name& typeName, Metadata::Ptr (*createMetadata)());
static void unregisterType(const Name& typeName);
protected:
/// Read the size of the metadata from a stream.
static Index32 readSize(std::istream&);
/// Write the size of the metadata to a stream.
void writeSize(std::ostream&) const;
/// Read the metadata from a stream.
virtual void readValue(std::istream&, Index32 numBytes) = 0;
/// Write the metadata to a stream.
virtual void writeValue(std::ostream&) const = 0;
private:
// Disallow copying of instances of this class.
Metadata(const Metadata&);
Metadata& operator=(const Metadata&);
};
/// @brief Subclass to read (and ignore) data of an unregistered type
class OPENVDB_API UnknownMetadata: public Metadata
{
public:
UnknownMetadata() {}
virtual ~UnknownMetadata() {}
virtual Name typeName() const { return "<unknown>"; }
virtual Metadata::Ptr copy() const { OPENVDB_THROW(TypeError, "Metadata has unknown type"); }
virtual void copy(const Metadata&) { OPENVDB_THROW(TypeError, "Destination has unknown type"); }
virtual std::string str() const { return "<unknown>"; }
virtual bool asBool() const { return false; }
virtual Index32 size() const { return 0; }
protected:
virtual void readValue(std::istream&s, Index32 numBytes);
virtual void writeValue(std::ostream&) const;
};
/// @brief Templated metadata class to hold specific types.
template<typename T>
class TypedMetadata: public Metadata
{
public:
typedef boost::shared_ptr<TypedMetadata<T> > Ptr;
typedef boost::shared_ptr<const TypedMetadata<T> > ConstPtr;
TypedMetadata();
TypedMetadata(const T& value);
TypedMetadata(const TypedMetadata<T>& other);
virtual ~TypedMetadata();
virtual Name typeName() const;
virtual Metadata::Ptr copy() const;
virtual void copy(const Metadata& other);
virtual std::string str() const;
virtual bool asBool() const;
virtual Index32 size() const { return static_cast<Index32>(sizeof(T)); }
/// Set this metadata's value.
void setValue(const T&);
/// Return this metadata's value.
T& value();
const T& value() const;
// Static specialized function for the type name. This function must be
// template specialized for each type T.
static Name staticTypeName() { return typeNameAsString<T>(); }
/// Create new metadata of this type.
static Metadata::Ptr createMetadata();
static void registerType();
static void unregisterType();
static bool isRegisteredType();
protected:
virtual void readValue(std::istream&, Index32 numBytes);
virtual void writeValue(std::ostream&) const;
private:
T mValue;
};
/// Write a Metadata to an output stream
std::ostream& operator<<(std::ostream& ostr, const Metadata& metadata);
////////////////////////////////////////
inline void
Metadata::writeSize(std::ostream& os) const
{
const Index32 n = this->size();
os.write(reinterpret_cast<const char*>(&n), sizeof(Index32));
}
inline Index32
Metadata::readSize(std::istream& is)
{
Index32 n = 0;
is.read(reinterpret_cast<char*>(&n), sizeof(Index32));
return n;
}
inline void
Metadata::read(std::istream& is)
{
const Index32 numBytes = this->readSize(is);
this->readValue(is, numBytes);
}
inline void
Metadata::write(std::ostream& os) const
{
this->writeSize(os);
this->writeValue(os);
}
////////////////////////////////////////
template <typename T>
inline
TypedMetadata<T>::TypedMetadata() : mValue(T())
{
}
template <typename T>
inline
TypedMetadata<T>::TypedMetadata(const T &value) : mValue(value)
{
}
template <typename T>
inline
TypedMetadata<T>::TypedMetadata(const TypedMetadata<T> &other) :
Metadata(),
mValue(other.mValue)
{
}
template <typename T>
inline
TypedMetadata<T>::~TypedMetadata()
{
}
template <typename T>
inline Name
TypedMetadata<T>::typeName() const
{
return TypedMetadata<T>::staticTypeName();
}
template <typename T>
inline void
TypedMetadata<T>::setValue(const T& val)
{
mValue = val;
}
template <typename T>
inline T&
TypedMetadata<T>::value()
{
return mValue;
}
template <typename T>
inline const T&
TypedMetadata<T>::value() const
{
return mValue;
}
template <typename T>
inline Metadata::Ptr
TypedMetadata<T>::copy() const
{
Metadata::Ptr metadata(new TypedMetadata<T>());
metadata->copy(*this);
return metadata;
}
template <typename T>
inline void
TypedMetadata<T>::copy(const Metadata &other)
{
const TypedMetadata<T>* t = dynamic_cast<const TypedMetadata<T>*>(&other);
if (t == NULL) OPENVDB_THROW(TypeError, "Incompatible type during copy");
mValue = t->mValue;
}
template<typename T>
inline void
TypedMetadata<T>::readValue(std::istream& is, Index32 /*numBytes*/)
{
//assert(this->size() == numBytes);
is.read(reinterpret_cast<char*>(&mValue), this->size());
}
template<typename T>
inline void
TypedMetadata<T>::writeValue(std::ostream& os) const
{
os.write(reinterpret_cast<const char*>(&mValue), this->size());
}
template <typename T>
inline std::string
TypedMetadata<T>::str() const
{
std::ostringstream ostr;
ostr << mValue;
return ostr.str();
}
template<typename T>
inline bool
TypedMetadata<T>::asBool() const
{
return !math::isZero(mValue);
}
template <typename T>
inline Metadata::Ptr
TypedMetadata<T>::createMetadata()
{
Metadata::Ptr ret(new TypedMetadata<T>());
return ret;
}
template <typename T>
inline void
TypedMetadata<T>::registerType()
{
Metadata::registerType(TypedMetadata<T>::staticTypeName(),
TypedMetadata<T>::createMetadata);
}
template <typename T>
inline void
TypedMetadata<T>::unregisterType()
{
Metadata::unregisterType(TypedMetadata<T>::staticTypeName());
}
template <typename T>
inline bool
TypedMetadata<T>::isRegisteredType()
{
return Metadata::isRegisteredType(TypedMetadata<T>::staticTypeName());
}
template<>
inline std::string
TypedMetadata<bool>::str() const
{
return (mValue ? "true" : "false");
}
inline std::ostream&
operator<<(std::ostream& ostr, const Metadata& metadata)
{
ostr << metadata.str();
return ostr;
}
typedef TypedMetadata<bool> BoolMetadata;
typedef TypedMetadata<double> DoubleMetadata;
typedef TypedMetadata<float> FloatMetadata;
typedef TypedMetadata<boost::int32_t> Int32Metadata;
typedef TypedMetadata<boost::int64_t> Int64Metadata;
typedef TypedMetadata<Vec2d> Vec2DMetadata;
typedef TypedMetadata<Vec2i> Vec2IMetadata;
typedef TypedMetadata<Vec2s> Vec2SMetadata;
typedef TypedMetadata<Vec3d> Vec3DMetadata;
typedef TypedMetadata<Vec3i> Vec3IMetadata;
typedef TypedMetadata<Vec3s> Vec3SMetadata;
typedef TypedMetadata<Mat4s> Mat4SMetadata;
typedef TypedMetadata<Mat4d> Mat4DMetadata;
} // namespace OPENVDB_VERSION_NAME
} // namespace openvdb
#endif // OPENVDB_METADATA_METADATA_HAS_BEEN_INCLUDED
// Copyright (c) 2012-2016 DreamWorks Animation LLC
// All rights reserved. This software is distributed under the
// Mozilla Public License 2.0 ( http://www.mozilla.org/MPL/2.0/ )
| 27.68593 | 100 | 0.6948 |
1e69a40a5c19b0bef0131edaea34cea27e092c07 | 1,350 | h | C | File_Handling/File_Handling.h | zorguiradhwen/STM32MSC | 21a23965d9a5e296cf5575aa4490203feb97d798 | [
"MIT"
] | null | null | null | File_Handling/File_Handling.h | zorguiradhwen/STM32MSC | 21a23965d9a5e296cf5575aa4490203feb97d798 | [
"MIT"
] | null | null | null | File_Handling/File_Handling.h | zorguiradhwen/STM32MSC | 21a23965d9a5e296cf5575aa4490203feb97d798 | [
"MIT"
] | null | null | null | /*
* File_Handling_RTOS.h
*
* Created on: 14-May-2020
* Author: Controllerstech
*/
#ifndef FILE_HANDLING_RTOS_H_
#define FILE_HANDLING_RTOS_H_
#include "fatfs.h"
#include "string.h"
#include "stdio.h"
/* mounts the sd card*/
void Mount_SD (const TCHAR* path);
/* unmounts the sd card*/
void Unmount_SD (const TCHAR* path);
/* Start node to be scanned (***also used as work area***) */
FRESULT Scan_SD (char* pat);
/* Only supports removing files from home directory. Directory remover to be added soon */
FRESULT Format_SD (void);
/* write the data to the file
* @ name : is the path to the file*/
FRESULT Write_File (char *name, char *data);
/* read data from the file
* @ name : is the path to the file*/
FRESULT Read_File (char *name);
/* creates the file, if it does not exists
* @ name : is the path to the file*/
FRESULT Create_File (char *name);
/* Removes the file from the sd card
* @ name : is the path to the file*/
FRESULT Remove_File (char *name);
/* creates a directory
* @ name: is the path to the directory
*/
FRESULT Create_Dir (char *name);
/* checks the free space in the sd card*/
void Check_SD_Space (void);
/* updates the file. write pointer is set to the end of the file
* @ name : is the path to the file
*/
FRESULT Update_File (char *name, char *data);
#endif /* FILE_HANDLING_RTOS_H_ */
| 22.131148 | 90 | 0.691111 |
1ea081980c85c278a486ce5c5ef5c8bc15f58e49 | 380 | h | C | extras/test/myassert.h | thiminhnhut/ArduinoTrace | dfbfc29ec6717d5759212ecfec8008c96aff4f53 | [
"MIT"
] | 149 | 2018-07-19T15:19:48.000Z | 2022-03-19T13:19:39.000Z | extras/test/myassert.h | thiminhnhut/ArduinoTrace | dfbfc29ec6717d5759212ecfec8008c96aff4f53 | [
"MIT"
] | 9 | 2019-02-06T14:20:11.000Z | 2021-02-08T13:05:01.000Z | extras/test/myassert.h | thiminhnhut/ArduinoTrace | dfbfc29ec6717d5759212ecfec8008c96aff4f53 | [
"MIT"
] | 14 | 2018-11-22T07:13:32.000Z | 2022-01-04T12:08:43.000Z | #pragma once
#include <cstdlib>
#include <iostream>
#include <regex>
void ASSERT_RE(std::string actual, std::string expected) {
std::regex re(expected);
if (regex_match(actual, re))
return;
std::cerr << "Assertion failed:\n"
"Expected:\n"
<< expected << "\n"
<< "but got:\n"
<< actual << std::endl;
std::exit(1);
}
| 21.111111 | 58 | 0.552632 |
000df897d5b1b48210aba006c0b509cd9a6f19dd | 11,316 | c | C | libscpi/src/ieee488.c | PolyPik/scpi-parser | 25193feddd986026cd84b24c31e6af0a16d5bcb6 | [
"BSD-2-Clause"
] | null | null | null | libscpi/src/ieee488.c | PolyPik/scpi-parser | 25193feddd986026cd84b24c31e6af0a16d5bcb6 | [
"BSD-2-Clause"
] | null | null | null | libscpi/src/ieee488.c | PolyPik/scpi-parser | 25193feddd986026cd84b24c31e6af0a16d5bcb6 | [
"BSD-2-Clause"
] | null | null | null | /*-
* BSD 2-Clause License
*
* Copyright (c) 2012-2018, Jan Breuer
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 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.
*/
/**
* @file scpi_ieee488.c
* @date Thu Nov 15 10:58:45 UTC 2012
*
* @brief Implementation of IEEE488.2 commands and state model
*
*
*/
#include "scpi/parser.h"
#include "scpi/ieee488.h"
#include "scpi/error.h"
#include "scpi/constants.h"
#include <stdio.h>
static const scpi_reg_info_t scpi_reg_details[SCPI_REG_COUNT] = {
{ SCPI_REG_CLASS_STB, SCPI_REG_GROUP_STB },
{ SCPI_REG_CLASS_SRE, SCPI_REG_GROUP_STB },
{ SCPI_REG_CLASS_EVEN, SCPI_REG_GROUP_ESR },
{ SCPI_REG_CLASS_ENAB, SCPI_REG_GROUP_ESR },
{ SCPI_REG_CLASS_EVEN, SCPI_REG_GROUP_OPER },
{ SCPI_REG_CLASS_ENAB, SCPI_REG_GROUP_OPER },
{ SCPI_REG_CLASS_COND, SCPI_REG_GROUP_OPER },
{ SCPI_REG_CLASS_EVEN, SCPI_REG_GROUP_QUES },
{ SCPI_REG_CLASS_ENAB, SCPI_REG_GROUP_QUES },
{ SCPI_REG_CLASS_COND, SCPI_REG_GROUP_QUES },
#if USE_CUSTOM_REGISTERS
#ifndef USER_REGISTER_DETAILS
#error "No user register details defined"
#else
USER_REGISTER_DETAILS
#endif
#endif
};
static const scpi_reg_group_info_t scpi_reg_group_details[SCPI_REG_GROUP_COUNT] = {
{
SCPI_REG_STB,
SCPI_REG_SRE,
SCPI_REG_NONE,
SCPI_REG_NONE,
SCPI_REG_NONE,
SCPI_REG_NONE,
0
}, //SCPI_REG_GROUP_STB
{
SCPI_REG_ESR,
SCPI_REG_ESE,
SCPI_REG_NONE,
SCPI_REG_NONE,
SCPI_REG_NONE,
SCPI_REG_STB,
STB_ESR
}, //SCPI_REG_GROUP_ESR
{
SCPI_REG_OPER,
SCPI_REG_OPERE,
SCPI_REG_OPERC,
SCPI_REG_NONE,
SCPI_REG_NONE,
SCPI_REG_STB,
STB_OPS
}, //SCPI_REG_GROUP_OPER
{
SCPI_REG_QUES,
SCPI_REG_QUESE,
SCPI_REG_QUESC,
SCPI_REG_NONE,
SCPI_REG_NONE,
SCPI_REG_STB,
STB_QES
}, //SCPI_REG_GROUP_QUES
#if USE_CUSTOM_REGISTERS
#ifndef USER_REGISTER_GROUP_DETAILS
#error "No user register group details defined"
#else
USER_REGISTER_GROUP_DETAILS
#endif
#endif
};
/**
* Get register value
* @param name - register name
* @return register value
*/
scpi_reg_val_t SCPI_RegGet(scpi_t * context, scpi_reg_name_t name) {
if ((name < SCPI_REG_COUNT) && context) {
return context->registers[name];
} else {
return 0;
}
}
/**
* Wrapper function to control interface from context
* @param context
* @param ctrl number of controll message
* @param value value of related register
*/
static size_t writeControl(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val) {
if (context && context->interface && context->interface->control) {
return context->interface->control(context, ctrl, val);
} else {
return 0;
}
}
/**
* Set register value
* @param name - register name
* @param val - new value
*/
void SCPI_RegSet(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t val) {
if ((name >= SCPI_REG_COUNT) || (context == NULL)) {
return;
}
scpi_reg_group_info_t register_group;
do {
scpi_reg_class_t register_type = scpi_reg_details[name].type;
register_group = scpi_reg_group_details[scpi_reg_details[name].group];
scpi_reg_val_t ptrans;
/* store old register value */
scpi_reg_val_t old_val = context->registers[name];
if (old_val == val) {
return;
} else {
context->registers[name] = val;
}
switch (register_type) {
case SCPI_REG_CLASS_STB:
case SCPI_REG_CLASS_SRE:
;
scpi_reg_val_t stb = context->registers[SCPI_REG_STB] & ~STB_SRQ;
scpi_reg_val_t sre = context->registers[SCPI_REG_SRE] & ~STB_SRQ;
if (stb & sre) {
ptrans = ((old_val ^ val) & val);
context->registers[SCPI_REG_STB] |= STB_SRQ;
if (ptrans & val) {
writeControl(context, SCPI_CTRL_SRQ, context->registers[SCPI_REG_STB]);
}
} else {
context->registers[SCPI_REG_STB] &= ~STB_SRQ;
}
break;
case SCPI_REG_CLASS_EVEN:
;
scpi_reg_val_t enable;
if(register_group.enable != SCPI_REG_NONE) {
enable = SCPI_RegGet(context, register_group.enable);
} else {
enable = 0xFFFF;
}
scpi_bool_t summary = val & enable;
name = register_group.parent_reg;
val = SCPI_RegGet(context, register_group.parent_reg);
if (summary) {
val |= register_group.parent_bit;
} else {
val &= ~(register_group.parent_bit);
}
break;
case SCPI_REG_CLASS_COND:
name = register_group.event;
if(register_group.ptfilt == SCPI_REG_NONE && register_group.ntfilt == SCPI_REG_NONE) {
val = ((old_val ^ val) & val) | SCPI_RegGet(context, register_group.event);
} else {
scpi_reg_val_t ptfilt = 0, ntfilt = 0;
scpi_reg_val_t transitions;
scpi_reg_val_t ntrans;
if(register_group.ptfilt != SCPI_REG_NONE) {
ptfilt = SCPI_RegGet(context, register_group.ptfilt);
}
if(register_group.ntfilt != SCPI_REG_NONE) {
ntfilt = SCPI_RegGet(context, register_group.ntfilt);
}
transitions = old_val ^ val;
ptrans = transitions & val;
ntrans = transitions & ~ptrans;
val = ((ptrans & ptfilt) | (ntrans & ntfilt)) | SCPI_RegGet(context, register_group.event);
}
break;
case SCPI_REG_CLASS_ENAB:
case SCPI_REG_CLASS_NTR:
case SCPI_REG_CLASS_PTR:
return;
}
} while(register_group.parent_reg != SCPI_REG_NONE);
}
/**
* Set register bits
* @param name - register name
* @param bits bit mask
*/
void SCPI_RegSetBits(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t bits) {
SCPI_RegSet(context, name, SCPI_RegGet(context, name) | bits);
}
/**
* Clear register bits
* @param name - register name
* @param bits bit mask
*/
void SCPI_RegClearBits(scpi_t * context, scpi_reg_name_t name, scpi_reg_val_t bits) {
SCPI_RegSet(context, name, SCPI_RegGet(context, name) & ~bits);
}
/**
* *CLS - This command clears all status data structures in a device.
* For a device which minimally complies with SCPI. (SCPI std 4.1.3.2)
* @param context
* @return
*/
scpi_result_t SCPI_CoreCls(scpi_t * context) {
SCPI_ErrorClear(context);
for (int i = 0; i < SCPI_REG_GROUP_COUNT; ++i) {
scpi_reg_name_t event_reg = scpi_reg_group_details[i].event;
if (event_reg != SCPI_REG_STB) {
SCPI_RegSet(context, event_reg, 0);
}
}
return SCPI_RES_OK;
}
/**
* *ESE
* @param context
* @return
*/
scpi_result_t SCPI_CoreEse(scpi_t * context) {
int32_t new_ESE;
if (SCPI_ParamInt32(context, &new_ESE, TRUE)) {
SCPI_RegSet(context, SCPI_REG_ESE, (scpi_reg_val_t) new_ESE);
return SCPI_RES_OK;
}
return SCPI_RES_ERR;
}
/**
* *ESE?
* @param context
* @return
*/
scpi_result_t SCPI_CoreEseQ(scpi_t * context) {
SCPI_ResultInt32(context, SCPI_RegGet(context, SCPI_REG_ESE));
return SCPI_RES_OK;
}
/**
* *ESR?
* @param context
* @return
*/
scpi_result_t SCPI_CoreEsrQ(scpi_t * context) {
SCPI_ResultInt32(context, SCPI_RegGet(context, SCPI_REG_ESR));
SCPI_RegSet(context, SCPI_REG_ESR, 0);
return SCPI_RES_OK;
}
/**
* *IDN?
*
* field1: MANUFACTURE
* field2: MODEL
* field4: SUBSYSTEMS REVISIONS
*
* example: MANUFACTURE,MODEL,0,01-02-01
* @param context
* @return
*/
scpi_result_t SCPI_CoreIdnQ(scpi_t * context) {
int i;
for (i = 0; i < 4; i++) {
if (context->idn[i]) {
SCPI_ResultMnemonic(context, context->idn[i]);
} else {
SCPI_ResultMnemonic(context, "0");
}
}
return SCPI_RES_OK;
}
/**
* *OPC
* @param context
* @return
*/
scpi_result_t SCPI_CoreOpc(scpi_t * context) {
SCPI_RegSetBits(context, SCPI_REG_ESR, ESR_OPC);
return SCPI_RES_OK;
}
/**
* *OPC?
* @param context
* @return
*/
scpi_result_t SCPI_CoreOpcQ(scpi_t * context) {
/* Operation is always completed */
SCPI_ResultInt32(context, 1);
return SCPI_RES_OK;
}
/**
* *RST
* @param context
* @return
*/
scpi_result_t SCPI_CoreRst(scpi_t * context) {
if (context && context->interface && context->interface->reset) {
return context->interface->reset(context);
}
return SCPI_RES_OK;
}
/**
* *SRE
* @param context
* @return
*/
scpi_result_t SCPI_CoreSre(scpi_t * context) {
int32_t new_SRE;
if (SCPI_ParamInt32(context, &new_SRE, TRUE)) {
SCPI_RegSet(context, SCPI_REG_SRE, (scpi_reg_val_t) new_SRE);
return SCPI_RES_OK;
}
return SCPI_RES_ERR;
}
/**
* *SRE?
* @param context
* @return
*/
scpi_result_t SCPI_CoreSreQ(scpi_t * context) {
SCPI_ResultInt32(context, SCPI_RegGet(context, SCPI_REG_SRE));
return SCPI_RES_OK;
}
/**
* *STB?
* @param context
* @return
*/
scpi_result_t SCPI_CoreStbQ(scpi_t * context) {
SCPI_ResultInt32(context, SCPI_RegGet(context, SCPI_REG_STB));
return SCPI_RES_OK;
}
/**
* *TST?
* @param context
* @return
*/
scpi_result_t SCPI_CoreTstQ(scpi_t * context) {
(void) context;
SCPI_ResultInt32(context, 0);
return SCPI_RES_OK;
}
/**
* *WAI
* @param context
* @return
*/
scpi_result_t SCPI_CoreWai(scpi_t * context) {
(void) context;
/* NOP */
return SCPI_RES_OK;
}
| 26.942857 | 111 | 0.626281 |
18618acef826e43e76bc14e857c1cdfce47f0cf5 | 325 | h | C | Samples/ARM32-FirmwareTPM/optee_ta/fTPM/include/fTPM_event_log.h | chrisfenner/ms-tpm-20-ref | d213d9992dfec9c8e523d9ca41fc1c056441a924 | [
"BSD-2-Clause"
] | 149 | 2019-05-09T22:08:25.000Z | 2022-03-31T16:31:28.000Z | Samples/ARM32-FirmwareTPM/optee_ta/fTPM/include/fTPM_event_log.h | chrisfenner/ms-tpm-20-ref | d213d9992dfec9c8e523d9ca41fc1c056441a924 | [
"BSD-2-Clause"
] | 31 | 2019-05-09T22:07:20.000Z | 2022-03-22T00:42:14.000Z | Samples/ARM32-FirmwareTPM/optee_ta/fTPM/include/fTPM_event_log.h | chrisfenner/ms-tpm-20-ref | d213d9992dfec9c8e523d9ca41fc1c056441a924 | [
"BSD-2-Clause"
] | 59 | 2019-05-14T20:03:29.000Z | 2022-03-22T00:39:14.000Z | /*
* Copyright (c) 2021, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef _FTPM_EVENT_LOG_
#define _FTPM_EVENT_LOG_
bool process_eventlog(const unsigned char *const buf, const size_t log_size);
void dump_event_log(uint8_t *log_addr, size_t log_size);
#endif /* _FTPM_EVENT_LOG_*/
| 23.214286 | 77 | 0.763077 |
9bc286ab3fdb9213e5672b4ab8cc36cc89ddd159 | 458 | c | C | tcpl/2.types_operators_and_expressions/2-8.c | chen-chao/coursera | 4cce36f8f49b6aab41b3df6f6f979c70da080bf7 | [
"MIT"
] | 1 | 2018-07-17T22:18:22.000Z | 2018-07-17T22:18:22.000Z | tcpl/2.types_operators_and_expressions/2-8.c | chen-chao/coursera | 4cce36f8f49b6aab41b3df6f6f979c70da080bf7 | [
"MIT"
] | null | null | null | tcpl/2.types_operators_and_expressions/2-8.c | chen-chao/coursera | 4cce36f8f49b6aab41b3df6f6f979c70da080bf7 | [
"MIT"
] | 1 | 2019-08-31T11:50:52.000Z | 2019-08-31T11:50:52.000Z | #include <stdio.h>
#include <limits.h>
unsigned rightrot(unsigned x, int n){
/* since sizeof is used here, this answer is more reasonable
* size_t p = sizeof(x)*CHAR_BIT
* return (x>>n) | (x <<(p-n))*/
unsigned mask = (1 << n) -1;
return ((x & mask) << (sizeof(x)*CHAR_BIT-n)) + (x & ~mask);
}
int main(){
unsigned x = 0xfa2b;
printf("%x, %x\n", x, rightrot(x, 4));
x = 0x3b1c;
printf("%x, %x\n", x, rightrot(x, 6));
} | 26.941176 | 64 | 0.550218 |
af618ca7705f4b0d25eccb5aefb4846526d0e734 | 421 | h | C | src/xrGame/ZudaArtifact.h | clayne/xray-16 | 32ebf81a252c7179e2824b2874f911a91e822ad1 | [
"OML",
"Linux-OpenIB"
] | 2 | 2015-02-23T10:43:02.000Z | 2015-06-11T14:45:08.000Z | src/xrGame/ZudaArtifact.h | clayne/xray-16 | 32ebf81a252c7179e2824b2874f911a91e822ad1 | [
"OML",
"Linux-OpenIB"
] | 17 | 2022-01-25T08:58:23.000Z | 2022-03-28T17:18:28.000Z | src/xrGame/ZudaArtifact.h | clayne/xray-16 | 32ebf81a252c7179e2824b2874f911a91e822ad1 | [
"OML",
"Linux-OpenIB"
] | 1 | 2015-06-05T20:04:00.000Z | 2015-06-05T20:04:00.000Z | ///////////////////////////////////////////////////////////////
// ZudaArtifact.h
// ZudaArtefact - артефакт зуда
///////////////////////////////////////////////////////////////
#pragma once
#include "Artefact.h"
class CZudaArtefact : public CArtefact
{
private:
typedef CArtefact inherited;
public:
CZudaArtefact(void);
virtual ~CZudaArtefact(void);
virtual void Load(LPCSTR section);
protected:
};
| 19.136364 | 63 | 0.503563 |
15d8320badae5ac2621b7c614fd8dba846251eea | 419 | h | C | strerror_override.h | mx838/json-c-0.12-cmake | 627e54c74f2cefc697b9890c425efacebfc5e82a | [
"MIT"
] | 1 | 2019-05-26T06:08:52.000Z | 2019-05-26T06:08:52.000Z | strerror_override.h | mx838/json-c-0.12-cmake | 627e54c74f2cefc697b9890c425efacebfc5e82a | [
"MIT"
] | null | null | null | strerror_override.h | mx838/json-c-0.12-cmake | 627e54c74f2cefc697b9890c425efacebfc5e82a | [
"MIT"
] | 1 | 2019-05-26T06:08:43.000Z | 2019-05-26T06:08:43.000Z | #ifndef _json_strerror_override_h_
#define _json_strerror_override_h_
#include "config.h"
#include <errno.h>
#include "json_object.h" /* for JSON_EXPORT */
#ifdef __cplusplus
extern "C" {
#endif
JSON_EXPORT char *_json_c_strerror(int errno_in);
#ifndef STRERROR_OVERRIDE_IMPL
#define strerror _json_c_strerror
#else
#include <string.h>
#endif
#ifdef __cplusplus
}
#endif
#endif /* _json_strerror_override_h_ */
| 16.115385 | 49 | 0.78043 |
768af4b435545b46099ab99720f788a7a3cf67a3 | 2,058 | h | C | Archived/v1/WCDistractionFreeXcodePlugin/Headers/SharedFrameworks/DVTKit/DVTDisclosureView.h | wokalski/Distraction-Free-Xcode-plugin | 54ab4b9d9825e8370855b7985d6ff39d64c19f25 | [
"MIT"
] | 25 | 2016-03-03T07:43:56.000Z | 2021-09-05T08:47:40.000Z | Archived/v1/WCDistractionFreeXcodePlugin/Headers/SharedFrameworks/DVTKit/DVTDisclosureView.h | wokalski/Distraction-Free-Xcode-plugin | 54ab4b9d9825e8370855b7985d6ff39d64c19f25 | [
"MIT"
] | 8 | 2016-02-23T18:40:20.000Z | 2016-08-18T13:21:05.000Z | Archived/v1/WCDistractionFreeXcodePlugin/Headers/SharedFrameworks/DVTKit/DVTDisclosureView.h | wokalski/Distraction-Free-Xcode-plugin | 54ab4b9d9825e8370855b7985d6ff39d64c19f25 | [
"MIT"
] | 4 | 2016-02-24T13:24:27.000Z | 2016-06-28T12:50:36.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import <DVTKit/DVTLayoutView_ML.h>
#import "DVTDisclosureHeaderViewDelegate.h"
#import "DVTDraggableView.h"
#import "DVTIssueDisplayingView.h"
@class DVTDisclosureHeaderView, NSColor, NSDictionary, NSString, NSView;
@interface DVTDisclosureView : DVTLayoutView_ML <DVTDisclosureHeaderViewDelegate, DVTDraggableView, DVTIssueDisplayingView>
{
NSView *contentView;
DVTDisclosureHeaderView *_headerView;
NSColor *_bottomBorderColor;
NSColor *_backgroundColor;
NSString *_disclosureStatePersistenceDefaultsKey;
CDStruct_bf6d4a14 _contentMargins;
BOOL _shouldAlwaysDrawBottomBorder;
}
+ (id)keyPathsForValuesAffectingDisclosed;
+ (void)initialize;
@property BOOL shouldAlwaysDrawBottomBorder; // @synthesize shouldAlwaysDrawBottomBorder=_shouldAlwaysDrawBottomBorder;
- (void).cxx_destruct;
@property(copy) NSDictionary *issueInfoDictionary;
- (struct CGRect)draggingRect;
- (void)disclosureHeaderView:(id)arg1 didChangeDisclosedState:(BOOL)arg2;
@property(copy) NSString *disclosureStatePersistenceDefaultsKey; // @dynamic disclosureStatePersistenceDefaultsKey;
@property(getter=isDisclosed) BOOL disclosed;
@property(copy) NSColor *backgroundColor;
@property(copy) NSColor *bottomBorderColor;
@property CDStruct_bf6d4a14 contentMargins;
@property(retain) NSView *contentView;
- (void)reflectDefaultsDisclosureState;
- (void)drawRect:(struct CGRect)arg1;
- (struct CGRect)bottomBorderRect;
- (void)layoutBottomUp;
- (void)layoutTopDown;
- (BOOL)shouldDrawBottomBorder;
- (BOOL)isFlipped;
@property(retain) DVTDisclosureHeaderView *headerView; // @dynamic headerView;
- (void)encodeWithCoder:(id)arg1;
- (id)initWithCoder:(id)arg1;
- (id)initWithFrame:(struct CGRect)arg1;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
| 34.881356 | 123 | 0.798834 |
9dbf8bafa04a0b656cd72953ef67da6fc6b48f32 | 441 | h | C | Miss-Scarlett/Miss-Scarlett/Classes/Other/Category/UIBarButtonItem+BWItem.h | mortal-master/Miss-Scarlett | ff6949c8d31af55185bc66338b68d4df6817cf29 | [
"Apache-2.0"
] | null | null | null | Miss-Scarlett/Miss-Scarlett/Classes/Other/Category/UIBarButtonItem+BWItem.h | mortal-master/Miss-Scarlett | ff6949c8d31af55185bc66338b68d4df6817cf29 | [
"Apache-2.0"
] | null | null | null | Miss-Scarlett/Miss-Scarlett/Classes/Other/Category/UIBarButtonItem+BWItem.h | mortal-master/Miss-Scarlett | ff6949c8d31af55185bc66338b68d4df6817cf29 | [
"Apache-2.0"
] | null | null | null | //
// UIBarButtonItem+BWItem.h
// Miss-Scarlett
//
// Created by mortal on 16/10/16.
// Copyright © 2016年 mortal. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIBarButtonItem (BWItem)
+ (instancetype)itemWithImage:(UIImage *)image highImage:(UIImage *)highImage target:(id)target action:(SEL)action;
+ (instancetype)itemWithImage:(UIImage *)image selImage:(UIImage *)selImage target:(id)target action:(SEL)action;
@end
| 25.941176 | 115 | 0.734694 |
6fcc59b10ac928758597f05207ede693c23be6d7 | 1,296 | h | C | cpp/spike/doxygen-test/Component.h | yatesjr/OpenEngine | e379ad9ad47a2b1de1daff3bb931346b3ef1403c | [
"Apache-2.0"
] | 3 | 2018-09-13T03:00:59.000Z | 2019-04-01T23:07:32.000Z | cpp/spike/doxygen-test/Component.h | yatesjr/OpenEngine | e379ad9ad47a2b1de1daff3bb931346b3ef1403c | [
"Apache-2.0"
] | 17 | 2019-03-14T20:52:20.000Z | 2019-05-24T17:15:15.000Z | cpp/spike/doxygen-test/Component.h | yatesjr/OpenEngine | e379ad9ad47a2b1de1daff3bb931346b3ef1403c | [
"Apache-2.0"
] | null | null | null | #ifndef OPENENGINE_COMPONENT_H
#define OPENENGINE_COMPONENT_H
//! Some component to be used in other classes.
//!
//! This is class is used to provide an example of composition.
//!
//! @version 1.0.0
//! @pre Understand composition.
//! @bug There are *no* bugs!
//! @copyright GNU Public License
//! @date 1989-2018
//! @author jyates
//!
class Component {
//! Simple component of type INT.
int m_someComponentMember;
public:
//! Explicit constructor used to initialize an instance of Component.
//!
//! @param componentMember Value used for initialization.
//!
explicit Component(int componentMember);
//! Explicitly declared destructor marked as default.
//!
//! We explicitly declare this to ensure it is marked as virtual, which
//! makes this class safe to use for inheritance. However, being marked as
//! default, the compiler will generate a simple implementation for us.
//!
virtual ~Component() = default;
//! Simple getter for the component member variable.
int someComponentMember() const;
};
inline Component::Component(int componentMember) :
m_someComponentMember(componentMember) { }
inline int Component::someComponentMember() const {
return m_someComponentMember;
}
#endif //OPENENGINE_COMPONENT_H
| 28.173913 | 78 | 0.709877 |
7797e7baf5b39974e1f38e8b7039c467ccbbade0 | 1,106 | h | C | include/easyhttpcpp/common/CacheStrategy.h | commshare/easyhttpcpp | 757ec75679c1cbc5f04c81a30133f4bcd3e780f4 | [
"MIT"
] | 147 | 2017-10-05T01:42:02.000Z | 2022-01-21T08:15:05.000Z | include/easyhttpcpp/common/CacheStrategy.h | commshare/easyhttpcpp | 757ec75679c1cbc5f04c81a30133f4bcd3e780f4 | [
"MIT"
] | 20 | 2018-05-17T01:55:16.000Z | 2021-04-20T07:27:00.000Z | include/easyhttpcpp/common/CacheStrategy.h | commshare/easyhttpcpp | 757ec75679c1cbc5f04c81a30133f4bcd3e780f4 | [
"MIT"
] | 32 | 2018-05-05T13:04:34.000Z | 2022-03-25T16:57:11.000Z | /*
* Copyright 2017 Sony Corporation
*/
#ifndef EASYHTTPCPP_COMMON_CACHESTRATEGY_H_INCLUDED
#define EASYHTTPCPP_COMMON_CACHESTRATEGY_H_INCLUDED
#include "Poco/AutoPtr.h"
#include "Poco/RefCountedObject.h"
#include "Poco/ScopedLock.h"
#include "easyhttpcpp/common/CacheStrategyListener.h"
namespace easyhttpcpp {
namespace common {
// TValue is intended Poco::AutoPtr.
template<class TKey, class TValue>
class CacheStrategy : public Poco::RefCountedObject {
public:
typedef Poco::AutoPtr<CacheStrategy<TKey, TValue> > Ptr;
typedef Poco::ScopedLock<CacheStrategy<TKey, TValue> > ScopedLock;
virtual ~CacheStrategy()
{
}
virtual void setListener(CacheStrategyListener <TKey, TValue>* pListener) = 0;
virtual bool add(const TKey& key, TValue value) = 0;
virtual bool update(const TKey& key, TValue value) = 0;
virtual bool remove(const TKey& key) = 0;
virtual TValue get(const TKey& key) = 0;
virtual bool clear(bool mayDeleteIfBusy) = 0;
};
} /* namespace common */
} /* namespace easyhttpcpp */
#endif /* EASYHTTPCPP_COMMON_CACHESTRATEGY_H_INCLUDED */
| 26.97561 | 82 | 0.740506 |
ae53d1603c92a61433741c6ad34cc7c1ae92d6bf | 261 | h | C | NotificationService/NotificationService.h | Projects-OC/Objc | 107b76840f91d2afd6b739173c21df7fdb3982fd | [
"MIT"
] | null | null | null | NotificationService/NotificationService.h | Projects-OC/Objc | 107b76840f91d2afd6b739173c21df7fdb3982fd | [
"MIT"
] | null | null | null | NotificationService/NotificationService.h | Projects-OC/Objc | 107b76840f91d2afd6b739173c21df7fdb3982fd | [
"MIT"
] | null | null | null | //
// NotificationService.h
// NotificationService
//
// Created by header on 2019/7/25.
// Copyright © 2019 mf. All rights reserved.
//
#import <UserNotifications/UserNotifications.h>
@interface NotificationService : UNNotificationServiceExtension
@end
| 18.642857 | 63 | 0.754789 |
5b55c2d3cb71327d2327a225f52abb82922abfe8 | 2,150 | h | C | OpenC2X/common/asn1/HazardousLocation-ObstacleOnTheRoadSubCauseCode.h | zdzaz/e-c-its | dbe4f191d6d5e7dd50a28e4fcffd3123a64c0372 | [
"MIT"
] | null | null | null | OpenC2X/common/asn1/HazardousLocation-ObstacleOnTheRoadSubCauseCode.h | zdzaz/e-c-its | dbe4f191d6d5e7dd50a28e4fcffd3123a64c0372 | [
"MIT"
] | null | null | null | OpenC2X/common/asn1/HazardousLocation-ObstacleOnTheRoadSubCauseCode.h | zdzaz/e-c-its | dbe4f191d6d5e7dd50a28e4fcffd3123a64c0372 | [
"MIT"
] | null | null | null | /*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "ITS-Container"
* found in "its_facilities_pdu_all.asn"
* `asn1c -fnative-types -gen-PER`
*/
#ifndef _HazardousLocation_ObstacleOnTheRoadSubCauseCode_H_
#define _HazardousLocation_ObstacleOnTheRoadSubCauseCode_H_
#include <asn_application.h>
/* Including external dependencies */
#include <NativeInteger.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum HazardousLocation_ObstacleOnTheRoadSubCauseCode {
HazardousLocation_ObstacleOnTheRoadSubCauseCode_unavailable = 0,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_shedLoad = 1,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_partsOfVehicles = 2,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_partsOfTyres = 3,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_bigObjects = 4,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_fallenTrees = 5,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_hubCaps = 6,
HazardousLocation_ObstacleOnTheRoadSubCauseCode_waitingVehicles = 7
} e_HazardousLocation_ObstacleOnTheRoadSubCauseCode;
/* HazardousLocation-ObstacleOnTheRoadSubCauseCode */
typedef long HazardousLocation_ObstacleOnTheRoadSubCauseCode_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_HazardousLocation_ObstacleOnTheRoadSubCauseCode;
asn_struct_free_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_free;
asn_struct_print_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_print;
asn_constr_check_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_constraint;
ber_type_decoder_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_decode_ber;
der_type_encoder_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_encode_der;
xer_type_decoder_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_decode_xer;
xer_type_encoder_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_encode_xer;
per_type_decoder_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_decode_uper;
per_type_encoder_f HazardousLocation_ObstacleOnTheRoadSubCauseCode_encode_uper;
#ifdef __cplusplus
}
#endif
#endif /* _HazardousLocation_ObstacleOnTheRoadSubCauseCode_H_ */
#include <asn_internal.h>
| 39.814815 | 85 | 0.887442 |
e3308bf368d3f57c5575f1191f557e19158dab85 | 612 | c | C | Lab Question Solve/Loops/digit_average.c | ArnobMahmud/CSE102-CP | 110df34dd4cb9e9e94f519579b2f3770887344b1 | [
"MIT"
] | null | null | null | Lab Question Solve/Loops/digit_average.c | ArnobMahmud/CSE102-CP | 110df34dd4cb9e9e94f519579b2f3770887344b1 | [
"MIT"
] | null | null | null | Lab Question Solve/Loops/digit_average.c | ArnobMahmud/CSE102-CP | 110df34dd4cb9e9e94f519579b2f3770887344b1 | [
"MIT"
] | null | null | null | /* Qn :
Write a C program to find the average of the first and last digit of a number.
Sample Input Sample Output
12356 3.5
34972 2.5
*/
/*
Author : Arnob Mahmud
mail : arnob.tech.me@gmail.com
*/
#include <stdio.h>
int main(int argc, char const *argv[])
{
int num, sum = 0, rem;
float avg;
scanf("%d", &num);
sum = num % 10;
while (num != 0)
{
rem = num % 10;
num /= 10;
}
sum += rem;
avg = sum / 2.0;
printf("%.1f", avg);
return 0;
}
| 16.105263 | 82 | 0.444444 |
8b9fab10f9e33c6b7fa45a9d3e385d53597f5c56 | 275 | h | C | submodules/Digit_Model/gen/kin/eigen/include/R_left_shoulder_roll.h | prem-chand/Cassie_CFROST | da4bd51442f86e852cbb630cc91c9a380a10b66d | [
"BSD-3-Clause"
] | null | null | null | submodules/Digit_Model/gen/kin/eigen/include/R_left_shoulder_roll.h | prem-chand/Cassie_CFROST | da4bd51442f86e852cbb630cc91c9a380a10b66d | [
"BSD-3-Clause"
] | null | null | null | submodules/Digit_Model/gen/kin/eigen/include/R_left_shoulder_roll.h | prem-chand/Cassie_CFROST | da4bd51442f86e852cbb630cc91c9a380a10b66d | [
"BSD-3-Clause"
] | null | null | null | /*
* Automatically Generated from Mathematica.
* Thu 4 Nov 2021 17:00:44 GMT-04:00
*/
#ifndef R_LEFT_SHOULDER_ROLL_H
#define R_LEFT_SHOULDER_ROLL_H
#include <Eigen/Dense>
Eigen::Matrix<double,3,3> R_left_shoulder_roll(const Eigen::Matrix<double,36,1> &var1);
#endif
| 18.333333 | 87 | 0.752727 |
e9064732f784666a52fe3f6954788d3ae64640db | 12,835 | c | C | thirdparty/molfile_plugin/src/pqrplugin.c | caioss/molpp | 051f94545a6c687189697c950b1a4060a18060d5 | [
"BSD-3-Clause"
] | null | null | null | thirdparty/molfile_plugin/src/pqrplugin.c | caioss/molpp | 051f94545a6c687189697c950b1a4060a18060d5 | [
"BSD-3-Clause"
] | null | null | null | thirdparty/molfile_plugin/src/pqrplugin.c | caioss/molpp | 051f94545a6c687189697c950b1a4060a18060d5 | [
"BSD-3-Clause"
] | null | null | null | /***************************************************************************
*cr
*cr (C) Copyright 1995-2016 The Board of Trustees of the
*cr University of Illinois
*cr All Rights Reserved
*cr
***************************************************************************/
/***************************************************************************
* RCS INFORMATION:
*
* $RCSfile: pqrplugin.c,v $
* $Author: johns $ $Locker: $ $State: Exp $
* $Revision: 1.21 $ $Date: 2016/11/28 05:01:54 $
*
***************************************************************************/
/*
* PQR is be a space-delimited variant of the PDB format, with atom radius
* and charge information replacing the B-factor and occupancy columns, and
* containing only ATOM records.
*
* Most of this code is lifted from pdbplugin and readpdb.h
*/
#include "molfile_plugin.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define PQR_RECORD_LENGTH 80
/* record type defines */
enum {PQR_REMARK, PQR_ATOM, PQR_UNKNOWN, PQR_END, PQR_EOF, PQR_ERROR, PQR_CRYST1};
/*
* read the next record from the specified pqr file, and put the string
* found in the given string pointer (the caller must provide adequate (81
* chars) buffer space); return the type of record found
*/
static int read_pqr_record(FILE *f, char *retStr) {
char inbuf[PQR_RECORD_LENGTH+2];
int recType = PQR_UNKNOWN;
/* XXX This PQR record reading code breaks with files that use
* Mac or DOS style line breaks with ctrl-M characters. We need
* to replace the use of fgets() and comparisons against \n with
* code that properly handles the other cases.
*/
/* read the next line */
if(inbuf != fgets(inbuf, PQR_RECORD_LENGTH+1, f)) {
retStr[0] = '\0';
if (feof(f)) {
recType = PQR_EOF;
}
else {
recType = PQR_ERROR;
}
}
else {
/* remove the newline character, if there is one */
if(inbuf[strlen(inbuf)-1] == '\n')
inbuf[strlen(inbuf)-1] = '\0';
if (!strncmp(inbuf, "ATOM ", 5) || !strncmp(inbuf, "HETATM", 6)) {
/* Note that by only comparing 5 chars for "ATOM " rather than 6, */
/* we allow PQR files containing > 99,999 atoms generated by AMBER */
/* to load which would otherwise fail. Not needed for HETATM since */
/* those aren't going to show up in files produced for/by MD engines. */
strcpy(retStr,inbuf);
recType = PQR_ATOM;
} else if (!strncmp(inbuf, "CRYST1", 6)) {
recType = PQR_CRYST1;
strcpy(retStr,inbuf);
} else if (!strncmp(inbuf, "END", 3)) {
strcpy(retStr,inbuf);
recType = PQR_END;
} else {
retStr[0] = '\0';
recType = PQR_UNKNOWN;
}
}
/* read the '\r', if there was one */
{
int ch = fgetc(f);
if (ch != '\r') {
ungetc(ch, f);
}
}
return recType;
}
/* Extract the alpha/beta/gamma a/b/c unit cell info from a CRYST1 record */
static void get_pqr_cryst1(const char *record,
float *alpha, float *beta, float *gamma,
float *a, float *b, float *c) {
char tmp[PQR_RECORD_LENGTH+3]; /* space for line + cr + lf + NUL */
char ch, *s;
memset(tmp, 0, sizeof(tmp));
strncpy(tmp, record, PQR_RECORD_LENGTH);
s = tmp+6 ; ch = tmp[15]; tmp[15] = 0;
*a = (float) atof(s);
s = tmp+15; *s = ch; ch = tmp[24]; tmp[24] = 0;
*b = (float) atof(s);
s = tmp+24; *s = ch; ch = tmp[33]; tmp[33] = 0;
*c = (float) atof(s);
s = tmp+33; *s = ch; ch = tmp[40]; tmp[40] = 0;
*alpha = (float) atof(s);
s = tmp+40; *s = ch; ch = tmp[47]; tmp[47] = 0;
*beta = (float) atof(s);
s = tmp+47; *s = ch; ch = tmp[54]; tmp[54] = 0;
*gamma = (float) atof(s);
}
/*
* Read the fields in an ATOM line. Return 0 on success, nonzero otherwise.
*/
static int get_pqr_fields(char *record, char *name, char *resname, char *chain,
char *segname, char *resid,
float *x, float *y, float *z, float *charge, float *radius) {
/*
* PQR files are like pdb files, but not quite. They're fixed format
* for the the identifier data up to resid, but after that it's free-format
* for the floating point data.
*/
strncpy(name, record+12, 4); name[4] = 0;
strncpy(resname, record+17, 4); resname[4] = 0;
strncpy(chain, record+21, 1); chain[1] = 0;
strncpy(resid, record+22, 4); resid[4] = 0;
/* XXX what to do about the segid? */
segname[0] = 0;
if (sscanf(record+30, "%f%f%f%f%f", x, y, z, charge, radius) != 5) {
return 1;
}
/* success */
return 0;
}
/*
* Read the coordinates in an ATOM line. Return 0 on success, nonzero otherwise.
*/
static int get_pqr_coordinates(char *record, float *x, float *y, float *z) {
/* skip over the fixed format part and only parse the coordinates */
if (sscanf(record+30, "%f%f%f", x, y, z) != 3) {
return 1;
}
return 0;
}
/*
* Return a default radius for the given atom.
*/
static float get_atom_radius(molfile_atom_t *atom) {
char *name, *type;
name = atom->name;
type = atom->type;
/* XXX - yeah, this needs to be fixed */
return 1.0;
}
/*
* Append a PQR ATOM record to the given file.
*/
static int write_pqr_atom(FILE *fd, int index, const molfile_atom_t *atom,
float x, float y, float z) {
int rc;
rc = fprintf(fd, "ATOM %5d %-4s %s %5d %8.3f %8.3f %8.3f %.3f %.3f\n",
index, atom->name, atom->resname, atom->resid,
x, y, z, atom->charge, atom->radius);
return (rc > 0);
}
/*
* API functions start here
*/
typedef struct {
FILE *fd;
int natoms;
molfile_atom_t *atomlist;
} pqrdata;
static void *open_pqr_read(const char *filepath, const char *filetype,
int *natoms) {
FILE *fd;
pqrdata *pqr;
char pqr_record[PQR_RECORD_LENGTH+2];
int record_type;
fd = fopen(filepath, "r");
if (!fd)
return NULL;
pqr = (pqrdata *)malloc(sizeof(pqrdata));
pqr->fd = fd;
*natoms=0;
do {
record_type = read_pqr_record(pqr->fd, pqr_record);
if (record_type == PQR_ATOM) {
*natoms += 1;
} else if (record_type == PQR_ERROR) {
printf("pqrplugin) Error reading file after opening.\n");
free(pqr);
return NULL;
}
} while ((record_type != PQR_EOF) && (record_type != PQR_END));
/* If no atoms were found, this is probably not a PQR file! */
if (!*natoms) {
printf("pqrplugin) file '%s' contains no atoms.\n", filepath);
free(pqr);
return NULL;
}
rewind(pqr->fd);
pqr->natoms = *natoms;
return pqr;
}
/*
* Read atom structure, but not coordinate information.
*/
static int read_pqr_structure(void *mydata, int *optflags,
molfile_atom_t *atoms) {
pqrdata *pqr = (pqrdata *)mydata;
molfile_atom_t *atom;
char pqr_record[PQR_RECORD_LENGTH + 1];
int i, record_type;
char ridstr[8];
float newpos;
long fpos = ftell(pqr->fd);
*optflags = MOLFILE_CHARGE | MOLFILE_RADIUS;
i = 0;
do {
record_type = read_pqr_record(pqr->fd, pqr_record);
if (((record_type == PQR_EOF) || (record_type == PQR_END))
&& (i < pqr->natoms)) {
printf("pqrplugin) unexpected end-of-file while reading structure.\n");
printf("XXX: %d of %d \n", i, pqr->natoms);
return MOLFILE_ERROR;
} else if (record_type == PQR_ERROR) {
printf("pqrplugin) error reading atom coordinates.\n");
return MOLFILE_ERROR;
} else if (record_type == PQR_ATOM) {
if (i >= pqr->natoms) {
printf("pqrplugin) too many atoms.\n");
return MOLFILE_ERROR;
}
atom = atoms+i;
get_pqr_fields(pqr_record, atom->name, atom->resname, atom->chain,
atom->segid, ridstr,
&newpos, &newpos, &newpos, &atom->charge, &atom->radius);
atom->resid = atoi(ridstr);
strcpy(atom->type, atom->name);
i++;
}
} while((record_type != PQR_EOF) && (record_type != PQR_END));
fseek(pqr->fd, fpos, SEEK_SET);
return MOLFILE_SUCCESS;
}
/*
* Read atom coordinates. PQR files contain only a single "timestep".
*/
static int read_pqr_timestep(void *v, int natoms, molfile_timestep_t *ts) {
pqrdata *pqr = (pqrdata *)v;
char pqr_record[PQR_RECORD_LENGTH+2];
int record_type, i;
float *x, *y, *z;
if (pqr->natoms == 0)
return MOLFILE_ERROR; /* EOF */
if (ts != NULL) {
x = ts->coords;
y = x+1;
z = x+2;
} else {
x = y = z = NULL;
}
i = 0;
do {
record_type = read_pqr_record(pqr->fd, pqr_record);
if (((record_type == PQR_EOF) || (record_type == PQR_END))
&& (i < pqr->natoms)) {
if (i == 0) {
/* don't emit an error if there're no more timesteps */
return MOLFILE_EOF;
} else {
printf("pqrplugin) unexpected end-of-file while reading timestep.\n");
return MOLFILE_ERROR;
}
} else if (record_type == PQR_ERROR) {
printf("pqrplugin) error reading atom coordinates.\n");
return MOLFILE_ERROR;
} else if (record_type == PQR_CRYST1) {
if (ts) {
get_pqr_cryst1(pqr_record, &ts->alpha, &ts->beta, &ts->gamma,
&ts->A, &ts->B, &ts->C);
}
} else if (record_type == PQR_ATOM) {
/* just get the coordinates, and store them */
if (ts != NULL) {
get_pqr_coordinates(pqr_record, x, y, z);
x += 3;
y += 3;
z += 3;
}
i++;
}
} while(i < pqr->natoms);
return MOLFILE_SUCCESS;
}
static void close_pqr_read(void *v) {
pqrdata *pqr = (pqrdata *)v;
if (pqr->fd) {
fclose(pqr->fd);
pqr->fd = 0;
}
free(pqr);
}
static void *open_pqr_write(const char *path, const char *filetype,
int natoms) {
FILE *fd;
pqrdata *pqr;
fd = fopen(path, "w");
if (!fd) {
printf("pqrplugin) unable to open file %s for writing\n", path);
return NULL;
}
pqr = (pqrdata *)malloc(sizeof(pqrdata));
pqr->fd = fd;
pqr->natoms = natoms;
pqr->atomlist = NULL;
return pqr;
}
static int write_pqr_structure(void *v, int optflags,
const molfile_atom_t *atoms) {
int i;
pqrdata *pqr = (pqrdata *)v;
int natoms = pqr->natoms;
pqr->atomlist = (molfile_atom_t *)malloc(natoms*sizeof(molfile_atom_t));
memcpy(pqr->atomlist, atoms, natoms*sizeof(molfile_atom_t));
/* If charge and radius aren't given, we assign defaultvalues. */
if (!(optflags & MOLFILE_CHARGE)) {
printf("pqrplugin) Warning no atom charges available, assigning zero\n");
for (i=0; i<natoms; i++) pqr->atomlist[i].charge = 0.0f;
}
if (!(optflags & MOLFILE_RADIUS)) {
printf("pqrplugin) Warning no atom radii available, assigning radii of 1.0\n");
for (i=0; i<natoms; i++) pqr->atomlist[i].radius =
get_atom_radius(&(pqr->atomlist[i]));
}
return MOLFILE_SUCCESS;
}
static void write_pqr_cryst1(FILE *fd, const molfile_timestep_t *ts) {
fprintf(fd, "CRYST1%9.3f%9.3f%9.3f%7.2f%7.2f%7.2f P 1 1\n",
ts->A, ts->B, ts->C, ts->alpha, ts->beta, ts->gamma);
}
static int write_pqr_timestep(void *v, const molfile_timestep_t *ts) {
pqrdata *pqr = (pqrdata *)v;
const molfile_atom_t *atom;
const float *pos;
int i;
if (pqr->natoms == 0)
return MOLFILE_SUCCESS;
write_pqr_cryst1(pqr->fd, ts);
atom = pqr->atomlist;
pos = ts->coords;
for (i=0; i<pqr->natoms; i++) {
if (!write_pqr_atom(pqr->fd, i+1, atom, pos[0], pos[1], pos[2])) {
printf("pqrplugin) error writing atom %d; file may be incomplete.\n", i+1);
return MOLFILE_ERROR;
}
atom++;
pos += 3;
}
fprintf(pqr->fd, "END\n");
return MOLFILE_SUCCESS;
}
static void close_pqr_write(void *v) {
pqrdata *pqr = (pqrdata *)v;
fclose(pqr->fd);
free(pqr->atomlist);
free(pqr);
}
/*
* Initialization stuff down here
*/
static molfile_plugin_t plugin;
VMDPLUGIN_API int VMDPLUGIN_init() {
memset(&plugin, 0, sizeof(molfile_plugin_t));
plugin.abiversion = vmdplugin_ABIVERSION;
plugin.type = MOLFILE_PLUGIN_TYPE;
plugin.name = "pqr";
plugin.prettyname = "PQR";
plugin.author = "Eamon Caddigan";
plugin.majorv = 0;
plugin.minorv = 6;
plugin.is_reentrant = VMDPLUGIN_THREADSAFE;
plugin.filename_extension = "pqr";
plugin.open_file_read = open_pqr_read;
plugin.read_structure = read_pqr_structure;
plugin.read_next_timestep = read_pqr_timestep;
plugin.close_file_read = close_pqr_read;
plugin.open_file_write = open_pqr_write;
plugin.write_structure = write_pqr_structure;
plugin.write_timestep = write_pqr_timestep;
plugin.close_file_write = close_pqr_write;
return VMDPLUGIN_SUCCESS;
}
VMDPLUGIN_API int VMDPLUGIN_register(void *v, vmdplugin_register_cb cb) {
(*cb)(v, (vmdplugin_t *)&plugin);
return VMDPLUGIN_SUCCESS;
}
VMDPLUGIN_API int VMDPLUGIN_fini() {
return VMDPLUGIN_SUCCESS;
}
| 28.14693 | 83 | 0.598364 |
e93e8c65f3a515b63be76de338e4d816f349b08c | 27,170 | c | C | src/util/disk_cache_os.c | SoftReaper/Mesa-Renoir-deb | 8d1de1f66058d62b41fe55d36522efea2bdf996d | [
"MIT"
] | null | null | null | src/util/disk_cache_os.c | SoftReaper/Mesa-Renoir-deb | 8d1de1f66058d62b41fe55d36522efea2bdf996d | [
"MIT"
] | null | null | null | src/util/disk_cache_os.c | SoftReaper/Mesa-Renoir-deb | 8d1de1f66058d62b41fe55d36522efea2bdf996d | [
"MIT"
] | null | null | null | /*
* Copyright © 2014 Intel Corporation
*
* 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 (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND 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.
*/
#ifdef ENABLE_SHADER_CACHE
#include <assert.h>
#include <inttypes.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
#include <fcntl.h>
#include "util/compress.h"
#include "util/crc32.h"
struct cache_entry_file_data {
uint32_t crc32;
uint32_t uncompressed_size;
};
#if DETECT_OS_WINDOWS
/* TODO: implement disk cache support on windows */
#else
#include <dirent.h>
#include <errno.h>
#include <pwd.h>
#include <stdio.h>
#include <string.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "util/blob.h"
#include "util/crc32.h"
#include "util/debug.h"
#include "util/disk_cache.h"
#include "util/disk_cache_os.h"
#include "util/ralloc.h"
#include "util/rand_xor.h"
/* Create a directory named 'path' if it does not already exist.
*
* Returns: 0 if path already exists as a directory or if created.
* -1 in all other cases.
*/
static int
mkdir_if_needed(const char *path)
{
struct stat sb;
/* If the path exists already, then our work is done if it's a
* directory, but it's an error if it is not.
*/
if (stat(path, &sb) == 0) {
if (S_ISDIR(sb.st_mode)) {
return 0;
} else {
fprintf(stderr, "Cannot use %s for shader cache (not a directory)"
"---disabling.\n", path);
return -1;
}
}
int ret = mkdir(path, 0755);
if (ret == 0 || (ret == -1 && errno == EEXIST))
return 0;
fprintf(stderr, "Failed to create %s for shader cache (%s)---disabling.\n",
path, strerror(errno));
return -1;
}
/* Concatenate an existing path and a new name to form a new path. If the new
* path does not exist as a directory, create it then return the resulting
* name of the new path (ralloc'ed off of 'ctx').
*
* Returns NULL on any error, such as:
*
* <path> does not exist or is not a directory
* <path>/<name> exists but is not a directory
* <path>/<name> cannot be created as a directory
*/
static char *
concatenate_and_mkdir(void *ctx, const char *path, const char *name)
{
char *new_path;
struct stat sb;
if (stat(path, &sb) != 0 || ! S_ISDIR(sb.st_mode))
return NULL;
new_path = ralloc_asprintf(ctx, "%s/%s", path, name);
if (mkdir_if_needed(new_path) == 0)
return new_path;
else
return NULL;
}
struct lru_file {
struct list_head node;
char *lru_name;
size_t lru_file_size;
time_t lru_atime;
};
static void
free_lru_file_list(struct list_head *lru_file_list)
{
struct lru_file *e, *next;
LIST_FOR_EACH_ENTRY_SAFE(e, next, lru_file_list, node) {
free(e->lru_name);
free(e);
}
free(lru_file_list);
}
/* Given a directory path and predicate function, create a linked list of entrys
* with the oldest access time in that directory for which the predicate
* returns true.
*
* Returns: A malloc'ed linkd list for the paths of chosen files, (or
* NULL on any error). The caller should free the linked list via
* free_lru_file_list() when finished.
*/
static struct list_head *
choose_lru_file_matching(const char *dir_path,
bool (*predicate)(const char *dir_path,
const struct stat *,
const char *, const size_t))
{
DIR *dir;
struct dirent *dir_ent;
dir = opendir(dir_path);
if (dir == NULL)
return NULL;
/* First count the number of files in the directory */
unsigned total_file_count = 0;
while ((dir_ent = readdir(dir)) != NULL) {
if (dir_ent->d_type == DT_REG) { /* If the entry is a regular file */
total_file_count++;
}
}
/* Reset to the start of the directory */
rewinddir(dir);
/* Collect 10% of files in this directory for removal. Note: This should work
* out to only be around 0.04% of total cache items.
*/
unsigned lru_file_count = total_file_count > 10 ? total_file_count / 10 : 1;
struct list_head *lru_file_list = malloc(sizeof(struct list_head));
list_inithead(lru_file_list);
unsigned processed_files = 0;
while (1) {
dir_ent = readdir(dir);
if (dir_ent == NULL)
break;
struct stat sb;
if (fstatat(dirfd(dir), dir_ent->d_name, &sb, 0) == 0) {
struct lru_file *entry = NULL;
if (!list_is_empty(lru_file_list))
entry = list_first_entry(lru_file_list, struct lru_file, node);
if (!entry|| sb.st_atime < entry->lru_atime) {
size_t len = strlen(dir_ent->d_name);
if (!predicate(dir_path, &sb, dir_ent->d_name, len))
continue;
bool new_entry = false;
if (processed_files < lru_file_count) {
entry = calloc(1, sizeof(struct lru_file));
new_entry = true;
}
processed_files++;
char *tmp = realloc(entry->lru_name, len + 1);
if (tmp) {
/* Find location to insert new lru item. We want to keep the
* list ordering from most recently used to least recently used.
* This allows us to just evict the head item from the list as
* we process the directory and find older entrys.
*/
struct list_head *list_node = lru_file_list;
struct lru_file *e;
LIST_FOR_EACH_ENTRY(e, lru_file_list, node) {
if (sb.st_atime < entry->lru_atime) {
list_node = &e->node;
break;
}
}
if (new_entry) {
list_addtail(&entry->node, list_node);
} else {
if (list_node != lru_file_list) {
list_del(lru_file_list);
list_addtail(lru_file_list, list_node);
}
}
entry->lru_name = tmp;
memcpy(entry->lru_name, dir_ent->d_name, len + 1);
entry->lru_atime = sb.st_atime;
entry->lru_file_size = sb.st_blocks * 512;
}
}
}
}
if (list_is_empty(lru_file_list)) {
closedir(dir);
free(lru_file_list);
return NULL;
}
/* Create the full path for the file list we found */
struct lru_file *e;
LIST_FOR_EACH_ENTRY(e, lru_file_list, node) {
char *filename = e->lru_name;
if (asprintf(&e->lru_name, "%s/%s", dir_path, filename) < 0)
e->lru_name = NULL;
free(filename);
}
closedir(dir);
return lru_file_list;
}
/* Is entry a regular file, and not having a name with a trailing
* ".tmp"
*/
static bool
is_regular_non_tmp_file(const char *path, const struct stat *sb,
const char *d_name, const size_t len)
{
if (!S_ISREG(sb->st_mode))
return false;
if (len >= 4 && strcmp(&d_name[len-4], ".tmp") == 0)
return false;
return true;
}
/* Returns the size of the deleted file, (or 0 on any error). */
static size_t
unlink_lru_file_from_directory(const char *path)
{
struct list_head *lru_file_list =
choose_lru_file_matching(path, is_regular_non_tmp_file);
if (lru_file_list == NULL)
return 0;
assert(!list_is_empty(lru_file_list));
size_t total_unlinked_size = 0;
struct lru_file *e;
LIST_FOR_EACH_ENTRY(e, lru_file_list, node) {
if (unlink(e->lru_name) == 0)
total_unlinked_size += e->lru_file_size;
}
free_lru_file_list(lru_file_list);
return total_unlinked_size;
}
/* Is entry a directory with a two-character name, (and not the
* special name of ".."). We also return false if the dir is empty.
*/
static bool
is_two_character_sub_directory(const char *path, const struct stat *sb,
const char *d_name, const size_t len)
{
if (!S_ISDIR(sb->st_mode))
return false;
if (len != 2)
return false;
if (strcmp(d_name, "..") == 0)
return false;
char *subdir;
if (asprintf(&subdir, "%s/%s", path, d_name) == -1)
return false;
DIR *dir = opendir(subdir);
free(subdir);
if (dir == NULL)
return false;
unsigned subdir_entries = 0;
struct dirent *d;
while ((d = readdir(dir)) != NULL) {
if(++subdir_entries > 2)
break;
}
closedir(dir);
/* If dir only contains '.' and '..' it must be empty */
if (subdir_entries <= 2)
return false;
return true;
}
/* Create the directory that will be needed for the cache file for \key.
*
* Obviously, the implementation here must closely match
* _get_cache_file above.
*/
static void
make_cache_file_directory(struct disk_cache *cache, const cache_key key)
{
char *dir;
char buf[41];
_mesa_sha1_format(buf, key);
if (asprintf(&dir, "%s/%c%c", cache->path, buf[0], buf[1]) == -1)
return;
mkdir_if_needed(dir);
free(dir);
}
static ssize_t
read_all(int fd, void *buf, size_t count)
{
char *in = buf;
ssize_t read_ret;
size_t done;
for (done = 0; done < count; done += read_ret) {
read_ret = read(fd, in + done, count - done);
if (read_ret == -1 || read_ret == 0)
return -1;
}
return done;
}
static ssize_t
write_all(int fd, const void *buf, size_t count)
{
const char *out = buf;
ssize_t written;
size_t done;
for (done = 0; done < count; done += written) {
written = write(fd, out + done, count - done);
if (written == -1)
return -1;
}
return done;
}
/* Evict least recently used cache item */
void
disk_cache_evict_lru_item(struct disk_cache *cache)
{
char *dir_path;
/* With a reasonably-sized, full cache, (and with keys generated
* from a cryptographic hash), we can choose two random hex digits
* and reasonably expect the directory to exist with a file in it.
* Provides pseudo-LRU eviction to reduce checking all cache files.
*/
uint64_t rand64 = rand_xorshift128plus(cache->seed_xorshift128plus);
if (asprintf(&dir_path, "%s/%02" PRIx64 , cache->path, rand64 & 0xff) < 0)
return;
size_t size = unlink_lru_file_from_directory(dir_path);
free(dir_path);
if (size) {
p_atomic_add(cache->size, - (uint64_t)size);
return;
}
/* In the case where the random choice of directory didn't find
* something, we choose the least recently accessed from the
* existing directories.
*
* Really, the only reason this code exists is to allow the unit
* tests to work, (which use an artificially-small cache to be able
* to force a single cached item to be evicted).
*/
struct list_head *lru_file_list =
choose_lru_file_matching(cache->path, is_two_character_sub_directory);
if (lru_file_list == NULL)
return;
assert(!list_is_empty(lru_file_list));
struct lru_file *lru_file_dir =
list_first_entry(lru_file_list, struct lru_file, node);
size = unlink_lru_file_from_directory(lru_file_dir->lru_name);
free_lru_file_list(lru_file_list);
if (size)
p_atomic_add(cache->size, - (uint64_t)size);
}
void
disk_cache_evict_item(struct disk_cache *cache, char *filename)
{
struct stat sb;
if (stat(filename, &sb) == -1) {
free(filename);
return;
}
unlink(filename);
free(filename);
if (sb.st_blocks)
p_atomic_add(cache->size, - (uint64_t)sb.st_blocks * 512);
}
static void *
parse_and_validate_cache_item(struct disk_cache *cache, void *cache_item,
size_t cache_item_size, size_t *size)
{
uint8_t *uncompressed_data = NULL;
struct blob_reader ci_blob_reader;
blob_reader_init(&ci_blob_reader, cache_item, cache_item_size);
size_t header_size = cache->driver_keys_blob_size;
const void *keys_blob = blob_read_bytes(&ci_blob_reader, header_size);
if (ci_blob_reader.overrun)
goto fail;
/* Check for extremely unlikely hash collisions */
if (memcmp(cache->driver_keys_blob, keys_blob, header_size) != 0) {
assert(!"Mesa cache keys mismatch!");
goto fail;
}
uint32_t md_type = blob_read_uint32(&ci_blob_reader);
if (ci_blob_reader.overrun)
goto fail;
if (md_type == CACHE_ITEM_TYPE_GLSL) {
uint32_t num_keys = blob_read_uint32(&ci_blob_reader);
if (ci_blob_reader.overrun)
goto fail;
/* The cache item metadata is currently just used for distributing
* precompiled shaders, they are not used by Mesa so just skip them for
* now.
* TODO: pass the metadata back to the caller and do some basic
* validation.
*/
const void UNUSED *metadata =
blob_read_bytes(&ci_blob_reader, num_keys * sizeof(cache_key));
if (ci_blob_reader.overrun)
goto fail;
}
/* Load the CRC that was created when the file was written. */
struct cache_entry_file_data *cf_data =
(struct cache_entry_file_data *)
blob_read_bytes(&ci_blob_reader, sizeof(struct cache_entry_file_data));
if (ci_blob_reader.overrun)
goto fail;
size_t cache_data_size = ci_blob_reader.end - ci_blob_reader.current;
const uint8_t *data = (uint8_t *) blob_read_bytes(&ci_blob_reader, cache_data_size);
/* Check the data for corruption */
if (cf_data->crc32 != util_hash_crc32(data, cache_data_size))
goto fail;
/* Uncompress the cache data */
uncompressed_data = malloc(cf_data->uncompressed_size);
if (!util_compress_inflate(data, cache_data_size, uncompressed_data,
cf_data->uncompressed_size))
goto fail;
if (size)
*size = cf_data->uncompressed_size;
return uncompressed_data;
fail:
if (uncompressed_data)
free(uncompressed_data);
return NULL;
}
void *
disk_cache_load_item(struct disk_cache *cache, char *filename, size_t *size)
{
uint8_t *data = NULL;
int fd = open(filename, O_RDONLY | O_CLOEXEC);
if (fd == -1)
goto fail;
struct stat sb;
if (fstat(fd, &sb) == -1)
goto fail;
data = malloc(sb.st_size);
if (data == NULL)
goto fail;
/* Read entire file into memory */
int ret = read_all(fd, data, sb.st_size);
if (ret == -1)
goto fail;
uint8_t *uncompressed_data =
parse_and_validate_cache_item(cache, data, sb.st_size, size);
if (!uncompressed_data)
goto fail;
free(data);
free(filename);
close(fd);
return uncompressed_data;
fail:
if (data)
free(data);
if (filename)
free(filename);
if (fd != -1)
close(fd);
return NULL;
}
/* Return a filename within the cache's directory corresponding to 'key'.
*
* Returns NULL if out of memory.
*/
char *
disk_cache_get_cache_filename(struct disk_cache *cache, const cache_key key)
{
char buf[41];
char *filename;
if (cache->path_init_failed)
return NULL;
_mesa_sha1_format(buf, key);
if (asprintf(&filename, "%s/%c%c/%s", cache->path, buf[0],
buf[1], buf + 2) == -1)
return NULL;
return filename;
}
static bool
create_cache_item_header_and_blob(struct disk_cache_put_job *dc_job,
struct blob *cache_blob)
{
/* Compress the cache item data */
size_t max_buf = util_compress_max_compressed_len(dc_job->size);
void *compressed_data = malloc(max_buf);
if (compressed_data == NULL)
return false;
size_t compressed_size =
util_compress_deflate(dc_job->data, dc_job->size,
compressed_data, max_buf);
if (compressed_size == 0)
goto fail;
/* Copy the driver_keys_blob, this can be used find information about the
* mesa version that produced the entry or deal with hash collisions,
* should that ever become a real problem.
*/
if (!blob_write_bytes(cache_blob, dc_job->cache->driver_keys_blob,
dc_job->cache->driver_keys_blob_size))
goto fail;
/* Write the cache item metadata. This data can be used to deal with
* hash collisions, as well as providing useful information to 3rd party
* tools reading the cache files.
*/
if (!blob_write_uint32(cache_blob, dc_job->cache_item_metadata.type))
goto fail;
if (dc_job->cache_item_metadata.type == CACHE_ITEM_TYPE_GLSL) {
if (!blob_write_uint32(cache_blob, dc_job->cache_item_metadata.num_keys))
goto fail;
size_t metadata_keys_size =
dc_job->cache_item_metadata.num_keys * sizeof(cache_key);
if (!blob_write_bytes(cache_blob, dc_job->cache_item_metadata.keys[0],
metadata_keys_size))
goto fail;
}
/* Create CRC of the compressed data. We will read this when restoring the
* cache and use it to check for corruption.
*/
struct cache_entry_file_data cf_data;
cf_data.crc32 = util_hash_crc32(compressed_data, compressed_size);
cf_data.uncompressed_size = dc_job->size;
if (!blob_write_bytes(cache_blob, &cf_data, sizeof(cf_data)))
goto fail;
/* Finally copy the compressed cache blob */
if (!blob_write_bytes(cache_blob, compressed_data, compressed_size))
goto fail;
free(compressed_data);
return true;
fail:
free(compressed_data);
return false;
}
void
disk_cache_write_item_to_disk(struct disk_cache_put_job *dc_job,
char *filename)
{
int fd = -1, fd_final = -1;
struct blob cache_blob;
blob_init(&cache_blob);
/* Write to a temporary file to allow for an atomic rename to the
* final destination filename, (to prevent any readers from seeing
* a partially written file).
*/
char *filename_tmp = NULL;
if (asprintf(&filename_tmp, "%s.tmp", filename) == -1)
goto done;
fd = open(filename_tmp, O_WRONLY | O_CLOEXEC | O_CREAT, 0644);
/* Make the two-character subdirectory within the cache as needed. */
if (fd == -1) {
if (errno != ENOENT)
goto done;
make_cache_file_directory(dc_job->cache, dc_job->key);
fd = open(filename_tmp, O_WRONLY | O_CLOEXEC | O_CREAT, 0644);
if (fd == -1)
goto done;
}
/* With the temporary file open, we take an exclusive flock on
* it. If the flock fails, then another process still has the file
* open with the flock held. So just let that file be responsible
* for writing the file.
*/
#ifdef HAVE_FLOCK
int err = flock(fd, LOCK_EX | LOCK_NB);
#else
struct flock lock = {
.l_start = 0,
.l_len = 0, /* entire file */
.l_type = F_WRLCK,
.l_whence = SEEK_SET
};
int err = fcntl(fd, F_SETLK, &lock);
#endif
if (err == -1)
goto done;
/* Now that we have the lock on the open temporary file, we can
* check to see if the destination file already exists. If so,
* another process won the race between when we saw that the file
* didn't exist and now. In this case, we don't do anything more,
* (to ensure the size accounting of the cache doesn't get off).
*/
fd_final = open(filename, O_RDONLY | O_CLOEXEC);
if (fd_final != -1) {
unlink(filename_tmp);
goto done;
}
/* OK, we're now on the hook to write out a file that we know is
* not in the cache, and is also not being written out to the cache
* by some other process.
*/
if (!create_cache_item_header_and_blob(dc_job, &cache_blob)) {
unlink(filename_tmp);
goto done;
}
/* Now, finally, write out the contents to the temporary file, then
* rename them atomically to the destination filename, and also
* perform an atomic increment of the total cache size.
*/
int ret = write_all(fd, cache_blob.data, cache_blob.size);
if (ret == -1) {
unlink(filename_tmp);
goto done;
}
ret = rename(filename_tmp, filename);
if (ret == -1) {
unlink(filename_tmp);
goto done;
}
struct stat sb;
if (stat(filename, &sb) == -1) {
/* Something went wrong remove the file */
unlink(filename);
goto done;
}
p_atomic_add(dc_job->cache->size, sb.st_blocks * 512);
done:
if (fd_final != -1)
close(fd_final);
/* This close finally releases the flock, (now that the final file
* has been renamed into place and the size has been added).
*/
if (fd != -1)
close(fd);
free(filename_tmp);
blob_finish(&cache_blob);
}
/* Determine path for cache based on the first defined name as follows:
*
* $MESA_GLSL_CACHE_DIR
* $XDG_CACHE_HOME/mesa_shader_cache
* <pwd.pw_dir>/.cache/mesa_shader_cache
*/
char *
disk_cache_generate_cache_dir(void *mem_ctx, const char *gpu_name,
const char *driver_id)
{
char *cache_dir_name = CACHE_DIR_NAME;
if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false))
cache_dir_name = CACHE_DIR_NAME_SF;
char *path = getenv("MESA_GLSL_CACHE_DIR");
if (path) {
if (mkdir_if_needed(path) == -1)
return NULL;
path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name);
if (!path)
return NULL;
}
if (path == NULL) {
char *xdg_cache_home = getenv("XDG_CACHE_HOME");
if (xdg_cache_home) {
if (mkdir_if_needed(xdg_cache_home) == -1)
return NULL;
path = concatenate_and_mkdir(mem_ctx, xdg_cache_home, cache_dir_name);
if (!path)
return NULL;
}
}
if (!path) {
char *buf;
size_t buf_size;
struct passwd pwd, *result;
buf_size = sysconf(_SC_GETPW_R_SIZE_MAX);
if (buf_size == -1)
buf_size = 512;
/* Loop until buf_size is large enough to query the directory */
while (1) {
buf = ralloc_size(mem_ctx, buf_size);
getpwuid_r(getuid(), &pwd, buf, buf_size, &result);
if (result)
break;
if (errno == ERANGE) {
ralloc_free(buf);
buf = NULL;
buf_size *= 2;
} else {
return NULL;
}
}
path = concatenate_and_mkdir(mem_ctx, pwd.pw_dir, ".cache");
if (!path)
return NULL;
path = concatenate_and_mkdir(mem_ctx, path, cache_dir_name);
if (!path)
return NULL;
}
if (env_var_as_boolean("MESA_DISK_CACHE_SINGLE_FILE", false)) {
path = concatenate_and_mkdir(mem_ctx, path, driver_id);
if (!path)
return NULL;
path = concatenate_and_mkdir(mem_ctx, path, gpu_name);
if (!path)
return NULL;
}
return path;
}
bool
disk_cache_enabled()
{
/* If running as a users other than the real user disable cache */
if (geteuid() != getuid())
return false;
/* At user request, disable shader cache entirely. */
#ifdef SHADER_CACHE_DISABLE_BY_DEFAULT
bool disable_by_default = true;
#else
bool disable_by_default = false;
#endif
if (env_var_as_boolean("MESA_GLSL_CACHE_DISABLE", disable_by_default))
return false;
return true;
}
void *
disk_cache_load_item_foz(struct disk_cache *cache, const cache_key key,
size_t *size)
{
size_t cache_tem_size = 0;
void *cache_item = foz_read_entry(&cache->foz_db, key, &cache_tem_size);
if (!cache_item)
return NULL;
uint8_t *uncompressed_data =
parse_and_validate_cache_item(cache, cache_item, cache_tem_size, size);
free(cache_item);
return uncompressed_data;
}
bool
disk_cache_write_item_to_disk_foz(struct disk_cache_put_job *dc_job)
{
struct blob cache_blob;
blob_init(&cache_blob);
if (!create_cache_item_header_and_blob(dc_job, &cache_blob))
return false;
bool r = foz_write_entry(&dc_job->cache->foz_db, dc_job->key,
cache_blob.data, cache_blob.size);
blob_finish(&cache_blob);
return r;
}
bool
disk_cache_load_cache_index(void *mem_ctx, struct disk_cache *cache)
{
/* Load cache index into a hash map (from fossilise files) */
return foz_prepare(&cache->foz_db, cache->path);
}
bool
disk_cache_mmap_cache_index(void *mem_ctx, struct disk_cache *cache,
char *path)
{
int fd = -1;
bool mapped = false;
path = ralloc_asprintf(mem_ctx, "%s/index", cache->path);
if (path == NULL)
goto path_fail;
fd = open(path, O_RDWR | O_CREAT | O_CLOEXEC, 0644);
if (fd == -1)
goto path_fail;
struct stat sb;
if (fstat(fd, &sb) == -1)
goto path_fail;
/* Force the index file to be the expected size. */
size_t size = sizeof(*cache->size) + CACHE_INDEX_MAX_KEYS * CACHE_KEY_SIZE;
if (sb.st_size != size) {
if (ftruncate(fd, size) == -1)
goto path_fail;
}
/* We map this shared so that other processes see updates that we
* make.
*
* Note: We do use atomic addition to ensure that multiple
* processes don't scramble the cache size recorded in the
* index. But we don't use any locking to prevent multiple
* processes from updating the same entry simultaneously. The idea
* is that if either result lands entirely in the index, then
* that's equivalent to a well-ordered write followed by an
* eviction and a write. On the other hand, if the simultaneous
* writes result in a corrupt entry, that's not really any
* different than both entries being evicted, (since within the
* guarantees of the cryptographic hash, a corrupt entry is
* unlikely to ever match a real cache key).
*/
cache->index_mmap = mmap(NULL, size, PROT_READ | PROT_WRITE,
MAP_SHARED, fd, 0);
if (cache->index_mmap == MAP_FAILED)
goto path_fail;
cache->index_mmap_size = size;
cache->size = (uint64_t *) cache->index_mmap;
cache->stored_keys = cache->index_mmap + sizeof(uint64_t);
mapped = true;
path_fail:
if (fd != -1)
close(fd);
return mapped;
}
void
disk_cache_destroy_mmap(struct disk_cache *cache)
{
munmap(cache->index_mmap, cache->index_mmap_size);
}
#endif
#endif /* ENABLE_SHADER_CACHE */
| 27.838115 | 87 | 0.639198 |
eb225d294404cd2bea76b4245e312374b29d1cb1 | 17,217 | h | C | modules/graph/vertex_map/arrow_vertex_map.h | luoxiaojian/libvineyard | 7970639a5b0ad27829883146185f66e0645a59fc | [
"Apache-2.0"
] | null | null | null | modules/graph/vertex_map/arrow_vertex_map.h | luoxiaojian/libvineyard | 7970639a5b0ad27829883146185f66e0645a59fc | [
"Apache-2.0"
] | null | null | null | modules/graph/vertex_map/arrow_vertex_map.h | luoxiaojian/libvineyard | 7970639a5b0ad27829883146185f66e0645a59fc | [
"Apache-2.0"
] | null | null | null | /** Copyright 2020 Alibaba Group Holding Limited.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#ifndef MODULES_GRAPH_VERTEX_MAP_ARROW_VERTEX_MAP_H_
#define MODULES_GRAPH_VERTEX_MAP_ARROW_VERTEX_MAP_H_
#include <memory>
#include <string>
#include <vector>
#include "basic/ds/array.h"
#include "basic/ds/arrow.h"
#include "basic/ds/hashmap.h"
#include "client/client.h"
#include "common/util/typename.h"
#include "graph/fragment/property_graph_types.h"
#include "graph/fragment/property_graph_utils.h"
namespace gs {
template <typename OID_T, typename VID_T>
class ArrowProjectedVertexMap;
} // namespace gs
namespace vineyard {
template <typename OID_T, typename VID_T>
class ArrowVertexMapBuilder;
template <typename OID_T, typename VID_T>
class ArrowVertexMap
: public vineyard::Registered<ArrowVertexMap<OID_T, VID_T>> {
using oid_t = OID_T;
using vid_t = VID_T;
using label_id_t = property_graph_types::LABEL_ID_TYPE;
using oid_array_t = typename vineyard::ConvertToArrowType<oid_t>::ArrayType;
public:
ArrowVertexMap() {}
~ArrowVertexMap() {}
static std::shared_ptr<vineyard::Object> Create() __attribute__((used)) {
return std::static_pointer_cast<vineyard::Object>(
std::make_shared<ArrowVertexMap<OID_T, VID_T>>());
}
void Construct(const vineyard::ObjectMeta& meta) {
this->meta_ = meta;
this->id_ = meta.GetId();
this->fnum_ = meta.GetKeyValue<fid_t>("fnum");
this->label_num_ = meta.GetKeyValue<label_id_t>("label_num");
id_parser_.Init(fnum_, label_num_);
o2g_.resize(fnum_);
oid_arrays_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
o2g_[i].Construct(meta.GetMemberMeta("o2g_" + std::to_string(i)));
oid_arrays_[i].resize(label_num_);
for (label_id_t j = 0; j < label_num_; ++j) {
typename InternalType<oid_t>::vineyard_array_type array;
array.Construct(meta.GetMemberMeta("oid_arrays_" + std::to_string(i) +
"_" + std::to_string(j)));
oid_arrays_[i][j] = array.GetArray();
}
}
}
bool GetOid(vid_t gid, oid_t& oid) const {
fid_t fid = id_parser_.GetFid(gid);
label_id_t label = id_parser_.GetLabelId(gid);
int64_t offset = id_parser_.GetOffset(gid);
if (fid < fnum_ && label < label_num_ && label >= 0) {
auto array = oid_arrays_[fid][label];
if (offset < array->length()) {
oid = array->GetView(offset);
return true;
}
}
return false;
}
bool GetGid(fid_t fid, oid_t oid, vid_t& gid) const {
auto iter = o2g_[fid].find(oid);
if (iter != o2g_[fid].end()) {
gid = iter->second;
return true;
}
return false;
}
bool GetGid(oid_t oid, vid_t& gid) const {
for (fid_t i = 0; i < fnum_; ++i) {
if (GetGid(i, oid, gid)) {
return true;
}
}
return false;
}
std::vector<oid_t> GetOids(fid_t fid, label_id_t label_id) {
auto array = oid_arrays_[fid][label_id];
std::vector<oid_t> oids;
oids.resize(array->length());
for (auto i = 0; i < array->length(); i++) {
oids[i] = array->GetView(i);
}
return oids;
}
fid_t fnum() { return fnum_; }
size_t GetTotalNodesNum() const {
size_t num = 0;
for (auto m : o2g_) {
num += m.size();
}
return num;
}
size_t GetTotalNodesNum(label_id_t label) const {
size_t num = 0;
for (auto& vec : oid_arrays_) {
num += vec[label]->length();
}
return num;
}
label_id_t label_num() const { return label_num_; }
vid_t GetInnerVertexSize(fid_t fid) const {
return static_cast<vid_t>(o2g_[fid].size());
}
vid_t GetInnerVertexSize(fid_t fid, label_id_t label_id) const {
return static_cast<vid_t>(oid_arrays_[fid][label_id]->length());
}
private:
fid_t fnum_;
label_id_t label_num_;
vineyard::IdParser<vid_t> id_parser_;
// frag->label->oid
std::vector<std::vector<std::shared_ptr<oid_array_t>>> oid_arrays_;
std::vector<vineyard::Hashmap<oid_t, vid_t>> o2g_;
template <typename _OID_T, typename _VID_T>
friend class ArrowVertexMapBuilder;
template <typename _OID_T, typename _VID_T>
friend class gs::ArrowProjectedVertexMap;
};
template <typename VID_T>
class ArrowVertexMap<arrow::util::string_view, VID_T>
: public vineyard::Registered<
ArrowVertexMap<arrow::util::string_view, VID_T>> {
using oid_t = arrow::util::string_view;
using vid_t = VID_T;
using label_id_t = property_graph_types::LABEL_ID_TYPE;
using oid_array_t = arrow::StringArray;
public:
ArrowVertexMap() {}
~ArrowVertexMap() {}
static std::shared_ptr<vineyard::Object> Create() __attribute__((used)) {
return std::static_pointer_cast<vineyard::Object>(
std::make_shared<ArrowVertexMap<oid_t, vid_t>>());
}
void Construct(const vineyard::ObjectMeta& meta) {
this->meta_ = meta;
this->id_ = meta.GetId();
this->fnum_ = meta.GetKeyValue<fid_t>("fnum");
this->label_num_ = meta.GetKeyValue<label_id_t>("label_num");
id_parser_.Init(fnum_, label_num_);
oid_arrays_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
oid_arrays_[i].resize(label_num_);
for (label_id_t j = 0; j < label_num_; ++j) {
typename InternalType<oid_t>::vineyard_array_type array;
array.Construct(meta.GetMemberMeta("oid_arrays_" + std::to_string(i) +
"_" + std::to_string(j)));
oid_arrays_[i][j] = array.GetArray();
}
}
initHashmaps();
}
bool GetOid(vid_t gid, oid_t& oid) const {
fid_t fid = id_parser_.GetFid(gid);
label_id_t label = id_parser_.GetLabelId(gid);
int64_t offset = id_parser_.GetOffset(gid);
if (fid < fnum_ && label < label_num_ && label >= 0) {
auto array = oid_arrays_[fid][label];
if (offset < array->length()) {
oid = array->GetView(offset);
return true;
}
}
return false;
}
bool GetGid(fid_t fid, oid_t oid, vid_t& gid) const {
auto iter = o2g_[fid].find(oid);
if (iter != o2g_[fid].end()) {
gid = iter->second;
return true;
}
return false;
}
bool GetGid(oid_t oid, vid_t& gid) const {
for (fid_t i = 0; i < fnum_; ++i) {
if (GetGid(i, oid, gid)) {
return true;
}
}
return false;
}
std::vector<oid_t> GetOids(fid_t fid, label_id_t label_id) {
auto array = oid_arrays_[fid][label_id];
std::vector<oid_t> oids;
oids.resize(array->length());
for (auto i = 0; i < array->length(); i++) {
oids[i] = array->GetView(i);
}
return oids;
}
fid_t fnum() { return fnum_; }
size_t GetTotalNodesNum() const {
size_t num = 0;
for (auto m : o2g_) {
num += m.size();
}
return num;
}
size_t GetTotalNodesNum(label_id_t label) const {
size_t num = 0;
for (auto& vec : oid_arrays_) {
num += vec[label]->length();
}
return num;
}
label_id_t label_num() const { return label_num_; }
vid_t GetInnerVertexSize(fid_t fid) const {
return static_cast<vid_t>(o2g_[fid].size());
}
vid_t GetInnerVertexSize(fid_t fid, label_id_t label_id) const {
return static_cast<vid_t>(oid_arrays_[fid][label_id]->length());
}
private:
void initHashmaps() {
o2g_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
for (label_id_t j = 0; j < label_num_; ++j) {
auto array = oid_arrays_[i][j];
{
vid_t cur_gid = id_parser_.GenerateId(i, j, 0);
int64_t vnum = array->length();
for (int64_t k = 0; k < vnum; ++k) {
o2g_[i].emplace(array->GetView(k), cur_gid);
++cur_gid;
}
}
}
}
}
fid_t fnum_;
label_id_t label_num_;
vineyard::IdParser<vid_t> id_parser_;
// frag->label->oid
std::vector<std::vector<std::shared_ptr<oid_array_t>>> oid_arrays_;
std::vector<ska::flat_hash_map<oid_t, vid_t>> o2g_;
template <typename _OID_T, typename _VID_T>
friend class ArrowVertexMapBuilder;
template <typename _OID_T, typename _VID_T>
friend class gs::ArrowProjectedVertexMap;
};
template <typename OID_T, typename VID_T>
class ArrowVertexMapBuilder : public vineyard::ObjectBuilder {
using oid_t = OID_T;
using vid_t = VID_T;
using label_id_t = property_graph_types::LABEL_ID_TYPE;
public:
explicit ArrowVertexMapBuilder(vineyard::Client& client) {}
void set_fnum_label_num(fid_t fnum, label_id_t label_num) {
fnum_ = fnum;
label_num_ = label_num;
oid_arrays_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
oid_arrays_[i].resize(label_num_);
}
o2g_.resize(fnum_);
}
void set_oid_array(
fid_t fid, label_id_t label,
const typename InternalType<oid_t>::vineyard_array_type& array) {
oid_arrays_[fid][label] = array;
}
void set_o2g(fid_t fid, const vineyard::Hashmap<oid_t, vid_t>& rm) {
o2g_[fid] = rm;
}
std::shared_ptr<vineyard::Object> _Seal(vineyard::Client& client) {
// ensure the builder hasn't been sealed yet.
ENSURE_NOT_SEALED(this);
VINEYARD_CHECK_OK(this->Build(client));
auto vertex_map = std::make_shared<ArrowVertexMap<oid_t, vid_t>>();
vertex_map->fnum_ = fnum_;
vertex_map->label_num_ = label_num_;
vertex_map->id_parser_.Init(fnum_, label_num_);
vertex_map->oid_arrays_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
auto& array = vertex_map->oid_arrays_[i];
array.resize(label_num_);
for (label_id_t j = 0; j < label_num_; ++j) {
array[j] = oid_arrays_[i][j].GetArray();
}
}
vertex_map->o2g_ = o2g_;
vertex_map->meta_.SetTypeName(type_name<ArrowVertexMap<oid_t, vid_t>>());
vertex_map->meta_.AddKeyValue("fnum", fnum_);
vertex_map->meta_.AddKeyValue("label_num", label_num_);
size_t nbytes = 0;
for (fid_t i = 0; i < fnum_; ++i) {
vertex_map->meta_.AddMember("o2g_" + std::to_string(i), o2g_[i].meta());
nbytes += o2g_[i].nbytes();
for (label_id_t j = 0; j < label_num_; ++j) {
vertex_map->meta_.AddMember(
"oid_arrays_" + std::to_string(i) + "_" + std::to_string(j),
oid_arrays_[i][j].meta());
nbytes += oid_arrays_[i][j].nbytes();
}
}
vertex_map->meta_.SetNBytes(nbytes);
VINEYARD_CHECK_OK(
client.CreateMetaData(vertex_map->meta_, vertex_map->id_));
// mark the builder as sealed
this->set_sealed(true);
return std::static_pointer_cast<vineyard::Object>(vertex_map);
}
private:
fid_t fnum_;
label_id_t label_num_;
std::vector<std::vector<typename InternalType<oid_t>::vineyard_array_type>>
oid_arrays_;
std::vector<vineyard::Hashmap<oid_t, vid_t>> o2g_;
};
template <typename VID_T>
class ArrowVertexMapBuilder<arrow::util::string_view, VID_T>
: public vineyard::ObjectBuilder {
using oid_t = arrow::util::string_view;
using vid_t = VID_T;
using label_id_t = property_graph_types::LABEL_ID_TYPE;
public:
explicit ArrowVertexMapBuilder(vineyard::Client& client) {}
void set_fnum_label_num(fid_t fnum, label_id_t label_num) {
fnum_ = fnum;
label_num_ = label_num;
oid_arrays_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
oid_arrays_[i].resize(label_num_);
}
}
void set_oid_array(
fid_t fid, label_id_t label,
const typename InternalType<oid_t>::vineyard_array_type& array) {
oid_arrays_[fid][label] = array;
}
std::shared_ptr<vineyard::Object> _Seal(vineyard::Client& client) {
// ensure the builder hasn't been sealed yet.
ENSURE_NOT_SEALED(this);
VINEYARD_CHECK_OK(this->Build(client));
auto vertex_map =
std::make_shared<ArrowVertexMap<arrow::util::string_view, vid_t>>();
vertex_map->fnum_ = fnum_;
vertex_map->label_num_ = label_num_;
vertex_map->id_parser_.Init(fnum_, label_num_);
vertex_map->oid_arrays_.resize(fnum_);
for (fid_t i = 0; i < fnum_; ++i) {
auto& array = vertex_map->oid_arrays_[i];
array.resize(label_num_);
for (label_id_t j = 0; j < label_num_; ++j) {
array[j] = oid_arrays_[i][j].GetArray();
}
}
vertex_map->meta_.SetTypeName(type_name<ArrowVertexMap<oid_t, vid_t>>());
vertex_map->meta_.AddKeyValue("fnum", fnum_);
vertex_map->meta_.AddKeyValue("label_num", label_num_);
size_t nbytes = 0;
for (fid_t i = 0; i < fnum_; ++i) {
for (label_id_t j = 0; j < label_num_; ++j) {
vertex_map->meta_.AddMember(
"oid_arrays_" + std::to_string(i) + "_" + std::to_string(j),
oid_arrays_[i][j].meta());
nbytes += oid_arrays_[i][j].nbytes();
}
}
vertex_map->meta_.SetNBytes(nbytes);
VINEYARD_CHECK_OK(
client.CreateMetaData(vertex_map->meta_, vertex_map->id_));
// mark the builder as sealed
this->set_sealed(true);
return std::static_pointer_cast<vineyard::Object>(vertex_map);
}
private:
fid_t fnum_;
label_id_t label_num_;
std::vector<std::vector<typename InternalType<oid_t>::vineyard_array_type>>
oid_arrays_;
};
template <typename OID_T, typename VID_T>
class BasicArrowVertexMapBuilder : public ArrowVertexMapBuilder<OID_T, VID_T> {
using oid_t = OID_T;
using vid_t = VID_T;
using oid_array_t = typename vineyard::ConvertToArrowType<oid_t>::ArrayType;
using label_id_t = property_graph_types::LABEL_ID_TYPE;
public:
BasicArrowVertexMapBuilder(
vineyard::Client& client, fid_t fnum, label_id_t label_num,
const std::vector<std::vector<std::shared_ptr<oid_array_t>>>& oid_arrays)
: ArrowVertexMapBuilder<oid_t, vid_t>(client),
fnum_(fnum),
label_num_(label_num),
oid_arrays_(oid_arrays) {
CHECK_EQ(oid_arrays.size(), label_num);
id_parser_.Init(fnum_, label_num_);
}
vineyard::Status Build(vineyard::Client& client) override {
this->set_fnum_label_num(fnum_, label_num_);
for (fid_t i = 0; i < fnum_; ++i) {
// TODO(luoxiaojian): parallel construct hashmap
vineyard::HashmapBuilder<oid_t, vid_t> builder(client);
for (label_id_t j = 0; j < label_num_; ++j) {
auto array = oid_arrays_[j][i];
{
vid_t cur_gid = id_parser_.GenerateId(i, j, 0);
int64_t vnum = array->length();
for (int64_t k = 0; k < vnum; ++k) {
builder.emplace(array->GetView(k), cur_gid);
++cur_gid;
}
}
typename InternalType<oid_t>::vineyard_builder_type array_builder(
client, array);
this->set_oid_array(
i, j,
*std::dynamic_pointer_cast<vineyard::NumericArray<oid_t>>(
array_builder.Seal(client)));
}
this->set_o2g(i,
*std::dynamic_pointer_cast<vineyard::Hashmap<oid_t, vid_t>>(
builder.Seal(client)));
}
return vineyard::Status::OK();
}
private:
fid_t fnum_;
label_id_t label_num_;
vineyard::IdParser<vid_t> id_parser_;
std::vector<std::vector<std::shared_ptr<oid_array_t>>> oid_arrays_;
};
template <typename VID_T>
class BasicArrowVertexMapBuilder<arrow::util::string_view, VID_T>
: public ArrowVertexMapBuilder<arrow::util::string_view, VID_T> {
using oid_t = arrow::util::string_view;
using vid_t = VID_T;
using oid_array_t = arrow::StringArray;
using label_id_t = property_graph_types::LABEL_ID_TYPE;
public:
BasicArrowVertexMapBuilder(
vineyard::Client& client, fid_t fnum, label_id_t label_num,
const std::vector<std::vector<std::shared_ptr<oid_array_t>>>& oid_arrays)
: ArrowVertexMapBuilder<arrow::util::string_view, vid_t>(client),
fnum_(fnum),
label_num_(label_num),
oid_arrays_(oid_arrays) {
CHECK_EQ(oid_arrays.size(), label_num);
id_parser_.Init(fnum_, label_num_);
}
vineyard::Status Build(vineyard::Client& client) override {
this->set_fnum_label_num(fnum_, label_num_);
for (fid_t i = 0; i < fnum_; ++i) {
// TODO(luoxiaojian): parallel construct hashmap
for (label_id_t j = 0; j < label_num_; ++j) {
auto array = oid_arrays_[j][i];
typename InternalType<oid_t>::vineyard_builder_type array_builder(
client, array);
this->set_oid_array(
i, j,
*std::dynamic_pointer_cast<
typename InternalType<oid_t>::vineyard_array_type>(
array_builder.Seal(client)));
}
}
return vineyard::Status::OK();
}
private:
fid_t fnum_;
label_id_t label_num_;
vineyard::IdParser<vid_t> id_parser_;
std::vector<std::vector<std::shared_ptr<oid_array_t>>> oid_arrays_;
};
} // namespace vineyard
#endif // MODULES_GRAPH_VERTEX_MAP_ARROW_VERTEX_MAP_H_
| 28.887584 | 80 | 0.650636 |
3a1cedfa145afdaa76c4543ba3ab038b630b20a1 | 2,322 | h | C | include/qx/xpu/aligned_memory_allocator.h | QuTech-Delft/qx-simulator | e3a888f4a79fde2313060cb92756488d20b08b66 | [
"Apache-2.0"
] | 3 | 2020-05-06T03:33:20.000Z | 2021-03-22T11:21:07.000Z | include/qx/xpu/aligned_memory_allocator.h | QuTech-Delft/qx-simulator | e3a888f4a79fde2313060cb92756488d20b08b66 | [
"Apache-2.0"
] | 5 | 2021-03-16T12:20:34.000Z | 2021-11-23T10:31:16.000Z | include/qx/xpu/aligned_memory_allocator.h | QuTech-Delft/qx-simulator | e3a888f4a79fde2313060cb92756488d20b08b66 | [
"Apache-2.0"
] | 9 | 2020-01-10T12:15:50.000Z | 2021-07-02T12:14:07.000Z | #ifndef XPU_ALIGNED_MEMORY_ALLOCATOR_H
#define XPU_ALIGNED_MEMORY_ALLOCATOR_H
#include <cstdlib>
#include <string>
#if defined (__unix__) || (defined (__APPLE__) && defined (__MACH__))
#include <mm_malloc.h>
#define QX_ALIGNED_MEMORY_MALLOC _mm_malloc
#define QX_ALIGNED_MEMORY_FREE _mm_free
#else
#define QX_ALIGNED_MEMORY_MALLOC _aligned_malloc
#define QX_ALIGNED_MEMORY_FREE _aligned_free
#endif
#include <new>
namespace xpu
{
template <typename T, std::size_t N = 16>
class aligned_memory_allocator {
public:
typedef T value_type;
typedef std::size_t size_type;
typedef std::ptrdiff_t difference_type;
typedef T * pointer;
typedef const T * const_pointer;
typedef T & reference;
typedef const T & const_reference;
public:
inline aligned_memory_allocator () throw () { }
template <typename T2>
inline aligned_memory_allocator (const aligned_memory_allocator<T2, N> &) throw () { }
inline ~aligned_memory_allocator () throw () { }
inline pointer address (reference r) {
return &r;
}
inline const_pointer address (const_reference r) const {
return &r;
}
inline pointer allocate (size_type n) {
pointer rv = (pointer)QX_ALIGNED_MEMORY_MALLOC(n*sizeof(value_type), N);
if(NULL==rv) {
throw std::bad_alloc();
}
return rv;
}
inline void deallocate (pointer p, size_type) {
QX_ALIGNED_MEMORY_FREE(p);
}
inline void construct (pointer p, const value_type & wert) {
new (p) value_type (wert);
}
inline void destroy (pointer p) {
p->~value_type ();
}
inline size_type max_size () const throw () {
return size_type (-1) / sizeof (value_type);
}
template <typename T2>
struct rebind {
typedef aligned_memory_allocator<T2, N> other;
};
bool operator!=(const aligned_memory_allocator<T,N>& other) const {
return !(*this == other);
}
// Returns true if and only if storage allocated from *this
// can be deallocated from other, and vice versa.
// Always returns true for stateless allocators.
bool operator==(const aligned_memory_allocator<T,N>& other) const {
return true;
}
};
} // xpu
#endif
| 24.702128 | 94 | 0.651593 |
3a669b42a1fc99711dc7fb23a19a30971d39c689 | 1,702 | h | C | QuickGUI/include/QuickGUICharacter.h | VisualEntertainmentAndTechnologies/VENT-QuickGUI | 7c687193001bcf914bd4a9947644915091ea8723 | [
"Unlicense"
] | 3 | 2017-01-12T19:22:01.000Z | 2017-05-06T09:55:39.000Z | QuickGUI/include/QuickGUICharacter.h | VisualEntertainmentAndTechnologies/VENT-QuickGUI | 7c687193001bcf914bd4a9947644915091ea8723 | [
"Unlicense"
] | null | null | null | QuickGUI/include/QuickGUICharacter.h | VisualEntertainmentAndTechnologies/VENT-QuickGUI | 7c687193001bcf914bd4a9947644915091ea8723 | [
"Unlicense"
] | null | null | null | #ifndef QUICKGUICHARACTER_H
#define QUICKGUICHARACTER_H
#include "QuickGUIExportDLL.h"
#include "QuickGUIRect.h"
#include "QuickGUIUVRect.h"
#include "QuickGUIOgreEquivalents.h"
#include "OgreColourValue.h"
#include "OgreFont.h"
#include "OgreUTFString.h"
namespace QuickGUI
{
class _QuickGUIExport Character
{
public:
Character(Ogre::UTFString::code_point cp, Ogre::FontPtr fp, ColourValue cv);
/**
* Returns true if this character is highlighted, false otherwise.
*/
bool getHighlighted();
/**
* Returns the color of the text background when highlighted.
*/
ColourValue getHighlightColor();
/**
* Returns the color of the text when highlighted.
*/
ColourValue getHighlightedTextColor();
/**
* Returns true if this character is a tab, newline, carriage return, space, or other whitespace.
*/
bool isWhiteSpace();
/**
* Updates fontPtr member variable and recalculates uv coords and dimensions.
*/
void setFont(Ogre::FontPtr fp);
/**
* Sets whether this character is highlighted or not.
*/
void setHighlighted(bool highlighted);
/// Code point of the glyph
Ogre::UTFString::code_point codePoint;
/// Color of the character when drawn.
ColourValue colorValue;
/// Position is relative to the parent TextLine
Rect dimensions;
/// Font of the glyph being drawn.
Ogre::FontPtr fontPtr;
/// member allowing fast access to font texture name
Ogre::TexturePtr texturePtr;
/// UV coords of glyph, retreived from Font texture generated by Ogre::Font class.
UVRect uvCoords;
protected:
Character();
bool mHighlighted;
bool mWhiteSpace;
};
}
#endif
| 24.666667 | 99 | 0.695652 |
5f9d2fedd64ea6ec6bc1525eb014b5c179781e4a | 228 | h | C | source/include/stropts.h | streaksu/slibc | c339129df82695329858a329d9737dd4ed7b4767 | [
"BSL-1.0"
] | 11 | 2020-11-10T00:57:15.000Z | 2021-12-30T20:54:34.000Z | source/include/stropts.h | kushagra765/slibc | c339129df82695329858a329d9737dd4ed7b4767 | [
"BSL-1.0"
] | null | null | null | source/include/stropts.h | kushagra765/slibc | c339129df82695329858a329d9737dd4ed7b4767 | [
"BSL-1.0"
] | 2 | 2021-02-09T19:23:37.000Z | 2021-06-19T15:26:46.000Z | #ifndef __STROPTS_H__
#define __STROPTS_H__
#include <sys/ioctlval.h> // Kernel-specific ioctl values.
#ifdef __cplusplus
extern "C" {
#endif
int ioctl(int fd, int request, ...); // Port.
#ifdef __cplusplus
}
#endif
#endif
| 13.411765 | 58 | 0.714912 |
5c7619a83f84a7f514193cde4a557199a4c8ce00 | 67,478 | c | C | os/arch/arm/src/imxrt/imxrt_semc_sdram.c | ziyik/TizenRT-1 | d510c03303fcfa605bc12c60f826fa5642bbe406 | [
"Apache-2.0"
] | 511 | 2017-03-29T09:14:09.000Z | 2022-03-30T23:10:29.000Z | os/arch/arm/src/imxrt/imxrt_semc_sdram.c | ziyik/TizenRT-1 | d510c03303fcfa605bc12c60f826fa5642bbe406 | [
"Apache-2.0"
] | 4,673 | 2017-03-29T10:43:43.000Z | 2022-03-31T08:33:44.000Z | os/arch/arm/src/imxrt/imxrt_semc_sdram.c | ziyik/TizenRT-1 | d510c03303fcfa605bc12c60f826fa5642bbe406 | [
"Apache-2.0"
] | 642 | 2017-03-30T20:45:33.000Z | 2022-03-24T17:07:33.000Z | /****************************************************************************
*
* Copyright 2019 NXP Semiconductors All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/
/************************************************************************************
* os/arch/arm/src/imxrt/imxrt_semc_sdram.c
*
* Copyright (C) 2011 Uros Platise. All rights reserved.
* Author: Uros Platise <uros.platise@isotel.eu>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
************************************************************************************/
/* Provides standard flash access functions, to be used by the flash mtd driver.
* The interface is defined in the include/tinyara/progmem.h
*
* Requirements during write/erase operations on FLASH:
* - HSI must be ON.
* - Low Power Modes are not permitted during write/erase
*/
/************************************************************************************
* Included Files
************************************************************************************/
#include <tinyara/config.h>
#include <tinyara/arch.h>
#include <stdio.h>
#include <errno.h>
#include "imxrt_flexspi.h"
#include "imxrt_flash.h"
#include "imxrt_log.h"
#include "up_arch.h"
#include <tinyara/fs/mtd.h>
#include <tinyara/fs/ioctl.h>
#include <tinyara/spi/spi.h>
#include "imxrt_clock.h"
#include "imxrt_iomuxc.h"
#include "chip/imxrt_memorymap.h"
#include "imxrt_semc.h"
#include "imxrt_log.h"
/************************************************************************************
* Pre-processor Definitions
************************************************************************************/
/************************************************************************************
* Private Data
************************************************************************************/
/*******************************************************************************
* Code
******************************************************************************/
/************************************************************************************
* Private Functions
************************************************************************************/
/************************************************************************************
* Name: imxrt_semc_sdram_pins_init
*
* Description:
* Initialize pin setting in sdram
*
************************************************************************************/
static inline void imxrt_semc_sdram_pins_init(void)
{
imxrt_clock_enableclock(kCLOCK_Iomuxc); /* iomuxc clock (iomuxc_clk_enable): 0x03u */
#if defined(CONFIG_ARCH_CHIP_FAMILY_IMXRT102x)
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_00_SEMC_DATA00, /* GPIO_EMC_00 is configured as SEMC_DATA00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_01_SEMC_DATA01, /* GPIO_EMC_01 is configured as SEMC_DATA01 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_02_SEMC_DATA02, /* GPIO_EMC_02 is configured as SEMC_DATA02 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_03_SEMC_DATA03, /* GPIO_EMC_03 is configured as SEMC_DATA03 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_04_SEMC_DATA04, /* GPIO_EMC_04 is configured as SEMC_DATA04 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_05_SEMC_DATA05, /* GPIO_EMC_05 is configured as SEMC_DATA05 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_06_SEMC_DATA06, /* GPIO_EMC_06 is configured as SEMC_DATA06 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_07_SEMC_DATA07, /* GPIO_EMC_07 is configured as SEMC_DATA07 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_08_SEMC_DM00, /* GPIO_EMC_08 is configured as SEMC_DM00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_09_SEMC_WE, /* GPIO_EMC_09 is configured as SEMC_WE */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_10_SEMC_CAS, /* GPIO_EMC_10 is configured as SEMC_CAS */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_11_SEMC_RAS, /* GPIO_EMC_11 is configured as SEMC_RAS */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_12_SEMC_CS0, /* GPIO_EMC_12 is configured as SEMC_CS0 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_13_SEMC_BA0, /* GPIO_EMC_13 is configured as SEMC_BA0 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_14_SEMC_BA1, /* GPIO_EMC_14 is configured as SEMC_BA1 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_15_SEMC_ADDR10, /* GPIO_EMC_15 is configured as SEMC_ADDR10 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_16_SEMC_ADDR00, /* GPIO_EMC_16 is configured as SEMC_ADDR00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_17_SEMC_ADDR01, /* GPIO_EMC_17 is configured as SEMC_ADDR01 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_18_SEMC_ADDR02, /* GPIO_EMC_18 is configured as SEMC_ADDR02 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_19_SEMC_ADDR03, /* GPIO_EMC_19 is configured as SEMC_ADDR03 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_20_SEMC_ADDR04, /* GPIO_EMC_20 is configured as SEMC_ADDR04 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_21_SEMC_ADDR05, /* GPIO_EMC_21 is configured as SEMC_ADDR05 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_22_SEMC_ADDR06, /* GPIO_EMC_22 is configured as SEMC_ADDR06 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_23_SEMC_ADDR07, /* GPIO_EMC_23 is configured as SEMC_ADDR07 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_24_SEMC_ADDR08, /* GPIO_EMC_24 is configured as SEMC_ADDR08 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_25_SEMC_ADDR09, /* GPIO_EMC_25 is configured as SEMC_ADDR09 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_26_SEMC_ADDR11, /* GPIO_EMC_26 is configured as SEMC_ADDR11 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_27_SEMC_ADDR12, /* GPIO_EMC_27 is configured as SEMC_ADDR12 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_28_SEMC_DQS, /* GPIO_EMC_28 is configured as SEMC_DQS */
1U); /* Software Input On Field: Force input path of pad GPIO_EMC_28 */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_29_SEMC_CKE, /* GPIO_EMC_29 is configured as SEMC_CKE */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_30_SEMC_CLK, /* GPIO_EMC_30 is configured as SEMC_CLK */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_31_SEMC_DM01, /* GPIO_EMC_31 is configured as SEMC_DM01 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_32_SEMC_DATA08, /* GPIO_EMC_32 is configured as SEMC_DATA08 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_33_SEMC_DATA09, /* GPIO_EMC_33 is configured as SEMC_DATA09 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_34_SEMC_DATA10, /* GPIO_EMC_34 is configured as SEMC_DATA10 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_35_SEMC_DATA11, /* GPIO_EMC_35 is configured as SEMC_DATA11 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_36_SEMC_DATA12, /* GPIO_EMC_36 is configured as SEMC_DATA12 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_37_SEMC_DATA13, /* GPIO_EMC_37 is configured as SEMC_DATA13 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_38_SEMC_DATA14, /* GPIO_EMC_38 is configured as SEMC_DATA14 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_39_SEMC_DATA15, /* GPIO_EMC_39 is configured as SEMC_DATA15 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_40_SEMC_CSX00, /* GPIO_EMC_40 is configured as SEMC_CSX00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_41_SEMC_READY, /* GPIO_EMC_41 is configured as SEMC_READY */
0U);
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_00_SEMC_DATA00, /* GPIO_EMC_00 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_01_SEMC_DATA01, /* GPIO_EMC_01 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_02_SEMC_DATA02, /* GPIO_EMC_02 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_03_SEMC_DATA03, /* GPIO_EMC_03 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_04_SEMC_DATA04, /* GPIO_EMC_04 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_05_SEMC_DATA05, /* GPIO_EMC_05 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_06_SEMC_DATA06, /* GPIO_EMC_06 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_07_SEMC_DATA07, /* GPIO_EMC_07 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_08_SEMC_DM00, /* GPIO_EMC_08 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_09_SEMC_WE, /* GPIO_EMC_09 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_10_SEMC_CAS, /* GPIO_EMC_10 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_11_SEMC_RAS, /* GPIO_EMC_11 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_12_SEMC_CS0, /* GPIO_EMC_12 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_13_SEMC_BA0, /* GPIO_EMC_13 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_14_SEMC_BA1, /* GPIO_EMC_14 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_15_SEMC_ADDR10, /* GPIO_EMC_15 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_16_SEMC_ADDR00, /* GPIO_EMC_16 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_17_SEMC_ADDR01, /* GPIO_EMC_17 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_18_SEMC_ADDR02, /* GPIO_EMC_18 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_19_SEMC_ADDR03, /* GPIO_EMC_19 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_20_SEMC_ADDR04, /* GPIO_EMC_20 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_21_SEMC_ADDR05, /* GPIO_EMC_21 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_22_SEMC_ADDR06, /* GPIO_EMC_22 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_23_SEMC_ADDR07, /* GPIO_EMC_23 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_24_SEMC_ADDR08, /* GPIO_EMC_24 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_25_SEMC_ADDR09, /* GPIO_EMC_25 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_26_SEMC_ADDR11, /* GPIO_EMC_26 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_27_SEMC_ADDR12, /* GPIO_EMC_27 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_28_SEMC_DQS, /* GPIO_EMC_28 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_29_SEMC_CKE, /* GPIO_EMC_29 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_30_SEMC_CLK, /* GPIO_EMC_30 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_31_SEMC_DM01, /* GPIO_EMC_31 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_32_SEMC_DATA08, /* GPIO_EMC_32 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_33_SEMC_DATA09, /* GPIO_EMC_33 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_34_SEMC_DATA10, /* GPIO_EMC_34 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_35_SEMC_DATA11, /* GPIO_EMC_35 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_36_SEMC_DATA12, /* GPIO_EMC_36 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_37_SEMC_DATA13, /* GPIO_EMC_37 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_38_SEMC_DATA14, /* GPIO_EMC_38 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_39_SEMC_DATA15, /* GPIO_EMC_39 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_40_SEMC_CSX00, /* GPIO_EMC_40 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_41_SEMC_READY, /* GPIO_EMC_41 PAD functional properties : */
0xE1u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/4
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Disabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Disabled *//* Software Input On Field: Input Path is determined by functionality */
#elif defined(CONFIG_ARCH_CHIP_FAMILY_IMXRT105x)
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_00_SEMC_DATA00, /* GPIO_EMC_00 is configured as SEMC_DATA00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_01_SEMC_DATA01, /* GPIO_EMC_01 is configured as SEMC_DATA01 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_02_SEMC_DATA02, /* GPIO_EMC_02 is configured as SEMC_DATA02 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_03_SEMC_DATA03, /* GPIO_EMC_03 is configured as SEMC_DATA03 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_04_SEMC_DATA04, /* GPIO_EMC_04 is configured as SEMC_DATA04 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_05_SEMC_DATA05, /* GPIO_EMC_05 is configured as SEMC_DATA05 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_06_SEMC_DATA06, /* GPIO_EMC_06 is configured as SEMC_DATA06 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_07_SEMC_DATA07, /* GPIO_EMC_07 is configured as SEMC_DATA07 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_08_SEMC_DM00, /* GPIO_EMC_08 is configured as SEMC_DM00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_09_SEMC_ADDR00, /* GPIO_EMC_09 is configured as SEMC_ADDR00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_10_SEMC_ADDR01, /* GPIO_EMC_10 is configured as SEMC_ADDR01 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_11_SEMC_ADDR02, /* GPIO_EMC_11 is configured as SEMC_ADDR02 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_12_SEMC_ADDR03, /* GPIO_EMC_12 is configured as SEMC_ADDR03 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_13_SEMC_ADDR04, /* GPIO_EMC_13 is configured as SEMC_ADDR04 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_14_SEMC_ADDR05, /* GPIO_EMC_14 is configured as SEMC_ADDR05 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_15_SEMC_ADDR06, /* GPIO_EMC_15 is configured as SEMC_ADDR06 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_16_SEMC_ADDR07, /* GPIO_EMC_16 is configured as SEMC_ADDR07 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_17_SEMC_ADDR08, /* GPIO_EMC_17 is configured as SEMC_ADDR08 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_18_SEMC_ADDR09, /* GPIO_EMC_18 is configured as SEMC_ADDR09 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_19_SEMC_ADDR11, /* GPIO_EMC_19 is configured as SEMC_ADDR11 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_20_SEMC_ADDR12, /* GPIO_EMC_20 is configured as SEMC_ADDR12 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_21_SEMC_BA0, /* GPIO_EMC_21 is configured as SEMC_BA0 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_22_SEMC_BA1, /* GPIO_EMC_22 is configured as SEMC_BA1 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_23_SEMC_ADDR10, /* GPIO_EMC_23 is configured as SEMC_ADDR10 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_24_SEMC_CAS, /* GPIO_EMC_24 is configured as SEMC_CAS */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_25_SEMC_RAS, /* GPIO_EMC_25 is configured as SEMC_RAS */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_26_SEMC_CLK, /* GPIO_EMC_26 is configured as SEMC_CLK */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_27_SEMC_CKE, /* GPIO_EMC_27 is configured as SEMC_CKE */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_28_SEMC_WE, /* GPIO_EMC_28 is configured as SEMC_WE */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_29_SEMC_CS0, /* GPIO_EMC_29 is configured as SEMC_CS0 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_30_SEMC_DATA08, /* GPIO_EMC_30 is configured as SEMC_DATA08 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_31_SEMC_DATA09, /* GPIO_EMC_31 is configured as SEMC_DATA09 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_32_SEMC_DATA10, /* GPIO_EMC_32 is configured as SEMC_DATA10 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_33_SEMC_DATA11, /* GPIO_EMC_33 is configured as SEMC_DATA11 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_34_SEMC_DATA12, /* GPIO_EMC_34 is configured as SEMC_DATA12 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_35_SEMC_DATA13, /* GPIO_EMC_35 is configured as SEMC_DATA13 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_36_SEMC_DATA14, /* GPIO_EMC_36 is configured as SEMC_DATA14 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_37_SEMC_DATA15, /* GPIO_EMC_37 is configured as SEMC_DATA15 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_38_SEMC_DM01, /* GPIO_EMC_38 is configured as SEMC_DM01 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_39_SEMC_DQS, /* GPIO_EMC_39 is configured as SEMC_DQS */
1U); /* Software Input On Field: Force input path of pad GPIO_EMC_39 */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_40_SEMC_RDY, /* GPIO_EMC_40 is configured as SEMC_RDY */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinmux(IOMUXC_GPIO_EMC_41_SEMC_CSX00, /* GPIO_EMC_41 is configured as SEMC_CSX00 */
0U); /* Software Input On Field: Input Path is determined by functionality */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_00_SEMC_DATA00, /* GPIO_EMC_00 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_01_SEMC_DATA01, /* GPIO_EMC_01 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_02_SEMC_DATA02, /* GPIO_EMC_02 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_03_SEMC_DATA03, /* GPIO_EMC_03 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_04_SEMC_DATA04, /* GPIO_EMC_04 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_05_SEMC_DATA05, /* GPIO_EMC_05 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_06_SEMC_DATA06, /* GPIO_EMC_06 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_07_SEMC_DATA07, /* GPIO_EMC_07 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_08_SEMC_DM00, /* GPIO_EMC_08 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_09_SEMC_ADDR00, /* GPIO_EMC_09 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_10_SEMC_ADDR01, /* GPIO_EMC_10 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_11_SEMC_ADDR02, /* GPIO_EMC_11 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_12_SEMC_ADDR03, /* GPIO_EMC_12 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_13_SEMC_ADDR04, /* GPIO_EMC_13 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_14_SEMC_ADDR05, /* GPIO_EMC_14 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_15_SEMC_ADDR06, /* GPIO_EMC_15 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_16_SEMC_ADDR07, /* GPIO_EMC_16 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_17_SEMC_ADDR08, /* GPIO_EMC_17 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_18_SEMC_ADDR09, /* GPIO_EMC_18 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_19_SEMC_ADDR11, /* GPIO_EMC_19 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_20_SEMC_ADDR12, /* GPIO_EMC_20 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_21_SEMC_BA0, /* GPIO_EMC_21 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_22_SEMC_BA1, /* GPIO_EMC_22 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_23_SEMC_ADDR10, /* GPIO_EMC_23 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_24_SEMC_CAS, /* GPIO_EMC_24 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_25_SEMC_RAS, /* GPIO_EMC_25 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_26_SEMC_CLK, /* GPIO_EMC_26 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_27_SEMC_CKE, /* GPIO_EMC_27 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_28_SEMC_WE, /* GPIO_EMC_28 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_29_SEMC_CS0, /* GPIO_EMC_29 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_30_SEMC_DATA08, /* GPIO_EMC_30 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_31_SEMC_DATA09, /* GPIO_EMC_31 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_32_SEMC_DATA10, /* GPIO_EMC_32 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_33_SEMC_DATA11, /* GPIO_EMC_33 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_34_SEMC_DATA12, /* GPIO_EMC_34 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_35_SEMC_DATA13, /* GPIO_EMC_35 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_36_SEMC_DATA14, /* GPIO_EMC_36 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_37_SEMC_DATA15, /* GPIO_EMC_37 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_38_SEMC_DM01, /* GPIO_EMC_38 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_39_SEMC_DQS, /* GPIO_EMC_39 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_40_SEMC_RDY, /* GPIO_EMC_40 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
imxrt_iomuxc_setpinconfig(IOMUXC_GPIO_EMC_41_SEMC_CSX00, /* GPIO_EMC_41 PAD functional properties : */
0x0110F9u); /* Slew Rate Field: Fast Slew Rate
Drive Strength Field: R0/7
Speed Field: max(200MHz)
Open Drain Enable Field: Open Drain Disabled
Pull / Keep Enable Field: Pull/Keeper Enabled
Pull / Keep Select Field: Keeper
Pull Up / Down Config. Field: 100K Ohm Pull Down
Hyst. Enable Field: Hysteresis Enabled */
#endif
}
/************************************************************************************
* Name: imxrt_semc_sdram_clock_init
*
* Description:
* Initialize clock setting in semc for sdram
*
************************************************************************************/
static inline void imxrt_semc_sdram_clock_init(void)
{
imxrt_clock_initsyspfd(kCLOCK_Pfd2, 29);
/* Set semc clock to 163.86 MHz */
imxrt_clock_setmux(kCLOCK_SemcMux, 1);
imxrt_clock_setdiv(kCLOCK_SemcDiv, 1);
}
/************************************************************************************
* Public Functions
************************************************************************************/
/****************************************************************************
* Public Types
****************************************************************************/
/************************************************************************************
* Name: imxrt_semc_sdram_init
*
* Description:
* Initialize sdram
*
************************************************************************************/
void imxrt_semc_sdram_init(void)
{
semc_config_t config;
semc_sdram_config_t sdramconfig;
uint32_t clockFrq;
char tempLog[128];
imxrt_semc_sdram_pins_init();
imxrt_semc_sdram_clock_init();
imxrt_clock_enableclock(kCLOCK_Semc);
clockFrq = imxrt_clock_getfreq(kCLOCK_SemcClk);
snprintf(tempLog, sizeof(tempLog), "first clockFrq => %d", clockFrq);
IMXLOG(tempLog);
/* Initializes the MAC configure structure to zero. */
memset(&config, 0, sizeof(semc_config_t));
memset(&sdramconfig, 0, sizeof(semc_sdram_config_t));
/* Initialize SEMC. */
imxrt_semc_getdefaultconfig(&config);
config.dqsMode = kSEMC_Loopbackdqspad; /* For more accurate timing. */
imxrt_semc_init(SEMC, &config);
clockFrq = imxrt_clock_getfreq(kCLOCK_SemcClk);
snprintf(tempLog, sizeof(tempLog), "second clockFrq => %d", clockFrq);
IMXLOG(tempLog);
/* Configure SDRAM. */
sdramconfig.csxPinMux = kSEMC_MUXCSX0;
sdramconfig.address = 0x80000000;
sdramconfig.memsize_kbytes = 32 * 1024; /* 32MB = 32*1024*1KBytes */
sdramconfig.portSize = kSEMC_PortSize16Bit;
sdramconfig.burstLen = kSEMC_Sdram_BurstLen8;
sdramconfig.columnAddrBitNum = kSEMC_SdramColunm_9bit;
sdramconfig.casLatency = kSEMC_LatencyThree;
sdramconfig.tPrecharge2Act_Ns = 18; /* Trp 18ns */
sdramconfig.tAct2ReadWrite_Ns = 18; /* Trcd 18ns */
sdramconfig.tRefreshRecovery_Ns = 67; /* Use the maximum of the (Trfc , Txsr). */
sdramconfig.tWriteRecovery_Ns = 12; /* 12ns */
sdramconfig.tCkeOff_Ns = 42; /* The minimum cycle of SDRAM CLK off state. CKE is off in self refresh at a minimum period tRAS. */
sdramconfig.tAct2Prechage_Ns = 42; /* Tras 42ns */
sdramconfig.tSelfRefRecovery_Ns = 67;
sdramconfig.tRefresh2Refresh_Ns = 60;
sdramconfig.tAct2Act_Ns = 60;
sdramconfig.tPrescalePeriod_Ns = 160 * (1000000000 / clockFrq);
sdramconfig.refreshPeriod_nsPerRow = 64 * 1000000 / 8192; /* 64ms/8192 */
sdramconfig.refreshUrgThreshold = sdramconfig.refreshPeriod_nsPerRow;
sdramconfig.refreshBurstLen = 1;
imxrt_semc_configuresdram(SEMC, kSEMC_SDRAM_CS0, &sdramconfig, clockFrq);
}
| 60.14082 | 130 | 0.653294 |
1d462def498a315622723855386baa02f68ace00 | 4,573 | h | C | Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 13 | 2015-11-30T15:49:45.000Z | 2022-02-08T16:11:30.000Z | Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 640 | 2015-02-11T18:55:47.000Z | 2022-03-31T14:12:23.000Z | Calibration/EcalCalibAlgos/interface/Pi0FixedMassWindowCalibration.h | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 51 | 2015-08-11T21:01:40.000Z | 2022-03-30T07:31:34.000Z | #ifndef Calibration_EcalCalibAlgos_Pi0FixedMassWindowCalibration_h
#define Calibration_EcalCalibAlgos_Pi0FixedMassWindowCalibration_h
#include <memory>
#include <string>
#include <iostream>
#include <vector>
#include "DataFormats/GeometryVector/interface/GlobalPoint.h"
// Framework
#include "FWCore/Framework/interface/LooperFactory.h"
#include "FWCore/Framework/interface/ESProducerLooper.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
#include "FWCore/ParameterSet/interface/ConfigurationDescriptions.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/Framework/interface/ESHandle.h"
#include "CondFormats/EcalObjects/interface/EcalIntercalibConstants.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHit.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "DataFormats/EcalDetId/interface/EcalSubdetector.h"
#include "DataFormats/HcalRecHit/interface/HBHERecHit.h"
#include "DataFormats/HcalRecHit/interface/HcalRecHitCollections.h"
#include "DataFormats/HcalDetId/interface/HcalSubdetector.h"
#include "DataFormats/EcalDetId/interface/EBDetId.h"
#include "DataFormats/EcalDetId/interface/EEDetId.h"
#include "DataFormats/EcalDetId/interface/ESDetId.h"
#include "DataFormats/DetId/interface/DetId.h"
#include "FWCore/Framework/interface/Frameworkfwd.h"
#include "FWCore/Framework/interface/EDProducer.h"
#include "FWCore/Framework/interface/Event.h"
#include "FWCore/Framework/interface/EventSetup.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
#include "RecoEcal/EgammaClusterAlgos/interface/IslandClusterAlgo.h"
#include "RecoEcal/EgammaCoreTools/interface/PositionCalc.h"
#include "RecoEcal/EgammaCoreTools/interface/ClusterShapeAlgo.h"
#include "Geometry/CaloTopology/interface/CaloSubdetectorTopology.h"
#include "TFile.h"
#include "TTree.h"
#include "TH1F.h"
#include "TF1.h"
#include "TGraph.h"
#include "TCanvas.h"
class Pi0FixedMassWindowCalibration : public edm::ESProducerLooper {
public:
/// Constructor
Pi0FixedMassWindowCalibration(const edm::ParameterSet& iConfig);
/// Destructor
~Pi0FixedMassWindowCalibration() override;
static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
/// Dummy implementation (job done in duringLoop)
virtual void produce(edm::Event&, const edm::EventSetup&){};
/// Called at beginning of job
void beginOfJob() override;
/// Called at end of job
void endOfJob() override;
/// Called at beginning of loop
void startingNewLoop(unsigned int iLoop) override;
/// Called at end of loop
Status endOfLoop(const edm::EventSetup&, unsigned int iLoop) override;
/// Called at each event
Status duringLoop(const edm::Event&, const edm::EventSetup&) override;
private:
// static const double PDGPi0Mass;
int nevent;
unsigned int theMaxLoops;
std::string ecalHitsProducer_;
std::string barrelHits_;
IslandClusterAlgo::VerbosityLevel verbosity;
std::string barrelHitProducer_;
std::string barrelHitCollection_;
std::string barrelClusterCollection_;
std::string clustershapecollectionEB_;
std::string barrelClusterShapeAssociation_;
PositionCalc posCalculator_; // position calculation algorithm
ClusterShapeAlgo shapeAlgo_; // cluster shape algorithm
IslandClusterAlgo* island_p;
// Selection algorithm parameters
double selePi0PtGammaOneMin_;
double selePi0PtGammaTwoMin_;
double selePi0DRBelt_;
double selePi0DetaBelt_;
double selePi0PtPi0Min_;
double selePi0S4S9GammaOneMin_;
double selePi0S4S9GammaTwoMin_;
double selePi0S9S25GammaOneMin_;
double selePi0S9S25GammaTwoMin_;
double selePi0EtBeltIsoRatioMax_;
double selePi0MinvMeanFixed_;
double selePi0MinvSigmaFixed_;
std::vector<DetId> barrelCells;
// input calibration constants
double oldCalibs_barl[85][360][2];
double newCalibs_barl[85][360][2];
double wxtals[85][360][2];
double mwxtals[85][360][2];
// steering parameters
edm::ParameterSet theParameterSet;
// map for all RecHits from ECal:
std::map<DetId, EcalRecHit>* recHitsEB_map;
const EcalRecHitCollection* ecalRecHitBarrelCollection;
const EcalRecHitCollection* recalibEcalRecHitCollection;
// root tree
TFile* theFile;
bool isfirstcall_;
};
#endif
| 30.486667 | 77 | 0.798819 |
0dfb8e8da5f4479cc5b42f76273026b048310645 | 4,468 | c | C | lib/slist.c | marcas756/myos | be75b6b127d213b7c6ed1c6a05b247680d6cd2d2 | [
"BSD-3-Clause"
] | null | null | null | lib/slist.c | marcas756/myos | be75b6b127d213b7c6ed1c6a05b247680d6cd2d2 | [
"BSD-3-Clause"
] | null | null | null | lib/slist.c | marcas756/myos | be75b6b127d213b7c6ed1c6a05b247680d6cd2d2 | [
"BSD-3-Clause"
] | null | null | null | /*! \copyright
https://opensource.org/licenses/BSD-3-Clause
Copyright 2013-2021 Marco Bacchi <marco@bacchi.at>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*!
\file slist.h
\brief Circular singly linked list
\details In computer science, a linked list is a linear collection of data elements,
whose order is not given by their physical placement in memory.
Instead, each element points to the next. It is a data structure consisting
of a collection of nodes which together represent a sequence. In its most basic form,
each node contains: data, and a reference (in other words, a link) to the next node
in the sequence. This structure allows for efficient insertion or removal of elements
from any position in the sequence during iteration.
[https://en.wikipedia.org/wiki/Linked_list]
Singly linked lists contain nodes which have a data field as well as 'next' field,
which points to the next node in line of nodes. Operations that can be performed on
singly linked lists include insertion, deletion and traversal.
[https://en.wikipedia.org/wiki/Linked_list#Singly_linked_list]
In the last node of a list, the link field often contains a null reference, a
special value is used to indicate the lack of further nodes. A less common convention
is to make it point to the first node of the list; in that case, the list is said to
be 'circular' or 'circularly linked'; otherwise, it is said to be 'open' or 'linear'.
It is a list where the last pointer points to the first node.
[https://en.wikipedia.org/wiki/Linked_list#Circular_linked_list]
*/
#include <stdlib.h>
#include "slist.h"
slist_node_t* slist_find(slist_t *slist, void *node)
{
slist_node_t* iterator;
slist_foreach(slist,iterator)
{
if ( iterator == node )
{
return node;
}
}
return NULL;
}
slist_node_t* slist_back(slist_t* slist)
{
slist_node_t *iterator = slist_end(slist);
while( slist_next(slist,iterator) != slist_end(slist) )
{
iterator = slist_next(slist,iterator);
}
return iterator;
}
void slist_pop_back(slist_t *slist)
{
slist_node_t *iterator = slist_end(slist);
while( iterator->next->next != slist_end(slist) )
{
iterator = slist_next(slist,iterator);
}
iterator->next = slist_end(slist);
}
slist_node_t* slist_prev(slist_t *slist, void* node)
{
slist_node_t *iterator = node;
while( slist_next(slist,iterator) != node )
{
iterator = slist_next(slist,iterator);
}
return iterator;
}
size_t slist_size(slist_t *slist)
{
slist_node_t *iterator;
size_t size = 0;
slist_foreach(slist,iterator)
{
size++;
}
return size;
}
| 33.096296 | 101 | 0.68308 |
0ea0b45ecaec7fa2b5e8bdb351c8ec62c9bc1c77 | 555 | h | C | QuFaXian/QuFaXian/Model/ActivityEntitylist.h | Hekeda-scjy03/The-End-Project | 3d81a711cae47735d9fe60ccf74a41ec63c7cd84 | [
"Apache-2.0"
] | null | null | null | QuFaXian/QuFaXian/Model/ActivityEntitylist.h | Hekeda-scjy03/The-End-Project | 3d81a711cae47735d9fe60ccf74a41ec63c7cd84 | [
"Apache-2.0"
] | null | null | null | QuFaXian/QuFaXian/Model/ActivityEntitylist.h | Hekeda-scjy03/The-End-Project | 3d81a711cae47735d9fe60ccf74a41ec63c7cd84 | [
"Apache-2.0"
] | null | null | null | //
// ActivityEntitylist.h
// QuFaXian
//
// Created by licong on 16/5/31.
// Copyright © 2016年 Sugar. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ActivityEntitylist : NSObject
@property (nonatomic, strong) NSNumber *zan;
@property (nonatomic, strong) NSNumber *comment;
@property (nonatomic, copy) NSString *context;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *senderName;
@property (nonatomic, copy) NSString *senderDes;
- (instancetype)initWithDic:(NSDictionary* )dic;
@end
| 19.821429 | 49 | 0.733333 |
1db85a23a13df78a5c50ab6affb85a200af7f202 | 2,066 | c | C | vlc_linux/vlc-3.0.16/compat/flockfile.c | Brook1711/biubiu_Qt6 | 5c4d22a1d1beef63bc6c7738dce6c477c4642803 | [
"MIT"
] | null | null | null | vlc_linux/vlc-3.0.16/compat/flockfile.c | Brook1711/biubiu_Qt6 | 5c4d22a1d1beef63bc6c7738dce6c477c4642803 | [
"MIT"
] | null | null | null | vlc_linux/vlc-3.0.16/compat/flockfile.c | Brook1711/biubiu_Qt6 | 5c4d22a1d1beef63bc6c7738dce6c477c4642803 | [
"MIT"
] | null | null | null | /*****************************************************************************
* flockfile.c: POSIX unlocked I/O stream stubs
*****************************************************************************
* Copyright © 2011-2012 Rémi Denis-Courmont
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#ifdef _WIN32
# ifndef HAVE__LOCK_FILE
# warning Broken SDK: VLC logs will be garbage.
# define _lock_file(s) ((void)(s))
# define _unlock_file(s) ((void)(s))
# undef _getc_nolock
# define _getc_nolock(s) getc(s)
# undef _putc_nolock
# define _putc_nolock(s,c) putc(s,c)
# endif
void flockfile (FILE *stream)
{
_lock_file (stream);
}
void funlockfile (FILE *stream)
{
_unlock_file (stream);
}
int getc_unlocked (FILE *stream)
{
return _getc_nolock (stream);
}
int putc_unlocked (int c, FILE *stream)
{
return _putc_nolock (c, stream);
}
#elif defined __native_client__
void flockfile (FILE *stream)
{
_flockfile(stream);
}
void funlockfile (FILE *stream)
{
_funlockfile(stream);
}
#else
# error flockfile not implemented on your platform!
#endif
int getchar_unlocked (void)
{
return getc_unlocked (stdin);
}
int putchar_unlocked (int c)
{
return putc_unlocked (c, stdout);
}
| 25.506173 | 79 | 0.643272 |
8aa48ca1ea0c30e322bbd2348e0cb46ae7fd1d8f | 3,352 | h | C | implementations/c99/basic/drivers/com16/satl_com16.h | sebastien-riou/SATL | b95d0e784d2e8e1384381d4d5b8b448d3d1798cf | [
"Apache-2.0"
] | 4 | 2020-05-13T10:13:55.000Z | 2021-10-20T04:43:07.000Z | implementations/c99/basic/drivers/com16/satl_com16.h | TiempoSecure/SATL | b95d0e784d2e8e1384381d4d5b8b448d3d1798cf | [
"Apache-2.0"
] | 4 | 2020-07-22T16:06:31.000Z | 2021-07-25T19:51:41.000Z | implementations/c99/basic/drivers/com16/satl_com16.h | TiempoSecure/SATL | b95d0e784d2e8e1384381d4d5b8b448d3d1798cf | [
"Apache-2.0"
] | 2 | 2019-05-12T21:15:00.000Z | 2020-09-23T09:05:24.000Z | #ifndef __SATL_COM16_H__
#define __SATL_COM16_H__
#include "com16.h"
//assume we have built-in flow control
#define SATL_ACK 0
#define SATL_SFR_GRANULARITY 2
#define SATL_SUPPORT_SLAVE
#define SATL_SUPPORT_MASTER
//assume COM16_ADDR is defined to based address of COM16 peripheral
//#define SATL_COM16 ((COM16_t*)(COM16_ADDR))
#define SATL_COM16 (ctx->hw)
typedef struct SATL_driver_ctx_struct_t {
COM16_t*hw;
uint16_t buf;
uint32_t buf_level;
} SATL_driver_ctx_t;
static uint32_t SATL_get_rx_level(const SATL_driver_ctx_t *ctx){
return ctx->buf_level;
}
static uint32_t SATL_slave_init_driver( SATL_driver_ctx_t*const ctx, void *hw){
ctx->buf = 0;
ctx->buf_level = 0;
ctx->hw = hw;
return 0;
}
static uint32_t SATL_master_init_driver( SATL_driver_ctx_t*const ctx, void *hw){
return SATL_slave_init_driver(ctx,hw);
}
static void SATL_switch_to_tx(SATL_driver_ctx_t *const ctx){
//printf("SATL_switch_to_tx\n");
ctx->buf_level=0;//sometime a padding byte is left unread
assert(0==COM16_RX_IS_READY(ctx->hw));
}
static void __SATL_tx16(const SATL_driver_ctx_t *ctx,uint16_t dat){
//printf("__SATL_tx16\n");
while(0==COM16_TX_IS_READY(ctx->hw));
COM16_SET_TX(ctx->hw,dat);
}
static uint16_t __SATL_rx16(SATL_driver_ctx_t *const ctx){
while(0==COM16_RX_IS_READY(ctx->hw));
return COM16_GET_RX(ctx->hw);
}
static void SATL_tx(SATL_driver_ctx_t *const ctx,const void*const buf,unsigned int len){
//printf("SATL_tx %u\n",len);
uint8_t*buf8 = (uint8_t*)buf;
if(ctx->buf_level && len>=1){
ctx->buf |= ((uint16_t)buf8[0])<<8;
__SATL_tx16(ctx,ctx->buf);
ctx->buf_level=0;
len--;
buf8++;
}
for(unsigned int i=0;i<len/2;i++){
uint16_t dat = buf8[2*i+1];
dat = dat<<8;
dat |= buf8[2*i];
__SATL_tx16(ctx,dat);
}
if(len%2){
ctx->buf_level=1;
ctx->buf = buf8[len-1];
}
}
static void SATL_final_tx(SATL_driver_ctx_t *const ctx,const void*const buf,unsigned int len){
SATL_tx(ctx,buf,len);
//printf("SATL_final_tx ctx->buf_level=%u\n",ctx->buf_level);
if(ctx->buf_level){
__SATL_tx16(ctx,ctx->buf);
ctx->buf_level=0;
}
}
static void SATL_generic_rx(SATL_driver_ctx_t *const ctx,void*buf,unsigned int len){
//printf("SATL_generic_rx len=%u\n",len);
if(0==len) return;
uint8_t*buf8 = (uint8_t*)buf;
if(ctx->buf_level){
buf8[0] = ctx->buf;
len--;
buf8++;
ctx->buf_level=0;
}
for(unsigned int i=0;i<len/2;i++){
ctx->buf = __SATL_rx16(ctx);
buf8[2*i+0] = ctx->buf;
buf8[2*i+1] = ctx->buf>>8;
}
if(len%2){
ctx->buf = __SATL_rx16(ctx);
buf8[len-1] = ctx->buf;
ctx->buf_level=1;
ctx->buf = ctx->buf>>8;
}
}
static void SATL_rx(SATL_driver_ctx_t *const ctx,void*buf,unsigned int len){
//printf("SATL_rx %u\n",len);
SATL_generic_rx(ctx,buf,len);
}
static void SATL_final_rx(SATL_driver_ctx_t *const ctx,void*buf,unsigned int len){
//printf("SATL_final_rx %u\n",len);
SATL_generic_rx(ctx,buf,len);
}
static void SATL_tx_ack(SATL_driver_ctx_t *const ctx){
//printf("SATL_tx_ack\n");
}
static void SATL_rx_ack(SATL_driver_ctx_t *const ctx){
//printf("SATL_rx_ack ");
}
#endif //__SATL_COM16_H__
| 25.784615 | 94 | 0.654833 |
c087c58219434c4983bfaafd692432a4026e5a3c | 2,908 | h | C | services/nfc_standard/src/service-ncibal/lib/stnfc/include/src/include/vendor_cfg.h | dawmlight/communication_nfc | 84a10d69eb9cb3128e864230c53d5a5e6660dfb9 | [
"Apache-2.0"
] | null | null | null | services/nfc_standard/src/service-ncibal/lib/stnfc/include/src/include/vendor_cfg.h | dawmlight/communication_nfc | 84a10d69eb9cb3128e864230c53d5a5e6660dfb9 | [
"Apache-2.0"
] | null | null | null | services/nfc_standard/src/service-ncibal/lib/stnfc/include/src/include/vendor_cfg.h | dawmlight/communication_nfc | 84a10d69eb9cb3128e864230c53d5a5e6660dfb9 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2015 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.
*/
/******************************************************************************
*
* This file contains compile-time configurable constants for vendor specific
*proprietary protocols
*
******************************************************************************/
#ifndef __NFC_VENDOR_CFG_H__
#define __NFC_VENDOR_CFG_H__
/* compile-time configuration structure for proprietary protocol and discovery
* value */
typedef struct {
uint8_t pro_protocol_18092_active;
uint8_t pro_protocol_b_prime;
uint8_t pro_protocol_dual;
uint8_t pro_protocol_15693;
uint8_t pro_protocol_kovio;
uint8_t pro_protocol_mfc;
uint8_t pro_discovery_kovio_poll;
uint8_t pro_discovery_b_prime_poll;
uint8_t pro_discovery_b_prime_listen;
} tNFA_PROPRIETARY_CFG;
extern tNFA_PROPRIETARY_CFG* p_nfa_proprietary_cfg;
/**********************************************
* Proprietary Protocols
**********************************************/
#ifndef NCI_PROTOCOL_18092_ACTIVE
#define NCI_PROTOCOL_18092_ACTIVE \
(p_nfa_proprietary_cfg->pro_protocol_18092_active)
#endif
#ifndef NCI_PROTOCOL_B_PRIME
#define NCI_PROTOCOL_B_PRIME (p_nfa_proprietary_cfg->pro_protocol_b_prime)
#endif
#ifndef NCI_PROTOCOL_DUAL
#define NCI_PROTOCOL_DUAL (p_nfa_proprietary_cfg->pro_protocol_dual)
#endif
#ifndef NCI_PROTOCOL_15693
#define NCI_PROTOCOL_15693 (p_nfa_proprietary_cfg->pro_protocol_15693)
#endif
#ifndef NCI_PROTOCOL_KOVIO
#define NCI_PROTOCOL_KOVIO (p_nfa_proprietary_cfg->pro_protocol_kovio)
#endif
#ifndef NCI_PROTOCOL_MIFARE
#define NCI_PROTOCOL_MIFARE (p_nfa_proprietary_cfg->pro_protocol_mfc)
#endif
#ifdef ST21NFC
#ifndef NCI_PROTOCOL_CI
#define NCI_PROTOCOL_CI 0x84
#endif
#endif
/**********************************************
* Proprietary Discovery technology and mode
**********************************************/
#ifndef NCI_DISCOVERY_TYPE_POLL_KOVIO
#define NCI_DISCOVERY_TYPE_POLL_KOVIO \
(p_nfa_proprietary_cfg->pro_discovery_kovio_poll)
#endif
#ifndef NCI_DISCOVERY_TYPE_POLL_B_PRIME
#define NCI_DISCOVERY_TYPE_POLL_B_PRIME \
(p_nfa_proprietary_cfg->pro_discovery_b_prime_poll)
#endif
#ifndef NCI_DISCOVERY_TYPE_LISTEN_B_PRIME
#define NCI_DISCOVERY_TYPE_LISTEN_B_PRIME \
(p_nfa_proprietary_cfg->pro_discovery_b_prime_listen)
#endif
#endif /* __NFC_VENDOR_CFG_H__ */
| 32.311111 | 80 | 0.723865 |
0e0cc43ebdf28914190c1b7d2ae0c3cbad1085cf | 270 | c | C | src/recsum.c | kgashok/psgc | c3509f1a6dfc0e7943ea703a971256f28d5a4af5 | [
"MIT"
] | null | null | null | src/recsum.c | kgashok/psgc | c3509f1a6dfc0e7943ea703a971256f28d5a4af5 | [
"MIT"
] | null | null | null | src/recsum.c | kgashok/psgc | c3509f1a6dfc0e7943ea703a971256f28d5a4af5 | [
"MIT"
] | null | null | null | #include <stdio.h>
int rec_sum(int* s, int size) {
if (size == 0) return 0;
int sumval = *s; // get element
return sumval + rec_sum(++s, --size);
}
int main() {
int s[7] = {1, 2, 3, 4, 5, 6, 7};
int sum = rec_sum(s, 7);
printf("The sum is %d\n", sum);
} | 18 | 39 | 0.537037 |
dbd425046380660c972a90aa1e0d36048afd2f05 | 3,748 | h | C | tictactoe.h | ofdouglas/TicTacToe | b8d6adf902d8f2a5b60daf9edec62ea079721feb | [
"MIT"
] | null | null | null | tictactoe.h | ofdouglas/TicTacToe | b8d6adf902d8f2a5b60daf9edec62ea079721feb | [
"MIT"
] | null | null | null | tictactoe.h | ofdouglas/TicTacToe | b8d6adf902d8f2a5b60daf9edec62ea079721feb | [
"MIT"
] | null | null | null | #ifndef TICTACTOE_H_DEFINED
#define TICTACTOE_H_DEFINED
#include <limits>
#include <cstdint>
#include <vector>
#include <string>
#include <cmath>
namespace TicTacToe {
enum class GameResult { Ongoing, Draw, X_win, O_win };
enum Mark { X = 1, Empty = 0, O = -1 };
class Board;
struct Move {
int row;
int col;
std::string ToString() const;
};
// Use float so that score arithmetic saturates and latches at +/-INFINITY, as
// required by the heuristic function.
using score_t = float;
static constexpr score_t max_score = INFINITY;
static constexpr score_t score_per_mark = 1.0f;
static constexpr size_t min_dimensions = 3;
static constexpr size_t max_dimensions = 10;
std::ostream& operator<<(std::ostream& os, TicTacToe::GameResult result);
std::ostream& operator<<(std::ostream& os, TicTacToe::Mark mark);
std::ostream& operator<<(std::ostream& os, TicTacToe::Move move);
class Player {
public:
virtual Move GetMove(const Board& b, Mark mark) const = 0;
};
class HumanPlayer : public Player {
public:
Move GetMove(const Board& b, Mark mark) const;
private:
int ReadIntWithPrompt(const std::string& prompt) const;
};
class ComputerPlayer : public Player {
public:
ComputerPlayer(unsigned max_depth = 5) : depth_limit(max_depth) {}
Move GetMove(const Board& b, Mark mark) const;
private:
score_t Negamax(Board& b, Mark mark, unsigned depth) const;
mutable Move best_move;
mutable bool move_selected;
mutable unsigned moves_evaluated;
mutable unsigned max_depth_this_run;
const unsigned depth_limit;
};
class Board {
public:
Board(int dimension);
bool IsValidMove(Move move) const;
bool IsInBoundsMove(Move move) const;
bool IsAnyTileEmpty() const;
GameResult CheckResults() const;
void ApplyMove(Move move, Mark sc);
void UndoMove(Move move);
// Requires that score_t::operator+= saturates and latches at max_score (the victory condition),
// because the total score of a position is the sum of the scores of all lines, and we need any
// max_score results from the line scoring function to be preserved, so that a winning line causes
// the position to be scored as a win, even if the opponent has a better score for the other lines.
// NOTE: addition of (+max_score) and (-max_score) should never happen (we do win checks each ply).
score_t HeuristicScore() const;
const int dimension;
private:
Mark* squares; // Treated as a 2D array; accessed through 'At' function
Mark& At(int row, int col);
const Mark& At(int row, int col) const;
// Calculate the score of a single row, column, or diagonal (e.g. a 'line'). The score is
// zero if both players have marks on the line, because neither can win via that line. A win
// is evaluated as a +max_score or -max_score, depending on the player. If the line isn't
// contested and isn't a victory, the score is proportional to the number of marks.
inline score_t ScoreLine(const std::vector<Mark>& line) const;
mutable std::vector<Mark> line = std::vector<Mark>(dimension);
friend std::ostream& operator<<(std::ostream&, const Board& b);
};
class Game {
public:
Game(Player& x_player, Player& o_player, int dimension = 3);
GameResult ExecutePly();
void Display() const;
private:
Board board;
Player* const players[2];
unsigned ply_number;
};
};
#endif // TICTACTOE_H_DEFINED | 32.310345 | 107 | 0.648346 |
ed68c9728af5e1d2c180680c3a82949a660c7cda | 2,932 | h | C | lib-arm/include/arm/synchronize.h | rodb70/rpidmx512 | 6e7eef3eaba35cc2eb7cdeb5bef906faea9366fd | [
"MIT"
] | 328 | 2015-02-26T09:54:16.000Z | 2022-03-31T11:04:00.000Z | lib-arm/include/arm/synchronize.h | rodb70/rpidmx512 | 6e7eef3eaba35cc2eb7cdeb5bef906faea9366fd | [
"MIT"
] | 195 | 2016-07-13T10:43:37.000Z | 2022-03-20T19:14:55.000Z | lib-arm/include/arm/synchronize.h | rodb70/rpidmx512 | 6e7eef3eaba35cc2eb7cdeb5bef906faea9366fd | [
"MIT"
] | 113 | 2015-06-08T04:54:23.000Z | 2022-02-15T09:06:10.000Z | /**
* @file synchronize.h
*
*/
/* Copyright (C) 2016-2018 by Arjan van Vught mailto:info@orangepi-dmx.nl
*
* 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 SYNCHRONIZE_H_
#define SYNCHRONIZE_H_
#ifdef __cplusplus
extern "C" {
#endif
#if defined( RPI1 )
#define isb() asm volatile ("mcr p15, #0, %[zero], c7, c5, #4" : : [zero] "r" (0) )
#define dsb() asm volatile ("mcr p15, #0, %[zero], c7, c10, #4" : : [zero] "r" (0) )
#define dmb() asm volatile ("mcr p15, #0, %[zero], c7, c10, #5" : : [zero] "r" (0) )
#define invalidate_instruction_cache() asm volatile ("mcr p15, #0, %[zero], c7, c5, #0" : : [zero] "r" (0) )
#define flush_prefetch_buffer() asm volatile ("mcr p15, #0, %[zero], c7, c5, #4" : : [zero] "r" (0) )
#define flush_branch_target_cache() asm volatile ("mcr p15, #0, %[zero], c7, c5, #6" : : [zero] "r" (0) )
#define invalidate_data_cache() asm volatile ("mcr p15, 0, %0, c7, c6, 0\n" \
"mcr p15, 0, %0, c7, c10, 4\n" : : "r" (0) : "memory")
#define clean_data_cache() asm volatile ("mcr p15, 0, %0, c7, c10, 0\n" \
"mcr p15, 0, %0, c7, c10, 4\n" : : "r" (0) : "memory")
#else
#define isb() asm volatile ("isb" ::: "memory")
#define dsb() asm volatile ("dsb" ::: "memory")
#define dmb() asm volatile ("dmb" ::: "memory")
#define invalidate_instruction_cache() asm volatile ("mcr p15, #0, %[zero], c7, c5, #0" : : [zero] "r" (0) : "memory")
#define flush_prefetch_buffer() asm volatile ("isb" ::: "memory")
#define flush_branch_target_cache() asm volatile ("mcr p15, #0, %[zero], c7, c5, #6" : : [zero] "r" (0) : "memory")
extern void invalidate_data_cache(void) __attribute__ ((optimize (3)));
extern void clean_data_cache(void) __attribute__ ((optimize (3)));
extern void invalidate_data_cache_l1_only(void) __attribute__ ((optimize (3)));
#endif
#ifdef __cplusplus
}
#endif
#endif /* SYNCHRONIZE_H_ */
| 43.761194 | 120 | 0.663029 |
ef3a0fdaabd29abe73b75b7d84bc01734fce5895 | 2,821 | h | C | src/list-mon-race-flags.h | Elfin-Jedi/Angband-4.0.5 | d4c9bcf96b6fed8e7c477e5f545d7a4ecea7250c | [
"CC-BY-3.0"
] | null | null | null | src/list-mon-race-flags.h | Elfin-Jedi/Angband-4.0.5 | d4c9bcf96b6fed8e7c477e5f545d7a4ecea7250c | [
"CC-BY-3.0"
] | null | null | null | src/list-mon-race-flags.h | Elfin-Jedi/Angband-4.0.5 | d4c9bcf96b6fed8e7c477e5f545d7a4ecea7250c | [
"CC-BY-3.0"
] | null | null | null | /**
* \file list-mon-race-flags.h
* \brief monster race flags
*
* Changing flag order will break savefiles. There was a hard-coded limit of
* 96 flags, due to 12 bytes of storage for lore flags in the savefile; this
* should be fixed now. Flags below start from 1 on line 13, so a flag's
* sequence number is its line number minus 12. Column 2 (descr) is currently
* used for lore descriptions.
*/
/* symbol descr */
RF(NONE, "", "")
RF(UNIQUE, "", "")
RF(QUESTOR, "", "")
RF(MALE, "", "")
RF(FEMALE, "", "")
RF(CHAR_CLEAR, "", "")
RF(ATTR_RAND, "","")
RF(ATTR_CLEAR, "", "")
RF(ATTR_MULTI, "", "")
RF(FORCE_DEPTH,"", "")
RF(UNAWARE, "","")
RF(FORCE_SLEEP,"", "")
RF(FORCE_EXTRA,"", "")
RF(GROUP_AI, "", "")
RF(SEASONAL, "", "")
RF(NEVER_BLOW, "", "")
RF(NEVER_MOVE, "", "")
RF(RAND_25, "", "")
RF(RAND_50, "", "")
RF(ONLY_GOLD, "", "")
RF(ONLY_ITEM, "", "")
RF(DROP_40, "", "")
RF(DROP_60, "", "")
RF(DROP_1, "", "")
RF(DROP_2, "", "")
RF(DROP_3, "", "")
RF(DROP_4, "", "")
RF(DROP_GOOD, "", "")
RF(DROP_GREAT, "", "")
RF(DROP_20, "", "")
RF(MIMIC_INV, "", "")
RF(STUPID, "", "")
RF(SMART, "", "")
RF(HAS_LIGHT, "", "")
RF(ATTR_FLICKER,"","")
RF(INVISIBLE, "", "invisible")
RF(COLD_BLOOD, "", "cold blooded")
RF(EMPTY_MIND, "", "not detected by telepathy")
RF(WEIRD_MIND, "", "rarely detected by telepathy")
RF(MULTIPLY, "", "")
RF(REGENERATE, "", "")
RF(POWERFUL, "", "")
RF(OPEN_DOOR, "", "open doors")
RF(BASH_DOOR, "", "bash down doors")
RF(PASS_WALL, "", "pass through walls")
RF(KILL_WALL, "", "bore through walls")
RF(MOVE_BODY, "", "push past weaker monsters")
RF(KILL_BODY, "", "destroy weaker monsters")
RF(TAKE_ITEM, "", "pick up objects")
RF(KILL_ITEM, "", "destroy objects")
RF(ORC, "orcs", "orc")
RF(TROLL, "trolls", "troll")
RF(GIANT, "giants", "giant")
RF(DRAGON, "dragons", "dragon")
RF(DEMON, "demons", "demon")
RF(UNDEAD, "undead", "undead")
RF(EVIL, "evil creatures", "evil")
RF(ANIMAL, "animals", "animal")
RF(INSECT, "insects", "insect")
RF(PLANT, "plants", "plant")
RF(NATURE, "", "")
RF(HUMANOID, "humanoids", "humanoid")
RF(METAL, "", "metal")
RF(NONLIVING, "","nonliving")
RF(HURT_LIGHT, "", "bright light")
RF(HURT_ROCK, "", "rock remover")
RF(HURT_FIRE, "", "fire")
RF(HURT_COLD, "", "cold")
RF(IM_ACID, "", "acid")
RF(IM_ELEC, "", "lightning")
RF(IM_FIRE, "", "fire")
RF(IM_COLD, "", "cold")
RF(IM_POIS, "", "poison")
RF(IM_NETHER, "", "nether")
RF(IM_WATER, "", "water")
RF(IM_PLASMA, "", "plasma")
RF(IM_NEXUS, "", "nexus")
RF(IM_DISEN, "", "disenchantment")
RF(NO_FEAR, "", "frightened")
RF(NO_STUN, "", "stunned")
RF(NO_CONF, "", "confused")
RF(NO_SLEEP, "", "slept")
/* end flags */
| 29.694737 | 78 | 0.559376 |
dedb64fdc105a5b0882d8c3254026fcb8b287056 | 829 | h | C | ra-tls/sgx-ra-tls/ra-challenger.h | hhb584520/inclavare-containers | 8a53cbcb621012d8bf2d038ebd35b07a6692eb38 | [
"Apache-2.0"
] | 97 | 2018-01-08T23:54:36.000Z | 2022-02-17T06:03:54.000Z | ra-tls/sgx-ra-tls/ra-challenger.h | hhb584520/inclavare-containers | 8a53cbcb621012d8bf2d038ebd35b07a6692eb38 | [
"Apache-2.0"
] | 25 | 2018-08-06T23:45:08.000Z | 2021-10-12T16:54:43.000Z | ra-tls/sgx-ra-tls/ra-challenger.h | hhb584520/inclavare-containers | 8a53cbcb621012d8bf2d038ebd35b07a6692eb38 | [
"Apache-2.0"
] | 31 | 2018-01-10T07:45:08.000Z | 2022-01-25T05:57:52.000Z | #ifndef _RA_CHALLENGER_H_
#define _RA_CHALLENGER_H_
#include <sgx_quote.h>
/**
* Extract an Intel SGX quote from an Intel Attestation Service (IAS) report.
*/
void get_quote_from_report
(
const uint8_t* report /* in */,
const int report_len /* in */,
sgx_quote_t* quote
);
/**
* Extract an Intel SGX quote from a DER-encoded X.509 certificate.
*/
void get_quote_from_cert
(
const uint8_t* der_crt,
uint32_t der_crt_len,
sgx_quote_t* q
);
/**
* Verify SGX-related X.509 extensions.
* @return 0 if verification succeeds, 1 otherwise.
*/
int verify_sgx_cert_extensions
(
uint8_t* der_crt,
uint32_t der_crt_len
);
/**
* Pretty-print information of RA-TLS certificate to file descriptor.
*/
void dprintf_ratls_cert
(
int fd,
uint8_t* der_crt,
uint32_t der_crt_len
);
#endif
| 17.638298 | 77 | 0.700844 |
90452ca92aa4bcac47e0f7cecc990cf78fa57911 | 2,914 | h | C | C/vbHmmGauss.h | okamoto-kenji/varBayes-HMM | 77afe3c336c9e1ebeb115ca4f0b2bc25060556bd | [
"MIT"
] | 7 | 2016-03-31T06:59:00.000Z | 2019-11-01T06:35:57.000Z | C/vbHmmGauss.h | okamoto-kenji/varBayes-HMM | 77afe3c336c9e1ebeb115ca4f0b2bc25060556bd | [
"MIT"
] | null | null | null | C/vbHmmGauss.h | okamoto-kenji/varBayes-HMM | 77afe3c336c9e1ebeb115ca4f0b2bc25060556bd | [
"MIT"
] | null | null | null | /*
* vbHmmGauss.h
* Model-specific core functions for VB-HMM-GAUSS.
*
* Created by OKAMOTO Kenji, SAKO Yasushi and RIKEN
* Copyright 2011-2015
* Cellular Informatics Laboratory, Advance Science Institute, RIKEN, Japan.
* All rights reserved.
*
* Ver. 1.0.0
* Last modified on 2015.09.17
*/
#ifndef VBHMMGAUSS_DEF
#define VBHMMGAUSS_DEF
#include "gVbHmm_Common.h"
// model-specific data
typedef struct _gaussData {
double *v; // value
} gaussData;
xnDataSet *newXnDataSet_gauss( const char* );
void freeXnDataSet_gauss( xnDataSet** );
// model-specific parameters
typedef struct _gaussParameters {
// int sNo;
double *uPiArr, sumUPi;
double **uAMat, *sumUAArr;
double *avgPi, *avgLnPi;
double **avgA, **avgLnA;
double *avgMu, *avgLm, *avgLnLm;
double *uBtArr, *uMuArr, *uAArr, *uBArr;
double *btMu, *aLm, *bLm, *mu0;
} gaussParameters;
void *newModelParameters_gauss( xnDataSet*, int );
void freeModelParameters_gauss( void**, xnDataSet*, int );
// model-specific stats variables
typedef struct _gaussStats {
double **Nij, *Nii, *Ni, *barX, *NiSi;
} gaussStats;
void *newModelStats_gauss( xnDataSet*, globalVars*, indVars* );
void freeModelStats_gauss( void**, xnDataSet*, globalVars*, indVars* );
// model-specific stats variables
typedef struct _gaussGlobalStats {
double **NijR, *NiiR, *NiR, *barXR, *NiSiR, *z1iR;
} gaussGlobalStats;
void *newModelStatsG_gauss( xnDataBundle*, globalVars*, indVarBundle* );
void freeModelStatsG_gauss( void**, xnDataBundle*, globalVars*, indVarBundle* );
void initializeVbHmm_gauss( xnDataSet*, globalVars*, indVars* );
void initializeVbHmmG_gauss( xnDataBundle*, globalVars*, indVarBundle* );
void initialize_indVars_gauss( xnDataSet*, globalVars*, indVars* );
// model-specific output
void outputGaussResults( xnDataSet*, globalVars*, indVars*, FILE* );
void outputGaussResultsG( xnDataBundle*, globalVars*, indVarBundle*, FILE* );
// functions required to work with vbHmm_Common
void setFunctions_gauss();
void setGFunctions_gauss();
double pTilde_z1_gauss( int, void* );
double pTilde_zn_zn1_gauss( int, int, void* );
double pTilde_xn_zn_gauss( xnDataSet*, size_t, int, void* );
void calcStatsVars_gauss( xnDataSet*, globalVars*, indVars* );
void calcStatsVarsG_gauss( xnDataBundle*, globalVars*, indVarBundle* );
void maximization_gauss( xnDataSet*, globalVars*, indVars* );
void maximizationG_gauss( xnDataBundle*, globalVars*, indVarBundle* );
double varLowerBound_gauss( xnDataSet*, globalVars*, indVars* );
double varLowerBoundG_gauss( xnDataBundle*, globalVars*, indVarBundle* );
void reorderParameters_gauss( xnDataSet*, globalVars*, indVars* );
void reorderParametersG_gauss( xnDataBundle*, globalVars*, indVarBundle* );
void outputResults_gauss( xnDataSet*, globalVars*, indVars*, FILE* );
void outputResultsG_gauss( xnDataBundle*, globalVars*, indVarBundle*, FILE* );
#endif
//
| 32.741573 | 80 | 0.741935 |
fd06bbe20475dc8f1fe20514b7e8366c4e95310d | 481 | h | C | RestKit-Syndicate/Source/RKSMapper.h | DZamataev/RestKit-Syndicate | 2dfc843d8828b051cdd2d7d7511da076b6faf092 | [
"MIT"
] | null | null | null | RestKit-Syndicate/Source/RKSMapper.h | DZamataev/RestKit-Syndicate | 2dfc843d8828b051cdd2d7d7511da076b6faf092 | [
"MIT"
] | null | null | null | RestKit-Syndicate/Source/RKSMapper.h | DZamataev/RestKit-Syndicate | 2dfc843d8828b051cdd2d7d7511da076b6faf092 | [
"MIT"
] | 2 | 2016-07-21T07:16:51.000Z | 2019-07-27T08:39:39.000Z | //
// RKSMapper.h
// RestKit-Syndicate
//
// Created by Denis Zamataev on 2/18/14.
// Copyright (c) 2014 DZamataev. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <RestKit/CoreData.h>
#import <RestKit.h>
@class RKSFeed, RKSChannel, RKSItem, RKSImage;
typedef enum { RKSFeedTypeRSS20 } RKSFeedType ;
@interface RKSMapper : NSObject
+ (RKEntityMapping*)entityMappingForFeedType:(RKSFeedType)feedType inManagedObjectStore:(RKManagedObjectStore*)store;
@end
| 24.05 | 117 | 0.758836 |
0aa394d4dd47de9c4d2078183cab4f6b52f38ac5 | 5,099 | c | C | d/atoyatl/tecqumin/rooms/step_high.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-07-19T05:24:44.000Z | 2021-11-18T04:08:19.000Z | d/atoyatl/tecqumin/rooms/step_high.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 4 | 2021-03-15T18:56:39.000Z | 2021-08-17T17:08:22.000Z | d/atoyatl/tecqumin/rooms/step_high.c | Dbevan/SunderingShadows | 6c15ec56cef43c36361899bae6dc08d0ee907304 | [
"MIT"
] | 13 | 2019-09-12T06:22:38.000Z | 2022-01-31T01:15:12.000Z | #include <std.h>
#include <move.h>
#include "../tecqumin.h"
inherit ROOM;
string long_desc();
void create() {
::create();
set_indoors(0);
set_property("light", 2);
set_terrain(GRASSLANDS);
set_travel(FOOT_PATH);
set_name("Near the top of a staircase on the side of a ziggurat");
set_short("Near the top of a staircase on the side of a ziggurat");
set_long( (:TO, "long_desc":) );
set("night long",(:TO, "night_desc":));
set_items(([ "ziggurat": "The ziggurat rises out of the jungle like a mountain, its stepped sides climbing tier by tier until it breaks through the upper canopy to reach the sky. There appears to be some kind of additional structure right at the top.",
({"step", "steps", "staircase"}): "The steps are carved from the same stones as the rest of the ziggurat, in smaller blocks to make it possible to walk up them. Despite the shared origin, the stones of the staircase are a noticeably different hue to the rest of the ziggurat. Something, over the years seems to have stained them an odd orangey brown. They are adorned with carved motifs",
({"stonework", "motif", "motifs", "carved motif", "carved motifs"}):"The stones on either side of the"
+" staircase are decorated with intricately linked carvings and"
+" sculptures. They carry images of a sun god, and of the ziggurat itself",
({"sun", "sun deity", "sun god", "sun motif", "sun god motif", "sun deity motif"}):(:TO, "sun_desc" :),
({"ziggurat motif", "ziggurat itself"}):(:TO, "zig_desc" :)
]));
set_smell("default","The scent of the jungle reaches you");
set_listen("default","The souds of the jungle are all there is to be"
+" heard.");
}
void init() {
::init();
}
string query_path(){
return ROOMS;
}
string query_name(){
return base_name(TO)[strlen(ROOMS)..strlen(base_name(TO))-1];
}
string long_desc(){
return "%^ORANGE%^You stand on near the top of the broad staircase"
+" leading up the side of the ziggurat. A glance down at the ground"
+" tells you you must be more than a hundred feet up. The%^BOLD%^"
+" %^CYAN%^s%^BLUE%^k%^CYAN%^y%^RESET%^%^ORANGE%^ opens up above"
+" you, breathtaking in its scale compared to the enclosed spaces"
+" you have emerged from. Below you, they unfettered tangle of the"
+" %^GREEN%^jungle%^ORANGE%^ seems to go on for miles in all"
+" directions, broken only by the bare patches where traces of the"
+" ancient city still remain. A little way above, the ziggurat's"
+" zenith stands in splendid isolation. The stonework either side"
+" of the staircase is carved with motifs of some kind of sun deity,"
+" and images of the ziggurat itself.";
}
string night_desc(){
return "%^BLUE%^You stand on near the top of the broad"
+" %^ORANGE%^staircase%^BLUE%^ leading up the side of the"
+" ziggurat. The night sky swaddles you in %^BOLD%^"
+"%^BLACK%^darkness%^RESET%^%^BLUE%^, and the %^BOLD%^"
+"%^BLACK%^black silhouettes%^RESET%^%^BLUE%^ of the %^BOLD%^"
+"%^BLACK%^jungle's tangled shapes%^RESET%^%^BLUE%^ spread out"
+" for miles all around. You sense that the ziggurat's"
+" %^RESET%^zenith%^BLUE%^ is not far away.";
}
string sun_desc(){
string * str;
int i, count;
str = ({"%^YELLOW%^You see a carving of some form of sun deity.",
" @(/ ",
" #( / #& / # ",
" (( %/, / (%*// ",
" %#& // %%%& / @(*% ",
" %&@&/*%,(&/@. /(&%* ",
" ( (@@%/%@#*(@(@@( (*/ ",
" (//((/%&&(((,.#@@/ #/. ",
" , @*&%&&(%(#*#***@#// ,/((# ",
" @(%/(@%#/#%@(#%*,*,,*%@@@@%#& (#///(",
" (/(%&/**,**#%( ",
" // (#@%#&%&(@&/(( * ",
" (( (@#((((/&(/,(/%%.* ",
" &(# (.(/@#//( ,(** ",
" /&%&& #/ %(( /( %/ ",
" %# / //% * &/ ",
" (% ",
" *& ",
" *, ",
});
count = sizeof(str);
for (i=0;i<count;i++){
tell_object(TP, str[i]);
}
return "";
}
string zig_desc(){
string * str;
int i, count;
str = ({"%^BOLD%^%^BLUE%^You see a carving of the ziggurat itself. Some form of light or energy seems to be depicted radiating from the top",
"############### #\# | #/# #############",
"################ #\ | /# ##############",
"################# #\|/# ###############",
"--------------------X------------------",
"############## ,##,@|@.##. ############",
"############# ,##*/%%,,,,##. ##########",
"########### ,##@% ##,,,,@@##. ########",
"######### ,##%##.../%%..,.#@@##. ######",
"####### ,##%&%%.,,%#%&,.,....@@##. ####",
"##### ,##&&((#.,,%#%&&%,,,....,@@##. ##",
"### ,##(#%##..,.,&%&&%%%... ..,..@@##. ",
"# ,##&&*#(/......%&%((%#,.,..... ...@#.",
",###%(/&., ,,,,,(#(%#####. . . ....&@#",
});
count = sizeof(str);
for (i=0;i<count;i++){
tell_object(TP, str[i]);
}
return "";
}
| 39.835938 | 390 | 0.484997 |
50995df2d55bdf06664d71bfe01734d16c833d2f | 677 | h | C | ToolSelectionDialog.h | fyazici/LibrarySelectionTool | ef48b452aaa59efde500553f63c5bdc535830260 | [
"MIT"
] | null | null | null | ToolSelectionDialog.h | fyazici/LibrarySelectionTool | ef48b452aaa59efde500553f63c5bdc535830260 | [
"MIT"
] | null | null | null | ToolSelectionDialog.h | fyazici/LibrarySelectionTool | ef48b452aaa59efde500553f63c5bdc535830260 | [
"MIT"
] | null | null | null | //
// Created by fatih on 9/2/16.
//
#ifndef LIBRARYSELECTIONTOOL_TOOLSELECTIONDIALOG_H
#define LIBRARYSELECTIONTOOL_TOOLSELECTIONDIALOG_H
#include <wx/wx.h>
#include <vector>
#include <tuple>
#include "ListFileHelper.h"
#include "FileSelectionFrame.h"
#include "DuplicateDetectionFrame.h"
class ToolSelectionDialog : public wxFrame {
public:
ToolSelectionDialog();
enum ID : int {
BTN1,
BTN2
};
wxButton* mBtn1;
wxButton* mBtn2;
wxFrame* mCurrentFrame;
void OnToolClose(wxCloseEvent&);
void OnBtn1Click(wxCommandEvent&);
void OnBtn2Click(wxCommandEvent&);
};
#endif //LIBRARYSELECTIONTOOL_TOOLSELECTIONDIALOG_H
| 16.925 | 51 | 0.722304 |
9275810439b9908587a4dfe3ffae717e8f646691 | 1,082 | h | C | src/libraries/Si7021/Si7021.h | vlast3k/vThingCO2DualBeamOSHW | ebbeebdf1e7e0b62b3f989f85545867202121823 | [
"MIT"
] | 1 | 2017-05-22T11:42:11.000Z | 2017-05-22T11:42:11.000Z | src/libraries/Si7021/Si7021.h | vlast3k/vThingCO2DualBeamOSHW | ebbeebdf1e7e0b62b3f989f85545867202121823 | [
"MIT"
] | null | null | null | src/libraries/Si7021/Si7021.h | vlast3k/vThingCO2DualBeamOSHW | ebbeebdf1e7e0b62b3f989f85545867202121823 | [
"MIT"
] | null | null | null | #ifndef __SI7021_H__
#define __SI7021_H__
#include "Arduino.h"
class SI7021
{
public:
SI7021();
/* Main Functions */
void begin(int sda = 4, int scl = 5);
float readHumidity();
float readTemp();
float readTempPrev();
/* Resolution Functions */
void setHumidityRes(uint8_t res);
void setTempRes(uint8_t res);
uint8_t getHumidityRes();
uint8_t getTempRes();
/* Heater Functions */
void setHeater(uint8_t hBit);
uint8_t getHeater();
//void setHeaterPower(uint8_t hPow); // broken : register access problem
//uint8_t getHeaterPower(); // broken : register access problem
/* Device ID And Reset Functions */
uint16_t getDeviceID();
uint8_t getFirmwareVer();
uint8_t checkVDD();
void reset(uint8_t delayR = 15);
/* Conversion Functions */
uint16_t floatToInt(float FtoI);
float intToFloat(uint16_t ItoF);
float CtoF(float tempC);
float FtoC(float tempF);
private:
void writeRegister(uint8_t reg, uint8_t value);
uint8_t readRegister(uint8_t reg);
uint16_t readSensor(uint8_t reg);
};
#endif | 23.521739 | 75 | 0.691312 |
9299b36978eb3f01bfca8102e335c6faf4cba347 | 2,397 | h | C | twr/inc/twr_hc_sr04.h | janakj/bcf-sdk | 177ce40f2b9b353bc4efc0f1a6765823144ee1cc | [
"MIT"
] | 19 | 2017-11-03T13:54:37.000Z | 2019-12-13T12:46:28.000Z | twr/inc/twr_hc_sr04.h | janakj/bcf-sdk | 177ce40f2b9b353bc4efc0f1a6765823144ee1cc | [
"MIT"
] | 18 | 2017-11-14T08:35:53.000Z | 2019-07-22T11:36:24.000Z | twr/inc/twr_hc_sr04.h | janakj/bcf-sdk | 177ce40f2b9b353bc4efc0f1a6765823144ee1cc | [
"MIT"
] | 10 | 2017-11-07T19:46:29.000Z | 2020-04-25T14:46:32.000Z | #ifndef _TWR_HC_SR04_H
#define _TWR_HC_SR04_H
#include <twr_tick.h>
#include <twr_gpio.h>
#include <twr_scheduler.h>
//! @addtogroup twr_hc_sr04 twr_hc_sr04
//! @brief Driver for HC-SR04 ultrasonic range sensor
//! @{
typedef enum
{
//! @brief Error event
TWR_HC_SR04_EVENT_ERROR = 0,
//! @brief Update event
TWR_HC_SR04_EVENT_UPDATE = 1
} twr_hc_sr04_event_t;
typedef enum
{
TWR_HC_SR04_ECHO_P5 = TWR_GPIO_P5,
TWR_HC_SR04_ECHO_P8 = TWR_GPIO_P8,
} twr_hc_sr04_echo_t;
//! @brief HC-SR04 instance
typedef struct twr_hc_sr04_t twr_hc_sr04_t;
//! @cond
struct twr_hc_sr04_t
{
twr_scheduler_task_id_t _task_id_interval;
twr_scheduler_task_id_t _task_id_notify;
void (*_event_handler)(twr_hc_sr04_t *, twr_hc_sr04_event_t, void *);
void *_event_param;
twr_tick_t _update_interval;
bool _measurement_active;
bool _measurement_valid;
uint16_t _echo_duration;
twr_hc_sr04_echo_t _echo;
twr_gpio_channel_t _trig;
};
//! @endcond
//! @brief Initialize HC-SR04 for sensor module
//! @param[in] self Instance
void twr_hc_sr04_init_sensor_module(twr_hc_sr04_t *self);
//! @brief Initialize HC-SR04
//! @param[in] self Instance
//! @param[in] echo Pin
//! @param[in] trig Pin
void twr_hc_sr04_init(twr_hc_sr04_t *self, twr_gpio_channel_t trig, twr_hc_sr04_echo_t echo);
//! @brief Set callback function
//! @param[in] self Instance
//! @param[in] event_handler Function address
//! @param[in] event_param Optional event parameter (can be NULL)
void twr_hc_sr04_set_event_handler(twr_hc_sr04_t *self, void (*event_handler)(twr_hc_sr04_t *, twr_hc_sr04_event_t, void *), void *event_param);
//! @brief Set measurement interval
//! @param[in] self Instance
//! @param[in] interval Measurement interval
void twr_hc_sr04_set_update_interval(twr_hc_sr04_t *self, twr_tick_t interval);
//! @brief Start measurement manually
//! @param[in] self Instance
//! @return true On success
//! @return false When other measurement is in progress
bool twr_hc_sr04_measure(twr_hc_sr04_t *self);
//! @brief Get measured distance in millimeters
//! @param[in] self Instance
//! @param[out] millimeter Pointer to variable where result will be stored
//! @return true When value is valid
//! @return false When value is invalid
bool twr_hc_sr04_get_distance_millimeter(twr_hc_sr04_t *self, float *millimeter);
//! @}
#endif // _TWR_HC_SR04_H
| 25.231579 | 144 | 0.750521 |
daf9cc07a12ad6e368dc3b6d66e0cb32ac01b3e6 | 2,435 | h | C | WSEExternal/include/Common/SceneData/Attributes/hkxSparselyAnimatedString.h | Swyter/wse | 3ad901f1a463139b320c30ea08bdc343358ea6b6 | [
"WTFPL"
] | null | null | null | WSEExternal/include/Common/SceneData/Attributes/hkxSparselyAnimatedString.h | Swyter/wse | 3ad901f1a463139b320c30ea08bdc343358ea6b6 | [
"WTFPL"
] | null | null | null | WSEExternal/include/Common/SceneData/Attributes/hkxSparselyAnimatedString.h | Swyter/wse | 3ad901f1a463139b320c30ea08bdc343358ea6b6 | [
"WTFPL"
] | null | null | null | /*
*
* Confidential Information of Telekinesys Research Limited (t/a Havok). Not for disclosure or distribution without Havok's
* prior written consent. This software contains code, techniques and know-how which is confidential and proprietary to Havok.
* Level 2 and Level 3 source code contains trade secrets of Havok. Havok Software (C) Copyright 1999-2009 Telekinesys Research Limited t/a Havok. All Rights Reserved. Use of this software is subject to the terms of an end user license agreement.
*
*/
#ifndef HK_SCENEDATA_HKX_ANIMATED_STRING_H
#define HK_SCENEDATA_HKX_ANIMATED_STRING_H
extern const hkClass hkxSparselyAnimatedStringClass;
/// An hkxSparselyAnimatedString stores the values associated with an hkxAttribute of type string. The animation of values is stored as
/// pairs (time, value).
struct hkxSparselyAnimatedString
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SCENE_DATA, hkxSparselyAnimatedString );
HK_DECLARE_REFLECTION();
/// We put the string (char*) in a struct since char** would not be interpreted by the serialization as an array of strings.
struct StringType
{
HK_DECLARE_NONVIRTUAL_CLASS_ALLOCATOR( HK_MEMORY_CLASS_SCENE_DATA, hkxSparselyAnimatedString::StringType );
HK_DECLARE_REFLECTION();
char* m_string;
char* operator=(char* str)
{
m_string = str;
return m_string;
}
};
/// The array of string values. We put those string (char*) in a struct since char** would not be interpreted by the
/// serialization as an array of strings.
struct StringType* m_strings;
int m_numStrings;
/// The array of times associated with teach of the values in m_strings.
float* m_times;
int m_numTimes;
};
#endif // HK_SCENEDATA_HKX_ANIMATED_STRING_H
/*
* Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20090704)
*
* Confidential Information of Havok. (C) Copyright 1999-2009
* Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
* Logo, and the Havok buzzsaw logo are trademarks of Havok. Title, ownership
* rights, and intellectual property rights in the Havok software remain in
* Havok and/or its suppliers.
*
* Use of this software for evaluation purposes is subject to and indicates
* acceptance of the End User licence Agreement for this product. A copy of
* the license is included with this software and is also available at www.havok.com/tryhavok.
*
*/
| 38.650794 | 247 | 0.754825 |
1f1da9b749eceddf6fa00f7167fa08ec315b274c | 3,707 | h | C | headers/private/kernel/disk_device_manager/KDiskSystem.h | Kirishikesan/haiku | 835565c55830f2dab01e6e332cc7e2d9c015b51e | [
"MIT"
] | 1,338 | 2015-01-03T20:06:56.000Z | 2022-03-26T13:49:54.000Z | headers/private/kernel/disk_device_manager/KDiskSystem.h | Kirishikesan/haiku | 835565c55830f2dab01e6e332cc7e2d9c015b51e | [
"MIT"
] | 15 | 2015-01-17T22:19:32.000Z | 2021-12-20T12:35:00.000Z | headers/private/kernel/disk_device_manager/KDiskSystem.h | Kirishikesan/haiku | 835565c55830f2dab01e6e332cc7e2d9c015b51e | [
"MIT"
] | 350 | 2015-01-08T14:15:27.000Z | 2022-03-21T18:14:35.000Z | /*
* Copyright 2003-2011, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <ingo_weinhold@gmx.de>
*/
#ifndef _K_DISK_DEVICE_SYSTEM_H
#define _K_DISK_DEVICE_SYSTEM_H
#include "disk_device_manager.h"
struct user_disk_system_info;
namespace BPrivate {
namespace DiskDevice {
class KPartition;
//! \brief Common ancestor for disk system add-on wrappers
class KDiskSystem {
public:
KDiskSystem(const char *name);
virtual ~KDiskSystem();
virtual status_t Init();
// void SetID(disk_system_id id);
disk_system_id ID() const;
const char* Name() const;
const char* ShortName() const;
const char* PrettyName() const;
uint32 Flags() const;
bool IsFileSystem() const;
bool IsPartitioningSystem() const;
void GetInfo(user_disk_system_info* info);
// manager will be locked
status_t Load(); // load/unload -- can be nested
void Unload(); //
bool IsLoaded() const;
// Scanning
// Device must be write locked.
virtual float Identify(KPartition* partition, void** cookie);
virtual status_t Scan(KPartition* partition, void* cookie);
virtual void FreeIdentifyCookie(KPartition* partition,
void* cookie);
virtual void FreeCookie(KPartition* partition);
virtual void FreeContentCookie(KPartition* partition);
// Writing
// Device should not be locked, but all affected partitions are marked
// busy, meaning that no one else is allowed to modify it (and we only,
// if we get a write lock).
virtual status_t Defragment(KPartition* partition,
disk_job_id job);
virtual status_t Repair(KPartition* partition, bool checkOnly,
disk_job_id job);
virtual status_t Resize(KPartition* partition, off_t size,
disk_job_id job);
virtual status_t ResizeChild(KPartition* child, off_t size,
disk_job_id job);
virtual status_t Move(KPartition* partition, off_t offset,
disk_job_id job);
virtual status_t MoveChild(KPartition* child, off_t offset,
disk_job_id job);
virtual status_t SetName(KPartition* partition, const char* name,
disk_job_id job);
virtual status_t SetContentName(KPartition* partition,
const char* name, disk_job_id job);
virtual status_t SetType(KPartition* partition, const char* type,
disk_job_id job);
virtual status_t SetParameters(KPartition* partition,
const char* parameters, disk_job_id job);
virtual status_t SetContentParameters(KPartition* partition,
const char* parameters, disk_job_id job);
virtual status_t Initialize(KPartition* partition,
const char* name, const char* parameters,
disk_job_id job);
virtual status_t Uninitialize(KPartition* partition,
disk_job_id job);
virtual status_t CreateChild(KPartition* partition, off_t offset,
off_t size, const char* type,
const char* name, const char* parameters,
disk_job_id job, KPartition** child = NULL,
partition_id childID = -1);
virtual status_t DeleteChild(KPartition* child, disk_job_id job);
protected:
virtual status_t LoadModule();
virtual void UnloadModule();
status_t SetShortName(const char* name);
status_t SetPrettyName(const char* name);
void SetFlags(uint32 flags);
static int32 _NextID();
private:
disk_system_id fID;
char* fName;
char* fShortName;
char* fPrettyName;
uint32 fFlags;
int32 fLoadCounter;
static int32 fNextID;
};
} // namespace DiskDevice
} // namespace BPrivate
using BPrivate::DiskDevice::KDiskSystem;
#endif // _K_DISK_DEVICE_SYSTEM_H
| 28.960938 | 72 | 0.702185 |
1f7372f3cf23ea379f84d090ccf30983befc2951 | 936 | h | C | DriveFusion/PathInfo.h | JadeTheFlame/google-drive-shell-extension | 917ada8e1a173e43e637db980ac4b9976a34acf9 | [
"Apache-2.0"
] | 155 | 2015-03-25T22:09:37.000Z | 2022-03-07T14:51:31.000Z | DriveFusion/PathInfo.h | Jason-Cooke/google-drive-shell-extension | 917ada8e1a173e43e637db980ac4b9976a34acf9 | [
"Apache-2.0"
] | 13 | 2015-04-01T17:51:45.000Z | 2021-08-21T13:36:39.000Z | DriveFusion/PathInfo.h | Jason-Cooke/google-drive-shell-extension | 917ada8e1a173e43e637db980ac4b9976a34acf9 | [
"Apache-2.0"
] | 73 | 2015-03-26T02:21:54.000Z | 2022-03-26T10:22:46.000Z | /*
Copyright 2014 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.
*/
#pragma once
class PathInfo
{
protected:
PathInfo(void);
~PathInfo(void);
public:
static bool FileExists(const std::wstring& path);
static std::wstring CombinePath(const std::wstring& path1, const std::wstring& path2);
static std::wstring GetFileUrl(const std::wstring& path);
static void CreatePath(const std::wstring& path, size_t last = std::wstring::npos);
};
| 30.193548 | 88 | 0.762821 |
50dabab4748e978d3e860ad7ea7fa8f99d36e0e2 | 216 | c | C | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/cast-qual-3.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 7 | 2020-05-02T17:34:05.000Z | 2021-10-17T10:15:18.000Z | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/cast-qual-3.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | null | null | null | gcc-gcc-7_3_0-release/gcc/testsuite/gcc.dg/cast-qual-3.c | best08618/asylo | 5a520a9f5c461ede0f32acc284017b737a43898c | [
"Apache-2.0"
] | 2 | 2020-07-27T00:22:36.000Z | 2021-04-01T09:41:02.000Z | /* PR 55383 */
/* { dg-do compile } */
/* { dg-options "-Wcast-qual" } */
void set(void*);
int foo(int argc)
{
volatile double val;
set((void*)&val); /* { dg-warning "cast discards .volatile. qualifier" } */
}
| 18 | 77 | 0.578704 |
1ca32b22f8690cc02599ed1b2b4f9ccbd1e2b1c3 | 342 | c | C | data/source/yaltools/mount_handle/includes-start.c | libyal/libyal | 407e4710c9c11000dc45427d72bbdbdc2861c51a | [
"Apache-2.0"
] | 176 | 2015-01-11T01:57:37.000Z | 2022-03-30T05:31:33.000Z | data/source/yaltools/mount_handle/includes-start.c | libyal/libyal | 407e4710c9c11000dc45427d72bbdbdc2861c51a | [
"Apache-2.0"
] | 79 | 2015-01-07T19:05:32.000Z | 2022-01-25T15:19:29.000Z | data/source/yaltools/mount_handle/includes-start.c | libyal/libyal | 407e4710c9c11000dc45427d72bbdbdc2861c51a | [
"Apache-2.0"
] | 25 | 2015-07-16T13:29:00.000Z | 2022-02-12T08:15:19.000Z | #include <common.h>
#include <memory.h>
#include <narrow_string.h>
#include <system_string.h>
#include <types.h>
#include <wide_string.h>
#include "${tools_name}_${library_name}.h"
#include "${tools_name}_libcerror.h"
#include "${tools_name}_libcpath.h"
#include "mount_file_entry.h"
#include "mount_file_system.h"
#include "mount_handle.h"
| 24.428571 | 42 | 0.751462 |
97e0e221e3feb0e82e578b41256f86cfbe17c5be | 3,652 | h | C | Development/External/Novodex/Physics/include/NxInertiaTensor.h | addstone/unrealengine3 | 4579d360dfd52b12493292120b27bb430f978fc8 | [
"FSFAP"
] | 37 | 2020-05-22T18:18:47.000Z | 2022-03-19T06:51:54.000Z | Development/External/Novodex/Physics/include/NxInertiaTensor.h | AdanosGotoman/unrealengine3 | 4579d360dfd52b12493292120b27bb430f978fc8 | [
"FSFAP"
] | null | null | null | Development/External/Novodex/Physics/include/NxInertiaTensor.h | AdanosGotoman/unrealengine3 | 4579d360dfd52b12493292120b27bb430f978fc8 | [
"FSFAP"
] | 27 | 2020-05-17T01:03:30.000Z | 2022-03-06T19:10:14.000Z | #ifndef NX_PHYSICS_NXINERTIATENSOR
#define NX_PHYSICS_NXINERTIATENSOR
/*----------------------------------------------------------------------------*\
|
| Public Interface to NovodeX Technology
|
| www.novodex.com
|
\*----------------------------------------------------------------------------*/
#include "Nxp.h"
/**
Computes mass of a homogeneous sphere according to sphere density.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeSphereMass (NxReal radius, NxReal density);
/**
Computes density of a homogeneous sphere according to sphere mass.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeSphereDensity (NxReal radius, NxReal mass);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
Computes mass of a homogeneous box according to box density.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeBoxMass (const NxVec3& extents, NxReal density);
/**
Computes density of a homogeneous box according to box mass.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeBoxDensity (const NxVec3& extents, NxReal mass);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
Computes mass of a homogeneous ellipsoid according to ellipsoid density.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeEllipsoidMass (const NxVec3& extents, NxReal density);
/**
Computes density of a homogeneous ellipsoid according to ellipsoid mass.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeEllipsoidDensity (const NxVec3& extents, NxReal mass);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
Computes mass of a homogeneous cylinder according to cylinder density.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeCylinderMass (NxReal radius, NxReal length, NxReal density);
/**
Computes density of a homogeneous cylinder according to cylinder mass.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeCylinderDensity (NxReal radius, NxReal length, NxReal mass);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
Computes mass of a homogeneous cone according to cone density.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeConeMass (NxReal radius, NxReal length, NxReal density);
/**
Computes density of a homogeneous cone according to cone mass.
*/
NX_C_EXPORT NXP_DLL_EXPORT NxReal NX_CALL_CONV NxComputeConeDensity (NxReal radius, NxReal length, NxReal mass);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
Computes diagonalized inertia tensor for a box.
*/
NX_C_EXPORT NXP_DLL_EXPORT void NX_CALL_CONV NxComputeBoxInertiaTensor (NxVec3& diagInertia, NxReal mass, NxReal xlength, NxReal ylength, NxReal zlength);
/**
Computes diagonalized inertia tensor for a sphere.
*/
NX_C_EXPORT NXP_DLL_EXPORT void NX_CALL_CONV NxComputeSphereInertiaTensor(NxVec3& diagInertia, NxReal mass, NxReal radius, bool hollow);
#endif
| 46.820513 | 200 | 0.53724 |
de1b621e7333dd94fb82704fcb9800c51aca9524 | 1,855 | h | C | Software/Core/Inc/keypad.h | jay-hamlin/rpncalculator | 09969f861a7241d3824ec30478070f37ff2fb4d2 | [
"MIT"
] | 1 | 2021-10-02T03:49:32.000Z | 2021-10-02T03:49:32.000Z | Software/Core/Inc/keypad.h | jay-hamlin/rpncalculator | 09969f861a7241d3824ec30478070f37ff2fb4d2 | [
"MIT"
] | null | null | null | Software/Core/Inc/keypad.h | jay-hamlin/rpncalculator | 09969f861a7241d3824ec30478070f37ff2fb4d2 | [
"MIT"
] | null | null | null |
#ifndef INC_KEYPAD_H_
#define INC_KEYPAD_H_
// Now defines for the Keyboard.
// The keyboard uses a TCA8418 keypad scann IC.
// It is on I2C bus 1 with an address of 0x68
// The INT output of the '8418 connects to MCU GPIO PA10
// The /RST input connects to MCU GPIO PA9
#define TCA8418_ADDR 0x68 // 0110 100r
#define TCA_REG_CFG 0x01 // Configuration register
#define TCA_REG_INT_STAT 0x02 // Key Interrupt status
#define TCA_REG_LCK_EC 0x03 // Key event counter
#define TCA_REG_EVENT_A 0x04 // Key event register A
#define TCA_REG_KP_GPIO1 0x1D // keypad or gpio (o=gpio, 1=keypad)
#define TCA_REG_KP_GPIO2 0x1E // keypad or gpio (o=gpio, 1=keypad)
#define TCA_REG_KP_GPIO3 0x1F // keypad or gpio (o=gpio, 1=keypad)
// Key codes - these are decimal values.
// Read datasheet page 16, 8,3,1,3 for how to read.
// Bit 7 is set for a KEYDOWN event and cleared for a KEYUP event.
enum {
KEY_BASE = 41,
KEY_DSP = 42,
KEY_C = 43,
KEY_D = 44,
KEY_E = 45,
KEY_F = 46,
KEY_DIV = 47,
KEY_SEND = 31,
KEY_CHS = 32,
KEY_B = 33,
KEY_7 = 34,
KEY_8 = 35,
KEY_9 = 36,
KEY_X = 37,
KEY_COPY = 21,
KEY_ROL = 22,
KEY_A = 23,
KEY_4 = 24,
KEY_5 = 25,
KEY_6 = 26,
KEY_MINUS = 27,
KEY_PASTE = 11,
KEY_X_Y = 12,
KEY_MOD = 13,
KEY_1 = 14,
KEY_2 = 15,
KEY_3 = 16,
KEY_PLUS = 17,
KEY_FUNC = 1,
KEY_CLX = 2,
KEY_DEL = 3,
KEY_0 = 4,
KEY_DP = 5,
KEY_ENTER = 7,
KEY_PWR_ON_OFF = 88 // this one is on gpio B pin 12
};
#define KEYDOWN_EVENT 0x80
// Exported prototypes for keyboard
void KeyboardInitialize(void);
uint8_t ReadKeypad(void);
#endif /* INC_KEYPAD_H_ */
| 26.5 | 67 | 0.591375 |
6ed1b0729225f026699271a780d9e8e7fc324a80 | 12,956 | h | C | src/storage/gstor/zekernel/kernel/buffer/knl_buffer.h | opengauss-mirror/DCC | b32ae696df92d2d1d7d261de0153acaa34080588 | [
"MulanPSL-1.0"
] | null | null | null | src/storage/gstor/zekernel/kernel/buffer/knl_buffer.h | opengauss-mirror/DCC | b32ae696df92d2d1d7d261de0153acaa34080588 | [
"MulanPSL-1.0"
] | null | null | null | src/storage/gstor/zekernel/kernel/buffer/knl_buffer.h | opengauss-mirror/DCC | b32ae696df92d2d1d7d261de0153acaa34080588 | [
"MulanPSL-1.0"
] | null | null | null | /*
* Copyright (c) 2022 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* -------------------------------------------------------------------------
*
* knl_buffer.h
* kernel buffer manager definitions
*
* IDENTIFICATION
* src/storage/gstor/zekernel/kernel/buffer/knl_buffer.h
*
* -------------------------------------------------------------------------
*/
#ifndef __KNL_BUFFER_H__
#define __KNL_BUFFER_H__
#include "cm_defs.h"
#include "cm_hash.h"
#include "knl_common.h"
#include "knl_interface.h"
#include "knl_log.h"
#include "knl_page.h"
#include "knl_session.h"
#ifdef __cplusplus
extern "C" {
#endif
#define ENTER_PAGE_NORMAL (uint8)0x00 // normal access for single page
#define ENTER_PAGE_RESIDENT (uint8)0x01 // resident in memory, not in LRU
#define ENTER_PAGE_PINNED (uint8)0x02 // temp pinned for undo rollback
#define ENTER_PAGE_NO_READ (uint8)0x04 // don't read from disk,caller will initialize
#define ENTER_PAGE_TRY (uint8)0x08 // try to read from buffer, don't read from disk
#define ENTER_PAGE_SEQUENTIAL (uint8)0x10 // for situation like table full scan to descrease impact on buffer
#define ENTER_PAGE_HIGH_AGE (uint8)0x20 // decrease possibility to be recycled of page
#define RD_ENTER_PAGE_MASK (~(ENTER_PAGE_PINNED | ENTER_PAGE_NO_READ | ENTER_PAGE_TRY | ENTER_PAGE_RESIDENT))
#define BUF_IS_RESIDENT(ctrl) ((ctrl)->is_resident)
#define BUF_IN_USE(ctrl) ((ctrl)->ref_num > 0)
#define BUF_IS_HOT(ctrl) ((ctrl)->touch_number >= BUF_TCH_AGE)
#define BUF_CAN_EXPIRE_PAGE(ctrl) (!(ctrl)->is_pinned && !(ctrl)->is_dirty && !(ctrl)->is_marked && !BUF_IN_USE(ctrl))
#define BUF_CAN_EXPIRE_CACHE(ctrl) (BUF_CAN_EXPIRE_PAGE(ctrl) && !(ctrl)->is_resident)
#define BUF_CAN_EVICT(ctrl) (BUF_CAN_EXPIRE_CACHE(ctrl) && !BUF_IS_HOT(ctrl))
#define BUF_ON_LIST(ctrl) ((ctrl)->prev != NULL || (ctrl)->next != NULL)
#define FILE_COMPRESS_START_PAGE 0
#define PAGE_IS_COMPRESS_HEAD(page_id) ((((page_id).page) - FILE_COMPRESS_START_PAGE) % PAGE_GROUP_COUNT == 0)
#define BUF_IS_COMPRESS(ctrl) ((ctrl)->compress_group[0] != NULL)
#define BUF_UNPIN(ctrl) \
{ \
(ctrl)->is_pinned = 0; \
}
#define BUF_GET_BUCKET(buf, id) (&(buf)->buckets[(id)])
#define BUF_ACCESS_WINDOW 3000000 // us, increase buf_ctrl_t::touch_number if access interval > BUF_ACCESS_WINDOW
#define BUF_TCH_AGE 3 // consider buffer is hot if its touch_number >= BUF_TCH_AGE
#define BUF_LRU_OLD_RATIO 0.6 // the position of LRU old list pointer in the LRU list
#define BUF_MAX_PREFETCH_NUM (uint32)128 // prefetch at most BUF_MAX_PREFETCH_NUM pages
#define BUF_PREFETCH_UNIT 8
#define UNDO_PREFETCH_NUM 64
#define BUF_LRU_OLD_TOLERANCE 256 // adjust LRU old list pointer if the distance from OLD RATION > BUF_LRU_OLD_TOLERANCE
#define BUF_LRU_OLD_MIN_LEN 65536 // use LRU old list if >= BUF_LRU_OLD_MIN_LEN buffer pages in memory
#define BUF_LRU_STATS_LEN 1024 // full scan LRU list len
#define BUF_POOL_SIZE_THRESHOLD (((uint64)SIZE_M(1024)) * 1) // if total/buf_pool_num < 1G, then use one buffer pool
#define BUCKET_TIMES 3 // the times of buckets against buffer ctrl
#define BUF_IOCBS_MAX_NUM 1024
#define BUF_CTRL_PER_IOCB 128
#define BUF_CURR_OPTIONS(session) ((session)->page_stack.options[(session)->page_stack.depth - 1])
#define BUF_LRU_SEARCH_THRESHOLD(set) ((set)->capacity * 60 / 100)
#define BUF_AGE_DECREASE_FACTOR 2
#define BUF_BALANCE_RATIO 0.5
#define BUF_NEED_BALANCE(set) ((set)->scan_list.count < (uint32)((set)->main_list.count * BUF_BALANCE_RATIO))
#define BUF_OPTIMIZE_MIN_PAGES 131072 // use scan list only when buffer set size less than 1G
#define PAGE_GROUP_COUNT 8
#define MAX_PCB_VM_COUNT 8192 // GS_MAX_TAB_COMPRESS_BUF_SIZE(1G) / 128k (vm page size)
extern uint32 g_cks_level;
typedef enum en_buf_add_pos {
BUF_ADD_HOT = 0,
BUF_ADD_OLD = 1,
BUF_ADD_COLD = 2,
} buf_add_pos_t;
typedef enum en_buf_lru_list_type {
LRU_LIST_MAIN = 0,
LRU_LIST_SCAN = 1,
LRU_LIST_WRITE = 2,
LRU_LIST_TYPE_COUNT,
} buf_lru_list_type_t;
typedef enum en_buf_load_status {
BUF_NEED_LOAD = 0,
BUF_IS_LOADED = 1,
BUF_LOAD_FAILED = 2,
} buf_load_status_t;
typedef struct st_buf_latch {
volatile uint16 shared_count;
volatile uint16 stat;
volatile uint16 sid; // the first session latched buffer, less than GS_MAX_SESSIONS(8192)
volatile uint16 xsid; // the last session exclusively latched buffer, less than GS_MAX_SESSIONS(8192)
} buf_latch_t;
typedef enum en_buf_expire_type {
BUF_EVICT = 0,
BUF_EXPIRE_PAGE,
BUF_EXPIRE_CACHE,
} buf_expire_type_t;
struct st_buf_gbp_ctrl;
#ifdef WIN32
typedef struct st_buf_ctrl
#else
typedef struct __attribute__((aligned(128))) st_buf_ctrl
#endif
{
buf_latch_t latch; // for page operations
uint32 bucket_id; // the cache id of the bucket
volatile uint8 is_resident; // resident buffer not in LRU queue
volatile uint8 is_pinned; // pinned buffer in LRU queue
volatile uint8 is_readonly;
volatile uint8 is_dirty;
volatile uint8 is_marked;
volatile uint8 load_status;
volatile uint8 in_old;
volatile uint8 list_id;
volatile uint8 buf_pool_id;
volatile uint8 in_ckpt;
volatile uint8 aligned;
volatile uint16 ref_num;
volatile uint16 touch_number; // touch number for LRU
page_id_t page_id;
date_t access_time; // last access time
log_point_t trunc_point;
uint64 lastest_lfn;
struct st_buf_gbp_ctrl *gbp_ctrl;
struct st_buf_ctrl *ckpt_prev;
struct st_buf_ctrl *ckpt_next;
struct st_buf_ctrl *prev; // for LRU queue or free control list
struct st_buf_ctrl *next; // for LRU queue or free control list
struct st_buf_ctrl *hash_next; // next cache id in the same bucket
page_head_t *page;
struct st_buf_ctrl *compress_group[PAGE_GROUP_COUNT];
} buf_ctrl_t;
typedef struct st_buf_gbp_ctrl {
volatile uint8 is_gbpdirty; // page need flush to gbp
volatile uint8 is_from_gbp; // page is read from gbp
volatile uint8 gbp_read_version; // curren version of gbp page, if version is expected, it is newest page
volatile uint8 page_status; // page status
log_point_t gbp_lrp_point; // gbp page lrp point
log_point_t gbp_trunc_point; // gbp dirty page trunc point
buf_ctrl_t *gbp_next; // next gbp dirty page
spinlock_t init_lock;
} buf_gbp_ctrl_t;
typedef struct st_buf_bucket {
spinlock_t lock;
uint32 count;
buf_ctrl_t *first;
} buf_bucket_t;
typedef struct st_buf_lru_list {
buf_ctrl_t *lru_first;
buf_ctrl_t *lru_last;
buf_ctrl_t *lru_old;
spinlock_t lock;
uint32 count; // buffer count in LRU queue
uint32 old_count; // old buffer in LRU list
uint8 type; // lru list type
} buf_lru_list_t;
typedef struct st_buf_set {
spinlock_t lock;
char *addr;
uint64 size;
cm_thread_cond_t set_cond;
uint32 capacity; // total page count
uint32 hwm; // high water mark
uint32 bucket_num; // total bucket count
uint32 padding;
buf_bucket_t *buckets; // bucket pool
buf_ctrl_t *ctrls; // page control pool
buf_gbp_ctrl_t *gbp_ctrls; // page gbp control pool
char *page_buf; // page buffer
union {
buf_lru_list_t list[LRU_LIST_TYPE_COUNT];
struct {
buf_lru_list_t main_list;
buf_lru_list_t scan_list;
buf_lru_list_t write_list;
};
};
} buf_set_t;
typedef struct st_buf_context {
buf_set_t buf_set[GS_MAX_BUF_POOL_NUM];
uint32 buf_set_count;
thread_lock_t buf_mutex;
} buf_context_t;
typedef struct st_buf_iocb {
cm_iocb_t iocb; // io control block of os
struct st_buf_iocb *next; // next buffer iocb
uint32 large_pool_id; // large pool page id managed by this iocb
page_id_t page_id; // first page id managed by this iocb
uint32 page_cnt; // buffer page count managed by this iocb
uint32 used; // buffer iocb is uesed or not
char *large_buf; // point to large pool buffer
knl_session_t *session; // session of prefetch
buf_ctrl_t *ctrls[BUF_CTRL_PER_IOCB]; // ctrls allocated for this iocb
}buf_iocb_t;
typedef struct st_knl_aio_iocbs {
spinlock_t lock;
uint32 count;
buf_iocb_t *iocbs;
buf_iocb_t *first;
buf_iocb_t *last;
} knl_aio_iocbs_t;
typedef struct st_buf_aio_ctx {
thread_t thread; // thread of async prefetch
cm_io_context_t io_ctx; // async io context of os, managing all iocbs
knl_aio_iocbs_t buf_aio_iocbs; // io control blocks
} buf_aio_ctx_t;
typedef struct st_compress_buf_ctrl {
volatile bool32 used;
vm_page_t *vm_page;
} compress_buf_ctrl_t;
typedef struct st_compress_buf_context {
spinlock_t lock;
compress_buf_ctrl_t com_bufs[MAX_PCB_VM_COUNT];
volatile uint32 opt_count;
} pcb_context_t;
typedef struct st_pcb_assist {
char *ori_buf;
char *aligned_buf;
uint32 buf_id;
bool32 from_vm;
} pcb_assist_t;
#pragma pack(4)
typedef struct st_rd_enter_page {
uint32 page;
uint16 file;
uint8 options;
uint8 pcn;
} rd_enter_page_t;
#pragma pack()
static const buf_lru_list_t g_init_list_t = {0};
static inline uint32 hash_page(uint32 h)
{
/* a hash algorithm */
h ^= (h >> 20) ^ (h >> 12);
return h ^ (h >> 7) ^ (h >> 4);
}
static inline uint32 buf_page_hash_value(page_id_t page_id)
{
/* better if file size < 256G, file count < 128 */
return hash_page((page_id.page & 0x1FFFFFF) | (((uint32)page_id.file & (uint32)0x7F) << 25));
}
static inline uint32 buf_get_pool_id(page_id_t page_id, uint32 buf_pool_num)
{
return buf_page_hash_value(page_id) % buf_pool_num;
}
static inline buf_ctrl_t *buf_find_from_bucket(buf_bucket_t *bucket, page_id_t page_id)
{
buf_ctrl_t *ctrl = bucket->first;
while (ctrl != NULL) {
if (IS_SAME_PAGID(ctrl->page_id, page_id)) {
return ctrl;
}
ctrl = ctrl->hash_next;
}
return NULL;
}
static inline void buf_add_to_bucket(buf_bucket_t *bucket, buf_ctrl_t *ctrl)
{
ctrl->hash_next = bucket->first;
bucket->first = ctrl;
bucket->count++;
}
static inline void buf_remove_from_bucket(buf_bucket_t *bucket, buf_ctrl_t *ctrl)
{
buf_ctrl_t *item = bucket->first;
if (item == ctrl) {
bucket->first = ctrl->hash_next;
} else {
while (item->hash_next != ctrl) {
item = item->hash_next;
}
item->hash_next = ctrl->hash_next;
}
/* if the count of bucket is zero, the function will not be called */
bucket->count--;
}
status_t buf_init(knl_session_t *session);
uint32 buf_expire_cache(knl_session_t *session, buf_set_t *ctx);
void buf_expire_page(knl_session_t *sessoin, page_id_t page_id);
buf_ctrl_t *buf_find_by_pageid(knl_session_t *session, page_id_t page_id);
buf_ctrl_t *buf_alloc_ctrl(knl_session_t *session, page_id_t page_id, latch_mode_t mode, uint32 options);
buf_ctrl_t *buf_try_alloc_ctrl(knl_session_t *session, page_id_t page_id, latch_mode_t mode, uint32 options,
buf_add_pos_t add_pos);
buf_ctrl_t *buf_alloc_compress(knl_session_t *session, page_id_t page_id, latch_mode_t mode, uint32 options);
buf_ctrl_t *buf_try_alloc_compress(knl_session_t *session, page_id_t page_id, latch_mode_t mode, uint32 options,
buf_add_pos_t add_pos);
void buf_lru_add_ctrl(buf_lru_list_t *list, buf_ctrl_t *ctrl, buf_add_pos_t pos);
void buf_stash_marked_page(buf_set_t *set, buf_lru_list_t *list, buf_ctrl_t *ctrl);
void buf_reset_cleaned_pages(buf_set_t *set, buf_lru_list_t *list);
void buf_balance_set_list(buf_set_t *set);
void buf_check_page_version(knl_session_t *session, buf_ctrl_t *ctrl);
bool32 buf_check_resident_page_version(knl_session_t *session, page_id_t pageid);
void buf_expire_datafile_pages(knl_session_t *session, uint32 file_id);
status_t pcb_get_buf(knl_session_t *session, pcb_assist_t *pcb_assist);
void pcb_release_buf(knl_session_t *session, pcb_assist_t *pcb_assist);
status_t pcb_init_ctx(knl_session_t *session);
#ifdef __cplusplus
}
#endif
#endif
| 35.790055 | 122 | 0.698209 |
877b245b1adc5844e433b52d8429af7bf59f0999 | 2,301 | h | C | pysnobal/c_snobal/h/bih.h | najsham/pysnobal | 0183b7aa2c99d915dc1b47d64ee2c30d6509e432 | [
"CC0-1.0"
] | 4 | 2018-09-11T17:14:06.000Z | 2021-08-09T20:22:29.000Z | pysnobal/c_snobal/h/bih.h | najsham/pysnobal | 0183b7aa2c99d915dc1b47d64ee2c30d6509e432 | [
"CC0-1.0"
] | 16 | 2017-11-17T22:52:14.000Z | 2021-02-10T02:04:47.000Z | pysnobal/c_snobal/h/bih.h | najsham/pysnobal | 0183b7aa2c99d915dc1b47d64ee2c30d6509e432 | [
"CC0-1.0"
] | 2 | 2020-03-02T17:23:48.000Z | 2022-02-23T19:28:50.000Z | #ifndef BIH_H
#define BIH_H
/*
* basic image header
*/
/* ------------------------------------------------------------------------ */
typedef struct {
char *byteorder; /* byte order */
int nlines; /* # lines */
int nsamps; /* # samples / line */
int nbands; /* # bands */
} BIHI_T;
#define BIHI_HNAME "basic_image_i" /* per-image component name */
typedef struct {
BIHI_T *img; /* -> per-image component */
int nbytes; /* # bytes / pixel */
int nbits; /* # bits / pixel */
STRVEC_T *history; /* -> processing history strings */
STRVEC_T *annot; /* -> annotation strings */
} BIH_T;
#define BIH_HNAME "basic_image" /* header name within IPW */
#define BIH_VERSION "$Revision: 1.11 $" /* RCS revsion # */
/* field keywords */
#define BIH_BYTEORDER "byteorder"
#define BIH_NLINES "nlines"
#define BIH_NSAMPS "nsamps"
#define BIH_NBANDS "nbands"
#define BIH_NBYTES "bytes"
#define BIH_NBITS "bits"
#define BIH_HISTORY "history"
#define BIH_ANNOT "annot"
/* field access macros */
#define bih_byteorder(p) ( (p)->img->byteorder )
#define bih_nlines(p) ( (p)->img->nlines )
#define bih_nsamps(p) ( (p)->img->nsamps )
#define bih_nbands(p) ( (p)->img->nbands )
#define bih_nbytes(p) ( (p)->nbytes )
#define bih_nbits(p) ( (p)->nbits )
#define bih_history(p) ( (p)->history )
#define bih_annot(p) ( (p)->annot )
/* ------------------------------------------------------------------------ */
extern char * o_byteorder;
/* ------------------------------------------------------------------------ */
extern BIH_T ** bih(int fd);
extern BIH_T ** bihdup(BIH_T **oldhpp);
extern BIH_T * bihmake(int nbytes, int nbits, STRVEC_T *history,
STRVEC_T *annot, BIH_T *oldp, int nlines,
int nsamps, int nbands);
extern BIH_T ** bihread(int fd);
extern int bihwrite(int fd, BIH_T **bihpp);
extern char * hbyteorder(int fd);
extern int hnbands(int fd);
extern int hnbits(int fd, int band);
extern int hnbytes(int fd, int band);
extern int hnlines(int fd);
extern int hnsamps(int fd);
extern char * hostorder(void);
extern long imgsize(int fd);
extern void no_history(int fd);
extern int sampsize(int fd);
#endif
| 30.68 | 78 | 0.559322 |
0c67221528459d6b8f1f5002e74eae95dd16ebfb | 4,654 | h | C | UWP/RadialDevice/winrt/internal/Windows.Perception.Spatial.3.h | megayuchi/RadialController | 87bb1baa72a0b43b1b7b0d7787b0a93edc7e3175 | [
"MIT"
] | 23 | 2016-11-28T05:47:06.000Z | 2020-11-13T20:13:47.000Z | UWP/RadialDevice/winrt/internal/Windows.Perception.Spatial.3.h | megayuchi/RadialController | 87bb1baa72a0b43b1b7b0d7787b0a93edc7e3175 | [
"MIT"
] | null | null | null | UWP/RadialDevice/winrt/internal/Windows.Perception.Spatial.3.h | megayuchi/RadialController | 87bb1baa72a0b43b1b7b0d7787b0a93edc7e3175 | [
"MIT"
] | 5 | 2017-01-21T14:42:47.000Z | 2022-02-24T03:42:24.000Z | // C++ for the Windows Runtime v1.0.161012.5
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
#pragma once
#include "Windows.Perception.Spatial.2.h"
WINRT_EXPORT namespace winrt {
namespace Windows::Perception::Spatial {
struct WINRT_EBO SpatialAnchor :
Windows::Perception::Spatial::ISpatialAnchor,
impl::require<SpatialAnchor, Windows::Perception::Spatial::ISpatialAnchor2>
{
SpatialAnchor(std::nullptr_t) noexcept {}
static Windows::Perception::Spatial::SpatialAnchor TryCreateRelativeTo(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem);
static Windows::Perception::Spatial::SpatialAnchor TryCreateRelativeTo(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem, const Windows::Foundation::Numerics::float3 & position);
static Windows::Perception::Spatial::SpatialAnchor TryCreateRelativeTo(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem, const Windows::Foundation::Numerics::float3 & position, const Windows::Foundation::Numerics::quaternion & orientation);
};
struct SpatialAnchorManager
{
SpatialAnchorManager() = delete;
static Windows::Foundation::IAsyncOperation<Windows::Perception::Spatial::SpatialAnchorStore> RequestStoreAsync();
};
struct WINRT_EBO SpatialAnchorRawCoordinateSystemAdjustedEventArgs :
Windows::Perception::Spatial::ISpatialAnchorRawCoordinateSystemAdjustedEventArgs
{
SpatialAnchorRawCoordinateSystemAdjustedEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO SpatialAnchorStore :
Windows::Perception::Spatial::ISpatialAnchorStore
{
SpatialAnchorStore(std::nullptr_t) noexcept {}
};
struct SpatialAnchorTransferManager
{
SpatialAnchorTransferManager() = delete;
static Windows::Foundation::IAsyncOperation<Windows::Foundation::Collections::IMapView<hstring, Windows::Perception::Spatial::SpatialAnchor>> TryImportAnchorsAsync(const Windows::Storage::Streams::IInputStream & stream);
static Windows::Foundation::IAsyncOperation<bool> TryExportAnchorsAsync(const Windows::Foundation::Collections::IIterable<Windows::Foundation::Collections::IKeyValuePair<hstring, Windows::Perception::Spatial::SpatialAnchor>> & anchors, const Windows::Storage::Streams::IOutputStream & stream);
static Windows::Foundation::IAsyncOperation<winrt::Windows::Perception::Spatial::SpatialPerceptionAccessStatus> RequestAccessAsync();
};
struct WINRT_EBO SpatialBoundingVolume :
Windows::Perception::Spatial::ISpatialBoundingVolume
{
SpatialBoundingVolume(std::nullptr_t) noexcept {}
static Windows::Perception::Spatial::SpatialBoundingVolume FromBox(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem, const Windows::Perception::Spatial::SpatialBoundingBox & box);
static Windows::Perception::Spatial::SpatialBoundingVolume FromOrientedBox(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem, const Windows::Perception::Spatial::SpatialBoundingOrientedBox & box);
static Windows::Perception::Spatial::SpatialBoundingVolume FromSphere(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem, const Windows::Perception::Spatial::SpatialBoundingSphere & sphere);
static Windows::Perception::Spatial::SpatialBoundingVolume FromFrustum(const Windows::Perception::Spatial::SpatialCoordinateSystem & coordinateSystem, const Windows::Perception::Spatial::SpatialBoundingFrustum & frustum);
};
struct WINRT_EBO SpatialCoordinateSystem :
Windows::Perception::Spatial::ISpatialCoordinateSystem
{
SpatialCoordinateSystem(std::nullptr_t) noexcept {}
};
struct WINRT_EBO SpatialLocation :
Windows::Perception::Spatial::ISpatialLocation
{
SpatialLocation(std::nullptr_t) noexcept {}
};
struct WINRT_EBO SpatialLocator :
Windows::Perception::Spatial::ISpatialLocator
{
SpatialLocator(std::nullptr_t) noexcept {}
static Windows::Perception::Spatial::SpatialLocator GetDefault();
};
struct WINRT_EBO SpatialLocatorAttachedFrameOfReference :
Windows::Perception::Spatial::ISpatialLocatorAttachedFrameOfReference
{
SpatialLocatorAttachedFrameOfReference(std::nullptr_t) noexcept {}
};
struct WINRT_EBO SpatialLocatorPositionalTrackingDeactivatingEventArgs :
Windows::Perception::Spatial::ISpatialLocatorPositionalTrackingDeactivatingEventArgs
{
SpatialLocatorPositionalTrackingDeactivatingEventArgs(std::nullptr_t) noexcept {}
};
struct WINRT_EBO SpatialStationaryFrameOfReference :
Windows::Perception::Spatial::ISpatialStationaryFrameOfReference
{
SpatialStationaryFrameOfReference(std::nullptr_t) noexcept {}
};
}
}
| 47.489796 | 297 | 0.807477 |
674d3356cc8b54b300f7a9f1f9ef1effe1757077 | 1,315 | h | C | keyboards/gboards/g/keymap_combo.h | fzf/qmk_toolbox | 10d6b425bd24b45002555022baf16fb11254118b | [
"MIT"
] | null | null | null | keyboards/gboards/g/keymap_combo.h | fzf/qmk_toolbox | 10d6b425bd24b45002555022baf16fb11254118b | [
"MIT"
] | null | null | null | keyboards/gboards/g/keymap_combo.h | fzf/qmk_toolbox | 10d6b425bd24b45002555022baf16fb11254118b | [
"MIT"
] | null | null | null | // Keymap helpers
#define K_ENUM(name, key, ...) name,
#define K_DATA(name, key, ...) const uint16_t PROGMEM cmb_##name[] = {__VA_ARGS__, COMBO_END};
#define K_COMB(name, key, ...) [name] = COMBO(cmb_##name, key),
#define A_ENUM(name, string, ...) name,
#define A_DATA(name, string, ...) const uint16_t PROGMEM cmb_##name[] = {__VA_ARGS__, COMBO_END};
#define A_COMB(name, string, ...) [name] = COMBO_ACTION(cmb_##name),
#define A_ACTI(name, string, ...) \
case name: \
if (pressed) SEND_STRING(string); \
break;
#define BLANK(...)
// Generate data needed for combos/actions
// Create Enum
#undef COMB
#undef SUBS
#define COMB K_ENUM
#define SUBS A_ENUM
enum combos {
#include "combos.def"
};
// Bake combos into mem
#undef COMB
#undef SUBS
#define COMB K_DATA
#define SUBS A_DATA
#include "combos.def"
#undef COMB
#undef SUBS
// Fill combo array
#define COMB K_COMB
#define SUBS A_COMB
combo_t key_combos[] = {
#include "combos.def"
};
#undef COMB
#undef SUBS
// Export length to combo module
int COMBO_LEN = sizeof(key_combos) / sizeof(key_combos[0]);
// Fill QMK hook
#define COMB BLANK
#define SUBS A_ACTI
void process_combo_event(uint8_t combo_index, bool pressed) {
switch (combo_index) {
#include "combos.def"
}
}
#undef COMB
#undef SUBS
| 23.070175 | 97 | 0.676046 |
8ca49d4224cda4c300ed78a465251d6ebf056bda | 338 | h | C | test-suite/generated-src/objc/DBMapListRecord.h | TechN8/djinni | cd628bdf4350f9ae0aa8384bdf506d1b62115845 | [
"Apache-2.0"
] | 1 | 2015-03-30T13:34:31.000Z | 2015-03-30T13:34:31.000Z | test-suite/generated-src/objc/DBMapListRecord.h | TechN8/djinni | cd628bdf4350f9ae0aa8384bdf506d1b62115845 | [
"Apache-2.0"
] | null | null | null | test-suite/generated-src/objc/DBMapListRecord.h | TechN8/djinni | cd628bdf4350f9ae0aa8384bdf506d1b62115845 | [
"Apache-2.0"
] | null | null | null | // AUTOGENERATED FILE - DO NOT MODIFY!
// This file generated by Djinni from map.djinni
#import <Foundation/Foundation.h>
@interface DBMapListRecord : NSObject
- (id)initWithMapListRecord:(DBMapListRecord *)mapListRecord;
- (id)initWithMapList:(NSMutableArray *)mapList;
@property (nonatomic, readonly) NSMutableArray *mapList;
@end
| 24.142857 | 61 | 0.778107 |
7b9a542979dfef186e2aab1b1e91405b5cea4f8c | 1,692 | h | C | src/gui/tabwidget.h | GavriloviciEduard/Asclepios-DICOM-Viewer | 2aeb90ae4fcbdfcf0fe1b714f31e2b1c8fd6a8ed | [
"MIT"
] | 55 | 2020-09-10T01:29:27.000Z | 2022-03-23T06:41:09.000Z | src/gui/tabwidget.h | GavriloviciEduard/Asclepios-DICOM-Viewer | 2aeb90ae4fcbdfcf0fe1b714f31e2b1c8fd6a8ed | [
"MIT"
] | 4 | 2020-09-10T01:25:07.000Z | 2022-03-22T02:34:39.000Z | src/gui/tabwidget.h | GavriloviciEduard/Asclepios-DICOM-Viewer | 2aeb90ae4fcbdfcf0fe1b714f31e2b1c8fd6a8ed | [
"MIT"
] | 16 | 2020-11-24T07:37:43.000Z | 2022-03-03T03:16:30.000Z | #pragma once
#include "ui_tabwidget.h"
#include "widgetbase.h"
namespace asclepios::gui
{
class Widget2D;
class TabWidget final : public QWidget
{
Q_OBJECT
public:
explicit TabWidget(QWidget* parent);
~TabWidget() = default;
void createWidget2D();
void createWidgetMPR3D(const WidgetBase::WidgetType& t_type);
void resetWidget();
//getters
[[nodiscard]] WidgetBase::WidgetType getWidgetType() const;
[[nodiscard]] WidgetBase* getTabbedWidget() const { return m_tabbedWidget; }
[[nodiscard]] WidgetBase* getActiveTabbedWidget() const;
[[nodiscard]] bool getIsActive() const { return m_isActive; }
[[nodiscard]] bool getIsMaximized() const { return m_isMaximized; }
//setters
void setIsActive(const bool& t_flag) { m_isActive = t_flag; }
void setIsMaximized(const bool& t_flag) { m_isMaximized = t_flag; }
void setTabTitle(const int& t_index, const QString& t_name) const;
public slots:
void onFocus(const bool& t_flag);
void onMaximize();
void closeWidget(const int& t_index) const;
signals:
void focused(TabWidget* t_widget);
void setMaximized(TabWidget* t_widget);
protected:
void focusInEvent(QFocusEvent* event) override;
void dragEnterEvent(QDragEnterEvent* event) override;
void dragLeaveEvent(QDragLeaveEvent* event) override;
void dropEvent(QDropEvent* event) override;
private:
Ui::TabWidget m_ui = {};
WidgetBase* m_tabbedWidget = {};
bool m_isActive = false;
bool m_isMaximized = false;
void populateWidget(core::Series* t_series, core::Image* t_image);
[[nodiscard]] std::tuple<core::Series*, core::Image*> getDropData(const QString& t_data);
[[nodiscard]] bool canCreateWidgetMPR3D() const;
};
}
| 29.172414 | 91 | 0.735225 |
f47293920dabc02e21dacc63ae1be50aa32e222c | 3,878 | h | C | gui/ctrl/textbox.h | r3dl3g/guipp | 3d3179be3022935b46b59f1b988a029abeabfcbf | [
"MIT"
] | null | null | null | gui/ctrl/textbox.h | r3dl3g/guipp | 3d3179be3022935b46b59f1b988a029abeabfcbf | [
"MIT"
] | null | null | null | gui/ctrl/textbox.h | r3dl3g/guipp | 3d3179be3022935b46b59f1b988a029abeabfcbf | [
"MIT"
] | null | null | null | /**
* @copyright (c) 2016-2021 Ing. Buero Rothfuss
* Riedlinger Str. 8
* 70327 Stuttgart
* Germany
* http://www.rothfuss-web.de
*
* @author <a href="mailto:armin@rothfuss-web.de">Armin Rothfuss</a>
*
* Project gui++ lib
*
* @brief multiline textbox control
*
* @license MIT license. See accompanying file LICENSE.
*/
#pragma once
// --------------------------------------------------------------------------
//
// Library includes
//
#include <gui/draw/font.h>
#include <gui/ctrl/control.h>
#include <gui/ctrl/look/textbox.h>
namespace gui {
namespace ctrl {
// --------------------------------------------------------------------------
namespace detail {
// --------------------------------------------------------------------------
class GUIPP_CTRL_EXPORT textbox_base : public colored_control {
public:
typedef colored_control super;
typedef win::no_erase_window_class<textbox_base, win::cursor_type::ibeam> clazz;
typedef std::vector<std::string> strings;
typedef strings::size_type size_type;
typedef core::basic_point<int> position;
typedef core::range<position> range;
using control::create;
void create (win::container& parent,
const core::rectangle& r = core::rectangle::def);
void create (win::container& parent,
const std::string& txt,
const core::rectangle& place = core::rectangle::def);
void set_text (const std::string&);
std::string get_text () const;
size_type row_count () const;
void set_scroll_pos (const core::point& pos);
void set_selection (const range&);
void set_cursor_pos (const position&, bool shift = false);
const core::point& get_scroll_pos () const;
const range& get_selection () const;
const position& get_cursor_pos () const;
void replace_selection (const std::string&);
std::string get_text_in_range (const range&) const;
std::string get_selected_text () const;
std::string cut_selected_text ();
core::rectangle get_virtual_geometry (const core::rectangle&) const;
core::size get_scroll_steps () const;
void make_selection_visible ();
position find_prev_word (const position& pos);
position find_next_word (const position& pos);
void set_font (const draw::font& f);
const draw::font& get_font () const;
protected:
position get_position_at_point (const core::point& pt, const text_origin_t origin_t) const;
void erase_lines (int first, int last);
void erase_line (int first);
void notify_content_changed ();
void enable_select_by_mouse (const text_origin_t origin_t);
struct data {
data ();
strings lines;
draw::font font;
core::point offset;
core::native_point last_mouse_point;
position cursor_pos;
range selection;
mutable core::size virtual_size;
} data;
};
} // namespace detail
// --------------------------------------------------------------------------
template<text_origin_t align = text_origin_t::vcenter_left,
draw::frame::drawer frame = draw::frame::no_frame>
class basic_textbox : public detail::textbox_base {
public:
typedef detail::textbox_base super;
basic_textbox ();
void enable_select_by_mouse ();
private:
void handle_paint (draw::graphics& graph);
};
// --------------------------------------------------------------------------
using textbox = basic_textbox<>;
} // ctrl
} // gui
#include <gui/ctrl/textbox.inl>
| 29.157895 | 99 | 0.547189 |
3c62fc73e1719aad12ead982362aacc7774c3c67 | 1,719 | h | C | chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86 | 2015-10-21T13:02:42.000Z | 2022-03-14T07:50:50.000Z | chrome/browser/safe_browsing/advanced_protection_status_manager_factory.h | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_SAFE_BROWSING_ADVANCED_PROTECTION_STATUS_MANAGER_FACTORY_H_
#define CHROME_BROWSER_SAFE_BROWSING_ADVANCED_PROTECTION_STATUS_MANAGER_FACTORY_H_
#include "base/memory/singleton.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
class Profile;
namespace safe_browsing {
class AdvancedProtectionStatusManager;
// Responsible for keeping track of advanced protection status of the sign-in
// profile.
class AdvancedProtectionStatusManagerFactory
: public BrowserContextKeyedServiceFactory {
public:
static AdvancedProtectionStatusManager* GetForProfile(Profile* profile);
static AdvancedProtectionStatusManagerFactory* GetInstance();
AdvancedProtectionStatusManagerFactory(
const AdvancedProtectionStatusManagerFactory&) = delete;
AdvancedProtectionStatusManagerFactory& operator=(
const AdvancedProtectionStatusManagerFactory&) = delete;
private:
friend struct base::DefaultSingletonTraits<
AdvancedProtectionStatusManagerFactory>;
AdvancedProtectionStatusManagerFactory();
~AdvancedProtectionStatusManagerFactory() override;
// BrowserContextKeyedServiceFactory:
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
};
} // namespace safe_browsing
#endif // CHROME_BROWSER_SAFE_BROWSING_ADVANCED_PROTECTION_STATUS_MANAGER_FACTORY_H_
| 35.8125 | 85 | 0.830716 |
a73c068273b4159dca7cae5b7d0b7c9547c88233 | 406 | h | C | CMC030/bi/open/bi_rateline.h | khandy21yo/aplus | 3b4024a2a8315f5dcc78479a24100efa3c4a6504 | [
"MIT"
] | 1 | 2018-10-17T08:53:17.000Z | 2018-10-17T08:53:17.000Z | CMC030/bi/open/bi_rateline.h | khandy21yo/aplus | 3b4024a2a8315f5dcc78479a24100efa3c4a6504 | [
"MIT"
] | null | null | null | CMC030/bi/open/bi_rateline.h | khandy21yo/aplus | 3b4024a2a8315f5dcc78479a24100efa3c4a6504 | [
"MIT"
] | null | null | null | /*
* File Layout for: BI.BI_RATELINE on 21-May-01
*
* CPT Time Rate Line File
*/
#pragma member_alignment save
#pragma nomember_alignment
struct bi_rateline_cdd
{
/* Element = RATETABLE
Description = CPT Time Rate Table */
char ratetable[6];
/* Element =
Description = Time Interval */
char interval[2];
/* Element =
Description = Rate */
double rate;
};
#pragma member_alignment restore
| 17.652174 | 47 | 0.704433 |
2191cf86247ab3f9084efc2440f7cb710cabc79d | 2,150 | h | C | peripherals/include/rnr/mot/MotQik.h | roadnarrows-robotics/rnr-sdk | aee20c65b49fb3eedf924c5c2ec9f19f4f1a1b29 | [
"MIT"
] | null | null | null | peripherals/include/rnr/mot/MotQik.h | roadnarrows-robotics/rnr-sdk | aee20c65b49fb3eedf924c5c2ec9f19f4f1a1b29 | [
"MIT"
] | null | null | null | peripherals/include/rnr/mot/MotQik.h | roadnarrows-robotics/rnr-sdk | aee20c65b49fb3eedf924c5c2ec9f19f4f1a1b29 | [
"MIT"
] | null | null | null | /*
Title: Header file for serial control of Qik motor controller
Author: Rob Shiely
Date: 4/12/2012
TODOs: Need functions to get current from controllers
*/
#ifndef _qik_h
#define _qik_h
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <limits.h>
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <time.h>
#include <errno.h>
#include <string.h>
#include "rnr/serdev.h"
#include "rnr/log.h"
/*
BAUD rate to use for Qik motor controllers.
This rate can be changed in Qik registers.
*/
#define BAUDRATE 38400
struct Qiks {
int m_fdQiks;
int m_fdQiks2; // DHP: for future
};
/*
Function opens serial comunication with set port.
(No actual communication with Qik controllers in this function)
Returns: 0 on success and -1 on failure (0 or -1)
*/
int QikOpenConnection(int *Descriptor);
/*
Function updates the speed of a single wheel.
Needs to be passed: A speed (-250 < speed < 250), a file descriptor,
and a motor (0 = left, 1 = right)
Returns: 0 on Success, -1 on incorrect speed, -2 on serial write fail.
*/
int QikUpdateMotorSpeeds(int Speed, int Descriptor, int Side);
/*
Function changes how agressively each individual motor brakes.
Needs to be passed: A brake rate (0 < Braking < 31: 31 = full brake),
a file descriptor, and a motor)
Returns: 0 on Success, -1 on incorrect speed, -2 on serial write fail.
*/
int QikAlterBraking(int Braking, int Descriptor, int Side);
/*
Function changes how agressively each individual motor changes dirrection.
Needs to be passed: A slew rate (0 < slew < 90: 0 = immediate change),
a file descriptor, and a motor)
Returns: 0 on Success, -1 on incorrect speed, -2 on serial write fail.
*/
int QikAlterSlew(int Slew, int Descriptor, int Side);
/*
E-Stop Function to lock up all wheels ICE
Needs to be passed: Both descriptors.
*/
void QikEStop(int Descriptor);
/*
Closing function to release a connection to a device.
*/
int QikClose(int Descriptor);
#endif // _qik_h
| 25.903614 | 76 | 0.689767 |
90d018f8d4a6b32de3b16c6eea7043956a6a78bc | 685 | h | C | Firmware/NixieClock/src/Pins.h | Finomnis/NixieClock | b414c265fa7c09b45397df22df566e699d842d2a | [
"MIT"
] | 1 | 2020-11-23T15:37:35.000Z | 2020-11-23T15:37:35.000Z | Firmware/NixieClock/src/Pins.h | Finomnis/NixieClock | b414c265fa7c09b45397df22df566e699d842d2a | [
"MIT"
] | null | null | null | Firmware/NixieClock/src/Pins.h | Finomnis/NixieClock | b414c265fa7c09b45397df22df566e699d842d2a | [
"MIT"
] | null | null | null | #pragma once
#include <Arduino.h>
struct PINS_t
{
const uint8_t NIXIE_DIM = PIN_PA5;
const uint8_t NIXIE_DATA = PIN_PA6;
const uint8_t NIXIE_LATCH = PIN_PA7;
const uint8_t NIXIE_CLK = PIN_PB5;
const uint8_t TIME_ZONE = PIN_PA4;
const uint8_t NMEA_SYNC = PIN_PC2;
void initializePins() const
{
pinMode(NIXIE_DIM, OUTPUT);
pinMode(NIXIE_DATA, OUTPUT);
pinMode(NIXIE_LATCH, OUTPUT);
pinMode(NIXIE_CLK, OUTPUT);
pinMode(TIME_ZONE, INPUT);
pinMode(NMEA_SYNC, INPUT);
// Set PWM frequency
constexpr int TCA = 0x0A00;
*((char *)TCA) = 0b00001111;
}
};
extern const PINS_t PINS;
| 22.096774 | 40 | 0.639416 |
347427c7ae254f0da3ccd39bb8c1b815936895c0 | 65 | h | C | p3/pgroup-13/src/drawlot.h | zhliOvO/ENGR1501J | b41264ead9bf93f54cce1fd6676037e99efeb70c | [
"MIT"
] | null | null | null | p3/pgroup-13/src/drawlot.h | zhliOvO/ENGR1501J | b41264ead9bf93f54cce1fd6676037e99efeb70c | [
"MIT"
] | null | null | null | p3/pgroup-13/src/drawlot.h | zhliOvO/ENGR1501J | b41264ead9bf93f54cce1fd6676037e99efeb70c | [
"MIT"
] | null | null | null | #ifndef __DRAWLOT_H_
#define __DRAWLOT_H_
void drawlot();
#endif
| 13 | 20 | 0.8 |
34ec302b95eca44987342b7c6de94c6b74492468 | 374 | h | C | src/api/obj_loader.h | wzm727069/HorseFarm | 447707b6c352e93fe7eb671d7570fb809d8acd51 | [
"MIT"
] | 1 | 2020-02-06T22:03:45.000Z | 2020-02-06T22:03:45.000Z | src/api/obj_loader.h | wzm727069/HorseFarm | 447707b6c352e93fe7eb671d7570fb809d8acd51 | [
"MIT"
] | null | null | null | src/api/obj_loader.h | wzm727069/HorseFarm | 447707b6c352e93fe7eb671d7570fb809d8acd51 | [
"MIT"
] | 1 | 2020-07-12T15:16:26.000Z | 2020-07-12T15:16:26.000Z | #pragma once
#include <vector>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/transform.hpp>
#include <glm/gtc/type_ptr.hpp>
class ObjectLoader
{
public:
static bool LoadObject(
const char * path,
std::vector<glm::vec3> & vertices,
std::vector<glm::vec3> & normals,
std::vector<glm::vec2> & uvs);
};
| 18.7 | 42 | 0.647059 |
553a60d5adbcd824e16212f2d2acca47352db2c2 | 1,489 | h | C | src/Bitarray.h | gravesee/BMM | b57b141b2a8934803326f387041859aec6dfce11 | [
"MIT"
] | 1 | 2021-06-21T01:52:48.000Z | 2021-06-21T01:52:48.000Z | src/Bitarray.h | gravesee/BMM | b57b141b2a8934803326f387041859aec6dfce11 | [
"MIT"
] | 1 | 2018-07-11T20:58:03.000Z | 2018-07-11T20:58:03.000Z | src/Bitarray.h | Zelazny7/BMM | b57b141b2a8934803326f387041859aec6dfce11 | [
"MIT"
] | null | null | null | #ifndef BITARRAY_H
#define BITARRAY_H
#include <limits.h>
#define BITS_IN_INT (sizeof(int) * 8)
/* Hat-tip to SO for these macros:
* "How to define and work with an array of bits in C?"
* https://stackoverflow.com/a/30590727/919872
*/
#define SetBit(A,k) ( A[(k / BITS_IN_INT)] |= (1 << (k % BITS_IN_INT)) )
#define TestBit(A,k) ( A[(k / BITS_IN_INT)] & (1 << (k % BITS_IN_INT)) )
/*
* Bitarray structure for storing binary data as array of ints
* \param int** data an array of array of ints
* \param nrow int storing number of elements to store -- usually a "row" of data from a sparse matrix
* \param ncol int storing number of bytes needed to store all of the bits
* \param nbits int storing number of individual bits to represent
*/
typedef struct {
int** _data;
int _nrows;
int _nbits;
} Bitarray;
int Bitarray_at(const Bitarray * me, int n, int d);
void Bitarray_set(Bitarray * me, int n, int d);
/*
* Helper method returning number of bytes need to store nbits for each machine
* Calculated as the # of bits needed / # bits in an int
*/
int bytes_needed(int d);
/*
* Allocate and zero out the space needed to store requested elements
*/
int** allocate_bytes(int n, int d);
/*
* Constructor initializing a Bitarray struct and allocating spaces
*/
void Bitarray_ctor(Bitarray * const me, int*p, int*i, int n, int d);
/*
* Destructor freeing memory allocated for Bitarray
*/
void Bitarray_free(Bitarray * const me);
#endif /* BITARRAY_H */
| 25.237288 | 102 | 0.695097 |
b6c467f901076e22acc2377958a0d8aa137cba55 | 673 | h | C | multiformats/util/varint.h | amatuni/multiformats | 0f26247b9f9d43fa8633f352399f67085a74448e | [
"MIT"
] | 3 | 2018-04-21T18:26:11.000Z | 2018-07-25T20:59:31.000Z | multiformats/util/varint.h | andreiamatuni/multiformats | 0f26247b9f9d43fa8633f352399f67085a74448e | [
"MIT"
] | null | null | null | multiformats/util/varint.h | andreiamatuni/multiformats | 0f26247b9f9d43fa8633f352399f67085a74448e | [
"MIT"
] | null | null | null | #pragma once
#include <cstdint>
#include <vector>
namespace multi::varint {
/*
Encode a uint64_t into a varint
*/
std::vector<uint8_t> encode(uint64_t);
/*
Parse the first varint in a buffer passed as input.
decode will return the value of the varint as uint64_t
along with the number of bytes processed, in a std::pair<>.
If an error occurs, the returned value is 0 and the number
of bytes processed is <= 0:
n == 0: buffer too small
n < 0: value larger than 64 bits
*/
std::pair<uint64_t, size_t> decode(std::vector<uint8_t>::const_iterator curr,
std::vector<uint8_t>::const_iterator end);
} // namespace multi::varint | 24.035714 | 77 | 0.684993 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.