text
stringlengths 4
6.14k
|
|---|
/* MI Command Set - disassemble commands.
Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
Contributed by Cygnus Solutions (a Red Hat company).
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "defs.h"
#include "target.h"
#include "value.h"
#include "mi-cmds.h"
#include "mi-getopt.h"
#include "gdb_string.h"
#include "ui-out.h"
#include "disasm.h"
/* The arguments to be passed on the command line and parsed here are:
either:
START-ADDRESS: address to start the disassembly at.
END-ADDRESS: address to end the disassembly at.
or:
FILENAME: The name of the file where we want disassemble from.
LINE: The line around which we want to disassemble. It will
disassemble the function that contins that line.
HOW_MANY: Number of disassembly lines to display. In mixed mode, it
is the number of disassembly lines only, not counting the source
lines.
always required:
MODE: 0 or 1 for disassembly only, or mixed source and disassembly,
respectively. */
void
mi_cmd_disassemble (char *command, char **argv, int argc)
{
CORE_ADDR start;
int mixed_source_and_assembly;
struct symtab *s;
/* Which options have we processed ... */
int file_seen = 0;
int line_seen = 0;
int num_seen = 0;
int start_seen = 0;
int end_seen = 0;
/* ... and their corresponding value. */
char *file_string = NULL;
int line_num = -1;
int how_many = -1;
CORE_ADDR low = 0;
CORE_ADDR high = 0;
/* Options processing stuff. */
int optind = 0;
char *optarg;
enum opt
{
FILE_OPT, LINE_OPT, NUM_OPT, START_OPT, END_OPT
};
static struct mi_opt opts[] = {
{"f", FILE_OPT, 1},
{"l", LINE_OPT, 1},
{"n", NUM_OPT, 1},
{"s", START_OPT, 1},
{"e", END_OPT, 1},
{ 0, 0, 0 }
};
/* Get the options with their arguments. Keep track of what we
encountered. */
while (1)
{
int opt = mi_getopt ("mi_cmd_disassemble", argc, argv, opts,
&optind, &optarg);
if (opt < 0)
break;
switch ((enum opt) opt)
{
case FILE_OPT:
file_string = xstrdup (optarg);
file_seen = 1;
break;
case LINE_OPT:
line_num = atoi (optarg);
line_seen = 1;
break;
case NUM_OPT:
how_many = atoi (optarg);
num_seen = 1;
break;
case START_OPT:
low = parse_and_eval_address (optarg);
start_seen = 1;
break;
case END_OPT:
high = parse_and_eval_address (optarg);
end_seen = 1;
break;
}
}
argv += optind;
argc -= optind;
/* Allow only filename + linenum (with how_many which is not
required) OR start_addr + and_addr */
if (!((line_seen && file_seen && num_seen && !start_seen && !end_seen)
|| (line_seen && file_seen && !num_seen && !start_seen && !end_seen)
|| (!line_seen && !file_seen && !num_seen && start_seen && end_seen)))
error
("mi_cmd_disassemble: Usage: ( [-f filename -l linenum [-n howmany]] | [-s startaddr -e endaddr]) [--] mixed_mode.");
if (argc != 1)
error
("mi_cmd_disassemble: Usage: [-f filename -l linenum [-n howmany]] [-s startaddr -e endaddr] [--] mixed_mode.");
mixed_source_and_assembly = atoi (argv[0]);
if ((mixed_source_and_assembly != 0) && (mixed_source_and_assembly != 1))
error (_("mi_cmd_disassemble: Mixed_mode argument must be 0 or 1."));
/* We must get the function beginning and end where line_num is
contained. */
if (line_seen && file_seen)
{
s = lookup_symtab (file_string);
if (s == NULL)
error (_("mi_cmd_disassemble: Invalid filename."));
if (!find_line_pc (s, line_num, &start))
error (_("mi_cmd_disassemble: Invalid line number"));
if (find_pc_partial_function (start, NULL, &low, &high) == 0)
error (_("mi_cmd_disassemble: No function contains specified address"));
}
gdb_disassembly (uiout,
file_string,
line_num,
mixed_source_and_assembly, how_many, low, high);
}
|
/*
* Copyright (c) 2017, 2020, Oracle and/or its affiliates.
*
* 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. Neither the name of the copyright holder nor the names of its contributors may be used to
* endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <graalvm/llvm/polyglot.h>
#include <graalvm/llvm/handles.h>
int main() {
void *p = polyglot_import("object");
void *p1 = create_handle(p);
void *p2 = resolve_handle(p1);
if (p != p2) {
return 1;
}
return 0;
}
|
#ifndef Podd_THaVDCPoint_h_
#define Podd_THaVDCPoint_h_
///////////////////////////////////////////////////////////////////////////////
// //
// THaVDCPoint //
// //
// A pair of one U and one V VDC cluster in a given VDC chamber //
// //
///////////////////////////////////////////////////////////////////////////////
#include "THaCluster.h"
#include "THaVDCCluster.h"
class THaVDCChamber;
class THaTrack;
class THaVDCPoint : public THaCluster {
public:
THaVDCPoint( THaVDCCluster* u_cl, THaVDCCluster* v_cl,
THaVDCChamber* chamber );
virtual ~THaVDCPoint() {}
void CalcDetCoords();
// Get and Set Functions
THaVDCCluster* GetUCluster() const { return fUClust; }
THaVDCCluster* GetVCluster() const { return fVClust; }
THaVDCChamber* GetChamber() const { return fChamber; }
THaVDCPoint* GetPartner() const { return fPartner; }
THaTrack* GetTrack() const { return fTrack; }
Double_t GetU() const;
Double_t GetV() const;
Double_t GetX() const { return fX; }
Double_t GetY() const { return fY; }
Double_t GetTheta() const { return fTheta; }
Double_t GetPhi() const { return fPhi; }
Int_t GetTrackIndex() const;
Double_t GetZU() const;
Double_t GetZV() const;
Double_t GetZ() const { return GetZU(); }
Bool_t HasPartner() const { return (fPartner != 0); }
void CalcChisquare(Double_t &chi2, Int_t &nhits) const;
void SetTrack( THaTrack* track);
void SetPartner( THaVDCPoint* partner) { fPartner = partner;}
void SetSlopes( Double_t mu, Double_t mv );
protected:
THaVDCCluster* fUClust; // Cluster in the U plane
THaVDCCluster* fVClust; // Cluster in the V plane
THaVDCChamber* fChamber; // Chamber of this cluster pair
THaTrack* fTrack; // Track that this point is associated with
THaVDCPoint* fPartner; // Point associated with this one in
// the other chamber
// Detector system coordinates derived from fUClust and fVClust
// at the U plane (z = GetZ()). X,Y in m; theta, phi in tan(angle)
Double_t fX; // X position of point in U wire plane
Double_t fY; // Y position of point in U wire plane
Double_t fTheta; // tan(angle between z-axis and track proj onto xz plane)
Double_t fPhi; // tan(angle between z-axis and track proj onto yz plane)
void Set( Double_t x, Double_t y, Double_t theta, Double_t phi )
{ fX = x; fY = y; fTheta = theta; fPhi = phi; }
private:
// Hide copy ctor and op=
THaVDCPoint( const THaVDCPoint& );
THaVDCPoint& operator=( const THaVDCPoint& );
ClassDef(THaVDCPoint,0) // Pair of one U and one V cluster in a VDC chamber
};
//-------------------- inlines ------------------------------------------------
inline
Double_t THaVDCPoint::GetU() const
{
// Return intercept of u cluster
return fUClust->GetIntercept();
}
//_____________________________________________________________________________
inline
Double_t THaVDCPoint::GetV() const
{
// Return intercept of v cluster
return fVClust->GetIntercept();
}
///////////////////////////////////////////////////////////////////////////////
#endif
|
/* Table of relaxations for Xtensa assembly.
Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
GAS is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GAS is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GAS; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef XTENSA_RELAX_H
#define XTENSA_RELAX_H
#include "xtensa-isa.h"
/* Data structures for the table-driven relaxations for Xtensa processors.
See xtensa-relax.c for details. */
typedef struct transition_list TransitionList;
typedef struct transition_table TransitionTable;
typedef struct transition_rule TransitionRule;
typedef struct precondition_list PreconditionList;
typedef struct precondition Precondition;
typedef struct req_or_option_list ReqOrOptionList;
typedef struct req_or_option_list ReqOrOption;
typedef struct req_option_list ReqOptionList;
typedef struct req_option_list ReqOption;
struct transition_table
{
int num_opcodes;
TransitionList **table; /* Possible transitions for each opcode. */
};
struct transition_list
{
TransitionRule *rule;
TransitionList *next;
};
struct precondition_list
{
Precondition *precond;
PreconditionList *next;
};
/* The required options for a rule are represented with a two-level
structure, with leaf expressions combined by logical ORs at the
lower level, and the results then combined by logical ANDs at the
top level. The AND terms are linked in a list, and each one can
contain a reference to a list of OR terms. The leaf expressions,
i.e., the OR options, can be negated by setting the is_true field
to FALSE. There are two classes of leaf expressions: (1) those
that are properties of the Xtensa configuration and can be
evaluated once when building the tables, and (2) those that depend
of the state of directives or other settings that may vary during
the assembly. The following expressions may be used in group (1):
IsaUse*: Xtensa configuration settings.
realnop: TRUE if the instruction set includes a NOP instruction.
There are currently no expressions in group (2), but they are still
supported since there is a good chance they'll be needed again for
something. */
struct req_option_list
{
ReqOrOptionList *or_option_terms;
ReqOptionList *next;
};
struct req_or_option_list
{
char *option_name;
bfd_boolean is_true;
ReqOrOptionList *next;
};
/* Operand types and constraints on operands: */
typedef enum op_type OpType;
typedef enum cmp_op CmpOp;
enum op_type
{
OP_CONSTANT,
OP_OPERAND,
OP_OPERAND_LOW8, /* Sign-extended low 8 bits of immed. */
OP_OPERAND_HI24S, /* High 24 bits of immed,
plus 0x100 if low 8 bits are signed. */
OP_OPERAND_F32MINUS, /* 32 - immed. */
OP_OPERAND_LOW16U, /* Low 16 bits of immed. */
OP_OPERAND_HI16U, /* High 16 bits of immed. */
OP_LITERAL,
OP_LABEL
};
enum cmp_op
{
OP_EQUAL,
OP_NOTEQUAL,
};
struct precondition
{
CmpOp cmp;
int op_num;
OpType typ; /* CONSTANT: op_data is a constant.
OPERAND: operand op_num must equal op_data.
Cannot be LITERAL or LABEL. */
int op_data;
};
typedef struct build_op BuildOp;
struct build_op
{
int op_num;
OpType typ;
unsigned op_data; /* CONSTANT: op_data is the value to encode.
OPERAND: op_data is the field in the
source instruction to take the value from
and encode in the op_num field here.
LITERAL or LABEL: op_data is the ordinal
that identifies the appropriate one, i.e.,
there can be more than one literal or
label in an expansion. */
BuildOp *next;
};
typedef struct build_instr BuildInstr;
typedef enum instr_type InstrType;
enum instr_type
{
INSTR_INSTR,
INSTR_LITERAL_DEF,
INSTR_LABEL_DEF
};
struct build_instr
{
InstrType typ;
unsigned id; /* LITERAL_DEF or LABEL_DEF: an ordinal to
identify which one. */
xtensa_opcode opcode; /* Unused for LITERAL_DEF or LABEL_DEF. */
BuildOp *ops;
BuildInstr *next;
};
struct transition_rule
{
xtensa_opcode opcode;
PreconditionList *conditions;
ReqOptionList *options;
BuildInstr *to_instr;
};
typedef int (*transition_cmp_fn) (const TransitionRule *,
const TransitionRule *);
extern TransitionTable *xg_build_simplify_table (transition_cmp_fn);
extern TransitionTable *xg_build_widen_table (transition_cmp_fn);
extern bfd_boolean xg_has_userdef_op_fn (OpType);
extern long xg_apply_userdef_op_fn (OpType, long);
#endif /* !XTENSA_RELAX_H */
|
/*
* This is free software, licensed under the GNU General Public License v2.
* See /LICENSE for more information.
*
* Copyright (C) 2015 Álvaro Fernández Rojas <[email protected]>
*/
#ifndef _NAND_H
#define _NAND_H
#define NAND_PAGE_DEF 2048
#define NAND_OOB_DEF 64
#define NAND_CHECK_ENTRIES 1
#define DEBUG_DEF 0
#define DEBUG_PROG 5
#define pr_info(...) printf(__VA_ARGS__)
#define pr_err(...) fprintf(stderr, __VA_ARGS__)
enum errors {
NO_ERROR = 0,
ERROR_ARGS,
ERROR_PTR,
ERROR_FILE,
ERROR_SEEK,
ERROR_READ,
ERROR_WRITE,
ERROR_ENTRIES
};
int nand_clean_oob(int debug, int ifd, int ofd, ssize_t size, int nand_page, int nand_oob, int nand_entries);
void nand_tools_version(void);
#endif /* _NAND_H */
|
/*
** tr2latex - troff to LaTeX converter
** $Id: setups.h,v 1.1.1.1 1992/04/27 15:20:56 teuben Exp $
** COPYRIGHT (C) 1987 Kamal Al-Yahya, 1991,1992 Christian Engel
**
** Module: setups.h
**
** setup file
*/
#ifdef __TURBOC__
# ifndef __COMPACT__
# error "The COMPACT model is needed"
# endif
#endif
#include <stdio.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#if defined(__TURBOC__) | defined(MSC)
# include <io.h> /* for type declarations */
#endif
#ifdef UCB
# include <strings.h>
#else
# include <string.h>
#endif
#ifdef VMS
# define GOOD 1
#else
# define GOOD 0
#endif
#ifdef __TURBOC__
/*--- ONE MEGABYTE for EACH BUFFER? Really? - not for a brain-dead cpu
like the 8086 or 80286. Would my account on the VAX let me have
this much?
Maybe, one day when we all have an 80386+, or a SPARC, or a real
cpu.... ---*/
#define MAXLEN (0xfff0) /* maximum length of document */
/* A segment is 64k bytes! */
#else
/* ... but no problem on virtual operating systems */
#define MAXLEN (1024*1024) /* maximum length of document */
#endif
#define MAXWORD 250 /* maximum word length */
#define MAXLINE 500 /* maximum line length */
#define MAXDEF 200 /* maximum number of defines */
#define MAXARGS 128 /* maximal number of arguments */
#define EOS '\0' /* end of string */
#if defined(__TURBOC__) | defined (VAXC)
# define index strchr
#endif
#ifdef MAIN /* can only declare globals once */
# define GLOBAL
#else
# define GLOBAL extern
#endif
GLOBAL int math_mode, /* math mode status */
de_arg, /* .de argument */
IP_stat, /* IP status */
QP_stat, /* QP status */
TP_stat; /* TP status */
#ifdef DEBUG
GLOBAL int debug_o;
GLOBAL int debug_v;
#endif
GLOBAL struct defs {
char *def_macro;
char *replace;
int illegal;
} def[MAXDEF];
GLOBAL struct mydefs {
char *def_macro;
char *replace;
int illegal;
int arg_no;
int par; /* if it impiles (or contains) a par break */
} mydef[MAXDEF];
GLOBAL struct measure {
char old_units[MAXWORD]; float old_value;
char units[MAXWORD]; float value;
char def_units[MAXWORD]; /* default units */
int def_value; /* default value: 0 means take last one */
} linespacing, indent, tmpind, space, vspace;
typedef unsigned char bool;
extern int errno;
|
// **********************************************************************
//
// Copyright (c) 2003-2017 ZeroC, Inc. All rights reserved.
//
// This copy of Ice is licensed to you under the terms described in the
// ICE_LICENSE file included in this distribution.
//
// **********************************************************************
#ifndef ICE_INTERFACE_BY_VALUE_H
#define ICE_INTERFACE_BY_VALUE_H
#include <Ice/Value.h>
#include <Ice/OutputStream.h>
#include <Ice/InputStream.h>
#ifdef ICE_CPP11_MAPPING
namespace Ice
{
template<typename T>
class InterfaceByValue : public ValueHelper<InterfaceByValue<T>, Value>
{
public:
virtual std::string ice_id() const
{
return T::ice_staticId();
}
static const std::string& ice_staticId()
{
return T::ice_staticId();
}
std::tuple<> ice_tuple() const
{
return std::tie();
}
};
}
#endif
#endif
|
#ifndef FILEZILLA_INTERFACE_CLEARPRIVATEDATA_HEADER
#define FILEZILLA_INTERFACE_CLEARPRIVATEDATA_HEADER
#include "dialogex.h"
#include <wx/timer.h>
class CMainFrame;
class CClearPrivateDataDialog final : public wxDialogEx
{
public:
static CClearPrivateDataDialog* Create(CMainFrame* pMainFrame) { return new CClearPrivateDataDialog(pMainFrame); }
void Run();
void Delete();
protected:
CClearPrivateDataDialog(CMainFrame* pMainFrame);
virtual ~CClearPrivateDataDialog() = default;
bool ClearReconnect();
void RemoveXmlFile(const wxString& name);
CMainFrame* const m_pMainFrame;
wxTimer m_timer;
DECLARE_EVENT_TABLE()
void OnTimer(wxTimerEvent& event);
};
#endif
|
/*
* The TiLib: wavelet based lossy image compression library
* Copyright (C) 1998-2004 Alexander Simakov
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* QuikInfo:
*
* Top-level compression & decompression functions.
*
*/
#ifndef TILIB_H
#define TILIB_H
#ifdef __cplusplus
extern "C" {
#endif
#define GRAYSCALE (0)
#define TRUECOLOR (1)
#define BUTTERWORTH (0)
#define DAUB97 (1)
int TiCompress(unsigned char *image,
unsigned char *stream,
int img_width,
int img_height,
int wavelet,
int img_type,
int desired_size,
int *actual_size,
int lum_ratio,
int cb_ratio,
int cr_ratio,
int scales);
int TiCheckHeader(unsigned char *stream,
int *img_width,
int *img_height,
int *img_type,
int stream_size);
int TiDecompress(unsigned char *stream,
unsigned char *image,
int img_width,
int img_height,
int img_type,
int stream_size);
#ifdef __cplusplus
}
#endif
#endif /* TILIB_H */
|
/*
* Created by Rolando Abarca 2012.
* Copyright (c) 2012 Rolando Abarca. All rights reserved.
* Copyright (c) 2013 Zynga Inc. All rights reserved.
* Copyright (c) 2013-2014 Chukong Technologies Inc.
*
* Heavy based on: https://github.com/funkaster/FakeWebGL/blob/master/FakeWebGL/WebGL/XMLHTTPRequest.h
*
* 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 __FAKE_XMLHTTPREQUEST_H__
#define __FAKE_XMLHTTPREQUEST_H__
#include "jsapi.h"
#include "jsfriendapi.h"
#include "network/HttpClient.h"
#include "js_bindings_config.h"
#include "ScriptingCore.h"
#include "jsb_helper.h"
class MinXmlHttpRequest : public cocos2d::Ref
{
public:
enum class ResponseType
{
STRING,
ARRAY_BUFFER,
BLOB,
DOCUMENT,
JSON
};
// Ready States (http://www.w3.org/TR/XMLHttpRequest/#interface-xmlhttprequest)
static const unsigned short UNSENT = 0;
static const unsigned short OPENED = 1;
static const unsigned short HEADERS_RECEIVED = 2;
static const unsigned short LOADING = 3;
static const unsigned short DONE = 4;
MinXmlHttpRequest();
~MinXmlHttpRequest();
JS_BINDED_CLASS_GLUE(MinXmlHttpRequest);
JS_BINDED_CONSTRUCTOR(MinXmlHttpRequest);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, onreadystatechange);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, responseType);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, withCredentials);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, upload);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, timeout);
JS_BINDED_PROP_GET(MinXmlHttpRequest, readyState);
JS_BINDED_PROP_GET(MinXmlHttpRequest, status);
JS_BINDED_PROP_GET(MinXmlHttpRequest, statusText);
JS_BINDED_PROP_GET(MinXmlHttpRequest, responseText);
JS_BINDED_PROP_GET(MinXmlHttpRequest, response);
JS_BINDED_PROP_GET(MinXmlHttpRequest, responseXML);
JS_BINDED_FUNC(MinXmlHttpRequest, open);
JS_BINDED_FUNC(MinXmlHttpRequest, send);
JS_BINDED_FUNC(MinXmlHttpRequest, abort);
JS_BINDED_FUNC(MinXmlHttpRequest, getAllResponseHeaders);
JS_BINDED_FUNC(MinXmlHttpRequest, getResponseHeader);
JS_BINDED_FUNC(MinXmlHttpRequest, setRequestHeader);
JS_BINDED_FUNC(MinXmlHttpRequest, overrideMimeType);
void handle_requestResponse(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response);
private:
void _gotHeader(std::string header);
void _setRequestHeader(const char* field, const char* value);
void _setHttpRequestHeader();
void _sendRequest(JSContext *cx);
std::string _url;
JSContext* _cx;
std::string _meth;
std::string _type;
char* _data;
uint32_t _dataSize;
JSObject* _onreadystateCallback;
int _readyState;
int _status;
std::string _statusText;
ResponseType _responseType;
unsigned _timeout;
bool _isAsync;
cocos2d::network::HttpRequest* _httpRequest;
bool _isNetwork;
bool _withCredentialsValue;
bool _errorFlag;
std::unordered_map<std::string, std::string> _httpHeader;
std::unordered_map<std::string, std::string> _requestHeader;
};
#endif
|
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2006, Daniel Stenberg, <[email protected]>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at http://curl.haxx.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
* $Id: getinfo.c,v 1.1 2006/07/05 22:41:22 victor Exp $
***************************************************************************/
#include "setup.h"
#include <curl/curl.h>
#include "urldata.h"
#include "getinfo.h"
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
#include "memory.h"
#include "sslgen.h"
/* Make this the last #include */
#include "memdebug.h"
/*
* This is supposed to be called in the beginning of a perform() session
* and should reset all session-info variables
*/
CURLcode Curl_initinfo(struct SessionHandle *data)
{
struct Progress *pro = &data->progress;
struct PureInfo *info =&data->info;
pro->t_nslookup = 0;
pro->t_connect = 0;
pro->t_pretransfer = 0;
pro->t_starttransfer = 0;
pro->timespent = 0;
pro->t_redirect = 0;
info->httpcode = 0;
info->httpversion=0;
info->filetime=-1; /* -1 is an illegal time and thus means unknown */
if (info->contenttype)
free(info->contenttype);
info->contenttype = NULL;
info->header_size = 0;
info->request_size = 0;
info->numconnects = 0;
return CURLE_OK;
}
CURLcode Curl_getinfo(struct SessionHandle *data, CURLINFO info, ...)
{
va_list arg;
long *param_longp=NULL;
double *param_doublep=NULL;
char **param_charp=NULL;
struct curl_slist **param_slistp=NULL;
va_start(arg, info);
switch(info&CURLINFO_TYPEMASK) {
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
case CURLINFO_STRING:
param_charp = va_arg(arg, char **);
if(NULL == param_charp)
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
case CURLINFO_LONG:
param_longp = va_arg(arg, long *);
if(NULL == param_longp)
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
case CURLINFO_DOUBLE:
param_doublep = va_arg(arg, double *);
if(NULL == param_doublep)
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
case CURLINFO_SLIST:
param_slistp = va_arg(arg, struct curl_slist **);
if(NULL == param_slistp)
return CURLE_BAD_FUNCTION_ARGUMENT;
break;
}
switch(info) {
case CURLINFO_EFFECTIVE_URL:
*param_charp = data->change.url?data->change.url:(char *)"";
break;
case CURLINFO_RESPONSE_CODE:
*param_longp = data->info.httpcode;
break;
case CURLINFO_HTTP_CONNECTCODE:
*param_longp = data->info.httpproxycode;
break;
case CURLINFO_FILETIME:
*param_longp = data->info.filetime;
break;
case CURLINFO_HEADER_SIZE:
*param_longp = data->info.header_size;
break;
case CURLINFO_REQUEST_SIZE:
*param_longp = data->info.request_size;
break;
case CURLINFO_TOTAL_TIME:
*param_doublep = data->progress.timespent;
break;
case CURLINFO_NAMELOOKUP_TIME:
*param_doublep = data->progress.t_nslookup;
break;
case CURLINFO_CONNECT_TIME:
*param_doublep = data->progress.t_connect;
break;
case CURLINFO_PRETRANSFER_TIME:
*param_doublep = data->progress.t_pretransfer;
break;
case CURLINFO_STARTTRANSFER_TIME:
*param_doublep = data->progress.t_starttransfer;
break;
case CURLINFO_SIZE_UPLOAD:
*param_doublep = (double)data->progress.uploaded;
break;
case CURLINFO_SIZE_DOWNLOAD:
*param_doublep = (double)data->progress.downloaded;
break;
case CURLINFO_SPEED_DOWNLOAD:
*param_doublep = (double)data->progress.dlspeed;
break;
case CURLINFO_SPEED_UPLOAD:
*param_doublep = (double)data->progress.ulspeed;
break;
case CURLINFO_SSL_VERIFYRESULT:
*param_longp = data->set.ssl.certverifyresult;
break;
case CURLINFO_CONTENT_LENGTH_DOWNLOAD:
*param_doublep = (double)data->progress.size_dl;
break;
case CURLINFO_CONTENT_LENGTH_UPLOAD:
*param_doublep = (double)data->progress.size_ul;
break;
case CURLINFO_REDIRECT_TIME:
*param_doublep = data->progress.t_redirect;
break;
case CURLINFO_REDIRECT_COUNT:
*param_longp = data->set.followlocation;
break;
case CURLINFO_CONTENT_TYPE:
*param_charp = data->info.contenttype;
break;
case CURLINFO_PRIVATE:
*param_charp = data->set.private_data;
break;
case CURLINFO_HTTPAUTH_AVAIL:
*param_longp = data->info.httpauthavail;
break;
case CURLINFO_PROXYAUTH_AVAIL:
*param_longp = data->info.proxyauthavail;
break;
case CURLINFO_OS_ERRNO:
*param_longp = data->state.os_errno;
break;
case CURLINFO_NUM_CONNECTS:
*param_longp = data->info.numconnects;
break;
case CURLINFO_SSL_ENGINES:
*param_slistp = Curl_ssl_engines_list(data);
break;
case CURLINFO_COOKIELIST:
*param_slistp = Curl_cookie_list(data);
break;
case CURLINFO_LASTSOCKET:
if((data->state.lastconnect != -1) &&
(data->state.connects[data->state.lastconnect] != NULL))
*param_longp = data->state.connects[data->state.lastconnect]->
sock[FIRSTSOCKET];
else
*param_longp = -1;
break;
default:
return CURLE_BAD_FUNCTION_ARGUMENT;
}
return CURLE_OK;
}
|
/* nip2-cli.c ... run the nip2 executable, connecting stdin and stdout to the
* console
*
* 11/12/09
* - use SetHandleInformation() to stop the child inheriting the read
* handle (thanks Leo)
*/
/*
Copyright (C) 2008 Imperial College, London
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
*/
/*
These files are distributed with VIPS - http://www.vips.ecs.soton.ac.uk
*/
/* Adapted from sample code by Leo Davidson, with the author's permission.
*/
/* Windows does not let a single exe run in both command-line and GUI mode. To
* run nip2 in command-line mode, we run this CLI wrapper program instead,
* which starts the main nip2 exe, connecting stdin/out/err appropriately.
*/
#include <windows.h>
#include <stdio.h>
#include <io.h>
#include <ctype.h>
#include <glib.h>
void
print_last_error ()
{
char *buf;
if (FormatMessageA (FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_IGNORE_INSERTS |
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
GetLastError (),
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPSTR) & buf, 0, NULL))
{
fprintf (stderr, "%s", buf);
LocalFree (buf);
}
}
int
main (int argc, char **argv)
{
char *dirname;
char command[2048];
gboolean quote;
int i, j;
HANDLE hChildStdoutRd;
HANDLE hChildStdoutWr;
SECURITY_ATTRIBUTES saAttr;
PROCESS_INFORMATION processInformation;
STARTUPINFO startUpInfo;
DWORD dwRead;
CHAR buf[1024];
/* we run the nip2.exe in the same directory as this exe: swap the last
* pathname component for nip2.exe
* we change the argv[0] pointer, probably not a good idea
*/
dirname = g_path_get_dirname (argv[0]);
argv[0] = g_build_filename (dirname, "nip2.exe", NULL);
g_free (dirname);
if (_access (argv[0], 00))
{
fprintf (stderr, "cannot access \"%s\"\n", argv[0]);
exit (1);
}
/* build the command string ... we have to quote items containing spaces
*/
command[0] = '\0';
for (i = 0; i < argc; i++)
{
quote = FALSE;
for (j = 0; argv[i][j]; j++)
{
if (isspace (argv[i][j]))
{
quote = TRUE;
break;
}
}
if (i > 0)
{
strncat (command, " ", sizeof (command) - 1);
}
if (quote)
{
strncat (command, "\"", sizeof (command) - 1);
}
strncat (command, argv[i], sizeof (command) - 1);
if (quote)
{
strncat (command, "\"", sizeof (command) - 1);
}
}
if (strlen (command) == sizeof (command) - 1)
{
fprintf (stderr, "command too long\n");
exit (1);
}
/* Create a pipe for the child process's STDOUT.
*/
hChildStdoutRd = NULL;
hChildStdoutWr = NULL;
saAttr.nLength = sizeof (SECURITY_ATTRIBUTES);
saAttr.bInheritHandle = TRUE;
saAttr.lpSecurityDescriptor = NULL;
if (!CreatePipe (&hChildStdoutRd, &hChildStdoutWr, &saAttr, 0))
{
fprintf (stderr, "CreatePipe failed: ");
print_last_error ();
fprintf (stderr, "\n");
exit (1);
}
/* Ensure the read handle to the pipe for STDOUT is not inherited.
*/
if (!SetHandleInformation(hChildStdoutRd, HANDLE_FLAG_INHERIT, 0))
{
fprintf (stderr, "SetHandleInformation failed: ");
print_last_error ();
fprintf (stderr, "\n");
exit (1);
}
/* Run command.
*/
startUpInfo.cb = sizeof (STARTUPINFO);
startUpInfo.lpReserved = NULL;
startUpInfo.lpDesktop = NULL;
startUpInfo.lpTitle = NULL;
startUpInfo.dwFlags = STARTF_USESHOWWINDOW | STARTF_USESTDHANDLES;
startUpInfo.hStdOutput = hChildStdoutWr;
startUpInfo.hStdError = hChildStdoutWr;
startUpInfo.cbReserved2 = 0;
startUpInfo.lpReserved2 = NULL;
startUpInfo.wShowWindow = SW_SHOWNORMAL;
if (!CreateProcess (NULL, command, NULL, /* default security */
NULL, /* default thread security */
TRUE, /* inherit handles */
CREATE_DEFAULT_ERROR_MODE | DETACHED_PROCESS, NULL, /* use default environment */
NULL, /* set default directory */
&startUpInfo, &processInformation))
{
fprintf (stderr, "error running \"%s\": ", command);
print_last_error ();
fprintf (stderr, "\n");
exit (1);
}
/* Close the write end of the pipe before reading from the read end.
*/
CloseHandle (hChildStdoutWr);
while (ReadFile (hChildStdoutRd, buf, sizeof (buf) - 1, &dwRead, NULL) &&
dwRead > 0)
{
buf[dwRead] = '\0';
printf ("%s", buf);
}
CloseHandle (hChildStdoutRd);
return (0);
}
|
#ifndef _UMLINTERRUPTIBLEACTIVITYREGION_H
#define _UMLINTERRUPTIBLEACTIVITYREGION_H
#include "UmlBaseInterruptibleActivityRegion.h"
#include <qcstring.h>
class UmlInterruptibleActivityRegion : public UmlBaseInterruptibleActivityRegion {
public:
// the constructor, do not call it yourself !!!!!!!!!!
UmlInterruptibleActivityRegion(void * id, const QCString & s) : UmlBaseInterruptibleActivityRegion(id, s) {
}
//returns a string indicating the king of the element
virtual QCString sKind();
//entry to produce the html code receiving chapter number
//path, rank in the mother and level in the browser tree
virtual void html(QCString pfix, unsigned int rank, unsigned int level);
};
#endif
|
/* dfilter_expr_dlg.h
* Definitions for dialog boxes for display filter expression construction
*
* $Id: dfilter_expr_dlg.h 24034 2008-01-08 22:54:51Z stig $
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <[email protected]>
* Copyright 1998 Gerald Combs
*
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DFILTER_EXPR_DLG_H__
#define __DFILTER_EXPR_DLG_H__
/** @file
* "Add Expression" dialog box.
* @ingroup dialog_group
*/
/** User requested the "Add Expression" dialog box by menu or toolbar.
*
* @param widget corresponding text entry widget
* @return the newly created dialog widget
*/
GtkWidget *dfilter_expr_dlg_new(GtkWidget *widget);
#endif /* dfilter_expr_dlg.h */
|
/**
* board/annapurna-labs/common/gpio_board_init.h
*
* Board GPIO initialization service
*
* Copyright (C) 2013 Annapurna Labs Ltd.
*
* 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 <asm/gpio.h>
/* Board GPIO configuration entry */
struct gpio_cfg_ent {
/* GPIO number */
int gpio_num;
/* Configure GPIO as output */
int is_output;
/* Initial output value for output */
int output_val;
};
/**
* Board GPIO Initialization
*
* @param[in] cfg
* Board GPIO configuration entry array
*
* @param[in] cnt
* Number of board GPIO configuration entries
*
* @return 0 upon success
*/
int gpio_board_init(
const struct gpio_cfg_ent *cfg,
int cnt);
|
{
int n, dx, dy, sx, pp_inc_1, pp_inc_2;
register int a;
register PIXEL *pp;
#if defined(INTERP_RGB)
register unsigned int r, g, b;
#endif
#ifdef INTERP_RGB
register unsigned int rinc, ginc, binc;
#endif
#ifdef INTERP_Z
register unsigned int *pz;
int zinc;
register unsigned int z;
#endif
if (p1->y > p2->y || (p1->y == p2->y && p1->x > p2->x)) {
ZBufferPoint *tmp;
tmp = p1;
p1 = p2;
p2 = tmp;
}
sx = zb->xsize;
pp = (PIXEL *)((char *) zb->pbuf.getRawBuffer() + zb->linesize * p1->y + p1->x * PSZB);
#ifdef INTERP_Z
pz = zb->zbuf + (p1->y * sx + p1->x);
z = p1->z;
#endif
dx = p2->x - p1->x;
dy = p2->y - p1->y;
#ifdef INTERP_RGB
r = p2->r << 8;
g = p2->g << 8;
b = p2->b << 8;
#endif
#ifdef INTERP_RGB
#define RGB(x) x
#define RGBPIXEL *pp = RGB_TO_PIXEL(r >> 8,g >> 8,b >> 8)
#else // INTERP_RGB
#define RGB(x)
#define RGBPIXEL *pp = color
#endif // INTERP_RGB
#ifdef INTERP_Z
#define ZZ(x) x
#define PUTPIXEL() \
{ \
if (ZCMP(z, *pz)) { \
RGBPIXEL; \
*pz = z; \
} \
}
#else // INTERP_Z
#define ZZ(x)
#define PUTPIXEL() RGBPIXEL
#endif // INTERP_Z
#define DRAWLINE(dx, dy, inc_1, inc_2) \
n = dx; \
ZZ(zinc = (p2->z - p1->z)/n); \
RGB(rinc=((p2->r - p1->r) << 8)/n; \
ginc=((p2->g - p1->g) << 8)/n; \
binc=((p2->b - p1->b) << 8)/n); \
a = 2 * dy - dx; \
dy = 2 * dy; \
dx = 2 * dx - dy; \
pp_inc_1 = (inc_1) * PSZB; \
pp_inc_2 = (inc_2) * PSZB; \
do { \
PUTPIXEL(); \
ZZ(z += zinc); \
RGB(r += rinc; g += ginc; b += binc); \
if (a > 0) { \
pp = (PIXEL *)((char *)pp + pp_inc_1); \
ZZ(pz+=(inc_1)); \
a -= dx; \
} else { \
pp = (PIXEL *)((char *)pp + pp_inc_2); \
ZZ(pz += (inc_2)); \
a += dy; \
} \
} while (--n >= 0);
// fin macro
if (dx == 0 && dy == 0) {
PUTPIXEL();
} else if (dx > 0) {
if (dx >= dy) {
DRAWLINE(dx, dy, sx + 1, 1);
} else {
DRAWLINE(dy, dx, sx + 1, sx);
}
} else {
dx = -dx;
if (dx >= dy) {
DRAWLINE(dx, dy, sx - 1, -1);
} else {
DRAWLINE(dy, dx, sx - 1, sx);
}
}
}
#undef INTERP_Z
#undef INTERP_RGB
// internal defines
#undef DRAWLINE
#undef PUTPIXEL
#undef ZZ
#undef RGB
#undef RGBPIXEL
|
/* utility routines for keeping some statistics */
/* (C) 2009 by Harald Welte <[email protected]>
*
* All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
#include <sys/types.h>
#include <osmocore/linuxlist.h>
#include <osmocore/talloc.h>
#include <osmocore/statistics.h>
static LLIST_HEAD(counters);
void *tall_ctr_ctx;
struct counter *counter_alloc(const char *name)
{
struct counter *ctr = talloc_zero(tall_ctr_ctx, struct counter);
if (!ctr)
return NULL;
ctr->name = name;
llist_add_tail(&ctr->list, &counters);
return ctr;
}
void counter_free(struct counter *ctr)
{
llist_del(&ctr->list);
talloc_free(ctr);
}
int counters_for_each(int (*handle_counter)(struct counter *, void *), void *data)
{
struct counter *ctr;
int rc = 0;
llist_for_each_entry(ctr, &counters, list) {
rc = handle_counter(ctr, data);
if (rc < 0)
return rc;
}
return rc;
}
|
/***************************************************************************
qgsmeasure.h
------------------
begin : March 2005
copyright : (C) 2005 by Radim Blazek
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSMEASUREDIALOG_H
#define QGSMEASUREDIALOG_H
#include "ui_qgsmeasurebase.h"
#include "qgspoint.h"
#include "qgsdistancearea.h"
#include "qgscontexthelp.h"
class QCloseEvent;
class QgsMeasureTool;
class QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
{
Q_OBJECT
public:
//! Constructor
QgsMeasureDialog( QgsMeasureTool* tool, Qt::WFlags f = 0 );
//! Save position
void saveWindowLocation( void );
//! Restore last window position/size
void restorePosition( void );
//! Add new point
void addPoint( QgsPoint &point );
//! Mose move
void mouseMove( QgsPoint &point );
//! Mouse press
void mousePress( QgsPoint &point );
public slots:
//! Reject
void on_buttonBox_rejected( void );
//! Reset and start new
void restart();
//! Close event
void closeEvent( QCloseEvent *e );
//! Show the help for the dialog
void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); }
private:
//! formats distance to most appropriate units
QString formatDistance( double distance, int decimalPlaces );
//! formats area to most appropriate units
QString formatArea( double area, int decimalPlaces );
//! shows/hides table, shows correct units
void updateUi();
//! Converts the measurement, depending on settings in options and current transformation
void convertMeasurement( double &measure, QGis::UnitType &u, bool isArea );
double mTotal;
//! indicates whether we're measuring distances or areas
bool mMeasureArea;
//! pointer to measure tool which owns this dialog
QgsMeasureTool* mTool;
};
#endif
|
/*
* This file is part of MPlayer.
*
* MPlayer 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.
*
* MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <string.h>
#include "config.h"
#include "mp_msg.h"
#include "help_mp.h"
#ifdef __FreeBSD__
#include <sys/cdrio.h>
#endif
#include "m_option.h"
#include "stream.h"
#include "libmpdemux/demuxer.h"
/// We keep these 2 for the gui atm, but they will be removed.
char* cdrom_device=NULL;
int dvd_chapter=1;
int dvd_last_chapter=0;
char* dvd_device=NULL;
char *bluray_device=NULL;
// Open a new stream (stdin/file/vcd/url)
stream_t* open_stream(const char* filename,char** options, int* file_format){
int dummy = DEMUXER_TYPE_UNKNOWN;
if (!file_format) file_format = &dummy;
// Check if playlist or unknown
if (*file_format != DEMUXER_TYPE_PLAYLIST){
*file_format=DEMUXER_TYPE_UNKNOWN;
}
if(!filename) {
mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
return NULL;
}
//============ Open STDIN or plain FILE ============
return open_stream_full(filename,STREAM_READ,options,file_format);
}
|
/***************************************************************************
orbitalviewerbase.h - description
-------------------
begin : Thu Nov 4 2004
copyright : (C) 2004-2006 by Ben Swerts
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
/// \file
/// Contains the declaration of the class OrbitalViewerBase
#ifndef ORBITALVIEWERBASE_H
#define ORBITALVIEWERBASE_H
///// Forward class declarations & header files ///////////////////////////////
///// Qt forward class declarations
class QHBoxLayout;
class QTimer;
///// Xbrabo forward class declarations
class ColorButton;
class GLOrbitalView;
class OrbitalOptionsWidget;
class OrbitalThread;
///// Base class header file
#include <qdialog.h>
///// class OrbitalViewerBase /////////////////////////////////////////////////
class OrbitalViewerBase : public QDialog
{
Q_OBJECT
public:
// constructor/destructor
OrbitalViewerBase(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);// constructor
~OrbitalViewerBase(); // destructor
protected:
void customEvent(QCustomEvent* e); // reimplemented to receive events from calcThread
private slots:
void update(); // updates the view with the values of the widgets
void adjustL(int newN); // adjust the orbital quantum number to the region 1 - n-1
void adjustM(int newL); // adjust the angular momentum quantum number to the region -l - +l
void updateColors(); // updates the view with new colors
void updateTypeOptions(int type); // updates the options to correspond to the chosen type
void cancelCalculation(); // stops calculating a new orbital
private:
// private member functions
void finishCalculation(); // finished up a calculation
// private member variables
QHBoxLayout* BigLayout; ///< All encompassing horizontal layout.
OrbitalOptionsWidget* options; ///< Shows the options.
GLOrbitalView* view; ///< Shows the orbital.
ColorButton* ColorButtonPositive; ///< The pushbutton for choosing the colour of the positive values.
ColorButton* ColorButtonNegative; ///< The pushbutton for choosing the colour of the negative values.
OrbitalThread* calcThread; ///< The thread doing the calculation.
QTimer* timer; ///< Handles periodic updating of the view during a calculation.
};
#endif
|
/*
** $Id: lgc.h,v 2.58 2012/09/11 12:53:08 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
#ifndef lgc_h
#define lgc_h
#include "lobject.h"
#include "lstate.h"
/*
** Collectable objects may have one of three colors: white, which
** means the object is not marked; gray, which means the
** object is marked, but its references may be not marked; and
** black, which means that the object and all its references are marked.
** The main invariant of the garbage collector, while marking objects,
** is that a black object can never point to a white one. Moreover,
** any gray object must be in a "gray list" (gray, grayagain, weak,
** allweak, ephemeron) so that it can be visited again before finishing
** the collection cycle. These lists have no meaning when the invariant
** is not being enforced (e.g., sweep phase).
*/
/* how much to allocate before next GC step */
#if !defined(GCSTEPSIZE)
/* ~100 small strings */
#define GCSTEPSIZE (cast_int(100 * sizeof(TString)))
#endif
/*
** Possible states of the Garbage Collector
*/
#define GCSpropagate 0
#define GCSatomic 1
#define GCSsweepstring 2
#define GCSsweepudata 3
#define GCSsweep 4
#define GCSpause 5
#define issweepphase(g) \
(GCSsweepstring <= (g)->gcstate && (g)->gcstate <= GCSsweep)
#define isgenerational(g) ((g)->gckind == KGC_GEN)
/*
** macros to tell when main invariant (white objects cannot point to black
** ones) must be kept. During a non-generational collection, the sweep
** phase may break the invariant, as objects turned white may point to
** still-black objects. The invariant is restored when sweep ends and
** all objects are white again. During a generational collection, the
** invariant must be kept all times.
*/
#define keepinvariant(g) (isgenerational(g) || g->gcstate <= GCSatomic)
/*
** Outside the collector, the state in generational mode is kept in
** 'propagate', so 'keepinvariant' is always true.
*/
#define keepinvariantout(g) \
check_exp(g->gcstate == GCSpropagate || !isgenerational(g), \
g->gcstate <= GCSatomic)
/*
** some useful bit tricks
*/
#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m)))
#define setbits(x,m) ((x) |= (m))
#define testbits(x,m) ((x) & (m))
#define bitmask(b) (1<<(b))
#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2))
#define l_setbit(x,b) setbits(x, bitmask(b))
#define resetbit(x,b) resetbits(x, bitmask(b))
#define testbit(x,b) testbits(x, bitmask(b))
/* Layout for bit use in `marked' field: */
#define WHITE0BIT 0 /* object is white (type 0) */
#define WHITE1BIT 1 /* object is white (type 1) */
#define BLACKBIT 2 /* object is black */
#define FINALIZEDBIT 3 /* object has been separated for finalization */
#define SEPARATED 4 /* object is in 'finobj' list or in 'tobefnz' */
#define FIXEDBIT 5 /* object is fixed (should not be collected) */
#define OLDBIT 6 /* object is old (only in generational mode) */
/* bit 7 is currently used by tests (luaL_checkmemory) */
#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT)
#define iswhite(x) testbits((x)->gch.marked, WHITEBITS)
#define isblack(x) testbit((x)->gch.marked, BLACKBIT)
#define isgray(x) /* neither white nor black */ \
(!testbits((x)->gch.marked, WHITEBITS | bitmask(BLACKBIT)))
#define isold(x) testbit((x)->gch.marked, OLDBIT)
/* MOVE OLD rule: whenever an object is moved to the beginning of
a GC list, its old bit must be cleared */
#define resetoldbit(o) resetbit((o)->gch.marked, OLDBIT)
#define otherwhite(g) (g->currentwhite ^ WHITEBITS)
#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow)))
#define isdead(g,v) isdeadm(otherwhite(g), (v)->gch.marked)
#define changewhite(x) ((x)->gch.marked ^= WHITEBITS)
#define gray2black(x) l_setbit((x)->gch.marked, BLACKBIT)
#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x)))
#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS)
#define luaC_condGC(L,c) \
{if (G(L)->GCdebt > 0) {c;}; condchangemem(L);}
#define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);)
#define luaC_barrier(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
luaC_barrier_(L,obj2gco(p),gcvalue(v)); }
#define luaC_barrierback(L,p,v) { if (valiswhite(v) && isblack(obj2gco(p))) \
luaC_barrierback_(L,p); }
#define luaC_objbarrier(L,p,o) \
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) \
luaC_barrier_(L,obj2gco(p),obj2gco(o)); }
#define luaC_objbarrierback(L,p,o) \
{ if (iswhite(obj2gco(o)) && isblack(obj2gco(p))) luaC_barrierback_(L,p); }
#define luaC_barrierproto(L,p,c) \
{ if (isblack(obj2gco(p))) luaC_barrierproto_(L,p,c); }
LUAI_FUNC void luaC_freeallobjects(lua_State *L);
LUAI_FUNC void luaC_step(lua_State *L);
LUAI_FUNC void luaC_forcestep(lua_State *L);
LUAI_FUNC void luaC_runtilstate(lua_State *L, int statesmask);
LUAI_FUNC void luaC_fullgc(lua_State *L, int isemergency);
LUAI_FUNC GCObject *luaC_newobj(lua_State *L, int tt, size_t sz,
GCObject **list, int offset);
LUAI_FUNC void luaC_barrier_(lua_State *L, GCObject *o, GCObject *v);
LUAI_FUNC void luaC_barrierback_(lua_State *L, GCObject *o);
LUAI_FUNC void luaC_barrierproto_(lua_State *L, Proto *p, Closure *c);
LUAI_FUNC void luaC_checkfinalizer(lua_State *L, GCObject *o, Table *mt);
LUAI_FUNC void luaC_checkupvalcolor(global_State *g, UpVal *uv);
LUAI_FUNC void luaC_changemode(lua_State *L, int mode);
#endif
|
/*
* 13.5.1 Thread Creation Scheduling Parameters, P1003.1c/Draft 10, p. 120
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <pthread.h>
#include <errno.h>
int pthread_attr_setschedparam(
pthread_attr_t *attr,
const struct sched_param *param
)
{
if ( !attr || !attr->is_initialized || !param )
return EINVAL;
attr->schedparam = *param;
return 0;
}
|
// This file is part of VideoPad.
//
// VideoPad 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.
//
// VideoPad 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 VideoPad; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#pragma once
#include "CaptureDevice.h"
class CAudioCaptureDevice : public CCaptureDevice
{
public:
CAudioCaptureDevice();
// init capture device by given COM object ID
//
HRESULT Create( CString szID );
const DWORD& GetPreferredSamplesPerSec();
const WORD& GetPreferredBitsPerSample();
const WORD& GetPreferredChannels();
const DWORD& GetSamplesPerSec();
const WORD& GetBitsPerSample();
const WORD& GetChannels();
void SetPreferredAudioSamplesPerSec( DWORD nSamplesPerSec );
void SetPreferredAudioBitsPerSample( WORD wBitsPerSample );
void SetPreferredAudioChannels( WORD nChannels );
// these functions are used by CAudioGraph to set
// the current audio format information of the graph
// and the device
//
void SetAudioSamplesPerSec( DWORD nSamplesPerSec );
void SetAudioBitsPerSample( WORD wBitsPerSample );
void SetAudioChannels( WORD nChannels );
private:
DWORD m_nPreferredSamplesPerSec;
WORD m_wPreferredBitsPerSample;
WORD m_nPreferredChannels;
DWORD m_nSamplesPerSec;
WORD m_wBitsPerSample;
WORD m_nChannels;
};
|
#include "thanks.h"
//
// EternityProject Public message START:
//
- To the "developers" like franciscofranco:
Are you able to work on your own?
Also, if you want to badly copy my commits, can you at least give credits
to the proprietary of the commit you're copying?
We're an opensource community, we do this for free... but we also are
satisfacted of the TIME WE LOSE on the things we do.
We want to work with everyone that wants to.
We publish our sources.
We give you all everything we do.
And you?
Instead of copying someone else's work, try to lose time on your own
at least sorting the not working commits (yeah, I knew someone was
copying my work and I've committed some fakes).
You did that badly.
The EternityProject Team Manager & Main Developer,
--kholk
//
// EternityProject Public message END
//
|
#ifndef __STACK_TESTS_H_INCLUDED__
#define __STACK_TESTS_H_INCLUDED__
//-------------------------------------
#include "../CppTest/cpptest.h"
#include "../Raple/Headers/Stack.h"
//-------------------------------------
//-------------------------------------
#ifdef _MSC_VER
#pragma warning (disable: 4290)
#endif
//-------------------------------------
using Raple::Stack;
using Raple::StackOverflowException;
using Raple::StackUnderflowException;
//-------------------------------------
namespace RapleTests
{
class StackTests : public Test::Suite
{
public:
StackTests()
{
addTest(StackTests::SizeTest);
addTest(StackTests::PushAndPopTest);
addTest(StackTests::OverflowExceptionTest);
addTest(StackTests::UnderflowExceptionTest);
}
private:
void SizeTest()
{
Stack<int> s;
assertEquals(0, s.Size());
s.Push(1);
s.Push(2);
assertEquals(2, s.Size());
s.Pop();
assertEquals(1, s.Size());
s.Pop();
assertEquals(0, s.Size());
}
void PushAndPopTest()
{
Stack<int> s;
s.Push(1);
s.Push(2);
s.Push(3);
assertEquals(3, s.Pop());
assertEquals(2, s.Pop());
assertEquals(1, s.Pop());
}
void OverflowExceptionTest()
{
Stack<int> s(2);
s.Push(1);
s.Push(2);
try
{
s.Push(3);
}
catch (StackOverflowException ex)
{
assert(true);
return;
}
assert(false);
}
void UnderflowExceptionTest()
{
Stack<int> s;
try
{
s.Pop();
}
catch (StackUnderflowException ex)
{
assert(true);
return;
}
assert(false);
}
};
}
#endif //__STACK_TESTS_H_INCLUDED__
|
#ifndef CONTROLPANEL_INCLUDED
#define CONTROLPANEL_INCLUDED
#include <qwidget.h>
//Added by qt3to4:
#include <Q3GridLayout>
#include <list>
#include <q3frame.h>
#include <qlayout.h>
#include <qlabel.h>
class Control;
class MetaGear;
class GearControl;
class ControlPanel : public QWidget
{
public:
ControlPanel(QWidget *panelContainerWidget, MetaGear *parentMetagear);
~ControlPanel();
Control *addControl(GearControl* gear);
void addControlPanel(ControlPanel* controlPanel);
QWidget *mainWidget(){return _mainFrame;}
private:
std::list<Control*> _controls;
std::list<ControlPanel*> _controlPanels;
MetaGear *_parentMetaGear;
Q3Frame *_mainFrame;
Q3GridLayout *_mainLayout;
QLabel *_labelName;
};
#endif
|
/*
* Copyright 2008-2009 Sun Microsystems, Inc. All Rights Reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code 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. Sun designates this
* particular file as subject to the "Classpath" exception as provided
* by Sun in the LICENSE file that accompanied this code.
*
* This code 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 work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* 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.
*/
#include "jni.h"
#include "jni_util.h"
#include "jvm.h"
#include "jlong.h"
#include <dlfcn.h>
#include <errno.h>
#include <sys/acl.h>
#include "sun_nio_fs_SolarisNativeDispatcher.h"
static void throwUnixException(JNIEnv* env, int errnum) {
jobject x = JNU_NewObjectByName(env, "sun/nio/fs/UnixException",
"(I)V", errnum);
if (x != NULL) {
(*env)->Throw(env, x);
}
}
JNIEXPORT void JNICALL
Java_sun_nio_fs_SolarisNativeDispatcher_init(JNIEnv *env, jclass clazz) {
}
JNIEXPORT jint JNICALL
Java_sun_nio_fs_SolarisNativeDispatcher_facl(JNIEnv* env, jclass this, jint fd,
jint cmd, jint nentries, jlong address)
{
void* aclbufp = jlong_to_ptr(address);
int n = -1;
n = facl((int)fd, (int)cmd, (int)nentries, aclbufp);
if (n == -1) {
throwUnixException(env, errno);
}
return (jint)n;
}
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_UI_ANDROID_EXTENSIONS_EXTENSION_INSTALL_UI_ANDROID_H_
#define CHROME_BROWSER_UI_ANDROID_EXTENSIONS_EXTENSION_INSTALL_UI_ANDROID_H_
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "chrome/browser/extensions/extension_install_ui.h"
class ExtensionInstallUIAndroid : public ExtensionInstallUI {
public:
ExtensionInstallUIAndroid();
virtual ~ExtensionInstallUIAndroid();
virtual void OnInstallSuccess(const extensions::Extension* extension,
SkBitmap* icon) OVERRIDE;
virtual void OnInstallFailure(
const extensions::CrxInstallerError& error) OVERRIDE;
private:
DISALLOW_COPY_AND_ASSIGN(ExtensionInstallUIAndroid);
};
#endif
|
//
// CategoryModel.h
// healthfood
//
// Created by lanou on 15/6/22.
// Copyright (c) 2015年 hastar. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface CategoryModel : NSObject
@property (nonatomic, retain)NSString *title;
@property (nonatomic, retain)UIImage *image;
@property (nonatomic, retain)NSArray *idArray;
-(instancetype)initWithTitle:(NSString *)title andImageName:(NSString *)imageName andIdArray:(NSArray *)array;
@end
|
#ifndef MUX_CLOCK_H
#define MUX_CLOCK_H
/**
* Initializes main system clock.
* @ms time between each tick in milliseconds
* @tick function to run every tick
*/
void clock_init(int ms, void (*tick)());
/**
* Starts main system clock.
*/
void clock_start();
/**
* Stops main system clock.
*/
void clock_stop();
#endif
|
#ifndef PERF_LINUX_LINKAGE_H_
#define PERF_LINUX_LINKAGE_H_
/* linkage.h ... for including arch/x86/lib/memcpy_64.S */
#define ENTRY(name) \
.globl name; \
name:
#define ENDPROC(name)
#endif /* PERF_LINUX_LINKAGE_H_ */
|
#pragma once
#include <Nena\Window.h>
#include <Nena\StepTimer.h>
#include <Nena\DeviceResources.h>
#include <Nena\RenderTargetOverlay.h>
#include "TextRenderer.h"
namespace Framework
{
namespace Application
{
void Start();
void Stop();
struct Window;
struct Dispatcher
{
Framework::Application::Window *Host;
Framework::Application::Dispatcher::Dispatcher(
Framework::Application::Window *host
);
LRESULT Framework::Application::Dispatcher::Process(
_In_::HWND hwnd,
_In_::UINT umsg,
_In_::WPARAM wparam,
_In_::LPARAM lparam
);
};
struct WindowDeviceNotify : Nena::Graphics::IDeviceNotify
{
Framework::Application::Window *Host;
Framework::Application::WindowDeviceNotify::WindowDeviceNotify(Framework::Application::Window *host);
virtual void OnDeviceLost() override;
virtual void OnDeviceRestored() override;
};
struct Window : Nena::Application::Window
{
friend WindowDeviceNotify;
Framework::Application::Window::Window();
::BOOL Framework::Application::Window::Update();
LRESULT Framework::Application::Window::OnMouseLeftButtonPressed(_In_ ::INT16 x, _In_ ::INT16 y);
LRESULT Framework::Application::Window::OnMouseRightButtonPressed(_In_ ::INT16 x, _In_ ::INT16 y);
LRESULT Framework::Application::Window::OnMouseLeftButtonReleased(_In_ ::INT16 x, _In_ ::INT16 y);
LRESULT Framework::Application::Window::OnMouseRightButtonReleased(_In_::INT16 x, _In_::INT16 y);
LRESULT Framework::Application::Window::OnMouseMoved(_In_::INT16 x, _In_::INT16 y);
LRESULT Framework::Application::Window::OnKeyPressed(::UINT16 virtualKey);
LRESULT Framework::Application::Window::OnResized();
static Framework::Application::Window *Framework::Application::Window::GetForCurrentThread();
Nena::Graphics::OverlayResources Overlay;
Nena::Graphics::DeviceResources Graphics;
Nena::Simulation::StepTimer Timer;
TextRenderer Renderer;
WindowDeviceNotify DeviceNotify;
Dispatcher EventHandler;
};
}
}
|
/* This file defines the control system */
/* Dependencies - Serial */
#ifndef MICAV_CONTROLLER
#define MICAV_CONTROLLER
#include "config.h"
#include "drivers.h"
#include "PID.h"
#include <stdint.h>
#define MAX_DYAW 100
#define MIN_DYAW -100
#define MAX_DPITCH 100
#define MIN_DPITCH -100
#define MAX_DROLL 100
#define MIN_DROLL -100
#define MAX_DYAW 100
#define MIN_DYAW -100
#define MAX_DPITCH 100
#define MIN_DPITCH -100
#define MAX_ROLL 150
#define MIN_ROLL -150 /*Degrees*10*/
void update_input();
void update_state(float []);
//void update_control();
//void update_output();
void write_output();
#endif /* MICAV_CONTROLLER */
|
/*
* libquicktime yuv4 encoder
*
* Copyright (c) 2011 Carl Eugen Hoyos
*
* 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
*/
#include "avcodec.h"
#include "internal.h"
static av_cold int yuv4_encode_init(AVCodecContext *avctx)
{
avctx->coded_frame = av_frame_alloc();
if (!avctx->coded_frame) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
return AVERROR(ENOMEM);
}
return 0;
}
static int yuv4_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
const AVFrame *pic, int *got_packet)
{
uint8_t *dst;
uint8_t *y, *u, *v;
int i, j, ret;
if ((ret = ff_alloc_packet2(avctx, pkt, 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1))) < 0)
return ret;
dst = pkt->data;
avctx->coded_frame->key_frame = 1;
avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I;
y = pic->data[0];
u = pic->data[1];
v = pic->data[2];
for (i = 0; i < avctx->height + 1 >> 1; i++) {
for (j = 0; j < avctx->width + 1 >> 1; j++) {
*dst++ = u[j] ^ 0x80;
*dst++ = v[j] ^ 0x80;
*dst++ = y[ 2 * j ];
*dst++ = y[ 2 * j + 1];
*dst++ = y[pic->linesize[0] + 2 * j ];
*dst++ = y[pic->linesize[0] + 2 * j + 1];
}
y += 2 * pic->linesize[0];
u += pic->linesize[1];
v += pic->linesize[2];
}
pkt->flags |= AV_PKT_FLAG_KEY;
*got_packet = 1;
return 0;
}
static av_cold int yuv4_encode_close(AVCodecContext *avctx)
{
av_freep(&avctx->coded_frame);
return 0;
}
AVCodec ff_yuv4_encoder = {
.name = "yuv4",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:2:0"),
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_YUV4,
.init = yuv4_encode_init,
.encode2 = yuv4_encode_frame,
.close = yuv4_encode_close,
.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_NONE },
};
|
/*
* Copyright (C) 2005-2012 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MANGOSSERVER_PATH_H
#define MANGOSSERVER_PATH_H
#include "Common.h"
#include <vector>
struct SimplePathNode
{
float x,y,z;
};
template<typename PathElem, typename PathNode = PathElem>
class Path
{
public:
size_t size() const { return i_nodes.size(); }
bool empty() const { return i_nodes.empty(); }
void resize(unsigned int sz) { i_nodes.resize(sz); }
void clear() { i_nodes.clear(); }
void erase(uint32 idx) { i_nodes.erase(i_nodes.begin()+idx); }
float GetTotalLength(uint32 start, uint32 end) const
{
float len = 0.0f;
for(unsigned int idx=start+1; idx < end; ++idx)
{
PathNode const& node = i_nodes[idx];
PathNode const& prev = i_nodes[idx-1];
float xd = node.x - prev.x;
float yd = node.y - prev.y;
float zd = node.z - prev.z;
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
return len;
}
float GetTotalLength() const { return GetTotalLength(0,size()); }
float GetPassedLength(uint32 curnode, float x, float y, float z) const
{
float len = GetTotalLength(0,curnode);
if (curnode > 0)
{
PathNode const& node = i_nodes[curnode-1];
float xd = x - node.x;
float yd = y - node.y;
float zd = z - node.z;
len += sqrtf( xd*xd + yd*yd + zd*zd );
}
return len;
}
PathNode& operator[](size_t idx) { return i_nodes[idx]; }
PathNode const& operator[](size_t idx) const { return i_nodes[idx]; }
void set(size_t idx, PathElem elem) { i_nodes[idx] = elem; }
protected:
std::vector<PathElem> i_nodes;
};
typedef Path<SimplePathNode> SimplePath;
#endif
|
/*
* arch/s390/kernel/sys_s390.c
*
* S390 version
* Copyright (C) 1999,2000 IBM Deutschland Entwicklung GmbH, IBM Corporation
* Author(s): Martin Schwidefsky ([email protected]),
* Thomas Spatzier ([email protected])
*
* Derived from "arch/i386/kernel/sys_i386.c"
*
* This file contains various random system calls that
* have a non-standard calling sequence on the Linux/s390
* platform.
*/
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/smp.h>
#include <linux/sem.h>
#include <linux/msg.h>
#include <linux/shm.h>
#include <linux/stat.h>
#include <linux/syscalls.h>
#include <linux/mman.h>
#include <linux/file.h>
#include <linux/utsname.h>
#include <linux/personality.h>
#include <linux/unistd.h>
#include <linux/ipc.h>
#include <asm/uaccess.h>
#include "entry.h"
/*
* Perform the mmap() system call. Linux for S/390 isn't able to handle more
* than 5 system call parameters, so this system call uses a memory block
* for parameter passing.
*/
struct s390_mmap_arg_struct {
unsigned long addr;
unsigned long len;
unsigned long prot;
unsigned long flags;
unsigned long fd;
unsigned long offset;
};
SYSCALL_DEFINE1(mmap2, struct s390_mmap_arg_struct __user *, arg)
{
struct s390_mmap_arg_struct a;
int error = -EFAULT;
if (copy_from_user(&a, arg, sizeof(a)))
goto out;
error = sys_mmap_pgoff(a.addr, a.len, a.prot, a.flags, a.fd, a.offset);
out:
return error;
}
/*
* sys_ipc() is the de-multiplexer for the SysV IPC calls.
*/
SYSCALL_DEFINE5(s390_ipc, uint, call, int, first, unsigned long, second,
unsigned long, third, void __user *, ptr)
{
if (call >> 16)
return -EINVAL;
/* The s390 sys_ipc variant has only five parameters instead of six
* like the generic variant. The only difference is the handling of
* the SEMTIMEDOP subcall where on s390 the third parameter is used
* as a pointer to a struct timespec where the generic variant uses
* the fifth parameter.
* Therefore we can call the generic variant by simply passing the
* third parameter also as fifth parameter.
*/
return sys_ipc(call, first, second, third, ptr, third);
}
#ifdef CONFIG_64BIT
SYSCALL_DEFINE1(s390_personality, unsigned int, personality)
{
unsigned int ret;
if (current->personality == PER_LINUX32 && personality == PER_LINUX)
personality = PER_LINUX32;
ret = sys_personality(personality);
if (ret == PER_LINUX32)
ret = PER_LINUX;
return ret;
}
#endif /* CONFIG_64BIT */
/*
* Wrapper function for sys_fadvise64/fadvise64_64
*/
#ifndef CONFIG_64BIT
SYSCALL_DEFINE5(s390_fadvise64, int, fd, u32, offset_high, u32, offset_low,
size_t, len, int, advice)
{
return sys_fadvise64(fd, (u64) offset_high << 32 | offset_low,
len, advice);
}
struct fadvise64_64_args {
int fd;
long long offset;
long long len;
int advice;
};
SYSCALL_DEFINE1(s390_fadvise64_64, struct fadvise64_64_args __user *, args)
{
struct fadvise64_64_args a;
if ( copy_from_user(&a, args, sizeof(a)) )
return -EFAULT;
return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
}
/*
* This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
* 64 bit argument "len" is split into the upper and lower 32 bits. The
* system call wrapper in the user space loads the value to %r6/%r7.
* The code in entry.S keeps the values in %r2 - %r6 where they are and
* stores %r7 to 96(%r15). But the standard C linkage requires that
* the whole 64 bit value for len is stored on the stack and doesn't
* use %r6 at all. So s390_fallocate has to convert the arguments from
* %r2: fd, %r3: mode, %r4/%r5: offset, %r6/96(%r15)-99(%r15): len
* to
* %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
*/
SYSCALL_DEFINE(s390_fallocate)(int fd, int mode, loff_t offset,
u32 len_high, u32 len_low)
{
return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
}
#ifdef CONFIG_HAVE_SYSCALL_WRAPPERS
asmlinkage long SyS_s390_fallocate(long fd, long mode, loff_t offset,
long len_high, long len_low)
{
return SYSC_s390_fallocate((int) fd, (int) mode, offset,
(u32) len_high, (u32) len_low);
}
SYSCALL_ALIAS(sys_s390_fallocate, SyS_s390_fallocate);
#endif
#endif
|
/*---- license ----*/
/*-------------------------------------------------------------------------
Coco.ATG -- Attributed Grammar
Compiler Generator Coco/R,
Copyright (c) 1990, 2004 Hanspeter Moessenboeck, University of Linz
extended by M. Loeberbauer & A. Woess, Univ. of Linz
with improvements by Pat Terry, Rhodes University.
ported to C by Charles Wang <[email protected]>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
As an exception, it is allowed to write an extension of Coco/R that is
used as a plugin in non-free software.
If not otherwise stated, any source code generated by Coco/R (other than
Coco/R itself) does not fall under the GNU General Public License.
-------------------------------------------------------------------------*/
/*---- enable ----*/
#ifndef COCO_CcsXmlParser_H
#define COCO_CcsXmlParser_H
#ifndef COCO_ERRORPOOL_H
#include "c/ErrorPool.h"
#endif
#ifndef COCO_CcsXmlScanner_H
#include "Scanner.h"
#endif
/*---- hIncludes ----*/
#ifndef COCO_GLOBALS_H
#include "Globals.h"
#endif
/*---- enable ----*/
EXTC_BEGIN
/*---- SynDefines ----*/
#define CcsXmlParser_WEAK_USED
/*---- enable ----*/
typedef struct CcsXmlParser_s CcsXmlParser_t;
struct CcsXmlParser_s {
CcsErrorPool_t errpool;
CcsXmlScanner_t scanner;
CcsToken_t * t;
CcsToken_t * la;
int maxT;
/*---- members ----*/
CcGlobals_t globals;
/* Shortcut pointers */
CcSymbolTable_t * symtab;
CcXmlSpecMap_t * xmlspecmap;
CcSyntax_t * syntax;
/*---- enable ----*/
};
CcsXmlParser_t * CcsXmlParser(CcsXmlParser_t * self, FILE * infp, FILE * errfp);
CcsXmlParser_t *
CcsXmlParser_ByName(CcsXmlParser_t * self, const char * infn, FILE * errfp);
void CcsXmlParser_Destruct(CcsXmlParser_t * self);
void CcsXmlParser_Parse(CcsXmlParser_t * self);
void CcsXmlParser_SemErr(CcsXmlParser_t * self, const CcsToken_t * token,
const char * format, ...);
void CcsXmlParser_SemErrT(CcsXmlParser_t * self, const char * format, ...);
EXTC_END
#endif /* COCO_PARSER_H */
|
#ifndef RENDERENVCONSTS_H_INCLUDED
#define RENDERENVCONSTS_H_INCLUDED
/*
* consts
*/
/* The following rendering method is expected to engage in the renderer */
/** \brief available renderer type
*/
enum PreferredRendererType {
RendererUndeterminate, /**< a memory block with undefined renderer */
RendererRasterizer, /**< rasterization renderer */
RendererPathTracer, /**< path tracing renderer */
RendererPhotonTracer, /**< photon tracing renderer */
RendererPhotonMap, /**< photon light map generation renderer */
RendererRadiosity, /**< radiosity light map generation renderer */
RendererRadianceCache, /**< radiance cache generation renderer */
RendererPRT, /**< precomputed radiance transfer renderer */
RendererSelection, /**< object selection renderer */
c_NumRendererType
};
static const int LightModelDirect = 0X1;
static const int LightModelShadow = 0X2;
static const int LightModelLightMap = 0X4;
static const int LightModelSHProbe = 0X8;
static const int LightModelSVO = 0X10;
enum GeometryModelType {
GeometryModelWireframe,
GeometryModelSolid
};
/* Renderer should not handle threading from these constants itself,
* this are the states telling which situation
* the renderer is being created with */
static const int RenderThreadMutual = 0X0;
static const int RenderThreadSeparated = 0X1;
/* These are what renderer expected to behave internally */
static const int RenderThreadSingle = 0X2;
static const int RenderThreadMultiple = 0X4;
enum RenderSpecType {
RenderSpecSWBuiltin,
RenderSpecSWAdvBuiltin,
RenderSpecHWOpenGL,
RenderSpecHWDirectX
};
enum RenderEnvironment {
RenderEnvVoid,
RenderEnvSpec,
RenderEnvProbe,
RenderEnvRenderable,
RenderEnvRenderOut,
RenderEnvThread,
RenderEnvAntialias,
RenderEnvFiltering,
RenderEnvGeometryModel,
RenderEnvPreferredRenderer,
c_NumRenderEnviornmentType
};
#endif // RENDERENVCONSTS_H_INCLUDED
|
/* IEEE754 floating point arithmetic
* single precision
*/
/*
* MIPS floating point support
* Copyright (C) 1994-2000 Algorithmics Ltd.
*
* ########################################################################
*
* This program is free software; you can distribute 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 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 "ieee754sp.h"
/* close to ieeep754sp_logb
*/
ieee754sp ieee754sp_frexp(ieee754sp x, int *eptr)
{
COMPXSP;
CLEARCX;
EXPLODEXSP;
switch (xc) {
case IEEE754_CLASS_SNAN:
case IEEE754_CLASS_QNAN:
case IEEE754_CLASS_INF:
case IEEE754_CLASS_ZERO:
*eptr = 0;
return x;
case IEEE754_CLASS_DNORM:
SPDNORMX;
break;
case IEEE754_CLASS_NORM:
break;
}
*eptr = xe + 1;
return buildsp(xs, -1 + SP_EBIAS, xm & ~SP_HIDDEN_BIT);
}
|
#ifndef MATRIX_SPMATRIX_H
#define MATRIX_SPMATRIX_H
#include "dgeMatrix.h"
#include "R_ext/Lapack.h"
SEXP dspMatrix_validate(SEXP obj);
double get_norm_sp(SEXP obj, const char *typstr);
SEXP dspMatrix_norm(SEXP obj, SEXP type);
SEXP dspMatrix_rcond(SEXP obj, SEXP type);
SEXP dspMatrix_solve(SEXP a);
SEXP dspMatrix_matrix_solve(SEXP a, SEXP b);
SEXP dspMatrix_getDiag(SEXP x);
SEXP lspMatrix_getDiag(SEXP x);
SEXP dspMatrix_setDiag(SEXP x, SEXP d);
SEXP lspMatrix_setDiag(SEXP x, SEXP d);
SEXP dspMatrix_as_dsyMatrix(SEXP from);
SEXP dspMatrix_matrix_mm(SEXP a, SEXP b);
SEXP dspMatrix_trf(SEXP x);
#endif
|
// Copyright (C) 2003--2005 Carnegie Mellon University
// Copyright (C) 2011--2014 Google Inc
//
// This file is part of Ymer.
//
// Ymer 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.
//
// Ymer 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 Ymer; if not, write to the Free Software Foundation,
// Inc., #59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// Internal state of parser.
#ifndef PARSER_STATE_H_
#define PARSER_STATE_H_
#include <optional>
#include <string>
#include <vector>
#include "model.h"
#include "strutil.h"
class ParserState {
public:
ParserState(const std::optional<std::string>& filename,
std::vector<std::string>* errors)
: filename_(filename), errors_(errors), success_(true) {}
Model* mutable_model() {
if (!model_.has_value()) {
model_ = Model();
}
return &model_.value();
}
void add_property(std::unique_ptr<const Expression>&& property) {
properties_.push_back(std::move(property));
}
void add_error(const std::string& error) {
if (!filename_.has_value() || filename_.value() == "-") {
errors_->push_back(error);
} else {
errors_->push_back(StrCat(filename_.value(), ":", error));
}
success_ = false;
}
bool has_model() const { return model_.has_value(); }
Model release_model() { return std::move(model_.value()); }
UniquePtrVector<const Expression> release_properties() {
return std::move(properties_);
}
bool success() const { return success_; }
private:
const std::optional<std::string> filename_;
std::vector<std::string>* const errors_;
std::optional<Model> model_;
UniquePtrVector<const Expression> properties_;
bool success_;
};
#endif // PARSER_STATE_H_
|
/*
LZ4 HC - High Compression Mode of LZ4
Header File
Copyright (C) 2011-2012, Yann Collet.
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the
distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- LZ4 homepage : http://fastcompression.blogspot.com/p/lz4.html
- LZ4 source repository : http://code.google.com/p/lz4/
*/
#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
//**************************************
// Basic Types
//**************************************
#ifndef BYTE
#define BYTE uint8_t
#endif
#ifndef U16
#define U16 uint16_t
#endif
#ifndef U32
#define U32 uint32_t
#endif
#ifndef S32
#define S32 int32_t
#endif
#ifndef U64
#define U64 uint64_t
#endif
#ifndef HTYPE
#define HTYPE const BYTE*
#endif
//**************************************
// Constants
//**************************************
#define MINMATCH 4
#define DICTIONARY_LOGSIZE 16
#define MAXD (1<<DICTIONARY_LOGSIZE)
#define MAXD_MASK ((U32)(MAXD - 1))
#define MAX_DISTANCE (MAXD - 1)
#define HASH_LOG (DICTIONARY_LOGSIZE-1)
#define HASHTABLESIZE (1 << HASH_LOG)
#define HASH_MASK (HASHTABLESIZE - 1)
#define MAX_NB_ATTEMPTS 256
#define ML_BITS 4
#define ML_MASK (size_t)((1U<<ML_BITS)-1)
#define RUN_BITS (8-ML_BITS)
#define RUN_MASK ((1U<<RUN_BITS)-1)
#define COPYLENGTH 8
#define LASTLITERALS 5
#define MFLIMIT (COPYLENGTH+MINMATCH)
#define MINLENGTH (MFLIMIT+1)
#define OPTIMAL_ML (int)((ML_MASK-1)+MINMATCH)
typedef struct
{
const BYTE* base;
HTYPE hashTable[HASHTABLESIZE];
U16 chainTable[MAXD];
const BYTE* nextToUpdate;
} LZ4HC_Data_Structure;
int LZ4_compressHC (const char* source, char* dest, int isize, char* hashTable);
/*
LZ4_compressHC :
return : the number of bytes in compressed buffer dest
note : destination buffer must be already allocated.
To avoid any problem, size it to handle worst cases situations (input data not compressible)
Worst case size evaluation is provided by function LZ4_compressBound() (see "lz4.h")
*/
/* Note :
Decompression functions are provided within regular LZ4 source code (see "lz4.h") (BSD license)
*/
#if defined (__cplusplus)
}
#endif
|
/* LibTomCrypt, modular cryptographic library -- Tom St Denis
*
* LibTomCrypt is a library that provides various cryptographic
* algorithms in a highly modular and flexible manner.
*
* The library is free for all purposes without any express
* guarantee it works.
*/
#include "tomcrypt_private.h"
/**
@file rsa_import.c
Import a PKCS RSA key, Tom St Denis
*/
#ifdef LTC_MRSA
/**
Import an RSAPublicKey or RSAPrivateKey [two-prime only, only support >= 1024-bit keys, defined in PKCS #1 v2.1]
@param in The packet to import from
@param inlen It's length (octets)
@param key [out] Destination for newly imported key
@return CRYPT_OK if successful, upon error allocated memory is freed
*/
int rsa_import(const unsigned char *in, unsigned long inlen, rsa_key *key)
{
int err;
void *zero;
unsigned char *tmpbuf=NULL;
unsigned long tmpbuf_len, len;
LTC_ARGCHK(in != NULL);
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(ltc_mp.name != NULL);
/* init key */
if ((err = mp_init_multi(&key->e, &key->d, &key->N, &key->dQ,
&key->dP, &key->qP, &key->p, &key->q, NULL)) != CRYPT_OK) {
return err;
}
/* see if the OpenSSL DER format RSA public key will work */
tmpbuf_len = inlen;
tmpbuf = XCALLOC(1, tmpbuf_len);
if (tmpbuf == NULL) {
err = CRYPT_MEM;
goto LBL_ERR;
}
len = 0;
err = x509_decode_subject_public_key_info(in, inlen,
PKA_RSA, tmpbuf, &tmpbuf_len,
LTC_ASN1_NULL, NULL, &len);
if (err == CRYPT_OK) { /* SubjectPublicKeyInfo format */
/* now it should be SEQUENCE { INTEGER, INTEGER } */
if ((err = der_decode_sequence_multi(tmpbuf, tmpbuf_len,
LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_INTEGER, 1UL, key->e,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
goto LBL_ERR;
}
key->type = PK_PUBLIC;
err = CRYPT_OK;
goto LBL_FREE;
}
/* not SSL public key, try to match against PKCS #1 standards */
err = der_decode_sequence_multi(in, inlen, LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_EOL, 0UL, NULL);
if (err != CRYPT_OK && err != CRYPT_INPUT_TOO_LONG) {
goto LBL_ERR;
}
if (mp_cmp_d(key->N, 0) == LTC_MP_EQ) {
if ((err = mp_init(&zero)) != CRYPT_OK) {
goto LBL_ERR;
}
/* it's a private key */
if ((err = der_decode_sequence_multi(in, inlen,
LTC_ASN1_INTEGER, 1UL, zero,
LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_INTEGER, 1UL, key->e,
LTC_ASN1_INTEGER, 1UL, key->d,
LTC_ASN1_INTEGER, 1UL, key->p,
LTC_ASN1_INTEGER, 1UL, key->q,
LTC_ASN1_INTEGER, 1UL, key->dP,
LTC_ASN1_INTEGER, 1UL, key->dQ,
LTC_ASN1_INTEGER, 1UL, key->qP,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
mp_clear(zero);
goto LBL_ERR;
}
mp_clear(zero);
key->type = PK_PRIVATE;
} else if (mp_cmp_d(key->N, 1) == LTC_MP_EQ) {
/* we don't support multi-prime RSA */
err = CRYPT_PK_INVALID_TYPE;
goto LBL_ERR;
} else {
/* it's a public key and we lack e */
if ((err = der_decode_sequence_multi(in, inlen,
LTC_ASN1_INTEGER, 1UL, key->N,
LTC_ASN1_INTEGER, 1UL, key->e,
LTC_ASN1_EOL, 0UL, NULL)) != CRYPT_OK) {
goto LBL_ERR;
}
key->type = PK_PUBLIC;
}
err = CRYPT_OK;
goto LBL_FREE;
LBL_ERR:
mp_clear_multi(key->d, key->e, key->N, key->dQ, key->dP, key->qP, key->p, key->q, NULL);
LBL_FREE:
if (tmpbuf != NULL) {
XFREE(tmpbuf);
}
return err;
}
#endif /* LTC_MRSA */
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
|
/**
* MaNGOS is a full featured server for World of Warcraft, supporting
* the following clients: 1.12.x, 2.4.3, 3.3.5a, 4.3.4a and 5.4.8
*
* Copyright (C) 2005-2015 MaNGOS project <http://getmangos.eu>
*
* 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
*
* World of Warcraft, and all World of Warcraft or Warcraft art, images,
* and lore are copyrighted by Blizzard Entertainment, Inc.
*/
#ifndef MANGOS_CREATIONPOLICY_H
#define MANGOS_CREATIONPOLICY_H
#include <stdlib.h>
#include "Platform/Define.h"
namespace MaNGOS
{
template<class T>
/**
* @brief OperatorNew policy creates an object on the heap using new.
*
*/
class MANGOS_DLL_DECL OperatorNew
{
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
return (new T);
}
/**
* @brief
*
* @param obj
*/
static void Destroy(T* obj)
{
delete obj;
}
};
template<class T>
/**
* @brief LocalStaticCreation policy creates an object on the stack the first time call Create.
*
*/
class MANGOS_DLL_DECL LocalStaticCreation
{
/**
* @brief
*
*/
union MaxAlign
{
char t_[sizeof(T)]; /**< TODO */
short int shortInt_; /**< TODO */
int int_; /**< TODO */
long int longInt_; /**< TODO */
float float_; /**< TODO */
double double_; /**< TODO */
long double longDouble_; /**< TODO */
struct Test;
int Test::* pMember_; /**< TODO */
/**
* @brief
*
* @param Test::pMemberFn_)(int
* @return int
*/
int (Test::*pMemberFn_)(int);
};
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
static MaxAlign si_localStatic;
return new(&si_localStatic) T;
}
/**
* @brief
*
* @param obj
*/
static void Destroy(T* obj)
{
obj->~T();
}
};
/**
* CreateUsingMalloc by pass the memory manger.
*/
template<class T>
/**
* @brief
*
*/
class MANGOS_DLL_DECL CreateUsingMalloc
{
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
void* p = malloc(sizeof(T));
if (!p)
{ return NULL; }
return new(p) T;
}
/**
* @brief
*
* @param p
*/
static void Destroy(T* p)
{
p->~T();
free(p);
}
};
template<class T, class CALL_BACK>
/**
* @brief CreateOnCallBack creates the object base on the call back.
*
*/
class MANGOS_DLL_DECL CreateOnCallBack
{
public:
/**
* @brief
*
* @return T
*/
static T* Create()
{
return CALL_BACK::createCallBack();
}
/**
* @brief
*
* @param p
*/
static void Destroy(T* p)
{
CALL_BACK::destroyCallBack(p);
}
};
}
#endif
|
/*
Lucy the Diamond Girl - Game where player collects diamonds.
Copyright (C) 2005-2015 Joni Yrjänä <[email protected]>
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.
Complete license can be found in the LICENSE file.
*/
#include "widget.h"
#include <assert.h>
void widget_set_navigation_right(struct widget * widget, struct widget * right)
{
assert(widget != NULL);
assert(right != NULL);
assert(widget != right);
assert(widget->navigation_right_ == NULL);
widget->navigation_right_ = right;
stack_push(widget->widgets_linking_to_this, right);
stack_push(right->widgets_linking_to_this, widget);
}
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* memset */
#include <libwzd-core/wzd_structs.h>
#include <libwzd-core/wzd_crc32.h>
#define C1 0x12345678
#define C2 0x9abcdef0
int main(int argc, char *argv[])
{
unsigned long c1 = C1;
unsigned long crc = 0x0;
char input1[1024];
const char * file1 = "file_crc.txt";
const unsigned long crc_ref = 0xEB2FAFAF; /* cksfv file_crc.txt */
char * srcdir = NULL;
unsigned long c2 = C2;
if (argc > 1) {
srcdir = argv[1];
} else {
srcdir = getenv("srcdir");
if (srcdir == NULL) {
fprintf(stderr, "Environment variable $srcdir not found, aborting\n");
return 1;
}
}
snprintf(input1,sizeof(input1)-1,"%s/%s",srcdir,file1);
if ( calc_crc32(input1,&crc,0,(unsigned long)-1) ) {
fprintf(stderr, "calc_crc32 failed\n");
return 1;
}
if ( crc != crc_ref ) {
fprintf(stderr, "calc_crc32 returned crap\n");
return 1;
}
if (c1 != C1) {
fprintf(stderr, "c1 nuked !\n");
return -1;
}
if (c2 != C2) {
fprintf(stderr, "c2 nuked !\n");
return -1;
}
return 0;
}
|
/*
* * Copyright (C) 2009-2011 Ali <[email protected]>
* * Copyright (C) 2012-2013 Sean Davis <[email protected]>
* * Copyright (C) 2012-2013 Simon Steinbeiß <[email protected]
*
* Licensed under the GNU General Public License Version 2
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __PAROLE_MODULE_H
#define __PAROLE_MODULE_H
#include <glib-object.h>
#include <src/misc/parole.h>
#include "parole-plugin-player.h"
G_BEGIN_DECLS
#define PAROLE_TYPE_PROVIDER_MODULE (parole_provider_module_get_type () )
#define PAROLE_PROVIDER_MODULE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_PROVIDER_MODULE, ParoleProviderModule))
#define PAROLE_PROVIDER_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PAROLE_TYPE_PROVIDER_MODULE, ParoleProviderModuleClass))
#define PAROLE_IS_PROVIDER_MODULE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_PROVIDER_MODULE))
#define PAROLE_IS_PROVIDER_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PAROLE_TYPE_PROVIDER_MODULE))
#define PAROLE_PROVIDER_MODULE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), PAROLE_TYPE_PROVIDER_MODULE, ParoleProviderModuleClass))
typedef struct _ParoleProviderModuleClass ParoleProviderModuleClass;
typedef struct _ParoleProviderModule ParoleProviderModule;
struct _ParoleProviderModule
{
GTypeModule parent;
GModule *library;
ParolePluginPlayer *player;
GType (*initialize) (ParoleProviderModule *module);
void (*shutdown) (void);
GType provider_type;
gboolean active;
gpointer instance;
gchar *desktop_file;
};
struct _ParoleProviderModuleClass
{
GTypeModuleClass parent_class;
} ;
GType parole_provider_module_get_type (void) G_GNUC_CONST;
ParoleProviderModule *parole_provider_module_new (const gchar *filename,
const gchar *desktop_file);
gboolean parole_provider_module_new_plugin (ParoleProviderModule *module);
void parole_provider_module_free_plugin (ParoleProviderModule *module);
gboolean parole_provider_module_get_is_active (ParoleProviderModule *module);
G_END_DECLS
#endif /* __PAROLE_MODULE_H */
|
/*
* symlink.c
*
* Symlink methods.
*
* Author: Steve Longerbeam <[email protected], or [email protected]>
*
* 2003 (c) MontaVista Software, Inc.
* Copyright 2003 Sony Corporation
* Copyright 2003 Matsushita Electric Industrial Co., Ltd.
*
* This software is being distributed under the terms of the GNU General Public
* License version 2. Some or all of the technology encompassed by this
* software may be subject to one or more patents pending as of the date of
* this notice. No additional patent license will be required for GPL
* implementations of the technology. If you want to create a non-GPL
* implementation of the technology encompassed by this software, please
* contact [email protected] for details including licensing terms and fees.
*
* This file is licensed under the terms of the GNU General Public License
* version 2. This program is licensed "as is" without any warranty of any
* kind, whether express or implied.
*/
#include <linux/fs.h>
#include <linux/pram_fs.h>
int pram_block_symlink(struct inode *inode, const char *symname, int len)
{
struct super_block * sb = inode->i_sb;
pram_off_t block;
char* blockp;
unsigned long flags;
int err;
err = pram_alloc_blocks (inode, 0, 1);
if (err)
return err;
block = pram_find_data_block(inode, 0);
blockp = pram_get_block(sb, block);
pram_lock_block(sb, blockp);
memcpy(blockp, symname, len);
blockp[len] = '\0';
pram_unlock_block(sb, blockp);
return 0;
}
static int pram_readlink(struct dentry *dentry, char *buffer, int buflen)
{
struct inode * inode = dentry->d_inode;
struct super_block * sb = inode->i_sb;
pram_off_t block;
char* blockp;
block = pram_find_data_block(inode, 0);
blockp = pram_get_block(sb, block);
return vfs_readlink(dentry, buffer, buflen, blockp);
}
static int pram_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct inode * inode = dentry->d_inode;
struct super_block * sb = inode->i_sb;
pram_off_t block;
char* blockp;
block = pram_find_data_block(inode, 0);
blockp = pram_get_block(sb, block);
return vfs_follow_link(nd, blockp);
}
struct inode_operations pram_symlink_inode_operations = {
readlink: pram_readlink,
follow_link: pram_follow_link,
};
|
// File: $Id: opbranch.h,v 1.1 2001/10/27 22:34:09 ses6442 Exp p334-70f $
// Author: Benjamin Meyer
// Contributor: Sean Sicher
// Discription: Branch module for
// Revisions:
// $Log: opbranch.h,v $
// Revision 1.1 2001/10/27 22:34:09 ses6442
// Initial revision
//
//
#ifndef OPBRANCH_H
#define OPBRANCH_H
#include "operation.h"
class OpBranch : public Operation {
public:
OpBranch();
// Discription: process this instruction and dump if there are any errors.
virtual bool process();
};
#endif
|
#ifndef GRAPHICS_FX_H
#define GRAPHICS_FX_H
#include "video/video.h" // PlayerVisual
#include "game/game_data.h" // Player
#include "game/camera.h" // Camera
#include "video/nebu_video_types.h" // Visual
void drawImpact(int player);
void drawGlow(PlayerVisual *pV, Player *pTarget, float dim);
#endif
|
/*
* PROJECT: Boot Loader
* LICENSE: BSD - See COPYING.ARM in the top level directory
* FILE: boot/armllb/hw/versatile/hwclcd.c
* PURPOSE: LLB CLCD Routines for Versatile
* PROGRAMMERS: ReactOS Portable Systems Group
*/
#include "precomp.h"
#define LCDTIMING0_PPL(x) ((((x) / 16 - 1) & 0x3f) << 2)
#define LCDTIMING1_LPP(x) (((x) & 0x3ff) - 1)
#define LCDCONTROL_LCDPWR (1 << 11)
#define LCDCONTROL_LCDEN (1)
#define LCDCONTROL_LCDBPP(x) (((x) & 7) << 1)
#define LCDCONTROL_LCDTFT (1 << 5)
#define PL110_LCDTIMING0 (PVOID)0x10120000
#define PL110_LCDTIMING1 (PVOID)0x10120004
#define PL110_LCDTIMING2 (PVOID)0x10120008
#define PL110_LCDUPBASE (PVOID)0x10120010
#define PL110_LCDLPBASE (PVOID)0x10120014
#define PL110_LCDCONTROL (PVOID)0x10120018
PUSHORT LlbHwVideoBuffer;
VOID
NTAPI
LlbHwVersaClcdInitialize(VOID)
{
/* Set framebuffer address */
WRITE_REGISTER_ULONG(PL110_LCDUPBASE, (ULONG)LlbHwGetFrameBuffer());
WRITE_REGISTER_ULONG(PL110_LCDLPBASE, (ULONG)LlbHwGetFrameBuffer());
/* Initialize timings to 720x400 */
WRITE_REGISTER_ULONG(PL110_LCDTIMING0, LCDTIMING0_PPL(LlbHwGetScreenWidth()));
WRITE_REGISTER_ULONG(PL110_LCDTIMING1, LCDTIMING1_LPP(LlbHwGetScreenHeight()));
/* Enable the TFT/LCD Display */
WRITE_REGISTER_ULONG(PL110_LCDCONTROL,
LCDCONTROL_LCDEN |
LCDCONTROL_LCDTFT |
LCDCONTROL_LCDPWR |
LCDCONTROL_LCDBPP(4));
}
ULONG
NTAPI
LlbHwGetScreenWidth(VOID)
{
return 720;
}
ULONG
NTAPI
LlbHwGetScreenHeight(VOID)
{
return 400;
}
PVOID
NTAPI
LlbHwGetFrameBuffer(VOID)
{
return (PVOID)0x000A0000;
}
ULONG
NTAPI
LlbHwVideoCreateColor(IN ULONG Red,
IN ULONG Green,
IN ULONG Blue)
{
return (((Blue >> 3) << 11)| ((Green >> 2) << 5)| ((Red >> 3) << 0));
}
/* EOF */
|
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define MAX_SIZE 1010
int getarray(int a[])
{
int i=0,count;
scanf("%d",&count);
for(; i<count ; i++)
scanf("%d",&a[i]);
return count;
}
int find(int a[], int n, int val)
{
int i,true=0;
for(i=0; i<n; i++)
{
if(a[i]==val)
{
true=1;
return i;
}
}
if(true==0)
return -1;
}
int main()
{
int cases, i;
int arr[MAX_SIZE], size;
int val, found = 0;
scanf("%d", &cases);
for(i = 1; i <= cases; i++)
{
size = getarray(arr);
scanf("%d", &val);
found = find(arr, size, val);
if(found == -1)
{
printf("NOT FOUND\n");
continue;
}
printf("%d\n", found);
}
return 0;
}
|
/*
* Copyright (C) 2019 Paul Davis <[email protected]>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef _ardour_transport_api_h_
#define _ardour_transport_api_h_
#include "ardour/types.h"
#include "ardour/libardour_visibility.h"
namespace ARDOUR
{
class LIBARDOUR_API TransportAPI
{
public:
TransportAPI() {}
virtual ~TransportAPI() {}
private:
friend struct TransportFSM;
virtual void locate (samplepos_t, bool with_roll, bool with_flush, bool with_loop=false, bool force=false, bool with_mmc=true) = 0;
virtual void stop_transport (bool abort = false, bool clear_state = false) = 0;
virtual void start_transport () = 0;
virtual void butler_completed_transport_work () = 0;
virtual void schedule_butler_for_transport_work () = 0;
virtual bool should_roll_after_locate () const = 0;
virtual double speed() const = 0;
virtual void set_transport_speed (double speed, bool abort_capture, bool clear_state, bool as_default) = 0;
virtual samplepos_t position() const = 0;
virtual bool need_declick_before_locate () const = 0;
};
} /* end namespace ARDOUR */
#endif
|
/*
* Copyright (C) 2015-2016 FixCore <FixCore Develops>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_GAMEOBJECTAI_H
#define TRINITY_GAMEOBJECTAI_H
#include "Define.h"
#include <list>
#include "Object.h"
#include "GameObject.h"
#include "CreatureAI.h"
class GameObjectAI
{
protected:
GameObject* const go;
public:
explicit GameObjectAI(GameObject* g) : go(g) {}
virtual ~GameObjectAI() {}
virtual void UpdateAI(uint32 /*diff*/) {}
virtual void InitializeAI() { Reset(); }
virtual void Reset() { }
// Pass parameters between AI
virtual void DoAction(const int32 /*param = 0 */) {}
virtual void SetGUID(uint64 /*guid*/, int32 /*id = 0 */) {}
virtual uint64 GetGUID(int32 /*id = 0 */) const { return 0; }
static int Permissible(GameObject const* go);
virtual bool GossipHello(Player* /*player*/) { return false; }
virtual bool GossipSelect(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/) { return false; }
virtual bool GossipSelectCode(Player* /*player*/, uint32 /*sender*/, uint32 /*action*/, char const* /*code*/) { return false; }
virtual bool QuestAccept(Player* /*player*/, Quest const* /*quest*/) { return false; }
virtual bool QuestReward(Player* /*player*/, Quest const* /*quest*/, uint32 /*opt*/) { return false; }
virtual uint32 GetDialogStatus(Player* /*player*/) { return 100; }
virtual void Destroyed(Player* /*player*/, uint32 /*eventId*/) {}
virtual uint32 GetData(uint32 /*id*/) const { return 0; }
virtual void SetData64(uint32 /*id*/, uint64 /*value*/) {}
virtual uint64 GetData64(uint32 /*id*/) const { return 0; }
virtual void SetData(uint32 /*id*/, uint32 /*value*/) {}
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
virtual void EventInform(uint32 /*eventId*/) {}
};
class NullGameObjectAI : public GameObjectAI
{
public:
explicit NullGameObjectAI(GameObject* g);
void UpdateAI(uint32 /*diff*/) {}
static int Permissible(GameObject const* /*go*/) { return PERMIT_BASE_IDLE; }
};
#endif
|
/****************************************************************************
**
** This file is part of the Qtopia Opensource Edition Package.
**
** Copyright (C) 2008 Trolltech ASA.
**
** Contact: Qt Extended Information ([email protected])
**
** This file may be used under the terms of the GNU General Public License
** versions 2.0 as published by the Free Software Foundation and appearing
** in the file LICENSE.GPL included in the packaging of this file.
**
** Please review the following information to ensure GNU General Public
** Licensing requirements will be met:
** http://www.fsf.org/licensing/licenses/info/GPLv2.html.
**
**
****************************************************************************/
#ifndef BROWSER_H
#define BROWSER_H
#include <QList>
#include <QMailAddress>
#include <QMap>
#include <QString>
#include <QTextBrowser>
#include <QUrl>
#include <QVariant>
class QWidget;
class QMailMessage;
class QMailMessagePart;
class Browser: public QTextBrowser
{
Q_OBJECT
public:
Browser(QWidget *parent = 0);
virtual ~Browser();
void setResource( const QUrl& name, QVariant var );
void clearResources();
void setMessage( const QMailMessage& mail, bool plainTextMode );
void scrollBy(int dx, int dy);
virtual QVariant loadResource(int type, const QUrl& name);
QList<QString> embeddedNumbers() const;
signals:
void finished();
public slots:
virtual void setSource(const QUrl &name);
protected:
void keyPressEvent(QKeyEvent* event);
private:
void displayPlainText(const QMailMessage* mail);
void displayHtml(const QMailMessage* mail);
void setTextResource(const QUrl& name, const QString& textData);
void setImageResource(const QUrl& name, const QByteArray& imageData);
void setPartResource(const QMailMessagePart& part);
QString renderPart(const QMailMessagePart& part);
QString renderAttachment(const QMailMessagePart& part);
QString describeMailSize(uint bytes) const;
QString formatText(const QString& txt) const;
QString smsBreakReplies(const QString& txt) const;
QString noBreakReplies(const QString& txt) const;
QString handleReplies(const QString& txt) const;
QString buildParagraph(const QString& txt, const QString& prepend, bool preserveWs = false) const;
QString encodeUrlAndMail(const QString& txt) const;
QString listRefMailTo(const QList<QMailAddress>& list) const;
QString refMailTo(const QMailAddress& address) const;
QString refNumber(const QString& number) const;
QMap<QUrl, QVariant> resourceMap;
QString (Browser::*replySplitter)(const QString&) const;
mutable QList<QString> numbers;
};
#endif // BROWSER_H
|
/*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef __INC_BLOCK_H
#define __INC_BLOCK_H
#include "vp8/common/onyx.h"
#include "vp8/common/blockd.h"
#include "vp8/common/entropymv.h"
#include "vp8/common/entropy.h"
#include "vpx_ports/mem.h"
#define MAX_MODES 20
#define MAX_ERROR_BINS 1024
typedef struct
{
MV mv;
int offset;
} search_site;
typedef struct block
{
short *src_diff;
short *coeff;
short *quant;
short *quant_fast;
short *quant_shift;
short *zbin;
short *zrun_zbin_boost;
short *round;
short zbin_extra;
unsigned char **base_src;
int src;
int src_stride;
} BLOCK;
typedef struct
{
int count;
struct
{
B_PREDICTION_MODE mode;
int_mv mv;
} bmi[16];
} PARTITION_INFO;
typedef struct macroblock
{
DECLARE_ALIGNED(16, short, src_diff[400]);
DECLARE_ALIGNED(16, short, coeff[400]);
DECLARE_ALIGNED(16, unsigned char, thismb[256]);
unsigned char *thismb_ptr;
BLOCK block[25];
YV12_BUFFER_CONFIG src;
MACROBLOCKD e_mbd;
PARTITION_INFO *partition_info;
PARTITION_INFO *pi;
PARTITION_INFO *pip;
int ref_frame_cost[MAX_REF_FRAMES];
search_site *ss;
int ss_count;
int searches_per_step;
int errorperbit;
int sadperbit16;
int sadperbit4;
int rddiv;
int rdmult;
unsigned int * mb_activity_ptr;
int * mb_norm_activity_ptr;
signed int act_zbin_adj;
signed int last_act_zbin_adj;
int *mvcost[2];
int *mvsadcost[2];
int (*mbmode_cost)[MB_MODE_COUNT];
int (*intra_uv_mode_cost)[MB_MODE_COUNT];
int (*bmode_costs)[10][10];
int *inter_bmode_costs;
int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS]
[MAX_ENTROPY_TOKENS];
int mv_col_min;
int mv_col_max;
int mv_row_min;
int mv_row_max;
int skip;
unsigned int encode_breakout;
signed char *gf_active_ptr;
unsigned char *active_ptr;
MV_CONTEXT *mvc;
int optimize;
int q_index;
#if CONFIG_TEMPORAL_DENOISING
MB_PREDICTION_MODE best_sse_inter_mode;
int_mv best_sse_mv;
MV_REFERENCE_FRAME best_reference_frame;
MV_REFERENCE_FRAME best_zeromv_reference_frame;
unsigned char need_to_clamp_best_mvs;
#endif
int skip_true_count;
unsigned int coef_counts [BLOCK_TYPES] [COEF_BANDS] [PREV_COEF_CONTEXTS] [MAX_ENTROPY_TOKENS];
unsigned int MVcount [2] [MVvals];
int ymode_count [VP8_YMODES];
int uv_mode_count[VP8_UV_MODES];
int64_t prediction_error;
int64_t intra_error;
int count_mb_ref_frame_usage[MAX_REF_FRAMES];
int rd_thresh_mult[MAX_MODES];
int rd_threshes[MAX_MODES];
unsigned int mbs_tested_so_far;
unsigned int mode_test_hit_counts[MAX_MODES];
int zbin_mode_boost_enabled;
int zbin_mode_boost;
int last_zbin_mode_boost;
int last_zbin_over_quant;
int zbin_over_quant;
int error_bins[MAX_ERROR_BINS];
void (*short_fdct4x4)(short *input, short *output, int pitch);
void (*short_fdct8x4)(short *input, short *output, int pitch);
void (*short_walsh4x4)(short *input, short *output, int pitch);
void (*quantize_b)(BLOCK *b, BLOCKD *d);
void (*quantize_b_pair)(BLOCK *b1, BLOCK *b2, BLOCKD *d0, BLOCKD *d1);
} MACROBLOCK;
#endif
|
// Copyright (c) 2000 Max-Planck-Institute Saarbruecken (Germany).
// 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
// 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: https://github.com/CGAL/cgal/blob/releases/CGAL-4.14.1/Partition_2/include/CGAL/Partition_2/Rotation_tree_2.h $
// $Id: Rotation_tree_2.h b33ab79 %aI Andreas Fabri
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Susan Hert <[email protected]>
/*
A rotation tree for computing the vertex visibility graph of a set of
non-intersecting segments in the plane (e.g. edges of a polygon).
Let $V$ be the set of segment endpoints and
let $p_{\infinity}$ ($p_{-\infinity}$) be a point with $y$ coordinate
$\infinity$ ($-\infinity$) and $x$ coordinate larger than all points
in $V$. The tree $G$ is a tree with node set
$V \cup \{p_{\infinity}, p_{-\infinity}\}$. Every node (except the one
corresponding to $p_{\infinity}$) has exactly one outgoing edge to the
point $q$ with the following property: $q$ is the first point encountered
when looking from $p$ in direction $d$ and rotating counterclockwise.
*/
#ifndef CGAL_ROTATION_TREE_H
#define CGAL_ROTATION_TREE_H
#include <CGAL/disable_warnings.h>
#include <CGAL/license/Partition_2.h>
#include <CGAL/vector.h>
#include <CGAL/Partition_2/Rotation_tree_node_2.h>
#include <boost/bind.hpp>
namespace CGAL {
template <class Traits_>
class Rotation_tree_2 : public internal::vector< Rotation_tree_node_2<Traits_> >
{
public:
typedef Traits_ Traits;
typedef Rotation_tree_node_2<Traits> Node;
typedef typename internal::vector<Node>::iterator Self_iterator;
typedef typename Traits::Point_2 Point_2;
using internal::vector< Rotation_tree_node_2<Traits_> >::push_back;
class Greater {
typename Traits::Less_xy_2 less;
typedef typename Traits::Point_2 Point;
public:
Greater(typename Traits::Less_xy_2 less) : less(less) {}
template <typename Point_like>
bool operator()(const Point_like& p1, const Point_like& p2) {
return less(Point(p2), Point(p1));
}
};
// constructor
template<class ForwardIterator>
Rotation_tree_2(ForwardIterator first, ForwardIterator beyond)
{
for (ForwardIterator it = first; it != beyond; it++)
push_back(*it);
Greater greater (Traits().less_xy_2_object());
std::sort(this->begin(), this->end(), greater);
std::unique(this->begin(), this->end());
// front() is the point with the largest x coordinate
// push the point p_minus_infinity; the coordinates should never be used
push_back(Point_2( 1, -1));
// push the point p_infinity; the coordinates should never be used
push_back(Point_2(1, 1));
_p_inf = this->end(); // record the iterators to these extreme points
_p_inf--;
_p_minus_inf = _p_inf;
_p_minus_inf--;
Self_iterator child;
// make p_minus_inf a child of p_inf
set_rightmost_child(_p_minus_inf, _p_inf);
child = this->begin(); // now points to p_0
while (child != _p_minus_inf) // make all points children of p_minus_inf
{
set_rightmost_child(child, _p_minus_inf);
child++;
}
}
// the point that comes first in the right-to-left ordering is first
// in the ordering, after the auxilliary points p_minus_inf and p_inf
Self_iterator rightmost_point_ref()
{
return this->begin();
}
Self_iterator right_sibling(Self_iterator p)
{
if (!(*p).has_right_sibling()) return this->end();
return (*p).right_sibling();
}
Self_iterator left_sibling(Self_iterator p)
{
if (!(*p).has_left_sibling()) return this->end();
return (*p).left_sibling();
}
Self_iterator rightmost_child(Self_iterator p)
{
if (!(*p).has_children()) return this->end();
return (*p).rightmost_child();
}
Self_iterator parent(Self_iterator p)
{
if (!(*p).has_parent()) return this->end();
return (*p).parent();
}
bool parent_is_p_infinity(Self_iterator p)
{
return parent(p) == _p_inf;
}
bool parent_is_p_minus_infinity(Self_iterator p)
{
return parent(p) == _p_minus_inf;
}
// makes *p the parent of *q
void set_parent (Self_iterator p, Self_iterator q)
{
CGAL_assertion(q != this->end());
if (p == this->end())
(*q).clear_parent();
else
(*q).set_parent(p);
}
// makes *p the rightmost child of *q
void set_rightmost_child(Self_iterator p, Self_iterator q);
// makes *p the left sibling of *q
void set_left_sibling(Self_iterator p, Self_iterator q);
// makes *p the right sibling of *q
void set_right_sibling(Self_iterator p, Self_iterator q);
// NOTE: this function does not actually remove the node p from the
// list; it only reorganizes the pointers so this node is not
// in the tree structure anymore
void erase(Self_iterator p);
private:
Self_iterator _p_inf;
Self_iterator _p_minus_inf;
};
}
#include <CGAL/Partition_2/Rotation_tree_2_impl.h>
#include <CGAL/enable_warnings.h>
#endif // CGAL_ROTATION_TREE_H
// For the Emacs editor:
// Local Variables:
// c-basic-offset: 3
// End:
|
#ifndef _LOCKHELP_H
#define _LOCKHELP_H
#include <generated/autoconf.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
#include <linux/interrupt.h>
#include <linux/smp.h>
/* Header to do help in lock debugging. */
#if 0 //CONFIG_NETFILTER_DEBUG
struct spinlock_debug
{
spinlock_t l;
atomic_t locked_by;
};
struct rwlock_debug
{
rwlock_t l;
long read_locked_map;
long write_locked_map;
};
#define DECLARE_LOCK(l) \
struct spinlock_debug l = { SPIN_LOCK_UNLOCKED, ATOMIC_INIT(-1) }
#define DECLARE_LOCK_EXTERN(l) \
extern struct spinlock_debug l
#define DECLARE_RWLOCK(l) \
struct rwlock_debug l = { RW_LOCK_UNLOCKED, 0, 0 }
#define DECLARE_RWLOCK_EXTERN(l) \
extern struct rwlock_debug l
#define MUST_BE_LOCKED(l) \
do { if (atomic_read(&(l)->locked_by) != smp_processor_id()) \
printk("ASSERT %s:%u %s unlocked\n", __FILE__, __LINE__, #l); \
} while(0)
#define MUST_BE_UNLOCKED(l) \
do { if (atomic_read(&(l)->locked_by) == smp_processor_id()) \
printk("ASSERT %s:%u %s locked\n", __FILE__, __LINE__, #l); \
} while(0)
/* Write locked OK as well. */
#define MUST_BE_READ_LOCKED(l) \
do { if (!((l)->read_locked_map & (1UL << smp_processor_id())) \
&& !((l)->write_locked_map & (1UL << smp_processor_id()))) \
printk("ASSERT %s:%u %s not readlocked\n", __FILE__, __LINE__, #l); \
} while(0)
#define MUST_BE_WRITE_LOCKED(l) \
do { if (!((l)->write_locked_map & (1UL << smp_processor_id()))) \
printk("ASSERT %s:%u %s not writelocked\n", __FILE__, __LINE__, #l); \
} while(0)
#define MUST_BE_READ_WRITE_UNLOCKED(l) \
do { if ((l)->read_locked_map & (1UL << smp_processor_id())) \
printk("ASSERT %s:%u %s readlocked\n", __FILE__, __LINE__, #l); \
else if ((l)->write_locked_map & (1UL << smp_processor_id())) \
printk("ASSERT %s:%u %s writelocked\n", __FILE__, __LINE__, #l); \
} while(0)
#define LOCK_BH(lk) \
do { \
MUST_BE_UNLOCKED(lk); \
spin_lock_bh(&(lk)->l); \
atomic_set(&(lk)->locked_by, smp_processor_id()); \
} while(0)
#define UNLOCK_BH(lk) \
do { \
MUST_BE_LOCKED(lk); \
atomic_set(&(lk)->locked_by, -1); \
spin_unlock_bh(&(lk)->l); \
} while(0)
#define READ_LOCK(lk) \
do { \
MUST_BE_READ_WRITE_UNLOCKED(lk); \
read_lock_bh(&(lk)->l); \
set_bit(smp_processor_id(), &(lk)->read_locked_map); \
} while(0)
#define WRITE_LOCK(lk) \
do { \
MUST_BE_READ_WRITE_UNLOCKED(lk); \
write_lock_bh(&(lk)->l); \
set_bit(smp_processor_id(), &(lk)->write_locked_map); \
} while(0)
#define READ_UNLOCK(lk) \
do { \
if (!((lk)->read_locked_map & (1UL << smp_processor_id()))) \
printk("ASSERT: %s:%u %s not readlocked\n", \
__FILE__, __LINE__, #lk); \
clear_bit(smp_processor_id(), &(lk)->read_locked_map); \
read_unlock_bh(&(lk)->l); \
} while(0)
#define WRITE_UNLOCK(lk) \
do { \
MUST_BE_WRITE_LOCKED(lk); \
clear_bit(smp_processor_id(), &(lk)->write_locked_map); \
write_unlock_bh(&(lk)->l); \
} while(0)
#else
#define DECLARE_LOCK(l) spinlock_t l = SPIN_LOCK_UNLOCKED
#define DECLARE_LOCK_EXTERN(l) extern spinlock_t l
#define DECLARE_RWLOCK(l) rwlock_t l = RW_LOCK_UNLOCKED
#define DECLARE_RWLOCK_EXTERN(l) extern rwlock_t l
#define MUST_BE_LOCKED(l)
#define MUST_BE_UNLOCKED(l)
#define MUST_BE_READ_LOCKED(l)
#define MUST_BE_WRITE_LOCKED(l)
#define MUST_BE_READ_WRITE_UNLOCKED(l)
#define LOCK_BH(l) spin_lock_bh(l)
#define UNLOCK_BH(l) spin_unlock_bh(l)
#define READ_LOCK(l) read_lock_bh(l)
#define WRITE_LOCK(l) write_lock_bh(l)
#define READ_UNLOCK(l) read_unlock_bh(l)
#define WRITE_UNLOCK(l) write_unlock_bh(l)
#endif /*CONFIG_NETFILTER_DEBUG*/
#endif /* _LOCKHELP_H */
|
/*
AVFS: A Virtual File System Library
Copyright (C) 1998-2001 Miklos Szeredi <[email protected]>
This program can be distributed under the terms of the GNU GPL.
See the file COPYING.
*/
#include <sys/types.h>
struct child_message {
int reqsize;
int path1size;
int path2size;
};
extern void run(int cfs, const char *codadir, int dm);
extern void child_process(int infd, int outfd);
extern int mount_coda(const char *dev, const char *dir, int devfd, int quiet);
extern int unmount_coda(const char *dir, int quiet);
extern void set_signal_handlers();
extern void clean_exit(int status);
extern void run_exit();
extern void user_child(pid_t pid);
|
/*
* $Id: x2c.c,v 1.7 2009/06/02 09:40:53 bnv Exp $
* $Log: x2c.c,v $
* Revision 1.7 2009/06/02 09:40:53 bnv
* MVS/CMS corrections
*
* Revision 1.6 2008/07/15 07:40:54 bnv
* #include changed from <> to ""
*
* Revision 1.5 2008/07/14 13:08:16 bnv
* MVS,CMS support
*
* Revision 1.4 2002/06/11 12:37:15 bnv
* Added: CDECL
*
* Revision 1.3 2001/06/25 18:49:48 bnv
* Header changed to Id
*
* Revision 1.2 1999/11/26 12:52:25 bnv
* Changed: To use the new macros
*
* Revision 1.1 1998/07/02 17:20:58 bnv
* Initial Version
*
*/
#include <ctype.h>
#include "lerror.h"
#include "lstring.h"
/* ------------------ Lx2c ------------------ */
void __CDECL
Lx2c( const PLstr to, const PLstr from )
{
int i,j,r;
char *t,*f;
L2STR(from);
Lfx(to,LLEN(*from)/2+1); /* a rough estimation */
t = LSTR(*to); f = LSTR(*from);
for (i=r=0; i<LLEN(*from); ) {
for (; ISSPACE(f[i]) && (i<LLEN(*from)); i++) ;; /*skip spaces*/
for (j=i; ISXDIGIT(f[j]) && (j<LLEN(*from)); j++) ;; /* find hexdigits */
if ((i<LLEN(*from)) && (j==i)) { /* Ooops wrong character */
Lerror(ERR_INVALID_HEX_CONST,0);
LZEROSTR(*to); /* return null when error occures */
return;
}
if ((j-i)&1) {
t[r++] = HEXVAL(f[i]);
i++;
}
for (; i<j; i+=2)
t[r++] = (HEXVAL(f[i])<<4) | HEXVAL(f[i+1]);
}
LTYPE(*to) = LSTRING_TY;
LLEN(*to) = r;
} /* Lx2c */
|
/**
* @file id_10361.c
* @brief AOAPC I 10361
* @author chenxilinsidney
* @version 1.0
* @date 2015-03-24
*/
#include <stdio.h>
#include <string.h>
#define MAX_LINE_LENGTH 101
char line[2][MAX_LINE_LENGTH];
int main()
{
int num_case;
scanf("%d\n", &num_case);
while (num_case--) {
gets(*line);
gets(*(line+ 1));
int line_length_a = strlen(*line);
int line_length_b = strlen(*(line + 1));
int line_index = 0;
int char_position[4] = {0};
int position_index = 0;
/* output first line */
while (line_index < line_length_a) {
int character = line[0][line_index];
if (character != '<' && character != '>')
putchar(character);
else
char_position[position_index++] = line_index;
line_index++;
}
printf("\n");
/* output second line */
line[1][line_length_b - 3] = '\0';
printf("%s", line[1]);
for (position_index = 2; position_index >= 0; position_index--)
for (line_index = char_position[position_index] + 1; line_index <
char_position[position_index + 1]; line_index++)
putchar(line[0][line_index]);
printf("%s", line[0] + char_position[3] + 1);
printf("\n");
}
return 0;
}
|
//
// Copyright (C) 2010 Piotr Zagawa
//
// Released under BSD License
//
#pragma once
#include "sqlite3.h"
#include "SqlCommon.h"
#include "SqlFieldSet.h"
#include "SqlRecordSet.h"
namespace sql
{
class Table
{
private:
sqlite3* _db;
string _tableName;
RecordSet _recordset;
public:
Table(sqlite3* db, string tableName, Field* definition);
Table(sqlite3* db, string tableName, FieldSet* fields);
public:
string name();
string getDefinition();
string toString();
string errMsg();
FieldSet* fields();
sqlite3* getHandle();
public:
bool create();
bool exists();
bool remove();
bool truncate();
public:
bool open();
bool open(string whereCondition);
bool open(string whereCondition, string sortBy);
bool query(string queryStr);
int totalRecordCount();
public:
int recordCount();
Record* getRecord(int record_index);
Record* getTopRecord();
Record* getRecordByKeyId(integer keyId);
public:
bool addRecord(Record* record);
bool updateRecord(Record* record);
bool deleteRecords(string whereCondition);
bool copyRecords(Table& source);
bool backup(Table& source);
public:
static Table* createFromDefinition(sqlite3* db, string tableName, string fieldsDefinition);
};
//sql eof
};
|
/* ASE - Allegro Sprite Editor
* Copyright (C) 2001-2011 David Capello
*
* 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 COMMANDS_FILTERS_FILTER_WINDOW_H_INCLUDED
#define COMMANDS_FILTERS_FILTER_WINDOW_H_INCLUDED
#include "gui/box.h"
#include "gui/button.h"
#include "gui/frame.h"
#include "commands/filters/filter_preview.h"
#include "commands/filters/filter_target_buttons.h"
#include "filters/tiled_mode.h"
class FilterManagerImpl;
// A generic window to show parameters for a Filter with integrated
// preview in the current editor.
class FilterWindow : public Frame
{
public:
enum WithChannels { WithChannelsSelector, WithoutChannelsSelector };
enum WithTiled { WithTiledCheckBox, WithoutTiledCheckBox };
FilterWindow(const char* title, const char* cfgSection,
FilterManagerImpl* filterMgr,
WithChannels withChannels,
WithTiled withTiled,
TiledMode tiledMode = TILED_NONE);
~FilterWindow();
// Shows the window as modal (blocking interface), and returns true
// if the user pressed "OK" button (i.e. wants to apply the filter
// with the current settings).
bool doModal();
// Starts (or restart) the preview procedure. You should call this
// method each time the user modifies parameters of the Filter.
void restartPreview();
protected:
// Changes the target buttons. Used by convolution matrix filter
// which specified different targets for each matrix.
void setNewTarget(Target target);
// Returns the container where derived classes should put controls.
Widget* getContainer() { return &m_container; }
void onOk(Event& ev);
void onCancel(Event& ev);
void onShowPreview(Event& ev);
void onTargetButtonChange();
void onTiledChange();
// Derived classes WithTiledCheckBox should set its filter's tiled
// mode overriding this method.
virtual void setupTiledMode(TiledMode tiledMode) { }
private:
const char* m_cfgSection;
FilterManagerImpl* m_filterMgr;
Box m_hbox;
Box m_vbox;
Box m_container;
Button m_okButton;
Button m_cancelButton;
FilterPreview m_preview;
FilterTargetButtons m_targetButton;
CheckBox m_showPreview;
CheckBox* m_tiledCheck;
};
#endif
|
/* -*- mode: c -*- */
/* $Id$ */
/* Copyright (C) 2004-2013 Alexander Chernov <[email protected]> */
/*
* 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.
*/
#include "checker_internal.h"
#include <errno.h>
#include "l10n_impl.h"
int
checker_read_int(
int ind,
const char *name,
int eof_error_flag,
int *p_val)
{
int x;
char sb[128], *db = 0, *vb = 0, *ep = 0;
size_t ds = 0;
if (!name) name = "";
vb = checker_read_buf_2(ind, name, eof_error_flag, sb, sizeof(sb), &db, &ds);
if (!vb) return -1;
if (!*vb) {
fatal_read(ind, _("%s: no int32 value"), name);
}
errno = 0;
x = strtol(vb, &ep, 10);
if (*ep) {
fatal_read(ind, _("%s: cannot parse int32 value"), name);
}
if (errno) {
fatal_read(ind, _("%s: int32 value is out of range"), name);
}
*p_val = x;
return 1;
}
|
#ifndef MANAGER_RENDER_H
#define MANAGER_RENDER_H
#include "manager_space.h"
#include <vector>
#include <string>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/glm.hpp>
using namespace std;
class render_obj {
public:
render_obj();
render_obj(GLuint _vao, GLuint _vbo);
render_obj(GLuint _vao, GLuint _vbo, GLuint _tbo);
render_obj(GLuint _vao, GLuint _vbo, GLuint _tbo, GLuint _nbo);
void basicPlane();
void end();
bool hasV, hasT, hasN;
GLuint vao, vbo, tbo, nbo;
};
class camera{
public:
camera();
camera(int dim);
glm::mat4 proj, model, view, mvp;
void setMat(int dim);
void calcMat();
};
class render_manager {
public:
render_manager();
virtual ~render_manager();
void loadShader(const char *vertexpath, const char *fragmentpath);
void end();
void init();
void useProg(int index);
GLuint getProg(int index);
GLuint getUniform(const char *s);
void putTex(GLuint t_id, int where, const char *var_name);
void loadPNG(const char *name);
void deletePNG(int ind);
void drawImg(int w,int h);
int in_use;
camera c;
render_obj r;
vector<GLuint> prog;
vector<tex> texture;
};
#endif // MANAGER_RENDER_H
|
/*
* Copyright (C) 2012-2017 Jacob R. Lifshay
* This file is part of Voxels.
*
* Voxels 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.
*
* Voxels 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 Voxels; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*/
#ifndef COBBLESTONE_SPIKE_H_INCLUDED
#define COBBLESTONE_SPIKE_H_INCLUDED
#include "generate/decorator.h"
#include "generate/decorator/pregenerated_instance.h"
#include "block/builtin/cobblestone.h"
#include "util/global_instance_maker.h"
namespace programmerjake
{
namespace voxels
{
namespace Decorators
{
namespace builtin
{
class CobblestoneSpikeDecorator : public DecoratorDescriptor
{
friend class global_instance_maker<CobblestoneSpikeDecorator>;
private:
CobblestoneSpikeDecorator() : DecoratorDescriptor(L"builtin.cobblestone_spike", 1, 1000)
{
}
public:
static const CobblestoneSpikeDecorator *pointer()
{
return global_instance_maker<CobblestoneSpikeDecorator>::getInstance();
}
static DecoratorDescriptorPointer descriptor()
{
return pointer();
}
/** @brief create a DecoratorInstance for this decorator in a chunk
*
* @param chunkBasePosition the base position of the chunk to generate in
* @param columnBasePosition the base position of the column to generate in
* @param surfacePosition the surface position of the column to generate in
* @param lock_manager the WorldLockManager
* @param chunkBaseIterator a BlockIterator to chunkBasePosition
* @param blocks the blocks for this chunk
* @param randomSource the RandomSource
* @param generateNumber a number that is different for each decorator in a chunk (use for
*picking a different position each time)
* @return the new DecoratorInstance or nullptr
*
*/
virtual std::shared_ptr<const DecoratorInstance> createInstance(
PositionI chunkBasePosition,
PositionI columnBasePosition,
PositionI surfacePosition,
WorldLockManager &lock_manager,
BlockIterator chunkBaseIterator,
const BlocksGenerateArray &blocks,
RandomSource &randomSource,
std::uint32_t generateNumber) const override
{
std::shared_ptr<PregeneratedDecoratorInstance> retval =
std::make_shared<PregeneratedDecoratorInstance>(
surfacePosition, this, VectorI(-5, 0, -5), VectorI(11, 10, 11));
for(int i = 0; i < 5; i++)
{
retval->setBlock(VectorI(0, i, 0), Block(Blocks::builtin::Cobblestone::descriptor()));
}
for(int i = 5; i < 10; i++)
{
retval->setBlock(VectorI(5 - i, i, 0),
Block(Blocks::builtin::Cobblestone::descriptor()));
retval->setBlock(VectorI(i - 5, i, 0),
Block(Blocks::builtin::Cobblestone::descriptor()));
retval->setBlock(VectorI(0, i, 5 - i),
Block(Blocks::builtin::Cobblestone::descriptor()));
retval->setBlock(VectorI(0, i, i - 5),
Block(Blocks::builtin::Cobblestone::descriptor()));
}
return retval;
}
};
}
}
}
}
#endif // COBBLESTONE_SPIKE_H_INCLUDED
|
#include <cxxtools/http/request.h>
#include <cxxtools/http/reply.h>
#include <cxxtools/http/responder.h>
#include <cxxtools/arg.h>
#include <cxxtools/jsonserializer.h>
#include <cxxtools/serializationinfo.h>
#include <cxxtools/utf8codec.h>
#include <vdr/epg.h>
#include <vdr/plugin.h>
#include "tools.h"
#include "epgsearch/services.h"
#include "epgsearch.h"
#include "events.h"
#ifndef __RESTFUL_SEARCHTIMERS_H
#define __RESETFUL_SEARCHTIMERS_H
class SearchTimersResponder : public cxxtools::http::Responder
{
public:
explicit SearchTimersResponder(cxxtools::http::Service& service)
: cxxtools::http::Responder(service)
{ }
virtual void reply(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replyShow(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replyCreate(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replyDelete(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
virtual void replySearch(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply);
};
typedef cxxtools::http::CachedService<SearchTimersResponder> SearchTimersService;
class SearchTimerList : public BaseList
{
protected:
StreamExtension *s;
int total;
public:
SearchTimerList(std::ostream* _out);
~SearchTimerList();
virtual void init() { };
virtual void addSearchTimer(SerSearchTimerContainer searchTimer) { };
virtual void finish() { };
virtual void setTotal(int _total) { total = _total; };
};
class HtmlSearchTimerList : public SearchTimerList
{
public:
HtmlSearchTimerList(std::ostream* _out) : SearchTimerList(_out) { };
~HtmlSearchTimerList() { };
virtual void init();
virtual void addSearchTimer(SerSearchTimerContainer searchTimer);
virtual void finish();
};
class JsonSearchTimerList : public SearchTimerList
{
private:
std::vector< SerSearchTimerContainer > _items;
public:
JsonSearchTimerList(std::ostream* _out) : SearchTimerList(_out) { };
~JsonSearchTimerList() { };
virtual void init() { };
virtual void addSearchTimer(SerSearchTimerContainer searchTimer);
virtual void finish();
};
class XmlSearchTimerList : public SearchTimerList
{
public:
XmlSearchTimerList(std::ostream* _out) : SearchTimerList(_out) { };
~XmlSearchTimerList() { };
virtual void init();
virtual void addSearchTimer(SerSearchTimerContainer searchTimer);
virtual void finish();
};
#endif
|
/** @file esetinternal.h
* @brief Xapian::ESet::Internal class
*/
/* Copyright (C) 2008,2010 Olly Betts
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef XAPIAN_INCLUDED_ESETINTERNAL_H
#define XAPIAN_INCLUDED_ESETINTERNAL_H
#include "xapian/base.h"
#include "xapian/enquire.h"
#include "xapian/types.h"
#include <algorithm>
#include <string>
#include <vector>
namespace Xapian {
class Database;
class ExpandDecider;
namespace Internal {
class ExpandWeight;
/// Class combining a term and its expand weight.
class ExpandTerm {
friend class Xapian::ESetIterator;
friend class Xapian::ESet::Internal;
/// The expand weight calculated for this term.
Xapian::weight wt;
/// The term.
std::string term;
public:
/// Constructor.
ExpandTerm(Xapian::weight wt_, const std::string & term_)
: wt(wt_), term(term_) { }
/// Implement custom swap for ESet sorting efficiency.
void swap(ExpandTerm & o) {
std::swap(wt, o.wt);
std::swap(term, o.term);
}
/// Ordering relation for ESet contents.
bool operator<(const ExpandTerm & o) const {
if (wt > o.wt) return true;
if (wt < o.wt) return false;
return term > o.term;
}
/// Return a string describing this object.
std::string get_description() const;
};
}
/// Class which actually implements Xapian::ESet.
class ESet::Internal : public Xapian::Internal::RefCntBase {
friend class ESet;
friend class ESetIterator;
/** This is a lower bound on the ESet size if an infinite number of results
* were requested.
*
* It will of course always be true that: ebound >= items.size()
*/
Xapian::termcount ebound;
/// The ExpandTerm objects which represent the items in the ESet.
std::vector<Xapian::Internal::ExpandTerm> items;
/// Don't allow assignment.
void operator=(const Internal &);
/// Don't allow copying.
Internal(const Internal &);
public:
/// Construct an empty ESet::Internal.
Internal() : ebound(0) { }
/// Run the "expand" operation which fills the ESet.
void expand(Xapian::termcount max_esize,
const Xapian::Database & db,
const Xapian::RSet & rset,
const Xapian::ExpandDecider * edecider,
const Xapian::Internal::ExpandWeight & eweight);
/// Return a string describing this object.
std::string get_description() const;
};
}
#endif // XAPIAN_INCLUDED_ESETINTERNAL_H
|
/******************************************************************************
* File : velocity_tria3.c *
* Author : Carlos Rosales Fernandez ([email protected]) *
* Date : 01-09-2006 *
* Revision : 1.0 *
*******************************************************************************
* DESCRIPTION *
* Calculates the three components of the flow speed at a given point Xin[] *
* and returns the values in array U[]. *
* Works for linear interpolation in triangular elements (3-noded triangles). *
******************************************************************************/
/******************************************************************************
* COPYRIGHT & LICENSE INFORMATION *
* *
* Copyright 2006 Carlos Rosales Fernandez and The Institute of High *
* Performance Computing (A*STAR) *
* *
* This file is part of stkSolver. *
* *
* stkSolver 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. *
* *
* stkSolver 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 stkSolver; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
******************************************************************************/
#include "constants.h"
#include "velocity_tria3.h"
int velocity_tria3(double *Xin, double **mNodes, unsigned int **mElems,
double *vProbParam, double *vB, double *U)
{
const unsigned int ELEMS = nElems, NODES_IN_ELEM = 3;
unsigned int currentNode, i, j, SinNode, test, xNode, yNode, zNode;
double dx, dy, dz, factor;
double X[3][3];
double Int[3][3][3];
/* Initialize */
U[0] = U[1] = U[2] = 0.0;
factor = 1.0/(8.0*pi*vProbParam[0]);
for(i = 0; i < ELEMS; i++){
for(j = 0; j < NODES_IN_ELEM; j++){
currentNode = mElems[i][j] - 1;
X[j][0] = mNodes[currentNode][0];
X[j][1] = mNodes[currentNode][1];
X[j][2] = mNodes[currentNode][2];
}
/* Check for singular case */
test = 0;
for(j = 0; j < NODES_IN_ELEM; j++){
dx = X[j][0] - Xin[0];
dy = X[j][1] - Xin[1];
dz = X[j][2] - Xin[2];
if(dx == 0.0 && dy == 0.0 && dz == 0.0){
test = 1;
SinNode = j+1;
break;
}
}
if(test == 0) intGStk_tria3(X,Xin,Int);
else intSingularGStk_tria3(SinNode,X,Xin,Int);
/* Add cotribution from each node j in element i */
for(j = 0; j < NODES_IN_ELEM; j++){
xNode = mElems[i][j] - 1;
yNode = xNode + nNodes;
zNode = yNode + nNodes;
U[0] -= Int[0][0][j]*vB[xNode] + Int[0][1][j]*vB[yNode] + /* Ux */
Int[0][2][j]*vB[zNode];
U[1] -= Int[1][0][j]*vB[xNode] + Int[1][1][j]*vB[yNode] + /* Uy */
Int[1][2][j]*vB[zNode];
U[2] -= Int[2][0][j]*vB[xNode] + Int[2][1][j]*vB[yNode] + /* Uz */
Int[2][2][j]*vB[zNode];
}
}
U[0] = U[0]*factor;
U[1] = U[1]*factor;
U[2] = U[2]*factor;
return 0;
}
|
#ifndef _INCLUDE_DECODER_H
#define _INCLUDE_DECODER_H
#include <sys/time.h>
#include <string>
#include <map>
using std::string;
using std::map;
enum sensor_e {
TFA_1=0, // IT+ Klimalogg Pro, 30.3180, 30.3181, 30.3199(?)
TFA_2, // IT+ 30.3143, 30.3146(?), 30.3144
TFA_3, // 30.3155
TX22, // LaCrosse TX22
TFA_WHP, // 30.3306 (rain meter), pulse data
TFA_WHB, // TFA WeatherHub
FIREANGEL=0x20 // ST-630+W2
};
typedef struct {
sensor_e type;
uint64_t id;
double temp;
double humidity;
int alarm;
int flags;
int sequence;
time_t ts;
int rssi;
} sensordata_t;
class decoder
{
public:
decoder(sensor_e _type);
void set_params(char *_handler, int _mode, int _dbg);
virtual void store_bit(int bit);
virtual void flush(int rssi, int offset=0);
virtual void store_data(sensordata_t &d);
virtual void execute_handler(sensordata_t &d);
virtual void flush_storage(void);
virtual int has_sync(void) {return synced;};
int count(void) {return data.size();}
sensor_e get_type(void) {return type;}
virtual void store_bytes(uint8_t *d, int len);
protected:
int dbg;
int bad;
int synced;
sensor_e type;
uint8_t rdata[256];
int byte_cnt;
private:
char *handler;
int mode;
map<uint64_t,sensordata_t> data;
};
class demodulator
{
public:
demodulator(decoder *_dec);
virtual void start(int len);
virtual void reset(void){};
virtual int demod(int thresh, int pwr, int index, int16_t *iq);
decoder *dec;
protected:
int last_bit_idx;
};
#endif
|
/* Festalon - NSF Player
* Copyright (C) 2004 Xodnizel
*
* 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 <string.h>
#include <stdlib.h>
#include "../types.h"
#include "x6502.h"
#include "cart.h"
#include "memory.h"
/* 16 are (sort of) reserved for UNIF/iNES and 16 to map other stuff. */
static INLINE void setpageptr(NESCART *ca, int s, uint32 A, uint8 *p, int ram)
{
uint32 AB=A>>11;
int x;
if(p)
for(x=(s>>1)-1;x>=0;x--)
{
ca->PRGIsRAM[AB+x]=ram;
ca->Page[AB+x]=p-A;
}
else
for(x=(s>>1)-1;x>=0;x--)
{
ca->PRGIsRAM[AB+x]=0;
ca->Page[AB+x]=0;
}
}
static uint8 nothing[8192];
void FESTAC_Kill(NESCART *ca)
{
free(ca);
}
NESCART *FESTAC_Init(void)
{
int x;
NESCART *ca;
if(!(ca=malloc(sizeof(NESCART)))) return(0);
memset(ca,0,sizeof(NESCART));
for(x=0;x<32;x++)
{
ca->Page[x]=nothing-x*2048;
ca->PRGptr[x]=0;
ca->PRGsize[x]=0;
}
return(ca);
}
void FESTAC_SetupPRG(NESCART *ca, int chip, uint8 *p, uint32 size, int ram)
{
ca->PRGptr[chip]=p;
ca->PRGsize[chip]=size;
ca->PRGmask2[chip]=(size>>11)-1;
ca->PRGmask4[chip]=(size>>12)-1;
ca->PRGmask8[chip]=(size>>13)-1;
ca->PRGmask16[chip]=(size>>14)-1;
ca->PRGmask32[chip]=(size>>15)-1;
ca->PRGram[chip]=ram?1:0;
}
DECLFR(CartBR)
{
NESCART *ca=private;
return ca->Page[A>>11][A];
}
DECLFW(CartBW)
{
NESCART *ca=private;
if(ca->PRGIsRAM[A>>11] && ca->Page[A>>11])
ca->Page[A>>11][A]=V;
}
DECLFR(CartBROB)
{
NESCART *ca=private;
if(!ca->Page[A>>11]) return(DB);
return ca->Page[A>>11][A];
}
void FASTAPASS(3) setprg2r(NESCART *ca, int r, unsigned int A, unsigned int V)
{
V&=ca->PRGmask2[r];
setpageptr(ca,2,A,ca->PRGptr[r]?(&ca->PRGptr[r][V<<11]):0,ca->PRGram[r]);
}
void FASTAPASS(2) setprg2(NESCART *ca, uint32 A, uint32 V)
{
setprg2r(ca,0,A,V);
}
void FASTAPASS(3) setprg4r(NESCART *ca, int r, unsigned int A, unsigned int V)
{
V&=ca->PRGmask4[r];
setpageptr(ca,4,A,ca->PRGptr[r]?(&ca->PRGptr[r][V<<12]):0,ca->PRGram[r]);
}
void FASTAPASS(2) setprg4(NESCART *ca, uint32 A, uint32 V)
{
setprg4r(ca,0,A,V);
}
void FASTAPASS(3) setprg8r(NESCART *ca, int r, unsigned int A, unsigned int V)
{
if(ca->PRGsize[r]>=8192)
{
V&=ca->PRGmask8[r];
setpageptr(ca,8,A,ca->PRGptr[r]?(&ca->PRGptr[r][V<<13]):0,ca->PRGram[r]);
}
else
{
uint32 VA=V<<2;
int x;
for(x=0;x<4;x++)
setpageptr(ca,2,A+(x<<11),ca->PRGptr[r]?(&ca->PRGptr[r][((VA+x)&ca->PRGmask2[r])<<11]):0,ca->PRGram[r]);
}
}
void FASTAPASS(2) setprg8(NESCART *ca, uint32 A, uint32 V)
{
setprg8r(ca,0,A,V);
}
void FASTAPASS(3) setprg16r(NESCART *ca, int r, unsigned int A, unsigned int V)
{
if(ca->PRGsize[r]>=16384)
{
V&=ca->PRGmask16[r];
setpageptr(ca,16,A,ca->PRGptr[r]?(&ca->PRGptr[r][V<<14]):0,ca->PRGram[r]);
}
else
{
uint32 VA=V<<3;
int x;
for(x=0;x<8;x++)
setpageptr(ca,2,A+(x<<11),ca->PRGptr[r]?(&ca->PRGptr[r][((VA+x)&ca->PRGmask2[r])<<11]):0,ca->PRGram[r]);
}
}
void FASTAPASS(2) setprg16(NESCART *ca, uint32 A, uint32 V)
{
setprg16r(ca,0,A,V);
}
void FASTAPASS(3) setprg32r(NESCART *ca, int r,unsigned int A, unsigned int V)
{
if(ca->PRGsize[r]>=32768)
{
V&=ca->PRGmask32[r];
setpageptr(ca,32,A,ca->PRGptr[r]?(&ca->PRGptr[r][V<<15]):0,ca->PRGram[r]);
}
else
{
uint32 VA=V<<4;
int x;
for(x=0;x<16;x++)
setpageptr(ca,2,A+(x<<11),ca->PRGptr[r]?(&ca->PRGptr[r][((VA+x)&ca->PRGmask2[r])<<11]):0,ca->PRGram[r]);
}
}
void FASTAPASS(2) setprg32(NESCART *ca, uint32 A, uint32 V)
{
setprg32r(ca,0,A,V);
}
|
#ifndef __INC_USERVIA_H
#define __INC_USERVIA_H
#include "via.h"
extern VIA uservia;
extern ALLEGRO_USTR *prt_clip_str;
extern FILE *prt_fp;
void uservia_reset(void);
void uservia_write(uint16_t addr, uint8_t val);
uint8_t uservia_read(uint16_t addr);
void uservia_savestate(FILE *f);
void uservia_loadstate(FILE *f);
extern uint8_t lpt_dac;
void uservia_set_ca1(int level);
void uservia_set_ca2(int level);
void uservia_set_cb1(int level);
void uservia_set_cb2(int level);
#endif
|
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#define _CRT_SECURE_NO_WARNINGS
#pragma once
#include "targetver.h"
#include <stdio.h>
#include <stdlib.h>
#include <tchar.h>
#include <direct.h>
#include <string.h>
// TODO: reference additional headers your program requires here
|
// Copyright (C) 2005 - 2021 Settlers Freaks (sf-team at siedler25.org)
//
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <string>
#include <utility>
/// Base class for controls with a tooltip
class ctrlBaseTooltip
{
public:
ctrlBaseTooltip(std::string tooltip = "") : tooltip_(std::move(tooltip)) {}
virtual ~ctrlBaseTooltip();
void SetTooltip(const std::string& tooltip) { tooltip_ = tooltip; }
const std::string& GetTooltip() const { return tooltip_; }
/// Swap the tooltips of those controls
void SwapTooltip(ctrlBaseTooltip& other);
void ShowTooltip() const;
/// Show a temporary tooltip
void ShowTooltip(const std::string& tooltip) const;
void HideTooltip() const;
protected:
std::string tooltip_;
};
|
/*CXXR $Id$
*CXXR
*CXXR This file is part of CXXR, a project to refactor the R interpreter
*CXXR into C++. It may consist in whole or in part of program code and
*CXXR documentation taken from the R project itself, incorporated into
*CXXR CXXR (and possibly MODIFIED) under the terms of the GNU General Public
*CXXR Licence.
*CXXR
*CXXR CXXR is Copyright (C) 2008-14 Andrew R. Runnalls, subject to such other
*CXXR copyrights and copyright restrictions as may be stated below.
*CXXR
*CXXR CXXR is not part of the R project, and bugs and other issues should
*CXXR not be reported via r-bugs or other R project channels; instead refer
*CXXR to the CXXR website.
*CXXR */
/*
* R : A Computer Language for Statistical Data Analysis
* Copyright (C) 2001--2012 The R Core Team.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, a copy is available at
* http://www.r-project.org/Licenses/
*/
#include <R_ext/Complex.h>
#include <R_ext/RS.h>
/* use declarations in R_ext/Lapack.h (instead of having them there *and* here)
but ``delete'' the 'extern' there : */
#define La_extern
#define BLAS_extern
#include <R_ext/Lapack.h>
#undef La_extern
#undef BLAS_extern
|
/*
* setting.h
*
* Created on: 2015. 2. 3.
* Author: asran
*/
#ifndef INCLUDE_SETTING_H_
#define INCLUDE_SETTING_H_
//#define MATRIX
//#define MATRIX_CSR
//#define MATRIX_VECTOR
#define MATRIX_MAP
#define COL_SIZE (1000)
#define ROW_SIZE (1000)
#define VAL_RANGE_START (1)
#define VAL_RANGE_END (10)
#define VAL_PER_COL (6)
#ifdef MATRIX
#include <matrix.h>
typedef matrix::Matrix matrix_t;
#define TEST_MULTI_THREAD (0)
#endif
#ifdef MATRIX_CSR
#include <matrix_csr.h>
typedef matrix::MatrixCSR matrix_t;
#define TEST_MULTI_THREAD (0)
#endif
#ifdef MATRIX_MAP
#include <sparse_matrix2.h>
typedef matrix::SparseMatrix2 matrix_t;
#define TEST_MULTI_THREAD (1)
#endif
#ifdef MATRIX_VECTOR
#include <sparse_matrix.h>
typedef matrix::SparseMatrix matrix_t;
#define TEST_MULTI_THREAD (1)
#endif
#include "matrix_error.h"
#endif /* INCLUDE_SETTING_H_ */
|
#ifndef TOUCHPANEL_H__
#define TOUCHPANEL_H__
/* Pre-defined definition */
/* Register */
#define FD_ADDR_MAX 0xE9
#define FD_ADDR_MIN 0xDD
#define FD_BYTE_COUNT 6
#define CUSTOM_MAX_WIDTH (720)
#define CUSTOM_MAX_HEIGHT (1280)
//#define TPD_UPDATE_FIRMWARE
#define TPD_HAVE_BUTTON
#define TPD_BUTTON_HEIGH (100)
#define TPD_KEY_COUNT 3
#define TPD_KEYS { KEY_MENU, KEY_HOMEPAGE, KEY_BACK}
#define TPD_KEYS_DIM {{145,1330,120,TPD_BUTTON_HEIGH},\
{360,1330,120,TPD_BUTTON_HEIGH},\
{600,1330,120,TPD_BUTTON_HEIGH}}
#define TPD_POWER_SOURCE_CUSTOM MT65XX_POWER_LDO_VGP5
//#define TPD_HAVE_CALIBRATION
//#define TPD_CALIBRATION_MATRIX {2680,0,0,0,2760,0,0,0};
//#define TPD_WARP_START
//#define TPD_WARP_END
//#define TPD_RESET_ISSUE_WORKAROUND
//#define TPD_MAX_RESET_COUNT 3
//#define TPD_WARP_Y(y) ( TPD_Y_RES - 1 - y )
//#define TPD_WARP_X(x) ( x )
#endif /* TOUCHPANEL_H__ */
|
/*
Copyright (C) 2013 Stephen Robinson
This file is part of HDMI-Light
HDMI-Light 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.
HDMI-Light 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 code (see the file names COPING).
If not, see <http://www.gnu.org/licenses/>.
*/
struct ConfigTable
{
unsigned char address;
unsigned char subaddress;
unsigned char data;
};
static const struct ConfigTable g_configTablePreEdid[] PROGMEM =
{
{ 0x98, 0xF4, 0x80 }, // CEC
{ 0x98, 0xF5, 0x7C }, // INFOFRAME
{ 0x98, 0xF8, 0x4C }, // DPLL
{ 0x98, 0xF9, 0x64 }, // KSV
{ 0x98, 0xFA, 0x6C }, // EDID
{ 0x98, 0xFB, 0x68 }, // HDMI
{ 0x98, 0xFD, 0x44 }, // CP
{ 0x64, 0x77, 0x00 }, // Disable the Internal EDID
{ 0x00 }
};
static const struct ConfigTable g_configTablePostEdid[] PROGMEM =
{
{ 0x64, 0x77, 0x00 }, // Set the Most Significant Bit of the SPA location to 0
{ 0x64, 0x52, 0x20 }, // Set the SPA for port B.
{ 0x64, 0x53, 0x00 }, // Set the SPA for port B.
{ 0x64, 0x70, 0x9E }, // Set the Least Significant Byte of the SPA location
{ 0x64, 0x74, 0x03 }, // Enable the Internal EDID for Ports
{ 0x98, 0x01, 0x06 }, // Prim_Mode =110b HDMI-GR
{ 0x98, 0x02, 0xF2 }, // Auto CSC, YCrCb out, Set op_656 bit
{ 0x98, 0x03, 0x40 }, // 24 bit SDR 444 Mode 0
{ 0x98, 0x05, 0x28 }, // AV Codes Off
{ 0x98, 0x0B, 0x44 }, // Power up part
{ 0x98, 0x0C, 0x42 }, // Power up part
{ 0x98, 0x14, 0x55 }, // Min Drive Strength
{ 0x98, 0x15, 0x80 }, // Disable Tristate of Pins
{ 0x98, 0x19, 0x85 }, // LLC DLL phase
{ 0x98, 0x33, 0x40 }, // LLC DLL enable
{ 0x44, 0xBA, 0x01 }, // Set HDMI FreeRun
{ 0x64, 0x40, 0x81 }, // Disable HDCP 1.1 features
{ 0x68, 0x9B, 0x03 }, // ADI recommended setting
{ 0x68, 0xC1, 0x01 }, // ADI recommended setting
{ 0x68, 0xC2, 0x01 }, // ADI recommended setting
{ 0x68, 0xC3, 0x01 }, // ADI recommended setting
{ 0x68, 0xC4, 0x01 }, // ADI recommended setting
{ 0x68, 0xC5, 0x01 }, // ADI recommended setting
{ 0x68, 0xC6, 0x01 }, // ADI recommended setting
{ 0x68, 0xC7, 0x01 }, // ADI recommended setting
{ 0x68, 0xC8, 0x01 }, // ADI recommended setting
{ 0x68, 0xC9, 0x01 }, // ADI recommended setting
{ 0x68, 0xCA, 0x01 }, // ADI recommended setting
{ 0x68, 0xCB, 0x01 }, // ADI recommended setting
{ 0x68, 0xCC, 0x01 }, // ADI recommended setting
{ 0x68, 0x00, 0x00 }, // Set HDMI Input Port A
{ 0x68, 0x83, 0xFE }, // Enable clock terminator for port A
{ 0x68, 0x6F, 0x0C }, // ADI recommended setting
{ 0x68, 0x85, 0x1F }, // ADI recommended setting
{ 0x68, 0x87, 0x70 }, // ADI recommended setting
{ 0x68, 0x8D, 0x04 }, // LFG
{ 0x68, 0x8E, 0x1E }, // HFG
{ 0x68, 0x1A, 0x8A }, // unmute audio
{ 0x68, 0x57, 0xDA }, // ADI recommended setting
{ 0x68, 0x58, 0x01 }, // ADI recommended setting
{ 0x68, 0x75, 0x10 }, // DDC drive strength
{ 0x98, 0x40, 0xE2 }, // INT1 active high, active until cleared
{ 0x00 }
};
|
/*
* UAE - The Un*x Amiga Emulator
*
* Sound emulation stuff
*
* Copyright 1995, 1996, 1997 Bernd Schmidt
*/
#ifndef UAE_AUDIO_H
#define UAE_AUDIO_H
#define PERIOD_MAX ULONG_MAX
extern void aud0_handler (void);
extern void aud1_handler (void);
extern void aud2_handler (void);
extern void aud3_handler (void);
extern void AUDxDAT (int nr, uae_u16 value);
extern void AUDxDAT_addr (int nr, uae_u16 value, uaecptr addr);
extern void AUDxVOL (int nr, uae_u16 value);
extern void AUDxPER (int nr, uae_u16 value);
extern void AUDxLCH (int nr, uae_u16 value);
extern void AUDxLCL (int nr, uae_u16 value);
extern void AUDxLEN (int nr, uae_u16 value);
extern uae_u16 audio_dmal (void);
extern void audio_state_machine (void);
extern uaecptr audio_getpt (int nr, bool reset);
extern int init_audio (void);
extern void ahi_install (void);
extern void audio_reset (void);
extern void update_audio (void);
extern void audio_evhandler (void);
extern void audio_hsync (void);
extern void audio_update_adkmasks (void);
extern void update_sound (double freq, int longframe, int linetoggle);
extern void led_filter_audio (void);
extern void set_audio (void);
extern int audio_activate (void);
extern void audio_vsync (void);
void switch_audio_interpol (void);
extern int sound_available;
extern void audio_sampleripper(int);
extern int sampleripper_enabled;
//extern void write_wavheader (struct zfile *wavfile, uae_u32 size, uae_u32 freq);
enum {
SND_MONO, SND_STEREO, SND_4CH_CLONEDSTEREO, SND_4CH, SND_6CH_CLONEDSTEREO, SND_6CH, SND_NONE };
STATIC_INLINE int get_audio_stereomode (int channels)
{
switch (channels)
{
case 1:
return SND_MONO;
case 2:
return SND_STEREO;
case 4:
return SND_4CH;
case 6:
return SND_6CH;
}
return SND_STEREO;
}
STATIC_INLINE int get_audio_nativechannels (int stereomode)
{
int ch[] = { 1, 2, 4, 4, 6, 6, 0 };
return ch[stereomode];
}
STATIC_INLINE int get_audio_amigachannels (int stereomode)
{
int ch[] = { 1, 2, 2, 4, 2, 4, 0 };
return ch[stereomode];
}
STATIC_INLINE int get_audio_ismono (int stereomode)
{
if (stereomode == 0)
return 1;
return 0;
}
#define SOUND_MAX_DELAY_BUFFER 1024
#define SOUND_MAX_LOG_DELAY 10
#define MIXED_STEREO_MAX 16
#define MIXED_STEREO_SCALE 32
#endif /* UAE_AUDIO_H */
|
// 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 CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_
#define CONTENT_BROWSER_FRAME_HOST_NAVIGATION_CONTROLLER_DELEGATE_H_
#include <string>
#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
namespace content {
struct LoadCommittedDetails;
struct LoadNotificationDetails;
struct NativeWebKeyboardEvent;
class InterstitialPage;
class InterstitialPageImpl;
class RenderViewHost;
class SiteInstance;
class WebContents;
class WebContentsDelegate;
class NavigationControllerDelegate {
public:
virtual ~NavigationControllerDelegate() {}
virtual RenderViewHost* GetRenderViewHost() const = 0;
virtual InterstitialPage* GetInterstitialPage() const = 0;
virtual const std::string& GetContentsMimeType() const = 0;
virtual void NotifyNavigationStateChanged(unsigned changed_flags) = 0;
virtual void Stop() = 0;
virtual SiteInstance* GetSiteInstance() const = 0;
virtual SiteInstance* GetPendingSiteInstance() const = 0;
virtual int32 GetMaxPageID() = 0;
virtual int32 GetMaxPageIDForSiteInstance(SiteInstance* site_instance) = 0;
virtual bool IsLoading() const = 0;
virtual void NotifyBeforeFormRepostWarningShow() = 0;
virtual void NotifyNavigationEntryCommitted(
const LoadCommittedDetails& load_details) = 0;
virtual bool NavigateToPendingEntry(
NavigationController::ReloadType reload_type) = 0;
virtual void SetHistoryLengthAndPrune(
const SiteInstance* site_instance,
int merge_history_length,
int32 minimum_page_id) = 0;
virtual void CopyMaxPageIDsFrom(WebContents* web_contents) = 0;
virtual void UpdateMaxPageID(int32 page_id) = 0;
virtual void UpdateMaxPageIDForSiteInstance(SiteInstance* site_instance,
int32 page_id) = 0;
virtual void ActivateAndShowRepostFormWarningDialog() = 0;
virtual WebContents* GetWebContents() = 0;
virtual bool IsHidden() = 0;
virtual void RenderViewForInterstitialPageCreated(
RenderViewHost* render_view_host) = 0;
virtual void AttachInterstitialPage(
InterstitialPageImpl* interstitial_page) = 0;
virtual void DetachInterstitialPage() = 0;
virtual void SetIsLoading(RenderViewHost* render_view_host,
bool is_loading,
LoadNotificationDetails* details) = 0;
};
}
#endif
|
/**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2017 UniPro <[email protected]>
* http://ugene.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef _U2_DOCUMENT_MODEL_TESTS_H_
#define _U2_DOCUMENT_MODEL_TESTS_H_
#include <U2Test/XMLTestUtils.h>
#include <U2Core/IOAdapter.h>
#include <QDomElement>
namespace U2 {
class Document;
class GObject;
class LoadDocumentTask;
class SaveDocumentTask;
class DocumentProviderTask;
class GTest_LoadDocument : public GTest {
Q_OBJECT
public:
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_LoadDocument, "load-document");
ReportResult report();
void prepare();
virtual void cleanup();
private:
QString docContextName;
LoadDocumentTask* loadTask;
bool contextAdded;
bool tempFile;
QString url;
GTestLogHelper logHelper;
QString expectedLogMessage;
QString expectedLogMessage2;
QString unexpectedLogMessage;
bool needVerifyLog;
};
class GTest_SaveDocument : public GTest {
Q_OBJECT
public:
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_SaveDocument, "save-document");
void prepare();
private:
QString url;
IOAdapterFactory* iof;
QString docContextName;
SaveDocumentTask* saveTask;
};
class GTest_LoadBrokenDocument : public GTest {
Q_OBJECT
public:
SIMPLE_XML_TEST_BODY_WITH_FACTORY_EXT(GTest_LoadBrokenDocument, "load-broken-document", TaskFlags(TaskFlag_NoRun)| TaskFlag_FailOnSubtaskCancel);
Document* getDocument() const;
ReportResult report();
void cleanup();
private:
LoadDocumentTask* loadTask;
QString url;
bool tempFile;
QString message;
};
class GTest_ImportDocument : public GTest {
Q_OBJECT
public:
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_ImportDocument, "import-document");
ReportResult report();
void prepare();
virtual void cleanup();
private:
QString docContextName;
DocumentProviderTask* importTask;
bool contextAdded;
bool tempFile;
QString url;
QString destUrl;
GTestLogHelper logHelper;
QString expectedLogMessage;
QString expectedLogMessage2;
QString unexpectedLogMessage;
bool needVerifyLog;
};
class GTest_ImportBrokenDocument : public GTest {
Q_OBJECT
public:
SIMPLE_XML_TEST_BODY_WITH_FACTORY_EXT(GTest_ImportBrokenDocument, "import-broken-document", TaskFlags(TaskFlag_NoRun)| TaskFlag_FailOnSubtaskCancel);
Document* getDocument() const;
ReportResult report();
void cleanup();
private:
DocumentProviderTask* importTask;
QString url;
QString destUrl;
bool tempFile;
QString message;
};
class GTest_DocumentNumObjects : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_DocumentNumObjects, "check-num-objects");
ReportResult report();
QString docContextName;
int numObjs;
};
class GTest_DocumentFormat : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_DocumentFormat, "check-document-format");
ReportResult report();
QString docUrl;
QString docFormat;
};
class GTest_DocumentObjectNames : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_DocumentObjectNames, "check-document-object-names");
ReportResult report();
QString docContextName;
QStringList names;
};
class GTest_DocumentObjectTypes : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_DocumentObjectTypes, "check-document-object-types");
ReportResult report();
QString docContextName;
QList<GObjectType> types;
};
class DocumentModelTests {
public:
static QList<XMLTestFactory*> createTestFactories();
};
class GTest_FindGObjectByName : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_FindGObjectByName, "find-object-by-name");
ReportResult report();
void cleanup();
private:
QString docContextName;
QString objContextName;
QString objName;
GObjectType type;
GObject* result;
};
class GTest_CompareFiles : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_CompareFiles, "compare-docs");
ReportResult report();
private:
void compareMixed();
QByteArray getLine(IOAdapter* io);
IOAdapter* createIoAdapter(const QString& filePath);
QString doc1Path;
QString doc2Path;
bool byLines;
QStringList commentsStartWith;
bool line_num_only;
bool mixed_lines;
int first_n_lines;
};
class GTest_Compare_VCF_Files : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_Compare_VCF_Files, "compare-vcf-docs");
ReportResult report();
private:
IOAdapter* createIoAdapter(const QString& filePath);
QString getLine(IOAdapter* io);
QString doc1Path;
QString doc2Path;
static const QByteArray COMMENT_MARKER;
};
class GTest_Compare_PDF_Files : public GTest {
Q_OBJECT
SIMPLE_XML_TEST_BODY_WITH_FACTORY(GTest_Compare_PDF_Files, "compare-pdf-docs");
ReportResult report();
private:
QString doc1Path;
QString doc2Path;
bool byLines;
};
}//namespace
#endif
|
/*
This file is part of ffmpeg-php
Copyright (C) 2004-2008 Todd Kirby (ffmpeg.php AT gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
In addition, as a special exception, the copyright holders of ffmpeg-php
give you permission to combine ffmpeg-php with code included in the
standard release of PHP under the PHP license (or modified versions of
such code, with unchanged license). You may copy and distribute such a
system following the terms of the GNU GPL for ffmpeg-php and the licenses
of the other code concerned, provided that you include the source code of
that other code when and as the GNU GPL requires distribution of source code.
You must obey the GNU General Public License in all respects for all of the
code used other than standard release of PHP. If you modify this file, you
may extend this exception to your version of the file, but you are not
obligated to do so. If you do not wish to do so, delete this exception
statement from your version.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
//#include <php.h>
#include "ffmpeg_tools.h"
#if LIBAVCODEC_VERSION_MAJOR >= 52
#include <swscale.h>
/* {{{ ffmpeg_img_convert()
* wrapper around ffmpeg image conversion routines
*/
int img_convert(AVPicture *dst, int dst_pix_fmt,
AVPicture *src, int src_pix_fmt, int src_width, int src_height)
{
struct SwsContext *sws_ctx = NULL;
// TODO: Try to get cached sws_context first
sws_ctx = sws_getContext(src_width, src_height, 0,
src_width, src_height, dst_pix_fmt,
SWS_BICUBIC, NULL, NULL, NULL);
if (sws_ctx == NULL){
return 2;
}
sws_scale(sws_ctx, src->data, src->linesize, 0, src_height, dst->data, dst->linesize);
sws_freeContext(sws_ctx);
return 0;
}
/* }}} */
void img_resample(ImgReSampleContext * context, AVPicture * pxOut, const AVPicture * pxIn)
{
if (context != NULL && context->context != NULL) {
AVPicture shiftedInput; // = {0};
shiftedInput.data[0] = pxIn->data[0] + pxIn->linesize[0] *
context->bandTop + context->bandLeft;
shiftedInput.data[1] = pxIn->data[1] + (pxIn->linesize[1] *
(context->bandTop / 2)) + (context->bandLeft+1) / 2;
shiftedInput.data[2] = pxIn->data[2] + (pxIn->linesize[2] *
(context->bandTop / 2)) + (context->bandLeft+1) / 2;
shiftedInput.linesize[0] = pxIn->linesize[0];
shiftedInput.linesize[1] = pxIn->linesize[1];
shiftedInput.linesize[2] = pxIn->linesize[2];
sws_scale(context->context, (uint8_t**)shiftedInput.data,
(int*)shiftedInput.linesize, 0, context->height - context->bandBottom -
context->bandTop, pxOut->data, pxOut->linesize);
}
}
ImgReSampleContext * img_resample_full_init (int owidth, int oheight, int iwidth, int iheight, int topBand, int bottomBand, int leftBand, int rightBand, int padtop, int padbottom, int padleft, int padright)
{
ImgReSampleContext * s = (ImgReSampleContext *)av_malloc(sizeof(ImgReSampleContext));
if (s == NULL) {
return NULL;
}
int srcSurface = (iwidth - rightBand - leftBand)* (iheight - topBand - bottomBand);
// We use bilinear when the source surface is big, and bicubic when the number of pixels to handle is less than 1 MPixels
s->context = sws_getContext(iwidth - rightBand - leftBand,
iheight - topBand - bottomBand, PIX_FMT_YUV420P, owidth, oheight,
PIX_FMT_YUV420P, srcSurface > 1024000 ? SWS_FAST_BILINEAR : SWS_BICUBIC,
NULL, NULL, NULL);
if (s->context == NULL) {
av_free(s);
return NULL; }
s->bandLeft = leftBand;
s->bandRight = rightBand;
s->bandTop = topBand;
s->bandBottom = bottomBand;
s->padLeft = padleft;
s->padRight = padright;
s->padTop = padtop;
s->padBottom = padbottom;
s->width = iwidth;
s->height = iheight;
s->outWidth = owidth;
s->outHeight = oheight;
return s;
}
ImgReSampleContext * img_resample_init (int owidth, int oheight, int iwidth, int iheight)
{
return img_resample_full_init(owidth, oheight, iwidth, iheight, 0, 0, 0, 0, 0, 0, 0, 0);
}
void img_resample_close(ImgReSampleContext * s)
{
if (s == NULL) return;
sws_freeContext(s->context);
av_free(s);
}
#endif
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: noet sw=4 ts=4
* vim<600: noet sw=4 ts=4
*/
|
/*
** 2004 May 22
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
**
** May you do good and not evil.
** May you find forgiveness for yourself and forgive others.
** May you share freely, never taking more than you give.
**
******************************************************************************
**
** This file contains macros and a little bit of code that is common to
** all of the platform-specific files (os_*.c) and is #included into those
** files.
**
** This file should be #included by the os_*.c files only. It is not a
** general purpose header file.
*/
/*
** At least two bugs have slipped in because we changed the MEMORY_DEBUG
** macro to SQLITE_DEBUG and some older makefiles have not yet made the
** switch. The following code should catch this problem at compile-time.
*/
#ifdef MEMORY_DEBUG
# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead."
#endif
/*
* When testing, this global variable stores the location of the
* pending-byte in the database file.
*/
#ifdef SQLITE_TEST
unsigned int sqlite3_pending_byte = 0x40000000;
#endif
#ifdef SQLITE_DEBUG
int sqlite3_os_trace = 0;
#define OSTRACE1(X) if( sqlite3_os_trace ) sqlite3DebugPrintf(X)
#define OSTRACE2(X,Y) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y)
#define OSTRACE3(X,Y,Z) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z)
#define OSTRACE4(X,Y,Z,A) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A)
#define OSTRACE5(X,Y,Z,A,B) if( sqlite3_os_trace ) sqlite3DebugPrintf(X,Y,Z,A,B)
#define OSTRACE6(X,Y,Z,A,B,C) \
if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C)
#define OSTRACE7(X,Y,Z,A,B,C,D) \
if(sqlite3_os_trace) sqlite3DebugPrintf(X,Y,Z,A,B,C,D)
#else
#define OSTRACE1(X)
#define OSTRACE2(X,Y)
#define OSTRACE3(X,Y,Z)
#define OSTRACE4(X,Y,Z,A)
#define OSTRACE5(X,Y,Z,A,B)
#define OSTRACE6(X,Y,Z,A,B,C)
#define OSTRACE7(X,Y,Z,A,B,C,D)
#endif
/*
** Macros for performance tracing. Normally turned off. Only works
** on i486 hardware.
*/
#ifdef SQLITE_PERFORMANCE_TRACE
__inline__ unsigned long long int hwtime(void){
unsigned long long int x;
__asm__("rdtsc\n\t"
"mov %%edx, %%ecx\n\t"
:"=A" (x));
return x;
}
static unsigned long long int g_start;
static unsigned int elapse;
#define TIMER_START g_start=hwtime()
#define TIMER_END elapse=hwtime()-g_start
#define TIMER_ELAPSED elapse
#else
#define TIMER_START
#define TIMER_END
#define TIMER_ELAPSED 0
#endif
/*
** If we compile with the SQLITE_TEST macro set, then the following block
** of code will give us the ability to simulate a disk I/O error. This
** is used for testing the I/O recovery logic.
*/
#ifdef SQLITE_TEST
int sqlite3_io_error_hit = 0;
int sqlite3_io_error_pending = 0;
int sqlite3_io_error_persist = 0;
int sqlite3_diskfull_pending = 0;
int sqlite3_diskfull = 0;
#define SimulateIOError(CODE) \
if( sqlite3_io_error_pending || sqlite3_io_error_hit ) \
if( sqlite3_io_error_pending-- == 1 \
|| (sqlite3_io_error_persist && sqlite3_io_error_hit) ) \
{ local_ioerr(); CODE; }
static void local_ioerr(){
IOTRACE(("IOERR\n"));
sqlite3_io_error_hit = 1;
}
#define SimulateDiskfullError(CODE) \
if( sqlite3_diskfull_pending ){ \
if( sqlite3_diskfull_pending == 1 ){ \
local_ioerr(); \
sqlite3_diskfull = 1; \
sqlite3_io_error_hit = 1; \
CODE; \
}else{ \
sqlite3_diskfull_pending--; \
} \
}
#else
#define SimulateIOError(A)
#define SimulateDiskfullError(A)
#endif
/*
** When testing, keep a count of the number of open files.
*/
#ifdef SQLITE_TEST
int sqlite3_open_file_count = 0;
#define OpenCounter(X) sqlite3_open_file_count+=(X)
#else
#define OpenCounter(X)
#endif
/*
** sqlite3GenericMalloc
** sqlite3GenericRealloc
** sqlite3GenericOsFree
** sqlite3GenericAllocationSize
**
** Implementation of the os level dynamic memory allocation interface in terms
** of the standard malloc(), realloc() and free() found in many operating
** systems. No rocket science here.
**
** There are two versions of these four functions here. The version
** implemented here is only used if memory-management or memory-debugging is
** enabled. This version allocates an extra 8-bytes at the beginning of each
** block and stores the size of the allocation there.
**
** If neither memory-management or debugging is enabled, the second
** set of implementations is used instead.
*/
#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || defined (SQLITE_MEMDEBUG)
void *sqlite3GenericMalloc(int n){
char *p = (char *)malloc(n+8);
assert(n>0);
assert(sizeof(int)<=8);
if( p ){
*(int *)p = n;
p += 8;
}
return (void *)p;
}
void *sqlite3GenericRealloc(void *p, int n){
char *p2 = ((char *)p - 8);
assert(n>0);
p2 = (char*)realloc(p2, n+8);
if( p2 ){
*(int *)p2 = n;
p2 += 8;
}
return (void *)p2;
}
void sqlite3GenericFree(void *p){
assert(p);
free((void *)((char *)p - 8));
}
int sqlite3GenericAllocationSize(void *p){
return p ? *(int *)((char *)p - 8) : 0;
}
#else
void *sqlite3GenericMalloc(int n){
char *p = (char *)malloc(n);
return (void *)p;
}
void *sqlite3GenericRealloc(void *p, int n){
assert(n>0);
p = realloc(p, n);
return p;
}
void sqlite3GenericFree(void *p){
assert(p);
free(p);
}
/* Never actually used, but needed for the linker */
int sqlite3GenericAllocationSize(void *p){ return 0; }
#endif
/*
** The default size of a disk sector
*/
#ifndef PAGER_SECTOR_SIZE
# define PAGER_SECTOR_SIZE 512
#endif
|
// CHDK palette colors for the s90
// Define color values as needed in this file.
#include "palette.h"
#include "platform_palette.h"
// Playback mode colors
unsigned char ply_colors[] =
{
COLOR_TRANSPARENT, // Placeholder for script colors
COLOR_BLACK, // Placeholder for script colors
0x01, // White
0x2B, // Red
0x29, // Dark Red
0x1E, // Light Red
0x99, // Green
0x25, // Dark Green
0x51, // Light Green
0xA1, // Blue
0xA1, // Dark Blue
0xA9, // Light Blue / Cyan
0x17, // Grey
0x61, // Dark Grey
0x16, // Light Grey
0x9A, // Yellow
0x6F, // Dark Yellow
0x66, // Light Yellow
0x61, // Transparent Dark Grey
COLOR_BLACK, // Magenta
};
// Record mode colors
unsigned char rec_colors[] =
{
COLOR_TRANSPARENT, // Placeholder for script colors
COLOR_BLACK, // Placeholder for script colors
0x01, // White
0x2B, // Red
0x29, // Dark Red
0x1E, // Light Red
0x99, // Green
0x25, // Dark Green
0x51, // Light Green
0xA1, // Blue
0xA1, // Dark Blue
0xA9, // Light Blue / Cyan
0x17, // Grey
0x61, // Dark Grey
0x16, // Light Grey
0x9A, // Yellow
0x6F, // Dark Yellow
0x66, // Light Yellow
0x61, // Transparent Dark Grey
COLOR_BLACK, // Magenta
};
|
// Camera - SX150IS - platform_camera.h
// This file contains the various settings values specific to the SX150IS camera.
// This file is referenced via the 'include/camera.h' file and should not be loaded directly.
// If adding a new settings value put a suitable default in 'include/camera.h',
// along with documentation on what the setting does and how to determine the correct value.
// If the setting should not have a default value then add it in 'include/camera.h'
// using the '#undef' directive along with appropriate documentation.
// Override any default values with your camera specific values in this file. Try and avoid
// having override values that are the same as the default value.
// When overriding a setting value there are two cases:
// 1. If removing the value, because it does not apply to your camera, use the '#undef' directive.
// 2. If changing the value it is best to use an '#undef' directive to remove the default value
// followed by a '#define' to set the new value.
// When porting CHDK to a new camera, check the documentation in 'include/camera.h'
// for information on each setting. If the default values are correct for your camera then
// don't override them again in here.
#define CAM_PROPSET 4
#define CAM_DRYOS 1
#define CAM_DRYOS_2_3_R39 1
#define CAM_DRYOS_2_3_R47 1 // Defined for cameras with DryOS version R47 or higher
#undef CAM_CAN_UNLOCK_OPTICAL_ZOOM_IN_VIDEO
#define CAM_HAS_VIDEO_BUTTON 1
#define CAM_VIDEO_QUALITY_ONLY 1
#define CAM_BRACKETING 1
#undef CAM_VIDEO_CONTROL
#define CAM_HAS_JOGDIAL 1
#undef CAM_USE_ZOOM_FOR_MF
#undef CAM_UNCACHED_BIT
#define CAM_UNCACHED_BIT 0x40000000
#define CAM_ADJUSTABLE_ALT_BUTTON 1
#define CAM_ALT_BUTTON_NAMES { "Playback", "Video", "Display" }
#define CAM_ALT_BUTTON_OPTIONS { KEY_PRINT, KEY_VIDEO, KEY_DISPLAY }
#define CAM_DNG_LENS_INFO { 50,10, 600,10, 34,10, 56,10 } // See comments in camera.h
// pattern
#define cam_CFAPattern 0x01000201 // Green Blue Red Green
// color
#define CAM_COLORMATRIX1 \
1301431, 1000000, -469837, 1000000, -102652, 1000000, \
-200195, 1000000, 961551, 1000000, 238645, 1000000, \
-16441, 1000000, 142319, 1000000, 375979, 1000000
#define cam_CalibrationIlluminant1 1 // Daylight
// Sensor size, DNG image size & cropping
#define CAM_RAW_ROWPIX 4464
#define CAM_RAW_ROWS 3276
#define CAM_JPEG_WIDTH 4368
#define CAM_JPEG_HEIGHT 3254
#define CAM_ACTIVE_AREA_X1 24
#define CAM_ACTIVE_AREA_Y1 10
#define CAM_ACTIVE_AREA_X2 (CAM_RAW_ROWPIX-72)
#define CAM_ACTIVE_AREA_Y2 (CAM_RAW_ROWS-12)
// camera name
#define PARAM_CAMERA_NAME 4 // parameter number for GetParameterData
#undef CAM_SENSOR_BITS_PER_PIXEL
#define CAM_SENSOR_BITS_PER_PIXEL 12
#define CAM_QUALITY_OVERRIDE 1
// copied from the SX200 which has the same video buffer size
#undef CAM_USES_ASPECT_CORRECTION
#define CAM_USES_ASPECT_CORRECTION 1 //camera uses the modified graphics primitives to map screens an viewports to buffers more sized
#undef CAM_BITMAP_WIDTH
#define CAM_BITMAP_WIDTH 720 // Actual width of bitmap screen in bytes
#define CAM_ZEBRA_NOBUF 1
//#undef EDGE_HMARGIN
//#define EDGE_HMARGIN 28
#define CAM_DATE_FOLDER_NAMING 0x400
// CR2 accesible through USB
#undef DEFAULT_RAW_EXT
#define DEFAULT_RAW_EXT 2
#define CAM_DRIVE_MODE_FROM_TIMER_MODE 1 // use PROPCASE_TIMER_MODE to check for multiple shot custom timer.
// Used to enabled bracketing in custom timer, required on many recent cameras
// see http://chdk.setepontos.com/index.php/topic,3994.405.html
#undef CAM_USB_EVENTID
#define CAM_USB_EVENTID 0x202 // Levent ID for USB control. Changed in DryOS R49 so needs to be overridable.
#define REMOTE_SYNC_STATUS_LED 0xC0220014 // specifies an LED that turns on while camera waits for USB remote to sync
#define CAM_USE_ALT_SET_ZOOM_POINT 1 // Define to use the alternate code in lens_set_zoom_point()
#define CAM_USE_ALT_PT_MoveOpticalZoomAt 1 // Define to use the PT_MoveOpticalZoomAt() function in lens_set_zoom_point()
#define CAM_NEED_SET_ZOOM_DELAY 300 // http://chdk.setepontos.com/index.php?topic=6953.msg119736#msg119736
#define CAM_SD_OVER_IN_AF 1
#define CAM_SD_OVER_IN_AFL 1
#define CAM_SD_OVER_IN_MF 1
#undef CAM_AF_LED
#define CAM_AF_LED 1
#define CAM_REAR_CURTAIN 1
//--------------------------------------------------
|
/*
* arch/i386/mm/ioremap.c
*
* Re-map IO memory to kernel address space so that we can access it.
* This is needed for high PCI addresses that aren't mapped in the
* 640k-1MB IO memory area on PC's
*
* (C) Copyright 1995 1996 Linus Torvalds
*/
#include <linux/vmalloc.h>
#include <asm/io.h>
#include <asm/pgalloc.h>
static inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
unsigned long phys_addr, unsigned long flags)
{
unsigned long end;
address &= ~PMD_MASK;
end = address + size;
if (end > PMD_SIZE)
end = PMD_SIZE;
if (address >= end)
BUG();
do {
if (!pte_none(*pte)) {
printk("remap_area_pte: page already exists\n");
BUG();
}
set_pte(pte, mk_pte_phys(phys_addr, __pgprot(_PAGE_PRESENT | _PAGE_RW |
_PAGE_DIRTY | _PAGE_ACCESSED | flags)));
address += PAGE_SIZE;
phys_addr += PAGE_SIZE;
pte++;
} while (address && (address < end));
}
static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
unsigned long phys_addr, unsigned long flags)
{
unsigned long end;
address &= ~PGDIR_MASK;
end = address + size;
if (end > PGDIR_SIZE)
end = PGDIR_SIZE;
phys_addr -= address;
if (address >= end)
BUG();
do {
pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address);
if (!pte)
return -ENOMEM;
remap_area_pte(pte, address, end - address, address + phys_addr, flags);
address = (address + PMD_SIZE) & PMD_MASK;
pmd++;
} while (address && (address < end));
return 0;
}
static int remap_area_pages(unsigned long address, unsigned long phys_addr,
unsigned long size, unsigned long flags)
{
int error;
pgd_t * dir;
unsigned long end = address + size;
phys_addr -= address;
dir = pgd_offset(&init_mm, address);
flush_cache_all();
if (address >= end)
BUG();
spin_lock(&init_mm.page_table_lock);
do {
pmd_t *pmd;
pmd = pmd_alloc(&init_mm, dir, address);
error = -ENOMEM;
if (!pmd)
break;
if (remap_area_pmd(pmd, address, end - address,
phys_addr + address, flags))
break;
error = 0;
address = (address + PGDIR_SIZE) & PGDIR_MASK;
dir++;
} while (address && (address < end));
spin_unlock(&init_mm.page_table_lock);
flush_tlb_all();
return error;
}
/*
* Generic mapping function (not visible outside):
*/
/*
* Remap an arbitrary physical address space into the kernel virtual
* address space. Needed when the kernel wants to access high addresses
* directly.
*
* NOTE! We need to allow non-page-aligned mappings too: we will obviously
* have to convert them into an offset in a page-aligned mapping, but the
* caller shouldn't need to know that small detail.
*/
void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
{
void * addr;
struct vm_struct * area;
unsigned long offset, last_addr;
/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
if (!size || last_addr < phys_addr)
return NULL;
/*
* Don't remap the low PCI/ISA area, it's always mapped..
*/
if (phys_addr >= 0xA0000 && last_addr < 0x100000)
return phys_to_virt(phys_addr);
/*
* Don't allow anybody to remap normal RAM that we're using..
*/
if (phys_addr < virt_to_phys(high_memory)) {
char *t_addr, *t_end;
struct page *page;
t_addr = __va(phys_addr);
t_end = t_addr + (size - 1);
for(page = virt_to_page(t_addr); page <= virt_to_page(t_end); page++)
if(!PageReserved(page))
return NULL;
}
/*
* Mappings have to be page-aligned
*/
offset = phys_addr & ~PAGE_MASK;
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr) - phys_addr;
/*
* Ok, go for it..
*/
area = get_vm_area(size, VM_IOREMAP);
if (!area)
return NULL;
addr = area->addr;
if (remap_area_pages(VMALLOC_VMADDR(addr), phys_addr, size, flags)) {
vfree(addr);
return NULL;
}
return (void *) (offset + (char *)addr);
}
void iounmap(void *addr)
{
if (addr > high_memory)
return vfree((void *) (PAGE_MASK & (unsigned long) addr));
}
void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
{
unsigned long offset, last_addr;
unsigned int nrpages;
enum fixed_addresses idx;
/* Don't allow wraparound or zero size */
last_addr = phys_addr + size - 1;
if (!size || last_addr < phys_addr)
return NULL;
/*
* Don't remap the low PCI/ISA area, it's always mapped..
*/
if (phys_addr >= 0xA0000 && last_addr < 0x100000)
return phys_to_virt(phys_addr);
/*
* Mappings have to be page-aligned
*/
offset = phys_addr & ~PAGE_MASK;
phys_addr &= PAGE_MASK;
size = PAGE_ALIGN(last_addr) - phys_addr;
/*
* Mappings have to fit in the FIX_BTMAP area.
*/
nrpages = size >> PAGE_SHIFT;
if (nrpages > NR_FIX_BTMAPS)
return NULL;
/*
* Ok, go for it..
*/
idx = FIX_BTMAP_BEGIN;
while (nrpages > 0) {
set_fixmap(idx, phys_addr);
phys_addr += PAGE_SIZE;
--idx;
--nrpages;
}
return (void*) (offset + fix_to_virt(FIX_BTMAP_BEGIN));
}
void __init bt_iounmap(void *addr, unsigned long size)
{
unsigned long virt_addr;
unsigned long offset;
unsigned int nrpages;
enum fixed_addresses idx;
virt_addr = (unsigned long)addr;
if (virt_addr < fix_to_virt(FIX_BTMAP_BEGIN))
return;
offset = virt_addr & ~PAGE_MASK;
nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT;
idx = FIX_BTMAP_BEGIN;
while (nrpages > 0) {
__set_fixmap(idx, 0, __pgprot(0));
--idx;
--nrpages;
}
}
|
/* Company : Nequeo Pty Ltd, http://www.nequeo.com.au/
* Copyright : Copyright © Nequeo Pty Ltd 2016 http://www.nequeo.com.au/
*
* File : EndpointInterface.h
* Purpose : SIP Endpoint Interface class.
*
*/
/*
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.
*/
#pragma once
#include <pjsua2\endpoint.hpp>
namespace Nequeo {
namespace Net {
namespace Android {
namespace PjSip
{
typedef void(*OnNatDetectionComplete_Function)(const pj::OnNatDetectionCompleteParam&);
typedef void(*OnNatCheckStunServersComplete_Function)(const pj::OnNatCheckStunServersCompleteParam&);
typedef void(*OnTransportState_Function)(const pj::OnTransportStateParam&);
typedef void(*OnTimer_Function)(const pj::OnTimerParam&);
typedef void(*OnSelectAccount_Function)(pj::OnSelectAccountParam&);
/// <summary>
/// Endpoint callbacks.
/// </summary>
class EndpointInterface : public pj::Endpoint
{
public:
/// <summary>
/// Endpoint callbacks.
/// </summary>
EndpointInterface();
/// <summary>
/// Endpoint callbacks.
/// </summary>
virtual ~EndpointInterface();
};
}
}
}
}
|
#ifndef __DGAPROC_H
#define __DGAPROC_H
#include <X11/Xproto.h>
#include "pixmap.h"
#define DGA_CONCURRENT_ACCESS 0x00000001
#define DGA_FILL_RECT 0x00000002
#define DGA_BLIT_RECT 0x00000004
#define DGA_BLIT_RECT_TRANS 0x00000008
#define DGA_PIXMAP_AVAILABLE 0x00000010
#define DGA_INTERLACED 0x00010000
#define DGA_DOUBLESCAN 0x00020000
#define DGA_FLIP_IMMEDIATE 0x00000001
#define DGA_FLIP_RETRACE 0x00000002
#define DGA_COMPLETED 0x00000000
#define DGA_PENDING 0x00000001
#define DGA_NEED_ROOT 0x00000001
typedef struct {
int num; /* A unique identifier for the mode (num > 0) */
char *name; /* name of mode given in the XF86Config */
int VSync_num;
int VSync_den;
int flags; /* DGA_CONCURRENT_ACCESS, etc... */
int imageWidth; /* linear accessible portion (pixels) */
int imageHeight;
int pixmapWidth; /* Xlib accessible portion (pixels) */
int pixmapHeight; /* both fields ignored if no concurrent access */
int bytesPerScanline;
int byteOrder; /* MSBFirst, LSBFirst */
int depth;
int bitsPerPixel;
unsigned long red_mask;
unsigned long green_mask;
unsigned long blue_mask;
short visualClass;
int viewportWidth;
int viewportHeight;
int xViewportStep; /* viewport position granularity */
int yViewportStep;
int maxViewportX; /* max viewport origin */
int maxViewportY;
int viewportFlags; /* types of page flipping possible */
int offset;
int reserved1;
int reserved2;
} XDGAModeRec, *XDGAModePtr;
/* DDX interface */
extern _X_EXPORT int
DGASetMode(int Index, int num, XDGAModePtr mode, PixmapPtr *pPix);
extern _X_EXPORT void
DGASetInputMode(int Index, Bool keyboard, Bool mouse);
extern _X_EXPORT void
DGASelectInput(int Index, ClientPtr client, long mask);
extern _X_EXPORT Bool DGAAvailable(int Index);
extern _X_EXPORT Bool DGAActive(int Index);
extern _X_EXPORT void DGAShutdown(void);
extern _X_EXPORT void DGAInstallCmap(ColormapPtr cmap);
extern _X_EXPORT int DGAGetViewportStatus(int Index);
extern _X_EXPORT int DGASync(int Index);
extern _X_EXPORT int
DGAFillRect(int Index, int x, int y, int w, int h, unsigned long color);
extern _X_EXPORT int
DGABlitRect(int Index, int srcx, int srcy, int w, int h, int dstx, int dsty);
extern _X_EXPORT int
DGABlitTransRect(int Index,
int srcx, int srcy,
int w, int h, int dstx, int dsty, unsigned long color);
extern _X_EXPORT int
DGASetViewport(int Index, int x, int y, int mode);
extern _X_EXPORT int DGAGetModes(int Index);
extern _X_EXPORT int DGAGetOldDGAMode(int Index);
extern _X_EXPORT int DGAGetModeInfo(int Index, XDGAModePtr mode, int num);
extern _X_EXPORT Bool DGAVTSwitch(void);
extern _X_EXPORT Bool DGAStealButtonEvent(DeviceIntPtr dev, int Index,
int button, int is_down);
extern _X_EXPORT Bool DGAStealMotionEvent(DeviceIntPtr dev, int Index, int dx,
int dy);
extern _X_EXPORT Bool DGAStealKeyEvent(DeviceIntPtr dev, int Index,
int key_code, int is_down);
extern _X_EXPORT Bool DGAOpenFramebuffer(int Index, char **name,
unsigned char **mem, int *size,
int *offset, int *flags);
extern _X_EXPORT void DGACloseFramebuffer(int Index);
extern _X_EXPORT Bool DGAChangePixmapMode(int Index, int *x, int *y, int mode);
extern _X_EXPORT int DGACreateColormap(int Index, ClientPtr client, int id,
int mode, int alloc);
extern _X_EXPORT unsigned char DGAReqCode;
extern _X_EXPORT int DGAErrorBase;
extern _X_EXPORT int DGAEventBase;
extern _X_EXPORT int *XDGAEventBase;
#endif /* __DGAPROC_H */
|
/** @file
* PDM - Pluggable Device Manager, Common Instance Macros.
*/
/*
* Copyright (C) 2006-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_vmm_pdmins_h
#define ___VBox_vmm_pdmins_h
/** @defgroup grp_pdm_ins Common PDM Instance Macros
* @ingroup grp_pdm
* @{
*/
/** @def PDMBOTHCBDECL
* Macro for declaring a callback which is static in HC and exported in GC.
*/
#if defined(IN_RC) || defined(IN_RING0)
# ifdef __cplusplus
# define PDMBOTHCBDECL(type) extern "C" DECLEXPORT(type)
# else
# define PDMBOTHCBDECL(type) DECLEXPORT(type)
# endif
#else
# define PDMBOTHCBDECL(type) static DECLCALLBACK(type)
#endif
/** @def PDMINS_2_DATA
* Converts a PDM Device, USB Device, or Driver instance pointer to a pointer to the instance data.
*/
#define PDMINS_2_DATA(pIns, type) ( (type)(void *)&(pIns)->achInstanceData[0] )
/** @def PDMINS_2_DATA_RCPTR
* Converts a PDM Device, USB Device, or Driver instance pointer to a RC pointer to the instance data.
*/
#define PDMINS_2_DATA_RCPTR(pIns) ( (pIns)->pvInstanceDataRC )
/** @def PDMINS_2_DATA_R3PTR
* Converts a PDM Device, USB Device, or Driver instance pointer to a HC pointer to the instance data.
*/
#define PDMINS_2_DATA_R3PTR(pIns) ( (pIns)->pvInstanceDataR3 )
/** @def PDMINS_2_DATA_R0PTR
* Converts a PDM Device, USB Device, or Driver instance pointer to a R0 pointer to the instance data.
*/
#define PDMINS_2_DATA_R0PTR(pIns) ( (pIns)->pvInstanceDataR0 )
/** @} */
#endif
|
/*
* Copyright (c) 2010, Google, Inc.
*
* This file is part of Libav.
*
* Libav 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.
*
* Libav 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 Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @file
* VP8 decoder support via libvpx
*/
#define VPX_CODEC_DISABLE_COMPAT 1
#include <vpx/vpx_decoder.h>
#include <vpx/vp8dx.h>
#include "libavutil/common.h"
#include "libavutil/imgutils.h"
#include "avcodec.h"
#include "internal.h"
typedef struct VP8DecoderContext {
struct vpx_codec_ctx decoder;
} VP8Context;
static av_cold int vpx_init(AVCodecContext *avctx,
const struct vpx_codec_iface *iface)
{
VP8Context *ctx = avctx->priv_data;
struct vpx_codec_dec_cfg deccfg = {
/* token partitions+1 would be a decent choice */
.threads = FFMIN(avctx->thread_count, 16)
};
av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str());
av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config());
if (vpx_codec_dec_init(&ctx->decoder, iface, &deccfg, 0) != VPX_CODEC_OK) {
const char *error = vpx_codec_error(&ctx->decoder);
av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n",
error);
return AVERROR(EINVAL);
}
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
return 0;
}
static int vp8_decode(AVCodecContext *avctx,
void *data, int *got_frame, AVPacket *avpkt)
{
VP8Context *ctx = avctx->priv_data;
AVFrame *picture = data;
const void *iter = NULL;
struct vpx_image *img;
int ret;
if (vpx_codec_decode(&ctx->decoder, avpkt->data, avpkt->size, NULL, 0) !=
VPX_CODEC_OK) {
const char *error = vpx_codec_error(&ctx->decoder);
const char *detail = vpx_codec_error_detail(&ctx->decoder);
av_log(avctx, AV_LOG_ERROR, "Failed to decode frame: %s\n", error);
if (detail)
av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n",
detail);
return AVERROR_INVALIDDATA;
}
if ((img = vpx_codec_get_frame(&ctx->decoder, &iter))) {
if (img->fmt != VPX_IMG_FMT_I420) {
av_log(avctx, AV_LOG_ERROR, "Unsupported output colorspace (%d)\n",
img->fmt);
return AVERROR_INVALIDDATA;
}
if ((int) img->d_w != avctx->width || (int) img->d_h != avctx->height) {
av_log(avctx, AV_LOG_INFO, "dimension change! %dx%d -> %dx%d\n",
avctx->width, avctx->height, img->d_w, img->d_h);
if (av_image_check_size(img->d_w, img->d_h, 0, avctx))
return AVERROR_INVALIDDATA;
avcodec_set_dimensions(avctx, img->d_w, img->d_h);
}
if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
return ret;
av_image_copy(picture->data, picture->linesize, img->planes,
img->stride, avctx->pix_fmt, img->d_w, img->d_h);
*got_frame = 1;
}
return avpkt->size;
}
static av_cold int vp8_free(AVCodecContext *avctx)
{
VP8Context *ctx = avctx->priv_data;
vpx_codec_destroy(&ctx->decoder);
return 0;
}
#if CONFIG_LIBVPX_VP8_DECODER
static av_cold int vp8_init(AVCodecContext *avctx)
{
return vpx_init(avctx, &vpx_codec_vp8_dx_algo);
}
AVCodec ff_libvpx_vp8_decoder = {
.name = "libvpx",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP8,
.priv_data_size = sizeof(VP8Context),
.init = vp8_init,
.close = vp8_free,
.decode = vp8_decode,
.capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("libvpx VP8"),
};
#endif /* CONFIG_LIBVPX_VP8_DECODER */
#if CONFIG_LIBVPX_VP9_DECODER
static av_cold int vp9_init(AVCodecContext *avctx)
{
return vpx_init(avctx, &vpx_codec_vp9_dx_algo);
}
AVCodec ff_libvpx_vp9_decoder = {
.name = "libvpx-vp9",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_VP9,
.priv_data_size = sizeof(VP8Context),
.init = vp9_init,
.close = vp8_free,
.decode = vp8_decode,
.capabilities = CODEC_CAP_AUTO_THREADS | CODEC_CAP_EXPERIMENTAL,
.long_name = NULL_IF_CONFIG_SMALL("libvpx VP9"),
};
#endif /* CONFIG_LIBVPX_VP9_DECODER */
|
#ifndef GAP_HPC_MISC_H
#define GAP_HPC_MISC_H
#include "system.h"
#ifndef HPCGAP
#error This header is only meant to be used with HPC-GAP
#endif
/****************************************************************************
**
*V ThreadUI . . . . . . . . . . . . . . . . . . . . support UI for threads
**
*/
extern UInt ThreadUI;
/****************************************************************************
**
*V DeadlockCheck . . . . . . . . . . . . . . . . . . check for deadlocks
**
*/
extern UInt DeadlockCheck;
/****************************************************************************
**
*V SyNumProcessors . . . . . . . . . . . . . . . . . number of logical CPUs
**
*/
extern UInt SyNumProcessors;
/****************************************************************************
**
*V SyNumGCThreads . . . . . . . . . . . . . . . number of GC worker threads
**
*/
extern UInt SyNumGCThreads;
/****************************************************************************
**
*F MergeSort() . . . . . . . . . . . . . . . sort an array using mergesort.
**
** MergeSort() sorts an array of 'count' elements of individual size 'width'
** with ordering determined by the parameter 'lessThan'. The 'lessThan'
** function is to return a non-zero value if the first argument is less
** than the second argument, zero otherwise.
**
*/
extern void MergeSort(void *data, UInt count, UInt width,
int (*lessThan)(const void *a, const void *));
#endif // GAP_HPC_MISC_H
|
// Copyright (c) 2009 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_FRAME_EXTRA_SYSTEM_APIS_H_
#define CHROME_FRAME_EXTRA_SYSTEM_APIS_H_
#include <mshtml.h>
#include <shdeprecated.h>
class __declspec(uuid("54A8F188-9EBD-4795-AD16-9B4945119636"))
IWebBrowserEventsService : public IUnknown {
public:
STDMETHOD(FireBeforeNavigate2Event)(VARIANT_BOOL* cancel) = 0;
STDMETHOD(FireNavigateComplete2Event)(VOID) = 0;
STDMETHOD(FireDownloadBeginEvent)(VOID) = 0;
STDMETHOD(FireDownloadCompleteEvent)(VOID) = 0;
STDMETHOD(FireDocumentCompleteEvent)(VOID) = 0;
};
class __declspec(uuid("{87CC5D04-EAFA-4833-9820-8F986530CC00}"))
IWebBrowserEventsUrlService : public IUnknown {
public:
STDMETHOD(GetUrlForEvents)(BSTR* url) = 0;
};
class __declspec(uuid("{3050F804-98B5-11CF-BB82-00AA00BDCE0B}"))
IWebBrowserPriv : public IUnknown {
public:
STDMETHOD(NavigateWithBindCtx)(VARIANT* uri, VARIANT* flags,
VARIANT* target_frame, VARIANT* post_data,
VARIANT* headers, IBindCtx* bind_ctx,
LPOLESTR url_fragment);
STDMETHOD(OnClose)();
};
class IWebBrowserPriv2Common : public IUnknown {
public:
STDMETHOD(NavigateWithBindCtx2)(IUri* uri, VARIANT* flags,
VARIANT* target_frame, VARIANT* post_data,
VARIANT* headers, IBindCtx* bind_ctx,
LPOLESTR url_fragment);
};
class IWebBrowserPriv2CommonIE9 : public IUnknown {
public:
STDMETHOD(NavigateWithBindCtx2)(IUri* uri, VARIANT* flags,
VARIANT* target_frame, VARIANT* post_data,
VARIANT* headers, IBindCtx* bind_ctx,
LPOLESTR url_fragment, DWORD unused1);
};
interface __declspec(uuid("3050f801-98b5-11cf-bb82-00aa00bdce0b"))
IDocObjectService : public IUnknown {
STDMETHOD(FireBeforeNavigate2)(IDispatch* dispatch,
LPCTSTR url, DWORD flags, LPCTSTR frame_name, BYTE* post_data,
DWORD post_data_len, LPCTSTR headers, BOOL play_nav_sound,
BOOL* cancel) = 0;
STDMETHOD(FireNavigateComplete2)(IHTMLWindow2* html_window2,
DWORD flags) = 0;
STDMETHOD(FireDownloadBegin)() = 0;
STDMETHOD(FireDownloadComplete)() = 0;
STDMETHOD(FireDocumentComplete)(IHTMLWindow2* html_window2, DWORD flags) = 0;
STDMETHOD(UpdateDesktopComponent)(IHTMLWindow2* html_window2) = 0;
STDMETHOD(GetPendingUrl)(BSTR* pending_url) = 0;
STDMETHOD(ActiveElementChanged)(IHTMLElement* html_element) = 0;
STDMETHOD(GetUrlSearchComponent)(BSTR* search) = 0;
STDMETHOD(IsErrorUrl)(LPCTSTR url, BOOL* is_error) = 0;
};
interface __declspec(uuid("f62d9369-75ef-4578-8856-232802c76468"))
ITridentService2 : public IUnknown {
STDMETHOD(FireBeforeNavigate2)(IDispatch* dispatch,
LPCTSTR url, DWORD flags, LPCTSTR frame_name, BYTE* post_data,
DWORD post_data_len, LPCTSTR headers, BOOL play_nav_sound,
BOOL* cancel) = 0;
STDMETHOD(FireNavigateComplete2)(IHTMLWindow2*, uint32);
STDMETHOD(FireDownloadBegin)(VOID);
STDMETHOD(FireDownloadComplete)(VOID);
STDMETHOD(FireDocumentComplete)(IHTMLWindow2*, uint32);
STDMETHOD(UpdateDesktopComponent)(IHTMLWindow2*);
STDMETHOD(GetPendingUrl)(uint16**);
STDMETHOD(ActiveElementChanged)(IHTMLElement*);
STDMETHOD(GetUrlSearchComponent)(uint16**);
STDMETHOD(IsErrorUrl)(uint16 const*, int32*);
STDMETHOD(AttachMyPics)(VOID *, VOID**);
STDMETHOD(ReleaseMyPics)(VOID*);
STDMETHOD(IsGalleryMeta)(int32, VOID*);
STDMETHOD(EmailPicture)(uint16*);
STDMETHOD(FireNavigateError)(IHTMLWindow2*,
uint16*,
uint16*,
uint32, int*);
STDMETHOD(FirePrintTemplateEvent)(IHTMLWindow2*, int32);
STDMETHOD(FireUpdatePageStatus)(IHTMLWindow2*, uint32, int32);
STDMETHOD(FirePrivacyImpactedStateChange)(int32 privacy_violated);
STDMETHOD(InitAutoImageResize)(VOID);
STDMETHOD(UnInitAutoImageResize)(VOID);
};
#define TLEF_RELATIVE_INCLUDE_CURRENT (0x01)
#define TLEF_RELATIVE_BACK (0x10)
#define TLEF_RELATIVE_FORE (0x20)
#endif
|
//
// LVKDefaultMessageStickerItem.h
// VKMessenger
//
// Created by Eliah Nikans on 6/9/14.
// Copyright (c) 2014 Levelab. All rights reserved.
//
#import "LVKMessageItemProtocol.h"
@interface LVKDefaultMessageStickerItem : UICollectionViewCell <LVKMessageItemProtocol>
@property (weak, nonatomic) IBOutlet UIImageView *image;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *imageWidthConstraint;
@end
|
#ifndef UI_UNDOVIEW_H
#define UI_UNDOVIEW_H
#include <QtWidgets/QUndoView>
namespace ui {
class UndoView : public QUndoView
{
Q_OBJECT
public:
explicit UndoView(QWidget *parent = 0);
signals:
public slots:
};
} // namespace ui
#endif // UI_UNDOVIEW_H
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef GLK_DETECTION_H
#define GLK_DETECTION_H
#include "engines/advancedDetector.h"
#include "engines/game.h"
#define MAX_SAVES 99
/**
* ScummVM Meta Engine interface
*/
class GlkMetaEngine : public MetaEngine {
private:
Common::String findFileByGameId(const Common::String &gameId) const;
public:
GlkMetaEngine() : MetaEngine() {}
virtual const char *getName() const {
return "ScummGlk";
}
virtual const char *getOriginalCopyright() const {
return "Infocom games (C) Infocom\nScott Adams games (C) Scott Adams";
}
virtual bool hasFeature(MetaEngineFeature f) const override;
virtual Common::Error createInstance(OSystem *syst, Engine **engine) const override;
virtual SaveStateList listSaves(const char *target) const;
virtual int getMaximumSaveSlot() const;
virtual void removeSaveState(const char *target, int slot) const;
SaveStateDescriptor querySaveMetaInfos(const char *target, int slot) const;
/**
* Returns a list of games supported by this engine.
*/
virtual PlainGameList getSupportedGames() const override;
/**
* Runs the engine's game detector on the given list of files, and returns a
* (possibly empty) list of games supported by the engine which it was able
* to detect amongst the given files.
*/
virtual DetectedGames detectGames(const Common::FSList &fslist) const override;
/**
* Query the engine for a PlainGameDescriptor for the specified gameid, if any.
*/
virtual PlainGameDescriptor findGame(const char *gameId) const override;
/**
* Calls each sub-engine in turn to ensure no game Id accidentally shares the same Id
*/
void detectClashes() const;
};
namespace Glk {
/**
* Holds the name of a recognised game
*/
struct GameDescriptor {
const char *_gameId;
const char *_description;
uint _options;
GameDescriptor(const char *gameId, const char *description, uint options) :
_gameId(gameId), _description(description), _options(options) {}
GameDescriptor(const PlainGameDescriptor &gd) : _gameId(gd.gameId), _description(gd.description),
_options(0) {}
static PlainGameDescriptor empty() {
return GameDescriptor(nullptr, nullptr, 0);
}
operator PlainGameDescriptor() const {
PlainGameDescriptor pd;
pd.gameId = _gameId;
pd.description = _description;
return pd;
}
};
} // End of namespace Glk
#endif
|
/**
@copyright
Copyright (c) 2008 - 2010, AuthenTec Oy. All rights reserved.
wince_wan_interface.h
This file contains the type definitions and function declarations
for Windows CE WAN Interfaces (i.e. dial-up interfaces).
*/
#ifndef SSH_WINCE_WAN_INTERFACE_H
#define SSH_WINCE_WAN_INTERFACE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _WIN32_WCE
/*--------------------------------------------------------------------------
DEFINITIONS
--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
ENUMERATIONS
--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
TYPE DEFINITIONS
--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
EXPORTED FUNCTIONS
--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------
Frees buffer returned by ssh_wan_alloc_buffer_send(). Can be called from
a WanSendComplete handler.
--------------------------------------------------------------------------*/
void
ssh_wan_free_buffer_send(PNDIS_WAN_PACKET wan_pkt);
/*--------------------------------------------------------------------------
Inspects a PPP-encapsulated packet received from a WAN protocol. If
it is an IPv4 or IPv6 packet, removes the PPP header from the packet,
leaving a bare IPv4 or IPv6 packet, stores the protocol (IPv4 or
IPv6) in *protocol and returns TRUE. Otherwise leaves the packet
untouched and returns FALSE.
--------------------------------------------------------------------------*/
Boolean
ssh_wan_intercept_from_protocol(SshNdisIMAdapter adapter,
PNDIS_WAN_PACKET packet,
SshInterceptorProtocol *protocol);
/*--------------------------------------------------------------------------
Processes a PPP-encapsulated non-IP packet received from a WAN
protocol. The packet will be either dropped, rejected or passed
directly to the corresponding WAN adapter. The status stored in
*status should be returned to NDIS by the caller.
--------------------------------------------------------------------------*/
void
ssh_wan_process_from_protocol(SshNdisIMAdapter adapter,
PNDIS_WAN_PACKET packet,
PNDIS_STATUS status);
/*--------------------------------------------------------------------------
Inspects a PPP-encapsulated packet received from a WAN adapter. If
it is an IPv4 or IPv6 packet, removes the PPP header from the packet,
leaving a bare IPv4 or IPv6 packet, stores the protocol (IPv4 or
IPv6) in *protocol and returns TRUE. Otherwise leaves the packet
untouched and returns FALSE.
--------------------------------------------------------------------------*/
Boolean
ssh_wan_intercept_from_adapter(SshNdisIMAdapter adapter,
PUCHAR *packet,
ULONG *packet_size,
SshInterceptorProtocol *protocol);
/*--------------------------------------------------------------------------
Processes a PPP-encapsulated non-IP packet received from a WAN
adapter. The packet will be either dropped, rejected or passed
directly to the corresponding WAN protocol. The status stored in
*status should be returned to NDIS by the caller.
--------------------------------------------------------------------------*/
void
ssh_wan_process_from_adapter(SshNdisIMAdapter adapter,
PUCHAR packet,
ULONG packet_size,
PNDIS_STATUS status);
/*--------------------------------------------------------------------------
PPP-encapsulates an IPv4 or IPv6 packet and sends it to WAN
adapter. If successful, returns TRUE, otherwise returns FALSE.
--------------------------------------------------------------------------*/
Boolean
ssh_wan_send_to_adapter(SshNdisIMAdapter adapter,
SshNdisPacket packet,
SshInterceptorProtocol protocol);
/*--------------------------------------------------------------------------
PPP-encapsulates an IPv4 or IPv6 packet and indicates it to WAN
protocol. If successful, returns TRUE, otherwise returns FALSE.
--------------------------------------------------------------------------*/
Boolean
ssh_wan_send_to_protocol(SshNdisIMAdapter adapter,
SshNdisPacket packet,
SshInterceptorProtocol protocol);
#endif /* _WIN32_WCE */
#ifdef __cplusplus
}
#endif
#endif /* SSH_WINCE_WAN_INTERCFACE */
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int f1(int limite);
int f2(int limite)
{
int i;
for (i = 1; i < limite; i ++)
f1(i);
}
int f1(int limite)
{
int i;
for (i = 1; i < limite; i ++)
f2(i);
}
int main(void)
{
f1(25);
}
|
/* dnsmasq is Copyright (c) 2000-2015 Simon Kelley
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 dated June, 1991, or
(at your option) version 3 dated 29 June, 2007.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "dnsmasq.h"
#ifdef HAVE_LOOP
static ssize_t loop_make_probe(u32 uid);
void loop_send_probes()
{
struct server *serv;
if (!option_bool(OPT_LOOP_DETECT))
return;
/* Loop through all upstream servers not for particular domains, and send a query to that server which is
identifiable, via the uid. If we see that query back again, then the server is looping, and we should not use it. */
for (serv = daemon->servers; serv; serv = serv->next)
if (!(serv->flags &
(SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND | SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_LOOP)))
{
ssize_t len = loop_make_probe(serv->uid);
int fd;
struct randfd *rfd = NULL;
if (serv->sfd)
fd = serv->sfd->fd;
else
{
if (!(rfd = allocate_rfd(serv->addr.sa.sa_family)))
continue;
fd = rfd->fd;
}
while (retry_send(sendto(fd, daemon->packet, len, 0,
&serv->addr.sa, sa_len(&serv->addr))));
free_rfd(rfd);
}
}
static ssize_t loop_make_probe(u32 uid)
{
struct dns_header *header = (struct dns_header *)daemon->packet;
unsigned char *p = (unsigned char *)(header+1);
/* packet buffer overwritten */
daemon->srv_save = NULL;
header->id = rand16();
header->ancount = header->nscount = header->arcount = htons(0);
header->qdcount = htons(1);
header->hb3 = HB3_RD;
header->hb4 = 0;
SET_OPCODE(header, QUERY);
*p++ = 8;
sprintf((char *)p, "%.8x", uid);
p += 8;
*p++ = strlen(LOOP_TEST_DOMAIN);
strcpy((char *)p, LOOP_TEST_DOMAIN); /* Add terminating zero */
p += strlen(LOOP_TEST_DOMAIN) + 1;
PUTSHORT(LOOP_TEST_TYPE, p);
PUTSHORT(C_IN, p);
return p - (unsigned char *)header;
}
int detect_loop(char *query, int type)
{
int i;
u32 uid;
struct server *serv;
if (!option_bool(OPT_LOOP_DETECT))
return 0;
if (type != LOOP_TEST_TYPE ||
strlen(LOOP_TEST_DOMAIN) + 9 != strlen(query) ||
strstr(query, LOOP_TEST_DOMAIN) != query + 9)
return 0;
for (i = 0; i < 8; i++)
if (!isxdigit(query[i]))
return 0;
uid = strtol(query, NULL, 16);
for (serv = daemon->servers; serv; serv = serv->next)
if (!(serv->flags &
(SERV_LITERAL_ADDRESS | SERV_NO_ADDR | SERV_USE_RESOLV | SERV_NO_REBIND | SERV_HAS_DOMAIN | SERV_FOR_NODOTS | SERV_LOOP)) &&
uid == serv->uid)
{
serv->flags |= SERV_LOOP;
check_servers(); /* log new state */
return 1;
}
return 0;
}
#endif
|
void dflu_pack_fin(DFluPack *p) {
UC(dmap_fin(NFRAGS, /**/ &p->map));
UC(comm_bags_fin(PINNED, NONE, /**/ &p->hpp, &p->dpp));
if (p->opt.ids) UC(comm_bags_fin(PINNED, NONE, /**/ &p->hii, &p->dii));
if (p->opt.colors) UC(comm_bags_fin(PINNED, NONE, /**/ &p->hcc, &p->dcc));
EFREE(p);
}
void dflu_comm_fin(DFluComm *c) {
UC(comm_fin(c->pp));
if (c->opt.ids) UC(comm_fin(c->ii));
if (c->opt.colors) UC(comm_fin(c->cc));
EFREE(c);
}
void dflu_unpack_fin(DFluUnpack *u) {
UC(comm_bags_fin(HST_ONLY, NONE, &u->hpp, NULL));
if (u->opt.ids) UC(comm_bags_fin(HST_ONLY, NONE, &u->hii, NULL));
if (u->opt.colors) UC(comm_bags_fin(HST_ONLY, NONE, &u->hcc, NULL));
CC(d::Free(u->ppre));
if (u->opt.ids) CC(d::Free(u->iire));
if (u->opt.colors) CC(d::Free(u->ccre));
EFREE(u);
}
|
/*
* Copyright (c) 2011 Picochip Ltd., Jamie Iles
*
* This file contains the hardware definitions of the picoXcell SoC devices.
*
* 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.
*/
#ifndef __ASM_ARCH_HARDWARE_H
#define __ASM_ARCH_HARDWARE_H
#include <mach/picoxcell_soc.h>
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.