text stringlengths 4 6.14k |
|---|
#ifndef MAKEFILEGENERATOR_H
#define MAKEFILEGENERATOR_H
#include <settings.h>
#include <cbproject.h>
#include "compilergcc.h"
#include <compiler.h>
WX_DEFINE_ARRAY(ProjectBuildTarget*, TargetsArray);
WX_DEFINE_ARRAY(ProjectFile*, FilesArray); // keep our own copy, to sort it by file weight (priority)
WX_DEFINE_ARRAY(ProjectFile*, ObjectFilesArray); // holds object files already included in the Makefile
class CustomVars;
/*
* No description
*/
class MakefileGenerator
{
public:
// class constructor
MakefileGenerator(CompilerGCC* compiler, cbProject* project, const wxString& makefile, int logIndex);
// class destructor
~MakefileGenerator();
bool CreateMakefile();
void ReplaceMacros(ProjectBuildTarget* bt, ProjectFile* pf, wxString& text);
void QuoteStringIfNeeded(wxString& str, bool force = false);
wxString CreateSingleFileCompileCmd(const wxString& command,
ProjectBuildTarget* target,
ProjectFile* pf,
const wxString& file,
const wxString& object,
const wxString& deps);
wxString CreateSingleFileCompileCmd(CommandType et,
ProjectBuildTarget* target,
ProjectFile* pf,
const wxString& file,
const wxString& object,
const wxString& deps);
void ConvertToMakefileFriendly(wxString& str, bool force = false);
private:
void DoAppendCompilerOptions(wxString& cmd, ProjectBuildTarget* target = 0L, bool useGlobalOptions = false);
void DoAppendLinkerOptions(wxString& cmd, ProjectBuildTarget* target = 0L, bool useGlobalOptions = false);
void DoAppendLinkerLibs(wxString& cmd, ProjectBuildTarget* target = 0L, bool useGlobalOptions = false);
void DoAppendIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-I"), bool useGlobalOptions = false);
void DoAppendResourceIncludeDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-I"), bool useGlobalOptions = false);
void DoAppendLibDirs(wxString& cmd, ProjectBuildTarget* target = 0L, const wxString& prefix = _T("-L"), bool useGlobalOptions = false);
void DoAddVarsSet(wxString& buffer, CustomVars& vars);
void DoAddMakefileVars(wxString& buffer);
void DoAddMakefileResources(wxString& buffer);
void DoAddMakefileCreateDirs(wxString& buffer, ProjectBuildTarget* target, bool obj, bool dep, bool bin);
void DoAddMakefileObjs(wxString& buffer);
void DoAddMakefileIncludes(wxString& buffer);
void DoAddMakefileLibs(wxString& buffer);
void DoAddMakefileLibDirs(wxString& buffer);
void DoAddMakefileOptions(wxString& buffer);
void DoAddMakefileCFlags(wxString& buffer);
void DoAddMakefileLDFlags(wxString& buffer);
void DoAddMakefileTargets(wxString& buffer);
void DoAddPhonyTargets(wxString& buffer);
void DoAddMakefileTarget_All(wxString& buffer);
void DoAddMakefileTargets_BeforeAfter(wxString& buffer);
void DoAddMakefileCommands(const wxString& desc, const wxString& prefix, const wxArrayString& commands, wxString& buffer);
void DoAddMakefileTarget_Clean(wxString& buffer);
void DoAddMakefileTarget_Dist(wxString& buffer);
void DoAddMakefileTarget_Depend(wxString& buffer);
void DoAddMakefileTarget_Link(wxString& buffer);
void DoAddMakefileTarget_Objs(wxString& buffer);
void DoGetMakefileIncludes(wxString& buffer, ProjectBuildTarget* target);
void DoGetMakefileLibDirs(wxString& buffer, ProjectBuildTarget* target);
void DoGetMakefileLibs(wxString& buffer, ProjectBuildTarget* target);
void DoGetMakefileCFlags(wxString& buffer, ProjectBuildTarget* target);
void DoGetMakefileLDFlags(wxString& buffer, ProjectBuildTarget* target);
wxString GetObjectFile(ProjectFile* pf, ProjectBuildTarget* target);
wxString GetDependencyFile(ProjectFile* pf, ProjectBuildTarget* target);
void UpdateCompiler(ProjectBuildTarget* target = 0);
void DoPrepareFiles();
void DoPrepareValidTargets();
bool IsTargetValid(ProjectBuildTarget* target);
void RecursiveCreateDir(wxString& buffer, const wxArrayString& subdirs, wxArrayString& guardList);
wxString ReplaceCompilerMacros(CommandType et,
const wxString& compilerVar,
ProjectBuildTarget* target,
const wxString& file,
const wxString& object,
const wxString& deps);
CompilerGCC* m_Compiler;
Compiler* m_CompilerSet;
cbProject* m_Project;
wxString m_Makefile;
TargetsArray m_LinkableTargets;
FilesArray m_Files;
ObjectFilesArray m_ObjectFiles;
int m_LogIndex;
wxString m_Quiet; // used for compiler simple log
private:
bool m_GeneratingMakefile;
};
#endif // MAKEFILEGENERATOR_H
|
#undef CONFIG_USB_UHCI124
|
/*
* Copyright (c) International Business Machines Corp., 2008
*
* Authors:
* Reiner Sailer <sailer@watson.ibm.com>
* Mimi Zohar <zohar@us.ibm.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, version 2 of the
* License.
*
* File: ima_measure.c
*
* Calculate the SHA1 aggregate-pcr value based on the IMA runtime
* binary measurements.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include "config.h"
#include "test.h"
char *TCID = "ima_measure";
#if HAVE_LIBCRYPTO
#include <openssl/sha.h>
#define TCG_EVENT_NAME_LEN_MAX 255
int TST_TOTAL = 1;
static int verbose;
#define print_info(format, arg...) \
if (verbose) \
printf(format, ##arg)
static u_int8_t zero[SHA_DIGEST_LENGTH];
static u_int8_t fox[SHA_DIGEST_LENGTH];
struct event {
struct {
u_int32_t pcr;
u_int8_t digest[SHA_DIGEST_LENGTH];
u_int32_t name_len;
} header;
char name[TCG_EVENT_NAME_LEN_MAX + 1];
struct {
u_int8_t digest[SHA_DIGEST_LENGTH];
char filename[TCG_EVENT_NAME_LEN_MAX + 1];
} ima_data;
int filename_len;
};
static void display_sha1_digest(u_int8_t * digest)
{
int i;
for (i = 0; i < 20; i++)
print_info(" %02X", (*(digest + i) & 0xff));
}
/*
* Calculate the sha1 hash of data
*/
static void calc_digest(u_int8_t * digest, int len, void *data)
{
SHA_CTX c;
/* Calc template hash for an ima entry */
memset(digest, 0, sizeof *digest);
SHA1_Init(&c);
SHA1_Update(&c, data, len);
SHA1_Final(digest, &c);
}
static int verify_template_hash(struct event *template)
{
int rc;
rc = memcmp(fox, template->header.digest, sizeof fox);
if (rc != 0) {
u_int8_t digest[SHA_DIGEST_LENGTH];
memset(digest, 0, sizeof digest);
calc_digest(digest, sizeof template->ima_data,
&template->ima_data);
rc = memcmp(digest, template->header.digest, sizeof digest);
return rc != 0 ? 1 : 0;
}
return 0;
}
/*
* ima_measurements.c - calculate the SHA1 aggregate-pcr value based
* on the IMA runtime binary measurements.
*
* format: ima_measurement [--validate] [--verify] [--verbose]
*
* --validate: forces validation of the aggregrate pcr value
* for an invalidated PCR. Replace all entries in the
* runtime binary measurement list with 0x00 hash values,
* which indicate the PCR was invalidated, either for
* "a time of measure, time of use"(ToMToU) error, or a
* file open for read was already open for write, with
* 0xFF's hash value, when calculating the aggregate
* pcr value.
*
* --verify: for all IMA template entries in the runtime binary
* measurement list, calculate the template hash value
* and compare it with the actual template hash value.
* Return the number of incorrect hash measurements.
*
* --verbose: For all entries in the runtime binary measurement
* list, display the template information.
*
* template info: list #, PCR-register #, template hash, template name
* IMA info: IMA hash, filename hint
*
* Ouput: displays the aggregate-pcr value
* Return code: if verification enabled, returns number of verification
* errors.
*/
int main(int argc, char *argv[])
{
FILE *fp;
struct event template;
u_int8_t pcr[SHA_DIGEST_LENGTH];
int i, count = 0;
int validate = 0;
int verify = 0;
if (argc < 2) {
printf("format: %s binary_runtime_measurements"
" [--validate] [--verbose] [--verify]\n", argv[0]);
return 1;
}
for (i = 2; i < argc; i++) {
if (strncmp(argv[i], "--validate", 8) == 0)
validate = 1;
if (strncmp(argv[i], "--verbose", 7) == 0)
verbose = 1;
if (strncmp(argv[i], "--verify", 6) == 0)
verify = 1;
}
fp = fopen(argv[1], "r");
if (!fp) {
printf("fn: %s\n", argv[1]);
perror("Unable to open file\n");
return 1;
}
memset(pcr, 0, SHA_DIGEST_LENGTH); /* initial PCR content 0..0 */
memset(zero, 0, SHA_DIGEST_LENGTH);
memset(fox, 0xff, SHA_DIGEST_LENGTH);
print_info("### PCR HASH "
"TEMPLATE-NAME\n");
while (fread(&template.header, sizeof template.header, 1, fp)) {
SHA_CTX c;
/* Extend simulated PCR with new template digest */
SHA1_Init(&c);
SHA1_Update(&c, pcr, SHA_DIGEST_LENGTH);
if (validate) {
if (memcmp(template.header.digest, zero, 20) == 0)
memset(template.header.digest, 0xFF, 20);
}
SHA1_Update(&c, template.header.digest, 20);
SHA1_Final(pcr, &c);
print_info("%3d %03u ", count++, template.header.pcr);
display_sha1_digest(template.header.digest);
if (template.header.name_len > TCG_EVENT_NAME_LEN_MAX) {
printf("%d ERROR: event name too long!\n",
template.header.name_len);
exit(1);
}
memset(template.name, 0, sizeof template.name);
fread(template.name, template.header.name_len, 1, fp);
print_info(" %s ", template.name);
memset(&template.ima_data, 0, sizeof template.ima_data);
fread(&template.ima_data.digest,
sizeof template.ima_data.digest, 1, fp);
display_sha1_digest(template.ima_data.digest);
fread(&template.filename_len,
sizeof template.filename_len, 1, fp);
fread(template.ima_data.filename, template.filename_len, 1, fp);
print_info(" %s\n", template.ima_data.filename);
if (verify)
if (verify_template_hash(&template) != 0) {
tst_resm(TFAIL, "Hash failed");
}
}
fclose(fp);
verbose = 1;
print_info("PCRAggr (re-calculated):");
display_sha1_digest(pcr);
tst_exit();
}
#else
int main(void)
{
tst_brkm(TCONF, NULL, "test requires libcrypto and openssl development packages");
}
#endif
|
/********************************************************************************
* Marvell GPL License Option
*
* If you received this File from Marvell, you may opt to use, redistribute and/or
* modify this File in accordance with the terms and conditions of the General
* Public License Version 2, June 1991 (the "GPL License"), a copy of which is
* available along with the File in the license.txt file or by writing to the Free
* Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 or
* on the worldwide web at http://www.gnu.org/licenses/gpl.txt.
*
* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE IMPLIED
* WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY
* DISCLAIMED. The GPL License provides additional details about this warranty
* disclaimer.
********************************************************************************/
///////////////////////////////////////////////////////////////////////////////
//! \file errcode_vpp.h
//! \brief Header file for VPP error codes
///////////////////////////////////////////////////////////////////////////////
#ifndef _ERRCODE_VPP_H_
#define _ERRCODE_VPP_H_
#define S_VPP( code ) ( E_SUC | E_VPP_BASE | ( (code) & 0xFFFF ) )
#define E_VPP( code ) ( E_ERR | E_VPP_BASE | ( (code) & 0xFFFF ) )
#define S_VPP_OK (S_OK)
/* error code */
#define VPP_E_NODEV E_VPP(1)
#define VPP_E_BADPARAM E_VPP(2)
#define VPP_E_BADCALL E_VPP(3)
#define VPP_E_UNSUPPORT E_VPP(4)
#define VPP_E_IOFAIL E_VPP(5)
#define VPP_E_UNCONFIG E_VPP(6)
#define VPP_E_CMDQFULL E_VPP(7)
#define VPP_E_FRAMEQFULL E_VPP(8)
#define VPP_E_BCMBUFFULL E_VPP(9)
#define VPP_E_NOMEM E_VPP(10)
#define VPP_EVBIBUFFULL E_VPP(11)
#define VPP_EHARDWAREBUSY E_VPP(12)
#endif //!< #ifndef _ERRCODE_VPP_H_
|
/*
* emergency module - basic support for emergency calls
*
* Copyright (C) 2014-2015 Robison Tesini & Evandro Villaron
*
* This file is part of opensips, a free SIP server.
*
* opensips 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
*
* opensips 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
*
* History:
* --------
* 2014-10-14 initial version (Villaron/Tesini)
* 2015-03-21 implementing subscriber function (Villaron/Tesini)
* 2015-04-29 implementing notifier function (Villaron/Tesini)
* 2015-08-05 code review (Villaron/Tesini)
*/
int post(char* url, char* xml,char** response); |
//
// FLViewController.h
// FreeLunchDemo
//
// Created by Patrick Perini on 1/25/14.
// Copyright (c) 2014 FreeLunch. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface FLViewController : UIViewController <MKMapViewDelegate>
#pragma mark - Properties
@property IBOutlet MKMapView *mapView;
@end
|
/* MJS Portable C Library.
* Module: error-messaging API - format "usage" message to stderr
* @(#) usage.c 1.0 25jan91 MJS
*
* Copyright (c) 1991 Mike Spooner
*----------------------------------------------------------------------
* 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.
*----------------------------------------------------------------------
* Source-code conforms to ANSI standard X3.159-1989.
*/
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
#include "mjsu.h"
#include "mjsuimpl.h"
/* emit fatal "usage" message to stderr, and always return NO.
* Message is prefixed with "usage: " and the process name.
*/
VOID usage(CHAR *fmt, ...)
{
va_list ap;
fprintf(stderr, "usage: %s ", process_name);
va_start(ap, fmt);
vfprintf(stderr, fmt ? fmt : "", ap);
va_end(ap);
fprintf(stderr, "\n");
exit(EXIT_FAILURE);
}
|
/*
* PearPC
* ppc_fpu.h
*
* Copyright (C) 2003, 2004 Sebastian Biallas (sb@biallas.net)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __PPC_FPU_H__
#define __PPC_FPU_H__
#include "skyeye_types.h"
#define FPU_SIGN_BIT (0x8000000000000000ULL)
#define FPD_SIGN(v) (((v)&FPU_SIGN_BIT)?1:0)
#define FPD_EXP(v) ((v)>>52)
#define FPD_FRAC(v) ((v)&0x000fffffffffffffULL)
#define FPS_SIGN(v) ((v)&0x80000000)
#define FPS_EXP(v) ((v)>>23)
#define FPS_FRAC(v) ((v)&0x007fffff)
// m must be uint64
#define FPD_PACK_VAR(f, s, e, m) (f) = ((s)?FPU_SIGN_BIT:0ULL)|((((uint64)(e))&0x7ff)<<52)|((m)&((1ULL<<52)-1))
#define FPD_UNPACK_VAR(f, s, e, m) {(s)=FPD_SIGN(f);(e)=FPD_EXP(f)&0x7ff;(m)=FPD_FRAC(f);}
#define FPS_PACK_VAR(f, s, e, m) (f) = ((s)?0x80000000:0)|((e)<<23)|((m)&0x7fffff)
#define FPS_UNPACK_VAR(f, s, e, m) {(s)=FPS_SIGN(f);(e)=FPS_EXP(f)&0xff;(m)=FPS_FRAC(f);}
#define FPD_UNPACK(freg, fvar) FPD_UNPACK(freg, fvar.s, fvar.e, fvar.m)
void ppc_fpu_test();
typedef enum {
ppc_fpr_norm,
ppc_fpr_zero,
ppc_fpr_NaN,
ppc_fpr_Inf,
}ppc_fpr_type;
typedef struct ppc_quadro_s {
ppc_fpr_type type;
int s;
int e;
uint64 m0; // most significant
uint64 m1; // least significant
}ppc_quadro;
typedef struct ppc_double_s {
ppc_fpr_type type;
int s;
int e;
uint64 m;
}ppc_double;
typedef struct ppc_single_s {
ppc_fpr_type type;
int s;
int e;
uint32 m;
}ppc_single;
double ppc_fpu_get_uint64(uint64 d);
double ppc_fpu_get_double(ppc_double *d);
void ppc_opc_fabsx();
void ppc_opc_faddx();
void ppc_opc_faddsx();
void ppc_opc_fcmpo();
void ppc_opc_fcmpu();
void ppc_opc_fctiwx();
void ppc_opc_fctiwzx();
void ppc_opc_fdivx();
void ppc_opc_fdivsx();
void ppc_opc_fmaddx();
void ppc_opc_fmaddsx();
void ppc_opc_fmrx();
void ppc_opc_fmsubx();
void ppc_opc_fmsubsx();
void ppc_opc_fmulx();
void ppc_opc_fmulsx();
void ppc_opc_fnabsx();
void ppc_opc_fnegx();
void ppc_opc_fnmaddx();
void ppc_opc_fnmaddsx();
void ppc_opc_fnmsubx();
void ppc_opc_fnmsubsx();
void ppc_opc_fresx();
void ppc_opc_frspx();
void ppc_opc_frsqrtex();
void ppc_opc_fselx();
void ppc_opc_fsqrtx();
void ppc_opc_fsqrtsx();
void ppc_opc_fsubx();
void ppc_opc_fsubsx();
#endif
|
/*
* Digest Authentication - Radius support
*
* Copyright (C) 2001-2003 FhG Fokus
*
* This file is part of Kamailio, a free SIP server.
*
* Kamailio 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
*
* Kamailio 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 AUTHORIZE_H
#define AUTHORIZE_H
#include "../../parser/msg_parser.h"
/*
* Authorize using Proxy-Authorize header field (no URI user parameter given)
*/
int radius_proxy_authorize_1(struct sip_msg* _msg, char* _realm, char* _s2);
/*
* Authorize using Proxy-Authorize header field (URI user parameter given)
*/
int radius_proxy_authorize_2(struct sip_msg* _msg, char* _realm, char* _uri_user);
/*
* Authorize using WWW-Authorization header field (no URI user parameter given)
*/
int radius_www_authorize_1(struct sip_msg* _msg, char* _realm, char* _s2);
/*
* Authorize using WWW-Authorization header field (URI user parameter given)
*/
int radius_www_authorize_2(struct sip_msg* _msg, char* _realm, char* _uri_user);
#endif /* AUTHORIZE_H */
|
#include "component.h"
#include <libmatecomponent.h>
#include <libart_lgpl/art_affine.h>
struct _SampleComponentPrivate {
MateComponent_Unknown server;
gdouble x;
gdouble y;
gdouble width;
gdouble height;
};
enum SIGNALS {
CHANGED,
LAST_SIGNAL
};
static guint signals [LAST_SIGNAL] = { 0 };
static GObjectClass *component_parent_class;
static void
sample_component_finalize (GObject *obj)
{
SampleComponent *comp = SAMPLE_COMPONENT (obj);
matecomponent_object_release_unref (comp->priv->server, NULL);
g_free (comp->priv);
component_parent_class->finalize (obj);
}
static void
sample_component_class_init (GObjectClass *klass)
{
component_parent_class = g_type_class_peek_parent (klass);
signals [CHANGED] = g_signal_new (
"changed", G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (SampleComponentClass, changed),
NULL, NULL, g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE, 0);
klass->finalize = sample_component_finalize;
}
static void
sample_component_instance_init (GObject *obj)
{
SampleComponent *comp = SAMPLE_COMPONENT (obj);
comp->priv = g_new0 (SampleComponentPrivate, 1);
comp->priv->server = CORBA_OBJECT_NIL;
comp->priv->x = 0.0;
comp->priv->y = 0.0;
comp->priv->height = 0.0;
comp->priv->width = 0.0;
}
GType
sample_component_get_type (void)
{
static GType type = 0;
if (!type) {
GTypeInfo info = {
sizeof (SampleComponentClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) sample_component_class_init,
NULL,
NULL, /* class_data */
sizeof (SampleComponent),
0, /* n_preallocs */
(GInstanceInitFunc) sample_component_instance_init
};
type = g_type_register_static (G_TYPE_OBJECT,
"SampleComponent",
&info, 0);
}
return type;
}
SampleComponent *
sample_component_new (gchar *object_id)
{
SampleComponent *comp;
MateComponent_Unknown server;
CORBA_Environment ev;
comp = g_object_new (SAMPLE_COMPONENT_TYPE, NULL);
CORBA_exception_init (&ev);
server = matecomponent_activation_activate_from_id (object_id, 0, NULL, &ev);
if ((server == CORBA_OBJECT_NIL) || MATECOMPONENT_EX (&ev)) {
CORBA_exception_free (&ev);
g_object_unref (G_OBJECT (comp));
return NULL;
}
comp->priv->server = matecomponent_object_dup_ref (server, &ev);
MateComponent_Unknown_unref (server, &ev);
CORBA_exception_free (&ev);
return comp;
}
SampleComponent *
sample_component_new_from_storage (MateComponent_Storage storage)
{
g_warning ("Nope, not yet. Storage loading be broke still.");
#if 0
MateComponent_Unknown persist;
MateComponent_Unknown prop_stream;
CORBA_Environment ev;
CORBA_exception_init (&ev);
switch (comp->priv->persist_type) {
case PSTREAM:
persist = MateComponent_Unknown_queryInterface (
comp->server, "IDL:MateComponent/PersistStream:1.0", &ev);
if (persist != CORBA_OBJECT_NIL) {
MateComponent_PersistStream_load (persist, subdir, "", &ev);
MateComponent_Unknown_unref (persist, &ev);
}
break;
case PSTORAGE:
persist = MateComponent_Unknown_queryInterface (
comp->server, "IDL:MateComponent/PersistStorage:1.0", &ev);
if (persist != CORBA_OBJECT_NIL) {
MateComponent_PersistStorage_load (persist, subdir, "", &ev);
MateComponent_Unknown_unref (persist, &ev);
}
break;
default:
g_warning ("Unexpected Persist type encountered.");
return;
}
if (MATECOMPONENT_EX (&ev)) {
char *msg = matecomponent_exception_get_text (&ev);
mate_warning_dialog (msg);
g_free (msg);
}
#endif
return NULL;
}
gboolean
sample_component_is_dirty (SampleComponent *comp)
{
CORBA_Environment ev;
MateComponent_Persist persist;
gboolean dirty = FALSE;
g_return_val_if_fail (SAMPLE_IS_COMPONENT (comp), FALSE);
CORBA_exception_init (&ev);
persist = MateComponent_Unknown_queryInterface (
comp->priv->server, "IDL:MateComponent/Persist:1.0", &ev);
if (persist != CORBA_OBJECT_NIL) {
dirty = MateComponent_Persist_isDirty (persist, &ev);
MateComponent_Unknown_unref (persist, &ev);
}
CORBA_exception_free (&ev);
return FALSE;
}
void
sample_component_move (SampleComponent *comp, gdouble x, gdouble y)
{
g_return_if_fail (SAMPLE_IS_COMPONENT (comp));
comp->priv->x = x;
comp->priv->y = y;
g_signal_emit (G_OBJECT (comp), signals [CHANGED], 0);
}
void
sample_component_resize (SampleComponent *comp, gdouble width, gdouble height)
{
g_return_if_fail (SAMPLE_IS_COMPONENT (comp));
comp->priv->width = width;
comp->priv->height = height;
g_signal_emit (G_OBJECT (comp), signals [CHANGED], 0);
}
void
sample_component_get_affine (SampleComponent *comp, gdouble *aff)
{
art_affine_identity (aff);
art_affine_translate (aff, comp->priv->x, comp->priv->y);
}
MateComponent_Unknown
sample_component_get_server (SampleComponent *comp)
{
return comp->priv->server;
}
|
/***************************************************************************
qgtp.h - description
-------------------
begin : Thu Nov 29 2001
copyright : (C) 2001 by PALM Thomas , DINTILHAC Florian, HIVERT Anthony, PIOC Sebastien
email :
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGTP_H
#define QGTP_H
#include <qapplication.h>
#include <q3process.h>
//#include "global.h"
#define IGTP_BUFSIZE 2048 /* Size of the response buffer */
#define OK 0
#define FAIL -1
/**
*@author PALM Thomas , DINTILHAC Florian, HIVERT Anthony, PIOC Sebastien
*/
class QGtp : public QObject{
Q_OBJECT
public slots:
void slot_readFromStdout();
void slot_processExited();
public:
QGtp();
~QGtp();
/****************************
* *
****************************/
QString getLastMessage();
int openGtpSession(QString filename, int size, float komi, int handicap, int level);
Q3Process * programProcess ;
void fflush(char * s);
/****************************
* Administrative commands. *
****************************/
int quit ();
/****************************
* Program identity. *
****************************/
int name ();
int protocolVersion ();
int version ();
/***************************
* Setting the board size. *
***************************/
int setBoardsize (int size);
int queryBoardsize();
/***************************
* Clearing the board. *
***************************/
int clearBoard ();
/************
* Setting. *
************/
int setKomi (float k);
int setLevel (int level);
/******************
* Playing moves. *
******************/
int playblack (char c, int j);
int playblackPass ();
int playwhite (char c, int j);
int playwhitePass ();
int fixedHandicap (int handicap);
int loadsgf (QString filename,int movNumber=0,char c='A',int i=0);
/*****************
* Board status. *
*****************/
int whatColor (char c, int j);
int countlib (char c, int j);
int findlib (char c, int j);
int isLegal (QString color, char c, int j);
int allLegal (QString color);
int captures (QString color);
/**********************
* Retractable moves. *
**********************/
int trymove (QString color, char c, int j);
int popgo ();
/*********************
* Tactical reading. *
*********************/
int attack (char c, int j);
int defend (char c, int j);
int increaseDepths ();
int decreaseDepths ();
/******************
* owl reading. *
******************/
int owlAttack (char c, int j);
int owlDefend (char c, int j);
/********
* eyes *
********/
int evalEye (char c, int j);
/*****************
* dragon status *
*****************/
int dragonStatus (char c, int j);
int sameDragon (char c1, int i1, char c2, int i2);
int dragonData ();
int dragonData (char c, int i);
/***********************
* combination attacks *
***********************/
int combinationAttack (QString color);
/********************
* generating moves *
********************/
int genmoveBlack ();
int genmoveWhite ();
int genmove (QString color,int seed=0);
int topMovesBlack ();
int topMovesWhite ();
int undo (int i=1);
int finalStatus (char c, int i, int seed=0);
int finalStatusList (QString status, int seed=0);
/**************
* score *
**************/
int finalScore (int seed=0);
int estimateScore ();
int newScore ();
/**************
* statistics *
**************/
int getLifeNodeCounter ();
int getOwlNodeCounter ();
int getReadingNodeCounter ();
int getTrymoveCounter ();
int resetLifeNodeCounter ();
int resetOwlNodeCounter ();
int resetReadingNodeCounter ();
int resetTrymoveCounter ();
/*********
* debug *
*********/
int showboard ();
int dumpStack ();
int debugInfluence (QString color, QString list);
int debugMoveInfluence (QString color, char c, int i, QString list);
int influence (QString color);
int moveInfluence (QString color, char c, int i);
int wormCutstone (char c, int i);
int wormData ();
int wormData (char c, int i);
int wormStones ();
int tuneMoveOrdering (int MOVE_ORDERING_PARAMETERS);
int echo (QString param);
int help ();
int reportUncertainty (QString s);
int shell(QString s);
int knownCommand(QString s);
private :
int _cpt; /* Number of the request */
char *_outFile;
char *outFile;
FILE *_inFile;
QString _response;
int waitResponse();
int waitResponseOld();
};
#endif
|
#ifndef _QUNIT_H_
#define _QUNIT_H_
#include <types.h>
#include <qstring.h>
void qunitLog(const char* msg);
void qunitWriteAssertionResults(const char* filename,
int lineno,
const char* expr,
const char* expected,
const char* actual,
bool matched);
void qunitQuit();
#define EXPECT_TRUE(EXPR) { bool _value = (EXPR); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#EXPR, \
"true", \
_value ? "true" : "false", \
_value);}
#define EXPECT_FALSE(EXPR) { bool _value = (EXPR); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#EXPR, \
"false", \
_value ? "true" : "false", \
!_value);}
#define EXPECT_EQ_INT(ACTUAL, EXPECTED) { \
int _expected = (EXPECTED), \
_actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
itoa(_actual), \
_actual == _expected);}
#define EXPECT_LT_INT(ACTUAL, EXPECTED) { \
int _expected = (EXPECTED), \
_actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
itoa(_actual), \
_actual < _expected);}
#define EXPECT_GT_INT(ACTUAL, EXPECTED) { \
int _expected = (EXPECTED), \
_actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
itoa(_actual), \
_actual > _expected);}
#define EXPECT_LE_INT(ACTUAL, EXPECTED) { \
int _expected = (EXPECTED), \
_actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
itoa(_actual), \
_actual <= _expected);}
#define EXPECT_GE_INT(ACTUAL, EXPECTED) { \
int _expected = (EXPECTED), \
_actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
itoa(_actual), \
_actual >= _expected);}
#define EXPECT_EQ_STR(ACTUAL, EXPECTED) { \
const char* _expected = (EXPECTED); \
const char* _actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
_actual, \
strcmp(_actual, _expected) == 0);}
#define EXPECT_LT_STR(ACTUAL, EXPECTED) { \
const char* _expected = (EXPECTED); \
const char* _actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
_actual, \
strcmp(_actual, _expected) < 0);}
#define EXPECT_GT_STR(ACTUAL, EXPECTED) { \
const char* _expected = (EXPECTED); \
const char* _actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
_actual, \
strcmp(_actual, _expected) > 0);}
#define EXPECT_LE_STR(ACTUAL, EXPECTED) { \
const char* _expected = (EXPECTED); \
const char* _actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
_actual, \
strcmp(_actual, _expected) <= 0);}
#define EXPECT_GE_STR(ACTUAL, EXPECTED) { \
const char* _expected = (EXPECTED); \
const char* _actual = (ACTUAL); \
qunitWriteAssertionResults(__FILE__, \
__LINE__, \
#ACTUAL, \
#EXPECTED, \
_actual, \
strcmp(_actual, _expected) >= 0);}
#endif /*_QUNIT_H_*/
|
/*
FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
***NOTE*** The exception to the GPL is included to allow you to distribute
a combined work that includes FreeRTOS without being obliged to provide the
source code for proprietary components outside of the FreeRTOS kernel.
FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public
License and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
http://www.FreeRTOS.org - Documentation, latest information, license and
contact details.
http://www.SafeRTOS.com - A version that is certified for use in safety
critical systems.
http://www.OpenRTOS.com - Commercial support, development, porting,
licensing and training services.
*/
/* FreeRTOS.org includes. */
#include "FreeRTOS.h"
#include "task.h"
/* Demo includes. */
#include "basic_io.h"
/* The task function. */
void vTaskFunction( void *pvParameters );
/* Define the strings that will be passed in as the task parameters. These are
defined const and off the stack to ensure they remain valid when the tasks are
executing. */
const char *pcTextForTask1 = "Task 1 is running\n";
const char *pcTextForTask2 = "Task 2 is running\n";
/*-----------------------------------------------------------*/
int main( void )
{
/* Create the first task at priority 1... */
xTaskCreate( vTaskFunction, "Task 1", 240, pcTextForTask1, 1, NULL );
/* ... and the second task at priority 2. The priority is the second to
last parameter. */
xTaskCreate( vTaskFunction, "Task 2", 240, pcTextForTask2, 2, NULL );
/* Start the scheduler so our tasks start executing. */
vTaskStartScheduler();
/* If all is well we will never reach here as the scheduler will now be
running. If we do reach here then it is likely that there was insufficient
heap available for the idle task to be created. */
for( ;; );
return 0;
}
/*-----------------------------------------------------------*/
void vTaskFunction( void *pvParameters )
{
char *pcTaskName;
/* The string to print out is passed in via the parameter. Cast this to a
character pointer. */
pcTaskName = ( char * ) pvParameters;
/* As per most tasks, this task is implemented in an infinite loop. */
for( ;; )
{
/* Print out the name of this task. */
vPrintString( pcTaskName );
/* Delay for a period. This time we use a call to vTaskDelay() which
puts the task into the Blocked state until the delay period has expired.
The delay period is specified in 'ticks'. */
vTaskDelay( 250 / portTICK_RATE_MS );
}
}
/*-----------------------------------------------------------*/
void vApplicationMallocFailedHook( void )
{
/* This function will only be called if an API call to create a task, queue
or semaphore fails because there is too little heap RAM remaining. */
for( ;; );
}
/*-----------------------------------------------------------*/
void vApplicationStackOverflowHook( xTaskHandle *pxTask, signed char *pcTaskName )
{
/* This function will only be called if a task overflows its stack. Note
that stack overflow checking does slow down the context switch
implementation. */
for( ;; );
}
/*-----------------------------------------------------------*/
void vApplicationIdleHook( void )
{
/* This example does not use the idle hook to perform any processing. */
}
/*-----------------------------------------------------------*/
void vApplicationTickHook( void )
{
/* This example does not use the tick hook to perform any processing. */
}
|
/*
Copyright (C) 2015- The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/
#ifndef DELTADB_REDUCTION_H
#define DELTADB_REDUCTION_H
#include "jx.h"
#include "hash_table.h"
typedef enum {
COUNT,
SUM,
FIRST,
LAST,
MIN,
AVERAGE,
MAX,
INC,
UNIQUE,
} deltadb_reduction_t;
typedef enum {
DELTADB_SCOPE_LOCAL,
DELTADB_SCOPE_GLOBAL,
} deltadb_scope_t;
struct deltadb_reduction {
deltadb_reduction_t type;
deltadb_scope_t scope;
struct jx *expr;
struct hash_table *unique_table;
struct jx *unique_value;
double count;
double sum;
double first;
double last;
double min;
double max;
};
struct deltadb_reduction *deltadb_reduction_create( const char *name, struct jx *expr, deltadb_scope_t scope );
void deltadb_reduction_delete( struct deltadb_reduction *r );
void deltadb_reduction_reset( struct deltadb_reduction *r, deltadb_scope_t scope );
void deltadb_reduction_update( struct deltadb_reduction *r, struct jx *value, deltadb_scope_t scope );
char * deltadb_reduction_string( struct deltadb_reduction *r );
#endif
|
//
// This file is part of the CAMGEN library.
// Copyright (C) 2013 Gijs van den Oord.
// CAMGEN is licensed under the GNU GPL, version 2,
// see COPYING for details.
//
#ifndef CAMGEN_SUSY_PARAMS_H_
#define CAMGEN_SUSY_PARAMS_H_
#ifndef CAMGEN_DEFAULT_MSLEPTON
#define CAMGEN_DEFAULT_MSLEPTON 300
#endif
#ifndef CAMGEN_DEFAULT_WSLEPTON
#define CAMGEN_DEFAULT_WSLEPTON 1.5
#endif
#ifndef CAMGEN_DEFAULT_MN0
#define CAMGEN_DEFAULT_MN0 200
#endif
#ifndef CAMGEN_DEFAULT_MSQUARK
#define CAMGEN_DEFAULT_MSQUARK 600
#endif
#endif /*CAMGEN_SUSY_PARAMS_H_*/
|
/*
* Carsten Langgaard, carstenl@mips.com
* Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
*
* This program is free software; you can distribute it and/or modify it
* under the terms of the GNU General Public License (Version 2) as
* published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
*
* Putting things on the screen/serial line using YAMONs facilities.
*/
#include <linux/config.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/serial_reg.h>
#include <linux/spinlock.h>
#include <asm/io.h>
#ifdef CONFIG_MIPS_ATLAS
#include <asm/mips-boards/atlas.h>
#ifdef CONFIG_CPU_LITTLE_ENDIAN
#define PORT(offset) (ATLAS_UART_REGS_BASE + ((offset)<<3))
#else
#define PORT(offset) (ATLAS_UART_REGS_BASE + 3 + ((offset)<<3))
#endif
#elif defined(CONFIG_MIPS_SEAD)
#include <asm/mips-boards/sead.h>
#ifdef CONFIG_CPU_LITTLE_ENDIAN
#define PORT(offset) (SEAD_UART0_REGS_BASE + ((offset)<<3))
#else
#define PORT(offset) (SEAD_UART0_REGS_BASE + 3 + ((offset)<<3))
#endif
#else
#define PORT(offset) (0x3f8 + (offset))
#endif
static inline unsigned int serial_in(int offset)
{
return inb(PORT(offset));
}
static inline void serial_out(int offset, int value)
{
outb(value, PORT(offset));
}
int putPromChar(char c)
{
while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
;
serial_out(UART_TX, c);
return 1;
}
char getPromChar(void)
{
while (!(serial_in(UART_LSR) & UART_LSR_DR))
;
return serial_in(UART_RX);
}
static spinlock_t con_lock = SPIN_LOCK_UNLOCKED;
static char buf[1024];
void __init prom_printf(char *fmt, ...)
{
va_list args;
int l;
char *p, *buf_end;
long flags;
spin_lock_irqsave(con_lock, flags);
va_start(args, fmt);
l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
va_end(args);
buf_end = buf + l;
for (p = buf; p < buf_end; p++) {
/* Crude cr/nl handling is better than none */
if (*p == '\n')
putPromChar('\r');
putPromChar(*p);
}
/* wait for output to drain */
while ((serial_in(UART_LSR) & UART_LSR_TEMT) == 0)
;
spin_unlock_irqrestore(con_lock, flags);
}
|
#include "uart_common.h"
int main() {
uart_puts("Hello world!\n");
while (1);
}
|
/* packet-dcerpc-rs_unix.c
*
* Routines for dcerpc Unix ops
* Copyright 2002, Jaime Fournier <Jaime.Fournier@hush.com>
* This information is based off the released idl files from opengroup.
* ftp://ftp.opengroup.org/pub/dce122/dce/src/security.tar.gz security/idl/rs_unix.idl
*
* $Id: packet-dcerpc-rs_unix.c 42429 2012-05-04 21:29:00Z wmeier $
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <glib.h>
#include <epan/packet.h>
#include "packet-dcerpc.h"
static int proto_rs_unix = -1;
static int hf_rs_unix_opnum = -1;
static gint ett_rs_unix = -1;
static e_uuid_t uuid_rs_unix = { 0x361993c0, 0xb000, 0x0000, { 0x0d, 0x00, 0x00, 0x87, 0x84, 0x00, 0x00, 0x00 } };
static guint16 ver_rs_unix = 1;
static dcerpc_sub_dissector rs_unix_dissectors[] = {
{ 0, "getpwents", NULL, NULL },
{ 0, NULL, NULL, NULL },
};
void
proto_register_rs_unix (void)
{
static hf_register_info hf[] = {
{ &hf_rs_unix_opnum,
{ "Operation", "rs_unix.opnum", FT_UINT16, BASE_DEC,
NULL, 0x0, NULL, HFILL }}
};
static gint *ett[] = {
&ett_rs_unix,
};
proto_rs_unix = proto_register_protocol ("DCE/RPC RS_UNIX", "RS_UNIX", "rs_unix");
proto_register_field_array (proto_rs_unix, hf, array_length (hf));
proto_register_subtree_array (ett, array_length (ett));
}
void
proto_reg_handoff_rs_unix (void)
{
/* Register the protocol as dcerpc */
dcerpc_init_uuid (proto_rs_unix, ett_rs_unix, &uuid_rs_unix, ver_rs_unix, rs_unix_dissectors, hf_rs_unix_opnum);
}
|
/* AbiSource Application Framework
* Copyright (C) 1998 AbiSource, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
* 02111-1307, USA.
*/
#ifndef XAP_PREVIEW_H
#define XAP_PREVIEW_H
/* pre-emptive dismissal; ut_types.h is needed by just about everything,
* so even if it's commented out in-file that's still a lot of work for
* the preprocessor to do...
*/
#ifndef UT_TYPES_H
#include "ut_types.h"
#endif
#include "ut_misc.h"
/* #include "ev_EditBits.h" */
class GR_Graphics;
class ABI_EXPORT XAP_Preview
{
public:
XAP_Preview(GR_Graphics * gc);
virtual ~XAP_Preview(void);
void setWindowSize(UT_sint32, UT_sint32);
inline UT_sint32 getWindowWidth(void) const { return m_iWindowWidth; };
inline UT_sint32 getWindowHeight(void) const { return m_iWindowHeight; };
// we probably don't need this one
/*
inline GR_Graphics * getGraphicsContext(void) const { return m_graphics; };
*/
// function triggered by platform events to handle any drawing
virtual void draw(void) = 0;
// function to handle mouse down event.
virtual void onLeftButtonDown(UT_sint32 /*x*/, UT_sint32 /*y*/) { };
protected:
XAP_Preview();
GR_Graphics * m_gc;
private:
// TODO :
// later we might add some useful high-level macro-like drawing functions
// for previews, like drawing page boundaries, etc.
UT_sint32 m_iWindowHeight;
UT_sint32 m_iWindowWidth;
};
#endif /* XAP_PREVIEW_H */
|
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2000-2012 Julian Seward
jseward@acm.org
Copyright (C) 2005-2012 Nicholas Nethercote
njn@valgrind.org
Copyright (C) 2006-2012 OpenWorks LLP
info@open-works.co.uk
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 GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_VKI_H
#define __PUB_CORE_VKI_H
#include "pub_tool_vki.h"
void VG_(vki_do_initial_consistency_checks)(void);
#endif
|
// File: $Id: variables.h,v 1.1 2001/11/10 02:18:42 p334-70f Exp p334-70f $
// Author: Benjamin Meyer
// Description:
//
// Revisions:
// $Log: variables.h,v $
// Revision 1.1 2001/11/10 02:18:42 p334-70f
// Initial revision
//
//
#ifndef VARIABLES_H
#define VARIABLES_H
#include <string>
#include <iostream>
#include <deque>
using namespace std;
struct hardValue{
int value;
int memoryLocation;
};
/*
struct variable{
string s;
int number;
int numberOfTimesUsed;
int memoryLocation;
};
*/
class Variables {
public:
Variables();
~Variables();
int prepare();
friend ostream &operator <<( ostream &out, const Variables &variable);
void output(ostream &out) const;
void setDebug( bool debug = false );
int asciiNumber(string s);
void isUsed(int var);
int memoryLocation(int var) const;
void saveNumber(int);
int getNumberMemoryLocation(int) const;
void boolTempMemoryLocation(bool inUse = true);
int getTempMemoryLocation();
private:
int usedVars[26];
int memLocation[26];
deque<hardValue*> numbers;
bool debug;
bool usingTempMemoryLocation;
int tempMemoryLocation;
/*
97 = a
122 = z
*/
};
#endif
|
// Copyright 2015 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <array>
#include <string>
#include "Common/CommonTypes.h"
#include "InputCommon/ControllerEmu/ControllerEmu.h"
#include "InputCommon/InputConfig.h"
namespace ControllerEmu
{
class ControllerEmu;
class Buttons;
}
enum Hotkey
{
HK_OPEN,
HK_CHANGE_DISC,
HK_EJECT_DISC,
HK_REFRESH_LIST,
HK_PLAY_PAUSE,
HK_STOP,
HK_RESET,
HK_FULLSCREEN,
HK_SCREENSHOT,
HK_EXIT,
HK_VOLUME_DOWN,
HK_VOLUME_UP,
HK_VOLUME_TOGGLE_MUTE,
HK_DECREASE_EMULATION_SPEED,
HK_INCREASE_EMULATION_SPEED,
HK_TOGGLE_THROTTLE,
HK_FRAME_ADVANCE,
HK_FRAME_ADVANCE_DECREASE_SPEED,
HK_FRAME_ADVANCE_INCREASE_SPEED,
HK_FRAME_ADVANCE_RESET_SPEED,
HK_START_RECORDING,
HK_PLAY_RECORDING,
HK_EXPORT_RECORDING,
HK_READ_ONLY_MODE,
HK_STEP,
HK_STEP_OVER,
HK_STEP_OUT,
HK_SKIP,
HK_SHOW_PC,
HK_SET_PC,
HK_BP_TOGGLE,
HK_BP_ADD,
HK_MBP_ADD,
HK_TRIGGER_SYNC_BUTTON,
HK_WIIMOTE1_CONNECT,
HK_WIIMOTE2_CONNECT,
HK_WIIMOTE3_CONNECT,
HK_WIIMOTE4_CONNECT,
HK_BALANCEBOARD_CONNECT,
HK_NEXT_WIIMOTE_PROFILE_1,
HK_PREV_WIIMOTE_PROFILE_1,
HK_NEXT_GAME_WIIMOTE_PROFILE_1,
HK_PREV_GAME_WIIMOTE_PROFILE_1,
HK_NEXT_WIIMOTE_PROFILE_2,
HK_PREV_WIIMOTE_PROFILE_2,
HK_NEXT_GAME_WIIMOTE_PROFILE_2,
HK_PREV_GAME_WIIMOTE_PROFILE_2,
HK_NEXT_WIIMOTE_PROFILE_3,
HK_PREV_WIIMOTE_PROFILE_3,
HK_NEXT_GAME_WIIMOTE_PROFILE_3,
HK_PREV_GAME_WIIMOTE_PROFILE_3,
HK_NEXT_WIIMOTE_PROFILE_4,
HK_PREV_WIIMOTE_PROFILE_4,
HK_NEXT_GAME_WIIMOTE_PROFILE_4,
HK_PREV_GAME_WIIMOTE_PROFILE_4,
HK_TOGGLE_CROP,
HK_TOGGLE_AR,
HK_TOGGLE_EFBCOPIES,
HK_TOGGLE_XFBCOPIES,
HK_TOGGLE_IMMEDIATE_XFB,
HK_TOGGLE_FOG,
HK_TOGGLE_DUMPTEXTURES,
HK_TOGGLE_TEXTURES,
HK_INCREASE_IR,
HK_DECREASE_IR,
HK_FREELOOK_DECREASE_SPEED,
HK_FREELOOK_INCREASE_SPEED,
HK_FREELOOK_RESET_SPEED,
HK_FREELOOK_UP,
HK_FREELOOK_DOWN,
HK_FREELOOK_LEFT,
HK_FREELOOK_RIGHT,
HK_FREELOOK_ZOOM_IN,
HK_FREELOOK_ZOOM_OUT,
HK_FREELOOK_RESET,
HK_TOGGLE_STEREO_SBS,
HK_TOGGLE_STEREO_TAB,
HK_TOGGLE_STEREO_ANAGLYPH,
HK_TOGGLE_STEREO_3DVISION,
HK_DECREASE_DEPTH,
HK_INCREASE_DEPTH,
HK_DECREASE_CONVERGENCE,
HK_INCREASE_CONVERGENCE,
HK_LOAD_STATE_SLOT_1,
HK_LOAD_STATE_SLOT_2,
HK_LOAD_STATE_SLOT_3,
HK_LOAD_STATE_SLOT_4,
HK_LOAD_STATE_SLOT_5,
HK_LOAD_STATE_SLOT_6,
HK_LOAD_STATE_SLOT_7,
HK_LOAD_STATE_SLOT_8,
HK_LOAD_STATE_SLOT_9,
HK_LOAD_STATE_SLOT_10,
HK_LOAD_STATE_SLOT_SELECTED,
HK_SAVE_STATE_SLOT_1,
HK_SAVE_STATE_SLOT_2,
HK_SAVE_STATE_SLOT_3,
HK_SAVE_STATE_SLOT_4,
HK_SAVE_STATE_SLOT_5,
HK_SAVE_STATE_SLOT_6,
HK_SAVE_STATE_SLOT_7,
HK_SAVE_STATE_SLOT_8,
HK_SAVE_STATE_SLOT_9,
HK_SAVE_STATE_SLOT_10,
HK_SAVE_STATE_SLOT_SELECTED,
HK_SELECT_STATE_SLOT_1,
HK_SELECT_STATE_SLOT_2,
HK_SELECT_STATE_SLOT_3,
HK_SELECT_STATE_SLOT_4,
HK_SELECT_STATE_SLOT_5,
HK_SELECT_STATE_SLOT_6,
HK_SELECT_STATE_SLOT_7,
HK_SELECT_STATE_SLOT_8,
HK_SELECT_STATE_SLOT_9,
HK_SELECT_STATE_SLOT_10,
HK_LOAD_LAST_STATE_1,
HK_LOAD_LAST_STATE_2,
HK_LOAD_LAST_STATE_3,
HK_LOAD_LAST_STATE_4,
HK_LOAD_LAST_STATE_5,
HK_LOAD_LAST_STATE_6,
HK_LOAD_LAST_STATE_7,
HK_LOAD_LAST_STATE_8,
HK_LOAD_LAST_STATE_9,
HK_LOAD_LAST_STATE_10,
HK_SAVE_FIRST_STATE,
HK_UNDO_LOAD_STATE,
HK_UNDO_SAVE_STATE,
HK_SAVE_STATE_FILE,
HK_LOAD_STATE_FILE,
NUM_HOTKEYS,
};
enum HotkeyGroup : int
{
HKGP_GENERAL,
HKGP_VOLUME,
HKGP_SPEED,
HKGP_FRAME_ADVANCE,
HKGP_MOVIE,
HKGP_STEPPING,
HKGP_PC,
HKGP_BREAKPOINT,
HKGP_WII,
HKGP_CONTROLLER_PROFILE,
HKGP_GRAPHICS_TOGGLES,
HKGP_IR,
HKGP_FREELOOK,
HKGP_3D_TOGGLE,
HKGP_3D_DEPTH,
HKGP_LOAD_STATE,
HKGP_SAVE_STATE,
HKGP_SELECT_STATE,
HKGP_LOAD_LAST_STATE,
HKGP_STATE_MISC,
NUM_HOTKEY_GROUPS,
};
struct HotkeyStatus
{
std::array<u32, NUM_HOTKEY_GROUPS> button;
s8 err;
};
class HotkeyManager : public ControllerEmu::EmulatedController
{
public:
HotkeyManager();
~HotkeyManager();
void GetInput(HotkeyStatus* const hk);
std::string GetName() const override;
ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group) const;
int FindGroupByID(int id) const;
int GetIndexForGroup(int group, int id) const;
void LoadDefaults(const ControllerInterface& ciface) override;
private:
std::array<ControllerEmu::Buttons*, NUM_HOTKEY_GROUPS> m_keys;
std::array<ControllerEmu::ControlGroup*, NUM_HOTKEY_GROUPS> m_hotkey_groups;
};
namespace HotkeyManagerEmu
{
void Initialize();
void Shutdown();
void LoadConfig();
InputConfig* GetConfig();
ControllerEmu::ControlGroup* GetHotkeyGroup(HotkeyGroup group);
void GetStatus();
bool IsEnabled();
void Enable(bool enable_toggle);
bool IsPressed(int Id, bool held);
}
|
/*
* mconfig_log.c - Part of AFD, an automatic file distribution program.
* Copyright (c) 2004 - 2017 Holger Kiehl <Holger.Kiehl@dwd.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "afddefs.h"
DESCR__S_M3
/*
** NAME
** mconfig_log - log configuration entries to system log
**
** SYNOPSIS
** void mconfig_log(int type, char *sign, char *fmt, ...)
**
** DESCRIPTION
** This function logs all configuration options to MON_LOG.
**
** RETURN VALUES
** None.
**
** AUTHOR
** H.Kiehl
**
** HISTORY
** 28.03.2004 H.Kiehl Created
**
*/
DESCR__E_M3
#include <stdio.h>
#include <stdarg.h> /* va_start(), va_end() */
#include <time.h> /* time(), localtime() */
#include <sys/types.h>
#include <unistd.h> /* write() */
#include <fcntl.h>
#include <errno.h>
#include "mon_ctrl.h"
#include "motif_common_defs.h"
/* External global variables. */
extern int mon_log_fd,
sys_log_fd;
#ifdef WITHOUT_FIFO_RW_SUPPORT
extern int mon_log_readfd,
sys_log_readfd;
#endif
extern char *p_work_dir,
user[];
/*############################ mconfig_log() ############################*/
void
mconfig_log(int type, char *sign, char *fmt, ...)
{
int *p_fd;
#ifdef WITHOUT_FIFO_RW_SUPPORT
int *p_readfd;
#endif
size_t length;
time_t tvalue;
char buf[MAX_LINE_LENGTH + 1];
va_list ap;
struct tm *p_ts;
if (type == SYS_LOG)
{
p_fd = &sys_log_fd;
#ifdef WITHOUT_FIFO_RW_SUPPORT
p_readfd = &sys_log_readfd;
#endif
}
else
{
p_fd = &mon_log_fd;
#ifdef WITHOUT_FIFO_RW_SUPPORT
p_readfd = &mon_log_readfd;
#endif
}
/*
* Only open sys_log_fd to MON_LOG when it is STDERR_FILENO.
* If it is STDOUT_FILENO it is an X application and here we do
* NOT wish to write to MON_SYS_LOG or MON_LOG.
*/
if ((*p_fd == STDERR_FILENO) && (p_work_dir != NULL))
{
char log_fifo[MAX_PATH_LENGTH];
(void)strcpy(log_fifo, p_work_dir);
(void)strcat(log_fifo, FIFO_DIR);
if (type == SYS_LOG)
{
(void)strcat(log_fifo, MON_SYS_LOG_FIFO);
}
else
{
(void)strcat(log_fifo, MON_LOG_FIFO);
}
#ifdef WITHOUT_FIFO_RW_SUPPORT
if (open_fifo_rw(log_fifo, p_readfd, p_fd) == -1)
#else
if ((*p_fd = open(log_fifo, O_RDWR)) == -1)
#endif
{
if (errno == ENOENT)
{
if ((make_fifo(log_fifo) == SUCCESS) &&
#ifdef WITHOUT_FIFO_RW_SUPPORT
(open_fifo_rw(log_fifo, p_readfd, p_fd) == -1))
#else
((*p_fd = open(log_fifo, O_RDWR)) == -1))
#endif
{
(void)fprintf(stderr,
"WARNING : Could not open fifo %s : %s (%s %d)\n",
log_fifo, strerror(errno), __FILE__, __LINE__);
}
}
else
{
(void)fprintf(stderr,
"WARNING : Could not open fifo %s : %s (%s %d)\n",
log_fifo, strerror(errno), __FILE__, __LINE__);
}
}
}
tvalue = time(NULL);
p_ts = localtime(&tvalue);
if (p_ts == NULL)
{
buf[0] = '?';
buf[1] = '?';
buf[2] = ' ';
buf[3] = '?';
buf[4] = '?';
buf[5] = ':';
buf[6] = '?';
buf[7] = '?';
buf[8] = ':';
buf[9] = '?';
buf[10] = '?';
}
else
{
buf[0] = (p_ts->tm_mday / 10) + '0';
buf[1] = (p_ts->tm_mday % 10) + '0';
buf[2] = ' ';
buf[3] = (p_ts->tm_hour / 10) + '0';
buf[4] = (p_ts->tm_hour % 10) + '0';
buf[5] = ':';
buf[6] = (p_ts->tm_min / 10) + '0';
buf[7] = (p_ts->tm_min % 10) + '0';
buf[8] = ':';
buf[9] = (p_ts->tm_sec / 10) + '0';
buf[10] = (p_ts->tm_sec % 10) + '0';
}
buf[11] = ' ';
buf[12] = sign[0];
buf[13] = sign[1];
buf[14] = sign[2];
buf[15] = ' ';
length = 16;
va_start(ap, fmt);
length += vsnprintf(&buf[length], MAX_LINE_LENGTH - length, fmt, ap);
va_end(ap);
if (length >= MAX_LINE_LENGTH)
{
length = MAX_LINE_LENGTH;
buf[length] = '\n';
}
else
{
length += sprintf(&buf[length], " (%s)\n", user);
if (length >= MAX_LINE_LENGTH)
{
length = MAX_LINE_LENGTH;
buf[length] = '\n';
}
}
if (write(*p_fd, buf, length) != length)
{
(void)fprintf(stderr,
"WARNING : write() error : %s (%s %d)\n",
strerror(errno), __FILE__, __LINE__);
}
return;
}
|
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
//
// Copyright : (C) 2015 Eran Ifrah
// File name : PHPWrokspaceStorageInterface.h
//
// -------------------------------------------------------------------------
// A
// _____ _ _ _ _
// / __ \ | | | | (_) |
// | / \/ ___ __| | ___| | _| |_ ___
// | | / _ \ / _ |/ _ \ | | | __/ _ )
// | \__/\ (_) | (_| | __/ |___| | || __/
// \____/\___/ \__,_|\___\_____/_|\__\___|
//
// F i l e
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#ifndef PHPWROKSPACE_STORAGE_INTERFACE_H
#define PHPWROKSPACE_STORAGE_INTERFACE_H
#include <wx/filename.h>
#include <wx/string.h>
#include <vector>
#include <set>
struct FileInfo {
wxFileName filename;
wxString folder;
size_t flags;
};
typedef std::vector<FileInfo> FileArray_t;
#endif // PHPWROKSPACE_STORAGE_INTERFACE_H
|
/* specfunc/gsl_sf_coupling.h
*
* Copyright (C) 1996,1997,1998,1999,2000,2001,2002 Gerard Jungman
*
* 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.
*/
/* Author: G. Jungman */
#ifndef __GSL_SF_COUPLING_H__
#define __GSL_SF_COUPLING_H__
#include <gsl/gsl_sf_result.h>
#undef __BEGIN_DECLS
#undef __END_DECLS
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS /* empty */
# define __END_DECLS /* empty */
#endif
__BEGIN_DECLS
/* 3j Symbols: / ja jb jc \
* \ ma mb mc /
*
* exceptions: GSL_EDOM, GSL_EOVRFLW
*/
int gsl_sf_coupling_3j_e(int two_ja, int two_jb, int two_jc,
int two_ma, int two_mb, int two_mc,
gsl_sf_result * result
);
double gsl_sf_coupling_3j(int two_ja, int two_jb, int two_jc,
int two_ma, int two_mb, int two_mc
);
/* 6j Symbols: / ja jb jc \
* \ jd je jf /
*
* exceptions: GSL_EDOM, GSL_EOVRFLW
*/
int gsl_sf_coupling_6j_e(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf,
gsl_sf_result * result
);
double gsl_sf_coupling_6j(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf
);
/* Racah W coefficients:
*
* W(a b c d; e f) = (-1)^{a+b+c+d} / a b e \
* \ d c f /
*
* exceptions: GSL_EDOM, GSL_EOVRFLW
*/
int gsl_sf_coupling_RacahW_e(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf,
gsl_sf_result * result
);
double gsl_sf_coupling_RacahW(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf
);
/* 9j Symbols: / ja jb jc \
* | jd je jf |
* \ jg jh ji /
*
* exceptions: GSL_EDOM, GSL_EOVRFLW
*/
int gsl_sf_coupling_9j_e(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf,
int two_jg, int two_jh, int two_ji,
gsl_sf_result * result
);
double gsl_sf_coupling_9j(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf,
int two_jg, int two_jh, int two_ji
);
/* INCORRECT version of 6j Symbols:
* This function actually calculates
* / ja jb je \
* \ jd jc jf /
* It represents the original implementation,
* which had the above permutation of the
* arguments. This was wrong and confusing,
* and I had to fix it. Sorry for the trouble.
* [GJ] Tue Nov 26 12:53:39 MST 2002
*
* exceptions: GSL_EDOM, GSL_EOVRFLW
*/
#ifndef GSL_DISABLE_DEPRECATED
int gsl_sf_coupling_6j_INCORRECT_e(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf,
gsl_sf_result * result
);
double gsl_sf_coupling_6j_INCORRECT(int two_ja, int two_jb, int two_jc,
int two_jd, int two_je, int two_jf
);
#endif /* !GSL_DISABLE_DEPRECATED */
__END_DECLS
#endif /* __GSL_SF_COUPLING_H__ */
|
/*
* Flare Tiled Plugin
* Copyright 2010, Jaderamiso <jaderamiso@gmail.com>
* Copyright 2011, Stefan Beller <stefanbeller@googlemail.com>
*
* This file is part of Tiled.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FLAREPLUGIN_H
#define FLAREPLUGIN_H
#include "flare_global.h"
#include "mapwriterinterface.h"
#include <QObject>
#include <QMap>
namespace Flare {
class FLARESHARED_EXPORT FlarePlugin
: public QObject
, public Tiled::MapWriterInterface
{
Q_OBJECT
Q_INTERFACES(Tiled::MapWriterInterface)
public:
FlarePlugin();
// MapWriterInterface
bool write(const Tiled::Map *map, const QString &fileName);
QString nameFilter() const;
QString errorString() const;
private:
bool checkOneLayerWithName(const Tiled::Map *map, const QString &name);
QString mError;
};
} // namespace Flare
#endif // FLAREPLUGIN_H
|
/*
* BESSELFUNC.C: polynomial approximations to Bessel functions.
* bessi0, bessi1, bessk0, bessk1
*
* Reference: Abramowitz & Stegun, chapter 9.
*
* 29-jul-92 deleted explicit math.h references for convex PJT
* 22-jan-95 ansi prototypes pjt
*
* TODO: gnu-C libraries have the bessel functions builtin...
* check out:
* besj0 besj1 besjn besy0 besy1 besyn
* dbesj0 dbesj1 dbesjn dbesy0 dbesy1 dbesyn
*/
#include <stdinc.h>
/*
* BESSI0: modified Bessel function I0(x). See A&S 9.8.1, 9.8.2.
*/
double bessi0(double x)
{
double t, tt, ti, u;
t = ABS(x) / 3.75;
tt = t * t;
if (tt < 1.0) {
u = 1.0 +
tt * (3.5156229 +
tt * (3.0899424 +
tt * (1.2067492 +
tt * (0.2659732 +
tt * (0.0360768 +
tt * 0.0045813)))));
return (u);
} else {
ti = 1.0 / t;
u = 0.39894228 +
ti * (0.01328592 +
ti * (0.00225319 +
ti * (-0.00157565 +
ti * (0.00916281 +
ti * (-0.02057706 +
ti * (0.02635537 +
ti * (-0.01647633 +
ti * 0.00392377)))))));
return (u * exp(ABS(x)) / sqrt(ABS(x)));
}
}
/*
* BESSI1: modified Bessel function I1(x). See A&S 9.8.3, 9.8.4.
*/
double bessi1(double x)
{
double t, tt, ti, u;
t = x / 3.75;
tt = t * t;
if (tt < 1.0) {
u = 0.5 +
tt * (0.87890594 +
tt * (0.51498869 +
tt * (0.15084934 +
tt * (0.02658733 +
tt * (0.00301532 +
tt * 0.00032411)))));
return (u * x);
} else {
if (t < 0.0)
error("bessi1: invalid for x < -3.75\n");
ti = 1.0 / t;
u = 0.39894228 +
ti * (-0.03988024 +
ti * (-0.00362018 +
ti * (0.00163801 +
ti * (-0.01031555 +
ti * (0.02282967 +
ti * (-0.02895312 +
ti * (0.01787654 +
ti * -0.00420059)))))));
return (u * exp(ABS(x)) / sqrt(ABS(x)));
}
}
/*
* BESSK0: modified Bessel function K0(x). See A&S 9.8.5, 9.8.6.
*/
double bessk0(double x)
{
double t, tt, ti, u;
if (x < 0.0) error("bessk0(%g): negative argument",x);
t = x / 2.0;
if (t < 1.0) {
tt = t * t;
u = -0.57721566 +
tt * (0.42278420 +
tt * (0.23069756 +
tt * (0.03488590 +
tt * (0.00262698 +
tt * (0.00010750 +
tt * 0.00000740)))));
return (u - log(t) * bessi0(x));
} else {
ti = 1.0 / t;
u = 1.25331414 +
ti * (-0.07832358 +
ti * (0.02189568 +
ti * (-0.01062446 +
ti * (0.00587872 +
ti * (-0.00251540 +
ti * 0.00053208)))));
return (u * exp(- x) / sqrt(x));
}
}
/*
* BESSK1: modified Bessel function K1(x). See A&S 9.8.7, 9.8.8.
*/
double bessk1(double x)
{
double t, tt, ti, u;
if (x < 0.0) error("bessk1(%g): negative argument",x);
t = x / 2.0;
if (t < 1.0) {
tt = t * t;
u = 1.0 +
tt * (0.15443144 +
tt * (-0.67278579 +
tt * (-0.18156897 +
tt * (-0.01919402 +
tt * (-0.00110404 +
tt * -0.00004686)))));
return (u / x + log(t) * bessi1(x));
} else {
ti = 1.0 / t;
u = 1.25331414 +
ti * (0.23498619 +
ti * (-0.03655620 +
ti * (0.01504268 +
ti * (-0.00780353 +
ti * (0.00325614 +
ti * -0.00068245)))));
return (u * exp(- x) / sqrt(x));
}
}
#ifdef TESTBED
#include <getparam.h>
#define MAXX 1000
string defv[] = {
"x=4.5",
NULL,
};
nemo_main()
{
double x,xa[MAXX], ex;
int i, n;
n = nemoinpd(getparam("x"),xa,MAXX);
dprintf(0,"Abr.&Steg. tabulate I's and K's with an extra factor exp(+/-x)\n");
dprintf(0,"x {I0 I1}*exp(-x) {K0 K1}*exp(x) \n");
for (i=0; i<n; i++) {
x = xa[i];
ex = exp(x);
printf("%g %g %g %g %g\n",
x, bessi0(x)/ex, bessi1(x)/ex, bessk0(x)*ex, bessk1(x)*ex);
}
}
#endif
#if 0
bessi0(x), bessi0(x) / ex
bessi1(x), bessi1(x) / ex
bessk0(x), ex * bessk0(x)
bessk1(x), ex * bessk1(x)
#endif
|
#include <stdlib.h>
#include <stdio.h>
#define offsetof(TYPE, MEMBER) ((size_t) &(((TYPE *)0)->MEMBER))
struct student
{
char gender;
char grade;
char prize;
int id;
char swimming;
int age;
char name[20];
};
int main()
{
struct student xiaoming;
printf("offset of gender is %d\n", offsetof(struct student, gender));
printf("offset of grade is %d\n", offsetof(struct student, grade));
printf("offset of prize is %d\n", offsetof(struct student, prize));
printf("offset of id is %d\n", offsetof(struct student, id));
printf("offset of swimming is %d\n", offsetof(struct student, swimming));
printf("offset of age is %d\n", offsetof(struct student, age));
printf("offset of name is %d\n", offsetof(struct student, name));
return 0;
}
|
#ifndef TRANSPORTER_H
#define TRANSPORTER_H
#include <fstream>
#include <stdexcept>
#include "constants.h"
#include "helper.h"
/*****************************************************
* Reads contents of a file and writes to an output *
* file. In order to minimize memory usage, I/O is *
* performed by utilizing a buffer. *
* Buffer's size is defined in constants.h *
****************************************************/
void transfer(std::istream& in, std::ostream& out, unsigned long to_read) {
if(!in || !out) {
throw std::runtime_error("transfer function error: one of the I/O streams is not open.");
}
//if buffer_size is larger than the amount of data to read, there is no point to use the buffer
unsigned long actual_buffer_size = buffer_size > to_read ? to_read : buffer_size;
char *buffer = new char[actual_buffer_size];
do {
//try to read enough data to fill the buffer
in.read(buffer, actual_buffer_size);
//only writes as much as read in previous line
//this way there is no need for an extra iteration
//at the end of the loop for possible remaining data.
out.write(buffer, in.gcount());
to_read -= in.gcount();
} while(to_read > 0 && in.gcount() > 0);
delete[] buffer;
}
#endif
|
#include "keymatrix.h"
///////////////////////////////////////////////////////////////////////////////
// rows are driven, cols are measured (Port B)
// one row is set to GND, the others are held floating
// columns have pull-ups enabled
uint8_t scan_keymatrix() {
uint8_t val = 0, i = 0;
INIT_COL();
// give everything time to settle
// (we have quite a high capacitive load due to long wires)
SHORT_SLEEP();
// for(i = 0 to 5)
#define F(i) \
do { \
ALL_ROWS_Z(); \
DRIVE_ROW(i); \
SHORT_SLEEP(); \
val = READ_COL(); \
if (val) { \
return DISC_LOG(val) + i*6; \
} \
} while(0);
FOR_0_TO_5();
#undef F
return 0; // no key pressed
}
///////////////////////////////////////////////////////////////////////////////
|
/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef MSM_ACTUATOR_H
#define MSM_ACTUATOR_H
#include <linux/i2c.h>
#include <linux/gpio.h>
#include <mach/camera2.h>
#include <media/v4l2-subdev.h>
#include <media/msmb_camera.h>
#include "msm_camera_i2c.h"
#define DEFINE_MSM_MUTEX(mutexname) \
static struct mutex mutexname = __MUTEX_INITIALIZER(mutexname)
struct msm_actuator_ctrl_t;
enum msm_actuator_state_t {
ACTUATOR_POWER_UP,
ACTUATOR_POWER_DOWN,
};
struct msm_actuator_func_tbl {
int32_t (*actuator_i2c_write_b_af)(struct msm_actuator_ctrl_t *,
uint8_t,
uint8_t);
int32_t (*actuator_init_step_table)(struct msm_actuator_ctrl_t *,
struct msm_actuator_set_info_t *);
int32_t (*actuator_init_focus)(struct msm_actuator_ctrl_t *,
uint16_t, enum msm_actuator_data_type, struct reg_settings_t *);
int32_t (*actuator_set_default_focus) (struct msm_actuator_ctrl_t *,
struct msm_actuator_move_params_t *);
int32_t (*actuator_move_focus) (struct msm_actuator_ctrl_t *,
struct msm_actuator_move_params_t *);
void (*actuator_parse_i2c_params)(struct msm_actuator_ctrl_t *,
int16_t, uint32_t, uint16_t);
void (*actuator_write_focus)(struct msm_actuator_ctrl_t *,
uint16_t,
struct damping_params_t *,
int8_t,
int16_t);
int32_t (*actuator_set_position)(struct msm_actuator_ctrl_t *,
struct msm_actuator_set_position_t *);
};
struct msm_actuator {
enum actuator_type act_type;
struct msm_actuator_func_tbl func_tbl;
};
struct msm_actuator_ctrl_t {
struct i2c_driver *i2c_driver;
struct platform_driver *pdriver;
struct platform_device *pdev;
struct msm_camera_i2c_client i2c_client;
enum msm_camera_device_type_t act_device_type;
struct msm_sd_subdev msm_sd;
enum af_camera_name cam_name;
struct mutex *actuator_mutex;
struct msm_actuator_func_tbl *func_tbl;
enum msm_actuator_data_type i2c_data_type;
struct v4l2_subdev sdev;
struct v4l2_subdev_ops *act_v4l2_subdev_ops;
int16_t curr_step_pos;
uint16_t curr_region_index;
uint16_t *step_position_table;
struct region_params_t region_params[MAX_ACTUATOR_REGION];
uint16_t reg_tbl_size;
struct msm_actuator_reg_params_t reg_tbl[MAX_ACTUATOR_REG_TBL_SIZE];
uint16_t region_size;
void *user_data;
uint32_t vcm_pwd;
uint32_t vcm_enable;
uint32_t total_steps;
uint16_t pwd_step;
uint16_t initial_code;
struct msm_camera_i2c_reg_array *i2c_reg_tbl;
uint16_t i2c_tbl_index;
enum cci_i2c_master_t cci_master;
uint32_t subdev_id;
enum msm_actuator_state_t actuator_state;
uint32_t valid_position;
};
#endif
|
//
// LMPropertyApperenceVC.h
// IUEditor
//
// Created by jd on 4/10/14.
// Copyright (c) 2014 JDLab. All rights reserved.
//
#import <Cocoa/Cocoa.h>
#import "IUController.h"
@interface LMPropertyBorderVC : NSViewController
@property (nonatomic) IUController *controller;
@end |
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
http://lammps.sandia.gov, Sandia National Laboratories
Steve Plimpton, sjplimp@sandia.gov
Copyright (2003) Sandia Corporation. Under the terms of Contract
DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains
certain rights in this software. This software is distributed under
the GNU General Public License.
See the README file in the top-level LAMMPS directory.
------------------------------------------------------------------------- */
#ifdef FIX_CLASS
FixStyle(efield,FixEfield)
#else
#ifndef LMP_FIX_EFIELD_H
#define LMP_FIX_EFIELD_H
#include "fix.h"
namespace LAMMPS_NS {
class FixEfield : public Fix {
public:
FixEfield(class LAMMPS *, int, char **);
~FixEfield();
int setmask();
void init();
void setup(int);
void min_setup(int);
void post_force(int);
void post_force_respa(int, int, int);
void min_post_force(int);
double memory_usage();
double compute_scalar();
double compute_vector(int);
private:
double ex,ey,ez;
int varflag,iregion;;
char *xstr,*ystr,*zstr,*estr;
char *idregion;
int xvar,yvar,zvar,evar,xstyle,ystyle,zstyle,estyle;
int nlevels_respa;
double qe2f;
int qflag,muflag;
int maxatom;
double **efield;
int force_flag;
double fsum[4],fsum_all[4];
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Illegal ... command
Self-explanatory. Check the input script syntax and compare to the
documentation for the command. You can use -echo screen as a
command-line option when running LAMMPS to see the offending line.
E: Region ID for fix efield does not exist
Self-explanatory.
E: Fix efield requires atom attribute q or mu
The atom style defined does not have this attribute.
E: Variable name for fix efield does not exist
Self-explanatory.
E: Variable for fix efield is invalid style
The variable must be an equal- or atom-style variable.
E: Region ID for fix aveforce does not exist
Self-explanatory.
E: Fix efield with dipoles cannot use atom-style variables
This option is not supported.
W: The minimizer does not re-orient dipoles when using fix efield
This means that only the atom coordinates will be minimized,
not the orientation of the dipoles.
E: Cannot use variable energy with constant efield in fix efield
LAMMPS computes the energy itself when the E-field is constant.
E: Must use variable energy with fix efield
You must define an energy when performing a minimization with a
variable E-field.
*/
|
/**
* collectd - src/irq.c
* Copyright (C) 2007 Peter Holik
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Peter Holik <peter at holik.at>
**/
#include "collectd.h"
#include "common.h"
#include "plugin.h"
#include "configfile.h"
#if !KERNEL_LINUX
# error "No applicable input method."
#endif
#define BUFSIZE 128
/*
* (Module-)Global variables
*/
static const char *config_keys[] =
{
"Irq",
"IgnoreSelected"
};
static int config_keys_num = STATIC_ARRAY_SIZE (config_keys);
static unsigned int *irq_list;
static unsigned int irq_list_num;
/*
* irq_list_action:
* 0 => default is to collect selected irqs
* 1 => ignore selcted irqs
*/
static int irq_list_action;
static int irq_config (const char *key, const char *value)
{
if (strcasecmp (key, "Irq") == 0)
{
unsigned int *temp;
unsigned int irq;
char *endptr;
temp = (unsigned int *) realloc (irq_list, (irq_list_num + 1) * sizeof (unsigned int *));
if (temp == NULL)
{
fprintf (stderr, "irq plugin: Cannot allocate more memory.\n");
ERROR ("irq plugin: Cannot allocate more memory.");
return (1);
}
irq_list = temp;
/* Clear errno, because we need it to see if an error occured. */
errno = 0;
irq = strtol(value, &endptr, 10);
if ((endptr == value) || (errno != 0))
{
fprintf (stderr, "irq plugin: Irq value is not a "
"number: `%s'\n", value);
ERROR ("irq plugin: Irq value is not a "
"number: `%s'", value);
return (1);
}
irq_list[irq_list_num] = irq;
irq_list_num++;
}
else if (strcasecmp (key, "IgnoreSelected") == 0)
{
if ((strcasecmp (value, "True") == 0)
|| (strcasecmp (value, "Yes") == 0)
|| (strcasecmp (value, "On") == 0))
irq_list_action = 1;
else
irq_list_action = 0;
}
else
{
return (-1);
}
return (0);
}
/*
* Check if this interface/instance should be ignored. This is called from
* both, `submit' and `write' to give client and server the ability to
* ignore certain stuff..
*/
static int check_ignore_irq (const unsigned int irq)
{
int i;
if (irq_list_num < 1)
return (0);
for (i = 0; (unsigned int)i < irq_list_num; i++)
if (irq == irq_list[i])
return (irq_list_action);
return (1 - irq_list_action);
}
static void irq_submit (unsigned int irq, counter_t value)
{
value_t values[1];
value_list_t vl = VALUE_LIST_INIT;
int status;
if (check_ignore_irq (irq))
return;
values[0].counter = value;
vl.values = values;
vl.values_len = 1;
vl.time = time (NULL);
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "irq", sizeof (vl.plugin));
sstrncpy (vl.type, "irq", sizeof (vl.type));
status = ssnprintf (vl.type_instance, sizeof (vl.type_instance),
"%u", irq);
if ((status < 1) || ((unsigned int)status >= sizeof (vl.type_instance)))
return;
plugin_dispatch_values (&vl);
} /* void irq_submit */
static int irq_read (void)
{
#undef BUFSIZE
#define BUFSIZE 256
FILE *fh;
char buffer[BUFSIZE];
unsigned int irq;
unsigned int irq_value;
long value;
char *endptr;
int i;
char *fields[64];
int fields_num;
if ((fh = fopen ("/proc/interrupts", "r")) == NULL)
{
char errbuf[1024];
WARNING ("irq plugin: fopen (/proc/interrupts): %s",
sstrerror (errno, errbuf, sizeof (errbuf)));
return (-1);
}
while (fgets (buffer, BUFSIZE, fh) != NULL)
{
fields_num = strsplit (buffer, fields, 64);
if (fields_num < 2)
continue;
errno = 0; /* To distinguish success/failure after call */
irq = strtol (fields[0], &endptr, 10);
if ((endptr == fields[0]) || (errno != 0) || (*endptr != ':'))
continue;
irq_value = 0;
for (i = 1; i < fields_num; i++)
{
errno = 0;
value = strtol (fields[i], &endptr, 10);
if ((*endptr != '\0') || (errno != 0))
break;
irq_value += value;
} /* for (i) */
irq_submit (irq, irq_value);
}
fclose (fh);
return (0);
} /* int irq_read */
void module_register (void)
{
plugin_register_config ("irq", irq_config,
config_keys, config_keys_num);
plugin_register_read ("irq", irq_read);
} /* void module_register */
#undef BUFSIZE
|
/******************************************************************************
*
* Copyright (C), 2001-2011, Huawei Tech. Co., Ltd.
* All Rights Reserved
*
*------------------------------------------------------------------------------
* Project Code : VRP5.0
* Module Name : IP6 ND
* Version : IPBIRV100R003.IPv6.E001
* File Name : Nd_nbcache.h
* Create Date : 2003/06/25
* Author : Santosh G Kulkarni
* Description : the interface module of ND
*------------------------------------------------------------------------------
* Modification History
*
* DATE NAME DESCRIPTION
* ----------------------------------------------------------------------------
* 2003-06-25 Santosh G Kulkarni Create
*******************************************************************************/
#ifndef _ND_NBCACHE_H_
#define _ND_NBCACHE_H_
#ifdef __cplusplus
extern "C"{
#endif
/*----------------------------------------------*
* external variables *
*----------------------------------------------*/
/*----------------------------------------------*
* external routine prototypes *
*----------------------------------------------*/
/*----------------------------------------------*
* internal routine prototypes *
*----------------------------------------------*/
/*----------------------------------------------*
* project-wide global variables *
*----------------------------------------------*/
/*----------------------------------------------*
* module-wide global variables *
*----------------------------------------------*/
/*----------------------------------------------*
* constants *
*----------------------------------------------*/
/*----------------------------------------------*
* macros *
*----------------------------------------------*/
/* NA message flag values */
#define ND_ISNOTROUTER 0
#define ND_ISROUTER 1
#define ND_HAVENOLLA 0
#define ND_HAVELLA 1
/* Avail value (ND_PAF_INF_NBENTRIES_AVAIL) will not exceed entries to delete
(g_ulNDEntryToDelete)
Minimum value for 'ND_PAF_INF_NBENTRIES_AVAIL' is 128
Default 'g_ulNDEntryToDelete' is 100
'g_ulNDEntryToDelete' can configure less than avail value */
#define IP6_ND_PERMISSIBLE_LIMIT \
(ND_PAF_INF_NBENTRIES_AVAIL - g_ulNDEntryToDelete)
/* Macro to define default number of force delete neighbor cache entries */
#define IP6_ND_NBENTRYDELBYFORCE 100
/* Macro to define max number of neighbor cache entries to be delete at a
time */
#define IP6_ND_MAXDELETEATATIME 10
/* Macro to remove Magic Number */
#define TIMEDELAY_500 500
/*----------------------------------------------*
* routines' implementations *
*----------------------------------------------*/
#ifdef __cplusplus
}
#endif /* end of __cplusplus */
#endif /* end of _ND_NBCACHE_H_ */
|
/*
* File : idle.c
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2009, 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
* 2006-03-23 Bernard the first version
*/
#include <rthw.h>
#include <rtthread.h>
#include "kservice.h"
#if defined (RT_USING_HOOK) || defined(RT_USING_HEAP)
#define IDLE_THREAD_STACK_SIZE 256
#else
#define IDLE_THREAD_STACK_SIZE 128
#endif
static struct rt_thread idle;
ALIGN(RT_ALIGN_SIZE)
static rt_uint8_t rt_thread_stack[IDLE_THREAD_STACK_SIZE];
#ifdef RT_USING_HEAP
extern rt_list_t rt_thread_defunct;
#endif
#ifdef RT_USING_HOOK
/**
* @addtogroup Hook
*/
/*@{*/
static void (*rt_thread_idle_hook)();
/**
* This function will set a hook function to idle thread loop.
*
* @param hook the specified hook function
*
* @note the hook function must be simple and never be blocked or suspend.
*/
void rt_thread_idle_sethook(void (*hook)())
{
rt_thread_idle_hook = hook;
}
/*@}*/
#endif
static void rt_thread_idle_entry(void* parameter)
{
while (1)
{
#ifdef RT_USING_HOOK
/* if there is an idle thread hook */
if (rt_thread_idle_hook != RT_NULL) rt_thread_idle_hook();
#endif
#ifdef RT_USING_HEAP
/* check the defunct thread list */
if (!rt_list_isempty(&rt_thread_defunct))
{
rt_base_t lock;
struct rt_thread* thread = rt_list_entry(rt_thread_defunct.next, struct rt_thread, tlist);
/* disable interrupt */
lock = rt_hw_interrupt_disable();
rt_list_remove(&(thread->tlist));
/* enable interupt */
rt_hw_interrupt_enable(lock);
/* release thread's stack */
rt_free(thread->stack_addr);
/* delete thread object */
rt_object_delete((rt_object_t)thread);
}
#endif
}
}
/**
* @addtogroup SystemInit
*/
/*@{*/
/**
* This function will initialize idle thread, then start it.
*
* @note this function must be invoked when system init.
*/
void rt_thread_idle_init()
{
/* init thread */
rt_thread_init(&idle,
"tidle",
rt_thread_idle_entry, RT_NULL,
&rt_thread_stack[0], sizeof(rt_thread_stack),
RT_THREAD_PRIORITY_MAX - 1, 32);
/* startup */
rt_thread_startup(&idle);
}
/*@}*/
|
/**
* @file score/src/ts64equalto.c
*/
/*
* COPYRIGHT (c) 1989-2008.
* 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$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/score/timestamp.h>
#if CPU_TIMESTAMP_USE_INT64 == TRUE
bool _Timestamp64_Equal_to(
const Timestamp64_Control *_lhs,
const Timestamp64_Control *_rhs
)
{
_Timestamp64_implementation_Equal_to( _lhs, _rhs );
}
#endif
|
#ifndef _ASM_PAGE_OFFSET_H
#define _ASM_PAGE_OFFSET_H
#define PAGE_OFFSET_RAW CONFIG_KERNEL_RAM_BASE_ADDRESS
#endif
|
#pragma push_pop_trampolines true
#pragma safe_stack true
// This should use trampolines if safe stack is enabled,
// the threshold is then lowered to 2
main() {
two1(1, 2);
two2(1, 2);
two3(1, 2);
two4(1, 2);
two5(1, 2);
}
two1(a,b) { nop(); }
two2(a,b) { nop(); }
two3(a,b) { nop(); }
two4(a,b) { nop(); }
two5(a,b) { nop(); }
nop() {}
|
#ifndef __LINSCHED_SHMBUF_H
#define __LINSCHED_SHMBUF_H
#include <asm-generic/shmbuf.h>
#endif
|
/*
* Copyright (C) 2009 Joby Energy
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
/** \file csc_ap.c
*/
#include <inttypes.h>
#include "commands.h"
#include "mercury_xsens.h"
#include "firmwares/rotorcraft/autopilot.h"
#include "firmwares/rotorcraft/stabilization.h"
#include "firmwares/rotorcraft/stabilization/stabilization_attitude.h"
#include "led.h"
#include "math/pprz_algebra_float.h"
#include "string.h"
#include "subsystems/radio_control.h"
#include "mercury_supervision.h"
#include "firmwares/rotorcraft/actuators.h"
#include "props_csc.h"
#include "csc_booz2_guidance_v.h"
static const int xsens_id = 0;
// based on booz2_autopilot.c - 4c4112f044adeb48c5af7afbc070863839f697c9
// -- mmt 6/15/09
uint8_t booz2_autopilot_mode;
uint8_t booz2_autopilot_mode_auto2;
bool_t booz2_autopilot_motors_on;
bool_t booz2_autopilot_in_flight;
uint32_t booz2_autopilot_motors_on_counter;
uint32_t booz2_autopilot_in_flight_counter;
uint16_t mercury_yaw_servo_gain;
uint8_t props_enable[PROPS_NB];
uint8_t props_throttle_pass;
#define BOOZ2_AUTOPILOT_MOTOR_ON_TIME (512/4)
#define BOOZ2_AUTOPILOT_IN_FLIGHT_TIME 40
#define BOOZ2_AUTOPILOT_THROTTLE_TRESHOLD (MAX_PPRZ * -14 / 20)
#define BOOZ2_AUTOPILOT_YAW_TRESHOLD (MAX_PPRZ * 14 / 20)
void csc_ap_init(void) {
booz2_autopilot_mode = AP_MODE_FAILSAFE;
booz2_autopilot_motors_on = FALSE;
booz2_autopilot_in_flight = FALSE;
booz2_autopilot_motors_on_counter = 0;
booz2_autopilot_in_flight_counter = 0;
booz2_autopilot_mode_auto2 = MODE_AUTO2;
props_throttle_pass = 0;
for(uint8_t i = 0; i < PROPS_NB; i++){
props_enable[i] = 1;
}
}
#define BOOZ2_AUTOPILOT_CHECK_IN_FLIGHT() { \
if (booz2_autopilot_in_flight) { \
if (booz2_autopilot_in_flight_counter > 0) { \
if (radio_control.values[RADIO_THROTTLE] < BOOZ2_AUTOPILOT_THROTTLE_TRESHOLD) { \
booz2_autopilot_in_flight_counter--; \
if (booz2_autopilot_in_flight_counter == 0) { \
booz2_autopilot_in_flight = FALSE; \
} \
} \
else { /* rc throttle > threshold */ \
booz2_autopilot_in_flight_counter = BOOZ2_AUTOPILOT_IN_FLIGHT_TIME; \
} \
} \
} \
else { /* not in flight */ \
if (booz2_autopilot_in_flight_counter < BOOZ2_AUTOPILOT_IN_FLIGHT_TIME && \
booz2_autopilot_motors_on) { \
if (radio_control.values[RADIO_THROTTLE] > BOOZ2_AUTOPILOT_THROTTLE_TRESHOLD) { \
booz2_autopilot_in_flight_counter++; \
if (booz2_autopilot_in_flight_counter == BOOZ2_AUTOPILOT_IN_FLIGHT_TIME) \
booz2_autopilot_in_flight = TRUE; \
} \
else { /* rc throttle < threshold */ \
booz2_autopilot_in_flight_counter = 0; \
} \
} \
} \
}
#define BOOZ2_AUTOPILOT_CHECK_MOTORS_ON() { \
if(!booz2_autopilot_motors_on){ \
if (radio_control.values[RADIO_THROTTLE] < BOOZ2_AUTOPILOT_THROTTLE_TRESHOLD && \
(radio_control.values[RADIO_YAW] > BOOZ2_AUTOPILOT_YAW_TRESHOLD || \
radio_control.values[RADIO_YAW] < -BOOZ2_AUTOPILOT_YAW_TRESHOLD)) { \
if ( booz2_autopilot_motors_on_counter < BOOZ2_AUTOPILOT_MOTOR_ON_TIME) { \
booz2_autopilot_motors_on_counter++; \
if (booz2_autopilot_motors_on_counter == BOOZ2_AUTOPILOT_MOTOR_ON_TIME){ \
booz2_autopilot_motors_on = TRUE; \
booz2_autopilot_in_flight_counter += BOOZ2_AUTOPILOT_MOTOR_ON_TIME; \
} \
} \
} else { \
booz2_autopilot_motors_on_counter = 0; \
} \
} \
}
// adapted from booz2_commands.h - cb6e74ae259a2384046f431c35735dc8018c0ecd
// mmt -- 06/16/09
const pprz_t csc_ap_commands_failsafe[COMMANDS_NB] = COMMANDS_FAILSAFE;
#define CscSetCommands(_in_cmd, _in_flight, _motors_on) { \
commands[COMMAND_PITCH] = _in_cmd[COMMAND_PITCH]; \
commands[COMMAND_ROLL] = _in_cmd[COMMAND_ROLL]; \
commands[COMMAND_YAW] = (_in_flight) ? _in_cmd[COMMAND_YAW] : 0; \
commands[COMMAND_THRUST] = (_motors_on) ? _in_cmd[COMMAND_THRUST] : 0; \
}
pprz_t mixed_commands[PROPS_NB];
void csc_ap_periodic(uint8_t _in_flight, uint8_t kill) {
// RunOnceEvery(50, nav_periodic_task_10Hz())
BOOZ2_AUTOPILOT_CHECK_MOTORS_ON();
if(kill) booz2_autopilot_motors_on = FALSE;
booz2_autopilot_in_flight = _in_flight;
stabilization_attitude_read_rc(booz2_autopilot_in_flight);
stabilization_attitude_run(booz2_autopilot_in_flight);
booz2_guidance_v_run(booz2_autopilot_in_flight);
stabilization_cmd[COMMAND_THRUST] = (int32_t)radio_control.values[RADIO_THROTTLE] * 105 / 7200 + 95;
CscSetCommands(stabilization_cmd,
booz2_autopilot_in_flight,booz2_autopilot_motors_on);
BOOZ2_SUPERVISION_RUN(mixed_commands, commands, booz2_autopilot_motors_on);
if(booz2_autopilot_motors_on && props_throttle_pass){
Bound(stabilization_cmd[COMMAND_THRUST],0,255);
for(uint8_t i = 0; i < PROPS_NB; i++)
mixed_commands[i] = stabilization_cmd[COMMAND_THRUST];
}
for(uint8_t i = 0; i < PROPS_NB; i++){
if(props_enable[i])
props_set(i,mixed_commands[i]);
else
props_set(i,0);
}
props_commit();
MERCURY_SURFACES_SUPERVISION_RUN(Actuator,
stabilization_cmd,
mixed_commands,
(!booz2_autopilot_in_flight));
ActuatorsCommit();
SendCscFromActuators();
}
|
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(C) 2019 Marvell International Ltd.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <rte_common.h>
#include <rte_debug.h>
#include <rte_eal.h>
#include <rte_log.h>
#include <rte_malloc.h>
#include <rte_mbuf.h>
#include <rte_mbuf_pool_ops.h>
#include <rte_memcpy.h>
#include <rte_memory.h>
#include <rte_mempool.h>
#include <rte_per_lcore.h>
#include <rte_rawdev.h>
#include "otx2_dpi_rawdev.h"
static struct dpi_cring_data_s cring;
static uint8_t
buffer_fill(uint8_t *addr, int len, uint8_t val)
{
int j = 0;
memset(addr, 0, len);
for (j = 0; j < len; j++)
*(addr + j) = val++;
return val;
}
static int
validate_buffer(uint8_t *saddr, uint8_t *daddr, int len)
{
int j = 0, ret = 0;
for (j = 0; j < len; j++) {
if (*(saddr + j) != *(daddr + j)) {
otx2_dpi_dbg("FAIL: Data Integrity failed");
otx2_dpi_dbg("index: %d, Expected: 0x%x, Actual: 0x%x",
j, *(saddr + j), *(daddr + j));
ret = -1;
break;
}
}
return ret;
}
static inline int
dma_test_internal(int dma_port, int buf_size)
{
struct dpi_dma_req_compl_s *comp_data;
struct dpi_dma_queue_ctx_s ctx = {0};
struct rte_rawdev_buf buf = {0};
struct rte_rawdev_buf *d_buf[1];
struct rte_rawdev_buf *bufp[1];
struct dpi_dma_buf_ptr_s cmd;
union dpi_dma_ptr_u rptr = { {0} };
union dpi_dma_ptr_u wptr = { {0} };
uint8_t *fptr, *lptr;
int ret;
fptr = (uint8_t *)rte_malloc("dummy", buf_size, 128);
lptr = (uint8_t *)rte_malloc("dummy", buf_size, 128);
comp_data = rte_malloc("dummy", buf_size, 128);
if (fptr == NULL || lptr == NULL || comp_data == NULL) {
otx2_dpi_dbg("Unable to allocate internal memory");
return -ENOMEM;
}
buffer_fill(fptr, buf_size, 0);
memset(&cmd, 0, sizeof(struct dpi_dma_buf_ptr_s));
memset(lptr, 0, buf_size);
memset(comp_data, 0, buf_size);
rptr.s.ptr = (uint64_t)fptr;
rptr.s.length = buf_size;
wptr.s.ptr = (uint64_t)lptr;
wptr.s.length = buf_size;
cmd.rptr[0] = &rptr;
cmd.wptr[0] = &wptr;
cmd.rptr_cnt = 1;
cmd.wptr_cnt = 1;
cmd.comp_ptr = comp_data;
buf.buf_addr = (void *)&cmd;
bufp[0] = &buf;
ctx.xtype = DPI_XTYPE_INTERNAL_ONLY;
ctx.pt = 0;
ctx.c_ring = &cring;
ret = rte_rawdev_enqueue_buffers(dma_port,
(struct rte_rawdev_buf **)bufp, 1,
&ctx);
if (ret < 0) {
otx2_dpi_dbg("Enqueue request failed");
return 0;
}
/* Wait and dequeue completion */
do {
sleep(1);
ret = rte_rawdev_dequeue_buffers(dma_port, &d_buf[0], 1, &ctx);
if (ret)
break;
otx2_dpi_dbg("Dequeue request not completed");
} while (1);
if (validate_buffer(fptr, lptr, buf_size)) {
otx2_dpi_dbg("DMA transfer failed\n");
return -EAGAIN;
}
otx2_dpi_dbg("Internal Only DMA transfer successfully completed");
if (lptr)
rte_free(lptr);
if (fptr)
rte_free(fptr);
if (comp_data)
rte_free(comp_data);
return 0;
}
static void *
dpi_create_mempool(void)
{
void *chunk_pool = NULL;
char pool_name[25];
int ret;
snprintf(pool_name, sizeof(pool_name), "dpi_chunk_pool");
chunk_pool = (void *)rte_mempool_create_empty(pool_name, 1024, 1024,
0, 0, rte_socket_id(), 0);
if (chunk_pool == NULL) {
otx2_dpi_dbg("Unable to create memory pool.");
return NULL;
}
ret = rte_mempool_set_ops_byname(chunk_pool,
rte_mbuf_platform_mempool_ops(), NULL);
if (ret < 0) {
otx2_dpi_dbg("Unable to set pool ops");
rte_mempool_free(chunk_pool);
return NULL;
}
ret = rte_mempool_populate_default(chunk_pool);
if (ret < 0) {
otx2_dpi_dbg("Unable to populate pool");
return NULL;
}
return chunk_pool;
}
int
test_otx2_dma_rawdev(uint16_t val)
{
struct rte_rawdev_info rdev_info = {0};
struct dpi_rawdev_conf_s conf = {0};
int ret, i, size = 1024;
int nb_ports;
RTE_SET_USED(val);
nb_ports = rte_rawdev_count();
if (nb_ports == 0) {
otx2_dpi_dbg("No Rawdev ports - bye");
return -ENODEV;
}
i = rte_rawdev_get_dev_id("DPI:5:00.1");
/* Configure rawdev ports */
conf.chunk_pool = dpi_create_mempool();
rdev_info.dev_private = &conf;
ret = rte_rawdev_configure(i, (rte_rawdev_obj_t)&rdev_info);
if (ret) {
otx2_dpi_dbg("Unable to configure DPIVF %d", i);
return -ENODEV;
}
otx2_dpi_dbg("rawdev %d configured successfully", i);
/* Each stream allocate its own completion ring data, store it in
* application context. Each stream needs to use same application
* context for enqueue/dequeue.
*/
cring.compl_data = rte_malloc("dummy", sizeof(void *) * 1024, 128);
if (!cring.compl_data) {
otx2_dpi_dbg("Completion allocation failed");
return -ENOMEM;
}
cring.max_cnt = 1024;
cring.head = 0;
cring.tail = 0;
ret = dma_test_internal(i, size);
if (ret)
otx2_dpi_dbg("DMA transfer failed for queue %d", i);
if (rte_rawdev_close(i))
otx2_dpi_dbg("Dev close failed for port %d", i);
if (conf.chunk_pool)
rte_mempool_free(conf.chunk_pool);
return ret;
}
|
#include <math.h>
#include "cmapf.h"
void geog_ll(vector_3d * geog,double * lat,double * longit){
double fact;
if ((fact = geog->v[0]*geog->v[0] + geog->v[1]*geog->v[1]) <= 0.) {
* lat = geog->v[2]>0. ? 90. : -90.;
* longit = 90. + *lat;
/* Change made 02/12/02 to acommodate WMO reporting conventions. North
pole is longitude 180., so "North" points to the Greenwich Meridian,
South Pole is longitude 0. so "North" again points to the Greenwich
Meridian. */
} else {
fact = sqrt(fact);
* lat = DEGPRAD * atan2(geog->v[2], fact);
* longit = DEGPRAD * atan2(geog->v[1],geog->v[0]);
}
}
|
/*
* kbdif.h -- Xen virtual keyboard/mouse
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
* Copyright (C) 2005 Anthony Liguori <aliguori@us.ibm.com>
* Copyright (C) 2006 Red Hat, Inc., Markus Armbruster <armbru@redhat.com>
*/
#ifndef __OPENXTFB_KBDIF_H__
#define __OPENXTFB_KBDIF_H__
/**
* The default maximum for ABS_X and ABS_Y events. Can be overridden at
* module load time.
*/
#define OXT_KBD_ABS_MAX 32767
/*
* Frontends should ignore unknown in events.
*/
/* Pointer movement event */
#define OXT_KBD_TYPE_MOTION 1
/* Event type 2 currently not used */
/* Key event (includes pointer buttons) */
#define OXT_KBD_TYPE_KEY 3
/*
* Pointer position event
*/
#define OXT_KBD_TYPE_POS 4
/*
* OpenXT Multitouch events
*/
#define OXT_KBD_TYPE_TOUCH_DOWN 5
#define OXT_KBD_TYPE_TOUCH_UP 6
#define OXT_KBD_TYPE_TOUCH_MOVE 7
#define OXT_KBD_TYPE_TOUCH_FRAME 8
/**
* Packet describing a touch "press" event.
* Careful not to change the ordering-- id must be the second element!
*/
struct oxtkbd_touch_down {
uint8_t type; /* OXT_KBD_TYPE_TOUCH_DOWN */
int32_t id; /* the finger identifier for a touch event */
int32_t abs_x; /* absolute X position (in FB pixels) */
int32_t abs_y; /* absolute Y position (in FB pixels) */
};
/**
* Packet describing a touch release event.
* Careful not to change the ordering-- id must be the second element!
*/
struct oxtkbd_touch_up {
uint8_t type; /* OXT_KBD_TYPE_TOUCH_UP */
int32_t id; /* the finger identifier for a touch event */
};
/**
* Packet describing a touch movement event.
* Careful not to change the ordering-- id must be the second element!
*/
struct oxtkbd_touch_move {
uint8_t type; /* OXT_KBD_TYPE_TOUCH_MOVE */
int32_t id; /* the finger identifier for a touch event */
int32_t abs_x; /* absolute X position (in FB pixels) */
int32_t abs_y; /* absolute Y position (in FB pixels) */
};
/**
* Packet describing a touch movement event.
*/
struct oxtkbd_touch_frame {
uint8_t type; /* OXT_KBD_TYPE_TOUCH_FRAME */
};
#define OXT_KBD_IN_EVENT_SIZE 40
/**
* Union representing an OpenXT keyboard event.
*
*/
union oxtkbd_in_event {
//Do not edit the entries below;
//they're necessary for backwards compatibility.
uint8_t type;
struct xenkbd_motion motion;
struct xenkbd_key key;
struct xenkbd_position pos;
//New event types for OpenXT.
//Multitouch:
struct oxtkbd_touch_down touch_down;
struct oxtkbd_touch_move touch_move;
struct oxtkbd_touch_up touch_up;
struct oxtkbd_touch_frame touch_frame;
char pad[OXT_KBD_IN_EVENT_SIZE];
};
/* shared page */
#define OXT_KBD_IN_RING_SIZE 2048
#define OXT_KBD_IN_RING_LEN (XENKBD_IN_RING_SIZE / XENKBD_IN_EVENT_SIZE)
#define OXT_KBD_IN_RING_OFFS 1024
#define OXT_KBD_IN_RING(page) \
((union oxtkbd_in_event *)((char *)(page) + OXT_KBD_IN_RING_OFFS))
#define OXT_KBD_IN_RING_REF(page, idx) \
(OXT_KBD_IN_RING((page))[(idx) % XENKBD_IN_RING_LEN])
#endif
|
/*
* This file is part of the coreboot project.
*
* Copyright (c) 2015, The Linux Foundation. All rights reserved.
* Copyright 2014 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <boardid.h>
#include <boot/coreboot_tables.h>
#include <delay.h>
#include <device/device.h>
#include <gpio.h>
#include <soc/clock.h>
#include <soc/soc_services.h>
#include <soc/usb.h>
#include <soc/blsp.h>
#include <symbols.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include "mmu.h"
#define USB_ENABLE_GPIO 51
static void setup_usb(void)
{
usb_clock_config();
setup_usb_host1();
}
#define TPM_RESET_GPIO 19
void ipq_setup_tpm(void)
{
if (!IS_ENABLED(CONFIG_I2C_TPM))
return;
gpio_tlmm_config_set(TPM_RESET_GPIO, FUNC_SEL_GPIO,
GPIO_PULL_UP, GPIO_6MA, 1);
gpio_set(TPM_RESET_GPIO, 0);
udelay(100);
gpio_set(TPM_RESET_GPIO, 1);
/*
* ----- Per the SLB 9615XQ1.2 spec -----
*
* 4.7.1 Reset Timing
*
* The TPM_ACCESS_x.tpmEstablishment bit has the correct value
* and the TPM_ACCESS_x.tpmRegValidSts bit is typically set
* within 8ms after RESET# is deasserted.
*
* The TPM is ready to receive a command after less than 30 ms.
*
* --------------------------------------
*
* I'm assuming this means "wait for 30ms"
*
* If we don't wait here, subsequent QUP I2C accesses
* to the TPM either fail or timeout.
*/
mdelay(30);
}
static void mainboard_init(device_t dev)
{
/* disable mmu and d-cache before setting up secure world.*/
dcache_mmu_disable();
start_tzbsp();
/* Setup mmu and d-cache again as non secure entries. */
setup_mmu(DRAM_INITIALIZED);
setup_usb();
ipq_setup_tpm();
if (IS_ENABLED(CONFIG_CHROMEOS)) {
/* Copy WIFI calibration data into CBMEM. */
cbmem_add_vpd_calibration_data();
}
/*
* Make sure bootloader can issue sounds The frequency is calculated
* as "<frame_rate> * <bit_width> * <channels> * 4", i.e.
*
* 48000 * 2 * 16 * 4 = 6144000
*/
//audio_clock_config(6144000);
}
static void mainboard_enable(device_t dev)
{
dev->ops->init = &mainboard_init;
}
struct chip_operations mainboard_ops = {
.name = "gale",
.enable_dev = mainboard_enable,
};
void lb_board(struct lb_header *header)
{
struct lb_range *dma;
dma = (struct lb_range *)lb_new_record(header);
dma->tag = LB_TAB_DMA;
dma->size = sizeof(*dma);
dma->range_start = (uintptr_t)_dma_coherent;
dma->range_size = _dma_coherent_size;
if (IS_ENABLED(CONFIG_CHROMEOS)) {
/* Retrieve the switch interface MAC addressses. */
lb_table_add_macs_from_vpd(header);
}
}
|
/*
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
* Copyright (C) 2004 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
* This copyrighted material is made available to anyone wishing to use,
* modify, copy, or redistribute it subject to the terms and conditions
* of the GNU General Public License v.2.
*
* 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 "tools.h"
static int vgexport_single(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg, int consistent,
void *handle)
{
if (!vg) {
log_error("Unable to find volume group \"%s\"", vg_name);
goto error;
}
if (!consistent) {
log_error("Volume group %s inconsistent", vg_name);
goto error;
}
if (vg->status & EXPORTED_VG) {
log_error("Volume group \"%s\" is already exported", vg_name);
goto error;
}
if (!(vg->status & LVM_WRITE)) {
log_error("Volume group \"%s\" is read-only", vg_name);
goto error;
}
if (lvs_in_vg_activated(vg)) {
log_error("Volume group \"%s\" has active logical volumes",
vg_name);
goto error;
}
if (!archive(vg))
goto error;
vg->status |= EXPORTED_VG;
if (!vg_write(vg) || !vg_commit(vg))
goto error;
backup(vg);
log_print("Volume group \"%s\" successfully exported", vg->name);
return ECMD_PROCESSED;
error:
return ECMD_FAILED;
}
int vgexport(struct cmd_context *cmd, int argc, char **argv)
{
if (!argc && !arg_count(cmd, all_ARG)) {
log_error("Please supply volume groups or use -a for all.");
return ECMD_FAILED;
}
if (argc && arg_count(cmd, all_ARG)) {
log_error("No arguments permitted when using -a for all.");
return ECMD_FAILED;
}
return process_each_vg(cmd, argc, argv, LCK_VG_WRITE, 1, NULL,
&vgexport_single);
}
|
#ifndef METAWATCHPAINTENGINE_H
#define METAWATCHPAINTENGINE_H
#include <sowatch.h>
#include "metawatch.h"
namespace sowatch
{
/** This WatchPaintEngine accelerates fillRects by using the MetaWatch's template command. */
class MetaWatchPaintEngine : public WatchPaintEngine
{
public:
MetaWatchPaintEngine();
bool begin(QPaintDevice *pdev);
bool end();
void drawRects(const QRectF *rects, int rectCount);
void drawRects(const QRect *rects, int rectCount);
void updateState(const QPaintEngineState &state);
protected:
bool fillsEntireImage(const QRect& rect);
MetaWatch* _watch;
MetaWatch::Mode _mode;
bool _isBrushBlack;
bool _isBrushWhite;
};
}
#endif // METAWATCHPAINTENGINE_H
|
/***********************************************************************************
* *
* Voreen - The Volume Rendering Engine *
* *
* Copyright (C) 2005-2012 University of Muenster, Germany. *
* Visualization and Computer Graphics Group <http://viscg.uni-muenster.de> *
* For a list of authors please refer to the file "CREDITS.txt". *
* *
* This file is part of the Voreen software package. Voreen 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. *
* *
* Voreen 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 in the file *
* "LICENSE.txt" along with this file. If not, see <http://www.gnu.org/licenses/>. *
* *
* For non-commercial academic use see the license exception specified in the file *
* "LICENSE-academic.txt". To get information about commercial licensing please *
* contact the authors. *
* *
***********************************************************************************/
#ifndef VRN_VOREENTOOLWINDOW_H
#define VRN_VOREENTOOLWINDOW_H
#include <QWidget>
#include <QDockWidget>
#include "voreen/qt/voreenqtapi.h"
namespace voreen {
class VRN_QT_API VoreenToolWindowTitle : public QWidget {
Q_OBJECT
public:
VoreenToolWindowTitle(QDockWidget* parent, bool dockable=true);
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
protected:
virtual void paintEvent(QPaintEvent *event);
void mousePressEvent(QMouseEvent* event);
void mouseDoubleClickEvent(QMouseEvent* event);
private:
bool dockable_;
QPixmap closeButton_;
QPixmap undockButton_;
QPixmap maximizeButton_;
};
//----------------------------------------------------------------------------------------------------------------
class VRN_QT_API VoreenToolWindow : public QDockWidget {
Q_OBJECT
public:
VoreenToolWindow(QAction* action, QWidget* parent, QWidget* child, const QString& name = "", bool dockable=true);
/// Returns the action associated with this tool.
QAction* action() const;
/// Returns the widget that is wrapped by the tool windows.
QWidget* child() const;
private:
QAction* action_;
QWidget* child_;
};
} // namespace
#endif // VRN_VOREENTOOLWINDOW_H
|
/*
* Copyright (c) 2011, Intel Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _PROTINFOIGNOREMETA_r10b_H_
#define _PROTINFOIGNOREMETA_r10b_H_
#include "test.h"
#include "../Utils/queues.h"
namespace GrpNVMReadCmd {
/** \verbatim
* -----------------------------------------------------------------------------
* ----------------Mandatory rules for children to follow-----------------------
* -----------------------------------------------------------------------------
* 1) See notes in the header file of the Test base class
* \endverbatim
*/
class ProtInfoIgnoreMeta_r10b : public Test
{
public:
ProtInfoIgnoreMeta_r10b(string grpName, string testName);
virtual ~ProtInfoIgnoreMeta_r10b();
/**
* IMPORTANT: Read Test::Clone() header comment.
*/
virtual ProtInfoIgnoreMeta_r10b *Clone() const
{ return new ProtInfoIgnoreMeta_r10b(*this); }
ProtInfoIgnoreMeta_r10b &operator=(const ProtInfoIgnoreMeta_r10b &other);
ProtInfoIgnoreMeta_r10b(const ProtInfoIgnoreMeta_r10b &other);
protected:
virtual void RunCoreTest();
virtual RunType RunnableCoreTest(bool preserve);
private:
///////////////////////////////////////////////////////////////////////////
// Adding a member variable? Then edit the copy constructor and operator=().
///////////////////////////////////////////////////////////////////////////
void CreateIOQs(SharedASQPtr asq, SharedACQPtr acq, uint32_t ioqId,
SharedIOSQPtr &iosq, SharedIOCQPtr &iocq);
};
} // namespace
#endif
|
//
// VungleManager.h
// VungleTest
//
// Created by Mike Desaro on 6/5/12.
// Copyright (c) 2012 prime31. All rights reserved.
//
#import <UIKit/UIKit.h>
#import <VungleSDK/VungleSDK.h>
@interface VungleManager : NSObject <VungleSDKDelegate>
+ (VungleManager*)sharedManager;
- (void)startWithAppId:(NSString*)appId;
- (void)playAdWithOptions:(NSDictionary*)options;
@end
|
/*
names.c -- generate commonly used (file)names
Copyright (C) 1998-2005 Ivo Timmermans
2000-2015 Guus Sliepen <guus@tinc-vpn.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 "system.h"
#include "logger.h"
#include "names.h"
#include "xalloc.h"
char *netname = NULL;
char *confdir = NULL; /* base configuration directory */
char *confbase = NULL; /* base configuration directory for this instance of tinc */
bool confbase_given;
char *identname = NULL; /* program name for syslog */
char *unixsocketname = NULL; /* UNIX socket location */
char *logfilename = NULL; /* log file location */
char *pidfilename = NULL;
char *program_name = NULL;
/*
Set all files and paths according to netname
*/
void make_names(bool daemon) {
#ifdef HAVE_MINGW
HKEY key;
char installdir[1024] = "";
DWORD len = sizeof installdir;
#endif
confbase_given = confbase;
if(netname && confbase)
logger(DEBUG_ALWAYS, LOG_INFO, "Both netname and configuration directory given, using the latter...");
if(netname)
xasprintf(&identname, "tinc.%s", netname);
else
identname = xstrdup("tinc");
#ifdef HAVE_MINGW
if(!RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\tinc", 0, KEY_READ, &key)) {
if(!RegQueryValueEx(key, NULL, 0, 0, (LPBYTE)installdir, &len)) {
confdir = xstrdup(installdir);
if(!confbase) {
if(netname)
xasprintf(&confbase, "%s" SLASH "%s", installdir, netname);
else
xasprintf(&confbase, "%s", installdir);
}
if(!logfilename)
xasprintf(&logfilename, "%s" SLASH "tinc.log", confbase);
}
RegCloseKey(key);
}
#endif
if(!confdir)
confdir = xstrdup(CONFDIR SLASH "tinc");
if(!confbase) {
if(netname)
xasprintf(&confbase, CONFDIR SLASH "tinc" SLASH "%s", netname);
else
xasprintf(&confbase, CONFDIR SLASH "tinc");
}
#ifdef HAVE_MINGW
if(!logfilename)
xasprintf(&logfilename, "%s" SLASH "log", confbase);
if(!pidfilename)
xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
#else
bool fallback = false;
if(daemon) {
if(access(LOCALSTATEDIR, R_OK | W_OK | X_OK))
fallback = true;
} else {
char fname[PATH_MAX];
snprintf(fname, sizeof fname, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
if(access(fname, R_OK)) {
snprintf(fname, sizeof fname, "%s" SLASH "pid", confbase);
if(!access(fname, R_OK))
fallback = true;
}
}
if(!fallback) {
if(!logfilename)
xasprintf(&logfilename, LOCALSTATEDIR SLASH "log" SLASH "%s.log", identname);
if(!pidfilename)
xasprintf(&pidfilename, LOCALSTATEDIR SLASH "run" SLASH "%s.pid", identname);
} else {
if(!logfilename)
xasprintf(&logfilename, "%s" SLASH "log", confbase);
if(!pidfilename) {
if(daemon)
logger(DEBUG_ALWAYS, LOG_WARNING, "Could not access " LOCALSTATEDIR SLASH " (%s), storing pid and socket files in %s" SLASH, strerror(errno), confbase);
xasprintf(&pidfilename, "%s" SLASH "pid", confbase);
}
}
#endif
if(!unixsocketname) {
int len = strlen(pidfilename);
unixsocketname = xmalloc(len + 8);
memcpy(unixsocketname, pidfilename, len);
if(len > 4 && !strcmp(pidfilename + len - 4, ".pid"))
strncpy(unixsocketname + len - 4, ".socket", 8);
else
strncpy(unixsocketname + len, ".socket", 8);
}
}
void free_names(void) {
free(identname);
free(netname);
free(unixsocketname);
free(pidfilename);
free(logfilename);
free(confbase);
free(confdir);
identname = NULL;
netname = NULL;
unixsocketname = NULL;
pidfilename = NULL;
logfilename = NULL;
confbase = NULL;
confdir = NULL;
}
|
#ifndef __ALPHA_SYSTEM_H
#error Do not include xchg.h directly!
#else
static inline unsigned long
____xchg(_u8, volatile char *m, unsigned long val)
{
unsigned long ret, tmp, addr64;
__asm__ __volatile__(
" andnot %4,7,%3\n"
" insbl %1,%4,%1\n"
"1: ldq_l %2,0(%3)\n"
" extbl %2,%4,%0\n"
" mskbl %2,%4,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
__ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
return ret;
}
static inline unsigned long
____xchg(_u16, volatile short *m, unsigned long val)
{
unsigned long ret, tmp, addr64;
__asm__ __volatile__(
" andnot %4,7,%3\n"
" inswl %1,%4,%1\n"
"1: ldq_l %2,0(%3)\n"
" extwl %2,%4,%0\n"
" mskwl %2,%4,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%3)\n"
" beq %2,2f\n"
__ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (ret), "=&r" (val), "=&r" (tmp), "=&r" (addr64)
: "r" ((long)m), "1" (val) : "memory");
return ret;
}
static inline unsigned long
____xchg(_u32, volatile int *m, unsigned long val)
{
unsigned long dummy;
__asm__ __volatile__(
"1: ldl_l %0,%4\n"
" bis $31,%3,%1\n"
" stl_c %1,%2\n"
" beq %1,2f\n"
__ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
return val;
}
static inline unsigned long
____xchg(_u64, volatile long *m, unsigned long val)
{
unsigned long dummy;
__asm__ __volatile__(
"1: ldq_l %0,%4\n"
" bis $31,%3,%1\n"
" stq_c %1,%2\n"
" beq %1,2f\n"
__ASM__MB
".subsection 2\n"
"2: br 1b\n"
".previous"
: "=&r" (val), "=&r" (dummy), "=m" (*m)
: "rI" (val), "m" (*m) : "memory");
return val;
}
extern void __xchg_called_with_bad_pointer(void);
static __always_inline unsigned long
____xchg(, volatile void *ptr, unsigned long x, int size)
{
switch (size) {
case 1:
return ____xchg(_u8, ptr, x);
case 2:
return ____xchg(_u16, ptr, x);
case 4:
return ____xchg(_u32, ptr, x);
case 8:
return ____xchg(_u64, ptr, x);
}
__xchg_called_with_bad_pointer();
return x;
}
static inline unsigned long
____cmpxchg(_u8, volatile char *m, unsigned char old, unsigned char new)
{
unsigned long prev, tmp, cmp, addr64;
__asm__ __volatile__(
" andnot %5,7,%4\n"
" insbl %1,%5,%1\n"
"1: ldq_l %2,0(%4)\n"
" extbl %2,%5,%0\n"
" cmpeq %0,%6,%3\n"
" beq %3,2f\n"
" mskbl %2,%5,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
__ASM__MB
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
return prev;
}
static inline unsigned long
____cmpxchg(_u16, volatile short *m, unsigned short old, unsigned short new)
{
unsigned long prev, tmp, cmp, addr64;
__asm__ __volatile__(
" andnot %5,7,%4\n"
" inswl %1,%5,%1\n"
"1: ldq_l %2,0(%4)\n"
" extwl %2,%5,%0\n"
" cmpeq %0,%6,%3\n"
" beq %3,2f\n"
" mskwl %2,%5,%2\n"
" or %1,%2,%2\n"
" stq_c %2,0(%4)\n"
" beq %2,3f\n"
__ASM__MB
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r" (prev), "=&r" (new), "=&r" (tmp), "=&r" (cmp), "=&r" (addr64)
: "r" ((long)m), "Ir" (old), "1" (new) : "memory");
return prev;
}
static inline unsigned long
____cmpxchg(_u32, volatile int *m, int old, int new)
{
unsigned long prev, cmp;
__asm__ __volatile__(
"1: ldl_l %0,%5\n"
" cmpeq %0,%3,%1\n"
" beq %1,2f\n"
" mov %4,%1\n"
" stl_c %1,%2\n"
" beq %1,3f\n"
__ASM__MB
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
return prev;
}
static inline unsigned long
____cmpxchg(_u64, volatile long *m, unsigned long old, unsigned long new)
{
unsigned long prev, cmp;
__asm__ __volatile__(
"1: ldq_l %0,%5\n"
" cmpeq %0,%3,%1\n"
" beq %1,2f\n"
" mov %4,%1\n"
" stq_c %1,%2\n"
" beq %1,3f\n"
__ASM__MB
"2:\n"
".subsection 2\n"
"3: br 1b\n"
".previous"
: "=&r"(prev), "=&r"(cmp), "=m"(*m)
: "r"((long) old), "r"(new), "m"(*m) : "memory");
return prev;
}
extern void __cmpxchg_called_with_bad_pointer(void);
static __always_inline unsigned long
____cmpxchg(, volatile void *ptr, unsigned long old, unsigned long new,
int size)
{
switch (size) {
case 1:
return ____cmpxchg(_u8, ptr, old, new);
case 2:
return ____cmpxchg(_u16, ptr, old, new);
case 4:
return ____cmpxchg(_u32, ptr, old, new);
case 8:
return ____cmpxchg(_u64, ptr, old, new);
}
__cmpxchg_called_with_bad_pointer();
return old;
}
#endif
|
/*
* Please do not edit this file.
* It was generated using rpcgen.
*/
#include <stdio.h>
#include <memory.h> /* for memset */
#include "nfs4_prot.h"
/* Default timeout can be changed using clnt_control() */
static struct timeval TIMEOUT = { 25, 0 };
void *
nfsproc4_null_4(void *argp, CLIENT *clnt)
{
static char clnt_res;
memset((char *)&clnt_res, 0, sizeof(clnt_res));
if (clnt_call (clnt, NFSPROC4_NULL,
(xdrproc_t) xdr_void, (caddr_t) argp,
(xdrproc_t) xdr_void, (caddr_t) &clnt_res,
TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return ((void *)&clnt_res);
}
COMPOUND4res *
nfsproc4_compound_4(COMPOUND4args *argp, CLIENT *clnt)
{
static COMPOUND4res clnt_res;
enum clnt_stat stat;
memset((char *)&clnt_res, 0, sizeof(clnt_res));
stat = clnt_call (clnt, NFSPROC4_COMPOUND,
(xdrproc_t) xdr_COMPOUND4args, (caddr_t) argp,
(xdrproc_t) xdr_COMPOUND4res, (caddr_t) &clnt_res,
TIMEOUT);
if (stat != RPC_SUCCESS) {
fprintf(stderr, "%s\n", clnt_sperrno(stat));
return (NULL);
}
return (&clnt_res);
}
void *
cb_null_1(void *argp, CLIENT *clnt)
{
static char clnt_res;
memset((char *)&clnt_res, 0, sizeof(clnt_res));
if (clnt_call (clnt, CB_NULL,
(xdrproc_t) xdr_void, (caddr_t) argp,
(xdrproc_t) xdr_void, (caddr_t) &clnt_res,
TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return ((void *)&clnt_res);
}
CB_COMPOUND4res *
cb_compound_1(CB_COMPOUND4args *argp, CLIENT *clnt)
{
static CB_COMPOUND4res clnt_res;
memset((char *)&clnt_res, 0, sizeof(clnt_res));
if (clnt_call (clnt, CB_COMPOUND,
(xdrproc_t) xdr_CB_COMPOUND4args, (caddr_t) argp,
(xdrproc_t) xdr_CB_COMPOUND4res, (caddr_t) &clnt_res,
TIMEOUT) != RPC_SUCCESS) {
return (NULL);
}
return (&clnt_res);
}
|
/* Copyright (C) 1991, 1993, 1996, 1997, 1999 Free Software Foundation, Inc.
Based on strlen implementation by Torbjorn Granlund (tege@sics.se),
with help from Dan Sahlin (dan@sics.se) and
commentary by Jim Blandy (jimb@ai.mit.edu);
adaptation to memchr suggested by Dick Karpinski (dick@cca.ucsf.edu),
and implemented by Roland McGrath (roland@ai.mit.edu).
The GNU C 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.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#undef __ptr_t
#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
# define __ptr_t void *
#else /* Not C++ or ANSI C. */
# define __ptr_t char *
#endif /* C++ or ANSI C. */
#if defined (_LIBC)
# include <string.h>
#endif
#if defined (HAVE_LIMITS_H) || defined (_LIBC)
# include <limits.h>
#endif
#include <stdlib.h>
#define LONG_MAX_32_BITS 2147483647
#ifndef LONG_MAX
#define LONG_MAX LONG_MAX_32_BITS
#endif
#include <sys/types.h>
#undef memchr
/* Search no more than N bytes of S for C. */
__ptr_t
__rawmemchr (s, c)
const __ptr_t s;
int c;
{
const unsigned char *char_ptr;
const unsigned long int *longword_ptr;
unsigned long int longword, magic_bits, charmask;
c = (unsigned char) c;
/* Handle the first few characters by reading one character at a time.
Do this until CHAR_PTR is aligned on a longword boundary. */
for (char_ptr = (const unsigned char *) s;
((unsigned long int) char_ptr & (sizeof (longword) - 1)) != 0;
++char_ptr)
if (*char_ptr == c)
return (__ptr_t) char_ptr;
/* All these elucidatory comments refer to 4-byte longwords,
but the theory applies equally well to 8-byte longwords. */
longword_ptr = (unsigned long int *) char_ptr;
/* Bits 31, 24, 16, and 8 of this number are zero. Call these bits
the "holes." Note that there is a hole just to the left of
each byte, with an extra at the end:
bits: 01111110 11111110 11111110 11111111
bytes: AAAAAAAA BBBBBBBB CCCCCCCC DDDDDDDD
The 1-bits make sure that carries propagate to the next 0-bit.
The 0-bits provide holes for carries to fall into. */
if (sizeof (longword) != 4 && sizeof (longword) != 8)
abort ();
#if LONG_MAX <= LONG_MAX_32_BITS
magic_bits = 0x7efefeff;
#else
magic_bits = ((unsigned long int) 0x7efefefe << 32) | 0xfefefeff;
#endif
/* Set up a longword, each of whose bytes is C. */
charmask = c | (c << 8);
charmask |= charmask << 16;
#if LONG_MAX > LONG_MAX_32_BITS
charmask |= charmask << 32;
#endif
/* Instead of the traditional loop which tests each character,
we will test a longword at a time. The tricky part is testing
if *any of the four* bytes in the longword in question are zero. */
while (1)
{
/* We tentatively exit the loop if adding MAGIC_BITS to
LONGWORD fails to change any of the hole bits of LONGWORD.
1) Is this safe? Will it catch all the zero bytes?
Suppose there is a byte with all zeros. Any carry bits
propagating from its left will fall into the hole at its
least significant bit and stop. Since there will be no
carry from its most significant bit, the LSB of the
byte to the left will be unchanged, and the zero will be
detected.
2) Is this worthwhile? Will it ignore everything except
zero bytes? Suppose every byte of LONGWORD has a bit set
somewhere. There will be a carry into bit 8. If bit 8
is set, this will carry into bit 16. If bit 8 is clear,
one of bits 9-15 must be set, so there will be a carry
into bit 16. Similarly, there will be a carry into bit
24. If one of bits 24-30 is set, there will be a carry
into bit 31, so all of the hole bits will be changed.
The one misfire occurs when bits 24-30 are clear and bit
31 is set; in this case, the hole at bit 31 is not
changed. If we had access to the processor carry flag,
we could close this loophole by putting the fourth hole
at bit 32!
So it ignores everything except 128's, when they're aligned
properly.
3) But wait! Aren't we looking for C, not zero?
Good point. So what we do is XOR LONGWORD with a longword,
each of whose bytes is C. This turns each byte that is C
into a zero. */
longword = *longword_ptr++ ^ charmask;
/* Add MAGIC_BITS to LONGWORD. */
if ((((longword + magic_bits)
/* Set those bits that were unchanged by the addition. */
^ ~longword)
/* Look at only the hole bits. If any of the hole bits
are unchanged, most likely one of the bytes was a
zero. */
& ~magic_bits) != 0)
{
/* Which of the bytes was C? If none of them were, it was
a misfire; continue the search. */
const unsigned char *cp = (const unsigned char *) (longword_ptr - 1);
if (cp[0] == c)
return (__ptr_t) cp;
if (cp[1] == c)
return (__ptr_t) &cp[1];
if (cp[2] == c)
return (__ptr_t) &cp[2];
if (cp[3] == c)
return (__ptr_t) &cp[3];
#if LONG_MAX > 2147483647
if (cp[4] == c)
return (__ptr_t) &cp[4];
if (cp[5] == c)
return (__ptr_t) &cp[5];
if (cp[6] == c)
return (__ptr_t) &cp[6];
if (cp[7] == c)
return (__ptr_t) &cp[7];
#endif
}
}
}
weak_alias (__rawmemchr, rawmemchr)
|
#include <config.h>
#include <stdlib.h>
#include <glib.h>
#include <gtk/gtk.h> /* just for version */
#ifdef G_OS_WIN32
#define Rectangle Win32Rectangle
#define WIN32_LEAN_AND_MEAN
#include <windows.h> /* native file api */
#undef Rectangle
#include "app_procs.h"
#include "interface.h"
static void dia_redirect_console (void);
/* In case we build this as a windowed application */
#ifdef __GNUC__
# ifndef _stdcall
# define _stdcall __attribute__((stdcall))
# endif
#endif
int _stdcall
WinMain (struct HINSTANCE__ *hInstance,
struct HINSTANCE__ *hPrevInstance,
char *lpszCmdLine,
int nCmdShow)
{
typedef BOOL (WINAPI *PFN_SetProcessDPIAware) (VOID);
PFN_SetProcessDPIAware setProcessDPIAware;
/* Try to claim DPI awareness (should work from Vista). This disables automatic
* scaling of the user interface elements, so icons might get really small. But
* for reasonable high dpi that should still look better than, e.g. scaling our
* buttons to 125%.
*/
setProcessDPIAware = (PFN_SetProcessDPIAware) GetProcAddress (GetModuleHandle ("user32.dll"),
"SetProcessDPIAware");
if (setProcessDPIAware)
setProcessDPIAware ();
dia_redirect_console ();
app_init (__argc, __argv);
if (!app_is_interactive())
return 0;
toolbox_show();
app_splash_done();
gtk_main ();
return 0;
}
void
dia_log_func (const gchar *log_domain,
GLogLevelFlags flags,
const gchar *message,
gpointer data)
{
HANDLE file = (HANDLE)data;
const char* level;
static char* last_message = NULL;
DWORD dwWritten; /* looks like being optional in MSDN, but isn't */
/* some small optimization especially for the ugly tweaked font message */
if (last_message && (0 == strcmp (last_message, message)))
return;
/* not using GLib functions! */
if (last_message)
free (last_message);
last_message = strdup (message); /* finally leaked */
WriteFile (file, log_domain ? log_domain : "?", log_domain ? strlen(log_domain) : 1, &dwWritten, 0);
WriteFile (file, "-", 1, &dwWritten, 0);
level = flags & G_LOG_LEVEL_ERROR ? "Error" :
flags & G_LOG_LEVEL_CRITICAL ? "Critical" :
flags & G_LOG_LEVEL_WARNING ? "Warning" :
flags & G_LOG_LEVEL_INFO ? "Info" :
flags & G_LOG_LEVEL_DEBUG ? "Debug" :
flags & G_LOG_LEVEL_MESSAGE ? "Message" : "?";
WriteFile (file, level, strlen(level), &dwWritten, 0);
WriteFile (file, ": ", 2, &dwWritten, 0);
WriteFile (file, message, strlen(message), &dwWritten, 0);
WriteFile (file, "\r\n", 2, &dwWritten, 0);
FlushFileBuffers (file);
if (flags & G_LOG_FATAL_MASK)
{
/* should we also exit here or at least do MessageBox ?*/
}
}
void
dia_print_func (const char* string)
{
}
void
dia_redirect_console (void)
{
const gchar *log_domains[] =
{
"GLib", "GModule", "GThread", "GLib-GObject",
"Pango", "PangoFT2", "PangoWin32", /* noone sets them ?*/
"Gtk", "Gdk", "GdkPixbuf",
"Dia", "DiaLib", "DiaObject", "DiaPlugin", "DiaPython",
NULL,
};
static int MAX_TRIES = 16;
int i = 0;
HANDLE file = INVALID_HANDLE_VALUE;
char logname[] = "dia--" VERSION ".log";
char* redirected;
gboolean verbose = TRUE;
BY_HANDLE_FILE_INFORMATION fi = { 0, };
if ( ( ((file = GetStdHandle (STD_OUTPUT_HANDLE)) != INVALID_HANDLE_VALUE)
|| ((file = GetStdHandle (STD_ERROR_HANDLE)) != INVALID_HANDLE_VALUE))
&& (GetFileInformationByHandle (file, &fi) && (fi.dwFileAttributes != 0)))
verbose = FALSE; /* use it but not too much ;-) */
else do
{
/* overwrite at startup */
redirected = g_build_filename (g_get_tmp_dir (), logname, NULL);
/* not using standard c runtime functions to
* deal with possibly multiple instances
*/
file = CreateFile (redirected, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_FLAG_WRITE_THROUGH, 0);
if (file == INVALID_HANDLE_VALUE)
{
i++;
g_clear_pointer (&redirected, g_free);
logname[3] = '0' + i;
}
} while (file == INVALID_HANDLE_VALUE && i < MAX_TRIES);
if (file != INVALID_HANDLE_VALUE)
{
char* log = g_strdup_printf ("Dia (%s) instance %d started "
"using Gtk %d.%d.%d (%d)\r\n",
VERSION, i + 1,
gtk_major_version, gtk_minor_version, gtk_micro_version, gtk_binary_age);
DWORD dwWritten; /* looks like being optional in msdn, but isn't */
if (!verbose || WriteFile (file, log, strlen(log), &dwWritten, 0))
{
for (i = 0; i < G_N_ELEMENTS (log_domains); i++)
g_log_set_handler (log_domains[i],
G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR,
dia_log_func,
file);
/* don't redirect g_print () yet, it's upcoming API */
g_set_print_handler (dia_print_func);
}
else
{
char* emsg = g_win32_error_message (GetLastError ());
g_printerr ("Logfile %s writing failed: %s", redirected, emsg);
g_clear_pointer (&emsg, g_free);
}
g_clear_pointer (&log, g_free);
}
}
#endif
|
#include <stdbool.h>
#include <stdint.h>
// NOTE: Unsigned integer overflow wraps without causing undefined behaviour.
#define MULTIPLY_UNSIGNED_SAFE(name, type) \
bool multiply_ ## name ## _safe(type *out, type m1, type m2) \
{ \
type result = m1 * m2; \
if ((m1 > 0) && ((result / m1) != m2)) \
return false; \
\
*out = result; \
return true; \
}
MULTIPLY_UNSIGNED_SAFE(uint32, uint32_t)
MULTIPLY_UNSIGNED_SAFE(uint64, uint64_t)
|
/* Gtk+ User Interface Builder
* Copyright (C) 1998 Damon Chaplin
*
* 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 <gtk/gtkeventbox.h>
#include "../gb.h"
/* Include the 21x21 icon pixmap for this widget, to be used in the palette */
#include "../graphics/eventbox.xpm"
/*
* This is the GbWidget struct for this widget (see ../gbwidget.h).
* It is initialized in the init() function at the end of this file
*/
static GbWidget gbwidget;
/******
* NOTE: To use these functions you need to uncomment them AND add a pointer
* to the function in the GbWidget struct at the end of this file.
******/
/*
* Creates a new GtkWidget of class GtkEventBox, performing any specialized
* initialization needed for the widget to work correctly in this environment.
* If a dialog box is used to initialize the widget, return NULL from this
* function, and call data->callback with your new widget when it is done.
* If the widget needs a special destroy handler, add a signal here.
*/
GtkWidget *
gb_event_box_new (GbWidgetNewData * data)
{
GtkWidget *new_widget = gtk_event_box_new ();
if (data->action != GB_LOADING)
gtk_container_add (GTK_CONTAINER (new_widget), editor_new_placeholder ());
return new_widget;
}
/*
* Creates the components needed to edit the extra properties of this widget.
*/
/*
static void
gb_event_box_create_properties(GtkWidget *widget, GbWidgetCreateArgData *data)
{
}
*/
/*
* Gets the properties of the widget. This is used for both displaying the
* properties in the property editor, and also for saving the properties.
*/
/*
static void
gb_event_box_get_properties(GtkWidget *widget, GbWidgetGetArgData *data)
{
}
*/
/*
* Sets the properties of the widget. This is used for both applying the
* properties changed in the property editor, and also for loading.
*/
/*
static void
gb_event_box_set_properties(GtkWidget *widget, GbWidgetSetArgData *data)
{
}
*/
/*
* Adds menu items to a context menu which is just about to appear!
* Add commands to aid in editing a GtkEventBox, with signals pointing to
* other functions in this file.
*/
/*
static void
gb_event_box_create_popup_menu(GtkWidget *widget, GbWidgetCreateMenuData *data)
{
}
*/
/*
* Writes the source code needed to create this widget.
* You have to output everything necessary to create the widget here, though
* there are some convenience functions to help.
*/
static void
gb_event_box_write_source (GtkWidget * widget, GbWidgetWriteSourceData * data)
{
if (data->create_widget)
{
source_add (data, " %s = gtk_event_box_new ();\n", data->wname);
}
gb_widget_write_standard_source (widget, data);
}
/*
* Initializes the GbWidget structure.
* I've placed this at the end of the file so we don't have to include
* declarations of all the functions.
*/
GbWidget *
gb_event_box_init ()
{
/* Initialise the GTK type */
volatile GtkType type;
type = gtk_event_box_get_type ();
/* Initialize the GbWidget structure */
gb_widget_init_struct (&gbwidget);
/* Fill in the pixmap struct & tooltip */
gbwidget.pixmap_struct = eventbox_xpm;
gbwidget.tooltip = _("Event Box");
/* Fill in any functions that this GbWidget has */
gbwidget.gb_widget_new = gb_event_box_new;
/*
gbwidget.gb_widget_create_properties = gb_event_box_create_properties;
gbwidget.gb_widget_get_properties = gb_event_box_get_properties;
gbwidget.gb_widget_set_properties = gb_event_box_set_properties;
gbwidget.gb_widget_create_popup_menu = gb_event_box_create_popup_menu;
*/
gbwidget.gb_widget_write_source = gb_event_box_write_source;
return &gbwidget;
}
|
#ifndef ArgParser_h__
#define ArgParser_h__
#include <iostream>
#include <string>
#include "ArgumentList.h"
using namespace std;
class ArgParser
{
private:
static const char* COMMAND_PREFIX;
bool isCommand(string arg);
string trimCommand(string command);
public:
ArgParser();
virtual ~ArgParser();
ArgumentList parse(int argc, char* argv[]);
void print(int argc, char* argv[]);
};
#endif // ArgParser_h__
|
#pragma once
#include <vector>
#include <map>
typedef unsigned long long ui64;
typedef unsigned int ui32;
typedef double f64;
typedef std::vector<ui32> vui32;
struct Histogram
{
std::map<int, ui32> statistic;
ui64 count;
f64 coefficient, left, right;
Histogram(f64 _left, f64 _right, f64 _coef) : left(_left), right(_right), coefficient(_coef){
count = 0;
}
void add(f64 numb){
if (numb > right || numb < left) return;
numb = numb * coefficient;
if (numb < 0.0f) numb -= 1.0f;// because [-1.2] = -2
count++;
statistic[static_cast<int>(numb)]++;
}
}; |
#include <stdint.h>
#include <string.h>
#include <device/pci_def.h>
#include <arch/io.h>
#include <device/pnp_def.h>
#include <arch/romcc_io.h>
#include <stdlib.h>
#include <pc80/mc146818rtc.h>
#include <console/console.h>
#include <lib.h>
#include <spd.h>
#include <cpu/amd/model_fxx_rev.h>
#include "northbridge/amd/amdk8/incoherent_ht.c"
#include "southbridge/amd/amd8111/early_smbus.c"
#include "northbridge/amd/amdk8/raminit.h"
#include "lib/delay.c"
#include "northbridge/amd/amdk8/reset_test.c"
#include "northbridge/amd/amdk8/debug.c"
#include "superio/winbond/w83627hf/early_serial.c"
#include "cpu/x86/mtrr/earlymtrr.c"
#include "cpu/x86/bist.h"
#include "northbridge/amd/amdk8/setup_resource_map.c"
#include "southbridge/amd/amd8111/early_ctrl.c"
#define SERIAL_DEV PNP_DEV(0x2e, W83627HF_SP1)
static void memreset_setup(void)
{
if (is_cpu_pre_c0())
outb((1<<2)|(0<<0), SMBUS_IO_BASE + 0xc0 + 16); //REVC_MEMRST_EN=0
else
outb((1<<2)|(1<<0), SMBUS_IO_BASE + 0xc0 + 16); //REVC_MEMRST_EN=1
outb((1<<2)|(0<<0), SMBUS_IO_BASE + 0xc0 + 17);
}
static void memreset(int controllers, const struct mem_controller *ctrl)
{
if (is_cpu_pre_c0()) {
udelay(800);
outb((1<<2)|(1<<0), SMBUS_IO_BASE + 0xc0 + 17); //REVB_MEMRST_L=1
udelay(90);
}
}
static void activate_spd_rom(const struct mem_controller *ctrl) { }
static inline int spd_read_byte(unsigned device, unsigned address)
{
return smbus_read_byte(device, address);
}
#include "northbridge/amd/amdk8/raminit.c"
#include "northbridge/amd/amdk8/coherent_ht.c"
#include "lib/generic_sdram.c"
#include "northbridge/amd/amdk8/resourcemap.c"
#include "cpu/amd/dualcore/dualcore.c"
#include "cpu/amd/car/post_cache_as_ram.c"
#include "cpu/amd/model_fxx/init_cpus.c"
void cache_as_ram_main(unsigned long bist, unsigned long cpu_init_detectedx)
{
static const struct mem_controller cpu[] = {
{
.node_id = 0,
.f0 = PCI_DEV(0, 0x18, 0),
.f1 = PCI_DEV(0, 0x18, 1),
.f2 = PCI_DEV(0, 0x18, 2),
.f3 = PCI_DEV(0, 0x18, 3),
.channel0 = { DIMM0, DIMM2, 0, 0 },
.channel1 = { DIMM1, DIMM3, 0, 0 },
},
#if CONFIG_MAX_PHYSICAL_CPUS > 1
{
.node_id = 1,
.f0 = PCI_DEV(0, 0x19, 0),
.f1 = PCI_DEV(0, 0x19, 1),
.f2 = PCI_DEV(0, 0x19, 2),
.f3 = PCI_DEV(0, 0x19, 3),
.channel0 = { DIMM4, DIMM6, 0, 0 },
.channel1 = { DIMM5, DIMM7, 0, 0 },
},
#endif
};
int needs_reset;
if (bist == 0)
init_cpus(cpu_init_detectedx);
w83627hf_enable_serial(SERIAL_DEV, CONFIG_TTYS0_BASE);
console_init();
/* Halt if there was a built in self test failure */
report_bist_failure(bist);
setup_default_resource_map();
needs_reset = setup_coherent_ht_domain();
#if CONFIG_LOGICAL_CPUS
// It is said that we should start core1 after all core0 launched
start_other_cores();
#endif
needs_reset |= ht_setup_chains_x();
if (needs_reset) {
print_info("ht reset -\n");
soft_reset();
}
enable_smbus();
memreset_setup();
sdram_initialize(ARRAY_SIZE(cpu), cpu);
post_cache_as_ram();
}
|
#include <ham-relay.h>
static volatile bool tx_enabled;
void
inputs_init (void)
{
tx_enabled = false;
/* RXE */
Chip_IOCON_PinMuxSet (LPC_IOCON, RXE_PIO, RXE_CONFIG);
Chip_GPIO_SetPinDIRInput (LPC_GPIO, RXE_PORT, RXE_PIN);
Chip_GPIO_SetPinModeEdge (LPC_GPIO, RXE_PORT, (1 << RXE_PIN));
Chip_GPIO_SetEdgeModeBoth (LPC_GPIO, RXE_PORT, (1 << RXE_PIN));
Chip_GPIO_EnableInt (LPC_GPIO, RXE_PORT, (1 << RXE_PIN));
NVIC_EnableIRQ (EINT2_IRQn);
/* EXT */
Chip_IOCON_PinMuxSet (LPC_IOCON, EXT_PIO, EXT_CONFIG);
Chip_GPIO_SetPinDIRInput (LPC_GPIO, EXT_PORT, EXT_PIN);
Chip_GPIO_SetPinModeEdge (LPC_GPIO, EXT_PORT, (1 << EXT_PIN));
Chip_GPIO_SetEdgeModeBoth (LPC_GPIO, EXT_PORT, (1 << EXT_PIN));
Chip_GPIO_EnableInt (LPC_GPIO, EXT_PORT, (1 << EXT_PIN));
NVIC_EnableIRQ (EINT1_IRQn);
}
void
pio1_handler (void)
{
Chip_GPIO_ClearInts (LPC_GPIO, EXT_PORT, (1 << EXT_PIN));
//call_force_transmit ();
if (Chip_GPIO_GetPinState (LPC_GPIO, EXT_PORT, EXT_PIN)) {
tone_set_frequency (TONE_DEFAULT_HZ);
} else {
tone_set_frequency (TONE_EXT_HZ);
}
}
void
pio2_handler (void)
{
Chip_GPIO_ClearInts (LPC_GPIO, RXE_PORT, (1 << RXE_PIN));
if (Chip_GPIO_GetPinState (LPC_GPIO, RXE_PORT, RXE_PIN)) {
tx_disable ();
tx_enabled = false;
roger_beep_start_timer ();
} else if (!tx_enabled) {
roger_beep_stop_timer ();
tx_enable ();
tx_enabled = true;
}
}
|
/***************************************************************************
* Copyright (C) 2007 by alejandro santos *
* alejolp@gmail.com *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef GUICHANLOADER_H
#define GUICHANLOADER_H
#include <guichan.hpp>
#include <guichan/sdl.hpp>
#include <guichan/opengl.hpp>
#include <guichan/opengl/openglsdlimageloader.hpp>
#include "SDL.h"
/**
@author alejandro santos <alejolp@gmail.com>
*/
class GuichanLoader
{
public:
GuichanLoader();
~GuichanLoader();
void loadOpenGL( int width, int height );
void pushInput( SDL_Event & event ) {
input->pushInput( event );
}
void logic() {
gui->logic();
}
void draw() {
gui->draw();
}
gcn::Container* get_top() { return top; }
gcn::Graphics* graphics;
private:
void loadTopContainer();
int _width;
int _height;
gcn::SDLInput* input;
gcn::ImageLoader* imageLoader;
gcn::ImageFont* font;
gcn::Gui* gui;
gcn::Container* top;
gcn::Window *window;
};
#endif
|
/****************************************************************************
**
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the files LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Alternatively you may (at
** your option) use any later version of the GNU General Public
** License if such license has been publicly approved by Trolltech ASA
** (or its successors, if any) and the KDE Free Qt Foundation. In
** addition, as a special exception, Trolltech gives you certain
** additional rights. These rights are described in the Trolltech GPL
** Exception version 1.2, which can be found at
** http://www.trolltech.com/products/qt/gplexception/ and in the file
** GPL_EXCEPTION.txt in this package.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/. If
** you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** In addition, as a special exception, Trolltech, as the sole
** copyright holder for Qt Designer, grants users of the Qt/Eclipse
** Integration plug-in the right for the Qt/Eclipse Integration to
** link to functionality provided by Qt Designer and its related
** libraries.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not expressly
** granted herein.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
****************************************************************************/
#ifndef QSHORTCUT_H
#define QSHORTCUT_H
#include <QtGui/qwidget.h>
#include <QtGui/qkeysequence.h>
QT_BEGIN_HEADER
QT_MODULE(Gui)
#ifndef QT_NO_SHORTCUT
class QShortcutPrivate;
class Q_GUI_EXPORT QShortcut : public QObject
{
Q_OBJECT
Q_DECLARE_PRIVATE(QShortcut)
Q_PROPERTY(QKeySequence key READ key WRITE setKey)
Q_PROPERTY(QString whatsThis READ whatsThis WRITE setWhatsThis)
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
Q_PROPERTY(Qt::ShortcutContext context READ context WRITE setContext)
public:
explicit QShortcut(QWidget *parent);
QShortcut(const QKeySequence& key, QWidget *parent,
const char *member = 0, const char *ambiguousMember = 0,
Qt::ShortcutContext context = Qt::WindowShortcut);
~QShortcut();
void setKey(const QKeySequence& key);
QKeySequence key() const;
void setEnabled(bool enable);
bool isEnabled() const;
void setContext(Qt::ShortcutContext context);
Qt::ShortcutContext context();
void setWhatsThis(const QString &text);
QString whatsThis() const;
void setAutoRepeat(bool on);
bool autoRepeat() const;
int id() const;
inline QWidget *parentWidget() const
{ return static_cast<QWidget *>(QObject::parent()); }
Q_SIGNALS:
void activated();
void activatedAmbiguously();
protected:
bool event(QEvent *e);
};
#endif // QT_NO_SHORTCUT
QT_END_HEADER
#endif // QSHORTCUT_H
|
/*
* linux/drivers/base/map.c
*
* (C) Copyright Al Viro 2002,2003
* Released under GPL v2.
*
* NOTE: data structure needs to be changed. It works, but for large dev_t
* it will be too slow. It is isolated, though, so these changes will be
* local to that file.
*/
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/mutex.h>
#include <linux/kdev_t.h>
#include <linux/kobject.h>
#include <linux/kobj_map.h>
struct kobj_map {
struct probe {
struct probe *next;
dev_t dev;
unsigned long range;
struct module *owner;
kobj_probe_t *get;
int (*lock)(dev_t, void *);
void *data; /*<llj>pointer to cdev</llj>*/
} *probes[255];
struct mutex *lock;
};
int kobj_map(struct kobj_map *domain, dev_t dev, unsigned long range,
struct module *module, kobj_probe_t *probe,
int (*lock)(dev_t, void *), void *data)
{
unsigned n = MAJOR(dev + range - 1) - MAJOR(dev) + 1;/*<llj>+1 to avoid n=0</llj>*/
unsigned index = MAJOR(dev);
unsigned i;
struct probe *p;
if (n > 255)
n = 255;
p = kmalloc(sizeof(struct probe) * n, GFP_KERNEL);
if (p == NULL)
return -ENOMEM;
for (i = 0; i < n; i++, p++) {
p->owner = module;
p->get = probe;
p->lock = lock;
p->dev = dev;
p->range = range;
p->data = data;
}
mutex_lock(domain->lock);
for (i = 0, p -= n; i < n; i++, p++, index++) {
struct probe **s = &domain->probes[index % 255];
while (*s && (*s)->range < range)/*<llj>Õë¶ÔÒ»¸öprobeÁ´±í£¬°´rangeµÝÔö¼ÓÈëµ½Á´±íÖÐ</llj>*/
s = &(*s)->next;
p->next = *s;
*s = p;
}
mutex_unlock(domain->lock);
return 0;
}
void kobj_unmap(struct kobj_map *domain, dev_t dev, unsigned long range)
{
unsigned n = MAJOR(dev + range - 1) - MAJOR(dev) + 1;
unsigned index = MAJOR(dev);
unsigned i;
struct probe *found = NULL;
if (n > 255)
n = 255;
mutex_lock(domain->lock);
for (i = 0; i < n; i++, index++) {
struct probe **s;
for (s = &domain->probes[index % 255]; *s; s = &(*s)->next) {
struct probe *p = *s;
if (p->dev == dev && p->range == range) {
*s = p->next;
if (!found)
found = p;
break;
}
}
}
mutex_unlock(domain->lock);
kfree(found);
}
struct kobject *kobj_lookup(struct kobj_map *domain, dev_t dev, int *index)
{
struct kobject *kobj;
struct probe *p;
unsigned long best = ~0UL;
retry:
mutex_lock(domain->lock);
for (p = domain->probes[MAJOR(dev) % 255]; p; p = p->next) {
struct kobject *(*probe)(dev_t, int *, void *);
struct module *owner;
void *data;
if (p->dev > dev || p->dev + p->range - 1 < dev)
continue;
if (p->range - 1 >= best)
break;
if (!try_module_get(p->owner))
continue;
owner = p->owner;
data = p->data;
probe = p->get;
best = p->range - 1;
*index = dev - p->dev;
if (p->lock && p->lock(dev, data) < 0) {
module_put(owner);
continue;
}
mutex_unlock(domain->lock);
kobj = probe(dev, index, data);
/* Currently ->owner protects _only_ ->probe() itself. */
module_put(owner);
if (kobj)
return kobj;
goto retry;
}
mutex_unlock(domain->lock);
return NULL;
}
struct kobj_map *kobj_map_init(kobj_probe_t *base_probe, struct mutex *lock)
{
struct kobj_map *p = kmalloc(sizeof(struct kobj_map), GFP_KERNEL);
struct probe *base = kzalloc(sizeof(*base), GFP_KERNEL);
int i;
if ((p == NULL) || (base == NULL)) {
kfree(p);
kfree(base);
return NULL;
}
base->dev = 1;
base->range = ~0;
base->get = base_probe;
for (i = 0; i < 255; i++)
p->probes[i] = base;
p->lock = lock;
return p;
}
|
#if !defined(__XEN_SOFTIRQ_H__) && !defined(__ASSEMBLY__)
#define __XEN_SOFTIRQ_H__
/* Low-latency softirqs come first in the following list. */
enum {
TIMER_SOFTIRQ = 0,
SCHEDULE_SOFTIRQ,
NEW_TLBFLUSH_CLOCK_PERIOD_SOFTIRQ,
PAGE_SCRUB_SOFTIRQ,
RCU_SOFTIRQ,
STOPMACHINE_SOFTIRQ,
TASKLET_SOFTIRQ,
NR_COMMON_SOFTIRQS
};
#include <xen/config.h>
#include <xen/lib.h>
#include <xen/smp.h>
#include <asm/bitops.h>
#include <asm/current.h>
#include <asm/hardirq.h>
#include <asm/softirq.h>
#define NR_SOFTIRQS (NR_COMMON_SOFTIRQS + NR_ARCH_SOFTIRQS)
typedef void (*softirq_handler)(void);
asmlinkage void do_softirq(void);
void open_softirq(int nr, softirq_handler handler);
void softirq_init(void);
static inline void cpumask_raise_softirq(cpumask_t mask, unsigned int nr)
{
int cpu;
for_each_cpu_mask(cpu, mask)
{
if ( test_and_set_bit(nr, &softirq_pending(cpu)) )
cpu_clear(cpu, mask);
}
smp_send_event_check_mask(&mask);
}
static inline void cpu_raise_softirq(unsigned int cpu, unsigned int nr)
{
if ( !test_and_set_bit(nr, &softirq_pending(cpu)) )
smp_send_event_check_cpu(cpu);
}
static inline void raise_softirq(unsigned int nr)
{
set_bit(nr, &softirq_pending(smp_processor_id()));
}
/*
* TASKLETS -- dynamically-allocatable tasks run in softirq context
* on at most one CPU at a time.
*/
struct tasklet
{
struct list_head list;
bool_t is_scheduled;
bool_t is_running;
bool_t is_dead;
void (*func)(unsigned long);
unsigned long data;
};
#define DECLARE_TASKLET(name, func, data) \
struct tasklet name = { LIST_HEAD_INIT(name.list), 0, 0, 0, func, data }
void tasklet_schedule(struct tasklet *t);
void tasklet_kill(struct tasklet *t);
void tasklet_init(
struct tasklet *t, void (*func)(unsigned long), unsigned long data);
#endif /* __XEN_SOFTIRQ_H__ */
|
/**
* @author Pavel Lobyrin
* @email pavel@lobyrin.ru
* @website http://lobyrin.de
* @link https://github.com/Comrada/SmartCar
* @version v1.0
* @ide CooCox
* @license GNU GPL v3
* @brief Motors functionality for SmartCar
*
@verbatim
----------------------------------------------------------------------
Copyright (C) Pavel Lobyrin, 2015
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
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/>.
----------------------------------------------------------------------
@endverbatim
*/
#ifndef DELAY_H
#define DELAY_H
void Delay(uint32_t ms);
void DelayMC(uint32_t us);
#endif
|
/*
* Setup pointers to hardware-dependent routines.
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 1996, 1997, 1998, 2001, 07, 08 by Ralf Baechle
* Copyright (C) 2001 MIPS Technologies, Inc.
* Copyright (C) 2007 by Thomas Bogendoerfer
*/
#include <linux/eisa.h>
#include <linux/init.h>
#include <linux/ioport.h>
#include <linux/console.h>
#include <linux/screen_info.h>
#include <linux/platform_device.h>
#include <linux/serial_8250.h>
#include <asm/jazz.h>
#include <asm/jazzdma.h>
#include <asm/reboot.h>
#include <asm/pgtable.h>
extern asmlinkage void jazz_handle_int(void);
extern void jazz_machine_restart(char *command);
static struct resource jazz_io_resources[] = {
{
.start = 0x00,
.end = 0x1f,
.name = "dma1",
.flags = IORESOURCE_BUSY
}, {
.start = 0x40,
.end = 0x5f,
.name = "timer",
.flags = IORESOURCE_BUSY
}, {
.start = 0x80,
.end = 0x8f,
.name = "dma page reg",
.flags = IORESOURCE_BUSY
}, {
.start = 0xc0,
.end = 0xdf,
.name = "dma2",
.flags = IORESOURCE_BUSY
}
};
void __init plat_mem_setup(void)
{
int i;
/* Map 0xe0000000 -> 0x0:800005C0, 0xe0010000 -> 0x1:30000580 */
add_wired_entry(0x02000017, 0x03c00017, 0xe0000000, PM_64K);
/* Map 0xe2000000 -> 0x0:900005C0, 0xe3010000 -> 0x0:910005C0 */
add_wired_entry(0x02400017, 0x02440017, 0xe2000000, PM_16M);
/* Map 0xe4000000 -> 0x0:600005C0, 0xe4100000 -> 400005C0 */
add_wired_entry(0x01800017, 0x01000017, 0xe4000000, PM_4M);
set_io_port_base(JAZZ_PORT_BASE);
#ifdef CONFIG_EISA
EISA_bus = 1;
#endif
/* request I/O space for devices used on all i[345]86 PCs */
for (i = 0; i < ARRAY_SIZE(jazz_io_resources); i++)
request_resource(&ioport_resource, jazz_io_resources + i);
/* The RTC is outside the port address space */
_machine_restart = jazz_machine_restart;
#ifdef CONFIG_VT
screen_info = (struct screen_info) {
.orig_video_cols = 160,
.orig_video_lines = 64,
.orig_video_points = 16,
};
#endif
add_preferred_console("ttyS", 0, "9600");
}
#ifdef CONFIG_OLIVETTI_M700
#define UART_CLK 1843200
#else
/* Some Jazz machines seem to have an 8MHz crystal clock but I don't know
exactly which ones ... XXX */
#define UART_CLK (8000000 / 16) /* ( 3072000 / 16) */
#endif
#define MEMPORT(_base, _irq) \
{ \
.mapbase = (_base), \
.membase = (void *)(_base), \
.irq = (_irq), \
.uartclk = UART_CLK, \
.iotype = UPIO_MEM, \
.flags = UPF_BOOT_AUTOCONF, \
}
static struct plat_serial8250_port jazz_serial_data[] = {
MEMPORT(JAZZ_SERIAL1_BASE, JAZZ_SERIAL1_IRQ),
MEMPORT(JAZZ_SERIAL2_BASE, JAZZ_SERIAL2_IRQ),
{ },
};
static struct platform_device jazz_serial8250_device = {
.name = "serial8250",
.id = PLAT8250_DEV_PLATFORM,
.dev = {
.platform_data = jazz_serial_data,
},
};
static struct resource jazz_esp_rsrc[] = {
{
.start = JAZZ_SCSI_BASE,
.end = JAZZ_SCSI_BASE + 31,
.flags = IORESOURCE_MEM
},
{
.start = JAZZ_SCSI_DMA,
.end = JAZZ_SCSI_DMA,
.flags = IORESOURCE_MEM
},
{
.start = JAZZ_SCSI_IRQ,
.end = JAZZ_SCSI_IRQ,
.flags = IORESOURCE_IRQ
}
};
static struct platform_device jazz_esp_pdev = {
.name = "jazz_esp",
.num_resources = ARRAY_SIZE(jazz_esp_rsrc),
.resource = jazz_esp_rsrc
};
static struct resource jazz_sonic_rsrc[] = {
{
.start = JAZZ_ETHERNET_BASE,
.end = JAZZ_ETHERNET_BASE + 0xff,
.flags = IORESOURCE_MEM
},
{
.start = JAZZ_ETHERNET_IRQ,
.end = JAZZ_ETHERNET_IRQ,
.flags = IORESOURCE_IRQ
}
};
static struct platform_device jazz_sonic_pdev = {
.name = "jazzsonic",
.num_resources = ARRAY_SIZE(jazz_sonic_rsrc),
.resource = jazz_sonic_rsrc
};
static struct resource jazz_cmos_rsrc[] = {
{
.start = 0x70,
.end = 0x71,
.flags = IORESOURCE_IO
},
{
.start = 8,
.end = 8,
.flags = IORESOURCE_IRQ
}
};
static struct platform_device jazz_cmos_pdev = {
.name = "rtc_cmos",
.num_resources = ARRAY_SIZE(jazz_cmos_rsrc),
.resource = jazz_cmos_rsrc
};
static struct platform_device pcspeaker_pdev = {
.name = "pcspkr",
.id = -1,
};
static int __init jazz_setup_devinit(void)
{
platform_device_register(&jazz_serial8250_device);
platform_device_register(&jazz_esp_pdev);
platform_device_register(&jazz_sonic_pdev);
platform_device_register(&jazz_cmos_pdev);
platform_device_register(&pcspeaker_pdev);
return 0;
}
device_initcall(jazz_setup_devinit);
|
//
// ランチャーダイアログクラス
//
#ifndef __CLAUNCHERDLG_INCLUDED__
#define __CLAUNCHERDLG_INCLUDED__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <list>
#include <vector>
#include <string>
using namespace std;
#include "Wnd.h"
class FILELIST
{
public:
string fname;
string path;
INT mapper;
INT prg_size;
INT chr_size;
DWORD crcall;
DWORD crc;
string info;
string db;
string title;
string country;
string manufacturer;
string saledate;
string price;
string genre;
};
class CLauncherDlg : public CWnd
{
public:
// Override from CWnd
BOOL Create( HWND hWndParent );
void Destroy();
// Table
static INT m_HeaderID[];
protected:
enum {
COLUMN_FILENAME = 0,
COLUMN_PATH,
COLUMN_MAPPER,
COLUMN_PRG,
COLUMN_CHR,
COLUMN_ALLCRC,
COLUMN_PRGCRC,
COLUMN_INFO,
COLUMN_DB,
COLUMN_TITLE,
COLUMN_COUNTRY,
COLUMN_MANUFACTURER,
COLUMN_SALEDATE,
COLUMN_PRICE,
COLUMN_GENRE,
};
static INT CALLBACK ListViewCompare( LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort );
void ResetListViewHeader();
void ResetFileList();
void ResetListView();
void SetListView( INT index, FILELIST& fl );
void SortListView();
void SetLastSelect();
void OnUpdateStart();
void OnUpdateStop();
void UpdateListView();
void CheckFile( FILELIST& fl );
void OnUpdateMenu( HMENU hMenu, UINT uID );
BOOL LoadFileList();
void SaveFileList();
// Message map
DLG_MESSAGE_MAP()
DLGMSG OnInitDialog( DLGMSGPARAM );
DLGMSG OnDestroy( DLGMSGPARAM );
DLGMSG OnClose( DLGMSGPARAM );
DLGMSG OnActivate( DLGMSGPARAM );
DLGMSG OnSetCursor( DLGMSGPARAM );
DLGMSG OnSize( DLGMSGPARAM );
DLGMSG OnTimer( DLGMSGPARAM );
DLGMSG OnInitMenuPopup( DLGMSGPARAM );
DLGCMD OnOK( DLGCMDPARAM );
DLGCMD OnCancel( DLGCMDPARAM );
DLGCMD OnListSelect( DLGCMDPARAM );
DLGCMD OnRefresh( DLGCMDPARAM );
DLGCMD OnDispEdit( DLGCMDPARAM );
DLGCMD OnFolder( DLGCMDPARAM );
DLGCMD OnHeaderEdit( DLGCMDPARAM );
DLGNOTIFY OnKeyDownListView( DLGNOTIFYPARAM );
DLGNOTIFY OnReturnListView( DLGNOTIFYPARAM );
DLGNOTIFY OnDoubleClickListView( DLGNOTIFYPARAM );
DLGNOTIFY OnColumnClickListView( DLGNOTIFYPARAM );
DLGNOTIFY OnItemChangedListView( DLGNOTIFYPARAM );
//
// Image List
HIMAGELIST m_hImageList;
HIMAGELIST m_hImageListHdr; // sort
//
BOOL m_bFileLoaded;
// ランチャーリスト番号
INT m_nListSelect;
INT m_nSortType;
INT m_SelectPos;
INT m_UpdatePos;
BOOL m_bUpdate;
volatile BOOL m_bUpdating;
INT m_nTimerID;
INT m_nUpdateIndex;
// Sort type
static BOOL m_bSortDir;
// File list
static INT m_FileListNum;
static vector<FILELIST> m_FileList;
// Path
static CHAR m_LaunchPath[_MAX_PATH];
private:
};
class CLchDispEditDlg : public CWnd
{
public:
// Override from CWnd
INT DoModal( HWND hWndParent );
protected:
// Message map
DLG_MESSAGE_MAP()
DLGMSG OnInitDialog( DLGMSGPARAM );
DLGCMD OnOK( DLGCMDPARAM );
DLGCMD OnCancel( DLGCMDPARAM );
DLGCMD OnAdd( DLGCMDPARAM );
DLGCMD OnDel( DLGCMDPARAM );
DLGCMD OnUp( DLGCMDPARAM );
DLGCMD OnDown( DLGCMDPARAM );
//
// Temp
INT m_nViewOrder[16];
INT m_nViewNum;
INT m_nHideOrder[16];
INT m_nHideNum;
private:
};
class CLchFolderConfigDlg : public CWnd
{
public:
// Override from CWnd
INT DoModal( HWND hWndParent );
protected:
// Message map
DLG_MESSAGE_MAP()
DLGMSG OnInitDialog( DLGMSGPARAM );
DLGCMD OnOK( DLGCMDPARAM );
DLGCMD OnCancel( DLGCMDPARAM );
DLGCMD OnAdd( DLGCMDPARAM );
DLGCMD OnDel( DLGCMDPARAM );
//
private:
};
class CLchHeaderEditDlg : public CWnd
{
public:
// Override from CWnd
INT DoModal( HWND hWndParent );
INT m_nMapperNo;
BOOL m_bMirror;
BOOL m_bSram;
BOOL m_bTrainer;
BOOL m_bFourScreen;
BOOL m_bVSUnisystem;
protected:
// Message map
DLG_MESSAGE_MAP()
DLGMSG OnInitDialog( DLGMSGPARAM );
DLGCMD OnOK( DLGCMDPARAM );
DLGCMD OnCancel( DLGCMDPARAM );
//
private:
};
#endif // !__CLAUNCHERDLG_INCLUDED__
|
struct cRGB black = {0,0,0};
struct cRGB red = {255,0,0};
struct cRGB white = {255,255,255};
struct cStrip { uint8_t pin; uint8_t led_count;};
struct cStrip strip;
void setStrip(uint8_t pin, uint8_t led_count)
{
strip.pin = pin;
strip.led_count = led_count;
/* define Pin as configured in ws2812_config.h as LEDstrip Pin */
DDRB|=_BV(ws2812_pin);
}
void setColor(struct cRGB color, int from, int to, unsigned char brightness)
{
struct cRGB led[strip.led_count];
for (int i = 0; i <= strip.led_count; i++) {
if ( i >= from && i < to )
{
led[i].r=color.g * brightness/255.0;
led[i].g=color.r * brightness/255.0;
/*
* original colors; depends on LEDs
led[i].r=color.r * brightness/255;
led[i].g=color.g * brightness/255;
*/
led[i].b=color.b * brightness/255.0;
}
else
{
led[i].r=0;
led[i].g=0;
led[i].b=0;
}
}
ws2812_setleds(led,strip.led_count);
}
void setStripColor(struct cRGB color, unsigned char brightness)
{
setColor(color, 0, strip.led_count, brightness);
} |
/*
Copyright (c) 2012 Gordon Gremme <gremme@zbh.uni-hamburg.de>
Permission to use, copy, modify, and 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.
*/
#ifndef ORPHANAGE_H
#define ORPHANAGE_H
typedef struct GtOrphanage GtOrphanage;
GtOrphanage* gt_orphanage_new(void);
void gt_orphanage_delete(GtOrphanage*);
void gt_orphanage_reset(GtOrphanage*);
/* Takes ownership of <orphan*>. */
void gt_orphanage_add(GtOrphanage*, GtGenomeNode *orphan,
const char *orphan_id,
GtStrArray *missing_parents);
void gt_orphanage_reg_parent(GtOrphanage*, const char *id);
GtGenomeNode* gt_orphanage_get_orphan(GtOrphanage*);
bool gt_orphanage_parent_is_missing(GtOrphanage*, const char *id);
bool gt_orphanage_is_orphan(GtOrphanage*, const char *id);
#endif
|
/******************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corp. and is
* only intended for use with Renesas products.
* No other uses are authorized.
* This software is owned by Renesas Electronics Corp. and is
* protected under the applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES
* REGARDING THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY,
* INCLUDING BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. ALL SUCH
* WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER
* RENESAS ELECTRONICS CORP. NOR ANY OF ITS AFFILIATED COMPANIES
* SHALL BE LIABLE FOR AND DIRECT, INDIRECT, SPECIAL, INCIDENTAL
* OR COSEQUENTIAL DAMAGES FOR ANY REASON RELATED TO THIS SOFTWARE,
* EVEN IF RENESAS OR ITS AFFILIATES HAVE BEEN ADVISED OF THE
* POSSIBILITIES OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this
* software and to discontinue availability of this software.
* By using this software, you agree to the additional terms and
* conditions found by accessing the following link:
* http://www.renesas.com/disclaimer
*******************************************************************************/
/* Copyright (C) 2010. Renesas Electronics Corp., All Rights Reserved */
/******************************************************************************
* File Name : sprite_images.c
* Version : 1.1
* Device(s) : R5F562N8
* Tool-Chain : Renesas RX Standard Toolchain 1.0.1
* OS : None
* H/W Platform : YRDKRX62N
* Description : Board specific definitions
* Limitations : None
*******************************************************************************
* History : DD.MMM.YYYY Version Description
* : 08.Oct.2010 1.00 First release
* : 02.Dec.2010 1.10 Second YRDK release
*******************************************************************************/
/*******************************************************************************
* Project Includes
*******************************************************************************/
/* LCD Graphics definitions */
#include "lcd_graphics.h"
// Sample sprite -- rectangle
uint8_t Rectangle_image[] = { 0xFF, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xFF};
SPRITE Rectangle = { 8, 8, Rectangle_image};
// Sample sprite -- triangle
uint8_t Triangle_image[] =
{ 0x00, // pixel row 0
0x18, // pixel row 1
0x24,
0x42,
0x81,
0xFF };
SPRITE Triangle = { 8, 6, Triangle_image};
// Sample sprite -- a 15x10 bit large square, requires 24 bytes of data
uint8_t Square_LG_image[] =
{ 0xFF, 0xFE,
0x80, 0x02,
0x80, 0x02,
0x80, 0x02,
0x80, 0x02,
0x80, 0x02,
0x80, 0x02,
0x80, 0x02,
0x80, 0x02,
0xFF, 0xFE };
SPRITE Square_LG = { 15, 10, Square_LG_image};
// Sample sprite -- a 15x10 bit circle, requires 24 bytes of data
uint8_t Circle_image[] =
{ 0x0F, 0xC0,
0x30, 0x30,
0x60, 0x18,
0xC0, 0x0C,
0xC0, 0x0C,
0xC0, 0x0C,
0xC0, 0x0C,
0x60, 0x18,
0x30, 0x30,
0x0F, 0xC0 };
SPRITE Circle = { 15, 10, Circle_image};
// Sample sprite -- a 14x10 bit filled circle, requires 24 bytes of data
uint8_t FilledCircle_image[] =
{ 0x0F, 0xC0, //0
0x3D, 0xF0, //1
0x7E, 0xF8, //2
0xFF, 0x7C, //3
0xDF, 0x7C, //4
0xE7, 0x74, //5
0xF8, 0x0C, //6
0x7E, 0xF8, //7
0x3D, 0xF0, //8
0x0F, 0xC0 }; //9
SPRITE FilledCircle = { 14, 10, FilledCircle_image};
// Sample sprite -- a 8x6 bit filled circle, requires 24 bytes of data
uint8_t SmallCircle_image[] =
{ 0x3C, //0
0x7E, //1
0xFF, //2
0xFF, //3
0x7E, //4
0x3C }; //5
SPRITE SmallCircle = { 8, 6, SmallCircle_image};
// configure what sprite to display on the LCD
SPRITE* sprite = ∘
|
/* Copyright Statement:
*
* (C) 2005-2016 MediaTek Inc. All rights reserved.
*
* This software/firmware and related documentation ("MediaTek Software") are
* protected under relevant copyright laws. The information contained herein
* is confidential and proprietary to MediaTek Inc. ("MediaTek") and/or its licensors.
* Without the prior written permission of MediaTek and/or its licensors,
* any reproduction, modification, use or disclosure of MediaTek Software,
* and information contained herein, in whole or in part, shall be strictly prohibited.
* You may only use, reproduce, modify, or distribute (as applicable) MediaTek Software
* if you have agreed to and been bound by the applicable license agreement with
* MediaTek ("License Agreement") and been granted explicit permission to do so within
* the License Agreement ("Permitted User"). If you are not a Permitted User,
* please cease any access or use of MediaTek Software immediately.
* BY OPENING THIS FILE, RECEIVER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
* THAT MEDIATEK SOFTWARE RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES
* ARE PROVIDED TO RECEIVER ON AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL
* WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
* NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
* SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
* SUPPLIED WITH MEDIATEK SOFTWARE, AND RECEIVER AGREES TO LOOK ONLY TO SUCH
* THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. RECEIVER EXPRESSLY ACKNOWLEDGES
* THAT IT IS RECEIVER'S SOLE RESPONSIBILITY TO OBTAIN FROM ANY THIRD PARTY ALL PROPER LICENSES
* CONTAINED IN MEDIATEK SOFTWARE. MEDIATEK SHALL ALSO NOT BE RESPONSIBLE FOR ANY MEDIATEK
* SOFTWARE RELEASES MADE TO RECEIVER'S SPECIFICATION OR TO CONFORM TO A PARTICULAR
* STANDARD OR OPEN FORUM. RECEIVER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND
* CUMULATIVE LIABILITY WITH RESPECT TO MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
* AT MEDIATEK'S OPTION, TO REVISE OR REPLACE MEDIATEK SOFTWARE AT ISSUE,
* OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY RECEIVER TO
* MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*/
#define THIS_FILE_BELONGS_TO_IMAGE_DATA_PATH_MODULE_INTERNAL
#include <idp_define.h>
#if defined(DRV_IDP_6252_SERIES)
#include <idp_core.h>
#include <mt6252/idp_hw/idp_resz.h>
#include <mt6252/idp_hw/idp_resz_crz.h>
void
idp_resz_init(void)
{
idp_resz_crz_init();
}
#endif // #if defined(DRV_IDP_6252_SERIES)
|
#include "nop.h"
void nop(void)
{
_asm
nop
_endasm;
} |
/***********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif
#include <gtk/gtk.h>
/* utility */
#include "fcintl.h"
/* common */
#include "game.h"
#include "unitlist.h"
/* client */
#include "tilespec.h"
/* client/gui-gtk-3.0 */
#include "gui_main.h"
#include "gui_stuff.h"
#include "dialogs_g.h"
extern char forced_tileset_name[512];
static void tileset_suggestion_callback(GtkWidget *dlg, gint arg);
/****************************************************************
Callback either loading suggested tileset or doing nothing
*****************************************************************/
static void tileset_suggestion_callback(GtkWidget *dlg, gint arg)
{
if (arg == GTK_RESPONSE_YES) {
/* User accepted tileset loading */
sz_strlcpy(forced_tileset_name, game.control.preferred_tileset);
if (!tilespec_reread(game.control.preferred_tileset, FALSE, 1.0)) {
tileset_error(LOG_ERROR, _("Can't load requested tileset %s."),
game.control.preferred_tileset);
}
}
}
/****************************************************************
Popup dialog asking if ruleset suggested tileset should be
used.
*****************************************************************/
void popup_tileset_suggestion_dialog(void)
{
GtkWidget *dialog, *label;
char buf[1024];
dialog = gtk_dialog_new_with_buttons(_("Preferred tileset"),
NULL,
0,
_("Load tileset"),
GTK_RESPONSE_YES,
_("Keep current tileset"),
GTK_RESPONSE_NO,
NULL);
setup_dialog(dialog, toplevel);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
fc_snprintf(buf, sizeof(buf),
_("Modpack suggests using %s tileset.\n"
"It might not work with other tilesets.\n"
"You are currently using tileset %s."),
game.control.preferred_tileset, tileset_basename(tileset));
label = gtk_label_new(buf);
gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), label);
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
gtk_widget_show(label);
g_signal_connect(dialog, "response",
G_CALLBACK(tileset_suggestion_callback), NULL);
/* In case incoming rulesets are incompatible with current tileset
* we need to block their receive before user has accepted loading
* of the correct tileset. */
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy(dialog);
}
|
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "box.h"
#include <QMainWindow>
#include <QtCore>
#include <QtGui>
#include <Phonon/MediaObject>
#include <Phonon/AudioOutput>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private slots:
void loop();
void on_actionClose_triggered();
void on_actionStart_triggered();
void on_actionStop_triggered();
private:
Ui::MainWindow *ui;
Phonon::MediaObject *med;
Phonon::AudioOutput *aout;
QGraphicsScene *scene;
QTimer *timer;
};
#endif // MAINWINDOW_H
|
// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
// (c) Copyright 2000-2020 by Vladi Belperchinov-Shabanski and Andrettin
//
// 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; only 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.
//
#pragma once
class CConfigData;
class CPlayer;
class CUnit;
class CUpgrade;
namespace wyrmgus {
class button;
class season;
class site;
class sml_data;
class sml_property;
class trigger;
class unit_type;
class condition
{
public:
static std::unique_ptr<const condition> from_sml_property(const sml_property &property);
static std::unique_ptr<const condition> from_sml_scope(const sml_data &scope);
static std::string get_conditions_string(const std::vector<std::unique_ptr<const condition>> &conditions, const size_t indent)
{
std::string conditions_string;
bool first = true;
for (const std::unique_ptr<const condition> &condition : conditions) {
if (condition->is_hidden()) {
continue;
}
const std::string condition_string = condition->get_string(indent);
if (condition_string.empty()) {
continue;
}
if (first) {
first = false;
} else {
conditions_string += "\n";
}
if (indent > 0) {
conditions_string += std::string(indent, '\t');
}
conditions_string += condition_string;
}
return conditions_string;
}
virtual ~condition() {}
void ProcessConfigData(const CConfigData *config_data);
virtual void ProcessConfigDataProperty(const std::pair<std::string, std::string> &property);
virtual void ProcessConfigDataSection(const CConfigData *section);
virtual void process_sml_property(const sml_property &property);
virtual void process_sml_scope(const sml_data &scope);
virtual void check_validity() const
{
}
virtual bool check(const CPlayer *player, bool ignore_units = false) const = 0;
virtual bool check(const CUnit *unit, bool ignore_units = false) const;
//get the condition as a string
virtual std::string get_string(const size_t indent) const = 0;
virtual bool is_hidden() const
{
return false;
}
};
template <bool precondition>
extern bool check_special_conditions(const unit_type *target, const CPlayer *player, const bool ignore_units, const bool is_neutral_use);
template <bool precondition>
extern bool check_special_conditions(const CUpgrade *target, const CPlayer *player, const bool ignore_units, const bool is_neutral_use);
//check conditions for player
template <bool precondition = false, typename T>
extern bool check_conditions(const T *target, const CPlayer *player, const bool ignore_units = false, const bool is_neutral_use = false)
{
if constexpr (!precondition) {
if (!check_conditions<true>(target, player, ignore_units, is_neutral_use)) {
return false;
}
}
if constexpr (std::is_same_v<T, unit_type>) {
if (!check_special_conditions<precondition>(target, player, ignore_units, is_neutral_use)) {
return false;
}
} else if constexpr (std::is_same_v<T, CUpgrade>) {
if (!check_special_conditions<precondition>(target, player, ignore_units, is_neutral_use)) {
return false;
}
}
if constexpr (precondition) {
return target->get_preconditions() == nullptr || target->get_preconditions()->check(player, ignore_units);
} else {
return target->get_conditions() == nullptr || target->get_conditions()->check(player, ignore_units);
}
}
template <bool precondition>
extern bool check_special_conditions(const unit_type *target, const CUnit *unit, const bool ignore_units);
template <bool precondition>
extern bool check_special_conditions(const CUpgrade *target, const CUnit *unit, const bool ignore_units);
//check conditions for unit
template <bool precondition = false, typename T>
extern bool check_conditions(const T *target, const CUnit *unit, const bool ignore_units = false)
{
if constexpr (!precondition) {
if (!check_conditions<true>(target, unit, ignore_units)) {
return false;
}
}
if constexpr (std::is_same_v<T, unit_type>) {
if (!check_special_conditions<precondition>(target, unit, ignore_units)) {
return false;
}
} else if constexpr (std::is_same_v<T, CUpgrade>) {
if (!check_special_conditions<precondition>(target, unit, ignore_units)) {
return false;
}
}
if constexpr (precondition) {
return target->get_preconditions() == nullptr || target->get_preconditions()->check(unit, ignore_units);
} else {
return target->get_conditions() == nullptr || target->get_conditions()->check(unit, ignore_units);
}
}
}
/// Register CCL features for dependencies
extern void DependenciesCclRegister();
/// Print all unit conditions into string
extern std::string PrintConditions(const wyrmgus::button &button);
|
/*
Kvalobs - Free Quality Control Software for Meteorological Observations
$Id: kvServiceImpl.h,v 1.5.2.3 2007/09/27 09:02:39 paule Exp $
Copyright (C) 2007 met.no
Contact information:
Norwegian Meteorological Institute
Box 43 Blindern
0313 OSLO
NORWAY
email: kvalobs-dev@met.no
This file is part of KVALOBS
KVALOBS 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.
KVALOBS 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 KVALOBS; if not, write to the Free Software Foundation Inc.,
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __kvServiceImpl_h__
#define __kvServiceImpl_h__
#include <set>
#include <kvskel/kvService.hh>
#include <kvskel/adminInterface.h>
#include <boost/thread/thread.hpp>
#include "ServiceApp.h"
#include <list>
#include <kvalobs/kvObsPgm.h>
class KvServiceImpl : public virtual POA_CKvalObs::CService::kvServiceExt2,
public virtual micutil::AdminInterface,
public PortableServer::RefCountServantBase {
ServiceApp &app;
void addToObsPgmList(CKvalObs::CService::Obs_pgmList &pgmList,
std::list<kvalobs::kvObsPgm> &obsPgms, bool aUnion);
bool appendWhichDataFromStationRange(
dnmi::db::Connection *dbCon,
const CKvalObs::CService::WhichDataList &wData, CORBA::Long startIndex,
CKvalObs::CService::WhichDataList *whichData);
CKvalObs::CService::WhichDataList*
createWhichDataListForAllStations(dnmi::db::Connection *dbCon,
const CKvalObs::CService::WhichData &wData);
public:
// standard constructor
KvServiceImpl(ServiceApp &app_);
virtual ~KvServiceImpl();
char* subscribeDataNotify(const CKvalObs::CService::DataSubscribeInfo& info,
CKvalObs::CService::kvDataNotifySubscriber_ptr sub);
char* subscribeData(const CKvalObs::CService::DataSubscribeInfo& info,
CKvalObs::CService::kvDataSubscriber_ptr sub);
char* subscribeKvHint(CKvalObs::CService::kvHintSubscriber_ptr sub);
void unsubscribe(const char *subid);
CORBA::Boolean
getData(const CKvalObs::CService::WhichDataList& whichData,
CKvalObs::CService::DataIterator_out it);
CORBA::Boolean
getModelData(const CKvalObs::CService::WhichDataList& whichData,
CKvalObs::CService::ModelDataIterator_out it);
CORBA::Boolean
getRejectdecode(const CKvalObs::CService::RejectDecodeInfo& decodeInfo_,
CKvalObs::CService::RejectedIterator_out it);
CORBA::Boolean
getReferenceStation(
CORBA::Long stationid, CORBA::Short paramsetid,
CKvalObs::CService::Reference_stationList_out refStationList);
CORBA::Boolean
getStations(CKvalObs::CService::StationList_out stationList);
CORBA::Boolean
getParams(CKvalObs::CService::ParamList_out paramList_);
CORBA::Boolean
getObsPgm(CKvalObs::CService::Obs_pgmList_out obs_pgmList_,
const CKvalObs::CService::StationIDList& stationIDList_,
CORBA::Boolean aUnion);
CORBA::Boolean getTypes(CKvalObs::CService::TypeList_out typeList_);
CORBA::Boolean getOperator(
CKvalObs::CService::OperatorList_out operatorList_);
CORBA::Boolean getStationParam(
CKvalObs::CService::Station_paramList_out spList, CORBA::Long stationid,
CORBA::Long paramid, CORBA::Long day);
//This implements the new methods defined in kvServiceExt
char* registerDataNotify(
const char* id, CKvalObs::CService::kvDataNotifySubscriberExt_ptr sub);
char* registerData(const char* id,
CKvalObs::CService::kvDataSubscriberExt_ptr sub);
CORBA::Boolean unregisterSubscriber(const char *id);
CORBA::Boolean getDataExt(
const CKvalObs::CService::WhichDataExtList& whichData,
CKvalObs::CService::DataIterator_out it);
CORBA::Boolean getStationMetaData(
CKvalObs::CService::Station_metadataList_out stMeta,
CORBA::Long stationid, const char* obstime, const char* metadataName);
CORBA::Boolean getWorkstatistik(
CKvalObs::CService::WorkstatistikTimeType timeType, const char *fromTime,
const char *toTime, CKvalObs::CService::WorkstatistikIterator_out it);
};
#endif
|
//
// CmdReader.h
// CGame
//
// Created by admin on 14-11-11.
//
//
#ifndef __NET__CMDREADER_H_
#define __NET__CMDREADER_H_
#include "LuaUtils.h"
namespace net
{
class CmdReader
{
private:
CmdReader(const CmdReader & reader);
CmdReader & operator= (const CmdReader & reader);
public:
explicit CmdReader(char * pData, unsigned int len, LUA_FUNCTION handler);
~CmdReader();
const char * getData() const;
unsigned int getLength() const;
LUA_FUNCTION getHandler() const;
private:
unsigned int m_len;
char * m_data;
LUA_FUNCTION m_handler;
};
}
#endif /* defined(__NET__CMDREADER_H_) */
|
/* ///////////////////////////////////////////////////////////////////////// */
/* This file is a part of the BSTools package */
/* written by Przemyslaw Kiciak */
/* ///////////////////////////////////////////////////////////////////////// */
/* (C) Copyright by Przemyslaw Kiciak, 2012, 2013 */
/* this package is distributed under the terms of the */
/* Lesser GNU Public License, see the file COPYING.LIB */
/* ///////////////////////////////////////////////////////////////////////// */
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "pkvaria.h"
#include "pknum.h"
/* /////////////////////////////////////////////////////////////////////////// */
boolean pkn_SPsubMCountMMTnnzR ( int nra, int nca, int nrb,
unsigned int nnza, index3 *ai,
unsigned int *apermut, int *arows, boolean ra,
unsigned int nnzb, index3 *bi,
unsigned int *bpermut, int *bcols, boolean cb,
unsigned int *nnzab, unsigned int *nmultab )
{
void *sp;
unsigned int nnz, nmult;
int i, j, k, k0, k1, l, l0, l1, cnt;
int *wsp, wsps, wspn;
sp = pkv_GetScratchMemTop ();
if ( !ra ) {
if ( !pkn_SPsubMFindRows ( nra, nca, nnza, ai, apermut, ra, arows ) )
goto failure;
}
if ( !cb ) {
if ( !pkn_SPsubMFindCols ( nca, nrb, nnzb, bi, bpermut, cb, bcols ) )
goto failure;
}
wsp = NULL;
wsps = 0;
nnz = nmult = 0;
for ( i = 0; i < nra; i++ ) {
k0 = arows[i];
k1 = arows[i+1];
/* find the workspace size and allocate the workspace */
wspn = 0;
for ( k = k0; k < k1; k++ ) {
j = ai[apermut[k]].j;
wspn += bcols[j+1]-bcols[j];
}
nmult += wspn;
if ( wspn > wsps ) {
pkv_SetScratchMemTop ( sp );
wsp = pkv_GetScratchMemi ( wspn );
if ( !wsp )
goto failure;
wsps = wspn;
}
/* find the positions (column numbers) of nonzero product coefficients */
/* in the i-th row */
cnt = 0;
for ( k = k0; k < k1; k++ ) {
j = ai[apermut[k]].j;
l0 = bcols[j];
l1 = bcols[j+1];
for ( l = l0; l < l1; l++ )
wsp[cnt++] = bi[bpermut[l]].i;
}
/* count the different positions */
if ( cnt ) {
if ( pkv_SortFast ( sizeof(int), ID_UNSIGNED, sizeof(int),
0, cnt, wsp ) != SORT_OK )
goto failure;
l0 = wsp[0];
nnz ++;
for ( l = 1; l < cnt; l++ )
if ( wsp[l] != l0 ) {
l0 = wsp[l];
nnz ++;
}
}
}
*nnzab = nnz;
if (nmultab)
*nmultab = nmult;
pkv_SetScratchMemTop ( sp );
return true;
failure:
pkv_SetScratchMemTop ( sp );
return false;
} /*pkn_SPsubMCountMMTnnzR*/
boolean pkn_SPsubMFindMMTnnzR ( int nra, int nca, int nrb,
unsigned int nnza, index3 *ai,
unsigned int *apermut, int *arows,
unsigned int nnzb, index3 *bi,
unsigned int *bpermut, int *bcols,
index2 *abi, int *abpos, index2 *aikbkj )
{
void *sp;
unsigned int nnz, nmult;
int i, j, k, k0, k1, l, l0, l1, m, n, cnt, nn;
int *wsp, wsps, wspn;
unsigned int *auxpermut;
sp = pkv_GetScratchMemTop ();
wsp = NULL;
wsps = 0;
nnz = nmult = nn = 0;
abpos[0] = 0;
for ( i = 0; i < nra; i++ ) {
k0 = arows[i];
k1 = arows[i+1];
/* find the workspace size and allocate the workspace */
wspn = 0;
for ( k = k0; k < k1; k++ ) {
j = ai[apermut[k]].j;
wspn += bcols[j+1]-bcols[j];
}
if ( wspn > wsps ) {
pkv_SetScratchMemTop ( sp );
wsp = pkv_GetScratchMemi ( wspn );
if ( !wsp )
goto failure;
wsps = wspn;
}
/* find the positions (column numbers) of nonzero product coefficients */
/* in the i-th row */
cnt = 0;
for ( k = k0; k < k1; k++ ) {
m = apermut[k];
j = ai[m].j;
l0 = bcols[j];
l1 = bcols[j+1];
for ( l = l0; l < l1; l++ ) {
n = bpermut[l];
wsp[cnt++] = bi[n].i;
aikbkj[nmult].i = ai[m].k;
aikbkj[nmult++].j = bi[n].k;
}
}
/* count the different positions */
if ( cnt ) {
/* set up the identity permutation */
auxpermut = (unsigned int*)pkv_GetScratchMemi ( cnt );
if ( !auxpermut )
goto failure;
for ( l = 0; l < cnt; l++ )
auxpermut[l] = l;
/* sort by columns */
if ( pkv_SortKernel ( sizeof(int), ID_UNSIGNED, sizeof(int),
0, cnt, wsp, auxpermut ) != SORT_OK )
goto failure;
k1 = nn;
l0 = wsp[auxpermut[0]];
abpos[nnz] = nn ++;
abi[nnz].i = i;
abi[nnz++].j = l0;
for ( l = 1; l < cnt; l++ ) {
k0 = auxpermut[l];
if ( wsp[k0] != l0 ) {
l0 = wsp[k0];
abpos[nnz] = nn;
abi[nnz].i = i;
abi[nnz++].j = l0;
}
nn ++;
}
pkv_SortPermute ( sizeof(index2), cnt, &aikbkj[k1], auxpermut );
}
}
abpos[nnz] = nn;
pkv_SetScratchMemTop ( sp );
return true;
failure:
pkv_SetScratchMemTop ( sp );
return false;
} /*pkn_SPsubMFindMMTnnzR*/
|
/***************************************************************************
* Copyright (C) 2009 by Andrey Afletdinov <fheroes2@gmail.com> *
* *
* Part of the Free Heroes2 Engine: *
* http://sourceforge.net/projects/fheroes2 *
* *
* 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 H2SPLITTER_H
#define H2SPLITTER_H
#include "gamedefs.h"
class Splitter : public SpriteCursor
{
public:
enum positions_t { HORIZONTAL, VERTICAL };
Splitter();
Splitter(const Surface &sf, const Rect &rt, positions_t pos);
void Forward(void);
void Backward(void);
void Move(u16 pos);
void SetArea(s16, s16, u16, u16);
void SetArea(const Rect & rt);
void SetOrientation(positions_t ps);
void SetRange(u16 smin, u16 smax);
u16 GetCurrent(void) const{ return cur; };
u16 GetStep(void) const{ return step; };
u16 Max(void) const{ return max; };
u16 Min(void) const{ return min; };
const Rect & GetRect(void) const{ return area; };
const Rect & GetCursor(void) const{ return SpriteCursor::GetRect(); };
private:
Rect area;
u16 step;
u16 min;
u16 max;
u16 cur;
positions_t position;
};
#endif
|
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#endif
// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef WINVER // Allow use of features specific to Windows XP or later.
#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later.
#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.
#endif
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
//#include "SkinPlusPlus.h"
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif
#include <vector>
#include <map>
#include <string>
#include <fstream> |
/*
* Copyright 2003,2004,2005 Kevin Smathers, All Rights Reserved
*
* This file may be used or modified without the need for a license.
*
* Redistribution of this file in either its original form, or in an
* updated form may be done under the terms of the GNU LIBRARY GENERAL
* PUBLIC LICENSE. If this license is unacceptable to you then you
* may not redistribute this work.
*
* See the file COPYING.LGPL for details.
*/
#include "config.h"
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include <stdio.h>
#include "bitset.h"
#include "random.h"
#include "util.h"
kBitSet* kBitSet_create( kBitSet *set, int nbits) {
int bytes = (nbits+7)/8;
if (nbits %8) bytes++;
if (!set) {
set = btcalloc( 1, sizeof(kBitSet));
}
set->nbits = nbits;
set->bits = btcalloc( bytes, 1);
return set;
}
kBitSet* kBitSet_createCopy( kBitSet *copy, kBitSet *orig) {
int bytes;
int i;
kBitSet_create( copy, orig->nbits);
bytes = (orig->nbits+7)/8;
for (i = 0; i<bytes; i++) {
copy->bits[i] = orig->bits[i];
}
return copy;
}
void kBitSet_finit( kBitSet *set) {
if (set && set->bits) {
btfree(set->bits);
set->bits = NULL;
}
}
void kBitSet_readBytes( kBitSet *set, char* bits, int len) {
int i;
int bytes = (set->nbits+7)/8;
bt_assert(len <= bytes);
for (i=0; i<len; i++) {
set->bits[i] = bits[i];
}
}
void bs_set( kBitSet *set, int bit) {
int byte = bit/8;
int mask = 0x80 >> (bit %8);
set->bits[byte] |= mask;
}
void bs_clr( kBitSet *set, int bit) {
int byte = bit/8;
int mask = 0x80 >> (bit %8);
set->bits[byte] &= ~mask;
}
int bs_isSet( kBitSet *set, int bit) {
int byte = bit/8;
int mask = 0x80 >> (bit %8);
return (set->bits[byte] & mask) != 0;
}
void bs_and( kBitSet *res, kBitSet *a, kBitSet *b) {
int n;
int bytes = (a->nbits+7)/8;
bt_assert(a->nbits == b->nbits);
bt_assert(res->nbits == b->nbits);
for (n=0; n<bytes; n++) {
res->bits[n] = a->bits[n] & b->bits[n];
}
}
void bs_not( kBitSet *res, kBitSet *a) {
int n;
int bytes = (a->nbits+7)/8;
bt_assert(res->nbits == a->nbits);
for (n=0; n<bytes; n++) {
res->bits[n] = ~a->bits[n];
}
}
#if WIN32
char bstest_mask[] = {
'\xff', '\x80', '\xc0', '\xe0', '\xf0', '\xf8', '\xfc', '\xfe'
};
#else
char bstest_mask[] = {
0xff, 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe
};
#endif
int bs_isEmpty( kBitSet *a) {
int n;
int bytes = (a->nbits+7)/8;
for (n=0; n<bytes-1; n++) {
if (a->bits[n]) return 0;
}
if (a->bits[bytes-1] & bstest_mask[a->nbits %8]) return 0;
return 1;
}
int bs_isFull( kBitSet *a) {
int res;
kBitSet c;
kBitSet_create( &c, a->nbits);
bs_not( &c, a);
res = bs_isEmpty( &c);
kBitSet_finit( &c);
return res;
}
int bs_firstClr( kBitSet *a) {
int i;
for (i=0; i<a->nbits; i++) {
if (!bs_isSet( a, i)) return i;
}
return 0;
}
void bs_setRange( kBitSet *set, int start, int endplus1) {
int bit;
for (bit = start; bit<endplus1; bit++) {
if ((bit & 7) == 0 && (bit + 8)<endplus1) {
int byte = bit/8;
set->bits[byte] = 0xff;
bit += 7;
} else {
bs_set( set, bit);
}
}
}
void bs_getSparseSet( kBitSet *a, int **data, int *len) {
int l=0, m=0;
int *d = NULL;
int n;
for (n=0; n<a->nbits; n++) {
if (bs_isSet( a, n)) {
if (l >= m) { m += 10; d = btrealloc( d, m * sizeof(int)); }
d[l] = n;
l++;
}
}
*data = d;
*len = l;
}
int bs_countBits( kBitSet *a) {
int n;
int count = 0;
for (n=0; n<a->nbits; n++) {
if (bs_isSet( a, n)) {
count++;
}
}
return count;
}
int bs_hasInteresting( kBitSet *reqs, kBitSet *peer, kBitSet *intr) {
/*
* reqs is the list of blocks already requested from other peers
* peer is the list of blocks available at this peer
* intr in the list of block that I'm interested in downloading
*
* returns the true iff there is at least one block that the peer
* has, but isn't already requested.
*/
kBitSet r;
int interesting = 1;
kBitSet_create( &r, peer->nbits);
bs_not( &r, reqs);
bs_and( &r, &r, peer);
bs_and( &r, &r, intr);
if (bs_isEmpty( &r)) interesting=0;
kBitSet_finit( &r);
return interesting;
}
int bs_pickblock( kBitSet *reqs, kBitSet *peer, kBitSet *intr) {
/*
* reqs is the list of blocks already requested from other peers
* peer is the list of blocks available at this peer
* intr in the list of block that I'm interested in downloading
*
* returns the block number of a block to request from this peer,
* or -1 if there are no blocks to request.
*/
kBitSet r;
int *picks;
int npicks;
int block;
kBitSet_create( &r, peer->nbits);
bs_not( &r, reqs);
bs_and( &r, &r, peer);
bs_and( &r, &r, intr);
if (bs_isEmpty( &r)) return -1;
#if 0
bs_dump( "reqs", reqs);
bs_dump( "peer", peer);
bs_dump( "intr", intr);
bs_dump("r", &r);
#endif
bs_getSparseSet( &r, &picks, &npicks);
bt_assert(npicks != 0);
block = picks[ rnd(npicks)];
btfree(picks);
kBitSet_finit( &r);
return block;
}
void bs_dump( char *label, kBitSet *bs) {
#define BPL 24
int n,m;
int bytes = (bs->nbits+7)/8;
for (n=0; n<bytes; n+=BPL) {
printf("%s+%05d:", label, n);
for (m=0; m<BPL && m+n<bytes; m++) {
if (m>0 && (m%4)==0) printf(" ");
printf ("%02x", (unsigned char)bs->bits[n+m]);
}
printf("\n");
}
printf("\n");
}
|
#pragma once
#include "afxwin.h"
#include "afxcmn.h"
#include "IISConfigHelper.h"
// *************************************************************************************************** //
class CMyRClickTreeCtrl : public CTreeCtrl
{
protected:
DECLARE_MESSAGE_MAP()
afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
};
// CWebSelectFormView dialog
class CWebSelectFormView : public CFormView
{
DECLARE_DYNCREATE(CWebSelectFormView)
public:
CWebSelectFormView(); // standard constructor
virtual ~CWebSelectFormView();
// Dialog Data
enum { IDD = IDD_DIALOG_WEBSITESELECT };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
void OnInitialUpdate();
DECLARE_MESSAGE_MAP()
DECLARE_MENUXP()
DECLARE_HANDLECONTEXTMENUMESSAGES()
afx_msg void OnDestroy();
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnCbnSelChangeComboWebSites();
afx_msg void OnTvnItemExpandingTreeWebSiteDirectories(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnTvnSelChangedTreeWebSiteDirectories(NMHDR *pNMHDR, LRESULT *pResult);
afx_msg void OnBnClickedButtonRefresh();
afx_msg void OnContextMenu(CWnd* pWnd, CPoint pos);
afx_msg void OnExploreFolder();
afx_msg void OnBrowseInternetExplorer();
afx_msg void OnBrowseFirefox();
afx_msg void OnBrowseOpera();
afx_msg void OnBrowseSafari();
afx_msg void OnViewRefresh();
afx_msg void OnCmdUIViewRefresh(CCmdUI* pCmdUI);
afx_msg void OnCmdUIExploreFolder(CCmdUI* pCmdUI);
afx_msg void OnCmdUIToolbarIE(CCmdUI* pCmdUI);
afx_msg void OnCmdUIToolbarFirefox(CCmdUI* pCmdUI);
afx_msg void OnCmdUIToolbarOpera(CCmdUI* pCmdUI);
afx_msg void OnCmdUIToolbarSafari(CCmdUI* pCmdUI);
private:
void PositionChildControls();
void OnWebTreeContextMenu(CWnd* pWnd, CPoint pos);
static CView* GetParentView(CWnd*);
void PopulateTree();
void PopulateWebSiteCombo();
IISWebSite* GetSelectedComboInstanceData(void);
void FreeComboItems();
void FreeTreeItems();
void FreeTreeItems(HTREEITEM htItem);
void SelectWebSiteRoot();
static bool FormatURL(const CAtlArray<IISWebSiteBindings>& Ports, const CAtlArray<IISWebSiteBindings>& SecurePorts, LPCTSTR pszURI, LPCTSTR pszFilename, CString& sURL);
CComboBox m_cWebSites;
CMyRClickTreeCtrl m_cWebDirectories;
CButton m_cRefresh;
CStatic m_cDlgMargins;
CControlMargins m_WebSitesMargins;
CControlMargins m_nWebDirectoriesMargins;
CControlMargins m_nRefreshMargins;
std::set<CStringW> m_IgnoreDirNames;
CImageList m_ImageList;
CBitmap m_bmpFolder;
CBitmap m_bmpVirtualDirectory;
CBitmap m_bmpWebServer;
int m_nFolderIndex;
int m_nVirtualDirectoryIndex;
int m_nWebServerIndex;
CMenu m_WebTreeContext;
CImage m_bmpIE;
CImage m_bmpFolderOpen;
};
|
/*
Copyright (C) 2013 Hong Jen Yee (PCMan) <pcman.tw@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 PCMANFM_DESKTOPWINDOW_H
#define PCMANFM_DESKTOPWINDOW_H
#include "view.h"
#include "launcher.h"
#include <QHash>
#include <QPoint>
#include <QByteArray>
#include <xcb/xcb.h>
#include <libfm-qt/folder.h>
namespace Fm {
class CachedFolderModel;
class ProxyFolderModel;
class FolderViewListView;
}
namespace PCManFM {
class DesktopItemDelegate;
class Settings;
class DesktopWindow : public View {
Q_OBJECT
public:
friend class Application;
enum WallpaperMode {
WallpaperNone,
WallpaperStretch,
WallpaperFit,
WallpaperCenter,
WallpaperTile,
WallpaperZoom
};
explicit DesktopWindow(int screenNum);
virtual ~DesktopWindow();
void setForeground(const QColor& color);
void setShadow(const QColor& color);
void setBackground(const QColor& color);
void setDesktopFolder();
void setWallpaperFile(QString filename);
void setWallpaperMode(WallpaperMode mode = WallpaperStretch);
// void setWallpaperAlpha(qreal alpha);
void updateWallpaper();
void updateFromSettings(Settings& settings);
void queueRelayout(int delay = 0);
int screenNum() const {
return screenNum_;
}
void setScreenNum(int num);
protected:
virtual void prepareFolderMenu(Fm::FolderMenu* menu);
virtual void prepareFileMenu(Fm::FileMenu* menu);
virtual void resizeEvent(QResizeEvent* event);
virtual void onFileClicked(int type, FmFileInfo* fileInfo);
void loadItemPositions();
void saveItemPositions();
QImage loadWallpaperFile(QSize requiredSize);
virtual bool event(QEvent* event);
virtual bool eventFilter(QObject * watched, QEvent * event);
virtual void childDropEvent(QDropEvent* e);
virtual void closeEvent(QCloseEvent *event);
protected Q_SLOTS:
void onOpenDirRequested(FmPath* path, int target);
void onDesktopPreferences();
void onRowsAboutToBeRemoved(const QModelIndex& parent, int start, int end);
void onRowsInserted(const QModelIndex& parent, int start, int end);
void onLayoutChanged();
void onModelSortFilterChanged();
void onIndexesMoved(const QModelIndexList& indexes);
void relayoutItems();
void onStickToCurrentPos(bool toggled);
// void updateWorkArea();
// file operations
void onCutActivated();
void onCopyActivated();
void onPasteActivated();
void onRenameActivated();
void onDeleteActivated();
void onFilePropertiesActivated();
private:
void removeBottomGap();
private:
Fm::ProxyFolderModel* proxyModel_;
Fm::CachedFolderModel* model_;
Fm::Folder folder_;
Fm::FolderViewListView* listView_;
QColor fgColor_;
QColor bgColor_;
QColor shadowColor_;
QString wallpaperFile_;
WallpaperMode wallpaperMode_;
QPixmap wallpaperPixmap_;
DesktopItemDelegate* delegate_;
Launcher fileLauncher_;
bool showWmMenu_;
int screenNum_;
QHash<QByteArray, QPoint> customItemPos_;
QTimer* relayoutTimer_;
};
}
#endif // PCMANFM_DESKTOPWINDOW_H
|
/* This file is part of Syanot
Copyright (C) 2007 Gael de Chalendar <kleag@free.fr>
Syanot 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.
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 SYANOT_EASYRELATION_H
#define SYANOT_EASYRELATION_H
#include <QObject>
#include <QMap>
#include <QString>
#include <QTextStream>
/**
* This is a relation from the easy format.
*
* It will be represented by an edge in the graphical view
*
* @author Gael de Chalendar <kleag@free.fr>
*/
class EasyRelation : public QObject
{
Q_OBJECT
public:
/**
* Default Constructor
*/
EasyRelation() {}
/**
* Default Destructor
*/
virtual ~EasyRelation() {}
inline const QMap<QString,QString>& bounds() const {return m_bounds;}
inline QMap<QString,QString>& bounds() {return m_bounds;}
inline const QString& type() const {return m_type;}
inline void setType(const QString& t) {m_type = t;}
inline bool toPropagate() const {return m_toPropagate;}
inline void setToPropagate(bool b) {m_toPropagate = b;}
inline const QString& id() const {return m_id;}
inline void setId(const QString& id) {m_id = id;}
inline const QString& value() const {return m_value;}
inline void setValue(const QString& v) {m_value = v;}
private:
QMap<QString,QString> m_bounds;
QString m_type;
bool m_toPropagate;
QString m_id;
QString m_value; // used only for ATT-SO relations to distinguish S and O attributes (values are respectively sujet and objet)
};
QTextStream& operator<<(QTextStream& s, const EasyRelation& r);
#endif // SYANOT_EASYRELATION_H
|
/***************************************************************************
commandmove.h - description
-------------------
begin : Fri Apr 12 2002
copyright : (C) 2002 by Henrik Enqvist
email : henqvist@excite.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. *
* *
***************************************************************************/
#ifndef COMMANDMOVE_H
#define COMMANDMOVE_H
using namespace std;
#include <vector>
#include "command.h"
#include "EMath.h"
/** @author Henrik Enqvist */
class CommandMove : public Command {
public:
CommandMove(PinEditDoc * doc);
~CommandMove();
Command * build();
void undo();
void clearObjects();
void execute(const CommandContext & context);
void preview(const CommandContext & context, View2D * view2d, QPainter &painter);
virtual const char * type() { return "CommandMove"; };
private:
vector<Vertex3D> m_vVertex;
vector<int> m_vIndex;
};
#endif
|
// Copyright 2018 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "Common/Config/Config.h"
// This is a temporary soluation, although they should be in their repected cpp file in UICommon.
// However, in order for IsSettingSaveable to commpile without some issues, this needs to be here.
// Once IsSettingSaveable is removed, then you should able to move these back to UICommon.
namespace Config
{
// Configuration Information
// UI.General
extern const ConfigInfo<bool> MAIN_USE_DISCORD_PRESENCE;
extern const ConfigInfo<bool> MAIN_USE_GAME_COVERS;
extern const ConfigInfo<bool> MAIN_FOCUSED_HOTKEYS;
} // namespace Config
|
#ifndef CONFIG_H
#define CONFIG_H
// Number of servo joints
#define NUM_JOINTS 4
// Pins
#define TRIGGER_PIN 3
#define ECHO_PIN 2
#define ECHO_INT 0
#define LHIP_PIN 7
#define LANKLE_PIN 6
#define RANKLE_PIN 5
#define RHIP_PIN 4
// Fast LED Neopixel
#define DATA_PIN 12
// pin references
uint8_t servoPins[NUM_JOINTS] = {LHIP_PIN, LANKLE_PIN, RANKLE_PIN, RHIP_PIN};
// default centers - will be overwritten from EEPROM once calibrated
uint8_t servoCenters[NUM_JOINTS] = {90,90,90,90};
#define COMMAND_QUEUE_LENGTH 15
// Commands
#define MAX_ANIM_CMD 9
#define CMD_FD 0 // forward
#define CMD_BK 1 // backward
#define CMD_LT 2 // turn left
#define CMD_RT 3 // turn right
#define CMD_ST 4 // stop
#define CMD_FT 5 // tap foot
#define CMD_TT 6 // tip toes (balerina)
#define CMD_LL 7 // look left
#define CMD_LR 8 // look right
#define CMD_TF 9 // Tap foot
#endif
|
/*
* Copyright 2009, Jason S. McMullan <jason.mcmullan@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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "ui.h"
static void *null_open(int argc, char **argv)
{
return &null_open;
}
static void null_close(void *ui)
{
}
static aq_key null_keywait(void *ui, unsigned int ms)
{
usleep(ms * 1000);
return AQ_KEY_NOP;
}
static void null_timestamp(void *ui)
{
}
static void null_debug(void *ui, const char *fmt, va_list args)
{
}
static void null_show_title(void *ui, const char *title)
{
}
static void null_show_sensor(void *ui, const char *title, struct aq_sensor *sen)
{
}
static void null_show_device(void *ui, const char *title, struct aq_device *dev)
{
}
static void null_clear(void *ui)
{
}
static void null_flush(void *ui)
{
}
static struct aquaria_ui null_ui = {
.name = "null",
.open = null_open,
.close = null_close,
.keywait = null_keywait,
.timestamp = null_timestamp,
.debug = null_debug,
.show_title = null_show_title,
.show_sensor = null_show_sensor,
.show_device = null_show_device,
.clear = null_clear,
.flush = null_flush,
};
const struct aquaria_ui *aquaria_ui = &null_ui;
|
/*
* Mutex Handler
*
* DESCRIPTION:
*
* This package is the implementation of the Mutex Handler.
* This handler provides synchronization and mutual exclusion capabilities.
*
* COPYRIGHT (c) 1989-1999.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id$
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/system.h>
#include <rtems/score/isr.h>
#include <rtems/score/coremutex.h>
#include <rtems/score/states.h>
#include <rtems/score/thread.h>
#include <rtems/score/threadq.h>
/*
* _CORE_mutex_Flush
*
* This function a flushes the mutex's task wait queue.
*
* Input parameters:
* the_mutex - the mutex to be flushed
* remote_extract_callout - function to invoke remotely
* status - status to pass to thread
*
* Output parameters: NONE
*/
void _CORE_mutex_Flush(
CORE_mutex_Control *the_mutex,
Thread_queue_Flush_callout remote_extract_callout,
uint32_t status
)
{
_Thread_queue_Flush(
&the_mutex->Wait_queue,
remote_extract_callout,
status
);
}
|
/* Copyright (c) 2003-2008 Timothy B. Terriberry
Copyright (c) 2008 Xiph.Org Foundation */
/*
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*Some common macros for potential platform-specific optimization.*/
#include "opus_types.h"
#include <math.h>
#include <limits.h>
#include "arch.h"
#if !defined(_ecintrin_H)
# define _ecintrin_H (1)
/*Some specific platforms may have optimized intrinsic or OPUS_INLINE assembly
versions of these functions which can substantially improve performance.
We define macros for them to allow easy incorporation of these non-ANSI
features.*/
/*Modern gcc (4.x) can compile the naive versions of min and max with cmov if
given an appropriate architecture, but the branchless bit-twiddling versions
are just as fast, and do not require any special target architecture.
Earlier gcc versions (3.x) compiled both code to the same assembly
instructions, because of the way they represented ((_b)>(_a)) internally.*/
# define EC_MINI(_a,_b) ((_a)+(((_b)-(_a))&-((_b)<(_a))))
/*Count leading zeros.
This macro should only be used for implementing ec_ilog(), if it is defined.
All other code should use EC_ILOG() instead.*/
#if defined(_MSC_VER) && (_MSC_VER >= 1400)
# include <intrin.h>
/*In _DEBUG mode this is not an intrinsic by default.*/
# pragma intrinsic(_BitScanReverse)
static __inline int ec_bsr(unsigned long _x){
unsigned long ret;
_BitScanReverse(&ret,_x);
return (int)ret;
}
# define EC_CLZ0 (1)
# define EC_CLZ(_x) (-ec_bsr(_x))
#elif defined(ENABLE_TI_DSPLIB)
# include "dsplib.h"
# define EC_CLZ0 (31)
# define EC_CLZ(_x) (_lnorm(_x))
#elif __GNUC_PREREQ(3,4)
# if INT_MAX>=2147483647
# define EC_CLZ0 ((int)sizeof(unsigned)*CHAR_BIT)
# define EC_CLZ(_x) (__builtin_clz(_x))
# elif LONG_MAX>=2147483647L
# define EC_CLZ0 ((int)sizeof(unsigned long)*CHAR_BIT)
# define EC_CLZ(_x) (__builtin_clzl(_x))
# endif
#endif
#if defined(EC_CLZ)
/*Note that __builtin_clz is not defined when _x==0, according to the gcc
documentation (and that of the BSR instruction that implements it on x86).
The majority of the time we can never pass it zero.
When we need to, it can be special cased.*/
# define EC_ILOG(_x) (EC_CLZ0-EC_CLZ(_x))
#else
int ec_ilog(opus_uint32 _v);
# define EC_ILOG(_x) (ec_ilog(_x))
#endif
#endif
|
/* Copyright (c) 2013-2014, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef MDP3_CTRL_H
#define MDP3_CTRL_H
#include <linux/types.h>
#include <linux/mutex.h>
#include <linux/completion.h>
#include <linux/timer.h>
#include "mdp3.h"
#include "mdp3_dma.h"
#include "mdss_fb.h"
#include "mdss_panel.h"
#define MDP3_MAX_BUF_QUEUE 8
struct mdp3_buffer_queue {
struct mdp3_img_data img_data[MDP3_MAX_BUF_QUEUE];
int count;
int push_idx;
int pop_idx;
};
#ifdef CONFIG_FB_MSM_MDSS_MDP3_KCAL_CTRL
#define R_MASK 0xff0000
#define G_MASK 0xff00
#define B_MASK 0xff
#define R_SHIFT 16
#define G_SHIFT 8
#define B_SHIFT 0
#define NUM_QLUT 256
#define MAX_KCAL_V (NUM_QLUT - 1)
#define lut2rgb(lut,mask,shift) ((lut & mask) >> shift)
#define scaled_by_kcal(rgb, kcal) \
(((((unsigned int)(rgb) * (unsigned int)(kcal)) << 16) / \
(unsigned int)MAX_KCAL_V) >> 16)
struct kcal_lut_data {
int red;
int green;
int blue;
int minimum;
};
#endif
struct mdp3_session_data {
struct mutex lock;
int status;
struct mdp3_dma *dma;
struct mdss_panel_data *panel;
struct mdp3_intf *intf;
struct msm_fb_data_type *mfd;
ktime_t vsync_time;
struct timer_list vsync_timer;
int vsync_period;
struct sysfs_dirent *vsync_event_sd;
struct mdp_overlay overlay;
struct mdp_overlay req_overlay;
struct mdp3_buffer_queue bufq_in;
struct mdp3_buffer_queue bufq_out;
struct work_struct clk_off_work;
struct work_struct dma_done_work;
atomic_t dma_done_cnt;
int histo_status;
struct mutex histo_lock;
int lut_sel;
int cc_vect_sel;
bool vsync_before_commit;
bool first_commit;
int clk_on;
struct blocking_notifier_head notifier_head;
int vsync_enabled;
atomic_t vsync_countdown; /* Used to count down */
#ifdef CONFIG_FB_MSM_MDSS_MDP3_KCAL_CTRL
struct kcal_lut_data lut_data;
#endif
};
int mdp3_ctrl_init(struct msm_fb_data_type *mfd);
#endif /* MDP3_CTRL_H */
|
/*****************************************************************************
*
* sectest.c
* Purpose ...............: Security flags access test
*
*****************************************************************************
* Copyright (C) 1997-2004 Michiel Broek <mbse@mbse.eu>
* Copyright (C) 2013 Robert James Clay <jame@rocasa.us>
*
* This file is part of FTNd.
*
* This BBS is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2, or (at your option) any
* later version.
*
* FTNd 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 FTNd; see the file COPYING. If not, write to the Free
* Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*****************************************************************************/
#include "../config.h"
#include "ftndlib.h"
/*
* Security Access Check
*/
int Access(securityrec us, securityrec ref)
{
if (us.level < ref.level)
return FALSE;
if ((ref.notflags & ~us.flags) != ref.notflags)
return FALSE;
if ((ref.flags & us.flags) != ref.flags)
return FALSE;
return TRUE;
}
/*
* The same test, for menus which are written in machine endian independant way.
* The second parameter MUST be the menu parameter.
*/
int Le_Access(securityrec us, securityrec ref)
{
if (us.level < le_int(ref.level))
return FALSE;
if ((ref.notflags & ~us.flags) != ref.notflags)
return FALSE;
if ((ref.flags & us.flags) != ref.flags)
return FALSE;
return TRUE;
}
|
/* -*- Mode: C; c-file-style: "gnu"; tab-width: 8 -*- */
/* Copyright (C) 2005 Carlos Garnacho
*
* 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.
*
* 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.
*
* Authors: Carlos Garnacho Parro <carlosg@gnome.org>
*/
#ifndef __OOBS_SHARE_NFS_H__
#define __OOBS_SHARE_NFS_H__
#include "oobs-share.h"
G_BEGIN_DECLS
#define OOBS_TYPE_SHARE_NFS (oobs_share_nfs_get_type())
#define OOBS_SHARE_NFS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), OOBS_TYPE_SHARE_NFS, OobsShareNFS))
#define OOBS_SHARE_NFS_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), OOBS_TYPE_SHARE_NFS, OobsShareNFSClass))
#define OOBS_IS_SHARE_NFS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), OOBS_TYPE_SHARE_NFS))
#define OOBS_IS_SHARE_NFS_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), OOBS_TYPE_SHARE_NFS))
#define OOBS_SHARE_NFS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), OOBS_TYPE_SHARE_NFS, OobsShareNFSClass))
typedef struct _OobsShareNFS OobsShareNFS;
typedef struct _OobsShareNFSClass OobsShareNFSClass;
typedef struct _OobsShareAclElement OobsShareAclElement;
struct _OobsShareNFS {
OobsShare parent;
/*<private>*/
gpointer _priv;
};
struct _OobsShareNFSClass {
OobsShareClass parent_class;
void (*_oobs_padding1) (void);
void (*_oobs_padding2) (void);
};
struct _OobsShareAclElement {
gchar *element;
gboolean read_only;
};
GType oobs_share_nfs_get_type (void);
OobsShare* oobs_share_nfs_new (const gchar *path);
void oobs_share_nfs_add_acl_element (OobsShareNFS *share, const gchar *element, gboolean read_only);
void oobs_share_nfs_set_acl (OobsShareNFS *share, GSList *acl);
GSList* oobs_share_nfs_get_acl (OobsShareNFS *share);
G_END_DECLS
#endif /* __SHARE_NFS_EXPORT_H__ */
|
//
// DetailViewController.h
// Vehicles
//
// Created by Transferred on 9/8/13.
// Copyright (c) 2013 Designated Nerd Software. All rights reserved.
//
#import <UIKit/UIKit.h>
//Forward declaration of a class to be imported in the .m file
@class Vehicle;
@interface VehicleDetailViewController : UIViewController <UIAlertViewDelegate>
@property (strong, nonatomic) Vehicle *detailVehicle;
@end
|
/* Copyright (C) 1995-2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, August 1995.
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 <errno.h>
#include <sys/msg.h>
#include <ipc_priv.h>
#include <sysdep-cancel.h>
#include <sys/syscall.h>
#include <bp-checks.h>
int
__libc_msgsnd (msqid, msgp, msgsz, msgflg)
int msqid;
const void *msgp;
size_t msgsz;
int msgflg;
{
if (SINGLE_THREAD_P)
return INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
msgflg, (void *) CHECK_N (msgp, msgsz));
int oldtype = LIBC_CANCEL_ASYNC ();
int result = INLINE_SYSCALL (ipc, 5, IPCOP_msgsnd, msqid, msgsz,
msgflg, (void *) CHECK_N (msgp, msgsz));
LIBC_CANCEL_RESET (oldtype);
return result;
}
weak_alias (__libc_msgsnd, msgsnd)
|
#pragma once
#include "../Editor/xMedusaEditorImpl.h"
class CTabWindowContainer : public CWnd
{
// Construction
public:
CTabWindowContainer();
virtual ~CTabWindowContainer();
void SetMEdDockPane(nsMedusaEditor::IMEdUIElement* pPane);
BOOL Create( CWnd* pWnd , int w );
protected:
void AdjustLayout();
protected:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnSetFocus(CWnd* pOldWnd);
DECLARE_MESSAGE_MAP()
protected:
HWND m_hChildWindow;
// Implementation
};
|
/* -*- mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- */
// vim: ft=cpp:expandtab:ts=8:sw=4:softtabstop=4:
#ident "$Id$"
/*
COPYING CONDITIONS NOTICE:
This program is free software; you can redistribute it and/or modify
it under the terms of version 2 of the GNU General Public License as
published by the Free Software Foundation, and provided that the
following conditions are met:
* Redistributions of source code must retain this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below).
* Redistributions in binary form must reproduce this COPYING
CONDITIONS NOTICE, the COPYRIGHT NOTICE (below), the
DISCLAIMER (below), the UNIVERSITY PATENT NOTICE (below), the
PATENT MARKING NOTICE (below), and the PATENT RIGHTS
GRANT (below) in the documentation and/or other materials
provided with the distribution.
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.
COPYRIGHT NOTICE:
TokuDB, Tokutek Fractal Tree Indexing Library.
Copyright (C) 2007-2013 Tokutek, Inc.
DISCLAIMER:
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.
UNIVERSITY PATENT NOTICE:
The technology is licensed by the Massachusetts Institute of
Technology, Rutgers State University of New Jersey, and the Research
Foundation of State University of New York at Stony Brook under
United States of America Serial No. 11/760379 and to the patents
and/or patent applications resulting from it.
PATENT MARKING NOTICE:
This software is covered by US Patent No. 8,185,551.
This software is covered by US Patent No. 8,489,638.
PATENT RIGHTS GRANT:
"THIS IMPLEMENTATION" means the copyrightable works distributed by
Tokutek as part of the Fractal Tree project.
"PATENT CLAIMS" means the claims of patents that are owned or
licensable by Tokutek, both currently or in the future; and that in
the absence of this license would be infringed by THIS
IMPLEMENTATION or by using or running THIS IMPLEMENTATION.
"PATENT CHALLENGE" shall mean a challenge to the validity,
patentability, enforceability and/or non-infringement of any of the
PATENT CLAIMS or otherwise opposing any of the PATENT CLAIMS.
Tokutek hereby grants to you, for the term and geographical scope of
the PATENT CLAIMS, a non-exclusive, no-charge, royalty-free,
irrevocable (except as stated in this section) patent license to
make, have made, use, offer to sell, sell, import, transfer, and
otherwise run, modify, and propagate the contents of THIS
IMPLEMENTATION, where such license applies only to the PATENT
CLAIMS. This grant does not include claims that would be infringed
only as a consequence of further modifications of THIS
IMPLEMENTATION. If you or your agent or licensee institute or order
or agree to the institution of patent litigation against any entity
(including a cross-claim or counterclaim in a lawsuit) alleging that
THIS IMPLEMENTATION constitutes direct or contributory patent
infringement, or inducement of patent infringement, then any rights
granted to you under this License shall terminate as of the date
such litigation is filed. If you or your agent or exclusive
licensee institute or order or agree to the institution of a PATENT
CHALLENGE, then Tokutek may terminate any rights granted to you
under this License.
*/
#ident "Copyright (c) 2007-2013 Tokutek Inc. All rights reserved."
#ident "The technology is licensed by the Massachusetts Institute of Technology, Rutgers State University of New Jersey, and the Research Foundation of State University of New York at Stony Brook under United States of America Serial No. 11/760379 and to the patents and/or patent applications resulting from it."
#include <toku_race_tools.h>
template <class F>
void treenode::traverse_overlaps(const keyrange &range, F *function) {
keyrange::comparison c = range.compare(m_cmp, m_range);
if (c == keyrange::comparison::EQUALS) {
// Doesn't matter if fn wants to keep going, there
// is nothing left, so return.
function->fn(m_range, m_txnid);
return;
}
treenode *left = m_left_child.get_locked();
if (left) {
if (c != keyrange::comparison::GREATER_THAN) {
// Target range is less than this node, or it overlaps this
// node. There may be something on the left.
left->traverse_overlaps(range, function);
}
left->mutex_unlock();
}
if (c == keyrange::comparison::OVERLAPS) {
bool keep_going = function->fn(m_range, m_txnid);
if (!keep_going) {
return;
}
}
treenode *right = m_right_child.get_locked();
if (right) {
if (c != keyrange::comparison::LESS_THAN) {
// Target range is greater than this node, or it overlaps this
// node. There may be something on the right.
right->traverse_overlaps(range, function);
}
right->mutex_unlock();
}
}
|
/***************************************************************************
* Copyright (C) 2002~2005 by Yuking *
* yuking_net@sohu.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 St, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
/**
* @file AutoEng.h
* @author Yuking yuking_net@sohu.com
* @date 2008-1-16
*
* Auto Switch to English State
*
*/
#ifndef _FCITX_AUTOENG_H_
#define _FCITX_AUTOENG_H_
#define MAX_AUTO_TO_ENG 10
#include "fcitx-config/fcitx-config.h"
typedef struct AUTO_ENG {
char str[MAX_AUTO_TO_ENG + 1];
} AUTO_ENG;
#endif
// kate: indent-mode cstyle; space-indent on; indent-width 0;
|
#ifndef EF_NET_THREAD_H
#define EF_NET_THREAD_H
#include <map>
#include <set>
#include <list>
#include <string>
#include <iostream>
#include "ef_common.h"
#include "ef_sock.h"
#include "ef_timer.h"
#include "base/ef_thread.h"
#include "base/ef_atomic.h"
#include "base/ef_loop_buf.h"
namespace ef{
class Device;
class Connection;
class Acceptor;
class NetOperator;
class EventLoop;
typedef int32 (*OBJ_INIT)(EventLoop* l, void* obj);
typedef int32 (*OBJ_CLEAN)(EventLoop* l, void* obj);
class EventLoop{
public:
EventLoop();
virtual ~EventLoop();
int32 addNotify(Device *con, int32 noti);
int32 clearNotify(Device *con);
int32 modifyNotify(Device *con, int32 noti);
int32 asynAddConnection(Connection *con);
int32 asynCloseConnection(int32 id);
int32 asynCloseAllConnections();
int32 asynSendMessage(int32 id, const std::string &msg);
int32 addAsynOperator(NetOperator* op = NULL);
int32 init();
int32 run();
int32 stop();
int32 setObj(void* obj, OBJ_INIT it, OBJ_CLEAN cl){
int32 ret = 0;
if(m_clean)
ret = m_clean(this, m_obj);
m_obj = obj;
m_init = it;
m_clean = cl;
return ret;
}
void* getObj(){
return m_obj;
}
int32 getId(){
return m_id;
}
void setId(int32 id){
m_id = id;
}
//the function below is not thread safe
int32 addTimer(Timer* tm);
int32 delTimer(Timer* tm);
int32 addConnection(Connection *con);
int32 delConnection(int32 id);
int32 closeConnection(int32 id);
Connection* getConnection(int32 id);
int32 sendMessage(int32 id, const std::string &msg);
int32 closeAllConnections();
size_t ConnectionsCount();
private:
int32 startCtl();
int32 delAllConnections();
int32 delAllOp();
//return next timer start after ms
int64 processTimers();
int32 processOps();
struct less
{ // functor for operator<
bool operator()
(const Timer* _Left, const Timer* _Right) const
{
if(_Left == _Right)
return false;
bool ret = *_Left < *_Right;
//std::cout <<"less ret:" << ret << ", L:" << std::hex << _Left
// << ", R:" << _Right << std::dec << ", l.sec:" << _Left->getTimeoutTime().m_sec << ", l.usec:" << _Left->getTimeoutTime().m_usec << ", R.sec:" << _Right->getTimeoutTime().m_sec << ", R.usec:" << _Right->getTimeoutTime().m_usec << std::endl;
return ret;
}
};
enum{
STATUS_INIT = 0,
STATUS_RUNNING = 1,
STATUS_CLOSING = 2,
STATUS_CLOSED = 3,
};
int32 m_max_fds;
volatile int32 m_status;
SOCKET m_epl;
SOCKET m_ctlfd;
int32 m_ctlport;
SOCKET m_ctlfd1;
typedef std::map<int32, Connection*> con_map;
con_map m_con_map;
typedef std::set<Timer*, less> timer_map;
timer_map m_timer_map;
MUTEX m_opcs;
volatile int32 m_ops_flag;
LoopBuf m_ops;
int32 m_id;
void* m_obj;
OBJ_INIT m_init;
OBJ_CLEAN m_clean;
};
};
#endif/*EF_NET_THREAD_H*/
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.