text
stringlengths 4
6.14k
|
|---|
#ifndef __SVI_FLASHEFFECTOR_H_
#define __SVI_FLASHEFFECTOR_H_
#include "SVITransitionEffector.h"
namespace SVI {
class SVIFlashEffector : public SVITransitionEffector {
public:
SVIFlashEffector(SVIGLSurface *surface);
virtual ~SVIFlashEffector() {}
protected:
void setAnimation();
};
}
#endif
|
//
// ViewController.h
// 03-pthread
//
// Created by Ammar on 15/7/8.
// Copyright (c) 2015年 小码哥. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
|
//
// Generated by gen_resource_source.py
//
#ifndef _COM_IBM_ICU_IMPL_DATA_ICUDT58B_EN_AU_RES_H
#define _COM_IBM_ICU_IMPL_DATA_ICUDT58B_EN_AU_RES_H
static jbyte _com_ibm_icu_impl_data_icudt58b_en_AU_res[] = {
0x00, 0x20, 0xDA, 0x27, 0x00, 0x14, 0x00, 0x00, 0x01, 0x00,
0x02, 0x00, 0x52, 0x65, 0x73, 0x42, 0x03, 0x00, 0x00, 0x00,
0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x20, 0x00, 0x00, 0xD3, 0x00, 0xBC, 0x34, 0x08,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0xDE, 0x00, 0x00,
0x00, 0xDE, 0x00, 0x00, 0x00, 0x07, 0xBC, 0x34, 0x00, 0x04,
0x00, 0x00, 0x00, 0x88, 0xD0, 0x04, 0x87, 0xEE, 0x00, 0x00,
0x00, 0x46, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x57, 0x00, 0x2E,
0x00, 0x00, 0x00, 0x53, 0x00, 0x75, 0x00, 0x2E, 0x00, 0x00,
0x00, 0x54, 0x00, 0x68, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x54,
0x00, 0x75, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x44, 0x00, 0x65,
0x00, 0x63, 0x00, 0x2E, 0x00, 0x00, 0x00, 0x6D, 0x00, 0x69,
0x00, 0x64, 0x00, 0x64, 0x00, 0x61, 0x00, 0x79, 0x00, 0x00,
0x00, 0x6D, 0x00, 0x69, 0x00, 0x64, 0x00, 0x6E, 0x00, 0x69,
0x00, 0x67, 0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x61,
0x00, 0x74, 0x00, 0x20, 0x00, 0x6E, 0x00, 0x69, 0x00, 0x67,
0x00, 0x68, 0x00, 0x74, 0x00, 0x00, 0x00, 0x32, 0x00, 0x2E,
0x00, 0x31, 0x00, 0x2E, 0x00, 0x33, 0x00, 0x30, 0x00, 0x2E,
0x00, 0x35, 0x00, 0x30, 0x00, 0x00, 0x00, 0x4E, 0x00, 0x6F,
0x00, 0x6E, 0x00, 0x2D, 0x00, 0x73, 0x00, 0x70, 0x00, 0x61,
0x00, 0x63, 0x00, 0x69, 0x00, 0x6E, 0x00, 0x67, 0x00, 0x00,
0x00, 0x01, 0x00, 0xB3, 0x08, 0x82, 0x00, 0x02, 0x03, 0x7A,
0x03, 0xA6, 0xBC, 0x33, 0x56, 0x36, 0x00, 0x02, 0x03, 0x75,
0x0E, 0xC1, 0x56, 0xBE, 0x56, 0xBE, 0x00, 0x02, 0x03, 0x75,
0x0E, 0xC1, 0x96, 0x37, 0x96, 0x37, 0x00, 0x01, 0x0E, 0xC1,
0xAE, 0x73, 0x00, 0x02, 0x07, 0x67, 0x07, 0x49, 0x00, 0x02,
0x07, 0x67, 0x07, 0x49, 0x00, 0x02, 0x07, 0x67, 0x07, 0x49,
0x00, 0x0D, 0x55, 0xFF, 0x36, 0x0F, 0x64, 0x28, 0x29, 0x75,
0x64, 0x01, 0x22, 0x50, 0x56, 0x16, 0x0F, 0x17, 0x13, 0xAE,
0x36, 0x1B, 0x36, 0x1B, 0x13, 0xAE, 0x13, 0xAE, 0x00, 0x07,
0x2F, 0x47, 0x2F, 0x2F, 0x2F, 0x5F, 0x2F, 0x6B, 0x2F, 0x53,
0x2F, 0x23, 0x2F, 0x3B, 0x00, 0x07, 0xBC, 0x3B, 0x07, 0x13,
0xBC, 0x43, 0xBC, 0x38, 0xBC, 0x3F, 0xBC, 0x35, 0x12, 0xD2,
0x00, 0x07, 0xBC, 0x3B, 0x2F, 0x2F, 0xBC, 0x43, 0x2F, 0x6B,
0xBC, 0x3F, 0x2F, 0x23, 0x2F, 0x3B, 0x00, 0x07, 0xBC, 0x3B,
0x07, 0x13, 0xBC, 0x43, 0xBC, 0x38, 0xBC, 0x3F, 0xBC, 0x35,
0x12, 0xD2, 0x00, 0x07, 0xBC, 0x3B, 0x2F, 0x2F, 0xBC, 0x43,
0x2F, 0x6B, 0xBC, 0x3F, 0x2F, 0x23, 0x2F, 0x3B, 0x00, 0x06,
0x0C, 0x11, 0x0C, 0x1C, 0x0C, 0x25, 0x0C, 0x2E, 0x0C, 0x37,
0x0C, 0x65, 0x6C, 0xFD, 0x51, 0x46, 0xBC, 0x53, 0x51, 0x55,
0xBC, 0x56, 0xBC, 0x4C, 0x00, 0x06, 0x0C, 0x11, 0x0C, 0x1C,
0x0C, 0x25, 0x0C, 0x2E, 0x0C, 0x37, 0x0C, 0x65, 0x6C, 0xFD,
0x51, 0x46, 0xBC, 0x53, 0x51, 0x55, 0xBC, 0x56, 0xBC, 0x4C,
0x00, 0x06, 0x0C, 0x11, 0x0C, 0x1C, 0x0C, 0x25, 0x0C, 0x2E,
0x0C, 0x37, 0x0C, 0x65, 0x6C, 0xF6, 0x51, 0x3F, 0xBC, 0x53,
0x51, 0x4E, 0xBC, 0x5C, 0xBC, 0x4C, 0x00, 0x01, 0x0C, 0x65,
0xBC, 0x4C, 0x00, 0x03, 0x0E, 0x76, 0x0C, 0x65, 0x0C, 0x3E,
0x07, 0x67, 0xBC, 0x4C, 0x07, 0x49, 0x00, 0x03, 0x0E, 0x76,
0x0C, 0x65, 0x0C, 0x3E, 0x07, 0x67, 0xBC, 0x4C, 0x07, 0x49,
0x00, 0x0C, 0x04, 0x53, 0x03, 0xC2, 0x39, 0xBE, 0x04, 0x49,
0x01, 0x59, 0x04, 0x62, 0x04, 0x58, 0x04, 0x4E, 0x04, 0x71,
0x05, 0x70, 0x03, 0x9A, 0xBC, 0x47, 0x00, 0x0C, 0x04, 0x53,
0x03, 0xC2, 0x39, 0xBE, 0x04, 0x49, 0x01, 0x59, 0x04, 0x62,
0x04, 0x58, 0x04, 0x4E, 0x04, 0x71, 0x05, 0x70, 0x03, 0x9A,
0xBC, 0x47, 0x00, 0x01, 0x07, 0xDC, 0xBC, 0x6F, 0x00, 0x01,
0x09, 0x73, 0x07, 0x3E, 0x00, 0x02, 0x03, 0x35, 0x01, 0x97,
0x5C, 0x4E, 0x49, 0xE5, 0x00, 0x01, 0x0B, 0x82, 0x2C, 0xB8,
0x00, 0x01, 0x0B, 0x82, 0x2C, 0xB8, 0x00, 0x01, 0x05, 0xB1,
0x50, 0x00, 0x00, 0x47, 0x00, 0x01, 0x01, 0x34, 0x20, 0x00,
0x00, 0x88, 0x00, 0x03, 0x03, 0x7B, 0x03, 0x8B, 0x03, 0x8A,
0x50, 0x00, 0x00, 0x4F, 0x50, 0x00, 0x00, 0x54, 0x50, 0x00,
0x00, 0x59, 0x00, 0x02, 0x02, 0xA4, 0x02, 0xCF, 0xAA, 0xAA,
0x50, 0x00, 0x00, 0x4A, 0x20, 0x00, 0x00, 0x8C, 0x00, 0x03,
0x02, 0xC3, 0x09, 0x9F, 0x09, 0xAA, 0x90, 0x00, 0x00, 0x73,
0x90, 0x00, 0x00, 0x7B, 0x90, 0x00, 0x00, 0x83, 0x00, 0x02,
0x09, 0x9F, 0x09, 0xAA, 0xAA, 0xAA, 0x90, 0x00, 0x00, 0x8B,
0x90, 0x00, 0x00, 0x93, 0x00, 0x02, 0x03, 0xD3, 0x04, 0x16,
0xAA, 0xAA, 0x20, 0x00, 0x00, 0x95, 0x20, 0x00, 0x00, 0x9A,
0x00, 0x03, 0x02, 0xC3, 0x09, 0x9F, 0x0E, 0x40, 0x50, 0x00,
0x00, 0x9B, 0x50, 0x00, 0x00, 0xA8, 0x50, 0x00, 0x00, 0xB5,
0x00, 0x03, 0x02, 0xC3, 0x09, 0x9F, 0x0E, 0x40, 0x50, 0x00,
0x00, 0xC2, 0x50, 0x00, 0x00, 0xC5, 0x50, 0x00, 0x00, 0xCC,
0x00, 0x02, 0x03, 0xD3, 0x04, 0x16, 0xAA, 0xAA, 0x20, 0x00,
0x00, 0xA2, 0x20, 0x00, 0x00, 0xA7, 0x00, 0x01, 0x02, 0xC3,
0x90, 0x00, 0x00, 0xD3, 0x00, 0x01, 0x02, 0xC3, 0x90, 0x00,
0x00, 0xE0, 0x00, 0x02, 0x03, 0xD3, 0x04, 0x16, 0xAA, 0xAA,
0x20, 0x00, 0x00, 0xB0, 0x20, 0x00, 0x00, 0xB2, 0x00, 0x07,
0x02, 0x4D, 0x04, 0x8F, 0x02, 0x59, 0x02, 0x6B, 0x02, 0xB5,
0x0C, 0x07, 0x02, 0xDF, 0x90, 0x00, 0x00, 0x5C, 0x90, 0x00,
0x00, 0x5F, 0x90, 0x00, 0x00, 0x62, 0x90, 0x00, 0x00, 0x65,
0x20, 0x00, 0x00, 0x9E, 0x20, 0x00, 0x00, 0xAC, 0x20, 0x00,
0x00, 0xB4, 0x00, 0x02, 0x04, 0x6B, 0x04, 0x85, 0xAA, 0xAA,
0x20, 0x00, 0x00, 0x91, 0x20, 0x00, 0x00, 0xB8, 0x00, 0x01,
0x09, 0x96, 0x50, 0x00, 0x00, 0xF3, 0x00, 0x01, 0x09, 0x82,
0x20, 0x00, 0x00, 0xC7, 0x00, 0x02, 0x09, 0xE8, 0x0A, 0x55,
0xAA, 0xAA, 0x50, 0x00, 0x00, 0xF0, 0x20, 0x00, 0x00, 0xC9,
0x00, 0x02, 0x0B, 0x79, 0x0B, 0x93, 0xAA, 0xAA, 0x50, 0x00,
0x00, 0xF8, 0x50, 0x00, 0x00, 0xFB, 0x00, 0x07, 0x0C, 0x97,
0x00, 0x71, 0x02, 0x33, 0x02, 0x3B, 0x05, 0x16, 0x09, 0x6C,
0x0B, 0x6D, 0x60, 0x00, 0x09, 0xE7, 0x20, 0x00, 0x00, 0x8A,
0x60, 0x00, 0xBC, 0x65, 0x20, 0x00, 0x00, 0xC3, 0x50, 0x00,
0x00, 0xED, 0x20, 0x00, 0x00, 0xCB, 0x20, 0x00, 0x00, 0xCF,
0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA,
};
J2OBJC_RESOURCE(\
_com_ibm_icu_impl_data_icudt58b_en_AU_res, \
928, \
0x5018aec9);
#endif
|
/*!The Treasure Box Library
*
* 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.
*
* Copyright (C) 2009 - 2019, TBOOX Open Source Group.
*
* @author ruki
* @file wcsdup.c
* @ingroup libc
*
*/
/* //////////////////////////////////////////////////////////////////////////////////////
* includes
*/
#include "string.h"
/* //////////////////////////////////////////////////////////////////////////////////////
* interfaces
*/
tb_wchar_t* tb_wcsdup(tb_wchar_t const* s)
{
// check
tb_assert_and_check_return_val(s, tb_null);
// done
__tb_register__ tb_size_t n = tb_wcslen(s);
__tb_register__ tb_wchar_t* p = (tb_wchar_t*)tb_malloc((n + 1) * sizeof(tb_wchar_t));
if (p)
{
tb_memcpy(p, s, n * sizeof(tb_wchar_t));
p[n] = L'\0';
}
return p;
}
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_ValueType1744280289.h"
#include "mscorlib_System_Collections_Generic_Dictionary_2_En833703292.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Collections.Generic.Dictionary`2/ValueCollection/Enumerator<System.String,UnityEngine.GUIStyle>
struct Enumerator_t1743180604
{
public:
// System.Collections.Generic.Dictionary`2/Enumerator<TKey,TValue> System.Collections.Generic.Dictionary`2/ValueCollection/Enumerator::host_enumerator
Enumerator_t833703292 ___host_enumerator_0;
public:
inline static int32_t get_offset_of_host_enumerator_0() { return static_cast<int32_t>(offsetof(Enumerator_t1743180604, ___host_enumerator_0)); }
inline Enumerator_t833703292 get_host_enumerator_0() const { return ___host_enumerator_0; }
inline Enumerator_t833703292 * get_address_of_host_enumerator_0() { return &___host_enumerator_0; }
inline void set_host_enumerator_0(Enumerator_t833703292 value)
{
___host_enumerator_0 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
#pragma once
#include "Inimigo.h"
class finalBoss : public Inimigo
{
public:
finalBoss(void);
virtual void status();
virtual int attack();
virtual int defense(int damage);
virtual void image();
virtual int getSpeed();
virtual int getLuck();
virtual int getLife();
virtual char *getName();
virtual ~finalBoss();
private:
void setImage();
char nome[40];
int lifeTotal,life;
int force, resistance;
int luck;
int speed;
FILE *file;
};
|
//---------------------------------------------------------------------------
// Greenplum Database
// Copyright (C) 2011 EMC Corp.
//
// @filename:
// CEnfdRewindability.h
//
// @doc:
// Enforceable rewindability property
//---------------------------------------------------------------------------
#ifndef GPOPT_CEnfdRewindability_H
#define GPOPT_CEnfdRewindability_H
#include "gpos/base.h"
#include "gpopt/base/CEnfdProp.h"
#include "gpopt/base/CRewindabilitySpec.h"
namespace gpopt
{
using namespace gpos;
// prototypes
class CPhysical;
//---------------------------------------------------------------------------
// @class:
// CEnfdRewindability
//
// @doc:
// Enforceable rewindability property;
//
//---------------------------------------------------------------------------
class CEnfdRewindability : public CEnfdProp
{
public:
// type of rewindability matching function
enum ERewindabilityMatching
{
ErmSatisfy = 0,
ErmSentinel
};
private:
// required rewindability
CRewindabilitySpec *m_prs;
// rewindability matching type
ERewindabilityMatching m_erm;
// private copy ctor
CEnfdRewindability(const CEnfdRewindability &);
// names of rewindability matching types
static
const CHAR *m_szRewindabilityMatching[ErmSentinel];
public:
// ctor
CEnfdRewindability(CRewindabilitySpec *prs, ERewindabilityMatching erm);
// dtor
virtual
~CEnfdRewindability();
// hash function
virtual
ULONG UlHash() const;
// check if the given rewindability specification is compatible with the
// rewindability specification of this object for the specified matching type
BOOL FCompatible(CRewindabilitySpec *pos) const;
// required rewindability accessor
CRewindabilitySpec *PrsRequired() const
{
return m_prs;
}
// get rewindability enforcing type for the given operator
EPropEnforcingType Epet
(
CExpressionHandle &exprhdl,
CPhysical *popPhysical,
BOOL fRewindabilityReqd
)
const;
// property spec accessor
virtual
CPropSpec *Pps() const
{
return m_prs;
}
// matching type accessor
ERewindabilityMatching Erm() const
{
return m_erm;
}
// matching function
BOOL FMatch
(
CEnfdRewindability *per
)
{
GPOS_ASSERT(NULL != per);
return m_erm == per->Erm() &&
m_prs->FMatch(per->PrsRequired());
}
// print function
virtual
IOstream &OsPrint(IOstream &os) const;
}; // class CEnfdRewindability
}
#endif // !GPOPT_CEnfdRewindability_H
// EOF
|
// 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/notebooks/v1/managed_service.proto
#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_NOTEBOOKS_INTERNAL_MANAGED_NOTEBOOK_STUB_FACTORY_H
#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_NOTEBOOKS_INTERNAL_MANAGED_NOTEBOOK_STUB_FACTORY_H
#include "google/cloud/notebooks/internal/managed_notebook_stub.h"
#include "google/cloud/completion_queue.h"
#include "google/cloud/credentials.h"
#include "google/cloud/internal/unified_grpc_credentials.h"
#include "google/cloud/version.h"
#include <memory>
namespace google {
namespace cloud {
namespace notebooks_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
std::shared_ptr<ManagedNotebookServiceStub>
CreateDefaultManagedNotebookServiceStub(google::cloud::CompletionQueue cq,
Options const& options);
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
} // namespace notebooks_internal
} // namespace cloud
} // namespace google
#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_NOTEBOOKS_INTERNAL_MANAGED_NOTEBOOK_STUB_FACTORY_H
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vector>
#include <vespa/document/bucket/bucket.h>
#include <vespa/storageapi/buckets/bucketinfo.h>
#include <vespa/storage/common/messagesender.h>
#include <vespa/storage/common/servicelayercomponent.h>
namespace storage {
class BucketOwnershipNotifier
{
const ServiceLayerComponent & _component;
MessageSender & _sender;
public:
BucketOwnershipNotifier(const ServiceLayerComponent& component, MessageSender& sender)
: _component(component),
_sender(sender)
{}
bool distributorOwns(uint16_t distributor, const document::Bucket &bucket) const;
void notifyIfOwnershipChanged(const document::Bucket &bucket, uint16_t sourceIndex, const api::BucketInfo& infoToSend);
void sendNotifyBucketToCurrentOwner(const document::Bucket &bucket, const api::BucketInfo& infoToSend);
private:
enum IndexMeta {
FAILED_TO_RESOLVE = 0xffff
};
void sendNotifyBucketToDistributor(uint16_t distributorIndex, const document::Bucket &bucket,
const api::BucketInfo& infoToSend);
// Returns either index or FAILED_TO_RESOLVE
uint16_t getOwnerDistributorForBucket(const document::Bucket &bucket) const;
void logNotification(const document::Bucket &bucket, uint16_t sourceIndex,
uint16_t currentOwnerIndex, const api::BucketInfo& newInfo);
};
/**
* Convenience class for sending notifications at the end of a scope, primarily
* to avoid issues with sending while holding a bucket lock.
*/
class NotificationGuard
{
struct BucketToCheck
{
BucketToCheck(const document::Bucket& _bucket, uint16_t _sourceIndex, const api::BucketInfo& _info)
: bucket(_bucket),
info(_info),
sourceIndex(_sourceIndex),
alwaysSend(false)
{}
document::Bucket bucket;
api::BucketInfo info;
uint16_t sourceIndex;
bool alwaysSend;
};
BucketOwnershipNotifier& _notifier;
std::vector<BucketToCheck> _bucketsToCheck;
public:
NotificationGuard(BucketOwnershipNotifier& notifier)
: _notifier(notifier),
_bucketsToCheck()
{}
NotificationGuard(const NotificationGuard&) = delete;
NotificationGuard& operator=(const NotificationGuard&) = delete;
~NotificationGuard();
void notifyIfOwnershipChanged(const document::Bucket &bucket, uint16_t sourceIndex, const api::BucketInfo& infoToSend);
void notifyAlways(const document::Bucket &bucket, const api::BucketInfo& infoToSend);
};
} // storage
|
//
// Colleague.h
// 20中介者模式
//
// Created by huangchengdu on 17/5/22.
// Copyright © 2017年 黄成都. All rights reserved.
//
#import <Foundation/Foundation.h>
@class Mediator;
@interface Colleague : NSObject
@property(nonatomic, strong)Mediator *mediator;
-(instancetype)initWithMediator:(Mediator *)mediator;
-(void)notify:(NSString *)message;
-(void)send:(NSString *)message;
@end
|
/*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkOSWindow_Unix_DEFINED
#define SkOSWindow_Unix_DEFINED
#include <GL/glx.h>
#include <X11/Xlib.h>
#include "SkWindow.h"
class SkEvent;
struct SkUnixWindow {
Display* fDisplay;
Window fWin;
size_t fOSWin;
GC fGc;
GLXContext fGLContext;
};
class SkOSWindow : public SkWindow {
public:
SkOSWindow(void*);
~SkOSWindow();
void* getHWND() const { return (void*)fUnixWindow.fWin; }
void* getDisplay() const { return (void*)fUnixWindow.fDisplay; }
void* getUnixWindow() const { return (void*)&fUnixWindow; }
void loop();
enum SkBackEndTypes {
kNone_BackEndType,
kNativeGL_BackEndType,
#if SK_ANGLE
kANGLE_BackEndType,
#endif // SK_ANGLE
};
bool attach(SkBackEndTypes attachType, int msaaSampleCount, AttachmentInfo*);
void detach();
void present();
int getMSAASampleCount() const { return fMSAASampleCount; }
//static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
bool makeFullscreen();
void setVsync(bool);
void closeWindow();
protected:
// Overridden from from SkWindow:
void onSetTitle(const char title[]) override;
private:
enum NextXEventResult {
kContinue_NextXEventResult,
kQuitRequest_NextXEventResult,
kPaintRequest_NextXEventResult
};
NextXEventResult nextXEvent();
void doPaint();
void mapWindowAndWait();
// Forcefully closes the window. If a graceful shutdown is desired then call the public
// closeWindow method
void internalCloseWindow();
void initWindow(int newMSAASampleCount, AttachmentInfo* info);
SkUnixWindow fUnixWindow;
// Needed for GL
XVisualInfo* fVi;
// we recreate the underlying xwindow if this changes
int fMSAASampleCount;
typedef SkWindow INHERITED;
};
#endif
|
#ifndef YAKKA_WEAK_REF_H_
#define YAKKA_WEAK_REF_H_
/** @defgroup WeakRef WeakRef
*
* A reference to an object that does not prevent an object from being
* destroyed.
*
* As long as the referent (some other object) exists, its weak reference can
* be used to obtain a referenced pointer to it. However the existence of the
* weak reference does not prevent the object from being destroyed when all
* references to it are released (a weak reference does not hold a strong
* reference to its referent). If that occurs, attempting to obtain a
* referenced pointer to the referent will return NULL.
*
* Weak references are useful in dealing with objects that may go away at some
* point, or for avoiding cyclical references (i.e. objects that refer to each
* other, meaning that neither can be destroyed).
*
* The creation of a weak reference for an object instance is handled via the
* Object API method @ref y_weak_ref.
* @{
*/
#include "Object.h"
/**
* Structure for the WeakRef class.
*/
typedef struct y_WeakRefClass y_WeakRefClass;
/** Structure for a WeakRef instance. */
typedef struct y_WeakRef {
/** The super class structure for a weak reference instance:
* @ref y_Object. */
y_Object object;
} y_WeakRef;
/**
* Get the type for WeakReference.
*
* @param rt The Yakka runtime.
* @return The class structure for weak reference.
*/
y_WeakRefClass * y_WeakRef_type (y_Runtime * rt);
/**
* Dereference a weak reference (if possible).
*
* If the referent still exists, this method will return a referenced (strong)
* pointer to that object, otherwise NULL will be returned. The reference
* obtained in this manner should eventually be unreferenced (@ref y_unref)
* when no longer needed, just as with any other strong reference.
*
* @param self A weak reference.
* @return A referenced (strong) pointer to the referent, or NULL if it no
* longer exists.
*/
void * y_WeakRef_deref (void * self);
/**
* Check whether the referent still exists.
*
* @param self A weak reference.
* @return True if the referent still exists, false otherwise.
*/
bool y_WeakRef_is_set (void * self);
/**
* Safely cast an object to a weak reference.
*/
#define y_WEAK_REF(self) \
y_SAFE_CAST_INSTANCE(self, y_WeakRef_type, y_WeakRef)
/**
* @}
*/
#endif
|
/******************************************************************************
* Licensed under Apache License Version 2.0 - see LICENSE
*****************************************************************************/
#include "allmonotone.h"
#include "helper.h"
PyObject *
PyIU_Monotone(PyObject *Py_UNUSED(m), PyObject *args, PyObject *kwargs) {
static char *kwlist[] = {"iterable", "decreasing", "strict", NULL};
PyObject *iterable;
PyObject *iterator;
PyObject *item;
PyObject *last = NULL;
int decreasing = 0;
int strict = 0;
int op;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|pp:all_monotone", kwlist,
&iterable, &decreasing, &strict)) {
return NULL;
}
iterator = PyObject_GetIter(iterable);
if (iterator == NULL) {
return NULL;
}
op = decreasing ? (strict ? Py_GT : Py_GE) : (strict ? Py_LT : Py_LE);
while ((item = Py_TYPE(iterator)->tp_iternext(iterator))) {
int ok;
if (last == NULL) {
last = item;
continue;
}
ok = PyObject_RichCompareBool(last, item, op);
Py_DECREF(last);
last = item;
if (ok != 1) {
Py_DECREF(iterator);
Py_DECREF(last);
if (ok == 0) {
Py_RETURN_FALSE;
} else if (ok == -1) {
return NULL;
}
}
}
Py_DECREF(iterator);
Py_XDECREF(last);
if (PyIU_ErrorOccurredClearStopIteration()) {
return NULL;
}
Py_RETURN_TRUE;
}
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2014 by Appcelerator, 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.
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "ASIHTTPRequest.h"
#import "ASINetworkQueue.h"
#import "TiDimension.h"
typedef enum {
TiImageScalingDefault,
TiImageScalingThumbnail,
TiImageScalingNonProportional,
TiImageScalingStretch,
} TiImageScalingStyle;
@class ImageLoaderRequest;
/**
Protocol for image loader delegate.
*/
@protocol ImageLoaderDelegate
@required
/**
Tells the delegate that the image load request succeeded.
@param request The load request.
@param image The loaded image.
*/
-(void)imageLoadSuccess:(ImageLoaderRequest*)request image:(UIImage*)image;
/**
Tells the delegate that the image load request failed.
@param request The load request.
@param error The error.
*/
-(void)imageLoadFailed:(ImageLoaderRequest*)request error:(NSError*)error;
@optional
/**
Tells the delegate that the image load request has been cancelled.
@param request The load request.
*/
-(void)imageLoadCancelled:(ImageLoaderRequest*)request;
@end
/**
Image loader request class.
*/
@interface ImageLoaderRequest : NSObject {
@private
ASIHTTPRequest *request;
NSObject<ImageLoaderDelegate>* delegate;
NSDictionary* userInfo;
NSURL *url;
CGSize imageSize;
BOOL completed;
BOOL cancelled;
}
@property(nonatomic,readwrite,retain) ASIHTTPRequest* request;
/**
Whether or not the request has completed.
@return _YES_ if the request has completed, _NO_ otherwise.
*/
@property(nonatomic,readwrite,assign) BOOL completed;
/**
Returns loaded image size.
@return The loaded image size
*/
@property(nonatomic,readwrite,assign) CGSize imageSize;
/**
Returns the request delegate.
@return The request delegate.
*/
@property(nonatomic,readonly) NSObject<ImageLoaderDelegate>* delegate;
/**
Cancels the request.
*/
-(void)cancel;
/**
Whether or not the image load request was cancelled.
@return _YES_ if request was cancelled, _NO_ otherwise.
*/
@property(nonatomic,readonly) BOOL cancelled;
/**
Returns request additional properties.
@return The dictionary of properties.
*/
@property(nonatomic,readonly) NSDictionary *userInfo;
/**
Returns the request URL.
@return The image URL.
*/
@property(nonatomic,readonly) NSURL *url;
@end
/**
The ImageLoader class provides a centralized point for loading images in PMXFramwork.
Using ImageLoader is the preferred way for getting images from remote sources.
The class is singleton and not supposed to be subclassed.
The instance should not be instantiated directly, but lazily created with <sharedLoader>.
*/
@interface ImageLoader : NSObject<NSCacheDelegate> {
@private
NSCache *cache;
ASINetworkQueue* queue;
NSMutableArray* timeout;
NSRecursiveLock* lock;
}
/**
Returns the shared instance of image loader.
@return The shared instance.
*/
+(ImageLoader*)sharedLoader;
/**
Tells the loader to load remote image from URL.
@param url The image URL
@return The loaded image.
@see loadImage:delegate:userInfo:
*/
-(UIImage *)loadRemote:(NSURL*)url;
/**
Tells the loader to return previously loaded image with URL.
@param url The image URL
@return The loaded image or _nil_ if the image is not available from the cache.
@see loadRemote:
*/
-(UIImage *)loadImmediateImage:(NSURL *)url;
/**
Tells the loader to return previously loaded image with URL and size.
@param url The image URL
@param imageSize The required image size.
@return The loaded image or _nil_ if the image is not available from the cache.
@see loadRemote:
*/
-(UIImage *)loadImmediateImage:(NSURL *)url withSize:(CGSize)imageSize;
/**
Tells the loader to return previously loaded stretchable image with URL.
@param url The image URL
@return The loaded image or _nil_ if the image is not available from the cache.
@see loadRemote:
*/
-(UIImage *)loadImmediateStretchableImage:(NSURL *)url;
/**
Tells the loader to return previously loaded stretchable image with URL and specified cap values.
@param url The image URL
@param left The value to use for the left cap width. Specify 0 if you want the entire image to be horizontally stretchable.
@param top The value to use for the top cap width. Specify 0 if you want the entire image to be vertically stretchable.
@return The loaded image or _nil_ if the image is not available from cache.
@see loadRemote:
*/
-(UIImage *)loadImmediateStretchableImage:(NSURL *)url withLeftCap:(TiDimension)left topCap:(TiDimension)top;
/**
Returns the full image size.
@param url The image URL
@return The image size.
*/
-(CGSize)fullImageSize:(NSURL *)url;
/**
Tells the loader to load image from URL with delegate.
@param url The image URL.
@param delegate The loader delegate.
@param userInfo The additional properties to be assigned to the request.
@return The image load request.
@see loadRemote:
*/
-(ImageLoaderRequest*)loadImage:(NSURL*)url
delegate:(NSObject<ImageLoaderDelegate>*)delegate
userInfo:(NSDictionary*)userInfo;
/*
Tells the image loader to suspend its activities.
*/
-(void)suspend;
/*
Tells the image loader to resume its activities.
*/
-(void)resume;
/**
Tells the image loader to cancel all activities.
*/
-(void)cancel;
@end
|
/*
* Copyright 2014-2022 Real Logic Limited.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.
*/
#include <errno.h>
#include <stdio.h>
#include <inttypes.h>
#ifndef _MSC_VER
#include <unistd.h>
#include <getopt.h>
#endif
#include "aeronc.h"
#include "aeron_common.h"
#include "aeron_cnc_file_descriptor.h"
#include "concurrent/aeron_distinct_error_log.h"
#include "util/aeron_strutil.h"
#include "util/aeron_error.h"
typedef struct aeron_error_stat_settings_stct
{
const char *base_path;
int64_t timeout_ms;
const char *error_file;
size_t error_file_offset;
}
aeron_error_stat_settings_t;
static const char *aeron_error_stat_usage()
{
return
" -h Displays help information.\n"
" -d basePath Base Path to shared memory. Default: /dev/shm/aeron-[user].\n"
" -t timeout Number of milliseconds to wait to see if the driver metadata is available. Default: 1000.\n"
" -f errorFile Read from a specific file used as a distinct error log (takes precedence over basePath).\n"
" -o errorFileOffset Offset to read error messages from when using a specific file (default 0).\n";
}
static void aeron_error_stat_print_error_and_usage(const char *message)
{
fprintf(stderr, "%s\n%s", message, aeron_error_stat_usage());
}
void aeron_error_stat_on_observation(
int32_t observation_count,
int64_t first_observation_timestamp,
int64_t last_observation_timestamp,
const char *error,
size_t error_length,
void *clientd)
{
char first_timestamp[AERON_MAX_PATH];
char last_timestamp[AERON_MAX_PATH];
aeron_format_date(first_timestamp, sizeof(first_timestamp), first_observation_timestamp);
aeron_format_date(last_timestamp, sizeof(last_timestamp), last_observation_timestamp);
fprintf(
stdout,
"***\n%d observations from %s to %s for:\n %.*s\n",
observation_count,
first_timestamp,
last_timestamp,
(int)error_length,
error);
}
int main(int argc, char **argv)
{
char default_directory[AERON_MAX_PATH];
aeron_default_path(default_directory, AERON_MAX_PATH);
aeron_error_stat_settings_t settings =
{
.base_path = default_directory,
.timeout_ms = 1000,
.error_file = NULL,
.error_file_offset = 0
};
int opt;
while ((opt = getopt(argc, argv, "d:t:f:o:h")) != -1)
{
switch (opt)
{
case 'd':
settings.base_path = optarg;
break;
case 't':
{
errno = 0;
char *endptr;
settings.timeout_ms = strtoll(optarg, &endptr, 10);
if (0 != errno || '\0' != endptr[0])
{
aeron_error_stat_print_error_and_usage("Invalid timeout");
return EXIT_FAILURE;
}
break;
}
case 'f':
settings.error_file = optarg;
break;
case 'o':
{
errno = 0;
char *endptr;
settings.error_file_offset = strtoull(optarg, &endptr, 10);
if (0 != errno || '\0' != endptr[0])
{
aeron_error_stat_print_error_and_usage("Invalid file offset");
return EXIT_FAILURE;
}
break;
}
case 'h':
aeron_error_stat_print_error_and_usage(argv[0]);
return EXIT_SUCCESS;
default:
aeron_error_stat_print_error_and_usage("Unknown option");
return EXIT_FAILURE;
}
}
size_t count;
if (NULL != settings.error_file)
{
aeron_mapped_file_t error_mmap;
if (aeron_map_existing_file(&error_mmap, settings.error_file) < 0)
{
aeron_error_stat_print_error_and_usage(aeron_errmsg());
return EXIT_FAILURE;
}
const uint8_t *error_buffer = (uint8_t *)error_mmap.addr + settings.error_file_offset;
const size_t error_buffer_length = error_mmap.length - settings.error_file_offset;
count = aeron_error_log_read(error_buffer, error_buffer_length, aeron_error_stat_on_observation, NULL, 0);
aeron_unmap(&error_mmap);
}
else
{
aeron_cnc_t *aeron_cnc = NULL;
if (aeron_cnc_init(&aeron_cnc, settings.base_path, settings.timeout_ms) < 0)
{
aeron_error_stat_print_error_and_usage(aeron_errmsg());
return EXIT_FAILURE;
}
count = aeron_cnc_error_log_read(aeron_cnc, aeron_error_stat_on_observation, NULL, 0);
aeron_cnc_close(aeron_cnc);
}
fprintf(stdout, "\n%" PRIu64 " distinct errors observed.\n", (uint64_t)count);
return EXIT_SUCCESS;
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _ACTIVEMQ_UTIL_LONGSEQUENCEGENERATOR_H_
#define _ACTIVEMQ_UTIL_LONGSEQUENCEGENERATOR_H_
#include <activemq/util/Config.h>
#include <decaf/util/concurrent/Mutex.h>
namespace activemq {
namespace util {
/**
* This class is used to generate a sequence of long long values that
* are incremented each time a new value is requested. This class is
* thread safe so the ids can be requested in different threads safely.
*/
class AMQCPP_API LongSequenceGenerator {
private:
long long lastSequenceId;
decaf::util::concurrent::Mutex mutex;
public:
LongSequenceGenerator();
virtual ~LongSequenceGenerator();
/**
* @returns the next id in the sequence.
*/
long long getNextSequenceId();
/**
* @returns the last id that was generated.
*/
long long getLastSequenceId();
};
}}
#endif /*_ACTIVEMQ_UTIL_LONGSEQUENCEGENERATOR_H_*/
|
/**
* Tencent is pleased to support the open source community by making Tars available.
*
* Copyright (C) 2016THL A29 Limited, a Tencent company. All rights reserved.
*
* Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
*
* https://opensource.org/licenses/BSD-3-Clause
*
* 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 __TARS__COMMUNICATOR_EPOLL_H_
#define __TARS__COMMUNICATOR_EPOLL_H_
#include "util/tc_thread.h"
#include "util/tc_thread_mutex.h"
#include "util/tc_epoller.h"
#include "util/tc_loop_queue.h"
#include "servant/Message.h"
#include <set>
namespace tars
{
class Communicator;
class ObjectProxy;
class ObjectProxyFactory;
class StatReport;
class PropertyReport;
////////////////////////////////////////////////////////////////////////
/**
* 监听FD事件并触发注册的handle
*/
struct FDInfo
{
enum
{
ET_C_NOTIFY = 1,
ET_C_NET = 2,
};
/**
* 构造函数
*/
FDInfo()
: iSeq(0)
, fd(-1)
, iType(ET_C_NOTIFY)
, p(NULL)
{
}
/**
* 析构函数
*/
~FDInfo()
{
}
size_t iSeq;
int fd;
int iType;
void * p;
};
////////////////////////////////////////////////////////////////////////
/**
* 客户端网络处理的线程类
*/
class CommunicatorEpoll : public TC_Thread ,public TC_ThreadRecMutex
{
public:
struct NotifyInfo
{
/**
* 构造函数
*/
NotifyInfo()
: eventFd(-1)
, bValid(false)
{
}
/**
* 析构函数
*/
~NotifyInfo()
{
}
FDInfo stFDInfo; //通知FD信息
TC_Epoller::Notify notify; //通知fd
int eventFd; //eventfd,目前未使用
bool bValid; //是否有效
};
/**
* 构造函数
*/
CommunicatorEpoll(Communicator * pCommunicator, size_t _netThreadSeq);
/**
* 析构函数
*/
virtual ~CommunicatorEpoll();
/**
* 获取 Communicator
*/
inline Communicator * getCommunicator()
{
return _communicator;
}
/**
* 获取 ObjectProxyFactory
*/
inline ObjectProxyFactory * getObjectProxyFactory()
{
return _objectProxyFactory;
}
/**
* 获取 网络线程id
*/
inline size_t getCommunicatorEpollId()
{
return _netThreadSeq;
}
/**
* 获取 节点队列未发送请求的大小限制
*/
inline size_t getNoSendQueueLimit()
{
return _noSendQueueLimit;
}
/*
* 判断是否是第一个网络线程 主控写缓存的时候用到
*/
inline bool isFirstNetThread()
{
return (_netThreadSeq == 0);
}
/*
* 获取本epoll的代理对象
*/
ObjectProxy * getObjectProxy(const string & sObjectProxyName,const string& setName="");
/**
* 循环监听网络事件
*/
virtual void run();
/**
* 中止监听
*/
void terminate();
/**
* 注册fd对应的处理handle
* @param fd
* @param info 事件指针
* @param event
* @param handle
*/
void addFd(int fd,FDInfo * info, uint32_t events);
/**
* 取消已注册的handle
* @param fd
* @param info 事件指针
* @param event
* @param handle
*/
void delFd(int fd,FDInfo * info, uint32_t events);
/**
* 通知事件过来
* @param fd
*/
void notify(size_t iSeq,ReqInfoQueue * pReqQueue);
/**
* 通知删除事件过来
* @param iSeq
*/
void notifyDel(size_t iSeq);
/**
* 数据加入到异步线程队列里面
* @return
*/
void pushAsyncThreadQueue(ReqMessage * msg);
protected:
/**
* 处理函数
*
* @param pFDInfo
* @param events
*/
void handle(FDInfo * pFDInfo, uint32_t events);
/**
* 输入事件
* @param pi
*/
void handleInputImp(Transceiver * pTransceiver);
/**
* 输出事件
* @param pi
*/
void handleOutputImp(Transceiver * pTransceiver);
/**
* 处理超时
* @param pi
*/
void doTimeout();
/**
* 处理stat
* @param pi
*/
void doStat();
protected:
/*
* 通信器
*/
Communicator * _communicator;
/*
* 请求事件通知数组
*/
NotifyInfo _notify[MAX_CLIENT_NOTIFYEVENT_NUM];
/*
* 关闭线程请求的事件通知
*/
TC_Epoller::Notify _shutdown;
/*
* 线程是否终止
*/
bool _terminate;
/*
* epoll
*/
TC_Epoller _ep;
/*
* 下次检查超时的时间
*/
int64_t _nextTime;
/*
* 下次上报数据的时间
*/
int64_t _nextStatTime;
/*
* ObjectProxy的工厂类
*/
ObjectProxyFactory * _objectProxyFactory;
/*
* 异步线程数组
*/
AsyncProcThread * _asyncThread[MAX_CLIENT_ASYNCTHREAD_NUM];
/*
* 异步线程数目
*/
size_t _asyncThreadNum;
/*
* 分发给异步线程的索引seq
*/
size_t _asyncSeq;
/*
* 网络线程的id号
*/
size_t _netThreadSeq;
/*
* 异步队列的统计上报的对象
*/
PropertyReport * _reportAsyncQueue;
/*
* 节点ip队列未发送请求的大小限制
*/
size_t _noSendQueueLimit;
/*
* epoll wait的超时时间
*/
int64_t _waitTimeout;
/*
* 超时的检查时间间隔
*/
int64_t _timeoutCheckInterval;
};
/////////////////////////////////////////////////////////////////////////////////////
}
#endif
|
#ifndef _ldskflsld_cmdmdmdmdmdmdmdmd_ikdjjfjkskskskfj_h_lsldkfj
#define _ldskflsld_cmdmdmdmdmdmdmdmd_ikdjjfjkskskskfj_h_lsldkfj
#include "FileBaseStream.h"
#include "MemStream.h"
#include <string>
using namespace std;
class CMemToFile : public FileBaseStream, public MemStream
{
public:
CMemToFile(const char *d, int s, const char *n);
~CMemToFile(void){}
const char* fname() const {return m_fn.c_str();}
CEFilePtr getFptr() const {return CEFilePtr();}
void attach(CEFilePtr file){}
bool isValid() const { return m_fn.length() > 0 && MemStream::isValid(); }
int fileLength() {return MemStream::getLength();}
bool existFile() { return m_fn.length() > 0 && MemStream::isValid(); }
bool rOrw() { return MemStream::rOrw(); }
bool openFS(){ return MemStream::openFS(); }
private:
string m_fn;
};
#endif
|
/* Copyright 2017 Jonathan Realmuto
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 <stdint.h>
#include "soc_AM33XX.h"
#include "hw_types.h"
#include "spidriver.h"
void spiInit(void)
{
uint16_t clkdiv_ch0 = 800;
uint16_t clkdiv_ch1 = 200;
// CM_PER_SPI1_CLKCTRL: MODULEMODE = 0x2
// This just enables the SPI1 module
HWREG(0x44E00050) = (0x2);
// MCSPI_SYSCONFIG: Reset Module
HWREG(SOC_SPI_1_REGS + 0x110) = (0x1 << 1);
// MCSPI_SYSSTATUS: Poll for Reset done flag
while( (HWREG(SOC_SPI_1_REGS + 0x114) & 0x1) != 0x1) {}
// MCSPI_MODULCTRL: FDAA = 0x0 - FIFO data in MCSPI_(TX/RX)(i)
// MOA = 0x0 - multi word disabled
// INITDLY = 0x0 - no delay
// SYSTEM_TEST = 0x0 - Functional mode
// MS = 0x0 - master mode
// PIN34 = 0x0 - SPIEN used as CS
// SINGLE = 0x0 - multi-channel
HWREG(SOC_SPI_1_REGS + 0x128) = 0x00000000;
// MCSPI_SYSCONFIG: CLOCKACTIVITY = 0x3 - ocp and func. clocks maintained
// SIDLEMODE = 0x2 - smart idle
// AUTOIDLE = 0x1 - auto idle
HWREG(SOC_SPI_1_REGS + 0x110) = (0x3 << 8) | (0x1 << 3) | 0x0;
// MCSPI_IQRSTATUS: reset all interrupts
HWREG(SOC_SPI_1_REGS + 0x118) = 0xFFFFFFFF;
// MCSPI_IQRENABLE: none
HWREG(SOC_SPI_1_REGS + 0x11C) = 0x00000000;
// -- CHANNEL 0 -------------------------------------------------------------
//
// Set up for LSM6DS3.
// Word Length - 16-bit
// POL = 1, PHA = 1
// --------------------------------------------------------------------------
// MCSPI_CH0CONF: CLKG = 0x1 - a clock cycle granularity
// DPE0 = 0x1 - No TX on SPIDAT[0]
// WL = 0x7 - word length of 8-bits
// EPOL = 0x1 - CS low for active state
// CLKD = 0x4 - divide by 16
HWREG(SOC_SPI_1_REGS + 0x12C) = (0x1 << 29) | (0x0 << 25) | (0x0 << 18)
| (0x1 << 16)
| (0x17 << 7) | (0x1 << 6)
| ( (clkdiv_ch0 & 0xF) << 2) | (0x1);
// MCSPI_CH0CTRL: EXTCLK = clock divider extension
// EN = 0x1 - enable channel 0
HWREG(SOC_SPI_1_REGS + 0x134) = ( ((clkdiv_ch0 >> 4) & 0xFF) << 8) | 0x1;
// -- CHANNEL 1 -------------------------------------------------------------
//
// Set up for atm encoder.
// Word Length - 8-bit
// POL = 0, PHA = 0
// --------------------------------------------------------------------------
// MCSPI_CH1CONF: CLKG = 0x1 - a clock cycle granularity
// DPE0 = 0x1 - No TX on SPIDAT[0]
// WL = 0x7 - word length of 8-bits
// EPOL = 0x1 - CS low for active state
// CLKD = 0x4 - divide by 16
HWREG(SOC_SPI_1_REGS + 0x140) = (0x1 << 29) | (0x3 << 25) | (0x1 << 16)
| (0x7 << 7) | (0x1 << 6)
| ( (clkdiv_ch1 & 0xF) << 2);
// MCSPI_CH1CTRL: EXTCLK = clock divider extension
// EN = 0x1 - enable channel 1
HWREG(SOC_SPI_1_REGS + 0x148) = ( ((clkdiv_ch1 >> 4) & 0xFF) << 8) | 0x1;
}
uint32_t spiXfer(uint8_t channel, uint32_t tx)
{
// IMU -- WL: 16-bits
if (channel == 0){
// MCSPI_TX0: Write payload to tx buffer
HWREG(SOC_SPI_1_REGS + 0x138) = tx;
// MCSPI_CH0STAT: Poll End of Transmission
while( (HWREG(SOC_SPI_1_REGS + 0x130) & (1 << 2)) == 0) {}
// MCSPI_RX0: Read Word
return (uint32_t) HWREG(SOC_SPI_1_REGS + 0x13C);
}
// Encoder -- WL: 8-bits
else if (channel == 1) {
// MCSPI_TX1: Write payload to tx buffer
HWREG(SOC_SPI_1_REGS + 0x14C) = (uint8_t) tx;
// MCSPI_CH1STAT: Poll End of Transmission
while( (HWREG(SOC_SPI_1_REGS + 0x144) & (1 << 2)) == 0) {}
// MCSPI_RX1: Read Word
return (uint8_t) HWREG(SOC_SPI_1_REGS + 0x150);
}
return 0;
}
void spiCleanUp(void)
{
// Disable both channels
HWREG(SOC_SPI_1_REGS + 0x134) &= ~(0x1);
HWREG(SOC_SPI_1_REGS + 0x148) &= ~(0x1);
// Release clock
HWREG(0x44E00050) = (0x0);
}
|
/*
* Project: FullereneViewer
* Version: 1.0
* Copyright: (C) 2011-15 Dr.Sc.KAWAMOTO,Takuji (Ext)
*/
#ifndef __POSTURE_H__
#define __POSTURE_H__
#include "Matrix3.h"
#include "Vector3.h"
class Posture {
// members
public:
Matrix3 posture;
bool fixed;
Matrix3 fixed_posture;
Matrix3 last_posture;
Vector3 next_moment;
// constructors & the destructor
public:
Posture() : posture(), fixed(false), fixed_posture(), last_posture(), next_moment() { }
~Posture() { }
Posture& operator = (const Posture& you); /* dont use */
// stability
bool stabled() const { return last_posture == posture; }
};
#endif /* __POSTURE_H__ */
/* Local Variables: */
/* mode: c++ */
/* End: */
|
//
// ViewController.h
// QuakeRadar
//
// Created by Tekhne on 10/26/13.
// Copyright (c) 2013 Tekhne. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import "QuakeUtilities.h"
#import "Quake.h"
@interface MapViewController : UIViewController
@property (weak, nonatomic) IBOutlet MKMapView *mapView;
@end
|
/**********************************************************************
Filename : BoaScriptException.h
Content :
Created : June 20, 2013
Authors : Boris Rayskiy
Copyright : (c) 2013
**********************************************************************/
#ifndef _BOA_SCRIPT_EXCEPTION_H_
#define _BOA_SCRIPT_EXCEPTION_H_
#include <BException.h>
using namespace BoriSoft;
namespace BoriSoft {
namespace util {
class BoaScriptException : public util::BException
{
public:
BoaScriptException(std::string msg) : BException(msg) {}
};
} // namespace util
} // namespace BoriSoft
#define THROW_BOA_SCRIPT_EXCEPTION(msg) \
{ \
std::ostringstream oss; \
oss << "BoaScriptException: "; \
oss << __FILE__ << ": "; \
oss << __LINE__ << " "; \
oss << msg; \
\
throw util::BoaScriptException(oss.str()); \
}
#endif // _B_PLOT_EXCEPTION_H_
|
/*=========================================================================
Program: GDCM (Grassroots DICOM). A DICOM library
Copyright (c) 2006-2011 Mathieu Malaterre
All rights reserved.
See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
#ifndef GDCMABSTRACTSYNTAX_H
#define GDCMABSTRACTSYNTAX_H
#include "gdcmTypes.h"
#include "gdcmUIDs.h"
#include "gdcmDataElement.h"
namespace gdcm
{
namespace network
{
/**
* \brief AbstractSyntax
* Table 9-14
* ABSTRACT SYNTAX SUB-ITEM FIELDS
*/
class AbstractSyntax
{
public:
AbstractSyntax();
std::istream &Read(std::istream &is);
const std::ostream &Write(std::ostream &os) const;
void SetName( const char *name ) { UpdateName( name ); }
const char *GetName() const { return Name.c_str(); }
// accept a UIDs::TSType also...
void SetNameFromUID( UIDs::TSName tsname );
//now that the PresentationContext messes around with UIDs and returns a string
//use that string as well.
//void SetNameFromUIDString( const std::string& inUIDName );
size_t Size() const;
void Print(std::ostream &os) const;
bool operator==(const AbstractSyntax & as) const
{
return Name == as.Name;
}
DataElement GetAsDataElement() const;
private:
void UpdateName( const char *name );
static const uint8_t ItemType;
static const uint8_t Reserved2;
uint16_t ItemLength; // len of
std::string /*AbstractSyntax*/ Name; // UID
};
} // end namespace network
} // end namespace gdcm
#endif //GDCMABSTRACTSYNTAX_H
|
/*
Copyright (c) 2010 Aldo J. Nunez
Licensed under the Apache License, Version 2.0.
See the LICENSE text file for details.
*/
#pragma once
const GUID& GetEngineId();
const wchar_t* GetEngineName();
const GUID& GetDLanguageId();
const GUID& GetDExceptionType();
const GUID& GetWin32ExceptionType();
const wchar_t* GetRootDExceptionName();
const wchar_t* GetRootWin32ExceptionName();
enum StringIds
{
IDS_NONE,
IDS_NO_SYMS_FOR_DOC,
IDS_NO_CODE_FOR_LINE,
IDS_INVALID_ADDRESS,
IDS_REGGROUP_CPU,
IDS_REGGROUP_CPU_SEGMENTS,
IDS_REGGROUP_FLOATING_POINT,
IDS_REGGROUP_FLAGS,
IDS_REGGROUP_MMX,
IDS_REGGROUP_SSE,
IDS_REGGROUP_SSE2,
IDS_LINE,
IDS_BYTES,
IDS_BP_TRIGGERED,
IDS_FIRST_CHANCE_EXCEPTION,
IDS_UNHANDLED_EXCEPTION,
};
struct MagoOptions
{
bool hideInternalNames;
bool showStaticsInAggr;
bool showVTable;
bool flatClassFields;
bool expandableStrings;
bool hideReferencePointers;
bool removeLeadingHexZeroes;
bool recombineTuples;
bool showDArrayLengthInType;
bool callDebuggerFunctions;
bool callDebuggerRanges;
bool callDebuggerUseMagoGC;
int maxArrayElements;
};
extern MagoOptions gOptions;
bool readMagoOptions();
const wchar_t* GetString( DWORD strId );
bool GetString( DWORD strId, CString& str );
LSTATUS OpenRootRegKey( bool user, bool readWrite, HKEY& hKey );
LSTATUS GetRegString( HKEY hKey, const wchar_t* valueName, wchar_t* charBuf, int& charLen );
LSTATUS GetRegValue( HKEY hKey, const wchar_t* valueName, DWORD* pValue );
|
//
// eLongTakePictureService.h
// eLongFramework
//
// Created by 吕月 on 16/4/19.
// Copyright © 2016年 Kirn. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "eLongTakePictureServiceDelegate.h"
@interface eLongTakePictureService : NSObject <eLongTakePictureServiceDelegate>
@end
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-2.0-xr-w32-bld/build/toolkit/components/startup/public/nsIUserInfo.idl
*/
#ifndef __gen_nsIUserInfo_h__
#define __gen_nsIUserInfo_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIUserInfo */
#define NS_IUSERINFO_IID_STR "6c1034f0-1dd2-11b2-aa14-e6657ed7bb0b"
#define NS_IUSERINFO_IID \
{0x6c1034f0, 0x1dd2, 0x11b2, \
{ 0xaa, 0x14, 0xe6, 0x65, 0x7e, 0xd7, 0xbb, 0x0b }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIUserInfo : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IUSERINFO_IID)
/* readonly attribute wstring fullname; */
NS_SCRIPTABLE NS_IMETHOD GetFullname(PRUnichar **aFullname) = 0;
/* readonly attribute string emailAddress; */
NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(char **aEmailAddress) = 0;
/* readonly attribute string username; */
NS_SCRIPTABLE NS_IMETHOD GetUsername(char **aUsername) = 0;
/* readonly attribute string domain; */
NS_SCRIPTABLE NS_IMETHOD GetDomain(char **aDomain) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIUserInfo, NS_IUSERINFO_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIUSERINFO \
NS_SCRIPTABLE NS_IMETHOD GetFullname(PRUnichar **aFullname); \
NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(char **aEmailAddress); \
NS_SCRIPTABLE NS_IMETHOD GetUsername(char **aUsername); \
NS_SCRIPTABLE NS_IMETHOD GetDomain(char **aDomain);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIUSERINFO(_to) \
NS_SCRIPTABLE NS_IMETHOD GetFullname(PRUnichar **aFullname) { return _to GetFullname(aFullname); } \
NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(char **aEmailAddress) { return _to GetEmailAddress(aEmailAddress); } \
NS_SCRIPTABLE NS_IMETHOD GetUsername(char **aUsername) { return _to GetUsername(aUsername); } \
NS_SCRIPTABLE NS_IMETHOD GetDomain(char **aDomain) { return _to GetDomain(aDomain); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIUSERINFO(_to) \
NS_SCRIPTABLE NS_IMETHOD GetFullname(PRUnichar **aFullname) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetFullname(aFullname); } \
NS_SCRIPTABLE NS_IMETHOD GetEmailAddress(char **aEmailAddress) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetEmailAddress(aEmailAddress); } \
NS_SCRIPTABLE NS_IMETHOD GetUsername(char **aUsername) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUsername(aUsername); } \
NS_SCRIPTABLE NS_IMETHOD GetDomain(char **aDomain) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetDomain(aDomain); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsUserInfo : public nsIUserInfo
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIUSERINFO
nsUserInfo();
private:
~nsUserInfo();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsUserInfo, nsIUserInfo)
nsUserInfo::nsUserInfo()
{
/* member initializers and constructor code */
}
nsUserInfo::~nsUserInfo()
{
/* destructor code */
}
/* readonly attribute wstring fullname; */
NS_IMETHODIMP nsUserInfo::GetFullname(PRUnichar **aFullname)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute string emailAddress; */
NS_IMETHODIMP nsUserInfo::GetEmailAddress(char **aEmailAddress)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute string username; */
NS_IMETHODIMP nsUserInfo::GetUsername(char **aUsername)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* readonly attribute string domain; */
NS_IMETHODIMP nsUserInfo::GetDomain(char **aDomain)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
// 14c13684-1dd2-11b2-9463-bb10ba742554
#define NS_USERINFO_CID \
{ 0x14c13684, 0x1dd2, 0x11b2, \
{0x94, 0x63, 0xbb, 0x10, 0xba, 0x74, 0x25, 0x54}}
#define NS_USERINFO_CONTRACTID "@mozilla.org/userinfo;1"
#endif /* __gen_nsIUserInfo_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/core/client/CoreErrors.h>
#include <aws/directconnect/DirectConnect_EXPORTS.h>
namespace Aws
{
namespace DirectConnect
{
enum class DirectConnectErrors
{
//From Core//
//////////////////////////////////////////////////////////////////////////////////////////
INCOMPLETE_SIGNATURE = 0,
INTERNAL_FAILURE = 1,
INVALID_ACTION = 2,
INVALID_CLIENT_TOKEN_ID = 3,
INVALID_PARAMETER_COMBINATION = 4,
INVALID_QUERY_PARAMETER = 5,
INVALID_PARAMETER_VALUE = 6,
MISSING_ACTION = 7, // SDK should never allow
MISSING_AUTHENTICATION_TOKEN = 8, // SDK should never allow
MISSING_PARAMETER = 9, // SDK should never allow
OPT_IN_REQUIRED = 10,
REQUEST_EXPIRED = 11,
SERVICE_UNAVAILABLE = 12,
THROTTLING = 13,
VALIDATION = 14,
ACCESS_DENIED = 15,
RESOURCE_NOT_FOUND = 16,
UNRECOGNIZED_CLIENT = 17,
MALFORMED_QUERY_STRING = 18,
SLOW_DOWN = 19,
REQUEST_TIME_TOO_SKEWED = 20,
INVALID_SIGNATURE = 21,
SIGNATURE_DOES_NOT_MATCH = 22,
INVALID_ACCESS_KEY_ID = 23,
REQUEST_TIMEOUT = 24,
NETWORK_CONNECTION = 99,
UNKNOWN = 100,
///////////////////////////////////////////////////////////////////////////////////////////
DIRECT_CONNECT_CLIENT= static_cast<int>(Aws::Client::CoreErrors::SERVICE_EXTENSION_START_RANGE) + 1,
DIRECT_CONNECT_SERVER,
DUPLICATE_TAG_KEYS,
TOO_MANY_TAGS
};
namespace DirectConnectErrorMapper
{
AWS_DIRECTCONNECT_API Aws::Client::AWSError<Aws::Client::CoreErrors> GetErrorForName(const char* errorName);
}
} // namespace DirectConnect
} // namespace Aws
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2011 by Appcelerator, 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.
*/
// A good bit of this code was derived from the Three20 project
// and was customized to work inside spfc_me
//
// All modifications by spfc_me are licensed under
// the Apache License, Version 2.0
//
//
// Copyright 2009 Facebook
//
// 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.
//
#ifdef USE_TI_UIDASHBOARDVIEW
#import <Foundation/Foundation.h>
@class LauncherItem;
@interface LauncherButton : UIButton {
BOOL dragging;
BOOL editing;
LauncherItem *item;
UIButton *button;
UIButton *closeButton;
UIButton *badge;
}
@property(nonatomic,readwrite,retain) LauncherItem *item;
@property(nonatomic,readonly) UIButton *closeButton;
@property(nonatomic) BOOL dragging;
@property(nonatomic) BOOL editing;
@end
#endif
|
/*
* FFIO.h
*
* Created on: Sep 13, 2014
* Author: amlogic
*/
#ifndef FFIO_H_
#define FFIO_H_
extern "C"
{
#include <stdint.h>
#include <libavformat/avio.h>
}
#include "DataSource.h"
namespace android {
class FFIO {
public:
FFIO();
~FFIO();
bool init(DataSource* src);
AVIOContext* getContext() { return mInitCheck ? mContext : NULL; }
private:
bool mInitCheck;
AVIOContext* mContext;
DataSource* mSource;
int64_t mNextReadPos;
int32_t mWakeupHandle;
int32_t read(uint8_t* buf, int read_size);
int64_t seek(int64_t offset, int whence);
static int32_t staticRead(void* thiz, uint8_t* buf, int read_size);
static int32_t staticWrite(void* thiz, uint8_t* buf, int write_size);
static int64_t staticSeek(void* thiz, int64_t offset, int whence);
};
};
#endif /* FFIO_H_ */
|
//
// Generated by gen_resource_source.py
//
#ifndef _COM_IBM_ICU_IMPL_DATA_ICUDT58B_ZONE_EN_KI_RES_H
#define _COM_IBM_ICU_IMPL_DATA_ICUDT58B_ZONE_EN_KI_RES_H
static jbyte _com_ibm_icu_impl_data_icudt58b_zone_en_KI_res[] = {
0x00, 0x20, 0xDA, 0x27, 0x00, 0x14, 0x00, 0x00, 0x01, 0x00,
0x02, 0x00, 0x52, 0x65, 0x73, 0x42, 0x03, 0x00, 0x00, 0x00,
0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x50, 0x00, 0x00, 0x01, 0x00, 0x1B, 0xF3, 0x08,
0x00, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x0C, 0x00, 0x00,
0x00, 0x0C, 0x00, 0x00, 0x00, 0x02, 0x1B, 0xF3, 0x00, 0x04,
0x00, 0x00, 0x00, 0x0C, 0xF9, 0x85, 0x50, 0x53, 0x00, 0x00,
0x00, 0x02, 0x24, 0xFD, 0x00, 0x00, 0x05, 0xFF, 0x1B, 0xF2,
};
J2OBJC_RESOURCE(\
_com_ibm_icu_impl_data_icudt58b_zone_en_KI_res, \
80, \
0x1604a7e1);
#endif
|
#include "Ougens.h"
#include <Instrument.h>
class MYWAVETABLE : public Instrument {
Ooscili *theOscil;
Ooscili *theEnv;
float _amp;
float _pitch;
float _spread;
int _updateCounter;
public:
MYWAVETABLE();
virtual ~MYWAVETABLE();
virtual int init(double p[], int n_args);
virtual int run();
};
|
/*
Copyright 2016 Esri
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 2015 ESRI
//
// All rights reserved under the copyright laws of the United States
// and applicable international laws, treaties, and conventions.
//
// You may freely redistribute and use this sample code, with or
// without modification, provided you include the original copyright
// notice and use restrictions.
//
// See the use restrictions at <your ArcGIS install location>/DeveloperKit10.3/userestrictions.txt.
//
// SimpleXform.h : Declaration of the SimpleXform
#ifndef __SIMPLEXFORM_H_
#define __SIMPLEXFORM_H_
#include "resource.h" // main symbols
_COM_SMARTPTR_TYPEDEF(ISimpleXform, __uuidof(ISimpleXform));
/////////////////////////////////////////////////////////////////////////////
// SimpleXform
class ATL_NO_VTABLE SimpleXform :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<SimpleXform, &CLSID_SimpleXform>,
public ISupportErrorInfo,
public IGeodataXform,
public ISimpleXform,
public IPersistStream,
public IClone
{
public:
SimpleXform();
DECLARE_REGISTRY_RESOURCEID(IDR_CUSTOMXFORM)
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(SimpleXform)
COM_INTERFACE_ENTRY(ISupportErrorInfo)
COM_INTERFACE_ENTRY(IGeodataXform)
COM_INTERFACE_ENTRY(ISimpleXform)
COM_INTERFACE_ENTRY(IPersistStream)
COM_INTERFACE_ENTRY(IClone)
END_COM_MAP()
HRESULT FinalConstruct();
void FinalRelease();
public:
// ISupportsErrorInfo
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
// ISimpleXform
STDMETHOD(get_Name)(BSTR* pName);
STDMETHOD(put_Name)(BSTR name);
// IGeodataXform methods
STDMETHOD(get_SpatialReference)(ISpatialReference** ppSpatialReference);
STDMETHOD(putref_SpatialReference)(ISpatialReference* pSpatialReference);
STDMETHOD(get_Domains)(IGeometryCollection** ppDomains);
STDMETHOD(get_IsIdentity)(VARIANT_BOOL* pIsIdentity);
STDMETHOD(Transform)(esriTransformDirection direction, long npoints, WKSPoint* points);
STDMETHOD(TransformCellsize)(esriTransformDirection direction, double* dx, double* dy, IEnvelope* pAreaOfInterest);
STDMETHOD(TransformExtent)(esriTransformDirection direction, IEnvelope* pExtent);
STDMETHOD(TransformPoints)(esriTransformDirection direction, IPointCollection* pPoints);
// IPersistStream
STDMETHOD(IsDirty)();
STDMETHOD(Load)(IStream * pstm);
STDMETHOD(Save)(IStream * pstm, BOOL fClearDirty);
STDMETHOD(GetSizeMax)(_ULARGE_INTEGER * pcbSize);
STDMETHOD(GetClassID)(CLSID* pClassID);
// IClone methods
STDMETHOD(Clone)(IClone** ppClone);
STDMETHOD(Assign)(IClone* pOther);
STDMETHOD(IsEqual)(IClone* pOther, VARIANT_BOOL* pbEqual);
STDMETHOD(IsIdentical)(IClone* pOther, VARIANT_BOOL* pbIsIdentical);
private:
ISpatialReferencePtr m_ipSpatialReference;
IGeometryCollectionPtr m_ipDomains;
ISpatialReferencePtr m_ipUnknownCoordinateSystem;
CComBSTR m_name;
double m_dx;
double m_dy;
WKSPoint* m_points;
long m_size;
};
#endif
|
//
// GLUtil.h
//
// Created by Jingshu Huang on 8/28/13.
// Copyright (c) HuangImage 2013. All rights reserved.
//
#ifndef __GLUtil__
#define __GLUtil__
#include <string>
#include "platformGL.h"
typedef enum {
BlendNone,
BlendAlpha,
BlendAdditive,
BlendAlphaAdditive,
BlendCustom
} BlendMode;
typedef enum {
CullNone,
CullBack,
CullFront,
CullFrontAndBack
} CullMode;
// utilility
bool glGetErrorPrettyPrint(const int lineNumber);
void GL_init();
void GL_clearColor(float r, float g, float b, float a);
void GL_clear(GLbitfield clearBuffers);
void GL_viewport(GLint x, GLint y, GLsizei width, GLsizei height);
// vbo
void GL_genBuffers(GLsizei number, GLuint *buffers);
void GL_deleteBuffers(GLsizei number, const GLuint *buffers);
void GL_bufferData(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage);
void GL_bindBuffer(GLenum type, GLuint bufferId);
void GL_unbindBuffer();
void GL_verifyBuffer(GLuint bufferId);
// Rendering state.
void GL_pixelStorei(GLenum pname, GLint param);
void GL_setZTest(bool state);
void GL_setZWrite(bool state);
void GL_setBackfaceCulling(bool state);
void GL_setFaceCulling(CullMode mode);
void GL_setBlending(bool state);
void GL_setBlendFunc(int src, int dst);
// Texture.
void GL_genTextures(GLenum type, GLuint *texId);
void GL_bindTexture(GLenum type, GLuint texId);
void GL_compressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data);
void GL_texImage2D(GLenum target, int level, int internalFormat, GLsizei w, GLsizei h, int border, GLenum format, GLenum type, GLvoid *data);
void GL_texParameteri(GLenum target, GLenum pname, GLint param);
void GL_activeTexture(GLenum texture);
// Shader attributes and uniforms
void GL_uniform1fv(GLint location, GLsizei count, const GLfloat *value);
void GL_uniform2fv(GLint location, GLsizei count, const GLfloat *value);
void GL_uniform3fv(GLint location, GLsizei count, const GLfloat *value);
void GL_uniform4fv(GLint location, GLsizei count, const GLfloat *value);
void GL_uniform1iv(GLint location, GLsizei count, const GLint *value);
void GL_uniform2iv(GLint location, GLsizei count, const GLint *value);
void GL_uniform3iv(GLint location, GLsizei count, const GLint *value);
void GL_uniform4iv(GLint location, GLsizei count, const GLint *value);
void GL_uniform1i(GLint location, GLint value);
void GL_uniform1f(GLint location, GLfloat value);
void GL_uniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
void GL_enableVertexAttribArray(GLuint location);
void GL_disableVertexAttribArray(GLuint location);
void GL_vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer);
GLint GL_getUniformLocation(GLuint program, const GLchar *name);
GLint GL_getAttribLocation(GLuint program, const GLchar *name);
// Shader program compile, link
GLuint GL_createShader(GLenum shaderType);
void GL_deleteShader(GLuint shader);
void GL_shaderSource(GLuint shader, GLsizei count, const GLchar **string, const GLint *length);
bool GL_compileShader(GLuint shader);
GLuint GL_createProgram();
void GL_deleteProgram(GLuint& program);
void GL_attachShader(GLuint program, GLuint shader);
bool GL_linkProgram(GLuint program);
bool GL_validateProgram(GLuint program);
void GL_useProgram(GLuint program);
// draw calls.
void GL_drawArrays(GLenum mode, GLint first, GLsizei count);
void GL_drawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
#endif
|
/*-----------------------------------------------------------------------------
Header to use with JPEG.LIB.
functions: int ReadJPEG (char * buffer, stJPEG *Image)
[buffer] - buffer with compressed JPEG, it's freing after
decompression
[stJPEG] - structure with decompressed JPEG
{
DWORD dwWidth, dwHeight;
unsigned char ucData;
[ucData] - pointer to decompressed data BGR (blue,green,red)
}
HBITMAP ConvertJPEGtoBITMAP(stJPEG *Info, HWND hWnd)
[stJPEG] - structure with decompresed JPEG
[hWnd] - handle to window when bitmap will be show
Adam Joniec [-SAuron-]
saur@cad.pl
-----------------------------------------------------------------------------*/
#include <windows.h>
#include "jpegdata.h"
int jwidthline;
struct stJPEG
{
DWORD dwWidth, dwHeight;
unsigned char *ucData;
};
static void output_init (decompress_info_ptr cinfo)
{
jwidthline = cinfo->image_width * 3;
if ( jwidthline%4 )
jwidthline = ((jwidthline/4)*4)+4;
cinfo->output_image = new char[jwidthline * cinfo->image_height];
cinfo->output_imageptr = cinfo->output_image + (jwidthline*cinfo->image_height) - jwidthline;
}
static void put_color_map (decompress_info_ptr cinfo, int num_colors, JSAMPARRAY colormap)
{
}
static void put_pixel_rows (decompress_info_ptr cinfo, int num_rows, JSAMPIMAGE pixel_data)
{
register char *image;
register JSAMPROW ptr0, ptr1, ptr2;
register int col, row;
for (row = 0; row < num_rows; row++)
{
ptr0 = pixel_data[0][row];
ptr1 = pixel_data[1][row];
ptr2 = pixel_data[2][row];
image = cinfo->output_imageptr;
for (col = 0; col < cinfo->image_width; col++)
{
*image = *ptr2;
image++; ptr2++;
*image = *ptr1;
image++; ptr1++;
*image = *ptr0;
image++; ptr0++;
}
cinfo->output_imageptr -= jwidthline;
}
}
static void output_term (decompress_info_ptr cinfo)
{
}
static void d_ui_method_selection (decompress_info_ptr cinfo)
{
cinfo->methods->output_init = output_init;
cinfo->methods->put_color_map = put_color_map;
cinfo->methods->put_pixel_rows = put_pixel_rows;
cinfo->methods->output_term = output_term;
}
int ReadJPEG (char * buffer, stJPEG *Image)
{
struct Decompress_info_struct cinfo;
struct Decompress_methods_struct dc_methods;
struct External_methods_struct e_methods;
cinfo.methods = &dc_methods;
cinfo.emethods = &e_methods;
jselerror(cinfo.emethods);
jselmemmgr(cinfo.emethods);
cinfo.methods->d_ui_method_selection = d_ui_method_selection;
j_d_defaults(&cinfo, TRUE);
jselrjfif(&cinfo);
cinfo.input_filebuffer = buffer;
jpeg_decompress(&cinfo);
delete cinfo.input_filebuffer;
Image->dwWidth = cinfo.image_width;
Image->dwHeight = cinfo.image_height;
Image->ucData = (unsigned char*)cinfo.output_image;
return 1;
}
HBITMAP ConvertJPEGtoBITMAP(stJPEG *Info, HWND hWnd)
{
HBITMAP hBitmap;
BITMAPINFOHEADER bhinfo;
BITMAPINFO binfo;
bhinfo.biSize = sizeof(BITMAPINFOHEADER);
bhinfo.biWidth = Info->dwWidth;
bhinfo.biHeight = Info->dwHeight;
bhinfo.biPlanes = 1;
bhinfo.biBitCount = 24;
bhinfo.biCompression = BI_RGB;
memcpy(&binfo.bmiHeader, &bhinfo, bhinfo.biSize);
hBitmap = ( HBITMAP)CreateDIBitmap(GetDC(hWnd), &bhinfo,
CBM_INIT, Info->ucData, &binfo, DIB_RGB_COLORS);
return hBitmap;
}
|
//
// LoadModel.h
// OpenSourceChina
//
// Created by bokan on 16/6/25.
// Copyright © 2016年 guozhidong. All rights reserved.
//
#import <Foundation/Foundation.h>
typedef void(^SuccessCallBack)(id responseObject);
//请求失败代码块
typedef void(^FailCallBack) (NSError *error);
@interface LoadModel : NSObject
/**
* 网络post方式请求
*
* @param urlStr 请求主链接
* @param paramsDict 链接参数body
* @param sucCallBack 请求成功回调代码块
* @param failCallBack 请求失败回调代码块
*/
+(void)postRequestWithUrl:(NSString *)urlStr
andParams:(NSDictionary *)paramsDict
andSucBlock:(SuccessCallBack)sucCallBack
andFailBlock:(FailCallBack)failCallBack;
/**
* 网络get方式请求
*
* @param urlStr 请求主链接
* @param sucCallBack 请求成功回调代码块
* @param failCallBack 请求失败回调代码块
*/
+(void)getRequestWithUrl:(NSString *)urlStr
andSucBlock:(SuccessCallBack)sucCallBack
andFailBlock:(FailCallBack)failCallBack;
@end
|
/*
* Copyright (C) 2015 luodichen
*
* 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.
*/
/*
* BaseRecord.h
*
* Created on: 2015年5月5日
* Author: luodichen
*/
#ifndef SRC_RECORD_BASERECORD_H_
#define SRC_RECORD_BASERECORD_H_
#include <stdint.h>
#include <string.h>
#include "../common/errcode.h"
class BaseRecord
{
public:
BaseRecord(size_t size);
BaseRecord(const BaseRecord &);
virtual ~BaseRecord();
virtual BaseRecord &operator=(const BaseRecord &);
public:
virtual int StreamInput(uint8_t word);
const uint8_t *GetRawData() const;
size_t GetRawDataLength() const;
virtual size_t GetDataLength() const;
virtual uint16_t GetType() const;
private:
size_t m_nRawSize;
uint8_t *m_pRawData;
size_t m_nWordsReaded;
protected:
uint16_t m_sType;
public:
static const uint16_t TYPE;
};
#endif /* SRC_RECORD_BASERECORD_H_ */
|
#ifndef _TESTBCPLAYERSTATISTICSEVENT_H_
#define _TESTBCPLAYERSTATISTICSEVENT_H_
#include "gtest/gtest.h"
#include "braincloud/BrainCloudClient.h"
#include "TestFixtureBase.h"
#include "json/json.h"
using namespace BrainCloud;
class TestBCPlayerStatisticsEvent: public TestFixtureBase, public IRewardCallback
{
protected:
const char* m_eventId01;
const char* m_eventId02;
int m_rewardCallbackHitCount;
public:
TestBCPlayerStatisticsEvent()
{
m_eventId01 = "testEvent01";
m_eventId02 = "rewardCredits";
m_rewardCallbackHitCount = 0;
}
virtual void rewardCallback(std::string const & jsonData);
};
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* Monkey HTTP Server
* ==================
* Copyright 2001-2017 Eduardo Silva <eduardo@monkey.io>
*
* 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 MK_LIB_H
#define MK_LIB_H
#define _GNU_SOURCE
#include <monkey/mk_info.h>
#include <monkey/mk_tls.h>
#include <monkey/mk_vhost.h>
#include <monkey/mk_config.h>
#include <monkey/mk_fifo.h>
#include <monkey/mk_http_internal.h>
#include <pthread.h>
struct mk_lib_ctx {
pthread_t worker_tid;
struct mk_server *server;
struct mk_fifo *fifo;
};
typedef struct mk_fifo_queue mk_mq_t;
typedef struct mk_lib_ctx mk_ctx_t;
typedef struct mk_http_request mk_request_t;
typedef struct mk_http_session mk_session_t;
MK_EXPORT int mk_start(mk_ctx_t *ctx);
MK_EXPORT int mk_stop(mk_ctx_t *ctx);
MK_EXPORT mk_ctx_t *mk_create();
MK_EXPORT int mk_destroy(mk_ctx_t *ctx);
MK_EXPORT int mk_config_set(mk_ctx_t *ctx, ...);
MK_EXPORT int mk_vhost_create(mk_ctx_t *ctx, char *name);
MK_EXPORT int mk_vhost_set(mk_ctx_t *ctx, int vid, ...);
MK_EXPORT int mk_vhost_handler(mk_ctx_t *ctx, int vid, char *regex,
void (*cb)(mk_request_t *, void *), void *data);
MK_EXPORT int mk_http_status(mk_request_t *req, int status);
MK_EXPORT int mk_http_header(mk_request_t *req,
char *key, int key_len,
char *val, int val_len);
MK_EXPORT int mk_http_send(mk_request_t *req, char *buf, size_t len,
void (*cb_finish)(mk_request_t *));
MK_EXPORT int mk_http_done(mk_request_t *req);
MK_EXPORT int mk_worker_callback(mk_ctx_t *ctx,
void (*cb_func) (void *),
void *data);
//MK_EXPORT int mk_mq_create(mk_ctx_t *ctx, char *name);
MK_EXPORT int mk_mq_create(mk_ctx_t *ctx, char *name, void (*cb), void *data);
MK_EXPORT int mk_mq_send(mk_ctx_t *ctx, int qid, void *data, size_t size);
MK_EXPORT int mk_main();
#endif
|
//
// Location.h
// MyLocations
//
// Created by Matthijs on 14-10-13.
// Copyright (c) 2013 Razeware LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface Location : NSManagedObject <MKAnnotation>
@property (nonatomic, retain) NSNumber * latitude;
@property (nonatomic, retain) NSNumber * longitude;
@property (nonatomic, retain) NSDate * date;
@property (nonatomic, retain) NSString * locationDescription;
@property (nonatomic, retain) NSString * category;
@property (nonatomic, retain) CLPlacemark *placemark;
@property (nonatomic, retain) NSNumber * photoId;
+ (NSInteger)nextPhotoId;
- (BOOL)hasPhoto;
- (NSString *)photoPath;
- (UIImage *)photoImage;
- (void)removePhotoFile;
@end
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/moz2_slave/rel-2.0-xr-w32-bld/build/dom/interfaces/svg/nsIDOMSVGZoomAndPan.idl
*/
#ifndef __gen_nsIDOMSVGZoomAndPan_h__
#define __gen_nsIDOMSVGZoomAndPan_h__
#ifndef __gen_domstubs_h__
#include "domstubs.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
/* starting interface: nsIDOMSVGZoomAndPan */
#define NS_IDOMSVGZOOMANDPAN_IID_STR "18967370-921a-4245-8158-a279b190abca"
#define NS_IDOMSVGZOOMANDPAN_IID \
{0x18967370, 0x921a, 0x4245, \
{ 0x81, 0x58, 0xa2, 0x79, 0xb1, 0x90, 0xab, 0xca }}
class NS_NO_VTABLE NS_SCRIPTABLE nsIDOMSVGZoomAndPan : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOMSVGZOOMANDPAN_IID)
enum { SVG_ZOOMANDPAN_UNKNOWN = 0U };
enum { SVG_ZOOMANDPAN_DISABLE = 1U };
enum { SVG_ZOOMANDPAN_MAGNIFY = 2U };
/* attribute unsigned short zoomAndPan; */
NS_SCRIPTABLE NS_IMETHOD GetZoomAndPan(PRUint16 *aZoomAndPan) = 0;
NS_SCRIPTABLE NS_IMETHOD SetZoomAndPan(PRUint16 aZoomAndPan) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMSVGZoomAndPan, NS_IDOMSVGZOOMANDPAN_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIDOMSVGZOOMANDPAN \
NS_SCRIPTABLE NS_IMETHOD GetZoomAndPan(PRUint16 *aZoomAndPan); \
NS_SCRIPTABLE NS_IMETHOD SetZoomAndPan(PRUint16 aZoomAndPan);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIDOMSVGZOOMANDPAN(_to) \
NS_SCRIPTABLE NS_IMETHOD GetZoomAndPan(PRUint16 *aZoomAndPan) { return _to GetZoomAndPan(aZoomAndPan); } \
NS_SCRIPTABLE NS_IMETHOD SetZoomAndPan(PRUint16 aZoomAndPan) { return _to SetZoomAndPan(aZoomAndPan); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIDOMSVGZOOMANDPAN(_to) \
NS_SCRIPTABLE NS_IMETHOD GetZoomAndPan(PRUint16 *aZoomAndPan) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetZoomAndPan(aZoomAndPan); } \
NS_SCRIPTABLE NS_IMETHOD SetZoomAndPan(PRUint16 aZoomAndPan) { return !_to ? NS_ERROR_NULL_POINTER : _to->SetZoomAndPan(aZoomAndPan); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsDOMSVGZoomAndPan : public nsIDOMSVGZoomAndPan
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIDOMSVGZOOMANDPAN
nsDOMSVGZoomAndPan();
private:
~nsDOMSVGZoomAndPan();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsDOMSVGZoomAndPan, nsIDOMSVGZoomAndPan)
nsDOMSVGZoomAndPan::nsDOMSVGZoomAndPan()
{
/* member initializers and constructor code */
}
nsDOMSVGZoomAndPan::~nsDOMSVGZoomAndPan()
{
/* destructor code */
}
/* attribute unsigned short zoomAndPan; */
NS_IMETHODIMP nsDOMSVGZoomAndPan::GetZoomAndPan(PRUint16 *aZoomAndPan)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsDOMSVGZoomAndPan::SetZoomAndPan(PRUint16 aZoomAndPan)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsIDOMSVGZoomAndPan_h__ */
|
//
// HomeViewController.h
//
//
// Created by lgh on 16/4/5.
//
//
#import <UIKit/UIKit.h>
@interface HomeViewController : UIViewController
@end
|
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Sample app for CDC ACM class driver
*
* Sample app for USB CDC ACM class driver. The received data is echoed back
* to the serial port.
*/
#include <stdio.h>
#include <string.h>
#include <device.h>
#include <uart.h>
#include <zephyr.h>
static const char *banner1 = "Send characters to the UART device\r\n";
static const char *banner2 = "Characters read:\r\n";
static volatile bool data_transmitted;
static volatile bool data_arrived;
static char data_buf[64];
static void interrupt_handler(struct device *dev)
{
uart_irq_update(dev);
if (uart_irq_tx_ready(dev)) {
data_transmitted = true;
}
if (uart_irq_rx_ready(dev)) {
data_arrived = true;
}
}
static void write_data(struct device *dev, const char *buf, int len)
{
uart_irq_tx_enable(dev);
while (len) {
int written;
data_transmitted = false;
written = uart_fifo_fill(dev, (const u8_t *)buf, len);
while (data_transmitted == false) {
k_yield();
}
len -= written;
buf += written;
}
uart_irq_tx_disable(dev);
}
static void read_and_echo_data(struct device *dev, int *bytes_read)
{
while (data_arrived == false)
;
data_arrived = false;
/* Read all data and echo it back */
while ((*bytes_read = uart_fifo_read(dev,
(u8_t *)data_buf, sizeof(data_buf)))) {
write_data(dev, data_buf, *bytes_read);
}
}
void main(void)
{
struct device *dev;
u32_t baudrate, bytes_read, dtr = 0U;
int ret;
dev = device_get_binding("CDC_ACM_0");
if (!dev) {
printf("CDC ACM device not found\n");
return;
}
printf("Wait for DTR\n");
while (1) {
uart_line_ctrl_get(dev, LINE_CTRL_DTR, &dtr);
if (dtr)
break;
}
printf("DTR set, start test\n");
/* They are optional, we use them to test the interrupt endpoint */
ret = uart_line_ctrl_set(dev, LINE_CTRL_DCD, 1);
if (ret)
printf("Failed to set DCD, ret code %d\n", ret);
ret = uart_line_ctrl_set(dev, LINE_CTRL_DSR, 1);
if (ret)
printf("Failed to set DSR, ret code %d\n", ret);
/* Wait 1 sec for the host to do all settings */
k_busy_wait(1000000);
ret = uart_line_ctrl_get(dev, LINE_CTRL_BAUD_RATE, &baudrate);
if (ret)
printf("Failed to get baudrate, ret code %d\n", ret);
else
printf("Baudrate detected: %d\n", baudrate);
uart_irq_callback_set(dev, interrupt_handler);
write_data(dev, banner1, strlen(banner1));
write_data(dev, banner2, strlen(banner2));
/* Enable rx interrupts */
uart_irq_rx_enable(dev);
/* Echo the received data */
while (1) {
read_and_echo_data(dev, (int *) &bytes_read);
}
}
|
/**
* Appcelerator Titanium Mobile
* Copyright (c) 2009-2012 by Appcelerator, Inc. All Rights Reserved.
* Licensed under the terms of the Apache Public License
* Please see the LICENSE included with this distribution for details.
*/
#ifndef TIDBOBJECT_H_
#define TIDBOBJECT_H_
#include "TiProxy.h"
class NativeObjectFactory;
/*
* TiDBObject
*
* DB object that wraps SQLite database engine.
*
* Titanium.Database.DB namespace
*/
class TiDBObject : public TiProxy
{
public:
static void addObjectToParent(TiObject* parent, NativeObjectFactory* objectFactory);
static TiDBObject* createDB(NativeObjectFactory* objectFactory, const Arguments& args);
protected:
virtual ~TiDBObject();
virtual void onCreateStaticMembers();
virtual void initializeTiObject(TiObject* parentContext, const Arguments& args);
static Handle<Value> _execute(void* userContext, TiObject* caller, const Arguments& args);
static Handle<Value> _close(void* userContext, TiObject* caller, const Arguments& args);
static Handle<Value> _rowsAffected(void* userContext);
private:
TiDBObject();
explicit TiDBObject(NativeObjectFactory* objectFactory);
TiDBObject(const TiDBObject&);
TiDBObject& operator=(const TiDBObject&);
NativeObjectFactory* objectFactory_;
};
#endif /* TIDBOBJECT_H_ */
|
// @copyright 2017-2018 zzu_softboy <zzu_softboy@163.com>
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
// Created by softboy on 5/26/17.
#ifndef ZAPI_KERNEL_META_H
#define ZAPI_KERNEL_META_H
#include "zapi/Global.h"
namespace zapi
{
namespace kernel
{
class ZAPI_DECL_EXPORT Meta
{
public:
void getLoadedExtensions();
void getPhpVersion();
};
} // kernel
} // zapi
#endif //ZAPI_KERNEL_META_H
|
#ifndef __MODBUS_DRIVE_H__
#define __MODBUS_DRIVE_H__
#include <mutex>
#include <chrono>
class ModbusDrive
{
public:
static ModbusDrive* get_instance();
static int delete_instance();
int pro_ctrl();
int pro_data_request();
int pro_data_response();
// int ProcReadWords((s_modbusPktReadWordResponse*)pData);
// int ProcReadBits(s_modbusPktReadBitResponse* pData);
private:
ModbusDrive();
~ModbusDrive();
private:
static ModbusDrive *m_instance;
static std::mutex m_mutex;
};
#endif //__MODBUS_DRIVE_H__
|
//---------------------------------------------------------------------------
#ifndef PropertyFormH
#define PropertyFormH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include <jpeg.hpp>
#include <Buttons.hpp>
#include <Dialogs.hpp>
#include "VectorGraphic.h"
#include "Parameters.h"
#include "mainForm.h"
#include "Utility.h"
#include <ComCtrls.hpp>
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published: // IDE-managed Components
TOpenDialog *OpenDialog1;
TPanel *PanelImage;
TImage *ImageMap;
TGroupBox *GroupBox1;
TBitBtn *BitBtn2;
TBitBtn *BitBtn1;
TGroupBox *GroupBox2;
TButton *btnZoomIN;
TButton *btnZoomOut;
TButton *btnFit;
TBitBtn *btnRotateManual;
TGroupBox *GroupBox3;
TBitBtn *btnHorMirror;
TBitBtn *btnVerMirror;
TBitBtn *btnOpen;
TBitBtn *btnOK;
TBitBtn *btnExit;
TLabel *lblGage;
TLabel *lblScale;
TLabel *lblLenght;
TLabel *Label1;
void __fastcall FormDestroy(TObject *Sender);
void __fastcall ImageMapMouseDown(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall ImageMapMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
void __fastcall ImageMapMouseMove(TObject *Sender, TShiftState Shift,
int X, int Y);
void __fastcall BitBtn1Click(TObject *Sender);
void __fastcall FormCreate(TObject *Sender);
void __fastcall UpDown1Click(TObject *Sender, TUDBtnType Button);
void __fastcall btnFitClick(TObject *Sender);
void __fastcall btnZoomOutClick(TObject *Sender);
void __fastcall BitBtn2Click(TObject *Sender);
void __fastcall btnRotateManualClick(TObject *Sender);
void __fastcall btnHorMirrorClick(TObject *Sender);
void __fastcall btnVerMirrorClick(TObject *Sender);
void __fastcall btnZoomINClick(TObject *Sender);
void __fastcall btnOpenClick(TObject *Sender);
void __fastcall btnOKClick(TObject *Sender);
void __fastcall btnExitClick(TObject *Sender);
private:
void __fastcall Zoom(double scale);
void __fastcall ShowFit();
CuttingModel *cuttingModel;
CuttingModel *viewModel;
CuttingModel *viewForm1Model;
VectorGraphic *VG;
double scale;
TPoint startPoint;
int k;
Utility u;
// 0 -> NO
// 1 -> Move
// 2 -> Rotate Manually Button pressed
// 3 -> Rotate Manually
int mouseDownMode;
public: // User declarations
__fastcall TForm2(TComponent* Owner);
void setNewScale();
void ShowFitViewModel();
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif
|
/*
* Copyright (c) 2015 by Farsight Security, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include <netdb.h>
#include <err.h>
#include <nmsg.h>
#include <nmsg/base/dnsqr.pb-c.h>
#include <nmsg/base/defs.h>
nmsg_output_t filter_output;
int dnsqr_filter(nmsg_message_t);
static void
callback(nmsg_message_t msg, void *user) {
int32_t vid, msgtype;
vid = nmsg_message_get_vid(msg);
msgtype = nmsg_message_get_msgtype(msg);
if (vid == NMSG_VENDOR_BASE_ID &&
msgtype == NMSG_VENDOR_BASE_DNSQR_ID) {
if (dnsqr_filter(msg))
nmsg_output_write(filter_output, msg);
}
nmsg_message_destroy(&msg);
}
void err_nmsg_res(int eval, nmsg_res res, const char *fmt, ...) {
va_list ap;
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
fprintf(stderr, ": %s", nmsg_res_lookup(res));
exit(eval);
}
int
open_sock(const char *sockspec, int do_bind) {
char *spec = strdup(sockspec), *port;
struct addrinfo hints = {0}, *res, *r;
int ai_err, s;
port = index(spec, '/');
if (!port)
errx(1, "invalid socket spec '%s'\n", sockspec);
*port++ = 0;
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_DGRAM;
hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICHOST | AI_NUMERICSERV;
if (do_bind)
hints.ai_flags |= AI_PASSIVE;
ai_err = getaddrinfo(spec, port, &hints, &res);
if (ai_err)
errx(1, "%s", gai_strerror(ai_err));
free(spec);
for (r = res; r; r = r->ai_next) {
s = socket(r->ai_family, r->ai_socktype, r->ai_protocol);
if (s == -1) continue;
if (do_bind) {
if (bind(s, r->ai_addr, r->ai_addrlen) < 0)
err(1, "bind %s", sockspec);
} else {
if (connect(s, r->ai_addr, r->ai_addrlen) < 0)
err(1, "connect %s", sockspec);
}
freeaddrinfo(res);
return s;
}
err(1, "could not open %s", sockspec);
}
int
main(int argc, char **argv) {
nmsg_io_t io;
nmsg_output_t output;
nmsg_input_t input;
nmsg_res res;
char c;
int fd;
res = nmsg_init();
if (res != nmsg_res_success) {
fprintf(stderr, "unable to initialize libnmsg\n");
return (EXIT_FAILURE);
}
io = nmsg_io_init();
if (io == NULL) {
fprintf(stderr, "nmsg_io_init() failed\n");
return (EXIT_FAILURE);
}
while ( (c=getopt(argc, argv, "r:C:l:s:w:h")) != -1 ) {
switch(c) {
case 'r':
fd = open(optarg, O_RDONLY);
if (fd < 0)
err(EXIT_FAILURE, "[-r %s] open() failed", optarg);
input = nmsg_input_open_file(fd);
if (input == NULL)
errx(EXIT_FAILURE, "[-r %s] nmsg_input_open_file() failed.", optarg);
res = nmsg_io_add_input(io, input, NULL);
if (res != nmsg_res_success)
err_nmsg_res(EXIT_FAILURE, res, "[-r %s] nmsg_io_add_input() failed");
break;
case 'C':
res = nmsg_io_add_input_channel(io, optarg, NULL);
if (res != nmsg_res_success)
err_nmsg_res(EXIT_FAILURE, res, "[-C %s] nmsg_io_add_input_channel(%s) failed", optarg);
break;
case 'l':
input = nmsg_input_open_sock(open_sock(optarg, 1));
if (input == NULL)
errx(EXIT_FAILURE, "[-L %s] nmsg_input_open_sock() failed.", optarg);
res = nmsg_io_add_input(io, input, NULL);
if (res != nmsg_res_success)
err_nmsg_res(EXIT_FAILURE, res, "[-L %s] nmsg_io_add_input() failed.", optarg);
break;
case 's':
filter_output = nmsg_output_open_sock(open_sock(optarg, 0), NMSG_WBUFSZ_JUMBO);
if (filter_output == NULL)
errx(EXIT_FAILURE, "[-S %s] nmsg_output_open_sock() failed.", optarg);
break;
case 'w':
fd = open(optarg, O_WRONLY|O_CREAT, 0666);
if (fd < 0)
err(EXIT_FAILURE, "[-w %s] open() failed", optarg);
filter_output = nmsg_output_open_file(fd, NMSG_WBUFSZ_MAX);
if (filter_output == NULL)
errx(EXIT_FAILURE, "[-w %s] nmsg_output_open_file() failed", optarg);
break;
case '?':
case 'h':
fprintf(stderr, "Usage: %s\n"
"[-h] Display help text\n"
"[-r file] Read nmsg data from file\n"
"[-l ip/port] Read nmsg data datagram socket\n"
"[-C channel] Read nmsg data from channel\n"
"[-w file] Write nmsg data to file\n"
"[-s ip/port] Write nmsg data to datagram socket\n",
argv[0]);
exit(1);
}
}
if (filter_output == NULL)
errx(EXIT_FAILURE, "No outputs given.");
output = nmsg_output_open_callback(callback, NULL);
if (output == NULL)
errx(EXIT_FAILURE, "nmsg_output_open_callback() failed.");
res = nmsg_io_add_output(io, output, NULL);
if (res != nmsg_res_success)
err_nmsg_res(EXIT_FAILURE, res, "nmsg_io_add_output() failed");
res = nmsg_io_loop(io);
if (res != nmsg_res_success)
err_nmsg_res(EXIT_FAILURE, res, "nmsg_io_loop() failed");
nmsg_io_destroy(&io);
return (EXIT_SUCCESS);
}
|
#if !defined(CETTY_HANDLER_TIMEOUT_READTIMEOUTHANDLER_H)
#define CETTY_HANDLER_TIMEOUT_READTIMEOUTHANDLER_H
/*
* Copyright 2009 Red Hat, Inc.
*
* Red Hat 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.
*/
/*
* Copyright (c) 2010-2011 frankee zhou (frankee.zhou at gmail dot com)
* Distributed under under the Apache License, version 2.0 (the "License").
*/
#include <boost/function.hpp>
#include <boost/date_time/posix_time/ptime.hpp>
#include <cetty/channel/TimeoutPtr.h>
#include <cetty/channel/ChannelStateHandler.h>
#include <cetty/handler/timeout/ReadTimeoutException.h>
namespace cetty {
namespace handler {
namespace timeout {
using namespace cetty::channel;
using namespace cetty::util;
/**
* Raises a {@link ReadTimeoutException} when no data was read within a certain
* period of time.
*
* <pre>
* public class MyPipelineFactory implements {@link ChannelPipelineFactory} {
*
* private final {@link Timer} timer;
*
* public MyPipelineFactory({@link Timer} timer) {
* this.timer = timer;
* }
*
* public {@link ChannelPipeline} getPipeline() {
* // An example configuration that implements 30-second read timeout:
* return {@link Channels}.pipeline(
* <b>new {@link ReadTimeoutHandler}(timer, 30), // timer must be shared.</b>
* new MyHandler());
* }
* }
*
* {@link ServerBootstrap} bootstrap = ...;
* {@link Timer} timer = new {@link HashedWheelTimer}();
* ...
* bootstrap.setPipelineFactory(new MyPipelineFactory(timer));
* ...
* </pre>
*
* The {@link Timer} which was specified when the {@link ReadTimeoutHandler} is
* created should be stopped manually by calling {@link #releaseExternalResources()}
* or {@link Timer#stop()} when your application shuts down.
*
*
* @author <a href="http://gleamynode.net/">Trustin Lee</a>
* @author <a href="mailto:frankee.zhou@gmail.com">Frankee Zhou</a>
*
* @see WriteTimeoutHandler
* @see IdleStateHandler
*
* @apiviz.landmark
* @apiviz.uses org.jboss.netty.util.HashedWheelTimer
* @apiviz.has org.jboss.netty.handler.timeout.TimeoutException oneway - - raises
*/
class ReadTimeoutHandler {
public:
typedef boost::posix_time::ptime Time;
typedef boost::posix_time::time_duration Duration;
typedef boost::function<void (ChannelHandlerContext&)> ReadTimeoutCallback;
typedef ChannelStateHandler<ReadTimeoutHandler>::Context Context;
public:
/**
* Creates a new instance.
*
* @param timer
* the {@link Timer} that is used to trigger the scheduled event.
* The recommended {@link Timer} implementation is {@link HashedWheelTimer}.
* @param timeoutSeconds
* read timeout in seconds
*/
ReadTimeoutHandler(int timeoutSeconds);
/**
* Creates a new instance.
*
* @param timer
* the {@link Timer} that is used to trigger the scheduled event.
* The recommended {@link Timer} implementation is {@link HashedWheelTimer}.
* @param timeout
* read timeout
*
*/
ReadTimeoutHandler(const Duration& timeout);
void registerTo(Context& ctx);
void setReadTimeoutCallback(const ReadTimeoutCallback& callback) {
readTimeoutCallback_ = callback;
}
private:
void beforeAdd(ChannelHandlerContext& ctx);
void beforeRemove(ChannelHandlerContext& ctx);
void channelActive(ChannelHandlerContext& ctx);
void channelInactive(ChannelHandlerContext& ctx);
void messageUpdated(ChannelHandlerContext& ctx);
protected:
void readTimedOut(ChannelHandlerContext& ctx);
private:
void initialize(ChannelHandlerContext& ctx);
void destroy();
void handleReadTimeout(ChannelHandlerContext& ctx);
private:
static const ReadTimeoutException EXCEPTION;
private:
typedef boost::function0<void> TimerCallback;
private:
bool closed_;
int state_; // 0 - none, 1 - Initialized, 2 - Destroyed;
int64_t timeoutMillis_;
Time lastReadTime_;
TimeoutPtr timeout_;
TimerCallback timerCallback_;
ReadTimeoutCallback readTimeoutCallback_;
};
}
}
}
#endif //#if !defined(CETTY_HANDLER_TIMEOUT_READTIMEOUTHANDLER_H)
// Local Variables:
// mode: c++
// End:
|
//
// LYHTTPToolManager.h
// GoHomeForDinner
//
// Created by Mac on 16/8/26.
// Copyright © 2016年 Mac. All rights reserved.
//
#import "AFHTTPSessionManager.h"
@interface LYHTTPToolManager : AFHTTPSessionManager
+ (instancetype)shareManager;
@end
|
#pragma once
#include"Globals.h"
#include<map>
class MaterialImporter
{
public:
MaterialImporter();
~MaterialImporter();
std::multimap<int, std::string> Mat_Map;
public:
void ImportMaterial(const char* path, std::string * new_path=nullptr);
};
|
/**********************************************************************
Filename : BPlotDriverPPM.h
Content : PPM driver.
Created : July 30, 2009
Authors : Boris Rayskiy
Copyright : (c) 2009
**********************************************************************/
#ifndef _B_PLOT_DRIVER_PPM_H_
#define _B_PLOT_DRIVER_PPM_H_
#include <bplot_driver.h>
#include <BColor.h>
#include <BMath.h>
#include <BMemory.h>
#include <BArray.h>
#include <stdio.h>
#include <string.h>
using namespace BoriSoft;
using namespace BoriSoft::graph;
using namespace BoriSoft::data;
class BPlotLog;
class BPPMDev : public BDev
{
public:
virtual Float GetResX(void) { return (Float)(xRes / 150.f / width * height); }
virtual Float GetResY(void) { return (Float)(yRes / 150.f); }
virtual SInt32 GetPhyXmin(void) { return (SInt32)0; }
virtual SInt32 GetPhyXmax(void) { return (SInt32)xRes; }
virtual SInt32 GetPhyYmin(void) { return (SInt32)0; }
virtual SInt32 GetPhyYmax(void) { return (SInt32)yRes; }
};
class BPlotDriverPPM : public BPlotDriver
{
BPPMDev* PPMDev;
char* FileName;
UInt32 FileNumber;
UByte* DumpBuf;
UPInt BufSize;
FILE* FileDesc;
BColor Color;
public:
BPlotDriverPPM() { PPMDev = NULL; }
void Init(const void* ptr);
void* GetDev(void);
void SetPlotLog(void* pLog) {}
void SetColor(BColor color, SInt32 width);
void Line(SInt32 x1, SInt32 y1, SInt32 x2, SInt32 y2);
void Polyline(SInt32* x, SInt32* y, SInt32 n);
void FillPolygon(SInt32* x, SInt32* y, SInt32 n);
void BeginOfPage(void);
void EndOfPage(void);
void Tidy(void);
~BPlotDriverPPM() { if (PPMDev) delete PPMDev; }
private:
void setPixel(SInt32 x, SInt32 y, BColor color);
BColor getPixel(SInt32 x, SInt32 y);
};
#endif // _B_PLOT_DRIVER_PPM_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/batch/Batch_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 Batch
{
namespace Model
{
/**
* <p>An object representing summary details of a container within a
* job.</p><p><h3>See Also:</h3> <a
* href="http://docs.aws.amazon.com/goto/WebAPI/batch-2016-08-10/ContainerSummary">AWS
* API Reference</a></p>
*/
class AWS_BATCH_API ContainerSummary
{
public:
ContainerSummary();
ContainerSummary(Aws::Utils::Json::JsonView jsonValue);
ContainerSummary& operator=(Aws::Utils::Json::JsonView jsonValue);
Aws::Utils::Json::JsonValue Jsonize() const;
/**
* <p>The exit code to return upon completion.</p>
*/
inline int GetExitCode() const{ return m_exitCode; }
/**
* <p>The exit code to return upon completion.</p>
*/
inline void SetExitCode(int value) { m_exitCodeHasBeenSet = true; m_exitCode = value; }
/**
* <p>The exit code to return upon completion.</p>
*/
inline ContainerSummary& WithExitCode(int value) { SetExitCode(value); return *this;}
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline const Aws::String& GetReason() const{ return m_reason; }
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline void SetReason(const Aws::String& value) { m_reasonHasBeenSet = true; m_reason = value; }
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline void SetReason(Aws::String&& value) { m_reasonHasBeenSet = true; m_reason = std::move(value); }
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline void SetReason(const char* value) { m_reasonHasBeenSet = true; m_reason.assign(value); }
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline ContainerSummary& WithReason(const Aws::String& value) { SetReason(value); return *this;}
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline ContainerSummary& WithReason(Aws::String&& value) { SetReason(std::move(value)); return *this;}
/**
* <p>A short (255 max characters) human-readable string to provide additional
* details about a running or stopped container.</p>
*/
inline ContainerSummary& WithReason(const char* value) { SetReason(value); return *this;}
private:
int m_exitCode;
bool m_exitCodeHasBeenSet;
Aws::String m_reason;
bool m_reasonHasBeenSet;
};
} // namespace Model
} // namespace Batch
} // namespace Aws
|
// 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 2005-2011 Google, Inc.
// Author: ttai@google.com (Terry Tai)
//
// Basic node wrapper around a text string.
#ifndef THRAX_STRING_NODE_H_
#define THRAX_STRING_NODE_H_
#include <string>
#include <fst/compat.h>
#include <thrax/compat/compat.h>
#include <thrax/node.h>
namespace thrax {
class AstWalker;
class StringNode : public Node {
public:
StringNode(const string& str);
virtual ~StringNode();
const string& Get() const;
virtual void Accept(AstWalker* walker);
private:
string str_;
DISALLOW_COPY_AND_ASSIGN(StringNode);
};
} // namespace thrax
#endif // THRAX_STRING_NODE_H_
|
/*
*
* Copyright 2015 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.
*
*/
// This file is autogenerated from a template file. Please make
// modifications to
// `templates/src/objective-c/GRPCClient/private/version.h.template`
// instead. This file can be regenerated from the template by running
// `tools/buildgen/generate_projects.sh`.
#define GRPC_OBJC_VERSION_STRING @"1.42.0-dev"
#define GRPC_C_VERSION_STRING @"19.1.0"
|
/**************************************************************************\
* This file is part of CaSPER. *
* *
* Copyright: *
* 2011-2011 - Marco Correia <marco.v.correia@gmail.com> *
* *
* 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 CASPER_KERNEL_OBJ_REF_H_
#define CASPER_KERNEL_OBJ_REF_H_
namespace Casper {
namespace Detail {
template<class T,class Eval>
struct Create<T,Ref<Eval> >
{
Ref<Eval> operator()(Casper::State& state, const T& t);
};
template<class T,class Eval>
Ref<Eval> Create<T,Ref<Eval> >::operator()(Casper::State& state, const T& t)
{ return Ref<Eval>(state,t); }
//template<class T,class Eval>
//struct Create<T,Ref<CP::Var<Eval> > >
//{
// Ref<CP::Var<Eval> > operator()(State& state, const T& t)
// { throw Casper::Exception::TypeCoercion(typeid(T).name(),"CP::Var<Eval>"); }
//};
} // Detail
template<class Eval>
struct RefView<Eval,Expr<Eval> > : IRef<Eval>
{
RefView(State& state, const Expr<Eval>& e) :
par(e.toRef(state)),expr(e) {}
const Expr<Eval>& getObj() const { return expr; }
Eval value() const { return par.value(); }
void setValue(const Eval& v) { par.setValue(v); }
Ref<Eval> par;
Expr<Eval> expr;
};
// Extracts a given element of any array type
template<class Eval>
struct RefArrayView<Expr<Seq<Eval> > >
{
typedef Expr<Eval> Elem;
RefArrayView(State& s,const Expr<Seq<Eval> >& e) : a(e.toStdArray()) {}
Elem& operator[](int idx)
{ return a[idx]; }
const Elem& operator[](int idx) const
{ return a[idx]; }
Util::StdArray<Expr<Eval> > a;
};
template<class Eval>
struct RefView<CP::Var<Eval>,Expr<Eval> > : IRef<CP::Var<Eval> >
{
RefView(State& state, const Expr<Eval>& e) :
par(e.toCPVarRef(state)),expr(e) {}
const Expr<Eval>& getObj() const { return expr; }
CP::Var<Eval> value() const { return par.value(); }
//void setValue(const Eval& v) { par.setValue(v); }
Ref<CP::Var<Eval> > par;
Expr<Eval> expr;
};
}
#endif /* CASPER_KERNEL_OBJ_PAR_H_ */
|
#include <stdbool.h>
#include <stdint.h>
#include "src/lib.h"
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#define LOAD_SYM GetProcAddress
#else
#include <dlfcn.h>
#define LOAD_SYM dlsym
#endif
typedef bool (*extract_inno_ptr)(const char *path, const char *destination, inno_progress_callback callback, inno_log_callback log);
extract_inno_ptr extract_inno_ref = 0;
extern void libinnoextract_progress_cb(const char *message, float progress);
extern void libinnoextract_log_cb(uint8_t level, const char *message);
bool extract_inno_wrapper(const char *path, const char *destination) {
return extract_inno_ref(path, destination, &libinnoextract_progress_cb,
&libinnoextract_log_cb);
}
bool load_libinnoextract(const char *lib_path, char **error) {
if (extract_inno_ref) {
return true;
}
#ifdef WIN32
HMODULE lib = LoadLibraryA(lib_path);
if (!lib) {
DWORD code = GetLastError();
LPSTR message;
FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, code, 0, (LPSTR)&message, 0, NULL);
*error = (char *)message;
return false;
}
#else
void *lib = dlopen(lib_path, RTLD_NOW | RTLD_NODELETE);
if (!lib) {
*error = dlerror();
return false;
}
#endif
extract_inno_ref = (extract_inno_ptr)LOAD_SYM(lib, "extract_inno");
#ifndef WIN32
dlclose(lib);
#endif
if (!extract_inno_ref) {
*error = (char *)"One or more functions could not be found!";
return false;
}
return true;
}
|
//
// YDMessageShowViewController.h
// YaoDaoBingChu
//
// Created by lanou3g on 15/7/22.
// Copyright (c) 2015年 zlwz. All rights reserved.
// 显示所有的“留言”
#import <UIKit/UIKit.h>
@interface YDMessageShowViewController : UIViewController
@end
|
// ============================================================================
// Coda Binary Encoder
// ============================================================================
#ifndef CODA_IO_BINARYENCODER_H
#define CODA_IO_BINARYENCODER_H 1
#ifndef CODA_IO_ABSTRACTENCODER_H
#include "coda/io/abstractencoder.h"
#endif
#ifndef CODA_IO_BINARYFORMAT_H
#include "coda/io/binaryformat.h"
#endif
#include <ostream>
namespace coda {
namespace io {
/**
* Encoder that serializes into binary format.
*/
class BinaryEncoder : public AbstractEncoder {
public:
BinaryEncoder(std::ostream& str);
Encoder& writeSubtypeHeader(const runtime::StringRef& subtypeName, int32_t subtypeId);
Encoder& writeFieldHeader(const runtime::StringRef& fieldName, int32_t fieldId);
Encoder& writeBoolean(bool value);
Encoder& writeInteger(int32_t value);
Encoder& writeInteger(int64_t value);
Encoder& writeFixed16(int16_t value);
Encoder& writeFixed32(int32_t value);
Encoder& writeFixed64(int64_t value);
Encoder& writeFloat(float value);
Encoder& writeDouble(double value);
Encoder& writeString(const runtime::StringRef& value);
Encoder& writeBytes(const runtime::StringRef& value);
Encoder& writeBeginList(
coda::descriptors::TypeKind elementKind, size_t length, bool fixed = false);
Encoder& writeEndList();
Encoder& writeBeginSet(
coda::descriptors::TypeKind elementKind, size_t length, bool fixed = false);
Encoder& writeEndSet();
Encoder& writeBeginMap(
coda::descriptors::TypeKind keyKind,
coda::descriptors::TypeKind valueKind,
size_t length);
Encoder& writeEndMap();
Encoder& writeStruct(const coda::runtime::Object* value, bool shared=false);
Encoder& writeEndSubtype();
private:
enum State {
CLEAR,
STRUCT,
CONTAINER,
MAP_KEY,
MAP_VALUE,
SUBTYPE
};
std::ostream& strm;
State state;
std::unordered_set<void*> inProgress;
std::vector<State> states;
int32_t subtypeId;
int32_t fieldId;
int32_t lastFieldId;
void beginValue(DataType dt);
void beginSubtype();
void writeUByte(uint8_t);
void writeVarInt(uint32_t);
void writeVarInt(uint64_t);
static uint32_t zigZagEncode(int32_t value);
static uint64_t zigZagEncode(int64_t value);
};
}} // namespace
#endif // CODA_IO_TEXTENCODER_H
|
/* Copyright (c) 2019, Arm Limited and Contributors
*
* SPDX-License-Identifier: Apache-2.0
*
* Licensed under the Apache License, Version 2.0 the "License";
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include "common/helpers.h"
#include "common/vk_common.h"
#include "core/command_buffer.h"
namespace vkb
{
class Device;
class RenderFrame;
class CommandPool
{
public:
CommandPool(Device &device, uint32_t queue_family_index, RenderFrame *render_frame = nullptr,
size_t thread_index = 0,
CommandBuffer::ResetMode reset_mode = CommandBuffer::ResetMode::ResetPool);
CommandPool(const CommandPool &) = delete;
CommandPool(CommandPool &&other);
~CommandPool();
CommandPool &operator=(const CommandPool &) = delete;
CommandPool &operator=(CommandPool &&) = delete;
Device &get_device();
uint32_t get_queue_family_index() const;
VkCommandPool get_handle() const;
RenderFrame *get_render_frame();
size_t get_thread_index() const;
VkResult reset_pool();
CommandBuffer &request_command_buffer(VkCommandBufferLevel level = VK_COMMAND_BUFFER_LEVEL_PRIMARY);
const CommandBuffer::ResetMode get_reset_mode() const;
private:
Device &device;
VkCommandPool handle{VK_NULL_HANDLE};
RenderFrame *render_frame{nullptr};
size_t thread_index{0};
uint32_t queue_family_index{0};
std::vector<std::unique_ptr<CommandBuffer>> primary_command_buffers;
uint32_t active_primary_command_buffer_count{0};
std::vector<std::unique_ptr<CommandBuffer>> secondary_command_buffers;
uint32_t active_secondary_command_buffer_count{0};
CommandBuffer::ResetMode reset_mode{CommandBuffer::ResetMode::ResetPool};
VkResult reset_command_buffers();
};
} // namespace vkb
|
//
// UserListViewController.h
// MicroSport
//
// Created by Satya on 26/08/17.
// Copyright © 2017 Hashim Khan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UserListViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITableView *userlistTableView;
@end
|
/*
* SPDX-FileCopyrightText: 2020-2021 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
#include "soc/interrupts.h"
const char *const esp_isr_names[ETS_MAX_INTR_SOURCE] = {
[0] = "WIFI_MAC",
[1] = "WIFI_NMI",
[2] = "WIFI_PWR",
[3] = "WIFI_BB",
[4] = "BT_MAC",
[5] = "BT_BB",
[6] = "BT_BB_NMI",
[7] = "RWBT",
[8] = "RWBLE",
[9] = "RWBT_NMI",
[10] = "RWBLE_NMI",
[11] = "I2C",
[12] = "SLC0",
[13] = "SLC1",
[14] = "APB_CTRL",
[15] = "UHCI0",
[16] = "GPIO",
[17] = "GPIO_NMI",
[18] = "SPI1",
[19] = "SPI2",
[20] = "I2S1",
[21] = "UART0",
[22] = "UART1",
[23] = "LEDC",
[24] = "EFUSE",
[25] = "TWAI",
[26] = "USB",
[27] = "RTC_CORE",
[28] = "RMT",
[29] = "I2C_EXT0",
[30] = "TIMER1",
[31] = "TIMER2",
[32] = "TG0_T0_LEVEL",
[33] = "TG0_WDT_LEVEL",
[34] = "TG1_T0_LEVEL",
[35] = "TG1_WDT_LEVEL",
[36] = "CACHE_IA",
[37] = "SYSTIMER_TARGET0_EDGE",
[38] = "SYSTIMER_TARGET1_EDGE",
[39] = "SYSTIMER_TARGET2_EDGE",
[40] = "SPI_MEM_REJECT_CACHE",
[41] = "ICACHE_PRELOAD0",
[42] = "ICACHE_SYNC0",
[43] = "APB_ADC",
[44] = "DMA_CH0",
[45] = "DMA_CH1",
[46] = "DMA_CH2",
[47] = "RSA",
[48] = "AES",
[49] = "SHA",
[50] = "ETS_FROM_CPU_INTR0",
[51] = "ETS_FROM_CPU_INTR1",
[52] = "ETS_FROM_CPU_INTR2",
[53] = "ETS_FROM_CPU_INTR3",
[54] = "ETS_ASSIST_DEBUG",
[55] = "ETS_DMA_APBPERI_PMS",
[56] = "ETS_CORE0_IRAM0_PMS",
[57] = "ETS_CORE0_DRAM0_PMS",
[58] = "ETS_CORE0_PIF_PMS",
[59] = "ETS_CORE0_PIF_PMS_SIZE",
[60] = "ETS_BAK_PMS_VIOLATE",
[61] = "ETS_CACHE_CORE0_ACS",
};
|
// Copyright 2017 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef TINK_AEAD_AEAD_FACTORY_H_
#define TINK_AEAD_AEAD_FACTORY_H_
#include "absl/base/macros.h"
#include "tink/aead.h"
#include "tink/key_manager.h"
#include "tink/keyset_handle.h"
#include "tink/util/statusor.h"
namespace crypto {
namespace tink {
///////////////////////////////////////////////////////////////////////////////
// This class is deprecated. Call keyset_handle->GetPrimitive<Aead>() instead.
//
// Note that in order to for this change to be safe, the AeadSetWrapper has to
// be registered in your binary before this call. This happens automatically if
// you call one of
// * AeadConfig::Register()
// * HybridConfig::Register()
// * TinkConfig::Register()
class ABSL_DEPRECATED(
"Call GetPrimitive<Aead>() on the keyset_handle after registering the "
"AeadWrapper instead.") AeadFactory {
public:
// Returns an Aead-primitive that uses key material from the keyset
// specified via 'keyset_handle'.
static crypto::tink::util::StatusOr<std::unique_ptr<Aead>> GetPrimitive(
const KeysetHandle& keyset_handle);
// Returns an Aead-primitive that uses key material from the keyset
// specified via 'keyset_handle' and is instantiated by the given
// 'custom_key_manager' (instead of the key manager from the Registry).
static crypto::tink::util::StatusOr<std::unique_ptr<Aead>> GetPrimitive(
const KeysetHandle& keyset_handle,
const KeyManager<Aead>* custom_key_manager);
private:
AeadFactory() {}
};
} // namespace tink
} // namespace crypto
#endif // TINK_AEAD_AEAD_FACTORY_H_
|
//
// WikiTodayData.h
//
// Created by 超逸 李 on 14/12/25
// Copyright (c) 2014 Duostec. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface WikiTodayData : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *author;
@property (nonatomic, strong) NSString *cateId;
@property (nonatomic, strong) NSString *encyCollect;
@property (nonatomic, strong) NSString *typeId;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *encyId;
@property (nonatomic, strong) NSString *keyword;
@property (nonatomic, strong) NSString *cateName;
@property (nonatomic, strong) NSString *headImg;
@property (nonatomic, strong) NSString *encyRead;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
|
/*
* Copyright (c) 2013 Thomas Adam <thomas@xteddy.org>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
* IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
* OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* Routines for handling desktops */
#include <string.h>
#include "lswm.h"
struct desktop *
desktop_create(void)
{
struct desktop *d;
d = xmalloc(sizeof *d);
memset(d, 0, sizeof *d);
TAILQ_INIT(&d->clients_q);
d->name = NULL;
return (d);
}
void
add_desktop_to_monitor(struct monitor *m, struct desktop *d)
{
if (m == NULL) {
log_fatal("Can't add desktop '%s' to nonexistent monitor",
d->name);
}
if (TAILQ_EMPTY(&m->desktops_q))
TAILQ_INSERT_HEAD(&m->desktops_q, d, entry);
else
TAILQ_INSERT_TAIL(&m->desktops_q, d, entry);
log_msg("Added desktop: '%s' to monitor: '%s'", d->name, m->name);
}
void
desktop_set_name(struct desktop *d, const char *name)
{
if (name == NULL)
log_fatal("Setting desktop name cannot be NULL");
free(d->name);
d->name = strdup(name);
}
void
desktop_setup(struct monitor *m, const char *name)
{
struct desktop *d;
d = desktop_create();
desktop_set_name(d, name);
add_desktop_to_monitor(m, d);
}
inline int
desktop_count_all_desktops(void)
{
struct monitor *m;
struct desktop *d;
int c;
c = 0;
TAILQ_FOREACH(m, &monitor_q, entry) {
TAILQ_FOREACH(d, &m->desktops_q, entry) {
c++;
}
}
return (c);
}
|
/*-
* Copyright (C) 2011-2012 by Maxim Ignatenko <gelraen.ua@gmail.com>
* 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.
*/
#ifndef __USERFW_MODULE_H
#define __USERFW_MODULE_H
#include <userfw/types.h>
#include <sys/param.h>
#include <sys/lock.h>
#include <sys/rwlock.h>
#include <sys/queue.h>
#include <sys/mutex.h>
struct modinfo_entry
{
userfw_modinfo *data;
SLIST_ENTRY(modinfo_entry) entries;
uint32_t refcount;
struct mtx refcount_mtx;
};
typedef SLIST_HEAD(__userfw_modules_head, modinfo_entry) userfw_modules_head_t;
extern userfw_modules_head_t userfw_modules_list;
extern struct rwlock userfw_modules_list_mtx;
#endif /* __USERFW_MODULE_H */
|
/*
* Copyright (c) 2015, Guillermo Amaral <gamaral@kdab.com>
* 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.
*/
#include "stack.h"
#include <stdlib.h>
/************************************************************************ declarations */
struct t_STACK
{
struct t_STACK_ITEM *head;
};
struct t_STACK_ITEM
{
struct t_STACK_ITEM *next;
int value;
};
/************************************************************************* definitions */
STACK
stack_create(void)
{
STACK s = malloc(sizeof(struct t_STACK));
s->head = NULL;
return(s);
}
void
stack_destroy(STACK s)
{
struct t_STACK_ITEM *item = s->head;
while (item) {
struct t_STACK_ITEM *prev = item;
item = prev->next;
free(prev);
}
free(s);
}
void
stack_push(STACK s, int value)
{
struct t_STACK_ITEM *prev = s->head;
s->head = malloc(sizeof(struct t_STACK_ITEM));
s->head->next = prev;
s->head->value = value;
}
int
stack_pop(STACK s)
{
struct t_STACK_ITEM *item = s->head;
int result;
if (NULL == item)
return(-1);
s->head = item->next;
result = item->value;
free(item);
return(result);
}
BOOL
stack_contains(STACK s, int value)
{
struct t_STACK_ITEM *item = s->head;
BOOL result = FALSE;
while (item && !result) {
if (item->value == value)
result = TRUE;
else item = item->next;
}
return(result);
}
BOOL
stack_empty(STACK s)
{
return(s->head == NULL ? TRUE : FALSE);
}
|
/*
* =====================================================================================
*
* Filename: gaussian.h
*
* Description: <F7>
*
* Version: 1.0
* Created: 11/28/2015 9:54:01 PM
* Revision: none
* Compiler: gcc
*
* Author: Gabe Jespersen (), gzackwebs@tfwno.gf
* Organization:
*
* =====================================================================================
*/
#ifndef GAUSSIAN_H
#define GAUSSIAN_H
double gaussian(int,int);
#endif
|
/*
* Copyright (C) 2009 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:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef RenderRubyBase_h
#define RenderRubyBase_h
#include "RenderBlockFlow.h"
namespace WebCore {
class RenderRubyRun;
class RenderRubyBase final : public RenderBlockFlow {
public:
RenderRubyBase(Document&, RenderStyle&&);
virtual ~RenderRubyBase();
const char* renderName() const override { return "RenderRubyBase (anonymous)"; }
RenderRubyRun* rubyRun() const;
void setIsAfterExpansion(bool isAfterExpansion) { m_isAfterExpansion = isAfterExpansion; }
bool isAfterExpansion() { return m_isAfterExpansion; }
void setInitialOffset(float initialOffset) { m_initialOffset = initialOffset; }
void reset()
{
m_initialOffset = 0;
m_isAfterExpansion = true;
}
void cachePriorCharactersIfNeeded(const LazyLineBreakIterator&) override;
private:
bool isRubyBase() const override { return true; }
bool isChildAllowed(const RenderObject&, const RenderStyle&) const override;
ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const override;
void adjustInlineDirectionLineBounds(int expansionOpportunityCount, float& logicalLeft, float& logicalWidth) const override;
void mergeChildrenWithBase(RenderRubyBase* toBlock);
void moveChildren(RenderRubyBase* toBase, RenderObject* beforeChild = 0);
void moveInlineChildren(RenderRubyBase* toBase, RenderObject* beforeChild = 0);
void moveBlockChildren(RenderRubyBase* toBase, RenderObject* beforeChild = 0);
// Allow RenderRubyRun to manipulate the children within ruby bases.
friend class RenderRubyRun;
float m_initialOffset;
unsigned m_isAfterExpansion : 1;
};
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderRubyBase, isRubyBase())
#endif // RenderRubyBase_h
|
/*
* Verse encryption routines. There are two distinct flavors of encryption
* in use: one "heavy" for login/connection establishment security, and
* a far lighter symmetrical one that is applied to each data packet after
* the key has been exchanged during connection.
*/
#include "verse.h"
/* Internal key size definitions. *MUST* be kept in sync with V_HOST_ID_SIZE in verse_header.h! */
#define V_ENCRYPTION_LOGIN_KEY_BITS 512
#define V_ENCRYPTION_LOGIN_KEY_SIZE (V_ENCRYPTION_LOGIN_KEY_BITS / 8)
#define V_ENCRYPTION_LOGIN_KEY_FULL_SIZE (3 * V_ENCRYPTION_LOGIN_KEY_SIZE)
#define V_ENCRYPTION_LOGIN_KEY_HALF_SIZE (2 * V_ENCRYPTION_LOGIN_KEY_SIZE)
#define V_ENCRYPTION_LOGIN_PUBLIC_START (0 * V_ENCRYPTION_LOGIN_KEY_SIZE)
#define V_ENCRYPTION_LOGIN_PRIVATE_START (1 * V_ENCRYPTION_LOGIN_KEY_SIZE)
#define V_ENCRYPTION_LOGIN_N_START (2 * V_ENCRYPTION_LOGIN_KEY_SIZE)
#define V_ENCRYPTION_DATA_KEY_SIZE (V_ENCRYPTION_LOGIN_KEY_BITS / 8)
/* Connection encryption. Heavy, and symmetrical, so encrypt() does both encryption
* and decryption given the proper key. Current algorithm used is RSA.
*/
extern void v_e_connect_create_key(uint8 *private_key, uint8 *public_key, uint8 *n);
extern void v_e_connect_encrypt(uint8 *output, const uint8 *data, const uint8 *key, const uint8 *key_n);
/* Actual data traffic encryption. Also symmetrical, with a single key. Uses XOR. */
extern const uint8 * v_e_data_create_key(void);
extern void v_e_data_encrypt_command(uint8 *packet, size_t packet_length,
const uint8 *command, size_t command_length, const uint8 *key);
extern void v_e_data_decrypt_packet(uint8 *to, const uint8 *from, size_t size, const uint8 *key);
|
#include "libtrading/proto/fix_message.h"
#include "libtrading/proto/fix_session.h"
#include "libtrading/array.h"
#include "libtrading/die.h"
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <stdio.h>
#include <netdb.h>
#include <errno.h>
#define FIX_FIELDS_NUM 32
static const char *program;
static void usage(void)
{
fprintf(stderr, "\n usage: %s -h host -p port\n\n", program);
exit(EXIT_FAILURE);
}
static int socket_setopt(int sockfd, int level, int optname, int optval)
{
return setsockopt(sockfd, level, optname, (void *) &optval, sizeof(optval));
}
static int do_trader(struct fix_session_cfg *cfg)
{
struct fix_session *session = NULL;
struct fix_field *fields = NULL;
double price, qty;
int ret = -1;
int nr = 0;
int side;
session = fix_session_new(cfg);
if (!session) {
fprintf(stderr, "FIX session cannot be created\n");
goto exit;
}
ret = fix_session_logon(session);
if (ret) {
fprintf(stderr, "Trader Logon failed\n");
goto exit;
}
fprintf(stdout, "Trader Logged on\n");
fields = calloc(FIX_FIELDS_NUM, sizeof(struct fix_field));
if (!fields) {
fprintf(stderr, "Cannot allocate memory\n");
goto exit;
}
while (true) {
nr = 0;
fprintf(stdout, "Buy/Sell/Quit (1/2/0): ");
if (scanf("%d", &side) != 1)
continue;
if (side == 1)
fields[nr++] = FIX_STRING_FIELD(Side, "1");
else if (side == 2)
fields[nr++] = FIX_STRING_FIELD(Side, "2");
else if (side == 0)
break;
else
continue;
fprintf(stdout, "Price: ");
if (scanf("%lf", &price) != 1)
continue;
if (price <= 0)
continue;
fields[nr++] = FIX_FLOAT_FIELD(Price, price);
fprintf(stdout, "Quantity: ");
if (scanf("%lf", &qty) != 1)
continue;
if (qty <= 0)
continue;
fields[nr++] = FIX_FLOAT_FIELD(OrderQty, qty);
fix_session_new_order_single(session, fields, nr);
}
ret = fix_session_logout(session, NULL);
if (!ret)
fprintf(stdout, "Trader logged out\n");
else
fprintf(stderr, "Trader logout failed\n");
exit:
fix_session_free(session);
free(fields);
return ret;
}
int main(int argc, char *argv[])
{
struct fix_session_cfg cfg;
const char *host = NULL;
struct sockaddr_in sa;
int saved_errno = 0;
struct hostent *he;
int port = 0;
int ret = 0;
char **ap;
int opt;
program = basename(argv[0]);
while ((opt = getopt(argc, argv, "h:p:")) != -1) {
switch (opt) {
case 'p':
port = atoi(optarg);
break;
case 'h':
host = optarg;
break;
default: /* '?' */
usage();
exit(EXIT_FAILURE);
}
}
if (!port || !host)
usage();
strncpy(cfg.target_comp_id, "SELLSIDE", ARRAY_SIZE(cfg.target_comp_id));
strncpy(cfg.sender_comp_id, "BUYSIDE", ARRAY_SIZE(cfg.sender_comp_id));
cfg.dialect = &fix_dialects[FIX_4_4];
he = gethostbyname(host);
if (!he)
error("Unable to look up %s (%s)", host, hstrerror(h_errno));
for (ap = he->h_addr_list; *ap; ap++) {
cfg.sockfd = socket(he->h_addrtype, SOCK_STREAM, IPPROTO_TCP);
if (cfg.sockfd < 0) {
saved_errno = errno;
continue;
}
sa = (struct sockaddr_in) {
.sin_family = he->h_addrtype,
.sin_port = htons(port),
};
memcpy(&sa.sin_addr, *ap, he->h_length);
if (connect(cfg.sockfd, (const struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) {
saved_errno = errno;
close(cfg.sockfd);
cfg.sockfd = -1;
continue;
}
break;
}
if (cfg.sockfd < 0)
error("Unable to connect to a socket (%s)", strerror(saved_errno));
if (socket_setopt(cfg.sockfd, IPPROTO_TCP, TCP_NODELAY, 1) < 0)
die("cannot set socket option TCP_NODELAY");
ret = do_trader(&cfg);
shutdown(cfg.sockfd, SHUT_RDWR);
if (close(cfg.sockfd) < 0)
die("close");
return ret;
}
|
/*-
* Copyright (c) 2011 Varnish Software AS
* All rights reserved.
*
* Author: Martin Blix Grydeland <martin@varnish-software.com>
* 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.
*
* Handle backend connections and backend request structures.
*
*/
#include "config.h"
#include <stdlib.h>
#include <stddef.h>
#include <stdio.h>
#include "cache.h"
struct vbo {
unsigned magic;
#define VBO_MAGIC 0xde3d8223
struct lock mtx;
unsigned refcount;
uint16_t nhttp;
struct busyobj bo;
};
static struct lock vbo_mtx;
static struct vbo *nvbo;
void
VBO_Init(void)
{
Lck_New(&vbo_mtx, lck_busyobj);
nvbo = NULL;
}
/*--------------------------------------------------------------------
* BusyObj handling
*/
static struct vbo *
vbo_New(void)
{
struct vbo *vbo;
uint16_t nhttp;
ssize_t http_space;
assert(cache_param->http_max_hdr < 65536);
nhttp = (uint16_t)cache_param->http_max_hdr;
http_space = HTTP_estimate(nhttp);
vbo = malloc(sizeof *vbo + 2 * http_space);
AN(vbo);
memset(vbo, 0, sizeof *vbo);
vbo->magic = VBO_MAGIC;
vbo->nhttp = nhttp;
Lck_New(&vbo->mtx, lck_busyobj);
return (vbo);
}
void
VBO_Free(struct vbo **vbop)
{
struct vbo *vbo;
AN(vbop);
vbo = *vbop;
*vbop = NULL;
CHECK_OBJ_NOTNULL(vbo, VBO_MAGIC);
AZ(vbo->refcount);
Lck_Delete(&vbo->mtx);
FREE_OBJ(vbo);
}
struct busyobj *
VBO_GetBusyObj(struct worker *wrk)
{
struct vbo *vbo = NULL;
char *p;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
if (wrk->nvbo != NULL) {
vbo = wrk->nvbo;
wrk->nvbo = NULL;
}
if (vbo == NULL) {
Lck_Lock(&vbo_mtx);
vbo = nvbo;
nvbo = NULL;
if (vbo == NULL)
VSC_C_main->busyobj_alloc++;
Lck_Unlock(&vbo_mtx);
}
if (vbo != NULL && vbo->nhttp != cache_param->http_max_hdr)
VBO_Free(&vbo);
if (vbo == NULL)
vbo = vbo_New();
CHECK_OBJ_NOTNULL(vbo, VBO_MAGIC);
AZ(vbo->refcount);
AZ(vbo->bo.magic);
vbo->refcount = 1;
vbo->bo.magic = BUSYOBJ_MAGIC;
vbo->bo.vbo = vbo;
p = (void*)(vbo + 1);
vbo->bo.bereq = HTTP_create(p, vbo->nhttp);
p += HTTP_estimate(vbo->nhttp);
vbo->bo.beresp = HTTP_create(p, vbo->nhttp);
return (&vbo->bo);
}
void
VBO_RefBusyObj(const struct busyobj *busyobj)
{
struct vbo *vbo;
CHECK_OBJ_NOTNULL(busyobj, BUSYOBJ_MAGIC);
vbo = busyobj->vbo;
CHECK_OBJ_NOTNULL(vbo, VBO_MAGIC);
Lck_Lock(&vbo->mtx);
assert(vbo->refcount > 0);
vbo->refcount++;
Lck_Unlock(&vbo->mtx);
}
void
VBO_DerefBusyObj(struct worker *wrk, struct busyobj **pbo)
{
struct busyobj *bo;
struct vbo *vbo;
unsigned r;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
AN(pbo);
bo = *pbo;
*pbo = NULL;
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
vbo = bo->vbo;
CHECK_OBJ_NOTNULL(vbo, VBO_MAGIC);
Lck_Lock(&vbo->mtx);
assert(vbo->refcount > 0);
r = --vbo->refcount;
Lck_Unlock(&vbo->mtx);
if (r == 0) {
/* XXX: Sanity checks & cleanup */
memset(&vbo->bo, 0, sizeof vbo->bo);
if (cache_param->bo_cache && wrk->nvbo == NULL) {
wrk->nvbo = vbo;
} else {
Lck_Lock(&vbo_mtx);
if (nvbo == NULL) {
nvbo = vbo;
vbo = NULL;
} else
VSC_C_main->busyobj_free++;
Lck_Unlock(&vbo_mtx);
if (vbo != NULL)
VBO_Free(&vbo);
}
}
}
|
#ifndef DOWNLOADHTTP_H
#define DOWNLOADHTTP_H
#include <QtGlobal>
#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QFile>
#include <QTimer>
class DownloadHTTP : public QObject {
Q_OBJECT
public:
explicit DownloadHTTP(QObject* parent = 0);
virtual ~DownloadHTTP();
signals:
void addLine(QString qsLine);
void downloadComplete();
void progress(int nPercentage);
public slots:
void download(QUrl url);
private slots:
void download();
void finishedHead();
void finished();
void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
private:
QUrl _URL;
QString _qsFileName;
QNetworkAccessManager* _pManager;
QNetworkRequest _CurrentRequest;
QNetworkReply* _pCurrentReply;
QFile* _pFile;
int _nDownloadTotal;
bool _bAcceptRanges;
int _nDownloadSize;
int _nDownloadSizeAtPause;
QTimer _Timer;
};
#endif // DOWNLOADHTTP_H
|
// USB HID helper library for libUSBThermo
#ifndef __USBHID_H__
#define __USBHID_H__
#include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
struct HidDevice_;
typedef struct HidDevice_ HidDevice;
typedef struct HidDevicePathList_ HidDevicePathList;
struct HidDevicePathList_ {
char *path;
HidDevicePathList *next;
};
int HidInit( void );
int HidExit( void );
HidDevice *HidOpen( uint16_t vendor_id, uint16_t product_id );
HidDevice *HidOpenPath( const char *path );
void HidClose( HidDevice *device );
HidDevicePathList *HidEnumerate( uint16_t vendor_id, uint16_t product_id );
void HidFreeEnumeration( HidDevicePathList *devs );
void HidSetDefaultTimeout( HidDevice *device, int milliseconds );
int HidWrite( HidDevice *device, const u_char *data, size_t length );
int HidWriteTimeout( HidDevice *device, const u_char *data, size_t length, int milliseconds );
int HidRead( HidDevice *device, u_char *data, size_t length );
int HidReadTimeout( HidDevice *device, u_char *data, size_t length, int milliseconds );
#ifdef __cplusplus
}
#endif
#endif
|
/*-
* Copyright (c) 1987, 1991 Regents of the University of California.
* 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.
* 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
*
* @(#)endian.h 7.8 (Berkeley) 4/3/91
* $FreeBSD: releng/10.2/sys/x86/include/endian.h 233684 2012-03-29 23:31:48Z dim $
*/
#ifndef _MACHINE_ENDIAN_H_
#define _MACHINE_ENDIAN_H_
#include <sys/cdefs.h>
#include <sys/_types.h>
/*
* Define the order of 32-bit words in 64-bit words.
*/
#define _QUAD_HIGHWORD 1
#define _QUAD_LOWWORD 0
/*
* Definitions for byte order, according to byte significance from low
* address to high.
*/
#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
#define _BYTE_ORDER _LITTLE_ENDIAN
/*
* Deprecated variants that don't have enough underscores to be useful in more
* strict namespaces.
*/
#if __BSD_VISIBLE
#define LITTLE_ENDIAN _LITTLE_ENDIAN
#define BIG_ENDIAN _BIG_ENDIAN
#define PDP_ENDIAN _PDP_ENDIAN
#define BYTE_ORDER _BYTE_ORDER
#endif
#define __bswap16_gen(x) (__uint16_t)((x) << 8 | (x) >> 8)
#define __bswap32_gen(x) \
(((__uint32_t)__bswap16((x) & 0xffff) << 16) | __bswap16((x) >> 16))
#define __bswap64_gen(x) \
(((__uint64_t)__bswap32((x) & 0xffffffff) << 32) | __bswap32((x) >> 32))
#ifdef __GNUCLIKE_BUILTIN_CONSTANT_P
#define __bswap16(x) \
((__uint16_t)(__builtin_constant_p(x) ? \
__bswap16_gen((__uint16_t)(x)) : __bswap16_var(x)))
#define __bswap32(x) \
(__builtin_constant_p(x) ? \
__bswap32_gen((__uint32_t)(x)) : __bswap32_var(x))
#define __bswap64(x) \
(__builtin_constant_p(x) ? \
__bswap64_gen((__uint64_t)(x)) : __bswap64_var(x))
#else
/* XXX these are broken for use in static initializers. */
#define __bswap16(x) __bswap16_var(x)
#define __bswap32(x) __bswap32_var(x)
#define __bswap64(x) __bswap64_var(x)
#endif
/* These are defined as functions to avoid multiple evaluation of x. */
static __inline __uint16_t
__bswap16_var(__uint16_t _x)
{
return (__bswap16_gen(_x));
}
static __inline __uint32_t
__bswap32_var(__uint32_t _x)
{
#ifdef __GNUCLIKE_ASM
__asm("bswap %0" : "+r" (_x));
return (_x);
#else
return (__bswap32_gen(_x));
#endif
}
static __inline __uint64_t
__bswap64_var(__uint64_t _x)
{
#if defined(__amd64__) && defined(__GNUCLIKE_ASM)
__asm("bswap %0" : "+r" (_x));
return (_x);
#else
/*
* It is important for the optimizations that the following is not
* really generic, but expands to 2 __bswap32_var()'s.
*/
return (__bswap64_gen(_x));
#endif
}
#define __htonl(x) __bswap32(x)
#define __htons(x) __bswap16(x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
#endif /* !_MACHINE_ENDIAN_H_ */
|
#include "apue.h"
#include <sys/socket.h>
/*
* Returns a full-duplex "stream" pipe (a UNIX domain socket)
* with the two file descriptors returned in fd[0] and fd[1].
*/
int s_pipe(int fd[2])
{
return socketpair(AF_UNIX, SOCK_STREAM, 0, fd);
}
|
#include "e.h"
static void
_fsel_path_save(E_Import_Dialog *id)
{
const char *fdev = NULL, *fpath = NULL;
e_widget_fsel_path_get(id->fsel_obj, &fdev, &fpath);
if ((fdev) || (fpath))
{
eina_stringshare_replace(&e_config->wallpaper_import_last_dev, fdev);
eina_stringshare_replace(&e_config->wallpaper_import_last_path, fpath);
e_config_save_queue();
}
}
static void
_fsel_cb_close(void *data, E_Dialog *dia __UNUSED__)
{
E_Import_Dialog *id = data;
e_object_ref(data);
if (id->cancel) id->cancel(id);
e_object_del(data);
e_object_unref(data);
}
static void
_import_ok(void *data, void *data2)
{
E_Import_Dialog *id;
id = e_object_data_get(data2);
e_object_ref(E_OBJECT(id));
if (id->ok) id->ok(data, id);
e_object_del(E_OBJECT(id));
e_object_unref(E_OBJECT(id));
}
static void
_fsel_cb_ok(void *data, E_Dialog *dia __UNUSED__)
{
E_Import_Dialog *id;
const char *path, *p;
int is_bg, is_theme, r;
const char *file;
char buf[PATH_MAX];
id = data;
path = e_widget_fsel_selection_path_get(id->fsel_obj);
if (!path) return;
p = strrchr(path, '.');
if ((p) && (strcasecmp(p, ".edj")))
{
E_Import_Config_Dialog *import;
import = e_import_config_dialog_show(id->dia->win->container, path, _import_ok, NULL);
e_dialog_parent_set(import->dia, id->dia->win);
e_object_data_set(E_OBJECT(import), id);
return;
}
r = 0;
file = ecore_file_file_get(path);
e_user_dir_snprintf(buf, sizeof(buf), "backgrounds/%s", file);
is_bg = edje_file_group_exists(path, "e/desktop/background");
is_theme =
edje_file_group_exists(path, "e/widgets/border/default/border");
if ((is_bg) && (!is_theme))
{
if (!ecore_file_cp(path, buf))
{
e_util_dialog_show(_("Import Error"),
_("Enlightenment was unable to "
"import the image<br>due to a "
"copy error."));
}
else
r = 1;
}
else
{
e_util_dialog_show(_("Import Error"),
_("Enlightenment was unable to "
"import the image.<br><br>"
"Are you sure this is a valid "
"image?"));
}
if (r)
{
e_object_ref(E_OBJECT(id));
if (id->ok) id->ok(buf, id);
e_object_del(E_OBJECT(id));
e_object_unref(E_OBJECT(id));
}
else
_fsel_cb_close(id, NULL);
}
static void
_e_import_dia_del(void *data)
{
E_Dialog *dia = data;
e_object_del(dia->data);
}
static void
_e_import_dialog_del(void *data)
{
E_Import_Dialog *id = data;
_fsel_path_save(id);
e_object_del(E_OBJECT(id->dia));
free(id);
}
static void
_e_import_dialog_win_del(E_Win *win)
{
E_Dialog *dia;
E_Import_Dialog *id;
dia = win->data;
id = dia->data;
e_object_del(E_OBJECT(id));
}
//////////////////////////////////////////////////////////////////////////////////
EAPI E_Import_Dialog *
e_import_dialog_show(E_Container *con, const char *dev, const char *path, Ecore_End_Cb ok, Ecore_Cb cancel)
{
Evas *evas;
E_Import_Dialog *id;
Evas_Object *ofm;
int w, h;
const char *fdev, *fpath;
char buf[PATH_MAX], *rpath;
E_Dialog *dia;
id = E_OBJECT_ALLOC(E_Import_Dialog, E_IMPORT_DIALOG_TYPE, _e_import_dialog_del);
if (!id) return NULL;
dia = e_dialog_new(con, "E", "_import_fsel_dialog");
if (!dia)
{
e_object_del(E_OBJECT(id));
return NULL;
}
e_dialog_resizable_set(dia, 1);
dia->data = id;
id->dia = dia;
id->ok = ok, id->cancel = cancel;
e_object_del_attach_func_set(E_OBJECT(dia), _e_import_dia_del);
e_win_delete_callback_set(dia->win, _e_import_dialog_win_del);
evas = e_win_evas_get(dia->win);
e_dialog_title_set(dia, _("Select a Picture..."));
fdev = dev ?: e_config->wallpaper_import_last_dev;
fpath = path ?: e_config->wallpaper_import_last_path;
if (fdev)
snprintf(buf, sizeof(buf), "%s/%s",
fdev, fpath);
else
snprintf(buf, sizeof(buf), "%s", fpath);
rpath = ecore_file_realpath(buf);
if (!ecore_file_exists(rpath))
fpath = "/";
free(rpath);
if ((!fdev) && (!fpath))
{
fdev = "~/";
fpath = "/";
}
//printf("LAST: [%s] '%s' '%s'\n", buf, fdev, fpath);
/* if we ever use the second param in _fsel_cb_ok() then we will have to create a second function
* for this callback, but as of now it's okay
*/
ofm = e_widget_fsel_add(evas, fdev, fpath, NULL, NULL, (void*)_fsel_cb_ok, id,
NULL, NULL, 1);
e_widget_fsel_window_object_set(ofm, E_OBJECT(dia->win));
id->fsel_obj = ofm;
e_widget_size_min_get(ofm, &w, &h);
e_dialog_content_set(dia, ofm, w, h);
e_dialog_button_add(dia, _("Use"), NULL, _fsel_cb_ok, id);
e_dialog_button_add(dia, _("Cancel"), NULL, _fsel_cb_close, id);
e_dialog_border_icon_set(dia, "enlightenment/background");
e_dialog_show(dia);
e_win_centered_set(dia->win, 1);
e_widget_focus_set(ofm, 1);
return id;
}
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "ModuleManager.h"
/**
* The public interface to this module. In most cases, this interface is only public to sibling modules
* within this plugin.
*/
class ILiveEditorListenServer : public IModuleInterface
{
public:
/**
* Singleton-like access to this module's interface. This is just for convenience!
* Beware of calling this during the shutdown phase, though. Your module might have been unloaded already.
*
* @return Returns singleton instance, loading the module on demand if needed
*/
static inline ILiveEditorListenServer& Get()
{
return FModuleManager::LoadModuleChecked< ILiveEditorListenServer >( "LiveEditorListenServer" );
}
/**
* Checks to see if this module is loaded and ready. It is only valid to call Get() if IsAvailable() returns true.
*
* @return True if the module is loaded and ready to use
*/
static inline bool IsAvailable()
{
return FModuleManager::Get().IsModuleLoaded( "LiveEditorListenServer" );
}
};
|
/* Copyright (c) 2013, Robert Clausecker
* 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 OUTPUT_H
#define OUTPUT_H
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
/* string with all available formats */
extern const char formats[];
/* digest formats as a list of indices into formats[] */
enum digest_format {
/* b */ BSD_FORMAT,
/* c */ POSIX_FORMAT,
/* l */ HEXLEN_FORMAT,
/* s */ SYSV_FORMAT,
/* x */ HEX_FORMAT,
/* 0 */ UNKNOWN_FORMAT,
};
extern int format_digest(const uint8_t*,size_t,off_t,const char*,enum digest_format);
#endif /* OUTPUT_H */
|
#ifndef INCLUDE_POD_LIST_H
#define INCLUDE_POD_LIST_H
/********************************************************************
* pod_list.h
* Copyright (c) 2011-2012, James A. Banks
* All rights reserved.
* See file LICENSE for details.
********************************************************************/
#include <stddef.h>
#include "pod_object.h"
// I'm finding that struct blah-blah wastes too much space so I'll try it
// without (that is, use a typedef).
// Type value is 0x62, POD_OBJECT_TYPE + 2
#define POD_LIST_TYPE 0x62
struct pod_list;
typedef struct pod_list pod_list;
struct pod_list {
pod_object o;
pod_node header;
};
// One may need to walk a list and do something to the objects.
typedef pod_object *pod_list_apply(pod_list *list, pod_object *object);
// Constructor and destructor
extern pod_list *pod_list_create(void);
extern void pod_list_destroy(void *target);
// Other pod_list-related functions
extern void pod_list_append(pod_list *list, pod_object *object);
extern pod_object *pod_list_peek(pod_list *list);
extern pod_object *pod_list_pop(pod_list *list);
extern void pod_list_push(pod_list *list, pod_object *object);
extern size_t pod_list_size(pod_list *list);
extern int pod_list_is_empty(pod_list *list);
extern pod_object *pod_list_find(pod_list *list, size_t pos);
extern pod_object *pod_list_insert(pod_list *list, size_t pos, pod_object *obj);
extern pod_object *pod_list_remove(pod_list *list, size_t pos);
extern pod_object *pod_list_replace(pod_list *list, size_t pos, pod_object *to);
extern void pod_list_apply_all(pod_list *list, pod_list_apply *apply);
#endif /* INCLUDE_POD_LIST_H */
|
/*******************************************************************************
* Copyright 2016 ROBOTIS CO., LTD.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/* Authors: Taehoon Lim (Darby) */
#ifndef POLI_PAN_TILT_POSITION_CONTROL_H
#define POLI_PAN_TILT_POSITION_CONTROL_H
#include <ros/ros.h>
#include <dynamixel_workbench_toolbox/dynamixel_multi_driver.h>
#include <dynamixel_workbench_msgs/DynamixelStateList.h>
#include <dynamixel_workbench_msgs/JointCommand.h>
#include <std_msgs/Float64.h>
namespace position_control
{
#define MOTOR 0
#define PAN 0
#define TILT 1
typedef struct
{
std::vector<uint8_t> torque;
std::vector<uint32_t> pos;
std::vector<uint32_t> prof_vel;
std::vector<uint32_t> prof_acc;
}WriteValue;
class PositionControl
{
private:
// ROS NodeHandle
ros::NodeHandle node_handle_;
ros::NodeHandle node_handle_priv_;
// ROS Parameters
int profile_velocity_;
int profile_acceleration_;
// ROS Topic Publisher
ros::Publisher dynamixel_state_list_pub_;
// ROS Topic Subscriber
ros::Subscriber joint_command_sub;
// ROS Service Server
ros::ServiceServer joint_command_server;
// ROS Service Client
// ROS Topic Publisher
// ROS Service Server
// Dynamixel Workbench Parameters
std::vector<dynamixel_driver::DynamixelInfo*> dynamixel_info_;
dynamixel_multi_driver::DynamixelMultiDriver *multi_driver_;
WriteValue *writeValue_;
public:
PositionControl();
~PositionControl();
bool controlLoop(void);
private:
bool loadDynamixel();
bool checkLoadDynamixel();
bool initDynamixelStatePublisher();
bool initDynamixelInfoServer();
bool setTorque(bool onoff);
bool setProfileValue(uint32_t prof_vel, uint32_t prof_acc);
bool setPosition(uint32_t pan_pos);
void jointCommandSubCallback(const std_msgs::Float64::ConstPtr& msg);
bool readDynamixelState();
bool dynamixelStatePublish();
uint32_t convertRadian2Value(float radian);
float convertValue2Radian(int32_t value);
};
}
#endif //POLI_PAN_TILT_POSITION_CONTROL_H
|
/* bcal-cbc.h */
/*
This file is part of the ARM-Crypto-Lib.
Copyright (C) 2010 Daniel Otte (daniel.otte@rub.de)
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/>.
*/
#ifndef BCALCBC_H_
#define BCALCBC_H_
#include <stdint.h>
#include <crypto/blockcipher_descriptor.h>
#include <crypto/bcal-basic.h>
typedef struct{
bcdesc_t* desc;
bcgen_ctx_t cctx;
uint8_t* prev_block;
uint8_t blocksize_B;
} bcal_cbc_ctx_t;
uint8_t bcal_cbc_init(const bcdesc_t* desc, const void* key, uint16_t keysize_b, bcal_cbc_ctx_t* ctx);
void bcal_cbc_free(bcal_cbc_ctx_t* ctx);
void bcal_cbc_loadIV(const void* iv, bcal_cbc_ctx_t* ctx);
void bcal_cbc_encNext(void* block, bcal_cbc_ctx_t* ctx);
void bcal_cbc_decNext(void* block, bcal_cbc_ctx_t* ctx);
void bcal_cbc_decRand(void* block, const void* prev_block, bcal_cbc_ctx_t* ctx);
void bcal_cbc_encMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
void bcal_cbc_decMsg(const void* iv, void* msg, uint16_t msg_blocks, bcal_cbc_ctx_t* ctx);
#endif /* BCALCBC_H_ */
|
#ifndef _SL_LOG_H_
#define _SL_LOG_H_
#include <stdio.h>
#define SL_LOG_ERROR(fmt, arg...) printf(fmt, arg);
#define SL_LOG_WARN(fmt, arg...) printf(fmt, arg);
#define SL_LOG_INFO(fmt, arg...) printf(fmt, arg);
#define SL_LOG_DEBUG(fmt, arg...) printf(fmt, arg);
#endif
|
//---------------------------------------------------------------------------
#ifndef Unit2H
#define Unit2H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
//---------------------------------------------------------------------------
class TForm2 : public TForm
{
__published: // IDE-managed Components
TButton *btn1;
TEdit *edt1;
TLabel *lbl1;
TPanel *pnl1;
TEdit *edt2;
TLabel *lbl2;
void __fastcall btn1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm2(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm2 *Form2;
//---------------------------------------------------------------------------
#endif
|
/*
This file is a part of NNTL project (https://github.com/Arech/nntl)
Copyright (c) 2015-2021, Arech (aradvert@gmail.com; https://github.com/Arech)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of NNTL 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.
*/
#pragma once
#include <type_traits>
#include "utils/denormal_floats.h"
#include "utils/tuple_utils.h"
#include "utils/own_or_use_ptr.h"
#include "utils/scope_exit.h"
#include "utils/chrono.h"
|
/* $NetBSD: cpu.h,v 1.3 1999/12/24 08:29:25 msaitoh Exp $ */
#ifndef _EVBSH3_CPU_H_
#define _EVBSH3_CPU_H_
#include <sh3/cpu.h>
#endif /* _EVBSH3_CPU_H_ */
|
/*
* 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.
*/
// Pebble/src/framework/dr/common/to_string.h
#ifndef BUBBLEFS_UTILS_PEBBLE_DR_TO_STRING_H_
#define BUBBLEFS_UTILS_PEBBLE_DR_TO_STRING_H_
#include <map>
#include <set>
#include <sstream>
#include <string>
#include <vector>
namespace bubblefs {
namespace mypebble { namespace dr {
template <typename T>
std::string to_string(const T& t) {
std::ostringstream o;
o << t;
return o.str();
}
template <typename K, typename V>
std::string to_string(const std::map<K, V>& m);
template <typename T>
std::string to_string(const std::set<T>& s);
template <typename T>
std::string to_string(const std::vector<T>& t);
template <typename K, typename V>
std::string to_string(const typename std::pair<K, V>& v) {
std::ostringstream o;
o << to_string(v.first) << ": " << to_string(v.second);
return o.str();
}
template <typename T>
std::string to_string(const T& beg, const T& end)
{
std::ostringstream o;
for (T it = beg; it != end; ++it) {
if (it != beg) {
o << ", ";
}
o << to_string(*it);
}
return o.str();
}
template <typename T>
std::string to_string(const std::vector<T>& t) {
std::ostringstream o;
o << "[" << to_string(t.begin(), t.end()) << "]";
return o.str();
}
template <typename K, typename V>
std::string to_string(const std::map<K, V>& m) {
std::ostringstream o;
o << "{" << to_string(m.begin(), m.end()) << "}";
return o.str();
}
template <typename T>
std::string to_string(const std::set<T>& s) {
std::ostringstream o;
o << "{" << to_string(s.begin(), s.end()) << "}";
return o.str();
}
} // namespace dr
} // namespace mypebble
} // namespace bubblefs
#endif // BUBBLEFS_UTILS_PEBBLE_DR_TO_STRING_H_
|
/* Copyright (C) 2005-2011, Thorvald Natvig <thorvald@natvig.com>
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- Neither the name of the Mumble Developers 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 FOUNDATION OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _SCRIPT_H
#define _SCRIPT_H
#include "mumble_pch.hpp"
#include "User.h"
#include "Channel.h"
class ScriptUser;
class ScriptChannel;
class MumbleScript;
class MumbleScripts;
class ScriptUser : public QObject, protected QScriptable {
friend class MumbleScript;
Q_OBJECT
Q_DISABLE_COPY(ScriptUser)
Q_PROPERTY(QString name READ getName)
Q_PROPERTY(unsigned int session READ getSession)
Q_PROPERTY(int id READ getId)
Q_PROPERTY(QScriptValue channel READ getChannel WRITE setChannel)
Q_PROPERTY(bool mute READ isMute WRITE setMute)
Q_PROPERTY(bool deaf READ isDeaf WRITE setDeaf)
public:
ScriptUser(ClientUser *p);
QString getName() const;
unsigned int getSession() const;
int getId() const;
QScriptValue getChannel() const;
bool isMute() const;
bool isDeaf() const;
public slots:
void setMute(bool);
void setDeaf(bool);
void setChannel(const QScriptValue &);
void sendMessage(const QString &);
signals:
void moved();
};
class ScriptChannel : public QObject, protected QScriptable {
friend class MumbleScript;
Q_OBJECT
Q_DISABLE_COPY(ScriptChannel)
Q_PROPERTY(QString name READ getName WRITE setName)
Q_PROPERTY(int id READ getId)
Q_PROPERTY(int parent READ getParent WRITE setParent)
Q_PROPERTY(QScriptValue children READ getChildren)
Q_PROPERTY(QScriptValue users READ getUsers)
public:
ScriptChannel(Channel *c);
QString getName() const;
int getId() const;
int getParent() const;
public slots:
void setName(const QString &);
void setParent(int);
QScriptValue getUsers() const;
QScriptValue getChildren() const;
void sendMessage(const QString &, bool);
signals:
void moved();
};
class ScriptServer : public QObject, protected QScriptable {
friend class MumbleScript;
Q_OBJECT
Q_DISABLE_COPY(ScriptServer)
Q_PROPERTY(QScriptValue userContextMenu)
Q_PROPERTY(QScriptValue channelContextMenu)
Q_PROPERTY(QScriptValue msgHandler)
Q_PROPERTY(QScriptValue root READ getRoot)
public:
ScriptServer(QObject *p);
QScriptValue getRoot() const;
public slots:
QScriptValue loadUi(const QString &);
void sendMsg(const QString &, const QStringList &);
signals:
void newUser(QScriptValue);
void newChannel(QScriptValue);
void connected();
void disconnected(QString reason);
};
class MumbleScript : public QObject {
Q_OBJECT
Q_DISABLE_COPY(MumbleScript)
public:
QScriptEngine *qseEngine;
ScriptServer *ssServer;
QString qsFilename;
QMap<ClientUser *, ScriptUser *> qmUsers;
QMap<Channel *, ScriptChannel *> qmChannels;
QMap<QString, QByteArray> qmResources;
bool bLocal;
MumbleScript(MumbleScripts *p);
~MumbleScript();
void load(const QString &source);
void evaluate(const QString &code);
void addUser(ClientUser *p);
void moveUser(ClientUser *p);
void addChannel(Channel *c);
void moveChannel(Channel *c);
void connected();
public slots:
void userDeleted(QObject *);
void channelDeleted(QObject *);
void errorHandler(const QScriptValue &);
};
class MumbleScripts : public QObject {
friend class MumbleScript;
Q_OBJECT
Q_DISABLE_COPY(MumbleScripts)
protected:
QList<MumbleScript *> qlScripts;
public:
MumbleScripts(QObject *p);
~MumbleScripts();
void createEvaluate(const QString &code);
void addUser(ClientUser *p);
void moveUser(ClientUser *p);
void addChannel(Channel *c);
void moveChannel(Channel *c);
void connected();
};
#endif
|
#ifndef INTERPOLATION_H
#define INTERPOLATION_H
#ifndef USE_MINLIN
#include "interpolation_legacy.h"
#else
#include <cuda_runtime.h>
#include <cusparse.h>
#include <util/coordinators.h>
#include <util/mklallocator.h>
#include <mkl_spblas.h>
#include <mkl_service.h>
#include <algorithm>
namespace util{
enum sparse_file_format {file_format_matlab};
// Interpolation matrix. In the most general sense this type is used
// for weighted linear maps from one vector to another.
// It is templated on a coordinator that specifies
// whether the matrix is stored on host or device memory.
//
// Initialised with index and weight vectors defined on the host memory
// If a GPU coordinator is specified, then a CUSP-based sparse matrix
// is allocated on device/GPU memory and used for interpolation
//template <typename TVec, typename TIndexVec, typename Coord>
template <typename Coord>
class InterpolationMatrix{
typedef typename lin::rebind<Coord,int>::type CoordType;
typedef typename lin::rebind<Coord,double>::type CoordWeights;
typedef typename lin::rebind<Coord,int>::type CoordIndex;
typedef typename lin::Vector<double,CoordWeights> TVec;
typedef typename lin::Vector<int,CoordIndex> TIndexVec;
typedef typename lin::Vector<double,lin::DefaultCoordinator<double> > TVecHost;
typedef typename lin::Vector<int,lin::DefaultCoordinator<int> > TIndexVecHost;
public:
InterpolationMatrix(){};
InterpolationMatrix( TIndexVecHost& ia, TIndexVecHost& ja, TVecHost& v ):
ia_(ia), ja_(ja), v_(v)
{
n_rows_ = ia_.size() - 1;
nnz_ = ja_.size();
n_cols_ = *(std::max_element(ja.begin(),ja.end())) + 1;
// GPU : use CUSPARSE
if( CoordTraits<CoordType>::is_device() ){
assert( cusparseCreate(&handle_) == CUSPARSE_STATUS_SUCCESS );
status_ = cusparseCreateMatDescr(&descra_);
assert( status_==CUSPARSE_STATUS_SUCCESS );
cusparseSetMatType(descra_, CUSPARSE_MATRIX_TYPE_GENERAL);
cusparseSetMatIndexBase(descra_, CUSPARSE_INDEX_BASE_ZERO);
}
}
// initialise a matrix that refers to nonzeros stored externally
InterpolationMatrix( TIndexVecHost& ia, TIndexVecHost& ja, double *v ):
ia_(ia), ja_(ja)
{
n_rows_ = ia_.size() - 1;
nnz_ = ja_.size();
v = TVecDevice(v, nnz_);
n_cols_ = *(std::max_element(ja.begin(),ja.end())) + 1;
// GPU : use CUSPARSE
if( CoordTraits<CoordType>::is_device() ){
assert( cusparseCreate(&handle_) == CUSPARSE_STATUS_SUCCESS );
status_ = cusparseCreateMatDescr(&descra_);
assert( status_==CUSPARSE_STATUS_SUCCESS );
cusparseSetMatType(descra_, CUSPARSE_MATRIX_TYPE_GENERAL);
cusparseSetMatIndexBase(descra_, CUSPARSE_INDEX_BASE_ZERO);
}
}
int rows() const{
return n_rows_;
}
int cols() const{
return n_cols_;
}
int nonzeros() const{
return nnz_;
}
void matvec( const TVec& x, TVec& y ){
double *x_ptr = const_cast<double*>(x.data());
double *y_ptr = const_cast<double*>(y.data());
int *row_ptr = const_cast<int*>(ia_.data());
int *col_ptr = const_cast<int*>(ja_.data());
double *v_ptr = const_cast<double*>(v_.data());
assert(x.dim()>=n_cols_);
assert(y.dim()==n_rows_);
// GPU : use CUSPARSE
if( CoordTraits<CoordType>::is_device() ){
status_ = cusparseDcsrmv( handle_, CUSPARSE_OPERATION_NON_TRANSPOSE, n_rows_, n_cols_, 1., descra_,
v_ptr, row_ptr, col_ptr, x_ptr, 0., y_ptr);
assert( status_==CUSPARSE_STATUS_SUCCESS );
}
// CPU : use MKL
else
{
char transa = 'N';
// uses zero-based cspblas version of the MKL function
mkl_cspblas_dcsrgemv(&transa, &n_rows_, v_ptr, row_ptr, col_ptr, x_ptr, y_ptr );
}
}
void matvec( const TVec& x, double* y_ptr ){
double *x_ptr = const_cast<double*>(x.data());
int *row_ptr = const_cast<int*>(ia_.data());
int *col_ptr = const_cast<int*>(ja_.data());
double *v_ptr = const_cast<double*>(v_.data());
assert(x.dim()>=n_cols_);
assert(y_ptr!=0);
// GPU : use CUSPARSE
if( CoordTraits<CoordType>::is_device() ){
status_ = cusparseDcsrmv( handle_, CUSPARSE_OPERATION_NON_TRANSPOSE, n_rows_, n_cols_, 1., descra_,
v_ptr, row_ptr, col_ptr, x_ptr, 0., y_ptr);
assert( status_==CUSPARSE_STATUS_SUCCESS );
}
// CPU : use MKL
else
{
char transa = 'N';
// uses zero-based cspblas version of the MKL function
mkl_cspblas_dcsrgemv(&transa, &n_rows_, v_ptr, row_ptr, col_ptr, x_ptr, y_ptr );
}
}
void write_to_file(std::string fname, sparse_file_format format){
std::ofstream fid;
fid.open(fname.c_str());
switch(format){
case file_format_matlab:
fid << "ijv = [ ";
for(int row=0; row<ia_.dim()-1; row++)
for(int j=ia_[row]; j<ia_[row+1]; j++)
fid << row+1 << " " << ja_[j]+1 << " " << v_[j] << ";";
fid << "];" << std::endl;
fid << "A = sparse(ijv(:,1), ijv(:,2), ijv(:,3));" << std::endl;
break;
}
fid.close();
}
const TIndexVec& row_ptrs(){
return ia_;
}
const TIndexVec& col_indexes(){
return ja_;
}
// set new nonzero values
void set_nonzeros(const TVec &x){
assert(x.size()==v_.size());
v_.at(lin::all) = x;
}
private:
TIndexVec ia_;
TIndexVec ja_;
TVec v_;
// for the sparse cuda calls
cusparseStatus_t status_;
cusparseHandle_t handle_;
cusparseMatDescr_t descra_;
// interpolation dimensions
int n_cols_;
int n_rows_;
int nnz_;
};
}
#endif
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef Response_h
#define Response_h
#include "bindings/core/v8/Dictionary.h"
#include "bindings/core/v8/ScriptWrappable.h"
#include "bindings/modules/v8/UnionTypesModules.h"
#include "modules/ModulesExport.h"
#include "modules/fetch/Body.h"
#include "modules/fetch/BodyStreamBuffer.h"
#include "modules/fetch/FetchResponseData.h"
#include "modules/fetch/Headers.h"
#include "platform/blob/BlobData.h"
#include "platform/heap/Handle.h"
namespace blink {
class Blob;
class DOMArrayBuffer;
class ExceptionState;
class ResponseInit;
class WebServiceWorkerResponse;
typedef BlobOrArrayBufferOrArrayBufferViewOrFormDataOrUSVString BodyInit;
class MODULES_EXPORT Response final : public Body {
DEFINE_WRAPPERTYPEINFO();
WTF_MAKE_NONCOPYABLE(Response);
public:
~Response() override { }
// From Response.idl:
static Response* create(ExecutionContext*, ExceptionState&);
static Response* create(ExecutionContext*, const BodyInit&, const Dictionary&, ExceptionState&);
static Response* create(ExecutionContext*, Blob*, const ResponseInit&, ExceptionState&);
static Response* create(ExecutionContext*, FetchResponseData*);
static Response* create(ExecutionContext*, const WebServiceWorkerResponse&);
static Response* createClone(const Response&);
static Response* error(ExecutionContext*);
static Response* redirect(ExecutionContext*, const String& url, unsigned short status, ExceptionState&);
const FetchResponseData* response() const { return m_response; }
// From Response.idl:
String type() const;
String url() const;
unsigned short status() const;
bool ok() const;
String statusText() const;
Headers* headers() const;
// From Response.idl:
Response* clone(ExceptionState&);
// ActiveDOMObject
bool hasPendingActivity() const override;
// Does not call response.setBlobDataHandle().
void populateWebServiceWorkerResponse(WebServiceWorkerResponse& /* response */);
bool hasBody() const;
BodyStreamBuffer* bodyBuffer() override { return m_response->buffer(); }
const BodyStreamBuffer* bodyBuffer() const override { return m_response->buffer(); }
BodyStreamBuffer* internalBodyBuffer() { return m_response->internalBuffer(); }
const BodyStreamBuffer* internalBodyBuffer() const { return m_response->internalBuffer(); }
bool bodyUsed() override;
String mimeType() const override;
String internalMIMEType() const;
DECLARE_VIRTUAL_TRACE();
private:
explicit Response(ExecutionContext*);
Response(ExecutionContext*, FetchResponseData*);
Response(ExecutionContext*, FetchResponseData*, Headers*);
const Member<FetchResponseData> m_response;
const Member<Headers> m_headers;
};
} // namespace blink
#endif // Response_h
|
/**
* \file
*/
#ifndef RF_ELLIPSEPROPERTIES_H
#define RF_ELLIPSEPROPERTIES_H
#include "Workspace/DataExecution/Operations/operation.h"
#include "Workspace/DataExecution/Operations/operationfactorytraits.h"
#include "volcanoplugin.h"
namespace RF
{
class EllipsePropertiesImpl;
/**
* \brief Put a one-line description of your operation here
*
* Add a more detailed description of your operation here
* or remove these lines if the brief description above
* is sufficient.
*/
class RF_API EllipseProperties : public CSIRO::DataExecution::Operation
{
// Allow string translation to work properly
Q_DECLARE_TR_FUNCTIONS(RF::EllipseProperties)
EllipsePropertiesImpl* pImpl_;
// Prevent copy and assignment - these should not be implemented
EllipseProperties(const EllipseProperties&);
EllipseProperties& operator=(const EllipseProperties&);
protected:
virtual bool execute();
public:
EllipseProperties();
virtual ~EllipseProperties();
};
}
DECLARE_WORKSPACE_OPERATION_FACTORY(RF::EllipseProperties, RF_API)
#endif
|
// Copyright 2019 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 SERVICES_NETWORK_PUBLIC_CPP_ISOLATION_OPT_IN_HINTS_H_
#define SERVICES_NETWORK_PUBLIC_CPP_ISOLATION_OPT_IN_HINTS_H_
#include <string>
#include "base/component_export.h"
namespace network {
// The following definitions correspond to the draft spec found here:
// https://github.com/domenic/origin-isolation#proposed-hints.
enum class IsolationOptInHints : unsigned {
NO_HINTS = 0x0,
PREFER_ISOLATED_EVENT_LOOP = 0x1,
PREFER_ISOLATED_MEMORY = 0x2,
FOR_SIDE_CHANNEL_PROTECTION = 0x4,
FOR_MEMORY_ISOLATION = 0x8,
ALL_HINTS_ACTIVE = 0xF
};
// Converts hint strings into their corresponding IsolationOptInHints values.
// The hint strings are specified at
// https://github.com/domenic/origin-isolation#proposed-hints.
COMPONENT_EXPORT(NETWORK_CPP_BASE)
IsolationOptInHints GetIsolationOptInHintFromString(
const std::string& hint_str);
COMPONENT_EXPORT(NETWORK_CPP_BASE)
IsolationOptInHints& operator|=(IsolationOptInHints& lhs,
IsolationOptInHints& rhs);
COMPONENT_EXPORT(NETWORK_CPP_BASE)
IsolationOptInHints& operator&(IsolationOptInHints& lhs,
IsolationOptInHints& rhs);
} // namespace network
#endif // SERVICES_NETWORK_PUBLIC_CPP_ISOLATION_OPT_IN_HINTS_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63a.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-63a.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: listen_socket Read data using a listen socket (server side)
* GoodSource: Fixed string
* Sinks: w32_spawnv
* BadSink : execute command with wspawnv
* Flow Variant: 63 Data flow: pointer to data passed from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT L"cmd.exe"
#define COMMAND_ARG1 L"/c"
#define COMMAND_ARG2 L"dir "
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH L"/bin/sh"
#define COMMAND_INT L"sh"
#define COMMAND_ARG1 L"-c"
#define COMMAND_ARG2 L"ls "
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
#include <process.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63b_badSink(wchar_t * * dataPtr);
void CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63_bad()
{
wchar_t * data;
wchar_t dataBuffer[100] = COMMAND_ARG2;
data = dataBuffer;
{
#ifdef _WIN32
WSADATA wsaData;
int wsaDataInit = 0;
#endif
int recvResult;
struct sockaddr_in service;
wchar_t *replace;
SOCKET listenSocket = INVALID_SOCKET;
SOCKET acceptSocket = INVALID_SOCKET;
size_t dataLen = wcslen(data);
do
{
#ifdef _WIN32
if (WSAStartup(MAKEWORD(2,2), &wsaData) != NO_ERROR)
{
break;
}
wsaDataInit = 1;
#endif
/* POTENTIAL FLAW: Read data using a listen socket */
listenSocket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (listenSocket == INVALID_SOCKET)
{
break;
}
memset(&service, 0, sizeof(service));
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(TCP_PORT);
if (bind(listenSocket, (struct sockaddr*)&service, sizeof(service)) == SOCKET_ERROR)
{
break;
}
if (listen(listenSocket, LISTEN_BACKLOG) == SOCKET_ERROR)
{
break;
}
acceptSocket = accept(listenSocket, NULL, NULL);
if (acceptSocket == SOCKET_ERROR)
{
break;
}
/* Abort on error or the connection was closed */
recvResult = recv(acceptSocket, (char *)(data + dataLen), sizeof(wchar_t) * (100 - dataLen - 1), 0);
if (recvResult == SOCKET_ERROR || recvResult == 0)
{
break;
}
/* Append null terminator */
data[dataLen + recvResult / sizeof(wchar_t)] = L'\0';
/* Eliminate CRLF */
replace = wcschr(data, L'\r');
if (replace)
{
*replace = L'\0';
}
replace = wcschr(data, L'\n');
if (replace)
{
*replace = L'\0';
}
}
while (0);
if (listenSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(listenSocket);
}
if (acceptSocket != INVALID_SOCKET)
{
CLOSE_SOCKET(acceptSocket);
}
#ifdef _WIN32
if (wsaDataInit)
{
WSACleanup();
}
#endif
}
CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63b_badSink(&data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63b_goodG2BSink(wchar_t * * data);
static void goodG2B()
{
wchar_t * data;
wchar_t dataBuffer[100] = COMMAND_ARG2;
data = dataBuffer;
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63b_goodG2BSink(&data);
}
void CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63_good()
{
goodG2B();
}
#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()...");
CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_listen_socket_w32_spawnv_63_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* $OpenBSD: if_fereg.h,v 1.2 1997/11/07 08:06:55 niklas Exp $ */
/*
* All Rights Reserved, Copyright (C) Fujitsu Limited 1995
*
* This software may be used, modified, copied, distributed, and sold,
* in both source and binary form provided that the above copyright,
* these terms and the following disclaimer are retained. The name of
* the author and/or the contributor may not be used to endorse or
* promote products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND THE CONTRIBUTOR ``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 THE CONTRIBUTOR 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.
*/
#define FE_REG_VERSION "if_fereg.h ver. 0.8"
/*
* Hardware specification of various 86960/86965 based Ethernet cards.
* Contributed by M.S. <seki@sysrap.cs.fujitsu.co.jp>
*/
/*
* Registers on FMV-180 series' ISA bus interface ASIC.
* I'm not sure the following register names are appropriate.
* Doesn't it look silly, eh? FIXME.
*/
#define FE_FMV0 16 /* Hardware status. */
#define FE_FMV1 17 /* Hardrare type? Always 0 */
#define FE_FMV2 18 /* Hardware configuration. */
#define FE_FMV3 19 /* Hardware enable. */
#define FE_FMV4 20 /* Station address #1 */
#define FE_FMV5 21 /* Station address #2 */
#define FE_FMV6 22 /* Station address #3 */
#define FE_FMV7 23 /* Station address #4 */
#define FE_FMV8 24 /* Station address #5 */
#define FE_FMV9 25 /* Station address #6 */
#define FE_FMV10 26 /* Unknown; to be set to 0. */
/*
* FMV-180 series' ASIC register values.
*/
/* Magic value in FMV0 register. */
#define FE_FMV0_MAGIC_MASK 0x78
#define FE_FMV0_MAGIC_VALUE 0x50
/* Model identification. */
#define FE_FMV0_MODEL 0x07
#define FE_FMV0_MODEL_FMV181 0x05
#define FE_FMV0_MODEL_FMV182 0x03
/* Card type ID? Always 0? */
#define FE_FMV1_CARDID_MASK 0xFF
#define FE_FMV1_CARDID_ID 0x00
/* I/O port address assignment. */
#define FE_FMV2_ADDR 0x07
#define FE_FMV2_ADDR_SHIFT 0
/* Boot ROM address assignment. */
#define FE_FMV2_ROM 0x38
#define FE_FMV2_ROM_SHIFT 3
/* IRQ assignment. */
#define FE_FMV2_IRQ 0xC0
#define FE_FMV2_IRQ_SHIFT 6
/* Hardware(?) enable flag. */
#define FE_FMV3_ENABLE_FLAG 0x80
/* Extra bits in FMV3 register. Always 0? */
#define FE_FMV3_EXTRA_MASK 0x7F
#define FE_FMV3_EXTRA_VALUE 0x00
/*
* EEPROM allocation of AT1700/RE2000.
*/
#define FE_ATI_EEP_ADDR 0x08 /* Station address. (8-13) */
#define FE_ATI_EEP_MEDIA 0x18 /* Media type. */
#define FE_ATI_EEP_MAGIC 0x19 /* XXX Magic. */
#define FE_ATI_EEP_MODEL 0x1e /* Hardware type. */
#define FE_ATI_EEP_REVISION 0x1f /* Hardware revision. */
#define FE_ATI_MODEL_AT1700T 0x00
#define FE_ATI_MODEL_AT1700BT 0x01
#define FE_ATI_MODEL_AT1700FT 0x02
#define FE_ATI_MODEL_AT1700AT 0x03
/*
* Registers on MBH10302.
*/
#define FE_MBH0 0x10 /* ??? Including interrupt. */
#define FE_MBH1 0x11 /* ??? */
#define FE_MBH10 0x1A /* Station address. (10 - 15) */
/* Values to be set in MBH0 register. */
#define FE_MBH0_MAGIC 0x0D /* Just a magic constant? */
#define FE_MBH0_INTR 0x10 /* Master interrupt control. */
#define FE_MBH0_INTR_ENABLE 0x10 /* Enable interrupts. */
#define FE_MBH0_INTR_DISABLE 0x00 /* Disable interrupts. */
|
/* zpoequb.f -- translated by f2c (version 20061008).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
#include "blaswrap.h"
/* Subroutine */ int zpoequb_(integer *n, doublecomplex *a, integer *lda,
doublereal *s, doublereal *scond, doublereal *amax, integer *info)
{
/* System generated locals */
integer a_dim1, a_offset, i__1, i__2, i__3;
doublereal d__1, d__2;
/* Local variables */
integer i__;
doublereal tmp, base, smin;
/* -- LAPACK routine (version 3.2) -- */
/* -- Contributed by James Demmel, Deaglan Halligan, Yozo Hida and -- */
/* -- Jason Riedy of Univ. of California Berkeley. -- */
/* -- November 2008 -- */
/* -- LAPACK is a software package provided by Univ. of Tennessee, -- */
/* -- Univ. of California Berkeley and NAG Ltd. -- */
/* Purpose */
/* ======= */
/* ZPOEQUB computes row and column scalings intended to equilibrate a */
/* symmetric positive definite matrix A and reduce its condition number */
/* (with respect to the two-norm). S contains the scale factors, */
/* S(i) = 1/sqrt(A(i,i)), chosen so that the scaled matrix B with */
/* elements B(i,j) = S(i)*A(i,j)*S(j) has ones on the diagonal. This */
/* choice of S puts the condition number of B within a factor N of the */
/* smallest possible condition number over all possible diagonal */
/* scalings. */
/* Arguments */
/* ========= */
/* N (input) INTEGER */
/* The order of the matrix A. N >= 0. */
/* A (input) COMPLEX*16 array, dimension (LDA,N) */
/* The N-by-N symmetric positive definite matrix whose scaling */
/* factors are to be computed. Only the diagonal elements of A */
/* are referenced. */
/* LDA (input) INTEGER */
/* The leading dimension of the array A. LDA >= max(1,N). */
/* S (output) DOUBLE PRECISION array, dimension (N) */
/* If INFO = 0, S contains the scale factors for A. */
/* SCOND (output) DOUBLE PRECISION */
/* If INFO = 0, S contains the ratio of the smallest S(i) to */
/* the largest S(i). If SCOND >= 0.1 and AMAX is neither too */
/* large nor too small, it is not worth scaling by S. */
/* AMAX (output) DOUBLE PRECISION */
/* Absolute value of largest matrix element. If AMAX is very */
/* close to overflow or very close to underflow, the matrix */
/* should be scaled. */
/* INFO (output) INTEGER */
/* = 0: successful exit */
/* < 0: if INFO = -i, the i-th argument had an illegal value */
/* > 0: if INFO = i, the i-th diagonal element is nonpositive. */
/* ===================================================================== */
/* Test the input parameters. */
/* Positive definite only performs 1 pass of equilibration. */
/* Parameter adjustments */
a_dim1 = *lda;
a_offset = 1 + a_dim1;
a -= a_offset;
--s;
/* Function Body */
*info = 0;
if (*n < 0) {
*info = -1;
} else if (*lda < max(1,*n)) {
*info = -3;
}
if (*info != 0) {
i__1 = -(*info);
xerbla_("ZPOEQUB", &i__1);
return 0;
}
/* Quick return if possible. */
if (*n == 0) {
*scond = 1.;
*amax = 0.;
return 0;
}
base = dlamch_("B");
tmp = -.5 / log(base);
/* Find the minimum and maximum diagonal elements. */
i__1 = a_dim1 + 1;
s[1] = a[i__1].r;
smin = s[1];
*amax = s[1];
i__1 = *n;
for (i__ = 2; i__ <= i__1; ++i__) {
i__2 = i__;
i__3 = i__ + i__ * a_dim1;
s[i__2] = a[i__3].r;
/* Computing MIN */
d__1 = smin, d__2 = s[i__];
smin = min(d__1,d__2);
/* Computing MAX */
d__1 = *amax, d__2 = s[i__];
*amax = max(d__1,d__2);
}
if (smin <= 0.) {
/* Find the first non-positive diagonal element and return. */
i__1 = *n;
for (i__ = 1; i__ <= i__1; ++i__) {
if (s[i__] <= 0.) {
*info = i__;
return 0;
}
}
} else {
/* Set the scale factors to the reciprocals */
/* of the diagonal elements. */
i__1 = *n;
for (i__ = 1; i__ <= i__1; ++i__) {
i__2 = (integer) (tmp * log(s[i__]));
s[i__] = pow_di(&base, &i__2);
}
/* Compute SCOND = min(S(I)) / max(S(I)). */
*scond = sqrt(smin) / sqrt(*amax);
}
return 0;
/* End of ZPOEQUB */
} /* zpoequb_ */
|
/*
* Software License Agreement (BSD License)
*
* Copyright (c) 2011-2014, Willow Garage, Inc.
* Copyright (c) 2014-2015, Open Source Robotics Foundation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Open Source Robotics Foundation nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE 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.
*/
/** \author Dalibor Matura, Jia Pan */
#ifndef FCL_ARTICULATED_MODEL_MODEL_H
#define FCL_ARTICULATED_MODEL_MODEL_H
#include "fcl/articulated_model/joint.h"
#include "fcl/articulated_model/link.h"
#include "fcl/data_types.h"
#include <memory>
#include <map>
#include <stdexcept>
namespace fcl
{
class ModelParseError : public std::runtime_error
{
public:
ModelParseError(const std::string& error_msg) : std::runtime_error(error_msg) {}
};
class Model
{
public:
Model() {}
virtual ~Model() {}
const std::string& getName() const;
void addLink(const std::shared_ptr<Link>& link);
void addJoint(const std::shared_ptr<Joint>& joint);
void initRoot(const std::map<std::string, std::string>& link_parent_tree);
void initTree(std::map<std::string, std::string>& link_parent_tree);
std::size_t getNumDofs() const;
std::size_t getNumLinks() const;
std::size_t getNumJoints() const;
std::shared_ptr<Link> getRoot() const;
std::shared_ptr<Link> getLink(const std::string& name) const;
std::shared_ptr<Joint> getJoint(const std::string& name) const;
std::vector<std::shared_ptr<Link> > getLinks() const;
std::vector<std::shared_ptr<Joint> > getJoints() const;
protected:
std::shared_ptr<Link> root_link_;
std::map<std::string, std::shared_ptr<Link> > links_;
std::map<std::string, std::shared_ptr<Joint> > joints_;
std::string name_;
};
}
#endif
|
#include <node_api.h>
#include "../common.h"
static double value_ = 1;
static double static_value_ = 10;
napi_ref constructor_;
napi_value GetValue(napi_env env, napi_callback_info info) {
size_t argc = 0;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, NULL, NULL, NULL));
NAPI_ASSERT(env, argc == 0, "Wrong number of arguments");
napi_value number;
NAPI_CALL(env, napi_create_number(env, value_, &number));
return number;
}
napi_value SetValue(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value args[1];
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
NAPI_ASSERT(env, argc == 1, "Wrong number of arguments");
NAPI_CALL(env, napi_get_value_double(env, args[0], &value_));
return NULL;
}
napi_value Echo(napi_env env, napi_callback_info info) {
size_t argc = 1;
napi_value args[1];
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, args, NULL, NULL));
NAPI_ASSERT(env, argc == 1, "Wrong number of arguments");
return args[0];
}
napi_value New(napi_env env, napi_callback_info info) {
napi_value _this;
NAPI_CALL(env, napi_get_cb_info(env, info, NULL, NULL, &_this, NULL));
return _this;
}
napi_value GetStaticValue(napi_env env, napi_callback_info info) {
size_t argc = 0;
NAPI_CALL(env, napi_get_cb_info(env, info, &argc, NULL, NULL, NULL));
NAPI_ASSERT(env, argc == 0, "Wrong number of arguments");
napi_value number;
NAPI_CALL(env, napi_create_number(env, static_value_, &number));
return number;
}
void Init(napi_env env, napi_value exports, napi_value module, void* priv) {
napi_value number;
NAPI_CALL_RETURN_VOID(env, napi_create_number(env, value_, &number));
napi_property_descriptor properties[] = {
{ "echo", 0, Echo, 0, 0, 0, napi_enumerable, 0 },
{ "readwriteValue", 0, 0, 0, 0, number, napi_enumerable | napi_writable, 0 },
{ "readonlyValue", 0, 0, 0, 0, number, napi_enumerable, 0},
{ "hiddenValue", 0, 0, 0, 0, number, napi_default, 0},
{ "readwriteAccessor1", 0, 0, GetValue, SetValue, 0, napi_default, 0},
{ "readwriteAccessor2", 0, 0, GetValue, SetValue, 0, napi_writable, 0},
{ "readonlyAccessor1", 0, 0, GetValue, NULL, 0, napi_default, 0},
{ "readonlyAccessor2", 0, 0, GetValue, NULL, 0, napi_writable, 0},
{ "staticReadonlyAccessor1", 0, 0, GetStaticValue, NULL, 0,
napi_default | napi_static, 0},
};
napi_value cons;
NAPI_CALL_RETURN_VOID(env, napi_define_class(env, "MyObject", New,
NULL, sizeof(properties)/sizeof(*properties), properties, &cons));
NAPI_CALL_RETURN_VOID(env,
napi_set_named_property(env, module, "exports", cons));
NAPI_CALL_RETURN_VOID(env,
napi_create_reference(env, cons, 1, &constructor_));
}
NAPI_MODULE(addon, Init)
|
/********************************************************************
Copyright (c) 2010-2015, Regents of the University of Colorado
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither the name of the University of Colorado nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
********************************************************************/
#ifndef STRINGTR_H
#define STRINGTR_H
#include "Expr.h"
namespace CNF {
std::string stringTR(Expr::Manager::View* v, std::vector<ID> ids);
std::string stringTR(Expr::Manager::View* v, ID id);
std::string stringOfID(Expr::Manager::View* v, ID id);
std::string stringOfVectorID(Expr::Manager::View* v, const std::vector<ID>& ids);
std::string stringOfVectorVectorID(Expr::Manager::View* v, const std::vector<std::vector<ID> >& ids);
}
#endif
|
#include "info.h"
void
_info_botman_send(Module_Info *info,
Gotham_Citizen *citizen)
{
Eina_Iterator *it;
Eina_Strbuf *buf;
void *data;
Eina_Bool found = EINA_FALSE;
buf = eina_strbuf_new();
it = gotham_citizen_var_iterate(info->gotham->me);
while (eina_iterator_next(it, &data))
{
Eina_Hash_Tuple *t = data;
const char *name = t->key,
*value = t->data;
found = EINA_TRUE;
DBG("Adding %s : %s", name, value);
eina_strbuf_append_printf(buf, "%s : %s\n", name, value);
}
eina_iterator_free(it);
if (!found)
{
eina_strbuf_free(buf);
return;
}
gotham_command_json_answer(".info", "", EINA_TRUE, buf, info->gotham, citizen, EINA_TRUE);
}
Eina_Bool
info_botman_sync(void *data)
{
Module_Info *info = data;
_info_botman_send(info, info->gotham->alfred);
return EINA_TRUE;
}
void
info_botman_command(Module_Info *info,
Gotham_Citizen_Command *command)
{
if ( (command->command[1])
&& (!strcmp(command->command[1], "get"))
&& (command->command[2])
)
{
Eina_Strbuf *buf;
const char *s;
s = gotham_citizen_var_get(info->gotham->me, command->command[2]);
EINA_SAFETY_ON_NULL_GOTO(s, not_found_msg);
buf = eina_strbuf_new();
if (!buf)
goto memory_error;
eina_strbuf_append_printf(buf, "%s : %s\n", command->command[2], s);
if (strcmp(command->citizen->jid, info->gotham->alfred->jid))
gotham_command_send(command, eina_strbuf_string_get(buf));
else
gotham_command_json_answer(".info", "get", EINA_TRUE, buf, info->gotham, command->citizen, EINA_TRUE);
eina_strbuf_free(buf);
}
else if (!command->command[1])
_info_botman_send(info, command->citizen);
return;
not_found_msg:
GOTHAM_IF_SEND_RETURN(strcmp(command->citizen->jid, info->gotham->alfred->jid), command, "Given info variable not found.");
{
Eina_Strbuf *buf;
buf = eina_strbuf_new();
eina_strbuf_append_printf(buf, "Given info variable '%s' was not found.", command->command[1]);
gotham_command_json_answer(".info", "get", EINA_FALSE, buf, info->gotham, command->citizen, EINA_TRUE);
eina_strbuf_free(buf);
}
return;
memory_error:
return;
}
|
/*
This file is part of INDDGO.
Copyright (C) 2012, Oak Ridge National Laboratory
This product includes software produced by UT-Battelle, LLC under Contract No.
DE-AC05-00OR22725 with the Department of Energy.
This program is free software; you can redistribute it and/or modify
it under the terms of the New BSD 3-clause software license (LICENSE).
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
LICENSE for more details.
For more information please contact the INDDGO developers at:
inddgo-info@googlegroups.com
*/
#ifndef PTD_H_
#define PTD_H_
#ifdef __MADNESS__
#define WORLD_INSTANTIATE_STATIC_TEMPLATES
#include <world/world.h>
#include <world/worldobj.h>
#include <world/worlddc.h>
#include <iomanip>
#include "GraphDecomposition.h"
#include "TreeDecomposition.h"
#include "Log.h"
#include "mpi.h"
#include "pthread.h"
using namespace std;
using namespace madness;
using namespace std;
class PTD: public WorldObject<PTD>
{
private:
vector<int> ordering;
vector<int> position;
Graph::VertexWeightedGraph G;
Graph::VertexWeightedGraph H;
int width;
double xtime;
Graph::GraphEOUtil eoutil;
string tmp_filename;
string tree_name;
int s;
int r;
public:
MutexFair tlock;
ofstream fw;
PTD(World& world, Graph::VertexWeightedGraph g);
virtual ~PTD();
int owner(int i);
int get_width() const;
void set_width(int w);
int triangulate();
int size();
int rank();
int compute_elim_order(int order_type, bool t, const char *s);
int parmetis_elim_order(int order_type);
vector<int> *get_elim_order();
void set_elim_order(vector<int> &order);
int write_elim_order(char *filename);
int create_bag(int v, int i, list<string> &ls);
void process_bag();
string get_random_name(char *x);
void set_file_name(string s);
string get_file_name() const;
void set_tree_name (string t);
string get_tree_name() const;
void merge_files(char *x);
void refine_td(string x);
int get_int(char *x);
void create_tree_decomposition(char *filename, TDTree *&T);
};
// TPTD class is used to pass data into threaded environment.
class TPTD {
private:
PTD *p;
int id;
vector<int> range_vector;
public:
TPTD(PTD *p, vector<int> range, int id):
p(p), range_vector(range), id(id)
{};
virtual ~TPTD()
{};
int get_id()
{
return id;
};
vector<int> get_range_vector()
{
return range_vector;
};
PTD* get_ptd()
{
return p;
};
};
#endif
#endif /* PTD_H_ */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__wchar_t_realloc_52a.c
Label Definition File: CWE401_Memory_Leak.c.label.xml
Template File: sources-sinks-52a.tmpl.c
*/
/*
* @description
* CWE: 401 Memory Leak
* BadSource: realloc Allocate data using realloc()
* GoodSource: Allocate data on the stack
* Sinks:
* GoodSink: call free() on data
* BadSink : no deallocation of data
* Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE401_Memory_Leak__wchar_t_realloc_52b_badSink(wchar_t * data);
void CWE401_Memory_Leak__wchar_t_realloc_52_bad()
{
wchar_t * data;
data = NULL;
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (wchar_t *)realloc(data, 100*sizeof(wchar_t));
if (data == NULL) {exit(-1);}
/* Initialize and make use of data */
wcscpy(data, L"A String");
printWLine(data);
CWE401_Memory_Leak__wchar_t_realloc_52b_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE401_Memory_Leak__wchar_t_realloc_52b_goodG2BSink(wchar_t * data);
static void goodG2B()
{
wchar_t * data;
data = NULL;
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (wchar_t *)ALLOCA(100*sizeof(wchar_t));
/* Initialize and make use of data */
wcscpy(data, L"A String");
printWLine(data);
CWE401_Memory_Leak__wchar_t_realloc_52b_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE401_Memory_Leak__wchar_t_realloc_52b_goodB2GSink(wchar_t * data);
static void goodB2G()
{
wchar_t * data;
data = NULL;
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (wchar_t *)realloc(data, 100*sizeof(wchar_t));
if (data == NULL) {exit(-1);}
/* Initialize and make use of data */
wcscpy(data, L"A String");
printWLine(data);
CWE401_Memory_Leak__wchar_t_realloc_52b_goodB2GSink(data);
}
void CWE401_Memory_Leak__wchar_t_realloc_52_good()
{
goodG2B();
goodB2G();
}
#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()...");
CWE401_Memory_Leak__wchar_t_realloc_52_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE401_Memory_Leak__wchar_t_realloc_52_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.