text stringlengths 4 6.14k |
|---|
//
// ICGestureRecognizer.h
// caster
//
// Created by Jonah Williams on 7/21/12.
// Copyright (c) 2012 Industrial City Apps. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ICGestureRecognizer : UIGestureRecognizer
- (NSArray *)bezierPaths;
- (NSArray *)paths;
@end
|
#pragma once
#include <dnn/io/stream.h>
#include <dnn/util/spinning_barrier.h>
#include <dnn/neurons/spike_neuron.h>
#include <dnn/base/constants.h>
#include "reward_control.h"
#include "builder.h"
#include "network.h"
#include "global_ctx.h"
#include "sim_info.h"
namespace dnn {
class Sim : public Printable {
public:
Sim() : duration(0.0) {
init();
}
Sim(const Constants &_c) : c(_c) {
init();
}
void build(Stream* input_stream = nullptr);
void serialize(Stream &output_stream);
void saveStat(Stream &str);
void saveSpikes(Stream &str);
void turnOnStatistics();
void turnOffLearning();
static void runWorker(
Sim &s
, size_t from
, size_t to
, SpinningBarrier &barrier
, bool master_thread
, vector<std::exception_ptr> &exc_v
, std::mutex &exc_v_mut
);
static void runWorkerRoutine(Sim &s, size_t from, size_t to, SpinningBarrier &barrier, bool master_thread);
void setMaxDuration(const double Tmax);
void print(std::ostream &str) const;
void run(size_t jobs);
double duration;
protected:
void init() {
GlobalCtx::inst().init(sim_info, c, duration, rc);
}
SimInfo sim_info;
RewardControl rc;
Constants c;
vector<InterfacedPtr<SpikeNeuronBase>> neurons;
uptr<Network> net;
};
}
|
/* iostream.c -- This file is part of ctools
*
* Copyright (C) 2015 - David Oberhollenzer
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
#define TL_OS_EXPORT
#include "tl_iostream.h"
#include "tl_unix.h"
#include "os.h"
#ifdef __linux__
#include <sys/sendfile.h>
int __tl_os_splice(tl_iostream *out, tl_iostream *in,
size_t count, size_t *actual)
{
int infd, outfd, fds[2];
ssize_t res = -1;
off_t old = 0;
/* get fds */
tl_unix_iostream_fd(in, fds);
infd = fds[0];
tl_unix_iostream_fd(out, fds);
outfd = fds[1];
if (infd == -1 || outfd == -1)
return TL_ERR_NOT_SUPPORTED;
if (!wait_for_fd(infd, ((fd_stream *)in)->timeout, 0))
return TL_ERR_TIMEOUT;
if (!wait_for_fd(outfd, ((fd_stream *)out)->timeout, 1))
return TL_ERR_TIMEOUT;
/* splice */
if (out->type == TL_STREAM_TYPE_FILE &&
(((file_stream *)out)->flags & TL_APPEND)) {
old = lseek(outfd, 0, SEEK_END);
if (old == (off_t)-1)
return TL_ERR_INTERNAL;
}
if ((in->type == TL_STREAM_TYPE_PIPE)
|| (out->type == TL_STREAM_TYPE_PIPE)) {
res = splice(infd, NULL, outfd, NULL, count, SPLICE_F_MOVE);
} else if (in->type == TL_STREAM_TYPE_FILE) {
res = sendfile(outfd, infd, NULL, count);
}
if (out->type == TL_STREAM_TYPE_FILE &&
(((file_stream *) out)->flags & TL_APPEND)) {
lseek(outfd, old, SEEK_SET);
}
/* let the fallback implementation retry and figure that out */
if (res <= 0)
return TL_ERR_NOT_SUPPORTED;
if (actual)
*actual = res;
return 0;
}
#else /* __linux__ */
int __tl_os_splice(tl_iostream *out, tl_iostream *in,
size_t count, size_t *actual)
{
(void)out;
(void)in;
(void)count;
(void)actual;
return TL_ERR_NOT_SUPPORTED;
}
#endif
void tl_unix_iostream_fd(tl_iostream *str, int *fds)
{
fds[0] = -1;
fds[1] = -1;
switch (str->type) {
case TL_STREAM_TYPE_PIPE:
case TL_STREAM_TYPE_FILE:
fds[0] = (((file_stream *) str)->flags & TL_READ) ?
((file_stream *) str)->fd : -1;
fds[1] = (((file_stream *) str)->flags & TL_WRITE) ?
((file_stream *) str)->fd : -1;
break;
case TL_STREAM_TYPE_SOCK:
fds[0] = ((fd_stream *) str)->readfd;
fds[1] = ((fd_stream *) str)->writefd;
break;
}
}
|
#include "../include/a_audiosys.h"
void A_audioinit()
{
}
void A_audioclose()
{
}
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__wchar_t_console_execlp_05.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-05.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: console Read input from the console
* GoodSource: Fixed string
* Sink: execlp
* BadSink : execute command with wexeclp
* Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse)
*
* */
#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
#ifdef _WIN32
#include <process.h>
#define EXECLP _wexeclp
#else /* NOT _WIN32 */
#define EXECLP execlp
#endif
/* The two variables below are not defined as "const", but are never
* assigned any other value, so a tool should be able to identify that
* reads of these will always return their initialized values.
*/
static int staticTrue = 1; /* true */
static int staticFalse = 0; /* false */
#ifndef OMITBAD
void CWE78_OS_Command_Injection__wchar_t_console_execlp_05_bad()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(staticTrue)
{
{
/* Read input from the console */
size_t dataLen = wcslen(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 (fgetws(data+dataLen, (int)(100-dataLen), stdin) != NULL)
{
/* The next few lines remove the carriage return from the string that is
* inserted by fgetws() */
dataLen = wcslen(data);
if (dataLen > 0 && data[dataLen-1] == L'\n')
{
data[dataLen-1] = L'\0';
}
}
else
{
printLine("fgetws() failed");
/* Restore NUL terminator if fgetws fails */
data[dataLen] = L'\0';
}
}
}
}
/* wexeclp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B1() - use goodsource and badsink by changing the staticTrue to staticFalse */
static void goodG2B1()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
}
/* wexeclp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */
static void goodG2B2()
{
wchar_t * data;
wchar_t dataBuffer[100] = L"";
data = dataBuffer;
if(staticTrue)
{
/* FIX: Append a fixed string to data (not user / external input) */
wcscat(data, L"*.*");
}
/* wexeclp - searches for the location of the command among
* the directories specified by the PATH environment variable */
/* POTENTIAL FLAW: Execute command without validating input possibly leading to command injection */
EXECLP(COMMAND_INT, COMMAND_INT, COMMAND_ARG1, COMMAND_ARG2, COMMAND_ARG3, NULL);
}
void CWE78_OS_Command_Injection__wchar_t_console_execlp_05_good()
{
goodG2B1();
goodG2B2();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE78_OS_Command_Injection__wchar_t_console_execlp_05_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__wchar_t_console_execlp_05_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
#include "cpu/exec/template-start.h"
#define instr shl
static void do_execute () {
DATA_TYPE src = op_src->val;
DATA_TYPE dest = op_dest->val;
uint8_t count = src & 0x1f;
dest <<= count;
OPERAND_W(op_dest, dest);
/* There is no need to update EFLAGS, since no other instructions
* in PA will test the flags updated by this instruction.
*/
print_asm_template2();
}
make_instr_helper(rm_1)
make_instr_helper(rm_cl)
make_instr_helper(rm_imm)
#include "cpu/exec/template-end.h"
|
#include <stdint.h>
extern "C" {
void xoroshiro_seed(uint64_t high, uint64_t low);
uint64_t xoroshiro_next(void);
}
|
/*
K.N.King "C Programming. A Modern Approach."
Programming project 9 p.157
Write a program that asks the user for a 12-hour time,
then displays the time in 24-hour form:
hours:minutes
followed by either A, P, AM, or PM (either lowercase or
uppercase). Whitespace is allowed (but not required)
between the numerical time and the AM/PM indicator.
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#define BUFFER_SIZE 256
#define MINUTES_PER_HOUR 60
#define MIDDAY_HOUR 12
enum TimePeriod { AM, PM };
struct ShortTimeStamp24Hour
{
int hours;
int minutes;
};
struct ShortTimeStamp12Hour
{
int hours;
int minutes;
enum TimePeriod timePeriod;
};
struct ShortTimeStamp24Hour* ShortTimeStamp12HourConvertToShortTimeStamp24Hour(
const struct ShortTimeStamp12Hour* stamp,
struct ShortTimeStamp24Hour* OutResult);
int main(void) {
char buffer[BUFFER_SIZE] = { 0 };
int hours = 0;
int minutes = 0;
char c = '\0';
char* pchar = NULL;
struct ShortTimeStamp12Hour userTime12Hour = { 0 };
struct ShortTimeStamp24Hour userTime24Hour = { 0 };
while (1)
{
if (!fgets(buffer, BUFFER_SIZE, stdin)) {
return EXIT_FAILURE;
}
// if user enters input longer than BUFFER_SIZE - 1,
// discard the trailing input
// we can detect that if the last character before
// the null terminating character is not equal to a
// new line feed
if (buffer[strlen(buffer) - 1] != '\n') {
while ( (c = getchar()) != '\n' && c != EOF) continue;
}
// consume the numbers, store the rest of input back
// in the buffer
if ( sscanf(buffer, "%d : %d %s", &hours, &minutes, buffer) <3
|| (hours < 0 || hours > MIDDAY_HOUR)
|| (minutes < 0 || minutes >= MINUTES_PER_HOUR))
{
fprintf(stderr, "Input invalid. Please try again.\n");
continue;
}
pchar = buffer;
// convert to upper case for case insensitive comparison
while ((c = *pchar) != '\0') {
*pchar = toupper(c);
++pchar;
}
if (strcmp(buffer, "AM") == 0 || strcmp(buffer, "A") == 0) {
userTime12Hour.timePeriod = AM;
break;
} else if (strcmp(buffer, "PM") == 0 || strcmp(buffer, "P") == 0) {
userTime12Hour.timePeriod = PM;
break;
} else {
fprintf(stderr, "Input invalid. Please try again.\n");
continue;
}
}
userTime12Hour.hours = hours;
userTime12Hour.minutes = minutes;
ShortTimeStamp12HourConvertToShortTimeStamp24Hour(&userTime12Hour, &userTime24Hour);
printf("%d:%d\n", userTime24Hour.hours, userTime24Hour.minutes);
getchar();
return EXIT_SUCCESS;
}
struct ShortTimeStamp24Hour* ShortTimeStamp12HourConvertToShortTimeStamp24Hour(
const struct ShortTimeStamp12Hour* stamp,
struct ShortTimeStamp24Hour* OutResult)
{
if (!stamp || !OutResult) return NULL;
OutResult->hours =
(stamp->timePeriod == PM && stamp->hours != MIDDAY_HOUR) ? stamp->hours + MIDDAY_HOUR : stamp->hours;
OutResult->minutes = stamp->minutes;
return OutResult;
}
|
#ifndef FIXTURES_H_INCLUDED
#define FIXTURES_H_INCLUDED
#include "luapp/lua.hpp"
#include "luapp/luainc.h"
struct fxState{
lua::State gs;
};
struct fxContext: public fxState {
lua::Context context;
fxContext():
context(gs.getRawState(), lua::Context::initializeExplicitly)
{
}
};
struct fxSignal: public fxContext{
static int signal;
static int fnSignal(lua_State*)
{
signal = 1;
return 0;
}
bool isSignaled() noexcept
{
if(signal != 0) {
signal = 0;
return true;
} else
return false;
}
fxSignal()
{
lua_pushcfunction(gs.getRawState(), fnSignal);
lua_setglobal(gs.getRawState(), "fnSignal");
}
};
struct fxGlobalVal: public fxContext
{
// Creates global variable "val" and 1-element Valset
lua::Valset vs;
fxGlobalVal();
};
struct fxFiles: public fxSignal {
static size_t entryCount;
fxFiles();
~fxFiles();
};
#endif // FIXTURES_H_INCLUDED
|
/*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <DevToolsCore/PBXGroup.h>
@class PBXFileReference, PBXFileType;
@interface XCVersionGroup : PBXGroup
{
PBXFileReference *_currentVersion;
PBXFileType *_versionedFileType;
}
+ (id)archivableRelationships;
+ (id)archivableAttributes;
+ (id)versionGroupByWrappingReference:(id)arg1 usingPathExtension:(id)arg2;
+ (void)_replaceBuildFilesForReference:(id)arg1 withBuildFilesForReference:(id)arg2;
- (void)willMoveItem:(id)arg1 toGroup:(id)arg2;
- (void)didRemoveItem:(id)arg1;
- (void)didAddItem:(id)arg1;
- (void)willAddItem:(id)arg1;
- (void)awakeFromPListUnarchiver:(id)arg1;
- (BOOL)isVersionGroup;
- (BOOL)makeVersionWithName:(id)arg1;
- (BOOL)makeVersionWithName:(id)arg1 basedOnReference:(id)arg2;
- (id)versionForName:(id)arg1;
- (BOOL)ensureHasDefaultReference;
- (id)defaultReference;
- (void)setVersionGroupType:(id)arg1;
- (id)versionGroupType;
- (void)setVersionedFileType:(id)arg1;
- (id)versionedFileType;
- (id)fileType;
- (BOOL)saveCurrentVersion;
- (void)setCurrentVersion:(id)arg1;
- (id)currentVersion;
- (BOOL)allowsSubgroups;
- (void)configureFromOnDiskContents;
- (void)dealloc;
- (id)initWithName:(id)arg1 versionedFileType:(id)arg2 path:(id)arg3 sourceTree:(id)arg4;
@end
|
//
// AppDelegate.h
// black_War_Box
//
// Created by Mac_NJW on 16/11/30.
// Copyright © 2016年 Mac_NJW. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
|
#pragma once
#ifndef RESTC_CPP_BODY_H_
#define RESTC_CPP_BODY_H_
#include "restc-cpp/error.h"
#include "restc-cpp/DataWriter.h"
namespace restc_cpp {
/*! The body of the request. */
class RequestBody {
public:
enum class Type {
/// Typically a string or a file
FIXED_SIZE,
/// Use GetData() to pull for data
CHUNKED_LAZY_PULL,
/// User will push directly to the data writer
CHUNKED_LAZY_PUSH,
};
virtual ~RequestBody() = default;
virtual Type GetType() const noexcept = 0;
/*! Typically the value of the content-length header */
virtual std::uint64_t GetFixedSize() const {
throw NotImplementedException("GetFixedSize()");
}
/*! Returns true if we added data */
virtual bool GetData(write_buffers_t& buffers) {
throw NotImplementedException("GetFixedSize()");
}
virtual void PushData(DataWriter& writer) {
throw NotImplementedException("GetFixedSize()");
}
// For unit testing
virtual std::string GetCopyOfData() const {
return {};
}
/*! Set the body up for a new run.
*
* This is typically done if request fails and the client wants
* to re-try.
*/
virtual void Reset() {
;
}
/*! Create a body with a string in it */
static std::unique_ptr<RequestBody> CreateStringBody(std::string body);
/*! Create a body from a file
*
* This will effectively upload the file.
*/
static std::unique_ptr<RequestBody> CreateFileBody(
boost::filesystem::path path);
};
} // restc_cpp
#endif // RESTC_CPP_BODY_H_
|
#define sgn(x) ((x<0)?-1:((x>0)?1:0)) //Sign of number
#define M_E 2.7182818284590452354 // e
#define M_LOG2E 1.4426950408889634074 // log_2 e
#define M_LOG10E 0.43429448190325182765 // log_10 e
#define M_LN2 0.69314718055994530942 // log_e 2
#define M_LN10 2.30258509299404568402 // log_e 10
#define M_PI 3.14159265358979323846 // pi
#define M_PI_2 1.57079632679489661923 // pi/2
#define M_PI_4 0.78539816339744830962 // pi/4
#define M_1_PI 0.31830988618379067154 // 1/pi
#define M_2_PI 0.63661977236758134308 // 2/pi
#define M_2_SQRTPI 1.12837916709551257390 // 2/sqrt(pi)
#define M_SQRT2 1.41421356237309504880 // sqrt(2)
#define M_SQRT1_2 0.70710678118654752440 // 1/sqrt(2)
int abs(int x); //Absolute value
double sqrt (double x); //Square root
|
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_SHM_H_
#define _LINUX_SHM_H_
#include <linux/ipc.h>
#include <linux/errno.h>
#include <asm-generic/hugetlb_encode.h>
#include <unistd.h>
/*
* SHMMNI, SHMMAX and SHMALL are default upper limits which can be
* modified by sysctl. The SHMMAX and SHMALL values have been chosen to
* be as large possible without facilitating scenarios where userspace
* causes overflows when adjusting the limits via operations of the form
* "retrieve current limit; add X; update limit". It is therefore not
* advised to make SHMMAX and SHMALL any larger. These limits are
* suitable for both 32 and 64-bit systems.
*/
#define SHMMIN 1 /* min shared seg size (bytes) */
#define SHMMNI 4096 /* max num of segs system wide */
#define SHMMAX (ULONG_MAX - (1UL << 24)) /* max shared seg size (bytes) */
#define SHMALL (ULONG_MAX - (1UL << 24)) /* max shm system wide (pages) */
#define SHMSEG SHMMNI /* max shared segs per process */
/* Obsolete, used only for backwards compatibility and libc5 compiles */
struct shmid_ds {
struct ipc_perm shm_perm; /* operation perms */
int shm_segsz; /* size of segment (bytes) */
__kernel_old_time_t shm_atime; /* last attach time */
__kernel_old_time_t shm_dtime; /* last detach time */
__kernel_old_time_t shm_ctime; /* last change time */
__kernel_ipc_pid_t shm_cpid; /* pid of creator */
__kernel_ipc_pid_t shm_lpid; /* pid of last operator */
unsigned short shm_nattch; /* no. of current attaches */
unsigned short shm_unused; /* compatibility */
void *shm_unused2; /* ditto - used by DIPC */
void *shm_unused3; /* unused */
};
/* Include the definition of shmid64_ds and shminfo64 */
#include <asm/shmbuf.h>
/*
* shmget() shmflg values.
*/
/* The bottom nine bits are the same as open(2) mode flags */
#define SHM_R 0400 /* or S_IRUGO from <linux/stat.h> */
#define SHM_W 0200 /* or S_IWUGO from <linux/stat.h> */
/* Bits 9 & 10 are IPC_CREAT and IPC_EXCL */
#define SHM_HUGETLB 04000 /* segment will use huge TLB pages */
#define SHM_NORESERVE 010000 /* don't check for reservations */
/*
* Huge page size encoding when SHM_HUGETLB is specified, and a huge page
* size other than the default is desired. See hugetlb_encode.h
*/
#define SHM_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
#define SHM_HUGE_MASK HUGETLB_FLAG_ENCODE_MASK
#define SHM_HUGE_64KB HUGETLB_FLAG_ENCODE_64KB
#define SHM_HUGE_512KB HUGETLB_FLAG_ENCODE_512KB
#define SHM_HUGE_1MB HUGETLB_FLAG_ENCODE_1MB
#define SHM_HUGE_2MB HUGETLB_FLAG_ENCODE_2MB
#define SHM_HUGE_8MB HUGETLB_FLAG_ENCODE_8MB
#define SHM_HUGE_16MB HUGETLB_FLAG_ENCODE_16MB
#define SHM_HUGE_32MB HUGETLB_FLAG_ENCODE_32MB
#define SHM_HUGE_256MB HUGETLB_FLAG_ENCODE_256MB
#define SHM_HUGE_512MB HUGETLB_FLAG_ENCODE_512MB
#define SHM_HUGE_1GB HUGETLB_FLAG_ENCODE_1GB
#define SHM_HUGE_2GB HUGETLB_FLAG_ENCODE_2GB
#define SHM_HUGE_16GB HUGETLB_FLAG_ENCODE_16GB
/*
* shmat() shmflg values
*/
#define SHM_RDONLY 010000 /* read-only access */
#define SHM_RND 020000 /* round attach address to SHMLBA boundary */
#define SHM_REMAP 040000 /* take-over region on attach */
#define SHM_EXEC 0100000 /* execution access */
/* super user shmctl commands */
#define SHM_LOCK 11
#define SHM_UNLOCK 12
/* ipcs ctl commands */
#define SHM_STAT 13
#define SHM_INFO 14
#define SHM_STAT_ANY 15
/* Obsolete, used only for backwards compatibility */
struct shminfo {
int shmmax;
int shmmin;
int shmmni;
int shmseg;
int shmall;
};
struct shm_info {
int used_ids;
__kernel_ulong_t shm_tot; /* total allocated shm */
__kernel_ulong_t shm_rss; /* total resident shm */
__kernel_ulong_t shm_swp; /* total swapped shm */
__kernel_ulong_t swap_attempts;
__kernel_ulong_t swap_successes;
};
#endif /* _LINUX_SHM_H_ */ |
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE78_OS_Command_Injection__char_file_w32_spawnvp_66a.c
Label Definition File: CWE78_OS_Command_Injection.strings.label.xml
Template File: sources-sink-66a.tmpl.c
*/
/*
* @description
* CWE: 78 OS Command Injection
* BadSource: file Read input from a file
* GoodSource: Fixed string
* Sinks: w32_spawnvp
* BadSink : execute command with spawnvp
* Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <wchar.h>
#ifdef _WIN32
#define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe"
#define COMMAND_INT "cmd.exe"
#define COMMAND_ARG1 "/c"
#define COMMAND_ARG2 "dir"
#define COMMAND_ARG3 data
#else /* NOT _WIN32 */
#include <unistd.h>
#define COMMAND_INT_PATH "/bin/sh"
#define COMMAND_INT "sh"
#define COMMAND_ARG1 "ls"
#define COMMAND_ARG2 "-la"
#define COMMAND_ARG3 data
#endif
#ifdef _WIN32
#define FILENAME "C:\\temp\\file.txt"
#else
#define FILENAME "/tmp/file.txt"
#endif
#include <process.h>
#ifndef OMITBAD
/* bad function declaration */
void CWE78_OS_Command_Injection__char_file_w32_spawnvp_66b_badSink(char * dataArray[]);
void CWE78_OS_Command_Injection__char_file_w32_spawnvp_66_bad()
{
char * data;
char * dataArray[5];
char dataBuffer[100] = "";
data = dataBuffer;
{
/* Read input from a file */
size_t dataLen = strlen(data);
FILE * pFile;
/* if there is room in data, attempt to read the input from a file */
if (100-dataLen > 1)
{
pFile = fopen(FILENAME, "r");
if (pFile != NULL)
{
/* POTENTIAL FLAW: Read data from a file */
if (fgets(data+dataLen, (int)(100-dataLen), pFile) == NULL)
{
printLine("fgets() failed");
/* Restore NUL terminator if fgets fails */
data[dataLen] = '\0';
}
fclose(pFile);
}
}
}
/* put data in array */
dataArray[2] = data;
CWE78_OS_Command_Injection__char_file_w32_spawnvp_66b_badSink(dataArray);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE78_OS_Command_Injection__char_file_w32_spawnvp_66b_goodG2BSink(char * dataArray[]);
static void goodG2B()
{
char * data;
char * dataArray[5];
char dataBuffer[100] = "";
data = dataBuffer;
/* FIX: Append a fixed string to data (not user / external input) */
strcat(data, "*.*");
dataArray[2] = data;
CWE78_OS_Command_Injection__char_file_w32_spawnvp_66b_goodG2BSink(dataArray);
}
void CWE78_OS_Command_Injection__char_file_w32_spawnvp_66_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_file_w32_spawnvp_66_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE78_OS_Command_Injection__char_file_w32_spawnvp_66_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/******************************************************************************
* Quantitative Kit Library *
* *
* Copyright (C) 2017 Xiaojun Gao *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License. *
******************************************************************************/
#include "ux_internal.h"
#include "queue.h"
typedef struct {
ux_order_status status;
double avg_price;
double cum_qty;
double leaves_qty;
double commission;
}node_t;
typedef struct {
UT_hash_handle hh;
void* orders[2];
int instrument_id;
}order_list_t;
typedef struct ux_default_execution_simulator_s {
UX_EXECUTION_SIMULATOR_PUBLIC_FIELDS
order_list_t *list_by_instrument_id;
ux_timespan_t auction1;
ux_timespan_t auction2;
}ux_default_execution_simulator_t;
/* provider */
static int is_enable(ux_provider_t *provider)
{
}
static int get_id(ux_provider_t *provider)
{
}
const char* get_name(ux_provider_t *provider)
{
}
static ux_provider_status get_status(ux_provider_t *provider)
{
}
static void connect(ux_provider_t *provider, ux_provider_cb on_connect)
{
}
static void disconnect(ux_provider_t *provider, ux_provider_cb on_disconnect)
{
}
/* execution provider */
static void send(ux_execution_provider_t *provider, ux_event_execution_command_t command)
{
}
/* execution simulator */
static void process_orders(ux_default_execution_simulator_t *s)
{
}
static void process_bid(ux_order_t *order, ux_event_bid_t *bid)
{
}
static void on_bid(ux_execution_simulator_t* simulator, ux_event_bid_t *bid)
{
ux_default_execution_simulator_t *s = (ux_default_execution_simulator_t*)simulator;
order_list_t *list;
QUEUE *q;
int key = bid->instrument;
HASH_FIND_INT(s->list_by_instrument_id, &key, list);
if (!list)
return;
if(s->fill_flag & UX_EXECUTION_SIMULATOR_FLAG_FILL_ON_QUOTE) {
QUEUE_FOREACH(q, &list->orders) {
ux_order_t *order = QUEUE_DATA(q, ux_order_t, queue_node);
process_bid(order, bid);
}
process_orders(s);
}
}
static void on_ask(ux_execution_simulator_t* simulator, ux_event_bid_t *ask)
{
}
static void on_trade(ux_execution_simulator_t* simulator, ux_event_trade_t *trade)
{
}
static void on_level2_snapshot(ux_execution_simulator_t* simulator, ux_event_l2snapshot_t *snapshot)
{
}
static void on_level2_update(ux_execution_simulator_t* simulator, ux_event_l2update_t *update)
{
}
static void on_bar_open(ux_execution_simulator_t* simulator, ux_event_bar_t *bar)
{
}
static void on_bar(ux_execution_simulator_t* simulator, ux_event_bar_t *bar)
{
}
static void clear(void)
{
}
void ux_default_execution_simulator_init(ux_default_execution_simulator_t *simulator)
{
simulator->is_enable = is_enable;
simulator->get_id = get_id;
simulator->get_name = get_name;
simulator->get_status = get_status;
simulator->connect = connect;
simulator->disconnect = disconnect;
simulator->send = send;
simulator->on_bid = on_bid;
simulator->on_ask = on_ask;
simulator->on_trade = on_trade;
simulator->on_level2_snapshot = on_level2_snapshot;
simulator->on_level2_update = on_level2_update;
simulator->on_bar_open = on_bar_open;
simulator->on_bar = on_bar;
simulator->clear = clear;
}
|
////////////////////////////////////////////////////////////////////////////
/*
This file is a part of an interpreter for Tao, a high level
object-oriented computing and scripting language.
Copyright (C) 2004-2005, Fu Limin.
Contact: fu.limin.tao@gmail.com, limin.fu@ircc.it
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 TAO_EXTDATA_H
#define TAO_EXTDATA_H
#include "taoDatatype.h"
#include "taoPlugin.h"
class TaoClass;
class TaoModule;
class TaoRoutine;
/*
class TaoFile : public TaoBase
{
public:
string fname;
};
*/
class TaoFin : public TaoBase {
public:
TaoFin() { fin = 0; }
~TaoFin() {
if (fin)
fin->close();
}
string fname;
ifstream *fin;
static short RTTI;
virtual short rtti() const;
};
class TaoFout : public TaoBase {
public:
TaoFout() { fout = 0; }
~TaoFout() {
if (fout)
fout->close();
}
string fname;
ofstream *fout;
static short RTTI;
virtual short rtti() const;
};
//! Tao reference type for Tao object data.
class TaoDataRefer : public TaoReference {
public:
TaoDataRefer(){};
TaoDataRefer(TaoBase *p);
static short RTTI;
virtual short rttiRefer() const;
// TaoBase* duplicate();
TaoReference *newObject() { return new TaoDataRefer; }
};
//! Tao reference type for function parameters.
class TaoParamRefer : public TaoReference {
public:
TaoParamRefer(){};
TaoParamRefer(TaoBase *p);
static short RTTI;
virtual short rttiRefer() const;
// TaoBase* duplicate();
TaoReference *newObject() { return new TaoParamRefer; }
};
//! Tao reference type for global data shared in the same namespace.
class TaoShareRefer : public TaoReference {
public:
TaoShareRefer(){};
TaoShareRefer(TaoBase *p);
static short RTTI;
virtual short rttiRefer() const;
// TaoBase* duplicate();
TaoReference *newObject() { return new TaoShareRefer; }
};
class TaoConstRefer : public TaoReference {
public:
TaoConstRefer(){};
TaoConstRefer(TaoBase *p);
static short RTTI;
virtual short rttiRefer() const;
// TaoBase* duplicate();
TaoReference *newObject() { return new TaoConstRefer; }
};
class TaoAddOn : public TaoBase {
public:
TaoAddOn() {}
virtual ~TaoAddOn() {}
static short RTTI;
short rtti() const { return RTTI; }
virtual short rttiAddOn() const { return RTTI; }
virtual TaoAddOn *newObject() { return new TaoAddOn(); }
virtual TaoAddOn *newObject(TaoArray *param) { return new TaoAddOn(); }
virtual void runMethod(string funame, TaoArray *in = 0, TaoArray *out = 0) {}
};
class TaoLibrary;
class TaoCppObject : public TaoBase {
public:
TaoCppObject() { cppObject = NULL; }
~TaoCppObject() {
if (cppObject)
delete cppObject;
}
TaoLibrary *libHandler;
string typeName;
TaoPlugin *cppObject;
static short RTTI;
virtual short rtti() const { return RTTI; }
void print(ostream *out = &cout) {
if (cppObject)
cppObject->print(out);
}
TaoBase *duplicate() { return this; }
TcBase *toCppType();
void fromCppType();
};
class TaoNameSpace : public TaoBase {
public:
TaoNameSpace() {
mainModule = 0;
name = "Null";
}
string name;
static short RTTI;
virtual short rtti() const;
TaoModule *mainModule;
//! Data in the name space:
map<string, TaoReference *> nsData;
//! Data in the name space:
map<string, TaoReference *> nsDataShared;
//! Modules in the name space:
map<string, TaoModule *> nsModule;
//! Classes in the name space:
map<string, TaoClass *> nsClass;
//! AddOns in the name space:
map<string, TaoAddOn *> nsAddOn;
//! Plugins in the name space:
map<string, TaoPlugin *> nsPlugin;
//! Name spaces in the name space:
map<string, TaoNameSpace *> nameSpace;
//! C/C++ library in the name space:
map<void *, TaoLibrary *> nsLibrary;
TaoClass *findClass(string name, string ns = "");
TaoModule *findModule(string name, string ns = "");
TaoAddOn *findAddOn(string name, string ns = "");
TaoPlugin *findPlugin(string name, string ns = "");
TaoReference *findData(string name, string ns = "");
TaoReference *findDataShared(string name, string ns = "");
};
class TaoLibrary : public TaoBase {
TaoCppObject objCpp;
public:
TaoLibrary() {}
static short RTTI;
virtual short rtti() const;
TaoCppObject *findPlugin(string name);
string libName;
string libPath;
void *libHandler;
//! Plugins defined the library:
map<string, TaoPlugin *> libPlugin;
};
class TaoPluginHandler : public TaoPlugin {
public:
TaoPluginHandler(){};
virtual ~TaoPluginHandler(){};
string libName;
map<string, TaoPlugin *> myPlugins;
void run_function(string funame, TaoArray *in = 0, TaoArray *out = 0);
};
#endif
|
#include "lstrutil.h"
/**
* @brief compare MQTTLenString with NULL terminated C String
* @param lstr MQTTLenString object
* @param cstr Null terminated C String
* @return strcmp difference (0 equal, !=0 difference of first not equal char)
*/
int lstrcmpcstr(const MQTTLenString *lstr, const char *cstr) {
int i;
for (i = 0; i < lstr->len && cstr[i]; i++) {
int d = cstr[i] - lstr->data[i];
if (d != 0)
return d;
}
if (!cstr[i])
return 0;
return cstr[i] - lstr->data[i];
}
/**
*
* @brief compare tow MQTTLenString
* @param lstr1 MQTTLenString object 1
* @param lstr2 MQTTLenString object 2
* @return strcmp difference (0 equal, !=0 difference of first not equal char)
*/
int lstrcmp(const MQTTLenString *lstr1, const MQTTLenString *lstr2) {
int i;
for (i = 0; i < lstr1->len && i < lstr2->len; i++) {
int d = lstr1->len - lstr2->data[i];
if (d != 0)
return d;
}
return lstr1->len - lstr2->len;
}
/**
* @brief Convert NULL terminated C string to MQTTLenString
* @param buf MQTTLenString memory buffer to store data
* @param cstr NULL terminated C string
* @return buf pointer for convenience
*/
MQTTLenString *cstr2lstr(MQTTLenString *buf, const char *cstr) {
buf->len = strlen(cstr);
buf->data = (char*) cstr;
return buf;
}
/**
* @brief Convert MQTTLenString to NULL terminated C string
* @param buf Char buffer to store C string
* @param maxlen Maximum len of buffer (usual sizeof(buf)-1)
* @param lstr Input MQTTLenString object
* @return buf pointer for convenience
*/
const char *lstr2cstr(char *buf, int maxlen, const MQTTLenString *lstr) {
int i;
int max = maxlen - 1;
if (max > lstr->len)
max = lstr->len;
for (i = 0; i < max; i++) {
buf[i] = lstr->data[i];
}
buf[i] = '\0';
return buf;
}
/**
* @brief Iterate over MQTTLenString characters
* @param lstr MQTTLenString object
* @param cb Callback function
* @param u User data pointer
*/
void foreach_lstr(const MQTTLenString *lstr, lstr_iter_t *cb, void *u) {
int i;
for (i = 0; i < lstr->len; i++) {
cb(u, lstr->data[i]);
}
}
|
#define BACKGROUND_TINT_COLOR "#2a2a2a"
#define COLOR_STYLE SOLARIZED_DARK
#define COLOR_FOREGROUND "lightgrey"
#define COLOR_BACKGROUND "#2a2a2a"
#define BACKGROUND_SATURATION 0.05
#define BACKGROUND_TRANSPARENT TRUE
#define BELL_AUDIBLE TRUE
#define COMMAND_EXEC_PROGRAM TRUE
#define COMMAND_SHOW_HELP TRUE
#define COMMAND_SHOW_OPTIONS TRUE
#define COMMAND_SHOW_VERSION TRUE
#define CURSOR_BLINKS TRUE
#define DEFAULT_TERMINAL_SIZE 40x8
#define FONT "'Source Sans Pro' 11"
#define FONT_ENABLE_BOLD_TEXT TRUE
#define SCROLL_LINES -1
#define SCROLLBAR RIGHT
#define WINDOW_TITLE_DYNAMIC TRUE
#define WORD_CHARS "-A-Za-z0-9_$.+!*(),;:@&=?/~#%"
#define MENU TRUE
#define MATCH_STRING_EXEC_L g_getenv("BROWSER")
#define MATCH_STRING_HTTP TRUE
#define MATCH_STRING_MAIL TRUE
#define MATCH_STRING_FILE TRUE
#define MENU_CUSTOM "Copy", "Paste", "Separator", "Zoom in", "Zoom out", "Zoom default"
#define TAB TRUE
#define TAB_CLOSE_BUTTON TRUE
#define TAB_EXPANDED_WIDTH TRUE
#define TAB_LABEL "Tab #%u"
#define TAB_LABEL_DYNAMIC TRUE
#define TAB_REORDERABLE TRUE
#define TABBAR TRUE
#define TABBAR_AUTOHIDE TRUE
#define TABBAR_SCROLLABLE TRUE
#define HOTKEY TRUE
#define HOTKEY_COPY CTRL_SHIFT(GDK_C) || CTRL_SHIFT(GDK_c)
#define HOTKEY_PASTE CTRL_SHIFT(GDK_V) || CTRL_SHIFT(GDK_v)
#define HOTKEY_FONT_BIGGER CTRL(GDK_KP_Add)
#define HOTKEY_FONT_SMALLER CTRL(GDK_KP_Subtract)
#define HOTKEY_FONT_DEFAULT_SIZE CTRL(GDK_KP_0)
#define HOTKEY_OPEN_NEW_WINDOW CTRL_SHIFT(GDK_N) || CTRL_SHIFT(GDK_n)
#define HOTKEY_TAB_ADD CTRL_SHIFT(GDK_T) || CTRL_SHIFT(GDK_t)
#define HOTKEY_TAB_REMOVE CTRL_SHIFT(GDK_W) || CTRL_SHIFT(GDK_w)
#define HOTKEY_TAB_PREVIOUS CTRL_SHIFT(GDK_Left)
#define HOTKEY_TAB_NEXT CTRL_SHIFT(GDK_Right)
|
/*
* $Id$
*
* © Copyright IBM Corp. 2005, 2007
*
* THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
* CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
*
* You can obtain a current copy of the Eclipse Public License from
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* Author: Adrian Schuur <schuur@de.ibm.com>
*
* Description:
*
* CMPIPredicate implementation.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "native.h"
#include "queryOperation.h"
typedef struct native_predicate {
CMPIPredicate pred;
int mem_state;
QLOperation* op;
} NativePredicate;
static NativePredicate *__new_predicate(int mode, QLOperation* ptr, CMPIStatus * rc);
/*****************************************************************************/
static CMPIStatus __eft_release(CMPIPredicate * pred)
{
NativePredicate *p = (NativePredicate *) pred;
if (p->mem_state && p->mem_state != MEM_RELEASED) {
memUnlinkEncObj(p->mem_state);
p->mem_state = MEM_RELEASED;
free(p);
CMReturn(CMPI_RC_OK);
}
CMReturn(CMPI_RC_ERR_FAILED);
}
static CMPIPredicate *__eft_clone(const CMPIPredicate * pred, CMPIStatus * rc)
{
NativePredicate *p = (NativePredicate *) pred;
return (CMPIPredicate *) __new_predicate(MEM_NOT_TRACKED,p->op,rc);
}
static CMPIStatus __eft_getData(const CMPIPredicate* pred, CMPIType* type,
CMPIPredOp* opc, CMPIString** lhs, CMPIString** rhs)
{
NativePredicate *p = (NativePredicate *) pred;
QLOperation *op=p->op,*o;
CMPIStatus irc={CMPI_RC_OK,NULL};
if (op) {
if (op->opr==QL_bin) {
QLOpd type=QL_Invalid;
if (op->lhon) o=op->lhon;
else o=op->rhon;
if (o->lhod && o->lhod->type!=QL_PropertyName)
type=o->lhod->type;
else if (o->rhod && o->rhod->type!=QL_PropertyName)
type=o->rhod->type;
if (opc) *opc=o->opr;
if (lhs) *lhs= sfcb_native_new_CMPIString(o->lhod->ft->toString(o->lhod),NULL, 0);
if (rhs) *rhs= sfcb_native_new_CMPIString(o->rhod->ft->toString(o->rhod),NULL, 0);
}
else {
printf("--- NOT QL_bin\n");
CMSetStatusWithString(&irc,CMPI_RC_ERR_FAILED,
sfcb_native_new_CMPIString("Predicate has no a binary operator.", NULL, 0));
}
}
return irc;
}
static CMPIBoolean __eft_evaluate (const CMPIPredicate* pred,
CMPIAccessor * acc, void *v, CMPIStatus *rc)
{
if (rc) CMSetStatus(rc, CMPI_RC_ERR_NOT_SUPPORTED);
return 0;
}
static NativePredicate *__new_predicate(int mode, QLOperation *op, CMPIStatus * rc)
{
static CMPIPredicateFT eft = {
NATIVE_FT_VERSION,
__eft_release,
__eft_clone,
__eft_getData,
__eft_evaluate
};
static CMPIPredicate p = {
"CMPIPredicate",
&eft
};
int state;
NativePredicate pred,*tPred;
memset(&pred, 0, sizeof(pred));
pred.pred = p;
pred.op=op;
tPred=memAddEncObj(mode, &pred, sizeof(pred),&state);
tPred->mem_state=state;
if (rc) CMSetStatus(rc, CMPI_RC_OK);
return tPred;
}
CMPIPredicate *TrackedCMPIPredicate(QLOperation *op, CMPIStatus * rc)
{
return (CMPIPredicate*) __new_predicate(MEM_TRACKED, op, rc);
}
CMPIPredicate *NewCMPIPredicate(QLOperation *op, CMPIStatus * rc)
{
return (CMPIPredicate*) __new_predicate(MEM_NOT_TRACKED, op, rc);
}
|
/*! \file
Copyright Notice:
Copyright (C) 1990-2015, International Business Machines
Corporation and others. All rights reserved
*/
// OpenTM2ToolsLauncherDlg.h : header file
//
#pragma once
#include "TabCtrlOwn.h"
#include "DlgToolLauncher.h"
// COpenTM2ToolsLauncherDlg dialog
class COpenTM2ToolsLauncherDlg : public CDialogEx
{
// Construction
public:
COpenTM2ToolsLauncherDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
enum { IDD = IDD_OPENTM2TOOLSLAUNCHER_DIALOG };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CTabCtrlOwn m_Tab;
CDlgToolLauncher mToolLauncher;
afx_msg void OnClose();
afx_msg void OnBnClickedHelp();
afx_msg void OnBnClickedExit();
private:
void saveHistory();
};
|
/*************************************************************************
*** FORTE Library Element
***
*** This file was generated using the 4DIAC FORTE Export Filter V1.0.x!
***
*** Name: OpenSCADATestFB
*** Description: Service Interface Function Block Type
*** Version:
*** 0.0: 2013-07-06/4DIAC-IDE - 4DIAC-Consortium - null
*************************************************************************/
#ifndef _OPENSCADATESTFB_H_
#define _OPENSCADATESTFB_H_
#include "openscadafb.h"
#include <forte_int.h>
#include <forte_string.h>
#include <forte_bool.h>
class FORTE_OpenSCADATestFB: public COpenSCADAFB{
DECLARE_FIRMWARE_FB(FORTE_OpenSCADATestFB)
private:
static const CStringDictionary::TStringId scm_anDataInputNames[];
static const CStringDictionary::TStringId scm_anDataInputTypeIds[];
CIEC_BOOL &QI() {
return *static_cast<CIEC_BOOL*>(getDI(0));
};
CIEC_STRING &BaseAddress() {
return *static_cast<CIEC_STRING*>(getDI(1));
};
CIEC_BOOL &TestBool() {
return *static_cast<CIEC_BOOL*>(getDI(2));
};
CIEC_INT &TestINT() {
return *static_cast<CIEC_INT*>(getDI(3));
};
CIEC_STRING &TestString() {
return *static_cast<CIEC_STRING*>(getDI(4));
};
static const CStringDictionary::TStringId scm_anDataOutputNames[];
static const CStringDictionary::TStringId scm_anDataOutputTypeIds[];
CIEC_BOOL &QO() {
return *static_cast<CIEC_BOOL*>(getDO(0));
};
CIEC_INT &RD_INT() {
return *static_cast<CIEC_INT*>(getDO(1));
};
CIEC_BOOL &RD_DINT() {
return *static_cast<CIEC_BOOL*>(getDO(2));
};
CIEC_STRING &RD_String() {
return *static_cast<CIEC_STRING*>(getDO(3));
};
static const TEventID scm_nEventINITID = 0;
static const TEventID scm_nEventREQID = 1;
static const TForteInt16 scm_anEIWithIndexes[];
static const TDataIOID scm_anEIWith[];
static const CStringDictionary::TStringId scm_anEventInputNames[];
static const TEventID scm_nEventINITOID = 0;
static const TEventID scm_nEventCNFID = 1;
static const TEventID scm_nEventINDID = 2;
static const TForteInt16 scm_anEOWithIndexes[];
static const TDataIOID scm_anEOWith[];
static const CStringDictionary::TStringId scm_anEventOutputNames[];
static const SFBInterfaceSpec scm_stFBInterfaceSpec;
FORTE_FB_DATA_ARRAY(3, 5, 4, 0);
void executeEvent(int pa_nEIID);
public:
FORTE_OpenSCADATestFB(const CStringDictionary::TStringId pa_nInstanceNameId, CResource *pa_poSrcRes);
virtual ~FORTE_OpenSCADATestFB();
bool writeDataPointDataRecieved(struct sfp_item * pa_pstItem, struct sfp_variant *pa_pstValue);
private:
void initialize();
void updateSCADAData();
};
#endif //close the ifdef sequence from the beginning of the file
|
/*
* DO NOT EDIT THIS FILE - IT IS GENERATED BY THE DRIVER BUILD.
*
* If you need to change the driver's name spaces, look in the scons
* files for the driver's defineVmkDriver() rule.
*/
VMK_NAMESPACE_PROVIDES("com.vmware.libfc", "9.2.1.0");
#define VMKLNX_MY_NAMESPACE_VERSION "9.2.1.0"
|
/* arch/arm/mach-msm/proc_comm.c
*
* Copyright (C) 2007-2008 Google, Inc.
* Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
* Author: Brian Swetland <swetland@google.com>
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* 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.
*
*/
#include <linux/delay.h>
#include <linux/errno.h>
#include <linux/io.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#include <mach/msm_iomap.h>
#include <mach/system.h>
#include "proc_comm.h"
#include "smd_private.h"
static inline void notify_other_proc_comm(void)
{
#if defined(CONFIG_ARCH_MSM7X30)
writel_relaxed(1 << 6, MSM_GCC_BASE + 0x8);
#elif defined(CONFIG_ARCH_MSM8X60)
writel_relaxed(1 << 5, MSM_GCC_BASE + 0x8);
#else
writel_relaxed(1, MSM_CSR_BASE + 0x400 + (6) * 4);
#endif
/* Make sure the write completes before returning */
wmb();
}
#define APP_COMMAND 0x00
#define APP_STATUS 0x04
#define APP_DATA1 0x08
#define APP_DATA2 0x0C
#define MDM_COMMAND 0x10
#define MDM_STATUS 0x14
#define MDM_DATA1 0x18
#define MDM_DATA2 0x1C
static DEFINE_SPINLOCK(proc_comm_lock);
/* Poll for a state change, checking for possible
* modem crashes along the way (so we don't wait
* forever while the ARM9 is blowing up.
*
* Return an error in the event of a modem crash and
* restart so the msm_proc_comm() routine can restart
* the operation from the beginning.
*/
static int proc_comm_wait_for(unsigned addr, unsigned value)
{
while (1) {
/* Barrier here prevents excessive spinning */
mb();
if (readl_relaxed(addr) == value)
return 0;
if (smsm_check_for_modem_crash())
return -EAGAIN;
udelay(5);
}
}
void msm_proc_comm_reset_modem_now(void)
{
unsigned base = (unsigned)MSM_SHARED_RAM_BASE;
unsigned long flags;
spin_lock_irqsave(&proc_comm_lock, flags);
again:
if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY))
goto again;
writel_relaxed(PCOM_RESET_MODEM, base + APP_COMMAND);
writel_relaxed(0, base + APP_DATA1);
writel_relaxed(0, base + APP_DATA2);
spin_unlock_irqrestore(&proc_comm_lock, flags);
/* Make sure the writes complete before notifying the other side */
dsb();
notify_other_proc_comm();
return;
}
EXPORT_SYMBOL(msm_proc_comm_reset_modem_now);
int msm_proc_comm(unsigned cmd, unsigned *data1, unsigned *data2)
{
unsigned base = (unsigned)MSM_SHARED_RAM_BASE;
unsigned long flags;
static unsigned mac1=0x0;
static unsigned mac2=0x0;
int ret;
if((mac1!=0||mac2!=0)&&cmd==PCOM_CUSTOMER_CMD1)
{
*data1=mac1;
*data2=mac2;
printk("zhp Read mac from buffer!\n");
return 0;
}
spin_lock_irqsave(&proc_comm_lock, flags);
again:
if (proc_comm_wait_for(base + MDM_STATUS, PCOM_READY))
goto again;
writel_relaxed(cmd, base + APP_COMMAND);
writel_relaxed(data1 ? *data1 : 0, base + APP_DATA1);
writel_relaxed(data2 ? *data2 : 0, base + APP_DATA2);
/* Make sure the writes complete before notifying the other side */
dsb();
notify_other_proc_comm();
if (proc_comm_wait_for(base + APP_COMMAND, PCOM_CMD_DONE))
goto again;
if (readl_relaxed(base + APP_STATUS) == PCOM_CMD_SUCCESS) {
if (data1)
*data1 = readl_relaxed(base + APP_DATA1);
if (data2)
*data2 = readl_relaxed(base + APP_DATA2);
ret = 0;
} else {
ret = -EIO;
}
writel_relaxed(PCOM_CMD_IDLE, base + APP_COMMAND);
/* Make sure the writes complete before returning */
dsb();
spin_unlock_irqrestore(&proc_comm_lock, flags);
if(ret==0&&cmd==PCOM_CUSTOMER_CMD1)
{
mac1=*data1;
mac2=*data2;
printk("zhp Read mac from nv!\n");
}
return ret;
}
EXPORT_SYMBOL(msm_proc_comm);
|
#ifndef TORRENTPP_value_H
#define TORRENTPP_value_H
#include "encode.h"
#include <cstdint>
#include <map>
#include <ostream>
#include <stdexcept>
#include <string>
#include <vector>
namespace bencode {
class value {
public:
enum class type { null, integer, string, list, dict };
typedef std::int64_t int_type;
typedef std::string string_type;
typedef std::vector<value> list_type;
typedef std::map<value, value> dict_type;
value();
explicit value(std::int64_t v);
explicit value(const std::string& str);
explicit value(const list_type& list);
explicit value(const dict_type& dict);
type value_type() const { return type_; }
std::int64_t int_value() const { return int_; }
std::string string_value() const { return string_; }
list_type list_value() const { return list_; }
dict_type dict_value() const { return dict_; }
std::string encode() const;
bool operator<(const value& other) const;
bool operator==(const value& other);
std::string to_string() const;
private:
type type_;
int_type int_;
string_type string_;
list_type list_;
dict_type dict_;
};
}
#endif
|
/* Prototypes for functions defined in
C-NSF-MatchThreadBase.c
*/
extern SWAttrMapT SWAttrs[5];
extern STRPTR SWCatStr[2];
extern STRPTR SWMsgStr[3];
extern Catalog * SWCatalog;
extern Catalog * SWCatalog;
ULONG __asm SWDispatch(register __a0 Class * , register __a2 Object * , register __a1 Msg );
int __asm __saveds STI_4500_SW(register __a6 Library * );
void __saveds STD_4500_SW(void);
|
/*
* Amstrad E3 (Delta) keyboard port driver
*
* Copyright (c) 2006 Matt Callow
* Copyright (c) 2010 Janusz Krzysztofik
*
* 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.
*
* Thanks to Cliff Lawson for his help
*
* The Amstrad Delta keyboard (aka mailboard) uses normal PC-AT style serial
* transmission. The keyboard port is formed of two GPIO lines, for clock
* and data. Due to strict timing requirements of the interface,
* the serial data stream is read and processed by a FIQ handler.
* The resulting words are fetched by this driver from a circular buffer.
*
* Standard AT keyboard driver (atkbd) is used for handling the keyboard data.
* However, when used with the E3 mailboard that producecs non-standard
* scancodes, a custom key table must be prepared and loaded from userspace.
*/
#include <linux/gpio.h>
#include <linux/irq.h>
#include <linux/serio.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <asm/mach-types.h>
#include <plat/board-ams-delta.h>
#include <mach/ams-delta-fiq.h>
MODULE_AUTHOR("Matt Callow");
MODULE_DESCRIPTION("AMS Delta (E3) keyboard port driver");
MODULE_LICENSE("GPL");
static struct serio *ams_delta_serio;
static int check_data(int data)
{
int i, parity = 0;
/* check valid stop bit */
if (!(data & 0x400)) {
dev_warn(&ams_delta_serio->dev,
"invalid stop bit, data=0x%X\n",
data);
return SERIO_FRAME;
}
/* calculate the parity */
for (i = 1; i < 10; i++) {
if (data & (1 << i))
parity++;
}
/* it should be odd */
if (!(parity & 0x01)) {
dev_warn(&ams_delta_serio->dev,
"paritiy check failed, data=0x%X parity=0x%X\n",
data, parity);
return SERIO_PARITY;
}
return 0;
}
static irqreturn_t ams_delta_serio_interrupt(int irq, void *dev_id)
{
int *circ_buff = &fiq_buffer[FIQ_CIRC_BUFF];
int data, dfl;
u8 scancode;
fiq_buffer[FIQ_IRQ_PEND] = 0;
/*
* Read data from the circular buffer, check it
* and then pass it on the serio
*/
while (fiq_buffer[FIQ_KEYS_CNT] > 0) {
data = circ_buff[fiq_buffer[FIQ_HEAD_OFFSET]++];
fiq_buffer[FIQ_KEYS_CNT]--;
if (fiq_buffer[FIQ_HEAD_OFFSET] == fiq_buffer[FIQ_BUF_LEN])
fiq_buffer[FIQ_HEAD_OFFSET] = 0;
dfl = check_data(data);
scancode = (u8) (data >> 1) & 0xFF;
serio_interrupt(ams_delta_serio, scancode, dfl);
}
return IRQ_HANDLED;
}
static int ams_delta_serio_open(struct serio *serio)
{
/* enable keyboard */
gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 1);
return 0;
}
static void ams_delta_serio_close(struct serio *serio)
{
/* disable keyboard */
gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
}
static const struct gpio ams_delta_gpios[] __initconst_or_module = {
{
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
.flags = GPIOF_DIR_IN,
.label = "serio-data",
},
{
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_CLK,
.flags = GPIOF_DIR_IN,
.label = "serio-clock",
},
{
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_PWR,
.flags = GPIOF_OUT_INIT_LOW,
.label = "serio-power",
},
{
.gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATAOUT,
.flags = GPIOF_OUT_INIT_LOW,
.label = "serio-dataout",
},
};
static int __init ams_delta_serio_init(void)
{
int err;
if (!machine_is_ams_delta())
return -ENODEV;
ams_delta_serio = kzalloc(sizeof(struct serio), GFP_KERNEL);
if (!ams_delta_serio)
return -ENOMEM;
ams_delta_serio->id.type = SERIO_8042;
ams_delta_serio->open = ams_delta_serio_open;
ams_delta_serio->close = ams_delta_serio_close;
strlcpy(ams_delta_serio->name, "AMS DELTA keyboard adapter",
sizeof(ams_delta_serio->name));
strlcpy(ams_delta_serio->phys, "GPIO/serio0",
sizeof(ams_delta_serio->phys));
err = gpio_request_array(ams_delta_gpios,
ARRAY_SIZE(ams_delta_gpios));
if (err) {
pr_err("ams_delta_serio: Couldn't request gpio pins\n");
goto serio;
}
err = request_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
ams_delta_serio_interrupt, IRQ_TYPE_EDGE_RISING,
"ams-delta-serio", 0);
if (err < 0) {
pr_err("ams_delta_serio: couldn't request gpio interrupt %d\n",
gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK));
goto gpio;
}
/*
* Since GPIO register handling for keyboard clock pin is performed
* at FIQ level, switch back from edge to simple interrupt handler
* to avoid bad interaction.
*/
irq_set_handler(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK),
handle_simple_irq);
serio_register_port(ams_delta_serio);
dev_info(&ams_delta_serio->dev, "%s\n", ams_delta_serio->name);
return 0;
gpio:
gpio_free_array(ams_delta_gpios,
ARRAY_SIZE(ams_delta_gpios));
serio:
kfree(ams_delta_serio);
return err;
}
module_init(ams_delta_serio_init);
static void __exit ams_delta_serio_exit(void)
{
serio_unregister_port(ams_delta_serio);
free_irq(gpio_to_irq(AMS_DELTA_GPIO_PIN_KEYBRD_CLK), 0);
gpio_free_array(ams_delta_gpios,
ARRAY_SIZE(ams_delta_gpios));
}
module_exit(ams_delta_serio_exit);
|
/**
* @file ui_node_todo.c
* @brief A node allowing to tag a GUI with comment (only visible on debug mode).
*/
/*
Copyright (C) 2002-2011 UFO: Alien Invasion.
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 "../ui_nodes.h"
#include "../ui_parse.h"
#include "../ui_behaviour.h"
#include "../ui_draw.h"
#include "../ui_tooltip.h"
#include "../ui_render.h"
#include "ui_node_todo.h"
#include "ui_node_abstractnode.h"
#include "../../input/cl_input.h"
/**
* @brief Custom tooltip of todo node
* @param[in] node Node we request to draw tooltip
* @param[in] x Position x of the mouse
* @param[in] y Position y of the mouse
*/
static void UI_TodoNodeDrawTooltip (uiNode_t *node, int x, int y)
{
const int tooltipWidth = 250;
static char tooltiptext[1024];
const char* text = UI_GetReferenceString(node, node->text);
if (!text)
return;
tooltiptext[0] = '\0';
Q_strcat(tooltiptext, text, sizeof(tooltiptext));
UI_DrawTooltip(tooltiptext, x, y, tooltipWidth);
}
static void UI_TodoNodeDraw (uiNode_t *node)
{
static vec4_t red = {1.0, 0.0, 0.0, 1.0};
vec2_t pos;
UI_GetNodeAbsPos(node, pos);
UI_DrawFill(pos[0], pos[1], node->size[0], node->size[1], red);
if (node->state)
UI_CaptureDrawOver(node);
}
static void UI_TodoNodeDrawOverWindow (uiNode_t *node)
{
UI_TodoNodeDrawTooltip(node, mousePosX, mousePosY);
}
static void UI_TodoNodeLoading (uiNode_t *node)
{
Vector4Set(node->color, 1.0, 1.0, 1.0, 1.0);
}
static void UI_TodoNodeLoaded (uiNode_t *node)
{
#ifndef DEBUG
node->invis = qtrue;
#endif
node->size[0] = 10;
node->size[1] = 10;
}
void UI_RegisterTodoNode (uiBehaviour_t *behaviour)
{
behaviour->name = "todo";
behaviour->extends = "string";
behaviour->draw = UI_TodoNodeDraw;
behaviour->drawOverWindow = UI_TodoNodeDrawOverWindow;
behaviour->loading = UI_TodoNodeLoading;
behaviour->loaded = UI_TodoNodeLoaded;
}
|
/**
******************************************************************************
* @file TIM/TIM_ExtTriggerSynchro/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.3.1
* @date 09-October-2015
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_hal.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/********************************************************************************
** Form generated from reading UI file 'marketmapview.ui'
**
** Created by: Qt User Interface Compiler version 5.2.1
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MARKETMAPVIEW_H
#define UI_MARKETMAPVIEW_H
#include <QtCore/QVariant>
#include <QtWebKitWidgets/QWebView>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QDialog>
#include <QtWidgets/QHeaderView>
QT_BEGIN_NAMESPACE
class Ui_MarketMapView
{
public:
QWebView *MarketMapWebView;
void setupUi(QDialog *MarketMapView)
{
if (MarketMapView->objectName().isEmpty())
MarketMapView->setObjectName(QStringLiteral("MarketMapView"));
MarketMapView->resize(702, 381);
QSizePolicy sizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
sizePolicy.setHeightForWidth(MarketMapView->sizePolicy().hasHeightForWidth());
MarketMapView->setSizePolicy(sizePolicy);
QIcon icon;
icon.addFile(QStringLiteral(":/icons/img/tkrtapico.png"), QSize(), QIcon::Normal, QIcon::Off);
MarketMapView->setWindowIcon(icon);
MarketMapWebView = new QWebView(MarketMapView);
MarketMapWebView->setObjectName(QStringLiteral("MarketMapWebView"));
MarketMapWebView->setGeometry(QRect(0, -60, 621, 421));
MarketMapWebView->setUrl(QUrl(QStringLiteral("about:blank")));
MarketMapWebView->setZoomFactor(0.6);
retranslateUi(MarketMapView);
QMetaObject::connectSlotsByName(MarketMapView);
} // setupUi
void retranslateUi(QDialog *MarketMapView)
{
MarketMapView->setWindowTitle(QApplication::translate("MarketMapView", "Dialog", 0));
} // retranslateUi
};
namespace Ui {
class MarketMapView: public Ui_MarketMapView {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MARKETMAPVIEW_H
|
// Copyright 2014 Dolphin Emulator Project
// Licensed under GPLv2
// Refer to the license.txt file included.
// Razer Hydra Wiimote Translation Layer
#pragma once
#include "Core/HW/WiimoteEmu/Attachment/Classic.h"
#include "Core/HW/WiimoteEmu/WiimoteEmu.h"
namespace HydraTLayer
{
void GetButtons(int index, bool sideways, bool has_extension, wm_buttons* butt,
bool* cycle_extension);
void GetAcceleration(int index, bool sideways, bool has_extension,
WiimoteEmu::AccelData* const data);
void GetIR(int index, double* x, double* y, double* z);
void GetNunchukAcceleration(int index, WiimoteEmu::AccelData* const data);
void GetNunchuk(int index, u8* jx, u8* jy, wm_nc_core* butt);
void GetClassic(int index, wm_classic_extension* ccdata);
void GetGameCube(int index, u16* butt, u8* stick_x, u8* stick_y, u8* substick_x, u8* substick_y,
u8* ltrigger, u8* rtrigger);
extern float vr_gc_dpad_speed, vr_gc_leftstick_speed, vr_gc_rightstick_speed;
extern float vr_cc_dpad_speed, vr_wm_dpad_speed, vr_wm_leftstick_speed, vr_wm_rightstick_speed,
vr_ir_speed;
}
|
/*
* Copyright (C) 2016-2016 peak3d
* http://www.peak3d.de
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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.
*
* <http://www.gnu.org/licenses/>.
*
*/
#pragma once
#include "../common/AdaptiveTree.h"
#include <kodi/AddonBase.h>
namespace adaptive
{
class ATTRIBUTE_HIDDEN DASHTree : public AdaptiveTree
{
public:
DASHTree();
virtual bool open(const std::string& url, const std::string& manifestUpdateParam) override;
virtual bool open(const std::string& url, const std::string& manifestUpdateParam, std::map<std::string, std::string> additionalHeaders) override;
virtual bool write_data(void* buffer, size_t buffer_size, void* opaque) override;
virtual void RefreshSegments(Period* period,
AdaptationSet* adp,
Representation* rep,
StreamType type) override;
virtual uint64_t GetNowTime() { return time(0); };
virtual std::chrono::system_clock::time_point GetTimePointNowTime()
{
return std::chrono::system_clock::now();
};
virtual void SetLastUpdated(std::chrono::system_clock::time_point tm){};
void SetUpdateInterval(uint32_t interval) { updateInterval_ = interval; };
uint64_t pts_helper_, timeline_time_;
uint32_t firstStartNumber_;
std::string current_playready_wrmheader_;
std::string mpd_url_;
protected:
virtual void RefreshLiveSegments() override;
};
}
|
#define CONFIG_PARPORT_PC_SUPERIO 1
|
/*
* c_client - Linux C client to access the kernel mmap area
*
* Written in 2012 by Prashant P Shah <pshah.mumbai@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE
*/
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define DEVICE_FILE "./mmapdev" /* Update this to the mmap char device file path */
int main(void)
{
unsigned char *data, *blockdata;
unsigned long size = 1024 * 1024 * 500;
unsigned long c;
/* Open the char device */
int fd = open(DEVICE_FILE, O_RDWR);
if (fd < 0) {
printf("ERROR : Failed to open mmap char device file.\n");
printf("Create a device with $mknod ./mmapdev c <major_number> 0\n");
printf("Major number allocated to the device can be located from the kernel log using $dmesg\n");
return 1;
}
/* Allocate memory for local buffer */
blockdata = (unsigned char *)malloc(size);
if (!blockdata) {
close(fd);
printf("ERROR : Failed to allocate memory");
return 1;
}
/* Format : mmap(addr, length, prot, flags, fd, offset) */
data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
printf("mmap address : %p (%lu)\n", data, size);
/*
* Copy the device mmap memory to local buffer and check if its
* correct if all values are equal to 'A'
*/
memcpy(blockdata, data, size);
for (c = 0; c < size; c++) {
if (*(blockdata + c) != 'A')
printf("Invalid data at %lu : %d\n", c, *(blockdata + c));
}
printf("Verification completed!\n");
/* Update local buffer to 'B' */
for (c = 0; c < size; c++) {
*(blockdata + c) = 'B';
}
/* Copy local buffer to device mmap memory */
memcpy(data, blockdata, size);
printf("Copy completed!\n");
/* Unmapping the shared memory */
munmap(data, size);
free(blockdata);
close(fd);
return 0;
}
|
/***
This file belongs to the Wanda distribution.
Copyright (C) 1998-2001 Thorsten Thielen <thth@gmx.net>
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 _NLD_FACT_H_
#define _NLD_FACT_H_
#include "nldisp.h"
#include "nldisp_1.h"
class NotelistDisplayFactory
{
public:
static NotelistDisplayFactory *Instance (VOID) {
if (! pnldf) { pnldf = new NotelistDisplayFactory; }
return pnldf;
}
NotelistDisplay *New (Notelist &nl);
private:
NotelistDisplayFactory (VOID);
USHORT nldid;
PVOID pv;
static NotelistDisplayFactory *pnldf;
};
#endif
|
// This file is part of fityk program. Copyright 2001-2013 Marcin Wojdyr
// Licence: GNU General Public License ver. 2+
#ifndef FITYK_MGR_H_
#define FITYK_MGR_H_
#include <map>
#include "fityk.h"
#include "tplate.h" // Tplate::Ptr
namespace fityk {
class Variable;
class Function;
class BasicContext;
class Model;
struct FunctionSum;
/// keeps all functions and variables
class FITYK_API ModelManager
{
public:
static bool is_auto(const std::string& name)
{ return !name.empty() && name[0] == '_'; }
ModelManager(const BasicContext* ctx);
~ModelManager();
Model* create_model();
void delete_model(Model *m);
//int assign_variable(const std::string &name, const std::string &rhs);
int assign_var_copy(const std::string &name, const std::string &orig);
int make_variable(const std::string &name, VMData* vd);
void delete_variables(const std::vector<std::string> &name);
/// returns -1 if not found or idx in variables if found
int find_variable_nr(const std::string &name) const;
const Variable* find_variable(const std::string &name) const;
int gpos_to_vpos(int gpos) const;
const Variable* gpos_to_var(int gpos) const
{ return variables_[gpos_to_vpos(gpos)]; }
/// remove unreffered variables and parameters
void remove_unreferred();
/// remove unreffered functions
void auto_remove_functions();
bool is_function_referred(int n) const;
// returns the global array of parameters
const std::vector<realt>& parameters() const { return parameters_; }
const std::vector<Variable*>& variables() const { return variables_; }
const Variable* get_variable(int n) const { return variables_[n]; }
//Variable* get_variable(int n) { return variables_[n]; }
void set_domain(int n, const RealRange& domain);
/// returns index of the new function in functions_
int assign_func(const std::string &name, Tplate::Ptr tp,
std::vector<VMData*> &args);
/// returns index of the new function in functions_
int assign_func_copy(const std::string &name, const std::string &orig);
void substitute_func_param(const std::string &name,
const std::string ¶m,
VMData* vd);
void delete_funcs(const std::vector<std::string> &names);
///returns -1 if not found or idx in functions_ if found
int find_function_nr(const std::string &name) const;
const Function* find_function(const std::string &name) const;
const std::vector<Function*>& functions() const { return functions_; }
const Function* get_function(int n) const { return functions_[n]; }
/// calculate value and derivatives of all variables;
/// do precomputations for all functions
void use_parameters();
void use_external_parameters(const std::vector<realt> &ext_param);
void put_new_parameters(const std::vector<realt> &aa);
realt variation_of_a(int n, realt variat) const;
std::vector<std::string>
get_variable_references(const std::string &name) const;
void update_indices_in_models();
void do_reset();
std::vector<std::string> share_par_cmd(const std::string& par, bool share);
std::string next_var_name(); ///generate name for "anonymous" variable
std::string next_func_name(); ///generate name for "anonymous" function
private:
const BasicContext* ctx_;
std::vector<Model*> models_;
std::vector<realt> parameters_;
/// sorted, a doesn't depend on b if idx(a)>idx(b)
std::vector<Variable*> variables_;
std::vector<Function*> functions_;
int var_autoname_counter_; ///for names for "anonymous" variables
int func_autoname_counter_; ///for names for "anonymous" functions
int add_variable(Variable* new_var, bool old_domain);
void sort_variables();
int copy_and_add_variable(const std::string& name,
const Variable* orig,
const std::map<int,std::string>& varmap);
int add_func(Function* func);
//std::string get_or_make_variable(const std::string& func);
bool is_variable_referred(int i, std::string *first_referrer = NULL);
void reindex_all();
std::string name_var_copy(const Variable* v);
void update_indices(FunctionSum& sum);
void eval_tilde(std::vector<int>::iterator op,
std::vector<int>& code, const std::vector<realt>& nums);
};
// used in mgr.cpp and udf.cpp
Variable* make_compound_variable(const std::string &name, VMData* vd,
const std::vector<Variable*>& all_variables);
} // namespace fityk
#endif
|
// A simple set of realistic camera lens classes
// Nolan Goodnight <ngoodnight@cs.virginia.edu>
#ifndef _LENSDATA_H_
#define _LENSDATA_H_
#include "lensSphere.h"
#include "lensview.h"
enum mode {thick, precise};
// A simple class for the camera lens interface elements
class lensElement {
public:
lensElement(void):
isStop(true), rad(0), zpos(0), ndr(0), aper(0), isActive(false) {
edge[X] = edge[Y] = 0.0f;
}
lensElement(float _rad, float _xpos, float _ndr, float _aper) {
this->Init(_rad, _xpos, _ndr, _aper);
edge[X] = edge[Y] = 0.0f;
}
// Method to initialize a lens interface object
void Init(float _rad, float _xpos, float _ndr, float _aper)
{
this->isStop = false;
rad = _rad; zpos = _xpos;
ndr = _ndr; aper = _aper;
this->isActive = true;
if (rad == 0.0f && ndr == 0.0f)
this->isStop = true;
this->lensSph = lensSphere(_rad, -_rad, _rad, 360.0f, _aper, Point(0, 0, _xpos));
}
// Draw a single lens interfaces
void Draw(void);
bool isAir(void) { return (ndr == 1.0f)?true:false; }
bool isStop; // Flag to identify the aperture stop
lensSphere lensSph; // Sphere from which lens element was derived
float rad; // Radius for the lens interface
float zpos; // Lens interface position (1D);
float ndr; // Index of refraction
float aper; // Aperture (diameter) of the interface
bool isActive; // Flag to set interface active
float edge[2]; // Top edge point of each interface
int elemNum; // Stores position in lens system
};
// A simple class for the camera lens systems: lens interfaces
class lensSystem {
public:
lensSystem(void): f1(0), f2(0), p1(0), p2(0), fstop(1) {
this->oPlane = INFINITY; this->iPlane = f2; stopElement = 0; stopTrans = 1; this->M = precise;}
lensSystem(const char *file): f1(0), f2(0), p1(0), p2(0), fstop(1) {
this->oPlane = INFINITY; this->iPlane = f2; stopElement = 0; stopTrans = 1; this->M = precise;
this->Load(file);
}
// Method to load a lens specification file and build
// a vector of lens interfaces.
bool Load(const char *file);
// Get the number of lens interfaces
int numLenses(void) { return int(lenses.size()); }
// Draw the entire lens system (all interfaces)
void Draw(void);
// Trace a ray through the system
bool Trace(Ray &ray, Ray* res);
bool TraceF(Ray &ray, Ray* res, bool draw, int startLens = 0);
bool TraceB(Ray &ray, Ray* res, bool draw, int endLens = 0);
// Find intrinsic lens properties
void findIntrinsics();
// Trace rays to find (focal point)'
void findFp();
// Trace rays to find focal point
void findF();
// Trace rays to find (principal axis)
void findP(const Ray focalRay, const Ray r2, float* p);
// Refocus the system at a point z
void refocus(float zPos, int direction);
// Find the minimum fstop
void findMinFStop();
// Find exit pupil
void findExitPupil();
// Recalculates aperture
void recalAper();
// Calculates thick lens transformation
void thickLens(Point &e, Point* et, Reference<Matrix4x4> transform);
// Get the maximum aperture in the lens system
float maxAperture(void);
// Get the minimum aperture in the lens system
float minAperture(void);
// Get the aperture interface
lensElement *getAperture(void);
vector<lensElement> lenses; // Vector of lens elements
float f1, f2, f1T, f2T; // Focal points for the lens
float p1, p2, p1T, p2T; // Locations of principle planes
Point pupil; // Exit pupil for the lens system
float fstop; // Current fstop for the camera
float maxFS; // Maximum fstop for the camera
float minFS; // Minimum fstop for the camera
float iPlane; // Image plane
float oPlane; // Object focal plane
int curLens; // Dummy to test lens intersection
int stopElement;
int stopTrans; // Controls whether the object can move closer to the lens system
float thetaMax;
Reference<Matrix4x4> thick;
Reference<Matrix4x4> backThick;
mode M;
};
#endif
|
/*
* Module: glib_hash
* Purpose: to read the dictionary into a hash and search it
* Author: Wade Hampton
* Date: 9/30/2015
* Notes:
* 1) This uses IO channels to open and read a file into a hash.
* Multiple other GLIB functions are also used including string
* and timer functions.
*
* 2) Ref: GLIB docs
*
*/
#include <stdio.h>
#include <glib.h>
/************************************************************************/
GHashTable* ht = NULL; // test hash table
GIOChannel* ch = NULL; // file to read
const gchar* DICx="/usr/share/dict/junk";
const gchar* DICT="/usr/share/dict/words";
GError* perr = NULL;
/************************************************************************/
/** get time as a string, for NOW use NULL, user must g_free result */
gchar* get_time(GTimeVal* ptv) {
if (ptv == NULL) {
GTimeVal tv;
ptv = &tv;
g_get_current_time(ptv);
}
gchar* res = g_time_val_to_iso8601(ptv);
return(res);
}
/************************************************************************/
/** test result and print an error if one is found */
gboolean test_err(char* msg, GError* perr) {
gboolean res = FALSE;
if (perr != NULL) {
gchar* stime = get_time(NULL);
printf("%s error %s d=%d code=%d, msg=%s\n",
stime, msg,
perr->domain, perr->code, perr->message);
g_free(stime);
res = TRUE;
}
return(res);
}
/************************************************************************/
/** reset any error */
gboolean reset_err(GError** perr) {
if (perr != NULL) {
if (*perr != NULL) {
g_error_free(*perr);
*perr = NULL;
}
}
return(TRUE);
}
/************************************************************************/
gboolean find_entry(GHashTable* pht, gchar* key, gboolean verbose_in) {
gchar* str;
GTimer* tmp_timer = NULL;
if (pht == NULL) {
g_error("NULL hash table");
}
if (verbose_in) {
tmp_timer=g_timer_new();
//g_timer_start(my_timer);
}
str = g_hash_table_lookup(ht, key);
if (verbose_in) {
g_timer_stop(tmp_timer);
printf("Found key=%s with value %s in %lf\n",
key, str, g_timer_elapsed(tmp_timer, NULL));
g_timer_destroy(tmp_timer);
}
if (str != NULL) {
return(TRUE);
} else {
return(FALSE);
}
}
/************************************************************************/
/** function for use with foreach search, etc. */
gboolean srch(gpointer key, gpointer val, gpointer udata) {
gchar* str = (gchar*)udata;
gboolean res = g_str_equal(str, key);
return(res);
}
/************************************************************************/
/** foreach function, GHFunc, print result if we find match */
void fe_srch(gpointer key, gpointer val, gpointer udata) {
gboolean res = srch(key, val, udata);
if (res == TRUE) {
printf("Found key=%s\n", (char*)key);
}
}
/************************************************************************/
/** test main function */
int main(int argc, char* argv[]) {
int idx=0;
char* str = NULL;
gsize slen=0;
gboolean bres;
GIOStatus gst;
GTimer* my_timer = NULL;
gchar* key;
printf("glib_hash.c: test glib's hash and other fcns\n");
// FAIL: open the dictionary, if we fail print error
ch = g_io_channel_new_file(DICx, "r", &perr);
if (ch == NULL) {
test_err("opening DICx", perr);
reset_err(&perr);
// for test uncomment: g_error("open DICx failed");
}
// open the dictionary, if we fail print error
ch = g_io_channel_new_file(DICT, "r", &perr);
if (ch == NULL) {
test_err("opening DICT", perr);
reset_err(&perr);
g_error("open DICT failed");
}
// create a hash using strings and default string fcns
ht = g_hash_table_new(g_str_hash, g_str_equal);
// time our read of all lines and insertion into the hash
my_timer = g_timer_new();
gst = G_IO_STATUS_NORMAL;
while (TRUE) {
gst = g_io_channel_read_line(ch, &str, &slen, NULL, &perr);
if (gst != G_IO_STATUS_NORMAL) {
test_err("read line error", perr);
reset_err(&perr);
break;
}
//bres = g_hash_table_insert(ht, sx, str);
// we are using the hash table as a set
g_strchomp(str);
bres = g_hash_table_add(ht, str);
if (!bres) {
g_error("hash add failed");
}
idx++;
}
g_timer_stop(my_timer);
printf("Read %d in %lf\n", idx, g_timer_elapsed(my_timer, NULL));
// close the input channel
// deprecated: g_io_channel_close(ch);
gst = g_io_channel_shutdown(ch, TRUE, &perr);
if (gst != G_IO_STATUS_NORMAL) {
test_err("shutdown error", perr);
reset_err(&perr);
}
// look for some examples in the data
g_timer_start(my_timer);
key = g_strdup("Linux");
str = g_hash_table_lookup(ht, key);
g_timer_stop(my_timer);
printf("Found key=%s with value %s in %lf\n",
key, str, g_timer_elapsed(my_timer, NULL));
g_free(key);
find_entry(ht, "joker", TRUE);
find_entry(ht, "joke", TRUE);
find_entry(ht, "secret", TRUE);
printf("Finding string using g_hash_table_foreach()\n");
g_hash_table_foreach(ht, fe_srch, "Linux");
printf("Finding string using g_hash_table_find()\n");
str = g_hash_table_find(ht, srch, "Linux");
printf("Found %s\n", str);
return(0);
}
|
/*
* unistd.h --
*
* Macros, CONSTants and prototypes for Posix conformance.
*
* Copyright 1989 Regents of the University of California
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*
* RCS: @(#) $Id: unistd.h,v 1.1 2003/02/23 07:43:21 jasonwilkins Exp $
*/
#ifndef _UNISTD
#define _UNISTD
#include <sys/types.h>
#ifndef _TCL
# include "tcl.h"
#endif
#ifndef NULL
#define NULL 0
#endif
/*
* Strict POSIX stuff goes here. Extensions go down below, in the
* ifndef _POSIX_SOURCE section.
*/
extern void _exit _ANSI_ARGS_((int status));
extern int access _ANSI_ARGS_((CONST char *path, int mode));
extern int chdir _ANSI_ARGS_((CONST char *path));
extern int chown _ANSI_ARGS_((CONST char *path, uid_t owner, gid_t group));
extern int close _ANSI_ARGS_((int fd));
extern int dup _ANSI_ARGS_((int oldfd));
extern int dup2 _ANSI_ARGS_((int oldfd, int newfd));
extern int execl _ANSI_ARGS_((CONST char *path, ...));
extern int execle _ANSI_ARGS_((CONST char *path, ...));
extern int execlp _ANSI_ARGS_((CONST char *file, ...));
extern int execv _ANSI_ARGS_((CONST char *path, char **argv));
extern int execve _ANSI_ARGS_((CONST char *path, char **argv, char **envp));
extern int execvp _ANSI_ARGS_((CONST char *file, char **argv));
extern pid_t fork _ANSI_ARGS_((void));
extern char *getcwd _ANSI_ARGS_((char *buf, size_t size));
extern gid_t getegid _ANSI_ARGS_((void));
extern uid_t geteuid _ANSI_ARGS_((void));
extern gid_t getgid _ANSI_ARGS_((void));
extern int getgroups _ANSI_ARGS_((int bufSize, int *buffer));
extern pid_t getpid _ANSI_ARGS_((void));
extern uid_t getuid _ANSI_ARGS_((void));
extern int isatty _ANSI_ARGS_((int fd));
extern long lseek _ANSI_ARGS_((int fd, long offset, int whence));
extern int pipe _ANSI_ARGS_((int *fildes));
extern int read _ANSI_ARGS_((int fd, char *buf, size_t size));
extern int setgid _ANSI_ARGS_((gid_t group));
extern int setuid _ANSI_ARGS_((uid_t user));
extern unsigned sleep _ANSI_ARGS_ ((unsigned seconds));
extern char *ttyname _ANSI_ARGS_((int fd));
extern int unlink _ANSI_ARGS_((CONST char *path));
extern int write _ANSI_ARGS_((int fd, CONST char *buf, size_t size));
#ifndef _POSIX_SOURCE
extern char *crypt _ANSI_ARGS_((CONST char *, CONST char *));
extern int fchown _ANSI_ARGS_((int fd, uid_t owner, gid_t group));
extern int flock _ANSI_ARGS_((int fd, int operation));
extern int ftruncate _ANSI_ARGS_((int fd, unsigned long length));
extern int ioctl _ANSI_ARGS_((int fd, int request, ...));
extern int readlink _ANSI_ARGS_((CONST char *path, char *buf, int bufsize));
extern int setegid _ANSI_ARGS_((gid_t group));
extern int seteuid _ANSI_ARGS_((uid_t user));
extern int setreuid _ANSI_ARGS_((int ruid, int euid));
extern int symlink _ANSI_ARGS_((CONST char *, CONST char *));
extern int ttyslot _ANSI_ARGS_((void));
extern int truncate _ANSI_ARGS_((CONST char *path, unsigned long length));
extern int vfork _ANSI_ARGS_((void));
#endif /* _POSIX_SOURCE */
#endif /* _UNISTD */
|
int main(void) {
register int a[5] = {0};
a;
return 0;
}
|
/*************************************************************************
> File Name: server.c
> Author: GatieMe
> Mail: gatieme@163.com
> Created Time: 2016年03月28日 星期一 23时31分45秒
************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <semaphore.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define SHMSZ 27
char SEM_NAME[]= "vik";
int main()
{
char ch;
int shmid;
key_t key;
char *shm,*s;
sem_t *mutex;
//name the shared memory segment
key = 1000;
//create & initialize semaphore
mutex = sem_open(SEM_NAME, O_CREAT, 0644, 1);
if(mutex == SEM_FAILED)
{
perror("unable to create semaphore");
sem_unlink(SEM_NAME);
exit(-1);
}
//create the shared memory segment with this key
shmid = shmget(key, SHMSZ, IPC_CREAT | 0666);
if(shmid < 0)
{
perror("failure in shmget");
exit(-1);
}
//attach this segment to virtual memory
shm = shmat(shmid, NULL, 0);
//start writing into memory
s = shm;
for(ch = 'A'; ch <= 'Z'; ch++)
{
sem_wait(mutex);
*s++ = ch;
sem_post(mutex);
}
//the below loop could be replaced by binary semaphore
while(*shm != '*')
{
sleep(1);
}
sem_close(mutex);
sem_unlink(SEM_NAME);
shmctl(shmid, IPC_RMID, 0);
return EXIT_SUCCESS;
}
|
/* ########################################################################
PICsimLab - PIC laboratory simulator
########################################################################
Copyright (c) : 2010-2022 Luis Claudio Gambôa Lopes
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, 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.
For e-mail suggestions : lcgamboa@yahoo.com
######################################################################## */
#ifndef PART_GAMEPAD_H
#define PART_GAMEPAD_H
#include <lxrad.h>
#include "part.h"
#define PART_GAMEPAD_Name "Gamepad"
class cpart_gamepad : public part {
public:
lxString GetName(void) override { return lxT(PART_GAMEPAD_Name); };
lxString GetAboutInfo(void) override { return lxT("L.C. Gamboa \n <lcgamboa@yahoo.com>"); };
cpart_gamepad(unsigned x, unsigned y);
~cpart_gamepad(void);
void Draw(void) override;
void PreProcess(void) override;
void EvMouseButtonPress(uint button, uint x, uint y, uint state) override;
void EvMouseButtonRelease(uint button, uint x, uint y, uint state) override;
void EvMouseMove(uint button, uint x, uint y, uint state) override;
void EvKeyPress(uint key, uint mask) override;
void EvKeyRelease(uint key, uint mask) override;
void ConfigurePropertiesWindow(CPWindow* WProp) override;
void ReadPropertiesWindow(CPWindow* WProp) override;
lxString WritePreferences(void) override;
void ReadPreferences(lxString value) override;
unsigned short get_in_id(char* name) override;
unsigned short get_out_id(char* name) override;
private:
void RegisterRemoteControl(void) override;
unsigned char output_pins[8];
unsigned char output_value[6];
unsigned char value[2];
unsigned char active;
unsigned int jr;
lxFont font;
};
#endif /* PART_GAMEPAD_H */
|
#ifndef __WFGUI_TIME_H
#define __WFGUI_TIME_H
#include "WFGUI_Common.h"
void WFGUI_Time(void);
#endif
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport
*/
#import <OfficeImport/PDBuild.h>
__attribute__((visibility("hidden")))
@interface PDChartBuild : PDBuild {
@private
int mChartBuildType; // 12 = 0xc
}
@property(assign) int type; // G=0x21759d; S=0x2175ad; converted property
- (id)initWithBuildType:(int)buildType; // 0x2188e1
// converted property getter: - (int)type; // 0x21759d
// converted property setter: - (void)setType:(int)type; // 0x2175ad
@end
|
#include "BEN_benchmark.h"
#ifndef HEA_HEAP_H
#define HEA_HEAP_H
void HEA_sort(int vet[], int n, Benchmark b);
#endif
|
/*
* ip_vs_proto.c: transport protocol load balancing support for IPVS
*
* Version: $Id$
*
* Authors: Wensong Zhang <wensong@linuxvirtualserver.org>
* Julian Anastasov <ja@ssi.bg>
*
* 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.
*
* Changes:
*
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/skbuff.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <net/protocol.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <asm/system.h>
#include <linux/stat.h>
#include <linux/proc_fs.h>
#include <net/ip_vs.h>
/*
* IPVS protocols can only be registered/unregistered when the ipvs
* module is loaded/unloaded, so no lock is needed in accessing the
* ipvs protocol table.
*/
#define IP_VS_PROTO_TAB_SIZE 32 /* must be power of 2 */
#define IP_VS_PROTO_HASH(proto) ((proto) & (IP_VS_PROTO_TAB_SIZE-1))
static struct ip_vs_protocol *ip_vs_proto_table[IP_VS_PROTO_TAB_SIZE];
/*
* register an ipvs protocol
*/
static int register_ip_vs_protocol(struct ip_vs_protocol *pp)
{
unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
pp->next = ip_vs_proto_table[hash];
ip_vs_proto_table[hash] = pp;
if (pp->init != NULL)
pp->init(pp);
return 0;
}
/*
* unregister an ipvs protocol
*/
static int unregister_ip_vs_protocol(struct ip_vs_protocol *pp)
{
struct ip_vs_protocol **pp_p;
unsigned hash = IP_VS_PROTO_HASH(pp->protocol);
pp_p = &ip_vs_proto_table[hash];
for (; *pp_p; pp_p = &(*pp_p)->next) {
if (*pp_p == pp) {
*pp_p = pp->next;
if (pp->exit != NULL)
pp->exit(pp);
return 0;
}
}
return -ESRCH;
}
/*
* get ip_vs_protocol object by its proto.
*/
struct ip_vs_protocol * ip_vs_proto_get(unsigned short proto)
{
struct ip_vs_protocol *pp;
unsigned hash = IP_VS_PROTO_HASH(proto);
for (pp = ip_vs_proto_table[hash]; pp; pp = pp->next) {
if (pp->protocol == proto)
return pp;
}
return NULL;
}
/*
* Propagate event for state change to all protocols
*/
void ip_vs_protocol_timeout_change(int flags)
{
struct ip_vs_protocol *pp;
int i;
for (i = 0; i < IP_VS_PROTO_TAB_SIZE; i++) {
for (pp = ip_vs_proto_table[i]; pp; pp = pp->next) {
if (pp->timeout_change)
pp->timeout_change(pp, flags);
}
}
}
int *
ip_vs_create_timeout_table(int *table, int size)
{
return kmemdup(table, size, GFP_ATOMIC);
}
/*
* Set timeout value for state specified by name
*/
int
ip_vs_set_state_timeout(int *table, int num, char **names, char *name, int to)
{
int i;
if (!table || !name || !to)
return -EINVAL;
for (i = 0; i < num; i++) {
if (strcmp(names[i], name))
continue;
table[i] = to * HZ;
return 0;
}
return -ENOENT;
}
const char * ip_vs_state_name(__u16 proto, int state)
{
struct ip_vs_protocol *pp = ip_vs_proto_get(proto);
if (pp == NULL || pp->state_name == NULL)
return "ERR!";
return pp->state_name(state);
}
void
ip_vs_tcpudp_debug_packet(struct ip_vs_protocol *pp,
const struct sk_buff *skb,
int offset,
const char *msg)
{
char buf[128];
struct iphdr _iph, *ih;
ih = skb_header_pointer(skb, offset, sizeof(_iph), &_iph);
if (ih == NULL)
sprintf(buf, "%s TRUNCATED", pp->name);
else if (ih->frag_off & __constant_htons(IP_OFFSET))
sprintf(buf, "%s %u.%u.%u.%u->%u.%u.%u.%u frag",
pp->name, NIPQUAD(ih->saddr),
NIPQUAD(ih->daddr));
else {
__be16 _ports[2], *pptr
;
pptr = skb_header_pointer(skb, offset + ih->ihl*4,
sizeof(_ports), _ports);
if (pptr == NULL)
sprintf(buf, "%s TRUNCATED %u.%u.%u.%u->%u.%u.%u.%u",
pp->name,
NIPQUAD(ih->saddr),
NIPQUAD(ih->daddr));
else
sprintf(buf, "%s %u.%u.%u.%u:%u->%u.%u.%u.%u:%u",
pp->name,
NIPQUAD(ih->saddr),
ntohs(pptr[0]),
NIPQUAD(ih->daddr),
ntohs(pptr[1]));
}
printk(KERN_DEBUG "IPVS: %s: %s\n", msg, buf);
}
int ip_vs_protocol_init(void)
{
char protocols[64];
#define REGISTER_PROTOCOL(p) \
do { \
register_ip_vs_protocol(p); \
strcat(protocols, ", "); \
strcat(protocols, (p)->name); \
} while (0)
protocols[0] = '\0';
protocols[2] = '\0';
#ifdef CONFIG_IP_VS_PROTO_TCP
REGISTER_PROTOCOL(&ip_vs_protocol_tcp);
#endif
#ifdef CONFIG_IP_VS_PROTO_UDP
REGISTER_PROTOCOL(&ip_vs_protocol_udp);
#endif
#ifdef CONFIG_IP_VS_PROTO_AH
REGISTER_PROTOCOL(&ip_vs_protocol_ah);
#endif
#ifdef CONFIG_IP_VS_PROTO_ESP
REGISTER_PROTOCOL(&ip_vs_protocol_esp);
#endif
IP_VS_INFO("Registered protocols (%s)\n", &protocols[2]);
return 0;
}
void ip_vs_protocol_cleanup(void)
{
struct ip_vs_protocol *pp;
int i;
/* unregister all the ipvs protocols */
for (i = 0; i < IP_VS_PROTO_TAB_SIZE; i++) {
while ((pp = ip_vs_proto_table[i]) != NULL)
unregister_ip_vs_protocol(pp);
}
}
|
//
// TimeIndicatorView.h
// BAEN
//
// Created by loi on 1/22/15.
// Copyright (c) 2015 GWrabbit. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIColor+Colorful.h"
@interface TimeIndicatorView : UIView
- (id) init:(NSDate*)date;
-(id)initBAEN:(NSString *)ibaen;
- (void) updateSize;
- (UIBezierPath *)curvePathWithOrigin:(CGPoint)origin;
@end
|
#pragma once
#include "afxwin.h"
// CDlgConvluteW ¶Ô»°¿ò
class CDlgConvluteW : public CDialogEx
{
DECLARE_DYNAMIC(CDlgConvluteW)
public:
CDlgConvluteW(CWnd* pParent = NULL); // ±ê×¼¹¹Ô캯Êý
virtual ~CDlgConvluteW();
// ¶Ô»°¿òÊý¾Ý
enum { IDD = IDD_CONVOLUTE_W };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö
DECLARE_MESSAGE_MAP()
public:
CEdit m_EditW;
float m_fW;
CStatic m_StaticVar;
CComboBox m_EditConvKernel;
int m_nConvKernel;
virtual BOOL OnInitDialog();
afx_msg void OnCbnSelchangeComboConvKernel();
};
|
/*
* arch/arm/mach-ixdp425/ixdp425-pci.c
*
* IXDP425 PCI initialization
*
* Copyright (C) 2002 Intel Corporation.
*
* Maintainer: Deepak Saxena <dsaxena@mvista.com>
*
* 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/config.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <asm/mach/pci.h>
#include <asm/irq.h>
#include <asm/hardware.h>
#include <asm/arch/pci.h>
/* PCI controller pin mappings */
#define INTA_PIN IXP425_GPIO_PIN_11
#define INTB_PIN IXP425_GPIO_PIN_10
#define INTC_PIN IXP425_GPIO_PIN_9
#define INTD_PIN IXP425_GPIO_PIN_8
#define IXP425_PCI_RESET_GPIO IXP425_GPIO_PIN_13
#define IXP425_PCI_CLK_PIN IXP425_GPIO_CLK_0
#define IXP425_PCI_CLK_ENABLE IXP425_GPIO_CLK0_ENABLE
#define IXP425_PCI_CLK_TC_LSH IXP425_GPIO_CLK0TC_LSH
#define IXP425_PCI_CLK_DC_LSH IXP425_GPIO_CLK0DC_LSH
void __init ixdp425_pci_init(void *sysdata)
{
gpio_line_config(INTA_PIN, IXP425_GPIO_IN | IXP425_GPIO_ACTIVE_LOW);
gpio_line_config(INTB_PIN, IXP425_GPIO_IN | IXP425_GPIO_ACTIVE_LOW);
gpio_line_config(INTC_PIN, IXP425_GPIO_IN | IXP425_GPIO_ACTIVE_LOW);
gpio_line_config(INTD_PIN, IXP425_GPIO_IN | IXP425_GPIO_ACTIVE_LOW);
//super add
*IXP425_GPIO_GPOER = 0x1ee0;//set default value
*IXP425_GPIO_GPIT1R = 0x00010000;
*IXP425_GPIO_GPIT2R = 0x00003248;
//end
gpio_line_isr_clear(INTA_PIN);
gpio_line_isr_clear(INTB_PIN);
gpio_line_isr_clear(INTC_PIN);
gpio_line_isr_clear(INTD_PIN);
ixp425_pci_init(sysdata);
}
/*
* Interrupt mapping
*/
#define INTA IRQ_IXDP425_PCI_INTA
#define INTB IRQ_IXDP425_PCI_INTB
#define INTC IRQ_IXDP425_PCI_INTC
#define INTD IRQ_IXDP425_PCI_INTD
#define IXP425_PCI_MAX_DEV 4
#define IXP425_PCI_IRQ_LINES 4
static int __init ixdp425_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
{
static int pci_irq_table[IXP425_PCI_MAX_DEV][IXP425_PCI_IRQ_LINES] =
{
{INTA, INTB, INTC, INTD},
{INTB, INTC, INTD, INTA},
{INTC, INTD, INTA, INTB},
{INTD, INTA, INTB, INTC}
};
int irq = -1;
if (slot >= 1 && slot <= IXP425_PCI_MAX_DEV &&
pin >= 1 && pin <= IXP425_PCI_IRQ_LINES)
{
irq = pci_irq_table[slot-1][pin-1];
}
return irq;
}
struct hw_pci ixdp425_pci __initdata = {
init: ixdp425_pci_init,
swizzle: common_swizzle,
map_irq: ixdp425_map_irq,
};
|
/*
File: fat_common.c
Copyright (C) 1998-2009 Christophe GRENIER <grenier@cgsecurity.org>
This software 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 the Free Software Foundation, Inc., 51
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include "types.h"
#include "common.h"
#include "fat_common.h"
unsigned int fat_sector_size(const struct fat_boot_sector *fat_header)
{ return (fat_header->sector_size[1]<<8)+fat_header->sector_size[0]; }
unsigned int get_dir_entries(const struct fat_boot_sector *fat_header)
{ return (fat_header->dir_entries[1]<<8)+fat_header->dir_entries[0]; }
unsigned int fat_sectors(const struct fat_boot_sector *fat_header)
{ return (fat_header->sectors[1]<<8)+fat_header->sectors[0]; }
unsigned int fat_get_cluster_from_entry(const struct msdos_dir_entry *entry)
{
return (((unsigned long int)le16(entry->starthi))<<16) | le16(entry->start);
}
int is_fat_directory(const unsigned char *buffer)
{
return(buffer[0]=='.' &&
memcmp(buffer, ". ", 8+3)==0 &&
memcmp(&buffer[0x20], ".. ", 8+3)==0 &&
buffer[0xB]!=ATTR_EXT && (buffer[0xB]&ATTR_DIR)!=0 &&
buffer[1*0x20+0xB]!=ATTR_EXT && (buffer[1*0x20+0xB]&ATTR_DIR)!=0);
}
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://www.xbmc.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, 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 XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "BackgroundInfoLoader.h"
#include "utils/StdString.h"
class CTextureDatabase;
class CThumbLoader : public CBackgroundInfoLoader
{
public:
CThumbLoader();
virtual ~CThumbLoader();
virtual void OnLoaderStart();
virtual void OnLoaderFinish();
/*! \brief helper function to fill the art for a library item
\param item a CFileItem
\return true if we fill art, false otherwise
*/
virtual bool FillLibraryArt(CFileItem &item) { return false; }
/*! \brief Checks whether the given item has an image listed in the texture database
\param item CFileItem to check
\param type the type of image to retrieve
\return the image associated with this item
*/
virtual CStdString GetCachedImage(const CFileItem &item, const CStdString &type);
/*! \brief Associate an image with the given item in the texture database
\param item CFileItem to associate the image with
\param type the type of image
\param image the URL of the image
*/
virtual void SetCachedImage(const CFileItem &item, const CStdString &type, const CStdString &image);
protected:
CTextureDatabase *m_textureDatabase;
};
class CProgramThumbLoader : public CThumbLoader
{
public:
CProgramThumbLoader();
virtual ~CProgramThumbLoader();
virtual bool LoadItem(CFileItem* pItem);
virtual bool LoadItemCached(CFileItem* pItem);
virtual bool LoadItemLookup(CFileItem* pItem);
/*! \brief Fill the thumb of a programs item
First uses a cached thumb from a previous run, then checks for a local thumb
and caches it for the next run
\param item the CFileItem object to fill
\return true if we fill the thumb, false otherwise
\sa GetLocalThumb
*/
virtual bool FillThumb(CFileItem &item);
/*! \brief Get a local thumb for a programs item
Shortcuts are checked, then we check for a file or folder thumb
\param item the CFileItem object to check
\return the local thumb (if it exists)
\sa FillThumb
*/
static CStdString GetLocalThumb(const CFileItem &item);
};
|
#ifndef STORAGE_VOL_CONTROL_THREAD_H
#define STORAGE_VOL_CONTROL_THREAD_H
#include "virt_objects/control_thread.h"
#define BLOCK_SIZE 1024
class StorageVolControlThread : public ControlThread
{
Q_OBJECT
public:
explicit StorageVolControlThread(QObject *parent = Q_NULLPTR);
signals:
private:
QString currPoolName;
virStoragePool *currStoragePool = Q_NULLPTR;
const unsigned long long bytes = 1;
const unsigned long long KiB = 1024;
const unsigned long long MiB = 1048576;
const unsigned long long GiB = 1073741824;
const unsigned long long TiB = 1099511627776;
public slots:
void stop();
void execAction(uint, TASK);
private slots:
QString intToRangedStr(unsigned long long);
void run();
Result getAllStorageVolList();
Result createStorageVol();
Result downloadStorageVol();
Result deleteStorageVol();
Result uploadStorageVol();
Result resizeStorageVol();
Result wipeStorageVol();
Result refreshStorageVolList();
Result getStorageVolXMLDesc();
};
#endif // STORAGE_VOL_CONTROL_THREAD_H
|
/* tc-tic4x.h -- Assemble for the Texas TMS320C[34]X.
Copyright (C) 1997, 2002, 2003, 2005, 2007
Free Software Foundation. Inc.
Contributed by Michael P. Hayes (m.hayes@elec.canterbury.ac.nz)
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GAS 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 GAS; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#define TC_TIC4X
#define TIC4X
#define TARGET_ARCH bfd_arch_tic4x
#define WORKING_DOT_WORD
/* There are a number of different formats used for local labels. gas
expects local labels either of the form `10$:' or `n:', where n is
a single digit. When LOCAL_LABEL_DOLLARS is defined labels of the
form `10$:' are expected. When LOCAL_LABEL_FB is defined labels of
the form `n:' are expected. The latter are expected to be referred
to using `nf' for a forward reference of `nb' for a backward
reference.
The local labels expected by the TI tools are of the form `$n:',
where the colon is optional. Now the $ character is considered to
be valid symbol name character, so gas doesn't recognise our local
symbols by default. Defining LEX_DOLLAR to be 1 means that gas
won't allow labels starting with $ and thus the hook
tc_unrecognized_line() will be called from read.c. We can thus
parse lines starting with $n as having local labels.
The other problem is the forward reference of local labels. If a
symbol is undefined, symbol_make() calls the md_undefined_symbol()
hook where we create a local label if recognised. */
/* Don't stick labels starting with 'L' into symbol table of COFF file. */
#define LOCAL_LABEL(name) ((name)[0] == '$' || (name)[0] == 'L')
#define TARGET_BYTES_BIG_ENDIAN 0
#define OCTETS_PER_BYTE_POWER 2
#define TARGET_ARCH bfd_arch_tic4x
#define TIC_NOP_OPCODE 0x0c800000
#define reloc_type int
#define NO_RELOC 0
/* '||' denotes parallel instruction */
#define DOUBLEBAR_PARALLEL 1
/* Labels are not required to have a colon for a suffix. */
#define LABELS_WITHOUT_COLONS 1
/* Use $ as the section program counter (SPC). */
#define DOLLAR_DOT
/* Accept numbers with a suffix, e.g. 0ffffh, 1010b. */
#define NUMBERS_WITH_SUFFIX 1
extern int tic4x_unrecognized_line PARAMS ((int));
#define tc_unrecognized_line(c) tic4x_unrecognized_line (c)
#define md_number_to_chars number_to_chars_littleendian
extern int tic4x_do_align PARAMS ((int, const char *, int, int));
#define md_do_align(n,fill,len,max,label) if( tic4x_do_align (n,fill,len,max) ) goto label;
/* Start of line hook to remove parallel instruction operator || */
extern void tic4x_start_line PARAMS ((void));
#define md_start_line_hook() tic4x_start_line()
extern void tic4x_cleanup PARAMS ((void));
#define md_cleanup() tic4x_cleanup()
extern void tic4x_end PARAMS ((void));
#define md_end() tic4x_end()
|
/*
* %kadu copyright begin%
* Copyright 2015 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com)
* %kadu copyright end%
*
* 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/>.
*/
#pragma once
#include <QtCore/QObject>
#include <QtCore/QPointer>
#include <injeqt/injeqt.h>
class Status;
class QXmppPresence;
class JabberPresenceService : public QObject
{
Q_OBJECT
public:
explicit JabberPresenceService(QObject *parent = nullptr);
virtual ~JabberPresenceService();
QXmppPresence statusToPresence(const Status &status);
Status presenceToStatus(const QXmppPresence &presence);
};
|
/*****************************************************************************\
* $Id: ipmi-fru-inventory-device-cmds.c,v 1.5 2008/08/12 18:14:43 chu11 Exp $
*****************************************************************************
* Copyright (C) 2007-2008 Lawrence Livermore National Security, LLC.
* Copyright (C) 2007 The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Albert Chu <chu11@llnl.gov>
* UCRL-CODE-232183
*
* This file is part of Ipmi-fru, a tool used for retrieving
* motherboard field replaceable unit (FRU) information. For details,
* see http://www.llnl.gov/linux/.
*
* Ipmi-fru 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.
*
* Ipmi-fru 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 Ipmi-fru; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
\*****************************************************************************/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /* HAVE_CONFIG_H */
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include "freeipmi/cmds/ipmi-fru-inventory-device-cmds.h"
#include "freeipmi/spec/ipmi-cmd-spec.h"
#include "libcommon/ipmi-err-wrappers.h"
#include "libcommon/ipmi-fiid-wrappers.h"
#include "freeipmi-portability.h"
fiid_template_t tmpl_cmd_get_fru_inventory_area_info_rq =
{
{8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "fru_device_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{0, "", 0}
};
fiid_template_t tmpl_cmd_get_fru_inventory_area_info_rs =
{
{8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{16, "fru_inventory_area_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{1, "device_is_accessed", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{7, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{0, "", 0}
};
fiid_template_t tmpl_cmd_read_fru_data_rq =
{
{8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "fru_device_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{16, "fru_inventory_offset_to_read", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "count_to_read", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{0, "", 0}
};
fiid_template_t tmpl_cmd_read_fru_data_rs =
{
{8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "count_returned", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
/* 2040 = 255 * 8, 255 b/c count_returned field in request is 1 byte long */
{2040, "requested_data", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
{0, "", 0}
};
fiid_template_t tmpl_cmd_write_fru_data_rq =
{
{8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "fru_device_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{16, "fru_inventory_offset_to_write", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
/* 2040 = 255 * 8, 255 b/c bytes_to_write field in request is 1 byte long */
{2040, "data_to_write", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
{0, "", 0}
};
fiid_template_t tmpl_cmd_write_fru_data_rs =
{
{8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{8, "count_written", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
{0, "", 0}
};
int8_t
fill_cmd_get_fru_inventory_area_info (uint8_t fru_device_id,
fiid_obj_t obj_cmd_rq)
{
ERR_EINVAL (fiid_obj_valid(obj_cmd_rq));
FIID_OBJ_TEMPLATE_COMPARE(obj_cmd_rq, tmpl_cmd_get_fru_inventory_area_info_rq);
FIID_OBJ_CLEAR (obj_cmd_rq);
FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_FRU_INVENTORY_AREA_INFO);
FIID_OBJ_SET (obj_cmd_rq, "fru_device_id", fru_device_id);
return (0);
}
int8_t
fill_cmd_read_fru_data (uint8_t fru_device_id,
uint16_t fru_inventory_offset_to_read,
uint8_t count_to_read,
fiid_obj_t obj_cmd_rq)
{
ERR_EINVAL (fiid_obj_valid(obj_cmd_rq));
FIID_OBJ_TEMPLATE_COMPARE(obj_cmd_rq, tmpl_cmd_read_fru_data_rq);
FIID_OBJ_CLEAR (obj_cmd_rq);
FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_READ_FRU_DATA);
FIID_OBJ_SET (obj_cmd_rq, "fru_device_id", fru_device_id);
FIID_OBJ_SET (obj_cmd_rq, "fru_inventory_offset_to_read", fru_inventory_offset_to_read);
FIID_OBJ_SET (obj_cmd_rq, "count_to_read", count_to_read);
return (0);
}
int8_t
fill_cmd_write_fru_data (uint8_t fru_device_id,
uint16_t fru_inventory_offset_to_write,
uint8_t *data_to_write,
unsigned int data_to_write_len,
fiid_obj_t obj_cmd_rq)
{
ERR_EINVAL (!(data_to_write
&& data_to_write_len > IPMI_FRU_DATA_MAX)
&& fiid_obj_valid(obj_cmd_rq));
FIID_OBJ_TEMPLATE_COMPARE(obj_cmd_rq, tmpl_cmd_write_fru_data_rq);
FIID_OBJ_CLEAR (obj_cmd_rq);
FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_WRITE_FRU_DATA);
FIID_OBJ_SET (obj_cmd_rq, "fru_device_id", fru_device_id);
FIID_OBJ_SET (obj_cmd_rq, "fru_inventory_offset_to_write", fru_inventory_offset_to_write);
if (data_to_write && data_to_write_len)
FIID_OBJ_SET_DATA (obj_cmd_rq, "data_to_write", data_to_write, data_to_write_len);
return (0);
}
|
#pragma once
#include "cnc/cnc.h"
namespace cnc {
namespace mods {
namespace common {
#ifdef CNC_MODS_COMMON_EXPORTS
#define CNC_MODS_COMMON_API __declspec(dllexport)
#else
#define CNC_MODS_COMMON_API __declspec(dllimport)
#endif
}
}
} |
/*
* Copyright (C) 2010-2011 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
*
* A copy of the licence is included with the program, and can also be obtained from Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @file ump_osk_atomics.c
* Implementation of the OS abstraction layer for the UMP kernel device driver
*/
#include "ump_osk.h"
#include <asm/atomic.h>
int _ump_osk_atomic_dec_and_read( _mali_osk_atomic_t *atom )
{
return atomic_dec_return((atomic_t *)&atom->u.val);
}
int _ump_osk_atomic_inc_and_read( _mali_osk_atomic_t *atom )
{
return atomic_inc_return((atomic_t *)&atom->u.val);
}
|
/*
* Description:
* Helper functions to support the tegra USB controller
*
* 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.
*/
#include <linux/fsl_devices.h>
#include <linux/platform_device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <mach/usb_phy.h>
static struct tegra_usb_phy *phy;
static struct clk *udc_clk;
static struct clk *emc_clk;
static struct clk *sclk_clk;
static void *udc_base;
int fsl_udc_clk_init(struct platform_device *pdev)
{
struct resource *res;
int err;
int instance;
struct fsl_usb2_platform_data *pdata = pdev->dev.platform_data;
udc_clk = clk_get(&pdev->dev, NULL);
if (IS_ERR(udc_clk)) {
dev_err(&pdev->dev, "Can't get udc clock\n");
return PTR_ERR(udc_clk);
}
clk_enable(udc_clk);
sclk_clk = clk_get(&pdev->dev, "sclk");
if (IS_ERR(sclk_clk)) {
dev_err(&pdev->dev, "Can't get sclk clock\n");
err = PTR_ERR(sclk_clk);
goto err_sclk;
}
clk_set_rate(sclk_clk, 80000000);
clk_enable(sclk_clk);
emc_clk = clk_get(&pdev->dev, "emc");
if (IS_ERR(emc_clk)) {
dev_err(&pdev->dev, "Can't get emc clock\n");
err = PTR_ERR(emc_clk);
goto err_emc;
}
clk_enable(emc_clk);
#ifdef CONFIG_MACH_SAMSUNG_VARIATION_TEGRA
clk_set_rate(emc_clk, 150000000);
#else
clk_set_rate(emc_clk, 400000000);
#endif
/* we have to remap the registers ourselves as fsl_udc does not
* export them for us.
*/
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
err = -ENXIO;
goto err0;
}
udc_base = ioremap(res->start, resource_size(res));
if (!udc_base) {
err = -ENOMEM;
goto err0;
}
instance = pdev->id;
if (instance == -1)
instance = 0;
phy = tegra_usb_phy_open(instance, udc_base, pdata->phy_config,
TEGRA_USB_PHY_MODE_DEVICE);
if (IS_ERR(phy)) {
dev_err(&pdev->dev, "Can't open phy\n");
err = PTR_ERR(phy);
goto err1;
}
tegra_usb_phy_power_on(phy);
return 0;
err1:
iounmap(udc_base);
err0:
clk_disable(emc_clk);
clk_put(emc_clk);
err_emc:
clk_disable(sclk_clk);
clk_put(sclk_clk);
err_sclk:
clk_disable(udc_clk);
clk_put(udc_clk);
return err;
}
void fsl_udc_clk_finalize(struct platform_device *pdev)
{
}
void fsl_udc_clk_release(void)
{
tegra_usb_phy_close(phy);
iounmap(udc_base);
clk_disable(udc_clk);
clk_put(udc_clk);
clk_disable(sclk_clk);
clk_put(sclk_clk);
clk_disable(emc_clk);
clk_put(emc_clk);
}
void fsl_udc_clk_suspend(void)
{
tegra_usb_phy_power_off(phy);
clk_disable(udc_clk);
clk_disable(sclk_clk);
clk_disable(emc_clk);
}
void fsl_udc_clk_resume(void)
{
clk_enable(emc_clk);
clk_enable(sclk_clk);
clk_enable(udc_clk);
tegra_usb_phy_power_on(phy);
}
void fsl_udc_dtd_prepare(void)
{
/* When we are programming two DTDs very close to each other,
* the second DTD is being prefetched before it is actually written
* to DDR. To prevent this, we disable prefetcher before programming
* any new DTD and re-enable it before priming endpoint.
*/
tegra_usb_phy_memory_prefetch_off(phy);
}
void fsl_udc_ep_barrier(void)
{
tegra_usb_phy_memory_prefetch_on(phy);
}
|
/* $Id$ */
/*
* UNIX-Connect, a ZCONNECT(r) Transport and Gateway/Relay.
* Copyright (C) 1993-1994 Martin Husemann
* Copyright (C) 1995 Christopher Creutzig
* Copyright (C) 1999-2000 Dirk Meyer
*
* 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.
*
* ------------------------------------------------------------------------
* Eine deutsche Zusammenfassung zum Copyright dieser Programme sowie der
* GNU General Public License finden Sie in der Datei README.1st.
* ------------------------------------------------------------------------
*
* Bugreports, suggestions for improvement, patches, ports to other systems
* etc. are welcome. Contact the maintainer by e-mail:
* dirk.meyer@dinoex.sub.org or snail-mail:
* Dirk Meyer, Im Grund 4, 34317 Habichtswald
*
* There is a mailing-list for user-support:
* unix-connect-users@lists.sourceforge.net,
* write a mail with subject "Help" to
* unix-connect-users-request@lists.sourceforge.net
* for instructions on how to join this list.
*/
/********************************************************************
*
* File : header.h
* Autoren : Hacko, Martin
* Funktion: Definition aller Zugriffsfunktionen und Datentypen fuer
* Mail-Header
*/
/*
* Definition des Header-Records fuer Mail-Header
*/
typedef struct para_s {
char *text; /* Pointer auf den Inhalts-String */
char *header; /* Pointer auf den Namen dieses Headers */
unsigned int code; /* Interner Code dieses Header-Namens */
struct para_s
*other, /* Pointer auf weitere Header mit diesem code */
*next; /* Pointer auf den naechsten Header */
} header_t;
typedef header_t *header_p;
/* Fehlercodes fuer rd_para */
#define HEAD_NO_ERROR 0
#define HEAD_END_OF_FILE 1
#define HEAD_ILLEGAL_HEADER 2
extern int rd_para_error;
#define MAX_HEADER_NAME_LEN 1024
#define HD_UU_CONTROL HD_CONTROL
#define HN_UU_CONTROL HN_CONTROL
/*
* Die Funktionen:
*/
extern const char *hd_crlf;
/* Muss vom main() definiert werden, um fuer dieses */
/* Programm die Zeilenendekonvention festzulegen */
int set_rd_para_reaction (int new_reaction);
header_p uu_rd_para(FILE *);
header_p smtp_rd_para(FILE *);
header_p rd_para(FILE *);
/*
* Versionen mit CRC Behandlung: (und anderen Zeilenenden)
*/
header_p rd_packet(FILE *, crc_t *); /* CRC ist der lokal ermittelte */
void wr_packet(header_p, FILE *); /* Der CRC wird automatisch hinzugef. */
header_p rd_para_str(char *str);
char *wr_para_str(header_p ptr, char *buffer,int size);
void wr_para_continue(header_p, FILE *);
void wr_paraf(header_p ptr, FILE *fp,int laenge);
long size_para(header_p);
void do_free_para(header_p);
header_p find(unsigned int, header_p);
header_p truefind(unsigned int, header_p);
char * header_name(unsigned int);
char *headertext (header_p, unsigned int, char *);
header_p internal_add_header(const char *, unsigned int,
header_p, const char *);
header_p add_header(const char *, unsigned int, header_p);
header_p del_header(unsigned int, header_p);
header_p copy_one_header(header_p p);
header_p join_header(header_p, header_p);
header_p unify_header(header_p, header_p);
int identify(const char *);
#define wr_para(p,f) { wr_para_continue(p,f); fputs(hd_crlf, f); }
#define copy_header(p) join_header(p,NULL)
#define new_header(text, code) add_header(text, code, NULL)
#define for_header(par, code, h) for(par=find(code, h); par; par=par->other)
#define free_para(x) { do_free_para(x); (x) = NULL; }
|
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/gpio.h>
#include <mach/hardware.h>
#include <asm/mach/map.h>
#include <mach/iomux-v3.h>
static void __iomem *base;
int mxc_iomux_v3_setup_pad(struct pad_desc *pad)
{
if (pad->mux_ctrl_ofs)
__raw_writel(pad->mux_mode, base + pad->mux_ctrl_ofs);
if (pad->select_input_ofs)
__raw_writel(pad->select_input,
base + pad->select_input_ofs);
if (!(pad->pad_ctrl & NO_PAD_CTRL) && pad->pad_ctrl_ofs)
__raw_writel(pad->pad_ctrl, base + pad->pad_ctrl_ofs);
return 0;
}
EXPORT_SYMBOL(mxc_iomux_v3_setup_pad);
int mxc_iomux_v3_setup_multiple_pads(struct pad_desc *pad_list, unsigned count)
{
struct pad_desc *p = pad_list;
int i;
int ret;
for (i = 0; i < count; i++) {
ret = mxc_iomux_v3_setup_pad(p);
if (ret)
return ret;
p++;
}
return 0;
}
EXPORT_SYMBOL(mxc_iomux_v3_setup_multiple_pads);
void mxc_iomux_v3_init(void __iomem *iomux_v3_base)
{
base = iomux_v3_base;
}
|
// vim:set noet cinoptions= sw=4 ts=4:
// This file is part of the eix project and distributed under the
// terms of the GNU General Public License v2.
//
// Copyright (c)
// Wolfgang Frisch <xororand@users.sourceforge.net>
// Emil Beinroth <emilbeinroth@gmx.net>
// Martin Väth <martin@mvath.de>
#ifndef SRC_OUTPUT_FORMATSTRING_PRINT_H_
#define SRC_OUTPUT_FORMATSTRING_PRINT_H_ 1
#include <string>
class PrintFormat;
class OutputString;
void get_package_property(OutputString *s, const PrintFormat *fmt, void *entity, const std::string& name) ATTRIBUTE_NONNULL_;
void get_diff_package_property(OutputString *s, const PrintFormat *fmt, void *void_entity, const std::string& name) ATTRIBUTE_NONNULL_;
#endif // SRC_OUTPUT_FORMATSTRING_PRINT_H_
|
/*
* This source file is part of the ZipArc project source distribution and
* is Copyrighted 2000 - 2006 by Tadeusz Dracz (http://www.artpol-software.com/)
*
* This code may be used in compiled form in any way you desire PROVIDING
* it is not sold for profit as a stand-alone application.
*
* This file may be redistributed unmodified by any means providing it is
* not sold for profit without the authors written consent, and
* providing that this notice and the authors name and all copyright
* notices remains intact.
*
* This file is provided 'as is' with no expressed or implied warranty.
* The author accepts no liability if it causes any damage to your computer.
*
*****************************************************/
#if !defined(AFX_DLGOPTGEN_H__22A8EC26_C7E8_4117_BEEB_BA72770290EF__INCLUDED_)
#define AFX_DLGOPTGEN_H__22A8EC26_C7E8_4117_BEEB_BA72770290EF__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/////////////////////////////////////////////////////////////////////////////
// CDlgOptGen dialog
#include "SAPrefsSubDlg.h"
class CDlgOptGen : public CSAPrefsSubDlg
{
// Construction
public:
COptions* m_pOptions;
CDlgOptGen(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CDlgOptGen)
enum { IDD = IDD_OPTGENRAL };
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CDlgOptGen)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlgOptGen)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_DLGOPTGEN_H__22A8EC26_C7E8_4117_BEEB_BA72770290EF__INCLUDED_)
|
#ifndef __edible_h_
#define __edible_h_
#include"staticel.h"
class Edible : public StaticElement
{
public:
};
#endif
|
/* $Id: asn1-ut-string-template2.h $ */
/** @file
* IPRT - ASN.1, XXX STRING Types, Template for type specific wrappers.
*/
/*
* Copyright (C) 2006-2014 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
RTASN1STRING_IMPL(ASN1_TAG_NUMERIC_STRING, "NUMERIC STRING", RTAsn1NumericString)
RTASN1STRING_IMPL(ASN1_TAG_PRINTABLE_STRING, "PRINTABLE STRING", RTAsn1PrintableString)
RTASN1STRING_IMPL(ASN1_TAG_T61_STRING, "T61 STRING", RTAsn1T61String)
RTASN1STRING_IMPL(ASN1_TAG_VIDEOTEX_STRING, "VIDEOTEX STRING", RTAsn1VideotexString)
RTASN1STRING_IMPL(ASN1_TAG_VISIBLE_STRING, "VISIBLE STRING", RTAsn1VisibleString)
RTASN1STRING_IMPL(ASN1_TAG_IA5_STRING, "IA5 STRING", RTAsn1Ia5String)
RTASN1STRING_IMPL(ASN1_TAG_GRAPHIC_STRING, "GRAPHIC STRING", RTAsn1GraphicString)
RTASN1STRING_IMPL(ASN1_TAG_GENERAL_STRING, "GENERAL STRING", RTAsn1GeneralString)
RTASN1STRING_IMPL(ASN1_TAG_UTF8_STRING, "UTF8 STRING", RTAsn1Utf8String)
RTASN1STRING_IMPL(ASN1_TAG_BMP_STRING, "BMP STRING", RTAsn1BmpString)
RTASN1STRING_IMPL(ASN1_TAG_UNIVERSAL_STRING, "UNIVERSAL STRING", RTAsn1UniversalString)
|
/*
* Copyright (C) 2008-2018 TrinityCore <https://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 DB2Meta_h__
#define DB2Meta_h__
#include "Define.h"
struct TC_COMMON_API DB2MetaField
{
DB2MetaField(DBCFormer type, uint8 arraySize, bool isSigned);
DBCFormer Type;
uint8 ArraySize;
bool IsSigned;
};
struct TC_COMMON_API DB2Meta
{
DB2Meta(int32 indexField, uint32 fieldCount, uint32 layoutHash, DB2MetaField const* fields, int32 parentIndexField);
bool HasIndexFieldInData() const;
// Returns field index for data loaded in our structures (ID field is appended in the front if not present in db2 file data section)
uint32 GetIndexField() const;
// Returns size of final loaded structure
uint32 GetRecordSize() const;
int32 GetParentIndexFieldOffset() const;
uint32 GetDbIndexField() const;
uint32 GetDbFieldCount() const;
bool IsSignedField(uint32 field) const;
int32 IndexField;
int32 ParentIndexField;
uint32 FieldCount;
uint32 LayoutHash;
DB2MetaField const* Fields;
};
#endif // DB2Meta_h__
|
/*
\file: readdata.h
\author: Javier Zhang
\date: 2-17-2014
*/
#ifndef _READDATA_H_
#define _READDATA_H_
#include <matio.h>
#include "conf.h"
// read annotations files
bool annoRead(std::string annoName, BOWImg &dst);
// read image
int imgRead(std::vector<BOWImg> &dst);
template <class Type>
void readNumber(mat_t *matfp, char *varName, std::vector<Type> &dst);
/*
Impletation of read number from '.mat' file.
Notice: this function can only read vector or array, cannot read cell or structure.
*/
template <class Type>
void readNumber(mat_t *matfp, char *varName, std::vector<Type> &dst)
{
matvar_t *matvar = Mat_VarRead(matfp,varName);
if ( NULL == matvar ) {
std::cerr<<"Variable '"<<varName<<"' not found, or error reading MAT file\n"<<std::endl;
} else {
double* auxNumb = (double *)matvar->data;
int dim = matvar->nbytes / sizeof(double);
for (int i = 0; i < dim; i++)
{
dst.push_back((Type)auxNumb[i]);
}
Mat_VarFree(matvar);
}
}
#endif
|
/* Generated by wbuild
* (generator version 3.3)
*/
#ifndef XTCW_WHEELP_H
#define XTCW_WHEELP_H
#include <X11/CoreP.h>
#include <xtcw/Wheel.h>
_XFUNCPROTOBEGIN
typedef int (*exec_command_Proc)(
#if NeedFunctionPrototypes
Widget,int ,int
#endif
);
#define XtInherit_exec_command ((exec_command_Proc) _XtInherit)
typedef int (*sig_recv_Proc)(
#if NeedFunctionPrototypes
Widget,Widget ,int ,void *,void *
#endif
);
#define XtInherit_sig_recv ((sig_recv_Proc) _XtInherit)
typedef struct {
/* methods */
exec_command_Proc exec_command;
sig_recv_Proc sig_recv;
/* class variables */
} WheelClassPart;
typedef struct _WheelClassRec {
CoreClassPart core_class;
WheelClassPart wheel_class;
} WheelClassRec;
typedef struct {
/* resources */
XftFont * xftFont;
XtCallbackList callback;
Pixel bg_norm;
Pixel bg_sel;
Pixel bg_hi;
Pixel fg_norm;
Pixel fg_sel;
Pixel fg_hi;
int user_data;
String focus_group;
int state;
Boolean register_focus_group;
/* private state */
Pixel pixel[6];
XftColor xft_col[6];
GC gc[3];
} WheelPart;
typedef struct _WheelRec {
CorePart core;
WheelPart wheel;
} WheelRec;
externalref WheelClassRec wheelClassRec;
_XFUNCPROTOEND
#endif /* XTCW_WHEELP_H */
|
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
*
* Test that timer_gettime() sets itimerspec.it_value = 0 if
* the timer was previously disarmed because it had just expired with
* no repeating interval.
*
* For this test, signal SIGCONT will be used so that the test will
* not abort. Clock CLOCK_REALTIME will be used.
*/
#if __APPLE__
int main() { return 0; }
#else /* !__APPLE__ */
#include <time.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include "posixtest.h"
#define TIMERSEC 1
#define SLEEPDELTA 1
int main(int argc, char *argv[])
{
struct sigevent ev;
timer_t tid;
struct itimerspec itsset, itsget;
ev.sigev_notify = SIGEV_SIGNAL;
ev.sigev_signo = SIGCONT;
itsset.it_interval.tv_sec = 0;
itsset.it_interval.tv_nsec = 0;
itsset.it_value.tv_sec = TIMERSEC;
itsset.it_value.tv_nsec = 0;
if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) {
perror("timer_create() did not return success\n");
return PTS_UNRESOLVED;
}
/*
* set up timer that will expire
*/
if (timer_settime(tid, 0, &itsset, NULL) != 0) {
perror("timer_settime() did not return success\n");
return PTS_UNRESOLVED;
}
/*
* let timer expire (just call sleep())
*/
sleep(TIMERSEC+SLEEPDELTA);
if (timer_gettime(tid, &itsget) != 0) {
perror("timer_gettime() did not return success\n");
return PTS_UNRESOLVED;
}
if ( (0 == itsget.it_value.tv_sec) &&
(0 == itsget.it_value.tv_nsec) ) {
printf("Test PASSED\n");
return PTS_PASS;
} else {
printf("Test FAILED: tv_sec %d tv_nsec %d\n",
(int) itsget.it_value.tv_sec,
(int) itsget.it_value.tv_nsec);
return PTS_FAIL;
}
printf("This code should not be executed\n");
return PTS_UNRESOLVED;
}
#endif /* !__APPLE__ */
|
/*
Copyright 2012 Guillem Vinals Gangolells <guillem@guillem.co.uk>
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 "debug.h"
#include "BTApp.h"
/*
* BT APP definitions
*/
#if DEBUG_APP
#undef DBG_CLASS
#define DBG_CLASS DBG_CLASS_APP
#endif
/*
* Bluetooth application private function prototypes
*/
//bool BTAPP_API_putRFCOMMData(const BYTE *pData, UINT uLen);
//bool BTAPP_API_confComplete();
/*
* Bluetooth application implementation
*/
bool BTAPP_Initialise(BT_DEVICE **ppsBTDevice)
{
BT_DEVICE *psBTDev = NULL;
ASSERT(NULL != ppsBTDevice);
*ppsBTDevice = (BT_DEVICE *) BT_malloc(sizeof(BT_DEVICE));
psBTDev = *ppsBTDevice;
ASSERT(NULL != psBTDev);
/* Initialise all the BT stack layers */
// HCIUSB_create();
HCI_create();
L2CAP_create();
SDP_create();
RFCOMM_create();
DBG_INFO("Bluetooth stack initialized\n\r");
return true;
}
bool BTAPP_Start(BT_DEVICE *psBTDevice)
{
HCIUSB_API sPHY;
HCI_API sHCI;
L2CAP_API sL2CAP;
DEVICE_API sAPI;
RFCOMM_API sRFCOMM;
ASSERT(NULL != psBTDevice);
/* Get all the APIs needed */
// HCIUSB_getAPI(&sPHY); FIXME
HCI_getAPI(&sHCI);
L2CAP_getAPI(&sL2CAP);
RFCOMM_getAPI(&sRFCOMM);
/*
// Initialise the USB Device API directly related with the physical bus
psBTDevice->sUSB.getACLBuff = sPHY.getACLBuff;
psBTDevice->sUSB.getEVTBuff = sPHY.getEVTBuff;
psBTDevice->sUSB.writeACL = sPHY.USBwriteACL;
psBTDevice->sUSB.writeCTL = sPHY.USBwriteCTL;
// Initialise the last part of the USB Device API
psBTDevice->sUSB.readACL = sHCI.putData;
psBTDevice->sUSB.readEVT = sHCI.putEvent;
// L2CAP API
psBTDevice->L2CAPdisconnect = sL2CAP.disconnect;
// RFCOMM API
psBTDevice->SPPsendData = sRFCOMM.sendData;
psBTDevice->SPPdisconnect = sRFCOMM.disconnect;
*/
/* Install the Device call-backs in the RFCOMM and HCI layer */
sAPI.putRFCOMMData = &BTAPP_API_putRFCOMMData;
sAPI.confComplete = &BTAPP_API_confComplete;
RFCOMM_installDevCB(&sAPI);
HCI_installDevCB(&sAPI);
/* Issue the RESET command (which will trigger the HCI configuration) */
//sHCI.setLocalName("PIC_BT", 6);
sHCI.setPINCode("1234", 4);
sHCI.cmdReset();
return true;
}
bool BTAPP_Deinitialise()
{
// HCIUSB_destroy();
HCI_destroy();
L2CAP_destroy();
SDP_destroy();
RFCOMM_destroy();
return true;
}
/*
* Device call-back functions to be installed to the BT Stack
*/
/* Called by the RFCOMM after the reception of data from the remote Device */
bool BTAPP_API_putRFCOMMData(const BYTE *pData, UINT uLen){
int i = 0;
for (i = 0; i < uLen; ++i){
SIOPutChar(pData[i]);
}
SIOPutChar('\n');
RFCOMM_API_sendData("ACK ", 4);
return true;
}
/* Called by the HCI after completing the configuration of the local Device */
bool BTAPP_API_confComplete()
{
SIOPrintString("BTAPP: HCI Configured\n");
return true;
}
void SIOPutChar(BYTE pData){
}
|
/*
* Copyright (c) 2011 Mark Liversedge (liversedge@gmail.com)
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _BatchExportDialog_h
#define _BatchExportDialog_h
#include "GoldenCheetah.h"
#include "Context.h"
#include "Settings.h"
#include "Units.h"
#include "RideItem.h"
#include "RideFile.h"
#include <QtGui>
#include <QTableWidget>
#include <QProgressBar>
#include <QList>
#include <QFileDialog>
#include <QCheckBox>
#include <QLabel>
#include <QListIterator>
#include <QDebug>
// Dialog class to show filenames, import progress and to capture user input
// of ride date and time
class BatchExportDialog : public QDialog
{
Q_OBJECT
G_OBJECT
public:
BatchExportDialog(Context *context);
QTreeWidget *files; // choose files to export
signals:
private slots:
void cancelClicked();
void okClicked();
void selectClicked();
void exportFiles();
void allClicked();
private:
Context *context;
bool aborted;
QCheckBox *all;
QComboBox *format;
QLabel *formatLabel;
QPushButton *selectDir;
QLabel *dirLabel, *dirName;
QCheckBox *overwrite;
QPushButton *cancel, *ok;
int exports, fails;
QLabel *status;
};
#endif // _BatchExportDialog_h
|
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpdata.h
* Copyright (C) 2001 Michael Natterer <mitch@gimp.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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_DATA_H__
#define __GIMP_DATA_H__
#include <time.h> /* time_t */
#include "gimpviewable.h"
typedef enum
{
GIMP_DATA_ERROR_OPEN, /* opening data file failed */
GIMP_DATA_ERROR_READ, /* reading data file failed */
GIMP_DATA_ERROR_WRITE, /* writing data file failed */
GIMP_DATA_ERROR_DELETE /* deleting data file failed */
} GimpDataError;
#define GIMP_TYPE_DATA (gimp_data_get_type ())
#define GIMP_DATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DATA, GimpData))
#define GIMP_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DATA, GimpDataClass))
#define GIMP_IS_DATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DATA))
#define GIMP_IS_DATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DATA))
#define GIMP_DATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_DATA, GimpDataClass))
typedef struct _GimpDataClass GimpDataClass;
struct _GimpData
{
GimpViewable parent_instance;
gchar *filename;
GQuark mime_type;
guint writable : 1;
guint deletable : 1;
guint dirty : 1;
guint internal : 1;
gint freeze_count;
time_t mtime;
GList *tags;
};
struct _GimpDataClass
{
GimpViewableClass parent_class;
/* signals */
void (* dirty) (GimpData *data);
/* virtual functions */
gboolean (* save) (GimpData *data,
GError **error);
const gchar * (* get_extension) (GimpData *data);
GimpData * (* duplicate) (GimpData *data);
};
GType gimp_data_get_type (void) G_GNUC_CONST;
gboolean gimp_data_save (GimpData *data,
GError **error);
void gimp_data_dirty (GimpData *data);
void gimp_data_freeze (GimpData *data);
void gimp_data_thaw (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data,
GError **error);
const gchar * gimp_data_get_extension (GimpData *data);
void gimp_data_set_filename (GimpData *data,
const gchar *filename,
gboolean writable,
gboolean deletable);
void gimp_data_create_filename (GimpData *data,
const gchar *dest_dir);
const gchar * gimp_data_get_mime_type (GimpData *data);
GimpData * gimp_data_duplicate (GimpData *data);
void gimp_data_make_internal (GimpData *data);
gint gimp_data_compare (GimpData *data1,
GimpData *data2);
gint gimp_data_name_compare (GimpData *data1,
GimpData *data2);
#define GIMP_DATA_ERROR (gimp_data_error_quark ())
GQuark gimp_data_error_quark (void) G_GNUC_CONST;
#endif /* __GIMP_DATA_H__ */
|
/*
* Generated by asn1c-0.9.22.1409 (http://lionet.info/asn1c)
* From ASN.1 module "MCS-PROTOCOL-3"
* found in "mcs.asn1"
* `asn1c -fnative-types -fskeletons-copy -fcompound-names -gen-PER`
*/
#ifndef _ChannelExpelIndication_H_
#define _ChannelExpelIndication_H_
#include <asn_application.h>
/* Including external dependencies */
#include "PrivateChannelId.h"
#include "UserId.h"
#include <asn_SET_OF.h>
#include <constr_SET_OF.h>
#include <asn_SEQUENCE_OF.h>
#include <constr_SEQUENCE_OF.h>
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct NonStandardParameter;
/* ChannelExpelIndication */
typedef struct ChannelExpelIndication {
PrivateChannelId_t channelId;
struct ChannelExpelIndication__userIds {
A_SET_OF(UserId_t) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} userIds;
struct ChannelExpelIndication__nonStandard {
A_SEQUENCE_OF(struct NonStandardParameter) list;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} *nonStandard;
/*
* This type is extensible,
* possible extensions are below.
*/
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} ChannelExpelIndication_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_ChannelExpelIndication;
#ifdef __cplusplus
}
#endif
/* Referred external types */
#include "NonStandardParameter.h"
#endif /* _ChannelExpelIndication_H_ */
|
/*
* Copyright (c) 2002, Intel Corporation. All rights reserved.
* Created by: bing.wei.liu REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
* Test pthread_mutexattr_settype()
*
* It shall fail if:
* [EINVAL] - The value 'type' is invalid.
* It may fail if:
* [EINVAL] - The value specified by 'attr' is invalid.
*
* Steps:
* 1. Initialize a pthread_mutexattr_t object.
* 2. Pass to pthread_mutexattr_settype an invalid type. It shall fail.
*
*/
#define _XOPEN_SOURCE 600
#include <pthread.h>
#include <stdio.h>
#include <errno.h>
#include "posixtest.h"
int main()
{
pthread_mutexattr_t mta;
int ret;
int invalid_type = -1;
/* Initialize a mutex attributes object */
if (pthread_mutexattr_init(&mta) != 0)
{
perror("Error at pthread_mutexattr_init()\n");
return PTS_UNRESOLVED;
}
while (invalid_type == PTHREAD_MUTEX_NORMAL ||
invalid_type == PTHREAD_MUTEX_ERRORCHECK ||
invalid_type == PTHREAD_MUTEX_RECURSIVE ||
invalid_type == PTHREAD_MUTEX_DEFAULT)
{
invalid_type --;
}
/* Set the 'type' attribute to be a negative number. */
ret=pthread_mutexattr_settype(&mta, invalid_type);
if (ret != EINVAL)
{
printf("Test FAILED: Expected return code of EINVAL, got: %d\n", ret);
return PTS_FAIL;
}
printf("Test PASSED\n");
return PTS_PASS;
} |
/*
* SplitFunctionML.h
*
* Author: Samuel Schulter, Paul Wohlhart, Christian Leistner, Amir Saffari, Peter M. Roth, Horst Bischof
* Institution: Graz, University of Technology, Austria
*/
#ifndef SPLITFUNCTIONML_H_
#define SPLITFUNCTIONML_H_
#include <eigen3/Eigen/Core>
#include <eigen3/Eigen/LU>
#include <vector>
#include <math.h>
#include "AppContextML.h"
#include "LabelMLClass.h"
#include "SampleML.h"
#include "icgrf.h"
using namespace std;
using namespace Eigen;
class SplitFunctionML
{
public:
// Constructors & destructors
explicit SplitFunctionML(AppContextML* appcontextin);
virtual ~SplitFunctionML();
void SetRandomValues();
void SetThreshold(double inth);
void SetSplit(SplitFunctionML* spfin);
int Split(SampleML& sample) const;
double CalculateResponse(SampleML& sample) const;
// I/O method
void Save(std::ofstream& out);
void Load(std::ifstream& in);
vector<int> m_feature_indices;
vector<double> m_feature_weights;
double m_th;
protected:
// members
AppContextML* m_appcontext;
};
#endif /* SPLITFUNCTIONML_H_ */
|
SEXP R_unary(SEXP, SEXP, SEXP);
SEXP rcc_R_binary(SEXP call, SEXP op, SEXP x, SEXP y);
SEXP rcc_do_arith(SEXP call, SEXP op, SEXP args, SEXP env);
SEXP rcc_VectorAssign(SEXP call, SEXP x, SEXP s, SEXP y);
SEXP rcc_MatrixAssign(SEXP call, SEXP x, SEXP s, SEXP y);
SEXP rcc_ArrayAssign(SEXP call, SEXP x, SEXP s, SEXP y);
int SubassignTypeFix(SEXP *x, SEXP *y, int stretch, int level, SEXP call);
SEXP EnlargeVector(SEXP x, R_len_t newlen);
SEXP DeleteListElements(SEXP x, SEXP which);
SEXP do_transpose_osr(SEXP call, SEXP op, SEXP args, SEXP rho);
SEXP applyClosureNoMatching(SEXP call, SEXP op, SEXP arglist, SEXP rho, SEXP suppliedenv);
|
#include <stdio.h>
#include <string.h>
#include <signal.h>
#ifndef WIN32
#include <sys/signal.h>
#include <unistd.h>
#endif
#include <math.h>
#ifdef _WIN32
# undef WIN32
# define WIN32
# define M_PI 3.14159265358979323846
# define M_SQRT2 1.41421356237309504880
# define REAL_IS_FLOAT
# define NEW_DCT9
# define random rand
# define srandom srand
// Heffo
#pragma warning(disable : 4244)
#pragma warning(disable : 4018)
#endif
#ifdef REAL_IS_FLOAT
# define real float
#elif defined(REAL_IS_LONG_DOUBLE)
# define real long double
#else
# define real double
#endif
#ifdef __GNUC__
#define INLINE inline
#else
#define INLINE
#endif
/* AUDIOBUFSIZE = n*64 with n=1,2,3 ... */
#define AUDIOBUFSIZE 16384
#define FALSE 0
#define TRUE 1
#define SBLIMIT 32
#define SSLIMIT 18
#define MPG_MD_STEREO 0
#define MPG_MD_JOINT_STEREO 1
#define MPG_MD_DUAL_CHANNEL 2
#define MPG_MD_MONO 3
#define MAXFRAMESIZE 1792
/* Pre Shift fo 16 to 8 bit converter table */
#define AUSHIFT (3)
struct frame {
int stereo;
int jsbound;
int single;
int lsf;
int mpeg25;
int header_change;
int lay;
int error_protection;
int bitrate_index;
int sampling_frequency;
int padding;
int extension;
int mode;
int mode_ext;
int copyright;
int original;
int emphasis;
int framesize; /* computed framesize */
};
struct parameter {
int quiet; /* shut up! */
int tryresync; /* resync stream after error */
int verbose; /* verbose level */
int checkrange;
};
extern unsigned int get1bit(void);
extern unsigned int getbits(int);
extern unsigned int getbits_fast(int);
extern int set_pointer(long);
extern unsigned char *wordpointer;
extern int bitindex;
extern void make_decode_tables(long scaleval);
extern int do_layer3(struct frame *fr,unsigned char *,int *);
extern int decode_header(struct frame *fr,unsigned long newhead);
struct gr_info_s {
int scfsi;
unsigned part2_3_length;
unsigned big_values;
unsigned scalefac_compress;
unsigned block_type;
unsigned mixed_block_flag;
unsigned table_select[3];
unsigned subblock_gain[3];
unsigned maxband[3];
unsigned maxbandl;
unsigned maxb;
unsigned region1start;
unsigned region2start;
unsigned preflag;
unsigned scalefac_scale;
unsigned count1table_select;
real *full_gain[3];
real *pow2gain;
};
struct III_sideinfo
{
unsigned main_data_begin;
unsigned private_bits;
struct {
struct gr_info_s gr[2];
} ch[2];
};
extern int synth_1to1 (real *,int,unsigned char *,int *);
extern int synth_1to1_8bit (real *,int,unsigned char *,int *);
extern int synth_1to1_mono (real *,unsigned char *,int *);
extern int synth_1to1_mono2stereo (real *,unsigned char *,int *);
extern int synth_1to1_8bit_mono (real *,unsigned char *,int *);
extern int synth_1to1_8bit_mono2stereo (real *,unsigned char *,int *);
extern int synth_2to1 (real *,int,unsigned char *,int *);
extern int synth_2to1_8bit (real *,int,unsigned char *,int *);
extern int synth_2to1_mono (real *,unsigned char *,int *);
extern int synth_2to1_mono2stereo (real *,unsigned char *,int *);
extern int synth_2to1_8bit_mono (real *,unsigned char *,int *);
extern int synth_2to1_8bit_mono2stereo (real *,unsigned char *,int *);
extern int synth_4to1 (real *,int,unsigned char *,int *);
extern int synth_4to1_8bit (real *,int,unsigned char *,int *);
extern int synth_4to1_mono (real *,unsigned char *,int *);
extern int synth_4to1_mono2stereo (real *,unsigned char *,int *);
extern int synth_4to1_8bit_mono (real *,unsigned char *,int *);
extern int synth_4to1_8bit_mono2stereo (real *,unsigned char *,int *);
extern int synth_ntom (real *,int,unsigned char *,int *);
extern int synth_ntom_8bit (real *,int,unsigned char *,int *);
extern int synth_ntom_mono (real *,unsigned char *,int *);
extern int synth_ntom_mono2stereo (real *,unsigned char *,int *);
extern int synth_ntom_8bit_mono (real *,unsigned char *,int *);
extern int synth_ntom_8bit_mono2stereo (real *,unsigned char *,int *);
extern void rewindNbits(int bits);
extern int hsstell(void);
extern int get_songlen(struct frame *fr,int no);
extern void init_layer3(int);
extern void init_layer2(void);
extern void make_decode_tables(long scale);
extern void make_conv16to8_table(int);
extern void dct64(real *,real *,real *);
extern void synth_ntom_set_step(long,long);
extern unsigned char *conv16to8;
extern long freqs[9];
extern real muls[27][64];
extern real decwin[512+32];
extern real *pnts[5];
extern struct parameter param;
|
/* 2 for loops in one?
* We're used to the single index forloop, but actually
* it can cope with more. Let's have a look ... */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
int i, j;
for(i=0,j=0;((i<4)&(j<4));++i,j+=2)
printf("%d ", 2*i+j);
printf("\n");
return 0;
}
|
/******************************************
** Realized by
** GeoKronos
** geokronos.homelinux.org
** geokronos@yahoo.com
** and
** Clepto
** cleptoiii@yahoo.it
** License: GPL
*******************************************/
#ifndef TAB_CHAT_H
#define TAB_CHAT_H
#include <QWidget>
#include <QMessageBox>
#include <QTextBrowser>
#include <QFont>
#include <QLineEdit>
#include <QGridLayout>
#include <QListWidget>
#include <QMenu>
#include <QPushButton>
#include <QList>
#include <QKeyEvent>
#include <QUrl>
#include <QProcess>
#include <iostream>
#include "irc_engine.h"
#include "xml_config.h"
#include "edit_message.h"
#include "list_user.h"
using namespace std;
class tab_chat : public QWidget
{
Q_OBJECT
private:
QString name;
irc_engine* chat;
QGridLayout *grid;
QTextBrowser *txt;
// QListWidget *lst;
list_user *lst;
edit_message *edt_cmd;
QLineEdit *edt_topic;
xml_config *config;
QWidget *prn;
QString mode;
QGridLayout *grid_topic;
QPushButton *btn_t,*btn_n,*btn_s,*btn_i,*btn_p,*btn_m,*btn_k,*btn_l;
void create_mode_buttons();
void set_mode_buttons_disabled(bool);
void set_topic_disabled(bool);
QStringList voice,op,halfop;
QPushButton *send_btn;
QGridLayout *grid_msg;
public:
bool ischan;
tab_chat(QString,irc_engine*,bool,xml_config*,QWidget*);
QString get_name();
public slots:
void send(); //Spedisce il messaggio al server
void append(QString);
void add_user(QString);
void add_users(QString chan,QStringList users);
void del_user(QString,QString);
void del_user(QString);
void change_nick(QString,QString);
void msg_from_chan(QString,QString);
void close_chan();
void open_query(QListWidgetItem*);
void set_topic(QString,QString);
void anchor(QUrl);
void mode_user(QString,QString,QString,QString);
void mode_chan(QString,QString,QString);
void kick(QString,QString,QString,QString);
//Operazioni dei pulsanti
void set_t();
void set_n();
void set_s();
void set_i();
void set_p();
void set_m();
void set_k();
void set_l();
//cambio del topic
void change_topic();
//void send_clicked();
protected:
virtual void keyPressEvent(QKeyEvent*);
signals:
void title_changed(QWidget*,QString);
void new_query(QString);
void chan_closed(tab_chat*);
};
#endif
|
// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
//
// Copyright (C) 2018 Gunter Königsmann <wxMaxima@physikbuch.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// SPDX-License-Identifier: GPL-2.0+
/*! \file
This file declares the function that returns the wxMaxima icon
*/
#ifndef WXMAXIMAICON_H
#define WXMAXIMAICON_H
#include "Cell.h"
#include <wx/icon.h>
#include <wx/image.h>
#include <wx/bitmap.h>
//! The wxMaxima icon.
wxIcon wxMaximaIcon();
#endif // WXMAXIMAICON_H
|
//
// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
#ifndef DETOURPROXIMITYGRID_H
#define DETOURPROXIMITYGRID_H
class dtProximityGrid
{
int m_maxItems;
float m_cellSize;
float m_invCellSize;
struct Item
{
unsigned short id;
short x,y;
unsigned short next;
};
Item* m_pool;
int m_poolHead;
int m_poolSize;
unsigned short* m_buckets;
int m_bucketsSize;
int m_bounds[4];
public:
dtProximityGrid();
~dtProximityGrid();
bool init(const int maxItems, const float cellSize);
void clear();
void addItem(const unsigned short id,
const float minx, const float miny,
const float maxx, const float maxy);
int queryItems(const float minx, const float miny,
const float maxx, const float maxy,
unsigned short* ids, const int maxIds) const;
int getItemCountAt(const int x, const int y) const;
inline const int* getBounds() const { return m_bounds; }
inline float getCellSize() const { return m_cellSize; }
};
dtProximityGrid* dtAllocProximityGrid();
void dtFreeProximityGrid(dtProximityGrid* ptr);
#endif // DETOURPROXIMITYGRID_H
|
#ifndef CONST_INAPPPURCHASEEVENTHANDLER_H
#define CONST_INAPPPURCHASEEVENTHANDLER_H
#include <string>
#include "CCEventHandler.h"
#include "Options.h"
#define EVENT_ON_CURRENCY_BALANCE_CHANGED "onCurrencyBalanceChanged"
#define EVENT_ON_GOOD_BALANCE_CHANGED "onGoodBalanceChanged"
#define EVENT_ON_GOOD_EQUIPPED "onGoodEquipped"
#define EVENT_ON_GOOD_UNEQUIPPED "onGoodUnEquipped"
#define EVENT_ON_GOOD_UPGRADE "onGoodUpgrade"
using namespace std;
class InAppPurchaseEventHandler : public soomla::CCEventHandler {
public:
virtual void onBillingNotSupported();
virtual void onBillingSupported();
virtual void onOpeningStore();
virtual void onClosingStore();
virtual void onCurrencyBalanceChanged(soomla::CCVirtualCurrency *virtualCurrency, int balance, int amountAdded);
virtual void onGoodBalanceChanged(soomla::CCVirtualGood *virtualGood, int balance, int amountAdded);
virtual void onGoodEquipped(soomla::CCEquippableVG *equippableVG);
virtual void onGoodUnEquipped(soomla::CCEquippableVG *equippableVG);
virtual void onGoodUpgrade(soomla::CCVirtualGood *virtualGood, soomla::CCUpgradeVG *upgradeVG);
virtual void onItemPurchased(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
virtual void onItemPurchaseStarted(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
virtual void onMarketPurchaseCancelled(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
virtual void onMarketPurchase(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
virtual void onMarketPurchaseStarted(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
virtual void onMarketRefund(soomla::CCPurchasableVirtualItem *purchasableVirtualItem);
virtual void onRestoreTransactions(bool success);
virtual void onRestoreTransactionsStarted();
virtual void onUnexpectedErrorInStore();
virtual void onStoreControllerInitialized();
};
#endif |
//
// Player.h
// C2DSmasher
//
// Created by Peter Arato on 9/15/13.
// Copyright 2013 Peter Arato. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import "SmasherTypes.h"
#import "MoveController.h"
#import "ControlTouchDelegate.h"
@interface Player : CCNode <ControlTouchDelegate> {
BOOL isMove;
MoveController *moveController;
NSMutableDictionary *ships;
}
@property (nonatomic, retain) NSMutableDictionary *ships;
- (void)controlStop;
- (void)controlStart;
+ (Player *)player;
@end
|
/*
* AMD Family 10h mmconfig enablement
*/
#include <linux/types.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/pci.h>
#include <linux/dmi.h>
#include <linux/range.h>
#include <asm/pci-direct.h>
#include <linux/sort.h>
#include <asm/io.h>
#include <asm/msr.h>
#include <asm/acpi.h>
#include <asm/mmconfig.h>
#include <asm/pci_x86.h>
struct pci_hostbridge_probe {
u32 bus;
u32 slot;
u32 vendor;
u32 device;
};
static u64 __cpuinitdata fam10h_pci_mmconf_base;
static struct pci_hostbridge_probe pci_probes[] __cpuinitdata = {
{ 0, 0x18, PCI_VENDOR_ID_AMD, 0x1200 },
{ 0xff, 0, PCI_VENDOR_ID_AMD, 0x1200 },
};
static int __cpuinit cmp_range(const void *x1, const void *x2)
{
const struct range *r1 = x1;
const struct range *r2 = x2;
int start1, start2;
start1 = r1->start >> 32;
start2 = r2->start >> 32;
return start1 - start2;
}
#define MMCONF_UNIT (1ULL << FAM10H_MMIO_CONF_BASE_SHIFT)
#define MMCONF_MASK (~(MMCONF_UNIT - 1))
#define MMCONF_SIZE (MMCONF_UNIT << 8)
/* need to avoid (0xfd<<32), (0xfe<<32), and (0xff<<32), ht used space */
#define FAM10H_PCI_MMCONF_BASE (0xfcULL<<32)
#define BASE_VALID(b) ((b) + MMCONF_SIZE <= (0xfdULL<<32) || (b) >= (1ULL<<40))
static void __cpuinit get_fam10h_pci_mmconf_base(void)
{
int i;
unsigned bus;
unsigned slot;
int found;
u64 val;
u32 address;
u64 tom2;
u64 base = FAM10H_PCI_MMCONF_BASE;
int hi_mmio_num;
struct range range[8];
/* only try to get setting from BSP */
if (fam10h_pci_mmconf_base)
return;
if (!early_pci_allowed())
return;
found = 0;
for (i = 0; i < ARRAY_SIZE(pci_probes); i++) {
u32 id;
u16 device;
u16 vendor;
bus = pci_probes[i].bus;
slot = pci_probes[i].slot;
id = read_pci_config(bus, slot, 0, PCI_VENDOR_ID);
vendor = id & 0xffff;
device = (id>>16) & 0xffff;
if (pci_probes[i].vendor == vendor &&
pci_probes[i].device == device) {
found = 1;
break;
}
}
if (!found)
return;
/* SYS_CFG */
address = MSR_K8_SYSCFG;
rdmsrl(address, val);
/* TOP_MEM2 is not enabled? */
if (!(val & (1<<21))) {
tom2 = 1ULL << 32;
} else {
/* TOP_MEM2 */
address = MSR_K8_TOP_MEM2;
rdmsrl(address, val);
tom2 = max(val & 0xffffff800000ULL, 1ULL << 32);
}
if (base <= tom2)
base = (tom2 + 2 * MMCONF_UNIT - 1) & MMCONF_MASK;
/*
* need to check if the range is in the high mmio range that is
* above 4G
*/
hi_mmio_num = 0;
for (i = 0; i < 8; i++) {
u32 reg;
u64 start;
u64 end;
reg = read_pci_config(bus, slot, 1, 0x80 + (i << 3));
if (!(reg & 3))
continue;
start = (u64)(reg & 0xffffff00) << 8; /* 39:16 on 31:8*/
reg = read_pci_config(bus, slot, 1, 0x84 + (i << 3));
end = ((u64)(reg & 0xffffff00) << 8) | 0xffff; /* 39:16 on 31:8*/
if (end < tom2)
continue;
range[hi_mmio_num].start = start;
range[hi_mmio_num].end = end;
hi_mmio_num++;
}
if (!hi_mmio_num)
goto out;
/* sort the range */
sort(range, hi_mmio_num, sizeof(struct range), cmp_range, NULL);
if (range[hi_mmio_num - 1].end < base)
goto out;
if (range[0].start > base + MMCONF_SIZE)
goto out;
/* need to find one window */
base = (range[0].start & MMCONF_MASK) - MMCONF_UNIT;
if ((base > tom2) && BASE_VALID(base))
goto out;
base = (range[hi_mmio_num - 1].end + MMCONF_UNIT) & MMCONF_MASK;
if (BASE_VALID(base))
goto out;
/* need to find window between ranges */
for (i = 1; i < hi_mmio_num; i++) {
base = (range[i - 1].end + MMCONF_UNIT) & MMCONF_MASK;
val = range[i].start & MMCONF_MASK;
if (val >= base + MMCONF_SIZE && BASE_VALID(base))
goto out;
}
return;
out:
fam10h_pci_mmconf_base = base;
}
void __cpuinit fam10h_check_enable_mmcfg(void)
{
u64 val;
u32 address;
if (!(pci_probe & PCI_CHECK_ENABLE_AMD_MMCONF))
return;
address = MSR_FAM10H_MMIO_CONF_BASE;
rdmsrl(address, val);
/* try to make sure that AP's setting is identical to BSP setting */
if (val & FAM10H_MMIO_CONF_ENABLE) {
unsigned busnbits;
busnbits = (val >> FAM10H_MMIO_CONF_BUSRANGE_SHIFT) &
FAM10H_MMIO_CONF_BUSRANGE_MASK;
/* only trust the one handle 256 buses, if acpi=off */
if (!acpi_pci_disabled || busnbits >= 8) {
u64 base = val & MMCONF_MASK;
if (!fam10h_pci_mmconf_base) {
fam10h_pci_mmconf_base = base;
return;
} else if (fam10h_pci_mmconf_base == base)
return;
}
}
/*
* if it is not enabled, try to enable it and assume only one segment
* with 256 buses
*/
get_fam10h_pci_mmconf_base();
if (!fam10h_pci_mmconf_base) {
pci_probe &= ~PCI_CHECK_ENABLE_AMD_MMCONF;
return;
}
#ifndef CONFIG_XEN
printk(KERN_INFO "Enable MMCONFIG on AMD Family 10h\n");
val &= ~((FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT) |
(FAM10H_MMIO_CONF_BUSRANGE_MASK<<FAM10H_MMIO_CONF_BUSRANGE_SHIFT));
val |= fam10h_pci_mmconf_base | (8 << FAM10H_MMIO_CONF_BUSRANGE_SHIFT) |
FAM10H_MMIO_CONF_ENABLE;
wrmsrl(address, val);
#else
if ((val & ~((FAM10H_MMIO_CONF_BASE_MASK<<FAM10H_MMIO_CONF_BASE_SHIFT) |
(FAM10H_MMIO_CONF_BUSRANGE_MASK<<FAM10H_MMIO_CONF_BUSRANGE_SHIFT)))
!= (fam10h_pci_mmconf_base | (8 << FAM10H_MMIO_CONF_BUSRANGE_SHIFT) |
FAM10H_MMIO_CONF_ENABLE))
pci_probe &= ~PCI_CHECK_ENABLE_AMD_MMCONF;
#endif
}
static int __init set_check_enable_amd_mmconf(const struct dmi_system_id *d)
{
pci_probe |= PCI_CHECK_ENABLE_AMD_MMCONF;
return 0;
}
static const struct dmi_system_id __initconst mmconf_dmi_table[] = {
{
.callback = set_check_enable_amd_mmconf,
.ident = "Sun Microsystems Machine",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Sun Microsystems"),
},
},
{}
};
/* Called from a __cpuinit function, but only on the BSP. */
void __ref check_enable_amd_mmconf_dmi(void)
{
dmi_check_system(mmconf_dmi_table);
}
|
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <unistd.h>
#include <signal.h>
void die(const char* fmt, ...) __attribute__((noreturn));
int warn(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
printf("\n");
va_end(ap);
return 0;
}
void die(const char* fmt, ...)
{
va_list ap;
va_start(ap, fmt);
vprintf(fmt, ap);
printf("\n");
va_end(ap);
kill(getpid(), SIGTERM); /* debugger trap */
_exit(-1);
}
/* Some tests need writable string literals, normally done with strdup.
It looks like a minor nuisance, but turns out there's no easy way
to do it without bringing malloc() family in.
I can't find a way to ask gcc to put string literals to .data
instead of .text, which is a shame since that would solve the problem
completely and with grace.
And strdupa is surprisingly messy, with gcc builtins and whatnot.
So, here comes a simple kind-of malloc implementation, capable *just*
enough to handle strdup calls.
I don't feel like putting this into bundled libc. Why do, after all,
if it works, it will works with native libc just as well, and opaque malloc
pointers is not something I want in tests.
Testing for use-after-free is out of question of course, since there's no free(). */
/* Max memory is set to be 8k, that's actually much more that it will use.
Most of these calls are for small strings. */
#define HEAP 8*1024
int heaplen = HEAP;
int heapptr = 0;
char heap[HEAP];
static char* heapdupstr(const char* s)
{
int l = strlen(s);
int p = heapptr;
if(p + l + 1 > heaplen)
die("HEAP out of memory");
memcpy(heap + p, s, l+1);
heapptr += l + 1;
return heap + p;
}
char* heapdup(const char* s)
{
if(!s) die("HEAP dup(NULL)");
return heapdupstr(s);
}
char* heapdupnull(const char* s)
{
return s ? heapdup(s) : NULL;
}
int nocall(const char* func)
{
die("called %s()", func);
}
|
/********************************************\
*
* Sire - Molecular Simulation Framework
*
* Copyright (C) 2009 Christopher Woods
*
* 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
*
* For full details of the license please see the COPYING file
* that should have come with this distribution.
*
* You can contact the authors via the developer's mailing list
* at http://siremol.org
*
\*********************************************/
#ifndef SIREMOL_MGIDS_AND_MAP_H
#define SIREMOL_MGIDS_AND_MAP_H
#include "mgidentifier.h"
#include "moleculegroup.h"
#include "SireBase/property.h"
#include "SireBase/propertymap.h"
#include <QVector>
#include <QList>
#include <boost/tuple/tuple.hpp>
SIRE_BEGIN_HEADER
namespace SireMol
{
class MGIDsAndMaps;
}
SIREMOL_EXPORT QDataStream& operator<<(QDataStream&, const SireMol::MGIDsAndMaps&);
SIREMOL_EXPORT QDataStream& operator>>(QDataStream&, SireMol::MGIDsAndMaps&);
namespace SireMol
{
/** This class holds a set of molecule group IDs, together
with the property maps that should be used with the
associated molecule groups. This provides a store for
information used to identify groups of molecule groups,
together with the properties needed to manipulate those
groups
@author Christopher Woods
*/
class SIREMOL_EXPORT MGIDsAndMaps
: public SireBase::ConcreteProperty<MGIDsAndMaps,SireBase::Property>
{
friend SIREMOL_EXPORT QDataStream& ::operator<<(QDataStream&, const MGIDsAndMaps&);
friend SIREMOL_EXPORT QDataStream& ::operator>>(QDataStream&, MGIDsAndMaps&);
public:
MGIDsAndMaps();
MGIDsAndMaps(const MoleculeGroup &mgroup);
MGIDsAndMaps(const MoleculeGroup &mgroup, const PropertyMap &map);
MGIDsAndMaps(const boost::tuple<MolGroupPtr,PropertyMap> group_and_map);
MGIDsAndMaps(const QList<MolGroupPtr> &mgroups);
MGIDsAndMaps(const QList< boost::tuple<MolGroupPtr,PropertyMap> > &groups_and_maps);
MGIDsAndMaps(const QList<MolGroupPtr> &mgroups, const PropertyMap &map);
MGIDsAndMaps(const boost::tuple<QList<MolGroupPtr>,PropertyMap> &groups_and_maps);
MGIDsAndMaps(const MGID &mgid);
MGIDsAndMaps(const MGID &mgid, const PropertyMap &map);
MGIDsAndMaps(const boost::tuple<MGIdentifier,PropertyMap> mgid_and_map);
MGIDsAndMaps(const QList<MGIdentifier> &mgids);
MGIDsAndMaps(const QList< boost::tuple<MGIdentifier,PropertyMap> > &mgids_and_maps);
MGIDsAndMaps(const QList<MGIdentifier> &mgids, const PropertyMap &map);
MGIDsAndMaps(const boost::tuple<QList<MGIdentifier>,PropertyMap> &mgids_and_maps);
MGIDsAndMaps(const QList<MGIDsAndMaps> &mgids_and_maps);
MGIDsAndMaps(const MGIDsAndMaps &other);
~MGIDsAndMaps();
MGIDsAndMaps& operator=(const MGIDsAndMaps &other);
bool operator==(const MGIDsAndMaps &other) const;
bool operator!=(const MGIDsAndMaps &other) const;
static const char* typeName();
bool isEmpty() const;
int count() const;
QString toString() const;
const QVector<MGIdentifier>& mgIDs() const;
const QVector<PropertyMap>& propertyMaps() const;
private:
QVector<MGIdentifier> mgids;
QVector<PropertyMap> maps;
};
}
Q_DECLARE_METATYPE( SireMol::MGIDsAndMaps )
SIRE_EXPOSE_CLASS( SireMol::MGIDsAndMaps )
SIRE_END_HEADER
#endif
|
/**
* @file RegKey.cpp
*
* @brief Declaration of CRegKeyEx C++ wrapper class for reading Windows registry
*/
// ID line follows -- this is updated by SVN
// $Id: RegKey.h 4507 2007-09-03 21:00:14Z kimmov $
#include "UnicodeString.h"
/**
* @brief Class for reading/writing registry.
*/
class CRegKeyEx
{
// Construction
public:
CRegKeyEx();
~CRegKeyEx();
// Operations
public:
HKEY GetKey() { return m_hKey; } // Only used by VssPrompt.cpp - can be removed?
void Close();
LONG Open(HKEY hKeyRoot, LPCTSTR pszPath);
LONG OpenWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam);
LONG OpenNoCreateWithAccess(HKEY hKeyRoot, LPCTSTR pszPath, REGSAM regsam);
bool QueryRegMachine(LPCTSTR key);
bool QueryRegUser(LPCTSTR key);
LONG WriteDword (LPCTSTR pszKey, DWORD dwVal);
LONG WriteString (LPCTSTR pszKey, LPCTSTR pszVal);
LONG WriteBool (LPCTSTR pszKey, BOOL bVal);
LONG WriteFloat (LPCTSTR pszKey, float fVal);
DWORD ReadDword (LPCTSTR pszKey, DWORD defval);
float ReadFloat (LPCTSTR pszKey, float defval);
BOOL ReadBool(LPCTSTR pszKey, BOOL defval);
LONG ReadLong (LPCTSTR pszKey, LONG defval);
UINT ReadUint (LPCTSTR pszKey, UINT defval);
UINT ReadInt (LPCTSTR pszKey, int defval);
short int ReadShort (LPCTSTR pszKey, short int defval);
BYTE ReadByte (LPCTSTR pszKey, BYTE defval);
String ReadString (LPCTSTR pszKey, LPCTSTR defval);
void ReadChars (LPCTSTR pszKey, LPTSTR pData, DWORD dwLength, LPCTSTR defval);
protected:
HKEY m_hKey; /**< Open key (HKLM, HKCU, etc). */
String m_sPath; /**< Path to actual key to open. */
};
|
#ifndef VOXELBORDERRENDERPASS_H
#define VOXELBORDERRENDERPASS_H
#include "Renderer/RenderPassI.h"
class VoxelBorderRenderPass : public RenderPassI
{
public:
virtual ~VoxelBorderRenderPass ();
virtual void Init ();
virtual RenderVolumeCollection* Execute (Scene* scene, Camera* camera, RenderVolumeCollection* rvc);
protected:
void StartVoxelBordering ();
void BorderVoxelVolume (RenderVolumeCollection*);
void EndVoxelBordering ();
};
#endif |
/*
Copyright (c) 2013, 2014 Montel Laurent <montel@kde.org>
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.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef SIEVESCRIPTBLOCKWIDGET_H
#define SIEVESCRIPTBLOCKWIDGET_H
#include "sievewidgetpageabstract.h"
class QRadioButton;
class QGroupBox;
class QAbstractButton;
class KComboBox;
class KPushButton;
class QDomElement;
namespace KSieveUi {
class SieveConditionWidgetLister;
class SieveActionWidgetLister;
class SieveScriptBlockWidget : public SieveWidgetPageAbstract
{
Q_OBJECT
public:
enum MatchCondition {
OrCondition,
AndCondition,
AllCondition
};
explicit SieveScriptBlockWidget(QWidget *parent = 0);
~SieveScriptBlockWidget();
void setPageType(PageType type);
void generatedScript(QString &script, QStringList &requires);
MatchCondition matchCondition() const;
void loadScript(const QDomElement &element, bool onlyActions, QString &error);
Q_SIGNALS:
void addNewBlock(QWidget *widget, KSieveUi::SieveWidgetPageAbstract::PageType type);
private Q_SLOTS:
void slotRadioClicked(QAbstractButton*);
void slotAddBlock();
private:
void updateWidget();
void updateCondition();
MatchCondition mMatchCondition;
QGroupBox *mConditions;
SieveConditionWidgetLister *mScriptConditionLister;
SieveActionWidgetLister *mScriptActionLister;
QRadioButton *mMatchAll;
QRadioButton *mMatchAny;
QRadioButton *mAllMessageRBtn;
KComboBox *mNewBlockType;
KPushButton *mAddBlockType;
};
}
#endif // SIEVESCRIPTBLOCKWIDGET_H
|
//6.3.1 简化版
#include<stdio.h>
int main(){
int D,I;
while(scanf("%d%d",&D,&I) == 2){
int k = 1;
for(int i=1;i<=D-1;i++){
if(I%2){
k = k*2;
I = (I+1)/2;
}else{
k = k*2+1;
I = I/2;
}
}
printf("%d\n",k);
}
return 0;
} |
#ifdef documentation
=========================================================================
program: mglPrivateEyelinkEDFGetFile.c
by: eric dewitt and eli merriam
date: 02/08/09
copyright: (c) 2006 Justin Gardner, Jonas Larsson (GPL see mgl/COPYING)
purpose: Receives a data file from the EyeLink tracker PC.
usage: mglPrivateEyelinkEDFGetFile(filename, filedestination)
=========================================================================
#endif
/////////////////////////
// include section //
/////////////////////////
#include "../mgl.h"
#include <eyelink.h>
//////////////
// main //
//////////////
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) {
char *filename, *filedestination;
INT16 dest_is_path = 0;
int result;
// Check that we have the correct number of arguments.
if (nrhs < 1 || nrhs > 2) {
usageError("mglPrivateEyelinkEDFGetFile");
return;
}
// Make sure our input is a character matrix.
if (!mxIsChar(prhs[0])) {
mexPrintf("(mglPrivateEyelinkEDFGetFile) filename must be a string.\n");
return;
}
// Also make sure that the input is a row vector, i.e. string.
if (mxGetM(prhs[0]) != 1) {
mexPrintf("(mglPrivateEyelinkEDFGetFile) Input must be a row vector.\n");
return;
}
// Get a pointer to the filename string.
filename = mxArrayToString(prhs[0]);
// Do the same checks for the 2nd function argument if present.
if (nrhs == 2) {
if (!mxIsChar(prhs[1])) {
mexPrintf("(mglPrivateEyelinkEDFGetFile) filedestination must be a string.\n");
return;
}
if (mxGetM(prhs[1]) != 1) {
mexPrintf("(mglPrivateEyelinkEDFGetFile) Input must be a row vector.\n");
return;
}
// Get a pointer to the file destination string.
filedestination = mxArrayToString(prhs[1]);
// Tell the EyeLink API that we are specifying the folder where we
// want the data file saved.
dest_is_path = 1;
}
else {
// If no file destination was specified, we'll use the same name as the
// eye tracker file.
filedestination = filename;
}
mexPrintf("(mglPrivateEyelinkEDFGetFile) ");
if (result = receive_data_file(filename, filedestination, dest_is_path)) {
if (result == FILE_CANT_OPEN || result == FILE_XFER_ABORTED) {
mexPrintf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
mexPrintf("(mglPrivateEyelinkEDFGetFile) File transfer error.\n");
mexPrintf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
}
}
else {
mexPrintf("\n.");
}
// Free the string memory.
mxFree(filename);
if (nrhs == 2) {
mxFree(filedestination);
}
}
|
/*
Main program. Version 1.0.
Michał Obrembski (byku@byku.com.pl)
Using rs232.c library from Teunis van Beelen
http://www.teuniz.net/RS-232/
*/
#include <stdlib.h>
#include <stdio.h>
#include "ansparser.h"
#include "crc.h"
#include "rs232.h"
const int cport_nr = 16;
const int brate = 9600;
const char mode[]={'8','N','1',0};
/* This is standard MODBUS RTU query frame. It has following meaning:
0x01 - MODBUS slave no. 0x01...
0x03 - ...Read Your Holding Registers...
0x00 0x00 - ...from register 0
0x00 0x10 - ...to register 16
0x00 0x00 - Last bytes is CRC16, it will be calculated.*/
unsigned char req[] = {0x01, 0x03, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00};
unsigned char buf[128];
/* Calculate time needed to wait before all bytes has been received.
In usec. It only calculates transmission time.*/
long calcSleepTime(int bdRate, unsigned int bytesToRecv)
{
int bytesPerSec = bdRate / 8;
float sum = (float)bytesToRecv / (float)bytesPerSec;
return sum * 1000000;
}
int main()
{
unsigned int i;
if(RS232_OpenComport(cport_nr, brate, mode))
{
printf("Can not open comport\n");
exit(1);
}
appendCRC(req, 8);
i = RS232_SendBuf(cport_nr, req, 8);
/* It seems that ORNO Power meters need 0.2 sec to prepare reply*/
usleep(calcSleepTime(9600, i) + 200000);
i = RS232_PollComport(cport_nr,buf,37);
if (checkCRC(buf, i))
{
printf("Wrong CRC!\n");
exit(1);
}
OrnoReply t = parseAnswer(buf);
printAnswer(t);
RS232_CloseComport(cport_nr);
return 0;
} |
/** \file alc_list.h \brief Receive packets to the list
*
* $Author: peltotal $ $Date: 2007/02/26 13:48:19 $ $Revision: 1.10 $
*
* MAD-ALCLIB: Implementation of ALC/LCT protocols, Compact No-Code FEC,
* Simple XOR FEC, Reed-Solomon FEC, and RLC Congestion Control protocol.
* Copyright (c) 2003-2007 TUT - Tampere University of Technology
* main authors/contacts: jani.peltotalo@tut.fi and sami.peltotalo@tut.fi
*
* 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
*
* In addition, as a special exception, TUT - Tampere University of Technology
* gives permission to link the code of this program with the OpenSSL library (or
* with modified versions of OpenSSL that use the same license as OpenSSL), and
* distribute linked combinations including the two. You must obey the GNU
* General Public License in all respects for all of the code used other than
* OpenSSL. If you modify this file, you may extend this exception to your version
* of the file, but you are not obligated to do so. If you do not wish to do so,
* delete this exception statement from your version.
*/
#ifndef _ALCLIST_H_
#define _ALCLIST_H_
#ifdef _MSC_VER
#include <winsock2.h>
#else
#include <pthread.h>
#include <sys/socket.h>
#include <sys/time.h>
#endif
#include "defines.h"
/**
* Container which stores received packet and its information.
* @struct alc_rcv_container
*/
typedef struct alc_rcv_container {
char recvbuf[MAX_PACKET_LENGTH]; /**< buffer for the received data */
struct sockaddr_storage from; /**< information about sender of the packet */
#ifdef _MSC_VER
int fromlen; /**< the actual length of from */
#else
socklen_t fromlen; /**< the actual length of from */
#endif
int recvlen; /**< the length of received data */
struct timeval time_stamp;
} alc_rcv_container_t;
/**
* List item for received packet.
* @struct alc_list_node
*/
typedef struct alc_list_node {
struct alc_list_node *next; /**< next item in the list*/
void *data; /**< pointer to the stored data (alc_rcv_container) */
} alc_list_node_t;
/**
* List for received packets.
* @struct alc_list
*/
typedef struct alc_list {
struct alc_list_node *first_elem; /**< first item in the list */
struct alc_list_node *last_elem; /**< last item in the list */
#ifdef _MSC_VER
RTL_CRITICAL_SECTION session_variables_semaphore; /**< used when the list is locked/unlocked */
#else
pthread_mutex_t session_variables_semaphore; /**< used when the list is locked/unlocked */
#endif
} alc_list_t;
/**
* This function inserts the data to the end of the list.
*
* @param a_list the list
* @param a_data the data
*
*/
void push_back(alc_list_t *a_list, alc_rcv_container_t *a_data);
/**
* This function inserts the data to the beginning of the list.
*
* @param a_list the list
* @param a_data the data
*
*/
void push_front(alc_list_t *a_list, alc_rcv_container_t *a_data);
/**
* This function returns the data from the beginning of the list.
*
* @param a_list the list
*
* @return pointer to the data, NULL if the list is empty
*
*/
alc_rcv_container_t *pop_front(alc_list_t *a_list);
/**
* This function checks if the list is empty.
*
* @param a_list the list
*
* @return 1 if the list is empty, 0 if not
*
*/
int is_empty(const alc_list_t *a_list);
/**
* This function creates new list.
*
* @return pointer to the created list, NULL in error cases.
*
*/
alc_list_t* build_list(void);
/**
* This function destroy the list.
*
* @param a_list the list
*
*/
void destroy_list(alc_list_t *a_list);
#endif
|
/*
Copyright (c) 2009, William M Brandt (aka 'Taekvideo')
All rights reserved.
Email: taekvideo@gmail.com (feel free to contact me with any questions, concerns, or suggestions)
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistribution of any files containing source code covered by this license must retain the above copyright notice,
this list of conditions, and the following disclaimer.
* Neither the name William M Brandt nor the pseudonym 'Taekvideo' may be used to endorse or
promote products derived from this software without specific prior written permission.
* It's not required, but I would appreciate being included in your credits.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef PHPBBHASH_H
#define PHPBBHASH_H
#include <string>
using namespace std;
class PHPBB3Password {
public:
PHPBB3Password();
string do_hash(string password, string setting);
bool check_hash(string password, string hash);
string encode(string input, int count);
string md5(string data);
private:
string itoa64;
};
#endif
|
/* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <locale.h>
#include <stdlib.h>
#include <wcsmbs/wcsmbsload.h>
extern mbstate_t __no_r_state attribute_hidden; /* Defined in mbtowc.c. */
int
__wctomb_chk (char *s, wchar_t wchar, size_t buflen)
{
/* We do not have to implement the full wctomb semantics since we
know that S cannot be NULL when we come here. */
if (buflen < MB_CUR_MAX)
__chk_fail ();
return __wcrtomb (s, wchar, &__no_r_state);
}
|
/*
* drivers/mtd/nandids.c
*
* Copyright (C) 2002 Thomas Gleixner (tglx@linutronix.de)
*
* 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/mtd/nand.h>
/*
* Chip ID list
*
* Name. ID code, pagesize, chipsize in MegaByte, eraseblock size,
* options
*
* Pagesize; 0, 256, 512
* 0 get this information from the extended chip ID
+ 256 256 Byte page size
* 512 512 Byte page size
*/
struct nand_flash_dev nand_flash_ids[] = {
#ifdef CONFIG_MTD_NAND_MUSEUM_IDS
{"NAND 1MiB 5V 8-bit", 0x6e, 256, 1, 0x1000, 0},
{"NAND 2MiB 5V 8-bit", 0x64, 256, 2, 0x1000, 0},
{"NAND 4MiB 5V 8-bit", 0x6b, 512, 4, 0x2000, 0},
{"NAND 1MiB 3,3V 8-bit", 0xe8, 256, 1, 0x1000, 0},
{"NAND 1MiB 3,3V 8-bit", 0xec, 256, 1, 0x1000, 0},
{"NAND 2MiB 3,3V 8-bit", 0xea, 256, 2, 0x1000, 0},
{"NAND 4MiB 3,3V 8-bit", 0xd5, 512, 4, 0x2000, 0},
{"NAND 4MiB 3,3V 8-bit", 0xe3, 512, 4, 0x2000, 0},
{"NAND 4MiB 3,3V 8-bit", 0xe5, 512, 4, 0x2000, 0},
{"NAND 8MiB 3,3V 8-bit", 0xd6, 512, 8, 0x2000, 0},
{"NAND 8MiB 1,8V 8-bit", 0x39, 512, 8, 0x2000, 0},
{"NAND 8MiB 3,3V 8-bit", 0xe6, 512, 8, 0x2000, 0},
{"NAND 8MiB 1,8V 16-bit", 0x49, 512, 8, 0x2000, NAND_BUSWIDTH_16},
{"NAND 8MiB 3,3V 16-bit", 0x59, 512, 8, 0x2000, NAND_BUSWIDTH_16},
#endif
{"NAND 16MiB 1,8V 8-bit", 0x33, 512, 16, 0x4000, 0},
{"NAND 16MiB 3,3V 8-bit", 0x73, 512, 16, 0x4000, 0},
{"NAND 16MiB 1,8V 16-bit", 0x43, 512, 16, 0x4000, NAND_BUSWIDTH_16},
{"NAND 16MiB 3,3V 16-bit", 0x53, 512, 16, 0x4000, NAND_BUSWIDTH_16},
{"NAND 32MiB 1,8V 8-bit", 0x35, 512, 32, 0x4000, 0},
{"NAND 32MiB 3,3V 8-bit", 0x75, 512, 32, 0x4000, 0},
{"NAND 32MiB 1,8V 16-bit", 0x45, 512, 32, 0x4000, NAND_BUSWIDTH_16},
{"NAND 32MiB 3,3V 16-bit", 0x55, 512, 32, 0x4000, NAND_BUSWIDTH_16},
{"NAND 64MiB 1,8V 8-bit", 0x36, 512, 64, 0x4000, 0},
{"NAND 64MiB 3,3V 8-bit", 0x76, 512, 64, 0x4000, 0},
{"NAND 64MiB 1,8V 16-bit", 0x46, 512, 64, 0x4000, NAND_BUSWIDTH_16},
{"NAND 64MiB 3,3V 16-bit", 0x56, 512, 64, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 1,8V 8-bit", 0x78, 512, 128, 0x4000, 0},
{"NAND 128MiB 1,8V 8-bit", 0x39, 512, 128, 0x4000, 0},
{"NAND 128MiB 3,3V 8-bit", 0x79, 512, 128, 0x4000, 0},
{"NAND 128MiB 1,8V 16-bit", 0x72, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 1,8V 16-bit", 0x49, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 3,3V 16-bit", 0x74, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 128MiB 3,3V 16-bit", 0x59, 512, 128, 0x4000, NAND_BUSWIDTH_16},
{"NAND 256MiB 3,3V 8-bit", 0x71, 512, 256, 0x4000, 0},
/*
* These are the new chips with large page size. The pagesize and the
* erasesize is determined from the extended id bytes
*/
#define LP_OPTIONS (NAND_SAMSUNG_LP_OPTIONS | NAND_NO_READRDY | NAND_NO_AUTOINCR)
#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16)
/*512 Megabit */
{"NAND 64MiB 1,8V 8-bit", 0xA2, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 3,3V 8-bit", 0xF2, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 3,3V 8-bit", 0xF0, 0, 64, 0, LP_OPTIONS},
{"NAND 64MiB 1,8V 16-bit", 0xB2, 0, 64, 0, LP_OPTIONS16},
{"NAND 64MiB 3,3V 16-bit", 0xC2, 0, 64, 0, LP_OPTIONS16},
/* 1 Gigabit */
{"NAND 128MiB 1,8V 8-bit", 0xA1, 0, 128, 0, LP_OPTIONS},
{"NAND 128MiB 3,3V 8-bit", 0xF1, 0, 128, 0, LP_OPTIONS},
{"NAND 128MiB 3,3V 8-bit", 0xD1, 0, 128, 0, LP_OPTIONS},
{"NAND 128MiB 1,8V 16-bit", 0xB1, 0, 128, 0, LP_OPTIONS16},
{"NAND 128MiB 3,3V 16-bit", 0xC1, 0, 128, 0, LP_OPTIONS16},
{"NAND 128MiB 1,8V 16-bit", 0xAD, 0, 128, 0, LP_OPTIONS16},
/* 2 Gigabit */
{"NAND 256MiB 1,8V 8-bit", 0xAA, 0, 256, 0, LP_OPTIONS},
{"NAND 256MiB 3,3V 8-bit", 0xDA, 0, 256, 0, LP_OPTIONS},
{"NAND 256MiB 1,8V 16-bit", 0xBA, 0, 256, 0, LP_OPTIONS16},
{"NAND 256MiB 3,3V 16-bit", 0xCA, 0, 256, 0, LP_OPTIONS16},
/* 4 Gigabit */
{"NAND 512MiB 1,8V 8-bit", 0xAC, 0, 512, 0, LP_OPTIONS},
{"NAND 512MiB 3,3V 8-bit", 0xDC, 0, 512, 0, LP_OPTIONS},
{"NAND 512MiB 1,8V 16-bit", 0xBC, 0, 512, 0, LP_OPTIONS16},
{"NAND 512MiB 3,3V 16-bit", 0xCC, 0, 512, 0, LP_OPTIONS16},
/* 8 Gigabit */
{"NAND 1GiB 1,8V 8-bit", 0xA3, 0, 1024, 0, LP_OPTIONS},
{"NAND 1GiB 3,3V 8-bit", 0xD3, 0, 1024, 0, LP_OPTIONS},
{"NAND 1GiB 1,8V 16-bit", 0xB3, 0, 1024, 0, LP_OPTIONS16},
{"NAND 1GiB 3,3V 16-bit", 0xC3, 0, 1024, 0, LP_OPTIONS16},
/* 16 Gigabit */
{"NAND 2GiB 1,8V 8-bit", 0xA5, 0, 2048, 0, LP_OPTIONS},
{"NAND 2GiB 3,3V 8-bit", 0xD5, 0, 2048, 0, LP_OPTIONS},
{"NAND 2GiB 1,8V 16-bit", 0xB5, 0, 2048, 0, LP_OPTIONS16},
{"NAND 2GiB 3,3V 16-bit", 0xC5, 0, 2048, 0, LP_OPTIONS16},
/* 32 Gigabit */
{"NAND 4GiB 3,3V 8-bit", 0xD7, 0, 4096, 0, LP_OPTIONS},
/*
* Renesas AND 1 Gigabit. Those chips do not support extended id and
* have a strange page/block layout ! The chosen minimum erasesize is
* 4 * 2 * 2048 = 16384 Byte, as those chips have an array of 4 page
* planes 1 block = 2 pages, but due to plane arrangement the blocks
* 0-3 consists of page 0 + 4,1 + 5, 2 + 6, 3 + 7 Anyway JFFS2 would
* increase the eraseblock size so we chose a combined one which can be
* erased in one go There are more speed improvements for reads and
* writes possible, but not implemented now
*/
{"AND 128MiB 3,3V 8-bit", 0x01, 2048, 128, 0x4000,
NAND_IS_AND | NAND_NO_AUTOINCR |NAND_NO_READRDY | NAND_4PAGE_ARRAY |
BBT_AUTO_REFRESH
},
{NULL,}
};
/*
* Manufacturer ID list
*/
#define NAND_MFR_ESMT 0x92
#define NAND_MFR_MACRONIX 0xc2
struct nand_manufacturers nand_manuf_ids[] = {
{NAND_MFR_TOSHIBA, "Toshiba"},
{NAND_MFR_SAMSUNG, "Samsung"},
{NAND_MFR_FUJITSU, "Fujitsu"},
{NAND_MFR_NATIONAL, "National"},
{NAND_MFR_RENESAS, "Renesas"},
{NAND_MFR_STMICRO, "ST Micro"},
{NAND_MFR_HYNIX, "Hynix"},
{NAND_MFR_MICRON, "Micron"},
{NAND_MFR_AMD, "AMD"},
{NAND_MFR_ESMT, "ESMT"},
{NAND_MFR_MACRONIX, "MACRONIX"},
{0x0, "Unknown"}
};
EXPORT_SYMBOL(nand_manuf_ids);
EXPORT_SYMBOL(nand_flash_ids);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Thomas Gleixner <tglx@linutronix.de>");
MODULE_DESCRIPTION("Nand device & manufacturer IDs");
|
/*
* mate-keyring
*
* Copyright (C) 2009 Stefan Walter
*
* This program 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.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#ifndef __GKD_SECRET_UNLOCK_H__
#define __GKD_SECRET_UNLOCK_H__
#include <glib-object.h>
#include "gkd-secret-types.h"
#define GKD_SECRET_TYPE_UNLOCK (gkd_secret_unlock_get_type ())
#define GKD_SECRET_UNLOCK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GKD_SECRET_TYPE_UNLOCK, GkdSecretUnlock))
#define GKD_SECRET_UNLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GKD_SECRET_TYPE_UNLOCK, GkdSecretUnlockClass))
#define GKD_SECRET_IS_UNLOCK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GKD_SECRET_TYPE_UNLOCK))
#define GKD_SECRET_IS_UNLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GKD_SECRET_TYPE_UNLOCK))
#define GKD_SECRET_UNLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GKD_SECRET_TYPE_UNLOCK, GkdSecretUnlockClass))
typedef struct _GkdSecretUnlockClass GkdSecretUnlockClass;
struct _GkdSecretUnlockClass {
GObjectClass parent_class;
};
GType gkd_secret_unlock_get_type (void);
GkdSecretUnlock* gkd_secret_unlock_new (GkdSecretService *service,
const gchar *caller,
const gchar *object_path);
void gkd_secret_unlock_queue (GkdSecretUnlock *self,
const gchar *unlock_path);
gboolean gkd_secret_unlock_have_queued (GkdSecretUnlock *self);
gchar** gkd_secret_unlock_get_results (GkdSecretUnlock *self,
gint *n_results);
void gkd_secret_unlock_reset_results (GkdSecretUnlock *self);
void gkd_secret_unlock_call_prompt (GkdSecretUnlock *self,
const gchar *window_id);
gboolean gkd_secret_unlock_with_secret (GckObject *collection,
GkdSecretSecret *master,
DBusError *derr);
gboolean gkd_secret_unlock_with_password (GckObject *collection,
const guchar *password,
gsize n_password,
DBusError *derr);
#endif /* __GKD_SECRET_UNLOCK_H__ */
|
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:41 2014 */
/* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm-x86/mach-summit/mach_apic.h */
#ifndef __ASM_MACH_APIC_H
#if defined(__cplusplus) && !CLICK_CXX_PROTECTED
# error "missing #include <click/cxxprotect.h>"
#endif
#define __ASM_MACH_APIC_H
#include <asm/smp.h>
#define esr_disable (1)
#define NO_BALANCE_IRQ (0)
/* In clustered mode, the high nibble of APIC ID is a cluster number.
* The low nibble is a 4-bit bitmap. */
#define XAPIC_DEST_CPUS_SHIFT 4
#define XAPIC_DEST_CPUS_MASK ((1u << XAPIC_DEST_CPUS_SHIFT) - 1)
#define XAPIC_DEST_CLUSTER_MASK (XAPIC_DEST_CPUS_MASK << XAPIC_DEST_CPUS_SHIFT)
#define APIC_DFR_VALUE (APIC_DFR_CLUSTER)
static inline cpumask_t target_cpus(void)
{
/* CPU_MASK_ALL (0xff) has undefined behaviour with
* dest_LowestPrio mode logical clustered apic interrupt routing
* Just start on cpu 0. IRQ balancing will spread load
*/
return cpumask_of_cpu(0);
}
#define TARGET_CPUS (target_cpus())
#define INT_DELIVERY_MODE (dest_LowestPrio)
#define INT_DEST_MODE 1 /* logical delivery broadcast to all procs */
static inline unsigned long check_apicid_used(physid_mask_t bitmap, int apicid)
{
return 0;
}
/* we don't use the phys_cpu_present_map to indicate apicid presence */
static inline unsigned long check_apicid_present(int bit)
{
return 1;
}
#define apicid_cluster(apicid) ((apicid) & XAPIC_DEST_CLUSTER_MASK)
extern u8 cpu_2_logical_apicid[];
static inline void init_apic_ldr(void)
{
unsigned long val, id;
int count = 0;
u8 my_id = (u8)hard_smp_processor_id();
u8 my_cluster = (u8)apicid_cluster(my_id);
#ifdef CONFIG_SMP
u8 lid;
int i;
/* Create logical APIC IDs by counting CPUs already in cluster. */
for (count = 0, i = NR_CPUS; --i >= 0; ) {
lid = cpu_2_logical_apicid[i];
if (lid != BAD_APICID && apicid_cluster(lid) == my_cluster)
++count;
}
#endif
/* We only have a 4 wide bitmap in cluster mode. If a deranged
* BIOS puts 5 CPUs in one APIC cluster, we're hosed. */
BUG_ON(count >= XAPIC_DEST_CPUS_SHIFT);
id = my_cluster | (1UL << count);
apic_write(APIC_DFR, APIC_DFR_VALUE);
val = apic_read(APIC_LDR) & ~APIC_LDR_MASK;
val |= SET_APIC_LOGICAL_ID(id);
apic_write(APIC_LDR, val);
}
static inline int multi_timer_check(int apic, int irq)
{
return 0;
}
static inline int apic_id_registered(void)
{
return 1;
}
static inline void setup_apic_routing(void)
{
printk("Enabling APIC mode: Summit. Using %d I/O APICs\n",
nr_ioapics);
}
static inline int apicid_to_node(int logical_apicid)
{
#ifdef CONFIG_SMP
return apicid_2_node[hard_smp_processor_id()];
#else
return 0;
#endif
}
/* Mapping from cpu number to logical apicid */
static inline int cpu_to_logical_apicid(int cpu)
{
#ifdef CONFIG_SMP
if (cpu >= NR_CPUS)
return BAD_APICID;
return (int)cpu_2_logical_apicid[cpu];
#else
return logical_smp_processor_id();
#endif
}
static inline int cpu_present_to_apicid(int mps_cpu)
{
if (mps_cpu < NR_CPUS)
return (int)per_cpu(x86_bios_cpu_apicid, mps_cpu);
else
return BAD_APICID;
}
static inline physid_mask_t ioapic_phys_id_map(physid_mask_t phys_id_map)
{
/* For clustered we don't have a good way to do this yet - hack */
return physids_promote(0x0F);
}
static inline physid_mask_t apicid_to_cpu_present(int apicid)
{
return physid_mask_of_physid(apicid);
}
static inline void setup_portio_remap(void)
{
}
static inline int check_phys_apicid_present(int boot_cpu_physical_apicid)
{
return 1;
}
static inline void enable_apic_mode(void)
{
}
static inline unsigned int cpu_mask_to_apicid(cpumask_t cpumask)
{
int num_bits_set;
int cpus_found = 0;
int cpu;
int apicid;
num_bits_set = cpus_weight(cpumask);
/* Return id to all */
if (num_bits_set == NR_CPUS)
return (int) 0xFF;
/*
* The cpus in the mask must all be on the apic cluster. If are not
* on the same apicid cluster return default value of TARGET_CPUS.
*/
cpu = first_cpu(cpumask);
apicid = cpu_to_logical_apicid(cpu);
while (cpus_found < num_bits_set) {
if (cpu_isset(cpu, cpumask)) {
int new_apicid = cpu_to_logical_apicid(cpu);
if (apicid_cluster(apicid) !=
apicid_cluster(new_apicid)){
printk ("%s: Not a valid mask!\n",__FUNCTION__);
return 0xFF;
}
apicid = apicid | new_apicid;
cpus_found++;
}
cpu++;
}
return apicid;
}
/* cpuid returns the value latched in the HW at reset, not the APIC ID
* register's value. For any box whose BIOS changes APIC IDs, like
* clustered APIC systems, we must use hard_smp_processor_id.
*
* See Intel's IA-32 SW Dev's Manual Vol2 under CPUID.
*/
static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb)
{
return hard_smp_processor_id() >> index_msb;
}
#endif /* __ASM_MACH_APIC_H */
|
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef BACKEND_I_H
#define BACKEND_I_H
#include <Test.h>
class BackendI : public Test::Backend
{
public:
virtual void check(const Ice::Current&);
virtual void shutdown(const Ice::Current&);
};
#endif
|
/* Copyright (C) 2014 InfiniDB, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2 of
the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#pragma once
#include "joblist.h"
#include "inetstreamsocket.h"
#include "threadpool.h"
class FEMsgHandler
{
public:
FEMsgHandler();
FEMsgHandler(boost::shared_ptr<joblist::JobList>, messageqcpp::IOSocket*);
virtual ~FEMsgHandler();
void start();
void stop();
void setJobList(boost::shared_ptr<joblist::JobList>);
void setSocket(messageqcpp::IOSocket*);
bool aborted();
void threadFcn();
static threadpool::ThreadPool threadPool;
private:
bool die, running, sawData;
messageqcpp::IOSocket* sock;
boost::shared_ptr<joblist::JobList> jl;
boost::mutex mutex;
uint64_t thr;
};
|
/* AbiWord
* Copyright (C) 1998 AbiSource, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef PF_FRAGMENTS_H
#define PF_FRAGMENTS_H
/*!
pf_Fragments is a container for all of the pf_Frag
derrived objects. pf_Fragments provides a searchable,
efficient ordering on the document fragments.
Currently this consists of a simple doubly-linked list.
We may need to add a tree structure on top of it, if we
need to do various types of searches.
*/
#include <stdio.h>
#include "ut_vector.h"
#include "ut_types.h"
#include "pt_Types.h"
class pf_Frag;
class ABI_EXPORT pf_Fragments
{
friend class pf_Frag;
public:
pf_Fragments();
~pf_Fragments();
void appendFrag(pf_Frag * pf);
void insertFrag(pf_Frag * pfPlace, pf_Frag * pfNew);
void insertFragBefore(pf_Frag * pfPlace, pf_Frag * pfNew);
void unlinkFrag(pf_Frag * pf);
// Call this to purge ALL the fragments. Likely before the destructor.
void purgeFrags();
pf_Frag * findFirstFragBeforePos(PT_DocPosition pos) const;
pf_Frag * getFirst() const;
pf_Frag * getLast() const;
void verifyDoc(void) const;
#ifdef PT_TEST
void __dump(FILE * fp) const;
#endif
class Node
{
public:
enum Color { red, black };
Node();
Node(Color c);
Node(Color c, pf_Frag * pf, Node * l, Node * r, Node * p);
~Node(void);
Color color;
pf_Frag* item;
Node* left;
Node* right;
Node* parent;
#ifdef DEBUG
void print(void);
#endif
private:
// prevent copy
Node(const Node&);
Node& operator=(const Node&);
};
class Iterator
{
public:
Iterator() : m_pOwner(NULL), m_pNode(NULL) {}
Iterator& operator++()
{
m_pNode = const_cast<Node*>(m_pOwner->_next(m_pNode));
return *this;
}
Iterator operator++(int)
{
Iterator tmp(*this);
m_pNode = const_cast<Node*>(m_pOwner->_next(m_pNode));
return tmp;
}
Iterator& operator--()
{
m_pNode = const_cast<Node*>(m_pOwner->_prev(m_pNode));
return *this;
}
Iterator operator--(int)
{
Iterator tmp(*this);
m_pNode = const_cast<Node*>(m_pOwner->_prev(m_pNode));
return tmp;
}
bool operator==(const Iterator other)
{ return (m_pOwner == other.m_pOwner && m_pNode == other.m_pNode); }
bool operator!=(const Iterator other)
{ return !(*this == other); }
const pf_Frag* value() const;
pf_Frag* value();
bool is_valid() const
{ return m_pNode != 0; }
private:
Iterator(const pf_Fragments* owner, Node* node = 0) : m_pOwner(owner), m_pNode(node) {}
const Node* getNode() const { return m_pNode; }
Node* getNode() { return m_pNode; }
const pf_Fragments* m_pOwner;
Node* m_pNode;
friend class pf_Fragments;
friend class pf_Frag;
};
Iterator find(PT_DocPosition pos) const; // throws ()
private:
Iterator insertRoot(pf_Frag* new_piece); // throws std::bad_alloc (strong)
Iterator insertLeft(pf_Frag* new_piece, Iterator it); // throws std::bad_alloc (strong)
Iterator insertRight(pf_Frag* new_piece, Iterator it); // throws std::bad_alloc (strong)
void erase(Iterator it); // throws ()
void fixSize(Iterator it); // throws ()
PT_DocPosition documentPosition(const Iterator it) const; // throws ()
void changeSize(int delta); // throws ()
Iterator begin() { return Iterator(this, _first()); }
Iterator end() { return Iterator(this); }
size_t size() const { return m_nSize; }
PT_DocPosition sizeDocument() const { return m_nDocumentSize; }
#ifdef DEBUG
void print() const;
bool checkInvariants() const;
bool checkSizeInvariant(const Node* pn, PT_DocPosition* size) const;
#endif
void _insertBST(Node* pn);
void _insertFixup(Node* pn);
void _eraseFixup(Node* pn);
void _leftRotate(Node* x);
void _rightRotate(Node* x);
PT_DocPosition _calculateSize(Node* x) const;
PT_DocPosition _calculateLeftSize(pf_Frag * pf) const;
#ifdef DEBUG
int _countBlackNodes(const Iterator it) const;
#endif
/** will delete the tree AND delete the fragments */
void delete_and_purge_tree(Node* node);
/** same as above BUT keep the fragments (as we don't own them */
void delete_tree(Node* node);
const Node* _next(const Node* pn) const;
const Node* _prev(const Node* pn) const;
const Node* _first() const;
const Node* _last() const;
Node* _next(Node* pn);
Node* _prev(Node* pn);
Node* _first();
Node* _last();
Node* m_pLeaf;
Node* m_pRoot;
size_t m_nSize;
PT_DocPosition m_nDocumentSize;
friend class Iterator;
};
#endif /* PF_FRAGMENTS_H */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.