text stringlengths 4 6.14k |
|---|
// Generated by the gRPC C++ plugin.
// If you make any local change, they will be lost.
// source: tensorflow_serving/apis/inference.proto
// Original file comments:
// This file contains messages for various machine learning inferences
// such as regression and classification.
//
// In many applications more than one type of inference is desired for a single
// input. For example, given meteorologic data an application may want to
// perform a classification to determine if we should expect rain, snow or sun
// and also perform a regression to predict the temperature.
// Sharing the single input data between two inference tasks can be accomplished
// using MultiInferenceRequest and MultiInferenceResponse.
//
#ifndef GRPC_tensorflow_5fserving_2fapis_2finference_2eproto__INCLUDED
#define GRPC_tensorflow_5fserving_2fapis_2finference_2eproto__INCLUDED
#include "tensorflow_serving/apis/inference.pb.h"
#include <grpc++/impl/codegen/async_stream.h>
#include <grpc++/impl/codegen/async_unary_call.h>
#include <grpc++/impl/codegen/method_handler_impl.h>
#include <grpc++/impl/codegen/proto_utils.h>
#include <grpc++/impl/codegen/rpc_method.h>
#include <grpc++/impl/codegen/service_type.h>
#include <grpc++/impl/codegen/status.h>
#include <grpc++/impl/codegen/stub_options.h>
#include <grpc++/impl/codegen/sync_stream.h>
namespace grpc {
class CompletionQueue;
class Channel;
class RpcService;
class ServerCompletionQueue;
class ServerContext;
} // namespace grpc
namespace tensorflow {
namespace serving {
} // namespace serving
} // namespace tensorflow
#endif // GRPC_tensorflow_5fserving_2fapis_2finference_2eproto__INCLUDED
|
//
// LayoutTestLayer.h
// CALayer
//
// Created by pantosoft on 2018/1/24.
// Copyright © 2018年 jianghongbing. All rights reserved.
//
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
@interface LayoutTestLayer : CALayer
@end
|
/*
* cat/dynbuf.h -- A generic resizeable byte buffer;
*
* by Christopher Adam Telfer
*
* Copyright 2012, See accompanying license
*
*/
#ifndef __cat_buffer_h
#define __cat_buffer_h
#include <cat/cat.h>
#include <cat/mem.h>
struct dynbuf {
ulong size;
byte_t * data;
ulong off;
ulong len;
struct memmgr * mm;
};
#define dyb_last(b) ((b)->off + (b)->len)
/* all of the below functions will return a -1 if the offset/length */
/* parameters will cause an overflow of ulong */
/* initialize a fresh dynbuf */
void dyb_init(struct dynbuf *b, struct memmgr *mm);
/* ensure that the buffer has at least sz bytes */
/* if not, try to allocate it. Return 0 on success and */
/* -1 if unable to allocate the space. */
int dyb_resv(struct dynbuf *b, ulong sz);
/* free the memory associated with a dynbuf and re-initialize */
void dyb_clear(struct dynbuf *b);
/* re-initialize the dynamic buffer and return the memory it held */
void *dyb_release(struct dynbuf *b);
/* reset offset and length pointers for a buffer but keep memory */
void dyb_empty(struct dynbuf *b);
/* concatenate 'len' bytes from 'p' to 'b'. Return 0 on success or */
/* -1 if not enough space. */
int dyb_cat(struct dynbuf *b, void *p, ulong len);
/* concatenate 'len' bytes from 'p' to 'b'. If 'b' lacks space, try */
/* to allocate it. Return 0 on success and -1 on failure. */
int dyb_cat_a(struct dynbuf *b, void *p, ulong len);
/* Set the data in the buffer to 'len' bytes of data starting at 'off' */
/* bytes from the start of the dynbuf. Copy the data from 'p'. Returns 0 */
/* on success, and -1 if not enough space. */
int dyb_set(struct dynbuf *b, ulong off, void *p, ulong len);
/* Set the data in the buffer to 'len' bytes of data starting at 'off' */
/* bytes from the start of the dynbuf. Copy the data from 'p'. If 'b' lacks */
/* the space, try to allocate it. Return 0 on success and -1 on failure */
int dyb_set_a(struct dynbuf *b, ulong off, void *p, ulong len);
/* copy the 'sb' into 'db'. Returns 0 on success, or -1 if unable to */
/* allocate the necessary space in 'db'. Offsets are preserved and */
/* the 'db' is sized to at least 'sb->size' */
int dyb_copy(struct dynbuf *db, struct dynbuf *sb);
#endif /* __cat_dynbuf_h */
|
//
// NLDataModel+__InternalDataDefines.h
// NLDB
//
// Created by hejunqiu on 2017/4/3.
// Copyright © 2017年 CHE. All rights reserved.
//
#import "NLDataModel.h"
NS_ASSUME_NONNULL_BEGIN
@class NLDBHandler;
@interface NLDataModel (__InternalDataDefines)
@property (nonatomic, strong) NLDBHandler *databaseHanlder;
@property (nonatomic, strong) NSMutableDictionary *propertyDiffer;
@end
NS_ASSUME_NONNULL_END
|
#pragma once
namespace Geom
{
struct Rect
{
double l = 0.;
double t = 0.;
double w = 0.;
double h = 0.;
};
} // namespace Geom
|
#include "GlobalDef.h"
// Driver Includes
#include "Input.h"
#include "EEPROM.h"
#include "CAN.h"
#include "Led.h"
#include "Tach.h"
#include "Data.h"
#include "VSource.h"
#include "Relay.h"
// Utils Includes
#include "ModeSelection.h"
#include "Delay.h"
#include "ProgrammedModule.h"
#include "Periodic.h"
// App Includes
#if defined(DL_TL_FIRMWARE)
#include "ToyotaCAN2.h"
#include "ToyotaCAN_Database2.h"
#elif defined (TL1)
#include "TL1.h"
#include "TL1_Database.h"
#elif defined (TL2)
#include "TL2.h"
#include "TL2_Database.h"
#include "ToyotaUART.h"
#include "ToyotaUART_Database.h"
#endif
#include "ToyotaCAN_Txct.h"
#include "TL1_KeyImmo.h"
#include "ToyotaCommon.h"
#include "TIRFID.h"
#if defined (TL_BEANCAN)
#include "ToyotaBean.h"
#endif
// Toyota Uart
extern volatile Uint8 RS_CMD_Data[5]; // Data to write on the bus
extern volatile Uint8 Car_Info_Data[11]; // Data to read from the bus
extern volatile Uint8 TLPlatform;
// Toyota CAN
extern Uint8 H680_Data[8];
extern Uint8 H680_Chg;
static volatile Uint8 TPBypass=YES;
static volatile Uint8 ShutDownSource=0;
static volatile Uint8 CheckForHoldLockCount=0;
extern volatile Uint8 VehicleName;
// used for remote start with OEM remote
extern volatile Uint8 StartFlag;
extern volatile Uint8 CheckForHoldLock;
extern volatile Uint8 LockCount;
void ToyotaCAN_TXCT_Learn(void)
{
// Force reversed logic on TXCT
VSource_SetTransponderVoltage5V();
TXCTMode=TXCT_MODE_REVERSED;
if(ProgrammedModule_Check()==NO)
{
// Check for immo and learn
if(TL1_KeyImmo_Learn()==SUCCESS)
{
ProgrammedModule_Save();
// Immo = YES
TPBypass=YES;
EEPROM_Write(PROGRAM_MEMORY_TP_BYPASS_PTR,TPBypass);
}
else
{
ProgrammedModule_Save();
// Immo = NO
TPBypass=NO;
EEPROM_Write(PROGRAM_MEMORY_TP_BYPASS_PTR,TPBypass);
}
}
else
{
// Read immo info
TPBypass=EEPROM_Read(PROGRAM_MEMORY_TP_BYPASS_PTR);
VehicleName = EEPROM_Read(PLATFORM_VEHICULE_NAME_PTR);
}
}
void ToyotaCAN_TXCT_GWR_ON(void)
{
VehicleName = EEPROM_Read(PLATFORM_VEHICULE_NAME_PTR);
#if defined (TL_BEANCAN)
//if(TLPlatform==PLATFORM_TOYOTA_RX2005_KEY)
{
// For keysense: (RX2005 solve telescopic steering wheel problem)
Relay_SetState(ON);
Start_Periodic_Bean_Frame_DuringRS();
}
#endif
/////////////////////////////////////////////
// Bypass Immo
/////////////////////////////////////////////
#if defined (TL1)
if(TLPlatform==PLATFORM_TOYOTA_TL1_KEY)
{
// Load Structure from EEPROM
TIRFID_LoadDSTEE();
// Generate key in DSTEE because not saved in EEPROM (module hacking protection)
ToyotaNew_FindCryptkey();
}
#endif
#if defined (TL_BEANCAN)
if(TLPlatform==PLATFORM_TOYOTA_RX2005_KEY
|| TLPlatform==PLATFORM_TOYOTA_AVALON_KEY)
{
// Load Structure from EEPROM
TIRFID_LoadDSTEE();
// Generate key in DSTEE because not saved in EEPROM (module hacking protection)
ToyotaNew_FindCryptkey();
}
#endif
/////////////////////////////////////////////
// Start Keyless for TL1(CAN) and TL2(UART)
/////////////////////////////////////////////
// Toyota CAMRY NON-PUSH (TXCT/CODE) platform
#if defined (TL1)
if(TLPlatform==PLATFORM_TOYOTA_TL1_KEY)
{
// Put keyless ON
Toyota_H680_SetState(Toyota_H680_KeylessOn);
Toyota_H680_Update();
}
#endif
// Toyota VENZA NON-PUSH (TXCT/CODE) platform
#if defined (TL2)
// Wait an empty buffer
/* if(ToyotaUART_WaitBuffer(100))
goto Retry;
Retry:
Toyota_RS_UART_Reset_All();
ToyotaUART_ByteSetState(Toyota_RS_UART_KeylessOn); // 3C 2X XX XX XX CS
ToyotaUART_ByteSetState(Toyota_RS_UART_LockOn);
ToyotaUART_WriteTxBuffer((Uint8 *)RS_CMD_Data);
// Wait an empty buffer
if(ToyotaUART_WaitBuffer(100))
goto Retry;
ToyotaUART_ByteSetState(Toyota_RS_UART_LockOff);
*/ #endif
}
// Stop Keyless for TL1(CAN) and TL2(UART)
void ToyotaCAN_TXCT_GWR_OFF(void)
{
#if defined (TL1)
if(TLPlatform==PLATFORM_TOYOTA_TL1_KEY)
{
Toyota_H680_SetState(Toyota_H680_KeylessOff);
Toyota_H680_Update();
}
#endif
#if defined (TL2)
/* if(TLPlatform==PLATFORM_TOYOTA_VENZA_KEY)
{
Toyota_RS_UART_Reset_All();
for(i=0;i<10;i++)
{
// Wait an empty buffer (135ms max)
if(ToyotaUART_WaitBuffer(50))
continue;
ToyotaUART_WriteTxBuffer((Uint8 *)RS_CMD_Data);
}
EngineStarted=NO;
ToyotaUART_Disable();
}
*/ #endif
#if defined (TL_BEANCAN)
//if(TLPlatform==PLATFORM_TOYOTA_RX2005_KEY)
{
// For keysense: (RX2005 solve telescopic steering wheel problem)
Relay_SetState(OFF);
Stop_Periodic_Bean_Frame_DuringRS();
}
#endif
}
void Toyota_TXCT_CAN_RS(void)
{
#if defined (TL1)
if(TLPlatform==PLATFORM_TOYOTA_TL1_KEY)
{
// Check for immo
if(TPBypass==YES)
TL1_KeyImmo_GWR();
}
#endif
#if defined (TL_BEANCAN)
if(TLPlatform==PLATFORM_TOYOTA_RX2005_KEY
|| TLPlatform==PLATFORM_TOYOTA_AVALON_KEY)
{
// Check for immo
if(TPBypass==YES)
TL1_KeyImmo_GWR();
}
Periodic_Bean_Frame_DuringRS();
#endif
}
|
#include <stdlib.h>
#include <stdio.h>
#include <malloc.h>
#include <string.h>
#include <sys/time.h>
#include <math.h>
#define NODES_IN_LEVEL 20
#define NODES_PER_LEVEL_INIT 100
#define NODES_PER_LEVEL_STEP 100
#define SKIPLIST_DATA_FILE "data.dat"
#define SKIPLIST_NODES_FILE "nodes.node"
enum SkipListNodeType {
NODE_MIN,
NODE_MAX,
NODE_NORMAL
};
enum SkipListNodeDataType {
TypeString,
TypeInt,
};
struct SkipListNode {
enum SkipListNodeType type;
struct SkipListNode *next;
struct SkipListNode *down;
unsigned char *key;
long data;
short deleted;
};
struct SkipListNodeStore {
long data;
short deleted;
short len;
};
struct SkipList {
int height;
int count;
struct SkipListNode *head;
struct SkipListNode *top;
FILE *dataFile;
FILE *StoreNode;
};
struct SkipList *skipList_new();
struct SkipListNode *skipListNode_new(struct SkipList *, unsigned char *, void *);
struct SkipListNode *skipListSpecialNode_new(enum SkipListNodeType);
void skipListNode_insert(struct SkipList *, unsigned char *, void *);
struct SkipListNode *skipListNode_findNode(struct SkipList *, unsigned char *,short);
void *skipListNode_find(struct SkipList *, unsigned char *);
void skipList_free(struct SkipList *);
void SkipListNode_free(struct SkipListNode *);
int SkipList_level(struct SkipList *);
void SkipList_print(struct SkipList *);
long skipListStoreNode_new(struct SkipList *, unsigned char *, long);
long writeNodeToFile(FILE*, struct SkipListNodeStore *, char *);
struct SkipListNodeStore *readNodeFromFile(FILE *, long *, char **);
char *readNodeData(FILE *, long);
void saveNodesToFile(struct SkipList *);
struct SkipListNode *skipListNodeReverse_new(struct SkipList *, unsigned char *, long);
void skipListNodeReverse_insert(struct SkipList *, unsigned char *, long);
void reverseNodesFromFile(struct SkipList *);
typedef void (*skipList_callback)(unsigned char *, unsigned char *, void *);
int skipList_range(struct SkipList *, unsigned char *, unsigned char *, skipList_callback, void *);
int skipList_findn(struct SkipList *, unsigned char *, int, skipList_callback, void *);
long addToDataFile(struct SkipList *, void *) ;
void skipListNode_del(struct SkipList *, unsigned char *); |
//
// BXTextLanguage.h
// RegexForAccordance
//
// Created by Darin Franklin on 8/6/14.
// Copyright (c) 2014 Darin Franklin. All rights reserved.
//
#import <Foundation/Foundation.h>
#define ZWSP "\u200B" // ZERO-WIDTH SPACE
#define NBSP "\u00A0" // NO-BREAK SPACE
#define LRE "\u202A" // LEFT-TO-RIGHT EMBEDDING
#define RLE "\u202B" // RIGHT-TO-LEFT EMBEDDING
#define PDF "\u202C" // POP DIRECTIONAL FORMATTING
#define LRO "\u202D" // LEFT-TO-RIGHT OVERRIDE
#define RLO "\u202E" // RIGHT-TO-LEFT OVERRIDE
#define LRM "\u200E" // LEFT-TO-RIGHT MARK
#define RLM "\u200F" // RIGHT-TO-LEFT MARK
#define HEB_CANTIL "\\u0591-\\u05AF"
#define HEB_POINTS "\\u05B0-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C7" // SHIN DOT U+05C1; SIN DOT U+05C2
#define HEB_PUNCTS "\\u05BE\\u05C0\\u05C3-\\u05C6"
#define HEB_LETTERS "\\u05D0-\\u05EA"
#define GRK_DIACRITICS "\\u0300-\\u0344\u0346-\\u036F" // U+0345 is iota subscript, which regex matches to iota U+03B9
#define GRK_PUNCTS ".,;·᾿«»_\\u002D\\u2014" // U+2014 EM DASH; U+002D -
#define GRK_LETTERS "\\u0391-\\u03C9"
#define SCRIPT_TAG_HEBREW "Hebr"
#define SCRIPT_TAG_GREEK "Grek"
#define SCRIPT_TAG_LATIN "Latn"
@interface BXTextLanguage : NSObject
/* Script Tag is a four-character code that identifies the language: Hebr, Grek, Latn */
- (NSString *)scriptTagForString:(NSString *)text;
- (NSWritingDirection)writingDirectionForString:(NSString *)text;
- (NSWritingDirection)writingDirectionForLanguageScriptTag:(NSString *)script;
+ (NSCharacterSet *)hebrewCantillationCharacterSet;
+ (NSCharacterSet *)hebrewPointsCharacterSet;
+ (NSCharacterSet *)hebrewPunctuationCharacterSet;
+ (NSCharacterSet *)greekDiacriticsCharacterSet;
+ (NSCharacterSet *)greekPunctuationCharacterSet;
@end
|
//
// libembryo
//
// Copyright Stanley Cen 2013
// Released under the MIT License
//
#ifndef libembryo_sigscan_h
#define libembryo_sigscan_h
#include <libembryo/signature.h>
#include <libembryo/module.h>
namespace embryo
{
class sigscan
{
public:
sigscan(signature sig, module &mod);
sigscan(signature sig, void *start, unsigned int size);
void *find();
private:
bool ran;
void *result;
signature m_sig;
void *start;
unsigned int size;
};
}
#endif |
namespace liblogger
{
class LogFilterContains : public ILogFilter
{
public:
LogFilterContains(const std::string &str, bool matchcase = false);
~LogFilterContains();
virtual bool Filter(const LogType Type, const std::string &str);
private:
std::string m_match;
bool m_case;
};
};
|
//
// PDProtoFile.h
// proto-dump
//
// Copyright (c) 2013 Sean Patrick O'Brien. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface PDProtoFile : NSObject
// The file's path.
@property(readonly) NSString *path;
// The file's source code.
@property(readonly) NSString *source;
@end
|
//
// KAAppDelegate.h
// KAChartViewMac
//
// Created by Kenneth Parker Ackerson on 1/12/14.
// Copyright (c) 2014 Kenneth Parker Ackerson. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "KAChartView.h"
@interface KAAppDelegate : NSObject <NSApplicationDelegate>
@property (assign) IBOutlet NSWindow *window;
@end
|
#ifndef uFormatH
#define uFormatH
#include <vcl.h>
#include <list>
#include <set>
#include "uStack.h"
#include "uMark.h"
namespace SHEdit
{
class Buffer;
class Mark;
class IMark;
class Format;
//---------------------------------------------------------------------------
/*!
* FontStyle
* ---------
* FontStyle represents how font should look like. It does not neccessarily specify all properties of font - just those that are supposed to be changed - null/empty values are properties that are supposed to remain formatted according to lower priority markup (i.e. as syntax highlight).
*
* For more information on formatting see \ref index and Format class documentation.
* */
class FontStyle
{
public:
FontStyle();
FontStyle(TColor * foreground, TColor * background, TFontStyles style);
FontStyle(TColor * foreground, TColor * background);
FontStyle(TColor * foreground);
TColor * foreground;
TColor * background;
TFontStyles style;
bool operator==(const FontStyle& f);
bool operator!=(const FontStyle& f);
FontStyle& operator+=(const FontStyle& f);
FontStyle& operator+=(const Format& f);
FontStyle& operator=(const FontStyle& f);
FontStyle& operator=(const Format& f);
};
//---------------------------------------------------------------------------
/*!
* Fonts, text formatting, markup system
* =====================================
* The basic thing to notice is:
* - FontStyle represents how a font should be formatted.
* - Format represents how the buffer is formatted using its FontStyle.
*
* That means that while Format inherits FontStyle, FontStyle class is used just to pass information while Format is used to represent it.
*
* Format
* ------
* Formats are applied to buffer using Iter's methods to start and end a position where markup should be applied. Those methods do place markup where it is required, but besides that it also registers all marks within their Format class, which allows to clear all markup easily at once. As mentioned at \ref index there are 2 different markup systems. For details about them see Mark and IMark classes (those represent buffer positions where markup starts and where it ends).
* */
class Format : public FontStyle
{
private:
std::list< Stack<Mark >::Node* > marks;
std::set<IPos*, IMark::compare> imarks; //Actually stores IMark pointers casted to pos for comparison
public:
friend class Iter;
Format();
Format(TColor * foreground, TColor * background);
Format(TColor * foreground, TColor * background, TFontStyles style);
~Format();
void Remove(Stack<Mark>::Node * mark);
void Add(Stack<Mark>::Node * mark);
void RemoveIM(IMark * mark);
void AddIM(IMark * mark);
void RemoveAllMarks();
bool operator==(const Format& f);
bool operator!=(const Format& f);
Format& operator+=(const Format& f);
Format& operator=(const Format& f);
IMark * GetMarkBefore(IPos * ipos);
};
}
//---------------------------------------------------------------------------
#endif
|
/*=========================================================================
Program: Visualization Toolkit
Module: vtkPProbeFilter.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME vtkPProbeFilter - probe dataset in parallel
// .SECTION Description
#ifndef vtkPProbeFilter_h
#define vtkPProbeFilter_h
#include "vtkFiltersParallelModule.h" // For export macro
#include "vtkCompositeDataProbeFilter.h"
class vtkMultiProcessController;
class VTKFILTERSPARALLEL_EXPORT vtkPProbeFilter : public vtkCompositeDataProbeFilter
{
public:
vtkTypeMacro(vtkPProbeFilter,vtkCompositeDataProbeFilter);
void PrintSelf(ostream& os, vtkIndent indent);
static vtkPProbeFilter *New();
// Description:
// Set and get the controller.
virtual void SetController(vtkMultiProcessController*);
vtkGetObjectMacro(Controller, vtkMultiProcessController);
//BTX
protected:
vtkPProbeFilter();
~vtkPProbeFilter();
enum
{
PROBE_COMMUNICATION_TAG=1970
};
// Usual data generation method
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int RequestUpdateExtent(vtkInformation *, vtkInformationVector **, vtkInformationVector *);
virtual int FillInputPortInformation(int port, vtkInformation *info);
vtkMultiProcessController* Controller;
private:
vtkPProbeFilter(const vtkPProbeFilter&); // Not implemented.
void operator=(const vtkPProbeFilter&); // Not implemented.
//ETX
};
#endif
|
#ifndef DEFINES_H
#define DEFINES_H
/*
É preciso definir aqui a seguinte macro para escolher o tipo de compilação:
compativel com POSIX: #define _POSIX_C_VERSION 199309L (199309 e a primeira versao do posix que define o nanosleep)
C11 ou superior: #define _ISOC11_SOURCE 1
outro: nao definir nada
Quando pomos o gcc em modo ansi ele deixa de incluir as bibliotecas POSIX.
Para pedir-lhe para incluir as bibliotecas utilizamos o define _POSIX_C_SOURCE com o valor de POSIX mais baixo que suporta nanosleep
Precisamos do nanosleep, pois o c89 nao tem funcoes que permitam a aplicacao guardar informacao sobre o tempo com precisao superior a segundos
e ao mesmo tempo fazer 'sleep'. Como tal, incluimos as header do POSIX e compilamos com linkagem da biblioteca librt.so, incluido por definicao na pseudo-package ubuntu-minimal, incluida em todos os sistemas baseados no ubuntu (pelo menos) desde a versao 10.04(iex: xubuntu)
Para alem disso, a funcao usleep() foi deprecada com o POSIX-2001 (o nanosleep faz o mesmo e tem maior precisao)
*/
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L
#endif
#undef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 199309L
#include <stdio.h>
#include <errno.h>
#define FILE_HEADLINE "tempo [s] x [m] z [m] vx [m] vz [m] atitude [graus] fuel [kg]\n"
/*
Funcoes do preprocessador uteis:
*/
/*Teste de memoria*/
#define TESTMEM(s) if (s == NULL) {\
fprintf(stderr, "(3x23) Erro detetado: Memory Access Error!");\
exit(ENOMEM);\
}
/*General math functions*/
#define max(a,b) ((a) >= (b) ? (a) : (b))
#define min(a,b) ((a) <= (b) ? (a) : (b))
#define distsq(a,b) (((a[0])-(b[0]))*((a[0])-(b[0]))+((a[1])-(b[1]))*((a[1])-(b[1])))
#define fast_abs(a) ((a) > 0 ? (a) : -(a))
#define angle(a,b) atan2(((b[1])-(a[1])),((b[0])-(a[0])))
/*definicao para transformar coisas do preprocessador em strings*/
#define TOSTRING(s) #s
#define PRETOSTRING(s) TOSTRING(s)
/*Definição para comparar doubles:*/
#define SIGMA 0.0000001
/*Definicoes de fisica e matematica */
/*Maxima coordenada em qualquer eixo*/
#define MAX_COORD 10000000
#define LIGHT_SPEED 300000000
#define AUX_LINES_ZOOM 30
/*Constantes de aterragem */
/*5 graus: */
#define MAXROT 0.0872664626
#define LAND_MAXVZ 0.1
#define LAND_MAXVX 0.05
/*Bitmasks partilhadas por diversos ficheiros*/
/* Bitmasks para verificar se a spaceship ja foi inicializada*/
#define INIT_SPACESHIP 1
#define INIT_SURFACE 2
#define INIT_LANDING 4
/* Bitmasks para controlar o modo de jogo*/
#define MODE_COCKPIT 1
#define MODE_GRAPHIC 2
/* FONTS SIZES */
#define PLANNER_FONT_SIZE 12
/* Nomes de ficheiros para input/output */
#define FILENAME_MOON "superficieLunar.txt"
#define FILENAME_DATA "vooLunarCorrente.txt"
#define FILE_MOON_HEADLINE "Nome X Z\n"
#endif
|
//
// ZZiOSVersion.h
// iOSVersionManager
//
// Created by liuweizhen on 2017/11/11.
// Copyright © 2017年 liuxing8807@126.com. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface ZZiOSVersion : NSObject
/**
版本判断
使用方法:
if (ZZiOSVersion.versionAvailable(__IPHONE_7_0)) {
...
}
*/
+ (BOOL (^)(NSInteger))versionAvailable;
@end
|
#pragma once
#include "Vec4.h"
typedef vec4 color;
namespace Color
{
// inline color RandColor( bool withAlpha = false ){ return color( random_f(),
// random_f(), random_f(), (withAlpha)? random_f() : 1.0f ); }
static color blend( color& c1, color& c2, float alpha )
{
return ( c1 * ( 1.0f - alpha ) + ( c2 * alpha ) );
}
static color CLEAR( 1, 1, 1, 0 );
// grayscale
static color WHITE( 1, 1, 1, 1 );
static color GRAY_75( .75f, .75f, .75f, 1 );
static color GRAY( .5f, .5f, .5f, 1 );
static color GRAY_50( .5f, .5f, .5f, 1 );
static color GREY( .5f, .5f, .5f, 1 );
static color GRAY_25( .25f, .25f, .25f, 1 );
static color GRAY_10( .1f, .1f, .1f, 1 );
static color BLACK( 0, 0, 0, 1 );
// ROYGBIV, light-to-dark
static color RED( 1, 0, 0, 1 );
static color DARK_RED( 0.5f, 0, 0, 1 );
static color RED_ORANGE( 1, .3f, .1f, 1 );
static color ORANGE( 1, .5f, 0, 1 );
static color LIGHT_ORANGE( 1, .8f, .5f, 1 );
static color ORANGE_YELLOW( 1, .75f, 0, 1 );
static color YELLOW_ORANGE( 1, .75f, 0, 1 );
static color YELLOW( 1, 1, 0, 1 );
static color YELLOW_GREEN( .7f, 1, .2f, 1 );
static color GREEN( 0, 1, 0, 1 );
static color BLUE_GREEN( 0, 1, 1, 1 );
static color LIGHT_BLUE( .5, .5, 1, 1 );
static color BLUE( 0, 0, 1, 1 );
static color PURPLE( 1, 0, 1, 1 );
static color VIOLET( 1, 0, 1, 1 );
}
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <alloca.h>
int main(int argc, char **argv) {
size_t i=5000;
if(argc != 4) {
printf("call as: eatmem <stacksize(Kb)> <heapsize(Kb)> <period(sec)>\n");
exit(1);
}
int stacksize = atoi(argv[1]);
int heapsize = atoi(argv[2]);
int period = atoi(argv[3]);
if(stacksize==0 || heapsize==0 || period==0) {
printf("error in stacksize, heapsize or period\n");
exit(2);
}
printf("Starting with: stacksize=%d, heapsize=%d, period=%d\n", stacksize, heapsize, period);
int stackstep = stacksize / period;
int heapstep = stacksize / period;
int stackcur = 0;
int heapcur = 0;
int curperiod = 0;
char * buf;
for(curperiod=0; curperiod < period; curperiod++) {
buf = (char *) malloc(stackstep*1024);
if(buf == NULL) {
printf("no malloc buf");
exit(3);
}
buf = (char *) alloca(heapstep*1024);
if(buf == NULL) {
printf("no alloca buf");
exit(4);
}
sleep(1);
}
return 0;
}
|
/*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2020 Scientific Computing and Imaging Institute,
University of Utah.
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 CORE_ALGORITHMS_FIELDS_FILTERFIELDDATA_ERODEFILTER_H
#define CORE_ALGORITHMS_FIELDS_FILTERFIELDDATA_ERODEFILTER_H 1
// Datatypes that the algorithm uses
#include <Core/Datatypes/Mesh.h>
#include <Core/Datatypes/Field.h>
// Base class for algorithm
#include <Core/Algorithms/Util/AlgoBase.h>
// for Windows support
#include <Core/Algorithms/Fields/share.h>
namespace SCIRunAlgo {
using namespace SCIRun;
class SCISHARE ErodeFieldDataAlgo : public AlgoBase
{
public:
/// Set defaults
ErodeFieldDataAlgo()
{
/// Number of iterations to perform
add_int("num_iterations",2);
}
/// run the algorithm
bool run(FieldHandle input, FieldHandle& output);
};
} // end namespace SCIRunAlgo
#endif
|
/*
* 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.h"
#import "XPCClientDelegate-Protocol.h"
@class NSObject<OS_dispatch_queue>, XPCClient;
@interface WPZoneTracker : NSObject <XPCClientDelegate>
{
_Bool _wantEntry;
_Bool _wantExit;
long long _state;
XPCClient *_connection;
id <WPZoneTrackerDelegate> _delegate;
NSObject<OS_dispatch_queue> *_queue;
}
@property(retain) NSObject<OS_dispatch_queue> *queue; // @synthesize queue=_queue;
@property(nonatomic) _Bool wantExit; // @synthesize wantExit=_wantExit;
@property(nonatomic) _Bool wantEntry; // @synthesize wantEntry=_wantEntry;
@property(nonatomic) __weak id <WPZoneTrackerDelegate> delegate; // @synthesize delegate=_delegate;
@property(retain, nonatomic) XPCClient *connection; // @synthesize connection=_connection;
@property long long state; // @synthesize state=_state;
- (void).cxx_destruct;
- (void)changeState:(long long)arg1;
- (void)messageArrived:(id)arg1;
- (void)connectionInterrupted;
- (void)connectionDied;
- (void)registerZonesFailed:(id)arg1;
- (void)zonesExited:(id)arg1;
- (void)zonesEntered:(id)arg1;
- (void)getCurrentTrackedZones;
- (void)unregisterAllZoneChanges;
- (void)unregisterForZoneChanges:(id)arg1;
- (void)registerForZoneChangesMatching:(id)arg1;
- (id)description;
- (void)dealloc;
- (id)initWithDelegate:(id)arg1;
- (id)initWithDelegate:(id)arg1 queue:(id)arg2;
@end
|
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
FOUNDATION_EXPORT double Pods_Example1VersionNumber;
FOUNDATION_EXPORT const unsigned char Pods_Example1VersionString[];
|
#ifndef ____COR_COCOS2DX_MRUBY_INTERFACE_SOURCES_COCOS_VALUE_H_
#define ____COR_COCOS2DX_MRUBY_INTERFACE_SOURCES_COCOS_VALUE_H_
#include "cor_type/sources/basic_types.h"
#include "cor_mruby_interface/sources/mruby_state.h"
#include "base/CCValue.h"
namespace cor
{
namespace cocos2dx_mruby_interface
{
struct CocosValueItnl;
class CocosValue
{
std::unique_ptr<CocosValueItnl> itnl;
public:
static MrubyRef convert_from_cocos_value();
static MrubyRef convert_from_cocos_value(const cocos2d::Value& v);
static MrubyRef convert_from_cocos_value_vec(const cocos2d::ValueVector& v);
static MrubyRef convert_from_cocos_value_map(const cocos2d::ValueMap& v);
static cocos2d::Value convert_to_cocos_value(const MrubyRef& v);
static cocos2d::ValueVector convert_to_cocos_value_vec(const MrubyRef& v);
static cocos2d::ValueMap convert_to_cocos_value_map(const MrubyRef& v);
CocosValue();
virtual ~CocosValue();
};
}
}
#endif
|
// Copyright (c) 2015 fjz13. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#pragma once
#include "MedusaCorePreDeclares.h"
#include "Core/String/HeapString.h"
#include "Core/Siren/Siren.h"
MEDUSA_BEGIN;
class Version
{
public:
struct Schema;
const static Version Zero;
public:
Version(uint major = 0, uint minor = 0, uint build = 0, uint revision = 0);
Version(const StringRef& versionString);
Version(const Version& val);
Version& operator=(const Version& val);
~Version(void);
int Compare(const Version& val)const;
bool operator==(const Version& val)const { return Compare(val) == 0; }
bool operator!=(const Version& val)const { return !operator==(val); }
bool operator>(const Version& val)const { return Compare(val) > 0; }
bool operator<(const Version& val)const { return Compare(val) < 0; }
bool operator>=(const Version& val)const { return Compare(val) >= 0; }
bool operator<=(const Version& val)const { return Compare(val) <= 0; }
intp HashCode()const { return mMajor^mMinor^mRevision^mBuild; }
HeapString ToString(uint fieldCount = 4)const;
public:
static Version ParseFrom(const StringRef& versionString);
static bool TryParse(const StringRef& versionString, Version& outVersion);
public:
uint Major() const { return mMajor; }
uint& MutableMajor() { return mMajor; }
void SetMajor(uint val) { mMajor = val; }
uint Minor() const { return mMinor; }
uint& MutableMinor() { return mMinor; }
void SetMinor(uint val) { mMinor = val; }
uint Revision() const { return mRevision; }
uint& MutableRevision() { return mRevision; }
void SetRevision(uint val) { mRevision = val; }
uint Build() const { return mBuild; }
uint& MutableBuild() { return mBuild; }
void SetBuild(uint val) { mBuild = val; }
protected:
uint mMajor;
uint mMinor;
uint mBuild;
uint mRevision;
};
struct Version::Schema
{
SIREN_FIELD(0, 0, Required, Version, uint, mMajor);
SIREN_FIELD(1, 1, Required, Version, uint, mMinor);
SIREN_FIELD(2, 2, Optional, Version, uint, mRevision);
SIREN_FIELD(3, 3, Optional, Version, uint, mBuild);
SIREN_FIELDS_4(void, Version);
};
MEDUSA_END;
|
// Copyright (c) 2016 Intel Corporation. All rights reserved.
// Use of this source code is governed by a MIT-style license that can be
// found in the LICENSE file.
#ifndef _POINTING_INFO_H_
#define _POINTING_INFO_H_
#include <node.h>
#include <v8.h>
#include <string>
#include "gen/generator_helper.h"
#include "gen/array_helper.h"
#include "pointing_data2d.h"
#include "pointing_data3d.h"
class PointingInfo {
public:
PointingInfo();
PointingInfo(const PointingInfo& rhs);
~PointingInfo();
PointingInfo& operator = (const PointingInfo& rhs);
public:
PointingData3D* get_worldPointingData() const {
return &this->worldPointingData_;
}
PointingData2D* get_colorPointingData() const {
return &this->colorPointingData_;
}
int32_t get_confidence() const {
return this->confidence_;
}
int32_t get_gestureStartTimeStamp() const {
return this->gestureStartTimeStamp_;
}
void SetJavaScriptThis(v8::Local<v8::Object> obj) {
// Ignore this if you don't need it
// Typical usage: emit an event on `obj`
}
private:
mutable PointingData3D worldPointingData_;
mutable PointingData2D colorPointingData_;
int32_t confidence_;
int32_t gestureStartTimeStamp_;
friend class PersonTrackerAdapter;
};
#endif // _POINTING_INFO_H_
|
//
// NSDictionary+OpenXmlString.h
// BRAXlsxReaderWriter
//
// Created by René BIGOT on 03/09/2014.
// Copyright (c) 2014 René Bigot. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (OpenXmlString)
- (NSString *)openXmlStringInNodeNamed:(NSString *)nodeName;
@end
|
//
// SHTableViewDelegate.h
//
#import <UIKit/UIKit.h>
/** Your subclass will implement these functions to add custom content to your cells and setup the table view as necessary **/
@protocol SHTableDelegate <NSObject>
@optional
- (void)customInitForTableView:(UITableView *)tableView;
- (void)configureCell:(id)cell atIndexPath:(NSIndexPath *)indexPath forTableView:(UITableView *)tableView withDataItem:(id)dataItem;
@end
/** Protocol added as a wrapper that will tell you when the cell is selected and what item in the datasource is related to that cell **/
@protocol SHTableSelectionDelegate <NSObject>
- (void)tableView:(UITableView *)tableView cellSelected:(id)cell withDataItem:(id)item atIndexPath:(NSIndexPath *)indexPath;
@end
@interface SHTableViewDelegate : NSObject <UITableViewDelegate, UITableViewDataSource, SHTableDelegate>
@property(nonatomic, strong) NSArray *dataSource;
@property(nonatomic, weak) id <SHTableSelectionDelegate> selectionDelegate;
- (id)initWithTableView:(UITableView *)tableView cellClass:(Class)cellClass andDataSource:(NSArray *)array;
@end |
#ifdef __IAR_SYSTEMS_ICC__
#pragma pack(1)
#endif
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "WebviewJSEventHandlerBase.h"
@interface WebviewJSEventHandler_stopPullDownRefresh : WebviewJSEventHandlerBase
{
}
- (void)handleJSEvent:(id)arg1 HandlerFacade:(id)arg2 ExtraData:(id)arg3;
@end
|
#pragma once
#ifndef _SIMENGINETIMER_
#define _SIMENGINETIMER_
#include "Job.h"
namespace EnergySim {
// forward declaration
class SimContext;
class ITimer;
class ENERGYSIM_DLL_PUBLIC TimerElapsedListener
{
public:
virtual void OnElapsed(ITimer *theTimer, EventArgs *theArgs)=0;
};
class ENERGYSIM_DLL_PUBLIC TimerPreemptedListener
{
public:
virtual void OnPreempted(ITimer *theTimer, EventArgs *theArgs)=0;
};
class ENERGYSIM_DLL_PUBLIC ITimer{
protected:
vector<TimerElapsedListener*> _elapsedlisteners = vector<TimerElapsedListener*>();
vector<TimerPreemptedListener*> _preemptedlisteners = vector<TimerPreemptedListener*>();
virtual void NotifyElapsed(){
for(vector<TimerElapsedListener*>::const_iterator iter = _elapsedlisteners.begin(); iter != _elapsedlisteners.end(); ++iter)
{
if(*iter != 0)
{
(*iter)->OnElapsed(this, NULL);
}
}
}
virtual void NotifyPreempted(){
for(vector<TimerPreemptedListener*>::const_iterator iter = _preemptedlisteners.begin(); iter != _preemptedlisteners.end(); ++iter)
{
if(*iter != 0)
{
(*iter)->OnPreempted(this, NULL);
}
}
}
public:
void AddElapsedListener(TimerElapsedListener *theListener)
{
_elapsedlisteners.push_back(theListener);
};
void AddPreemptedListener(TimerPreemptedListener *theListener)
{
_preemptedlisteners.push_back(theListener);
};
void RemoveElapsedListener(TimerElapsedListener *theListener)
{
_elapsedlisteners.erase(std::remove(_elapsedlisteners.begin(), _elapsedlisteners.end(), theListener), _elapsedlisteners.end());
};
void RemovePreemptedListener(TimerPreemptedListener *theListener)
{
_preemptedlisteners.erase(std::remove(_preemptedlisteners.begin(), _preemptedlisteners.end(), theListener), _preemptedlisteners.end());
}
virtual void Start()=0;
virtual void Preempt()=0;
virtual void Elapse()=0;
};
class ENERGYSIM_DLL_PUBLIC SimEngineTimer:public ITimer
{
private:
SimContext* _ctx;
double _delay;
double _startedtime;
double _completiontime;
public:
SimEngineTimer();
SimEngineTimer(SimContext* theContext, double delay);
virtual void Start();
virtual void Preempt();
virtual void Elapse();
double startedtime()const{return _startedtime;}
double completiontime()const{return _completiontime;}
};
class ENERGYSIM_DLL_PUBLIC FinishTimerJob:public IPreemptableJob
{
private:
SimEngineTimer* _timer;
public:
FinishTimerJob(SimContext *context, SimEngineTimer *timer):IPreemptableJob(context)
{
_timer = timer;
}
virtual void Preempt();
virtual void Execute();
};
}
#endif |
/**
*
* ┌─┐╔═╗┌┬┐┌─┐
* │ ║ ║ ││├┤
* └─┘╚═╝─┴┘└─┘
* ┌─┐┌─┐╔╗╔┬ ┬┌─┐┌─┐
* │ ├─┤║║║└┐┌┘├─┤└─┐
* └─┘┴ ┴╝╚╝ └┘ ┴ ┴└─┘
*
* Copyright (c) 2016 Code on Canvas Pty Ltd, http://CodeOnCanvas.cc
*
* This software is distributed under the MIT license
* https://tldrlegal.com/license/mit-license
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code
*
*
* Simple class to edit and load/save single poly to xml file
* based on Cinder bezierPath sample
*/
#pragma once
#include "cinder/app/App.h"
#include "cinder/Path2d.h"
#include "cinder/gl/gl.h"
#include "cinder/Xml.h"
namespace coc {
class PolyEditor {
public:
void setup( std::string _filename = "config_poly.xml" );
void draw( bool _solid = false);
void save();
void toggleEditMode();
bool getIsEditable() { return mIsEditable; };
void setIsEditable( bool _b ) { mIsEditable = _b; }
void close() { mPath.close(); };
void clear() { mPath.clear(); };
void clearLast() {
if (mPath.getNumSegments()>0) mPath.removeSegment( mPath.getNumSegments()-1 );
}
void cleanup();
ci::Rectf getBounds() { return mPath.calcBoundingBox(); }
ci::Path2d getPath() { return mPath; }
void registerEvents();
void unregisterEvents();
void mouseDown( ci::app::MouseEvent event );
void mouseDrag( ci::app::MouseEvent event );
void mouseUp( ci::app::MouseEvent event );
void keyDown( ci::app::KeyEvent event );
private:
bool areEventsRegistered = false;
ci::signals::ScopedConnection mCbMouseDown, mCbMouseDrag, mCbMouseUp, mCbKeyDown;
std::string mFilename;
ci::Path2d mPath;
int mTrackedPoint;
bool mIsEditable;
ci::XmlTree xml;
ci::app::MouseEvent lastMouseDown;//for key events
};//class PolyEditor
}//namespace coc |
//
// Copyright (c) 2014 Kicksend (http://kicksend.com)
//
// Created by Martin Conte Mac Donell (Reflejo@gmail.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
#import <Foundation/NSKeyValueCoding.h>
#import "KADatabaseManager.h"
#import "PropertyKit.h"
#import "KATypes.h"
/* Notification types used when a database object is modified, inserted or removed */
extern NSString * const kKANotificationObjectRemoved;
extern NSString * const kKANotificationObjectInserted;
extern NSString * const kKANotificationObjectModified;
/* Keys used on the notification userInfo dictionary. */
extern NSString * const kKANotificationObjectKey;
extern NSString * const kKANotificationObjectPropertiesKey;
@interface KADatabaseModel : NSObject
/*
* Inserts or updates this object into the database. We decide whether to update or insert
* according to self.id value (> 0 => INSERT, = 0 => UPDATE)
*/
- (void)persistInto:(FMDatabase *)db silent:(BOOL)silent;
- (void)persist;
/*
* Removes current object from database.
*/
- (void)removeFrom:(FMDatabase *)db silent:(BOOL)silent;
- (void)remove;
/*
* Runs ANALYZE query on the class table.
*/
+ (void)analyzeIn:(FMDatabase *)db;
/*
* Returns the name of the table associated to this object. You MUST override this method.
*/
+ (NSString *)tableName;
/*
* CREATE TABLE sql query. It's created based on fields from +[class schema] method.
*/
+ (NSString *)createSQL;
/*
* Gets the object with the given primary key. Note that "the object" is the object that
* is calling this instance, for example: [KAPerson objectForId:1] will returns the KAPerson
* found with id = 1 (if any).
*/
+ (id)objectForId:(NSInteger)objectId from:(FMDatabase *)db;
+ (id)objectForId:(NSInteger)objectId;
/*
* Creates an instance of the calling class by parsing every property following the +schema
* definition.
*/
+ (id)objectFromResultSet:(FMResultSet *)set;
/*
* Returns an array of normalized objects from a result set.
*/
+ (NSArray *)objectsFromResultSet:(FMResultSet *)set;
/*
* This method is used when creating complex models that subclass other models. If you DON'T
* want the subclass to be created as a table on the database, you must set this flag to YES.
*/
+ (BOOL)isAbstractClass;
/*
* Returns a valid query for creating an INDEX on all the given properties, if the property is
* prepended by "-", then the order of index for that property will be descending. Note that the
* properties are not the database fields but the name of the property on the class.
*
* Example: properties: ["annualRate", "-id"] will create an index for (annual_rate ASC, id DESC).
*/
+ (NSString *)indexSQLForProperties:(NSArray *)properties isUnique:(BOOL)unique;
+ (NSString *)indexSQLForProperties:(NSArray *)properties;
@property (nonatomic, assign, readonly) NSInteger id;
@end
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "CDStructures.h"
@interface _IDEDocumentControllerCloseAllContext : NSObject
{
void *innerContext;
id delegate;
SEL didCloseAllSelector;
BOOL shouldCloseAutosavingDocuments;
}
@end
|
#include "dali/array/expression/assignment.h"
#include "dali/array/expression/control_flow.h"
#include "dali/array/expression/operator.h"
#include "dali/array/op/arange.h"
#include "dali/array/op/random.h"
#include "dali/array/op/binary.h"
#include "dali/array/op/unary.h"
#include "dali/array/op/elementwise_operation.h"
#include "dali/array/op/circular_convolution.h"
#include "dali/array/op/im2col.h"
#include "dali/array/op/col2im.h"
#include "dali/array/op/concatenate.h"
#include "dali/array/op/conv.h"
#include "dali/array/op/gather.h"
#include "dali/array/op/gather_from_rows.h"
#include "dali/array/op/one_hot.h"
#include "dali/array/op/eye.h"
#include "dali/array/op/outer.h"
#include "dali/array/op/reducers.h"
#include "dali/array/op/scan.h"
#include "dali/array/op/top_k.h"
#include "dali/array/op/dot.h"
#include "dali/array/op/spatial_enums.h"
#include "dali/array/cudnn/conv.h"
|
//
// KIFTestScenario+CEAdditions.h
// CEPopupPickerView
//
// Created by Chris Eidhof on 2/7/12.
// Copyright (c) 2012 Chris Eidhof. All rights reserved.
//
#import "KIFTestScenario.h"
@interface KIFTestScenario (CEAdditions)
+ (id)scenarioToAppear;
+ (id)scenarioToCloseWhenTappedOutsideOfPicker;
+ (id)scenarioToCloseWhenTappedOnCenterRowOfPicker;
@end
|
//
// AppDelegate_iPad.h
// iPhoneOSUniversal
//
// Created by Thorsten Karrer on 26.5.10.
// Copyright media computing group - RWTH Aachen University 2010. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <ThoMoNetworking/ThoMoNetworking.h>
@interface AppDelegate_iPad : NSObject <UIApplicationDelegate, ThoMoClientDelegateProtocol, ThoMoServerDelegateProtocol>
{
UIWindow *window;
ThoMoClientStub *client;
ThoMoServerStub *server;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@end
|
extern NSString *const CCAlertViewDismissAllAlertsNotification;
extern NSString *const CCAlertViewAnimatedKey;
/**
A simple `UIAlertView` wrapper with blocks-based API.
The memory management works as in `UIAlertView`: you don’t have
to hold a strong reference to a `CCAlertView`, it will retain
itself when it’s displayed and release after being dismissed.
*/
@interface CCAlertView : NSObject
/**
Alert style, see `UIAlertViewStyle` for details.
The alert style can be used to show a textfield in the alert.
*/
@property(nonatomic, assign) UIAlertViewStyle alertViewStyle;
/** Block to be called after the alert is dismissed by whatever means. */
@property(copy) dispatch_block_t dismissAction;
/** Both the title and the message may be `nil`. */
- (id) initWithTitle: (NSString*) title message: (NSString*) message;
/** Adds button with given title and action. The action may be `nil`. */
- (void) addButtonWithTitle: (NSString*) title block: (dispatch_block_t) block;
/** Display the alert. */
- (void) show;
/** Dismiss the alert. Calls `dismissAction` if set. */
- (void) dismissAnimated: (BOOL) animated;
/**
Returns a pointer to a textfield, if present.
The only supported way to get a textfield in the alert
is by setting the `alertViewStyle` property.
*/
- (UITextField*) textFieldAtIndex: (NSInteger) textFieldIndex;
@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic_17.c
Label Definition File: CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic.label.xml
Template File: point-flaw-17.tmpl.c
*/
/*
* @description
* CWE: 479 Signal Handler Use of Non-Reentrant Function
* Sinks:
* GoodSink: Don't call a function from within the signal handler
* BadSink : malloc() and free() inside a signal handler
* Flow Variant: 17 Control flow: for loops
*
* */
#include "std_testcase.h"
#include <signal.h>
static void helperBad(int sig)
{
/* FLAW: malloc and free are not re-entrant */
/* Used to be printf in here, but we are trying to avoid that.
* Detecting that printLine ultimately calls printf requires inter-
* procedural analysis, so we cannot do that either. So instead,
* do something very contrived with malloc/free
*/
void *voidPointer = malloc(10);
free(voidPointer);
}
static volatile sig_atomic_t volatileSigAtomic = 0;
static void helperGood(int sig)
{
/* FIX: Basically, "don't do anything" in signal handlers. Set a flag at
* best, and if you have to call a function, ensure it's a re-entrant
* asynchronous-safe one that doesn't eat up a lot of time
*/
volatileSigAtomic = sig;
}
#ifndef OMITBAD
void CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic_17_bad()
{
int j;
for(j = 0; j < 1; j++)
{
signal(SIGINT, helperBad);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses the GoodSinkBody in the for statements */
static void good1()
{
int k;
for(k = 0; k < 1; k++)
{
signal(SIGINT, helperGood);
}
}
void CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic_17_good()
{
good1();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic_17_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE479_Signal_Handler_Use_of_Non_Reentrant_Function__basic_17_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// OWActivityCommentVC.h
// SmartPartyBuilding
//
// Created by 王卫华 on 2017/7/1.
// Copyright © 2017年 王卫华. All rights reserved.
//
#import <UIKit/UIKit.h>
@class OWHomeActivity;
@interface OWActivityCommentVC : UITableViewController
@property (nonatomic, strong) OWHomeActivity *activity;
@end
|
/* Copyright (C) 2012 Yevgeniy Melnichuk <yevgeniy.melnichuk@googlemail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#import <Cocoa/Cocoa.h>
@interface AppDelegate : NSObject <NSApplicationDelegate> {
NSStatusItem* statusMenuItem;
}
@property (assign) IBOutlet NSWindow *window;
- (NSStatusItem*)statusMenuItem;
- (void)setStatusMenuItemIcon:(NSString*)iconName;
@end
|
/**
Copyright (C) 2013 Eric Wasylishen
Date: November 2013
License: MIT (see COPYING)
*/
#import <CoreObject/CoreObject.h>
/**
* The server is pushing revisions to the client (the client is not expecting them)
*
* Client should send a COSynchronizerAcknowledgementFromClientMessage in response.
*/
@interface COSynchronizerPushedRevisionsToClientMessage : NSObject
{
NSArray *_revisions;
}
/** Array of COSynchronizerRevision */
@property (nonatomic, readwrite, copy) NSArray *revisions;
@end
|
//
// AddBusinessViewController.h
// iVending
//
// Created by Manny Pino on 4/20/15.
// Copyright (c) 2015 student. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "businessDb.h"
@interface AddBusinessViewController : UIViewController
@property (strong, nonatomic) SqlDB *myDb;
@property (strong, nonatomic) Business *business;
@property (strong, nonatomic) BusinessDb * businessDb;
@property (strong, nonatomic) IBOutlet UITextField *businessName;
@property (strong, nonatomic) IBOutlet UITextField *address;
@property (strong, nonatomic) IBOutlet UITextField *address2;
@property (strong, nonatomic) IBOutlet UITextField *city;
@property (strong, nonatomic) IBOutlet UITextField *state;
@property (strong, nonatomic) IBOutlet UITextField *zip;
- (IBAction)saveBusiness:(id)sender;
@end
|
/*numPass=5, numTotal=5
Verdict:ACCEPTED, Visibility:1, Input:"5
52 91 72 65 100", ExpOutput:"100
100 65
100 65 72
100 65 72 91
100 65 72 91 52
", Output:"100
100 65
100 65 72
100 65 72 91
100 65 72 91 52
"
Verdict:ACCEPTED, Visibility:1, Input:"3
1 22 333", ExpOutput:"333
333 22
333 22 1
", Output:"333
333 22
333 22 1
"
Verdict:ACCEPTED, Visibility:1, Input:"10
2346 62 756 452 7274 288 2 81 82 1000", ExpOutput:"1000
1000 82
1000 82 81
1000 82 81 2
1000 82 81 2 288
1000 82 81 2 288 7274
1000 82 81 2 288 7274 452
1000 82 81 2 288 7274 452 756
1000 82 81 2 288 7274 452 756 62
1000 82 81 2 288 7274 452 756 62 2346
", Output:"1000
1000 82
1000 82 81
1000 82 81 2
1000 82 81 2 288
1000 82 81 2 288 7274
1000 82 81 2 288 7274 452
1000 82 81 2 288 7274 452 756
1000 82 81 2 288 7274 452 756 62
1000 82 81 2 288 7274 452 756 62 2346
"
Verdict:ACCEPTED, Visibility:0, Input:"6
-2 6 18 27 5 2", ExpOutput:"2
2 5
2 5 27
2 5 27 18
2 5 27 18 6
2 5 27 18 6 -2
", Output:"2
2 5
2 5 27
2 5 27 18
2 5 27 18 6
2 5 27 18 6 -2
"
Verdict:ACCEPTED, Visibility:0, Input:"8
-182 571 -27 257 21 9199 -299 12", ExpOutput:"12
12 -299
12 -299 9199
12 -299 9199 21
12 -299 9199 21 257
12 -299 9199 21 257 -27
12 -299 9199 21 257 -27 571
12 -299 9199 21 257 -27 571 -182
", Output:"12
12 -299
12 -299 9199
12 -299 9199 21
12 -299 9199 21 257
12 -299 9199 21 257 -27
12 -299 9199 21 257 -27 571
12 -299 9199 21 257 -27 571 -182
"
*/
#include <stdio.h>
int main()
{
int i,j;
int n;
scanf("%d ",&n);
int a[n];
for(i=0;i<n;i++)
{
scanf("%d ",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=n;j>=(n-i);j--)
{
printf("%d ",a[j-1]);
}
printf("\n");
}
return 0;
} |
#ifndef CML_EASINGS_H
#error "Never use <cml/easings/exponential.h> directly; include <cml/easings.h> instead."
#endif
#ifndef CML_EASINGS_EXPONENTIAL_H
#define CML_EASINGS_EXPONENTIAL_H
__CML_BEGIN_DECLS
double cml_ease_exponential_in(double p);
double cml_ease_exponential_out(double p);
double cml_ease_exponential_in_out(double p);
__CML_END_DECLS
#endif
|
// Estimote Fleet Management SDK
// Copyright (c) 2015 Estimote. All rights reserved.
#import <Foundation/Foundation.h>
#import "ESTSettingReadOnly.h"
@class ESTSettingDeviceInfoApplicationHash;
NS_ASSUME_NONNULL_BEGIN
/**
* Block used as a result of read setting ApplicationHash operation for Device Info packet.
*
* @param applicationHashSetting ApplicationHash setting carrying value.
* @param error Operation error. No error means success.
*/
typedef void(^ESTSettingDeviceInfoApplicationHashCompletionBlock)(ESTSettingDeviceInfoApplicationHash * _Nullable applicationHashSetting, NSError * _Nullable error);
/**
* ESTSettingDeviceInfoApplicationHash represents Device Info ApplicationHash value.
*/
@interface ESTSettingDeviceInfoApplicationHash : ESTSettingReadOnly <NSCopying>
/**
* Designated initializer.
*
* @param applicationHash Device Info ApplicationHash value.
*
* @return Initialized object.
*/
- (instancetype)initWithValue:(NSString *)applicationHash;
/**
* Returns current value of Device Info ApplicationHash setting.
*
* @return Device Info ApplicationHash value.
*/
- (NSString *)getValue;
/**
* Method allows to read value of initialized Device Info ApplicationHash setting object.
*
* @param completion Block to be invoked when the operation is complete.
*/
- (void)readValueWithCompletion:(ESTSettingDeviceInfoApplicationHashCompletionBlock)completion;
@end
NS_ASSUME_NONNULL_END
|
//
// MFBActionBinding.h
// Pods
//
// Created by Nickolay Tarbayev on 28.07.2017.
//
//
#import <Foundation/Foundation.h>
#import "NSObject+MFBBindingAssertion.h"
NS_ASSUME_NONNULL_BEGIN
@interface MFBActionBinding : NSObject
@property (nonatomic, unsafe_unretained) IBOutlet id observable;
@property (nonatomic, copy) IBInspectable NSString *keyPath;
@property (nonatomic, unsafe_unretained) IBOutlet id target;
@property (nonatomic) IBInspectable NSString *action;
@end
@interface NSObject (MFBActionBinding)
- (void)mfb_bindAction:(SEL)action toObject:(id)observableController withKeyPath:(NSString *)keyPath;
- (void)mfb_unbindAction:(SEL)action;
@end
#ifdef DEBUG
/**
For debug and assertion purposes only
*/
@interface NSObject (MFBActionBindingQueries)
/**
@param keyPath The key-path, relative to the receiver, for which to return the list of corresponding bindings.
*/
- (NSArray *)mfb_triggeringBindingsForKeyPath:(NSString *)keyPath;
/**
@param action A selector implemented by the receiver, for which to return the corresponding binding.
*/
- (id)mfb_bindingForAction:(SEL)action;
@end
#endif
// clang-format off
#if !defined(NS_BLOCK_ASSERTIONS)
#define MFBAssertTriggerToActionBinding(obj, property) ({ \
if (!obj.bindingAssertionDisabled) { \
NSString *_propertyName = NSStringFromSelector(@selector(property)); \
NSCAssert([obj mfb_triggeringBindingsForKeyPath:_propertyName].count > 0, \
@"Missing action binding(s) for trigger: %@", _propertyName); \
} \
})
#define MFBAssertActionToTriggerBinding(obj, action) ({ \
if (!obj.bindingAssertionDisabled) { \
NSCAssert([obj mfb_bindingForAction:action] != nil, \
@"Missing trigger binding for action: %@", NSStringFromSelector(action)); \
} \
})
#else
#define MFBAssertTriggerToActionBinding(obj, property) ({})
#define MFBAssertActionToTriggerBinding(obj, property) ({})
#endif
// clang-format on
NS_ASSUME_NONNULL_END
|
//
// SketchPluginDemo.h
// SketchPluginDemo
//
// Created by Sergey on 1/23/17.
// Copyright © 2017 Sketch plugin by https://sympli.io All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "AutoDrawViewController.h"
#import "AutoDrawNetworkClient.h"
@interface AutoDrawPlugin : NSObject <AutoDrawViewControllerDelegate>
@property double thickness;
@property BOOL removeOriginalLayers;
@property (strong) NSArray *layers;
@property (nonatomic, strong) AutoDrawViewController *autoDrawViewController;
@property (strong) AutoDrawNetworkClient *networkClient;
-(void)processDocument:(id)document;
@end
|
//
// QZKitDelegate.h
// SDk
//
// Created by tang.johannes on 15/1/23.
// Copyright (c) 2015年 tang.johannes. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@class QUserInfo;
@class QAgentInfo;
@class QMessageRecvInfo;
typedef enum {
ParamTypePhoneNumber, /**< 电话号码 */
ParamTypeQZId /**< 青芝Id */
} ParamType;
extern NSString * const AbilityIM;
extern NSString * const AbilityPhone;
extern NSString * const AbilityAgent;
extern NSString * const QAgentEventServiceStart;//客户分配给坐席,坐席开始振铃
extern NSString * const QAgentEventServicePickup;//客户分配给坐席,坐席摘机
extern NSString * const QAgentEventServiceEnd;//坐席服务结束
extern NSString * const QAgentEventServiceComplete;//坐席服务完成
extern NSString * const MessageInChatRecvRangeAll; //普通聊天消息范围涉及所有sender-id,不涉及群聊范围
@protocol QZUCCDelegate <NSObject>
@required
/**
* 获取AppDelegate下root view ctrl
* @return self.window.rootViewController;
*/
- (UIViewController *)getAppRootViewController;
/**
* 查询用户
* @param paramString 参数字符串
* @param type 参数类型,详见ParamType
* @return 查询成功返回QUserInfo对象,否则返回nil
*/
- (QUserInfo *)getQUserInfo:(NSString *)paramString type:(ParamType)type;
/**
* 各能力状态变化事件
* @param ability 能力类型,参见Ability常量定义
* @param state 状态值,取值0、1,其中1--初始化完成且连接成功,0则是断开连接
* @return
*/
- (void)onAbilityStateChange:(NSString *)ability state:(int)state;
/**
* 座席状态变化事件
* @param agentInfo 座席信息,详见各属性描述
*
*/
- (void)onAgentStatusEventChange:(QAgentInfo *)agentInfo;
/**
* 坐席服务事件
* @param eventDic - 事件详情内容
* @param type - 事件类型,参见QAgentEventService常量定义
* @return
*/
- (void)onAgentServiceEventChange:(NSDictionary *)eventDic eventType:(NSString *)type;
/**
* 指定sender_id订阅来自其所发送的消息,当有指定Id后,sdk接收该sender_id的消息后执行<onRecvMessageFromSubscribeSenderIds:>回调方法
* 其中sender_id的取值范围:
* -- 1.普通用户,则直接填写qz_id;
* -- 2.后台服务中消息中转代理模块的特定用户,则由后台开发人员指定;
* 若返回 @[MessageInChatRecvRangeAll], 则订阅所有普通聊天, 但不涉及群聊天;其中MessageInChatRecvRangeAll为常量;
*/
- (NSArray *)subscribeMessageFromSenderIds;
/*
* 接收subscribeMessageFromSenderIds中指定sender_id发来的消息
* @param msgInfo 消息对象
*/
- (void)onRecvMessageFromSubscribeSenderIds:(QMessageRecvInfo *)msgInfo;
@end
|
//
// kunittest.c
// Firedrake
//
// Created by Sidney Just
// Copyright (c) 2012 by Sidney Just
// 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 reKUriction, including without limitation
// the rights to use, copy, modify, merge, publish, diKUribute, 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 subKUantial 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 <config.h>
#include <libc/string.h>
#include <libc/stdio.h>
#include <system/syslog.h>
#include <memory/memory.h>
#include "kunittest.h"
kunit_test_t *kunit_testCreate(char *name, char *description, kunit_test_function_t function)
{
if(!function)
{
warn("kunit_testCreate() with NULL function!");
return NULL;
}
kunit_test_t *test = halloc(NULL, sizeof(kunit_test_t));
if(test)
{
size_t nameLength = name ? strlen(name) : 0;
size_t descLength = description ? strlen(description) : 0;
test->name = name ? halloc(NULL, nameLength + 1) : NULL;
test->description = description ? halloc(NULL, descLength + 1) : NULL;
if((test->name == NULL && name) || (test->description == NULL && description))
{
if(test->name)
hfree(NULL, test->name);
if(test->description)
hfree(NULL, test->description);
hfree(NULL, test);
return NULL;
}
if(name)
strlcpy(test->name, name, nameLength);
if(description)
strlcpy(test->description, description, descLength);
test->state = kunit_test_state_waiting;
test->suite = NULL;
test->continueOnError = true;
test->failures = 0;
test->buffer = NULL;
test->function = function;
test->next = NULL;
}
return test;
}
void kunit_testDestroy(kunit_test_t *test)
{
if(test->name)
hfree(NULL, test->name);
if(test->description)
hfree(NULL, test->description);
hfree(NULL, test);
}
void kunit_testRun(kunit_test_t *test)
{
jmp_buf buffer;
test->buffer = &buffer;
test->started = time_getTimestamp();
if(setjmp(buffer) == 0)
{
#if CONF_KUNITFAILSONLY
info("Test case '%s' started.\n", test->name);
#endif
test->state = kunit_test_state_ran;
test->function();
}
test->finished = time_getTimestamp();
timestamp_t diff = test->finished - test->started;
if(test->state == kunit_test_state_ran)
{
#if CONF_KUNITFAILSONLY
info("Test case '%s' passed (%i.%03i s).\n", test->name, time_getSeconds(diff), time_getMilliseconds(diff));
#endif
}
else
{
info("Test case '%s' failed (%i.%03i s).\n", test->name, time_getSeconds(diff), time_getMilliseconds(diff));
}
test->buffer = NULL;
}
void kunit_testFail(kunit_test_t *test, char *UNUSED(description), ...)
{
test->state = kunit_test_state_failed;
test->failures ++;
if(!test->continueOnError && test->buffer)
longjmp(*test->buffer, 0);
}
|
//
// c3dDocuments.h
// HelloOpenGL
//
// Created by wantnon (yang chao) on 14-2-20.
//
//
#ifndef __HelloOpenGL__c3dDocuments__
#define __HelloOpenGL__c3dDocuments__
#include <iostream>
#include <string>
using namespace std;
#if (C3D_TARGET_PLATFORM == C3D_PLATFORM_WIN32)
#include "platform/win32/c3dDocumentsPlatformDepend.h"
#include "platform/win32/c3dPathPlatformDepend.h"
#else
#include "platform/iOS/c3dDocumentsPlatformDepend.h"
#include "platform/iOS/c3dPathPlatformDepend.h"
#endif
class Cc3dDocuments{
public:
static Cc3dDocuments*sharedDocuments();
string getDocumentsPath();
bool getIsFileOrClipExistInDocument(const string&pathInDoc){
string fullPath=getDocumentsPath()+"/"+pathInDoc;
return isFileExistsAtPath_plat(fullPath);
}
};
#endif /* defined(__HelloOpenGL__c3dDocuments__) */
|
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#endif
#import "Weathersama.h"
FOUNDATION_EXPORT double WeathersamaVersionNumber;
FOUNDATION_EXPORT const unsigned char WeathersamaVersionString[];
|
//
// NSString+RCAppConfig.h
// RCKit
//
// Created by Looping on 14/8/21.
//
// The MIT License (MIT)
// Copyright (c) 2014 Ridgecorn (http://ridgecorn.com/ )
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#import <Foundation/Foundation.h>
@interface NSString (NSString_RCAppConfig)
+ (NSString *)productDisplayName;
+ (NSString *)bundleIdentifier;
+ (NSString *)bundleVersion;
+ (NSString *)bundleName;
+ (NSString *)appScheme;
+ (NSString *)mainStoryboardFile;
+ (NSString *)sqliteStoreFilename;
+ (NSString *)shortBuildString;
+ (NSString *)versionString;
+ (NSString *)defaultCoordinateString;
+ (NSString *)coordinateType;
+ (NSString *)productIntroduction;
+ (NSString *)productCopyright;
+ (NSString *)contactNumber;
+ (NSString *)appID;
+ (NSString *)apiBaseURLString;
+ (NSString *)apiBaseHTTPURLString;
+ (NSString *)apiBaseHTTPSURLString;
+ (NSString *)cookieBaseURLString;
+ (NSString *)userAgent;
+ (NSString *)applicationTintColorString;
+ (NSString *)applicationBackgroundColorString;
+ (NSString *)applicationThemeKey;
@end
|
#pragma once
#include <vector>
#include <string>
#include <unordered_map>
#include "../utility/types.h"
class Compiler {
public:
~Compiler() {}
Compiler(std::vector<std::string> contents) : m_contents(contents) {
m_umap_rfunctions.insert({ "syscall", 0x0 });
m_umap_rfunctions.insert({ "add", 0x2 });
m_umap_rfunctions.insert({ "fadd", 0x3 });
m_umap_rfunctions.insert({ "fsub", 0x4 });
m_umap_rfunctions.insert({ "fmul", 0x5 });
m_umap_ifunctions3param.insert({ "addi", 0xA });
m_umap_ifunctions3param.insert({ "subi", 0xB });
m_umap_ifunctions2param.insert({ "li", 0xC });
m_umap_ifunctions3param.insert({ "lw", 0xD });
m_umap_ifunctions2param.insert({ "la", 0xE });
m_umap_ifunctions3param.insert({ "lb", 0xF });
m_umap_ifunctions3param.insert({ "ld", 0x10 });
m_umap_ifunctions3param.insert({ "sd", 0x11 });
m_umap_jfunctions.insert({ "b", 0x1E });
m_umap_ifunctions3param.insert({ "bge", 0x1C });
m_umap_ifunctions2param.insert({ "beqz", 0x1B });
m_umap_ifunctions3param.insert({ "bne", 0x1D });
m_umap_jfunctions.insert({ "nop", 0x1F });
}
void compile() {
findData();
findInstructions();
moveToMemory();
}
private:
//determine contents
void findData();
void findInstructions();
const std::vector<std::string> findInstructionAndOperand(const std::string& s) const;
//memory modifiers
void moveToMemory();
//per segment, by file parser
void storeData(const std::vector<std::string>& values); //namely used by fileparser
void storeInstruction(std::vector<std::string>& values); //namely used by fileparser
//store specific instruction types
void storeInstructionHelper(const std::string& type, const instruction_t& instr);
std::unordered_map<std::string, int> m_umap_rfunctions;
std::unordered_map<std::string, int> m_umap_ifunctions2param;
std::unordered_map<std::string, int> m_umap_ifunctions3param;
std::unordered_map<std::string, int> m_umap_jfunctions;
std::unordered_map<std::string, int> m_umap_address;
std::vector<std::string> m_contents;
std::vector<std::string> m_data; // will be [variable][type][datum]
std::vector<std::string> m_instructions; // will be [instruction]<optional>[ma_"memory address"] ex: [push][ma_X]
}; |
// -*- C++ -*-
//=============================================================================
/**
* @file RecursDef_i.h
*
* $Id: RecursDef_i.h 935 2008-12-10 21:47:27Z mitza $
*
* StructDef & UnionDef support class.
*
*
* @author Simon Massey <sma@prismtech.com>
*/
//=============================================================================
#ifndef TAO_RECURSDEF_I_H
#define TAO_RECURSDEF_I_H
#include "orbsvcs/IFRService/TypedefDef_i.h"
#include "ace/SString.h"
#include "ace/OS_NS_stdlib.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4250)
#endif /* _MSC_VER */
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
//-----------------------------------------------------------------------------
// Class TAO_RecursiveDef_OuterScopes is a support class for StructDef_i.h and
// UnionDef_i.h files. It creates a stack of outer structure definitions, used
// by TAO_StructDef_i::type_i(), and TAO_UnionDef_i::type_i() during nested
// structure processing.
//-----------------------------------------------------------------------------
class TAO_RecursiveDef_OuterScopes
{
public:
TAO_RecursiveDef_OuterScopes( const ACE_TString &id ); // "Push" scope's ID
~TAO_RecursiveDef_OuterScopes(); // "Pop" this scope
static bool SeenBefore( const ACE_TString &id ); // Check for outer ID
private: // Data
const ACE_TString id_;
const TAO_RecursiveDef_OuterScopes *const pNextOuterID_;
static const TAO_RecursiveDef_OuterScopes *pIDsSeenAlready;
};
TAO_END_VERSIONED_NAMESPACE_DECL
#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */
#endif /* TAO_RECURSDEF_I_H */
|
//
// IGKit.h
// IGKit
//
// Created by CaptainTeemo on 5/12/16.
// Copyright © 2016 CaptainTeemo. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for IGKit.
FOUNDATION_EXPORT double IGKitVersionNumber;
//! Project version string for IGKit.
FOUNDATION_EXPORT const unsigned char IGKitVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <IGKit/PublicHeader.h>
|
/*
* $QNXLicenseC:
* Copyright 2007, QNX Software Systems.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not reproduce, modify or distribute this software except in
* compliance with the License. You may obtain a copy of the License
* at: http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OF ANY KIND, either express or implied.
*
* This file may contain contributions from others, either as
* contributors under the License or as licensors under other terms.
* Please review this entire file for other proprietary rights or license
* notices, as well as the QNX Development Suite License Guide at
* http://licensing.qnx.com/license-guide/ for other information.
* $
*/
/*
* arm/syspage.h
*
*/
#ifndef __SYSPAGE_H_INCLUDED
#error arm/syspage.h should not be included directly.
#endif
#ifdef __ARM__
extern struct cpupage_entry *_cpupage_ptr;
#endif /* __ARM__ */
/*
* CPU capability/state flags
*/
#define ARM_CPU_FLAG_XSCALE_CP0 0x0001 /* Xscale CP0 MAC unit */
#define ARM_CPU_FLAG_V6 0x0002 /* ARMv6 architecture */
#define ARM_CPU_FLAG_V6_ASID 0x0004 /* use ARMv6 MMU ASID */
#define ARM_CPU_FLAG_SMP 0x0008 /* multiprocessor system */
#define ARM_CPU_FLAG_V7_MP 0x0010 /* ARMv7 multiprocessor extenstions */
#define ARM_CPU_FLAG_V7 0x0020 /* ARMv7 architecture */
#define ARM_CPU_FLAG_NEON 0x0040 /* Neon Media Engine */
#define ARM_CPU_FLAG_WMMX2 0x0080 /* iWMMX2 coprocessor */
#define ARM_CPU_FLAG_V7_MP_ERRATA 0x0100 /* Needs SMP TLB workarounds */
#define ARM_CPU_FLAG_CC_INCR_BIT_32 0x0200 /* CLOCKCYCLES_INCR_BIT == 32 */
#if defined(ENABLE_DEPRECATED_SYSPAGE_SECTIONS)
struct arm_boxinfo_entry {
_Uint32t hw_flags; /* HW_* */
_Uint32t spare[9];
};
#endif
struct arm_cpu_entry {
_SPFPTR(int, page_flush, (unsigned, int));
_SPFPTR(void, page_flush_deferred, (int));
_Uint16t upte_ro;
_Uint16t upte_rw;
_Uint16t kpte_ro;
_Uint16t kpte_rw;
_Uint16t mask_nc;
_Uint16t spare0;
_SPFPTR(_Uint64t, clock_cycles, (void));
_Uint16t ttb_attr;
_Uint16t pte_attr;
_Uint32t spare1;
};
struct arm_syspage_entry {
syspage_entry_info DEPRECATED_SECTION_NAME(boxinfo);
_Uint32t L1_vaddr;
#if defined(__GNUC__)
/* Old startups referenced L1_paddr (even though they didn't
have to), so let's do some hackery to let them continue to compile
*/
union {
_Uint32t L2_vaddr;
_Uint32t L1_paddr;
};
#else
_Uint32t L2_vaddr;
#endif
_Uint32t startup_base;
unsigned startup_size;
syspage_entry_info cpu;
};
struct arm_kernel_entry {
unsigned long code[2];
};
#ifdef __QNXNTO__
#include <sys/srcversion.h>
__SRCVERSION( "$URL: http://svn/product/branches/6.5.0/SP1/services/system/public/arm/syspage.h $ $Rev: 644488 $" )
#endif
|
#ifndef CART_MEMORY_H
#define CART_MEMORY_H
#include <cstdint>
#include <vector>
#include <Mirroring.h>
struct CartMemory
{
Mirroring mirroring;
bool chrIsRam;
std::vector<uint8_t> trainer;
std::vector<uint8_t> prg;
std::vector<uint8_t> chr;
std::vector<uint8_t> ram;
};
#endif
|
/*
* SPL definitions for the i.MX7 SPL
*
* (C) Copyright 2017 CompuLab, Ltd. http://www.compulab.com
*
* Author: Uri Mashiach <uri.mashiach@compulab.co.il>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#ifndef __IMX7_SPL_CONFIG_H
#define __IMX7_SPL_CONFIG_H
#ifdef CONFIG_SPL
/*
* see figure 6-22 in i.MX 7Dual/Solo Reference manuals:
* - IMX7D/S OCRAM free area RAM (OCRAM) is from 0x00910000 to
* 0x00946C00.
* - Set the stack at the end of the free area section, at 0x00946BB8.
* - The BOOT ROM loads what they consider the firmware image
* which consists of a 4K header in front of us that contains the IVT, DCD
* and some padding thus 'our' max size is really 0x00946BB8 - 0x00911000.
* 64KB is more then enough for the SPL.
*/
#define CONFIG_SPL_TEXT_BASE 0x00911000
#define CONFIG_SPL_MAX_SIZE 0x10000
#define CONFIG_SPL_STACK 0x00946BB8
/*
* Pad SPL to 68KB (4KB header + 64KB max size). This allows to write the
* SPL/U-Boot combination generated with u-boot-with-spl.imx directly to a
* boot media (given that boot media specific offset is configured properly).
*/
#define CONFIG_SPL_PAD_TO 0x11000
/* MMC support */
#if defined(CONFIG_SPL_MMC_SUPPORT)
#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1
#define CONFIG_SYS_MONITOR_LEN 409600 /* 400 KB */
#endif
/* Define the payload for FAT/EXT support */
#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
# ifdef CONFIG_OF_CONTROL
# define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot-dtb.img"
# else
# define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img"
# endif
#endif
#define CONFIG_SPL_BSS_START_ADDR 0x88200000
#define CONFIG_SPL_BSS_MAX_SIZE 0x100000 /* 1 MB */
#define CONFIG_SYS_SPL_MALLOC_START 0x88300000
#define CONFIG_SYS_SPL_MALLOC_SIZE 0x100000 /* 1 MB */
#endif /* CONFIG_SPL */
#endif /* __IMX7_SPL_CONFIG_H */
|
// stdafx.h : 标准系统包含文件的包含文件,
// 或是经常使用但不常更改的
// 特定于项目的包含文件
// #pragma once
#include "targetver.h"
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <ctime>
#if defined(__APPLE__)
#define PLATFORM_MACOSX
#elif defined(_WIN32) || define(_WIN64)
#define PLATFORM_WINNT
#elif defined(__linux__)
#define PLATFORM_LINUX
#endif
#if defined(PLATFORM_MACOSX)
#include <unistd.h>
typedef char _TCHAR;
#define MainX(argc,argv) main(argc,argv)
#define strcpy_x(source, size, target) strcpy(source,target)
#elif defined(PLATFORM_WINNT)
#define MainX(argc,argv) _tmain(argc,argv)
#define strcpy_x(source, size, target) strcpy_s(source,size,target)
#include <tchar.h>
#elif defined(PLATFORM_LINUX)
#include <unistd.h>
#include <cstdlib>
typedef char _TCHAR;
#define MainX(argc,argv) main(argc,argv)
#define strcpy_x(source, size, target) strcpy(source,target)
#endif
using namespace std;
|
/** @defgroup i2c_defines I2C Defines
*
* @brief <b>Defined Constants and Types for the STM32F0xx I2C</b>
*
* @ingroup STM32F0xx_defines
*
* @version 1.0.0
*
* @date 11 July 2013
*
* LGPL License Terms @ref lgpl_license
*/
/*
* This file is part of the libopencm3 project.
*
* Copyright (C) 2010 Thomas Otto <tommi@viadmin.org>
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBOPENCM3_I2C_H
#define LIBOPENCM3_I2C_H
#include <libopencm3/stm32/common/i2c_common_v2.h>
#endif
|
#ifndef WEAPONRANK_H
#define WEAPONRANK_H
#include <unordered_map>
#include "feClass.h"
#include "feUtils.h"
class feWeaponRank {
private:
std::unordered_map< std::string, int > weaponRank;
public:
feWeaponRank(feClass j);
std::string getWeaponRanks(feClass f);
char getWeaponRank(std::string w);
void incWEx(int xp);
};
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_connect_socket_w32_execv_54e.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-54e.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: connect_socket Read data using a connect socket (client side)
* GoodSource: Fixed string
* Sink: w32_execv
* BadSink : execute command with execv
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "ls"
#define COMMAND_ARG2 "-la"
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else /* 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"
#include <process.h>
#define EXECV _execv
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
void CWE78_OS_Command_Injection__char_connect_socket_w32_execv_54e_badSink(char * data)
{
{
char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL};
/* execv - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECV(COMMAND_INT_PATH, args);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__char_connect_socket_w32_execv_54e_goodG2BSink(char * data)
{
{
char *args[] = {COMMAND_INT_PATH, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL};
/* execv - specify the path where the command is located */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECV(COMMAND_INT_PATH, args);
}
}
#endif /* OMITGOOD */
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "IDEEditorDocument.h"
#import "DVTTextFindable-Protocol.h"
@class IDEActivityLogSection;
@interface IDELogDocument : IDEEditorDocument <DVTTextFindable>
{
IDEActivityLogSection *_activityLog;
}
+ (BOOL)shouldUnlockFileURLBeforeMakingChanges;
@property(readonly) IDEActivityLogSection *buildLog; // @synthesize buildLog=_activityLog;
- (void).cxx_destruct;
- (void)printDocument:(id)arg1;
- (id)findStringMatchingDescriptor:(id)arg1 backwards:(BOOL)arg2 from:(id)arg3 to:(id)arg4;
- (struct _NSRange)searchRangeforStartRange:(struct _NSRange)arg1 backwards:(BOOL)arg2 withinString:(id)arg3;
- (id)searchStringForLocation:(id)arg1;
- (id)findLocationFollowing:(id)arg1 backwards:(BOOL)arg2 passingTestForSection:(id)arg3;
- (id)lastLocationInLog;
- (id)lastIndexPathInSection:(id)arg1 inIndexPath:(id)arg2;
- (id)_iterateStartingWith:(id)arg1 section:(id)arg2 index:(unsigned long long)arg3 backwards:(BOOL)arg4 level:(long long)arg5 messageCount:(unsigned long long)arg6 onRefPath:(BOOL)arg7 passingTest:(id)arg8;
- (id)messageOrSectionForDocumentLocation:(id)arg1;
- (int)readOnlyStatus;
- (id)displayName;
- (id)initForURL:(id)arg1 withContentsOfURL:(id)arg2 ofType:(id)arg3 error:(id *)arg4;
// Remaining properties
@property unsigned long long supportedMatchingOptions;
@end
|
#pragma once
#include <vector>
#define DECLARE_STATIC_INIT(ClassName) \
static void static_init_func(); \
static static_init_helper ClassName##_static_init_helper
#define STATIC_INIT(ClassName) \
static_init_helper ClassName::ClassName##_static_init_helper(&ClassName::static_init_func); \
void ClassName::static_init_func()
typedef void (*init_func_type)();
class static_init
{
public:
static static_init& instance()
{
static static_init inst;
return inst;
}
void add_init_func(init_func_type f) { funcs_.push_back(f); }
static void execute()
{
auto& inst = instance();
for (auto c : inst.funcs_) c();
}
private:
static_init() {}
std::vector<init_func_type> funcs_;
};
class static_init_helper
{
public:
static_init_helper(init_func_type f)
{
static_init::instance().add_init_func(f);
}
};
|
//
// ICClassInfo.h
// Pods
//
// Created by mac on 2017/8/6.
//
//
#import <Foundation/Foundation.h>
@class ICClassIvarInfo;
@interface ICClassInfo : NSObject
@property (nonatomic, assign, readonly) Class cls; ///< class object
@property (nonatomic, strong, readonly) NSString *name; ///< class name
@property (nullable, nonatomic, strong, readonly) NSDictionary<NSString *, ICClassIvarInfo *> *ivarInfos; ///< ivars
/**
Get the class info of a specified Class.
@discussion This method will cache the class info and super-class info
at the first access to the Class. This method is thread-safe.
@param cls A class.
@return A class info, or nil if an error occurs.
*/
+ (nullable instancetype)classInfoWithClass:(Class)cls;
/**
Get the class info of a specified Class.
@discussion This method will cache the class info and super-class info
at the first access to the Class. This method is thread-safe.
@param className A class name.
@return A class info, or nil if an error occurs.
*/
+ (nullable instancetype)classInfoWithClassName:(NSString *)className;@end
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE401_Memory_Leak__char_malloc_66a.c
Label Definition File: CWE401_Memory_Leak.c.label.xml
Template File: sources-sinks-66a.tmpl.c
*/
/*
* @description
* CWE: 401 Memory Leak
* BadSource: malloc Allocate data using malloc()
* GoodSource: Allocate data on the stack
* Sinks:
* GoodSink: call free() on data
* BadSink : no deallocation of data
* Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE401_Memory_Leak__char_malloc_66b_badSink(char * dataArray[]);
void CWE401_Memory_Leak__char_malloc_66_bad()
{
char * data;
char * dataArray[5];
data = NULL;
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (char *)malloc(100*sizeof(char));
/* Initialize and make use of data */
strcpy(data, "A String");
printLine(data);
/* put data in array */
dataArray[2] = data;
CWE401_Memory_Leak__char_malloc_66b_badSink(dataArray);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE401_Memory_Leak__char_malloc_66b_goodG2BSink(char * dataArray[]);
static void goodG2B()
{
char * data;
char * dataArray[5];
data = NULL;
/* FIX: Use memory allocated on the stack with ALLOCA */
data = (char *)ALLOCA(100*sizeof(char));
/* Initialize and make use of data */
strcpy(data, "A String");
printLine(data);
dataArray[2] = data;
CWE401_Memory_Leak__char_malloc_66b_goodG2BSink(dataArray);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE401_Memory_Leak__char_malloc_66b_goodB2GSink(char * dataArray[]);
static void goodB2G()
{
char * data;
char * dataArray[5];
data = NULL;
/* POTENTIAL FLAW: Allocate memory on the heap */
data = (char *)malloc(100*sizeof(char));
/* Initialize and make use of data */
strcpy(data, "A String");
printLine(data);
dataArray[2] = data;
CWE401_Memory_Leak__char_malloc_66b_goodB2GSink(dataArray);
}
void CWE401_Memory_Leak__char_malloc_66_good()
{
goodG2B();
goodB2G();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
its own for testing or for building a binary to use in testing binary
analysis tools. It is not used when compiling all the testcases as one
application, which is how source code analysis tools are tested. */
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE401_Memory_Leak__char_malloc_66_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE401_Memory_Leak__char_malloc_66_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef AUTHORIZETESTCASE_H
#define AUTHORIZETESTCASE_H
#include <QObject>
#include <TestCases/testcasebase.h>
class AuthorizeTestCase : public TestCaseBase
{
Q_OBJECT
public:
AuthorizeTestCase(QString testClientId, int& requestid, QObject *parent = NULL);
void startTest(QWebSocket* webSocket);
signals:
void finished(bool result);
public slots:
void forceStop();
void onTextMessageReceived(QString message);
};
#endif // AUTHORIZETESTCASE_H
|
//The header for a car object
//car objects are always managed by the roads!
#ifndef G2_CAR_OBJECT_INCLUDE
#define G2_CAR_OBJECT_INCLUDE
#include "objs/map_piece.h"
class g2_car_object_class :
public g1_map_piece_class
{
friend class act_manager;
public:
//g1_mini_object *back_wheels;
//g1_mini_object *front_wheels;
//w32 *route_quality;
g1_id_ref * last_route;
w32 route_len;
w32 start_time;
w32 required_arrival_time;
w32 arrival_time;
w32 car_id;
i4_bool linked;
link_id start_link, dest_link;
w32 act_link_start_time;
public:
enum {
CAR_DATA_VERSION=2
};
g2_car_object_class * next; //for i4_isl_list template
enum {
TIME_UNKNOWN=0xffffffff,
TIME_NOTYET=0xfffffffe
};
g2_car_object_class(g1_object_type id, g1_loader_class * fp);
void request_remove();
void save(g1_saver_class * fp);
void think();
i4_bool occupy_location();
void unoccupy_location();
i4_bool can_attack(g1_object_class * who)
{
return i4_F;
}
virtual void draw(g1_draw_context_class * context, i4_3d_vector& viewer_position);
li_object *message(li_symbol * message_name,
li_object * message_params,
li_environment * env);
//the following starts the voyage of this vehicle
//it returns false if car cannot start now (link full, engine failure...)
i4_bool start(w32 current_time,link_id for_dest);
i4_str *get_context_string();
w32 calc_new_start_time(w32 olds,w32 reqarr, w32 actarr);
double calc_util(w32 ttrip,w32 tearly,w32 tlate);
};
extern i4_isl_list<g1_path_object_class> g1_path_object_list;
extern i4_isl_list<g2_car_object_class> g2_car_object_list;
#endif
|
#ifndef __mekdotlu_log_h
#define __mekdotlu_log_h
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
struct log_cfg {
/* log file path */
char *file;
int forcecolor;
int _fd;
};
int log_init(struct log_cfg *cfg);
int log_kill(struct log_cfg *cfg);
int log_raw(
const struct log_cfg *cfg,
const char *format,
const char *prefix,
const char *color,
...
);
int log_err(const struct log_cfg *cfg, const char *format, ...);
int log_wrn(const struct log_cfg *cfg, const char *format, ...);
int log_ok(const struct log_cfg *cfg, const char *format, ...);
int log_reg(const struct log_cfg *cfg, const char *format, ...);
int log_perror(const struct log_cfg *cfg, int err, const char *prefix, ...);
#endif /* __mekdotlu_log_h */
/* vi: set sts=8 ts=8 sw=8 noexpandtab: */
|
#ifndef FIGURA_H
#define FIGURA_H
class Figura {
public:
Figura (float x, float y);
// draw() é virtual puro, pois a classe
// Figura é base para as demais
virtual void draw() = 0;
virtual bool acertou(int, int) = 0;
protected:
float x,y;
};
#endif
|
//
// OuttaTimeViewController.h
// OuttaTimeObjectiveC
//
// Created by Pedro Trujillo on 11/9/15.
// Copyright © 2015 Pedro Trujillo. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OuttaTimeViewController : UIViewController
@property(nonatomic) NSString * lastTimeDeparted;
@property(nonatomic) NSTimer * timerBack;
@property(nonatomic) int currentSpeed;
@property(nonatomic) NSDate * currentDate;
@property (weak, nonatomic) IBOutlet UILabel *presentTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *DestinationTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *LastTimeDepartedLabel;
@property (weak, nonatomic) IBOutlet UILabel *SpeedLabel;
-(NSString *) setDateTimeAndFormat:(NSDate *)seclectedDate;
@end
|
//
// LibraryObject.h
// ProjectCrystalBlue-iOS
//
// Created by Justin Baumgartner on 1/30/14.
// Copyright (c) 2014 Library Object. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface LibraryObject : NSObject
@property(readonly,copy) NSString *key;
@property NSMutableDictionary *attributes;
- (id)initWithKey:(NSString *)aKey
AndWithAttributes:(NSArray *)attributeNames
AndValues:(NSArray *)attributeValues;
- (id)initWithKey:(NSString *)aKey
AndWithAttributeDictionary:(NSDictionary *)attr;
@end |
/*
* applications-search-provider: Search provider for searching installed
* applications
*
* Copyright 2012-2015 Stephan Haller <nomad@froevel.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 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., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
#ifndef __XFDASHBOARD_APPLICATIONS_SEARCH_PROVIDER__
#define __XFDASHBOARD_APPLICATIONS_SEARCH_PROVIDER__
#include "search-provider.h"
G_BEGIN_DECLS
#define XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER (xfdashboard_applications_search_provider_get_type())
#define XFDASHBOARD_APPLICATIONS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER, XfdashboardApplicationsSearchProvider))
#define XFDASHBOARD_IS_APPLICATIONS_SEARCH_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER))
#define XFDASHBOARD_APPLICATIONS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER, XfdashboardApplicationsSearchProviderClass))
#define XFDASHBOARD_IS_APPLICATIONS_SEARCH_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER))
#define XFDASHBOARD_APPLICATIONS_SEARCH_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), XFDASHBOARD_TYPE_APPLICATIONS_SEARCH_PROVIDER, XfdashboardApplicationsSearchProviderClass))
typedef struct _XfdashboardApplicationsSearchProvider XfdashboardApplicationsSearchProvider;
typedef struct _XfdashboardApplicationsSearchProviderPrivate XfdashboardApplicationsSearchProviderPrivate;
typedef struct _XfdashboardApplicationsSearchProviderClass XfdashboardApplicationsSearchProviderClass;
struct _XfdashboardApplicationsSearchProvider
{
/* Parent instance */
XfdashboardSearchProvider parent_instance;
/* Private structure */
XfdashboardApplicationsSearchProviderPrivate *priv;
};
struct _XfdashboardApplicationsSearchProviderClass
{
/*< private >*/
/* Parent class */
XfdashboardSearchProviderClass parent_class;
/*< public >*/
/* Virtual functions */
};
/* Public API */
GType xfdashboard_applications_search_provider_get_type(void) G_GNUC_CONST;
G_END_DECLS
#endif /* __XFDASHBOARD_APPLICATIONS_SEARCH_PROVIDER__ */
|
#ifndef _CLASS_SAMPLEGENERATORVISITOR_ABC
#define _CLASS_SAMPLEGENERATORVISITOR_ABC
class Sample;
class Tree;
class Robot;
class Obstacle;
class SampleGeneratorVisitor_ABC {
public:
SampleGeneratorVisitor_ABC();
~SampleGeneratorVisitor_ABC();
public:
// TODO tree must be const
virtual void Visit(const Robot& /*robot*/, /*const*/Tree& /*tree*/, Sample& /*sample*/);
virtual void Visit(const Robot& /*robot*/, /*const*/Tree& /*tree*/, Sample& /*sample*/, const Obstacle& /*obstacle*/);
private:
};
#endif //_CLASS_SAMPLEGENERATORVISITOR_ABC |
/*
* USART.c
*
* Amherst College Electronics Club - Nov 2013
* Author: André Lucas Antunes de Sá
*/
#include "USART.h"
void USARTInit(const uint16_t ubrr)
{
UBRR0L = ubrr; //Set Baud Rate
UBRR0H = (ubrr>>8);
/*Set Frame Format. This is the default for Asynchronous serial
>> Asynchronous mode
>> No Parity
>> 1 StopBit
>> char size 8
*/
UCSR0C = (1<<UCSZ00)|(1<<UCSZ01); //8-bit frame
UCSR0B = (1<<RXEN0)|(1<<TXEN0); //Enable TX and RX
}
char USARTReadChar()
{
//Wait until data is available or bail out
uint8_t i = 255U;
while(!(UCSR0A & (1<<RXC0))){
if(i==0)
{
break;
}
--i;
_delay_us(10);
}
//USART has gotten data from device and is available on the buffer
return UDR0;
}
void USARTWriteChar(const char data)
{
//Wait until the transmitter is ready or bail out
uint8_t i = 255U;
while(!(UCSR0A & (1<<UDRE0))){
if(i==0)
{
break;
}
--i;
_delay_us(10);
}
//Write the data to USART buffer
UDR0 = data;
}
void USARTPrint(const char *data) //Sends a series of characters through the serial until the string ends with a termination character, i.e. a 0
{
for (uint16_t i=0; data[i]!=0; ++i)
{
while(!(UCSR0A & (1<<UDRE0)));
UDR0 = data[i];
}
} |
/***************************************************************************
menu_aft_logical_channels_list.h - description
-------------------
begin : Wed Apr 7 2004
copyright : (C) 2004 by David Rokhvarg
email : davidr@sangoma.com
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
#ifndef MENU_AFT_LOGICAL_CHANNELS_LIST_H
#define MENU_AFT_LOGICAL_CHANNELS_LIST_H
#include "menu_base.h"
#include "conf_file_reader.h"
/**
*@author David Rokhvarg
*/
class menu_aft_logical_channels_list : public menu_base {
char lxdialog_path[MAX_PATH_LENGTH];
conf_file_reader* cfr;
link_def_t *link_defs;
wandev_conf_t *linkconf;
unsigned int max_valid_number_of_logical_channels;
int create_logical_channels_list_str(string& menu_str);
int adjust_number_of_groups_of_channels(IN objects_list * obj_list,
IN unsigned int new_number_of_groups_of_channels);
int check_bound_channels_not_overlapping();
public:
menu_aft_logical_channels_list(IN char * lxdialog_path, IN conf_file_reader* cfr);
~menu_aft_logical_channels_list();
int run(OUT int * selection_index);
};
#endif
|
#ifndef __ASM_AVR32_DMA_MAPPING_H
#define __ASM_AVR32_DMA_MAPPING_H
#include <linux/mm.h>
#include <linux/device.h>
#include <linux/scatterlist.h>
#include <asm/processor.h>
#include <asm/cacheflush.h>
#include <asm/io.h>
extern void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
int direction);
static inline int dma_supported(struct device *dev, u64 mask)
{
/* Fix when needed. I really don't know of any limitations */
return 1;
}
static inline int dma_set_mask(struct device *dev, u64 dma_mask)
{
if (!dev->dma_mask || !dma_supported(dev, dma_mask))
return -EIO;
*dev->dma_mask = dma_mask;
return 0;
}
static inline int dma_mapping_error(struct device *dev, dma_addr_t addr)
{
return 0;
}
extern void *dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t gfp);
extern void dma_free_coherent(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t handle);
extern void *dma_alloc_writecombine(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t gfp);
extern void dma_free_writecombine(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t handle);
static inline dma_addr_t
dma_map_single(struct device *dev, void *cpu_addr, size_t size,
enum dma_data_direction direction)
{
dma_cache_sync(dev, cpu_addr, size, direction);
return virt_to_bus(cpu_addr);
}
static inline void
dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
enum dma_data_direction direction)
{
}
static inline dma_addr_t
dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction direction)
{
return dma_map_single(dev, page_address(page) + offset,
size, direction);
}
static inline void
dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
enum dma_data_direction direction)
{
dma_unmap_single(dev, dma_address, size, direction);
}
static inline int
dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
enum dma_data_direction direction)
{
int i;
for (i = 0; i < nents; i++) {
char *virt;
sg[i].dma_address = page_to_bus(sg_page(&sg[i])) + sg[i].offset;
virt = sg_virt(&sg[i]);
dma_cache_sync(dev, virt, sg[i].length, direction);
}
return nents;
}
static inline void
dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
enum dma_data_direction direction)
{
}
static inline void
dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle,
size_t size, enum dma_data_direction direction)
{
/*
* No need to do anything since the CPU isn't supposed to
* touch this memory after we flushed it at mapping- or
* sync-for-device time.
*/
}
static inline void
dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle,
size_t size, enum dma_data_direction direction)
{
dma_cache_sync(dev, bus_to_virt(dma_handle), size, direction);
}
static inline void
dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
unsigned long offset, size_t size,
enum dma_data_direction direction)
{
/* just sync everything, that's all the pci API can do */
dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
}
static inline void
dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
unsigned long offset, size_t size,
enum dma_data_direction direction)
{
/* just sync everything, that's all the pci API can do */
dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
}
static inline void
dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction direction)
{
/*
* No need to do anything since the CPU isn't supposed to
* touch this memory after we flushed it at mapping- or
* sync-for-device time.
*/
}
static inline void
dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction direction)
{
int i;
for (i = 0; i < nents; i++) {
dma_cache_sync(dev, sg_virt(&sg[i]), sg[i].length, direction);
}
}
/* Now for the API extensions over the pci_ one */
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
{
return 1;
}
static inline int dma_get_cache_alignment(void)
{
return boot_cpu_data.dcache.linesz;
}
#endif /* __ASM_AVR32_DMA_MAPPING_H */
|
#ifndef GLTEXTURE_H
#define GLTEXTURE_H
#include <curitiba/render/texture.h>
//#include <curitiba/material/textureSampler.h>
#include <curitiba/render/opengl/gltexturesampler.h>
#include <GL/glew.h>
using namespace curitiba::render;
using namespace curitiba::material;
namespace curitiba
{
namespace render
{
class GLTexture : public Texture
{
friend class Texture;
public:
~GLTexture(void);
static std::string StringType[];
static int Type[];
static std::string StringDimension[];
static int Dimension[];
static std::string StringFormat[];
static int Format[];
static std::string StringInternalFormat[];
static int InternalFormat[];
static bool isValidFormat(std::string aFormat);
static bool isValidInternalFormat(std::string anInternalFormat);
virtual void prepare(int unit, TextureSampler *ts);
virtual void restore(int unit);
virtual int getNumberOfComponents(void);
virtual int getDimension(void);
virtual int getInternalFormat (void);
virtual int getType (void);
virtual int getFormat(void);
virtual int getElementSize();
virtual bool getMipmap();
//virtual void prepare(int unit,IState *state);
//virtual void restore(int unit,curitiba::render::IState *state);
//virtual void bind (void);
//virtual void unbind (void);
//void enableCompareToTexture (void);
//void disableCompareToTexture (void);
//void enableObjectSpaceCoordGen (void);
//void generateObjectSpaceCoords (TextureCoord aCoord, float *plane);
protected:
GLTexture (std::string label, std::string internalFormat,
std::string aFormat, std::string aType, int width, int height,
void* data = NULL, bool mipmap = true );
GLTexture (std::string label);
void setData(std::string internalFormat, std::string aFormat,
std::string aType, int width, int height, unsigned char * data = NULL);
static int getIndex(std::string StringArray[], int IntArray[], std::string aString);
GLenum translateCoord (TextureCoord aCoord);
int m_Dimension;
int m_Format;
int m_InternalFormat;
int m_Type;
bool m_Mipmap;
//GLenum translateDimension (TextureDimension aDimension);
//void setData(std::string internalFormat, std::string aFormat,
// std::string aType, int width, int height);
//GLTexture (std::string label, std::string internalFormat,
// std::string aFormat, std::string aType, int width, int height);
//GLenum translateFormat (TextureFormat aFormat);
//GLenum translateInternalFormat (TextureFormat aFormat);
//GLenum translateType (TextureType aType);
//GLenum translateTexWrapMode (TextureSampler::TextureWrapMode aMode);
//GLenum translateTexEnvMode (TextureSampler::TextureEnvMode aMode);
//GLenum translateTexCompareMode (TextureSampler::TextureCompareMode aMode);
//GLenum translateTexMagMode (TextureSampler::TextureMagMode aMode);
//GLenum translateTexMinMode (TextureSampler::TextureMinMode aMode);
//GLenum translateTexCompareFunc (TextureSampler::TextureCompareFunc aFunc);
//GLTexture(void) {};
};
};
};
#endif
|
/* fre:ac - free audio converter
* Copyright (C) 2001-2021 Robert Kausch <robert.kausch@freac.org>
*
* 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 PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. */
#ifndef H_FREAC_PROGRESS
#define H_FREAC_PROGRESS
#include <smooth.h>
#include <boca.h>
using namespace smooth;
namespace freac
{
class Progress
{
private:
static Array<Progress *> progressIndicators;
Threads::Mutex mutex;
Window *window;
protected:
const BoCA::Config *configuration;
Bool consoleMode;
UnsignedInt64 lastInvoked;
Int64 totalSamplesLeft;
Int totalSamplesMultiplier;
Float totalProgressDone;
Array<BoCA::Track> trackList;
Array<UnsignedInt64> trackStartTicks;
Array<Int64> trackPositions;
UnsignedInt64 startTicks;
UnsignedInt64 pauseTicks;
public:
Progress(const BoCA::Config *);
~Progress();
Void ComputeTotalSamples(const Array<BoCA::Track> &);
Void FixTotalSamples(const BoCA::Track &, const BoCA::Track &);
Int64 GetTotalSamples() const;
Void Start();
Void Pause();
Void Resume();
Void StartTrack(const BoCA::Track &);
Void UpdateTrack(const BoCA::Track &, Int64);
Void FinishTrack(const BoCA::Track &, Bool);
signals:
Signal4<Void, Int, Int, Int, Int> onReportProgress;
};
};
#endif
|
#pragma once
#include "Window.h"
class SimpleWindow : public Window{
public:
void draw() {
// implements simple window
}
string getDescription() {
return "simple window";
}
}; |
/* $Id$ */
/* DO NOT EDIT - file generated by ObitTables.pl */
/*--------------------------------------------------------------------*/
/*; Copyright (C) 2013 */
/*; Associated Universities, Inc. Washington DC, USA. */
/*; */
/*; 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 Massachusetts Ave, Cambridge, */
/*; MA 02139, USA. */
/*; */
/*;Correspondence about this software should be addressed as follows: */
/*; Internet email: bcotton@nrao.edu. */
/*; Postal address: William Cotton */
/*; National Radio Astronomy Observatory */
/*; 520 Edgemont Road */
/*; Charlottesville, VA 22903-2475 USA */
/*--------------------------------------------------------------------*/
/* Define the basic components of the ObitTableIDI_INTERFEROMETER_MODEL structure */
/* This is intended to be included in a class structure definition */
/**
* \file ObitTableIDI_INTERFEROMETER_MODELDef.h
* ObitTableIDI_INTERFEROMETER_MODEL structure members for derived classes.
*/
#include "ObitTableDef.h" /* Parent class definitions */
/** Table format revision number */
oint tabrev;
/** [OPTIONAL] The number of polarizations */
oint numPol;
/** Number of polynomial parameters */
oint npoly;
/** Number of Stokes parameters */
oint no_stkd;
/** First Stokes parameter */
oint stk_1;
/** [OPTIONAL] Number of frequency bands */
oint no_band;
/** Number of frequency channels */
oint no_chan;
/** Reference frequency (Hz) */
odouble ref_freq;
/** Channel bandwidth (Hz) */
odouble chan_bw;
/** Reference frequency bin */
oint ref_pixl;
/** Observation project code */
gchar obscode[MAXKEYCHARTABLEIDI_INTERFEROMETER_MODEL];
/** Column offset for The center time. in table record */
olong TimeOff;
/** Physical column number for The center time. in table record */
olong TimeCol;
/** Column offset for Time interval of record in table record */
olong TimeIOff;
/** Physical column number for Time interval of record in table record */
olong TimeICol;
/** Column offset for Source ID number in table record */
olong SourIDOff;
/** Physical column number for Source ID number in table record */
olong SourIDCol;
/** Column offset for Antenna number in table record */
olong antennaNoOff;
/** Physical column number for Antenna number in table record */
olong antennaNoCol;
/** Column offset for Array number in table record */
olong ArrayOff;
/** Physical column number for Array number in table record */
olong ArrayCol;
/** Column offset for Frequency ID in table record */
olong FreqIDOff;
/** Physical column number for Frequency ID in table record */
olong FreqIDCol;
/** Column offset for Ionospheric Faraday Rotation in table record */
olong IFROff;
/** Physical column number for Ionospheric Faraday Rotation in table record */
olong IFRCol;
/** Column offset for FREQ.VAR (?) in table record */
olong FreqVarOff;
/** Physical column number for FREQ.VAR (?) in table record */
olong FreqVarCol;
/** Column offset for Phase delay in table record */
olong PDelay1Off;
/** Physical column number for Phase delay in table record */
olong PDelay1Col;
/** Column offset for Group delay in table record */
olong GDelay1Off;
/** Physical column number for Group delay in table record */
olong GDelay1Col;
/** Column offset for Phase delay rate in table record */
olong PRate1Off;
/** Physical column number for Phase delay rate in table record */
olong PRate1Col;
/** Column offset for Group delay rate in table record */
olong GRate1Off;
/** Physical column number for Group delay rate in table record */
olong GRate1Col;
/** Column offset for Dispersion in table record */
olong Disp1Off;
/** Physical column number for Dispersion in table record */
olong Disp1Col;
/** Column offset for Dispersion rate in table record */
olong DRate1Off;
/** Physical column number for Dispersion rate in table record */
olong DRate1Col;
/** Column offset for Phase delay in table record */
olong PDelay2Off;
/** Physical column number for Phase delay in table record */
olong PDelay2Col;
/** Column offset for Group delay in table record */
olong GDelay2Off;
/** Physical column number for Group delay in table record */
olong GDelay2Col;
/** Column offset for Phase delay rate in table record */
olong PRate2Off;
/** Physical column number for Phase delay rate in table record */
olong PRate2Col;
/** Column offset for Group delay rate in table record */
olong GRate2Off;
/** Physical column number for Group delay rate in table record */
olong GRate2Col;
/** Column offset for Dispersion in table record */
olong Disp2Off;
/** Physical column number for Dispersion in table record */
olong Disp2Col;
/** Column offset for Dispersion rate in table record */
olong DRate2Off;
/** Physical column number for Dispersion rate in table record */
olong DRate2Col;
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_
#define NET_WEBSOCKETS_WEBSOCKET_HANDSHAKE_HANDLER_H_
#include <string>
#include <vector>
#include "net/base/net_export.h"
#include "net/http/http_request_info.h"
#include "net/http/http_response_info.h"
#include "net/spdy/spdy_header_block.h"
namespace net {
void ComputeSecWebSocketAccept(const std::string& key,
std::string* accept);
class NET_EXPORT_PRIVATE WebSocketHandshakeRequestHandler {
public:
WebSocketHandshakeRequestHandler();
~WebSocketHandshakeRequestHandler() {}
bool ParseRequest(const char* data, int length);
size_t original_length() const;
void AppendHeaderIfMissing(const std::string& name,
const std::string& value);
void RemoveHeaders(const char* const headers_to_remove[],
size_t headers_to_remove_len);
HttpRequestInfo GetRequestInfo(const GURL& url, std::string* challenge);
bool GetRequestHeaderBlock(const GURL& url,
SpdyHeaderBlock* headers,
std::string* challenge,
int spdy_protocol_version);
std::string GetRawRequest();
size_t raw_length() const;
private:
std::string request_line_;
std::string headers_;
int original_length_;
int raw_length_;
DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeRequestHandler);
};
class NET_EXPORT_PRIVATE WebSocketHandshakeResponseHandler {
public:
WebSocketHandshakeResponseHandler();
~WebSocketHandshakeResponseHandler();
size_t ParseRawResponse(const char* data, int length);
bool HasResponse() const;
bool ParseResponseInfo(const HttpResponseInfo& response_info,
const std::string& challenge);
bool ParseResponseHeaderBlock(const SpdyHeaderBlock& headers,
const std::string& challenge,
int spdy_protocol_version);
void GetHeaders(const char* const headers_to_get[],
size_t headers_to_get_len,
std::vector<std::string>* values);
void RemoveHeaders(const char* const headers_to_remove[],
size_t headers_to_remove_len);
std::string GetRawResponse() const;
std::string GetResponse();
private:
std::string original_;
int original_header_length_;
std::string status_line_;
std::string headers_;
std::string header_separator_;
DISALLOW_COPY_AND_ASSIGN(WebSocketHandshakeResponseHandler);
};
}
#endif
|
#include <pthread.h>
#include "tlpi_hdr.h"
static void *threadFunc(void *x)
{
return x;
}
int main(int argc, char *argv[])
{
pthread_t thr;
pthread_attr_t attr;
int s;
s = pthread_attr_init(&attr);
if (s != 0)
errExitEN(s, "pthread_attr_init");
s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (s != 0)
errExitEN(s, "pthread_attr_satdatevhstate");
s = pthread_create(&thr, &attr, threadFunc, (void *) 1);
if (s != 0)
errExitEN(s, "pthread_create");
s = pthread_attr_destroy(&attr);
if (s != 0)
errExitEN(s, "pthread_attr_destroy");
s = pthread_join(thr, NULL);
if (s != 0)
errExitEN(s, "pthread_join failed");
exit(EXIT_SUCCESS);
}
|
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "dbus-target.h"
#include "log.h"
#include "serialize.h"
#include "special.h"
#include "string-util.h"
#include "target.h"
#include "unit-name.h"
#include "unit.h"
static const UnitActiveState state_translation_table[_TARGET_STATE_MAX] = {
[TARGET_DEAD] = UNIT_INACTIVE,
[TARGET_ACTIVE] = UNIT_ACTIVE
};
static void target_set_state(Target *t, TargetState state) {
TargetState old_state;
assert(t);
old_state = t->state;
t->state = state;
if (state != old_state)
log_debug("%s changed %s -> %s",
UNIT(t)->id,
target_state_to_string(old_state),
target_state_to_string(state));
unit_notify(UNIT(t), state_translation_table[old_state], state_translation_table[state], 0);
}
static int target_add_default_dependencies(Target *t) {
static const UnitDependency deps[] = {
UNIT_REQUIRES,
UNIT_REQUISITE,
UNIT_WANTS,
UNIT_BINDS_TO,
UNIT_PART_OF
};
int r;
unsigned k;
assert(t);
if (!UNIT(t)->default_dependencies)
return 0;
/* Imply ordering for requirement dependencies on target units. Note that when the user created a contradicting
* ordering manually we won't add anything in here to make sure we don't create a loop. */
for (k = 0; k < ELEMENTSOF(deps); k++) {
Unit *other;
Iterator i;
void *v;
HASHMAP_FOREACH_KEY(v, other, UNIT(t)->dependencies[deps[k]], i) {
r = unit_add_default_target_dependency(other, UNIT(t));
if (r < 0)
return r;
}
}
if (unit_has_name(UNIT(t), SPECIAL_SHUTDOWN_TARGET))
return 0;
/* Make sure targets are unloaded on shutdown */
return unit_add_two_dependencies_by_name(UNIT(t), UNIT_BEFORE, UNIT_CONFLICTS, SPECIAL_SHUTDOWN_TARGET, true, UNIT_DEPENDENCY_DEFAULT);
}
static int target_load(Unit *u) {
Target *t = TARGET(u);
int r;
assert(t);
r = unit_load_fragment_and_dropin(u);
if (r < 0)
return r;
/* This is a new unit? Then let's add in some extras */
if (u->load_state == UNIT_LOADED) {
r = target_add_default_dependencies(t);
if (r < 0)
return r;
}
return 0;
}
static int target_coldplug(Unit *u) {
Target *t = TARGET(u);
assert(t);
assert(t->state == TARGET_DEAD);
if (t->deserialized_state != t->state)
target_set_state(t, t->deserialized_state);
return 0;
}
static void target_dump(Unit *u, FILE *f, const char *prefix) {
Target *t = TARGET(u);
assert(t);
assert(f);
fprintf(f,
"%sTarget State: %s\n",
prefix, target_state_to_string(t->state));
}
static int target_start(Unit *u) {
Target *t = TARGET(u);
int r;
assert(t);
assert(t->state == TARGET_DEAD);
r = unit_acquire_invocation_id(u);
if (r < 0)
return r;
target_set_state(t, TARGET_ACTIVE);
return 1;
}
static int target_stop(Unit *u) {
Target *t = TARGET(u);
assert(t);
assert(t->state == TARGET_ACTIVE);
target_set_state(t, TARGET_DEAD);
return 1;
}
static int target_serialize(Unit *u, FILE *f, FDSet *fds) {
Target *s = TARGET(u);
assert(s);
assert(f);
assert(fds);
(void) serialize_item(f, "state", target_state_to_string(s->state));
return 0;
}
static int target_deserialize_item(Unit *u, const char *key, const char *value, FDSet *fds) {
Target *s = TARGET(u);
assert(u);
assert(key);
assert(value);
assert(fds);
if (streq(key, "state")) {
TargetState state;
state = target_state_from_string(value);
if (state < 0)
log_debug("Failed to parse state value %s", value);
else
s->deserialized_state = state;
} else
log_debug("Unknown serialization key '%s'", key);
return 0;
}
_pure_ static UnitActiveState target_active_state(Unit *u) {
assert(u);
return state_translation_table[TARGET(u)->state];
}
_pure_ static const char *target_sub_state_to_string(Unit *u) {
assert(u);
return target_state_to_string(TARGET(u)->state);
}
const UnitVTable target_vtable = {
.object_size = sizeof(Target),
.sections =
"Unit\0"
"Target\0"
"Install\0",
.load = target_load,
.coldplug = target_coldplug,
.dump = target_dump,
.start = target_start,
.stop = target_stop,
.serialize = target_serialize,
.deserialize_item = target_deserialize_item,
.active_state = target_active_state,
.sub_state_to_string = target_sub_state_to_string,
.bus_vtable = bus_target_vtable,
.status_message_formats = {
.finished_start_job = {
[JOB_DONE] = "Reached target %s.",
},
.finished_stop_job = {
[JOB_DONE] = "Stopped target %s.",
},
},
};
|
/* ------------------------------------------------------------------------
* Program : eval_pwlinear.c
* Author : Rajiv Singh
*
* Copyright 2007 The MathWorks, Inc.
* $Revision: 1.1.8.1 $ $Date: 2007/11/09 20:17:40 $
*
* Purpose : Evaluate pwlinear nonlinearity
* ------------------------------------------------------------------------*/
/* NOTE: DO NOT ASSIGN MEMORY ANYWHERE IN THIS CODE! */
#include "idsfuncommon.h"
#include "eval_pwlinear.h"
/* -------------------------------------------------------------------
* Purpose: Calculate the contribution of nonlinearity, which is sum
* of triangular units
* -------------------------------------------------------------------
*/
void addPwlinearNLResp
(
real_T *y,
const real_T *X,
real_T *T,
real_T *Coef,
uint_T NumRows,
uint_T NumUnits
)
{
/*
* Xnl: input variable, NumRows-by-DimXnl matrix
* D: dilation parameters, DimXnl-by-NumUnits vector
* T: translation parameters, 1-by-NumUnits matrix
* Coef: output coefficients (NumUnits-by-1 vector)
* [NumRows,DimXnl] = size(Xnl)
* NumUnits = number of basis function terms (NumberOfUnits property)
* y: output vector (NumRows-by-1)
*/
int_T i, j;
for(j=0; j<NumRows; j++){
for(i=0; i<NumUnits; i++){
/* basis fcn |x| */
y[j] += (fabs(X[j]+T[i])) * Coef[i];
}
}
}
/* ---------------------------------------------------------------------
* Purpose: Evaluate the nonlinearity for given parameters and regressors
* --------------------------------------------------------------------- */
void evaluate_pwlinear
(
real_T *y,
const real_T *X,
uint_T NumRows,
ParStruc *Par
)
{
/* y: output
* X: regressor matrix
* Par: parameters required for simulation
* NumRows: number of time samples (=number of rows of X) (=1 for S function)
* NOTE: DimInp = number of regressors, is always 1.
*/
int_T i;
/* initialize output matrix */
for(i=0; i<NumRows; i++){
y[i] = 0.0;
}
/* add linear component of response */
if (Par->DimXlin==1){
for(i=0; i<NumRows; i++){
y[i] += X[i]*Par->LinearCoef[0] + Par->OutputOffset;
}
}
if ( Par->NumberOfUnits>0 ){
/* add contribution of nonlinearity */
addPwlinearNLResp(y, X, Par->Translation, Par->OutputCoef,
NumRows, Par->NumberOfUnits);
} /* if */
} /* evaluate_pwlinear */
|
#include "special_files.h"
typedef struct _SymlinksData SymlinksData;
void
symlinks_init (SymlinksData **sl_data, gint panel);
void
symlinks_add_file (SymlinksData *sl_data,
GtkTreeIter *iter,
const GnomeVFSFileInfo *info,
const GnomeVFSURI *uri);
void
symlinks_execute (SymlinksData *sl_data);
void
symlinks_abort (SymlinksData *sl_data);
|
#ifndef LINUX_MMC_SH_MOBILE_SDHI_H
#define LINUX_MMC_SH_MOBILE_SDHI_H
#include <linux/types.h>
struct platform_device;
#define SH_MOBILE_SDHI_IRQ_CARD_DETECT "card_detect"
#define SH_MOBILE_SDHI_IRQ_SDCARD "sdcard"
#define SH_MOBILE_SDHI_IRQ_SDIO "sdio"
/**
* struct sh_mobile_sdhi_ops - SDHI driver callbacks
* @cd_wakeup: trigger a card-detection run
*/
struct sh_mobile_sdhi_ops {
void (*cd_wakeup)(const struct platform_device *pdev);
};
struct sh_mobile_sdhi_info {
int dma_slave_tx;
int dma_slave_rx;
unsigned long tmio_flags;
unsigned long tmio_caps;
unsigned long tmio_caps2;
u32 tmio_ocr_mask; /* available MMC voltages */
unsigned int cd_gpio;
dma_addr_t dma_rx_offset;
/* callbacks for board specific setup code */
int (*init)(struct platform_device *pdev,
const struct sh_mobile_sdhi_ops *ops);
void (*cleanup)(struct platform_device *pdev);
};
#endif /* LINUX_MMC_SH_MOBILE_SDHI_H */
|
/*
* These routines are helpers - note that this file gets linked into all the
* zip-access variants that refer to <zzip/format.h>. On the x86 platform the
* actual definitions will be empty - fetching is done on native machine-level
*
* Author:
* Guido Draheim <guidod@gmx.de>
*
* Copyright (c) 2004,2005,2006 Guido Draheim
* All rights reserved,
* use under the restrictions of the
* Lesser GNU General Public License
* or alternatively the restrictions
* of the Mozilla Public License 1.1
*/
#include <zzip/fetch.h>
#include "utils/heapcheck.h"
#if defined ZZIP_WORDS_BIGENDIAN && \
defined bswap_16 && defined bswap_32 && defined bswap_64
# define __ZZIP_GET16(__p) bswap_16(*(uint16_t*)(__p))
# define __ZZIP_GET32(__p) bswap_32(*(uint32_t*)(__p))
# define __ZZIP_SET16(__p,__x) (*(uint16_t*)(__p) = bswap_16((uint16_t)(__x)))
# define __ZZIP_SET32(__p,__x) (*(uint32_t*)(__p) = bswap_32((uint32_t)(__x)))
# define __ZZIP_GET64(__p) bswap_64(*(zzip_off64_t*)(__p))
# define __ZZIP_SET64(__p,__x) \
(*(zzip_off64_t*)(__p) = bswap_64((zzip_off64_t)(__x)))
#endif
/* ------------------------- fetch helpers --------------------------------- */
/**
* Make 32 bit value in host byteorder from little-endian mapped octet-data
* (works also on machines which SIGBUS on misaligned data access (eg. 68000))
*/
uint32_t __zzip_get32(unsigned char * s)
{
#if defined __ZZIP_GET32
return __ZZIP_GET32(s);
#else
return ((uint32_t)s[3] << 24) | ((uint32_t)s[2] << 16)
| ((uint32_t)s[1] << 8) | ((uint32_t)s[0]);
#endif
}
/** => __zzip_get32
* This function does the same for a 16 bit value.
*/
uint16_t __zzip_get16(unsigned char * s)
{
#if defined __ZZIP_GET16
return __ZZIP_GET16(s);
#else
return ((uint16_t)s[1] << 8) | ((uint16_t)s[0]);
#endif
}
/** => __zzip_get32
* This function does the same for an off64_t value.
*/
uint64_t __zzip_get64(unsigned char * s)
{
#ifdef __GNUC__
/* *INDENT-OFF* */
register uint64_t v
= s[7]; v <<= 8;
v |= s[6]; v <<= 8;
v |= s[5]; v <<= 8;
v |= s[4]; v <<= 8;
v |= s[3]; v <<= 8;
v |= s[2]; v <<= 8;
v |= s[1]; v <<= 8;
v |= s[0]; return v;
/* *INDENT-ON* */
#else
return ((uint64_t)s[7] << 56) | ((uint64_t)s[6] << 48)
| ((uint64_t)s[5] << 40) | ((uint64_t)s[4] << 32)
| ((uint64_t)s[3] << 24) | ((uint64_t)s[2] << 16)
| ((uint64_t)s[1] << 8) | ((uint64_t)s[0]);
#endif
}
/** => __zzip_get32
* This function pushes a 32bit value at the specified address
*/
void __zzip_set32(unsigned char * s, uint32_t v)
{
#if defined __ZZIP_SET32
return __ZZIP_SET32(s, v);
#else
/* *INDENT-OFF* */
s[0] = (unsigned char) (v); v >>= 8;
s[1] = (unsigned char) (v); v >>= 8;
s[2] = (unsigned char) (v); v >>= 8;
s[3] = (unsigned char) (v);
/* *INDENT-ON* */
#endif
}
/** => __zzip_get32
* This function does the same for a 16 bit value.
*/
void __zzip_set16(unsigned char * s, uint16_t v)
{
#if defined __ZZIP_SET16
return __ZZIP_SET16(s, v);
#else
/* *INDENT-OFF* */
s[0] = (unsigned char) (v); v >>= 8;
s[1] = (unsigned char) (v);
/* *INDENT-ON* */
#endif
}
/** => __zzip_get32
* This function pushes a off64_t value at the specified address
*/
void __zzip_set64(unsigned char * s, uint64_t v)
{
/* *INDENT-OFF* */
s[0] = (unsigned char) (v); v >>= 8;
s[1] = (unsigned char) (v); v >>= 8;
s[2] = (unsigned char) (v); v >>= 8;
s[3] = (unsigned char) (v); v >>= 8;
s[4] = (unsigned char) (v); v >>= 8;
s[5] = (unsigned char) (v); v >>= 8;
s[6] = (unsigned char) (v); v >>= 8;
s[7] = (unsigned char) (v);
/* *INDENT-ON* */
}
///////////
// JMW
/**
* Make 32 bit value in host byteorder from little-endian mapped octet-data
* (works also on machines which SIGBUS on misaligned data access (eg. 68000))
*/
uint32_t __zzip_get32b(unsigned char * s)
{
return ((uint32_t)s[0] << 24) | ((uint32_t)s[1] << 16)
| ((uint32_t)s[2] << 8) | ((uint32_t)s[3]);
}
/** => __zzip_get32
* This function does the same for a 16 bit value.
*/
uint16_t __zzip_get16b(unsigned char * s)
{
return ((uint16_t)s[0] << 8) | ((uint16_t)s[1]);
}
/** => __zzip_get32
* This function does the same for an off64_t value.
*/
uint64_t __zzip_get64b(unsigned char * s)
{
return ((uint64_t)s[0] << 56) | ((uint64_t)s[1] << 48)
| ((uint64_t)s[2] << 40) | ((uint64_t)s[3] << 32)
| ((uint64_t)s[4] << 24) | ((uint64_t)s[5] << 16)
| ((uint64_t)s[6] << 8) | ((uint64_t)s[7]);
}
/** => __zzip_get32
* This function pushes a 32bit value at the specified address
*/
void __zzip_set32b(unsigned char * s, uint32_t v)
{
/* *INDENT-OFF* */
s[3] = (unsigned char) (v); v >>= 8;
s[2] = (unsigned char) (v); v >>= 8;
s[1] = (unsigned char) (v); v >>= 8;
s[0] = (unsigned char) (v);
/* *INDENT-ON* */
}
/** => __zzip_get32
* This function does the same for a 16 bit value.
*/
void __zzip_set16b(unsigned char * s, uint16_t v)
{
/* *INDENT-OFF* */
s[1] = (unsigned char) (v); v >>= 8;
s[0] = (unsigned char) (v);
/* *INDENT-ON* */
}
/** => __zzip_get32
* This function pushes a off64_t value at the specified address
*/
void __zzip_set64b(unsigned char * s, uint64_t v)
{
/* *INDENT-OFF* */
s[7] = (unsigned char) (v); v >>= 8;
s[6] = (unsigned char) (v); v >>= 8;
s[5] = (unsigned char) (v); v >>= 8;
s[4] = (unsigned char) (v); v >>= 8;
s[3] = (unsigned char) (v); v >>= 8;
s[2] = (unsigned char) (v); v >>= 8;
s[1] = (unsigned char) (v); v >>= 8;
s[0] = (unsigned char) (v);
/* *INDENT-ON* */
}
|
#pragma once
#include "../../lib/vcmi_endian.h"
#include "gui/Geometries.h"
#include "../../lib/GameConstants.h"
/*
* CAnimation.h, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*
* License: GNU General Public License v2.0 or later
* Full text of license available in license.txt file, in main folder
*
*/
struct SDL_Surface;
class JsonNode;
class CDefFile;
/*
* Base class for images, can be used for non-animation pictures as well
*/
class IImage
{
int refCount;
public:
//draws image on surface "where" at position
virtual void draw(SDL_Surface * where, int posX = 0, int posY = 0, Rect * src = nullptr, ui8 alpha = 255) const=0;
virtual void draw(SDL_Surface * where, SDL_Rect * dest, SDL_Rect * src, ui8 alpha = 255) const = 0;
virtual std::unique_ptr<IImage> scaleFast(float scale) const = 0;
virtual void exportBitmap(const boost::filesystem::path & path) const = 0;
//decrease ref count, returns true if image can be deleted (refCount <= 0)
bool decreaseRef();
void increaseRef();
//Change palette to specific player
virtual void playerColored(PlayerColor player)=0;
//set special color for flag
virtual void setFlagColor(PlayerColor player)=0;
virtual int width() const=0;
virtual int height() const=0;
//only indexed bitmaps, 16 colors maximum
virtual void shiftPalette(int from, int howMany) = 0;
virtual void horizontalFlip() = 0;
virtual void verticalFlip() = 0;
IImage();
virtual ~IImage() {};
};
/// Class for handling animation
class CAnimation
{
private:
//source[group][position] - file with this frame, if string is empty - image located in def file
std::map<size_t, std::vector <JsonNode> > source;
//bitmap[group][position], store objects with loaded bitmaps
std::map<size_t, std::map<size_t, IImage* > > images;
//animation file name
std::string name;
//if true all frames will be stored in compressed (RLE) state
const bool compressed;
bool preloaded;
//loader, will be called by load(), require opened def file for loading from it. Returns true if image is loaded
bool loadFrame(CDefFile * file, size_t frame, size_t group);
//unloadFrame, returns true if image has been unloaded ( either deleted or decreased refCount)
bool unloadFrame(size_t frame, size_t group);
//initialize animation from file
void initFromJson(const JsonNode & input);
void init(CDefFile * file);
//try to open def file
CDefFile * getFile() const;
//to get rid of copy-pasting error message :]
void printError(size_t frame, size_t group, std::string type) const;
//not a very nice method to get image from another def file
//TODO: remove after implementing resource manager
IImage * getFromExtraDef(std::string filename);
public:
CAnimation(std::string Name, bool Compressed = false);
CAnimation();
~CAnimation();
//duplicates frame at [sourceGroup, sourceFrame] as last frame in targetGroup
//and loads it if animation is preloaded
void duplicateImage(const size_t sourceGroup, const size_t sourceFrame, const size_t targetGroup);
//add custom surface to the selected position.
void setCustom(std::string filename, size_t frame, size_t group=0);
//get pointer to image from specific group, nullptr if not found
IImage * getImage(size_t frame, size_t group=0, bool verbose=true) const;
void exportBitmaps(const boost::filesystem::path & path) const;
//all available frames
void load ();
void unload();
void preload();
//all frames from group
void loadGroup (size_t group);
void unloadGroup(size_t group);
//single image
void load (size_t frame, size_t group=0);
void unload(size_t frame, size_t group=0);
//total count of frames in group (including not loaded)
size_t size(size_t group=0) const;
};
const float DEFAULT_DELTA = 0.05f;
class CFadeAnimation
{
public:
enum class EMode
{
NONE, IN, OUT
};
private:
float delta;
SDL_Surface * fadingSurface;
bool fading;
float fadingCounter;
bool shouldFreeSurface;
float initialCounter() const;
bool isFinished() const;
public:
EMode fadingMode;
CFadeAnimation();
~CFadeAnimation();
void init(EMode mode, SDL_Surface * sourceSurface, bool freeSurfaceAtEnd = false, float animDelta = DEFAULT_DELTA);
void update();
void draw(SDL_Surface * targetSurface, const SDL_Rect * sourceRect, SDL_Rect * destRect);
bool isFading() const { return fading; }
};
|
/*
* fta.h - FTA (Fault Trace Assistant)
* external API header
*
* Copyright(C) 2011 FUJITSU LIMITED
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2
* of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _FTA_H
#define _FTA_H
#ifdef __cplusplus
extern "C" {
#endif
/* --------------------------------
* definition for message function
* -------------------------------- */
/* level */
#define FTA_LOG_LEVEL_LOW 0
#define FTA_LOG_LEVEL_MED 1
#define FTA_LOG_LEVEL_HIGH 2
#define FTA_LOG_LEVEL_CRITICAL 3
#define FTA_LOG_LEVEL_NOTICE 4
#define FTA_LOG_LEVEL_WARNING 5
#define FTA_LOG_LEVEL_ERROR 6
#define FTA_LOG_LEVEL_FATAL 7
#define FTA_LOG_LEVEL_TRACE 8
#define FTA_LOG_LEVEL_VERIFY 9
#define FTA_LOG_LEVEL_WORKFLOW 10
#define FTA_LOG_LEVEL_MONITOR 11
#define FTA_LOG_LEVEL_INSPECT 12
#define FTA_LOG_LEVEL_PERFORM 13
#define FTA_LOG_LEVEL_FIELD 14
#define FTA_LOG_LEVEL_REVIEW 15
/* category */
/* 240-255 is reserved for FTA */
#define FTA_LOG_CATEGORY_ENABLED(CMD, PARMs) CMD PARMs
#define FTA_LOG_CATEGORY_DISABLED(CMD, PARMs) /* no effect */
#define FTA_LOG_CATEGORY_FTA_DEFAULT 0
#define FTA_LOG_CATEGORY_SW_FTA_DEFAULT FTA_LOG_CATEGORY_ENABLED
/* filter */
#define FTA_LOG_SCENE_FILTER_MASK 0x80
#define FTA_LOG_SCENE_NORMAL 0
#define FTA_LOG_SCENE_DEVEL (FTA_LOG_SCENE_FILTER_MASK)
/* info structure
* msb|31 16|15 8| 7 |6 4|3 0|lsb
* |<---- line ---->|<-category->|filter |reserve | level | */
#define FTA_LOG_MESSAGE_SERIAL_I(LINE, CATEGORY, LEVEL) \
(((LINE) << 16) \
|(((CATEGORY) & 0x000000FF) << 8) \
|((LEVEL) & 0xFF))
#define FTA_LOG_MESSAGE_INFO_GET_LINE(SER) (unsigned short)((SER) >> 16)
#define FTA_LOG_MESSAGE_INFO_GET_LEVEL(SER) (unsigned short)((SER) & 0x0000FFFF)
/* default log definition */
#define FTA_LOG_PAUSE_DEFAULT_API fta_log_message_pause_null
#define FTA_LOG_RESUME_DEFAULT_API fta_log_message_resume_null
#define FTA_LOG_MESSAGE_DEFAULT_API fta_log_message
/* stop reason */
typedef enum _fta_stop_reason_enum {
FTA_STOP_REASON_NORMAL, /* normal end */
FTA_STOP_REASON_ABNORMAL, /* abnormal end */
FTA_STOP_REASON_INTENTIONAL, /* intentional */
} fta_stop_reason_enum;
/* internal MACRO */
#define FTA_LOG_MESSAGE_I(API, SWITCH, CATEGORY, LEVEL, FORMAT, P1, P2, P3) \
SWITCH(API, (__FILE__, \
(unsigned long)FTA_LOG_MESSAGE_SERIAL_I(__LINE__, CATEGORY, LEVEL), \
(const unsigned char *)(FORMAT), (unsigned long)(P1), (unsigned long)(P2), (unsigned long)(P3)))
/* --------------------------------
* API
* -------------------------------- */
#define FTA_LOG_MESSAGE(CATEGTAG, LEVEL, FORMAT, P1, P2, P3) \
FTA_LOG_MESSAGE_I(FTA_LOG_MESSAGE_DEFAULT_API, FTA_LOG_CATEGORY_SW_##CATEGTAG, FTA_LOG_CATEGORY_##CATEGTAG, FTA_LOG_SCENE_NORMAL|(LEVEL), FORMAT, P1, P2, P3)
#define FTA_LOG_MESSAGE_DEVEL(CATEGTAG, LEVEL, FORMAT, P1, P2, P3) \
FTA_LOG_MESSAGE_I(FTA_LOG_MESSAGE_DEFAULT_API, FTA_LOG_CATEGORY_SW_##CATEGTAG, FTA_LOG_CATEGORY_##CATEGTAG, FTA_LOG_SCENE_DEVEL|(LEVEL), FORMAT, P1, P2, P3)
#define FTA_LOG_PAUSE() FTA_LOG_PAUSE_DEFAULT_API()
#define FTA_LOG_RESUME() FTA_LOG_RESUME_DEFAULT_API()
#define FTA_LOG_ISENABLED(CATEGTAG) (FTA_LOG_CATEGORY_SW_##CATEGTAG(,1+) 0)
extern void fta_initialize(void);
extern void fta_terminate(void);
extern void fta_stop(fta_stop_reason_enum reason);
extern void fta_log_message(const unsigned char *srcname, unsigned long info, const unsigned char *msgformat,
unsigned long arg1, unsigned long arg2, unsigned long arg3);
extern void fta_log_struct_log0(const unsigned char *srcname, unsigned long info, const unsigned char *msgtitle,
unsigned long addr, const void *data, unsigned short data_len,
const unsigned char *dataformat);
extern void ftadrv_send_str(const unsigned char *cmd);
/* STUB */
static inline unsigned long fta_log_message_pause_null(void) { /* do nothing */ return 0xFFFFFFFF; }
static inline unsigned long fta_log_message_resume_null(void) { /* do nothing */ return 0xFFFFFFFF; }
#ifdef __cplusplus
}
#endif
#endif /* _FTA_H */ |
#include <linux/mman.h>
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/ptrace.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <asm/setup.h>
#include <asm/traps.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/pgalloc.h>
extern void die_if_kernel(char *, struct pt_regs *, long);
extern const int frame_extra_sizes[]; /* in m68k/kernel/signal.c */
int send_fault_sig(struct pt_regs *regs)
{
siginfo_t siginfo = { 0, 0, 0, };
siginfo.si_signo = current->thread.signo;
siginfo.si_code = current->thread.code;
siginfo.si_addr = (void *)current->thread.faddr;
#ifdef DEBUG
printk("send_fault_sig: %p,%d,%d\n", siginfo.si_addr, siginfo.si_signo, siginfo.si_code);
#endif
if (user_mode(regs)) {
force_sig_info(siginfo.si_signo,
&siginfo, current);
} else {
const struct exception_table_entry *fixup;
/* Are we prepared to handle this kernel fault? */
if ((fixup = search_exception_tables(regs->pc))) {
struct pt_regs *tregs;
/* Create a new four word stack frame, discarding the old
one. */
regs->stkadj = frame_extra_sizes[regs->format];
tregs = (struct pt_regs *)((ulong)regs + regs->stkadj);
tregs->vector = regs->vector;
tregs->format = 0;
tregs->pc = fixup->fixup;
tregs->sr = regs->sr;
return -1;
}
//if (siginfo.si_signo == SIGBUS)
// force_sig_info(siginfo.si_signo,
// &siginfo, current);
/*
* Oops. The kernel tried to access some bad page. We'll have to
* terminate things with extreme prejudice.
*/
if ((unsigned long)siginfo.si_addr < PAGE_SIZE)
printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
else
printk(KERN_ALERT "Unable to handle kernel access");
printk(" at virtual address %p\n", siginfo.si_addr);
die_if_kernel("Oops", regs, 0 /*error_code*/);
do_exit(SIGKILL);
}
return 1;
}
int do_page_fault(struct pt_regs *regs, unsigned long address,
unsigned long error_code)
{
struct mm_struct *mm = current->mm;
struct vm_area_struct * vma;
int write, fault;
#ifdef DEBUG
printk ("do page fault:\nregs->sr=%#x, regs->pc=%#lx, address=%#lx, %ld, %p\n",
regs->sr, regs->pc, address, error_code,
current->mm->pgd);
#endif
/*
* If we're in an interrupt or have no user
* context, we must not take the fault..
*/
if (in_atomic() || !mm)
goto no_context;
down_read(&mm->mmap_sem);
vma = find_vma(mm, address);
if (!vma)
goto map_err;
if (vma->vm_flags & VM_IO)
goto acc_err;
if (vma->vm_start <= address)
goto good_area;
if (!(vma->vm_flags & VM_GROWSDOWN))
goto map_err;
if (user_mode(regs)) {
/* Accessing the stack below usp is always a bug. The
"+ 256" is there due to some instructions doing
pre-decrement on the stack and that doesn't show up
until later. */
if (address + 256 < rdusp())
goto map_err;
}
if (expand_stack(vma, address))
goto map_err;
good_area:
#ifdef DEBUG
printk("do_page_fault: good_area\n");
#endif
write = 0;
switch (error_code & 3) {
default: /* 3: write, present */
/* fall through */
case 2: /* write, not present */
if (!(vma->vm_flags & VM_WRITE))
goto acc_err;
write++;
break;
case 1: /* read, present */
goto acc_err;
case 0: /* read, not present */
if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
goto acc_err;
}
/*
* If for any reason at all we couldn't handle the fault,
* make sure we exit gracefully rather than endlessly redo
* the fault.
*/
fault = handle_mm_fault(mm, vma, address, write ? FAULT_FLAG_WRITE : 0);
#ifdef DEBUG
printk("handle_mm_fault returns %d\n",fault);
#endif
if (unlikely(fault & VM_FAULT_ERROR)) {
if (fault & VM_FAULT_OOM)
goto out_of_memory;
else if (fault & VM_FAULT_SIGBUS)
goto bus_err;
BUG();
}
if (fault & VM_FAULT_MAJOR)
current->maj_flt++;
else
current->min_flt++;
up_read(&mm->mmap_sem);
return 0;
out_of_memory:
up_read(&mm->mmap_sem);
if (!user_mode(regs))
goto no_context;
pagefault_out_of_memory();
return 0;
no_context:
current->thread.signo = SIGBUS;
current->thread.faddr = address;
return send_fault_sig(regs);
bus_err:
current->thread.signo = SIGBUS;
current->thread.code = BUS_ADRERR;
current->thread.faddr = address;
goto send_sig;
map_err:
current->thread.signo = SIGSEGV;
current->thread.code = SEGV_MAPERR;
current->thread.faddr = address;
goto send_sig;
acc_err:
current->thread.signo = SIGSEGV;
current->thread.code = SEGV_ACCERR;
current->thread.faddr = address;
send_sig:
up_read(&mm->mmap_sem);
return send_fault_sig(regs);
}
|
/* Compile with:
export LDLIBS="`pkg-config --libs gsl`"
export CFLAGS="`pkg-config --cflags gsl` -g -Wall -std=gnu11 -O3"
make stddev
*/
#include <math.h>
#include <stdio.h> //size_t
typedef struct meanvar {double mean, var;} meanvar;
meanvar mean_and_var(const double *data){
long double avg = 0,
avg2 = 0;
long double ratio;
size_t cnt= 0;
for(size_t i=0; !isnan(data[i]); i++){
ratio = cnt/(cnt+1.0);
cnt ++;
avg *= ratio;
avg2 *= ratio;
avg += data[i]/(cnt +0.0);
avg2 += pow(data[i], 2)/(cnt +0.0);
}
return (meanvar){.mean = avg,
.var = avg2 - pow(avg, 2)}; //E[x^2] - E^2[x]
}
int main(){
double d[] = { 34124.75, 34124.48,
34124.90, 34125.31,
34125.05, 34124.98, NAN};
meanvar mv = mean_and_var(d);
printf("mean: %.10g var: %.10g\n", mv.mean, mv.var*6/5.);
double d2[] = { 4.75, 4.48,
4.90, 5.31,
5.05, 4.98, NAN};
mv = mean_and_var(d2);
mv.var *= 6./5;
printf("mean: %.10g var: %.10g\n", mv.mean, mv.var);
}
|
#include<stdio.h>
#define MAX 100
int top=-1;
int stack[MAX];
int match(char a,char b);
int main()
{
char exp[MAX];
int valid;
printf("Enter expression: ");
gets(exp);
valid=check(exp);
if (valid==1) printf("Valid expression\n");
else printf("Invalid expression\n");
}
int check(char exp[] )
{
int i;
char temp;
for(i=0;i<strlen(exp);i++)
{
if(exp[i]=='(' || exp[i]=='{' || exp[i]=='[') push(exp[i]);
if(exp[i]==')' || exp[i]=='}' || exp[i]==']')
{
if(top==-1)
{
printf("-1\n");
return 0;
}
else
{
temp=pop();
if(!match(temp, exp[i]))
{
printf("Unbalanced brackets are: ");
printf("%c and %c\n",temp,exp[i]);
return 0;
}
}
}
}
if(top==-1)
{
printf("0\n");
return 1;
}
else
{
printf("-1\n");
return 0;
}
}
int match(char a,char b)
{
if(a=='[' && b==']') return 1;
if(a=='{' && b=='}') return 1;
if(a=='(' && b==')') return 1;
}
void push(char item)
{
if(top==(MAX-1))
{
printf("Stack Overflow\n");
return;
}
top=top+1;
stack[top]=item;
}
char pop()
{
if(top==-1)
{
printf("Stack Underflow\n");
exit(1);
}
return(stack[top--]);
}
|
/*
* Hydrogen
* Copyright(c) 2002-2007 by Alex >Comix< Cominu [comix@users.sourceforge.net]
* http://www.hydrogen-music.org
* Copyright 2007 Stéphane Brunner <stephane.brunner@gmail.com>
*
* 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., 51 Franklin St, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef LADSPA_FX_SELECTOR_H
#define LADSPA_FX_SELECTOR_H
#include "ui_LadspaFXSelector_UI.h"
#include "ladspa_fx.h"
#include <QtGui/QDialog>
namespace LiveMix
{
class LadspaFXSelector : public QDialog, public Ui_LadspaFXSelector_UI
{
Q_OBJECT
public:
LadspaFXSelector(LadspaFX* nLadspaFX);
~LadspaFXSelector();
QString getSelectedFX();
private slots:
void on_m_pGroupsListView_currentItemChanged(QTreeWidgetItem * current, QTreeWidgetItem * previous);
void pluginSelected();
private:
QString m_sSelectedPluginName;
void buildLadspaGroups();
#ifdef LADSPA_SUPPORT
// void addGroup(QTreeWidgetItem* pItem, TargetType target, QString pName);
void addGroup(QTreeWidgetItem *pItem, LadspaFXGroup *pGroup);
QList<LadspaFXInfo*> findPluginsInGroup(const QString& sSelectedGroup, LadspaFXGroup *pGroup);
#endif
};
}
; //LiveMix
#endif
|
/*
This file is part of the MeshNet Arduino library.
Copyright (C) 2013 Mattia Baldani
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __MESHNET_H__
#define __MESHNET_H__
#include "Arduino.h"
#include <stddef.h>
#include <stdint.h>
#include "hmac_sha1.h"
// Enable the debug messages via Serial
#define DEBUG_SERIAL_ENABLE
#ifdef DEBUG_SERIAL_ENABLE
#define DEBUG_PRINT(x) ({Serial.print(x);})
#else
#define DEBUG_PRINT(x)
#endif
#ifdef DEBUG_SERIAL_ENABLE
#define DEBUG_PRINTLN(x) ({Serial.println(x);})
#else
#define DEBUG_PRINTLN(x)
#endif
/** These functions must be implemented by the sketch */
int sendPacket(unsigned char *, uint8_t, uint8_t, uint8_t);
extern const int NUM_INTERFACES;
extern const uint32_t deviceType;
extern uint32_t deviceUniqueId;
void onCommandReceived(uint8_t command, void* data, uint8_t dataLen);
/** This is the function that every layer2 implementations must call to pass a packet to the layer3 */
void processIncomingPacket(unsigned char*, uint8_t, uint8_t, uint8_t);
void sendCommand(uint8_t command, void* data, uint8_t dataLen); // called by the sketch
extern uint16_t networkId;
void printDebugStateInfo();
int printPacket(unsigned char *, uint8_t);
#endif
|
// -*- C++ -*-
//=============================================================================
/**
* @file OS_NS_sys_utsname.h
*
* $Id: OS_NS_sys_utsname.h 80826 2008-03-04 14:51:23Z wotte $
*
* @author Douglas C. Schmidt <schmidt@cs.wustl.edu>
* @author Jesper S. M|ller<stophph@diku.dk>
* @author and a cast of thousands...
*
* Originally in OS.h.
*/
//=============================================================================
#ifndef ACE_OS_NS_SYS_UTSNAME_H
# define ACE_OS_NS_SYS_UTSNAME_H
# include /**/ "ace/pre.h"
# include "ace/config-all.h"
# if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
# endif /* ACE_LACKS_PRAGMA_ONCE */
#include /**/ "ace/ACE_export.h"
#if defined (ACE_EXPORT_MACRO)
# undef ACE_EXPORT_MACRO
#endif
#define ACE_EXPORT_MACRO ACE_Export
#if defined (ACE_LACKS_UTSNAME_T)
# if !defined (SYS_NMLN)
# define SYS_NMLN 257
# endif /* SYS_NMLN */
# if !defined (_SYS_NMLN)
# define _SYS_NMLN SYS_NMLN
# endif /* _SYS_NMLN */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
struct ACE_utsname
{
char sysname[_SYS_NMLN];
char nodename[_SYS_NMLN];
char release[_SYS_NMLN];
char version[_SYS_NMLN];
char machine[_SYS_NMLN];
};
ACE_END_VERSIONED_NAMESPACE_DECL
# else
# include "ace/os_include/sys/os_utsname.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
typedef struct utsname ACE_utsname;
ACE_END_VERSIONED_NAMESPACE_DECL
# endif /* ACE_LACKS_UTSNAME_T */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
namespace ACE_OS {
extern ACE_Export
int uname (ACE_utsname *name);
} /* namespace ACE_OS */
ACE_END_VERSIONED_NAMESPACE_DECL
# include /**/ "ace/post.h"
#endif /* ACE_OS_NS_SYS_UTSNAME_H */
|
/* $Id: opml.win32.rcprefix.h 516 2006-02-04 16:08:42Z andreradke $ */
/******************************************************************************
UserLand Frontier(tm) -- High performance Web content management,
object database, system-level and Internet scripting environment,
including source code editing and debugging.
Copyright (C) 1992-2004 UserLand Software, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 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
******************************************************************************/
/*
2004-12-11 aradke: Generalized CodeWarrior resource prefix file for Win32
*/
#define PIKE 1
#define OPMLEDITOR 1
#define WIN95VERSION 1
#define WIN32
#define _WIN32
#define _WINDOWS
#define _X86_
#define _WIN32_WINNT 0x0400 /* Windows NT 4.0 or later */
#define _WIN32_WINDOWS 0x0410 /* Windows 98 or later */
#undef MACVERSION
#undef TARGET_API_MAC_CARBON
#undef TARGET_RT_MAC_CFM
#undef TARGET_RT_MAC_MACHO
|
/*
* signing-milter - utils/bio2file.c
* Copyright (C) 2010-2013 Andreas Schulze
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; only version 2 of the License is applicable.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Authors:
* Andreas Schulze <signing-milter at andreasschulze.de>
*
*/
#include "bio2file.h"
int bio2file(BIO *b, const char* dir, const char* prefix, const char* queueid) {
BIO* biofile;
BUF_MEM* pp;
char* bio_filename;
assert(dir != NULL);
assert(prefix != NULL);
assert(queueid != NULL);
if ((bio_filename = malloc(strlen(dir) + strlen(prefix) + strlen(queueid + 1) + 100)) == NULL) {
logmsg(LOG_ERR, "bio2file: malloc for bio_filename failed: %m", strerror(errno));
return(1);
}
sprintf(bio_filename, "%s/%s-%s", dir, prefix, queueid);
BIO_get_mem_ptr(b, &pp);
biofile = BIO_new_file(bio_filename, "w");
if (!biofile) {
logmsg(LOG_ERR, "bio2file: BIO_new_file failed");
BIO_free_all(biofile);
BUF_MEM_free(pp);
return(2);
}
BIO_write(biofile, pp->data, pp->length);
BIO_free(biofile);
free(bio_filename);
return(0);
}
|
/*
* File : pwm.h
* This file is part of FH8620 BSP for RT-Thread distribution.
*
* Copyright (c) 2016 Shanghai Fullhan Microelectronics Co., Ltd.
* All rights reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Visit http://www.fullhan.com to get contact with Fullhan.
*
* Change Logs:
* Date Author Notes
*/
#ifndef PWM_H_
#define PWM_H_
// #define FH_VPWM_DEBUG
#include <rtthread.h>
#ifdef RT_USING_TIMEKEEPING
#include <timekeeping.h>
#include <hrtimer.h>
#endif
#define ENABLE_PWM (0x10)
#define DISABLE_PWM (0x11)
#define SET_PWM_DUTY_CYCLE (0x12)
#define GET_PWM_DUTY_CYCLE (0x13)
struct pwm_device
{
int id;
int working;
rt_uint32_t period_ns;
rt_uint32_t counter_ns;
#ifdef RT_USING_VPWM
unsigned int gpio_id;
rt_uint32_t period_ticks;
rt_uint32_t counter_ticks;
rt_uint32_t invert_ticks[2];
void *func;
char name[8];
struct hrtimer timer;
int invert;
#endif
};
struct pwm_driver
{
// struct clk *clk;
#ifdef RT_USING_VPWM
struct pwm_device pwm[FH_VPWM_COUNT + 3];
#else
struct pwm_device pwm[3];
#endif
struct pwm_device *cur;
void *priv;
};
void rt_hw_pwm_init(void);
#endif /* PWM_H_ */
|
/* -*- linux-c -*- ------------------------------------------------------- *
*
* Copyright (C) 1991, 1992 Linus Torvalds
* Copyright 2007 rPath, Inc. - All Rights Reserved
*
* This file is part of the Linux kernel, and is made available under
* the terms of the GNU General Public License version 2.
*
* ----------------------------------------------------------------------- */
/*
* Check for obligatory CPU features and abort if the features are not
* present. This code should be compilable as 16-, 32- or 64-bit
* code, so be very careful with types and inline assembly.
*
* This code should not contain any messages; that requires an
* additional wrapper.
*
* As written, this code is not safe for inclusion into the kernel
* proper (after FPU initialization, in particular).
*/
#ifdef _SETUP
# include "boot.h"
#endif
#include <linux/types.h>
#include <asm/processor-flags.h>
#include <asm/required-features.h>
#include <asm/msr-index.h>
struct cpu_features cpu;
static u32 cpu_vendor[3];
static u32 err_flags[NCAPINTS];
static const int req_level = CONFIG_X86_MINIMUM_CPU_FAMILY;
static const u32 req_flags[NCAPINTS] =
{
REQUIRED_MASK0,
REQUIRED_MASK1,
0, /* REQUIRED_MASK2 not implemented in this file */
0, /* REQUIRED_MASK3 not implemented in this file */
REQUIRED_MASK4,
0, /* REQUIRED_MASK5 not implemented in this file */
REQUIRED_MASK6,
0, /* REQUIRED_MASK7 not implemented in this file */
};
#define A32(a, b, c, d) (((d) << 24)+((c) << 16)+((b) << 8)+(a))
static int is_amd(void)
{
return cpu_vendor[0] == A32('A', 'u', 't', 'h') &&
cpu_vendor[1] == A32('e', 'n', 't', 'i') &&
cpu_vendor[2] == A32('c', 'A', 'M', 'D');
}
static int is_centaur(void)
{
return cpu_vendor[0] == A32('C', 'e', 'n', 't') &&
cpu_vendor[1] == A32('a', 'u', 'r', 'H') &&
cpu_vendor[2] == A32('a', 'u', 'l', 's');
}
static int is_transmeta(void)
{
return cpu_vendor[0] == A32('G', 'e', 'n', 'u') &&
cpu_vendor[1] == A32('i', 'n', 'e', 'T') &&
cpu_vendor[2] == A32('M', 'x', '8', '6');
}
static int has_fpu(void)
{
u16 fcw = -1, fsw = -1;
u32 cr0;
asm("movl %%cr0,%0" : "=r" (cr0));
if (cr0 & (X86_CR0_EM|X86_CR0_TS)) {
cr0 &= ~(X86_CR0_EM|X86_CR0_TS);
asm volatile("movl %0,%%cr0" : : "r" (cr0));
}
asm volatile("fninit ; fnstsw %0 ; fnstcw %1"
: "+m" (fsw), "+m" (fcw));
return fsw == 0 && (fcw & 0x103f) == 0x003f;
}
static int has_eflag(u32 mask) //hacklu? 不明白其中奥妙
{
u32 f0, f1;
asm("pushfl ; "
"pushfl ; "
"popl %0 ; "
"movl %0,%1 ; "
"xorl %2,%1 ; "
"pushl %1 ; "
"popfl ; "
"pushfl ; "
"popl %1 ; "
"popfl"
: "=&r" (f0), "=&r" (f1)
: "ri" (mask));
//f0=eflags reg
//f1=eflags reg ^ mask
return !!((f0^f1) & mask);
}
static void get_flags(void)
{
u32 max_intel_level, max_amd_level;
u32 tfms;
if (has_fpu())
set_bit(X86_FEATURE_FPU, cpu.flags);
if (has_eflag(X86_EFLAGS_ID)) {
asm("cpuid"
: "=a" (max_intel_level),
"=b" (cpu_vendor[0]),
"=d" (cpu_vendor[1]),
"=c" (cpu_vendor[2])
: "a" (0));
if (max_intel_level >= 0x00000001 &&
max_intel_level <= 0x0000ffff) {
asm("cpuid"
: "=a" (tfms),
"=c" (cpu.flags[4]),
"=d" (cpu.flags[0])
: "a" (0x00000001)
: "ebx");
cpu.level = (tfms >> 8) & 15;
cpu.model = (tfms >> 4) & 15;
if (cpu.level >= 6)
cpu.model += ((tfms >> 16) & 0xf) << 4;
}
asm("cpuid"
: "=a" (max_amd_level)
: "a" (0x80000000)
: "ebx", "ecx", "edx");
if (max_amd_level >= 0x80000001 &&
max_amd_level <= 0x8000ffff) {
u32 eax = 0x80000001;
asm("cpuid"
: "+a" (eax),
"=c" (cpu.flags[6]),
"=d" (cpu.flags[1])
: : "ebx");
}
}
}
/* Returns a bitmask of which words we have error bits in */
static int check_flags(void)
{
u32 err;
int i;
err = 0;
for (i = 0; i < NCAPINTS; i++) {
err_flags[i] = req_flags[i] & ~cpu.flags[i];
if (err_flags[i])
err |= 1 << i;
}
return err;
}
/*
* Returns -1 on error.
*
* *cpu_level is set to the current CPU level; *req_level to the required
* level. x86-64 is considered level 64 for this purpose.
*
* *err_flags_ptr is set to the flags error array if there are flags missing.
*/
int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr)
{
int err;
memset(&cpu.flags, 0, sizeof cpu.flags);
cpu.level = 3;
if (has_eflag(X86_EFLAGS_AC))
cpu.level = 4;
get_flags();
err = check_flags();
if (test_bit(X86_FEATURE_LM, cpu.flags))
cpu.level = 64;
if (err == 0x01 &&
!(err_flags[0] &
~((1 << X86_FEATURE_XMM)|(1 << X86_FEATURE_XMM2))) &&
is_amd()) {
/* If this is an AMD and we're only missing SSE+SSE2, try to
turn them on */
u32 ecx = MSR_K7_HWCR;
u32 eax, edx;
asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
eax &= ~(1 << 15);
asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
get_flags(); /* Make sure it really did something */
err = check_flags();
} else if (err == 0x01 &&
!(err_flags[0] & ~(1 << X86_FEATURE_CX8)) &&
is_centaur() && cpu.model >= 6) {
/* If this is a VIA C3, we might have to enable CX8
explicitly */
u32 ecx = MSR_VIA_FCR;
u32 eax, edx;
asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
eax |= (1<<1)|(1<<7);
asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
set_bit(X86_FEATURE_CX8, cpu.flags);
err = check_flags();
} else if (err == 0x01 && is_transmeta()) {
/* Transmeta might have masked feature bits in word 0 */
u32 ecx = 0x80860004;
u32 eax, edx;
u32 level = 1;
asm("rdmsr" : "=a" (eax), "=d" (edx) : "c" (ecx));
asm("wrmsr" : : "a" (~0), "d" (edx), "c" (ecx));
asm("cpuid"
: "+a" (level), "=d" (cpu.flags[0])
: : "ecx", "ebx");
asm("wrmsr" : : "a" (eax), "d" (edx), "c" (ecx));
err = check_flags();
}
if (err_flags_ptr)
*err_flags_ptr = err ? err_flags : NULL;
if (cpu_level_ptr)
*cpu_level_ptr = cpu.level;
if (req_level_ptr)
*req_level_ptr = req_level;
return (cpu.level < req_level || err) ? -1 : 0;
}
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__
#define CHROME_BROWSER_HANG_MONITOR_HUNG_WINDOW_DETECTOR_H__
#include "base/synchronization/lock.h"
#include "chrome/common/worker_thread_ticker.h"
class HungWindowDetector : public WorkerThreadTicker::Callback {
public:
static const wchar_t kHungChildWindowTimeout[];
class HungWindowNotification {
public:
enum ActionOnHungWindow {
HUNG_WINDOW_IGNORE,
HUNG_WINDOW_TERMINATE_PROCESS,
};
virtual bool OnHungWindowDetected(HWND hung_window, HWND top_level_window,
ActionOnHungWindow* action) = 0;
};
explicit HungWindowDetector(HungWindowNotification* notification);
~HungWindowDetector();
bool Initialize(HWND top_level_window,
int message_response_timeout);
virtual void OnTick();
private:
bool CheckChildWindow(HWND child_window);
static BOOL CALLBACK ChildWndEnumProc(HWND child_window, LPARAM param);
HungWindowNotification* notification_;
HWND top_level_window_;
int message_response_timeout_;
base::Lock hang_detection_lock_;
bool enumerating_;
DISALLOW_COPY_AND_ASSIGN(HungWindowDetector);
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.