text stringlengths 4 6.14k |
|---|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <OfficeImport/EDGradientFill.h>
@interface EDGradientFill (EDInternal)
+ (id)gradientWithType:(int)arg1 degree:(double)arg2 focusRect:(struct CGRect)arg3 stops:(id)arg4 resources:(id)arg5;
+ (id)gradientWithType:(int)arg1 degree:(double)arg2 top:(double)arg3 bottom:(double)arg4 right:(double)arg5 left:(double)arg6 stops:(id)arg7 resources:(id)arg8;
- (id)initWithType:(int)arg1 degree:(double)arg2 focusRect:(struct CGRect)arg3 stops:(id)arg4 resources:(id)arg5;
- (id)initWithType:(int)arg1 degree:(double)arg2 top:(double)arg3 bottom:(double)arg4 right:(double)arg5 left:(double)arg6 stops:(id)arg7 resources:(id)arg8;
@end
|
#pragma once
#include <fbxsdk.h>
#ifdef IOS_REF
#undef IOS_REF
#define IOS_REF (*(pSdkManager->GetIOSettings()))
#endif
using namespace System;
using namespace System::Collections::Generic;
using namespace System::IO;
#define WITH_MARSHALLED_STRING(name,str,block)\
{ \
char* name; \
try \
{ \
name = StringToUTF8(str); \
block \
} \
finally \
{ \
delete name; \
} \
}
static char* FBXVersion[] =
{
FBX_2010_00_COMPATIBLE,
FBX_2011_00_COMPATIBLE,
FBX_2012_00_COMPATIBLE,
FBX_2013_00_COMPATIBLE,
FBX_2014_00_COMPATIBLE,
FBX_2016_00_COMPATIBLE
};
namespace AssetStudio {
public ref class Fbx
{
public:
static Vector3 QuaternionToEuler(Quaternion q);
static Quaternion EulerToQuaternion(Vector3 v);
static char* StringToUTF8(String^ s);
static void Init(FbxManager** pSdkManager, FbxScene** pScene);
ref class Exporter
{
public:
static void Export(String^ path, IImported^ imported, bool eulerFilter, float filterPrecision,
bool allNodes, bool skins, bool animation, bool blendShape, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii);
private:
bool exportSkins;
float boneSize;
IImported^ imported;
HashSet<String^>^ framePaths;
Dictionary<ImportedFrame^, size_t>^ frameToNode;
List<ImportedFrame^>^ meshFrames;
char* cDest;
FbxManager* pSdkManager;
FbxScene* pScene;
FbxExporter* pExporter;
FbxArray<FbxSurfacePhong*>* pMaterials;
FbxArray<FbxFileTexture*>* pTextures;
FbxPose* pBindPose;
Exporter(String^ name, IImported^ imported, bool allNodes, bool skins, bool castToBone, float boneSize, float scaleFactor, int versionIndex, bool isAscii);
~Exporter();
void Exporter::LinkTexture(ImportedMaterialTexture^ texture, FbxFileTexture* pTexture, FbxProperty& prop);
void SetJointsNode(ImportedFrame^ frame, HashSet<String^>^ bonePaths, bool allBones);
HashSet<String^>^ SearchHierarchy();
void SearchHierarchy(ImportedFrame^ frame, HashSet<String^>^ exportFrames);
void SetJointsFromImportedMeshes(bool allBones);
void ExportFrame(FbxNode* pParentNode, ImportedFrame^ frame);
void ExportMesh(FbxNode* pFrameNode, ImportedMesh^ iMesh);
FbxFileTexture* ExportTexture(ImportedTexture^ matTex);
void ExportAnimations(bool eulerFilter, float filterValue);
void ExportKeyframedAnimation(ImportedKeyframedAnimation^ parser, FbxString& kTakeName, FbxAnimCurveFilterUnroll* eulerFilter, float filterPrecision);
void ExportMorphs();
};
};
}
|
#ifndef OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_UTIL_POLYMESH_IS_NEIGHBOR_H
#define OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_UTIL_POLYMESH_IS_NEIGHBOR_H
//
// OpenTissue Template Library
// - A generic toolbox for physics-based modeling and simulation.
// Copyright (C) 2008 Department of Computer Science, University of Copenhagen.
//
// OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php
//
#include <OpenTissue/configuration.h>
#include <OpenTissue/core/containers/mesh/polymesh/polymesh_edge.h>
#include <OpenTissue/core/containers/mesh/polymesh/polymesh_halfedge.h>
#include <OpenTissue/core/containers/mesh/polymesh/polymesh_vertex.h>
#include <OpenTissue/core/containers/mesh/polymesh/polymesh_face.h>
namespace OpenTissue
{
namespace polymesh
{
template<typename mesh_type>
bool is_neighbor(PolyMeshFace<mesh_type> const & f, PolyMeshVertex<mesh_type> const & vertex)
{
typedef typename mesh_type::const_face_vertex_circulator const_face_vertex_circulator;
const_face_vertex_circulator v(f),end;
for(; v!=end; ++v)
if( v->get_handle().get_idx() == vertex.get_handle().get_idx())
return true;
return false;
}
template<typename mesh_type>
bool is_neighbor(PolyMeshFace<mesh_type> const & f,PolyMeshHalfEdge<mesh_type> const & h)
{
if(h.get_face_handle().get_idx() == f.get_handle().get_idx())
return true;
return false;
}
template<typename mesh_type>
bool is_neighbor(PolyMeshFace<mesh_type> const & face,PolyMeshEdge<mesh_type> const & e)
{
typedef typename mesh_type::halfedge_iterator halfedge_iterator;
halfedge_iterator h0 = e.get_halfedge0_iterator();
halfedge_iterator h1 = e.get_halfedge1_iterator();
if(is_neighbor(face,*h0) || is_neighbor(face,*h1))
return true;
return false;
}
template<typename mesh_type>
bool is_neighbor(PolyMeshFace<mesh_type> const & f0,PolyMeshFace<mesh_type> const & f1)
{
typedef typename mesh_type::const_face_edge_circulator const_face_edge_circulator;
const_face_edge_circulator e(f0),end;
for(;e!=end;++e)
if( is_neighbor(f1,*e))
return true;
return false;
}
} // namespace polymesh
} // namespace OpenTissue
//OPENTISSUE_CORE_CONTAINERS_MESH_POLYMESH_UTIL_POLYMESH_IS_NEIGHBOR_H
#endif
|
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2015, University of Ostrava, Institute for Research and Applications of Fuzzy Modeling,
// Pavel Vlasanek, all rights reserved. Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's 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.
//
// * The name of the copyright holders may not 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 Intel Corporation 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.
//
//M*/
#ifndef __OPENCV_PHASH_FAST_HPP__
#define __OPENCV_PHASH_FAST_HPP__
#include <opencv2/opencv.hpp>
#include "img_hash_base.hpp"
namespace cv
{
namespace img_hash
{
//! @addtogroup p_hash
//! @{
/** @brief Computes pHash value of the input image
@param inputArr input image want to compute hash value,
type should be CV_8UC4, CV_8UC3, CV_8UC1.
@param outputArr Hash value of input, it will contain 8 uchar value
*/
CV_EXPORTS_W void pHash_Fast(cv::InputArray inputArr,
cv::OutputArray outputArr);
class CV_EXPORTS_W PHash_Fast : public ImgHashBase
{
public:
CV_WRAP ~PHash_Fast();
/** @brief Computes PHash_Fast of the input image
@param inputArr input image want to compute hash value,
type should be CV_8UC4, CV_8UC3, CV_8UC1.
@param outputArr hash of the image
*/
CV_WRAP virtual void compute(cv::InputArray inputArr,
cv::OutputArray outputArr);
/** @brief Compare the hash value between inOne and inTwo
@param hashOne Hash value one
@param hashTwo Hash value two
@return zero means the images are likely very similar;
5 means a few things maybe different; 10 or more means
they maybe are very different image
*/
CV_WRAP virtual double compare(cv::InputArray hashOne,
cv::InputArray hashTwo) const;
CV_WRAP static Ptr<PHash_Fast> create();
/** Returns the algorithm string identifier.*/
CV_WRAP virtual String getDefaultName() const;
private:
cv::Mat bitsImg;
cv::Mat dctImg;
cv::Mat grayFImg;
cv::Mat grayImg;
cv::Mat resizeImg;
cv::Mat topLeftDCT;
};
//! @}
}
}
#endif // __OPENCV_PHASH_FAST_HPP__
|
#ifndef __CUTFIND
#define __CUTFIND
class cutfinder : public ofThread{
private:
bool autocut;
int autocut_direction, autocut_startframe, autocut_minlength, autocut_threshold;
ofVideoPlayer fingerMovie;
ofxCvColorImage colorImg;
ofxCvGrayscaleImage redDiff, redBG,red;
ofxCvGrayscaleImage greenDiff, greenBG, green;
ofxCvGrayscaleImage blueDiff, blueBG, blue;
int avg;
public:
cutfinder(){
}
void start(ofVideoPlayer &movie, int _autocut_direction, int _autocut_minlength, int _autocut_threshold){
autocut = true;
fingerMovie = movie;
if (!fingerMovie.isLoaded()) {
return;
}
autocut_direction = _autocut_direction;
autocut_minlength = _autocut_minlength;
autocut_threshold = _autocut_threshold;
colorImg.setUseTexture(false);
redDiff.setUseTexture(false);
redBG.setUseTexture(false);
red.setUseTexture(false);
greenDiff.setUseTexture(false);
greenBG.setUseTexture(false);
green.setUseTexture(false);
blueDiff.setUseTexture(false);
blueBG.setUseTexture(false);
blue.setUseTexture(false);
autocut_startframe = fingerMovie.getCurrentFrame();
startThread();
}
void updateColorSize() {
if (colorImg.getWidth() != fingerMovie.getWidth() || colorImg.getHeight() != fingerMovie.getHeight()) {
colorImg.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
red.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
redBG.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
redDiff.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
green.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
greenBG.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
greenDiff.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
blue.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
blueBG.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
blueDiff.allocate(fingerMovie.getWidth(),fingerMovie.getHeight());
}
}
int avgPixel(ofPixelsRef & px) {
int i = 0;
int tot = 0;
while( i < px.size()) {
tot += px[i];
i+=5;
}
tot /= (px.size()/5);
return tot;
}
//
void updateColorPics() {
colorImg.setFromPixels(fingerMovie.getPixelsRef());
colorImg.convertToGrayscalePlanarImages(red, green, blue);
redDiff.absDiff(redBG,red);
redDiff.threshold(30);
greenDiff.absDiff(greenBG, green);
greenDiff.threshold(30);
blueDiff.absDiff(blueBG,blue);
blueDiff.threshold(30);
redBG = red;
greenBG = green;
blueBG = blue;
}
bool updateSync(ofVideoPlayer &movie, int _autocut_direction, int _autocut_minlength, int _autocut_threshold, int _autocut_startframe) {
fingerMovie = movie;
autocut_startframe = _autocut_startframe;
autocut_direction = _autocut_direction;
autocut_minlength = _autocut_minlength;
autocut_threshold = _autocut_threshold;
updateColorSize();
return update();
}
bool update(){
//do we have a new frame?
fingerMovie.setFrame(fingerMovie.getCurrentFrame()+autocut_direction);
fingerMovie.update();
updateColorPics();
avg = (avgPixel(redDiff.getPixelsRef()) + avgPixel(greenDiff.getPixelsRef()) + avgPixel(blueDiff.getPixelsRef())) / 3;
if (avg > autocut_threshold && fingerMovie.getCurrentFrame() - autocut_startframe > autocut_minlength) {
return true;
}
if (isThreadRunning() && autocut && fingerMovie.getCurrentFrame()<fingerMovie.getTotalNumFrames()-1) {
update();
}
else {
return false;
}
}
void stop(){
}
void threadedFunction(){
fingerMovie.setUseTexture(false);
updateColorSize();
update();
fingerMovie.setUseTexture(true);
}
};
#endif
|
/**************************
* map.c
* (c) 2013 Daniel Burgener
* Map
**************************/
#include <ncurses.h>
#include <stdlib.h>
#include "map.h"
// Generate a map.
// For now it just generates a big floor with a wall and a door in the middle.
map_t *gen_map() {
// Let's just start with a static map for now.
map_t *map = malloc(sizeof(map_t));
// Initialize to all floors
for (int i = 0; i < MAX_HEIGHT; i++) {
for (int j = 0; j < MAX_WIDTH; j++) {
(*map)[i][j] = FLOOR_TILE;
}
}
//Put in a wall
(*map)[15][15] = WALL_TILE;
(*map)[15][16] = WALL_TILE;
(*map)[15][17] = WALL_TILE;
(*map)[15][18] = CLOSED_DOOR_TILE;
(*map)[15][19] = WALL_TILE;
(*map)[15][20] = WALL_TILE;
(*map)[15][21] = WALL_TILE;
return map;
}
// Print a map
void print_map(map_t map) {
for (int i = 0; i < MAX_HEIGHT; i++) {
for (int j = 0; j < MAX_WIDTH; j++) {
mvaddch(i,j,map[i][j].disp);
}
}
}
|
#ifndef MATERIAL_H
#define MATERIAL_H
#include "color.h"
#include "TextureFactory.h"
/** Encapsulates texture and material settings */
class Material {
public:
/** Default Constructor */
Material();
/** Copy Constructor */
Material(const Material &mat);
/**
Sets a texture for the material and leaves all else at default values.
@param fileName Texture file name
*/
Material(TextureFactory::Handle *texture);
/** Clears the state of the Material and resets it */
void clear();
/**
Adds a texture to the list of textures to apply during multitexturing
@param textureHandle A handle to the texture
*/
void setTexture(TextureFactory::Handle *textureHandle);
/** Passes Material information to the currently bound Effect. */
void bind() const;
/** Gets the file name of the texture */
inline FileName getFileName() const {
return texture->getFileName();
}
private:
/**
Copies across from another material
@param mat The object to copy
*/
void copy(const Material &mat);
/** Applies texture filter settings */
static void setTextureFilters();
public:
bool glow;
color Ka;
color Kd;
color Ks;
float shininess;
/**
Handle to the texture resource. Texture resource may be reloaded or
altered behind the scenes by the texture manager.
*/
TextureFactory::Handle *texture;
};
#endif
|
/* from https://lists.mpich.org/pipermail/discuss/2019-January/011136.html */
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int main(void)
{
int rank, size,i;
MPI_Init(NULL,NULL);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &size);
double* buf = malloc(323262400L*sizeof(double));
for(i=(1<<28)-4; i< (1<<28)+4; i++){
printf("Size: %i\n", i);
MPI_Sendrecv_replace(buf, i, MPI_DOUBLE, size-rank-1, 1111, size-rank-1, 1111, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
}
MPI_Sendrecv_replace(buf, 323262400, MPI_DOUBLE, size-rank-1, 1111, size-rank-1, 1111, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
MPI_Finalize();
return 0;
}
|
/*
* Generated by class-dump 3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2012 by Steve Nygard.
*/
#import "NSWindowDelegate.h"
@protocol MailFullScreenWindowDelegate <NSWindowDelegate>
- (void)restoreFrame;
- (BOOL)mailFullScreenWindowShouldClose:(id)arg1;
- (id)windowForMailFullScreen;
@end
|
#include "types.h"
#include "param.h"
#include "memlayout.h"
#include "mmu.h"
#include "proc.h"
#include "defs.h"
#include "x86.h"
#include "elf.h"
int
exec(char *path, char **argv)
{
char *s, *last;
int i, off;
uint argc, sz, sp, ustack[3+MAXARG+1];
struct elfhdr elf;
struct inode *ip;
struct proghdr ph;
pde_t *pgdir, *oldpgdir;
begin_op();
if((ip = namei(path)) == 0){
end_op();
return -1;
}
ilock(ip);
pgdir = 0;
// Check ELF header
if(readi(ip, (char*)&elf, 0, sizeof(elf)) < sizeof(elf))
goto bad;
if(elf.magic != ELF_MAGIC)
goto bad;
if((pgdir = setupkvm()) == 0)
goto bad;
// Load program into memory.
sz = PGSIZE-1;
for(i=0, off=elf.phoff; i<elf.phnum; i++, off+=sizeof(ph)){
if(readi(ip, (char*)&ph, off, sizeof(ph)) != sizeof(ph))
goto bad;
if(ph.type != ELF_PROG_LOAD)
continue;
if(ph.memsz < ph.filesz)
goto bad;
if(ph.vaddr + ph.memsz < ph.vaddr)
goto bad;
if((sz = allocuvm(pgdir, sz, ph.vaddr + ph.memsz)) == 0)
goto bad;
if(ph.vaddr % PGSIZE != 0)
goto bad;
if(loaduvm(pgdir, (char*)ph.vaddr, ip, ph.off, ph.filesz) < 0)
goto bad;
}
iunlockput(ip);
end_op();
ip = 0;
// Allocate two pages at the next page boundary.
// Make the first inaccessible. Use the second as the user stack.
sz = PGROUNDUP(sz);
if((sz = allocuvm(pgdir, sz, sz + 2*PGSIZE)) == 0)
goto bad;
clearpteu(pgdir, (char*)(sz - 2*PGSIZE));
sp = sz;
// Push argument strings, prepare rest of stack in ustack.
for(argc = 0; argv[argc]; argc++) {
if(argc >= MAXARG)
goto bad;
sp = (sp - (strlen(argv[argc]) + 1)) & ~3;
if(copyout(pgdir, sp, argv[argc], strlen(argv[argc]) + 1) < 0)
goto bad;
ustack[3+argc] = sp;
}
ustack[3+argc] = 0;
ustack[0] = 0xffffffff; // fake return PC
ustack[1] = argc;
ustack[2] = sp - (argc+1)*4; // argv pointer
sp -= (3+argc+1) * 4;
if(copyout(pgdir, sp, ustack, (3+argc+1)*4) < 0)
goto bad;
// Save program name for debugging.
for(last=s=path; *s; s++)
if(*s == '/')
last = s+1;
safestrcpy(proc->name, last, sizeof(proc->name));
// Commit to the user image.
oldpgdir = proc->pgdir;
proc->pgdir = pgdir;
proc->sz = sz;
proc->tf->eip = elf.entry; // main
proc->tf->esp = sp;
switchuvm(proc);
freevm(oldpgdir);
return 0;
bad:
if(pgdir)
freevm(pgdir);
if(ip){
iunlockput(ip);
end_op();
}
return -1;
}
|
#ifndef __APROJECT_MATH__
#define __APROJECT_MATH__
#pragma once
using namespace std;
struct AColor
{
AReal32 a;
AReal32 r;
AReal32 g;
AReal32 b;
AColor ()
{
a = r = g = b = 1.0f;
};
AColor (AReal32 fColor)
{
a = r = g = b = fColor;
};
AColor (AReal32 fR, AReal32 fG, AReal32 fB)
{
r = fR;
g = fG;
b = fB;
};
AColor (AReal32 fA, AReal32 fR, AReal32 fG, AReal32 fB)
{
a = fA;
r = fR;
g = fG;
b = fB;
};
~AColor ()
{
};
AUInt32 GetD3DColor (void);
};
struct AVector3
{
AReal32 x;
AReal32 y;
AReal32 z;
AVector3 (AReal32 fX, AReal32 fY, AReal32 fZ)
{
x = fX;
y = fY;
z = fZ;
};
AVector3 (AReal32 fValue)
{
x = y = z = fValue;
};
AVector3 ()
{
x = 0.0f;
y = 0.0f;
z = 0.0f;
};
AVector3 (D3DXVECTOR3 vec)
{
x = vec.x;
y = vec.y;
z = vec.z;
}
bool operator== (const AVector3 &fValue) const;
bool operator!= (const AVector3 &fValue) const;
AVector3 operator- () const;
AVector3 operator- (const AVector3 &fValue) const;
AVector3 operator+ (const AVector3 &fValue) const;
AVector3 operator/ (AReal32 divider) const;
AVector3 operator* (AReal32 scaleFactor) const; //!< ³»Àû ¿¬»ê
AVector3& operator+= (const AVector3 &fValue);
AVector3& operator-= (const AVector3 &fValue);
AVector3& operator*= (AReal32 f); //!< ³»Àû ¿¬»ê
AVector3& operator/= (AReal32 f);
AVector3 operator* (AVector3 &fValue); //!< ¿ÜÀû ¿¬»ê
AVector3& operator= (AVector3 &fValue);
public:
AReal32 Length (void);
AReal32 LengthSquared (void);
static AReal32 Distance (const AVector3& fOne, const AVector3& fTwo);
static AReal32 DistanceSquared (const AVector3& fOne, const AVector3& fTwo);
static AReal32 Dot (const AVector3& fOne, const AVector3& fTwo); //!< ³»Àû ¿¬»ê
AVector3 Dot (AVector3& fValue); //!< ¿ÜÀû ¿¬»ê
void Copy (const AVector3& fValue);
AVector3 Normalize (void);
D3DXVECTOR3 D3DXVector(void);
static AVector3 Normalize (const AVector3& fValue);
};
RECT CreateRECT (int nX, int nY, int nW, int nH);
int Log2 (int n);
int Pow2 (int n);
bool IsInRect (RECT* rc, POINT pt);
D3DXVECTOR3 WorldToClient (D3DXVECTOR3 vPosition);
#endif |
// " City== NewMarlene && pop == 47182047 && elevation > = 8.0 "
#define EXPRESSION CityIs("NewMarlene") && pop == 47182047 && elevation >= 8.0 |
//
// NSDictionary+IDPSignup.h
// IDPSignup
//
// Created by 能登 要 on 2015/11/09.
// Copyright © 2015年 Irimasu Densan Planning. All rights reserved.
//
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger,IDPSignupPropertyDestinationType)
{
IDPSignupPropertyDestinationTypeUser
,IDPSignupPropertyDestinationTypeObject
};
typedef NS_ENUM(NSInteger,IDPSignupRoleGenerateType)
{
IDPSignupRoleGenerateTypeExist
,IDPSignupRoleGenerateTypeNew
,IDPSignupRoleGenerateTypeExistNew
};
@class PFObject;
@interface NSDictionary (IDPSignup)
+ (NSDictionary *) dictionaryWithPropertyName:(NSString *)propertyName className:(NSString *)className objectId:(NSString *)objectId destinationType:(IDPSignupPropertyDestinationType)destinationType;
+ (NSDictionary *) dictionaryWithPropertyName:(NSString *)propertyName object:(PFObject *)object destinationType:(IDPSignupPropertyDestinationType)destinationType;
+ (NSDictionary *) dictionaryWithRelationsName:(NSString *)relationshipName className:(NSString *)className objectId:(NSString *)objectId destinationType:(IDPSignupPropertyDestinationType)destinationType;
+ (NSDictionary *) dictionaryWithRelationsName:(NSString *)relationshipName object:(PFObject *)object destinationType:(IDPSignupPropertyDestinationType)destinationType;
+ (NSDictionary *) dictionaryWithRoleName:(NSString *)roleName generateType:(IDPSignupRoleGenerateType)generateType acceptRoles:(NSArray *)acceptRoles;
@end
|
//
// QLQRCodeViewController.h
// QRCode
//
// Created by huangyueqi on 2017/5/11.
// Copyright © 2017年 sjyt. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface QLQRCodeViewController : UIViewController
@end
|
#import "MOBProjection.h"
@interface MOBProjectionEPSG3587 : MOBProjection
@end
|
#ifndef PROCESS_H_
#define PROCESS_H_
#include <stdint.h>
#include <sys/time.h>
#include "monikor.h"
#define MOD_NAME "process"
int poll_processes_metrics(monikor_t *mon, struct timeval *clock);
#endif /* end of include guard: PROCESS_H_ */
|
/* -*- c-style: gnu -*-
Copyright (c) 2015 John Harper <jsh@unfactored.org>
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 <AppKit/NSFont.h>
@interface ActFont : NSFont
+ (NSFont *)bodyFontOfSize:(CGFloat)size;
+ (NSFont *)mediumSystemFontOfSize:(CGFloat)size;
@end
|
//
// UITableViewCell+ELNUtils.h
// e-legion
//
// Created by Dmitry Nesterenko on 01.12.15.
// Copyright © 2015 e-legion. All rights reserved.
//
@import UIKit;
/// Returns default separator insets for cell.
extern UIEdgeInsets ELNTableViewCellDefaultSeparatorInsets();
@interface UITableViewCell (ELNUtils)
- (void)eln_setSeparatorInset:(UIEdgeInsets)separatorInset;
/// Returns height for autolayout based cell.
- (CGFloat)eln_heightForWidth:(CGFloat)width configuration:(void (^)(UITableViewCell *cell))configuration;
@end
|
#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 2
#define CLIENT_VERSION_MINOR 3
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X
#endif // CLIENTVERSION_H
|
//
// Created by Francisco Facioni on 14/3/16.
//
#ifndef BACKGROUND_ONIREADER_H
#define BACKGROUND_ONIREADER_H
#include <memory>
#include <string>
#include <chrono>
class OniReader {
class Impl;
std::shared_ptr<Impl> impl;
public:
class Frame {
public:
typedef std::shared_ptr<Frame> Ptr;
typedef std::shared_ptr<const Frame> ConstPtr;
Frame(uint32_t width, uint32_t height, double zeroPlanePixelSize, uint64_t zeroPlaneDistance)
: width(width)
, height(height)
, zeroPlanePixelSize(zeroPlanePixelSize)
, zeroPlaneDistance(zeroPlaneDistance)
, rgb (new uint8_t[3*width*height])
, depth (new uint16_t[width*height])
{}
const uint32_t width;
const uint32_t height;
const double zeroPlanePixelSize;
const uint64_t zeroPlaneDistance;
std::chrono::microseconds timestamp;
const std::unique_ptr<uint8_t[]> rgb;
const std::unique_ptr<uint16_t[]> depth;
};
OniReader(const std::string& file);
bool isOpen() const;
bool read(Frame::Ptr& frame);
};
#endif //BACKGROUND_ONIREADER_H
|
#pragma once
#include "PR_Config.h"
namespace PR {
namespace Normal {
/// Evaluate gaussian
inline float PR_LIB_BASE eval(float x, float mean, float stddev)
{
constexpr float SQRT_2PI = 2.5066282746310f;
const float k = (x - mean) / stddev;
return std::exp(-k * k / 2) / (SQRT_2PI * stddev);
}
/// Inverse of the error function for -1 < x < 1
/// Based on https://stackoverflow.com/questions/27229371/inverse-error-function-in-c by njuffa
inline float PR_LIB_BASE erfinv(float x)
{
const float t = std::log(std::max(std::fma(x, -x, 1.0f), std::numeric_limits<float>::min()));
float p;
if (std::abs(t) > 6.125f) { // maximum ulp error = 2.35793
p = 3.03697567e-10f; // 0x1.4deb44p-32
p = std::fma(p, t, 2.93243101e-8f); // 0x1.f7c9aep-26
p = std::fma(p, t, 1.22150334e-6f); // 0x1.47e512p-20
p = std::fma(p, t, 2.84108955e-5f); // 0x1.dca7dep-16
p = std::fma(p, t, 3.93552968e-4f); // 0x1.9cab92p-12
p = std::fma(p, t, 3.02698812e-3f); // 0x1.8cc0dep-9
p = std::fma(p, t, 4.83185798e-3f); // 0x1.3ca920p-8
p = std::fma(p, t, -2.64646143e-1f); // -0x1.0eff66p-2
p = std::fma(p, t, 8.40016484e-1f); // 0x1.ae16a4p-1
} else { // maximum ulp error = 2.35456
p = 5.43877832e-9f; // 0x1.75c000p-28
p = std::fma(p, t, 1.43286059e-7f); // 0x1.33b458p-23
p = std::fma(p, t, 1.22775396e-6f); // 0x1.49929cp-20
p = std::fma(p, t, 1.12962631e-7f); // 0x1.e52bbap-24
p = std::fma(p, t, -5.61531961e-5f); // -0x1.d70c12p-15
p = std::fma(p, t, -1.47697705e-4f); // -0x1.35be9ap-13
p = std::fma(p, t, 2.31468701e-3f); // 0x1.2f6402p-9
p = std::fma(p, t, 1.15392562e-2f); // 0x1.7a1e4cp-7
p = std::fma(p, t, -2.32015476e-1f); // -0x1.db2aeep-3
p = std::fma(p, t, 8.86226892e-1f); // 0x1.c5bf88p-1
}
return x * p;
}
/// Sample based on the gaussian
inline float PR_LIB_BASE sample(float u, float mean, float stddev)
{
// Scale u from [0,1) to [EPS, 1-EPS)
constexpr float EPS = 1e-5f;
u = (1 - 2 * EPS) * u + EPS;
return mean + PR_SQRT2 * stddev * erfinv(2 * u - 1);
}
inline float pdf(float x, float mean, float stddev)
{
return eval(x, mean, stddev);
}
/// Sample based on the truncated gaussian
/// This may have some problems! -> https://en.wikipedia.org/wiki/Truncated_normal_distribution
inline float PR_LIB_BASE sample(float u, float mean, float stddev, float a, float b)
{
const float alpha = (a - mean) / stddev;
const float beta = (b - mean) / stddev;
const float CDF_A = (1 + std::erf(alpha / PR_SQRT2)) / 2;
const float CDF_B = (1 + std::erf(beta / PR_SQRT2)) / 2;
return sample(CDF_A + u * (CDF_B - CDF_A), mean, stddev);
}
/// Truncated PDF
inline float pdf(float x, float mean, float stddev, float a, float b)
{
const float alpha = (a - mean) / stddev;
const float beta = (b - mean) / stddev;
const float CDF_A = (1 + std::erf(alpha / PR_SQRT2)) / 2;
const float CDF_B = (1 + std::erf(beta / PR_SQRT2)) / 2;
return pdf(x, mean, stddev) / (CDF_B - CDF_A);
}
} // namespace Normal
} // namespace PR |
#ifndef ELYSIUM_FETCHWALLETTX_H
#define ELYSIUM_FETCHWALLETTX_H
class uint256;
#include <map>
#include <string>
namespace elysium
{
/** Gets the byte offset of a transaction from the transaction index. */
unsigned int GetTransactionByteOffset(const uint256& txid);
/** Returns an ordered list of Elysium transactions that are relevant to the wallet. */
std::map<std::string, uint256> FetchWalletElysiumTransactions(unsigned int count, int startBlock = 0, int endBlock = 999999);
}
#endif // ELYSIUM_FETCHWALLETTX_H
|
/*
* File: mcs.c
* Author: Tudor David <tudor.david@epfl.ch>
*
* Description:
* MCS lock implementation
*
* The MIT License (MIT)
*
* Copyright (c) 2013 Tudor David
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
* the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "mcs.h"
int mcs_trylock(mcs_lock *L, mcs_qnode_ptr I) {
I->next=NULL;
#ifndef __tile__
if (CAS_PTR(L, NULL, I)==NULL) return 0;
return 1;
#else
MEM_BARRIER;
if (CAS_PTR( L, NULL, I)==NULL) return 0;
return 1;
#endif
}
void mcs_acquire(mcs_lock *L, mcs_qnode_ptr I)
{
I->next = NULL;
#ifndef __tile__
mcs_qnode_ptr pred = (mcs_qnode*) SWAP_PTR((volatile void*) L, (void*) I);
#else
MEM_BARRIER;
mcs_qnode_ptr pred = (mcs_qnode*) SWAP_PTR( L, I);
#endif
if (pred == NULL) /* lock was free */
return;
I->waiting = 1; // word on which to spin
MEM_BARRIER;
pred->next = I; // make pred point to me
#if defined(OPTERON_OPTIMIZE)
PREFETCHW(I);
#endif /* OPTERON_OPTIMIZE */
while (I->waiting != 0)
{
#ifndef __MIC__
PAUSE;
#endif
#if defined(OPTERON_OPTIMIZE)
pause_rep(23);
PREFETCHW(I);
#endif /* OPTERON_OPTIMIZE */
}
}
void mcs_release(mcs_lock *L, mcs_qnode_ptr I)
{
#ifdef __tile__
MEM_BARRIER;
#endif
mcs_qnode_ptr succ;
#if defined(OPTERON_OPTIMIZE)
PREFETCHW(I);
#endif /* OPTERON_OPTIMIZE */
if (!(succ = I->next)) /* I seem to have no succ. */
{
/* try to fix global pointer */
if (CAS_PTR(L, I, NULL) == I)
return;
do {
succ = I->next;
#ifndef __MIC__
PAUSE;
#endif
} while (!succ); // wait for successor
}
succ->waiting = 0;
}
int is_free_mcs(mcs_lock *L ){
if ((*L) == NULL) return 1;
return 0;
}
/*
Methods for easy lock array manipulation
*/
mcs_global_params* init_mcs_array_global(uint32_t num_locks) {
uint32_t i;
mcs_global_params* the_locks = (mcs_global_params*)malloc(num_locks * sizeof(mcs_global_params));
for (i=0;i<num_locks;i++) {
the_locks[i].the_lock=(mcs_lock*)malloc(sizeof(mcs_lock));
*(the_locks[i].the_lock)=0;
}
MEM_BARRIER;
return the_locks;
}
mcs_qnode** init_mcs_array_local(uint32_t thread_num, uint32_t num_locks) {
set_cpu(thread_num);
//init its qnodes
uint32_t i;
mcs_qnode** the_qnodes = (mcs_qnode**)malloc(num_locks * sizeof(mcs_qnode*));
for (i=0;i<num_locks;i++) {
the_qnodes[i]=(mcs_qnode*)malloc(sizeof(mcs_qnode));
}
MEM_BARRIER;
return the_qnodes;
}
void end_mcs_array_local(mcs_qnode** the_qnodes, uint32_t size) {
uint32_t i;
for (i = 0; i < size; i++) {
free(the_qnodes[i]);
}
free(the_qnodes);
}
void end_mcs_array_global(mcs_global_params* the_locks, uint32_t size) {
uint32_t i;
for (i = 0; i < size; i++) {
free(the_locks[i].the_lock);
}
free(the_locks);
}
int init_mcs_global(mcs_global_params* the_lock) {
the_lock->the_lock=(mcs_lock*)malloc(sizeof(mcs_lock));
*(the_lock->the_lock)=0;
MEM_BARRIER;
return 0;
}
int init_mcs_local(uint32_t thread_num, mcs_qnode** the_qnode) {
set_cpu(thread_num);
(*the_qnode)=(mcs_qnode*)malloc(sizeof(mcs_qnode));
MEM_BARRIER;
return 0;
}
void end_mcs_local(mcs_qnode* the_qnodes) {
free(the_qnodes);
}
void end_mcs_global(mcs_global_params the_locks) {
free(the_locks.the_lock);
}
|
// Copyright (c) 2012 DotNetAnywhere
//
// 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.
#if !defined(__TYPE_H)
#define __TYPE_H
#include "MetaData.h"
#include "Types.h"
#define ELEMENT_TYPE_VOID 0x01
#define ELEMENT_TYPE_BOOLEAN 0x02
#define ELEMENT_TYPE_CHAR 0x03
#define ELEMENT_TYPE_I1 0x04
#define ELEMENT_TYPE_U1 0x05
#define ELEMENT_TYPE_I2 0x06
#define ELEMENT_TYPE_U2 0x07
#define ELEMENT_TYPE_I4 0x08
#define ELEMENT_TYPE_U4 0x09
#define ELEMENT_TYPE_I8 0x0a
#define ELEMENT_TYPE_U8 0x0b
#define ELEMENT_TYPE_R4 0x0c
#define ELEMENT_TYPE_R8 0x0d
#define ELEMENT_TYPE_STRING 0x0e
#define ELEMENT_TYPE_PTR 0x0f
#define ELEMENT_TYPE_BYREF 0x10
#define ELEMENT_TYPE_VALUETYPE 0x11
#define ELEMENT_TYPE_CLASS 0x12
#define ELEMENT_TYPE_VAR 0x13 // Generic argument type
#define ELEMENT_TYPE_GENERICINST 0x15
#define ELEMENT_TYPE_INTPTR 0x18
#define ELEMENT_TYPE_UINTPTR 0x19
#define ELEMENT_TYPE_OBJECT 0x1c
#define ELEMENT_TYPE_SZARRAY 0x1d
#define ELEMENT_TYPE_MVAR 0x1e
extern tMD_TypeDef **types;
#define TYPE_SYSTEM_OBJECT 0
#define TYPE_SYSTEM_ARRAY_NO_TYPE 1
#define TYPE_SYSTEM_VOID 2
#define TYPE_SYSTEM_BOOLEAN 3
#define TYPE_SYSTEM_BYTE 4
#define TYPE_SYSTEM_SBYTE 5
#define TYPE_SYSTEM_CHAR 6
#define TYPE_SYSTEM_INT16 7
#define TYPE_SYSTEM_INT32 8
#define TYPE_SYSTEM_STRING 9
#define TYPE_SYSTEM_INTPTR 10
#define TYPE_SYSTEM_RUNTIMEFIELDHANDLE 11
#define TYPE_SYSTEM_INVALIDCASTEXCEPTION 12
#define TYPE_SYSTEM_UINT32 13
#define TYPE_SYSTEM_UINT16 14
#define TYPE_SYSTEM_ARRAY_CHAR 15
#define TYPE_SYSTEM_ARRAY_OBJECT 16
#define TYPE_SYSTEM_COLLECTIONS_GENERIC_IENUMERABLE_T 17
#define TYPE_SYSTEM_COLLECTIONS_GENERIC_ICOLLECTION_T 18
#define TYPE_SYSTEM_COLLECTIONS_GENERIC_ILIST_T 19
#define TYPE_SYSTEM_MULTICASTDELEGATE 20
#define TYPE_SYSTEM_NULLREFERENCEEXCEPTION 21
#define TYPE_SYSTEM_SINGLE 22
#define TYPE_SYSTEM_DOUBLE 23
#define TYPE_SYSTEM_INT64 24
#define TYPE_SYSTEM_UINT64 25
#define TYPE_SYSTEM_RUNTIMETYPE 26
#define TYPE_SYSTEM_TYPE 27
#define TYPE_SYSTEM_RUNTIMETYPEHANDLE 28
#define TYPE_SYSTEM_RUNTIMEMETHODHANDLE 29
#define TYPE_SYSTEM_ENUM 30
#define TYPE_SYSTEM_ARRAY_STRING 31
#define TYPE_SYSTEM_ARRAY_INT32 32
#define TYPE_SYSTEM_THREADING_THREAD 33
#define TYPE_SYSTEM_THREADING_THREADSTART 34
#define TYPE_SYSTEM_THREADING_PARAMETERIZEDTHREADSTART 35
#define TYPE_SYSTEM_WEAKREFERENCE 36
#define TYPE_SYSTEM_IO_FILEMODE 37
#define TYPE_SYSTEM_IO_FILEACCESS 38
#define TYPE_SYSTEM_IO_FILESHARE 39
#define TYPE_SYSTEM_ARRAY_BYTE 40
#define TYPE_SYSTEM_GLOBALIZATION_UNICODECATEGORY 41
#define TYPE_SYSTEM_OVERFLOWEXCEPTION 42
#define TYPE_SYSTEM_PLATFORMID 43
#define TYPE_SYSTEM_IO_FILESYSTEMATTRIBUTES 44
#define TYPE_SYSTEM_UINTPTR 45
#define TYPE_SYSTEM_NULLABLE 46
#define TYPE_SYSTEM_ARRAY_TYPE 47
#define TYPE_SYSTEM_REFLECTION_PROPERTYINFO 48
#define TYPE_SYSTEM_REFLECTION_METHODINFO 49
#define TYPE_SYSTEM_REFLECTION_METHODBASE 50
#define TYPE_SYSTEM_REFLECTION_MEMBERINFO 51
#define TYPE_SYSTEM_ATTRIBUTE 52
#define TYPE_SYSTEM_REFLECTION_INTERNALCUSTOMATTRIBUTEINFO 53
#define TYPE_SYSTEM_GLOBALIZATION_NUMBERSTYLES 54
#define TYPE_SYSTEM_VALUETYPE 55
#define TYPE_SYSTEM_REFLECTION_TYPEINFO 56
//U32 Type_IsMethod(tMD_MethodDef *pMethod, STRING name, tMD_TypeDef *pReturnType, U32 numParams, ...);
U32 Type_IsMethod(tMD_MethodDef *pMethod, STRING name, tMD_TypeDef *pReturnType, U32 numParams, U8 *pParamTypeIndexs);
void Type_Init();
U32 Type_IsValueType(tMD_TypeDef *pTypeDef);
tMD_TypeDef* Type_GetTypeFromSig(tMetaData *pMetaData, SIG *pSig, tMD_TypeDef **ppClassTypeArgs, tMD_TypeDef **ppMethodTypeArgs);
// Is TestType derived from BaseType or the same as BaseType?
U32 Type_IsDerivedFromOrSame(tMD_TypeDef *pBaseType, tMD_TypeDef *pTestType);
// Does TestType implement pInterface?
U32 Type_IsImplemented(tMD_TypeDef *pInterface, tMD_TypeDef *pTestType);
// Can a variable of FromType be assigend to ToType?
U32 Type_IsAssignableFrom(tMD_TypeDef *pToType, tMD_TypeDef *pFromType);
tMD_TypeDef* Type_GetArrayTypeDef(tMD_TypeDef *pElementType, tMD_TypeDef **ppClassTypeArgs, tMD_TypeDef **ppMethodTypeArgs);
HEAP_PTR Type_GetTypeObject(tMD_TypeDef *pTypeDef);
#endif |
/*
* Copyright (c) 2012-2019 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#include <sys/cdefs.h>
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/callback-list.h>
#include <internal.h>
static void _default_handler(void *);
callback_list_t *
callback_list_alloc(uint8_t count)
{
assert(count > 0);
callback_list_t *callback_list;
callback_list = __malloc(sizeof(callback_list_t));
assert(callback_list != NULL);
callback_t *callbacks;
callbacks = __malloc(count * sizeof(callback_t));
assert(callbacks != NULL);
callback_list_init(callback_list, callbacks, count);
callback_list_clear(callback_list);
return callback_list;
}
void
callback_list_free(callback_list_t *callback_list)
{
assert(callback_list != NULL);
assert(callback_list->callbacks != NULL);
callback_list->count = 0;
__free(callback_list->callbacks);
__free(callback_list);
}
void
callback_list_init(callback_list_t *callback_list, callback_t *callbacks, uint8_t count)
{
assert(callback_list != NULL);
assert(callbacks != NULL);
assert(count > 0);
callback_list->count = count;
callback_list->callbacks = callbacks;
}
void
callback_list_process(callback_list_t *callback_list, bool clear)
{
assert(callback_list != NULL);
assert(callback_list->callbacks != NULL);
assert(callback_list->count > 0);
uint8_t id;
for (id = 0; id < callback_list->count; id++) {
callback_handler_t handler;
handler = callback_list->callbacks[id].handler;
void *work;
work = callback_list->callbacks[id].work;
if (clear) {
callback_init(&callback_list->callbacks[id]);
}
handler(work);
}
}
callback_id_t
callback_list_callback_add(callback_list_t *callback_list, callback_handler_t handler, void *work)
{
#ifdef DEBUG
assert(callback_list != NULL);
assert(callback_list->callbacks != NULL);
assert(callback_list->count > 0);
#endif /* DEBUG */
callback_id_t id;
for (id = 0; id < callback_list->count; id++) {
if (callback_list->callbacks[id].handler != _default_handler) {
continue;
}
callback_set(&callback_list->callbacks[id], handler, work);
return id;
}
#ifdef DEBUG
assert(id != callback_list->count);
#endif /* DEBUG */
return -1;
}
void
callback_list_callback_remove(callback_list_t *callback_list, callback_id_t id)
{
#ifdef DEBUG
assert(callback_list != NULL);
assert(callback_list->callbacks != NULL);
assert(callback_list->count > 0);
assert(id < callback_list->count);
#endif /* DEBUG */
callback_list->callbacks[id].handler = _default_handler;
callback_list->callbacks[id].work = NULL;
}
void
callback_list_clear(callback_list_t *callback_list)
{
assert(callback_list != NULL);
assert(callback_list->callbacks != NULL);
assert(callback_list->count > 0);
uint8_t i;
for (i = 0; i < callback_list->count; i++) {
callback_init(&callback_list->callbacks[i]);
}
}
void
callback_init(callback_t *callback)
{
assert(callback != NULL);
callback->handler = _default_handler;
callback->work = NULL;
}
void
callback_set(callback_t *callback, callback_handler_t handler, void *work)
{
assert(callback != NULL);
callback->handler = (handler != NULL) ? handler : _default_handler;
callback->work = work;
}
static void
_default_handler(void *work __unused)
{
}
|
/*
shoutbot.h : Shoutbot routines.
(C)2013 Marisa Kirisame, UnSX Team.
Part of OpenPONIKO 3.0, the ultimate CAPS LOCK bot.
Released under the MIT License.
*/
/* a quote */
typedef struct
{
long long id;
long long epoch;
char name[256];
char channel[256];
char line[512];
} quote_t;
/* currently loaded quote */
quote_t shout_q;
/* start up */
int shout_init( void );
/* shut down */
int shout_quit( void );
/* clean up database (vacuum) */
void shout_tidy( void );
/* get a random quote */
int shout_get( void );
/* count all */
int shout_countall( long long *to );
/* count key */
int shout_countkey( const char *k, long long *to );
/* count channel */
int shout_countchan( const char *c, long long *to );
/* count name */
int shout_countname( const char *n, long long *to );
/* get quote by key */
int shout_get_key( const char *k, quote_t *where );
/* save a new quote */
int shout_save( char *u, char *c, char *l );
/* delete a quote */
int shout_rmquote( long long i );
/* delete all quotes from name */
int shout_rmuser( char *u );
|
#ifndef SCHEMA_H
#define SCHEMA_H
#include "appster.h"
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
typedef struct schema_s schema_t;
typedef struct value_s value_t;
schema_t* sh_alloc(const char* path, const appster_schema_entry_t* entries, as_route_cb_t cb, void* user_data);
void sh_free(schema_t* s);
value_t** sh_parse(schema_t* sh, char* args);
void sh_free_values(schema_t* sh, value_t** val);
int sh_call_cb(schema_t* sh);
const char* sh_get_path(schema_t* sh);
int sh_arg_exists(schema_t* sh, value_t** vals, uint32_t idx);
int sh_arg_flag(schema_t* sh, value_t** vals, uint32_t idx);
uint64_t sh_arg_integer(schema_t* sh, value_t** vals, uint32_t idx);
double sh_arg_number(schema_t* sh, value_t** vals, uint32_t idx);
const char* sh_arg_string(schema_t* sh, value_t** vals, uint32_t idx);
uint32_t sh_arg_string_length(schema_t* sh, value_t** vals, uint32_t idx);
uint32_t sh_arg_list_length(schema_t* sh, value_t** vals, uint32_t idx);
uint64_t sh_arg_list_integer(schema_t* sh, value_t** vals, uint32_t idx, uint32_t list_idx);
double sh_arg_list_number(schema_t* sh, value_t** vals, uint32_t idx, uint32_t list_idx);
const char* sh_arg_list_string(schema_t* sh, value_t** vals, uint32_t idx, uint32_t list_idx);
uint32_t sh_arg_list_string_length(schema_t* sh, value_t** vals, uint32_t idx, uint32_t list_idx);
#endif /* schema_H */
|
///////////////////////////////////////
// Workfile : Stock.h
// Author : Matthias Schett
// Date : 27-04-2013
// Description : Stock management
// Remarks : -
// Revision : 0
///////////////////////////////////////
#ifndef STOCK_H
#define STOCK_H
#include <string>
#include <vector>
class Stock {
private:
std::string mStockName;
double mAcutalSharePrice;
double mDayBeforeSharePrice;
double mHighestSharePrice;
double mLowestSharePrice;
double mStockChangeRate;
std::vector<double> mSharePriceCollection;
public:
// Ctr
Stock(std::string const &stockName, double actualPrice);
// Ctr for Extract Method
Stock(std::string const &stockName, std::vector<double> sharePriceCollection);
// Dtr
~Stock();
// Getters
std::string const &getStockName() const;
double getActualSharePrice() const;
double getDayBeforeSharePrice() const;
double getHighestSharePrice() const;
double getLowestSharePrice() const;
double getStockChangeRate() const;
std::vector<double> getSharePriceCollection() const;
// Setters
void setStockName(std::string const &stockName);
void setActualSharePrice(double actualSharePrice);
void setDayBeforeSharePrice(double dayBeforeSharePrice);
void setHighestSharePrice(double highestSharePrice);
void setLowestSharePrice(double lowestSharePrice);
void setStockChangeRate(double stockChangeRate);
//************************************
// Method: calcNewValuesOnChangeRate
// FullName: Stock::calcNewValuesOnChangeRate
// Access: public
// Returns: void
// Qualifier:
// Parameter: double changeRate
// Calculates the new stock values based on the given change rate
//************************************
void calcNewValuesOnChangeRate(double changeRate);
};
#endif |
//
// StoryPathManager.h
// Singpath
//
// Created by Rishik on 31/10/12.
// Copyright (c) 2012 Rishik. All rights reserved.
//
#import "StoryPaths.h"
#import "ModelUtil.h"
#import "Story.h"
@interface StoryPaths ( Management )
+(StoryPaths *)insertPath:(NSString*)pathID pathName:(NSString*)pathName storyId:(NSString*)storyId pathsStory:(NSSet*)pathsStory managedObjectContext:(NSManagedObjectContext*)moc;
+(StoryPaths *)insertPath:(NSString*)pathID pathName:(NSString*)pathName storyId:(NSString*)storyId pathsStory:(NSSet*)pathsStory;
+(StoryPaths *)getPathWithId:(NSString *)pathId storyId:(NSString*)storyId;
+(NSArray *)getAllPaths;
+(void)deleteAllPaths:(NSManagedObjectContext*)moc;
+(void)deleteAllPaths;
+(NSArray *)getPathsWithStoryId:(NSString*)storyId;
@end |
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
FOUNDATION_EXPORT double Pods_IncSpinner_TestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_IncSpinner_TestsVersionString[];
|
#ifndef ICAL_PROPERTIES_STATUS_H
#define ICAL_PROPERTIES_STATUS_H
#include <ostream>
#include <vector>
#include "core/genericproperty.h"
#include "parserexception.h"
namespace ical {
namespace properties {
class Status
{
private:
std::string value;
public:
static const std::string NAME;
Status() {}
void print(std::ostream & out) const;
static Status parse(const core::WithPos<core::GenericProperty> &generic);
const std::string &getValue() const noexcept { return value; }
};
} // namespace properties
} // namespace ical
#endif // ICAL_PARAMETERS_STATUS_H
|
/*
* Copyright (c) 2011 Erin Catto http://box2d.org
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#ifndef B2_TIMER_H
#define B2_TIMER_H
#include <Mragpp/Box2D/Common/b2Settings.h>
/// Timer for profiling. This has platform specific code and may
/// not work on every platform.
class BOX2D_EXPORT b2Timer
{
public:
/// Constructor
b2Timer();
/// Reset the timer.
void Reset();
/// Get the time since construction or the last reset.
float32 GetMilliseconds() const;
private:
#if defined(_WIN32)
float64 m_start;
static float64 s_invFrequency;
#elif defined(__linux__) || defined (__APPLE__)
unsigned long m_start_sec;
unsigned long m_start_usec;
#endif
};
#endif
|
#if 0
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000
//
// fxc /EDofCombine /Tps_2_0 /FhpsPP_DofCombine.h PP_DofCombine.fx
//
//
// Parameters:
//
// float4 FocalPlane;
// sampler2D g_samSceneColor;
// sampler2D g_samSrcColor;
// sampler2D g_samSrcPosition;
//
//
// Registers:
//
// Name Reg Size
// ---------------- ----- ----
// FocalPlane c0 1
// g_samSrcColor s0 1
// g_samSrcPosition s1 1
// g_samSceneColor s2 1
//
//
// Default values:
//
// FocalPlane
// c0 = { 0, 0, 0.2, -0.6 };
//
ps_2_0
def c1, 1, 0, 0, 0
dcl t0.xy
dcl t1.xy
dcl_2d s0
dcl_2d s1
dcl_2d s2
texld r0, t0, s1
texld r2, t1, s2
texld r1, t0, s0
dp4 r0.w, r0, c0
abs_sat r1.w, r0.w
lrp r0.xyz, r1.w, r1, r2
mov r0.w, c1.x
mov oC0, r0
// approximately 9 instruction slots used (3 texture, 6 arithmetic)
#endif
const DWORD g_ps20_DofCombine[] =
{
0xffff0200, 0x0045fffe, 0x42415443, 0x0000001c, 0x000000de, 0xffff0200,
0x00000004, 0x0000001c, 0x00000100, 0x000000d7, 0x0000006c, 0x00000002,
0x00000001, 0x00000078, 0x00000088, 0x00000098, 0x00020003, 0x00000001,
0x000000a8, 0x00000000, 0x000000b8, 0x00000003, 0x00000001, 0x000000a8,
0x00000000, 0x000000c6, 0x00010003, 0x00000001, 0x000000a8, 0x00000000,
0x61636f46, 0x616c506c, 0xab00656e, 0x00030001, 0x00040001, 0x00000001,
0x00000000, 0x00000000, 0x00000000, 0x3e4ccccd, 0xbf19999a, 0x61735f67,
0x6563536d, 0x6f43656e, 0x00726f6c, 0x000c0004, 0x00010001, 0x00000001,
0x00000000, 0x61735f67, 0x6372536d, 0x6f6c6f43, 0x5f670072, 0x536d6173,
0x6f506372, 0x69746973, 0x70006e6f, 0x5f325f73, 0x694d0030, 0x736f7263,
0x2074666f, 0x20295228, 0x58443344, 0x68532039, 0x72656461, 0x6d6f4320,
0x656c6970, 0x2e392072, 0x322e3830, 0x302e3939, 0x00303030, 0x05000051,
0xa00f0001, 0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f,
0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb0030001, 0x0200001f,
0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f,
0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801,
0x03000042, 0x800f0002, 0xb0e40001, 0xa0e40802, 0x03000042, 0x800f0001,
0xb0e40000, 0xa0e40800, 0x03000009, 0x80080000, 0x80e40000, 0xa0e40000,
0x02000023, 0x80180001, 0x80ff0000, 0x04000012, 0x80070000, 0x80ff0001,
0x80e40001, 0x80e40002, 0x02000001, 0x80080000, 0xa0000001, 0x02000001,
0x800f0800, 0x80e40000, 0x0000ffff
};
|
//
// PlayViewController.h
// HighCBar
//
// Created by shadow on 14-9-4.
// Copyright (c) 2014年 genio. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface PlayViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIView *containerView;
@property (weak, nonatomic) IBOutlet UIImageView *albumCoverImageView;
@property (weak, nonatomic) IBOutlet UILabel *albumScoreLabel;
@property (weak, nonatomic) IBOutlet UILabel *albumNameLabel;
@property (weak, nonatomic) IBOutlet UIButton *albumPlayBtn;
@end
|
#import <UIKit/UIKit.h>
FOUNDATION_EXPORT double Pods_CalendarTestsVersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_CalendarTestsVersionString[];
|
/************************************************************************************
* *
* Copyright (c) 2014, 2015 - 2016 Axel Menzel <info@rttr.org> *
* *
* This file is part of RTTR (Run Time Type Reflection) *
* License: MIT License *
* *
* 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 RTTR_COMPARE_LESS_IMPL_H_
#define RTTR_COMPARE_LESS_IMPL_H_
#include "rttr/type.h"
#include "rttr/detail/comparison/compare_array_less.h"
#include <type_traits>
namespace rttr
{
namespace detail
{
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
RTTR_INLINE typename std::enable_if<is_comparable_type<T>::value && !std::is_array<T>::value, bool>::type
compare_less_than(const T& lhs, const T& rhs, int& result)
{
result = (lhs < rhs ? - 1 : ((rhs < lhs) ? 1 : 0));
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
RTTR_INLINE typename std::enable_if<!is_comparable_type<T>::value && !std::is_array<T>::value, bool>::type
compare_less_than(const T& lhs, const T& rhs, int& result)
{
return compare_types_less_than(&lhs, &rhs, type::get<T>(), result);
}
/////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
RTTR_INLINE typename std::enable_if<!is_comparable_type<T>::value && std::is_array<T>::value, bool>::type
compare_less_than(const T& lhs, const T& rhs, int& result)
{
result = compare_array_less(lhs, rhs) ? -1 : 1;
return true;
}
/////////////////////////////////////////////////////////////////////////////////////////
} // end namespace detail
} // end namespace rttr
#endif // RTTR_COMPARE_LESS_IMPL_H_
|
#pragma once
#include <netdb.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <list>
#include "ISocket.h"
namespace Net
{
class SocketUdp : public ISocket
{
private:
int socket_;
std::list<EndPoint*> client_;
SocketMode mode_;
void Create_(void);
void Close_(void);
SocketUdp(const SocketUdp&);
SocketUdp& operator=(const SocketUdp&);
public:
SocketUdp(SocketMode);
virtual ~SocketUdp(void);
virtual bool isServerMode(void) const;
virtual bool isClientMode(void) const;
virtual void Connect(const EndPoint&);
virtual void Bind(const EndPoint&);
virtual void Send(const std::string&);
virtual std::string Recv(void);
ISocket* Accept();
};
} // namespace Net
|
#include "stmd.h"
extern int _scan_autolink_uri(const unsigned char *p);
extern int _scan_autolink_email(const unsigned char *p);
extern int _scan_html_tag(const unsigned char *p);
extern int _scan_html_block_tag(const unsigned char *p);
extern int _scan_link_url(const unsigned char *p);
extern int _scan_link_title(const unsigned char *p);
extern int _scan_spacechars(const unsigned char *p);
extern int _scan_atx_header_start(const unsigned char *p);
extern int _scan_setext_header_line(const unsigned char *p);
extern int _scan_hrule(const unsigned char *p);
extern int _scan_open_code_fence(const unsigned char *p);
extern int _scan_close_code_fence(const unsigned char *p);
extern int _scan_entity(const unsigned char *p);
static int scan_at(int (*scanner)(const unsigned char *), chunk *c, int offset)
{
int res;
unsigned char *ptr = (unsigned char *)c->data;
unsigned char lim = ptr[c->len];
ptr[c->len] = '\0';
res = scanner(ptr + offset);
ptr[c->len] = lim;
return res;
}
#define scan_autolink_uri(c, n) scan_at(&_scan_autolink_uri, c, n)
#define scan_autolink_email(c, n) scan_at(&_scan_autolink_email, c, n)
#define scan_html_tag(c, n) scan_at(&_scan_html_tag, c, n)
#define scan_html_block_tag(c, n) scan_at(&_scan_html_block_tag, c, n)
#define scan_link_url(c, n) scan_at(&_scan_link_url, c, n)
#define scan_link_title(c, n) scan_at(&_scan_link_title, c, n)
#define scan_spacechars(c, n) scan_at(&_scan_spacechars, c, n)
#define scan_atx_header_start(c, n) scan_at(&_scan_atx_header_start, c, n)
#define scan_setext_header_line(c, n) scan_at(&_scan_setext_header_line, c, n)
#define scan_hrule(c, n) scan_at(&_scan_hrule, c, n)
#define scan_open_code_fence(c, n) scan_at(&_scan_open_code_fence, c, n)
#define scan_close_code_fence(c, n) scan_at(&_scan_close_code_fence, c, n)
#define scan_entity(c, n) scan_at(&_scan_entity, c, n)
|
#ifndef KEXPECTED_H
#define KEXPECTED_H
#define KEXPECTED_G1T0 \
"FS:cutbtests/g1t0.cpp;" \
"GS:Gd3cutbtests/g1t0.cpp;" \
"GE:Gd3cutbtests/g1t0.cpp;" \
"FE:cutbtests/g1t0.cpp;"
#define KEXPECTED_G1T1 \
"FS:cutbtests/g1t1.cpp;" \
"GS:Ga3cutbtests/g1t1.cpp;" \
"Ta5Gacutbtests/g1t1.cpp;" \
"GE:Ga3cutbtests/g1t1.cpp;" \
"FE:cutbtests/g1t1.cpp;"
#define KEXPECTED_G2T2 \
"FS:cutbtests/g2t2.cpp;" \
"GS:Gb3cutbtests/g2t2.cpp;" \
"GE:Gb3cutbtests/g2t2.cpp;" \
"GS:Gc7cutbtests/g2t2.cpp;" \
"Ta9Gccutbtests/g2t2.cpp;" \
"Tb13Gccutbtests/g2t2.cpp;" \
"GE:Gc7cutbtests/g2t2.cpp;" \
"FE:cutbtests/g2t2.cpp;"
#endif
|
/*
* Serializable.h
*
* Created on: May 22, 2016
* Author: mad
*/
#ifndef INCLUDE_VNL_IO_SERIALIZABLE_H_
#define INCLUDE_VNL_IO_SERIALIZABLE_H_
#include <vnl/io/TypeInput.h>
#include <vnl/io/TypeOutput.h>
namespace vnl { namespace io {
class Serializable {
public:
virtual ~Serializable() {}
virtual void serialize(vnl::io::TypeOutput& out) const = 0;
virtual void deserialize(vnl::io::TypeInput& in, int size) = 0;
};
}}
#endif /* INCLUDE_VNL_IO_SERIALIZABLE_H_ */
|
#ifndef _BUTTON_H_
#define _BUTTON_H_
//
// button.h
//
// (C) Copyright 2000 Jan van den Baard.
// All Rights Reserved.
//
#include "../window.h"
#include "../../coords/rect.h"
// A ClsWindow derived class handling button controls.
class ClsButton : public ClsWindow
{
_NO_COPY( ClsButton );
public:
// Default constructor. Does nothing.
ClsButton()
{;}
// Constructor. Initializes to the passed
// handle.
ClsButton( HWND hWnd )
{
// Attach the handle so that it will not
// get destroyed when the object is destroyed.
Attach( hWnd );
}
// Destructor. Does nothing.
virtual ~ClsButton()
{;}
// Create a button control.
inline BOOL Create( ClsWindow *parent, const ClsRect& rBounds, UINT nID, LPCTSTR pszName, UINT nStyle = WS_CHILD | WS_TABSTOP | WS_VISIBLE | BS_PUSHBUTTON )
{
_ASSERT( m_hWnd == NULL ); // May not exist already.
// Create the control.
return ClsWindow::Create( 0, _T( "BUTTON" ), pszName, nStyle, rBounds, parent ? parent->GetSafeHWND() : NULL, ( HMENU )( UINT_PTR )nID );
}
// Simulate a click on the button.
inline void Click()
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Send the BM_CLICK message.
SendMessage( BM_CLICK );
}
// Get the button checked state.
inline UINT GetCheck() const
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Return the checked state.
return ( UINT )::SendMessage( m_hWnd, BM_GETCHECK, 0, 0 );
}
// Set the button checked state.
inline void SetCheck( UINT nCheck )
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Set the checked state.
SendMessage( BM_SETCHECK, nCheck );
}
// Get the button icon.
inline HICON GetIcon() const
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Return the icon.
return ( HICON )::SendMessage( m_hWnd, BM_GETIMAGE, IMAGE_ICON, 0 );
}
// Set the button icon.
inline HICON SetIcon( HICON hIcon )
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Set the new icon, returning the old.
return ( HICON )SendMessage( BM_SETIMAGE, IMAGE_ICON, ( LPARAM )hIcon );
}
// Get the button bitmap.
inline HBITMAP GetBitmap() const
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Return the bitmap.
return ( HBITMAP )::SendMessage( m_hWnd, BM_GETIMAGE, IMAGE_BITMAP, 0 );
}
// Set the button bitmap.
inline HBITMAP SetBitmap( HBITMAP hBitmap )
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Set the new bitmap, returning the old.
return ( HBITMAP )SendMessage( BM_SETIMAGE, IMAGE_BITMAP, ( LPARAM )hBitmap );
}
// Get the button state.
inline UINT GetState() const
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Return the button state.
return ( UINT )::SendMessage( m_hWnd, BM_GETSTATE, 0, 0 );
}
// Set the button state.
inline void SetState( UINT nState )
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Set the new state.
SendMessage( BM_SETSTATE, nState );
}
// Set the button style.
inline void SetStyle( UINT nStyle )
{
_ASSERT_VALID( GetSafeHWND()); // Must be valid.
// Set the new style.
SendMessage( BM_SETSTYLE, nStyle );
}
protected:
// Reflected WM_COMMAND notification handlers.
virtual LRESULT OnClicked( BOOL& bNotifyParent ) { return 0; }
virtual LRESULT OnSetFocus( BOOL& bNotifyParent ) { return 0; }
virtual LRESULT OnKillFocus( BOOL& bNotifyParent ) { return 0; }
// Handle the reflected WM_COMMAND messages.
virtual LRESULT OnReflectedCommand( UINT nNotifyCode, BOOL& bNotifyParent )
{
switch ( nNotifyCode )
{
case BN_CLICKED:
return OnClicked( bNotifyParent );
case BN_SETFOCUS:
return OnSetFocus( bNotifyParent );
case BN_KILLFOCUS:
return OnKillFocus( bNotifyParent );
}
return 1;
}
};
#endif // _BUTTON_H_
|
#include<stdio.h>
#include<assert.h>
struct nested {
int x;
int y;
};
union kala {
int i;
int j;
float p;
struct nested struk;
};
struct maja {
int arv;
union kala kala;
};
int main () {
union kala k;
struct maja maja;
k.i = 5;
k.j = 7;
assert(k.i == 7);
assert(k.p == 7.0); // UNKNOWN!
maja.arv = 8;
maja.kala.i = 3;
assert(maja.kala.j == 3);
assert(maja.kala.p == 3.0); // UNKNOWN!
k.struk.x = 3;
assert(k.struk.x == 3);
assert(k.i == 3); // UNKNOWN!
return 0;
}
|
//
// TMFError.h
//
// Copyright (c) 2013 Martin Gratzer, http://www.mgratzer.com
// All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// This file is part of 3MF http://threemf.com
//
#import <Foundation/Foundation.h>
static const NSInteger TMFInternalErrorCode = 0;
static const NSInteger TMFChannelErrorCode = 100;
static const NSInteger TMFMessageParsingErrorCode = 200;
static const NSInteger TMFPeerNotFoundErrorCode = 300;
static const NSInteger TMFSubscribeErrorCode = 400;
static const NSInteger TMFResponseErrorCode = 500;
static const NSInteger TMFCommandErrorCode = 500;
/**
A little NSError subclass easing the creation of error objects.
*/
@interface TMFError : NSError
/**
Creates an error object based on an internal error code. The error message
will contain a default value.
@param code The error code defined by 3MF
*/
+ (NSError *)errorForCode:(NSUInteger)code;
/**
Creates an error object based on an internal error code and a customized message.
@param code The error code defined by 3MF
@param message The message used for this error code
*/
+ (NSError *)errorForCode:(NSUInteger)code message:(NSString *)message;
/**
Creates an error object based on an internal error code, a customized message
and a custom userInfo dictionary.
@param code The error code defined by 3MF
@param message The message used for this error code
@param userInfo The dictionary holding further user information describing the error.
*/
+ (NSError *)errorForCode:(NSUInteger)code message:(NSString *)message userInfo:(NSDictionary *)userInfo;
@end
|
#include "pch.h"
#include "database.h"
#include "bookings.h"
#include "customers.h"
#include "rooms.h"
#define DEBUG
enum first_actions_t {
FIRST_ACTION_QUIT = 0,
FIRST_ACTION_CUSTOMER = 1,
FIRST_ACTION_ROOMS = 2,
FIRST_ACTION_BOOKINGS = 3
};
enum second_actions_t {
SECOND_ACTION_QUIT = 0,
SECOND_ACTION_CREATE = 1,
SECOND_ACTION_REMOVE = 2,
SECOND_ACTION_MODIFY = 3,
SECOND_ACTION_PRINT = 4,
SECOND_ACTION_SEARCH = 5
};
int action[2];
bool quit_program = false;
void post_action()
{
#ifdef DEBUG
printf("Post action %d %d\n", action[0], action[1]);
#endif
if(action[0] == FIRST_ACTION_CUSTOMER){
if(action[1] == SECOND_ACTION_CREATE){
create_customer();
}
else if(action[1] == SECOND_ACTION_REMOVE){
remove_customer();
}
else if(action[1] == SECOND_ACTION_MODIFY){
modify_customer();
}
else if(action[1] == SECOND_ACTION_PRINT){
print_customers();
}
else if(action[1] == SECOND_ACTION_SEARCH){
search_customers();
}
}
else if(action[0] == FIRST_ACTION_ROOMS){
if(action[1] == SECOND_ACTION_MODIFY){
modify_room();
}
else if(action[1] == SECOND_ACTION_PRINT){
print_rooms();
}
else if(action[1] == SECOND_ACTION_SEARCH){
search_rooms();
}
}
else if(action[0] == FIRST_ACTION_BOOKINGS){
if(action[1] == SECOND_ACTION_CREATE){
create_booking();
}
else if(action[1] == SECOND_ACTION_REMOVE){
remove_booking();
}
else if(action[1] == SECOND_ACTION_MODIFY){
modify_booking();
}
else if(action[1] == SECOND_ACTION_PRINT){
print_bookings();
}
else if(action[1] == SECOND_ACTION_SEARCH){
search_bookings();
}
}
}
void second_action()
{
int temp = 0;
printf("\nPodaj akcje\n");
printf("0. Koniec programu\n");
switch(action[0]){
case FIRST_ACTION_QUIT:
quit_program = true;
return;
case FIRST_ACTION_CUSTOMER: //customer management
printf("1. Dodaj klienta\n");
printf("2. Usun klienta\n");
printf("3. Modyfikuj klienta\n");
printf("4. Wypisz klientow\n");
printf("5. Wyszukaj klienta\n");
break;
case FIRST_ACTION_ROOMS: //rooms management
printf("3. Modyfikuj pokoj\n");
printf("4. Wypisz pokoje\n");
printf("5. Wyszukaj pokoj\n");
break;
case FIRST_ACTION_BOOKINGS: //bookings management
printf("1. Dodaj rezerwacje\n");
printf("2. Usun rezerwacje\n");
printf("3. Modyfikuj rezerwacje\n");
printf("4. Wypisz rezerwacje\n");
printf("5. Wyszukaj rezerwacje\n");
break;
default: //If
second_action(); //Repeat second action till we get valid input
break;
}
if(scanf("%d", &temp) != -1){
switch(temp){
case SECOND_ACTION_QUIT: //Quit program
quit_program = true;
return;
case SECOND_ACTION_CREATE: //Quit program
case SECOND_ACTION_REMOVE:
case SECOND_ACTION_MODIFY:
case SECOND_ACTION_PRINT:
case SECOND_ACTION_SEARCH:
action[1] = temp;
//Move to post action
post_action();
break;
default:
second_action(); //Repeat first action till we get valid input
return;
}
}
else{
//Repeat second action till we get valid input
second_action();
}
}
void first_action()
{
int temp = 0;
printf("Podaj akcje:\n");
printf("0. Koniec programu\n");
printf("1. Zarzadzanie klientem\n");
printf("2. Zarzadzanie pokojami\n");
printf("3. Zarzadzanie rezerwacjami\n");
if(scanf("%d", &temp) != -1){
switch(temp){
case FIRST_ACTION_QUIT: //Quit program
quit_program = true;
return;
case FIRST_ACTION_CUSTOMER:
case FIRST_ACTION_ROOMS:
case FIRST_ACTION_BOOKINGS:
action[0] = temp;
//Move to second action
second_action();
break;
default:
first_action(); //Repeat first action till we get valid input
return;
}
}
else{
//Repeat first action till we get valid input
first_action();
}
}
int main(void)
{
rooms = NULL;
bookings = NULL;
customers = NULL;
//If database init failed then exit application
if(!database_init("__rooms.db", "__customers.db", "__bookings.db")){
return 1;
}
printf("Witaj w programie zarzadzajacym hotelem.\n");
while(!quit_program) {
first_action();
}
#ifdef DEBUG
printf("Saving database..\n");
#endif
database_rooms_write_rows(rooms_database_file);
database_customers_write_rows(customers_database_file);
database_bookings_write_rows(bookings_database_file);
#ifdef DEBUG
printf("Closing database..\n");
#endif
database_close();
return 0;
}
|
#include "Nucleus/FileSystem/getFileContents.h"
|
/*
* order_execution_report.h
*
* The order execution report object.
*/
#ifndef _order_execution_report_H_
#define _order_execution_report_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
typedef struct order_execution_report_t order_execution_report_t;
#include "fills.h"
#include "ord_side.h"
#include "ord_status.h"
#include "ord_type.h"
#include "order_execution_report_all_of.h"
#include "order_new_single_request.h"
#include "time_in_force.h"
// Enum for order_execution_report
typedef enum { oeml___rest_api_order_execution_report__NULL = 0, oeml___rest_api_order_execution_report__BUY, oeml___rest_api_order_execution_report__SELL } oeml___rest_api_order_execution_report__e;
char* order_execution_report_side_ToString(oeml___rest_api_order_execution_report__e side);
oeml___rest_api_order_execution_report__e order_execution_report_side_FromString(char* side);
// Enum for order_execution_report
typedef enum { oeml___rest_api_order_execution_report__NULL = 0, oeml___rest_api_order_execution_report__LIMIT } oeml___rest_api_order_execution_report__e;
char* order_execution_report_order_type_ToString(oeml___rest_api_order_execution_report__e order_type);
oeml___rest_api_order_execution_report__e order_execution_report_order_type_FromString(char* order_type);
// Enum for order_execution_report
typedef enum { oeml___rest_api_order_execution_report__NULL = 0, oeml___rest_api_order_execution_report__GOOD_TILL_CANCEL, oeml___rest_api_order_execution_report__GOOD_TILL_TIME_EXCHANGE, oeml___rest_api_order_execution_report__GOOD_TILL_TIME_OMS, oeml___rest_api_order_execution_report__FILL_OR_KILL, oeml___rest_api_order_execution_report__IMMEDIATE_OR_CANCEL } oeml___rest_api_order_execution_report__e;
char* order_execution_report_time_in_force_ToString(oeml___rest_api_order_execution_report__e time_in_force);
oeml___rest_api_order_execution_report__e order_execution_report_time_in_force_FromString(char* time_in_force);
// Enum EXECINST for order_execution_report
typedef enum { oeml___rest_api_order_execution_report_EXECINST_NULL = 0, oeml___rest_api_order_execution_report_EXECINST_MAKER_OR_CANCEL, oeml___rest_api_order_execution_report_EXECINST_AUCTION_ONLY, oeml___rest_api_order_execution_report_EXECINST_INDICATION_OF_INTEREST } oeml___rest_api_order_execution_report_EXECINST_e;
char* order_execution_report_exec_inst_ToString(oeml___rest_api_order_execution_report_EXECINST_e exec_inst);
oeml___rest_api_order_execution_report_EXECINST_e order_execution_report_exec_inst_FromString(char* exec_inst);
// Enum for order_execution_report
typedef enum { oeml___rest_api_order_execution_report__NULL = 0, oeml___rest_api_order_execution_report__RECEIVED, oeml___rest_api_order_execution_report__ROUTING, oeml___rest_api_order_execution_report__ROUTED, oeml___rest_api_order_execution_report___NEW, oeml___rest_api_order_execution_report__PENDING_CANCEL, oeml___rest_api_order_execution_report__PARTIALLY_FILLED, oeml___rest_api_order_execution_report__FILLED, oeml___rest_api_order_execution_report__CANCELED, oeml___rest_api_order_execution_report__REJECTED } oeml___rest_api_order_execution_report__e;
char* order_execution_report_status_ToString(oeml___rest_api_order_execution_report__e status);
oeml___rest_api_order_execution_report__e order_execution_report_status_FromString(char* status);
typedef struct order_execution_report_t {
char *exchange_id; // string
char *client_order_id; // string
char *symbol_id_exchange; // string
char *symbol_id_coinapi; // string
double amount_order; //numeric
double price; //numeric
ord_side_t *side; // custom
ord_type_t *order_type; // custom
time_in_force_t *time_in_force; // custom
list_t *exec_inst; //primitive container
char *client_order_id_format_exchange; // string
char *exchange_order_id; // string
double amount_open; //numeric
double amount_filled; //numeric
double avg_px; //numeric
ord_status_t *status; // custom
list_t *status_history; //primitive container
char *error_message; // string
list_t *fills; //nonprimitive container
} order_execution_report_t;
order_execution_report_t *order_execution_report_create(
char *exchange_id,
char *client_order_id,
char *symbol_id_exchange,
char *symbol_id_coinapi,
double amount_order,
double price,
ord_side_t *side,
ord_type_t *order_type,
time_in_force_t *time_in_force,
list_t *exec_inst,
char *client_order_id_format_exchange,
char *exchange_order_id,
double amount_open,
double amount_filled,
double avg_px,
ord_status_t *status,
list_t *status_history,
char *error_message,
list_t *fills
);
void order_execution_report_free(order_execution_report_t *order_execution_report);
order_execution_report_t *order_execution_report_parseFromJSON(cJSON *order_execution_reportJSON);
cJSON *order_execution_report_convertToJSON(order_execution_report_t *order_execution_report);
#endif /* _order_execution_report_H_ */
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSObject-Protocol.h"
@protocol PKPassLibraryDelegate <NSObject>
- (void)passLibrary:(id)arg1 receivedUpdatedCatalog:(id)arg2 passes:(id)arg3;
@end
|
#pragma once
class CMapView : public CView
{
public:
CMapView();
virtual ~CMapView();
bool Init();
void Render();
void Update(float elapseT);
void UpdateCamera();
void SelectCube( int index );
public:
virtual void OnDraw(CDC* pDC); // ÀÌ ºä¸¦ ±×¸®±â À§ÇØ ÀçÁ¤ÀǵǾú½À´Ï´Ù.
#ifdef _DEBUG
virtual void AssertValid() const;
#ifndef _WIN32_WCE
virtual void Dump(CDumpContext& dc) const;
#endif
#endif
bool m_dxInit;
string m_filePath;
Matrix44 m_rotateTm;
Vector3 m_camPos;
Vector3 m_lookAtPos;
Matrix44 m_matView;
Matrix44 m_matProj;
bool m_LButtonDown;
bool m_RButtonDown;
bool m_MButtonDown;
CPoint m_curPos;
graphic::cGrid m_grid;
graphic::cCube m_cube;
protected:
void GetRay(int sx, int sy, Vector3 &orig, Vector3 &dir);
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
};
|
#if 0
//
// Generated by Microsoft (R) D3DX9 Shader Compiler 9.08.299.0000
//
// fxc /ECombine /Tps_2_0 /Fhadd.h add.fx
//
//
// Parameters:
//
// sampler2D g_samSrcColor1;
// sampler2D g_samSrcColor2;
//
//
// Registers:
//
// Name Reg Size
// -------------- ----- ----
// g_samSrcColor1 s0 1
// g_samSrcColor2 s1 1
//
ps_2_0
def c0, 1, 0, 0, 0
dcl t0.xy
dcl t1.xy
dcl_2d s0
dcl_2d s1
texld r0, t0, s0
texld r1, t1, s1
add r0.xyz, r0, r1
mov r0.w, c0.x
mov oC0, r0
// approximately 5 instruction slots used (2 texture, 3 arithmetic)
#endif
const DWORD g_ps20_Combine[] =
{
0xffff0200, 0x002cfffe, 0x42415443, 0x0000001c, 0x0000007a, 0xffff0200,
0x00000002, 0x0000001c, 0x00000100, 0x00000073, 0x00000044, 0x00000003,
0x00000001, 0x00000054, 0x00000000, 0x00000064, 0x00010003, 0x00000001,
0x00000054, 0x00000000, 0x61735f67, 0x6372536d, 0x6f6c6f43, 0xab003172,
0x000c0004, 0x00010001, 0x00000001, 0x00000000, 0x61735f67, 0x6372536d,
0x6f6c6f43, 0x70003272, 0x5f325f73, 0x694d0030, 0x736f7263, 0x2074666f,
0x20295228, 0x58443344, 0x68532039, 0x72656461, 0x6d6f4320, 0x656c6970,
0x2e392072, 0x322e3830, 0x302e3939, 0x00303030, 0x05000051, 0xa00f0000,
0x3f800000, 0x00000000, 0x00000000, 0x00000000, 0x0200001f, 0x80000000,
0xb0030000, 0x0200001f, 0x80000000, 0xb0030001, 0x0200001f, 0x90000000,
0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000,
0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40001, 0xa0e40801,
0x03000002, 0x80070000, 0x80e40000, 0x80e40001, 0x02000001, 0x80080000,
0xa0000000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff
};
|
//
// FlyingMemberIconCellCollectionViewCell.h
// FlyingEnglish
//
// Created by vincent sung on 5/5/2016.
// Copyright © 2016 BirdEngish. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface FlyingMemberIconCellCollectionViewCell : UICollectionViewCell
+ (FlyingMemberIconCellCollectionViewCell*) memberIconCell;
-(void) setImageIconURL:(NSString*) imageURL;
-(void) setImageIcon:(UIImage *)image;
@end
|
//
// MJPropertyType.h
// MJExtension
//
// Created by mj on 14-1-15.
// Copyright (c) 2014年 小码哥. All rights reserved.
// 包装一种类型
#import <Foundation/Foundation.h>
/**
* 包装一种类型
*/
@interface MJPropertyType : NSObject
/** 类型标识符 */
@property (nonatomic, copy) NSString *code;
/** 是否为id类型 */
@property (nonatomic, readonly, getter=isIdType) BOOL idType;
/** 是否为基本数字类型:int、float等 */
@property (nonatomic, readonly, getter=isNumberType) BOOL numberType;
/** 是否为BOOL类型 */
@property (nonatomic, readonly, getter=isBoolType) BOOL boolType;
/** 对象类型(如果是基本数据类型,此值为nil) */
@property (nonatomic, readonly) Class typeClass;
/** 类型是否来自于Foundation框架,比如NSString、NSArray */
@property (nonatomic, readonly, getter = isFromFoundation) BOOL fromFoundation;
/** 类型是否不支持KVC */
@property (nonatomic, readonly, getter = isKVCDisabled) BOOL KVCDisabled;
/**
* 获得缓存的类型对象
*/
+ (instancetype)cachedTypeWithCode:(NSString *)code;
@end |
//
// BMFViewRegister.h
// BMF
//
// Created by Jose Manuel Sánchez Peñarroja on 07/02/14.
// Copyright (c) 2014 José Manuel Sánchez. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BMFViewRegisterProtocol.h"
@interface BMFViewRegister : NSObject <BMFViewRegisterProtocol>
- (void) registerTableViews: (UITableView *) tableView;
- (void) registerCollectionViews:(UICollectionView *) collectionView;
@end
|
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclasses;
#pragma link C++ namespace PlotUtils;
#pragma link C++ class PlotUtils::MULatErrorBand+;
#pragma link C++ class PlotUtils::MULatErrorBand2D+;
#pragma link C++ class PlotUtils::MULatErrorBand3D+;
#pragma link C++ class PlotUtils::MUVertErrorBand+;
#pragma link C++ class PlotUtils::MUVertErrorBand2D+;
#pragma link C++ class PlotUtils::MUVertErrorBand3D+;
#pragma link C++ class PlotUtils::MUH1D+;
#pragma link C++ class PlotUtils::MUH2D+;
#pragma link C++ class PlotUtils::MUH3D+;
#endif
|
//
// JTSSimpleImageDownloader.h
//
//
// Created by Jared Sinclair on 3/2/14.
// Copyright (c) 2014 Nice Boy LLC. All rights reserved.
//
//@import Foundation;
@interface JTSSimpleImageDownloader : NSObject
+ (NSURLSessionDataTask *)downloadImageForURL:(NSURL *)imageURL
canonicalURL:(NSURL *)canonicalURL
completion:(void(^)(UIImage *image))completion;
@end
|
//============================================================================
// Name : bayesianFilter.h
// Version : 1.0.0
// Copyright : MBRDNA, Udacity
//============================================================================
#ifndef BAYESIANFILTER_H_
#define BAYESIANFILTER_H_
#include <vector>
#include <string>
#include <fstream>
#include "measurement_package.h"
#include "map.h"
#include "help_functions.h"
class bayesianFilter {
public:
//constructor:
bayesianFilter();
//deconstructor:
virtual ~bayesianFilter();
//main public member function, which estimate the beliefs:
void process_measurement(const MeasurementPackage &measurements,
const map &map_1d,
help_functions &helpers);
//member public: belief of state x:
std::vector<float> bel_x ;
private:
/////private members:
//flag, if filter is initialized:
bool is_initialized_;
//precision of control information:
float control_std ;
float observation_std ;
//initial belief of state x:
std::vector<float> bel_x_init ;
};
#endif /* BAYESIANFILTER_H_ */ |
//
// UIImageColors.h
// UIImageColors
//
// Created by Suyeol Jeon on 10/10/2016.
// Copyright © 2016 Jathu Satkunarajah (@jathu) - Toronto. All rights reserved.
//
#if TARGET_OS_MAC
#import <Appkit/AppKit.h>
#else
#import <UIKit/UIKit.h>
#endif
//! Project version number for UIImageColors.
FOUNDATION_EXPORT double UIImageColorsVersionNumber;
//! Project version string for UIImageColors.
FOUNDATION_EXPORT const unsigned char UIImageColorsVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <UIImageColors/PublicHeader.h>
|
//
// SwiftEmoji-iOS.h
// SwiftEmoji-iOS
//
// Created by Christian Niles on 4/25/16.
// Copyright © 2016 Christian Niles. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for SwiftEmoji-iOS.
FOUNDATION_EXPORT double SwiftEmoji_iOSVersionNumber;
//! Project version string for SwiftEmoji-iOS.
FOUNDATION_EXPORT const unsigned char SwiftEmoji_iOSVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <SwiftEmoji_iOS/PublicHeader.h>
|
// 7 january 2015
#include "tablepriv.h"
static const handlerfunc handlers[] = {
eventHandlers,
childrenHandlers,
resizeHandler,
drawHandlers,
apiHandlers,
hscrollHandler,
vscrollHandler,
accessibilityHandler,
modelNotificationHandler,
enableFocusHandlers,
NULL,
};
// TODO migrate this
// TODO check all of these functions for failure and/or copy comments from hscroll.c
static LRESULT CALLBACK tableWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
struct table *t;
LRESULT lResult;
t = (struct table *) GetWindowLongPtrW(hwnd, GWLP_USERDATA);
if (t == NULL) {
// we have to do things this way because creating the header control will fail mysteriously if we create it first thing
// (which is fine; we can get the parent hInstance this way too)
// we use WM_CREATE because we have to use WM_DESTROY to destroy the header; we can't do it in WM_NCDESTROY because Windows will have destroyed it for us by then, and let's match message pairs to be safe
if (uMsg == WM_CREATE) {
CREATESTRUCTW *cs = (CREATESTRUCTW *) lParam;
t = (struct table *) tableAlloc(sizeof (struct table));
if (t == NULL) {
logMemoryExhausted("error allocating internal Table data structure");
// ABORT CREATION
// TODO correct value?
// TODO last error or some other way to set error?
return FALSE;
}
t->hwnd = hwnd;
t->hInstance = cs->hInstance;
// TODO use t->hInstance here
makeHeader(t, cs->hInstance);
t->selectedRow = -1;
t->selectedColumn = -1;
loadCheckboxThemeData(t);
t->model = nullModel;
initTableAcc(t);
SetWindowLongPtrW(hwnd, GWLP_USERDATA, (LONG_PTR) t);
}
// even if we did the above, fall through
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
if (uMsg == WM_DESTROY) {
// TODO free appropriate (after figuring this part out) components of t
uninitTableAcc(t);
// TODO what if any of this fails?
if (t->model != nullModel)
tableModel_tableUnsubscribe(t->model, t->hwnd);
tableModel_Release(t->model);
freeCheckboxThemeData(t);
destroyHeader(t);
tableFree(t);//TODO, "error allocating internal Table data structure");
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
if (runHandlers(handlers, t, uMsg, wParam, lParam, &lResult))
return lResult;
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
static HINSTANCE hInstance;
#define wantedICCClasses ( \
ICC_LISTVIEW_CLASSES | /* table headers */ \
ICC_BAR_CLASSES | /* tooltips */ \
0)
// TODO WINAPI or some equivalent instead of __stdcall?
// TODO return HRESULT and store the ATOM in a parameter
// TODO provide a reserved parameter for configuration
__declspec(dllexport) ATOM __stdcall tableInit(void)
{
INITCOMMONCONTROLSEX icc;
WNDCLASSW wc;
ATOM a;
ZeroMemory(&icc, sizeof (INITCOMMONCONTROLSEX));
icc.dwSize = sizeof (INITCOMMONCONTROLSEX);
icc.dwICC = wantedICCClasses;
if (InitCommonControlsEx(&icc) == 0) {
logLastError("error initializing Common Controls library for Table");
return 0;
}
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = tableWindowClass;
wc.lpfnWndProc = tableWndProc;
wc.hCursor = LoadCursorW(NULL, IDC_ARROW);
if (wc.hCursor == NULL) {
logLastError("error loading Table window class cursor");
return 0; // pass last error up
}
wc.hIcon = LoadIconW(NULL, IDI_APPLICATION);
if (wc.hIcon == NULL) {
logLastError("error loading Table window class icon");
return 0; // pass last error up
}
wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); // TODO correct? (check list view behavior on COLOR_WINDOW change)
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.hInstance = hInstance;
a = RegisterClassW(&wc);
if (a == 0)
logLastError("error registering Table window class");
return a; // pass last error up if a == 0
}
__declspec(dllexport) HINSTANCE __stdcall tableHINSTANCE(void)
{
return hInstance;
}
// TODO consider DisableThreadLibraryCalls() (will require removing ALL C runtime calls); if we do so we will also need to fix the signature below
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
if (fdwReason == DLL_PROCESS_ATTACH)
hInstance = hinstDLL;
// TODO provide cleanup function
return TRUE;
}
// TODO don't duplicate the GUIDs
__declspec(dllexport) const IID IID_tableModel = { 0x8f361d46, 0xcaab, 0x489f, { 0x8d, 0x20, 0xae, 0xaa, 0xea, 0xa9, 0x10, 0x4f } };
|
/*------------------------------------------------------------------------------
Copyright (c) 2009-2020 The GRRLIB Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
------------------------------------------------------------------------------*/
#include <grrlib.h>
#include <stdio.h>
#include <pngu.h>
/**
* Load a file to memory.
* @param filename Name of the file to be loaded.
* @param data Pointer-to-your-pointer.
* Ie. { u8 *data; GRRLIB_LoadFile("file", &data); }.
* It is your responsibility to free the memory allocated by this function.
* @return A integer representing a code:
* - 0 : EmptyFile.
* - -1 : FileNotFound.
* - -2 : OutOfMemory.
* - -3 : FileReadError.
* - >0 : FileLength.
*/
int GRRLIB_LoadFile(const char* filename, u8* *data) {
int len;
FILE *fd;
// Open the file
if ( !(fd = fopen(filename, "rb")) ) {
return -1;
}
// Get file length
fseek(fd, 0, SEEK_END);
if ( !(len = ftell(fd)) ) {
fclose(fd);
*data = NULL;
return 0;
}
fseek(fd, 0, SEEK_SET);
// Grab some memory in which to store the file
if ( (*data = malloc(len)) == NULL ) {
fclose(fd);
return -2;
}
if ( fread(*data, 1, len, fd) != len) {
fclose(fd);
free(*data);
*data = NULL;
return -3;
}
fclose(fd);
return len;
}
/**
* Load a texture from a file.
* @param filename The JPEG, PNG or Bitmap filename to load.
* @return A GRRLIB_texImg structure filled with image information.
* If an error occurs NULL will be returned.
*/
GRRLIB_texImg* GRRLIB_LoadTextureFromFile(const char *filename) {
GRRLIB_texImg *tex;
u8 *data;
// return NULL it load fails
if (GRRLIB_LoadFile(filename, &data) <= 0) {
return NULL;
}
// Convert to texture
tex = GRRLIB_LoadTexture(data);
// Free up the buffer
free(data);
return tex;
}
/**
* Make a PNG screenshot.
* It should be called after drawing stuff on the screen, but before GRRLIB_Render.
* libfat is required to use the function.
* @param filename Name of the file to write.
* @return bool true=everything worked, false=problems occurred.
*/
bool GRRLIB_ScrShot(const char* filename) {
int ret = -1;
IMGCTX pngContext = PNGU_SelectImageFromDevice(filename);
if ( pngContext != NULL ) {
ret = PNGU_EncodeFromEFB( pngContext,
rmode->fbWidth, rmode->efbHeight,
0 );
PNGU_ReleaseImageContext(pngContext);
}
return !ret;
}
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netinet/in.h>
#include <netdb.h>
#include <syslog.h>
#include <utils.h>
#include <config.h>
/*
* Let program fall to background. Fork
* process and exit parent.
*/
void
daemonize() {
if (fork() > 0) {
syslog(LOG_INFO,"daemonize: Exiting Parent");
exit(EXIT_SUCCESS);
}
}
void
write_pid_file(const char* filename) {
FILE *file = fopen(filename,"w");
fprintf(file,"%u",getpid());
fclose(file);
}
void
signal_handler(int signal) {
syslog(LOG_INFO, "stopping");
closelog();
if(remove(PID_FILE) == -1) {
syslog(LOG_ERR,"Couldn't delete PID File in %s",PID_FILE);
//TODO: close socket
//close(socket);
}
exit(EXIT_SUCCESS);
}
char*
getpeeraddress(int socket) {
struct sockaddr_storage ss;
socklen_t sslen = sizeof(ss);
char *numeric_name = malloc(NI_MAXHOST);
char *name = malloc(NI_MAXHOST);
getpeername(socket, (struct sockaddr *)&ss, &sslen);
getnameinfo((struct sockaddr *)&ss, sslen, numeric_name, NI_MAXHOST, NULL, 0, NI_NUMERICHOST);
getnameinfo((struct sockaddr *)&ss, sslen, name, NI_MAXHOST, NULL, 0, NI_NAMEREQD);
int rtr_len = strlen(name)+strlen(numeric_name)+4;
char *rtr = malloc(rtr_len);
snprintf(rtr,rtr_len,"%s [%s]",name,numeric_name);
free(name);
free(numeric_name);
return rtr;
}
/*
* Decode a base64 encoded STRING. This will NOT
* work for anything other than a null-terminated
* string.
*/
char*
base64_decode(const char* string) {
char base64_table[66] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
//replace all = by A so that base64 fill bytes end up being
//null terminating bytes in the decoded string
char *new_string = strdup(string);
char *p;
while((p = strrchr(new_string,'=')) != NULL) {
*p = 'A';
}
char *free_new_str = new_string;
char *decoded_str = malloc(1+(3*strlen(string))/4);
char *tmp = decoded_str;
//convert 4 base64 encoded bytes into 3 decoded bytes
//until the base64 encoded string ends
int b64_1, b64_2, b64_3, b64_4;
while(*new_string != '\0') {
b64_1 = strchr(base64_table,(int)*new_string++)-base64_table;
b64_2 = strchr(base64_table,(int)*new_string++)-base64_table;
b64_3 = strchr(base64_table,(int)*new_string++)-base64_table;
b64_4 = strchr(base64_table,(int)*new_string++)-base64_table;
*tmp++ = (b64_1 << 2) + (b64_2 >> 4);
*tmp++ = (b64_2 << 4) + (b64_3 >> 2);
*tmp++ = (b64_3 << 6) + b64_4;
}
free(free_new_str);
return decoded_str;
}
|
#ifndef NETWORK_H
#define NETWORK_H
#include <sys/socket.h>
#include <arpa/inet.h>
#include "structs.h"
#include "utils.h"
#include "network_client.h"
#include "network_server.h"
#define DEFAULT_SERVER_PORT 69 // Server port defined in RFC1350
#define DEFAULT_BLK_SIZE 516 // Default value defined in RFC1350 is 512 of payload + 4 of headers
#define DEFAULT_TIMEOUT 1 // Default timeout is 1 second
#define PREF_BLK_SIZE 1468 // Maximum block size possible:
// Ethernet MTU (1500) - UDP headers (8) - IP (20)
#define HOST_LEN 128 // Maximum length of a hostname
#define PORT_MIN 10000 // Minimum port used as TID (source)
#define PORT_MAX 50000 // Maximum port used as TID (source)
#define DEFAULT_RETRY 3 // Number of retries on errors
void send_error(struct conn_info conn, int err_code, char *err_msg);
void send_ack(struct conn_info conn, int block_nb);
int send_data(struct conn_info conn, char** buffer, int buffer_size, int* last_block, FILE* fd);
int handle_data(struct conn_info conn, char* buffer, int n, int *last_block, int *total_size, FILE *fd_dst);
int handle_ack(char* buffer, int buffer_size, int last_block);
int get_data(struct conn_info conn, enum request_code type, const int retry, char **buffer, int buffer_size, char *filename);
void free_conn(struct conn_info conn);
#endif /* end of include guard: NETWORK_H */
|
/**
* This is an example admin module for pulling metrics informations
* IDL: admin.proto
*
* @note before you compile it, make sure the admin.proto has in
* $top_project/config
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "skull/api.h"
#include "skull_metrics.h"
#include "skull_txn_sharedata.h"
#include "skull_srv_api_proto.h"
#include "config.h"
#define CMD_HELP "commands help:\n - help\n - show\n"
#define MAX_METRICS_COUNT 100
#define MAX_METRICS_LEN 256
void* module_init(skull_config_t* config)
{
printf("admin module(test): init\n");
return NULL;
}
void module_release(void* user_data)
{
printf("admin module(test): release\n");
}
// The command format: command_string\r\n
// commands:
// - show [metrics]
// - help
size_t module_unpack(skull_txn_t* txn, const void* data, size_t data_sz)
{
printf("admin module_unpack(test): data sz:%zu\n", data_sz);
if (data_sz < 2) {
return 0;
}
const char* cmd = data;
if (0 != strncmp(&cmd[data_sz - 2], "\r\n", 2)) {
return 0;
}
Skull__Admin* admin_data = skull_txn_sharedata_admin(txn);
admin_data->ignore = 0;
// for the empty line, just mark this request can be ignored
if (data_sz == 2) {
admin_data->ignore = 1;
return data_sz;
}
// store command string, remove the '\r\n', and append '\0'
admin_data->command = calloc(1, data_sz - 2 + 1);
memcpy(admin_data->command, data, data_sz - 2);
// create 100 metrics slots
admin_data->n_metrics_array = MAX_METRICS_COUNT;
admin_data->metrics_array =
calloc(MAX_METRICS_COUNT, sizeof(*admin_data->metrics_array));
SKULL_LOG_INFO(1, "admin module_unpack(test): data sz:%zu", data_sz);
return data_sz;
}
static
void _metrics_each_cb(const char* name, double value, void* ud)
{
skull_txn_t* txn = ud;
Skull__Admin* admin_data = skull_txn_sharedata_admin(txn);
int index = admin_data->metrics_count;
if (index >= MAX_METRICS_COUNT) {
printf("exceed the max metrics limitation: %d\n", MAX_METRICS_COUNT);
return;
}
printf("metrics loop: index=%d, name: %s, value: %f\n", index, name, value);
// fill the metrics
admin_data->metrics_array[index].len = MAX_METRICS_LEN;
admin_data->metrics_array[index].data = calloc(1, MAX_METRICS_LEN);
snprintf((char*)admin_data->metrics_array[index].data, MAX_METRICS_LEN,
"%s: %f\n", name, value);
// update the counter
admin_data->metrics_count = ++index;
}
static
void process_show(skull_txn_t* txn)
{
skull_metric_foreach(_metrics_each_cb, txn);
}
static
void process_help(skull_txn_t* txn)
{
Skull__Admin* admin_data = skull_txn_sharedata_admin(txn);
admin_data->metrics_array[0].len = MAX_METRICS_LEN;
admin_data->metrics_array[0].data = calloc(1, MAX_METRICS_LEN);
// fille the response
char* response = (char*)admin_data->metrics_array[0].data;
strncpy(response, CMD_HELP, strlen(CMD_HELP));
// update the counter
admin_data->metrics_count = 1;
}
int module_run(skull_txn_t* txn)
{
Skull__Admin* admin_data = skull_txn_sharedata_admin(txn);
bool ignore = admin_data->ignore;
if (ignore) {
return 0;
}
const char* command = admin_data->command;
printf("receive command: %s\n", command);
SKULL_LOG_INFO(1, "receive command: %s", command);
if (0 == strcmp("help", command)) {
process_help(txn);
} else if (0 == strcmp("show", command)) {
process_show(txn);
} else {
process_help(txn);
}
return 0;
}
void module_pack(skull_txn_t* txn, skull_txndata_t* txndata)
{
Skull__Admin* admin_data = skull_txn_sharedata_admin(txn);
bool ignore = admin_data->ignore;
if (ignore) {
return;
}
// pack the reponse string to txndata
int metrics_count = admin_data->metrics_count;
for (int i = 0; i < metrics_count; i++) {
const ProtobufCBinaryData* metrics = &admin_data->metrics_array[i];
skull_txndata_output_append(txndata, metrics->data,
strlen((const char*)metrics->data));
}
printf("module_pack(test): complete\n");
SKULL_LOG_INFO(1, "module_pack(test): complete");
}
|
#include <epopeia/epopeia_system.h>
#ifdef WIN32
#include <windows.h>
#endif
#include <stdio.h>
#include <GL/gl.h>
struct test { float valor; };
//-----------------------------------------------------------------------------
static void* Test_New(void)
{
void* self;
self = (void *)malloc(sizeof(struct test));
printf("Test_New self is %lx\n", self);
return self;
}
//-----------------------------------------------------------------------------
static void Test_Delete(void* self)
{
printf("Test_Delete self is %lx\n", self);
free(self);
}
//-----------------------------------------------------------------------------
static void Test_DoFrame(void* self, TRenderContext* RC, TSoundContext* SC)
{
// Do nothing
}
//-----------------------------------------------------------------------------
static void Test_Start(void* self, int z)
{
}
//-----------------------------------------------------------------------------
static void Test_Stop(void* self)
{
}
static float Test_GetValue(void* _self)
{
struct test *self = _self;
printf("Test_GetValue %f\n", self->valor);
return self->valor;
}
static void Test_SetValue(void* _self, float valor)
{
struct test *self = _self;
self->valor = valor;
printf("Test_SetValue %f\n", valor);
}
//-----------------------------------------------------------------------------
EPOPEIA_PLUGIN_API char*Epopeia_PluginName(void)
{
return "State-of-the-art Test by Enlar";
}
EPOPEIA_PLUGIN_API void Epopeia_RegisterType(void)
{
TTypeId Id;
TMethod* pMethod;
// printf("Registrando Test. "); //fflush(stdout);
// Registramos el tipo del objeto/efecto, el nombre que
// damos es el que se usar en el script como tipo/clase.
Id = Type_Register("Test");
// printf("Cod. de tipo %x. ", Id); fflush(stdout);
// A¤adimos los metodos obligatorios
// Son: New, Delete, Start, Stop, DoFrame
// New devuelve un puntero al objeto recien creado,
// de forma que multiples llamadas a new devuelven
// diferente puntero, pudiendo tener el mismo
// efecto varias veces incluso concurrentes
// El resto de las funciones, obligatorias y no obligatorias,
// el primer parametro que reciben es ese puntero al objeto.
pMethod = Method_New("New", (void*)Test_New);
Type_AddMethod(Id, pMethod);
pMethod = Method_New("Delete", (void*)Test_Delete);
Type_AddMethod(Id, pMethod);
pMethod = Method_New("DoFrame", (void*)Test_DoFrame);
Type_AddMethod(Id, pMethod);
pMethod = Method_New("Start", (void*)Test_Start);
Method_AddParameterType(pMethod, Type_IntegerId);
Type_AddMethod(Id, pMethod);
pMethod = Method_New("Stop", (void*)Test_Stop);
Type_AddMethod(Id, pMethod);
pMethod = Method_New("SetValue", (void*)Test_SetValue);
Method_AddParameterType(pMethod, Type_RealId);
Type_AddMethod(Id, pMethod);
pMethod = Method_New("GetValue", (void*)Test_GetValue);
Method_SetReturnType(pMethod, Type_RealId);
Type_AddMethod(Id, pMethod);
}
|
/*
WeaponPCmissile.h
(c)2004 Palestar, Richard Lyle
*/
#ifndef WEAPON_PC_MISSILE_H
#define WEAPON_PC_MISSILE_H
#include "DarkSpace/Constants.h"
#include "DarkSpace/GadgetWeapon.h"
//----------------------------------------------------------------------------
class WeaponPCmissile : public GadgetWeapon
{
public:
DECLARE_WIDGET_CLASS();
// NounGadget interface
Type type() const
{
return WEAPON_RANGED;
}
int maxDamage() const
{
return (9000 + (level() * 300));
}
int addValue() const
{
return 15750;
}
int buildTechnology() const
{
return 35;
}
int buildCost() const
{
return 400;
}
dword buildFlags() const
{
return NounPlanet::FLAG_METALS;
}
int buildTime() const
{
return 675;
}
// GadgetWeapon interface
int energyCost() const
{
return 1500;
}
int energyCharge() const
{
return 5;
}
int ammoCost() const
{
return 1;
}
int ammoMax() const
{
return 12;
}
int ammoReload() const
{
return 1;
}
int ammoResources() const
{
return 8;
}
bool needsTarget() const
{
return true;
}
bool needsLock() const
{
return false;
}
int lockTime() const
{
return 0;
}
dword lockType() const
{
return 0;
}
bool checkRange() const
{
return true;
}
bool inheritVelocity() const
{
return false;
}
bool turret() const
{
return false;
}
int maxProjectiles() const
{
return 12;
}
int projectileCount() const
{
return 1;
}
int projectileDelay() const
{
return 0;
}
bool projectileSmart() const
{
return true;
}
bool isMine() const
{
return false;
}
float projectileVelocity() const
{
return 50.0f + level();
}
float projectileLife() const
{
return (120.0f + (level() * 2.0f));
}
float projectileSig() const
{
return 1.0f + (level() * 0.25f);
}
bool projectileCollidable() const
{
return true;
}
bool projectileAutoTarget() const
{
return true;
}
float turnRate() const
{
return PI / 16.0f;
}
int tracerRate() const
{
return 20;
}
int tracerLife() const
{
return TICKS_PER_SECOND * 6;
}
dword damageType() const
{
return DAMAGE_KINETIC;
}
int damage() const
{
return (4360 + (level() * 8));
}
int damageRandom() const
{
return 1220;
}
bool reverseFalloff() const
{
return false;
}
float damageFalloff() const
{
return 1;
}
int repairRate() const
{
return 2;
}
int areaDamage() const
{
return (6500 + (level() * 19));
}
int areaDamageRandom() const
{
return (2200 + (level() * 25));
}
float areaDamageRadius() const
{
return 60.0f + level();
}
float armTime() const
{
return 5.0f;
}
};
//----------------------------------------------------------------------------
#endif
//----------------------------------------------------------------------------
// EOF
|
#pragma once
#include <ProcessHandle.h>
namespace Fangame {
//////////////////////////////////////////////////////////////////////////
// Fangame process and module information.
struct CFangameProcessInfo {
// Target boss information file.
CUnicodeString BossInfoPath;
// Window handle.
HWND WndHandle = nullptr;
// Process handle.
CProcessHandle ProcessHandle;
CFangameProcessInfo() = default;
CFangameProcessInfo( CUnicodePart bossInfoPath, HWND handle ) : BossInfoPath( bossInfoPath ), WndHandle( handle ), ProcessHandle( handle ) {}
};
//////////////////////////////////////////////////////////////////////////
} // namespace Fangame.
|
//
// Created by chengxin on 16/1/27.
// Copyright (c) 2016 oschina. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface UITabBar (BYT)
/**
* TabBar theme
*
* @param barColor 背景
* @param titleTextAttributes Item选中的颜色
* @param iconColor 选中图标的颜色,默认是蓝色
*/
+ (void)byt_setBarBackgroundColor:(UIColor *)barColor titleTextAttributesOnSelected:(NSDictionary *)titleTextAttributes iconColor:(UIColor *)iconColor;
@end |
/*
* safe_alloc.c - Wrappers around standard library memory functions,
* with some error checks.
*
* Copyright (c)2017 Phil Vachon <phil@security-embedded.com>
*
* This file is a part of The Standard Library (TSL)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <tsl/safe_alloc.h>
#include <tsl/cal.h>
#include <tsl/errors.h>
#include <tsl/assert.h>
#include <tsl/diag.h>
#include <stdlib.h>
#include <string.h>
#define ALC_MSG(sev, sys, msg, ...) MESSAGE("SAFEALLOC", sev, sys, msg, ##__VA_ARGS__)
CAL_CHECKED aresult_t __safe_malloc(void **ptr, size_t size)
{
aresult_t ret = A_OK;
void *n = NULL;
TSL_ASSERT_ARG(NULL != ptr);
TSL_ASSERT_ARG(0 != size);
*ptr = NULL;
if (NULL == (n = malloc(size))) {
ALC_MSG(SEV_FATAL, "OUT-OF-MEMORY", "No more heap space available for allocation of %zu bytes", size);
ret = A_E_NOMEM;
goto done;
}
*ptr = n;
done:
return ret;
}
CAL_CHECKED aresult_t __safe_calloc(void **ptr, size_t count, size_t size)
{
aresult_t ret = A_OK;
void *n = NULL;
TSL_ASSERT_ARG(NULL != ptr);
TSL_ASSERT_ARG(0 != size);
TSL_ASSERT_ARG(0 != count);
*ptr = NULL;
if (NULL == (n = calloc(count, size))) {
ALC_MSG(SEV_FATAL, "OUT-OF-MEMORY", "No more heap space available for allocation of %zu x %zu bytes", count, size);
ret = A_E_NOMEM;
goto done;
}
*ptr = n;
done:
return ret;
}
CAL_CHECKED aresult_t __safe_realloc(void **ptr, size_t size)
{
aresult_t ret = A_OK;
void *n = NULL;
TSL_ASSERT_ARG(NULL != ptr);
TSL_ASSERT_ARG(0 != size);
if (NULL == (n = realloc(*ptr, size))) {
ALC_MSG(SEV_FATAL, "OUT-OF-MEMORY", "No more heap space available for allocation of %zu bytes", size);
ret = A_E_NOMEM;
goto done;
}
*ptr = n;
done:
return ret;
}
#define HALF_SIZE_T ((size_t)1 << ((sizeof(size_t) << 3) - 1))
CAL_CHECKED
aresult_t __safe_aligned_zalloc(void **pptr, size_t size, size_t count, size_t align)
{
aresult_t ret = A_OK;
size_t alloc_size = 0;
void *ptr = NULL;
TSL_ASSERT_ARG(NULL != pptr);
TSL_ASSERT_ARG(0 < size);
TSL_ASSERT_ARG(0 < count);
*pptr = NULL;
alloc_size = size * count;
/* Check for an overflow in size * count */
if (CAL_UNLIKELY(size > HALF_SIZE_T || count > HALF_SIZE_T)) {
if (alloc_size / size != count) {
ret = A_E_OVERFLOW;
goto done;
}
}
/* We're good, so let's use posix_memalign to get an aligned pointer */
if (0 != posix_memalign(&ptr, align, alloc_size)) {
ret = A_E_NOMEM;
goto done;
}
/* Zero the memory behind the pointer */
memset(ptr, 0, alloc_size);
*pptr = ptr;
done:
return ret;
}
void free_u32_array(uint32_t **ptr)
{
TFREE(*ptr);
}
void free_i16_array(int16_t **ptr)
{
TFREE(*ptr);
}
void free_double_array(double **ptr)
{
TFREE(*ptr);
}
void free_memory(void **ptr)
{
TFREE(*ptr);
}
void free_string(char **str)
{
TFREE(*str);
}
|
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef ELECTRUM_QT_TEST_URITESTS_H
#define ELECTRUM_QT_TEST_URITESTS_H
#include <QObject>
#include <QTest>
class URITests : public QObject
{
Q_OBJECT
private Q_SLOTS:
void uriTests();
};
#endif // ELECTRUM_QT_TEST_URITESTS_H
|
#ifndef _WIN_G_PASSCODEBOX_
#define _WIN_G_PASSCODEBOX_
#include <_gadget/gadget.textbox.h>
class _passcodeBox : public _textBox
{
private:
//! The real value of the passcode box
wstring realText;
//! Char that will be used as replacement
_char replaceChar;
//! Internal
void refresher();
//! Override of _textBox::(..)
void removeStr( _int position , _length numChars = 1 );
void insertStr( _int position , wstring s );
public:
//! Set string-value
void setStrValue( wstring val );
//! Get string-value
wstring getStrValue(){ return this->realText; }
//! Ctor
_passcodeBox( _optValue<_coord> x , _optValue<_coord> y , _optValue<_length> width , _optValue<_length> height , wstring value = "" , _optValue<_char> replaceChar = ignore , _style&& style = _style() );
};
#endif |
//
// MyScene.h
// Game
//
// Copyright (c) 2013年 Harry Yan. All rights reserved.
//
#import <SpriteKit/SpriteKit.h>
@interface MyScene : SKScene
@end
|
/**
** @date 04/14/2013
**
** @license
** Copyright (C) 2013 Baptiste COVOLATO
** 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 SHARE_ERROR_H
# define SHARE_ERROR_H
# include <stdio.h>
# define ERROR_MSG(...) \
fprintf(stderr, __VA_ARGS__)
# define TREAT_ERROR(Cond) \
if (Cond) \
goto error
#endif /* !SHARE_ERROR_H */
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <CoreImage/CIFilter.h>
#import "_CIFilterProperties-Protocol.h"
@class CIImage, NSArray, NSString;
// Not exported
@interface CIRedEyeCorrections : CIFilter <_CIFilterProperties>
{
CIImage *inputImage;
NSString *inputCameraModel;
NSArray *inputCorrectionInfo;
}
@property(copy, nonatomic) NSArray *inputCorrectionInfo; // @synthesize inputCorrectionInfo;
@property(copy, nonatomic) NSString *inputCameraModel; // @synthesize inputCameraModel;
@property(retain, nonatomic) CIImage *inputImage; // @synthesize inputImage;
- (id)_initFromProperties:(id)arg1;
- (id)_outputProperties;
- (id)outputImage;
- (_Bool)_isIdentity;
- (void)setDefaults;
@end
|
/*!
* @file tree_avl.c
* @brief Tree structure for storing data.
*
* @addtogroup tree_avl
* @{
*/
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include "tree_avl.h"
#include "tree_binary.h"
#include "sukat_log_internal.h"
static int node_height(tree_node_t *node)
{
if (!node)
{
return -1;
}
return node->meta.height;
}
static void height_count(tree_node_t *node)
{
assert(node != NULL);
#define MAX(x, y) ((x > y) ? x : y)
node->meta.height =
MAX(node_height(node->left), node_height(node->right)) + 1;
#undef MAX
}
static int node_balance_get(tree_node_t *node)
{
assert(node != NULL);
int height_left = (node->left) ? node->left->meta.height : -1,
height_right = (node->right) ? node->right->meta.height : -1;
return height_left - height_right;
}
tree_ctx_t *tree_avl_create(struct sukat_drawer_params *params,
struct sukat_drawer_cbs *cbs)
{
tree_ctx_t *ctx;
if (!params)
{
return NULL;
}
ctx = (tree_ctx_t *)calloc(1, sizeof(*ctx));
if (!ctx)
{
return NULL;
}
ctx->type = SUKAT_DRAWER_TREE_AVL;
if (cbs)
{
memcpy(&ctx->cbs, cbs, sizeof(*cbs));
}
if (params)
{
memcpy(&ctx->params, params, sizeof(*params));
}
DBG(ctx, "Created tree %p", ctx);
return ctx;
}
static bool avl_rebalance(tree_ctx_t *ctx, tree_node_t *node, int balance)
{
if (balance > 1)
{
tree_node_t *left = node->left;
if (node_balance_get(left) < 0)
{
tree_binary_rotate_left(ctx, left);
height_count(left);
}
tree_binary_rotate_right(ctx, node);
return true;
}
else if (balance < -1)
{
tree_node_t *right = node->right;
if (node_balance_get(right) > 0)
{
tree_binary_rotate_right(ctx, right);
height_count(right);
}
tree_binary_rotate_left(ctx, node);
return true;
}
return false;
}
static void height_update_up(tree_ctx_t *ctx,
tree_node_t *node, bool rebalance)
{
while (node)
{
height_count(node);
if (rebalance)
{
int balance = node_balance_get(node);
if (avl_rebalance(ctx, node, balance) == true)
{
height_count(node);
}
}
node = node->parent;
}
}
void tree_avl_remove(tree_ctx_t *ctx, tree_node_t *node)
{
tree_node_t *update_from = tree_binary_detach(ctx, node);
if (update_from && !ctx->destroyed)
{
height_update_up(ctx, update_from, true);
}
tree_binary_node_free(ctx, node);
}
tree_node_t *sukat_tree_find(tree_ctx_t *ctx, void *key)
{
return tree_binary_find(ctx, ctx->root, key);
}
tree_node_t *tree_avl_add(tree_ctx_t *ctx, void *data)
{
tree_node_t *node = tree_binary_insert(ctx, data);
if (!node)
{
return NULL;
}
height_update_up(ctx, node, true);
return node;
};
/*! }@ */
|
/*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef TEST_MOCK_TRANSPORT_H_
#define TEST_MOCK_TRANSPORT_H_
#include BOSS_WEBRTC_U_api__call__transport_h //original-code:"api/call/transport.h"
#include "test/gmock.h"
namespace webrtc {
class MockTransport : public Transport {
public:
MOCK_METHOD3(SendRtp,
bool(const uint8_t* data,
size_t len,
const PacketOptions& options));
MOCK_METHOD2(SendRtcp, bool(const uint8_t* data, size_t len));
};
} // namespace webrtc
#endif // TEST_MOCK_TRANSPORT_H_
|
#ifndef TOKEN_H
#define TOKEN_H
#include <ostream>
#include <string>
/**
* Possible graph description language tokens
*/
enum class TokenType
{
KEYWORD,
NUMBER,
TEXT,
NEWLINE,
EMPTY
};
/**
* Represents a graph description language token
*/
class Token
{
public:
/**
* Construct an empty token.
*/
Token();
/**
* Constructs new token.
*/
Token(TokenType type, const std::string& value);
/**
* Get the type of the token.
*/
TokenType getType() const;
/**
* Get the value of the token.
*/
std::string getValue() const;
private:
/**
* The type of the token
*/
TokenType _type;
/**
* The value of the token
*/
std::string _value;
};
/**
* Write the token type to the output stream.
*/
std::ostream& operator<<(std::ostream& outputStream, TokenType tokenType);
/**
* Write the content of the token to the output stream.
*/
std::ostream& operator<<(std::ostream& outputStream, const Token& token);
#endif /* TOKEN_H */
|
/*
***********************************************************************************************************************
*
* Copyright (c) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, 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.
*
**********************************************************************************************************************/
/**
***********************************************************************************************************************
* @file palByteSwap.h
* @brief Header for utility byte swap functions
***********************************************************************************************************************
*/
#pragma once
#include "palUtil.h"
namespace Util
{
PAL_FORCE_INLINE constexpr bool IsHostBE()
{
#if (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) || defined(_M_PPC)
return true;
#elif (defined(__BYTE_ORDER__) && (__BYTE_ORDER__== __ORDER_LITTLE_ENDIAN__))
return false;
#else
#error Unable to determine host byte order
#endif
}
/// @{
/// @brief Swap the byte order of the value
///
/// @param v Value to be swapped
///
/// @return Value in swapped byte order
///
/// @note Requires compiler intrinsics
#if defined(__GNUC__) || defined(__clang__)
PAL_FORCE_INLINE uint16 SwapBytes16(uint16 v) { return __builtin_bswap16(v); }
PAL_FORCE_INLINE uint32 SwapBytes32(uint32 v) { return __builtin_bswap32(v); }
PAL_FORCE_INLINE uint64 SwapBytes64(uint64 v) { return __builtin_bswap64(v); }
#else
#error Unable to determine compiler intrinsics
#endif
/// @}
/// @{
/// @brief Swap the byte order of the value from host (memory) to Big-Endian (network) byte order if needed
///
/// @param v Value in host byte order
///
/// @return Value in Big-Endian order
///
/// @note Compiler may no-op if host is BE
PAL_FORCE_INLINE uint16 HostToBigEndian16(uint16 v) { return IsHostBE() ? v : SwapBytes16(v); }
PAL_FORCE_INLINE uint32 HostToBigEndian32(uint32 v) { return IsHostBE() ? v : SwapBytes32(v); }
PAL_FORCE_INLINE uint64 HostToBigEndian64(uint64 v) { return IsHostBE() ? v : SwapBytes64(v); }
/// @}
/// @{
/// @brief Swap the byte order of the value from Big-Endian (network) to host (memory) byte order if needed
///
/// @param v Value in Big-Endian order
///
/// @return Value in host byte order
///
/// @note Compiler may no-op if host is BE
PAL_FORCE_INLINE uint16 BigEndianToHost16(uint16 v) { return IsHostBE() ? v : SwapBytes16(v); }
PAL_FORCE_INLINE uint32 BigEndianToHost32(uint32 v) { return IsHostBE() ? v : SwapBytes32(v); }
PAL_FORCE_INLINE uint64 BigEndianToHost64(uint64 v) { return IsHostBE() ? v : SwapBytes64(v); }
/// @}
} // namespace Util
|
/*
* Seek thermal interface
* Author: Maarten Vandersteegen
*/
#ifndef SEEK_THERMAL_H
#define SEEK_THERMAL_H
#include <opencv2/opencv.hpp>
#include "SeekCam.h"
#define THERMAL_WIDTH 207
#define THERMAL_HEIGHT 154
#define THERMAL_RAW_WIDTH 208
#define THERMAL_RAW_HEIGHT 156
#define THERMAL_REQUEST_SIZE 16224
#define THERMAL_RAW_SIZE (THERMAL_RAW_WIDTH * THERMAL_RAW_HEIGHT)
namespace LibSeek {
class SeekThermal: public SeekCam
{
public:
SeekThermal();
/*
* ffc_filename:
* Filename for additional flat field calibration and corner
* gradient elimination. If provided and found, the image will
* be subtracted from each retrieved frame. If not, no additional
* flat field calibration will be applied
*/
SeekThermal(std::string ffc_filename);
virtual bool init_cam();
virtual int frame_id();
virtual int frame_counter();
private:
uint16_t m_buffer[THERMAL_RAW_SIZE];
};
} /* LibSeek */
#endif /* SEEK_THERMAL_H */
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 30 2020 21:18:12).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@class DVTFilePath, NSDictionary, NSOrderedSet, NSPredicate, NSSet, NSString;
@interface DVTDeviceType : NSObject
{
DVTFilePath *_bundlePath;
NSString *_baseDeviceTypeIdentifier;
NSPredicate *_matchPredicate;
NSPredicate *_filterPredicate;
NSString *_identifier;
NSString *_name;
NSString *_UTI;
NSOrderedSet *_supportedArchitectures;
NSString *_deviceSpecifierPrefix;
NSDictionary *_deviceSpecifierOptionDefaults;
NSSet *_knownDeviceSpecifierOptions;
NSSet *_requiredDeviceSpecifierOptions;
}
+ (id)_propertyDictionaryForDeviceTypeAtPath:(id)arg1;
+ (void)_loadDeviceTypeBundleAtPath:(id)arg1;
+ (BOOL)loadAllDeviceTypeBundlesReturningError:(id *)arg1;
+ (id)conformingDeviceTypeForDevice:(id)arg1;
+ (void)registerDeviceTypeWithSpecification:(id)arg1;
+ (void)_locked_fulfillPendingDeviceTypeSpecificationsWaitingForBaseDeviceTypeWithIdentifier:(id)arg1;
+ (void)_locked_registerPendingDeviceTypeSpecification:(id)arg1 waitingForBaseDeviceTypeWithIdentifier:(id)arg2;
+ (void)_locked_registerDeviceType:(id)arg1;
+ (id)parentDeviceTypeForDeviceType:(id)arg1;
+ (id)deviceTypeWithIdentifier:(id)arg1;
+ (void)initialize;
- (void).cxx_destruct;
@property(readonly, copy) NSSet *requiredDeviceSpecifierOptions; // @synthesize requiredDeviceSpecifierOptions=_requiredDeviceSpecifierOptions;
@property(readonly, copy) NSSet *knownDeviceSpecifierOptions; // @synthesize knownDeviceSpecifierOptions=_knownDeviceSpecifierOptions;
@property(readonly, copy) NSDictionary *deviceSpecifierOptionDefaults; // @synthesize deviceSpecifierOptionDefaults=_deviceSpecifierOptionDefaults;
@property(readonly, copy) NSString *deviceSpecifierPrefix; // @synthesize deviceSpecifierPrefix=_deviceSpecifierPrefix;
@property(readonly, copy) NSOrderedSet *supportedArchitectures; // @synthesize supportedArchitectures=_supportedArchitectures;
@property(readonly, copy) NSString *UTI; // @synthesize UTI=_UTI;
@property(readonly, copy) NSString *name; // @synthesize name=_name;
@property(readonly, copy) NSString *identifier; // @synthesize identifier=_identifier;
- (BOOL)_isFilteredDevice:(id)arg1;
- (BOOL)_isMatchedDevice:(id)arg1;
- (id)_baseDeviceType;
- (id)description;
- (void)_commonInit;
- (void)_initFilterPredicateWithPredicateString:(id)arg1 fallbackPredicate:(id)arg2;
- (void)_initMatchPredicateWithPredicateString:(id)arg1 fallbackPredicate:(id)arg2;
- (id)initWithExtension:(id)arg1;
- (id)initWithIdentifier:(id)arg1 baseDeviceType:(id)arg2 specification:(id)arg3;
- (id)initWithIdentifier:(id)arg1 baseDeviceType:(id)arg2;
@property(readonly) NSString *baseDeviceTypeIdentifier;
@end
|
/*
* c_scope.h - Scope handling for the C programming language.
*
* Copyright (C) 2002 Southern Storm Software, Pty Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef _C_SCOPE_H
#define _C_SCOPE_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* Scope data item kinds. Must not overlap with the values
* defined in "codegen/cg_scope.h".
*/
#define C_SCDATA_TYPEDEF 100
#define C_SCDATA_STRUCT_OR_UNION 101
#define C_SCDATA_ENUM 102
#define C_SCDATA_ENUM_CONSTANT 103
#define C_SCDATA_LOCAL_VAR 104
#define C_SCDATA_PARAMETER_VAR 105
#define C_SCDATA_GLOBAL_VAR 106
#define C_SCDATA_GLOBAL_VAR_FORWARD 107
#define C_SCDATA_FUNCTION 108
#define C_SCDATA_FUNCTION_FORWARD 109
#define C_SCDATA_FUNCTION_FORWARD_KR 110
#define C_SCDATA_FUNCTION_INFERRED 111
#define C_SCDATA_UNDECLARED 112
/*
* The current scope.
*/
extern ILScope *CCurrentScope;
/*
* The global scope.
*/
extern ILScope *CGlobalScope;
/*
* Initialize the global scope.
*/
void CScopeGlobalInit(ILGenInfo *info);
/*
* Look up a name in the current scope. Returns NULL if not found.
*/
void *CScopeLookup(const char *name);
/*
* Lookup a name in the current scope, while ignoring parent scopes.
*/
void *CScopeLookupCurrent(const char *name);
/*
* Determine if a name in the current scope is a typedef.
*/
int CScopeIsTypedef(const char *name);
/*
* Determine if a name in the current scope is a namespace.
*/
int CScopeIsNamespace(const char *name);
/*
* Look up a struct or union name in the current scope.
*/
void *CScopeLookupStructOrUnion(const char *name, int structKind);
/*
* Determine if we already have a struct or union in with a specific
* name in the current scope.
*/
int CScopeHasStructOrUnion(const char *name, int structKind);
/*
* Add a type reference for a struct or union to the current scope.
*/
void CScopeAddStructOrUnion(const char *name, int structKind, ILType *type);
/*
* Look up an enum name in the current scope.
*/
void *CScopeLookupEnum(const char *name);
/*
* Determine if we already have an enum in with a specific
* name in the current scope.
*/
int CScopeHasEnum(const char *name);
/*
* Add a type reference for an enum to the current scope.
*/
void CScopeAddEnum(const char *name, ILType *type);
/*
* Add an enum constant to the current scope.
*/
void CScopeAddEnumConst(const char *name, ILNode *node,
ILInt32 value, ILType *type);
/*
* Add a type definition to the current scope.
*/
void CScopeAddTypedef(const char *name, ILType *type, ILNode *node);
/*
* Add a function definition to the global scope.
*/
void CScopeAddFunction(const char *name, ILNode *node, ILType *signature);
/*
* Add a forward function definition to the global scope.
*/
void CScopeAddFunctionForward(const char *name, int kind,
ILNode *node, ILType *signature);
/*
* Add an inferred function definition to the global scope.
*/
void CScopeAddInferredFunction(const char *name, ILType *signature);
/*
* Update a forward reference to a function with actual information.
*/
void CScopeUpdateFunction(void *data, int kind,
ILNode *node, ILType *signature);
/*
* Add information about a parameter to the current scope.
*/
void CScopeAddParam(const char *name, unsigned index, ILType *type);
/*
* Add information about a non-static local variable to the current scope.
*/
void CScopeAddLocal(const char *name, ILNode *node,
unsigned index, ILType *type);
/*
* Add information about a global variable to the current scope.
*/
void CScopeAddGlobal(const char *name, ILNode *node, ILType *type);
/*
* Add information about a global variable forward declaration
* to the current scope.
*/
void CScopeAddGlobalForward(const char *name, ILNode *node, ILType *type);
/*
* Update information about a global variable.
*/
void CScopeUpdateGlobal(void *data, int kind, ILNode *node, ILType *type);
/*
* Add an entry to the current scope that records that an identifier
* was undeclared, but that we don't want to know about it again.
*/
void CScopeAddUndeclared(const char *name);
/*
* Add a namespace to the global scope for the purposes of "using".
*/
void CScopeUsingNamespace(const char *name);
/*
* Push a namespace onto the lookup context.
*/
void CScopePushNamespace(char *name);
/*
* Pop a namespace from the lookup context.
*/
void CScopePopNamespace(char *name);
/*
* Get the scope data kind.
*/
int CScopeGetKind(void *data);
/*
* Get the type information associated with a scope data item.
*/
ILType *CScopeGetType(void *data);
/*
* Get the node information associated with a scope data item.
*/
ILNode *CScopeGetNode(void *data);
/*
* Get the local variable index associated with a scope data item.
*/
unsigned CScopeGetIndex(void *data);
/*
* Get the value of an "enum" constant.
*/
ILInt32 CScopeGetEnumConst(void *data);
#ifdef __cplusplus
};
#endif
#endif /* _C_SCOPE_H */
|
//
// SettingsModel.h
// MyBrowser
//
// Created by apple on 2015/03/20.
// Copyright (c) 2015年 org. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface Settings : NSObject
@property (strong, nonatomic) NSString* homeUrlStr;
@property (assign, nonatomic) NSInteger tabsSize;
@end
|
//
// CDProposicao.h
// DadosAbertosDeputados
//
// Created by Ulysses on 3/10/16.
// Copyright © 2016 DadosAbertosBrasil. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface CDProposicao : NSObject
@property NSNumber *idProposicao;
@property NSString *nome;
@property NSString *sigla;
@property NSNumber *numero;
@property NSNumber *ano;
@property NSString *tipoProposicao;
@property NSString *tema;
@property NSString *ementa;
@property NSString *explicacaoEmenta;
@property NSString *indexacao;
@property NSString *regimeTramitacao;
@property NSString *situacao;
@property NSString *urlInteiroTeor;
@property NSNumber *qtdeAutores;
@property NSNumber *idAutor;
@property NSString *nomeAutor;
@property NSArray *votacoes;
- (instancetype)initWithCodProposicao:(NSNumber*)codProposicao;
-(void)loadProposicao:(void(^)(void))completionHandler;
-(void)loadVotacoes:(void(^)(void))completionHandler;
+(void)loadDistinctCodProposicoesVotedIn:(NSUInteger*)year withCompletionHandler:(void(^)(NSArray* response))completionHandler;
+(void)loadCodProposicoesVotedIn:(NSUInteger*)year withCompletionHandler:(void(^)(NSArray* response))completionHandler;
@end
|
#include "handle.h"
int
handle_task(_task *task, _response *response) {
int fd;
int total, nrecv;
char buf[BUFFSIZE] = {0};
int data_size, n, nsend;
fd = task->fd;
total = 0;
while ((nrecv = recv(fd, buf, sizeof(buf), 0)) > 0) {
total += nrecv;
}
if (nrecv == 0) {
printf("%s(%d) closed\n", inet_ntoa(task->client_addr.sin_addr),
task->client_addr.sin_port);
close(fd);
return 0;
}
if (nrecv == -1 && errno != EAGAIN
&& errno != EWOULDBLOCK && errno != ECONNABORTED
&& errno != EPROTO && errno != EINTR) {
perror("read error");
}
printf("%s(%d) says: ", inet_ntoa(task->client_addr.sin_addr),
task->client_addr.sin_port);
for (n = 0; n < strlen(buf); ++n) {
printf("0x%x ", buf[n]);
}
printf("\n");
data_size = strlen(buf);
n = data_size;
while (n > 0) {
nsend = send(fd, buf + data_size - n, n, 0);
if (nsend < n) {
if (nsend == -1 && errno != EAGAIN) {
perror("write error");
}
break;
}
n -= nsend;
}
return 0;
}
|
#include <stdint.h>
#include <windows.h>
#undef GetCurrentTime
#undef DeleteFile
// credit: https://groups.google.com/forum/#!msg/leveldb/VuECZMnsob4/F6pGPGaK-XwJ
namespace leveldb {
namespace port {
class AtomicPointer {
private:
void* rep_;
public:
AtomicPointer () {}
explicit AtomicPointer(void* v) {
InterlockedExchangePointer(&rep_, v);
}
// Read and return the stored pointer with the guarantee that no
// later memory access (read or write) by this thread can be
// reordered ahead of this read.
inline void* Acquire_Load() const {
void* r;
InterlockedExchangePointer(&r, rep_ );
return r;
}
// Set v as the stored pointer with the guarantee that no earlier
// memory access (read or write) by this thread can be reordered
// after this store.
inline void Release_Store(void* v) {
InterlockedExchangePointer(&rep_, v);
}
// Read the stored pointer with no ordering guarantees.
inline void* NoBarrier_Load() const {
void* r = reinterpret_cast<void*>(rep_);
return r;
}
// Set va as the stored pointer with no ordering guarantees.
inline void NoBarrier_Store(void* v) {
rep_ = reinterpret_cast<void*>(v);
}
};
} // namespace port
} // namespace leveldb
|
#ifndef _TB_BCM2_H_
#define _TB_BCM2_H_
void TB_BCM2_CAN_SetupLearnImmo(Uint8 CanSpeedNumber);
Uint8 TB_BCM2_CAN_LearnImmo(Uint8 CanSpeedNumber);
void TB_BCM2_CAN_CheckBcmVersion(Uint8 CanSpeedNumber);
extern const_Flash_Uint8 BCM2_db_Channel_setup[];
extern const_Flash_Uint8 BCM2_db_Channel_param[];
extern const_Flash_Uint8 BCM2_db_KeepAlive[];
extern const_Flash_Uint8 BCM2_db_EndSession[];
extern const_Flash_Uint8 BCM2_db_Data_Transmit_1[];
extern const_Flash_Uint8 BCM2_db_Data_Transmit_8[];
#endif /*_TB_BCM2_H_*/
|
/*
This file contains the systemmonitor 'raw mode'
What the hell is this?
see issue #52
Why do we need this??
to give developers the chance to create custom font ends...
*/
void raw_mode(int argc, char *argv[])
{ //NOTE WE ARE __NOT__ IN CURSES, NORMAL SHELL
struct user *user = malloc(sizeof(struct user));
if(argc == 2)
{
puts("Sorry, you need to enter a opperation");
exit(1);
}
if(strcmp(argv[2], "core") == 0)
{
printf("SYSTEMMONITOR_VERSION:%s\n", _VERSION_); //to check compatability...
printf("SYSTEMMONITOR_RAW_REVISION:%s\n", _RAW_REV_); //to check compatability...
//memory
struct sysinfo info;
sysinfo(&info); //All important infos
printf("TOTAL_RAM:%ld\n", info.totalram * info.mem_unit);
printf("FREE_RAM:%ld\n", info.freeram * info.mem_unit);
printf("TOTAL_SWAP:%ld\n", info.totalswap * info.mem_unit);
printf("FREE_SWAP:%ld\n", info.freeswap * info.mem_unit);
printf("FREE_RAM_PERCENT: %f\n", info.totalram != 0 ? 100 * info.freeram / info.totalram : 100.0);
printf("FREE_SWAP_PERCENT: %f\n", info.totalswap != 0 ? 100 * info.freeswap / info.totalswap : 100.0);
//CPU
FILE *load = fopen("/proc/cpuinfo", "r");
int cores = 0;
char buffer[50];
while(fgets(buffer, 50, load) != NULL)
{
if(strncmp(buffer, "processor", 9) == 0)
{
cores++;
}
}
printf("CPU_CORES:%d\n", cores);
fclose(load);
printf("CPU_LOAD_PERCENT:%f\n", cpu_load_percent());
printf("CPU_RUNNING_TASKS:%d\n", info.procs);
FILE *cpuinfo = fopen("/proc/cpuinfo", "r");
char buffer1[100] = "", buffer2[100] = "", buffer3[100] = "", buffer4[100] ="";
char buffer5[100] = "";
char *vendor = malloc(50);
char *model_name = malloc(50);
char *rate = malloc(50);
char *cache_size = malloc(50);
char *add_size = malloc(50);
for(;fgets(buffer1, 100, cpuinfo) != NULL;)
if(strstr(buffer1, "vendor_id" ) != 0)
break;
/* now split */
vendor = strtok(buffer1, "\t\n ");
vendor = strtok(NULL, "\t\n ");
vendor = strtok(NULL, "\t\n ");
!strstr(buffer1, "vendor_id" ) ? vendor = not_arivable : NULL;
strncmp(buffer1, "vendor_id", 9) == 0 ? printf("CPU_VENDOR:%s\n", vendor) : printf("CPU_VENDOR:%s\n", not_arivable);
fseek(cpuinfo, 0L, SEEK_SET);
for(;fgets(buffer2, 100, cpuinfo) != NULL;)
if(strstr(buffer2, "model name" ) != 0)
break;
/* now split */
model_name = strtok(buffer2, "\t\n ");
model_name = strtok(NULL, "\t\n ");
model_name = strtok(NULL, "\t\n ");
model_name = strtok(NULL, ":");
strncmp(buffer2, "model", 5) == 0 ? printf("CPU_MODEL:%s", model_name) : printf("CPU_MODEL:%s\n", not_arivable);
fseek(cpuinfo, 0L, SEEK_SET);
for(;fgets(buffer3, 100, cpuinfo) != NULL;)
if(strstr(buffer3, "cpu MHz" ) != 0)
break;
/* now split */
rate = strtok(buffer3, "\t\n ");
rate = strtok(NULL, "\t\n ");
rate = strtok(NULL, "\t\n ");
rate = strtok(NULL, "\t\n ");
strncmp(buffer3, "cpu", 3) == 0 ? printf("CPU_RATE:%s\n", rate) : printf("CPU_RATE:%s\n", not_arivable);
fseek(cpuinfo, 0L, SEEK_SET);
for(;fgets(buffer4, 100, cpuinfo) != NULL;)
if(strstr(buffer4, "cache size" ) != 0)
break;
/* now split */
cache_size = strtok(buffer4, "\t\n ");
cache_size = strtok(NULL, "\t\n ");
cache_size = strtok(NULL, "\t\n ");
cache_size = strtok(NULL, ":");
strncmp(buffer4, "cache", 5) == 0 ? printf("CPU_CACHE_SIZE:%s", cache_size) : printf("CPU_CACHE_SIZE:%s\n", not_arivable);
fseek(cpuinfo, 0L, SEEK_SET);
for(;fgets(buffer5, 100, cpuinfo) != NULL;)
if(strstr(buffer5, "address sizes" ) != 0)
break;
/* now split */
add_size = strtok(buffer5, "\t\n ");
add_size = strtok(NULL, "\t\n ");
add_size = strtok(NULL, "\t\n ");
add_size = strtok(NULL, ":");
strncmp(buffer5, "address", 7) == 0 ? printf("CPU_ADDRESS_SIZE:%s", add_size) : printf("CPU_ADDRESS_SIZE:%s\n", not_arivable);
fclose(cpuinfo);
//ALSA
FILE *alsa = fopen("/proc/asound/version", "r");
char alsa_version[250];
fgets(alsa_version, 250, alsa);
printf("ALSA_VERSION:%s",alsa_version);
}
else if(strcmp(argv[2], "users") == 0)
{
while((user = entry()) != NULL)
{
printf("\nUSER_BEGIN\n");
printf("USERNAME:");
puts(user->username);
printf("COMMENT:");
puts(user->comment);
printf("HOME:");
user->basedir != NULL ? puts(user->basedir) : puts("");
printf("SHELL:");
user->shell != NULL ? puts(user->shell) : puts("");
printf("UID:");
puts(user->UID);
printf("GID:");
puts(user->GID);
printf("USER_END\n");
}
}
else if(strcmp(argv[2], "user") == 0 && argc > 3)
{
while((user = entry()) != NULL)
{
if(strcmp(user->username, argv[3]) == 0 || strcmp(user->UID, argv[3]) == 0)
{
printf("USERNAME:");
puts(user->username);
printf("COMMENT:");
puts(user->comment);
printf("HOME:");
user->basedir != NULL ? puts(user->basedir) : puts("");
printf("SHELL:");
user->shell != NULL ? puts(user->shell) : puts("");
printf("UID:");
puts(user->UID);
printf("GID:");
puts(user->GID);
}
}
}
exit(0);
}
|
//
// MainPage.xaml.h
// Declaration of the MainPage class.
//
#pragma once
#include "MainPage.g.h"
namespace WheresMyElement
{
public ref class MainPage sealed
{
private:
bool storyboardPaused;
public:
MainPage();
protected:
virtual void OnTapped(Windows::UI::Xaml::Input::TappedRoutedEventArgs^ args) override;
};
}
|
/************************************************************************************
Tue Apr 19 10:30:43 2016
MIT License
Copyright (c) 2016 zhuzuolang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
************************************************************************************/
#include "clock.h"
PUBLIC u_int32 global_clock=0;
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "WXPBGeneratedMessage.h"
@class NSString;
@interface OpenAppInfo : WXPBGeneratedMessage
{
}
+ (void)initialize;
// Remaining properties
@property(retain, nonatomic) NSString *androidPackageName; // @dynamic androidPackageName;
@property(retain, nonatomic) NSString *androidSignature; // @dynamic androidSignature;
@property(retain, nonatomic) NSString *appDescription; // @dynamic appDescription;
@property(retain, nonatomic) NSString *appDescription4EnUs; // @dynamic appDescription4EnUs;
@property(retain, nonatomic) NSString *appDescription4ZhTw; // @dynamic appDescription4ZhTw;
@property(retain, nonatomic) NSString *appIconUrl; // @dynamic appIconUrl;
@property(retain, nonatomic) NSString *appId; // @dynamic appId;
@property(nonatomic) unsigned int appInfoFlag; // @dynamic appInfoFlag;
@property(retain, nonatomic) NSString *appName; // @dynamic appName;
@property(retain, nonatomic) NSString *appName4EnUs; // @dynamic appName4EnUs;
@property(retain, nonatomic) NSString *appName4ZhTw; // @dynamic appName4ZhTw;
@property(retain, nonatomic) NSString *appStoreUrl; // @dynamic appStoreUrl;
@property(nonatomic) unsigned int appVersion; // @dynamic appVersion;
@property(retain, nonatomic) NSString *appWatermarkUrl; // @dynamic appWatermarkUrl;
@end
|
// Copyright (c) 2014 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_MENU_VIEWS_H_
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_MENU_VIEWS_H_
#include <map>
#include <memory>
#include "base/memory/weak_ptr.h"
#include "shell/browser/api/electron_api_menu.h"
#include "ui/display/screen.h"
#include "ui/views/controls/menu/menu_runner.h"
namespace electron {
namespace api {
class MenuViews : public Menu {
public:
explicit MenuViews(gin::Arguments* args);
~MenuViews() override;
protected:
void PopupAt(BaseWindow* window,
int x,
int y,
int positioning_item,
base::OnceClosure callback) override;
void ClosePopupAt(int32_t window_id) override;
private:
void OnClosed(int32_t window_id, base::OnceClosure callback);
// window ID -> open context menu
std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;
base::WeakPtrFactory<MenuViews> weak_factory_{this};
};
} // namespace api
} // namespace electron
#endif // ELECTRON_SHELL_BROWSER_API_ELECTRON_API_MENU_VIEWS_H_
|
/**
* Example implementation of the radio button list UI pattern.
*/
#include "radio_button_window.h"
static Window *s_main_window;
static MenuLayer *s_menu_layer;
static int s_current_selection = 0;
static uint16_t get_num_rows_callback(MenuLayer *menu_layer, uint16_t section_index, void *context) {
return RADIO_BUTTON_WINDOW_NUM_ROWS + 1;
}
static void draw_row_callback(GContext *ctx, const Layer *cell_layer, MenuIndex *cell_index, void *context) {
if(cell_index->row == RADIO_BUTTON_WINDOW_NUM_ROWS) {
// This is the submit item
menu_cell_basic_draw(ctx, cell_layer, "Submit", NULL, NULL);
} else {
// This is a choice item
static char s_buff[16];
snprintf(s_buff, sizeof(s_buff), "Choice %d", (int)cell_index->row);
menu_cell_basic_draw(ctx, cell_layer, s_buff, NULL, NULL);
GRect bounds = layer_get_bounds(cell_layer);
GPoint p = GPoint(bounds.size.w - (3 * RADIO_BUTTON_WINDOW_RADIO_RADIUS), (bounds.size.h / 2));
// Selected?
if(menu_cell_layer_is_highlighted(cell_layer)) {
graphics_context_set_stroke_color(ctx, GColorWhite);
graphics_context_set_fill_color(ctx, GColorWhite);
} else {
graphics_context_set_fill_color(ctx, GColorBlack);
}
// Draw radio filled/empty
graphics_draw_circle(ctx, p, RADIO_BUTTON_WINDOW_RADIO_RADIUS);
if(cell_index->row == s_current_selection) {
// This is the selection
graphics_fill_circle(ctx, p, RADIO_BUTTON_WINDOW_RADIO_RADIUS - 3);
}
}
}
static int16_t get_cell_height_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *context) {
return PBL_IF_ROUND_ELSE(
menu_layer_is_index_selected(menu_layer, cell_index) ?
MENU_CELL_ROUND_FOCUSED_SHORT_CELL_HEIGHT : MENU_CELL_ROUND_UNFOCUSED_TALL_CELL_HEIGHT,
44);
}
static void select_callback(struct MenuLayer *menu_layer, MenuIndex *cell_index, void *callback_context) {
if(cell_index->row == RADIO_BUTTON_WINDOW_NUM_ROWS) {
// Do something with user choice
APP_LOG(APP_LOG_LEVEL_INFO, "Submitted choice %d", s_current_selection);
window_stack_pop(true);
} else {
// Change selection
s_current_selection = cell_index->row;
menu_layer_reload_data(menu_layer);
}
}
static void window_load(Window *window) {
Layer *window_layer = window_get_root_layer(window);
GRect bounds = layer_get_bounds(window_layer);
s_menu_layer = menu_layer_create(bounds);
menu_layer_set_click_config_onto_window(s_menu_layer, window);
menu_layer_set_callbacks(s_menu_layer, NULL, (MenuLayerCallbacks) {
.get_num_rows = get_num_rows_callback,
.draw_row = draw_row_callback,
.get_cell_height = get_cell_height_callback,
.select_click = select_callback,
});
layer_add_child(window_layer, menu_layer_get_layer(s_menu_layer));
}
static void window_unload(Window *window) {
menu_layer_destroy(s_menu_layer);
window_destroy(window);
s_main_window = NULL;
}
void radio_button_window_push() {
if(!s_main_window) {
s_main_window = window_create();
window_set_window_handlers(s_main_window, (WindowHandlers) {
.load = window_load,
.unload = window_unload,
});
}
window_stack_push(s_main_window, true);
}
|
#include <stdio.h>
#include "uuid.h"
#define UUID_HI64(uuid) (0[(uint64_t *)uuid])
#define UUID_LO64(uuid) (1[(uint64_t *)uuid])
static int _uuid_parse_hex_char (char c) {
if (c >= '0' && c <= '9') {
return c - '0';
}
if (c >= 'A' && c <= 'F') {
return c - 'A' + 10;
}
if (c >= 'a' && c <= 'f') {
return c - 'a' + 10;
}
return -1;
}
static bool _uuid_parse_hex_octed (char *in, uint8_t *out) {
int hi = _uuid_parse_hex_char(in[0]);
int lo = _uuid_parse_hex_char(in[1]);
if (hi < 0 || lo < 0) {
return false;
}
*out = ((hi << 4) & 0xf0) | (lo & 0x0f);
return true;
}
static bool _uuid_parse_hex_group (int len, char *grouped, uint8_t *out) {
if (len % 2 != 0) {
return false;
}
int i, o;
for (i = 0; i < len; i += 2) {
if (!_uuid_parse_hex_octed(&grouped[i], &out[i / 2])) {
return false;
}
}
return true;
}
uuid_ptr_t uuid_parse (char *grouped, uuid_t uuid) {
if (grouped[8] != '-' || grouped[13] != '-' ||
grouped[18] != '-' || grouped[23] != '-') {
return NULL;
}
if (!_uuid_parse_hex_group(8, &grouped[0], &uuid[0])) {
return NULL;
}
if (!_uuid_parse_hex_group(4, &grouped[9], &uuid[4])) {
return NULL;
}
if (!_uuid_parse_hex_group(4, &grouped[14], &uuid[6])) {
return NULL;
}
if (!_uuid_parse_hex_group(4, &grouped[19], &uuid[8])) {
return NULL;
}
if (!_uuid_parse_hex_group(12, &grouped[24], &uuid[10])) {
return NULL;
}
return uuid;
}
bool uuid_eq (uuid_t a, uuid_t b) {
return a && b &&
UUID_HI64(a) == UUID_HI64(b) &&
UUID_LO64(a) == UUID_LO64(b);
}
uuid_ptr_t uuid_copy (uuid_t dst, uuid_t src) {
UUID_HI64(dst) = UUID_HI64(src);
UUID_LO64(dst) = UUID_LO64(src);
return dst;
}
int uuid_snprint (char * buffer, int buf_size, uuid_t uuid) {
return snprintf(buffer, buf_size, "%02x%02x%02x%02x-"
"%02x%02x-%02x%02x-%02x%02x-"
"%02x%02x%02x%02x%02x%02x",
uuid[0], uuid[1], uuid[2], uuid[3],
uuid[4], uuid[5], uuid[6], uuid[7],
uuid[8], uuid[9], uuid[10], uuid[11],
uuid[12], uuid[13], uuid[14], uuid[15]);
}
|
//
// SingleCommunicationCallingView.h
// API
//
// Created by ShingHo on 16/5/9.
// Copyright © 2016年 SayGeronimo. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol SingleCommunicationCallingViewDelegate<NSObject>
- (void)onClickBtn:(NSInteger)tag;
@end
@interface SingleCommunicationCallingView : UIView
@property (nonatomic, weak) id<SingleCommunicationCallingViewDelegate> delegate;
- (instancetype)initWithFrame:(CGRect)frame senderIsMe:(BOOL)isMe;
@end
|
#ifndef CURRENT_PC_H
#define CURRENT_PC_H
#include "../../../../common/sensor/current/current.h"
void initCurrentPc(Current* current);
#endif
|
/****************************************************************************
**
** Copyright (C) 2016
**
** This file is generated by the Magus toolkit
**
** 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."
**
****************************************************************************/
#pragma once
#include "Ogre.h"
#include <limits>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QWheelEvent>
enum CameraMode // enumerator values for different styles of camera movement
{
CM_BLENDER,
CM_FLY, // WIP
CM_ORBIT // WIP
};
enum View
{
VI_TOP,
VI_LEFT,
VI_BOTTOM,
VI_RIGHT,
VI_FRONT,
VI_BACK,
VI_USER
};
enum Direction
{
DR_FORWARD,
DR_BACKWARD,
DR_LEFT,
DR_RIGHT
};
/****************************************************************************
* This class manages the ogre camera and transalates Qt events to camera
* actions
***************************************************************************/
class CameraController
{
public:
CameraController(Ogre::Camera* cam);
~CameraController();
void reset();
void setCamera(Ogre::Camera* cam);
Ogre::Camera* getCamera() { return mCamera; }
void setTarget(Ogre::SceneNode* target);
Ogre::SceneNode* getTarget() { return mTarget; }
void manualStop();
Ogre::Real getDistanceFromTarget() { return mDistFromTarget; }
void setYawPitchDist(Ogre::Radian yaw, Ogre::Radian pitch, Ogre::Real dist);
void setMode(CameraMode mode);
CameraMode getMode() { return mMode; }
void setProjectionType(Ogre::ProjectionType pt);
Ogre::ProjectionType getProjectionType() { return mCamera->getProjectionType(); }
View getView() { return mCurrentView; }
void setView(View newView);
void rotatePerspective(Direction dir);
void numpadViewSwitch(const QKeyEvent* evt);
// Per-frame updates.
bool frameRenderingQueued(const Ogre::FrameEvent& evt);
void keyPress(const QKeyEvent* evt);
void keyRelease(const QKeyEvent* evt);
void mouseMove(Ogre::Vector2 mousePos);
void mouseWheel(const QWheelEvent* evt);
void mousePress(const QMouseEvent* evt);
/*-----------------------------------------------------------------------------
| Processes mouse releases.
| Left button is for orbiting, and right button is for zooming.
-----------------------------------------------------------------------------*/
void mouseRelease(const QMouseEvent* evt); // Only applies for orbit style.
void rotate(int x, int y);
void pan(float x, float y);
private:
Ogre::Camera* mCamera = nullptr;
Ogre::SceneNode* mTarget = nullptr;
Ogre::SceneNode* mCameraNode = nullptr;
bool mOrbiting = false;
bool mShiftDown = false;
bool mGoingForward = false;
bool mGoingBack = false;
bool mGoingLeft = false;
bool mGoingRight = false;
bool mGoingUp = false;
bool mGoingDown = false;
Ogre::Real mDistFromTarget = 0.0;
Ogre::Real mTopSpeed = 15;
Ogre::Vector3 mVelocity = Ogre::Vector3::ZERO;
int mMouseWheelDelta = 0;
View mCurrentView = VI_USER;
CameraMode mMode = CM_BLENDER;
};
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2011-2012 Litecoin Developers
// Copyright (c) 2013 Feathercoin2 Developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef __cplusplus
# error This header can only be compiled as C++.
#endif
#ifndef __INCLUDED_PROTOCOL_H__
#define __INCLUDED_PROTOCOL_H__
#include "serialize.h"
#include "netbase.h"
#include <string>
#include "uint256.h"
extern bool fTestNet;
static inline unsigned short GetDefaultPort(const bool testnet = fTestNet)
{
return testnet ? 19131 : 9131;
}
extern unsigned char pchMessageStart[4];
/** Message header.
* (4) message start.
* (12) command.
* (4) size.
* (4) checksum.
*/
class CMessageHeader
{
public:
CMessageHeader();
CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn);
std::string GetCommand() const;
bool IsValid() const;
IMPLEMENT_SERIALIZE
(
READWRITE(FLATDATA(pchMessageStart));
READWRITE(FLATDATA(pchCommand));
READWRITE(nMessageSize);
READWRITE(nChecksum);
)
// TODO: make private (improves encapsulation)
public:
enum {
MESSAGE_START_SIZE=sizeof(::pchMessageStart),
COMMAND_SIZE=12,
MESSAGE_SIZE_SIZE=sizeof(int),
CHECKSUM_SIZE=sizeof(int),
MESSAGE_SIZE_OFFSET=MESSAGE_START_SIZE+COMMAND_SIZE,
CHECKSUM_OFFSET=MESSAGE_SIZE_OFFSET+MESSAGE_SIZE_SIZE
};
char pchMessageStart[MESSAGE_START_SIZE];
char pchCommand[COMMAND_SIZE];
unsigned int nMessageSize;
unsigned int nChecksum;
};
/** nServices flags */
enum
{
NODE_NETWORK = (1 << 0),
};
/** A CService with information about it as peer */
class CAddress : public CService
{
public:
CAddress();
explicit CAddress(CService ipIn, uint64 nServicesIn=NODE_NETWORK);
void Init();
IMPLEMENT_SERIALIZE
(
CAddress* pthis = const_cast<CAddress*>(this);
CService* pip = (CService*)pthis;
if (fRead)
pthis->Init();
if (nType & SER_DISK)
READWRITE(nVersion);
if ((nType & SER_DISK) ||
(nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH)))
READWRITE(nTime);
READWRITE(nServices);
READWRITE(*pip);
)
void print() const;
// TODO: make private (improves encapsulation)
public:
uint64 nServices;
// disk and network only
unsigned int nTime;
// memory only
int64 nLastTry;
};
/** inv message data */
class CInv
{
public:
CInv();
CInv(int typeIn, const uint256& hashIn);
CInv(const std::string& strType, const uint256& hashIn);
IMPLEMENT_SERIALIZE
(
READWRITE(type);
READWRITE(hash);
)
friend bool operator<(const CInv& a, const CInv& b);
bool IsKnownType() const;
const char* GetCommand() const;
std::string ToString() const;
void print() const;
// TODO: make private (improves encapsulation)
public:
int type;
uint256 hash;
};
#endif // __INCLUDED_PROTOCOL_H__
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_connect_socket_popen_53c.c
Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml
Template File: sources-sink-53c.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Fixed string
* Sink: popen
* BadSink : Execute command in data using popen()
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define FULL_COMMAND "%WINDIR%\\system32\\cmd.exe /c dir "
#else
#include <unistd.h>
#define FULL_COMMAND "/bin/sh ls -la "
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* NOT _WIN32 */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define IP_ADDRESS "127.0.0.1"
/* define POPEN as _popen on Windows and popen otherwise */
#ifdef _WIN32
#define POPEN _popen
#define PCLOSE _pclose
#else /* NOT _WIN32 */
#define POPEN popen
#define PCLOSE pclose
#endif
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__char_connect_socket_popen_53d_badSink(char * data);
void CWE78_OS_Command_Injection__char_connect_socket_popen_53c_badSink(char * data)
{
CWE78_OS_Command_Injection__char_connect_socket_popen_53d_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE78_OS_Command_Injection__char_connect_socket_popen_53d_goodG2BSink(char * data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__char_connect_socket_popen_53c_goodG2BSink(char * data)
{
CWE78_OS_Command_Injection__char_connect_socket_popen_53d_goodG2BSink(data);
}
#endif /* OMITGOOD */
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "WXPBGeneratedMessage.h"
@class BaseResponse, CmdList, SKBuiltinBuffer_t;
@interface SnsSyncResponse : WXPBGeneratedMessage
{
}
+ (void)initialize;
// Remaining properties
@property(retain, nonatomic) BaseResponse *baseResponse; // @dynamic baseResponse;
@property(retain, nonatomic) CmdList *cmdList; // @dynamic cmdList;
@property(nonatomic) unsigned int continueFlag; // @dynamic continueFlag;
@property(retain, nonatomic) SKBuiltinBuffer_t *keyBuf; // @dynamic keyBuf;
@end
|
#ifndef COLOR_SENSOR_TCS34725_H
#define COLOR_SENSOR_TCS34725_H
#include "colorSensor.h"
#include "tcs34725.h"
#include "../../../common/color/color.h"
/**
* Init the Tcs34725 as a color Sensor Structure (POO Management)
* @param colorSensor
* @param pColor
*/
void initColorSensorTcs34725(ColorSensor* colorSensor,
Color* color,
colorSensorFindColorTypeFunction* colorSensorFindColorType,
Tcs34725* tcs34725);
#endif
|
#ifndef _LR_PASTE_SYMBOL_OP_H_
#define _LR_PASTE_SYMBOL_OP_H_
#include <ee/PasteSymbolOP.h>
namespace ee { class PropertySettingPanel; }
namespace lr
{
class StagePanel;
class PasteSymbolOP : public ee::PasteSymbolOP
{
public:
PasteSymbolOP(StagePanel* stage, ee::LibraryPanel* library,
ee::PropertySettingPanel* property);
private:
void ChangeCurrOP();
private:
ee::PropertySettingPanel* m_property;
}; // PasteSymbolOP
}
#endif // _LR_PASTE_SYMBOL_OP_H_ |
#include <stdio.h>
#include <stdint.h>
#include <avr/io.h>
#include <stdlib.h>
#include <stdlib.h>
#include <util/delay.h>
#include <avr/cpufunc.h>
#include <avr/pgmspace.h>
#include <avr/interrupt.h>
#include "../../lib/spi/spi.h"
#include "../../lib/aes/aes.h"
#include "../../lib/radio_control/radioctl.h"
#define ADC_PRESCALER 0
#define CPU_PRESCALE(n) (CLKPR = 0x80, CLKPR = (n))
#define DATAGRAM 2
#define PROTOCOL_LENGTH 7
#define PACKET_SIZE 32
#define KEY_SIZE 8
#define HEX 1
//#define STRING 1
static void initUART(void);
static void uart_putbyte(char data);
static void uart_putdata(char * data);
static void uart_flush(void);
static char hex_to_ascii(uint8_t data);
static void print_hex(uint8_t *data, uint8_t size);
static void AES_decrypt(uint8_t * payload);
int8_t check_payload(uint8_t * buf);
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.