text
stringlengths 4
6.14k
|
|---|
/**
* common.h
* CHRONICLES PHYSICS ENGINE
* by Greg Tourville
* Copyright (c) 2007
* Tuesday Jan 23 -
* All Rights Reserved.
**/
#ifndef _PHYSICS_COMMON_H
#define _PHYSICS_COMMON_H
#ifndef RADS
# define RADS (0.017453f)
#endif
#define DEGS (57.29578f)
#ifndef PI
# define PI (3.141593f)
#endif
#define HALF_PI (1.570796f)
#ifndef ROOT_TWO
# define ROOT_TWO (1.414214f)
#endif
struct SPoint;
struct SVector;
struct SBox;
SPoint ClosestPointOnLineSegment( SPoint* line1, SPoint* line2, SPoint* point );
float atan( SPoint* );
float atan( SVector* );
struct SPoint
{
SPoint();
SPoint( float, float );
float x, y;
void Set( float x, float y );
void Translate( SVector* v );
void Difference( SPoint* p2, SVector* ret );
void Add( SPoint* p );
void Copy( SPoint* dest );
};
struct SVector
{
SVector();
SVector( float, float );
float x, y;
void Set( float, float );
void Copy( SVector* ret );
void Flip();
void Add( SVector* v );
void Subtract( SVector* v );
float Length(); // Real Length
float LengthSquared(); // Length without sqrt()
float SquareLength(); // Fast Cartesian Length
void Scale( float s, SVector* ret );
void Scale( float s );
void Normalize();
float DotProduct( SVector* );
void Rotate( float deg );
};
struct SBox
{
SBox();
SBox( SPoint*, SPoint* );
bool IntersectsWithBox( SBox* box );
bool IntersectsWithBoxX( SBox* box );
bool IntersectsWithBoxY( SBox* box );
void FindBoxFromPoints( SPoint* p1, SPoint* p2 );
SPoint position;
SPoint size;
};
#endif
|
/* $Id: edgelist.c,v 1.4 2011/01/25 16:30:48 ellson Exp $ $Revision: 1.4 $ */
/* vim:set shiftwidth=4 ts=8: */
/*************************************************************************
* Copyright (c) 2011 AT&T Intellectual Property
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: See CVS logs. Details at http://www.graphviz.org/
*************************************************************************/
#include "edgelist.h"
#include <assert.h>
static edgelistitem *mkItem(Dt_t * d, edgelistitem * obj, Dtdisc_t * disc)
{
edgelistitem *ap = GNEW(edgelistitem);
ap->edge = obj->edge;
return ap;
}
static void freeItem(Dt_t * d, edgelistitem * obj, Dtdisc_t * disc)
{
free(obj);
}
static int
cmpItem(Dt_t * d, Agedge_t ** key1, Agedge_t ** key2, Dtdisc_t * disc)
{
if (*key1 > *key2)
return 1;
else if (*key1 < *key2)
return -1;
else
return 0;
}
static Dtdisc_t ELDisc = {
offsetof(edgelistitem, edge), /* key */
sizeof(Agedge_t *), /* size */
offsetof(edgelistitem, link), /* link */
(Dtmake_f) mkItem,
(Dtfree_f) freeItem,
(Dtcompar_f) cmpItem,
(Dthash_f) 0,
(Dtmemory_f) 0,
(Dtevent_f) 0
};
edgelist *init_edgelist()
{
edgelist *list = dtopen(&ELDisc, Dtoset);
return list;
}
void free_edgelist(edgelist * list)
{
dtclose(list);
}
void add_edge(edgelist * list, Agedge_t * e)
{
edgelistitem temp;
temp.edge = e;
dtinsert(list, &temp);
}
void remove_edge(edgelist * list, Agedge_t * e)
{
edgelistitem temp;
temp.edge = e;
dtdelete(list, &temp);
}
#ifdef DEBUG
void print_edge(edgelist * list)
{
edgelistitem *temp;
Agedge_t *ep;
for (temp = (edgelistitem *) dtflatten(list); temp;
temp = (edgelistitem *) dtlink(list, (Dtlink_t *) temp)) {
ep = temp->edge;
fprintf(stderr, "%s--%s \n", ep->tail->name, ep->head->name);
}
fputs("\n", stderr);
}
#endif
int size_edgelist(edgelist * list)
{
return dtsize(list);
}
|
////////////////////////////////////////////////////////////
// //
// This file is part of the VRPH software package for //
// generating solutions to vehicle routing problems. //
// VRPH was developed by Chris Groer (cgroer@gmail.com). //
// //
// (c) Copyright 2010 Chris Groer. //
// All Rights Reserved. VRPH is licensed under the //
// Common Public License. See LICENSE file for details. //
// //
////////////////////////////////////////////////////////////
#ifndef _VRP_NODE_H
#define _VRP_NODE_H
#define VRPTW 0
#define MAX_NEIGHBORLIST_SIZE 75
class VRPNode
{
public:
double x;
double y;
double r; // For polar
double theta; // coordinates
int id;
int demand;
int *daily_demands; // For period VRPs
int cluster;
VRPNeighborElement neighbor_list[MAX_NEIGHBORLIST_SIZE];
double service_time;
// represents the time required at the node
double *daily_service_times; // For period VRPs
double arrival_time;
double start_tw;
double end_tw;// Time windows
int num_days; // For multi-day VRPs
// Constructor
VRPNode();
// Constructor for a d-day problem
VRPNode(int d);
// Destructor
~VRPNode();
// Duplication
void duplicate(VRPNode *N);
void show();
};
#endif
|
/* Copyright 2009-2011 Jay Conrod
*
* This file is part of Tungsten.
*
* Tungsten 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.
*
* Tungsten 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 Tungsten. If not, see
* <http://www.gnu.org/licenses/>.
*/
/* This file contains definitions related to the Tungsten object system. In LLVM, a Tungsten
* object is represented by a block of memory containing a vtable pointer, a number of fields
* (stored in the same order as declared in the class, aligned appropriately), and a number of
* pointers used to represent reified type arguments. Each word in the type argument list
* is either a pointer to a class_info, an interface_info, or null (for the nothing type).
* If the type argument has more type arguments, they are stored immediately afterward. For
* example, if an object has the class A[B[C, D], E[F, G]], the type argument words would be
* B, C, D, E, F, G.
*/
#ifndef objects_h
#define objects_h
#include <stdint.h>
typedef struct w_array {
int8_t* data;
intptr_t size;
} w_array;
const uint32_t CLASS_INFO_KIND_MASK = 0x1;
const uint32_t CLASS_INFO_CLASS_FLAG = 0x1;
const uint32_t CLASS_INFO_INTERFACE_FLAG = 0x0;
typedef struct w_class_info {
uint32_t flags;
w_array name;
w_array type_parameters;
const struct w_class_info* superclass;
intptr_t supertype_count;
const struct w_class_info* const* supertype_info;
const int8_t* const* const* supertype_instructions;
intptr_t instance_size;
} w_class_info;
typedef struct w_interface_info {
uint32_t flags;
w_array name;
w_array type_parameters;
const struct w_class_info* superclass;
intptr_t supertype_count;
const struct w_class_info* const* supertype_info;
const int8_t* const* const* supertype_instructions;
} w_interface_info;
const uint32_t TYPE_PARAMETER_INFO_VARIANCE_MASK = 0x3;
const uint32_t TYPE_PARAMETER_INFO_INVARIANT_FLAG = 0x0;
const uint32_t TYPE_PARAMETER_INFO_COVARIANT_FLAG = 0x1;
const uint32_t TYPE_PARAMETER_INFO_CONTRAVARIANT_FLAG = 0x2;
typedef struct w_type_parameter_info {
uint32_t flags;
} w_type_parameter_info;
typedef struct w_vtable {
const w_class_info* info;
} w_vtable;
typedef struct w_object {
const w_vtable* vtable;
const w_class_info const* type_args[0];
} w_object;
#endif
|
/*
* Copyright (C) 2005 - 2011 MaNGOS <http://www.getmangos.org/>
*
* Copyright (C) 2008 - 2011 TrinityCore <http://www.trinitycore.org/>
*
* Copyright (C) 2011 - 2012 TrilliumEMU <http://trilliumx.code-engine.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/// \addtogroup Trilliumd
/// @{
/// \file
#ifndef _RASOCKET_H
#define _RASOCKET_H
#include "Common.h"
#include <ace/Synch_Traits.h>
#include <ace/Svc_Handler.h>
#include <ace/SOCK_Stream.h>
#include <ace/SOCK_Acceptor.h>
/// Remote Administration socket
class RASocket: public ACE_Svc_Handler<ACE_SOCK_STREAM, ACE_MT_SYNCH>
{
public:
RASocket();
virtual ~RASocket();
virtual int svc(void);
virtual int open(void * = 0);
virtual int handle_close(ACE_HANDLE = ACE_INVALID_HANDLE, ACE_Reactor_Mask = ACE_Event_Handler::ALL_EVENTS_MASK);
private:
int recv_line(std::string& out_line);
int recv_line(ACE_Message_Block& buffer);
int process_command(const std::string& command);
int authenticate();
int subnegotiate(); //! Used by telnet protocol RFC 854 / 855
int check_access_level(const std::string& user);
int check_password(const std::string& user, const std::string& pass);
int send(const std::string& line);
static void zprint(void* callbackArg, const char * szText );
static void commandFinished(void* callbackArg, bool success);
private:
/// Minimum security level required to connect
uint8 iMinLevel;
};
#endif
/// @}
|
/*
* Copyright (C) 2010. Adam Barth. 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 Adam Barth. ("Adam Barth") 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 APPLE AND ITS 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 APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef DocumentWriter_h
#define DocumentWriter_h
#include "KURL.h"
#include "PlatformString.h"
namespace WebCore {
class Document;
class Frame;
class SecurityOrigin;
class TextResourceDecoder;
class DocumentWriter {
WTF_MAKE_NONCOPYABLE(DocumentWriter);
public:
DocumentWriter(Frame*);
// This is only called by ScriptController::executeIfJavaScriptURL
// and always contains the result of evaluating a javascript: url.
void replaceDocument(const String&);
void begin();
void begin(const KURL&, bool dispatchWindowObjectAvailable = true, SecurityOrigin* forcedSecurityOrigin = 0);
void addData(const char* string, int length = -1, bool flush = false);
void end();
void endIfNotLoadingMainResource();
void setFrame(Frame* frame) { m_frame = frame; }
String encoding() const;
void setEncoding(const String& encoding, bool userChosen);
// FIXME: It's really unforunate to need to expose this piece of state.
// I suspect a better design is to disentangle user-provided encodings,
// default encodings, and the decoding we're currently using.
String deprecatedFrameEncoding() const;
const String& mimeType() const { return m_mimeType; }
void setMIMEType(const String& type) { m_mimeType = type; }
void setDecoder(TextResourceDecoder*);
// Exposed for DoucmentParser::appendBytes
TextResourceDecoder* createDecoderIfNeeded();
void reportDataReceived();
void setDocumentWasLoadedAsPartOfNavigation();
#if ENABLE(WML)
// Workaround for: XML Declaration allowed only at the start of the document.
bool receivedData() { return m_receivedData; }
#endif
/*guoxiaolei 20120827 end>*/
private:
PassRefPtr<Document> createDocument(const KURL&);
void clear();
Frame* m_frame;
bool m_receivedData;
String m_mimeType;
bool m_encodingWasChosenByUser;
String m_encoding;
RefPtr<TextResourceDecoder> m_decoder;
};
} // namespace WebCore
#endif // DocumentWriter_h
|
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-01-05 Bernard the first version
* 2014-04-27 Bernard make code cleanup.
*/
#include <board.h>
#include <rtthread.h>
#include <finsh.h>
#ifdef PKG_USING_GUIENGINE
#include "rtgui_demo.h"
#include <rtgui/driver.h>
#endif
#ifdef RT_USING_DFS
/* dfs init */
#include <dfs.h>
/* dfs filesystem:ELM filesystem init */
#include <dfs_elm.h>
/* dfs Filesystem APIs */
#include <dfs_fs.h>
#include <dfs_posix.h>
#endif
#include <gd32f4xx.h>
void rt_init_thread_entry(void* parameter)
{
/* initialization RT-Thread Components */
#ifdef RT_USING_COMPONENTS_INIT
rt_components_init();
#endif
#ifdef PKG_USING_GUIENGINE
{
rt_device_t device;
device = rt_device_find("lcd");
/* re-set graphic device */
rtgui_graphic_set_device(device);
rt_gui_demo_init();
}
#endif
#ifdef RT_USING_DFS
#ifdef RT_USING_DFS_ELMFAT
/* mount sd card fat partition 0 as root directory */
if (dfs_mount("gd25q16", "/", "elm", 0, 0) == 0)
{
rt_kprintf("spi flash mount to / !\n");
}
else
{
rt_kprintf("spi flash mount to / failed!\n");
}
#endif /* RT_USING_DFS_ELMFAT */
#endif /* DFS */
}
int rt_application_init()
{
rt_thread_t tid;
tid = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
2048, RT_THREAD_PRIORITY_MAX/3, 20);
if (tid != RT_NULL)
rt_thread_startup(tid);
return 0;
}
|
/*
Copyright (c) 2013, 2017, Oracle and/or its affiliates. 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; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef NAMED_PIPE_CONNECTION_INCLUDED
#define NAMED_PIPE_CONNECTION_INCLUDED
#include <Windows.h>
#include <string>
class Channel_info;
class THD;
/**
This class abstracts Named pipe listener that setups a named pipe
handle to listen and receive client connections.
*/
class Named_pipe_listener
{
std::string m_pipe_name;
SECURITY_ATTRIBUTES m_sa_pipe_security;
SECURITY_DESCRIPTOR m_sd_pipe_descriptor;
HANDLE m_pipe_handle;
char m_pipe_path_name[512];
HANDLE h_connected_pipe;
OVERLAPPED m_connect_overlapped;
public:
/**
Constructor for named pipe listener
@param pipe_name name for pipe used in CreateNamedPipe function.
*/
Named_pipe_listener(const std::string *pipe_name)
: m_pipe_name(*pipe_name),
m_pipe_handle(INVALID_HANDLE_VALUE)
{ }
/**
Set up a listener.
@retval false listener listener has been setup successfully to listen for connect events
true failure in setting up the listener.
*/
bool setup_listener();
/**
The body of the event loop that listen for connection events from clients.
@retval Channel_info Channel_info object abstracting the connected client
details for processing this connection.
*/
Channel_info* listen_for_connection_event();
/**
Close the listener
*/
void close_listener();
};
#endif // NAMED_PIPE_CONNECTION_INCLUDED.
|
/*
* Copyright (c) 2001-2003,2005 Silicon Graphics, Inc.
* 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.
*
* This program is distributed in the hope that it would be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <xfs/xfs.h>
#include <xfs/command.h>
#include <xfs/input.h>
#include "init.h"
#include "io.h"
static cmdinfo_t imap_cmd;
int
imap_f(int argc, char **argv)
{
int count;
int nent;
int i;
__u64 last = 0;
xfs_inogrp_t *t;
xfs_fsop_bulkreq_t bulkreq;
if (argc != 2)
nent = 1;
else
nent = atoi(argv[1]);
t = malloc(nent * sizeof(*t));
bulkreq.lastip = &last;
bulkreq.icount = nent;
bulkreq.ubuffer = (void *)t;
bulkreq.ocount = &count;
while (xfsctl(file->name, file->fd, XFS_IOC_FSINUMBERS, &bulkreq) == 0) {
if (count == 0)
return 0;
for (i = 0; i < count; i++) {
printf(_("ino %10llu count %2d mask %016llx\n"),
(unsigned long long)t[i].xi_startino,
t[i].xi_alloccount,
(unsigned long long)t[i].xi_allocmask);
}
}
perror("xfsctl(XFS_IOC_FSINUMBERS)");
exitcode = 1;
return 0;
}
void
imap_init(void)
{
imap_cmd.name = _("imap");
imap_cmd.cfunc = imap_f;
imap_cmd.argmin = 0;
imap_cmd.argmax = 0;
imap_cmd.args = _("[nentries]");
imap_cmd.flags = CMD_NOMAP_OK;
imap_cmd.oneline = _("inode map for filesystem of current file");
if (expert)
add_command(&imap_cmd);
}
|
/*
* Copyright (c) 2009 NVIDIA Corporation. All rights reserved.
*
* NVIDIA Corporation and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
* and any modifications thereto. Any use, reproduction, disclosure or
* distribution of this software and related documentation without an express
* license agreement from NVIDIA Corporation is strictly prohibited.
*/
#ifndef NVMM_FILE_UTIL_H_
#define NVMM_FILE_UTIL_H_
#include "nvos.h"
#include "nvcommon.h"
#include "nvmm.h"
#include "nvmm_event.h"
#include "nvmm_parser_types.h"
#include "nvmm_super_parserblock.h"
#include "nvcustomprotocol.h"
NvError NvMMUtilFilenameToParserType(NvU8 *filename,
NvMMParserCoreType *eParserType,
NvMMSuperParserMediaType *eMediaType);
NvError NvMMUtilConvertNvMMParserCoreType(NvParserCoreType eParserType,
NvMMParserCoreType *eNvMMParserType);
NvError NvMMUtilGuessFormatFromFile(char *szURI, NV_CUSTOM_PROTOCOL *pProtocol,
NvParserCoreType *eParserType,
NvMMSuperParserMediaType *eMediaType);
#endif
|
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) <Year>, <Your Name Here>
*
* <Your Name Here> <<Your Email Here>>
*
* See http://www.iaxproxy.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*!
* \file
* \brief Skeleton Test
*
* \author\verbatim <Your Name Here> <<Your Email Here>> \endverbatim
*
* This is a skeleton for development of an Asterisk test module
* \ingroup tests
*/
/*** MODULEINFO
<depend>TEST_FRAMEWORK</depend>
***/
#include "iaxproxy.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 272531 $")
#include "iaxproxy/utils.h"
#include "iaxproxy/module.h"
#include "iaxproxy/test.h"
AST_TEST_DEFINE(sample_test)
{
void *ptr;
switch (cmd) {
case TEST_INIT:
info->name = "sample_test";
info->category = "main/sample/";
info->summary = "sample unit test";
info->description =
"This demonstrates what is required to implement "
"a unit test.";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
}
ast_test_status_update(test, "Executing sample test...\n");
if (!(ptr = ast_malloc(8))) {
ast_test_status_update(test, "ast_malloc() failed\n");
return AST_TEST_FAIL;
}
ast_free(ptr);
return AST_TEST_PASS;
}
static int unload_module(void)
{
AST_TEST_UNREGISTER(sample_test);
return 0;
}
static int load_module(void)
{
AST_TEST_REGISTER(sample_test);
return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Skeleton (sample) Test");
|
/* $Id: disco_provider_id.c,v 1.0 2005/10/14 15:17:55 fpeters Exp $
*
* Lasso - A free implementation of the Liberty Alliance specifications.
*
* Copyright (C) 2004-2007 Entr'ouvert
* http://lasso.entrouvert.org
*
* Authors: See AUTHORS file in top-level directory.
*
* 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/>.
*/
#include "../private.h"
#include "disco_provider_id.h"
#include "idwsf2_strings.h"
/**
* SECTION:disco_provider_id
* @short_description: <disco:ProviderID>
*
* <figure><title>Schema fragment for disco:ProviderID</title>
* <programlisting><![CDATA[
*
* <xs:element name="ProviderID" type="xs:anyURI"/>
* ]]></programlisting>
* </figure>
*/
/*****************************************************************************/
/* private methods */
/*****************************************************************************/
static struct XmlSnippet schema_snippets[] = {
{ "content", SNIPPET_TEXT_CHILD,
G_STRUCT_OFFSET(LassoIdWsf2DiscoProviderID, content), NULL, NULL, NULL},
{NULL, 0, 0, NULL, NULL, NULL}
};
static LassoNodeClass *parent_class = NULL;
/*****************************************************************************/
/* instance and class init functions */
/*****************************************************************************/
static void
class_init(LassoIdWsf2DiscoProviderIDClass *klass)
{
LassoNodeClass *nclass = LASSO_NODE_CLASS(klass);
parent_class = g_type_class_peek_parent(klass);
nclass->node_data = g_new0(LassoNodeClassData, 1);
lasso_node_class_set_nodename(nclass, "ProviderID");
lasso_node_class_set_ns(nclass, LASSO_IDWSF2_DISCOVERY_HREF, LASSO_IDWSF2_DISCOVERY_PREFIX);
lasso_node_class_add_snippets(nclass, schema_snippets);
}
GType
lasso_idwsf2_disco_provider_id_get_type()
{
static GType this_type = 0;
if (!this_type) {
static const GTypeInfo this_info = {
sizeof (LassoIdWsf2DiscoProviderIDClass),
NULL,
NULL,
(GClassInitFunc) class_init,
NULL,
NULL,
sizeof(LassoIdWsf2DiscoProviderID),
0,
NULL,
NULL
};
this_type = g_type_register_static(LASSO_TYPE_NODE,
"LassoIdWsf2DiscoProviderID", &this_info, 0);
}
return this_type;
}
/**
* lasso_idwsf2_disco_provider_id_new:
*
* Creates a new #LassoIdWsf2DiscoProviderID object.
*
* Return value: a newly created #LassoIdWsf2DiscoProviderID object
**/
LassoIdWsf2DiscoProviderID*
lasso_idwsf2_disco_provider_id_new()
{
return g_object_new(LASSO_TYPE_IDWSF2_DISCO_PROVIDER_ID, NULL);
}
/**
* lasso_idwsf2_disco_provider_id_new_with_string:
* @content: the content string
*
* Creates a new #LassoIdWsf2DiscoProviderID object and initializes it
* with @content as content.
*
* Return value: a newly created #LassoIdWsf2DiscoProviderID object
**/
LassoIdWsf2DiscoProviderID*
lasso_idwsf2_disco_provider_id_new_with_string(const char *content)
{
LassoIdWsf2DiscoProviderID *object;
object = g_object_new(LASSO_TYPE_IDWSF2_DISCO_PROVIDER_ID, NULL);
object->content = g_strdup(content);
return object;
}
|
#if !defined(AFX_RMBAND_H__0CE5722A_FBCB_442D_A665_D4687B2868D3__INCLUDED_)
#define AFX_RMBAND_H__0CE5722A_FBCB_442D_A665_D4687B2868D3__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// Machine generated IDispatch wrapper class(es) created by Microsoft Visual C++
// NOTE: Do not modify the contents of this file. If this class is regenerated by
// Microsoft Visual C++, your modifications will be overwritten.
/////////////////////////////////////////////////////////////////////////////
// CRMBand wrapper class
class CRMBand : public COleDispatchDriver
{
public:
CRMBand() {} // Calls COleDispatchDriver default constructor
CRMBand(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CRMBand(const CRMBand& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// Attributes
public:
// Operations
public:
void SetBounds(long aLeft, long aTop, long aWidth, long aHeight);
long GetLeft();
void SetLeft(long nNewValue);
long GetTop();
void SetTop(long nNewValue);
long GetWidth();
void SetWidth(long nNewValue);
long GetHeight();
void SetHeight(long nNewValue);
CString GetText();
void SetText(LPCTSTR lpszNewValue);
VARIANT GetProp(LPCTSTR aPropName);
void SetProp(LPCTSTR aPropName, const VARIANT& newValue);
CString GetName();
void SetName(LPCTSTR lpszNewValue);
void SetFrameVisible(BOOL Value);
void SetFrameColor(long Value);
void SetFrameWidth(long Value);
VARIANT GetDelphiObject();
BOOL GetAllowSplit();
void SetAllowSplit(BOOL bNewValue);
BOOL GetKeepChild();
void SetKeepChild(BOOL bNewValue);
CString GetOutlineText();
void SetOutlineText(LPCTSTR lpszNewValue);
BOOL GetNewPageAfter();
void SetNewPageAfter(BOOL bNewValue);
BOOL GetStretched();
void SetStretched(BOOL bNewValue);
CString GetChildBand();
void SetChildBand(LPCTSTR lpszNewValue);
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RMBAND_H__0CE5722A_FBCB_442D_A665_D4687B2868D3__INCLUDED_)
|
/*
* Adium is the legal property of its developers, whose names are listed in the copyright file included
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#import <Adium/AIWindowController.h>
@class AIAccountProxySettings, AIAccountViewController, AIImageViewWithImagePicker;
@interface AIEditAccountWindowController : AIWindowController {
//Account preferences
IBOutlet NSMatrix *matrix_userIcon;
IBOutlet NSButton *button_chooseIcon;
IBOutlet NSTextField *textField_accountDescription;
IBOutlet NSTextField *textField_serviceName;
IBOutlet AIImageViewWithImagePicker *imageView_userIcon;
IBOutlet NSTabView *tabView_auxiliary;
IBOutlet NSButton *button_cancel;
IBOutlet NSButton *button_OK;
IBOutlet NSButton *checkbox_autoconnect;
//Replacable views
IBOutlet NSView *view_accountSetup;
IBOutlet NSView *view_accountProxy;
IBOutlet NSView *view_accountProfile;
IBOutlet NSView *view_accountOptions;
IBOutlet NSView *view_accountPrivacy;
//Current configuration
AIAccountViewController *accountViewController;
AIAccountProxySettings *accountProxyController;
AIAccount *account;
NSData *userIconData;
BOOL didDeleteUserIcon;
id notifyTarget;
}
- (id)initWithAccount:(AIAccount *)inAccount notifyingTarget:(id)inTarget;
- (IBAction)cancel:(id)sender;
- (IBAction)okay:(id)sender;
- (IBAction)changedIconSetting:(id)sender;
@end
|
int SUBST_chown = 1;
int chown(const char *path,int uid,int gid)
{
return -1;
}
|
/*
* File : application.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006, RT-Thread Development Team
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rt-thread.org/license/LICENSE
*
* Change Logs:
* Date Author Notes
* 2009-01-05 Bernard the first version
*/
/**
* @addtogroup STM32
*/
/*@{*/
#include <stdio.h>
#include "stm32f4xx.h"
#include <board.h>
#include <rtthread.h>
#include "App_moduleConfig.h"
#ifdef RT_USING_LWIP
#include <lwip/sys.h>
#include <lwip/api.h>
#include <netif/ethernetif.h>
#include "stm32_eth.h"
#endif
void rt_init_thread_entry(void* parameter)
{
/* LwIP Initialization */
#ifdef RT_USING_LWIP
{
extern void lwip_sys_init(void);
/* register ethernetif device */
eth_system_device_init();
rt_hw_stm32_eth_init();
/* re-init device driver */
rt_device_init_all();
/* init lwip system */
lwip_sys_init();
rt_kprintf("TCP/IP initialized!\n");
}
#endif
//FS
//GUI
}
ALIGN(RT_ALIGN_SIZE)
static char thread_led_stack[1024];
struct rt_thread thread_led;
static void rt_thread_entry_led(void* parameter)
{
u8 LowPowerCounter=0,CutPowerCounter=0,Battery_Flag=0;;
CAN_App_Init(); // CAN³õʼ»¯
AD_PowerInit();
while (1)
{
//------- CAN query ---------------
/*
if(CAN_initOver==1)
{
TestRx=(TestStatus)CANRXStr();
if (TestRx == PASSED)
rt_kprintf("\r\n CAN1-RxData\r\n");
}
*/
//---------------------------------------------
//----------------------
//------------- µçÔ´µçѹADÏÔʾ -----------------------
Power_AD.ADC_ConvertedValue=ADC_GetConversionValue(ADC1);
Power_AD.AD_Volte=((Power_AD.ADC_ConvertedValue*543)>>12);
//rt_kprintf ("\r\n »ñÈ¡µ½µÄµç³ØADÊýֵΪ: %d ADµçѹΪ: %d V µçÔ´µçѹ: %d V\r\n",ADC_ConvertedValue,a,a+11);
// ---µçԴǷѹ±¨¾¯----
Power_AD.AD_Volte=Power_AD.AD_Volte+11;
//------------Íⲿ¶Ïµç---------------------
if(Power_AD.ADC_ConvertedValue<500) // СÓÚ500 ÈÏΪÊÇÍⲿ¶Ïµç
{
CutPowerCounter++;
if(CutPowerCounter>15)
{
CutPowerCounter=0;
LowPowerCounter=0;
//------ ³¬¼¶µçÈÝ Îª¸ßÔò Æô¶¯ÁË
if(Battery_Flag==0)
{
rt_kprintf("\r\n Ö÷µçÔ´µôµç! \r\n");
Battery_Flag=1;
MainPower_cut_process();
PositionSD_Enable();
Current_UDP_sd=1;
}
//--------------------------------
}
}
else
{ // µçÔ´Õý³£Çé¿öÏÂ
CutPowerCounter=0;
if(Battery_Flag==1)
{
MainPower_Recover_process();
rt_kprintf("\r\n Ö÷µçÔ´Õý³£! \r\n");
Battery_Flag=1;
PositionSD_Enable();
Current_UDP_sd=1;
}
Battery_Flag=0;
//------------ÅжÏǷѹºÍÕý³£-----
// ¸ù¾Ý²É¼¯µ½µÄµçÑ¹Çø·ÖµçÆ¿ÀàÐÍ£¬ÐÞ¸ÄǷѹÃÅÏÞÊýÖµ
if(Power_AD.AD_Volte<=160) // 16V
Power_AD.LowWarn_Limit_Value=100; // СÓÚ16V ÈÏΪÊÇС³µ £¬Ç·Ñ¹ÃÅÏÞÊÇ10V
else
Power_AD.LowWarn_Limit_Value=170; // ´óÓÚ16V ÈÏΪÊÇ´ó³µ £¬Ç·Ñ¹ÃÅÏÞÊÇ17V
if(Power_AD.AD_Volte< Power_AD.LowWarn_Limit_Value)
{
if((Warn_Status[3]&0x80)==0x00)
{
LowPowerCounter++;
if(LowPowerCounter>15)
{
LowPowerCounter=0;
Warn_Status[3]|=0x80; //Ƿѹ±¨¾¯
PositionSD_Enable();
Current_UDP_sd=1;
rt_kprintf("\r\n Ƿѹ±¨¾¯! \r\n");
}
}
}
else
{
if((Warn_Status[3]&0x80)==0x80)
rt_kprintf("\r\n ´ÓǷѹÖл¹ÔÕý³£! \r\n");
LowPowerCounter=0;
Warn_Status[3]&=~0x80; //È¡ÏûǷѹ±¨¾¯
}
//---------------------------------------
}
//----------------------------------
// 3. GPS_ANTENNA_status
if(Module_3020C==GPS_MODULE_TYPE)
{
GPS_ANTENNA_status();
GPS_short_judge_timer();
}
//-----------------------------------------------
rt_thread_delay(RT_TICK_PER_SECOND/5);
}
}
int rt_application_init()
{
rt_thread_t init_thread;
// Device_CAN2_regist(); // Device CAN2 Init
#if (RT_THREAD_PRIORITY_MAX == 32)
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
256, 8, 20); // thread null
#else
init_thread = rt_thread_create("init",
rt_init_thread_entry, RT_NULL,
2048, 80, 20);
#endif
if (init_thread != RT_NULL)
rt_thread_startup(init_thread);
//------- init led1 thread
rt_thread_init(&thread_led,
"led1",
rt_thread_entry_led,
RT_NULL,
&thread_led_stack[0],
sizeof(thread_led_stack),Prio_Demo,5);
rt_thread_startup(&thread_led);
return 0;
}
/*@}*/
|
/**
* Name: wx/features.h
* Purpose: test macros for the features which might be available in some
* wxWidgets ports but not others
* Author: Vadim Zeitlin
* Modified by: Ryan Norton (Converted to C)
* Created: 18.03.02
* RCS-ID: $Id: features.h 69961 2011-12-08 15:58:45Z VZ $
* Copyright: (c) 2002 Vadim Zeitlin <vadim@wxwidgets.org>
* Licence: wxWindows licence
*/
/* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
#ifndef _WX_FEATURES_H_
#define _WX_FEATURES_H_
/* radio menu items are currently not implemented in wxMotif, use this
symbol (kept for compatibility from the time when they were not implemented
under other platforms as well) to test for this */
#if !defined(__WXMOTIF__)
#define wxHAS_RADIO_MENU_ITEMS
#else
#undef wxHAS_RADIO_MENU_ITEMS
#endif
/* the raw keyboard codes are generated under wxGTK and wxMSW only */
#if defined(__WXGTK__) || defined(__WXMSW__) || defined(__WXMAC__) \
|| defined(__WXDFB__)
#define wxHAS_RAW_KEY_CODES
#else
#undef wxHAS_RAW_KEY_CODES
#endif
/* taskbar is implemented in the major ports */
#if defined(__WXMSW__) || defined(__WXCOCOA__) \
|| defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXX11__) \
|| defined(__WXOSX_MAC__) || defined(__WXCOCOA__)
#define wxHAS_TASK_BAR_ICON
#else
#undef wxUSE_TASKBARICON
#define wxUSE_TASKBARICON 0
#undef wxHAS_TASK_BAR_ICON
#endif
/* wxIconLocation appeared in the middle of 2.5.0 so it's handy to have a */
/* separate define for it */
#define wxHAS_ICON_LOCATION
/* same for wxCrashReport */
#ifdef __WXMSW__
#define wxHAS_CRASH_REPORT
#else
#undef wxHAS_CRASH_REPORT
#endif
/* wxRE_ADVANCED is not always available, depending on regex library used
* (it's unavailable only if compiling via configure against system library) */
#ifndef WX_NO_REGEX_ADVANCED
#define wxHAS_REGEX_ADVANCED
#else
#undef wxHAS_REGEX_ADVANCED
#endif
/* Pango-based ports and wxDFB use UTF-8 for text and font encodings
* internally and so their fonts can handle any encodings: */
#if wxUSE_PANGO || defined(__WXDFB__)
#define wxHAS_UTF8_FONTS
#endif
/* This is defined when the underlying toolkit handles tab traversal natively.
Otherwise we implement it ourselves in wxControlContainer. */
#ifdef __WXGTK20__
#define wxHAS_NATIVE_TAB_TRAVERSAL
#endif
/* This is defined when the compiler provides some type of extended locale
functions. Otherwise, we implement them ourselves to only support the
'C' locale */
#if defined(HAVE_LOCALE_T) || \
(wxCHECK_VISUALC_VERSION(8) && !defined(__WXWINCE__))
#define wxHAS_XLOCALE_SUPPORT
#else
#undef wxHAS_XLOCALE_SUPPORT
#endif
/* Direct access to bitmap data is not implemented in all ports yet */
#if defined(__WXGTK20__) || defined(__WXMAC__) || defined(__WXDFB__) || \
defined(__WXMSW__)
/*
These compilers can't deal with templates in wx/rawbmp.h:
- HP aCC for PA-RISC
- Watcom < 1.8
*/
#if !wxONLY_WATCOM_EARLIER_THAN(1, 8) && \
!(defined(__HP_aCC) && defined(__hppa))
#define wxHAS_RAW_BITMAP
#endif
#endif
/* also define deprecated synonym which exists for compatibility only */
#ifdef wxHAS_RAW_BITMAP
#define wxHAVE_RAW_BITMAP
#endif
/*
If this is defined, wxEvtHandler::Bind<>() is available (not all compilers
have the required template support for this and in particular under Windows
where only g++ and MSVC >= 7 currently support it.
Recent Sun CC versions support this but perhaps older ones can compile this
code too, adjust the version check if this is the case (unfortunately we
can't easily test for the things used in wx/event.h in configure so we have
to maintain these checks manually). The same applies to xlC 7: perhaps
earlier versions can compile this code too but they were not tested.
*/
#if wxCHECK_GCC_VERSION(3, 2) || wxCHECK_VISUALC_VERSION(7) \
|| (defined(__SUNCC__) && __SUNCC__ >= 0x5100) \
|| (defined(__xlC__) && __xlC__ >= 0x700)
#define wxHAS_EVENT_BIND
#endif
#endif /* _WX_FEATURES_H_ */
|
#ifndef MC_LOGGING_H
#define MC_LOGGING_H
/*
This file provides an easy-to-use function for writing all kinds of
events into a central log file that can be used for debugging.
*/
extern void mc_log(const char *, ...)
__attribute__((__format__(__printf__,1,2)));
#endif
|
#ifndef K3DSDK_ISTREAMING_BITMAP_SOURCE_H
#define K3DSDK_ISTREAMING_BITMAP_SOURCE_H
// K-3D
// Copyright (c) 1995-2010, Timothy M. Shead
//
// Contact: tshead@k-3d.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
/** \file
\author Tim Shead (tshead@k-3d.com)
*/
#include <k3dsdk/bitmap.h>
#include <k3dsdk/iunknown.h>
#include <k3dsdk/signal_system.h>
#include <boost/version.hpp>
#if BOOST_VERSION < 106900
#include <boost/gil/gil_all.hpp>
#else
#include <boost/gil.hpp>
#endif
namespace k3d
{
class inode;
/// Abstract interface for an object that collects and distributes profiling data for the K-3D visualization pipeline
class istreaming_bitmap_source :
public virtual iunknown
{
public:
/// Defines a standard pixel as floating-point RGBA
typedef boost::gil::pixel<boost::gil::bits32f, boost::gil::rgba_layout_t> pixel;
/// Defines a standard bitmap as half-precision floating-point RGBA
typedef boost::gil::image<pixel, false> bitmap;
/// Defines a standard bitmap as half-precision floating-point RGBA
typedef bitmap::const_view_t bucket;
/// Define storage for a pixel coordinate
typedef bitmap::coord_t coordinate;
/// Connects a slot that will be called when streaming begins
virtual sigc::connection connect_bitmap_start_signal(const sigc::slot<void, coordinate, coordinate>& Slot) = 0;
/// Connects a slot that will be called when streaming begins
virtual sigc::connection connect_bitmap_bucket_signal(const sigc::slot<void, coordinate, coordinate, const bucket&>& Slot) = 0;
/// Connects a slot that will be called when streaming finishes
virtual sigc::connection connect_bitmap_finish_signal(const sigc::slot<void>& Slot) = 0;
protected:
istreaming_bitmap_source() {}
istreaming_bitmap_source(const istreaming_bitmap_source& Other) : iunknown(Other) {}
istreaming_bitmap_source& operator=(const istreaming_bitmap_source&) { return *this; }
virtual ~istreaming_bitmap_source() {}
};
} // namespace k3d
#endif // !K3DSDK_ISTREAMING_BITMAP_SOURCE_H
|
/*
bbs100 3.3 WJ107
Copyright (C) 1997-2015 Walter de Jong <walter@heiho.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.
*/
#ifndef TELNET_H_WJ105
#define TELNET_H_WJ105 1
#include "Conn.h"
/*
the value of 8 is ridiculously small, but OK for the BBS
it only cares for NAWS bytes and the "USER" environment variable
*/
#define MAX_SUB_BUF 8
#define MAX_TERM 500
/* telnet states */
#define TS_DATA 0
#define TS_IAC 1
#define TS_ARG 2
#define TS_WILL 3
#define TS_DO 4
#define TS_NAWS 5
#define TS_NEW_ENVIRON 6
#define TS_NEW_ENVIRON_IS 7
#define TS_NEW_ENVIRON_VAR 8
#define TS_NEW_ENVIRON_VAL 9
typedef struct {
int state, in_sub;
int term_width, term_height;
char in_sub_buf[MAX_SUB_BUF];
} Telnet;
Telnet *new_Telnet(void);
void destroy_Telnet(Telnet *);
int telnet_negotiations(Telnet *, Conn *, unsigned char, void (*)(Conn *, Telnet *));
#endif /* TELNET_H_WJ105 */
/* EOB */
|
#pragma once
#include <iostream>
#include <vector>
#include <enet/enet.h>
#include "md5.h"
#include "config.h"
#include "MessageManager.h"
#include "Player.h"
#include "exploot-protobuf/build/Message.pb.h"
using namespace std;
class NetworkManager{
public:
NetworkManager(MessageManager*);
~NetworkManager();
void sendMessage(ENetPeer* peer, Message& message);
string getChallenge(int connectID);
void update();
bool init();
private:
ENetHost * server;
MessageManager* msgManager;
};
|
/** DBLog class header.
@file DBLog.h
This file belongs to the SYNTHESE project (public transportation specialized software)
Copyright (C) 2002 Hugues Romain - RCSmobility <contact@rcsmobility.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef SYNTHESE_UTIL_DBLOG_H
#define SYNTHESE_UTIL_DBLOG_H
#include <string>
#include <vector>
#include "FactoryBase.h"
#include "DBLogEntry.h"
#include "Registry.h"
#include "SecurityTypes.hpp"
#include <boost/optional.hpp>
namespace synthese
{
namespace security
{
class User;
class Profile;
}
namespace server
{
class Request;
}
namespace dblog
{
/** Journal d'événements stocké en base de données (abstraite).
@ingroup m13
Un journal est un compte-rendu d'activité de SYNTHESE.
Plusieurs entrées sont consignées dans la base de données sous formes d'entrées de journal.
Le journal lui-même est le composant d'administration dédié à leur consultation.
Le stockage des entrées de journal s'effectue dans la base de données.
Les éléments de journal contiennent les données suivantes :
- date de l'événement
- nom du journal (clé texte identique au nom d'enregistrement de la classe)
- utilisateur à l'origine de l'événement
- niveau de l'entrée (INFO, WARNING, ERROR)
- texte de l'entrée (formalisme selon module et rubrique, spécifié par les sous-classes)
Les différents journaux sont enregistrés dans l'instance de fabrique Factory<DBLog>.
*/
class DBLog
: public util::FactoryBase<DBLog>
{
public:
typedef std::vector<std::string> ColumnsVector;
protected:
/** Adds an entry to a log (generic method).
@param logKey key of the DBLog to write
@param level level of the entry (@see DBLogEntry::Level)
@param content serialized content of the entry
@param user user of the entry
@param objectId id of the referring object
@return id of the created entry
@author Hugues Romain
@date 2008
This method is intended to be used by subclasses to do managed entry creations.
*/
static util::RegistryKeyType _addEntry(
const std::string& logKey
, Level level
, const DBLogEntry::Content& content
, const security::User* user
, util::RegistryKeyType objectId = 0
, util::RegistryKeyType objectId2 = 0
);
/** Reads the last entry of a log.
@param logKey key of the DBLog to write
@param objectId id of the referring object (can be undefined)
@return The last log entry of the specified log, referring the specified object if any
*/
static boost::shared_ptr<DBLogEntry> _getLastEntry(
const std::string& logKey,
boost::optional<util::RegistryKeyType> objectId = boost::optional<util::RegistryKeyType>()
);
public:
virtual std::string getName() const = 0;
virtual ColumnsVector getColumnNames() const = 0;
//////////////////////////////////////////////////////////////////////////
/// Generates the display of the log specific columns.
/// @param entry to parse
/// @searchRequest request which has generated the display : can be reused
/// to generate other requests at the display
/// @return all columns content to display
virtual ColumnsVector parse(
const DBLogEntry& entry,
const server::Request& searchRequest
) const;
//////////////////////////////////////////////////////////////////////////
/// Object column name getter.
/// If empty result, then the column is not displayed.
/// Virtual method : the default implementation returns "Objet"
virtual std::string getObjectColumnName() const;
virtual std::string getObjectName(
util::RegistryKeyType id,
const server::Request& searchRequest
) const;
//////////////////////////////////////////////////////////////////////////
/// Object column name getter.
/// If empty result, then the column is not displayed.
/// Virtual method : the default implementation returns empty string
virtual std::string getObject2ColumnName() const;
virtual std::string getObject2Name(
util::RegistryKeyType id,
const server::Request& searchRequest
) const;
//////////////////////////////////////////////////////////////////////////
/** Authorization tester.
* Each subclass of DBLog must implement an authorization method depending on the request.
* @param request the request which generated the display of the log
* @param level needed level
* @return true if the log can be displayed
*/
virtual bool isAuthorized(
const security::Profile& profile,
const security::RightLevel& level
) = 0;
static util::RegistryKeyType AddSimpleEntry(
const std::string& logKey,
Level level,
const std::string& content,
const security::User* user,
util::RegistryKeyType objectId = 0,
util::RegistryKeyType objectId2 = 0
);
};
}
}
#endif
|
#ifndef FUNC_H
#define FUNC_H
void show(void);
#endif
|
/**
* @file
* @brief XML tag constants for savegame.
*/
/*
Copyright (C) 2002-2011 UFO: Alien Invasion.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#pragma once
#define SAVE_ROOTNODE "savegame"
/** @note this data is loaded from/saved to binary header, we save it into the XML for readability only */
#define SAVE_SAVEVERSION "saveVersion"
#define SAVE_UFOVERSION "gameVersion"
#define SAVE_COMMENT "comment"
#define SAVE_REALDATE "realDate"
#define SAVE_GAMEDATE "gameDate"
/*
DTD:
<!ELEMENT savegame (bases research campaign interests missions market employees* alienCont UFOs projectiles
installations storedUFOs production messages stats nations transfers alienBases
XVI messageOptions)>
<!ATTLIST savegame
saveVersion CDATA #IMPLIED
gameVersion CDATA #IMPLIED
comment CDATA #IMPLIED
realDate CDATA #IMPLIED
gameDate CDATA #IMPLIED
>
*/
|
/*
<<<<<<< HEAD
* Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
=======
* Copyright (c) 2012, The Linux Foundation. All rights reserved.
>>>>>>> 8f21ba79e30f047f727d3b9dd531267c1db2a838
*
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
*
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
* above copyright notice and this permission notice appear in all
* copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
* WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
* DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
* PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
<<<<<<< HEAD
/*
=======
/*
*
>>>>>>> 8f21ba79e30f047f727d3b9dd531267c1db2a838
* Airgo Networks, Inc proprietary. All rights reserved.
* limStaHashApi.c: Provides access functions to get/set values of station hash entry fields.
* Author: Sunit Bhatia
* Date: 09/19/2006
* History:-
* Date Modified by Modification Information
*
* --------------------------------------------------------------------------
*
*/
#include "limStaHashApi.h"
/**
* limGetStaHashBssidx()
*
*FUNCTION:
* This function is called to Get the Bss Index of the currently associated Station.
*
*LOGIC:
*
*ASSUMPTIONS:
* NA
*
*NOTE:
* NA
*
* @param pMac pointer to Global Mac structure.
* @param assocId AssocID of the Station.
* @param bssidx pointer to the bss index, which will be returned by the function.
*
* @return success if GET operation is ok, else Failure.
*/
tSirRetStatus limGetStaHashBssidx(tpAniSirGlobal pMac, tANI_U16 assocId, tANI_U8 *bssidx, tpPESession psessionEntry)
{
tpDphHashNode pSta = dphGetHashEntry(pMac, assocId, &psessionEntry->dph.dphHashTable);
if (pSta == NULL)
{
<<<<<<< HEAD
PELOGE(limLog(pMac, LOGE, FL("invalid STA %d"), assocId);)
=======
PELOGE(limLog(pMac, LOGE, FL("invalid STA %d\n"), assocId);)
>>>>>>> 8f21ba79e30f047f727d3b9dd531267c1db2a838
return eSIR_LIM_INVALID_STA;
}
*bssidx = (tANI_U8)pSta->bssId;
return eSIR_SUCCESS;
}
|
/*
* DO NOT EDIT THIS FILE - it is generated by Glade.
*/
GtkWidget* create_window_options (void);
|
/*
* This source code is part of
*
* G R O M A C S
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2009, The GROMACS Development Team
*
* Gromacs is a library for molecular simulation and trajectory analysis,
* written by Erik Lindahl, David van der Spoel, Berk Hess, and others - for
* a full list of developers and information, check out http://www.gromacs.org
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option) any
* later version.
* As a special exception, you may use this file as part of a free software
* library without restriction. Specifically, if other files instantiate
* templates or use macros or inline functions from this file, or you compile
* this file and link it with other files to produce an executable, this
* file does not by itself cause the resulting executable to be covered by
* the GNU Lesser General Public License.
*
* In plain-speak: do not worry about classes/macros/templates either - only
* changes to the library have to be LGPL, not an application linking with it.
*
* To help fund GROMACS development, we humbly ask that you cite
* the papers people have written on it - you can find them on the website!
*/
/*! \file nb_kernel223_f77_double.c
* \brief Wrapper for fortran nonbonded kernel 223
*
* \internal
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef F77_FUNC
#define F77_FUNC(name,NAME) name ## _
#endif
/* Declarations of Fortran routines.
* We avoid using underscores in F77 identifiers for portability!
*/
void
F77_FUNC(f77dkernel223,F77DKERNEL223)
(int * nri, int * iinr,
int * jindex, int * jjnr,
int * shift, double * shiftvec,
double * fshift, int * gid,
double * pos, double * faction,
double * charge, double * facel,
double * krf, double * crf,
double * Vc, int * type,
int * ntype, double * vdwparam,
double * Vvdw, double * tabscale,
double * VFtab, double * invsqrta,
double * dvda, double * gbtabscale,
double * GBtab, int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work);
void
F77_FUNC(f77dkernel223nf,F77DKERNEL223NF)
(int * nri, int * iinr,
int * jindex, int * jjnr,
int * shift, double * shiftvec,
double * fshift, int * gid,
double * pos, double * faction,
double * charge, double * facel,
double * krf, double * crf,
double * Vc, int * type,
int * ntype, double * vdwparam,
double * Vvdw, double * tabscale,
double * VFtab, double * invsqrta,
double * dvda, double * gbtabscale,
double * GBtab, int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work);
void
nb_kernel223_f77_double
(int * nri, int * iinr,
int * jindex, int * jjnr,
int * shift, double * shiftvec,
double * fshift, int * gid,
double * pos, double * faction,
double * charge, double * facel,
double * krf, double * crf,
double * Vc, int * type,
int * ntype, double * vdwparam,
double * Vvdw, double * tabscale,
double * VFtab, double * invsqrta,
double * dvda, double * gbtabscale,
double * GBtab, int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work)
{
F77_FUNC(f77dkernel223,F77DKERNEL223)
(nri,iinr,jindex,jjnr,shift,shiftvec,fshift,gid,pos,faction,
charge,facel,krf,crf,Vc,type,ntype,vdwparam,Vvdw,tabscale,
VFtab,invsqrta,dvda,gbtabscale,GBtab,nthreads,count,mtx,
outeriter,inneriter,work);
}
void
nb_kernel223nf_f77_double
(int * nri, int iinr[],
int jindex[], int jjnr[],
int shift[], double shiftvec[],
double fshift[], int gid[],
double pos[], double faction[],
double charge[], double * facel,
double * krf, double * crf,
double Vc[], int type[],
int * ntype, double vdwparam[],
double Vvdw[], double * tabscale,
double VFtab[], double invsqrta[],
double dvda[], double * gbtabscale,
double GBtab[], int * nthreads,
int * count, void * mtx,
int * outeriter, int * inneriter,
double * work)
{
F77_FUNC(f77dkernel223nf,F77DKERNEL223NF)
(nri,iinr,jindex,jjnr,shift,shiftvec,fshift,gid,pos,faction,
charge,facel,krf,crf,Vc,type,ntype,vdwparam,Vvdw,tabscale,
VFtab,invsqrta,dvda,gbtabscale,GBtab,nthreads,count,mtx,
outeriter,inneriter,work);
}
|
/**
* (C) 2007-2010 Taobao Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* Version: $Id$
*
* Authors:
* ruohai <ruohai@taobao.com>
*/
#ifndef OCEANBASE_ROOTSERVER_OB_ROOT_LOG_REPLAY
#define OCEANBASE_ROOTSERVER_OB_ROOT_LOG_REPLAY
#include "common/ob_log_replay_runnable.h"
#include "common/ob_log_entry.h"
#include "rootserver/ob_root_log_manager.h"
namespace oceanbase
{
namespace rootserver
{
class ObRootLogManager;
class ObRootLogReplay : public common::ObLogReplayRunnable
{
public:
ObRootLogReplay();
~ObRootLogReplay();
public:
void set_log_manager(ObRootLogManager* log_manage);
int replay(common::LogCommand cmd, uint64_t seq, const char* log_data, const int64_t data_len);
private:
ObRootLogManager* log_manager_;
};
} /* rootserver */
} /* oceanbase */
#endif /* end of include guard: OCEANBASE_ROOTSERVER_OB_ROOT_LOG_REPLAY */
|
/*
* BorderDetector
*
* Attempt to infer content boundaries of an image by looking for rows and
* columns of pixels whose values fall within some narrow range.
*
* Handle letterboxing, pillarboxing, and combinations of the two. Handle cases
* where letterboxing embedded inside of pillarboxing (or vice versa) uses a
* different filler color.
*/
#ifndef __BORDERDETECTOR_H__
#define __BORDERDETECTOR_H__
typedef struct AVPicture AVPicture;
class NuppelVideoPlayer;
class TemplateFinder;
class BorderDetector
{
public:
/* Ctor/dtor. */
BorderDetector(void);
~BorderDetector(void);
int nuppelVideoPlayerInited(const NuppelVideoPlayer *nvp);
void setLogoState(TemplateFinder *finder);
static const long long UNCACHED = -1;
int getDimensions(const AVPicture *pgm, int pgmheight, long long frameno,
int *prow, int *pcol, int *pwidth, int *pheight);
int reportTime(void);
private:
TemplateFinder *logoFinder;
const struct AVPicture *logo;
int logorow, logocol;
int logowidth, logoheight;
long long frameno; /* frame number */
int row, col; /* content location */
int width, height; /* content dimensions */
bool ismonochromatic;
/* Debugging. */
int debugLevel;
struct timeval analyze_time;
bool time_reported;
};
#endif /* !__BORDERDETECTOR_H__ */
/* vim: set expandtab tabstop=4 shiftwidth=4: */
|
#ifndef __LIBS_DEFS_H__
#define __LIBS_DEFS_H__
// #TEST TEST
#ifndef NULL
#define NULL ((void *)0)
#endif
#define __always_inline inline __attribute__((always_inline))
#define __noinline __attribute__((noinline))
#define __noreturn __attribute__((noreturn))
/* Represents true-or-false values */
typedef int bool;
/* Explicitly-sized versions of integer types */
typedef char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
/* *
* Pointers and addresses are 32 bits long.
* We use pointer types to represent addresses,
* uintptr_t to represent the numerical values of addresses.
* */
typedef int32_t intptr_t;
typedef uint32_t uintptr_t;
/* size_t is used for memory object sizes */
typedef uintptr_t size_t;
/* used for page numbers */
typedef size_t ppn_t;
/* *
* Rounding operations (efficient when n is a power of 2)
* Round down to the nearest multiple of n
* */
#define ROUNDDOWN(a, n) ({ \
size_t __a = (size_t)(a); \
(typeof(a))(__a - __a % (n)); \
})
/* Round up to the nearest multiple of n */
#define ROUNDUP(a, n) ({ \
size_t __n = (size_t)(n); \
(typeof(a))(ROUNDDOWN((size_t)(a) + __n - 1, __n)); \
})
/* Return the offset of 'member' relative to the beginning of a struct type */
#define offsetof(type, member) \
((size_t)(&((type *)0)->member))
/* *
* to_struct - get the struct from a ptr
* @ptr: a struct pointer of member
* @type: the type of the struct this is embedded in
* @member: the name of the member within the struct
* */
#define to_struct(ptr, type, member) \
((type *)((char *)(ptr) - offsetof(type, member)))
#endif /* !__LIBS_DEFS_H__ */
|
/*
* Copyright (C) 2017 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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.
*/
#pragma once
#if ENABLE(APPLE_PAY)
#include "ApplePayError.h"
#include "ApplePayLineItem.h"
#include "ApplePayShippingMethod.h"
namespace WebCore {
struct ApplePayShippingContactUpdate {
Vector<RefPtr<ApplePayError>> errors;
Vector<ApplePayShippingMethod> newShippingMethods;
ApplePayLineItem newTotal;
Vector<ApplePayLineItem> newLineItems;
};
}
#endif
|
/*
* otg-wakelock.c
*
* Copyright (C) 2011 Google, Inc.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <linux/kernel.h>
#include <linux/device.h>
#include <linux/notifier.h>
#include <linux/wakelock.h>
#include <linux/spinlock.h>
#include <linux/usb/otg.h>
#define TEMPORARY_HOLD_TIME 2000
static bool enabled = true;
static struct otg_transceiver *otgwl_xceiv;
static struct notifier_block otgwl_nb;
/*
* otgwl_spinlock is held while the VBUS lock is grabbed or dropped and the
* held field is updated to match.
*/
static DEFINE_SPINLOCK(otgwl_spinlock);
/*
* Only one lock, but since these 3 fields are associated with each other...
*/
struct otgwl_lock {
char name[40];
struct wake_lock wakelock;
bool held;
};
/*
* VBUS present lock. Also used as a timed lock on charger
* connect/disconnect and USB host disconnect, to allow the system
* to react to the change in power.
*/
static struct otgwl_lock vbus_lock;
static void otgwl_hold(struct otgwl_lock *lock)
{
if (!lock->held) {
wake_lock(&lock->wakelock);
lock->held = true;
}
}
static void otgwl_temporary_hold(struct otgwl_lock *lock)
{
wake_lock_timeout(&lock->wakelock,
msecs_to_jiffies(TEMPORARY_HOLD_TIME));
lock->held = false;
}
static void otgwl_drop(struct otgwl_lock *lock)
{
if (lock->held) {
wake_unlock(&lock->wakelock);
lock->held = false;
}
}
static void otgwl_handle_event(unsigned long event)
{
unsigned long irqflags;
spin_lock_irqsave(&otgwl_spinlock, irqflags);
pr_info("%s(%d): event=%ld\n", __func__, __LINE__, event);
if (!enabled) {
otgwl_drop(&vbus_lock);
spin_unlock_irqrestore(&otgwl_spinlock, irqflags);
return;
}
switch (event) {
case USB_EVENT_VBUS:
case USB_EVENT_ENUMERATED:
otgwl_hold(&vbus_lock);
break;
case USB_EVENT_NONE:
case USB_EVENT_ID:
case USB_EVENT_CHARGER:
otgwl_temporary_hold(&vbus_lock);
break;
default:
break;
}
spin_unlock_irqrestore(&otgwl_spinlock, irqflags);
}
static int otgwl_otg_notifications(struct notifier_block *nb,
unsigned long event, void *unused)
{
otgwl_handle_event(event);
return NOTIFY_OK;
}
static int set_enabled(const char *val, const struct kernel_param *kp)
{
int rv = param_set_bool(val, kp);
if (rv)
return rv;
if (otgwl_xceiv)
otgwl_handle_event(otgwl_xceiv->last_event);
return 0;
}
static struct kernel_param_ops enabled_param_ops = {
.set = set_enabled,
.get = param_get_bool,
};
module_param_cb(enabled, &enabled_param_ops, &enabled, 0644);
MODULE_PARM_DESC(enabled, "enable wakelock when VBUS present");
static int __init otg_wakelock_init(void)
{
int ret;
otgwl_xceiv = otg_get_transceiver();
if (!otgwl_xceiv) {
pr_err("%s: No OTG transceiver found\n", __func__);
return -ENODEV;
}
snprintf(vbus_lock.name, sizeof(vbus_lock.name), "vbus-%s",
dev_name(otgwl_xceiv->dev));
wake_lock_init(&vbus_lock.wakelock, WAKE_LOCK_SUSPEND,
vbus_lock.name);
otgwl_nb.notifier_call = otgwl_otg_notifications;
ret = otg_register_notifier(otgwl_xceiv, &otgwl_nb);
if (ret) {
pr_err("%s: otg_register_notifier on transceiver %s"
" failed\n", __func__,
dev_name(otgwl_xceiv->dev));
otgwl_xceiv = NULL;
wake_lock_destroy(&vbus_lock.wakelock);
return ret;
}
otgwl_handle_event(otgwl_xceiv->last_event);
return ret;
}
late_initcall(otg_wakelock_init);
|
/*
¹¦ÄÜ : ÁгöÕ¾ÄÚʹÓÃÕß×ÊÁÏ
×¢ÒâÊÂÏî : ÐëҪĿǰµÄ bbs.h
Compile : gcc -o showuser showuser.c
ʹÓ÷½Ê½ : showuser i10 l5 e25
(ÁгöʹÓÃÕßµÄ ID, login ´ÎÊý, email µØÖ·)
²é¿´½á¹û £º ÔÚ ~bbs/tmp/showuser.result ÖÐ
*/
/* Modify by deardraogn 2000.10.28 */
#define FIRSTLOGIN
#include <stdio.h>
#include "../../include/bbs.h"
FILE *outf;
struct userec aman;
char field_str[ 20 ][ 128 ];
char field_idx[] = "dihlpnvVraetufFmI" ;
int field_count = 0;
int field_lst_no [ 20 ];
int field_lst_size [ 20 ];
int field_default_size [ 20 ] = {
4, 12, 16, 5, 5,
18, 24, 14, 25, 30,
30, 8, 32, 24, 14,
45, 20, 0, 0, 0
};
char *field_name[] = {
"Num",
"ID ",
"LastHost",
"Visit",
"Post",
"Nick",
"LastVisit_text",
"LastVisit_num",
"Real",
"Addr",
"Email",
"Term",
"Userlevel",
"FirstVisit_text",
"FirstVisit_num",
"RealMail",
"IdentInfo",
NULL
};
char MYPASSFILE[160];
set_opt(argc, argv)
int argc;
char *argv[];
{
int i, field, size;
char *field_ptr;
field_count = 0;
for (i = 1; i < argc; i++) {
field_ptr = (char *)strchr(field_idx, argv[ i ][ 0 ] );
if (field_ptr == NULL) continue;
else field = field_ptr - field_idx ;
size = atoi( argv[ i ] + 1 );
field_lst_no[ field_count ] = field;
field_lst_size[ field_count ] = (size == 0) ?
field_default_size[ field ] : size;
field_count++;
}
}
char *repeat(ch, n)
int ch, n;
{
char *p;
int i;
static char buf[ 256 ];
p = buf;
for (i = 0 ; i < n ; i++) *(p++) = ch ;
*p = '\0';
return buf;
}
print_head()
{
int i, field, size;
for (i = 0; i < field_count; i++) {
field = field_lst_no[ i ];
size = field_lst_size[ i ];
fprintf(outf,"%-*.*s ", size, size, field_name[ field ] );
}
fprintf(outf,"\n");
for (i = 0; i < field_count; i++) {
field = field_lst_no[ i ];
size = field_lst_size[ i ];
fprintf(outf,"%-*.*s ", size, size, repeat('=', size ));
}
fprintf(outf,"\n");
}
print_record()
{
int i, field, size;
for (i = 0 ; i < field_count; i++) {
field = field_lst_no[ i ];
size = field_lst_size[ i ];
fprintf(outf,"%-*.*s ", size, size, field_str[ field ] );
}
fprintf(outf,"\n");
}
char *my_ctime(t)
time_t *t;
{
static char time_str[ 80 ];
strcpy( time_str, (char *)ctime( t ) );
time_str[ strlen( time_str ) - 1 ] = '\0';
return time_str ;
}
dump_record(serial_no, p)
int serial_no;
struct userec *p;
{
int i = 0, j ;
int pat;
/* the order of sprint should follow the order of list_idx[] */
sprintf( field_str[ i++ ], "%d", serial_no );
sprintf( field_str[ i++ ], "%s", p->userid );
sprintf( field_str[ i++ ], "%s", p->lasthost );
sprintf( field_str[ i++ ], "%d", p->numlogins );
sprintf( field_str[ i++ ], "%d", p->numposts );
sprintf( field_str[ i++ ], "%s", p->username );
sprintf( field_str[ i++ ], "%s", my_ctime(&p->lastlogin) );
sprintf( field_str[ i++ ], "%d", p->lastlogin );
sprintf( field_str[ i++ ], "%s", p->realname );
sprintf( field_str[ i++ ], "%s", p->address );
sprintf( field_str[ i++ ], "%s", p->email);
sprintf( field_str[ i++ ], "%s", p->termtype );
pat = p->userlevel;
for ( j=0; j<31; j++, pat >>= 1) {
field_str[ i ][ j ] = (pat & 1) ? '1' : '0' ;
}
field_str[ i++ ][ j ] = '\0';
sprintf( field_str[ i++ ], "%s", my_ctime(&p->firstlogin) );
sprintf( field_str[ i++ ], "%d", p->firstlogin );
sprintf( field_str[ i++ ], "%s", p->termtype + 16 );
sprintf( field_str[ i++ ], "%s", p->ident );
}
main(argc, argv)
int argc;
char *argv[];
{
FILE *inf;
int i;
if (argc < 2) {
printf("Usage: %s %s\n", argv[ 0 ], "[XN] ....");
printf("Example: %s %s\n", argv[ 0 ], "d3 i12 e30");
printf("N is field width, X is one of the following char :\n");
for (i=0; field_name[ i ]; i++) {
printf("\t%c -> %20.20s (default size = %2d)\n",
field_idx[ i ], field_name[ i ], field_default_size[ i ] );
}
exit( 0 );
} else {
set_opt( argc, argv );
sprintf(MYPASSFILE,"/home/bbs/.PASSWDS");
}
inf = fopen( MYPASSFILE, "rb" );
if (inf == NULL) {
printf("Error open %s\n", MYPASSFILE);
exit( 0 );
}
outf = fopen("./showuser.result","w+");
if(outf == NULL){
printf("Error open ./showuser.result");
exit(0);
}
print_head();
for (i=0; ; i++) {
if (fread(&aman, sizeof( aman ), 1, inf ) <= 0) break;
dump_record(i, &aman);
print_record();
}
fclose( inf );
fclose( outf);
}
|
/* Copyright (C) 2000-2002, 2004-2005 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/*
Static variables for MyISAM library. All definied here for easy making of
a shared library
*/
#ifndef _global_h
#include "myisamdef.h"
#endif
LIST *myisam_open_list=0;
uchar NEAR myisam_file_magic[]=
{ (uchar) 254, (uchar) 254,'\007', '\001', };
uchar NEAR myisam_pack_file_magic[]=
{ (uchar) 254, (uchar) 254,'\010', '\002', };
my_string myisam_log_filename=(char*) "myisam.log";
File myisam_log_file= -1;
uint myisam_quick_table_bits=9;
ulong myisam_block_size= MI_KEY_BLOCK_LENGTH; /* Best by test */
my_bool myisam_flush=0, myisam_delay_key_write=0, myisam_single_user=0;
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
ulong myisam_concurrent_insert= 2;
#else
ulong myisam_concurrent_insert= 0;
#endif
my_off_t myisam_max_temp_length= MAX_FILE_SIZE;
ulong myisam_bulk_insert_tree_size=8192*1024;
ulong myisam_data_pointer_size=4;
/*
read_vec[] is used for converting between P_READ_KEY.. and SEARCH_
Position is , == , >= , <= , > , <
*/
uint NEAR myisam_read_vec[]=
{
SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER,
SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER,
SEARCH_FIND | SEARCH_PREFIX, SEARCH_LAST, SEARCH_LAST | SEARCH_SMALLER,
MBR_CONTAIN, MBR_INTERSECT, MBR_WITHIN, MBR_DISJOINT, MBR_EQUAL
};
uint NEAR myisam_readnext_vec[]=
{
SEARCH_BIGGER, SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_BIGGER, SEARCH_SMALLER,
SEARCH_BIGGER, SEARCH_SMALLER, SEARCH_SMALLER
};
|
/*
* Copyright (C) 2003-2011 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h" /* must be first for large file support */
#include "song.h"
#include "uri.h"
#include "directory.h"
#include "mapper.h"
#include "decoder_list.h"
#include "decoder_plugin.h"
#include "tag_ape.h"
#include "tag_id3.h"
#include "tag.h"
#include "tag_handler.h"
#include "input_stream.h"
#include <glib.h>
#include <assert.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <stdio.h>
struct song *
song_file_load(const char *path, struct directory *parent)
{
struct song *song;
bool ret;
assert((parent == NULL) == g_path_is_absolute(path));
assert(!uri_has_scheme(path));
assert(strchr(path, '\n') == NULL);
song = song_file_new(path, parent);
//in archive ?
if (parent != NULL && parent->device == DEVICE_INARCHIVE) {
ret = song_file_update_inarchive(song);
} else {
ret = song_file_update(song);
}
if (!ret) {
song_free(song);
return NULL;
}
return song;
}
/**
* Attempts to load APE or ID3 tags from the specified file.
*/
static bool
tag_scan_fallback(const char *path,
const struct tag_handler *handler, void *handler_ctx)
{
return tag_ape_scan2(path, handler, handler_ctx) ||
tag_id3_scan(path, handler, handler_ctx);
}
bool
song_file_update(struct song *song)
{
const char *suffix;
char *path_fs;
const struct decoder_plugin *plugin;
struct stat st;
struct input_stream *is = NULL;
assert(song_is_file(song));
/* check if there's a suffix and a plugin */
suffix = uri_get_suffix(song->uri);
if (suffix == NULL)
return false;
plugin = decoder_plugin_from_suffix(suffix, NULL);
if (plugin == NULL)
return false;
path_fs = map_song_fs(song);
if (path_fs == NULL)
return false;
if (song->tag != NULL) {
tag_free(song->tag);
song->tag = NULL;
}
if (stat(path_fs, &st) < 0 || !S_ISREG(st.st_mode)) {
g_free(path_fs);
return false;
}
song->mtime = st.st_mtime;
GMutex *mutex = NULL;
GCond *cond;
#if !GCC_CHECK_VERSION(4, 2)
/* work around "may be used uninitialized in this function"
false positive */
cond = NULL;
#endif
do {
/* load file tag */
song->tag = tag_new();
if (decoder_plugin_scan_file(plugin, path_fs,
&full_tag_handler, song->tag))
break;
tag_free(song->tag);
song->tag = NULL;
/* fall back to stream tag */
if (plugin->scan_stream != NULL) {
/* open the input_stream (if not already
open) */
if (is == NULL) {
mutex = g_mutex_new();
cond = g_cond_new();
is = input_stream_open(path_fs, mutex, cond,
NULL);
}
/* now try the stream_tag() method */
if (is != NULL) {
song->tag = tag_new();
if (decoder_plugin_scan_stream(plugin, is,
&full_tag_handler,
song->tag))
break;
tag_free(song->tag);
song->tag = NULL;
input_stream_lock_seek(is, 0, SEEK_SET, NULL);
}
}
plugin = decoder_plugin_from_suffix(suffix, plugin);
} while (plugin != NULL);
if (is != NULL)
input_stream_close(is);
if (mutex != NULL) {
g_cond_free(cond);
g_mutex_free(mutex);
}
if (song->tag != NULL && tag_is_empty(song->tag))
tag_scan_fallback(path_fs, &full_tag_handler, song->tag);
g_free(path_fs);
return song->tag != NULL;
}
bool
song_file_update_inarchive(struct song *song)
{
const char *suffix;
const struct decoder_plugin *plugin;
assert(song_is_file(song));
/* check if there's a suffix and a plugin */
suffix = uri_get_suffix(song->uri);
if (suffix == NULL)
return false;
plugin = decoder_plugin_from_suffix(suffix, NULL);
if (plugin == NULL)
return false;
if (song->tag != NULL)
tag_free(song->tag);
//accept every file that has music suffix
//because we don't support tag reading through
//input streams
song->tag = tag_new();
return true;
}
|
#include <pebble.h>
#include "config.h"
BitmapLayer * bluetooth_layer;
GBitmap *bluetooth_images[4];
bool bt_connected = false;
int _bt_loaded = 0;
void bt_load(Layer * window_layer, GRect rect) {
if (!_bt_loaded) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "bt_load");
for (int i = 0; i < 2; i++)
bluetooth_images[i] = gbitmap_create_with_resource(RESOURCE_ID_IMAGE_BLUETOOTH_OFF + i);
bluetooth_layer = bitmap_layer_create(rect);
layer_add_child(window_layer, bitmap_layer_get_layer(bluetooth_layer));
_bt_loaded = 1;
bt_redraw();
register_plugin((load_fn)bt_load,(void_fn)bt_redraw,(void_fn)bt_unload);
}
}
void bt_redraw() {
if (_bt_loaded) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "bt_redraw");
GBitmap * bmp = bluetooth_images[bt_connected ? 1 : 0];
if (customcolor) {
#ifdef PBL_COLOR
replace_gbitmap_color(GColorBlack, bg_color, bmp, bluetooth_layer);
replace_gbitmap_color(GColorWhite, text_color, bmp, bluetooth_layer);
#endif
}
bitmap_layer_set_bitmap(bluetooth_layer, bmp);
}
}
void bt_refresh(bool connected) {
if (_bt_loaded) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "bt_refresh");
if (appstarted && !connected && bt_vibe) {
vibes_long_pulse();
}
bt_connected = connected;
bt_redraw();
}
}
void bt_unload() {
if (_bt_loaded) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "bt_unload");
bitmap_layer_destroy(bluetooth_layer);
for (int i = 0; i < 2; i++) {
gbitmap_destroy(bluetooth_images[i]);
}
_bt_loaded = 0;
}
}
int bt_loaded() {
return _bt_loaded;
}
|
/* $Id: sp_respond.h,v 1.26 2015/04/23 18:28:09 jocornet Exp $ */
/*
** Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved.
** Copyright (C) 2002-2013 Sourcefire, Inc.
** Copyright (C) 1998-2002 Martin Roesch <roesch@sourcefire.com>
** Copyright (C) 1999,2000,2001 Christian Lademann <cal@zls.de>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License Version 2 as
** published by the Free Software Foundation. You may not use, modify or
** distribute this program under any other version of the GNU General
** Public License.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef __SP_RESPOND_H__
#define __SP_RESPOND_H__
#ifdef ENABLE_RESPOND
void SetupRespond(void);
uint32_t RespondHash(void* d);
int RespondCompare(void *l, void *r);
#endif
#endif
|
#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include "elf.h"
#include <string.h>
FILE * source;
void clean_up(){
fclose(source);
}
const char * types[] = {
"NULL", "LOAD", "DYNAMIC", "INTERP","NOTE",
"SHLIB","PHDR","TLS","LOOS","HIOS","LOPROC","HIPROC"
};
char * permissions(uint flags) {
char * res = strdup(" ");
if(flags & 1) res[0] = 'X';
if(flags & 2) res[1] = 'W';
if(flags & 4) res[2] = 'R';
return res;
}
int main(int argc, const char ** argv){
source = stdin;
if(argc > 1){
source = fopen(argv[1],"r");
atexit(clean_up);
}else{
printf("Te falta el argumento de archivo\n");
exit(0);
}
char * buffer = malloc(1024);
int read = 0;
while(!feof(source)){
buffer = realloc(buffer,read+1024);
read += fread(buffer+read,sizeof(char),1024,source);
}
elf_file * e = elf_exec_create(buffer);
if(e == NULL){
printf("Algo salio muy mal\n");
exit(0);
}
printf("El punto de entrada es %x\n",elf_entry_point(e));
for(uint i = 0; i < e->header->ph_entry_count; ++i){
elf_segment * es = elf_get_segment(e,i);
if(es == NULL){
printf("El header %d es nulo\n",i);
continue;
}
printf("HEADER DE PROGRAMA: \n");
printf("\tNumero identificador de tipo: %d\n",es->type);
printf("\tTipo: %s\n",types[es->type]);
printf("\tTamanio: %d\n",es->file_size);
printf("\tTamanio de imagen: %d\n",es->mem_size);
printf("\tDireccion virtual: %x\n",es->virtual_address);
printf("\tAtributos: %x\n", es->attributes);
printf("\tAlineacion: %x\n",es->alignment);
printf("\tFlags: %s\n",permissions(es->flags));
elf_free_segment(es);
}
elf_destroy(e);
}
|
/*
(c) Copyright 2001-2008 The world wide DirectFB Open Source Community (directfb.org)
(c) Copyright 2000-2004 Convergence (integrated media) GmbH
All rights reserved.
Written by Denis Oliver Kropp <dok@directfb.org>,
Andreas Hundt <andi@fischlustig.de>,
Sven Neumann <neo@directfb.org>,
Ville Syrjälä <syrjala@sci.fi> and
Claudio Ciccani <klan@users.sf.net>.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#ifndef __INPUT_H__
#define __INPUT_H__
#include <pthread.h>
#include <directfb.h>
#include <direct/modules.h>
#include <fusion/reactor.h>
#include <core/coretypes.h>
DECLARE_MODULE_DIRECTORY( dfb_input_modules );
/*
* Increase this number when changes result in binary incompatibility!
*/
#define DFB_INPUT_DRIVER_ABI_VERSION 7
#define DFB_INPUT_DRIVER_INFO_NAME_LENGTH 48
#define DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH 64
typedef struct {
int major; /* major version */
int minor; /* minor version */
} InputDriverVersion; /* major.minor, e.g. 0.1 */
typedef struct {
InputDriverVersion version;
char name[DFB_INPUT_DRIVER_INFO_NAME_LENGTH];
/* Name of driver,
e.g. 'Serial Mouse Driver' */
char vendor[DFB_INPUT_DRIVER_INFO_VENDOR_LENGTH];
/* Vendor (or author) of the driver,
e.g. 'directfb.org' or 'Sven Neumann' */
} InputDriverInfo;
typedef struct {
unsigned int prefered_id; /* Prefered predefined input device id,
e.g. DIDID_MOUSE */
DFBInputDeviceDescription desc; /* Capabilities, type, etc. */
} InputDeviceInfo;
typedef struct {
int (*GetAvailable) (void);
void (*GetDriverInfo) (InputDriverInfo *driver_info);
DFBResult (*OpenDevice) (CoreInputDevice *device,
unsigned int number,
InputDeviceInfo *device_info,
void **driver_data);
DFBResult (*GetKeymapEntry) (CoreInputDevice *device,
void *driver_data,
DFBInputDeviceKeymapEntry *entry);
void (*CloseDevice) (void *driver_data);
} InputDriverFuncs;
typedef DFBEnumerationResult (*InputDeviceCallback) (CoreInputDevice *device,
void *ctx);
void dfb_input_enumerate_devices( InputDeviceCallback callback,
void *ctx,
DFBInputDeviceCapabilities caps );
DirectResult dfb_input_attach ( CoreInputDevice *device,
ReactionFunc func,
void *ctx,
Reaction *reaction );
DirectResult dfb_input_detach ( CoreInputDevice *device,
Reaction *reaction );
DirectResult dfb_input_attach_global( CoreInputDevice *device,
int index,
void *ctx,
GlobalReaction *reaction );
DirectResult dfb_input_detach_global( CoreInputDevice *device,
GlobalReaction *reaction );
DFBResult dfb_input_add_global ( ReactionFunc func,
int *ret_index );
DFBResult dfb_input_set_global ( ReactionFunc func,
int index );
void dfb_input_dispatch ( CoreInputDevice *device,
DFBInputEvent *event );
void dfb_input_device_description( const CoreInputDevice *device,
DFBInputDeviceDescription *desc );
DFBInputDeviceID dfb_input_device_id ( const CoreInputDevice *device );
CoreInputDevice *dfb_input_device_at ( DFBInputDeviceID id );
DFBResult dfb_input_device_get_keymap_entry( CoreInputDevice *device,
int keycode,
DFBInputDeviceKeymapEntry *entry );
DFBResult dfb_input_device_reload_keymap ( CoreInputDevice *device );
/* global reactions */
typedef enum {
DFB_WINDOWSTACK_INPUTDEVICE_LISTENER
} DFB_INPUT_GLOBALS;
#endif
|
#include <QtCore/QtCore>
class HueTransitionToOnState : public QState
{
Q_OBJECT
public:
HueTransitionToOnState(QState *parent = Q_NULLPTR);
protected:
void onEntry(QEvent*);
void onExit(QEvent*);
};
|
/*
* This code is part of MaNGOS. Contributor & Copyright details are in AUTHORS/THANKS.
*
* 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 _MODELINSTANCE_H_
#define _MODELINSTANCE_H_
#include <G3D/Matrix3.h>
#include <G3D/Vector3.h>
#include <G3D/AABox.h>
#include <G3D/Ray.h>
#include "Platform/Define.h"
namespace VMAP
{
class WorldModel;
struct AreaInfo;
struct LocationInfo;
enum ModelFlags
{
MOD_M2 = 1,
MOD_WORLDSPAWN = 1 << 1,
MOD_HAS_BOUND = 1 << 2
};
class ModelSpawn
{
public:
// mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, Bound_lo, Bound_hi, name
uint32 flags;
uint16 adtId;
uint32 ID;
G3D::Vector3 iPos;
G3D::Vector3 iRot;
float iScale;
G3D::AABox iBound;
std::string name;
bool operator==(const ModelSpawn& other) const { return ID == other.ID; }
// uint32 hashCode() const { return ID; }
// temp?
const G3D::AABox& getBounds() const { return iBound; }
static bool readFromFile(FILE* rf, ModelSpawn& spawn);
static bool writeToFile(FILE* rw, const ModelSpawn& spawn);
};
class ModelInstance: public ModelSpawn
{
public:
ModelInstance(): iModel(0) {}
ModelInstance(const ModelSpawn& spawn, WorldModel* model);
void setUnloaded() { iModel = 0; }
bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const;
void intersectPoint(const G3D::Vector3& p, AreaInfo& info) const;
bool GetLocationInfo(const G3D::Vector3& p, LocationInfo& info) const;
bool GetLiquidLevel(const G3D::Vector3& p, LocationInfo& info, float& liqHeight) const;
protected:
G3D::Matrix3 iInvRot;
float iInvScale;
WorldModel* iModel;
#ifdef MMAP_GENERATOR
public:
WorldModel* const getWorldModel();
#endif
};
} // namespace VMAP
#endif // _MODELINSTANCE
|
// license:BSD-3-Clause
// copyright-holders:Ryan Holtz
//============================================================
//
// slider.h - BGFX shader parameter slider
//
//============================================================
#pragma once
#ifndef __DRAWBGFX_SLIDER__
#define __DRAWBGFX_SLIDER__
#include <bgfx/bgfx.h>
#include <string>
#include <vector>
#include "emu.h"
#include "../frontend/mame/ui/slider.h"
class bgfx_slider
{
public:
enum slider_type
{
SLIDER_INT_ENUM,
SLIDER_FLOAT,
SLIDER_INT,
SLIDER_COLOR,
SLIDER_VEC2
};
enum screen_type
{
SLIDER_SCREEN_TYPE_NONE = 0,
SLIDER_SCREEN_TYPE_RASTER = 1,
SLIDER_SCREEN_TYPE_VECTOR = 2,
SLIDER_SCREEN_TYPE_VECTOR_OR_RASTER = SLIDER_SCREEN_TYPE_VECTOR | SLIDER_SCREEN_TYPE_RASTER,
SLIDER_SCREEN_TYPE_LCD = 4,
SLIDER_SCREEN_TYPE_LCD_OR_RASTER = SLIDER_SCREEN_TYPE_LCD | SLIDER_SCREEN_TYPE_RASTER,
SLIDER_SCREEN_TYPE_LCD_OR_VECTOR = SLIDER_SCREEN_TYPE_LCD | SLIDER_SCREEN_TYPE_VECTOR,
SLIDER_SCREEN_TYPE_ANY = SLIDER_SCREEN_TYPE_RASTER | SLIDER_SCREEN_TYPE_VECTOR | SLIDER_SCREEN_TYPE_LCD
};
bgfx_slider(running_machine& machine, std::string name, float min, float def, float max, float step, slider_type type, screen_type screen, std::string format, std::string description, std::vector<std::string>& strings);
~bgfx_slider();
int32_t update(std::string *str, int32_t newval);
// Getters
std::string name() const { return m_name; }
slider_type type() const { return m_type; }
float value() const { return m_value; }
float uniform_value() const { return float(m_value); }
slider_state* core_slider() const { return m_slider_state; }
size_t size() const { return get_size_for_type(m_type); }
static size_t get_size_for_type(slider_type type);
// Setters
void import(float val);
protected:
slider_state* create_core_slider(running_machine &machine);
int32_t as_int() const { return int32_t(floor(m_value / m_step + 0.5f)); }
std::string m_name;
float m_min;
float m_default;
float m_max;
float m_step;
slider_type m_type;
screen_type m_screen_type;
std::string m_format;
std::string m_description;
std::vector<std::string> m_strings;
float m_value;
slider_state* m_slider_state;
running_machine&m_machine;
};
#endif // __DRAWBGFX_SLIDER__
|
#ifndef _SETTINGS_H__
#define _SETTINGS_H__
enum ComputerStrengthType {
CST_Easy,
CST_Hard
};
struct GuiSettings {
};
struct AppSettings {
Preference::GameSettings gameSettings;
GuiSettings guiSettings;
ComputerStrengthType computer1;
ComputerStrengthType computer2;
void Load() {}
void Save() {}
};
#endif // _SETTINGS_H__
|
#include "qemu-common.h"
#include "qemu-option.h"
#include "qemu-config.h"
#include "sysemu.h"
QemuOptsList qemu_drive_opts = {
.name = "drive",
.head = QTAILQ_HEAD_INITIALIZER(qemu_drive_opts.head),
.desc = {
{
.name = "bus",
.type = QEMU_OPT_NUMBER,
.help = "bus number",
},{
.name = "unit",
.type = QEMU_OPT_NUMBER,
.help = "unit number (i.e. lun for scsi)",
},{
.name = "if",
.type = QEMU_OPT_STRING,
.help = "interface (ide, scsi, sd, mtd, floppy, pflash, virtio)",
},{
.name = "index",
.type = QEMU_OPT_NUMBER,
},{
.name = "cyls",
.type = QEMU_OPT_NUMBER,
.help = "number of cylinders (ide disk geometry)",
},{
.name = "heads",
.type = QEMU_OPT_NUMBER,
.help = "number of heads (ide disk geometry)",
},{
.name = "secs",
.type = QEMU_OPT_NUMBER,
.help = "number of sectors (ide disk geometry)",
},{
.name = "trans",
.type = QEMU_OPT_STRING,
.help = "chs translation (auto, lba. none)",
},{
.name = "media",
.type = QEMU_OPT_STRING,
.help = "media type (disk, cdrom)",
},{
.name = "snapshot",
.type = QEMU_OPT_BOOL,
},{
.name = "file",
.type = QEMU_OPT_STRING,
.help = "disk image",
},{
.name = "cache",
.type = QEMU_OPT_STRING,
.help = "host cache usage (none, writeback, writethrough)",
},{
.name = "aio",
.type = QEMU_OPT_STRING,
.help = "host AIO implementation (threads, native)",
},{
.name = "format",
.type = QEMU_OPT_STRING,
.help = "disk format (raw, qcow2, ...)",
},{
.name = "serial",
.type = QEMU_OPT_STRING,
},{
.name = "werror",
.type = QEMU_OPT_STRING,
},{
.name = "addr",
.type = QEMU_OPT_STRING,
.help = "pci address (virtio only)",
},{
.name = "boot",
.type = QEMU_OPT_BOOL,
.help = "make this a boot drive",
},
{ /* end if list */ }
},
};
QemuOptsList qemu_chardev_opts = {
.name = "chardev",
.head = QTAILQ_HEAD_INITIALIZER(qemu_chardev_opts.head),
.desc = {
{
.name = "backend",
.type = QEMU_OPT_STRING,
},{
.name = "path",
.type = QEMU_OPT_STRING,
},{
.name = "host",
.type = QEMU_OPT_STRING,
},{
.name = "port",
.type = QEMU_OPT_STRING,
},{
.name = "localaddr",
.type = QEMU_OPT_STRING,
},{
.name = "localport",
.type = QEMU_OPT_STRING,
},{
.name = "to",
.type = QEMU_OPT_NUMBER,
},{
.name = "ipv4",
.type = QEMU_OPT_BOOL,
},{
.name = "ipv6",
.type = QEMU_OPT_BOOL,
},{
.name = "wait",
.type = QEMU_OPT_BOOL,
},{
.name = "server",
.type = QEMU_OPT_BOOL,
},{
.name = "delay",
.type = QEMU_OPT_BOOL,
},{
.name = "telnet",
.type = QEMU_OPT_BOOL,
},{
.name = "width",
.type = QEMU_OPT_NUMBER,
},{
.name = "height",
.type = QEMU_OPT_NUMBER,
},{
.name = "cols",
.type = QEMU_OPT_NUMBER,
},{
.name = "rows",
.type = QEMU_OPT_NUMBER,
},{
.name = "mux",
.type = QEMU_OPT_BOOL,
},
{ /* end if list */ }
},
};
QemuOptsList qemu_device_opts = {
.name = "device",
.head = QTAILQ_HEAD_INITIALIZER(qemu_device_opts.head),
.desc = {
/*
* no elements => accept any
* sanity checking will happen later
* when setting device properties
*/
{ /* end if list */ }
},
};
QemuOptsList qemu_net_opts = {
.name = "net",
.head = QTAILQ_HEAD_INITIALIZER(qemu_net_opts.head),
.desc = {
/*
* no elements => accept any params
* validation will happen later
*/
{ /* end of list */ }
},
};
QemuOptsList qemu_rtc_opts = {
.name = "rtc",
.head = QTAILQ_HEAD_INITIALIZER(qemu_rtc_opts.head),
.desc = {
{
.name = "base",
.type = QEMU_OPT_STRING,
},{
.name = "clock",
.type = QEMU_OPT_STRING,
#ifdef TARGET_I386
},{
.name = "driftfix",
.type = QEMU_OPT_STRING,
#endif
},
{ /* end if list */ }
},
};
static QemuOptsList *lists[] = {
&qemu_drive_opts,
&qemu_chardev_opts,
&qemu_device_opts,
&qemu_net_opts,
&qemu_rtc_opts,
NULL,
};
int qemu_set_option(const char *str)
{
char group[64], id[64], arg[64];
QemuOpts *opts;
int i, rc, offset;
rc = sscanf(str, "%63[^.].%63[^.].%63[^=]%n", group, id, arg, &offset);
if (rc < 3 || str[offset] != '=') {
qemu_error("can't parse: \"%s\"\n", str);
return -1;
}
for (i = 0; lists[i] != NULL; i++) {
if (strcmp(lists[i]->name, group) == 0)
break;
}
if (lists[i] == NULL) {
qemu_error("there is no option group \"%s\"\n", group);
return -1;
}
opts = qemu_opts_find(lists[i], id);
if (!opts) {
qemu_error("there is no %s \"%s\" defined\n",
lists[i]->name, id);
return -1;
}
if (qemu_opt_set(opts, arg, str+offset+1) == -1) {
return -1;
}
return 0;
}
|
/*
* linux/arch/arm/mach-clps711x/clep7312.c
*
* 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 <linux/init.h>
#include <linux/types.h>
#include <linux/string.h>
#include <asm/setup.h>
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include "common.h"
static void __init
fixup_clep7312(struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
mi->nr_banks=1;
mi->bank[0].start = 0xc0000000;
mi->bank[0].size = 0x01000000;
}
MACHINE_START(CLEP7212, "Cirrus Logic 7212/7312")
/* Maintainer: Nobody */
.boot_params = 0xc0000100,
.fixup = fixup_clep7312,
.map_io = clps711x_map_io,
.init_irq = clps711x_init_irq,
.timer = &clps711x_timer,
MACHINE_END
|
#ifndef _YLIST_H_
#define _YLIST_H_
#define COMMON_LIST \
struct _list_node_t *pre; \
struct _list_node_t *suc;
typedef struct _list_node_t
{
COMMON_LIST
} list_node_t;
typedef struct
{
list_node_t *start;
uint32_t length;
} list_t;
void freeList(list_t *list);
void deleteListNode(list_t *list, list_node_t *node);
list_node_t *unshiftListNode(list_t *list, list_node_t *node);
list_node_t *insertListNodeAfter(
list_t *list,
list_node_t *node,
list_node_t *pre);
#endif /* _YLIST_H_ */
|
/*
* Created on 9. September 2008, 01:08
*
* Copyright 2008 Oliver Eichner <o.eichner@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 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
/**
* @file DeviceTreeView.h
* TreeView widget header for the devies
*/
#ifndef _DEVICETREEVIEW_H
#define _DEVICETREEVIEW_H
#include <gtkmm.h>
#include <gtkmm/filefilter.h>
#include <gtkmm/menu_elems.h>
#include <gtkmm/menu.h>
#include <gtkmm/container.h>
#include <gtkmm/dialog.h>
#include <gdkmm-2.4/gdkmm.h>
#include <locale>
#include <sstream>
#include <list>
#include <fstream>
#include <string>
#include <iostream>
#include "DeviceDetailDialog.h"
#include "Device.h"
#include "CommentDialog.h"
#include "text.h"
#include "SaveToFileDialog.h"
using namespace std;
/**
* @class CellItem_Device
* The TreeView Device Items
* @author Oliver Eichner
* @version 0.0.93
*/
class CellItem_Device {
public:
CellItem_Device();
CellItem_Device(string tbridge, string devicename,
string vendor, string model,
string size, bool writeblocked, bool hpa_inUse,
bool dco_inUse, bool security_inUse);
CellItem_Device(const CellItem_Device& src);
~CellItem_Device();
CellItem_Device & operator=(const CellItem_Device& src);
Glib::ustring tp_tbridge;
Glib::ustring tp_devicename;
Glib::ustring tp_vendor;
Glib::ustring tp_model;
Glib::ustring tp_size;
bool tp_writeblocked;
bool tp_hpa_inUse;
bool tp_dco_inUse;
bool tp_security_inUse;
};
/**
* @class DeviceTreeView
* The class for displaying the Device TreeView
* @author Oliver Eichner
* @version 0.0.92
*/
class DeviceTreeView : public Gtk::TreeView {
public:
DeviceTreeView();
DeviceTreeView(const DeviceTreeView& orig);
virtual ~DeviceTreeView();
// virtual void fillTree();
virtual void reload();
virtual void hideColumn(DevTreeEnum column);
virtual bool somethingSelected();
virtual Device& get_SelectedDeviceIterator();
virtual void on_menu_file_popup_AddComment();
virtual void on_menu_file_popup_Details();
virtual void on_menu_file_popup_Save();
// Override Signal handler:
// Alternatively, use signal_button_press_event().connect_notify()
virtual bool on_button_press_event(GdkEventButton *ev);
protected:
virtual void create_model();
virtual void add_columns();
virtual void add_items();
virtual void liststore_add_item(const CellItem_Device& tp_items);
//Signal handler for popup menu items:
virtual void on_menu_file_popup_generic();
virtual void on_menu_file_popup_Print();
virtual list<Device>::iterator findDeviceIter(Glib::ustring deviceName);
virtual void dialogPrint(list<Device>::iterator nDeviceIter);
Glib::RefPtr<Gtk::ListStore> tp_refListStore;
typedef std::vector<CellItem_Device> type_vecItems;
type_vecItems tp_vecItems;
//Tree model columns:
/**
* @class DeviceTreeView::ModelColumns
* The Columns for the treeview
*/
class ModelColumns : public Gtk::TreeModel::ColumnRecord {
public:
ModelColumns() {
add(tp_col_tbridge);
add(tp_col_devname);
add(tp_col_vendor);
add(tp_col_model);
add(tp_col_size);
add(tp_col_writeblocked);
add(tp_col_hpa_inUse);
add(tp_col_dco_inUse);
add(tp_col_security_inUse);
}
Gtk::TreeModelColumn<Glib::ustring> tp_col_tbridge;
Gtk::TreeModelColumn<Glib::ustring> tp_col_devname;
Gtk::TreeModelColumn<Glib::ustring> tp_col_vendor;
Gtk::TreeModelColumn<Glib::ustring> tp_col_model;
Gtk::TreeModelColumn<Glib::ustring> tp_col_size;
Gtk::TreeModelColumn<bool> tp_col_writeblocked;
Gtk::TreeModelColumn<bool> tp_col_hpa_inUse;
Gtk::TreeModelColumn<bool> tp_col_dco_inUse;
Gtk::TreeModelColumn<bool> tp_col_security_inUse;
};
ModelColumns tp_Columns;
//The Tree model:
Glib::RefPtr<Gtk::ListStore> tp_refTreeModel;
Gtk::Menu tp_Menu_Popup;
list<Device> DeviceList;
enum ResponseType {
response_Save,
response_Print
};
};
#endif /* _DEVICETREEVIEW_H */
|
/*
* Copyright (C) 2013 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#include <config.h>
#ifdef __linux__
# include "internal.h"
# include <stdlib.h>
# include <dbus/dbus.h>
void dbus_connection_set_change_sigpipe(dbus_bool_t will_modify_sigpipe ATTRIBUTE_UNUSED)
{
}
DBusConnection *dbus_bus_get(DBusBusType type ATTRIBUTE_UNUSED,
DBusError *error ATTRIBUTE_UNUSED)
{
return (DBusConnection *)0x1;
}
void dbus_connection_set_exit_on_disconnect(DBusConnection *connection ATTRIBUTE_UNUSED,
dbus_bool_t exit_on_disconnect ATTRIBUTE_UNUSED)
{
}
dbus_bool_t dbus_connection_set_watch_functions(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusAddWatchFunction add_function ATTRIBUTE_UNUSED,
DBusRemoveWatchFunction remove_function ATTRIBUTE_UNUSED,
DBusWatchToggledFunction toggled_function ATTRIBUTE_UNUSED,
void *data ATTRIBUTE_UNUSED,
DBusFreeFunction free_data_function ATTRIBUTE_UNUSED)
{
return 1;
}
dbus_bool_t dbus_message_set_reply_serial(DBusMessage *message ATTRIBUTE_UNUSED,
dbus_uint32_t serial ATTRIBUTE_UNUSED)
{
return 1;
}
DBusMessage *dbus_connection_send_with_reply_and_block(DBusConnection *connection ATTRIBUTE_UNUSED,
DBusMessage *message,
int timeout_milliseconds ATTRIBUTE_UNUSED,
DBusError *error ATTRIBUTE_UNUSED)
{
DBusMessage *reply = NULL;
const char *service = dbus_message_get_destination(message);
const char *member = dbus_message_get_member(message);
if (STREQ(service, "org.freedesktop.machine1")) {
if (getenv("FAIL_BAD_SERVICE")) {
DBusMessageIter iter;
const char *error_message = "Something went wrong creating the machine";
if (!(reply = dbus_message_new(DBUS_MESSAGE_TYPE_ERROR)))
return NULL;
dbus_message_set_error_name(reply, "org.freedesktop.systemd.badthing");
dbus_message_iter_init_append(reply, &iter);
if (!dbus_message_iter_append_basic(&iter,
DBUS_TYPE_STRING,
&error_message))
goto error;
} else {
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
}
} else if (STREQ(service, "org.freedesktop.DBus") &&
STREQ(member, "ListActivatableNames")) {
const char *svc1 = "org.foo.bar.wizz";
const char *svc2 = "org.freedesktop.machine1";
DBusMessageIter iter, sub;
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
dbus_message_iter_init_append(reply, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
"s", &sub);
if (!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc1))
goto error;
if (!getenv("FAIL_NO_SERVICE") &&
!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc2))
goto error;
dbus_message_iter_close_container(&iter, &sub);
} else if (STREQ(service, "org.freedesktop.DBus") &&
STREQ(member, "ListNames")) {
const char *svc1 = "org.foo.bar.wizz";
const char *svc2 = "org.freedesktop.systemd1";
DBusMessageIter iter, sub;
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
dbus_message_iter_init_append(reply, &iter);
dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY,
"s", &sub);
if (!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc1))
goto error;
if ((!getenv("FAIL_NO_SERVICE") && !getenv("FAIL_NOT_REGISTERED")) &&
!dbus_message_iter_append_basic(&sub,
DBUS_TYPE_STRING,
&svc2))
goto error;
dbus_message_iter_close_container(&iter, &sub);
} else {
reply = dbus_message_new(DBUS_MESSAGE_TYPE_METHOD_RETURN);
}
return reply;
error:
dbus_message_unref(reply);
return NULL;
}
#else
/* Nothing to override on non-__linux__ platforms */
#endif
|
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <pthread.h>
#define NUM_THREADS 10
static pthread_once_t welcome_once_block = PTHREAD_ONCE_INIT;
void welcome(void)
{
printf("welcome: Welcome\n");
}
void *identify_yourself(void *arg)
{
int rtn;
if ((rtn = pthread_once(&welcome_once_block,
welcome)) != 0) {
fprintf(stderr, "pthread_once failed with %d",rtn);
pthread_exit((void *)NULL);
}
printf("identify_yourself: Hi, I'm a thread\n");
return(NULL);
}
extern int
main(void)
{
int *id_arg, thread_num, rtn;
pthread_t threads[NUM_THREADS];
id_arg = (int *)malloc(NUM_THREADS*sizeof(int));
for (thread_num = 0; thread_num < NUM_THREADS; (thread_num)++) {
id_arg[thread_num] = thread_num;
if (( rtn = pthread_create(&threads[thread_num],
NULL,
identify_yourself,
(void *) &(id_arg[thread_num])))
!= 0) {
fprintf(stderr, "pthread_create failed with %d",rtn);
exit(1);
}
}
for (thread_num = 0; thread_num < NUM_THREADS; thread_num++) {
pthread_join(threads[thread_num], NULL);
}
printf("main: Goodbye\n");
return 0;
}
|
/*
* Bricks-OS, Operating System for Game Consoles
* Copyright (C) 2008 Maximus32 <Maximus32@bricks-os.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA
*/
#ifndef GENWAIT_H
#define GENWAIT_H
#include "stdint.h"
int genwait_wait(void * obj, useconds_t useconds);
int genwait_wake(void * obj, int maxcount);
#endif
|
/*****************************************************************************
*
* 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
*
* $Id: sincos.c 591 2006-01-17 12:28:08Z picard $
*
* The Core Pocket Media Player
* Copyright (c) 2004-2005 Gabor Kovacs
*
****************************************************************************/
#include "../common.h"
#define PI 3.14159265358979324
NOINLINE double floor(double i);
NOINLINE double ceil(double i)
{
if (i<0)
return -floor(-i);
else
{
double d = floor(i);
if (d!=i)
d+=1.0;
return d;
}
}
NOINLINE double floor(double i)
{
if (i<0)
return -ceil(-i);
else
return (double)(int)i;
}
NOINLINE double sin(double i)
{
int n,k;
double j,sum;
int sign = 0;
if (i<0)
{
sign = 1;
i = -i;
}
i *= 1.0/(2*PI);
i -= floor(i);
if (i>=0.5)
{
i -= 0.5;
sign ^= 1;
}
i *= 2*PI;
k = 1;
j = sum = i;
for (n=3;n<14;n+=2)
{
k *= (n-1)*n;
j *= i*i;
if (n & 2)
sum -= j/k;
else
sum += j/k;
}
return sign ? -sum:sum;
}
NOINLINE double cos(double i)
{
return sin(i+PI/2);
}
|
/* Copyright 2000 Kjetil S. Matheussen
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 _RADIUM_COMMON_CLIPBOARD_TEMPOS_COPY_PROC_H
#define _RADIUM_COMMON_CLIPBOARD_TEMPOS_COPY_PROC_H
extern LANGSPEC struct Swing *CB_CopySwings(
const struct Swing *swing,
const Place *cut // can be NULL
);
extern LANGSPEC struct Signatures *CB_CopySignatures(
const struct Signatures *signature
);
extern LANGSPEC struct LPBs *CB_CopyLPBs(
const struct LPBs *lpb
);
extern LANGSPEC struct Tempos *CB_CopyTempos(
const struct Tempos *tempo
);
extern LANGSPEC struct TempoNodes *CB_CopyTempoNodes(
const struct TempoNodes *temponode
);
#endif
|
#include <stdio.h>
int main( void )
{
int age;
char c;
double income;
printf("input age:\n");
scanf("%d", &age);
scanf("%*[^\n]");
scanf("%*c");
printf("input c:\n");
scanf("%c", &c);
scanf("%*[^\n]");
scanf("%*c");
printf("input income:\n");
scanf("%lf", &income);
printf("你的年龄是%d, %s, %g\n", age, c=='f'?"女" : "男", income);
return 0;
}
|
/*
Copyright 2008 by Robert Knight <robertknight@gmail.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
*/
#ifndef WARNINGBOX_H
#define WARNINGBOX_H
// Qt
#include <QtGui/QFrame>
class QLabel;
namespace Konsole
{
/**
* A label which displays a warning message,
* using the appropriate icon from the current icon theme
* and background color from KColorScheme
*/
class WarningBox : public QFrame
{
Q_OBJECT
public:
WarningBox(QWidget* parent = 0);
/** Sets the text displayed in the warning label. */
void setText(const QString& text);
/** Returns the text displayed in the warning label. */
QString text() const;
private:
QLabel* _label;
};
}
#endif // WARNINGBOX_H
|
/*
* T50 - Experimental Mixed Packet Injector
*
* Copyright (C) 2010 - 2014 - T50 developers
*
* 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/>.
*/
#include <common.h>
void icmp_help(void)
{
printf("ICMP Options:\n"
" --icmp-type NUM ICMP type (default %d)\n"
" --icmp-code NUM ICMP code (default 0)\n"
" --icmp-gateway ADDR ICMP redirect gateway (default RANDOM)\n"
" --icmp-id NUM ICMP identification (default RANDOM)\n"
" --icmp-sequence NUM ICMP sequence # (default RANDOM)\n\n",
ICMP_ECHO);
}
|
/* header file of mygmres.c --
* generalized minimum residual method
* Copyright (C) 1998-2007 Kengo Ichiki <kichiki@users.sourceforge.net>
* $Id: gmres.h,v 2.9 2007/11/25 18:41:57 kichiki Exp $
*
* Reference :
* GMRES(m) : Y.Saad & M.H.Schultz, SIAM J.Sci.Stat.Comput.
* vol7 (1986) pp.856-869
*
* 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 _GMRES_H_
#define _GMRES_H_
/* GMRES(m)
* INPUT
* n : dimension of the problem
* b[n] : r-h-s vector
* atimes (int n, static double *x, double *b, void *param) :
* calc matrix-vector product A.x = b.
* atimes_param : parameters for atimes().
* it : struct iter. the following entries are used.
* it->max : max of iteration
* it->restart : number of iteration at once
* it->eps : criteria for |r^2|/|b^2|
* OUTPUT
* returned value : 0 == success, otherwise (-1) == failed
* x[m] : solution
* it->niter : # of iteration
* it->res2 : |r^2| / |b^2|
*/
int
gmres_m (int n, const double *f, double *x,
void (*atimes) (int, const double *, double *, void *),
void *atimes_param,
struct iter *it);
/* GMRES(m) with preconditioning
* INPUT
* n : dimension of the problem
* b[n] : r-h-s vector
* atimes (int n, static double *x, double *b, void *param) :
* calc matrix-vector product A.x = b.
* atimes_param : parameters for atimes().
* inv (int n, static double *b, double *x, void *param) :
* approx of A^{-1}.b = x for preconditioning.
* inv_param : parameters for the preconditioner inv().
* it : struct iter. the following entries are used.
* it->max : max of iteration
* it->restart : number of iteration at once
* it->eps : criteria for |r^2|/|b^2|
* OUTPUT
* returned value : 0 == success, otherwise (-1) == failed
* x[n] : solution
* it->niter : # of iteration
* it->res2 : |r^2| / |b^2|
*/
int
gmres_m_pc (int n, const double *f, double *x,
void (*atimes) (int, const double *, double *, void *),
void *atimes_param,
void (*inv) (int, const double *, double *, void *),
void *inv_param,
struct iter *it);
/* plain GMRES (not restart version)
* INPUT
* m : dimension of the problem
* b[m] : r-h-s vector
* atimes (int m, static double *x, double *b, void *param) :
* calc matrix-vector product A.x = b.
* atimes_param : parameters for atimes().
* it : struct iter. following entries are used
* it->max : max of iteration
* it->eps : criteria for |r^2|/|b^2|
* OUTPUT
* returned value : 0 == success, otherwise (-1) == failed
* x[m] : solution
* it->niter : # of iteration
* it->res2 : |r^2| / |b^2|
*/
int
gmres (int n, const double *f, double *x,
void (*atimes) (int, const double *, double *, void *),
void *atimes_param,
struct iter *it);
#endif /* !_GMRES_H_ */
|
/* This file is part of the KDE project
Copyright (C) 2009, 2011 Dag Andersen <danders@get2net.dk>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KPTHTMLVIEW_H
#define KPTHTMLVIEW_H
#include "kplatoui_export.h"
#include "kptviewbase.h"
#include "khtml_part.h"
class KoDocument;
class KUrl;
class QPoint;
namespace KPlato
{
class KPLATOUI_EXPORT HtmlView : public ViewBase
{
Q_OBJECT
public:
HtmlView(KoPart *part, KoDocument *doc, QWidget *parent);
bool openHtml( const KUrl &url );
void setupGui();
virtual void updateReadWrite( bool readwrite );
KoPrintJob *createPrintJob();
KHTMLPart &htmlPart() { return *m_htmlPart; }
const KHTMLPart &htmlPart() const { return *m_htmlPart; }
Q_SIGNALS:
void openUrlRequest( HtmlView*, const KUrl& );
public Q_SLOTS:
/// Activate/deactivate the gui
virtual void setGuiActive( bool activate );
void slotOpenUrlRequest(const KUrl &url, const KParts::OpenUrlArguments &arguments=KParts::OpenUrlArguments(), const KParts::BrowserArguments &browserArguments=KParts::BrowserArguments());
protected:
void updateActionsEnabled( bool on = true );
private Q_SLOTS:
void slotContextMenuRequested( const QModelIndex &index, const QPoint& pos );
void slotEnableActions( bool on );
private:
KHTMLPart *m_htmlPart;
};
} //KPlato namespace
#endif
|
/*
* Given an integer k and a string s,
* find the length of the longest substring that contains at most k distinct characters.
*
* For example, given s = "abcba" and k = 2,
* the longest substring with k distinct characters is "bcb".
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "template.h"
#if 0
#include <string.h>
#include <stdint.h>
#include <sys/types.h>
#endif
#if 0
int k = 2; char str[] = "abcba";
int k = 3; char str[] = "pabcbcpa";
int k = 3; char str[] = "ppbbbbpa";
int k = 2; char str[] = "ppbbbbpa";
#endif
int k = 2; char str[] = "abcba";
int hash[26];
#define INC 1
#define DEC 0
int getdistcnt(int b, int e, int distcnt, int change)
{
switch (change) {
case INC:
if((hash[str[e]]++) == 0)
distcnt++;
break;
case DEC:
if((--hash[str[b-1]]) == 0)
distcnt--;
break;
default:
break;
}
return distcnt;
}
int main (int argc, char *argv[])
{
for (int i = 0; i < 26; ++i)
hash[i] = 0;
int maxidx = strlen(str) - 1;
int b = 0, e = 0;
int ib = b, ie = e;
int distcnt = getdistcnt(b, e, 0, INC);
int maxlen = e-b+1, gap = e-b+1;
int change;
while (TRUE) {
if (distcnt <= k) {
e++;
change = INC;
} else {
b++;
change = DEC;
}
gap = e-b+1;
if (e > maxidx)
break;
if (e == maxidx && gap <= maxlen)
break;
distcnt = getdistcnt(b, e, distcnt, change);
if (distcnt <= k && gap > maxlen) {
maxlen = gap;
ib = b;
ie = e;
}
}
printf("%s <- Input\n", str);
for (int j = 0; j <= maxidx; ++j) {
if (j == ib)
printf("[");
printf("%c", str[j]);
if (j == ie)
printf("]");
}
printf(" <- Output\n");
printf("maxlen with %d distinct characters is %d. from index %d to %d\n", k, maxlen, ib, ie);
return 0;
}
|
/* $Id: //WIFI_SOC/release/SDK_4_1_0_0/source/linux-2.6.36.x/drivers/sbus/char/max1617.h#1 $ */
#ifndef _MAX1617_H
#define _MAX1617_H
#define MAX1617_AMB_TEMP 0x00 /* Ambient temp in C */
#define MAX1617_CPU_TEMP 0x01 /* Processor die temp in C */
#define MAX1617_STATUS 0x02 /* Chip status bits */
/* Read-only versions of changable registers. */
#define MAX1617_RD_CFG_BYTE 0x03 /* Config register */
#define MAX1617_RD_CVRATE_BYTE 0x04 /* Temp conversion rate */
#define MAX1617_RD_AMB_HIGHLIM 0x05 /* Ambient high limit */
#define MAX1617_RD_AMB_LOWLIM 0x06 /* Ambient low limit */
#define MAX1617_RD_CPU_HIGHLIM 0x07 /* Processor high limit */
#define MAX1617_RD_CPU_LOWLIM 0x08 /* Processor low limit */
/* Write-only versions of the same. */
#define MAX1617_WR_CFG_BYTE 0x09
#define MAX1617_WR_CVRATE_BYTE 0x0a
#define MAX1617_WR_AMB_HIGHLIM 0x0b
#define MAX1617_WR_AMB_LOWLIM 0x0c
#define MAX1617_WR_CPU_HIGHLIM 0x0d
#define MAX1617_WR_CPU_LOWLIM 0x0e
#define MAX1617_ONESHOT 0x0f
#endif /* _MAX1617_H */
|
#ifndef _I386_PGTABLE_3LEVEL_H
#define _I386_PGTABLE_3LEVEL_H
/*
* Intel Physical Address Extension (PAE) Mode - three-level page
* tables on PPro+ CPUs.
*
* Copyright (C) 1999 Ingo Molnar <mingo@redhat.com>
*/
#define pte_ERROR(e) \
printk("%s:%d: bad pte %p(%08lx%08lx).\n", __FILE__, __LINE__, &(e), (e).pte_high, (e).pte_low)
#define pmd_ERROR(e) \
printk("%s:%d: bad pmd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pmd_val(e))
#define pgd_ERROR(e) \
printk("%s:%d: bad pgd %p(%016Lx).\n", __FILE__, __LINE__, &(e), pgd_val(e))
static inline int pgd_none(pgd_t pgd) { return 0; }
static inline int pgd_bad(pgd_t pgd) { return 0; }
static inline int pgd_present(pgd_t pgd) { return 1; }
/*
* Is the pte executable?
*/
static inline int pte_x(pte_t pte)
{
return !(pte_val(pte) & _PAGE_NX);
}
/*
* All present user-pages with !NX bit are user-executable:
*/
static inline int pte_exec(pte_t pte)
{
return pte_user(pte) && pte_x(pte);
}
/*
* All present pages with !NX bit are kernel-executable:
*/
static inline int pte_exec_kernel(pte_t pte)
{
return pte_x(pte);
}
/* Rules for using set_pte: the pte being assigned *must* be
* either not present or in a state where the hardware will
* not attempt to update the pte. In places where this is
* not possible, use pte_get_and_clear to obtain the old pte
* value and then use set_pte to update it. -ben
*/
#define __HAVE_ARCH_SET_PTE_ATOMIC
#if 1
/* use writable pagetables */
static inline void set_pte(pte_t *ptep, pte_t pte)
{
mm_track(ptep); // track the old (departing) page
ptep->pte_high = pte.pte_high;
smp_wmb();
ptep->pte_low = pte.pte_low;
}
#define set_pte_atomic(pteptr,pteval) \
set_64bit((unsigned long long *)(pteptr),pte_val_ma(pteval))
#else
/* no writable pagetables */
# define set_pte(pteptr,pteval) \
xen_l1_entry_update((pteptr), (pteval))
# define set_pte_atomic(pteptr,pteval) set_pte(pteptr,pteval)
#endif
#define set_pte_at(_mm,addr,ptep,pteval) do { \
if (((_mm) != current->mm && (_mm) != &init_mm) || \
HYPERVISOR_update_va_mapping((addr), (pteval), 0)) \
set_pte((ptep), (pteval)); \
} while (0)
#define set_pte_at_sync(_mm,addr,ptep,pteval) do { \
if (((_mm) != current->mm && (_mm) != &init_mm) || \
HYPERVISOR_update_va_mapping((addr), (pteval), UVMF_INVLPG)) { \
set_pte((ptep), (pteval)); \
xen_invlpg((addr)); \
} \
} while (0)
extern void xen_l2_entry_update(pmd_t *ptr, pmd_t val);
static inline void set_pmd(pmd_t *pmdptr, pmd_t pmd)
{
mm_track(pmdptr); /* track the old page */
xen_l2_entry_update((pmdptr), (pmd));
}
#define set_pgd(pgdptr,pgdval) \
xen_l3_entry_update((pgdptr), (pgdval))
/*
* Pentium-II erratum A13: in PAE mode we explicitly have to flush
* the TLB via cr3 if the top-level pgd is changed...
* We do not let the generic code free and clear pgd entries due to
* this erratum.
*/
static inline void pgd_clear (pgd_t * pgd) { }
#define pgd_page(pgd) \
((unsigned long) __va(pgd_val(pgd) & PAGE_MASK))
/* Find an entry in the second-level page table.. */
#define pmd_offset(dir, address) ((pmd_t *) pgd_page(*(dir)) + \
pmd_index(address))
/*
* For PTEs and PDEs, we must clear the P-bit first when clearing a page table
* entry, so clear the bottom half first and enforce ordering with a compiler
* barrier.
*/
static inline void pte_clear(pte_t *ptep)
{
ptep->pte_low = 0;
smp_wmb();
ptep->pte_high = 0;
}
static inline pte_t ptep_get_and_clear(pte_t *ptep)
{
pte_t res;
mm_track(ptep); // track old page before losing this reference
/* xchg acts as a barrier before the setting of the high bits */
res.pte_low = xchg(&ptep->pte_low, 0);
res.pte_high = ptep->pte_high;
ptep->pte_high = 0;
return res;
}
static inline int pte_same(pte_t a, pte_t b)
{
return a.pte_low == b.pte_low && a.pte_high == b.pte_high;
}
#define pte_page(x) pfn_to_page(pte_pfn(x))
static inline int pte_none(pte_t pte)
{
return !pte.pte_low && !pte.pte_high;
}
#define __pte_mfn(_pte) (((_pte).pte_low >> PAGE_SHIFT) | \
((_pte).pte_high << (32-PAGE_SHIFT)))
#define pte_mfn(_pte) ((_pte).pte_low & _PAGE_PRESENT ? \
__pte_mfn(_pte) : pfn_to_mfn(__pte_mfn(_pte)))
#define pte_pfn(_pte) ((_pte).pte_low & _PAGE_PRESENT ? \
mfn_to_local_pfn(__pte_mfn(_pte)) : __pte_mfn(_pte))
extern unsigned long long __supported_pte_mask;
static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
{
return __pte((((unsigned long long)page_nr << PAGE_SHIFT) |
pgprot_val(pgprot)) & __supported_pte_mask);
}
static inline pmd_t pfn_pmd(unsigned long page_nr, pgprot_t pgprot)
{
return __pmd((((unsigned long long)page_nr << PAGE_SHIFT) |
pgprot_val(pgprot)) & __supported_pte_mask);
}
/*
* Bits 0, 6 and 7 are taken in the low part of the pte,
* put the 32 bits of offset into the high part.
*/
#define pte_to_pgoff(pte) ((pte).pte_high)
#define pgoff_to_pte(off) ((pte_t) { _PAGE_FILE, (off) })
#define PTE_FILE_MAX_BITS 32
/* Encode and de-code a swap entry */
#define __swp_type(x) (((x).val) & 0x1f)
#define __swp_offset(x) ((x).val >> 5)
#define __swp_entry(type, offset) ((swp_entry_t){(type) | (offset) << 5})
#define __pte_to_swp_entry(pte) ((swp_entry_t){ (pte).pte_high })
#define __swp_entry_to_pte(x) ((pte_t){ 0, (x).val })
#endif /* _I386_PGTABLE_3LEVEL_H */
|
/*****************************************************************************
* PreviewWidget: Main preview widget
*****************************************************************************
* Copyright (C) 2008-2014 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
*
* 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 PREVIEWWIDGET_H
#define PREVIEWWIDGET_H
#include <QWidget>
#include "Workflow/MainWorkflow.h"
class GenericRenderer;
class RendererEventWatcher;
namespace Ui {
class PreviewWidget;
}
class PreviewWidget : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY( PreviewWidget )
public:
explicit PreviewWidget( QWidget* parent = NULL );
virtual ~PreviewWidget();
const GenericRenderer* getGenericRenderer() const;
void setRenderer( GenericRenderer *renderer );
/**
* @brief setClipEdition Allows to enable/disable markers & create clip buttons
*/
void setClipEdition( bool enable );
private:
Ui::PreviewWidget* m_ui;
GenericRenderer* m_renderer;
bool m_previewStopped;
protected:
virtual void changeEvent( QEvent *e );
public slots:
void stop();
private slots:
void on_pushButtonPlay_clicked();
void on_pushButtonStop_clicked();
void on_pushButtonNextFrame_clicked();
void on_pushButtonPreviousFrame_clicked();
void frameChanged( qint64, Vlmc::FrameChangedReason reason );
void videoPaused();
void videoPlaying();
void videoStopped();
void volumeChanged();
void updateVolume( int );
void markerStartClicked();
void markerStopClicked();
void createNewClipFromMarkers();
void error();
};
#endif // PREVIEWWIDGET_H
|
/* Copyright 2001 Jeff Dike and others
* Licensed under the GPL
*/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include <net/if.h>
#include <sys/un.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/uio.h>
#include <linux/if_tun.h>
#include "host.h"
#include "output.h"
static int do_tuntap_up(char *gate_addr, struct output *output,
struct ifreq *ifr)
{
int tap_fd;
char *ifconfig_argv[] = { "ifconfig", ifr->ifr_name, gate_addr, "netmask",
"255.255.255.255", "up", NULL };
char *insmod_argv[] = { "modprobe", "tun", NULL };
if(setreuid(0, 0) < 0){
output_errno(output, "setreuid to root failed : ");
return(-1);
}
/* XXX hardcoded dir name and perms */
umask(0);
mkdir("/dev/net", 0755);
/* #includes for MISC_MAJOR and TUN_MINOR bomb in userspace */
mk_node("/dev/net/tun", 10, 200);
do_exec(insmod_argv, 0, output);
if((tap_fd = open("/dev/net/tun", O_RDWR)) < 0){
output_errno(output, "Opening /dev/net/tun failed : ");
return(-1);
}
memset(ifr, 0, sizeof(*ifr));
ifr->ifr_flags = IFF_TAP | IFF_NO_PI;
ifr->ifr_name[0] = '\0';
if(ioctl(tap_fd, TUNSETIFF, (void *) ifr) < 0){
output_errno(output, "TUNSETIFF : ");
return(-1);
}
if((*gate_addr != '\0') && do_exec(ifconfig_argv, 1, output))
return(-1);
forward_ip(output);
return(tap_fd);
}
static void tuntap_up(int fd, int argc, char **argv)
{
struct ifreq ifr;
struct msghdr msg;
struct cmsghdr *cmsg;
struct output output = INIT_OUTPUT;
struct iovec iov[2];
int tap_fd, *fd_ptr;
char anc[CMSG_SPACE(sizeof(tap_fd))];
char *gate_addr;
msg.msg_control = NULL;
msg.msg_controllen = 0;
iov[0].iov_base = NULL;
iov[0].iov_len = 0;
if(argc < 1){
add_output(&output, "Too few arguments to tuntap_up\n", -1);
goto out;
}
gate_addr = argv[0];
if((tap_fd = do_tuntap_up(gate_addr, &output, &ifr)) > 0){
iov[0].iov_base = ifr.ifr_name;
iov[0].iov_len = IFNAMSIZ;
msg.msg_control = anc;
msg.msg_controllen = sizeof(anc);
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_level = SOL_SOCKET;
cmsg->cmsg_type = SCM_RIGHTS;
cmsg->cmsg_len = CMSG_LEN(sizeof(tap_fd));
msg.msg_controllen = cmsg->cmsg_len;
fd_ptr = (int *) CMSG_DATA(cmsg);
*fd_ptr = tap_fd;
}
out:
iov[1].iov_base = output.buffer;
iov[1].iov_len = output.used;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = iov;
msg.msg_iovlen = sizeof(iov)/sizeof(iov[0]);
msg.msg_flags = 0;
if(sendmsg(fd, &msg, 0) < 0){
perror("sendmsg");
exit(1);
}
}
void tuntap_v2(int argc, char **argv)
{
char *op = argv[0];
if(!strcmp(op, "up")) tuntap_up(atoi(argv[2]), argc - 3, argv + 3);
else if(!strcmp(op, "add") || !strcmp(op, "del"))
change_addr(argv[1], argv[2], argv[3], NULL, NULL);
else {
fprintf(stderr, "Bad tuntap op : '%s'\n", op);
exit(1);
}
}
void tuntap_v3(int argc, char **argv)
{
char *op = argv[0];
struct output output = INIT_OUTPUT;
if(!strcmp(op, "up")) tuntap_up(1, argc - 2, argv + 2);
else if(!strcmp(op, "add") || !strcmp(op, "del"))
change_addr(op, argv[1], argv[2], NULL, &output);
else {
fprintf(stderr, "Bad tuntap op : '%s'\n", op);
exit(1);
}
write_output(1, &output);
}
void tuntap_v4(int argc, char **argv)
{
char *op;
struct output output = INIT_OUTPUT;
if(argc < 1){
add_output(&output, "uml_net : too few arguments to tuntap_v4\n", -1);
write_output(1, &output);
exit(1);
}
op = argv[0];
if(!strcmp(op, "up")) tuntap_up(1, argc - 1, argv + 1);
else if(!strcmp(op, "add") || !strcmp(op, "del")){
if(argc < 4)
add_output(&output, "uml_net : too few arguments to tuntap "
"change_addr\n", -1);
else change_addr(op, argv[1], argv[2], argv[3], &output);
write_output(1, &output);
}
else {
fprintf(stderr, "Bad tuntap op : '%s'\n", op);
exit(1);
}
}
|
/* 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 omac_done.c
OMAC1 support, terminate a stream, Tom St Denis
*/
#ifdef LTC_OMAC
/**
Terminate an OMAC stream
@param omac The OMAC state
@param out [out] Destination for the authentication tag
@param outlen [in/out] The max size and resulting size of the authentication tag
@return CRYPT_OK if successful
*/
int omac_done(omac_state *omac, unsigned char *out, unsigned long *outlen)
{
int err, mode;
unsigned x;
LTC_ARGCHK(omac != NULL);
LTC_ARGCHK(out != NULL);
LTC_ARGCHK(outlen != NULL);
if ((err = cipher_is_valid(omac->cipher_idx)) != CRYPT_OK) {
return err;
}
if ((omac->buflen > (int)sizeof(omac->block)) || (omac->buflen < 0) ||
(omac->blklen > (int)sizeof(omac->block)) || (omac->buflen > omac->blklen)) {
return CRYPT_INVALID_ARG;
}
/* figure out mode */
if (omac->buflen != omac->blklen) {
/* add the 0x80 byte */
omac->block[omac->buflen++] = 0x80;
/* pad with 0x00 */
while (omac->buflen < omac->blklen) {
omac->block[omac->buflen++] = 0x00;
}
mode = 1;
} else {
mode = 0;
}
/* now xor prev + Lu[mode] */
for (x = 0; x < (unsigned)omac->blklen; x++) {
omac->block[x] ^= omac->prev[x] ^ omac->Lu[mode][x];
}
/* encrypt it */
if ((err = cipher_descriptor[omac->cipher_idx].ecb_encrypt(omac->block, omac->block, &omac->key)) != CRYPT_OK) {
return err;
}
cipher_descriptor[omac->cipher_idx].done(&omac->key);
/* output it */
for (x = 0; x < (unsigned)omac->blklen && x < *outlen; x++) {
out[x] = omac->block[x];
}
*outlen = x;
#ifdef LTC_CLEAN_STACK
zeromem(omac, sizeof(*omac));
#endif
return CRYPT_OK;
}
#endif
/* ref: $Format:%D$ */
/* git commit: $Format:%H$ */
/* commit time: $Format:%ai$ */
|
/*
Spassus2 is a free game (and powerfull engine) for Casio calculators
Copyright (C) 2016 Hugo KUENY
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 _NETWORK_SOCKET_H
#define _NETWORK_SOCKET_H
#include "memory/Buffer.h"
enum NETWORK_SOCKET_RESULT{
NETWORK_SOCKET_OK = 0,
NETWORK_SOCKET_OUT_OF_BUFFER,
NETWORK_SOCKET_ERROR,
};
class NetworkSocket{
protected:
bool isConnected = false;
bool autoReconnect = true;
public:
virtual NETWORK_SOCKET_RESULT writeOut(Buffer * toSend) = 0;
virtual NETWORK_SOCKET_RESULT readIn(Buffer * inputBuffer) = 0;
virtual unsigned int getWaitingSize() = 0;
virtual NETWORK_SOCKET_RESULT disconnect(bool doNotWaitForData) = 0;
virtual NETWORK_SOCKET_RESULT connect() = 0;
};
#endif
|
/* Copyright (c) Mark J. Kilgard, 1994. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
/* Exercise all the GLUT shapes. */
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
#include <windows.h>
#define sleep(x) Sleep(1000 * x)
#else
#include <unistd.h>
#endif
#include <GL/glut.h>
GLfloat light_diffuse[] =
{1.0, 0.0, 0.0, 1.0};
GLfloat light_position[] =
{1.0, 1.0, 1.0, 0.0};
void
displayFunc(void)
{
static int shape = 1;
fprintf(stderr, " %d", shape);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
switch (shape) {
case 1:
glutWireSphere(1.0, 20, 20);
break;
case 2:
glutSolidSphere(1.0, 20, 20);
break;
case 3:
glutWireCone(1.0, 1.0, 20, 20);
break;
case 4:
glutSolidCone(1.0, 1.0, 20, 20);
break;
case 5:
glutWireCube(1.0);
break;
case 6:
glutSolidCube(1.0);
break;
case 7:
glutWireTorus(0.5, 1.0, 15, 15);
break;
case 8:
glutSolidTorus(0.5, 1.0, 15, 15);
break;
case 9:
glutWireDodecahedron();
break;
case 10:
glutSolidDodecahedron();
break;
case 11:
glutWireTeapot(1.0);
break;
case 12:
glutSolidTeapot(1.0);
break;
case 13:
glutWireOctahedron();
break;
case 14:
glutSolidOctahedron();
break;
case 15:
glutWireTetrahedron();
break;
case 16:
glutSolidTetrahedron();
break;
case 17:
glutWireIcosahedron();
break;
case 18:
glutSolidIcosahedron();
break;
default:
printf("\nPASS: test16\n");
exit(0);
}
glutSwapBuffers();
shape += 1;
sleep(1);
glutPostRedisplay();
}
/* ARGSUSED */
void
timefunc(int value)
{
printf("\nFAIL: test16\n");
exit(1);
}
int
main(int argc, char **argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGB);
glutCreateWindow("test16");
glutDisplayFunc(displayFunc);
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_DEPTH_TEST);
glMatrixMode(GL_PROJECTION);
gluPerspective( /* field of view in degree */ 22.0,
/* aspect ratio */ 1.0,
/* Z near */ 1.0, /* Z far */ 10.0);
glMatrixMode(GL_MODELVIEW);
gluLookAt(0.0, 0.0, 5.0, /* eye is at (0,0,5) */
0.0, 0.0, 0.0, /* center is at (0,0,0) */
0.0, 1.0, 0.); /* up is in postivie Y direction */
glTranslatef(0.0, 0.0, -3.0);
glRotatef(25, 1.0, 0.0, 0.0);
/* Have a reasonably large timeout since some machines make
take a while to render all those polygons. */
glutTimerFunc(35000, timefunc, 1);
fprintf(stderr, "shape =");
glutMainLoop();
return 0; /* ANSI C requires main to return int. */
}
|
#ifndef EXITPANEL_H
#define EXITPANEL_H
#include "../../gui/panel.h"
using namespace std;
class Exitpanel : public Panel
{
public:
Exitpanel();
~Exitpanel();
private:
};
#endif
|
#include "queue.h"
struct qmessage genrandmessage(){
int i;
struct qmessage ret;
i=rand()%10;
strcpy(ret.text,getmesstext(i)); //Установка текста сообщения
ret.delay=rand()%200000+400000;
strcpy(ret.iface,"IFACE");
return ret;
}
|
#include <stddef.h>
struct ether_addr;
int macstr_from_ea(struct ether_addr *ea, char *s, size_t len);
void macstr_from_uint8t(const uint8_t *mac, char *s, size_t len);
|
/***************************************************************
*
* (C) 2011-16 Nicola Bonelli <nicola@pfq.io>
*
* 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.
*
* The full GNU General Public License is included in this distribution in
* the file called "COPYING".
*
****************************************************************/
#include <pfq/percpu.h>
#include <pfq/qbuff.h>
#include <pfq/percpu.h>
#include <pfq/qbuff.h>
#include <pfq/memory.h>
#include <pfq/define.h>
int pfq_percpu_alloc(void)
{
global->percpu_data = alloc_percpu(struct pfq_percpu_data);
if (!global->percpu_data) {
printk(KERN_ERR "[PFQ] could not allocate percpu data!\n");
return -ENOMEM;
}
global->percpu_pool = alloc_percpu(struct pfq_percpu_pool);
if (!global->percpu_pool) {
printk(KERN_ERR "[PFQ] could not allocate percpu pool!\n");
goto err1;
}
global->percpu_stats = alloc_percpu(pfq_global_stats_t);
if (!global->percpu_stats) {
printk(KERN_ERR "[PFQ] could not allocate percpu stats!\n");
goto err2;
}
global->percpu_memory = alloc_percpu(struct pfq_memory_stats);
if (!global->percpu_memory) {
printk(KERN_ERR "[PFQ] could not allocate percpu memory stats!\n");
goto err3;
}
printk(KERN_INFO "[PFQ] number of online cpus %d\n", num_online_cpus());
return 0;
free_percpu(global->percpu_memory);
err3: free_percpu(global->percpu_stats);
err2: free_percpu(global->percpu_pool);
err1: free_percpu(global->percpu_data);
return -ENOMEM;
}
void pfq_percpu_free(void)
{
int cpu;
for_each_present_cpu(cpu) {
struct pfq_percpu_data *data = per_cpu_ptr(global->percpu_data, cpu);
pfq_free_pages(data->qbuff_queue, sizeof(struct pfq_qbuff_long_queue));
}
free_percpu(global->percpu_stats);
free_percpu(global->percpu_memory);
free_percpu(global->percpu_data);
free_percpu(global->percpu_pool);
}
int pfq_percpu_init(void)
{
int cpu;
for_each_present_cpu(cpu)
{
struct pfq_percpu_data *data;
memset(per_cpu_ptr(global->percpu_stats, cpu), 0, sizeof(pfq_global_stats_t));
memset(per_cpu_ptr(global->percpu_memory, cpu), 0, sizeof(struct pfq_memory_stats));
preempt_disable();
data = per_cpu_ptr(global->percpu_data, cpu);
data->counter = 0;
data->qbuff_queue = pfq_malloc_pages(sizeof(struct pfq_qbuff_long_queue), GFP_KERNEL);
if (!data->qbuff_queue)
return -ENOMEM;
data->qbuff_queue->len = 0;
preempt_enable();
}
return 0;
}
int pfq_percpu_qbuff_queue_reset(void)
{
int cpu;
int total = 0;
/* destroy prefetch queues (of each cpu) */
for_each_present_cpu(cpu) {
struct pfq_percpu_data *data;
struct pfq_percpu_pool *pool;
struct qbuff *buff;
size_t n;
preempt_disable();
data = per_cpu_ptr(global->percpu_data, cpu);
pool = per_cpu_ptr(global->percpu_pool, cpu);
for(n = 0; n < data->qbuff_queue->len; n++)
{
buff = &data->qbuff_queue->queue[n];
pfq_free_skb_pool(QBUFF_SKB(buff), &pool->rx);
}
total += data->qbuff_queue->len;
data->qbuff_queue->len = 0;
preempt_enable();
}
sparse_add(global->percpu_stats, lost, total);
return total;
}
int pfq_percpu_destruct(void)
{
int cpu;
int total = 0;
/* destroy prefetch queues (of each cpu) */
for_each_present_cpu(cpu) {
struct pfq_percpu_data *data;
preempt_disable();
data = per_cpu_ptr(global->percpu_data, cpu);
total += data->qbuff_queue->len;
data->qbuff_queue->len = 0;
preempt_enable();
}
sparse_add(global->percpu_stats, lost, total);
return total;
}
|
/******************************************************************************
errorhandler.c for Allmogetracker
Allmogetracker receives data from a GPS receiver and transmits it
over amature radio using the APRS protocol version 1.0.
Copyright (C)2011, Andreas Kingbäck (andki234@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 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 <avr/wdt.h>
#include "errorhandler.h"
#include "StdDefines.h"
#include "config.h"
#include "led.h"
#define CW_BASE_DELAY (uint32_t)200000
#define CW_SHORT_DELAY CW_BASE_DELAY * 1
#define CW_LONG_DELAY CW_BASE_DELAY * 3
#define CW_LETTER_SPACE_DELAY CW_BASE_DELAY * 5
#define CW_WORD_SPACE_DELAY CW_BASE_DELAY * 7
typedef enum
{
NO_ERROR, NO_VALID_CALLSIGN
} T_ERROR;
typedef enum
{
CW_DI, CW_DA
} T_DOT;
/******************************************************************************/
static void _ErrDelay(uint32_t delay)
/******************************************************************************/
{
uint32_t i;
for (i = 0; i < delay; i++)
{
wdt_reset(); // Reset watchdog timer
}
}
/******************************************************************************/
static void __SendDot(T_DOT dot)
/******************************************************************************/
{
switch (dot)
{
case CW_DI:
{
LED__Set(STATLED, ON); // Status LED on
_ErrDelay(CW_SHORT_DELAY);
LED__Set(STATLED, OFF); // Status LED off
_ErrDelay(CW_SHORT_DELAY);
break;
}
case CW_DA:
{
LED__Set(STATLED, ON); // Status LED on
_ErrDelay(CW_LONG_DELAY);
LED__Set(STATLED, OFF); // Status LED off
_ErrDelay(CW_SHORT_DELAY);
break;
}
}
}
/******************************************************************************/
static void _SendLEDError(void)
/******************************************************************************/
{
// E
__SendDot(CW_DI);
_ErrDelay(CW_LETTER_SPACE_DELAY);
// R
__SendDot(CW_DI);
__SendDot(CW_DA);
__SendDot(CW_DI);
_ErrDelay(CW_LETTER_SPACE_DELAY);
// R
__SendDot(CW_DI);
__SendDot(CW_DA);
__SendDot(CW_DI);
_ErrDelay(CW_LETTER_SPACE_DELAY);
// O
__SendDot(CW_DA);
__SendDot(CW_DA);
__SendDot(CW_DA);
_ErrDelay(CW_LETTER_SPACE_DELAY);
// R
__SendDot(CW_DI);
__SendDot(CW_DA);
__SendDot(CW_DI);
_ErrDelay(CW_LETTER_SPACE_DELAY);
}
/******************************************************************************/
static void _SendLEDOK(void)
/******************************************************************************/
{
// O
__SendDot(CW_DA);
__SendDot(CW_DA);
__SendDot(CW_DA);
_ErrDelay(CW_LETTER_SPACE_DELAY);
// K
__SendDot(CW_DA);
__SendDot(CW_DI);
__SendDot(CW_DA);
}
/******************************************************************************/
bool ERROR_HANDLER__SignalError(void)
/******************************************************************************/
{
bool status;
LED__Set(STATLED, OFF); // Status LED off
_ErrDelay(CW_WORD_SPACE_DELAY);
if (!CONFIG__ValidCallsign())
{
_SendLEDError();
_ErrDelay(CW_WORD_SPACE_DELAY);
status = false;
}
else
{
_SendLEDOK();
status = true;
}
return status;
}
|
//
// OpitionTableViewCell.h
// healthfood
//
// Created by lanou on 15/6/24.
// Copyright (c) 2015年 hastar. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface OpitionTableViewCell : UITableViewCell
@property (nonatomic, retain) UIImageView *photoImage;
@property (nonatomic, retain) UILabel *titleLabel;
-(void) setAccessoryText:(NSString *)text;
@end
|
#include <linux/platform_data/usb-omap.h>
/* AM35x */
/* USB 2.0 PHY Control */
#define CONF2_PHY_GPIOMODE (1 << 23)
#define CONF2_OTGMODE (3 << 14)
#define CONF2_NO_OVERRIDE (0 << 14)
#define CONF2_FORCE_HOST (1 << 14)
#define CONF2_FORCE_DEVICE (2 << 14)
#define CONF2_FORCE_HOST_VBUS_LOW (3 << 14)
#define CONF2_SESENDEN (1 << 13)
#define CONF2_VBDTCTEN (1 << 12)
#define CONF2_REFFREQ_24MHZ (2 << 8)
#define CONF2_REFFREQ_26MHZ (7 << 8)
#define CONF2_REFFREQ_13MHZ (6 << 8)
#define CONF2_REFFREQ (0xf << 8)
#define CONF2_PHYCLKGD (1 << 7)
#define CONF2_VBUSSENSE (1 << 6)
#define CONF2_PHY_PLLON (1 << 5)
#define CONF2_RESET (1 << 4)
#define CONF2_PHYPWRDN (1 << 3)
#define CONF2_OTGPWRDN (1 << 2)
#define CONF2_DATPOL (1 << 1)
/* TI81XX specific definitions */
#define USBCTRL0 0x620
#define USBSTAT0 0x624
/* TI816X PHY controls bits */
#define TI816X_USBPHY0_NORMAL_MODE (1 << 0)
#define TI816X_USBPHY_REFCLK_OSC (1 << 8)
/* TI814X PHY controls bits */
#define USBPHY_CM_PWRDN (1 << 0)
#define USBPHY_OTG_PWRDN (1 << 1)
#define USBPHY_CHGDET_DIS (1 << 2)
#define USBPHY_CHGDET_RSTRT (1 << 3)
#define USBPHY_SRCONDM (1 << 4)
#define USBPHY_SINKONDP (1 << 5)
#define USBPHY_CHGISINK_EN (1 << 6)
#define USBPHY_CHGVSRC_EN (1 << 7)
#define USBPHY_DMPULLUP (1 << 8)
#define USBPHY_DPPULLUP (1 << 9)
#define USBPHY_CDET_EXTCTL (1 << 10)
#define USBPHY_GPIO_MODE (1 << 12)
#define USBPHY_DPOPBUFCTL (1 << 13)
#define USBPHY_DMOPBUFCTL (1 << 14)
#define USBPHY_DPINPUT (1 << 15)
#define USBPHY_DMINPUT (1 << 16)
#define USBPHY_DPGPIO_PD (1 << 17)
#define USBPHY_DMGPIO_PD (1 << 18)
#define USBPHY_OTGVDET_EN (1 << 19)
#define USBPHY_OTGSESSEND_EN (1 << 20)
#define USBPHY_DATA_POLARITY (1 << 23)
struct usbhs_phy_data {
int port; /* 1 indexed port number */
int reset_gpio;
int vcc_gpio;
bool vcc_polarity; /* 1 active high, 0 active low */
void *platform_data;
};
extern void usb_musb_init(struct omap_musb_board_data *board_data);
extern void usbhs_init(struct usbhs_omap_platform_data *pdata);
extern int usbhs_init_phys(struct usbhs_phy_data *phy, int num_phys);
extern void am35x_musb_reset(void);
extern void am35x_musb_phy_power(u8 on);
extern void am35x_musb_clear_irq(void);
extern void am35x_set_mode(u8 musb_mode);
extern void ti81xx_musb_phy_power(u8 on);
|
/*
* Inter-OS core software
*
* Copyright (C) 2007 NXP Semiconductors
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*/
#include "xos_core.h"
#include <nk/xos_ctrl.h>
#include <osware/osware.h>
#ifndef XOS_CORE_CTRL_ID
#define XOS_CORE_CTRL_ID 0x65766e74 /* evnt */
#endif /* XOS_CORE_CTRL_ID */
/**
* event descriptor.
*/
struct xos_evnt_t
{
xos_ctrl_handler_t handler;
int pending;
void * cookie;
};
/**
* local end-point descriptor.
*/
struct xos_ctrl_t
{
NkXIrq xirq;
NkOsId osid;
int rank;
};
/**
* device descriptor.
*/
struct xos_ctrl_dev_t
{
struct xos_ctrl_t ctrl[2]; /**< device end-points descriptors. */
unsigned nevt; /**< number of managed events. */
};
#define TO_VDEV(c) ( struct xos_ctrl_dev_t * ) ( (c) - (c)->rank )
#define TO_EVNT(v,i) ( ( struct xos_evnt_t * ) ( (v) + 1 ) ) + (i) * (v)->nevt
static void
xos_ctrl_handler ( void * cookie,
NkXIrq xirq )
{
struct xos_ctrl_t * self = ( struct xos_ctrl_t * ) cookie;
struct xos_ctrl_dev_t * vdev = TO_VDEV ( self );
unsigned nevt = vdev->nevt;
struct xos_evnt_t * evnt = TO_EVNT ( vdev, self->rank ) + nevt;
/* travel the events list and execute subscribed pending ones. */
while ( nevt-- > 0 )
{
evnt -= 1;
if ( evnt->pending != 0 && evnt->handler != ( void * ) 0L )
{
evnt->pending = 0;
evnt->handler ( nevt, evnt->cookie );
}
}
}
struct xos_ctrl_t *
xos_ctrl_connect ( const char * name,
unsigned nb_events )
{
const NkOsId osid = nkops.nk_id_get ( );
const int type = XOS_CORE_CTRL_ID;
struct xos_ctrl_t * self = 0;
struct xos_ctrl_dev_t * vdev = xos_core_lookup ( name, type );
if ( vdev == 0 )
{
unsigned size = nb_events * sizeof ( struct xos_evnt_t );
/* attempt to allocate a cross-interrupt. */
NkXIrq xirq = nkops.nk_xirq_alloc ( 1 );
if ( xirq == 0 )
goto bail_out;
/* shared device not found: attempt to create one. */
vdev = xos_core_create ( name, type, sizeof ( *vdev ) + 2 * size );
if ( vdev != 0 )
{
/* initialize device end-points. */
int i = 2;
while ( i-- )
{
struct xos_evnt_t * evnt = TO_EVNT ( vdev, i );
unsigned e = nb_events;
while ( e-- > 0 )
{
evnt->pending = 0;
evnt->handler = ( void * ) 0L;
evnt->cookie = ( void * ) 0L;
evnt += 1;
}
}
vdev->ctrl[0].xirq = xirq;
vdev->ctrl[0].osid = osid;
vdev->ctrl[0].rank = 0;
vdev->ctrl[1].xirq = 0;
vdev->ctrl[1].osid = 0;
vdev->ctrl[1].rank = 1;
vdev->nevt = nb_events;
self = &(vdev->ctrl[0]);
/* attach handler to the cross-interrupt. */
nkops.nk_xirq_attach ( self->xirq, xos_ctrl_handler, self );
/* make device available. */
xos_core_publish ( vdev );
}
else
goto bail_out;
}
else
{
self = &(vdev->ctrl[(vdev->ctrl[0].osid == osid ? 0 : 1)]);
if ( self->xirq == 0 )
{
/* local end-point initialization */
self->osid = osid;
self->xirq = nkops.nk_xirq_alloc ( 1 );
if ( self->xirq == 0 )
goto bail_out;
/* attach handler to the cross-interrupt. */
nkops.nk_xirq_attach ( self->xirq, xos_ctrl_handler, self );
}
}
bail_out:
return self;
}
void
xos_ctrl_register ( struct xos_ctrl_t * self,
unsigned event,
xos_ctrl_handler_t handler,
void * cookie,
int clear )
{
struct xos_ctrl_dev_t * vdev = TO_VDEV ( self );
struct xos_evnt_t * evnt = TO_EVNT ( vdev, self->rank ) + event;
/* clear pending flag is asked to. */
if ( clear )
evnt->pending = 0;
/* execute possibly already pending event. */
if ( evnt->pending && handler != ( void * ) 0L )
handler ( event, cookie );
/* register event information. */
evnt->cookie = cookie;
evnt->handler = handler;
evnt->pending = 0;
}
void
xos_ctrl_unregister ( struct xos_ctrl_t * self,
unsigned event )
{
struct xos_ctrl_dev_t * vdev = TO_VDEV ( self );
struct xos_evnt_t * evnt = TO_EVNT ( vdev, self->rank ) + event;
evnt->cookie = ( void * ) 0L;
evnt->handler = ( void * ) 0L;
}
int
xos_ctrl_raise ( struct xos_ctrl_t * self,
unsigned event )
{
struct xos_ctrl_dev_t * vdev = TO_VDEV ( self );
unsigned peer = 1 - self->rank;
struct xos_evnt_t * evnt = TO_EVNT ( vdev, peer ) + event;
int retval;
retval = evnt->handler != ( void * ) 0L;
/* mark remote event pending and trigger a cross-interrupt if
remote site subscribed the event. */
evnt->pending = 1;
if ( retval )
nkops.nk_xirq_trigger ( vdev->ctrl[peer].xirq, vdev->ctrl[peer].osid );
return retval;
}
#include <linux/module.h>
EXPORT_SYMBOL(xos_ctrl_connect);
EXPORT_SYMBOL(xos_ctrl_register);
EXPORT_SYMBOL(xos_ctrl_unregister);
EXPORT_SYMBOL(xos_ctrl_raise);
|
/*
* 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 <math.h>
#include "longdouble.h"
int main(void) {
TEST(0, 0, +, 0);
TEST(0, -1, +, 1);
TEST(1, -4, +, 5);
TEST(0, -4, +, 4);
TEST(-1, -6, +, 5);
TEST(1, 5, +, -4);
TEST(0, 5, +, -5);
TEST(-1, 5, +, -6);
TEST(13, 4, +, 9);
TEST(INFINITY, INFINITY, +, INFINITY);
}
|
#include <stdio.h>
#include <stdlib.h>
static const int MULTIPLE_MAX = 1000;
int main() {
int i, sum;
for (i = 0, sum = 0; i < MULTIPLE_MAX; ++i) {
if (i % 3 == 0 || i % 5 == 0) {
sum += i;
}
}
fprintf(stdout, "The sum of multiples of 3 or 5 is: %d\n", sum);
return EXIT_SUCCESS;
}
|
/* Target-specific definition for a Hitachi Super-H.
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
Free Software Foundation, Inc.
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 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 SH_TDEP_H
#define SH_TDEP_H
#include "osabi.h"
/* Contributed by Steve Chamberlain sac@cygnus.com */
/* Information that is dependent on the processor variant. */
enum sh_abi
{
SH_ABI_UNKNOWN,
SH_ABI_32,
SH_ABI_64
};
struct gdbarch_tdep
{
int PR_REGNUM;
int FPUL_REGNUM; /* sh3e, sh4 */
int FPSCR_REGNUM; /* sh3e, sh4 */
int SR_REGNUM; /* sh-dsp, sh3, sh3-dsp, sh3e, sh4 */
int DSR_REGNUM; /* sh-dsp, sh3-dsp */
int FP_LAST_REGNUM; /* sh3e, sh4 */
int A0G_REGNUM; /* sh-dsp, sh3-dsp */
int A0_REGNUM; /* sh-dsp, sh3-dsp */
int A1G_REGNUM; /* sh-dsp, sh3-dsp */
int A1_REGNUM; /* sh-dsp, sh3-dsp */
int M0_REGNUM; /* sh-dsp, sh3-dsp */
int M1_REGNUM; /* sh-dsp, sh3-dsp */
int X0_REGNUM; /* sh-dsp, sh3-dsp */
int X1_REGNUM; /* sh-dsp, sh3-dsp */
int Y0_REGNUM; /* sh-dsp, sh3-dsp */
int Y1_REGNUM; /* sh-dsp, sh3-dsp */
int MOD_REGNUM; /* sh-dsp, sh3-dsp */
int SSR_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */
int SPC_REGNUM; /* sh3, sh3-dsp, sh3e, sh4 */
int RS_REGNUM; /* sh-dsp, sh3-dsp */
int RE_REGNUM; /* sh-dsp, sh3-dsp */
int DR0_REGNUM; /* sh4 */
int DR_LAST_REGNUM; /* sh4 */
int FV0_REGNUM; /* sh4 */
int FV_LAST_REGNUM; /* sh4 */
/* FPP stands for Floating Point Pair, to avoid confusion with
GDB's FP0_REGNUM, which is the number of the first Floating
point register. Unfortunately on the sh5, the floating point
registers are called FR, and the floating point pairs are called FP. */
int TR7_REGNUM; /* sh5-media*/
int FPP0_REGNUM; /* sh5-media*/
int FPP_LAST_REGNUM; /* sh5-media*/
int R0_C_REGNUM; /* sh5-compact*/
int R_LAST_C_REGNUM; /* sh5-compact*/
int PC_C_REGNUM; /* sh5-compact*/
int GBR_C_REGNUM; /* sh5-compact*/
int MACH_C_REGNUM; /* sh5-compact*/
int MACL_C_REGNUM; /* sh5-compact*/
int PR_C_REGNUM; /* sh5-compact*/
int T_C_REGNUM; /* sh5-compact*/
int FPSCR_C_REGNUM; /* sh5-compact*/
int FPUL_C_REGNUM; /* sh5-compact*/
int FP0_C_REGNUM; /* sh5-compact*/
int FP_LAST_C_REGNUM; /* sh5-compact*/
int DR0_C_REGNUM; /* sh5-compact*/
int DR_LAST_C_REGNUM; /* sh5-compact*/
int FV0_C_REGNUM; /* sh5-compact*/
int FV_LAST_C_REGNUM; /* sh5-compact*/
int ARG0_REGNUM;
int ARGLAST_REGNUM;
int FLOAT_ARGLAST_REGNUM;
int RETURN_REGNUM;
enum gdb_osabi osabi; /* OS/ABI of the inferior */
enum sh_abi sh_abi;
};
/* Registers common to all the SH variants. */
enum
{
R0_REGNUM = 0,
STRUCT_RETURN_REGNUM = 2,
ARG0_REGNUM = 4, /* Used in h8300-tdep.c */
ARGLAST_REGNUM = 7, /* Used in h8300-tdep.c */
PR_REGNUM = 17, /* used in sh3-rom.c */
GBR_REGNUM = 18,
VBR_REGNUM = 19,
MACH_REGNUM = 20,
MACL_REGNUM = 21,
SR_REGNUM = 22
};
#endif /* SH_TDEP_H */
|
#include <stdio.h>
#include <unistd.h>
int main()
{
printf("First line...");
sleep(3);
printf("\nSecond Line...");
sleep(3);
printf("Third line\n");
sleep(2);
return 0;
}
|
/* Copyright (C) 1997 Aladdin Enterprises. All rights reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
For more information about licensing, please refer to
http://www.ghostscript.com/licensing/. For information on
commercial licensing, go to http://www.artifex.com/licensing/ or
contact Artifex Software, Inc., 101 Lucas Valley Road #110,
San Rafael, CA 94903, U.S.A., +1(415)492-9861.
*/
/* $Id: sfxboth.c,v 1.4 2002/02/21 22:24:54 giles Exp $ */
/* File stream implementation using both stdio and direct OS calls */
#include "sfxstdio.c"
#define KEEP_FILENO_API /* see sfxfd.c */
#include "sfxfd.c"
|
#if 0
class T {
#endif
protected:
// virtual methods
virtual QModelIndex mapFromSource ( const QModelIndex & sourceIndex ) const {
if (!m_mapFromSource)
return QOREQTYPE::mapFromSource(sourceIndex);
ExceptionSink xsink;
ReferenceHolder<QoreListNode> args(new QoreListNode, &xsink);
QoreObject *qw = new QoreObject(QC_QModelIndex, getProgram());
qw->setPrivate(CID_QMODELINDEX, new QoreQModelIndex(sourceIndex));
args->push(qw);
ReferenceHolder<AbstractQoreNode> rv(dispatch_event_intern(qore_obj, m_mapFromSource, *args, &xsink), &xsink);
if (xsink)
return QModelIndex();
QoreObject *o = rv && rv->getType() == NT_OBJECT ? reinterpret_cast<QoreObject *>(*rv) : 0;
QoreQModelIndex *qmi = o ? (QoreQModelIndex *)o->getReferencedPrivateData(CID_QMODELINDEX, &xsink) : 0;
if (!qmi) {
xsink.raiseException("MAPFROMSOURCE-ERROR", "the mapFromSource() method did not return a QModelIndex object");
return QModelIndex();
}
ReferenceHolder<QoreQModelIndex> qmiHolder(qmi, &xsink);
QModelIndex rv_qmi = *(static_cast<QModelIndex *>(qmi));
return rv_qmi;
}
virtual QModelIndex mapToSource ( const QModelIndex & proxyIndex ) const {
if (!m_mapToSource)
return QOREQTYPE::mapToSource(proxyIndex);
ExceptionSink xsink;
ReferenceHolder<QoreListNode> args(new QoreListNode, &xsink);
QoreObject *qw = new QoreObject(QC_QModelIndex, getProgram());
qw->setPrivate(CID_QMODELINDEX, new QoreQModelIndex(proxyIndex));
args->push(qw);
ReferenceHolder<AbstractQoreNode> rv(dispatch_event_intern(qore_obj, m_mapToSource, *args, &xsink), &xsink);
if (xsink)
return QModelIndex();
QoreObject *o = rv && rv->getType() == NT_OBJECT ? reinterpret_cast<QoreObject *>(*rv) : 0;
QoreQModelIndex *qmi = o ? (QoreQModelIndex *)o->getReferencedPrivateData(CID_QMODELINDEX, &xsink) : 0;
if (!qmi) {
xsink.raiseException("MAPTOSOURCE-ERROR", "the mapFromSource() method did not return a QModelIndex object");
return QModelIndex();
}
ReferenceHolder<QoreQModelIndex> qmiHolder(qmi, &xsink);
QModelIndex rv_qmi = *(static_cast<QModelIndex *>(qmi));
return rv_qmi;
}
virtual QItemSelection mapSelectionFromSource ( const QItemSelection & sourceSelection ) const {
if (!m_mapSelectionFromSource)
return QOREQTYPE::mapSelectionFromSource(sourceSelection);
ExceptionSink xsink;
ReferenceHolder<QoreListNode> args(new QoreListNode, &xsink);
QoreObject *qw = new QoreObject(QC_QItemSelection, getProgram());
qw->setPrivate(CID_QITEMSELECTION, new QoreQItemSelection(sourceSelection));
args->push(qw);
ReferenceHolder<AbstractQoreNode> rv(dispatch_event_intern(qore_obj, m_mapSelectionFromSource, *args, &xsink), &xsink);
if (xsink)
return QItemSelection();
QoreObject *o = rv && rv->getType() == NT_OBJECT ? reinterpret_cast<QoreObject *>(*rv) : 0;
QoreQItemSelection *qmi = o ? (QoreQItemSelection *)o->getReferencedPrivateData(CID_QITEMSELECTION, &xsink) : 0;
if (!qmi) {
xsink.raiseException("MAPSELECTIONFROMSOURCE-ERROR", "the mapSelectionFromSource() method did not return a QItemSelection object");
return QItemSelection();
}
ReferenceHolder<QoreQItemSelection> qmiHolder(qmi, &xsink);
QItemSelection rv_qmi = *(static_cast<QItemSelection *>(qmi));
return rv_qmi;
}
virtual QItemSelection mapSelectionToSource ( const QItemSelection & sourceSelection ) const {
if (!m_mapSelectionFromSource)
return QOREQTYPE::mapSelectionToSource(sourceSelection);
ExceptionSink xsink;
ReferenceHolder<QoreListNode> args(new QoreListNode, &xsink);
QoreObject *qw = new QoreObject(QC_QItemSelection, getProgram());
qw->setPrivate(CID_QITEMSELECTION, new QoreQItemSelection(sourceSelection));
args->push(qw);
ReferenceHolder<AbstractQoreNode> rv(dispatch_event_intern(qore_obj, m_mapSelectionToSource, *args, &xsink), &xsink);
if (xsink)
return QItemSelection();
QoreObject *o = rv && rv->getType() == NT_OBJECT ? reinterpret_cast<QoreObject *>(*rv) : 0;
QoreQItemSelection *qmi = o ? (QoreQItemSelection *)o->getReferencedPrivateData(CID_QITEMSELECTION, &xsink) : 0;
if (!qmi) {
xsink.raiseException("MAPSELECTIONTOSOURCE-ERROR", "the mapSelectionToSource() method did not return a QItemSelection object");
return QItemSelection();
}
ReferenceHolder<QoreQItemSelection> qmiHolder(qmi, &xsink);
QItemSelection rv_qmi = *(static_cast<QItemSelection *>(qmi));
return rv_qmi;
}
virtual void setSourceModel ( QAbstractItemModel * sourceModel ) {
if (!m_setSourceModel)
return QOREQTYPE::setSourceModel(sourceModel);
ExceptionSink xsink;
ReferenceHolder<QoreListNode> args(new QoreListNode, &xsink);
QoreObject *qw = new QoreObject(QC_QAbstractItemModel, getProgram());
qw->setPrivate(CID_QABSTRACTITEMMODEL, new QoreQAbstractItemModel(qw, sourceModel));
args->push(qw);
ReferenceHolder<AbstractQoreNode> rv(dispatch_event_intern(qore_obj, m_setSourceModel, *args, &xsink), &xsink);
}
#if 0
}
#endif
#undef PARENT_IS_PRIVATE
#undef HASCHILDREN_IS_PRIVATE
|
/**
* Mupen64 - exception.h
* Copyright (C) 2002 Hacktarux
*
* Mupen64 homepage: http://mupen64.emulation64.com
* email address: hacktarux@yahoo.fr
*
* If you want to contribute to the project please contact
* me first (maybe someone is already making what you are
* planning to do).
*
*
* This program is free software; you can redistribute it and/
* or modify it under the terms of the GNU General Public Li-
* cence as published by the Free Software Foundation; either
* version 2 of the Licence, or any later version.
*
* This program is distributed in the hope that it will be use-
* ful, but WITHOUT ANY WARRANTY; without even the implied war-
* ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public Licence for more details.
*
* You should have received a copy of the GNU General Public
* Licence along with this program; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
* USA.
*
**/
#ifndef EXCEPTION_H
#define EXCEPTION_H
#include "../main/winlnxdefs.h"
void address_error_exception();
void TLB_invalid_exception();
void TLB_refill_exception(u32 addresse, int w);
void TLB_mod_exception();
void integer_overflow_exception();
void coprocessor_unusable_exception();
void exception_general();
#endif
|
#include "temp.h"
void load_TEMP () {
fprintf(stdout, "Loading TEMP\n");
int theta_id;
//perturbation potential temperature (theta-t0)
nc_error(nc_inq_varid (wrfout_id, "T", &theta_id));
wTHETA = malloc (wN3D * sizeof(float));
if (wTHETA==NULL) {fprintf(stderr, "temp.c : Cannot allocate wTHETA\n"); exit(-1);}
wTEMP = malloc (wN3D * sizeof(float));
if (wTEMP==NULL) {fprintf(stderr, "temp.c : Cannot allocate wTEMP\n"); exit(-1);}
wTK = malloc (wN3D * sizeof(float));
if (wTK==NULL) {fprintf(stderr, "temp.c : Cannot allocate wTK\n"); exit(-1);}
nc_error(nc_get_var_float(wrfout_id, theta_id, wTHETA));
double p1000mb = 100000.;
double r_d = 287.;
double cp = 7.*r_d/2.;
double pi;
int i;
#pragma omp parallel for private(i)
for (i=0; i<wN3D; i++) {
wTHETA[i] += 300;
pi = pow( (wPRESS[i]*100/p1000mb), (r_d/cp) );
wTK[i] = pi*wTHETA[i];
wTEMP[i] = wTK[i] - 273.16;
}
wTEMP_A = malloc (wN2D * ip_nALEVELS * sizeof(float));
if (wTEMP_A==NULL) {fprintf(stderr, "rh.c : Cannot allocate wTEMP_A\n"); exit(-1);}
wTEMP_P = malloc (wN2D * ip_nPLEVELS * sizeof(float));
if (wTEMP_P==NULL) {fprintf(stderr, "rh.c : Cannot allocate wTEMP_P\n"); exit(-1);}
#pragma omp parallel for private(i)
for (i=0; i<ip_nALEVELS; i++) {
interpolate_3d_z (wTEMP, ip_ALEVELS[i], wHEIGHT, &wTEMP_A[wN2D*i]);
}
#pragma omp parallel for private(i)
for (i=0; i<ip_nPLEVELS; i++) {
interpolate_3d_z (wTEMP, ip_PLEVELS[i], wPRESS, &wTEMP_P[wN2D*i]);
}
}
void write_TEMP () {
fprintf(stdout, "Writing TEMP\n");
nc_error(nc_put_var_float(ncout_ID, idTEMP, wTEMP));
nc_error(nc_put_var_float(ncout_ID, idTEMP_A, wTEMP_A));
nc_error(nc_put_var_float(ncout_ID, idTEMP_P, wTEMP_P));
}
void set_meta_TEMP () {
ncout_def_var_float("temp", 3, ncout_3D_DIMS, &idTEMP);
ncout_def_var_float("temp_a", 3, ncout_3DA_DIMS, &idTEMP_A);
ncout_def_var_float("temp_p", 3, ncout_3DP_DIMS, &idTEMP_P);
ncout_set_meta (idTEMP, "long_name", "air_temperature");
ncout_set_meta (idTEMP, "standard_name", "air_temperature");
ncout_set_meta (idTEMP, "description", "");
ncout_set_meta (idTEMP, "reference", "http://doc.omd.li/wrfpp/temp");
ncout_set_meta (idTEMP, "units", "degree_Celsius");
ncout_set_meta (idTEMP, "coordinates", "model_level lon lat");
ncout_set_meta (idTEMP_A, "long_name", "air_temperature_on_altitude_level");
ncout_set_meta (idTEMP_A, "standard_name", "air_temperature");
ncout_set_meta (idTEMP_A, "description", "air temperature, interpolated to altitude levels");
ncout_set_meta (idTEMP_A, "reference", "http://doc.omd.li/wrfpp/temp_a");
ncout_set_meta (idTEMP_A, "units", "degree_Celsius");
ncout_set_meta (idTEMP_A, "coordinates", "alti_level lon lat");
ncout_set_meta (idTEMP_P, "long_name", "air_temperature_on_pressure_level");
ncout_set_meta (idTEMP_P, "standard_name", "air_temperature");
ncout_set_meta (idTEMP_P, "description", "air temperature, interpolated to pressure levels");
ncout_set_meta (idTEMP_P, "reference", "http://doc.omd.li/wrfpp/temp_p");
ncout_set_meta (idTEMP_P, "units", "degree_Celsius");
ncout_set_meta (idTEMP_P, "coordinates", "press_level lon lat");
}
void free_TEMP () {
free (wTEMP);
free (wTEMP_A);
free (wTEMP_P);
free (wTHETA);
free (wTK);
}
|
# include <stdio.h>
void mycpy(const char * source, char * dest) {
int i = 0;
while (source[i] != '\0')
dest[i++] = source[i];
dest[i] = 0;
}
void main(void)
{
char str[100];
mycpy("desserts I",str); printf("%s\n", str);
mirror(str); printf("%s\n", str);
mirror(str); printf("%s\n", str);
}
|
// -*-c++-*-
/* $Id$ */
#ifndef _LIBTAME_TAME_EVENT_H_
#define _LIBTAME_TAME_EVENT_H_
#include "refcnt.h"
#include "vec.h"
#include "init.h"
#include "async.h"
#include "list.h"
#include "tame_slotset.h"
#include "tame_run.h"
// Specify 1 extra argument, that way we can do template specialization
// elsewhere. We should never have an instatiated event class with
// 4 templated types, though.
template<class T1=void, class T2=void, class T3=void, class T4=void>
class _event;
class _event_cancel_base : public virtual refcount {
public:
_event_cancel_base (const char *loc) :
_loc (loc),
_cancelled (false),
_cleared (false),
_reuse (false),
_performing (false)
{ g_stats->did_mkevent (); }
~_event_cancel_base () {}
void set_cancel_notifier (ptr<_event<> > e) { _cancel_notifier = e; }
void cancel ();
const char *loc () const { return _loc; }
bool cancelled () const { return _cancelled; }
operator bool() const { return is_alive (); }
bool is_alive () const
{ return (!_cancelled && (_reuse || !_performing) && !_cleared); }
void set_reuse (bool b) { _reuse = b; }
bool get_reuse () const { return _reuse; }
bool can_trigger ()
{
bool ret = false;
if (_cancelled) {
if (tame_strict_mode ())
tame_error (_loc, "event triggered after it was cancelled");
} else if (_performing && !_reuse) {
tame_error (_loc, "event triggered recursively");
} else if (_cleared) {
tame_error (_loc, "event triggered after it was cleared");
} else {
ret = true;
}
return ret;
}
void trigger_no_assign ()
{
if (can_trigger ()) {
ptr<_event_cancel_base> hold (mkref (this));
_performing = true;
if (perform_action (this, _loc, _reuse)) {
_cleared = true;
}
_performing = false;
}
}
void finish () { clear (); }
list_entry<_event_cancel_base> _lnk;
protected:
virtual bool perform_action (_event_cancel_base *e, const char *loc,
bool reuse) = 0;
virtual void clear_action () = 0;
void clear ();
const char *_loc;
bool _cancelled;
bool _cleared;
bool _reuse;
bool _performing;
ptr<_event<> > _cancel_notifier;
};
#ifdef TAME_DETEMPLATIZE
class tame_action {
public:
tame_action () {}
virtual ~tame_action () {}
virtual bool perform (_event_cancel_base *event,
const char *loc, bool _reuse) = 0;
virtual void clear (_event_cancel_base *e) = 0;
};
#endif /* TAME_DETEMPLATIZE */
typedef ptr<_event_cancel_base> _event_hold_t;
typedef list<_event_cancel_base, &_event_cancel_base::_lnk>
event_cancel_list_t;
void report_leaks (event_cancel_list_t *lst);
template<
#ifndef TAME_DETEMPLATIZE
class A,
#endif /* TAME_DETEMPLATIZE */
class T1=void, class T2=void, class T3=void, class T4=void>
class _event_impl;
template<class T1=void, class T2=void, class T3=void>
class event {
public:
typedef struct ref<_event<T1,T2,T3> > ref;
typedef struct ptr<_event<T1,T2,T3> > ptr;
};
#ifdef WRAP_DEBUG
# define CALLBACK_ARGS(x) "???", x, x
# else
# define CALLBACK_ARGS(x)
#endif
#define mkevent(...) _mkevent (__cls_g, __FL__, __cls_type, ##__VA_ARGS__)
#define mkevent_rs(...) _mkevent_rs (__cls_g, __FL__, __cls_type, ##__VA_ARGS__)
#endif /* _LIBTAME_TAME_EVENT_H_ */
|
/*
* 16.1.3 Wait for Thread Termination, P1003.1c/Draft 10, p. 147
*
* COPYRIGHT (c) 1989-2007.
* 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.
*
* $Id: pthreadjoin.c,v 1.8 2007/11/30 20:34:13 humph Exp $
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <pthread.h>
#include <errno.h>
#include <rtems/system.h>
#include <rtems/score/thread.h>
#include <rtems/posix/pthread.h>
int pthread_join(
pthread_t thread,
void **value_ptr
)
{
register Thread_Control *the_thread;
POSIX_API_Control *api;
Objects_Locations location;
void *return_pointer;
the_thread = _POSIX_Threads_Get( thread, &location );
switch ( location ) {
case OBJECTS_LOCAL:
api = the_thread->API_Extensions[ THREAD_API_POSIX ];
if ( api->detachstate == PTHREAD_CREATE_DETACHED ) {
_Thread_Enable_dispatch();
return EINVAL;
}
if ( _Thread_Is_executing( the_thread ) ) {
_Thread_Enable_dispatch();
return EDEADLK;
}
/*
* Put ourself on the threads join list
*/
_Thread_Executing->Wait.return_argument = &return_pointer;
_Thread_queue_Enter_critical_section( &api->Join_List );
_Thread_queue_Enqueue( &api->Join_List, WATCHDOG_NO_TIMEOUT );
_Thread_Enable_dispatch();
if ( value_ptr )
*value_ptr = return_pointer;
return 0;
#if defined(RTEMS_MULTIPROCESSING)
case OBJECTS_REMOTE:
#endif
case OBJECTS_ERROR:
break;
}
return ESRCH;
}
|
/* Copyright (c) Mark J. Kilgard, 1996, 1997. */
/* This program is freely distributable without licensing fees
and is provided without guarantee or warrantee expressed or
implied. This program is -not- in the public domain. */
/* Test glutExtensionSupported. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <GL/glut.h>
void
wrangleExtensionName(char *extension)
{
char buffer[512];
int rc, len;
sprintf(buffer, " %s", extension);
rc = glutExtensionSupported(buffer);
if (rc) {
printf("FAIL: test20, space prefix\n");
exit(1);
}
sprintf(buffer, "%s ", extension);
rc = glutExtensionSupported(buffer);
if (rc) {
printf("FAIL: test20, space suffix\n");
exit(1);
}
sprintf(buffer, "GL_%s", extension);
rc = glutExtensionSupported(buffer);
if (rc) {
printf("FAIL: test20, GL_ prefix\n");
exit(1);
}
sprintf(buffer, "%s", extension + 1);
rc = glutExtensionSupported(buffer);
if (rc) {
printf("FAIL: test20, missing first character\n");
exit(1);
}
sprintf(buffer, "%s", extension);
len = (int) strlen(buffer);
if(len > 0) {
buffer[len-1] = '\0';
}
rc = glutExtensionSupported(buffer);
if (rc) {
printf("FAIL: test20, mising last character\n");
exit(1);
}
sprintf(buffer, "%s", extension);
len = (int) strlen(buffer);
if(len > 0) {
buffer[len-1] = 'X';
}
rc = glutExtensionSupported(buffer);
if (rc) {
printf("FAIL: test20, changed last character\n");
exit(1);
}
}
int
main(int argc, char **argv)
{
char *extension;
int rc;
glutInit(&argc, argv);
glutCreateWindow("test20");
extension = "GL_EXT_blend_color";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_abgr";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_blend_minmax";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_blend_logic_op";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_blend_subtract";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_polygon_offset";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_subtexture";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_texture";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_EXT_texture_object";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
extension = "GL_SGIX_framezoom";
rc = glutExtensionSupported(extension);
printf("Extension %s is %s by your OpenGL.\n", extension, rc ? "SUPPORTED" : "NOT supported");
if (rc) wrangleExtensionName(extension);
rc = glutExtensionSupported("");
if (rc) {
printf("FAIL: test20, null string\n");
exit(1);
}
printf("PASS: test20\n");
return 0; /* ANSI C requires main to return int. */
}
|
#ifndef _UAPIBLKTRACE_H
#define _UAPIBLKTRACE_H
#include <linux/types.h>
/*
* Trace categories
*/
enum blktrace_cat {
BLK_TC_READ = 1 << 0, /* reads */
BLK_TC_WRITE = 1 << 1, /* writes */
BLK_TC_FLUSH = 1 << 2, /* flush */
BLK_TC_SYNC = 1 << 3, /* sync IO */
BLK_TC_SYNCIO = BLK_TC_SYNC,
BLK_TC_QUEUE = 1 << 4, /* queueing/merging */
BLK_TC_REQUEUE = 1 << 5, /* requeueing */
BLK_TC_ISSUE = 1 << 6, /* issue */
BLK_TC_COMPLETE = 1 << 7, /* completions */
BLK_TC_FS = 1 << 8, /* fs requests */
BLK_TC_PC = 1 << 9, /* pc requests */
BLK_TC_NOTIFY = 1 << 10, /* special message */
BLK_TC_AHEAD = 1 << 11, /* readahead */
BLK_TC_META = 1 << 12, /* metadata */
BLK_TC_DISCARD = 1 << 13, /* discard requests */
BLK_TC_DRV_DATA = 1 << 14, /* binary per-driver data */
BLK_TC_FUA = 1 << 15, /* fua requests */
BLK_TC_END = 1 << 15, /* we've run out of bits! */
};
#define BLK_TC_SHIFT (16)
#define BLK_TC_ACT(act) ((act) << BLK_TC_SHIFT)
/*
* Basic trace actions
*/
enum blktrace_act {
__BLK_TA_QUEUE = 1, /* queued */
__BLK_TA_BACKMERGE, /* back merged to existing rq */
__BLK_TA_FRONTMERGE, /* front merge to existing rq */
__BLK_TA_GETRQ, /* allocated new request */
__BLK_TA_SLEEPRQ, /* sleeping on rq allocation */
__BLK_TA_REQUEUE, /* request requeued */
__BLK_TA_ISSUE, /* sent to driver */
__BLK_TA_COMPLETE, /* completed by driver */
__BLK_TA_PLUG, /* queue was plugged */
__BLK_TA_UNPLUG_IO, /* queue was unplugged by io */
__BLK_TA_UNPLUG_TIMER, /* queue was unplugged by timer */
__BLK_TA_INSERT, /* insert request */
__BLK_TA_SPLIT, /* bio was split */
__BLK_TA_BOUNCE, /* bio was bounced */
__BLK_TA_REMAP, /* bio was remapped */
__BLK_TA_ABORT, /* request aborted */
__BLK_TA_DRV_DATA, /* driver-specific binary data */
};
/*
* Notify events.
*/
enum blktrace_notify {
__BLK_TN_PROCESS = 0, /* establish pid/name mapping */
__BLK_TN_TIMESTAMP, /* include system clock */
__BLK_TN_MESSAGE, /* Character string message */
};
/*
* Trace actions in full. Additionally, read or write is masked
*/
#define BLK_TA_QUEUE (__BLK_TA_QUEUE | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_BACKMERGE (__BLK_TA_BACKMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_FRONTMERGE (__BLK_TA_FRONTMERGE | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_GETRQ (__BLK_TA_GETRQ | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_SLEEPRQ (__BLK_TA_SLEEPRQ | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_REQUEUE (__BLK_TA_REQUEUE | BLK_TC_ACT(BLK_TC_REQUEUE))
#define BLK_TA_ISSUE (__BLK_TA_ISSUE | BLK_TC_ACT(BLK_TC_ISSUE))
#define BLK_TA_COMPLETE (__BLK_TA_COMPLETE| BLK_TC_ACT(BLK_TC_COMPLETE))
#define BLK_TA_PLUG (__BLK_TA_PLUG | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_UNPLUG_IO (__BLK_TA_UNPLUG_IO | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_UNPLUG_TIMER (__BLK_TA_UNPLUG_TIMER | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_INSERT (__BLK_TA_INSERT | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_SPLIT (__BLK_TA_SPLIT)
#define BLK_TA_BOUNCE (__BLK_TA_BOUNCE)
#define BLK_TA_REMAP (__BLK_TA_REMAP | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_ABORT (__BLK_TA_ABORT | BLK_TC_ACT(BLK_TC_QUEUE))
#define BLK_TA_DRV_DATA (__BLK_TA_DRV_DATA | BLK_TC_ACT(BLK_TC_DRV_DATA))
#define BLK_TN_PROCESS (__BLK_TN_PROCESS | BLK_TC_ACT(BLK_TC_NOTIFY))
#define BLK_TN_TIMESTAMP (__BLK_TN_TIMESTAMP | BLK_TC_ACT(BLK_TC_NOTIFY))
#define BLK_TN_MESSAGE (__BLK_TN_MESSAGE | BLK_TC_ACT(BLK_TC_NOTIFY))
#define BLK_IO_TRACE_MAGIC 0x65617400
#define BLK_IO_TRACE_VERSION 0x07
/*
* The trace itself
*/
struct blk_io_trace {
__u32 magic; /* MAGIC << 8 | version */
__u32 sequence; /* event number */
__u64 time; /* in microseconds */
__u64 sector; /* disk offset */
__u32 bytes; /* transfer length */
__u32 action; /* what happened */
__u32 pid; /* who did it */
__u32 device; /* device number */
__u32 cpu; /* on what cpu did it happen */
__u16 error; /* completion error */
__u16 pdu_len; /* length of data after this trace */
};
/*
* The remap event
*/
struct blk_io_trace_remap {
__be32 device_from;
__be32 device_to;
__be64 sector_from;
};
enum {
Blktrace_setup = 1,
Blktrace_running,
Blktrace_stopped,
};
#define BLKTRACE_BDEV_SIZE 32
/*
* User setup structure passed with BLKTRACESTART
*/
struct blk_user_trace_setup {
char name[BLKTRACE_BDEV_SIZE]; /* output */
__u16 act_mask; /* input */
__u32 buf_size; /* input */
__u32 buf_nr; /* input */
__u64 start_lba;
__u64 end_lba;
__u32 pid;
};
#endif /* _UAPIBLKTRACE_H */
|
/**
helder_hash.h
Purpose: C++ helper functions for hash custom types, here vector<int>
Details: C++ header.
@author Mikkel Meyer Andersen
*/
#ifndef HELPER_HASH_H
#define HELPER_HASH_H
#include <functional>
#include <vector>
namespace std {
// a little helper
template<typename T>
std::size_t make_hash(const T& v) {
return std::hash<T>()(v);
}
// hash any container
template<typename T>
struct hash_container {
size_t operator()(const T& v) const {
size_t h = 0;
for (const auto& e: v) {
size_t e_hash = make_hash(e);
// adapted from boost::hash_combine
h ^= e_hash + 0x9e3779b9 + (h << 6) + (h >> 2);
}
return h;
}
};
// hash any pair
template<typename T>
struct hash_pair {
size_t operator()(const T& v) const {
size_t lhs = v.first;
size_t rhs = v.second;
// adapted from boost::hash_combine
lhs ^= rhs + 0x9e3779b9 + (lhs << 6) + (lhs >> 2);
return lhs;
}
};
template<>
struct hash< std::vector<int> > : hash_container< std::vector<int> > {};
template<>
struct hash< std::pair<int, int> > : hash_pair< std::pair<int, int> > {};
}
#endif
|
/*
* Copyright (C) 2010, 2012-2013 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
*
* A copy of the licence is included with the program, and can also be obtained from Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <linux/version.h>
#include <linux/dma-mapping.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/pm.h>
#include <linux/of.h>
#include <linux/ioport.h>
#include <linux/slab.h>
#include <mach/register.h>
#include <mach/irqs.h>
#include <mach/io.h>
#include <asm/io.h>
#include "meson_main.h"
#include <linux/mali/mali_utgard.h>
#include "mali_kernel_common.h"
#include "common/mali_pmu.h"
#include "common/mali_osk_profiling.h"
int mali_pm_statue = 0;
u32 mali_gp_reset_fail = 0;
module_param(mali_gp_reset_fail, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw-rw-r-- */
MODULE_PARM_DESC(mali_gp_reset_fail, "times of failed to reset GP");
u32 mali_core_timeout = 0;
module_param(mali_core_timeout, int, S_IRUSR | S_IWUSR | S_IWGRP | S_IRGRP | S_IROTH); /* rw-rw-r-- */
MODULE_PARM_DESC(mali_core_timeout, "times of failed to reset GP");
static struct mali_gpu_device_data mali_gpu_data =
{
.shared_mem_size = 1024 * 1024 * 1024,
.max_job_runtime = 60000, /* 60 seconds */
.pmu_switch_delay = 0xFFFF, /* do not have to be this high on FPGA, but it is good for testing to have a delay */
.pmu_domain_config = {0x1, 0x2, 0x4, 0x4, 0x4, 0x8, 0x8, 0x8, 0x8, 0x1, 0x2, 0x8},
};
static void mali_platform_device_release(struct device *device);
static struct platform_device mali_gpu_device =
{
.name = MALI_GPU_NAME_UTGARD,
.id = 0,
.dev.release = mali_platform_device_release,
.dev.coherent_dma_mask = DMA_BIT_MASK(32),
.dev.platform_data = &mali_gpu_data,
.dev.type = &mali_pm_device, /* We should probably use the pm_domain instead of type on newer kernels */
};
int mali_pdev_pre_init(struct platform_device* ptr_plt_dev)
{
MALI_DEBUG_PRINT(4, ("mali_platform_device_register() called\n"));
if (mali_gpu_data.shared_mem_size < 10) {
MALI_DEBUG_PRINT(2, ("mali os memory didn't configered, set to default(512M)\n"));
mali_gpu_data.shared_mem_size = 1024 * 1024 *1024;
}
return mali_meson_init_start(ptr_plt_dev);
}
void mali_pdev_post_init(struct platform_device* pdev)
{
mali_gp_reset_fail = 0;
mali_core_timeout = 0;
#ifdef CONFIG_PM_RUNTIME
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37))
pm_runtime_set_autosuspend_delay(&(pdev->dev), 1000);
pm_runtime_use_autosuspend(&(pdev->dev));
#endif
pm_runtime_enable(&(pdev->dev));
#endif
mali_meson_init_finish(pdev);
}
int mali_pdev_dts_init(struct platform_device* mali_gpu_device)
{
struct device_node *cfg_node = mali_gpu_device->dev.of_node;
struct device_node *child;
u32 prop_value;
int err;
for_each_child_of_node(cfg_node, child) {
err = of_property_read_u32(child, "shared_memory", &prop_value);
if (err == 0) {
MALI_DEBUG_PRINT(2, ("shared_memory configurate %d\n", prop_value));
mali_gpu_data.shared_mem_size = prop_value * 1024 * 1024;
}
}
err = mali_pdev_pre_init(mali_gpu_device);
if (err == 0)
mali_pdev_post_init(mali_gpu_device);
return err;
}
int mali_platform_device_register(void)
{
int err = -1;
err = mali_pdev_pre_init(&mali_gpu_device);
if (err == 0) {
err = platform_device_register(&mali_gpu_device);
if (0 == err)
mali_pdev_post_init(&mali_gpu_device);
}
return err;
}
void mali_platform_device_unregister(void)
{
MALI_DEBUG_PRINT(4, ("mali_platform_device_unregister() called\n"));
mali_core_scaling_term();
platform_device_unregister(&mali_gpu_device);
platform_device_put(&mali_gpu_device);
}
static void mali_platform_device_release(struct device *device)
{
MALI_DEBUG_PRINT(4, ("mali_platform_device_release() called\n"));
}
|
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_concat_params.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qhusler <qhusler@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2015/10/27 12:58:31 by qhusler #+# #+# */
/* Updated: 2015/10/29 20:12:08 by qhusler ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int ft_strlen(char *str)
{
int i;
i = 0;
while (str && str[i])
i++;
return (i);
}
char *ft_strncat(char *dest, char *src, int nb)
{
int i;
int size;
i = 0;
size = ft_strlen(dest);
while (i < nb && src && src[i])
{
dest[size + i] = src[i];
i++;
}
dest[size + i] = '\0';
return (dest);
}
int ft_argvlen(int argc, char **argv)
{
int i;
unsigned int s;
i = 1;
s = 0;
while (i < argc)
{
s = s + ft_strlen(argv[i]);
i++;
}
return (s);
}
char *ft_concat_params(int argc, char **argv)
{
int i;
char *dest;
char *bn;
i = 1;
bn = "\n";
dest = (char*)malloc(sizeof(char) * ft_argvlen(argc, argv));
if (argc > 1)
while (++i < argc + 1)
{
ft_strncat(dest, argv[i - 1], ft_strlen(argv[i - 1]));
if (i < argc)
ft_strncat(dest, bn, 1);
}
return (dest);
}
|
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is Brazil.
*
* The Initial Developer of the Original Code is
* National ICT Australia.
* Portions created by the Initial Developer are Copyright (C) 2007
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Douglas Aberdeen (doug.aberdeen@gmail.com)
* Owen Thomas (owen.thomas@nicta.com.au)
* Olivier Buffet (olivier.buffet@loria.fr)
*
* ***** END LICENSE BLOCK ***** */
/*
* $Id: BrazilState.cpp 107 2006-07-27 03:31:12Z owen $
*
* This file is part of the Brazil Planner. Copyright NICTA 2006.
*
* This file is commercial in confidence. You should no be looking at
* it unless you are an employee of NICTA, a student who has signed
* their IP to NICTA, or you have signed an NDA covering the Brazil
* source code. If you are not one of these people we will poke out
* your eyes with a gerkhin while forcing you to sing the Brazilian
* national anthem.
*
*/
#ifndef _BrazilStateHelpers__h
#define _BrazilStateHelpers__h
#include"DOMDuration.h"
#include"DOMAtomicEffectVisitor.h"
#include"DOMConditionVisitor.h"
#include"DOMFunctionExpression.h"
#include"DOMOutcome.h"
#include"BrazilState.h"
/**
* This class has got some slightly higher level routines that use
* state information, but do not effect the alter the state
* directly. Could easily be in BrazilState, but separated out just to
* make it clear what the real elements of state are.
*/
class BrazilStateHelpers : public BrazilState {
protected:
// Remember what the goal condition is for isGoal()
DOMCondition* goalCondition;
// See .cpp for comments.
BrazilStateHelpers(DOMProblem* problem);
bool isActionEligible(DOMAction* action);
bool isGoal();
time_t sampleTime(DOMDuration* duration, bool median);
bool checkEffects(DOMEffectSet* e);
bool checkOutcomeEffects(DOMOutcome::Effects effectSets);
bool isUsefulAction(DOMAction* a);
/**
* Visitor implementation for checking whether effects
* of a task are useful in the current state.
* An effect is useful if it is not already in place.
* Any function makes the task useful it's generally
* not possible to determine if a function is
* useful (except in the stupid case where it does nothing).
*/
class EffectChecker: public DOMAtomicEffectVisitor {
private:
BrazilState* state;
public:
EffectChecker(BrazilState* bs) : state(bs) {};
virtual ~EffectChecker() {};
virtual bool visitFunctionEffect(DOMFunctionEffect*);
virtual bool visitPredicateEffect(DOMPredicateEffect*);
} effectChecker;
/**
* Visitor implementation for checking whether conditions
* are met.
*/
class ConditionChecker : public DOMConditionVisitor {
private:
BrazilStateHelpers* state;
public:
ConditionChecker(BrazilStateHelpers* bs) : state(bs) {};
virtual ~ConditionChecker() {};
virtual bool visitInternal (DOMInternalCondition* internal);
virtual bool visitFunction (DOMFunctionCondition* function);
virtual bool visitPredicate (DOMPredicateCondition* predicate);
} conditionChecker;
public:
/**
* Visitor implementation for checking whether conditions
* are met.
*/
class ExpressionEvaluator : public DOMFunctionExpressionVisitor {
private:
BrazilStateHelpers* state;
public:
ExpressionEvaluator(BrazilStateHelpers* bs) : state(bs) {};
virtual ~ExpressionEvaluator() {};
virtual double visitFunction(DOMFunctionExpressionFunction* resource);
virtual double visitInternal(DOMFunctionExpressionInternal* internal);
virtual double visitValue(DOMFunctionExpressionValue* value);
} expressionEvaluator;
};
#endif
|
//
// kenwood.h
//
// Copyright 2012, 2013 by John Pietrzak (jpietrzak8@gmail.com)
//
// This file is part of Pierogi.
//
// Pierogi 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.
//
// Pierogi 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 KENWOOD_H
#define KENWOOD_H
#include "pirkeysetmetadata.h"
class QObject;
class QComboBox;
class KenwoodAudio1: public PIRKeysetMetaData
{
public:
KenwoodAudio1(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb);
};
class KenwoodComponent1: public PIRKeysetMetaData
{
public:
KenwoodComponent1(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb);
};
class KenwoodComponent2: public PIRKeysetMetaData
{
public:
KenwoodComponent2(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb);
};
class KenwoodComponent3: public PIRKeysetMetaData
{
public:
KenwoodComponent3(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb);
};
class KenwoodCD1: public PIRKeysetMetaData
{
public:
KenwoodCD1(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
};
class KenwoodDVD1: public PIRKeysetMetaData
{
public:
KenwoodDVD1(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
};
class KenwoodTV1: public PIRKeysetMetaData
{
public:
KenwoodTV1(
unsigned int index);
virtual void populateProtocol(
QObject *guiObject);
virtual void populateInputList(
QComboBox *cb);
};
#endif // KENWOOD_H
|
/*******************************************************************************
Intel 10 Gigabit PCI Express Linux driver
Copyright(c) 1999 - 2011 Intel Corporation.
This program is free software; you can redistribute it and/or modify it
under the terms and conditions 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.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information:
e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
*******************************************************************************/
#ifndef _IXGBE_SRIOV_H_
#define _IXGBE_SRIOV_H_
void ixgbe_restore_vf_multicasts(struct ixgbe_adapter *adapter);
void ixgbe_msg_task(struct ixgbe_adapter *adapter);
int ixgbe_vf_configuration(struct pci_dev *pdev, unsigned int event_mask);
void ixgbe_disable_tx_rx(struct ixgbe_adapter *adapter);
void ixgbe_ping_all_vfs(struct ixgbe_adapter *adapter);
void ixgbe_dump_registers(struct ixgbe_adapter *adapter);
int ixgbe_ndo_set_vf_mac(struct net_device *netdev, int queue, u8 *mac);
int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int queue, u16 vlan,
u8 qos);
int ixgbe_ndo_set_vf_bw(struct net_device *netdev, int vf, int tx_rate);
int ixgbe_ndo_get_vf_config(struct net_device *netdev,
int vf, struct ifla_vf_info *ivi);
void ixgbe_check_vf_rate_limit(struct ixgbe_adapter *adapter);
#endif /* _IXGBE_SRIOV_H_ */
|
/*!**************************************************************************
*!
*! FILE NAME : eshlibld.h
*!
*! DESCRIPTION: Prototypes for exported shared library functions
*!
*! FUNCTIONS : perform_cris_aout_relocations, shlibmod_fork, shlibmod_exit
*! (EXPORTED)
*!
*!---------------------------------------------------------------------------
*!
*! (C) Copyright 1998, 1999 Axis Communications AB, LUND, SWEDEN
*!
*!**************************************************************************/
/* $Id: //WIFI_SOC/release/SDK_4_1_0_0/source/linux-2.6.36.x/arch/cris/include/asm/eshlibld.h#1 $ */
#ifndef _cris_relocate_h
#define _cris_relocate_h
/* Please note that this file is also compiled into the xsim simulator.
Try to avoid breaking its double use (only works on a little-endian
32-bit machine such as the i386 anyway).
Use __KERNEL__ when you're about to use kernel functions,
(which you should not do here anyway, since this file is
used by glibc).
Use defined(__KERNEL__) || defined(__elinux__) when doing
things that only makes sense on an elinux system.
Use __CRIS__ when you're about to do (really) CRIS-specific code.
*/
/* We have dependencies all over the place for the host system
for xsim being a linux system, so let's not pretend anything
else with #ifdef:s here until fixed. */
#include <linux/limits.h>
/* Maybe do sanity checking if file input. */
#undef SANITYCHECK_RELOC
/* Maybe output debug messages. */
#undef RELOC_DEBUG
/* Maybe we want to share core as well as disk space.
Mainly depends on the config macro CONFIG_SHARE_SHLIB_CORE, but it is
assumed that we want to share code when debugging (exposes more
trouble). */
#ifndef SHARE_LIB_CORE
# if (defined(__KERNEL__) || !defined(RELOC_DEBUG)) \
&& !defined(CONFIG_SHARE_SHLIB_CORE)
# define SHARE_LIB_CORE 0
# else
# define SHARE_LIB_CORE 1
# endif /* __KERNEL__ etc */
#endif /* SHARE_LIB_CORE */
/* Main exported function; supposed to be called when the program a.out
has been read in. */
extern int
perform_cris_aout_relocations(unsigned long text, unsigned long tlength,
unsigned long data, unsigned long dlength,
unsigned long baddr, unsigned long blength,
/* These may be zero when there's "perfect"
position-independent code. */
unsigned char *trel, unsigned long tsrel,
unsigned long dsrel,
/* These will be zero at a first try, to see
if code is statically linked. Else a
second try, with the symbol table and
string table nonzero should be done. */
unsigned char *symbols, unsigned long symlength,
unsigned char *strings, unsigned long stringlength,
/* These will only be used when symbol table
information is present. */
char **env, int envc,
int euid, int is_suid);
#ifdef RELOC_DEBUG
/* Task-specific debug stuff. */
struct task_reloc_debug {
struct memdebug *alloclast;
unsigned long alloc_total;
unsigned long export_total;
};
#endif /* RELOC_DEBUG */
#if SHARE_LIB_CORE
/* When code (and some very specific data) is shared and not just
dynamically linked, we need to export hooks for exec beginning and
end. */
struct shlibdep;
extern void
shlibmod_exit(struct shlibdep **deps);
/* Returns 0 if failure, nonzero for ok. */
extern int
shlibmod_fork(struct shlibdep **deps);
#else /* ! SHARE_LIB_CORE */
# define shlibmod_exit(x)
# define shlibmod_fork(x) 1
#endif /* ! SHARE_LIB_CORE */
#endif _cris_relocate_h
/********************** END OF FILE eshlibld.h *****************************/
|
/*
* The PCI Library -- User Access
*
* Copyright (c) 1997--2014 Martin Mares <mj@ucw.cz>
*
* Can be freely distributed and used under the terms of the GNU GPL.
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include "internal.h"
void
pci_scan_bus(struct pci_access *a)
{
a->methods->scan(a);
}
struct pci_dev *
pci_alloc_dev(struct pci_access *a)
{
struct pci_dev *d = pci_malloc(a, sizeof(struct pci_dev));
memset(d, 0, sizeof(*d));
d->access = a;
d->methods = a->methods;
d->hdrtype = -1;
d->numa_node = -1;
if (d->methods->init_dev)
d->methods->init_dev(d);
return d;
}
int
pci_link_dev(struct pci_access *a, struct pci_dev *d)
{
d->next = a->devices;
a->devices = d;
/*
* Applications compiled with older versions of libpci do not expect
* 32-bit domain numbers. To keep them working, we keep a 16-bit
* version of the domain number at the previous location in struct
* pci_dev. This will keep backward compatibility on systems which
* don't require large domain numbers.
*/
if (d->domain > 0xffff)
d->domain_16 = 0xffff;
else
d->domain_16 = d->domain;
return 1;
}
struct pci_dev *
pci_get_dev(struct pci_access *a, int domain, int bus, int dev, int func)
{
struct pci_dev *d = pci_alloc_dev(a);
d->domain = domain;
d->bus = bus;
d->dev = dev;
d->func = func;
return d;
}
void pci_free_dev(struct pci_dev *d)
{
if (d->methods->cleanup_dev)
d->methods->cleanup_dev(d);
pci_free_caps(d);
pci_mfree(d->module_alias);
pci_mfree(d->label);
pci_mfree(d->phy_slot);
pci_mfree(d);
}
static inline void
pci_read_data(struct pci_dev *d, void *buf, int pos, int len)
{
if (pos & (len-1))
d->access->error("Unaligned read: pos=%02x, len=%d", pos, len);
if (pos + len <= d->cache_len)
memcpy(buf, d->cache + pos, len);
else if (!d->methods->read(d, pos, buf, len))
memset(buf, 0xff, len);
}
byte
pci_read_byte(struct pci_dev *d, int pos)
{
byte buf;
pci_read_data(d, &buf, pos, 1);
return buf;
}
word
pci_read_word(struct pci_dev *d, int pos)
{
word buf;
pci_read_data(d, &buf, pos, 2);
return le16_to_cpu(buf);
}
u32
pci_read_long(struct pci_dev *d, int pos)
{
u32 buf;
pci_read_data(d, &buf, pos, 4);
return le32_to_cpu(buf);
}
int
pci_read_block(struct pci_dev *d, int pos, byte *buf, int len)
{
return d->methods->read(d, pos, buf, len);
}
int
pci_read_vpd(struct pci_dev *d, int pos, byte *buf, int len)
{
return d->methods->read_vpd ? d->methods->read_vpd(d, pos, buf, len) : 0;
}
static inline int
pci_write_data(struct pci_dev *d, void *buf, int pos, int len)
{
if (pos & (len-1))
d->access->error("Unaligned write: pos=%02x,len=%d", pos, len);
if (pos + len <= d->cache_len)
memcpy(d->cache + pos, buf, len);
return d->methods->write(d, pos, buf, len);
}
int
pci_write_byte(struct pci_dev *d, int pos, byte data)
{
return pci_write_data(d, &data, pos, 1);
}
int
pci_write_word(struct pci_dev *d, int pos, word data)
{
word buf = cpu_to_le16(data);
return pci_write_data(d, &buf, pos, 2);
}
int
pci_write_long(struct pci_dev *d, int pos, u32 data)
{
u32 buf = cpu_to_le32(data);
return pci_write_data(d, &buf, pos, 4);
}
int
pci_write_block(struct pci_dev *d, int pos, byte *buf, int len)
{
if (pos < d->cache_len)
{
int l = (pos + len >= d->cache_len) ? (d->cache_len - pos) : len;
memcpy(d->cache + pos, buf, l);
}
return d->methods->write(d, pos, buf, len);
}
int
pci_fill_info_v35(struct pci_dev *d, int flags)
{
if (flags & PCI_FILL_RESCAN)
{
flags &= ~PCI_FILL_RESCAN;
d->known_fields = 0;
pci_free_caps(d);
}
if (flags & ~d->known_fields)
d->known_fields |= d->methods->fill_info(d, flags & ~d->known_fields);
return d->known_fields;
}
/* In version 3.1, pci_fill_info got new flags => versioned alias */
/* In versions 3.2, 3.3, 3.4 and 3.5, the same has happened */
STATIC_ALIAS(int pci_fill_info(struct pci_dev *d, int flags), pci_fill_info_v35(d, flags));
DEFINE_ALIAS(int pci_fill_info_v30(struct pci_dev *d, int flags), pci_fill_info_v35);
DEFINE_ALIAS(int pci_fill_info_v31(struct pci_dev *d, int flags), pci_fill_info_v35);
DEFINE_ALIAS(int pci_fill_info_v32(struct pci_dev *d, int flags), pci_fill_info_v35);
DEFINE_ALIAS(int pci_fill_info_v33(struct pci_dev *d, int flags), pci_fill_info_v35);
DEFINE_ALIAS(int pci_fill_info_v34(struct pci_dev *d, int flags), pci_fill_info_v35);
SYMBOL_VERSION(pci_fill_info_v30, pci_fill_info@LIBPCI_3.0);
SYMBOL_VERSION(pci_fill_info_v31, pci_fill_info@LIBPCI_3.1);
SYMBOL_VERSION(pci_fill_info_v32, pci_fill_info@LIBPCI_3.2);
SYMBOL_VERSION(pci_fill_info_v33, pci_fill_info@LIBPCI_3.3);
SYMBOL_VERSION(pci_fill_info_v34, pci_fill_info@LIBPCI_3.4);
SYMBOL_VERSION(pci_fill_info_v35, pci_fill_info@@LIBPCI_3.5);
void
pci_setup_cache(struct pci_dev *d, byte *cache, int len)
{
d->cache = cache;
d->cache_len = len;
}
|
/********************************************************************\
* 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, contact: *
* *
* Free Software Foundation Voice: +1-617-542-5942 *
* 59 Temple Place - Suite 330 Fax: +1-617-542-2652 *
* Boston, MA 02111-1307, USA gnu@gnu.org *
* *
\********************************************************************/
/* $Id: http.h 1104 2006-10-09 00:58:46Z acv $ */
/** @file http.h
@brief HTTP IO functions
@author Copyright (C) 2004 Philippe April <papril777@yahoo.com>
@author Copyright (C) 2007 Paul Kube <nodogsplash@kokoro.ucsd.edu>
*/
#ifndef _HTTP_H_
#define _HTTP_H_
#include "auth.h"
#include "httpd.h"
#include "client_list.h"
/**
* Define parts of an authentication target.
*/
typedef struct _auth_target_t {
char *ip; /**< @brief IP of auth server */
int port; /**< @brief Port of auth server */
char *authdir; /**< @brief Auth dir */
char *denydir; /**< @brief Deny dir */
char *authaction; /**< @brief Auth action */
char *denyaction; /**< @brief Deny action */
char *authtarget; /**< @brief Deny action */
char *token; /**< @brief Client token */
char *redir; /**< @brief Client redirect target */
char *username; /**< @brief User name */
char *password; /**< @brief User password */
char *info; /**< @brief Auxilliary info */
} t_auth_target;
/**@brief Callback for libhttpd, serves nodogsplash splash page */
void http_nodogsplash_callback_404(httpd *webserver, request *r);
/**@brief Callback for libhttpd, serves nodogsplash splash page */
void http_nodogsplash_callback_index(httpd *webserver, request *r);
/**@brief Callback for libhttpd, authenticates a client for nodogsplash */
void http_nodogsplash_callback_auth(httpd *webserver, request *r);
/**@brief Callback for libhttpd, denies a client for nodogsplash */
void http_nodogsplash_callback_deny(httpd *webserver, request *r);
/**@brief The multipurpose authentication action handler */
void http_nodogsplash_callback_action(request *r, t_auth_target *authtarget, t_authaction action);
/**@brief Add client identified in request to client list. */
t_client* http_nodogsplash_add_client(request *r);
/**@brief Serve a 307 Temporary Redirect */
void http_nodogsplash_redirect(request *r, char *url);
/**@brief Redirect to remote auth server */
void http_nodogsplash_redirect_remote_auth(request *r, t_auth_target *authtarget);
/**@brief Serve the splash page from its file */
void http_nodogsplash_serve_splash(request *r, t_auth_target *authtarget);
/**@brief Serve the info page from its file */
void http_nodogsplash_serve_info(request *r, char *title, char *content);
/**@brief Handle initial contact from client */
void http_nodogsplash_first_contact(request *r);
/**@brief Decode token and redirect URL from a request */
t_auth_target* http_nodogsplash_decode_authtarget(request *r);
/**@brief Malloc and return a t_auth_target struct encoding info */
t_auth_target* http_nodogsplash_make_authtarget(char* token, char* redir);
/**@brief Free a t_auth_target struct */
void http_nodogsplash_free_authtarget(t_auth_target* authtarget);
/**@brief Malloc and return a redirect URL */
char* http_nodogsplash_make_redir(char* redirhost, char* redirpath);
/**@brief Do password check if configured */
int http_nodogsplash_check_password(request *r, t_auth_target *authtarget);
/**@brief Allocate and return a random string of 8 hex digits
suitable as an authentication token */
char * http_make_auth_token();
/** @brief Sends HTML header to web browser */
void http_nodogsplash_header(request *r, char *title);
/** @brief Sends HTML footer to web browser */
void http_nodogsplash_footer(request *r);
#endif /* _HTTP_H_ */
|
/*************************************************************************
* util.h
*
* Matt Shelton <matt@mattshelton.com>
*
* This header file contains information relating to the util.c module.
*
* Copyright (C) 2004 Matt Shelton <matt@mattshelton.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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: util.h,v 1.4 2005/02/22 16:09:25 mattshelton Exp $
*
**************************************************************************/
#include <bstring/bstrlib.h>
/* PROTOTYPES -------------------------------------- */
void strip_comment (char *string);
int chomp (char *string, int size);
void daemonize (void);
void init_pid_file (bstring pid_file, bstring user, bstring group);
char *copy_argv(register char **argv);
void log_message (const char *msg, ...);
void err_message (const char *msg, ...);
void verbose_message (const char *msg, ...);
#ifndef HAVE_STRLCPY
size_t strlcpy(char *dst, const char *src, size_t size);
#endif
#ifndef HAVE_STRLCAT
size_t strlcat(char *dst, const char *src, size_t len);
#endif
void drop_privs (bstring newuser, bstring newgroup);
void mac2hex(const char *mac, char *dst, int len);
char *hex2mac(unsigned const char *mac);
char *fasthex(u_char *, int);
/* GLOBALS ----------------------------------------- */
|
/* Test for ldbl-128ibm fmodl handling of equal values (bug 19602).
Copyright (C) 2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#include <float.h>
#include <math.h>
#include <stdio.h>
union u
{
long double ld;
double d[2];
};
volatile union u p1 = { .d = { DBL_MIN, 0.0 } };
volatile union u p2 = { .d = { DBL_MIN, -0.0 } };
volatile union u m1 = { .d = { -DBL_MIN, 0.0 } };
volatile union u m2 = { .d = { -DBL_MIN, -0.0 } };
static int
test_fmodl (const char *s, long double x, long double y, long double expected)
{
volatile long double r;
r = fmodl (x, y);
if (r != expected || copysignl (1.0, r) != copysignl (1.0, expected))
{
printf ("FAIL: fmodl (%s)\n", s);
return 1;
}
else
{
printf ("PASS: fmodl (%s)\n", s);
return 0;
}
}
#define TEST_FMODL(a, b, e) test_fmodl (#a ", " #b, a, b, e)
static int
do_test (void)
{
int result = 0;
result |= TEST_FMODL (p1.ld, p1.ld, 0.0L);
result |= TEST_FMODL (p1.ld, p2.ld, 0.0L);
result |= TEST_FMODL (p1.ld, m1.ld, 0.0L);
result |= TEST_FMODL (p1.ld, m2.ld, 0.0L);
result |= TEST_FMODL (p2.ld, p1.ld, 0.0L);
result |= TEST_FMODL (p2.ld, p2.ld, 0.0L);
result |= TEST_FMODL (p2.ld, m1.ld, 0.0L);
result |= TEST_FMODL (p2.ld, m2.ld, 0.0L);
result |= TEST_FMODL (m1.ld, p1.ld, -0.0L);
result |= TEST_FMODL (m1.ld, p2.ld, -0.0L);
result |= TEST_FMODL (m1.ld, m1.ld, -0.0L);
result |= TEST_FMODL (m1.ld, m2.ld, -0.0L);
result |= TEST_FMODL (m2.ld, p1.ld, -0.0L);
result |= TEST_FMODL (m2.ld, p2.ld, -0.0L);
result |= TEST_FMODL (m2.ld, m1.ld, -0.0L);
result |= TEST_FMODL (m2.ld, m2.ld, -0.0L);
return result;
}
#define TEST_FUNCTION do_test ()
#include "../../../test-skeleton.c"
|
#pragma once
#include <string>
struct IVTShell
{
virtual void OnApplicationProtocolCommand(const char *str) = 0;
virtual void InjectInput(const char *str) = 0;
virtual void OnKeypadChange(unsigned char keypad) = 0;
virtual void OnTerminalResized() = 0;
};
class VTAnsi
{
struct {
std::string tail, tmp;
} _incomplete;
std::wstring _ws, _saved_title;
public:
VTAnsi(IVTShell *vt_shell);
~VTAnsi();
void DisableOutput();
void EnableOutput();
void Write(const char *str, size_t len);
struct VTAnsiState *Suspend();
void Resume(struct VTAnsiState* state);
void OnStart();
void OnStop();
};
class VTAnsiSuspend
{
VTAnsi &_vta;
struct VTAnsiState *_ansi_state;
public:
VTAnsiSuspend(VTAnsi &vta)
: _vta(vta), _ansi_state(_vta.Suspend())
{
}
~VTAnsiSuspend()
{
if (_ansi_state)
_vta.Resume(_ansi_state);
}
inline operator bool() const
{
return _ansi_state != nullptr;
}
};
|
/*
* equalizer.h
*
* Copyright (C) 2003-2004 Jürgen Kofler <kaffeine@gmx.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef EQUALIZER_H
#define EQUALIZER_H
#include <kdialogbase.h>
#include <kconfig.h>
#include <qwidget.h>
#include <qslider.h>
#include <qgroupbox.h>
#include <qcheckbox.h>
/**equalizer widget
*@author Juergen Kofler
*/
class Equalizer : public KDialogBase {
Q_OBJECT
public:
Equalizer(QWidget *parent=0, const char *name=0);
~Equalizer();
void ReadValues(KConfig* config);
void SaveValues(KConfig* config);
signals:
void signalNewEq30(int);
void signalNewEq60(int);
void signalNewEq125(int);
void signalNewEq250(int);
void signalNewEq500(int);
void signalNewEq1k(int);
void signalNewEq2k(int);
void signalNewEq4k(int);
void signalNewEq8k(int);
void signalNewEq16k(int);
void signalSetVolumeGain(bool);
private slots:
void slotSetDefaultValues();
void slotSetEnabled( bool );
private:
QCheckBox* on;
QCheckBox* volumeGain;
QGroupBox* equalGroup;
QSlider* eq30Slider;
QSlider* eq60Slider;
QSlider* eq125Slider;
QSlider* eq250Slider;
QSlider* eq500Slider;
QSlider* eq1kSlider;
QSlider* eq2kSlider;
QSlider* eq4kSlider;
QSlider* eq8kSlider;
QSlider* eq16kSlider;
};
#endif /* EQUALIZER_H */
|
class Singleton{
private:
static Singleton *mInstance;//此处仅是申明
Singleton();
~Singleton();
public:
static Singleton* getInstance();
};
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.