text
stringlengths 4
6.14k
|
|---|
/*--------------------------------------------------------------------
(C) Copyright 2006-2011 Barcelona Supercomputing Center
Centro Nacional de Supercomputacion
This file is part of Mercurium C/C++ source-to-source compiler.
See AUTHORS file in the top level directory for information
regarding developers and contributors.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
Mercurium C/C++ source-to-source compiler is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public
License along with Mercurium C/C++ source-to-source compiler; if
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.
--------------------------------------------------------------------*/
#ifndef LIBMF03_PRESCANNER_COMMON_H
#define LIBMF03_PRESCANNER_COMMON_H
#ifdef WIN32_BUILD
#ifdef LIBMF03_PRESCANNER_DLL_EXPORT
#define LIBMF03_PRESCANNER_EXTERN extern __declspec(dllexport)
#else
#define LIBMF03_PRESCANNER_EXTERN extern __declspec(dllimport)
#endif
#else
#define LIBMF03_PRESCANNER_EXTERN extern
#endif
#endif
|
/*
* globals.h
*
* Created on: Dec 4, 2014
* Author: asseylum
*/
#ifndef SRC_GLOBALS_H_
#define SRC_GLOBALS_H_
#include <vector>
#include "ServerThread.h"
#include "ServerClasses/Group.h"
#include "ServerClasses/User.h"
class Group;
class ServerThread;
extern std::vector<ServerThread*> threadPool;
extern std::vector<Group*> groupList;
extern bool isUserOnline(User user);
extern bool isUserOnline(string user);
#endif /* SRC_GLOBALS_H_ */
|
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <strings.h>
#include <errno.h>
#include <fcntl.h>
#ifndef _DIRECTORY_FSYNC_
#define _DIRECTORY_FSYNC_
/* open a directory for reading and fsync the resultant fd */
int cDirectoryFsync(char *path)
{
int fd = 0;
int ret = 0;
struct stat fdstat = {0};
fd = open(path, O_RDONLY);
if(fd < 0)
{
return errno;
}
/* ensure that opened fd is a directory fd. Otherwise, fsync will fail (on a read-only file descriptor */
ret = fstat(fd,&fdstat);
if(ret < 0)
{
close(fd);
return errno;
}
if(!S_ISDIR(fdstat.st_mode))
{
close(fd);
return ENOTDIR;
}
/* execute the fsync */
#if defined(__APPLE__) && defined(__MACH__) && defined(F_FULLFSYNC)
ret = fcntl(fd, F_FULLFSYNC);
#else
ret = fsync(fd);
#endif
close(fd);
if(ret < 0)
{
return errno;
}
return 0;
}
#endif
|
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__9C9F47D3_224A_4BE5_9ACF_F34E6EC24C9F__INCLUDED_)
#define AFX_STDAFX_H__9C9F47D3_224A_4BE5_9ACF_F34E6EC24C9F__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__9C9F47D3_224A_4BE5_9ACF_F34E6EC24C9F__INCLUDED_)
|
// stdafx.h : WÌVXe CN[h t@CÌCN[h t@CAܽÍ
// QÆñª½A©Â ÜèÏX³êÈ¢AvWFNgêpÌCN[h t@C
// ðLqµÜ·B
//
#pragma once
#include "targetver.h"
// CppUnitTest Ìwb_[
#include "CppUnitTest.h"
// TODO: vOÉKvÈÇÁwb_[ð±±ÅQƵľ³¢
#include <wchar.h>
// boost
#include <boost/fusion/tuple.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/phoenix.hpp>
template <typename P, typename S> bool test_parser2(std::string input, P const& p, S const& s, bool full_match = true) {
using boost::spirit::qi::phrase_parse;
std::string::iterator it = input.begin();
std::string::iterator end = input.end();
if (phrase_parse(it, input.end(), p, s) && (!full_match || (it == end))) {
std::cout << "ok" << std::endl;
return true;
} else {
std::cout << "fail" << std::endl;
return false;
}
}
|
#include<stdio.h>
main()
{
abc(((200,100),(300,400)));
}
abc(int i)
{
printf("\n%d",i);
}
|
/*
* File: chs_debug.h
* Author: oscar
*
* Created on March 16, 2014, 12:32 AM
*/
#ifndef CHS_DEBUG_H
#define CHS_DEBUG_H
#include <stdio.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Flag set by ‘--verbose’. */
int verbose_flag;
void verbose(const char * format, ...);
#ifdef __cplusplus
}
#endif
#endif /* CHS_DEBUG_H */
|
void progress_bar(int percent) {
std::string bar;
for(int i = 0; i < 50; ++i) {
if(i < (percent / 2))
bar.replace(i, 1, "=");
else if(i == (percent / 2))
bar.replace(i, 1, ">");
else
bar.replace(i, 1, " ");
}
std::cout << "\r" "[" << bar << "] ";
std::cout.width(3);
std::cout << percent << "% " << std::flush;
}
|
//
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "NSURLSession+Deserlizer.h"
#import "JSONDeserlizer.h"
#import "APIEndpoints.h"
#import "Sector.h"
#import "Brochure.h"
|
#ifndef C_ELM_GRID_H
#define C_ELM_GRID_H
#include "elm.h"
#include "CElmObject.h"
namespace elm {
using namespace v8;
class CElmGrid : public CElmObject {
private:
static Persistent<FunctionTemplate> tmpl;
protected:
CElmGrid(Local<Object> _jsObject, CElmObject *parent);
static Handle<FunctionTemplate> GetTemplate();
public:
static void Initialize(Handle<Object> target);
virtual Handle<Value> Pack(Handle<Value>, Handle<Value>);
virtual Handle<Value> Unpack(Handle<Value>);
void size_set(Handle<Value> val);
Handle<Value> size_get() const;
friend Handle<Value> CElmObject::New<CElmGrid>(const Arguments& args);
};
}
#endif
|
#include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
#ifndef PERSONAL
#define PERSONAL
class Personal {
public:
Personal();
Personal(char*,char*,char*,int,long);
void writeToFile(fstream&) const;
void readFromFile(fstream&);
void readKey();
int size() const {
return 9 + nameLen + cityLen + sizeof(year) + sizeof(salary);
}
bool operator==(const Personal& pr) const {
return strncmp(pr.SSN,SSN,9) == 0;
}
protected:
const int nameLen, cityLen;
char SSN[10], *name, *city;
int year;
long salary;
ostream& writeLegibly(ostream&);
friend ostream& operator<<(ostream& out, Personal& pr) {
return pr.writeLegibly(out);
}
istream& readFromConsole(istream&);
friend istream& operator>>(istream& in, Personal& pr) {
return pr.readFromConsole(in);
}
};
#endif
|
#include <errno.h>
extern void _abort(int);
void abort() {
_abort(errno);
}
|
/*
Copyright 2017 Vector Creations 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.
*/
#import "SegmentedViewController.h"
@interface GroupDetailsViewController : SegmentedViewController
@property (strong, readonly, nonatomic) MXGroup *group;
@property (strong, readonly, nonatomic) MXSession *mxSession;
/**
Returns the `UINib` object initialized for a `GroupDetailsViewController`.
@return The initialized `UINib` object or `nil` if there were errors during initialization
or the nib file could not be located.
*/
+ (UINib *)nib;
/**
Creates and returns a new `GroupDetailsViewController` object.
@discussion This is the designated initializer for programmatic instantiation.
@return An initialized `GroupDetailsViewController` object if successful, `nil` otherwise.
*/
+ (instancetype)groupDetailsViewController;
/**
Set the group for which the details are displayed.
Provide the related matrix session.
@param group
@param mxSession
*/
- (void)setGroup:(MXGroup*)group withMatrixSession:(MXSession*)mxSession;
@end
|
/*
* 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/lightsail/Lightsail_EXPORTS.h>
#include <aws/lightsail/LightsailRequest.h>
#include <aws/lightsail/model/PortInfo.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>
namespace Aws
{
namespace Lightsail
{
namespace Model
{
/**
*/
class AWS_LIGHTSAIL_API CloseInstancePublicPortsRequest : public LightsailRequest
{
public:
CloseInstancePublicPortsRequest();
// Service request name is the Operation name which will send this request out,
// each operation should has unique request name, so that we can get operation's name from this request.
// Note: this is not true for response, multiple operations may have the same response name,
// so we can not get operation's name from response.
inline virtual const char* GetServiceRequestName() const override { return "CloseInstancePublicPorts"; }
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>Information about the public port you are trying to close.</p>
*/
inline const PortInfo& GetPortInfo() const{ return m_portInfo; }
/**
* <p>Information about the public port you are trying to close.</p>
*/
inline bool PortInfoHasBeenSet() const { return m_portInfoHasBeenSet; }
/**
* <p>Information about the public port you are trying to close.</p>
*/
inline void SetPortInfo(const PortInfo& value) { m_portInfoHasBeenSet = true; m_portInfo = value; }
/**
* <p>Information about the public port you are trying to close.</p>
*/
inline void SetPortInfo(PortInfo&& value) { m_portInfoHasBeenSet = true; m_portInfo = std::move(value); }
/**
* <p>Information about the public port you are trying to close.</p>
*/
inline CloseInstancePublicPortsRequest& WithPortInfo(const PortInfo& value) { SetPortInfo(value); return *this;}
/**
* <p>Information about the public port you are trying to close.</p>
*/
inline CloseInstancePublicPortsRequest& WithPortInfo(PortInfo&& value) { SetPortInfo(std::move(value)); return *this;}
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline const Aws::String& GetInstanceName() const{ return m_instanceName; }
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline bool InstanceNameHasBeenSet() const { return m_instanceNameHasBeenSet; }
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline void SetInstanceName(const Aws::String& value) { m_instanceNameHasBeenSet = true; m_instanceName = value; }
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline void SetInstanceName(Aws::String&& value) { m_instanceNameHasBeenSet = true; m_instanceName = std::move(value); }
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline void SetInstanceName(const char* value) { m_instanceNameHasBeenSet = true; m_instanceName.assign(value); }
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline CloseInstancePublicPortsRequest& WithInstanceName(const Aws::String& value) { SetInstanceName(value); return *this;}
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline CloseInstancePublicPortsRequest& WithInstanceName(Aws::String&& value) { SetInstanceName(std::move(value)); return *this;}
/**
* <p>The name of the instance on which you're attempting to close the public
* ports.</p>
*/
inline CloseInstancePublicPortsRequest& WithInstanceName(const char* value) { SetInstanceName(value); return *this;}
private:
PortInfo m_portInfo;
bool m_portInfoHasBeenSet;
Aws::String m_instanceName;
bool m_instanceNameHasBeenSet;
};
} // namespace Model
} // namespace Lightsail
} // namespace Aws
|
/*
* Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/securityhub/SecurityHub_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/securityhub/model/Result.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Json
{
class JsonValue;
} // namespace Json
} // namespace Utils
namespace SecurityHub
{
namespace Model
{
class AWS_SECURITYHUB_API DeleteMembersResult
{
public:
DeleteMembersResult();
DeleteMembersResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
DeleteMembersResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline const Aws::Vector<Result>& GetUnprocessedAccounts() const{ return m_unprocessedAccounts; }
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline void SetUnprocessedAccounts(const Aws::Vector<Result>& value) { m_unprocessedAccounts = value; }
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline void SetUnprocessedAccounts(Aws::Vector<Result>&& value) { m_unprocessedAccounts = std::move(value); }
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline DeleteMembersResult& WithUnprocessedAccounts(const Aws::Vector<Result>& value) { SetUnprocessedAccounts(value); return *this;}
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline DeleteMembersResult& WithUnprocessedAccounts(Aws::Vector<Result>&& value) { SetUnprocessedAccounts(std::move(value)); return *this;}
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline DeleteMembersResult& AddUnprocessedAccounts(const Result& value) { m_unprocessedAccounts.push_back(value); return *this; }
/**
* <p>The list of AWS accounts that were not deleted. For each account, the list
* includes the account ID and the email address.</p>
*/
inline DeleteMembersResult& AddUnprocessedAccounts(Result&& value) { m_unprocessedAccounts.push_back(std::move(value)); return *this; }
private:
Aws::Vector<Result> m_unprocessedAccounts;
};
} // namespace Model
} // namespace SecurityHub
} // namespace Aws
|
// Switches class
class Switches {
public:
Switches();
int compression_method; //compression method to use (default: none)
unsigned int compression_otf_max_memory; // max. memory for LZMA compression method (default: 2 GiB)
unsigned int compression_otf_thread_count; // max. thread count for LZMA compression method (default: auto-detect)
//byte positions to ignore (default: none)
long long* ignore_list;
int ignore_list_len;
bool intense_mode; //intense mode (default: off)
bool fast_mode; //fast mode (default: off)
bool brute_mode; //brute mode (default: off)
bool pdf_bmp_mode; //wrap BMP header around PDF images
// (default: off)
bool prog_only; //recompress progressive JPGs only
// (default: off)
bool use_mjpeg; //insert huffman table for MJPEG recompression
// (default: on)
bool use_brunsli; //use brunsli for JPG compression
// (default: on)
bool use_brotli; //use brotli for JPG metadata when brunsli is used
// (default: off)
bool use_packjpg_fallback; //use packJPG for JPG compression (fallback when brunsli fails)
// (default: on)
bool debug_mode; //debug mode (default: off)
unsigned int min_ident_size; //minimal identical bytes (default: 4)
//(p)recompression types to use (default: all)
bool use_pdf;
bool use_zip;
bool use_gzip;
bool use_png;
bool use_gif;
bool use_jpg;
bool use_mp3;
bool use_swf;
bool use_base64;
bool use_bzip2;
bool level_switch; //level switch used? (default: no)
bool use_zlib_level[81]; //compression levels to use (default: all)
};
//Switches constructor
Switches::Switches() {
compression_method = 2;
compression_otf_max_memory = 2048;
compression_otf_thread_count = std::thread::hardware_concurrency();
if (compression_otf_thread_count == 0) {
compression_otf_thread_count = 2;
}
ignore_list = NULL;
ignore_list_len = 0;
intense_mode = false;
fast_mode = false;
brute_mode = false;
pdf_bmp_mode = false;
prog_only = false;
use_mjpeg = true;
use_brunsli = true;
use_brotli = false;
use_packjpg_fallback = true;
debug_mode = false;
min_ident_size = 4;
use_pdf = true;
use_zip = true;
use_gzip = true;
use_png = true;
use_gif = true;
use_jpg = true;
use_mp3 = true;
use_swf = true;
use_base64 = true;
use_bzip2 = true;
level_switch = false;
for (int i = 0; i < 81; i++) {
use_zlib_level[i] = true;
}
}
#ifndef DLL
#define DLL __declspec(dllexport)
#endif
DLL void get_copyright_msg(char* msg);
DLL bool precompress_file(char* in_file, char* out_file, char* msg, Switches switches);
DLL bool recompress_file(char* in_file, char* out_file, char* msg, Switches switches);
|
/*
* Copyright (c) 2010 Yahoo! Inc. All rights reserved. Licensed under
* the Apache License, Version 2.0 (the "License"); you may not use
* this file except in compliance with the License. You may obtain a
* copy of the License at http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License. See accompanying
* LICENSE file.
*
* $Id$
*/
#ifndef _CL_PROPERTYLISTIMPL_H_
#define _CL_PROPERTYLISTIMPL_H_
namespace clusterlib {
/**
* Implementation of PropertyList.
*/
class PropertyListImpl
: public virtual PropertyList,
public virtual NotifyableImpl
{
public:
virtual CachedKeyValues &cachedKeyValues();
virtual bool getPropertyListWaitMsecs(
const std::string &name,
AccessType accessType,
int64_t msecTimeout,
boost::shared_ptr<PropertyList> *pPropertyListSP);
/*
* Internal functions not used by outside clients
*/
public:
/**
* Constructor.
*/
PropertyListImpl(FactoryOps *fp,
const std::string &key,
const std::string &name,
const boost::shared_ptr<NotifyableImpl> &parent);
virtual NotifyableList getChildrenNotifyables();
virtual void initializeCachedRepresentation();
/**
* Create the key-value JSONObject key
*
* @param propertyListKey the property list key
* @return the generated key-value JSONObject key
*/
static std::string createKeyValJsonObjectKey(
const std::string &propertyListKey);
private:
/**
* Do not call the default constructor.
*/
PropertyListImpl();
private:
/**
* The cached key-values
*/
CachedKeyValuesImpl m_cachedKeyValues;
};
} /* End of 'namespace clusterlib' */
#endif /* !_PROPERTYLISTIMPL_H_ */
|
/*
ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio
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 _BOARD_H_
#define _BOARD_H_
/*
* Setup for Raisonance REva V3 + STM8S208RB daughter board.
*/
/*
* Board identifiers.
*/
#define BOARD_REVA_V3_STM8S208RB
#define BOARD_NAME "Raisonance REva V3 + STM8S208RB"
/*
* Board frequencies.
*/
#define HSECLK 0
/*
* MCU model used on the board.
*/
#define STM8S208
/*
* Pin definitions.
*/
#define PA_OSCIN 1
#define PA_J2_25 2 /* It is also OSCOUT. */
#define PA_J2_27 3
#define PA_RX 4
#define PA_TX 5
#define PB_LED(n) (n)
#define PB_LCD_D0 0
#define PB_LCD_D1 1
#define PB_LCD_CSB 2
#define PB_LCD_RESB 3
#define PC_ADC_ETR 0
#define PC_J2_51 1
#define PC_J2_53 2
#define PC_J2_55 3
#define PC_J2_57 4
#define PC_SCK 5
#define PC_MOSI 6
#define PC_MISO 7
#define PD_J2_69 0
#define PD_J2_21 1
#define PD_J2_67 2
#define PD_J2_65 3
#define PD_PWM 4
#define PD_J2_63 5
#define PD_J2_61 6
#define PD_J2_59 7
#define PE_P2_49 0
#define PE_SCL 1
#define PE_SDA 2
#define PE_P2_47 3
#define PE_P2_45 4
#define PE_P2_43 5
#define PE_P2_41 6
#define PE_P2_39 7
#define PF_J2_37 0
#define PF_J2_35 1
#define PF_J2_33 2
#define PF_J2_31 3
#define PF_ANA_IN1 4
#define PF_ANA_IN2 5
#define PF_ANA_TEMP 6
#define PF_ANA_POT 7
#define PG_CAN_TX 0
#define PG_CAN_RX 1
#define PG_BT5 2
#define PG_BT6 3
#define PG_SW4 4
#define PG_SW3 5
#define PG_SW2 6
#define PG_SW1 7
#define PI_J2_71 0
/*
* Port A initial setup.
*/
#define VAL_GPIOAODR (1 << PA_TX) /* PA_TX initially to 1. */
#define VAL_GPIOADDR (1 << PA_TX) /* PA_TX output, others inputs. */
#define VAL_GPIOACR1 0xFF /* All pull-up or push-pull. */
#define VAL_GPIOACR2 0
/*
* Port B initial setup.
*/
#define VAL_GPIOBODR 0xFF /* Initially all set to high. */
#define VAL_GPIOBDDR 0xFF /* All outputs. */
#define VAL_GPIOBCR1 0xFF /* All push-pull. */
#define VAL_GPIOBCR2 0
/*
* Port C initial setup.
*/
#define VAL_GPIOCODR 0
#define VAL_GPIOCDDR 0 /* All inputs. */
#define VAL_GPIOCCR1 0xFF /* All pull-up. */
#define VAL_GPIOCCR2 0
/*
* Port D initial setup.
*/
#define VAL_GPIODODR 0
#define VAL_GPIODDDR 0 /* All inputs. */
#define VAL_GPIODCR1 0xFF /* All pull-up. */
#define VAL_GPIODCR2 0
/*
* Port E initial setup.
*/
#define VAL_GPIOEODR 0
#define VAL_GPIOEDDR 0 /* All inputs. */
#define VAL_GPIOECR1 0xFF /* All pull-up. */
#define VAL_GPIOECR2 0
/*
* Port F initial setup.
*/
#define VAL_GPIOFODR 0
#define VAL_GPIOFDDR 0 /* All inputs. */
#define VAL_GPIOFCR1 0xFF /* All pull-up. */
#define VAL_GPIOFCR2 0
/*
* Port G initial setup.
*/
#define VAL_GPIOGODR (1 << PG_CAN_TX)/* CAN_TX initially to 1. */
#define VAL_GPIOGDDR (1 << PG_CAN_TX)/* CAN_TX output, others inputs. */
#define VAL_GPIOGCR1 0xFF /* All pull-up or push-pull. */
#define VAL_GPIOGCR2 0
/*
* Port H initial setup (dummy, not present).
*/
#define VAL_GPIOHODR 0
#define VAL_GPIOHDDR 0 /* All inputs. */
#define VAL_GPIOHCR1 0xFF /* All pull-up. */
#define VAL_GPIOHCR2 0
/*
* Port I initial setup.
*/
#define VAL_GPIOIODR 0
#define VAL_GPIOIDDR 0 /* All inputs. */
#define VAL_GPIOICR1 0xFF /* All pull-up. */
#define VAL_GPIOICR2 0
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
extern "C" {
#endif
void boardInit(void);
#ifdef __cplusplus
}
#endif
#endif /* _FROM_ASM_ */
#endif /* _BOARD_H_ */
|
/* IBM_PROLOG_BEGIN_TAG */
/*
* Copyright 2003,2016 IBM International Business Machines Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* IBM_PROLOG_END_TAG */
/* static char sccsid[] = "@(#)71 1.2 src/htx/usr/lpp/htx/lib/htxmp64/htxmp_proto_new.h, htx_libhtxmp, htxubuntu 1/20/14 06:11:24";
*
* COMPONENT_NAME: htx_libhtxmp
*
* FUNCTIONS:
*
* ORIGINS: 27
*
* IBM CONFIDENTIAL -- (IBM Confidential Restricted when
* combined with the aggregated modules for this product)
* OBJECT CODE ONLY SOURCE MATERIALS
* (C) COPYRIGHT International Business Machines Corp. 1988, 1990, 1991
* All Rights Reserved
*
* US Government Users Restricted Rights - Use, duplication or
* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
*/
#include "hxiipc64.h"
#include "hxihtx64.h"
/* Global htxmp data-structure */
typedef struct {
/* local_htx_ds keeps track of thread specific stats */
struct htx_data local_htx_ds;
/* Read/Write lock for updating stats per thread basis */
pthread_mutex_t mutex_lock;
} mp_struct;
mp_struct * global_mp_struct = NULL;
unsigned int num_threads = 0;
struct htx_data * global_mp_htx_ds ;
/* This flag lets us choose b/w prev version of mp
and the new version
*/
int new_mp = 0;
/* This flag tells whether mp_instialization was
successful or not */
int new_mp_initialize = 0;
/* This thread will make stats update thread wait,
until exer had made first call to hxfupdate.
*/
int exer_stats_updated = 0;
/* Thread index dictated by htxmp library when each thread
call mp_start()
*/
int th_index = -1;
/* Exit stats for mp stats thread */
int exit_update_td = 0;
/* Stats thread thread attribute */
pthread_attr_t stats_th_attr;
pthread_t stats_th_tid;
/* mp_start needs a global mutex lock to generate,
unique number each time. */
pthread_mutex_t mutex_start;
pthread_mutex_t create_thread_mutex;
pthread_cond_t create_thread_cond;
pthread_cond_t start_thread_cond;
pthread_once_t mpstart_onceblock = PTHREAD_ONCE_INIT;
pthread_mutex_t hxfupdate_mutex;
pthread_once_t hxfupdate_onceblock = PTHREAD_ONCE_INIT;
pthread_mutex_t hxfpat_mutex;
pthread_once_t hxfpat_onceblock = PTHREAD_ONCE_INIT;
pthread_once_t hxfsbuf_onceblock = PTHREAD_ONCE_INIT;
pthread_mutex_t hxfsbuf_mutex;
pthread_once_t hxfcbuf_onceblock = PTHREAD_ONCE_INIT;
pthread_mutex_t hxfcbuf_mutex;
pthread_once_t hxfbindto_a_cpu_onceblock = PTHREAD_ONCE_INIT;
pthread_mutex_t hxfbindto_a_cpu_mutex;
/* function prtotypes */
/* below prototypes if changed here should also be updated in hxihtxmp.h(aix) as they are duplicated */
/* to get rid of funcn prototype warnings when hxihtxmp.h is included anywhere */
int hxfmsg_tsafe(struct htx_data *p,int err, int sev, char * text);
int hxfupdate_tsafe(char type,struct htx_data * arg);
int hxfpat_tsafe(char *filename, char *pattern_buf, int num_chars);
int hxfsbuf_tsafe(char *buf, size_t len, char *fname, struct htx_data *ps);
int hxfcbuf_tsafe(struct htx_data *ps, char *wbuf, char *rbuf, size_t len, char *msg);
int hxfupdate_tunsafe(char call, struct htx_data *data);
int hxfpat_tefficient(char *filename, char *pattern_buf, int num_chars);
int hxfsbuf_tefficient(char *buf, size_t len, char *fname, struct htx_data *ps);
int hxfcbuf_calling_hxfsbuf_tsafe(struct htx_data *ps, char *wbuf, char *rbuf, size_t len,
char *msg);
void update_stats(void * args);
|
#ifndef _COMMON_H
#define _COMMON_H
#ifndef __MACH__
#include <numa.h>
#include <numaif.h>
#endif
// The author knows that this is really ugly...
// But what can we do? Lets hope our Macbook
// supporting NUMA soon! A 2lbs laptop with
// 4 NUMA nodes, how cool is that!
#ifdef __MACH__
#include <math.h>
#include <stdlib.h>
#define numa_alloc_onnode(X,Y) malloc(X)
#define numa_max_node() 0
#define numa_run_on_node(X) 0
#define numa_set_localalloc() 0
#endif
#include <math.h>
#define LOG_2 0.693147180559945
#define MINUS_LOG_THRESHOLD -18.42
inline bool fast_exact_is_equal(double a, double b){
return (a <= b && b <= a);
}
/**
* Calculates log(exp(log_a) + exp(log_b))
*/
inline double logadd(double log_a, double log_b){
if (log_a < log_b)
{ // swap them
double tmp = log_a;
log_a = log_b;
log_b = tmp;
} else if (fast_exact_is_equal(log_a, log_b)) {
// Special case when log_a == log_b. In particular this works when both
// log_a and log_b are (+-) INFINITY: it will return (+-) INFINITY
// instead of NaN.
return LOG_2 + log_a;
}
double negative_absolute_difference = log_b - log_a;
if (negative_absolute_difference < MINUS_LOG_THRESHOLD)
return (log_a);
return (log_a + log1p(exp(negative_absolute_difference)));
}
/**
* Caclulate average of array of doubles
*/
inline double average(double * array, int length) {
double sum = 0.0;
for (int i=0; i < length; i++) {
sum+=array[i];
}
return sum/length;
}
#endif
|
//
// TesterEventDispatcher.h
//
// Package: Generated
// Module: TesterEventDispatcher
//
// This file has been generated.
// Warning: All changes to this will be lost when the file is re-generated.
//
#ifndef TesterEventDispatcher_INCLUDED
#define TesterEventDispatcher_INCLUDED
#include "Poco/RemotingNG/EventDispatcher.h"
#include "TesterRemoteObject.h"
class TesterEventDispatcher: public Poco::RemotingNG::EventDispatcher
{
public:
TesterEventDispatcher(TesterRemoteObject* pRemoteObject, const std::string& protocol);
/// Creates a TesterEventDispatcher.
virtual ~TesterEventDispatcher();
/// Destroys the TesterEventDispatcher.
void event__testEvent(const void* pSender, std::string& data);
void event__testFilteredEvent(const void* pSender, const int& data);
void event__testOneWayEvent(const void* pSender, std::string& data);
void event__testVoidEvent(const void* pSender);
virtual const Poco::RemotingNG::Identifiable::TypeId& remoting__typeId() const;
private:
void event__testEventImpl(const std::string& subscriberURI, std::string& data);
void event__testFilteredEventImpl(const std::string& subscriberURI, const int& data);
void event__testOneWayEventImpl(const std::string& subscriberURI, std::string& data);
void event__testVoidEventImpl(const std::string& subscriberURI);
static const std::string DEFAULT_NS;
TesterRemoteObject* _pRemoteObject;
};
inline const Poco::RemotingNG::Identifiable::TypeId& TesterEventDispatcher::remoting__typeId() const
{
return ITester::remoting__typeId();
}
#endif // TesterEventDispatcher_INCLUDED
|
//
// HLCardResult.h
// 简闻
//
// Created by 韩露露 on 16/5/2.
// Copyright © 2016年 韩露露. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface HLCardResult : NSObject
@property (copy, nonatomic) NSString *area;
@property (copy, nonatomic) NSString *sex;
@property (copy, nonatomic) NSString *birthday;
@end
|
/**
* @file LogAttribute.h
* LogAttribute class declaration
*
* 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 __LOG_ATTRIBUTE_H__
#define __LOG_ATTRIBUTE_H__
#include "FlowFileRecord.h"
#include "core/Processor.h"
#include "core/ProcessSession.h"
#include "core/Core.h"
#include "core/Resource.h"
#include "core/logging/LoggerConfiguration.h"
namespace org {
namespace apache {
namespace nifi {
namespace minifi {
namespace processors {
// LogAttribute Class
class LogAttribute : public core::Processor {
public:
// Constructor
/*!
* Create a new processor
*/
LogAttribute(std::string name, uuid_t uuid = NULL)
: Processor(name, uuid),
logger_(logging::LoggerFactory<LogAttribute>::getLogger()) {
}
// Destructor
virtual ~LogAttribute() {
}
// Processor Name
static constexpr char const* ProcessorName = "LogAttribute";
// Supported Properties
static core::Property LogLevel;
static core::Property AttributesToLog;
static core::Property AttributesToIgnore;
static core::Property LogPayload;
static core::Property LogPrefix;
// Supported Relationships
static core::Relationship Success;
enum LogAttrLevel {
LogAttrLevelTrace,
LogAttrLevelDebug,
LogAttrLevelInfo,
LogAttrLevelWarn,
LogAttrLevelError
};
// Convert log level from string to enum
bool logLevelStringToEnum(std::string logStr, LogAttrLevel &level) {
if (logStr == "trace") {
level = LogAttrLevelTrace;
return true;
} else if (logStr == "debug") {
level = LogAttrLevelDebug;
return true;
} else if (logStr == "info") {
level = LogAttrLevelInfo;
return true;
} else if (logStr == "warn") {
level = LogAttrLevelWarn;
return true;
} else if (logStr == "error") {
level = LogAttrLevelError;
return true;
} else
return false;
}
// Nest Callback Class for read stream
class ReadCallback : public InputStreamCallback {
public:
ReadCallback(uint64_t size) {
_bufferSize = size;
_buffer = new char[_bufferSize];
}
~ReadCallback() {
if (_buffer)
delete[] _buffer;
}
void process(std::ifstream *stream) {
stream->read(_buffer, _bufferSize);
if (!stream)
_readSize = stream->gcount();
else
_readSize = _bufferSize;
}
char *_buffer;
uint64_t _bufferSize;
uint64_t _readSize;
};
public:
// OnTrigger method, implemented by NiFi LogAttribute
virtual void onTrigger(core::ProcessContext *context, core::ProcessSession *session);
// Initialize, over write by NiFi LogAttribute
virtual void initialize(void);
protected:
private:
// Logger
std::shared_ptr<logging::Logger> logger_;
};
REGISTER_RESOURCE(LogAttribute);
} /* namespace processors */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */
#endif
|
/*
* Copyright 2014 The Kythe Authors. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/// \file
/// \brief Functions to convert gcc command lines to clang command lines.
///
/// Utilities in this file convert from arguments to the gcc frontend to
/// arguments to the clang frontend. They are useful for building tools that act
/// on compilation logs that originally invoked gcc.
///
/// Terminology:
///
/// 'argc' and 'argv' have the same meaning as in
/// `int main(int argc, char* argv[]);`
/// i.e. `argv[]` contains `argc + 1` elements, where `argv[0]` is the path
/// to the program, and `argv[argc]` (the last element) is a `NULL`
/// sentinel.
///
/// We use the term 'command line' for the `std::vector`
/// `{ argv[0], argv[1], ..., argv[argc - 1] }`
/// i.e. `argv[]` minus the trailing `NULL`.
///
/// We use the term 'args' for the `std::vector`
/// `{ argv[1], argv[2], ..., argv[argc - 1] }`
/// i.e. the command line minus `argv[0]`.
///
//===----------------------------------------------------------------------===//
// This file uses the Clang style conventions.
#ifndef LLVM_CLANG_LIB_DRIVER_COMMANDLINE_UTILS_H
#define LLVM_CLANG_LIB_DRIVER_COMMANDLINE_UTILS_H
#include <string>
#include <vector>
namespace kythe {
namespace common {
// Returns true iff a C++ source file appears on the given command
// line or args. This doesn't care whether the input contains argv[0]
// or not.
bool HasCxxInputInCommandLineOrArgs(
const std::vector<std::string>& command_line_or_args);
// Converts GCC's arguments to Clang's arguments by dropping GCC args that
// Clang doesn't understand.
std::vector<std::string> GCCArgsToClangArgs(
const std::vector<std::string>& gcc_args);
// Converts GCC's arguments to Clang's arguments by dropping GCC args that
// Clang doesn't understand or that are not supported in -fsyntax-only mode
// and adding -fsyntax-only. The return value is guaranteed to contain exactly
// one -fsyntax-only flag.
std::vector<std::string> GCCArgsToClangSyntaxOnlyArgs(
const std::vector<std::string>& gcc_args);
// Converts GCC's arguments to Clang's arguments by dropping GCC args that
// Clang doesn't understand or that are not supported in --analyze mode
// and adding --analyze. The return value is guaranteed to contain exactly
// one --analyze flag.
std::vector<std::string> GCCArgsToClangAnalyzeArgs(
const std::vector<std::string>& gcc_args);
// Adds -fsyntax-only to the args, and removes args incompatible with
// -fsyntax-only. The return value is guaranteed to contain exactly
// one -fsyntax-only flag.
std::vector<std::string> AdjustClangArgsForSyntaxOnly(
const std::vector<std::string>& clang_args);
// Adds --analyze to the args, and removes args incompatible with
// --analyze. The return value is guaranteed to contain exactly
// one --analyze flag.
std::vector<std::string> AdjustClangArgsForAnalyze(
const std::vector<std::string>& clang_args);
// Converts Clang's arguments to GCC's arguments by dropping Clang args that
// GCC doesn't understand.
std::vector<std::string> ClangArgsToGCCArgs(
const std::vector<std::string>& clang_args);
// Removes and adjusts the flags to be valid for compiling with
// AddressSanitizer.
std::vector<std::string> AdjustClangArgsForAddressSanitizer(
const std::vector<std::string>& clang_args);
// Converts a std::string std::vector representing a command line into a C
// string std::vector representing the argv (including the trailing NULL).
// Note that the C strings in the result point into the argument std::vector.
// That argument must live and remain unchanged as long as the return
// std::vector lives.
//
// Note that the result std::vector contains char* rather than const char*,
// in order to work with legacy C-style APIs. It's the caller's responsibility
// not to modify the contents of the C-strings.
std::vector<char*> CommandLineToArgv(
const std::vector<std::string>& command_line);
// `CommandLineToArgv` should not be used with temporaries.
void CommandLineToArgv(const std::vector<std::string>&&) = delete;
// Set of possible actions to be performed by the compiler driver.
enum DriverAction {
ASSEMBLY,
CXX_COMPILE,
C_COMPILE,
FORTRAN_COMPILE,
GO_COMPILE,
LINK,
UNKNOWN
};
// Decides what will the driver do based on the inputs found on the command
// line.
DriverAction DetermineDriverAction(const std::vector<std::string>& args);
} // namespace common
} // namespace kythe
#endif // LLVM_CLANG_LIB_DRIVER_COMMANDLINE_UTILS_H
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Object4170816371.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Security.CodeAccessPermission
struct CodeAccessPermission_t2127220 : public Il2CppObject
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
/*********************************************************************
*
* test_listbuckets.h: Riak C Unit testing for List Buckets Message
*
* Copyright (c) 2007-2014 Basho Technologies, Inc. All Rights Reserved.
*
* This file is provided 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.
*
*********************************************************************/
void
test_listbuckets_response_decode();
void
test_integration_listbuckets();
void
test_integration_async_listbuckets();
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Users/tball/tmp/j2objc/testing/mockito/build_result/java/org/mockito/internal/util/collections/ArrayUtils.java
//
#ifndef _OrgMockitoInternalUtilCollectionsArrayUtils_H_
#define _OrgMockitoInternalUtilCollectionsArrayUtils_H_
@class IOSObjectArray;
#include "J2ObjC_header.h"
@interface OrgMockitoInternalUtilCollectionsArrayUtils : NSObject {
}
- (jboolean)isEmptyWithNSObjectArray:(IOSObjectArray *)array;
- (instancetype)init;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgMockitoInternalUtilCollectionsArrayUtils)
CF_EXTERN_C_BEGIN
CF_EXTERN_C_END
J2OBJC_TYPE_LITERAL_HEADER(OrgMockitoInternalUtilCollectionsArrayUtils)
#endif // _OrgMockitoInternalUtilCollectionsArrayUtils_H_
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __BLE_BATTERY_SERVICE_H__
#define __BLE_BATTERY_SERVICE_H__
#include "BLEDevice.h"
/* Battery Service */
/* Service: https://developer.bluetooth.org/gatt/services/Pages/ServiceViewer.aspx?u=org.bluetooth.service.battery_service.xml */
/* Battery Level Char: https://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.battery_level.xml */
class BatteryService {
public:
BatteryService(BLEDevice &_ble, uint8_t level = 100) :
ble(_ble),
batteryLevel(level),
batteryLevelCharacteristic(GattCharacteristic::UUID_BATTERY_LEVEL_CHAR, &batteryLevel, sizeof(batteryLevel), sizeof(batteryLevel),
GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_READ | GattCharacteristic::BLE_GATT_CHAR_PROPERTIES_NOTIFY) {
static bool serviceAdded = false; /* We should only ever need to add the heart rate service once. */
if (serviceAdded) {
return;
}
GattCharacteristic *charTable[] = {&batteryLevelCharacteristic};
GattService batteryService(GattService::UUID_BATTERY_SERVICE, charTable, sizeof(charTable) / sizeof(GattCharacteristic *));
ble.addService(batteryService);
serviceAdded = true;
}
/**
* Update the battery level with a new value. Valid values range from
* 0..100. Anything outside this range will be ignored.
* @param newLevel New level.
*/
void updateBatteryLevel(uint8_t newLevel) {
batteryLevel = newLevel;
ble.updateCharacteristicValue(batteryLevelCharacteristic.getValueAttribute().getHandle(), &batteryLevel, 1);
}
private:
BLEDevice &ble;
uint8_t batteryLevel;
GattCharacteristic batteryLevelCharacteristic;
};
#endif /* #ifndef __BLE_BATTERY_SERVICE_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.
*/
#ifndef AXIS2_CALLBACK_RECV_H
#define AXIS2_CALLBACK_RECV_H
/**
* @defgroup axis2_callback_recv callback message receiver. This can be considered as a
* message receiver implementation for application client side which is similar to
* server side message receivers like raw_xml_in_out_msg_recv. Messages received by
* listener manager will finally end up here.
*
* @ingroup axis2_client_api
* callback message receiver, that is used as the message receiver in the
* operation in case of asynchronous invocation for receiving the result.
*/
/**
* @file axis2_axis2_callback_recv.h
*/
#include <axis2_defines.h>
#include <axutil_env.h>
#include <axis2_msg_recv.h>
#include <axis2_callback.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** Type name for struct axis2_callback_recv */
typedef struct axis2_callback_recv axis2_callback_recv_t;
/**
* Gets the base struct which is of type message receiver.
* @param callback_recv pointer to callback receiver struct
* @param env pointer to environment struct
* @return pointer to base message receiver struct
*/
AXIS2_EXTERN axis2_msg_recv_t *AXIS2_CALL
axis2_callback_recv_get_base(
axis2_callback_recv_t * callback_recv,
const axutil_env_t * env);
/**
* Frees the callback receiver struct.
* @param callback_recv pointer to callback receiver struct
* @param env pointer to environment struct
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
AXIS2_EXTERN void AXIS2_CALL
axis2_callback_recv_free(
axis2_callback_recv_t * callback_recv,
const axutil_env_t * env);
/**
* Adds a callback corresponding to given WSA message ID to message
* receiver.
* @param callback_recv pointer to callback receiver struct
* @param env pointer to environment struct
* @param msg_id message ID indicating which message the callback is
* supposed to deal with
* @param callback callback to be added. callback receiver assumes
* ownership of the callback
* @return AXIS2_SUCCESS on success, else AXIS2_FAILURE
*/
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axis2_callback_recv_add_callback(
struct axis2_callback_recv *callback_recv,
const axutil_env_t * env,
const axis2_char_t * msg_id,
axis2_callback_t * callback);
/**
* Creates a callback receiver struct.
* @param env pointer to environment struct
* @return a pointer to newly created callback receiver struct,
* or NULL on error with error code set in environment's error
*/
AXIS2_EXTERN axis2_callback_recv_t *AXIS2_CALL
axis2_callback_recv_create(
const axutil_env_t * env);
/** Gets the base message receiver. */
#define AXIS2_CALLBACK_RECV_GET_BASE(callback_recv, env) \
axis2_callback_recv_get_base(callback_recv, env)
/** Frees callback message receiver. */
#define AXIS2_CALLBACK_RECV_FREE(callback_recv, env) \
axis2_callback_recv_free(callback_recv, env)
/** Adds callback to callback message receiver. */
#define AXIS2_CALLBACK_RECV_ADD_CALLBACK(callback_recv, env, msg_id, callback)\
axis2_callback_recv_add_callback(callback_recv, env, msg_id, callback)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* AXIS2_CALLBACK_RECV_H */
|
//
// WalletViewController.h
// Courier
//
// Created by 朱玉涵 on 16/8/9.
// Copyright © 2016年 dabao. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface WalletViewController : UIViewController
@end
|
// Copyright 2015-2016 Espressif Systems (Shanghai) PTE 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.
#ifndef _DRIVER_RTC_GPIO_H_
#define _DRIVER_RTC_GPIO_H_
#include <stdint.h>
#include "esp_err.h"
#include "driver/gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Pin function information for a single GPIO pad's RTC functions.
*
* This is an internal function of the driver, and is not usually useful
* for external use.
*/
typedef struct {
uint32_t reg; /*!< Register of RTC pad, or 0 if not an RTC GPIO */
uint32_t mux; /*!< Bit mask for selecting digital pad or RTC pad */
uint32_t func; /*!< Shift of pad function (FUN_SEL) field */
uint32_t ie; /*!< Mask of input enable */
uint32_t pullup; /*!< Mask of pullup enable */
uint32_t pulldown; /*!< Mask of pulldown enable */
uint32_t slpsel; /*!< If slpsel bit is set, slpie will be used as pad input enabled signal in sleep mode */
uint32_t slpie; /*!< Mask of input enable in sleep mode */
uint32_t hold; /*!< Mask of hold_force bit for RTC IO in RTC_CNTL_HOLD_FORCE_REG */
int rtc_num; /*!< RTC IO number, or -1 if not an RTC GPIO */
} rtc_gpio_desc_t;
typedef enum {
RTC_GPIO_MODE_INPUT_ONLY , /*!< Pad output */
RTC_GPIO_MODE_OUTPUT_ONLY, /*!< Pad input */
RTC_GPIO_MODE_INPUT_OUTUT, /*!< Pad pull output + input */
RTC_GPIO_MODE_DISABLED, /*!< Pad (output + input) disable */
} rtc_gpio_mode_t;
/**
* @brief Provides access to a constant table of RTC I/O pin
* function information.
*
* This is an internal function of the driver, and is not usually useful
* for external use.
*/
extern const rtc_gpio_desc_t rtc_gpio_desc[GPIO_PIN_COUNT];
/**
* @brief Determine if the specified GPIO is a valid RTC GPIO.
*
* @param gpio_num GPIO number
* @return true if GPIO is valid for RTC GPIO use. talse otherwise.
*/
inline static bool rtc_gpio_is_valid_gpio(gpio_num_t gpio_num)
{
return gpio_num < GPIO_PIN_COUNT
&& rtc_gpio_desc[gpio_num].reg != 0;
}
#define RTC_GPIO_IS_VALID_GPIO(gpio_num) rtc_gpio_is_valid_gpio(gpio_num) // Deprecated, use rtc_gpio_is_valid_gpio()
/**
* @brief Init a GPIO as RTC GPIO
*
* This function must be called when initializing a pad for an analog function.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - ESP_OK success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_init(gpio_num_t gpio_num);
/**
* @brief Init a GPIO as digital GPIO
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - ESP_OK success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_deinit(gpio_num_t gpio_num);
/**
* @brief Get the RTC IO input level
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - 1 High level
* - 0 Low level
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
uint32_t rtc_gpio_get_level(gpio_num_t gpio_num);
/**
* @brief Set the RTC IO output level
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
* @param level output level
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_set_level(gpio_num_t gpio_num, uint32_t level);
/**
* @brief RTC GPIO set direction
*
* Configure RTC GPIO direction, such as output only, input only,
* output and input.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
* @param mode GPIO direction
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_set_direction(gpio_num_t gpio_num, rtc_gpio_mode_t mode);
/**
* @brief RTC GPIO pullup enable
*
* This function only works for RTC IOs. In general, call gpio_pullup_en,
* which will work both for normal GPIOs and RTC IOs.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_pullup_en(gpio_num_t gpio_num);
/**
* @brief RTC GPIO pulldown enable
*
* This function only works for RTC IOs. In general, call gpio_pulldown_en,
* which will work both for normal GPIOs and RTC IOs.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_pulldown_en(gpio_num_t gpio_num);
/**
* @brief RTC GPIO pullup disable
*
* This function only works for RTC IOs. In general, call gpio_pullup_dis,
* which will work both for normal GPIOs and RTC IOs.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_pullup_dis(gpio_num_t gpio_num);
/**
* @brief RTC GPIO pulldown disable
*
* This function only works for RTC IOs. In general, call gpio_pulldown_dis,
* which will work both for normal GPIOs and RTC IOs.
*
* @param gpio_num GPIO number (e.g. GPIO_NUM_12)
*
* @return
* - ESP_OK Success
* - ESP_ERR_INVALID_ARG GPIO is not an RTC IO
*/
esp_err_t rtc_gpio_pulldown_dis(gpio_num_t gpio_num);
/**
* @brief Disable "hold" signal for all RTC IOs
*
* Each RTC pad has a "hold" input signal from the RTC controller.
* If hold signal is set, pad latches current values of input enable,
* function, output enable, and other signals which come from the RTC mux.
* Hold signal is enabled before going into deep sleep for pins which
* are used for EXT1 wakeup.
*/
void rtc_gpio_unhold_all();
#ifdef __cplusplus
}
#endif
#endif
|
#include <stdlib.h>
#include <string.h>
#include <libterm_internal.h>
#include "term_logging.h"
void term_process_output_data(term_t_i *term, char *buf, int length)
{
int i, consumed;
for( i = 0; i < length; i ++ ) {
#if 0
if( isgraph( buf[ i ] ) ) {
printf( "Output character %d (%c)\n", buf[ i ], buf[ i ] );
} else {
printf( "Output character %d\n", buf[ i ] );
}
#endif
}
// Copy the characters for later processing.
// TODO: Try to reduce the copying to only do this if necessary - like run directly
// on this data if there's nothing pending, and make this into a ringbuffer
if( term->output_max_bytes < term->output_byte_count + length ) {
term->output_max_bytes = term->output_byte_count + length;
if( term->output_bytes != NULL ) {
term->output_bytes = realloc( term->output_bytes, term->output_max_bytes );
} else {
term->output_bytes = malloc( term->output_max_bytes );
}
}
memcpy( term->output_bytes + term->output_byte_count, buf, length );
term->output_byte_count += length;
// Process all the characters
while( term->output_byte_count ) {
// Process any escape codes. If one is still pending, abort processing, we'll
// continue when there is more data
consumed = term_send_escape( term, term->output_bytes, term->output_byte_count );
if( consumed == -1 ) {
// Not an escape code
} else if( consumed == 0 ) {
// It's a prefix, wait for more information
break;
} else {
// It's an escape code, eat it and continue
memmove( term->output_bytes, term->output_bytes + consumed, term->output_byte_count - consumed );
term->output_byte_count -= consumed;
continue;
}
// If it's not an escape, it's a regular character
if( term->crow >= 0 && term->crow < term->grid.history && term->ccol >= 0 && (term->ccol < term->grid.width || term->autoexpand) ) {
if( term->ccol > term->grid.width + term->extrawidth ) {
// Autoexpanding
term->extrawidth = term->ccol;
term_resize_internal( TO_H( term ), term->grid.width, term->grid.height, term->grid.history - term->grid.height, term->extrawidth, NULL );
}
term->grid.grid[term->crow][term->ccol] = term->output_bytes[0];
term->grid.attribs[term->crow][term->ccol] = term->cattr;
term->grid.colours[term->crow][term->ccol] = term->ccolour;
term_add_dirty_rect( term, term->ccol, term->crow, 1, 1 );
} else {
slog("Skipped writing %c out of bounds at (%d,%d)", term->output_bytes[0], term->crow, term->ccol);
}
memmove( term->output_bytes, term->output_bytes + 1, term->output_byte_count - 1 );
term->output_byte_count --;
term->ccol++;
term->dirty_cursor.exists = true;
}
term_update( term );
term_cursor_update( term );
}
|
#ifndef Arduino_h
#define Arduino_h
#include "cb_pio.h"
#include "hal_types.h"
#define HIGH cbPIO_HIGH
#define LOW cbPIO_LOW
#define INPUT cbPIO_INPUT_PD
#define OUTPUT cbPIO_OUTPUT
typedef uint8 uint8_t;
typedef uint16 uint16_t;
typedef uint32 uint32_t;
typedef bool boolean;
typedef uint8 byte;
void pinMode(cbPIO_Pin pin, cbPIO_Port port, cbPIO_Mode mode);
void digitalWrite(cbPIO_Pin pin, cbPIO_Port port, cbPIO_Value state);
cbPIO_Value digitalRead(cbPIO_Pin pin, cbPIO_Port port);
void delayMicroseconds(int ms);
void delay(int ms);
#endif
|
//
// SplashController.h
// JiangHomeStyle
//
// Created by 工业设计中意(湖南) on 13-8-28.
// Copyright (c) 2013年 工业设计中意(湖南). All rights reserved.
//
#import <UIKit/UIKit.h>
#import "googleAnalytics/GAI.h"
@class ViewController;
@interface SplashController : GAITrackedViewController
{
ViewController *viewController;
}
@end
|
/* 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.
*/
/*
* http_auth: authentication
*
* Rob McCool & Brian Behlendorf.
*
* Adapted to Apache by rst.
*
*/
#define APR_WANT_STRFUNC
#include "apr_want.h"
#include "apr_strings.h"
#include "apr_dbm.h"
#include "apr_md5.h" /* for apr_password_validate */
#include "ap_provider.h"
#include "httpd.h"
#include "http_config.h"
#include "http_core.h"
#include "http_log.h"
#include "http_protocol.h"
#include "http_request.h" /* for ap_hook_(check_user_id | auth_checker)*/
#include "mod_auth.h"
static APR_OPTIONAL_FN_TYPE(ap_authn_cache_store) *authn_cache_store = NULL;
#define AUTHN_CACHE_STORE(r,user,realm,data) \
if (authn_cache_store != NULL) \
authn_cache_store((r), "dbm", (user), (realm), (data))
typedef struct {
const char *pwfile;
const char *dbmtype;
} authn_dbm_config_rec;
static void *create_authn_dbm_dir_config(apr_pool_t *p, char *d)
{
authn_dbm_config_rec *conf = apr_palloc(p, sizeof(*conf));
conf->pwfile = NULL;
conf->dbmtype = "default";
return conf;
}
static const command_rec authn_dbm_cmds[] =
{
AP_INIT_TAKE1("AuthDBMUserFile", ap_set_file_slot,
(void *)APR_OFFSETOF(authn_dbm_config_rec, pwfile),
OR_AUTHCFG, "dbm database file containing user IDs and passwords"),
AP_INIT_TAKE1("AuthDBMType", ap_set_string_slot,
(void *)APR_OFFSETOF(authn_dbm_config_rec, dbmtype),
OR_AUTHCFG, "what type of DBM file the user file is"),
{NULL}
};
module AP_MODULE_DECLARE_DATA authn_dbm_module;
static apr_status_t fetch_dbm_value(const char *dbmtype, const char *dbmfile,
const char *user, char **value,
apr_pool_t *pool)
{
apr_dbm_t *f;
apr_datum_t key, val;
apr_status_t rv;
rv = apr_dbm_open_ex(&f, dbmtype, dbmfile, APR_DBM_READONLY,
APR_OS_DEFAULT, pool);
if (rv != APR_SUCCESS) {
return rv;
}
key.dptr = (char*)user;
#ifndef NETSCAPE_DBM_COMPAT
key.dsize = strlen(key.dptr);
#else
key.dsize = strlen(key.dptr) + 1;
#endif
*value = NULL;
if (apr_dbm_fetch(f, key, &val) == APR_SUCCESS && val.dptr) {
*value = apr_pstrmemdup(pool, val.dptr, val.dsize);
}
apr_dbm_close(f);
return rv;
}
static authn_status check_dbm_pw(request_rec *r, const char *user,
const char *password)
{
authn_dbm_config_rec *conf = ap_get_module_config(r->per_dir_config,
&authn_dbm_module);
apr_status_t rv;
char *dbm_password;
char *colon_pw;
rv = fetch_dbm_value(conf->dbmtype, conf->pwfile, user, &dbm_password,
r->pool);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01754)
"could not open dbm (type %s) auth file: %s",
conf->dbmtype, conf->pwfile);
return AUTH_GENERAL_ERROR;
}
if (!dbm_password) {
return AUTH_USER_NOT_FOUND;
}
colon_pw = ap_strchr(dbm_password, ':');
if (colon_pw) {
*colon_pw = '\0';
}
AUTHN_CACHE_STORE(r, user, NULL, dbm_password);
rv = apr_password_validate(password, dbm_password);
if (rv != APR_SUCCESS) {
return AUTH_DENIED;
}
return AUTH_GRANTED;
}
static authn_status get_dbm_realm_hash(request_rec *r, const char *user,
const char *realm, char **rethash)
{
authn_dbm_config_rec *conf = ap_get_module_config(r->per_dir_config,
&authn_dbm_module);
apr_status_t rv;
char *dbm_hash;
char *colon_hash;
rv = fetch_dbm_value(conf->dbmtype, conf->pwfile,
apr_pstrcat(r->pool, user, ":", realm, NULL),
&dbm_hash, r->pool);
if (rv != APR_SUCCESS) {
ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r, APLOGNO(01755)
"Could not open dbm (type %s) hash file: %s",
conf->dbmtype, conf->pwfile);
return AUTH_GENERAL_ERROR;
}
if (!dbm_hash) {
return AUTH_USER_NOT_FOUND;
}
colon_hash = ap_strchr(dbm_hash, ':');
if (colon_hash) {
*colon_hash = '\0';
}
*rethash = dbm_hash;
AUTHN_CACHE_STORE(r, user, realm, dbm_hash);
return AUTH_USER_FOUND;
}
static const authn_provider authn_dbm_provider =
{
&check_dbm_pw,
&get_dbm_realm_hash,
};
static void opt_retr(void)
{
authn_cache_store = APR_RETRIEVE_OPTIONAL_FN(ap_authn_cache_store);
}
static void register_hooks(apr_pool_t *p)
{
ap_register_auth_provider(p, AUTHN_PROVIDER_GROUP, "dbm",
AUTHN_PROVIDER_VERSION,
&authn_dbm_provider, AP_AUTH_INTERNAL_PER_CONF);
ap_hook_optional_fn_retrieve(opt_retr, NULL, NULL, APR_HOOK_MIDDLE);
}
AP_DECLARE_MODULE(authn_dbm) =
{
STANDARD20_MODULE_STUFF,
create_authn_dbm_dir_config, /* dir config creater */
NULL, /* dir merger --- default is to override */
NULL, /* server config */
NULL, /* merge server config */
authn_dbm_cmds, /* command apr_table_t */
register_hooks /* register hooks */
};
|
/*
* Copyright 2017 NVIDIA Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <math.h>
#include <string.h>
#include <openacc.h>
#include "timer.h"
#define NN 4096
#define NM 4096
double A[NN][NM];
double Anew[NN][NM];
int main(int argc, char** argv)
{
const int n = NN;
const int m = NM;
const int iter_max = 1000;
const double tol = 1.0e-6;
double error = 1.0;
memset(A, 0, n * m * sizeof(double));
memset(Anew, 0, n * m * sizeof(double));
for (int j = 0; j < n; j++)
{
A[j][0] = 1.0;
Anew[j][0] = 1.0;
}
printf("Jacobi relaxation Calculation: %d x %d mesh\n", n, m);
StartTimer();
int iter = 0;
while ( error > tol && iter < iter_max )
{
error = 0.0;
#pragma omp parallel for shared(m, n, Anew, A)
for( int j = 1; j < n-1; j++)
{
for( int i = 1; i < m-1; i++ )
{
Anew[j][i] = 0.25 * ( A[j][i+1] + A[j][i-1]
+ A[j-1][i] + A[j+1][i]);
error = fmax( error, fabs(Anew[j][i] - A[j][i]));
}
}
#pragma omp parallel for shared(m, n, Anew, A)
for( int j = 1; j < n-1; j++)
{
for( int i = 1; i < m-1; i++ )
{
A[j][i] = Anew[j][i];
}
}
if(iter % 100 == 0) printf("%5d, %0.6f\n", iter, error);
iter++;
}
double runtime = GetTimer();
printf(" total: %f s\n", runtime / 1000);
return 0;
}
|
/* $NetBSD: dict_cache.h,v 1.1.1.2 2013/01/02 18:59:12 tron Exp $ */
#ifndef _DICT_CACHE_H_INCLUDED_
#define _DICT_CACHE_H_INCLUDED_
/*++
/* NAME
/* dict_cache 3h
/* SUMMARY
/* External cache manager
/* SYNOPSIS
/* #include <dict_cache.h>
/* DESCRIPTION
/* .nf
/*
* Utility library.
*/
#include <dict.h>
/*
* External interface.
*/
typedef struct DICT_CACHE DICT_CACHE;
typedef int (*DICT_CACHE_VALIDATOR_FN) (const char *, const char *, char *);
extern DICT_CACHE *dict_cache_open(const char *, int, int);
extern void dict_cache_close(DICT_CACHE *);
extern const char *dict_cache_lookup(DICT_CACHE *, const char *);
extern int dict_cache_update(DICT_CACHE *, const char *, const char *);
extern int dict_cache_delete(DICT_CACHE *, const char *);
extern int dict_cache_sequence(DICT_CACHE *, int, const char **, const char **);
extern void dict_cache_control(DICT_CACHE *,...);
extern const char *dict_cache_name(DICT_CACHE *);
#define DICT_CACHE_FLAG_VERBOSE (1<<0) /* verbose operation */
#define DICT_CACHE_FLAG_STATISTICS (1<<1) /* log cache statistics */
#define DICT_CACHE_CTL_END 0 /* list terminator */
#define DICT_CACHE_CTL_FLAGS 1 /* see above */
#define DICT_CACHE_CTL_INTERVAL 2 /* cleanup interval */
#define DICT_CACHE_CTL_VALIDATOR 3 /* call-back validator */
#define DICT_CACHE_CTL_CONTEXT 4 /* call-back context */
/* LICENSE
/* .ad
/* .fi
/* The Secure Mailer license must be distributed with this software.
/* AUTHOR(S)
/* Wietse Venema
/* IBM T.J. Watson Research
/* P.O. Box 704
/* Yorktown Heights, NY 10598, USA
/*--*/
#endif
|
// TTTArrayFormatter.h
//
// Copyright (c) 2011 Mattt Thompson (http://mattt.me)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/Foundation.h>
typedef enum {
TTTArrayFormatterSentenceStyle = 0,
TTTArrayFormatterDataStyle,
} TTTArrayFormatterStyle;
@interface TTTArrayFormatter : NSFormatter {
TTTArrayFormatterStyle _arrayStyle;
NSString *_delimiter;
NSString *_separator;
NSString *_conjunction;
NSString *_abbreviatedConjunction;
BOOL _usesAbbreviatedConjunction;
BOOL _usesSerialDelimiter;
}
- (NSString *)stringFromArray:(NSArray *)anArray;
- (NSString *)stringFromArray:(NSArray *)anArray rangesOfComponents:(NSArray **)rangeValues;
- (NSArray *)arrayFromString:(NSString *)aString;
+ (NSString *)localizedStringFromArray:(NSArray *)anArray arrayStyle:(TTTArrayFormatterStyle)style;
- (TTTArrayFormatterStyle)arrayStyle;
- (void)setArrayStyle:(TTTArrayFormatterStyle)style;
- (NSString *)delimiter;
- (void)setDelimiter:(NSString *)aDelimiter;
- (NSString *)separator;
- (void)setSeparator:(NSString *)aSeparator;
- (NSString *)conjunction;
- (void)setConjunction:(NSString *)aConjunction;
- (NSString *)abbreviatedConjunction;
- (void)setAbbreviatedConjunction:(NSString *)anAbbreviatedConjunction;
- (BOOL)usesAbbreviatedConjunction;
- (void)setUsesAbbreviatedConjunction:(BOOL)flag;
- (BOOL)usesSerialDelimiter;
- (void)setUsesSerialDelimiter:(BOOL)flag;
@end
|
// Copyright 2017 Dungeon Text
//
// 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.
//
// Original code Copyright (c) 2000 The staff of Fatal Dimensions.
// Checked 04/22/2017 - CBS
#include "merc.h"
#include "olc.h"
#include "interp.h"
#include "db.h"
bool hedit_show( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
EDIT_HELP(ch, pHelp);
sprintf_to_char(ch, "{yVnum: {x [%8p]\n\r"
"{yArea: {x [%5d] %s\n\r"
"{yLevel: {x [%d] %s\n\r"
"{yKeywords:{x %s\n\r"
"{yText: {x\n\r",
pHelp,
!pHelp->area ? -1 : pHelp->area->vnum,
!pHelp->area ? "No Area" : pHelp->area->name,
pHelp->level, pHelp->deleted?"{Rdeleted{x":"",
pHelp->keyword );
if(pHelp->text[0]!='\0')
send_to_char( pHelp->text, ch );
else
send_to_char( "Empty help.\n\r", ch );
return FALSE;
}
bool hedit_create( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
AREA_DATA *pArea;
extern HELP_DATA *help_last;
/* OLC 1.1b */
if ( argument[0] == '\0')
{
send_to_char( "Syntax: create [keywords]\n\r",ch );
return FALSE;
}
pArea = get_help_area( ch );
if ( !IS_BUILDER( ch, pArea ) )
{
send_to_char( "MPEdit: You are editing in an area you cannot build in.\n\r", ch );
return FALSE;
}
/* This way we can't remove the helps.. Need to add more code for that */
pHelp = new_help();
pHelp->area = pArea;
pHelp->keyword = str_dup(argument);
if ( help_first == NULL ) help_first = pHelp;
if ( help_last != NULL ) help_last->next = pHelp;
help_last = pHelp;
pHelp->next = NULL;
ch->desc->pEdit = (void *)pHelp;
send_to_char( "Help Created.\n\r", ch );
return TRUE;
}
bool hedit_append( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
EDIT_HELP(ch, pHelp);
if ( argument[0] == '\0' )
{
editor_start( ch, &pHelp->text );
return TRUE;
}
send_to_char( "Syntax: append\n\r", ch );
return FALSE;
}
bool hedit_delete( CHAR_DATA *ch, char *argument ) {
HELP_DATA *pHelp;
EDIT_HELP(ch, pHelp);
pHelp->deleted=!pHelp->deleted;
sprintf_to_char(ch,"This entry is %s deleted.\n\r",
pHelp->deleted?"now":"not any more");
return TRUE;
}
bool hedit_clear( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
EDIT_HELP(ch, pHelp);
if ( argument[0] == '\0' )
{
free_string( pHelp->text );
pHelp->text = &str_empty[0];
return TRUE;
}
send_to_char( "Syntax: clear\n\r", ch );
return FALSE;
}
bool hedit_keyword( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
EDIT_HELP(ch, pHelp);
if ( argument[0] == '\0' )
{
send_to_char("An empty keyword is not allowed.\n\r",ch);
return FALSE;
}
if(get_help_data(pHelp->area,argument))
{
send_to_char("Duplicate keywords in one area are not allowed.\n\r",ch);
return FALSE;
}
free_string( pHelp->keyword );
pHelp->keyword=str_dup(argument);
send_to_char( "Keyword set.\n\r", ch );
return TRUE;
}
bool hedit_hlist( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
AREA_DATA *pArea;
char buf [ MAX_STRING_LENGTH ];
char buf1 [ MAX_STRING_LENGTH*2 ];
char arg [ MAX_INPUT_LENGTH ];
bool fAll, found;
int col = 0;
one_argument( argument, arg );
if ( arg[0] == '\0' )
{
send_to_char( "Syntax: hlist <all/prefix>\n\r", ch );
return FALSE;
}
pArea = get_help_area(ch);
buf1[0] = '\0';
fAll = !str_cmp( arg, "all" );
found = FALSE;
for ( pHelp = help_first; pHelp ; pHelp=pHelp->next )
{
if ( pHelp->area==pArea && (fAll || is_name( arg, pHelp->keyword )) )
{
found = TRUE;
sprintf( buf, "[%8p] %-15.14s",
pHelp, pHelp->keyword );
strcat( buf1, buf );
if ( ++col % 3 == 0 ) strcat( buf1, "\n\r" );
}
}
if ( !found )
{
send_to_char( "No help found in this area.\n\r", ch);
return FALSE;
}
if ( col % 3 != 0 )
strcat( buf1, "\n\r" );
send_to_char( buf1, ch );
return FALSE;
}
bool hedit_level( CHAR_DATA *ch, char *argument )
{
HELP_DATA *pHelp;
EDIT_HELP(ch, pHelp);
if ( argument[0] == '\0' || !is_number( argument ) )
{
send_to_char( "Syntax: levelh [number]\n\r", ch );
return FALSE;
}
pHelp->level = atoi( argument );
send_to_char( "Level set.\n\r", ch);
return TRUE;
}
|
/*
* 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.
*/
/*
* $Id: FlagJanitor.c 568078 2007-08-21 11:43:25Z amassari $
*/
// ---------------------------------------------------------------------------
// Includes
// ---------------------------------------------------------------------------
#if defined(XERCES_TMPLSINC)
#include <xercesc/util/FlagJanitor.hpp>
#endif
XERCES_CPP_NAMESPACE_BEGIN
// ---------------------------------------------------------------------------
// Constructors and Destructor
// ---------------------------------------------------------------------------
template <class T> FlagJanitor<T>::FlagJanitor(T* const valPtr, const T newVal)
: fValPtr(valPtr)
{
// Store the pointer, save the org value, and store the new value
if (fValPtr)
{
fOldVal = *fValPtr;
*fValPtr = newVal;
}
}
template <class T> FlagJanitor<T>::~FlagJanitor()
{
// Restore the old value
if (fValPtr)
*fValPtr = fOldVal;
}
// ---------------------------------------------------------------------------
// Value management methods
// ---------------------------------------------------------------------------
template <class T> void FlagJanitor<T>::release()
{
fValPtr = 0;
}
XERCES_CPP_NAMESPACE_END
|
#ifndef LCD12864_H
#define LCD12864_H
void Lcm_Init();
void LCD12864SettingInit();
void Display_String(unsigned char,unsigned char *);
void LCD12864DisplayChar(unsigned char , unsigned char , unsigned char );
void LCD12864DisplayTwoChar(unsigned char , unsigned char , unsigned char , unsigned char );
void LCD12864SettingExit();
#endif
|
/*
* Copyright 2004,2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef SANDESHA2_ACCEPT_H
#define SANDESHA2_ACCEPT_H
/**
* @file sandesha2_accept.h
* @brief
*/
#include <axutil_utils_defines.h>
#include <axutil_env.h>
#include <sandesha2_acks_to.h>
#include <sandesha2_error.h>
#ifdef __cplusplus
extern "C"
{
#endif
/** @defgroup sandesha2_accept
* @ingroup sandesha2_wsrm
* @{
*/
typedef struct sandesha2_accept_t sandesha2_accept_t;
/**
* @brief sandesha2_accept
* sandesha2_accept
*/
AXIS2_EXTERN sandesha2_accept_t* AXIS2_CALL
sandesha2_accept_create(
const axutil_env_t *env,
axis2_char_t *rm_ns_value,
axis2_char_t *addr_ns_value);
axis2_status_t AXIS2_CALL
sandesha2_accept_free(
sandesha2_accept_t *accept,
const axutil_env_t *env);
axis2_status_t AXIS2_CALL
sandesha2_accept_set_acks_to(
sandesha2_accept_t *accept,
const axutil_env_t *env,
sandesha2_acks_to_t *acks_to);
sandesha2_acks_to_t * AXIS2_CALL
sandesha2_accept_get_acks_to(
sandesha2_accept_t *accept,
const axutil_env_t *env);
axis2_char_t* AXIS2_CALL
sandesha2_accept_get_namespace_value(
sandesha2_accept_t *accept,
const axutil_env_t *env);
void* AXIS2_CALL
sandesha2_accept_from_om_node(
sandesha2_accept_t *accept,
const axutil_env_t *env,
axiom_node_t *om_node);
axiom_node_t* AXIS2_CALL
sandesha2_accept_to_om_node(
sandesha2_accept_t *accept,
const axutil_env_t *env,
void *om_node);
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* SANDESHA2_ACCEPT_H */
|
/* mbed Microcontroller Library
* Copyright (c) 2006-2013 ARM Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stddef.h>
#include "cmsis.h"
#include "gpio_irq_api.h"
#include "gpio_api.h"
#include "error.h"
#define CHANNEL_NUM 96
static uint32_t channel_ids[CHANNEL_NUM] = {0};
static gpio_irq_handler irq_handler;
#define IRQ_DISABLED (0)
#define IRQ_RAISING_EDGE PORT_PCR_IRQC(9)
#define IRQ_FALLING_EDGE PORT_PCR_IRQC(10)
#define IRQ_EITHER_EDGE PORT_PCR_IRQC(11)
const uint32_t search_bits[] = {0x0000FFFF, 0x000000FF, 0x0000000F, 0x00000003, 0x00000001};
static void handle_interrupt_in(PORT_Type *port, int ch_base) {
uint32_t isfr;
uint8_t location;
while((isfr = port->ISFR) != 0) {
location = 0;
for (int i = 0; i < 5; i++) {
if (!(isfr & (search_bits[i] << location)))
location += 1 << (4 - i);
}
uint32_t id = channel_ids[ch_base + location];
if (id == 0) {
continue;
}
FGPIO_Type *gpio;
gpio_irq_event event = IRQ_NONE;
switch (port->PCR[location] & PORT_PCR_IRQC_MASK) {
case IRQ_RAISING_EDGE:
event = IRQ_RISE;
break;
case IRQ_FALLING_EDGE:
event = IRQ_FALL;
break;
case IRQ_EITHER_EDGE:
if (port == PORTA) {
gpio = FPTA;
} else if (port == PORTC) {
gpio = FPTC;
} else {
gpio = FPTD;
}
event = (gpio->PDIR & (1<<location)) ? (IRQ_RISE) : (IRQ_FALL);
break;
}
if (event != IRQ_NONE) {
irq_handler(id, event);
}
port->ISFR = 1 << location;
}
}
void gpio_irqA(void) {
handle_interrupt_in(PORTA, 0);
}
/* PORTC and PORTD share same vector */
void gpio_irqCD(void) {
if ((SIM->SCGC5 & SIM_SCGC5_PORTC_MASK) && (PORTC->ISFR)) {
handle_interrupt_in(PORTC, 32);
} else if ((SIM->SCGC5 & SIM_SCGC5_PORTD_MASK) && (PORTD->ISFR)) {
handle_interrupt_in(PORTD, 64);
}
}
int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id) {
if (pin == NC)
return -1;
irq_handler = handler;
obj->port = pin >> PORT_SHIFT;
obj->pin = (pin & 0x7F) >> 2;
uint32_t ch_base, vector;
IRQn_Type irq_n;
switch (obj->port) {
case PortA:
ch_base = 0; irq_n = PORTA_IRQn; vector = (uint32_t)gpio_irqA;
break;
case PortC:
ch_base = 32; irq_n = PORTC_PORTD_IRQn; vector = (uint32_t)gpio_irqCD;
break;
case PortD:
ch_base = 64; irq_n = PORTC_PORTD_IRQn; vector = (uint32_t)gpio_irqCD;
break;
default:
error("gpio_irq only supported on port A,C and D");
break;
}
NVIC_SetVector(irq_n, vector);
NVIC_EnableIRQ(irq_n);
obj->ch = ch_base + obj->pin;
channel_ids[obj->ch] = id;
return 0;
}
void gpio_irq_free(gpio_irq_t *obj) {
channel_ids[obj->ch] = 0;
}
void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable) {
PORT_Type *port = (PORT_Type *)(PORTA_BASE + 0x1000 * obj->port);
uint32_t irq_settings = IRQ_DISABLED;
switch (port->PCR[obj->pin] & PORT_PCR_IRQC_MASK) {
case IRQ_DISABLED:
if (enable) {
irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_FALLING_EDGE);
}
break;
case IRQ_RAISING_EDGE:
if (enable) {
irq_settings = (event == IRQ_RISE) ? (IRQ_RAISING_EDGE) : (IRQ_EITHER_EDGE);
} else {
if (event == IRQ_FALL)
irq_settings = IRQ_RAISING_EDGE;
}
break;
case IRQ_FALLING_EDGE:
if (enable) {
irq_settings = (event == IRQ_FALL) ? (IRQ_FALLING_EDGE) : (IRQ_EITHER_EDGE);
} else {
if (event == IRQ_RISE)
irq_settings = IRQ_FALLING_EDGE;
}
break;
case IRQ_EITHER_EDGE:
if (enable) {
irq_settings = IRQ_EITHER_EDGE;
} else {
irq_settings = (event == IRQ_RISE) ? (IRQ_FALLING_EDGE) : (IRQ_RAISING_EDGE);
}
break;
}
// Interrupt configuration and clear interrupt
port->PCR[obj->pin] = (port->PCR[obj->pin] & ~PORT_PCR_IRQC_MASK) | irq_settings | PORT_PCR_ISF_MASK;
}
void gpio_irq_enable(gpio_irq_t *obj) {
if (obj->port == PortA) {
NVIC_EnableIRQ(PORTA_IRQn);
} else {
NVIC_EnableIRQ(PORTC_PORTD_IRQn);
}
}
void gpio_irq_disable(gpio_irq_t *obj) {
if (obj->port == PortA) {
NVIC_DisableIRQ(PORTA_IRQn);
} else {
NVIC_DisableIRQ(PORTC_PORTD_IRQn);
}
}
|
/*
* Copyright 2015 Matthias Fuchs
*
* 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 STROMX_RUNTIME_MERGE_H
#define STROMX_RUNTIME_MERGE_H
#include "stromx/runtime/OperatorKernel.h"
#include <boost/assert.hpp>
namespace stromx
{
namespace runtime
{
class List;
/** \brief Merges over the entries of an input list. */
class STROMX_RUNTIME_API Merge : public OperatorKernel
{
public:
enum DataId
{
INPUT_DATA,
INPUT_NUM_ITEMS,
OUTPUT
};
Merge();
virtual OperatorKernel* clone() const { return new Merge; }
virtual void setParameter(const unsigned int id, const Data& value);
const DataRef getParameter(const unsigned int id) const;
virtual void execute(DataProvider& provider);
virtual void activate();
virtual void deactivate();
private:
static const std::vector<const Input*> setupInputs();
const std::vector<const Output*> setupOutputs() const;
static const std::string TYPE;
static const std::string PACKAGE;
static const Version VERSION;
uint64_t m_numItems;
List* m_list;
};
}
}
#endif // STROMX_RUNTIME_MERGE_H
|
#ifndef ARK_CORE_BASE_STATE_H_
#define ARK_CORE_BASE_STATE_H_
#include <unordered_map>
#include "core/forwarding.h"
#include "core/base/api.h"
#include "core/base/command.h"
#include "core/types/shared_ptr.h"
#include "core/types/weak_ptr.h"
namespace ark {
class ARK_API State {
public:
State(StateMachine& stateMachine, const sp<Runnable>& onActive, State* fallback = nullptr);
// [[script::bindings::property]]
bool active() const;
void activate();
void deactivate();
void activate(Command& command) const;
void deactivate(Command& command) const;
// [[script::bindings::auto]]
void linkCommand(Command& command);
// [[script::bindings::auto]]
void linkCommandGroup(CommandGroup& commandGroup);
int32_t resolveConflicts(const Command& command, Command::State state, Command::State toState) const;
private:
sp<Runnable> _on_active;
State* _fallback;
bool _active;
std::unordered_map<Command*, State*> _linked_commands;
friend class StateMachine;
};
}
#endif
|
/************************************************/
/* */
/* AIMP Programming Interface */
/* v3.60 build 1426 */
/* */
/* Artem Izmaylov */
/* (C) 2006-2015 */
/* www.aimp.ru */
/* ICQ: 345-908-513 */
/* Mail: support@aimp.ru */
/* */
/************************************************/
#ifndef apiTagEditorH
#define apiTagEditorH
#include <windows.h>
#include <unknwn.h>
#include <apiObjects.h>
#include <apiFileManager.h>
static const GUID IID_IAIMPFileTag = {0x41494D50, 0x4669, 0x6C65, 0x54, 0x61, 0x67, 0x00, 0x00, 0x00, 0x00, 0x00};
static const GUID IID_IAIMPFileTagEditor = {0x41494D50, 0x4669, 0x6C65, 0x54, 0x61, 0x67, 0x45, 0x64, 0x69, 0x74, 0x00};
static const GUID IID_IAIMPServiceFileTagEditor = {0x41494D50, 0x5372, 0x7654, 0x61, 0x67, 0x45, 0x64, 0x69, 0x74, 0x00, 0x00};
// PropertyID for the IAIMPFileTag
const int AIMP_FILETAG_PROPID_BASE = 100;
const int AIMP_FILETAG_PROPID_TAG_ID = AIMP_FILETAG_PROPID_BASE + 1;
const int AIMP_FILETAG_PROPID_DELETE_ON_SAVING = AIMP_FILETAG_PROPID_BASE + 2;
// IDs for IAIMPFileTag.AIMP_FILETAG_PROPID_TAG_ID
const int AIMP_FILETAG_ID_CUSTOM = 0;
const int AIMP_FILETAG_ID_APEv2 = 1;
const int AIMP_FILETAG_ID_ID3v1 = 2;
const int AIMP_FILETAG_ID_ID3v2 = 3;
const int AIMP_FILETAG_ID_MP4 = 4;
const int AIMP_FILETAG_ID_VORBIS = 5;
const int AIMP_FILETAG_ID_WMA = 6;
/* IAIMPFileTag */
class IAIMPFileTag: public IAIMPFileInfo
{
// Nothing
};
/* IAIMPFileTagEditor */
class IAIMPFileTagEditor: public IUnknown
{
public:
// Info
virtual HRESULT WINAPI GetMixedInfo(IAIMPFileInfo **Info) = 0;
virtual HRESULT WINAPI GetTag(int Index, REFIID IID, void **Obj) = 0;
virtual int WINAPI GetTagCount() = 0;
virtual HRESULT WINAPI SetToAll(IAIMPFileInfo *Info) = 0;
// Save
virtual HRESULT WINAPI Save() = 0;
};
/* IAIMPServiceFileTagEditor */
class IAIMPServiceFileTagEditor: public IUnknown
{
public:
virtual HRESULT WINAPI EditFile(IUnknown *Source, REFIID IID, void **Obj) = 0;
virtual HRESULT WINAPI EditTag(IUnknown *Source, int TagID, REFIID IID, void **Obj) = 0;
};
#endif // !apiTagEditorH
|
#ifndef PD_TCP_H_
#define PD_TCP_H_
#include "pd_define.h"
PD_CPP_START
struct PdIOComponent;
struct PdTcpIOComponent;
extern int pd_tcp_on_readable(struct PdIOComponent *ioc);
extern int pd_tcp_on_writeable(struct PdIOComponent *ioc);
extern void pd_tcp_on_error(struct PdIOComponent *ioc);
extern struct PdIOComponent *pd_tcp_ioc_alloc();
extern void pd_tcp_ioc_free(struct PdIOComponent *ioc);
////////////////////////////////////////////////////////////////////////////////////////////////////
extern int pd_tcp_post_packet(struct PdTcpIOComponent *tcp_ioc, const char *buffer, const int length);
PD_CPP_END
#endif
|
//
// HeaderInfoViewController.h
// IntegrityHelp
//
// Created by 小凡 on 2017/4/27.
// Copyright © 2017年 小凡. All rights reserved.
//
#import "BaseViewController.h"
typedef void(^CallBack)(NSString *);
@interface HeaderInfoViewController : BaseViewController
@property(nonatomic,strong)NSString *imageUrl;
@property(nonatomic,copy) CallBack callBack;
@end
|
//
// GameSceneViewController.h
// White collar
//
// Created by Alexander Popov on 2/10/15.
// Copyright (c) 2015 -. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface GameSceneViewController : UIViewController
@end
|
/* RSAREF.H - header file for RSAREF cryptographic toolkit
*/
/* Copyright (C) 1991-2 RSA Laboratories, a division of RSA Data
Security, Inc. All rights reserved.
*/
/* RSA key lengths.
*/
#ifndef RSAREF_H
#define RSAREF_H
#define MIN_RSA_MODULUS_BITS 32
#define MAX_RSA_MODULUS_BITS 1984 // 248*8 = 1984
#define MAX_RSA_MODULUS_LEN ((MAX_RSA_MODULUS_BITS + 7) / 8)
#define MAX_RSA_PRIME_BITS ((MAX_RSA_MODULUS_BITS + 1) / 2)
#define MAX_RSA_PRIME_LEN ((MAX_RSA_PRIME_BITS + 7) / 8)
/* Error codes.
*/
#define RE_CONTENT_ENCODING 0x0400
#define RE_DATA 0x0401
#define RE_DIGEST_ALGORITHM 0x0402
#define RE_ENCODING 0x0403
#define RE_KEY 0x0404
#define RE_KEY_ENCODING 0x0405
#define RE_LEN 0x0406
#define RE_MODULUS_LEN 0x0407
#define RE_NEED_RANDOM 0x0408
#define RE_PRIVATE_KEY 0x0409
#define RE_PUBLIC_KEY 0x040a
#define RE_SIGNATURE 0x040b
#define RE_SIGNATURE_ENCODING 0x040c
#define ERR_NOT_SORPORT 0x7f00
/* RSA public and private key.
*/
typedef struct {
unsigned short bits; /* length in bits of modulus */
unsigned char modulus[MAX_RSA_MODULUS_LEN]; /* modulus */
unsigned char exponent[MAX_RSA_MODULUS_LEN]; /* public exponent */
} R_RSA_PUBLIC_KEY;
typedef struct {
unsigned short bits; /* length in bits of modulus */
unsigned char modulus[MAX_RSA_MODULUS_LEN]; /* modulus */
unsigned char publicExponent[MAX_RSA_MODULUS_LEN]; /* public exponent */
unsigned char exponent[MAX_RSA_MODULUS_LEN]; /* private exponent */
unsigned char prime[2][MAX_RSA_PRIME_LEN]; /* prime factors */
unsigned char primeExponent[2][MAX_RSA_PRIME_LEN]; /* exponents for CRT */
unsigned char coefficient[MAX_RSA_PRIME_LEN]; /* CRT coefficient */
} R_RSA_PRIVATE_KEY;
/* RSA prototype key.
*/
typedef struct {
unsigned short bits; /* length in bits of modulus */
short useFermat4; /* public exponent (1 = F4, 0 = 3) */
} R_RSA_PROTO_KEY;
#ifdef __cplusplus
extern "C" {
#endif
/* Raw RSA public-key operation. Output has same length as modulus.
Assumes inputLen < length of modulus.
Requires input < modulus.
*/
// output; /* output block */
// outputLen; /* length of output block */
// input; /* input block */
// inputLen; /* length of input block */
// publicKey; /* RSA public key */
short RSAPublicBlock(unsigned char *output, unsigned short *outputLen,
unsigned char *input, unsigned short inputLen,
R_RSA_PUBLIC_KEY *publicKey);
/* Raw RSA private-key operation. Output has same length as modulus.
Assumes inputLen < length of modulus.
Requires input < modulus.
*/
// output; /* output block */
// outputLen; /* length of output block */
// input; /* input block */
// inputLen; /* length of input block */
// privateKey; /* RSA private key */
short RSAPrivateBlock(unsigned char *output, unsigned short *outputLen,
unsigned char *input, unsigned short inputLen,
R_RSA_PRIVATE_KEY *privateKey);
/* set public key
*/
// in : psModulus // RSA modulus
// pProtoKey // RSA modulus length & public exponent
// out : pPublicKey // RSA public key
short RSASetPublicKey(R_RSA_PUBLIC_KEY *pPublicKey, unsigned char *pModulus,
R_RSA_PROTO_KEY *pProtoKey);
/* set private key
*/
// in : psModulus // RSA modulus
// psPrivateExponent // d value
// pProtoKey // RSA modulus length & public exponent
// out : pPrivateKey // RSA private key
short RSASetPrivateKey(R_RSA_PRIVATE_KEY *pPrivateKey, unsigned char *psModulus,
unsigned char *psPrivateExponent, R_RSA_PROTO_KEY *pProtoKey);
/* Set private key
*/
// in : psModulus // RSA modulus
// p, q, dp, dq, qinv // RSA private crt key
// pProtoKey // RSA modulus length
// out : pPrivateKey // RSA private key
short RSASetPrivateKeyCRT(R_RSA_PRIVATE_KEY *pPrivateKey, unsigned char *psModulus,
unsigned char *p,
unsigned char *q,
unsigned char *dp,
unsigned char *dq,
unsigned char *qinv,
R_RSA_PROTO_KEY *pProtoKey);
#ifdef __cplusplus
};
#endif /* __cplusplus */
#endif
|
//
// AppDelegate.h
// TimerPause
//
// Created by Qinting on 16/4/14.
// Copyright © 2016年 Qinting. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#ifndef _EPOLL_UTILS_H_
#define _EPOLL_UTILS_H_
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <strings.h>
#include <fcntl.h>
#include <unistd.h>
#include <netinet/in.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/epoll.h>
using namespace std;
enum ERROR_CODE{
RET_OK = 0,
RET_ERR,
};
#define MAXLINE 512
#define OPEN_MAX 100
#define LISTENQ 20
#define SERV_PORT 9876
#define INFTIM 1000
#define BUFSIZE 512
#endif
|
//
// AdProBannerView.h
// AdSDK
//
// Created by luo on 15/12/2.
// Copyright © 2015年 Goyoo. All rights reserved.
//
#import <UIKit/UIKit.h>
#define ADPRO_AD_SIZE_320x50 CGSizeMake(320, 50) // For iPhone
#define ADPRO_AD_SIZE_468x60 CGSizeMake(468, 60) // For iPad
#define ADPRO_AD_SIZE_768x90 CGSizeMake(768, 90) // For iPad
#define ADPRO_AD_SIZE_FULL_WIDTH_WITH_HEIGHT(height) CGSizeMake([UIScreen mainScreen].bounds.size.width, height)
@protocol AdProBannerViewDelegate;
@interface AdProBannerView : UIView
/// Initializes a AdProBannerView and sets it to the specified size, and specifies its placement
/// within its superview bounds. Returns nil if |adSize| is an invalid ad size.
- (instancetype)initWithAppID:(NSString *)appID appKey:(NSString *)appKey slotID:(NSString *)slotID adSize:(CGSize)adSize origin:(CGPoint)origin;
/// Optional delegate object that receives state change notifications from this AdProBannerView.
/// Remember to nil this property before deallocating the delegate.
@property (nonatomic, weak) IBOutlet id <AdProBannerViewDelegate> delegate;
/// Required reference to the current view controller.
@property (nonatomic, weak) IBOutlet UIViewController *rootViewController;
/// Download ad data
- (void)loadAd;
@end
/// Delegate methods for receiving AdProBannerView state change messages such as ad request status
/// and ad click lifecycle.
@protocol AdProBannerViewDelegate <NSObject>
@optional
#pragma mark Ad Request Lifecycle Notifications
/// Tells the delegate that an ad request successfully received an ad. The delegate may want to add
/// the banner view to the view hierarchy if it hasn't been added yet.
- (void)AdProBannerViewDidReceiveAd:(AdProBannerView *)bannerView;
/// Tells the delegate that an ad request failed. The failure is normally due to network
/// connectivity or ad availablility (i.e., no fill).
- (void)AdProBannerView:(AdProBannerView *)bannerView didFailToReceiveAdWithError:(NSError *)error;
#pragma mark Click-Time Lifecycle Notifications
/// Tells the delegate that a full screen view will be presented in response to the user clicking on
/// an ad. The delegate may want to pause animations and time sensitive interactions.
- (void)AdProBannerViewWillPresentScreen:(AdProBannerView *)bannerView;
/// Tells the delegate that the full screen view has been dismissed. The delegate should restart
/// anything paused while handling AdProBannerViewWillPresentScreen:.
- (void)AdProBannerViewDidDismissScreen:(AdProBannerView *)bannerView;
/// Tells the delegate that the user click will open another app, backgrounding the current
/// application. The standard UIApplicationDelegate methods, like applicationDidEnterBackground:,
/// are called immediately after this method is called.
- (void)AdProBannerViewWillLeaveApplication:(AdProBannerView *)bannerView;
@end
|
#pragma once
#include <string>
#include "envoy/network/address.h"
#include "envoy/network/transport_socket.h"
namespace Envoy {
namespace Network {
namespace Test {
/**
* Determines if the passed in address and port is available for binding. If the port is zero,
* the OS should pick an unused port for the supplied address (e.g. for the loopback address).
* NOTE: this is racy, as it does not provide a means to keep the port reserved for the
* caller's use.
* @param addr_port a valid host address (e.g. an address of one of the network interfaces
* of this host, or the any address or the loopback address) and port (zero to indicate
* that the OS should pick an unused address.
* @param type the type of socket to be tested.
* @returns the address and port (selected if zero was the passed in port) that can be used for
* listening, else nullptr if the address and port are not free.
*/
Address::InstanceConstSharedPtr findOrCheckFreePort(Address::InstanceConstSharedPtr addr_port,
Address::SocketType type);
/**
* As above, but addr_port is specified as a string. For example:
* - 127.0.0.1:32000 Check whether a specific port on the IPv4 loopback address is free.
* - [::1]:0 Pick a free port on the IPv6 loopback address.
* - 0.0.0.0:0 Pick a free port on all local addresses of all local interfaces.
* - [::]:45678 Check whether a specific port on all local IPv6 addresses is free.
*/
Address::InstanceConstSharedPtr findOrCheckFreePort(const std::string& addr_port,
Address::SocketType type);
/**
* Get a URL ready IP loopback address as a string.
* @param version IP address version of loopback address.
* @return std::string URL ready loopback address as a string.
*/
const std::string getLoopbackAddressUrlString(const Address::IpVersion version);
/**
* Get a IP loopback address as a string. There are no square brackets around IPv6 addresses, this
* is what inet_ntop() gives.
* @param version IP address version of loopback address.
* @return std::string loopback address as a string.
*/
const std::string getLoopbackAddressString(const Address::IpVersion version);
/**
* Get a URL ready IP any address as a string.
* @param version IP address version of any address.
* @return std::string URL ready any address as a string.
*/
const std::string getAnyAddressUrlString(const Address::IpVersion version);
/**
* Return a string version of enum IpVersion version.
* @param version IP address version.
* @return std::string string version of IpVersion.
*/
const std::string addressVersionAsString(const Address::IpVersion version);
/**
* Returns a loopback address for the specified IP version (127.0.0.1 for IPv4 and ::1 for IPv6).
* @param version the IP version of the loopback address.
* @returns a loopback address for the specified IP version.
*/
Address::InstanceConstSharedPtr getCanonicalLoopbackAddress(const Address::IpVersion version);
/**
* Returns the any address for the specified IP version.
* @param version the IP version of the any address.
* @param v4_compat determines whether a v4-mapped addresses bound to a socket listening on the
* returned ANY address are to be treated as IPv4 or IPv6 addresses. Defaults to 'false',
* has no effect with IPv4 ANY address.
* @returns the any address for the specified IP version.
*/
Address::InstanceConstSharedPtr getAnyAddress(const Address::IpVersion version,
bool v4_compat = false);
/**
* This function tries to create a socket of type IpVersion version and bind to it. If
* successful this function returns true. If either socket creation or socket
* bind fail, this function returns false.
* @param version the IP verson to test.
* @return bool whether IpVersion addresses are "supported".
*/
bool supportsIpVersion(const Address::IpVersion version);
/**
* Bind a socket to a free port on a loopback address, and return the socket's fd and bound address.
* Enables a test server to reliably "select" a port to listen on. Note that the socket option
* SO_REUSEADDR has NOT been set on the socket.
* @param version the IP version of the loopback address.
* @param type the type of socket to be bound.
* @returns the address and the fd of the socket bound to that address.
*/
std::pair<Address::InstanceConstSharedPtr, int> bindFreeLoopbackPort(Address::IpVersion version,
Address::SocketType type);
/**
* Create a transport socket for testing purposes.
* @return TransportSocketPtr the transport socket factory to use with a connection.
*/
TransportSocketPtr createRawBufferSocket();
/**
* Create a transport socket factory for testing purposes.
* @return TransportSocketFactoryPtr the transport socket factory to use with a cluster or a
* listener.
*/
TransportSocketFactoryPtr createRawBufferSocketFactory();
} // namespace Test
} // namespace Network
} // namespace Envoy
|
//
// ANYPlaybackView.h
// buxinteng
//
// Created by Anyson Chan on 15/11/17.
// Copyright © 2015年 Anyson Chan. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CircleProgressView.h"
#import "ANYMusicLRCView.h"
@class ANYPlaybackView;
@protocol ANYPlaybackViewDelegate <NSObject>
- (void)playbackViewPressPlayBtn:(ANYPlaybackView *)playbackView;
- (void)playbackViewPressNextBtn:(ANYPlaybackView *)playbackView;
- (void)playbackViewPressHateBtn:(ANYPlaybackView *)playbackView;
- (void)playbackViewPressLikeBtn:(ANYPlaybackView *)playbackView likeFlag:(BOOL)isLike;
@end
@interface ANYPlaybackView : UIView
@property(nonatomic, weak) id<ANYPlaybackViewDelegate> delegate;
@property(nonatomic, strong) CircleProgressView *progressView;
@property(nonatomic, strong) UIImageView *artworkView;
@property(nonatomic, strong) UILabel *titleLabel;
@property(nonatomic, strong) UILabel *artistLabel;
@property(nonatomic, strong) UIButton *playBtn;
@property(nonatomic, strong) UIButton *nextBtn;
@property(nonatomic, strong) UIButton *likeBtn;
@property(nonatomic, strong) UIButton *hateBtn;
@property(nonatomic, strong) ANYMusicLRCView *lrcView;
- (void)enable:(BOOL)enable;
- (void)interrupt;
- (void)resume;
- (void)playOrPause;
@end
|
/*
*
* Copyright 2017 Asylo authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#ifndef ASYLO_PLATFORM_POSIX_IO_SECURE_PATHS_H_
#define ASYLO_PLATFORM_POSIX_IO_SECURE_PATHS_H_
#include "asylo/platform/posix/io/io_manager.h"
namespace asylo {
namespace io {
// IOContext implementation wrapping a stream managed by the secure I/O layer.
class IOContextSecure : public IOManager::IOContext {
public:
// Factory method to create an instance of the class.
static std::unique_ptr<IOManager::IOContext> Create(const char *path,
int flags, mode_t mode) {
int host_fd = platform::storage::secure_open(path, flags, mode);
if (host_fd == -1) {
return nullptr;
}
return std::unique_ptr<IOManager::IOContext>(new IOContextSecure(host_fd));
}
protected:
ssize_t Read(void *buf, size_t count) override;
ssize_t Write(const void *buf, size_t count) override;
int Close() override;
int LSeek(off_t offset, int whence) override;
int FSync() override;
int FStat(struct stat *st) override;
int Isatty() override;
int Ioctl(int request, void *argp) override;
private:
explicit IOContextSecure(int host_fd) : host_fd_(host_fd) {}
// Host-provided file descriptor of the backing store.
int host_fd_;
};
} // namespace io
} // namespace asylo
#endif // ASYLO_PLATFORM_POSIX_IO_SECURE_PATHS_H_
|
// NOTE: This file was generated by the ServiceGenerator.
// ----------------------------------------------------------------------------
// API:
// API Gateway API (apigateway/v1)
// Documentation:
// https://cloud.google.com/api-gateway/docs
#if SWIFT_PACKAGE || GTLR_USE_MODULAR_IMPORT
@import GoogleAPIClientForRESTCore;
#elif GTLR_BUILT_AS_FRAMEWORK
#import "GTLR/GTLRService.h"
#else
#import "GTLRService.h"
#endif
#if GTLR_RUNTIME_VERSION != 3000
#error This file was generated by a different version of ServiceGenerator which is incompatible with this GTLR library source.
#endif
// Generated comments include content from the discovery document; avoid them
// causing warnings since clang's checks are some what arbitrary.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdocumentation"
NS_ASSUME_NONNULL_BEGIN
// ----------------------------------------------------------------------------
// Authorization scope
/**
* Authorization scope: See, edit, configure, and delete your Google Cloud data
* and see the email address for your Google Account.
*
* Value "https://www.googleapis.com/auth/cloud-platform"
*/
FOUNDATION_EXTERN NSString * const kGTLRAuthScopeAPIGatewayCloudPlatform;
// ----------------------------------------------------------------------------
// GTLRAPIGatewayService
//
/**
* Service for executing API Gateway API queries.
*/
@interface GTLRAPIGatewayService : GTLRService
// No new methods
// Clients should create a standard query with any of the class methods in
// GTLRAPIGatewayQuery.h. The query can the be sent with GTLRService's execute
// methods,
//
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// completionHandler:(void (^)(GTLRServiceTicket *ticket,
// id object, NSError *error))handler;
// or
// - (GTLRServiceTicket *)executeQuery:(GTLRQuery *)query
// delegate:(id)delegate
// didFinishSelector:(SEL)finishedSelector;
//
// where finishedSelector has a signature of:
//
// - (void)serviceTicket:(GTLRServiceTicket *)ticket
// finishedWithObject:(id)object
// error:(NSError *)error;
//
// The object passed to the completion handler or delegate method
// is a subclass of GTLRObject, determined by the query method executed.
@end
NS_ASSUME_NONNULL_END
#pragma clang diagnostic pop
|
//
// AppDelegate.h
// VideoTest
//
// Created by Windy on 2016/11/7.
// Copyright © 2016年 Windy. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
// UIImage+Alpha.h
// Created by Trevor Harmon on 9/20/09.
// Free for personal or commercial use, with or without modification.
// No warranty is expressed or implied.
// NOTE: pingoGame modified to convert from Category to
// new Class name since iPhone seems to have some issues with Categories
// of built in Classes
// Helper methods for adding an alpha layer to an image
@interface UIImageAlpha : NSObject
{
}
+ (BOOL)hasAlpha:(UIImage*)image;
+ (UIImage *)imageWithAlpha:(UIImage*)image;
+ (UIImage *)transparentBorderImage:(NSUInteger)borderSize image:(UIImage*)image;
@end
|
/*
* @file low.h
* @brief PSEC Library
* HASH [Blake2] low level interface header
*
* Date: 03-09-2014
*
* Copyright 2014 Pedro A. Hortas (pah@ucodev.org)
*
* 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 LIBPSEC_BLAKE2_LOW_H
#define LIBPSEC_BLAKE2_LOW_H
#include <stdio.h>
#include "blake2.h"
/* Blake2b Low Level Interface */
int blake2b_low_init(blake2b_state *context);
int blake2b_low_init_key(blake2b_state *context, const unsigned char *key, size_t key_len);
int blake2b_low_update(blake2b_state *context, const unsigned char *in, size_t in_len);
int blake2b_low_final(blake2b_state *context, unsigned char *out);
/* Blake2s Low Level Interface */
int blake2s_low_init(blake2s_state *context);
int blake2s_low_init_key(blake2s_state *context, const unsigned char *key, size_t key_len);
int blake2s_low_update(blake2s_state *context, const unsigned char *in, size_t in_len);
int blake2s_low_final(blake2s_state *context, unsigned char *out);
#endif
|
/**
* Copyright (C) 2013 kangliqiang ,kangliq@163.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 __TRANSACTIONMQPRODUCER_H__
#define __TRANSACTIONMQPRODUCER_H__
#include "DefaultMQProducer.h"
#include "DefaultMQProducerImpl.h"
#include "MQClientException.h"
namespace rmq
{
/**
* Ö§³Ö·Ö²¼Ê½ÊÂÎñProducer
*
*/
class TransactionMQProducer : public DefaultMQProducer
{
public:
TransactionMQProducer()
: m_pTransactionCheckListener(NULL),
m_checkThreadPoolMinSize(1),
m_checkThreadPoolMaxSize(1),
m_checkRequestHoldMax(2000)
{
}
TransactionMQProducer(const std::string& producerGroup)
: DefaultMQProducer(producerGroup),
m_pTransactionCheckListener(NULL),
m_checkThreadPoolMinSize(1),
m_checkThreadPoolMaxSize(1),
m_checkRequestHoldMax(2000)
{
}
void start()
{
m_pDefaultMQProducerImpl->initTransactionEnv();
DefaultMQProducer::start();
}
void shutdown()
{
DefaultMQProducer::shutdown();
m_pDefaultMQProducerImpl->destroyTransactionEnv();
}
TransactionSendResult sendMessageInTransaction(const Message& msg,
LocalTransactionExecuter* tranExecuter, void* arg)
{
if (NULL == m_pTransactionCheckListener)
{
THROW_MQEXCEPTION("localTransactionBranchCheckListener is null", -1);
}
return m_pDefaultMQProducerImpl.sendMessageInTransaction(msg, tranExecuter, arg);
}
TransactionCheckListener* getTransactionCheckListener()
{
return m_pTransactionCheckListener;
}
void setTransactionCheckListener(TransactionCheckListener* pTransactionCheckListener)
{
m_pTransactionCheckListener = pTransactionCheckListener;
}
int getCheckThreadPoolMinSize()
{
return m_checkThreadPoolMinSize;
}
void setCheckThreadPoolMinSize(int checkThreadPoolMinSize)
{
m_checkThreadPoolMinSize = checkThreadPoolMinSize;
}
int getCheckThreadPoolMaxSize()
{
return m_checkThreadPoolMaxSize;
}
void setCheckThreadPoolMaxSize(int checkThreadPoolMaxSize)
{
m_checkThreadPoolMaxSize = checkThreadPoolMaxSize;
}
int getCheckRequestHoldMax()
{
return m_checkRequestHoldMax;
}
void setCheckRequestHoldMax(int checkRequestHoldMax)
{
m_checkRequestHoldMax = checkRequestHoldMax;
}
private:
TransactionCheckListener* m_pTransactionCheckListener;
int m_checkThreadPoolMinSize;///< ÊÂÎñ»Ø²é×îС²¢·¢Êý
int m_checkThreadPoolMaxSize;///< ÊÂÎñ»Ø²é×î´ó²¢·¢Êý
int m_checkRequestHoldMax;///< ÊÂÎñ»Ø²é¶ÓÁÐÊý
};
}
#endif
|
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
FOUNDATION_EXPORT double Pods_Giotto_ExampleVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_Giotto_ExampleVersionString[];
|
/*
* Copyright 2013 Simone Campagna
*
* 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 configment_min_max_checker_h_20310505
#define configment_min_max_checker_h_20310505
#include<sstream>
#include <configment/configment.h>
#include <configment/debug.h>
#include <configment/error.h>
#include <configment/object.h>
#include <configment/checker.h>
namespace configment
{
template<typename M, typename V>
class MinMaxChecker : public Checker
{
public:
typedef M min_max_type;
typedef V value_type;
private:
min_max_type _min;
bool_type _has_min;
min_max_type _max;
bool_type _has_max;
protected:
virtual min_max_type _v2m(const value_type & value) const =0;
virtual value_type _o2v(const Object & value) const =0;
public:
MinMaxChecker() : _min(), _has_min(false), _max(), _has_max(false) { }
MinMaxChecker(const M & min) : _min(min), _has_min(true), _max(), _has_max(false) { }
MinMaxChecker(const M & min, const M & max) : _min(min), _has_min(true), _max(max), _has_max(true) { }
virtual ~MinMaxChecker() { }
/*virtual*/ void check(const Object & o) const
{
const value_type & value = this->_o2v(o);
this->check_min_max(value);
}
virtual void check_min_max(const value_type & value) const
{
if(this->_has_min || this->_has_max)
{
M m = this->_v2m(value);
if(this->_has_min && this->_min > m)
{
std::ostringstream os;
os << "Invalid value " << value << "; it is lower than min " << this->_min;
throw KeyValidationError(DEBUG_INFO, os.str());
}
if(this->_has_max && this->_max < m)
{
std::ostringstream os;
os << "Invalid value " << value << "; it is greater than max " << this->_max;
throw KeyValidationError(DEBUG_INFO, os.str());
}
}
}
/*virtual*/ void _set_nominal_arg(const str_type & arg, const Object & value)
{
if(arg == "min")
{
if(this->_has_min)
{
throw CheckerError(DEBUG_INFO, "argument <min> already has a value");
}
//std::cout << "setting min..." << std::endl;
this->_min = M(value);
this->_has_min = true;
return;
}
else if(arg == "max")
{
if(this->_has_max)
{
throw CheckerError(DEBUG_INFO, "argument <max> already has a value");
}
//std::cout << "setting max..." << std::endl;
this->_max = M(value);
this->_has_max = true;
}
else
{
this->invalid_arg_name(arg);
}
}
/*virtual*/ void _set_positional_arg(const Object & value)
{
if(! this->_has_min)
{
this->_set_nominal_arg("min", value);
}
else if(! this->_has_max)
{
this->_set_nominal_arg("max", value);
}
else
{
this->invalid_arg(value);
}
}
/*virtual*/ std::ostream & str_s(std::ostream & os) const
{
os << this->checker_name() << '(';
str_type sep = "";
if(this->_has_min)
{
os << "min=" << this->_min;
sep = ", ";
}
if(this->_has_max)
{
os << sep << "max=" << this->_max;
sep = ", ";
sep = ", ";
}
if(this->_has_default)
{
os << sep << "default=";
this->_default.grepr_s(os, ReprType::CONFIGSPEC);
}
os << ')';
return os;
}
};
} // namespace configment
#endif // ifndef configment_min_max_checker_h_20310505
|
/* ========================================
*
* Copyright YOUR COMPANY, THE YEAR
* All Rights Reserved
* UNPUBLISHED, LICENSED SOFTWARE.
*
* CONFIDENTIAL AND PROPRIETARY INFORMATION
* WHICH IS THE PROPERTY OF your company.
*
* ========================================
*/
#include <project.h>
#include "isr_Ultrasonic_Maxbotix.h"
void Ultrasonic_Maxbotix_Start();
//uint32 Ultrasonic_Maxbotix_Take_Reading();
//uint32 Ultrasonic_Maxbotix_Convert_Raw_Reading(uint8* raw);
struct {
uint32 depth;
uint8 valid;
}typedef MaxbotixUltrasonic;
MaxbotixUltrasonic Ultrasonic_Maxbotix_Take_Reading();
MaxbotixUltrasonic Ultrasonic_Maxbotix_Convert_Raw_Reading(uint8* raw_M);
|
/** @file
A brief file description
@section license License
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#pragma once
#include "I_VIO.h"
TS_INLINE
VIO::VIO(int aop) : _cont(nullptr), nbytes(0), ndone(0), op(aop), buffer(), vc_server(nullptr), mutex(nullptr) {}
/////////////////////////////////////////////////////////////
//
// VIO::VIO()
//
/////////////////////////////////////////////////////////////
TS_INLINE
VIO::VIO() : _cont(nullptr), nbytes(0), ndone(0), op(VIO::NONE), buffer(), vc_server(nullptr), mutex(nullptr) {}
TS_INLINE Continuation *
VIO::get_continuation()
{
return _cont;
}
TS_INLINE void
VIO::set_writer(MIOBuffer *writer)
{
buffer.writer_for(writer);
}
TS_INLINE void
VIO::set_reader(IOBufferReader *reader)
{
buffer.reader_for(reader);
}
TS_INLINE MIOBuffer *
VIO::get_writer()
{
return buffer.writer();
}
TS_INLINE IOBufferReader *
VIO::get_reader()
{
return (buffer.reader());
}
TS_INLINE int64_t
VIO::ntodo()
{
return nbytes - ndone;
}
TS_INLINE void
VIO::done()
{
if (buffer.reader()) {
nbytes = ndone + buffer.reader()->read_avail();
} else {
nbytes = ndone;
}
}
/////////////////////////////////////////////////////////////
//
// VIO::set_continuation()
//
/////////////////////////////////////////////////////////////
TS_INLINE void
VIO::set_continuation(Continuation *acont)
{
if (vc_server) {
vc_server->set_continuation(this, acont);
}
if (acont) {
mutex = acont->mutex;
_cont = acont;
} else {
mutex = nullptr;
_cont = nullptr;
}
return;
}
/////////////////////////////////////////////////////////////
//
// VIO::reenable()
//
/////////////////////////////////////////////////////////////
TS_INLINE void
VIO::reenable()
{
if (vc_server) {
vc_server->reenable(this);
}
}
/////////////////////////////////////////////////////////////
//
// VIO::reenable_re()
//
/////////////////////////////////////////////////////////////
TS_INLINE void
VIO::reenable_re()
{
if (vc_server) {
vc_server->reenable_re(this);
}
}
|
/*
* Copyright 2015-present Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <folly/ThreadLocal.h>
#include <folly/synchronization/AsymmetricMemoryBarrier.h>
namespace folly {
class TLRefCount {
public:
using Int = int64_t;
TLRefCount()
: localCount_([&]() { return new LocalRefCount(*this); }),
collectGuard_(this, [](void*) {}) {}
~TLRefCount() noexcept {
assert(globalCount_.load() == 0);
assert(state_.load() == State::GLOBAL);
}
// This can't increment from 0.
Int operator++() noexcept {
auto& localCount = *localCount_;
if (++localCount) {
return 42;
}
if (state_.load() == State::GLOBAL_TRANSITION) {
std::lock_guard<std::mutex> lg(globalMutex_);
}
assert(state_.load() == State::GLOBAL);
auto value = globalCount_.load();
do {
if (value == 0) {
return 0;
}
} while (!globalCount_.compare_exchange_weak(value, value+1));
return value + 1;
}
Int operator--() noexcept {
auto& localCount = *localCount_;
if (--localCount) {
return 42;
}
if (state_.load() == State::GLOBAL_TRANSITION) {
std::lock_guard<std::mutex> lg(globalMutex_);
}
assert(state_.load() == State::GLOBAL);
return globalCount_-- - 1;
}
Int operator*() const {
if (state_ != State::GLOBAL) {
return 42;
}
return globalCount_.load();
}
void useGlobal() noexcept {
std::array<TLRefCount*, 1> ptrs{{this}};
useGlobal(ptrs);
}
template <typename Container>
static void useGlobal(const Container& refCountPtrs) {
#ifdef FOLLY_SANITIZE_THREAD
// TSAN has a limitation for the number of locks held concurrently, so it's
// safer to call useGlobal() serially.
if (refCountPtrs.size() > 1) {
for (auto refCountPtr : refCountPtrs) {
refCountPtr->useGlobal();
}
return;
}
#endif
std::vector<std::unique_lock<std::mutex>> lgs_;
for (auto refCountPtr : refCountPtrs) {
lgs_.emplace_back(refCountPtr->globalMutex_);
refCountPtr->state_ = State::GLOBAL_TRANSITION;
}
asymmetricHeavyBarrier();
for (auto refCountPtr : refCountPtrs) {
std::weak_ptr<void> collectGuardWeak = refCountPtr->collectGuard_;
// Make sure we can't create new LocalRefCounts
refCountPtr->collectGuard_.reset();
while (!collectGuardWeak.expired()) {
auto accessor = refCountPtr->localCount_.accessAllThreads();
for (auto& count : accessor) {
count.collect();
}
}
refCountPtr->state_ = State::GLOBAL;
}
}
private:
using AtomicInt = std::atomic<Int>;
enum class State {
LOCAL,
GLOBAL_TRANSITION,
GLOBAL
};
class LocalRefCount {
public:
explicit LocalRefCount(TLRefCount& refCount) :
refCount_(refCount) {
std::lock_guard<std::mutex> lg(refCount.globalMutex_);
collectGuard_ = refCount.collectGuard_;
}
~LocalRefCount() {
collect();
}
void collect() {
std::lock_guard<std::mutex> lg(collectMutex_);
if (!collectGuard_) {
return;
}
collectCount_ = count_.load();
refCount_.globalCount_.fetch_add(collectCount_);
collectGuard_.reset();
}
bool operator++() {
return update(1);
}
bool operator--() {
return update(-1);
}
private:
bool update(Int delta) {
if (UNLIKELY(refCount_.state_.load() != State::LOCAL)) {
return false;
}
// This is equivalent to atomic fetch_add. We know that this operation
// is always performed from a single thread. asymmetricLightBarrier()
// makes things faster than atomic fetch_add on platforms with native
// support.
auto count = count_.load(std::memory_order_relaxed) + delta;
count_.store(count, std::memory_order_relaxed);
asymmetricLightBarrier();
if (UNLIKELY(refCount_.state_.load() != State::LOCAL)) {
std::lock_guard<std::mutex> lg(collectMutex_);
if (collectGuard_) {
return true;
}
if (collectCount_ != count) {
return false;
}
}
return true;
}
AtomicInt count_{0};
TLRefCount& refCount_;
std::mutex collectMutex_;
Int collectCount_{0};
std::shared_ptr<void> collectGuard_;
};
std::atomic<State> state_{State::LOCAL};
folly::ThreadLocal<LocalRefCount, TLRefCount> localCount_;
std::atomic<int64_t> globalCount_{1};
std::mutex globalMutex_;
std::shared_ptr<void> collectGuard_;
};
} // namespace folly
|
//
// main.c
// 13【掌握】指针变量的初始化和引用
//
// Created by 高明辉 on 15/12/28.
// Copyright © 2015年 itcast. All rights reserved.
//
#include <stdio.h>
int main(int argc, const char * argv[]) {
/*
指针的初始化也分为两种方式:
1、定义的同时初始化
2、先定义后初始化
注意:
常见的做法:在定义万指针后,紧接着将其赋值为NULL,目的就是不让指针乱指。
因为申请的空间中有可能有垃圾值,如果使用了,那么就访问到了不确定的内存,会得倒垃圾值(随机值)。
野指针
不确定指向哪里的指针
后果:
访问到随机值(垃圾值),导致程序一场甚至崩溃。
*/
//定义的同时初始化
int a = 5;
int *p1 = &a;
//先定义后初始化
int b;
int *p2;
p2=&b;
// 常见推荐做法:
int *p3 = NULL ;
// 相当于 int p3 = 0; // 因为地址也是一个整数。但不能赋其它的整数值!
// int *p3 = 10000;// 错误!
int *p;
printf("%d\n",*p);// 得到一个随机值,因此就是野指针。指向哪里,不知道!
return 0;
}
|
////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER
///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
///
/// Licensed under the Apache License, Version 2.0 (the "License");
/// you may not use this file except in compliance with the License.
/// You may obtain a copy of the License at
///
/// http://www.apache.org/licenses/LICENSE-2.0
///
/// Unless required by applicable law or agreed to in writing, software
/// distributed under the License is distributed on an "AS IS" BASIS,
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
/// See the License for the specific language governing permissions and
/// limitations under the License.
///
/// Copyright holder is ArangoDB GmbH, Cologne, Germany
///
/// @author Dr. Frank Celler
////////////////////////////////////////////////////////////////////////////////
#ifndef ARANGODB_BASICS_CSV_H
#define ARANGODB_BASICS_CSV_H 1
#include "Basics/Common.h"
////////////////////////////////////////////////////////////////////////////////
/// @brief parser states
////////////////////////////////////////////////////////////////////////////////
typedef enum {
TRI_CSV_PARSER_BOL,
TRI_CSV_PARSER_BOL2,
TRI_CSV_PARSER_BOF,
TRI_CSV_PARSER_WITHIN_FIELD,
TRI_CSV_PARSER_WITHIN_QUOTED_FIELD,
TRI_CSV_PARSER_CORRUPTED
} TRI_csv_parser_states_e;
////////////////////////////////////////////////////////////////////////////////
/// @brief template for CSV parser
////////////////////////////////////////////////////////////////////////////////
typedef struct TRI_csv_parser_s {
TRI_csv_parser_states_e _state;
char _quote;
char _separator;
bool _useQuote;
bool _useBackslash;
char* _begin; // beginning of the input buffer
char* _start; // start of the unproccessed part
char* _written; // pointer to currently written character
char* _current; // pointer to currently processed character
char* _stop; // end of unproccessed part
char* _end; // end of the input buffer
size_t _row;
size_t _column;
void* _dataBegin;
void* _dataAdd;
void* _dataEnd;
void (*begin)(struct TRI_csv_parser_s*, size_t row);
void (*add)(struct TRI_csv_parser_s*, char const*, size_t, size_t row,
size_t column, bool escaped);
void (*end)(struct TRI_csv_parser_s*, char const*, size_t, size_t row,
size_t column, bool escaped);
size_t _nResize;
size_t _nMemmove;
size_t _nMemcpy;
void* _data;
} TRI_csv_parser_t;
////////////////////////////////////////////////////////////////////////////////
/// @brief inits a CSV parser
////////////////////////////////////////////////////////////////////////////////
void TRI_InitCsvParser(
TRI_csv_parser_t*, void (*)(TRI_csv_parser_t*, size_t),
void (*)(TRI_csv_parser_t*, char const*, size_t, size_t, size_t, bool),
void (*)(TRI_csv_parser_t*, char const*, size_t, size_t, size_t, bool),
void* vData);
////////////////////////////////////////////////////////////////////////////////
/// @brief destroys a CSV parser
////////////////////////////////////////////////////////////////////////////////
void TRI_DestroyCsvParser(TRI_csv_parser_t* parser);
////////////////////////////////////////////////////////////////////////////////
/// @brief set the separator
///
/// note that the separator string must be valid until the parser is destroyed
////////////////////////////////////////////////////////////////////////////////
void TRI_SetSeparatorCsvParser(TRI_csv_parser_t* parser, char separator);
////////////////////////////////////////////////////////////////////////////////
/// @brief set the quote character
////////////////////////////////////////////////////////////////////////////////
void TRI_SetQuoteCsvParser(TRI_csv_parser_t* parser, char quote, bool useQuote);
////////////////////////////////////////////////////////////////////////////////
/// @brief whether or not a backslash is used to escape quotes
////////////////////////////////////////////////////////////////////////////////
void TRI_UseBackslashCsvParser(TRI_csv_parser_t* parser, bool value);
////////////////////////////////////////////////////////////////////////////////
/// @brief parses a CSV line
////////////////////////////////////////////////////////////////////////////////
int TRI_ParseCsvString(TRI_csv_parser_t*, char const*, size_t);
#endif
|
//
// XMPPUnReadMessageCoreDataStorageObject.h
// XMPP_Project
//
// Created by Peter Lee on 14/10/21.
// Copyright (c) 2014年 Peter Lee. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
@interface XMPPUnReadMessageCoreDataStorageObject : NSManagedObject
@property (nonatomic, retain) NSString * bareJidStr;
@property (nonatomic, retain) NSString * streamBareJidStr;
@property (nonatomic, retain) NSNumber * unReadCount;
+ (id)insertInManagedObjectContext:(NSManagedObjectContext *)moc
withUserJIDstr:(NSString *)jidStr
unReadMessageCount:(NSUInteger)unReatCount
streamBareJidStr:(NSString *)streamBareJidStr;
+ (BOOL)deleteObjectInManagedObjectContext:(NSManagedObjectContext *)moc
withUserJIDstr:(NSString *)jidStr
streamBareJidStr:(NSString *)streamBareJidStr;
+ (BOOL)updateOrInsertObjectInManagedObjectContext:(NSManagedObjectContext *)moc
withUserJIDstr:(NSString *)jidStr
unReadMessageCount:(NSUInteger)unReadCount
streamBareJidStr:(NSString *)streamBareJidStr;
+ (BOOL)editObjectInManagedObjectContext:(NSManagedObjectContext *)moc
withUserJIDstr:(NSString *)jidStr
nReadMessageCount:(NSUInteger)unReadCount
streamBareJidStr:(NSString *)streamBareJidStr;
+ (id)obejctInManagedObjectContext:(NSManagedObjectContext *)moc
withUserJIDStr:(NSString *)jidStr
streamBareJidStr:(NSString *)streamBareJidStr;
+ (BOOL)readObjectInManagedObjectContext:(NSManagedObjectContext *)moc
withUserJIDstr:(NSString *)jidStr
streamBareJidStr:(NSString *)streamBareJidStr;
@end
|
/**
* Copyright (c) 2014 Netheos (http://www.netheos.net)
*
* 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 INCLUDE_PCS_API_C_FOLDER_H_
#define INCLUDE_PCS_API_C_FOLDER_H_
#include "boost/date_time/posix_time/posix_time_types.hpp"
#include "pcs_api/c_file.h"
namespace pcs_api {
/**
* \brief Object for representation of a remote folder.
*/
class CFolder : public CFile {
public:
CFolder(CPath path, ::boost::posix_time::ptime modif_date);
private:
void DoToString(std::ostream *) const override;
bool IsBlobType() const override;
};
} // namespace pcs_api
#endif // INCLUDE_PCS_API_C_FOLDER_H_
|
//
// XPBookcityViewController.h
// ManHuaCheng
//
// Created by dragon on 16/6/28.
// Copyright © 2016年 win. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface XPBookcityViewController : UIViewController
@end
|
// ============================================================================
// casting.h: Dynamic casts.
// ============================================================================
#ifndef SPARK_SUPPORT_CASTING_H
#define SPARK_SUPPORT_CASTING_H 1
#ifndef SPARK_CONFIG_H
#include "spark/config.h"
#endif
#if SPARK_HAVE____LIB_SPARK_COLLECTIONS_ARRAY_SP
#include <../lib/spark/collections/array.sp>
#endif
#if SPARK_HAVE_CASSERT
#include <cassert>
#endif
namespace spark {
namespace support {
template<typename T>
struct SimplifyType {
typedef T value_type;
};
template<typename T>
struct SimplifyType<T*> {
typedef T value_type;
};
/** Returns true if the runtime type of the argument is 'To'. */
template<typename To, typename From>
inline bool isa(const From& val) {
return SimplifyType<To>::value_type::classof(val);
}
/** Returns true if the runtime type of the argument is 'To'. */
template<typename To, typename From>
inline To dyn_cast(const From& val) {
assert(val != nullptr);
return isa<To>(val) ? static_cast<To>(val) : nullptr;
}
/** Returns true if the runtime type of the argument is 'To'. */
template<typename To, typename From>
inline To dyn_cast_or_null(const From& val) {
return isa<To>(val) ? static_cast<To>(val) : nullptr;
}
}}
#endif
|
/* -------------------------------------------------------------------------- *
* CEINMS is a standalone toolbox for neuromusculoskeletal modelling and *
* simulation. CEINMS can also be used as a plugin for OpenSim either *
* through the OpenSim GUI or API. See https://simtk.org/home/ceinms and the *
* NOTICE file for more information. CEINMS development was coordinated *
* through Griffith University and supported by the Australian National *
* Health and Medical Research Council (NHMRC), the US National Institutes of *
* Health (NIH), and the European Union Framework Programme 7 (EU FP7). Also *
* see the PROJECTS file for more information about the funding projects. *
* *
* Copyright (c) 2010-2015 Griffith University and the Contributors *
* *
* CEINMS Contributors: C. Pizzolato, M. Reggiani, M. Sartori, *
* E. Ceseracciu, and D.G. Lloyd *
* *
* Author(s): E. Ceseracciu *
* *
* CEINMS is 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 ceinms_ExcitationGeneratorXmlReader_h
#define ceinms_ExcitationGeneratorXmlReader_h
#include "excitationGenerator.hxx"
#include <string>
namespace ceinms {
class ExcitationGeneratorXmlReader {
public:
ExcitationGeneratorXmlReader(const std::string& filename);
std::auto_ptr<ExcitationGeneratorXsd::excitationGenerator> getExcitationGenerator();
friend std::ostream& operator<< (std::ostream& output, const ExcitationGeneratorXmlReader& b);
private:
std::auto_ptr<ExcitationGeneratorXsd::excitationGenerator> excitationGenPointer_;
};
}
#endif
|
// Copyright 2013 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stdio.h>
#include <string.h>
#include <math.h>
#ifdef __APPLE__
# include <stdlib.h>
#else
# include <malloc.h>
#endif
const long long max_size = 2000; // max length of strings
const long long N = 40; // number of closest words that will be shown
const long long max_w = 50; // max length of vocabulary entries
int main(int argc, char **argv) {
FILE *f;
char st1[max_size];
char bestw[N][max_size];
char file_name[max_size], st[100][max_size];
float dist, len, bestd[N], vec[max_size];
long long words, size, a, b, c, d, cn, bi[100];
char ch;
float *M;
char *vocab;
if (argc < 2) {
printf("Usage: ./word-analogy <FILE>\nwhere FILE contains word projections in the BINARY FORMAT\n");
return 0;
}
strcpy(file_name, argv[1]);
f = fopen(file_name, "rb");
if (f == NULL) {
printf("Input file not found\n");
return -1;
}
fscanf(f, "%lld", &words);
fscanf(f, "%lld", &size);
vocab = (char *)malloc((long long)words * max_w * sizeof(char));
M = (float *)malloc((long long)words * (long long)size * sizeof(float));
if (M == NULL) {
printf("Cannot allocate memory: %lld MB %lld %lld\n", (long long)words * size * sizeof(float) / 1048576, words, size);
return -1;
}
for (b = 0; b < words; b++) {
a = 0;
while (1) {
vocab[b * max_w + a] = fgetc(f);
if (feof(f) || (vocab[b * max_w + a] == ' ')) break;
if ((a < max_w) && (vocab[b * max_w + a] != '\n')) a++;
}
vocab[b * max_w + a] = 0;
for (a = 0; a < size; a++) fread(&M[a + b * size], sizeof(float), 1, f);
len = 0;
for (a = 0; a < size; a++) len += M[a + b * size] * M[a + b * size];
len = sqrt(len);
for (a = 0; a < size; a++) M[a + b * size] /= len;
}
fclose(f);
while (1) {
for (a = 0; a < N; a++) bestd[a] = 0;
for (a = 0; a < N; a++) bestw[a][0] = 0;
printf("Enter three words (EXIT to break): ");
a = 0;
while (1) {
st1[a] = fgetc(stdin);
if ((st1[a] == '\n') || (a >= max_size - 1)) {
st1[a] = 0;
break;
}
a++;
}
if (!strcmp(st1, "EXIT")) break;
cn = 0;
b = 0;
c = 0;
while (1) {
st[cn][b] = st1[c];
b++;
c++;
st[cn][b] = 0;
if (st1[c] == 0) break;
if (st1[c] == ' ') {
cn++;
b = 0;
c++;
}
}
cn++;
if (cn < 3) {
printf("Only %lld words were entered.. three words are needed at the input to perform the calculation\n", cn);
continue;
}
for (a = 0; a < cn; a++) {
for (b = 0; b < words; b++) if (!strcmp(&vocab[b * max_w], st[a])) break;
if (b == words) b = 0;
bi[a] = b;
printf("\nWord: %s Position in vocabulary: %lld\n", st[a], bi[a]);
if (b == 0) {
printf("Out of dictionary word!\n");
break;
}
}
if (b == 0) continue;
printf("\n Word Distance\n------------------------------------------------------------------------\n");
for (a = 0; a < size; a++) vec[a] = M[a + bi[1] * size] - M[a + bi[0] * size] + M[a + bi[2] * size];
len = 0;
for (a = 0; a < size; a++) len += vec[a] * vec[a];
len = sqrt(len);
for (a = 0; a < size; a++) vec[a] /= len;
for (a = 0; a < N; a++) bestd[a] = 0;
for (a = 0; a < N; a++) bestw[a][0] = 0;
for (c = 0; c < words; c++) {
if (c == bi[0]) continue;
if (c == bi[1]) continue;
if (c == bi[2]) continue;
a = 0;
for (b = 0; b < cn; b++) if (bi[b] == c) a = 1;
if (a == 1) continue;
dist = 0;
for (a = 0; a < size; a++) dist += vec[a] * M[a + c * size];
for (a = 0; a < N; a++) {
if (dist > bestd[a]) {
for (d = N - 1; d > a; d--) {
bestd[d] = bestd[d - 1];
strcpy(bestw[d], bestw[d - 1]);
}
bestd[a] = dist;
strcpy(bestw[a], &vocab[c * max_w]);
break;
}
}
}
for (a = 0; a < N; a++) printf("%50s\t\t%f\n", bestw[a], bestd[a]);
}
return 0;
}
|
//
// RadioDetailDB.h
// Leisure
//
// Created by 莫大宝 on 16/4/13.
// Copyright © 2016年 dabao. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RadioDetailModel.h"
@interface RadioDetailDB : NSObject
// 数据库操作对象
@property (nonatomic, strong) FMDatabase *dataBase;
// 创建表
- (void)createDataTable;
// 插入数据 将model数据和本地音频路径保存到数据表中
- (void)insertReadDetailModel:(RadioDetailModel *)model andPath:(NSString *)path;
// 删除一条数据
- (void)deleteWithTitle:(NSString *)title;
// 查询所有数据
- (NSArray *)selectAllDataWithUserID:(NSString *)userID;
@end
|
#ifndef __LIGHT_H__
#define __LIGHT_H__
#ifndef _WIN32
#include <algorithm>
using std::min;
using std::max;
#endif
#include "scene.h"
#include "../ui/TraceUI.h"
#include <FL/gl.h>
class Light
: public SceneElement
{
public:
virtual glm::dvec3 shadowAttenuation(const ray& r, const glm::dvec3& pos) const = 0;
virtual double distanceAttenuation(const glm::dvec3& P) const = 0;
virtual glm::dvec3 getColor() const = 0;
virtual glm::dvec3 getDirection (const glm::dvec3& P) const = 0;
protected:
Light(Scene *scene, const glm::dvec3& col) : SceneElement(scene), color(col) {}
glm::dvec3 color;
public:
virtual void glDraw(GLenum lightID) const { }
virtual void glDraw() const { }
};
class DirectionalLight
: public Light
{
public:
DirectionalLight(Scene *scene, const glm::dvec3& orien, const glm::dvec3& color)
: Light(scene, color), orientation(glm::normalize(orien)) { }
virtual glm::dvec3 shadowAttenuation(const ray& r, const glm::dvec3& pos) const;
virtual double distanceAttenuation(const glm::dvec3& P) const;
virtual glm::dvec3 getColor() const;
virtual glm::dvec3 getDirection(const glm::dvec3& P) const;
protected:
glm::dvec3 orientation;
public:
void glDraw(GLenum lightID) const;
void glDraw() const;
};
class PointLight
: public Light
{
public:
PointLight( Scene *scene, const glm::dvec3& pos, const glm::dvec3& color,
float constantAttenuationTerm, float linearAttenuationTerm,
float quadraticAttenuationTerm )
: Light( scene, color ), position( pos ),
constantTerm(constantAttenuationTerm),
linearTerm(linearAttenuationTerm),
quadraticTerm(quadraticAttenuationTerm)
{}
virtual glm::dvec3 shadowAttenuation(const ray& r, const glm::dvec3& pos) const;
virtual double distanceAttenuation(const glm::dvec3& P) const;
virtual glm::dvec3 getColor() const;
virtual glm::dvec3 getDirection(const glm::dvec3& P) const;
void setAttenuationConstants(float a, float b, float c)
{
constantTerm = a;
linearTerm = b;
quadraticTerm = c;
}
protected:
glm::dvec3 position;
// These three values are the a, b, and c in the distance
// attenuation function (from the slide labelled
// "Intensity drop-off with distance"):
// f(d) = min( 1, 1/( a + b d + c d^2 ) )
float constantTerm; // a
float linearTerm; // b
float quadraticTerm; // c
public:
void glDraw(GLenum lightID) const;
void glDraw() const;
protected:
};
#endif // __LIGHT_H__
|
/*
Copyright 2014 PAW Solutions LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#import <Foundation/Foundation.h>
@interface SJAugmentedNSURLConnection : NSURLConnection {
}
@property NSString *SJHostName;
@property NSMutableData *SJData;
@property NSDate *connectionStartTime;
@end
|
#include <core.h>
static inline vector va_construct_vector(heap h, va_list a)
{
vector v = allocate_vector(h, 10);
void *n;
while ((n = va_arg(a, void *)) != END_OF_ARGUMENTS)
vector_insert(v, n);
return(v);
}
vector build_vector_internal(heap h, ...)
{
va_list a;
va_start(a, h);
return(va_construct_vector(h, a));
}
void vector_set(vector t, int index, void *n)
{
int b = index * sizeof(void *);
int e = b + sizeof(void *);
buffer_extend(t, e);
int z = t->end;
if (z < e) {
memset(bref(t, z), 0, (e-z)/8);
t->end = e;
}
*((void **)bref(t, b)) = n;
}
void vector_insert(vector t, void *n)
{
buffer_append(t, &n, sizeof(void *));
}
vector allocate_vector(heap h, int elements)
{
return(allocate_buffer(h, elements*sizeof(void *)));
}
void *vector_get(vector v, int element)
{
if (element >= vector_length(v)) return(false);
return(*(void **)bref(v, element*sizeof(void *)));
}
|
/*
* This file is part of the Camera Streaming Daemon
*
* Copyright (C) 2017 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <avahi-common/watch.h>
#include <memory>
#include <string>
#include <vector>
#ifdef ENABLE_AVAHI
#include "avahi_publisher.h"
#endif
#include "conf_file.h"
#ifdef ENABLE_MAVLINK
#include "mavlink_server.h"
#endif
#include "rtsp_server.h"
#include "stream.h"
class StreamManager {
public:
StreamManager(ConfFile &conf);
~StreamManager();
void start();
void stop();
void addStream(Stream *stream);
private:
std::vector<std::unique_ptr<Stream>> streams;
bool is_running;
#ifdef ENABLE_AVAHI
AvahiPublisher avahi_publisher;
#endif
RTSPServer rtsp_server;
#ifdef ENABLE_MAVLINK
MavlinkServer mavlink_server;
#endif
};
|
//
// DCUserAdressCell.h
// CDDStoreDemo
//
// Created by 陈甸甸 on 2017/12/19.
//Copyright © 2017年 RocketsChen. All rights reserved.
//
#import <UIKit/UIKit.h>
@class DCAdressItem;
@interface DCUserAdressCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIButton *chooseButton;
@property (nonatomic, copy) void (^selectBtnClickBlock)(BOOL isSelected);
/* 模型数据 */
@property (strong , nonatomic)DCAdressItem *adItem;
/** 删除点击回调 */
@property (nonatomic, copy) dispatch_block_t deleteClickBlock;
/** 编辑点击回调 */
@property (nonatomic, copy) dispatch_block_t editClickBlock;
@end
|
#pragma once
#include "ShootingObject.h"
#include "HudSound.h"
class CPhysicsShellHolder;
class CCarWeapon :public CShootingObject
{
protected:
typedef CShootingObject inheritedShooting;
void SetBoneCallbacks ();
void ResetBoneCallbacks ();
virtual void FireStart ();
virtual void FireEnd ();
virtual void UpdateFire ();
virtual void OnShot ();
void UpdateBarrelDir ();
virtual const Fvector& get_CurrentFirePoint();
virtual const Fmatrix& get_ParticlesXFORM ();
CPhysicsShellHolder* m_object;
bool m_bActive;
bool m_bAutoFire;
public:
enum{
eWpnDesiredDir =1,
eWpnDesiredPos,
eWpnActivate,
eWpnFire,
eWpnAutoFire,
eWpnToDefaultDir,
};
CCarWeapon (CPhysicsShellHolder* obj);
virtual ~CCarWeapon ();
static void BoneCallbackX (CBoneInstance *B);
static void BoneCallbackY (CBoneInstance *B);
void Load (LPCSTR section);
void UpdateCL ();
void Action (int id, u32 flags);
void SetParam (int id, Fvector2 val);
void SetParam (int id, Fvector val);
bool AllowFire ();
float FireDirDiff ();
private:
u16 m_rotate_x_bone, m_rotate_y_bone, m_fire_bone, m_camera_bone;
float m_tgt_x_rot, m_tgt_y_rot, m_cur_x_rot, m_cur_y_rot, m_bind_x_rot, m_bind_y_rot;
Fvector m_bind_x, m_bind_y;
Fvector m_fire_dir,m_fire_pos;
Fmatrix m_i_bind_x_xform, m_i_bind_y_xform, m_fire_bone_xform;
Fvector2 m_lim_x_rot, m_lim_y_rot; //in bone space
float m_min_gun_speed, m_max_gun_speed;
CCartridge* m_Ammo;
float m_barrel_speed;
Fvector m_destEnemyDir;
bool m_allow_fire;
HUD_SOUND m_sndShot;
};
|
// Copyright 2010-2014, 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 MOZC_WIN32_BASE_KEYBOARD_LAYOUT_ID_H_
#define MOZC_WIN32_BASE_KEYBOARD_LAYOUT_ID_H_
#include <windows.h>
#include <string>
namespace mozc {
namespace win32 {
// This class represents a keyboard layout identifier (KLID). You can use this
// class to convert to/from both KLID text representation like "04110411" and
// KLID integer representation like 0x04110411.
// Please note that the HKY (a handle to a keyboard layout) is based on
// its entirely different principle from HKID.
// To obtain a HKY corresponding to HKID, use ::LoadKeyboardLayout. Do not
// make a handle based on the integer representation of KLID.
// See the following article for details.
// http://blogs.msdn.com/b/michkap/archive/2005/04/17/409032.aspx
// Note that this simple wrapper accepts any KLID even if the ID is not
// registered in the registry.
class KeyboardLayoutID {
public:
// Initializes an instance with leaving |id_| as 'cleared'.
KeyboardLayoutID();
// Initializes an instance with a KLID in text form.
// |id_| remains 'cleared' if |text| is an invalid text form.
explicit KeyboardLayoutID(const wstring &text);
// Initializes an instance with a KLID in integer form.
explicit KeyboardLayoutID(DWORD id);
// Returns true unless |text| does not have an invalid text form.
// When this method returns false, it behaves as if |clear_id()| was called.
bool Parse(const wstring &text);
// Returns KLID in text form.
// You cannot call this method when |has_id()| returns false.
wstring ToString() const;
// Returns KLID in integer form.
// You cannot call this method when |has_id()| returns false.
DWORD id() const;
// Updates |id_| with the given KLID. Note that this method never checks if
// the given |id| is valid in terms of the existence of the corresponding
// registry entry.
void set_id(DWORD id);
// Returns true unless |id_| is not 'cleared'.
bool has_id() const;
// Set |id_| 'cleared'.
void clear_id();
private:
DWORD id_;
bool has_id_;
};
} // namespace win32
} // namespace mozc
#endif // MOZC_WIN32_BASE_KEYBOARD_LAYOUT_ID_H_
|
/*******************************************************************************
**NOTE** This code was generated by a tool and will occasionally be
overwritten. We welcome comments and issues regarding this code; they will be
addressed in the generation tool. If you wish to submit pull requests, please
do so for the templates in that tool.
This code was generated by Vipr (https://github.com/microsoft/vipr) using
the T4TemplateWriter (https://github.com/msopentech/vipr-t4templatewriter).
Copyright (c) Microsoft Corporation. All Rights Reserved.
Licensed under the Apache License 2.0; see LICENSE in the source repository
root for authoritative license information.
******************************************************************************/
#ifndef MSOUTLOOKRECIPIENT_H
#define MSOUTLOOKRECIPIENT_H
#import <Foundation/Foundation.h>
#import "core/MSOrcChangesTrackingArray.h"
@class MSOutlookEmailAddress;
#import "core/MSOrcBaseEntity.h"
#import "api/MSOrcInteroperableWithDictionary.h"
/** Interface MSOutlookRecipient
*
*/
@interface MSOutlookRecipient : MSOrcBaseEntity <MSOrcInteroperableWithDictionary>
/** Property emailAddress
*
*/
@property (nonatomic, copy, setter=setEmailAddress:, getter=emailAddress) MSOutlookEmailAddress * emailAddress;
+ (NSDictionary *) $$$_$$$propertiesNamesMappings;
@end
#endif
|
// Copyright 2011 WebDriver committers
// 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 WEBDRIVER_IE_GETPAGESOURCECOMMANDHANDLER_H_
#define WEBDRIVER_IE_GETPAGESOURCECOMMANDHANDLER_H_
#include "Session.h"
#include "logging.h"
namespace webdriver {
class GetPageSourceCommandHandler : public CommandHandler {
public:
GetPageSourceCommandHandler(void) {
}
virtual ~GetPageSourceCommandHandler(void) {
}
protected:
void GetPageSourceCommandHandler::ExecuteInternal(const IESessionWindow& session, const LocatorMap& locator_parameters, const ParametersMap& command_parameters, Response * response) {
BrowserHandle browser_wrapper;
int status_code = session.GetCurrentBrowser(&browser_wrapper);
if (status_code != SUCCESS) {
response->SetErrorResponse(status_code, "Unable to get browser");
return;
}
CComPtr<IHTMLDocument2> doc;
browser_wrapper->GetDocument(&doc);
CComPtr<IHTMLDocument3> doc3;
CComQIPtr<IHTMLDocument3> doc_qi_pointer(doc);
if (doc_qi_pointer) {
doc3 = doc_qi_pointer.Detach();
}
if (!doc3) {
response->SetErrorResponse(ENOSUCHDOCUMENT, "Unable to get document");
return;
}
CComPtr<IHTMLElement> document_element;
HRESULT hr = doc3->get_documentElement(&document_element);
if (FAILED(hr)) {
LOGHR(WARN, hr) << "Unable to get document element from page";
response->SetResponse(SUCCESS, "");
return;
}
CComBSTR html;
hr = document_element->get_outerHTML(&html);
if (FAILED(hr)) {
LOGHR(WARN, hr) << "Have document element but cannot read source.";
response->SetResponse(SUCCESS, "");
return;
}
std::string page_source = CW2A(html, CP_UTF8);
response->SetResponse(SUCCESS,page_source);
}
};
} // namespace webdriver
#endif // WEBDRIVER_IE_GETPAGESOURCECOMMANDHANDLER_H_
|
// bdlb_literalutil.h -*-C++-*-
#ifndef INCLUDED_BDLB_LITERALUTIL
#define INCLUDED_BDLB_LITERALUTIL
#include <bsls_ident.h>
BSLS_IDENT("$Id: $")
//@PURPOSE: Provide utility routines for programming language literals.
//
//@CLASSES:
// bdlb::LiteralUtil: utilities namespace for programming language literals
//
//@SEE_ALSO: hslc_lexer, hslc_parser
//
//@DESCRIPTION: This component provides a namespace, 'bdlb::LiteralUtil', for a
// set of utility routines that operate on (programming language) literals.
#include <bdlscm_version.h>
#include <bsls_libraryfeatures.h>
#include <bsl_string.h>
#include <bsl_string_view.h>
#include <string> // 'std::string', 'std::pmr::string'
namespace BloombergLP {
namespace bdlb {
// ==================
// struct LiteralUtil
// ==================
struct LiteralUtil {
private:
// PRIVATE CLASS METHODS
template <class OUT_STR>
static void createQuotedEscapedCString_Impl(
OUT_STR *result,
const bsl::string_view& input);
// Load into the specified 'result' string the '"' delimited and
// escaped C/C++ string literal equivalent representing the same value
// as that of the specified 'input' string. When the C string literal
// equivalent is translated by a compiler having C-compatible string
// literals, it will result in a string identical to the 'input'
// string. Note that this code uses the (ASCII) '\' character, rather
// than Unicode code points for escapes.
public:
// CLASS METHODS
static void createQuotedEscapedCString(bsl::string *result,
const bsl::string_view& input);
static void createQuotedEscapedCString(std::string *result,
const bsl::string_view& input);
// Load into the specified 'result' string the '"' delimited and
// escaped C/C++ string literal equivalent representing the same value
// as that of the specified 'input' string. When the C string literal
// equivalent is translated by a compiler having C-compatible string
// literals, it will result in a string identical to the 'input'
// string. Note that this code uses the (ASCII) '\' character, rather
// than Unicode code points for escapes.
#ifdef BSLS_LIBRARYFEATURES_HAS_CPP17_PMR
static void createQuotedEscapedCString(std::pmr::string *result,
const bsl::string_view& input);
// Load into the specified 'result' string the '"' delimited and
// escaped C/C++ string literal equivalent representing the same value
// as that of the specified 'input' string. When the C string literal
// equivalent is translated by a compiler having C-compatible string
// literals, it will result in a string identical to the 'input'
// string. Note that this code uses the (ASCII) '\' character, rather
// than Unicode code points for escapes.
#endif
};
} // close package namespace
} // close enterprise namespace
#endif
// ----------------------------------------------------------------------------
// Copyright 2020 Bloomberg Finance L.P.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// ----------------------------- END-OF-FILE ----------------------------------
|
#pragma once
#include "Bag.h"
#include <iostream>
#include <assert.h>
#include <string>
using namespace std;
class DiGraph
{
public:
DiGraph(int V);
DiGraph(istream& ist);
DiGraph(const DiGraph& DG);
~DiGraph();
int V() const;
int E() const;
void AddEdge(int v, int w);
Bag<int> Adj(int v) const;
DiGraph reverse();
void Show();
private:
Bag<int>* m_pBag;
int m_nV;
int m_nE;
};
DiGraph::DiGraph(int V) :m_pBag(0), m_nV(0), m_nE(0)
{
assert(V > 0);
m_pBag = new Bag<int>[V];
m_nV = V;
}
DiGraph::DiGraph(istream& ist) :m_pBag(0), m_nV(0), m_nE(0)
{
ist >> m_nV >> m_nE;
assert(m_nV > 0);
m_pBag = new Bag<int>[m_nV];
for (int i = 0; i < m_nE; i++)
{
int v, w;
ist >> v;
ist >> w;
this->AddEdge(v, w);
m_nE--;
}
}
DiGraph::DiGraph(const DiGraph& DG)
{
this->m_nV = DG.V();
this->m_nE = DG.E();
m_pBag = new Bag<int>[m_nV];
for (int i = 0; i < m_nV; i++)
{
//m_pBag[i] = DG.Adj(i);//no custom operator = constructor
for (int j = 0; j < DG.Adj(i).Size(); j++)
{
m_pBag->Add(DG.Adj(i).Peek(j));
}
}
}
DiGraph::~DiGraph()
{
if (m_pBag != 0)
{
delete[] m_pBag;
}
}
int DiGraph::V() const
{
return m_nV;
}
int DiGraph::E() const
{
return m_nE;
}
void DiGraph::AddEdge(int v, int w)
{
assert(v < m_nV && w < m_nV);
m_pBag[v].Add(w);
m_nE++;
}
Bag<int> DiGraph::Adj(int v) const
{
assert(v < m_nV);
return m_pBag[v];
}
DiGraph DiGraph::reverse()
{
DiGraph DG(this->V());
for (int i = 0; i < this->V(); i++)
{
Bag<int> b = this->Adj(i);
for (int j = 0; j < b.Size(); j++)
{
int nV = b.Peek(j);
DG.AddEdge(nV, i);
}
}
return DG;
}
void DiGraph::Show()
{
cout << m_nV << " vertices, " << m_nE << " edges" << endl;
for (int i = 0; i < m_nV; i++)
{
cout << i << ": ";
Bag<int> bagTemp = this->Adj(i);
for (int j = 0; j < bagTemp.Size(); j++)
{
cout << bagTemp.Peek(j) << " ";
}
cout << endl;
}
}
|
/*
* Copyright (c) 2015 Cisco and/or its affiliates.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
Copyright (c) 2001, 2002, 2003 Eliot Dresselhaus
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef included_error_h
#define included_error_h
#include <vppinfra/clib.h> /* for CLIB_LINUX_KERNEL */
#include <vppinfra/error_bootstrap.h>
#ifdef CLIB_UNIX
#include <errno.h>
#endif
#ifdef CLIB_LINUX_KERNEL
#include <linux/errno.h>
#endif
#include <stdarg.h>
#include <vppinfra/vec.h>
/* Callback functions for error reporting. */
typedef void clib_error_handler_func_t (void *arg, u8 * msg, int msg_len);
void clib_error_register_handler (clib_error_handler_func_t func, void *arg);
#define clib_warning(format,args...) \
_clib_error (CLIB_ERROR_WARNING, clib_error_function, __LINE__, format, ## args)
#define clib_error(format,args...) \
_clib_error (CLIB_ERROR_FATAL, clib_error_function, __LINE__, format, ## args)
#define clib_unix_error(format,args...) \
_clib_error (CLIB_ERROR_FATAL | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)
#define clib_unix_warning(format,args...) \
_clib_error (CLIB_ERROR_WARNING | CLIB_ERROR_ERRNO_VALID, clib_error_function, __LINE__, format, ## args)
/* For programming errors and assert. */
#define clib_panic(format,args...) \
_clib_error (CLIB_ERROR_ABORT, (char *) clib_error_function, __LINE__, format, ## args)
typedef struct
{
/* Error message. */
u8 *what;
/* Where error occurred (e.g. __FUNCTION__ __LINE__) */
const u8 *where;
uword flags;
/* Error code (e.g. errno for Unix errors). */
any code;
} clib_error_t;
#define clib_error_get_code(err) ((err) ? (err)->code : 0)
#define clib_error_set_code(err, c) \
do { \
if (err) \
(err)->code = (c); \
} while (0)
extern void *clib_error_free_vector (clib_error_t * errors);
#define clib_error_free(e) e = clib_error_free_vector(e)
extern clib_error_t *_clib_error_return (clib_error_t * errors,
any code,
uword flags,
char *where, char *fmt, ...);
#define clib_error_return_code(e,code,flags,args...) \
_clib_error_return((e),(code),(flags),(char *)clib_error_function,args)
#define clib_error_create(args...) \
clib_error_return_code(0,0,0,args)
#define clib_error_return(e,args...) \
clib_error_return_code(e,0,0,args)
#define clib_error_return_unix(e,args...) \
clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID,args)
#define clib_error_return_fatal(e,args...) \
clib_error_return_code(e,0,CLIB_ERROR_FATAL,args)
#define clib_error_return_unix_fatal(e,args...) \
clib_error_return_code(e,errno,CLIB_ERROR_ERRNO_VALID|CLIB_ERROR_FATAL,args)
extern clib_error_t *_clib_error_report (clib_error_t * errors);
#define clib_error_report(e) do { (e) = _clib_error_report (e); } while (0)
u8 *format_clib_error (u8 * s, va_list * va);
always_inline word
unix_error_is_fatal (word error)
{
#ifdef CLIB_UNIX
switch (error)
{
case EWOULDBLOCK:
case EINTR:
return 0;
}
#endif
return 1;
}
#define IF_ERROR_IS_FATAL_RETURN_ELSE_FREE(e) \
do { \
if (e) \
{ \
if (unix_error_is_fatal (clib_error_get_code (e))) \
return (e); \
else \
clib_error_free (e); \
} \
} while (0)
#define ERROR_RETURN_IF(x) \
do { \
clib_error_t * _error_return_if = (x); \
if (_error_return_if) \
return clib_error_return (_error_return_if, 0); \
} while (0)
#define ERROR_ASSERT(truth) \
({ \
clib_error_t * _error_assert = 0; \
if (CLIB_DEBUG > 0 && ! (truth)) \
{ \
_error_assert = clib_error_return_fatal \
(0, "%s:%d (%s) assertion `%s' fails", \
__FILE__, \
(uword) __LINE__, \
clib_error_function, \
# truth); \
} \
_error_assert; \
})
/* Assert to remain even if CLIB_DEBUG is set to 0. */
#define CLIB_ERROR_ASSERT(truth) \
({ \
clib_error_t * _error_assert = 0; \
if (! (truth)) \
{ \
_error_assert = \
clib_error_return_fatal \
(0, "%s:%d (%s) assertion `%s' fails", \
__FILE__, \
(uword) __LINE__, \
clib_error_function, \
# truth); \
} \
_error_assert; \
})
/*
* If we're running under Coverity, don't die on
* failed static assertions.
*/
#ifdef __COVERITY__
#ifndef _Static_assert
#define _Static_assert(x,y)
#endif
#endif
#endif /* included_error_h */
/*
* fd.io coding-style-patch-verification: ON
*
* Local Variables:
* eval: (c-set-style "gnu")
* End:
*/
|
//
// ELViewController.h
// ELSwipeController
//
// Created by Yarik Smirnov on 28.12.11.
// Copyright (c) 2011 e-legion ltd. All rights reserved.
//
#import <UIKit/UIKit.h>
@class ELSwipeBar;
@interface ELSwipeController : UIViewController {
@protected
UIScrollView *_controllersContainer;
NSMutableArray *_controllers;
ELSwipeBar *_swipeBar;
id _swipeDelegate;
}
@property (nonatomic, retain) UIColor *titleColor; //Text color of controllers titles
@property (nonatomic, retain) UIColor *shadowColor; //Shadow color of the controllers titles
@property (nonatomic, assign) CGFloat *fontSize; // Font size of controllers titles;
@property (nonatomic, retain) UIColor *titleBackgroundColor; // Controllers titles background;
@property (nonatomic, retain) UIColor *backgroundColor; // Use this color if controllers views is transparrent
@property (nonatomic, retain) UIImage *titlesBackgroundImage; // 1 pixel width;
@property (nonatomic, assign) BOOL hideSwipeBar;
- (id)initWithControllersStack:(NSArray *)controllers;
- (void)setControllers:(NSArray *)controllers;
- (void)scrollToController:(NSInteger)index;
- (void)scrollLeft;
- (void)scrollRight;
- (void)scrolledToSection:(NSUInteger)sectionIndex;
@end
|
//
// UIImage+XMG.h
// 小码哥彩票
//
// Created by xiaomage on 16/1/29.
// Copyright © 2016年 小码哥. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIImage (DT)
/**
* 图片不要渲染
*
* @param name 图片名字
*
* @return 返回一张不要渲染的图片
*/
+ (UIImage *)imageWithRenderOriginalName:(NSString *)name;
@end
|
//
// (C) Jan de Vaan 2007-2010, all rights reserved. See the accompanying "License.txt" for licensed use.
//
#ifndef CHARLS_CONTEXT
#define CHARLS_CONTEXT
#include <cstdlib>
//
// JlsContext: a JPEG-LS context with it's current statistics.
//
struct JlsContext
{
public:
JlsContext()
{}
JlsContext(LONG a) :
A(a),
B(0),
C(0),
N(1)
{
}
LONG A;
LONG B;
short C;
short N;
inlinehint LONG GetErrorCorrection(LONG k) const
{
if (k != 0)
return 0;
return BitWiseSign(2 * B + N - 1);
}
inlinehint void UpdateVariables(LONG errorValue, LONG NEAR, LONG NRESET)
{
ASSERT(N != 0);
// For performance work on copies of A,B,N (compiler will use registers).
int b = B + errorValue * (2 * NEAR + 1);
int a = A + std::abs(errorValue);
int n = N;
ASSERT(a < 65536 * 256);
ASSERT(abs(b) < 65536 * 256);
if (n == NRESET)
{
a = a >> 1;
b = b >> 1;
n = n >> 1;
}
n = n + 1;
if (b + n <= 0)
{
b = b + n;
if (b <= -n)
{
b = -n + 1;
}
C = _tableC[C - 1];
}
else if (b > 0)
{
b = b - n;
if (b > 0)
{
b = 0;
}
C = _tableC[C + 1];
}
A = a;
B = b;
N = (short)n;
ASSERT(N != 0);
}
inlinehint LONG GetGolomb() const
{
LONG Ntest = N;
LONG Atest = A;
LONG k = 0;
for(; (Ntest << k) < Atest; k++)
{
ASSERT(k <= 32);
};
return k;
}
static signed char* CreateTableC()
{
static std::vector<signed char> rgtableC;
rgtableC.reserve(256 + 2);
rgtableC.push_back(-128);
for (int i = -128; i < 128; i++)
{
rgtableC.push_back(char(i));
}
rgtableC.push_back(127);
signed char* pZero = &rgtableC[128 + 1];
ASSERT(pZero[0] == 0);
return pZero;
}
private:
static signed char* _tableC;
};
#endif
|
/*
* Copyright (C) 2004, 2005, 2008 Nikolas Zimmermann <zimmermann@kde.org>
* Copyright (C) 2004, 2005, 2006, 2007 Rob Buis <buis@kde.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef SVGTransformable_h
#define SVGTransformable_h
#include "core/svg/SVGLocatable.h"
#include "core/svg/SVGTransform.h"
#include "wtf/text/WTFString.h"
namespace WebCore {
class AffineTransform;
class SVGTransformList;
class SVGTransformable : virtual public SVGLocatable {
public:
enum TransformParsingMode {
ClearList,
DoNotClearList
};
virtual ~SVGTransformable();
static bool parseTransformAttribute(SVGTransformList&, const LChar*& ptr, const LChar* end, TransformParsingMode = ClearList);
static bool parseTransformAttribute(SVGTransformList&, const UChar*& ptr, const UChar* end, TransformParsingMode = ClearList);
static bool parseTransformValue(unsigned type, const LChar*& ptr, const LChar* end, SVGTransform&);
static bool parseTransformValue(unsigned type, const UChar*& ptr, const UChar* end, SVGTransform&);
static SVGTransform::SVGTransformType parseTransformType(const String&);
virtual AffineTransform localCoordinateSpaceTransform(SVGLocatable::CTMScope) const { return animatedLocalTransform(); }
virtual AffineTransform animatedLocalTransform() const = 0;
private:
template<typename CharType>
static bool parseTransformAttributeInternal(SVGTransformList&, const CharType*& ptr, const CharType* end, TransformParsingMode);
};
} // namespace WebCore
#endif // SVGTransformable_h
|
//---------------------------------------------------------- -*- Mode: C++ -*-
// $Id: DiskConnection.h 385 2010-05-27 15:58:30Z sriramsrao $
//
// Created 2006/03/23
//
// Copyright 2008 Quantcast Corp.
// Copyright 2006-2008 Kosmix Corp.
//
// This file is part of Kosmos File System (KFS).
//
// 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 _LIBIO_DISKCONNECTION_H
#define _LIBIO_DISKCONNECTION_H
#include <sys/types.h>
#include <aio.h>
#include <boost/shared_ptr.hpp>
#include <boost/enable_shared_from_this.hpp>
#include <deque>
namespace KFS
{
// forward declaration
class DiskManager;
class DiskConnection;
///
/// \typedef DiskConnectionPtr
/// DiskConnection is encapsulated in a smart pointer, so that when the
/// last reference is released, appropriate cleanup occurs.
///
typedef boost::shared_ptr<DiskConnection> DiskConnectionPtr;
}
#include "FileHandle.h"
#include "KfsCallbackObj.h"
#include "IOBuffer.h"
#include "DiskEvent.h"
namespace KFS
{
///
/// \file DiskConnection.h
/// \brief A disk connection is modeled after a network connection on
/// which I/O can be done.
///
/// A disk connection is owned by a KfsCallbackObj. Whenever the
/// KfsCallbackObj needs to do disk I/O, it schedules the operation on
/// the disk connection. The disk connection uses the disk manager
/// (@see DiskManager) to schedule the I/O. The disk manager calls
/// the connection back when the operation completes. The disk
/// connection in turn calls back the KfsCallbackObj with the result.
///
///
/// To allow pipelining of disk IO operations, particularly READ
/// requests---where a client can break-down the read requests into
/// multiple requests so that we can overlap disk/network
/// transfer---have a structure that tracks the status of individual
/// IO requests. A DiskConnection keeps a queue of such outstanding
/// requests.
///
struct DiskIORequest
{
DiskIORequest() : op(OP_NONE), offset(0), numBytes(0) { }
DiskIORequest(DiskEventOp_t o, off_t f, size_t n) :
op(o), offset(f), numBytes(n) { }
DiskEventOp_t op; /// what is this request about
off_t offset; /// offset from the chunk at which I/O should
/// be done
size_t numBytes; /// # of bytes in this request
std::list<DiskEventPtr> diskEvents; /// disk events associated with
/// this request.
bool operator == (DiskIORequest &other) const
{
return ((offset == other.offset) &&
(numBytes == other.numBytes));
}
};
///
/// Disk Connection encapsulates an fd and some disk IO requests. On
/// a given disk connection, you can do either a READ or a WRITE, but not
/// both.
///
class DiskConnection :
public boost::enable_shared_from_this<DiskConnection>
{
public:
DiskConnection(FileHandlePtr &handle, KfsCallbackObj *callbackObj);
~DiskConnection();
/// Close the connection. This will cause the events scheduled on
/// this connection to be cancelled.
void Close();
FileHandlePtr &GetFileHandle()
{
return mHandle;
}
/// Schedule a read on this connection at the specified offset for numBytes.
/// @param[in] numBytes # of bytes that need to be read.
/// @param[in] offset offset in the file at which to start reading data from.
/// @retval # of bytes for which read was successfully scheduled;
/// -1 if there was an error.
ssize_t Read(off_t offset, size_t numBytes);
/// Completion handler for a read.
int ReadDone(DiskEventPtr &doneEvent, int res);
/// Schedule a write on this connection.
/// @param[in] numBytes # of bytes that need to be written
/// @param[in] offset offset in the file at which to start writing data.
/// @param[in] buf IOBuffer which contains data that should be written
/// out to disk.
/// @retval # of bytes for which write was successfully scheduled;
/// -1 if there was an error.
ssize_t Write(off_t offset, size_t numBytes, IOBuffer *buf);
/// Completion handler for a write.
int WriteDone(DiskEventPtr &doneEvent, int res);
/// Sync the previously written data to disk.
/// @param[in] notifyDone if set, notify upstream objects that the
/// sync operation has finished.
int Sync(bool notifyDone);
/// Completion handler for a sync.
int SyncDone(DiskEventPtr &doneEvent, int res);
/// Completion handler for a disk event.
/// @param doneEvent Disk event that completed
/// @param res Result of the event that completed
///
int HandleDone(DiskEventPtr &doneEvent, int res)
{
if (doneEvent->op == OP_READ)
return ReadDone(doneEvent, res);
else if (doneEvent->op == OP_WRITE)
return WriteDone(doneEvent, res);
else
return SyncDone(doneEvent, res);
}
// XXX: Need a way to build backpressure: if there are too many
// I/O's outstanding, then throttle back...
private:
/// Owning KfsCallbackObj.
KfsCallbackObj *mCallbackObj;
FileHandlePtr mHandle;
/// Queue of disk IO requests that have been scheduled on this
/// connection. Whenever the I/O on the head of the queue is complete, the
/// associated KfsCallbackObj is notified.
std::deque<DiskIORequest> mDiskIO;
};
}
#endif // _LIBIO_DISKCONNECTION_H
|
/*
* author: Thomas Yao
*/
#include <err.h>
#include <stdlib.h>
#include "term_vector.h"
struct _term_vector*
term_vector_initial(char* _field,
char* _tms[],
int _term_freqs[])
{
struct _term_vector* tv = (struct _term_vector*) malloc(sizeof(
struct _term_vector));
if (tv == NULL)
err(1, "tv is null");
tv->field = _field;
//tv->terms = _tms;
//tv->term_freqs = _term_freqs;
return tv;
}
|
/**
* @copyright Copyright 2016 The J-PET Framework Authors. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may find a copy of the License in the LICENCE file.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* @file JPetSigCh.h
* @brief description
*/
#ifndef _JPETSIGCH_H_
#define _JPETSIGCH_H_
#include <cassert>
#include <vector>
#include <TClass.h>
#include <TRef.h>
#include "../JPetPM/JPetPM.h"
#include "../JPetTRB/JPetTRB.h"
#include "../JPetFEB/JPetFEB.h"
#include "../JPetTOMBChannel/JPetTOMBChannel.h"
#include "../JPetLoggerInclude.h"
/**
* @brief Data class representing a SIGnal from a single tdc CHannel.
*
* Contains either time corresponding to a single threshold and slope type of a front-end board or charge from a single PM (if available in a given setup).
*/
class JPetSigCh: public TNamed
{
public:
enum EdgeType
{
Trailing, Leading, Charge
};
const static float kUnset;
JPetSigCh() {
Init();
}
JPetSigCh(EdgeType Edge, float EdgeTime);
~JPetSigCh() {
}
/**
* @brief Used to obtain the time or charge carried by the TDC signal.
*
* @return either time with respect to beginning of the time window [ps] (TSlot) or charge (if getType()==Charge)
*/
inline float getValue() const {
return fValue;
}
/**
* @brief Used to obtain the type of the signal information
*
* Trailing edge, leading edge or charge (Charge)
*/
inline EdgeType getType() const {
return fType;
}
inline const JPetPM & getPM() const {
return (JPetPM&) *fPM.GetObject();
}
inline const JPetTRB & getTRB() const {
return (JPetTRB&) *fTRB.GetObject();
}
inline const JPetFEB & getFEB() const {
return (JPetFEB&) *fFEB.GetObject();
}
inline const JPetTOMBChannel & getTOMBChannel() const {
return (JPetTOMBChannel&) *fTOMBChannel.GetObject();
}
/**
* A proxy method for quick access to DAQ channel number ignorantly of what a TOMBCHannel is
*/
inline int getChannel() const {
return getTOMBChannel().getChannel();
}
/**
* Returns true if the value of the signal represents charge information (integral of the signal calculated by front-end board)
*/
bool isCharge() const;
/**
* Returns true if the value of the signal represents time information from the TDC
*/
bool isTime() const;
inline void setPM(const JPetPM & pm) {
fPM = const_cast<JPetPM*>(&pm);
}
inline void setTRB(const JPetTRB & trb) {
fTRB = const_cast<JPetTRB*>(&trb);
}
inline void setFEB(const JPetFEB & feb) {
fFEB = const_cast<JPetFEB*>(&feb);
}
inline void setTOMBChannel(const JPetTOMBChannel & channel) {
fTOMBChannel = const_cast<JPetTOMBChannel*>(&channel);
}
// Set time wrt beginning of TSlot [ps] or charge
inline void setValue(float val) {
fValue = val;
}
inline void setType(EdgeType type) {
fType = type;
}
inline void setThreshold(float thr) {
fThreshold = thr;
}
inline void setDAQch(Int_t daqch) {
fDAQch = daqch;
}
inline float getThreshold() const {
return fThreshold;
}
inline Int_t getDAQch() const {
return fDAQch;
}
/**
* @brief Get the number of this threshold on a certain edge.
*
* The thresholds are numbered starting from 1 according to ascending order of their corresponding DAQ channels.
*/
inline unsigned int getThresholdNumber() const {
return fThresholdNumber;
}
/**
* @brief Set the number of this threshold on a certain edge.
*
* The thresholds are numbered starting from 1 according to ascending order of their corresponding DAQ channels.
*/
inline void setThresholdNumber(unsigned int threshold_number) {
fThresholdNumber = threshold_number;
}
/**
* @brief Compares this SigCh with another by their threshold value
*
* This is a static function for use as Compare function with STL containers
*
* @return true if first argument should go before the second one.
*/
static bool compareByThresholdValue(const JPetSigCh & A, const JPetSigCh & B);
/**
* @brief Compares this SigCh with another by their threshold numbers
*
* This is a static function for use as Compare function with STL containers
*
* @return true if first argument should go before the second one.
*/
static bool compareByThresholdNumber(const JPetSigCh & A,
const JPetSigCh & B);
ClassDef(JPetSigCh, 4);
protected:
EdgeType fType; ///< type of the SigCh: Leading, Trailing (time) or Charge (charge)
float fValue; ///< main value of the SigCh; either time [ps] (if fType is kRiging or Leading) or charge (if fType is Charge)
unsigned int fThresholdNumber;
float fThreshold; ///< value of threshold [mV]
int fDAQch; ///< Number of DAQ channel from the raw HLD file
TRef fPM;
TRef fFEB;
TRef fTRB;
TRef fTOMBChannel;
void Init();
};
#endif
|
/*
* Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#pragma once
#include <aws/opsworks/OpsWorks_EXPORTS.h>
#include <aws/opsworks/OpsWorksRequest.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace OpsWorks
{
namespace Model
{
/**
*/
class AWS_OPSWORKS_API DeleteInstanceRequest : public OpsWorksRequest
{
public:
DeleteInstanceRequest();
Aws::String SerializePayload() const override;
Aws::Http::HeaderValueCollection GetRequestSpecificHeaders() const override;
/**
* <p>The instance ID.</p>
*/
inline const Aws::String& GetInstanceId() const{ return m_instanceId; }
/**
* <p>The instance ID.</p>
*/
inline void SetInstanceId(const Aws::String& value) { m_instanceIdHasBeenSet = true; m_instanceId = value; }
/**
* <p>The instance ID.</p>
*/
inline void SetInstanceId(Aws::String&& value) { m_instanceIdHasBeenSet = true; m_instanceId = value; }
/**
* <p>The instance ID.</p>
*/
inline void SetInstanceId(const char* value) { m_instanceIdHasBeenSet = true; m_instanceId.assign(value); }
/**
* <p>The instance ID.</p>
*/
inline DeleteInstanceRequest& WithInstanceId(const Aws::String& value) { SetInstanceId(value); return *this;}
/**
* <p>The instance ID.</p>
*/
inline DeleteInstanceRequest& WithInstanceId(Aws::String&& value) { SetInstanceId(value); return *this;}
/**
* <p>The instance ID.</p>
*/
inline DeleteInstanceRequest& WithInstanceId(const char* value) { SetInstanceId(value); return *this;}
/**
* <p>Whether to delete the instance Elastic IP address.</p>
*/
inline bool GetDeleteElasticIp() const{ return m_deleteElasticIp; }
/**
* <p>Whether to delete the instance Elastic IP address.</p>
*/
inline void SetDeleteElasticIp(bool value) { m_deleteElasticIpHasBeenSet = true; m_deleteElasticIp = value; }
/**
* <p>Whether to delete the instance Elastic IP address.</p>
*/
inline DeleteInstanceRequest& WithDeleteElasticIp(bool value) { SetDeleteElasticIp(value); return *this;}
/**
* <p>Whether to delete the instance's Amazon EBS volumes.</p>
*/
inline bool GetDeleteVolumes() const{ return m_deleteVolumes; }
/**
* <p>Whether to delete the instance's Amazon EBS volumes.</p>
*/
inline void SetDeleteVolumes(bool value) { m_deleteVolumesHasBeenSet = true; m_deleteVolumes = value; }
/**
* <p>Whether to delete the instance's Amazon EBS volumes.</p>
*/
inline DeleteInstanceRequest& WithDeleteVolumes(bool value) { SetDeleteVolumes(value); return *this;}
private:
Aws::String m_instanceId;
bool m_instanceIdHasBeenSet;
bool m_deleteElasticIp;
bool m_deleteElasticIpHasBeenSet;
bool m_deleteVolumes;
bool m_deleteVolumesHasBeenSet;
};
} // namespace Model
} // namespace OpsWorks
} // namespace Aws
|
/*
* nghttp2 - HTTP/2 C Library
*
* Copyright (c) 2013 Tatsuhiro Tsujikawa
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef NGHTTP2_HD_HUFFMAN_H
#define NGHTTP2_HD_HUFFMAN_H
#include <stdint.h>
#include <arpa/inet.h>
typedef enum {
/* FSA accepts this state as the end of huffman encoding
sequence. */
NGHTTP2_HUFF_ACCEPTED = 1 << 14,
/* This state emits symbol */
NGHTTP2_HUFF_SYM = 1 << 15,
} nghttp2_huff_decode_flag;
typedef struct {
/* fstate is the current huffman decoding state, which is actually
the node ID of internal huffman tree with
nghttp2_huff_decode_flag OR-ed. We have 257 leaf nodes, but they
are identical to root node other than emitting a symbol, so we
have 256 internal nodes [1..255], inclusive. The node ID 256 is
a special node and it is a terminal state that means decoding
failed. */
uint16_t fstate;
/* symbol if NGHTTP2_HUFF_SYM flag set */
uint8_t sym;
} nghttp2_huff_decode;
typedef nghttp2_huff_decode huff_decode_table_type[16];
typedef struct {
/* fstate is the current huffman decoding state. */
uint16_t fstate;
} nghttp2_hd_huff_decode_context;
typedef struct {
/* The number of bits in this code */
uint32_t nbits;
/* Huffman code aligned to LSB */
uint32_t code;
} nghttp2_huff_sym;
extern const nghttp2_huff_sym huff_sym_table[];
extern const nghttp2_huff_decode huff_decode_table[][16];
#endif /* NGHTTP2_HD_HUFFMAN_H */
|
/*
* Copyright (c) 2015 Lindem Data Acquisition AS. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use
* these files 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.
*
* Author: Joakim Myrland
* website: www.LDA.as
* email: joakim.myrland@LDA.as
* project: https://github.com/Lindem-Data-Acquisition-AS/iot_tiva_template/
*
*/
#include <stdbool.h>
#include <stdint.h>
#include <stddef.h>
#include "inc/hw_gpio.h"
#include "inc/hw_memmap.h"
#include "inc/hw_nvic.h"
#include "inc/hw_types.h"
#include "inc/tm4c129xnczad.h"
#include "driverlib/gpio.h"
#include "driverlib/pin_map.h"
#include "driverlib/rom.h"
#include "driverlib/rom_map.h"
#include "driverlib/sysctl.h"
#include "led_task.h"
#include "lwip_task.h"
#include "hello_world_task.h"
#include "FreeRTOS.h"
#include "task.h"
#include "queue.h"
#include "semphr.h"
uint32_t g_ui32SysClock;
#ifdef DEBUG
void
__error__(char *pcFilename, uint32_t ui32Line) {
send_debug_assert(pcFilename, ui32Line);
}
#endif
void
vApplicationStackOverflowHook(xTaskHandle *pxTask, signed char *pcTaskName) {
while(1) {
}
}
void
pin_init(void) {
// Enable all the GPIO peripherals
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOL);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOM);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPION);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOP);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOR);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOS);
// PF1/PK4/PK6 are used for Ethernet LEDs
ROM_GPIOPinConfigure(GPIO_PK4_EN0LED0);
ROM_GPIOPinConfigure(GPIO_PK6_EN0LED1);
GPIOPinTypeEthernetLED(GPIO_PORTK_BASE, GPIO_PIN_4);
GPIOPinTypeEthernetLED(GPIO_PORTK_BASE, GPIO_PIN_6);
#ifdef DEVKIT
// PN5 is used for the user LED
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_5);
ROM_GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_5, 0);
#else
// PA0-1 is used for the user LED
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_1 | GPIO_PIN_0);
ROM_GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_1 | GPIO_PIN_0, GPIO_PIN_0);
// PH2-3 is used for the user LED
ROM_GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_3 | GPIO_PIN_2);
ROM_GPIOPinWrite(GPIO_PORTH_BASE, GPIO_PIN_3 | GPIO_PIN_2, GPIO_PIN_3 | GPIO_PIN_2);
#endif
}
int
main(void) {
// Make sure the main oscillator is enabled because this is required by
// the PHY. The system must have a 25MHz crystal attached to the OSC
// pins. The SYSCTL_MOSC_HIGHFREQ parameter is used when the crystal
// frequency is 10MHz or higher.
SysCtlMOSCConfigSet(SYSCTL_MOSC_HIGHFREQ);
// Run from the PLL at 120 MHz.
g_ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
SYSCTL_OSC_MAIN |
SYSCTL_USE_PLL |
SYSCTL_CFG_VCO_480),
configCPU_CLOCK_HZ);
// Initialize the device pinout appropriately for this board.
pin_init();
// Create the LED task.
if (LEDTaskInit() != 0) {
while (1) {
}
}
// Create the lwIP tasks.
if (lwIPTaskInit() != 0) {
while (1) {
}
}
// Create the hello world task.
if (hello_world_init() != 0) {
while (1) {
}
}
// Start the scheduler. This should not return.
vTaskStartScheduler();
// In case the scheduler returns for some reason, loop forever.
while (1) {
}
}
|
#pragma once
#include <MI.h>
#include <memory>
namespace MI
{
class Instance;
class MIValue
{
private:
MI_Value m_value;
MI_Type m_type;
MI_Uint32 m_flags = 0;
void Delete(MI_Value& value, MI_Type type);
void SetNullValue();
void CopyString(const std::string& value);
void CopyWString(const std::wstring& value);
friend Instance;
public:
static std::shared_ptr<MIValue> FromBoolean(MI_Boolean value);
static std::shared_ptr<MIValue> FromSint8(MI_Sint8 value);
static std::shared_ptr<MIValue> FromUint8(MI_Uint8 value);
static std::shared_ptr<MIValue> FromSint16(MI_Sint16 value);
static std::shared_ptr<MIValue> FromUint16(MI_Uint16 value);
static std::shared_ptr<MIValue> FromChar16(MI_Char16 value);
static std::shared_ptr<MIValue> FromSint32(MI_Sint32 value);
static std::shared_ptr<MIValue> FromUint32(MI_Uint32 value);
static std::shared_ptr<MIValue> FromSint64(MI_Sint64 value);
static std::shared_ptr<MIValue> FromUint64(MI_Uint64 value);
static std::shared_ptr<MIValue> FromReal32(MI_Real32 value);
static std::shared_ptr<MIValue> FromReal64(MI_Real64 value);
static std::shared_ptr<MIValue> FromString(const std::string& value);
static std::shared_ptr<MIValue> FromString(const std::wstring& value);
static std::shared_ptr<MIValue> FromInstance(MI::Instance& value);
static std::shared_ptr<MIValue> FromReference(MI::Instance& value);
static std::shared_ptr<MIValue> CreateArray(MI_Uint32 arraySize, MI_Type type);
void SetArrayItem(const MIValue& value, MI_Uint32 index);
MIValue(void* value, MI_Type type);
MIValue(MI_Type type);
MIValue(const MI_Value& value, MI_Type type, MI_Uint32 flags = 0) : m_value(value), m_type(type), m_flags(flags) {}
virtual ~MIValue();
static unsigned GetItemSize(MI_Type valueType);
};
}
|
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
#ifndef SRC_PIPE_WRAP_H_
#define SRC_PIPE_WRAP_H_
#include "defs.hh"
#include "stream_wrap.h"
namespace node {
class PipeWrap : public StreamWrap {
public:
uv_pipe_t* UVHandle();
static v8::Local<v8::Object> Instantiate(Environment* env);
static void Initialize(v8::Handle<v8::Object> target,
v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context);
private:
PipeWrap(Environment* env, v8::Handle<v8::Object> object, bool ipc);
static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Bind(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Listen(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Connect(const v8::FunctionCallbackInfo<v8::Value>& args);
static void Open(const v8::FunctionCallbackInfo<v8::Value>& args);
#ifdef _WIN32
static void SetPendingInstances(
const v8::FunctionCallbackInfo<v8::Value>& args);
#endif
static void OnConnection(uv_stream_t* handle, int status);
static void AfterConnect(uv_connect_t* req, int status);
uv_pipe_t handle_;
};
} // namespace node
#endif // SRC_PIPE_WRAP_H_
|
/**
* A class which describes the properties and actions of a socket.
*
* @date Jul 6, 2014
* @author Joeri HERMANS
* @version 0.1
*
* Copyright 2013 Joeri HERMANS
*
* 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 SOCKET_H_
#define SOCKET_H_
// BEGIN Includes. ///////////////////////////////////////////////////
// System dependencies.
#include <sys/time.h>
// Application dependencies.
#include <ias/io/reader/reader.h>
#include <ias/io/writer/writer.h>
// END Includes. /////////////////////////////////////////////////////
class Socket {
public:
// BEGIN Class constants. ////////////////////////////////////////
// END Class constants. //////////////////////////////////////////
private:
// BEGIN Private members. ////////////////////////////////////////
// END Private members. //////////////////////////////////////////
// BEGIN Private methods. ////////////////////////////////////////
// END Private methods. //////////////////////////////////////////
protected:
// BEGIN Protected methods. //////////////////////////////////////
// END Protected methods. ////////////////////////////////////////
public:
// BEGIN Constructors. ///////////////////////////////////////////
Socket( void ) = default;
// END Constructors. /////////////////////////////////////////////
// BEGIN Destructor. /////////////////////////////////////////////
virtual ~Socket( void ) = default;
// END Destructor. ///////////////////////////////////////////////
// BEGIN Public methods. /////////////////////////////////////////
virtual void closeConnection( void ) = 0;
virtual bool createConnection( const std::string & address,
const std::size_t port ) = 0;
virtual bool isConnected( void ) const = 0;
virtual Reader * getReader( void ) const = 0;
virtual Writer * getWriter( void ) const = 0;
virtual void setReceiveTimeout( const struct timeval & tv ) = 0;
virtual void setSendTimeout( const struct timeval & tv ) = 0;
// END Public methods. ///////////////////////////////////////////
// BEGIN Static methods. /////////////////////////////////////////
// END Static methods. ///////////////////////////////////////////
};
#endif /* SOCKET_H_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.