text stringlengths 4 6.14k |
|---|
// AFNetworking.h
//
// Copyright (c) 2013 AFNetworking (http://afnetworking.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>
#import <Availability.h>
#ifndef _AFNETWORKING_
#define _AFNETWORKING_
#import "AFURLRequestSerialization.h"
#import "AFURLResponseSerialization.h"
#import "AFSecurityPolicy.h"
#if !TARGET_OS_WATCH
#import "AFNetworkReachabilityManager.h"
#import "AFURLConnectionOperation.h"
#import "AFHTTPRequestOperation.h"
#import "AFHTTPRequestOperationManager.h"
#endif
#if ( ( defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1090) || \
( defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 ) || \
TARGET_OS_WATCH )
#import "AFURLSessionManager.h"
#import "AFHTTPSessionManager.h"
#endif
#endif /* _AFNETWORKING_ */
|
#ifndef SHIMS_SDL2_EVENTS_H
#define SHIMS_SDL2_EVENTS_H
#include "api/SDL2_sym.h"
#include "common/dims.h"
class events
{
class shim* _shim;
common::dims_2u _source_resolution;
common::dims_2u _target_resolution;
public:
events( class shim* shim );
virtual ~events() = default;
int poll ( SDL_Event* event );
void source_resolution ( const common::dims_2u& dims );
void target_resolution ( const common::dims_2u& dims );
private:
bool _is_valid_resize ( const common::dims_2u& dims );
common::dims_2u _resize_dims ( SDL_WindowEvent& event );
void _process ( SDL_Event* event );
void _process ( SDL_MouseMotionEvent& event );
void _process ( SDL_MouseButtonEvent& event );
void _process ( SDL_WindowEvent& event );
};
#endif // ifndef SHIMS_SDL2_EVENTS_H
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67a.c
Label Definition File: CWE122_Heap_Based_Buffer_Overflow__c_CWE806.label.xml
Template File: sources-sink-67a.tmpl.c
*/
/*
* @description
* CWE: 122 Heap Based Buffer Overflow
* BadSource: Initialize data as a large string
* GoodSource: Initialize data as a small string
* Sinks: loop
* BadSink : Copy data to string using a loop
* Flow Variant: 67 Data flow: data passed in a struct from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
typedef struct _CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_structType
{
char * structFirst;
} CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_structType;
#ifndef OMITBAD
/* bad function declaration */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67b_badSink(CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_structType myStruct);
void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_bad()
{
char * data;
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_structType myStruct;
data = (char *)malloc(100*sizeof(char));
/* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */
memset(data, 'A', 100-1); /* fill with 'A's */
data[100-1] = '\0'; /* null terminate */
myStruct.structFirst = data;
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67b_badSink(myStruct);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67b_goodG2BSink(CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_structType myStruct);
static void goodG2B()
{
char * data;
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_structType myStruct;
data = (char *)malloc(100*sizeof(char));
/* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */
memset(data, 'A', 50-1); /* fill with 'A's */
data[50-1] = '\0'; /* null terminate */
myStruct.structFirst = data;
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67b_goodG2BSink(myStruct);
}
void CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_loop_67_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
//
// NameViewController.h
// RunLoopTest
//
// Created by fernando on 2017/2/26.
// Copyright © 2017年 fernando. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NameViewController1 : UIViewController
@end
|
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "OnlineSubSystemHeader.h"
#include "CreateSessionCallbackProxyAdvanced.generated.h"
UCLASS(MinimalAPI)
class UCreateSessionCallbackProxyAdvanced : public UOnlineBlueprintCallProxyBase
{
GENERATED_UCLASS_BODY()
// Called when the session was created successfully
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnSuccess;
// Called when there was an error creating the session
UPROPERTY(BlueprintAssignable)
FEmptyOnlineDelegate OnFailure;
// Creates a session with the default online subsystem with advanced optional inputs
UFUNCTION(BlueprintCallable, meta=(BlueprintInternalUseOnly = "true", WorldContext="WorldContextObject",AutoCreateRefTerm="ExtraSettings"), Category = "Online|AdvancedSessions")
static UCreateSessionCallbackProxyAdvanced* CreateAdvancedSession(UObject* WorldContextObject, const TArray<FSessionPropertyKeyPair> &ExtraSettings, class APlayerController* PlayerController = NULL, int32 PublicConnections = 100, bool bUseLAN = false, bool bAllowInvites = true, bool bIsDedicatedServer = false, bool bUsePresence = true, bool bAllowJoinViaPresence = true, bool bAllowJoinViaPresenceFriendsOnly = false, bool bAntiCheatProtected = false, bool bUsesStats = false, bool bShouldAdvertise = true);
// UOnlineBlueprintCallProxyBase interface
virtual void Activate() override;
// End of UOnlineBlueprintCallProxyBase interface
private:
// Internal callback when session creation completes, calls StartSession
void OnCreateCompleted(FName SessionName, bool bWasSuccessful);
// Internal callback when session creation completes, calls StartSession
void OnStartCompleted(FName SessionName, bool bWasSuccessful);
// The player controller triggering things
TWeakObjectPtr<APlayerController> PlayerControllerWeakPtr;
// The delegate executed by the online subsystem
FOnCreateSessionCompleteDelegate CreateCompleteDelegate;
// The delegate executed by the online subsystem
FOnStartSessionCompleteDelegate StartCompleteDelegate;
// Handles to the registered delegates above
FDelegateHandle CreateCompleteDelegateHandle;
FDelegateHandle StartCompleteDelegateHandle;
// Number of public connections
int NumPublicConnections;
// Whether or not to search LAN
bool bUseLAN;
// Whether or not to allow invites
bool bAllowInvites;
// Whether this is a dedicated server or not
bool bDedicatedServer;
// Whether to use the presence option
bool bUsePresence;
// Whether to allow joining via presence
bool bAllowJoinViaPresence;
// Allow joining via presence for friends only
bool bAllowJoinViaPresenceFriendsOnly;
// Delcare the server to be anti cheat protected
bool bAntiCheatProtected;
// Record Stats
bool bUsesStats;
// Should advertise server?
bool bShouldAdvertise;
// Store extra settings
TArray<FSessionPropertyKeyPair> ExtraSettings;
// The world context object in which this call is taking place
UObject* WorldContextObject;
};
|
@interface NSRegularExpression (Extensions)
+ (BOOL)testString:(NSString *)subject withPattern:(NSString *)pattern;
- (BOOL)testString:(NSString *)subject;
@end
|
/*
* chickengraphics.c
*
* Created on: 8 mrt. 2017
* Author: MisterCavespider
*/
#include "fxlib.h"
#include "chickenpoints.h"
#include "chickengraphics.h"
void Draw_line(Point a, Point b)
{
Bdisp_DrawLineVRAM(a.x, a.y, b.x, b.y);
}
void Draw_point(Point p)
{
Bdisp_SetPoint_VRAM(p.x, p.y, 1);
}
void Draw_triangle(Point a, Point b, Point c)
{
if(b.y == c.y)
{
/* Trivial cases */
if(a.y > b.y)
{
DrawH_flattop_triangle(a, b, c);
} else if(a.y < b.y)
{
DrawH_flatbottom_triangle(a, b, c);
}
} else {
}
}
void Draw_square(Point a, Point b, int type)
{
switch(type) {
case SQUARE_AREA:
break;
case SQUARE_POLYGON:
if(a.y > b.y) {
DrawH_flattop_triangle(a,b,Point_Create(a.x, b.y));
DrawH_flatbottom_triangle(b,a,Point_Create(b.x, a.y));
} else {
DrawH_flattop_triangle(b,a,Point_Create(b.x,a.y));
DrawH_flatbottom_triangle(a,b,Point_Create(a.x, b.y));
}
break;
}
}
void Draw_area(Point a, Point b)
{
}
void Draw_polygon(Point* p_arr)
{
}
void DrawH_flattop_triangle(Point v1, Point v2, Point v3)
{
int scanLine = 0;
float slope1 = (float) ((float) (v1.x - v2.x)) / ((float) (v1.y - v2.y)); /*Delta x , Delta y*/
float slope2 = (float) ((float) (v1.x - v3.x)) / ((float) (v1.y - v3.y)); /*Delta x , Delta y*/
float curx1 = (float) v2.x;
float curx2 = (float) v3.x;
for(scanLine = v2.y; scanLine < v1.y; scanLine++)
{
Bdisp_DrawLineVRAM((int) curx1, scanLine, (int) curx2, scanLine);
curx1 += slope1;
curx2 += slope2;
}
Bdisp_SetPoint_DD(v1.x, v1.y, 1);
}
void DrawH_flatbottom_triangle(Point v1, Point v2, Point v3)
{
int scanLine = 0;
float slope1 = (float) ((float) (v1.x - v2.x)) / ((float) (v1.y - v2.y)); /*Delta x , Delta y*/
float slope2 = (float) ((float) (v1.x - v3.x)) / ((float) (v1.y - v3.y)); /*Delta x , Delta y*/
float curx1 = (float) v2.x;
float curx2 = (float) v3.x;
for(scanLine = v2.y; scanLine > v1.y; scanLine--)
{
Bdisp_DrawLineVRAM((int) curx1, scanLine, (int) curx2, scanLine);
curx1 -= slope1;
curx2 -= slope2;
}
Bdisp_SetPoint_DD(v1.x, v1.y, 1);
}
void Grphcs_update_DD()
{
Bdisp_PutDisp_DD();
}
|
#pragma once
#include <Windows.h>
#include <string>
class RegistryRead {
private:
HKEY key;
DWORD dwByte;
std::string get_last_error();
#ifdef UNICODE
std::wstring buf;
#else
std::string buf;
#endif
public:
RegistryRead(HKEY parent_key_handle, const TCHAR* sub_key_root);
~RegistryRead();
DWORD dwType;
void read(const TCHAR* key_name);
#ifdef UNICODE
std::wstring& get_data();
#else
std::string& get_data();
#endif
};
|
#ifndef LIBDRONE_BEBOP_VIDEODECODER_H
#define LIBDRONE_BEBOP_VIDEODECODER_H
#include <vector>
#include <drones/bebop/types.h>
#include <opencv2/opencv.hpp>
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
namespace bebop
{
class videodecoder
{
public:
videodecoder(int fragmentSize, int maxFragmentNumber);
bool insertFragment(d2cbuffer &receivedDataBuffer, uint16_t frameIndex, int fragmentsInFrame, int fragmentIndex, int fragmentSize);
cv::Mat getLatestFrame();
unsigned long getLatestFrameTime();
private:
bool initializeDecoder();
void initializeSwsContext(int width, int height);
bool decodeFrame(int frameSize);
int _fragmentSize;
std::vector<char> _framebuffer;
AVCodec *_h264_codec = nullptr;
AVCodecContext *_h264_context = nullptr;
AVFrame *_frame_yuv = nullptr;
AVFrame *_frame_bgr = nullptr;
uint8_t *_bgr_framebuffer = nullptr;
SwsContext *_sws_context = nullptr;
cv::Mat _frame;
unsigned long _lastFrameTime = 0;
};
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_console_system_65a.c
Label Definition File: CWE78_OS_Command_Injection.one_string.label.xml
Template File: sources-sink-65a.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: console Read input from the console
* GoodSource: Fixed string
* Sinks: system
* BadSink : Execute command in data using system()
* Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called via a function pointer
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define FULL_COMMAND "%WINDIR%\\system32\\cmd.exe /c dir "
#else
#include <unistd.h>
#define FULL_COMMAND "/bin/sh ls -la "
#endif
#ifdef _WIN32
#define SYSTEM system
#else /* NOT _WIN32 */
#define SYSTEM system
#endif
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__char_console_system_65b_badSink(char * data);
void CWE78_OS_Command_Injection__char_console_system_65_bad()
{
char * data;
/* define a function pointer */
void (*funcPtr) (char *) = CWE78_OS_Command_Injection__char_console_system_65b_badSink;
char data_buf[100] = FULL_COMMAND;
data = data_buf;
{
/* Read input from the console */
size_t dataLen = strlen(data);
/* if there is room in data, read into it from the console */
if (100-dataLen > 1)
{
/* POTENTIAL FLAW: Read data from the console */
if (fgets(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgets() */
dataLen = strlen(data);
if (dataLen > 0 && data[dataLen-1] == '\n')
{
data[dataLen-1] = '\0';
}
}
else
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
}
}
/* use the function pointer */
funcPtr(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__char_console_system_65b_goodG2BSink(char * data);
static void goodG2B()
{
char * data;
void (*funcPtr) (char *) = CWE78_OS_Command_Injection__char_console_system_65b_goodG2BSink;
char data_buf[100] = FULL_COMMAND;
data = data_buf;
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
funcPtr(data);
}
void CWE78_OS_Command_Injection__char_console_system_65_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE78_OS_Command_Injection__char_console_system_65_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__char_console_system_65_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#ifndef CURLUTILS_H
#define CURLUTILS_H
#include <memory>
#include <stdexcept>
#include <functional>
#include <curl/curl.h>
namespace utils_curl
{
class Global
{
public:
static void Init()
{
static Global singleton;
}
private:
Global()
{
CURLcode res = curl_global_init(CURL_GLOBAL_ALL);
if ( res != CURLE_OK )
{
throw std::runtime_error(curl_easy_strerror(res));
}
}
~Global()
{
curl_global_cleanup();
}
};
class EasyHandleDeleter
{
public:
void operator()(CURL *curl_easy_handle)
{
curl_easy_cleanup(curl_easy_handle);
}
};
typedef std::unique_ptr<CURL, EasyHandleDeleter> EasyHandlePtr;
typedef std::function<std::size_t(char *, std::size_t, std::size_t, void *)> WriteCallback;
} // namespace utils_curl
#endif // CURLUTILS_H
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53c.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-53c.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: console Read input from the console
* GoodSource: Fixed string
* Sink: w32_execv
* BadSink : execute command with wexecv
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT L"cmd.exe"
#define COMMAND_ARG1 L"/c"
#define COMMAND_ARG2 L"dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH L"/bin/sh"
#define COMMAND_INT L"sh"
#define COMMAND_ARG1 L"ls"
#define COMMAND_ARG2 L"-la"
#define COMMAND_ARG3 data
#endif
#include <process.h>
#define EXECV _wexecv
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53d_badSink(wchar_t * data);
void CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53c_badSink(wchar_t * data)
{
CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53d_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53d_goodG2BSink(wchar_t * data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53c_goodG2BSink(wchar_t * data)
{
CWE78_OS_Command_Injection__wchar_t_console_w32_execv_53d_goodG2BSink(data);
}
#endif /* OMITGOOD */
|
#import "RCTBridgeModule.h"
@interface RNBugsnag : NSObject <RCTBridgeModule>
@property BOOL suppressDev;
+ (RNBugsnag*)init;
- (void)notifyWithTitle: (NSString *)exceptionTitle
andReason:(NSString *)exceptionReason
withSeverity:(NSString *)severity
andOtherData:(NSDictionary *) otherData;
@end
|
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_OPERATOR_REDUCERS_H_
#define V8_COMPILER_OPERATOR_REDUCERS_H_
#include "src/compiler/graph-reducer.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/lowering-builder.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node.h"
#include "src/compiler/simplified-operator.h"
namespace v8 {
namespace internal {
namespace compiler {
class JSBinopReduction;
// Lowers JS-level operators to simplified operators based on types.
class JSTypedLowering : public LoweringBuilder {
public:
explicit JSTypedLowering(JSGraph* jsgraph,
SourcePositionTable* source_positions)
: LoweringBuilder(jsgraph->graph(), source_positions),
jsgraph_(jsgraph),
simplified_(jsgraph->zone()),
machine_(jsgraph->zone()) {}
virtual ~JSTypedLowering() {}
Reduction Reduce(Node* node);
virtual void Lower(Node* node) { Reduce(node); }
JSGraph* jsgraph() { return jsgraph_; }
Graph* graph() { return jsgraph_->graph(); }
private:
friend class JSBinopReduction;
JSGraph* jsgraph_;
SimplifiedOperatorBuilder simplified_;
MachineOperatorBuilder machine_;
Reduction ReplaceEagerly(Node* old, Node* node);
Reduction NoChange() { return Reducer::NoChange(); }
Reduction ReplaceWith(Node* node) { return Reducer::Replace(node); }
Reduction Changed(Node* node) { return Reducer::Changed(node); }
Reduction ReduceJSAdd(Node* node);
Reduction ReduceJSComparison(Node* node);
Reduction ReduceJSEqual(Node* node, bool invert);
Reduction ReduceJSStrictEqual(Node* node, bool invert);
Reduction ReduceJSToNumberInput(Node* input);
Reduction ReduceJSToStringInput(Node* input);
Reduction ReduceJSToBooleanInput(Node* input);
Reduction ReduceNumberBinop(Node* node, Operator* numberOp);
Reduction ReduceI32Binop(Node* node, bool left_signed, bool right_signed,
Operator* intOp);
Reduction ReduceI32Shift(Node* node, bool left_signed, Operator* shift_op);
JSOperatorBuilder* javascript() { return jsgraph_->javascript(); }
CommonOperatorBuilder* common() { return jsgraph_->common(); }
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
MachineOperatorBuilder* machine() { return &machine_; }
};
}
}
} // namespace v8::internal::compiler
#endif // V8_COMPILER_OPERATOR_REDUCERS_H_
|
/* 守护进程:
* 1.后台运行,即父进程退出,子进程继续运行
* 2.独立于控制终端,在后台进程的基础上,脱离原来shell的进程组和session期(session是一个或多个进程组的集合,每个session独占一个终端),自立门户为新进程组的会话组长进程,与原终端脱离关系。
* pid_t setsid(); 函数setsid创建一个新的session和进程组,并以调用进程的ID号来设置新成立的进程组ID
* 3.清除文件创建掩码(umask)
* 4.处理信号,为了预防父进程不等带子进程结束而导致子进程僵死。
*/
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <unistd.h>
#include <assert.h>
void ClearChild(int nSignal)
{
pid_t _pid_t;
int nState;
while((_pid_t = waitpid(-1,&nState,WNOHANG)) > 0);
signal(SIGCLD,ClearChild);
}
int main()
{
pid_t pid1;
assert((pid1 = fork()) >= 0); //创建子进程
if(pid1 != 0)
{
sleep(1);
exit(0);
}
assert(setsid() >= 0); //子进程脱离终端
umask(0); //清除文件创建掩码
//忽略捕捉终端CTRL+C
signal(SIGINT,SIG_IGN); //忽略SIGINT信号
signal(SIGCLD,ClearChild); //处理SIGCLD信号,预防僵死进程
sleep(120);
return 0;
}
|
//
// Music.h
// InvaderR
//
// Created by Richard Adem on 17/02/10.
// Copyright 2010 vorticity. All rights reserved.
//
#pragma once
#ifndef _MUSIC_H_
#define _MUSIC_H_
#include <AVFoundation/AVFoundation.h>
class Music
{
public:
Music();
~Music();
void Load();
void Play();
void ShutDown();
bool IsMusicEnabled();
private:
AVAudioPlayer *m_audioPlayer;
};
#endif // _MUSIC_H_ |
/*
* Copyright (c) 2001 Dan Gudmundsson
*
* See the file "license.terms" for information on usage and redistribution
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* $Id: exdl_keyboard.h,v 1.1 2004/03/30 07:49:22 bjorng Exp $
*/
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
enum
{ SDL_EnableUNICODE_ENUM = EXDL_KEYBOARD_H
, SDL_EnableKeyRepeat_ENUM
, SDL_GetKeyRepeat_ENUM
, SDL_GetKeyState_ENUM
, SDL_GetModState_ENUM
, SDL_SetModState_ENUM
, SDL_GetKeyName_ENUM
, _ENUM_EXDL_KEYBOARD
};
EXDL_API(ekbd_enableUNICODE);
EXDL_API(ekbd_enableKeyRepeat);
EXDL_API(ekbd_getKeyRepeat);
EXDL_API(ekbd_getKeyState);
EXDL_API(ekbd_getModState);
EXDL_API(ekbd_setModState);
EXDL_API(ekbd_getKeyName);
#ifdef __cplusplus
}
#endif /* __cplusplus */
|
//
// ZFCustomControlView.h
// ZFPlayer_Example
//
// Created by 紫枫 on 2019/6/5.
// Copyright © 2019 紫枫. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <ZFPlayer/ZFPlayerMediaControl.h>
#import "ZFSpeedLoadingView.h"
NS_ASSUME_NONNULL_BEGIN
@interface ZFCustomControlView : UIView <ZFPlayerMediaControl>
/// 控制层自动隐藏的时间,默认2.5秒
@property (nonatomic, assign) NSTimeInterval autoHiddenTimeInterval;
/// 控制层显示、隐藏动画的时长,默认0.25秒
@property (nonatomic, assign) NSTimeInterval autoFadeTimeInterval;
/**
设置标题、封面、全屏模式
@param title 视频的标题
@param coverUrl 视频的封面,占位图默认是灰色的
@param fullScreenMode 全屏模式
*/
- (void)showTitle:(NSString *)title coverURLString:(NSString *)coverUrl fullScreenMode:(ZFFullScreenMode)fullScreenMode;
@end
NS_ASSUME_NONNULL_END
|
#ifndef IRELATION_H
#define IRELATION_H
#include "RelationType.h"
struct IRelation
{
virtual ~IRelation() {}
virtual bool isBidirectional() const = 0;
virtual const std::string& getTitle() const = 0;
virtual void setTitle(const std::string& theTitle) = 0;
virtual RelationType getType() const = 0;
virtual void setType(const RelationType theType) = 0;
};
#endif // IRELATION_H
|
/* Queue.h
Borislav Sabotinov
a very simple array-based queue ADT
This implentation will use a dynamic array
Note that this implementation uses one extra space and is a circular queue.
*/
#ifndef Queue_H
#define Queue_H
#include <cstdlib> // Provides size_t
#include <assert.h>
using namespace std;
template<class ItemType>
class Queue {
public:
typedef int value_type;
typedef int size_type;
//Default constructor will default to MAX_ITEMS in queue
Queue();
//Constructor with size of queue
Queue(int max);
//Copy constructor
Queue(const Queue & src);
//Destructor
~Queue();
/****************************
makeEmpty
Function: Removes all the items from the queue.
Preconditions: queue has been initialized
Postconditions: All the items have been removed
*****************************/
void makeEmpty();
/****************************
isEmpty
Function: Checks to see if there are any items on the queue.
Preconditions: queue has been initialized
Postconditions: Returns true if there are no items on the queue, else false.
*****************************/
bool isEmpty() const;
/****************************
isFull
Function: Determines if you have any more room to add items to the queue
Preconditions: queue has been initialized
Postconditions: Returns true if there is no more room to add items, else false
*****************************/
bool isFull() const;
/****************************
push
Function: Adds newItem to the top of the queue.
Preconditions: queue has been initialized and is not full.
Postconditions: newItem is at the top of the queue.
*****************************/
void enQueue(const ItemType &);
/****************************
pop
Function: Removes first item from queue and returns it.
Preconditions: queue has been initialized and is not empty.
Postconditions: First element has been removed from queue and is returned.
*****************************/
ItemType deQueue();
private:
size_type front;
size_type rear;
ItemType* items; //dynamic array
size_type maxQue; //will be one bigger than the size in the constructor
static const int MAX_ITEMS = 1000;
};
/*******************************
/ Function implementations
********************************/
template<class ItemType>
Queue<ItemType>::Queue()
{
maxQue = MAX_ITEMS + 1; //default value if none provided
front = maxQue - 1;
rear = maxQue - 1;
items = new ItemType[maxQue]; //dynamically allocated
}
template<class ItemType>
Queue<ItemType>::Queue(int max)
{
maxQue = max + 1; //max provided by user
front = maxQue - 1;
rear = maxQue - 1;
items = new ItemType[maxQue]; //dynamically allocated
}
template<class ItemType>
Queue<ItemType>::Queue(const Queue & src)
{
maxQue = src.maxQue;
front = src.front;
rear = src.rear;
items = src.items;
}
template<class ItemType>
Queue<ItemType>::~Queue()
{
delete[] items;
}
template<class ItemType>
void Queue <ItemType>::makeEmpty()
{
while (!this->isEmpty())
{
this->deQueue();
}
}
template<class ItemType>
bool Queue <ItemType>::isEmpty() const
{
return (front == rear);
}
template<class ItemType>
bool Queue <ItemType>::isFull() const
{
// Queue is full if rear has wrapped around to location of front
return ((rear - MAX_ITEMS) == front);
}
template<class ItemType>
void Queue <ItemType>::enQueue(const ItemType& newItem)
{
assert(!isFull());
rear++;
items[rear % MAX_ITEMS] = newItem;
//cout << "Enqueuing " << items[rear % MAX_ITEMS] << " into queue" << endl;
}
template<class ItemType>
ItemType Queue <ItemType>::deQueue()
{
assert(!isEmpty());
front++;
ItemType deQueued = items[front % MAX_ITEMS];
//cout << "Dequeuing " << items[front % MAX_ITEMS] << " from queue" << endl;
return deQueued;
}
#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"
@class CADisplayLink, CALayer, NSArray, NSMutableArray, NSMutableDictionary, NSMutableSet, PKExtendedPhysicsWorld, UIView;
@interface UIDynamicAnimator : NSObject
{
PKExtendedPhysicsWorld *_world;
CADisplayLink *_displaylink;
double _elapsedTime;
double _realElapsedTime;
double _lastUpdateTime;
double _lastInterval;
long long _ticks;
CALayer *_debugLayer;
NSMutableDictionary *_bodies;
NSMutableArray *_topLevelBehaviors;
NSMutableSet *_registeredBehaviors;
NSMutableSet *_behaviorsToRemove;
NSMutableSet *_behaviorsToAdd;
NSMutableArray *_postSolverActions;
NSMutableArray *_beginContacts;
NSMutableArray *_endContacts;
_Bool _isInWorldStepMethod;
_Bool _needsLocalBehaviorReevaluation;
unsigned long long _referenceSystemType;
unsigned long long _integralization;
struct {
unsigned int delegateImplementsDynamicAnimatorDidPause:1;
unsigned int delegateImplementsDynamicAnimatorWillResume:1;
} _stateFlags;
double _accuracy;
int _registeredCollisionGroups;
int _registeredImplicitBounds;
struct CGRect _referenceSystemBounds;
id <_UIDynamicReferenceSystem> _referenceSystem;
int _debugInterval;
id _action;
id <UIDynamicAnimatorDelegate> _delegate;
_Bool _disableDisplayLink;
double _speed;
}
+ (id)_allDynamicAnimators;
+ (void)_clearReferenceViewFromAnimators:(id)arg1;
+ (void)_referenceViewSizeChanged:(id)arg1;
+ (void)_unregisterAnimator:(id)arg1;
+ (void)_registerAnimator:(id)arg1;
+ (void)initialize;
- (id)_referenceSystem;
- (unsigned long long)_referenceSystemType;
- (struct CGRect)_referenceSystemBounds;
- (void)_setReferenceSystem:(id)arg1;
@property(readonly, nonatomic) UIView *referenceView;
- (void)setReferenceView:(id)arg1;
- (double)_realElapsedTime;
- (long long)_ticks;
- (void)_displayLinkTick:(id)arg1;
- (double)_animatorInterval;
- (_Bool)_animatorStep:(double)arg1;
- (_Bool)_alwaysDisableDisplayLink;
- (void)_setAlwaysDisableDisplayLink:(_Bool)arg1;
- (int)_debugInterval;
- (void)_setDebugInterval:(int)arg1;
- (void)_setAction:(id)arg1;
- (void)_setDelegate:(id)arg1;
@property(nonatomic) id <UIDynamicAnimatorDelegate> delegate;
- (id)_delegate;
- (void)_postSolverStep;
- (void)_runBlockPostSolverIfNeeded:(id)arg1;
- (void)_preSolverStep;
- (void)_start;
- (void)_tickle;
- (void)_clearReferenceView;
- (void)_stop;
- (void)_setRunning:(_Bool)arg1;
@property(readonly, nonatomic, getter=isRunning) _Bool running;
- (_Bool)_isWorldActive;
- (void)_setupWorld;
- (double)_speed;
- (void)_setSpeed:(double)arg1;
- (id)_world;
- (id)_bodyForItem:(id)arg1;
- (id)_keyForItem:(id)arg1;
- (id)_registerBodyForItem:(id)arg1 shape:(unsigned long long)arg2;
- (void)updateItemUsingCurrentState:(id)arg1;
- (void)updateItemFromCurrentState:(id)arg1;
- (id)layoutAttributesForCellAtIndexPath:(id)arg1;
- (id)layoutAttributesForDecorationViewOfKind:(id)arg1 atIndexPath:(id)arg2;
- (id)layoutAttributesForSupplementaryViewOfKind:(id)arg1 atIndexPath:(id)arg2;
- (id)itemsInRect:(struct CGRect)arg1;
- (id)_registerBodyForItem:(id)arg1;
- (void)_unregisterBodyForItem:(id)arg1 action:(id)arg2;
- (void)_defaultMapper:(id)arg1 position:(struct CGPoint)arg2 angle:(double)arg3 itemType:(unsigned long long)arg4;
- (unsigned long long)_animatorIntegralization;
- (void)_setAnimatorIntegralization:(unsigned long long)arg1;
- (void)_unregisterCollisionGroup;
- (int)_registerCollisionGroup;
@property(readonly, nonatomic) NSArray *behaviors;
- (double)elapsedTime;
- (void)removeAllBehaviors;
- (void)_traverseBehaviorHierarchy:(id)arg1;
- (void)_unregisterImplicitBounds;
- (void)_registerImplicitBounds;
- (void)_reevaluateImplicitBounds;
- (void)_evaluateLocalBehaviors;
- (void)_shouldReevaluateLocalBehaviors;
- (void)_reportEndContacts;
- (void)_reportBeginContacts;
- (void)didEndContact:(id)arg1;
- (void)didBeginContact:(id)arg1;
- (void)_unregisterBehavior:(id)arg1;
- (void)_registerBehavior:(id)arg1;
- (void)_checkBehavior:(id)arg1;
- (void)removeBehavior:(id)arg1;
- (void)addBehavior:(id)arg1;
- (double)_ptmRatio;
- (id)recursiveDescription;
- (id)description;
- (void)dealloc;
- (id)initWithReferenceSystem:(id)arg1;
- (id)init;
- (id)initWithCollectionViewLayout:(id)arg1;
- (id)initWithReferenceView:(id)arg1;
@end
|
//
// AuthCodeView.h
// MVC
//
// Created by 张坤 on 2017/3/24.
// Copyright © 2017年 zhangkun. All rights reserved.
//
#import <UIKit/UIKit.h>
/*本类用于生成随机验证码*/
@interface AuthCodeView : UIView
@property (strong, nonatomic) NSArray *dataArray;//字符素材数组
@property (strong, nonatomic) NSMutableString *authCodeStr;//验证码字符串
@end
|
/*=============================================================================
Copyright (c) 2012, Ludo Sapiens Inc. and contributors.
See accompanying file LICENSE.txt for details.
=============================================================================*/
#ifndef PLASMA_ACTION_H
#define PLASMA_ACTION_H
#include <Plasma/StdDefs.h>
#include <Fusion/VM/VM.h>
#include <Base/MT/Task.h>
#include <Base/Util/Bits.h>
#include <Base/Util/RCObject.h>
NAMESPACE_BEGIN
class Entity;
/*==============================================================================
CLASS Action
==============================================================================*/
class Action:
public RCObject,
public VMProxy
{
public:
/*----- types -----*/
typedef Action* (*CtorFunc)();
/*----- static methods -----*/
static PLASMA_DLL_API void initialize();
static PLASMA_DLL_API void terminate();
static PLASMA_DLL_API void registerAction( const ConstString& type, CtorFunc ctorFunc );
static Action* create( const ConstString& type );
/*----- methods -----*/
PLASMA_DLL_API virtual const ConstString& type() const = 0;
PLASMA_DLL_API virtual bool execute( Entity& entity, double time, double delta ) = 0;
inline bool enabled() const { return getbits(_state, 0, 1) != 0; }
inline void enabled( bool v ) { setbits(&_state, 0, 1, v?1:0); }
inline bool autoDelete() const { return getbits(_state, 1, 1) != 0; }
inline void autoDelete( bool v ) { setbits(&_state, 1, 1, v?1:0); }
inline bool notifyOnCompletion() const { return getbits(_state, 2, 1) != 0; }
inline void notifyOnCompletion( bool v ) { setbits(&_state, 2, 1, v?1:0); }
inline bool runAfterPhysics() const { return getbits(_state, 3, 1) != 0; }
// VM (not needed in subclasses).
virtual const char* meta() const;
PLASMA_DLL_API virtual bool performGet( VMState* vm );
PLASMA_DLL_API virtual bool performSet( VMState* vm );
protected:
friend class ActionTask;
friend class Brain;
/*----- types -----*/
enum {
STATE_ENABLED = 0x01,
STATE_AUTO_DELETE = 0x02,
STATE_NOTIFY_ON_COMPLETION = 0x04,
STATE_RUN_AFTER_PHYSICS = 0x08,
STATE_DEFAULT = STATE_ENABLED|STATE_AUTO_DELETE,
};
/*----- members -----*/
/**
* _state[0] Enabled (or disabled)
* _state[1] Auto-delete when done (or keep around)
* _state[2] Notify brain when completed (or do not send any stimulus)
* _state[3] Run the action after the physics (but before rendering)
*/
uint8_t _state; //!< A flag indicating if the action is enabled or disabled, .
/*----- methods -----*/
Action( int state = STATE_DEFAULT ): _state( state ) {}
PLASMA_DLL_API virtual ~Action();
inline bool canExecute() { return (_state & STATE_ENABLED) == STATE_ENABLED; }
}; //class Action
/*==============================================================================
CLASS DebugAction
==============================================================================*/
class DebugAction:
public Action
{
public:
/*----- methods -----*/
DebugAction();
PLASMA_DLL_API static const ConstString& actionType();
PLASMA_DLL_API virtual const ConstString& type() const;
PLASMA_DLL_API virtual bool execute( Entity& entity, double time, double delta );
PLASMA_DLL_API virtual bool performGet( VMState* vm );
PLASMA_DLL_API virtual bool performSet( VMState* vm );
protected:
RCP<Table> _attr;
}; //class DebugAction
/*==============================================================================
CLASS ParticleAction
==============================================================================*/
class ParticleAction:
public Action
{
public:
/*----- methods -----*/
ParticleAction();
PLASMA_DLL_API static const ConstString& actionType();
PLASMA_DLL_API virtual const ConstString& type() const;
PLASMA_DLL_API virtual bool execute( Entity& entity, double time, double delta );
protected:
float _duration;
};
/*==============================================================================
CLASS WaitAction
==============================================================================*/
class WaitAction:
public Action
{
public:
/*----- methods -----*/
WaitAction();
PLASMA_DLL_API static const ConstString& actionType();
PLASMA_DLL_API virtual const ConstString& type() const;
PLASMA_DLL_API virtual bool execute( Entity& entity, double time, double delta );
PLASMA_DLL_API virtual bool performGet( VMState* vm );
PLASMA_DLL_API virtual bool performSet( VMState* vm );
protected:
float _duration;
}; //class WaitAction
/*==============================================================================
CLASS ActionTask
==============================================================================*/
class ActionTask:
public Task
{
public:
/*----- methods -----*/
ActionTask( Entity* e, double t, double d, bool afterPhysics );
virtual void execute();
protected:
/*----- data members -----*/
RCP<Entity> _entity; //!< A pointer to the entity that has actions to run.
double _time; //!< The current world time.
double _delta; //!< The delta time since the last action call.
// Note: if _time and _delta take too much memory, we could poll them from the world.
bool _afterPhysics; //!< Only handle actions that have a matching runAfterPhysics() value.
private:
}; //class ActionTask
NAMESPACE_END
#endif //PLASMA_ACTION_H
|
#ifndef __NDM_SPAWN_H__
#define __NDM_SPAWN_H__
#include <stdbool.h>
#include <sys/types.h>
#include "attr.h"
#define NDM_SPAWN_INVALID_PID ((pid_t) -1)
bool ndm_spawn_default_at_exec(
const char *const argv[],
const char *const envp[],
const int fd_max,
const int control_fd,
void *user_data) NDM_ATTR_WUR;
pid_t ndm_spawn_process(
const char *const argv[],
const char *const envp[],
void *user_data,
bool (*at_exec)(
const char *const argv[],
const char *const envp[],
const int fd_max,
const int control_fd,
void *user_data)) NDM_ATTR_WUR;
pid_t ndm_spawn(
const char *const argv[],
const char *const envp[]) NDM_ATTR_WUR;
#endif /* __NDM_SPAWN_H__ */
|
#pragma once
#include <string>
#include <sstream>
#include <gumbo.h>
#include <vector>
namespace scivey {
namespace goosepp {
namespace util {
bool isHighLinkDensity(const GumboNode *node, const std::string &nodeText);
bool isHighLinkDensity(const GumboNode *node);
template<typename T>
std::string joinVec(const std::string &joinWith, const std::vector<T> &vec) {
std::ostringstream oss;
size_t last = vec.size() - 1;
for (size_t i = 0; i <= last; i++) {
std::string current = vec.at(i);
if (current.size()) {
oss << vec.at(i);
if (i != last) {
oss << joinWith;
}
}
}
return oss.str();
}
// used to make phony shared_ptr<T> instances that don't call `free()`
template<typename T>
struct NonDeleter {
void operator()(T* t) const {
((void) t);
}
};
} // util
} // goosepp
} // scivey |
//
// BDAudioToVideoConverter.h
// BDAudioToVideoConverter
//
// Created by Benny Davidovitz on 20/07/2016.
// Copyright © 2016 xcoder.solutions. All rights reserved.
//
@import UIKit;
typedef void(^BDAudioToVideoConverterCompletionBlock)( NSURL * _Nonnull fileURL);
@interface BDAudioToVideoConverter : NSObject
/**
* @param audioFileName - audio file you would like to add to the video
* @param audioFileExt - that file extenstion
* @param imagesArray - should not be empty, video size will be based on first image size
* @param videoFileName - the file name without extenstion, for example: @"my_video", the extenstion will be mp4
*/
+ (void) convertAudioFileName:(nonnull NSString *)audioFileName audioFileExtenstion:(nonnull NSString *)audioFileExt withImagesArray:(nonnull NSArray <UIImage *>*)imagesArray videoFileName:(nonnull NSString *)videoFileName withCompletionBlock:(nullable BDAudioToVideoConverterCompletionBlock)completionBlock;
/**
* @param fileURL - audio file local url
* @param imagesArray - should not be empty, video size will be based on first image size
* @param videoFileName - the file name without extenstion, for example: @"my_video", the extenstion will be mp4
*/
+ (void) convertAudioFileURL:(nonnull NSURL *)fileURL withImagesArray:(nonnull NSArray <UIImage *>*)imagesArray videoFileName:(nonnull NSString *)videoFileName withCompletionBlock:(nullable BDAudioToVideoConverterCompletionBlock)completionBlock;
@end
|
//
// SYProgressHUD.h
// SYHUDView
//
// Created by Saucheong Ye on 8/12/15.
// Copyright © 2015 sauchye.com. All rights reserved.
//
#import "MBProgressHUD.h"
#import "CWStatusBarNotification.h"
typedef NS_ENUM(NSInteger, SYProgressHUDStatus) {
SYProgressHUDStatusSuccess = 0,
SYProgressHUDStatusFailure,
SYProgressHUDStatusInfo,
SYProgressHUDStatusLoading
};
@interface SYProgressHUD : MBProgressHUD
+ (void)showStatus:(SYProgressHUDStatus)status
text:(NSString *)text
hide:(NSTimeInterval)time;
/** icon and text */
+ (void)showText:(NSString *)text
icon:(UIImage *)icon;
/** success icon and text */
+ (void)showSuccessText:(NSString *)text;
/** failure or error icon and text */
+ (void)showFailureText:(NSString *)text;
/** info icon and text */
+ (void)showInfoText:(NSString *)text;
/** Indeterminate loading window and text */
+ (void)showLoadingWindowText:(NSString *)text;
/** hide window hud */
+ (void)hide;
/** Indeterminate loading window or view */
+ (SYProgressHUD *)showToLoadingView:(UIView *)view;
/** show center text*/
+ (SYProgressHUD *)showToCenterText:(NSString *)text;
/** show bottom text */
+ (SYProgressHUD *)showToBottomText:(NSString *)text;
+ (SYProgressHUD *)showToBottom30Text:(NSString *)text;
/** setting customImage and text */
+ (SYProgressHUD *)showToCustomImage:(UIImage *)image
text:(NSString *)text;
@end
#pragma mark - SYStatusBarNotification
@interface SYStatusBarNotification : CWStatusBarNotification
+ (void)showStatusBarNotificationText:(NSString *)text
textBackgroundColor:(UIColor *)textBackgroundColor fontSize:(CGFloat)fontSize;
+ (void)showNavigationBarNotificationText:(NSString *)text
textBackgroundColor:(UIColor *)textBackgroundColor
fontSize:(CGFloat)fontSize;
/** showStatusBarNotificationText */
+ (void)showStatusBarNotificationText:(NSString *)text;
/** showNavigationBarNotificationText */
+ (void)showNavigationBarNotificationText:(NSString *)text;
@end
|
/*
* Legal Notice
*
* This document and associated source code (the "Work") is a part of a
* benchmark specification maintained by the TPC.
*
* The TPC reserves all right, title, and interest to the Work as provided
* under U.S. and international laws, including without limitation all patent
* and trademark rights therein.
*
* No Warranty
*
* 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
* CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
* AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
* WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
* INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
* DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
* PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
* WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
* ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
* QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
* WITH REGARD TO THE WORK.
* 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
* ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
* COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
* OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
* INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
* OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
* RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
* ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
*
* Contributors
* - Sergey Vasilevskiy
*/
#ifndef ERROR_H
#define ERROR_H
#include <string>
namespace TPCE
{
#define ERR_TYPE_LOGIC -1 //logic error in program; internal error
#define ERR_SUCCESS 0 //success (a non-error error)
#define ERR_TYPE_OS 11 //operating system error
#define ERR_TYPE_MEMORY 12 //memory allocation error
#define ERR_TYPE_FIXED_MAP 27 //Error from CFixedMap
#define ERR_TYPE_FIXED_ARRAY 28 //Error from CFixedArray
#define ERR_TYPE_CHECK 29 //Check assertion error (from DriverParamSettings)
#define ERR_INS_MEMORY "Insufficient Memory to continue."
#define ERR_UNKNOWN "Unknown error."
#define ERR_MSG_BUF_SIZE 512
#define INV_ERROR_CODE -1
class CBaseErr : public std::exception
{
protected:
std::string m_location;
int m_idMsg;
public:
CBaseErr()
: m_location()
, m_idMsg(INV_ERROR_CODE)
{
}
CBaseErr(char const * szLoc)
: m_location(szLoc)
, m_idMsg(INV_ERROR_CODE)
{
}
CBaseErr(int idMsg)
: m_location()
, m_idMsg(idMsg)
{
}
CBaseErr(int idMsg, char const * szLoc)
: m_location(szLoc)
, m_idMsg(idMsg)
{
}
~CBaseErr() throw()
{
}
virtual const char* what() const throw() {
return ErrorText();
}
virtual int ErrorNum() { return m_idMsg; }
virtual int ErrorType() = 0; // a value which distinguishes the kind of error that occurred
virtual const char *ErrorText() const = 0; // a string (i.e., human readable) representation of the error
virtual const char *ErrorLoc() { return m_location.c_str(); }
};
class CMemoryErr : public CBaseErr
{
public:
CMemoryErr()
: CBaseErr()
{
}
CMemoryErr(char const * szLoc)
: CBaseErr(szLoc)
{
}
int ErrorType() {return ERR_TYPE_MEMORY;}
const char *ErrorText() const {return ERR_INS_MEMORY;}
};
class CSystemErr : public CBaseErr
{
public:
enum Action
{
eNone = 0,
eTransactNamedPipe,
eWaitNamedPipe,
eSetNamedPipeHandleState,
eCreateFile,
eCreateProcess,
eCallNamedPipe,
eCreateEvent,
eCreateThread,
eVirtualAlloc,
eReadFile = 10,
eWriteFile,
eMapViewOfFile,
eCreateFileMapping,
eInitializeSecurityDescriptor,
eSetSecurityDescriptorDacl,
eCreateNamedPipe,
eConnectNamedPipe,
eWaitForSingleObject,
eRegOpenKeyEx,
eRegQueryValueEx = 20,
ebeginthread,
eRegEnumValue,
eRegSetValueEx,
eRegCreateKeyEx,
eWaitForMultipleObjects,
eRegisterClassEx,
eCreateWindow,
eCreateSemaphore,
eReleaseSemaphore,
eFSeek,
eFRead,
eFWrite,
eTmpFile,
eSetFilePointer,
eNew,
eCloseHandle,
eCreateMutex,
eReleaseMutex
};
CSystemErr(Action eAction, char const * szLocation);
CSystemErr(int iError, Action eAction, char const * szLocation);
int ErrorType() { return ERR_TYPE_OS;};
const char *ErrorText(void) const;
Action m_eAction;
~CSystemErr() throw()
{
}
};
class CBaseTxnErr
{
public:
enum
{
SUCCESS = 0,
//Trade Order errors
UNAUTHORIZED_EXECUTOR,
ROLLBACK, // return from TradeOrderFrame5 to indicate transaction rollback
BAD_INPUT_DATA,
Last
} mErrCode;
static const char* szMsgs[CBaseTxnErr::Last+1];
static const char* ErrorText(int code);
};
class CCheckErr : public CBaseErr
{
private:
std::string name_;
std::string msg_;
public:
CCheckErr()
: CBaseErr()
{
}
~CCheckErr() throw()
{
}
CCheckErr(const char *name, const std::string& msg)
: CBaseErr(name)
, msg_(msg)
{
}
int ErrorType() {return ERR_TYPE_CHECK;}
const char *ErrorText() const {
return msg_.c_str();
}
};
} // namespace TPCE
#endif //ERROR_H
|
#include "kernel.h"
#define PAGE_PS_FLAG 0x80
void cpu_init_page_emu();
void cpu_emu_flush_tlb(DWORD page_dir_base_addr);
void write_to_vm_page_entry(int page_num, DWORD value);
void change_PSE_mode();
|
//
// AppDelegate.h
// RallyTeamStatus
//
// Created by Pairing on 6/6/13.
// Copyright (c) 2013 Rally Software. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
/*
* volume.c
*/
static const char *WHAT_STRING = "@(#)volume.c 1.1 (C) P. Durif 1994" ;
#include <stdio.h>
#include <stdlib.h>
#include "volume.h"
#include "erreurs.h"
static FILE
*vol = 0,
*vol_sauve = 0 ;
int vol_debut_creer (const char *volume)
{
if (vol_sauve) {
erreur = VOLUME_DEJA_MONTE ; return -1 ;
}
vol_sauve = vol ;
#ifdef __TURBOC__
if (!(vol = fopen (volume, "w+b"))) {
#else
if (!(vol = fopen (volume, "w+"))) {
#endif
vol = vol_sauve ; vol_sauve = 0 ;
erreur = VOLUME_INEXISTANT ; return -1 ;
}
return 0 ;
}
int vol_fin_creer (void)
{
if (! vol_sauve) {
erreur = VOLUME_DEJA_MONTE ; return -1 ;
}
fclose (vol) ;
vol = vol_sauve ;
vol_sauve = 0 ;
return 0 ;
}
int vol_monter (const char *volume)
{
if (vol) {
erreur = VOLUME_DEJA_MONTE ; return -1 ;
}
#ifdef __TURBOC__
if (!(vol = fopen (volume, "r+b"))) {
#else
if (!(vol = fopen (volume, "r+"))) {
#endif
erreur = VOLUME_INEXISTANT ; return -1 ;
}
return 0 ;
}
int vol_demonter (void)
{
if (vol == NULL) {
erreur = VOLUME_NON_MONTE ; return -1 ;
}
fclose (vol) ;
vol = 0 ;
return 0 ;
}
int vol_lire (NUM_BLOC n, VOL_BLOC b)
{
#ifdef DEBUG
printf ("lecture %d\n", n) ;
#endif
if (vol == NULL) {
erreur = VOLUME_NON_MONTE ; return -1 ;
}
fseek (vol, n*BLOC_SIZE, 0) ;
if (fread (b, BLOC_SIZE, 1, vol) != 1) {
perror ("vol_lire.fread") ;
exit(EXIT_FAILURE) ;
}
return 0 ;
}
int vol_ecrire (NUM_BLOC n, VOL_BLOC b)
{
#ifdef DEBUG
printf ("ecriture %d\n", n) ;
#endif
if (vol == NULL) {
erreur = VOLUME_NON_MONTE ; return -1 ;
}
fseek (vol, n*BLOC_SIZE, 0) ;
if (fwrite (b, BLOC_SIZE, 1, vol) != 1) {
perror ("vol_ecrire.fwrite") ; exit (1) ;
}
return 0 ;
}
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <iCloudSupport/iCloudViewController.h>
@class NSByteCountFormatter, NSDateFormatter, NSMutableDictionary, NSMutableSet, NSOutlineView;
@interface iCloudDocumentsViewController : iCloudViewController
{
id _itemNotificationToken;
NSMutableSet *_observationTokens;
NSMutableDictionary *_displayItemIndex;
NSOutlineView *_outlineView;
id _frameDidChangeNotificationToken;
NSDateFormatter *_dateFormatter;
NSByteCountFormatter *_sizeFormatter;
}
+ (id)descendingImage;
+ (id)ascendingImage;
@property(retain, nonatomic) NSByteCountFormatter *sizeFormatter; // @synthesize sizeFormatter=_sizeFormatter;
@property(retain, nonatomic) NSDateFormatter *dateFormatter; // @synthesize dateFormatter=_dateFormatter;
@property(retain, nonatomic) id frameDidChangeNotificationToken; // @synthesize frameDidChangeNotificationToken=_frameDidChangeNotificationToken;
@property(retain, nonatomic) NSOutlineView *outlineView; // @synthesize outlineView=_outlineView;
- (void).cxx_destruct;
- (void)primitiveInvalidate;
- (void)loadView;
- (void)reloadDocuments;
- (void)resizeColumnsInTable:(id)arg1;
- (void)sizeColumnWidthToFit:(id)arg1;
- (void)outlineView:(id)arg1 sortDescriptorsDidChange:(id)arg2;
- (void)outlineViewItemDidCollapse:(id)arg1;
- (void)outlineViewItemDidExpand:(id)arg1;
- (id)outlineView:(id)arg1 viewForTableColumn:(id)arg2 item:(id)arg3;
- (id)outlineView:(id)arg1 getValueAndFormatter:(out id *)arg2 forTableColumn:(id)arg3 item:(id)arg4;
- (BOOL)outlineView:(id)arg1 isItemExpandable:(id)arg2;
- (id)outlineView:(id)arg1 child:(long long)arg2 ofItem:(id)arg3;
- (long long)outlineView:(id)arg1 numberOfChildrenOfItem:(id)arg2;
- (id)rootItem;
- (id)indicatorImageForSortDescriptor:(id)arg1;
- (id)sortDescriptorForTableColumn:(id)arg1 ascending:(BOOL)arg2;
- (void)checkGaugeInView:(id)arg1 forItem:(id)arg2;
- (id)initWithEditor:(id)arg1;
@end
|
// system.h
// All global variables used in Nachos are defined here.
//
// Copyright (c) 1992-1993 The Regents of the University of California.
// All rights reserved. See copyright.h for copyright notice and limitation
// of liability and disclaimer of warranty provisions.
#ifndef SYSTEM_H
#define SYSTEM_H
#include <vector>
#include <map>
#include <string>
#include "copyright.h"
#include "utility.h"
#include "thread.h"
#include "scheduler.h"
#include "interrupt.h"
#include "stats.h"
#include "timer.h"
// Initialization and cleanup routines
// Initialization, called before anything else
extern void Initialize(int argc, char **argv);
// Cleanup, called when Nachos is done.
extern void Cleanup();
extern Thread *currentThread; // the thread holding the CPU
extern Thread *threadToBeDestroyed; // the thread that just finished
extern Scheduler *scheduler; // the ready list
extern Interrupt *interrupt; // interrupt status
extern Statistics *stats; // performance metrics
extern Timer *timer; // the hardware alarm clock
#ifdef USER_PROGRAM
#include "machine.h"
#include "synchconsole.h"
#include "processtable.h"
#include "bitmap.h"
extern Machine* machine; // user program memory and registers
extern SynchConsole* synchConsole;
extern ProcessTable* processTable;
extern BitMap* freeList;
extern std::map<SpaceId, std::vector<std::string> > userProgramArgs;
#endif
#ifdef FILESYS_NEEDED // FILESYS or FILESYS_STUB
#include "filesys.h"
extern FileSystem *fileSystem;
#endif
#ifdef FILESYS
#include "synchdisk.h"
extern SynchDisk *synchDisk;
#endif
#ifdef NETWORK
#include "post.h"
extern PostOffice* postOffice;
#endif
#ifdef PAGING
extern CoreMapEntry* coreMap;
extern List<int>* loadedPages;
#endif
#endif // SYSTEM_H
|
#ifndef __UTILITY_H__
#define __UTILITY_H__
#include <stdarg.h>
#include <stdio.h>
#include "singleton.h"
#include "fxtimer.h"
#include "thread.h"
#include "log_thread.h"
#include "redef_assert.h"
#include "defines.h"
#ifdef _WIN32
#include <io.h>
#else
#include <unistd.h>
#endif // _WIN32
namespace Utility
{
int GetPid();
char* GetExePath();
char* GetExeName();
const char* GetSeparator();
FILE* GetLogFile();
void PrintTrace(char* strTrace, int dwLen);
bool Log(char* strBuffer, unsigned int dwLen, const char* strFmt, ...);
void FxSleep(unsigned int dwMilliseconds);
const char* GetOsInfo();
class ListDirAndLoadFile
{
public:
virtual ~ListDirAndLoadFile()
{
}
virtual bool operator()(const char* pFileName) = 0;
};
void ListDir(const char* pDirName, ListDirAndLoadFile& refLoadFile);
}
//#define LogOutHeader(eLevel, os1)\
//{\
// if((eLevel < LogLv_Count)) \
// {\
// if(os1) {(*os1) << GetTimeHandler()->GetTimeStr() << "." << GetTimeHandler()->GetTimeSeq() << "\t";} \
//if (os1) { (*os1) << LogLevelString[eLevel] << "[" << __FILE__ << "," << __LINE__ << "," << __FUNCTION__; } \
// }\
//}
#endif //__UTILITY_H__
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import "NSTextView.h"
#import "IDEApplicationEventDelegate-Protocol.h"
@class DVTNotificationToken, IDEKeyBindingFieldCell, NSButton, NSColor;
@interface IDEKeyBindingFieldEditor : NSTextView <IDEApplicationEventDelegate>
{
unsigned int _savedHotKeyOperatingMode;
BOOL _needsToRestoreSavedHotKeyOperatingMode;
DVTNotificationToken *_windowDidBecomeKeyObserverToken;
DVTNotificationToken *_windowDidResignKeyObserverToken;
IDEKeyBindingFieldCell *_editingCell;
NSButton *_addKeyboardShortcutButton;
NSButton *_deleteKeyboardShortcutButton;
NSColor *_borderColor;
struct CGSize _buttonOffset;
}
@property(nonatomic) struct CGSize buttonOffet; // @synthesize buttonOffet=_buttonOffset;
@property(retain, nonatomic) NSColor *borderColor; // @synthesize borderColor=_borderColor;
@property(readonly) IDEKeyBindingFieldCell *editingCell; // @synthesize editingCell=_editingCell;
- (void).cxx_destruct;
- (BOOL)validateUserInterfaceItem:(id)arg1;
- (BOOL)shouldDrawInsertionPoint;
- (void)drawRect:(struct CGRect)arg1;
- (id)acceptableDragTypes;
- (id)writablePasteboardTypes;
- (id)readablePasteboardTypes;
- (void)endEditingKeyboardShortcut;
- (void)deleteKeyboardShortcut:(id)arg1;
- (void)addKeyboardShortcut:(id)arg1;
- (void)mouseDown:(id)arg1;
- (void)resetCursorRects;
- (BOOL)application:(id)arg1 shouldSendEvent:(id)arg2;
- (void)beginEditingKeyboardShortcutForCell:(id)arg1;
- (void)_setSelectionFromEvent:(id)arg1;
- (void)_syncDisplay;
- (void)viewDidMoveToWindow;
- (void)_restoreHotKeyOperationMode;
- (void)_disableHotKeyOperationMode;
- (void)setFrame:(struct CGRect)arg1;
@end
|
#pragma once
#include "GfxAnimation.h"
//////////////////////////////////////////////////////////////////////////
namespace GameScope
{
//////////////////////////////////////////////////////////////////////////
// Animation Instance
//////////////////////////////////////////////////////////////////////////
class GfxAnimationClip final
{
private:
// animation status
enum class eStatus
{
Stopped, // animation is completed or does not started
Playing, // currently playing
};
public:
// ctor / dtor
GfxAnimationClip()
: m_SpeedFactor(1.0f)
, m_AnimationTime()
, m_FrameIndex()
, m_PlaybackStatus()
, m_Progress()
, m_LastFrameIndex()
, m_FirstFrameIndex()
, m_FrameCount()
, m_Direction()
{}
~GfxAnimationClip()
{}
// Begin animation from start
void Start();
// End animation
void Stop();
// Render current animation frame
// @param position: Position
// @param paletteIndex: Palette index
void DrawCurrentFrame(const Point3D& position, eGfxPalette paletteIndex);
void DrawCurrentFrameCenterPos(const Point3D& position,
eGfxPalette paletteIndex);
// Update current animation progress
// @param deltaTime: Time since last update in seconds
void AdvanceTime(float_t deltaTime);
// Set current animation speed factor
// @param speedFactor: Speed factor, 1.0 is default speed
void SetSpeedFactor(float_t speedFactor);
// Set current animation progress time
// @param animationTime: Time
void SetAnimationTime(float_t animationTime);
// Set current animation progress
// @param animationProgress: Progress in range [0;1]
void SetProgress(float_t animationProgress);
// Get current animation frame
inline int32_t GetFirstFrameIndex() const { return m_FirstFrameIndex; }
inline int32_t GetLastFrameIndex() const { return m_LastFrameIndex; }
inline int32_t GetFrameCount() const { return m_FrameCount; }
inline int32_t GetFrameIndex() const { return m_FrameIndex; }
// Set current animation and reset state
// @param animation: Animation instance Reference
void SetAnimation(const Reference<GfxAnimation>& animation);
// Get current animation Reference
inline const Reference<GfxAnimation>& GetAnimation() const
{
return m_Animation;
}
// Get current animation progress
inline float_t GetSpeedFactor() const { return m_SpeedFactor; }
inline float_t GetProgress() const { return m_Progress; };
inline float_t GetAnimationTime() const { return m_AnimationTime; }
// Set current direction
// @param direction: Desired direction
void SetDirection(eDirection direction);
// Get current direction
inline eDirection GetDirection() const
{
return m_Direction;
}
// Get current animation state
inline bool IsAnimationStopped() const { return m_PlaybackStatus == eStatus::Stopped; }
inline bool IsAnimationPlaying() const { return m_PlaybackStatus != eStatus::Stopped; }
private:
void ResetState();
private:
Reference<GfxAnimation> m_Animation;
float_t m_AnimationTime;
float_t m_SpeedFactor; // 1.0 is normal speed
float_t m_Progress;
int32_t m_FrameIndex; // current frame
int32_t m_LastFrameIndex;
int32_t m_FirstFrameIndex;
int32_t m_FrameCount;
eStatus m_PlaybackStatus;
eDirection m_Direction;
};
} // namespace GameScope |
//
// MTIAsyncImageView.h
// MetalPetal
//
// Created by Yu Ao on 2019/6/12.
//
#if __has_include(<UIKit/UIKit.h>)
#import <UIKit/UIKit.h>
#if __has_include(<MetalPetal/MetalPetal.h>)
#import <MetalPetal/MTIDrawableRendering.h>
#else
#import "MTIDrawableRendering.h"
#endif
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString * const MTIImageViewErrorDomain;
typedef NS_ERROR_ENUM(MTIImageViewErrorDomain, MTIImageViewError) {
MTIImageViewErrorContextNotFound = 1001,
MTIImageViewErrorSameImage = 1002
};
@class MTIImage,MTIContext;
/// An image view that immediately draws its `image` on the calling thread. Most of the custom properties can be accessed from any thread safely. It's recommanded to use the `MTIImageView` which draws it's content on the main thread instead of this view.
__attribute__((objc_subclassing_restricted))
@interface MTIThreadSafeImageView : UIView <MTIDrawableProvider>
@property (nonatomic) BOOL automaticallyCreatesContext;
@property (atomic) MTLPixelFormat colorPixelFormat;
@property (atomic) MTLClearColor clearColor;
/// This property aliases the colorspace property of the view's CAMetalLayer
@property (atomic, nullable) CGColorSpaceRef colorSpace;
@property (atomic) MTIDrawableRenderingResizingMode resizingMode;
@property (atomic, strong, nullable) MTIContext *context;
@property (atomic, nullable, strong) MTIImage *image;
/// Update the image. `renderCompletion` will be called when the rendering is finished or failed. The callback will be called on current thread or a metal internal thread.
- (void)setImage:(MTIImage * __nullable)image renderCompletion:(void (^ __nullable)(NSError * __nullable error))renderCompletion;
@end
NS_ASSUME_NONNULL_END
#endif
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@class SBWorkStore;
@protocol SBWorkStoreObserver <NSObject>
- (void)workDidChange:(SBWorkStore *)arg1;
@end
|
//
// MineViewController.h
// RongChatRoomDemo
//
// Created by 弘鼎 on 2017/8/9.
// Copyright © 2017年 rongcloud. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface MineViewController : UIViewController
@end
|
#ifndef SCRIPTHANDLE_H
#define SCRIPTHANDLE_H
#ifndef ANGELSCRIPT_H
// Avoid having to inform include path if header is already include before
#include <angelscript.h>
#endif
BEGIN_AS_NAMESPACE
class CScriptHandle
{
public:
// Constructors
CScriptHandle();
CScriptHandle(const CScriptHandle &other);
CScriptHandle(void *ref, asIObjectType *type);
~CScriptHandle();
// Copy the stored value from another any object
CScriptHandle &operator=(const CScriptHandle &other);
// Set the reference
void Set(void *ref, asIObjectType *type);
// Compare equalness
bool operator==(const CScriptHandle &o) const;
bool operator!=(const CScriptHandle &o) const;
bool Equals(void *ref, int typeId) const;
// Dynamic cast to desired handle type
void Cast(void **outRef, int typeId);
// Returns the type of the reference held
asIObjectType *GetType() const;
int GetTypeId() const;
// Get the reference
void *GetRef();
protected:
// These functions need to have access to protected
// members in order to call them from the script engine
friend void Construct(CScriptHandle *self, void *ref, int typeId);
friend void RegisterScriptHandle_Native(asIScriptEngine *engine);
friend void CScriptHandle_AssignVar_Generic(asIScriptGeneric *gen);
void ReleaseHandle();
void AddRefHandle();
// These shouldn't be called directly by the
// application as they requires an active context
CScriptHandle(void *ref, int typeId);
CScriptHandle &Assign(void *ref, int typeId);
void *m_ref;
asIObjectType *m_type;
};
void RegisterScriptHandle(asIScriptEngine *engine);
END_AS_NAMESPACE
#endif
|
/*
* Copyright (c) 2005-2006 Carnegie Mellon University and Intel Corporation.
* All rights reserved.
* See the file "LICENSE" for licensing terms.
*/
#ifndef _XFER_XSET_H_
#define _XFER_XSET_H_
#include "xferPlugin.h"
#include "gtcd.h"
#include "xferPlugin_gtc_prot.h"
#include "se_transfer.h"
#include "params.h"
#include "rxx.h"
#include "xferPlugin_opt.h"
typedef callback<void, ref< vec<dot_descriptor> >, ref<hv_vec> >::ref update_cb;
struct hint_cache {
oid_hint hint;
str name;
ihash_entry<hint_cache> hlink;
hint_cache(oid_hint, str);
~hint_cache();
};
struct chunk_cache_entry {
const dot_desc cid;
ihash_entry<chunk_cache_entry> hlink;
ihash<const str, hint_cache, &hint_cache::name, &hint_cache::hlink> hints_hash;
chunk_cache_entry (const dot_desc o);
~chunk_cache_entry();
};
class oid_info {
public:
dot_oid oid;
cbs cb;
ptr<vec<dot_descriptor> > descs;
gtcd *m;
ptr<dht_rpc> dht;
ptr<vec<oid_hint> > hints;
ptr<bitvec> bv;
ihash_entry<oid_info> hlink;
oid_info(const dot_oid &, cbs cb, ptr<vec<dot_descriptor> > descs, gtcd *m);
~oid_info() { }
void get_oid_sources_done(str err, ptr<vec<bamboo_value> > results);
void get_descriptors_cb(str s, ptr<vec<dot_descriptor> > descsin, bool end);
} ;
class src_info {
public:
str key;
dot_oid oid;
double time;
bool inprogress;
ptr<bitvec> bmp;
oid_hint hint;
ptr<vec<oid_hint> > hints_arg;
ptr<dot_oid_md> oid_arg;
ihash_entry<src_info> hlink;
src_info(oid_hint, dot_oid, unsigned int);
~src_info();
} ;
typedef ihash<const str, src_info, &src_info::key, &src_info::hlink> src_hash;
struct oid_netcache_entry {
const dot_oid oid;
ref<ordered_descriptor_list> slist;
int shingles_done;
int oids_done;
int oid_insert_done;
update_cb cb;
gtcd *m;
//for partial sources
bool next_event;
unsigned int ident_count;
unsigned int sim_count;
src_hash ident_srcs;
src_hash sim_srcs;
ptr<vec<dot_descriptor> > self_descs;
ihash_entry<oid_netcache_entry> hlink;
std::vector< ref<dht_rpc> > status ;
ihash<const dot_oid, oid_info, &oid_info::oid, &oid_info::hlink, do_hash> oidstatus;
ptr<dht_rpc> oidinsert_status;
oid_netcache_entry (const dot_oid o, update_cb, gtcd *m);
~oid_netcache_entry();
void net_lookup();
void net_lookup_refresh();
void net_insert_refresh();
void get_fp_oids_done(str err, ptr<vec<bamboo_value> > results);
void net_lookup_oid_done(dot_oid oid, str err);
void put_oid_source_done(str err);
void pick_sources(dot_oid);
void get_bitmap_cb(src_info *src, str err, ptr<bitvec > bmp);
void get_bitmap_refresh();
private:
void get_bitmap_refresh_sources(src_hash *srcs);
};
//-------------------------------------------------------------
class xferPlugin_xset : public xferPlugin {
private:
gtcd *m;
xferPlugin *xp;
void get_chunk(ref<dot_descriptor> d, ref<vec<oid_hint> > hints,
chunk_cb cb, CLOSURE);
void get_hints_chunk_cache(dot_desc cid, ref<vec<oid_hint > > hintsin);
public:
bool configure(str s, str pluginClass) { return true; }
/* Calls from the GTC */
void xp_get_descriptors(ref<dot_oid_md> oid, ref<vec<oid_hint> > hints,
descriptors_cb cb, CLOSURE);
void xp_notify_descriptors(ref<dot_oid_md> oid, ptr<vec<dot_descriptor> > descs);
void xp_get_bitmap(ref<dot_oid_md> oid, ref<vec<oid_hint> > hints,
bitmap_cb cb, CLOSURE);
void xp_get_chunks(ref< vec<dot_descriptor> > dv, ref<hv_vec > hints,
chunk_cb cb, CLOSURE);
void cancel_chunk(ref<dot_descriptor> d, cancel_cb cb, CLOSURE);
void cancel_chunks(ref< vec<dot_descriptor> > dv, cancel_cb cb, CLOSURE);
void update_hints(ref< vec<dot_descriptor> > dv, ref<hv_vec > hints);
static bool insert_chunk_cache(dot_desc cid, ptr<vec<oid_hint> > srcdata,
ref<vec<oid_hint> > new_hints);
void xp_dump_statistics() { xp->xp_dump_statistics(); }
xferPlugin_xset(gtcd *m, xferPlugin *next_xp);
~xferPlugin_xset();
};
#endif /* _XFER_XSET_H_ */
|
/*
* clustering.h
*
* Created on: Sep 23, 2013
* Author: vinhtt
*/
#ifndef __CLUSTERING_H__
#define __CLUSTERING_H__
#include "flags.h"
#include <vl/kmeans.h>
#include <vl/gmm.h>
#include <vl/fisher.h>
#include <vl/svm.h>
pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
vector<DATATYPE*> fvlist;
vector<int> labels;
int dms = 0;
int len = 0;
void encode(DATATYPE* data, int numData, int dimension, int numClusters,
int label) {
// KMeans
VlKMeans* kmeans = vl_kmeans_new(CLUSTERING_DATATYPE, VlDistanceL2);
vl_kmeans_set_algorithm(kmeans, VlKMeansLloyd); // Use Lloyd algorithm
vl_kmeans_set_max_num_iterations(kmeans, 100);// Run at most 100 iterations of cluster refinement
vl_kmeans_init_centers_plus_plus(kmeans, data, dimension, numData,
numClusters);// Initialize the cluster centers by randomly sampling the data
vl_kmeans_cluster(kmeans, data, dimension, numData, numClusters);
// GMM
VlGMM* gmm = vl_gmm_new(CLUSTERING_DATATYPE, dimension, numClusters);
vl_gmm_set_max_num_iterations(gmm, 1000);// set the maximum number of EM iterations to 1000
vl_gmm_set_kmeans_init_object(gmm, kmeans);
vl_gmm_cluster(gmm, data, numData);
dms = 2 * numClusters * dimension;
// run fisher encoding
DATATYPE* enc = (DATATYPE*) vl_malloc(sizeof(DATATYPE) * dms);// allocate space for the encoding
vl_fisher_encode(enc, CLUSTERING_DATATYPE, vl_gmm_get_means(gmm), dimension,
numClusters, vl_gmm_get_covariances(gmm), vl_gmm_get_priors(gmm),
data, numData,
VL_FISHER_FLAG_IMPROVED);
// put into the vector list
pthread_mutex_lock(&mutex);
fvlist.push_back(enc);
labels.push_back(label);
pthread_mutex_unlock(&mutex);
// free the memory
vl_free(enc);
vl_gmm_delete(gmm);
vl_kmeans_delete(kmeans);
}
//void svm_classify() {
// double lambda = 0.01;
// double bias;
//
// cout << "allocating data: ";
// flush(cout);
// int numData = fvlist.size();
// cout << numData << "x" << dms << "... ";
// flush(cout);
// double data[numData*dms];
// double label[numData];
// cout << "copying data... " << numData << "x" << dms << "... ";
// flush(cout);
// for (int i = 0; i < numData; i++)
// {
// for (int j = 0; j < dms; j++)
// data[i*dms + j] = (double)(fvlist[i])[j];
//// label[i] = (double)labels[i];
// }
//
// cout << "training svm... ";
// flush(cout);
// VlSvm* svm = vl_svm_new(VlSvmSolverSgd, data, dms, numData, label, lambda);
// cout << "start svm... ";
// flush(cout);
// vl_svm_train(svm);
//
// double const * model = vl_svm_get_model(svm);
// bias = vl_svm_get_bias(svm);
//// printf("model w = [ %f , %f ] , bias b = %f \n", model[0], model[1], bias);
// vl_svm_delete(svm);
//}
#endif
|
// 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 UI_GL_GL_SURFACE_H_
#define UI_GL_GL_SURFACE_H_
#include <string>
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/size.h"
#include "ui/gl/gl_export.h"
namespace gfx {
class GLContext;
class VSyncProvider;
class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> {
public:
GLSurface();
virtual bool Initialize();
virtual void Destroy() = 0;
virtual bool Resize(const gfx::Size& size);
virtual bool Recreate();
virtual bool DeferDraws();
virtual bool IsOffscreen() = 0;
virtual bool SwapBuffers() = 0;
virtual gfx::Size GetSize() = 0;
virtual void* GetHandle() = 0;
virtual std::string GetExtensions();
bool HasExtension(const char* name);
virtual unsigned int GetBackingFrameBufferObject();
virtual bool PostSubBuffer(int x, int y, int width, int height);
static bool InitializeOneOff();
virtual bool OnMakeCurrent(GLContext* context);
virtual bool SetBackbufferAllocation(bool allocated);
virtual void SetFrontbufferAllocation(bool allocated);
virtual void* GetShareHandle();
virtual void* GetDisplay();
virtual void* GetConfig();
virtual unsigned GetFormat();
virtual VSyncProvider* GetVSyncProvider();
static scoped_refptr<GLSurface> CreateViewGLSurface(
gfx::AcceleratedWidget window);
static scoped_refptr<GLSurface> CreateOffscreenGLSurface(
const gfx::Size& size);
static GLSurface* GetCurrent();
protected:
virtual ~GLSurface();
static bool InitializeOneOffInternal();
static void SetCurrent(GLSurface* surface);
static bool ExtensionsContain(const char* extensions, const char* name);
private:
friend class base::RefCounted<GLSurface>;
friend class GLContext;
DISALLOW_COPY_AND_ASSIGN(GLSurface);
};
class GL_EXPORT GLSurfaceAdapter : public GLSurface {
public:
explicit GLSurfaceAdapter(GLSurface* surface);
virtual bool Initialize() OVERRIDE;
virtual void Destroy() OVERRIDE;
virtual bool Resize(const gfx::Size& size) OVERRIDE;
virtual bool Recreate() OVERRIDE;
virtual bool DeferDraws() OVERRIDE;
virtual bool IsOffscreen() OVERRIDE;
virtual bool SwapBuffers() OVERRIDE;
virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE;
virtual std::string GetExtensions() OVERRIDE;
virtual gfx::Size GetSize() OVERRIDE;
virtual void* GetHandle() OVERRIDE;
virtual unsigned int GetBackingFrameBufferObject() OVERRIDE;
virtual bool OnMakeCurrent(GLContext* context) OVERRIDE;
virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE;
virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE;
virtual void* GetShareHandle() OVERRIDE;
virtual void* GetDisplay() OVERRIDE;
virtual void* GetConfig() OVERRIDE;
virtual unsigned GetFormat() OVERRIDE;
virtual VSyncProvider* GetVSyncProvider() OVERRIDE;
GLSurface* surface() const { return surface_.get(); }
protected:
virtual ~GLSurfaceAdapter();
private:
scoped_refptr<GLSurface> surface_;
DISALLOW_COPY_AND_ASSIGN(GLSurfaceAdapter);
};
}
#endif
|
#pragma once
#include "AI.h"
class SpaceAI : public AI
{
public:
SpaceAI(ControllablePlayer& player, const ViewableWorld& view)
:
AI(player, view)
{
goalLeft = Vec2(80.0f, 360.0f);
goalRight = Vec2(1200.0f, 360.0f);
}
protected:
Vec2 goalLeft;
Vec2 goalRight;
virtual void _Process() override
{
const Player& me = player.PlayerConst();
const Player& other = [me, this]() -> const Player&
{
for (const Player& p : view.GetPlayers())
{
if (p != me)
{
return p;
}
}
// should not ever see this... unless <= 1 player in game :?
assert(false);
return me;
}();
Vec2 ballPos = view.GetBalls().front().GetCenter();
Vec2 ballToOpp = ((ballPos - other.GetCenter()));
Vec2 vecToBall = ballPos - me.GetCenter();
Vec2 attackOpp = other.GetCenter() - me.GetCenter();
Vec2 pointOfAttack = ballPos + ballToOpp.Normalize() * (me.GetRadius() + view.GetBalls().front().GetRadius());
Vec2 dirPointOfAttack = pointOfAttack - me.GetCenter();
Vec2 dirGoalRight = goalRight - me.GetCenter();
static Vec2 dirDown = Vec2(0, 1).Normalize();
static Vec2 dirUp = Vec2(0, -1).Normalize();
Vec2 dirDefendBottm = ballPos + (dirDown * me.GetRadius()*1.5) - me.GetCenter();
Vec2 dirDefendTop = ballPos + (dirUp * me.GetRadius()*1.5) - me.GetCenter();
player.SetThrustVector(dirPointOfAttack.Normalize());
static float playerBallRad = (me.GetRadius() + view.GetBalls().front().GetRadius());
static float ballRad = view.GetBalls().front().GetRadius();
if (vecToBall.Len() < playerBallRad * 2 + ballRad * 2 && vecToBall.x > Vec2(0,0).x)
{
/*if (me.GetCenter().x < ballPos.x)
{
player.SetThrustVector(dirGoalRight.Normalize());
}*/
if (me.GetCenter().y < ballPos.y)
{
player.SetThrustVector(dirDefendBottm.Normalize());
}
else
{
player.SetThrustVector(dirDefendTop.Normalize());
}
player.Burst();
}
if (/*vecToBall.Len() < playerBallRad * 2 + ballRad * 2 && */vecToBall.x < Vec2(0, 0).x)
{
if (me.GetCenter().y > ballPos.y)
{
player.SetThrustVector(dirDefendBottm.Normalize());
}
else
{
player.SetThrustVector(dirDefendTop.Normalize());
}
player.Burst();
}
}
};
class SpaceAIFactory : public Controller::Factory
{
public:
SpaceAIFactory()
:
Factory(L"Space")
{}
virtual std::unique_ptr< Controller > Make(ControllablePlayer& player, const ViewableWorld& view) override
{
return std::make_unique< SpaceAI >(player, view);
}
}; |
#ifndef __CAN_PLATFORM_TI_D_CAN_H__
#define __CAN_PLATFORM_TI_D_CAN_H__
/*
* D_CAN controller driver platform header
*
* Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
* Anil Kumar Ch <anilkumar@ti.com>
*
* Bosch D_CAN controller is compliant to CAN protocol version 2.0 part A and B.
* Bosch D_CAN user manual can be obtained from:
* http://www.semiconductors.bosch.de/media/en/pdf/ipmodules_1/can/
* d_can_users_manual_111.pdf
*
* 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.
*
* This program is distributed "as is" WITHOUT ANY WARRANTY of any
* kind, whether express or implied; without even the implied warranty
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
/**
* struct d_can_platform_data - DCAN Platform Data
*
* @d_can_offset: mostly 0 - should really never change
* @d_can_ram_offset: d_can RAM offset
* @msg_obj_offset: Mailbox RAM offset
* @num_of_msg_objs: Number of message objects
* @dma_support: DMA support is required/not
* test_mode_enable: Test mode enable bit
* @parity_check: Parity error checking is needed/not
* @fck_name Functional clock name
* @ick_name Interface clock name
* @version: version for future use
*
* Platform data structure to get all platform specific settings.
* this structure also accounts the fact that the IP may have different
* RAM and mailbox offsets for different SOC's
*/
struct d_can_platform_data {
u32 d_can_offset;
u32 d_can_ram_offset;
u32 msg_obj_offset;
u32 num_of_msg_objs;
bool dma_support;
bool test_mode_enable;
bool parity_check;
u32 version;
char *fck_name;
char *ick_name;
};
#endif
|
/*
* linux/drivers/video/backlight/pwm_bl.c
*
* simple PWM based backlight control, board code has to setup
* 1) pin configuration so PWM waveforms can output
* 2) platform_data being correctly configured
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/fb.h>
#include <linux/backlight.h>
#include <linux/err.h>
#include <linux/pwm.h>
#include <linux/pwm_backlight.h>
#include <linux/slab.h>
struct pwm_bl_data {
struct pwm_device *pwm;
struct device *dev;
unsigned int period;
unsigned int lth_brightness;
int (*notify)(struct device *,
int brightness);
int (*check_fb)(struct device *, struct fb_info *);
};
static int pwm_backlight_update_status(struct backlight_device *bl)
{
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
int brightness = bl->props.brightness;
int max = bl->props.max_brightness;
brightness = abs(255 -brightness);
// brightness /=2;
// printk("brightness = %d\n",brightness);
if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;
if (bl->props.fb_blank != FB_BLANK_UNBLANK)
brightness = 0;
if (pb->notify)
brightness = pb->notify(pb->dev, brightness);
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
brightness = pb->lth_brightness +
(brightness * (pb->period - pb->lth_brightness) / max);
pwm_config(pb->pwm, brightness, pb->period);
pwm_enable(pb->pwm);
}
return 0;
}
static int pwm_backlight_get_brightness(struct backlight_device *bl)
{
return bl->props.brightness;
}
static int pwm_backlight_check_fb(struct backlight_device *bl,
struct fb_info *info)
{
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
return !pb->check_fb || pb->check_fb(pb->dev, info);
}
static const struct backlight_ops pwm_backlight_ops = {
.update_status = pwm_backlight_update_status,
.get_brightness = pwm_backlight_get_brightness,
.check_fb = pwm_backlight_check_fb,
};
static int pwm_backlight_probe(struct platform_device *pdev)
{
struct backlight_properties props;
struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
struct backlight_device *bl;
struct pwm_bl_data *pb;
int ret;
if (!data) {
dev_err(&pdev->dev, "failed to find platform data\n");
return -EINVAL;
}
if (data->init) {
ret = data->init(&pdev->dev);
if (ret < 0)
return ret;
}
pb = kzalloc(sizeof(*pb), GFP_KERNEL);
if (!pb) {
dev_err(&pdev->dev, "no memory for state\n");
ret = -ENOMEM;
goto err_alloc;
}
pb->period = data->pwm_period_ns;
pb->notify = data->notify;
pb->check_fb = data->check_fb;
pb->lth_brightness = data->lth_brightness *
(data->pwm_period_ns / data->max_brightness);
pb->dev = &pdev->dev;
pb->pwm = pwm_request(data->pwm_id, "backlight");
if (IS_ERR(pb->pwm)) {
dev_err(&pdev->dev, "unable to request PWM for backlight\n");
ret = PTR_ERR(pb->pwm);
goto err_pwm;
} else
dev_dbg(&pdev->dev, "got pwm for backlight\n");
memset(&props, 0, sizeof(struct backlight_properties));
props.type = BACKLIGHT_RAW;
props.max_brightness = data->max_brightness;
bl = backlight_device_register(dev_name(&pdev->dev), &pdev->dev, pb,
&pwm_backlight_ops, &props);
if (IS_ERR(bl)) {
dev_err(&pdev->dev, "failed to register backlight\n");
ret = PTR_ERR(bl);
goto err_bl;
}
bl->props.brightness = data->dft_brightness;
backlight_update_status(bl);
platform_set_drvdata(pdev, bl);
return 0;
err_bl:
pwm_free(pb->pwm);
err_pwm:
kfree(pb);
err_alloc:
if (data->exit)
data->exit(&pdev->dev);
return ret;
}
static int pwm_backlight_remove(struct platform_device *pdev)
{
struct platform_pwm_backlight_data *data = pdev->dev.platform_data;
struct backlight_device *bl = platform_get_drvdata(pdev);
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
backlight_device_unregister(bl);
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
pwm_free(pb->pwm);
kfree(pb);
if (data->exit)
data->exit(&pdev->dev);
return 0;
}
#ifdef CONFIG_PM
static int pwm_backlight_suspend(struct platform_device *pdev,
pm_message_t state)
{
struct backlight_device *bl = platform_get_drvdata(pdev);
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
if (pb->notify)
pb->notify(pb->dev, 0);
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
return 0;
}
static int pwm_backlight_resume(struct platform_device *pdev)
{
struct backlight_device *bl = platform_get_drvdata(pdev);
backlight_update_status(bl);
return 0;
}
#else
#define pwm_backlight_suspend NULL
#define pwm_backlight_resume NULL
#endif
static struct platform_driver pwm_backlight_driver = {
.driver = {
.name = "pwm-backlight",
.owner = THIS_MODULE,
},
.probe = pwm_backlight_probe,
.remove = pwm_backlight_remove,
.suspend = pwm_backlight_suspend,
.resume = pwm_backlight_resume,
};
static int __init pwm_backlight_init(void)
{
return platform_driver_register(&pwm_backlight_driver);
}
module_init(pwm_backlight_init);
static void __exit pwm_backlight_exit(void)
{
platform_driver_unregister(&pwm_backlight_driver);
}
module_exit(pwm_backlight_exit);
MODULE_DESCRIPTION("PWM based Backlight Driver");
MODULE_LICENSE("GPL");
MODULE_ALIAS("platform:pwm-backlight");
|
/*
* Generated by MTK SP Drv_CodeGen Version 10.03.0 for MT6589_NP. Copyright MediaTek Inc. (C) 2012.
* Fri Jul 26 05:40:03 2013
* Do Not Modify the File.
*/
#ifndef _CUST_KPD_H_
#define _CUST_KPD_H_
#include <linux/input.h>
#include <cust_eint.h>
#define KPD_YES 1
#define KPD_NO 0
/* available keys (Linux keycodes) */
#define KEY_CALL KEY_SEND
#define KEY_ENDCALL KEY_END
#undef KEY_OK
#define KEY_OK KEY_REPLY /* DPAD_CENTER */
#define KEY_FOCUS KEY_HP
#define KEY_AT KEY_EMAIL
#define KEY_POUND 228 //KEY_KBDILLUMTOGGLE
#define KEY_STAR 227 //KEY_SWITCHVIDEOMODE
#define KEY_DEL KEY_BACKSPACE
#define KEY_SYM KEY_COMPOSE
/* KEY_HOME */
/* KEY_BACK */
/* KEY_VOLUMEDOWN */
/* KEY_VOLUMEUP */
/* KEY_MUTE */
/* KEY_MENU */
/* KEY_UP */
/* KEY_DOWN */
/* KEY_LEFT */
/* KEY_RIGHT */
/* KEY_CAMERA */
/* KEY_POWER */
/* KEY_TAB */
/* KEY_ENTER */
/* KEY_LEFTSHIFT */
/* KEY_COMMA */
/* KEY_DOT */ /* PERIOD */
/* KEY_SLASH */
/* KEY_LEFTALT */
/* KEY_RIGHTALT */
/* KEY_SPACE */
/* KEY_SEARCH */
/* KEY_0 ~ KEY_9 */
/* KEY_A ~ KEY_Z */
/*
* Power key's HW keycodes are 8, 17, 26, 35, 44, 53, 62, 71. Only [8] works
* for Power key in Keypad driver, so we set KEY_ENDCALL in [8] because
* EndCall key is Power key in Android. If KPD_PWRKEY_USE_EINT is YES, these
* eight keycodes will not work for Power key.
*/
#define KPD_KEY_DEBOUNCE 0 /* (val / 32) ms */
#define KPD_PWRKEY_MAP KEY_POWER
/* HW keycode [0 ~ 71] -> Linux keycode */
#define KPD_INIT_KEYMAP() \
{ \
[0] = KEY_VOLUMEDOWN, \
[2] = KEY_VOLUMEUP, \
}
/*****************************************************************/
/*******************Preload Customation***************************/
/*****************************************************************/
#define KPD_PWRKEY_EINT_GPIO GPIO0
#define KPD_PWRKEY_GPIO_DIN 0
#define KPD_DL_KEY1 0 /* KEY_VOLUMEDOWN */
/*****************************************************************/
/*******************Uboot Customation***************************/
/*****************************************************************/
#define MT65XX_RECOVERY_KEY 2 /* KEY_VOLUMEUP */
#define MT65XX_FACTORY_KEY 0 /* KEY_VOLUMEDOWN */
/*****************************************************************/
/*******************factory Customation***************************/
/*****************************************************************/
#define KEYS_PWRKEY_MAP { KEY_POWER, "Power" }
#define DEFINE_KEYS_KEYMAP(x) \
struct key x[] = { \
KEYS_PWRKEY_MAP, \
{ KEY_VOLUMEDOWN, "VLDown" }, \
{ KEY_VOLUMEUP, "VLUp" }, \
}
#define CUST_KEY_UP KEY_VOLUMEUP
#define CUST_KEY_VOLUP KEY_VOLUMEUP
#define CUST_KEY_CONFIRM KEY_POWER
#define CUST_KEY_BACK KEY_VOLUMEUP
/*****************************************************************/
/*******************recovery Customation****************************/
/*****************************************************************/
#endif
|
/*
* jchuff.h
*
* Copyright (C) 1991-1997, Thomas G. Lane.
* This file is part of the Independent JPEG Group's software.
* For conditions of distribution and use, see the accompanying README file.
*
* This file contains declarations for Huffman entropy encoding routines
* that are shared between the sequential encoder (jchuff.c) and the
* progressive encoder (jcphuff.c). No other modules need to see these.
*/
/* The legal range of a DCT coefficient is
* -1024 .. +1023 for 8-bit data;
* -16384 .. +16383 for 12-bit data.
* Hence the magnitude should always fit in 10 or 14 bits respectively.
*/
#if BITS_IN_JSAMPLE == 8
#define MAX_COEF_BITS 10
#else
#define MAX_COEF_BITS 14
#endif
/* Derived data constructed for each Huffman table */
typedef struct {
unsigned int ehufco[256]; /* code for each symbol */
char ehufsi[256]; /* length of code for each symbol */
/* If no code has been allocated for a symbol S, ehufsi[S] contains 0 */
} c_derived_tbl;
/* Short forms of external names for systems with brain-damaged linkers. */
#ifdef NEED_SHORT_EXTERNAL_NAMES
#define jpeg_make_c_derived_tbl jMkCDerived
#define jpeg_gen_optimal_table jGenOptTbl
#endif /* NEED_SHORT_EXTERNAL_NAMES */
/* Expand a Huffman table definition into the derived format */
EXTERN(void)
jpeg_make_c_derived_tbl JPP((j_compress_ptr cinfo, boolean isDC, int tblno,
c_derived_tbl** pdtbl));
/* Generate an optimal table definition given the specified counts */
EXTERN(void)
jpeg_gen_optimal_table JPP((j_compress_ptr cinfo, JHUFF_TBL* htbl,
long freq[]));
|
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD 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.
* OpenTTD 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 OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ship.h Base for ships. */
#ifndef SHIP_H
#define SHIP_H
#include "vehicle_base.h"
void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
/**
* All ships have this type.
*/
struct Ship: public SpecializedVehicle<Ship, VEH_SHIP> {
TrackBitsByte state; ///< The "track" the ship is following.
/** We don't want GCC to zero our struct! It already is zeroed and has an index! */
Ship() : SpecializedVehicleBase() {}
/** We want to 'destruct' the right class. */
virtual ~Ship() { this->PreDestructor(); }
void MarkDirty();
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
void PlayLeaveStationSound() const;
bool IsPrimaryVehicle() const { return true; }
SpriteID GetImage(Direction direction) const;
int GetDisplaySpeed() const { return this->cur_speed / 2; }
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
Money GetRunningCost() const;
bool IsInDepot() const { return this->state == TRACK_BIT_DEPOT; }
bool Tick();
void OnNewDay();
Trackdir GetVehicleTrackdir() const;
TileIndex GetOrderStationLocation(StationID station);
bool FindClosestDepot(TileIndex *location, DestinationID *destination, bool *reverse);
void UpdateCache();
};
/**
* Iterate over all ships.
* @param var The variable used for iteration.
*/
#define FOR_ALL_SHIPS(var) FOR_ALL_VEHICLES_OF_TYPE(Ship, var)
#endif /* SHIP_H */
|
/*
Copyright (C) 2001 Alejandro Dubrovsky
* 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 Library 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.
*/
#include "common.h"
#include "hash.h"
#include "board.h"
#include <libale.h>
#include <stdlib.h>
void clearHashTable(hashTable * hashtable)
{
unsigned size, i;
if (hashtable != NULL) {
size = hashtable->size;
for (i = 0; i < size; i++) {
hashtable->white[i].depth = -1;
hashtable->black[i].depth = -1;
}
}
}
hashTable *initialiseHashTableBySize(unsigned hashkilobytes) {
unsigned entries;
entries = 1024 * hashkilobytes / (sizeof(hashChunk));
return initialiseHashTable(entries);
}
hashTable *initialiseHashTable(unsigned hashsize)
{
int i, j;
hashTable *hashtable;
if (hashsize > 0) {
hashtable = (hashTable *) xmalloc(sizeof(hashTable));
hashtable->size = hashsize >> 1;
hashtable->white =
(hashChunk *) xmalloc(sizeof(hashChunk) * hashtable->size);
hashtable->black =
(hashChunk *) xmalloc(sizeof(hashChunk) * hashtable->size);
for (i = 0; i < 14; i++) {
for (j = 0; j < 128; j++) {
hashtable->piecekeys[i][j] = (((U64) ((unsigned short int) random())) << 48) +
(((U64) ((unsigned short int) random())) << 32) +
(((U64) ((unsigned short int) random())) << 16) +
(((U64) ((unsigned short int) random())));
}
}
hashtable->wqcastle = (((U64) ((unsigned short int) random())) << 48) +
(((U64) ((unsigned short int) random())) << 32) +
(((U64) ((unsigned short int) random())) << 16) +
(((U64) ((unsigned short int) random())));
hashtable->wkcastle = (((U64) ((unsigned short int) random())) << 48) +
(((U64) ((unsigned short int) random())) << 32) +
(((U64) ((unsigned short int) random())) << 16) +
(((U64) ((unsigned short int) random())));
hashtable->bqcastle = (((U64) ((unsigned short int) random())) << 48) +
(((U64) ((unsigned short int) random())) << 32) +
(((U64) ((unsigned short int) random())) << 16) +
(((U64) ((unsigned short int) random())));
hashtable->bkcastle = (((U64) ((unsigned short int) random())) << 48) +
(((U64) ((unsigned short int) random())) << 32) +
(((U64) ((unsigned short int) random())) << 16) +
(((U64) ((unsigned short int) random())));
/*hashtable->blackhash = random() % hashsize; */
clearHashTable(hashtable);
} else {
hashtable = NULL;
}
return hashtable;
}
U64 getHashKey(hashTable * hashtable, Board * board)
{
int i, wking;
U64 key;
key = 0L;
wking = (int) WKING;
i = A1;
while (i <= H8) {
key ^= hashtable->piecekeys[(int) board->squares[i] - wking][x88ToStandard(i)];
i++;
if (i & OUT) i+=8;
}
if (board->palp[board->ply] >= 0) {
key ^= hashtable->piecekeys[PALPHASHKEY][board->palp[board->ply]];
}
if (!board->wkcastle) {
key ^= hashtable->wkcastle;
}
if (!board->wqcastle) {
key ^= hashtable->wqcastle;
}
if (!board->bkcastle) {
key ^= hashtable->bkcastle;
}
if (!board->bqcastle) {
key ^= hashtable->bqcastle;
}
/*if (board->blackturn) {
* key ^= hashtable->blackhash;
* } */
return key;
}
|
#include "eqntns.h"
void depupdt(void )
{
calcrho();
calccfl();
if (MTdep != -1)
calcmt();
#if _DBG == 10
calcdbgdep();
#endif
}
// Cells density update ---------
void calcrho(void )
{
int icell;
double *phi, *dep;
switch (eos) {
case ISIMPLE:
case ISIMPLEC:
case IPISO:
case ICOUPLED:
case IFROZENP:
break;
case IDBIG:
for (icell=0;icell<ntot;icell++) {
phi = setvar(icell);
dep = setdep(icell);
dep[Rdep] = phi[Pvar] / (R * phi[Tvar]);
}
break;
default:
FatalError("Wrong Equation of state");
break;
}
}
// density and enthalpy defs ----
double drdp( double phi[nvar])
{
switch (eos) {
case IDBIG:
return ( 1.0 / (R * phi[Tvar]));
break;
default:
FatalError("No drdp mode defined");
break;
}
}
double drdt( double phi[nvar])
{
switch (eos) {
case IDBIG:
return (- 1.0 * ( phi[Pvar] / (R * phi[Tvar] * phi[Tvar])));
break;
default:
FatalError("No drdt mode defined");
break;
}
}
double enthalpy( double phi[nvar])
{
double hh;
switch (eos) {
case IDBIG:
hh = Cp * phi[Tvar] + 0.5 * scalarp( ndir, &phi[Uvar], &phi[Uvar]);
break;
default:
FatalError("No enthalpy mode defined");
break;
}
return hh;
}
double dhdp( double phi[nvar])
{
switch (eos) {
case IDBIG:
return 0.0;
break;
default:
FatalError("No dhdp mode defined");
break;
}
}
double dhdt( double phi[nvar])
{
switch (eos) {
case IDBIG:
return ( Cp);
break;
default:
FatalError("No dhdt mode defined");
break;
}
}
void calccfl(void )
{
int icell, idir;
double *phi, *dep, *CelldblPnt, Vabs;
if (cfl > 0.0) { // TimeStep calculation for STEADY flows
timst = 1.0E10;
for (icell=0;icell<ncell;icell++) {
phi = setvar(icell);
dep = setdep(icell);
CelldblPnt = setdblcell(icell);
Vabs = sqrt(scalarp( ndir, &phi[Uvar], &phi[Uvar]));
if (Vabs < 0.01)
Vabs = 0.01;
timst = fmin( timst, cfl / Vabs * pow(CelldblPnt[CellVol], 1.0/ndir));
}
}
for (icell=0;icell<ncell;icell++) {
phi = setvar(icell);
dep = setdep(icell);
CelldblPnt = setdblcell(icell);
Vabs = sqrt(scalarp( ndir, &phi[Uvar], &phi[Uvar]));
dep[CFLdep] = Vabs * timst / pow(CelldblPnt[CellVol],1.0/ndir);
dep[TIMEdep]= timst;
}
}
// Turbulent viscosity ----------
void calcmt(void )
{
int icell, i, j;
double *phi, *dep, omhat, om2, Sij[ndir][ndir], div, WW[ndir][ndir];
double xi;
switch (turb) {
case SA:
for (icell=0;icell<ntot;icell++) {
phi = setvar(icell);
dep = setdep(icell);
dep[MTdep] = dep[Rdep] * phi[MTvar] * fv1( phi, dep);
}
break;
case KW06:
for (icell=0;icell<ntot;icell++) {
phi = setvar(icell);
dep = setdep(icell);
strain( dep, Sij);
div = divergence( dep);
for (i=0;i<ndir;i++)
Sij[i][i] -= div / 3.0;
om2 = 2.0 * matsum( Sij);
omhat = fmax( phi[OMvar], Clim * sqrt(om2 / Cmu));
dep[MTdep] = dep[Rdep] * phi[Kvar] / omhat;
}
break;
case KWSST:
for (icell=0;icell<ntot;icell++) {
phi = setvar(icell);
dep = setdep(icell);
rotation( dep, WW);
dep[MTdep] = dep[Rdep] * a1 * phi[Kvar];
dep[MTdep]/= fmax(a1 * phi[OMvar], \
sqrt(2.0*matsum(WW)) * F2( phi, dep));
}
break;
}
}
// Velocity divergence ----------
double divergence( double dep[ndep])
{
int idir;
double div = 0.0;
for (idir=0;idir<ndir;idir++)
div += dep[UGrd+(ndir*idir)+idir];
return div;
}
#if _DBG == 10
void calcdbgdep(void )
{
int icell, idir;
double *dep, *phi, tij[ndir][ndir];
for (icell=0;icell<ncell;icell++) {
dep = setdep(icell);
phi = setvar(icell);
// Divergence ----------------
dep[Divdep] = divergence( dep);
// Vorticity -----------------
double Omij[ndir][ndir];
rotation( dep, Omij);
dep[Vrtdep]= 2.0 * matsum( Omij);
// Pk ------------------------
if (Kvar!=-1) {
stress( phi, dep, tij);
dep[Pkdep] = prodk( dep, tij);
}
}
}
#endif
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:40 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/netdev/1000.h */
|
#ifndef TRACKERSETTINGS_H
#define TRACKERSETTINGS_H
#include <iostream>
#include <list>
#include "settingsIO.h"
#include "localTrackerSettings.h"
class TrackerSettings {
public:
TrackerSettings(void);
void set(LocalTrackerSettings& settings);
// Pupil tracker
int MAX_NOF_CLUSTERS;
int MAX_CLUSTER_SIZE;
int MIN_CLUSTER_SIZE;
int MAX_PUPIL_RADIUS;
int MIN_PUPIL_RADIUS;
int NOF_RAYS;
int MIN_NOF_RADIUSES;
int MIN_PUPIL_AREA;
unsigned int NOF_VERIFICATION_FRAMES;
unsigned int MAX_NOF_BAD_FRAMES;
int ROI_W_DEFAULT;
int ROI_H_DEFAULT;
double ROI_MULTIPLIER;
int MIN_ROI_W;
int MAX_FAILED_TRACKS_BEFORE_RESET;
int CR_THRESHOLD;
int PUPIL_THRESHOLD;
int AUTO_THRESHOLD; // 0 or 1
double CR_MAX_ERR_MULTIPLIER;
int CROP_AREA_X;
int CROP_AREA_Y;
int CROP_AREA_W;
int CROP_AREA_H;
// Starburst
int STARBURST_MAX_ITERATIONS;
int STARBURST_REQUIRED_ACCURACY;
int STARBURST_CIRCULAR_STEPS;
int STARBURST_MIN_SEED_POINTS;
int STARBURST_BLOCK_COUNT;
double STARBURST_OUTLIER_DISTANCE;
double STARBURST_RELATIVE_MAX_POINT_VARIANCE;
// CRTemplate
int MAX_CR_WIDTH;
int CR_MASK_LEN;
// GazeTracker
double rd;
int NOF_PERIMETER_POINTS;
double MYY;
// Cornea Computer
double RHO;
// gaze mapper
double GAZE_DISTANCE;
};
extern TrackerSettings trackerSettings;
#endif
|
#include <sea/dm/dev.h>
#include <modules/pci.h>
#include <modules/ata.h>
#include <sea/dm/block.h>
#include <sea/loader/symbol.h>
#include <modules/psm.h>
#include <sea/mm/dma.h>
#include <sea/string.h>
int init_ata_device(void)
{
struct pci_device *ata = pci_locate_class(0x1, 0x1);
if(!ata)
return 1;
ata->flags |= PCI_ENGAGED;
ata->flags |= PCI_DRIVEN;
unsigned short bmr;
if(!(bmr = pci_get_base_address(ata)))
{
ata->flags = PCI_ERROR;
return -1;
}
/* allow this device bus-mastering mode */
unsigned short cmd = ata->pcs->command | 4;
ata->pcs->command = cmd;
pci_write_dword(ata->bus, ata->dev, ata->func, 4, cmd);
ata_pci = ata;
primary->port_bmr_base=bmr;
if(ata->pcs->bar0 == 0 || ata->pcs->bar0 == 1)
primary->port_cmd_base = ATA_PRIMARY_CMD_BASE;
else
primary->port_cmd_base = ata->pcs->bar0;
if(ata->pcs->bar1 == 0 || ata->pcs->bar1 == 1)
primary->port_ctl_base = ATA_PRIMARY_CTL_BASE;
else
primary->port_ctl_base = ata->pcs->bar1;
primary->irq = ATA_PRIMARY_IRQ;
primary->id=0;
secondary->port_bmr_base=bmr+0x8;
if(ata->pcs->bar2 == 0 || ata->pcs->bar2 == 1)
secondary->port_cmd_base = ATA_SECONDARY_CMD_BASE;
else
secondary->port_cmd_base = ata->pcs->bar2;
if(ata->pcs->bar3 == 0 || ata->pcs->bar3 == 1)
secondary->port_ctl_base = ATA_SECONDARY_CTL_BASE;
else
secondary->port_ctl_base = ata->pcs->bar3;
secondary->irq = ATA_SECONDARY_IRQ;
secondary->id=1;
return 0;
}
void allocate_dma(struct ata_controller *cont)
{
addr_t buf;
addr_t p;
if(!cont->prdt_virt) {
cont->prdt_dma.p.size = 0x1000;
cont->prdt_dma.p.alignment = 0x1000;
mm_allocate_dma_buffer(&cont->prdt_dma);
cont->prdt_virt = (void *)cont->prdt_dma.v;
cont->prdt_phys = cont->prdt_dma.p.address;
}
for(int i=0;i<512;i++) {
cont->dma_buffers[i].p.size = 64 * 1024;
cont->dma_buffers[i].p.alignment = 0x1000;
cont->dma_buffers[i].p.address = 0;
}
int ret = mm_allocate_dma_buffer(&cont->dma_buffers[0]);
if(ret == -1)
{
kprintf("[ata]: could not allocate DMA buffer\n");
cont->dma_use=0;
return;
}
cont->dma_use=ATA_DMA_ENABLE;
}
int init_ata_controller(struct ata_controller *cont)
{
cont->enabled=1;
int i;
/* we don't need interrupts during the identification */
for (i = 0; i < 2; i++) {
ata_reg_outb(cont, REG_DEVICE, DEVICE_DEV(i));
ATA_DELAY(cont);
ata_reg_outb(cont, REG_CONTROL, CONTROL_NIEN);
}
struct ata_device dev;
if(cont->port_bmr_base)
allocate_dma(cont);
unsigned char in=0;
unsigned char m, h;
for (i = 0; i <= 1; i++)
{
dev.id=i;
dev.controller = cont;
dev.flags=0;
outb(cont->port_cmd_base+REG_DEVICE, i ? 0xB0 : 0xA0);
ATA_DELAY(cont);
if(!inb(cont->port_cmd_base+REG_STATUS)) {
printk(2, "[ata]: %d:%d: no status\n", cont->id, i);
continue;
}
/* reset the LBA ports, and send the identify command */
outb(cont->port_cmd_base+REG_LBA_LOW, 0);
ATA_DELAY(cont);
outb(cont->port_cmd_base+REG_LBA_MID, 0);
ATA_DELAY(cont);
outb(cont->port_cmd_base+REG_LBA_HIG, 0);
ATA_DELAY(cont);
outb(cont->port_cmd_base+REG_COMMAND, COMMAND_IDENTIFY);
ATA_DELAY(cont);
/* wait until we get READY, ABORT, or no device */
while(1)
{
in = inb(cont->port_cmd_base+REG_STATUS);
if((!(in & STATUS_BSY) && (in & STATUS_DRQ)) || in & STATUS_ERR || !in)
break;
ATA_DELAY(cont);
}
/* no device here. go to the next device */
if(!in) {
printk(4, "[ata]: %d:%d: no device\n", cont->id, i);
continue;
}
/* we got an ABORT response. This means that the device is likely
* an ATAPI or a SATA drive. */
if(in & STATUS_ERR)
{
ATA_DELAY(cont);
m=inb(cont->port_cmd_base+REG_LBA_MID);
ATA_DELAY(cont);
h=inb(cont->port_cmd_base+REG_LBA_HIG);
if((m == 0x14 && h == 0xEB))
{
dev.flags |= F_ATAPI;
/* ATAPI devices get the ATAPI IDENTIFY command */
outb(cont->port_cmd_base+REG_COMMAND, COMMAND_IDENTIFY_ATAPI);
ATA_DELAY(cont);
} else if(m==0x3c && h==0xc3) {
dev.flags |= F_SATA;
} else if(m == 0x69 && h == 0x96) {
dev.flags |= F_SATAPI;
} else {
printk(2, "[ata]: %d:%d: unknown (%d:%d)\n", cont->id, i, m, h);
continue;
}
}
dev.flags |= F_EXIST;
/* we need to check if DMA really works... */
int dma_ok = 1;
if((dev.flags & F_ATAPI))
dma_ok=0;
else
dev.flags |= F_DMA;
unsigned short tmp[256];
int idx;
for (idx = 0; idx < 256; idx++)
tmp[idx] = inw(cont->port_cmd_base+REG_DATA);
unsigned lba48_is_supported = tmp[83] & 0x400;
unsigned lba28 = *(unsigned *)(tmp+60);
unsigned long long lba48 = *(unsigned long long *)(tmp+100);
if(lba48)
dev.length = lba48;
else if(lba28) {
dev.length = lba28;
dev.flags |= F_LBA28;
}
/* if we do dma, we need to re-enable interrupts... */
if(dma_ok) {
ata_reg_outb(cont, REG_CONTROL, 0);
dev.flags |= F_DMA;
}
printk(2, "[ata]: %d:%d: %s, flags=0x%x, length = %d sectors (%d MB)\n",
cont->id, dev.id,
dev.flags & F_ATAPI ? "atapi" : (dev.flags & F_SATA ? "sata" :
(dev.flags & F_SATAPI ? "satapi" : "pata")),
dev.flags, (unsigned)dev.length,
((unsigned)dev.length/2)/1024);
if(lba48 && !lba48_is_supported)
printk(2, "[ata]: %d:%d: conflict in lba48 support reporting\n", cont->id, dev.id);
else
dev.flags |= F_LBA48;
if(dev.flags & F_LBA28 || dev.flags & F_LBA48)
dev.flags |= F_ENABLED;
else
printk(2, "[ata]: %d:%d: device reports no LBA accessing modes. Disabling this device.\n", cont->id, dev.id);
memcpy(&cont->devices[i], &dev, sizeof(struct ata_device));
#if CONFIG_MODULE_PSM
struct disk_info di;
int size = 512;
if(dev.flags & F_ATAPI) {
size = 2048;
di.flags = PSM_DISK_INFO_NOPART;
} else
di.flags = 0;
di.length=dev.length*size;
di.num_sectors=dev.length;
di.sector_size=size;
cont->devices[i].created = 1;
cont->devices[i].psm_minor = psm_register_disk_device(PSM_ATA_ID, GETDEV((dev.flags & F_ATAPI) ? api : 3, cont->id * 2 + dev.id), &di);
#endif
}
return 0;
}
|
/*
ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "hal.h"
/**
* @brief PAL setup.
* @details Digital I/O ports static configuration as defined in @p board.h.
* This variable is used by the HAL when initializing the PAL driver.
*/
#if HAL_USE_PAL || defined(__DOXYGEN__)
const PALConfig pal_default_config =
{
{VAL_GPIOAODR, VAL_GPIOACRL, VAL_GPIOACRH},
{VAL_GPIOBODR, VAL_GPIOBCRL, VAL_GPIOBCRH},
{VAL_GPIOCODR, VAL_GPIOCCRL, VAL_GPIOCCRH},
{VAL_GPIODODR, VAL_GPIODCRL, VAL_GPIODCRH},
{VAL_GPIOEODR, VAL_GPIOECRL, VAL_GPIOECRH},
{VAL_GPIOFODR, VAL_GPIOFCRL, VAL_GPIOFCRH},
{VAL_GPIOGODR, VAL_GPIOGCRL, VAL_GPIOGCRH},
};
#endif
/*
* Early initialization code.
* This initialization must be performed just after stack setup and before
* any other initialization.
*/
void __early_init(void) {
stm32_clock_init();
}
#if HAL_USE_SDC
/* Board-related functions related to the SDC driver.*/
bool_t sdc_lld_is_card_inserted(SDCDriver *sdcp) {
(void) sdcp;
return palReadPad(GPIOC, GPIOC_SDIO_CD);
}
bool_t sdc_lld_is_write_protected(SDCDriver *sdcp) {
(void) sdcp;
return !palReadPad(GPIOC, GPIOC_SDIO_WP);
}
#endif
/*
* Board-specific initialization code.
*/
void boardInit(void) {
}
|
/*
* Timer1.c
*
* Created on: 04 Apr 2015
* Author: RobThePyro
*/
#include "Timer1.h"
void Timer1_init(void) {
// Timer 1 A,B
TCCR1A |= (1 << WGM10); /* Fast PWM mode, 8-bit */
TCCR1B |= (1 << WGM12); /* Fast PWM mode, pt.2 */
TCCR1B |= (1 << CS11); /* PWM Freq = F_CPU/8/256 */
TCCR1A |= (1 << COM1A1); /* PWM output on OCR1A */
//TCCR1A |= (1 << COM1B1); /* PWM output on OCR1B */
// Pin Setup
LCD_PWM_DDR |= (1 << LCD_PWM);
}
|
/* src/setpgrp.c -- MiNTLib.
Copyright (C) 1999 Guido Flohr <guido@freemint.de>
This file is part of the MiNTLib project, and may only be used
modified and distributed under the terms of the MiNTLib project
license, COPYMINT. By continuing to use, modify, or distribute
this file you indicate that you have read the license and
understand and accept it fully.
*/
#include <errno.h>
#include <unistd.h>
#include <sys/types.h>
#include <mint/mintbind.h>
#include "lib.h"
int
__setpgrp (void)
{
static short have_pgrp = 1;
if (have_pgrp) {
int r = 0;
r = Psetpgrp (0, 0);
if (r == -ENOSYS) {
have_pgrp = 0;
}
else if (r < 0) {
if (r == -ENOENT)
r = -ESRCH;
else if (r == -EACCES)
r = -EPERM;
__set_errno (-r);
return -1;
}
}
return 0;
}
weak_alias (__setpgrp, setpgrp)
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/slab.h>
#include <asm/prom.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/map.h>
#define UFLASH_OBPNAME "flashprom"
#define DRIVER_NAME "sun_uflash"
#define PFX DRIVER_NAME ": "
#define UFLASH_WINDOW_SIZE 0x200000
#define UFLASH_BUSWIDTH 1 /* EBus is 8-bit */
MODULE_AUTHOR("Eric Brower <ebrower@usa.net>");
MODULE_DESCRIPTION("User-programmable flash device on Sun Microsystems boardsets");
MODULE_SUPPORTED_DEVICE(DRIVER_NAME);
MODULE_LICENSE("GPL");
MODULE_VERSION("2.1");
struct uflash_dev {
const char *name; /* device name */
struct map_info map; /* mtd map info */
struct mtd_info *mtd; /* mtd info */
};
struct map_info uflash_map_templ = {
.name = "SUNW,???-????",
.size = UFLASH_WINDOW_SIZE,
.bankwidth = UFLASH_BUSWIDTH,
};
int uflash_devinit(struct of_device *op, struct device_node *dp)
{
struct uflash_dev *up;
if (op->resource[1].flags) {
/* Non-CFI userflash device-- once I find one we
* can work on supporting it.
*/
printk(KERN_ERR PFX "Unsupported device at %s, 0x%llx\n",
dp->full_name, (unsigned long long)op->resource[0].start);
return -ENODEV;
}
up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL);
if (!up) {
printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n");
return -ENOMEM;
}
/* copy defaults and tweak parameters */
memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ));
up->map.size = resource_size(&op->resource[0]);
up->name = of_get_property(dp, "model", NULL);
if (up->name && 0 < strlen(up->name))
up->map.name = (char *)up->name;
up->map.phys = op->resource[0].start;
up->map.virt = of_ioremap(&op->resource[0], 0, up->map.size,
DRIVER_NAME);
if (!up->map.virt) {
printk(KERN_ERR PFX "Failed to map device.\n");
kfree(up);
return -EINVAL;
}
simple_map_init(&up->map);
/* MTD registration */
up->mtd = do_map_probe("cfi_probe", &up->map);
if (!up->mtd) {
of_iounmap(&op->resource[0], up->map.virt, up->map.size);
kfree(up);
return -ENXIO;
}
up->mtd->owner = THIS_MODULE;
add_mtd_device(up->mtd);
dev_set_drvdata(&op->dev, up);
return 0;
}
static int __devinit uflash_probe(struct of_device *op, const struct of_device_id *match)
{
struct device_node *dp = op->dev.of_node;
/* Flashprom must have the "user" property in order to
* be used by this driver.
*/
if (!of_find_property(dp, "user", NULL))
return -ENODEV;
return uflash_devinit(op, dp);
}
static int __devexit uflash_remove(struct of_device *op)
{
struct uflash_dev *up = dev_get_drvdata(&op->dev);
if (up->mtd) {
del_mtd_device(up->mtd);
map_destroy(up->mtd);
}
if (up->map.virt) {
of_iounmap(&op->resource[0], up->map.virt, up->map.size);
up->map.virt = NULL;
}
kfree(up);
return 0;
}
static const struct of_device_id uflash_match[] = {
{
.name = UFLASH_OBPNAME,
},
{},
};
MODULE_DEVICE_TABLE(of, uflash_match);
static struct of_platform_driver uflash_driver = {
.driver = {
.name = DRIVER_NAME,
.owner = THIS_MODULE,
.of_match_table = uflash_match,
},
.probe = uflash_probe,
.remove = __devexit_p(uflash_remove),
};
static int __init uflash_init(void)
{
return of_register_driver(&uflash_driver, &of_bus_type);
}
static void __exit uflash_exit(void)
{
of_unregister_driver(&uflash_driver);
}
module_init(uflash_init);
module_exit(uflash_exit);
|
#pragma once
#include "conn.h"
class ConnClient : public Conn {
public:
ConnClient(Network* network);
~ConnClient();
virtual int run(uint64_t tick);
virtual void on_recv_udp(const char* buf, ssize_t size, const struct sockaddr* addr);
virtual int recv_kcp(char*& buf, uint32_t& size);
int prepare_req_conn(const sockaddr* addr, uv_udp_t* handle);
void req_conn_run();
private:
void on_recv_udp_snd_conv(const char* buf, ssize_t size);
void send_ping();
private:
uint64_t _next_ping_tick;
int32_t _req_conn_times;
uint64_t _next_req_conn_tick;
hs_req_conn_s _req_conn;
}; |
#ifndef _BTF_ENCODER_H_
#define _BTF_ENCODER_H_ 1
/*
SPDX-License-Identifier: GPL-2.0-only
Copyright (C) 2019 Facebook
Derived from ctf_encoder.h, which is:
Copyright (C) Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include <stdbool.h>
struct btf_encoder;
struct btf;
struct cu;
struct list_head;
struct btf_encoder *btf_encoder__new(struct cu *cu, const char *detached_filename, struct btf *base_btf, bool skip_encoding_vars, bool force, bool gen_floats, bool verbose);
void btf_encoder__delete(struct btf_encoder *encoder);
int btf_encoder__encode(struct btf_encoder *encoder);
int btf_encoder__encode_cu(struct btf_encoder *encoder, struct cu *cu);
void btf_encoders__add(struct list_head *encoders, struct btf_encoder *encoder);
struct btf_encoder *btf_encoders__first(struct list_head *encoders);
struct btf_encoder *btf_encoders__next(struct btf_encoder *encoder);
#endif /* _BTF_ENCODER_H_ */
|
// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
// vim: set shiftwidth=4 softtabstop=4 expandtab:
/*
********************************************************************
** NIDAS: NCAR In-situ Data Acquistion Software
**
** 2006, Copyright University Corporation for Atmospheric Research
**
** 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.
**
** The LICENSE.txt file accompanying this software contains
** a copy of the GNU General Public License. If it is not found,
** write to the Free Software Foundation, Inc.,
** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
**
********************************************************************
*/
#ifndef NIDAS_UTIL_INTERRUPTEDEXCEPTION_H
#define NIDAS_UTIL_INTERRUPTEDEXCEPTION_H
#include <string>
#include "Exception.h"
namespace nidas { namespace util {
class InterruptedException : public Exception {
public:
InterruptedException(const std::string& what, const std::string& task):
Exception("InterruptedException: ",what + ": " + task) {}
};
}} // namespace nidas namespace util
#endif
|
#pragma once
class fifo_buf
{
public:
fifo_buf(size_t size);
fifo_buf(const fifo_buf &) = delete;
~fifo_buf();
void clear() { fill = pos = 0; }
// these return number of bytes actually put/got
size_t put (const char *data, size_t size);
size_t peek(char *data, size_t size);
size_t get (char *data, size_t size);
size_t get_space() const { return size - fill; }
size_t get_fill() const { return fill; }
size_t get_size() const { return size; }
private:
size_t size, fill, pos;
char *buf;
};
|
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <numa.h>
#include <sys/syscall.h>
#include <sys/resource.h>
#include <sys/sysinfo.h>
pid_t gettid(void) {
return syscall(__NR_gettid);
}
void set_affinity(unsigned long tid, unsigned long core_id) {
cpu_set_t mask;
CPU_ZERO(&mask);
CPU_SET(core_id, &mask);
int r = sched_setaffinity(tid, sizeof(mask), &mask);
if (r < 0) {
fprintf(stderr, "couldn't set affinity for %lu\n", core_id);
exit(1);
}
printf("Setting affinity of thread %lu on core %lu\n", tid, core_id);
}
unsigned long get_first_core_of_node (unsigned long node) {
struct bitmask* bm;
bm = numa_allocate_cpumask();
numa_node_to_cpus(node, bm);
for(int i = 0; i < get_nprocs(); i++) {
if (numa_bitmask_isbitset(bm, i)) {
return i;
}
}
printf("Oops\n");
exit(EXIT_FAILURE);
}
void shuffle_threads_on_nodes (unsigned long * thread_to_core, unsigned int nthreads) {
int ndies = numa_num_configured_nodes();
int ncores = get_nprocs();
struct bitmask ** bm = (struct bitmask**) malloc(sizeof(struct bitmask*) * ndies);
for (int i = 0; i < ndies; i++) {
bm[i] = numa_allocate_cpumask();
numa_node_to_cpus(i, bm[i]);
}
int next_node = 0;
for(int i = 0; i < nthreads; i++) {
int idx = (i / ndies) + 1;
int found = 0;
int j = 0;
do {
if (numa_bitmask_isbitset(bm[next_node], j)) {
found++;
}
if(found == idx){
//printf("Thread %d to core %d\n", i, j);
thread_to_core[i] = j;
break;
}
j = (j + 1) % ncores;
} while (found != idx);
next_node = (next_node + 1) % ndies;
}
}
|
/*
* Author: Andreas Linde <mail@andreaslinde.de>
* Kent Sutherland
*
* Copyright (c) 2012-2013 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2011 Andreas Linde & Kent Sutherland.
* All rights reserved.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
#if HOCKEYSDK_FEATURE_FEEDBACK
#import "BITFeedbackMessage.h"
@interface BITFeedbackManager () <UIAlertViewDelegate> {
}
@property (nonatomic, strong) NSMutableArray *feedbackList;
@property (nonatomic, strong) NSString *token;
// used by BITHockeyManager if disable status is changed
@property (nonatomic, getter = isFeedbackManagerDisabled) BOOL disableFeedbackManager;
@property (nonatomic, strong) BITFeedbackListViewController *currentFeedbackListViewController;
@property (nonatomic, strong) BITFeedbackComposeViewController *currentFeedbackComposeViewController;
@property (nonatomic) BOOL didAskUserData;
@property (nonatomic, strong) NSDate *lastCheck;
@property (nonatomic, strong) NSNumber *lastMessageID;
@property (nonatomic, copy) NSString *userID;
@property (nonatomic, copy) NSString *userName;
@property (nonatomic, copy) NSString *userEmail;
// load new messages from the server
- (void)updateMessagesList;
// load new messages from the server if the last request is too long ago
- (void)updateMessagesListIfRequired;
- (NSUInteger)numberOfMessages;
- (BITFeedbackMessage *)messageAtIndex:(NSUInteger)index;
- (void)submitMessageWithText:(NSString *)text;
- (void)submitPendingMessages;
// Returns YES if manual user data can be entered, required or optional
- (BOOL)askManualUserDataAvailable;
// Returns YES if required user data is missing?
- (BOOL)requireManualUserDataMissing;
// Returns YES if user data is available and can be edited
- (BOOL)isManualUserDataAvailable;
// used in the user data screen
- (void)updateDidAskUserData;
- (BITFeedbackMessage *)messageWithID:(NSNumber *)messageID;
- (NSArray *)messagesWithStatus:(BITFeedbackMessageStatus)status;
- (void)saveMessages;
- (void)fetchMessageUpdates;
- (void)updateMessageListFromResponse:(NSDictionary *)jsonDictionary;
- (BOOL)deleteMessageAtIndex:(NSUInteger)index;
- (void)deleteAllMessages;
@end
#endif /* HOCKEYSDK_FEATURE_FEEDBACK */
|
#ifndef __CMPH_COMPRESSED_RANK_H__
#define __CMPH_COMPRESSED_RANK_H__
#include "select.h"
struct _compressed_rank_t
{
cmph_uint32 max_val;
cmph_uint32 n; // number of values stored in vals_rems
// The length in bits of each value is decomposed into two compnents: the lg(n) MSBs are stored in rank_select data structure
// the remaining LSBs are stored in a table of n cells, each one of rem_r bits.
cmph_uint32 rem_r;
select_t sel;
cmph_uint32 * vals_rems;
};
typedef struct _compressed_rank_t compressed_rank_t;
void compressed_rank_init(compressed_rank_t * cr);
void compressed_rank_destroy(compressed_rank_t * cr);
void compressed_rank_generate(compressed_rank_t * cr, cmph_uint32 * vals_table, cmph_uint32 n);
cmph_uint32 compressed_rank_query(compressed_rank_t * cr, cmph_uint32 idx);
cmph_uint32 compressed_rank_get_space_usage(compressed_rank_t * cr);
void compressed_rank_dump(compressed_rank_t * cr, char **buf, cmph_uint32 *buflen);
void compressed_rank_load(compressed_rank_t * cr, const char *buf, cmph_uint32 buflen);
/** \fn void compressed_rank_pack(compressed_rank_t *cr, void *cr_packed);
* \brief Support the ability to pack a compressed_rank structure into a preallocated contiguous memory space pointed by cr_packed.
* \param cr points to the compressed_rank structure
* \param cr_packed pointer to the contiguous memory area used to store the compressed_rank structure. The size of cr_packed must be at least @see compressed_rank_packed_size
*/
void compressed_rank_pack(compressed_rank_t *cr, void *cr_packed);
/** \fn cmph_uint32 compressed_rank_packed_size(compressed_rank_t *cr);
* \brief Return the amount of space needed to pack a compressed_rank structure.
* \return the size of the packed compressed_rank structure or zero for failures
*/
cmph_uint32 compressed_rank_packed_size(compressed_rank_t *cr);
/** \fn cmph_uint32 compressed_rank_query_packed(void * cr_packed, cmph_uint32 idx);
* \param cr_packed is a pointer to a contiguous memory area
* \param idx is an index to compute the rank
* \return an integer that represents the compressed_rank value.
*/
cmph_uint32 compressed_rank_query_packed(void * cr_packed, cmph_uint32 idx);
#endif
|
/********************************************
³ÌÐòÃû³Æ£ºtemp_rh_test
¹¦ÄÜ£ºDHT11ÎÂʪ¶È´«¸ÐÆ÷·¶Àý´úÂë
°æ±¾£ºv1.0
×÷ÕߣºÀÁÍÃ×Ó <haixiaoli2@163.com>
*********************************************/
//°üº¬Í·Îļþ
#include <core.h>
#include "dht11.h"
//ºê¶¨Òå¼°È«¾Ö±äÁ¿
dht11 DHT11;
int pinDHT11 = 2; //DHT11Êý¾Ý¶ËÁ¬½ÓGPIO2
int checkSum; //DHT11Êý¾ÝУÑéºÍ
//¹¦Äܺ¯Êý²¿·Ö
//³õʼ»¯ÉèÖò¿·Ö
void setup()
{
}
//Ñ»·Ö´Ðв¿·Ö
void loop()
{
//¶ÁÈ¡DHT11Êý¾Ý¼°Ð£ÑéºÍ
printf("\nReading data from DHT11...\n");
checkSum = DHT11.read(pinDHT11);
//ÅжÏУÑéºÍ
switch (checkSum)
{
case DHTLIB_OK:
printf("Correct checksum.\n");
break;
case DHTLIB_ERROR_CHECKSUM:
printf("Incorrect checksum£¡\n");
break;
case DHTLIB_ERROR_TIMEOUT:
printf("Timeout error£¡\n");
break;
default:
printf("Unknown error!\n");
break;
}
//УÑéºÍÕýÈ·£¬ÏÔʾÊý¾Ý
if(checkSum == DHTLIB_OK)
{
printf("Humidity: %.1f, Temperature: %.1f\n", (float)DHT11.humidity, (float)DHT11.temperature);
}
delay(3000);
} |
/*****************************************************************************
flankBed.h
(c) 2009 - Aaron Quinlan
Hall Laboratory
Department of Biochemistry and Molecular Genetics
University of Virginia
aaronquinlan@gmail.com
Licenced under the GNU General Public License 2.0 license.
******************************************************************************/
#include "bedFile.h"
#include "genomeFile.h"
#include <vector>
#include <iostream>
#include <fstream>
#include <map>
#include <cstdlib>
#include <ctime>
using namespace std;
//************************************************
// Class methods and elements
//************************************************
class BedFlank {
public:
// constructor
BedFlank(string &bedFile, string &genomeFile, bool forceStrand, float leftSlop, float rightSlop, bool fractional);
// destructor
~BedFlank(void);
private:
string _bedFile;
string _genomeFile;
bool _forceStrand;
float _leftFlank;
float _rightFlank;
bool _fractional;
BedFile *_bed;
GenomeFile *_genome;
// methods
void FlankBed();
// method to grab requested flank w.r.t. a single BED entry
void AddFlank(BED &bed, int leftSlop, int rightSlop);
// method to grab requested flank w.r.t. a single BED entry,
// while choosing flanks based on strand
void AddStrandedFlank(BED &bed, int leftSlop, int rightSlop);
};
|
#ifndef _LIBNFTNL_OBJECT_H_
#define _LIBNFTNL_OBJECT_H_
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
#include <libnftnl/common.h>
#ifdef __cplusplus
extern "C" {
#endif
enum {
NFTNL_OBJ_TABLE = 0,
NFTNL_OBJ_NAME,
NFTNL_OBJ_TYPE,
NFTNL_OBJ_FAMILY,
NFTNL_OBJ_USE,
NFTNL_OBJ_BASE = 16,
__NFTNL_OBJ_MAX
};
#define NFTNL_OBJ_MAX (__NFTNL_OBJ_MAX - 1)
enum {
NFTNL_OBJ_CTR_PKTS = NFTNL_OBJ_BASE,
NFTNL_OBJ_CTR_BYTES,
};
enum {
NFTNL_OBJ_QUOTA_BYTES = NFTNL_OBJ_BASE,
NFTNL_OBJ_QUOTA_CONSUMED,
NFTNL_OBJ_QUOTA_FLAGS,
};
enum {
NFTNL_OBJ_CT_HELPER_NAME = NFTNL_OBJ_BASE,
NFTNL_OBJ_CT_HELPER_L3PROTO,
NFTNL_OBJ_CT_HELPER_L4PROTO,
};
struct nftnl_obj;
struct nftnl_obj *nftnl_obj_alloc(void);
void nftnl_obj_free(const struct nftnl_obj *ne);
bool nftnl_obj_is_set(const struct nftnl_obj *ne, uint16_t attr);
void nftnl_obj_unset(struct nftnl_obj *ne, uint16_t attr);
void nftnl_obj_set_data(struct nftnl_obj *ne, uint16_t attr, const void *data,
uint32_t data_len);
void nftnl_obj_set(struct nftnl_obj *ne, uint16_t attr, const void *data);
void nftnl_obj_set_u8(struct nftnl_obj *ne, uint16_t attr, uint8_t val);
void nftnl_obj_set_u16(struct nftnl_obj *ne, uint16_t attr, uint16_t val);
void nftnl_obj_set_u32(struct nftnl_obj *ne, uint16_t attr, uint32_t val);
void nftnl_obj_set_u64(struct nftnl_obj *obj, uint16_t attr, uint64_t val);
void nftnl_obj_set_str(struct nftnl_obj *ne, uint16_t attr, const char *str);
const void *nftnl_obj_get_data(struct nftnl_obj *ne, uint16_t attr,
uint32_t *data_len);
const void *nftnl_obj_get(struct nftnl_obj *ne, uint16_t attr);
uint8_t nftnl_obj_get_u8(struct nftnl_obj *ne, uint16_t attr);
uint16_t nftnl_obj_get_u16(struct nftnl_obj *obj, uint16_t attr);
uint32_t nftnl_obj_get_u32(struct nftnl_obj *ne, uint16_t attr);
uint64_t nftnl_obj_get_u64(struct nftnl_obj *obj, uint16_t attr);
const char *nftnl_obj_get_str(struct nftnl_obj *ne, uint16_t attr);
void nftnl_obj_nlmsg_build_payload(struct nlmsghdr *nlh,
const struct nftnl_obj *ne);
int nftnl_obj_nlmsg_parse(const struct nlmsghdr *nlh, struct nftnl_obj *ne);
int nftnl_obj_parse(struct nftnl_obj *ne, enum nftnl_parse_type type,
const char *data, struct nftnl_parse_err *err);
int nftnl_obj_parse_file(struct nftnl_obj *ne, enum nftnl_parse_type type,
FILE *fp, struct nftnl_parse_err *err);
int nftnl_obj_snprintf(char *buf, size_t size, const struct nftnl_obj *ne,
uint32_t type, uint32_t flags);
int nftnl_obj_fprintf(FILE *fp, const struct nftnl_obj *ne, uint32_t type,
uint32_t flags);
struct nftnl_obj_list;
struct nftnl_obj_list *nftnl_obj_list_alloc(void);
void nftnl_obj_list_free(struct nftnl_obj_list *list);
int nftnl_obj_list_is_empty(struct nftnl_obj_list *list);
void nftnl_obj_list_add(struct nftnl_obj *r, struct nftnl_obj_list *list);
void nftnl_obj_list_add_tail(struct nftnl_obj *r, struct nftnl_obj_list *list);
void nftnl_obj_list_del(struct nftnl_obj *t);
int nftnl_obj_list_foreach(struct nftnl_obj_list *table_list,
int (*cb)(struct nftnl_obj *t, void *data),
void *data);
struct nftnl_obj_list_iter;
struct nftnl_obj_list_iter *nftnl_obj_list_iter_create(struct nftnl_obj_list *l);
struct nftnl_obj *nftnl_obj_list_iter_next(struct nftnl_obj_list_iter *iter);
void nftnl_obj_list_iter_destroy(struct nftnl_obj_list_iter *iter);
#ifdef __cplusplusg
} /* extern "C" */
#endif
#endif /* _OBJ_H_ */
|
/*********************************************************************
* Portions COPYRIGHT 2015 STMicroelectronics *
* Portions SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
**********************************************************************
* *
* (c) 1996 - 2015 SEGGER Microcontroller GmbH & Co. KG *
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
** emWin V5.28 - Graphical user interface for embedded applications **
All Intellectual Property rights in the Software belongs to SEGGER.
emWin is protected by international copyright laws. Knowledge of the
source code may not be used to write a similar product. This file may
only be used in accordance with the following terms:
The software has been licensed to STMicroelectronics International
N.V. a Dutch company with a Swiss branch and its headquarters in Plan-
les-Ouates, Geneva, 39 Chemin du Champ des Filles, Switzerland for the
purposes of creating libraries for ARM Cortex-M-based 32-bit microcon_
troller products commercialized by Licensee only, sublicensed and dis_
tributed under the terms and conditions of the End User License Agree_
ment supplied by STMicroelectronics International N.V.
Full source code is available at: www.segger.com
We appreciate your understanding and fairness.
----------------------------------------------------------------------
File : GUIConf.c
Purpose : Display controller initialization
---------------------------END-OF-HEADER------------------------------
*/
/**
******************************************************************************
* @file GUIConf.c
* @author MCD Application Team
* @version V1.3.1
* @date 09-October-2015
* @brief Display controller initialization
******************************************************************************
* @attention
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
#include "GUI.h"
/*********************************************************************
*
* Defines, configurable
*
**********************************************************************
*/
//
// Define the available number of bytes available for the GUI
//
#define GUI_NUMBYTES (1024) * 115 // x KByte
/*********************************************************************
*
* Static data
*
**********************************************************************
*/
/* 32 bit aligned memory area */
static U32 extMem[GUI_NUMBYTES / 4];
/*********************************************************************
*
* Public code
*
**********************************************************************
*/
/*********************************************************************
*
* GUI_X_Config
*
* Purpose:
* Called during the initialization process in order to set up the
* available memory for the GUI.
*/
void GUI_X_Config(void)
{
GUI_ALLOC_AssignMemory(extMem, GUI_NUMBYTES);
}
/*************************** End of file ****************************/
|
/*
THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#ifndef _GAMEREND_H
#define _GAMEREND_H
void ShrinkWindow ();
void GrowWindow ();
void Draw2DFrameElements (void);
void FlushFrame (fix xStereoSeparation);
#endif /* _GAMEREND_H */
|
//²éÕÒ°æÃæ×î¿¿ºóµÄmarkÎÄÕ ylsdd 2002/4/3
#include "bbs.h"
#include "ythtlib.h"
#include "ythtbbs.h"
#include "www.h"
#define MAXFOUNDD 9
#define MAXAUTHOR 5
struct markeditem {
char title[100];
int n;
char author[MAXAUTHOR][16];
int thread;
int marked;
};
struct markedlist {
int n;
int nmarked;
struct markeditem mi[MAXFOUNDD];
};
int
denyUser(char *author)
{
char buf[256], *ptr;
FILE *fp;
int retv = 0;
if (!strcmp(author, "Anonymous"))
return 1;
fp = fopen("deny_users", "rt");
if (!fp)
return 0;
while (fgets(buf, sizeof (buf), fp)) {
ptr = strtok(buf, " \t\n\r");
if (!ptr)
continue;
if (!strcasecmp(ptr, author)) {
retv = 1;
break;
}
}
fclose(fp);
return retv;
}
int
addmiauthor(struct markeditem *mi, char *author)
{
int i;
for (i = 0; i < mi->n; i++) {
if (!strncmp(mi->author[i], author, sizeof (mi->author[i]))) {
return mi->n;
}
}
if (i >= MAXAUTHOR)
return -1;
strsncpy(mi->author[i], author, sizeof (mi->author[i]));
mi->n++;
return mi->n;
}
int
addmarkedlist(struct markedlist *ml, char *title, char *author, int thread,
int marked)
{
int i;
if (!marked && ml->n >= MAXFOUNDD)
return ml->nmarked;
if (marked && ml->n > ml->nmarked) {
for (i = ml->n - 1; i >= 0; i--) {
if (!ml->mi[i].marked)
break;
}
for (; i < ml->n - 1; i++)
ml->mi[i] = ml->mi[i + 1];
bzero(&ml->mi[i], sizeof (ml->mi[0]));
ml->n--;
}
for (i = 0; i < ml->n; i++) {
if (thread == ml->mi[i].thread) {
if (marked && !ml->mi[i].marked) {
ml->mi[i].n = 0;
ml->mi[i].marked = marked;
ml->nmarked++;
} else if (!marked && ml->mi[i].marked)
return ml->nmarked;
addmiauthor(&ml->mi[i], author);
return ml->nmarked;
}
}
if (i >= MAXFOUNDD)
return ml->nmarked;
strsncpy(ml->mi[i].title, title, sizeof (ml->mi[0].title));
addmiauthor(&ml->mi[i], author);
ml->mi[i].thread = thread;
ml->mi[i].marked = marked;
ml->n++;
if (marked)
ml->nmarked++;
return ml->nmarked;
}
int
searchLastMark(char *filename, struct markedlist *ml, int addscore)
{
struct fileheader fhdr;
int fd, total, n, old = 0;
time_t now;
bzero(ml, sizeof (*ml));
if ((total = file_size(filename) / sizeof (fhdr)) <= 0)
return 0;
time(&now);
if ((fd = open(filename, O_RDONLY, 0)) == -1) {
return 0;
}
for (n = total - 1; n >= 0 && total - n < 3000; n--) {
if (lseek(fd, n * sizeof (fhdr), SEEK_SET) < 0)
break;
if (read(fd, &fhdr, sizeof (fhdr)) != sizeof (fhdr))
break;
if (now - fhdr.filetime > 3600 * 24 * 6) {
old++;
if (old > 4)
break;
continue;
}
if (!strcmp(fhdr.owner, "deliver")
&& !(fhdr.accessed & FH_DIGEST)
&& !(fhdr.accessed & FH_MARKED))
continue;
if (fhdr.owner[0] == '-' //|| !strcmp(fhdr.owner, "deliver")
|| strstr(fhdr.title, "[¾¯¸æ]")
|| (fhdr.accessed & FH_DANGEROUS))
continue;
if (bytenum(fhdr.sizebyte) <= 150)
continue;
if (denyUser(fh2owner(&fhdr)))
continue;
if ((fhdr.accessed & FH_DIGEST) || (fhdr.accessed & FH_MARKED)
|| (fhdr.hasvoted > 1 + addscore
&& fhdr.staravg50 * (int) fhdr.hasvoted / 50 >
4 + addscore * 2)) {
if (addmarkedlist
(ml, fhdr.title, fh2owner(&fhdr), fhdr.thread,
1) >= MAXFOUNDD)
break;
} else if (bytenum(fhdr.sizebyte) > 200
|| fhdr.thread == fhdr.filetime) {
addmarkedlist(ml, fhdr.title, fh2owner(&fhdr),
fhdr.thread, 0);
}
}
close(fd);
return ml->n;
}
int
main()
{
int b_fd, fdaux, i, bnum = -1;
struct boardheader bh;
int size, foundd, addscore;
char buf[200], recfile[200];
struct markedlist ml;
struct boardaux boardaux;
struct bbsinfo bbsinfo;
FILE *fp;
initbbsinfo(&bbsinfo);
mkdir("wwwtmp/lastmark", 0770);
size = sizeof (bh);
chdir(MY_BBS_HOME);
if ((b_fd = open(BOARDS, O_RDONLY)) == -1)
return -1;
if ((fdaux = open(BOARDAUX, O_RDWR | O_CREAT, 0660)) < 0)
return -1;
for (bnum = 0; read(b_fd, &bh, size) == size && bnum < MAXBOARD; bnum++) {
if (!bh.filename[0])
continue;
sprintf(buf, MY_BBS_HOME "/boards/%s/.DIR", bh.filename);
sprintf(recfile, MY_BBS_HOME "/wwwtmp/lastmark/%s",
bh.filename);
if (file_time(buf) < file_time(recfile)
&& time(NULL) - file_time(recfile) < 3600 * 12)
continue;
fp = fopen(recfile, "w");
lseek(fdaux, bnum * sizeof (boardaux), SEEK_SET);
read(fdaux, &boardaux, sizeof (boardaux));
boardaux.nlastmark = 0;
addscore = 1;
if (bbsinfo.bcacheshm->bcache[bnum].score > 10000)
addscore++;
if (bbsinfo.bcacheshm->bcache[bnum].score > 50000)
addscore++;
searchLastMark(buf, &ml, addscore);
if (ml.n > 0) {
int nunmarked = 0;
for (foundd = 0;
foundd < ml.n && boardaux.nlastmark < MAXLASTMARK;
foundd++) {
char buf[60];
struct lastmark *lm =
&boardaux.lastmark[boardaux.nlastmark];
buf[0] = 0;
i = ml.mi[foundd].n;
while (i > 0) {
i--;
if (strlen(buf) +
strlen(ml.mi[foundd].author[i]) +
2 >= sizeof (buf))
break;
strcat(buf, ml.mi[foundd].author[i]);
if (i)
strcat(buf, " ");
}
strsncpy(lm->authors, buf,
sizeof (lm->authors));
strsncpy(lm->title, ml.mi[foundd].title,
sizeof (lm->title));
lm->thread = ml.mi[foundd].thread;
lm->marked = ml.mi[foundd].marked;
if (lm->marked || nunmarked < 6) {
boardaux.nlastmark++;
if (!lm->marked)
nunmarked++;
}
if (ml.mi[foundd].marked) {
fputs(buf, fp);
fprintf(fp, "\t%d",
ml.mi[foundd].thread);
fprintf(fp, "\t%s\n",
ml.mi[foundd].title);
}
}
}
fclose(fp);
lseek(fdaux, bnum * sizeof (boardaux), SEEK_SET);
write(fdaux, &boardaux, sizeof (boardaux));
}
close(b_fd);
return 0;
}
|
/*
* ProFTPD - FTP server daemon
* Copyright (c) 1997, 1998 Public Flood Software
* Copyright (c) 1999, 2000 MacGyver aka Habeeb J. Dihu <macgyver@tos.net>
* Copyright (c) 2001-2015 The ProFTPD Project team
*
* 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, Suite 500, Boston, MA 02110-1335, USA.
*
* As a special exemption, Public Flood Software/MacGyver aka Habeeb J. Dihu
* and other respective copyright holders give permission to link this program
* with OpenSSL, and distribute the resulting executable, without including
* the source code for OpenSSL in the source distribution.
*/
/* Logging, either to syslog or stderr, as well as debug logging
* and debug levels.
*/
#ifndef PR_LOG_H
#define PR_LOG_H
#ifndef LOG_AUTHPRIV
#define LOG_AUTHPRIV LOG_AUTH
#endif
#if !defined(WTMP_FILE) && defined(_PATH_WTMP)
#define WTMP_FILE _PATH_WTMP
#endif
/* These are the debug levels, higher numbers print more debugging
* info. DEBUG0 (the default) prints nothing.
*/
#define DEBUG10 10
#define DEBUG9 9
#define DEBUG8 8
#define DEBUG7 7
#define DEBUG6 6
#define DEBUG5 5
#define DEBUG4 4
#define DEBUG3 3
#define DEBUG2 2
#define DEBUG1 1
#define DEBUG0 0
/* pr_log_openfile() return values */
#define PR_LOG_WRITABLE_DIR -2
#define PR_LOG_SYMLINK -3
/* Log file modes */
#define PR_LOG_SYSTEM_MODE 0640
#ifdef PR_USE_LASTLOG
/* It is tempting to want to have these lastlog-related includes separated
* out into their own lastlog.h file. However, on some systems, such a
* proftpd-specific lastlog.h file may collide with the system's lastlog.h
* file. Ultimately it's an issue with the default search order of the
* system C preprocessor, not with us -- and not every installation has
* this problem.
*
* In the meantime, the most portable thing is to keep these lastlog-related
* includes in this file. Yay portability.
*/
#ifdef HAVE_LASTLOG_H
# include <lastlog.h>
#endif
#ifdef HAVE_LOGIN_H
# include <login.h>
#endif
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
#ifndef PR_LASTLOG_PATH
# ifdef _PATH_LASTLOG
# define PR_LASTLOG_PATH _PATH_LASTLOG
# else
# ifdef LASTLOG_FILE
# define PR_LASTLOG_PATH LASTLOG_FILE
# else
# error "Missing path to lastlog file (use --with-lastlog=PATH)"
# endif
# endif
#endif
int log_lastlog(uid_t uid, const char *user_name, const char *tty,
pr_netaddr_t *remote_addr);
#endif /* PR_USE_LASTLOG */
/* Note: Like lastlog.h, it would be tempting to split out the declaration of
* this function, and its necessary system headers, into a proftpd-specific
* wtmp.h file. But that would collide with the system wtmp.h file on
* some systems.
*/
int log_wtmp(const char *, const char *, const char *, pr_netaddr_t *);
/* file-based logging functions */
int pr_log_openfile(const char *, int *, mode_t);
int pr_log_writefile(int, const char *, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 3, 4)));
#else
;
#endif
/* Same as pr_log_writefile(), only this function takes a va_list.
* Useful for modules which provide their own varargs wrapper log functions,
* but still want to use the core facilities for writing to the log fd.
*/
int pr_log_vwritefile(int, const char *, const char *, va_list ap);
/* syslog-based logging functions. Note that the open/close functions are
* not part of the public API; use the pr_log_pri() function to log via
* syslog.
*/
void log_closesyslog(void);
int log_opensyslog(const char *);
int log_getfacility(void);
void log_setfacility(int);
void pr_log_pri(int, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)));
#else
;
#endif
void pr_log_auth(int, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)));
#else
;
#endif
void pr_log_debug(int, const char *, ...)
#ifdef __GNUC__
__attribute__ ((format (printf, 2, 3)));
#else
;
#endif
int pr_log_setdebuglevel(int);
int pr_log_setdefaultlevel(int);
void log_stderr(int);
void log_discard(void);
void init_log(void);
int pr_log_str2sysloglevel(const char *);
/* Define a struct, and some constants, for logging events and any listeners
* for those events.
*/
typedef struct log_event {
/* Type of log event/message; the values are defined below */
unsigned int log_type;
/* Log fd associated with this log for this event */
int log_fd;
/* Log level of this message; the semantics of the log level depend on
* on the log type.
*/
int log_level;
/* The message being logged. */
const char *log_msg;
size_t log_msglen;
} pr_log_event_t;
#define PR_LOG_TYPE_UNSPEC 0
#define PR_LOG_NAME_UNSPEC "core.log.unspec"
#define PR_LOG_TYPE_XFERLOG 1
#define PR_LOG_NAME_XFERLOG "core.log.xferlog"
#define PR_LOG_TYPE_SYSLOG 2
#define PR_LOG_NAME_SYSLOG "core.log.syslog"
#define PR_LOG_TYPE_SYSTEMLOG 3
#define PR_LOG_NAME_SYSTEMLOG "core.log.systemlog"
#define PR_LOG_TYPE_EXTLOG 4
#define PR_LOG_NAME_EXTLOG "core.log.extendedlog"
#define PR_LOG_TYPE_TRACELOG 5
#define PR_LOG_NAME_TRACELOG "core.log.tracelog"
/* Helper function to generate the necessary log event, passing along the
* log event context data.
*/
int pr_log_event_generate(unsigned int log_type, int log_fd, int log_level,
const char *log_msg, size_t log_msglen);
/* Returns TRUE if there are listeners for the specified log type, FALSE
* otherwise.
*/
int pr_log_event_listening(unsigned int log_type);
#endif /* PR_LOG_H */
|
#define PARAM_FILE_COUNTER 0x38
// DRYOS-Notes:
// propertycase
// 196 - overall brightness (of viewport?)
#include "platform.h"
const ApertureSize aperture_sizes_table[] = {
{ 9, 273, "2.6" },
{ 10, 285, "2.8" },
{ 11, 304, "3.2" },
{ 12, 337, "3.5" },
{ 13, 372, "4.0" },
{ 14, 409, "4.5" },
{ 15, 448, "5.0" },
{ 16, 480, "5.5" }
};
const ShutterSpeed shutter_speeds_table[] = {
{ -12, -384, "15", 15000000 },
{ -11, -352, "13", 13000000 },
{ -10, -320, "10", 10000000 },
{ -9, -288, "8", 8000000 },
{ -8, -256, "6", 6000000 },
{ -7, -224, "5", 5000000 },
{ -6, -192, "4", 4000000 },
{ -5, -160, "3.2", 3200000 },
{ -4, -128, "2.5", 2500000 },
{ -3, -96, "2", 2000000 },
{ -2, -64, "1.6", 1600000 },
{ -1, -32, "1.3", 1300000 },
{ 0, 0, "1", 1000000 },
{ 1, 32, "0.8", 800000 },
{ 2, 64, "0.6", 600000 },
{ 3, 96, "0.5", 500000 },
{ 4, 128, "0.4", 400000 },
{ 5, 160, "0.3", 300000 },
{ 6, 192, "1/4", 250000 },
{ 7, 224, "1/5", 200000 },
{ 8, 256, "1/6", 166667 },
{ 9, 288, "1/8", 125000 },
{ 10, 320, "1/10", 100000 },
{ 11, 352, "1/13", 76923 },
{ 12, 384, "1/15", 66667 },
{ 13, 416, "1/20", 50000 },
{ 14, 448, "1/25", 40000 },
{ 15, 480, "1/30", 33333 },
{ 16, 512, "1/40", 25000 },
{ 17, 544, "1/50", 20000 },
{ 18, 576, "1/60", 16667 },
{ 19, 608, "1/80", 12500 },
{ 20, 640, "1/100", 10000 },
{ 21, 672, "1/125", 8000 },
{ 22, 704, "1/160", 6250 },
{ 23, 736, "1/200", 5000 },
{ 24, 768, "1/250", 4000 },
{ 25, 800, "1/320", 3125 },
{ 26, 832, "1/400", 2500 },
{ 27, 864, "1/500", 2000 },
{ 28, 896, "1/640", 1563 },
{ 29, 928, "1/800", 1250 },
{ 30, 960, "1/1000", 1000 },
{ 31, 992, "1/1250", 800 },
{ 32, 1021, "1/1600", 625 },
{ 33, 1053, "1/2000", 500 },
};
const ISOTable iso_table[] = {
{ -1, 1, "HI", -1},
{ 0, 0, "Auto", -1},
{ 1, 80, "80", -1},
{ 2, 100, "100", -1},
{ 3, 200, "200", -1},
{ 4, 400, "400", -1},
{ 5, 800, "800", -1},
{ 6, 1600, "1600", -1},
};
/*
http://www.usa.canon.com/cusa/support/consumer/digital_cameras/powershot_a_series/powershot_a580#Specifications
Shooting Modes
Auto, Easy, Camera M, Portrait, Landscape,
Special Scene
(Foliage, Snow, Beach, Sunset, Fireworks, Night Scene, Aquarium),
Indoor, Kids & Pets, Night Snapshot, Movie
Movie: 640 x 480 (20 fps/20 fps LP), 320 x 240 (30 fps) available up to 4GB or 60 minutes, 160 x 120 (up to 3 minutes at 15 fps)
canon mode list in FFE7CFFC 100c
*/
// 32774 - ?????? ????? ? ?????? ???????
static const CapturemodeMap modemap[] = {
{ MODE_AUTO, 32768 },//OK
{ MODE_P, 32772 },//OK
{ MODE_VIDEO_STD, 2599 },//OK
{ MODE_VIDEO_COMPACT, 2601 },//OK
{ MODE_SCN_AQUARIUM, 16408 },//OK
{ MODE_SCN_NIGHT_SCENE, 16398 },//OK
{ MODE_SCN_FOLIAGE, 16403 },//OK
{ MODE_SCN_SNOW, 16404 },//OK
{ MODE_SCN_BEACH, 16405 },//OK
{ MODE_SCN_FIREWORK, 16406 },//OK
{ MODE_INDOOR, 32785 },//OK
{ MODE_KIDS_PETS, 32784 },//OK
{ MODE_NIGHT_SNAPSHOT, 32779 },//OK
{ MODE_LANDSCAPE, 32780 },//OK
{ MODE_PORTRAIT, 32781 },//OK
};
#include "../generic/shooting.c"
long get_file_next_counter() {
return get_file_counter();
}
long get_target_file_num() {
long n;
n = get_file_next_counter();
n = (n>>4)&0x3FFF;
return n;
}
long get_target_dir_num() {
long n;
n = get_file_next_counter();
n = (n>>18)&0x3FF;
return n;
}
int circle_of_confusion = 5;
|
/* Included once by translate.cxx c_unparser::emit_common_header ()
Defines all common fields and probe flags for struct context.
Available to C-based probe handlers as fields of the CONTEXT ptr. */
#ifdef __DYNINST__
/* The index of this context structure with the array of allocated
context structures. */
int data_index;
/* The index of the active probe within stap_probes[]. */
size_t probe_index;
/* The lock for this context structure. */
pthread_mutex_t lock;
#endif
/* Used to indicate whether a probe context is in use.
Tested in the code entering the probe setup by common_probe_entry_prologue
and cleared by the common_probe_entry_epilogue code. When an early error
forces a goto probe_epilogue then needs an explicitly atomic_dec() first.
All context busy flags are tested on module unload to prevent unloading
while some probe is still running. */
atomic_t busy;
/* The fully-resolved probe point associated with a currently running probe
handler, including alias and wild-card expansion effects.
aka stap_probe->pp. Setup by common_probe_entryfn_prologue.
Used in warning/error messages and accessible by pp() tapset function. */
const char *probe_point;
/* The script-level probe point associated with a currently running probe
handler, including wild-card expansion effects as per 'stap -l'.
Guarded by STP_NEED_PROBE_NAME as setup in pn() tapset function. */
#ifdef STP_NEED_PROBE_NAME
const char *probe_name;
#endif
/* The kind of probe this is. One of the stp_probe_type constants.
Used to determined what other fields are setup and how. Often the
probe context fields depend on how the probe handler is triggered
and what information it gets passed. */
enum stp_probe_type probe_type;
/* Common status flags of probe. */
unsigned user_mode_p:1;
unsigned full_uregs_p:1;
/* Number of "actions" this probe handler is still allowed to do.
Setup in common_probe_entryfn_prologue to either MAXACTION or
Checked by code generated by c_unparser::record_actions (), which will
set last_error in case this goes to zero and then jumps to out.
MAXACTION_INTERRUPTIBLE. Note special case in enter_all_profile_probes. */
#if !defined(STAP_SUPPRESS_TIME_LIMITS)
int actionremaining;
#endif
/* The current nesting of a function. Needed to determine which "level" of
locals to use. See the recursion_info traversing_visitor for how the
maximum is calculated. Locals of a function are stored at
c->locals[c->nesting], see c_unparser::emit_function (). */
int nesting;
/* A place to format error messages into if some error occurs, last_error
will then be pointed here. */
string_t error_buffer;
/* Only used when stap script uses tokenize.stp tapset. */
#ifdef STAP_NEED_CONTEXT_TOKENIZE
string_t tok_str;
char *tok_start;
char *tok_end;
#endif
/* NB: last_error is used as a health flag within a probe.
While it's 0, execution continues
When it's "something", probe code unwinds, _stp_error's, sets error state */
const char *last_error;
/* Last statement (token) executed. Often set together with last_error. */
const char *last_stmt;
/* Set when probe handler gets pt_regs handed to it. kregs holds the kernel
registers when availble. uregs holds the user registers when available.
uregs are at least available when user_mode_p == 1. */
struct pt_regs *kregs;
struct pt_regs *uregs;
/* unwaddr is caching unwound address in each probe handler on ia64. */
#if defined __ia64__
unsigned long *unwaddr;
#endif
/* Individual Probe State (ips).
A union since only one can be active at a time. */
union {
/* kretprobe state. */
struct {
struct kretprobe_instance *pi;
/* int64_t count in pi->data, the rest is string_t.
See the kretprobe.stp tapset. */
int pi_longs;
} krp;
/* State for mark_derived_probes. */
struct {
va_list *mark_va_list;
const char *marker_name;
const char *marker_format;
} kmark;
/* State for tracepoint probes. */
const char *tracepoint_name;
/* uretprobe state */
struct uretprobe_instance *ri;
/* State for procfs probes, see tapset-procfs.cxx. */
void *procfs_data;
} ips;
/* Only used when stap script uses the i386 or x86_64 register.stp tapset. */
#ifdef STAP_NEED_REGPARM
int regparm;
#endif
/* Only used for overload processing. */
#ifdef STP_OVERLOAD
cycles_t cycles_base;
cycles_t cycles_sum;
#endif
/* Current state of the unwinder (as used in the unwind.c dwarf unwinder). */
#if defined(STP_NEED_UNWIND_DATA)
struct unwind_cache uwcache_user;
struct unwind_cache uwcache_kernel;
struct unwind_context uwcontext_user;
struct unwind_context uwcontext_kernel;
#endif
|
// This file is part of Hermes2D.
//
// Hermes2D 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.
//
// Hermes2D 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 Hermes2D. If not, see <http://www.gnu.org/licenses/>.
#ifndef __H2D_REFINEMENT_SELECTORS_H1_PROJ_BASED_SELECTOR_H
#define __H2D_REFINEMENT_SELECTORS_H1_PROJ_BASED_SELECTOR_H
#include "proj_based_selector.h"
namespace RefinementSelectors {
/// A projection-based selector for H1 space. \ingroup g_selectors
/** This class is designed to be used with the class H1Adapt.
* Since an initialization of the class may take a long time,
* it is suggested to create the instance outside the adaptivity
* loop. */
class HERMES_API H1ProjBasedSelector : public ProjBasedSelector {
public: //API
/// Constructor.
/** \param[in] cand_list A predefined list of candidates.
* \param[in] conv_exp A conversion exponent, see evaluate_cands_score().
* \param[in] max_order A maximum order which considered. If ::H2DRS_DEFAULT_ORDER, a maximum order supported by the selector is used, see HcurlProjBasedSelector::H2DRS_MAX_H1_ORDER.
* \param[in] user_shapeset A shapeset. If NULL, it will use internal instance of the class H1Shapeset. */
H1ProjBasedSelector(CandList cand_list = H2D_HP_ANISO, double conv_exp = 1.0, int max_order = H2DRS_DEFAULT_ORDER, H1Shapeset* user_shapeset = NULL);
protected: //overloads
/// A function expansion of a function f used by this selector.
enum LocalFuncExpansion {
H2D_H1FE_VALUE = 0, ///< A function expansion: f.
H2D_H1FE_DX = 1, ///< A function expansion: df/dx.
H2D_H1FE_DY = 2, ///< A function expansion: df/dy.
H2D_H1FE_NUM = 3 ///< A total considered function expansion.
};
static const int H2DRS_MAX_H1_ORDER; ///< A maximum used order in this H1-space selector.
scalar* precalc_rvals[H2D_MAX_ELEMENT_SONS][H2D_H1FE_NUM]; ///< Array of arrays of precalculates. The first index is an index of a subdomain, the second index is an index of a function expansion (see enum LocalFuncExpansion).
/// Sets OptimumSelector::current_max_order and OptimumSelector::current_min_order.
/** The default order range is [1, 9]. If curved, the upper boundary of the range becomes lower.
* Overriden function. For details, see OptimumSelector::set_current_order_range().
* \todo Replace calculations inside with calculations that uses symbolic constants instead of fixed numbers. */
virtual void set_current_order_range(Element* element);
/// Returns an array of values of the reference solution at integration points.
/** Overriden function. For details, see ProjBasedSelector::precalc_ref_solution(). */
virtual scalar** precalc_ref_solution(int inx_son, Solution* rsln, Element* element, int intr_gip_order);
/// Calculates values of shape function at GIP for all transformations.
/** Overriden function. For details, see ProjBasedSelector::precalc_shapes(). */
virtual void precalc_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector<ShapeInx>& shapes, const int max_shape_inx, TrfShape& svals);
/// Calculates values of orthogonalized shape function at GIP for all transformations.
/** Overriden function. For details, see ProjBasedSelector::precalc_ortho_shapes(). */
virtual void precalc_ortho_shapes(const double3* gip_points, const int num_gip_points, const Trf* trfs, const int num_noni_trfs, const std::vector<ShapeInx>& shapes, const int max_shape_inx, TrfShape& svals);
/// Builds projection matrix using a given set of shapes.
/** Overriden function. For details, see ProjBasedSelector::build_projection_matrix(). */
virtual double** build_projection_matrix(double3* gip_points, int num_gip_points, const int* shape_inx, const int num_shapes);
/// Evaluates a value of the right-hande side in a subdomain.
/** Overriden function. For details, see ProjBasedSelector::evaluate_rhs_subdomain(). */
virtual scalar evaluate_rhs_subdomain(Element* sub_elem, const ElemGIP& sub_gip, const ElemSubTrf& sub_trf, const ElemSubShapeFunc& sub_shape);
/// Evaluates an squared error of a projection of an element of a candidate onto subdomains.
/** Overriden function. For details, see ProjBasedSelector::evaluate_error_squared_subdomain(). */
virtual double evaluate_error_squared_subdomain(Element* sub_elem, const ElemGIP& sub_gip, const ElemSubTrf& sub_trf, const ElemProj& elem_proj);
protected: //defaults
static H1Shapeset default_shapeset; ///< A default shapeset.
};
}
#endif
|
//
// lassheetdelegate.h
//
// Copyright 2015 by John Pietrzak (jpietrzak8@gmail.com)
//
// This file is part of Lasagne.
//
// Lasagne 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 2
// of the License, or (at your option) any later version.
//
// Lasagne 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 Lasagne; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
#ifndef LASSHEETDELEGATE_H
#define LASSHEETDELEGATE_H
#include <QItemDelegate>
class LasSheetDelegate: public QItemDelegate
{
Q_OBJECT
public:
explicit LasSheetDelegate(
QObject *parent = 0);
QWidget *createEditor(
QWidget *parent,
const QStyleOptionViewItem &viewItem,
const QModelIndex &index) const;
void setEditorData(
QWidget *editor,
const QModelIndex &index) const;
void setModelData(
QWidget *editor,
QAbstractItemModel *model,
const QModelIndex &index) const;
private slots:
void commitAndCloseEditor();
};
#endif // LASSHEETDELEGATE_H
|
/*
* This file is part of Robotic Swarm Simulator.
*
* Copyright (C) 2007, 2008, 2009 Antons Rebguns.
*
* 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.
*/
#include <gtk-2.0/gtk/gtk.h>
static gboolean delete_event( GtkWidget*, GdkEvent*, gpointer );
int main( int argc, char *argv[] )
{
gtk_init (&argc, &argv);
GtkWidget *window_main;
GtkWidget *window_scroll;
GtkWidget *vbox_main;
GtkWidget *expander_world;
GtkWidget *expander_goal;
GtkWidget *expander_agent;
GtkWidget *expander_obstacle;
GtkWidget *expander_physics;
GtkWidget *expander_newton;
GtkWidget *expander_lennard;
GtkWidget *expander_batch;
window_main = gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_window_set_title( GTK_WINDOW( window_main ), "Configuration Editor" );
gtk_container_set_border_width( GTK_CONTAINER( window_main ), 5 );
gtk_widget_set_size_request( window_main, 400, 200 );
window_scroll = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( window_scroll), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
gtk_container_set_border_width( GTK_CONTAINER( window_scroll ), 5 );
vbox_main = gtk_vbox_new( TRUE, 0 );
expander_world = gtk_expander_new( "World Parameters" );
expander_goal = gtk_expander_new( "Goal Parameters" );
expander_agent = gtk_expander_new( "Agent Parameters" );
expander_obstacle = gtk_expander_new( "Obstacle Parameters" );
expander_physics = gtk_expander_new( "General Physics Parameters" );
expander_newton = gtk_expander_new( "Newtonian Physics Parameters" );
expander_lennard = gtk_expander_new( "Lennard-Jones Physics Parameters" );
expander_batch = gtk_expander_new( "Batch Processing Parameters" );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_world );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_goal );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_agent );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_obstacle );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_physics );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_newton );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_lennard );
gtk_box_pack_start_defaults( GTK_BOX( vbox_main ), expander_batch );
/* Connect the main window to the destroy and delete-event signals. */
g_signal_connect( G_OBJECT( window_main ), "destroy",
G_CALLBACK( gtk_main_quit ), NULL );
g_signal_connect( G_OBJECT( window_main ), "delete_event",
G_CALLBACK( delete_event ), NULL );
/* Add the label as a child widget of the window. */
gtk_scrolled_window_add_with_viewport( GTK_SCROLLED_WINDOW( window_scroll ), vbox_main );
gtk_container_add( GTK_CONTAINER( window_main ), window_scroll );
gtk_widget_show_all( window_main );
gtk_main();
return 0;
}
/*
* Return FALSE to destroy the widget. By returning TRUE, you can cancel
* a delete-event. This can be used to confirm quitting the application.
*/
static gboolean delete_event( GtkWidget *window, GdkEvent *event, gpointer data )
{
return FALSE;
}
|
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
namespace driver {
enum class SoundType
{
Music,
Effect
};
/// Handle to a loaded sound.
/// Can be passed over ABI boundaries
struct RawSoundHandle
{
/// Opaque handle type to be used by the driver
using DriverData = void*;
private:
DriverData driverData;
SoundType type;
public:
DriverData getDriverData() const { return driverData; }
SoundType getType() const { return type; }
// Comparison only compares the driver data
bool operator==(const RawSoundHandle& rhs) const { return driverData == rhs.driverData; }
bool operator!=(const RawSoundHandle& rhs) const { return driverData == rhs.driverData; }
private:
// Only AudioDriver may create this to enforce registration and only it may reset the driverData
friend class AudioDriver;
RawSoundHandle(DriverData driverData, SoundType type) : driverData(driverData), type(type) {}
void invalidate() { driverData = nullptr; }
};
} // namespace driver
|
#ifndef GETPW_H
#define GETPW_H
#ifndef __ASSEMBLY__
void getpassw(uchar *hash);
#endif
#define MAXPASS 56
#endif
|
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.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 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 DEF_CULLING_OF_STRATHOLME_H
#define DEF_CULLING_OF_STRATHOLME_H
enum Data
{
DATA_CRATES_EVENT,
DATA_MEATHOOK_EVENT,
DATA_SALRAMM_EVENT,
DATA_EPOCH_EVENT,
DATA_MAL_GANIS_EVENT,
DATA_INFINITE_EVENT,
DATA_ARTHAS_EVENT,
DATA_COUNTDOWN,
DATA_ZOMBIEFEST,
DATA_CRATE_COUNT
};
enum Data64
{
DATA_ARTHAS,
DATA_MEATHOOK,
DATA_SALRAMM,
DATA_EPOCH,
DATA_MAL_GANIS,
DATA_INFINITE,
DATA_SHKAF_GATE,
DATA_MAL_GANIS_GATE_1,
DATA_MAL_GANIS_GATE_2,
DATA_EXIT_GATE,
DATA_MAL_GANIS_CHEST
};
enum Creatures
{
NPC_MEATHOOK = 26529,
NPC_SALRAMM = 26530,
NPC_EPOCH = 26532,
NPC_MAL_GANIS = 26533,
NPC_INFINITE = 32273,
NPC_ARTHAS = 26499,
NPC_JAINA = 26497,
NPC_UTHER = 26528,
NPC_CHROMIE_2 = 27915,
NPC_GENERIC_BUNNY = 28960,
NPC_CHROMIE = 30997
};
enum GameObjects
{
GO_SHKAF_GATE = 188686,
GO_MALGANIS_GATE_1 = 187711,
GO_MALGANIS_GATE_2 = 187723,
GO_EXIT_GATE = 191788,
GO_MALGANIS_CHEST_N = 190663,
GO_MALGANIS_CHEST_H = 193597,
GO_SUSPICIOUS_CRATE = 190094,
GO_PLAGUED_CRATE = 190095
};
enum KillCredit
{
CREDIT_A_ROYAL_ESCORT = 31006,
CREDIT_DISPELLING_ILLUSIONS = 30996
};
enum WorldStatesCoS
{
WORLDSTATE_NUMBER_CRATES_SHOW = 3479,
WORLDSTATE_NUMBER_CRATES_COUNT = 3480,
WORLDSTATE_NUMBER_SCOURGE_WAVES_SHOW_COUNT = 3504,
WORLDSTATE_NUMBER_INFINITE_TIMER = 3931,
WORLDSTATE_NUMBER_INFINITE_SHOW = 3932,
WORLDSTATE_CRATES_REVEALED = 3480,
};
enum AchievementControl
{
ACHI_IS_NOT_STARTED = 1,
ACHI_START,
ACHI_IS_IN_PROGRESS,
ACHI_COMPLETED,
ACHI_FAILED,
ACHI_RESET,
ACHI_INCREASE,
};
enum CrateSpells
{
SPELL_CRATES_CREDIT = 58109,
};
#endif
|
/**
* @file
* POP network mailbox
*
* @authors
* Copyright (C) 2000-2003 Vsevolod Volkov <vvv@mutt.org.ua>
*
* @copyright
* 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef _MUTT_POP_H
#define _MUTT_POP_H
#include <stdbool.h>
#include <time.h>
#include "mx.h"
struct Account;
struct Context;
struct Progress;
#define POP_PORT 110
#define POP_SSL_PORT 995
/* number of entries in the hash table */
#define POP_CACHE_LEN 10
/* maximal length of the server response (RFC1939) */
#define POP_CMD_RESPONSE 512
/**
* enum PopStatus - POP server responses
*/
enum PopStatus
{
POP_NONE = 0,
POP_CONNECTED,
POP_DISCONNECTED,
POP_BYE
};
/**
* enum PopAuthRes - POP authentication responses
*/
enum PopAuthRes
{
POP_A_SUCCESS = 0,
POP_A_SOCKET,
POP_A_FAILURE,
POP_A_UNAVAIL
};
/**
* struct PopCache - POP-specific email cache
*/
struct PopCache
{
unsigned int index;
char *path;
};
/**
* struct PopData - POP-specific server data
*/
struct PopData
{
struct Connection *conn;
unsigned int status : 2;
bool capabilities : 1;
unsigned int use_stls : 2;
bool cmd_capa : 1; /**< optional command CAPA */
bool cmd_stls : 1; /**< optional command STLS */
unsigned int cmd_user : 2; /**< optional command USER */
unsigned int cmd_uidl : 2; /**< optional command UIDL */
unsigned int cmd_top : 2; /**< optional command TOP */
bool resp_codes : 1; /**< server supports extended response codes */
bool expire : 1; /**< expire is greater than 0 */
bool clear_cache : 1;
size_t size;
time_t check_time;
time_t login_delay; /**< minimal login delay capability */
char *auth_list; /**< list of auth mechanisms */
char *timestamp;
struct BodyCache *bcache; /**< body cache */
char err_msg[POP_CMD_RESPONSE];
struct PopCache cache[POP_CACHE_LEN];
};
/**
* struct PopAuth - POP authentication multiplexor
*/
struct PopAuth
{
/* do authentication, using named method or any available if method is NULL */
enum PopAuthRes (*authenticate)(struct PopData *, const char *);
/* name of authentication method supported, NULL means variable. If this
* is not null, authenticate may ignore the second parameter. */
const char *method;
};
/* pop_auth.c */
int pop_authenticate(struct PopData *pop_data);
void pop_apop_timestamp(struct PopData *pop_data, char *buf);
/* pop_lib.c */
#define pop_query(A, B, C) pop_query_d(A, B, C, NULL)
int pop_parse_path(const char *path, struct Account *acct);
int pop_connect(struct PopData *pop_data);
int pop_open_connection(struct PopData *pop_data);
int pop_query_d(struct PopData *pop_data, char *buf, size_t buflen, char *msg);
int pop_fetch_data(struct PopData *pop_data, char *query, struct Progress *progressbar,
int (*funct)(char *, void *), void *data);
int pop_reconnect(struct Context *ctx);
void pop_logout(struct Context *ctx);
/* pop.c */
void pop_fetch_mail(void);
extern struct MxOps mx_pop_ops;
#endif /* _MUTT_POP_H */
|
/*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_SQLSTORAGES_H
#define MANGOS_SQLSTORAGES_H
#include "Common.h"
#include "Database/SQLStorage.h"
extern SQLStorage sCreatureStorage;
extern SQLStorage sCreatureDataAddonStorage;
extern SQLStorage sCreatureInfoAddonStorage;
extern SQLStorage sCreatureModelStorage;
extern SQLStorage sEquipmentStorage;
extern SQLStorage sGOStorage;
extern SQLStorage sPageTextStore;
extern SQLStorage sItemStorage;
extern SQLStorage sInstanceTemplate;
extern SQLStorage sWorldTemplate;
extern SQLStorage sConditionStorage;
extern SQLHashStorage sGameObjectDataAddonStorage;
extern SQLHashStorage sCreatureTemplateSpellsStorage;
extern SQLMultiStorage sVehicleAccessoryStorage;
#endif
|
#ifndef __COMMON_SOCKET_H__
#define __COMMON_SOCKET_H__
#include <string>
#include <netdb.h>
class Socket {
protected:
unsigned int fd;
struct sockaddr_in* ip2struct(const int port, const std::string& ip);
struct sockaddr_in* ip2struct(const std::string& port, const std::string& ip);
struct sockaddr_in* ip2struct(const std::string& ipport);
public:
Socket();
virtual ~Socket();
int shutdown();
int shutdown(int how);
};
class TCPSocket : public virtual Socket {
public:
TCPSocket();
~TCPSocket();
};
#endif
|
/*=========================================================================
Program: Visualization Toolkit
Module: $RCSfile: vtkAMRBox.h,v $
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 vtkAMRBox - represents a 3D uniform region in space
// .SECTION Description
// vtkAMRBox is similar to Chombo's Box. It represents a 3D
// region by storing indices for two corners (LoCorner, HiCorner).
// A few utility methods are provided.
#ifndef __vtkAMRBox_h
#define __vtkAMRBox_h
#include "vtkObject.h"
#include <assert.h>
template<int dimension>
struct vtkAMRBoxInitializeHelp;
// Helper to unroll the loop
template<int dimension>
void vtkAMRBoxInitialize(int *LoCorner, int *HiCorner, // member
const int *loCorner, const int *hiCorner, // local
vtkAMRBoxInitializeHelp<dimension>* = 0) // dummy parameter for vs6
{
for(int i=0; i<dimension; ++i)
{
LoCorner[i] = loCorner[i];
HiCorner[i] = hiCorner[i];
}
for(int i=dimension; i<(3-dimension); ++i)
{
LoCorner[i] = 0;
HiCorner[i] = 0;
}
}
class VTK_FILTERING_EXPORT vtkAMRBox
{
public:
// Public for quick access.
// Description:
// Cell position of the lower cell and higher cell defining the box.
// Both cells are defined at the same level of refinement. The refinement
// level itself is not specified.
// Invariant: LoCorner<=HiCorner
// Eg. LoCorner = {0,0,0}, HiCorner = {0,0,0} is an AMRBox with 1 cell
int LoCorner[3];
int HiCorner[3];
// Description:
// Default constructor: lower corner box made of one cell.
vtkAMRBox()
{
vtkAMRBoxInitialize<0>(this->LoCorner, this->HiCorner, 0, 0);
}
// Description:
// Constructor.
// \pre dimensionality >= 2 && dimensionality <= 3
vtkAMRBox(int dimensionality, const int* loCorner, const int* hiCorner)
{
switch(dimensionality)
{
case 2:
vtkAMRBoxInitialize<2>(this->LoCorner, this->HiCorner,
loCorner, hiCorner);
break;
case 3:
vtkAMRBoxInitialize<3>(this->LoCorner, this->HiCorner,
loCorner, hiCorner);
break;
default:
vtkGenericWarningMacro( "Wrong dimensionality" );
}
}
// Description:
// Returns the number of cells (aka elements, zones etc.) in
// the given region (for the specified refinement, see Coarsen()
// and Refine() ).
vtkIdType GetNumberOfCells()
{
vtkIdType numCells=1;
for(int i=0; i<3; i++)
{
numCells *= HiCorner[i] - LoCorner[i] + 1;
}
return numCells;
}
// Description:
// Modify LoCorner and HiCorner by coarsening with the given
// refinement ratio.
// \pre valid_refinement: refinement>=2
void Coarsen(int refinement)
{
assert("pre: valid_refinement" && refinement>=2);
for (int i=0; i<3; i++)
{
this->LoCorner[i] =
( this->LoCorner[i] < 0 ?
-abs(this->LoCorner[i]+1)/refinement - 1 :
this->LoCorner[i]/refinement );
this->HiCorner[i] =
( this->HiCorner[i] < 0 ?
-abs(this->HiCorner[i]+1)/refinement - 1 :
this->HiCorner[i]/refinement );
}
}
// Description:
// Modify LoCorner and HiCorner by refining with the given
// refinement ratio.
// \pre valid_refinement: refinement>=2
void Refine(int refinement)
{
assert("pre: valid_refinement" && refinement>=2);
for (int i=0; i<3; i++)
{
this->LoCorner[i] = this->LoCorner[i]*refinement;
this->HiCorner[i] = (this->HiCorner[i]+1)*refinement-1;
}
}
// Description:
// Returns non-zero if the box contains the cell with
// given indices.
int DoesContainCell(int i, int j, int k)
{
return
i >= this->LoCorner[0] && i <= this->HiCorner[0] &&
j >= this->LoCorner[1] && j <= this->HiCorner[1] &&
k >= this->LoCorner[2] && k <= this->HiCorner[2];
}
// Description:
// Returns non-zero if the box contains `box`
int DoesContainBox(vtkAMRBox const & box) const
{
// return DoesContainCell(box.LoCorner) && DoesContainCell(box.HiCorner);
return box.LoCorner[0] >= this->LoCorner[0]
&& box.LoCorner[1] >= this->LoCorner[1]
&& box.LoCorner[2] >= this->LoCorner[2]
&& box.HiCorner[0] <= this->HiCorner[0]
&& box.HiCorner[1] <= this->HiCorner[1]
&& box.HiCorner[2] <= this->HiCorner[2];
}
// Description:
// Print LoCorner and HiCorner
void Print(ostream &os)
{
os << "LoCorner: " << this->LoCorner[0] << "," << this->LoCorner[1]
<< "," << this->LoCorner[2] << "\n";
os << "HiCorner: " << this->HiCorner[0] << "," << this->HiCorner[1]
<< "," << this->HiCorner[2] << "\n";
}
// Description:
// Check if cell position is HiCorner
bool IsHiCorner(const int pos[3]) const
{
return this->HiCorner[0] == pos[0]
&& this->HiCorner[1] == pos[1]
&& this->HiCorner[2] == pos[2];
}
// Description:
// Check if cell position is LoCorner
bool IsLoCorner(const int pos[3]) const
{
return this->LoCorner[0] == pos[0]
&& this->LoCorner[1] == pos[1]
&& this->LoCorner[2] == pos[2];
}
};
#endif
|
//
// PBRepositoryFinder.h
// GitX
//
// Created by Rowan James on 13/11/2012.
//
//
#import <Foundation/Foundation.h>
@interface PBRepositoryFinder : NSObject
+ (NSURL *)fileURLForURL:(NSURL *)inputURL;
+ (NSURL*)workDirForURL:(NSURL*)fileURL;
+ (NSURL*)gitDirForURL:(NSURL*)fileURL;
@end
|
#include <linux/types.h>
#include <asm/txx9/pci.h>
#include <asm/txx9/jmr3927.h>
int __init jmr3927_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
{
unsigned char irq = pin;
/* IRQ rotation (PICMG) */
irq--; /* 0-3 */
if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(23)) {
/* PCI CardSlot (IDSEL=A23, DevNu=12) */
/* PCIA => PCIC (IDSEL=A23) */
/* NOTE: JMR3927 JP1 must be set to OPEN */
irq = (irq + 2) % 4;
} else if (slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(22)) {
/* PCI CardSlot (IDSEL=A22, DevNu=11) */
/* PCIA => PCIA (IDSEL=A22) */
/* NOTE: JMR3927 JP1 must be set to OPEN */
irq = (irq + 0) % 4;
} else {
/* PCI Backplane */
if (txx9_pci_option & TXX9_PCI_OPT_PICMG)
irq = (irq + 33 - slot) % 4;
else
irq = (irq + 3 + slot) % 4;
}
irq++; /* 1-4 */
switch (irq) {
case 1:
irq = JMR3927_IRQ_IOC_PCIA;
break;
case 2:
irq = JMR3927_IRQ_IOC_PCIB;
break;
case 3:
irq = JMR3927_IRQ_IOC_PCIC;
break;
case 4:
irq = JMR3927_IRQ_IOC_PCID;
break;
}
/* Check OnBoard Ethernet (IDSEL=A24, DevNu=13) */
if (dev->bus->parent == NULL &&
slot == TX3927_PCIC_IDSEL_AD_TO_SLOT(24))
irq = JMR3927_IRQ_ETHER0;
return irq;
}
|
#ifndef _M68K_DMA_MAPPING_H
#define _M68K_DMA_MAPPING_H
#include <asm/cache.h>
struct scatterlist;
#ifndef CONFIG_MMU_SUN3
static inline int dma_supported(struct device *dev, u64 mask)
{
return 1;
}
static inline int dma_set_mask(struct device *dev, u64 mask)
{
return 0;
}
static inline int dma_get_cache_alignment(void)
{
return 1 << L1_CACHE_SHIFT;
}
static inline int dma_is_consistent(struct device *dev, dma_addr_t dma_addr)
{
return 0;
}
extern void *dma_alloc_coherent(struct device *, size_t,
dma_addr_t *, gfp_t);
extern void dma_free_coherent(struct device *, size_t,
void *, dma_addr_t);
static inline void *dma_alloc_noncoherent(struct device *dev, size_t size,
dma_addr_t *handle, gfp_t flag)
{
return dma_alloc_coherent(dev, size, handle, flag);
}
static inline void dma_free_noncoherent(struct device *dev, size_t size,
void *addr, dma_addr_t handle)
{
dma_free_coherent(dev, size, addr, handle);
}
static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
enum dma_data_direction dir)
{
/* we use coherent allocation, so not much to do here. */
}
extern dma_addr_t dma_map_single(struct device *, void *, size_t,
enum dma_data_direction);
static inline void dma_unmap_single(struct device *dev, dma_addr_t addr,
size_t size, enum dma_data_direction dir)
{
}
extern dma_addr_t dma_map_page(struct device *, struct page *,
unsigned long, size_t size,
enum dma_data_direction);
static inline void dma_unmap_page(struct device *dev, dma_addr_t address,
size_t size, enum dma_data_direction dir)
{
}
extern int dma_map_sg(struct device *, struct scatterlist *, int,
enum dma_data_direction);
static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
int nhwentries, enum dma_data_direction dir)
{
}
extern void dma_sync_single_for_device(struct device *, dma_addr_t, size_t,
enum dma_data_direction);
extern void dma_sync_sg_for_device(struct device *, struct scatterlist *, int,
enum dma_data_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 for now */
dma_sync_single_for_device(dev, dma_handle, offset + size, direction);
}
static inline void dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
size_t size, enum dma_data_direction dir)
{
}
static inline void dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction dir)
{
}
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 for now */
dma_sync_single_for_cpu(dev, dma_handle, offset + size, direction);
}
static inline int dma_mapping_error(struct device *dev, dma_addr_t handle)
{
return 0;
}
#else
#include <asm-generic/dma-mapping-broken.h>
#endif
#endif /* _M68K_DMA_MAPPING_H */
|
/*
* Definitions for Device tree / OpenFirmware handling on X86
*
* based on arch/powerpc/include/asm/prom.h which is
* Copyright (C) 1996-2005 Paul Mackerras.
*
* 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 _ASM_X86_PROM_H
#define _ASM_X86_PROM_H
#ifndef __ASSEMBLY__
#include <linux/of.h>
#include <linux/types.h>
#include <linux/pci.h>
#include <asm/irq.h>
#include <linux/atomic.h>
#include <asm/setup.h>
#ifdef CONFIG_OF
extern int of_ioapic;
extern u64 initial_dtb;
extern void add_dtb(u64 data);
void x86_of_pci_init(void);
void x86_dtb_init(void);
#else
static inline void add_dtb(u64 data) { }
static inline void x86_of_pci_init(void) { }
static inline void x86_dtb_init(void) { }
#define of_ioapic 0
#endif
extern char cmd_line[COMMAND_LINE_SIZE];
#define HAVE_ARCH_DEVTREE_FIXUPS
#endif /* __ASSEMBLY__ */
#endif
|
#ifndef PLAYERSFINISHEDTURNTIMER_H
#define PLAYERSFINISHEDTURNTIMER_H
/* PlayersFinishedTurnTimer class
*
* Copyright (C) 2007, 2009 Lee Begg and the Thousand Parsec Project
*
* 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
*
*/
#include "turntimer.h"
class PlayersFinishedTurnTimer : public TurnTimer{
public:
PlayersFinishedTurnTimer();
void resetTimer();
protected:
void onPlayerFinishedTurn();
};
#endif
|
/*
* libdpkg - Debian packaging suite library routines
* t-tarextract.c - test tar extractor
*
* Copyright © 2014 Guillem Jover <guillem@debian.org>
*
* This 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,
* or (at your option) any later version.
*
* This 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 <https://www.gnu.org/licenses/>.
*/
#include <config.h>
#include <compat.h>
#include <sys/types.h>
#if HAVE_SYS_SYSMACROS_H
#include <sys/sysmacros.h> /* Needed on AIX for major()/minor(). */
#endif
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <dpkg/ehandle.h>
#include <dpkg/fdio.h>
#include <dpkg/buffer.h>
#include <dpkg/tarfn.h>
struct tar_context {
int tar_fd;
};
static int
tar_read(void *ctx, char *buffer, int size)
{
struct tar_context *tc = ctx;
return fd_read(tc->tar_fd, buffer, size);
}
static int
tar_object_skip(struct tar_context *tc, struct tar_entry *te)
{
off_t size;
size = (te->size + TARBLKSZ - 1) / TARBLKSZ * TARBLKSZ;
if (size == 0)
return 0;
return fd_skip(tc->tar_fd, size, NULL);
}
static int
tar_object(void *ctx, struct tar_entry *te)
{
printf("%s mode=%o time=%ld.%.9d uid=%d gid=%d", te->name,
te->stat.mode, te->mtime, 0, te->stat.uid, te->stat.gid);
if (te->stat.uname)
printf(" uname=%s", te->stat.uname);
if (te->stat.gname)
printf(" gname=%s", te->stat.gname);
switch (te->type) {
case TAR_FILETYPE_FILE0:
case TAR_FILETYPE_FILE:
tar_object_skip(ctx, te);
printf(" type=file size=%jd", (intmax_t)te->size);
break;
case TAR_FILETYPE_HARDLINK:
printf(" type=hardlink linkto=%s size=%jd",
te->linkname, (intmax_t)te->size);
break;
case TAR_FILETYPE_SYMLINK:
printf(" type=symlink linkto=%s size=%jd",
te->linkname, (intmax_t)te->size);
break;
case TAR_FILETYPE_DIR:
printf(" type=dir");
break;
case TAR_FILETYPE_CHARDEV:
case TAR_FILETYPE_BLOCKDEV:
printf(" type=device id=%d.%d", major(te->dev), minor(te->dev));
break;
case TAR_FILETYPE_FIFO:
printf(" type=fifo");
break;
default:
ohshit("unexpected tar entry type '%c'", te->type);
}
printf("\n");
return 0;
}
struct tar_operations tar_ops = {
.read = tar_read,
.extract_file = tar_object,
.link = tar_object,
.symlink = tar_object,
.mkdir = tar_object,
.mknod = tar_object,
};
int
main(int argc, char **argv)
{
struct tar_context ctx;
const char *tar_name = argv[1];
setvbuf(stdout, NULL, _IOLBF, 0);
push_error_context();
if (tar_name) {
ctx.tar_fd = open(tar_name, O_RDONLY);
if (ctx.tar_fd < 0)
ohshite("cannot open file '%s'", tar_name);
} else {
ctx.tar_fd = STDIN_FILENO;
}
if (tar_extractor(&ctx, &tar_ops))
ohshite("extracting tar");
if (tar_name)
close(ctx.tar_fd);
pop_error_context(ehflag_normaltidy);
return 0;
}
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2010-2014 Intel Corporation
*/
#ifndef _RTE_CPUFLAGS_H_
#define _RTE_CPUFLAGS_H_
/**
* @file
* Architecture specific API to determine available CPU features at runtime.
*/
#include "rte_common.h"
#include <errno.h>
/**
* Enumeration of all CPU features supported
*/
__extension__
enum rte_cpu_flag_t;
/**
* Get name of CPU flag
*
* @param feature
* CPU flag ID
* @return
* flag name
* NULL if flag ID is invalid
*/
__extension__
const char *
rte_cpu_get_flag_name(enum rte_cpu_flag_t feature);
/**
* Function for checking a CPU flag availability
*
* @param feature
* CPU flag to query CPU for
* @return
* 1 if flag is available
* 0 if flag is not available
* -ENOENT if flag is invalid
*/
__extension__
int
rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature);
/**
* This function checks that the currently used CPU supports the CPU features
* that were specified at compile time. It is called automatically within the
* EAL, so does not need to be used by applications.
*/
__rte_deprecated
void
rte_cpu_check_supported(void);
/**
* This function checks that the currently used CPU supports the CPU features
* that were specified at compile time. It is called automatically within the
* EAL, so does not need to be used by applications. This version returns a
* result so that decisions may be made (for instance, graceful shutdowns).
*/
int
rte_cpu_is_supported(void);
#endif /* _RTE_CPUFLAGS_H_ */
|
/***************************************************************************
qgsabstractdatasourcewidget.h - base class for source selector widgets
-------------------
begin : 10 July 2017
original : (C) 2017 by Alessandro Pasotti
email : apasotti at boundlessgeo dot 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 QGSABSTRACTDATASOURCEWIDGET_H
#define QGSABSTRACTDATASOURCEWIDGET_H
#include "qgis_sip.h"
#include "qgis.h"
#include "qgis_gui.h"
#include "qgsproviderregistry.h"
#include "qgsguiutils.h"
#include <QDialog>
#include <QDialogButtonBox>
class QgsMapCanvas;
/** \ingroup gui
* \brief Abstract base Data Source Widget to create connections and add layers
* This class provides common functionality and the interface for all
* source select dialogs used by data providers to configure data sources
* and add layers.
* \since QGIS 3.0
*/
class GUI_EXPORT QgsAbstractDataSourceWidget : public QDialog
{
Q_OBJECT
public:
//! Destructor
~QgsAbstractDataSourceWidget() = default;
/** Store a pointer to the map canvas to retrieve extent and CRS
* Used to select an appropriate CRS and possibly to retrieve data only in the current extent
*/
void setMapCanvas( const QgsMapCanvas *mapCanvas );
public slots:
/** Triggered when the provider's connections need to be refreshed
* The default implementation does nothing
*/
virtual void refresh() {}
/** Triggered when the add button is clicked, the add layer signal is emitted
* Concrete classes should implement the right behavior depending on the layer
* being added.
*/
virtual void addButtonClicked() { }
/** Triggered when the dialog is accepted, call addButtonClicked() and
* emit the accepted() signal
*/
virtual void okButtonClicked();
signals:
/** Emitted when the provider's connections have changed
* This signal is normally forwarded the app and used to refresh browser items
*/
void connectionsChanged();
//! Emitted when a DB layer has been selected for addition
void addDatabaseLayers( const QStringList &paths, const QString &providerKey );
//! Emitted when a raster layer has been selected for addition
void addRasterLayer( const QString &rasterLayerPath, const QString &baseName, const QString &providerKey );
/**
* Emitted when a vector layer has been selected for addition.
*
* If \a providerKey is not specified, the default provider key associated with the source
* will be used.
*/
void addVectorLayer( const QString &uri, const QString &layerName, const QString &providerKey = QString() );
/** Emitted when one or more OGR supported layers are selected for addition
* \param layerList list of layers protocol URIs
* \param encoding encoding
* \param dataSourceType string (can be "file" or "database")
*/
void addVectorLayers( const QStringList &layerList, const QString &encoding, const QString &dataSourceType );
/** Emitted when a layer needs to be replaced
* \param oldId old layer ID
* \param source URI of the layer
* \param name of the layer
* \param provider key
*/
void replaceVectorLayer( const QString &oldId, const QString &source, const QString &name, const QString &provider );
//! Emitted when a progress dialog is shown by the provider dialog
void progress( int, int );
//! Emitted when a progress dialog is shown by the provider dialog
void progressMessage( QString message );
//! Emitted when the ok/add buttons should be enabled/disabled
void enableButtons( bool enable );
protected:
//! Constructor
QgsAbstractDataSourceWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags, QgsProviderRegistry::WidgetMode widgetMode = QgsProviderRegistry::WidgetMode::None );
//! Return the widget mode
QgsProviderRegistry::WidgetMode widgetMode() const;
//! Return the map canvas (can be null)
const QgsMapCanvas *mapCanvas() const;
//! Connect the ok and apply/add buttons to the slots
void setupButtons( QDialogButtonBox *buttonBox );
//! Return the add Button
QPushButton *addButton( ) const { return mAddButton; }
private:
QPushButton *mAddButton = nullptr;
QgsProviderRegistry::WidgetMode mWidgetMode;
QgsMapCanvas const *mMapCanvas = nullptr;
};
#endif // QGSABSTRACTDATASOURCEWIDGET_H
|
// SPDX-License-Identifier: GPL-2.0
/* unix.c */
/* implements UNIX specific functions */
#include "ssrf.h"
#include "dive.h"
#include "subsurface-string.h"
#include "display.h"
#include "membuffer.h"
#include <string.h>
#include <sys/types.h>
#include <dirent.h>
#include <fnmatch.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <pwd.h>
// the DE should provide us with a default font and font size...
const char unix_system_divelist_default_font[] = "Sans";
const char *system_divelist_default_font = unix_system_divelist_default_font;
double system_divelist_default_font_size = -1.0;
void subsurface_OS_pref_setup(void)
{
// nothing
}
bool subsurface_ignore_font(const char *font)
{
// there are no old default fonts to ignore
UNUSED(font);
return false;
}
void subsurface_user_info(struct user_info *user)
{
struct passwd *pwd = getpwuid(getuid());
const char *username = getenv("USER");
if (pwd) {
if (!empty_string(pwd->pw_gecos))
user->name = strdup(pwd->pw_gecos);
if (!username)
username = pwd->pw_name;
}
if (!empty_string(username)) {
char hostname[64];
struct membuffer mb = {};
gethostname(hostname, sizeof(hostname));
put_format(&mb, "%s@%s", username, hostname);
mb_cstring(&mb);
user->email = detach_buffer(&mb);
}
}
static const char *system_default_path_append(const char *append)
{
const char *home = getenv("HOME");
if (!home)
home = "~";
const char *path = "/.subsurface";
int len = strlen(home) + strlen(path) + 1;
if (append)
len += strlen(append) + 1;
char *buffer = (char *)malloc(len);
memset(buffer, 0, len);
strcat(buffer, home);
strcat(buffer, path);
if (append) {
strcat(buffer, "/");
strcat(buffer, append);
}
return buffer;
}
const char *system_default_directory(void)
{
static const char *path = NULL;
if (!path)
path = system_default_path_append(NULL);
return path;
}
const char *system_default_filename(void)
{
static const char *path = NULL;
if (!path) {
const char *user = getenv("LOGNAME");
if (empty_string(user))
user = "username";
char *filename = calloc(strlen(user) + 5, 1);
strcat(filename, user);
strcat(filename, ".xml");
path = system_default_path_append(filename);
free(filename);
}
return path;
}
int enumerate_devices(device_callback_t callback, void *userdata, unsigned int transport)
{
int index = -1, entries = 0;
DIR *dp = NULL;
struct dirent *ep = NULL;
size_t i;
FILE *file;
char *line = NULL;
char *fname;
size_t len;
if (transport & DC_TRANSPORT_SERIAL) {
const char *dirname = "/dev";
#ifdef __OpenBSD__
const char *patterns[] = {
"ttyU*",
"ttyC*",
NULL
};
#else
const char *patterns[] = {
"ttyUSB*",
"ttyS*",
"ttyACM*",
"rfcomm*",
NULL
};
#endif
dp = opendir(dirname);
if (dp == NULL) {
return -1;
}
while ((ep = readdir(dp)) != NULL) {
for (i = 0; patterns[i] != NULL; ++i) {
if (fnmatch(patterns[i], ep->d_name, 0) == 0) {
char filename[1024];
int n = snprintf(filename, sizeof(filename), "%s/%s", dirname, ep->d_name);
if (n >= (int)sizeof(filename)) {
closedir(dp);
return -1;
}
callback(filename, userdata);
if (is_default_dive_computer_device(filename))
index = entries;
entries++;
break;
}
}
}
closedir(dp);
}
#ifdef __linux__
if (transport & DC_TRANSPORT_USBSTORAGE) {
int num_uemis = 0;
file = fopen("/proc/mounts", "r");
if (file == NULL)
return index;
while ((getline(&line, &len, file)) != -1) {
char *ptr = strstr(line, "UEMISSDA");
if (!ptr)
ptr = strstr(line, "GARMIN");
if (ptr) {
char *end = ptr, *start = ptr;
while (start > line && *start != ' ')
start--;
if (*start == ' ')
start++;
while (*end != ' ' && *end != '\0')
end++;
*end = '\0';
fname = strdup(start);
callback(fname, userdata);
if (is_default_dive_computer_device(fname))
index = entries;
entries++;
num_uemis++;
free((void *)fname);
}
}
free(line);
fclose(file);
if (num_uemis == 1 && entries == 1) /* if we found only one and it's a mounted Uemis, pick it */
index = 0;
}
#endif
return index;
}
/* NOP wrappers to comform with windows.c */
int subsurface_rename(const char *path, const char *newpath)
{
return rename(path, newpath);
}
int subsurface_open(const char *path, int oflags, mode_t mode)
{
return open(path, oflags, mode);
}
FILE *subsurface_fopen(const char *path, const char *mode)
{
return fopen(path, mode);
}
void *subsurface_opendir(const char *path)
{
return (void *)opendir(path);
}
int subsurface_access(const char *path, int mode)
{
return access(path, mode);
}
int subsurface_stat(const char* path, struct stat* buf)
{
return stat(path, buf);
}
struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp)
{
return zip_open(path, flags, errorp);
}
int subsurface_zip_close(struct zip *zip)
{
return zip_close(zip);
}
/* win32 console */
void subsurface_console_init(void)
{
/* NOP */
}
void subsurface_console_exit(void)
{
/* NOP */
}
bool subsurface_user_is_root()
{
return geteuid() == 0;
}
|
#ifndef __ALWAYS_ON_REG_H_
#define __ALWAYS_ON_REG_H_
#define IO_AOBUS_BASE 0xc8100000
#define P_AO_RTI_STATUS_REG0 (IO_AOBUS_BASE | (0x00 << 10) | (0x00 << 2))
#define P_AO_RTI_STATUS_REG1 (IO_AOBUS_BASE | (0x00 << 10) | (0x01 << 2))
#define P_AO_RTI_STATUS_REG2 (IO_AOBUS_BASE | (0x00 << 10) | (0x02 << 2))
#define P_AO_RTI_PWR_CNTL_REG0 (IO_AOBUS_BASE | (0x00 << 10) | (0x04 << 2))
#define P_AO_RTI_PIN_MUX_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x05 << 2))
#define P_AO_WD_GPIO_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x06 << 2))
#define P_AO_REMAP_REG0 (IO_AOBUS_BASE | (0x00 << 10) | (0x07 << 2))
#define P_AO_REMAP_REG1 (IO_AOBUS_BASE | (0x00 << 10) | (0x08 << 2))
#define P_AO_GPIO_O_EN_N (IO_AOBUS_BASE | (0x00 << 10) | (0x09 << 2))
#define P_AO_GPIO_I (IO_AOBUS_BASE | (0x00 << 10) | (0x0A << 2))
#define P_AO_RTI_PULL_UP_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x0B << 2))
#define P_AO_RTI_JTAG_CODNFIG_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x0C << 2))
#define P_AO_RTI_WD_MARK (IO_AOBUS_BASE | (0x00 << 10) | (0x0D << 2))
#define P_AO_RTI_GEN_CNTL_REG0 (IO_AOBUS_BASE | (0x00 << 10) | (0x10 << 2))
#define P_AO_WATCHDOG_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x11 << 2))
#define P_AO_WATCHDOG_RESET (IO_AOBUS_BASE | (0x00 << 10) | (0x12 << 2))
#define P_AO_TIMER_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x13 << 2))
#define P_AO_TIMERA_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x14 << 2))
#define P_AO_TIMERE_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x15 << 2))
#define P_AO_AHB2DDR_CNTL (IO_AOBUS_BASE | (0x00 << 10) | (0x18 << 2))
#define P_AO_IRQ_MASK_FIQ_SEL (IO_AOBUS_BASE | (0x00 << 10) | (0x20 << 2))
#define P_AO_IRQ_GPIO_REG (IO_AOBUS_BASE | (0x00 << 10) | (0x21 << 2))
#define P_AO_IRQ_STAT (IO_AOBUS_BASE | (0x00 << 10) | (0x22 << 2))
#define P_AO_IRQ_STAT_CLR (IO_AOBUS_BASE | (0x00 << 10) | (0x23 << 2))
#define P_AO_DEBUG_REG0 (IO_AOBUS_BASE | (0x00 << 10) | (0x28 << 2))
#define P_AO_DEBUG_REG1 (IO_AOBUS_BASE | (0x00 << 10) | (0x29 << 2))
#define P_AO_DEBUG_REG2 (IO_AOBUS_BASE | (0x00 << 10) | (0x2a << 2))
#define P_AO_DEBUG_REG3 (IO_AOBUS_BASE | (0x00 << 10) | (0x2b << 2))
// -------------------------------------------------------------------
// BASE #1
// -------------------------------------------------------------------
#define P_AO_IR_DEC_LDR_ACTIVE (IO_AOBUS_BASE | (0x01 << 10) | (0x20 << 2))
#define P_AO_IR_DEC_LDR_IDLE (IO_AOBUS_BASE | (0x01 << 10) | (0x21 << 2))
#define P_AO_IR_DEC_LDR_REPEAT (IO_AOBUS_BASE | (0x01 << 10) | (0x22 << 2))
#define P_AO_IR_DEC_BIT_0 (IO_AOBUS_BASE | (0x01 << 10) | (0x23 << 2))
#define P_AO_IR_DEC_REG0 (IO_AOBUS_BASE | (0x01 << 10) | (0x24 << 2))
#define P_AO_IR_DEC_FRAME (IO_AOBUS_BASE | (0x01 << 10) | (0x25 << 2))
#define P_AO_IR_DEC_STATUS (IO_AOBUS_BASE | (0x01 << 10) | (0x26 << 2))
#define P_AO_IR_DEC_REG1 (IO_AOBUS_BASE | (0x01 << 10) | (0x27 << 2))
// ----------------------------
// UART
// ----------------------------
#define P_AO_UART_WFIFO (IO_AOBUS_BASE | (0x01 << 10) | (0x30 << 2))
#define P_AO_UART_RFIFO (IO_AOBUS_BASE | (0x01 << 10) | (0x31 << 2))
#define P_AO_UART_CONTROL (IO_AOBUS_BASE | (0x01 << 10) | (0x32 << 2))
#define P_AO_UART_STATUS (IO_AOBUS_BASE | (0x01 << 10) | (0x33 << 2))
#define P_AO_UART_MISC (IO_AOBUS_BASE | (0x01 << 10) | (0x34 << 2))
// ----------------------------
// I2C Master (8)
// ----------------------------
#define P_AO_I2C_M_0_CONTROL_REG (0xc8100500)
#define P_AO_I2C_M_0_SLAVE_ADDR (0xc8100504)
#define P_AO_I2C_M_0_TOKEN_LIST0 (0xc8100508)
#define P_AO_I2C_M_0_TOKEN_LIST1 (0xc810050c)
#define P_AO_I2C_M_0_WDATA_REG0 (0xc8100510)
#define P_AO_I2C_M_0_WDATA_REG1 (0xc8100514)
#define P_AO_I2C_M_0_RDATA_REG0 (0xc8100518)
#define P_AO_I2C_M_0_RDATA_REG1 (0xc810051c)
// ----------------------------
// I2C Slave (3)
// ----------------------------
#define P_AO_I2C_S_CONTROL_REG (IO_AOBUS_BASE | (0x01 << 10) | (0x50 << 2))
#define P_AO_I2C_S_SEND_REG (IO_AOBUS_BASE | (0x01 << 10) | (0x51 << 2))
#define P_AO_I2C_S_RECV_REG (IO_AOBUS_BASE | (0x01 << 10) | (0x52 << 2))
#define P_AO_I2C_S_CNTL1_REG (IO_AOBUS_BASE | (0x01 << 10) | (0x53 << 2))
// ---------------------------
// RTC (4)
// ---------------------------
#define P_AO_RTC_ADDR0 (IO_AOBUS_BASE | (0x01 << 10) | (0xd0 << 2))
#define P_AO_RTC_ADDR1 (IO_AOBUS_BASE | (0x01 << 10) | (0xd1 << 2))
#define P_AO_RTC_ADDR2 (IO_AOBUS_BASE | (0x01 << 10) | (0xd2 << 2))
#define P_AO_RTC_ADDR3 (IO_AOBUS_BASE | (0x01 << 10) | (0xd3 << 2))
#define P_AO_RTC_ADDR4 (IO_AOBUS_BASE | (0x01 << 10) | (0xd4 << 2))
#endif
|
/****************************************************************************
*
* Copyright (C) 2005 - 2011 by Vivante Corp.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the license, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
#ifndef __gc_hal_kernel_debug_h_
#define __gc_hal_kernel_debug_h_
#include <gc_hal_kernel_linux.h>
#include <linux/spinlock.h>
#include <linux/time.h>
#include <stdarg.h>
#ifdef __cplusplus
extern "C" {
#endif
/******************************************************************************\
****************************** OS-dependent Macros *****************************
\******************************************************************************/
typedef va_list gctARGUMENTS;
#define gcmkARGUMENTS_START(Arguments, Pointer) \
va_start(Arguments, Pointer)
#define gcmkARGUMENTS_END(Arguments) \
va_end(Arguments)
#define gcmkDECLARE_LOCK(__spinLock__) \
static DEFINE_SPINLOCK(__spinLock__);
#define gcmkLOCKSECTION(__spinLock__) \
spin_lock(&__spinLock__)
#define gcmkUNLOCKSECTION(__spinLock__) \
spin_unlock(&__spinLock__)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
# define gcmkGETPROCESSID() \
task_tgid_vnr(current)
#else
# define gcmkGETPROCESSID() \
current->tgid
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,24)
# define gcmkGETTHREADID() \
task_pid_vnr(current)
#else
# define gcmkGETTHREADID() \
current->pid
#endif
#define gcmkOUTPUT_STRING(String) \
printk(String); \
touch_softlockup_watchdog()
#define gcmkSPRINTF(Destination, Size, Message, Value) \
snprintf(Destination, Size, Message, Value)
#define gcmkSPRINTF2(Destination, Size, Message, Value1, Value2) \
snprintf(Destination, Size, Message, Value1, Value2)
#define gcmkSPRINTF3(Destination, Size, Message, Value1, Value2, Value3) \
snprintf(Destination, Size, Message, Value1, Value2, Value3)
#define gcmkVSPRINTF(Destination, Size, Message, Arguments) \
vsnprintf(Destination, Size, Message, *(va_list *) &Arguments)
#define gcmkSTRCAT(Destination, Size, String) \
strncat(Destination, String, Size)
/* If not zero, forces data alignment in the variable argument list
by its individual size. */
#define gcdALIGNBYSIZE 1
#ifdef __cplusplus
}
#endif
#endif /* __gc_hal_kernel_debug_h_ */
|
/* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
*
* The information contained herein is property of Nordic Semiconductor ASA.
* Terms and conditions of usage are described in detail in NORDIC
* SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
*
* Licensees are granted free, non-transferable use of the information. NO
* WARRANTY of ANY KIND is provided. This heading must NOT be removed from
* the file.
*
*/
/** @file
*
* @defgroup ble_sdk_app_gzll_main main.c
* @{
* @ingroup ble_sdk_app_gzll
* @brief Multiprotocol Sample Application main file.
*
* This file contains the source code for a sample application using both Nordic Gazell proprietary
* radio protocol and Bluetooth Low Energy radio protocol. In Bluetooth mode, it behave as a Heart
* Rate sensor, in Gazell mode it behaves as a 'device'.
*/
#include <stdint.h>
#include <string.h>
#include "nordic_common.h"
#include "nrf.h"
#include "nrf_sdm.h"
#include "app_error.h"
#include "nrf_gpio.h"
#include "ble_app_gzll_device.h"
#include "ble_app_gzll_hr.h"
#include "ble_app_gzll_ui.h"
#include "boards.h"
#include "ble_error_log.h"
#include "app_timer.h"
#include "app_gpiote.h"
#include "ble_app_gzll_common.h"
#include "ble_debug_assert_handler.h"
#define DEAD_BEEF 0xDEADBEEF /**< Value used as error code on stack dump, can be used to identify stack location on stack unwind. */
volatile radio_mode_t running_mode = BLE;
/**@brief Function for error handling, which is called when an error has occurred.
*
* @warning This handler is an example only and does not fit a final product. You need to analyze
* how your product is supposed to react in case of error.
*
* @param[in] error_code Error code supplied to the handler.
* @param[in] line_num Line number where the handler is called.
* @param[in] p_file_name Pointer to the file name.
*/
void app_error_handler(uint32_t error_code, uint32_t line_num, const uint8_t * p_file_name)
{
nrf_gpio_pin_set(ASSERT_LED_PIN_NO);
// This call can be used for debug purposes during application development.
// @note CAUTION: Activating this code will write the stack to flash on an error.
// This function should NOT be used in a final product.
// It is intended STRICTLY for development/debugging purposes.
// The flash write will happen EVEN if the radio is active, thus interrupting
// any communication.
// Use with care. Un-comment the line below to use.
// ble_debug_assert_handler(error_code, line_num, p_file_name);
// On assert, the system can only recover on reset.
NVIC_SystemReset();
}
/**@brief Callback function for asserts in the SoftDevice.
*
* @details This function will be called in case of an assert in the SoftDevice.
*
* @warning This handler is an example only and does not fit a final product. You need to analyze
* how your product is supposed to react in case of Assert.
* @warning On assert from the SoftDevice, the system can only recover on reset.
*
* @param[in] line_num Line number of the failing ASSERT call.
* @param[in] file_name File name of the failing ASSERT call.
*/
void assert_nrf_callback(uint16_t line_num, const uint8_t * p_file_name)
{
app_error_handler(DEAD_BEEF, line_num, p_file_name);
}
/**@brief Function for the Timer module initialization.
*/
static void timers_init(void)
{
// Initialize timer module, making it use the scheduler
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_MAX_TIMERS, APP_TIMER_OP_QUEUE_SIZE, false);
}
/**@brief Function for initializing GPIOTE module.
*/
static void gpiote_init(void)
{
APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS);
}
/**@brief Function for the Power Management.
*/
static void power_manage(void)
{
if (running_mode == GAZELL)
{
// Use directly __WFE and __SEV macros since the SoftDevice is not available in proprietary
// mode.
// Wait for event.
__WFE();
// Clear Event Register.
__SEV();
__WFE();
}
else if (running_mode == BLE)
{
uint32_t err_code;
// Use SoftDevice API for power_management when in Bluetooth Mode.
err_code = sd_app_evt_wait();
APP_ERROR_CHECK(err_code);
}
}
/**@brief Function for application main entry.
*/
int main(void)
{
radio_mode_t previous_mode = running_mode;
leds_init();
ble_stack_start();
timers_init();
gpiote_init();
buttons_init();
ble_hrs_app_start();
// Enter main loop.
for (;;)
{
power_manage();
if (running_mode != previous_mode)
{
previous_mode = running_mode;
if (running_mode == GAZELL)
{
// Stop all heart rate functionality before disabling the SoftDevice.
ble_hrs_app_stop();
// Disable the S110 stack.
ble_stack_stop();
nrf_gpio_pin_clear(ADVERTISING_LED_PIN_NO);
nrf_gpio_pin_clear(CONNECTED_LED_PIN_NO );
// Enable Gazell.
gzll_app_start();
timers_init();
gpiote_init();
buttons_init();
}
else if (running_mode == BLE)
{
// Disable Gazell.
gzll_app_stop();
nrf_gpio_pin_clear(GZLL_TX_SUCCESS_LED_PIN_NO);
nrf_gpio_pin_clear(GZLL_TX_FAIL_LED_PIN_NO );
// Re-enable the S110 stack.
ble_stack_start();
timers_init();
gpiote_init();
buttons_init();
ble_hrs_app_start();
}
}
}
}
/**
* @}
*/
|
/*
* Copyright (c) 2002, 2003, 2004 Niels Provos <provos@citi.umich.edu>
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <sys/types.h>
#include <sys/param.h>
#include "config.h"
#include <sys/stat.h>
#include <sys/tree.h>
#include <sys/queue.h>
#include <sys/socket.h>
#include <sys/resource.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dumbnet.h>
#undef timeout_pending
#undef timeout_initialized
#include <event.h>
#include "honeyd.h"
#include "udp.h"
#include "log.h"
#include "hooks.h"
#include "util.h"
struct callback cb_udp = {
cmd_udp_read, cmd_udp_write, cmd_udp_eread, cmd_udp_connect_cb
};
void
cmd_udp_eread(int fd, short which, void *arg)
{
extern FILE *honeyd_servicefp;
struct udp_con *con = arg;
char line[1024];
int nread;
struct command *cmd = &con->cmd;
TRACE(fd, nread = read(fd, line, sizeof(line)));
if (nread <= 0) {
udp_free(con);
return;
}
if (nread == sizeof(line))
nread--;
line[nread] = '\0';
honeyd_log_service(honeyd_servicefp, IP_PROTO_UDP, &con->conhdr, line);
event_add(&cmd->peread, NULL);
}
void
udp_add_readbuf(struct udp_con *con, u_char *dat, u_int datlen)
{
struct conbuffer *buf;
hooks_dispatch(IP_PROTO_UDP, HD_INCOMING_STREAM, &con->conhdr,
dat, datlen);
if (con->cmd_pfd == -1)
return;
if (con->nincoming >= MAX_UDP_BUFFERS)
return;
buf = malloc(sizeof(struct conbuffer));
if (buf == NULL)
return;
buf->buf = malloc(datlen);
if (buf->buf == NULL) {
free(buf);
return;
}
memcpy(buf->buf, dat, datlen);
buf->len = datlen;
TAILQ_INSERT_TAIL(&con->incoming, buf, next);
con->nincoming++;
cmd_trigger_write(&con->cmd, 1);
}
void
cmd_udp_read(int fd, short which, void *arg)
{
struct udp_con *con = arg;
u_char buf[2048];
ssize_t len;
TRACE(fd, len = read(fd, buf, sizeof(buf)));
if (len == -1) {
if (errno == EINTR || errno == EAGAIN)
goto again;
}
if (len <= 0) {
udp_free(con);
return;
}
udp_send(con, buf, len);
again:
cmd_trigger_read(&con->cmd, 1);
}
void
cmd_udp_write(int fd, short which, void *arg)
{
struct udp_con *con = arg;
struct conbuffer *buf;
ssize_t len;
buf = TAILQ_FIRST(&con->incoming);
if (buf == NULL)
return;
TRACE(fd, len = write(fd, buf->buf, buf->len));
if (len == -1) {
if (errno == EINTR || errno == EAGAIN)
goto again;
cmd_free(&con->cmd);
return;
} else if (len == 0) {
cmd_free(&con->cmd);
return;
}
TAILQ_REMOVE(&con->incoming, buf, next);
con->nincoming--;
free(buf->buf);
free(buf);
again:
cmd_trigger_write(&con->cmd, TAILQ_FIRST(&con->incoming) != NULL);
}
void
cmd_udp_connect_cb(int fd, short which, void *arg)
{
struct udp_con *con = arg;
/* Everything is ready */
cmd_ready_fd(&con->cmd, &cb_udp, con);
cmd_trigger_read(&con->cmd, 1);
cmd_trigger_write(&con->cmd, TAILQ_FIRST(&con->incoming) != NULL);
return;
}
|
// qscore.h
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <ctype.h>
#include <assert.h>
#include <math.h>
#include <stdarg.h>
#include <errno.h>
#include <algorithm>
#include <vector>
#include <string>
#ifndef UINT_MAX
#define UINT_MAX 0xffffffff
#endif
#ifdef _MSC_VER
# if _MSC_VER < 1900
#include <hash_map>
typedef stdext::hash_map<std::string, unsigned> StrToInt;
# else
#include <unordered_map>
typedef std::unordered_map<std::string, unsigned> StrToInt;
# endif
#else
#undef __DEPRECATED // disable warning message about deprecated dependency.
#include <ext/hash_map>
struct HashStringToUnsigned
{
size_t operator()(const std::string &Key) const
{
size_t h = 0;
size_t Bytes = Key.size();
for (size_t i = 0; i < Bytes; ++i)
{
unsigned char c = (unsigned char) Key[i];
h = c + (h << 6) + (h << 16) - h;
}
return h;
}
};
typedef __gnu_cxx::hash_map<std::string, unsigned, HashStringToUnsigned> StrToInt;
#endif
using namespace std;
// Allow different conventions: DEBUG or _DEBUG for debug mode,
// NDEBUG for not debug mode.
#ifdef _DEBUG
#undef DEBUG
#define DEBUG 1
#endif
#ifdef DEBUG
#undef _DEBUG
#define _DEBUG 1
#endif
#ifdef NDEBUG
#undef DEBUG
#undef _DEBUG
#endif
typedef vector<unsigned> IntVec;
typedef vector<bool> BoolVec;
#define all(t, n) (t *) allocmem((n)*sizeof(t))
#define reall(p, t, n) p = (t *) reallocmem(p, (n)*sizeof(t))
#define zero(p, t, n) memset(p, 0, (n)*sizeof(t))
void *allocmem(int bytes);
void freemem(void *p);
void *reallocmem(void *p, int bytes);
static inline bool IsGap(char c)
{
return '-' == c || '~' == c || '.' == c || '+' == c || '#' == c;
}
static inline int iabs(int i)
{
return i >= 0 ? i : -i;
}
class MSA_QScore;
const double dInsane = double(0xffffffff);
const unsigned uInsane = 987654321;
unsigned CharToLetter(char c);
char LetterToChar(unsigned Letter);
void ComparePair(const MSA_QScore &msaTest, unsigned uTestSeqIndexA,
unsigned uTestSeqIndexB, const MSA_QScore &msaRef, unsigned uRefSeqIndexA,
unsigned uRefSeqIndexB, double *ptrdSP, double *ptrdPS, double *ptrdCS);
double ComparePairSP(const MSA_QScore &msaTest, unsigned uTestSeqIndexA,
unsigned uTestSeqIndexB, const MSA_QScore &msaRef, unsigned uRefSeqIndexA,
unsigned uRefSeqIndexB);
void ComparePairMap(const int iTestMapA[], const int iTestMapB[],
const int iRefMapA[], const int iRefMapB[], int iLengthA, int iLengthB,
double *ptrdSP, double *ptrdPS, double *ptrdCS);
double ComparePairMapSP(const int iTestMapA[], const int iTestMapB[],
const int iRefMapA[], const int iRefMapB[], int iLengthA, int iLengthB);
double SumPairs(const int iMapRef[], const int iMapTest[], unsigned uLength);
double ClineShift(const int iTestMapA[], const int iRefMapA[], unsigned uLengthA,
const int iTestMapB[], const int iRefMapB[], unsigned uLengthB, double dEpsilon = 0.2);
void MakePairMaps(const MSA_QScore &msaTest, unsigned uTestSeqIndexA, unsigned uTestSeqIndexB,
const MSA_QScore &msaRef, unsigned uRefSeqIndexA, unsigned uRefSeqIndexB, int **ptriTestMapAr,
int **ptriTestMapBr, int **ptriRefMapAr, int **ptriRefMapBr);
void Quit_Qscore(const char *Format, ...);
//void Warning_Qscore(const char *Format, ...);
FILE *OpenStdioFile(const char *FileName);
int GetFileSize(FILE *f);
//void ParseOptions(int argc, char *argv[]);
bool FlagOpt_QScore(const char *Name);
const char *ValueOpt_QScore(const char *Name);
const char *RequiredValueOpt(const char *Name);
void CompareMSA(const MSA_QScore &msaTest, const MSA_QScore &msaRef, double *ptrdSP,
double *ptrdPS, double *ptrdCS);
double ComputeTC(MSA_QScore &msaTest, MSA_QScore &msaRef);
void FastQ(const MSA_QScore &msaTest, const MSA_QScore &msaRef, double &Q, double &TC,
bool WarnIfNoRefAligned = true);
void ComputeGapScoreMSA(MSA_QScore &msaTest, MSA_QScore &msaRef, double &GC, double &TC);
//void Log(const char *Format, ...);
double PerSeq(const MSA_QScore &msaTest, const MSA_QScore &msaRef);
double QScore(MSA_QScore* _msaTest, MSA_QScore* _msaRef);
void SAB();
#include "qscore/msa.h"
#include "qscore/seq.h"
#include "qscore/qscore_context.h"
|
#ifndef SEEN_SP_SELTRANS_HANDLES_H
#define SEEN_SP_SELTRANS_HANDLES_H
/*
* Seltrans knots
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
*
* Copyright (C) 1999-2002 authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <2geom/forward.h>
#include <gdk/gdk.h>
#include "enums.h"
typedef unsigned int guint32;
namespace Inkscape {
class SelTrans;
}
guint32 const DEF_COLOR[] = { 0xff, 0xff6600, 0xff6600, 0xff, 0xff, 0xff };
guint32 const CEN_COLOR[] = { 0x0, 0x0, 0x0, 0xff, 0xff0000b0, 0xff0000b0 };
enum SPSelTransType {
HANDLE_STRETCH,
HANDLE_SCALE,
HANDLE_SKEW,
HANDLE_ROTATE,
HANDLE_CENTER
};
struct SPSelTransTypeInfo {
guint32 const *color;
char const *tip;
};
// One per handle type in order
extern SPSelTransTypeInfo const handtypes[5];
struct SPSelTransHandle;
struct SPSelTransHandle {
SPSelTransType type;
SPAnchorType anchor;
GdkCursorType cursor;
unsigned int control;
gdouble x, y;
};
// These are 4 * each handle type + 1 for center
int const NUMHANDS = 17;
extern SPSelTransHandle const hands[17];
#endif // SEEN_SP_SELTRANS_HANDLES_H
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* 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.
*
* $URL$
* $Id$
*
*/
#ifndef SHORTS_SEGMENT_MANAGER_H
#define SHORTS_SEGMENT_MANAGER_H
#include "common/scummsys.h"
#if defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) && defined(MIPS_TARGET)
#include "backends/plugins/elf/elf32.h"
#include "common/singleton.h"
#include "common/list.h"
#define ShortsMan ShortSegmentManager::instance()
/**
* ShortSegmentManager
*
* Since MIPS is limited to 32 bits per instruction, loading data that's further away than 16 bits
* takes several instructions. Thus, small global data (which is likely to be accessed a lot from
* multiple locations) is often put into a GP-relative area (GP standing for the global pointer register)
* in MIPS processors. This class manages these segments of small global data, and is used by the
* member functions of MIPSDLObject, which query in information from this manager in order to deal with
* this segment during the loading/unloading of plugins.
*
* Since there's no true dynamic linker to change the GP register between plugins and the main engine,
* custom ld linker scripts for both the main executable and the plugins ensure the GP-area is in the
* same place for both. The ShortSegmentManager accesses this place via the symbols __plugin_hole_start
* and __plugin_hole_end, which are defined in those custom ld linker scripts.
*/
class ShortSegmentManager : public Common::Singleton<ShortSegmentManager> {
private:
char *_shortsStart;
char *_shortsEnd;
public:
char *getShortsStart() {
return _shortsStart;
}
// Returns whether or not an absolute address is in the GP-relative section.
bool inGeneralSegment(char *addr) {
return (addr >= _shortsStart && addr < _shortsEnd);
}
class Segment {
private:
friend class ShortSegmentManager;
Segment(char *start, uint32 size, char *origAddr) :
_startAddress(start),
_size(size),
_origAddress(origAddr) {
}
virtual ~Segment() {
}
char *_startAddress; // Start of shorts segment in memory
uint32 _size; // Size of shorts segment
char *_origAddress; // Original address this segment was supposed to be at
public:
char *getStart() {
return _startAddress;
}
char *getEnd() {
return (_startAddress + _size);
}
Elf32_Addr getOffset() {
return (Elf32_Addr)(_startAddress - _origAddress);
}
bool inSegment(char *addr) {
return (addr >= _startAddress && addr <= _startAddress + _size);
}
};
Segment *newSegment(uint32 size, char *origAddr);
void deleteSegment(Segment *);
private:
ShortSegmentManager();
friend class Common::Singleton<ShortSegmentManager>;
Common::List<Segment *> _list;
char *_highestAddress;
};
#endif // defined(DYNAMIC_MODULES) && defined(USE_ELF_LOADER) && defined(MIPS_TARGET)
#endif /* SHORTS_SEGMENT_MANAGER_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.