text stringlengths 4 6.14k |
|---|
// NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// Chrome Verified Access API (verifiedaccess/v1)
// Description:
// API for Verified Access chrome extension to provide credential verification
// for chrome devices connecting to an enterprise network
// Documentation:
// https://developers.google.com/chrome/verified-access
#if SWIFT_PACKAGE || GTLR_USE_MODULAR_IMPORT
@import GoogleAPIClientForRESTCore;
#elif GTLR_BUILT_AS_FRAMEWORK
#import "GTLR/GTLRObject.h"
#else
#import "GTLRObject.h"
#endif
#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif
@class GTLRVerifiedaccess_SignedData;
// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
NS_ASSUME_NONNULL_BEGIN
/**
* Result message for VerifiedAccess.CreateChallenge.
*/
@interface GTLRVerifiedaccess_Challenge : GTLRObject
/**
* Challenge generated with the old signing key (this will only be present
* during key rotation)
*/
@property(nonatomic, strong, nullable) GTLRVerifiedaccess_SignedData *alternativeChallenge;
/** Generated challenge */
@property(nonatomic, strong, nullable) GTLRVerifiedaccess_SignedData *challenge;
@end
/**
* A generic empty message that you can re-use to avoid defining duplicated
* empty messages in your APIs. A typical example is to use it as the request
* or the response type of an API method. For instance: service Foo { rpc
* Bar(google.protobuf.Empty) returns (google.protobuf.Empty); } The JSON
* representation for `Empty` is empty JSON object `{}`.
*/
@interface GTLRVerifiedaccess_Empty : GTLRObject
@end
/**
* The wrapper message of any data and its signature.
*/
@interface GTLRVerifiedaccess_SignedData : GTLRObject
/**
* The data to be signed.
*
* Contains encoded binary data; GTLRBase64 can encode/decode (probably
* web-safe format).
*/
@property(nonatomic, copy, nullable) NSString *data;
/**
* The signature of the data field.
*
* Contains encoded binary data; GTLRBase64 can encode/decode (probably
* web-safe format).
*/
@property(nonatomic, copy, nullable) NSString *signature;
@end
/**
* signed ChallengeResponse
*/
@interface GTLRVerifiedaccess_VerifyChallengeResponseRequest : GTLRObject
/** The generated response to the challenge */
@property(nonatomic, strong, nullable) GTLRVerifiedaccess_SignedData *challengeResponse;
/**
* Service can optionally provide identity information about the device or user
* associated with the key. For an EMK, this value is the enrolled domain. For
* an EUK, this value is the user's email address. If present, this value will
* be checked against contents of the response, and verification will fail if
* there is no match.
*/
@property(nonatomic, copy, nullable) NSString *expectedIdentity;
@end
/**
* Result message for VerifiedAccess.VerifyChallengeResponse.
*/
@interface GTLRVerifiedaccess_VerifyChallengeResponseResult : GTLRObject
/**
* Device enrollment id is returned in this field (for the machine response
* only).
*/
@property(nonatomic, copy, nullable) NSString *deviceEnrollmentId;
/**
* Device permanent id is returned in this field (for the machine response
* only).
*/
@property(nonatomic, copy, nullable) NSString *devicePermanentId;
/**
* Certificate Signing Request (in the SPKAC format, base64 encoded) is
* returned in this field. This field will be set only if device has included
* CSR in its challenge response. (the option to include CSR is now available
* for both user and machine responses)
*/
@property(nonatomic, copy, nullable) NSString *signedPublicKeyAndChallenge;
/**
* For EMCert check, device permanent id is returned here. For EUCert check,
* signed_public_key_and_challenge [base64 encoded] is returned if present,
* otherwise empty string is returned. This field is deprecated, please use
* device_permanent_id or signed_public_key_and_challenge fields.
*/
@property(nonatomic, copy, nullable) NSString *verificationOutput;
@end
NS_ASSUME_NONNULL_END
#pragma clang diagnostic pop
|
#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#include<fstream>
using namespace std;
#define BUFFERSIZE 81 |
// Copyright 2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef ELANG_VM_OBJECT_FACTORY_H_
#define ELANG_VM_OBJECT_FACTORY_H_
#include <array>
#include <unordered_map>
#include <string>
#include "base/basictypes.h"
#include "base/strings/string_piece.h"
namespace elang {
namespace vm {
class Factory;
namespace impl {
struct ArrayType;
struct Class;
struct Object;
struct String;
struct Type;
template <typename T>
struct Vector;
struct VectorBase;
//////////////////////////////////////////////////////////////////////
//
// ObjectFactory
//
class ObjectFactory final {
public:
~ObjectFactory();
Class* char_class() const { return char_class_; }
Class* class_meta_class() const { return class_meta_class_; }
Factory* factory() const { return factory_; }
Class* string_class() const { return string_class_; }
String* NewString(base::StringPiece16 data);
template <typename T>
Vector<T>* NewVector(Type* element_type, size_t size) {
return static_cast<Vector<T>*>(NewVectorBase(element_type, size));
}
private:
friend class Factory;
explicit ObjectFactory(Factory* factory);
ArrayType* NewArrayType(Type* element_type, int rank);
VectorBase* NewVectorBase(Type* element_type, size_t size);
Factory* const factory_;
std::array<std::unordered_map<Type*, ArrayType*>, 7> array_types_;
Class* const object_class_;
Class* const class_meta_class_;
Class* const array_meta_class_;
Class* const char_class_;
ArrayType* const char_vector_type_;
Class* const string_class_;
DISALLOW_COPY_AND_ASSIGN(ObjectFactory);
};
} // namespace impl
} // namespace vm
} // namespace elang
#endif // ELANG_VM_OBJECT_FACTORY_H_
|
#include <sys/time.h>
#include <getopt.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <bp_util.h>
size_t start, stop;
//
// Time sampling
//
size_t bp_sample_time(void)
{
struct timeval tv;
gettimeofday(&tv, NULL);
return tv.tv_usec + tv.tv_sec * 1000000;
}
size_t bp_start(void)
{
start = bp_sample_time();
return start;
}
size_t bp_stop(void)
{
stop = bp_sample_time();
return stop;
}
double bp_elapsed(void)
{
return (stop-start)/(double)1000000.0;
}
void bp_print(const char* tool)
{
printf("Ran %s elapsed-time: %lf\n", tool, bp_elapsed());
}
//
// Argument parsing
//
static void parse_size(bp_arguments_type* args, char* arg)
{
args->nsizes = 0;
while (1) {
char *tail;
int next;
while ('*'==*arg) {
arg++;
}
if (*arg == 0) {
break;
}
next = strtol (arg, &tail, 0);
arg = tail;
args->sizes[args->nsizes] = next;
args->nsizes++;
}
}
bp_arguments_type bp_parse_args(int argc, char** argv)
{
bp_arguments_type args;
args.has_unknown = 0;
args.has_error = 0;
static int verbose_flag;
static int visualize_flag;
while (1)
{
static struct option long_options[] = {
{"verbose", no_argument, &verbose_flag, 1},
{"visualize", no_argument, &visualize_flag, 1},
{"size", required_argument, 0, 's'},
{0, 0, 0, 0}
};
int option_index = 0; // getopt_long stores option index here
int c = getopt_long(argc, argv, "s:", long_options, &option_index);
if (c == -1) {
break;
}
switch (c) {
case 0:
if (long_options[option_index].flag != 0) {
break;
}
break;
case 's':
parse_size(&args, optarg);
break;
case '?':
args.has_unknown = 1;
break;
default:
args.has_error = 1;
break;
}
}
args.verbose = verbose_flag;
args.visualize = visualize_flag;
return args;
}
//
// Wrap everything up in this thing...
//
bp_util_type bp_util_create(int argc, char** argv, int nsizes)
{
bp_util_type util = {
.args = bp_parse_args(argc, argv),
.timer_start = bp_start,
.timer_stop = bp_stop,
.elapsed = bp_elapsed,
.print = bp_print
};
if ((nsizes < 0) || (nsizes > 10)) {
printf("bp_util_create(..., nsizes >10 or <0) this is no go.\n");
util.args.has_error = 1;
} else if (util.args.has_unknown || util.args.has_error || nsizes != util.args.nsizes) {
printf("Invalid arguments, check usage\n");
char size_descr[100];
strcpy(size_descr, "");
for(int i=0; i<nsizes; ++i) {
strcat(size_descr, "NUMBER");
if (i<nsizes-1) {
strcat(size_descr, "*");
}
}
printf("usage: %s --size=%s [--verbose]\n", argv[0], size_descr);
util.args.has_error = 1;
}
return util;
}
|
/*
* Copyright 2016 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* GCC compatible wrappers around clang attributes.
*
* @author Dominik Gabi
*/
#ifndef FOLLY_BASE_ATTRIBUTES_H_
#define FOLLY_BASE_ATTRIBUTES_H_
#ifndef __has_cpp_attribute
#define FOLLY_HAS_CPP_ATTRIBUTE(x) 0
#else
#define FOLLY_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
#endif
#ifndef __has_extension
#define FOLLY_HAS_EXTENSION(x) 0
#else
#define FOLLY_HAS_EXTENSION(x) __has_extension(x)
#endif
/**
* Fallthrough to indicate that `break` was left out on purpose in a switch
* statement, e.g.
*
* switch (n) {
* case 22:
* case 33: // no warning: no statements between case labels
* f();
* case 44: // warning: unannotated fall-through
* g();
* FOLLY_FALLTHROUGH; // no warning: annotated fall-through
* }
*/
#if FOLLY_HAS_CPP_ATTRIBUTE(clang::fallthrough)
#define FOLLY_FALLTHROUGH [[clang::fallthrough]]
#else
#define FOLLY_FALLTHROUGH
#endif
/**
* Nullable indicates that a return value or a parameter may be a `nullptr`,
* e.g.
*
* int* FOLLY_NULLABLE foo(int* a, int* FOLLY_NULLABLE b) {
* if (*a > 0) { // safe dereference
* return nullptr;
* }
* if (*b < 0) { // unsafe dereference
* return *a;
* }
* if (b != nullptr && *b == 1) { // safe checked dereference
* return new int(1);
* }
* return nullptr;
* }
*/
#if FOLLY_HAS_EXTENSION(nullability)
#define FOLLY_NULLABLE _Nullable
#else
#define FOLLY_NULLABLE
#endif
#endif /* FOLLY_BASE_ATTRIBUTES_H_ */
|
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
#ifndef __dj_include_ctype_h_
#define __dj_include_ctype_h_
#ifdef __cplusplus
extern "C" {
#endif
#define _UPPER 0x0001
#define _LOWER 0x0002
#define _DIGIT 0x0004
#define _SPACE 0x0008 /* HT LF VT FF CR SP */
#define _PUNCT 0x0010
#define _CONTROL 0x0020
#define _BLANK 0x0040 /* this is SP only, not SP and HT as in C99 */
#define _HEX 0x0080
#define _LEADBYTE 0x8000
#define _ALPHA 0x0103
int isalnum(int c);
int isalpha(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int isxdigit(int c);
int tolower(int c);
int toupper(int c);
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#include <inlines/ctype.ha>
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
int isascii(int c);
int toascii(int c);
#ifndef __dj_ENFORCE_FUNCTION_CALLS
#include <inlines/ctype.hd>
#endif /* !__dj_ENFORCE_FUNCTION_CALLS */
#ifdef __cplusplus
}
#endif
#endif /* !__dj_include_ctype_h_ */
|
/*
* Copyright 2010-2016 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/elasticloadbalancingv2/ElasticLoadBalancingv2_EXPORTS.h>
#include <aws/elasticloadbalancingv2/ElasticLoadBalancingv2Request.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/elasticloadbalancingv2/model/RuleCondition.h>
#include <aws/elasticloadbalancingv2/model/Action.h>
namespace Aws
{
namespace ElasticLoadBalancingv2
{
namespace Model
{
/**
* <p>Contains the parameters for ModifyRules.</p>
*/
class AWS_ELASTICLOADBALANCINGV2_API ModifyRuleRequest : public ElasticLoadBalancingv2Request
{
public:
ModifyRuleRequest();
Aws::String SerializePayload() const override;
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline const Aws::String& GetRuleArn() const{ return m_ruleArn; }
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline void SetRuleArn(const Aws::String& value) { m_ruleArnHasBeenSet = true; m_ruleArn = value; }
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline void SetRuleArn(Aws::String&& value) { m_ruleArnHasBeenSet = true; m_ruleArn = value; }
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline void SetRuleArn(const char* value) { m_ruleArnHasBeenSet = true; m_ruleArn.assign(value); }
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline ModifyRuleRequest& WithRuleArn(const Aws::String& value) { SetRuleArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline ModifyRuleRequest& WithRuleArn(Aws::String&& value) { SetRuleArn(value); return *this;}
/**
* <p>The Amazon Resource Name (ARN) of the rule.</p>
*/
inline ModifyRuleRequest& WithRuleArn(const char* value) { SetRuleArn(value); return *this;}
/**
* <p>The conditions.</p>
*/
inline const Aws::Vector<RuleCondition>& GetConditions() const{ return m_conditions; }
/**
* <p>The conditions.</p>
*/
inline void SetConditions(const Aws::Vector<RuleCondition>& value) { m_conditionsHasBeenSet = true; m_conditions = value; }
/**
* <p>The conditions.</p>
*/
inline void SetConditions(Aws::Vector<RuleCondition>&& value) { m_conditionsHasBeenSet = true; m_conditions = value; }
/**
* <p>The conditions.</p>
*/
inline ModifyRuleRequest& WithConditions(const Aws::Vector<RuleCondition>& value) { SetConditions(value); return *this;}
/**
* <p>The conditions.</p>
*/
inline ModifyRuleRequest& WithConditions(Aws::Vector<RuleCondition>&& value) { SetConditions(value); return *this;}
/**
* <p>The conditions.</p>
*/
inline ModifyRuleRequest& AddConditions(const RuleCondition& value) { m_conditionsHasBeenSet = true; m_conditions.push_back(value); return *this; }
/**
* <p>The conditions.</p>
*/
inline ModifyRuleRequest& AddConditions(RuleCondition&& value) { m_conditionsHasBeenSet = true; m_conditions.push_back(value); return *this; }
/**
* <p>The actions.</p>
*/
inline const Aws::Vector<Action>& GetActions() const{ return m_actions; }
/**
* <p>The actions.</p>
*/
inline void SetActions(const Aws::Vector<Action>& value) { m_actionsHasBeenSet = true; m_actions = value; }
/**
* <p>The actions.</p>
*/
inline void SetActions(Aws::Vector<Action>&& value) { m_actionsHasBeenSet = true; m_actions = value; }
/**
* <p>The actions.</p>
*/
inline ModifyRuleRequest& WithActions(const Aws::Vector<Action>& value) { SetActions(value); return *this;}
/**
* <p>The actions.</p>
*/
inline ModifyRuleRequest& WithActions(Aws::Vector<Action>&& value) { SetActions(value); return *this;}
/**
* <p>The actions.</p>
*/
inline ModifyRuleRequest& AddActions(const Action& value) { m_actionsHasBeenSet = true; m_actions.push_back(value); return *this; }
/**
* <p>The actions.</p>
*/
inline ModifyRuleRequest& AddActions(Action&& value) { m_actionsHasBeenSet = true; m_actions.push_back(value); return *this; }
private:
Aws::String m_ruleArn;
bool m_ruleArnHasBeenSet;
Aws::Vector<RuleCondition> m_conditions;
bool m_conditionsHasBeenSet;
Aws::Vector<Action> m_actions;
bool m_actionsHasBeenSet;
};
} // namespace Model
} // namespace ElasticLoadBalancingv2
} // namespace Aws
|
//
// Copyright 2011 Jeff Verkoeyen
//
// 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>
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow* _window;
UINavigationController* _rootController;
}
@property (nonatomic, readwrite, retain) UIWindow* window;
@end
|
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "LYTLayoutFailingTestSnapshotRecorder.h" |
// Copyright 2022 The Google Research Authors.
//
// 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 INTENT_RECOGNITION_ANNOTATED_RECORDING_COLLECTION_UTILS_H_
#define INTENT_RECOGNITION_ANNOTATED_RECORDING_COLLECTION_UTILS_H_
#include <utility>
#include <vector>
#include "google/protobuf/duration.pb.h"
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "intent_recognition/annotated_recording_collection.pb.h"
namespace ambient_sensing {
inline constexpr absl::string_view kStringLabelMappingGroupDescriptor =
"string_label_mapping";
// Converts a google::protobuf::Duration into absl::Duration and checks
// whether the conversion was successful.
absl::Duration ConvertProtoToDuration(
const google::protobuf::Duration& duration_proto);
// Converts a absl::Duration into google::protobuf::Duration and checks
// whether the conversion was successful.
google::protobuf::Duration ConvertDurationToProto(
const absl::Duration duration);
// Returns true if AnnotationGroup type is GROUND_TRUTH.
bool IsGroundTruthGroup(const AnnotationGroup& group);
// Returns true if AnnotationGroup description is
// kStringLabelMappingGroupDescriptor.
bool IsStringLabelMappingGroup(const AnnotationGroup& group);
// Returns true if AnnotationGroup type is MODEL.
bool IsModelGroup(const AnnotationGroup& group);
// Returns true if AnnotationSequence type is TASK_DURATION.
bool IsTaskDurationSequence(const AnnotationSequence& sequence);
// Returns true if AnnotationSequence type is TAG.
bool IsTagSequence(const AnnotationSequence& sequence);
// Returns true if AnnotationSequence type is CLASS_LABEL.
bool IsClassLabelSequence(const AnnotationSequence& sequence);
// Returns true if AnnotationSequence type is STAGED_MODEL_GENERATED.
bool IsStagedModelSequence(const AnnotationSequence& sequence);
// Returns true if AnnotationSequence type is HUMAN_LABEL.
bool IsHumanLabelSequence(const AnnotationSequence& sequence);
} // namespace ambient_sensing
#endif // INTENT_RECOGNITION_ANNOTATED_RECORDING_COLLECTION_UTILS_H_
|
/*---------------------------------------------------------------------------
knnclass_mex.c: MEX-file code K-NN classifier.
Compile: knnclass_mex.c
Synopsis:
[tst_labels,dfce] = knnclass_mex(tst_data,trn_data,trn_labels, k)
Input:
tst_data [dim x n_tst] data to be classified.
trn_data [dim x n_trn] training data.
trn_labels [ 1 x n_trn] labels of training data.
k [int] number of neighbours.
Output:
tst_labels [1 x n_tst] estimated labels of testing data.
About: (c) Statistical Pattern Recognition Toolbox, (C) 1999-2003,
Written by Vojtech Franc and Vaclav Hlavac,
<a href="http://www.cvut.cz">Czech Technical University Prague</a>,
<a href="http://www.feld.cvut.cz">Faculty of Electrical engineering</a>,
<a href="http://cmp.felk.cvut.cz">Center for Machine Perception</a>
Modifications:
9-may-2003, VF
18-sep-2002, V.Franc
-------------------------------------------------------------------- */
#include "mex.h"
#include "matrix.h"
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <limits.h>
#define MAX_INF INT_MAX
#define MAX(A,B) (((A) > (B)) ? (A) : (B) )
#define MIN(A,B) (((A) < (B)) ? (A) : (B) )
/* ==============================================================
Main MEX function - interface to Matlab.
============================================================== */
void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray*prhs[] )
{
long n_tst, n_trn, k, i, j, l, inx, dim;
double *tst_data, *trn_data;
double *tst_labels, *trn_labels;
double *dist, adist, max_dist;
double a, b;
long max_inx, best_count, best_label, count, *max_labels;
/* -- gets input arguments --------------------------- */
tst_data = mxGetPr( prhs[0]);
trn_data = mxGetPr(prhs[1]);
dim = mxGetM(prhs[0]); /* data dimension */
n_tst = mxGetN(prhs[0]); /* number of data */
n_trn = mxGetN(prhs[1]); /* number of data */
trn_labels = mxGetPr(prhs[2]);
if( dim != mxGetM( prhs[1] )) {
mexErrMsgTxt("Dimension of training and testing data differs.");
}
if( nrhs != 4 ) {
mexErrMsgTxt("Incorrect number of input arguments.");
}
k = mxGetScalar(prhs[3]);
/* output labels*/
plhs[0] = mxCreateDoubleMatrix(1,n_tst,mxREAL);
tst_labels = mxGetPr(plhs[0] );
/*--------------------------*/
if( (dist = mxCalloc(n_trn, sizeof(double))) == NULL) {
mexErrMsgTxt("Not enough memory for error cache.");
}
if( (max_labels = (long*) mxCalloc(k, sizeof(long))) == NULL) {
mexErrMsgTxt("Not enough memory for error cache.");
}
for( i=0; i < n_tst; i++ ) {
for( j=0; j < n_trn; j++ ) {
adist = 0;
for( l=0; l < dim; l++ ) {
a = *(tst_data+(i*dim)+l);
b = *(trn_data+(j*dim)+l);
adist += a*a - 2*a*b + b*b;
}
dist[j] = sqrt(adist);
}
for( l=0; l < k; l++) {
max_dist=MAX_INF;
for( j=0; j < n_trn; j++ ) {
if( max_dist > dist[j] ) {
max_inx = j;
max_dist = dist[j];
}
}
dist[ max_inx ] = MAX_INF;
max_labels[l] = trn_labels[max_inx];
}
best_count=0;
for( l=0; l < k; l++) {
count = 0;
for( j=0; j < k; j++) {
if( max_labels[l] == max_labels[j] ) count++;
}
if( count > best_count ) {
best_count = count;
best_label = max_labels[l];
}
}
tst_labels[i] = best_label;
}
mxFree( dist ); /* free mem*/
mxFree( max_labels ); /* free mem*/
}
|
/*
ozdevguy | C General Libraries
Copyright 2016 Bobby Crawford (ozdevguy)
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.
queue.c
========================================================================
*/
/*
<-CUSTOM HIGH-SPEED QUEUE->
This queue is implemented as an array in order to take advantage of memory locality/caching.
Written by Bobby Crawford
*/
static void int_queue_resize(queue* q){
//New queue size.
size_t new_size = q->size * 2, i, j = 0;
//Create a new, larger queue.
byte** entries = allocate(q->ctx, sizeof(size_t) * new_size);
//Copy over the data.
for(i = q->front; j < q->size; i = ((i + 1) % q->size)){
entries[j] = q->entries[i];
j++;
}
q->front = 0;
q->back = q->size;
q->size = new_size;
//Free previously used memory.
destroy(q->ctx, q->entries);
//Reassign the pointer.
q->entries = entries;
}
void _queue_delete(queue* q){
if(!q)
return;
destroy(q->ctx, q->entries);
destroy(q->ctx, q);
}
queue* _queue_new(standard_library_context* ctx, size_t start_size){
if(!ctx || !start_size)
return 0;
//Create a new object.
queue* q = allocate(ctx, sizeof(queue));
//Create a new queue array.
q->entries = allocate(ctx, sizeof(size_t) * start_size);
q->size = start_size;
q->ctx = ctx;
return q;
}
void _queue_reset(queue* q){
destroy(q->ctx, q->entries);
q->entries = allocate(q->ctx, q->size);
q->used = 0;
q->front = 0;
q->back = 0;
}
void* _queue_dequeue(queue* q){
void* entry;
if(!q)
return 0;
size_t frontpos = q->front;
if(!q->used)
return 0;
if(frontpos == q->size - 1)
frontpos = 0;
else
frontpos++;
entry = (void*)(q->entries[q->front]);
q->front = frontpos;
q->used--;
return entry;
}
void* _queue_peek(queue* q){
void* entry;
if(!q)
return 0;
if(!q->used)
return 0;
entry = (void*)(q->entries[q->front]);
return entry;
}
void _queue_enqueue(queue* q, void* data){
if(!q)
return;
size_t backpos;
if(q->used == q->size)
int_queue_resize(q);
if(q->back == q->size - 1)
backpos = 0;
else
backpos = q->back + 1;
q->entries[q->back] = data;
q->back = backpos;
q->used++;
}
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2017 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 Simon Grätzer
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGOD_VOC_BASE_API_DATABASE_H
#define ARANGOD_VOC_BASE_API_DATABASE_H 1
#include <velocypack/Builder.h>
#include <velocypack/Slice.h>
#include "Basics/Result.h"
struct TRI_vocbase_t;
namespace arangodb {
namespace methods {
/// Common code for the db._database(),
struct Databases {
static TRI_vocbase_t* lookup(std::string const& dbname);
static std::vector<std::string> list(std::string const& user = "");
static arangodb::Result info(TRI_vocbase_t* vocbase,
arangodb::velocypack::Builder& result);
static arangodb::Result create(std::string const& dbName,
arangodb::velocypack::Slice const& users,
arangodb::velocypack::Slice const& options);
static arangodb::Result drop(TRI_vocbase_t* systemVocbase,
std::string const&);
};
}
}
#endif
|
/****************************************************************************
*
* Copyright 2020 Samsung Electronics All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the License.
*
****************************************************************************/
#ifndef _WIFI_MANAGER_STATE_H__
#define _WIFI_MANAGER_STATE_H__
/* State Definition */
enum _wifimgr_state {
WIFIMGR_UNINITIALIZED,
WIFIMGR_STA_DISCONNECTED,
WIFIMGR_STA_DISCONNECTING,
WIFIMGR_STA_CONNECTING,
WIFIMGR_STA_CONNECTED,
WIFIMGR_STA_RECONNECT, // 5
WIFIMGR_STA_RECONNECTING,
WIFIMGR_STA_CONNECT_CANCEL,
WIFIMGR_SOFTAP,
WIFIMGR_SCANNING,
WIFIMGR_NONE, // it is used for prev state only
WIFIMGR_STATE_MAX,
};
typedef enum _wifimgr_state wifimgr_state_e;
#endif // _WIFI_MANAGER_STATE_H__
|
/*!
* Copyright (c) 2017 by Contributors
* \file cuda/extern.h
* \brief CUDA schedule for extern followed by injective operations
*/
#ifndef TOPI_CUDA_EXTERN_H_
#define TOPI_CUDA_EXTERN_H_
#include "topi/tags.h"
#include "topi/detail/fuse.h"
#include "tvm/tvm.h"
#include "tvm/build_module.h"
namespace topi {
using namespace tvm;
namespace cuda {
/*!
* \brief Schedule a given operation representing one of the outputs of an
* external function which is followed by injective operations.
*
* \param target The target to generate a schedule for.
* \param op The operation representing the output followed by injective operations.
* \param sch The schedule to apply this scheduling to
*
* \return The schedule given by sch
*/
inline Schedule ScheduleOutputForExtern(Target target, Operation op, Schedule sch) {
auto x = op.output(0);
auto fused = detail::Fuse(sch[x], sch[x]->op.as<ComputeOpNode>()->axis);
auto num_thread = target->max_num_threads;
IterVar bx, tx;
sch[x].split(fused, num_thread, &bx, &tx);
sch[x].bind(bx, tvm::thread_axis(Range(), "blockIdx.x"));
sch[x].bind(tx, tvm::thread_axis(Range(), "threadIdx.x"));
return sch;
}
/*!
* \brief Schedule an extern op followed by injective operations.
* For example, cudnn kernel + bias add + relu
*
* \param target The target to generate a schedule for.
* \param outs The output tensors.
*
* \return A schedule for the op.
*/
inline Schedule schedule_extern(const Target& target, Array<Tensor> outs) {
Array<Operation> out_ops;
for (auto t : outs) {
out_ops.push_back(t->op);
}
auto s = create_schedule(out_ops);
tvm::schedule::AutoInlineInjective(s);
for (auto out : outs) {
if (out->op->derived_from<ExternOpNode>()) {
continue;
}
ScheduleOutputForExtern(target, out->op, s);
}
return s;
}
} // namespace cuda
} // namespace topi
#endif // TOPI_CUDA_EXTERN_H_
|
#ifndef FORMAT_H
#define FORMAT_H
typedef unsigned char byte;
typedef unsigned int u8;
#define NUM_ELEMS(x) (sizeof(x) / sizeof((x)[0]))
#define INT2HEX(i) (i <= 9 : '0' + i ? 'A' - 10 + i)
//@input 303130323537
//@output "303130323537"
void dec2string(u8 in, byte * out);
//@input "303130323537"
//@output 303130323537
void string2dec(byte * in, u8 * out);
//@input 0x303130323537
//@output "303130323537"
void hex2string(u8 in, byte * out);
//@input "303130323537"
//@output 0x303130323537
void string2hex(byte * in, u8 * out);
//@input byte[]={"30", "31", "30", "32", "35", "37"}
//@output byte[]={0x30, 0x31, 0x30, 0x32, 0x35, 0x37}
void stringArr2hexArr(byte in[][40], u8 * out, u8 inLen);
//@input byte[]={0x30, 0x31, 0x30, 0x32, 0x35, 0x37}
//@output byte[]={"30", "31", "30", "32", "35", "37"}
void hexArr2stringArr(u8 * in, byte out[][40], u8 inLen);
//@input byte[]="Monday 1987"
//@output byte[]="Monday" && u8 = 1987
void splitStringBySpace(byte * in, byte * format, byte * strings, u8 * decimals);
//@input u8=0x3031
//@output * byte[]={"30", "31"}
void hex2stringArr(u8 in,byte out[][40]);
//@input "303130323537"
//@output "010257"
void bcdstring2string(byte in[], byte out[]);
#endif //FORMAT_H
|
#ifndef MESSAGE_DECODER_H
#define MESSAGE_DECODER_H
#include "Message.h"
#include "Parameter.h"
#include <vector>
#include <string>
class MessageDecoder{
private:
public:
MessageDecoder();
~MessageDecoder();
static std::string encodeIpPort(sockaddr_in raw);
static sockaddr_in decodeIpPort(std::string s);
static std::string encodeIpPortPair(std::string, int);
static std::pair<std::string,int> decodeIpPortPair(std::string s);
static void encode(Message& _message, std::vector<Parameter>&, int, MessageType);
static void decode(Message* _message, std::vector<Parameter>&);
};
#endif
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by gauth, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#ifdef USE_TI_FACEBOOK
#import "FacebookModule.h"
#import "KrollCallback.h"
#import "FBConnect/Facebook.h"
@interface TiFacebookRequest : NSObject<FBRequestDelegate> {
NSString *path;
KrollCallback *callback;
FacebookModule *module;
BOOL graph;
}
-(id)initWithPath:(NSString*)path_ callback:(KrollCallback*)callback_ module:(FacebookModule*)module_ graph:(BOOL)graph_;
@end
#endif |
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef KMSP11_OBJECT_H_
#define KMSP11_OBJECT_H_
#include "absl/status/statusor.h"
#include "absl/strings/string_view.h"
#include "google/cloud/kms/v1/resources.pb.h"
#include "kmsp11/algorithm_details.h"
#include "kmsp11/attribute_map.h"
#include "kmsp11/cryptoki.h"
#include "kmsp11/util/kms_v1.h"
namespace kmsp11 {
struct KeyPair;
// Object models a PKCS #11 Object, and logically maps to a CryptoKeyVersion in
// Cloud KMS.
//
// See go/kms-pkcs11-model
class Object {
public:
static absl::StatusOr<KeyPair> NewKeyPair(const kms_v1::CryptoKeyVersion& ckv,
BSSL_CONST EVP_PKEY* public_key);
static absl::StatusOr<Object> NewCertificate(
const kms_v1::CryptoKeyVersion& ckv, X509* certificate);
absl::string_view kms_key_name() const { return kms_key_name_; }
CK_OBJECT_CLASS object_class() const { return object_class_; }
const AlgorithmDetails& algorithm() const { return algorithm_; }
const AttributeMap& attributes() const { return attributes_; }
private:
Object(std::string kms_key_name, CK_OBJECT_CLASS object_class,
AlgorithmDetails algorithm, AttributeMap attributes)
: kms_key_name_(kms_key_name),
object_class_(object_class),
algorithm_(algorithm),
attributes_(attributes) {}
const std::string kms_key_name_;
const CK_OBJECT_CLASS object_class_;
const AlgorithmDetails algorithm_;
const AttributeMap attributes_;
};
struct KeyPair {
Object public_key;
Object private_key;
};
} // namespace kmsp11
#endif // KMSP11_OBJECT_H_
|
/*
* =====================================================================================
*
* Filename: EnvelopFinder.h
*
* Description: Class for generating list of envelops.
*
* Version: 1.0
* Created: 9/6/2012 4:26:45 PM
* Revision: none
* Compiler: msvc
*
* Author: Han Hu(hh1985@bu.edu),
* Organization: Boston University
*
* =====================================================================================
*/
#ifndef GAG_ENVELOPFINDER_H
#define GAG_ENVELOPFINDER_H
#include <boost/shared_ptr.hpp>
#include <tuple>
#include <GAGPL/SPECTRUM/Envelop.h>
#include <GAGPL/SPECTRUM/EnvelopReference.h>
#include <GAGPL/MISC/Param.h>
namespace gag
{
// Atom and coefficient.
typedef std::map<std::string, double> AveragineFormulae;
typedef std::vector<RichList> IslandList;
// Shift and corresponding peak information. Class ProtoEnv can be considered as prototype of class Envelop.
typedef std::multimap<int, std::pair<RichPeakPtr, InfoPeakPtr> > ProtoEnv;
// Overall fitting score and corresponding envelop set.
typedef std::multimap<double, std::set<EnvelopPtr> > EnvelopSetCollection;
class PeakSet
{
public:
PeakSet(EnvelopBoundary& boundary)
: bound(boundary) {}
inline void addPeak(int shift, RichPeakPtr pk, InfoPeakPtr info)
{
peak_information.insert(std::make_pair(shift, std::make_pair(pk, info)));
}
inline EnvelopBoundary& getBoundary()
{
return bound;
}
inline ProtoEnv& getPeakInformation()
{
return peak_information;
}
inline size_t getSize()
{
return peak_information.size();
}
private:
ProtoEnv peak_information;
EnvelopBoundary bound;
};
using namespace param;
class EnvelopFinder
{
private:
Param& param;
// TBD: This information should finally be retrieved from parameter file.
// No sulfate.
AveragineFormulae ave1;
// High sulfate
AveragineFormulae ave2;
// Envelop reference table: from peak id to envelop (smart pointer).
// Envelop will be managed only by EnvelopReference.
EnvelopReference env_ref;
// Envelop env_pool;
std::vector<EnvelopPtr> env_pool;
// Raw data.
RichList& spectrum;
private:
// Interface for executing the process of finding envelops.
void run();
// Convert the raw peak list into several independent peak islands.
IslandList getPeakIslands(RichList& spec);
// Start from current candidate base peak, find matching envelop and estimate corresponding lambda values.
void findNextEnvelops(RichList& island, RichPeakListByResolution::iterator iter_area, unsigned int charge, std::set<EnvelopPtr>& env_set);
// Based on the lambda value stored in the envelop object, the method will detect if there is any events (peak split, peak overlapping, etc) and register the events in EnvelopReference.
// Relative shifts and corresponding peak sets. This type is used to deal with peak split due to the varied sulfate contents.
// Peakset and maximum number of envelops.
std::pair<PeakSet, size_t> extendPeakSet(RichList& island, RichPeakListByMZ::iterator iter_mz, unsigned int charge);
// Consider about the possibilities of using template for two direction expanding.
size_t extendPeak(PeakSet& pk_set, RichPeakListByMZ& pks_mz, RichPeakListByMZ::iterator iter_mz, unsigned int charge, int direction);
// Notice: the boundary has to be corrected for given charge.
EnvelopBoundary createBoundary(const double mass, unsigned int charge);
// If the PeakSet meet the basic threshold of the envelop.
std::vector<EnvelopPtr> convertPeakSet(PeakSet& pk_set);
// Estimate the global lambda value for each envelop. The corresponding estimated_abundance in each InfoPeak will also be updated
void updateEnvelopParameter(std::vector<EnvelopPtr> env_vec);
void updateEnvelopParameter(EnvelopPtr env);
// Once lambda is set, update the splitting score for envelops based on current base peak abundance. Calculate the dot product between theoretical envelop and the real one.
void updateSplittingPotential(std::vector<EnvEntry> entry_vec);
void updateSplittingPotential(EnvelopPtr env);
void updateSplittingPotential(std::set<EnvelopPtr>& env_set);
// Recursively optimize the fitting score by adjusting Lambda and Delta.
// void optimizeEnvelopSet(RichList& pk_list);
// Find the lambda value that give you the maximum fitting score.
void adjustLambdaFromProfile(EnvelopPtr env);
// Split the peak based on splitting potential.
void splitPeak(RichPeakPtr pk);
/* Latest methods */
// Find all candidate envelops.
void identifyEnvelops();
// Remove redundant candidate envelops.
void selectEnvelops();
// Envelop set optimization using MS-Deconv.
void optimizeEnvelopSet(std::set<EnvelopPtr>& env_set, double last_score = 0.0);
public:
EnvelopFinder(RichList& spec);
inline std::vector<EnvelopPtr> getEnvelops()
{ return env_pool; }
double updateFittingScore(std::vector<EnvEntry> entry_vec);
// If a theoretical peak is missing, count the exp peak as one with intensity 0.
double updateFittingScore(EnvelopPtr env);
double updateFittingScore(std::set<EnvelopPtr>& env_set);
void printEnvelop(EnvelopPtr env);
};
}
#endif /* GAG_ENVELOPFINDER_H */
|
/* Copyright 2017 R. Thomas
* Copyright 2017 Quarkslab
*
* 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 C_LIEF_ELF_DYNAMIC_ENTRY_H_
#define C_LIEF_ELF_DYNAMIC_ENTRY_H_
#include <stdint.h>
#include "LIEF/ELF/enums.h"
/** @defgroup elf_dynamic_entry_c_api Dynamic Entry
* @ingroup elf_c_api
* @addtogroup elf_dynamic_entry_c_api
* @brief Dynamic Entry C API
*
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
struct Elf_DynamicEntry_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
};
struct Elf_DynamicEntry_Library_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
const char* name;
};
struct Elf_DynamicEntry_SharedObject_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
const char* name;
};
struct Elf_DynamicEntry_Array_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
uint64_t* array;
};
struct Elf_DynamicEntry_Rpath_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
const char* rpath;
};
struct Elf_DynamicEntry_RunPath_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
const char* runpath;
};
struct Elf_DynamicEntry_Flags_t {
enum DYNAMIC_TAGS tag;
uint64_t value;
enum DYNAMIC_FLAGS *flags;
enum DYNAMIC_FLAGS_1 *flags_1;
};
typedef struct Elf_DynamicEntry_t Elf_DynamicEntry_t;
typedef struct Elf_DynamicEntry_Library_t Elf_DynamicEntry_Library_t;
typedef struct Elf_DynamicEntry_SharedObject_t Elf_DynamicEntry_SharedObject_t;
typedef struct Elf_DynamicEntry_Array_t Elf_DynamicEntry_Array_t;
typedef struct Elf_DynamicEntry_Rpath_t Elf_DynamicEntry_Rpath_t;
typedef struct Elf_DynamicEntry_RunPath_t Elf_DynamicEntry_RunPath_t;
typedef struct Elf_DynamicEntry_Flags_t Elf_DynamicEntry_Flags_t;
#ifdef __cplusplus
}
#endif
/** @} */
#endif
|
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Generated by the Codegen C++ plugin.
// If you make any local changes, they will be lost.
// source: google/cloud/pubsublite/v1/topic_stats.proto
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUBLITE_INTERNAL_TOPIC_STATS_STUB_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUBLITE_INTERNAL_TOPIC_STATS_STUB_H
#include "google/cloud/status_or.h"
#include "google/cloud/version.h"
#include <google/cloud/pubsublite/v1/topic_stats.grpc.pb.h>
#include <memory>
namespace google {
namespace cloud {
namespace pubsublite_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
class TopicStatsServiceStub {
public:
virtual ~TopicStatsServiceStub() = 0;
virtual StatusOr<google::cloud::pubsublite::v1::ComputeMessageStatsResponse>
ComputeMessageStats(
grpc::ClientContext& context,
google::cloud::pubsublite::v1::ComputeMessageStatsRequest const&
request) = 0;
virtual StatusOr<google::cloud::pubsublite::v1::ComputeHeadCursorResponse>
ComputeHeadCursor(
grpc::ClientContext& context,
google::cloud::pubsublite::v1::ComputeHeadCursorRequest const&
request) = 0;
virtual StatusOr<google::cloud::pubsublite::v1::ComputeTimeCursorResponse>
ComputeTimeCursor(
grpc::ClientContext& context,
google::cloud::pubsublite::v1::ComputeTimeCursorRequest const&
request) = 0;
};
class DefaultTopicStatsServiceStub : public TopicStatsServiceStub {
public:
explicit DefaultTopicStatsServiceStub(
std::unique_ptr<
google::cloud::pubsublite::v1::TopicStatsService::StubInterface>
grpc_stub)
: grpc_stub_(std::move(grpc_stub)) {}
StatusOr<google::cloud::pubsublite::v1::ComputeMessageStatsResponse>
ComputeMessageStats(
grpc::ClientContext& client_context,
google::cloud::pubsublite::v1::ComputeMessageStatsRequest const& request)
override;
StatusOr<google::cloud::pubsublite::v1::ComputeHeadCursorResponse>
ComputeHeadCursor(
grpc::ClientContext& client_context,
google::cloud::pubsublite::v1::ComputeHeadCursorRequest const& request)
override;
StatusOr<google::cloud::pubsublite::v1::ComputeTimeCursorResponse>
ComputeTimeCursor(
grpc::ClientContext& client_context,
google::cloud::pubsublite::v1::ComputeTimeCursorRequest const& request)
override;
private:
std::unique_ptr<
google::cloud::pubsublite::v1::TopicStatsService::StubInterface>
grpc_stub_;
};
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace pubsublite_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_PUBSUBLITE_INTERNAL_TOPIC_STATS_STUB_H
|
#ifndef COMPLETIONINFO_H
#define COMPLETIONINFO_H
#include <QMap>
#include <QVector>
#include <QString>
class CompletionInfo;
class FunctionCompletionInfo
{
public:
FunctionCompletionInfo(){ name = "<error func>";}
FunctionCompletionInfo(QString name,
bool isProcNotFunc,
QVector<QString> argNames)
{
this->name = name;
this->isProcNotFunc = isProcNotFunc;
this->argNames = argNames;
}
QString name;
bool isProcNotFunc;
QVector<QString> argNames;
QString toolTipStr();
};
class ModuleCompletionInfo
{
CompletionInfo *fullDb;
public:
QString name;
QString path;
QVector<QString> includedModules;
QMap<QString, FunctionCompletionInfo> functionsDefinedHere;
public:
ModuleCompletionInfo() {name = "<error module>";}
ModuleCompletionInfo(QString name, QString path,CompletionInfo *fullDb)
{
this->fullDb = fullDb;
this->name = name;
this->path = path;
}
bool moduleOfPath(QString path, ModuleCompletionInfo &ret);
QVector<FunctionCompletionInfo> functionsVisibleFromHere();
};
class CompletionInfo
{
public:
// From full module path to module info
QMap<QString, ModuleCompletionInfo> modules;
public:
CompletionInfo();
ModuleCompletionInfo &module(QString path)
{
if(modules.contains(path))
return modules[path];
modules[path] = ModuleCompletionInfo("", path, this);
return modules[path];
}
};
#endif // COMPLETIONINFO_H
|
/*
* Copyright 2011 VMWare, Inc.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
* Author: Thomas Hellstrom <thellstrom@vmware.com>
*/
#ifndef _VMWARE_BOOTSTRAP_H_
#define _VMWARE_BOOTSTRAP_H_
#include <xf86.h>
#define VMWARE_INCHTOMM 25.4
typedef enum {
OPTION_HW_CURSOR,
OPTION_XINERAMA,
OPTION_STATIC_XINERAMA,
OPTION_GUI_LAYOUT,
OPTION_DEFAULT_MODE,
OPTION_RENDER_ACCEL,
OPTION_DRI,
OPTION_DIRECT_PRESENTS,
OPTION_HW_PRESENTS,
OPTION_RENDERCHECK
} VMWAREOpts;
OptionInfoPtr VMWARECopyOptions(void);
void
vmwlegacy_hookup(ScrnInfoPtr pScrn);
#ifdef BUILD_VMWGFX
void
vmwgfx_hookup(ScrnInfoPtr pScrn);
void
vmwgfx_modify_flags(uint32_t *flags);
#endif /* defined(BUILD_VMWGFX) */
#ifdef XFree86LOADER
void
VMWARERefSymLists(void);
#endif /* XFree86LOADER */
/*#define DEBUG_LOGGING*/
#ifdef DEBUG_LOGGING
# define VmwareLog(args) ErrorF args
# define TRACEPOINT VmwareLog(("%s : %s\n", __FUNCTION__, __FILE__));
#else
# define VmwareLog(args)
# define TRACEPOINT
#endif
#endif
|
/* ioctl.c --- wrappers for Windows ioctl function
Copyright (C) 2008-2013 Free Software Foundation, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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/>. */
/* Written by Paolo Bonzini */
#include <mingle/config.h>
#include <sys/ioctl.h>
#include <stdarg.h>
#if HAVE_IOCTL
/* Provide a wrapper with the POSIX prototype. */
# undef ioctl
int
rpl_ioctl (int fd, int request, ... /* {void *,char *} arg */)
{
void *buf;
va_list args;
va_start (args, request);
buf = va_arg (args, void *);
va_end (args);
/* Cast 'request' so that when the system's ioctl function takes a 64-bit
request argument, the value gets zero-extended, not sign-extended. */
return ioctl (fd, (unsigned int) request, buf);
}
#else /* mingw */
# include <errno.h>
/* Get HANDLE. */
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
# include "fd-hook.h"
/* Get _get_osfhandle. */
# include "msvc-nothrow.h"
static int
primary_ioctl (int fd, int request, void *arg)
{
/* We don't support FIONBIO on pipes here. If you want to make pipe
fds non-blocking, use the gnulib 'nonblocking' module, until
gnulib implements fcntl F_GETFL / F_SETFL with O_NONBLOCK. */
if ((HANDLE) _get_osfhandle (fd) != INVALID_HANDLE_VALUE)
errno = ENOSYS;
else
errno = EBADF;
return -1;
}
int
ioctl (int fd, int request, ... /* {void *,char *} arg */)
{
void *arg;
va_list args;
va_start (args, request);
arg = va_arg (args, void *);
va_end (args);
# if WINDOWS_SOCKETS
return execute_all_ioctl_hooks (primary_ioctl, fd, request, arg);
# else
return primary_ioctl (fd, request, arg);
# endif
}
#endif
|
/*
* Info/funciones usada por el servidor
*
*
*
*
*
*/
//va acumulando la cantidad de procesos que se van abriendo para manejar las conexiones concurrentes
int cantidad_de_clientes;
//se ejecuta cuando en el cliente corro el comando "bajarservidor"
//capturando ctrl+c
void bajarServidor();
void bannerDeBienvenida();
void *recibeConexion(void *socket_desc);
/* estructura que se le pasa como argumento al crear el thread de conexion entrante*/
typedef struct argumentos_thread_conexion {
char ip_cliente[INET_ADDRSTRLEN]; /* Ip del cliente que abre el thread*/
int socket_asociado; /* Socket asociado al cliente del thread*/
}argumentos_thread_conexion;
|
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
extern pthread_rwlock_t rwlock;
void print1(size_t count)
{
int i;
for (i = 0; i < count; i++)
{
fprintf(stderr, "1");
}
fprintf(stderr, "\n");
}
void *thread1(void *cmd)
{
while(1)
{
pthread_rwlock_rdlock(&rwlock);
print1(100);
pthread_rwlock_unlock(&rwlock);
}
return NULL;
}
|
//
// NSMutableArray+Extension.h
// Pods
//
// Created by 李晓 on 16/9/18.
//
//
#import <Foundation/Foundation.h>
@interface NSMutableArray (Extension)
/**
* 将数组中元素按照 “,” 分割成字符串
* 支持 string int double 等基础数据类型
* @[1,2,3]
* @return @“1,2,3”
*/
- (NSString *) toStringSeparatedByComma;
@end
|
/**
* Appcelerator Titanium - licensed under the Apache Public License 2
* see LICENSE in the root folder for details on the license.
* Copyright (c) 2009 Appcelerator, Inc. All Rights Reserved.
*/
#ifndef _PROCESS_H_
#define _PROCESS_H_
#include <kroll/kroll.h>
#include <Poco/Process.h>
#include <Poco/Pipe.h>
#include <Poco/Thread.h>
#include <Poco/RunnableAdapter.h>
#include <Poco/Mutex.h>
#include <Poco/Condition.h>
#include <sstream>
#include "pipe.h"
#include "process_binding.h"
namespace ti
{
class Process : public StaticBoundObject
{
public:
Process(ProcessBinding* parent, std::string& command, std::vector<std::string>& args);
protected:
virtual ~Process();
virtual void Set(const char *name, SharedValue value);
private:
ProcessBinding *parent;
Poco::Thread exitMonitorThread;
Poco::Thread stdOutThread;
Poco::Thread stdErrorThread;
Poco::RunnableAdapter<Process>* monitorAdapter;
Poco::RunnableAdapter<Process>* stdOutAdapter;
Poco::RunnableAdapter<Process>* stdErrorAdapter;
bool running;
bool complete;
int pid;
int exitCode;
std::vector<std::string> arguments;
std::string command;
Pipe *in;
Pipe *out;
Pipe *err;
Poco::Pipe *errp;
Poco::Pipe *outp;
Poco::Pipe *inp;
SharedKObject *shared_input;
SharedKObject *shared_output;
SharedKObject *shared_error;
std::ostringstream stdOutBuffer;
std::ostringstream stdErrorBuffer;
Logger* logger;
Poco::Mutex outputBufferMutex;
void Terminate(const ValueList& args, SharedValue result);
void Terminate();
void Monitor();
void ReadStdOut();
void ReadStdError();
void StartReadThreads();
void InvokeOnExitCallback();
void InvokeOnReadCallback(bool isStdError);
};
}
#endif
|
#warning rom/bigint.h is deprecated, please use esp32/rom/bigint.h instead
#include "esp32/rom/bigint.h"
|
/*
* 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/codepipeline/CodePipeline_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace CodePipeline
{
namespace Model
{
/**
* <p>Represents an AWS session credentials object. These credentials are temporary
* credentials that are issued by AWS Secure Token Service (STS). They can be used
* to access input and output artifacts in the S3 bucket used to store artifact for
* the pipeline in AWS CodePipeline.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/codepipeline-2015-07-09/AWSSessionCredentials">AWS
* API Reference</a></p>
*/
class AWS_CODEPIPELINE_API AWSSessionCredentials
{
public:
AWSSessionCredentials();
AWSSessionCredentials(Aws::Utils::Json::JsonView jsonValue);
AWSSessionCredentials& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The access key for the session.</p>
*/
inline const Aws::String& GetAccessKeyId() const{ return m_accessKeyId; }
/**
* <p>The access key for the session.</p>
*/
inline bool AccessKeyIdHasBeenSet() const { return m_accessKeyIdHasBeenSet; }
/**
* <p>The access key for the session.</p>
*/
inline void SetAccessKeyId(const Aws::String& value) { m_accessKeyIdHasBeenSet = true; m_accessKeyId = value; }
/**
* <p>The access key for the session.</p>
*/
inline void SetAccessKeyId(Aws::String&& value) { m_accessKeyIdHasBeenSet = true; m_accessKeyId = std::move(value); }
/**
* <p>The access key for the session.</p>
*/
inline void SetAccessKeyId(const char* value) { m_accessKeyIdHasBeenSet = true; m_accessKeyId.assign(value); }
/**
* <p>The access key for the session.</p>
*/
inline AWSSessionCredentials& WithAccessKeyId(const Aws::String& value) { SetAccessKeyId(value); return *this;}
/**
* <p>The access key for the session.</p>
*/
inline AWSSessionCredentials& WithAccessKeyId(Aws::String&& value) { SetAccessKeyId(std::move(value)); return *this;}
/**
* <p>The access key for the session.</p>
*/
inline AWSSessionCredentials& WithAccessKeyId(const char* value) { SetAccessKeyId(value); return *this;}
/**
* <p>The secret access key for the session.</p>
*/
inline const Aws::String& GetSecretAccessKey() const{ return m_secretAccessKey; }
/**
* <p>The secret access key for the session.</p>
*/
inline bool SecretAccessKeyHasBeenSet() const { return m_secretAccessKeyHasBeenSet; }
/**
* <p>The secret access key for the session.</p>
*/
inline void SetSecretAccessKey(const Aws::String& value) { m_secretAccessKeyHasBeenSet = true; m_secretAccessKey = value; }
/**
* <p>The secret access key for the session.</p>
*/
inline void SetSecretAccessKey(Aws::String&& value) { m_secretAccessKeyHasBeenSet = true; m_secretAccessKey = std::move(value); }
/**
* <p>The secret access key for the session.</p>
*/
inline void SetSecretAccessKey(const char* value) { m_secretAccessKeyHasBeenSet = true; m_secretAccessKey.assign(value); }
/**
* <p>The secret access key for the session.</p>
*/
inline AWSSessionCredentials& WithSecretAccessKey(const Aws::String& value) { SetSecretAccessKey(value); return *this;}
/**
* <p>The secret access key for the session.</p>
*/
inline AWSSessionCredentials& WithSecretAccessKey(Aws::String&& value) { SetSecretAccessKey(std::move(value)); return *this;}
/**
* <p>The secret access key for the session.</p>
*/
inline AWSSessionCredentials& WithSecretAccessKey(const char* value) { SetSecretAccessKey(value); return *this;}
/**
* <p>The token for the session.</p>
*/
inline const Aws::String& GetSessionToken() const{ return m_sessionToken; }
/**
* <p>The token for the session.</p>
*/
inline bool SessionTokenHasBeenSet() const { return m_sessionTokenHasBeenSet; }
/**
* <p>The token for the session.</p>
*/
inline void SetSessionToken(const Aws::String& value) { m_sessionTokenHasBeenSet = true; m_sessionToken = value; }
/**
* <p>The token for the session.</p>
*/
inline void SetSessionToken(Aws::String&& value) { m_sessionTokenHasBeenSet = true; m_sessionToken = std::move(value); }
/**
* <p>The token for the session.</p>
*/
inline void SetSessionToken(const char* value) { m_sessionTokenHasBeenSet = true; m_sessionToken.assign(value); }
/**
* <p>The token for the session.</p>
*/
inline AWSSessionCredentials& WithSessionToken(const Aws::String& value) { SetSessionToken(value); return *this;}
/**
* <p>The token for the session.</p>
*/
inline AWSSessionCredentials& WithSessionToken(Aws::String&& value) { SetSessionToken(std::move(value)); return *this;}
/**
* <p>The token for the session.</p>
*/
inline AWSSessionCredentials& WithSessionToken(const char* value) { SetSessionToken(value); return *this;}
private:
Aws::String m_accessKeyId;
bool m_accessKeyIdHasBeenSet;
Aws::String m_secretAccessKey;
bool m_secretAccessKeyHasBeenSet;
Aws::String m_sessionToken;
bool m_sessionTokenHasBeenSet;
};
} // namespace Model
} // namespace CodePipeline
} // namespace Aws
|
/*
* 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/mediastore/MediaStore_EXPORTS.h>
#include <aws/mediastore/MediaStoreRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace MediaStore
{
namespace Model
{
/**
*/
class AWS_MEDIASTORE_API GetCorsPolicyRequest : public MediaStoreRequest
{
public:
GetCorsPolicyRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "GetCorsPolicy"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline const Aws::String& GetContainerName() const{ return m_containerName; }
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline void SetContainerName(const Aws::String& value) { m_containerNameHasBeenSet = true; m_containerName = value; }
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline void SetContainerName(Aws::String&& value) { m_containerNameHasBeenSet = true; m_containerName = std::move(value); }
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline void SetContainerName(const char* value) { m_containerNameHasBeenSet = true; m_containerName.assign(value); }
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline GetCorsPolicyRequest& WithContainerName(const Aws::String& value) { SetContainerName(value); return *this;}
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline GetCorsPolicyRequest& WithContainerName(Aws::String&& value) { SetContainerName(std::move(value)); return *this;}
/**
* <p>The name of the container that the policy is assigned to.</p>
*/
inline GetCorsPolicyRequest& WithContainerName(const char* value) { SetContainerName(value); return *this;}
private:
Aws::String m_containerName;
bool m_containerNameHasBeenSet;
};
} // namespace Model
} // namespace MediaStore
} // namespace Aws
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "PKIX1Explicit88"
* found in "asn1/rfc3280-PKIX1Explicit88.asn1"
* `asn1c -S asn1c/skeletons -pdu=all -pdu=Certificate -fwide-types`
*/
#ifndef _TeletexPersonalName_H_
#define _TeletexPersonalName_H_
#include <asn_application.h>
/* Including external dependencies */
#include <TeletexString.h>
#include <constr_SET.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
/*
* Method of determining the components presence
*/
typedef enum TeletexPersonalName_PR {
TeletexPersonalName_PR_surname, /* Member surname is present */
TeletexPersonalName_PR_given_name, /* Member given_name is present */
TeletexPersonalName_PR_initials, /* Member initials is present */
TeletexPersonalName_PR_generation_qualifier, /* Member generation_qualifier is present */
} TeletexPersonalName_PR;
/* TeletexPersonalName */
typedef struct TeletexPersonalName {
TeletexString_t surname;
TeletexString_t *given_name /* OPTIONAL */;
TeletexString_t *initials /* OPTIONAL */;
TeletexString_t *generation_qualifier /* OPTIONAL */;
/* Presence bitmask: ASN_SET_ISPRESENT(pTeletexPersonalName, TeletexPersonalName_PR_x) */
unsigned int _presence_map
[((4+(8*sizeof(unsigned int))-1)/(8*sizeof(unsigned int)))];
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} TeletexPersonalName_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_TeletexPersonalName;
#ifdef __cplusplus
}
#endif
#endif /* _TeletexPersonalName_H_ */
#include <asn_internal.h>
|
/**
* entropy_hardware_poll.c
*
* override the software entropy generation (which only provides a weak entropy source)
* with the built in hardware RNG on the discovery board (which provides a much stronger
* source of entropy).
*
* this is heavily based on the example from https://www2.keil.com/iot/32f746gdiscovery
* (just with more commenting so I actually understand what's going on!)
*
* author: Dr. Alex Shenfield
* date: 17/11/2021
* purpose: 55-604481 embedded computer networks - lab 104
*/
// includes
#include <string.h>
#include "stm32f7xx_hal.h"
// include the random number generator functionality
#include "random_numbers.h"
// we define "MBEDTLS_ENTROPY_HARDWARE_ALT" in the mbedTLS_config.h file and then use the
// STM32F7 HAL hardware random number generator to provide an entropy source for the
// TLS function
// this is our function prototype
int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen);
// override the entropy poll callback in entropy_poll_hw.c to use a hardware source
// e.g. the hardware RNG built in to the stm32f7-discovery board (this is a stronger
// source of entropy than the weak entropy source defined in software)
int mbedtls_hardware_poll(void *data, unsigned char *output, size_t len, size_t *olen)
{
HAL_StatusTypeDef status = HAL_OK;
uint32_t random_number = 0;
// generate our random number
status = HAL_RNG_GenerateRandomNumber(&rng_handle, &random_number);
((void) data);
*olen = 0;
// if the rng hasn't returned properly then just return 0
if((len < sizeof(uint32_t)) || (HAL_OK != status))
{
return 0;
}
// otherwise, copy the random number into the output to use as part of the entropy
// source and return
memcpy(output, &random_number, sizeof(uint32_t));
*olen = sizeof(uint32_t);
return 0;
}
|
/** @file
A brief file description
@section license License
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.
*/
/*****************************************************************************
* Filename: NetworkUtilsRemote.h
* Purpose: This file contains functions used by remote api client to
* marshal requests to TM and unmarshal replies from TM.
* Also contains functions used to store information specific
* to a remote client connection.
* Created: 8/9/00
* Created by: lant
*
***************************************************************************/
#ifndef _NETWORK_UTILS_REMOTE_H_
#define _NETWORK_UTILS_REMOTE_H_
#include "mgmtapi.h"
#include "NetworkMessage.h"
#include "EventCallback.h"
extern int main_socket_fd;
extern int event_socket_fd;
extern CallbackTable *remote_event_callbacks;
// From CoreAPIRemote.cc
extern ink_thread ts_event_thread;
extern TSInitOptionT ts_init_options;
/**********************************************************************
* Socket Helper Functions
**********************************************************************/
void set_socket_paths(const char *path);
/* The following functions are specific for a client connection; uses
* the client connection information stored in the variables in
* NetworkUtilsRemote.cc
*/
TSMgmtError ts_connect(); /* TODO: update documenation, Renamed due to conflict with connect() in <sys/socket.h> on some platforms*/
TSMgmtError disconnect();
TSMgmtError reconnect();
TSMgmtError reconnect_loop(int num_attempts);
void *socket_test_thread(void *arg);
void *event_poll_thread_main(void *arg);
struct mgmtapi_sender : public mgmt_message_sender {
explicit mgmtapi_sender(int _fd) : fd(_fd) {}
virtual TSMgmtError send(void *msg, size_t msglen) const;
int fd;
};
#define MGMTAPI_SEND_MESSAGE(fd, optype, ...) send_mgmt_request(mgmtapi_sender(fd), (optype), __VA_ARGS__)
#define MGMTAPI_MGMT_SOCKET_NAME "mgmtapi.sock"
#define MGMTAPI_EVENT_SOCKET_NAME "eventapi.sock"
/*****************************************************************************
* Marshalling (create requests)
*****************************************************************************/
TSMgmtError send_register_all_callbacks(int fd, CallbackTable *cb_table);
TSMgmtError send_unregister_all_callbacks(int fd, CallbackTable *cb_table);
/*****************************************************************************
* Un-marshalling (parse responses)
*****************************************************************************/
TSMgmtError parse_generic_response(OpType optype, int fd);
#endif /* _NETWORK_UTILS_REMOTE_H_ */
|
/* vi:set ts=4 sw=4 expandtab:
*
* Copyright 2016, Chris Leishman (http://github.com/cleishm)
*
* 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 "../../config.h"
#include "astnode.h"
#include "util.h"
#include <assert.h>
struct comment
{
cypher_astnode_t _astnode;
char p[];
};
static cypher_astnode_t *clone(const cypher_astnode_t *self,
cypher_astnode_t **children);
static ssize_t detailstr(const cypher_astnode_t *self, char *str, size_t size);
static const struct cypher_astnode_vt *parents[] =
{ &cypher_comment_astnode_vt };
const struct cypher_astnode_vt cypher_line_comment_astnode_vt =
{ .parents = parents,
.nparents = 1,
.name = "line_comment",
.detailstr = detailstr,
.release = cypher_astnode_release,
.clone = clone };
cypher_astnode_t *cypher_ast_line_comment(const char *s, size_t n,
struct cypher_input_range range)
{
struct comment *node = calloc(1, sizeof(struct comment) + n+1);
if (node == NULL)
{
return NULL;
}
if (cypher_astnode_init(&(node->_astnode), CYPHER_AST_LINE_COMMENT,
NULL, 0, range))
{
free(node);
return NULL;
}
memcpy(node->p, s, n);
node->p[n] = '\0';
return &(node->_astnode);
}
cypher_astnode_t *clone(const cypher_astnode_t *self,
cypher_astnode_t **children)
{
REQUIRE_TYPE(self, CYPHER_AST_LINE_COMMENT, NULL);
struct comment *node = container_of(self, struct comment, _astnode);
return cypher_ast_line_comment(node->p, strlen(node->p), self->range);
}
const char *cypher_ast_line_comment_get_value(const cypher_astnode_t *astnode)
{
REQUIRE_TYPE(astnode, CYPHER_AST_LINE_COMMENT, NULL);
struct comment *node = container_of(astnode, struct comment, _astnode);
return node->p;
}
ssize_t detailstr(const cypher_astnode_t *self, char *str, size_t size)
{
REQUIRE_TYPE(self, CYPHER_AST_LINE_COMMENT, -1);
struct comment *node = container_of(self, struct comment, _astnode);
return snprintf(str, size, "//%s", node->p);
}
|
/*
* 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/cloudfront/CloudFront_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/cloudfront/model/SslProtocol.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Xml
{
class XmlNode;
} // namespace Xml
} // namespace Utils
namespace CloudFront
{
namespace Model
{
/**
* <p>A complex type that contains information about the SSL/TLS protocols that
* CloudFront can use when establishing an HTTPS connection with your origin.
* </p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/cloudfront-2018-06-18/OriginSslProtocols">AWS
* API Reference</a></p>
*/
class AWS_CLOUDFRONT_API OriginSslProtocols
{
public:
OriginSslProtocols();
OriginSslProtocols(const Aws::Utils::Xml::XmlNode& xmlNode);
OriginSslProtocols& operator=(const Aws::Utils::Xml::XmlNode& xmlNode);
void AddToNode(Aws::Utils::Xml::XmlNode& parentNode) const;
/**
* <p>The number of SSL/TLS protocols that you want to allow CloudFront to use when
* establishing an HTTPS connection with this origin. </p>
*/
inline int GetQuantity() const{ return m_quantity; }
/**
* <p>The number of SSL/TLS protocols that you want to allow CloudFront to use when
* establishing an HTTPS connection with this origin. </p>
*/
inline void SetQuantity(int value) { m_quantityHasBeenSet = true; m_quantity = value; }
/**
* <p>The number of SSL/TLS protocols that you want to allow CloudFront to use when
* establishing an HTTPS connection with this origin. </p>
*/
inline OriginSslProtocols& WithQuantity(int value) { SetQuantity(value); return *this;}
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline const Aws::Vector<SslProtocol>& GetItems() const{ return m_items; }
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline void SetItems(const Aws::Vector<SslProtocol>& value) { m_itemsHasBeenSet = true; m_items = value; }
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline void SetItems(Aws::Vector<SslProtocol>&& value) { m_itemsHasBeenSet = true; m_items = std::move(value); }
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline OriginSslProtocols& WithItems(const Aws::Vector<SslProtocol>& value) { SetItems(value); return *this;}
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline OriginSslProtocols& WithItems(Aws::Vector<SslProtocol>&& value) { SetItems(std::move(value)); return *this;}
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline OriginSslProtocols& AddItems(const SslProtocol& value) { m_itemsHasBeenSet = true; m_items.push_back(value); return *this; }
/**
* <p>A list that contains allowed SSL/TLS protocols for this distribution.</p>
*/
inline OriginSslProtocols& AddItems(SslProtocol&& value) { m_itemsHasBeenSet = true; m_items.push_back(std::move(value)); return *this; }
private:
int m_quantity;
bool m_quantityHasBeenSet;
Aws::Vector<SslProtocol> m_items;
bool m_itemsHasBeenSet;
};
} // namespace Model
} // namespace CloudFront
} // namespace Aws
|
//
// Copyright (c) 2014 Limit Point Systems, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Declarations for standard_member_index facet of namespace sheaf.
#ifndef STANDARD_MEMBER_INDEX_H
#define STANDARD_MEMBER_INDEX_H
#ifndef SHEAF_DLL_SPEC_H
#include "SheafSystem/sheaf_dll_spec.h"
#endif
#ifndef STD_CLIMITS_H
#include "SheafSystem/std_climits.h"
#endif
#ifndef POD_TYPES_H
#include "SheafSystem/pod_types.h"
#endif
namespace sheaf
{
///
/// Ids for standard poset members.
///
enum standard_member_index
{
STANDARD_MEMBER_INDEX_BEGIN = 0, // Must be same as first std id.
BOTTOM_INDEX = 0,
TOP_INDEX, // 1
STANDARD_MEMBER_INDEX_END, // Must be one more than last std id.
NOT_A_STANDARD_MEMBER_INDEX = INT_MAX
};
///
/// Prefix increment operator for standard_member_index.
///
SHEAF_DLL_SPEC standard_member_index& operator++(standard_member_index& x);
///
/// The name of the enumerator xpt.
///
SHEAF_DLL_SPEC const std::string& standard_member_index_to_name(standard_member_index xpt);
///
/// The enumerator with name xname.
///
SHEAF_DLL_SPEC standard_member_index standard_member_index_from_name(const std::string& xname);
///
/// The enumerator corresponding to primitive index xindex.
///
SHEAF_DLL_SPEC standard_member_index standard_member_index_from_index(pod_index_type xindex);
///
/// True if xindex is a valid primitive index.
///
SHEAF_DLL_SPEC bool is_standard_member_index(pod_index_type xindex);
} // namespace sheaf
#endif // ifndef STANDARD_MEMBER_INDEX_H
|
/*
* Copyright (c) 2005-2006 Institute for System Programming
* Russian Academy of Sciences
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TA_MATH_CHYPER_AGENT_H
#define TA_MATH_CHYPER_AGENT_H
#include "common/agent.h"
/********************************************************************/
/** Agent Initialization **/
/********************************************************************/
void register_math_chyper_commands(void);
#endif
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/keyspaces/Keyspaces_EXPORTS.h>
#include <aws/keyspaces/KeyspacesRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/keyspaces/model/Tag.h>
#include <utility>
namespace Aws
{
namespace Keyspaces
{
namespace Model
{
/**
*/
class AWS_KEYSPACES_API UntagResourceRequest : public KeyspacesRequest
{
public:
UntagResourceRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "UntagResource"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline const Aws::String& GetResourceArn() const{ return m_resourceArn; }
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline bool ResourceArnHasBeenSet() const { return m_resourceArnHasBeenSet; }
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline void SetResourceArn(const Aws::String& value) { m_resourceArnHasBeenSet = true; m_resourceArn = value; }
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline void SetResourceArn(Aws::String&& value) { m_resourceArnHasBeenSet = true; m_resourceArn = std::move(value); }
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline void SetResourceArn(const char* value) { m_resourceArnHasBeenSet = true; m_resourceArn.assign(value); }
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline UntagResourceRequest& WithResourceArn(const Aws::String& value) { SetResourceArn(value); return *this;}
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline UntagResourceRequest& WithResourceArn(Aws::String&& value) { SetResourceArn(std::move(value)); return *this;}
/**
* <p>The Amazon Keyspaces resource that the tags will be removed from. This value
* is an Amazon Resource Name (ARN).</p>
*/
inline UntagResourceRequest& WithResourceArn(const char* value) { SetResourceArn(value); return *this;}
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline const Aws::Vector<Tag>& GetTags() const{ return m_tags; }
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline bool TagsHasBeenSet() const { return m_tagsHasBeenSet; }
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline void SetTags(const Aws::Vector<Tag>& value) { m_tagsHasBeenSet = true; m_tags = value; }
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline void SetTags(Aws::Vector<Tag>&& value) { m_tagsHasBeenSet = true; m_tags = std::move(value); }
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline UntagResourceRequest& WithTags(const Aws::Vector<Tag>& value) { SetTags(value); return *this;}
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline UntagResourceRequest& WithTags(Aws::Vector<Tag>&& value) { SetTags(std::move(value)); return *this;}
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline UntagResourceRequest& AddTags(const Tag& value) { m_tagsHasBeenSet = true; m_tags.push_back(value); return *this; }
/**
* <p>A list of existing tags to be removed from the Amazon Keyspaces resource.</p>
*/
inline UntagResourceRequest& AddTags(Tag&& value) { m_tagsHasBeenSet = true; m_tags.push_back(std::move(value)); return *this; }
private:
Aws::String m_resourceArn;
bool m_resourceArnHasBeenSet;
Aws::Vector<Tag> m_tags;
bool m_tagsHasBeenSet;
};
} // namespace Model
} // namespace Keyspaces
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/customer-profiles/CustomerProfiles_EXPORTS.h>
#include <aws/customer-profiles/model/AppflowIntegrationWorkflowStep.h>
#include <utility>
namespace Aws
{
namespace Utils
{
namespace Json
{
class JsonValue;
class JsonView;
} // namespace Json
} // namespace Utils
namespace CustomerProfiles
{
namespace Model
{
/**
* <p>List containing steps in workflow.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/customer-profiles-2020-08-15/WorkflowStepItem">AWS
* API Reference</a></p>
*/
class AWS_CUSTOMERPROFILES_API WorkflowStepItem
{
public:
WorkflowStepItem();
WorkflowStepItem(Aws::Utils::Json::JsonView jsonValue);
WorkflowStepItem& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>Workflow step information specific to <code>APPFLOW_INTEGRATION</code>
* workflow.</p>
*/
inline const AppflowIntegrationWorkflowStep& GetAppflowIntegration() const{ return m_appflowIntegration; }
/**
* <p>Workflow step information specific to <code>APPFLOW_INTEGRATION</code>
* workflow.</p>
*/
inline bool AppflowIntegrationHasBeenSet() const { return m_appflowIntegrationHasBeenSet; }
/**
* <p>Workflow step information specific to <code>APPFLOW_INTEGRATION</code>
* workflow.</p>
*/
inline void SetAppflowIntegration(const AppflowIntegrationWorkflowStep& value) { m_appflowIntegrationHasBeenSet = true; m_appflowIntegration = value; }
/**
* <p>Workflow step information specific to <code>APPFLOW_INTEGRATION</code>
* workflow.</p>
*/
inline void SetAppflowIntegration(AppflowIntegrationWorkflowStep&& value) { m_appflowIntegrationHasBeenSet = true; m_appflowIntegration = std::move(value); }
/**
* <p>Workflow step information specific to <code>APPFLOW_INTEGRATION</code>
* workflow.</p>
*/
inline WorkflowStepItem& WithAppflowIntegration(const AppflowIntegrationWorkflowStep& value) { SetAppflowIntegration(value); return *this;}
/**
* <p>Workflow step information specific to <code>APPFLOW_INTEGRATION</code>
* workflow.</p>
*/
inline WorkflowStepItem& WithAppflowIntegration(AppflowIntegrationWorkflowStep&& value) { SetAppflowIntegration(std::move(value)); return *this;}
private:
AppflowIntegrationWorkflowStep m_appflowIntegration;
bool m_appflowIntegrationHasBeenSet;
};
} // namespace Model
} // namespace CustomerProfiles
} // namespace Aws
|
#include "nit.common.h"
#define COLOR_nit__mdoc__MDoc___content 0
extern const char FILE_nit__mdoc[];
#define COLOR_nit__mdoc__MDoc___original_mentity 1
#define COLOR_nit__mdoc__MEntity___mdoc 0
#define COLOR_nit__mdoc__MEntity___deprecation 1
#define COLOR_nit__mdoc__MDeprecationInfo___mdoc 0
|
/*
Editor: http://www.visualmicro.com
visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten
the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project
all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!).
note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again
Hardware: Arduino Uno, Platform=avr, Package=arduino
*/
#ifndef _VSARDUINO_H_
#define _VSARDUINO_H_
#define __AVR_ATmega328p__
#define __AVR_ATmega328P__
#define ARDUINO 106
#define ARDUINO_MAIN
#define __AVR__
#define __avr__
#define F_CPU 16000000L
#define __cplusplus
#define GCC_VERSION 40302
#define ARDUINO_ARCH_AVR
#define ARDUINO_AVR_UNO
#define __inline__
#define __asm__(x)
#define __extension__
#define __ATTR_PURE__
#define __ATTR_CONST__
#define __inline__
#define __asm__
#define __volatile__
typedef void *__builtin_va_list;
#define __builtin_va_start
#define __builtin_va_end
//#define __DOXYGEN__
#define __attribute__(x)
#define NOINLINE __attribute__((noinline))
#define prog_void
#define PGM_VOID_P int
#define NEW_H
typedef unsigned char byte;
extern "C" void __cxa_pure_virtual() {;}
#include <arduino.h>
#include <pins_arduino.h>
#undef F
#define F(string_literal) ((const PROGMEM char *)(string_literal))
#undef cli
#define cli()
#define pgm_read_byte(address_short)
#define pgm_read_word(address_short)
#define pgm_read_word2(address_short)
#define digitalPinToPort(P)
#define digitalPinToBitMask(P)
#define digitalPinToTimer(P)
#define analogInPinToBit(P)
#define portOutputRegister(P)
#define portInputRegister(P)
#define portModeRegister(P)
#include <hdScreenBrightnessMonitor.ino>
#include <Config.h>
#endif
|
// Copyright 2021 gRPC authors.
//
// 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 GRPC_CORE_LIB_PROMISE_DETAIL_PROMISE_LIKE_H
#define GRPC_CORE_LIB_PROMISE_DETAIL_PROMISE_LIKE_H
#include <grpc/impl/codegen/port_platform.h>
#include "src/core/lib/promise/poll.h"
#include <utility>
#include "src/core/lib/promise/poll.h"
// A Promise is a callable object that returns Poll<T> for some T.
// Often when we're writing code that uses promises, we end up wanting to also
// deal with code that completes instantaneously - that is, it returns some T
// where T is not Poll.
// PromiseLike wraps any callable that takes no parameters and implements the
// Promise interface. For things that already return Poll, this wrapping does
// nothing. For things that do not return Poll, we wrap the return type in Poll.
// This allows us to write things like:
// Seq(
// [] { return 42; },
// ...)
// in preference to things like:
// Seq(
// [] { return Poll<int>(42); },
// ...)
// or:
// Seq(
// [] -> Poll<int> { return 42; },
// ...)
// leading to slightly more concise code and eliminating some rules that in
// practice people find hard to deal with.
namespace grpc_core {
namespace promise_detail {
template <typename T>
struct PollWrapper {
static Poll<T> Wrap(T&& x) { return Poll<T>(std::forward<T>(x)); }
};
template <typename T>
struct PollWrapper<Poll<T>> {
static Poll<T> Wrap(Poll<T>&& x) { return std::forward<Poll<T>>(x); }
};
template <typename T>
auto WrapInPoll(T&& x) -> decltype(PollWrapper<T>::Wrap(std::forward<T>(x))) {
return PollWrapper<T>::Wrap(std::forward<T>(x));
}
template <typename F>
class PromiseLike {
private:
GPR_NO_UNIQUE_ADDRESS F f_;
public:
// NOLINTNEXTLINE - internal detail that drastically simplifies calling code.
PromiseLike(F&& f) : f_(std::forward<F>(f)) {}
auto operator()() -> decltype(WrapInPoll(f_())) { return WrapInPoll(f_()); }
using Result = typename PollTraits<decltype(WrapInPoll(f_()))>::Type;
};
// T -> T, const T& -> T
template <typename T>
using RemoveCVRef = absl::remove_cv_t<absl::remove_reference_t<T>>;
} // namespace promise_detail
} // namespace grpc_core
#endif // GRPC_CORE_LIB_PROMISE_DETAIL_PROMISE_LIKE_H
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by GDS, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*
* WARNING: This is generated code. Modify at your own risk and without support.
*/
#include "TiBase.h"
typedef enum {
OUT,
LOG_DEBUG, // Have to distinguish from the DEBUG macro
TRACE,
WARN,
ERR
} DebuggerLogLevel;
#ifdef __cplusplus
#define EXTERN_FUNC extern "C"
#else
#define EXTERN_FUNC extern
#endif
EXTERN_FUNC void* TiDebuggerCreate(KrollContext*,TiObjectRef);
EXTERN_FUNC void TiDebuggerDestroy(KrollContext*,TiObjectRef,void*);
EXTERN_FUNC void TiDebuggerStart(NSString*,int);
EXTERN_FUNC void TiDebuggerStop();
EXTERN_FUNC void TiDebuggerBeginScript(KrollContext*,const char*);
EXTERN_FUNC void TiDebuggerEndScript(KrollContext*);
EXTERN_FUNC void TiDebuggerLogMessage(DebuggerLogLevel level,NSString* message); |
//******************************************************************************
// Simple and generic functions header -- tools.h
//
// by: Daniel Commins (danielcommins@atacmd.com)
//
//******************************************************************************
//---------------------------------[DEFINES]------------------------------------
#define TRUE ( 1 )
#define FALSE ( 0 )
#define OFF ( 0 )
#define ON ( 1 )
#define ERROR ( 1 )
#define NO_ERROR ( 0 )
//--------------------------[FUNCTION DECLARATIONS]-----------------------------
extern void TOOLS_DumpLine( FILE* pFilePointer );
extern void TOOLS_RemovePadding( char** ppInputStr );
extern void TOOLS_RemoveTrailingSpaces( char* const pInputStr );
extern int TOOLS_StringCompareIgnoreCase( const char* pStr1, const char* pStr2, int numToCompare );
extern void TOOLS_GetTime( char** ppTimeStr );
|
/**
* Author: Claude Abounegm
*/
#ifndef SHADOW_OBJECT_H
#define SHADOW_OBJECT_H
#include <standard/String.h>
#include <standard/Class.h>
#include <standard/ULong.h>
#include <standard/MethodTable.h>
typedef struct
{
shadow_ulong_t ref_count;
shadow_Class_t* class_ref;
shadow_MethodTable_t* methods;
}
shadow_Object_t;
shadow_String_t* _shadowObject_toString(shadow_Object_t* ref);
shadow_Class_t* _shadowObject_getClass(shadow_Object_t* ref);
void __decrementRef(shadow_Object_t* object);
void __incrementRef(shadow_Object_t* object);
#endif
|
#ifndef FORMLOGIN_H
#define FORMLOGIN_H
#include <QWidget>
namespace Ui {
class FormLogin;
}
class FormLogin : public QWidget
{
Q_OBJECT
public:
explicit FormLogin(QWidget *parent = 0);
~FormLogin();
private:
Ui::FormLogin *ui;
};
#endif // FORMLOGIN_H
|
/*
* Copyright (c) 1999
* Boris Fomitchev
*
* This material is provided "as is", with absolutely no warranty expressed
* or implied. Any use is at your own risk.
*
* Permission to use or copy this software for any purpose is hereby granted
* without fee, provided the above notices are retained on all copies.
* Permission to modify the code and to distribute modified code is granted,
* provided the above notices are retained, and a notice that the code was
* modified is included with the above copyright notice.
*
*/
# if !defined (_STLP_OUTERMOST_HEADER_ID)
# define _STLP_OUTERMOST_HEADER_ID 0x242
# include <stl/_prolog.h>
# elif (_STLP_OUTERMOST_HEADER_ID == 0x242) && ! defined (_STLP_DONT_POP_0x242)
# define _STLP_DONT_POP_0x242
# endif
# include _STLP_NATIVE_C_HEADER(locale.h)
# if (_STLP_OUTERMOST_HEADER_ID == 0x242)
# if ! defined (_STLP_DONT_POP_0x242)
# include <stl/_epilog.h>
# undef _STLP_OUTERMOST_HEADER_ID
# endif
# undef _STLP_DONT_POP_0x242
# endif
// Local Variables:
// mode:C++
// End:
|
//
// Created by Georges Alkhouri
// Copyright (c) 2015 Georges Alkhouri. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "TripleStoreQueryProtocols.h"
@interface TripleStoreQueryInteractor : NSObject <TripleStoreQueryInteractorInputProtocol>
@property (nonatomic, weak) id <TripleStoreQueryInteractorOutputProtocol> presenter;
@property (nonatomic, strong) id <TripleStoreQueryAPIDataManagerInputProtocol> APIDataManager;
@property (nonatomic, strong) id <TripleStoreQueryLocalDataManagerInputProtocol> localDataManager;
@end |
//
// Entity.h
// NYUCodebase
//
// Created by Marcus Williams on 4/14/15.
// Copyright (c) 2015 Ivan Safrin. All rights reserved.
//
#ifndef NYUCodebase_Entity_h
#define NYUCodebase_Entity_h
#include <SDL.h>
#include <SDL_opengl.h>
#include <SDL_image.h>
class Entity {
public:
Entity (float x, float y, float w, float h) : x(x), y(y), width(w), height(h), rotation(0.0), velocity_x (0.0), velocity_y(0.0), acceleration_x(0.0), acceleration_y(0.0), friction_x(0.0), friction_y(0.0), mass(1.0), direction_x(0.0), direction_y(0.0), numFrames(0), framesPerSecond(0.0), gravity_x(0.0), gravity_y(0.0) {}
void Update(float elapsed);
void Render(std::string shape);
bool collidesWith(Entity *entity);
void FixedUpdate();
float x;
float y;
float width;
float height;
float rotation;
float direction_x;
float direction_y;
float velocity_x;
float velocity_y;
float acceleration_x;
float acceleration_y;
float friction_x;
float friction_y;
float gravity_x;
float gravity_y;
float mass;
bool isStatic;
bool enableCollisions;
bool collidedTop = false;
bool collidedBottom = false;
bool collidedLeft = false;
bool collidedRight = false;
int numFrames;
float animationElapsed = 0.0f;
float framesPerSecond;
int currentIndex = 0;
float offset;
float penetration;
};
class Bullet {
public:
void Update(float elapsed);
float x;
float y;
bool visible;
float angle;
};
GLuint LoadTexture(const char *image_path);
float lerp(float v0, float v1, float t);
#endif
|
/*
* Copyright (c) 2015-2021 Hanspeter Portner (dev@open-music-kontrollers.ch)
*
* This is free software: you can redistribute it and/or modify
* it under the terms of the Artistic License 2.0 as published by
* The Perl Foundation.
*
* This source 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
* Artistic License 2.0 for more details.
*
* You should have received a copy of the Artistic License 2.0
* along the source as a COPYING file. If not, obtain it from
* http://www.perlfoundation.org/artistic_license_2_0.
*/
#include <midi_matrix.h>
LV2_SYMBOL_EXPORT const LV2UI_Descriptor*
lv2ui_descriptor(uint32_t index)
{
switch(index)
{
case 0:
return &channel_filter_nk;
default:
return NULL;
}
}
|
#include "tag.h"
#include "util/buffer.h"
#include "util/yml.h"
extern nbt_tag *nbt_parse(const unsigned char *data, size_t size);
extern nbt_tag *nbt_parse_yml(struct yaml_object *obj);
extern bedrock_buffer *nbt_write(nbt_tag *tag);
extern void nbt_free(nbt_tag *tag);
extern void nbt_clear(nbt_tag *tag);
extern nbt_tag *nbt_get(nbt_tag *tag, nbt_tag_type type, size_t size, ...);
extern void nbt_copy(nbt_tag *tag, nbt_tag_type type, void *dest, size_t dest_size, size_t size, ...);
extern void *nbt_read(nbt_tag *tag, nbt_tag_type type, size_t size, ...);
extern const char *nbt_read_string(nbt_tag *tag, size_t size, ...);
extern void nbt_set(nbt_tag *tag, nbt_tag_type type, const void *src, size_t src_size, size_t size, ...);
extern nbt_tag *nbt_add(nbt_tag *tag, nbt_tag_type type, const char *name, const void *src, size_t src_size);
|
//*****************************************************************************
//
// pins.h - Defines the board-level pin connections.
//
// Copyright (c) 2008-2012 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of revision 8555 of the RDK-BDC24 Firmware Package.
//
//*****************************************************************************
#ifndef __PINS_H__
#define __PINS_H__
//*****************************************************************************
//
// Defines for the board connections to the Stellaris microcontroller.
//
//*****************************************************************************
#define UART_RX_PORT GPIO_PORTA_BASE
#define UART_RX_PIN GPIO_PIN_0
#define UART_TX_PORT GPIO_PORTA_BASE
#define UART_TX_PIN GPIO_PIN_1
#define LED_GREEN_PORT GPIO_PORTA_BASE
#define LED_GREEN_PIN GPIO_PIN_2
#define LED_GREEN_ON LED_GREEN_PIN
#define LED_GREEN_OFF 0
#define SERVO_PORT GPIO_PORTA_BASE
#define SERVO_PIN GPIO_PIN_3
#define SERVO_INT INT_GPIOA
#define CAN_RX_PORT GPIO_PORTA_BASE
#define CAN_RX_PIN GPIO_PIN_4
#define CAN_TX_PORT GPIO_PORTA_BASE
#define CAN_TX_PIN GPIO_PIN_5
#define HBRIDGE_AHI_PORT GPIO_PORTA_BASE
#define HBRIDGE_AHI_PIN GPIO_PIN_6
#define HBRIDGE_ALO_PORT GPIO_PORTA_BASE
#define HBRIDGE_ALO_PIN GPIO_PIN_7
#define HBRIDGE_BHI_PORT GPIO_PORTB_BASE
#define HBRIDGE_BHI_PIN GPIO_PIN_0
#define HBRIDGE_BLO_PORT GPIO_PORTB_BASE
#define HBRIDGE_BLO_PIN GPIO_PIN_1
#define I2C_SCL_PORT GPIO_PORTB_BASE
#define I2C_SCL_PIN GPIO_PIN_2
#define I2C_SDA_PORT GPIO_PORTB_BASE
#define I2C_SDA_PIN GPIO_PIN_3
#define GATE_RESET_PORT GPIO_PORTB_BASE
#define GATE_RESET_PIN GPIO_PIN_4
#define FAN_PORT GPIO_PORTB_BASE
#define FAN_PIN GPIO_PIN_5
#define FAN_ON FAN_PIN
#define FAN_OFF 0
#define LIMIT_REV_PORT GPIO_PORTB_BASE
#define LIMIT_REV_PIN GPIO_PIN_6
#define LIMIT_REV_OK 0
#define LIMIT_REV_ERR LIMIT_REV_PIN
#define LIMIT_FWD_PORT GPIO_PORTB_BASE
#define LIMIT_FWD_PIN GPIO_PIN_7
#define LIMIT_FWD_OK 0
#define LIMIT_FWD_ERR LIMIT_FWD_PIN
#define QEI_PHA_PORT GPIO_PORTC_BASE
#define QEI_PHA_PIN GPIO_PIN_4
#define QEI_PHA_INT INT_GPIOC
#define GATE_FAULT_PORT GPIO_PORTC_BASE
#define GATE_FAULT_PIN GPIO_PIN_5
#define QEI_PHB_PORT GPIO_PORTC_BASE
#define QEI_PHB_PIN GPIO_PIN_6
#define LED_RED_PORT GPIO_PORTC_BASE
#define LED_RED_PIN GPIO_PIN_7
#define LED_RED_ON LED_RED_PIN
#define LED_RED_OFF 0
#define QEI_INDEX_PORT GPIO_PORTD_BASE
#define QEI_INDEX_PIN GPIO_PIN_0
#define BRAKECOAST_PORT GPIO_PORTD_BASE
#define BRAKECOAST_PIN GPIO_PIN_2
#define BRAKECOAST_COAST BRAKECOAST_PIN
#define BRAKECOAST_BRAKE 0
#define ADC_CURRENT_PORT GPIO_PORTE_BASE
#define ADC_CURRENT_PIN GPIO_PIN_0
#define ADC_CURRENT_CH ADC_CTL_CH3
#define ADC_POSITION_PORT GPIO_PORTE_BASE
#define ADC_POSITION_PIN GPIO_PIN_2
#define ADC_POSITION_CH ADC_CTL_CH1
#define ADC_VBUS_PORT GPIO_PORTE_BASE
#define ADC_VBUS_PIN GPIO_PIN_3
#define ADC_VBUS_CH ADC_CTL_CH0
#define BUTTON_PORT GPIO_PORTE_BASE
#define BUTTON_PIN GPIO_PIN_4
#define BUTTON_DOWN 0
#define BUTTON_UP BUTTON_PIN
#endif // __PINS_H__
|
/*
Copyright (c) 2013, William Magato
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) AND CONTRIBUTORS ''AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the copyright holder(s) or contributors.
*/
#ifndef llamaos_net_intel_regs_txdctl_h_
#define llamaos_net_intel_regs_txdctl_h_
#include <cstdint>
#include <ostream>
namespace apps {
namespace net {
namespace intel {
namespace regs {
/**
* @brief Transmit Descriptor Control register.
*
*/
class TXDCTL
{
public:
/**
* @breif Construct from value.
*
* @param value Initial value (usually read from hardware).
*
*/
TXDCTL (uint32_t value);
/**
* @breif Convert to 32-bit integer.
*
*/
operator uint32_t () const;
/**
* @brief Prefetch Threshold value.
*
*/
uint8_t PTHRESH () const;
/**
* @brief Prefetch Threshold value.
*
*/
void PTHRESH (uint8_t threshold);
/**
* @brief Host Threshold value.
*
*/
uint8_t HTHRESH () const;
/**
* @brief Host Threshold value.
*
*/
void HTHRESH (uint8_t threshold);
/**
* @brief Write-back Threshold value.
*
*/
uint8_t WTHRESH () const;
/**
* @brief Write-back Threshold value.
*
*/
void WTHRESH (uint8_t threshold);
/**
* @brief Ganularity bit.
*
*/
bool GRAN () const;
/**
* @brief Ganularity bit.
*
*/
void GRAN (bool flag);
/**
* @brief Low Threshold value.
*
*/
uint8_t LWTHRESH () const;
/**
* @brief Low Threshold value.
*
*/
void LWTHRESH (uint8_t threshold);
private:
uint32_t value;
};
/**
* @brief Stream insertion operator.
*
*/
std::ostream &operator<< (std::ostream &, const TXDCTL &);
} } } }
#endif // llamaos_net_intel_regs_txdctl_h_
|
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2012 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PX_PHYSICS_COMMON_UTILS
#define PX_PHYSICS_COMMON_UTILS
#include "PxVec3.h"
#include "PxMat33.h"
#include "CmPhysXCommon.h"
namespace physx
{
namespace Cm
{
PX_INLINE void transformInertiaTensor(const PxVec3& invD, const PxMat33& M, PxMat33& mIInv)
{
const float axx = invD.x*M(0,0), axy = invD.x*M(1,0), axz = invD.x*M(2,0);
const float byx = invD.y*M(0,1), byy = invD.y*M(1,1), byz = invD.y*M(2,1);
const float czx = invD.z*M(0,2), czy = invD.z*M(1,2), czz = invD.z*M(2,2);
mIInv(0,0) = axx*M(0,0) + byx*M(0,1) + czx*M(0,2);
mIInv(1,1) = axy*M(1,0) + byy*M(1,1) + czy*M(1,2);
mIInv(2,2) = axz*M(2,0) + byz*M(2,1) + czz*M(2,2);
mIInv(0,1) = mIInv(1,0) = axx*M(1,0) + byx*M(1,1) + czx*M(1,2);
mIInv(0,2) = mIInv(2,0) = axx*M(2,0) + byx*M(2,1) + czx*M(2,2);
mIInv(1,2) = mIInv(2,1) = axy*M(2,0) + byy*M(2,1) + czy*M(2,2);
}
template <typename T, PxU32 size>
struct Block
{
PxU8 mem[sizeof(T)*size];
Block() {} // get around VS warning C4345, otherwise useless
};
// Array with externally managed storage.
// Allocation and resize policy are managed by the owner,
// Very minimal functionality right now, just POD types
template <typename T,
typename Owner,
typename IndexType,
void (Owner::*realloc)(T*& currentMem, IndexType& currentCapacity, IndexType size, IndexType requiredMinCapacity)>
class OwnedArray
{
public:
OwnedArray()
: mData(0)
, mCapacity(0)
, mSize(0)
{}
~OwnedArray() // owner must call releaseMem before destruction
{
PX_ASSERT(mCapacity==0);
}
void pushBack(T& element, Owner& owner)
{
// there's a failure case if here if we push an existing element which causes a resize -
// a rare case not worth coding around; if you need it, copy the element then push it.
PX_ASSERT(&element<mData || &element>=mData+mSize);
if(mSize==mCapacity)
(owner.*realloc)(mData, mCapacity, mSize, mSize+1);
PX_ASSERT(mData && mSize<mCapacity);
mData[mSize++] = element;
}
IndexType size() const
{
return mSize;
}
void replaceWithLast(IndexType index)
{
PX_ASSERT(index<mSize);
mData[index] = mData[--mSize];
}
T* begin() const
{
return mData;
}
T* end() const
{
return mData+mSize;
}
T& operator [](IndexType index)
{
PX_ASSERT(index<mSize);
return mData[index];
}
const T& operator [](IndexType index) const
{
PX_ASSERT(index<mSize);
return mData[index];
}
void reserve(IndexType capacity, Owner &owner)
{
if(capacity>=mCapacity)
(owner.*realloc)(mData, mCapacity, mSize, capacity);
}
void releaseMem(Owner &owner)
{
mSize = 0;
(owner.*realloc)(mData, mCapacity, 0, 0);
}
private:
T* mData;
IndexType mCapacity;
IndexType mSize;
// just in case someone tries to use a non-POD in here
union FailIfNonPod
{
T t;
int x;
};
};
} // namespace Cm
}
#endif
|
#pragma once
#include <botan/certstor.h>
#include <botan/credentials_manager.h>
namespace yael
{
namespace network
{
class ClientCredentials : public Botan::Credentials_Manager
{
public:
std::vector<Botan::Certificate_Store*> trusted_certificate_authorities(
const std::string& type,
const std::string& context) override
{
(void)type;
(void)context;
return { new Botan::Certificate_Store_In_Memory("cas") };
}
std::vector<Botan::X509_Certificate> cert_chain(
const std::vector<std::string>& cert_key_types,
const std::string& type,
const std::string& context) override
{
(void)cert_key_types;
(void)type;
(void)context;
return std::vector<Botan::X509_Certificate>();
}
Botan::Private_Key* private_key_for(const Botan::X509_Certificate& cert,
const std::string& type,
const std::string& context) override
{
(void)cert;
(void)type;
(void)context;
return nullptr;
}
};
}
}
|
#include<stdarg.h>
#include<stdio.h>
#include<stdlib.h>
#include<stdbool.h>
#include<string.h>
#include<unistd.h>
#include<dlfcn.h>
static int (*orig_isatty)(int) = 0;
static char* env = NULL;
static int env_len = 0;
static bool should_fake(int fd){
if(fd != 1 && fd != 2)
return false;
if(env_len >= 2){
return env[fd-1] == 'y';
}else if(fd == 1){
return true;
}
return false;
}
int isatty(int fd){
if(should_fake(fd)){
return 1;
}
return orig_isatty(fd);
}
void die(char *fmt, ...) {
va_list args;
va_start(args, fmt);
vfprintf(stderr, fmt, args);
va_end(args);
fprintf(stderr, "\n");
fflush(stderr);
exit(-1);
}
__attribute__ ((constructor)) static void setup(void) {
void *libhdl;
char *dlerr;
if (!(libhdl=dlopen("libc.so.6", RTLD_LAZY)))
die("Failed to patch library calls: %s", dlerror());
orig_isatty = dlsym(libhdl, "isatty");
if ((dlerr=dlerror()) != NULL)
die("Failed to patch isatty() library call: %s", dlerr);
env = getenv("ISATTY");
if(env)
env_len = strlen(env);
}
|
#ifdef ENABLE_QAC_TEST
#pragma PRQA_MESSAGES_OFF 0292
#endif
/*********************************************************************************************************************
* File Name : $Source: r_typedefs.h $
* Mod. Revision : $Revision: 1.6 $
* Mod. Date : $Date: 2014/09/10 11:53:29MESZ $
* Device(s) : All Renesas device families
* Description : This file contains the Renesas standard type definitions
*********************************************************************************************************************/
/*********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only intended for use with Renesas products.
* No other uses are authorized. This software is owned by Renesas Electronics Corporation and is protected under all
* applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED
* OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS ELECTRONICS CORPORATION NOR ANY OF ITS
* AFFILIATED COMPANIES SHALL BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR ANY
* REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
* DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software and to discontinue the availability of
* this software. By using this software, you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2014 Renesas Electronics Corporation. All rights reserved.
*********************************************************************************************************************/
#ifdef ENABLE_QAC_TEST
#pragma PRQA_MESSAGES_ON 0292
#endif
/*********************************************************************************************************************
* MISRA Rule: MISRA-C 2004 rule 3.1 (QAC message 0292)
* Reason: To support automatic insertion of revision, module name etc. by the source revision control system
* it is necessary to violate the rule, because the system uses non basic characters as placeholders.
* Verification: The placeholders are used in commentars only. Therefore rule violation cannot influency code
* compilation.
*********************************************************************************************************************/
#ifndef R_TYPEDEFS_H
#define R_TYPEDEFS_H
/*********************************************************************************************************************
* standard types definitions
*********************************************************************************************************************/
/*********************************************************************************************************************
* MISRA Rule: QAC message 4623, 4600
* Reason: QAC requests to use <stdint.h> and <stdbool.h> for the standard types. However, in order to support
non C99 compliant compilers too, the Renesas include file explicitly defining the standard types
is included into the library.
* Verification: Reviewed that the type definitions match the standard definitions (char = 8bit, short = 16bit,
long = 32bit)
*********************************************************************************************************************/
typedef signed char int8_t; /* PRQA S 4623 */
typedef unsigned char uint8_t; /* PRQA S 4623 */
typedef signed short int16_t; /* PRQA S 4623 */
typedef unsigned short uint16_t; /* PRQA S 4623 */
typedef signed long int32_t; /* PRQA S 4623 */
typedef unsigned long uint32_t; /* PRQA S 4623 */
typedef unsigned char rBool;
#define bool rBool /* PRQA S 4600 */
#define false 0 /* PRQA S 4600 */
#define true 1 /* PRQA S 4600 */
/*********************************************************************************************************************/
#endif /* #ifndef R_TYPEDEFS_H */
|
#pragma once
#include "afxwin.h"
class Cmd5dlg : public CDialog
{
public:
Cmd5dlg(CWnd* pParent = NULL);
enum { IDD = IDD_MD5_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual void OnOk();
virtual void OnCancel();
private:
void ShowLastError(CString FileName);
BOOL MD5SUM(CString FileName);
BOOL PumpMessage();
BOOL UpdateWindow(CFile* f);
protected:
HICON m_hIcon;
virtual BOOL OnInitDialog();
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
UINT m_toggle;
public:
afx_msg void OnDropFiles(HDROP hDropInfo);
afx_msg void OnClose();
CString m_edit;
CString m_title;
unsigned int m_argid;
CFont m_font;
afx_msg void OnSize(UINT nType, int cx, int cy);
CEdit m_editctrl;
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
};
|
/*-
* Copyright (c) 2006 Verdens Gang AS
* Copyright (c) 2006-2010 Linpro AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include <stdint.h>
#define VSC_CLASS "Stat"
#define VSC_TYPE_MAIN ""
#define VSC_TYPE_SMA "SMA"
#define VSC_TYPE_SMF "SMF"
#define VSC_TYPE_VBE "VBE"
#define VSC_TYPE_LCK "LCK"
#define VSC_F(n, t, l, f, e) t n;
#define VSC_DO(u,l,t) struct vsc_##l {
#define VSC_DONE(u,l,t) };
#include "vsc_all.h"
#undef VSC_DO
#undef VSC_F
#undef VSC_DONE
|
int srv_pid = sfd_spawn("disk0", /* Server instance name */
"/mnt/disk0", /* New server root directory */
"/run", /* UNIX socket directory -> /mnt/disk0/run */
100, /* Maximum number of concurrent transfers */
10000); /* Open file timeout in milliseconds */
|
/*
* Copyright (C) Igor Sysoev
* Copyright (C) NGINX, Inc.
*/
#ifndef _NXT_TYPES_H_INCLUDED_
#define _NXT_TYPES_H_INCLUDED_
/*
* off_t is 32 bit on Linux, Solaris and HP-UX by default.
* Must be before <sys/types.h>.
*/
#define _FILE_OFFSET_BITS 64
/* u_char, u_int, int8_t, int32_t, int64_t, size_t, off_t. */
#include <sys/types.h>
#include <inttypes.h>
#if (__LP64__)
#define NXT_64BIT 1
#define NXT_PTR_SIZE 8
#else
#define NXT_64BIT 0
#define NXT_PTR_SIZE 4
#endif
/*
* nxt_int_t corresponds to the most efficient integer type, an architecture
* word. It is usually the long type, however on Win64 the long is int32_t,
* so pointer size suits better. nxt_int_t must be no less than int32_t.
*/
#if (__amd64__)
/*
* AMD64 64-bit multiplication and division operations are slower and 64-bit
* instructions are longer.
*/
#define NXT_INT_T_SIZE 4
typedef int nxt_int_t;
typedef u_int nxt_uint_t;
#else
#define NXT_INT_T_SIZE NXT_PTR_SIZE
typedef intptr_t nxt_int_t;
typedef uintptr_t nxt_uint_t;
#endif
typedef nxt_uint_t nxt_bool_t;
/*
* nxt_off_t corresponds to OS's off_t, a file offset type. Although Linux,
* Solaris, and HP-UX define both off_t and off64_t, setting _FILE_OFFSET_BITS
* to 64 defines off_t as off64_t.
*/
#if (NXT_WINDOWS)
/* Windows defines off_t as a 32-bit "long". */
typedef __int64 nxt_off_t;
#else
typedef off_t nxt_off_t;
#endif
/*
* nxt_time_t corresponds to OS's time_t, time in seconds. nxt_time_t is
* a signed integer. OS's time_t may be an integer or real-floating type,
* though it is usually a signed 32-bit or 64-bit integer depending on
* platform bits length. There are however exceptions, e.g., time_t is:
* 32-bit on 64-bit NetBSD prior to 6.0 version;
* 64-bit on 32-bit NetBSD 6.0;
* 32-bit on 64-bit OpenBSD;
* 64-bit in Linux x32 ABI;
* 64-bit in 32-bit Visual Studio C++ 2005.
*
* Besides, QNX defines time_t as uint32_t.
*/
#if (NXT_QNX)
/* Y2038 fix: "typedef int64_t nxt_time_t". */
typedef int32_t nxt_time_t;
#else
/* Y2038, if time_t is 32-bit integer. */
typedef time_t nxt_time_t;
#endif
#endif /* _NXT_TYPES_H_INCLUDED_ */
|
#ifndef CVSIMPLEVIEWER_H
#define CVSIMPLEVIEWER_H
#include "simpleimageviewer.h"
#include "cvwidgets_config.h"
namespace cv {
class Mat;
}
class CV_WIDGET_LIBSHARED_EXPORT CVSimpleViewer : public SimpleImageViewer
{
Q_OBJECT
public:
CVSimpleViewer(QWidget *parent = 0);
void setCVMat(const cv::Mat &image, bool contrast = false, bool conversion = true);
};
#endif // CVSIMPLEVIEWER_H
|
/*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list
of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef INTERNAL_EXTRACTOR_EDGE_H
#define INTERNAL_EXTRACTOR_EDGE_H
#include "../typedefs.h"
#include "../DataStructures/TravelMode.h"
#include <osrm/Coordinate.h>
#include <boost/assert.hpp>
struct InternalExtractorEdge
{
InternalExtractorEdge()
: start(0), target(0), direction(0), speed(0), name_id(0), is_roundabout(false),
is_in_tiny_cc(false), is_duration_set(false), is_access_restricted(false),
travel_mode(TRAVEL_MODE_INACCESSIBLE), is_split(false)
{
}
explicit InternalExtractorEdge(NodeID start,
NodeID target,
short direction,
double speed,
unsigned name_id,
bool is_roundabout,
bool is_in_tiny_cc,
bool is_duration_set,
bool is_access_restricted,
TravelMode travel_mode,
bool is_split)
: start(start), target(target), direction(direction), speed(speed),
name_id(name_id), is_roundabout(is_roundabout), is_in_tiny_cc(is_in_tiny_cc),
is_duration_set(is_duration_set), is_access_restricted(is_access_restricted),
travel_mode(travel_mode), is_split(is_split)
{
}
// necessary static util functions for stxxl's sorting
static InternalExtractorEdge min_value()
{
return InternalExtractorEdge(0, 0, 0, 0, 0, false, false, false, false, TRAVEL_MODE_INACCESSIBLE, false);
}
static InternalExtractorEdge max_value()
{
return InternalExtractorEdge(
SPECIAL_NODEID, SPECIAL_NODEID, 0, 0, 0, false, false, false, false, TRAVEL_MODE_INACCESSIBLE, false);
}
NodeID start;
NodeID target;
short direction;
double speed;
unsigned name_id;
bool is_roundabout;
bool is_in_tiny_cc;
bool is_duration_set;
bool is_access_restricted;
TravelMode travel_mode : 4;
bool is_split;
FixedPointCoordinate source_coordinate;
FixedPointCoordinate target_coordinate;
};
struct CmpEdgeByStartID
{
using value_type = InternalExtractorEdge;
bool operator()(const InternalExtractorEdge &a, const InternalExtractorEdge &b) const
{
return a.start < b.start;
}
value_type max_value() { return InternalExtractorEdge::max_value(); }
value_type min_value() { return InternalExtractorEdge::min_value(); }
};
struct CmpEdgeByTargetID
{
using value_type = InternalExtractorEdge;
bool operator()(const InternalExtractorEdge &a, const InternalExtractorEdge &b) const
{
return a.target < b.target;
}
value_type max_value() { return InternalExtractorEdge::max_value(); }
value_type min_value() { return InternalExtractorEdge::min_value(); }
};
#endif // INTERNAL_EXTRACTOR_EDGE_H
|
//
// MPLogging.h
// HelloMixpanel
//
// Created by Alex Hofsteede on 7/11/14.
// Copyright (c) 2014 Mixpanel. All rights reserved.
//
#ifndef HelloMixpanel_MPLogging_h
#define HelloMixpanel_MPLogging_h
static inline void MPLog(NSString *format, ...) {
__block va_list arg_list;
va_start (arg_list, format);
NSString *formattedString = [[NSString alloc] initWithFormat:format arguments:arg_list];
va_end(arg_list);
NSLog(@"[Mixpanel] %@", formattedString);
}
#ifdef MIXPANEL_ERROR
#define MixpanelError(...) MPLog(__VA_ARGS__)
#else
#define MixpanelError(...)
#endif
#ifdef MIXPANEL_DEBUG
#define MixpanelDebug(...) MPLog(__VA_ARGS__)
#else
#define MixpanelDebug(...)
#endif
#ifdef MIXPANEL_MESSAGING_DEBUG
#define MessagingDebug(...) MPLog(__VA_ARGS__)
#else
#define MessagingDebug(...)
#endif
#endif
|
/* --------------------------------------------------------------------------
* Name: bsearch.h
* Purpose: Searching arrays
* ----------------------------------------------------------------------- */
#ifndef APPENGINE_BSEARCH_H
#define APPENGINE_BSEARCH_H
#include <stddef.h>
/* Binary search an array 'nelems' long for 'want'.
* Each array element is 'stride' bytes wide.
*/
int bsearch_short(const short *array,
size_t nelems,
size_t stride,
short want);
int bsearch_ushort(const unsigned short *array,
size_t nelems,
size_t stride,
unsigned short want);
int bsearch_int(const int *array,
size_t nelems,
size_t stride,
int want);
int bsearch_uint(const unsigned int *array,
size_t nelems,
size_t stride,
unsigned int want);
#endif /* APPENGINE_BSEARCH_H */
|
// Copyright (c) 2020 The Orbit 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 ORBIT_SSH_SSH_CREDENTIALS_H_
#define ORBIT_SSH_SSH_CREDENTIALS_H_
#include <filesystem>
#include <string>
#include "OrbitSsh/AddrAndPort.h"
namespace orbit_ssh {
struct Credentials {
AddrAndPort addr_and_port;
std::string user;
std::filesystem::path known_hosts_path;
std::filesystem::path key_path;
};
} // namespace orbit_ssh
#endif // ORBIT_SSH_SSH_CREDENTIALS_H_ |
/****************************************************************************
* configs/mcu123-lpc214x/src/lpc2148_usbmsc.c
*
* Copyright (C) 2008-2010 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Configure and register the LPC214x MMC/SD SPI block driver.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <syslog.h>
#include <errno.h>
#include <nuttx/spi/spi.h>
#include <nuttx/mmcsd.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/* Configuration ************************************************************/
#ifndef CONFIG_SYSTEM_USBMSC_DEVMINOR1
# define CONFIG_SYSTEM_USBMSC_DEVMINOR1 0
#endif
/* PORT and SLOT number probably depend on the board configuration */
#ifdef CONFIG_ARCH_BOARD_MCU123
# undef LPC214X_MMCSDSPIPORTNO
# define LPC214X_MMCSDSPIPORTNO 1
# undef LPC214X_MMCSDSLOTNO
# define LPC214X_MMCSDSLOTNO 0
#else
/* Add configuration for new LPC214x boards here */
# error "Unrecognized LPC214x board"
#endif
/****************************************************************************
* Public Functions
****************************************************************************/
/****************************************************************************
* Name: usbmsc_archinitialize
*
* Description:
* Perform architecture specific initialization
*
****************************************************************************/
int usbmsc_archinitialize(void)
{
FAR struct spi_dev_s *spi;
int ret;
/* Get the SPI port */
syslog(LOG_INFO, "Initializing SPI port %d\n",
LPC214X_MMCSDSPIPORTNO);
spi = up_spiinitialize(LPC214X_MMCSDSPIPORTNO);
if (!spi)
{
syslog(LOG_ERR, "ERROR: Failed to initialize SPI port %d\n",
LPC214X_MMCSDSPIPORTNO);
return -ENODEV;
}
syslog(LOG_INFO, "Successfully initialized SPI port %d\n",
LPC214X_MMCSDSPIPORTNO);
/* Bind the SPI port to the slot */
syslog(LOG_INFO, "Binding SPI port %d to MMC/SD slot %d\n",
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
ret = mmcsd_spislotinitialize(CONFIG_SYSTEM_USBMSC_DEVMINOR1,
LPC214X_MMCSDSLOTNO, spi);
if (ret < 0)
{
syslog(LOG_ERR,
"ERROR: Failed to bind SPI port %d to MMC/SD slot %d: %d\n",
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO, ret);
return ret;
}
syslog(LOG_INFO, "Successfully bound SPI port %d to MMC/SD slot %d\n",
LPC214X_MMCSDSPIPORTNO, LPC214X_MMCSDSLOTNO);
return OK;
}
|
#ifndef MIST32_IO_H
#define MIST32_IO_H
/* FIFO remaining */
#define FIFO_USED(start, end, size) ((end + size - start) % size)
/* io.c */
void io_init(void);
void io_close(void);
void *io_addr_get(Memory addr);
void io_load(Memory addr);
void io_store(Memory addr);
#endif /* MIST32_IO_H */
|
/*************************************************************************
* Copyright (c) 2015, Synopsys, Inc. *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions are *
* met: *
* *
* 1. Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR *
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT *
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, *
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, *
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY *
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE *
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
*************************************************************************/
#ifndef _gtHorzBox_h
#define _gtHorzBox_h
// gtHorzBox.h
//------------------------------------------
// synopsis:
// Manager suitable for aligning children horizontally.
//------------------------------------------
#ifndef _gtManager_h
#include <gtManager.h>
#endif
class gtHorzBox : public gtManager
{
public:
static gtHorzBox* create(gtBase* parent, const char* name);
~gtHorzBox();
virtual void margins(int h, int v) = 0;
virtual void packing(gtPacking) = 0;
virtual void rows(int) = 0;
protected:
gtHorzBox();
};
/*
START-LOG-------------------------------------------
$Log: gtHorzBox.h $
Revision 1.1 1993/02/24 13:29:26EST builder
made from unix file
* Revision 1.2.1.3 1992/12/30 19:08:54 glenn
* Add margins, packing, rows.
*
* Revision 1.2.1.2 1992/10/09 18:10:10 jon
* RCS history fixup
*
* Revision 1.2.1.1 92/10/07 20:33:37 smit
* *** empty log message ***
*
* Revision 1.2 92/10/07 20:33:36 smit
* *** empty log message ***
*
* Revision 1.1 92/10/07 18:19:50 smit
* Initial revision
*
END-LOG---------------------------------------------
*/
#endif // _gtHorzBox_h
|
/*
* Copyright 2016, Data61, CSIRO (ABN 41 687 119 230)
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#include "../../common.h"
#include "../../state.h"
#include "pagedir.h"
#include <sel4utils/mapping.h>
/*! @file
@brief Static page directory allocator.
This procserv module is responsible for allocation and deallocation of client kernel page
directory objects, and root cnode objects. Because these objects are really big, continually
allocating and re-allocating them could fail due to memory fragmentation.
*/
#define PD_ID_BASE 1
void
pd_init(struct pd_list *pdlist)
{
assert(pdlist);
/* Initialise the allocation pool. */
dprintf("Initialising static Page Directory pool (sized %d)...\n", PD_MAX);
cpool_init(&pdlist->PDpool, PD_ID_BASE, PD_ID_BASE + PD_MAX);
/* Statically allocate the page directories. */
for (int i = 0; i < PD_MAX; i++) {
/* Allocate the kernel vspace_root. */
int error = vka_alloc_vspace_root(&procServ.vka, &pdlist->pd[i]);
if (error) {
ROS_ERROR("Failed to allocate vspace root. error %d\n", error);
assert(!"Procserv initialisation failed. Try lowering CONFIG_PROCSERV_MAX_VSPACES.");
return;
}
assert(pdlist->pd[i].cptr != 0);
/* If we are on mainline, we need to assign a kernel ASID. ASID Pools have been removed
from the newer experimental kernels. */
#ifndef CONFIG_KERNEL_STABLE
#ifndef CONFIG_X86_64
error = seL4_ARCH_ASIDPool_Assign(seL4_CapInitThreadASIDPool, pdlist->pd[i].cptr);
assert(error == seL4_NoError);
#endif
#endif
/* Allocate the kernel Root CNode object. */
error = vka_alloc_cnode_object(&procServ.vka, REFOS_CSPACE_RADIX, &pdlist->cnode[i]);
if (error) {
ROS_ERROR("Failed to allocate Root CNode. error %d\n", error);
assert(!"Procserv initialisation failed. Try lowering CONFIG_PROCSERV_MAX_VSPACES.");
return;
}
assert(pdlist->cnode[i].cptr != 0);
}
}
struct pd_info
pd_assign(struct pd_list *pdlist)
{
assert(pdlist);
struct pd_info info;
uint32_t pdID = cpool_alloc(&pdlist->PDpool);
if (!pdID) {
info.kpdObject = 0;
info.kcnodeObject = 0;
return info;
}
info.kpdObject = pdlist->pd[pdID - 1].cptr;
info.kcnodeObject = pdlist->cnode[pdID - 1].cptr;
return info;
}
void
pd_free(struct pd_list *pdlist, seL4_CPtr pdPtr)
{
assert(pdlist);
/* First, we loop through our list and find the associated vka object with this given cptr. */
int idx = -1;
for (int i = 0; i < PD_MAX; i++) {
if (pdlist->pd[i].cptr == pdPtr) {
idx = i;
break;
}
}
if (idx == -1) {
/* Could not find the given cptr. */
ROS_WARNING("pd_free failed: no such page directory cptr %d\n", pdPtr);
return;
}
if (cpool_check(&pdlist->PDpool, idx + 1)) {
/* Already free. */
ROS_WARNING("pd_free failed: page directory cptr %d is already free.\n", pdPtr);
return;
}
/* Delete all derived caps from this PD. */
cspacepath_t cpath;
vka_cspace_make_path(&procServ.vka, pdPtr, &cpath);
vka_cnode_revoke(&cpath);
/* Delete this PD's associated root CNode. */
vka_cspace_make_path(&procServ.vka, pdlist->cnode[idx].cptr, &cpath);
vka_cnode_revoke(&cpath);
vka_cnode_delete(&cpath);
vka_free_object(&procServ.vka, &pdlist->cnode[idx]);
/* Allocate a new kernel Root CNode object. */
int error = vka_alloc_cnode_object(&procServ.vka, REFOS_CSPACE_RADIX, &pdlist->cnode[idx]);
if (error) {
ROS_ERROR("Failed to re-allocate Root CNode. error %d\n", error);
return;
}
/* Put it back into the allocation pool. */
cpool_free(&pdlist->PDpool, idx + 1);
}
|
//
// ViewController.h
// notion
//
// Created by Seppo on 5/22/15.
// Copyright (c) 2015 seppo0010. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController {
NSString* _clue;
}
- (void) viewModeAnimated:(BOOL)animated;
- (IBAction)viewMode;
- (IBAction)editMode;
@property NSString* clue;
@end |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "sqlite3ext.h"
#include "callnumber.h"
#include "lccn_patterns.h"
SQLITE_EXTENSION_INIT1
static void normalize_callnumber_sqlite(
sqlite3_context* ctx,
int n_vals,
sqlite3_value** vals
){
const char* val = sqlite3_value_text(vals[0]); // this is just a pointer, not allocated. Does not need to be free()d.
char* cn_string = normalize_callnumber(val); // this does need to be free()d.
if (cn_string == NULL){
sqlite3_result_null(ctx);
}else{
sqlite3_result_text(ctx, cn_string, strlen(cn_string), free);
}
}
static int compare_callnumber_strings_sqlite(
void* not_used,
int s1len,
const void* s1,
int s2len,
const void* s2
){
char* str1 = (char*) s1;
char* str2 = (char*) s2;
return compare_callnumber_strings(s1len, str1, s2len, str2);
}
int sqlite3_extension_init(
sqlite3 *db,
char **pzErrMsg,
const sqlite3_api_routines *pApi
){
const char *e_msg;
int e_offset;
//these global variables are required within callnumber.c
re_is_cn = pcre_compile(P_IS_CN, 0, &e_msg, &e_offset, NULL);
if (re_is_cn == NULL){
printf("Error compiling P_IS_CN at character: %d\n. Message: %s\n", e_offset, e_msg);
exit(1);
}
pe_is_cn = pcre_study(re_is_cn, 0, &e_msg);
SQLITE_EXTENSION_INIT2(pApi)
sqlite3_create_collation(db, "LCCN", SQLITE_UTF8, NULL, compare_callnumber_strings_sqlite);
sqlite3_create_function(db, "NORMALIZE_LCCN", 1, SQLITE_UTF8, NULL, normalize_callnumber_sqlite, NULL, NULL);
return 0;
}
|
// Copyright (c) 2014, Jochen Kempfle
// All rights reserved.
/*
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*/
#ifndef VECTOR_H
#define VECTOR_H
namespace capability_map_generator
{
// small helper class used for coordinates and vectors
class Vector
{
public:
Vector() { }
~Vector() { }
Vector(double xVal, double yVal, double zVal) : x(xVal), y(yVal), z(zVal) { }
Vector(const Vector &rhs) : x(rhs.x), y(rhs.y), z(rhs.z) { }
inline Vector operator*(double rhs) const { return Vector(x * rhs, y * rhs, z * rhs); }
inline Vector operator+(const Vector &rhs) const { return Vector(x + rhs.x, y + rhs.y, z + rhs.z); }
inline Vector cross(const Vector &rhs) const
{
return Vector(y * rhs.z - z * rhs.y, z * rhs.x - x * rhs.z, x * rhs.y - y * rhs.x);
}
inline double dot(const Vector &rhs) const
{
return x * rhs.x + y * rhs.y + z * rhs.z;
}
double x, y, z;
};
}
#endif // VECTOR_H
|
/**
* \file modelconv.h
* \brief Class to handle parsing and converting 3D model data.
* \author Gregory Gluszek.
*/
#ifndef _MODEL_CONV_
#define _MODEL_CONV_
#include <stdint.h>
#include <string>
#include <vector>
#include <list>
#include <unordered_map>
#include <math.h>
class ModelConv
{
public:
ModelConv(const char* filename);
~ModelConv();
void exportBinStl(const char* filename);
void exportSvg(const char* filename);
void debugPrint();
protected:
//TODO: make into class? construction and init being taken care of correctly in code?
struct Normal
{
float i;
float j;
float k;
bool operator==(const Normal& rhs) const
{
//TODO: Is this the best way to control thresholding the imprecision of float conversions?
return (fabs(rhs.i-i) < .00001) &&
(fabs(rhs.j-j) < .00001) &&
(fabs(rhs.k- k) < .00001);
}
};
//TODO: make into class? construction and init being taken care of correctly in code?
struct Vertex
{
float x;
float y;
float z;
bool operator==(const Vertex& rhs) const
{
return (rhs.x == x) && (rhs.y == y) && (rhs.z == z);
}
};
// Since this struct is used to read from a packed file, we need to
// compress data to match
#pragma pack(push, 1)
struct BinStlTriangle
{
Normal normal; //!< Normal vector of triangle.
Vertex vertices[3];
uint16_t attrByteCnt; //!< Attribute byte count. Unused.
};
#pragma pack(pop)
// Back to default packing
//TODO: make into class? construction and init being taken care of correctly in code?
struct Triangle
{
Normal normal; //!< Normal vector of triangle.
Vertex* vertices[3]; //!< A triangle is defined by three
//!< vertices. Each entry points to an object stored in
//!< vertices.
Triangle* neighbors[3]; //!< A triangle can have up to
//!< three adjacent triangles. NULL indicates an
//!< unconnected or open edge in the object.
//!< neighbor[0] is on edge made by vertices 0 to 1
//!< neighbor[1] is on edge made by vertices 1 to 2
//!< neighbor[2] is on edge made by vertices 2 to 0
};
//TODO: make into class? construction and init being taken care of correctly in code?
struct Face
{
Normal normal;
std::vector<const Triangle*> triangles; //!< All triangles that
//!< make up a face. Mostly included for debug or
//!< face to object export.
std::list<const Vertex*> border; //!< Vertices that define
//!< border of the face.
};
std::string to_string(const Normal& normal);
std::string to_string(const Vertex& vertex);
std::string to_string(const Triangle& triangle);
Vertex& addVertex(const Vertex& vertex);
void checkAdjacent(Triangle& tri1, Triangle& tri2);
void addNeighbor(Triangle& tri, Triangle& neighbor,
uint8_t sharedVtxs);
void buildFace(const Triangle& tri, Face& face,
std::unordered_map<const Triangle*, int>& faceMap,
std::unordered_map<const Triangle*, int>& travMap);
void insertVertex(Face& face, const Triangle& tri, int neighborIndex);
void exportBinStl(const char* filename,
const std::vector<const Triangle*>& triangles);
uint8_t binStlHeader[80]; //!< Header read from binary STL file.
std::vector<Vertex*> vertices; //!< Unique entry for each vertex in
//!< object.
std::vector<Triangle*> triangles; //!< Unique entry for each trianlge
//!< in the object.
std::vector<Face*> faces; //!< Unique entry for each face of the object.
};
#endif /* _MODEL_CONV_ */
|
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_SYNC_ENGINE_SYNC_STATUS_OBSERVER_H_
#define COMPONENTS_SYNC_ENGINE_SYNC_STATUS_OBSERVER_H_
#include "components/sync/engine/sync_status.h"
namespace syncer {
class SyncStatusObserver {
public:
SyncStatusObserver();
virtual ~SyncStatusObserver();
// This event is sent when SyncStatus changes.
virtual void OnSyncStatusChanged(const SyncStatus& status) = 0;
};
} // namespace syncer
#endif // COMPONENTS_SYNC_ENGINE_SYNC_STATUS_OBSERVER_H_
|
// Copyright 2014 The Cobalt 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.
#ifndef COBALT_DOM_ATTR_H_
#define COBALT_DOM_ATTR_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "cobalt/script/wrappable.h"
namespace cobalt {
namespace dom {
class Element;
class NamedNodeMap;
// This type represents a DOM element's attribute as an object.
// https://www.w3.org/TR/2014/WD-dom-20140710/#interface-attr
//
// Starting from DOM4, Attr no longer inherits from Node.
//
// This class is designed to proxy the actual attribute value which is stored
// in the Element and be created only on demand.
class Attr : public script::Wrappable,
public base::SupportsWeakPtr<Attr> {
public:
// If container is NULL, the Attr will be created in a detached state.
Attr(const std::string& name, const std::string& value,
const scoped_refptr<const NamedNodeMap>& container);
// Web API: Attr
const std::string& name() const { return name_; }
const std::string& node_name() const {
// TODO: Report deprecated attribute.
return name_;
}
const std::string& value() const { return value_; }
void set_value(const std::string& value);
const std::string& node_value() const;
DEFINE_WRAPPABLE_TYPE(Attr);
void TraceMembers(script::Tracer* tracer) override;
private:
~Attr();
// Used by NamedNodeMap to set the value of Attr without triggering an
// update in the proxied Element.
void SetValueInternal(const std::string& value) { value_ = value; }
// Used by NamedNodeMap to attach the Attr to itself.
scoped_refptr<const NamedNodeMap> container() const;
void set_container(const scoped_refptr<const NamedNodeMap>& value);
// Name of the attribute.
const std::string name_;
// Value of the attribute.
std::string value_;
// Pointer to the NamedNodeMap that contains this Attr.
scoped_refptr<const NamedNodeMap> container_;
friend class NamedNodeMap;
DISALLOW_COPY_AND_ASSIGN(Attr);
};
} // namespace dom
} // namespace cobalt
#endif // COBALT_DOM_ATTR_H_
|
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef mitkPlaneGeometryDataMapper2D_h
#define mitkPlaneGeometryDataMapper2D_h
#include "mitkVtkMapper.h"
#include "mitkBaseRenderer.h"
#include <MitkCoreExports.h>
#include <mitkWeakPointer.h>
#include <vtkSmartPointer.h>
class vtkActor2D;
class vtkPropAssembly;
class vtkFloatArray;
class vtkCellArray;
class vtkPolyDataMapper2D;
namespace mitk {
/**
* @brief Vtk-based 2D mapper for rendering a crosshair with the plane geometry.
*
* This mapper uses the mitkPlaneGeometryData from the three helper objects in
* the StdMultiWidget to render a crosshair in all 2D render windows. The crosshair
* is assembled as lines and rendered with a vtkPolyDataMapper. The mapper
* requires multiple plane geometry to compute the correct crosshair position.
* The plane bounds are computed using either ReferenceGeometry if it is present or
* the plane geometry itself otherwise.
* The mapper offers the following properties:
* \b Crosshair.Line width: The thickness of the crosshair.
* \b Crosshair.Gap Size: The gap between the lines in pixels.
* \b Crosshair.Orientation Decoration: Adds a PlaneOrientationProperty, which
* indicates the direction of the plane normal. See mitkPlaneOrientationProperty.
*
* @ingroup Mapper
*/
class MITKCORE_EXPORT PlaneGeometryDataMapper2D : public VtkMapper
{
public:
mitkClassMacro(PlaneGeometryDataMapper2D, VtkMapper);
itkFactorylessNewMacro(Self)
itkCloneMacro(Self)
virtual const mitk::PlaneGeometryData* GetInput() const;
/** \brief returns the a prop assembly */
virtual vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
/** Applies properties specific to this mapper */
virtual void ApplyAllProperties( BaseRenderer *renderer );
virtual void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
/** \brief set the default properties for this mapper */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = NULL, bool overwrite = false);
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
class LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/* constructor */
LocalStorage();
/* destructor */
~LocalStorage();
// actor
vtkSmartPointer<vtkActor2D> m_CrosshairActor;
vtkSmartPointer<vtkActor2D> m_CrosshairHelperLineActor;
vtkSmartPointer<vtkActor2D> m_ArrowActor;
vtkSmartPointer<vtkPolyDataMapper2D> m_HelperLinesmapper;
vtkSmartPointer<vtkPolyDataMapper2D> m_Arrowmapper;
vtkSmartPointer<vtkPolyDataMapper2D> m_Mapper;
vtkSmartPointer<vtkPropAssembly> m_CrosshairAssembly;
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
protected:
/* constructor */
PlaneGeometryDataMapper2D();
/* destructor */
virtual ~PlaneGeometryDataMapper2D();
/* \brief Applies the color and opacity properties and calls CreateVTKRenderObjects */
virtual void GenerateDataForRenderer(mitk::BaseRenderer* renderer) override;
void CreateVtkCrosshair(BaseRenderer *renderer);
static bool TestPointInPlaneGeometry(const PlaneGeometry* planeGeometry, const Point3D& point);
static bool TestPointInReferenceGeometry(const BaseGeometry* referenceGeometry, const Point3D& point);
static bool CutCrossLineWithPlaneGeometry(const PlaneGeometry* planeGeometry, Line3D &crossLine);
static bool CutCrossLineWithReferenceGeometry(const BaseGeometry* referenceGeometry, Line3D &crossLine);
/**
* \brief Returns the thick slice mode for the given datanode.
*
* This method returns the value of the 'reslice.thickslices' property for
* the given datanode.
* '0': thick slice mode disabled
* '1': thick slice mode enabled
*
* The variable 'thickSlicesNum' contains the value of the 'reslice.thickslices.num'
* property that defines how many slices are shown at once.
*/
int DetermineThickSliceMode( DataNode * dn, int &thickSlicesNum );
void DrawLine(Point3D p0, Point3D p1,
vtkCellArray *lines,
vtkPoints *points);
// member variables holding the current value of the properties used in this mapper
typedef std::vector<DataNode*> NodesVectorType;
NodesVectorType m_OtherPlaneGeometries;
typedef std::set<Self*> AllInstancesContainer;
static AllInstancesContainer s_AllInstances;
bool m_RenderOrientationArrows;
bool m_ArrowOrientationPositive;
mitk::ScalarType m_DepthValue;
void ApplyColorAndOpacityProperties2D(BaseRenderer *renderer, vtkActor2D *actor);
void DrawOrientationArrow(vtkSmartPointer<vtkCellArray> triangles,
vtkSmartPointer<vtkPoints> triPoints,
double triangleSizeMM,
Vector3D& orthogonalVector,
Point3D& point1, Point3D& point2);
};
} // namespace mitk
#endif /* mitkPlaneGeometryDataMapper2D_h */
|
#define BFD_VERSION_DATE 20050612
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_string@
|
#ifndef HANDLE_H
#define HANDLE_H
#include "Object.h"
#include "Thread.h"
#include "Dictionary.h"
#include <string.h>
#define REMEMBER_SCOPE_POSITION 0
typedef struct Handle {
void *object;
struct Handle *prev;
struct Handle *next;
} Handle;
typedef struct HandleScope {
struct HandleScope *parent;
Object handles[1024];
size_t size;
#if REMEMBER_SCOPE_POSITION
char *file;
size_t line;
#endif
} HandleScope;
typedef struct {
Handle *current;
} HandlesIterator;
typedef struct {
HandleScope *current;
} HandleScopeIterator;
typedef struct {
Object *nil;
Object *false;
Object *true;
Class *MetaClass;
Class *UndefinedObject;
Class *True;
Class *False;
Class *SmallInteger;
Class *Symbol;
Class *Character;
//Class *Float;
Class *String;
Class *Array;
Class *ByteArray;
Class *Association;
Class *Dictionary;
Class *OrderedCollection;
Class *Class;
Class *TypeFeedback;
Class *CompiledMethod;
Class *CompiledBlock;
Class *SourceCode;
Class *FileSourceCode;
Class *Block;
Class *Message;
Class *MethodContext;
Class *BlockContext;
Class *ExceptionHandler;
Class *ClassNode;
Class *MethodNode;
Class *BlockNode;
Class *BlockScope;
Class *ExpressionNode;
Class *MessageExpressionNode;
Class *NilNode;
Class *TrueNode;
Class *FalseNode;
Class *VariableNode;
Class *IntegerNode;
Class *CharacterNode;
Class *SymbolNode;
Class *StringNode;
Class *ArrayNode;
Class *ParseError;
Class *UndefinedVariableError;
Class *RedefinitionError;
Class *ReadonlyVariableError;
Class *InvalidPragmaError;
Class *IoError;
Dictionary *Smalltalk;
Array *SymbolTable;
String *initializeSymbol;
String *finalizeSymbol;
String *valueSymbol;
String *value_Symbol;
String *valueValueSymbol;
String *doesNotUnderstandSymbol;
String *cannotReturnSymbol;
String *handlesSymbol;
String *generateBacktraceSymbol;
} SmalltalkHandles;
extern SmalltalkHandles Handles;
static void *scopeHandle(void *object);
static void *closeHandleScope(HandleScope *scope, void *handle);
static void *persistHandle(void *handle);
static void *handle(void *object);
void freeHandle(void *handle);
void freeHandles(void);
void *newObject(Class *class, size_t size);
static Value getTaggedPtr(void *handle);
Object *copyResizedObject(Object *object, size_t newSize);
void initHandlesIterator(HandlesIterator *iterator, Handle *handles);
_Bool handlesIteratorHasNext(HandlesIterator *iterator);
Object *handlesIteratorNext(HandlesIterator *iterator);
void initHandleScopeIterator(HandleScopeIterator *iterator, HandleScope *scopes);
_Bool handleScopeIteratorHasNext(HandleScopeIterator *iterator);
HandleScope *handleScopeIteratorNext(HandleScopeIterator *iterator);
#if REMEMBER_SCOPE_POSITION
#define openHandleScope(scope) _openHandleScope(scope, __FILE__, __LINE__)
static void _openHandleScope(HandleScope *scope, char *file, size_t line)
{
memset(scope, 0, sizeof(*scope));
scope->parent = CurrentThread.handleScopes;
scope->file = file;
scope->line = line;
CurrentThread.handleScopes = scope;
}
#else
static void openHandleScope(HandleScope *scope)
{
memset(scope, 0, sizeof(*scope));
scope->parent = CurrentThread.handleScopes;
CurrentThread.handleScopes = scope;
}
#endif
static void *closeHandleScope(HandleScope *scope, void *handle)
{
ASSERT(CurrentThread.handleScopes == scope);
CurrentThread.handleScopes = CurrentThread.handleScopes->parent;
if (handle != NULL) {
ASSERT(CurrentThread.handleScopes != NULL);
return scopeHandle(((Object *) handle)->raw);
}
return NULL;
}
static void *scopeHandle(void *object)
{
ASSERT(CurrentThread.handleScopes != NULL);
ASSERT(CurrentThread.handleScopes->size < 256);
Object *handle = &CurrentThread.handleScopes->handles[CurrentThread.handleScopes->size++];
handle->raw = object;
return handle;
}
static void *persistHandle(void *object)
{
return handle(((Object *) object)->raw);
}
static void *handle(void *object)
{
Handle *handle = malloc(sizeof(Handle));
ASSERT(handle != NULL);
handle->object = object;
handle->prev = NULL;
handle->next = CurrentThread.handles;
CurrentThread.handles = handle;
return (void *) handle;
}
static Value getTaggedPtr(void *handle)
{
return tagPtr(((Object *) handle)->raw);
}
#endif
|
#ifdef MSDOS
#define JDOS 0 /* PS/55 ú{êDOS */
#define PCDOS 1 /* PC DOS */
#define DOSVJ 2 /* DOS/V ú{êÓ°ÄÞ */
#define DOSVE 3 /* DOS/V pêÓ°ÄÞ */
#define AXJ 4 /* AX ú{êÓ°ÄÞ */
#define AXE 5 /* AX pêÓ°ÄÞ */
#define J3100J 6 /* J3100 ú{êÓ°ÄÞ */
#define J3100E 7 /* J3100 pêÓ°ÄÞ */
#define DRDOSJ 8 /* DR-DOS ú{êÓ°ÄÞ */
#define DRDOSE 9 /* DR-DOS pêÓ°ÄÞ */
#define PC9801 10 /* PC-9801 */
#define PC9801H 11 /* PC-9801 Hireso */
# if (defined __386__)
# include <dos.h>
extern union REGS ir, or;
unsigned short getvmd(void);
isMachine(void)
{
# if 0
int machine = 12;
int m;
if((getvmd() & 0xff00) == 0x0f00) {
machine = PC9801;
if (*((unsigned char __far *) MK_FP(0, 0x501)) & 8) /* Hireso flag */
++machine; /* PC9801 Ê²Ú¿Þ */
}
else machine = DOSVJ;
return(machine);
#endif
return(DOSVJ);
}
# else
unsigned getvmd(void)
{
__asm {
mov ah, 0x0f
int 0x10
}
}
drdos(void)
{
__asm {
stc
mov ax, 0x4412
int 0x21
mov ax, 1
jnc drd01
dec al
drd01:
}
}
dbcschk(int code)
{
__asm {
push ds
push si
mov ax, 0x6300
int 0x21
mov ax, code
jc dbc01
cmp word ptr ds:[si], 0
jz dbc01
dec ax
dbc01:
pop si
pop ds
}
}
ax(void)
{
__asm {
mov ax, 0x5001
int 0x10
xor cx, cx
and al, al
jnz nax
mov cx, AXJ
cmp bx, 1
jz nax
mov cx, AXE
nax:
mov ax, cx
}
}
dosv(void)
{
__asm {
mov ax, 0x4900
int 0x15
mov ax, 0
jc dv01
and bl, bl
jnz dv01
inc al
dv01:
}
}
chkint60(void)
{
__asm {
mov dx, 0x8148 /* Shift JIS code */
mov ah, 2
int 0x60
xor ax, ax
cmp dx, 0x2129
jnz ck801
inc ax
ck801:
}
}
isMachine(void)
{
int machine = 12;
int m;
if((getvmd() & 0xff00) == 0x0f00) {
machine = PC9801;
if (*((unsigned char __far *)0x00000501) & 8) /* Hireso flag */
++machine; /* PC9801 Ê²Ú¿Þ */
}
else if(drdos()) machine = dbcschk(DRDOSE);
else if((*((unsigned __far *)0x00000180) + *((unsigned __far *)0x00000182)) && chkint60()) {
machine = J3100J;
if(*((unsigned char __far *)0x000004d0) == 0) ++machine;
}
else if((m = ax())) machine = m;
else if(dosv()) machine = dbcschk(DOSVE);
else machine = (*((unsigned __far *)0x000001f4) + *((unsigned __far *)0x000001f6))? JDOS: PCDOS;
return(machine);
}
# endif
#endif
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_FUCHSIA_SCOPED_SERVICE_BINDING_H_
#define BASE_FUCHSIA_SCOPED_SERVICE_BINDING_H_
#include <lib/fidl/cpp/binding_set.h>
#include "base/bind.h"
#include "base/fuchsia/service_directory.h"
#include "starboard/types.h"
namespace base {
namespace fuchsia {
template <typename Interface>
class ScopedServiceBinding {
public:
// |service_directory| and |impl| must outlive the binding.
ScopedServiceBinding(ServiceDirectory* service_directory, Interface* impl)
: directory_(service_directory), impl_(impl) {
directory_->AddService(
Interface::Name_,
BindRepeating(&ScopedServiceBinding::BindClient, Unretained(this)));
}
~ScopedServiceBinding() { directory_->RemoveService(Interface::Name_); }
void SetOnLastClientCallback(base::OnceClosure on_last_client_callback) {
on_last_client_callback_ = std::move(on_last_client_callback);
bindings_.set_empty_set_handler(
fit::bind_member(this, &ScopedServiceBinding::OnBindingSetEmpty));
}
private:
void BindClient(zx::channel channel) {
bindings_.AddBinding(impl_,
fidl::InterfaceRequest<Interface>(std::move(channel)));
}
void OnBindingSetEmpty() {
bindings_.set_empty_set_handler(nullptr);
std::move(on_last_client_callback_).Run();
}
ServiceDirectory* const directory_;
Interface* const impl_;
fidl::BindingSet<Interface> bindings_;
base::OnceClosure on_last_client_callback_;
DISALLOW_COPY_AND_ASSIGN(ScopedServiceBinding);
};
} // namespace fuchsia
} // namespace base
#endif // BASE_FUCHSIA_SCOPED_SERVICE_BINDING_H_
|
/**************************************************************************
*
* Copyright 2010 Pauli Nieminen.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
* THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
* OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
* USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*
**************************************************************************/
/*
* Multipart buffer for coping data which is larger than the page size.
*
* Authors:
* Pauli Nieminen <suokkos-at-gmail-dot-com>
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD: releng/9.3/sys/dev/drm2/drm_buffer.c 261629 2014-02-08 10:33:23Z dumbbell $");
#include <dev/drm2/drm_buffer.h>
/**
* Allocate the drm buffer object.
*
* buf: Pointer to a pointer where the object is stored.
* size: The number of bytes to allocate.
*/
int drm_buffer_alloc(struct drm_buffer **buf, int size)
{
int nr_pages = size / PAGE_SIZE + 1;
int idx;
/* Allocating pointer table to end of structure makes drm_buffer
* variable sized */
*buf = malloc(sizeof(struct drm_buffer) + nr_pages*sizeof(char *),
DRM_MEM_DRIVER, M_ZERO | M_WAITOK);
if (*buf == NULL) {
DRM_ERROR("Failed to allocate drm buffer object to hold"
" %d bytes in %d pages.\n",
size, nr_pages);
return -ENOMEM;
}
(*buf)->size = size;
for (idx = 0; idx < nr_pages; ++idx) {
(*buf)->data[idx] =
malloc(min(PAGE_SIZE, size - idx * PAGE_SIZE),
DRM_MEM_DRIVER, M_WAITOK);
if ((*buf)->data[idx] == NULL) {
DRM_ERROR("Failed to allocate %dth page for drm"
" buffer with %d bytes and %d pages.\n",
idx + 1, size, nr_pages);
goto error_out;
}
}
return 0;
error_out:
/* Only last element can be null pointer so check for it first. */
if ((*buf)->data[idx])
free((*buf)->data[idx], DRM_MEM_DRIVER);
for (--idx; idx >= 0; --idx)
free((*buf)->data[idx], DRM_MEM_DRIVER);
free(*buf, DRM_MEM_DRIVER);
return -ENOMEM;
}
/**
* Copy the user data to the begin of the buffer and reset the processing
* iterator.
*
* user_data: A pointer the data that is copied to the buffer.
* size: The Number of bytes to copy.
*/
int drm_buffer_copy_from_user(struct drm_buffer *buf,
void __user *user_data, int size)
{
int nr_pages = size / PAGE_SIZE + 1;
int idx;
if (size > buf->size) {
DRM_ERROR("Requesting to copy %d bytes to a drm buffer with"
" %d bytes space\n",
size, buf->size);
return -EFAULT;
}
for (idx = 0; idx < nr_pages; ++idx) {
if (DRM_COPY_FROM_USER(buf->data[idx],
(char *)user_data + idx * PAGE_SIZE,
min(PAGE_SIZE, size - idx * PAGE_SIZE))) {
DRM_ERROR("Failed to copy user data (%p) to drm buffer"
" (%p) %dth page.\n",
user_data, buf, idx);
return -EFAULT;
}
}
buf->iterator = 0;
return 0;
}
/**
* Free the drm buffer object
*/
void drm_buffer_free(struct drm_buffer *buf)
{
if (buf != NULL) {
int nr_pages = buf->size / PAGE_SIZE + 1;
int idx;
for (idx = 0; idx < nr_pages; ++idx)
free(buf->data[idx], DRM_MEM_DRIVER);
free(buf, DRM_MEM_DRIVER);
}
}
/**
* Read an object from buffer that may be split to multiple parts. If object
* is not split function just returns the pointer to object in buffer. But in
* case of split object data is copied to given stack object that is suplied
* by caller.
*
* The processing location of the buffer is also advanced to the next byte
* after the object.
*
* objsize: The size of the objet in bytes.
* stack_obj: A pointer to a memory location where object can be copied.
*/
void *drm_buffer_read_object(struct drm_buffer *buf,
int objsize, void *stack_obj)
{
int idx = drm_buffer_index(buf);
int page = drm_buffer_page(buf);
void *obj = NULL;
if (idx + objsize <= PAGE_SIZE) {
obj = &buf->data[page][idx];
} else {
/* The object is split which forces copy to temporary object.*/
int beginsz = PAGE_SIZE - idx;
memcpy(stack_obj, &buf->data[page][idx], beginsz);
memcpy((char *)stack_obj + beginsz, &buf->data[page + 1][0],
objsize - beginsz);
obj = stack_obj;
}
drm_buffer_advance(buf, objsize);
return obj;
}
|
//
// WYQEditRealNameAuthViewController.h
// Steward
//
// Created by wangyaqiang on 14-10-3.
// Copyright (c) 2014年 bitcar. All rights reserved.
//
#import "WYQBaseViewController.h"
@interface WYQEditRealNameAuthViewController : WYQBaseViewController
@property(nonatomic,strong)IBOutlet UIScrollView *editScrollView;//编辑
@property(nonatomic,strong)IBOutlet WYQCommonHeadBackView *headerV;
@property(nonatomic,strong)IBOutlet UIView *backView;//主要用来算高度
-(IBAction)completeBtnClick:(id)sender;
@end
|
/* Generated by ./xlat/gen.sh from ./xlat/fcntl64cmds.in; do not edit. */
#if !(defined(F_GETLK64) || (defined(HAVE_DECL_F_GETLK64) && HAVE_DECL_F_GETLK64))
# define F_GETLK64 12
#endif
#if !(defined(F_SETLK64) || (defined(HAVE_DECL_F_SETLK64) && HAVE_DECL_F_SETLK64))
# define F_SETLK64 13
#endif
#if !(defined(F_SETLKW64) || (defined(HAVE_DECL_F_SETLKW64) && HAVE_DECL_F_SETLKW64))
# define F_SETLKW64 14
#endif
#ifdef IN_MPERS
# error static const struct xlat fcntl64cmds in mpers mode
#else
static
const struct xlat fcntl64cmds[] = {
/* asm-generic/fcntl.h */
XLAT(F_GETLK64),
XLAT(F_SETLK64),
XLAT(F_SETLKW64),
XLAT_END
};
#endif /* !IN_MPERS */
|
/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated by an internal plugin build system
*/
#ifdef ABI39_0_0RN_DISABLE_OSS_PLUGIN_HEADER
// FB Internal: FBABI39_0_0RCTAnimationPlugins.h is autogenerated by the build system.
#import <ABI39_0_0React/ABI39_0_0FBABI39_0_0RCTAnimationPlugins.h>
#else
// OSS-compatibility layer
#import <Foundation/Foundation.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage"
#ifdef __cplusplus
extern "C" {
#endif
// ABI39_0_0RCTTurboModuleManagerDelegate should call this to resolve module classes.
Class ABI39_0_0RCTAnimationClassProvider(const char *name);
// Lookup functions
Class ABI39_0_0RCTNativeAnimatedModuleCls(void) __attribute__((used));
#ifdef __cplusplus
}
#endif
#pragma GCC diagnostic pop
#endif // ABI39_0_0RN_DISABLE_OSS_PLUGIN_HEADER
|
#import <Foundation/Foundation.h>
@interface CAS : NSURLConnection
typedef void (^CASAuthCallbackBlock)(id param);
// CAS server info
@property (nonatomic, strong) NSString *casServer;
@property (nonatomic, strong) NSString *restletPath;
// User info
@property (nonatomic, strong) NSString *username;
@property (nonatomic, strong) NSString *password;
// CAS session data
@property (nonatomic, getter = isLoggedIn) BOOL loggedIn;
@property (nonatomic, strong) NSString *tgt;
// Authentication callback
@property (nonatomic, copy) CASAuthCallbackBlock authCallbackBlock;
// Temp connection data storage
@property (nonatomic, strong) NSMutableDictionary *connectionStorage;
+ (CAS *)client;
- (void)initWithCasServer:(NSString *)casServer
restletPath:(NSString *)restletPath
username:(NSString *)username
password:(NSString *)password
authCallbackBlock:(CASAuthCallbackBlock)authCallbackBlock;
- (void)requestTGTWithUsername:(NSString *)user
password:(NSString *)pass;
- (NSString *)requestSTForService:(NSURL *)serviceURL;
- (void)sendAsyncRequest:(NSURLRequest *)request
authCallbackBlock:(CASAuthCallbackBlock)authCallbackBlock;
// NSURLConnection Delegate Methods
- (NSURLRequest *)connection:(NSURLConnection *)connection
willSendRequest:(NSURLRequest *)request
redirectResponse:(NSURLResponse *)redirectResponse;
- (void) connection:(NSURLConnection *)connection
didReceiveData:(NSData *)data;
- (void) connection:(NSURLConnection *)connection
didReceiveResponse:(NSURLResponse *)response;
- (void) connectionDidFinishLoading:(NSURLConnection *)connection;
@end
|
/*-
* Copyright (c) 2001 Alexey Zelkin <phantom@FreeBSD.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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD: src/include/langinfo.h,v 1.6 2002/09/18 05:54:25 mike Exp $
*/
#ifndef _LANGINFO_H_
#define _LANGINFO_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
#ifndef _NL_ITEM_DECLARED
typedef __nl_item nl_item;
#define _NL_ITEM_DECLARED
#endif
#define CODESET 0 /* codeset name */
#define D_T_FMT 1 /* string for formatting date and time */
#define D_FMT 2 /* date format string */
#define T_FMT 3 /* time format string */
#define T_FMT_AMPM 4 /* a.m. or p.m. time formatting string */
#define AM_STR 5 /* Ante Meridian affix */
#define PM_STR 6 /* Post Meridian affix */
/* week day names */
#define DAY_1 7
#define DAY_2 8
#define DAY_3 9
#define DAY_4 10
#define DAY_5 11
#define DAY_6 12
#define DAY_7 13
/* abbreviated week day names */
#define ABDAY_1 14
#define ABDAY_2 15
#define ABDAY_3 16
#define ABDAY_4 17
#define ABDAY_5 18
#define ABDAY_6 19
#define ABDAY_7 20
/* month names */
#define MON_1 21
#define MON_2 22
#define MON_3 23
#define MON_4 24
#define MON_5 25
#define MON_6 26
#define MON_7 27
#define MON_8 28
#define MON_9 29
#define MON_10 30
#define MON_11 31
#define MON_12 32
/* abbreviated month names */
#define ABMON_1 33
#define ABMON_2 34
#define ABMON_3 35
#define ABMON_4 36
#define ABMON_5 37
#define ABMON_6 38
#define ABMON_7 39
#define ABMON_8 40
#define ABMON_9 41
#define ABMON_10 42
#define ABMON_11 43
#define ABMON_12 44
#define ERA 45 /* era description segments */
#define ERA_D_FMT 46 /* era date format string */
#define ERA_D_T_FMT 47 /* era date and time format string */
#define ERA_T_FMT 48 /* era time format string */
#define ALT_DIGITS 49 /* alternative symbols for digits */
#define RADIXCHAR 50 /* radix char */
#define THOUSEP 51 /* separator for thousands */
#define YESEXPR 52 /* affirmative response expression */
#define NOEXPR 53 /* negative response expression */
#if __BSD_VISIBLE || __XSI_VISIBLE <= 500
#define YESSTR 54 /* affirmative response for yes/no queries */
#define NOSTR 55 /* negative response for yes/no queries */
#endif
#define CRNCYSTR 56 /* currency symbol */
#if __BSD_VISIBLE
#define D_MD_ORDER 57 /* month/day order (local extension) */
#endif
__BEGIN_DECLS
char *nl_langinfo(nl_item);
__END_DECLS
#endif /* !_LANGINFO_H_ */
|
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
#include <netdb.h>
#include "dns_message.h"
#include "md_array.h"
static int largest = 0;
int
opcode_indexer(const void *vp)
{
const dns_message *m = vp;
int i = (int) m->opcode;
if (m->malformed)
return -1;
if (i > largest)
largest = i;
return i;
}
static int next_iter = 0;
int
opcode_iterator(char **label)
{
static char label_buf[20];
if (NULL == label) {
next_iter = 0;
return largest + 1;
}
if (next_iter > largest)
return -1;
snprintf(*label = label_buf, 20, "%d", next_iter);
return next_iter++;
}
void
opcode_reset()
{
largest = 0;
}
|
/*****************************************************************************
* *
* OpenNI 1.0 Alpha *
* Copyright (C) 2010 PrimeSense Ltd. *
* *
* This file is part of OpenNI. *
* *
* OpenNI is free software: you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as published *
* by the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* OpenNI is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with OpenNI. If not, see <http://www.gnu.org/licenses/>. *
* *
*****************************************************************************/
#ifndef __XN_OPEN_NITE_STATUS_H__
#define __XN_OPEN_NITE_STATUS_H__
#include "XnPlatform.h"
//---------------------------------------------------------------------------
// Types
//---------------------------------------------------------------------------
/** Defines the XnStatus type.
* The high word represents the group to which this error belongs to.
* The low word is a sequential number inside the group. */
typedef XnUInt32 XnStatus;
/** Definition of the OK error code. */
static const XnStatus XN_STATUS_OK = 0;
//---------------------------------------------------------------------------
// API
//---------------------------------------------------------------------------
/**
* Converts a Xiron Status enumerator into a meaningful error string.
*
* @param Status [in] The input Xiron Status to be converted to a string.
*
* @return A string representation of the Xiron status.
*/
XN_C_API const XnChar* xnGetStatusString(const XnStatus Status);
/**
* Gets the name of a Xiron Status as a string.
*
* @param Status [in] The input Xiron Status.
*
* @return A string representation of the Xiron status name.
*/
XN_C_API const XnChar* xnGetStatusName(const XnStatus Status);
/**
* Prints a user message with a description of the error.
*
* @param Status [in] The input Xiron Status.
* @param csUserMessage [in] A user message.
*
*/
XN_C_API void xnPrintError(const XnStatus Status, const XnChar* csUserMessage);
//---------------------------------------------------------------------------
// Enums
//---------------------------------------------------------------------------
/** A list of modules for Xiron status. */
typedef enum XnErrorGroup
{
XN_ERROR_GROUP_NI = 1,
XN_ERROR_GROUP_OS = 2,
XN_ERROR_GROUP_PRIMESENSE = 3,
} XnErrorGroup;
/** Constructs a status code from a module and an error code. */
#define XN_STATUS_MAKE(group, code) ((group << 16) | code)
/** Returns the group of the status. */
#define XN_STATUS_GROUP(status) (status >> 16)
/** Returns the code of the status. */
#define XN_STATUS_CODE(status) (status & 0x0000FFFF)
/** Marks the beginning of a message map of a specific module. */
#define XN_STATUS_MESSAGE_MAP_START_FROM(group, first) \
enum _##group##first##Errors \
{ \
group##first##_OK = XN_STATUS_MAKE(group, first),
#define XN_STATUS_MESSAGE_MAP_START(group) \
XN_STATUS_MESSAGE_MAP_START_FROM(group, 0)
/** Adds an entry to the message map. */
#define XN_STATUS_MESSAGE(csName, csMessage) \
csName,
/** Marks the end of a message map. */
#define XN_STATUS_MESSAGE_MAP_END_FROM(group, first) \
};
#define XN_STATUS_MESSAGE_MAP_END(group) \
XN_STATUS_MESSAGE_MAP_END_FROM(group, 0)
#endif // __XN_OPEN_NITE_STATUS_H__
|
/*
* Copyright (C) 2011 Apple Inc. All rights reserved.
* Copyright (C) 2008 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Image.h"
#include <runtime/Uint8ClampedArray.h>
#include <wtf/CheckedArithmetic.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
#if PLATFORM(MAC) && USE(CA)
#define WTF_USE_IOSURFACE_CANVAS_BACKING_STORE 1
#endif
typedef struct __IOSurface *IOSurfaceRef;
typedef struct CGColorSpace *CGColorSpaceRef;
typedef struct CGDataProvider *CGDataProviderRef;
typedef uint32_t CGBitmapInfo;
namespace WebCore {
class IntSize;
class ImageBufferData {
public:
ImageBufferData(const IntSize&);
void* m_data;
RetainPtr<CGDataProviderRef> m_dataProvider;
CGBitmapInfo m_bitmapInfo;
Checked<unsigned, RecordOverflow> m_bytesPerRow;
CGColorSpaceRef m_colorSpace;
RetainPtr<IOSurfaceRef> m_surface;
#if !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1070
mutable double m_lastFlushTime;
#endif
PassRefPtr<Uint8ClampedArray> getData(const IntRect&, const IntSize&, bool accelerateRendering, bool unmultiplied, float resolutionScale) const;
void putData(Uint8ClampedArray*& source, const IntSize& sourceSize, const IntRect& sourceRect, const IntPoint& destPoint, const IntSize&, bool accelerateRendering, bool unmultiplied, float resolutionScale);
};
} // namespace WebCore
|
/*
* Tally Mark Daemon - An aggregated time-based counter for disparate systems
* Copyright (c) 2014, Bindle Binaries
* All rights reserved.
*
* @BINDLE_BINARIES_BSD_LICENSE_START@
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* @BINDLE_BINARIES_BSD_LICENSE_END@
*/
#include "version.h"
///////////////
// //
// Headers //
// //
///////////////
#ifdef __TALLYMARK_PMARK
#pragma mark - Headers
#endif
#include "libtallymark.h"
#include <stdio.h>
#include <assert.h>
/////////////////
// //
// Functions //
// //
/////////////////
#ifdef __TALLYMARK_PMARK
#pragma mark - Functions
#endif
const char * tallymark_lib_version(uint32_t * pcur, uint32_t * prev, uint32_t * page)
{
if (pcur != NULL)
*pcur = LIB_VERSION_CURRENT;
if (page != NULL)
*page = LIB_VERSION_REVISION;
if (prev != NULL)
*prev = LIB_VERSION_AGE;
return(LIB_VERSION_INFO);
}
const char * tallymark_pkg_version(uint32_t * pmaj, uint32_t * pmin,
uint32_t * ppat, const char ** pbuild)
{
if (pmaj != NULL)
*pmaj = GIT_PACKAGE_MAJOR;
if (pmin != NULL)
*pmin = GIT_PACKAGE_MINOR;
if (ppat != NULL)
*ppat = GIT_PACKAGE_PATCH;
if (pbuild != NULL)
*pbuild = GIT_PACKAGE_BUILD;
return(GIT_PACKAGE_VERSION_BUILD);
}
/* end of source */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE758_Undefined_Behavior__double_pointer_alloca_use_16.c
Label Definition File: CWE758_Undefined_Behavior.alloc.label.xml
Template File: point-flaw-16.tmpl.c
*/
/*
* @description
* CWE: 758 Undefined Behavior
* Sinks: alloca_use
* GoodSink: Initialize then use data
* BadSink : Use data from alloca without initialization
* Flow Variant: 16 Control flow: while(1)
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE758_Undefined_Behavior__double_pointer_alloca_use_16_bad()
{
while(1)
{
{
double * * pointer = (double * *)ALLOCA(sizeof(double *));
double * data = *pointer; /* FLAW: the value pointed to by pointer is undefined */
printDoubleLine(*data);
}
break;
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses the GoodSinkBody in the while loop */
static void good1()
{
while(1)
{
{
double * data;
double * * pointer = (double * *)ALLOCA(sizeof(double *));
/* initialize both the pointer and the data pointed to */
data = (double *)malloc(sizeof(double));
if (data == NULL) {exit(-1);}
*data = 5.0;
*pointer = data; /* FIX: Assign a value to the thing pointed to by pointer */
{
double * data = *pointer;
printDoubleLine(*data);
}
}
break;
}
}
void CWE758_Undefined_Behavior__double_pointer_alloca_use_16_good()
{
good1();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE758_Undefined_Behavior__double_pointer_alloca_use_16_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE758_Undefined_Behavior__double_pointer_alloca_use_16_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef INCLUDE_jrv_mj_binary_operation_h__
#define INCLUDE_jrv_mj_binary_operation_h__
#include "ast.h"
/**
* Represents a binary operation (such as +,-,*,< etc.) node in the AST
*/
typedef struct {
/** The type of the node */
nodetype type;
/** The left operand to the operation */
ast *left_operand;
/** The right operand to the operation */
ast *right_operand;
} mj_binary_operation;
/**
* Creates a new binary operation with the given type and
* operands.
*
* @param[in] type The type of the operation
* @param[in] left_operand The left operand of the expression
* @param[in] right_operand The right operand of the expression
* @param[out] node The addres of the pointer that will point at the result
* of the function
* @return An integer describing the result of the function
*/
int new_mj_binary_operation(nodetype type, ast* left_operand,
ast* right_operand, ast **node);
/**
* Deletes a binary operation
*
* @param op The binary operation to delete
*/
void delete_mj_binary_operation(mj_binary_operation *op);
#endif /* INCLUDE_jrv_mj_binary_operation_h__ */
|
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef mitkRenderWindowFrame_h
#define mitkRenderWindowFrame_h
#include <MitkCoreExports.h>
#include <itkObject.h>
#include <mitkCommon.h>
#include <vtkSmartPointer.h>
class vtkRenderer;
class vtkRenderWindow;
namespace mitk
{
/**
* This is a simple class for rendering colored rectangles
* at the boarders of vtkRenderWindows.
* The rectangle rendering itself is performed by means of a
* vtkProp (vtkMitkRectangleProp).
* This class instantiates the vtkProp and a corresponding vtkRenderer instance.
*/
class MITKCORE_EXPORT RenderWindowFrame : public itk::Object
{
public:
mitkClassMacroItkParent(RenderWindowFrame, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* Sets the renderwindow, in which colored rectangle boarders will be shown.
* Make sure, you have called this function
* before calling Enable()
*/
virtual void SetRenderWindow(vtkSmartPointer<vtkRenderWindow> renderWindow);
/**
* Enables drawing of the colored rectangle.
* If you want to disable it, call the Disable() function.
*/
virtual void Enable(float col1, float col2, float col3);
/**
* Disables drawing of the colored rectangle.
* If you want to enable it, call the Enable() function.
*/
virtual void Disable();
/**
* Checks, if the text is currently
* enabled (visible)
*/
virtual bool IsEnabled();
/**
* Returns the vtkRenderWindow, which is used
* for displaying the text
*/
virtual vtkSmartPointer<vtkRenderWindow> GetRenderWindow();
/**
* Returns the renderer responsible for
* rendering the text into the
* vtkRenderWindow
*/
virtual vtkSmartPointer<vtkRenderer> GetVtkRenderer();
protected:
/**
* Constructor
*/
RenderWindowFrame();
/**
* Destructor
*/
~RenderWindowFrame() override;
vtkSmartPointer<vtkRenderWindow> m_RenderWindow;
vtkSmartPointer<vtkRenderer> m_RectangleRenderer;
bool m_IsEnabled;
};
} // end of namespace mitk
#endif // mitkRenderWindowFrame_h
|
/****************************************************************************
* hn70ap/apps/libhn70ap/tun.c
*
* Copyright (C) 2018 Sebastien Lorquet. All rights reserved.
* Author: Sebastien Lorquet <sebastien@lorquet.fr>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name NuttX nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include <nuttx/config.h>
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <pthread.h>
#include <syslog.h>
#include <sys/ioctl.h>
#include <nuttx/net/tun.h>
#include <hn70ap/tun.h>
struct iptunnel_s
{
int fd;
char ifname[IFNAMSIZ];
bool alive;
pthread_t rxthread;
/*data reception and calling back to the user*/
FAR uint8_t * userbuf;
int userbuflen;
tunrxfunction_f callback;
FAR void * arg;
};
struct iptunnel_s tunnels[2];
/****************************************************************************
* hn70ap_tun_rxthread
* This thread waits for packets from the tun interface, and sends them to processes.
****************************************************************************/
void *hn70ap_tun_rxthread(void *arg)
{
struct iptunnel_s *tunnel = (struct iptunnel_s*)arg;
syslog(LOG_INFO, "Started tun RX thread\n");
int ret;
while(tunnel->alive)
{
if(tunnel->callback)
{
//Wait for messages on the air
ret = read(tunnel->fd, tunnel->userbuf, tunnel->userbuflen);
if(ret > 0)
{
//Dispatch them to the callback
tunnel->callback((tunnel==tunnels)?0:1, tunnel->arg, tunnel->userbuf, ret);
}
else
{
//syslog(LOG_ERR, "tunnel rx failed -> errno=%d\n", errno);
}
} //callback defined
else
{
pthread_yield();
}
} //tunnel alive
syslog(LOG_INFO, "Stopped tunnel RX thread\n");
return NULL;
}
/****************************************************************************
* hn70ap_tun_transmit
****************************************************************************/
int hn70ap_tun_transmit(int tunnel, FAR uint8_t *buf, size_t len)
{
if(tunnel != 0 && tunnel != 1)
{
return -1;
}
return write(tunnels[tunnel].fd, buf, len);
}
/****************************************************************************
* hn70ap_tun_rxfunction
****************************************************************************/
int hn70ap_tun_rxfunction(int tunnel, tunrxfunction_f rx, FAR void *arg, FAR uint8_t *userbuf, int userbuflen)
{
if(tunnel != 0 && tunnel != 1)
{
return -1;
}
tunnels[tunnel].userbuf = userbuf;
tunnels[tunnel].userbuflen = userbuflen;
tunnels[tunnel].arg = arg;
tunnels[tunnel].callback = rx;
return OK;
}
/****************************************************************************
* hn70ap_tun_devinit
****************************************************************************/
int hn70ap_tun_devinit(char name[IFNAMSIZ])
{
struct ifreq ifr;
int errcode;
int fd;
int ret;
struct iptunnel_s *tunnel = &tunnels[0];
if(tunnel->fd != 0)
{
tunnel = &tunnels[1];
}
if(tunnel->fd != 0)
{
syslog(LOG_ERR, "No tunnel available");
return -1;
}
if ((fd = open("/dev/tun", O_RDWR)) < 0)
{
return fd;
}
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TUN;
if (name[0])
{
strncpy(ifr.ifr_name, name, IFNAMSIZ);
}
errcode = ioctl(fd, TUNSETIFF, (unsigned long)&ifr);
if(errcode < 0)
{
close(fd);
return errcode;
}
tunnel->fd = fd;
strncpy(tunnel->ifname, ifr.ifr_name, IFNAMSIZ);
syslog(LOG_INFO, "Started interface: %s\n", tunnel->ifname);
//Start RX thread
tunnel->alive = true;
tunnel->callback = NULL;
ret = pthread_create(&tunnel->rxthread, NULL, hn70ap_tun_rxthread, tunnel);
if(ret < 0)
{
syslog(LOG_ERR, "Failed to start the receive thread\n");
}
return fd;
}
/****************************************************************************
* hn70ap_tun_addroute
****************************************************************************/
int hn70ap_tun_addroute(int tunnel, in_addr_t destination, int maskbits)
{
return ERROR;
}
/****************************************************************************
* hn70ap_tun_init
****************************************************************************/
int hn70ap_tun_init(void)
{
tunnels[0].fd = 0;
tunnels[1].fd = 0;
return 0;
}
|
#ifndef HTTPU_PARSE_HTTP_RESPONSE_H
#define HTTPU_PARSE_HTTP_RESPONSE_H
#include "ace/config-all.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "HTTPU/http_export.h"
class HTTPU_Export Parse_HTTP_Response
{
public:
Parse_HTTP_Response (const char *response = 0);
~Parse_HTTP_Response (void);
void init (const char *response);
int code (void) const;
const char *code_str (void) const;
int major_version (void) const;
int minor_version (void) const;
const char *version (void) const;
enum { HTTPU_OK, NO_MEMORY, BAD_RESPONSE };
int error (void) const;
// 0 -> ok
private:
int code_;
char *code_str_;
int major_version_;
int minor_version_;
char *version_;
char *response_;
int error_;
};
#if defined (ACE_HAS_INLINED_OSCALLS)
# if defined (ACE_INLINE)
# undef ACE_INLINE
# endif /* ACE_INLINE */
# define ACE_INLINE inline
# include "HTTPU/parse_http_response.inl"
# endif /* ACE_HAS_INLINED_OSCALLS */
#endif /* !defined (HTTPU_PARSE_HTTP_RESPONSE_H) */
|
#pragma once
#ifndef INFOVIEWER_H
#define INFOVIEWER_H
#include <memory>
#include "toonzqt/dvdialog.h"
#undef DVAPI
#undef DVVAR
#ifdef TOONZQT_EXPORTS
#define DVAPI DV_EXPORT_API
#define DVVAR DV_EXPORT_VAR
#else
#define DVAPI DV_IMPORT_API
#define DVVAR DV_IMPORT_VAR
#endif
class TLevelP;
class TFilePath;
class TPalette;
class InfoViewerImp;
class DVAPI InfoViewer : public DVGui::Dialog
{
Q_OBJECT
std::unique_ptr<InfoViewerImp> m_imp;
QWidget *m_parent;
public:
InfoViewer(QWidget *parent = 0);
~InfoViewer();
protected:
void hideEvent(QHideEvent *);
void showEvent(QShowEvent *);
protected slots:
void onSliderChanged(bool);
public slots:
void setItem(const TLevelP &level, TPalette *palette, const TFilePath &path);
};
#endif
|
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
#include "uv.h"
#include "internal.h"
#include "spinlock.h"
#include <assert.h>
#include <unistd.h>
#include <termios.h>
#include <errno.h>
#include <sys/ioctl.h>
static int orig_termios_fd = -1;
static struct termios orig_termios;
static uv_spinlock_t termios_spinlock = UV_SPINLOCK_INITIALIZER;
int uv_tty_init(uv_loop_t* loop, uv_tty_t* tty, int fd, int readable) {
int flags;
int newfd;
int r;
flags = 0;
newfd = -1;
uv__stream_init(loop, (uv_stream_t*) tty, UV_TTY);
/* Reopen the file descriptor when it refers to a tty. This lets us put the
* tty in non-blocking mode without affecting other processes that share it
* with us.
*
* Example: `node | cat` - if we put our fd 0 in non-blocking mode, it also
* affects fd 1 of `cat` because both file descriptors refer to the same
* struct file in the kernel. When we reopen our fd 0, it points to a
* different struct file, hence changing its properties doesn't affect
* other processes.
*/
if (isatty(fd)) {
r = uv__open_cloexec("/dev/tty", O_RDWR);
if (r < 0) {
/* fallback to using blocking writes */
if (!readable)
flags |= UV_STREAM_BLOCKING;
goto skip;
}
newfd = r;
r = uv__dup2_cloexec(newfd, fd);
if (r < 0 && r != -EINVAL) {
/* EINVAL means newfd == fd which could conceivably happen if another
* thread called close(fd) between our calls to isatty() and open().
* That's a rather unlikely event but let's handle it anyway.
*/
uv__close(newfd);
return r;
}
fd = newfd;
}
skip:
#if defined(__APPLE__)
r = uv__stream_try_select((uv_stream_t*) tty, &fd);
if (r) {
if (newfd != -1)
uv__close(newfd);
return r;
}
#endif
if (readable)
flags |= UV_STREAM_READABLE;
else
flags |= UV_STREAM_WRITABLE;
if (!(flags & UV_STREAM_BLOCKING))
uv__nonblock(fd, 1);
uv__stream_open((uv_stream_t*) tty, fd, flags);
tty->mode = UV_TTY_MODE_NORMAL;
return 0;
}
int uv_tty_set_mode(uv_tty_t* tty, uv_tty_mode_t mode) {
struct termios tmp;
int fd;
if (tty->mode == (int) mode)
return 0;
fd = uv__stream_fd(tty);
if (tty->mode == UV_TTY_MODE_NORMAL && mode != UV_TTY_MODE_NORMAL) {
if (tcgetattr(fd, &tty->orig_termios))
return -errno;
/* This is used for uv_tty_reset_mode() */
uv_spinlock_lock(&termios_spinlock);
if (orig_termios_fd == -1) {
orig_termios = tty->orig_termios;
orig_termios_fd = fd;
}
uv_spinlock_unlock(&termios_spinlock);
}
tmp = tty->orig_termios;
switch (mode) {
case UV_TTY_MODE_NORMAL:
break;
case UV_TTY_MODE_RAW:
tmp.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
tmp.c_oflag |= (ONLCR);
tmp.c_cflag |= (CS8);
tmp.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
tmp.c_cc[VMIN] = 1;
tmp.c_cc[VTIME] = 0;
break;
case UV_TTY_MODE_IO:
cfmakeraw(&tmp);
break;
}
/* Apply changes after draining */
if (tcsetattr(fd, TCSADRAIN, &tmp))
return -errno;
tty->mode = mode;
return 0;
}
int uv_tty_get_winsize(uv_tty_t* tty, int* width, int* height) {
struct winsize ws;
if (ioctl(uv__stream_fd(tty), TIOCGWINSZ, &ws))
return -errno;
*width = ws.ws_col;
*height = ws.ws_row;
return 0;
}
uv_handle_type uv_guess_handle(uv_file file) {
struct sockaddr sa;
struct stat s;
socklen_t len;
int type;
if (file < 0)
return UV_UNKNOWN_HANDLE;
if (isatty(file))
return UV_TTY;
if (fstat(file, &s))
return UV_UNKNOWN_HANDLE;
if (S_ISREG(s.st_mode))
return UV_FILE;
if (S_ISCHR(s.st_mode))
return UV_FILE; /* XXX UV_NAMED_PIPE? */
if (S_ISFIFO(s.st_mode))
return UV_NAMED_PIPE;
if (!S_ISSOCK(s.st_mode))
return UV_UNKNOWN_HANDLE;
len = sizeof(type);
if (getsockopt(file, SOL_SOCKET, SO_TYPE, &type, &len))
return UV_UNKNOWN_HANDLE;
len = sizeof(sa);
if (getsockname(file, &sa, &len))
return UV_UNKNOWN_HANDLE;
if (type == SOCK_DGRAM)
if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
return UV_UDP;
if (type == SOCK_STREAM) {
if (sa.sa_family == AF_INET || sa.sa_family == AF_INET6)
return UV_TCP;
if (sa.sa_family == AF_UNIX)
return UV_NAMED_PIPE;
}
return UV_UNKNOWN_HANDLE;
}
/* This function is async signal-safe, meaning that it's safe to call from
* inside a signal handler _unless_ execution was inside uv_tty_set_mode()'s
* critical section when the signal was raised.
*/
int uv_tty_reset_mode(void) {
int err;
if (!uv_spinlock_trylock(&termios_spinlock))
return -EBUSY; /* In uv_tty_set_mode(). */
err = 0;
if (orig_termios_fd != -1)
if (tcsetattr(orig_termios_fd, TCSANOW, &orig_termios))
err = -errno;
uv_spinlock_unlock(&termios_spinlock);
return err;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.