text stringlengths 4 6.14k |
|---|
/*
* Copyright (C) 2008 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 _DALVIK_ALLOC_MARK_SWEEP
#define _DALVIK_ALLOC_MARK_SWEEP
#include "alloc/HeapBitmap.h"
#include "alloc/HeapSource.h"
/* Downward-growing stack for better cache read behavior.
*/
typedef struct {
/* Lowest address (inclusive)
*/
const Object **limit;
/* Current top of the stack (inclusive)
*/
const Object **top;
/* Highest address (exclusive)
*/
const Object **base;
} GcMarkStack;
/* This is declared publicly so that it can be included in gDvm.gcHeap.
*/
typedef struct {
HeapBitmap *bitmap;
GcMarkStack stack;
const char *immuneLimit;
const void *finger; // only used while scanning/recursing.
} GcMarkContext;
bool dvmHeapBeginMarkStep(GcMode mode);
void dvmHeapMarkRootSet(void);
void dvmHeapReMarkRootSet(void);
void dvmHeapScanMarkedObjects(void);
void dvmHeapReScanMarkedObjects(void);
void dvmHandleSoftRefs(Object **list);
void dvmClearWhiteRefs(Object **list);
void dvmHeapScheduleFinalizations(void);
void dvmHeapFinishMarkStep(void);
void dvmHeapSweepSystemWeaks(void);
void dvmHeapSweepUnmarkedObjects(GcMode mode, bool isConcurrent,
size_t *numObjects, size_t *numBytes);
#endif // _DALVIK_ALLOC_MARK_SWEEP
|
/*
* Copyright (C) 2008 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.
*/
/*
* Garbage collector
*/
#ifndef _DALVIK_ALLOC_GC
#define _DALVIK_ALLOC_GC
/*
* Initiate garbage collection.
*
* This usually happens automatically, but can also be caused by Runtime.gc().
*/
void dvmCollectGarbage(bool collectSoftRefs);
/****
**** NOTE: The functions after this point will (should) only be called
**** during GC.
****/
/*
* Functions that mark an object.
*
* Currently implemented in Heap.c.
*/
/*
* Mark an object and schedule it to be scanned for
* references to other objects.
*
* @param obj must be a valid object
*/
void dvmMarkObjectNonNull(const Object *obj);
/*
* Mark an object and schedule it to be scanned for
* references to other objects.
*
* @param obj must be a valid object or NULL
*/
#define dvmMarkObject(obj) \
do { \
Object *DMO_obj_ = (Object *)(obj); \
if (DMO_obj_ != NULL) { \
dvmMarkObjectNonNull(DMO_obj_); \
} \
} while (false)
/*
* If obj points to a valid object, mark it and
* schedule it to be scanned for references to other
* objects.
*
* @param obj any pointer that may be an Object, or NULL
TODO: check for alignment, too (would require knowledge of heap chunks)
*/
#define dvmMarkIfObject(obj) \
do { \
Object *DMIO_obj_ = (Object *)(obj); \
if (DMIO_obj_ != NULL && dvmIsValidObject(DMIO_obj_)) { \
dvmMarkObjectNonNull(DMIO_obj_); \
} \
} while (false)
/*
* Functions that handle scanning various objects for references.
*/
/*
* Mark all class objects loaded by the root class loader;
* most of these are the java.* classes.
*
* Currently implemented in Class.c.
*/
void dvmGcScanRootClassLoader(void);
/*
* Mark all root ThreadGroup objects, guaranteeing that
* all live Thread objects will eventually be scanned.
*
* NOTE: this is a misnomer, because the current implementation
* actually only scans the internal list of VM threads, which
* will mark all VM-reachable Thread objects. Someone else
* must scan the root class loader, which will mark java/lang/ThreadGroup.
* The ThreadGroup class object has static members pointing to
* the root ThreadGroups, and these will be marked as a side-effect
* of marking the class object.
*
* Currently implemented in Thread.c.
*/
void dvmGcScanRootThreadGroups(void);
/*
* Mark all interned string objects.
*
* Currently implemented in Intern.c.
*/
void dvmGcScanInternedStrings(void);
/*
* Remove any unmarked interned string objects from the table.
*
* Currently implemented in Intern.c.
*/
void dvmGcDetachDeadInternedStrings(int (*isUnmarkedObject)(void *));
/*
* Mark all primitive class objects.
*
* Currently implemented in Array.c.
*/
void dvmGcScanPrimitiveClasses(void);
/*
* Mark all JNI global references.
*
* Currently implemented in JNI.c.
*/
void dvmGcMarkJniGlobalRefs(void);
/*
* Mark all debugger references.
*
* Currently implemented in Debugger.c.
*/
void dvmGcMarkDebuggerRefs(void);
/*
* Optional heap profiling.
*/
#if WITH_HPROF && !defined(_DALVIK_HPROF_HPROF)
#include "hprof/Hprof.h"
#define HPROF_SET_GC_SCAN_STATE(tag_, thread_) \
dvmHeapSetHprofGcScanState((tag_), (thread_))
#define HPROF_CLEAR_GC_SCAN_STATE() \
dvmHeapSetHprofGcScanState(0, 0)
#else
#define HPROF_SET_GC_SCAN_STATE(tag_, thread_) do {} while (false)
#define HPROF_CLEAR_GC_SCAN_STATE() do {} while (false)
#endif
#endif // _DALVIK_ALLOC_GC
|
/**
* @file lexan.c
* @provides lexan
*
* $Id: lexan.c 217 2007-07-11 01:03:18Z brylow $
*/
/* Embedded XINU, Copyright (C) 2007. All rights reserved. */
#include <kernel.h>
#include <shell.h>
/**
* Ad hoc lexical analyzer to divide command line into tokens
* @param *line pointer to line to parse
* @param linelen length of line to parse
* @param *tokbuf buffer for tokens
* @param *tok[] array of pointers into token buffer
* @return number of tokens created
*/
short lexan(char *line, ushort linelen, char *tokbuf, char *tok[])
{
char quote; /* character for quoted string */
ushort ntok = 0; /* number of tokens parsed */
ushort i = 0; /* temp variable */
while ((i < linelen) && (ntok < SHELL_MAXTOK))
{
/* Skip whitespace in line of input */
while (isWhitespace(line[i]) && (i < linelen))
{ i++; }
/* Stop parsing at end of line */
if (isEndOfLine(line[i]) || (i >= linelen))
{ return ntok; }
/* Set token to point to value in token buffer */
tok[ntok] = tokbuf;
/* Handle quoted string */
if (isQuote(line[i]))
{
quote = *tokbuf++ = line[i++];
while ( (quote != line[i])
&& (!isEndOfLine(line[i])) && (i < linelen))
{ *tokbuf++ = line[i++]; }
if (quote == line[i])
{ *tokbuf++ = line[i++]; }
else
{ return SYSERR; }
}
else
{
*tokbuf++ = line[i++];
/* Handle standard alphanumeric token */
if (!isOtherSpecial(line[i-1]))
{
while ( (!isEndOfLine(line[i])) && (!isQuote(line[i]))
&& (!isOtherSpecial(line[i])) && (!isWhitespace(line[i]))
&& (i < linelen) )
{ *tokbuf++ = line[i++]; }
if (i >= linelen)
return SYSERR;
}
}
/* Finish current token */
*tokbuf++ = '\0';
ntok++;
}
return ntok;
}
|
#pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "mscorlib_System_Attribute542643598.h"
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.SerializableAttribute
struct SerializableAttribute_t2780967079 : public Attribute_t542643598
{
public:
public:
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
|
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2010-2012 Couchbase, Inc.
*
* 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 file contains the static part of the configure script. Please add
* all platform specific conditional code to this file.
*
* @author Trond Norbye
*/
#ifndef LIBCOUCHBASE_CONFIG_STATIC_H
#define LIBCOUCHBASE_CONFIG_STATIC_H 1
#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if !defined HAVE_STDINT_H && defined _WIN32 && defined(_MSC_VER)
# include "win_stdint.h"
#else
# include <stdint.h>
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
#ifdef HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef _WIN32
#include <winsock2.h>
#include <ws2tcpip.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SYS_UIO_H
#include <sys/uio.h>
#endif
#ifdef HAVE_STRINGS_H
#include <strings.h>
#endif
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
#ifdef HAVE_DLFCN_H
#include <dlfcn.h>
#endif
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
/* Standard C includes */
#include <limits.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#ifndef PATH_MAX
#define PATH_MAX 1024
#endif
#ifdef _WIN32
#include <libcouchbase/plugins/io/wsaerr.h>
#ifndef __MINGW32__
#if defined(_MSC_VER) && _MSC_VER < 1900
#define snprintf _snprintf
#endif
#define strcasecmp(a,b) _stricmp(a,b)
#define strncasecmp(a,b,c) _strnicmp(a,b,c)
#undef strdup
#define strdup _strdup
#endif
#else
#define INVALID_SOCKET -1
#define SOCKET_ERROR -1
#endif /* _WIN32 */
#if defined(HAVE_HTONLL)
#define lcb_htonll htonll
#define lcb_ntohll ntohll
#elif defined(WORDS_BIGENDIAN)
#define lcb_ntohll(a) a
#define lcb_htonll(a) a
#else
#define lcb_ntohll(a) lcb_byteswap64(a)
#define lcb_htonll(a) lcb_byteswap64(a)
#endif /* HAVE_HTONLL */
#ifdef __cplusplus
extern "C" {
#endif
extern uint64_t lcb_byteswap64(uint64_t val);
#ifdef __cplusplus
}
#endif
#ifdef linux
#undef ntohs
#undef ntohl
#undef htons
#undef htonl
#endif
#ifndef HAVE_GETHRTIME
#ifdef __cplusplus
extern "C" {
#endif
typedef uint64_t hrtime_t;
extern hrtime_t gethrtime(void);
#ifdef __cplusplus
}
#endif
#endif
#if defined(EWOULDBLOCK) && defined(EAGAIN) && EWOULDBLOCK != EAGAIN
#define USE_EAGAIN 1
#endif
#endif /* LIBCOUCHBASE_CONFIG_STATIC_H */
|
//===----------------------------------------------------------------------===//
//
// Peloton
//
// updateable_storage.h
//
// Identification: src/include/codegen/updateable_storage.h
//
// Copyright (c) 2015-17, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include "codegen/codegen.h"
#include "codegen/compact_storage.h"
#include "codegen/value.h"
namespace peloton {
namespace codegen {
//===----------------------------------------------------------------------===//
// A storage area where slots can be updated.
//===----------------------------------------------------------------------===//
class UpdateableStorage {
public:
// Constructor
UpdateableStorage() : storage_size_(0), storage_type_(nullptr) {}
// Add the given type to the storage format. We return the index that this
// value can be found it (i.e., the index to pass into Get() to get the value)
uint32_t AddType(type::Type::TypeId type);
// Construct the final LLVM type given all the types that'll be stored
llvm::Type *Finalize(CodeGen &codegen);
// Get the value at a specific index into the storage area
codegen::Value GetValueAt(CodeGen &codegen, llvm::Value *area_start,
uint64_t index) const;
// Get the value at a specific index into the storage area
void SetValueAt(CodeGen &codegen, llvm::Value *area_start, uint64_t index,
const codegen::Value &value) const;
// Return the format of the storage area
llvm::Type *GetStorageType() const { return storage_type_; }
// Return the total bytes required by this storage format
uint32_t GetStorageSize() const { return storage_size_; }
// Return the number of elements this format is configured to handle
uint32_t GetNumElements() const {
return static_cast<uint32_t>(types_.size());
}
private:
// The types we store in the storage area
std::vector<type::Type::TypeId> types_;
// The physical storage format
std::vector<CompactStorage::EntryInfo> storage_format_;
// The total number of bytes needed for this format
uint32_t storage_size_;
// The finalized LLVM type that represents this storage area
llvm::Type *storage_type_;
};
} // namespace codegen
} // namespace peloton |
// Copyright (c) 2015 Ionel Gog <ionel.gog@cl.cam.ac.uk>
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT
* LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR
* A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
*
* See the Apache Version 2.0 License for specific language governing
* permissions and limitations under the License.
*/
#ifndef MUSKETEER_COMMON_H
#define MUSKETEER_COMMON_H
using namespace std; // NOLINT
#include <glog/logging.h>
#include <gflags/gflags.h>
typedef enum {
AGG_OP,
BLACK_BOX_OP,
COUNT_OP,
CROSS_JOIN_OP,
DIFFERENCE_OP,
DISTINCT_OP,
DIV_OP,
INPUT_OP,
INTERSECTION_OP,
JOIN_OP,
MAX_OP,
MIN_OP,
MUL_OP,
PROJECT_OP,
SELECT_OP,
SORT_OP,
SUB_OP,
SUM_OP,
UDF_OP,
UNION_OP,
WHILE_OP
} OperatorType;
#endif // MUSKETEER_COMMON_H
|
//
// msgpack::rpc::future - MessagePack-RPC for C++
//
// Copyright (C) 2010 FURUHASHI Sadayuki
//
// 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 MSGPACK_RPC_FUTURE_IMPL_H__
#define MSGPACK_RPC_FUTURE_IMPL_H__
#include "future.h"
#include "session_impl.h"
#include "../mp/pthread.h"
#include "../mp/memory.h"
namespace msgpack {
namespace rpc {
class future_impl : public mp::enable_shared_from_this<future_impl> {
public:
future_impl(shared_session s, loop lo) :
m_session(s),
m_loop(lo),
m_timeout(s->get_timeout()) // FIXME
{ }
~future_impl() { }
object get_impl();
void join();
void wait();
void recv();
bool finish();
object result() const
{
return m_result;
}
object error() const
{
return m_error;
}
auto_zone& zone() { return m_zone; }
void attach_callback(callback_t func);
void set_result(object result, object error, auto_zone z);
bool step_timeout()
{
if(m_timeout > 0) {
--m_timeout;
return false;
} else {
return true;
}
}
private:
shared_session m_session;
loop m_loop;
unsigned int m_timeout;
callback_t m_callback;
object m_result;
object m_error;
auto_zone m_zone;
mp::pthread_mutex m_mutex;
mp::pthread_cond m_cond;
private:
future_impl();
future_impl(const future_impl&);
};
} // namespace rpc
} // namespace msgpack
#endif /* msgpack/rpc/future_impl.h */
|
/**
* FreeRDP: A Remote Desktop Protocol Client
* Input PDUs
*
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* 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 __INPUT_H
#define __INPUT_H
#include "rdp.h"
#include "fastpath.h"
#include <freerdp/input.h>
#include <freerdp/freerdp.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/memory.h>
/* Input Events */
#define INPUT_EVENT_SYNC 0x0000
#define INPUT_EVENT_SCANCODE 0x0004
#define INPUT_EVENT_UNICODE 0x0005
#define INPUT_EVENT_MOUSE 0x8001
#define INPUT_EVENT_MOUSEX 0x8002
#define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH 4
void input_send_synchronize_event(rdpInput* input, uint32 flags);
void input_send_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
void input_send_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
void input_send_mouse_event(rdpInput* input, uint16 flags, sint16 x, sint16 y);
void input_send_extended_mouse_event(rdpInput* input, uint16 flags, sint16 x, sint16 y);
void input_send_fastpath_synchronize_event(rdpInput* input, uint32 flags);
void input_send_fastpath_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
void input_send_fastpath_unicode_keyboard_event(rdpInput* input, uint16 flags, uint16 code);
void input_send_fastpath_mouse_event(rdpInput* input, uint16 flags, sint16 x, sint16 y);
void input_send_fastpath_extended_mouse_event(rdpInput* input, uint16 flags, sint16 x, sint16 y);
boolean input_recv(rdpInput* input, STREAM* s);
void input_register_client_callbacks(rdpInput* input);
rdpInput* input_new(rdpRdp* rdp);
void input_free(rdpInput* input);
#endif /* __INPUT_H */
|
// -*- C++ -*-
/***************************************************************************
*
* _cstdarg.h - C++ Standard library interface to the ANSI C header stdarg.h
*
* $Id$
*
***************************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you 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.
*
* Copyright 1994-2006 Rogue Wave Software.
*
**************************************************************************/
#ifndef _RWSTD_CSTDARG_H_INCLUDED
#define _RWSTD_CSTDARG_H_INCLUDED
#include <rw/_defs.h>
_RWSTD_NAMESPACE (std) {
extern "C" {
#ifdef _RWSTD_VA_LIST
typedef _RWSTD_VA_LIST va_list;
#else
typedef void* va_list;
#endif // _RWSTD_VA_LIST
#define va_arg(va, T) \
((T*)(va = (va_list)((char*)va + sizeof (T))))[-1]
#define va_start(va, name) \
(void)(va = (va_list)((char*)&name \
+ ((sizeof (name) + (sizeof (int) - 1)) & ~(sizeof (int) - 1))))
#define va_end(ignore) (void)0
} // extern "C"
} // namespace std
#endif // _RWSTD_CSTDARG_H_INCLUDED
|
/**********************************************************************
* File: boxread.h
* Description: Read data from a box file.
* Author: Ray Smith
* Created: Fri Aug 24 17:47:23 PDT 2007
*
* (C) Copyright 2007, Google Inc.
** 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 TESSERACT_CCUTIL_BOXREAD_H_
#define TESSERACT_CCUTIL_BOXREAD_H_
#include <cstdio> // for FILE
#include "strngs.h" // for STRING
class TBOX;
template <typename T> class GenericVector;
template <typename T> class GenericVector;
// Size of buffer used to read a line from a box file.
const int kBoxReadBufSize = 1024;
// Open the boxfile based on the given image filename.
// Returns nullptr if the box file cannot be opened.
FILE* OpenBoxFile(const STRING& fname);
// Reads all boxes from the given filename.
// Reads a specific target_page number if >= 0, or all pages otherwise.
// Skips blanks if skip_blanks is true.
// The UTF-8 label of the box is put in texts, and the full box definition as
// a string is put in box_texts, with the corresponding page number in pages.
// Each of the output vectors is optional (may be nullptr).
// Returns false if no boxes are found.
bool ReadAllBoxes(int target_page, bool skip_blanks, const STRING& filename,
GenericVector<TBOX>* boxes,
GenericVector<STRING>* texts,
GenericVector<STRING>* box_texts,
GenericVector<int>* pages);
// Reads all boxes from the string. Otherwise, as ReadAllBoxes.
// continue_on_failure allows reading to continue even if an invalid box is
// encountered and will return true if it succeeds in reading some boxes.
// It otherwise gives up and returns false on encountering an invalid box.
bool ReadMemBoxes(int target_page, bool skip_blanks, const char* box_data,
bool continue_on_failure,
GenericVector<TBOX>* boxes,
GenericVector<STRING>* texts,
GenericVector<STRING>* box_texts,
GenericVector<int>* pages);
// Returns the box file name corresponding to the given image_filename.
STRING BoxFileName(const STRING& image_filename);
// ReadNextBox factors out the code to interpret a line of a box
// file so that applybox and unicharset_extractor interpret the same way.
// This function returns the next valid box file utf8 string and coords
// and returns true, or false on eof (and closes the file).
// It ignores the utf8 file signature ByteOrderMark (U+FEFF=EF BB BF), checks
// for valid utf-8 and allows space or tab between fields.
// utf8_str is set with the unichar string, and bounding box with the box.
// If there are page numbers in the file, it reads them all.
bool ReadNextBox(int *line_number, FILE* box_file,
STRING* utf8_str, TBOX* bounding_box);
// As ReadNextBox above, but get a specific page number. (0-based)
// Use -1 to read any page number. Files without page number all
// read as if they are page 0.
bool ReadNextBox(int target_page, int *line_number, FILE* box_file,
STRING* utf8_str, TBOX* bounding_box);
// Parses the given box file string into a page_number, utf8_str, and
// bounding_box. Returns true on a successful parse.
bool ParseBoxFileStr(const char* boxfile_str, int* page_number,
STRING* utf8_str, TBOX* bounding_box);
// Creates a box file string from a unichar string, TBOX and page number.
void MakeBoxFileStr(const char* unichar_str, const TBOX& box, int page_num,
STRING* box_str);
#endif // TESSERACT_CCUTIL_BOXREAD_H_
|
/*
* Copyright 2012 Rolando Martins, CRACS & INESC-TEC, DCC/FCUP
*
* 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.
*
*/
/*
* File: AsyncDiscoveryQueryReply.h
* Author: Rolando Martins (rolando.martins@gmail.com)
*
* Created on May 12, 2010, 11:06 AM
*/
#ifndef ASYNCDISCOVERYQUERYREPLY_H
#define ASYNCDISCOVERYQUERYREPLY_H
#include <euryale/event/EventFuture.h>
#include <stheno/core/p2p/discovery/DiscoveryQueryReply.h>
class AsyncDiscoveryQueryReply: public EventFuture<DiscoveryQueryReply*>{
public:
AsyncDiscoveryQueryReply(ACE_Time_Value* timeout);
AsyncDiscoveryQueryReply(UInt expectedSize, ACE_Time_Value* timeout);
//AsyncDiscoveryQueryReply(const AsyncDiscoveryQueryReply& orig);
virtual ~AsyncDiscoveryQueryReply();
protected:
};
#endif /* ASYNCDISCOVERYQUERYREPLY_H */
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
//
// You are hereby granted a non-exclusive, worldwide, royalty-free license to use,
// copy, modify, and distribute this software in source code or binary form for use
// in connection with the web services and APIs provided by Facebook.
//
// As with any software that integrates with the Facebook platform, your use of
// this software is subject to the Facebook Developer Principles and Policies
// [http://developers.facebook.com/policy/]. This copyright 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>
NS_ASSUME_NONNULL_BEGIN
/// An internal protocol used to describe a type that can post a notification
NS_SWIFT_NAME(NotificationPosting)
@protocol FBSDKNotificationPosting
- (void)postNotificationName:(NSNotificationName)aName
object:(nullable id)anObject
userInfo:(nullable NSDictionary *)aUserInfo
NS_SWIFT_NAME(post(name:object:userInfo:));
@end
/// An internal protocol used to describe a type that can observe a notification
NS_SWIFT_NAME(NotificationObserving)
@protocol FBSDKNotificationObserving
- (void)addObserver:(id)observer
selector:(SEL)aSelector
name:(nullable NSNotificationName)aName
object:(nullable id)anObject;
- (void)removeObserver:(id)observer;
@end
NS_ASSUME_NONNULL_END
|
// Copyright 2018-present the Material Components for iOS authors. All Rights Reserved.
//
// 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.
#import "MaterialTabs.h"
#import "MaterialTypographyScheme.h"
/**
The Material Design typography system's themer for instances of MDCTabBar.
@warning This API will eventually be deprecated. See the individual method documentation for
details on replacement APIs.
Learn more at docs/theming.md#migration-guide-themers-to-theming-extensions
*/
@interface MDCTabBarTypographyThemer : NSObject
@end
@interface MDCTabBarTypographyThemer (Deprecated)
/**
Applies a typography scheme's properties to an MDCTabBar.
@param typographyScheme The typography scheme to apply to the component instance.
@param tabBar A component instance to which the typography scheme should be applied.
@warning This API will eventually be deprecated. The replacement API is any `MDCTabBar` theming
extension.
Learn more at docs/theming.md#migration-guide-themers-to-theming-extensions
*/
+ (void)applyTypographyScheme:(nonnull id<MDCTypographyScheming>)typographyScheme
toTabBar:(nonnull MDCTabBar *)tabBar
__deprecated_msg("Use MDCTabBar's applyPrimaryThemeWithScheme instead.");
@end
|
//
// PPAddressModel.h
// PPAddressBook
//
// Created by AndyPang on 16/8/17.
// Copyright © 2016年 AndyPang. All rights reserved.
//
/*
*********************************************************************************
*
*⭐️⭐️⭐️ 新建 PP-iOS学习交流群: 323408051 欢迎加入!!! ⭐️⭐️⭐️
*
* 如果您在使用 PPGetAddressBook 的过程中出现bug或有更好的建议,还请及时以下列方式联系我,我会及
* 时修复bug,解决问题.
*
* Weibo : jkpang-庞
* Email : jkpang@outlook.com
* QQ 群 : 323408051
* GitHub: https://github.com/jkpang
*
* PS:我的另外两个很好用的封装,欢迎使用!
* 1.对AFNetworking 3.x 与YYCache的二次封装,一句代码搞定数据请求与缓存,告别FMDB:
* GitHub:https://github.com/jkpang/PPNetworkHelper
* 2.仿京东淘宝商品数量的加减按钮,可定制程度高,使用简单:
* GitHub:https://github.com/jkpang/PPNumberButton
*
* 如果 PPGetAddressBook 好用,希望您能Star支持,你的 ⭐️ 是我持续更新的动力!
*********************************************************************************
*/
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface PPPersonModel : NSObject
/** 联系人姓名*/
@property (nonatomic, copy) NSString *name;
/** 联系人电话数组,因为一个联系人可能存储多个号码*/
@property (nonatomic, strong) NSMutableArray *mobileArray;
/** 联系人头像*/
@property (nonatomic, strong) UIImage *headerImage;
@end
|
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_
#define CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/hash_tables.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/net/network_portal_detector.h"
namespace chromeos {
class NetworkPortalDetectorStub : public NetworkPortalDetector {
public:
NetworkPortalDetectorStub();
virtual ~NetworkPortalDetectorStub();
// NetworkPortalDetector implementation:
virtual void Init() OVERRIDE;
virtual void Shutdown() OVERRIDE;
virtual void AddObserver(Observer* observer) OVERRIDE;
virtual void AddAndFireObserver(Observer* observer) OVERRIDE;
virtual void RemoveObserver(Observer* observer) OVERRIDE;
virtual CaptivePortalState GetCaptivePortalState(
const chromeos::Network* network) OVERRIDE;
virtual bool IsEnabled() OVERRIDE;
virtual void Enable(bool start_detection) OVERRIDE;
virtual void EnableLazyDetection() OVERRIDE;
virtual void DisableLazyDetection() OVERRIDE;
private:
friend class UpdateScreenTest;
typedef std::string NetworkId;
typedef base::hash_map<NetworkId, CaptivePortalState> CaptivePortalStateMap;
void SetActiveNetworkForTesting(const Network* network);
void SetDetectionResultsForTesting(const Network* network,
const CaptivePortalState& state);
void NotifyObserversForTesting();
ObserverList<Observer> observers_;
const Network* active_network_;
CaptivePortalStateMap portal_state_map_;
DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_NET_NETWORK_PORTAL_DETECTOR_STUB_H_
|
/*
* Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.
*/
#import <Foundation/Foundation.h>
#import "S3Response.h"
#import "S3BucketPolicy.h"
/** Contains all the information about the getBucketPolicy operation.
*
* \ingroup S3
*/
@interface S3GetBucketPolicyResponse:S3Response {
S3BucketPolicy *policy;
}
/** Gets the bucket policy */
@property (nonatomic, retain) S3BucketPolicy *policy;
@end
|
/*
* Copyright 2004-2015 Cray Inc.
* Other additional copyright holders may be indicated within.
*
* The entirety of this work is 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 _FOR_LOOP_H_
#define _FOR_LOOP_H_
#include "LoopStmt.h"
// A ForLoop represents the for-statement language construct as described in
// the specification (see "The For Loop" section in the chapter on "Statements").
// The buildForLoop() method transforms the elements of the for-statement
// parser production into its internal representation.
// ForLoop objects are also used to represent coforall-statements and zippered
// iteration.
class ForLoop : public LoopStmt
{
//
// Class interface
//
public:
static BlockStmt* buildForLoop (Expr* indices,
Expr* iteratorExpr,
BlockStmt* body,
bool coforall,
bool zippered);
//
// Instance Interface
//
public:
ForLoop(VarSymbol* index,
VarSymbol* iterator,
BlockStmt* initBody,
bool zippered);
virtual ~ForLoop();
virtual ForLoop* copy(SymbolMap* map = NULL,
bool internal = false);
virtual GenRet codegen();
virtual void verify();
virtual void accept(AstVisitor* visitor);
// Interface to Expr
virtual void replaceChild(Expr* oldAst, Expr* newAst);
virtual Expr* getFirstExpr();
virtual Expr* getNextExpr(Expr* expr);
virtual bool isForLoop() const;
virtual bool isCoforallLoop() const;
virtual bool deadBlockCleanup();
BlockStmt* copyBody();
BlockStmt* copyBody(SymbolMap* map);
SymExpr* indexGet() const;
SymExpr* iteratorGet() const;
bool zipperedGet() const;
virtual CallExpr* blockInfoGet() const;
virtual CallExpr* blockInfoSet(CallExpr* expr);
private:
ForLoop();
SymExpr* mIndex;
SymExpr* mIterator;
bool mZippered;
};
#endif
|
#include "f2c.h"
/*
* getenv - f77 subroutine to return environment variables
*
* called by:
* call getenv (ENV_NAME, char_var)
* where:
* ENV_NAME is the name of an environment variable
* char_var is a character variable which will receive
* the current value of ENV_NAME, or all blanks
* if ENV_NAME is not defined
*/
#ifdef KR_headers
VOID getenv_(fname, value, flen, vlen) char *value, *fname;
ftnlen vlen, flen;
#else
void getenv_(char *fname, char *value, ftnlen flen, ftnlen vlen)
#endif
{
extern char **environ;
register char *ep, *fp, *flast;
register char **env = environ;
flast = fname + flen;
for(fp = fname ; fp < flast ; ++fp)
if(*fp == ' ')
{
flast = fp;
break;
}
while(ep = *env++)
{
for(fp = fname; fp < flast ;)
if(*fp++ != *ep++)
goto endloop;
if(*ep++ == '=') /* copy right hand side */
{
while(*ep && --vlen >= 0)
*value++ = *ep++;
goto blank;
}
endloop:
;
}
blank:
while(--vlen >= 0)
*value++ = ' ';
}
|
/* ``The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved via the world wide web at http://www.erlang.org/.
*
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
*
* The Initial Developer of the Original Code is Ericsson AB. Portions
* created by Ericsson are Copyright 2008, Ericsson AB. All Rights
* Reserved.''
*
* $Id$
*/
#if defined(DEBUG) || 0
# define PRINTF(X) printf X
#else
# define PRINTF(X)
#endif
#include <math.h>
#ifdef __WIN32__
#include <float.h>
#if defined (__GNUC__)
int _finite(double x);
#endif
#ifndef finite
#define finite _finite
#endif
#endif
#include "erl_driver.h"
#define ERTS_FP_CONTROL_TEST 0
#define ERTS_FP_THREAD_TEST 1
static int control(ErlDrvData, unsigned int, char *, int, char **, int);
static ErlDrvEntry fp_drv_entry = {
NULL /* init */,
NULL /* start */,
NULL /* stop */,
NULL /* output */,
NULL /* ready_input */,
NULL /* ready_output */,
"fp_drv",
NULL /* finish */,
NULL /* handle */,
control,
NULL /* timeout */,
NULL /* outputv */,
NULL /* ready_async */,
NULL /* flush */,
NULL /* call */,
NULL /* event */,
ERL_DRV_EXTENDED_MARKER,
ERL_DRV_EXTENDED_MAJOR_VERSION,
ERL_DRV_EXTENDED_MINOR_VERSION,
ERL_DRV_FLAG_USE_PORT_LOCKING,
NULL /* handle2 */,
NULL /* process_exit */
};
DRIVER_INIT(fp_drv)
{
return &fp_drv_entry;
}
void *
do_test(void *unused)
{
double x, y, z;
x = 3.23e133;
y = 3.57e257;
z = x*y;
if (finite(z))
return "is finite (1)";
x = 5.0;
y = 0.0;
z = x/y;
if (finite(z))
return "is finite (2)";
z = log(-1.0);
if (finite(z))
return "is finite (3)";
z = log(0.0);
if (finite(z))
return "is finite (4)";
return "ok";
}
static int control(ErlDrvData drv_data,
unsigned int command,
char *buf, int len,
char **rbuf, int rlen)
{
char *res_str;
PRINTF(("control(%p, %d, ...) called\r\n", drv_data, command));
switch (command) {
case ERTS_FP_THREAD_TEST: {
ErlDrvTid tid;
ErlDrvSysInfo info;
driver_system_info(&info, sizeof(ErlDrvSysInfo));
if (!info.thread_support)
res_str = "skip: no thread support";
else if (0 != erl_drv_thread_create("test", &tid, do_test, NULL, NULL))
res_str = "failed to create thread";
else if (0 != erl_drv_thread_join(tid, &res_str))
res_str = "failed to join thread";
break;
}
case ERTS_FP_CONTROL_TEST:
res_str = do_test(NULL);
break;
default:
res_str = "unknown command";
break;
}
done: {
int res_len = strlen(res_str);
if (res_len > rlen) {
char *abuf = driver_alloc(sizeof(char)*res_len);
if (!abuf)
return 0;
*rbuf = abuf;
}
memcpy((void *) *rbuf, (void *) res_str, res_len);
return res_len;
}
}
|
/*! @file AppAuth.h
@brief AppAuth iOS SDK
@copyright
Copyright 2015 Google Inc. All Rights Reserved.
@copydetails
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.
*/
#import "OIDAuthState.h"
#import "OIDAuthStateChangeDelegate.h"
#import "OIDAuthStateErrorDelegate.h"
#import "OIDAuthorizationRequest.h"
#import "OIDAuthorizationResponse.h"
#import "OIDAuthorizationService.h"
#import "OIDError.h"
#import "OIDErrorUtilities.h"
#import "OIDExternalUserAgent.h"
#import "OIDExternalUserAgentRequest.h"
#import "OIDExternalUserAgentSession.h"
#import "OIDGrantTypes.h"
#import "OIDIDToken.h"
#import "OIDRegistrationRequest.h"
#import "OIDRegistrationResponse.h"
#import "OIDResponseTypes.h"
#import "OIDScopes.h"
#import "OIDScopeUtilities.h"
#import "OIDServiceConfiguration.h"
#import "OIDServiceDiscovery.h"
#import "OIDTokenRequest.h"
#import "OIDTokenResponse.h"
#import "OIDTokenUtilities.h"
#import "OIDURLSessionProvider.h"
#import "OIDEndSessionRequest.h"
#import "OIDEndSessionResponse.h"
#if TARGET_OS_TV
#elif TARGET_OS_WATCH
#elif TARGET_OS_IOS || TARGET_OS_MACCATALYST
#import "OIDAuthState+IOS.h"
#import "OIDAuthorizationService+IOS.h"
#import "OIDExternalUserAgentIOS.h"
#import "OIDExternalUserAgentCatalyst.h"
#elif TARGET_OS_OSX
#import "OIDAuthState+Mac.h"
#import "OIDAuthorizationService+Mac.h"
#import "OIDExternalUserAgentMac.h"
#import "OIDRedirectHTTPHandler.h"
#else
#error "Platform Undefined"
#endif
/*! @mainpage AppAuth for iOS and macOS
@section introduction Introduction
AppAuth for iOS and macOS is a client SDK for communicating with [OAuth 2.0]
(https://tools.ietf.org/html/rfc6749) and [OpenID Connect]
(http://openid.net/specs/openid-connect-core-1_0.html) providers. It strives to
directly map the requests and responses of those specifications, while following
the idiomatic style of the implementation language. In addition to mapping the
raw protocol flows, convenience methods are available to assist with common
tasks like performing an action with fresh tokens.
It follows the best practices set out in
[RFC 8252 - OAuth 2.0 for Native Apps](https://tools.ietf.org/html/rfc8252)
including using `SFAuthenticationSession` and `SFSafariViewController` on iOS
for the auth request. Web view and `WKWebView` are explicitly *not*
supported due to the security and usability reasons explained in
[Section 8.12 of RFC 8252](https://tools.ietf.org/html/rfc8252#section-8.12).
It also supports the [PKCE](https://tools.ietf.org/html/rfc7636) extension to
OAuth which was created to secure authorization codes in public clients when
custom URI scheme redirects are used. The library is friendly to other
extensions (standard or otherwise) with the ability to handle additional params
in all protocol requests and responses.
<b>Homepage</b>: http://openid.github.io/AppAuth-iOS/ <br>
<b>API Documentation</b>: http://openid.github.io/AppAuth-iOS/docs/latest <br>
<b>Git Repository</b>: https://github.com/openid/AppAuth-iOS <br>
*/
|
/*****************************************************************************
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.
See NOTICE file for details.
*****************************************************************************/
#ifndef _JPMETHOD_H_
#define _JPMETHOD_H_
#include "jp_modifier.h"
class JPMethod;
class JPMethod : public JPResource
{
friend class JPMethodDispatch;
public:
JPMethod();
JPMethod(JPJavaFrame& frame,
JPClass* claz,
const string& name,
jobject mth,
jmethodID mid,
JPMethodList& moreSpecific,
jint modifiers);
virtual ~JPMethod();
void setParameters(
JPClass *returnType,
JPClassList parameterTypes);
/** Check to see if this overload matches the argument list.
*
* @param frame is the scope to hold Java local variables.
* @param match holds the details of the match that is found.
* @param isInstance is true if the first argument is an instance object.
* @param args is a list of arguments including the instance.
*
* @return the quality of the match.
*
*/
JPMatch::Type matches(JPJavaFrame &frame, JPMethodMatch& match, bool isInstance, JPPyObjectVector& args);
JPPyObject invoke(JPJavaFrame &frame, JPMethodMatch& match, JPPyObjectVector& arg, bool instance);
JPPyObject invokeCallerSensitive(JPMethodMatch& match, JPPyObjectVector& arg, bool instance);
JPValue invokeConstructor(JPJavaFrame &frame, JPMethodMatch& match, JPPyObjectVector& arg);
bool isAbstract() const
{
return JPModifier::isAbstract(m_Modifiers);
}
bool isConstructor() const
{
return JPModifier::isConstructor(m_Modifiers);
}
bool isInstance() const
{
return !JPModifier::isStatic(m_Modifiers) && !JPModifier::isConstructor(m_Modifiers);
}
bool isFinal() const
{
return JPModifier::isFinal(m_Modifiers);
}
bool isStatic() const
{
return JPModifier::isStatic(m_Modifiers);
}
bool isVarArgs() const
{
return JPModifier::isVarArgs(m_Modifiers);
}
bool isCallerSensitive() const
{
return JPModifier::isCallerSensitive(m_Modifiers);
}
string toString() const;
string matchReport(JPPyObjectVector& args);
bool checkMoreSpecificThan(JPMethod* other) const;
jobject getJava()
{
return m_Method.get();
}
private:
void packArgs(JPJavaFrame &frame, JPMethodMatch &match, vector<jvalue> &v, JPPyObjectVector &arg);
void ensureTypeCache();
JPMethod(const JPMethod& o);
JPMethod& operator=(const JPMethod&) ;
private:
JPClass* m_Class;
string m_Name;
JPObjectRef m_Method;
jmethodID m_MethodID;
JPClass* m_ReturnType;
JPClassList m_ParameterTypes;
JPMethodList m_MoreSpecificOverloads;
jint m_Modifiers;
} ;
#endif // _JPMETHODOVERLOAD_H_ |
/* $NetBSD: auixpvar.h,v 1.8 2012/10/27 17:18:28 chs Exp $*/
/*
* Copyright (c) 2004, 2005 Reinoud Zandijk <reinoud@netbsd.org>
* All rights reserved.
*
* 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the NetBSD
* Foundation, Inc. and its contributors.
* 4. Neither the name of The NetBSD Foundation 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 AUTHOR ``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 AUTHOR 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.
*/
/*
* NetBSD audio driver for ATI IXP-{150,200,...} audio driver hardware.
*/
#define DMA_DESC_CHAIN 255
/* audio format structure describing our hardware capabilities */
/* XXX min and max sample rates are for AD1888 codec XXX */
#define AUIXP_NFORMATS 6
#define AUIXP_MINRATE 7000
#define AUIXP_MAXRATE 48000
/* current AC'97 driver only supports SPDIF outputting channel 3&4 i.e. STEREO */
static const struct audio_format auixp_formats[AUIXP_NFORMATS] = {
{NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 2, AUFMT_STEREO, 0, {7000, 48000}},
{NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 2, AUFMT_STEREO, 0, {7000, 48000}},
{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 4, AUFMT_SURROUND4, 0, {7000, 48000}},
{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 4, AUFMT_SURROUND4, 0, {7000, 48000}},
{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 16, 16, 6, AUFMT_DOLBY_5_1, 0, {7000, 48000}},
{NULL, AUMODE_PLAY, AUDIO_ENCODING_SLINEAR_LE, 32, 32, 6, AUFMT_DOLBY_5_1, 0, {7000, 48000}},
};
/* auixp structures; used to record alloced DMA space */
struct auixp_dma {
/* bus mappings */
bus_dmamap_t map;
void * addr;
bus_dma_segment_t segs[1];
int nsegs;
size_t size;
/* audio feeder */
void (*intr)(void *); /* function to call when there is space */
void *intrarg;
/* status and setup bits */
int running;
uint32_t linkptr;
uint32_t dma_enable_bit;
/* linked list of all mapped area's */
SLIST_ENTRY(auixp_dma) dma_chain;
};
struct auixp_codec {
struct auixp_softc *sc;
int present;
int codec_nr;
struct ac97_codec_if *codec_if;
struct ac97_host_if host_if;
enum ac97_host_flags codec_flags;
};
struct auixp_softc {
device_t sc_dev;
kmutex_t sc_lock;
kmutex_t sc_intr_lock;
/* card id */
int type;
int delay1, delay2; /* nessisary? */
/* card properties */
int has_4ch, has_6ch, is_fixed, has_spdif;
/* bus tags */
bus_space_tag_t sc_iot;
bus_space_handle_t sc_ioh;
bus_addr_t sc_iob;
bus_size_t sc_ios;
pcitag_t sc_tag;
pci_chipset_tag_t sc_pct;
bus_dma_tag_t sc_dmat;
/* interrupts */
void *sc_ih;
/* DMA business */
struct auixp_dma *sc_output_dma; /* contains dma-safe chain */
struct auixp_dma *sc_input_dma;
/* list of allocated DMA pieces */
SLIST_HEAD(auixp_dma_list, auixp_dma) sc_dma_list;
/* audio formats supported */
struct audio_format sc_formats[AUIXP_NFORMATS];
struct audio_encoding_set *sc_encodings;
/* codecs */
int sc_num_codecs;
struct auixp_codec sc_codec[ATI_IXP_CODECS];
int sc_codec_not_ready_bits;
/* last set audio parameters */
struct audio_params sc_play_params;
struct audio_params sc_rec_params;
};
|
/*
* Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#ifndef CONVERSIONEMITTERGEOMSPHEREPARAMS_0P0_0P1H_H
#define CONVERSIONEMITTERGEOMSPHEREPARAMS_0P0_0P1H_H
#include "ParamConversionTemplate.h"
#include "EmitterGeomSphereParams_0p0.h"
#include "EmitterGeomSphereParams_0p1.h"
namespace physx
{
namespace apex
{
namespace legacy
{
typedef ParamConversionTemplate<EmitterGeomSphereParams_0p0, EmitterGeomSphereParams_0p1, 0, 1> ConversionEmitterGeomSphereParams_0p0_0p1Parent;
class ConversionEmitterGeomSphereParams_0p0_0p1: ConversionEmitterGeomSphereParams_0p0_0p1Parent
{
public:
static NxParameterized::Conversion* Create(NxParameterized::Traits* t)
{
void* buf = t->alloc(sizeof(ConversionEmitterGeomSphereParams_0p0_0p1));
return buf ? PX_PLACEMENT_NEW(buf, ConversionEmitterGeomSphereParams_0p0_0p1)(t) : 0;
}
protected:
ConversionEmitterGeomSphereParams_0p0_0p1(NxParameterized::Traits* t) : ConversionEmitterGeomSphereParams_0p0_0p1Parent(t) {}
const NxParameterized::PrefVer* getPreferredVersions() const
{
static NxParameterized::PrefVer prefVers[] =
{
//TODO:
// Add your preferred versions for included references here.
// Entry format is
// { (const char*)longName, (PxU32)preferredVersion }
{ 0, 0 } // Terminator (do not remove!)
};
return prefVers;
}
bool convert()
{
//TODO:
// Write custom conversion code here using mNewData and mLegacyData members.
//
// Note that
// - mNewData has already been initialized with default values
// - same-named/same-typed members have already been copied
// from mLegacyData to mNewData
// - included references were moved to mNewData
// (and updated to preferred versions according to getPreferredVersions)
//
// For more info see the versioning wiki.
return true;
}
};
}
}
} // namespace physx::apex
#endif
|
///////////////////////////////////////////////////////////////////////////////
//
// @@@ START COPYRIGHT @@@
//
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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.
//
// @@@ END COPYRIGHT @@@
//
///////////////////////////////////////////////////////////////////////////////
#ifndef CLUSTERCONF_H_
#define CLUSTERCONF_H_
#include <stdlib.h>
#include "lnodeconfig.h"
#include "pnodeconfig.h"
#include "persistconfig.h"
class CClusterConfig : public CPNodeConfigContainer
, public CLNodeConfigContainer
, public CPersistConfigContainer
{
public:
CClusterConfig( void );
~CClusterConfig( void );
void Clear( void );
bool DeleteNodeConfig( int pnid );
inline int GetClusterId( void ) { return clusterId_;}
inline int GetConfigMaster( void ) { return configMaster_;}
inline char * GetConfigMasterByName( void ) {return configMasterName_;}
inline int GetInstanceId( void ) { return instanceId_;}
bool Initialize( void );
bool Initialize( bool traceEnabled, const char *traceFile );
void InitCoreMask( cpu_set_t &coreMask );
inline bool IsConfigReady( void ) { return( nodeReady_ && persistReady_ ); }
inline bool IsNodeReady( void ) { return( nodeReady_ ); }
inline bool IsPersistReady( void ) { return( persistReady_ ); }
inline TcStorageType_t GetStorageType( void ) { return(trafConfigStorageType_); }
bool LoadConfig( void );
bool LoadNodeConfig( void );
bool LoadPersistConfig( void );
bool SaveNodeConfig( const char *name
, const char *domain
, int nid
, int pnid
, int firstCore
, int lastCore
, int processors
, int excludedFirstCore
, int excludedLastCore
, int roles );
void SetCoreMask( int firstCore
, int lastCore
, cpu_set_t &coreMask );
bool UpdatePNodeConfig( int pnid
, const char *name
, const char *domain
, int excludedFirstCore
, int excludedLastCore );
protected:
private:
int configMaster_;
int clusterId_;
int instanceId_;
char configMasterName_[TC_PROCESSOR_NAME_MAX];
bool isRealCluster_;
bool nodeReady_; // true when node configuration loaded
bool persistReady_; // true when persist configuration loaded
bool newPNodeConfig_;
bool trafConfigInitialized_;
TcStorageType_t trafConfigStorageType_;
CPNodeConfig *prevPNodeConfig_;
CLNodeConfig *prevLNodeConfig_;
CPersistConfig *prevPersistConfig_;
void AddNodeConfiguration( pnodeConfigInfo_t &pnodeConfigInfo
, lnodeConfigInfo_t &lnodeConfigInfo );
void AddSNodeConfiguration( pnodeConfigInfo_t &pnodeConfigInfo );
void AddPersistConfiguration( persistConfigInfo_t &persistConfigInfo );
bool DeleteDbNodeData( int pnid );
TcProcessType_t GetProcessType( const char *processtype );
void ProcessLNode( TcNodeConfiguration_t &nodeConfig
, pnodeConfigInfo_t &pnodeConfigInfo
, lnodeConfigInfo_t &lnodeConfigInfo );
void ProcessSNode( TcPhysicalNodeConfiguration_t &pnodeConfig
, pnodeConfigInfo_t &pnodeConfigInfo );
void ProcessPersistInfo( TcPersistConfiguration_t &persistConfigData
, persistConfigInfo_t &persistConfigInfo );
bool SaveDbLNodeData( int nid
, int pnid
, int firstCore
, int lastCore
, int processors
, int roles );
bool SaveDbPNodeData( const char *name
, int pnid
, int excludedFirstCore
, int excludedLastCore );
bool UpdateDbPNodeData( int pnid
, const char *name
, int excludedFirstCore
, int excludedLastCore );
void UpdatePNodeConfiguration( int pnid
, const char *name
, const char *domain
, int excludedFirstCore
, int excludedLastCore );
};
#endif /* CLUSTERCONF_H_ */
|
/* Synchronet Control Panel (GUI Borland C++ Builder Project for Win32) */
/* $Id: SpyFormUnit.h,v 1.9 2003/05/10 03:15:40 rswindell Exp $ */
/****************************************************************************
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2003 Rob Swindell - http://www.synchro.net/copyright.html *
* *
* 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. *
* See the GNU General Public License for more details: gpl.txt or *
* http://www.fsf.org/copyleft/gpl.html *
* *
* Anonymous FTP access to the most recent released source is available at *
* ftp://vert.synchro.net, ftp://cvs.synchro.net and ftp://ftp.synchro.net *
* *
* Anonymous CVS access to the development source and modification history *
* is available at cvs.synchro.net:/cvsroot/sbbs, example: *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs login *
* (just hit return, no password is necessary) *
* cvs -d :pserver:anonymous@cvs.synchro.net:/cvsroot/sbbs checkout src *
* *
* For Synchronet coding style and modification guidelines, see *
* http://www.synchro.net/source.html *
* *
* You are encouraged to submit any modifications (preferably in Unix diff *
* format) via e-mail to mods@synchro.net *
* *
* Note: If this box doesn't appear square, then you need to fix your tabs. *
****************************************************************************/
#ifndef SpyFormUnitH
#define SpyFormUnitH
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <ExtCtrls.hpp>
#include "ringbuf.h"
#include "emulvt.hpp"
#include <ComCtrls.hpp>
#include <Dialogs.hpp>
#include <ImgList.hpp>
#include <ToolWin.hpp>
#include <Menus.hpp>
#include <ActnList.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TSpyForm : public TForm
{
__published: // IDE-managed Components
TTimer *Timer;
TImageList *ImageList;
TPopupMenu *PopupMenu;
TMenuItem *KeyboardActivePopupMenuItem;
TActionList *ActionList;
TAction *KeyboardActive;
TAction *ChangeFont;
TMenuItem *FontPopupMenuItem;
TPanel *ToolBar;
TSpeedButton *FontButton;
TCheckBox *KeyboardActiveCheckBox;
void __fastcall SpyTimerTick(TObject *Sender);
void __fastcall FormShow(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
void __fastcall ChangeFontClick(TObject *Sender);
void __fastcall FormKeyPress(TObject *Sender, char &Key);
void __fastcall KeyboardActiveClick(TObject *Sender);
void __fastcall FormMouseUp(TObject *Sender, TMouseButton Button,
TShiftState Shift, int X, int Y);
private: // User declarations
int __fastcall strip_telnet(uchar *buf, int len);
public: // User declarations
TEmulVT* Terminal;
RingBuf** inbuf;
RingBuf** outbuf;
__fastcall TSpyForm(TComponent* Owner);
__fastcall ~TSpyForm();
};
//---------------------------------------------------------------------------
extern PACKAGE TSpyForm *SpyForms[];
//---------------------------------------------------------------------------
#endif
|
#ifndef __UITEXT_H__
#define __UITEXT_H__
#pragma once
namespace DuiLib
{
class UILIB_API CTextUI : public CLabelUI
{
public:
CTextUI();
~CTextUI();
LPCTSTR GetClass() const;
UINT GetControlFlags() const;
LPVOID GetInterface(LPCTSTR pstrName);
void SetText(LPCTSTR pstrText) override;
CDuiString* GetLinkContent(int iIndex);
void DoEvent(TEventUI& event);
SIZE EstimateSize(SIZE szAvailable);
void SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue);
void SetShadowColor(DWORD dwTextColor);
DWORD GetShadowColor() const;
void PaintText(HDC hDC);
protected:
enum { MAX_LINK = 8 };
int m_nLinks;
RECT m_rcLinks[MAX_LINK];
CDuiString m_sLinks[MAX_LINK];
int m_nHoverLink;
DWORD m_dwShadowColor;
};
} // namespace DuiLib
#endif //__UITEXT_H__ |
#include "emous_priv.h"
#include "emous_type.eo.x" |
/*-
* Test 0070: Check boundary conditions (BPF_LD+BPF_B+BPF_IND)
*
* $FreeBSD: soc2013/dpl/head/tools/regression/bpf/bpf_filter/tests/test0070.h 182436 2008-08-28 18:38:55Z jkim $
*/
/* BPF program */
struct bpf_insn pc[] = {
BPF_STMT(BPF_LD+BPF_IMM, 0xdeadc0de),
BPF_STMT(BPF_LDX+BPF_IMM, 1),
BPF_STMT(BPF_LD+BPF_B+BPF_IND, 0),
BPF_STMT(BPF_RET+BPF_A, 0),
};
/* Packet */
u_char pkt[] = {
0x01, 0x23, 0x45,
};
/* Packet length seen on wire */
u_int wirelen = sizeof(pkt);
/* Packet length passed on buffer */
u_int buflen = 0;
/* Invalid instruction */
int invalid = 0;
/* Expected return value */
u_int expect = 0;
/* Expected signal */
int expect_signal = 0;
|
/**
* hdr_writer_reader_phaser.h
* Written by Michael Barker and released to the public domain,
* as explained at http://creativecommons.org/publicdomain/zero/1.0/
*/
#ifndef HDR_WRITER_READER_PHASER_H
#define HDR_WRITER_READER_PHASER_H 1
#include <stdlib.h>
#include <stdbool.h>
#include <stdlib.h>
#include <errno.h>
#include "hdr_thread.h"
HDR_ALIGN_PREFIX(8)
struct hdr_writer_reader_phaser
{
int64_t start_epoch;
int64_t even_end_epoch;
int64_t odd_end_epoch;
hdr_mutex* reader_mutex;
}
HDR_ALIGN_SUFFIX(8);
#ifdef __cplusplus
extern "C" {
#endif
int hdr_writer_reader_phaser_init(struct hdr_writer_reader_phaser* p);
void hdr_writer_reader_phaser_destory(struct hdr_writer_reader_phaser* p);
int64_t hdr_phaser_writer_enter(struct hdr_writer_reader_phaser* p);
void hdr_phaser_writer_exit(
struct hdr_writer_reader_phaser* p, int64_t critical_value_at_enter);
void hdr_phaser_reader_lock(struct hdr_writer_reader_phaser* p);
void hdr_phaser_reader_unlock(struct hdr_writer_reader_phaser* p);
void hdr_phaser_flip_phase(
struct hdr_writer_reader_phaser* p, int64_t sleep_time_ns);
#ifdef __cplusplus
}
#endif
#endif
|
/* $NetBSD: netconfig.h,v 1.1 2000/06/02 22:57:54 fvdl Exp $ */
/* $FreeBSD: soc2013/dpl/head/sys/rpc/netconfig.h 177676 2008-03-26 15:23:12Z dfr $ */
#ifndef _NETCONFIG_H_
#define _NETCONFIG_H_
#include <sys/cdefs.h>
#define NETCONFIG "/etc/netconfig"
#define NETPATH "NETPATH"
struct netconfig {
char *nc_netid; /* Network ID */
unsigned long nc_semantics; /* Semantics (see below) */
unsigned long nc_flag; /* Flags (see below) */
char *nc_protofmly; /* Protocol family */
char *nc_proto; /* Protocol name */
char *nc_device; /* Network device pathname */
unsigned long nc_nlookups; /* Number of directory lookup libs */
char **nc_lookups; /* Names of the libraries */
unsigned long nc_unused[9]; /* reserved */
};
typedef struct {
struct netconfig **nc_head;
struct netconfig **nc_curr;
} NCONF_HANDLE;
/*
* nc_semantics values
*/
#define NC_TPI_CLTS 1
#define NC_TPI_COTS 2
#define NC_TPI_COTS_ORD 3
#define NC_TPI_RAW 4
/*
* nc_flag values
*/
#define NC_NOFLAG 0x00
#define NC_VISIBLE 0x01
#define NC_BROADCAST 0x02
/*
* nc_protofmly values
*/
#define NC_NOPROTOFMLY "-"
#define NC_LOOPBACK "loopback"
#define NC_INET "inet"
#define NC_INET6 "inet6"
#define NC_IMPLINK "implink"
#define NC_PUP "pup"
#define NC_CHAOS "chaos"
#define NC_NS "ns"
#define NC_NBS "nbs"
#define NC_ECMA "ecma"
#define NC_DATAKIT "datakit"
#define NC_CCITT "ccitt"
#define NC_SNA "sna"
#define NC_DECNET "decnet"
#define NC_DLI "dli"
#define NC_LAT "lat"
#define NC_HYLINK "hylink"
#define NC_APPLETALK "appletalk"
#define NC_NIT "nit"
#define NC_IEEE802 "ieee802"
#define NC_OSI "osi"
#define NC_X25 "x25"
#define NC_OSINET "osinet"
#define NC_GOSIP "gosip"
/*
* nc_proto values
*/
#define NC_NOPROTO "-"
#define NC_TCP "tcp"
#define NC_UDP "udp"
#define NC_ICMP "icmp"
__BEGIN_DECLS
void *setnetconfig(void);
struct netconfig *getnetconfig(void *);
struct netconfig *getnetconfigent(const char *);
void freenetconfigent(struct netconfig *);
int endnetconfig(void *);
#ifndef _KERNEL
void *setnetpath(void);
struct netconfig *getnetpath(void *);
int endnetpath(void *);
void nc_perror(const char *);
char *nc_sperror(void);
#endif
__END_DECLS
#endif /* _NETCONFIG_H_ */
|
/*
* Copyright (C) 1999 Lars Knoll (knoll@kde.org)
* (C) 1999 Antti Koivisto (koivisto@kde.org)
* (C) 2000 Dirk Mueller (mueller@kde.org)
* Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef HTMLFormElement_h
#define HTMLFormElement_h
#include "CheckedRadioButtons.h"
#include "FormState.h"
#include "FormSubmission.h"
#include "HTMLElement.h"
#include <wtf/OwnPtr.h>
namespace WebCore {
class Event;
class FormAssociatedElement;
class FormData;
class HTMLFormControlElement;
class HTMLImageElement;
class HTMLInputElement;
class HTMLFormCollection;
class TextEncoding;
struct CollectionCache;
class HTMLFormElement : public HTMLElement {
public:
static PassRefPtr<HTMLFormElement> create(Document*);
static PassRefPtr<HTMLFormElement> create(const QualifiedName&, Document*);
virtual ~HTMLFormElement();
PassRefPtr<HTMLCollection> elements();
void getNamedElements(const AtomicString&, Vector<RefPtr<Node> >&);
unsigned length() const;
Node* item(unsigned index);
String enctype() const { return m_attributes.encodingType(); }
void setEnctype(const String&);
String encoding() const { return m_attributes.encodingType(); }
void setEncoding(const String& value) { setEnctype(value); }
bool shouldAutocomplete() const;
// FIXME: Should rename these two functions to say "form control" or "form-associated element" instead of "form element".
void registerFormElement(FormAssociatedElement*);
void removeFormElement(FormAssociatedElement*);
void registerImgElement(HTMLImageElement*);
void removeImgElement(HTMLImageElement*);
bool prepareForSubmission(Event*);
void submit();
void submitFromJavaScript();
void reset();
// Used to indicate a malformed state to keep from applying the bottom margin of the form.
// FIXME: Would probably be better to call this wasUnclosed; that's more specific.
void setMalformed(bool malformed) { m_wasMalformed = malformed; }
bool isMalformed() const { return m_wasMalformed; }
void setDemoted(bool demoted) { m_wasDemoted = demoted; }
void submitImplicitly(Event*, bool fromImplicitSubmissionTrigger);
bool formWouldHaveSecureSubmission(const String& url);
String name() const;
bool noValidate() const;
String acceptCharset() const { return m_attributes.acceptCharset(); }
void setAcceptCharset(const String&);
String action() const;
void setAction(const String&);
String method() const;
void setMethod(const String&);
virtual String target() const;
bool wasUserSubmitted() const;
HTMLFormControlElement* defaultButton() const;
bool checkValidity();
HTMLFormControlElement* elementForAlias(const AtomicString&);
void addElementAlias(HTMLFormControlElement*, const AtomicString& alias);
CheckedRadioButtons& checkedRadioButtons() { return m_checkedRadioButtons; }
const Vector<FormAssociatedElement*>& associatedElements() const { return m_associatedElements; }
private:
HTMLFormElement(const QualifiedName&, Document*);
virtual bool rendererIsNeeded(const NodeRenderingContext&);
virtual void insertedIntoDocument();
virtual void removedFromDocument();
virtual void handleLocalEvents(Event*);
virtual void parseMappedAttribute(Attribute*);
virtual bool isURLAttribute(Attribute*) const;
virtual void documentDidBecomeActive();
virtual void willMoveToNewOwnerDocument();
virtual void didMoveToNewOwnerDocument();
void submit(Event*, bool activateSubmitButton, bool processingUserGesture, FormSubmissionTrigger);
unsigned formElementIndexWithFormAttribute(Element*);
unsigned formElementIndex(FormAssociatedElement*);
// Returns true if the submission should proceed.
bool validateInteractively(Event*);
// Validates each of the controls, and stores controls of which 'invalid'
// event was not canceled to the specified vector. Returns true if there
// are any invalid controls in this form.
bool checkInvalidControlsAndCollectUnhandled(Vector<RefPtr<FormAssociatedElement> >&);
friend class HTMLFormCollection;
typedef HashMap<RefPtr<AtomicStringImpl>, RefPtr<HTMLFormControlElement> > AliasMap;
FormSubmission::Attributes m_attributes;
OwnPtr<AliasMap> m_elementAliases;
OwnPtr<CollectionCache> m_collectionCache;
CheckedRadioButtons m_checkedRadioButtons;
unsigned m_associatedElementsBeforeIndex;
unsigned m_associatedElementsAfterIndex;
Vector<FormAssociatedElement*> m_associatedElements;
Vector<HTMLImageElement*> m_imageElements;
bool m_wasUserSubmitted;
bool m_isSubmittingOrPreparingForSubmission;
bool m_shouldSubmit;
bool m_isInResetFunction;
bool m_wasMalformed;
bool m_wasDemoted;
AtomicString m_name;
};
} // namespace WebCore
#endif // HTMLFormElement_h
|
/*
FreeRTOS V7.6.0 - Copyright (C) 2013 Real Time Engineers Ltd.
All rights reserved
VISIT http://www.FreeRTOS.org TO ENSURE YOU ARE USING THE LATEST VERSION.
***************************************************************************
* *
* FreeRTOS provides completely free yet professionally developed, *
* robust, strictly quality controlled, supported, and cross *
* platform software that has become a de facto standard. *
* *
* Help yourself get started quickly and support the FreeRTOS *
* project by purchasing a FreeRTOS tutorial book, reference *
* manual, or both from: http://www.FreeRTOS.org/Documentation *
* *
* Thank you! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS 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 >>!AND MODIFIED BY!<< the FreeRTOS exception.
>>! NOTE: The modification to the GPL is included to allow you to distribute
>>! a combined work that includes FreeRTOS without being obliged to provide
>>! the source code for proprietary components outside of the FreeRTOS
>>! kernel.
FreeRTOS 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. Full license text is available from the following
link: http://www.freertos.org/a00114.html
1 tab == 4 spaces!
***************************************************************************
* *
* Having a problem? Start by reading the FAQ "My application does *
* not run, what could be wrong?" *
* *
* http://www.FreeRTOS.org/FAQHelp.html *
* *
***************************************************************************
http://www.FreeRTOS.org - Documentation, books, training, latest versions,
license and Real Time Engineers Ltd. contact details.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool, a DOS
compatible FAT file system, and our tiny thread aware UDP/IP stack.
http://www.OpenRTOS.com - Real Time Engineers ltd license FreeRTOS to High
Integrity Systems to sell under the OpenRTOS brand. Low cost OpenRTOS
licenses offer ticketed support, indemnification and middleware.
http://www.SafeRTOS.com - High Integrity Systems also provide a safety
engineered and independently SIL3 certified version for use in safety and
mission critical applications that require provable dependability.
1 tab == 4 spaces!
*/
/* Scheduler include files. */
#include "FreeRTOS.h"
#include "portable.h"
/* Processor Expert created headers. */
#include "byte1.h"
/* Demo application include files. */
#include "partest.h"
/*-----------------------------------------------------------
* Simple parallel port IO routines.
*-----------------------------------------------------------*/
void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )
{
/* This function is required as it is called from the standard demo
application files. All it does however is call the Processor Expert
created function. */
portENTER_CRITICAL();
Byte1_PutBit( uxLED, !xValue );
portEXIT_CRITICAL();
}
/*-----------------------------------------------------------*/
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )
{
/* This function is required as it is called from the standard demo
application files. All it does however is call the processor Expert
created function. */
portENTER_CRITICAL();
Byte1_NegBit( uxLED );
portEXIT_CRITICAL();
}
|
/*++
Copyright (c) 2006, 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:
AcpiMetronome.h
Abstract:
Driver implementing the EFI 2.0 metronome protocol using the ACPI timer.
--*/
#ifndef _ACPI_METRONOME_H
#define _ACPI_METRONOME_H
//
// Statements that include other files
//
#include "Tiano.h"
#include "EfiDriverLib.h"
#include "EfiHobLib.h"
//
// Driver Consumes GUIDs
//
#include EFI_GUID_DEFINITION (Hob)
#include EFI_GUID_DEFINITION (AcpiDescription)
//
// Consumed protocols
//
#include EFI_PROTOCOL_DEPENDENCY (CpuIo)
//
// Produced protocols
//
#include EFI_ARCH_PROTOCOL_PRODUCER (Metronome)
//
// Private definitions
//
#define TICK_PERIOD 300 // 30 uS
//
// 8254 counter initialization definitions
//
#define TIMER1_CONTROL_PORT 0x43
#define TIMER1_COUNT_PORT 0x41
#define LOAD_COUNTER1_LSB 0x54
#define COUNTER1_COUNT 0x12
//
// Function Prototypes
//
EFI_STATUS
EFIAPI
WaitForTick (
IN EFI_METRONOME_ARCH_PROTOCOL *This,
IN UINT32 TickNumber
)
/*++
Routine Description:
Waits for the TickNumber of ticks from a known platform time source.
Arguments:
This Pointer to the protocol instance.
TickNumber Tick Number to be waited
Returns:
EFI_SUCCESS If number of ticks occurred.
EFI_NOT_FOUND Could not locate CPU IO protocol
--*/
;
UINT32
GetAcpiTick (
VOID
)
/*++
Routine Description:
Get the current ACPI counter's value
Arguments:
None
Returns:
The value of the counter
--*/
;
VOID
WriteIo8 (
UINT16 Port,
UINT8 Data
)
/*++
Routine Description:
Write an 8 bit value to an I/O port
Arguments:
Port - IO Port
Data - Data in IO Port
Returns:
None.
--*/
;
#endif
|
/* Copyright (c) 2006, Jan Flora <janflora@diku.dk>
* 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 the University of Copenhagen 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 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.
*/
/*
@author Jan Flora <janflora@diku.dk>
*/
#if DBG_LEVEL && DBG_LEVEL > 0
#ifndef DBG_MIN_LEVEL
#define DBG_MIN_LEVEL 1
#endif
#define DBG_STR(str,lvl) \
if (DBG_LEVEL >= lvl && lvl >= DBG_MIN_LEVEL) {\
call Debug.debugStr(str,lvl);\
}
#define DBG_STR_CLEAN(str,lvl) \
if (DBG_LEVEL >= lvl && lvl >= DBG_MIN_LEVEL) {\
call Debug.debugStrClean(str);\
}
#define DBG_INT(int,lvl) \
if (DBG_LEVEL >= lvl && lvl >= DBG_MIN_LEVEL) {\
call Debug.debugInt(((uint8_t*)&int),sizeof(int),lvl);\
}
#define DBG_INT_CLEAN(int,lvl) \
if (DBG_LEVEL >= lvl && lvl >= DBG_MIN_LEVEL) {\
call Debug.debugIntClean(((uint8_t*)&int),sizeof(int));\
}
#define DBG_STRINT(str,int,lvl) \
if (DBG_LEVEL >= lvl && lvl >= DBG_MIN_LEVEL) {\
call Debug.debugStrInt(str,((uint8_t*)&int),sizeof(int),lvl);\
}
#define DBG_DUMP(dmp,len,lvl) \
if (DBG_LEVEL >= lvl && lvl >= DBG_MIN_LEVEL) {\
call Debug.debugInt(dmp,len,lvl);\
}
#else
#define DBG_STR(str,lvl)
#define DBG_INT(int,lvl)
#define DBG_STR_CLEAN(str,lvl)
#define DBG_INT_CLEAN(int,lvl)
#define DBG_STRINT(str,int,lvl)
#define DBG_DUMP(dmp,len,lvl)
#endif
#define DBG_STR_TMP(str) call Debug.debugStr(str,0)
#define DBG_INT_TMP(int) call Debug.debugInt(((uint8_t*)&int),sizeof(int),0)
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE126_Buffer_Overread__CWE129_fscanf_53c.c
Label Definition File: CWE126_Buffer_Overread__CWE129.label.xml
Template File: sources-sinks-53c.tmpl.c
*/
/*
* @description
* CWE: 126 Buffer Overread
* BadSource: fscanf Read data from the console using fscanf()
* GoodSource: Larger than zero but less than 10
* Sinks:
* GoodSink: Ensure the array index is valid
* BadSink : Improperly check the array index by not checking the upper bound
* Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fourth; all four functions are in different source files
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
/* bad function declaration */
void CWE126_Buffer_Overread__CWE129_fscanf_53d_badSink(int data);
void CWE126_Buffer_Overread__CWE129_fscanf_53c_badSink(int data)
{
CWE126_Buffer_Overread__CWE129_fscanf_53d_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE126_Buffer_Overread__CWE129_fscanf_53d_goodG2BSink(int data);
void CWE126_Buffer_Overread__CWE129_fscanf_53c_goodG2BSink(int data)
{
CWE126_Buffer_Overread__CWE129_fscanf_53d_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE126_Buffer_Overread__CWE129_fscanf_53d_goodB2GSink(int data);
void CWE126_Buffer_Overread__CWE129_fscanf_53c_goodB2GSink(int data)
{
CWE126_Buffer_Overread__CWE129_fscanf_53d_goodB2GSink(data);
}
#endif /* OMITGOOD */
|
#ifndef TRITONSORT_RESOURCE_QUEUE_H
#define TRITONSORT_RESOURCE_QUEUE_H
#include <list>
#include <stdint.h>
#include <string.h>
#include "core/Resource.h"
#include "core/TritonSortAssert.h"
/**
A fixed-size FIFO queue that supports efficient bulk pushes
*/
class ResourceQueue {
public:
/// Constructor
/**
\param cap the queue's capacity
*/
ResourceQueue(uint64_t cap) {
curSize = 0;
frontOffset = 0;
backOffset = 0;
capacity = cap;
resources = new Resource*[capacity];
memset(resources, 0, sizeof(Resource*) * capacity);
}
/// Destructor
virtual ~ResourceQueue() {
if (resources != NULL) {
delete[] resources;
}
}
/// Is the queue empty?
/**
\return if the queue is empty or not
*/
inline bool empty() const {
return curSize == 0;
}
/// Is the queue full?
/**
\return if the queue is full or not
*/
inline bool full() const {
return curSize == capacity;
}
/// Get the size of the queue
/**
\return the size of the queue
*/
inline uint64_t size() const {
return curSize;
}
/// Push an element onto the back of the queue
/**
\param x the element to push
*/
inline void push(Resource* x) {
TRITONSORT_ASSERT(curSize < capacity, "Tried to push into a full pool");
resources[backOffset] = x;
backOffset = (backOffset + 1) % capacity;
curSize++;
}
/// Pop an element from the front of the queue
/**
\warning Must check if the pool is empty with ResourceQueue::empty before
popping.
*/
inline void pop() {
TRITONSORT_ASSERT(curSize > 0, "Tried to pop from an empty pool");
resources[frontOffset] = NULL;
frontOffset = (frontOffset + 1) % capacity;
curSize--;
if (curSize == 0) {
frontOffset = 0;
backOffset = 0;
}
}
/// Get the element at the front of the queue
/**
\warning Must check if the queue is empty with ResourceQueue::empty before
calling.
\return the element at the front of the queue
*/
inline Resource* front() {
return resources[frontOffset];
}
/// Get the capacity of the queue
/**
\return the capacity of the queue
*/
inline uint64_t getCapacity() const {
return capacity;
}
/// Push a number of elements from the front of another queue onto the back
/// of this queue efficiently
/**
This method assumes (and, if assertions are enabled, asserts) that there
is enough space in the queue to accomodate the elements to be pushed.
\param otherQueue the queue from which to retrieve elements
\param numElements the number of elements to retrieve
*/
inline void stealFrom(ResourceQueue& otherQueue, uint64_t numElements) {
if (numElements == 0) {
return;
}
ResourceQueue& other = otherQueue;
uint64_t amtLeftToCopy = numElements;
TRITONSORT_ASSERT(numElements <= other.curSize,
"Trying to copy more elements than the source pool has");
TRITONSORT_ASSERT(amtLeftToCopy + curSize <= capacity, "Not enough space left in "
"dest. pool (%llu) to copy %llu elements", capacity - curSize,
amtLeftToCopy);
while (amtLeftToCopy > 0) {
uint64_t destCellsFree = 0;
if (frontOffset > backOffset) {
destCellsFree = frontOffset - backOffset;
} else if (frontOffset == backOffset) {
if (curSize == 0) {
destCellsFree = capacity;
} else {
ABORT("Previous assertions should have caught this");
}
} else {
destCellsFree = capacity - backOffset;
}
destCellsFree = std::min<uint64_t>(destCellsFree, amtLeftToCopy);
uint64_t srcCellsBeforeEnd = 0;
if (other.frontOffset >= other.backOffset) {
TRITONSORT_ASSERT(other.curSize > 0,
"Previous assertions should have caught this");
srcCellsBeforeEnd = other.capacity - other.frontOffset;
} else {
srcCellsBeforeEnd = other.backOffset - other.frontOffset;
}
srcCellsBeforeEnd = std::min<uint64_t>(srcCellsBeforeEnd, amtLeftToCopy);
uint64_t cellsToCopy = std::min<uint64_t>(srcCellsBeforeEnd,
destCellsFree);
TRITONSORT_ASSERT(cellsToCopy > 0, "Somehow decided that you need to copy zero "
"cells");
memcpy(resources + backOffset, other.resources + other.frontOffset,
cellsToCopy * sizeof(Resource*));
memset(other.resources + other.frontOffset, 0,
cellsToCopy * sizeof(Resource*));
other.frontOffset = (other.frontOffset + cellsToCopy) % other.capacity;
backOffset = (backOffset + cellsToCopy) % capacity;
amtLeftToCopy -= cellsToCopy;
other.curSize -= cellsToCopy;
curSize += cellsToCopy;
}
if (other.curSize == 0) {
other.frontOffset = 0;
other.backOffset = 0;
}
}
private:
Resource** resources;
// Offset in the resources array that points to the front of the queue
uint64_t frontOffset;
// Offset in the resources array that points to the element after the back of
// the queue
uint64_t backOffset;
uint64_t curSize;
uint64_t capacity;
};
#endif // TRITONSORT_RESOURCE_QUEUE_H
|
//////////////////////////////////////////////////////////////////
// (c) Copyright 2009- by Jeremy McMinis and Jeongnim Kim
//////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////
// Jeongnim Kim
// National Center for Supercomputing Applications &
// Materials Computation Center
// University of Illinois, Urbana-Champaign
// Urbana, IL 61801
// e-mail: jnkim@ncsa.uiuc.edu
//
// Supported by
// National Center for Supercomputing Applications, UIUC
// Materials Computation Center, UIUC
//////////////////////////////////////////////////////////////////
// -*- C++ -*-
#ifndef QMCPLUSPLUS_FWOMP_ANALYSIS_H
#define QMCPLUSPLUS_FWOMP_ANALYSIS_H
#include "QMCDrivers/QMCDriver.h"
#include "QMCDrivers/CloneManager.h"
#include "QMCDrivers/ForwardWalking/HDF5_FW.h"
namespace qmcplusplus
{
class QMCUpdateBase;
/** @ingroup QMCDrivers PbyP
*@brief Implements the VMC algorithm using particle-by-particle move.
*/
class FWSingleOMP: public QMCDriver , public CloneManager
{
public:
/// Constructor.
FWSingleOMP(MCWalkerConfiguration& w, TrialWaveFunction& psi, QMCHamiltonian& h,
HamiltonianPool& hpool,WaveFunctionPool& ppool);
bool run();
bool put(xmlNodePtr cur);
private:
FWSingleOMP(const FWSingleOMP& a): QMCDriver(a), CloneManager(a) { }
/// Copy operator (disabled).
FWSingleOMP& operator=(const FWSingleOMP&)
{
return *this;
}
//main drivers
void FWOneStep();
void transferParentsOneGeneration();
//helper functions
void fillIDMatrix();
void resetWeights();
int getNumberOfSamples(int omittedSteps);
//debugging functions
void printIDs(vector<long> vi);
void printInts(vector<int> vi);
string xmlrootName;
stringstream fname;
int doWeights, doObservables, doDat;
int weightFreq, weightLength, numSteps;
vector<int> walkersPerBlock;
vector<int> pointsToCalculate;
vector<vector<int> > Weights;
vector<vector<long> > IDs, PIDs, realPIDs, realIDs;
HDF5_FW_float hdf_float_data;
HDF5_FW_long hdf_ID_data,hdf_PID_data;
HDF5_FW_observables hdf_OBS_data;
HDF5_FW_weights hdf_WGT_data;
hid_t c_file;
string WIDstring,PIDstring;
int verbose,startStep;
int gensTransferred;
};
}
#endif
/***************************************************************************
* $RCSfile: VMCSingle.h,v $ $Author: jnkim $
* $Revision: 1.5 $ $Date: 2006/07/17 14:29:40 $
* $Id: VMCSingle.h,v 1.5 2006/07/17 14:29:40 jnkim Exp $
***************************************************************************/
|
/* libFLAC - Free Lossless Audio Codec library
* Copyright (C) 2004-2009 Josh Coalson
* Copyright (C) 2011-2013 Xiph.Org Foundation
*
* 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 the Xiph.org Foundation 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 FOUNDATION 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 FLAC__PRIVATE__FLOAT_H
#define FLAC__PRIVATE__FLOAT_H
#include "FLAC/config.h"
#include "FLAC/ordinals.h"
/*
* These typedefs make it easier to ensure that integer versions of
* the library really only contain integer operations. All the code
* in libFLAC should use FLAC__float and FLAC__double in place of
* float and double, and be protected by checks of the macro
* FLAC__INTEGER_ONLY_LIBRARY.
*
* FLAC__real is the basic floating point type used in LPC analysis.
*/
#ifndef FLAC__INTEGER_ONLY_LIBRARY
typedef double FLAC__double;
typedef float FLAC__float;
/*
* WATCHOUT: changing FLAC__real will change the signatures of many
* functions that have assembly language equivalents and break them.
*/
typedef float FLAC__real;
#else
/*
* The convention for FLAC__fixedpoint is to use the upper 16 bits
* for the integer part and lower 16 bits for the fractional part.
*/
typedef FLAC__int32 FLAC__fixedpoint;
extern const FLAC__fixedpoint FLAC__FP_ZERO;
extern const FLAC__fixedpoint FLAC__FP_ONE_HALF;
extern const FLAC__fixedpoint FLAC__FP_ONE;
extern const FLAC__fixedpoint FLAC__FP_LN2;
extern const FLAC__fixedpoint FLAC__FP_E;
#define FLAC__fixedpoint_trunc(x) ((x)>>16)
#define FLAC__fixedpoint_mul(x, y) ( (FLAC__fixedpoint) ( ((FLAC__int64)(x)*(FLAC__int64)(y)) >> 16 ) )
#define FLAC__fixedpoint_div(x, y) ( (FLAC__fixedpoint) ( ( ((FLAC__int64)(x)<<32) / (FLAC__int64)(y) ) >> 16 ) )
/*
* FLAC__fixedpoint_log2()
* --------------------------------------------------------------------
* Returns the base-2 logarithm of the fixed-point number 'x' using an
* algorithm by Knuth for x >= 1.0
*
* 'fracbits' is the number of fractional bits of 'x'. 'fracbits' must
* be < 32 and evenly divisible by 4 (0 is OK but not very precise).
*
* 'precision' roughly limits the number of iterations that are done;
* use (unsigned)(-1) for maximum precision.
*
* If 'x' is less than one -- that is, x < (1<<fracbits) -- then this
* function will punt and return 0.
*
* The return value will also have 'fracbits' fractional bits.
*/
FLAC__uint32 FLAC__fixedpoint_log2(FLAC__uint32 x, unsigned fracbits, unsigned precision);
#endif
#endif
|
/*
* Copyright (c) 2013 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "native_client/src/trusted/service_runtime/nacl_runtime_host_interface.h"
#include "native_client/src/shared/platform/nacl_log.h"
#include "native_client/src/trusted/desc/nacl_desc_base.h"
#include "native_client/src/trusted/service_runtime/include/sys/errno.h"
int NaClRuntimeHostInterfaceCtor_protected(
struct NaClRuntimeHostInterface *self) {
NaClLog(4, "Entered NaClRuntimeHostInterfaceCtor_protected\n");
if (!NaClRefCountCtor((struct NaClRefCount *) self)) {
NaClLog(4,
"NaClRuntimeHostInterfaceCtor_protected: "
"NaClRefCountCtor base class ctor failed\n");
return 0;
}
NACL_VTBL(NaClRefCount, self) =
(struct NaClRefCountVtbl const *) &kNaClRuntimeHostInterfaceVtbl;
NaClLog(4,
"Leaving NaClRuntimeHostInterfaceCtor_protected, returning 1\n");
return 1;
}
void NaClRuntimeHostInterfaceDtor(struct NaClRefCount *vself) {
struct NaClRuntimeHostInterface *self =
(struct NaClRuntimeHostInterface *) vself;
NACL_VTBL(NaClRefCount, self) = &kNaClRefCountVtbl;
(*NACL_VTBL(NaClRefCount, self)->Dtor)(vself);
}
int NaClRuntimeHostInterfaceStartupInitializationCompleteNotImplemented(
struct NaClRuntimeHostInterface *self) {
NaClLog(LOG_ERROR,
("NaClRuntimeHostInterfaceStartupInitializationComplete(0x%08"
NACL_PRIxPTR")\n"),
(uintptr_t) self);
return -NACL_ABI_EINVAL;
}
int NaClRuntimeHostInterfaceReportExitStatusNotImplemented(
struct NaClRuntimeHostInterface *self,
int exit_status) {
NaClLog(LOG_ERROR,
("NaClRuntimeHostInterfaceReportExitStatus(0x%08"NACL_PRIxPTR
", 0x%x)\n"),
(uintptr_t) self, exit_status);
return -NACL_ABI_EINVAL;
}
ssize_t NaClRuntimeHostInterfacePostMessageNotImplemented(
struct NaClRuntimeHostInterface *self,
char const *message,
size_t message_bytes) {
NaClLog(LOG_ERROR,
("NaClRuntimeHostInterfaceDoPostMessage(0x%08"NACL_PRIxPTR", %s"
", %08"NACL_PRIdS")\n"),
(uintptr_t) self, message, message_bytes);
return -NACL_ABI_EINVAL;
}
int NaClRuntimeHostInterfaceCreateProcessNotImplemented(
struct NaClRuntimeHostInterface *self,
struct NaClDesc **out_sock_addr,
struct NaClDesc **out_app_addr) {
NaClLog(3,
("NaClRuntimeHostInterfaceCreateProcess(0x%08"NACL_PRIxPTR
", 0x%08"NACL_PRIxPTR", 0x%08"NACL_PRIxPTR")\n"),
(uintptr_t) self,
(uintptr_t) out_sock_addr,
(uintptr_t) out_app_addr);
return -NACL_ABI_EINVAL;
}
struct NaClRuntimeHostInterfaceVtbl const kNaClRuntimeHostInterfaceVtbl = {
{
NaClRuntimeHostInterfaceDtor,
},
NaClRuntimeHostInterfaceStartupInitializationCompleteNotImplemented,
NaClRuntimeHostInterfaceReportExitStatusNotImplemented,
NaClRuntimeHostInterfacePostMessageNotImplemented,
NaClRuntimeHostInterfaceCreateProcessNotImplemented,
};
|
/*
* Copyright (C) 2005 Frerich Raabe <raabe@kde.org>
* Copyright (C) 2006, 2009 Apple Inc. All rights reserved.
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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 XPathResult_h
#define XPathResult_h
#include "bindings/core/v8/ScriptWrappable.h"
#include "core/xml/XPathValue.h"
#include "platform/heap/Handle.h"
#include "wtf/Forward.h"
#include "wtf/RefCounted.h"
namespace blink {
class Document;
class ExceptionState;
class Node;
namespace XPath {
struct EvaluationContext;
}
class XPathResult final : public RefCountedWillBeGarbageCollected<XPathResult>, public ScriptWrappable {
DECLARE_EMPTY_DESTRUCTOR_WILL_BE_REMOVED(XPathResult);
DEFINE_WRAPPERTYPEINFO();
public:
enum XPathResultType {
ANY_TYPE = 0,
NUMBER_TYPE = 1,
STRING_TYPE = 2,
BOOLEAN_TYPE = 3,
UNORDERED_NODE_ITERATOR_TYPE = 4,
ORDERED_NODE_ITERATOR_TYPE = 5,
UNORDERED_NODE_SNAPSHOT_TYPE = 6,
ORDERED_NODE_SNAPSHOT_TYPE = 7,
ANY_UNORDERED_NODE_TYPE = 8,
FIRST_ORDERED_NODE_TYPE = 9
};
static PassRefPtrWillBeRawPtr<XPathResult> create(XPath::EvaluationContext& context, const XPath::Value& value)
{
return adoptRefWillBeNoop(new XPathResult(context, value));
}
void convertTo(unsigned short type, ExceptionState&);
unsigned short resultType() const;
double numberValue(ExceptionState&) const;
String stringValue(ExceptionState&) const;
bool booleanValue(ExceptionState&) const;
Node* singleNodeValue(ExceptionState&) const;
bool invalidIteratorState() const;
unsigned long snapshotLength(ExceptionState&) const;
Node* iterateNext(ExceptionState&);
Node* snapshotItem(unsigned long index, ExceptionState&);
const XPath::Value& value() const { return m_value; }
void trace(Visitor*);
private:
XPathResult(XPath::EvaluationContext&, const XPath::Value&);
XPath::NodeSet& nodeSet() { return *m_nodeSet; }
XPath::Value m_value;
unsigned m_nodeSetPosition;
OwnPtrWillBeMember<XPath::NodeSet> m_nodeSet; // FIXME: why duplicate the node set stored in m_value?
unsigned short m_resultType;
RefPtrWillBeMember<Document> m_document;
uint64_t m_domTreeVersion;
};
} // namespace blink
#endif // XPathResult_h
|
#ifndef UTIL_LCMUTIL_H_
#define UTIL_LCMUTIL_H_
#include <Eigen/Core>
#include <iostream>
#include "drake/systems/trajectories/PiecewisePolynomial.h"
#include "lcmtypes/drake/lcmt_polynomial.hpp"
#include "lcmtypes/drake/lcmt_polynomial_matrix.hpp"
#include "lcmtypes/drake/lcmt_piecewise_polynomial.hpp"
#include "lcmtypes/drake/lcmt_qp_controller_input.hpp"
#include "drake/drakeLCMUtil_export.h"
DRAKELCMUTIL_EXPORT void encodePolynomial(const Polynomial<double>& polynomial,
drake::lcmt_polynomial& msg);
DRAKELCMUTIL_EXPORT Polynomial<double> decodePolynomial(
const drake::lcmt_polynomial& msg);
template <int RowsAtCompileTime, int ColsAtCompileTime>
void encodePolynomialMatrix(
const Eigen::Matrix<Polynomial<double>, RowsAtCompileTime,
ColsAtCompileTime>& polynomial_matrix,
drake::lcmt_polynomial_matrix& msg) {
msg.polynomials.clear();
msg.polynomials.resize(polynomial_matrix.rows());
for (int row = 0; row < polynomial_matrix.rows(); ++row) {
auto& polynomial_msg_row = msg.polynomials[row];
polynomial_msg_row.resize(polynomial_matrix.cols());
for (int col = 0; col < polynomial_matrix.cols(); ++col) {
encodePolynomial(polynomial_matrix(row, col), polynomial_msg_row[col]);
}
}
msg.rows = polynomial_matrix.rows();
msg.cols = polynomial_matrix.cols();
}
template <int RowsAtCompileTime, int ColsAtCompileTime>
Eigen::Matrix<Polynomial<double>, RowsAtCompileTime, ColsAtCompileTime>
decodePolynomialMatrix(const drake::lcmt_polynomial_matrix& msg) {
Eigen::Matrix<Polynomial<double>, RowsAtCompileTime, ColsAtCompileTime> ret(
msg.rows, msg.cols);
for (int row = 0; row < msg.rows; ++row) {
for (int col = 0; col < msg.cols; ++col) {
ret(row, col) = decodePolynomial(msg.polynomials[row][col]);
}
}
return ret;
}
DRAKELCMUTIL_EXPORT void encodePiecewisePolynomial(
const PiecewisePolynomial<double>& piecewise_polynomial,
drake::lcmt_piecewise_polynomial& msg);
DRAKELCMUTIL_EXPORT PiecewisePolynomial<double> decodePiecewisePolynomial(
const drake::lcmt_piecewise_polynomial& msg);
DRAKELCMUTIL_EXPORT void verifySubtypeSizes(
drake::lcmt_support_data& support_data);
DRAKELCMUTIL_EXPORT void verifySubtypeSizes(
drake::lcmt_qp_controller_input& qp_input);
#endif /* UTIL_LCMUTIL_H_ */
|
typedef struct test {
int x;
int y;
} test_t;
void main (test_t* t) {
t->x = 3;
int i = 0;
while (i < 10) {
i = i + 1;
t[i].x = 5;
t[i].y = 10;
}
return;
}
|
/* -*- mode: C -*- */
/*
IGraph library.
Copyright (C) 2010-2012 Gabor Csardi <csardi.gabor@gmail.com>
334 Harvard st, Cambridge MA, 02139 USA
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
*/
#include <igraph.h>
#include <string.h>
int main() {
char tmp[100];
const char *string;
int major, minor, subminor;
igraph_version(&string, &major, &minor, &subminor);
if (subminor != 0) {
sprintf(tmp, "%i.%i.%i", major, minor, subminor);
} else {
sprintf(tmp, "%i.%i", major, minor);
}
if (strncmp(string, tmp, strlen(tmp))) {
return 1;
}
return 0;
}
|
/*
Copyright (c) 1999 - 2010, Vodafone Group Services Ltd
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 the Vodafone Group Services Ltd 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 NGPMAKER_REQUEST_H
#define NGPMAKER_REQUEST_H
#include "NParam.h"
/// \namespace Holds NGP utilities for making ngp binaries
namespace NGPMaker {
/// Describes an NGP Parameter
struct Param {
uint32 m_id; ///< identification number
NParam::NParam_t m_type; ///< param type
MC2String m_value; ///< string value to be converted
MC2String m_desc; ///< simple description of this parameter
};
/// Contains a request with all parameters
struct Request {
uint32 m_protocolVersion; ///< protocol version
uint32 m_type; ///< Request type
uint32 m_id; ///< identification number
uint32 m_version; ///< Version.
bool m_useGzip; ///< whether or not to use gzip
vector<Param> m_params; ///< all parameters
MC2String m_desc; ///< simple description of this request
MC2String m_name; ///< name of the request
};
/**
* Determines string representation of param type
* @return string representation of type
*/
MC2String getTypeAsString( NParam::NParam_t type );
/**
* Returns type that matches string
* @param value string representation of type
* @param type returns type value, if found
* @return true if type was found and set
*/
bool getTypeFromString( const MC2String& value,
NParam::NParam_t& type );
/**
* Saves ngp request to a file
*
* @param filename name of the file
* @param request the request to write
* @return true on success
*/
bool saveNGP( const MC2String& filename, const Request& request );
/**
* Saves ngp request to a buffer
* @param buffer to be filled with ngp data
* @param request to be save
* @return true on success
*/
bool saveNGPToBuffer( vector<byte>& buffer, const Request& request );
}
#endif
|
/*
* Version macros.
*
* This file is part of FFmpeg.
*
* FFmpeg 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.
*
* FFmpeg 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 FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_VERSION_H
#define AVFILTER_VERSION_H
/**
* @file
* @ingroup lavfi
* Libavfilter version macros
*/
#include "libavutil/version.h"
#define LIBAVFILTER_VERSION_MAJOR 5
#define LIBAVFILTER_VERSION_MINOR 13
#define LIBAVFILTER_VERSION_MICRO 101
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
LIBAVFILTER_VERSION_MICRO)
#define LIBAVFILTER_VERSION AV_VERSION(LIBAVFILTER_VERSION_MAJOR, \
LIBAVFILTER_VERSION_MINOR, \
LIBAVFILTER_VERSION_MICRO)
#define LIBAVFILTER_BUILD LIBAVFILTER_VERSION_INT
#define LIBAVFILTER_IDENT "Lavfi" AV_STRINGIFY(LIBAVFILTER_VERSION)
/**
* FF_API_* defines may be placed below to indicate public API that will be
* dropped at a future version bump. The defines themselves are not part of
* the public API and may change, break or disappear at any time.
*/
#ifndef FF_API_AVFILTERPAD_PUBLIC
#define FF_API_AVFILTERPAD_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_FOO_COUNT
#define FF_API_FOO_COUNT (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_AVFILTERBUFFER
#define FF_API_AVFILTERBUFFER (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_OLD_FILTER_OPTS
#define FF_API_OLD_FILTER_OPTS (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_AVFILTER_OPEN
#define FF_API_AVFILTER_OPEN (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_AVFILTER_INIT_FILTER
#define FF_API_AVFILTER_INIT_FILTER (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_OLD_FILTER_REGISTER
#define FF_API_OLD_FILTER_REGISTER (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#ifndef FF_API_OLD_GRAPH_PARSE
#define FF_API_OLD_GRAPH_PARSE (LIBAVFILTER_VERSION_MAJOR < 5)
#endif
#ifndef FF_API_NOCONST_GET_NAME
#define FF_API_NOCONST_GET_NAME (LIBAVFILTER_VERSION_MAJOR < 6)
#endif
#endif /* AVFILTER_VERSION_H */
|
/* $Id: catgets.c,v 1.1.1.1 2006/05/30 06:13:45 hhzhou Exp $ */
/*
* Written by J.T. Conklin, 10/05/94
* Public domain.
*/
/*
* Portions copyright (c) 1999, 2000
* Intel Corporation.
* All rights reserved.
*
* 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
*
* This product includes software developed by Intel Corporation and
* its contributors.
*
* 4. Neither the name of Intel Corporation or its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION 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 INTEL CORPORATION OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include <sys/cdefs.h>
#ifdef __indr_reference
__indr_reference(_catgets,catgets);
#else
#include <nl_types.h>
extern char * _catgets __P((nl_catd, int, int, __const char *));
char *
catgets(catd, set_id, msg_id, s)
nl_catd catd;
int set_id;
int msg_id;
__const char *s;
{
return _catgets(catd, set_id, msg_id, s);
}
#endif
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Copyright 2014 Samsung Electronics. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_PASSWORD_MANAGER_DRIVER_H
#define CONTENT_PASSWORD_MANAGER_DRIVER_H
#ifdef TIZEN_AUTOFILL_SUPPORT
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "browser/password_manager/password_generation_manager.h"
#include "browser/password_manager/password_manager.h"
#include "browser/password_manager/password_manager_driver.h"
#include "content/public/browser/web_contents_observer.h"
namespace autofill {
class AutofillManager;
struct PasswordForm;
}
namespace content {
class WebContents;
}
class ContentPasswordManagerDriver : public PasswordManagerDriver,
public content::WebContentsObserver {
public:
explicit ContentPasswordManagerDriver(content::WebContents* web_contents,
PasswordManagerClient* client);
virtual ~ContentPasswordManagerDriver();
// PasswordManagerDriver implementation.
virtual void FillPasswordForm(const autofill::PasswordFormFillData& form_data)
override;
virtual bool DidLastPageLoadEncounterSSLErrors() override;
virtual bool IsOffTheRecord() override;
virtual PasswordGenerationManager* GetPasswordGenerationManager() override;
virtual PasswordManager* GetPasswordManager() override;
virtual autofill::AutofillManager* GetAutofillManager() override;
virtual void AllowPasswordGenerationForForm(autofill::PasswordForm* form)
override;
// content::WebContentsObserver overrides.
virtual bool OnMessageReceived(const IPC::Message& message) override;
virtual void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) override;
private:
// Must outlive this instance.
PasswordManagerClient* client_;
PasswordManager password_manager_;
PasswordGenerationManager password_generation_manager_;
DISALLOW_COPY_AND_ASSIGN(ContentPasswordManagerDriver);
};
#endif // TIZEN_AUTOFILL_SUPPORT
#endif // CONTENT_PASSWORD_MANAGER_DRIVER_H
|
// Copyright (c) 2007 INRIA Sophia-Antipolis (France).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); 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.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
//
// Author(s) : Christophe Delage
#ifndef CGAL_HILBERT_SORT_BASE_H
#define CGAL_HILBERT_SORT_BASE_H
#include <CGAL/basic.h>
#include <algorithm>
#include <CGAL/algorithm.h>
namespace CGAL {
namespace internal {
template <class RandomAccessIterator, class Cmp>
RandomAccessIterator
hilbert_split (RandomAccessIterator begin, RandomAccessIterator end,
Cmp cmp = Cmp ())
{
if (begin >= end) return begin;
#if defined(CGAL_HILBERT_SORT_WITH_MEDIAN_POLICY_CROSS_PLATFORM_BEHAVIOR)
RandomAccessIterator middle = begin + (end - begin) / 2;
CGAL::nth_element (begin, middle, end, cmp);
return middle;
#else
RandomAccessIterator middle = begin + (end - begin) / 2;
std::nth_element (begin, middle, end, cmp);
return middle;
#endif
}
}
} // namespace CGAL
#endif//CGAL_HILBERT_SORT_BASE_H
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68a.c
Label Definition File: CWE195_Signed_to_Unsigned_Conversion_Error.label.xml
Template File: sources-sink-68a.tmpl.c
*/
/*
* @description
* CWE: 195 Signed to Unsigned Conversion Error
* BadSource: rand Set data to result of rand(), which may be zero
* GoodSource: Positive integer
* Sink: malloc
* BadSink : Allocate memory using malloc() with the size of data
* Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
*
* */
#include "std_testcase.h"
int CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_badData;
int CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_goodG2BData;
#ifndef OMITBAD
/* bad function declaration */
void CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68b_badSink();
void CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_bad()
{
int data;
/* Initialize data */
data = -1;
/* POTENTIAL FLAW: Set data to a random value */
data = RAND32();
CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_badData = data;
CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68b_badSink();
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* good function declarations */
void CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68b_goodG2BSink();
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
int data;
/* Initialize data */
data = -1;
/* FIX: Use a positive integer less than &InitialDataSize&*/
data = 100-1;
CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_goodG2BData = data;
CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68b_goodG2BSink();
}
void CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE195_Signed_to_Unsigned_Conversion_Error__rand_malloc_68_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
/************************************************************************************
* Copyright (c) 2006, University of Kansas - Hybridthreads Group
* 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 the University of Kansas nor the name of the
* Hybridthreads Group 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 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.
************************************************************************************/
/** \file rops.h
* \brief The declaration of the Hybrid Threads API.
*
* \author Wesley Peck <peckw@ittc.ku.edu>\n
*/
#ifndef _HYBRID_THREADS_ROPS_H_
#define _HYBRID_THREADS_ROPS_H_
#include <httype.h>
#define read_reg(cmd) (*(volatile Huint*)(cmd))
#define read_reg64(cmd) (*(volatile Hulong*)(cmd))
#define write_reg(reg,val) ((*(volatile Huint*)(reg)) = val)
#endif
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE369_Divide_by_Zero__int_fgets_modulo_54c.c
Label Definition File: CWE369_Divide_by_Zero__int.label.xml
Template File: sources-sinks-54c.tmpl.c
*/
/*
* @description
* CWE: 369 Divide by Zero
* BadSource: fgets Read data from the console using fgets()
* GoodSource: Non-zero
* Sinks: modulo
* GoodSink: Check for zero before modulo
* BadSink : Modulo a constant with data
* Flow Variant: 54 Data flow: data passed as an argument from one function through three others to a fifth; all five functions are in different source files
*
* */
#include "std_testcase.h"
#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)
#ifndef OMITBAD
/* bad function declaration */
void CWE369_Divide_by_Zero__int_fgets_modulo_54d_badSink(int data);
void CWE369_Divide_by_Zero__int_fgets_modulo_54c_badSink(int data)
{
CWE369_Divide_by_Zero__int_fgets_modulo_54d_badSink(data);
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void CWE369_Divide_by_Zero__int_fgets_modulo_54d_goodG2BSink(int data);
void CWE369_Divide_by_Zero__int_fgets_modulo_54c_goodG2BSink(int data)
{
CWE369_Divide_by_Zero__int_fgets_modulo_54d_goodG2BSink(data);
}
/* goodB2G uses the BadSource with the GoodSink */
void CWE369_Divide_by_Zero__int_fgets_modulo_54d_goodB2GSink(int data);
void CWE369_Divide_by_Zero__int_fgets_modulo_54c_goodB2GSink(int data)
{
CWE369_Divide_by_Zero__int_fgets_modulo_54d_goodB2GSink(data);
}
#endif /* OMITGOOD */
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_01.c
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE131.label.xml
Template File: sources-sink-01.tmpl.c
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Allocate memory without using sizeof(int)
* GoodSource: Allocate memory using sizeof(int)
* Sink: memmove
* BadSink : Copy array to data using memmove()
* Flow Variant: 01 Baseline
*
* */
#include "std_testcase.h"
#ifndef OMITBAD
void CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_01_bad()
{
int * data;
data = NULL;
/* FLAW: Allocate memory without using sizeof(int) */
data = (int *)ALLOCA(10);
{
int source[10] = {0};
/* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */
memmove(data, source, 10*sizeof(int));
printIntLine(data[0]);
}
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
static void goodG2B()
{
int * data;
data = NULL;
/* FIX: Allocate memory using sizeof(int) */
data = (int *)ALLOCA(10*sizeof(int));
{
int source[10] = {0};
/* POTENTIAL FLAW: Possible buffer overflow if data was not allocated correctly in the source */
memmove(data, source, 10*sizeof(int));
printIntLine(data[0]);
}
}
void CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_01_good()
{
goodG2B();
}
#endif /* OMITGOOD */
/* Below is the main(). It is only used when building this testcase on
* its own for testing or for building a binary to use in testing binary
* analysis tools. It is not used when compiling all the testcases as one
* application, which is how source code analysis tools are tested.
*/
#ifdef INCLUDEMAIN
int main(int argc, char * argv[])
{
/* seed randomness */
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_01_good();
printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
printLine("Calling bad()...");
CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_01_bad();
printLine("Finished bad()");
#endif /* OMITBAD */
return 0;
}
#endif
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_
#define CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_
#include <string>
#include "base/basictypes.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/chromeos/app_mode/kiosk_app_launch_error.h"
#include "google_apis/gaia/oauth2_token_service.h"
#include "net/base/network_change_notifier.h"
class Profile;
namespace extensions {
class WebstoreStandaloneInstaller;
}
namespace chromeos {
// Launches the app at startup. The flow roughly looks like this:
// First call Initialize():
// - Checks if the app is installed in user profile (aka app profile);
// - If the app is installed, launch it and finish the flow;
// - If not installed, prepare to start install by checking network online
// state;
// - If network gets online, start to install the app from web store;
// Report OnLauncherInitialized() or OnLaunchFailed() to observers:
// - If all goes good, launches the app and finish the flow;
class StartupAppLauncher
: public base::SupportsWeakPtr<StartupAppLauncher>,
public OAuth2TokenService::Observer,
public net::NetworkChangeNotifier::NetworkChangeObserver {
public:
class Observer {
public:
virtual void OnLoadingOAuthFile() = 0;
virtual void OnInitializingTokenService() = 0;
virtual void OnInitializingNetwork() = 0;
virtual void OnInstallingApp() = 0;
virtual void OnReadyToLaunch() = 0;
virtual void OnLaunchSucceeded() = 0;
virtual void OnLaunchFailed(KioskAppLaunchError::Error error) = 0;
protected:
virtual ~Observer() {}
};
StartupAppLauncher(Profile* profile, const std::string& app_id);
virtual ~StartupAppLauncher();
// Prepares the environment for an app launch.
void Initialize();
// Launches the app after the initialization is successful.
void LaunchApp();
// Add and remove observers for app launch procedure.
void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer);
private:
// OAuth parameters from /home/chronos/kiosk_auth file.
struct KioskOAuthParams {
std::string refresh_token;
std::string client_id;
std::string client_secret;
};
void OnLaunchSuccess();
void OnLaunchFailure(KioskAppLaunchError::Error error);
void BeginInstall();
void InstallCallback(bool success, const std::string& error);
void OnReadyToLaunch();
void InitializeTokenService();
void InitializeNetwork();
void StartLoadingOAuthFile();
static void LoadOAuthFileOnBlockingPool(KioskOAuthParams* auth_params);
void OnOAuthFileLoaded(KioskOAuthParams* auth_params);
// OAuth2TokenService::Observer overrides.
virtual void OnRefreshTokenAvailable(const std::string& account_id) OVERRIDE;
virtual void OnRefreshTokensLoaded() OVERRIDE;
// net::NetworkChangeNotifier::NetworkChangeObserver overrides:
virtual void OnNetworkChanged(
net::NetworkChangeNotifier::ConnectionType type) OVERRIDE;
Profile* profile_;
const std::string app_id_;
ObserverList<Observer> observer_list_;
bool ready_to_launch_;
scoped_refptr<extensions::WebstoreStandaloneInstaller> installer_;
KioskOAuthParams auth_params_;
DISALLOW_COPY_AND_ASSIGN(StartupAppLauncher);
};
} // namespace chromeos
#endif // CHROME_BROWSER_CHROMEOS_APP_MODE_STARTUP_APP_LAUNCHER_H_
|
#ifndef TRITONSORT_LOG_LINE_DESCRIPTOR_H
#define TRITONSORT_LOG_LINE_DESCRIPTOR_H
#include <inttypes.h>
#include <list>
#include <map>
#include <stdint.h>
#include <string>
#include "LogLineFieldInfo.h"
/**
LogLineDescriptors are used by stat containers (see StatContainerInterface)
to describe the log lines they write to stat log files.
*/
class LogLineDescriptor {
public:
/// Constructor
LogLineDescriptor();
/// Copy constructor
/**
\param descriptor the LogLineDescriptor being copied
*/
LogLineDescriptor(const LogLineDescriptor& descriptor);
/// Destructor
virtual ~LogLineDescriptor();
/// Set the log line type name for this descriptor
/**
The log line type name is used to easily differentiate between different
kinds of log lines. Convention is usually that it is an all-caps,
four-letter string like DATM or SUMM, but this is not strictly required.
\param logLineTypeName the log line type name
*/
LogLineDescriptor& setLogLineTypeName(const std::string& logLineTypeName);
/// Add a field to the description
/**
This field will be added after all preceding fields declared with calls to
addField()
\param fieldName the name of the field
\param fieldType a string declaring the type of the field. Will be used by
the log processing scripts to automatically convert the field to the
appropriate type
\return a reference to this LogLineDescriptor
*/
LogLineDescriptor& addField(const std::string& fieldName,
LogLineFieldInfo::FieldType fieldType
= LogLineFieldInfo::STRING);
/// Add a constant string field to the log line descriptor
/**
This field will come after all previously added fields.
\param fieldName the name of the field
\param the field's constant value
*/
LogLineDescriptor& addConstantStringField(const std::string& fieldName,
const std::string& value);
/// Add a constant unsigned integer field to the log line descriptor
/**
This field will come after all previously added fields.
\param fieldName the name of the field
\param the field's constant value
*/
LogLineDescriptor& addConstantUIntField(const std::string& fieldName,
uint64_t value);
/// Add a constant signed integer field to the log line descriptor
/**
This field will come after all previously added fields.
\param fieldName the name of the field
\param the field's constant value
*/
LogLineDescriptor& addConstantIntField(const std::string& fieldName,
int64_t value);
/// Indicate that you are done specifying the log line descriptor
/**
This method must be called before any methods other than field addition
are used. Constructs the description string and the log line format string
as side-effects.
*/
void finalize();
/// Get a JSON object describing this log line
/**
This JSON object is used by meta-programs to map field numbers to logical
names.
\return a reference to the JSON object that describes this log line
*/
const Json::Value& getDescriptionJson() const;
/// Get the log line format string for this log line
/**
The log line format string is a printf-style format string that will be
combined with the descriptor's variable fields to produce the log line.
\return a printf-style format string for use when printing this log line
*/
const std::string& getLogLineFormatString() const;
/// Write this log line to a file
/**
\param fileDescriptor an open file descriptor referring to the file to
which to write
\param ... the variable arguments for this log line, in order of their
declaration
*/
void writeLogLineToFile(int fileDescriptor ...) const;
private:
typedef std::list<LogLineFieldInfo*> FieldList;
std::string logLineTypeName;
std::string formatString;
Json::Value description;
bool finalized;
FieldList fields;
void init();
};
#endif // TRITONSORT_LOG_LINE_DESCRIPTOR_H
|
/*
* DO NOT EDIT. THIS FILE IS GENERATED FROM e:/builds/tinderbox/XR-Trunk/WINNT_5.2_Depend/mozilla/content/base/public/nsISelectionListener.idl
*/
#ifndef __gen_nsISelectionListener_h__
#define __gen_nsISelectionListener_h__
#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif
/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIDOMDocument; /* forward declaration */
class nsISelection; /* forward declaration */
/* starting interface: nsISelectionListener */
#define NS_ISELECTIONLISTENER_IID_STR "a6cf90e2-15b3-11d2-932e-00805f8add32"
#define NS_ISELECTIONLISTENER_IID \
{0xa6cf90e2, 0x15b3, 0x11d2, \
{ 0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32 }}
class NS_NO_VTABLE NS_SCRIPTABLE nsISelectionListener : public nsISupports {
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISELECTIONLISTENER_IID)
enum { NO_REASON = 0 };
enum { DRAG_REASON = 1 };
enum { MOUSEDOWN_REASON = 2 };
enum { MOUSEUP_REASON = 4 };
enum { KEYPRESS_REASON = 8 };
enum { SELECTALL_REASON = 16 };
/* void notifySelectionChanged (in nsIDOMDocument doc, in nsISelection sel, in short reason); */
NS_SCRIPTABLE NS_IMETHOD NotifySelectionChanged(nsIDOMDocument *doc, nsISelection *sel, PRInt16 reason) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsISelectionListener, NS_ISELECTIONLISTENER_IID)
/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSISELECTIONLISTENER \
NS_SCRIPTABLE NS_IMETHOD NotifySelectionChanged(nsIDOMDocument *doc, nsISelection *sel, PRInt16 reason);
/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSISELECTIONLISTENER(_to) \
NS_SCRIPTABLE NS_IMETHOD NotifySelectionChanged(nsIDOMDocument *doc, nsISelection *sel, PRInt16 reason) { return _to NotifySelectionChanged(doc, sel, reason); }
/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSISELECTIONLISTENER(_to) \
NS_SCRIPTABLE NS_IMETHOD NotifySelectionChanged(nsIDOMDocument *doc, nsISelection *sel, PRInt16 reason) { return !_to ? NS_ERROR_NULL_POINTER : _to->NotifySelectionChanged(doc, sel, reason); }
#if 0
/* Use the code below as a template for the implementation class for this interface. */
/* Header file */
class nsSelectionListener : public nsISelectionListener
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISELECTIONLISTENER
nsSelectionListener();
private:
~nsSelectionListener();
protected:
/* additional members */
};
/* Implementation file */
NS_IMPL_ISUPPORTS1(nsSelectionListener, nsISelectionListener)
nsSelectionListener::nsSelectionListener()
{
/* member initializers and constructor code */
}
nsSelectionListener::~nsSelectionListener()
{
/* destructor code */
}
/* void notifySelectionChanged (in nsIDOMDocument doc, in nsISelection sel, in short reason); */
NS_IMETHODIMP nsSelectionListener::NotifySelectionChanged(nsIDOMDocument *doc, nsISelection *sel, PRInt16 reason)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
/* End of implementation class template. */
#endif
#endif /* __gen_nsISelectionListener_h__ */
|
//
// PlotGalleryController.h
// CorePlotGallery
//
// Created by Jeff Buck on 9/5/10.
// Copyright 2010 Jeff Buck. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import <Quartz/Quartz.h>
#import <CorePlot/CorePlot.h>
#import "PlotGallery.h"
#import "PlotView.h"
@interface PlotGalleryController : NSObject <NSSplitViewDelegate,
PlotViewDelegate>
{
IBOutlet NSSplitView *splitView;
IBOutlet NSScrollView *scrollView;
IBOutlet IKImageBrowserView *imageBrowser;
IBOutlet NSPopUpButton *themePopUpButton;
IBOutlet PlotView *hostingView;
CPTGraphHostingView *defaultGraphHostingView;
PlotItem *plotItem;
NSString *currentThemeName;
void *nuHandle;
}
@property (nonatomic, retain) PlotItem *plotItem;
@property (nonatomic, copy) NSString *currentThemeName;
- (IBAction)themeSelectionDidChange:(id)sender;
@end
|
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMEOS_SERVICES_IME_PUBLIC_CPP_RULEBASED_DEF_NE_INSCRIPT_H_
#define CHROMEOS_SERVICES_IME_PUBLIC_CPP_RULEBASED_DEF_NE_INSCRIPT_H_
namespace ne_inscript {
// The id of this IME/keyboard.
extern const char* kId;
// Whether this keyboard layout is a 102 or 101 keyboard.
extern bool kIs102;
// The key mapping definitions under various modifier states.
extern const char** kKeyMap[8];
} // namespace ne_inscript
#endif // CHROMEOS_SERVICES_IME_PUBLIC_CPP_RULEBASED_DEF_NE_INSCRIPT_H_
|
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81.h
Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml
Template File: sources-sink-81.tmpl.h
*/
/*
* @description
* CWE: 121 Stack Based Buffer Overflow
* BadSource: Set data pointer to the bad buffer
* GoodSource: Set data pointer to the good buffer
* Sinks: memcpy
* BadSink : Copy twoIntsStruct array to data using memcpy
* Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference
*
* */
#include "std_testcase.h"
namespace CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81
{
class CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81_base
{
public:
/* pure virtual function */
virtual void action(twoIntsStruct * data) const = 0;
};
#ifndef OMITBAD
class CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81_bad : public CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81_base
{
public:
void action(twoIntsStruct * data) const;
};
#endif /* OMITBAD */
#ifndef OMITGOOD
class CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81_goodG2B : public CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_81_base
{
public:
void action(twoIntsStruct * data) const;
};
#endif /* OMITGOOD */
}
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_ASH_LOGIN_TEST_OOBE_BASE_TEST_H_
#define CHROME_BROWSER_ASH_LOGIN_TEST_OOBE_BASE_TEST_H_
#include <memory>
#include <string>
#include "base/compiler_specific.h"
#include "chrome/browser/ash/login/oobe_screen.h"
#include "chrome/browser/ash/login/test/embedded_test_server_setup_mixin.h"
#include "chrome/browser/ash/login/test/js_checker.h"
#include "chrome/test/base/mixin_based_in_process_browser_test.h"
// TODO(https://crbug.com/1164001): move to forward declaration.
#include "chromeos/dbus/update_engine/fake_update_engine_client.h"
namespace content {
class WebUI;
} // namespace content
namespace ash {
class LoginOrLockScreenVisibleWaiter;
// Base class for OOBE, login, SAML and Kiosk tests.
class OobeBaseTest : public MixinBasedInProcessBrowserTest {
public:
OobeBaseTest();
OobeBaseTest(const OobeBaseTest&) = delete;
OobeBaseTest& operator=(const OobeBaseTest&) = delete;
~OobeBaseTest() override;
// Subclasses may register their own custom request handlers that will
// process requests prior it gets handled by FakeGaia instance.
virtual void RegisterAdditionalRequestHandlers();
static OobeScreenId GetFirstSigninScreen();
protected:
// MixinBasedInProcessBrowserTest::
void SetUp() override;
void SetUpCommandLine(base::CommandLine* command_line) override;
void SetUpInProcessBrowserTestFixture() override;
void CreatedBrowserMainParts(
content::BrowserMainParts* browser_main_parts) override;
void SetUpOnMainThread() override;
// If this returns true (default), then SetUpOnMainThread would wait for
// Oobe UI to start up before initializing all mix-ins.
virtual bool ShouldWaitForOobeUI();
// Returns chrome://oobe WebUI.
content::WebUI* GetLoginUI();
FakeUpdateEngineClient* update_engine_client() {
return update_engine_client_;
}
void WaitForOobeUI();
void WaitForGaiaPageLoad();
void WaitForGaiaPageLoadAndPropertyUpdate();
void WaitForGaiaPageReload();
void WaitForGaiaPageBackButtonUpdate();
WARN_UNUSED_RESULT std::unique_ptr<test::TestConditionWaiter>
CreateGaiaPageEventWaiter(const std::string& event);
void WaitForSigninScreen();
void CheckJsExceptionErrors(int number);
test::JSChecker SigninFrameJS();
// Whether to use background networking. Note this is only effective when it
// is set before SetUpCommandLine is invoked.
bool needs_background_networking_ = false;
std::string gaia_frame_parent_ = "signin-frame";
std::string authenticator_id_ = "$('gaia-signin').authenticator_";
EmbeddedTestServerSetupMixin embedded_test_server_{&mixin_host_,
embedded_test_server()};
// Waits for login_screen_load_observer_ and resets it afterwards.
void MaybeWaitForLoginScreenLoad();
private:
FakeUpdateEngineClient* update_engine_client_ = nullptr;
std::unique_ptr<LoginOrLockScreenVisibleWaiter> login_screen_load_observer_;
};
} // namespace ash
// TODO(https://crbug.com/1164001): remove after //chrome/browser/chromeos
// source migration is finished.
namespace chromeos {
using ::ash::OobeBaseTest;
}
#endif // CHROME_BROWSER_ASH_LOGIN_TEST_OOBE_BASE_TEST_H_
|
/*=========================================================================
Program: Visualization Toolkit
Module: ADIOSVarInfo.h
Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
All rights reserved.
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================*/
// .NAME ADIOSVarInfo - The utility class wrapping the ADIOS_VARINFO struct
#ifndef _ADIOSVarInfo_h
#define _ADIOSVarInfo_h
#include <string>
#include <vector>
//----------------------------------------------------------------------------
class ADIOSVarInfo
{
public:
ADIOSVarInfo(const std::string &name = "", void* var = NULL);
~ADIOSVarInfo(void);
std::string GetName(void) const;
int GetId(void) const;
int GetType(void) const;
size_t GetNumSteps(void) const;
bool IsGlobal(void) const;
bool IsScalar(void) const;
void GetDims(std::vector<size_t>& dims, int block) const;
template<typename T>
T GetValue(int step = 0) const;
template<typename T>
const T* GetAllValues(void) const;
private:
struct ADIOSVarInfoImpl;
ADIOSVarInfoImpl *Impl;
};
#endif // _ADIOSVarInfo_h
// VTK-HeaderTest-Exclude: ADIOSVarInfo.h
|
#ifndef SCHEINERMAN_STREAM_PROVIDERS_ADJACENT_DIFFERENCE_H
#define SCHEINERMAN_STREAM_PROVIDERS_ADJACENT_DIFFERENCE_H
#include "StreamProvider.h"
#include "../Utility.h"
#include <type_traits>
namespace stream {
namespace provider {
template<typename T, typename Subtractor>
class AdjacentDifference : public StreamProvider<std::result_of_t<Subtractor(T&, T&)>> {
public:
using DiffType = std::result_of_t<Subtractor(T&, T&)>;
AdjacentDifference(StreamProviderPtr<T> source, Subtractor&& subtract)
: source_(std::move(source)), subtract_(subtract) {}
std::shared_ptr<DiffType> get() override {
return result_;
}
bool advance_impl() override {
if(first_advance_) {
first_advance_ = false;
if(source_->advance()) {
first_ = source_->get();
} else {
return false;
}
if(source_->advance()) {
second_ = source_->get();
} else {
first_.reset();
return false;
}
result_ = std::make_shared<DiffType>(subtract_(*second_, *first_));
return true;
}
first_ = std::move(second_);
if(source_->advance()) {
second_ = source_->get();
result_ = std::make_shared<DiffType>(subtract_(*second_, *first_));
return true;
}
first_.reset();
result_.reset();
return false;
}
PrintInfo print(std::ostream& os, int indent) const override {
this->print_indent(os, indent);
os << "AdjacentDifference:\n";
return source_->print(os, indent + 1).addStage();
}
private:
StreamProviderPtr<T> source_;
Subtractor subtract_;
std::shared_ptr<T> first_;
std::shared_ptr<T> second_;
std::shared_ptr<DiffType> result_;
bool first_advance_ = true;
};
} /* namespace provider */
} /* namespace stream */
#endif
|
/*
* OpenSSL Engine
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_ENGINE_OPENSSL_H__
#define BOTAN_ENGINE_OPENSSL_H__
#include <botan/engine.h>
namespace Botan {
/**
* OpenSSL Engine
*/
class OpenSSL_Engine : public Engine
{
public:
/**
* Return the provider name ("openssl")
*/
std::string provider_name() const { return "openssl"; }
PK_Ops::Key_Agreement*
get_key_agreement_op(const Private_Key& key) const;
PK_Ops::Signature*
get_signature_op(const Private_Key& key) const;
PK_Ops::Verification* get_verify_op(const Public_Key& key) const;
PK_Ops::Encryption* get_encryption_op(const Public_Key& key) const;
PK_Ops::Decryption* get_decryption_op(const Private_Key& key) const;
Modular_Exponentiator* mod_exp(const BigInt&,
Power_Mod::Usage_Hints) const;
BlockCipher* find_block_cipher(const SCAN_Name&,
Algorithm_Factory&) const;
StreamCipher* find_stream_cipher(const SCAN_Name&,
Algorithm_Factory&) const;
HashFunction* find_hash(const SCAN_Name&, Algorithm_Factory&) const;
};
}
#endif
|
// Copyright (c) 2010-2011 Zipline Games, Inc. All Rights Reserved.
// http://getmoai.com
#ifndef MOAIBOX2DREVOLUTEJOINT_H
#define MOAIBOX2DREVOLUTEJOINT_H
#if USE_BOX2D
#include <moaicore/MOAIBox2DJoint.h>
#include <moaicore/MOAILua.h>
//================================================================//
// MOAIBox2DRevoluteJoint
//================================================================//
/** @name MOAIBox2DRevoluteJoint
@text Box2D revolute joint.
*/
class MOAIBox2DRevoluteJoint :
public MOAIBox2DJoint {
private:
//----------------------------------------------------------------//
static int _getJointAngle ( lua_State* L );
static int _getJointSpeed ( lua_State* L );
static int _getLowerLimit ( lua_State* L );
static int _getMotorSpeed ( lua_State* L );
static int _getMotorTorque ( lua_State* L );
static int _getUpperLimit ( lua_State* L );
static int _isLimitEnabled ( lua_State* L );
static int _isMotorEnabled ( lua_State* L );
static int _setLimit ( lua_State* L );
static int _setLimitEnabled ( lua_State* L );
static int _setMaxMotorTorque ( lua_State* L );
static int _setMotor ( lua_State* L );
static int _setMotorSpeed ( lua_State* L );
static int _setMotorEnabled ( lua_State* L );
public:
DECL_LUA_FACTORY ( MOAIBox2DRevoluteJoint )
//----------------------------------------------------------------//
MOAIBox2DRevoluteJoint ();
~MOAIBox2DRevoluteJoint ();
void RegisterLuaClass ( MOAILuaState& state );
void RegisterLuaFuncs ( MOAILuaState& state );
};
#endif
#endif |
/*
* ControlSceneManager.h
*
* Copyright (c) 2011 Yannick Loriot
*
* 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 __CCCONTROLSCENEMANAGER_H__
#define __CCCONTROLSCENEMANAGER_H__
#include "cocos2d.h"
#include "extensions/cocos-ext.h"
USING_NS_CC;
class ControlSceneManager : public cocos2d::Object
{
public:
ControlSceneManager();
~ControlSceneManager();
/** Returns the singleton of the control scene manager. */
static ControlSceneManager * sharedControlSceneManager();
/** Returns the next control scene. */
cocos2d::Scene *nextControlScene();
/** Returns the previous control scene. */
cocos2d::Scene *previousControlScene();
/** Returns the current control scene. */
cocos2d::Scene *currentControlScene();
/** Control scene id. */
CC_SYNTHESIZE(int, _currentControlSceneId, CurrentControlSceneId)
};
#endif /* __CCCONTROLSCENEMANAGER_H__ */
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#include "a_and_d.h"
void e() { d(); }
void g() {}
void f() {}
void c() { d(); }
void b() { c(); }
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 1997,2008 Oracle. All rights reserved.
*
* $Id: os_yield.c,v 12.19 2008/01/08 20:58:43 bostic Exp $
*/
#include "db_config.h"
#define __INCLUDE_SELECT_H 1
#include "db_int.h"
#if defined(HAVE_SYSTEM_INCLUDE_FILES) && defined(HAVE_SCHED_YIELD)
#include <sched.h>
#endif
static void __os_sleep __P((ENV *, u_long, u_long));
/*
* __os_yield --
* Yield the processor, optionally pausing until running again.
*
* PUBLIC: void __os_yield __P((ENV *, u_long, u_long));
*/
void
__os_yield(env, secs, usecs)
ENV *env;
u_long secs, usecs; /* Seconds and microseconds. */
{
/*
* Don't require the values be normalized (some operating systems
* return an error if the usecs argument to select is too large).
*/
for (; usecs >= US_PER_SEC; usecs -= US_PER_SEC)
++secs;
if (DB_GLOBAL(j_yield) != NULL) {
(void)DB_GLOBAL(j_yield)(secs, usecs);
return;
}
/*
* Yield the processor so other processes or threads can run. Use
* the local yield call if not pausing, otherwise call the select
* function.
*/
if (secs != 0 || usecs != 0)
__os_sleep(env, secs, usecs);
else {
#if defined(HAVE_MUTEX_UI_THREADS)
thr_yield();
#elif defined(HAVE_PTHREAD_YIELD) && \
(defined(HAVE_MUTEX_PTHREADS) || defined(HAVE_PTHREAD_API))
pthread_yield();
#elif defined(HAVE_SCHED_YIELD)
(void)sched_yield();
#elif defined(HAVE_YIELD)
yield();
#else
__os_sleep(dbenv, 0, 0);
#endif
}
}
/*
* __os_sleep --
* Pause the thread of control.
*/
static void
__os_sleep(env, secs, usecs)
ENV *env;
u_long secs, usecs; /* Seconds and microseconds. */
{
struct timeval t;
int ret;
/*
* Sheer raving paranoia -- don't select for 0 time, in case some
* implementation doesn't yield the processor in that case.
*/
t.tv_sec = (long)secs;
t.tv_usec = (long)usecs + 1;
/*
* We don't catch interrupts and restart the system call here, unlike
* other Berkeley DB system calls. This may be a user attempting to
* interrupt a sleeping DB utility (for example, db_checkpoint), and
* we want the utility to see the signal and quit. This assumes it's
* always OK for DB to sleep for less time than originally scheduled.
*/
if (select(0, NULL, NULL, NULL, &t) == -1) {
ret = __os_get_syserr();
if (__os_posix_err(ret) != EINTR)
__db_syserr(env, ret, "select");
}
}
|
// This file was generated based on 'C:\ProgramData\Uno\Packages\Android\0.19.1\Android\Fallbacks\$.uno'.
// WARNING: Changes might be lost if you edit this file directly.
#pragma once
#include <Android.android.media.MediaPlayerDLROnBufferingUpdateListener.h>
#include <Android.Base.Wrappers.IJWrapper.h>
#include <Android.java.lang.Object.h>
#include <jni.h>
#include <Uno.IDisposable.h>
namespace g{namespace Android{namespace android{namespace media{struct MediaPlayer;}}}}
namespace g{namespace Android{namespace Fallbacks{struct Android_android_media_MediaPlayerDLROnBufferingUpdateListener;}}}
namespace g{
namespace Android{
namespace Fallbacks{
// public sealed extern class Android_android_media_MediaPlayerDLROnBufferingUpdateListener :27657
// {
struct Android_android_media_MediaPlayerDLROnBufferingUpdateListener_type : ::g::Android::java::lang::Object_type
{
::g::Android::android::media::MediaPlayerDLROnBufferingUpdateListener interface2;
};
Android_android_media_MediaPlayerDLROnBufferingUpdateListener_type* Android_android_media_MediaPlayerDLROnBufferingUpdateListener_typeof();
void Android_android_media_MediaPlayerDLROnBufferingUpdateListener__onBufferingUpdate_fn(Android_android_media_MediaPlayerDLROnBufferingUpdateListener* __this, ::g::Android::android::media::MediaPlayer* arg0, int* arg1);
void Android_android_media_MediaPlayerDLROnBufferingUpdateListener__onBufferingUpdate_IMPL_9436_fn(bool* arg0_, jobject* arg1_, uObject* arg2_, int* arg3_);
struct Android_android_media_MediaPlayerDLROnBufferingUpdateListener : ::g::Android::java::lang::Object
{
static jmethodID onBufferingUpdate_9436_ID_;
static jmethodID& onBufferingUpdate_9436_ID() { return onBufferingUpdate_9436_ID_; }
void onBufferingUpdate(::g::Android::android::media::MediaPlayer* arg0, int arg1);
static void onBufferingUpdate_IMPL_9436(bool arg0_, jobject arg1_, uObject* arg2_, int arg3_);
};
// }
}}} // ::g::Android::Fallbacks
|
/*
* RandomNumberGenerator
* (C) 1999-2009 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_RANDOM_NUMBER_GENERATOR_H__
#define BOTAN_RANDOM_NUMBER_GENERATOR_H__
#include <botan/entropy_src.h>
#include <botan/exceptn.h>
#include <string>
namespace Botan {
/**
* This class represents a random number (RNG) generator object.
*/
class BOTAN_DLL RandomNumberGenerator
{
public:
/**
* Create a seeded and active RNG object for general application use
*/
static RandomNumberGenerator* make_rng();
/**
* Randomize a byte array.
* @param output the byte array to hold the random output.
* @param length the length of the byte array output.
*/
virtual void randomize(byte output[], size_t length) = 0;
/**
* Return a random vector
* @param bytes number of bytes in the result
* @return randomized vector of length bytes
*/
SecureVector<byte> random_vec(size_t bytes)
{
SecureVector<byte> output(bytes);
randomize(&output[0], output.size());
return output;
}
/**
* Return a random byte
* @return random byte
*/
byte next_byte();
/**
* Check whether this RNG is seeded.
* @return true if this RNG was already seeded, false otherwise.
*/
virtual bool is_seeded() const { return true; }
/**
* Clear all internally held values of this RNG.
*/
virtual void clear() = 0;
/**
* Return the name of this object
*/
virtual std::string name() const = 0;
/**
* Seed this RNG using the entropy sources it contains.
* @param bits_to_collect is the number of bits of entropy to
attempt to gather from the entropy sources
*/
virtual void reseed(size_t bits_to_collect) = 0;
/**
* Add this entropy source to the RNG object
* @param source the entropy source which will be retained and used by RNG
*/
virtual void add_entropy_source(EntropySource* source) = 0;
/**
* Add entropy to this RNG.
* @param in a byte array containg the entropy to be added
* @param length the length of the byte array in
*/
virtual void add_entropy(const byte in[], size_t length) = 0;
RandomNumberGenerator() {}
virtual ~RandomNumberGenerator() {}
private:
RandomNumberGenerator(const RandomNumberGenerator&) {}
RandomNumberGenerator& operator=(const RandomNumberGenerator&)
{ return (*this); }
};
/**
* Null/stub RNG - fails if you try to use it for anything
*/
class BOTAN_DLL Null_RNG : public RandomNumberGenerator
{
public:
void randomize(byte[], size_t) { throw PRNG_Unseeded("Null_RNG"); }
void clear() {}
std::string name() const { return "Null_RNG"; }
void reseed(size_t) {}
bool is_seeded() const { return false; }
void add_entropy(const byte[], size_t) {}
void add_entropy_source(EntropySource* es) { delete es; }
};
}
#endif
|
//===== Copyright � 2005-2005, Valve Corporation, All rights reserved. ======//
//
// Purpose: A higher level link library for general use in the game and tools.
//
//===========================================================================//
#ifndef TIER1_H
#define TIER1_H
#if defined( _WIN32 )
#pragma once
#endif
#include "appframework/iappsystem.h"
#include "tier1/convar.h"
//-----------------------------------------------------------------------------
// Call this to connect to/disconnect from all tier 1 libraries.
// It's up to the caller to check the globals it cares about to see if ones are missing
//-----------------------------------------------------------------------------
void ConnectTier1Libraries( CreateInterfaceFn *pFactoryList, int nFactoryCount );
void DisconnectTier1Libraries();
//-----------------------------------------------------------------------------
// Helper empty implementation of an IAppSystem for tier2 libraries
//-----------------------------------------------------------------------------
template< class IInterface, int ConVarFlag = 0 >
class CTier1AppSystem : public CTier0AppSystem< IInterface >
{
typedef CTier0AppSystem< IInterface > BaseClass;
public:
virtual bool Connect( CreateInterfaceFn factory )
{
if ( !BaseClass::Connect( factory ) )
return false;
ConnectTier1Libraries( &factory, 1 );
return true;
}
virtual void Disconnect()
{
DisconnectTier1Libraries();
BaseClass::Disconnect();
}
virtual InitReturnVal_t Init()
{
InitReturnVal_t nRetVal = BaseClass::Init();
if ( nRetVal != INIT_OK )
return nRetVal;
if ( g_pCVar )
{
ConVar_Register( ConVarFlag );
}
return INIT_OK;
}
virtual void Shutdown()
{
if ( g_pCVar )
{
ConVar_Unregister( );
}
BaseClass::Shutdown( );
}
virtual AppSystemTier_t GetTier()
{
return APP_SYSTEM_TIER1;
}
};
#endif // TIER1_H
|
//
// UIScrollView+Utils.h
// SimpleTelnet
//
// Copyright (c) 2009 Peter Bakhyryev <peter@byteclub.com>, ByteClub LLC
//
// 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 <UIKit/UITextView.h>
@interface UITextView (Utils)
- (void)scrollToBottom;
- (void)appendTextAfterLinebreak:(NSString *)text;
@end
|
//
// CountriesStorage.h
// WeatherApp
//
// Created by Renzo Crisóstomo on 1/15/14.
// Copyright (c) 2014 Ruenzuo. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol CountriesStorage <NSObject>
- (void)storeCountries:(NSArray *)cities;
@end
|
/*
* Copyright (C) 2012 Spreadtrum Communications Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <mach/hardware.h>
#include <mach/board.h>
#include <mach/adi.h>
#include <asm/gpio.h>
#define SPRD_FLASH_ON 1
#define SPRD_FLASH_OFF 0
int sprd_flash_on(void)
{
printk("sprd_flash_on vivalto \n");
gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
gpio_free(GPIO_CAM_FLASH_EN);
return 0;
}
int sprd_flash_high_light(void)
{
printk("sprd_flash_high_light vivalto \n");
gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_ON);
gpio_free(GPIO_CAM_FLASH_EN);
return 0;
}
int sprd_flash_close(void)
{
printk("sprd_flash_close vivalto \n");
gpio_request(GPIO_CAM_FLASH_EN,"cam_flash_en");
gpio_direction_output(GPIO_CAM_FLASH_EN, SPRD_FLASH_OFF);
gpio_free(GPIO_CAM_FLASH_EN);
return 0;
}
|
/* SPDX-License-Identifier: MIT */
#include <types.h>
#include <console/console.h>
#include <drivers/intel/gma/i915.h>
/* HDMI/DVI modes ignore everything but the last 2 items. So we share
* them for both DP and FDI transports, allowing those ports to
* automatically adapt to HDMI connections as well.
*/
static u32 hsw_ddi_translations_dp[] = {
0x00FFFFFF, 0x0006000E, /* DP parameters */
0x00D75FFF, 0x0005000A,
0x00C30FFF, 0x00040006,
0x80AAAFFF, 0x000B0000,
0x00FFFFFF, 0x0005000A,
0x00D75FFF, 0x000C0004,
0x80C30FFF, 0x000B0000,
0x00FFFFFF, 0x00040006,
0x80D75FFF, 0x000B0000,
0x00FFFFFF, 0x00040006 /* HDMI parameters */
};
static u32 hsw_ddi_translations_fdi[] = {
0x00FFFFFF, 0x0007000E, /* FDI parameters */
0x00D75FFF, 0x000F000A,
0x00C30FFF, 0x00060006,
0x00AAAFFF, 0x001E0000,
0x00FFFFFF, 0x000F000A,
0x00D75FFF, 0x00160004,
0x00C30FFF, 0x001E0000,
0x00FFFFFF, 0x00060006,
0x00D75FFF, 0x001E0000,
0x00FFFFFF, 0x00040006 /* HDMI parameters */
};
/* On Haswell, DDI port buffers must be programmed with correct values
* in advance. The buffer values are different for FDI and DP modes,
* but the HDMI/DVI fields are shared among those. So we program the DDI
* in either FDI or DP modes only, as HDMI connections will work with both
* of those.
*/
static void intel_prepare_ddi_buffers(int port, int use_fdi_mode)
{
u32 reg;
int i;
u32 *ddi_translations = ((use_fdi_mode) ?
hsw_ddi_translations_fdi :
hsw_ddi_translations_dp);
printk(BIOS_SPEW, "Initializing DDI buffers for port %d in %s mode\n",
port,
use_fdi_mode ? "FDI" : "DP");
for (i=0,reg=DDI_BUF_TRANS(port);i < ARRAY_SIZE(hsw_ddi_translations_fdi);i++) {
gtt_write(reg,ddi_translations[i]);
reg += 4;
}
}
void intel_prepare_ddi(void)
{
int port;
u32 use_fdi = 1;
for (port = PORT_A; port < PORT_E; port++)
intel_prepare_ddi_buffers(port, !use_fdi);
intel_prepare_ddi_buffers(PORT_E, use_fdi);
}
|
#undef CONFIG_FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE
|
/**
* Copyright (C) 2009 International Business Machines
* Author(s): Tyler Hicks <tyhicks@linux.vnet.ibm.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#include <errno.h>
#include <mntent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "ecryptfs.h"
static void usage()
{
fprintf(stderr, "\teCryptfs umount helper\n\tusage: "
"umount [ecryptfs mount point]\n"
);
exit(-EINVAL);
}
/**
* Parses a string of mount options, searching for an option name, and returns
* a pointer to the option value. For example, if name was "ecryptfs_sig=",
* it would set value to a string containing the sig, up to the first
* comma or NULL character in the mount options. Name must end with an = sign.
* value must be freed by the caller.
*/
static int get_mount_opt_value(char *mnt_opts, char *name, char **value)
{
char *name_start, *val_start, *val_stop;
size_t name_len, val_len;
int rc = 0;
name_len = strlen(name);
if (name[name_len - 1] != '=') {
rc = EINVAL;
goto out;
}
name_start = strstr(mnt_opts, name);
if (!name_start) {
rc = EINVAL;
goto out;
}
val_start = name_start + name_len;
val_stop = strstr(val_start, ",");
if (!val_stop)
val_stop = mnt_opts + strlen(mnt_opts);
val_len = val_stop - val_start;
*value = malloc(val_len + 1);
if (!(*value)) {
rc = ENOMEM;
goto out;
}
memcpy(*value, val_start, val_len);
(*value)[val_len] = '\0';
out:
return rc;
}
static int unlink_keys_from_keyring(const char *mnt_point)
{
struct mntent *mntent;
FILE *file;
char *fekek_sig = NULL, *fnek_sig = NULL;
int fekek_fail = 0, fnek_fail = 0;
int rc;
file = setmntent("/etc/mtab", "r");
if (!file) {
rc = EINVAL;
goto out;
}
while ((mntent = getmntent(file))) {
if (strcmp("ecryptfs", mntent->mnt_type))
continue;
if (strcmp(mnt_point, mntent->mnt_dir))
continue;
break;
}
if (!mntent) {
rc = EINVAL;
goto end_out;
}
if (!hasmntopt(mntent, "ecryptfs_unlink_sigs")) {
rc = 0;
goto end_out;
}
rc = get_mount_opt_value(mntent->mnt_opts, "ecryptfs_sig=", &fekek_sig);
if (!rc) {
fekek_fail = ecryptfs_remove_auth_tok_from_keyring(fekek_sig);
if (fekek_fail == ENOKEY)
fekek_fail = 0;
if (fekek_fail)
fprintf(stderr, "Failed to remove fekek with sig [%s] "
"from keyring: %s\n", fekek_sig,
strerror(fekek_fail));
} else {
fekek_fail = rc;
}
if (!get_mount_opt_value(mntent->mnt_opts,
"ecryptfs_fnek_sig=", &fnek_sig)
&& strcmp(fekek_sig, fnek_sig)) {
fnek_fail = ecryptfs_remove_auth_tok_from_keyring(fnek_sig);
if (fnek_fail == ENOKEY)
fnek_fail = 0;
if (fnek_fail) {
fprintf(stderr, "Failed to remove fnek with sig [%s] "
"from keyring: %s\n", fnek_sig,
strerror(fnek_fail));
}
}
free(fekek_sig);
free(fnek_sig);
end_out:
endmntent(file);
out:
return (fekek_fail ? fekek_fail : (fnek_fail ? fnek_fail : rc));
}
static int construct_umount_args(int argc, char **argv, char ***new_argv)
{
int new_argc = argc + 1;
int i, rc;
*new_argv = malloc(sizeof(char *) * (new_argc + 1));
if (!*new_argv) {
rc = errno;
goto out;
}
(*new_argv)[0] = "umount";
(*new_argv)[1] = "-i";
for (i = 2; i < new_argc; i++)
(*new_argv)[i] = argv[i - 1];
(*new_argv)[i] = NULL;
rc = 0;
out:
return rc;
}
#define UMOUNT_PATH "/bin/umount"
int main(int argc, char **argv)
{
char **new_argv;
int rc;
if (argc<2)
usage();
if (unlink_keys_from_keyring(argv[1]))
fprintf(stderr, "Could not unlink the key(s) from your keying. "
"Please use `keyctl unlink` if you wish to remove the "
"key(s). Proceeding with umount.\n");
rc = construct_umount_args(argc, argv, &new_argv);
if (rc) {
fprintf(stderr, "Failed to construct umount arguments: %s\n",
strerror(rc));
goto out;
}
rc = execv(UMOUNT_PATH, new_argv);
if (rc < 0) {
rc = errno;
fprintf(stderr, "Failed to execute %s: %m\n", UMOUNT_PATH);
goto free_out;
}
rc = 0;
free_out:
free(new_argv);
out:
return rc;
}
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <device/pci_ops.h>
#include <acpi/acpi.h>
#include <cpu/x86/smm.h>
#include <southbridge/intel/lynxpoint/pch.h>
#include "chip.h"
void acpi_fill_fadt(acpi_fadt_t *fadt)
{
struct device *dev = pcidev_on_root(0x1f, 0);
struct southbridge_intel_lynxpoint_config *cfg = dev->chip_info;
u16 pmbase = get_pmbase();
fadt->sci_int = 0x9;
if (permanent_smi_handler()) {
fadt->smi_cmd = APM_CNT;
fadt->acpi_enable = APM_CNT_ACPI_ENABLE;
fadt->acpi_disable = APM_CNT_ACPI_DISABLE;
}
fadt->pm1a_evt_blk = pmbase + PM1_STS;
fadt->pm1a_cnt_blk = pmbase + PM1_CNT;
fadt->pm2_cnt_blk = pmbase + PM2_CNT;
fadt->pm_tmr_blk = pmbase + PM1_TMR;
if (pch_is_lp())
fadt->gpe0_blk = pmbase + LP_GPE0_STS_1;
else
fadt->gpe0_blk = pmbase + GPE0_STS;
/*
* Some of the lengths here are doubled. This is because they describe
* blocks containing two registers, where the size of each register
* is found by halving the block length. See Table 5-34 and section
* 4.8.3 of the ACPI specification for details.
*/
fadt->pm1_evt_len = 2 * 2;
fadt->pm1_cnt_len = 2;
fadt->pm2_cnt_len = 1;
fadt->pm_tmr_len = 4;
if (pch_is_lp())
fadt->gpe0_blk_len = 2 * 16;
else
fadt->gpe0_blk_len = 2 * 8;
/* P_LVLx not used */
fadt->p_lvl2_lat = 101;
fadt->p_lvl3_lat = 1001;
fadt->duty_offset = 0;
fadt->duty_width = 0;
fadt->day_alrm = 0xd;
fadt->mon_alrm = 0x00;
fadt->iapc_boot_arch = ACPI_FADT_LEGACY_DEVICES | ACPI_FADT_8042;
fadt->flags |= ACPI_FADT_WBINVD |
ACPI_FADT_C1_SUPPORTED |
ACPI_FADT_SLEEP_BUTTON |
ACPI_FADT_SEALED_CASE |
ACPI_FADT_S4_RTC_WAKE |
ACPI_FADT_PLATFORM_CLOCK;
if (cfg && cfg->docking_supported)
fadt->flags |= ACPI_FADT_DOCKING_SUPPORTED;
fadt->x_pm1a_evt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm1a_evt_blk.bit_width = fadt->pm1_evt_len * 8;
fadt->x_pm1a_evt_blk.bit_offset = 0;
fadt->x_pm1a_evt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS;
fadt->x_pm1a_evt_blk.addrl = pmbase + PM1_STS;
fadt->x_pm1a_evt_blk.addrh = 0x0;
fadt->x_pm1a_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm1a_cnt_blk.bit_width = fadt->pm1_cnt_len * 8;
fadt->x_pm1a_cnt_blk.bit_offset = 0;
fadt->x_pm1a_cnt_blk.access_size = ACPI_ACCESS_SIZE_WORD_ACCESS;
fadt->x_pm1a_cnt_blk.addrl = pmbase + PM1_CNT;
fadt->x_pm1a_cnt_blk.addrh = 0x0;
fadt->x_pm2_cnt_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm2_cnt_blk.bit_width = fadt->pm2_cnt_len * 8;
fadt->x_pm2_cnt_blk.bit_offset = 0;
fadt->x_pm2_cnt_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
fadt->x_pm2_cnt_blk.addrl = pmbase + PM2_CNT;
fadt->x_pm2_cnt_blk.addrh = 0x0;
fadt->x_pm_tmr_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_pm_tmr_blk.bit_width = fadt->pm_tmr_len * 8;
fadt->x_pm_tmr_blk.bit_offset = 0;
fadt->x_pm_tmr_blk.access_size = ACPI_ACCESS_SIZE_DWORD_ACCESS;
fadt->x_pm_tmr_blk.addrl = pmbase + PM1_TMR;
fadt->x_pm_tmr_blk.addrh = 0x0;
/*
* Windows 10 requires x_gpe0_blk to be set starting with FADT revision 5.
* The bit_width field intentionally overflows here.
* The OSPM can instead use the values in `fadt->gpe0_blk{,_len}`, which
* seems to work fine on Linux 5.0 and Windows 10.
*/
fadt->x_gpe0_blk.space_id = ACPI_ADDRESS_SPACE_IO;
fadt->x_gpe0_blk.bit_width = fadt->gpe0_blk_len * 8;
fadt->x_gpe0_blk.bit_offset = 0;
fadt->x_gpe0_blk.access_size = ACPI_ACCESS_SIZE_BYTE_ACCESS;
fadt->x_gpe0_blk.addrl = fadt->gpe0_blk;
fadt->x_gpe0_blk.addrh = 0x0;
}
|
/* Definitions for PA_RISC with ELF-32 format
Copyright (C) 2000, 2002, 2004, 2006, 2007, 2010, 2011, 2012
Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3, or (at your option)
any later version.
GCC 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 GCC; see the file COPYING3. If not see
<http://www.gnu.org/licenses/>. */
/* Turn off various SOM crap we don't want. */
#undef TARGET_ELF32
#define TARGET_ELF32 1
|
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
* Date : 2007-10-24
* Description : XMP workflow status properties settings page.
*
* Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
* Public License as published by the Free Software Foundation;
* either version 2, 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.
*
* ============================================================ */
#ifndef XMP_PROPERTIES_H
#define XMP_PROPERTIES_H
// Qt includes
#include <QWidget>
#include <QByteArray>
namespace KIPIMetadataEditPlugin
{
class XMPProperties : public QWidget
{
Q_OBJECT
public:
XMPProperties(QWidget* const parent);
~XMPProperties();
void applyMetadata(QByteArray& xmpData);
void readMetadata(QByteArray& xmpData);
Q_SIGNALS:
void signalModified();
private:
class XMPPropertiesPriv;
XMPPropertiesPriv* const d;
};
} // namespace KIPIMetadataEditPlugin
#endif // XMP_PROPERTIES_H
|
struct list {
struct list *next, *prev;
};
static inline void
list_init(struct list *list)
{
list->next = list;
list->prev = list;
}
static inline int
list_empty(struct list *list)
{
return list->next == list;
}
static inline void
list_insert(struct list *link, struct list *new_link)
{
new_link->prev = link->prev;
new_link->next = link;
new_link->prev->next = new_link;
new_link->next->prev = new_link;
}
static inline void
list_append(struct list *list, struct list *new_link)
{
list_insert((struct list *)list, new_link);
}
static inline void
list_prepend(struct list *list, struct list *new_link)
{
list_insert(list->next, new_link);
}
static inline void
list_remove(struct list *link)
{
link->prev->next = link->next;
link->next->prev = link->prev;
}
#define list_entry(link, type, member) \
((type *)((char *)(link)-(unsigned long)(&((type *)0)->member)))
#define list_head(list, type, member) \
list_entry((list)->next, type, member)
#define list_tail(list, type, member) \
list_entry((list)->prev, type, member)
#define list_next(elm, member) \
list_entry((elm)->member.next, typeof(*elm), member)
#define list_for_each_entry(pos, list, member) \
for (pos = list_head(list, typeof(*pos), member); \
&pos->member != (list); \
pos = list_next(pos, member))
|
/*
# dyn_mpg123.h: dynamic linking for libmpg123
# Copyright (C) 2012 Stephen Fairchild (s-fairchild@users.sourceforge.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 in the file entitled COPYING.
# If not, see <http://www.gnu.org/licenses/>.
*/
#include "../config.h"
#ifdef DYN_MPG123
int dyn_mpg123_init();
#endif /* DYN_MPG123 */
|
/* Copyright (c) 2010, Code Aurora Forum. 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_RMNET_H_
#define _MSM_RMNET_H_
/* Bitmap macros for RmNET driver operation mode. */
#define RMNET_MODE_NONE (0x00)
#define RMNET_MODE_LLP_ETH (0x01)
#define RMNET_MODE_LLP_IP (0x02)
#define RMNET_MODE_QOS (0x04)
#define RMNET_MODE_MASK (RMNET_MODE_LLP_ETH | \
RMNET_MODE_LLP_IP | \
RMNET_MODE_QOS)
#define RMNET_IS_MODE_QOS(mode) \
((mode & RMNET_MODE_QOS) == RMNET_MODE_QOS)
#define RMNET_IS_MODE_IP(mode) \
((mode & RMNET_MODE_LLP_IP) == RMNET_MODE_LLP_IP)
/* IOCTL command enum
* Values chosen to not conflict with other drivers in the ecosystem */
enum rmnet_ioctl_cmds_e {
RMNET_IOCTL_SET_LLP_ETHERNET = 0x000089F1, /* Set Ethernet protocol */
RMNET_IOCTL_SET_LLP_IP = 0x000089F2, /* Set RAWIP protocol */
RMNET_IOCTL_GET_LLP = 0x000089F3, /* Get link protocol */
RMNET_IOCTL_SET_QOS_ENABLE = 0x000089F4, /* Set QoS header enabled */
RMNET_IOCTL_SET_QOS_DISABLE = 0x000089F5, /* Set QoS header disabled*/
RMNET_IOCTL_GET_QOS = 0x000089F6, /* Get QoS header state */
RMNET_IOCTL_GET_OPMODE = 0x000089F7, /* Get operation mode */
RMNET_IOCTL_OPEN = 0x000089F8, /* Open transport port */
RMNET_IOCTL_CLOSE = 0x000089F9, /* Close transport port */
RMNET_IOCTL_MAX
};
/* QMI QoS header definition */
#define QMI_QOS_HDR_S __attribute((__packed__)) qmi_qos_hdr_s
struct QMI_QOS_HDR_S {
unsigned char version;
unsigned char flags;
unsigned long flow_id;
};
#if 0
//#ifdef CONFIG_HUAWEI_KERNEL
/*
* if there have special requirement need to apply.
*/
#define RMNET_DEFAULT_MAX_MTU 1500
int rmnet_get_max_mtu(void);
#define RMNET_DATA_LEN (rmnet_get_max_mtu())
#endif
#endif /* _MSM_RMNET_H_ */
|
/*
* Copyright (C) 2009 Google Inc. 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 Google Inc. 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
* 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.
*/
#ifndef WebAccessibilityObject_h
#define WebAccessibilityObject_h
#include "WebAccessibilityRole.h"
#include "WebCommon.h"
#if WEBKIT_IMPLEMENTATION
namespace WebCore { class AccessibilityObject; }
namespace WTF { template <typename T> class PassRefPtr; }
#endif
namespace WebKit {
class WebAccessibilityObjectPrivate;
class WebString;
struct WebPoint;
struct WebRect;
// A container for passing around a reference to AccessibilityObject.
class WebAccessibilityObject {
public:
~WebAccessibilityObject() { reset(); }
WebAccessibilityObject() : m_private(0) { }
WebAccessibilityObject(const WebAccessibilityObject& o) : m_private(0) { assign(o); }
WebAccessibilityObject& operator=(const WebAccessibilityObject& o)
{
assign(o);
return *this;
}
WEBKIT_API void reset();
WEBKIT_API void assign(const WebAccessibilityObject&);
bool isNull() const { return !m_private; }
WebString accessibilityDescription() const;
WebString actionVerb() const;
bool canSetFocusAttribute() const;
bool canSetValueAttribute() const;
unsigned childCount() const;
WebAccessibilityObject childAt(unsigned) const;
WebAccessibilityObject firstChild() const;
WebAccessibilityObject focusedChild() const;
WebAccessibilityObject lastChild() const;
WebAccessibilityObject nextSibling() const;
WebAccessibilityObject parentObject() const;
WebAccessibilityObject previousSibling() const;
bool isAnchor() const;
bool isChecked() const;
bool isFocused() const;
bool isEnabled() const;
bool isHovered() const;
bool isIndeterminate() const;
bool isMultiSelectable() const;
bool isOffScreen() const;
bool isPasswordField() const;
bool isPressed() const;
bool isReadOnly() const;
bool isVisited() const;
WebRect boundingBoxRect() const;
WebString helpText() const;
WebAccessibilityObject hitTest(const WebPoint&) const;
WebString keyboardShortcut() const;
bool performDefaultAction() const;
WebAccessibilityRole roleValue() const;
WebString stringValue() const;
WebString title() const;
#if WEBKIT_IMPLEMENTATION
WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>&);
WebAccessibilityObject& operator=(const WTF::PassRefPtr<WebCore::AccessibilityObject>&);
operator WTF::PassRefPtr<WebCore::AccessibilityObject>() const;
#endif
private:
void assign(WebAccessibilityObjectPrivate*);
WebAccessibilityObjectPrivate* m_private;
};
} // namespace WebKit
#endif
|
#pragma once
/*
* Copyright (C) 2005-2013 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include <vector>
#include "cores/VideoRenderers/RenderFormats.h"
#include "cores/VideoRenderers/BaseRenderer.h"
class CDVDVideoCodec;
class CDVDAudioCodec;
class CDVDOverlayCodec;
class CDemuxStreamVideo;
class CDVDStreamInfo;
class CDVDCodecOption;
class CDVDCodecOptions;
class CDVDFactoryCodec
{
public:
static CDVDVideoCodec* CreateVideoCodec(CDVDStreamInfo &hint, const CRenderInfo &info = CRenderInfo());
static CDVDAudioCodec* CreateAudioCodec(CDVDStreamInfo &hint, bool allowpassthrough = true);
static CDVDOverlayCodec* CreateOverlayCodec(CDVDStreamInfo &hint );
static CDVDAudioCodec* OpenCodec(CDVDAudioCodec* pCodec, CDVDStreamInfo &hint, CDVDCodecOptions &options );
static CDVDVideoCodec* OpenCodec(CDVDVideoCodec* pCodec, CDVDStreamInfo &hint, CDVDCodecOptions &options );
static CDVDOverlayCodec* OpenCodec(CDVDOverlayCodec* pCodec, CDVDStreamInfo &hint, CDVDCodecOptions &options );
};
|
#ifndef __ACMEM_H__
#define __ACMEM_H__
#include <stddef.h>
#include "AdAChar.h"
#include "..\inc\zacmem.h"
#ifndef ACHAR
#define ACHAR ZTCHAR
#endif //#ifndef ACHAR
#ifndef acad__msize
#define acad__msize zcad__msize
#endif //#ifndef acad__msize
#ifndef acad__strdup
#define acad__strdup zcad__strdup
#endif //#ifndef acad__strdup
#ifndef acad_calloc
#define acad_calloc zcad_calloc
#endif //#ifndef acad_calloc
#ifndef acad_free
#define acad_free zcad_free
#endif //#ifndef acad_free
#ifndef acad_malloc
#define acad_malloc zcad_malloc
#endif //#ifndef acad_malloc
#ifndef acad_realloc
#define acad_realloc zcad_realloc
#endif //#ifndef acad_realloc
#endif //#ifndef __ACMEM_H__
|
#include "multi_inc2.h"
|
#ifndef OPT_STATUS_H
#define OPT_STATUS_H
#include <QMap>
#include <QSet>
#include <QStringList>
#include "optionstab.h"
#include "statuspreset.h"
class QWidget;
class OptionsTabStatus : public OptionsTab
{
Q_OBJECT
public:
OptionsTabStatus(QObject *parent);
~OptionsTabStatus();
QWidget *widget();
void applyOptions();
void restoreOptions();
void setData(PsiCon *, QWidget *parentDialog);
//bool stretchable() const { return true; }
private slots:
void selectStatusPreset(int x);
void newStatusPreset();
void removeStatusPreset();
void changeStatusPreset();
private:
void setStatusPresetWidgetsEnabled(bool);
QWidget *w, *parentWidget;
QMap<QString, StatusPreset> presets;
QSet<QString> dirtyPresets;
QStringList deletedPresets;
QMap<QString, StatusPreset> newPresets;
};
#endif
|
//*****************************************************************************
//
// usbhhidmouse.h - This file holds the application interfaces for USB
// mouse devices.
//
// Copyright (c) 2008-2010 Texas Instruments Incorporated. All rights reserved.
// Software License Agreement
//
// Texas Instruments (TI) is supplying this software for use solely and
// exclusively on TI's microcontroller products. The software is owned by
// TI and/or its suppliers, and is protected under applicable copyright
// laws. You may not combine this software with "viral" open-source
// software in order to form a larger program.
//
// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
// DAMAGES, FOR ANY REASON WHATSOEVER.
//
// This is part of AM1808 StarterWare USB Library, modified resused from revision 6288 of the
// stellaris USB Library.
//
//*****************************************************************************
#ifndef __USBHHIDMOUSE_H__
#define __USBHHIDMOUSE_H__
//*****************************************************************************
//
// If building with a C++ compiler, make all of the definitions in this header
// have a C binding.
//
//*****************************************************************************
#ifdef __cplusplus
extern "C"
{
#endif
//*****************************************************************************
//
//! \addtogroup usblib_host_device
//! @{
//
//*****************************************************************************
extern unsigned int USBHMouseOpen(tUSBCallback pfnCallback,
unsigned char *pucBuffer,
unsigned int ulBufferSize);
extern unsigned int USBHMouseClose(unsigned int ulInstance);
extern unsigned int USBHMouseInit(unsigned int ulInstance);
//*****************************************************************************
//
//! @}
//
//*****************************************************************************
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
#endif
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* libnm_glib -- Access network status & information from glib applications
*
* 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; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright (C) 2013 Red Hat, Inc.
*/
#ifndef NM_DBUS_HELPERS_PRIVATE_H
#define NM_DBUS_HELPERS_PRIVATE_H
#include <gio/gio.h>
#include <dbus/dbus.h>
#include <dbus/dbus-glib-lowlevel.h>
DBusGConnection *_nm_dbus_new_connection (GError **error);
gboolean _nm_dbus_is_connection_private (DBusGConnection *connection);
DBusGProxy * _nm_dbus_new_proxy_for_connection (DBusGConnection *connection,
const char *path,
const char *interface);
#endif /* NM_DBUS_HELPERS_PRIVATE_H */
|
/*
* $Id: dhaad_ha.c 1.14 06/05/07 21:52:42+03:00 anttit@tcs.hut.fi $
*
* This file is part of the MIPL Mobile IPv6 for Linux.
*
* Authors: Antti Tuominen <anttit@tcs.hut.fi>
* Ville Nuorvala <vnuorval@tcs.hut.fi>
*
* Copyright 2003-2005 Go-Core Project
* Copyright 2003-2006 Helsinki University of Technology
*
* MIPL Mobile IPv6 for Linux 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.
*
* MIPL Mobile IPv6 for Linux 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 MIPL Mobile IPv6 for Linux; if not, write to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <pthread.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <net/if.h>
#include <errno.h>
#include "icmp6.h"
#include "dhaad_ha.h"
#include "ha.h"
#include "debug.h"
#include "statistics.h"
static pthread_rwlock_t ha_lock;
/*********************************************************
* Home Agent functions
*********************************************************/
#ifdef ENABLE_VT
/**
* dhaad_halist_iterate - apply function to every home agent list entry
* @func: function to apply
* @arg: extra data for @func
**/
void dhaad_halist_iterate(struct ha_interface *iface,
int (* func)(int, void *, void *), void *arg)
{
struct list_head *lp;
list_for_each(lp, &iface->ha_list) {
struct home_agent *h;
int ret;
h = list_entry(lp, struct home_agent, list);
pthread_rwlock_rdlock(&ha_lock);
ret = func(iface->ifindex, h, arg);
pthread_rwlock_unlock(&ha_lock);
if (ret)
break;
}
}
#endif
static void dhaad_expire_halist(struct tq_elem *tqe)
{
pthread_rwlock_wrlock(&ha_lock);
if (!task_interrupted()) {
struct home_agent *ha = tq_data(tqe, struct home_agent, tqe);
list_del(&ha->list);
free(ha);
}
pthread_rwlock_unlock(&ha_lock);
}
void dhaad_insert_halist(struct ha_interface *i, uint16_t key,
uint16_t life_sec, uint16_t flags,
struct nd_opt_prefix_info *pinfo)
{
struct home_agent *ha = NULL, *tmp;
struct list_head *lp;
struct in6_addr *addr = &pinfo->nd_opt_pi_prefix;
pthread_rwlock_wrlock(&ha_lock);
list_for_each(lp, &i->ha_list) {
tmp = list_entry(lp, struct home_agent, list);
if (!IN6_ARE_ADDR_EQUAL(&tmp->addr, addr))
continue;
ha = tmp;
list_del(&ha->list);
break;
}
if (ha == NULL) {
/* allocate new HAL entry */
ha = malloc(sizeof(*ha));
if (ha == NULL) {
pthread_rwlock_unlock(&ha_lock);
return;
}
memset(ha, 0, sizeof(*ha));
ha->flags = flags;
ha->iface = i;
ha->addr = *addr;
INIT_LIST_HEAD(&ha->tqe.list);
}
ha->preference = key;
tssetsec(ha->lifetime, life_sec);
/* insert ha entry to the HAL */
list_for_each(lp, &i->ha_list) {
tmp = list_entry(lp, struct home_agent, list);
if (key >= tmp->preference) {
list_add_tail(&ha->list, &tmp->list);
add_task_rel(&ha->lifetime, &ha->tqe,
dhaad_expire_halist);
pthread_rwlock_unlock(&ha_lock);
return;
}
}
list_add_tail(&ha->list, &i->ha_list);
add_task_rel(&ha->lifetime, &ha->tqe, dhaad_expire_halist);
pthread_rwlock_unlock(&ha_lock);
return;
}
void dhaad_del_halist(struct ha_interface *i)
{
struct list_head *l, *n;
pthread_rwlock_wrlock(&ha_lock);
list_for_each_safe(l, n, &i->ha_list) {
struct home_agent *ha;
list_del(l);
ha = list_entry(l, struct home_agent, list);
del_task(&ha->tqe);
free(ha);
}
pthread_rwlock_unlock(&ha_lock);
}
static int dhaad_get_halist(struct ha_interface *i, uint16_t flags,
int max, struct iovec *iov)
{
struct list_head *lp;
int n = 0;
list_for_each(lp, &i->ha_list) {
struct home_agent *h;
h = list_entry(lp, struct home_agent, list);
if (!(flags & MIP_DHREQ_FLAG_SUPPORT_MR) ||
h->flags & ND_OPT_HAI_FLAG_SUPPORT_MR) {
n++;
iov[n].iov_len = sizeof(struct in6_addr);
iov[n].iov_base = &h->addr;
if (n >= max)
break;
}
}
return n;
}
static void dhaad_recv_req(const struct icmp6_hdr *ih, ssize_t len,
const struct in6_addr *src,
const struct in6_addr *dst,
__attribute__ ((unused)) int iif,
__attribute__ ((unused)) int hoplimit)
{
struct mip_dhaad_req *rqh = (struct mip_dhaad_req *)ih;
struct mip_dhaad_rep *rph;
struct iovec iov[MAX_HOME_AGENTS + 1];
int iovlen;
struct ha_interface *i;
struct in6_addr *ha_addr = NULL;
statistics_inc(&mipl_stat, MIPL_STATISTICS_IN_DHAAD_REQ);
/* validity check */
if (len < 0 || (size_t)len < sizeof(struct mip_dhaad_req))
return;
if ((i = ha_get_if_by_anycast(dst, &ha_addr)) == NULL) {
dbg("no halist for anycast address %x:%x:%x:%x:%x:%x:%x:%x\n",
NIP6ADDR(dst));
return;
}
if ((rph = icmp6_create(iov, MIP_HA_DISCOVERY_REPLY, 0)) == NULL)
return;
rph->mip_dhrep_id = rqh->mip_dhreq_id;
if (rqh->mip_dhreq_flags_reserved & MIP_DHREQ_FLAG_SUPPORT_MR)
rph->mip_dhrep_flags_reserved = MIP_DHREP_FLAG_SUPPORT_MR;
pthread_rwlock_rdlock(&ha_lock);
iovlen = dhaad_get_halist(i, rqh->mip_dhreq_flags_reserved,
MAX_HOME_AGENTS, iov);
icmp6_send(i->ifindex, 64, ha_addr, src, iov, iovlen + 1);
pthread_rwlock_unlock(&ha_lock);
free_iov_data(&iov[0], 1);
statistics_inc(&mipl_stat, MIPL_STATISTICS_OUT_DHAAD_REP);
}
static struct icmp6_handler dhaad_req_handler = {
.recv = dhaad_recv_req,
};
int dhaad_ha_init(void)
{
if (pthread_rwlock_init(&ha_lock, NULL))
return -1;
icmp6_handler_reg(MIP_HA_DISCOVERY_REQUEST, &dhaad_req_handler);
return 0;
}
void dhaad_ha_cleanup(void)
{
icmp6_handler_dereg(MIP_HA_DISCOVERY_REQUEST, &dhaad_req_handler);
}
|
/*
* Copyright (C) 2017 Jean-Christophe PLAGNIOL-VILLARD <plagnio@jcrosoft.com>
*
* Under GPL v2
*/
#include <common.h>
#include <init.h>
#include <driver.h>
#include <clock.h>
#include <efi.h>
#include <efi/efi.h>
#include <efi/efi-device.h>
#include <linux/err.h>
static uint64_t ticks = 1;
static void *efi_cs_evt;
static uint64_t efi_cs_read(void)
{
return ticks;
}
static void efi_cs_inc(void *event, void *ctx)
{
ticks++;
}
/* count ticks during a 1dms */
static uint64_t ticks_freq(void)
{
uint64_t ticks_start, ticks_end;
ticks_start = ticks;
BS->stall(1000);
ticks_end = ticks;
return (ticks_end - ticks_start) * 1000;
}
/* count ticks during a 20ms delay as on qemu x86_64 the max is 100Hz */
static uint64_t ticks_freq_x86(void)
{
uint64_t ticks_start, ticks_end;
ticks_start = ticks;
BS->stall(20 * 1000);
ticks_end = ticks;
return (ticks_end - ticks_start) * 50;
}
static int efi_cs_init(struct clocksource *cs)
{
efi_status_t efiret;
uint64_t freq;
efiret = BS->create_event(EFI_EVT_TIMER | EFI_EVT_NOTIFY_SIGNAL,
EFI_TPL_CALLBACK, efi_cs_inc, NULL, &efi_cs_evt);
if (EFI_ERROR(efiret))
return -efi_errno(efiret);
efiret = BS->set_timer(efi_cs_evt, EFI_TIMER_PERIODIC, 10);
if (EFI_ERROR(efiret)) {
BS->close_event(efi_cs_evt);
return -efi_errno(efiret);
}
freq = 1000 * 1000;
if (ticks_freq() < 800 * 1000) {
uint64_t nb_100ns;
freq = ticks_freq_x86();
if (freq == 0) {
BS->close_event(efi_cs_evt);
return -ENODEV;
}
nb_100ns = 10 * 1000 * 1000 / freq;
pr_warn("EFI Event timer too slow freq = %llu Hz\n", freq);
efiret = BS->set_timer(efi_cs_evt, EFI_TIMER_PERIODIC, nb_100ns);
if (EFI_ERROR(efiret)) {
BS->close_event(efi_cs_evt);
return -efi_errno(efiret);
}
}
cs->mult = clocksource_hz2mult(freq, cs->shift);
return 0;
}
static struct clocksource efi_cs = {
.read = efi_cs_read,
.mask = CLOCKSOURCE_MASK(64),
.shift = 0,
.init = efi_cs_init,
};
static int efi_cs_probe(struct device_d *dev)
{
return init_clock(&efi_cs);
}
static struct driver_d efi_cs_driver = {
.name = "efi-cs",
.probe = efi_cs_probe,
};
static int efi_cs_initcall(void)
{
return platform_driver_register(&efi_cs_driver);
}
/* for efi the time must be init at core initcall level */
core_initcall(efi_cs_initcall);
|
/*
htop - ColumnsPanel.c
(C) 2004-2015 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#include "MainPanel.h"
#include "Process.h"
#include "Platform.h"
#include "CRT.h"
#include <stdlib.h>
/*{
#include "Panel.h"
#include "Action.h"
#include "Settings.h"
typedef struct MainPanel_ {
Panel super;
State* state;
IncSet* inc;
Htop_Action *keys;
pid_t pidSearch;
} MainPanel;
typedef union {
int i;
void* v;
} Arg;
typedef bool(*MainPanel_ForeachProcessFn)(Process*, Arg);
#define MainPanel_getFunctionBar(this_) (((Panel*)(this_))->defaultBar)
}*/
static const char* const MainFunctions[] = {"Help ", "Setup ", "Search", "Filter", "Tree ", "SortBy", "Nice -", "Nice +", "Kill ", "Quit ", NULL};
void MainPanel_updateTreeFunctions(MainPanel* this, bool mode) {
FunctionBar* bar = MainPanel_getFunctionBar(this);
if (mode) {
FunctionBar_setLabel(bar, KEY_F(5), "Sorted");
FunctionBar_setLabel(bar, KEY_F(6), "Collap");
} else {
FunctionBar_setLabel(bar, KEY_F(5), "Tree ");
FunctionBar_setLabel(bar, KEY_F(6), "SortBy");
}
}
void MainPanel_pidSearch(MainPanel* this, int ch) {
Panel* super = (Panel*) this;
pid_t pid = ch-48 + this->pidSearch;
for (int i = 0; i < Panel_size(super); i++) {
Process* p = (Process*) Panel_get(super, i);
if (p && p->pid == pid) {
Panel_setSelected(super, i);
break;
}
}
this->pidSearch = pid * 10;
if (this->pidSearch > 10000000) {
this->pidSearch = 0;
}
}
static HandlerResult MainPanel_eventHandler(Panel* super, int ch) {
MainPanel* this = (MainPanel*) super;
HandlerResult result = IGNORED;
Htop_Reaction reaction = HTOP_OK;
if (EVENT_IS_HEADER_CLICK(ch)) {
int x = EVENT_HEADER_CLICK_GET_X(ch);
ProcessList* pl = this->state->pl;
Settings* settings = this->state->settings;
int hx = super->scrollH + x + 1;
ProcessField field = ProcessList_keyAt(pl, hx);
if (field == settings->sortKey) {
Settings_invertSortOrder(settings);
settings->treeView = false;
} else {
reaction |= Action_setSortKey(settings, field);
}
reaction |= HTOP_RECALCULATE | HTOP_REDRAW_BAR | HTOP_SAVE_SETTINGS;
result = HANDLED;
} else if (ch != ERR && this->inc->active) {
bool filterChanged = IncSet_handleKey(this->inc, ch, super, (IncMode_GetPanelValue) MainPanel_getValue, NULL);
if (filterChanged) {
this->state->pl->incFilter = IncSet_filter(this->inc);
reaction = HTOP_REFRESH | HTOP_REDRAW_BAR;
}
if (this->inc->found) {
reaction |= Action_follow(this->state);
reaction |= HTOP_KEEP_FOLLOWING;
}
result = HANDLED;
} else if (ch == 27) {
return HANDLED;
} else if (ch != ERR && ch > 0 && ch < KEY_MAX && this->keys[ch]) {
reaction |= (this->keys[ch])(this->state);
result = HANDLED;
} else if (isdigit(ch)) {
MainPanel_pidSearch(this, ch);
} else {
if (ch != ERR) {
this->pidSearch = 0;
} else {
reaction |= HTOP_KEEP_FOLLOWING;
}
}
if (reaction & HTOP_REDRAW_BAR) {
MainPanel_updateTreeFunctions(this, this->state->settings->treeView);
IncSet_drawBar(this->inc);
}
if (reaction & HTOP_UPDATE_PANELHDR) {
ProcessList_printHeader(this->state->pl, Panel_getHeader(super));
}
if (reaction & HTOP_REFRESH) {
result |= REDRAW;
}
if (reaction & HTOP_RECALCULATE) {
result |= RESCAN;
}
if (reaction & HTOP_SAVE_SETTINGS) {
this->state->settings->changed = true;
}
if (reaction & HTOP_QUIT) {
return BREAK_LOOP;
}
if (!(reaction & HTOP_KEEP_FOLLOWING)) {
this->state->pl->following = -1;
Panel_setSelectionColor(super, CRT_colors[PANEL_SELECTION_FOCUS]);
}
return result;
}
int MainPanel_selectedPid(MainPanel* this) {
Process* p = (Process*) Panel_getSelected((Panel*)this);
if (p) {
return p->pid;
}
return -1;
}
const char* MainPanel_getValue(MainPanel* this, int i) {
Process* p = (Process*) Panel_get((Panel*)this, i);
if (p)
return p->comm;
return "";
}
bool MainPanel_foreachProcess(MainPanel* this, MainPanel_ForeachProcessFn fn, Arg arg, bool* wasAnyTagged) {
Panel* super = (Panel*) this;
bool ok = true;
bool anyTagged = false;
for (int i = 0; i < Panel_size(super); i++) {
Process* p = (Process*) Panel_get(super, i);
if (p->tag) {
ok = fn(p, arg) && ok;
anyTagged = true;
}
}
if (!anyTagged) {
Process* p = (Process*) Panel_getSelected(super);
if (p) ok = fn(p, arg) && ok;
}
if (wasAnyTagged)
*wasAnyTagged = anyTagged;
return ok;
}
PanelClass MainPanel_class = {
.super = {
.extends = Class(Panel),
.delete = MainPanel_delete
},
.eventHandler = MainPanel_eventHandler
};
MainPanel* MainPanel_new() {
MainPanel* this = AllocThis(MainPanel);
Panel_init((Panel*) this, 1, 1, 1, 1, Class(Process), false, FunctionBar_new(MainFunctions, NULL, NULL));
this->keys = xCalloc(KEY_MAX, sizeof(Htop_Action));
this->inc = IncSet_new(MainPanel_getFunctionBar(this));
Action_setBindings(this->keys);
Platform_setBindings(this->keys);
return this;
}
void MainPanel_setState(MainPanel* this, State* state) {
this->state = state;
}
void MainPanel_delete(Object* object) {
Panel* super = (Panel*) object;
MainPanel* this = (MainPanel*) object;
Panel_done(super);
IncSet_delete(this->inc);
free(this->keys);
free(this);
}
|
// SPDX-License-Identifier: GPL-2.0
/* unix.c */
/* implements UNIX specific functions */
#include "ssrf.h"
#include "dive.h"
#include "file.h"
#include "subsurface-string.h"
#include "display.h"
#include "membuffer.h"
#include <stdlib.h>
#include <sys/types.h>
#include <dirent.h>
#include <fnmatch.h>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <pwd.h>
#include <zip.h>
// the DE should provide us with a default font and font size...
const char unix_system_divelist_default_font[] = "Sans";
const char *system_divelist_default_font = unix_system_divelist_default_font;
double system_divelist_default_font_size = -1.0;
void subsurface_OS_pref_setup(void)
{
// nothing
}
bool subsurface_ignore_font(const char *font)
{
// there are no old default fonts to ignore
UNUSED(font);
return false;
}
static const char *system_default_path_append(const char *append)
{
const char *home = getenv("HOME");
if (!home)
home = "~";
const char *path = "/.subsurface";
int len = strlen(home) + strlen(path) + 1;
if (append)
len += strlen(append) + 1;
char *buffer = (char *)malloc(len);
memset(buffer, 0, len);
strcat(buffer, home);
strcat(buffer, path);
if (append) {
strcat(buffer, "/");
strcat(buffer, append);
}
return buffer;
}
const char *system_default_directory(void)
{
static const char *path = NULL;
if (!path)
path = system_default_path_append(NULL);
return path;
}
const char *system_default_filename(void)
{
static const char *path = NULL;
if (!path) {
const char *user = getenv("LOGNAME");
if (empty_string(user))
user = "username";
char *filename = calloc(strlen(user) + 5, 1);
strcat(filename, user);
strcat(filename, ".xml");
path = system_default_path_append(filename);
free(filename);
}
return path;
}
int enumerate_devices(device_callback_t callback, void *userdata, unsigned int transport)
{
int index = -1, entries = 0;
DIR *dp = NULL;
struct dirent *ep = NULL;
size_t i;
FILE *file;
char *line = NULL;
char *fname;
size_t len;
if (transport & DC_TRANSPORT_SERIAL) {
const char *dirname = "/dev";
#ifdef __OpenBSD__
const char *patterns[] = {
"ttyU*",
"ttyC*",
NULL
};
#else
const char *patterns[] = {
"ttyUSB*",
"ttyS*",
"ttyACM*",
"rfcomm*",
NULL
};
#endif
dp = opendir(dirname);
if (dp == NULL) {
return -1;
}
while ((ep = readdir(dp)) != NULL) {
for (i = 0; patterns[i] != NULL; ++i) {
if (fnmatch(patterns[i], ep->d_name, 0) == 0) {
char filename[1024];
int n = snprintf(filename, sizeof(filename), "%s/%s", dirname, ep->d_name);
if (n >= (int)sizeof(filename)) {
closedir(dp);
return -1;
}
callback(filename, userdata);
if (is_default_dive_computer_device(filename))
index = entries;
entries++;
break;
}
}
}
closedir(dp);
}
#ifdef __linux__
if (transport & DC_TRANSPORT_USBSTORAGE) {
int num_uemis = 0;
file = fopen("/proc/mounts", "r");
if (file == NULL)
return index;
while ((getline(&line, &len, file)) != -1) {
char *ptr = strstr(line, "UEMISSDA");
if (!ptr)
ptr = strstr(line, "GARMIN");
if (ptr) {
char *end = ptr, *start = ptr;
while (start > line && *start != ' ')
start--;
if (*start == ' ')
start++;
while (*end != ' ' && *end != '\0')
end++;
*end = '\0';
fname = strdup(start);
callback(fname, userdata);
if (is_default_dive_computer_device(fname))
index = entries;
entries++;
num_uemis++;
free((void *)fname);
}
}
free(line);
fclose(file);
if (num_uemis == 1 && entries == 1) /* if we found only one and it's a mounted Uemis, pick it */
index = 0;
}
#endif
return index;
}
/* NOP wrappers to comform with windows.c */
int subsurface_rename(const char *path, const char *newpath)
{
return rename(path, newpath);
}
int subsurface_open(const char *path, int oflags, mode_t mode)
{
return open(path, oflags, mode);
}
FILE *subsurface_fopen(const char *path, const char *mode)
{
return fopen(path, mode);
}
void *subsurface_opendir(const char *path)
{
return (void *)opendir(path);
}
int subsurface_access(const char *path, int mode)
{
return access(path, mode);
}
int subsurface_stat(const char* path, struct stat* buf)
{
return stat(path, buf);
}
struct zip *subsurface_zip_open_readonly(const char *path, int flags, int *errorp)
{
return zip_open(path, flags, errorp);
}
int subsurface_zip_close(struct zip *zip)
{
return zip_close(zip);
}
/* win32 console */
void subsurface_console_init(void)
{
/* NOP */
}
void subsurface_console_exit(void)
{
/* NOP */
}
bool subsurface_user_is_root()
{
return geteuid() == 0;
}
|
/*****************************************************************************
* pce *
*****************************************************************************/
/*****************************************************************************
* File name: src/arch/macplus/hotkey.h *
* Created: 2010-11-05 by Hampa Hug <hampa@hampa.ch> *
* Copyright: (C) 2010-2011 Hampa Hug <hampa@hampa.ch> *
*****************************************************************************/
/*****************************************************************************
* This program is free software. You can redistribute it and / or modify it *
* under the terms of the GNU General Public License version 2 as published *
* by the Free Software Foundation. *
* *
* This program is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY, without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General *
* Public License for more details. *
*****************************************************************************/
#ifndef PCE_MACPLUS_HOTKEY_H
#define PCE_MACPLUS_HOTKEY_H 1
#include "macplus.h"
#include <drivers/video/keys.h>
int mac_set_hotkey (macplus_t *sim, pce_key_t key);
#endif
|
/* vi:set et ai sw=2 sts=2 ts=2: */
/*-
* Copyright (c) 2004-2007 Benedikt Meurer <benny@xfce.org>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc., 59 Temple
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __THUNAR_LIST_MODEL_H__
#define __THUNAR_LIST_MODEL_H__
#include <thunar/thunar-folder.h>
G_BEGIN_DECLS;
typedef struct _ThunarListModelClass ThunarListModelClass;
typedef struct _ThunarListModel ThunarListModel;
#define THUNAR_TYPE_LIST_MODEL (thunar_list_model_get_type ())
#define THUNAR_LIST_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THUNAR_TYPE_LIST_MODEL, ThunarListModel))
#define THUNAR_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), THUNAR_TYPE_LIST_MODEL, ThunarListModelClass))
#define THUNAR_IS_LIST_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THUNAR_TYPE_LIST_MODEL))
#define THUNAR_IS_LIST_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), THUNAR_TYPE_LIST_MODEL))
#define THUNAR_LIST_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THUNAR_TYPE_LIST_MODEL, ThunarListModelClass))
GType thunar_list_model_get_type (void) G_GNUC_CONST;
ThunarListModel *thunar_list_model_new (void);
ThunarFolder *thunar_list_model_get_folder (ThunarListModel *store);
void thunar_list_model_set_folder (ThunarListModel *store,
ThunarFolder *folder);
void thunar_list_model_set_folders_first (ThunarListModel *store,
gboolean folders_first);
gboolean thunar_list_model_get_show_hidden (ThunarListModel *store);
void thunar_list_model_set_show_hidden (ThunarListModel *store,
gboolean show_hidden);
gboolean thunar_list_model_get_file_size_binary (ThunarListModel *store);
void thunar_list_model_set_file_size_binary (ThunarListModel *store,
gboolean file_size_binary);
ThunarFile *thunar_list_model_get_file (ThunarListModel *store,
GtkTreeIter *iter);
GList *thunar_list_model_get_paths_for_files (ThunarListModel *store,
GList *files);
GList *thunar_list_model_get_paths_for_pattern (ThunarListModel *store,
const gchar *pattern);
gchar *thunar_list_model_get_statusbar_text (ThunarListModel *store,
GList *selected_items);
G_END_DECLS;
#endif /* !__THUNAR_LIST_MODEL_H__ */
|
/*
* This file is part of the coreboot project.
*
* Copyright 2011 Google 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.
*/
#ifndef TPM_H_
#define TPM_H_
#include <stddef.h>
#include <stdint.h>
enum tis_access {
TPM_ACCESS_VALID = (1 << 7),
TPM_ACCESS_ACTIVE_LOCALITY = (1 << 5),
TPM_ACCESS_REQUEST_PENDING = (1 << 2),
TPM_ACCESS_REQUEST_USE = (1 << 1),
TPM_ACCESS_ESTABLISHMENT = (1 << 0),
};
enum tis_status {
TPM_STS_FAMILY_SHIFT = 26,
TPM_STS_FAMILY_MASK = (0x3 << TPM_STS_FAMILY_SHIFT),
TPM_STS_FAMILY_TPM_2_0 = (1 << TPM_STS_FAMILY_SHIFT),
TPM_STS_FAMILY_TPM_1_2 = (0 << TPM_STS_FAMILY_SHIFT),
TPM_STS_RESET_ESTABLISHMENT = (1 << 25),
TPM_STS_COMMAND_CANCEL = (1 << 24),
TPM_STS_BURST_COUNT_SHIFT = 8,
TPM_STS_BURST_COUNT_MASK = (0xFFFF << TPM_STS_BURST_COUNT_SHIFT),
TPM_STS_VALID = (1 << 7),
TPM_STS_COMMAND_READY = (1 << 6),
TPM_STS_GO = (1 << 5),
TPM_STS_DATA_AVAIL = (1 << 4),
TPM_STS_DATA_EXPECT = (1 << 3),
TPM_STS_SELF_TEST_DONE = (1 << 2),
TPM_STS_RESPONSE_RETRY = (1 << 1),
};
/*
* tis_init()
*
* Initialize the TPM device. Returns 0 on success or -1 on
* failure (in case device probing did not succeed).
*/
int tis_init(void);
/*
* tis_open()
*
* Requests access to locality 0 for the caller. After all commands have been
* completed the caller is supposed to call tis_close().
*
* Returns 0 on success, -1 on failure.
*/
int tis_open(void);
/*
* tis_close()
*
* terminate the currect session with the TPM by releasing the locked
* locality. Returns 0 on success of -1 on failure (in case lock
* removal did not succeed).
*/
int tis_close(void);
/*
* tis_sendrecv()
*
* Send the requested data to the TPM and then try to get its response
*
* @sendbuf - buffer of the data to send
* @send_size size of the data to send
* @recvbuf - memory to save the response to
* @recv_len - pointer to the size of the response buffer
*
* Returns 0 on success (and places the number of response bytes at recv_len)
* or -1 on failure.
*/
int tis_sendrecv(const u8 *sendbuf, size_t send_size, u8 *recvbuf,
size_t *recv_len);
void init_tpm(int s3resume);
/*
* tis_plat_irq_status()
*
* Check tpm irq and clear it.
*
* Returns 1 when irq pending or 0 when not.
*/
int tis_plat_irq_status(void);
#endif /* TPM_H_ */
|
//
// GiveInstructions.c
// 5.6.4_calendar
//
// Created by Cirno MainasuK on 2015-1-10.
// Copyright (c) 2015年 Cirno MainasuK. All rights reserved.
//
#include <stdio.h>
// This percedure prints out instructions to the user.
void GiveInstructions(void) {
printf("This program displays a calendar for a full\n");
printf("year. The year must not be before 1900.\n");
} |
#ifndef __BSP_MODULE_H
#define __BSP_MODULE_H
#if defined(__OS_RTOSCK__)
#include <sre_buildef.h>
/*ÅäÖÃϵͳ֧³ÖµÄ×î´ómodule¸öÊý*/
#ifndef CONFIG_MODULE_MAX_NUM
#define CONFIG_MODULE_MAX_NUM 200
#endif
/*ÅäÖÃmodule¾²Ì¬³õʼ»¯ÓÅÏȼ¶*/
typedef enum _module_level
{
mod_level_libc_init = 0,
mod_level_dts,
mod_level_HardBoot_end, /*SRE_HardBootInit½×¶ÎµÄ·Å´Ë֮ǰ*/
mod_level_l2cache,
mod_level_gic,
mod_level_syslog_cb,
mod_level_serial,
mod_level_HardDrv_end, /*SRE_HardDrvInit ½×¶ÎµÄ·Å´Ë֮ǰ*/
mod_level_dt_sysctrl,
mod_level_share_mem,
mod_level_timer,
mod_level_fiq,
mod_level_dump_mem,
mod_level_dmesg,
mod_level_coresight,
mod_level_pdlock,
mod_level_dump,
/* bsp_drivers */
mod_level_console,
mod_level_pm_om_dump,
mod_level_clk,
mod_level_systimer,
mod_level_rsracc,
mod_level_wakelock,
mod_level_dpm,
mod_level_watchpoint,
mod_level_hardtimer,
mod_level_vic,
mod_level_ipc,
mod_level_dump_phase2,
mod_level_reset_node,
mod_level_icc,
mod_level_pdlock2,
mod_level_vshell,
mod_level_nvm,
mod_level_amon,
mod_level_rfile,
mod_level_version_core,
mod_level_hwspinlock,
mod_level_hkadc,
mod_level_version,
mod_level_hwadp,
mod_level_softtimer,
mod_level_edma,
mod_level_socp,
mod_level_dual_modem,
mod_level_dsp,
mod_level_dsp_load,
mod_level_bbp,
mod_level_board_fpga,
mod_level_gpio,
mod_level_pmu,
mod_level_regulator,
mod_level_mipi,
mod_level_cross_mipi,
mod_level_pinctrl,
mod_level_rffe,
mod_level_watchdog,
mod_level_i2c,
mod_level_efuse,
mod_level_tsensor,
mod_level_led,
mod_level_loadps_core,
mod_level_cipher,
mod_level_ipf,
mod_level_psam,
mod_level_mailbox,
mod_level_xmailbox,
mod_level_anten,
mod_level_mem,
mod_level_sci_cfg,
mod_level_abb,
mod_level_remote_clk,
mod_level_onoff,
mod_level_cpufreq,
mod_level_pm,
mod_level_reset,
mod_level_modem_log,
mod_level_pmomlog,
mod_level_pm_wakeup_debug,
mod_level_ddrtst_pm,
mod_level_sysbus_core,
mod_level_dsp_dvs,
mod_level_dsp_dfs, /* dspdfs³õʼ»¯ÐèÒª·ÅÔÚdspdvsµÄºóÃæ */
mod_level_dload,
mod_level_rsracc_late,
mod_level_psroot,
mod_level_dump_mem_debug,
mod_level_regidle,
mod_level_dump_init_tsk,
mod_level_onoff_modem_ok,
mod_level_App_end/*SRE_AppInit½×¶ÎµÄ·Å´Ë֮ǰ*/
} module_level;
/*
* module³õʼ»¯ÐÅÏ¢½á¹¹Ìå
*/
typedef int (*modcall_t)(void);
struct module
{
const char name[32];
modcall_t init_fun;
modcall_t exit_fun;
module_level level;
const char init_func_name[64];
const char exit_func_name[64];
};
/*module³õʼ»¯×¢²á½Ó¿Ú*/
#define __init __attribute__((section(".init.text")))
#define __exit __attribute__((section(".exit.text")))
#define __used __attribute__((__used__))
#define module_init(name, initlevel, initcall,exitcall) \
__used __attribute__((section(".mod.info"))) static struct module __mod_##initcall \
= { name, initcall, exitcall, initlevel, #initcall ,#exitcall}
/**
* @brief module³õʼ»¯Èë¿Ú¡£
*
* @par ÃèÊö:
* Èë²ÎΪ²»Í¬³õʼ»¯½×¶ÎµÄÓÅÏȼ¶Ë®Ïß¡£
*
* @attention
* Ö»ÔÚϵͳÆô¶¯½×¶Îµ÷ÓÃ
* *
* @retval
*ÎÞ
* @par ÒÀÀµ:
*ÎÞ
*/
void bsp_module_init(module_level module_level_t);
/**
* @brief module¼ÓÔØ
*
* @par ÃèÊö:
* ´ý¼ÓÔØµÄmoduleÃû×Ö
*
* @attention
* *½Ó¿ÚÀïʹÓÃÐźÅÁ¿£¬»áÔì³ÉÐÝÃß
* *
* @retval
*·µ»Ø´ý¼ÓÔØmoduleµÄ¿ØÖƽṹÌå
* @par ÒÀÀµ:
*rfile\icc\ipc\
*/
struct module * bsp_module_get(const char *module_name);
/**
* @brief moduleÐ¶ÔØ
*
* @par ÃèÊö:
* ´ýÐ¶ÔØµÄmoduleÃû×Ö
*
* @attention
* *½Ó¿ÚÀïʹÓÃÐźÅÁ¿£¬»áÔì³ÉÐÝÃß
* @retval
* @par ÒÀÀµ:
*ÎÞ
*/
int bsp_module_put(struct module *module);
#endif
#endif
|
/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
* vim:expandtab:shiftwidth=8:tabstop=8:
*
* GPL HEADER START
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 only,
* 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 version 2 for more details (a copy is included
* in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License
* version 2 along with this program; If not, see
* http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
*
* Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
* CA 95054 USA or visit www.sun.com if you need additional information or
* have any questions.
*
* GPL HEADER END
*/
/*
* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* Lustre is a trademark of Sun Microsystems, Inc.
*/
#ifndef __LIBCFS_WINNT_TRACEFILE_H__
#define __LIBCFS_WINNT_TRACEFILE_H__
/**
* only define one trace_data type for windows
*/
typedef enum {
CFS_TCD_TYPE_PASSIVE = 0,
CFS_TCD_TYPE_DISPATCH,
CFS_TCD_TYPE_MAX
} cfs_trace_buf_type_t;
#endif
|
/* PCSX2 - PS2 Emulator for PCs
* Copyright (C) 2002-2021 PCSX2 Dev Team
*
* PCSX2 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* PCSX2 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 PCSX2.
* If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/Pcsx2Defs.h"
#include "common/HashCombine.h"
#include "common/GL/Program.h"
#include <cstdio>
#include <functional>
#include <optional>
#include <string>
#include <string_view>
#include <unordered_map>
#include <vector>
namespace GL
{
class ShaderCache
{
public:
using PreLinkCallback = std::function<void(Program&)>;
ShaderCache();
~ShaderCache();
bool Open(bool is_gles, std::string_view base_path, u32 version);
std::optional<Program> GetProgram(const std::string_view vertex_shader, const std::string_view geometry_shader,
const std::string_view fragment_shader, const PreLinkCallback& callback = {});
bool GetProgram(Program* out_program, const std::string_view vertex_shader, const std::string_view geometry_shader,
const std::string_view fragment_shader, const PreLinkCallback& callback = {});
private:
static constexpr u32 FILE_VERSION = 1;
struct CacheIndexKey
{
u64 vertex_source_hash_low;
u64 vertex_source_hash_high;
u32 vertex_source_length;
u64 geometry_source_hash_low;
u64 geometry_source_hash_high;
u32 geometry_source_length;
u64 fragment_source_hash_low;
u64 fragment_source_hash_high;
u32 fragment_source_length;
bool operator==(const CacheIndexKey& key) const;
bool operator!=(const CacheIndexKey& key) const;
};
struct CacheIndexEntryHasher
{
std::size_t operator()(const CacheIndexKey& e) const noexcept
{
std::size_t h = 0;
HashCombine(h,
e.vertex_source_hash_low, e.vertex_source_hash_high, e.vertex_source_length,
e.geometry_source_hash_low, e.geometry_source_hash_high, e.geometry_source_length,
e.fragment_source_hash_low, e.fragment_source_hash_high, e.fragment_source_length);
return h;
}
};
struct CacheIndexData
{
u32 file_offset;
u32 blob_size;
u32 blob_format;
};
using CacheIndex = std::unordered_map<CacheIndexKey, CacheIndexData, CacheIndexEntryHasher>;
static CacheIndexKey GetCacheKey(const std::string_view& vertex_shader, const std::string_view& geometry_shader,
const std::string_view& fragment_shader);
std::string GetIndexFileName() const;
std::string GetBlobFileName() const;
bool CreateNew(const std::string& index_filename, const std::string& blob_filename);
bool ReadExisting(const std::string& index_filename, const std::string& blob_filename);
void Close();
bool Recreate();
std::optional<Program> CompileProgram(const std::string_view& vertex_shader, const std::string_view& geometry_shader,
const std::string_view& fragment_shader, const PreLinkCallback& callback,
bool set_retrievable);
std::optional<Program> CompileAndAddProgram(const CacheIndexKey& key, const std::string_view& vertex_shader,
const std::string_view& geometry_shader,
const std::string_view& fragment_shader, const PreLinkCallback& callback);
std::string m_base_path;
std::FILE* m_index_file = nullptr;
std::FILE* m_blob_file = nullptr;
CacheIndex m_index;
u32 m_version = 0;
bool m_program_binary_supported = false;
};
} // namespace GL
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.