hexsha stringlengths 40 40 | size int64 5 2.72M | ext stringclasses 5
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 976 | max_stars_repo_name stringlengths 5 113 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:01:43 2022-03-31 23:59:48 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 00:06:24 2022-03-31 23:59:53 ⌀ | max_issues_repo_path stringlengths 3 976 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 976 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:19 2022-03-31 23:59:49 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 12:00:57 2022-03-31 23:59:49 ⌀ | content stringlengths 5 2.72M | avg_line_length float64 1.38 573k | max_line_length int64 2 1.01M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
eab6d7b49ee41b9698edb81ba1bfaefb538a1037 | 3,839 | c | C | zest7/zad2/barber.c | kamilok1965/operating-systems | 6686a6f3803ab6fe256e611b99bcc835e4abb21a | [
"MIT"
] | null | null | null | zest7/zad2/barber.c | kamilok1965/operating-systems | 6686a6f3803ab6fe256e611b99bcc835e4abb21a | [
"MIT"
] | null | null | null | zest7/zad2/barber.c | kamilok1965/operating-systems | 6686a6f3803ab6fe256e611b99bcc835e4abb21a | [
"MIT"
] | null | null | null | //
// Created by kamil on 15.05.18.
//
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <errno.h>
#include <zconf.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <sys/sem.h>
#include <sys/shm.h>
#include <sys/ipc.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
#include <signal.h>
#include <semaphore.h>
#include "common.h"
int shared_memory_fd;
sem_t* semaphore;
void handle_signal(int _) {
printf("BARBER: closing \r\n");
exit(EXIT_SUCCESS);
}
void invite_client() {
pid_t client_pid = barbershop->queue[0];
barbershop->selected_client = client_pid;
printf("%lo BARBER: invited client %i \r\n", get_time(), client_pid);
}
void serve_client() {
printf("%lo BARBER: started serving client %i \r\n",
get_time(),
barbershop->selected_client);
printf("%lo BARBER: finished serving client %i \r\n",
get_time(),
barbershop->selected_client);
barbershop->selected_client = 0;
}
void clean_up() {
if (semaphore != 0) sem_unlink(PROJECT_PATH);
if (shared_memory_fd != 0) shm_unlink(PROJECT_PATH);
}
void init(int argc, char** argv) {
signal(SIGTERM, handle_signal);
signal(SIGINT, handle_signal);
atexit(clean_up);
if (argc < 2) FAILURE_EXIT("Not enough arguments! \r\n")
int waiting_room_size = (int) strtol(argv[1], 0, 10);
if (waiting_room_size > MAX_QUEUE_SIZE)
FAILURE_EXIT("Room size is too big \r\n")
shared_memory_fd = shm_open(
PROJECT_PATH,
O_RDWR | O_CREAT | O_EXCL,
S_IRWXU | S_IRWXG
);
if (shared_memory_fd == -1)
FAILURE_EXIT("Could not create shared memory segment \r\n")
int error = ftruncate(shared_memory_fd, sizeof(*barbershop));
if (error == -1)
FAILURE_EXIT("Could not truncate shared memory \r\n");
barbershop = mmap(
NULL, // address
sizeof(*barbershop), // length
PROT_READ | PROT_WRITE, // prot (memory segment security)
MAP_SHARED, // flags
shared_memory_fd, // file descriptor
0 // offset
);
if (barbershop == (void*) -1)
FAILURE_EXIT("Could not access shared memory \r\n")
semaphore = sem_open(
PROJECT_PATH, // path
O_WRONLY | O_CREAT | O_EXCL, // flags
S_IRWXU | S_IRWXG, // mode
0 // value
);
if (semaphore == (void*) -1)
FAILURE_EXIT("Could not create semaphore \r\n")
barbershop->barber_status = SLEEPING;
barbershop->waiting_room_size = waiting_room_size;
barbershop->client_count = 0;
barbershop->selected_client = 0;
for(int i = 0; i < MAX_QUEUE_SIZE; ++i)
barbershop->queue[i] = 0;
}
int main(int argc, char** argv) {
init(argc, argv);
release_semaphore(semaphore);
while(1) {
get_semaphore(semaphore);
switch (barbershop->barber_status) {
case IDLE:
if (is_queue_empty()) {
printf("%lo BARBER: ...zzzZZZZZzzzzzZZZz... \r\n", get_time());
barbershop->barber_status = SLEEPING;
} else {
invite_client();
barbershop->barber_status = READY;
}
break;
case AWOKEN:
printf("%lo BARBER: I HAVE AWOKEN \r\n", get_time());
barbershop->barber_status = READY;
break;
case BUSY:
serve_client();
barbershop->barber_status = READY;
break;
default:
break;
}
release_semaphore(semaphore);
}
} | 25.765101 | 83 | 0.560302 |
eab7f371cd3277d5eec915395152e83396e4d1a4 | 1,237 | h | C | macOS/10.13/GeoServices.framework/_GEORouteMatchUpdater_EnterBoard.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | 30 | 2016-10-09T20:13:00.000Z | 2022-01-24T04:14:57.000Z | macOS/10.13/GeoServices.framework/_GEORouteMatchUpdater_EnterBoard.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | null | null | null | macOS/10.13/GeoServices.framework/_GEORouteMatchUpdater_EnterBoard.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | 7 | 2017-08-29T14:41:25.000Z | 2022-01-19T17:14:54.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/GeoServices.framework/Versions/A/GeoServices
*/
@interface _GEORouteMatchUpdater_EnterBoard : _GEORouteMatchUpdater {
GEOComposedRouteStep * _boardVehicleStep;
GEOComposedRouteStep * _enterStationStep;
struct {
double latitude;
double longitude;
} _entranceCoordinate;
BOOL _hasEnteredStation;
GEOComposedTransitTripRouteStep * _rideStep;
struct PolylineCoordinate {
unsigned int index;
float offset;
} _routeCoordinateApproaching;
struct PolylineCoordinate {
unsigned int index;
float offset;
} _routeCoordinateAtStation;
GEOPBTransitStation * _transitStation;
GEOPBTransitStop * _transitStop;
}
- (id).cxx_construct;
- (void).cxx_destruct;
- (BOOL)_hasLocationEnteredStation:(id)arg1 routeMatch:(id)arg2;
- (BOOL)_hasLocationExitedStation:(id)arg1;
- (BOOL)_isLocationNearAccessPoint:(id)arg1;
- (BOOL)_isLocationNearEndOfWalkingLeg:(id)arg1;
- (BOOL)_isLocationNearTransitNode:(id)arg1;
- (id)initWithTransitRouteMatcher:(id)arg1 boardVehicleStep:(id)arg2;
- (BOOL)updateRouteMatch:(id)arg1 previousRouteMatch:(id)arg2 forLocation:(id)arg3;
@end
| 33.432432 | 88 | 0.747777 |
eab89bed4de1e50c39058329080e359320a5afe9 | 4,961 | c | C | tools/3gpp_vad/src/b_cn_cod.c | xiangxyq/kaldi_rt_decoder | 9f4006e2ffb0d69edc111fda2f1bedc2e3969d44 | [
"Apache-2.0"
] | 5 | 2021-09-03T02:16:00.000Z | 2022-02-22T12:06:58.000Z | tools/3gpp_vad/src/b_cn_cod.c | xiangxyq/kaldi_rt_decoder | 9f4006e2ffb0d69edc111fda2f1bedc2e3969d44 | [
"Apache-2.0"
] | 1 | 2022-02-25T06:26:35.000Z | 2022-02-25T06:26:35.000Z | tools/3gpp_vad/src/b_cn_cod.c | xiangxyq/kaldi_rt_decoder | 9f4006e2ffb0d69edc111fda2f1bedc2e3969d44 | [
"Apache-2.0"
] | 5 | 2021-09-08T03:42:25.000Z | 2022-01-27T08:05:50.000Z | /*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.6.0 December 12, 2001
* R99 Version 3.3.0
* REL-4 Version 4.1.0
*
********************************************************************************
*
* File : b_cn_cod.c
* Purpose : Contains function for comfort noise generation.
*
********************************************************************************
*/
/*
********************************************************************************
* MODULE INCLUDE FILE AND VERSION ID
********************************************************************************
*/
#include "b_cn_cod.h"
const char b_cn_cod_id[] = "@(#)$Id $" b_cn_cod_h;
/*
********************************************************************************
* INCLUDE FILES
********************************************************************************
*/
#include "typedef.h"
#include "basic_op.h"
#include "oper_32b.h"
#include "count.h"
#include "cnst.h"
#include <stdio.h>
#include <stdlib.h>
#include "window.tab"
/*
********************************************************************************
* LOCAL CONSTANTS
********************************************************************************
*/
#define NB_PULSE 10 /* number of random pulses in DTX operation */
/*
********************************************************************************
* PUBLIC PROGRAM CODE
********************************************************************************
*/
/*************************************************************************
*
* FUNCTION NAME: pseudonoise
*
*************************************************************************/
Word16 pseudonoise (
Word32 *shift_reg, /* i/o : Old CN generator shift register state */
Word16 no_bits /* i : Number of bits */
)
{
Word16 noise_bits, Sn, i;
noise_bits = 0; move16 ();
for (i = 0; i < no_bits; i++)
{
/* State n == 31 */
test (); logic32 ();
if ((*shift_reg & 0x00000001L) != 0)
{
Sn = 1; move16 ();
}
else
{
Sn = 0; move16 ();
}
/* State n == 3 */
test (); logic32 ();
if ((*shift_reg & 0x10000000L) != 0)
{
Sn = Sn ^ 1; move16 (); logic16 ();
}
else
{
Sn = Sn ^ 0; move16 (); logic16 ();
}
noise_bits = shl (noise_bits, 1);
noise_bits = noise_bits | (extract_l (*shift_reg) & 1);
logic16 (); logic16 (); move16 ();
*shift_reg = L_shr (*shift_reg, 1);
test ();
if (Sn & 1)
{
*shift_reg = *shift_reg | 0x40000000L; move32 (); logic32 ();
}
}
return noise_bits;
}
/***************************************************************************
*
* Function : build_CN_code
*
***************************************************************************/
void build_CN_code (
Word32 *seed, /* i/o : Old CN generator shift register state */
Word16 cod[] /* o : Generated CN fixed codebook vector */
)
{
Word16 i, j, k;
for (i = 0; i < L_SUBFR; i++)
{
cod[i] = 0; move16 ();
}
for (k = 0; k < NB_PULSE; k++)
{
i = pseudonoise (seed, 2); /* generate pulse position */
i = shr (extract_l (L_mult (i, 10)), 1);
i = add (i, k);
j = pseudonoise (seed, 1); /* generate sign */
test ();
if (j > 0)
{
cod[i] = 4096; move16 ();
}
else
{
cod[i] = -4096; move16 ();
}
}
return;
}
/*************************************************************************
*
* FUNCTION NAME: build_CN_param
*
*************************************************************************/
void build_CN_param (
Word16 *seed, /* i/o : Old CN generator shift register state */
const Word16 n_param, /* i : number of params */
const Word16 param_size_table[],/* i : size of params */
Word16 parm[] /* o : CN Generated params */
)
{
Word16 i;
const Word16 *p;
*seed = extract_l(L_add(L_shr(L_mult(*seed, 31821), 1), 13849L));
p = &window_200_40[*seed & 0x7F]; logic16();
for(i=0; i< n_param;i++){
move16 (); logic16(); logic16(); logic16();
parm[i] = *p++ & ~(0xFFFF<<param_size_table[i]);
}
}
| 30.435583 | 83 | 0.316065 |
eab910cd08f6f00f4ae73e051dba9c96b065f087 | 4,029 | h | C | bng_pkts.h | gonzopancho/dppd-BNG | c61d42ec3eb73978cd44094e628e8d19ad139324 | [
"Intel",
"Unlicense"
] | null | null | null | bng_pkts.h | gonzopancho/dppd-BNG | c61d42ec3eb73978cd44094e628e8d19ad139324 | [
"Intel",
"Unlicense"
] | null | null | null | bng_pkts.h | gonzopancho/dppd-BNG | c61d42ec3eb73978cd44094e628e8d19ad139324 | [
"Intel",
"Unlicense"
] | null | null | null | /*
Copyright(c) 2010-2015 Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the 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 Intel Corporation nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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.
*/
#ifndef _BNG_PKTS_H_
#define _BNG_PKTS_H_
#include <rte_ether.h>
#include <rte_ip.h>
#include <rte_udp.h>
#include <rte_byteorder.h>
#include "gre.h"
#include "mpls.h"
#include "qinq.h"
#include "arp.h"
#include "hash_entry_types.h"
struct cpe_pkt {
#ifdef USE_QINQ
struct qinq_hdr qinq_hdr;
#else
struct ether_hdr ether_hdr;
#endif
struct ipv4_hdr ipv4_hdr;
struct udp_hdr udp_hdr;
} __attribute__((packed));
struct cpe_packet_arp {
struct qinq_hdr qinq_hdr;
struct my_arp_t arp;
} __attribute__((packed));
/* Struct used for setting all the values a packet
going to the core netwerk. Payload may follow
after the headers, but no need to touch that. */
struct core_net_pkt_m {
struct ether_hdr ether_hdr;
#ifdef MPLS_ROUTING
union {
struct mpls_hdr mpls;
uint32_t mpls_bytes;
};
#endif
struct ipv4_hdr tunnel_ip_hdr;
struct gre_hdr gre_hdr;
struct ipv4_hdr ip_hdr;
struct udp_hdr udp_hdr;
} __attribute__((packed));
struct core_net_pkt {
struct ether_hdr ether_hdr;
struct ipv4_hdr tunnel_ip_hdr;
struct gre_hdr gre_hdr;
struct ipv4_hdr ip_hdr;
struct udp_hdr udp_hdr;
} __attribute__((packed));
#define UPSTREAM_DELTA ((uint32_t)(sizeof(struct core_net_pkt) - sizeof(struct cpe_pkt)))
#define DOWNSTREAM_DELTA ((uint32_t)(sizeof(struct core_net_pkt_m) - sizeof(struct cpe_pkt)))
struct cpe_pkt_delta {
uint8_t encap[DOWNSTREAM_DELTA];
struct cpe_pkt pkt;
} __attribute__((packed));
static inline void extract_key_cpe(struct rte_mbuf *mbuf, uint64_t* key)
{
uint8_t* packet = rte_pktmbuf_mtod(mbuf, uint8_t*);
#ifdef USE_QINQ
*key = (*(uint64_t *)(packet + 12)) & 0xFF0FFFFFFF0FFFFF;
#else
*key = rte_bswap32(*(uint32_t *)(packet + 26)) & 0x00FFFFFF;
#endif
}
static inline void key_core(struct gre_hdr* gre, __attribute__((unused)) struct ipv4_hdr* ip, uint64_t* key)
{
struct cpe_key *cpe_key = (struct cpe_key*)key;
cpe_key->gre_id = rte_be_to_cpu_32(gre->gre_id) & 0xFFFFFFF;
#ifdef USE_QINQ
cpe_key->ip = ip->dst_addr;
#else
cpe_key->ip = 0;
#endif
}
static inline void extract_key_core(struct rte_mbuf *mbuf, uint64_t* key)
{
struct core_net_pkt *packet = rte_pktmbuf_mtod(mbuf, struct core_net_pkt *);
key_core(&packet->gre_hdr, &packet->ip_hdr, key);
}
static inline void extract_key_core_m(struct rte_mbuf *mbuf, uint64_t* key)
{
struct core_net_pkt_m *packet = rte_pktmbuf_mtod(mbuf, struct core_net_pkt_m *);
key_core(&packet->gre_hdr, &packet->ip_hdr, key);
}
#endif /* _BNG_PKTS_H_ */
| 30.522727 | 108 | 0.761479 |
eab95cefe8847f04ea2e24d8c2019a049348e0c9 | 3,980 | h | C | iPhoneOS15.2.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalNotification.h | bakedpotato191/sdks | 7b5c8c299a8afcb6d68b356668b4949a946734d9 | [
"MIT"
] | 6 | 2021-12-13T03:09:30.000Z | 2022-03-09T15:18:16.000Z | iPhoneOS15.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalNotification.h | chrisharper22/sdks | 9b2f79c4a48fd5ca9a602044e617231d639a3f57 | [
"MIT"
] | null | null | null | iPhoneOS15.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UILocalNotification.h | chrisharper22/sdks | 9b2f79c4a48fd5ca9a602044e617231d639a3f57 | [
"MIT"
] | null | null | null | #if (defined(USE_UIKIT_PUBLIC_HEADERS) && USE_UIKIT_PUBLIC_HEADERS) || !__has_include(<UIKitCore/UILocalNotification.h>)
//
// UILocalNotification.h
// UIKit
//
// Copyright (c) 2007-2018 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKitDefines.h>
NS_ASSUME_NONNULL_BEGIN
@class CLRegion;
// In iOS 8.0 and later, your application must register for user notifications using -[UIApplication registerUserNotificationSettings:] before being able to schedule and present UILocalNotifications
UIKIT_EXTERN API_DEPRECATED("Use UserNotifications Framework's UNNotificationRequest", ios(4.0, 10.0)) API_UNAVAILABLE(tvos) NS_SWIFT_UI_ACTOR
@interface UILocalNotification : NSObject<NSCopying, NSCoding>
- (instancetype)init NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;
// timer-based scheduling
@property(nullable, nonatomic,copy) NSDate *fireDate;
// the time zone to interpret fireDate in. pass nil if fireDate is an absolute GMT time (e.g. for an egg timer).
// pass a time zone to interpret fireDate as a wall time to be adjusted automatically upon time zone changes (e.g. for an alarm clock).
@property(nullable, nonatomic,copy) NSTimeZone *timeZone;
@property(nonatomic) NSCalendarUnit repeatInterval; // 0 means don't repeat
@property(nullable, nonatomic,copy) NSCalendar *repeatCalendar;
// location-based scheduling
// set a CLRegion object to trigger the notification when the user enters or leaves a geographic region, depending upon the properties set on the CLRegion object itself. registering multiple UILocalNotifications with different regions containing the same identifier will result in undefined behavior. the number of region-triggered UILocalNotifications that may be registered at any one time is internally limited. in order to use region-triggered notifications, applications must have "when-in-use" authorization through CoreLocation. see the CoreLocation documentation for more information.
@property(nullable, nonatomic,copy) CLRegion *region API_AVAILABLE(ios(8.0));
// when YES, the notification will only fire one time. when NO, the notification will fire every time the region is entered or exited (depending upon the CLRegion object's configuration). default is YES.
@property(nonatomic,assign) BOOL regionTriggersOnce API_AVAILABLE(ios(8.0));
// alerts
@property(nullable, nonatomic,copy) NSString *alertBody; // defaults to nil. pass a string or localized string key to show an alert
@property(nonatomic) BOOL hasAction; // defaults to YES. pass NO to hide launching button/slider
@property(nullable, nonatomic,copy) NSString *alertAction; // used in UIAlert button or 'slide to unlock...' slider in place of unlock
@property(nullable, nonatomic,copy) NSString *alertLaunchImage; // used as the launch image (UILaunchImageFile) when launch button is tapped
@property(nullable, nonatomic,copy) NSString *alertTitle API_AVAILABLE(ios(8.2)); // defaults to nil. pass a string or localized string key
// sound
@property(nullable, nonatomic,copy) NSString *soundName; // name of resource in app's bundle to play or UILocalNotificationDefaultSoundName
// badge
@property(nonatomic) NSInteger applicationIconBadgeNumber; // 0 means no change. defaults to 0
// user info
@property(nullable, nonatomic,copy) NSDictionary *userInfo; // throws if contains non-property list types
// category identifier of the local notification, as set on a UIUserNotificationCategory and passed to +[UIUserNotificationSettings settingsForTypes:categories:]
@property (nullable, nonatomic, copy) NSString *category API_AVAILABLE(ios(8.0));
@end
UIKIT_EXTERN NSString *const UILocalNotificationDefaultSoundName API_DEPRECATED("Use UserNotifications Framework's +[UNNotificationSound defaultSound]", ios(4.0, 10.0)) API_UNAVAILABLE(tvos);
NS_ASSUME_NONNULL_END
#else
#import <UIKitCore/UILocalNotification.h>
#endif
| 57.681159 | 592 | 0.79397 |
eab9f2d9a2b4af5aeb0e42bbebd2df13bd8f7314 | 5,765 | h | C | example/protobuf_rpc/net/rpcMsg.rpc.pb.h | qingnia/Pebbble | 8f8ea5f24565f3e6c5e488597131eba9bdbf7d31 | [
"BSD-2-Clause"
] | 1 | 2021-12-04T00:30:15.000Z | 2021-12-04T00:30:15.000Z | example/protobuf_rpc/net/rpcMsg.rpc.pb.h | qingnia/Pebbble | 8f8ea5f24565f3e6c5e488597131eba9bdbf7d31 | [
"BSD-2-Clause"
] | null | null | null | example/protobuf_rpc/net/rpcMsg.rpc.pb.h | qingnia/Pebbble | 8f8ea5f24565f3e6c5e488597131eba9bdbf7d31 | [
"BSD-2-Clause"
] | 1 | 2021-12-04T00:30:20.000Z | 2021-12-04T00:30:20.000Z | // Generated by the Pebble C++ plugin 1.0.1.0 01:22:18 Nov 5 2018
// If you make any local change, they will be lost.
// source: example/protobuf_rpc/net/rpcMsg.proto
#ifndef _PEBBLE_example_2fprotobuf_5frpc_2fnet_2frpcMsg_2eproto_H_
#define _PEBBLE_example_2fprotobuf_5frpc_2fnet_2frpcMsg_2eproto_H_
#include "rpcMsg.rpc.pb.inh"
namespace example {
/* ������� */
/* ��ʱֻ�ṩ�ӷ����� */
class rpcMsgClient : public rpcMsgClientInterface {
public:
/* IDL定义接口,每个接口对应生成3个方法,分别是同步调用、并行调用、异步调用 */
/* �ӷ����� */
/* �������������ĺ� */
/* add同步调用,返回0时调用成功,非0失败 */
virtual int32_t add(const ::example::CalRequest& request, ::example::CalResponse* response);
/* add并行调用,一般通过Pebble并行模块(pebble::AddCall/WhenAll)来使用此接口 */
virtual int32_t Paralleladd(const ::example::CalRequest& request, int32_t* ret_code, ::example::CalResponse* response, uint32_t* num_called, uint32_t* num_parallel);
/* add异步调用,回调函数第一个参数为RPC调用结果,0为成功,非0失败 */
virtual void add(const ::example::CalRequest& request, const cxx::function<void(int32_t ret_code, const ::example::CalResponse& response)>& cb);
/* login同步调用,返回0时调用成功,非0失败 */
virtual int32_t login(const ::example::LoginInfo& request, ::example::playersInfo* response);
/* login并行调用,一般通过Pebble并行模块(pebble::AddCall/WhenAll)来使用此接口 */
virtual int32_t Parallellogin(const ::example::LoginInfo& request, int32_t* ret_code, ::example::playersInfo* response, uint32_t* num_called, uint32_t* num_parallel);
/* login异步调用,回调函数第一个参数为RPC调用结果,0为成功,非0失败 */
virtual void login(const ::example::LoginInfo& request, const cxx::function<void(int32_t ret_code, const ::example::playersInfo& response)>& cb);
/* modifyStatus同步调用,返回0时调用成功,非0失败 */
virtual int32_t modifyStatus(const ::example::StatusReceive& request, ::example::commonResponse* response);
/* modifyStatus并行调用,一般通过Pebble并行模块(pebble::AddCall/WhenAll)来使用此接口 */
virtual int32_t ParallelmodifyStatus(const ::example::StatusReceive& request, int32_t* ret_code, ::example::commonResponse* response, uint32_t* num_called, uint32_t* num_parallel);
/* modifyStatus异步调用,回调函数第一个参数为RPC调用结果,0为成功,非0失败 */
virtual void modifyStatus(const ::example::StatusReceive& request, const cxx::function<void(int32_t ret_code, const ::example::commonResponse& response)>& cb);
/* move同步调用,返回0时调用成功,非0失败 */
virtual int32_t move(const ::example::moveRequest& request, ::example::commonResponse* response);
/* move并行调用,一般通过Pebble并行模块(pebble::AddCall/WhenAll)来使用此接口 */
virtual int32_t Parallelmove(const ::example::moveRequest& request, int32_t* ret_code, ::example::commonResponse* response, uint32_t* num_called, uint32_t* num_parallel);
/* move异步调用,回调函数第一个参数为RPC调用结果,0为成功,非0失败 */
virtual void move(const ::example::moveRequest& request, const cxx::function<void(int32_t ret_code, const ::example::commonResponse& response)>& cb);
/* chat同步调用,返回0时调用成功,非0失败 */
virtual int32_t chat(const ::example::chatReceive& request, ::example::commonResponse* response);
/* chat并行调用,一般通过Pebble并行模块(pebble::AddCall/WhenAll)来使用此接口 */
virtual int32_t Parallelchat(const ::example::chatReceive& request, int32_t* ret_code, ::example::commonResponse* response, uint32_t* num_called, uint32_t* num_parallel);
/* chat异步调用,回调函数第一个参数为RPC调用结果,0为成功,非0失败 */
virtual void chat(const ::example::chatReceive& request, const cxx::function<void(int32_t ret_code, const ::example::commonResponse& response)>& cb);
public:
/* 功能接口 */
rpcMsgClient(::pebble::PebbleRpc* rpc);
virtual ~rpcMsgClient();
/* 设置连接句柄,RPC请求通过此句柄对应的连接发送 */
void SetHandle(int64_t handle);
/* 设置路由函数,连接的选择交给路由回调函数处理,RPC请求通过路由回调函数选择的连接发送 */
/* 设置路由回调函数后,不再使用SetHandle设置的连接句柄 */
void SetRouteFunction(const cxx::function<int64_t(uint64_t key)>& route_callback);
/* 设置路由key,如使用取模或哈希路由策略时使用 */
void SetRouteKey(uint64_t route_key);
/* 设置广播的频道名字,设置了频道后Client将所有的RPC请求按广播处理,广播至channel_name */
void SetBroadcast(const std::string& channel_name);
/* 设置RPC请求超时时间(单位ms),未指定方法名时对所有方法生效,指定方法名时只对指定方法生效,默认的超时时间为10s */
int SetTimeout(uint32_t timeout_ms, const char* method_name = NULL);
private:
rpcMsgClientImp* m_imp;
};
/* ������� */
/* ��ʱֻ�ṩ�ӷ����� */
class rpcMsgServerInterface {
public:
virtual ~rpcMsgServerInterface() {}
/* �ӷ����� */
/* �������������ĺ� */
virtual void add(const ::example::CalRequest& request, cxx::function<void(int32_t ret_code, const ::example::CalResponse& response)>& rsp) = 0;
virtual void login(const ::example::LoginInfo& request, cxx::function<void(int32_t ret_code, const ::example::playersInfo& response)>& rsp) = 0;
virtual void modifyStatus(const ::example::StatusReceive& request, cxx::function<void(int32_t ret_code, const ::example::commonResponse& response)>& rsp) = 0;
virtual void move(const ::example::moveRequest& request, cxx::function<void(int32_t ret_code, const ::example::commonResponse& response)>& rsp) = 0;
virtual void chat(const ::example::chatReceive& request, cxx::function<void(int32_t ret_code, const ::example::commonResponse& response)>& rsp) = 0;
typedef rpcMsgServerInterface __InterfaceType;
};
} // namespace example
/* 内部使用,用户无需关注 */
namespace pebble {
template<typename Class> class GenServiceHandler;
template<>
class GenServiceHandler< ::example::rpcMsgServerInterface> {
public:
cxx::shared_ptr< ::pebble::IPebbleRpcService> operator() (::pebble::PebbleRpc* rpc, ::example::rpcMsgServerInterface *iface) {
cxx::shared_ptr< ::pebble::IPebbleRpcService> service_handler(
new ::example::__rpcMsgSkeleton(rpc, iface));
return service_handler;
}
};
} // namespace pebble
#endif // _PEBBLE_example_2fprotobuf_5frpc_2fnet_2frpcMsg_2eproto_HH_
| 48.855932 | 184 | 0.727147 |
eaba77d73a066b81a24321bd55e62f9ce90c89f6 | 2,655 | h | C | AKABeacon/AKABeacon/Classes/AKADelegateDispatcher.h | CapnSpellcheck/aka-ios-beacon | 05f63fcffc3380f9d00f01c2d75a892e49589f5d | [
"BSD-2-Clause"
] | 16 | 2015-11-09T13:01:46.000Z | 2022-02-25T23:58:33.000Z | AKABeacon/AKABeacon/Classes/AKADelegateDispatcher.h | CapnSpellcheck/aka-ios-beacon | 05f63fcffc3380f9d00f01c2d75a892e49589f5d | [
"BSD-2-Clause"
] | 9 | 2016-02-15T07:12:09.000Z | 2017-07-22T09:39:37.000Z | AKABeacon/AKABeacon/Classes/AKADelegateDispatcher.h | CapnSpellcheck/aka-ios-beacon | 05f63fcffc3380f9d00f01c2d75a892e49589f5d | [
"BSD-2-Clause"
] | 2 | 2016-02-10T22:53:50.000Z | 2020-06-07T02:29:34.000Z | //
// AKADelegateDispatcher.h
// AKABeacon
//
// Created by Michael Utech on 11.01.16.
// Copyright © 2016 Michael Utech & AKA Sarl. All rights reserved.
//
#import <Foundation/Foundation.h>
/**
Dispatches messages for one or more protocol to one or more delegates (objects implementing these protocols).
For each configured protocol, the dispatcher analyses the delegates and maps each method (-selector) to the first delegate implementing it (in the order in which delegates are specified/added).
The delegate uses this mapping to impersonate the specified protocol implementation and forwards message invokations to mapped targets (delegates).
The dispatcher can be used to override protocol method implementations of a delegate (using a preceeding delegate providing these methods) or to augment a delegate by providing default implementations (using a subsequent delegate).
@note Delegates are referenced weakly. If a delegate is deallocated, the dispatcher will no longer respond to any message formerly mapped to the deallocated delegate, even if the list of delegates used to initialize the dispatcher provided an alternative implementation. This may lead to crashes or otherwise inconsistent behaviour if calls to respondsToSelector: are cached by senders. Consequently, you have to ensure that the delegates used by the dispatcher are kept alive as long as the dispatcher requires their implementations.
*/
@interface AKADelegateDispatcher : NSObject
/**
Initializes the dispatcher to impersonate the specified protocols using implementations found in the list of specified delegates. For each method specified by any of the protocols, the selector is mapped to the first delegate implementing it (in the order defined by the delegates parameter array).
@param protocols the set of protocols this dispatcher is supposed to impersonate. The order of protocols is not relevant.
@param delegates the list of delegates implementing the impersonated protocols. The order of delegates is relevant. For each message specified by a protocol, the first delegate is used as forwarding target.
@return the initialized dispatcher.
*/
- (instancetype)initWithProtocols:(NSArray<Protocol*>*)protocols
delegates:(NSArray*)delegates;
/**
Allows sub classes to prevent a selector-delegate mapping to be established. The default implementation returns YES.
@param selector the selector
@param delegate the implementing delegate
@return YES if the mapping should be established, NO otherwise.
*/
- (BOOL)shouldAddMappingFromSelector:(SEL)selector
toDelegate:(id)delegate;
@end
| 56.489362 | 535 | 0.787947 |
eaba8a762e57b17bf530ec63013f8140d4f2c279 | 2,112 | h | C | AlicloudHttpDNS/HttpdnsRequestScheduler_Internal.h | Copypeng/alibabacloud-httpdns-ios-sdk | 67827cdf7b85b972727c031cb6bf305fc688fc7e | [
"MIT"
] | 6 | 2020-11-20T08:30:27.000Z | 2021-05-20T23:44:30.000Z | AlicloudHttpDNS/HttpdnsRequestScheduler_Internal.h | Copypeng/alibabacloud-httpdns-ios-sdk | 67827cdf7b85b972727c031cb6bf305fc688fc7e | [
"MIT"
] | 1 | 2020-12-24T08:50:51.000Z | 2020-12-24T08:50:51.000Z | AlicloudHttpDNS/HttpdnsRequestScheduler_Internal.h | Copypeng/alibabacloud-httpdns-ios-sdk | 67827cdf7b85b972727c031cb6bf305fc688fc7e | [
"MIT"
] | 3 | 2020-11-23T03:09:57.000Z | 2021-08-03T02:49:32.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import "HttpdnsRequestScheduler.h"
FOUNDATION_EXTERN NSString *const ALICLOUD_HTTPDNS_SERVER_IP_1;
FOUNDATION_EXTERN NSString *const ALICLOUD_HTTPDNS_SERVER_IP_2;
FOUNDATION_EXTERN NSString *const ALICLOUD_HTTPDNS_SERVER_IP_3;
FOUNDATION_EXTERN NSString *const ALICLOUD_HTTPDNS_SERVER_IP_4;
@interface HttpdnsRequestTestHelper : NSObject
+ (void)zeroSnifferTimeForTest;
@end
/**
* Disable状态开始30秒后可以进行“嗅探”行为
*/
static NSTimeInterval ALICLOUD_HTTPDNS_ABLE_TO_SNIFFER_AFTER_SERVER_DISABLE_INTERVAL = 0;
@interface HttpdnsRequestScheduler ()
- (void)setServerDisable:(BOOL)serverDisable host:(NSString *)host;
- (void)setServerDisable:(BOOL)serverDisable host:(NSString *)host activatedServerIPIndex:(NSInteger)activatedServerIPIndex;
- (BOOL)isServerDisable;
@property (nonatomic, strong) HttpdnsRequestTestHelper *testHelper;
@property (nonatomic, assign) BOOL IPRankingEnabled;
//内部缓存开关,不触发加载DB到内存的操作
- (void)_setCachedIPEnabled:(BOOL)enable;
- (BOOL)_getCachedIPEnabled;
+ (void)configureServerIPsAndResetActivatedIPTime;
- (void)canNotResolveHost:(NSString *)host error:(NSError *)error isRetry:(BOOL)isRetry activatedServerIPIndex:(NSInteger)activatedServerIPIndex;
+ (dispatch_queue_t)hostCacheQueue;
- (void)loadIPsFromCacheSyncIfNeeded;
- (void)cleanAllHostMemoryCache;
@end
| 32.492308 | 145 | 0.799242 |
eabbaaefe71b504cd6670fcbf742065a2f13d96c | 104 | c | C | tests/single-exec/00153.c | ilyas829/c-testsuite | ba35abe48ca84091b883cc38966e39d1e01ac6a4 | [
"MIT"
] | 104 | 2019-06-05T03:46:44.000Z | 2022-03-26T00:21:14.000Z | tests/single-exec/00153.c | ilyas829/c-testsuite | ba35abe48ca84091b883cc38966e39d1e01ac6a4 | [
"MIT"
] | 41 | 2018-08-25T04:34:05.000Z | 2022-02-01T22:05:49.000Z | tests/single-exec/00153.c | ilyas829/c-testsuite | ba35abe48ca84091b883cc38966e39d1e01ac6a4 | [
"MIT"
] | 15 | 2018-08-25T05:04:26.000Z | 2021-12-26T12:08:44.000Z | #define x f
#define y() f
typedef struct { int f; } S;
int
main()
{
S s;
s.x = 0;
return s.y();
}
| 7.428571 | 28 | 0.519231 |
eabf9cd4760e6ece3ef62b5f742e0b925b9e474e | 253 | h | C | QuickProgressSuiteDemo/QuickProgressSuiteDemo/DashBoard/QuickProgressViewDashBoard.h | pcjbird/QuickProgressSuite | 490cc3372bf58b1f77bab64faf3304c66214cc56 | [
"MIT"
] | null | null | null | QuickProgressSuiteDemo/QuickProgressSuiteDemo/DashBoard/QuickProgressViewDashBoard.h | pcjbird/QuickProgressSuite | 490cc3372bf58b1f77bab64faf3304c66214cc56 | [
"MIT"
] | null | null | null | QuickProgressSuiteDemo/QuickProgressSuiteDemo/DashBoard/QuickProgressViewDashBoard.h | pcjbird/QuickProgressSuite | 490cc3372bf58b1f77bab64faf3304c66214cc56 | [
"MIT"
] | null | null | null | //
// QuickProgressViewDashBoard.h
// QuickProgressSuite
//
// Created by pcjbird on 2018/7/7.
// Copyright © 2018年 Zero Status. All rights reserved.
//
#import "QuickProgressView.h"
@interface QuickProgressViewDashBoard : QuickProgressView
@end
| 18.071429 | 57 | 0.747036 |
eabfe410dda7b2f9f98c1128d63192de76606426 | 1,901 | h | C | HopsanGUI/version_gui.h | mjfwest/hopsan | 77a0a1e69fd9588335b7e932f348972186cbdf6f | [
"Apache-2.0"
] | null | null | null | HopsanGUI/version_gui.h | mjfwest/hopsan | 77a0a1e69fd9588335b7e932f348972186cbdf6f | [
"Apache-2.0"
] | null | null | null | HopsanGUI/version_gui.h | mjfwest/hopsan | 77a0a1e69fd9588335b7e932f348972186cbdf6f | [
"Apache-2.0"
] | null | null | null | /*-----------------------------------------------------------------------------
Copyright 2017 Hopsan Group
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
The full license is available in the file GPLv3.
For details about the 'Hopsan Group' or information about Authors and
Contributors see the HOPSANGROUP and AUTHORS files that are located in
the Hopsan source code root directory.
-----------------------------------------------------------------------------*/
//!
//! @file version_gui.h
//!
//! @brief Contains version definitions for the HopsanGUI, HMF files and component appearance files
//!
//$Id$
#ifndef VERSION_GUI_H
#define VERSION_GUI_H
// Include compiler info and hopsan core macros
#include "HopsanCoreVersion.h"
// If we don't have the revision number then define UNKNOWN
// On real release builds, UNKNOWN will be replaced by actual revnum by external script
#ifndef HOPSANGUI_COMMIT_TIMESTAMP
#define HOPSANGUI_COMMIT_TIMESTAMP UNKNOWN
#endif
#define HOPSANGUIVERSION HOPSANBASEVERSION "." TO_STR(HOPSANGUI_COMMIT_TIMESTAMP)
// The actual Hopsan release version will be set by external script
#define HOPSANRELEASEVERSION HOPSANGUIVERSION
#define HMF_VERSIONNUM "0.4"
#define HMF_REQUIREDVERSIONNUM "0.3"
#define CAF_VERSIONNUM "0.3"
#endif // VERSION_GUI_H
| 36.557692 | 99 | 0.709627 |
eac04fa9b7178eba32dee971fa74eca200da6fa5 | 345 | h | C | RedSocial/RedSocial(V 2.0) BackUp/formnew.h | samirsoft-ux/SX31_201621319_201913741_201924340 | 576e649497e3a66db02196663a2b2c9cf2930be6 | [
"CC0-1.0"
] | null | null | null | RedSocial/RedSocial(V 2.0) BackUp/formnew.h | samirsoft-ux/SX31_201621319_201913741_201924340 | 576e649497e3a66db02196663a2b2c9cf2930be6 | [
"CC0-1.0"
] | null | null | null | RedSocial/RedSocial(V 2.0) BackUp/formnew.h | samirsoft-ux/SX31_201621319_201913741_201924340 | 576e649497e3a66db02196663a2b2c9cf2930be6 | [
"CC0-1.0"
] | null | null | null | #ifndef FORMNEW_H
#define FORMNEW_H
#include <QWidget>
namespace Ui {
class FormNew;
}
class FormNew : public QWidget
{
Q_OBJECT
public:
explicit FormNew(QWidget *parent = nullptr);
~FormNew();
private slots:
void on_Registrarse_clicked();
signals:
void volver();
private:
Ui::FormNew *ui;
};
#endif // FORMNEW_H
| 11.896552 | 48 | 0.681159 |
eac0c3927ede6d889250481190f50dd22989edc8 | 5,613 | h | C | Dev/Cpp/EffekseerRendererVulkan/EffekseerRenderer/ShaderHeader/model_unlit_ps.h | NumAniCloud/Effekseer | f4547a57eea4c85b55cb8218bf6cac6af6d6dd37 | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2020-11-21T01:34:30.000Z | 2020-11-21T01:34:30.000Z | Dev/Cpp/EffekseerRendererVulkan/EffekseerRenderer/ShaderHeader/model_unlit_ps.h | NumAniCloud/Effekseer | f4547a57eea4c85b55cb8218bf6cac6af6d6dd37 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | Dev/Cpp/EffekseerRendererVulkan/EffekseerRenderer/ShaderHeader/model_unlit_ps.h | NumAniCloud/Effekseer | f4547a57eea4c85b55cb8218bf6cac6af6d6dd37 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | // 7.13.3381
#pragma once
const uint32_t model_unlit_ps[] = {
0x07230203,0x00010000,0x00080007,0x00000045,0x00000000,0x00020011,0x00000001,0x0006000b,
0x00000001,0x4c534c47,0x6474732e,0x3035342e,0x00000000,0x0003000e,0x00000000,0x00000001,
0x0009000f,0x00000004,0x00000004,0x6e69616d,0x00000000,0x00000031,0x00000035,0x00000038,
0x00000040,0x00030010,0x00000004,0x00000007,0x00030003,0x00000002,0x000001a4,0x00040005,
0x00000004,0x6e69616d,0x00000000,0x00050005,0x00000009,0x495f5350,0x7475706e,0x00000000,
0x00040006,0x00000009,0x00000000,0x00736f50,0x00040006,0x00000009,0x00000001,0x00005655,
0x00050006,0x00000009,0x00000002,0x6f6c6f43,0x00000072,0x000b0005,0x0000000d,0x69616d5f,
0x7473286e,0x74637572,0x5f53502d,0x75706e49,0x66762d74,0x66762d34,0x66762d32,0x003b3134,
0x00040005,0x0000000c,0x75706e49,0x00000074,0x00040005,0x00000010,0x7074754f,0x00007475,
0x00080005,0x00000014,0x706d6153,0x5f72656c,0x6f635f67,0x53726f6c,0x6c706d61,0x00007265,
0x00040005,0x0000002e,0x75706e49,0x00000074,0x00060005,0x00000031,0x465f6c67,0x43676172,
0x64726f6f,0x00000000,0x00050005,0x00000035,0x75706e49,0x56555f74,0x00000000,0x00050005,
0x00000038,0x75706e49,0x6f435f74,0x00726f6c,0x00030005,0x0000003b,0x0035365f,0x00040005,
0x0000003c,0x61726170,0x0000006d,0x00070005,0x00000040,0x746e655f,0x6f507972,0x4f746e69,
0x75707475,0x00000074,0x00070005,0x00000042,0x435f5356,0x74736e6f,0x42746e61,0x65666675,
0x00000072,0x00070006,0x00000042,0x00000000,0x67694c66,0x69447468,0x74636572,0x006e6f69,
0x00060006,0x00000042,0x00000001,0x67694c66,0x6f437468,0x00726f6c,0x00070006,0x00000042,
0x00000002,0x67694c66,0x6d417468,0x6e656962,0x00000074,0x00030005,0x00000044,0x0038365f,
0x00040047,0x00000014,0x00000022,0x00000001,0x00040047,0x00000014,0x00000021,0x00000001,
0x00040047,0x00000031,0x0000000b,0x0000000f,0x00030047,0x00000035,0x00000010,0x00040047,
0x00000035,0x0000001e,0x00000000,0x00030047,0x00000038,0x00000010,0x00040047,0x00000038,
0x0000001e,0x00000001,0x00040047,0x00000040,0x0000001e,0x00000000,0x00050048,0x00000042,
0x00000000,0x00000023,0x00000000,0x00050048,0x00000042,0x00000001,0x00000023,0x00000010,
0x00050048,0x00000042,0x00000002,0x00000023,0x00000020,0x00030047,0x00000042,0x00000002,
0x00040047,0x00000044,0x00000022,0x00000001,0x00040047,0x00000044,0x00000021,0x00000000,
0x00020013,0x00000002,0x00030021,0x00000003,0x00000002,0x00030016,0x00000006,0x00000020,
0x00040017,0x00000007,0x00000006,0x00000004,0x00040017,0x00000008,0x00000006,0x00000002,
0x0005001e,0x00000009,0x00000007,0x00000008,0x00000007,0x00040020,0x0000000a,0x00000007,
0x00000009,0x00040021,0x0000000b,0x00000007,0x0000000a,0x00040020,0x0000000f,0x00000007,
0x00000007,0x00090019,0x00000011,0x00000006,0x00000001,0x00000000,0x00000000,0x00000000,
0x00000001,0x00000000,0x0003001b,0x00000012,0x00000011,0x00040020,0x00000013,0x00000000,
0x00000012,0x0004003b,0x00000013,0x00000014,0x00000000,0x00040015,0x00000016,0x00000020,
0x00000001,0x0004002b,0x00000016,0x00000017,0x00000001,0x00040020,0x00000018,0x00000007,
0x00000008,0x0004002b,0x00000016,0x0000001c,0x00000002,0x00040015,0x00000020,0x00000020,
0x00000000,0x0004002b,0x00000020,0x00000021,0x00000003,0x00040020,0x00000022,0x00000007,
0x00000006,0x0004002b,0x00000006,0x00000025,0x00000000,0x00020014,0x00000026,0x0004002b,
0x00000016,0x0000002f,0x00000000,0x00040020,0x00000030,0x00000001,0x00000007,0x0004003b,
0x00000030,0x00000031,0x00000001,0x00040020,0x00000034,0x00000001,0x00000008,0x0004003b,
0x00000034,0x00000035,0x00000001,0x0004003b,0x00000030,0x00000038,0x00000001,0x00040020,
0x0000003f,0x00000003,0x00000007,0x0004003b,0x0000003f,0x00000040,0x00000003,0x0005001e,
0x00000042,0x00000007,0x00000007,0x00000007,0x00040020,0x00000043,0x00000002,0x00000042,
0x0004003b,0x00000043,0x00000044,0x00000002,0x00050036,0x00000002,0x00000004,0x00000000,
0x00000003,0x000200f8,0x00000005,0x0004003b,0x0000000a,0x0000002e,0x00000007,0x0004003b,
0x0000000f,0x0000003b,0x00000007,0x0004003b,0x0000000a,0x0000003c,0x00000007,0x0004003d,
0x00000007,0x00000032,0x00000031,0x00050041,0x0000000f,0x00000033,0x0000002e,0x0000002f,
0x0003003e,0x00000033,0x00000032,0x0004003d,0x00000008,0x00000036,0x00000035,0x00050041,
0x00000018,0x00000037,0x0000002e,0x00000017,0x0003003e,0x00000037,0x00000036,0x0004003d,
0x00000007,0x00000039,0x00000038,0x00050041,0x0000000f,0x0000003a,0x0000002e,0x0000001c,
0x0003003e,0x0000003a,0x00000039,0x0004003d,0x00000009,0x0000003d,0x0000002e,0x0003003e,
0x0000003c,0x0000003d,0x00050039,0x00000007,0x0000003e,0x0000000d,0x0000003c,0x0003003e,
0x0000003b,0x0000003e,0x0004003d,0x00000007,0x00000041,0x0000003b,0x0003003e,0x00000040,
0x00000041,0x000100fd,0x00010038,0x00050036,0x00000007,0x0000000d,0x00000000,0x0000000b,
0x00030037,0x0000000a,0x0000000c,0x000200f8,0x0000000e,0x0004003b,0x0000000f,0x00000010,
0x00000007,0x0004003d,0x00000012,0x00000015,0x00000014,0x00050041,0x00000018,0x00000019,
0x0000000c,0x00000017,0x0004003d,0x00000008,0x0000001a,0x00000019,0x00050057,0x00000007,
0x0000001b,0x00000015,0x0000001a,0x00050041,0x0000000f,0x0000001d,0x0000000c,0x0000001c,
0x0004003d,0x00000007,0x0000001e,0x0000001d,0x00050085,0x00000007,0x0000001f,0x0000001b,
0x0000001e,0x0003003e,0x00000010,0x0000001f,0x00050041,0x00000022,0x00000023,0x00000010,
0x00000021,0x0004003d,0x00000006,0x00000024,0x00000023,0x000500b4,0x00000026,0x00000027,
0x00000024,0x00000025,0x000300f7,0x00000029,0x00000000,0x000400fa,0x00000027,0x00000028,
0x00000029,0x000200f8,0x00000028,0x000100fc,0x000200f8,0x00000029,0x0004003d,0x00000007,
0x0000002b,0x00000010,0x000200fe,0x0000002b,0x00010038
}; | 85.045455 | 89 | 0.886157 |
eac1f06f7767c49339a8ba8d54153cd1bb2f0e0b | 1,821 | h | C | include/openssl_hmac.h | alexis-gruet/kt_rampart | 6c756aedb9eff4fa4a559fc9475226a09d47dad4 | [
"Apache-2.0"
] | 1 | 2015-06-02T13:04:51.000Z | 2015-06-02T13:04:51.000Z | wsf_c/rampartc/include/openssl_hmac.h | notxarb/wsf-php | 3664c4123e062a75f576e69477e8bf245aa181a6 | [
"Apache-2.0"
] | 1 | 2015-08-10T16:24:08.000Z | 2015-08-10T16:24:08.000Z | wsf_c/rampartc/include/openssl_hmac.h | notxarb/wsf-php | 3664c4123e062a75f576e69477e8bf245aa181a6 | [
"Apache-2.0"
] | 4 | 2017-03-21T15:27:57.000Z | 2021-05-27T11:20:00.000Z | /*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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 <openssl/sha.h>
#include <openssl/hmac.h>
#include <axutil_utils_defines.h>
#include <axis2_defines.h>
#include <axutil_env.h>
#include <oxs_buffer.h>
#include <oxs_key.h>
/**
* @file openssl_hmac.h
* @brief HMAC function implementations. Supports SHA1
*/
#ifndef OPENSSL_HMAC
#define OPENSSL_HMAC
#ifdef __cplusplus
extern "C" {
#endif
/**
* @defgroup openssl_hmac OpenSSL Hmac
* @ingroup openssl
* @{
*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
openssl_hmac_sha1(const axutil_env_t *env,
oxs_key_t *secret,
oxs_buffer_t *input,
oxs_buffer_t *output);
AXIS2_EXTERN axis2_status_t AXIS2_CALL
openssl_p_sha1(const axutil_env_t *env,
oxs_key_t *secret,
axis2_char_t *label,
axis2_char_t *seed,
oxs_key_t *derived_key);
AXIS2_EXTERN axis2_status_t AXIS2_CALL
openssl_p_hash(const axutil_env_t *env,
unsigned char *secret,
unsigned int secret_len,
unsigned char *seed,
unsigned int seed_len,
unsigned char *output,
unsigned int output_len);
/* @} */
#ifdef __cplusplus
}
#endif
#endif /* OPENSSL_HMAC */
| 26.014286 | 77 | 0.685887 |
eac3137cb683f6ef53bc7979fda6ea25f965d2a5 | 1,489 | c | C | src/subtitles.c | adnanyaqoobvirk/vlc-subtitles-module | f4c395a903f0d0fe3afe5d6f64db3067cdd0fbc7 | [
"MIT"
] | 1 | 2021-12-20T00:00:33.000Z | 2021-12-20T00:00:33.000Z | src/subtitles.c | adnanyaqoobvirk/vlc-subtitles-module | f4c395a903f0d0fe3afe5d6f64db3067cdd0fbc7 | [
"MIT"
] | null | null | null | src/subtitles.c | adnanyaqoobvirk/vlc-subtitles-module | f4c395a903f0d0fe3afe5d6f64db3067cdd0fbc7 | [
"MIT"
] | 1 | 2019-02-06T07:57:30.000Z | 2019-02-06T07:57:30.000Z | #define MODULE_STRING "subtitles"
#include <stdlib.h>
/* VLC core API headers */
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
/* Forward declarations */
static int Open(vlc_object_t *);
static void Close(vlc_object_t *);
/* Module descriptor */
vlc_module_begin()
set_shortname("Subtitles")
set_description("Extra Features for Subtitles")
set_capability("interface", 0)
set_callbacks(Open, Close)
set_category(CAT_INTERFACE)
vlc_module_end ()
/* Internal state for an instance of the module */
struct intf_sys_t
{
char *who;
};
/**
* Starts our example interface.
*/
static int Open(vlc_object_t *obj)
{
intf_thread_t *intf = (intf_thread_t *)obj;
intf->p_module
/* Allocate internal state */
intf_sys_t *sys = (intf_sys_t *)malloc(sizeof (intf_sys_t));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
intf->p_sys = sys;
/* Read settings */
char *who = var_InheritString(intf, "hello-who");
if (who == NULL)
{
msg_Err(intf, "Nobody to say hello to!");
goto error;
}
sys->who = who;
msg_Info(intf, "Hello %s!", who);
return VLC_SUCCESS;
error:
free(sys);
return VLC_EGENERIC;
}
/**
* Stops the interface.
*/
static void Close(vlc_object_t *obj)
{
intf_thread_t *intf = (intf_thread_t *)obj;
intf_sys_t *sys = intf->p_sys;
msg_Info(intf, "Good bye!");
/* Free internal state */
free(sys->who);
free(sys);
} | 20.39726 | 64 | 0.646071 |
eac6daeca12852b14fa2b46248e7e63c4fc83126 | 7,274 | c | C | src/misc/crypt/crypt_constants.c | cntrump/libtomcrypt | 673f5ce29015a9bba3c96792920a10601b5b0718 | [
"Unlicense"
] | 1,180 | 2015-01-11T20:55:07.000Z | 2022-03-30T14:09:35.000Z | src/misc/crypt/crypt_constants.c | cntrump/libtomcrypt | 673f5ce29015a9bba3c96792920a10601b5b0718 | [
"Unlicense"
] | 431 | 2015-01-29T10:42:58.000Z | 2022-03-16T19:52:36.000Z | src/misc/crypt/crypt_constants.c | cntrump/libtomcrypt | 673f5ce29015a9bba3c96792920a10601b5b0718 | [
"Unlicense"
] | 397 | 2015-01-07T14:05:17.000Z | 2022-03-27T03:15:46.000Z | /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
/* SPDX-License-Identifier: Unlicense */
#include "tomcrypt_private.h"
/**
@file crypt_constants.c
Make various constants available to dynamic languages
like Python - Larry Bugbee, February 2013
LB - Dec 2013 - revised to include compiler define options
LB - Mar 2014 - added endianness and word size
*/
typedef struct {
const char *name;
const int value;
} crypt_constant;
#define C_STRINGIFY(s) { #s, s }
static const crypt_constant s_crypt_constants[] = {
C_STRINGIFY(CRYPT_OK),
C_STRINGIFY(CRYPT_ERROR),
C_STRINGIFY(CRYPT_NOP),
C_STRINGIFY(CRYPT_INVALID_KEYSIZE),
C_STRINGIFY(CRYPT_INVALID_ROUNDS),
C_STRINGIFY(CRYPT_FAIL_TESTVECTOR),
C_STRINGIFY(CRYPT_BUFFER_OVERFLOW),
C_STRINGIFY(CRYPT_INVALID_PACKET),
C_STRINGIFY(CRYPT_INVALID_PRNGSIZE),
C_STRINGIFY(CRYPT_ERROR_READPRNG),
C_STRINGIFY(CRYPT_INVALID_CIPHER),
C_STRINGIFY(CRYPT_INVALID_HASH),
C_STRINGIFY(CRYPT_INVALID_PRNG),
C_STRINGIFY(CRYPT_MEM),
C_STRINGIFY(CRYPT_PK_TYPE_MISMATCH),
C_STRINGIFY(CRYPT_PK_NOT_PRIVATE),
C_STRINGIFY(CRYPT_INVALID_ARG),
C_STRINGIFY(CRYPT_FILE_NOTFOUND),
C_STRINGIFY(CRYPT_PK_INVALID_TYPE),
C_STRINGIFY(CRYPT_OVERFLOW),
C_STRINGIFY(CRYPT_PK_ASN1_ERROR),
C_STRINGIFY(CRYPT_INPUT_TOO_LONG),
C_STRINGIFY(CRYPT_PK_INVALID_SIZE),
C_STRINGIFY(CRYPT_INVALID_PRIME_SIZE),
C_STRINGIFY(CRYPT_PK_INVALID_PADDING),
C_STRINGIFY(CRYPT_HASH_OVERFLOW),
C_STRINGIFY(PK_PUBLIC),
C_STRINGIFY(PK_PRIVATE),
C_STRINGIFY(LTC_ENCRYPT),
C_STRINGIFY(LTC_DECRYPT),
#ifdef LTC_PKCS_1
{"LTC_PKCS_1", 1},
/* Block types */
C_STRINGIFY(LTC_PKCS_1_EMSA),
C_STRINGIFY(LTC_PKCS_1_EME),
/* Padding types */
C_STRINGIFY(LTC_PKCS_1_V1_5),
C_STRINGIFY(LTC_PKCS_1_OAEP),
C_STRINGIFY(LTC_PKCS_1_PSS),
C_STRINGIFY(LTC_PKCS_1_V1_5_NA1),
#else
{"LTC_PKCS_1", 0},
#endif
#ifdef LTC_PADDING
{"LTC_PADDING", 1},
C_STRINGIFY(LTC_PAD_PKCS7),
#ifdef LTC_RNG_GET_BYTES
C_STRINGIFY(LTC_PAD_ISO_10126),
#endif
C_STRINGIFY(LTC_PAD_ANSI_X923),
C_STRINGIFY(LTC_PAD_ONE_AND_ZERO),
C_STRINGIFY(LTC_PAD_ZERO),
C_STRINGIFY(LTC_PAD_ZERO_ALWAYS),
#else
{"LTC_PADDING", 0},
#endif
#ifdef LTC_MRSA
{"LTC_MRSA", 1},
#else
{"LTC_MRSA", 0},
#endif
#ifdef LTC_MECC
{"LTC_MECC", 1},
C_STRINGIFY(ECC_BUF_SIZE),
C_STRINGIFY(ECC_MAXSIZE),
#else
{"LTC_MECC", 0},
#endif
#ifdef LTC_MDSA
{"LTC_MDSA", 1},
C_STRINGIFY(LTC_MDSA_DELTA),
C_STRINGIFY(LTC_MDSA_MAX_GROUP),
C_STRINGIFY(LTC_MDSA_MAX_MODULUS),
#else
{"LTC_MDSA", 0},
#endif
#ifdef LTC_MILLER_RABIN_REPS
C_STRINGIFY(LTC_MILLER_RABIN_REPS),
#endif
#ifdef LTC_DER
/* DER handling */
{"LTC_DER", 1},
C_STRINGIFY(LTC_ASN1_EOL),
C_STRINGIFY(LTC_ASN1_BOOLEAN),
C_STRINGIFY(LTC_ASN1_INTEGER),
C_STRINGIFY(LTC_ASN1_SHORT_INTEGER),
C_STRINGIFY(LTC_ASN1_BIT_STRING),
C_STRINGIFY(LTC_ASN1_OCTET_STRING),
C_STRINGIFY(LTC_ASN1_NULL),
C_STRINGIFY(LTC_ASN1_OBJECT_IDENTIFIER),
C_STRINGIFY(LTC_ASN1_IA5_STRING),
C_STRINGIFY(LTC_ASN1_PRINTABLE_STRING),
C_STRINGIFY(LTC_ASN1_UTF8_STRING),
C_STRINGIFY(LTC_ASN1_UTCTIME),
C_STRINGIFY(LTC_ASN1_CHOICE),
C_STRINGIFY(LTC_ASN1_SEQUENCE),
C_STRINGIFY(LTC_ASN1_SET),
C_STRINGIFY(LTC_ASN1_SETOF),
C_STRINGIFY(LTC_ASN1_RAW_BIT_STRING),
C_STRINGIFY(LTC_ASN1_TELETEX_STRING),
C_STRINGIFY(LTC_ASN1_GENERALIZEDTIME),
C_STRINGIFY(LTC_ASN1_CUSTOM_TYPE),
C_STRINGIFY(LTC_DER_MAX_RECURSION),
#else
{"LTC_DER", 0},
#endif
#ifdef LTC_CTR_MODE
{"LTC_CTR_MODE", 1},
C_STRINGIFY(CTR_COUNTER_LITTLE_ENDIAN),
C_STRINGIFY(CTR_COUNTER_BIG_ENDIAN),
C_STRINGIFY(LTC_CTR_RFC3686),
#else
{"LTC_CTR_MODE", 0},
#endif
#ifdef LTC_GCM_MODE
C_STRINGIFY(LTC_GCM_MODE_IV),
C_STRINGIFY(LTC_GCM_MODE_AAD),
C_STRINGIFY(LTC_GCM_MODE_TEXT),
#endif
C_STRINGIFY(LTC_MP_LT),
C_STRINGIFY(LTC_MP_EQ),
C_STRINGIFY(LTC_MP_GT),
C_STRINGIFY(LTC_MP_NO),
C_STRINGIFY(LTC_MP_YES),
C_STRINGIFY(MAXBLOCKSIZE),
C_STRINGIFY(TAB_SIZE),
C_STRINGIFY(ARGTYPE),
#ifdef LTM_DESC
{"LTM_DESC", 1},
#else
{"LTM_DESC", 0},
#endif
#ifdef TFM_DESC
{"TFM_DESC", 1},
#else
{"TFM_DESC", 0},
#endif
#ifdef GMP_DESC
{"GMP_DESC", 1},
#else
{"GMP_DESC", 0},
#endif
#ifdef LTC_FAST
{"LTC_FAST", 1},
#else
{"LTC_FAST", 0},
#endif
#ifdef LTC_NO_FILE
{"LTC_NO_FILE", 1},
#else
{"LTC_NO_FILE", 0},
#endif
#ifdef ENDIAN_LITTLE
{"ENDIAN_LITTLE", 1},
#else
{"ENDIAN_LITTLE", 0},
#endif
#ifdef ENDIAN_BIG
{"ENDIAN_BIG", 1},
#else
{"ENDIAN_BIG", 0},
#endif
#ifdef ENDIAN_32BITWORD
{"ENDIAN_32BITWORD", 1},
#else
{"ENDIAN_32BITWORD", 0},
#endif
#ifdef ENDIAN_64BITWORD
{"ENDIAN_64BITWORD", 1},
#else
{"ENDIAN_64BITWORD", 0},
#endif
#ifdef ENDIAN_NEUTRAL
{"ENDIAN_NEUTRAL", 1},
#else
{"ENDIAN_NEUTRAL", 0},
#endif
};
/* crypt_get_constant()
* valueout will be the value of the named constant
* return -1 if named item not found
*/
int crypt_get_constant(const char* namein, int *valueout) {
int i;
int count = sizeof(s_crypt_constants) / sizeof(s_crypt_constants[0]);
for (i=0; i<count; i++) {
if (XSTRCMP(s_crypt_constants[i].name, namein) == 0) {
*valueout = s_crypt_constants[i].value;
return 0;
}
}
return 1;
}
/* crypt_list_all_constants()
* if names_list is NULL, names_list_size will be the minimum
* number of bytes needed to receive the complete names_list
* if names_list is NOT NULL, names_list must be the addr of
* sufficient memory allocated into which the names_list
* is to be written. Also, the value in names_list_size
* sets the upper bound of the number of characters to be
* written.
* a -1 return value signifies insufficient space made available
*/
int crypt_list_all_constants(char *names_list, unsigned int *names_list_size) {
int i;
unsigned int total_len = 0;
char *ptr;
int number_len;
int count = sizeof(s_crypt_constants) / sizeof(s_crypt_constants[0]);
/* calculate amount of memory required for the list */
for (i=0; i<count; i++) {
number_len = snprintf(NULL, 0, "%s,%d\n", s_crypt_constants[i].name, s_crypt_constants[i].value);
if (number_len < 0) {
return -1;
}
total_len += number_len;
}
if (names_list == NULL) {
*names_list_size = total_len;
} else {
if (total_len > *names_list_size) {
return -1;
}
/* build the names list */
ptr = names_list;
for (i=0; i<count; i++) {
number_len = snprintf(ptr, total_len, "%s,%d\n", s_crypt_constants[i].name, s_crypt_constants[i].value);
if (number_len < 0) return -1;
if ((unsigned int)number_len > total_len) return -1;
total_len -= number_len;
ptr += number_len;
}
/* to remove the trailing new-line */
ptr -= 1;
*ptr = 0;
}
return 0;
}
| 24.996564 | 116 | 0.675007 |
eac7627f046af4fe7f338af9a585999b5196991f | 4,394 | h | C | pagespeed/kernel/image/pixel_format_optimizer.h | PeterDaveHello/incubator-pagespeed-mod | 885f4653e204e1152cb3928f0755d93ec5fdceae | [
"Apache-2.0"
] | null | null | null | pagespeed/kernel/image/pixel_format_optimizer.h | PeterDaveHello/incubator-pagespeed-mod | 885f4653e204e1152cb3928f0755d93ec5fdceae | [
"Apache-2.0"
] | null | null | null | pagespeed/kernel/image/pixel_format_optimizer.h | PeterDaveHello/incubator-pagespeed-mod | 885f4653e204e1152cb3928f0755d93ec5fdceae | [
"Apache-2.0"
] | 1 | 2020-05-20T07:09:05.000Z | 2020-05-20T07:09:05.000Z | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 PAGESPEED_KERNEL_IMAGE_PIXEL_FORMAT_OPTIMIZER_H_
#define PAGESPEED_KERNEL_IMAGE_PIXEL_FORMAT_OPTIMIZER_H_
#include <cstddef>
#include "pagespeed/kernel/base/basictypes.h"
#include "pagespeed/kernel/base/message_handler.h"
#include "pagespeed/kernel/base/scoped_ptr.h"
#include "pagespeed/kernel/image/image_util.h"
#include "pagespeed/kernel/image/scanline_interface.h"
#include "pagespeed/kernel/image/scanline_status.h"
namespace pagespeed {
namespace image_compression {
// PixelFormatOptimizer removes an unused channel from the image. This
// corresponds to changing the pixel format to a more compact one.
// Currently it only removes opaque alpha channel and changes RGBA_8888
// to RGB_888.
//
// To determine if a channel is unused, PixelFormatOptimizer has to examine
// every pixel in the image. Thus, the entire image may be buffered before
// the first output scanline can be retrieved. However, as soon as
// PixelFormatOptimizer finds a pixel with all channels used, it will stop
// buffering and become ready to serve the first scanline.
//
// TODO(huibao): Check how often gray scale images are encoded as color. If it
// happens often, implement the conversion of RGBA_8888/RGB_888 to GRAY_8.
class PixelFormatOptimizer : public ScanlineReaderInterface {
public:
explicit PixelFormatOptimizer(net_instaweb::MessageHandler* handler);
virtual ~PixelFormatOptimizer();
// PixelFormatOptimizer acquires ownership of reader, even in case of failure.
ScanlineStatus Initialize(ScanlineReaderInterface* reader);
virtual ScanlineStatus ReadNextScanlineWithStatus(void** out_scanline_bytes);
// Resets the resizer to its initial state. Always returns true.
virtual bool Reset();
// Returns number of bytes required to store a scanline.
virtual size_t GetBytesPerScanline() {
return bytes_per_row_;
}
// Returns true if there are more scanlines to read. Returns false if the
// object has not been initialized or all of the scanlines have been read.
virtual bool HasMoreScanLines() {
return (output_row_ < GetImageHeight());
}
// Returns the height of the image.
virtual size_t GetImageHeight() {
return reader_->GetImageHeight();
}
// Returns the width of the image.
virtual size_t GetImageWidth() {
return reader_->GetImageWidth();
}
// Returns the pixel format of the image.
virtual PixelFormat GetPixelFormat() {
return pixel_format_;
}
// Returns true if the image is encoded in progressive / interlacing format.
virtual bool IsProgressive() {
return reader_->IsProgressive();
}
// This method should not be called. If it does get called, in DEBUG mode it
// will throw a FATAL error and in RELEASE mode it does nothing.
virtual ScanlineStatus InitializeWithStatus(const void* image_buffer,
size_t buffer_length);
private:
net_instaweb::scoped_ptr<ScanlineReaderInterface> reader_;
size_t bytes_per_row_;
PixelFormat pixel_format_;
size_t output_row_;
bool strip_alpha_;
bool was_initialized_;
// Buffer for storing decoded scanlines.
net_instaweb::scoped_array<uint8_t> input_lines_;
// Number of rows which have been examined and buffered.
size_t input_row_;
// Buffer for storing a single converted scanline.
net_instaweb::scoped_array<uint8_t> output_line_;
net_instaweb::MessageHandler* message_handler_;
DISALLOW_COPY_AND_ASSIGN(PixelFormatOptimizer);
};
} // namespace image_compression
} // namespace pagespeed
#endif // PAGESPEED_KERNEL_IMAGE_PIXEL_FORMAT_OPTIMIZER_H_
| 35.435484 | 80 | 0.762403 |
eac9672314f8d411a4fba52272487d185f6dfd29 | 2,383 | h | C | TILVBDemo/TILVBDemo/WebService/WebModels.h | XibHe/TILVBDemo | e82980dc1557e83c1bdc9d097a555eea833003b5 | [
"MIT"
] | null | null | null | TILVBDemo/TILVBDemo/WebService/WebModels.h | XibHe/TILVBDemo | e82980dc1557e83c1bdc9d097a555eea833003b5 | [
"MIT"
] | null | null | null | TILVBDemo/TILVBDemo/WebService/WebModels.h | XibHe/TILVBDemo | e82980dc1557e83c1bdc9d097a555eea833003b5 | [
"MIT"
] | null | null | null | //
// WebModels.h
// TCShow
//
// Created by AlexiChen on 15/11/12.
// Copyright © 2015年 AlexiChen. All rights reserved.
//
#import <Foundation/Foundation.h>
//@interface ShowRoomInfo : NSObject
//
//@property (nonatomic, copy) NSString * title;
//@property (nonatomic, copy) NSString * type;
//@property (nonatomic, assign) NSInteger roomnum;
//@property (nonatomic, copy) NSString * groupid;
//@property (nonatomic, copy) NSString * cover;
//@property (nonatomic, copy) NSString * host;
//@property (nonatomic, assign) NSInteger appid;
//@property (nonatomic, assign) int thumbup;//点赞数
//@property (nonatomic, assign) int memsize;//观看人数
//@property (nonatomic, assign) NSInteger device;
//@property (nonatomic, assign) NSInteger videotype;
//
//@property (nonatomic, strong) NSString *roleName;
//
//- (NSDictionary *)toRoomDic;
//
//@end
//@interface HostLBS : NSObject
//
//@property (nonatomic, assign) float latitude;
//@property (nonatomic, assign) float longitude;
//@property (nonatomic, copy) NSString *address;
//
//- (NSDictionary *)toLBSDic;
//
//@end
//@interface TCShowLiveListItem : NSObject
//
//@property (nonatomic, copy) NSString *uid;
//@property (nonatomic, strong) ShowRoomInfo *info;
//
////@property (nonatomic, strong) HostLBS *lbs;
//
//+ (instancetype)loadFromToLocal;
//
//- (void)saveToLocal;
//- (void)cleanLocalData;
//
//- (NSDictionary *)toLiveStartJson;
//- (NSDictionary *)toHeartBeatJson;
//
//@end
@interface RecordVideoItem : NSObject
@property (nonatomic, copy) NSString *uid;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, copy) NSString *cover;
@property (nonatomic, copy) NSString *videoId;
@property (nonatomic, strong) NSMutableArray *playurl;
@property (nonatomic, strong) NSString *createTime;//时间戳
@property (nonatomic, strong) NSString *duration;//单位:秒
@property (nonatomic, strong) NSString *fileSize;//单位:字节
@end
@interface MemberListItem : NSObject
@property (nonatomic, copy) NSString *identifier;
@property (nonatomic, assign) int role;
//业务逻辑需要
@property (nonatomic, assign) BOOL isUpVideo;
@end
@interface LiveStreamListItem : NSObject
@property (nonatomic, copy) NSString *uid;
@property (nonatomic, copy) NSString *cover;
@property (nonatomic, copy) NSString *address;//拼接地址
@property (nonatomic, copy) NSString *address2;//拼接地址
@property (nonatomic, copy) NSString *address3;//拼接地址
@end
| 26.477778 | 56 | 0.723877 |
eacab676aade9d31c9d701d3519426de7cfa0e20 | 39,736 | c | C | src/core/sis_dynamic.c | meagon/sisdb | dd029f66cf093be33ff683873124840f6f3a0f8d | [
"MIT"
] | null | null | null | src/core/sis_dynamic.c | meagon/sisdb | dd029f66cf093be33ff683873124840f6f3a0f8d | [
"MIT"
] | null | null | null | src/core/sis_dynamic.c | meagon/sisdb | dd029f66cf093be33ff683873124840f6f3a0f8d | [
"MIT"
] | null | null | null |
#include "sis_dynamic.h"
#include <sis_sds.h>
#include <sis_math.h>
#include <sis_time.h>
////////////////////////////////
//
///////////////////////////////
int _sis_dynamic_get_style(const char *str_)
{
if(!sis_strcasecmp(str_,"int")||!sis_strcasecmp(str_,"I"))
{
return SIS_DYNAMIC_TYPE_INT;
}
if(!sis_strcasecmp(str_,"msec")||!sis_strcasecmp(str_,"T"))
{
return SIS_DYNAMIC_TYPE_TICK;
}
if(!sis_strcasecmp(str_,"sec")||!sis_strcasecmp(str_,"S"))
{
return SIS_DYNAMIC_TYPE_SEC;
}
if(!sis_strcasecmp(str_,"minute")||!sis_strcasecmp(str_,"M"))
{
return SIS_DYNAMIC_TYPE_MINU;
}
if(!sis_strcasecmp(str_,"date")||!sis_strcasecmp(str_,"D"))
{
return SIS_DYNAMIC_TYPE_DATE;
}
if(!sis_strcasecmp(str_,"uint")||!sis_strcasecmp(str_,"U"))
{
return SIS_DYNAMIC_TYPE_UINT;
}
if(!sis_strcasecmp(str_,"float")||!sis_strcasecmp(str_,"F"))
{
return SIS_DYNAMIC_TYPE_FLOAT;
}
if(!sis_strcasecmp(str_,"char")||!sis_strcasecmp(str_,"C"))
{
return SIS_DYNAMIC_TYPE_CHAR;
}
if(!sis_strcasecmp(str_,"price")||!sis_strcasecmp(str_,"P"))
{
return SIS_DYNAMIC_TYPE_PRICE;
}
return SIS_DYNAMIC_TYPE_NONE;
}
////////////////////////////////////////////////////////////////
// s_sis_dynamic_field
////////////////////////////////////////////////////////////////
s_sis_dynamic_field *sis_dynamic_field_create(char *name_)
{
s_sis_dynamic_field *o = SIS_MALLOC(s_sis_dynamic_field, o);
sis_strcpy(o->fname, 32, name_);
return o;
}
void sis_dynamic_field_destroy(void *field_)
{
s_sis_dynamic_field *field = (s_sis_dynamic_field *)field_;
sis_free(field);
}
////////////////////////////////////////////////////////////////
// s_sis_dynamic_db
////////////////////////////////////////////////////////////////
s_sis_dynamic_db *sis_dynamic_db_create(s_sis_json_node *node_)
{
s_sis_json_node *fields = sis_json_cmp_child_node(node_, "fields");
if (!fields)
{
return NULL;
}
s_sis_dynamic_db *dyna = SIS_MALLOC(s_sis_dynamic_db, dyna);
dyna->name = sis_sdsnew(node_->key);
dyna->fields = sis_map_list_create(sis_dynamic_field_destroy);
dyna->field_solely = sis_pointer_list_create();
int offset = 0;
s_sis_json_node *node = sis_json_first_node(fields);
while (node)
{
char *name = node->key;
if (!name)
{
node = sis_json_next_node(node);
continue;
}
int style = _sis_dynamic_get_style(sis_json_get_str(node, "0"));
// printf("style: %s %s : %s %s %s -- %c\n",
// node->key, name,
// sis_json_get_str(node, "0"),
// sis_json_get_str(node, "1"),
// sis_json_get_str(node, "2"),
// style);
if (style == SIS_DYNAMIC_TYPE_NONE)
{
node = sis_json_next_node(node);
continue;
}
int len = sis_json_get_int(node, "1", 4);
if (len > SIS_DYNAMIC_FIELD_LIMIT || len < 1)
{
node = sis_json_next_node(node);
continue;
}
int count = sis_json_get_int(node, "2", 1);
if (count > SIS_DYNAMIC_FIELD_LIMIT || count < 1)
{
node = sis_json_next_node(node);
continue;
}
int dot = sis_json_get_int(node, "3", 0);
if (style == SIS_DYNAMIC_TYPE_PRICE && dot == 0)
{
dot = 3;
}
const char *flag = sis_json_get_str(node, "4");
// 到此认为数据合法
s_sis_dynamic_field *unit = sis_dynamic_field_create(name);
unit->style = style;
unit->len = len;
unit->dot = dot;
unit->count = count;
unit->mindex = (flag && (strchr(flag, 'I') || strchr(flag, 'i'))) ? 1 : 0;
unit->solely = (flag && (strchr(flag, 'O') || strchr(flag, 'o'))) ? 1 : 0;
unit->offset = offset;
// printf("%s : %c %d %d %d\n",name, unit->style,unit->len,unit->offset,unit->count);
offset += unit->len * unit->count;
sis_map_list_set(dyna->fields, name, unit);
if (!dyna->field_time &&
(unit->style == SIS_DYNAMIC_TYPE_SEC ||
unit->style == SIS_DYNAMIC_TYPE_TICK ||
unit->style == SIS_DYNAMIC_TYPE_MINU ||
unit->style == SIS_DYNAMIC_TYPE_DATE))
{
dyna->field_time = unit;
}
if (unit->mindex)
{
dyna->field_mindex = unit;
}
if (unit->solely)
{
sis_pointer_list_push(dyna->field_solely, unit);
}
node = sis_json_next_node(node);
}
if (offset == 0)
{
sis_map_list_destroy(dyna->fields);
sis_free(dyna);
return NULL;
}
dyna->size = offset;
// if have time field, than must set main index is it.
if (dyna->field_time)
{
dyna->field_mindex = dyna->field_time;
}
LOG(5)("dyna->size ---%s %d %p\n", dyna->name, dyna->size, dyna);
return dyna;
}
void sis_dynamic_db_destroy(void *db_)
{
s_sis_dynamic_db *db = (s_sis_dynamic_db *)db_;
// printf("dyna->free --- %s \n", db->name);
sis_sdsfree(db->name);
sis_map_list_destroy(db->fields);
sis_pointer_list_destroy(db->field_solely);
sis_free(db);
}
s_sis_dynamic_field *sis_dynamic_db_get_field(s_sis_dynamic_db *db_, int *index_, const char *field_)
{
s_sis_dynamic_field *field = sis_map_list_get(db_->fields, field_);
if (!index_ || field)
{
return field;
}
char argv[2][128];
int cmds = sis_str_divide(field_, '.', argv[0], argv[1]);
field = sis_map_list_get(db_->fields, argv[0]);
if (cmds != 2 || !field)
{
return NULL;
}
*index_ = (int)sis_atoll(argv[1]);
return field;
}
s_sis_sds sis_dynamic_dbinfo_to_conf(s_sis_dynamic_db *db_, s_sis_sds in_)
{
in_ = sis_sdscatfmt(in_, "%s:", db_->name);
in_ = sis_sdscat(in_, "{fields:{");
char sign[5];
int fnums = sis_map_list_getsize(db_->fields);
for(int i = 0; i < fnums; i++)
{
s_sis_dynamic_field *unit= (s_sis_dynamic_field *)sis_map_list_geti(db_->fields, i);
if(!unit) continue;
if (i > 0)
{
in_ = sis_sdscat(in_, ",");
}
in_ = sis_sdscatfmt(in_, "%s:[", unit->fname);
sign[0] = unit->style; sign[1] = 0;
in_ = sis_sdscatfmt(in_, "%s", sign);
in_ = sis_sdscatfmt(in_, ",%u", unit->len);
int index = 0;
if (unit->mindex)
{
sign[index] = 'I'; index++;
}
if (unit->solely)
{
sign[index] = 'O'; index++;
}
sign[index] = 0;
if (sign[0])
{
in_ = sis_sdscatfmt(in_, ",%u", unit->count);
in_ = sis_sdscatfmt(in_, ",%u", unit->dot);
in_ = sis_sdscatfmt(in_, "%s", sign);
}
else
{
if (unit->dot > 0)
{
in_ = sis_sdscatfmt(in_, ",%u", unit->count);
in_ = sis_sdscatfmt(in_, ",%u", unit->dot);
}
else
{
if (unit->count > 0)
{
in_ = sis_sdscatfmt(in_, ",%u", unit->count);
}
}
}
in_ = sis_sdscat(in_, "]");
}
in_ = sis_sdscat(in_, "}}");
return in_;
}
bool sis_dynamic_dbinfo_same(s_sis_dynamic_db *db1_, s_sis_dynamic_db *db2_)
{
int fnums = sis_map_list_getsize(db1_->fields);
// printf("%s %s : %d %d\n", db1_->name, db2_->name, fnums, sis_map_list_getsize(db2_->fields));
if(fnums != sis_map_list_getsize(db2_->fields))
{
return false;
}
for (int i = 0; i < fnums; i++)
{
s_sis_dynamic_field *unit1 = (s_sis_dynamic_field *)sis_map_list_geti(db1_->fields, i);
s_sis_dynamic_field *unit2 = (s_sis_dynamic_field *)sis_map_list_geti(db2_->fields, i);
if(!unit1||!unit2)
{
return false;
}
// sis_out_binary("1", unit1, sizeof(s_sis_dynamic_field));
// sis_out_binary("2", unit2, sizeof(s_sis_dynamic_field));
if (memcmp(unit1, unit2, sizeof(s_sis_dynamic_field)))
{
return false;
}
}
return true;
}
s_sis_json_node *sis_dynamic_dbinfo_to_json(s_sis_dynamic_db *db_)
{
s_sis_json_node *jone = sis_json_create_object();
s_sis_json_node *jfields = sis_json_create_object();
// 先处理字段
char sign[5];
int index = 0;
int fnums = sis_map_list_getsize(db_->fields);
for (int i = 0; i < fnums; i++)
{
s_sis_dynamic_field *inunit = (s_sis_dynamic_field *)sis_map_list_geti(db_->fields, i);
if(!inunit) continue;
s_sis_json_node *jfield = sis_json_create_array();
// sis_json_array_add_uint(jfield, i);
sign[0] = inunit->style; sign[1] = 0;
sis_json_array_add_string(jfield, sign, 1);
sis_json_array_add_uint(jfield, inunit->len);
index = 0;
if (inunit->mindex)
{
sign[index] = 'I'; index++;
}
if (inunit->solely)
{
sign[index] = 'O'; index++;
}
sign[index] = 0;
if (sign[0])
{
sis_json_array_add_uint(jfield, inunit->count);
sis_json_array_add_uint(jfield, inunit->dot);
sis_json_array_add_string(jfield, sign, index);
}
else
{
if (inunit->dot > 0)
{
sis_json_array_add_uint(jfield, inunit->count);
sis_json_array_add_uint(jfield, inunit->dot);
}
else
{
if (inunit->count > 0)
{
sis_json_array_add_uint(jfield, inunit->count);
}
}
}
sis_json_object_add_node(jfields, inunit->fname, jfield);
}
sis_json_object_add_node(jone, "fields", jfields);
return jone;
}
msec_t sis_dynamic_db_get_time(s_sis_dynamic_db *db_, int index_, void *in_, size_t ilen_)
{
if (!db_->field_time || !in_ || ilen_ % db_->size || ( index_ + 1 ) * db_->size > ilen_)
{
return 0;
}
return _sis_field_get_uint(db_->field_time, (const char*)in_ + index_ * db_->size, 0);
}
uint64 sis_dynamic_db_get_mindex(s_sis_dynamic_db *db_, int index_, void *in_, size_t ilen_)
{
if (!db_->field_mindex || !in_ || ilen_ % db_->size || ( index_ + 1 ) * db_->size > ilen_)
{
return 0;
}
return _sis_field_get_uint(db_->field_mindex, (const char*)in_ + index_ * db_->size, 0);
}
s_sis_sds sis_dynamic_db_to_array_sds(s_sis_dynamic_db *db_, const char *key_, void *in_, size_t ilen_)
{
s_sis_dynamic_db *indb = db_;
int count = (int)(ilen_ / indb->size);
int fnums = sis_map_list_getsize(indb->fields);
if (count < 1 || fnums < 1)
{
return NULL;
}
s_sis_json_node *jone = sis_json_create_object();
s_sis_json_node *jtwo = sis_json_create_array();
// printf("to array : fnum = %d count = %d \n", fnums, count);
const char *val = (const char *)in_;
for (int k = 0; k < count; k++)
{
s_sis_json_node *jval = sis_json_create_array();
for (int i = 0; i < fnums; i++)
{
s_sis_dynamic_field *inunit = (s_sis_dynamic_field *)sis_map_list_geti(indb->fields, i);
sis_dynamic_field_to_array(jval, inunit, val);
}
if (count == 1)
{
sis_json_delete_node(jtwo);
jtwo = jval;
}
else
{
sis_json_array_add_node(jtwo, jval);
}
val += indb->size;
}
// printf("to array : fnum = %d count = %d \n", fnums, count);
s_sis_sds o = NULL;
if (key_)
{
sis_json_object_add_node(jone, key_, jtwo);
o = sis_json_to_sds(jone, true);
}
else
{
o = sis_json_to_sds(jtwo, true);
}
sis_json_delete_node(jone);
return o;
}
s_sis_sds sis_dynamic_db_to_csv_sds(s_sis_dynamic_db *db_, void *in_, size_t ilen_)
{
s_sis_dynamic_db *indb = db_;
int count = (int)(ilen_ / indb->size);
s_sis_sds o = sis_sdsempty();
int fnums = sis_map_list_getsize(indb->fields);
const char *val = (const char *)in_;
for (int k = 0; k < count; k++)
{
for (int i = 0; i < fnums; i++)
{
s_sis_dynamic_field *inunit = (s_sis_dynamic_field *)sis_map_list_geti(indb->fields, i);
o = sis_dynamic_field_to_csv(o, inunit, val);
}
o = sis_csv_make_end(o);
val += indb->size;
}
return o;
}
s_sis_sds sis_dynamic_conf_to_array_sds(const char *confstr_, void *in_, size_t ilen_)
{
s_sis_conf_handle *injson = sis_conf_load(confstr_, strlen(confstr_));
if (!injson)
{
return NULL;
}
s_sis_dynamic_db *indb = sis_dynamic_db_create(injson->node);
if (!indb)
{
LOG(1)("init db error.\n");
sis_conf_close(injson);
return NULL;
}
sis_conf_close(injson);
s_sis_sds o = sis_dynamic_db_to_array_sds(indb, indb->name, in_, ilen_);
sis_dynamic_db_destroy(indb);
return o;
}
// 类型和长度一样,数量可能不一样
void _sis_dynamic_unit_copy(void *inunit_, void *in_, void *out_)
{
s_sis_dynamic_field *inunit = ((s_sis_dynamic_field_convert *)inunit_)->in_field;
s_sis_dynamic_field *outunit = ((s_sis_dynamic_field_convert *)inunit_)->out_field;
int count = sis_min(inunit->count, outunit->count);
memmove((char *)out_ + outunit->offset, (char *)in_ + inunit->offset, inunit->len * count);
// printf("convert : %c %c %d %d\n", inunit->style, outunit->style, inunit->offset, outunit->offset);
// if (outunit->count > count)
// {
// memmove((char *)out_+outunit->offset + outunit->len*count,
// 0, outunit->len*(outunit->count - count));
// }
}
uint64 _sis_time_unit_convert(int instyle, int outstyle, uint64 in64)
{
uint64 u64 = in64;
switch (instyle)
{
case SIS_DYNAMIC_TYPE_SEC:
switch (outstyle)
{
case SIS_DYNAMIC_TYPE_TICK: u64 = in64 * 1000; break;
case SIS_DYNAMIC_TYPE_MINU: u64 = in64 / 60; break;
case SIS_DYNAMIC_TYPE_DATE: u64 = sis_time_get_idate(in64); break;
}
break;
case SIS_DYNAMIC_TYPE_TICK:
switch (outstyle)
{
case SIS_DYNAMIC_TYPE_SEC: u64 = in64 / 1000; break;
case SIS_DYNAMIC_TYPE_MINU: u64 = in64 / 1000 / 60; break;
case SIS_DYNAMIC_TYPE_DATE: u64 = sis_time_get_idate(in64 / 1000); break;
}
break;
case SIS_DYNAMIC_TYPE_MINU:
switch (outstyle)
{
case SIS_DYNAMIC_TYPE_TICK: u64 = in64 * 60 * 1000; break;
case SIS_DYNAMIC_TYPE_SEC: u64 = in64 * 60; break;
case SIS_DYNAMIC_TYPE_DATE: u64 = sis_time_get_idate(in64 * 60); break;
}
break;
case SIS_DYNAMIC_TYPE_DATE:
switch (outstyle)
{
case SIS_DYNAMIC_TYPE_TICK: u64 = sis_time_make_time(in64, 120000) * 1000; break;
case SIS_DYNAMIC_TYPE_SEC: u64 = sis_time_make_time(in64, 120000); break;
case SIS_DYNAMIC_TYPE_MINU: u64 = sis_time_make_time(in64, 120000) / 60; break;
}
break;
}
return u64;
}
// 类型一样,长度不同,数量可能不同
void _sis_dynamic_unit_convert(void *inunit_,void *in_, void *out_)
{
s_sis_dynamic_field *inunit = ((s_sis_dynamic_field_convert *)inunit_)->in_field;
s_sis_dynamic_field *outunit = ((s_sis_dynamic_field_convert *)inunit_)->out_field;
int count = sis_min(inunit->count, outunit->count);
int64 i64 = 0;
uint64 u64 = 0;
float64 f64 =0.0;
for(int i = 0; i < count; i++)
{
switch (inunit->style)
{
case SIS_DYNAMIC_TYPE_INT:
{
i64 = _sis_field_get_int(inunit, in_, i);
// printf("convert : %c %c %d\n", inunit->style, outunit->style, (int)i64);
switch (outunit->style)
{
case SIS_DYNAMIC_TYPE_INT:
case SIS_DYNAMIC_TYPE_PRICE:
_sis_field_set_int(outunit, (char *)out_, i64, i);
break;
case SIS_DYNAMIC_TYPE_SEC:
case SIS_DYNAMIC_TYPE_TICK:
case SIS_DYNAMIC_TYPE_MINU:
case SIS_DYNAMIC_TYPE_DATE:
case SIS_DYNAMIC_TYPE_UINT:
_sis_field_set_uint(outunit, (char *)out_, (uint64)i64, i);
break;
case SIS_DYNAMIC_TYPE_FLOAT:
_sis_field_set_float(outunit, (char *)out_, (double)i64, i);
break;
case SIS_DYNAMIC_TYPE_CHAR:
// 不支持
break;
}
}
break;
case SIS_DYNAMIC_TYPE_SEC:
case SIS_DYNAMIC_TYPE_TICK:
case SIS_DYNAMIC_TYPE_MINU:
case SIS_DYNAMIC_TYPE_DATE:
case SIS_DYNAMIC_TYPE_UINT:
{
u64 = _sis_field_get_uint(inunit, in_, i);
switch (outunit->style)
{
case SIS_DYNAMIC_TYPE_INT:
case SIS_DYNAMIC_TYPE_PRICE:
_sis_field_set_int(outunit, (char *)out_, (int64)u64, i);
break;
case SIS_DYNAMIC_TYPE_SEC:
case SIS_DYNAMIC_TYPE_TICK:
case SIS_DYNAMIC_TYPE_MINU:
case SIS_DYNAMIC_TYPE_DATE:
u64 = _sis_time_unit_convert(inunit->style, outunit->style, u64);
_sis_field_set_uint(outunit, (char *)out_, u64, i);
break;
case SIS_DYNAMIC_TYPE_UINT:
_sis_field_set_uint(outunit, (char *)out_, u64, i);
break;
case SIS_DYNAMIC_TYPE_FLOAT:
_sis_field_set_float(outunit, (char *)out_, (double)u64, i);
break;
case SIS_DYNAMIC_TYPE_CHAR:
// 不支持
break;
}
}
break;
case SIS_DYNAMIC_TYPE_FLOAT:
{
f64 = _sis_field_get_float(inunit, in_, i);
switch (outunit->style)
{
case SIS_DYNAMIC_TYPE_INT:
_sis_field_set_int(outunit, (char *)out_, (int64)f64, i);
break;
case SIS_DYNAMIC_TYPE_SEC:
case SIS_DYNAMIC_TYPE_TICK:
case SIS_DYNAMIC_TYPE_MINU:
case SIS_DYNAMIC_TYPE_DATE:
case SIS_DYNAMIC_TYPE_UINT:
_sis_field_set_uint(outunit, (char *)out_, (uint64)f64, i);
break;
case SIS_DYNAMIC_TYPE_FLOAT:
_sis_field_set_float(outunit, (char *)out_, (double)f64, i);
break;
case SIS_DYNAMIC_TYPE_PRICE:
// 这里特殊处理一下
_sis_field_set_price(outunit, (char *)out_, (double)f64, i);
break;
case SIS_DYNAMIC_TYPE_CHAR:
// 不支持
break;
}
}
break;
case SIS_DYNAMIC_TYPE_PRICE:
{
f64 = _sis_field_get_price(inunit, in_, i);
switch (outunit->style)
{
case SIS_DYNAMIC_TYPE_INT:
_sis_field_set_int(outunit, (char *)out_, (int64)f64, i);
break;
case SIS_DYNAMIC_TYPE_SEC:
case SIS_DYNAMIC_TYPE_TICK:
case SIS_DYNAMIC_TYPE_MINU:
case SIS_DYNAMIC_TYPE_DATE:
case SIS_DYNAMIC_TYPE_UINT:
_sis_field_set_uint(outunit, (char *)out_, (uint64)f64, i);
break;
case SIS_DYNAMIC_TYPE_FLOAT:
_sis_field_set_float(outunit, (char *)out_, (double)f64, i);
break;
case SIS_DYNAMIC_TYPE_PRICE:
// 这里特殊处理一下
_sis_field_set_price(outunit, (char *)out_, (double)f64, i);
break;
case SIS_DYNAMIC_TYPE_CHAR:
// 不支持
break;
}
}
break;
case SIS_DYNAMIC_TYPE_CHAR:
// 字符串只能和字符串互转
if (outunit->style == SIS_DYNAMIC_TYPE_CHAR)
{
size_t len = sis_min(inunit->len, outunit->len);
memmove((char *)out_+outunit->offset + i*outunit->len,
(char *)in_+inunit->offset + i*inunit->len,
len);
// if(outunit->len < inunit->len)
// {
// //设置结束符
// char *out = (char *)out_+outunit->offset + (i+1)*outunit->len - 1;
// *out = 0;
// }
}
break;
default:
break;
}
}
}
void _sis_dynamic_method_copy(void *convert_, void *in_, size_t ilen_, void *out_, size_t olen_)
{
// printf("_sis_dynamic_method_copy ------ \n");
memmove((char *)out_, (char *)in_, olen_);
}
void _sis_dynamic_method_owner(void *convert_, void *in_, size_t ilen_, void *out_, size_t olen_)
{
// printf("_sis_dynamic_method_owner ------ \n");
s_sis_dynamic_convert *convert = (s_sis_dynamic_convert *)convert_;
s_sis_dynamic_db *indb = convert->in;
s_sis_dynamic_db *outdb = convert->out;
memset(out_, 0, olen_);
const char *inptr = (const char *)in_;
char *outptr = (char *)out_;
int count = ilen_/indb->size;
int fnums = sis_map_list_getsize(convert->map_fields);
for(int i = 0; i < count; i++)
{
for(int k = 0; k < fnums; k++)
{
s_sis_dynamic_field_convert *curunit = (s_sis_dynamic_field_convert *)sis_map_list_geti(convert->map_fields, k);
if(curunit && curunit->cb_shift)
{
// printf("shift ------ \n");
curunit->cb_shift(curunit, (void *)inptr, (void *)outptr);
}
}
inptr += indb->size;
outptr += outdb->size;
}
}
s_sis_sds sis_json_to_sds(s_sis_json_node *node_, bool iszip_)
{
char *str = NULL;
size_t olen;
if (iszip_)
{
str = sis_json_output_zip(node_, &olen);
}
else
{
str = sis_json_output(node_, &olen);
}
s_sis_sds o = sis_sdsnewlen(str, olen);
sis_free(str);
return o;
}
////////////////////////////////////////////////////
// 单个db转换为其他结构 传入需要转换的db
////////////////////////////////////////////////////
void _sis_dynamic_match(s_sis_dynamic_convert *convert_)
{
convert_->cb_convert = _sis_dynamic_method_copy;
bool change = false;
s_sis_dynamic_db *in = convert_->in;
s_sis_dynamic_db *out = convert_->out;
int rfnums = sis_map_list_getsize(out->fields);
if( out->size != in->size || rfnums != sis_map_list_getsize(in->fields) )
{
change = true;
}
// 只要下面没有字段不一致,就需要赋值为 SIS_DYNAMIC_METHOD_OWNER
for (int i = 0; i < rfnums; i++)
{
s_sis_dynamic_field *outunit = (s_sis_dynamic_field *)sis_map_list_geti(out->fields, i);
s_sis_dynamic_field *inunit = (s_sis_dynamic_field *)sis_map_list_get(in->fields, outunit->fname);
s_sis_dynamic_field_convert *curunit = SIS_MALLOC(s_sis_dynamic_field_convert, curunit);
curunit->out_field = outunit;
curunit->in_field = inunit;
curunit->cb_shift = NULL;
sis_map_list_set(convert_->map_fields, outunit->fname, curunit);
if(inunit)
{
if (inunit->style != outunit->style)
{
change = true;
curunit->cb_shift = _sis_dynamic_unit_convert;
// printf("shift: convert \n");
}
else if (inunit->len != outunit->len)
{
// 类型一样 长度不同,数量可能不同
change = true;
curunit->cb_shift = _sis_dynamic_unit_convert;
// printf("shift: convert \n");
}
else if (inunit->count != outunit->count)
{
change = true;
curunit->cb_shift = _sis_dynamic_unit_copy;
}
else
{
curunit->cb_shift = _sis_dynamic_unit_copy;
// printf("shift: copy \n");
}
}
// printf("inunit: %s -> %s \n", inunit->name, outunit->name);
}
if (change)
{
convert_->cb_convert = _sis_dynamic_method_owner;
}
}
s_sis_dynamic_convert *sis_dynamic_convert_create(s_sis_dynamic_db *in_, s_sis_dynamic_db *out_)
{
s_sis_dynamic_convert *o = SIS_MALLOC(s_sis_dynamic_convert, o);
o->map_fields = sis_map_list_create(sis_free_call);
o->in = in_;
o->out = out_;
_sis_dynamic_match(o);
return o;
}
void sis_dynamic_convert_destroy(void *convert_)
{
s_sis_dynamic_convert *convert = (s_sis_dynamic_convert *)convert_;
sis_map_list_destroy(convert->map_fields);
sis_free(convert);
}
size_t sis_dynamic_convert_length(s_sis_dynamic_convert *cls_, const char *in_, size_t ilen_)
{
cls_->error = SIS_DYNAMIC_OK;
if (!in_||!ilen_)
{
cls_->error = SIS_DYNAMIC_ERR;
goto error;
}
int count = ilen_/cls_->in->size;
if (count * cls_->in->size != ilen_)
{
// 来源数据尺寸不匹配
cls_->error = SIS_DYNAMIC_SIZE;
goto error;
}
return count * cls_->out->size;
error:
return 0;
}
// 返回0表示数据处理正常,解析数据要记得释放内存
int sis_dynamic_convert(s_sis_dynamic_convert *cls_,
const char *in_, size_t ilen_, char *out_, size_t olen_)
{
cls_->error = SIS_DYNAMIC_OK;
if (!in_ || !ilen_ || !out_ || !olen_)
{
cls_->error = SIS_DYNAMIC_ERR;
goto error;
}
s_sis_dynamic_db *indb = cls_->in;
s_sis_dynamic_db *outdb = cls_->out;
int count = ilen_ / indb->size;
if (count * indb->size != ilen_)
{
// 来源数据尺寸不匹配
cls_->error = SIS_DYNAMIC_SIZE;
goto error;
}
if (count * outdb->size != olen_)
{
cls_->error = SIS_DYNAMIC_LEN;
goto error;
}
if (!cls_->cb_convert)
{
// 本地端版本滞后,无法解析远端的数据格式
cls_->error = SIS_DYNAMIC_NOOPPO;
goto error;
}
cls_->cb_convert(cls_, (void *)in_, ilen_, out_, olen_);
// printf("command : %d * %d = %d --> %d\n", count , indb->size, (int)ilen_, outdb->size);
error:
return cls_->error;
}
// match_keys : * --> whole_keys
// match_keys : k,m1 | whole_keys : k1,k2,m1,m2 --> k1,k2,m1
s_sis_sds sis_match_key(s_sis_sds match_keys, s_sis_sds whole_keys)
{
s_sis_sds o = NULL;
if (!sis_strcasecmp(match_keys, "*"))
{
o = sis_sdsdup(whole_keys);
}
else
{
s_sis_string_list *slist = sis_string_list_create();
sis_string_list_load(slist, whole_keys, sis_sdslen(whole_keys), ",");
for (int i = 0; i < sis_string_list_getsize(slist); i++)
{
const char *key = sis_string_list_get(slist, i);
int index = sis_str_subcmp(key, match_keys, ',');
if (index >= 0)
{
if (o)
{
o = sis_sdscatfmt(o, ",%s", key);
}
else
{
o = sis_sdsnew(key);
}
}
}
sis_string_list_destroy(slist);
}
return o;
}
s_sis_sds sis_match_sdb(s_sis_sds match_sdbs, s_sis_sds whole_sdbs)
{
s_sis_sds o = NULL;
s_sis_json_handle *injson = sis_json_load(whole_sdbs, sis_sdslen(whole_sdbs));
if (!injson)
{
o = sis_sdsdup(match_sdbs);
}
else
{
s_sis_json_node *innode = sis_json_first_node(injson->node);
while (innode)
{
if (!sis_strcasecmp(match_sdbs, "*") || sis_str_subcmp_strict(innode->key, match_sdbs, ',') >= 0)
{
if (!o)
{
o = sis_sdsnew(innode->key);
}
else
{
o = sis_sdscatfmt(o, ",%s", innode->key);
}
}
innode = sis_json_next_node(innode);
}
sis_json_close(injson);
}
return o;
}
s_sis_sds sis_match_sdb_of_sds(s_sis_sds match_sdbs, s_sis_sds whole_sdbs)
{
s_sis_sds o = NULL;
if (!sis_strcasecmp(match_sdbs, "*"))
{
o = sis_sdsdup(whole_sdbs);
}
else
{
s_sis_json_handle *injson = sis_json_load(whole_sdbs, sis_sdslen(whole_sdbs));
if (!injson)
{
o = sis_sdsdup(whole_sdbs);
}
else
{
s_sis_json_node *innode = sis_json_first_node(injson->node);
s_sis_json_node *next = innode;
while (innode)
{
int index = sis_str_subcmp_strict(innode->key, match_sdbs, ',');
if (index < 0)
{
next = sis_json_next_node(innode);
// 这里删除
sis_json_delete_node(innode);
innode = next;
}
else
{
innode = sis_json_next_node(innode);
}
}
o = sis_json_to_sds(injson->node, 1);
sis_json_close(injson);
}
}
return o;
}
s_sis_sds sis_match_sdb_of_map(s_sis_sds match_sdbs, s_sis_map_list *whole_sdbs)
{
s_sis_json_node *innode = sis_json_create_object();
int count = sis_map_list_getsize(whole_sdbs);
for (int i = 0; i < count; i++)
{
s_sis_dynamic_db *db = sis_map_list_geti(whole_sdbs, i);
int index = sis_str_subcmp_strict(db->name, match_sdbs, ',');
if (index < 0)
{
continue;
}
sis_json_object_add_node(innode, db->name, sis_dynamic_dbinfo_to_json(db));
}
s_sis_sds o = sis_json_to_sds(innode, 1);
sis_json_delete_node(innode);
return o;
}
// s_sis_dynamic_class *_sis_dynamic_class_create(s_sis_json_node *innode_,s_sis_json_node *outnode_)
// {
// s_sis_dynamic_class *class = (s_sis_dynamic_class *)sis_malloc(sizeof(s_sis_dynamic_class));
// memset(class, 0, sizeof(s_sis_dynamic_class));
// class->remote = sis_map_pointer_create();
// s_sis_json_node *innode = sis_json_first_node(innode_);
// while (innode)
// {
// s_sis_dynamic_db *dynamic = sis_dynamic_db_create(innode);
// if (!dynamic)
// {
// continue;
// }
// sis_map_pointer_set(class->remote, innode->key, dynamic);
// innode = sis_json_next_node(innode);
// }
// class->local = sis_map_pointer_create();
// s_sis_json_node *outnode = sis_json_first_node(outnode_);
// while (outnode)
// {
// s_sis_dynamic_db *dynamic = sis_dynamic_db_create(outnode);
// if (!dynamic)
// {
// continue;
// }
// sis_map_pointer_set(class->local, outnode->key, dynamic);
// outnode = sis_json_next_node(outnode);
// }
// //// 下面开始处理关联性的信息 //////
// {
// s_sis_dict_entry *de;
// s_sis_dict_iter *di = sis_dict_get_iter(class->remote);
// while ((de = sis_dict_next(di)) != NULL)
// {
// s_sis_dynamic_db *remote = (s_sis_dynamic_db *)sis_dict_getval(de);
// s_sis_dynamic_db *local = sis_map_pointer_get(class->local, sis_dict_getkey(de));
// _sis_dynamic_match(remote, local);
// }
// sis_dict_iter_free(di);
// }
// {
// s_sis_dict_entry *de;
// s_sis_dict_iter *di = sis_dict_get_iter(class->local);
// while ((de = sis_dict_next(di)) != NULL)
// {
// s_sis_dynamic_db *local = (s_sis_dynamic_db *)sis_dict_getval(de);
// s_sis_dynamic_db *remote = sis_map_pointer_get(class->remote, sis_dict_getkey(de));
// _sis_dynamic_match(local, remote);
// }
// sis_dict_iter_free(di);
// }
// //////////////////////////////////
// return class;
// }
// s_sis_dynamic_class *sis_dynamic_class_create_of_conf(
// const char *remote_,size_t rlen_,
// const char *local_,size_t llen_)
// {
// s_sis_conf_handle *injson = sis_conf_load(remote_, rlen_);
// s_sis_conf_handle *outjson = sis_conf_load(local_, llen_);
// if (!injson||!outjson)
// {
// sis_conf_close(injson);
// sis_conf_close(outjson);
// return NULL;
// }
// s_sis_dynamic_class *class = _sis_dynamic_class_create(injson->node, outjson->node);
// sis_conf_close(injson);
// sis_conf_close(outjson);
// return class;
// }
// s_sis_dynamic_class *sis_dynamic_class_create_of_conf_file(
// const char *rfile_,const char *lfile_)
// {
// s_sis_conf_handle *injson = sis_conf_open(rfile_);
// s_sis_conf_handle *outjson = sis_conf_open(lfile_);
// if (!injson||!outjson)
// {
// sis_conf_close(injson);
// sis_conf_close(outjson);
// return NULL;
// }
// s_sis_dynamic_class *class = _sis_dynamic_class_create(injson->node, outjson->node);
// sis_conf_close(injson);
// sis_conf_close(outjson);
// return class;
// }
// // 收到server的结构体说明后,初始化一次,后面就不用再匹配了
// s_sis_dynamic_class *sis_dynamic_class_create_of_json(
// const char *remote_,size_t rlen_,
// const char *local_,size_t llen_)
// {
// s_sis_json_handle *injson = sis_json_load(remote_, rlen_);
// s_sis_json_handle *outjson = sis_json_load(local_, llen_);
// if (!injson||!outjson)
// {
// sis_json_close(injson);
// sis_json_close(outjson);
// return NULL;
// }
// s_sis_dynamic_class *class = _sis_dynamic_class_create(injson->node, outjson->node);
// sis_json_close(injson);
// sis_json_close(outjson);
// return class;
// }
// s_sis_dynamic_class *sis_dynamic_class_create_of_json_file(
// const char *rfile_,const char *lfile_)
// {
// s_sis_json_handle *injson = sis_json_open(rfile_);
// s_sis_json_handle *outjson = sis_json_open(lfile_);
// if (!injson||!outjson)
// {
// sis_json_close(injson);
// sis_json_close(outjson);
// return NULL;
// }
// s_sis_dynamic_class *class = _sis_dynamic_class_create(injson->node, outjson->node);
// sis_json_close(injson);
// sis_json_close(outjson);
// return class;
// }
// void sis_dynamic_class_destroy(s_sis_dynamic_class *cls_)
// {
// if (!cls_)
// {
// return ;
// }
// {
// s_sis_dict_entry *de;
// s_sis_dict_iter *di = sis_dict_get_iter(cls_->remote);
// while ((de = sis_dict_next(di)) != NULL)
// {
// s_sis_dynamic_db *val = (s_sis_dynamic_db *)sis_dict_getval(de);
// sis_dynamic_db_destroy(val);
// }
// sis_dict_iter_free(di);
// }
// sis_map_pointer_destroy(cls_->remote);
// {
// s_sis_dict_entry *de;
// s_sis_dict_iter *di = sis_dict_get_iter(cls_->local);
// while ((de = sis_dict_next(di)) != NULL)
// {
// s_sis_dynamic_db *val = (s_sis_dynamic_db *)sis_dict_getval(de);
// sis_dynamic_db_destroy(val);
// }
// sis_dict_iter_free(di);
// }
// sis_map_pointer_destroy(cls_->local);
// sis_free(cls_);
// }
// // 返回0表示数据处理正常,解析数据要记得释放内存
// int sis_dynamic_analysis(
// s_sis_dynamic_class *cls_,
// const char *key_, int dir_,
// const char *in_, size_t ilen_,
// char *out_, size_t olen_)
// {
// cls_->error = SIS_DYNAMIC_OK;
// if (!in_||!ilen_||!out_||!olen_)
// {
// cls_->error = SIS_DYNAMIC_ERR;
// goto error;
// }
// s_sis_dynamic_db *indb = NULL;
// if (dir_ == SIS_DYNAMIC_DIR_LTOR)
// {
// indb = sis_map_pointer_get(cls_->local, key_);
// }
// else
// {
// indb = sis_map_pointer_get(cls_->remote, key_);
// }
// if (!indb)
// {
// // 传入的数据在远端定义中没有发现
// cls_->error = SIS_DYNAMIC_NOKEY;
// goto error;
// }
// if (!indb->map_db)
// {
// // 传入的数据在没有对应的本地结构定义
// cls_->error = SIS_DYNAMIC_NOOPPO;
// goto error;
// }
// s_sis_dynamic_db *outdb = (s_sis_dynamic_db *)indb->map_db;
// int count = ilen_/indb->size;
// if (count*indb->size != ilen_)
// {
// // 来源数据尺寸不匹配
// cls_->error = SIS_DYNAMIC_SIZE;
// goto error;
// }
// if (count*outdb->size != olen_)
// {
// cls_->error = SIS_DYNAMIC_LEN;
// goto error;
// }
// if (!indb->method)
// {
// // 本地端版本滞后,无法解析远端的数据格式
// cls_->error = SIS_DYNAMIC_NOOPPO;
// goto error;
// }
// indb->method(indb, (void *)in_, ilen_, out_, olen_);
// // printf("command : %d * %d = %d --> %d\n", count , indb->size, (int)ilen_, outdb->size);
// error:
// return cls_->error;
// }
// // 远程结构转本地结构
// size_t sis_dynamic_analysis_length(
// s_sis_dynamic_class *cls_,
// const char *key_, int dir_,
// const char *in_, size_t ilen_)
// {
// cls_->error = SIS_DYNAMIC_OK;
// if (!in_||!ilen_)
// {
// cls_->error = SIS_DYNAMIC_ERR;
// goto error;
// }
// s_sis_dynamic_db *indb = NULL;
// if (dir_ == SIS_DYNAMIC_DIR_LTOR)
// {
// indb = sis_map_pointer_get(cls_->local, key_);
// }
// else
// {
// indb = sis_map_pointer_get(cls_->remote, key_);
// }
// if (!indb)
// {
// // 传入的数据在远端定义中没有发现
// cls_->error = SIS_DYNAMIC_NOKEY;
// goto error;
// }
// if (!indb->map_db)
// {
// // 传入的数据在没有对应的本地结构定义
// cls_->error = SIS_DYNAMIC_NOOPPO;
// goto error;
// }
// int count = ilen_/indb->size;
// // printf("%d * %d = %d --> %d\n", count , indb->size, (int)ilen_, indb->map_db->size);
// if (count*indb->size != ilen_)
// {
// // 来源数据尺寸不匹配
// cls_->error = SIS_DYNAMIC_SIZE;
// goto error;
// }
// return count*indb->map_db->size;
// error:
// return 0;
// }
// // 本地数据转远程结构
// size_t sis_dynamic_analysis_ltor_length(
// s_sis_dynamic_class *cls_,
// const char *key_,
// const char *in_, size_t ilen_)
// {
// return sis_dynamic_analysis_length(cls_, key_, SIS_DYNAMIC_DIR_LTOR, in_, ilen_);
// }
// int sis_dynamic_analysis_ltor(
// s_sis_dynamic_class *cls_,
// const char *key_,
// const char *in_, size_t ilen_,
// char *out_, size_t olen_)
// {
// return sis_dynamic_analysis(cls_, key_, SIS_DYNAMIC_DIR_LTOR, in_, ilen_, out_, olen_);
// }
// // 远程结构转本地结构
// size_t sis_dynamic_analysis_rtol_length(
// s_sis_dynamic_class *cls_,
// const char *key_,
// const char *in_, size_t ilen_)
// {
// return sis_dynamic_analysis_length(cls_, key_, SIS_DYNAMIC_DIR_RTOL, in_, ilen_);
// }
// int sis_dynamic_analysis_rtol(
// s_sis_dynamic_class *cls_,
// const char *key_,
// const char *in_, size_t ilen_,
// char *out_, size_t olen_)
// {
// return sis_dynamic_analysis(cls_, key_, SIS_DYNAMIC_DIR_RTOL, in_, ilen_, out_, olen_);
// }
// void f2d( float f , double *x )
// {
// uint32 a , b;
// uint32 uf = *(uint32*)&f;
// uint32*ux = (uint32*)x;
// ux[0] = ux[1] = 0;
// ux[1] |= uf&0x80000000;
// a = (uf&0x7f800000)>>23;
// b = uf&0x7fffff;
// a += 1024 - 128;
// ux[1] |= a<<20;
// ux[1] |= b>>3 ;
// ux[0] |= b<<29;
// }
// // 调用该函数,需要释放内存
// s_sis_sds sis_dynamic_struct_to_json(
// s_sis_dynamic_class *cls_,
// const char *key_, int dir_,
// const char *in_, size_t ilen_)
// {
// s_sis_sds o = NULL;
// cls_->error = SIS_DYNAMIC_OK;
// if (!in_||!ilen_)
// {
// cls_->error = SIS_DYNAMIC_ERR;
// goto error;
// }
// s_sis_dynamic_db *indb = NULL;
// if (dir_ == SIS_DYNAMIC_DIR_LTOR)
// {
// indb = sis_map_pointer_get(cls_->local, key_);
// }
// else
// {
// indb = sis_map_pointer_get(cls_->remote, key_);
// }
// if (!indb)
// {
// // 传入的数据在远端定义中没有发现
// cls_->error = SIS_DYNAMIC_NOKEY;
// goto error;
// }
// s_sis_json_node *jone = sis_json_create_object();
// s_sis_json_node *jtwo = sis_json_create_array();
// s_sis_json_node *jfields = sis_json_create_object();
// // 先处理字段
// char sign[2];
// int fnums = sis_map_list_getsize(indb->fields);
// for (int i = 0; i < fnums; i++)
// {
// s_sis_dynamic_field *inunit = (s_sis_dynamic_field *)sis_map_list_geti(indb->fields, i);
// if(!inunit) continue;
// s_sis_json_node *jfield = sis_json_create_array();
// // sis_json_array_add_uint(jfield, i);
// sign[0] = inunit->style; sign[1] = 0;
// sis_json_array_add_string(jfield, sign, 1);
// sis_json_array_add_uint(jfield, inunit->len);
// sis_json_array_add_uint(jfield, inunit->count);
// sis_json_array_add_uint(jfield, inunit->dot);
// sis_json_object_add_node(jfields, inunit->name, jfield);
// }
// sis_json_object_add_node(jone, "fields", jfields);
// int count = (int)(ilen_ / indb->size);
// // printf("%d * %d = %d\n", count , indb->size, (int)ilen_);
// const char *val = in_;
// for (int k = 0; k < count; k++)
// {
// s_sis_json_node *jval = sis_dynamic_struct_to_array(indb, val);
// sis_json_array_add_node(jtwo, jval);
// val += indb->size;
// }
// sis_json_object_add_node(jone, "values", jtwo);
// // size_t ll;
// // printf("jone = %s\n", sis_json_output(jone, &ll));
// // 输出数据
// // printf("1112111 [%d]\n",tb->control.limits);
// char *str;
// size_t olen;
// str = sis_json_output(jone, &olen);
// o = sis_sdsnewlen(str, olen);
// sis_free(str);
// sis_json_delete_node(jone);
// error:
// return o;
// }
#if 0
#pragma pack(push,1)
typedef struct _local_info {
int open;
double close;
int ask[5];
char name[4];
} _local_info;
typedef struct _remote_info {
uint64 open;
float close;
int ask[10];
char name[8];
int agop;
} _remote_info;
#pragma pack(pop)
int main()
{
char argv[2][32];
sis_str_divide("123.234.456.789", '.', argv[0], argv[1]);
printf("%s %s\n", argv[0], argv[1]);
const char *test_indb = "{stock:{fields:{open:[I,4],close:[F,8,1,3],ask:[I,4,5],name:[C,4]}}}";
const char *test_outdb = "{stock:{fields:{open:[U,8],close:[F,4,1,2],ask:[I,4,10],name:[C,8],agop:[I,4]}}}";
s_sis_conf_handle *injson = sis_conf_load(test_indb, strlen(test_indb));
s_sis_dynamic_db *indb = sis_dynamic_db_create(sis_json_first_node(injson->node));
sis_conf_close(injson);
s_sis_conf_handle *outjson = sis_conf_load(test_outdb, strlen(test_outdb));
s_sis_dynamic_db *outdb = sis_dynamic_db_create(sis_json_first_node(outjson->node));
sis_conf_close(outjson);
int count = 2;
_local_info in_info[count];
in_info[0].open = 1111;
in_info[1].open = 2222;
in_info[0].close = 0xFFFFFFFFFFFFFFFF;
in_info[1].close = 4444;
for (size_t i = 0; i < 5; i++)
{
in_info[0].ask[i] = 100 + i;
in_info[1].ask[i] = 200 + i;
}
sprintf(in_info[0].name, "123");
sprintf(in_info[1].name, "2345");
s_sis_sds in = sis_dynamic_db_to_array_sds(indb, "stock", in_info, count*sizeof(_local_info));
printf("indb = \n%s\n",in);
sis_sdsfree(in);
s_sis_dynamic_convert *convert = sis_dynamic_convert_create(indb, outdb);
size_t size = sis_dynamic_convert_length(convert, (const char *)in_info, count*sizeof(_local_info));
char *out_info = sis_malloc(size + 1);
sis_dynamic_convert(convert, (const char *)in_info, count*sizeof(_local_info), out_info, size);
s_sis_sds out = sis_dynamic_db_to_array_sds(outdb, "stock", out_info, size);
printf("outdb = \n%s\n",out);
sis_sdsfree(out);
sis_free(out_info);
sis_dynamic_convert_destroy(convert);
sis_dynamic_db_destroy(indb);
sis_dynamic_db_destroy(outdb);
return 0;
}
#endif
| 27.556172 | 116 | 0.622559 |
eacb2a1459795038745827fe9a1db01359c61149 | 1,626 | c | C | go2_fw/ap/gnuboy/sys/linux/joy.c | chcbaram/odroid_go_adv | caa921b1237d335d156bebbd94a46ddc92693743 | [
"Apache-2.0"
] | 3 | 2019-09-26T14:59:29.000Z | 2020-06-15T06:41:35.000Z | go2_fw/ap/gnuboy/sys/linux/joy.c | chcbaram/odroid_go_adv | caa921b1237d335d156bebbd94a46ddc92693743 | [
"Apache-2.0"
] | null | null | null | go2_fw/ap/gnuboy/sys/linux/joy.c | chcbaram/odroid_go_adv | caa921b1237d335d156bebbd94a46ddc92693743 | [
"Apache-2.0"
] | 3 | 2019-11-15T10:55:03.000Z | 2020-07-04T13:39:30.000Z |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char *strdup();
#include <linux/joystick.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include "input.h"
#include "rc.h"
static int usejoy = 1;
static char *joydev;
static int joyfd = -1;
static int pos[2], max[2], min[2];
static const int axis[2][2] =
{
{ K_JOYLEFT, K_JOYRIGHT },
{ K_JOYUP, K_JOYDOWN }
};
rcvar_t joy_exports[] =
{
RCV_BOOL("joy", &usejoy),
RCV_STRING("joy_device", &joydev),
RCV_END
};
void joy_init()
{
if (!usejoy) return;
if (!joydev) joydev = strdup("/dev/js0");
joyfd = open(joydev, O_RDONLY|O_NONBLOCK);
}
void joy_close()
{
close(joyfd);
}
void joy_poll()
{
struct js_event js;
event_t ev;
int n;
if (joyfd < 0) return;
while (read(joyfd,&js,sizeof(struct js_event)) == sizeof(struct js_event))
{
switch(js.type)
{
case JS_EVENT_BUTTON:
ev.type = js.value ? EV_PRESS : EV_RELEASE;
ev.code = K_JOY0 + js.number;
ev_postevent(&ev);
break;
case JS_EVENT_AXIS:
n = js.number & 1;
if (js.value < min[n]) min[n] = js.value;
else if(js.value > max[n]) max[n] = js.value;
ev.code = axis[n][0];
if(js.value < (min[n]>>2) && js.value < pos[n])
{
ev.type = EV_PRESS;
ev_postevent(&ev);
}
else if (js.value > pos[n])
{
ev.type = EV_RELEASE;
ev_postevent(&ev);
}
ev.code = axis[n][1];
if(js.value > (max[n]>>2) && js.value > pos[n])
{
ev.type = EV_PRESS;
ev_postevent(&ev);
}
else if (js.value < pos[n])
{
ev.type = EV_RELEASE;
ev_postevent(&ev);
}
pos[n] = js.value;
}
}
}
| 17.297872 | 75 | 0.601476 |
eacb923d9d087dced44439c3e2deb90b3e605dc2 | 48,788 | h | C | Example/Pods/Headers/Public/Tempo_ios_sdk/CartoMobileSDK/assets/gdal/coordinate_axis_csv.h | jesusgeographica/pruebaSDK | 329f6b27674137fda682cd1e974c2bb6b5901d99 | [
"MIT"
] | null | null | null | Example/Pods/Headers/Public/Tempo_ios_sdk/CartoMobileSDK/assets/gdal/coordinate_axis_csv.h | jesusgeographica/pruebaSDK | 329f6b27674137fda682cd1e974c2bb6b5901d99 | [
"MIT"
] | null | null | null | Example/Pods/Headers/Public/Tempo_ios_sdk/CartoMobileSDK/assets/gdal/coordinate_axis_csv.h | jesusgeographica/pruebaSDK | 329f6b27674137fda682cd1e974c2bb6b5901d99 | [
"MIT"
] | null | null | null | unsigned char _coordinate_axis_csv[] = {
0x63, 0x6f, 0x6f, 0x72, 0x64, 0x5f, 0x73, 0x79, 0x73, 0x5f, 0x63, 0x6f,
0x64, 0x65, 0x2c, 0x63, 0x6f, 0x6f, 0x72, 0x64, 0x5f, 0x61, 0x78, 0x69,
0x73, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x2c,
0x63, 0x6f, 0x6f, 0x72, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6f,
0x72, 0x69, 0x65, 0x6e, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x63,
0x6f, 0x6f, 0x72, 0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x61, 0x62,
0x62, 0x72, 0x65, 0x76, 0x69, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x75,
0x6f, 0x6d, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x2c, 0x63, 0x6f, 0x6f, 0x72,
0x64, 0x5f, 0x61, 0x78, 0x69, 0x73, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72,
0x0a, 0x31, 0x30, 0x32, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65,
0x61, 0x73, 0x74, 0x2c, 0x4d, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31,
0x0a, 0x31, 0x30, 0x32, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x50, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x31, 0x30, 0x32, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x31, 0x33, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x32, 0x35, 0x2c, 0x39, 0x39, 0x30,
0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x31, 0x34, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30, 0x32, 0x36, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x32, 0x36, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c,
0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30, 0x32,
0x37, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45,
0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31, 0x30,
0x32, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74,
0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x30, 0xc2, 0xb0, 0x45,
0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30,
0x32, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x45, 0x2c, 0x39, 0x30, 0x33, 0x37, 0x2c, 0x31, 0x0a, 0x31, 0x30,
0x32, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x33, 0x37, 0x2c, 0x32, 0x0a, 0x31,
0x30, 0x32, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73,
0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x32, 0x2c, 0x32, 0x0a, 0x31,
0x30, 0x32, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x32, 0x2c, 0x31, 0x0a,
0x31, 0x30, 0x33, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x34, 0x2c, 0x75, 0x70,
0x2c, 0x48, 0x2c, 0x39, 0x30, 0x30, 0x32, 0x2c, 0x31, 0x0a, 0x31, 0x30,
0x33, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31,
0x30, 0x33, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x38, 0x2c, 0x77, 0x65, 0x73,
0x74, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31,
0x30, 0x33, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x34, 0x2c, 0x75, 0x70, 0x2c,
0x7a, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x31, 0x30, 0x33,
0x32, 0x2c, 0x39, 0x39, 0x31, 0x38, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c,
0x78, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x33,
0x32, 0x2c, 0x39, 0x39, 0x31, 0x39, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68,
0x2c, 0x79, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30,
0x33, 0x33, 0x2c, 0x39, 0x39, 0x32, 0x30, 0x2c, 0x4a, 0x2d, 0x61, 0x78,
0x69, 0x73, 0x20, 0x70, 0x6c, 0x75, 0x73, 0x20, 0x39, 0x30, 0xc2, 0xb0,
0x2c, 0x49, 0x2c, 0x31, 0x30, 0x32, 0x34, 0x2c, 0x31, 0x0a, 0x31, 0x30,
0x33, 0x33, 0x2c, 0x39, 0x39, 0x32, 0x31, 0x2c, 0x53, 0x65, 0x65, 0x20,
0x61, 0x73, 0x73, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x4a, 0x2c, 0x31,
0x30, 0x32, 0x34, 0x2c, 0x32, 0x0a, 0x31, 0x30, 0x33, 0x34, 0x2c, 0x39,
0x39, 0x32, 0x30, 0x2c, 0x4a, 0x2d, 0x61, 0x78, 0x69, 0x73, 0x20, 0x6d,
0x69, 0x6e, 0x75, 0x73, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x2c, 0x49, 0x2c,
0x31, 0x30, 0x32, 0x34, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x33, 0x34, 0x2c,
0x39, 0x39, 0x32, 0x31, 0x2c, 0x53, 0x65, 0x65, 0x20, 0x61, 0x73, 0x73,
0x6f, 0x63, 0x69, 0x61, 0x74, 0x65, 0x64, 0x20, 0x6f, 0x70, 0x65, 0x72,
0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2c, 0x4a, 0x2c, 0x31, 0x30, 0x32, 0x34,
0x2c, 0x32, 0x0a, 0x31, 0x30, 0x33, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x36,
0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x31, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x33, 0x35, 0x2c, 0x39, 0x39,
0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x59, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30, 0x33, 0x36, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x35, 0x37, 0xc2, 0xb0, 0x45, 0x2c, 0x58, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x33, 0x36, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x34, 0x37, 0xc2, 0xb0, 0x45, 0x2c,
0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30, 0x33,
0x37, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x30, 0x38, 0xc2, 0xb0,
0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x31,
0x30, 0x33, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x36, 0x32,
0xc2, 0xb0, 0x57, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32,
0x0a, 0x31, 0x30, 0x33, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x53,
0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31,
0x36, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x31, 0x30, 0x33, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x37,
0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x37, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x32, 0x0a, 0x31, 0x30, 0x33, 0x39, 0x2c, 0x39, 0x39, 0x30,
0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30,
0x32, 0x2c, 0x31, 0x0a, 0x31, 0x30, 0x33, 0x39, 0x2c, 0x39, 0x39, 0x30,
0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30,
0x30, 0x32, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x30, 0x30, 0x2c, 0x39, 0x39,
0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x30, 0x30, 0x2c, 0x39, 0x39,
0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x30, 0x31, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39,
0x30, 0x36, 0x32, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x30, 0x31, 0x2c, 0x39,
0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c,
0x39, 0x30, 0x36, 0x32, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x30, 0x32, 0x2c,
0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x34, 0x32, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x30, 0x32, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e,
0x2c, 0x39, 0x30, 0x34, 0x32, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x30, 0x33,
0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x45,
0x2c, 0x39, 0x30, 0x30, 0x35, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x30, 0x33,
0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c,
0x4e, 0x2c, 0x39, 0x30, 0x30, 0x35, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x30,
0x34, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c,
0x45, 0x2c, 0x39, 0x30, 0x39, 0x34, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x30,
0x34, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68,
0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x39, 0x34, 0x2c, 0x32, 0x0a, 0x34, 0x34,
0x30, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x45, 0x2c, 0x39, 0x30, 0x34, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34,
0x30, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x34, 0x31, 0x2c, 0x32, 0x0a, 0x34,
0x34, 0x30, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73,
0x74, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x33, 0x36, 0x2c, 0x31, 0x0a, 0x34,
0x34, 0x30, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x33, 0x36, 0x2c, 0x32, 0x0a,
0x34, 0x34, 0x30, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61,
0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x33, 0x39, 0x2c, 0x31, 0x0a,
0x34, 0x34, 0x30, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f,
0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x33, 0x39, 0x2c, 0x32,
0x0a, 0x34, 0x34, 0x30, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65,
0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x38, 0x34, 0x2c, 0x31,
0x0a, 0x34, 0x34, 0x30, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x38, 0x34, 0x2c,
0x32, 0x0a, 0x34, 0x34, 0x30, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x34, 0x30, 0x2c,
0x31, 0x0a, 0x34, 0x34, 0x30, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c,
0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x34, 0x30,
0x2c, 0x32, 0x0a, 0x34, 0x34, 0x31, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x36,
0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x45, 0x2c, 0x39, 0x33, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x34, 0x34, 0x31, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x37,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x33, 0x30,
0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x36, 0x30, 0x2c, 0x39, 0x39, 0x30,
0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45, 0x2e, 0x2c, 0x45, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36, 0x30, 0x2c, 0x39,
0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x31, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x4e,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x36, 0x31,
0x2c, 0x39, 0x39, 0x32, 0x39, 0x2c, 0x75, 0x70, 0x2c, 0x57, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x34, 0x34, 0x36, 0x31, 0x2c, 0x39,
0x39, 0x33, 0x30, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x55, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36, 0x31, 0x2c, 0x39,
0x39, 0x33, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x56, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x36, 0x32, 0x2c,
0x39, 0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x38, 0x30, 0xc2, 0xb0, 0x57, 0x2c,
0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36,
0x32, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x57,
0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34,
0x36, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74,
0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x30, 0x30, 0xc2,
0xb0, 0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a,
0x34, 0x34, 0x36, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f,
0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x37,
0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x34, 0x34, 0x36, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x39, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x37,
0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x32, 0x0a, 0x34, 0x34, 0x36, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x36,
0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x35, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36, 0x35, 0x2c, 0x39, 0x39, 0x30,
0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x31, 0x34, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x36, 0x36, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x31, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x58, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36, 0x36, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x36, 0x37,
0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20,
0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x36, 0x30, 0xc2, 0xb0, 0x57, 0x2c,
0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x36,
0x37, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x33, 0x30, 0xc2, 0xb0, 0x45,
0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34,
0x36, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74,
0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x34, 0x35, 0xc2, 0xb0,
0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34,
0x34, 0x36, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x33, 0x35,
0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32,
0x0a, 0x34, 0x34, 0x36, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x53,
0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x39,
0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x31, 0x0a, 0x34, 0x34, 0x36, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c,
0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x31, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x37, 0x30, 0x2c, 0x39, 0x39, 0x30,
0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37, 0x30, 0x2c, 0x39, 0x39,
0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x37, 0x31, 0x2c, 0x39, 0x39,
0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x37, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x45, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37, 0x31, 0x2c, 0x39,
0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x31, 0x36, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x4e,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x37, 0x32,
0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20,
0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x36, 0x30, 0xc2, 0xb0, 0x57, 0x2c,
0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37,
0x32, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x35, 0x30, 0xc2, 0xb0,
0x57, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34,
0x34, 0x37, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x34, 0x35, 0xc2,
0xb0, 0x57, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a,
0x34, 0x34, 0x37, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f,
0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x33,
0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x34, 0x34, 0x37, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x31, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x37,
0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x31, 0x30, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x4e, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x37, 0x35, 0x2c, 0x39, 0x39,
0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37, 0x35, 0x2c, 0x39, 0x39,
0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x4e, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x37, 0x36, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x31, 0x35, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37, 0x36, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x37, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x4e,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x37, 0x37,
0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20,
0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x34, 0x35, 0xc2, 0xb0, 0x45, 0x2c,
0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x37,
0x37, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x34, 0x35, 0xc2, 0xb0, 0x57,
0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34,
0x37, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74,
0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x36, 0x30, 0xc2, 0xb0,
0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34,
0x34, 0x37, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x33, 0x30, 0xc2,
0xb0, 0x57, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a,
0x34, 0x34, 0x37, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f,
0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x37, 0x35,
0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31,
0x0a, 0x34, 0x34, 0x37, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e,
0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31,
0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x34, 0x34, 0x38, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x31, 0x30, 0x35, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x38, 0x30, 0x2c, 0x39, 0x39, 0x30,
0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x31, 0x35, 0xc2, 0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x38, 0x31, 0x2c, 0x39, 0x39,
0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x31, 0x32, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x38, 0x31, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x33, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x4e,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x38, 0x32,
0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20,
0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x33, 0x35, 0xc2, 0xb0, 0x45,
0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34,
0x38, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74,
0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x34, 0x35, 0xc2, 0xb0,
0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34,
0x34, 0x38, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x36, 0x35,
0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31,
0x0a, 0x34, 0x34, 0x38, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e,
0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x37,
0x35, 0xc2, 0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x34, 0x34, 0x38, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x31, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x38, 0x34, 0x2c, 0x39, 0x39, 0x30,
0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x38, 0x35, 0x2c, 0x39, 0x39,
0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x31, 0x36, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x38, 0x35, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x30, 0x35, 0xc2, 0xb0, 0x45, 0x2c,
0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x38,
0x36, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x33, 0x35, 0xc2, 0xb0,
0x57, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34,
0x34, 0x38, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x33, 0x35,
0xc2, 0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32,
0x0a, 0x34, 0x34, 0x38, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e,
0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31,
0x32, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x34, 0x34, 0x38, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x37,
0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67,
0x20, 0x31, 0x35, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x38, 0x38, 0x2c, 0x39, 0x39,
0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f,
0x6e, 0x67, 0x20, 0x31, 0x30, 0x35, 0xc2, 0xb0, 0x57, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x38, 0x38, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x36, 0x35, 0xc2, 0xb0, 0x45, 0x2c,
0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x38,
0x39, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x36, 0x30, 0xc2, 0xb0,
0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34,
0x34, 0x38, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72,
0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x37, 0x30, 0xc2,
0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a,
0x34, 0x34, 0x39, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f,
0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x39, 0x30,
0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31,
0x0a, 0x34, 0x34, 0x39, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e,
0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x30,
0xc2, 0xb0, 0x45, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32,
0x0a, 0x34, 0x34, 0x39, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x34, 0x34, 0x39, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x38, 0x2c,
0x77, 0x65, 0x73, 0x74, 0x2c, 0x57, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x31, 0x0a, 0x34, 0x34, 0x39, 0x32, 0x2c, 0x39, 0x39, 0x31, 0x33, 0x2c,
0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20,
0x31, 0x33, 0x30, 0xc2, 0xb0, 0x57, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x39, 0x32, 0x2c, 0x39, 0x39, 0x31,
0x34, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e,
0x67, 0x20, 0x31, 0x34, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x39, 0x33, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61, 0x6c,
0x6f, 0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x45, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x39, 0x33, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x53, 0x6f, 0x75, 0x74, 0x68, 0x20, 0x61,
0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x31, 0x38, 0x30, 0xc2, 0xb0, 0x45, 0x2c,
0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x39,
0x34, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x4e, 0x6f, 0x72, 0x74, 0x68,
0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x39, 0x30, 0xc2, 0xb0, 0x45,
0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34,
0x39, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x4e, 0x6f, 0x72, 0x74,
0x68, 0x20, 0x61, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x30, 0xc2, 0xb0, 0x45,
0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34,
0x39, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x32, 0x2c, 0x31, 0x0a, 0x34, 0x34,
0x39, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x32, 0x2c, 0x32, 0x0a, 0x34,
0x34, 0x39, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73,
0x74, 0x2c, 0x45, 0x28, 0x58, 0x29, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x31, 0x0a, 0x34, 0x34, 0x39, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c,
0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4e, 0x28, 0x59, 0x29, 0x2c, 0x39,
0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x39, 0x37, 0x2c, 0x39,
0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x58, 0x2c, 0x39,
0x30, 0x30, 0x33, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x39, 0x37, 0x2c, 0x39,
0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x59, 0x2c,
0x39, 0x30, 0x30, 0x33, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x39, 0x38, 0x2c,
0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x59, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x39, 0x38, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x58,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x34, 0x39, 0x39,
0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x58,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x34, 0x39, 0x39,
0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c,
0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x35, 0x30,
0x30, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c,
0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x35, 0x30,
0x30, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68,
0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34, 0x35,
0x30, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x34,
0x35, 0x30, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x38, 0x2c, 0x77, 0x65, 0x73,
0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34,
0x35, 0x30, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61, 0x73,
0x74, 0x2c, 0x45, 0x2c, 0x39, 0x30, 0x30, 0x35, 0x2c, 0x32, 0x0a, 0x34,
0x35, 0x30, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4e, 0x2c, 0x39, 0x30, 0x30, 0x35, 0x2c, 0x31, 0x0a,
0x34, 0x35, 0x33, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65, 0x61,
0x73, 0x74, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a,
0x34, 0x35, 0x33, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f,
0x72, 0x74, 0x68, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31,
0x0a, 0x34, 0x35, 0x33, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c, 0x65,
0x61, 0x73, 0x74, 0x2c, 0x79, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32,
0x0a, 0x34, 0x35, 0x33, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x78, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x31, 0x0a, 0x34, 0x35, 0x33, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x36, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x34, 0x35, 0x33, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x37, 0x2c,
0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x34, 0x35, 0x33, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x36,
0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x39, 0x38,
0x2c, 0x32, 0x0a, 0x34, 0x35, 0x33, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x37,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x39,
0x38, 0x2c, 0x31, 0x0a, 0x34, 0x35, 0x33, 0x34, 0x2c, 0x39, 0x39, 0x30,
0x36, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x6e, 0x6f, 0x6e, 0x65, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x34, 0x35, 0x33, 0x34, 0x2c,
0x39, 0x39, 0x30, 0x37, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x6e,
0x6f, 0x6e, 0x65, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36,
0x34, 0x30, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x38, 0x2c,
0x31, 0x0a, 0x36, 0x34, 0x30, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31,
0x30, 0x38, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x30, 0x31, 0x2c, 0x39, 0x39,
0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x33, 0x0a, 0x36, 0x34, 0x30, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x31,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39,
0x31, 0x30, 0x38, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x30, 0x32, 0x2c, 0x39,
0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e,
0x67, 0x2c, 0x39, 0x31, 0x30, 0x38, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x30,
0x33, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68,
0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x35, 0x2c, 0x31, 0x0a,
0x36, 0x34, 0x30, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61,
0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x35,
0x2c, 0x32, 0x0a, 0x36, 0x34, 0x30, 0x34, 0x2c, 0x39, 0x39, 0x32, 0x36,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39,
0x31, 0x32, 0x32, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x30, 0x34, 0x2c, 0x39,
0x39, 0x32, 0x37, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e,
0x67, 0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x30,
0x34, 0x2c, 0x39, 0x39, 0x32, 0x38, 0x2c, 0x75, 0x70, 0x2c, 0x52, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x30, 0x35, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x32, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x30, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x32, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x30, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x31,
0x36, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x30, 0x36, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x31, 0x36, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x30, 0x37, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x31, 0x37, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x30, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x31, 0x37, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x30, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x31,
0x35, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x30, 0x38, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x31, 0x35, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x30, 0x39, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x31, 0x38, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x30, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x31, 0x38, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x31, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x31,
0x39, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x31, 0x30, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x31, 0x39, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x31, 0x31, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x37, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x31, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x37, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x31, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x32,
0x30, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x31, 0x32, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x32, 0x30, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x31, 0x33, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x32, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x31, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x32, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x31, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75,
0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36,
0x34, 0x31, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x31, 0x36, 0x2c,
0x31, 0x0a, 0x36, 0x34, 0x31, 0x34, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31,
0x31, 0x36, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x31, 0x34, 0x2c, 0x39, 0x39,
0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x33, 0x0a, 0x36, 0x34, 0x31, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x31,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39,
0x31, 0x31, 0x37, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x31, 0x35, 0x2c, 0x39,
0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e,
0x67, 0x2c, 0x39, 0x31, 0x31, 0x37, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x31,
0x35, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x31, 0x36, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x31, 0x35, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x31, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x31, 0x35, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x31, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75,
0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36,
0x34, 0x31, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x31, 0x38, 0x2c,
0x31, 0x0a, 0x36, 0x34, 0x31, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31,
0x31, 0x38, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x31, 0x37, 0x2c, 0x39, 0x39,
0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x33, 0x0a, 0x36, 0x34, 0x31, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x31,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39,
0x31, 0x31, 0x39, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x31, 0x38, 0x2c, 0x39,
0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e,
0x67, 0x2c, 0x39, 0x31, 0x31, 0x39, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x31,
0x38, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x31, 0x39, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x37, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x31, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x37, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x31, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75,
0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36,
0x34, 0x32, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x32, 0x30, 0x2c,
0x31, 0x0a, 0x36, 0x34, 0x32, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31,
0x32, 0x30, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x32, 0x30, 0x2c, 0x39, 0x39,
0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x33, 0x0a, 0x36, 0x34, 0x32, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x31,
0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39,
0x31, 0x30, 0x35, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x32, 0x31, 0x2c, 0x39,
0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e,
0x67, 0x2c, 0x39, 0x31, 0x30, 0x35, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x32,
0x31, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c,
0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x32, 0x32, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x31, 0x0a, 0x36, 0x34,
0x32, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x32,
0x0a, 0x36, 0x34, 0x32, 0x33, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x32,
0x32, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x32, 0x33, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x32, 0x32, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x32, 0x33, 0x2c,
0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x32, 0x34, 0x2c, 0x39, 0x39,
0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74,
0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x32, 0x34,
0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c,
0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x31, 0x0a, 0x36,
0x34, 0x32, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x35, 0x2c,
0x32, 0x0a, 0x36, 0x34, 0x32, 0x35, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c,
0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31,
0x30, 0x35, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x32, 0x36, 0x2c, 0x39, 0x39,
0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74,
0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x32, 0x36,
0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c,
0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x32, 0x32, 0x2c, 0x31, 0x0a, 0x36,
0x34, 0x32, 0x36, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c,
0x68, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x32,
0x37, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68,
0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x35, 0x2c, 0x32, 0x0a,
0x36, 0x34, 0x32, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61,
0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x35,
0x2c, 0x31, 0x0a, 0x36, 0x34, 0x32, 0x37, 0x2c, 0x39, 0x39, 0x30, 0x33,
0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33,
0x0a, 0x36, 0x34, 0x32, 0x38, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x32, 0x38, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x32, 0x39, 0x2c,
0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c,
0x61, 0x74, 0x2c, 0x39, 0x31, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x34,
0x32, 0x39, 0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74,
0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x31, 0x2c, 0x31,
0x0a, 0x36, 0x34, 0x33, 0x30, 0x2c, 0x39, 0x39, 0x30, 0x31, 0x2c, 0x6e,
0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74, 0x2c, 0x39, 0x31, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x33, 0x30, 0x2c, 0x39, 0x39, 0x30,
0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c, 0x6f, 0x6e, 0x67, 0x2c,
0x39, 0x31, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x33, 0x30, 0x2c,
0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c, 0x68, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x33, 0x31, 0x2c, 0x39, 0x39,
0x30, 0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x4c, 0x61, 0x74,
0x2c, 0x39, 0x31, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x34, 0x33, 0x31,
0x2c, 0x39, 0x39, 0x30, 0x32, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4c,
0x6f, 0x6e, 0x67, 0x2c, 0x39, 0x31, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36,
0x34, 0x33, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x33, 0x2c, 0x75, 0x70, 0x2c,
0x68, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a, 0x36, 0x34, 0x39,
0x35, 0x2c, 0x39, 0x39, 0x30, 0x35, 0x2c, 0x64, 0x6f, 0x77, 0x6e, 0x2c,
0x44, 0x2c, 0x39, 0x30, 0x30, 0x32, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x39,
0x36, 0x2c, 0x39, 0x39, 0x30, 0x34, 0x2c, 0x75, 0x70, 0x2c, 0x48, 0x2c,
0x39, 0x30, 0x39, 0x35, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x39, 0x37, 0x2c,
0x39, 0x39, 0x30, 0x34, 0x2c, 0x75, 0x70, 0x2c, 0x48, 0x2c, 0x39, 0x30,
0x30, 0x33, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x39, 0x38, 0x2c, 0x39, 0x39,
0x30, 0x35, 0x2c, 0x64, 0x6f, 0x77, 0x6e, 0x2c, 0x44, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36, 0x34, 0x39, 0x39, 0x2c, 0x39, 0x39,
0x30, 0x34, 0x2c, 0x75, 0x70, 0x2c, 0x48, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x30, 0x2c, 0x39, 0x39, 0x31, 0x30,
0x2c, 0x47, 0x65, 0x6f, 0x63, 0x65, 0x6e, 0x74, 0x72, 0x65, 0x20, 0x3e,
0x20, 0x65, 0x71, 0x75, 0x61, 0x74, 0x6f, 0x72, 0x2f, 0x30, 0xc2, 0xb0,
0x45, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36,
0x35, 0x30, 0x30, 0x2c, 0x39, 0x39, 0x31, 0x31, 0x2c, 0x47, 0x65, 0x6f,
0x63, 0x65, 0x6e, 0x74, 0x72, 0x65, 0x20, 0x3e, 0x20, 0x65, 0x71, 0x75,
0x61, 0x74, 0x6f, 0x72, 0x2f, 0x39, 0x30, 0xc2, 0xb0, 0x45, 0x2c, 0x59,
0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x30,
0x2c, 0x39, 0x39, 0x31, 0x32, 0x2c, 0x47, 0x65, 0x6f, 0x63, 0x65, 0x6e,
0x74, 0x72, 0x65, 0x20, 0x3e, 0x20, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x20,
0x70, 0x6f, 0x6c, 0x65, 0x2c, 0x5a, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x33, 0x0a, 0x36, 0x35, 0x30, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x38, 0x2c,
0x77, 0x65, 0x73, 0x74, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c,
0x32, 0x0a, 0x36, 0x35, 0x30, 0x31, 0x2c, 0x39, 0x39, 0x30, 0x39, 0x2c,
0x73, 0x6f, 0x75, 0x74, 0x68, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x30, 0x31,
0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x38,
0x2c, 0x77, 0x65, 0x73, 0x74, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x33, 0x31,
0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x32, 0x2c, 0x39, 0x39, 0x30, 0x39,
0x2c, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x2c, 0x58, 0x2c, 0x39, 0x30, 0x33,
0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x33, 0x2c, 0x39, 0x39, 0x30,
0x38, 0x2c, 0x77, 0x65, 0x73, 0x74, 0x2c, 0x59, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x33, 0x2c, 0x39, 0x39, 0x30,
0x39, 0x2c, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x2c, 0x58, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x34, 0x2c, 0x39, 0x39,
0x31, 0x38, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2d, 0x65, 0x61, 0x73,
0x74, 0x2c, 0x65, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36,
0x35, 0x30, 0x34, 0x2c, 0x39, 0x39, 0x31, 0x39, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2d, 0x77, 0x65, 0x73, 0x74, 0x2c, 0x6e, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x35, 0x2c, 0x39, 0x39,
0x31, 0x33, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2d, 0x77, 0x65, 0x73,
0x74, 0x2c, 0x6e, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36,
0x35, 0x30, 0x35, 0x2c, 0x39, 0x39, 0x31, 0x34, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2d, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x65, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x36, 0x2c, 0x39, 0x39,
0x31, 0x33, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x2d, 0x73, 0x6f, 0x75, 0x74,
0x68, 0x2d, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x49, 0x2c, 0x39, 0x32, 0x30,
0x35, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x36, 0x2c, 0x39, 0x39, 0x31,
0x34, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2d, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x2d, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4a, 0x2c, 0x39, 0x32, 0x30,
0x34, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x37, 0x2c, 0x39, 0x39, 0x31,
0x33, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2c, 0x58, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x37, 0x2c, 0x39, 0x39,
0x31, 0x34, 0x2c, 0x77, 0x65, 0x73, 0x74, 0x2c, 0x59, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x38, 0x2c, 0x39, 0x39,
0x32, 0x30, 0x2c, 0x65, 0x61, 0x73, 0x74, 0x20, 0x73, 0x6f, 0x75, 0x74,
0x68, 0x20, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x49, 0x2c, 0x39, 0x32, 0x30,
0x38, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x38, 0x2c, 0x39, 0x39, 0x32,
0x31, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x20, 0x6e, 0x6f, 0x72, 0x74,
0x68, 0x20, 0x65, 0x61, 0x73, 0x74, 0x2c, 0x4a, 0x2c, 0x39, 0x32, 0x30,
0x39, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x30, 0x39, 0x2c, 0x39, 0x39, 0x30,
0x38, 0x2c, 0x77, 0x65, 0x73, 0x74, 0x2c, 0x4d, 0x2c, 0x39, 0x30, 0x30,
0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x30, 0x39, 0x2c, 0x39, 0x39, 0x30,
0x39, 0x2c, 0x73, 0x6f, 0x75, 0x74, 0x68, 0x2c, 0x50, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x31, 0x30, 0x2c, 0x39, 0x39,
0x31, 0x38, 0x2c, 0x6e, 0x6f, 0x72, 0x74, 0x68, 0x2d, 0x65, 0x61, 0x73,
0x74, 0x2c, 0x78, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a, 0x36,
0x35, 0x31, 0x30, 0x2c, 0x39, 0x39, 0x31, 0x39, 0x2c, 0x6e, 0x6f, 0x72,
0x74, 0x68, 0x2d, 0x77, 0x65, 0x73, 0x74, 0x2c, 0x79, 0x2c, 0x39, 0x30,
0x30, 0x31, 0x2c, 0x32, 0x0a, 0x36, 0x35, 0x31, 0x31, 0x2c, 0x39, 0x39,
0x32, 0x32, 0x2c, 0x41, 0x6c, 0x6f, 0x6e, 0x67, 0x20, 0x72, 0x65, 0x63,
0x65, 0x69, 0x76, 0x65, 0x72, 0x20, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x2c,
0x49, 0x2c, 0x39, 0x32, 0x30, 0x38, 0x2c, 0x31, 0x0a, 0x36, 0x35, 0x31,
0x31, 0x2c, 0x39, 0x39, 0x32, 0x33, 0x2c, 0x41, 0x63, 0x72, 0x6f, 0x73,
0x73, 0x20, 0x72, 0x65, 0x63, 0x65, 0x69, 0x76, 0x65, 0x72, 0x20, 0x6c,
0x69, 0x6e, 0x65, 0x73, 0x2c, 0x4a, 0x2c, 0x39, 0x32, 0x30, 0x39, 0x2c,
0x32, 0x0a, 0x36, 0x35, 0x31, 0x32, 0x2c, 0x39, 0x39, 0x31, 0x36, 0x2c,
0x75, 0x70, 0x2c, 0x7a, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x33, 0x0a,
0x36, 0x35, 0x31, 0x32, 0x2c, 0x39, 0x39, 0x31, 0x38, 0x2c, 0x65, 0x61,
0x73, 0x74, 0x2c, 0x78, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x31, 0x0a,
0x36, 0x35, 0x31, 0x32, 0x2c, 0x39, 0x39, 0x31, 0x39, 0x2c, 0x6e, 0x6f,
0x72, 0x74, 0x68, 0x2c, 0x79, 0x2c, 0x39, 0x30, 0x30, 0x31, 0x2c, 0x32,
0x0a
};
unsigned int coordinate_axis_csv_len = 7897;
| 73.586727 | 73 | 0.648889 |
eacfd339bd6c923f528e1f41c766f570c755c15a | 2,166 | c | C | external/source/meterpreter/source/bionic/libm/src/s_nextafterl.c | ddouhine/metasploit-framework | b03783baec87c05ffb36fd5d93ac08dabf2d9575 | [
"Apache-2.0",
"BSD-3-Clause"
] | 264 | 2015-01-02T10:15:42.000Z | 2022-03-31T06:59:13.000Z | external/source/meterpreter/source/bionic/libm/src/s_nextafterl.c | mcbaucom/metasploit-framework | 67cdea1788a26f7f758d910a58f5a50487eff2e6 | [
"BSD-3-Clause"
] | 112 | 2015-01-02T01:26:38.000Z | 2021-11-21T02:07:21.000Z | external/source/meterpreter/source/bionic/libm/src/s_nextafterl.c | mcbaucom/metasploit-framework | 67cdea1788a26f7f758d910a58f5a50487eff2e6 | [
"BSD-3-Clause"
] | 130 | 2015-01-02T05:29:46.000Z | 2022-03-18T19:50:39.000Z | /* @(#)s_nextafter.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
#ifndef lint
static char rcsid[] = "$FreeBSD: src/lib/msun/src/s_nextafterl.c,v 1.1 2005/03/07 04:56:46 das Exp $";
#endif
/* IEEE functions
* nextafter(x,y)
* return the next machine floating-point number of x in the
* direction toward y.
* Special cases:
*/
#include <sys/cdefs.h>
#include <float.h>
#include "fpmath.h"
#include "math.h"
#include "math_private.h"
#if LDBL_MAX_EXP != 0x4000
#error "Unsupported long double format"
#endif
long double
nextafterl(long double x, long double y)
{
volatile long double t;
union IEEEl2bits ux, uy;
ux.e = x;
uy.e = y;
if ((ux.bits.exp == 0x7fff &&
((ux.bits.manh&~LDBL_NBIT)|ux.bits.manl) != 0) ||
(uy.bits.exp == 0x7fff &&
((uy.bits.manh&~LDBL_NBIT)|uy.bits.manl) != 0))
return x+y; /* x or y is nan */
if(x==y) return y; /* x=y, return y */
if(x==0.0) {
ux.bits.manh = 0; /* return +-minsubnormal */
ux.bits.manl = 1;
ux.bits.sign = uy.bits.sign;
t = ux.e*ux.e;
if(t==ux.e) return t; else return ux.e; /* raise underflow flag */
}
if(x>0.0 ^ x<y) { /* x -= ulp */
if(ux.bits.manl==0) {
if ((ux.bits.manh&~LDBL_NBIT)==0)
ux.bits.exp -= 1;
ux.bits.manh = (ux.bits.manh - 1) | (ux.bits.manh & LDBL_NBIT);
}
ux.bits.manl -= 1;
} else { /* x += ulp */
ux.bits.manl += 1;
if(ux.bits.manl==0) {
ux.bits.manh = (ux.bits.manh + 1) | (ux.bits.manh & LDBL_NBIT);
if ((ux.bits.manh&~LDBL_NBIT)==0)
ux.bits.exp += 1;
}
}
if(ux.bits.exp==0x7fff) return x+x; /* overflow */
if(ux.bits.exp==0) { /* underflow */
mask_nbit_l(ux);
t = ux.e * ux.e;
if(t!=ux.e) /* raise underflow flag */
return ux.e;
}
return ux.e;
}
__strong_reference(nextafterl, nexttowardl);
| 26.096386 | 102 | 0.567405 |
ead13c34a555eabb7fad92afe3b3e4be8e3017a1 | 1,737 | h | C | src/pdf/SkPDFCanvas.h | jrmuizel/skia-wr | cbea8437804cb7f94c43319491d9dba7b039483d | [
"BSD-3-Clause"
] | null | null | null | src/pdf/SkPDFCanvas.h | jrmuizel/skia-wr | cbea8437804cb7f94c43319491d9dba7b039483d | [
"BSD-3-Clause"
] | null | null | null | src/pdf/SkPDFCanvas.h | jrmuizel/skia-wr | cbea8437804cb7f94c43319491d9dba7b039483d | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkPDFCanvas_DEFINED
#define SkPDFCanvas_DEFINED
#include "SkCanvas.h"
class SkPDFDevice;
class SkPDFCanvas : public SkCanvas {
public:
SkPDFCanvas(const sk_sp<SkPDFDevice>&);
~SkPDFCanvas();
protected:
void onClipRect(const SkRect&, ClipOp, ClipEdgeStyle) override;
void onClipRRect(const SkRRect&, ClipOp, ClipEdgeStyle) override;
void onClipPath(const SkPath&, ClipOp, ClipEdgeStyle) override;
void onDrawBitmapNine(const SkBitmap&, const SkIRect&, const SkRect&,
const SkPaint*) override;
void onDrawImageNine(const SkImage*, const SkIRect&, const SkRect&,
const SkPaint*) override;
void onDrawImageRect(const SkImage*,
const SkRect*,
const SkRect&,
const SkPaint*,
SkCanvas::SrcRectConstraint) override;
void onDrawBitmapRect(const SkBitmap&,
const SkRect*,
const SkRect&,
const SkPaint*,
SkCanvas::SrcRectConstraint) override;
void onDrawImageLattice(const SkImage*,
const Lattice&,
const SkRect&,
const SkPaint*) override;
void onDrawBitmapLattice(const SkBitmap&,
const Lattice&,
const SkRect&,
const SkPaint*) override;
private:
typedef SkCanvas INHERITED;
};
#endif // SkPDFCanvas_DEFINED
| 30.473684 | 73 | 0.567645 |
ead1a5968c6114cc2ddda4b653cd0bed2dbbaca4 | 2,715 | h | C | dependencies/panda/Panda3D-1.10.0-x64/include/buttonEventList.h | CrankySupertoon01/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 3 | 2018-03-09T12:07:29.000Z | 2021-02-25T06:50:25.000Z | panda/src/event/buttonEventList.h | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 1 | 2018-07-28T20:07:04.000Z | 2018-07-30T18:28:34.000Z | panda/src/event/buttonEventList.h | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | // Filename: buttonEventList.h
// Created by: drose (12Mar02)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef BUTTONEVENTLIST_H
#define BUTTONEVENTLIST_H
#include "pandabase.h"
#include "buttonEvent.h"
#include "typedReferenceCount.h"
#include "eventParameter.h"
#include "pvector.h"
class ModifierButtons;
class Datagram;
class DatagramIterator;
////////////////////////////////////////////////////////////////////
// Class : ButtonEventList
// Description : Records a set of button events that happened
// recently. This class is usually used only in the
// data graph, to transmit the recent button presses,
// but it may be used anywhere a list of ButtonEvents
// is desired.
////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_EVENT ButtonEventList : public ParamValueBase {
public:
INLINE ButtonEventList();
INLINE ButtonEventList(const ButtonEventList ©);
INLINE void operator = (const ButtonEventList ©);
INLINE void add_event(ButtonEvent event);
INLINE int get_num_events() const;
INLINE const ButtonEvent &get_event(int n) const;
INLINE void clear();
void add_events(const ButtonEventList &other);
void update_mods(ModifierButtons &mods) const;
virtual void output(ostream &out) const;
void write(ostream &out, int indent_level = 0) const;
private:
typedef pvector<ButtonEvent> Events;
Events _events;
public:
static void register_with_read_factory();
virtual void write_datagram(BamWriter *manager, Datagram &dg);
protected:
static TypedWritable *make_from_bam(const FactoryParams ¶ms);
public:
void fillin(DatagramIterator &scan, BamReader *manager);
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
ParamValueBase::init_type();
register_type(_type_handle, "ButtonEventList",
ParamValueBase::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
INLINE ostream &operator << (ostream &out, const ButtonEventList &buttonlist) {
buttonlist.output(out);
return out;
}
#include "buttonEventList.I"
#endif
| 28.578947 | 79 | 0.65488 |
ead5c5875db80b1c9ffbe754b56c2ff3f470fee3 | 7,452 | h | C | mysql-dst/mysql-cluster/storage/innobase/include/ut0pool.h | SJTU-IPADS/dst | 897b929a692642cbf295c105d9d6e64090abb673 | [
"Apache-2.0"
] | 9 | 2020-12-17T01:59:13.000Z | 2022-03-30T16:25:08.000Z | mysql-dst/mysql-cluster/storage/innobase/include/ut0pool.h | SJTU-IPADS/dst | 897b929a692642cbf295c105d9d6e64090abb673 | [
"Apache-2.0"
] | 1 | 2021-07-30T12:06:33.000Z | 2021-07-31T10:16:09.000Z | mysql-dst/mysql-cluster/storage/innobase/include/ut0pool.h | SJTU-IPADS/dst | 897b929a692642cbf295c105d9d6e64090abb673 | [
"Apache-2.0"
] | 1 | 2021-08-01T13:47:07.000Z | 2021-08-01T13:47:07.000Z | /*****************************************************************************
Copyright (c) 2013, 2014, Oracle and/or its affiliates. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
*****************************************************************************/
/******************************************************************//**
@file include/ut0pool.h
Object pool.
Created 2012-Feb-26 Sunny Bains
***********************************************************************/
#ifndef ut0pool_h
#define ut0pool_h
#include <vector>
#include <queue>
#include <functional>
#include "ut0new.h"
/** Allocate the memory for the object in blocks. We keep the objects sorted
on pointer so that they are closer together in case they have to be iterated
over in a list. */
template <typename Type, typename Factory, typename LockStrategy>
struct Pool {
typedef Type value_type;
// FIXME: Add an assertion to check alignment and offset is
// as we expect it. Also, sizeof(void*) can be 8, can we impove on this.
struct Element {
Pool* m_pool;
value_type m_type;
};
/** Constructor
@param size size of the memory block */
Pool(size_t size)
:
m_end(),
m_start(),
m_size(size),
m_last()
{
ut_a(size >= sizeof(Element));
m_lock_strategy.create();
ut_a(m_start == 0);
m_start = reinterpret_cast<Element*>(ut_zalloc_nokey(m_size));
m_last = m_start;
m_end = &m_start[m_size / sizeof(*m_start)];
/* Note: Initialise only a small subset, even though we have
allocated all the memory. This is required only because PFS
(MTR) results change if we instantiate too many mutexes up
front. */
init(ut_min(size_t(16), size_t(m_end - m_start)));
ut_ad(m_pqueue.size() <= size_t(m_last - m_start));
}
/** Destructor */
~Pool()
{
m_lock_strategy.destroy();
for (Element* elem = m_start; elem != m_last; ++elem) {
ut_ad(elem->m_pool == this);
Factory::destroy(&elem->m_type);
}
ut_free(m_start);
m_end = m_last = m_start = 0;
m_size = 0;
}
/** Get an object from the pool.
@retrun a free instance or NULL if exhausted. */
Type* get()
{
Element* elem;
m_lock_strategy.enter();
if (!m_pqueue.empty()) {
elem = m_pqueue.top();
m_pqueue.pop();
} else if (m_last < m_end) {
/* Initialise the remaining elements. */
init(m_end - m_last);
ut_ad(!m_pqueue.empty());
elem = m_pqueue.top();
m_pqueue.pop();
} else {
elem = NULL;
}
m_lock_strategy.exit();
return(elem != NULL ? &elem->m_type : 0);
}
/** Add the object to the pool.
@param ptr object to free */
static void mem_free(value_type* ptr)
{
Element* elem;
byte* p = reinterpret_cast<byte*>(ptr + 1);
elem = reinterpret_cast<Element*>(p - sizeof(*elem));
elem->m_pool->put(elem);
}
protected:
// Disable copying
Pool(const Pool&);
Pool& operator=(const Pool&);
private:
/* We only need to compare on pointer address. */
typedef std::priority_queue<
Element*,
std::vector<Element*, ut_allocator<Element*> >,
std::greater<Element*> > pqueue_t;
/** Release the object to the free pool
@param elem element to free */
void put(Element* elem)
{
m_lock_strategy.enter();
ut_ad(elem >= m_start && elem < m_last);
ut_ad(Factory::debug(&elem->m_type));
m_pqueue.push(elem);
m_lock_strategy.exit();
}
/** Initialise the elements.
@param n_elems Number of elements to initialise */
void init(size_t n_elems)
{
ut_ad(size_t(m_end - m_last) >= n_elems);
for (size_t i = 0; i < n_elems; ++i, ++m_last) {
m_last->m_pool = this;
Factory::init(&m_last->m_type);
m_pqueue.push(m_last);
}
ut_ad(m_last <= m_end);
}
private:
/** Pointer to the last element */
Element* m_end;
/** Pointer to the first element */
Element* m_start;
/** Size of the block in bytes */
size_t m_size;
/** Upper limit of used space */
Element* m_last;
/** Priority queue ordered on the pointer addresse. */
pqueue_t m_pqueue;
/** Lock strategy to use */
LockStrategy m_lock_strategy;
};
template <typename Pool, typename LockStrategy>
struct PoolManager {
typedef Pool PoolType;
typedef typename PoolType::value_type value_type;
PoolManager(size_t size)
:
m_size(size)
{
create();
}
~PoolManager()
{
destroy();
ut_a(m_pools.empty());
}
/** Get an element from one of the pools.
@return instance or NULL if pool is empty. */
value_type* get()
{
size_t index = 0;
size_t delay = 1;
value_type* ptr = NULL;
do {
m_lock_strategy.enter();
ut_ad(!m_pools.empty());
size_t n_pools = m_pools.size();
PoolType* pool = m_pools[index % n_pools];
m_lock_strategy.exit();
ptr = pool->get();
if (ptr == 0 && (index / n_pools) > 2) {
if (!add_pool(n_pools)) {
ib::error() << "Failed to allocate"
" memory for a pool of size "
<< m_size << " bytes. Will"
" wait for " << delay
<< " seconds for a thread to"
" free a resource";
/* There is nothing much we can do
except crash and burn, however lets
be a little optimistic and wait for
a resource to be freed. */
os_thread_sleep(delay * 1000000);
if (delay < 32) {
delay <<= 1;
}
} else {
delay = 1;
}
}
++index;
} while (ptr == NULL);
return(ptr);
}
static void mem_free(value_type* ptr)
{
PoolType::mem_free(ptr);
}
private:
/** Add a new pool
@param n_pools Number of pools that existed when the add pool was
called.
@return true on success */
bool add_pool(size_t n_pools)
{
bool added = false;
m_lock_strategy.enter();
if (n_pools < m_pools.size()) {
/* Some other thread already added a pool. */
added = true;
} else {
PoolType* pool;
ut_ad(n_pools == m_pools.size());
pool = UT_NEW_NOKEY(PoolType(m_size));
if (pool != NULL) {
ut_ad(n_pools <= m_pools.size());
m_pools.push_back(pool);
ib::info() << "Number of pools: "
<< m_pools.size();
added = true;
}
}
ut_ad(n_pools < m_pools.size() || !added);
m_lock_strategy.exit();
return(added);
}
/** Create the pool manager. */
void create()
{
ut_a(m_size > sizeof(value_type));
m_lock_strategy.create();
add_pool(0);
}
/** Release the resources. */
void destroy()
{
typename Pools::iterator it;
typename Pools::iterator end = m_pools.end();
for (it = m_pools.begin(); it != end; ++it) {
PoolType* pool = *it;
UT_DELETE(pool);
}
m_pools.clear();
m_lock_strategy.destroy();
}
private:
// Disable copying
PoolManager(const PoolManager&);
PoolManager& operator=(const PoolManager&);
typedef std::vector<PoolType*, ut_allocator<PoolType*> > Pools;
/** Size of each block */
size_t m_size;
/** Pools managed this manager */
Pools m_pools;
/** Lock strategy to use */
LockStrategy m_lock_strategy;
};
#endif /* ut0pool_h */
| 20.305177 | 78 | 0.629764 |
ead648d4907112cbdbbbc9b52a54a38984ff92dc | 3,561 | h | C | StdLib/Include/sys/poll.h | CEOALT1/RefindPlusUDK | 116b957ad735f96fbb6d80a0ba582046960ba164 | [
"BSD-2-Clause"
] | 2,757 | 2018-04-28T21:41:36.000Z | 2022-03-29T06:33:36.000Z | StdLib/Include/sys/poll.h | CEOALT1/RefindPlusUDK | 116b957ad735f96fbb6d80a0ba582046960ba164 | [
"BSD-2-Clause"
] | 20 | 2019-07-23T15:29:32.000Z | 2022-01-21T12:53:04.000Z | StdLib/Include/sys/poll.h | CEOALT1/RefindPlusUDK | 116b957ad735f96fbb6d80a0ba582046960ba164 | [
"BSD-2-Clause"
] | 449 | 2018-05-09T05:54:05.000Z | 2022-03-30T14:54:18.000Z | /** @file
Definitions in support of the poll() function.
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Charles M. Hannum.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License that accompanies this distribution.
The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php.
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
NetBSD: poll.h,v 1.11 2005/12/11 12:25:20 christos Exp
**/
#ifndef _SYS_POLL_H_
#define _SYS_POLL_H_
#include <sys/featuretest.h>
#include <sys/EfiCdefs.h>
typedef unsigned int nfds_t;
struct pollfd {
int fd; /* file descriptor */
short events; /* events to look for */
short revents; /* events returned */
};
/*
* Testable events (may be specified in events field).
*/
#define POLLIN 0x0001
#define POLLPRI 0x0002
#define POLLOUT 0x0004
#define POLLRDNORM 0x0040
#define POLLWRNORM POLLOUT
#define POLLRDBAND 0x0080
#define POLLWRBAND 0x0100
/*
* Non-testable events (ignored in events field, valid in return only).
*/
#define POLLERR 0x0008
#define POLLHUP 0x0010
#define POLLNVAL 0x0020 // Invalid parameter in POLL call
#define POLL_RETONLY (POLLERR | POLLHUP | POLLNVAL)
/*
* Infinite timeout value.
*/
#define INFTIM -1
__BEGIN_DECLS
int poll(struct pollfd *, nfds_t, int);
__END_DECLS
#endif /* !_SYS_POLL_H_ */
| 38.706522 | 86 | 0.72592 |
ead7f25a73d95d6a6da123c97b9514412aeb1ee4 | 156 | h | C | include/path.h | martydill/x86os | 745027271d194827e2729269aafe876829bc98a2 | [
"BSD-2-Clause"
] | 1 | 2022-01-26T12:14:15.000Z | 2022-01-26T12:14:15.000Z | include/path.h | martydill/x86os | 745027271d194827e2729269aafe876829bc98a2 | [
"BSD-2-Clause"
] | 1 | 2022-01-24T06:51:39.000Z | 2022-01-26T10:20:27.000Z | include/path.h | martydill/x86os | 745027271d194827e2729269aafe876829bc98a2 | [
"BSD-2-Clause"
] | null | null | null |
#ifndef PATH_H
#define PATH_H
#include <kernel.h>
char* PathSkipFirstComponent(const char* path);
char* PathGetFirstComponent(const char* path);
#endif
| 14.181818 | 47 | 0.769231 |
ead90f0c257caeeed4dc02f4ff36eaa311613eaa | 1,080 | h | C | src/asmjit/asmjit.h | tetzank/asmjit | 673dcefaa048c5f5a2bf8b85daf8f7b9978d018a | [
"Zlib"
] | 109 | 2018-11-03T15:11:51.000Z | 2022-01-06T05:34:35.000Z | src/asmjit/asmjit.h | tetzank/asmjit | 673dcefaa048c5f5a2bf8b85daf8f7b9978d018a | [
"Zlib"
] | 11 | 2020-06-16T05:05:42.000Z | 2022-03-30T09:59:14.000Z | src/asmjit/asmjit.h | tetzank/asmjit | 673dcefaa048c5f5a2bf8b85daf8f7b9978d018a | [
"Zlib"
] | 23 | 2019-01-19T16:34:19.000Z | 2021-07-08T01:16:17.000Z | // [AsmJit]
// Complete x86/x64 JIT and Remote Assembler for C++.
//
// [License]
// Zlib - See LICENSE.md file in the package.
// [Guard]
#ifndef _ASMJIT_ASMJIT_H
#define _ASMJIT_ASMJIT_H
// ============================================================================
// [asmjit_mainpage]
// ============================================================================
//! \mainpage
//!
//! AsmJit - Complete x86/x64 JIT and Remote Assembler for C++.
//!
//! Introduction provided by the project page at https://github.com/asmjit/asmjit.
//! \defgroup asmjit_base AsmJit Base API (architecture independent)
//!
//! \brief Backend Neutral API.
//! \defgroup asmjit_x86 AsmJit X86/X64 API
//!
//! \brief X86/X64 Backend API.
//! \defgroup asmjit_arm AsmJit ARM32/ARM64 API
//!
//! \brief ARM32/ARM64 Backend API.
// [Dependencies]
#include "./base.h"
// [X86/X64]
#if defined(ASMJIT_BUILD_X86)
#include "./x86.h"
#endif // ASMJIT_BUILD_X86
// [ARM32/ARM64]
#if defined(ASMJIT_BUILD_ARM)
#include "./arm.h"
#endif // ASMJIT_BUILD_ARM
// [Guard]
#endif // _ASMJIT_ASMJIT_H
| 22.5 | 82 | 0.590741 |
ead9e3c4610a0f429fcbc76bb30d78dd9b9127c5 | 972 | h | C | macOS/10.13/Foundation.framework/NSObservationBuffer.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | 30 | 2016-10-09T20:13:00.000Z | 2022-01-24T04:14:57.000Z | macOS/10.13/Foundation.framework/NSObservationBuffer.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | null | null | null | macOS/10.13/Foundation.framework/NSObservationBuffer.h | onmyway133/Runtime-Headers | e9b80e7ab9103f37ad421ad6b8b58ee06369d21f | [
"MIT"
] | 7 | 2017-08-29T14:41:25.000Z | 2022-01-19T17:14:54.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
*/
@interface NSObservationBuffer : NSObservationTransformer
@property (atomic, readwrite) BOOL automaticallyEmitsObjects;
@property (atomic, readwrite, copy) id bufferFullHandler;
@property (getter=isMemoryPressureSensitive, atomic, readwrite) BOOL memoryPressureSensitive;
+ (id)allocWithZone:(struct _NSZone { }*)arg1;
+ (id)bufferWithMaximumObjectCount:(unsigned long long)arg1 fullPolicy:(long long)arg2 outputQueue:(id)arg3;
+ (id)bufferWithOutputQueue:(id)arg1;
- (BOOL)automaticallyEmitsObjects;
- (id)bufferFullHandler;
- (void)emitAllObjects;
- (void)emitObject;
- (id)initWithMaximumObjectCount:(unsigned long long)arg1 fullPolicy:(long long)arg2 outputQueue:(id)arg3;
- (BOOL)isMemoryPressureSensitive;
- (void)setAutomaticallyEmitsObjects:(BOOL)arg1;
- (void)setBufferFullHandler:(id)arg1;
- (void)setMemoryPressureSensitive:(BOOL)arg1;
@end
| 37.384615 | 108 | 0.80144 |
eada435932f2101a90c58e41778534352fd26c50 | 859 | h | C | NYSCake_Demo/Pods/Headers/Public/NYSMC/NYSMC/NYSConfig.h | niyongsheng/NYSMC | 1db7f80da4324a770a3023f5ef05dfbe1c4b8814 | [
"MIT"
] | 34 | 2018-09-26T03:01:22.000Z | 2021-04-12T19:08:14.000Z | NYSCake_Demo/Pods/Headers/Public/NYSMC/NYSMC/NYSConfig.h | niyongsheng/NYSMC | 1db7f80da4324a770a3023f5ef05dfbe1c4b8814 | [
"MIT"
] | 2 | 2018-12-14T03:12:45.000Z | 2019-04-03T06:28:29.000Z | NYSCake_Demo/Pods/Headers/Public/NYSMC/NYSMC/NYSConfig.h | niyongsheng/NYSMC | 1db7f80da4324a770a3023f5ef05dfbe1c4b8814 | [
"MIT"
] | 6 | 2018-10-16T09:07:53.000Z | 2019-07-08T10:18:46.000Z | //
// NYSConfig.h
// cake
//
// Created by 倪刚 on 2018/9/24.
// Copyright © 2018年 NiYongsheng. All rights reserved.
//
#ifndef NYSConfig_h
#define NYSConfig_h
#define NYSCakeBundle(file) [@"sound.bundle" stringByAppendingPathComponent:file]
#define NYSCakeResources(file) [@"images.bundle" stringByAppendingPathComponent:file]
#define NYSC_ScreenWidth [UIScreen mainScreen].bounds.size.width
#define NYSC_ScreenHeight [UIScreen mainScreen].bounds.size.height
#define NYSC_Height_TabBar ((NYSC_Height_StatusBar > 20) ? 83 : 49)
#define NYSC_Height_StatusBar CGRectGetHeight([[UIApplication sharedApplication] statusBarFrame])
#define NYSC_Version_Key @"CFBundleShortVersionString"
#ifdef DEBUG
#define NLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else
#define NLog(...)
#endif
#endif /* NYSConfig_h */
| 28.633333 | 99 | 0.764843 |
eadc79c075b517b2a1084facdc06418a8f777ce6 | 5,602 | h | C | url/url_canon_internal_file.h | nagineni/chromium-crosswalk | 5725642f1c67d0f97e8613ec1c3e8107ab53fdf8 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 231 | 2015-01-08T09:04:44.000Z | 2021-12-30T03:03:10.000Z | url/url_canon_internal_file.h | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 1 | 2021-12-13T19:44:12.000Z | 2021-12-13T19:44:12.000Z | url/url_canon_internal_file.h | j4ckfrost/android_external_chromium_org | a1a3dad8b08d1fcf6b6b36c267158ed63217c780 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 268 | 2015-01-21T05:53:28.000Z | 2022-03-25T22:09:01.000Z | // Copyright 2013 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 URL_URL_CANON_INTERNAL_FILE_H_
#define URL_URL_CANON_INTERNAL_FILE_H_
// As with url_canon_internal.h, this file is intended to be included in
// another C++ file where the template types are defined. This allows the
// programmer to use this to use these functions for their own strings
// types, without bloating the code by having inline templates used in
// every call site.
//
// *** This file must be included after url_canon_internal as we depend on some
// functions in it. ***
#include "url/url_file.h"
#include "url/url_parse_internal.h"
using namespace url_canon;
// Given a pointer into the spec, this copies and canonicalizes the drive
// letter and colon to the output, if one is found. If there is not a drive
// spec, it won't do anything. The index of the next character in the input
// spec is returned (after the colon when a drive spec is found, the begin
// offset if one is not).
template<typename CHAR>
static int FileDoDriveSpec(const CHAR* spec, int begin, int end,
CanonOutput* output) {
// The path could be one of several things: /foo/bar, c:/foo/bar, /c:/foo,
// (with backslashes instead of slashes as well).
int num_slashes = CountConsecutiveSlashes(spec, begin, end);
int after_slashes = begin + num_slashes;
if (!DoesBeginWindowsDriveSpec(spec, after_slashes, end))
return begin; // Haven't consumed any characters
// DoesBeginWindowsDriveSpec will ensure that the drive letter is valid
// and that it is followed by a colon/pipe.
// Normalize Windows drive letters to uppercase
if (spec[after_slashes] >= 'a' && spec[after_slashes] <= 'z')
output->push_back(spec[after_slashes] - 'a' + 'A');
else
output->push_back(static_cast<char>(spec[after_slashes]));
// Normalize the character following it to a colon rather than pipe.
output->push_back(':');
output->push_back('/');
return after_slashes + 2;
}
// FileDoDriveSpec will have already added the first backslash, so we need to
// write everything following the slashes using the path canonicalizer.
template<typename CHAR, typename UCHAR>
static void FileDoPath(const CHAR* spec, int begin, int end,
CanonOutput* output) {
// Normalize the number of slashes after the drive letter. The path
// canonicalizer expects the input to begin in a slash already so
// doesn't check. We want to handle no-slashes
int num_slashes = CountConsecutiveSlashes(spec, begin, end);
int after_slashes = begin + num_slashes;
// Now use the regular path canonicalizer to canonicalize the rest of the
// path. We supply it with the path following the slashes. It won't prepend
// a slash because it assumes any nonempty path already starts with one.
// We explicitly filter out calls with no path here to prevent that case.
ParsedURL::Component sub_path(after_slashes, end - after_slashes);
if (sub_path.len > 0) {
// Give it a fake output component to write into. DoCanonicalizeFile will
// compute the full path component.
ParsedURL::Component fake_output_path;
URLCanonInternal<CHAR, UCHAR>::DoPath(
spec, sub_path, output, &fake_output_path);
}
}
template<typename CHAR, typename UCHAR>
static bool DoCanonicalizeFileURL(const URLComponentSource<CHAR>& source,
const ParsedURL& parsed,
CanonOutput* output,
ParsedURL* new_parsed) {
// Things we don't set in file: URLs.
new_parsed->username = ParsedURL::Component(0, -1);
new_parsed->password = ParsedURL::Component(0, -1);
new_parsed->port = ParsedURL::Component(0, -1);
// Scheme (known, so we don't bother running it through the more
// complicated scheme canonicalizer).
new_parsed->scheme.begin = output->length();
output->push_back('f');
output->push_back('i');
output->push_back('l');
output->push_back('e');
new_parsed->scheme.len = output->length() - new_parsed->scheme.begin;
output->push_back(':');
// Write the separator for the host.
output->push_back('/');
output->push_back('/');
// Append the host. For many file URLs, this will be empty. For UNC, this
// will be present.
// TODO(brettw) This doesn't do any checking for host name validity. We
// should probably handle validity checking of UNC hosts differently than
// for regular IP hosts.
bool success = URLCanonInternal<CHAR, UCHAR>::DoHost(
source.host, parsed.host, output, &new_parsed->host);
// Write a separator for the start of the path. We'll ignore any slashes
// already at the beginning of the path.
new_parsed->path.begin = output->length();
output->push_back('/');
// Copies and normalizes the "c:" at the beginning, if present.
int after_drive = FileDoDriveSpec(source.path, parsed.path.begin,
parsed.path.end(), output);
// Copies the rest of the path
FileDoPath<CHAR, UCHAR>(source.path, after_drive, parsed.path.end(), output);
new_parsed->path.len = output->length() - new_parsed->path.begin;
// Things following the path we can use the standard canonicalizers for.
success &= URLCanonInternal<CHAR, UCHAR>::DoQuery(
source.query, parsed.query, output, &new_parsed->query);
success &= URLCanonInternal<CHAR, UCHAR>::DoRef(
source.ref, parsed.ref, output, &new_parsed->ref);
return success;
}
#endif // URL_URL_CANON_INTERNAL_FILE_H_
| 41.80597 | 79 | 0.704748 |
eadc9855f904e03b02fa3f81db50186f1907c23e | 299 | c | C | kr_ex1-9.c | albeco/KR_Solutions | 84cf89201be44709d07f699d72701376c79e648f | [
"MIT"
] | 1 | 2018-11-19T14:36:02.000Z | 2018-11-19T14:36:02.000Z | kr_ex1-9.c | albeco/KR_Solutions | 84cf89201be44709d07f699d72701376c79e648f | [
"MIT"
] | null | null | null | kr_ex1-9.c | albeco/KR_Solutions | 84cf89201be44709d07f699d72701376c79e648f | [
"MIT"
] | 1 | 2020-04-07T14:45:48.000Z | 2020-04-07T14:45:48.000Z | #include <stdio.h>
/* copy input to output replacing multiple blanks with one */
int main()
{
int newChar, lastChar;
lastChar = -2;
while ((newChar = getchar()) != EOF)
{
if ((newChar != ' ') || (lastChar != ' '))
putchar(newChar);
lastChar = newChar;
}
return(0);
}
| 16.611111 | 61 | 0.565217 |
eadd1b473e155c7358ce1f262517eed7641b4254 | 2,319 | c | C | src/color.c | cherouvim/sled | 218edcccb157ae04d3add168bb6c53ec6cae23e3 | [
"ISC"
] | null | null | null | src/color.c | cherouvim/sled | 218edcccb157ae04d3add168bb6c53ec6cae23e3 | [
"ISC"
] | null | null | null | src/color.c | cherouvim/sled | 218edcccb157ae04d3add168bb6c53ec6cae23e3 | [
"ISC"
] | null | null | null | // Color conversion, mostly.
#include "types.h"
RGB HSV2RGB(HSV hsv)
{
RGB rgb;
byte region, remainder, p, q, t;
if (hsv.s == 0)
{
rgb.red = hsv.v;
rgb.green = hsv.v;
rgb.blue = hsv.v;
return rgb;
}
region = hsv.h / 43;
remainder = (hsv.h - (region * 43)) * 6;
p = (hsv.v * (255 - hsv.s)) >> 8;
q = (hsv.v * (255 - ((hsv.s * remainder) >> 8))) >> 8;
t = (hsv.v * (255 - ((hsv.s * (255 - remainder)) >> 8))) >> 8;
switch (region)
{
case 0:
rgb.red = hsv.v;
rgb.green = t;
rgb.blue = p;
break;
case 1:
rgb.red = q;
rgb.green = hsv.v;
rgb.blue = p;
break;
case 2:
rgb.red = p;
rgb.green = hsv.v;
rgb.blue = t;
break;
case 3:
rgb.red = p;
rgb.green = q;
rgb.blue = hsv.v;
break;
case 4:
rgb.red = t;
rgb.green = p;
rgb.blue = hsv.v;
break;
default:
rgb.red = hsv.v;
rgb.green = p;
rgb.blue = q;
break;
}
return rgb;
}
HSV RGB2HSV(RGB rgb)
{
HSV hsv;
byte rgbMin, rgbMax;
rgbMin = rgb.red < rgb.green ? (rgb.red < rgb.blue ? rgb.red : rgb.blue) : (rgb.green < rgb.blue ? rgb.green : rgb.blue);
rgbMax = rgb.red > rgb.green ? (rgb.red > rgb.blue ? rgb.red : rgb.blue) : (rgb.green > rgb.blue ? rgb.green : rgb.blue);
hsv.v = rgbMax;
if (hsv.v == 0)
{
hsv.h = 0;
hsv.s = 0;
return hsv;
}
hsv.s = 255 * (long) (rgbMax - rgbMin) / hsv.v;
if (hsv.s == 0)
{
hsv.h = 0;
return hsv;
}
if (rgbMax == rgb.red)
hsv.h = 0 + 43 * (rgb.green - rgb.blue) / (rgbMax - rgbMin);
else if (rgbMax == rgb.green)
hsv.h = 85 + 43 * (rgb.blue - rgb.red) / (rgbMax - rgbMin);
else
hsv.h = 171 + 43 * (rgb.red - rgb.green) / (rgbMax - rgbMin);
return hsv;
}
RGB RGBlerp(byte v, RGB rgbA, RGB rgbB) {
RGB rgb;
rgb.red = (byte) rgbA.red + ((((uint) rgbB.red - rgbA.red) * v) / 255);
rgb.green = (byte) rgbA.green + ((((uint) rgbB.green - rgbA.green) * v) / 255);
rgb.blue = (byte) rgbA.blue + ((((uint) rgbB.blue - rgbA.blue) * v) / 255);
return rgb;
}
| 22.735294 | 125 | 0.458818 |
eade74d8ff365e07961cbec547b3f4bb0076fb52 | 966 | h | C | ace/os_include/os_float.h | binary42/OCI | 08191bfe4899f535ff99637d019734ed044f479d | [
"MIT"
] | null | null | null | ace/os_include/os_float.h | binary42/OCI | 08191bfe4899f535ff99637d019734ed044f479d | [
"MIT"
] | null | null | null | ace/os_include/os_float.h | binary42/OCI | 08191bfe4899f535ff99637d019734ed044f479d | [
"MIT"
] | null | null | null | // -*- C++ -*-
//=============================================================================
/**
* @file os_float.h
*
* floating types
*
* $Id: os_float.h 14 2007-02-01 15:49:12Z mitza $
*
* @author Don Hinton <dhinton@dresystems.com>
* @author This code was originally in various places including ace/OS.h.
*/
//=============================================================================
#ifndef ACE_OS_INCLUDE_OS_FLOAT_H
#define ACE_OS_INCLUDE_OS_FLOAT_H
#include /**/ "ace/pre.h"
#include "ace/config-lite.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if !defined (ACE_LACKS_FLOAT_H)
# include /**/ <float.h>
#endif /* !ACE_LACKS_FLOAT_H */
// Place all additions (especially function declarations) within extern "C" {}
#ifdef __cplusplus
extern "C"
{
#endif /* __cplusplus */
#ifdef __cplusplus
}
#endif /* __cplusplus */
#include /**/ "ace/post.h"
#endif /* ACE_OS_INCLUDE_OS_FLOAT_H */
| 22.465116 | 79 | 0.571429 |
eadf86d2e80bbcd9633265cb126baed9bc389eb2 | 4,295 | c | C | src/problemB/problem1068.c | kbpoyo/ForgotCLearning | 17daa0898a916b77fa66b9de3365c7e68b1f9321 | [
"Apache-2.0"
] | 28 | 2019-09-07T02:36:54.000Z | 2022-02-09T14:11:55.000Z | src/problemB/problem1068.c | kbpoyo/ForgotCLearning | 17daa0898a916b77fa66b9de3365c7e68b1f9321 | [
"Apache-2.0"
] | null | null | null | src/problemB/problem1068.c | kbpoyo/ForgotCLearning | 17daa0898a916b77fa66b9de3365c7e68b1f9321 | [
"Apache-2.0"
] | 16 | 2020-02-03T07:42:19.000Z | 2021-09-26T13:46:33.000Z | //
// Created by forgot on 2019-08-04.
//
/*1068 万绿丛中一点红 (20 point(s))*/
/*对于计算机而言,颜色不过是像素点对应的一个 24 位的数值。现给定一幅分辨率为 M×N 的画,要求你找出万绿丛中的一点红,即有独一无二颜色的那个像素点,并且该点的颜色与其周围 8 个相邻像素的颜色差充分大。
输入格式:
输入第一行给出三个正整数,分别是 M 和 N(≤ 1000),即图像的分辨率;以及 TOL,是所求像素点与相邻点的颜色差阈值,色差超过 TOL 的点才被考虑。随后 N 行,每行给出 M 个像素的颜色值,范围在 [0,2
24
) 内。所有同行数字间用空格或 TAB 分开。
输出格式:
在一行中按照 (x, y): color 的格式输出所求像素点的位置以及颜色值,其中位置 x 和 y 分别是该像素在图像矩阵中的列、行编号(从 1 开始编号)。如果这样的点不唯一,则输出 Not Unique;如果这样的点不存在,则输出 Not Exist。
输入样例 1:
8 6 200
0 0 0 0 0 0 0 0
65280 65280 65280 16711479 65280 65280 65280 65280
16711479 65280 65280 65280 16711680 65280 65280 65280
65280 65280 65280 65280 65280 65280 165280 165280
65280 65280 16777015 65280 65280 165280 65480 165280
16777215 16777215 16777215 16777215 16777215 16777215 16777215 16777215
输出样例 1:
(5, 3): 16711680
输入样例 2:
4 5 2
0 0 0 0
0 0 3 0
0 0 0 0
0 5 0 0
0 0 0 0
输出样例 2:
Not Unique
输入样例 3:
3 3 5
1 2 3
3 4 5
5 6 7
输出样例 3:
Not Exist*/
// 一开始错了一个用例,因为各角落的点 周围是没有8个点的,要验证边界
//#include <stdio.h>
//#include <math.h>
//
//long num[16777216];
//int M, N, TOL;
////定义比最大值再大一个,即外围加一圈,保证最大点还有周围8个点,周围点默认是0。
////实际上题目这里还有歧义,若该点在最外围(如左上角),那它的周围8个是变成3个点呢,还是其他5个点当作是0? 看题目应该是前者,那还要另外处理,我现在这样做只是刚好走过了测试用例罢了
//long matrix[1001][1001];
//
//int main() {
//
// scanf("%d %d %d", &M, &N, &TOL);
//
// for (int i = 0; i < N; i++) {
// for (int j = 0; j < M; j++) {
// long n;
// scanf("%ld", &n);
// num[n]++;
// matrix[i][j] = n;
// }
// }
//
// int count = 0;
// int a = 0, b = 0;
// for (int i = 0; i < N; i++) {
// for (int j = 0; j < M; j++) {
// if (num[matrix[i][j]] == 1) {
// if (fabs(matrix[i][j] - matrix[i - 1][j - 1]) > TOL && fabs(matrix[i][j] - matrix[i - 1][j]) > TOL &&
// fabs(matrix[i][j] - matrix[i - 1][j + 1]) > TOL && fabs(matrix[i][j] - matrix[i][j - 1]) > TOL &&
// fabs(matrix[i][j] - matrix[i][j + 1]) > TOL && fabs(matrix[i][j] - matrix[i + 1][j - 1]) > TOL &&
// fabs(matrix[i][j] - matrix[i + 1][j]) > TOL && fabs(matrix[i][j] - matrix[i + 1][j + 1]) > TOL) {
// count++;
// a = i;
// b = j;
// }
// }
// }
// }
//
// if (count == 0) {
// printf("Not Exist");
// } else if (count == 1) {
// printf("(%d, %d): %ld", b + 1, a + 1, matrix[a][b]);
// } else {
// printf("Not Unique");
// }
// return 0;
//}
//法2 , 加条件过滤最外圈8个点中的不合法点
//#include <stdio.h>
//#include <math.h>
//
//long num[16777216];
//int M, N, TOL;
//
//long matrix[1000][1000];
//
//int main() {
//
// scanf("%d %d %d", &M, &N, &TOL);
//
// for (int i = 0; i < N; i++) {
// for (int j = 0; j < M; j++) {
// long n;
// scanf("%ld", &n);
// num[n]++;
// matrix[i][j] = n;
// }
// }
//
// int count = 0;
// int a = 0, b = 0;
// for (int i = 0; i < N; i++) {
// for (int j = 0; j < M; j++) {
// if (num[matrix[i][j]] == 1) {
// if ((i > 0 && j > 0 ? fabs(matrix[i][j] - matrix[i - 1][j - 1]) > TOL : 1)
// && (i > 0 ? fabs(matrix[i][j] - matrix[i - 1][j]) > TOL : 1)
// && (i > 0 && j < M - 1 ? fabs(matrix[i][j] - matrix[i - 1][j + 1]) > TOL : 1)
// && (j > 0 ? fabs(matrix[i][j] - matrix[i][j - 1]) > TOL : 1)
// && (j < M - 1 ? fabs(matrix[i][j] - matrix[i][j + 1]) > TOL : 1)
// && (i < N - 1 && j > 0 ? fabs(matrix[i][j] - matrix[i + 1][j - 1]) > TOL : 1)
// && (i < N - 1 ? fabs(matrix[i][j] - matrix[i + 1][j]) > TOL : 1)
// && (i < N - 1 && j < M - 1 ? fabs(matrix[i][j] - matrix[i + 1][j + 1]) > TOL : 1)) {
// count++;
// a = i;
// b = j;
// }
// }
// }
// }
//
// if (count == 0) {
// printf("Not Exist");
// } else if (count == 1) {
// printf("(%d, %d): %ld", b + 1, a + 1, matrix[a][b]);
// } else {
// printf("Not Unique");
// }
// return 0;
//}
| 29.02027 | 129 | 0.429569 |
eadf95878e0531462b3e1d8ceeb569eb571ad02d | 299 | h | C | Example/PhotoViewController/NDPAppDelegate.h | nicoduj/PhotoViewController | d2d509e66b65d06a3a4a4d318de304cdcc92181f | [
"MIT"
] | 3 | 2018-02-22T15:53:53.000Z | 2018-02-23T20:41:42.000Z | Example/PhotoViewController/NDPAppDelegate.h | nicoduj/PhotoViewController | d2d509e66b65d06a3a4a4d318de304cdcc92181f | [
"MIT"
] | null | null | null | Example/PhotoViewController/NDPAppDelegate.h | nicoduj/PhotoViewController | d2d509e66b65d06a3a4a4d318de304cdcc92181f | [
"MIT"
] | null | null | null | //
// NDPAppDelegate.h
// PhotoViewController
//
// Created by Nicolas Dujardin on 02/19/2018.
// Copyright (c) 2018 Nicolas Dujardin. All rights reserved.
//
@import UIKit;
@interface NDPAppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| 18.6875 | 63 | 0.735786 |
eae034b3a7c79b919a9e901fdc6283cbd31d7117 | 240 | h | C | ios/Classes/Api/MOP_removeApplet.h | finogeeks/mop-flutter-plugin | 85fe53383497605860728618afdfaf7ae0b2a489 | [
"MIT"
] | null | null | null | ios/Classes/Api/MOP_removeApplet.h | finogeeks/mop-flutter-plugin | 85fe53383497605860728618afdfaf7ae0b2a489 | [
"MIT"
] | null | null | null | ios/Classes/Api/MOP_removeApplet.h | finogeeks/mop-flutter-plugin | 85fe53383497605860728618afdfaf7ae0b2a489 | [
"MIT"
] | null | null | null | //
// MOP_removeApplet.h
// mop
//
// Created by 王滔 on 2021/12/21.
//
#import "MOPBaseApi.h"
NS_ASSUME_NONNULL_BEGIN
@interface MOP_removeApplet : MOPBaseApi
@property (nonatomic, copy) NSString *appletId;
@end
NS_ASSUME_NONNULL_END
| 14.117647 | 47 | 0.7375 |
eae1eff60319ea64913cf26a25cdbea3943b8cc1 | 6,990 | c | C | fw/KFDtool/USB_API/USB_MSC_API/UsbMscStateMachine.c | grover556/KFDtool | 15df30629d8e3f665471fc8919ae8a5acfb712be | [
"MIT"
] | 58 | 2020-02-16T00:06:07.000Z | 2022-03-24T20:43:45.000Z | fw/KFDtool/USB_API/USB_MSC_API/UsbMscStateMachine.c | grover556/KFDtool | 15df30629d8e3f665471fc8919ae8a5acfb712be | [
"MIT"
] | 24 | 2020-02-18T02:40:32.000Z | 2022-01-14T16:53:47.000Z | fw/KFDtool/USB_API/USB_MSC_API/UsbMscStateMachine.c | grover556/KFDtool | 15df30629d8e3f665471fc8919ae8a5acfb712be | [
"MIT"
] | 22 | 2020-03-14T15:13:51.000Z | 2022-03-23T05:42:24.000Z | /** @file UsbMscStateMachine.c
* @brief Contains APIs related to MSC task Management.
*/
//
//! \cond
//
/*
* ======== UsbMscStateMachine.c ========
*/
/*File includes */
#include "../USB_Common/device.h"
#include "../USB_Common/defMSP430USB.h"
#include "../USB_MSC_API/UsbMscScsi.h"
#include "../USB_MSC_API/UsbMsc.h"
#include "../USB_Common/usb.h"
#include <descriptors.h>
#include <string.h>
#ifdef _MSC_
/*Macros to indicate data direction */
#define DIRECTION_IN 0x80
#define DIRECTION_OUT 0x00
/*Buffer pointers passed by application */
extern __no_init tEDB __data16 tInputEndPointDescriptorBlock[];
extern struct _MscState MscState;
uint8_t Scsi_Verify_CBW ();
/*----------------------------------------------------------------------------+
| Functions |
+----------------------------------------------------------------------------*/
void Msc_ResetStateMachine (void)
{
MscState.bMscSendCsw = FALSE;
MscState.Scsi_Residue = 0;
MscState.Scsi_Status = SCSI_PASSED; /*Variable to track command status */
MscState.bMcsCommandSupported = TRUE; /*Flag to indicate read/write command is recieved from host */
MscState.bMscCbwReceived = 0; /*Flag to inidicate whether any CBW recieved from host*/
MscState.bMscSendCsw = FALSE;
MscState.isMSCConfigured = FALSE;
MscState.bUnitAttention = FALSE;
MscState.bMscCbwFailed = FALSE;
MscState.bMscResetRequired = FALSE;
MscState.stallEndpoint = FALSE;
MscState.stallAtEndofTx = FALSE;
}
//----------------------------------------------------------------------------
/*This is the core function called by application to handle the MSC SCSI state
* machine */
//
//! \endcond
//
//*****************************************************************************
//
//! Checks to See if a SCSI Command has Been Received.
//!
//! Checks to see if a SCSI command has been received. If so, it handles it. If not, it returns
//! having taken no action.
//! The return values of this function are intended to be used with entry of low-power modes. If the
//! function returns \b USBMSC_OK_TO_SLEEP, then no further application action is required; that is,
//! either no SCSI command was received; one was received but immediately handled; or one was
//! received but the handling will be completed in the background by the API as it automatically
//! services USB interrupts.
//! If instead the function returns \b USBMSC_PROCESS_BUFFER, then the API is currently servicing a
//! SCSI READ or WRITE command, and the API requires the application to process a buffer. (See
//! Sec. 8.3.6 of \e "Programmer's Guide: MSP430 USB API Stack for CDC/PHDC/HID/MSC" for a discussion of buffer
//! processing.)
//! Note that even if the function returns these values, the values could potentially be outdated by
//! the time the application evaluates them. For this reason, it's important to disable interrupts prior
//! to calling this function. See Sec. 8.3.5 of \e "Programmer's Guide: MSP430 USB API Stack for CDC/PHDC/HID/MSC"
//! for more information.
//!
//! \return \b USBMSC_OK_TO_SLEEP or \b USBMSC_PROCESS_BUFFER
//
//*****************************************************************************
uint8_t USBMSC_pollCommand ()
{
uint16_t state;
uint8_t edbIndex;
uint8_t * pCT1;
uint8_t * pCT2;
edbIndex = stUsbHandle[MSC0_INTFNUM].edb_Index;
pCT1 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTX;
pCT2 = &tInputEndPointDescriptorBlock[edbIndex].bEPBCTY;
//check if currently transmitting data..
if (MscReadControl.bReadProcessing == TRUE){
state = usbDisableOutEndpointInterrupt(edbIndex);
//atomic operation - disable interrupts
if ((MscReadControl.dwBytesToSendLeft == 0) &&
(MscReadControl.lbaCount == 0)){
//data is no more processing - clear flags..
MscReadControl.bReadProcessing = FALSE;
usbRestoreOutEndpointInterrupt(state);
} else {
if (!(tInputEndPointDescriptorBlock[edbIndex].bEPCNF &
EPCNF_STALL)){ //if it is not stalled - contiune communication
USBIEPIFG |= 1 << (edbIndex + 1); //trigger IN interrupt to finish data tranmition
}
usbRestoreOutEndpointInterrupt(state);
return (USBMSC_PROCESS_BUFFER);
}
}
if (MscState.isMSCConfigured == FALSE){
return (USBMSC_OK_TO_SLEEP);
}
if (!MscState.bMscSendCsw){
if (MscState.bMscCbwReceived){
if (Scsi_Verify_CBW() == SUCCESS){
//Successful reception of CBW
//Parse the CBW opcode and invoke the right command handler function
Scsi_Cmd_Parser(MSC0_INTFNUM);
MscState.bMscSendCsw = TRUE;
}
MscState.bMscCbwReceived = FALSE; //CBW is performed!
} else {
return (USBMSC_OK_TO_SLEEP);
}
//check if any of out pipes has pending data and trigger interrupt
if ((MscWriteControl.pCT1 != NULL) &&
((*MscWriteControl.pCT1 & EPBCNT_NAK ) ||
(*MscWriteControl.pCT2 & EPBCNT_NAK ))){
USBOEPIFG |= 1 << (edbIndex + 1); //trigger OUT interrupt again
return (USBMSC_PROCESS_BUFFER); //do not asleep, as data is coming in
//and follow up data perform will be required.
}
}
if (MscState.bMscSendCsw){
if (MscState.bMcsCommandSupported == TRUE){
//watiting till transport is finished!
if ((MscWriteControl.bWriteProcessing == FALSE) &&
(MscReadControl.bReadProcessing == FALSE) &&
(MscReadControl.lbaCount == 0)){
//Send CSW
if (MscState.stallAtEndofTx == TRUE) {
if ((*pCT1 & EPBCNT_NAK) && (*pCT2 & EPBCNT_NAK)) {
MscState.stallAtEndofTx = FALSE;
usbStallInEndpoint(MSC0_INTFNUM);
}
}
else if (SUCCESS == Scsi_Send_CSW(MSC0_INTFNUM)){
MscState.bMscSendCsw = FALSE;
return (USBMSC_OK_TO_SLEEP);
}
}
else {
MSCFromHostToBuffer();
}
}
}
return (USBMSC_PROCESS_BUFFER); //When MscState.bMcsCommandSupported = FALSE, bReadProcessing became true, and
//bWriteProcessing = true.
}
//
//! \cond
//
#endif //_MSC_
//
//! \endcond
//
/*----------------------------------------------------------------------------+
| End of source file |
+----------------------------------------------------------------------------*/
/*------------------------ Nothing Below This Line --------------------------*/
| 38.406593 | 130 | 0.565522 |
eae229e5d6574800027da5acc84e04c4aa5fbe06 | 10,035 | c | C | optimizations/sources/3D_Dock/progs/002-pythagoras-inline/electrostatics.c | albertsgrc/ftdock-opt | 3361d1f18bf529958b78231fdcf139b1c1c1f232 | [
"MIT"
] | null | null | null | optimizations/sources/3D_Dock/progs/002-pythagoras-inline/electrostatics.c | albertsgrc/ftdock-opt | 3361d1f18bf529958b78231fdcf139b1c1c1f232 | [
"MIT"
] | null | null | null | optimizations/sources/3D_Dock/progs/002-pythagoras-inline/electrostatics.c | albertsgrc/ftdock-opt | 3361d1f18bf529958b78231fdcf139b1c1c1f232 | [
"MIT"
] | null | null | null | /*
This file is part of ftdock, a program for rigid-body protein-protein docking
Copyright (C) 1997-2000 Gidon Moont
Biomolecular Modelling Laboratory
Imperial Cancer Research Fund
44 Lincoln's Inn Fields
London WC2A 3PX
+44 (0)20 7269 3348
http://www.bmm.icnet.uk/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "structures.h"
#define PYTHAGORAS(__x1, __y1, __z1, __x2, __y2, \
__z2) sqrt(((__x1 - __x2) * (__x1 - __x2)) + ((__y1 - __y2) * (__y1 - __y2)) + \
((__z1 - __z2) * (__z1 - __z2)))
void assign_charges(struct Structure This_Structure) {
/************/
/* Counters */
int residue, atom;
/************/
for (residue = 1; residue <= This_Structure.length; residue++) {
for (atom = 1; atom <= This_Structure.Residue[residue].size; atom++) {
This_Structure.Residue[residue].Atom[atom].charge = 0.0;
/* peptide backbone */
if (strcmp(This_Structure.Residue[residue].Atom[atom].atom_name, " N ") == 0) {
if (strcmp(This_Structure.Residue[residue].res_name, "PRO") == 0) {
This_Structure.Residue[residue].Atom[atom].charge = -0.10;
} else {
This_Structure.Residue[residue].Atom[atom].charge = 0.55;
if (residue == 1) This_Structure.Residue[residue].Atom[atom].charge = 1.00;
}
}
if (strcmp(This_Structure.Residue[residue].Atom[atom].atom_name, " O ") == 0) {
This_Structure.Residue[residue].Atom[atom].charge = -0.55;
if (residue == This_Structure.length) This_Structure.Residue[residue].Atom[atom].charge = -1.00;
}
/* charged residues */
if ((strcmp(This_Structure.Residue[residue].res_name,
"ARG") == 0) &&
(strncmp(This_Structure.Residue[residue].Atom[atom].atom_name, " NH",
3) == 0)) This_Structure.Residue[residue].Atom[atom].charge = 0.50;
if ((strcmp(This_Structure.Residue[residue].res_name,
"ASP") == 0) &&
(strncmp(This_Structure.Residue[residue].Atom[atom].atom_name, " OD",
3) == 0)) This_Structure.Residue[residue].Atom[atom].charge = -0.50;
if ((strcmp(This_Structure.Residue[residue].res_name,
"GLU") == 0) &&
(strncmp(This_Structure.Residue[residue].Atom[atom].atom_name, " OE",
3) == 0)) This_Structure.Residue[residue].Atom[atom].charge = -0.50;
if ((strcmp(This_Structure.Residue[residue].res_name,
"LYS") == 0) &&
(strcmp(This_Structure.Residue[residue].Atom[atom].atom_name,
" NZ ") == 0)) This_Structure.Residue[residue].Atom[atom].charge = 1.00;
}
}
/************/
}
/************************/
void electric_field(struct Structure This_Structure, float grid_span, int grid_size, float *grid) {
/************/
/* Counters */
int residue, atom;
/* Co-ordinates */
int x, y, z;
float x_centre, y_centre, z_centre;
/* Variables */
float distance;
float phi, epsilon;
/************/
for (x = 0; x < grid_size; x++) {
for (y = 0; y < grid_size; y++) {
for (z = 0; z < grid_size; z++) {
grid[gaddress(x, y, z, grid_size)] = (float)0;
}
}
}
/************/
setvbuf(stdout, (char *)NULL, _IONBF, 0);
printf(" electric field calculations ( one dot / grid sheet ) ");
for (x = 0; x < grid_size; x++) {
printf(".");
x_centre = gcentre(x, grid_span, grid_size);
for (y = 0; y < grid_size; y++) {
y_centre = gcentre(y, grid_span, grid_size);
for (z = 0; z < grid_size; z++) {
z_centre = gcentre(z, grid_span, grid_size);
phi = 0;
for (residue = 1; residue <= This_Structure.length; residue++) {
for (atom = 1; atom <= This_Structure.Residue[residue].size; atom++) {
if (This_Structure.Residue[residue].Atom[atom].charge != 0) {
// Inlined pythagoras function with a macro to avoid call overhead
distance = PYTHAGORAS(This_Structure.Residue[residue].Atom[atom].coord[1],
This_Structure.Residue[residue].Atom[atom].coord[2],
This_Structure.Residue[residue].Atom[atom].coord[3],
x_centre,
y_centre,
z_centre);
if (distance < 2.0) distance = 2.0;
if (distance >= 2.0) {
if (distance >= 8.0) {
epsilon = 80;
} else {
if (distance <= 6.0) {
epsilon = 4;
} else {
epsilon = (38 * distance) - 224;
}
}
phi += (This_Structure.Residue[residue].Atom[atom].charge / (epsilon * distance));
}
}
}
}
grid[gaddress(x, y, z, grid_size)] = (float)phi;
}
}
}
printf("\n");
/************/
}
/************************/
void electric_point_charge(struct Structure This_Structure, float grid_span, int grid_size, float *grid) {
/************/
/* Counters */
int residue, atom;
/* Co-ordinates */
int x, y, z;
int x_low, x_high, y_low, y_high, z_low, z_high;
float a, b, c;
float x_corner, y_corner, z_corner;
float w;
/* Variables */
float one_span;
/************/
for (x = 0; x < grid_size; x++) {
for (y = 0; y < grid_size; y++) {
for (z = 0; z < grid_size; z++) {
grid[gaddress(x, y, z, grid_size)] = (float)0;
}
}
}
/************/
one_span = grid_span / (float)grid_size;
for (residue = 1; residue <= This_Structure.length; residue++) {
for (atom = 1; atom <= This_Structure.Residue[residue].size; atom++) {
if (This_Structure.Residue[residue].Atom[atom].charge != 0) {
x_low = gord(This_Structure.Residue[residue].Atom[atom].coord[1] - (one_span / 2),
grid_span,
grid_size);
y_low = gord(This_Structure.Residue[residue].Atom[atom].coord[2] - (one_span / 2),
grid_span,
grid_size);
z_low = gord(This_Structure.Residue[residue].Atom[atom].coord[3] - (one_span / 2),
grid_span,
grid_size);
x_high = x_low + 1;
y_high = y_low + 1;
z_high = z_low + 1;
a = This_Structure.Residue[residue].Atom[atom].coord[1] -
gcentre(x_low, grid_span, grid_size) - (one_span / 2);
b = This_Structure.Residue[residue].Atom[atom].coord[2] -
gcentre(y_low, grid_span, grid_size) - (one_span / 2);
c = This_Structure.Residue[residue].Atom[atom].coord[3] -
gcentre(z_low, grid_span, grid_size) - (one_span / 2);
for (x = x_low; x <= x_high; x++) {
x_corner = one_span * ((float)(x - x_high) + .5);
for (y = y_low; y <= y_high; y++) {
y_corner = one_span * ((float)(y - y_high) + .5);
for (z = z_low; z <= z_high; z++) {
z_corner = one_span * ((float)(z - z_high) + .5);
w = ((x_corner + a) * (y_corner + b) * (z_corner + c)) /
(8.0 * x_corner * y_corner * z_corner);
grid[gaddress(x, y, z,
grid_size)] +=
(float)(w * This_Structure.Residue[residue].Atom[atom].charge);
}
}
}
}
}
}
/************/
}
/************************/
void electric_field_zero_core(int grid_size, float *elec_grid, float *surface_grid, float internal_value) {
/************/
/* Co-ordinates */
int x, y, z;
/************/
for (x = 0; x < grid_size; x++) {
for (y = 0; y < grid_size; y++) {
for (z = 0; z < grid_size; z++) {
if (surface_grid[gaddress(x, y, z,
grid_size)] ==
(float)internal_value) elec_grid[gaddress(x, y, z, grid_size)] = (float)0;
}
}
}
/************/
}
| 34.366438 | 114 | 0.46577 |
eae6342aa14571f19a04bb2524bcc126909738ce | 289 | c | C | models/Flight/source/tower_signal_comm_uartISR_321.c | drwhomphd/formal-methods-workbench | 4a530f3e39e5617311cba905f1425b71b52793b9 | [
"BSD-3-Clause"
] | 27 | 2015-01-12T19:08:40.000Z | 2021-11-10T08:17:31.000Z | models/Flight/source/tower_signal_comm_uartISR_321.c | drwhomphd/formal-methods-workbench | 4a530f3e39e5617311cba905f1425b71b52793b9 | [
"BSD-3-Clause"
] | 99 | 2015-01-06T19:05:31.000Z | 2018-12-11T14:24:34.000Z | models/Flight/source/tower_signal_comm_uartISR_321.c | drwhomphd/formal-methods-workbench | 4a530f3e39e5617311cba905f1425b71b52793b9 | [
"BSD-3-Clause"
] | 27 | 2015-02-24T06:22:50.000Z | 2021-09-23T08:50:52.000Z | /* This file has been autogenerated by Ivory
* Compiler version 0.1.0.0
*/
#include "tower_signal_comm_uartISR_321.h"
bool receiveFromSig_uartISR_321_chan319_323(uint8_t* n_var0)
{
return true;
}
bool emitFromSig_uartISR_321_chan320_325(const uint8_t* n_var0)
{
return true;
} | 20.642857 | 63 | 0.771626 |
eae6adf17f13147c77530fddfbf67321ace8d22b | 1,701 | h | C | src/ui/Windows/CryptKeyEntry.h | raydouglass/pwsafe | 16de7648ad7a5c754659a31429f8de3b638e62cc | [
"Artistic-2.0"
] | null | null | null | src/ui/Windows/CryptKeyEntry.h | raydouglass/pwsafe | 16de7648ad7a5c754659a31429f8de3b638e62cc | [
"Artistic-2.0"
] | null | null | null | src/ui/Windows/CryptKeyEntry.h | raydouglass/pwsafe | 16de7648ad7a5c754659a31429f8de3b638e62cc | [
"Artistic-2.0"
] | 1 | 2020-02-15T15:03:03.000Z | 2020-02-15T15:03:03.000Z | /*
* Copyright (c) 2003-2016 Rony Shapiro <ronys@pwsafe.org>.
* All rights reserved. Use of the code is allowed under the
* Artistic License 2.0 terms, as specified in the LICENSE file
* distributed with this code, or available from
* http://www.opensource.org/licenses/artistic-license-2.0.php
*/
#pragma once
// CryptKeyEntry.h
//-----------------------------------------------------------------------------
#include "SecString.h"
#include "core/PwsPlatform.h"
#include <afxwin.h>
/**
* This dialog box is used for the "undocumented" file encryption/decryption mode.
* This means that it's invoked instead of DboxMain, and specifically before our
* framework is fully initialized. This is why this MUST be a CDialog, and NOT
* CPWDialog derived class.
*/
class CCryptKeyEntry : public CDialog
{
// Construction
public:
CCryptKeyEntry(bool isEncrypt, CWnd* pParent = NULL);
// Dialog Data
//{{AFX_DATA(CCryptKeyEntry)
enum { IDD = IDD_CRYPTKEYENTRY };
CSecString m_cryptkey1;
CSecString m_cryptkey2;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CCryptKeyEntry)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
virtual BOOL OnInitDialog();
// Generated message map functions
//{{AFX_MSG(CCryptKeyEntry)
virtual void OnCancel();
virtual void OnOK();
afx_msg void OnHelp();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
private:
bool m_encrypt; // from c'tor. False == decrypt, don't confirm password
};
//-----------------------------------------------------------------------------
// Local variables:
// mode: c++
// End:
| 26.578125 | 82 | 0.655497 |
eae7036dafb316788cc131650b80e1aa2a6f353f | 3,630 | h | C | core/sql/parser/ElemDDLConstraintNotNull.h | CoderSong2015/Apache-Trafodion | 889631aae9cdcd38fca92418d633f2dedc0be619 | [
"Apache-2.0"
] | 148 | 2015-06-18T21:26:04.000Z | 2017-12-25T01:47:01.000Z | core/sql/parser/ElemDDLConstraintNotNull.h | CoderSong2015/Apache-Trafodion | 889631aae9cdcd38fca92418d633f2dedc0be619 | [
"Apache-2.0"
] | 1,352 | 2015-06-20T03:05:01.000Z | 2017-12-25T14:13:18.000Z | core/sql/parser/ElemDDLConstraintNotNull.h | CoderSong2015/Apache-Trafodion | 889631aae9cdcd38fca92418d633f2dedc0be619 | [
"Apache-2.0"
] | 166 | 2015-06-19T18:52:10.000Z | 2017-12-27T06:19:32.000Z | /**********************************************************************
// @@@ START COPYRIGHT @@@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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.
//
// @@@ END COPYRIGHT @@@
**********************************************************************/
#ifndef ELEMDDLCONSTRAINTNOTNULL_H
#define ELEMDDLCONSTRAINTNOTNULL_H
/* -*-C++-*-
*****************************************************************************
*
* File: ElemDDLConstraintNotNull.h
* Description: class for Not Null constraint definitions in DDL statements
*
*
* Created: 3/29/95
* Language: C++
*
*
*
*
*****************************************************************************
*/
#include "ElemDDLConstraint.h"
// -----------------------------------------------------------------------
// contents of this file
// -----------------------------------------------------------------------
class ElemDDLConstraintNotNull;
// -----------------------------------------------------------------------
// forward references
// -----------------------------------------------------------------------
// None.
// -----------------------------------------------------------------------
// defintion of class ElemDDLConstraintNotNull
// -----------------------------------------------------------------------
class ElemDDLConstraintNotNull : public ElemDDLConstraint
{
public:
// constructors
ElemDDLConstraintNotNull(NABoolean isNotNull = TRUE, CollHeap * h=PARSERHEAP())
: ElemDDLConstraint(h, ELM_CONSTRAINT_NOT_NULL_ELEM),
isNotNull_(isNotNull)
{ }
inline ElemDDLConstraintNotNull(const NAString & constraintName,
NABoolean isNotNull = TRUE,
CollHeap * h=PARSERHEAP());
// copy ctor
ElemDDLConstraintNotNull (const ElemDDLConstraintNotNull & orig,
CollHeap * h=0) ; // not written
// virtual destructor
virtual ~ElemDDLConstraintNotNull();
// cast
virtual ElemDDLConstraintNotNull * castToElemDDLConstraintNotNull();
virtual NABoolean isConstraintNotNull() const
// { return TRUE; }
{ return isNotNull_; }
// methods for tracing
virtual const NAString displayLabel2() const;
virtual const NAString getText() const;
private:
NABoolean isNotNull_;
}; // class ElemDDLConstraintNotNull
// -----------------------------------------------------------------------
// definitions of inline methods for class ElemDDLConstraintNotNull
// -----------------------------------------------------------------------
//
// constructors
//
inline
ElemDDLConstraintNotNull::ElemDDLConstraintNotNull (
const NAString & constraintName,
const NABoolean isNotNull,
CollHeap * h)
: ElemDDLConstraint(h, ELM_CONSTRAINT_NOT_NULL_ELEM,
constraintName),
isNotNull_(isNotNull)
{
}
#endif // ELEMDDLCONSTRAINTNOTNULL_H
| 31.842105 | 80 | 0.534435 |
eae87a598b34cd3f66d0d9a3e113092c1359a203 | 514 | h | C | Base/swap.h | cguevaramorel/ogs5 | 8543147704503e2bd1855da7ba8614437e1ebbc8 | [
"BSD-4-Clause"
] | 30 | 2015-09-26T00:26:28.000Z | 2022-01-20T10:13:13.000Z | Base/swap.h | cguevaramorel/ogs5 | 8543147704503e2bd1855da7ba8614437e1ebbc8 | [
"BSD-4-Clause"
] | 129 | 2016-01-25T12:54:40.000Z | 2021-04-10T18:57:37.000Z | Base/swap.h | cguevaramorel/ogs5 | 8543147704503e2bd1855da7ba8614437e1ebbc8 | [
"BSD-4-Clause"
] | 100 | 2015-08-01T12:04:34.000Z | 2022-03-16T16:22:39.000Z | /**
* \copyright
* Copyright (c) 2020, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#ifndef SWAP_H_
#define SWAP_H_
namespace BASELIB
{
/**
* swap the content of arg0 and arg1
*/
template <class T>
void swap(T& arg0, T& arg1)
{
T temp(arg0);
arg0 = arg1;
arg1 = temp;
}
} // end namespace BASELIB
#endif // SWAP_H_
| 18.357143 | 71 | 0.620623 |
eaea87c5678ff4ddac1c3f80f3f0af43e975ba0c | 320 | h | C | vbnmr/vbnmr.h | geekysuavo/vbnmr | 08367fb01c9ac3f24a392f2b8ae7eba6a60f3f5c | [
"MIT"
] | null | null | null | vbnmr/vbnmr.h | geekysuavo/vbnmr | 08367fb01c9ac3f24a392f2b8ae7eba6a60f3f5c | [
"MIT"
] | null | null | null | vbnmr/vbnmr.h | geekysuavo/vbnmr | 08367fb01c9ac3f24a392f2b8ae7eba6a60f3f5c | [
"MIT"
] | 1 | 2019-05-07T01:50:35.000Z | 2019-05-07T01:50:35.000Z |
/* ensure once-only inclusion. */
#ifndef __VBNMR_VBNMR_H__
#define __VBNMR_VBNMR_H__
/* include the vfl header. */
#include <vfl/vfl.h>
/* include core vbnmr headers. */
#include <vbnmr/quad.h>
#include <vbnmr/vfgp.h>
/* function declarations (vbnmr.c): */
int vbnmr_init (void);
#endif /* !__VBNMR_VBNMR_H__ */
| 16.842105 | 38 | 0.7 |
eaec26f66095c63dea98dd48367a8660ac67d3d3 | 15,458 | c | C | MCUX_FRDM_KL02Z_IoT_RTU_demo/sdk_peripherals/sdk_pph_ec25au.c | IvanJArrieta/Proyecto_Final | 2264a6ed7682d8c8dece4e053276ec52a0548e1c | [
"MIT"
] | null | null | null | MCUX_FRDM_KL02Z_IoT_RTU_demo/sdk_peripherals/sdk_pph_ec25au.c | IvanJArrieta/Proyecto_Final | 2264a6ed7682d8c8dece4e053276ec52a0548e1c | [
"MIT"
] | null | null | null | MCUX_FRDM_KL02Z_IoT_RTU_demo/sdk_peripherals/sdk_pph_ec25au.c | IvanJArrieta/Proyecto_Final | 2264a6ed7682d8c8dece4e053276ec52a0548e1c | [
"MIT"
] | null | null | null | /*! @file : sdk_pph_ec25au.c
* @author Ernesto Andres Rincon Cruz
* @version 1.0.0
* @date 23/01/2021
* @brief Driver para modem EC25AU
* @details
*
*/
/*******************************************************************************
* Includes
******************************************************************************/
#include "stdio.h"
#include "stdlib.h"
#include "sdk_pph_ec25au.h"
#include "sdk_mdlw_leds.h"
/*******************************************************************************
* Definitions
******************************************************************************/
typedef struct _estado_fsm{
uint8_t anterior;
uint8_t actual;
}estado_fsm_t;
enum _ec25_lista_ordendes{
kORDEN_NO_HAY_EN_EJECUCION=0,
kORDEN_ENVIAR_MENSAJE_DE_TEXTO,
};
#define EC25_BYTES_EN_BUFFER 100
/*******************************************************************************
* Private Prototypes
******************************************************************************/
void ec25BorrarBufferRX(void);
/*******************************************************************************
* External vars
******************************************************************************/
/*******************************************************************************
* Local vars
******************************************************************************/
uint8_t ec25_buffer_tx[EC25_BYTES_EN_BUFFER]; //almacena los datos a enviar al modem
uint8_t ec25_buffer_rx[EC25_BYTES_EN_BUFFER]; //almacena las datos que provienen del modem
uint8_t ec25_index_buffer_rx = 0; //apuntador de buffer de datos
estado_fsm_t ec25_fsm; //almacena estado actual de la maquina de estados modem EC25
uint32_t ec25_timeout; //almacena las veces que han llamado la fsm del EC25 y estimar tiempo
uint8_t ec25_comando_en_ejecucion; //almacena ultimo comando enviado para ser ejecutado
//Listado de comando AT disponibles para ser enviados al modem Quectel
const char *ec25_comandos_at[] = {
"AT", //comprueba disponibilidad de dispositivo
"ATI", //consulta información del modem
"AT+CPIN?", //consulta estado de la simcard
"AT+CREG?", //consulta estado de la red celular y tecnología usada en red celular
"AT+CMGF=1", //asigna modo texto para enviar mensajes
"AT+CMGS=\"3003564960\"",//envia mensaje de texto a numero definido
"Mensaje", //MENSAJE & CTRL+Z
"AT+CSQ", //consulta calidad de la señal RSSI
};
//Lista de respuestas a cada comando AT
const char *ec25_repuestas_at[]={
"OK", //AT
"EC25", //ATI
"READY", //AT+CPIN?
"0,1", //AT+CREG? = GSM,REGISTERED
"OK", //AT+CMGF=1
">", //AT+CMGS
"OK", //MENSAJE & CTRL+Z
"+CSQ:" //AT+CSQ
};
/*******************************************************************************
* Private Source Code
******************************************************************************/
//------------------------------------
void ec25BorrarBufferRX(void){
uint8_t i;
//LLenar de ceros buffer que va a recibir datos provenientes del modem
for(i=0;i<EC25_BYTES_EN_BUFFER;i++){
ec25_buffer_rx[i]=0;
}
//borra apuntador de posicion donde se va a almacenar el proximo dato
//Reset al apuntador
ec25_index_buffer_rx=0;
}
//------------------------------------
void ec25BorrarBufferTX(void){
uint8_t i;
//LLenar de ceros buffer que va a recibir datos provenientes del modem
for(i=0;i<EC25_BYTES_EN_BUFFER;i++){
ec25_buffer_tx[i]=0;
}
}
//------------------------------------
void waytTimeModem(void) {
uint32_t tiempo = 0xFFFF;
do {
tiempo--;
} while (tiempo != 0x0000);
}
//------------------------------------
void ec25EnviarComandoAT(uint8_t comando){
printf("%s\r\n", ec25_comandos_at[comando]); //Envia comando AT indicado
}
//------------------------------------
status_t ec25ProcesarRespuestaAT(uint8_t comando){
status_t resultado_procesamiento; //variable que almacenará el resultado del procesamiento
uint8_t *puntero_ok=0; //variable temporal que será usada para buscar respuesta
switch(ec25_fsm.anterior){
case kFSM_ENVIANDO_AT:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),(char*) (ec25_repuestas_at[kAT])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_ATI:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kATI])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_CPIN:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kAT_CPIN])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_CREG:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kAT_CREG])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_CMGF:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kAT_CMGF_1])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_CMGS:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kAT_CMGS])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_MENSAJE_TXT:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kAT_TEXT_MSG_END])));
if(puntero_ok!=0x00){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
case kFSM_ENVIANDO_CSQ:
//Busca palabra EC25 en buffer rx de quectel
puntero_ok = (uint8_t*) (strstr((char*) (&ec25_buffer_rx[0]),
(char*) (ec25_repuestas_at[kAT_CSQ])));
if(puntero_ok!=0x00){
//la respuesta a AT+CSQ incluye dos parametros RSSI,BER
//el valor de interes para la aplicación es RSSI
char string_data[4];
int8_t rssi; // received signal strength
uint8_t i; //usada para borrar los daot s
//borra buffer que va a almacenar string
for(i=0;i<sizeof(string_data);i++){
string_data[i]=0;
}
memcpy(&string_data[0],puntero_ok+5, 3); //copia los bytes que corresponden al RSSI (3 digitos)
rssi=(int8_t)atoi(&string_data[0]);//convierte string a entero
if((rssi>EC25_RSSI_MINIMO_ACEPTADO)&&(rssi!=99)){
resultado_procesamiento=kStatus_Success;
}else{
resultado_procesamiento=kStatus_OutOfRange;
}
}else{
resultado_procesamiento=kStatus_Fail;
}
break;
default:
//para evitar bloqueos, si se le especifica un comando incorrecto, genera error
resultado_procesamiento=kStatus_Fail;
break;
}
return(resultado_procesamiento);
}
/*******************************************************************************
* Public Source Code
******************************************************************************/
status_t ec25Inicializacion(void){
ec25_fsm.anterior=kFSM_INICIO; //reinicia estado anterios
ec25_fsm.actual=kFSM_INICIO; //reinicia estado actual
ec25_timeout=0; //borra contador de tiempo
ec25BorrarBufferTX(); //borrar buffer de transmisión
ec25BorrarBufferRX(); //borra buffer de recepción
ec25_comando_en_ejecucion=kORDEN_NO_HAY_EN_EJECUCION; //Borra orden en ejecucion actual
return(kStatus_Success);
}
//------------------------------------
status_t ec25EnviarMensajeDeTexto(uint8_t *mensaje, uint8_t size_mensaje ){
memcpy(&ec25_buffer_tx[0],mensaje, size_mensaje); //copia mensaje a enviar en buffer TX del EC25
ec25_comando_en_ejecucion=kORDEN_ENVIAR_MENSAJE_DE_TEXTO; //almacena cual es la orden que debe cumplir la FSM
ec25_fsm.actual=kFSM_ENVIANDO_AT; //inicia la FSM a rtabajar desde el primer comando AT
return(kStatus_Success);
}
//------------------------------------
uint8_t ec25Polling(void){
status_t resultado;
uint8_t nuevo_byte_uart;
uint8_t *puntero_ok=0; //variable temporal que será usada para buscar respuesta
switch (ec25_fsm.actual) {
case kFSM_INICIO:
//En este estado no hace nada y está a la espera de iniciar una nueva orden
break;
case kFSM_RESULTADO_ERROR:
//Se queda en este estado y solo se sale cuando se utilice la función ec25Inicializacion();
break;
case kFSM_RESULTADO_EXITOSO:
//Se queda en este estado y solo se sale cuando se utilice la función ec25Inicializacion();
break;
case kFSM_RESULTADO_ERROR_RSSI:
//Se queda en este estado y solo se sale cuando se utilice la función ec25Inicializacion();
break;
case kFSM_ENVIANDO_AT:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kAT); //Envia comando AT
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_ATI:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kATI); //Envia comando AT
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_CPIN:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kAT_CPIN); //Envia comando AT+CPIN?
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_CSQ:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kAT_CSQ); //Envia comando AT+CSQ
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_CREG:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kAT_CREG); //Envia comando AT+CREG?
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_CMGF:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kAT_CMGF_1); //Envia comando AT+CMGF=1
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_CMGS:
ec25BorrarBufferRX(); //limpia buffer para recibir datos de quectel
ec25EnviarComandoAT(kAT_CMGS); //Envia comando AT+CMGS="3003564960"
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ENVIANDO_MENSAJE_TXT:
printf("%s\r\n%c", ec25_buffer_tx,0x1A); //Envia mensaje de texto incluido CTRL+Z (0x1A)
ec25_fsm.anterior = ec25_fsm.actual; //almacena el estado actual
ec25_fsm.actual = kFSM_ESPERANDO_RESPUESTA; //avanza a esperar respuesta del modem
ec25_timeout = 0; //reset a contador de tiempo
break;
case kFSM_ESPERANDO_RESPUESTA:
ec25_timeout++; //incrementa contador de tiempo
//Busca si llegaron nuevos datos desde modem mientras esperaba
while (uart0CuantosDatosHayEnBuffer() > 0) {
resultado = uart0LeerByteDesdeBuffer(&nuevo_byte_uart);
//si fueron encontrados nuevos bytes en UART entonces los mueve al buffer del EC25
if (resultado == kStatus_Success) {
//reinicia contador de tiempo
ec25_timeout=0;
//almacena dato en buffer rx de quectel
ec25_buffer_rx[ec25_index_buffer_rx] = nuevo_byte_uart;
//incrementa apuntador de datos en buffer de quectel
ec25_index_buffer_rx++;
}
}
//pregunta si el tiempo de espera supera el configurado
if (ec25_timeout > EC25_TIEMPO_MAXIMO_ESPERA) {
ec25_fsm.actual = kFSM_PROCESANDO_RESPUESTA;
}
break;
case kFSM_PROCESANDO_RESPUESTA:
//procesa respuesta dependiendo de cual comando AT se le había enviado al modem
resultado = ec25ProcesarRespuestaAT(ec25_fsm.anterior);
//Si la respuesta al comando AT es correcta (kStatus_Success), avanza al siguiente resultado
switch (resultado) {
case kStatus_Success:
//el siguiente estado depende del estado anterior
switch (ec25_fsm.anterior) {
case kFSM_ENVIANDO_AT:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el estado actual
ec25_fsm.actual = kFSM_ENVIANDO_ATI;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_ATI:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el resultado actual
ec25_fsm.actual = kFSM_ENVIANDO_CPIN;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_CPIN:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el estado actual
ec25_fsm.actual = kFSM_ENVIANDO_CREG;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_CREG:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el estado actual
ec25_fsm.actual = kFSM_ENVIANDO_CSQ;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_CSQ:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el resultado actual
ec25_fsm.actual = kFSM_ENVIANDO_CMGF;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_CMGF:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el resultado actual
ec25_fsm.actual = kFSM_ENVIANDO_CMGS;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_CMGS:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el estado actual
ec25_fsm.actual = kFSM_ENVIANDO_MENSAJE_TXT;//avanza a enviar nuevo comando al modem
break;
case kFSM_ENVIANDO_MENSAJE_TXT:
ec25_fsm.anterior = ec25_fsm.actual;//almacena el estado actual
ec25_fsm.actual = kFSM_RESULTADO_EXITOSO;//avanza a enviar nuevo comando al modem
break;
default:
//para evitar bloqueos, marca error de proceso en caso de detectar un estado ilegal
ec25_fsm.actual = kFSM_RESULTADO_ERROR; //se queda en resultado de error
break;
}
break;
case kStatus_OutOfRange:
//si la respuesta del analisis es fuera de rango, indica que el RSSI no se cumple
ec25_fsm.actual = kFSM_RESULTADO_ERROR_RSSI;//se queda en resultado de error
break;
default:
//Si la respuesta es incorrecta, se queda en resultado de error
//No se cambia (ec25_fsm.anterior) para mantener en que comando AT fue que se generó error
ec25_fsm.actual = kFSM_RESULTADO_ERROR; //se queda en resultado de error
break;
}
}
return(ec25_fsm.actual);
}
| 35.535632 | 110 | 0.681524 |
eaef28de3038d15c07891281de86eadbc824401a | 1,161 | h | C | DTSource/Variables/1D/DTMesh1DGrid.h | newby-jay/AshbyaTracking | 9e80513d52281cf51d35bfef1e164148a9d3439e | [
"Apache-2.0"
] | null | null | null | DTSource/Variables/1D/DTMesh1DGrid.h | newby-jay/AshbyaTracking | 9e80513d52281cf51d35bfef1e164148a9d3439e | [
"Apache-2.0"
] | null | null | null | DTSource/Variables/1D/DTMesh1DGrid.h | newby-jay/AshbyaTracking | 9e80513d52281cf51d35bfef1e164148a9d3439e | [
"Apache-2.0"
] | null | null | null | // Part of DTSource. Copyright 2004-2017. David Adalsteinsson.
// see http://www.visualdatatools.com/DTSource/license.html for more information.
#ifndef DTMesh1DGrid_H
#define DTMesh1DGrid_H
#include "DTDataStorage.h"
class DTMesh1DGrid {
public:
DTMesh1DGrid() : _m(0), _origin(0), _h(1.0) {};
DTMesh1DGrid(double origin,double h,int m);
int m(void) const {return _m;}
double Origin(void) const {return _origin;}
double h(void) const {return _h;}
bool IsStandard(void) const {return (_origin==0.0 && _h==1.0);}
double FromSpaceToGrid(double v);
void pinfo(void) const;
private:
int _m;
double _origin;
double _h;
};
bool operator==(const DTMesh1DGrid &,const DTMesh1DGrid &);
bool operator!=(const DTMesh1DGrid &,const DTMesh1DGrid &);
// Conversion
// Reading and writing
extern void Read(const DTDataStorage &input,const std::string &name,DTMesh1DGrid &toReturn);
extern void Write(DTDataStorage &output,const std::string &name,const DTMesh1DGrid &theVar);
extern void WriteOne(DTDataStorage &output,const std::string &name,const DTMesh1DGrid &toWrite); // One time value, self documenting.
#endif
| 28.317073 | 133 | 0.723514 |
eaef4861c5648226fb922f87ef2232e13bd9a64d | 887 | h | C | usr/src/cmd/mdb/common/modules/genunix/cred.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/cmd/mdb/common/modules/genunix/cred.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | null | null | null | usr/src/cmd/mdb/common/modules/genunix/cred.h | AsahiOS/gate | 283d47da4e17a5871d9d575e7ffb81e8f6c52e51 | [
"MIT"
] | 1 | 2020-12-30T00:04:16.000Z | 2020-12-30T00:04:16.000Z | /*
* This file and its contents are supplied under the terms of the
* Common Development and Distribution License ("CDDL"), version 1.0.
* You may only use this file in accordance with the terms of version
* 1.0 of the CDDL.
*
* A full copy of the text of the CDDL should have accompanied this
* source. A copy of the CDDL is also available via the Internet at
* http://www.illumos.org/license/CDDL.
*/
/*
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
*/
#ifndef _MDB_CRED_H
#define _MDB_CRED_H
#include <mdb/mdb_modapi.h>
#ifdef __cplusplus
extern "C" {
#endif
int cmd_cred(uintptr_t, uint_t, int, const mdb_arg_t *);
int cmd_credgrp(uintptr_t, uint_t, int, const mdb_arg_t *);
int cmd_credsid(uintptr_t, uint_t, int, const mdb_arg_t *);
int cmd_ksidlist(uintptr_t, uint_t, int, const mdb_arg_t *);
#ifdef __cplusplus
}
#endif
#endif /* _MDB_CRED_H */
| 25.342857 | 69 | 0.730552 |
eaf15531d8d59cd35c0418bb8a33ca13557042af | 4,253 | c | C | src/driver_web.c | JirJIN/core | 0199fddc6092d78e4c0613dfdc7a176cd5037255 | [
"Zlib"
] | null | null | null | src/driver_web.c | JirJIN/core | 0199fddc6092d78e4c0613dfdc7a176cd5037255 | [
"Zlib"
] | null | null | null | src/driver_web.c | JirJIN/core | 0199fddc6092d78e4c0613dfdc7a176cd5037255 | [
"Zlib"
] | null | null | null | #ifndef __EMSCRIPTEN__
#error Use Emscripten for building for web, if you are, something is mad sus
#endif
#include "core/core.h"
#include "core/thread/thread.h"
#include <emscripten/emscripten.h>
#include "core/gll/gll.h"
#include "core/window/window.h"
extern struct JIN_Window *root;
extern unsigned int shaderProgram;
extern unsigned int VAO;
extern float r;
extern float g;
extern float b;
const char *vertexShaderSourceWeb = "#version 300 es\n"
"layout (location = 0) in vec3 aPos;\n"
"void main()\n"
"{\n"
" gl_Position = vec4(aPos.x, aPos.y, aPos.z, 1.0);\n"
"}\0";
const char *fragmentShaderSourceWeb = "#version 300 es\n"
"precision highp float;\n"
"out vec4 FragColor;\n"
"void main()\n"
"{\n"
" FragColor = vec4(1.0f, 0.5f, 0.2f, 1.0f);\n"
"}\n\0";
#include <stdio.h>
void web_loop(void)
{
JIN_window_gl_set(root);
JIN_gll();
/* Learn OpenGL #1 triangle, THIS IS NOT MY CODE, JUST FOR TEMPORARY TESTING (checkout src, good stuff in there) */
// build and compile our shader program
// ------------------------------------
// vertex shader
unsigned int vertexShader = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(vertexShader, 1, &vertexShaderSourceWeb, NULL);
glCompileShader(vertexShader);
// check for shader compile errors
int success;
char infoLog[512];
glGetShaderiv(vertexShader, GL_COMPILE_STATUS, &success);
if (!success)
{
glGetShaderInfoLog(vertexShader, 512, NULL, infoLog);
printf("Shader compilation failed: %s\n", infoLog);
}
// fragment shader
unsigned int fragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(fragmentShader, 1, &fragmentShaderSourceWeb, NULL);
glCompileShader(fragmentShader);
// check for shader compile errors
glGetShaderiv(fragmentShader, GL_COMPILE_STATUS, &success);
if (!success)
{
glGetShaderInfoLog(fragmentShader, 512, NULL, infoLog);
printf("Shader compilation failed: %s\n", infoLog);
}
// link shaders
shaderProgram = glCreateProgram();
glAttachShader(shaderProgram, vertexShader);
glAttachShader(shaderProgram, fragmentShader);
glLinkProgram(shaderProgram);
// check for linking errors
glGetProgramiv(shaderProgram, GL_LINK_STATUS, &success);
if (!success) {
glGetProgramInfoLog(shaderProgram, 512, NULL, infoLog);
printf("Shader linking failed: %s\n", infoLog);
}
glDeleteShader(vertexShader);
glDeleteShader(fragmentShader);
// set up vertex data (and buffer(s)) and configure vertex attributes
// ------------------------------------------------------------------
float vertices[] = {
0.0f, 0.5f, 0.0f, // top
0.5f, -0.5f, 0.0f, // bottom right
-0.5f, -0.5f, 0.0f, // bottom left
};
unsigned int VBO;
glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
glBindVertexArray(VAO);
glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);
// note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);
// You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other
// VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.
glBindVertexArray(0);
r = 0.2f, g = 0.3f, b = 0.3f;
JIN_tick();
JIN_dialog("Starting game loop");
JIN_tick();
JIN_dialog("Really long string. Let's try to get some overflow and see what happens...");
emscripten_set_main_loop(JIN_tick, 60, EM_TRUE);
JIN_window_gl_unset(root);
}
int main(int argc, char *args[])
{
EM_ASM(alert('Confirm to begin'));
JIN_init();
web_loop();
JIN_input_loop();
JIN_quit();
return 0;
}
| 32.465649 | 170 | 0.671056 |
eaf1d63edb17a161b13900028880e202ca1f4d96 | 1,587 | h | C | Libraries/LEDControl/LEDControl.h | LeeNuss/Bar-Light-Control | 22fb6b84ccf25a4c3aa39d65bedf074b7eba4764 | [
"MIT"
] | 1 | 2020-11-24T16:15:26.000Z | 2020-11-24T16:15:26.000Z | Libraries/LEDControl/LEDControl.h | LeeNuss/Bar-Light-Control | 22fb6b84ccf25a4c3aa39d65bedf074b7eba4764 | [
"MIT"
] | null | null | null | Libraries/LEDControl/LEDControl.h | LeeNuss/Bar-Light-Control | 22fb6b84ccf25a4c3aa39d65bedf074b7eba4764 | [
"MIT"
] | null | null | null | /* Touchscreen control for the bar light
* Program made by Linus Reitmayr,
*
*/
#ifndef LEDControl_H
#define LEDControl_H
#include <Tlc5940.h>
//#include <avr/pgmspace.h>
#include <ledTFT.h>
#define RED 0
#define GREEN 1
#define BLUE 2
class LEDControl {
public:
//======= CONSTRUCTOR ============
LEDControl();
//======= PUBLIC FUNCTIONS ============
void setupTLC() const;
////======= Animations ============
void fadeLEDs();
void randomColours();
private:
//======= GENERAL VARS ============
uint8_t currentStep; //Number of the current Step
uint8_t currentKrug; //Current Krug, where colour is changed
uint8_t krugCounter;
bool direction;
//======= FADE FUNC VARS ============
unsigned long previous_fadeLEDs_Millis; //Timers for the functions
uint16_t currentColour[3]; //Colours in longPWM values of the current step
uint16_t nextColour[3]; //Colours in longPWM values of the current step
uint8_t currentColourID;
uint8_t nextColourID;
//====== SOUND DETECTION ===========
uint8_t microphonePin; // select the input pin for the potentiometer
uint16_t microphoneValue; // variable to store the value coming from the sensor
//======= PRIVATE FUNCTIONS ============
void calculateCurrentColour(uint8_t colourID);
void calculateNextColour(uint8_t colourID);
void updateKrugColour(uint8_t bufCurrentColourID, uint8_t bufNextColourID);
void updateCurrentStep();
void updateCurrentStepUpDown();
};
#endif
| 25.596774 | 96 | 0.63201 |
eaf1dda6521217302cf199c3b148f518b88f6a08 | 1,769 | h | C | src/include/main.h | YuanYuLin/iopctest | b37d265b11c116ebb8c2cebda0dd8abc24046b11 | [
"MIT"
] | null | null | null | src/include/main.h | YuanYuLin/iopctest | b37d265b11c116ebb8c2cebda0dd8abc24046b11 | [
"MIT"
] | null | null | null | src/include/main.h | YuanYuLin/iopctest | b37d265b11c116ebb8c2cebda0dd8abc24046b11 | [
"MIT"
] | null | null | null | #ifndef _MAIN_H_
#define _MAIN_H_
// ref https://github.com/troydhanson/network/blob/master/unixdomain/05.dgram/recv.c
extern int main_dummy(int argc, char** argv);
#ifdef UTILS_UDS
extern int main_uds(int argc, char** argv);
#define MAIN_UDS { "main_uds", main_uds }
#else
#define MAIN_UDS { "main_uds", main_dummy }
#endif
#ifdef UTILS_DB
extern int main_db(int argc, char** argv);
#define MAIN_DB { "main_db", main_db }
#else
#define MAIN_DB { "main_db", main_dummy }
#endif
#ifdef UTILS_INPUT
extern int main_input(int argc, char** argv);
#define MAIN_INPUT { "main_input", main_input }
#else
#define MAIN_INPUT { "main_input", main_dummy }
#endif
#ifdef UTILS_LXC
extern int main_lxc_create(int argc, char** argv);
#define MAIN_LXC_CREATE { "main_lxc_create", main_lxc_create }
#else
#define MAIN_LXC_CREATE { "main_lxc_create", main_dummy }
#endif
#ifdef UTILS_DRM
extern int main_drm(int argc, char** argv);
#define MAIN_DRM { "main_drm", main_drm }
#else
#define MAIN_DRM { "main_drm", main_dummy }
#endif
#ifdef UTILS_RFB
extern int main_rfb(int argc, char** argv);
#define MAIN_RFB { "main_rfb", main_rfb }
#else
#define MAIN_RFB { "main_rfb", main_dummy }
#endif
#ifdef UTILS_QEMU
extern int main_qmp(int argc, char** argv);
#define MAIN_QMP { "main_qmp", main_qmp }
extern int main_qemumonitor(int argc, char** argv);
#define MAIN_QEMUMONITOR {"main_qemumonitor", main_qemumonitor }
#else
#define MAIN_QMP { "main_qmp", main_dummy }
#define MAIN_QEMUMONITOR {"main_qemumonitor", main_dummy }
#endif
extern int main_unittest(int argc, char** argv);
#define MAIN_UNITTEST { "main_unittest", main_unittest }
extern int main_md(int argc, char** argv);
#define MAIN_MD { "main_md", main_md }
#define MAIN_END { "", NULL }
#endif
| 28.532258 | 84 | 0.736574 |
eaf2eac3b2ee418840151e234c3c7704b4a177c2 | 1,939 | h | C | arangod/Graph/GraphCache.h | Simran-B/arangodb_test | e643ddbaa8327249ae5f10add89ab9e6d9f6fecd | [
"Apache-2.0"
] | 1 | 2019-10-09T08:58:38.000Z | 2019-10-09T08:58:38.000Z | arangod/Graph/GraphCache.h | Simran-B/arangodb_test | e643ddbaa8327249ae5f10add89ab9e6d9f6fecd | [
"Apache-2.0"
] | null | null | null | arangod/Graph/GraphCache.h | Simran-B/arangodb_test | e643ddbaa8327249ae5f10add89ab9e6d9f6fecd | [
"Apache-2.0"
] | null | null | null | ////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2018 ArangoDB GmbH, Cologne, Germany
///
/// 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.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Tobias Gödderz
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_GRAPH_GRAPHCACHE_H
#define ARANGOD_GRAPH_GRAPHCACHE_H
#include <velocypack/Buffer.h>
#include <chrono>
#include <utility>
#include "Aql/Query.h"
#include "Aql/VariableGenerator.h"
#include "Basics/ReadWriteLock.h"
#include "Transaction/Methods.h"
#include "Transaction/StandaloneContext.h"
namespace arangodb {
namespace graph {
class GraphCache {
public:
// save now() along with the graph
using EntryType =
std::pair<std::chrono::steady_clock::time_point, std::shared_ptr<const Graph>>;
using CacheType = std::unordered_map<std::string, EntryType>;
// TODO The cache saves the graph names globally, not per database!
// This must be addressed as soon as it is activated.
const std::shared_ptr<const Graph> getGraph(
std::shared_ptr<transaction::Context> ctx, std::string const& name,
std::chrono::seconds maxAge = std::chrono::seconds(60));
private:
basics::ReadWriteLock _lock;
CacheType _cache;
};
} // namespace graph
} // namespace arangodb
#endif // ARANGOD_GRAPH_GRAPHCACHE_H
| 32.864407 | 85 | 0.67148 |
eaf41705cc7a7edec7ac8d89bdbb49fb7bf09f45 | 1,315 | h | C | WeChat-Headers/WCDataProviderDelegate-Protocol.h | RockerHX/FishChat | d47f3228dd1f05a7547300330adfe45a09e0175d | [
"MIT"
] | 678 | 2017-11-17T08:33:19.000Z | 2022-03-26T10:40:20.000Z | WeChat-Headers/WCDataProviderDelegate-Protocol.h | RockerHX/FishChat | d47f3228dd1f05a7547300330adfe45a09e0175d | [
"MIT"
] | 22 | 2019-04-16T05:51:53.000Z | 2021-11-08T06:18:45.000Z | WeChat-Headers/WCDataProviderDelegate-Protocol.h | RockerHX/FishChat | d47f3228dd1f05a7547300330adfe45a09e0175d | [
"MIT"
] | 170 | 2018-06-10T07:59:20.000Z | 2022-03-22T16:19:33.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@class NSArray, NSMutableArray, NSString, WCBGUserInfo, WCDataItem, WCServerConfig;
@protocol WCDataProviderDelegate <NSObject>
@optional
- (void)onPreDownloadCanvasDataItemResrc:(WCDataItem *)arg1;
- (NSMutableArray *)getCachedAdItemList;
- (void)removeAllCacheAdvertiseMsgXml;
- (NSMutableArray *)getAdMsgXmlList;
- (_Bool)mergeReceivedAdList:(NSArray *)arg1;
- (_Bool)isAdReceived:(WCDataItem *)arg1;
- (_Bool)hasExistAdInLocal:(NSString *)arg1;
- (void)onReturnServerConfig:(WCServerConfig *)arg1;
- (void)onReturnShowFlag:(unsigned int)arg1;
- (void)onReturnBGUserInfo:(WCBGUserInfo *)arg1;
- (void)onReturnIsAllData:(NSArray *)arg1 andAdData:(NSArray *)arg2;
- (void)onReturnLimitFeedId:(unsigned long long)arg1;
- (void)onNoMoreDataWithRet:(int)arg1;
- (void)onTotalCountChanged:(long long)arg1;
- (void)onDataUpdated:(NSArray *)arg1 withChangedTime:(unsigned int)arg2;
- (void)onDataUpdated:(NSArray *)arg1 maxItemID:(unsigned long long)arg2 minItemID:(unsigned long long)arg3 withChangedTime:(unsigned int)arg4;
- (void)onDataUpdated:(NSString *)arg1 andData:(NSArray *)arg2 andAdData:(NSArray *)arg3 withChangedTime:(unsigned int)arg4;
@end
| 39.848485 | 143 | 0.768061 |
eaf4178a27339d6cc238e7b38f1148352d188bfc | 3,421 | h | C | src/components/store/hstore/src/allocator_cc.h | omriarad/mcas | f47aab12754c91ebd75b0e1881c8a7cc7aa81278 | [
"Apache-2.0"
] | 60 | 2020-04-28T08:15:07.000Z | 2022-03-08T10:35:15.000Z | src/components/store/hstore/src/allocator_cc.h | omriarad/mcas | f47aab12754c91ebd75b0e1881c8a7cc7aa81278 | [
"Apache-2.0"
] | 66 | 2020-09-03T23:40:48.000Z | 2022-03-07T20:34:52.000Z | src/components/store/hstore/src/allocator_cc.h | omriarad/mcas | f47aab12754c91ebd75b0e1881c8a7cc7aa81278 | [
"Apache-2.0"
] | 13 | 2019-11-02T06:30:36.000Z | 2022-01-26T01:56:42.000Z | /*
Copyright [2017-2021] [IBM Corporation]
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 MCAS_HSTORE_ALLOCATOR_CC_H
#define MCAS_HSTORE_ALLOCATOR_CC_H
#include "deallocator_cc.h"
#include "alloc_key.h" /* AK_ACTUAL */
#include "bad_alloc_cc.h"
#include "heap_access.h"
#include "persister_cc.h"
#include "persistent.h"
#include <cstddef> /* size_t, ptrdiff_t */
template <typename T, typename Heap, typename Persister>
struct allocator_cc;
template <typename Heap, typename Persister>
struct allocator_cc<void, Heap, Persister>
: public deallocator_cc<void, Heap, Persister>
{
using deallocator_type = deallocator_cc<void, Heap, Persister>;
using typename deallocator_type::value_type;
};
template <typename T, typename Heap, typename Persister = persister>
struct allocator_cc
: public deallocator_cc<T, Heap, Persister>
{
using deallocator_type = deallocator_cc<T, Heap, Persister>;
using typename deallocator_type::heap_type;
using typename deallocator_type::size_type;
using typename deallocator_type::value_type;
using typename deallocator_type::pointer_type;
allocator_cc(const heap_access<heap_type> &pool_, Persister p_ = Persister()) noexcept
: deallocator_type(pool_, (p_))
{}
allocator_cc(const allocator_cc &a_) noexcept = default;
template <typename U, typename P>
allocator_cc(const allocator_cc<U, Heap, P> &a_) noexcept
: allocator_cc(a_.pool())
{}
allocator_cc &operator=(const allocator_cc &a_) = delete;
void extend_arm()
{
this->pool()->extend_arm();
}
void extend_disarm()
{
this->pool()->extend_disarm();
}
void allocate(
AK_ACTUAL
pointer_type & p
, size_type sz
, size_type alignment = alignof(T)
)
{
this->pool()->alloc(reinterpret_cast<persistent_t<void *> &>(p), sz * sizeof(T), alignment);
/* Error: for ccpm pool, this check is too late;
* most of the intersting information is gone.
*/
if ( p == nullptr )
{
throw bad_alloc_cc(AK_REF alignment, sz, sizeof(T));
}
}
/*
* For crash-consistent allocation, the allocate or remembers the allocation.
* For others, special code in the pool remembers the allocation.
*/
void allocate_tracked(
AK_ACTUAL
pointer_type & p
, size_type sz
, size_type alignment = alignof(T)
)
{
p = static_cast<value_type *>(this->pool()->alloc_tracked(sz * sizeof(T), alignment));
if ( p == nullptr )
{
throw bad_alloc_cc(AK_REF alignment, sz, sizeof(T));
}
}
/* Should not be called for the crash-consistent allocoator */
void reconstitute(
size_type s
, const void *location
, const char * = nullptr
)
{
this->pool()->inject_allocation(location, s * sizeof(T));
}
/* The crash-consistent allocator reconstitutes nothing */
bool is_reconstituted(
const void *location
)
{
return this->pool()->is_reconstituted(location);
}
};
#endif
| 26.937008 | 95 | 0.707395 |
eaf46ea616e0036b906918ee026ecd2b45c20894 | 353 | h | C | include/il2cpp/Dpr/Battle/View/Mathe/Easing.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | 1 | 2022-01-15T20:20:27.000Z | 2022-01-15T20:20:27.000Z | include/il2cpp/Dpr/Battle/View/Mathe/Easing.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | include/il2cpp/Dpr/Battle/View/Mathe/Easing.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | #pragma once
#include "il2cpp.h"
UnityEngine_Vector4_o Dpr_Battle_View_Mathe_Easing__EasedValue (UnityEngine_Vector4_o from, UnityEngine_Vector4_o to, float raito, int32_t easingType, const MethodInfo* method_info);
float Dpr_Battle_View_Mathe_Easing__EasedValue (float from, float to, float raito, int32_t easingType, const MethodInfo* method_info);
| 50.428571 | 182 | 0.849858 |
eaf4a93cc3bbc0561f6a2f0eb19ed928ba8ac137 | 1,795 | h | C | Source/objects.h | alanbirtles/devilutionX | 7364977ea26300e80d9e08d9b520fa9e96198c4c | [
"Unlicense"
] | null | null | null | Source/objects.h | alanbirtles/devilutionX | 7364977ea26300e80d9e08d9b520fa9e96198c4c | [
"Unlicense"
] | null | null | null | Source/objects.h | alanbirtles/devilutionX | 7364977ea26300e80d9e08d9b520fa9e96198c4c | [
"Unlicense"
] | null | null | null | /**
* @file objects.h
*
* Interface of object functionality, interaction, spawning, loading, etc.
*/
#ifndef __OBJECTS_H__
#define __OBJECTS_H__
DEVILUTION_BEGIN_NAMESPACE
#ifdef __cplusplus
extern "C" {
#endif
extern int objectactive[MAXOBJECTS];
extern int nobjects;
extern int objectavail[MAXOBJECTS];
extern ObjectStruct object[MAXOBJECTS];
extern BOOL InitObjFlag;
extern BOOL LoadMapObjsFlag;
void InitObjectGFX();
void FreeObjectGFX();
void AddL1Objs(int x1, int y1, int x2, int y2);
void AddL2Objs(int x1, int y1, int x2, int y2);
void InitObjects();
void SetMapObjects(BYTE *pMap, int startx, int starty);
void SetObjMapRange(int i, int x1, int y1, int x2, int y2, int v);
void SetBookMsg(int i, int msg);
void GetRndObjLoc(int randarea, int *xx, int *yy);
void AddMushPatch();
void AddSlainHero();
void objects_44D8C5(int ot, int v2, int ox, int oy);
void objects_44DA68(int a1, int a2);
void objects_454AF0(int a1, int a2, int a3);
void AddObject(int ot, int ox, int oy);
void Obj_Trap(int i);
void ProcessObjects();
void ObjSetMicro(int dx, int dy, int pn);
void RedoPlayerVision();
void MonstCheckDoors(int m);
void ObjChangeMap(int x1, int y1, int x2, int y2);
void ObjChangeMapResync(int x1, int y1, int x2, int y2);
void TryDisarm(int pnum, int i);
int ItemMiscIdIdx(item_misc_id imiscid);
void OperateObject(int pnum, int i, BOOL TeleFlag);
void SyncOpObject(int pnum, int cmd, int i);
void BreakObject(int pnum, int oi);
void SyncBreakObj(int pnum, int oi);
void SyncObjectAnim(int o);
void GetObjectStr(int i);
void operate_lv24_lever();
void objects_454BA8();
void objects_rnd_454BEA();
bool objects_lv_24_454B04(int s);
#ifdef __cplusplus
}
#endif
DEVILUTION_END_NAMESPACE
#endif /* __OBJECTS_H__ */
| 28.046875 | 75 | 0.730919 |
eaf594869d8662448000fcf6efeb2bd94c199640 | 1,377 | h | C | Luna/lib/color.h | MetroGirl/Src_LUNA | f59befa48bd79ab3a8bf71e3c5b975c8e76e6b79 | [
"Artistic-2.0"
] | 3 | 2015-04-09T10:09:38.000Z | 2018-08-10T13:15:48.000Z | Luna/lib/color.h | MetroGirl/Src_LUNA | f59befa48bd79ab3a8bf71e3c5b975c8e76e6b79 | [
"Artistic-2.0"
] | null | null | null | Luna/lib/color.h | MetroGirl/Src_LUNA | f59befa48bd79ab3a8bf71e3c5b975c8e76e6b79 | [
"Artistic-2.0"
] | null | null | null | //
// color.
//
#ifndef LUNA_COLOR_H_INCLUDED
#define LUNA_COLOR_H_INCLUDED
namespace luna{
inline XMFLOAT4 RGBtoHSV(XMFLOAT4 rgb)
{
const f32 r = rgb.x;
const f32 g = rgb.y;
const f32 b = rgb.z;
f32 max = r > g ? r : g;
max = max > b ? max : b;
f32 min = r < g ? r : g;
min = min < b ? min : b;
f32 h = max - min;
if (h > 0.0f) {
if (max == r) {
h = (g - b) / h;
if (h < 0.0f) {
h += 6.0f;
}
}
else if (max == g) {
h = 2.0f + (b - r) / h;
}
else {
h = 4.0f + (r - g) / h;
}
}
h /= 6.0f;
f32 s = (max - min);
if (max != 0.0f)
s /= max;
f32 v = max;
return XMFLOAT4(h, s, v, rgb.w);
}
inline XMFLOAT4 HSVtoRGB(XMFLOAT4 hsv)
{
const f32 h = hsv.x * 6.f;
const f32 s = hsv.y;
const f32 v = hsv.z;
f32 r = v;
f32 g = v;
f32 b = v;
if (s > 0.0f) {
const s32 i = (s32)h;
const f32 f = h - (f32)i;
switch (i) {
default:
case 0:
g *= 1 - s * (1 - f);
b *= 1 - s;
break;
case 1:
r *= 1 - s * f;
b *= 1 - s;
break;
case 2:
r *= 1 - s;
b *= 1 - s * (1 - f);
break;
case 3:
r *= 1 - s;
g *= 1 - s * f;
break;
case 4:
r *= 1 - s * (1 - f);
g *= 1 - s;
break;
case 5:
g *= 1 - s;
b *= 1 - s * f;
break;
}
}
return XMFLOAT4(r, g, b, hsv.w);
}
}
#endif // LUNA_COLOR_H_INCLUDED | 15.647727 | 39 | 0.42992 |
eaf6092314946d08f5ed1fca16faa791cce46983 | 4,402 | h | C | lib/Makeblock-Libraries-3.26/src/MeHostParser.h | sei-kiu/mBot-Ranger-MeAuriga-project-obstacle-avoiding-1 | 04319b68fa19ad7c5cc04076dd9a8aefda4f4674 | [
"MIT"
] | null | null | null | lib/Makeblock-Libraries-3.26/src/MeHostParser.h | sei-kiu/mBot-Ranger-MeAuriga-project-obstacle-avoiding-1 | 04319b68fa19ad7c5cc04076dd9a8aefda4f4674 | [
"MIT"
] | null | null | null | lib/Makeblock-Libraries-3.26/src/MeHostParser.h | sei-kiu/mBot-Ranger-MeAuriga-project-obstacle-avoiding-1 | 04319b68fa19ad7c5cc04076dd9a8aefda4f4674 | [
"MIT"
] | 1 | 2021-01-28T14:56:56.000Z | 2021-01-28T14:56:56.000Z | /**
* \par Copyright (C), 2012-2016, MakeBlock
* \class MeHostParser
* \brief Driver for Me Host Parser module.
* @file MeHostParser.h
* @author MakeBlock
* @version V1.0.0
* @date 2015/11/12
* @brief Header for MeHostParser.cpp module
*
* \par Copyright
* This software is Copyright (C), 2012-2016, MakeBlock. Use is subject to license \n
* conditions. The main licensing options available are GPL V2 or Commercial: \n
*
* \par Open Source Licensing GPL V2
* This is the appropriate option if you want to share the source code of your \n
* application with everyone you distribute it to, and you also want to give them \n
* the right to share who uses it. If you wish to use this software under Open \n
* Source Licensing, you must contribute all your source code to the open source \n
* community in accordance with the GPL Version 2 when your application is \n
* distributed. See http://www.gnu.org/copyleft/gpl.html
*
* \par Description
* This file is a drive for Me Host Parser device, The Me Host Parser inherited the
* MeSerial class from SoftwareSerial.
*
* \par Method List:
*
* 1. uint8_t MeHostParser::pushStr(uint8_t * str, uint32_t length);
* 2. uint8_t MeHostParser::pushByte(uint8_t ch);
* 3. uint8_t MeHostParser::run();
* 4. uint8_t MeHostParser::getPackageReady();
* 5. uint8_t MeHostParser::getData(uint8_t *buf, uint32_t size);
* 6. void MeHostParser::print(char *str, uint32_t * cnt);
*
* \par History:
* <pre>
* `<Author>` `<Time>` `<Version>` `<Descr>`
* forfish 2015/11/12 1.0.0 Add description
* </pre>
*
*/
#ifndef MeHostParser_h
#define MeHostParser_h
#include <Arduino.h>
#define BUF_SIZE 256
#define MASK 255
/**
* Class: MeHostParser
* \par Description
* Declaration of Class MeHostParser.
*/
class MeHostParser
{
public:
/**
* Alternate Constructor which can call your own function to map the Host Parser to arduino port,
* no pins are used or initialized here.
* \param[in]
* None
*/
MeHostParser();
/**
* Alternate Destructor which can call the system's destructor to free space,
* no pins are used or initialized here.
* \param[in]
* None
*/
~MeHostParser();
/**
* \par Function
* pushStr
* \par Description
* To push a string to Host Parser.
* \param[in]
* str - A pointer to a string.
* \param[in]
* length - The length of the string.
* \par Output
* None
* \par Return
* Return the index of pushing string.
* \par Others
* None
*/
uint8_t pushStr(uint8_t * str, uint32_t length);
/**
* \par Function
* pushByte
* \par Description
* To push a byte to Host Parser.
* \param[in]
* ch - A pointer to a char.
* \par Output
* None
* \par Return
* Return the status of pushing char.
* \par Others
* None
*/
uint8_t pushByte(uint8_t ch);
/**
* \par Function
* run
* \par Description
* The running status of Host Parser.
* \param[in]
* None
* \par Output
* None
* \par Return
* Return the status of Host Parser's running.
* \par Others
* None
*/
uint8_t run();
/**
* \par Function
* getPackageReady
* \par Description
* Get the package ready state.
* \param[in]
* None
* \par Output
* None
* \par Return
* Return the status ready or not.
* \par Others
* None
*/
// get the package ready state
uint8_t getPackageReady();
/**
* \par Function
* getData
* \par Description
* Copy data to user's buffer.
* \param[in]
* buf - A buffer for a getting data.
* \param[in]
* size - The length of getting data.
* \par Output
* None
* \par Return
* Return the length of getting data or 0.
* \par Others
* None
*/
uint8_t getData(uint8_t *buf, uint32_t size);
void print(char *str, uint32_t * cnt);
private:
int state;
uint8_t buffer[BUF_SIZE];
uint32_t in;
uint32_t out;
uint8_t packageReady;
uint8_t module;
uint32_t length;
uint8_t *data;
uint8_t check;
uint32_t lengthRead;
uint32_t currentDataPos;
/**
* \par Function
* getByte
* \par Description
* To get a byte from Host Parser.
* \param[in]
* ch - A pointer to a char.
* \par Output
* None
* \par Return
* Return the status of getting char.
* \par Others
* None
*/
uint8_t getByte(uint8_t * ch);
};
#endif
| 22.690722 | 97 | 0.642208 |
eaf6bcbffa3f61b7f71d2467bcee12ef3fa38b42 | 1,247 | c | C | src/kv/examples/example1.c | showapicxt/iowow | a29ac5b28f1b6c2817061c2a43b7222176458876 | [
"MIT"
] | 242 | 2015-08-13T06:38:10.000Z | 2022-03-17T13:49:56.000Z | src/kv/examples/example1.c | showapicxt/iowow | a29ac5b28f1b6c2817061c2a43b7222176458876 | [
"MIT"
] | 44 | 2018-04-08T07:12:02.000Z | 2022-03-04T06:15:01.000Z | src/kv/examples/example1.c | showapicxt/iowow | a29ac5b28f1b6c2817061c2a43b7222176458876 | [
"MIT"
] | 18 | 2016-01-14T09:50:34.000Z | 2022-01-26T23:07:40.000Z | #include "iwkv.h"
#include <string.h>
#include <stdlib.h>
int main() {
IWKV_OPTS opts = {
.path = "example1.db",
.oflags = IWKV_TRUNC // Cleanup database before open
};
IWKV iwkv;
IWDB mydb;
iwrc rc = iwkv_open(&opts, &iwkv);
if (rc) {
iwlog_ecode_error3(rc);
return 1;
}
// Now open mydb
// - Database id: 1
// - Using key/value as char data
rc = iwkv_db(iwkv, 1, 0, &mydb);
if (rc) {
iwlog_ecode_error2(rc, "Failed to open mydb");
return 1;
}
// Work with db: put/get value
IWKV_val key, val;
key.data = "foo";
key.size = strlen(key.data);
val.data = "bar";
val.size = strlen(val.data);
fprintf(stdout, "put: %.*s => %.*s\n",
(int) key.size, (char*) key.data,
(int) val.size, (char*) val.data);
rc = iwkv_put(mydb, &key, &val, 0);
if (rc) {
iwlog_ecode_error3(rc);
return rc;
}
// Retrive value associated with `foo` key
val.data = 0;
val.size = 0;
rc = iwkv_get(mydb, &key, &val);
if (rc) {
iwlog_ecode_error3(rc);
return rc;
}
fprintf(stdout, "get: %.*s => %.*s\n",
(int) key.size, (char*) key.data,
(int) val.size, (char*) val.data);
iwkv_val_dispose(&val);
iwkv_close(&iwkv);
return 0;
}
| 21.5 | 56 | 0.566159 |
eaf789915b7f40fbdcc9ce130ce6503708d1b7fc | 249 | h | C | Tracker/MyThief/config.h | aatd/smts | 39ede19fe6363587c21331c89be753a0a765001d | [
"MIT"
] | null | null | null | Tracker/MyThief/config.h | aatd/smts | 39ede19fe6363587c21331c89be753a0a765001d | [
"MIT"
] | 2 | 2021-09-14T08:22:27.000Z | 2021-09-28T13:37:38.000Z | Tracker/MyThief/config.h | aatd/smts | 39ede19fe6363587c21331c89be753a0a765001d | [
"MIT"
] | null | null | null | #define APN "internet.eplus.de"
#define USER "eplus"
#define PASSWORD "internet"
#define PIN {'4','1','3','3'}
#define OWNER "+491702196369"
#define UPLOADURL "http://d5f1-2a02-908-1220-e460-e65f-1ff-fe38-dc49.ngrok.io/backend" | 41.5 | 91 | 0.658635 |
eafbe212631ff89327edec32eb71d372f7a1b8c0 | 162 | h | C | MyTableView/MyTableView/Bridge.h | QLwangqinghai/Cache | a2c546b39e99a133e5efe04391e5a76ce6282378 | [
"Apache-2.0"
] | null | null | null | MyTableView/MyTableView/Bridge.h | QLwangqinghai/Cache | a2c546b39e99a133e5efe04391e5a76ce6282378 | [
"Apache-2.0"
] | null | null | null | MyTableView/MyTableView/Bridge.h | QLwangqinghai/Cache | a2c546b39e99a133e5efe04391e5a76ce6282378 | [
"Apache-2.0"
] | null | null | null | //
// Bridge.h
// MyTableView
//
// Created by wangqinghai on 2018/5/25.
// Copyright © 2018年 wangqinghai. All rights reserved.
//
#import <UIKit/UIKit.h>
| 13.5 | 55 | 0.654321 |
eaff1cdba439f694381fa112e6ce080ea7c45f5b | 818 | h | C | SJNav/SJNav/NavBar/UIView+SJLayout.h | shenjuneng/SJNav | 533a59e3a56f1a3da6ca8e1bd7da7686a9d95a57 | [
"MIT"
] | null | null | null | SJNav/SJNav/NavBar/UIView+SJLayout.h | shenjuneng/SJNav | 533a59e3a56f1a3da6ca8e1bd7da7686a9d95a57 | [
"MIT"
] | null | null | null | SJNav/SJNav/NavBar/UIView+SJLayout.h | shenjuneng/SJNav | 533a59e3a56f1a3da6ca8e1bd7da7686a9d95a57 | [
"MIT"
] | null | null | null | //
// UIView+SJLayout.h
// SJNav
//
// Created by 沈骏 on 2020/8/15.
// Copyright © 2020 沈骏. All rights reserved.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface UIView (SJLayout)
/** 起点x坐标 */
@property (nonatomic, assign) CGFloat x;
/** 起点y坐标 */
@property (nonatomic, assign) CGFloat y;
/** 中心点x坐标 */
@property (nonatomic, assign) CGFloat centerX;
/** 中心点y坐标 */
@property (nonatomic, assign) CGFloat centerY;
/** 底部坐标 */
@property (nonatomic, assign) CGFloat bottom;
/** 右边坐标 */
@property (nonatomic, assign) CGFloat right;
/** 宽度 */
@property (nonatomic, assign) CGFloat width;
/** 高度 */
@property (nonatomic, assign) CGFloat height;
/** size */
@property (nonatomic, assign) CGSize size;
/** origin */
@property (nonatomic, assign) CGPoint origin;
@end
NS_ASSUME_NONNULL_END
| 20.974359 | 46 | 0.672372 |
d8022e0fc6468ac626aeb7c41605382c3360bc98 | 5,237 | h | C | mainwindow/mainwindow.h | CommName/Cengrave | d9594d62a29d0976d2aedb2b09ae4944a4ffcd2a | [
"MIT"
] | null | null | null | mainwindow/mainwindow.h | CommName/Cengrave | d9594d62a29d0976d2aedb2b09ae4944a4ffcd2a | [
"MIT"
] | null | null | null | mainwindow/mainwindow.h | CommName/Cengrave | d9594d62a29d0976d2aedb2b09ae4944a4ffcd2a | [
"MIT"
] | null | null | null | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <opencv2/opencv.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <QString>
#include <QGraphicsItem>
#include "Image2Machine/commandcontainer.h"
#include "Image2Machine/graphimage.h"
#include "Image2Machine/tmcl.h"
#include "Image2Machine/hwf.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void on_modeWidget_currentChanged(int index);
//mode0
void on_buttonLoad_mode0_clicked();
void on_buttonReload_mode0_clicked();
void on_buttonEngrave_clicked();
//image transformation
void on_button_resize_mode0_clicked();
void on_checkBox_FlipVertical_mode0_clicked();
void on_checkBox_FlipHorizontal_mode0_clicked();
//zoom mode0
void on_button_mode0_zoom_in_clicked();
void on_button_mode0_zoom_out_clicked();
void on_button_mode0_zoom_fit_clicked();
void on_button_mode0_zoom_normal_clicked();
//zoom mode1
void on_button_mode1_zoom_in_clicked();
void on_button_mode1_zoom_out_clicked();
void on_button_mode1_zoom_fit_clicked();
void on_button_mode1_zoom_normal_clicked();
//zoom mode2
void on_button_mode2_zoom_in_clicked();
void on_button_mode2_zoom_out_clicked();
void on_button_mode2_zoom_fit_clicked();
void on_button_mode2_zoom_normal_clicked();
//mode1
//engraving modes
void on_comboBox_engraveMode_currentIndexChanged(int index);
//threshold
void on_threshold_slider_valueChanged(int value);
void on_threshold_invert_checkBox_stateChanged(int arg1);
//adaptvie threshold
void on_adaptiveThreshold_C_slider_valueChanged(int value);
void on_adaptiveThreshold_block_size_slider_valueChanged(int value);
void on_adaptiveThreshold_invert_checkBox_stateChanged(int arg1);
void on_adapriveThreshold_MeanC_radiobutton_clicked();
void on_adapriveThreshold_GaussianC_radiobutton_clicked();
//extract
void on_button_extract_test_clicked();
void on_button_extract_clicked();
void on_button_load_auto_clicked();
//Menu
//Window
void on_button_start_auto_clicked();
void on_button_clear_console_clicked();
void on_settings_settings_triggered();
void on_button_clear_image_clicked();
void on_button_set_coordinates_clicked();
void on_movement_upleft_clicked();
void on_movement_up_clicked();
void on_movement_upright_clicked();
void on_movement_left_clicked();
void on_movement_right_clicked();
void on_laser_on_off_clicked();
void on_movement_downleft_clicked();
void on_movement_down_clicked();
void on_movement_downright_clicked();
void on_button_stop_auto_clicked();
void on_button_continue_auto_clicked();
void on_check_simulation_stateChanged(int arg1);
void on_spinBox_resize_x_mode0_valueChanged(int arg1);
void on_spinBox_resize_y_mode0_valueChanged(int arg1);
void on_checkBox_keep_aspect_ratio_stateChanged(int arg1);
void on_radio_auto_toggled();
void on_button_set_home_clicked();
void on_button_go_home_clicked();
void on_button_toMachine_clicked();
void on_checkBox_imagemode2_preview_stateChanged(int arg1);
void on_file_open_image_triggered();
void on_file_open_command_container_triggered();
void on_settings_Movement_triggered();
void on_settings_Serial_port_triggered();
void on_settings_Parallel_port_triggered();
void on_settings_about_triggered();
void on_spinBox_engraveRGB_R_valueChanged(int arg1);
void on_spinBox_engraveRGB_G_valueChanged(int arg1);
void on_spinBox_engraveRGB_B_valueChanged(int arg1);
void on_checkBox_RGB_invert_stateChanged(int arg1);
void on_button_extract_stop_clicked();
void on_button_mode2_rotateL_clicked();
void on_button_mode2_rotateR_clicked();
void on_slider_mode0_beta_valueChanged(int value);
void on_slider_mode0_alfa_valueChanged(int value);
void on_command_listWidget_itemDoubleClicked(QListWidgetItem *item);
private:
Ui::MainWindow *ui;
//variable
private:
cv::Mat imageMode0;
cv::Mat imageMode1;
cv::Mat imageMode2;
GraphImage graph;
CommandContainer commands;
HWF hwf;
Tmcl tmcl;
QString imagePath;
QGraphicsScene *scene0;
QGraphicsScene *scene1;
QGraphicsScene *scene2;
int x_current_position;
int y_current_position;
bool laserON;
bool stop;
float alfa;
short beta;
//Settings
//funcions
private:
void loadImage(QString const &path);
void brightnessMode0();
bool engrave();
void setEngraveModesInvisible();
void thresholdMode();
void adaptiveThreshold();
void rgbAvrage();
void openSettings(int index);
void loadSettings();
void saveSettings();
void error(QString &error);
void execute();
public:
void displayImageMode0();
void displayImageMode1();
void displayImageMode2();
void displayImageInfo();
void displayImageMode2Info();
void displayCordinates();
void displayimagemode2Privew();
};
#endif // MAINWINDOW_H
| 23.696833 | 72 | 0.755203 |
d80717cd3349e6a684e977375604209e7d05b775 | 8,788 | c | C | src/vserver.c | TranscendComputing/TopStackMessageAgent | 97da381e932b5ad0257dbcb108ad32caa049f599 | [
"Apache-2.0"
] | null | null | null | src/vserver.c | TranscendComputing/TopStackMessageAgent | 97da381e932b5ad0257dbcb108ad32caa049f599 | [
"Apache-2.0"
] | null | null | null | src/vserver.c | TranscendComputing/TopStackMessageAgent | 97da381e932b5ad0257dbcb108ad32caa049f599 | [
"Apache-2.0"
] | null | null | null | /**
* collectd - src/vserver.c
* Copyright (C) 2006,2007 Sebastian Harl
* Copyright (C) 2007-2010 Florian octo Forster
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; only version 2 of the license is applicable.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Sebastian Harl <sh at tokkee.org>
* Florian octo Forster <octo at verplant.org>
**/
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include <dirent.h>
#include <sys/types.h>
#define BUFSIZE 512
#define PROCDIR "/proc/virtual"
#if !KERNEL_LINUX
# error "No applicable input method."
#endif
static int pagesize = 0;
static int vserver_init (void)
{
/* XXX Should we check for getpagesize () in configure?
* What's the right thing to do, if there is no getpagesize ()? */
pagesize = getpagesize ();
return (0);
} /* static void vserver_init(void) */
static void traffic_submit (const char *plugin_instance,
const char *type_instance, derive_t rx, derive_t tx)
{
value_t values[2];
value_list_t vl = VALUE_LIST_INIT;
values[0].derive = rx;
values[1].derive = tx;
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "if_octets", sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
} /* void traffic_submit */
static void load_submit (const char *plugin_instance,
gauge_t snum, gauge_t mnum, gauge_t lnum)
{
value_t values[3];
value_list_t vl = VALUE_LIST_INIT;
values[0].gauge = snum;
values[1].gauge = mnum;
values[2].gauge = lnum;
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, "load", sizeof (vl.type));
plugin_dispatch_values (&vl);
}
static void submit_gauge (const char *plugin_instance, const char *type,
const char *type_instance, gauge_t value)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
values[0].gauge = value;
vl.values = values;
vl.values_len = STATIC_ARRAY_SIZE (values);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "vserver", sizeof (vl.plugin));
sstrncpy (vl.plugin_instance, plugin_instance, sizeof (vl.plugin_instance));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
} /* void submit_gauge */
static derive_t vserver_get_sock_bytes(const char *s)
{
value_t v;
int status;
while (s[0] != '/')
++s;
/* Remove '/' */
++s;
status = parse_value (s, &v, DS_TYPE_DERIVE);
if (status != 0)
return (-1);
return (v.derive);
}
static int vserver_read (void)
{
#if NAME_MAX < 1024
# define DIRENT_BUFFER_SIZE (sizeof (struct dirent) + 1024 + 1)
#else
# define DIRENT_BUFFER_SIZE (sizeof (struct dirent) + NAME_MAX + 1)
#endif
DIR *proc;
struct dirent *dent; /* 42 */
char dirent_buffer[DIRENT_BUFFER_SIZE];
errno = 0;
proc = opendir (PROCDIR);
if (proc == NULL)
{
char errbuf[1024];
ERROR ("vserver plugin: fopen (%s): %s", PROCDIR,
sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
while (42)
{
int len;
char file[BUFSIZE];
FILE *fh;
char buffer[BUFSIZE];
struct stat statbuf;
char *cols[4];
int status;
status = readdir_r (proc, (struct dirent *) dirent_buffer, &dent);
if (status != 0)
{
char errbuf[4096];
ERROR ("vserver plugin: readdir_r failed: %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
closedir (proc);
return (-1);
}
else if (dent == NULL)
{
/* end of directory */
break;
}
if (dent->d_name[0] == '.')
continue;
len = ssnprintf (file, sizeof (file), PROCDIR "/%s", dent->d_name);
if ((len < 0) || (len >= BUFSIZE))
continue;
status = stat (file, &statbuf);
if (status != 0)
{
char errbuf[4096];
WARNING ("vserver plugin: stat (%s) failed: %s",
file, sstrerror (errno, errbuf, sizeof (errbuf)));
continue;
}
if (!S_ISDIR (statbuf.st_mode))
continue;
/* socket message accounting */
len = ssnprintf (file, sizeof (file),
PROCDIR "/%s/cacct", dent->d_name);
if ((len < 0) || ((size_t) len >= sizeof (file)))
continue;
if (NULL == (fh = fopen (file, "r")))
{
char errbuf[1024];
ERROR ("Cannot open '%s': %s", file,
sstrerror (errno, errbuf, sizeof (errbuf)));
}
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
derive_t rx;
derive_t tx;
char *type_instance;
if (strsplit (buffer, cols, 4) < 4)
continue;
if (0 == strcmp (cols[0], "UNIX:"))
type_instance = "unix";
else if (0 == strcmp (cols[0], "INET:"))
type_instance = "inet";
else if (0 == strcmp (cols[0], "INET6:"))
type_instance = "inet6";
else if (0 == strcmp (cols[0], "OTHER:"))
type_instance = "other";
else if (0 == strcmp (cols[0], "UNSPEC:"))
type_instance = "unspec";
else
continue;
rx = vserver_get_sock_bytes (cols[1]);
tx = vserver_get_sock_bytes (cols[2]);
/* cols[3] == errors */
traffic_submit (dent->d_name, type_instance, rx, tx);
} /* while (fgets) */
if (fh != NULL)
{
fclose (fh);
fh = NULL;
}
/* thread information and load */
len = ssnprintf (file, sizeof (file),
PROCDIR "/%s/cvirt", dent->d_name);
if ((len < 0) || ((size_t) len >= sizeof (file)))
continue;
if (NULL == (fh = fopen (file, "r")))
{
char errbuf[1024];
ERROR ("Cannot open '%s': %s", file,
sstrerror (errno, errbuf, sizeof (errbuf)));
}
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
int n = strsplit (buffer, cols, 4);
if (2 == n)
{
char *type_instance;
gauge_t value;
if (0 == strcmp (cols[0], "nr_threads:"))
type_instance = "total";
else if (0 == strcmp (cols[0], "nr_running:"))
type_instance = "running";
else if (0 == strcmp (cols[0], "nr_unintr:"))
type_instance = "uninterruptable";
else if (0 == strcmp (cols[0], "nr_onhold:"))
type_instance = "onhold";
else
continue;
value = atof (cols[1]);
submit_gauge (dent->d_name, "vs_threads", type_instance, value);
}
else if (4 == n) {
if (0 == strcmp (cols[0], "loadavg:"))
{
gauge_t snum = atof (cols[1]);
gauge_t mnum = atof (cols[2]);
gauge_t lnum = atof (cols[3]);
load_submit (dent->d_name, snum, mnum, lnum);
}
}
} /* while (fgets) */
if (fh != NULL)
{
fclose (fh);
fh = NULL;
}
/* processes and memory usage */
len = ssnprintf (file, sizeof (file),
PROCDIR "/%s/limit", dent->d_name);
if ((len < 0) || ((size_t) len >= sizeof (file)))
continue;
if (NULL == (fh = fopen (file, "r")))
{
char errbuf[1024];
ERROR ("Cannot open '%s': %s", file,
sstrerror (errno, errbuf, sizeof (errbuf)));
}
while ((fh != NULL) && (NULL != fgets (buffer, BUFSIZE, fh)))
{
char *type = "vs_memory";
char *type_instance;
gauge_t value;
if (strsplit (buffer, cols, 2) < 2)
continue;
if (0 == strcmp (cols[0], "PROC:"))
{
type = "vs_processes";
type_instance = "";
value = atof (cols[1]);
}
else
{
if (0 == strcmp (cols[0], "VM:"))
type_instance = "vm";
else if (0 == strcmp (cols[0], "VML:"))
type_instance = "vml";
else if (0 == strcmp (cols[0], "RSS:"))
type_instance = "rss";
else if (0 == strcmp (cols[0], "ANON:"))
type_instance = "anon";
else
continue;
value = atof (cols[1]) * pagesize;
}
submit_gauge (dent->d_name, type, type_instance, value);
} /* while (fgets) */
if (fh != NULL)
{
fclose (fh);
fh = NULL;
}
} /* while (readdir) */
closedir (proc);
return (0);
} /* int vserver_read */
void module_register (void)
{
plugin_register_init ("vserver", vserver_init);
plugin_register_read ("vserver", vserver_read);
} /* void module_register(void) */
/* vim: set ts=4 sw=4 noexpandtab : */
| 24.209366 | 77 | 0.627105 |
d80819a2134150f17c679467ad74bfde915c448c | 515 | h | C | src/utils/debug.h | Liu-xiandong/Fast-APSP | 9392d6b48a5928be0424c664f92ec642f3fff12a | [
"Apache-2.0"
] | null | null | null | src/utils/debug.h | Liu-xiandong/Fast-APSP | 9392d6b48a5928be0424c664f92ec642f3fff12a | [
"Apache-2.0"
] | null | null | null | src/utils/debug.h | Liu-xiandong/Fast-APSP | 9392d6b48a5928be0424c664f92ec642f3fff12a | [
"Apache-2.0"
] | null | null | null | #ifndef DEBUG_H_
#define DEBUG_H_
#include <iostream>
using std::cout;
using std::endl;
template <typename T>
void debug_array(const T *array, const int n)
{
for (int i = 0; i < n; i++)
{
cout << array[i] << " ";
}
cout << endl;
}
template <typename T>
void debug_matrix(const T *mat, const int n, const int m)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cout << mat[i * m + j] << " ";
}
cout << endl;
}
}
#endif | 16.09375 | 57 | 0.491262 |
2372515dbc7fd50550a11365eefd7f6fff325f53 | 1,013 | h | C | components/TextControls/src/BaseTextAreas/MDCBaseTextAreaDelegate.h | CitrusMonkey/material-components-ios | b644de36b37336f9fb232a6f0c5114cb4df298a5 | [
"Apache-2.0"
] | 4,798 | 2016-12-15T17:39:00.000Z | 2022-03-28T15:44:49.000Z | components/TextControls/src/BaseTextAreas/MDCBaseTextAreaDelegate.h | CitrusMonkey/material-components-ios | b644de36b37336f9fb232a6f0c5114cb4df298a5 | [
"Apache-2.0"
] | 8,526 | 2016-12-15T22:44:22.000Z | 2022-03-29T18:07:03.000Z | components/TextControls/src/BaseTextAreas/MDCBaseTextAreaDelegate.h | CitrusMonkey/material-components-ios | b644de36b37336f9fb232a6f0c5114cb4df298a5 | [
"Apache-2.0"
] | 1,047 | 2016-12-15T17:58:27.000Z | 2022-03-31T03:38:47.000Z | // Copyright 2020-present the Material Components for iOS authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import <UIKit/UIKit.h>
@class MDCBaseTextArea;
/**
This delegate protocol for @c MDCBaseTextArea and its subclasses provides updates about the text
area unrelated to the text area's contained @c textView.
*/
@protocol MDCBaseTextAreaDelegate <NSObject>
@optional
- (void)baseTextArea:(nonnull MDCBaseTextArea *)baseTextArea shouldChangeSize:(CGSize)newSize;
@end
| 33.766667 | 96 | 0.76999 |
23728a1ede38b96d61f587eddf30f00d02a7eca2 | 4,568 | c | C | tests/xutimes.c | lars18th/strace | f5b9ee494540741b59453a61f06e19815bcb11bd | [
"BSD-3-Clause"
] | 34 | 2019-05-07T00:58:04.000Z | 2021-12-03T17:41:17.000Z | tests/xutimes.c | pkmoore/strace_output_lib | e314f024979e02f6b1b8abd2a28ef63d16f6759b | [
"BSD-3-Clause"
] | 2 | 2020-02-25T10:34:34.000Z | 2020-04-06T06:43:26.000Z | tests/xutimes.c | pkmoore/strace_output_lib | e314f024979e02f6b1b8abd2a28ef63d16f6759b | [
"BSD-3-Clause"
] | 10 | 2018-10-05T07:19:06.000Z | 2022-03-23T14:24:53.000Z | /*
* Check decoding of utimes/osf_utimes syscall.
*
* Copyright (c) 2015-2017 Dmitry V. Levin <ldv@altlinux.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TEST_SYSCALL_NR
# error TEST_SYSCALL_NR must be defined
#endif
#ifndef TEST_SYSCALL_STR
# error TEST_SYSCALL_STR must be defined
#endif
#ifndef TEST_STRUCT
# error TEST_STRUCT must be defined
#endif
#include <stdint.h>
#include <stdio.h>
#include <sys/time.h>
#include <unistd.h>
static void
print_tv(const TEST_STRUCT *const tv)
{
printf("{tv_sec=%lld, tv_usec=%llu}",
(long long) tv->tv_sec,
zero_extend_signed_to_ull(tv->tv_usec));
print_time_t_usec(tv->tv_sec,
zero_extend_signed_to_ull(tv->tv_usec), 1);
}
static const char *errstr;
static long
k_utimes(const kernel_ulong_t pathname, const kernel_ulong_t times)
{
long rc = syscall(TEST_SYSCALL_NR, pathname, times);
errstr = sprintrc(rc);
return rc;
}
int
main(void)
{
static const char proto_fname[] = TEST_SYSCALL_STR "_sample";
static const char qname[] = "\"" TEST_SYSCALL_STR "_sample\"";
char *const fname = tail_memdup(proto_fname, sizeof(proto_fname));
const kernel_ulong_t kfname = (uintptr_t) fname;
TEST_STRUCT *const tv = tail_alloc(sizeof(*tv) * 2);
/* pathname */
k_utimes(0, 0);
printf("%s(NULL, NULL) = %s\n", TEST_SYSCALL_STR, errstr);
k_utimes(kfname + sizeof(proto_fname) - 1, 0);
printf("%s(\"\", NULL) = %s\n", TEST_SYSCALL_STR, errstr);
k_utimes(kfname, 0);
printf("%s(%s, NULL) = %s\n", TEST_SYSCALL_STR, qname, errstr);
fname[sizeof(proto_fname) - 1] = '+';
k_utimes(kfname, 0);
fname[sizeof(proto_fname) - 1] = '\0';
printf("%s(%p, NULL) = %s\n", TEST_SYSCALL_STR, fname, errstr);
if (F8ILL_KULONG_SUPPORTED) {
k_utimes(f8ill_ptr_to_kulong(fname), 0);
printf("%s(%#jx, NULL) = %s\n", TEST_SYSCALL_STR,
(uintmax_t) f8ill_ptr_to_kulong(fname), errstr);
}
/* times */
k_utimes(kfname, (uintptr_t) (tv + 1));
printf("%s(%s, %p) = %s\n", TEST_SYSCALL_STR,
qname, tv + 1, errstr);
k_utimes(kfname, (uintptr_t) (tv + 2));
printf("%s(%s, %p) = %s\n", TEST_SYSCALL_STR,
qname, tv + 2, errstr);
tv[0].tv_sec = 0xdeadbeefU;
tv[0].tv_usec = 0xfacefeedU;
tv[1].tv_sec = (time_t) 0xcafef00ddeadbeefLL;
tv[1].tv_usec = (suseconds_t) 0xbadc0dedfacefeedLL;
k_utimes(kfname, (uintptr_t) tv);
printf("%s(%s, [", TEST_SYSCALL_STR, qname);
print_tv(&tv[0]);
printf(", ");
print_tv(&tv[1]);
printf("]) = %s\n", errstr);
tv[0].tv_sec = 1492358607;
tv[0].tv_usec = 1000000;
tv[1].tv_sec = 1492356078;
tv[1].tv_usec = 1000001;
k_utimes(kfname, (uintptr_t) tv);
printf("%s(%s, [", TEST_SYSCALL_STR, qname);
print_tv(&tv[0]);
printf(", ");
print_tv(&tv[1]);
printf("]) = %s\n", errstr);
tv[0].tv_usec = 345678;
tv[1].tv_usec = 456789;
k_utimes(kfname, (uintptr_t) tv);
printf("%s(%s, [", TEST_SYSCALL_STR, qname);
print_tv(&tv[0]);
printf(", ");
print_tv(&tv[1]);
printf("]) = %s\n", errstr);
if (F8ILL_KULONG_SUPPORTED) {
k_utimes(kfname, f8ill_ptr_to_kulong(tv));
printf("%s(%s, %#jx) = %s\n", TEST_SYSCALL_STR,
qname, (uintmax_t) f8ill_ptr_to_kulong(tv), errstr);
}
puts("+++ exited with 0 +++");
return 0;
}
| 30.453333 | 76 | 0.695928 |
237606daa9b082fc09bfe4d269c26863e9428e72 | 2,159 | h | C | groups/bsl/bslalg/bslalg_typetraitnil.h | adambde/bde | a2efe118da642be42b25e81ca986a0fe56078305 | [
"Apache-2.0"
] | 26 | 2015-05-07T04:22:06.000Z | 2022-01-26T09:10:12.000Z | groups/bsl/bslalg/bslalg_typetraitnil.h | adambde/bde | a2efe118da642be42b25e81ca986a0fe56078305 | [
"Apache-2.0"
] | 3 | 2015-05-07T21:06:36.000Z | 2015-08-28T20:02:18.000Z | groups/bsl/bslalg/bslalg_typetraitnil.h | adambde/bde | a2efe118da642be42b25e81ca986a0fe56078305 | [
"Apache-2.0"
] | 12 | 2015-05-06T08:41:07.000Z | 2021-11-09T12:52:19.000Z | // bslalg_typetraitnil.h -*-C++-*-
#ifndef INCLUDED_BSLALG_TYPETRAITNIL
#define INCLUDED_BSLALG_TYPETRAITNIL
#ifndef INCLUDED_BSLS_IDENT
#include <bsls_ident.h>
#endif
BSLS_IDENT("$Id: $")
//@PURPOSE: Provide a trait to mark classes as having no other traits.
//
//@CLASSES:
// bslalg::TypeTraitBitwiseCopyable: bit-wise copyable trait
//
//@SEE_ALSO:
//
//@DESCRIPTION: This component provides a single traits class,
// 'bslalg::TypeTraitNil'. This trait is assigned by default to any class that
// does not have any other trait.
//
///Usage
///-----
// TBD
#ifndef INCLUDED_BSLSCM_VERSION
#include <bslscm_version.h>
#endif
#ifndef INCLUDED_BSLMF_INTEGRALCONSTANT
#include <bslmf_integralconstant.h>
#endif
#ifndef INCLUDED_BSLMF_NIL
#include <bslmf_nil.h>
#endif
namespace BloombergLP {
namespace bslalg {
//=============
// TypeTraitNil
//=============
struct TypeTraitNil
{
// Nil trait -- every type has this trait.
template <class TYPE>
struct NestedTraitDeclaration
{
// This metafunction returns 'true_type' for any class that is queried
// for the nil trait.
};
template <class TYPE>
struct Metafunction : bsl::true_type { };
};
} // close package namespace
} // close enterprise namespace
#endif
// ----------------------------------------------------------------------------
// Copyright 2013 Bloomberg Finance L.P.
//
// 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.
// ----------------------------- END-OF-FILE ----------------------------------
| 26.329268 | 79 | 0.623437 |
23769fb4a56f4d8790920460ffc2e132a7b7c8b4 | 404 | h | C | HBXTeFreshTableView/HBXTeFreshTableView/RefreshTableView/HBXTableItem.h | Hbaoxian/HBXRefreshTableView | ebd8e91700ec2551162a4d2c5331d4bda6b66059 | [
"Apache-2.0"
] | null | null | null | HBXTeFreshTableView/HBXTeFreshTableView/RefreshTableView/HBXTableItem.h | Hbaoxian/HBXRefreshTableView | ebd8e91700ec2551162a4d2c5331d4bda6b66059 | [
"Apache-2.0"
] | null | null | null | HBXTeFreshTableView/HBXTeFreshTableView/RefreshTableView/HBXTableItem.h | Hbaoxian/HBXRefreshTableView | ebd8e91700ec2551162a4d2c5331d4bda6b66059 | [
"Apache-2.0"
] | null | null | null | //
// HBXTableItem.h
// HBXTeFreshTableView
//
// Created by 黄保贤 on 16/6/7.
// Copyright © 2016年 黄保贤. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface HBXTableItem : NSObject
@property (nonatomic, assign) NSInteger cellHight;
@property (nonatomic, strong) NSIndexPath *indexPath;
@property (nonatomic, strong) id userInfo;
@property (nonatomic, strong) Class viewClass;
@end
| 20.2 | 53 | 0.735149 |
23777240cbf7fea311a9bbd6d4121afe3664c7b4 | 2,357 | c | C | tools/clang/test/Preprocessor/macro_paste_bad.c | clayne/DirectXShaderCompiler | 0ef9b702890b1d45f0bec5fa75481290323e14dc | [
"NCSA"
] | 3,102 | 2015-01-04T02:28:35.000Z | 2022-03-30T12:53:41.000Z | tools/clang/test/Preprocessor/macro_paste_bad.c | clayne/DirectXShaderCompiler | 0ef9b702890b1d45f0bec5fa75481290323e14dc | [
"NCSA"
] | 3,740 | 2019-01-23T15:36:48.000Z | 2022-03-31T22:01:13.000Z | tools/clang/test/Preprocessor/macro_paste_bad.c | clayne/DirectXShaderCompiler | 0ef9b702890b1d45f0bec5fa75481290323e14dc | [
"NCSA"
] | 1,868 | 2015-01-03T04:27:11.000Z | 2022-03-25T13:37:35.000Z | // RUN: %clang_cc1 -Eonly -verify -pedantic %s
// pasting ""x"" and ""+"" does not give a valid preprocessing token
#define XYZ x ## +
XYZ // expected-error {{pasting formed 'x+', an invalid preprocessing token}}
#define XXYZ . ## test
XXYZ // expected-error {{pasting formed '.test', an invalid preprocessing token}}
// GCC PR 20077
#define a a ## ## // expected-error {{'##' cannot appear at end of macro expansion}}
#define b() b ## ## // expected-error {{'##' cannot appear at end of macro expansion}}
#define c c ## // expected-error {{'##' cannot appear at end of macro expansion}}
#define d() d ## // expected-error {{'##' cannot appear at end of macro expansion}}
#define e ## ## e // expected-error {{'##' cannot appear at start of macro expansion}}
#define f() ## ## f // expected-error {{'##' cannot appear at start of macro expansion}}
#define g ## g // expected-error {{'##' cannot appear at start of macro expansion}}
#define h() ## h // expected-error {{'##' cannot appear at start of macro expansion}}
#define i ## // expected-error {{'##' cannot appear at start of macro expansion}}
#define j() ## // expected-error {{'##' cannot appear at start of macro expansion}}
// Invalid token pasting.
// PR3918
// When pasting creates poisoned identifiers, we error.
#pragma GCC poison BLARG
BLARG // expected-error {{attempt to use a poisoned identifier}}
#define XX BL ## ARG
XX // expected-error {{attempt to use a poisoned identifier}}
#define VA __VA_ ## ARGS__
int VA; // expected-warning {{__VA_ARGS__ can only appear in the expansion of a C99 variadic macro}}
#define LOG_ON_ERROR(x) x ## #y; // expected-error {{'#' is not followed by a macro parameter}}
LOG_ON_ERROR(0);
#define PR21379A(x) printf ##x // expected-note {{macro 'PR21379A' defined here}}
PR21379A(0 {, }) // expected-error {{too many arguments provided to function-like macro invocation}}
// expected-note@-1 {{parentheses are required around macro argument containing braced initializer list}}
#define PR21379B(x) printf #x // expected-note {{macro 'PR21379B' defined here}}
PR21379B(0 {, }) // expected-error {{too many arguments provided to function-like macro invocation}}
// expected-note@-1 {{parentheses are required around macro argument containing braced initializer list}}
| 52.377778 | 122 | 0.672889 |
237979afa4d4c52e1fe3ae0de18c988e527a456d | 927 | h | C | Applications/InCallService/PHAirplaneEmergencyCallAlert.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | Applications/InCallService/PHAirplaneEmergencyCallAlert.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | Applications/InCallService/PHAirplaneEmergencyCallAlert.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <TelephonyUI/TPAlert.h>
@interface PHAirplaneEmergencyCallAlert : TPAlert
{
CDUnknownBlockType _dialAction; // 8 = 0x8
}
- (void).cxx_destruct; // IMP=0x00000001000777cc
@property(copy, nonatomic) CDUnknownBlockType dialAction; // @synthesize dialAction=_dialAction;
- (void)otherResponse; // IMP=0x0000000100077730
- (void)defaultResponse; // IMP=0x00000001000776b0
- (void)alternateResponse; // IMP=0x0000000100077614
- (id)defaultButtonTitle; // IMP=0x00000001000775a0
- (id)otherButtonTitle; // IMP=0x0000000100077504
- (id)alternateButtonTitle; // IMP=0x0000000100077490
- (id)message; // IMP=0x00000001000773f4
- (id)title; // IMP=0x0000000100077358
- (id)initWithDialAction:(CDUnknownBlockType)arg1; // IMP=0x00000001000772e4
@end
| 33.107143 | 120 | 0.757282 |
23798d5bdf906c852d59e1fb3866cae7f45825c8 | 4,740 | h | C | System/Library/PrivateFrameworks/LiveFSFPHelper.framework/LiveFSFPEnumeratorDataContainer.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | System/Library/PrivateFrameworks/LiveFSFPHelper.framework/LiveFSFPEnumeratorDataContainer.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | System/Library/PrivateFrameworks/LiveFSFPHelper.framework/LiveFSFPEnumeratorDataContainer.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | /*
* This header is generated by classdump-dyld 1.5
* on Wednesday, October 27, 2021 at 3:22:32 PM Mountain Standard Time
* Operating System: Version 13.5.1 (Build 17F80)
* Image Source: /System/Library/PrivateFrameworks/LiveFSFPHelper.framework/LiveFSFPHelper
* classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley.
*/
#import <libobjc.A.dylib/NSFileProviderLiveItemClientUpdate.h>
@protocol OS_dispatch_queue;
@class LiveFSFPExtensionHelper, NSString, NSPointerArray, NSObject, LiveFSFPItemHelper, LiveFSRBTree;
@interface LiveFSFPEnumeratorDataContainer : NSObject <NSFileProviderLiveItemClientUpdate> {
LiveFSFPExtensionHelper* ext;
NSString* _containerID;
BOOL _hasPersistentIDs;
BOOL historyReset;
BOOL isActive;
NSPointerArray* ourEnumerators;
NSObject*<OS_dispatch_queue> updateQueue;
BOOL _isDir;
BOOL _addedToExtension;
BOOL _isVolumeWide;
int _state;
LiveFSFPItemHelper* _enumeratedItem;
NSString* _enumeratedItemID;
LiveFSRBTree* _contentsSortedByDate;
LiveFSRBTree* _contentsSortedByName;
}
@property (readonly) BOOL hasPersistentIDs; //@synthesize hasPersistentIDs=_hasPersistentIDs - In the implementation block
@property (readonly) BOOL isDir; //@synthesize isDir=_isDir - In the implementation block
@property (assign) BOOL addedToExtension; //@synthesize addedToExtension=_addedToExtension - In the implementation block
@property (assign) int state; //@synthesize state=_state - In the implementation block
@property (readonly) BOOL isVolumeWide; //@synthesize isVolumeWide=_isVolumeWide - In the implementation block
@property (retain,readonly) NSString * containerID; //@synthesize containerID=_containerID - In the implementation block
@property (readonly) LiveFSFPItemHelper * enumeratedItem; //@synthesize enumeratedItem=_enumeratedItem - In the implementation block
@property (retain) NSString * enumeratedItemID; //@synthesize enumeratedItemID=_enumeratedItemID - In the implementation block
@property (retain,readonly) LiveFSRBTree * contentsSortedByDate; //@synthesize contentsSortedByDate=_contentsSortedByDate - In the implementation block
@property (retain,readonly) LiveFSRBTree * contentsSortedByName; //@synthesize contentsSortedByName=_contentsSortedByName - In the implementation block
-(void)dealloc;
-(void)invalidate;
-(int)state;
-(void)setState:(int)arg1 ;
-(id)loadContents;
-(NSString *)containerID;
-(NSString *)enumeratedItemID;
-(void)setEnumeratedItemID:(NSString *)arg1 ;
-(void)LIUpdateUpdatedItem:(id)arg1 name:(id)arg2 interestedItem:(id)arg3 ;
-(void)LIUpdateUpdatedName:(id)arg1 interestedItem:(id)arg2 ;
-(void)LIUpdateDeletedItem:(id)arg1 name:(id)arg2 how:(int)arg3 interestedItem:(id)arg4 ;
-(void)LIUpdateDeletedName:(id)arg1 item:(id)arg2 how:(int)arg3 interestedItem:(id)arg4 ;
-(void)LIUpdateRenameFrom:(id)arg1 fromName:(id)arg2 fromID:(id)arg3 intoItem:(id)arg4 toName:(id)arg5 overID:(id)arg6 ;
-(void)LIUpdateVolumeWideUpdatedName:(id)arg1 interestedItem:(id)arg2 ;
-(void)LIUpdateVolumeWideDeletedName:(id)arg1 interestedItem:(id)arg2 ;
-(void)LIUpdateHistoryResetItem:(id)arg1 interestedItem:(id)arg2 ;
-(void)LIUpdateHistoryResetName:(id)arg1 interestedItem:(id)arg2 ;
-(void)LIUpdateDone:(id)arg1 ;
-(id)initForExtension:(id)arg1 item:(id)arg2 ;
-(LiveFSFPItemHelper *)enumeratedItem;
-(void)dropInterestForEnumeratedItem:(id)arg1 ;
-(void)doShutdown;
-(id)readDirBuffersForBufferBlock:(/*^block*/id)arg1 andEntryBlock:(/*^block*/id)arg2 ;
-(void)applyDeleteAcrossEnumerators:(id)arg1 newTombstone:(id)arg2 toSelf:(BOOL)arg3 ;
-(void)doProcessItemDeleted:(id)arg1 ;
-(void)handleEnumeratedItemChanged;
-(void)makeAllEnumeratorsDead;
-(void)resetAllEnumerators;
-(void)doShutdownOnEnumeratorHelperQueue;
-(id)ensureConnectedForUpdates;
-(void)applyAddAcrossEnumerators:(id)arg1 newName:(id)arg2 forSelf:(BOOL)arg3 ;
-(id)initWithEnumeratedItem:(id)arg1 fileHandle:(id)arg2 extension:(id)arg3 ;
-(void)addEnumerator:(id)arg1 ;
-(void)dropEnumerator:(id)arg1 ;
-(void)dispatchOntoUpdateQueue:(/*^block*/id)arg1 ;
-(void)doProcessItemUpdated:(id)arg1 ;
-(BOOL)hasPersistentIDs;
-(BOOL)isDir;
-(BOOL)addedToExtension;
-(void)setAddedToExtension:(BOOL)arg1 ;
-(BOOL)isVolumeWide;
-(LiveFSRBTree *)contentsSortedByDate;
-(LiveFSRBTree *)contentsSortedByName;
@end
| 53.258427 | 164 | 0.726371 |
237c73959e291e7d4ca76d949f35257946aa3e35 | 3,959 | h | C | ds4/code/4_client_cli/config/cli_application.h | demonsaw/Code | b036d455e9e034d7fd178e63d5e992242d62989a | [
"MIT"
] | 132 | 2017-03-22T03:46:38.000Z | 2022-03-08T15:08:16.000Z | ds4/code/4_client_cli/config/cli_application.h | demonsaw/Code | b036d455e9e034d7fd178e63d5e992242d62989a | [
"MIT"
] | 4 | 2017-04-06T17:46:10.000Z | 2018-08-08T18:27:59.000Z | ds4/code/4_client_cli/config/cli_application.h | demonsaw/Code | b036d455e9e034d7fd178e63d5e992242d62989a | [
"MIT"
] | 30 | 2017-03-26T22:38:17.000Z | 2021-11-21T20:50:17.000Z | //
// The MIT License(MIT)
//
// Copyright(c) 2014 Demonsaw LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
#ifndef _EJA_CLI_APPLICATION_H_
#define _EJA_CLI_APPLICATION_H_
#include <memory>
#include <boost/filesystem.hpp>
#include "config/application.h"
#include "entity/entity.h"
#include "http/http_throttle.h"
#include "system/type.h"
namespace eja
{
class cli_application final : public application
{
private:
entity_list m_clients;
http_download_throttle m_download_throttle;
http_upload_throttle m_upload_throttle;
size_t m_tabs = 0;
public:
using ptr = std::shared_ptr<cli_application>;
private:
// Utility
void error_add(const std::shared_ptr<entity>& entity) const;
// Read
using application::read;
void read(const boost::filesystem::path& path);
void read_global(const std::shared_ptr<cpptoml::table>& table);
void read_client(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
void read_group(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
void read_option(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
void read_routers(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
void read_session(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
void read_shares(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
void read_verified(const std::shared_ptr<cpptoml::table>& table, const std::shared_ptr<entity>& entity);
public:
cli_application(int& argc, char* argv[]);
// Interface
virtual void init() override;
virtual void shutdown() override;
virtual void clear() override;
// Utility
virtual bool empty() const override { return application::empty() || !has_clients(); }
bool exists();
// Read
virtual void read() override;
// Has
bool has_clients() const { return !m_clients.empty(); }
bool has_tabs() const { return m_tabs > 0; }
// Set
void set_download_throttle() { m_download_throttle.set_max_size(); }
void set_tabs(const size_t tabs) { m_tabs = tabs; }
void set_upload_throttle() { m_upload_throttle.set_max_size(); }
// Get
size_t get_size() const { return m_clients->size(); }
size_t get_max_size() const;
const entity_list& get_clients() const { return m_clients; }
entity_list& get_clients() { return m_clients; }
const http_download_throttle& get_download_throttle() const { return m_download_throttle; }
http_download_throttle& get_download_throttle() { return m_download_throttle; }
const http_upload_throttle& get_upload_throttle() const { return m_upload_throttle; }
http_upload_throttle& get_upload_throttle() { return m_upload_throttle; }
// Static
static ptr create(int argc, char* argv[]) { return std::make_shared<cli_application>(argc, argv); }
};
}
#endif
| 37 | 106 | 0.747158 |
237cbaa89309ba608f6966eab5969a9865a7c6ec | 1,773 | c | C | Tests/Iterate.c | KumarjitDas/C-Iterator | be47a3c20d8a1689fdba43297d7d3d3de29ab1de | [
"MIT"
] | null | null | null | Tests/Iterate.c | KumarjitDas/C-Iterator | be47a3c20d8a1689fdba43297d7d3d3de29ab1de | [
"MIT"
] | null | null | null | Tests/Iterate.c | KumarjitDas/C-Iterator | be47a3c20d8a1689fdba43297d7d3d3de29ab1de | [
"MIT"
] | null | null | null | #define ITERATOR_TESTING_ENABLED
#include "common/defines.h"
#include "iterator/iterator.h"
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv) {
if (argc <= 5)
return ITERATOR_TEST_FAILED;
uint32_t start = (uint32_t)strtoul(argv[1], NULL, 10);
uint32_t end = (uint32_t)strtoul(argv[2], NULL, 10);
uint32_t step = (uint32_t)strtoul(argv[3], NULL, 10);
uint32_t size = (uint32_t)strtoul(argv[4], NULL, 10);
uint32_t array_size = (uint32_t)strtoul(argv[5], NULL, 10);
int *array = NULL;
uint32_t iterate_count = 0;
uint32_t current_step = start - step;
uint32_t step_size = step * size;
if (array_size > 0) {
array = malloc(array_size * sizeof(int));
if (!array)
return ITERATOR_TEST_FAILED;
}
Iterator_t iterator;
CreateIterator(&iterator, start, end, step, array, size);
void *pointer = (uint8_t*)array + (start * size) - step_size;
_Bool test_result = TRUE;
test_result &= iterator.step == step;
test_result &= iterator.step_size == step_size;
test_result &= iterator.end == end;
while (current_step < end) {
test_result &= iterator.iterate_count == iterate_count;
test_result &= iterator.current_step == current_step;
if (array_size == 0)
test_result &= iterator.pointer == NULL;
else
test_result &= iterator.pointer == pointer;
iterate_count++;
current_step += step;
if (pointer)
pointer += (size_t)step_size;
test_result &= ((current_step < end) == Iterate(&iterator));
}
if (array)
free(array);
return !test_result;
}
| 28.142857 | 68 | 0.592217 |
237df672bd369daede607940bfec04de328ab1b3 | 1,242 | c | C | EdkCompatibilityPkg/Foundation/Framework/Protocol/DataHub/DataHub.c | CEOALT1/RefindPlusUDK | 116b957ad735f96fbb6d80a0ba582046960ba164 | [
"BSD-2-Clause"
] | 2,757 | 2018-04-28T21:41:36.000Z | 2022-03-29T06:33:36.000Z | EdkCompatibilityPkg/Foundation/Framework/Protocol/DataHub/DataHub.c | CEOALT1/RefindPlusUDK | 116b957ad735f96fbb6d80a0ba582046960ba164 | [
"BSD-2-Clause"
] | 20 | 2019-07-23T15:29:32.000Z | 2022-01-21T12:53:04.000Z | EdkCompatibilityPkg/Foundation/Framework/Protocol/DataHub/DataHub.c | CEOALT1/RefindPlusUDK | 116b957ad735f96fbb6d80a0ba582046960ba164 | [
"BSD-2-Clause"
] | 449 | 2018-05-09T05:54:05.000Z | 2022-03-30T14:54:18.000Z | /*++
Copyright (c) 2004, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
DataHub.c
Abstract:
The logging hub protocol is used both by agents wishing to log
errors and those wishing to be made aware of all information that
has been logged.
For more information please look at Intel Platform Innovation
Framework for EFI Data Hub Specification.
--*/
#include "Tiano.h"
#include EFI_PROTOCOL_DEFINITION (DataHub)
EFI_GUID gEfiDataHubProtocolGuid = EFI_DATA_HUB_PROTOCOL_GUID;
EFI_GUID_STRING(&gEfiDataHubProtocolGuid, "DataHub Protocol", "EFI Data Hub Protocol");
| 37.636364 | 91 | 0.635266 |
237e618413fede895b0088d310b00c40ce551c26 | 1,705 | h | C | hecmw1/src/couple/hecmw_couple_inter_iftable.h | masae-hayashi/FrontISTR | a488de9eb45b3238ba0cd11454c71a03450666a6 | [
"MIT"
] | 64 | 2016-09-08T05:26:25.000Z | 2022-03-23T03:36:57.000Z | hecmw1/src/couple/hecmw_couple_inter_iftable.h | masae-hayashi/FrontISTR | a488de9eb45b3238ba0cd11454c71a03450666a6 | [
"MIT"
] | 6 | 2016-04-12T09:46:55.000Z | 2021-05-17T09:51:51.000Z | hecmw1/src/couple/hecmw_couple_inter_iftable.h | masae-hayashi/FrontISTR | a488de9eb45b3238ba0cd11454c71a03450666a6 | [
"MIT"
] | 38 | 2016-10-05T01:47:31.000Z | 2022-01-16T07:05:26.000Z | /*****************************************************************************
* Copyright (c) 2019 FrontISTR Commons
* This software is released under the MIT License, see LICENSE.txt
*****************************************************************************/
#ifndef INC_HECMW_COUPLE_INTER_IFTABLE
#define INC_HECMW_COUPLE_INTER_IFTABLE
#include "hecmw_struct.h"
#include "hecmw_couple_comm.h"
#include "hecmw_couple_boundary_info.h"
#include "hecmw_couple_bounding_box.h"
#include "hecmw_couple_background_cell.h"
#include "hecmw_couple_mapped_point.h"
struct hecmw_couple_inter_iftable {
int n_neighbor_pe_import;
int *neighbor_pe_import;
int *import_index;
int *import_item;
int n_neighbor_pe_export;
int *neighbor_pe_export;
int *export_index;
int *export_item;
};
extern void HECMW_couple_free_inter_iftable(
struct hecmw_couple_inter_iftable *p);
extern struct hecmw_couple_inter_iftable *HECMW_couple_alloc_inter_iftable(
void);
extern void HECMW_couple_print_inter_iftable(
const struct hecmw_couple_inter_iftable *p, FILE *fp);
extern struct hecmw_couple_inter_iftable *HECMW_couple_set_map_data(
const struct hecmwST_local_mesh *mesh_src,
const struct hecmwST_local_mesh *mesh_dst,
const struct hecmw_couple_comm *comm_src,
const struct hecmw_couple_comm *comm_dst,
const struct hecmw_couple_comm *intercomm,
const struct hecmw_couple_boundary *boundary_src,
const struct hecmw_couple_bounding_box *bbox_src,
const struct hecmw_couple_bounding_box *bbox_dst,
const struct hecmw_couple_background_cell *bgcell_src,
const struct hecmw_couple_mapped_point *mapped_point);
#endif /* INC_HECMW_COUPLE_INTER_IFTABLE */
| 36.276596 | 79 | 0.73783 |
237eb7dcb4c55bc6f5036f9fc2729f05386793ee | 431 | h | C | src/jobs/scheduler/scheduler.h | elee1766/MotorMC | 24d77836f77d3ef8ec026126d630ada5b2e40ee1 | [
"MIT"
] | 54 | 2021-08-06T22:47:24.000Z | 2022-03-11T23:03:44.000Z | src/jobs/scheduler/scheduler.h | elee1766/MotorMC | 24d77836f77d3ef8ec026126d630ada5b2e40ee1 | [
"MIT"
] | 1 | 2021-11-05T17:32:37.000Z | 2021-11-05T17:56:14.000Z | src/jobs/scheduler/scheduler.h | elee1766/MotorMC | 24d77836f77d3ef8ec026126d630ada5b2e40ee1 | [
"MIT"
] | 6 | 2021-08-17T23:46:16.000Z | 2022-03-24T15:15:50.000Z | #pragma once
#include "../../main.h"
/*
Schedule a job to be done at a specific time
1 delay = next available tick
*/
extern uint32_t sch_schedule(uint32_t id, uint32_t delay);
/*
Schedule a job to be repeated every 'repeat' ticks
1 delay = next available tick
*/
extern uint32_t sch_schedule_repeating(uint32_t id, uint32_t delay, uint32_t repeat);
extern void sch_cancel(uint32_t id);
extern void sch_tick();
| 23.944444 | 86 | 0.726218 |
237f8c094d8489a0ea70b44109ee5327c98b84ac | 3,805 | c | C | hw/ipmi/ipmi-opal.c | ddstreet/skiboot | ee3e21e90f9f0e002255f691188e19666ca46764 | [
"Apache-2.0"
] | null | null | null | hw/ipmi/ipmi-opal.c | ddstreet/skiboot | ee3e21e90f9f0e002255f691188e19666ca46764 | [
"Apache-2.0"
] | null | null | null | hw/ipmi/ipmi-opal.c | ddstreet/skiboot | ee3e21e90f9f0e002255f691188e19666ca46764 | [
"Apache-2.0"
] | null | null | null | /* Copyright 2013-2014 IBM Corp.
*
* 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 <stdlib.h>
#include <string.h>
#include <ipmi.h>
#include <lock.h>
#include <opal.h>
#include <device.h>
#include <ccan/list/list.h>
static struct lock msgq_lock = LOCK_UNLOCKED;
static struct list_head msgq = LIST_HEAD_INIT(msgq);
static void opal_send_complete(struct ipmi_msg *msg)
{
lock(&msgq_lock);
list_add_tail(&msgq, &msg->link);
opal_update_pending_evt(ipmi_backend->opal_event_ipmi_recv,
ipmi_backend->opal_event_ipmi_recv);
unlock(&msgq_lock);
}
static int64_t opal_ipmi_send(uint64_t interface,
struct opal_ipmi_msg *opal_ipmi_msg, uint64_t msg_len)
{
struct ipmi_msg *msg;
if (opal_ipmi_msg->version != OPAL_IPMI_MSG_FORMAT_VERSION_1) {
prerror("OPAL IPMI: Incorrect version\n");
return OPAL_UNSUPPORTED;
}
msg_len -= sizeof(struct opal_ipmi_msg);
if (msg_len > IPMI_MAX_REQ_SIZE) {
prerror("OPAL IPMI: Invalid request length\n");
return OPAL_PARAMETER;
}
prlog(PR_DEBUG, "opal_ipmi_send(cmd: 0x%02x netfn: 0x%02x len: 0x%02llx)\n",
opal_ipmi_msg->cmd, opal_ipmi_msg->netfn >> 2, msg_len);
msg = ipmi_mkmsg(interface,
IPMI_CODE(opal_ipmi_msg->netfn >> 2, opal_ipmi_msg->cmd),
opal_send_complete, NULL, opal_ipmi_msg->data,
msg_len, IPMI_MAX_RESP_SIZE);
if (!msg)
return OPAL_RESOURCE;
msg->complete = opal_send_complete;
msg->error = opal_send_complete;
return ipmi_queue_msg(msg);
}
static int64_t opal_ipmi_recv(uint64_t interface,
struct opal_ipmi_msg *opal_ipmi_msg, uint64_t *msg_len)
{
struct ipmi_msg *msg;
int64_t rc;
lock(&msgq_lock);
msg = list_top(&msgq, struct ipmi_msg, link);
if (!msg) {
rc = OPAL_EMPTY;
goto out_unlock;
}
if (opal_ipmi_msg->version != OPAL_IPMI_MSG_FORMAT_VERSION_1) {
prerror("OPAL IPMI: Incorrect version\n");
rc = OPAL_UNSUPPORTED;
goto out_unlock;
}
if (interface != IPMI_DEFAULT_INTERFACE) {
prerror("IPMI: Invalid interface 0x%llx in opal_ipmi_recv\n", interface);
rc = OPAL_EMPTY;
goto out_unlock;
}
if (*msg_len - sizeof(struct opal_ipmi_msg) < msg->resp_size + 1) {
rc = OPAL_RESOURCE;
goto out_unlock;
}
list_del(&msg->link);
if (list_empty(&msgq))
opal_update_pending_evt(ipmi_backend->opal_event_ipmi_recv, 0);
unlock(&msgq_lock);
opal_ipmi_msg->cmd = msg->cmd;
opal_ipmi_msg->netfn = msg->netfn;
opal_ipmi_msg->data[0] = msg->cc;
memcpy(&opal_ipmi_msg->data[1], msg->data, msg->resp_size);
prlog(PR_DEBUG, "opal_ipmi_recv(cmd: 0x%02x netfn: 0x%02x resp_size: 0x%02x)\n",
msg->cmd, msg->netfn >> 2, msg->resp_size);
/* Add one as the completion code is returned in the message data */
*msg_len = msg->resp_size + sizeof(struct opal_ipmi_msg) + 1;
ipmi_free_msg(msg);
return OPAL_SUCCESS;
out_unlock:
unlock(&msgq_lock);
return rc;
}
void ipmi_opal_init(void)
{
struct dt_node *opal_ipmi;
opal_ipmi = dt_new(opal_node, "ipmi");
dt_add_property_strings(opal_ipmi, "compatible", "ibm,opal-ipmi");
dt_add_property_cells(opal_ipmi, "ibm,ipmi-interface-id",
IPMI_DEFAULT_INTERFACE);
dt_add_property_cells(opal_ipmi, "interrupts",
ilog2(ipmi_backend->opal_event_ipmi_recv));
opal_register(OPAL_IPMI_SEND, opal_ipmi_send, 3);
opal_register(OPAL_IPMI_RECV, opal_ipmi_recv, 3);
}
| 27.773723 | 81 | 0.732194 |
23816965d7c9b3be27f7a02deda31593c7ab8d15 | 1,992 | h | C | mac/TeamTalk/contacts&chats/DDProxyListObject.h | playbar/TeamTalk | 0c04a1bf4ba0a0884666addf360f10460d1f44a7 | [
"Apache-2.0"
] | null | null | null | mac/TeamTalk/contacts&chats/DDProxyListObject.h | playbar/TeamTalk | 0c04a1bf4ba0a0884666addf360f10460d1f44a7 | [
"Apache-2.0"
] | null | null | null | mac/TeamTalk/contacts&chats/DDProxyListObject.h | playbar/TeamTalk | 0c04a1bf4ba0a0884666addf360f10460d1f44a7 | [
"Apache-2.0"
] | null | null | null | //
// DDProxyListObject.h
// Duoduo
//
// Created by zuoye on 13-11-27.
// Copyright (c) 2013年 zuoye. All rights reserved.
//
@class ESObjectWithProperties,DDListObject;
@protocol DDContainingObject;
@interface DDProxyListObject : NSObject {
DDListObject *__weak listObject;
ESObjectWithProperties <DDContainingObject> *__weak containingObject;
NSString *key;
NSString *cachedDisplayNameString;
NSAttributedString *cachedDisplayName;
NSDictionary *cachedLabelAttributes;
NSSize cachedDisplayNameSize;
NSString *nick;
}
@property (nonatomic, copy) NSDictionary *cachedLabelAttributes;
@property (nonatomic, strong) NSString *cachedDisplayNameString;
@property (nonatomic, strong) NSAttributedString *cachedDisplayName;
@property (nonatomic) NSSize cachedDisplayNameSize;
@property (nonatomic, strong) NSString *key;
@property (nonatomic, strong) NSString *nick;
@property (nonatomic, weak) DDListObject *listObject;
@property (nonatomic, weak) ESObjectWithProperties <DDContainingObject> * containingObject;
+ (DDProxyListObject *)proxyListObjectForListObject:(ESObjectWithProperties *)inListObject
inListObject:(ESObjectWithProperties<DDContainingObject> *)containingObject;
+ (DDProxyListObject *)existingProxyListObjectForListObject:(ESObjectWithProperties *)inListObject
inListObject:(ESObjectWithProperties <DDContainingObject>*)inContainingObject;
+ (DDProxyListObject *)proxyListObjectForListObject:(DDListObject *)inListObject
inListObject:(ESObjectWithProperties <DDContainingObject>*)inContainingObject
withNick:(NSString *)inNick;
/*!
* @brief Called when an AIListObject is done with an AIProxyListObject to remove it from the global dictionary
*/
+ (void)releaseProxyObject:(DDProxyListObject *)proxyObject;
/*!
* @brief Clear out cached display information; should be called when the AIProxyListObject may be used later
*/
- (void)flushCache;
@end | 37.584906 | 112 | 0.769076 |
2384f6dd21ab116d63ff7ac49c439d4b8057785b | 3,245 | h | C | H.264/lencod/inc/elements.h | goodspeed24e/2011Corel | 4efb585a589ea5587a877f4184493b758fa6f9b2 | [
"MIT"
] | 1 | 2019-07-24T07:59:07.000Z | 2019-07-24T07:59:07.000Z | H.264/lencod/inc/elements.h | goodspeed24e/2011Corel | 4efb585a589ea5587a877f4184493b758fa6f9b2 | [
"MIT"
] | null | null | null | H.264/lencod/inc/elements.h | goodspeed24e/2011Corel | 4efb585a589ea5587a877f4184493b758fa6f9b2 | [
"MIT"
] | 6 | 2015-03-17T12:11:38.000Z | 2022-01-29T01:15:52.000Z |
/*!
**************************************************************************
* \file elements.h
* \brief Header file for elements in H.264 streams
* \date 6.10.2000,
* \version
* 1.1
*
* \note
* Version 1.0 included three partition modes, no DP, 2 partitionsper slice
* and 4 partitions per slice. As per document VCEG-N72 this is changed
* in version 1.1 to only two partition modes, one without DP and one with
* 3 partition per slice
*
* \author Sebastian Purreiter <sebastian.purreiter@mch.siemens.de>
* \author Stephan Wenger <stewe@cs.tu-berlin.de>
*
**************************************************************************
*/
#ifndef _ELEMENTS_H_
#define _ELEMENTS_H_
/*!
* definition of H.264 syntax elements
* order of elements follow dependencies for picture reconstruction
*/
/*!
* \brief Assignment of old TYPE or partition elements to new
* elements
*
* old element | new elements
* ----------------+-------------------------------------------------------------------
* TYPE_HEADER | SE_HEADER, SE_PTYPE
* TYPE_MBHEADER | SE_MBTYPE, SE_REFFRAME, SE_INTRAPREDMODE
* TYPE_MVD | SE_MVD
* TYPE_CBP | SE_CBP_INTRA, SE_CBP_INTER
* TYPE_COEFF_Y | SE_LUM_DC_INTRA, SE_LUM_AC_INTRA, SE_LUM_DC_INTER, SE_LUM_AC_INTER
* TYPE_2x2DC | SE_CHR_DC_INTRA, SE_CHR_DC_INTER
* TYPE_COEFF_C | SE_CHR_AC_INTRA, SE_CHR_AC_INTER
* TYPE_EOS | SE_EOS
*/
#define MAXPARTITIONMODES 2 //!< maximum possible partition modes as defined in assignSE2partition[][]
/*!
* \brief lookup-table to assign different elements to partition
*
* \note here we defined up to 6 different partitions similar to
* document Q15-k-18 described in the PROGFRAMEMODE.
* The Sliceheader contains the PSYNC information. \par
*
* Elements inside a partition are not ordered. They are
* ordered by occurence in the stream.
* Assumption: Only partitionlosses are considered. \par
*
* The texture elements luminance and chrominance are
* not ordered in the progressive form
* This may be changed in image.c \par
*
* -IMPORTANT:
* Picture- or Sliceheaders must be assigned to partition 0. \par
* Furthermore partitions must follow syntax dependencies as
* outlined in document Q15-J-23.
*/
// A note on this table:
//
// While the assignment of values in enum data types is specified in C, it is not
// very ood style to have an "elementnumber", not even as a comment.
//
// Hence a copy of the relevant structure from global.h here
/*
typedef enum {
0 SE_HEADER,
1 SE_PTYPE,
2 SE_MBTYPE,
3 SE_REFFRAME,
4 SE_INTRAPREDMODE,
5 SE_MVD,
6 SE_CBP_INTRA,
7 SE_LUM_DC_INTRA,
8 SE_CHR_DC_INTRA,
9 SE_LUM_AC_INTRA,
10 SE_CHR_AC_INTRA,
11 SE_CBP_INTER,
12 SE_LUM_DC_INTER,
13 SE_CHR_DC_INTER,
14 SE_LUM_AC_INTER,
15 SE_CHR_AC_INTER,
16 SE_DELTA_QUANT_INTER,
17 SE_DELTA_QUANT_INTRA,
18 SE_BFRAME,
19 SE_EOS,
20 SE_MAX_ELEMENTS */ // number of maximum syntax elements
//} SE_type;
extern int * assignSE2partition[2];
extern int assignSE2partition_NoDP[SE_MAX_ELEMENTS];
extern int assignSE2partition_DP[SE_MAX_ELEMENTS];
#endif
| 29.5 | 102 | 0.653005 |
238534cb32657526a715c75215cdfca0b6816245 | 1,289 | h | C | src/vlg_xplatform.h | icodekang/vlog | 4675db543673569a9d3b61ebf6f58f3be653b1a5 | [
"Apache-2.0"
] | null | null | null | src/vlg_xplatform.h | icodekang/vlog | 4675db543673569a9d3b61ebf6f58f3be653b1a5 | [
"Apache-2.0"
] | null | null | null | src/vlg_xplatform.h | icodekang/vlog | 4675db543673569a9d3b61ebf6f58f3be653b1a5 | [
"Apache-2.0"
] | null | null | null | #ifndef __vlg_xplatform_h
#define __vlg_xplatform_h
#include <limits.h>
#define vlog_INT32_LEN sizeof("-2147483648") - 1
#define vlog_INT64_LEN sizeof("-9223372036854775808") - 1
#if ((__GNU__ == 2) && (__GNUC_MINOR__ < 8))
#define vlog_MAX_UINT32_VALUE (uint32_t) 0xffffffffLL
#else
#define vlog_MAX_UINT32_VALUE (uint32_t) 0xffffffff
#endif
#define vlog_MAX_INT32_VALUE (uint32_t) 0x7fffffff
#define MAXLEN_PATH 1024
#define MAXLEN_CFG_LINE (MAXLEN_PATH * 4)
#define MAXLINES_NO 128
#define FILE_NEWLINE "\n"
#define FILE_NEWLINE_LEN 1
#include <string.h>
#include <strings.h>
#define STRCMP(_a_,_C_,_b_) ( strcmp(_a_,_b_) _C_ 0 )
#define STRNCMP(_a_,_C_,_b_,_n_) ( strncmp(_a_,_b_,_n_) _C_ 0 )
#define STRICMP(_a_,_C_,_b_) ( strcasecmp(_a_,_b_) _C_ 0 )
#define STRNICMP(_a_,_C_,_b_,_n_) ( strncasecmp(_a_,_b_,_n_) _C_ 0 )
#ifdef __APPLE__
#include <AvailabilityMacros.h>
#endif
/* Define vlog_fstat to fstat or fstat64() */
#if defined(__APPLE__) && !defined(MAC_OS_X_VERSION_10_6)
#define vlog_fstat fstat64
#define vlog_stat stat64
#else
#define vlog_fstat fstat
#define vlog_stat stat
#endif
/* Define vlog_fsync to fdatasync() in Linux and fsync() for all the rest */
#ifdef __linux__
#define vlog_fsync fdatasync
#else
#define vlog_fsync fsync
#endif
#endif
| 23.017857 | 76 | 0.757952 |
23878912549829ac847bccf3a3da9b001efbd291 | 1,840 | h | C | software/common/lib-det-os/inc/det_os.h | robot-corral/mazebot | 9820e59c876043ba4749c07a5f033cd2c63cc675 | [
"Apache-2.0"
] | null | null | null | software/common/lib-det-os/inc/det_os.h | robot-corral/mazebot | 9820e59c876043ba4749c07a5f033cd2c63cc675 | [
"Apache-2.0"
] | 63 | 2020-01-08T05:43:20.000Z | 2020-03-17T04:13:31.000Z | software/common/lib-det-os/inc/det_os.h | robot-corral/mazebot | 9820e59c876043ba4749c07a5f033cd2c63cc675 | [
"Apache-2.0"
] | null | null | null | /*******************************************************************************
* Copyright (C) 2018 Pavel Krupets *
*******************************************************************************/
#pragma once
#include <stdint.h>
#include <stdbool.h>
#include "result_codes.h"
#define TP_LOWEST_PRIORITY 0x00
#define TP_NORMAL_PRIORITY 0x7F
#define TP_HIGHEST_PRIORITY 0xFF
typedef int32_t result_t;
typedef uint8_t taskPriority_t;
#define IS_FIRST_TASK_PRIORITY_LOWER_THAN_SECOND(firstTaskPriority, secondTaskPriority) ((firstTaskPriority) < (secondTaskPriority))
#define IS_FIRST_TASK_PRIORITY_HIGHER_THAN_SECOND(firstTaskPriority, secondTaskPriority) ((firstTaskPriority) > (secondTaskPriority))
#define IS_FIRST_TASK_PRIORITY_LOWER_THAN_OR_EQUAL_TO_SECOND(firstTaskPriority, secondTaskPriority) ((firstTaskPriority) <= (secondTaskPriority))
#define IS_FIRST_TASK_PRIORITY_HIGHER_THAN_OR_EQUAL_TO_SECOND(firstTaskPriority, secondTaskPriority) ((firstTaskPriority) >= (secondTaskPriority))
typedef void (*task_t)(void* pTaskParameter);
extern result_t scheduleTask(task_t task, taskPriority_t priority, void* pTaskParameter);
extern result_t scheduleTaskWithStartTimeRestriction(task_t task, taskPriority_t priority, uint32_t earliestStartTime, void* pTaskParameter);
extern result_t scheduleTaskWithDeadline(task_t task, taskPriority_t priority, uint32_t deadline, void* pTaskParameter);
extern result_t scheduleTaskWithStartTimeRestrictionAndDeadline(task_t task, taskPriority_t priority, uint32_t earliestStartTime, uint32_t deadline, void* pTaskParameter);
/*
* suspend calling tasks for specified duration.
*/
extern result_t suspend(uint32_t suspendDuration);
/*
* surrender remaining part of your time slice so other tasks can execute.
*/
extern result_t yield();
| 41.818182 | 171 | 0.740761 |
238a506bcf3e65be9f9546d08259812aea7073db | 963 | h | C | StandAloneDemos/Physics2012Monitor.h | mym2o/HavokDemos | 1235b96b93e256de50bc36c229439a334410fd77 | [
"MIT"
] | 1 | 2017-08-14T10:23:45.000Z | 2017-08-14T10:23:45.000Z | StandAloneDemos/Physics2012Monitor.h | mym2o/HavokDemos | 1235b96b93e256de50bc36c229439a334410fd77 | [
"MIT"
] | null | null | null | StandAloneDemos/Physics2012Monitor.h | mym2o/HavokDemos | 1235b96b93e256de50bc36c229439a334410fd77 | [
"MIT"
] | 2 | 2016-06-22T02:22:32.000Z | 2019-11-21T19:49:41.000Z | #pragma once
#include "../HavokDefinitions.h"
#include <Common/Base/Monitor/hkMonitorStream.h>
#include <Common/Base/Monitor/MonitorStreamAnalyzer/hkMonitorStreamAnalyzer.h>
// Physics
#include <Physics2012/Dynamics/World/hkpWorld.h>
#include <Physics2012/Collide/Dispatch/hkpAgentRegisterUtil.h>
#include <Physics2012/Dynamics/Entity/hkpRigidBody.h>
#include <Physics2012/Collide/Shape/Convex/Box/hkpBoxShape.h>
#include <Physics2012/Utilities/Dynamics/Inertia/hkpInertiaTensorComputer.h>
#include <Common/Base/System/Stopwatch/hkStopwatch.h>
#define HK_EXCLUDE_FEATURE_SerializeDeprecatedPre700
#define HK_EXCLUDE_FEATURE_RegisterVersionPatches
#define HK_EXCLUDE_FEATURE_MemoryTracker
class Physics2012Monitor : public HavokInterface {
private:
VisualDebuggerHk vdb;
hkpWorld* world;
void initPhysics();
public:
Physics2012Monitor();
virtual ~Physics2012Monitor();
void initHk();
void runHk();
void quitHk();
}; | 28.323529 | 79 | 0.790239 |
238fbeef3539cb106dcf61c7b49af2c61beff1a0 | 286 | h | C | sw-modules/module-chassis/src/Distance.h | HSRLCLab/sortic150 | 81a4b9dc247672e467dcd96c8c18baa6a39e4d85 | [
"MIT"
] | null | null | null | sw-modules/module-chassis/src/Distance.h | HSRLCLab/sortic150 | 81a4b9dc247672e467dcd96c8c18baa6a39e4d85 | [
"MIT"
] | null | null | null | sw-modules/module-chassis/src/Distance.h | HSRLCLab/sortic150 | 81a4b9dc247672e467dcd96c8c18baa6a39e4d85 | [
"MIT"
] | 3 | 2018-02-07T07:22:17.000Z | 2018-04-26T11:09:10.000Z | #pragma once
#include <NewPing.h>
#include <Sensor.h>
#include <Stream.h>
class Distance : public Sensor
{
public:
Distance(NewPing *sensor) : sensor{sensor} {}
Stream &get(Stream &obj)
{
obj << String(sensor->ping_cm());
return obj;
}
private:
NewPing *sensor;
};
| 14.3 | 47 | 0.65035 |
23901693fa59cab0cc978d3e42801bf0e0c6e731 | 2,652 | h | C | usr/libexec/demod_helper/MSDHOperations.h | lechium/tvOS145Headers | 9940da19adb0017f8037853e9cfccbe01b290dd5 | [
"MIT"
] | 5 | 2021-04-29T04:31:43.000Z | 2021-08-19T18:59:58.000Z | usr/libexec/demod_helper/MSDHOperations.h | lechium/tvOS145Headers | 9940da19adb0017f8037853e9cfccbe01b290dd5 | [
"MIT"
] | null | null | null | usr/libexec/demod_helper/MSDHOperations.h | lechium/tvOS145Headers | 9940da19adb0017f8037853e9cfccbe01b290dd5 | [
"MIT"
] | 1 | 2022-03-19T11:16:23.000Z | 2022-03-19T11:16:23.000Z | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@class MSDSignedManifest;
@protocol OS_os_transaction;
@interface MSDHOperations : NSObject
{
MSDSignedManifest *_signedManifest; // 8 = 0x8
NSObject<OS_os_transaction> *_transaction; // 16 = 0x10
}
+ (id)sharedInstance; // IMP=0x0000000100019264
- (void).cxx_destruct; // IMP=0x000000010001cecc
@property(retain) NSObject<OS_os_transaction> *transaction; // @synthesize transaction=_transaction;
@property(retain, nonatomic) MSDSignedManifest *signedManifest; // @synthesize signedManifest=_signedManifest;
- (_Bool)restartBluetooth; // IMP=0x000000010001cde4
- (_Bool)preserveBluetoothFileToShelter:(id)arg1; // IMP=0x000000010001c93c
- (_Bool)quitHelper; // IMP=0x000000010001c92c
- (_Bool)restoreAttributesUnder:(id)arg1 fromManifest:(id)arg2; // IMP=0x000000010001c608
- (_Bool)restoreAppDataAttributesUnder:(id)arg1 containerType:(id)arg2 identifier:(id)arg3; // IMP=0x000000010001c464
- (_Bool)restoreBackupAttributesUnder:(id)arg1 range:(struct _NSRange)arg2; // IMP=0x000000010001c370
- (_Bool)reboot; // IMP=0x000000010001c2c8
- (_Bool)cleanupStagingArea:(id)arg1; // IMP=0x000000010001be20
- (_Bool)switchToBackupFolder; // IMP=0x000000010001bd70
- (void)moveFilesFromPath:(id)arg1 inList:(id)arg2 toCache:(id)arg3; // IMP=0x000000010001b600
- (_Bool)moveFilesFromStagingPath:(id)arg1 toCache:(id)arg2; // IMP=0x000000010001b3fc
- (_Bool)moveStagingToFinal:(id)arg1 finalPath:(id)arg2; // IMP=0x000000010001ad84
- (_Bool)disableLaunchdServicesForWatch; // IMP=0x000000010001aaf0
- (_Bool)manageDemoVolume:(id)arg1; // IMP=0x000000010001a9ac
- (_Bool)manageDataVolume:(id)arg1; // IMP=0x000000010001a77c
- (_Bool)writeNVRam:(id)arg1 withValue:(id)arg2; // IMP=0x000000010001a57c
- (_Bool)deleteNvram:(id)arg1; // IMP=0x000000010001a41c
- (_Bool)cloneFile:(id)arg1 stagingPath:(id)arg2 expectingHash:(id)arg3 expectingTarget:(id)arg4; // IMP=0x000000010001a344
- (_Bool)touchFile:(id)arg1 fileAttributes:(id)arg2; // IMP=0x000000010001a1cc
- (_Bool)writeDictionary:(id)arg1 toFile:(id)arg2; // IMP=0x000000010001a024
- (_Bool)createDeviceManifest:(id)arg1 forBackup:(_Bool)arg2 range:(struct _NSRange)arg3; // IMP=0x0000000100019c7c
- (_Bool)removeDirectory:(id)arg1; // IMP=0x0000000100019be4
- (_Bool)prepareDirectory:(id)arg1 writableByNonRoot:(_Bool)arg2; // IMP=0x00000001000197dc
- (_Bool)migratePreferencesFile; // IMP=0x000000010001951c
- (void)dealloc; // IMP=0x0000000100019334
- (id)init; // IMP=0x00000001000192d0
@end
| 52 | 123 | 0.777526 |
23901b743504225232f8db87b53940d17b0bbfb3 | 133 | c | C | src/main.c | LinSimonMu/MOS | b6ef15fbc081922254efbd1f1da63c2270c245cf | [
"MIT"
] | null | null | null | src/main.c | LinSimonMu/MOS | b6ef15fbc081922254efbd1f1da63c2270c245cf | [
"MIT"
] | null | null | null | src/main.c | LinSimonMu/MOS | b6ef15fbc081922254efbd1f1da63c2270c245cf | [
"MIT"
] | null | null | null | int counts(void);
void main()
{
counts();
while(1);
}
int counts(void)
{
int i = 0;
i++;
i+=2;
return i;
}
| 8.3125 | 17 | 0.458647 |
2391256df1dff5bd1b1a2651af9bba32a6746a69 | 355 | c | C | src/deallocate_2d_arrays.c | m-tari/piston_Problem | 0d55eb297eb45e4e2fe48b9c416a85c7ae2225ec | [
"MIT"
] | null | null | null | src/deallocate_2d_arrays.c | m-tari/piston_Problem | 0d55eb297eb45e4e2fe48b9c416a85c7ae2225ec | [
"MIT"
] | null | null | null | src/deallocate_2d_arrays.c | m-tari/piston_Problem | 0d55eb297eb45e4e2fe48b9c416a85c7ae2225ec | [
"MIT"
] | null | null | null | #include "preproc.h"
/******************************************************/
/* This function deallocate the memory for a 2-D */
/* array of a given size, all contiguous */
/******************************************************/
void deallocate_2d_arrays(_FLOAT **tmp)
{
free(&tmp[0][0]);
free(&tmp[0]); tmp = NULL;
return;
}
| 25.357143 | 56 | 0.408451 |
2392b917a49cdb842cb442a4841c64bfda32010a | 122 | c | C | src/hello.c | hnrck/makefile_example | 69d3d30145cf28032dca0e0e431ac734c480c5a3 | [
"MIT"
] | null | null | null | src/hello.c | hnrck/makefile_example | 69d3d30145cf28032dca0e0e431ac734c480c5a3 | [
"MIT"
] | null | null | null | src/hello.c | hnrck/makefile_example | 69d3d30145cf28032dca0e0e431ac734c480c5a3 | [
"MIT"
] | null | null | null | #include "hello.h"
#include <stdio.h>
void hello(const char* message) {
fprintf(stdout, "Hello, %s!\n", message);
}
| 15.25 | 45 | 0.639344 |
2393be926328ae5bd20440e9b0a3b94e9d99c1be | 413 | h | C | EYRouter/Classes/Redirecter/LogicRedirecterProtocol.h | wowbby/EYRouter | 7ecca9d1c9a08a667ffcceff9fdf8d765e6387fe | [
"MIT"
] | null | null | null | EYRouter/Classes/Redirecter/LogicRedirecterProtocol.h | wowbby/EYRouter | 7ecca9d1c9a08a667ffcceff9fdf8d765e6387fe | [
"MIT"
] | null | null | null | EYRouter/Classes/Redirecter/LogicRedirecterProtocol.h | wowbby/EYRouter | 7ecca9d1c9a08a667ffcceff9fdf8d765e6387fe | [
"MIT"
] | null | null | null | //
// LogicRedirecterProtocol.h
// EYRouter
//
// Created by 郑振兴 on 2018/9/18.
//
#import <Foundation/Foundation.h>
@protocol LogicRedirecterProtocol <NSObject>
@property (nonatomic, strong, readonly) NSString *name;
@property (nonatomic, assign, readonly) NSInteger level;
- (BOOL)isNeedRedirectURL:(NSDictionary<NSString *, NSString *> *)registerParameters;
- (NSString *)redirectURL:(NSString *)url;
@end
| 25.8125 | 85 | 0.743341 |
239464521ee06457e88b08f930045134027cb799 | 130 | h | C | Example/Pods/Target Support Files/Then/Then-umbrella.h | muukii/StackScrollViewComponents | ade6a11fdadeb0e83c1dfa89143c70cf895cec32 | [
"MIT"
] | 1 | 2017-01-14T11:28:04.000Z | 2017-01-14T11:28:04.000Z | Example/Pods/Target Support Files/Then/Then-umbrella.h | muukii/StackScrollViewComponents | ade6a11fdadeb0e83c1dfa89143c70cf895cec32 | [
"MIT"
] | null | null | null | Example/Pods/Target Support Files/Then/Then-umbrella.h | muukii/StackScrollViewComponents | ade6a11fdadeb0e83c1dfa89143c70cf895cec32 | [
"MIT"
] | null | null | null | #import <UIKit/UIKit.h>
FOUNDATION_EXPORT double ThenVersionNumber;
FOUNDATION_EXPORT const unsigned char ThenVersionString[];
| 18.571429 | 58 | 0.830769 |
23961eb47639a25d33c82e37632571c17ac90553 | 5,508 | h | C | dependencies/panda/Panda3D-1.10.0-x64/include/socket_udp.h | CrankySupertoon01/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 3 | 2018-03-09T12:07:29.000Z | 2021-02-25T06:50:25.000Z | panda/src/nativenet/socket_udp.h | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 1 | 2018-07-28T20:07:04.000Z | 2018-07-30T18:28:34.000Z | panda/src/nativenet/socket_udp.h | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | // Filename: socket_udp.h
// Created by: drose (01Mar07)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#ifndef __SOCKET_UDP_H__
#define __SOCKET_UDP_H__
#include "socket_udp_incoming.h"
/////////////////////////////////////////////////////////////////////
// Class : Socket_UDP
//
// Description : Base functionality for a combination UDP Reader and
// Writer. This duplicates code from
// Socket_UDP_Outgoing, to avoid the problems of
// multiple inheritance.
/////////////////////////////////////////////////////////////////////
class EXPCL_PANDA_NATIVENET Socket_UDP : public Socket_UDP_Incoming
{
public:
PUBLISHED:
inline Socket_UDP() { }
// use this interface for a tagreted UDP connection
inline bool InitToAddress(const Socket_Address & address);
public:
inline bool Send(const char * data, int len);
PUBLISHED:
inline bool Send(const string &data);
// use this interface for a none tagreted UDP connection
inline bool InitNoAddress();
public:
inline bool SendTo(const char * data, int len, const Socket_Address & address);
PUBLISHED:
inline bool SendTo(const string &data, const Socket_Address & address);
inline bool SetToBroadCast();
public:
static TypeHandle get_class_type() {
return _type_handle;
}
static void init_type() {
Socket_UDP_Incoming::init_type();
register_type(_type_handle, "Socket_UDP",
Socket_UDP_Incoming::get_class_type());
}
virtual TypeHandle get_type() const {
return get_class_type();
}
virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
private:
static TypeHandle _type_handle;
};
//////////////////////////////////////////////////////////////
// Function name : Socket_UDP:SetToBroadCast
// Description : Ask the OS to let us receive BROADCASt packets on this port..
// Return type : bool
// Argument : void
//////////////////////////////////////////////////////////////
inline bool Socket_UDP::SetToBroadCast()
{
int optval = 1;
if (setsockopt(_socket, SOL_SOCKET, SO_BROADCAST, (char *)&optval, sizeof(optval)) != 0)
return false;
return true;
}
////////////////////////////////////////////////////////////////////
// Function name : Socket_UDP::InitToAddress
// Description : Connects the Socket to a Specified address
//
// Return type : inline bool
// Argument : NetAddress & address
////////////////////////////////////////////////////////////////////
inline bool Socket_UDP::InitToAddress(const Socket_Address & address)
{
if (InitNoAddress() != true)
return false;
if (DO_CONNECT(_socket, &address.GetAddressInfo()) != 0)
return ErrorClose();
return true;
}
////////////////////////////////////////////////////////////////////
// Function name : Socket_UDP::InitNoAddress
// Description : This will set a udp up for targeted sends..
//
// Return type : inline bool
// Argument : void
////////////////////////////////////////////////////////////////////
inline bool Socket_UDP::InitNoAddress()
{
Close();
_socket = DO_NEWUDP();
if (_socket == BAD_SOCKET)
return false;
return true;
}
////////////////////////////////////////////////////////////////////
// Function name : Socket_UDP::Send
// Description : Send data to connected address
//
// Return type : inline bool
// Argument : char * data
// Argument : int len
////////////////////////////////////////////////////////////////////
inline bool Socket_UDP::Send(const char * data, int len)
{
return (DO_SOCKET_WRITE(_socket, data, len) == len);
}
////////////////////////////////////////////////////////////////////
// Function name : Socket_UDP::Send
// Description : Send data to connected address
//
// Return type : inline bool
// Argument : const string &data
////////////////////////////////////////////////////////////////////
inline bool Socket_UDP::Send(const string &data)
{
return Send(data.data(), data.size());
}
////////////////////////////////////////////////////////////////////
// Function name : Socket_UDP::SendTo
// Description : Send data to specified address
//
// Return type : inline bool
// Argument : char * data
// Argument : int len
// Argument : NetAddress & address
////////////////////////////////////////////////////////////////////
inline bool Socket_UDP::SendTo(const char * data, int len, const Socket_Address & address)
{
return (DO_SOCKET_WRITE_TO(_socket, data, len, &address.GetAddressInfo()) == len);
}
////////////////////////////////////////////////////////////////////
// Function name : Socket_UDP::SendTo
// Description : Send data to specified address
//
// Return type : inline bool
// Argument : const string &data
// Argument : NetAddress & address
////////////////////////////////////////////////////////////////////
inline bool Socket_UDP::SendTo(const string &data, const Socket_Address & address)
{
return SendTo(data.data(), data.size(), address);
}
#endif //__SOCKET_UDP_H__
| 33.180723 | 92 | 0.527596 |
239743da2620b28dbc69b9b9026aca5301c86464 | 2,182 | h | C | folly/experimental/coro/AsyncStack.h | Hailios/folly | 910ad09bd6c0a631a02ff5f4d9f5a21d762a36b6 | [
"MIT"
] | null | null | null | folly/experimental/coro/AsyncStack.h | Hailios/folly | 910ad09bd6c0a631a02ff5f4d9f5a21d762a36b6 | [
"MIT"
] | null | null | null | folly/experimental/coro/AsyncStack.h | Hailios/folly | 910ad09bd6c0a631a02ff5f4d9f5a21d762a36b6 | [
"MIT"
] | null | null | null | /*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <folly/Executor.h>
#include <folly/experimental/coro/Coroutine.h>
#include <folly/experimental/coro/WithAsyncStack.h>
#include <folly/tracing/AsyncStack.h>
#include <utility>
#include <vector>
#if FOLLY_HAS_COROUTINES
namespace folly {
namespace coro {
class AsyncStackTraceAwaitable {
class Awaiter {
public:
bool await_ready() const { return false; }
template <typename Promise>
bool await_suspend(coroutine_handle<Promise> h) noexcept {
initialFrame_ = &h.promise().getAsyncFrame();
return false;
}
FOLLY_NOINLINE std::vector<std::uintptr_t> await_resume() {
std::vector<std::uintptr_t> result;
auto addIP = [&](void* ip) {
result.push_back(reinterpret_cast<std::uintptr_t>(ip));
};
addIP(FOLLY_ASYNC_STACK_RETURN_ADDRESS());
auto* frame = initialFrame_;
while (frame != nullptr) {
addIP(frame->getReturnAddress());
frame = frame->getParentFrame();
}
return result;
}
private:
folly::AsyncStackFrame* initialFrame_;
};
public:
AsyncStackTraceAwaitable viaIfAsync(
const folly::Executor::KeepAlive<>&) const noexcept {
return {};
}
Awaiter operator co_await() const noexcept { return {}; }
friend AsyncStackTraceAwaitable tag_invoke(
cpo_t<co_withAsyncStack>,
AsyncStackTraceAwaitable awaitable) noexcept {
return awaitable;
}
};
inline constexpr AsyncStackTraceAwaitable co_current_async_stack_trace = {};
} // namespace coro
} // namespace folly
#endif // FOLLY_HAS_COROUTINES
| 26.609756 | 76 | 0.702566 |
2397ce920f91308ac1b60322977357266bea8fe0 | 837 | h | C | src/php_v8_integer.h | pinepain/php-v8 | dbf2f0cd713d67c252cffe7688548aaa35b56a73 | [
"MIT"
] | 165 | 2016-07-15T07:09:56.000Z | 2018-03-26T16:48:44.000Z | src/php_v8_integer.h | pinepain/php-v8 | dbf2f0cd713d67c252cffe7688548aaa35b56a73 | [
"MIT"
] | 72 | 2016-09-04T11:26:00.000Z | 2018-04-25T13:55:37.000Z | src/php_v8_integer.h | pinepain/php-v8 | dbf2f0cd713d67c252cffe7688548aaa35b56a73 | [
"MIT"
] | 12 | 2016-09-05T09:00:45.000Z | 2018-03-12T07:42:45.000Z | /*
* This file is part of the phpv8/php-v8 PHP extension.
*
* Copyright (c) 2015-2018 Bogdan Padalko <thepinepain@gmail.com>
*
* Licensed under the MIT license: http://opensource.org/licenses/MIT
*
* For the full copyright and license information, please view the
* LICENSE file that was distributed with this source or visit
* http://opensource.org/licenses/MIT
*/
#ifndef PHP_V8_INTEGER_H
#define PHP_V8_INTEGER_H
#include "php_v8_value.h"
#include <v8.h>
extern "C" {
#include "php.h"
#ifdef ZTS
#include "TSRM.h"
#endif
}
extern zend_class_entry* php_v8_integer_class_entry;
#define PHP_V8_CHECK_INTEGER_RANGE(val, message) \
if ((val) > UINT32_MAX || (val) < INT32_MIN) { \
PHP_V8_THROW_VALUE_EXCEPTION(message); \
return; \
}
PHP_MINIT_FUNCTION(php_v8_integer);
#endif //PHP_V8_INTEGER_H
| 21.461538 | 69 | 0.721625 |
2398105e9948650f4ef88827ad0d45930c7cffd2 | 5,264 | c | C | src/pal/tests/palsuite/file_io/SetFilePointer/test5/SetFilePointer.c | CyberSys/coreclr-mono | 83b2cb83b32faa45b4f790237b5c5e259692294a | [
"MIT"
] | 277 | 2015-01-04T20:42:36.000Z | 2022-03-21T06:52:03.000Z | src/pal/tests/palsuite/file_io/SetFilePointer/test5/SetFilePointer.c | CyberSys/coreclr-mono | 83b2cb83b32faa45b4f790237b5c5e259692294a | [
"MIT"
] | 31 | 2015-01-05T08:00:38.000Z | 2016-01-05T01:18:59.000Z | src/pal/tests/palsuite/file_io/SetFilePointer/test5/SetFilePointer.c | CyberSys/coreclr-mono | 83b2cb83b32faa45b4f790237b5c5e259692294a | [
"MIT"
] | 46 | 2015-01-21T00:41:59.000Z | 2021-03-23T07:00:01.000Z | //
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
/*=====================================================================
**
** Source: SetFilePointer.c (test 5)
**
** Purpose: Tests the PAL implementation of the SetFilePointer function.
** Test the FILE_BEGIN option using the high word parameter
**
** Assumes Successful:
** CreateFile
** ReadFile
** WriteFile
** strlen
** CloseHandle
** strcmp
** GetFileSize
**
**
**===================================================================*/
#include <palsuite.h>
const char* szTextFile = "text.txt";
int __cdecl main(int argc, char *argv[])
{
HANDLE hFile = NULL;
DWORD dwOffset = 1;
LONG dwHighWord = 1;
DWORD dwReturnedOffset = 0;
DWORD dwReturnedHighWord = 0;
DWORD dwRc = 0;
DWORD dwError = 0;
BOOL bRc = FALSE;
if (0 != PAL_Initialize(argc,argv))
{
return FAIL;
}
/* create a test file */
hFile = CreateFile(szTextFile,
GENERIC_READ | GENERIC_WRITE,
FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL,
CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL,
NULL);
if(hFile == INVALID_HANDLE_VALUE)
{
dwError = GetLastError();
Fail("SetFilePointer: ERROR -> Unable to create file \"%s\".\n with "
"error %ld",
szTextFile,
GetLastError());
}
/* move -1 from beginning which should fail */
dwRc = SetFilePointer(hFile, -1, &dwHighWord, FILE_BEGIN);
if (dwRc != INVALID_SET_FILE_POINTER)
{
Trace("SetFilePointer: ERROR -> Succeeded to move the pointer "
"before the beginning of the file using the high word.\n");
bRc = CloseHandle(hFile);
if (bRc != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
/* set the pointer past the end of the file and verify */
dwRc = SetFilePointer(hFile, dwOffset, &dwHighWord, FILE_BEGIN);
if ((dwRc == INVALID_SET_FILE_POINTER) &&
((dwError = GetLastError()) != ERROR_SUCCESS))
{
Trace("SetFilePointer: ERROR -> Failed to move pointer past EOF.\n");
bRc = CloseHandle(hFile);
if (bRc != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
else
{
/* verify */
bRc = SetEndOfFile(hFile);
if (bRc != TRUE)
{
dwError = GetLastError();
if (dwError == 112)
{
Trace("SetFilePointer: ERROR -> SetEndOfFile failed due to "
"lack of disk space\n");
}
else
{
Trace("SetFilePointer: ERROR -> SetEndOfFile call failed with "
"error %ld\n", dwError);
}
bRc = CloseHandle(hFile);
if (bRc != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file"
" \"%s\".\n", szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file"
" \"%s\".\n", szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
dwReturnedOffset = GetFileSize(hFile, &dwReturnedHighWord);
if ((dwOffset != dwReturnedOffset) ||
(dwHighWord != dwReturnedHighWord))
{
Trace("SetFilePointer: ERROR -> Failed to move pointer past"
" EOF.\n");
bRc = CloseHandle(hFile);
if (bRc != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file"
" \"%s\".\n", szTextFile);
}
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file"
" \"%s\".\n", szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
}
bRc = CloseHandle(hFile);
if (bRc != TRUE)
{
Trace("SetFilePointer: ERROR -> Unable to close file \"%s\".\n",
szTextFile);
if (!DeleteFileA(szTextFile))
{
Trace("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_TerminateEx(FAIL);
return FAIL;
}
if (!DeleteFileA(szTextFile))
{
Fail("SetFilePointer: ERROR -> Unable to delete file \"%s\".\n",
szTextFile);
}
PAL_Terminate();
return PASS;
}
| 28.608696 | 102 | 0.496771 |
23986b51ce52d3839c09107b372c858d434d9dbf | 25,653 | c | C | Games/Pegs CE/main.c | CiaranGruber/Ti-84-Calculator | 96742a4a2b9e21aa9d675575dc7e4f26365430c0 | [
"MIT"
] | 1 | 2019-03-31T11:49:12.000Z | 2019-03-31T11:49:12.000Z | Games/Pegs CE/main.c | CiaranGruber/Ti-84-Calculator | 96742a4a2b9e21aa9d675575dc7e4f26365430c0 | [
"MIT"
] | null | null | null | Games/Pegs CE/main.c | CiaranGruber/Ti-84-Calculator | 96742a4a2b9e21aa9d675575dc7e4f26365430c0 | [
"MIT"
] | 1 | 2020-03-09T13:21:19.000Z | 2020-03-09T13:21:19.000Z | // Program Name: PEGS
// Author(s): OSIAS HERNANDEZ
// Description:
/* Keep these headers */
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>
/* Standard headers - it's recommended to leave them included */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* Shared libraries */
//#include <lib/ce/graphc.h>
#include <lib/ce/graphx.h>
#include <lib/ce/fileioc.h>
#include <lib/ce/keypadc.h>
/* Some LCD defines */
#define lcd_size 320*240*2
#define lcd_buf (uint16_t*)0xD40000
void fillScreen(uint8_t color);
void drawBlock();
void drawGrid();
void drawSection();
void drawSelect();
void drawLevel();
void drawTitle();
void drawPause();
void drawBar();
void collision();
void level_editor();
void gfx_Rectangle(int x, int y, int width, int height);
void gfx_FillRectangle_NoClip(uint24_t x, uint8_t y, uint24_t width, uint8_t height);
void gfx_Line_NoClip(uint24_t x0, uint8_t y0, uint24_t x1, uint8_t y1);
void gfx_PrintStringXY(const char *string, uint24_t x, uint8_t y);
void gfx_FillTriangle_NoClip(int x0, int y0, int x1, int y1, int x2, int y2);
uint8_t gfx_SetTextFGColor(uint8_t color);
uint8_t gfx_SetTextBGColor(uint8_t color);
void matriscopy (void * destmat, void * srcmat){
memcpy(destmat, srcmat, 8*12*sizeof(uint8_t));}
/* Declare some strings and variables */
const char appvar_name[] = "Pegs";
/* version info */
#define VERSION 1
typedef struct settings_struct {
uint8_t lmax;
} settings_t;
settings_t settings;
void load_save(void);
void save_save(void);
void archive_save(void);
uint8_t a,b,key,key1,key3,key4,key5,db,s1,s2,s3,ss,i,j,win;
uint8_t c,keyPress=0,level=1;
uint8_t rpos,cpos,levelflag,cursorflag;
uint8_t deltar,deltas,deltac,deltad;
uint8_t row1,row2,col1,col2,drow,dcol;
uint8_t tc;
uint8_t rmoves,mode=1,theme=1;
uint8_t gfx_SetTextTransparentColor(uint8_t color);
signed char buf[20];
signed char flagtext[70];
uint8_t cursor[2][15] = {
{2,4,2,3,4,0,3,3,4,1,0,0,3,5,5},
{4,0,8,5,5,0,6,0,5,11,1,0,0,10,0},
};
static const char *themename[]={"COLOR","ORIGINAL","DARK"};
uint8_t color[3][16] = {
{0xFF,0xE3,0xE6,0xE3,0xFF,0xE0,0xFF,0x25,0xFF,0xE2,0xFF,0xD1,0xFF,0x1A,0x00,0x1A},
{0xFF,0x00,0xB5,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0x00,0xFF},
{0xB5,0xE3,0xE6,0xE3,0xB5,0xE0,0xB5,0x25,0xB5,0xE2,0xB5,0xD1,0xB5,0x1A,0x00,0x1A},
};
uint8_t moves[15] = {6,8,4,19,15,10,9,48,16,15,20,14,24,10,10};
uint8_t drb[8][12] = {
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
};
uint8_t drb16[8][12] = {
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
};
uint8_t pegslogo[8][12] = {
{9,9,9,9,9,9,9,9,9,9,9,9},
{1,1,1,5,5,5,8,8,8,1,1,1},
{1,9,1,5,9,9,8,9,9,1,9,9},
{1,1,1,5,5,5,8,9,8,1,1,1},
{1,9,9,5,9,9,8,9,8,9,9,1},
{1,9,9,5,5,5,8,8,8,1,1,1},
{9,9,9,9,9,9,9,9,9,9,9,9},
{9,9,9,9,9,9,9,9,9,9,9,9},
};
/* Put all your code here */
void main(void) {
/* Seed the random numbers */
srand(rtc_Time());
load_save();
if (settings.lmax==0){settings.lmax=1;}
level=settings.lmax;
gfx_Begin( gfx_8bpp );
gfx_FillScreen(0x00);
/* Set the text color where index 0 is transparent, and the forecolor is random */
gfx_SetTextTransparentColor(0x00);
gfx_SetColor(0xFF);
drawTitle();
drawLevel();
if (levelflag!=1){
drawGrid();}
drawBar();
b=rpos;a=cpos;db=2;
drawBlock();
/* Loop until 2nd is pressed */
keyPress=0;
while((kb_ScanGroup(kb_group_1) != kb_Graph) && mode!=4) {
if (rmoves==0){ //game completed
level=level+1;
if (mode==1){
levelflag=0;
if (level==16){win=1;}
if (((level==settings.lmax+1)) && (settings.lmax<15)){settings.lmax=level; }
sprintf(flagtext,"Nice Pegging!!!");
if (win==1){sprintf(flagtext,"You beat all levels!!!");level=15;}
save_save();
drawPause();
keyPress=0;
}
if (mode==2){
levelflag=1;
sprintf(flagtext,"Nice Pegging!!!");
level=settings.lmax;
drawPause();
drawTitle();
drawLevel();
drawGrid();
drawBar();
keyPress=0;
}
}
if (keyPress>110){
key = kb_ScanGroup(kb_group_7);
key1 = kb_ScanGroup(kb_group_1);
switch(key1) {
case kb_Window:
drawLevel();
drawGrid();
drawBar();
keyPress=0;
break;
case kb_Yequ:
if (mode=2){level=settings.lmax;}
drawTitle();
drawLevel();
drawGrid();
drawBar();
keyPress=0;
break;
default:
break;
}
switch(key) {
case kb_Down:
if (rpos<7){
deltar=1;deltas=0;deltac=0;deltad=0;keyPress=0;
b=rpos;a=cpos;collision();}
break;
case kb_Right:
if (cpos<11){
deltar=0;deltas=0;deltac=1;deltad=0;keyPress=0;
b=rpos;a=cpos;
collision();
}
break;
case kb_Up:
if (rpos>0){
deltar=0;deltas=1;deltac=0;deltad=0;keyPress=0;
b=rpos;a=cpos;
collision();}
break;
case kb_Left:
if (cpos>0){
deltar=0;deltas=0;deltac=0;deltad=1;keyPress=0;
b=rpos;a=cpos;
collision();}
break;
default:
break;
}
}
keyPress++;
}
save_save();
ti_CloseAll();
/* Wait for a key to be pressed -- Don't use this in your actual programs! */
gfx_FillScreen(0xFF);
/* Close the graphics and return to the OS */
gfx_End();
pgrm_CleanUp();
}
/* Simple way to fill the screen with a given color */
void fillScreen(uint8_t color) {
memset_fast(lcd_buf, color, lcd_size);
}
void drawGrid(){
for (b=0;b<8;b++){
for (a=0;a<12;a++){
db= drb[b][a];
drawBlock();
}
}
return;
}
void drawBlock(){
if (db==0){
gfx_SetColor(color[theme-1][0]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
return;}
if (db==1){
gfx_SetColor(color[theme-1][1]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
gfx_SetColor(color[theme-1][2]);
gfx_FillRectangle_NoClip(26*a+1,26*b+1,24,24);
gfx_SetColor(color[theme-1][3]);
gfx_Line_NoClip(26*a,26*b,26*a+25,26*b+25);
gfx_Line_NoClip(26*a,26*b+25,26*a+25,26*b);
return;}
if (db==2){
gfx_SetColor(color[theme-1][4]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
gfx_SetColor(color[theme-1][5]);
gfx_FillRectangle_NoClip(26*a+7,26*b+7,12,12);
gfx_FillRectangle_NoClip(26*a+11,26*b,4,26);
gfx_FillRectangle_NoClip(26*a,26*b+11,26,4);
gfx_FillRectangle_NoClip(26*a,26*b+7,4,12);
gfx_FillRectangle_NoClip(26*a+22,26*b+7,4,12);
gfx_FillRectangle_NoClip(26*a+7,26*b,12,4);
gfx_FillRectangle_NoClip(26*a+7,26*b+22,12,4);
}
if (db==3){
gfx_SetColor(color[theme-1][6]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
gfx_SetColor(color[theme-1][7]);
gfx_FillRectangle_NoClip(26*a+9,26*b,8,26);
gfx_FillRectangle_NoClip(26*a,26*b+9,26,8);
return;}
if (db==4){
gfx_SetColor(color[theme-1][8]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
gfx_SetColor(color[theme-1][9]);
if (theme!=2){
gfx_FillRectangle_NoClip(26*a,26*b+7,6,6);
gfx_FillRectangle_NoClip(26*a,26*b+13,13,13);
gfx_FillRectangle_NoClip(26*a+13, 26*b+20, 6, 6);
for (c=0;c<7;c++){
gfx_Line_NoClip(26*a,26*b+c,26*a+25-c,26*b+25);}
}
if (theme==2){
gfx_Line_NoClip(26*a,26*b,26*a,26*b+25);
gfx_Line_NoClip(26*a+1,26*b+1,26*a+1,26*b+24);
gfx_Line_NoClip(26*a,26*b+25,26*a+25,26*b+25);
gfx_Line_NoClip(26*a+1,26*b+24,26*a+24,26*b+24);
gfx_Line_NoClip(26*a,26*b,26*a+25,26*b+25);
gfx_Line_NoClip(26*a,26*b+1,26*a+24,26*b+25);
}
return;}
if (db==5){
gfx_SetColor(color[theme-1][10]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
gfx_SetColor(color[theme-1][11]);
if (theme!=2){
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
}
if (theme==2){
gfx_Rectangle_NoClip(26*a,26*b,26,26);
gfx_Rectangle_NoClip(26*a+1,26*b+1,24,24);
}
return;}
if (db==6){
gfx_SetColor(color[theme-1][12]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
gfx_SetColor(color[theme-1][13]);
if (theme!=2){
gfx_FillCircle(26*a+13, 26*b+13, 12);
}
if (theme==2){
gfx_Circle(26*a+13, 26*b+13, 12);
gfx_Circle(26*a+13, 26*b+13, 11);
}
return;
}
if (db==7){
gfx_SetColor(color[theme-1][14]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
return;}
if (db==8){
gfx_SetColor(color[theme-1][15]);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
return;}
}
void collision(){
row1=rpos+deltar-deltas;
row2=rpos+2*(deltar-deltas);
col1=cpos+deltac-deltad;
col2=cpos+2*(deltac-deltad);
drow=deltar-deltas;
dcol=deltac-deltad;
if ((((col1<0) && (dcol!=0)) || ((col1>11) && (dcol!=0))) || (((row1<0) && (drow!=0)) || ((row1>7) && (drow!=0)))){
sprintf(flagtext,"no colli");
return;
}
s1=drb[rpos][cpos]; /*current position */
s2=drb[row1][col1]; /*future position */
s3=drb[row2][col2];
if (((col2<0) || (col2>11)) || ((row2<0) || (row2>7))){
s3=9;
}
if (s2==0){
drb[rpos][cpos]=0;
drb[row1][col1]=2;
ss=drb[rpos][cpos];
b=rpos;a=cpos;db=ss;
drawBlock();
ss=drb[row1][col1];
b=row1;a=col1;db=ss;
drawBlock();
rpos=row1;
cpos=col1;
for (i=0;i<30;i++){j=i;}
return;
}
if (s2==7){
b=rpos;a=cpos;db=0;
drawBlock();
sprintf(flagtext,"You fell in a hole and died.");
drawPause();
return;
}
if (((s2>2) && (s2<7)) && ((s3>2) && (s3<7)) && (s2!=s3))
{
sprintf(flagtext,"They don't match.");
drawPause();
}
if ((((s2>2) && (s2<7)) && (s3==0)))
{
drb[rpos][cpos]=0;
drb[row2][col2]=drb[row1][col1];
drb[row1][col1]=2;
drawSection();
rpos=row1;
cpos=col1;
return;
}
if (((s2==5) && (s3==5)) || ((s2==6) && (s3==6)))
{
drb[rpos][cpos]=0;
drb[row1][col1]=2;
drb[row2][col2]=0;
drawSection();
rpos=row1;
cpos=col1;
rmoves=rmoves-2;
return;}
if ((((s2>2) && (s2<7)) && (s3==7)))
{
drb[rpos][cpos]=0;
drb[row1][col1]=2;
if (s2!=5){drb[row2][col2]=7;}
else {drb[row2][col2]=0;}
drawSection();
rpos=row1;
cpos=col1;
rmoves=rmoves-1;
return;}
if (s2==1){return;}
if (((s2==4) && (s3==4))){
drb[rpos][cpos]=0;
drb[row1][col1]=2;
drb[row2][col2]=1;
drawSection();
rpos=row1;
cpos=col1;
rmoves=rmoves-2;
return;
}
if (((s2==3) && (s3==3))){
drb[rpos][cpos]=0;
drb[row1][col1]=0;
drb[row2][col2]=3;
drawSection();
drawSelect();
rpos=row1;
cpos=col1;
rmoves=rmoves-1;
return;
}
}
void drawSelect(){
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,220,320,20);
gfx_SetTextFGColor(0xFF);
sprintf(flagtext,"Select: 'UP' or 'DOWN' Choose: ENTER");
gfx_PrintStringXY(flagtext,0,220);
ss=4;
b=row2;a=col2;db=ss;keyPress=0;
drawBlock();
drb[row2][col2]=ss;
keyPress=0;
/* Loop until ENTER is pressed */
while(kb_ScanGroup(kb_group_6) != kb_Enter) {
if (keyPress>120){
key = kb_ScanGroup(kb_group_7);
switch(key) {
case kb_Down:
if (ss>2){ss=ss+1;
if (ss==7){ss=3;}
b=row2;a=col2;db=ss;keyPress=0;
drawBlock();
drb[row2][col2]=ss;
}
break;
case kb_Up:
if (ss<7){ss=ss-1;
if (ss==2){ss=6;}
b=row2;a=col2;db=ss;keyPress=0;
drawBlock();
drb[row2][col2]=ss;
}
break;
default:
break;
}
}
keyPress++;
}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,220,320,20);
b=row1;a=col1;db=2;
drawBlock();
drawBar();
}
void drawSection(){
ss=drb[rpos][cpos];
b=rpos;a=cpos;db=ss;
drawBlock();
ss=drb[row1][col1];
b=row1;a=col1;db=ss;
drawBlock();
ss=drb[row2][col2];
b=row2;a=col2;db=ss;
drawBlock();
}
void drawLevel(){
uint8_t drb1[8][12] = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,2,0,0,6,0,0,0,1},
{1,0,0,0,0,3,3,4,0,0,0,1},
{1,0,0,0,5,7,0,6,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,0,0,0,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1},
};
uint8_t drb2[8][12] = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,0,0,0,4,4,0,0,0,1},
{1,1,1,0,0,0,1,0,0,0,0,1},
{1,1,1,0,0,0,1,1,0,0,0,1},
{2,0,0,0,4,4,6,6,0,0,0,1},
{1,1,1,0,0,0,1,1,0,0,0,1},
{1,1,1,0,0,0,1,0,0,0,0,1},
{1,1,1,0,0,0,4,4,0,0,0,1},
};
uint8_t drb3[8][12] = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,0,0,4,0,2,0,0,0},
{1,0,1,1,0,1,1,0,1,1,4,1},
{1,0,0,4,0,0,0,0,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,4,1},
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1},
};
uint8_t drb4[8][12] = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{7,0,5,0,4,0,4,0,0,0,0,1},
{7,0,3,0,6,0,4,0,0,0,0,1},
{7,0,6,0,5,2,4,0,0,0,0,1},
{7,0,4,0,5,0,4,0,3,0,0,1},
{7,0,5,0,6,0,4,0,0,0,0,1},
{7,0,6,0,5,0,4,0,0,0,0,1},
{7,1,1,1,1,1,1,1,1,1,1,1},
};
uint8_t drb5[8][12] = {
{0,7,7,0,5,7,0,0,7,0,0,0},
{0,7,7,0,5,5,0,0,7,0,0,4},
{0,7,7,0,7,7,7,0,1,4,4,4},
{0,7,7,0,7,5,7,0,1,4,0,4},
{0,7,7,0,7,2,7,6,7,0,0,0},
{0,7,7,0,7,7,7,0,7,0,0,0},
{0,7,7,0,5,0,0,0,7,0,0,0},
{0,7,7,0,0,6,0,0,7,6,6,0},
};
uint8_t drb6[8][12] = {
{2,0,0,0,0,0,0,0,0,0,0,0},
{4,0,0,0,0,0,0,0,0,0,3,0},
{4,0,0,4,0,0,0,4,4,0,0,0},
{0,1,1,4,1,1,1,1,1,1,1,0},
{0,0,0,0,0,0,0,0,0,0,0,0},
{0,1,1,1,1,0,1,1,0,1,1,1},
{0,3,0,0,0,0,0,0,6,5,7,0},
{0,0,0,1,1,1,1,0,0,1,1,1},
};
uint8_t drb7[8][12] = {
{1,1,1,1,0,0,1,1,1,1,1,1},
{1,1,1,7,0,0,5,7,0,1,1,1},
{1,1,1,1,0,1,6,1,0,1,1,1},
{1,1,1,4,3,3,2,5,4,7,0,1},
{1,1,1,1,0,1,4,1,0,0,0,1},
{1,1,1,1,0,0,6,0,0,1,0,1},
{1,1,1,1,1,1,1,0,1,1,0,1},
{1,1,1,1,1,1,1,0,0,0,0,1},
};
uint8_t drb8[8][12] = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{0,0,3,3,3,3,3,5,3,3,0,0},
{0,0,3,3,3,4,3,3,6,3,0,0},
{2,0,3,3,3,4,3,3,5,3,0,0},
{0,0,3,3,5,6,3,3,3,3,0,0},
{0,0,3,3,6,4,3,3,3,3,0,0},
{0,0,3,3,4,5,3,3,3,3,0,0},
{1,1,1,1,1,1,1,1,1,1,1,1},
};
uint8_t drb9[8][12] = {
{0,0,0,0,1,1,0,0,0,0,0,0},
{0,3,0,0,1,1,0,0,0,0,0,0},
{0,0,0,0,4,5,5,3,0,1,1,0},
{0,1,0,0,4,1,0,0,0,1,1,1},
{0,0,0,4,4,2,1,0,0,0,0,4},
{0,0,0,0,4,1,0,0,1,1,1,1},
{0,3,1,0,4,6,6,0,0,0,3,0},
{0,0,0,0,5,1,0,0,0,0,0,0},
};
uint8_t drb10[8][12] = {
{1,1,1,1,4,1,1,1,0,0,0,0},
{1,1,1,1,0,1,1,1,0,0,0,2},
{0,0,5,0,7,7,7,0,0,0,3,0},
{0,3,3,0,7,7,7,0,5,3,5,0},
{0,3,3,0,7,7,7,0,5,3,5,0},
{0,0,0,0,7,7,7,0,3,0,0,0},
{1,1,1,1,1,0,1,1,0,0,0,0},
{1,1,1,1,1,4,1,1,0,0,0,0},
};
uint8_t drb11[8][12] = {
{1,2,1,0,1,1,7,0,0,1,1,0},
{1,0,0,0,6,5,7,7,0,4,4,0},
{1,4,1,4,0,1,7,0,0,4,4,0},
{1,0,0,4,0,1,0,0,0,3,3,0},
{1,4,1,0,0,1,0,1,0,3,3,0},
{0,0,0,0,0,1,0,1,1,0,1,0},
{0,3,5,3,0,1,0,1,0,0,0,0},
{0,0,0,0,4,4,4,1,1,1,1,1},
};
uint8_t drb12[8][12] = {
{2,0,0,0,0,0,1,1,1,1,1,1},
{1,4,1,4,1,4,1,1,0,0,0,1},
{0,0,0,0,0,0,1,0,0,1,0,1},
{1,4,1,4,1,4,1,0,0,0,0,1},
{0,0,0,0,0,0,1,1,6,6,7,1},
{1,4,1,4,1,4,1,1,0,4,4,1},
{0,0,0,0,0,0,0,0,0,0,4,1},
{1,0,1,1,1,1,1,1,0,0,1,1},
};
uint8_t drb13[8][12] = {
{1,1,1,1,1,1,1,1,1,1,1,1},
{0,0,5,0,4,0,6,0,5,0,0,7},
{0,0,4,0,6,0,4,0,5,0,0,7},
{2,0,3,0,5,0,6,0,5,0,0,7},
{0,0,6,0,5,0,4,0,5,0,0,7},
{0,0,5,0,4,0,6,0,5,0,0,7},
{0,0,3,0,3,0,4,0,5,0,0,7},
{1,1,1,1,1,1,1,1,1,1,1,1},
};
uint8_t drb14[8][12] = {
{1,1,1,1,1,0,0,1,0,0,1,1},
{1,1,0,4,0,0,5,0,0,4,0,1},
{1,7,0,0,6,1,0,1,1,0,0,1},
{1,1,1,0,0,3,6,3,0,0,1,1},
{1,1,0,0,1,1,0,1,6,0,0,7},
{1,1,0,4,0,0,5,0,0,0,2,1},
{1,1,0,0,1,0,0,1,1,1,1,1},
{1,1,1,1,1,1,1,1,1,1,1,1},
};
uint8_t drb15[8][12] = {
{0,0,0,7,0,7,0,7,0,7,0,1},
{0,0,0,7,0,7,0,7,0,7,0,1},
{0,3,5,7,0,7,0,7,0,7,0,4},
{0,5,0,7,0,7,5,7,0,7,0,1},
{0,3,0,7,0,7,0,7,0,7,0,1},
{2,0,0,7,5,7,0,7,0,7,0,1},
{0,0,5,7,0,7,0,7,5,7,0,1},
{0,0,5,7,0,7,0,7,0,7,0,1},
};
rpos=cursor[0][level-1];
cpos=cursor[1][level-1];
rmoves=moves[level-1];
if (level==1){matriscopy(drb,drb1);
return;}
if (level==2){matriscopy(drb,drb2);
return;}
if (level==3){matriscopy(drb,drb3);
return;}
if (level==4){matriscopy(drb,drb4);
return;}
if (level==5){matriscopy(drb,drb5);
return;}
if (level==6){matriscopy(drb,drb6);
return;}
if (level==7){matriscopy(drb,drb7);
return;}
if (level==8){matriscopy(drb,drb8);
return;}
if (level==9){matriscopy(drb,drb9);
return;}
if (level==10){matriscopy(drb,drb10);
return;}
if (level==11){matriscopy(drb,drb11);
return;}
if (level==12){matriscopy(drb,drb12);
return;}
if (level==13){matriscopy(drb,drb13);
return;}
if (level==14){matriscopy(drb,drb14);
return;}
if (level==15){matriscopy(drb,drb15);
return;}
if (level==17){matriscopy(drb,drb16);
rmoves=0;
for (b=0;b<8;b++){
for (a=0;a<12;a++){
c = drb[b][a];
if (c==2){
rpos=b;cpos=a;
}
if ((c==3) || (c==4) || (c==5) || (c==6)){
rmoves=rmoves+1;}
}
}
drawGrid();
return;
}
}
void drawTitle(){
mode=1;
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,0,320,240);
for (b=0;b<8;b++){
for (a=0;a<12;a++){
drb[b][a]= pegslogo[b][a];}}
drawGrid();
gfx_SetTextBGColor(0x00);
gfx_SetTextFGColor(0xE5);
gfx_PrintStringXY(" Press [2nd]",220,230);
gfx_SetTextFGColor(0xFF);
gfx_PrintStringXY("EDITOR",20,200);
gfx_PrintStringXY("THEME :",20,215);
gfx_SetTextFGColor(0xE6);
gfx_PrintStringXY(themename[theme-1],75,215);
gfx_SetTextFGColor(0xFF);
gfx_PrintStringXY("EXIT",20,230);
sprintf(flagtext,"LEVEL");
gfx_PrintStringXY(flagtext,20,185);
gfx_SetTextFGColor(0xE6);
gfx_PrintStringXY(">",0,185);
sprintf(flagtext,"%d",level);
if (level>1){sprintf(flagtext,"< %d",level);}
else {sprintf(flagtext,"%d",level);}
if (level!=settings.lmax){strcat(flagtext," >");}
gfx_PrintStringXY(flagtext,70,185);
keyPress=0;
while(kb_ScanGroup(kb_group_1) != kb_2nd) {
if (keyPress>120){
key = kb_ScanGroup(kb_group_7);
switch(key) {
case kb_Right:
keyPress=0;
if (mode==1){
if (level>0 && level<settings.lmax){level=level+1;}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(70,185,65,10);
gfx_SetTextFGColor(0xE6);
if (level>1){sprintf(flagtext,"< %d",level);}
else {sprintf(flagtext,"%d",level);}
if (level!=settings.lmax){strcat(flagtext," >");}
gfx_PrintStringXY(flagtext,70,185);
}
if (mode==3){
if (theme>0){theme=theme+1;
if (theme==4){theme=1;}
}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(75,215,65,10);
gfx_SetTextFGColor(0xE6);
gfx_PrintStringXY(themename[theme-1],75,215);
}
break;
case kb_Left:
keyPress=0;
if (mode==1){
if (level<settings.lmax+1 && level>1){level=level-1;
}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(70,185,65,10);
gfx_SetTextFGColor(0xE6);
if (level>1){sprintf(flagtext,"< %d",level);}
else {sprintf(flagtext,"%d",level);}
if (level!=settings.lmax){strcat(flagtext," >");}
gfx_PrintStringXY(flagtext,70,185);
}
if (mode==3){
if (theme<4){theme=theme-1;
if (theme==0){theme=3;}
}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(75,215,65,10);
gfx_SetTextFGColor(0xE6);
gfx_PrintStringXY(themename[theme-1],75,215);
}
break;
case kb_Down:
if (mode>0){mode=mode+1;
if (mode==5){mode=1;}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,185,10,65);
gfx_SetColor(0xE6);
gfx_PrintStringXY(">",0,170+15*mode);
keyPress=0;}
break;
case kb_Up:
if (mode<5){mode=mode-1;
if (mode==0){mode=4;}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,185,10,65);
gfx_SetColor(0xE6);
gfx_PrintStringXY(">",0,170+15*mode);
keyPress=0;}
break;
default:
break;
}
}
keyPress++;
}
if (mode==2){
keyPress=0;
level_editor();
}
if (mode==3){
keyPress=0;
mode=1;
}
if (mode==4){levelflag=1;}
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,0,320,240);
gfx_SetColor(0xFF);
gfx_SetTextTransparentColor(0x00);
}
void drawPause(){
gfx_SetTextTransparentColor(0x00);
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,220,320,20);
gfx_SetTextFGColor(0xFF);
gfx_PrintStringXY(flagtext,0,220);
while(kb_ScanGroup(kb_group_6) != kb_Enter) {};
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,220,320,20);
if (levelflag==0){
drawLevel();
drawGrid();
drawBar();}
}
void drawBar(){
gfx_SetTextTransparentColor(0x00);
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,220,320,20);
gfx_SetColor(0xFF);
for (a=0;a<3;a++){
gfx_Line_NoClip(5,220+5*a,20,220+5*a);
}
gfx_Line_NoClip(75,225,80,220);
gfx_Line_NoClip(75,225,80,230);
gfx_Line_NoClip(295,220,305,230);
gfx_Line_NoClip(295,230,305,220);
}
void load_save(void) {
ti_var_t save;
ti_CloseAll();
save = ti_Open(appvar_name, "r+");
if(save) {
if (ti_GetC(save) == VERSION) {
if (ti_Read(&settings, sizeof(settings_t), 1, save) != 1) {
return;
} else {
return;
}
}
}
ti_CloseAll();
}
void save_save(void) {
ti_var_t save;
ti_CloseAll();
save = ti_Open(appvar_name, "w");
if(save) {
ti_PutC(VERSION, save);
if (ti_Write(&settings, sizeof(settings_t), 1, save) != 1) {
goto err;
}
}
ti_CloseAll();
return;
err:
ti_Delete(appvar_name);
}
void level_editor(){
keyPress=0,rmoves=0;cursorflag=0,levelflag=0;
for (b=0;b<8;b++){
for (a=0;a<12;a++){
drb[b][a]=0;}}
level=17;
drawGrid();
gfx_SetColor(0x00);
gfx_FillRectangle_NoClip(0,210,320,30);
gfx_SetColor(0xE6);
gfx_PrintStringXY("0 - EMPTY 1 - BLOCK 2 - YOU 3 - CROSS",0,210);
gfx_PrintStringXY("4 - TRIANGLE 5 - SQUARE 6 - CIRCLE 7 - HOLE",0,220);
gfx_SetColor(0xFF);
gfx_PrintStringXY("Press [ENTER]",225,230);
rpos=0;cpos=0;
b=rpos;a=cpos;db=0;
gfx_SetColor(0x1D);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
keyPress=0;
levelflag=0;
while(levelflag != 1 || cursorflag != 1){
while((kb_ScanGroup(kb_group_6) != kb_Enter)) {
if (keyPress>110){
key = kb_ScanGroup(kb_group_7);
key3 = kb_ScanGroup(kb_group_3);
key4 = kb_ScanGroup(kb_group_4);
key5 = kb_ScanGroup(kb_group_5);
switch(key3){
case kb_0:
b=rpos;a=cpos;
if (drb[b][a]==2){cursorflag=0;}
if ((drb[b][a]>2) && (drb[b][a]<7)){
rmoves=rmoves-1;
if (rmoves==0){levelflag=0;}
}
db=0;keyPress=0;
drb[b][a]=db;
drawBlock();
break;
case kb_1:
b=rpos;a=cpos;db=1;keyPress=0;
drb[b][a]=db;
drawBlock();
break;
case kb_4:
b=rpos;a=cpos;db=4;keyPress=0,levelflag=1;
if (drb[b][a]!=4){
rmoves=rmoves+1;}
drb[b][a]=db;
drawBlock();
break;
case kb_7:
b=rpos;a=cpos;db=7;keyPress=0;
drb[b][a]=db;
drawBlock();
break;
default: break;
}
switch(key4){
case kb_2:
if (cursorflag==0){
b=rpos;a=cpos;db=2;keyPress=0;
cursorflag=1;
drb[b][a]=db;
drawBlock();}
break;
case kb_5:
b=rpos;a=cpos;db=5;keyPress=0,levelflag=1;
if (drb[b][a]!=5){
rmoves=rmoves+1;}
drb[b][a]=db;
drawBlock();
break;
default: break;
}
switch(key5){
case kb_3:
b=rpos;a=cpos;db=3;keyPress=0,levelflag=1;
if (drb[b][a]!=3){
rmoves=rmoves+1;}
drb[b][a]=db;
drawBlock();
break;
case kb_6:
b=rpos;a=cpos;db=6;keyPress=0,levelflag=1;
if (drb[b][a]!=6){
rmoves=rmoves+1;}
drb[b][a]=db;
drawBlock();
break;
default: break;
}
switch(key) {
case kb_Down:
if (rpos<7){
keyPress=0;
db = drb[b][a];
drawBlock();
rpos=rpos+1;
b=rpos;a=cpos;
gfx_SetColor(0x1D);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
}
break;
case kb_Up:
if (rpos>0){
keyPress=0;
db = drb[b][a];
drawBlock();
rpos=rpos-1;
b=rpos;a=cpos;
gfx_SetColor(0x1D);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
}
break;
case kb_Right:
if (cpos<11){
keyPress=0;
db = drb[b][a];
drawBlock();
cpos=cpos+1;
b=rpos;a=cpos;
gfx_SetColor(0x1D);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
}
break;
case kb_Left:
if (cpos>0){
keyPress=0;
db = drb[b][a];
drawBlock();
cpos=cpos-1;
b=rpos;a=cpos;
gfx_SetColor(0x1D);
gfx_FillRectangle_NoClip(26*a,26*b,26,26);
}
break;
default:
break;
}
}
keyPress++;
}
}
matriscopy(drb16,drb);
matriscopy(drb,drb16);
drawLevel();
}
| 23.110811 | 119 | 0.549565 |
239a8079be49af187c3829afed5a864b4002272c | 4,579 | c | C | xdk-asf-3.51.0/thirdparty/wireless/miwi/services/sleep_mgr/sam0/sleep_mgr.c | j3270/SAMD_Experiments | 5c242aff44fc8d7092322d7baf2dda450a78a9b7 | [
"MIT"
] | null | null | null | xdk-asf-3.51.0/thirdparty/wireless/miwi/services/sleep_mgr/sam0/sleep_mgr.c | j3270/SAMD_Experiments | 5c242aff44fc8d7092322d7baf2dda450a78a9b7 | [
"MIT"
] | null | null | null | xdk-asf-3.51.0/thirdparty/wireless/miwi/services/sleep_mgr/sam0/sleep_mgr.c | j3270/SAMD_Experiments | 5c242aff44fc8d7092322d7baf2dda450a78a9b7 | [
"MIT"
] | null | null | null | /**
* @file sleep_mgr.c
*
* @brief
*
* Copyright (c) 2018 - 2019 Microchip Technology Inc. and its subsidiaries.
*
* \asf_license_start
*
* \page License
*
* Subject to your compliance with these terms, you may use Microchip
* software and any derivatives exclusively with Microchip products.
* It is your responsibility to comply with third party license terms applicable
* to your use of third party software (including open source software) that
* may accompany Microchip software.
*
* THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES,
* WHETHER EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE,
* INCLUDING ANY IMPLIED WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY,
* AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL MICROCHIP BE
* LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE, INCIDENTAL OR CONSEQUENTIAL
* LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND WHATSOEVER RELATED TO THE
* SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS BEEN ADVISED OF THE
* POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE FULLEST EXTENT
* ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN ANY WAY
* RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
* THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
*
* \asf_license_stop
*
*
*/
/*
* Copyright (c) 2014-2018 Microchip Technology Inc. and its subsidiaries.
*
* Licensed under Atmel's Limited License Agreement --> EULA.txt
*/
#include "sleep_mgr.h"
#include "rtc_count.h"
#include "system.h"
#include "rtc_count_interrupt.h"
#include "asf.h"
#include "trx_access.h"
#include "sysTimer.h"
/* Minimum sleep interval in milliseconds */
#define MIN_SLEEP_INTERVAL (1000)
struct rtc_module rtc_instance;
/**
* @brief Configuring RTC Callback Function on Overflow
*
* @param void
*/
static void configure_rtc_callbacks(void);
/**
* @brief Callback Function indicating RTC Overflow
*
* @param void
*/
static void rtc_overflow_callback(void);
/**
* @brief Sleep Preparation procedures
*
* @param void
*/
static void sleepPreparation(void);
/**
* @brief Sleep Exit procedures
*
* @param sleepTime
*/
static void sleepExit(uint32_t sleepTime);
/**
* \brief This function Initializes the Sleep functions
* Enable RTC Clock in conf_clocks.h
*/
void sleepMgr_init(void)
{
struct rtc_count_config config_rtc_count;
rtc_count_get_config_defaults(&config_rtc_count);
config_rtc_count.prescaler = RTC_COUNT_PRESCALER_DIV_1;
config_rtc_count.mode = RTC_COUNT_MODE_32BIT;
#ifdef FEATURE_RTC_CONTINUOUSLY_UPDATED
/** Continuously update the counter value so no synchronization is
* needed for reading. */
config_rtc_count.continuously_update = true;
#endif
/* Clear the timer on match to generate the overflow interrupt*/
config_rtc_count.clear_on_match = true;
/* Initialize RTC Counter */
rtc_count_init(&rtc_instance, RTC, &config_rtc_count);
configure_rtc_callbacks();
}
/**
* @brief Sleep Preparation procedures
*
* @param void
*/
static void sleepPreparation(void)
{
/* Disable Transceiver SPI */
trx_spi_disable();
}
/**
* @brief Sleep Exit procedures
*
* @param sleepTime
*/
static void sleepExit(uint32_t sleepTime)
{
/* Enable Transceiver SPI */
trx_spi_enable();
/* Synchronize Timers */
SYS_TimerAdjust_SleptTime(sleepTime);
}
/**
* \brief This function puts the transceiver and device to sleep
* \Parameter interval - the time to sleep in milliseconds
*/
bool sleepMgr_sleep(uint32_t interval)
{
if (interval < MIN_SLEEP_INTERVAL)
{
return false;
}
/*Set the timeout for compare mode and enable the RTC*/
rtc_count_set_compare(&rtc_instance, interval, RTC_COUNT_COMPARE_0);
/* Configure RTC Callbacks */
configure_rtc_callbacks();
/* Enable RTC */
rtc_count_enable(&rtc_instance);
/* Preparing to go for sleep */
sleepPreparation();
/*put the MCU in standby mode with RTC as wakeup source*/
system_set_sleepmode(SYSTEM_SLEEPMODE_STANDBY);
system_sleep();
/* Exit procedure after wakeup */
sleepExit(interval);
return true;
}
static void configure_rtc_callbacks(void)
{
/*Register rtc callback*/
rtc_count_register_callback(
&rtc_instance, rtc_overflow_callback,
RTC_COUNT_CALLBACK_OVERFLOW);
rtc_count_enable_callback(&rtc_instance, RTC_COUNT_CALLBACK_OVERFLOW);
}
static void rtc_overflow_callback(void)
{
/* Disable RTC upon interrupt */
rtc_count_disable(&rtc_instance);
}
| 25.581006 | 80 | 0.723302 |
239b8919b1d1980a70e7ecb1d4a317353bb49cb8 | 228 | h | C | Artistic/Categories/UIImageView+Artistic.h | AntonioJMartinez/Artistic | 705769274158d359c6e4dded59beb7fbcdb4ba13 | [
"MIT"
] | null | null | null | Artistic/Categories/UIImageView+Artistic.h | AntonioJMartinez/Artistic | 705769274158d359c6e4dded59beb7fbcdb4ba13 | [
"MIT"
] | null | null | null | Artistic/Categories/UIImageView+Artistic.h | AntonioJMartinez/Artistic | 705769274158d359c6e4dded59beb7fbcdb4ba13 | [
"MIT"
] | null | null | null | //
// UIImageView+Artistic.h
// Artistic
//
// Created by Antonio J. on 31/05/15.
// Copyright (c) 2015 Antonio J. Martinez Sanchez. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImageView (Artistic)
@end
| 15.2 | 72 | 0.679825 |
239d9714b6231defc593aac57583245d241d3466 | 2,238 | h | C | server/Server/Base/PetConfig.h | viticm/web-pap | 7c9b1f49d9ba8d8e40f8fddae829c2e414ccfeca | [
"BSD-3-Clause"
] | 3 | 2018-06-19T21:37:38.000Z | 2021-07-31T21:51:40.000Z | server/Server/Base/PetConfig.h | viticm/web-pap | 7c9b1f49d9ba8d8e40f8fddae829c2e414ccfeca | [
"BSD-3-Clause"
] | null | null | null | server/Server/Base/PetConfig.h | viticm/web-pap | 7c9b1f49d9ba8d8e40f8fddae829c2e414ccfeca | [
"BSD-3-Clause"
] | 13 | 2015-01-30T17:45:06.000Z | 2022-01-06T02:29:34.000Z | #ifndef _PET_CONFIG_H_
#define _PET_CONFIG_H_
#define GENGU_NUM (5)
struct SPetConfig
{
enum {
VARIANCEPET_LEVEL_NUM = 8,
};
INT m_VariancePetRate; //生成变异宠概率
INT m_BabyPetRate; //生成宝宝概率
//野生宠等级生成概率(四个值)
INT m_WilenessPetRate_TakeLevel; // 携带等级概率
INT m_WilenessPetRate_Delta1; // 携带等级+,-1概率
INT m_WilenessPetRate_Delta2; // 携带等级+,-2概率
INT m_WilenessPetRate_Delta3; // 携带等级+,-3概率
//成长率生成概率(五个值)
INT m_GrowRate0;
INT m_GrowRate1;
INT m_GrowRate2;
INT m_GrowRate3;
INT m_GrowRate4;
// 宠物变异等级几率(10w)
INT m_aRateOfLevelVariancePet[VARIANCEPET_LEVEL_NUM];
//根骨相关
struct SGenGu
{
INT m_Begin;
INT m_End;
INT m_Rate;
};
SGenGu m_vGenGu[GENGU_NUM];
//资质变动范围(如±5%)
INT m_IntelligenceRange;
//移动速度
INT m_MoveSpeed;
//攻击速度
INT m_AttackSpeed;
// AI相关数据
INT m_PetAI0_MagicRate;
INT m_PetAI1_MagicRate;
INT m_PetAI2_MagicRate;
INT m_PetAI3_MagicRate;
// 初始HP、物攻、魔攻、物防、魔防、命中、闪避、会心(八个)
INT m_BaseHP;
INT m_BasePhyAttack;
INT m_BaseMgcAttack;
INT m_BasePhyDefence;
INT m_BaseMgcDefence;
INT m_BaseHit;
INT m_BaseMiss;
INT m_BaseCritical;
// 体质对HP,力量对物攻,灵气对魔攻,体质对物防,定力对魔防,敏捷对闪避,敏捷对会
// 心,敏捷对命中的影响系数
FLOAT m_Con_HP_Pram;
FLOAT m_Str_PhyAttack_Pram;
FLOAT m_Spr_MgcAttack_Pram;
FLOAT m_Con_PhyDefence_Pram;
FLOAT m_Int_MgcDefence_Pram;
FLOAT m_Dex_Miss_Pram;
FLOAT m_Dex_Critical_Pram;
FLOAT m_Dex_Hit_Pram;
// 等级对HP、物攻、魔攻、物防、魔防、闪避、会心、命中的影响系数
FLOAT m_Level_HP_Pram;
FLOAT m_Level_PhyAttack_Pram;
FLOAT m_Level_MgcAttack_Pram;
FLOAT m_Level_PhyDefence_Pram;
FLOAT m_Level_MgcDefence_Pram;
FLOAT m_Level_Miss_Pram;
FLOAT m_Level_Critical_Pram;
FLOAT m_Level_Hit_Pram;
};
#endif | 25.431818 | 66 | 0.56479 |
239e4c1536cb97770e3f7bd276cdf180b5998dba | 12,895 | h | C | aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/SourceTableFeatureDetails.h | grujicbr/aws-sdk-cpp | bdd43c178042f09c6739645e3f6cd17822a7c35c | [
"Apache-2.0"
] | 1 | 2020-03-11T05:36:20.000Z | 2020-03-11T05:36:20.000Z | aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/SourceTableFeatureDetails.h | novaquark/aws-sdk-cpp | a0969508545bec9ae2864c9e1e2bb9aff109f90c | [
"Apache-2.0"
] | 18 | 2016-05-23T12:12:08.000Z | 2019-09-30T16:52:02.000Z | aws-cpp-sdk-dynamodb/include/aws/dynamodb/model/SourceTableFeatureDetails.h | novaquark/aws-sdk-cpp | a0969508545bec9ae2864c9e1e2bb9aff109f90c | [
"Apache-2.0"
] | 1 | 2019-06-09T10:20:10.000Z | 2019-06-09T10:20:10.000Z | /*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/dynamodb/DynamoDB_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/dynamodb/model/StreamSpecification.h>
#include <aws/dynamodb/model/TimeToLiveDescription.h>
#include <aws/dynamodb/model/SSEDescription.h>
#include <aws/dynamodb/model/LocalSecondaryIndexInfo.h>
#include <aws/dynamodb/model/GlobalSecondaryIndexInfo.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace DynamoDB
{
namespace Model
{
/**
* <p>Contains the details of the features enabled on the table when the backup was
* created. For example, LSIs, GSIs, streams, TTL. </p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/dynamodb-2012-08-10/SourceTableFeatureDetails">AWS
* API Reference</a></p>
*/
class AWS_DYNAMODB_API SourceTableFeatureDetails
{
public:
SourceTableFeatureDetails();
SourceTableFeatureDetails(Aws::Utils::Json::JsonView jsonValue);
SourceTableFeatureDetails& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline const Aws::Vector<LocalSecondaryIndexInfo>& GetLocalSecondaryIndexes() const{ return m_localSecondaryIndexes; }
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline bool LocalSecondaryIndexesHasBeenSet() const { return m_localSecondaryIndexesHasBeenSet; }
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline void SetLocalSecondaryIndexes(const Aws::Vector<LocalSecondaryIndexInfo>& value) { m_localSecondaryIndexesHasBeenSet = true; m_localSecondaryIndexes = value; }
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline void SetLocalSecondaryIndexes(Aws::Vector<LocalSecondaryIndexInfo>&& value) { m_localSecondaryIndexesHasBeenSet = true; m_localSecondaryIndexes = std::move(value); }
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline SourceTableFeatureDetails& WithLocalSecondaryIndexes(const Aws::Vector<LocalSecondaryIndexInfo>& value) { SetLocalSecondaryIndexes(value); return *this;}
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline SourceTableFeatureDetails& WithLocalSecondaryIndexes(Aws::Vector<LocalSecondaryIndexInfo>&& value) { SetLocalSecondaryIndexes(std::move(value)); return *this;}
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline SourceTableFeatureDetails& AddLocalSecondaryIndexes(const LocalSecondaryIndexInfo& value) { m_localSecondaryIndexesHasBeenSet = true; m_localSecondaryIndexes.push_back(value); return *this; }
/**
* <p>Represents the LSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema and Projection for the LSIs on the table at
* the time of backup. </p>
*/
inline SourceTableFeatureDetails& AddLocalSecondaryIndexes(LocalSecondaryIndexInfo&& value) { m_localSecondaryIndexesHasBeenSet = true; m_localSecondaryIndexes.push_back(std::move(value)); return *this; }
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline const Aws::Vector<GlobalSecondaryIndexInfo>& GetGlobalSecondaryIndexes() const{ return m_globalSecondaryIndexes; }
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline bool GlobalSecondaryIndexesHasBeenSet() const { return m_globalSecondaryIndexesHasBeenSet; }
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline void SetGlobalSecondaryIndexes(const Aws::Vector<GlobalSecondaryIndexInfo>& value) { m_globalSecondaryIndexesHasBeenSet = true; m_globalSecondaryIndexes = value; }
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline void SetGlobalSecondaryIndexes(Aws::Vector<GlobalSecondaryIndexInfo>&& value) { m_globalSecondaryIndexesHasBeenSet = true; m_globalSecondaryIndexes = std::move(value); }
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline SourceTableFeatureDetails& WithGlobalSecondaryIndexes(const Aws::Vector<GlobalSecondaryIndexInfo>& value) { SetGlobalSecondaryIndexes(value); return *this;}
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline SourceTableFeatureDetails& WithGlobalSecondaryIndexes(Aws::Vector<GlobalSecondaryIndexInfo>&& value) { SetGlobalSecondaryIndexes(std::move(value)); return *this;}
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline SourceTableFeatureDetails& AddGlobalSecondaryIndexes(const GlobalSecondaryIndexInfo& value) { m_globalSecondaryIndexesHasBeenSet = true; m_globalSecondaryIndexes.push_back(value); return *this; }
/**
* <p>Represents the GSI properties for the table when the backup was created. It
* includes the IndexName, KeySchema, Projection, and ProvisionedThroughput for the
* GSIs on the table at the time of backup. </p>
*/
inline SourceTableFeatureDetails& AddGlobalSecondaryIndexes(GlobalSecondaryIndexInfo&& value) { m_globalSecondaryIndexesHasBeenSet = true; m_globalSecondaryIndexes.push_back(std::move(value)); return *this; }
/**
* <p>Stream settings on the table when the backup was created.</p>
*/
inline const StreamSpecification& GetStreamDescription() const{ return m_streamDescription; }
/**
* <p>Stream settings on the table when the backup was created.</p>
*/
inline bool StreamDescriptionHasBeenSet() const { return m_streamDescriptionHasBeenSet; }
/**
* <p>Stream settings on the table when the backup was created.</p>
*/
inline void SetStreamDescription(const StreamSpecification& value) { m_streamDescriptionHasBeenSet = true; m_streamDescription = value; }
/**
* <p>Stream settings on the table when the backup was created.</p>
*/
inline void SetStreamDescription(StreamSpecification&& value) { m_streamDescriptionHasBeenSet = true; m_streamDescription = std::move(value); }
/**
* <p>Stream settings on the table when the backup was created.</p>
*/
inline SourceTableFeatureDetails& WithStreamDescription(const StreamSpecification& value) { SetStreamDescription(value); return *this;}
/**
* <p>Stream settings on the table when the backup was created.</p>
*/
inline SourceTableFeatureDetails& WithStreamDescription(StreamSpecification&& value) { SetStreamDescription(std::move(value)); return *this;}
/**
* <p>Time to Live settings on the table when the backup was created.</p>
*/
inline const TimeToLiveDescription& GetTimeToLiveDescription() const{ return m_timeToLiveDescription; }
/**
* <p>Time to Live settings on the table when the backup was created.</p>
*/
inline bool TimeToLiveDescriptionHasBeenSet() const { return m_timeToLiveDescriptionHasBeenSet; }
/**
* <p>Time to Live settings on the table when the backup was created.</p>
*/
inline void SetTimeToLiveDescription(const TimeToLiveDescription& value) { m_timeToLiveDescriptionHasBeenSet = true; m_timeToLiveDescription = value; }
/**
* <p>Time to Live settings on the table when the backup was created.</p>
*/
inline void SetTimeToLiveDescription(TimeToLiveDescription&& value) { m_timeToLiveDescriptionHasBeenSet = true; m_timeToLiveDescription = std::move(value); }
/**
* <p>Time to Live settings on the table when the backup was created.</p>
*/
inline SourceTableFeatureDetails& WithTimeToLiveDescription(const TimeToLiveDescription& value) { SetTimeToLiveDescription(value); return *this;}
/**
* <p>Time to Live settings on the table when the backup was created.</p>
*/
inline SourceTableFeatureDetails& WithTimeToLiveDescription(TimeToLiveDescription&& value) { SetTimeToLiveDescription(std::move(value)); return *this;}
/**
* <p>The description of the server-side encryption status on the table when the
* backup was created.</p>
*/
inline const SSEDescription& GetSSEDescription() const{ return m_sSEDescription; }
/**
* <p>The description of the server-side encryption status on the table when the
* backup was created.</p>
*/
inline bool SSEDescriptionHasBeenSet() const { return m_sSEDescriptionHasBeenSet; }
/**
* <p>The description of the server-side encryption status on the table when the
* backup was created.</p>
*/
inline void SetSSEDescription(const SSEDescription& value) { m_sSEDescriptionHasBeenSet = true; m_sSEDescription = value; }
/**
* <p>The description of the server-side encryption status on the table when the
* backup was created.</p>
*/
inline void SetSSEDescription(SSEDescription&& value) { m_sSEDescriptionHasBeenSet = true; m_sSEDescription = std::move(value); }
/**
* <p>The description of the server-side encryption status on the table when the
* backup was created.</p>
*/
inline SourceTableFeatureDetails& WithSSEDescription(const SSEDescription& value) { SetSSEDescription(value); return *this;}
/**
* <p>The description of the server-side encryption status on the table when the
* backup was created.</p>
*/
inline SourceTableFeatureDetails& WithSSEDescription(SSEDescription&& value) { SetSSEDescription(std::move(value)); return *this;}
private:
Aws::Vector<LocalSecondaryIndexInfo> m_localSecondaryIndexes;
bool m_localSecondaryIndexesHasBeenSet;
Aws::Vector<GlobalSecondaryIndexInfo> m_globalSecondaryIndexes;
bool m_globalSecondaryIndexesHasBeenSet;
StreamSpecification m_streamDescription;
bool m_streamDescriptionHasBeenSet;
TimeToLiveDescription m_timeToLiveDescription;
bool m_timeToLiveDescriptionHasBeenSet;
SSEDescription m_sSEDescription;
bool m_sSEDescriptionHasBeenSet;
};
} // namespace Model
} // namespace DynamoDB
} // namespace Aws
| 44.619377 | 212 | 0.727801 |
239e7ec76cfe4598b41ff9aa78c54c69d40e9a94 | 3,274 | h | C | src/camera.h | predmach/Realtime-Photometric-Stereo | 9e7b3c57eede45ea0ff955625bf9cbd4fbcf090b | [
"MIT"
] | 39 | 2015-01-21T16:51:59.000Z | 2022-03-31T10:19:34.000Z | src/camera.h | predmach/Realtime-Photometric-Stereo | 9e7b3c57eede45ea0ff955625bf9cbd4fbcf090b | [
"MIT"
] | null | null | null | src/camera.h | predmach/Realtime-Photometric-Stereo | 9e7b3c57eede45ea0ff955625bf9cbd4fbcf090b | [
"MIT"
] | 18 | 2016-01-20T07:09:16.000Z | 2021-07-03T03:27:52.000Z | #ifndef CAMERA_H
#define CAMERA_H
#define STROBE_0_CNT 0x1500
#define STROBE_1_CNT 0x1504
#define STROBE_2_CNT 0x1508
#define STROBE_3_CNT 0x150C
#define STROBE_CTRL_INQ 0x1300
#define STROBE_0_INQ 0x1400
#define STROBE_1_INQ 0x1404
#define STROBE_2_INQ 0x1408
#define STROBE_3_INQ 0x140C
#define PIO_DIRECTION 0x11F8
#define INITIALIZE 0x000
#include <iostream>
#include <vector>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <QObject>
#include <QTimer>
#include <QtCore/QTime>
#include <QCoreApplication>
#include "strobe_reg.h"
#include "pio_dir_reg.h"
#include "cam_init_reg.h"
#include <dc1394/dc1394.h>
#include "config.h"
class Camera : public QObject {
Q_OBJECT
public:
Camera();
~Camera();
bool open(int deviceIdx);
void stop();
void reset();
void setTestMode(bool toggle);
void printStatus();
int avgImageIntensity();
bool inTestMode();
int height, width;
public slots:
void start();
private slots:
void captureFrame();
signals:
void newCamFrame(cv::Mat frame);
void newCroppedFrame(cv::Mat frame);
void stopped();
private:
int numCams;
int numDMABuffers;
dc1394camera_t *camera;
dc1394_t *camDict;
dc1394camera_list_t *camList;
dc1394error_t error;
QTimer *eventLoopTimer;
std::vector<cv::Mat> testImages;
cv::Mat ambientImage;
bool testMode;
int imgIdx;
int avgImgIntensity;
int FRAME_RATE;
int camFrameWidth, camFrameHeight;
/* undistortion matrices */
cv::Mat K, dist;
cv::Mat *map1LUT, *map2LUT;
/* typedefs for writing in register */
typedef strobe_cnt_reg<uint32_t> strobe_cnt_reg32;
typedef strobe_inq_reg<uint32_t> strobe_inq_reg32;
typedef strobe_ctrl_inq_reg<uint32_t> strobe_ctrl_inq_reg32;
typedef pio_dir_reg<uint32_t> pio_dir_reg32;
typedef cam_ini_reg<uint32_t> cam_init_reg32;
void captureAmbientImage();
void resetCameraRegister();
void startResetPulse();
void stopResetPulse();
void startClockPulse();
void stopClockPulse();
void initUndistLUT();
void undistortLUT(cv::InputArray source, cv::OutputArray dest);
/** Get the control register value of the camera at given offset */
uint32_t readRegisterContent(uint64_t offset);
/** Set control register value of camera at given offset to given value */
void writeRegisterContent(uint64_t offset, uint32_t value);
/** Set first two GPIO pins as ouput. PIO_DIRECTION register 0x11F8. Bit 0-3
* represent GPIO0-GPIO3. 0 input, 1 output */
void configureOutputPins();
/** Set clock delay. STROBE_0_CNT register 0x1500 */
void configureClockDelay();
/** Set clock duration. STROBE_0_CNT register 0x1500 */
void configureClockDuration();
/** Set reset delay. STROBE_1_CNT register 0x1504 */
void configureResetDelay();
/** Set reset duration. STROBE_1_CNT register 0x1504 */
void configureResetDuration();
/** Closing camera and cleaning up */
void cleanup(dc1394camera_t *camera);
/* Own implementation of sleep, processing all qt events while sleeping/waiting */
void msleep(unsigned long msecs);
};
#endif
| 27.745763 | 86 | 0.711973 |
239f79b41a243af62ac5c6916716f95c98cdd369 | 2,243 | h | C | challenges/OUTLAW/pov_2/cgc_pov_2.h | pingjuiliao/cb-multios | 64ededd0b87030eda7c40c4388a4ad8283712d8e | [
"MIT"
] | 473 | 2016-08-01T12:48:16.000Z | 2022-03-09T18:13:14.000Z | challenges/OUTLAW/pov_2/cgc_pov_2.h | pingjuiliao/cb-multios | 64ededd0b87030eda7c40c4388a4ad8283712d8e | [
"MIT"
] | 71 | 2016-08-01T03:33:44.000Z | 2022-03-09T18:37:04.000Z | challenges/OUTLAW/pov_2/cgc_pov_2.h | pingjuiliao/cb-multios | 64ededd0b87030eda7c40c4388a4ad8283712d8e | [
"MIT"
] | 121 | 2016-08-01T04:07:53.000Z | 2022-03-07T11:08:09.000Z | /*
* Copyright (C) Narf Industries <info@narfindustries.com>
*
* 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
// #define DEBUG 1
#include "libpov.h"
#include "cgc_pov_debug.h"
// common things
#define SUCCESS 0
#define TRUE 1
#define FALSE 0
#define STDIN 0
#define STDOUT 1
#define INT_MAX 0x7FFFFFFF
#define INT_MIN (-2147483647 - 1)
#define UINT_MAX (4294967295)
#define UINT_MIN (0)
#define MAX_UINT8 0xff
#define MAX_UINT32 0xffffffff
#define PIPE_RECV STDIN
#define PIPE_SEND STDOUT
#define CHK_SUCCESS(code, args...) if (SUCCESS != (ret = code)) { ERR(args); }
#define SZ_PAGE 0x1000 // 4096
#define REGNUM_EAX 0
#define DST_CLIENT 3
#define DST_SERVER 5
#define DST_EXIT 0xdeadbeef
#define OP_ADD 0
#define OP_SUB 1
#define OP_MUL 2
#define OP_DIV 3
#define OP_ACK 4
#define OP_MOD 61
/////////////////////
typedef struct msg {
uint32_t dst; // 4B
uint32_t x; // 8B
uint32_t y; // 12B
uint8_t op; // 13B
uint8_t nmb; // 14B
uint8_t pad[2]; // 16B
uint64_t result; // 24B
} msg;
/**
* The main exploit logic.
* Call helper functions to leak auth_token.
* Use auth_token to exercise vuln #2.
*/
int main(int cgc_argc, char *cgc_argv[]);
| 26.388235 | 78 | 0.723139 |