text
stringlengths 4
6.14k
|
|---|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE511_Logic_Time_Bomb__time_05.c
Label Definition File: CWE511_Logic_Time_Bomb.label.xml
Template File: point-flaw-05.tmpl.c
*/
/*
* @description
* CWE: 511 Logic Time Bomb
* Sinks: time
* GoodSink: After a certain date, do something harmless
* BadSink : After a certain date, do something bad
* Flow Variant: 05 Control flow: if(staticTrue) and if(staticFalse)
*
* */
#include "std_testcase.h"
#ifdef _WIN32
#define UNLINK _unlink
#else
#include <unistd.h>
#define UNLINK unlink
#endif
#include <time.h>
#define TIME_CHECK ((time_t)1199163600) /* Jan 1, 2008 12:00:00 AM */
/* 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 CWE511_Logic_Time_Bomb__time_05_bad()
{
if(staticTrue)
{
{
time_t currentTime;
/* FLAW: After a certain date, delete a file */
time(¤tTime);
if (currentTime > TIME_CHECK)
{
UNLINK("important_file.txt");
}
}
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good1() uses if(staticFalse) instead of if(staticTrue) */
static void good1()
{
if(staticFalse)
{
/* INCIDENTAL: CWE 561 Dead Code, the code below will never run */
printLine("Benign, fixed string");
}
else
{
{
time_t currentTime;
/* FIX: After a certain date, print to the console */
time(¤tTime);
if (currentTime > TIME_CHECK)
{
printLine("Happy New Year!");
}
}
}
}
/* good2() reverses the bodies in the if statement */
static void good2()
{
if(staticTrue)
{
{
time_t currentTime;
/* FIX: After a certain date, print to the console */
time(¤tTime);
if (currentTime > TIME_CHECK)
{
printLine("Happy New Year!");
}
}
}
}
void CWE511_Logic_Time_Bomb__time_05_good()
{
good1();
good2();
}
#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()...");
CWE511_Logic_Time_Bomb__time_05_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE511_Logic_Time_Bomb__time_05_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE123_Write_What_Where_Condition__listen_socket_52b.c
Label Definition File: CWE123_Write_What_Where_Condition.label.xml
Template File: sources-sink-52b.tmpl.c
*/
/*
* @description
* CWE: 123 Write-What-Where Condition
* BadSource: listen_socket Overwrite linked list pointers using a listen socket (server side)
* GoodSource: Don't overwrite linked list pointers
* Sink:
* BadSink : Remove element from list
* Flow Variant: 52 Data flow: data passed as an argument from one function to another to another in three different source files
*
* */
#include "std_testcase.h"
typedef struct _linkedList
{
struct _linkedList *next;
struct _linkedList *prev;
} linkedList;
typedef struct _badStruct
{
linkedList list;
} badStruct;
static linkedList *linkedListPrev, *linkedListNext;
#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
#include <direct.h>
#pragma comment(lib, "ws2_32") /* include ws2_32.lib when linking */
#define CLOSE_SOCKET closesocket
#else
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#define CLOSE_SOCKET close
#define SOCKET int
#endif
#define TCP_PORT 27015
#define LISTEN_BACKLOG 5
/* all the sinks are the same, we just want to know where the hit originated if a tool flags one */
#ifndef OMITBAD
/* bad function declaration */
void CWE123_Write_What_Where_Condition__listen_socket_52c_badSink(badStruct data);
void CWE123_Write_What_Where_Condition__listen_socket_52b_badSink(badStruct data)
{
CWE123_Write_What_Where_Condition__listen_socket_52c_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declaration */
void CWE123_Write_What_Where_Condition__listen_socket_52c_goodG2BSink(badStruct data);
/* goodG2B uses the GoodSource with the BadSink */
void CWE123_Write_What_Where_Condition__listen_socket_52b_goodG2BSink(badStruct data)
{
CWE123_Write_What_Where_Condition__listen_socket_52c_goodG2BSink(data);
}
#endif /* OMITGOOD */
|
/*++
Copyright (c) 2004, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
Module Name:
SecPlatformInformation.h
Abstract:
Sec Platform Information PPI as defined in Tiano
--*/
#ifndef _PEI_SEC_PLATFORM_INFORMATION_PPI_H
#define _PEI_SEC_PLATFORM_INFORMATION_PPI_H
#define EFI_SEC_PLATFORM_INFORMATION_GUID \
{ \
0x6f8c2b35, 0xfef4, 0x448d, 0x82, 0x56, 0xe1, 0x1b, 0x19, 0xd6, 0x10, 0x77 \
}
EFI_FORWARD_DECLARATION (EFI_SEC_PLATFORM_INFORMATION_PPI);
extern EFI_GUID gEfiSecPlatformInformationPpiGuid;
typedef union {
struct {
UINT32 Status : 2;
UINT32 Tested : 1;
UINT32 Reserved1 :13;
UINT32 VirtualMemoryUnavailable : 1;
UINT32 Ia32ExecutionUnavailable : 1;
UINT32 FloatingPointUnavailable : 1;
UINT32 MiscFeaturesUnavailable : 1;
UINT32 Reserved2 :12;
} Bits;
UINT32 Uint32;
} EFI_HEALTH_FLAGS;
typedef struct {
EFI_HEALTH_FLAGS HealthFlags;
} SEC_PLATFORM_INFORMATION_RECORD;
typedef struct {
UINTN BootPhase; // entry r20 value
UINTN UniqueId; // PAL arbitration ID
UINTN HealthStat; // Health Status
UINTN PALRetAddress; // return address to PAL
} IPF_HANDOFF_STATUS;
typedef
EFI_STATUS
(EFIAPI *SEC_PLATFORM_INFORMATION) (
IN EFI_PEI_SERVICES **PeiServices,
IN OUT UINT64 *StructureSize,
IN OUT SEC_PLATFORM_INFORMATION_RECORD *PlatformInformationRecord
);
typedef struct _EFI_SEC_PLATFORM_INFORMATION_PPI {
SEC_PLATFORM_INFORMATION PlatformInformation;
} EFI_SEC_PLATFORM_INFORMATION_PPI;
#endif
|
/* Copyright 2021 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Battery pack vendor provided charging profile
*/
#include "battery_fuel_gauge.h"
#include "common.h"
#include "compile_time_macros.h"
/*
* Battery info for all Brya battery types. Note that the fields
* start_charging_min/max and charging_min/max are not used for the charger.
* The effective temperature limits are given by discharging_min/max_c.
*
* Fuel Gauge (FG) parameters which are used for determining if the battery
* is connected, the appropriate ship mode (battery cutoff) command, and the
* charge/discharge FETs status.
*
* Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery
* register. For some batteries, the charge/discharge FET bits are set when
* charging/discharging is active, in other types, these bits set mean that
* charging/discharging is disabled. Therefore, in addition to the mask for
* these bits, a disconnect value must be specified. Note that for TI fuel
* gauge, the charge/discharge FET status is found in Operation Status (0x54),
* but a read of Manufacturer Access (0x00) will return the lower 16 bits of
* Operation status which contains the FET status bits.
*
* The assumption for battery types supported is that the charge/discharge FET
* status can be read with a sb_read() command and therefore, only the register
* address, mask, and disconnect value need to be provided.
*/
const struct board_batt_params board_battery_info[] = {
/* SMP 996QA193H Battery Information */
[BATTERY_SIMPLO_HIGHPOWER] = {
.fuel_gauge = {
.manuf_name = "333-1D-11-A",
.ship_mode = {
.reg_addr = 0x0,
.reg_data = { 0x0010, 0x0010 },
},
.fet = {
.mfgacc_support = 1,
.reg_addr = 0x0,
.reg_mask = 0x0006,
.disconnect_val = 0x0,
},
},
.batt_info = {
.voltage_max = 13200, /* mV */
.voltage_normal = 11550, /* mV */
.voltage_min = 9000, /* mV */
.precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
.charging_max_c = 45,
.discharging_min_c = -20,
.discharging_max_c = 60,
},
},
/* Cosmx CA407792G Battery Information */
[BATTERY_COSMX] = {
.fuel_gauge = {
.manuf_name = "333-AC-11-A",
.ship_mode = {
.reg_addr = 0x0,
.reg_data = { 0x0010, 0x0010 },
},
.fet = {
.mfgacc_support = 1,
.reg_addr = 0x0,
.reg_mask = 0x0006,
.disconnect_val = 0x0,
},
},
.batt_info = {
.voltage_max = 13200, /* mV */
.voltage_normal = 11550, /* mV */
.voltage_min = 9000, /* mV */
.precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
.charging_max_c = 45,
.discharging_min_c = -10,
.discharging_max_c = 60,
},
},
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SIMPLO_HIGHPOWER;
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file contains the definition of the IdAllocator class.
#ifndef GPU_COMMAND_BUFFER_COMMON_ID_ALLOCATOR_H_
#define GPU_COMMAND_BUFFER_COMMON_ID_ALLOCATOR_H_
#include <stdint.h>
#include <map>
#include <utility>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "gpu/gpu_export.h"
namespace gpu {
// A resource ID, key to the resource maps.
typedef uint32_t ResourceId;
// Invalid resource ID.
static const ResourceId kInvalidResource = 0u;
// A class to manage the allocation of resource IDs.
class GPU_EXPORT IdAllocator {
public:
IdAllocator();
IdAllocator(const IdAllocator&) = delete;
IdAllocator& operator=(const IdAllocator&) = delete;
~IdAllocator();
// Allocates a new resource ID.
ResourceId AllocateID();
// Allocates an Id starting at or above desired_id.
// Note: may wrap if it starts near limit.
ResourceId AllocateIDAtOrAbove(ResourceId desired_id);
// Allocates |range| amount of contiguous ids.
// Returns the first id to |first_id| or |kInvalidResource| if
// allocation failed.
ResourceId AllocateIDRange(uint32_t range);
// Marks an id as used. Returns false if id was already used.
bool MarkAsUsed(ResourceId id);
// Frees a resource ID.
void FreeID(ResourceId id);
// Frees a |range| amount of contiguous ids, starting from |first_id|.
void FreeIDRange(ResourceId first_id, uint32_t range);
// Checks whether or not a resource ID is in use.
bool InUse(ResourceId id) const;
private:
// first_id -> last_id mapping.
typedef std::map<ResourceId, ResourceId> ResourceIdRangeMap;
ResourceIdRangeMap used_ids_;
};
} // namespace gpu
#endif // GPU_COMMAND_BUFFER_COMMON_ID_ALLOCATOR_H_
|
/*
* Order-1, 3D 25 point stencil with axis-symmetric ariable coefficients
* Adapted from PLUTO and Pochoir test bench
*
* Tareq Malas
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#ifdef LIKWID_PERFMON
#include <likwid.h>
#endif
#include "print_utils.h"
#define TESTS 2
#define MAX(a,b) ((a) > (b) ? a : b)
#define MIN(a,b) ((a) < (b) ? a : b)
/* Subtract the `struct timeval' values X and Y,
* storing the result in RESULT.
*
* Return 1 if the difference is negative, otherwise 0.
*/
int timeval_subtract(struct timeval *result, struct timeval *x, struct timeval *y)
{
/* Perform the carry for the later subtraction by updating y. */
if (x->tv_usec < y->tv_usec)
{
int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
y->tv_usec -= 1000000 * nsec;
y->tv_sec += nsec;
}
if (x->tv_usec - y->tv_usec > 1000000)
{
int nsec = (x->tv_usec - y->tv_usec) / 1000000;
y->tv_usec += 1000000 * nsec;
y->tv_sec -= nsec;
}
/* Compute the time remaining to wait.
* tv_usec is certainly positive.
*/
result->tv_sec = x->tv_sec - y->tv_sec;
result->tv_usec = x->tv_usec - y->tv_usec;
/* Return 1 if result is negative. */
return x->tv_sec < y->tv_sec;
}
int main(int argc, char *argv[])
{
int t, i, j, k, m, test;
int Nx, Ny, Nz, Nt;
if (argc > 3) {
Nx = atoi(argv[1])+8;
Ny = atoi(argv[2])+8;
Nz = atoi(argv[3])+8;
}
if (argc > 4)
Nt = atoi(argv[4]);
// allocate the arrays
double ****A = (double ****) malloc(sizeof(double***)*2);
for(m=0; m<2;m++){
A[m] = (double ***) malloc(sizeof(double**)*Nz);
for(i=0; i<Nz; i++){
A[m][i] = (double**) malloc(sizeof(double*)*Ny);
for(j=0;j<Ny;j++){
A[m][i][j] = (double*) malloc(sizeof(double)*Nx);
}
}
}
double ****coef = (double ****) malloc(sizeof(double***)*13);
for(m=0; m<13;m++){
coef[m] = (double ***) malloc(sizeof(double**)*Nz);
for(i=0; i<Nz; i++){
coef[m][i] = (double**) malloc(sizeof(double*)*Ny);
for(j=0;j<Ny;j++){
coef[m][i][j] = (double*) malloc(sizeof(double)*Nx);
}
}
}
// tile size information, including extra element to decide the list length
int *tile_size = (int*) malloc(sizeof(int));
tile_size[0] = -1;
// The list is modified here before source-to-source transformations
tile_size = (int*) realloc((void *)tile_size, sizeof(int)*5);
tile_size[0] = 16;
tile_size[1] = 16;
tile_size[2] = 4;
tile_size[3] = 512;
tile_size[4] = -1;
// for timekeeping
int ts_return = -1;
struct timeval start, end, result;
double tdiff = 0.0, min_tdiff=1.e100;
const int BASE = 1024;
// initialize variables
//
srand(42);
for (i = 1; i < Nz; i++) {
for (j = 1; j < Ny; j++) {
for (k = 1; k < Nx; k++) {
A[0][i][j][k] = 1.0 * (rand() % BASE);
}
}
}
for (m=0; m<13; m++) {
for (i=1; i<Nz; i++) {
for (j=1; j<Ny; j++) {
for (k=1; k<Nx; k++) {
coef[m][i][j][k] = 1.0 * (rand() % BASE);
}
}
}
}
#ifdef LIKWID_PERFMON
LIKWID_MARKER_INIT;
#pragma omp parallel
{
LIKWID_MARKER_THREADINIT;
#pragma omp barrier
LIKWID_MARKER_START("calc");
}
#endif
int num_threads = 1;
#if defined(_OPENMP)
num_threads = omp_get_max_threads();
#endif
for(test=0; test<TESTS; test++){
gettimeofday(&start, 0);
// serial execution - Addition: 6 && Multiplication: 2
#pragma scop
for (t = 0; t < Nt; t++) {
for (i = 4; i < Nz-4; i++) {
for (j = 4; j < Ny-4; j++) {
for (k = 4; k < Nx-4; k++) {
A[(t+1)%2][i][j][k] =
coef[0][i][j][k] * A[(t)%2][i ][j ][k ] +
coef[1][i][j][k] * (A[(t)%2][i-1][j ][k ] + A[(t)%2][i+1][j ][k ]) +
coef[2][i][j][k] * (A[(t)%2][i ][j-1][k ] + A[(t)%2][i ][j+1][k ]) +
coef[3][i][j][k] * (A[(t)%2][i ][j ][k-1] + A[(t)%2][i ][j ][k+1]) +
coef[4][i][j][k] * (A[(t)%2][i-2][j ][k ] + A[(t)%2][i+2][j ][k ]) +
coef[5][i][j][k] * (A[(t)%2][i ][j-2][k ] + A[(t)%2][i ][j+2][k ]) +
coef[6][i][j][k] * (A[(t)%2][i ][j ][k-2] + A[(t)%2][i ][j ][k+2]) +
coef[7][i][j][k] * (A[(t)%2][i-3][j ][k ] + A[(t)%2][i+3][j ][k ]) +
coef[8][i][j][k] * (A[(t)%2][i ][j-3][k ] + A[(t)%2][i ][j+3][k ]) +
coef[9][i][j][k] * (A[(t)%2][i ][j ][k-3] + A[(t)%2][i ][j ][k+3]) +
coef[10][i][j][k]* (A[(t)%2][i-4][j ][k ] + A[(t)%2][i+4][j ][k ]) +
coef[11][i][j][k]* (A[(t)%2][i ][j-4][k ] + A[(t)%2][i ][j+4][k ]) +
coef[12][i][j][k]* (A[(t)%2][i ][j ][k-4] + A[(t)%2][i ][j ][k+4]) ;
}
}
}
}
#pragma endscop
gettimeofday(&end, 0);
ts_return = timeval_subtract(&result, &end, &start);
tdiff = (double) (result.tv_sec + result.tv_usec * 1.0e-6);
min_tdiff = min(min_tdiff, tdiff);
printf("Rank 0 TEST# %d time: %f\n", test, tdiff);
}
PRINT_RESULTS(4, "variable axis-symmetric")
#ifdef LIKWID_PERFMON
#pragma omp parallel
{
LIKWID_MARKER_STOP("calc");
}
LIKWID_MARKER_CLOSE;
#endif
// Free allocated arrays
for(i=0; i<Nz; i++){
for(j=0;j<Ny;j++){
free(A[0][i][j]);
free(A[1][i][j]);
}
free(A[0][i]);
free(A[1][i]);
}
free(A[0]);
free(A[1]);
for(m=0; m<13;m++){
for(i=0; i<Nz; i++){
for(j=0;j<Ny;j++){
free(coef[m][i][j]);
}
free(coef[m][i]);
}
free(coef[m]);
}
return 0;
}
|
#ifndef STREAM_H
#define STREAM_H
#include <stdio.h>
#include <glib.h>
#include "glk.h"
#include "gi_dispa.h"
enum StreamType
{
STREAM_TYPE_WINDOW,
STREAM_TYPE_MEMORY,
STREAM_TYPE_FILE,
STREAM_TYPE_RESOURCE
};
struct glk_stream_struct
{
/*< private >*/
glui32 magic, rock;
gidispatch_rock_t disprock;
/* Pointer to the list node in the global stream list that contains this
stream */
GList* stream_list;
/* Stream parameters */
glui32 file_mode;
glui32 read_count;
glui32 write_count;
enum StreamType type;
/* Specific to window stream: the window this stream is connected to */
winid_t window;
/* For memory, file, and resource streams */
gboolean unicode;
/* For file and resource streams */
gboolean binary;
/* For memory and resource streams */
char *buffer;
glui32 *ubuffer;
glui32 mark;
glui32 endmark;
glui32 buflen;
/* Specific to memory streams */
gidispatch_rock_t buffer_rock;
/* Specific to file streams */
FILE *file_pointer;
gchar *filename; /* Displayable filename in UTF-8 for error handling */
glui32 lastop; /* 0, filemode_Write, or filemode_Read */
gboolean hyperlink_mode; /* When turned on, text written to the stream will be a hyperlink */
};
G_GNUC_INTERNAL strid_t file_stream_new(frefid_t fileref, glui32 fmode, glui32 rock, gboolean unicode);
G_GNUC_INTERNAL strid_t stream_new_common(glui32 rock);
G_GNUC_INTERNAL void stream_close_common(strid_t str, stream_result_t *result);
#endif
|
/* Copyright 2016, Ian Olivieri <ianolivieri93@gmail.com>
* All rights reserved.
*
* This file is part of the Firmata4CIAA program.
*
* 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 the copyright holder 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.
*
*/
#ifndef SAPI_SERVO_H_
#define SAPI_SERVO_H_
/*==================[inclusions]=============================================*/
/*==================[cplusplus]==============================================*/
#ifdef __cplusplus
extern "C" {
#endif
/*==================[macros and definitions]=================================*/
/*==================[typedef]================================================*/
/*Servo names are defined in the sAPI_PeripheralMap.h:
typedef enum{
SERVO0, SERVO1, SERVO2, SERVO3, SERVO4, SERVO5, SERVO6, SERVO7, SERVO8
} ServoMap_t;
*/
/*==================[external data declaration]==============================*/
/*==================[external functions declaration]=========================*/
/*
* @Brief: Initializes the servo peripheral
* @param none
* @return nothing
* @IMPORTANT: this function uses Timer 1, 2 and 3 to generate the servo signals, so
* they won't be available to use.
*/
void servoConfig(void);
/*
* @brief: adds a servo to the active servos list
* @param servoNumber: ID of the servo, from 0 to 8
* @return: True if servo was successfully attached, False if not.
*/
bool_t servoAttach( uint8_t servoNumber);
/*
* @brief: removes a servo from the active servos list
* @param servoNumber: ID of the servo, from 0 to 8
* @return: True if servo was successfully detached, False if not.
*/
bool_t servoDetach( uint8_t servoNumber);
/*
* @brief: Tells if the servo is currently active, and its position
* @param: servoNumber: ID of the servo, from 0 to 8
* @param: value: value of the servo, from 0 to 180
* @return: position (1 ~ SERVO_TOTALNUMBER), 0 if the element was not found.
*/
uint8_t servoIsAttached( uint8_t servoNumber);
/*
* @brief: change the value of the servo
* @param: servoNumber: ID of the servo, from 0 to 8
* @param: value: value of the servo, from 0 to 180
* @return: True if the value was successfully changed, False if not.
*/
bool_t servoWrite( uint8_t servoNumber, uint8_t angle );
/*
* @brief: read the value of the servo
* @param: servoNumber: ID of the servo, from 0 to 8
* @return: value of the servo (0 ~ 180).
* If an error ocurred, return = EMPTY_POSITION = 255
*/
uint8_t servoRead( uint8_t servoNumber);
/*==================[cplusplus]==============================================*/
#ifdef __cplusplus
}
#endif
/*==================[end of file]============================================*/
#endif /* SAPI_SERVO_H_ */
|
/* sane - Scanner Access Now Easy.
Copyright (C) 1996, 1997 David Mosberger-Tang and Andreas Beck
This file is part of the SANE package.
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.
As a special exception, the authors of SANE give permission for
additional uses of the libraries contained in this release of SANE.
The exception is that, if you link a SANE library with other files
to produce an executable, this does not by itself cause the
resulting executable to be covered by the GNU General Public
License. Your use of that executable is in no way restricted on
account of linking the SANE library code into it.
This exception does not, however, invalidate any other reasons why
the executable file might be covered by the GNU General Public
License.
If you submit changes to SANE to the maintainers to be included in
a subsequent release, you agree by submitting the changes that
those changes may be distributed with this exception intact.
If you write modifications of your own for SANE, it is your choice
whether to permit this exception to apply to your modifications.
If you do not wish that, delete this exception notice.
This file implements the backend-independent parts of SANE. */
#include <stdio.h>
#include "sane/sane.h"
SANE_String_Const
sane_strstatus (SANE_Status status)
{
static char buf[80];
switch (status)
{
case SANE_STATUS_GOOD:
return "Success";
case SANE_STATUS_UNSUPPORTED:
return "Operation not supported";
case SANE_STATUS_CANCELLED:
return "Operation was cancelled";
case SANE_STATUS_DEVICE_BUSY:
return "Device busy";
case SANE_STATUS_INVAL:
return "Invalid argument";
case SANE_STATUS_EOF:
return "End of file reached";
case SANE_STATUS_JAMMED:
return "Document feeder jammed";
case SANE_STATUS_NO_DOCS:
return "Document feeder out of documents";
case SANE_STATUS_COVER_OPEN:
return "Scanner cover is open";
case SANE_STATUS_IO_ERROR:
return "Error during device I/O";
case SANE_STATUS_NO_MEM:
return "Out of memory";
case SANE_STATUS_ACCESS_DENIED:
return "Access to resource has been denied";
default:
/* non-reentrant, but better than nothing */
sprintf (buf, "Unknown SANE status code %d", status);
return buf;
}
}
|
//
// NSArray+ZDUtility.h
// ZDUtility
//
// Created by Zero on 15/11/28.
// Copyright © 2015年 Zero.D.Saber. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSArray<__covariant ObjectType> (ZDUtility)
- (nullable ObjectType)zd_anyObject;
/// 反转数组中元素的顺序
- (NSArray<ObjectType> *)zd_reverse;
/// 打乱数组中元素的原有顺序
- (NSMutableArray<ObjectType> *)zd_shuffle;
/// 把某一元素移动到最前面
- (NSMutableArray<ObjectType> *)zd_moveObjcToFront:(ObjectType)obj;
/// 去重
- (NSArray<ObjectType> *)zd_deduplication;
/// 获取两个数组中的相同元素
- (NSArray<ObjectType> *)zd_collectSameElementWithArray:(NSArray<ObjectType> *)otherArray;
/// 求和
- (CGFloat)zd_sum;
/// 平均值
- (CGFloat)zd_avg;
/// 最大值
- (CGFloat)zd_max;
/// 最小值
- (CGFloat)zd_min;
- (void)zd_forEach:(void(^)(ObjectType obj, NSUInteger idx))block;
- (NSMutableArray *)zd_map:(id(^)(ObjectType obj, NSUInteger idx))block;
- (NSMutableArray<ObjectType> *)zd_filter:(BOOL(^)(ObjectType obj, NSUInteger idx))block;
- (nullable id)zd_reduce:(id _Nullable (^)(id _Nullable previousResult, ObjectType currentObject, NSUInteger idx))block;
- (NSMutableArray<ObjectType> *)zd_flatten;
- (NSMutableArray<ObjectType> *)zd_zipWith:(NSArray<ObjectType> *)rightArray usingBlock:(id(^)(ObjectType left, ObjectType right))block;
- (NSMutableArray<ObjectType> *)zd_mutableArray;
@end
NS_ASSUME_NONNULL_END
|
//------------------------------------------------------------------------------
//
// Copyright (C) Streamlet. All rights reserved.
//
// File Name: xlPair.h
// Author: Streamlet
// Create Time: 2009-11-07
// Description:
//
// Version history:
//
//
//
//------------------------------------------------------------------------------
#ifndef __XLPAIR_H_E7935E32_4626_4FB9_B582_4D3DA2D9CF69_INCLUDED__
#define __XLPAIR_H_E7935E32_4626_4FB9_B582_4D3DA2D9CF69_INCLUDED__
namespace xl
{
template <typename K, typename V>
class Pair
{
public:
K Key;
V Value;
public:
Pair();
Pair(const K &key);
Pair(const K &key, const V &value);
Pair(const Pair &that);
Pair &operator = (const Pair &that);
public:
bool operator == (const Pair &that) const;
bool operator != (const Pair &that) const;
bool operator < (const Pair &that) const;
bool operator > (const Pair &that) const;
bool operator <= (const Pair &that) const;
bool operator >= (const Pair &that) const;
};
template <typename K, typename V>
Pair<K, V>::Pair()
{
}
template <typename K, typename V>
Pair<K, V>::Pair(const K &key)
: Key(key)
{
}
template <typename K, typename V>
Pair<K, V>::Pair(const K &key, const V &value)
: Key(key), Value(value)
{
}
template <typename K, typename V>
Pair<K, V>::Pair(const Pair<K, V> &that)
: Key(that.Key), Value(that.Value)
{
}
template <typename K, typename V>
Pair<K, V> &Pair<K, V>::operator = (const Pair<K, V> &that)
{
if (this != &that)
{
this->Key = that.Key;
this->Value = that.Value;
}
return *this;
}
template <typename K, typename V>
bool Pair<K, V>::operator == (const Pair &that) const
{
return this->Key == that.Key;
}
template <typename K, typename V>
bool Pair<K, V>::operator != (const Pair &that) const
{
return this->Key != that.Key;
}
template <typename K, typename V>
bool Pair<K, V>::operator < (const Pair &that) const
{
return this->Key < that.Key;
}
template <typename K, typename V>
bool Pair<K, V>::operator > (const Pair &that) const
{
return this->Key > that.Key;
}
template <typename K, typename V>
bool Pair<K, V>::operator <= (const Pair &that) const
{
return this->Key <= that.Key;
}
template <typename K, typename V>
bool Pair<K, V>::operator >= (const Pair &that) const
{
return this->Key >= that.Key;
}
} // namespace xl
//
// For convenience of debugging, put the following code to the [AutoExpand] section of
// X:\Program Files\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\autoexp.dat
//
// ;------------------------------------------------------------------------------
// ; xl::Pair
// ;------------------------------------------------------------------------------
// xl::Pair<*>{
// preview (
// #(
// $e.Key,
// "->",
// $e.Value
// )
// )
// }
//
#endif // #ifndef __XLPAIR_H_E7935E32_4626_4FB9_B582_4D3DA2D9CF69_INCLUDED__
|
#pragma once
#include "Base.h"
namespace models {
class Ifrit : public Base {
public:
Ifrit();
virtual std::chrono::microseconds globalCooldown(const Actor* actor) const override;
virtual int maximumMP(const Actor* actor) const override { return 0; }
protected:
virtual DamageType _defaultDamageType() const override;
virtual std::chrono::microseconds _baseGlobalCooldown(const Actor* actor) const override;
virtual double _basePotencyMultiplier(const Actor* actor) const override;
virtual double _baseAutoAttackDamage(const Actor* actor) const override;
};
}
|
//
// AboutPageController.h
// FlashCards
//
// Created by Raul Chacon on 12/13/11.
// Copyright (c) 2011 Student. All rights reserved.
//
#import <UIKit/UIKit.h>
/*
* AboutPageController
* view controller with about contents displayed in a web view
*/
@interface AboutPageController : UIViewController
@property (nonatomic, strong) IBOutlet UIWebView *webView;
@end
|
/*************************************************************************/
/* test_validate_testing.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef TEST_VALIDATE_TESTING_H
#define TEST_VALIDATE_TESTING_H
#include "core/os/os.h"
#include "tests/test_macros.h"
#include "tests/test_tools.h"
TEST_SUITE("Validate tests") {
TEST_CASE("Always pass") {
CHECK(true);
}
TEST_CASE_PENDING("Pending tests are skipped") {
if (!doctest::getContextOptions()->no_skip) { // Normal run.
FAIL("This should be skipped if `--no-skip` is NOT set (missing `doctest::skip()` decorator?)");
} else {
CHECK_MESSAGE(true, "Pending test is run with `--no-skip`");
}
}
TEST_CASE("Muting Godot error messages") {
ERR_PRINT_OFF;
CHECK_MESSAGE(!_print_error_enabled, "Error printing should be disabled.");
ERR_PRINT("Still waiting for Godot!"); // This should never get printed!
ERR_PRINT_ON;
CHECK_MESSAGE(_print_error_enabled, "Error printing should be re-enabled.");
}
TEST_CASE("Stringify Variant types") {
Variant var;
INFO(var);
String string("Godot is finally here!");
INFO(string);
Vector2 vec2(0.5, 1.0);
INFO(vec2);
Vector2i vec2i(1, 2);
INFO(vec2i);
Rect2 rect2(0.5, 0.5, 100.5, 100.5);
INFO(rect2);
Rect2i rect2i(0, 0, 100, 100);
INFO(rect2i);
Vector3 vec3(0.5, 1.0, 2.0);
INFO(vec3);
Vector3i vec3i(1, 2, 3);
INFO(vec3i);
Transform2D trans2d(0.5, Vector2(100, 100));
INFO(trans2d);
Plane plane(Vector3(1, 1, 1), 1.0);
INFO(plane);
Quaternion quat(Vector3(0.5, 1.0, 2.0));
INFO(quat);
AABB aabb(Vector3(), Vector3(100, 100, 100));
INFO(aabb);
Basis basis(quat);
INFO(basis);
Transform3D trans(basis);
INFO(trans);
Color color(1, 0.5, 0.2, 0.3);
INFO(color);
StringName string_name("has_method");
INFO(string_name);
NodePath node_path("godot/sprite");
INFO(node_path);
INFO(RID());
Object *obj = memnew(Object);
INFO(obj);
Callable callable(obj, "has_method");
INFO(callable);
Signal signal(obj, "script_changed");
INFO(signal);
memdelete(obj);
Dictionary dict;
dict["string"] = string;
dict["color"] = color;
INFO(dict);
Array arr;
arr.push_back(string);
arr.push_back(color);
INFO(arr);
PackedByteArray byte_arr;
byte_arr.push_back(0);
byte_arr.push_back(1);
byte_arr.push_back(2);
INFO(byte_arr);
PackedInt32Array int32_arr;
int32_arr.push_back(0);
int32_arr.push_back(1);
int32_arr.push_back(2);
INFO(int32_arr);
PackedInt64Array int64_arr;
int64_arr.push_back(0);
int64_arr.push_back(1);
int64_arr.push_back(2);
INFO(int64_arr);
PackedFloat32Array float32_arr;
float32_arr.push_back(0.5);
float32_arr.push_back(1.5);
float32_arr.push_back(2.5);
INFO(float32_arr);
PackedFloat64Array float64_arr;
float64_arr.push_back(0.5);
float64_arr.push_back(1.5);
float64_arr.push_back(2.5);
INFO(float64_arr);
PackedStringArray str_arr = string.split(" ");
INFO(str_arr);
PackedVector2Array vec2_arr;
vec2_arr.push_back(Vector2(0, 0));
vec2_arr.push_back(Vector2(1, 1));
vec2_arr.push_back(Vector2(2, 2));
INFO(vec2_arr);
PackedVector3Array vec3_arr;
vec3_arr.push_back(Vector3(0, 0, 0));
vec3_arr.push_back(Vector3(1, 1, 1));
vec3_arr.push_back(Vector3(2, 2, 2));
INFO(vec3_arr);
PackedColorArray color_arr;
color_arr.push_back(Color(0, 0, 0));
color_arr.push_back(Color(1, 1, 1));
color_arr.push_back(Color(2, 2, 2));
INFO(color_arr);
// doctest string concatenation.
CHECK_MESSAGE(true, var, " ", vec2, " ", rect2, " ", color);
}
TEST_CASE("Detect error messages") {
ErrorDetector ed;
REQUIRE_FALSE(ed.has_error);
ERR_PRINT_OFF;
ERR_PRINT("Still waiting for Godot!");
ERR_PRINT_ON;
REQUIRE(ed.has_error);
}
}
#endif // TEST_VALIDATE_TESTING_H
|
#pragma once
#define UTF8SQL
namespace EAppEvent
{
enum
{
eAppTimerMgrOnTimer,
eAppGameDB,
eAppGWSvrSocketEvent,
eAppEventCount,
};
}
|
#include<stdio.h>
int main()
{
char ch,opl;
scanf("%ch", &ch);
opl='z'-(ch-'a');
printf("%c\n", opl);
return 0;
}
|
ConstantValue doAdd(std::vector<ExpressionPtr> args);
ConstantValue doSub(std::vector<ExpressionPtr> args);
ConstantValue doMul(std::vector<ExpressionPtr> args);
ConstantValue doMulU(std::vector<ExpressionPtr> args);
ConstantValue doMulS(std::vector<ExpressionPtr> args);
ConstantValue doOr(std::vector<ExpressionPtr> args);
ConstantValue doAnd(std::vector<ExpressionPtr> args);
ConstantValue doXor(std::vector<ExpressionPtr> args);
ConstantValue doShl(std::vector<ExpressionPtr> args);
ConstantValue doShr(std::vector<ExpressionPtr> args);
ConstantValue doSar(std::vector<ExpressionPtr> args);
ConstantValue doCmpEQ(std::vector<ExpressionPtr> args);
ConstantValue doCmpNE(std::vector<ExpressionPtr> args);
ConstantValue doNot(std::vector<ExpressionPtr> args);
ConstantValue doC64To8(std::vector<ExpressionPtr> args);
ConstantValue doC32To8(std::vector<ExpressionPtr> args);
ConstantValue doC64To16(std::vector<ExpressionPtr> args);
ConstantValue doC64LOto32(std::vector<ExpressionPtr> args);
ConstantValue doC64HIto32(std::vector<ExpressionPtr> args);
ConstantValue doC8UTo16(std::vector<ExpressionPtr> args);
ConstantValue doC8UTo64(std::vector<ExpressionPtr> args);
ConstantValue doC8UTo32(std::vector<ExpressionPtr> args);
ConstantValue doC8STo32(std::vector<ExpressionPtr> args);
ConstantValue doC16UTo64(std::vector<ExpressionPtr> args);
ConstantValue doC32To1(std::vector<ExpressionPtr> args);
ConstantValue doC64To1(std::vector<ExpressionPtr> args);
ConstantValue doC1UTo32(std::vector<ExpressionPtr> args);
ConstantValue doC1UTo8(std::vector<ExpressionPtr> args);
ConstantValue doC32STo64(std::vector<ExpressionPtr> args);
ConstantValue doC16STo32(std::vector<ExpressionPtr> args);
ConstantValue doC8STo16(std::vector<ExpressionPtr> args);
ConstantValue doDivModS64to32(std::vector<ExpressionPtr> args);
ConstantValue doDivModU64to32(std::vector<ExpressionPtr> args);
ConstantValue doC32HITo16(std::vector<ExpressionPtr> args);
ConstantValue doC32LOTo16(std::vector<ExpressionPtr> args);
ConstantValue doC16HITo8(std::vector<ExpressionPtr> args);
ConstantValue doC16LOTo8(std::vector<ExpressionPtr> args);
ConstantValue doCmpLTS(std::vector<ExpressionPtr> args);
ConstantValue doCmpLTU(std::vector<ExpressionPtr> args);
ConstantValue doCmpLES(std::vector<ExpressionPtr> args);
ConstantValue doCmpLEU(std::vector<ExpressionPtr> args);
ConstantValue doC16HLTo32(std::vector<ExpressionPtr> args);
ConstantValue doC16UTo32(std::vector<ExpressionPtr> args);
ConstantValue doC32Uto64(std::vector<ExpressionPtr> args);
ConstantValue doC32HLTo64(std::vector<ExpressionPtr> args);
ConstantValue doUSad8(std::vector<ExpressionPtr> args);
|
#pragma once
#include <memory>
#include <list>
#include <map>
#include <cppexpose/reflection/Object.h>
#include <gloperate/gloperate_api.h>
namespace gloperate
{
class Environment;
class AbstractEventConsumer;
class AbstractDeviceProvider;
class AbstractDevice;
class InputEvent;
/**
* @brief
* Manager for input device and consumers
*/
class GLOPERATE_API InputManager : public cppexpose::Object
{
public:
/**
* @brief
* Constructor
*
* @param[in] environment
* Environment to which the manager belongs (must NOT be null!)
*/
InputManager(Environment * environment);
/**
* @brief
* Destructor
*/
~InputManager();
/**
* @brief
* Register an event consumer at the input manager
*
* @param[in] consumer
* Event consumer (must NOT be null)
*/
void registerConsumer(AbstractEventConsumer * consumer);
/**
* @brief
* Deregister an event consumer from the input manager
*
* @param[in] consumer
* Event consumer (must NOT be null)
*/
void deregisterConsumer(AbstractEventConsumer * consumer);
/**
* @brief
* Add a device to the input manager
*
* @param[in] device
* Input device (must NOT be null)
*/
void addDevice(AbstractDevice * device);
/**
* @brief
* Forwards an Event to all registered Consumers
*
* @param event
* The Event to forward
*/
void onEvent(std::unique_ptr<InputEvent> && event);
protected:
// Scripting functions
int scr_onInput(const cppexpose::Variant & func);
protected:
Environment * m_environment; ///< Gloperate environment to which the manager belongs
std::list<AbstractEventConsumer *> m_consumers;
std::list<std::unique_ptr<AbstractDeviceProvider>> m_deviceProviders;
std::list<AbstractDevice *> m_devices;
std::list<std::unique_ptr<InputEvent>> m_events;
std::map<int, cppexpose::Function> m_callbacks;
int m_nextId; ///< Next callback ID
};
} // namespace gloperate
|
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) Electronic Arts Inc. All rights reserved.
/////////////////////////////////////////////////////////////////////////////
#ifndef EASTL_INTERNAL_MOVE_HELP_H
#define EASTL_INTERNAL_MOVE_HELP_H
#include <EABase/eabase.h>
#if defined(EA_PRAGMA_ONCE_SUPPORTED)
#pragma once
#endif
#include <EASTL/internal/config.h>
#include <EASTL/type_traits.h>
// C++11's rvalue references aren't supported by earlier versions of C++.
// It turns out that in a number of cases under earlier C++ versions we can
// write code that uses rvalues similar to lvalues. We have macros below for
// such cases. For example, eastl::move (same as std::move) can be treated
// as a no-op under C++03, though with the consequence that move functionality
// isn't taken advantage of.
/// EASTL_MOVE
/// Acts like eastl::move when possible. Same as C++11 std::move.
///
/// EASTL_MOVE_INLINE
/// Acts like eastl::move but is implemented inline instead of a function call.
/// This allows code to be faster in debug builds in particular.
/// Depends on C++ compiler decltype support or a similar extension.
///
/// EASTL_FORWARD
/// Acts like eastl::forward when possible. Same as C++11 std::forward.
///
/// EASTL_FORWARD_INLINE
/// Acts like eastl::forward but is implemented inline instead of a function call.
/// This allows code to be faster in debug builds in particular.
///
#define EASTL_MOVE(x) eastl::move(x)
#if !defined(EA_COMPILER_NO_DECLTYPE)
#define EASTL_MOVE_INLINE(x) static_cast<typename eastl::remove_reference<decltype(x)>::type&&>(x)
#elif defined(__GNUC__)
#define EASTL_MOVE_INLINE(x) static_cast<typename eastl::remove_reference<__typeof__(x)>::type&&>(x)
#else
#define EASTL_MOVE_INLINE(x) eastl::move(x)
#endif
#define EASTL_FORWARD(T, x) eastl::forward<T>(x)
#define EASTL_FORWARD_INLINE(T, x) eastl::forward<T>(x) // Need to investigate how to properly make a macro for this. (eastl::is_reference<T>::value ? static_cast<T&&>(static_cast<T&>(x)) : static_cast<T&&>(x))
/// EASTL_MOVE_RANGE
/// Acts like the eastl::move algorithm when possible. Same as C++11 std::move.
/// Note to be confused with the single argument move: (typename remove_reference<T>::type&& move(T&& x))
/// http://en.cppreference.com/w/cpp/algorithm/move
/// http://en.cppreference.com/w/cpp/algorithm/move_backward
///
#define EASTL_MOVE_RANGE(first, last, result) eastl::move(first, last, result)
#define EASTL_MOVE_BACKWARD_RANGE(first, last, resultEnd) eastl::move_backward(first, last, resultEnd)
namespace eastl
{
// forward
//
// forwards the argument to another function exactly as it was passed to the calling function.
// Not to be confused with move, this is specifically for echoing templated argument types
// to another function. move is specifically about making a type be an rvalue reference (i.e. movable) type.
//
// Example usage:
// template <class T>
// void WrapperFunction(T&& arg)
// { foo(eastl::forward<T>(arg)); }
//
// template <class... Args>
// void WrapperFunction(Args&&... args)
// { foo(eastl::forward<Args>(args)...); }
//
// See the C++ Standard, section 20.2.3
// http://en.cppreference.com/w/cpp/utility/forward
//
template <typename T>
EA_CPP14_CONSTEXPR T&& forward(typename eastl::remove_reference<T>::type& x) EA_NOEXCEPT
{
return static_cast<T&&>(x);
}
template <typename T>
EA_CPP14_CONSTEXPR T&& forward(typename eastl::remove_reference<T>::type&& x) EA_NOEXCEPT
{
static_assert(!is_lvalue_reference<T>::value, "forward T isn't lvalue reference");
return static_cast<T&&>(x);
}
// move
//
// move obtains an rvalue reference to its argument and converts it to an xvalue.
// Returns, by definition: static_cast<typename remove_reference<T>::type&&>(t).
// The primary use of this is to pass a move'd type to a function which takes T&&,
// and thus select that function instead of (e.g.) a function which takes T or T&.
// See the C++ Standard, section 20.2.3
// http://en.cppreference.com/w/cpp/utility/move
//
template <typename T>
EA_CPP14_CONSTEXPR typename eastl::remove_reference<T>::type&&
move(T&& x) EA_NOEXCEPT
{
return static_cast<typename eastl::remove_reference<T>::type&&>(x);
}
// move_if_noexcept
//
// Returns T&& if move-constructing T throws no exceptions. Instead returns const T& if
// move-constructing T throws exceptions or has no accessible copy constructor.
// The purpose of this is to use automatically use copy construction instead of move
// construction when the move may possible throw an exception.
// See the C++ Standard, section 20.2.3
// http://en.cppreference.com/w/cpp/utility/move_if_noexcept
//
#if EASTL_EXCEPTIONS_ENABLED
template <typename T>
EA_CPP14_CONSTEXPR typename eastl::conditional<!eastl::is_nothrow_move_constructible<T>::value &&
eastl::is_copy_constructible<T>::value, const T&, T&&>::type
move_if_noexcept(T& x) EA_NOEXCEPT
{
return eastl::move(x);
}
#else
template <typename T>
EA_CPP14_CONSTEXPR T&&
move_if_noexcept(T& x) EA_NOEXCEPT
{
return eastl::move(x);
}
#endif
} // namespace eastl
#endif // Header include guard
|
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#ifndef __STDAFX_H__
#define __STDAFX_H__
#pragma once
// Change these values to use different versions
#define WINVER 0x0400
#define _WIN32_IE 0x0500
#define _RICHEDIT_VER 0x0100
#include <atlbase.h>
#include <atlapp.h>
extern CAppModule _Module;
#include <atlwin.h>
#ifdef _EMBEDDED_MANIFEST
#if defined _M_IX86
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif // _EMBEDDED_MANIFEST
#endif //__STDAFX_H__
|
/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "buffer.h"
#include "hex-dec.h"
#include "unichar.h"
#include "istream-private.h"
#include "istream-jsonstr.h"
#define MAX_UTF8_LEN 6
struct jsonstr_istream {
struct istream_private istream;
/* The end '"' was found */
unsigned int str_end:1;
};
static int
i_stream_jsonstr_read_parent(struct jsonstr_istream *jstream,
unsigned int min_bytes)
{
struct istream_private *stream = &jstream->istream;
size_t size, avail;
ssize_t ret;
size = i_stream_get_data_size(stream->parent);
while (size < min_bytes) {
ret = i_stream_read(stream->parent);
if (ret <= 0 && (ret != -2 || stream->skip == 0)) {
stream->istream.stream_errno =
stream->parent->stream_errno;
stream->istream.eof = stream->parent->eof;
return ret;
}
size = i_stream_get_data_size(stream->parent);
}
if (!i_stream_try_alloc(stream, size, &avail))
return -2;
return 1;
}
static int
i_stream_json_unescape(const unsigned char *src, unsigned char *dest,
unsigned int *src_size_r, unsigned int *dest_size_r)
{
switch (*src) {
case '"':
case '\\':
case '/':
*dest = *src;
break;
case 'b':
*dest = '\b';
break;
case 'f':
*dest = '\f';
break;
case 'n':
*dest = '\n';
break;
case 'r':
*dest = '\r';
break;
case 't':
*dest = '\t';
break;
case 'u': {
buffer_t buf;
buffer_create_from_data(&buf, dest, MAX_UTF8_LEN);
uni_ucs4_to_utf8_c(hex2dec(src+1, 4), &buf);
*src_size_r = 5;
*dest_size_r = buf.used;
return 0;
}
default:
return -1;
}
*src_size_r = 1;
*dest_size_r = 1;
return 0;
}
static ssize_t i_stream_jsonstr_read(struct istream_private *stream)
{
struct jsonstr_istream *jstream = (struct jsonstr_istream *)stream;
const unsigned char *data;
unsigned int srcskip, destskip, extra;
size_t i, dest, size;
ssize_t ret;
if (jstream->str_end) {
stream->istream.eof = TRUE;
return -1;
}
ret = i_stream_jsonstr_read_parent(jstream, 1);
if (ret <= 0)
return ret;
/* @UNSAFE */
dest = stream->pos;
extra = 0;
data = i_stream_get_data(stream->parent, &size);
for (i = 0; i < size && dest < stream->buffer_size; ) {
if (data[i] == '"') {
jstream->str_end = TRUE;
if (dest == stream->pos) {
stream->istream.eof = TRUE;
return -1;
}
break;
} else if (data[i] == '\\') {
if (i+1 == size) {
/* not enough input for \x */
extra = 1;
break;
}
if ((data[i+1] == 'u' && i+1+4 >= size)) {
/* not enough input for \u0000 */
extra = 5;
break;
}
if (data[i+1] == 'u' && stream->buffer_size - dest < MAX_UTF8_LEN) {
/* UTF8 output is max. 6 chars */
if (dest == stream->pos)
return -2;
break;
}
i++;
if (i_stream_json_unescape(data + i,
stream->w_buffer + dest,
&srcskip, &destskip) < 0) {
/* invalid string */
io_stream_set_error(&stream->iostream,
"Invalid JSON string");
stream->istream.stream_errno = EINVAL;
return -1;
}
i += srcskip;
i_assert(i <= size);
dest += destskip;
i_assert(dest <= stream->buffer_size);
} else {
stream->w_buffer[dest++] = data[i];
i++;
}
}
i_stream_skip(stream->parent, i);
ret = dest - stream->pos;
if (ret == 0) {
/* not enough input */
i_assert(extra > 0);
ret = i_stream_jsonstr_read_parent(jstream, i+extra+1);
if (ret <= 0)
return ret;
return i_stream_jsonstr_read(stream);
}
i_assert(ret > 0);
stream->pos = dest;
return ret;
}
struct istream *i_stream_create_jsonstr(struct istream *input)
{
struct jsonstr_istream *dstream;
dstream = i_new(struct jsonstr_istream, 1);
dstream->istream.max_buffer_size = input->real_stream->max_buffer_size;
dstream->istream.read = i_stream_jsonstr_read;
dstream->istream.istream.readable_fd = FALSE;
dstream->istream.istream.blocking = input->blocking;
dstream->istream.istream.seekable = FALSE;
return i_stream_create(&dstream->istream, input,
i_stream_get_fd(input));
}
|
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2016-2019 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef __cplusplus
#error This header can only be compiled as C++.
#endif
#ifndef BITCOIN_PROTOCOL_H
#define BITCOIN_PROTOCOL_H
#include "netbase.h"
#include "serialize.h"
#include "uint256.h"
#include "version.h"
#include <stdint.h>
#include <string>
#define MESSAGE_START_SIZE 4
/** Message header.
* (4) message start.
* (12) command.
* (4) size.
* (4) checksum.
*/
class CMessageHeader
{
public:
CMessageHeader();
CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn);
std::string GetCommand() const;
bool IsValid() const;
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
{
READWRITE(FLATDATA(pchMessageStart));
READWRITE(FLATDATA(pchCommand));
READWRITE(nMessageSize);
READWRITE(nChecksum);
}
// TODO: make private (improves encapsulation)
public:
enum {
COMMAND_SIZE = 12,
MESSAGE_SIZE_SIZE = sizeof(int),
CHECKSUM_SIZE = sizeof(int),
MESSAGE_SIZE_OFFSET = MESSAGE_START_SIZE + COMMAND_SIZE,
CHECKSUM_OFFSET = MESSAGE_SIZE_OFFSET + MESSAGE_SIZE_SIZE,
HEADER_SIZE = MESSAGE_START_SIZE + COMMAND_SIZE + MESSAGE_SIZE_SIZE + CHECKSUM_SIZE
};
char pchMessageStart[MESSAGE_START_SIZE];
char pchCommand[COMMAND_SIZE];
unsigned int nMessageSize;
unsigned int nChecksum;
};
/** nServices flags */
enum {
NODE_NETWORK = (1 << 0),
// NODE_BLOOM means the node is capable and willing to handle bloom-filtered connections.
// Bitcoin Core nodes used to support this by default, without advertising this bit,
// but no longer do as of protocol version 70011 (= NO_BLOOM_VERSION)
NODE_BLOOM = (1 << 2),
// NODE_BLOOM_WITHOUT_MN means the node has the same features as NODE_BLOOM with the only difference
// that the node doens't want to receive master nodes messages. (the 1<<3 was not picked as constant because on bitcoin 0.14 is witness and we want that update here )
NODE_BLOOM_WITHOUT_MN = (1 << 4),
// Bits 24-31 are reserved for temporary experiments. Just pick a bit that
// isn't getting used, or one not being used much, and notify the
// bitcoin-development mailing list. Remember that service bits are just
// unauthenticated advertisements, so your code must be robust against
// collisions and other cases where nodes may be advertising a service they
// do not actually support. Other service bits should be allocated via the
// BIP process.
};
/** A CService with information about it as peer */
class CAddress : public CService
{
public:
CAddress();
explicit CAddress(CService ipIn, uint64_t nServicesIn = NODE_NETWORK);
void Init();
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
{
if (ser_action.ForRead())
Init();
if (nType & SER_DISK)
READWRITE(nVersion);
if ((nType & SER_DISK) ||
(nVersion >= CADDR_TIME_VERSION && !(nType & SER_GETHASH)))
READWRITE(nTime);
READWRITE(nServices);
READWRITE(*(CService*)this);
}
// TODO: make private (improves encapsulation)
public:
uint64_t nServices;
// disk and network only
unsigned int nTime;
};
/** inv message data */
class CInv
{
public:
CInv();
CInv(int typeIn, const uint256& hashIn);
CInv(const std::string& strType, const uint256& hashIn);
ADD_SERIALIZE_METHODS;
template <typename Stream, typename Operation>
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion)
{
READWRITE(type);
READWRITE(hash);
}
friend bool operator<(const CInv& a, const CInv& b);
bool IsKnownType() const;
bool IsMasterNodeType() const;
const char* GetCommand() const;
std::string ToString() const;
// TODO: make private (improves encapsulation)
public:
int type;
uint256 hash;
};
enum {
MSG_TX = 1,
MSG_BLOCK,
// Nodes may always request a MSG_FILTERED_BLOCK in a getdata, however,
// MSG_FILTERED_BLOCK should not appear in any invs except as a part of getdata.
MSG_FILTERED_BLOCK,
MSG_TXLOCK_REQUEST,
MSG_TXLOCK_VOTE,
MSG_SPORK,
MSG_MASTERNODE_WINNER,
MSG_MASTERNODE_SCANNING_ERROR,
MSG_BUDGET_VOTE,
MSG_BUDGET_PROPOSAL,
MSG_BUDGET_FINALIZED,
MSG_BUDGET_FINALIZED_VOTE,
MSG_MASTERNODE_QUORUM,
MSG_MASTERNODE_ANNOUNCE,
MSG_MASTERNODE_PING,
MSG_DSTX
};
#endif // BITCOIN_PROTOCOL_H
|
//
// DKFilterModel.h
// Partner
//
// Created by Drinking on 14-12-19.
// Copyright (c) 2014年 zhinanmao.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSInteger, DKFilterType){
DK_SELECTION_SINGLE,DK_SELECTION_MULTIPLE,DK_SELECTION_PICK
};
typedef NS_ENUM(NSInteger, DKFilterViewStyle){
DKFilterViewDefault,DKFilterViewStyle1
};
@interface DKFilterModel : NSObject
@property (nonatomic,assign) DKFilterType type;
@property (nonatomic,strong,readonly) NSArray *elements;
@property (nonatomic,strong) NSArray *choices;
@property (nonatomic,strong) UIView *cachedView;
@property (nonatomic,copy) NSString *title;
@property (nonatomic,strong) NSDictionary *originData;
@property (nonatomic,assign) NSInteger tag;
@property (nonatomic,assign) DKFilterViewStyle style;
@property (nonatomic,copy) NSString *clickedButtonText;
- (instancetype)initElement:(NSArray*)array ofType:(DKFilterType)type;
- (UIView *)getCustomeViewofWidth:(CGFloat)width;
- (NSArray *)getFilterResult;
@end
|
//
// BluetoothPort.h
// StarIOPort
//
// Created by u3237 on 2017/03/09.
//
//
#import "ExternalAccessoryPort.h"
#import "Util.h"
@interface BluetoothPort : ExternalAccessoryPort
@end
|
/**
* @file pause_us.c
*
* @author Andy Lindsay
*
* @version 0.85
*
* @copyright Copyright (C) Parallax, Inc. 2012. See end of file for
* terms of use (MIT License).
*
* @brief pause function source, see simpletools.h for documentation.
*
* @detail Please submit bug reports, suggestions, and improvements to
* this code to editor@parallax.com.
*/
#include "simpletools.h" // simpletools function prototypes
void pause_us(unsigned int microseconds) // pause function definition
{
usleep(microseconds);
}
/**
* TERMS OF USE: MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
|
#import <Foundation/Foundation.h>
#import "ASPObject.h"
/**
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen
* Do not edit the class manually.
*/
#import "ASPExtendedAttribute.h"
#import "ASPOutlineCode.h"
@protocol ASPResource
@end
@interface ASPResource : ASPObject
@property(nonatomic) NSString* name;
@property(nonatomic) NSNumber* uid;
@property(nonatomic) NSNumber* _id;
@property(nonatomic) NSString* type;
@property(nonatomic) NSNumber* isNull;
@property(nonatomic) NSString* initials;
@property(nonatomic) NSString* phonetics;
@property(nonatomic) NSString* ntAccount;
@property(nonatomic) NSString* materialLabel;
@property(nonatomic) NSString* code;
@property(nonatomic) NSString* group;
@property(nonatomic) NSString* emailAddress;
@property(nonatomic) NSString* hyperlink;
@property(nonatomic) NSString* hyperlinkAddress;
@property(nonatomic) NSString* hyperlinkSubAddress;
@property(nonatomic) NSNumber* maxUnits;
@property(nonatomic) NSNumber* peakUnits;
@property(nonatomic) NSNumber* overAllocated;
@property(nonatomic) NSDate* availableFrom;
@property(nonatomic) NSDate* availableTo;
@property(nonatomic) NSDate* start;
@property(nonatomic) NSDate* finish;
@property(nonatomic) NSNumber* canLevel;
@property(nonatomic) NSString* accrueAt;
@property(nonatomic) NSString* work;
@property(nonatomic) NSString* regularWork;
@property(nonatomic) NSString* overtimeWork;
@property(nonatomic) NSString* actualWork;
@property(nonatomic) NSString* remainingWork;
@property(nonatomic) NSString* actualOvertimeWork;
@property(nonatomic) NSString* remainingOvertimeWork;
@property(nonatomic) NSNumber* percentWorkComplete;
@property(nonatomic) NSNumber* standardRate;
@property(nonatomic) NSString* standardRateFormat;
@property(nonatomic) NSNumber* cost;
@property(nonatomic) NSString* overtimeRateFormat;
@property(nonatomic) NSNumber* overtimeCost;
@property(nonatomic) NSNumber* costPerUse;
@property(nonatomic) NSNumber* actualCost;
@property(nonatomic) NSNumber* actualOvertimeCost;
@property(nonatomic) NSNumber* remainingCost;
@property(nonatomic) NSNumber* remainingOvertimeCost;
@property(nonatomic) NSNumber* workVariance;
@property(nonatomic) NSNumber* costVariance;
@property(nonatomic) NSNumber* sv;
@property(nonatomic) NSNumber* cv;
@property(nonatomic) NSNumber* acwp;
@property(nonatomic) NSNumber* calendarUid;
@property(nonatomic) NSString* notesText;
@property(nonatomic) NSNumber* bcws;
@property(nonatomic) NSNumber* bcwp;
@property(nonatomic) NSNumber* isGeneric;
@property(nonatomic) NSNumber* isInactive;
@property(nonatomic) NSNumber* isEnterprise;
@property(nonatomic) NSString* bookingType;
@property(nonatomic) NSString* actualWorkProtected;
@property(nonatomic) NSString* actualOvertimeWorkProtected;
@property(nonatomic) NSString* activeDirectoryGuid;
@property(nonatomic) NSDate* creationDate;
@property(nonatomic) NSString* costCenter;
@property(nonatomic) NSNumber* isCostResource;
@property(nonatomic) NSNumber* teamAssignmentPool;
@property(nonatomic) NSString* assignmentOwner;
@property(nonatomic) NSString* assignmentOwnerGuid;
@property(nonatomic) NSNumber* isBudget;
@property(nonatomic) NSString* budgetWork;
@property(nonatomic) NSNumber* budgetCost;
@property(nonatomic) NSNumber* overtimeRate;
@property(nonatomic) NSString* baselineWork;
@property(nonatomic) NSNumber* baselineCost;
@property(nonatomic) NSNumber* baselineBcws;
@property(nonatomic) NSNumber* baselineBcwp;
@property(nonatomic) NSString* baseline1Work;
@property(nonatomic) NSNumber* baseline1Cost;
@property(nonatomic) NSNumber* baseline1Bcws;
@property(nonatomic) NSNumber* baseline1Bcwp;
@property(nonatomic) NSString* baseline2Work;
@property(nonatomic) NSNumber* baseline2Cost;
@property(nonatomic) NSNumber* baseline2Bcws;
@property(nonatomic) NSNumber* baseline2Bcwp;
@property(nonatomic) NSString* baseline3Work;
@property(nonatomic) NSNumber* baseline3Cost;
@property(nonatomic) NSNumber* baseline3Bcws;
@property(nonatomic) NSNumber* baseline3Bcwp;
@property(nonatomic) NSString* baseline4Work;
@property(nonatomic) NSNumber* baseline4Cost;
@property(nonatomic) NSNumber* baseline4Bcws;
@property(nonatomic) NSNumber* baseline4Bcwp;
@property(nonatomic) NSString* baseline5Work;
@property(nonatomic) NSNumber* baseline5Cost;
@property(nonatomic) NSNumber* baseline5Bcws;
@property(nonatomic) NSNumber* baseline5Bcwp;
@property(nonatomic) NSString* baseline6Work;
@property(nonatomic) NSNumber* baseline6Cost;
@property(nonatomic) NSNumber* baseline6Bcws;
@property(nonatomic) NSNumber* baseline6Bcwp;
@property(nonatomic) NSString* baseline7Work;
@property(nonatomic) NSNumber* baseline7Cost;
@property(nonatomic) NSNumber* baseline7Bcws;
@property(nonatomic) NSNumber* baseline7Bcwp;
@property(nonatomic) NSString* baseline8Work;
@property(nonatomic) NSNumber* baseline8Cost;
@property(nonatomic) NSNumber* baseline8Bcws;
@property(nonatomic) NSNumber* baseline8Bcwp;
@property(nonatomic) NSString* baseline9Work;
@property(nonatomic) NSNumber* baseline9Cost;
@property(nonatomic) NSNumber* baseline9Bcws;
@property(nonatomic) NSNumber* baseline9Bcwp;
@property(nonatomic) NSString* baseline10Work;
@property(nonatomic) NSNumber* baseline10Cost;
@property(nonatomic) NSNumber* baseline10Bcws;
@property(nonatomic) NSNumber* baseline10Bcwp;
@property(nonatomic) NSArray<ASPExtendedAttribute>* extendedAttributes;
@property(nonatomic) NSArray<ASPOutlineCode>* outlineCodes;
@end
|
/* SPDX-License-Identifier: LGPL-2.1+ */
#pragma once
#include <curl/curl.h>
#include <sys/types.h>
#include "sd-event.h"
#include "hashmap.h"
typedef struct CurlGlue CurlGlue;
struct CurlGlue {
sd_event *event;
CURLM *curl;
sd_event_source *timer;
Hashmap *ios;
Hashmap *translate_fds;
void (*on_finished)(CurlGlue *g, CURL *curl, CURLcode code);
void *userdata;
};
int curl_glue_new(CurlGlue **glue, sd_event *event);
CurlGlue* curl_glue_unref(CurlGlue *glue);
DEFINE_TRIVIAL_CLEANUP_FUNC(CurlGlue*, curl_glue_unref);
int curl_glue_make(CURL **ret, const char *url, void *userdata);
int curl_glue_add(CurlGlue *g, CURL *c);
void curl_glue_remove_and_free(CurlGlue *g, CURL *c);
struct curl_slist *curl_slist_new(const char *first, ...) _sentinel_;
int curl_header_strdup(const void *contents, size_t sz, const char *field, char **value);
int curl_parse_http_time(const char *t, usec_t *ret);
DEFINE_TRIVIAL_CLEANUP_FUNC(CURL*, curl_easy_cleanup);
DEFINE_TRIVIAL_CLEANUP_FUNC(struct curl_slist*, curl_slist_free_all);
|
/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only 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.
*/
#ifndef __MSM_PERIPHERAL_LOADER_H
#define __MSM_PERIPHERAL_LOADER_H
#include <linux/dma-attrs.h>
struct device;
struct module;
struct pil_priv;
/**
* struct pil_desc - PIL descriptor
* @name: string used for pil_get()
* @dev: parent device
* @ops: callback functions
* @owner: module the descriptor belongs to
* @proxy_timeout: delay in ms until proxy vote is removed
* @flags: bitfield for image flags
* @priv: DON'T USE - internal only
* @attrs: DMA attributes to be used during dma allocation.
* @proxy_unvote_irq: IRQ to trigger a proxy unvote. proxy_timeout
* is ignored if this is set.
* @map_fw_mem: Custom function used to map physical address space to virtual.
* This defaults to ioremap if not specified.
* @unmap_fw_mem: Custom function used to undo mapping by map_fw_mem.
* This defaults to iounmap if not specified.
*/
struct pil_desc {
const char *name;
struct device *dev;
const struct pil_reset_ops *ops;
struct module *owner;
unsigned long proxy_timeout;
unsigned long flags;
#define PIL_SKIP_ENTRY_CHECK BIT(0)
struct pil_priv *priv;
struct dma_attrs attrs;
unsigned int proxy_unvote_irq;
void * (*map_fw_mem)(phys_addr_t phys, size_t size, void *data);
void (*unmap_fw_mem)(void *virt, size_t size, void *data);
void *map_data;
};
/**
* struct pil_image_info - info in IMEM about image and where it is loaded
* @name: name of image (may or may not be NULL terminated)
* @start: indicates physical address where image starts (little endian)
* @size: size of image (little endian)
*/
struct pil_image_info {
char name[8];
__le64 start;
__le32 size;
} __attribute__((__packed__));
/**
* struct pil_reset_ops - PIL operations
* @init_image: prepare an image for authentication
* @mem_setup: prepare the image memory region
* @verify_blob: authenticate a program segment, called once for each loadable
* program segment (optional)
* @proxy_vote: make proxy votes before auth_and_reset (optional)
* @auth_and_reset: boot the processor
* @proxy_unvote: remove any proxy votes (optional)
* @deinit_image: restore actions performed in init_image if necessary
* @shutdown: shutdown the processor
*/
struct pil_reset_ops {
int (*init_image)(struct pil_desc *pil, const u8 *metadata,
size_t size);
int (*mem_setup)(struct pil_desc *pil, phys_addr_t addr, size_t size);
int (*verify_blob)(struct pil_desc *pil, phys_addr_t phy_addr,
size_t size);
int (*proxy_vote)(struct pil_desc *pil);
int (*auth_and_reset)(struct pil_desc *pil);
void (*proxy_unvote)(struct pil_desc *pil);
int (*deinit_image)(struct pil_desc *pil);
int (*shutdown)(struct pil_desc *pil);
};
#ifdef CONFIG_MSM_PIL
extern int pil_desc_init(struct pil_desc *desc);
extern int pil_boot(struct pil_desc *desc);
extern void pil_shutdown(struct pil_desc *desc);
extern void pil_free(struct pil_desc *desc);
extern void pil_desc_release(struct pil_desc *desc);
extern phys_addr_t pil_get_entry_addr(struct pil_desc *desc);
extern int pil_do_ramdump(struct pil_desc *desc, void *ramdump_dev);
#else
static inline int pil_desc_init(struct pil_desc *desc) { return 0; }
static inline int pil_boot(struct pil_desc *desc) { return 0; }
static inline void pil_shutdown(struct pil_desc *desc) { }
static inline void pil_free(struct pil_desc *desc) { }
static inline void pil_desc_release(struct pil_desc *desc) { }
static inline phys_addr_t pil_get_entry_addr(struct pil_desc *desc)
{
return 0;
}
static inline int pil_do_ramdump(struct pil_desc *desc, void *ramdump_dev)
{
return 0;
}
#endif
#endif
|
/* ----------------------------------------------------------------------
LIGGGHTS - LAMMPS Improved for General Granular and Granular Heat
Transfer Simulations
LIGGGHTS is part of the CFDEMproject
www.liggghts.com | www.cfdem.com
Christoph Kloss, christoph.kloss@cfdem.com
Copyright 2009-2012 JKU Linz
Copyright 2012- DCS Computing GmbH, Linz
LIGGGHTS is based on LAMMPS
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
This software is distributed under the GNU General Public License.
See the README file in the top-level directory.
------------------------------------------------------------------------- */
#ifndef LMP_FIX_CONTACTPROPERTY_ATOM_H
#define LMP_FIX_CONTACTPROPERTY_ATOM_H
#include "fix_contact_history.h"
namespace LAMMPS_NS {
class FixContactPropertyAtom : public FixContactHistory {
public:
void do_forward_comm() {}
void reset_history() {}
inline bool has_partner(int,int)
{return false;}
inline void add_partner(int,int,double *) {}
};
}
#endif
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#ifdef BOND_CLASS
// clang-format off
BondStyle(harmonic/shift/cut/omp,BondHarmonicShiftCutOMP);
// clang-format on
#else
#ifndef LMP_BOND_HARMONIC_SHIFT_CUT_OMP_H
#define LMP_BOND_HARMONIC_SHIFT_CUT_OMP_H
#include "bond_harmonic_shift_cut.h"
#include "thr_omp.h"
namespace LAMMPS_NS {
class BondHarmonicShiftCutOMP : public BondHarmonicShiftCut, public ThrOMP {
public:
BondHarmonicShiftCutOMP(class LAMMPS *lmp);
virtual void compute(int, int);
private:
template <int EVFLAG, int EFLAG, int NEWTON_BOND>
void eval(int ifrom, int ito, ThrData *const thr);
};
} // namespace LAMMPS_NS
#endif
#endif
|
/*
* Paparazzi $Id$
*
* Copyright (C) 2009 Pascal Brisset, Antoine Drouin
*
* This file is part of paparazzi.
*
* paparazzi 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.
*
* paparazzi 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 paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/*
*\brief architecture independant timing functions
*
*/
#ifndef SYS_TIME_H
#define SYS_TIME_H
#include <inttypes.h>
#include BOARD_CONFIG
extern uint16_t cpu_time_sec;
#define SYS_TICS_OF_USEC(us) SYS_TICS_OF_SEC((us) * 1e-6)
#define SYS_TICS_OF_NSEC(ns) SYS_TICS_OF_SEC((ns) * 1e-9)
#define SIGNED_SYS_TICS_OF_USEC(us) SIGNED_SYS_TICS_OF_SEC((us) * 1e-6)
#define SIGNED_SYS_TICS_OF_NSEC(us) SIGNED_SYS_TICS_OF_SEC((us) * 1e-9)
#define TIME_TICKS_PER_SEC SYS_TICS_OF_SEC( 1.)
#define FIFTY_MS SYS_TICS_OF_SEC( 50e-3 )
#define AVR_PERIOD_MS SYS_TICS_OF_SEC( 16.666e-3 )
#include "sys_time_hw.h"
#endif /* SYS_TIME_H */
|
/* -*- c++ -*- ----------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef ANGLE_CLASS
// clang-format off
AngleStyle(charmm,AngleCharmm);
// clang-format on
#else
#ifndef LMP_ANGLE_CHARMM_H
#define LMP_ANGLE_CHARMM_H
#include "angle.h"
namespace LAMMPS_NS {
class AngleCharmm : public Angle {
public:
AngleCharmm(class LAMMPS *);
virtual ~AngleCharmm();
virtual void compute(int, int);
virtual void coeff(int, char **);
double equilibrium_angle(int);
void write_restart(FILE *);
virtual void read_restart(FILE *);
void write_data(FILE *);
double single(int, int, int, int);
protected:
double *k, *theta0, *k_ub, *r_ub;
virtual void allocate();
};
} // namespace LAMMPS_NS
#endif
#endif
/* ERROR/WARNING messages:
E: Incorrect args for angle coefficients
Self-explanatory. Check the input script or data file.
*/
|
/**
* Copyright (C) 2010-2014 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 mali_device_pause_resume.c
* Implementation of the Mali pause/resume functionality
*/
#include <linux/module.h>
#include <linux/mali/mali_utgard.h>
#include "mali_pm.h"
void mali_dev_pause(void)
{
/*
* Deactive all groups to prevent hardware being touched
* during the period of mali device pausing
*/
mali_pm_os_suspend(MALI_FALSE);
}
EXPORT_SYMBOL(mali_dev_pause);
void mali_dev_resume(void)
{
mali_pm_os_resume();
}
EXPORT_SYMBOL(mali_dev_resume);
|
// Copyright 2015, VIXL authors
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of ARM Limited 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 CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// ---------------------------------------------------------------------
// This file is auto generated using tools/generate_simulator_traces.py.
//
// PLEASE DO NOT EDIT.
// ---------------------------------------------------------------------
#ifndef VIXL_SIM_FCVTNU_WH_TRACE_AARCH64_H_
#define VIXL_SIM_FCVTNU_WH_TRACE_AARCH64_H_
const uint32_t kExpected_fcvtnu_wh[] = {
0u,
0u,
0u,
0u,
1u,
1u,
1u,
1u,
2u,
10u,
65504u,
4294967295u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
1024u,
1025u,
1026u,
1027u,
1347u,
2044u,
2045u,
2046u,
2047u,
512u,
512u,
513u,
514u,
912u,
1022u,
1022u,
1023u,
1024u,
256u,
256u,
256u,
257u,
332u,
511u,
511u,
512u,
512u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
0u,
};
const unsigned kExpectedCount_fcvtnu_wh = 101;
#endif // VIXL_SIM_FCVTNU_WH_TRACE_AARCH64_H_
|
#pragma once
#include <string.h>
#include <string>
#include <vector>
namespace base {
#define streq(a, b) (strcmp((a), (b)) == 0)
bool startswith(const char* str, const char* head);
bool endswith(const char* str, const char* head);
// format as -#,###.##
std::string format_decimal(double val);
std::string format_decimal(int val);
std::vector<std::string> strsplit(const std::string& str, const char sep = ' ');
} // namespace base
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
#include <arch/romstage.h>
#include <cbmem.h>
#include <southbridge/intel/i82371eb/i82371eb.h>
#include <northbridge/intel/i440bx/raminit.h>
void mainboard_romstage_entry(void)
{
i82371eb_early_init();
sdram_initialize(0);
cbmem_initialize_empty();
}
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2008 Advanced Micro Devices, 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 St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* This file was generated by getpir.c, do not modify!
(but if you do, please run checkpir on it to verify)
Contains the IRQ Routing Table dumped directly from your memory , wich BIOS sets up
Documentation at : http://www.microsoft.com/hwdev/busbios/PCIIRQ.HTM
*/
#include <console/console.h>
#include <device/pci.h>
#include <string.h>
#include <stdint.h>
#include <arch/pirq_routing.h>
#include <cpu/amd/amdk8_sysconf.h>
static void write_pirq_info(struct irq_info *pirq_info, u8 bus, u8 devfn,
u8 link0, u16 bitmap0, u8 link1, u16 bitmap1,
u8 link2, u16 bitmap2, u8 link3, u16 bitmap3,
u8 slot, u8 rfu)
{
pirq_info->bus = bus;
pirq_info->devfn = devfn;
pirq_info->irq[0].link = link0;
pirq_info->irq[0].bitmap = bitmap0;
pirq_info->irq[1].link = link1;
pirq_info->irq[1].bitmap = bitmap1;
pirq_info->irq[2].link = link2;
pirq_info->irq[2].bitmap = bitmap2;
pirq_info->irq[3].link = link3;
pirq_info->irq[3].bitmap = bitmap3;
pirq_info->slot = slot;
pirq_info->rfu = rfu;
}
extern u8 bus_rs690[8];
extern u8 bus_sb600[2];
extern u32 sbdn_sb600;
unsigned long write_pirq_routing_table(unsigned long addr)
{
struct irq_routing_table *pirq;
struct irq_info *pirq_info;
u32 slot_num;
u8 *v;
u8 sum = 0;
int i;
get_bus_conf(); /* it will find out all bus num and apic that share with mptable.c and mptable.c and acpi_tables.c */
/* Align the table to be 16 byte aligned. */
addr += 15;
addr &= ~15;
/* This table must be betweeen 0xf0000 & 0x100000 */
printk(BIOS_INFO, "Writing IRQ routing tables to 0x%lx...", addr);
pirq = (void *)(addr);
v = (u8 *) (addr);
pirq->signature = PIRQ_SIGNATURE;
pirq->version = PIRQ_VERSION;
pirq->rtr_bus = bus_sb600[0];
pirq->rtr_devfn = ((sbdn_sb600 + 0x14) << 3) | 4;
pirq->exclusive_irqs = 0;
pirq->rtr_vendor = 0x1002;
pirq->rtr_device = 0x4384;
pirq->miniport_data = 0;
memset(pirq->rfu, 0, sizeof(pirq->rfu));
pirq_info = (void *)(&pirq->checksum + 1);
slot_num = 0;
/* pci bridge */
write_pirq_info(pirq_info, bus_sb600[0], ((sbdn_sb600 + 0x14) << 3) | 4,
0x1, 0xdef8, 0x2, 0xdef8, 0x3, 0xdef8, 0x4, 0xdef8, 0,
0);
pirq_info++;
slot_num++;
pirq->size = 32 + 16 * slot_num;
for (i = 0; i < pirq->size; i++)
sum += v[i];
sum = pirq->checksum - sum;
if (sum != pirq->checksum) {
pirq->checksum = sum;
}
printk(BIOS_INFO, "write_pirq_routing_table done.\n");
return (unsigned long)pirq_info;
}
|
/*
* Copyright (c) 1997 Adrian Sun (asun@zoology.washington.edu)
* All Rights Reserved. See COPYRIGHT.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif /* HAVE_CONFIG_H */
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <atalk/afp.h>
#include <atalk/dsi.h>
#include <atalk/util.h>
#include <atalk/unix.h>
#include <atalk/logger.h>
#include <atalk/globals.h>
#include "misc.h"
#define MAXMESGSIZE 199
/* this is only used by afpd children, so it's okay. */
static char servermesg[MAXPATHLEN] = "";
static char localized_message[MAXPATHLEN] = "";
void setmessage(const char *message)
{
strlcpy(servermesg, message, MAXMESGSIZE);
}
void readmessage(AFPObj *obj)
{
/* Read server message from file defined as SERVERTEXT */
#ifdef SERVERTEXT
FILE *message;
char * filename;
unsigned int i;
int rc;
static int c;
uint32_t maxmsgsize;
maxmsgsize = MIN(MAX(obj->dsi->attn_quantum, MAXMESGSIZE), MAXPATHLEN);
i=0;
/* Construct file name SERVERTEXT/message.[pid] */
if ( NULL == (filename=(char*) malloc(sizeof(SERVERTEXT)+15)) ) {
LOG(log_error, logtype_afpd, "readmessage: malloc: %s", strerror(errno) );
return;
}
sprintf(filename, "%s/message.%d", SERVERTEXT, getpid());
#ifdef DEBUG
LOG(log_debug9, logtype_afpd, "Reading file %s ", filename);
#endif
message=fopen(filename, "r");
if (message==NULL) {
/* try without the process id */
sprintf(filename, "%s/message", SERVERTEXT);
message=fopen(filename, "r");
}
/* if either message.pid or message exists */
if (message!=NULL) {
/* added while loop to get characters and put in servermesg */
while ((( c=fgetc(message)) != EOF) && (i < (maxmsgsize - 1))) {
if ( c == '\n') c = ' ';
servermesg[i++] = c;
}
servermesg[i] = 0;
/* cleanup */
fclose(message);
become_root();
if ((rc = unlink(filename)) != 0)
LOG(log_error, logtype_afpd, "File '%s' could not be deleted", strerror(errno));
unbecome_root();
if (rc < 0) {
LOG(log_error, logtype_afpd, "Error deleting %s: %s", filename, strerror(rc));
}
#ifdef DEBUG
else {
LOG(log_debug9, logtype_afpd, "Deleted %s", filename);
}
LOG(log_debug9, logtype_afpd, "Set server message to \"%s\"", servermesg);
#endif
}
free(filename);
#endif /* SERVERTEXT */
}
int afp_getsrvrmesg(AFPObj *obj, char *ibuf, size_t ibuflen _U_, char *rbuf, size_t *rbuflen)
{
char *message;
uint16_t type, bitmap;
uint16_t msgsize;
size_t outlen = 0;
size_t msglen = 0;
int utf8 = 0;
*rbuflen = 0;
msgsize = MAX(obj->dsi->attn_quantum, MAXMESGSIZE);
memcpy(&type, ibuf + 2, sizeof(type));
memcpy(&bitmap, ibuf + 4, sizeof(bitmap));
message = servermesg;
switch (ntohs(type)) {
case AFPMESG_LOGIN: /* login */
/* at least TIGER loses server messages
* if it receives a server msg attention before
* it has asked the login msg...
* Workaround: concatenate the two if any, ugly.
*/
if (obj->options.loginmesg) {
if (*message)
strlcat(message, " - ", MAXMESGSIZE);
strlcat(message, obj->options.loginmesg, MAXMESGSIZE);
}
break;
case AFPMESG_SERVER: /* server */
break;
default:
return AFPERR_BITMAP;
}
/* output format:
* message type: 2 bytes
* bitmap: 2 bytes
* message length: 1 byte ( 2 bytes for utf8)
* message: up to 199 bytes (dsi attn_quantum for utf8)
*/
memcpy(rbuf, &type, sizeof(type));
rbuf += sizeof(type);
*rbuflen += sizeof(type);
memcpy(rbuf, &bitmap, sizeof(bitmap));
rbuf += sizeof(bitmap);
*rbuflen += sizeof(bitmap);
utf8 = ntohs(bitmap) & 2;
msglen = strlen(message);
if (msglen > msgsize)
msglen = msgsize;
if (msglen) {
if ( (size_t)-1 == (outlen = convert_string(obj->options.unixcharset, utf8?CH_UTF8_MAC:obj->options.maccharset,
message, msglen, localized_message, msgsize)) )
{
memcpy(rbuf+((utf8)?2:1), message, msglen); /*FIXME*/
outlen = msglen;
}
else
{
memcpy(rbuf+((utf8)?2:1), localized_message, outlen);
}
}
if ( utf8 ) {
/* UTF8 message, 2 byte length */
msgsize = htons(outlen);
memcpy(rbuf, &msgsize, sizeof(msgsize));
*rbuflen += sizeof(msgsize);
}
else {
*rbuf = outlen;
*rbuflen += 1;
}
*rbuflen += outlen;
*message = 0;
return AFP_OK;
}
|
/*
*
* Font3x5
*
* created with FontCreator
* written by F. Maximilian Thiele
*
* http://www.apetech.de/fontCreator
* me@apetech.de
*
* File Name : Font3x5.h
* Date : 17.02.2012
* Font size in bytes : 1472
* Font width : 3
* Font height : 5
* Font first char : 32
* Font last char : 128
* Font used chars : 96
*
* The font data are defined as
*
* struct _FONT_ {
* uint16_t font_Size_in_Bytes_over_all_included_Size_it_self;
* uint8_t font_Width_in_Pixel_for_fixed_drawing;
* uint8_t font_Height_in_Pixel_for_all_characters;
* unit8_t font_First_Char;
* uint8_t font_Char_Count;
*
* uint8_t font_Char_Widths[font_Last_Char - font_First_Char +1];
* // for each character the separate width in pixels,
* // characters < 128 have an implicit virtual right empty row
*
* uint8_t font_data[];
* // bit field of all characters
*/
#include <inttypes.h>
#ifndef FONT3X5_H
#define FONT3X5_H
#define FONT3X5_WIDTH 3
#define FONT3X5_HEIGHT 5
static uint8_t Font3x5[] = {
0x05, 0xC0, // size
0x03, // width
0x05, // height
0x20, // first char
0x60, // char count
// char widths
0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x02, 0x02,
0x03, 0x03, 0x01, 0x03, 0x01, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x04, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x03, 0x03, 0x03, 0x02,
0x03, 0x02, 0x03, 0x03, 0x02, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x01, 0x03, 0x03, 0x01, 0x05, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x05, 0x03, 0x03,
0x03, 0x03, 0x01, 0x03, 0x03, 0x03,
// font data
0x00, 0x00, 0x00, // 32
0xB8, // 33
0x18, 0x00, 0x18, // 34
0xF8, 0x70, 0xF8, // 35
0x10, 0xF8, 0x40, // 36
0x00, 0x00, 0x00, // 37
0x00, 0x00, 0x00, // 38
0x18, // 39
0x70, 0x88, // 40
0x88, 0x70, // 41
0x70, 0x70, 0x70, // 42
0x20, 0x70, 0x20, // 43
0xC0, // 44
0x20, 0x20, 0x20, // 45
0x80, // 46
0xC0, 0x20, 0x18, // 47
0xF8, 0x88, 0xF8, // 48
0x90, 0xF8, 0x80, // 49
0xE8, 0xA8, 0xB8, // 50
0xA8, 0xA8, 0xF8, // 51
0x38, 0x20, 0xF8, // 52
0xB8, 0xA8, 0xE8, // 53
0xF8, 0xA8, 0xE8, // 54
0x08, 0xE8, 0x18, // 55
0xF8, 0xA8, 0xF8, // 56
0xB8, 0xA8, 0xF8, // 57
0x50, // 58
0xD0, // 59
0x20, 0x50, 0x88, // 60
0x50, 0x50, 0x50, // 61
0x88, 0x50, 0x20, // 62
0x08, 0xA8, 0x18, // 63
0x70, 0xE8, 0x70, // 64
0xF0, 0x28, 0xF0, // 65
0xF8, 0xA8, 0x50, // 66
0xF8, 0x88, 0x88, // 67
0xF8, 0x88, 0x70, // 68
0xF8, 0xA8, 0xA8, // 69
0xF8, 0x28, 0x28, // 70
0xF8, 0x88, 0xC8, // 71
0xF8, 0x20, 0xF8, // 72
0x88, 0xF8, 0x88, // 73
0x40, 0x80, 0x78, // 74
0xF8, 0x20, 0xD8, // 75
0xF8, 0x80, 0x80, // 76
0xF8, 0x10, 0xE0, 0x10, 0xF8, // 77
0xF8, 0x30, 0x40, 0xF8, // 78
0xF8, 0x88, 0xF8, // 79
0xF8, 0x28, 0x38, // 80
0x78, 0x48, 0xF8, // 81
0xF8, 0x28, 0xD0, // 82
0xB8, 0xA8, 0xE8, // 83
0x08, 0xF8, 0x08, // 84
0xF8, 0x80, 0xF8, // 85
0x78, 0x80, 0x78, // 86
0x78, 0x80, 0x78, 0x80, 0x78, // 87
0xD8, 0x20, 0xD8, // 88
0x18, 0xE0, 0x18, // 89
0xC8, 0xA8, 0x98, // 90
0xF8, 0x88, // 91
0x18, 0x20, 0xC0, // 92
0x88, 0xF8, // 93
0x10, 0x08, 0x10, // 94
0x80, 0x80, 0x80, // 95
0x08, 0x10, // 96
0xE8, 0xA8, 0xF8, // 97
0xF8, 0xA0, 0xE0, // 98
0xE0, 0xA0, 0xA0, // 99
0xE0, 0xA0, 0xF8, // 100
0xF8, 0xA8, 0xB8, // 101
0xF8, 0x28, 0x08, // 102
0xB8, 0xA8, 0xF8, // 103
0xF8, 0x20, 0xE0, // 104
0xE8, // 105
0x40, 0x80, 0x68, // 106
0xF8, 0x40, 0xA0, // 107
0xF8, // 108
0xF0, 0x20, 0xC0, 0x20, 0xC0, // 109
0xE0, 0x20, 0xC0, // 110
0xE0, 0xA0, 0xE0, // 111
0xF8, 0x28, 0x30, // 112
0x38, 0x28, 0xF0, // 113
0xE0, 0x20, 0x20, // 114
0x90, 0xA8, 0x48, // 115
0x10, 0xF8, 0x10, // 116
0xE0, 0x80, 0xE0, // 117
0x60, 0x80, 0x60, // 118
0x60, 0x80, 0x60, 0x80, 0x60, // 119
0xA0, 0x40, 0xA0, // 120
0x30, 0xA0, 0xF0, // 121
0xC8, 0xA8, 0x98, // 122
0x20, 0xF8, 0x88, // 123
0xF8, // 124
0x88, 0xF8, 0x20, // 125
0x60, 0x20, 0x30, // 126
0x00, 0x00, 0x00 // 127
};
#endif // FONT3X5_H
|
/*
* Copyright (C) 2006 Cooper Street Innovations Inc.
* Charles Eidsness <charles@cooper-street.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 MATRIX_H
#define MATRIX_H
#include <data.h>
#include "row.h"
#include "node.h"
#include "control.h"
typedef struct _matrix matrix_;
int matrixSolve(matrix_ *r);
int matrixSolveAgain(matrix_ *r);
node_ * matrixFindOrAddNode(matrix_ *r, row_ *row, row_ *col);
row_ * matrixFindOrAddRow(matrix_ *r, char rowType, char *rowName);
int matrixWriteRawfile(matrix_ *r, control_ *control);
int matrixClear(matrix_ *r);
int matrixRecall(matrix_ *r);
int matrixRecord(matrix_ *r, double time, unsigned int flag);
list_ * matrixGetHistory(matrix_ *r);
int matrixGetSolution(matrix_ *r, double *data[], char **variables[],
int *numPoints, int *numVariables);
int matrixInitialize(matrix_ *r, control_ *control);
int matrixDestroy(matrix_ **r);
matrix_ * matrixNew(matrix_ *r);
#endif
|
/* arch/arm/mach-msm/include/mach/memory.h
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
*
* 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.
*
*/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
#include <linux/types.h>
/* physical offset of RAM */
#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
#if defined(CONFIG_KEXEC_HARDBOOT)
#if defined(CONFIG_MACH_APQ8064_FLO)
#define KEXEC_HB_PAGE_ADDR UL(0x88C00000)
#elif defined(CONFIG_MACH_APQ8064_MAKO)
#define KEXEC_HB_PAGE_ADDR UL(0x88600000)
#elif defined(CONFIG_MACH_APQ8064_AWIFI)
#define KEXEC_HB_PAGE_ADDR UL(0x88600000)
#else
#error "Adress for kexec hardboot page not defined"
#endif
#endif
#define MAX_PHYSMEM_BITS 32
#define SECTION_SIZE_BITS 28
/* Maximum number of Memory Regions
* The largest system can have 4 memory banks, each divided into 8 regions
*/
#define MAX_NR_REGIONS 32
/* The number of regions each memory bank is divided into */
#define NR_REGIONS_PER_BANK 8
/* Certain configurations of MSM7x30 have multiple memory banks.
* One or more of these banks can contain holes in the memory map as well.
* These macros define appropriate conversion routines between the physical
* and virtual address domains for supporting these configurations using
* SPARSEMEM and a 3G/1G VM split.
*/
#if defined(CONFIG_ARCH_MSM7X30)
#define EBI0_PHYS_OFFSET PHYS_OFFSET
#define EBI0_PAGE_OFFSET PAGE_OFFSET
#define EBI0_SIZE 0x10000000
#ifndef __ASSEMBLY__
extern unsigned long ebi1_phys_offset;
#define EBI1_PHYS_OFFSET (ebi1_phys_offset)
#define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE)
#if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G))
#define __phys_to_virt(phys) \
((phys) >= EBI1_PHYS_OFFSET ? \
(phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \
(phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET)
#define __virt_to_phys(virt) \
((virt) >= EBI1_PAGE_OFFSET ? \
(virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \
(virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET)
#endif
#endif
#endif
#ifndef __ASSEMBLY__
void *allocate_contiguous_ebi(unsigned long, unsigned long, int);
unsigned long allocate_contiguous_ebi_nomap(unsigned long, unsigned long);
void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long);
void clean_caches(unsigned long, unsigned long, unsigned long);
void invalidate_caches(unsigned long, unsigned long, unsigned long);
int msm_get_memory_type_from_name(const char *memtype_name);
unsigned long get_ddr_size(void);
#if defined(CONFIG_ARCH_MSM_ARM11) || defined(CONFIG_ARCH_MSM_CORTEX_A5)
void write_to_strongly_ordered_memory(void);
void map_page_strongly_ordered(void);
#endif
#ifdef CONFIG_CACHE_L2X0
extern void l2x0_cache_sync(void);
#define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0)
#endif
#if defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960)
extern void store_ttbr0(void);
#ifdef CONFIG_LGE_CRASH_HANDLER
extern void store_ctrl(void);
extern void store_dac(void);
#endif
#define finish_arch_switch(prev) do { store_ttbr0(); } while (0)
#endif
#define MAX_HOLE_ADDRESS (PHYS_OFFSET + 0x10000000)
extern phys_addr_t memory_hole_offset;
extern phys_addr_t memory_hole_start;
extern phys_addr_t memory_hole_end;
extern unsigned long memory_hole_align;
extern unsigned long virtual_hole_start;
extern unsigned long virtual_hole_end;
#ifdef CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0
void find_memory_hole(void);
#define MEM_HOLE_END_PHYS_OFFSET (memory_hole_end)
#define MEM_HOLE_PAGE_OFFSET (PAGE_OFFSET + memory_hole_offset + \
memory_hole_align)
#define __phys_to_virt(phys) \
(unsigned long)\
((MEM_HOLE_END_PHYS_OFFSET && ((phys) >= MEM_HOLE_END_PHYS_OFFSET)) ? \
(phys) - MEM_HOLE_END_PHYS_OFFSET + MEM_HOLE_PAGE_OFFSET : \
(phys) - PHYS_OFFSET + PAGE_OFFSET)
#define __virt_to_phys(virt) \
(unsigned long)\
((MEM_HOLE_END_PHYS_OFFSET && ((virt) >= MEM_HOLE_PAGE_OFFSET)) ? \
(virt) - MEM_HOLE_PAGE_OFFSET + MEM_HOLE_END_PHYS_OFFSET : \
(virt) - PAGE_OFFSET + PHYS_OFFSET)
#endif
/*
* Need a temporary unique variable that no one will ever see to
* hold the compat string. Line number gives this easily.
* Need another layer of indirection to get __LINE__ to expand
* properly as opposed to appending and ending up with
* __compat___LINE__
*/
#define __CONCAT(a, b) ___CONCAT(a, b)
#define ___CONCAT(a, b) a ## b
#define EXPORT_COMPAT(com) \
static char *__CONCAT(__compat_, __LINE__) __used \
__attribute((__section__(".exportcompat.init"))) = com
extern char *__compat_exports_start[];
extern char *__compat_exports_end[];
#endif
#if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_KRAIT
#define arch_has_speculative_dfetch() 1
#endif
#endif
/* these correspond to values known by the modem */
#define MEMORY_DEEP_POWERDOWN 0
#define MEMORY_SELF_REFRESH 1
#define MEMORY_ACTIVE 2
#define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd"
#ifndef CONFIG_ARCH_MSM7X27
#define CONSISTENT_DMA_SIZE (SZ_1M * 14)
#endif
|
/* liblivejournal - a client library for LiveJournal.
* Copyright (C) 2003 Evan Martin <evan@livejournal.com>
*
* vim: tabstop=4 shiftwidth=4 noexpandtab :
*/
#include <config.h>
#include <glib.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h> /* atoi. */
#include <string.h> /* strchr. */
#include "entry.h"
#include "friends.h"
#include "tags.h"
#include "types.h"
char*
_lj_nid_by_id(GSList *l, int id) {
for ( ; l; l = l->next) {
if (((_LJNameIDHash*)l->data)->id == id)
return ((_LJNameIDHash*)l->data)->name;
}
return NULL;
}
int
_lj_nid_by_name(GSList *l, const char* name) {
for ( ; l; l = l->next) {
if (strcmp(((_LJNameIDHash*)l->data)->name, name) == 0)
return ((_LJNameIDHash*)l->data)->id;
}
return -1;
}
gint
_lj_nid_compare_alpha(_LJNameIDHash *a, _LJNameIDHash *b) {
return g_ascii_strcasecmp(a->name, b->name);
}
void
_lj_nid_free(_LJNameIDHash *nid) {
g_free(nid->name);
g_free(nid);
}
LJFriend*
lj_friend_new(void) {
LJFriend *f = g_new0(LJFriend, 1);
f->foreground = 0x000000;
f->background = 0xFFFFFF;
return f;
}
LJFriendType
lj_friend_type_from_str(char *str) {
if (str) {
if (strcmp(str, "community") == 0)
return LJ_FRIEND_TYPE_COMMUNITY;
}
return LJ_FRIEND_TYPE_USER;
}
void
lj_friend_free(LJFriend *f) {
g_free(f->username);
g_free(f->fullname);
g_free(f);
}
gint
lj_friend_compare_username(gconstpointer a, gconstpointer b) {
const LJFriend *fa = a;
const LJFriend *fb = b;
return strcmp(fa->username, fb->username);
}
LJTag*
lj_tag_new(void) {
LJTag *t = g_new0(LJTag, 1);
return t;
}
void
lj_tag_free(LJTag *t) {
g_free(t->tag);
g_free(t);
}
void
lj_security_append_to_request(LJSecurity *security, LJRequest *request) {
char *text = NULL;
switch (security->type) {
case LJ_SECURITY_PUBLIC:
text = "public"; break;
case LJ_SECURITY_PRIVATE:
text = "private"; break;
case LJ_SECURITY_FRIENDS:
case LJ_SECURITY_CUSTOM:
text = "usemask"; break;
}
lj_request_add(request, "security", text);
if (security->type == LJ_SECURITY_FRIENDS) {
lj_request_add_int(request, "allowmask", LJ_SECURITY_ALLOWMASK_FRIENDS);
} else if (security->type == LJ_SECURITY_CUSTOM) {
lj_request_add_int(request, "allowmask", security->allowmask);
}
}
void
lj_security_from_strings(LJSecurity *security, const char *sectext, const char *allowmask) {
if (!sectext) {
security->type = LJ_SECURITY_PUBLIC;
return;
}
if (g_ascii_strcasecmp(sectext, "public") == 0) {
security->type = LJ_SECURITY_PUBLIC;
} else if (g_ascii_strcasecmp(sectext, "private") == 0) {
security->type = LJ_SECURITY_PRIVATE;
} else if (g_ascii_strcasecmp(sectext, "friends") == 0) {
security->type = LJ_SECURITY_FRIENDS;
} else if (g_ascii_strcasecmp(sectext, "usemask") == 0 ||
g_ascii_strcasecmp(sectext, "custom") == 0) {
unsigned int am = 0;
if (allowmask)
am = atoi(allowmask);
switch (am) {
case 0:
security->type = LJ_SECURITY_PRIVATE; break;
case LJ_SECURITY_ALLOWMASK_FRIENDS:
security->type = LJ_SECURITY_FRIENDS; break;
default:
security->type = LJ_SECURITY_CUSTOM;
security->allowmask = am;
}
} else {
g_warning("security: '%s' unhandled", sectext);
}
}
#if 0
void
security_load_from_result(LJSecurity *security, NetResult *result) {
char *sectext, *allowmask;
sectext = net_result_get(result, "security");
if (sectext) {
allowmask = net_result_get(result, "allowmask");
security_load_from_strings(security, sectext, allowmask);
}
}
#endif
void
lj_security_to_strings(LJSecurity *security, char **sectext, char **allowmask) {
char *type = NULL;
switch (security->type) {
case LJ_SECURITY_PUBLIC: return;
case LJ_SECURITY_PRIVATE: type = "private"; break;
case LJ_SECURITY_FRIENDS: type = "friends"; break;
case LJ_SECURITY_CUSTOM: type = "custom"; break;
}
if (sectext)
*sectext = g_strdup(type);
if (allowmask && security->type == LJ_SECURITY_CUSTOM)
*allowmask = g_strdup_printf("%ud", security->allowmask);
}
time_t
lj_timegm(struct tm *tm) {
#ifdef HAVE_TIMEGM
return timegm(tm);
#elif defined(WIN32_FAKE_TIMEGM)
/* this is only for non-cygwin builds.
* windows getenv/putenv works in a wacky way. */
time_t ret;
char *tz;
tz = getenv("TZ");
putenv("TZ=UTC");
tzset();
ret = mktime(tm);
if (tz) {
char *putstr = g_strdup_printf("TZ=%s", tz);
putenv(putstr);
g_free(putstr);
} else {
putenv("TZ=");
}
tzset();
return ret;
#else
/* on systems that lack timegm, we can fake it with environment trickery.
* this is taken from the timegm(3) manpage. */
time_t ret;
char *tz;
tz = getenv("TZ");
setenv("TZ", "", 1);
tzset();
ret = mktime(tm);
if (tz)
setenv("TZ", tz, 1);
else
unsetenv("TZ");
tzset();
return ret;
#endif
}
gboolean
lj_ljdate_to_tm(const char *ljtime, struct tm *ptm) {
gboolean ret = TRUE;
if (sscanf(ljtime, "%4d-%2d-%2d %2d:%2d:%2d",
&ptm->tm_year, &ptm->tm_mon, &ptm->tm_mday,
&ptm->tm_hour, &ptm->tm_min, &ptm->tm_sec) < 5)
ret = FALSE;
ptm->tm_year -= 1900;
ptm->tm_mon -= 1;
ptm->tm_isdst = -1; /* -1: "the information is not available" */
return ret;
}
char*
lj_tm_to_ljdate(struct tm *ptm) {
return g_strdup_printf("%04d-%02d-%02d %02d:%02d:%02d",
ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday,
ptm->tm_hour, ptm->tm_min, ptm->tm_sec);
}
char*
lj_tm_to_ljdate_noseconds(struct tm *ptm) {
return g_strdup_printf("%04d-%02d-%02d %02d:%02d",
ptm->tm_year+1900, ptm->tm_mon+1, ptm->tm_mday,
ptm->tm_hour, ptm->tm_min);
}
guint32
lj_color_to_int(const char *color) {
if (color[0] != '#')
return 0;
return strtol(color+1, NULL, 16);
}
void
lj_int_to_color(guint32 l, char *color) {
sprintf(color, "#%06X", l);
}
|
//###########################################################################
//
// FILE: DSP2833x_XIntrupt.h
//
// TITLE: DSP2833x Device External Interrupt Register Definitions.
//
//###########################################################################
// $TI Release: 2833x/2823x Header Files and Peripheral Examples V133 $
// $Release Date: June 8, 2012 $
//###########################################################################
#ifndef DSP2833x_XINTRUPT_H
#define DSP2833x_XINTRUPT_H
#ifdef __cplusplus
extern "C" {
#endif
//---------------------------------------------------------------------------
struct XINTCR_BITS {
Uint16 ENABLE:1; // 0 enable/disable
Uint16 rsvd1:1; // 1 reserved
Uint16 POLARITY:2; // 3:2 pos/neg, both triggered
Uint16 rsvd2:12; //15:4 reserved
};
union XINTCR_REG {
Uint16 all;
struct XINTCR_BITS bit;
};
struct XNMICR_BITS {
Uint16 ENABLE:1; // 0 enable/disable
Uint16 SELECT:1; // 1 Timer 1 or XNMI connected to int13
Uint16 POLARITY:2; // 3:2 pos/neg, or both triggered
Uint16 rsvd2:12; // 15:4 reserved
};
union XNMICR_REG {
Uint16 all;
struct XNMICR_BITS bit;
};
//---------------------------------------------------------------------------
// External Interrupt Register File:
//
struct XINTRUPT_REGS {
union XINTCR_REG XINT1CR;
union XINTCR_REG XINT2CR;
union XINTCR_REG XINT3CR;
union XINTCR_REG XINT4CR;
union XINTCR_REG XINT5CR;
union XINTCR_REG XINT6CR;
union XINTCR_REG XINT7CR;
union XNMICR_REG XNMICR;
Uint16 XINT1CTR;
Uint16 XINT2CTR;
Uint16 rsvd[5];
Uint16 XNMICTR;
};
//---------------------------------------------------------------------------
// External Interrupt References & Function Declarations:
//
extern volatile struct XINTRUPT_REGS XIntruptRegs;
#ifdef __cplusplus
}
#endif /* extern "C" */
#endif // end of DSP2833x_XINTF_H definition
//===========================================================================
// End of file.
//===========================================================================
|
/* AbiSource
*
* Copyright (C) 2005 INdT
* Author: Daniel d'Andrada T. de Carvalho <daniel.carvalho@indt.org.br>
*
* 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 ODE_HEADINGSEARCHER_LISTENER_H_
#define ODE_HEADINGSEARCHER_LISTENER_H_
// Internal includes
#include "ODe_AbiDocListenerImpl.h"
// Internal classes
class ODe_AuxiliaryData;
// AbiWord classes
class PP_AttrProp;
class ODe_Styles;
/**
* Searches all TOCs for its heading styles, i.e.: the paragraph styles that are
* used to build the document structure (chapters, sections, etc).
*/
class ODe_HeadingSearcher_Listener: public ODe_AbiDocListenerImpl {
public:
ODe_HeadingSearcher_Listener(ODe_Styles& m_rStyles, ODe_AuxiliaryData& rAuxiliaryData);
virtual void openTOC(const PP_AttrProp* pAP);
private:
ODe_Styles& m_rStyles;
ODe_AuxiliaryData& m_rAuxiliaryData;
};
#endif /*ODE_HEADINGSEARCHER_LISTENER_H_*/
|
// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (C) 2020 Sean Anderson <seanga2@gmail.com>
*/
#include <common.h>
#include <console.h>
#include <log.h>
#include <test/log.h>
#include <test/ut.h>
DECLARE_GLOBAL_DATA_PTR;
/* Test invalid options */
static int log_test_filter_invalid(struct unit_test_state *uts)
{
ut_asserteq(1, run_command("log filter-add -AD", 0));
ut_asserteq(1, run_command("log filter-add -l1 -L1", 0));
ut_asserteq(1, run_command("log filter-add -l1 -L1", 0));
ut_asserteq(1, run_command("log filter-add -lfoo", 0));
ut_asserteq(1, run_command("log filter-add -cfoo", 0));
ut_asserteq(1, run_command("log filter-add -ccore -ccore -ccore -ccore "
"-ccore -ccore", 0));
return 0;
}
LOG_TEST_FLAGS(log_test_filter_invalid, UT_TESTF_CONSOLE_REC);
/* Test adding and removing filters */
static int log_test_filter(struct unit_test_state *uts)
{
bool any_found = false;
bool filt1_found = false;
bool filt2_found = false;
char cmd[32];
struct log_filter *filt;
struct log_device *ldev;
ulong filt1, filt2;
#define create_filter(args, filter_num) do {\
ut_assertok(console_record_reset_enable()); \
ut_assertok(run_command("log filter-add -p " args, 0)); \
ut_assert_skipline(); \
ut_assertok(strict_strtoul(uts->actual_str, 10, &(filter_num))); \
ut_assert_console_end(); \
} while (0)
create_filter("", filt1);
create_filter("-DL warning -cmmc -cspi -ffile", filt2);
ldev = log_device_find_by_name("console");
ut_assertnonnull(ldev);
list_for_each_entry(filt, &ldev->filter_head, sibling_node) {
if (filt->filter_num == filt1) {
filt1_found = true;
ut_asserteq(0, filt->flags);
ut_asserteq(LOGL_MAX, filt->level);
ut_assertnull(filt->file_list);
} else if (filt->filter_num == filt2) {
filt2_found = true;
ut_asserteq(LOGFF_HAS_CAT | LOGFF_DENY |
LOGFF_LEVEL_MIN, filt->flags);
ut_asserteq(true, log_has_cat(filt->cat_list,
log_uc_cat(UCLASS_MMC)));
ut_asserteq(true, log_has_cat(filt->cat_list,
log_uc_cat(UCLASS_SPI)));
ut_asserteq(LOGL_WARNING, filt->level);
ut_asserteq_str("file", filt->file_list);
}
}
ut_asserteq(true, filt1_found);
ut_asserteq(true, filt2_found);
#define remove_filter(filter_num) do { \
ut_assertok(console_record_reset_enable()); \
snprintf(cmd, sizeof(cmd), "log filter-remove %lu", filter_num); \
ut_assertok(run_command(cmd, 0)); \
ut_assert_console_end(); \
} while (0)
remove_filter(filt1);
remove_filter(filt2);
filt1_found = false;
filt2_found = false;
list_for_each_entry(filt, &ldev->filter_head, sibling_node) {
if (filt->filter_num == filt1)
filt1_found = true;
else if (filt->filter_num == filt2)
filt2_found = true;
}
ut_asserteq(false, filt1_found);
ut_asserteq(false, filt2_found);
create_filter("", filt1);
create_filter("", filt2);
ut_assertok(console_record_reset_enable());
ut_assertok(run_command("log filter-remove -a", 0));
ut_assert_console_end();
list_for_each_entry(filt, &ldev->filter_head, sibling_node)
any_found = true;
ut_asserteq(false, any_found);
return 0;
}
LOG_TEST_FLAGS(log_test_filter, UT_TESTF_CONSOLE_REC);
|
/*
* Copyright (C) 2008 The Android Open Source Project
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/time.h>
#include "usb.h"
static unsigned arg_size = 4096;
static unsigned arg_count = 4096;
long long NOW(void)
{
struct timeval tv;
gettimeofday(&tv, 0);
return (((long long) tv.tv_sec) * ((long long) 1000000)) +
(((long long) tv.tv_usec));
}
int printifc(usb_ifc_info *info)
{
printf("dev: csp=%02x/%02x/%02x v=%04x p=%04x ",
info->dev_class, info->dev_subclass, info->dev_protocol,
info->dev_vendor, info->dev_product);
printf("ifc: csp=%02x/%02x/%02x%s%s\n",
info->ifc_class, info->ifc_subclass, info->ifc_protocol,
info->has_bulk_in ? " in" : "",
info->has_bulk_out ? " out" : "");
return -1;
}
int match_null(usb_ifc_info *info)
{
if(info->dev_vendor != 0x18d1) return -1;
if(info->ifc_class != 0xff) return -1;
if(info->ifc_subclass != 0xfe) return -1;
if(info->ifc_protocol != 0x01) return -1;
return 0;
}
int match_zero(usb_ifc_info *info)
{
if(info->dev_vendor != 0x18d1) return -1;
if(info->ifc_class != 0xff) return -1;
if(info->ifc_subclass != 0xfe) return -1;
if(info->ifc_protocol != 0x02) return -1;
return 0;
}
int match_loop(usb_ifc_info *info)
{
if(info->dev_vendor != 0x18d1) return -1;
if(info->ifc_class != 0xff) return -1;
if(info->ifc_subclass != 0xfe) return -1;
if(info->ifc_protocol != 0x03) return -1;
return 0;
}
int test_null(usb_handle *usb)
{
int i;
unsigned char buf[4096];
memset(buf, 0xee, 4096);
long long t0, t1;
t0 = NOW();
for(i = 0; i < arg_count; i++) {
if(usb_write(usb, buf, arg_size) != arg_size) {
fprintf(stderr,"write failed (%s)\n", strerror(errno));
return -1;
}
}
t1 = NOW();
fprintf(stderr,"%d bytes in %lld uS\n", arg_count * arg_size, (t1 - t0));
return 0;
}
int test_zero(usb_handle *usb)
{
int i;
unsigned char buf[4096];
long long t0, t1;
t0 = NOW();
for(i = 0; i < arg_count; i++) {
if(usb_read(usb, buf, arg_size) != arg_size) {
fprintf(stderr,"read failed (%s)\n", strerror(errno));
return -1;
}
}
t1 = NOW();
fprintf(stderr,"%d bytes in %lld uS\n", arg_count * arg_size, (t1 - t0));
return 0;
}
struct
{
const char *cmd;
ifc_match_func match;
int (*test)(usb_handle *usb);
const char *help;
} tests[] = {
{ "list", printifc, 0, "list interfaces" },
{ "send", match_null, test_null, "send to null interface" },
{ "recv", match_zero, test_zero, "recv from zero interface" },
{ "loop", match_loop, 0, "exercise loopback interface" },
{},
};
int usage(void)
{
int i;
fprintf(stderr,"usage: usbtest <testname>\n\navailable tests:\n");
for(i = 0; tests[i].cmd; i++) {
fprintf(stderr," %-8s %s\n", tests[i].cmd, tests[i].help);
}
return -1;
}
int process_args(int argc, char **argv)
{
while(argc-- > 0) {
char *arg = *argv++;
if(!strncmp(arg,"count=",6)) {
arg_count = atoi(arg + 6);
} else if(!strncmp(arg,"size=",5)) {
arg_size = atoi(arg + 5);
} else {
fprintf(stderr,"unknown argument: %s\n", arg);
return -1;
}
}
if(arg_count == 0) {
fprintf(stderr,"count may not be zero\n");
return -1;
}
if(arg_size > 4096) {
fprintf(stderr,"size may not be greater than 4096\n");
return -1;
}
return 0;
}
int main(int argc, char **argv)
{
usb_handle *usb;
int i;
if(argc < 2)
return usage();
if(argc > 2) {
if(process_args(argc - 2, argv + 2))
return -1;
}
for(i = 0; tests[i].cmd; i++) {
if(!strcmp(argv[1], tests[i].cmd)) {
usb = usb_open(tests[i].match);
if(tests[i].test) {
if(usb == 0) {
fprintf(stderr,"usbtest: %s: could not find interface\n",
tests[i].cmd);
return -1;
}
if(tests[i].test(usb)) {
fprintf(stderr,"usbtest: %s: FAIL\n", tests[i].cmd);
return -1;
} else {
fprintf(stderr,"usbtest: %s: OKAY\n", tests[i].cmd);
}
}
return 0;
}
}
return usage();
}
|
/* packet-cdt.h
*
* Routines for Compressed Data Type packet dissection.
*
* Copyright 2005, Stig Bjorlykke <stig@bjorlykke.org>, Thales Norway AS
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* 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 PACKET_CDT_H
#define PACKET_CDT_H
void dissect_cdt (tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree);
#include "packet-cdt-exp.h"
#endif /* PACKET_CDT_H */
|
/*
*
* Copyright (c) International Business Machines Corp., 2001
*
* 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
*/
/*
* NAME
* open01.c
*
* DESCRIPTION
* Open a file with oflag = O_CREAT set, does it set the sticky bit off?
*
* Open "/tmp" with O_DIRECTORY, does it set the S_IFDIR bit on?
*
* ALGORITHM
* 1. open a new file with O_CREAT, fstat.st_mode should not have the
* 01000 bit on. In Linux, the save text bit is *NOT* cleared.
*
* 2. open "/tmp" with O_DIRECTORY. fstat.st_mode should have the
* 040000 bit on.
*
* USAGE: <for command-line>
* open01 [-c n] [-f] [-i n] [-I x] [-P x] [-t]
* where, -c n : Run n copies concurrently.
* -f : Turn off functionality Testing.
* -i n : Execute test n times.
* -I x : Execute test for x seconds.
* -P x : Pause for x seconds between iterations.
* -t : Turn on syscall timing.
*
* HISTORY
* 07/2001 Ported by Wayne Boyer
*
* RESTRICTIONS
* None
*/
#define _GNU_SOURCE /* for O_DIRECTORY */
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include "test.h"
#include "usctest.h"
char *TCID = "open01";
int TST_TOTAL = 1;
static char pfilname[40] = "";
static void cleanup(void);
static void setup(void);
int main(int ac, char **av)
{
int lc;
char *msg;
struct stat statbuf;
int fildes;
unsigned short filmode;
/*
* parse standard command line options
*/
msg = parse_opts(ac, av, NULL, NULL);
if (msg != NULL)
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
setup();
/*
* check looping state if -i option given on the command line
*/
for (lc = 0; TEST_LOOPING(lc); lc++) {
tst_count = 0; /* reset tst_count while looping. */
/* test #1 */
TEST(open(pfilname, O_RDWR | O_CREAT, 01444));
fildes = TEST_RETURN;
if (fildes == -1) {
tst_resm(TFAIL, "Cannot open %s", pfilname);
continue;
}
if (STD_FUNCTIONAL_TEST) {
fstat(fildes, &statbuf);
filmode = statbuf.st_mode;
if (!(filmode & S_ISVTX)) {
tst_resm(TFAIL, "Save test bit cleared, but "
"should not have been");
} else {
tst_resm(TPASS, "Save text bit not cleared "
"as expected");
}
} else {
tst_resm(TPASS, "open call succeeded");
}
/* test #2 */
TEST(open("/tmp", O_DIRECTORY));
if (TEST_RETURN == -1) {
tst_resm(TFAIL, "open of /tmp failed, errno: %d",
TEST_ERRNO);
continue;
}
if (STD_FUNCTIONAL_TEST) {
fstat(TEST_RETURN, &statbuf);
filmode = statbuf.st_mode;
if (!(filmode & S_IFDIR)) {
tst_resm(TFAIL, "directory bit cleared, but "
"should not have been");
} else {
tst_resm(TPASS, "directory bit is set "
"as expected");
}
} else {
tst_resm(TPASS, "open of /tmp succeeded");
}
/* clean up things is case we are looping */
if (close(fildes) == -1)
tst_brkm(TBROK, cleanup, "close #1 failed");
if (unlink(pfilname) == -1)
tst_brkm(TBROK, cleanup, "can't remove file");
if (close(TEST_RETURN) == -1)
tst_brkm(TBROK, cleanup, "close #2 failed");
}
cleanup();
tst_exit();
}
static void setup(void)
{
umask(0);
tst_sig(NOFORK, DEF_HANDLER, cleanup);
TEST_PAUSE;
tst_tmpdir();
sprintf(pfilname, "open3.%d", getpid());
}
static void cleanup(void)
{
TEST_CLEANUP;
tst_rmdir();
}
|
/*
* Copyright (C) 1999-2015, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: epivers.h.in,v 13.33 2010-09-08 22:08:53 $
*
*/
#ifndef _epivers_h_
#define _epivers_h_
#define EPI_MAJOR_VERSION 1
#define EPI_MINOR_VERSION 201
#define EPI_RC_NUMBER 59
#define EPI_INCREMENTAL_NUMBER 33
#define EPI_BUILD_NUMBER 0
#define EPI_VERSION 1, 201, 59, 33
#define EPI_VERSION_NUM 0x01c93b21
#define EPI_VERSION_DEV 1.201.59
/* Driver Version String, ASCII, 32 chars max */
#define EPI_VERSION_STR "1.201.59.33 (r593379)"
#endif /* _epivers_h_ */
|
/*
Osqoop, an open source software oscilloscope.
Copyright (C) 2006--2009 Stephane Magnenat <stephane at magnenat dot net>
http://stephane.magnenat.net
Laboratory of Digital Systems
http://www.eig.ch/fr/laboratoires/systemes-numeriques/
Engineering School of Geneva
http://hepia.hesge.ch/
See authors file in source distribution for details about contributors
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 __UTILITIES_H
#define __UTILITIES_H
#include <QString>
#include <QColor>
const unsigned ScaleFactorCount = 15;
QString timeScaleToStringWidthToDiv(unsigned duration);
QString timeScaleToString(double duration);
QString YScaleToString(unsigned yDivisionFactor);
void setDataSourceChannelCount(unsigned number);
unsigned logicChannelIdToPhysic(int logic, bool *ok = NULL);
int physicChannelIdToLogic(unsigned physic);
QString channelNumberToString(unsigned channel);
unsigned channelNumberFromString(const QString &channel);
void setCustomChannelName(unsigned channel, const QString &name);
void clearCustomChannelNames(void);
void loadCustomChannelNames(void);
void saveCustomChannelNames(void);
QColor getChannelColor(unsigned channel);
unsigned getScaleFactor(unsigned index);
unsigned getScaleFactorInvert(unsigned factor);
#endif
|
/*
* This file is part of the CMaNGOS Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOS_NULLCREATUREAI_H
#define MANGOS_NULLCREATUREAI_H
#include "AI/BaseAI/CreatureAI.h"
class NullCreatureAI : public CreatureAI
{
public:
explicit NullCreatureAI(Creature* c) : CreatureAI(c) {}
~NullCreatureAI();
void MoveInLineOfSight(Unit*) override {}
void AttackStart(Unit*) override {}
void AttackedBy(Unit*) override {}
void EnterEvadeMode() override {}
bool IsVisible(Unit*) const override { return false; }
void UpdateAI(const uint32) override {}
static int Permissible(const Creature*) { return PERMIT_BASE_IDLE; }
};
#endif
|
#include "cache.h"
#include "run-command.h"
#include "sigchain.h"
/*
* This is split up from the rest of git so that we can do
* something different on Windows.
*/
static int spawned_pager;
static void pager_preexec(void)
{
/*
* Work around bug in "less" by not starting it until we
* have real input
*/
fd_set in;
FD_ZERO(&in);
FD_SET(0, &in);
select(1, &in, NULL, &in, NULL);
setenv("LESS", "FRSX", 0);
}
static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
static struct child_process pager_process;
static void wait_for_pager(void)
{
fflush(stdout);
fflush(stderr);
/* signal EOF to pager */
close(1);
close(2);
finish_command(&pager_process);
}
static void wait_for_pager_signal(int signo)
{
wait_for_pager();
sigchain_pop(signo);
raise(signo);
}
void setup_pager(void)
{
/* ANDROID_CHANGE_BEGIN */
#ifdef __BIONIC__
return;
#else
const char *pager = getenv("PERF_PAGER");
if (!isatty(1))
return;
if (!pager) {
if (!pager_program)
perf_config(perf_default_config, NULL);
pager = pager_program;
}
if (!pager)
pager = getenv("PAGER");
if (!pager)
pager = "less";
else if (!*pager || !strcmp(pager, "cat"))
return;
spawned_pager = 1; /* means we are emitting to terminal */
/* spawn the pager */
pager_argv[2] = pager;
pager_process.argv = pager_argv;
pager_process.in = -1;
pager_process.preexec_cb = pager_preexec;
if (start_command(&pager_process))
return;
/* original process continues, but writes to the pipe */
dup2(pager_process.in, 1);
if (isatty(2))
dup2(pager_process.in, 2);
close(pager_process.in);
/* this makes sure that the parent terminates after the pager */
sigchain_push_common(wait_for_pager_signal);
atexit(wait_for_pager);
#endif
/* ANDROID_CHANGE_END */
}
int pager_in_use(void)
{
const char *env;
if (spawned_pager)
return 1;
env = getenv("PERF_PAGER_IN_USE");
return env ? perf_config_bool("PERF_PAGER_IN_USE", env) : 0;
}
|
/* SPDX-License-Identifier: LGPL-2.1-or-later */
#include "sort-util.h"
#include "alloc-util.h"
/* hey glibc, APIs with callbacks without a user pointer are so useless */
void *xbsearch_r(const void *key, const void *base, size_t nmemb, size_t size,
__compar_d_fn_t compar, void *arg) {
size_t l, u, idx;
const void *p;
int comparison;
assert(!size_multiply_overflow(nmemb, size));
l = 0;
u = nmemb;
while (l < u) {
idx = (l + u) / 2;
p = (const uint8_t*) base + idx * size;
comparison = compar(key, p, arg);
if (comparison < 0)
u = idx;
else if (comparison > 0)
l = idx + 1;
else
return (void *)p;
}
return NULL;
}
int cmp_int(const int *a, const int *b) {
return CMP(*a, *b);
}
|
/*
* (C) Copyright 2010
* Ilko Iliev <iliev@ronetix.at>
* Asen Dimov <dimov@ronetix.at>
* Ronetix GmbH <www.ronetix.at>
*
* (C) Copyright 2007-2008
* Stelian Pop <stelian.pop@leadtechdesign.com>
* Lead Tech Design <www.leadtechdesign.com>
*
* Configuation settings for the PM9G45 board.
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __CONFIG_H
#define __CONFIG_H
#define CONFIG_ARM926EJS 1 /* This is an ARM926EJS Core */
#define CONFIG_PM9G45 1 /* It's an Ronetix PM9G45 */
#define CONFIG_AT91SAM9G45 1 /* It's an Atmel AT91SAM9G45 SoC */
/* ARM asynchronous clock */
#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */
#define CONFIG_SYS_HZ 1000
#define CONFIG_ARCH_CPU_INIT
#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_INITRD_TAG 1
#define CONFIG_SKIP_LOWLEVEL_INIT
/*
* Hardware drivers
*/
#define CONFIG_AT91_GPIO 1
#define CONFIG_ATMEL_USART 1
#define CONFIG_USART3 1 /* USART 3 is DBGU */
#define CONFIG_SYS_USE_NANDFLASH 1
/* LED */
#define CONFIG_AT91_LED
#define CONFIG_RED_LED AT91_PIO_PORTD, 31 /* this is the user1 led */
#define CONFIG_GREEN_LED AT91_PIO_PORTD, 0 /* this is the user2 led */
#define CONFIG_BOOTDELAY 3
/*
* BOOTP options
*/
#define CONFIG_BOOTP_BOOTFILESIZE 1
#define CONFIG_BOOTP_BOOTPATH 1
#define CONFIG_BOOTP_GATEWAY 1
#define CONFIG_BOOTP_HOSTNAME 1
/*
* Command line configuration.
*/
#include <config_cmd_default.h>
#undef CONFIG_CMD_FPGA
#undef CONFIG_CMD_IMLS
#define CONFIG_CMD_PING 1
#define CONFIG_CMD_DHCP 1
#define CONFIG_CMD_NAND 1
#define CONFIG_CMD_USB 1
#define CONFIG_CMD_JFFS2 1
#define CONFIG_JFFS2_CMDLINE 1
#define CONFIG_JFFS2_NAND 1
#define CONFIG_JFFS2_DEV "nand0" /* NAND dev jffs2 lives on */
#define CONFIG_JFFS2_PART_OFFSET 0 /* start of jffs2 partition */
#define CONFIG_JFFS2_PART_SIZE (256 * 1024 * 1024) /* partition */
/* SDRAM */
#define CONFIG_NR_DRAM_BANKS 1
#define PHYS_SDRAM 0x70000000
#define PHYS_SDRAM_SIZE 0x08000000 /* 128 megs */
/* NOR flash, not available */
#define CONFIG_SYS_NO_FLASH 1
#undef CONFIG_CMD_FLASH
/* NAND flash */
#ifdef CONFIG_CMD_NAND
#define CONFIG_NAND_MAX_CHIPS 1
#define CONFIG_NAND_ATMEL
#define CONFIG_SYS_MAX_NAND_DEVICE 1
#define CONFIG_SYS_NAND_BASE 0x40000000
#define CONFIG_SYS_NAND_DBW_8 1
/* our ALE is AD21 */
#define CONFIG_SYS_NAND_MASK_ALE (1 << 21)
/* our CLE is AD22 */
#define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIO_PORTC, 14
#define CONFIG_SYS_NAND_READY_PIN AT91_PIO_PORTD, 3
#endif
/* Ethernet */
#define CONFIG_MACB 1
#define CONFIG_RMII 1
#define CONFIG_NET_MULTI 1
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_RESET_PHY_R 1
/* USB */
#define CONFIG_USB_ATMEL
#define CONFIG_USB_OHCI_NEW 1
#define CONFIG_DOS_PARTITION 1
#define CONFIG_SYS_USB_OHCI_CPU_INIT 1
#define CONFIG_SYS_USB_OHCI_REGS_BASE 0x00700000 /* _UHP_OHCI_BASE */
#define CONFIG_SYS_USB_OHCI_SLOT_NAME "at91sam9g45"
#define CONFIG_SYS_USB_OHCI_MAX_ROOT_PORTS 2
#define CONFIG_USB_STORAGE 1
/* board specific(not enough SRAM) */
#define CONFIG_AT91SAM9G45_LCD_BASE PHYS_SDRAM + 0xE00000
#define CONFIG_SYS_LOAD_ADDR PHYS_SDRAM + 0x2000000 /* load addr */
#define CONFIG_SYS_MEMTEST_START PHYS_SDRAM
#define CONFIG_SYS_MEMTEST_END CONFIG_AT91SAM9G45_LCD_BASE
/* bootstrap + u-boot + env + linux in nandflash */
#define CONFIG_ENV_IS_IN_NAND 1
#define CONFIG_ENV_OFFSET 0x60000
#define CONFIG_ENV_OFFSET_REDUND 0x80000
#define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */
#define CONFIG_BOOTCOMMAND "nand read 0x72000000 0x200000 0x200000; bootm"
#define CONFIG_BOOTARGS "fbcon=rotate:3 console=tty0 " \
"console=ttyS0,115200 " \
"root=/dev/mtdblock4 " \
"mtdparts=atmel_nand:128k(bootstrap)ro," \
"256k(uboot)ro,1664k(env)," \
"2M(linux)ro,-(root) rw " \
"rootfstype=jffs2"
#define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_BAUDRATE_TABLE {115200 , 19200, 38400, 57600, 9600 }
#define CONFIG_SYS_PROMPT "U-Boot> "
#define CONFIG_SYS_CBSIZE 256
#define CONFIG_SYS_MAXARGS 16
#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
#define CONFIG_SYS_LONGHELP 1
#define CONFIG_CMDLINE_EDITING 1
#define CONFIG_AUTO_COMPLETE
#define CONFIG_SYS_HUSH_PARSER
#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
/*
* Size of malloc() pool
*/
#define CONFIG_SYS_MALLOC_LEN ROUND(3 * CONFIG_ENV_SIZE + 128*1024,\
0x1000)
#define CONFIG_STACKSIZE (32*1024) /* regular stack */
#ifdef CONFIG_USE_IRQ
#error CONFIG_USE_IRQ not supported
#endif
#endif
|
/*
Unix SMB/CIFS implementation.
SMB torture tester
Copyright (C) Jelmer Vernooij 2007
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TORTURE_NDR_H__
#define __TORTURE_NDR_H__
#include "torture/torture.h"
#include "librpc/ndr/libndr.h"
#include "libcli/security/security.h"
_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_test(
struct torture_suite *suite,
const char *name, ndr_pull_flags_fn_t fn,
DATA_BLOB db,
size_t struct_size,
int ndr_flags,
bool (*check_fn) (struct torture_context *, void *data));
_PUBLIC_ struct torture_test *_torture_suite_add_ndr_pull_inout_test(
struct torture_suite *suite,
const char *name, ndr_pull_flags_fn_t pull_fn,
DATA_BLOB db_in,
DATA_BLOB db_out,
size_t struct_size,
bool (*check_fn) (struct torture_context *ctx, void *data));
#define torture_suite_add_ndr_pull_test(suite,name,data,check_fn) \
_torture_suite_add_ndr_pull_test(suite, #name, \
(ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \
sizeof(struct name), 0, (bool (*) (struct torture_context *, void *)) check_fn);
#define torture_suite_add_ndr_pull_fn_test(suite,name,data,flags,check_fn) \
_torture_suite_add_ndr_pull_test(suite, #name "_" #flags, \
(ndr_pull_flags_fn_t)ndr_pull_ ## name, data_blob_talloc(suite, data, sizeof(data)), \
sizeof(struct name), flags, (bool (*) (struct torture_context *, void *)) check_fn);
#define torture_suite_add_ndr_pull_io_test(suite,name,data_in,data_out,check_fn_out) \
_torture_suite_add_ndr_pull_inout_test(suite, #name "_INOUT", \
(ndr_pull_flags_fn_t)ndr_pull_ ## name, \
data_blob_talloc(suite, data_in, sizeof(data_in)), \
data_blob_talloc(suite, data_out, sizeof(data_out)), \
sizeof(struct name), \
(bool (*) (struct torture_context *, void *)) check_fn_out);
#define torture_assert_sid_equal(torture_ctx,got,expected,cmt)\
do { struct dom_sid *__got = (got), *__expected = (expected); \
if (!dom_sid_equal(__got, __expected)) { \
torture_result(torture_ctx, TORTURE_FAIL, \
__location__": "#got" was %s, expected %s: %s", \
dom_sid_string(torture_ctx, __got), dom_sid_string(torture_ctx, __expected), cmt); \
return false; \
} \
} while(0)
#endif /* __TORTURE_NDR_H__ */
|
/*
* CINELERRA
* Copyright (C) 2008 Adam Williams <broadcast at earthling dot 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 EDITPOPUP_H
#define EDITPOPUP_H
#include "guicast.h"
#include "mwindow.inc"
#include "mwindowgui.inc"
#include "edit.inc"
#include "plugindialog.inc"
#include "resizetrackthread.inc"
class EditPopupResize;
class EditPopupMatchSize;
class EditPopupTitleText;
class EditPopupTitleWindow;
class EditPopupTitleButton;
class EditPopupTitleButtonRes;
class EditPopup : public BC_PopupMenu
{
public:
EditPopup(MWindow *mwindow, MWindowGUI *gui);
~EditPopup();
void create_objects();
int update(Track *track, Edit *edit);
MWindow *mwindow;
MWindowGUI *gui;
// Acquired through the update command as the edit currently being operated on
Edit *edit;
Track *track;
EditPopupResize *resize_option;
EditPopupMatchSize *matchsize_option;
};
class EditPopupMatchSize : public BC_MenuItem
{
public:
EditPopupMatchSize(MWindow *mwindow, EditPopup *popup);
~EditPopupMatchSize();
int handle_event();
MWindow *mwindow;
EditPopup *popup;
};
class EditPopupResize : public BC_MenuItem
{
public:
EditPopupResize(MWindow *mwindow, EditPopup *popup);
~EditPopupResize();
int handle_event();
MWindow *mwindow;
EditPopup *popup;
ResizeTrackThread *dialog_thread;
};
class EditPopupDeleteTrack : public BC_MenuItem
{
public:
EditPopupDeleteTrack(MWindow *mwindow, EditPopup *popup);
int handle_event();
MWindow *mwindow;
EditPopup *popup;
};
class EditPopupAddTrack : public BC_MenuItem
{
public:
EditPopupAddTrack(MWindow *mwindow, EditPopup *popup);
int handle_event();
MWindow *mwindow;
EditPopup *popup;
};
class EditAttachEffect : public BC_MenuItem
{
public:
EditAttachEffect(MWindow *mwindow, EditPopup *popup);
~EditAttachEffect();
int handle_event();
MWindow *mwindow;
EditPopup *popup;
PluginDialogThread *dialog_thread;
};
class EditMoveTrackUp : public BC_MenuItem
{
public:
EditMoveTrackUp(MWindow *mwindow, EditPopup *popup);
~EditMoveTrackUp();
int handle_event();
MWindow *mwindow;
EditPopup *popup;
};
class EditMoveTrackDown : public BC_MenuItem
{
public:
EditMoveTrackDown(MWindow *mwindow, EditPopup *popup);
~EditMoveTrackDown();
int handle_event();
MWindow *mwindow;
EditPopup *popup;
};
class EditPopupTitle : public BC_MenuItem
{
public:
EditPopupTitle (MWindow *mwindow, EditPopup *popup);
~EditPopupTitle();
int handle_event();
MWindow *mwindow;
EditPopup *popup;
EditPopupTitleWindow *window;
};
class EditPopupTitleText : public BC_TextBox
{
public:
EditPopupTitleText (EditPopupTitleWindow *window,
MWindow *mwindow, int x, int y);
~EditPopupTitleText();
int handle_event();
EditPopupTitleWindow *window;
MWindow *mwindow;
};
class EditPopupTitleWindow : public BC_Window
{
public:
EditPopupTitleWindow (MWindow *mwindow, EditPopup *popup);
~EditPopupTitleWindow ();
int create_objects();
int close_event();
EditPopupTitleText *title_text;
Edit *edt;
MWindow *mwindow;
EditPopup *popup;
char new_text[BCTEXTLEN];
};
#endif
|
/******************************************************************************
* flask.c
*
* Authors: George Coker, <gscoker@alpha.ncsc.mil>
* Michael LeMay, <mdlemay@epoch.ncsc.mil>
*
*
* 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 <Python.h>
#include <xenctrl.h>
#include <flask.h>
#define PKG "xen.lowlevel.flask"
#define CLS "flask"
#define CTX_LEN 1024
static PyObject *xc_error_obj;
typedef struct {
PyObject_HEAD;
int xc_handle;
} XcObject;
static PyObject *pyflask_context_to_sid(PyObject *self, PyObject *args,
PyObject *kwds)
{
int xc_handle;
char *ctx;
char *buf;
uint32_t len;
uint32_t sid;
int ret;
static char *kwd_list[] = { "context", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "s", kwd_list,
&ctx) )
return NULL;
len = strlen(ctx);
buf = malloc(len);
if (!buf) {
errno = -ENOMEM;
PyErr_SetFromErrno(xc_error_obj);
}
memcpy(buf, ctx, len);
xc_handle = xc_interface_open();
if (xc_handle < 0) {
errno = xc_handle;
free(buf);
return PyErr_SetFromErrno(xc_error_obj);
}
ret = flask_context_to_sid(xc_handle, buf, len, &sid);
xc_interface_close(xc_handle);
free(buf);
if ( ret != 0 ) {
errno = -ret;
return PyErr_SetFromErrno(xc_error_obj);
}
return PyInt_FromLong(sid);
}
static PyObject *pyflask_sid_to_context(PyObject *self, PyObject *args,
PyObject *kwds)
{
int xc_handle;
uint32_t sid;
char ctx[CTX_LEN];
uint32_t ctx_len = CTX_LEN;
int ret;
static char *kwd_list[] = { "sid", NULL };
if ( !PyArg_ParseTupleAndKeywords(args, kwds, "i", kwd_list,
&sid) )
return NULL;
xc_handle = xc_interface_open();
if (xc_handle < 0) {
errno = xc_handle;
return PyErr_SetFromErrno(xc_error_obj);
}
ret = flask_sid_to_context(xc_handle, sid, ctx, ctx_len);
xc_interface_close(xc_handle);
if ( ret != 0 ) {
errno = -ret;
return PyErr_SetFromErrno(xc_error_obj);
}
return Py_BuildValue("s", ctx, ctx_len);
}
static PyMethodDef pyflask_methods[] = {
{ "flask_context_to_sid",
(PyCFunction)pyflask_context_to_sid,
METH_KEYWORDS, "\n"
"Convert a context string to a dynamic SID.\n"
" context [str]: String specifying context to be converted\n"
"Returns: [int]: Numeric SID on success; -1 on error.\n" },
{ "flask_sid_to_context",
(PyCFunction)pyflask_sid_to_context,
METH_KEYWORDS, "\n"
"Convert a dynamic SID to context string.\n"
" context [int]: SID to be converted\n"
"Returns: [str]: Numeric SID on success; -1 on error.\n" },
{ NULL, NULL, 0, NULL }
};
PyMODINIT_FUNC initflask(void)
{
Py_InitModule("flask", pyflask_methods);
}
/*
* Local variables:
* c-indent-level: 4
* c-basic-offset: 4
* End:
*/
|
/* Copyright (C) 1996, 1997, 1998, 2000, 2001 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by David Mosberger (davidm@cs.arizona.edu).
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. */
/* __bb_exit_func() dumps all the basic-block statistics linked into
the __bb_head chain to .d files. */
#include <sys/gmon.h>
#include <sys/gmon_out.h>
#include <sys/types.h>
#include <stdio.h>
#include <stdio_ext.h>
#include <string.h>
#define OUT_NAME "gmon.out"
void
__bb_exit_func (void)
{
const int version = GMON_VERSION;
struct gmon_hdr ghdr;
struct __bb *ptr;
FILE *fp;
fp = fopen (OUT_NAME, "wb");
if (!fp)
{
perror (OUT_NAME);
return;
}
/* No threads use this stream. */
__fsetlocking (fp, FSETLOCKING_BYCALLER);
memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
memcpy (&ghdr.version, &version, sizeof (version));
fwrite_unlocked (&ghdr, sizeof (ghdr), 1, fp);
for (ptr = __bb_head; ptr != 0; ptr = ptr->next)
{
u_int ncounts = ptr->ncounts;
u_char tag;
u_int i;
tag = GMON_TAG_BB_COUNT;
fwrite_unlocked (&tag, sizeof (tag), 1, fp);
fwrite_unlocked (&ncounts, sizeof (ncounts), 1, fp);
for (i = 0; i < ncounts; ++i)
{
fwrite_unlocked (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1,
fp);
fwrite_unlocked (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
}
}
fclose (fp);
}
|
/***************************************************************************
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
* doomer3d@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, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
#ifndef EXTEDIT_H
#define EXTEDIT_H
#include <QObject>
#include <QProcess>
#include <QFileSystemWatcher>
#include <QAction>
#include <qt5xdg/XdgDesktopFile>
#include <qt5xdg/XdgAction>
class ExtEdit : public QObject
{
Q_OBJECT
public:
explicit ExtEdit(QObject *parent = 0);
QList<XdgAction*> getActions();
public Q_SLOTS:
void runExternalEditor();
private Q_SLOTS:
void closedExternalEditor(int exitCode, QProcess::ExitStatus exitStatus);
void editedFileChanged(const QString & path);
private:
void createAppList();
QList<XdgDesktopFile*> _appList;
QList<XdgAction*> _actionList;
QString _editFilename;
bool _fileIsChanged;
QFileSystemWatcher *_watcherEditedFile;
};
#endif // EXTEDIT_H
|
#include "includes.h"
void displaymajoreventstory(newsstoryst& ns,char* story,short* storyx_s,short* storyx_e);
void squadstory_text_location(newsstoryst& ns,bool liberalguardian,bool ccs,char* story);
void squadstory_text_opening(newsstoryst& ns,bool liberalguardian,bool ccs,char* story);
void preparepage(newsstoryst& ns, bool liberalguardian);
void displayads(newsstoryst& ns, bool liberalguardian, short* storyx_s, short* storyx_e,int& it2);
void displaystoryheader(newsstoryst& ns, bool liberalguardian, int& y, int header);
void generate_random_event_news_stories();
void advance_ccs_defeat_storyline();
void clean_up_empty_news_stories();
void run_television_news_stories();
void assign_page_numbers_to_newspaper_stories();
void display_newspaper();
void handle_public_opinion_impact(const newsstoryst &ns);
int liberal_guardian_writing_power();
newsstoryst* ccs_exposure_story();
newsstoryst* ccs_fbi_raid_story();
newsstoryst* ccs_strikes_story();
newsstoryst* new_major_event();
|
/*
*
* Iter Vehemens ad Necem (IVAN)
* Copyright (C) Timo Kiviluoto
* Released under the GNU General
* Public License
*
* See LICENSING which should be included
* along with this file for more details
*
*/
#ifndef __COMMAND_H__
#define __COMMAND_H__
#include "ivandef.h"
typedef truth (item::*sorter)(ccharacter*) const;
class command
{
public:
command(truth (*)(character*), cchar*, char, char, char, truth, truth = false);
truth (*GetLinkedFunction() const)(character*) { return LinkedFunction; }
cchar* GetDescription() const { return Description; }
int GetKey() const;
truth IsUsableInWilderness() const { return UsableInWilderness; }
truth IsWizardModeFunction() const { return WizardModeFunction; }
int SetCustomKey(int iKey){ int iKeyBkp=Key4; Key4 = iKey; return iKeyBkp; }
private:
truth (*LinkedFunction)(character*);
cchar* Description;
char Key1;
char Key2;
char Key3;
int Key4; // custom keys can be more than 1 char long as ex.: KEY_HOME is 0x147 or 0x0147
truth UsableInWilderness;
truth WizardModeFunction;
};
class commandsystem
{
public:
static command* GetCommand(int I) { return Command[I]; }
static truth IsForRegionListItem(int iIndex);
static truth IsForRegionSilhouette(int iIndex);
static void PlayerDiedLookMode(bool bSeeWholeMapCheatMode=false);
static void PlayerDiedWeaponSkills();
static void SaveSwapWeapons(outputfile& SaveFile);
static void LoadSwapWeapons(inputfile& SaveFile);
static void ClearSwapWeapons();
static std::vector<v2> GetRouteGoOnCopy();
private:
static truth Apply(character*);
static truth ApplyWork(character* Char,item* itOverride=NULL);
static truth ApplyAgain(character* Char);
static truth Close(character*);
static truth Eat(character*);
static truth Drink(character*);
static truth Taste(character*);
static truth Dip(character*);
static truth DrawMessageHistory(character*);
static truth SwapWeapons(character* Char);
static truth SwapWeaponsWork(character* Char, int iIndexOverride=-1);
static truth SwapWeaponsCfg(character* Char);
static truth Drop(character*);
static truth ForceVomit(character*);
static truth GoDown(character*);
static truth GoUp(character*);
static truth Kick(character*);
static truth Look(character*);
static truth NOP(character*);
static truth Offer(character*);
static truth Open(character*);
static truth PickUp(character*);
static truth Pray(character*);
static truth Craft(character*);
static truth Quit(character*);
static truth Read(character*);
static truth Save(character*);
static truth ShowInventory(character*);
static truth ShowKeyLayout(character*);
static truth ShowWeaponSkills(character*);
static truth Talk(character*);
static truth Throw(character*);
static truth EquipmentScreen(character*);
static truth WhatToEngrave(character*);
static truth WhatToEngrave(character* Char,bool bEngraveNote,v2 v2EngraveNotePos);
static truth Zap(character*);
static truth Rest(character*);
static truth Sit(character*);
static truth ShowMap(character*);
static truth ShowMapWork(character* Char,v2* pv2ChoseLocation=NULL);
static truth Go(character*);
static truth ShowConfigScreen(character*);
static truth ScrollMessagesDown(character*);
static truth ScrollMessagesUp(character*);
static truth WieldInRightArm(character*);
static truth WieldInLeftArm(character*);
static truth AssignName(character*);
static truth Search(character*);
static truth Consume(character*, cchar*, cchar*, sorter, truth = false);
static truth ShowWorldSeed(character*);
#ifdef WIZARD
static truth WizardMode(character*);
static truth AutoPlay(character* Char);
static truth RaiseStats(character*);
static truth LowerStats(character*);
static truth SeeWholeMap(character*);
static truth WalkThroughWalls(character*);
static truth RaiseGodRelations(character*);
static truth LowerGodRelations(character*);
static truth GainDivineKnowledge(character*);
static truth GainAllItems(character*);
static truth SecretKnowledge(character*);
static truth DetachBodyPart(character*);
static truth SetFireToBodyPart(character*);
static truth SummonMonster(character*);
static truth LevelTeleport(character*);
static truth Possess(character*);
static truth Polymorph(character*);
#else
static truth DevConsCmd(character* Char);
#endif
static truth ToggleRunning(character*);
static truth IssueCommand(character*);
static command* Command[];
};
#endif
|
/*
* This file is part of Luma3DS
* Copyright (C) 2016-2017 Aurora Wright, TuxSH
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Additional Terms 7.b and 7.c of GPLv3 apply to this file:
* * Requiring preservation of specified reasonable legal notices or
* author attributions in that material or in the Appropriate Legal
* Notices displayed by works containing it.
* * Prohibiting misrepresentation of the origin of that material,
* or requiring that modified versions of such material be marked in
* reasonable ways as different from the original version.
*/
#include "svc/ControlMemory.h"
Result ControlMemoryHook(u32 *addrOut, u32 addr0, u32 addr1, u32 size, MemOp op, MemPerm perm)
{
KProcess *currentProcess = currentCoreContext->objectContext.currentProcess;
return ControlMemory(addrOut, addr0, addr1, size, op, perm, idOfProcess(currentProcess) == 1);
}
|
#ifndef MANTID_PYTHONINTERFACE_IFUNCTION1DADAPTER_H_
#define MANTID_PYTHONINTERFACE_IFUNCTION1DADAPTER_H_
/**
Copyright © 2011 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge
National Laboratory & European Spallation Source
This file is part of Mantid.
Mantid is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
Mantid 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/>.
File change history is stored at: <https://github.com/mantidproject/mantid>.
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
//-----------------------------------------------------------------------------
// Includes
//-----------------------------------------------------------------------------
#include "MantidAPI/IFunction1D.h"
#include "MantidAPI/ParamFunction.h"
#include "MantidPythonInterface/api/FitFunctions/IFunctionAdapter.h"
#include <boost/python/object.hpp>
namespace Mantid {
namespace PythonInterface {
/**
* Provides a layer class for boost::python to allow C++ virtual functions
* to be overridden in a Python object that is derived from IFunction1D.
*
* This is essentially a transparent layer that handles the function calls up
*into Python.
*/
#if defined(_MSC_VER) && _MSC_VER >= 1900
// All Python tests segfault on MSVC 2015 if the virtual specifiers are included
// The segault happens on initializing this constructor. Conversely on all other
// compilers it won't even compile without the virtual specifier.
class IFunction1DAdapter : public API::ParamFunction,
public API::IFunction1D,
public IFunctionAdapter {
#else
class IFunction1DAdapter : public virtual API::ParamFunction,
public virtual API::IFunction1D,
public IFunctionAdapter {
#endif
public:
/// A constructor that looks like a Python __init__ method
IFunction1DAdapter(PyObject *self);
/// Disable copy operator - The PyObject must be supplied to construct the
/// object
IFunction1DAdapter(const IFunction1DAdapter &) = delete;
/// Disable assignment operator
IFunction1DAdapter &operator=(const IFunction1DAdapter &) = delete;
/** @name Virtual methods */
///@{
/// Base-class method
void function1D(double *out, const double *xValues,
const size_t nData) const override;
/// Python-type signature
boost::python::object function1D(const boost::python::object &xvals) const;
/// Derivatives of function with respect to active parameters (C++ override)
void functionDeriv1D(API::Jacobian *out, const double *xValues,
const size_t nData) override;
///@}
private:
/// Flag if the functionDeriv1D method is overridden (avoids multiple checks)
bool m_derivOveridden;
};
}
}
#endif /* MANTID_PYTHONINTERFACE_IFUNCTION1DADAPTER_H_ */
|
/*
* SPDX-FileCopyrightText: 2017 Rolf Eike Beer <eike@sf-mail.de>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
#pragma once
#include <dirent.h>
#include <string>
#include <osm2go_cpp.h>
#include <osm2go_stl.h>
struct fdguard {
explicit fdguard(int f) : fd(f) {}
/**
* @brief open a filename as anchor point
* @param dirname path of the directory to open
*
* It will use O_CLOEXEC, O_PATH, and O_DIRECTORY if present. If O_PATH is not
* defined O_RDONLY will be used instead.
*/
explicit fdguard(const char *dirname);
/**
* @brief open a filename as anchor point
* @param pathname the path to open
* @param flags additional flags to pass to open.
*
* O_CLOEXEC will always be added to flags.
*/
explicit fdguard(const char *pathname, int flags);
/**
* @brief open a filename as anchor point
* @param basefd file descriptor to use as base for pathname
* @param pathname the path to open
* @param flags additional flags to pass to open.
*
* O_CLOEXEC will always be added to flags.
*/
explicit fdguard(int basefd, const char *pathname, int flags);
#if __cplusplus >= 201103L
inline fdguard(fdguard &&other) noexcept
: fd(other.fd)
{
const_cast<int &>(other.fd) = -1;
}
fdguard(const fdguard &other) = delete;
fdguard &operator=(const fdguard &other) = delete;
#else
fdguard(const fdguard &other);
fdguard &operator=(const fdguard &other);
#endif
~fdguard();
const int fd;
inline operator int() const noexcept { return fd; }
inline operator bool() const noexcept { return valid(); }
inline bool valid() const noexcept { return fd >= 0; }
void swap(fdguard &other) noexcept;
};
class dirguard {
const std::string p;
DIR * const d;
public:
#if __cplusplus >= 201103L
dirguard(const dirguard &other) = delete;
dirguard() = delete;
inline dirguard(dirguard &&f) noexcept
: p(std::move(f.p)), d(f.d)
{
const_cast<DIR*&>(f.d) = nullptr;
}
#else
dirguard(const dirguard &other);
explicit inline dirguard() : d(nullptr) {}
dirguard &operator=(const dirguard &other);
#endif
/**
* @brief opens the given directory
*/
explicit inline dirguard(const char *name) __attribute__((nonnull(2)))
: p(name), d(opendir(name)) {}
explicit inline dirguard(const std::string &name)
: p(ends_with(name, '/') ? name : name + '/'), d(opendir(name.c_str())) {}
explicit dirguard(int fd);
/**
* @brief opens the given subdirectory of a parent directory
*/
explicit dirguard(const dirguard &parent, const char *subdir)
: p(parent.path() + subdir + '/'), d(opendir(p.c_str())) {}
~dirguard();
inline bool valid() const noexcept { return d != nullptr; }
inline dirent *next() { return readdir(d); }
inline int dirfd() const { return ::dirfd(d); }
/**
* @brief the path name of the directory
*
* This may be empty if the object was initialized from a filedescriptor.
*/
inline const std::string &path() const noexcept
{ return p; }
};
std::string find_file(const std::string &n) __attribute__((warn_unused_result));
|
/*
This file is part of Telegram Desktop,
the official desktop application for the Telegram messaging service.
For license and copyright information please follow this link:
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
*/
#pragma once
#ifndef OS_OSX
namespace Media {
namespace Player {
struct TrackState;
} // namespace Player
} // namespace Media
@class NSButton;
@class NSCustomTouchBarItem;
@class NSImage;
@class NSSliderTouchBarItem;
namespace TouchBar {
[[nodiscard]] API_AVAILABLE(macos(10.12.2))
NSButton *CreateTouchBarButton(
NSImage *image,
rpl::lifetime &lifetime,
Fn<void()> callback);
[[nodiscard]] API_AVAILABLE(macos(10.12.2))
NSButton *CreateTouchBarButton(
const style::icon &icon,
rpl::lifetime &lifetime,
Fn<void()> callback);
[[nodiscard]] API_AVAILABLE(macos(10.12.2))
NSButton *CreateTouchBarButtonWithTwoStates(
NSImage *icon1,
NSImage *icon2,
rpl::lifetime &lifetime,
Fn<void(bool)> callback,
bool firstState,
rpl::producer<bool> stateChanged = rpl::never<bool>());
[[nodiscard]] API_AVAILABLE(macos(10.12.2))
NSButton *CreateTouchBarButtonWithTwoStates(
const style::icon &icon1,
const style::icon &icon2,
rpl::lifetime &lifetime,
Fn<void(bool)> callback,
bool firstState,
rpl::producer<bool> stateChanged = rpl::never<bool>());
[[nodiscard]] API_AVAILABLE(macos(10.12.2))
NSSliderTouchBarItem *CreateTouchBarSlider(
NSString *itemId,
rpl::lifetime &lifetime,
Fn<void(bool, double, double)> callback,
rpl::producer<Media::Player::TrackState> stateChanged);
[[nodiscard]] API_AVAILABLE(macos(10.12.2))
NSCustomTouchBarItem *CreateTouchBarTrackPosition(
NSString *itemId,
rpl::producer<Media::Player::TrackState> stateChanged);
} // namespace TouchBar
#endif // OS_OSX
|
/* -*- c++ -*- */
/*
* Copyright (C) 2002,2007,2012,2017 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#ifndef _MMSE_INTERP_DIFFERENTIATOR_FF_H_
#define _MMSE_INTERP_DIFFERENTIATOR_FF_H_
#include <gnuradio/filter/api.h>
#include <gnuradio/filter/fir_filter.h>
#include <vector>
namespace gr {
namespace filter {
/*!
* \brief Compute intermediate samples of the derivative of a signal
* between signal samples x(k*Ts)
* \ingroup filter_primitive
*
* \details
* This implements a Minimum Mean Squared Error interpolating
* differentiator with 8 taps. It is suitable for signals where the
* derivative of a signal has a bandwidth of interest in the range
* (-Fs/4, Fs/4), where Fs is the samples rate.
*
* Although mu, the fractional delay, is specified as a float, in
* the range [0.0, 1.0], it is actually quantized. That is, mu is
* quantized in the differentiate method to 128th's of a sample.
*
*/
class FILTER_API mmse_interp_differentiator_ff
{
public:
mmse_interp_differentiator_ff();
~mmse_interp_differentiator_ff();
unsigned ntaps() const;
unsigned nsteps() const;
/*!
* \brief compute a single interpolated differentiated output value.
*
* \p input must have ntaps() valid entries.
* input[0] .. input[ntaps() - 1] are referenced to compute the output
* value.
*
* \p mu must be in the range [0, 1] and specifies the fractional delay.
*
* \throws std::runtime_error if mu is not in the range [0, 1].
*
* \returns the interpolated differentiated output value.
*/
float differentiate(const float input[], float mu) const;
protected:
std::vector<kernel::fir_filter_fff*> filters;
};
} /* namespace filter */
} /* namespace gr */
#endif /* _MMSE_INTERP_DIFFERENTIATOR_FF_H_ */
|
using namespace std;
void initSet(int N, vector<int> &pset);
int findSet(int i, vector<int> &pset);
void unionSet(int i, int j, vector<int> &pset);
bool isSameSet(int i, int j, vector<int> &pset);
void printSet(vector<int> &pset);
//init set: each item initially has itself as the representative
void initSet(int N, vector<int> &pset) {
pset.resize(N);
for(int i = 0; i < N; ++i)
pset[i] = i;
}
//select the representative for i
int findSet(int i, vector<int> &pset) {
return (pset[i] == i)? i : (pset[i] = findSet(pset[i],pset));
}
//merge two sets
void unionSet(int i, int j, vector<int> &pset){
pset[findSet(i,pset)] = findSet(j,pset);
}
//check if i and j are in same set
bool isSameSet(int i, int j, vector<int> &pset) {
return findSet(i,pset) == findSet(j,pset);
}
void printSet(vector<int> &pset){
for(int i=0; i<pset.size(); ++i)
cout<<pset[i]<<" ";
cout<<endl;
}
|
//
// CFArray+Sort.h
// Cydia
//
// Created on 8/29/16.
//
// Insertion Sort
CFIndex SKBSearch_(const void *element,
CFIndex elementSize,
const void *list,
CFIndex count,
CFComparatorFunction comparator,
void *context);
CFIndex CFBSearch_(const void *element,
CFIndex elementSize,
const void *list,
CFIndex count,
CFComparatorFunction comparator,
void *context);
void CFArrayInsertionSortValues(CFMutableArrayRef array,
CFRange range,
CFComparatorFunction comparator,
void *context);
|
/* -*- mode: C; c-file-style: "stroustrup"; -*-
*
* Copyright (c) 2007 by Stefan Siegl <stesie@brokenpipe.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License (either version 2 or
* version 3) 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* For more information on the GPL, please go to:
* http://www.gnu.org/copyleft/gpl.html
*/
#ifndef BOOTP_NET_H
#define BOOTP_NET_H
/* constants */
#define BOOTPS_PORT 67
#define BOOTPC_PORT 68
/* prototypes */
void bootp_net_init(void);
void bootp_net_main(void);
#endif /* BOOTP_NET_H */
|
/*
Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the terms of version 2.1 of the GNU Lesser General Public License
as published by the Free Software Foundation.
This program is distributed in the hope that it would be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Further, this software is distributed without any warranty that it is
free of the rightful claim of any third person regarding infringement
or the like. Any license provided herein, whether implied or
otherwise, applies only to this software file. Patent licenses, if
any, provided herein do not apply to combinations of this program with
other software, or any other product whatsoever.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
USA.
Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky,
Mountain View, CA 94043, or:
http://www.sgi.com
For further information regarding this notice, see:
http://oss.sgi.com/projects/GenInfo/NoticeExplan
*/
#pragma ident "@(#) libfi/mpp_reduce/maxloc_p_4.c 92.1 07/09/99 17:05:42"
#include <stdlib.h>
#include <liberrno.h>
#include <fmath.h>
#include <cray/dopevec.h>
#include "f90_macros.h"
#define SIGN_BIT (1 << 63)
#define RANK 4
/*
* Compiler generated call: CALL _MAXLOC_JP4(RESULT, SOURCE, MASK)
*
* Purpose: Determine the location of the first element of SOURCE
* having the maximum value of the elements identified
* by MASK. This particular routine handles source arrays
* of rank 4 with a data type of 64-bit integer or
* 64-bit floating point.
*
* Arguments:
* RESULT - Dope vector for result temporary array
* SOURCE - Dope vector for user source array
* MASK - Dope vector for logical mask array
*
* Description:
* This is the MPP version of MAXLOC. This particular
* file contains the the intermediate type-specific
* routines. These routines parse and update the dope
* vectors, allocate either shared or private space for
* the result temporary, and possibly update the shared
* data desriptor (sdd) for the result temporary. Once
* this set-up work is complete, a Fortran subroutine
* is called which uses features from the Fortran
* Programming Model to distribute the word across all
* processors.
*
* Include file maxloc_p.h contains the rank independent
* source code for this routine.
*/
#include "maxloc_p.h"
|
/*
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight and Betaflight are distributed in the hope that they
* 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 software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/time.h"
#include "fc/config.h"
#define TASK_PERIOD_HZ(hz) (1000000 / (hz))
#define TASK_PERIOD_MS(ms) ((ms) * 1000)
#define TASK_PERIOD_US(us) (us)
typedef enum {
TASK_PRIORITY_IDLE = 0, // Disables dynamic scheduling, task is executed only if no other task is active this cycle
TASK_PRIORITY_LOW = 1,
TASK_PRIORITY_MEDIUM = 3,
TASK_PRIORITY_MEDIUM_HIGH = 4,
TASK_PRIORITY_HIGH = 5,
TASK_PRIORITY_REALTIME = 6,
TASK_PRIORITY_MAX = 255
} cfTaskPriority_e;
typedef struct {
timeUs_t maxExecutionTime;
timeUs_t totalExecutionTime;
timeUs_t averageExecutionTime;
timeUs_t averageDeltaTime;
} cfCheckFuncInfo_t;
typedef struct {
const char * taskName;
const char * subTaskName;
bool isEnabled;
uint8_t staticPriority;
timeDelta_t desiredPeriod;
timeDelta_t latestDeltaTime;
timeUs_t maxExecutionTime;
timeUs_t totalExecutionTime;
timeUs_t averageExecutionTime;
timeUs_t averageDeltaTime;
float movingAverageCycleTime;
} cfTaskInfo_t;
typedef enum {
/* Actual tasks */
TASK_SYSTEM = 0,
TASK_MAIN,
TASK_GYROPID,
TASK_ACCEL,
TASK_ATTITUDE,
TASK_RX,
TASK_SERIAL,
TASK_DISPATCH,
TASK_BATTERY_VOLTAGE,
TASK_BATTERY_CURRENT,
TASK_BATTERY_ALERTS,
#ifdef USE_BEEPER
TASK_BEEPER,
#endif
#ifdef USE_GPS
TASK_GPS,
#endif
#ifdef USE_MAG
TASK_COMPASS,
#endif
#ifdef USE_BARO
TASK_BARO,
#endif
#ifdef USE_RANGEFINDER
TASK_RANGEFINDER,
#endif
#if defined(USE_BARO) || defined(USE_GPS)
TASK_ALTITUDE,
#endif
#ifdef USE_DASHBOARD
TASK_DASHBOARD,
#endif
#ifdef USE_TELEMETRY
TASK_TELEMETRY,
#endif
#ifdef USE_LED_STRIP
TASK_LEDSTRIP,
#endif
#ifdef USE_TRANSPONDER
TASK_TRANSPONDER,
#endif
#ifdef STACK_CHECK
TASK_STACK_CHECK,
#endif
#ifdef USE_OSD
TASK_OSD,
#endif
#ifdef USE_BST
TASK_BST_MASTER_PROCESS,
#endif
#ifdef USE_ESC_SENSOR
TASK_ESC_SENSOR,
#endif
#ifdef USE_CMS
TASK_CMS,
#endif
#ifdef USE_VTX_CONTROL
TASK_VTXCTRL,
#endif
#ifdef USE_CAMERA_CONTROL
TASK_CAMCTRL,
#endif
#ifdef USE_RCDEVICE
TASK_RCDEVICE,
#endif
#ifdef USE_ADC_INTERNAL
TASK_ADC_INTERNAL,
#endif
#ifdef USE_PINIOBOX
TASK_PINIOBOX,
#endif
/* Count of real tasks */
TASK_COUNT,
/* Service task IDs */
TASK_NONE = TASK_COUNT,
TASK_SELF
} cfTaskId_e;
typedef struct {
// Configuration
#if defined(USE_TASK_STATISTICS)
const char * taskName;
const char * subTaskName;
#endif
bool (*checkFunc)(timeUs_t currentTimeUs, timeDelta_t currentDeltaTimeUs);
void (*taskFunc)(timeUs_t currentTimeUs);
timeDelta_t desiredPeriod; // target period of execution
const uint8_t staticPriority; // dynamicPriority grows in steps of this size, shouldn't be zero
// Scheduling
uint16_t dynamicPriority; // measurement of how old task was last executed, used to avoid task starvation
uint16_t taskAgeCycles;
timeDelta_t taskLatestDeltaTime;
timeUs_t lastExecutedAt; // last time of invocation
timeUs_t lastSignaledAt; // time of invocation event for event-driven tasks
timeUs_t lastDesiredAt; // time of last desired execution
#if defined(USE_TASK_STATISTICS)
// Statistics
float movingAverageCycleTime;
timeUs_t movingSumExecutionTime; // moving sum over 32 samples
timeUs_t movingSumDeltaTime; // moving sum over 32 samples
timeUs_t maxExecutionTime;
timeUs_t totalExecutionTime; // total time consumed by task since boot
#endif
} cfTask_t;
extern cfTask_t cfTasks[TASK_COUNT];
extern uint16_t averageSystemLoadPercent;
void getCheckFuncInfo(cfCheckFuncInfo_t *checkFuncInfo);
void getTaskInfo(cfTaskId_e taskId, cfTaskInfo_t *taskInfo);
void rescheduleTask(cfTaskId_e taskId, uint32_t newPeriodMicros);
void setTaskEnabled(cfTaskId_e taskId, bool newEnabledState);
timeDelta_t getTaskDeltaTime(cfTaskId_e taskId);
void schedulerSetCalulateTaskStatistics(bool calculateTaskStatistics);
void schedulerResetTaskStatistics(cfTaskId_e taskId);
void schedulerResetTaskMaxExecutionTime(cfTaskId_e taskId);
void schedulerInit(void);
void scheduler(void);
void taskSystemLoad(timeUs_t currentTime);
void schedulerOptimizeRate(bool optimizeRate);
#define LOAD_PERCENTAGE_ONE 100
#define isSystemOverloaded() (averageSystemLoadPercent >= LOAD_PERCENTAGE_ONE)
|
#pragma once
#include "filesystem_error.h"
namespace fs
{
template<typename ValueType>
class Result
{
public:
Result(ValueType &&value) :
mError(Error::OK),
mValue(std::move(value))
{
}
Result(const ValueType &value) :
mError(Error::OK),
mValue(value)
{
}
Result(Error error) :
mError(error)
{
}
Result(Error error, const ValueType &value) :
mError(error),
mValue(value)
{
}
ValueType value()
{
return mValue;
}
Error error() const
{
return mError;
}
explicit operator bool() const
{
return mError == Error::OK;
}
operator Error() const
{
return mError;
}
operator ValueType() const
{
return mValue;
}
private:
Error mError;
ValueType mValue;
};
template<>
class Result<Error>
{
public:
Result(Error error) :
mError(error)
{
}
Error error() const
{
return mError;
}
explicit operator bool() const
{
return mError == Error::OK;
}
operator Error() const
{
return mError;
}
private:
Error mError;
};
} // namespace fs
|
/*
* Generated by asn1c-0.9.24 (http://lionet.info/asn1c)
* From ASN.1 module "PDU-definitions"
* found in "../asn/PDU-definitions.asn"
* `asn1c -fcompound-names -fnative-types`
*/
#ifndef _InitialDirectTransfer_v690ext_IEs_H_
#define _InitialDirectTransfer_v690ext_IEs_H_
#include <asn_application.h>
/* Including external dependencies */
#include <constr_SEQUENCE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Forward declarations */
struct PLMN_Identity;
struct MeasuredResultsOnRACHinterFreq;
struct MBMS_JoinedInformation_r6;
/* InitialDirectTransfer-v690ext-IEs */
typedef struct InitialDirectTransfer_v690ext_IEs {
struct PLMN_Identity *plmn_Identity /* OPTIONAL */;
struct MeasuredResultsOnRACHinterFreq *measuredResultsOnRACHinterFreq /* OPTIONAL */;
struct MBMS_JoinedInformation_r6 *mbms_JoinedInformation /* OPTIONAL */;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} InitialDirectTransfer_v690ext_IEs_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_InitialDirectTransfer_v690ext_IEs;
#ifdef __cplusplus
}
#endif
/* Referred external types */
#include "PLMN-Identity.h"
#include "MeasuredResultsOnRACHinterFreq.h"
#include "MBMS-JoinedInformation-r6.h"
#endif /* _InitialDirectTransfer_v690ext_IEs_H_ */
#include <asn_internal.h>
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <QtGlobal>
#include "nodeinstanceserver.h"
#include <designersupportdelegate.h>
QT_BEGIN_NAMESPACE
class QQuickItem;
QT_END_NAMESPACE
namespace QmlDesigner {
class Qt5NodeInstanceServer : public NodeInstanceServer
{
Q_OBJECT
public:
Qt5NodeInstanceServer(NodeInstanceClientInterface *nodeInstanceClient);
~Qt5NodeInstanceServer();
QQuickView *quickView() const override;
QQmlView *declarativeView() const override;
QQmlEngine *engine() const override;
void refreshBindings() override;
DesignerSupport *designerSupport();
void createScene(const CreateSceneCommand &command) override;
void clearScene(const ClearSceneCommand &command) override;
void reparentInstances(const ReparentInstancesCommand &command) override;
protected:
void initializeView() override;
void resizeCanvasSizeToRootItemSize() override;
void resetAllItems();
void setupScene(const CreateSceneCommand &command) override;
QList<QQuickItem*> allItems() const;
private:
QPointer<QQuickView> m_quickView;
DesignerSupport m_designerSupport;
};
} // QmlDesigner
|
#ifndef _FS_PLUGIN_H__
#define _FS_PLUGIN_H__
#include "fstype.h"
int on_new_client(struct fs_context* context, int cid);
int on_recv_data(struct fs_context* context, int cid);
int on_close_client(struct fs_context* context, int cid);
int on_write_data(struct fs_context* context, int cid);
int on_recv_from(struct fs_context* context, char* data, int length,
struct sockaddr_in* fromaddr);
int on_load(struct fs_context* context);
int on_release(struct fs_context* context);
#endif
|
/* @(#)s_asinh.c 5.1 93/09/24 */
/*
* ====================================================
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
*
* Developed at SunPro, a Sun Microsystems, Inc. business.
* Permission to use, copy, modify, and distribute this
* software is freely granted, provided that this notice
* is preserved.
* ====================================================
*/
/* LINTLIBRARY */
/* asinh(x)
* Method :
* Based on
* asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ]
* we have
* asinh(x) := x if 1+x*x=1,
* := sign(x)*(log(x)+ln2)) for large |x|, else
* := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else
* := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2)))
*/
#include <sys/cdefs.h>
#include <float.h>
#include <math.h>
#include "math_private.h"
static const double
one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */
ln2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */
huge= 1.00000000000000000000e+300;
double
asinh(double x)
{
double t,w;
int32_t hx,ix;
GET_HIGH_WORD(hx,x);
ix = hx&0x7fffffff;
if(ix>=0x7ff00000) return x+x; /* x is inf or NaN */
if(ix< 0x3e300000) { /* |x|<2**-28 */
if(huge+x>one) return x; /* return x inexact except 0 */
}
if(ix>0x41b00000) { /* |x| > 2**28 */
w = log(fabs(x))+ln2;
} else if (ix>0x40000000) { /* 2**28 > |x| > 2.0 */
t = fabs(x);
w = log(2.0*t+one/(sqrt(x*x+one)+t));
} else { /* 2.0 > |x| > 2**-28 */
t = x*x;
w =log1p(fabs(x)+t/(one+sqrt(one+t)));
}
if(hx>0) return w; else return -w;
}
#if LDBL_MANT_DIG == 53
#ifdef lint
/* PROTOLIB1 */
long double asinhl(long double);
#else /* lint */
__weak_alias(asinhl, asinh);
#endif /* lint */
#endif /* LDBL_MANT_DIG == 53 */
|
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2014 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Zeev Suraski <zeev@zend.com> |
| Andrey Hristov <andrey@php.net> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifndef PHP_MYSQL_STRUCTS_H
#define PHP_MYSQL_STRUCTS_H
#ifdef ZTS
#include "TSRM.h"
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#if defined(MYSQL_USE_MYSQLND)
#include "ext/mysqlnd/mysqlnd.h"
#include "mysql_mysqlnd.h"
#else
#include <mysql.h>
#endif
#ifdef PHP_MYSQL_UNIX_SOCK_ADDR
#ifdef MYSQL_UNIX_ADDR
#undef MYSQL_UNIX_ADDR
#endif
#define MYSQL_UNIX_ADDR PHP_MYSQL_UNIX_SOCK_ADDR
#endif
#if (MYSQL_VERSION_ID >= 40113 && MYSQL_VERSION_ID < 50000) || MYSQL_VERSION_ID >= 50007 || defined(MYSQL_USE_MYSQLND)
#define MYSQL_HAS_SET_CHARSET
#endif
PHP_MINIT_FUNCTION(mysql);
PHP_RINIT_FUNCTION(mysql);
PHP_MSHUTDOWN_FUNCTION(mysql);
PHP_RSHUTDOWN_FUNCTION(mysql);
PHP_MINFO_FUNCTION(mysql);
PHP_FUNCTION(mysql_connect);
PHP_FUNCTION(mysql_pconnect);
PHP_FUNCTION(mysql_close);
PHP_FUNCTION(mysql_select_db);
#if MYSQL_VERSION_ID < 40000
PHP_FUNCTION(mysql_create_db);
PHP_FUNCTION(mysql_drop_db);
#endif
PHP_FUNCTION(mysql_query);
PHP_FUNCTION(mysql_unbuffered_query);
PHP_FUNCTION(mysql_db_query);
PHP_FUNCTION(mysql_list_dbs);
PHP_FUNCTION(mysql_list_tables);
PHP_FUNCTION(mysql_list_fields);
PHP_FUNCTION(mysql_list_processes);
PHP_FUNCTION(mysql_error);
PHP_FUNCTION(mysql_errno);
PHP_FUNCTION(mysql_affected_rows);
PHP_FUNCTION(mysql_insert_id);
PHP_FUNCTION(mysql_result);
PHP_FUNCTION(mysql_num_rows);
PHP_FUNCTION(mysql_num_fields);
PHP_FUNCTION(mysql_fetch_row);
PHP_FUNCTION(mysql_fetch_array);
PHP_FUNCTION(mysql_fetch_assoc);
PHP_FUNCTION(mysql_fetch_object);
PHP_FUNCTION(mysql_data_seek);
PHP_FUNCTION(mysql_fetch_lengths);
PHP_FUNCTION(mysql_fetch_field);
PHP_FUNCTION(mysql_field_seek);
PHP_FUNCTION(mysql_free_result);
PHP_FUNCTION(mysql_field_name);
PHP_FUNCTION(mysql_field_table);
PHP_FUNCTION(mysql_field_len);
PHP_FUNCTION(mysql_field_type);
PHP_FUNCTION(mysql_field_flags);
PHP_FUNCTION(mysql_escape_string);
PHP_FUNCTION(mysql_real_escape_string);
PHP_FUNCTION(mysql_get_client_info);
PHP_FUNCTION(mysql_get_host_info);
PHP_FUNCTION(mysql_get_proto_info);
PHP_FUNCTION(mysql_get_server_info);
PHP_FUNCTION(mysql_info);
PHP_FUNCTION(mysql_stat);
PHP_FUNCTION(mysql_thread_id);
PHP_FUNCTION(mysql_client_encoding);
PHP_FUNCTION(mysql_ping);
#ifdef MYSQL_HAS_SET_CHARSET
PHP_FUNCTION(mysql_set_charset);
#endif
ZEND_BEGIN_MODULE_GLOBALS(mysql)
long default_link;
long num_links,num_persistent;
long max_links,max_persistent;
long allow_persistent;
long default_port;
char *default_host, *default_user, *default_password;
char *default_socket;
char *connect_error;
long connect_errno;
long connect_timeout;
long result_allocated;
long trace_mode;
long allow_local_infile;
ZEND_END_MODULE_GLOBALS(mysql)
#ifdef ZTS
# define MySG(v) TSRMG(mysql_globals_id, zend_mysql_globals *, v)
#else
# define MySG(v) (mysql_globals.v)
#endif
#endif /* PHP_MYSQL_STRUCTS_H */
|
// File_Rar - Info for RAR files
// Copyright (C) 2005-2011 MediaArea.net SARL, Info@MediaArea.net
//
// This library is free software: you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this library. If not, see <http://www.gnu.org/licenses/>.
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
// Information about RAR files
//
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//---------------------------------------------------------------------------
#ifndef MediaInfo_File_RarH
#define MediaInfo_File_RarH
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
#include "MediaInfo/File__Analyze.h"
//---------------------------------------------------------------------------
namespace MediaInfoLib
{
//***************************************************************************
// Class File_Rar
//***************************************************************************
class File_Rar : public File__Analyze
{
public :
File_Rar();
protected :
int state;
//Buffer - File header
bool FileHeader_Begin();
//Buffer - Per element
bool Header_Begin();
void Header_Parse();
void Header_Parse_Flags();
void Header_Parse_Flags_73();
void Header_Parse_Flags_74();
void Header_Parse_Flags_XX();
void Header_Parse_Content();
void Header_Parse_Content_73();
void Header_Parse_Content_74();
void Header_Parse_Content_XX();
void Data_Parse();
//Temp
int8u HEAD_TYPE;
int32u PACK_SIZE;
int32u HIGH_PACK_SIZE;
int16u HEAD_FLAGS;
bool high_fields;
bool usual_or_utf8;
bool salt;
bool exttime;
bool add_size;
};
} //NameSpace
#endif
|
/* This file is part of the Palabos library.
*
* Copyright (C) 2011-2015 FlowKit Sarl
* Route d'Oron 2
* 1010 Lausanne, Switzerland
* E-mail contact: contact@flowkit.com
*
* The most recent release of Palabos can be downloaded at
* <http://www.palabos.org/>
*
* The library Palabos is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* The 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FUNCTIONS_H
#define FUNCTIONS_H
#include "core/array.h"
namespace plb {
namespace util {
template<typename T, pluint size>
struct TimeDependentFunction {
virtual ~TimeDependentFunction() { }
virtual Array<T,size> operator()(T t) const =0;
virtual TimeDependentFunction<T,size>* clone() const=0;
};
struct SelectInt {
virtual ~SelectInt() { }
virtual bool operator() (plint value) const=0;
virtual SelectInt* clone() const=0;
};
class SelectConstInt : public SelectInt {
public:
SelectConstInt(plint constVal_) : constVal(constVal_) { }
virtual bool operator() (plint value) const {
return value == constVal;
}
virtual SelectConstInt* clone() const {
return new SelectConstInt(*this);
}
private:
plint constVal;
};
class SelectLargerEqualInt : public SelectInt {
public:
SelectLargerEqualInt(plint threshold_) : threshold(threshold_) { }
virtual bool operator() (plint value) const {
return value >= threshold;
}
virtual SelectLargerEqualInt* clone() const {
return new SelectLargerEqualInt(*this);
}
private:
plint threshold;
};
// Smoothly increasing function from 0.0 to 1.0 using a sine.
template<typename T>
T sinIncreasingFunction(T t, T maxT)
{
static T pi = std::acos((T) -1);
if (t >= maxT) {
return((T) 1);
}
if (t < 0) {
return((T) 0);
}
return(std::sin(pi * t / (2.0 * maxT)));
}
// Smoothly increasing function from 0.0 to 1.0 using the hyperbolic tangent function.
template<typename T>
T tanhIncreasingFunction(T t, T maxT)
{
if (t >= maxT) {
return((T) 1);
}
if (t < 0) {
return((T) 0);
}
return(0.5 * (1.0 + std::tanh(6.0 / maxT * (t - maxT / 2.0))));
}
} // namespace util
} // namespace plb
#endif // FUNCTIONS_H
|
/*************************************************************************\
* Copyright (C) Michael Kerrisk, 2010. *
* *
* This program is free software. You may use, modify, and redistribute it *
* under the terms of the GNU Affero General Public License as published *
* by the Free Software Foundation, either version 3 or (at your option) *
* any later version. This program is distributed without any warranty. *
* See the file COPYING.agpl-v3 for details. *
\*************************************************************************/
/* Solution for Exercise 49-1 */
/* mmcopy.c
Copy the contents of one file to another file, using memory mappings.
Usage mmcopy source-file dest-file
*/
#include <sys/mman.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "tlpi_hdr.h"
int
main(int argc, char *argv[])
{
char *src, *dst;
int fdSrc, fdDst;
struct stat sb;
if (argc != 3)
usageErr("%s source-file dest-file\n", argv[0]);
fdSrc = open(argv[1], O_RDONLY);
if (fdSrc == -1)
errExit("open");
/* Use fstat() to obtain size of file: we use this to specify the
size of the two mappings */
if (fstat(fdSrc, &sb) == -1)
errExit("fstat");
/* Handle zero-length file specially, since specifying a size of
zero to mmap() will fail with the error EINVAL */
if (sb.st_size == 0)
exit(EXIT_SUCCESS);
src = mmap(NULL, sb.st_size, PROT_READ, MAP_PRIVATE, fdSrc, 0);
if (src == MAP_FAILED)
errExit("mmap");
fdDst = open(argv[2], O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR);
if (fdDst == -1)
errExit("open");
if (ftruncate(fdDst, sb.st_size) == -1)
errExit("ftruncate");
dst = mmap(NULL, sb.st_size, PROT_READ | PROT_WRITE, MAP_SHARED, fdDst, 0);
if (dst == MAP_FAILED)
errExit("mmap");
memcpy(dst, src, sb.st_size); /* Copy bytes between mappings */
if (msync(dst, sb.st_size, MS_SYNC) == -1)
errExit("msync");
exit(EXIT_SUCCESS);
}
|
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef KITMANAGERCONFIGWIDGET_H
#define KITMANAGERCONFIGWIDGET_H
#include "kitconfigwidget.h"
#include <QWidget>
QT_BEGIN_NAMESPACE
class QGridLayout;
class QLabel;
class QLineEdit;
class QToolButton;
QT_END_NAMESPACE
namespace ProjectExplorer {
class Kit;
namespace Internal {
class KitManagerConfigWidget : public QWidget
{
Q_OBJECT
public:
explicit KitManagerConfigWidget(Kit *k);
~KitManagerConfigWidget();
QString displayName() const;
void apply();
void discard();
bool isDirty() const;
bool isValid() const;
bool hasWarning() const;
QString validityMessage() const;
void addConfigWidget(ProjectExplorer::KitConfigWidget *widget);
void makeStickySubWidgetsReadOnly();
Kit *workingCopy() const;
bool configures(ProjectExplorer::Kit *k) const;
void setIsDefaultKit(bool d);
bool isDefaultKit() const;
void removeKit();
void updateVisibility();
signals:
void dirty();
private slots:
void setIcon();
void setDisplayName();
void workingCopyWasUpdated(ProjectExplorer::Kit *k);
void kitWasUpdated(ProjectExplorer::Kit *k);
private:
enum LayoutColumns {
LabelColumn,
WidgetColumn,
ButtonColumn
};
QLabel *createLabel(const QString &name, const QString &toolTip);
void paintEvent(QPaintEvent *ev);
QGridLayout *m_layout;
QToolButton *m_iconButton;
QLineEdit *m_nameEdit;
QList<KitConfigWidget *> m_widgets;
QList<QLabel *> m_labels;
Kit *m_kit;
Kit *m_modifiedKit;
bool m_isDefaultKit;
bool m_fixingKit;
QPixmap m_background;
};
} // namespace Internal
} // namespace ProjectExplorer
#endif // KITMANAGERCONFIGWIDGET_H
|
/*
* rwlock2.c
*
*
* --------------------------------------------------------------------------
*
* Pthreads-win32 - POSIX Threads Library for Win32
* Copyright(C) 1998 John E. Bossom
* Copyright(C) 1999,2012 Pthreads-win32 contributors
*
* Homepage1: http://sourceware.org/pthreads-win32/
* Homepage2: http://sourceforge.net/projects/pthreads4w/
*
* The current list of contributors is contained
* in the file CONTRIBUTORS included with the source
* code distribution. The list can also be seen at the
* following World Wide Web location:
* http://sources.redhat.com/pthreads-win32/contributors.html
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library in the file COPYING.LIB;
* if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
* --------------------------------------------------------------------------
*
* Declare a static rwlock object, lock it,
* and then unlock it again.
*
* Depends on API functions:
* pthread_rwlock_rdlock()
* pthread_rwlock_unlock()
*/
#include "test.h"
pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER;
int
main()
{
assert(rwlock == PTHREAD_RWLOCK_INITIALIZER);
assert(pthread_rwlock_rdlock(&rwlock) == 0);
assert(rwlock != PTHREAD_RWLOCK_INITIALIZER);
assert(rwlock != NULL);
assert(pthread_rwlock_unlock(&rwlock) == 0);
assert(pthread_rwlock_destroy(&rwlock) == 0);
assert(rwlock == NULL);
return 0;
}
|
//
// Copyright (C) 2007 Jaroslav Libak
//
// Copyright (C) 2005-2007 SIPez LLC.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2004-2007 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef SipCallIdGenerator_h__
#define SipCallIdGenerator_h__
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <os/OsMutex.h>
#include <utl/UtlRandom.h>
#include <utl/UtlString.h>
// DEFINES
// EXTERNAL FUNCTIONS
// EXTERNAL VARIABLES
// CONSTANTS
// FORWARD DECLARATIONS
// STRUCTS
// TYPEDEFS
// MACROS
// GLOBAL VARIABLES
// GLOBAL FUNCTIONS
/**
* Generates pseudorandom call-ids. Takes prefix, process id,
* 2 internal counters, time, random number into account. Threadsafe.
*/
class SipCallIdGenerator
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
///@name Creators
//@{
/**
* Constructor.
*/
SipCallIdGenerator(const UtlString& prefix);
/**
* Destructor.
*/
~SipCallIdGenerator(void);
//@}
/* ============================ MANIPULATORS ============================== */
///@name Manipulators
//@{
/**
* Returns new pseudorandom call-id. Threadsafe.
*/
UtlString getNewCallId();
//@}
/* ============================ ACCESSORS ================================= */
///@name Accessors
//@{
//@}
/* ============================ INQUIRY =================================== */
///@name Inquiry
//@{
//@}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
int m_processId; /// < pid of process that created this object
unsigned int m_instanceId; ///< object instance id
Int64 m_creationTime; ///< time of creation in msecs
Int64 m_callIdCounter; ///< internal callid counter
UtlString m_sPrefix; ///< prefix for callids
UtlRandom m_RandomNumGenerator; ///< random number generator
OsMutex m_mutex;
char m_callIdSuffix[255]; ///< internal buffer for speedup
static unsigned int ms_instanceCounter; ///< global instance counter
};
#endif // SipCallIdGenerator_h__
|
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Linguist of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** This file may be used under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation and
** appearing in the file LICENSE.LGPL included in the packaging of this
** file. Please review the following information to ensure the GNU Lesser
** General Public License version 2.1 requirements will be met:
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU General
** Public License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of this
** file. Please review the following information to ensure the GNU General
** Public License version 3.0 requirements will be met:
** http://www.gnu.org/copyleft/gpl.html.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef FINDDIALOG_H
#define FINDDIALOG_H
#include "ui_finddialog.h"
#include "messagemodel.h"
#include <QDialog>
QT_BEGIN_NAMESPACE
class FindDialog : public QDialog, public Ui::FindDialog
{
Q_OBJECT
public:
FindDialog(QWidget *parent = 0);
signals:
void findNext(const QString& text, DataModel::FindLocation where, bool matchCase, bool ignoreAccelerators);
private slots:
void emitFindNext();
void verifyText(const QString &);
void find();
};
QT_END_NAMESPACE
#endif
|
//
// Copyright (C) 2004-2006 SIPfoundry Inc.
// Licensed by SIPfoundry under the LGPL license.
//
// Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
// Licensed to SIPfoundry under a Contributor Agreement.
//
// Copyright (C) 2007 Jaroslav Libak
// Licensed under the LGPL license.
// $$
///////////////////////////////////////////////////////////////////////////////
#ifndef OsPtrLock_h__
#define OsPtrLock_h__
// SYSTEM INCLUDES
// APPLICATION INCLUDES
#include <os/OsSyncBase.h>
// DEFINES
// MACROS
// EXTERNAL FUNCTIONS
// CONSTANTS
// STRUCTS
// TYPEDEFS
// MACROS
// FORWARD DECLARATIONS
/**
* OsPtrLock is a locking container of any pointer type. Doesn't delete the stored pointer.
* T must inherit from OsSyncBase.
*/
template <class T>
class OsPtrLock
{
/* //////////////////////////// PUBLIC //////////////////////////////////// */
public:
/* ============================ CREATORS ================================== */
/**
* Constructor accepting an optional default value.
*/
OsPtrLock(T* pValue = NULL)
: m_pValue(pValue)
{
superclassCheck();
acquire();
}
/**
* Destructor
*/
virtual ~OsPtrLock()
{
release();
m_pValue = NULL;
}
/**
* Copy constructor for assigning instance of OsPtrLock. Copies the pointer
* stored in OsPtrLock, and locks it again.
*/
OsPtrLock(const OsPtrLock<T>& rhs)
{
superclassCheck();
m_pValue = rhs.m_pValue;
acquire();
}
/* ============================ MANIPULATORS ============================== */
/**
* Assignment operator for assigning instance of OsPtrLock into OsPtrLock.
* Locks the assigned object. Object will get unlocked during destruction or
* another assignment.
*/
OsPtrLock<T>& operator=(const OsPtrLock<T>& rhs)
{
if ((void*)&rhs == (void*)this)
{
// when self assignment do not lock or unlock anything
return *this;
}
release(); // release old lock
m_pValue = dynamic_cast<T*>(rhs.m_pValue);
acquire(); // acquire new lock
return *this;
}
/**
* Assignment operator for assigning instance of OsSyncBase into OsPtrLock.
* Locks the assigned object. Object will get unlocked during destruction or
* another assignment.
*/
OsPtrLock& operator=(OsSyncBase* rhs)
{
release(); // release old lock
m_pValue = dynamic_cast<T*>(rhs);
acquire(); // acquire new lock
return *this;
}
/**
* -> operator returns contents of OsPtrLock.
*/
T* operator->()
{
return m_pValue;
}
/* ============================ ACCESSORS ================================= */
/* ============================ INQUIRY =================================== */
/**
* Returns TRUE if pointer is NULL.
*/
UtlBoolean isNull() const
{
return m_pValue == NULL ? TRUE : FALSE;
}
/* //////////////////////////// PROTECTED ///////////////////////////////// */
protected:
/* //////////////////////////// PRIVATE /////////////////////////////////// */
private:
void acquire()
{
if (m_pValue)
{
OsSyncBase *pSyncBase = dynamic_cast<OsSyncBase*>(m_pValue);
if (pSyncBase)
{
// cast succeeded
pSyncBase->acquire();
}
}
}
void release()
{
// unlock if not null
if (m_pValue)
{
OsSyncBase *pSyncBase = dynamic_cast<OsSyncBase*>(m_pValue);
if (pSyncBase)
{
// cast succeeded
pSyncBase->release();
}
}
}
/** Helper method to limit possible T parameters to subclasses of OsSyncBase */
void superclassCheck()
{
OsSyncBase* pSyncBase = (T*)NULL;
}
T* m_pValue; /** < The void ptr wrapped by this object */
};
#endif // OsPtrLock_h__
|
/****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms and
** conditions see http://www.qt.io/terms-conditions. For further information
** use the contact form at http://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef FORMRESIZER_H
#define FORMRESIZER_H
#include "widgethostconstants.h"
#include <QWidget>
#include <QVector>
QT_FORWARD_DECLARE_CLASS(QDesignerFormWindowInterface)
QT_FORWARD_DECLARE_CLASS(QFrame)
namespace SharedTools {
namespace Internal {
class SizeHandleRect;
/* A window to embed a form window interface as follows:
*
* Widget
* |
* +---+----+
* | |
* | |
* Handles QVBoxLayout [margin: SELECTION_MARGIN]
* |
* Frame [margin: lineWidth]
* |
* QVBoxLayout
* |
* QDesignerFormWindowInterface
*
* Can be embedded into a QScrollArea. */
class FormResizer : public QWidget
{
Q_OBJECT
public:
FormResizer(QWidget *parent = 0);
void updateGeometry();
void setState(SelectionHandleState st);
void update();
void setFormWindow(QDesignerFormWindowInterface *fw);
signals:
void formWindowSizeChanged(const QRect &oldGeo, const QRect &newGeo);
protected:
void resizeEvent(QResizeEvent *event) override;
private slots:
void mainContainerChanged();
private:
QSize decorationSize() const;
QWidget *mainContainer();
QFrame *m_frame;
typedef QVector<SizeHandleRect*> Handles;
Handles m_handles;
QDesignerFormWindowInterface * m_formWindow;
};
}
} // namespace SharedTools
#endif // FORMRESIZER_H
|
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: operation/relate/EdgeEndBuilder.java rev. 1.12 (JTS-1.10)
*
**********************************************************************/
#ifndef GEOS_OP_RELATE_EDGEENDBUILDER_H
#define GEOS_OP_RELATE_EDGEENDBUILDER_H
#include <geos/export.h>
#include <vector>
// Forward declarations
namespace geos {
namespace geom {
class IntersectionMatrix;
class Coordinate;
}
namespace geomgraph {
class Edge;
class EdgeIntersection;
class EdgeEnd;
}
}
namespace geos {
namespace operation { // geos::operation
namespace relate { // geos::operation::relate
/** \brief
* Computes the geomgraph::EdgeEnd objects which arise
* from a noded geomgraph::Edge.
*/
class GEOS_DLL EdgeEndBuilder {
public:
EdgeEndBuilder() {}
std::vector<geomgraph::EdgeEnd*> computeEdgeEnds(std::vector<geomgraph::Edge*>* edges);
void computeEdgeEnds(geomgraph::Edge* edge, std::vector<geomgraph::EdgeEnd*>* l);
protected:
void createEdgeEndForPrev(geomgraph::Edge* edge,
std::vector<geomgraph::EdgeEnd*>* l,
const geomgraph::EdgeIntersection* eiCurr,
const geomgraph::EdgeIntersection* eiPrev);
void createEdgeEndForNext(geomgraph::Edge* edge,
std::vector<geomgraph::EdgeEnd*>* l,
const geomgraph::EdgeIntersection* eiCurr,
const geomgraph::EdgeIntersection* eiNext);
};
} // namespace geos:operation:relate
} // namespace geos:operation
} // namespace geos
#endif // GEOS_OP_RELATE_EDGEENDBUILDER_H
|
/* Swfdec
* Copyright (C) 2007-2008 Benjamin Otte <otte@gnome.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef _SWFDEC_VIDEO_DECODER_GST_H_
#define _SWFDEC_VIDEO_DECODER_GST_H_
#include <swfdec/swfdec_codec_gst.h>
#include <swfdec/swfdec_video_decoder.h>
G_BEGIN_DECLS
typedef struct _SwfdecVideoDecoderGst SwfdecVideoDecoderGst;
typedef struct _SwfdecVideoDecoderGstClass SwfdecVideoDecoderGstClass;
#define SWFDEC_TYPE_VIDEO_DECODER_GST (swfdec_video_decoder_gst_get_type())
#define SWFDEC_IS_VIDEO_DECODER_GST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SWFDEC_TYPE_VIDEO_DECODER_GST))
#define SWFDEC_IS_VIDEO_DECODER_GST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SWFDEC_TYPE_VIDEO_DECODER_GST))
#define SWFDEC_VIDEO_DECODER_GST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SWFDEC_TYPE_VIDEO_DECODER_GST, SwfdecVideoDecoderGst))
#define SWFDEC_VIDEO_DECODER_GST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SWFDEC_TYPE_VIDEO_DECODER_GST, SwfdecVideoDecoderGstClass))
#define SWFDEC_VIDEO_DECODER_GST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SWFDEC_TYPE_VIDEO_DECODER_GST, SwfdecVideoDecoderGstClass))
struct _SwfdecVideoDecoderGst
{
SwfdecVideoDecoder decoder;
SwfdecGstDecoder dec; /* the decoder element */
GstBuffer * last; /* last decoded buffer */
};
struct _SwfdecVideoDecoderGstClass
{
SwfdecVideoDecoderClass decoder_class;
};
GType swfdec_video_decoder_gst_get_type (void);
G_END_DECLS
#endif
|
/************************************************************************************
TerraME - a software platform for multiple scale spatially-explicit dynamic modeling.
Copyright (C) 2001-2017 INPE and TerraLAB/UFOP -- www.terrame.org
This code is part of the TerraME framework.
This framework 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.
You should have received a copy of the GNU Lesser General Public
License along with this library.
The authors reassure the license terms regarding the warranties.
They specifically disclaim any warranties, including, but not limited to,
the implied warranties of merchantability and fitness for a particular purpose.
The framework provided hereunder is on an "as is" basis, and the authors have no
obligation to provide maintenance, support, updates, enhancements, or modifications.
In no event shall INPE and TerraLAB / UFOP be held liable to any party for direct,
indirect, special, incidental, or consequential damages arising out of the use
of this software and its documentation.
*************************************************************************************/
#ifndef OBSERVER_UDP_SENDER_GUI_H
#define OBSERVER_UDP_SENDER_GUI_H
#include <QDialog>
namespace Ui {
class UdpSenderGUI;
}
class UdpSenderGUI : public QDialog
{
Q_OBJECT
public:
UdpSenderGUI(QWidget *parent = 0);
virtual ~UdpSenderGUI();
void setPort(int port);
void setStateSent(int state);
void setMessagesSent(int msg);
void setSpeed(const QString &speed);
void appendMessage(const QString &message);
void setCompressDatagram(bool compress);
private:
Ui::UdpSenderGUI *ui;
};
#endif // OBSERVER_UDP_SENDER_GUI_H
|
/*--------------------------------------------------------------------
(C) Copyright 2006-2012 Barcelona Supercomputing Center
Centro Nacional de Supercomputacion
This file is part of Mercurium C/C++ source-to-source compiler.
See AUTHORS file in the top level directory for information
regarding developers and contributors.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
Mercurium C/C++ source-to-source compiler is distributed in the hope
that it will be useful, but WITHOUT ANY WARRANTY; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU Lesser General Public License for more
details.
You should have received a copy of the GNU Lesser General Public
License along with Mercurium C/C++ source-to-source compiler; if
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA.
--------------------------------------------------------------------*/
/*
<testinfo>
test_generator=config/mercurium
</testinfo>
*/
void f(void)
{
int @reb-ref@ rr;
int k = 1;
int *p = 0;
&rr = &k;
rr = 3;
rr = k;
k = rr;
p = &rr;
}
|
/*
** $Id: progressbar.c 741 2009-03-31 07:16:18Z weiym $
**
** Listing 25.1
**
** progressbar.c: Sample program for MiniGUI Programming Guide
** Usage of PORGRESSBAR control.
**
** Copyright (C) 2004 ~ 2007 Feynman Software.
**
** License: GPL
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <minigui/common.h>
#include <minigui/minigui.h>
#include <minigui/gdi.h>
#include <minigui/window.h>
#include <minigui/control.h>
#ifdef _LANG_ZHCN
#include "progressbar_res_cn.h"
#elif defined _LANG_ZHTW
#include "progressbar_res_tw.h"
#else
#include "progressbar_res_en.h"
#endif
static HWND createProgressWin (HWND hParentWnd, char * title, char * label,
int id, int range)
{
HWND hwnd;
MAINWINCREATE CreateInfo;
int ww, wh;
HWND hStatic, hProgBar;
ww = ClientWidthToWindowWidth (WS_CAPTION | WS_BORDER, 400);
wh = ClientHeightToWindowHeight (WS_CAPTION | WS_BORDER,
(range > 0) ? 70 : 35, FALSE);
CreateInfo.dwStyle = WS_ABSSCRPOS | WS_CAPTION | WS_BORDER | WS_VISIBLE;
CreateInfo.dwExStyle = WS_EX_NONE;
CreateInfo.spCaption = title;
CreateInfo.hMenu = 0;
CreateInfo.hCursor = GetSystemCursor(IDC_WAIT);
CreateInfo.hIcon = 0;
CreateInfo.MainWindowProc = DefaultMainWinProc;
CreateInfo.lx = (GetGDCapability (HDC_SCREEN, GDCAP_MAXX) - ww) >> 1;
CreateInfo.ty = (GetGDCapability (HDC_SCREEN, GDCAP_MAXY) - wh) >> 1;
CreateInfo.rx = CreateInfo.lx + ww;
CreateInfo.by = CreateInfo.ty + wh;
CreateInfo.iBkColor = COLOR_lightgray;
CreateInfo.dwAddData = 0L;
CreateInfo.hHosting = hParentWnd;
hwnd = CreateMainWindow (&CreateInfo);
if (hwnd == HWND_INVALID)
return hwnd;
hStatic = CreateWindowEx ("static",
label,
WS_VISIBLE | SS_SIMPLE,
WS_EX_USEPARENTCURSOR,
IDC_STATIC,
10, 10, 380, 16, hwnd, 0);
if (range > 0) {
hProgBar = CreateWindowEx ("progressbar",
NULL,
WS_VISIBLE,
WS_EX_USEPARENTCURSOR,
id,
10, 30, 380, 30, hwnd, 0);
SendDlgItemMessage (hwnd, id, PBM_SETRANGE, 0, range);
}
else
hProgBar = HWND_INVALID;
UpdateWindow (hwnd, TRUE);
return hwnd;
}
static void destroyProgressWin (HWND hwnd)
{
DestroyAllControls (hwnd);
DestroyMainWindow (hwnd);
ThrowAwayMessages (hwnd);
MainWindowThreadCleanup (hwnd);
}
int MiniGUIMain (int argc, const char* argv[])
{
int i, sum;
HCURSOR hOldCursor;
HWND hwnd;
#ifdef _MGRM_PROCESSES
JoinLayer(NAME_DEF_LAYER , "progressbar" , 0 , 0);
#endif
hOldCursor = SetDefaultCursor (GetSystemCursor (IDC_WAIT));
hwnd = createProgressWin (HWND_DESKTOP, progress_bar,
calculating_please_waiting, 100, 2000);
while (HavePendingMessage (hwnd)) {
MSG msg;
GetMessage (&msg, hwnd);
DispatchMessage (&msg);
}
for (i = 0; i < 2000; i++) {
unsigned long j;
if (i % 100 == 0) {
SendDlgItemMessage (hwnd, 100, PBM_SETPOS, i, 0L);
while (HavePendingMessage (hwnd)) {
MSG msg;
GetMessage (&msg, hwnd);
DispatchMessage (&msg);
}
}
sum = i*5000;
for (j = 0; j < 500000; j++)
sum *= j;
sum += sum;
}
destroyProgressWin (hwnd);
SetDefaultCursor (hOldCursor);
return 0;
}
#ifdef _MGRM_THREADS
#include <minigui/dti.c>
#endif
|
/* $NetBSD: tzfile.h,v 1.9 2009/12/31 22:49:16 mlelstv Exp $ */
#ifndef TZFILE_H
#define TZFILE_H
/*
** This file is in the public domain, so clarified as of
** 1996-06-05 by Arthur David Olson.
*/
/*
** This header is for use ONLY with the time conversion code.
** There is no guarantee that it will remain unchanged,
** or that it will remain at all.
** Do NOT copy it to any system include directory.
** Thank you!
*/
/*
** ID
*/
#ifndef lint
#ifndef NOID
#if 0
static char tzfilehid[] = "@(#)tzfile.h 8.1";
#endif
#endif /* !defined NOID */
#endif /* !defined lint */
/*
** Information about time zone files.
*/
#ifndef TZDIR /* Time zone object file directory */
#define TZDIR "/usr/share/zoneinfo"
#endif /* !defined TZDIR */
#ifndef TZDEFAULT
#define TZDEFAULT "/etc/localtime"
#endif /* !defined TZDEFAULT */
#ifndef TZDEFRULES
#define TZDEFRULES "posixrules"
#endif /* !defined TZDEFRULES */
/*
** Each file begins with. . .
*/
#define TZ_MAGIC "TZif"
struct tzhead {
char tzh_magic[4]; /* TZ_MAGIC */
char tzh_version[1]; /* '\0' or '2' as of 2005 */
char tzh_reserved[15]; /* reserved--must be zero */
char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
char tzh_leapcnt[4]; /* coded number of leap seconds */
char tzh_timecnt[4]; /* coded number of transition times */
char tzh_typecnt[4]; /* coded number of local time types */
char tzh_charcnt[4]; /* coded number of abbr. chars */
};
/*
** . . .followed by. . .
**
** tzh_timecnt (char [4])s coded transition times a la time(2)
** tzh_timecnt (unsigned char)s types of local time starting at above
** tzh_typecnt repetitions of
** one (char [4]) coded UTC offset in seconds
** one (unsigned char) used to set tm_isdst
** one (unsigned char) that's an abbreviation list index
** tzh_charcnt (char)s '\0'-terminated zone abbreviations
** tzh_leapcnt repetitions of
** one (char [4]) coded leap second transition times
** one (char [4]) total correction after above
** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
** time is standard time, if FALSE,
** transition time is wall clock time
** if absent, transition times are
** assumed to be wall clock time
** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
** time is UTC, if FALSE,
** transition time is local time
** if absent, transition times are
** assumed to be local time
*/
/*
** If tzh_version is '2' or greater, the above is followed by a second instance
** of tzhead and a second instance of the data in which each coded transition
** time uses 8 rather than 4 chars,
** then a POSIX-TZ-environment-variable-style string for use in handling
** instants after the last transition time stored in the file
** (with nothing between the newlines if there is no POSIX representation for
** such instants).
*/
/*
** In the current implementation, "tzset()" refuses to deal with files that
** exceed any of the limits below.
*/
#ifndef TZ_MAX_TIMES
#define TZ_MAX_TIMES 1200
#endif /* !defined TZ_MAX_TIMES */
#ifndef TZ_MAX_TYPES
#ifndef NOSOLAR
#define TZ_MAX_TYPES 256 /* Limited by what (unsigned char)'s can hold */
#endif /* !defined NOSOLAR */
#ifdef NOSOLAR
/*
** Must be at least 14 for Europe/Riga as of Jan 12 1995,
** as noted by Earl Chew.
*/
#define TZ_MAX_TYPES 20 /* Maximum number of local time types */
#endif /* !defined NOSOLAR */
#endif /* !defined TZ_MAX_TYPES */
#ifndef TZ_MAX_CHARS
#define TZ_MAX_CHARS 50 /* Maximum number of abbreviation characters */
/* (limited by what unsigned chars can hold) */
#endif /* !defined TZ_MAX_CHARS */
#ifndef TZ_MAX_LEAPS
#define TZ_MAX_LEAPS 50 /* Maximum number of leap second corrections */
#endif /* !defined TZ_MAX_LEAPS */
#define SECSPERMIN 60
#define MINSPERHOUR 60
#define HOURSPERDAY 24
#define DAYSPERWEEK 7
#define DAYSPERNYEAR 365
#define DAYSPERLYEAR 366
#define SECSPERHOUR (SECSPERMIN * MINSPERHOUR)
#define SECSPERDAY ((long) SECSPERHOUR * HOURSPERDAY)
#define MONSPERYEAR 12
#define TM_SUNDAY 0
#define TM_MONDAY 1
#define TM_TUESDAY 2
#define TM_WEDNESDAY 3
#define TM_THURSDAY 4
#define TM_FRIDAY 5
#define TM_SATURDAY 6
#define TM_JANUARY 0
#define TM_FEBRUARY 1
#define TM_MARCH 2
#define TM_APRIL 3
#define TM_MAY 4
#define TM_JUNE 5
#define TM_JULY 6
#define TM_AUGUST 7
#define TM_SEPTEMBER 8
#define TM_OCTOBER 9
#define TM_NOVEMBER 10
#define TM_DECEMBER 11
#define TM_YEAR_BASE 1900
#define EPOCH_YEAR 1970
#define EPOCH_WDAY TM_THURSDAY
#define isleap(y) (((y) % 4) == 0 && (((y) % 100) != 0 || ((y) % 400) == 0))
/*
** Since everything in isleap is modulo 400 (or a factor of 400), we know that
** isleap(y) == isleap(y % 400)
** and so
** isleap(a + b) == isleap((a + b) % 400)
** or
** isleap(a + b) == isleap(a % 400 + b % 400)
** This is true even if % means modulo rather than Fortran remainder
** (which is allowed by C89 but not C99).
** We use this to avoid addition overflow problems.
*/
#define isleap_sum(a, b) isleap((a) % 400 + (b) % 400)
#endif /* !defined TZFILE_H */
|
/*
* XDD - a data movement and benchmarking toolkit
*
* Copyright (C) 1992-2013 I/O Performance, Inc.
* Copyright (C) 2009-2013 UT-Battelle, LLC
*
* This 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. See file COPYING.
*
*/
/*
* This file contains the subroutines that perform various initialization
* functions when xdd is started.
*/
#include "xint.h"
/*----------------------------------------------------------------------------*/
/* The arguments pass in are the same argc and argv from main();
*/
int32_t
xdd_initialization(int32_t argc,char *argv[], xdd_plan_t *planp) {
nclk_t tt;
// Initialize the Global Data Structure
// See global_data.c
//xdd_global_data_initialization(argc, argv);
// Init the barrier chain before any barriers get initialized
// See barrier.c
xdd_init_barrier_chain(planp);
// Parse the input arguments
// See parse.c
xgp->argc = argc; // remember the original arg count
xgp->argv = argv; // remember the original argv
xdd_parse(planp,argc,argv);
// Init output format header
if (planp->plan_options & PLAN_ENDTOEND)
xdd_results_format_id_add("+E2ESRTIME+E2EIOTIME+E2EPERCENTSRTIME ", planp->format_string);
// Optimize runtime priorities and all that
// See schedule.c
xdd_schedule_options();
// initialize the signal handlers
// See signals.c
xdd_signal_init(planp);
#if WIN32
/* Init the ts serializer mutex to compensate for a Windows bug */
xgp->tsp->ts_serializer_mutex_name = "ts_serializer_mutex";
ts_serializer_init(&xgp->tsp->ts_serializer_mutex, xgp->tsp->ts_serializer_mutex_name);
#endif
/* initialize the clocks */
nclk_initialize(&tt);
if (tt == NCLK_BAD) {
fprintf(xgp->errout, "%s: ERROR: Cannot initialize the nanosecond clock\n",xgp->progname);
fflush(xgp->errout);
xdd_destroy_all_barriers(planp);
return(-1);
}
nclk_now(&planp->base_time);
// Init the Global Clock
// See global_clock.c
// xdd_init_global_clock(&xgp->ActualLocalStartTime);
// display configuration information about this run
// See info_display.c
xdd_config_info(planp);
return(0);
} // End of initialization()
/*
* Local variables:
* indent-tabs-mode: t
* default-tab-width: 4
* c-indent-level: 4
* c-basic-offset: 4
* End:
*
* vim: ts=4 sts=4 sw=4 noexpandtab
*/
|
//
// XMLFilter.h
//
// Library: XML
// Package: SAX
// Module: SAXFilters
//
// SAX2 XMLFilter Interface.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// SPDX-License-Identifier: BSL-1.0
//
#ifndef SAX_XMLFilter_INCLUDED
#define SAX_XMLFilter_INCLUDED
#include "Poco/XML/XML.h"
#include "Poco/SAX/XMLReader.h"
namespace Poco {
namespace XML {
class XML_API XMLFilter: public XMLReader
/// Interface for an XML filter.
///
/// An XML filter is like an XML reader, except that it obtains its events from another XML reader
/// rather than a primary source like an XML document or database. Filters can modify a stream of
/// events as they pass on to the final application.
///
/// The XMLFilterImpl helper class provides a convenient base for creating SAX2 filters, by passing on
/// all EntityResolver, DTDHandler, ContentHandler and ErrorHandler events automatically.
{
public:
virtual XMLReader* getParent() const = 0;
/// Set the parent reader.
///
/// This method allows the application to link the filter to a parent reader (which may be another
/// filter). The argument may not be null.
virtual void setParent(XMLReader* pParent) = 0;
/// Get the parent reader.
///
/// This method allows the application to query the parent reader (which may be another filter).
/// It is generally a bad idea to perform any operations on the parent reader directly: they should
/// all pass through this filter.
protected:
virtual ~XMLFilter();
};
} } // namespace Poco::XML
#endif // SAX_XMLFilter_INCLUDED
|
/*!
\file drv_usb_host.h
\brief USB host mode low level driver header file
\version 2020-07-17, V3.0.0, firmware for GD32F10x
*/
/*
Copyright (c) 2020, GigaDevice Semiconductor Inc.
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 the copyright holder 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.
*/
#ifndef __DRV_USB_HOST_H
#define __DRV_USB_HOST_H
#include "drv_usb_regs.h"
#include "usb_ch9_std.h"
#include "drv_usb_core.h"
typedef enum _usb_pipe_status
{
PIPE_IDLE = 0U,
PIPE_XF,
PIPE_HALTED,
PIPE_NAK,
PIPE_NYET,
PIPE_STALL,
PIPE_TRACERR,
PIPE_BBERR,
PIPE_REQOVR,
PIPE_DTGERR,
} usb_pipe_staus;
typedef enum _usb_pipe_mode
{
PIPE_PERIOD = 0U,
PIPE_NON_PERIOD = 1U
} usb_pipe_mode;
typedef enum _usb_urb_state
{
URB_IDLE = 0U,
URB_DONE,
URB_NOTREADY,
URB_ERROR,
URB_STALL,
URB_PING
} usb_urb_state;
typedef struct _usb_pipe
{
uint8_t in_used;
uint8_t dev_addr;
uint32_t dev_speed;
struct {
uint8_t num;
uint8_t dir;
uint8_t type;
uint16_t mps;
} ep;
uint8_t ping;
uint32_t DPID;
uint8_t *xfer_buf;
uint32_t xfer_len;
uint32_t xfer_count;
uint8_t data_toggle_in;
uint8_t data_toggle_out;
__IO uint32_t err_count;
__IO usb_pipe_staus pp_status;
__IO usb_urb_state urb_state;
} usb_pipe;
typedef struct _usb_host_drv
{
__IO uint32_t connect_status;
__IO uint32_t port_enabled;
__IO uint32_t backup_xfercount[USBFS_MAX_TX_FIFOS];
usb_pipe pipe[USBFS_MAX_TX_FIFOS];
void *data;
} usb_host_drv;
typedef struct _usb_core_driver
{
usb_core_basic bp;
usb_core_regs regs;
usb_host_drv host;
} usb_core_driver;
/*!
\brief get USB even frame
\param[in] udev: pointer to USB device
\param[out] none
\retval none
*/
__STATIC_INLINE uint8_t usb_frame_even (usb_core_driver *udev)
{
return (uint8_t)!(udev->regs.hr->HFINFR & 0x01U);
}
/*!
\brief configure USB clock of PHY
\param[in] udev: pointer to USB device
\param[in] clock: PHY clock
\param[out] none
\retval none
*/
__STATIC_INLINE void usb_phyclock_config (usb_core_driver *udev, uint8_t clock)
{
udev->regs.hr->HCTL &= ~HCTL_CLKSEL;
udev->regs.hr->HCTL |= clock;
}
/*!
\brief read USB port
\param[in] udev: pointer to USB device
\param[out] none
\retval port status
*/
__STATIC_INLINE uint32_t usb_port_read (usb_core_driver *udev)
{
return *udev->regs.HPCS & ~(HPCS_PE | HPCS_PCD | HPCS_PEDC);
}
/*!
\brief get USB current speed
\param[in] udev: pointer to USB device
\param[out] none
\retval USB current speed
*/
__STATIC_INLINE uint32_t usb_curspeed_get (usb_core_driver *udev)
{
return *udev->regs.HPCS & HPCS_PS;
}
/*!
\brief get USB current frame
\param[in] udev: pointer to USB device
\param[out] none
\retval USB current frame
*/
__STATIC_INLINE uint32_t usb_curframe_get (usb_core_driver *udev)
{
return (udev->regs.hr->HFINFR & 0xFFFFU);
}
/* function declarations */
/* initializes USB core for host mode */
usb_status usb_host_init (usb_core_driver *udev);
/* control the VBUS to power */
void usb_portvbus_switch (usb_core_driver *udev, uint8_t state);
/* reset host port */
uint32_t usb_port_reset (usb_core_driver *udev);
/* initialize host pipe */
usb_status usb_pipe_init (usb_core_driver *udev, uint8_t pipe_num);
/* prepare host pipe for transferring packets */
usb_status usb_pipe_xfer (usb_core_driver *udev, uint8_t pipe_num);
/* halt host pipe */
usb_status usb_pipe_halt (usb_core_driver *udev, uint8_t pipe_num);
/* configure host pipe to do ping operation */
usb_status usb_pipe_ping (usb_core_driver *udev, uint8_t pipe_num);
/* stop the USB host and clean up FIFO */
void usb_host_stop (usb_core_driver *udev);
#endif /* __DRV_USB_HOST_H */
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
namespace Aws
{
namespace EC2
{
namespace Model
{
enum class PlacementGroupState
{
NOT_SET,
pending,
available,
deleting,
deleted
};
namespace PlacementGroupStateMapper
{
AWS_EC2_API PlacementGroupState GetPlacementGroupStateForName(const Aws::String& name);
AWS_EC2_API Aws::String GetNameForPlacementGroupState(PlacementGroupState value);
} // namespace PlacementGroupStateMapper
} // namespace Model
} // namespace EC2
} // namespace Aws
|
/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#pragma once
#include <aws/ec2/EC2_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/ec2/model/ResponseMetadata.h>
#include <aws/ec2/model/UnsuccessfulItem.h>
#include <utility>
namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;
namespace Utils
{
namespace Xml
{
class XmlDocument;
} // namespace Xml
} // namespace Utils
namespace EC2
{
namespace Model
{
class AWS_EC2_API DeleteVpcEndpointConnectionNotificationsResponse
{
public:
DeleteVpcEndpointConnectionNotificationsResponse();
DeleteVpcEndpointConnectionNotificationsResponse(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
DeleteVpcEndpointConnectionNotificationsResponse& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Xml::XmlDocument>& result);
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline const Aws::Vector<UnsuccessfulItem>& GetUnsuccessful() const{ return m_unsuccessful; }
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline void SetUnsuccessful(const Aws::Vector<UnsuccessfulItem>& value) { m_unsuccessful = value; }
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline void SetUnsuccessful(Aws::Vector<UnsuccessfulItem>&& value) { m_unsuccessful = std::move(value); }
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline DeleteVpcEndpointConnectionNotificationsResponse& WithUnsuccessful(const Aws::Vector<UnsuccessfulItem>& value) { SetUnsuccessful(value); return *this;}
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline DeleteVpcEndpointConnectionNotificationsResponse& WithUnsuccessful(Aws::Vector<UnsuccessfulItem>&& value) { SetUnsuccessful(std::move(value)); return *this;}
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline DeleteVpcEndpointConnectionNotificationsResponse& AddUnsuccessful(const UnsuccessfulItem& value) { m_unsuccessful.push_back(value); return *this; }
/**
* <p>Information about the notifications that could not be deleted
* successfully.</p>
*/
inline DeleteVpcEndpointConnectionNotificationsResponse& AddUnsuccessful(UnsuccessfulItem&& value) { m_unsuccessful.push_back(std::move(value)); return *this; }
inline const ResponseMetadata& GetResponseMetadata() const{ return m_responseMetadata; }
inline void SetResponseMetadata(const ResponseMetadata& value) { m_responseMetadata = value; }
inline void SetResponseMetadata(ResponseMetadata&& value) { m_responseMetadata = std::move(value); }
inline DeleteVpcEndpointConnectionNotificationsResponse& WithResponseMetadata(const ResponseMetadata& value) { SetResponseMetadata(value); return *this;}
inline DeleteVpcEndpointConnectionNotificationsResponse& WithResponseMetadata(ResponseMetadata&& value) { SetResponseMetadata(std::move(value)); return *this;}
private:
Aws::Vector<UnsuccessfulItem> m_unsuccessful;
ResponseMetadata m_responseMetadata;
};
} // namespace Model
} // namespace EC2
} // namespace Aws
|
/*
*************************************************************************
* Ralink Tech Inc.
* 5F., No.36, Taiyuan St., Jhubei City,
* Hsinchu County 302,
* Taiwan, R.O.C.
*
* (c) Copyright 2002-2007, Ralink Technology, 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. *
* *
*************************************************************************
Revision History:
Who When What
-------- ---------- ------------------------------------------
Eddy 2009/05/19 Create AES-Key Wrap
Eddy 2009/04/20 Create AES-CMAC, AES-CCM
Eddy 2009/01/19 Create AES-128, AES-192, AES-256, AES-CBC
***************************************************************************/
#ifndef __CRYPT_AES_H__
#define __CRYPT_AES_H__
#include "rt_config.h"
/* AES definition & structure */
#define AES_STATE_ROWS 4 /* Block size: 4*4*8 = 128 bits */
#define AES_STATE_COLUMNS 4
#define AES_BLOCK_SIZES AES_STATE_ROWS*AES_STATE_COLUMNS
#define AES_KEY_ROWS 4
#define AES_KEY_COLUMNS 8 /*Key length: 4*{4,6,8}*8 = 128, 192, 256 bits */
#define AES_KEY128_LENGTH 16
#define AES_KEY192_LENGTH 24
#define AES_KEY256_LENGTH 32
#define AES_CBC_IV_LENGTH 16
typedef struct {
UINT8 State[AES_STATE_ROWS][AES_STATE_COLUMNS];
UINT8 KeyWordExpansion[AES_KEY_ROWS][AES_KEY_ROWS*((AES_KEY256_LENGTH >> 2) + 6 + 1)];
} AES_CTX_STRUC, *PAES_CTX_STRUC;
/* AES operations */
VOID RT_AES_KeyExpansion (
IN UINT8 Key[],
IN UINT KeyLength,
INOUT AES_CTX_STRUC *paes_ctx);
VOID RT_AES_Encrypt (
IN UINT8 PlainBlock[],
IN UINT PlainBlockSize,
IN UINT8 Key[],
IN UINT KeyLength,
OUT UINT8 CipherBlock[],
INOUT UINT *CipherBlockSize);
VOID RT_AES_Decrypt (
IN UINT8 CipherBlock[],
IN UINT CipherBlockSize,
IN UINT8 Key[],
IN UINT KeyLength,
OUT UINT8 PlainBlock[],
INOUT UINT *PlainBlockSize);
/* AES Counter with CBC-MAC operations */
VOID AES_CCM_MAC (
IN UINT8 Payload[],
IN UINT PayloadLength,
IN UINT8 Key[],
IN UINT KeyLength,
IN UINT8 Nonce[],
IN UINT NonceLength,
IN UINT8 AAD[],
IN UINT AADLength,
IN UINT MACLength,
OUT UINT8 MACText[]);
INT AES_CCM_Encrypt (
IN UINT8 PlainText[],
IN UINT PlainTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
IN UINT8 Nonce[],
IN UINT NonceLength,
IN UINT8 AAD[],
IN UINT AADLength,
IN UINT MACLength,
OUT UINT8 CipherText[],
INOUT UINT *CipherTextLength);
INT AES_CCM_Decrypt (
IN UINT8 CipherText[],
IN UINT CipherTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
IN UINT8 Nonce[],
IN UINT NonceLength,
IN UINT8 AAD[],
IN UINT AADLength,
IN UINT MACLength,
OUT UINT8 PlainText[],
INOUT UINT *PlainTextLength);
/* AES-CMAC operations */
VOID AES_CMAC_GenerateSubKey (
IN UINT8 Key[],
IN UINT KeyLength,
OUT UINT8 SubKey1[],
OUT UINT8 SubKey2[]);
VOID AES_CMAC (
IN UINT8 PlainText[],
IN UINT PlainTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
OUT UINT8 MACText[],
INOUT UINT *MACTextLength);
/* AES-CBC operations */
VOID AES_CBC_Encrypt (
IN UINT8 PlainText[],
IN UINT PlainTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
IN UINT8 IV[],
IN UINT IVLength,
OUT UINT8 CipherText[],
INOUT UINT *CipherTextLength);
VOID AES_CBC_Decrypt (
IN UINT8 CipherText[],
IN UINT CipherTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
IN UINT8 IV[],
IN UINT IVLength,
OUT UINT8 PlainText[],
INOUT UINT *PlainTextLength);
/* AES key wrap operations */
INT AES_Key_Wrap (
IN UINT8 PlainText[],
IN UINT PlainTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
OUT UINT8 CipherText[],
OUT UINT *CipherTextLength);
INT AES_Key_Unwrap (
IN UINT8 CipherText[],
IN UINT CipherTextLength,
IN UINT8 Key[],
IN UINT KeyLength,
OUT UINT8 PlainText [],
OUT UINT *PlainTextLength);
#endif /* __CRYPT_AES_H__ */
|
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ART_RUNTIME_GC_ACCOUNTING_BITMAP_H_
#define ART_RUNTIME_GC_ACCOUNTING_BITMAP_H_
#include <limits.h>
#include <stdint.h>
#include <memory>
#include <set>
#include <vector>
#include "base/mutex.h"
#include "globals.h"
#include "object_callbacks.h"
namespace art {
class MemMap;
namespace gc {
namespace accounting {
// TODO: Use this code to implement SpaceBitmap.
class Bitmap {
public:
// Create and initialize a bitmap with size num_bits. Storage is allocated with a MemMap.
static Bitmap* Create(const std::string& name, size_t num_bits);
// Initialize a space bitmap using the provided mem_map as the live bits. Takes ownership of the
// mem map. The address range covered starts at heap_begin and is of size equal to heap_capacity.
// Objects are kAlignement-aligned.
static Bitmap* CreateFromMemMap(MemMap* mem_map, size_t num_bits);
// offset is the difference from base to a index.
static ALWAYS_INLINE constexpr size_t BitIndexToWordIndex(uintptr_t offset) {
return offset / kBitsPerBitmapWord;
}
template<typename T>
static ALWAYS_INLINE constexpr T WordIndexToBitIndex(T word_index) {
return static_cast<T>(word_index * kBitsPerBitmapWord);
}
static ALWAYS_INLINE constexpr uintptr_t BitIndexToMask(uintptr_t bit_index) {
return static_cast<uintptr_t>(1) << (bit_index % kBitsPerBitmapWord);
}
ALWAYS_INLINE bool SetBit(size_t bit_index) {
return ModifyBit<true>(bit_index);
}
ALWAYS_INLINE bool ClearBit(size_t bit_index) {
return ModifyBit<false>(bit_index);
}
ALWAYS_INLINE bool TestBit(size_t bit_index) const;
// Returns true if the bit_index was previously set.
ALWAYS_INLINE bool AtomicTestAndSetBit(size_t bit_index);
// Fill the bitmap with zeroes. Returns the bitmap's memory to the system as a side-effect.
void Clear();
// Visit the all the set bits range [visit_begin, visit_end) where visit_begin and visit_end are
// bit indices visitor is called with the index of each set bit.
template <typename Visitor>
void VisitSetBits(uintptr_t visit_begin, size_t visit_end, const Visitor& visitor) const;
void CopyFrom(Bitmap* source_bitmap);
// Starting address of our internal storage.
uintptr_t* Begin() {
return bitmap_begin_;
}
// Size of our bitmap in bits.
size_t BitmapSize() const {
return bitmap_size_;
}
// Check that a bit index is valid with a DCHECK.
ALWAYS_INLINE void CheckValidBitIndex(size_t bit_index) const {
DCHECK_LT(bit_index, BitmapSize());
}
std::string Dump() const;
protected:
static constexpr size_t kBitsPerBitmapWord = sizeof(uintptr_t) * kBitsPerByte;
Bitmap(MemMap* mem_map, size_t bitmap_size);
~Bitmap();
// Allocate the mem-map for a bitmap based on how many bits are required.
static MemMap* AllocateMemMap(const std::string& name, size_t num_bits);
template<bool kSetBit>
ALWAYS_INLINE bool ModifyBit(uintptr_t bit_index);
// Backing storage for bitmap.
std::unique_ptr<MemMap> mem_map_;
// This bitmap itself, word sized for efficiency in scanning.
uintptr_t* const bitmap_begin_;
// Number of bits in the bitmap.
const size_t bitmap_size_;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(Bitmap);
};
// One bit per kAlignment in range (start, end]
template<size_t kAlignment>
class MemoryRangeBitmap : public Bitmap {
public:
static MemoryRangeBitmap* Create(const std::string& name, uintptr_t cover_begin,
uintptr_t cover_end);
static MemoryRangeBitmap* CreateFromMemMap(MemMap* mem_map, uintptr_t cover_begin,
size_t num_bits);
// Beginning of the memory range that the bitmap covers.
ALWAYS_INLINE uintptr_t CoverBegin() const {
return cover_begin_;
}
// End of the memory range that the bitmap covers.
ALWAYS_INLINE uintptr_t CoverEnd() const {
return cover_end_;
}
// Return the address associated with a bit index.
ALWAYS_INLINE uintptr_t AddrFromBitIndex(size_t bit_index) const {
const uintptr_t addr = CoverBegin() + bit_index * kAlignment;
DCHECK_EQ(BitIndexFromAddr(addr), bit_index);
return addr;
}
// Return the bit index associated with an address .
ALWAYS_INLINE uintptr_t BitIndexFromAddr(uintptr_t addr) const {
DCHECK(HasAddress(addr)) << CoverBegin() << " <= " << addr << " < " << CoverEnd();
return (addr - CoverBegin()) / kAlignment;
}
ALWAYS_INLINE bool HasAddress(const uintptr_t addr) const {
return cover_begin_ <= addr && addr < cover_end_;
}
ALWAYS_INLINE bool Set(uintptr_t addr) {
return SetBit(BitIndexFromAddr(addr));
}
ALWAYS_INLINE bool Clear(size_t addr) {
return ClearBit(BitIndexFromAddr(addr));
}
ALWAYS_INLINE bool Test(size_t addr) const {
return TestBit(BitIndexFromAddr(addr));
}
// Returns true if the object was previously set.
ALWAYS_INLINE bool AtomicTestAndSet(size_t addr) {
return AtomicTestAndSetBit(BitIndexFromAddr(addr));
}
private:
MemoryRangeBitmap(MemMap* mem_map, uintptr_t begin, size_t num_bits)
: Bitmap(mem_map, num_bits), cover_begin_(begin), cover_end_(begin + kAlignment * num_bits) {
}
uintptr_t const cover_begin_;
uintptr_t const cover_end_;
DISALLOW_IMPLICIT_CONSTRUCTORS(MemoryRangeBitmap);
};
} // namespace accounting
} // namespace gc
} // namespace art
#endif // ART_RUNTIME_GC_ACCOUNTING_BITMAP_H_
|
/*
* Copyright 2006-2012 The FLWOR Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ******************************************
// * *
// * THIS IS A GENERATED FILE. DO NOT EDIT! *
// * SEE .xml FILE WITH SAME NAME *
// * *
// ******************************************
#ifndef ZORBA_RUNTIME_PARSING_AND_SERIALIZING_PARSE_FRAGMENT_H
#define ZORBA_RUNTIME_PARSING_AND_SERIALIZING_PARSE_FRAGMENT_H
#include "common/shared_types.h"
#include "runtime/base/narybase.h"
#include "runtime/parsing_and_serializing/fragment_istream.h"
#include "store/api/store.h"
namespace zorba {
/**
* fn-zorba-xml:parse
* Author: Zorba Team
*/
class FnZorbaParseXmlFragmentIteratorState : public PlanIteratorState
{
public:
FragmentIStream theFragmentStream; //the input fragment
store::LoadProperties theProperties; //loader properties
zstring baseUri; //
zstring docUri; //
FnZorbaParseXmlFragmentIteratorState();
~FnZorbaParseXmlFragmentIteratorState();
void init(PlanState&);
void reset(PlanState&);
};
class FnZorbaParseXmlFragmentIterator : public NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>
{
public:
SERIALIZABLE_CLASS(FnZorbaParseXmlFragmentIterator);
SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnZorbaParseXmlFragmentIterator,
NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>);
void serialize( ::zorba::serialization::Archiver& ar);
FnZorbaParseXmlFragmentIterator(
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children)
:
NaryBaseIterator<FnZorbaParseXmlFragmentIterator, FnZorbaParseXmlFragmentIteratorState>(sctx, loc, children)
{}
virtual ~FnZorbaParseXmlFragmentIterator();
zstring getNameAsString() const;
void accept(PlanIterVisitor& v) const;
bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
};
/**
* fn-zorba-xml:canonicalize
* Author: Zorba Team
*/
class FnZorbaCanonicalizeIteratorState : public PlanIteratorState
{
public:
store::LoadProperties theProperties; //loader properties
FnZorbaCanonicalizeIteratorState();
~FnZorbaCanonicalizeIteratorState();
void init(PlanState&);
void reset(PlanState&);
};
class FnZorbaCanonicalizeIterator : public NaryBaseIterator<FnZorbaCanonicalizeIterator, FnZorbaCanonicalizeIteratorState>
{
public:
SERIALIZABLE_CLASS(FnZorbaCanonicalizeIterator);
SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnZorbaCanonicalizeIterator,
NaryBaseIterator<FnZorbaCanonicalizeIterator, FnZorbaCanonicalizeIteratorState>);
void serialize( ::zorba::serialization::Archiver& ar);
FnZorbaCanonicalizeIterator(
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children)
:
NaryBaseIterator<FnZorbaCanonicalizeIterator, FnZorbaCanonicalizeIteratorState>(sctx, loc, children)
{}
virtual ~FnZorbaCanonicalizeIterator();
zstring getNameAsString() const;
void accept(PlanIterVisitor& v) const;
bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
};
/**
* fn:parse-xml-fragment
* Author: Zorba Team
*/
class FnParseXmlFragmentIteratorState : public PlanIteratorState
{
public:
FragmentIStream theFragmentStream; //the input fragment
store::LoadProperties theProperties; //loader properties
zstring baseUri; //
zstring docUri; //
FnParseXmlFragmentIteratorState();
~FnParseXmlFragmentIteratorState();
void init(PlanState&);
void reset(PlanState&);
};
class FnParseXmlFragmentIterator : public NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>
{
public:
SERIALIZABLE_CLASS(FnParseXmlFragmentIterator);
SERIALIZABLE_CLASS_CONSTRUCTOR2T(FnParseXmlFragmentIterator,
NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>);
void serialize( ::zorba::serialization::Archiver& ar);
FnParseXmlFragmentIterator(
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children)
:
NaryBaseIterator<FnParseXmlFragmentIterator, FnParseXmlFragmentIteratorState>(sctx, loc, children)
{}
virtual ~FnParseXmlFragmentIterator();
zstring getNameAsString() const;
void accept(PlanIterVisitor& v) const;
bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
};
}
#endif
/*
* Local variables:
* mode: c++
* End:
*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.