text
stringlengths 4
6.14k
|
|---|
#ifndef COIN_SOSHADOWSTYLEELEMENT_H
#define COIN_SOSHADOWSTYLEELEMENT_H
/**************************************************************************\
*
* This file is part of the Coin 3D visualization library.
* Copyright (C) 1998-2008 by Kongsberg SIM. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* ("GPL") version 2 as published by the Free Software Foundation.
* See the file LICENSE.GPL at the root directory of this source
* distribution for additional information about the GNU GPL.
*
* For using Coin with software that can not be combined with the GNU
* GPL, and for taking advantage of the additional benefits of our
* support services, please contact Kongsberg SIM about acquiring
* a Coin Professional Edition License.
*
* See http://www.coin3d.org/ for more information.
*
* Kongsberg SIM, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
* http://www.sim.no/ sales@sim.no coin-support@coin3d.org
*
\**************************************************************************/
#include <Inventor/elements/SoInt32Element.h>
class COIN_DLL_API SoShadowStyleElement : public SoInt32Element {
typedef SoInt32Element inherited;
SO_ELEMENT_HEADER(SoShadowStyleElement);
public:
static void initClass(void);
protected:
virtual ~SoShadowStyleElement();
public:
enum StyleFlags {
NO_SHADOWING = 0x0,
CASTS_SHADOW = 0x1,
SHADOWED = 0x2,
CASTS_SHADOW_AND_SHADOWED = CASTS_SHADOW|SHADOWED
};
virtual void init(SoState * state);
static void set(SoState * const state, SoNode * const node,
const int styleflags);
static void set(SoState * const state, const int styleflags);
static int get(SoState * const state);
static int getDefault(void);
};
#endif // !COIN_SOSHADOWSTYLEELEMENT_H
|
/*
* Copyright (c) 2003, 2007-8 Matteo Frigo
* Copyright (c) 2003, 2007-8 Massachusetts Institute of Technology
*
* See the file COPYING for license information.
*
*/
/* This file was automatically generated --- DO NOT EDIT */
/* Generated on Mon Nov 10 20:54:56 EST 2008 */
#include "codelet-rdft.h"
#ifdef HAVE_FMA
/* Generated by: ../../../genfft/gen_hc2hc -fma -reorder-insns -schedule-for-pipeline -compact -variables 4 -pipeline-latency 4 -sign 1 -n 3 -dif -name hb_3 -include hb.h */
/*
* This function contains 16 FP additions, 14 FP multiplications,
* (or, 6 additions, 4 multiplications, 10 fused multiply/add),
* 27 stack variables, 2 constants, and 12 memory accesses
*/
#include "hb.h"
static void hb_3(R *cr, R *ci, const R *W, stride rs, INT mb, INT me, INT ms)
{
DK(KP866025403, +0.866025403784438646763723170752936183471402627);
DK(KP500000000, +0.500000000000000000000000000000000000000000000);
INT m;
for (m = mb, W = W + ((mb - 1) * 4); m < me; m = m + 1, cr = cr + ms, ci = ci - ms, W = W + 4, MAKE_VOLATILE_STRIDE(rs)) {
E Tk, Tj, Tn, Tl, Tm, To;
{
E T1, Td, T7, T8, T4, Tg, T2, T3;
T1 = cr[0];
T2 = cr[WS(rs, 1)];
T3 = ci[0];
Td = ci[WS(rs, 2)];
T7 = ci[WS(rs, 1)];
T8 = cr[WS(rs, 2)];
T4 = T2 + T3;
Tg = T2 - T3;
{
E T5, Tc, Tf, Ta, T9, Te, T6, Th, Ti, Tb;
T5 = W[0];
T9 = T7 + T8;
Te = T7 - T8;
cr[0] = T1 + T4;
T6 = FNMS(KP500000000, T4, T1);
Tc = W[1];
ci[0] = Td + Te;
Tf = FNMS(KP500000000, Te, Td);
Tk = FMA(KP866025403, T9, T6);
Ta = FNMS(KP866025403, T9, T6);
Tj = W[2];
Tn = FNMS(KP866025403, Tg, Tf);
Th = FMA(KP866025403, Tg, Tf);
Ti = Tc * Ta;
Tb = T5 * Ta;
Tl = Tj * Tk;
Tm = W[3];
ci[WS(rs, 1)] = FMA(T5, Th, Ti);
cr[WS(rs, 1)] = FNMS(Tc, Th, Tb);
}
}
cr[WS(rs, 2)] = FNMS(Tm, Tn, Tl);
To = Tm * Tk;
ci[WS(rs, 2)] = FMA(Tj, Tn, To);
}
}
static const tw_instr twinstr[] = {
{TW_FULL, 1, 3},
{TW_NEXT, 1, 0}
};
static const hc2hc_desc desc = { 3, "hb_3", twinstr, &GENUS, {6, 4, 10, 0} };
void X(codelet_hb_3) (planner *p) {
X(khc2hc_register) (p, hb_3, &desc);
}
#else /* HAVE_FMA */
/* Generated by: ../../../genfft/gen_hc2hc -compact -variables 4 -pipeline-latency 4 -sign 1 -n 3 -dif -name hb_3 -include hb.h */
/*
* This function contains 16 FP additions, 12 FP multiplications,
* (or, 10 additions, 6 multiplications, 6 fused multiply/add),
* 15 stack variables, 2 constants, and 12 memory accesses
*/
#include "hb.h"
static void hb_3(R *cr, R *ci, const R *W, stride rs, INT mb, INT me, INT ms)
{
DK(KP866025403, +0.866025403784438646763723170752936183471402627);
DK(KP500000000, +0.500000000000000000000000000000000000000000000);
INT m;
for (m = mb, W = W + ((mb - 1) * 4); m < me; m = m + 1, cr = cr + ms, ci = ci - ms, W = W + 4, MAKE_VOLATILE_STRIDE(rs)) {
E T1, T4, Ta, Te, T5, T8, Tb, Tf;
{
E T2, T3, T6, T7;
T1 = cr[0];
T2 = cr[WS(rs, 1)];
T3 = ci[0];
T4 = T2 + T3;
Ta = FNMS(KP500000000, T4, T1);
Te = KP866025403 * (T2 - T3);
T5 = ci[WS(rs, 2)];
T6 = ci[WS(rs, 1)];
T7 = cr[WS(rs, 2)];
T8 = T6 - T7;
Tb = KP866025403 * (T6 + T7);
Tf = FNMS(KP500000000, T8, T5);
}
cr[0] = T1 + T4;
ci[0] = T5 + T8;
{
E Tc, Tg, T9, Td;
Tc = Ta - Tb;
Tg = Te + Tf;
T9 = W[0];
Td = W[1];
cr[WS(rs, 1)] = FNMS(Td, Tg, T9 * Tc);
ci[WS(rs, 1)] = FMA(T9, Tg, Td * Tc);
}
{
E Ti, Tk, Th, Tj;
Ti = Ta + Tb;
Tk = Tf - Te;
Th = W[2];
Tj = W[3];
cr[WS(rs, 2)] = FNMS(Tj, Tk, Th * Ti);
ci[WS(rs, 2)] = FMA(Th, Tk, Tj * Ti);
}
}
}
static const tw_instr twinstr[] = {
{TW_FULL, 1, 3},
{TW_NEXT, 1, 0}
};
static const hc2hc_desc desc = { 3, "hb_3", twinstr, &GENUS, {10, 6, 6, 0} };
void X(codelet_hb_3) (planner *p) {
X(khc2hc_register) (p, hb_3, &desc);
}
#endif /* HAVE_FMA */
|
/*
memoryword.w
Copyright 2009-2010 Taco Hoekwater <taco@@luatex.org>
This file is part of LuaTeX.
LuaTeX 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.
LuaTeX 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 General Public License along
with LuaTeX; if not, see <http://www.gnu.org/licenses/>.
*/
#include "ptexlib.h"
/*tex
The debug code is no longer present!
*/
|
#ifndef ALIGNEDREADCONVERT_H_
#define ALIGNEDREADCONVERT_H_
#include <stdlib.h>
#include <stdio.h>
#include <zlib.h>
#include "AlignedRead.h"
#include "AlignedEntry.h"
#include "BError.h"
void AlignedReadConvertPrintHeader(FILE*, RGBinary*, int, char*);
void AlignedReadConvertPrintOutputFormat(AlignedRead*, RGBinary*, FILE*, gzFile, char*, char*, int, int*, int, int, int, int);
void AlignedReadConvertPrintSAM(AlignedRead*, RGBinary*, int32_t, int32_t*, char*, char*, int, int, FILE*);
void AlignedReadConvertPrintAlignedEntryToSAM(AlignedRead*, RGBinary*, int32_t, int32_t, int32_t, int32_t*, char*, char*, int, int, FILE*);
void AlignedReadConvertPrintAlignedEntryToCIGAR(AlignedEntry*, char alignment[3][SEQUENCE_LENGTH], int32_t, int32_t, char*, char*, int32_t*, FILE*);
#endif
|
/*
* Copyright (c) 2002-2003, Intel Corporation. All rights reserved.
* Created by: rusty.lynch REMOVE-THIS AT intel DOT com
* This file is licensed under the GPL license. For the full content
* of this license, see the COPYING file at the top level of this
* source tree.
Test case for assertion #25 of the sigaction system call that verifies
that when the sa_sigaction signal-catching function is entered, then
the signal that was caught is added to the signal mask by raising that
signal in the signal handler and verifying that the handler is not
reentered.
Steps:
1. Fork a new process
2. (parent) wait for child
3. (child) Setup a signal handler for SIGTRAP
4. (child) raise SIGTRAP
5. (child, signal handler) increment handler count
6. (child, signal handler) if count is 1 then raise SIGTRAP
7. (child, signal handler) if count is 2 then set error variable
8. (child) if error is set then return -1, else return 0
6. (parent - returning from wait) If child returned 0 then exit 0,
otherwise exit -1.
*/
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <unistd.h>
#include "posixtest.h"
int handler_count = 0;
int handler_error = 0;
void handler(int signo)
{
static int inside_handler = 0;
printf("SIGTRAP caught\n");
if (inside_handler) {
printf("Signal caught while inside handler\n");
handler_error++;
exit(-1);
}
inside_handler++;
handler_count++;
if (handler_count == 1) {
printf("Raising SIGTRAP\n");
raise(SIGTRAP);
printf("Returning from raising SIGTRAP\n");
}
inside_handler--;
}
int main()
{
if (fork() == 0) {
/* child */
struct sigaction act;
act.sa_handler = handler;
act.sa_flags = 0;
sigemptyset(&act.sa_mask);
if (sigaction(SIGTRAP, &act, 0) == -1) {
perror("Unexpected error while attempting to "
"setup test pre-conditions");
return PTS_UNRESOLVED;
}
if (raise(SIGTRAP) == -1) {
perror("Unexpected error while attempting to "
"setup test pre-conditions");
return PTS_UNRESOLVED;
}
if (handler_error)
return PTS_UNRESOLVED;
return PTS_PASS;
} else {
int s;
/* parent */
if (wait(&s) == -1) {
perror("Unexpected error while setting up test "
"pre-conditions");
return PTS_UNRESOLVED;
}
if (!WEXITSTATUS(s)) {
printf("Test PASSED\n");
return PTS_PASS;
}
}
printf("Test FAILED\n");
return PTS_FAIL;
}
|
/* xkb-callbacks.h
*
* Copyright (C) 2016 Dmytro Poltavchenko <dmytro.poltavchenko@gmail.com>
*
* Copyright (C) 2008 Alexander Iliev <sasoiliev@mamul.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _GXKB_CALLBACKS_H_
#define _GXKB_CALLBACKS_H_
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "xkb-config.h"
#include <libwnck/libwnck.h>
void xkb_active_window_changed(WnckScreen *screen,
WnckWindow *previously_active_window,
t_xkb_settings *xkb);
void xkb_application_closed(WnckScreen *screen, WnckApplication *app,
t_xkb_settings *xkb);
void xkb_window_closed(WnckScreen *screen, WnckWindow *window,
t_xkb_settings *xkb);
void xkb_about(void);
void xkb_main_quit(void);
#endif
|
/* arch/arm/mach-exynos/hardware.c
*
* Meizu Mobilephone Hardware information support
*
* Author : Li Tao <litao@meizu.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/bootinfo.h>
#include <asm/mach-types.h>
#include <mach/hardware.h>
unsigned int meizu_board_mdm_type(void)
{
unsigned int mdm_type = MEIZU_MDM_XMM6260;
if (machine_is_m69())
mdm_type = MEIZU_MDM_SC8803G;
return mdm_type;
}
/* ID PCB NFC
* 000 V1.0 T
* 001 V1.0 F
* 010 V2.0 T
* 011 V2.0 F
*/
bool meizu_board_have_nfc(void)
{
bool have_nfc = false;
u8 board_version = m6x_get_board_version();
/*bit0: [0] NFC-> true, [1] NFC-> false*/
if (!(board_version & 0x1))
have_nfc = true;
return have_nfc;
}
static int c_show(struct seq_file *m, void *v)
{
u8 board_version = m6x_get_board_version();
seq_printf(m, "SOC\t\t: %s\n", "EXYNOS5410");
seq_printf(m, "Version\t\t: %d\n", board_version);
seq_printf(m, "NFC\t\t: %s\n", meizu_board_have_nfc()? "true":"false");
seq_printf(m, "Modem\t\t: %s\n", (meizu_board_mdm_type() == MEIZU_MDM_XMM6260)? "WCDMA":"TD-SCDMA");
return 0;
}
/*proc functions*/
static void *c_start(struct seq_file *m, loff_t *pos)
{
return *pos < 1 ? (void *)1 : NULL;
}
static void *c_next(struct seq_file *m, void *v, loff_t *pos)
{
++*pos;
return NULL;
}
static void c_stop(struct seq_file *m, void *v)
{
}
static const struct seq_operations hwinfo_op = {
.start = c_start,
.next = c_next,
.stop = c_stop,
.show = c_show
};
static int hwinfo_open(struct inode *inode, struct file *file)
{
return seq_open(file, &hwinfo_op);
}
static const struct file_operations proc_hwinfo_operations = {
.open = hwinfo_open,
.read = seq_read,
.llseek = seq_lseek,
.release = seq_release,
};
static int __init proc_hwinfo_init(void)
{
proc_create("hwinfo", 0, NULL, &proc_hwinfo_operations);
return 0;
}
module_init(proc_hwinfo_init);
MODULE_DESCRIPTION("Meizu Mobilephone Hardware Information");
MODULE_AUTHOR("Li Tao <litao@meizu.com>");
MODULE_LICENSE("GPL");
|
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <asm/uaccess.h>
#include <linux/version.h>
#include <linux/types.h>
#include <linux/kdev_t.h>
#include <linux/device.h>
#include <linux/cdev.h>
#define GPIO_NUMBER 56
static dev_t first; // Global variable for the first device number
static struct cdev c_dev; // Global variable for the character device structure
static struct class *cl; // Global variable for the device class
static ssize_t gpio_read(struct file* F, char *buf, size_t count, loff_t *f_pos)
{
unsigned char temp = gpio_get_value(GPIO_NUMBER);
if (copy_to_user(buf, &temp, 1))
{
return -EFAULT;
}
return count;
}
static ssize_t gpio_write(struct file* F, const char *buf, size_t count, loff_t *f_pos)
{
char temp;
if (copy_from_user(&temp, buf, count))
{
return -EFAULT;
}
printk(KERN_INFO "Executing WRITE.\n");
switch (temp)
{
case '0':
gpio_set_value(GPIO_NUMBER, 0);
break;
case '1':
gpio_set_value(GPIO_NUMBER, 1);
break;
default:
printk("Wrong option.\n");
break;
}
return count;
}
static int gpio_open(struct inode *inode, struct file *file)
{
return 0;
}
static int gpio_close(struct inode *inode, struct file *file)
{
return 0;
}
static struct file_operations file_ops =
{
.owner = THIS_MODULE,
.open = gpio_open,
.read = gpio_read,
.write = gpio_write,
.release = gpio_close,
};
static int init_gpio(void)
{
int ret;
struct device *dev_ret;
if ((ret = alloc_chrdev_region(&first, 0, 1, "gpio_drv")) < 0)
{
printk(KERN_ALERT "Device registration failed\n");
return ret;
}
printk("Major Nr: %d\n", MAJOR(first));
if (IS_ERR(cl = class_create(THIS_MODULE, "gpiodrv")))
{
printk(KERN_ALERT "Class creation failed\n");
unregister_chrdev_region(first, 1);
return PTR_ERR(cl);
}
if (IS_ERR(dev_ret = device_create(cl, NULL, first, NULL, "gpio_drv%d", 0)))
{
printk(KERN_ALERT "Device creation failed\n");
class_destroy(cl);
unregister_chrdev_region(first, 1);
return PTR_ERR(dev_ret);
}
cdev_init(&c_dev, &file_ops);
if ((ret = cdev_add(&c_dev, first, 1)) < 0)
{
printk(KERN_ALERT "Device addition failed\n");
device_destroy(cl, first);
class_destroy(cl);
unregister_chrdev_region(first, 1);
return ret;
}
return 0;
}
void cleanup_gpio(void)
{
cdev_del(&c_dev);
device_destroy(cl, first);
class_destroy(cl);
unregister_chrdev_region(first, 1);
printk(KERN_INFO "Device unregistered\n");
}
module_init(init_gpio);
module_exit(cleanup_gpio);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("SysPlay Workshops <workshop@sysplay.in>");
MODULE_DESCRIPTION("GPIO Demo");
|
/*****************************************************************
* $Id: std_comptype.h 0001 2016-07-13T15:39:19 rutger $
*
* Copyright (C) 2016 Red-Bag. All rights reserved.
* This file is part of the Biluna STD project.
*
* See http://www.biluna.com for further details.
*****************************************************************/
#ifndef STD_COMPTYPE_H
#define STD_COMPTYPE_H
#include "rb_objectcontainer.h"
/**
* Component type such as flange type as defined
* in the parent dimension standard
*/
class STD_CompType : public RB_ObjectContainer {
public:
STD_CompType(const QString& id = "", RB_ObjectBase* p = NULL,
const QString& n = "STD_CompType",
RB_ObjectFactory* f = NULL);
STD_CompType(STD_CompType* obj);
virtual ~STD_CompType();
private:
void createMembers();
};
#endif /*STD_COMPTYPE_H*/
|
/** @file connectmodule.h
@brief Contains ConnectModule - Call Module for connection establishment at incoming connection
@author Gernot Hillier <gernot@hillier.de>
$Revision: 1.5 $
*/
/***************************************************************************
* *
* 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 CONNECTMODULE_H
#define CONNECTMODULE_H
#include "callmodule.h"
#include "../backend/connection.h"
using namespace std;
/** @brief Call Module for connection establishment at incoming connection
This module serves to accept an incoming call and wait for the connection
establishment. It is the first module you should call when an incoming
call is signalled and you want to accept it.
@author Gernot Hillier
*/
class ConnectModule: public CallModule
{
public:
/** @brief Constructor. Create object.
@param conn reference to Connection object
@param service service to connect with as described in Connection::service_t
@param faxStationID fax station ID, only necessary when connecting in FAXG3 mode
@param faxHeadline fax headline, only necessary when connecting in FAXG3 mode
@throw CapiExternalError Thrown if Connection already up
@throw CapiWrongState Thrown if Connection not in waiting state
*/
ConnectModule(Connection *conn, Connection::service_t service, string faxStationID, string faxHeadline) throw (CapiWrongState,CapiExternalError);
/** @brief Accept connection and wait for complete establishment
@throw CapiExternalError Thrown by Connection::connectWaiting()
@throw CapiMsgError Thrown by Connection::connectWaiting()
@throw CapiWrongState Thrown by Connection::connectWaiting()
*/
void mainLoop() throw (CapiWrongState,CapiExternalError, CapiMsgError);
/** @brief Finish mainLoop() if call is completely established
*/
void callConnected();
private:
Connection::service_t service; ///< service with which we should connect
string faxStationID, ///< fax Station ID to use
faxHeadline; ///< fax headlint to use
};
#endif
/* History
Old Log (for new changes see ChangeLog):
Revision 1.4 2003/12/31 16:28:55 gernot
* src/modules/connectmodule.{h,cpp} (ConnectModule): throw
CapiExternalError only when connection's already up, otherwise
use CapiWrongState
Revision 1.3 2003/12/28 21:01:04 gernot
- reworked TODO, disabled automatic log message adding to source files
Revision 1.1.1.1 2003/02/19 08:19:53 gernot
initial checkin of 0.4
Revision 1.7 2002/11/29 10:27:44 ghillie
- updated comments, use doxygen format now
Revision 1.6 2002/11/25 11:57:19 ghillie
- use service_type instead of CIP value in application layer
Revision 1.5 2002/11/22 15:18:56 ghillie
added faxStationID, faxHeadline parameters
Revision 1.4 2002/11/21 15:33:44 ghillie
- moved code from constructor/destructor to overwritten mainLoop() method
Revision 1.3 2002/11/20 17:25:29 ghillie
added missing throw() declaration
Revision 1.2 2002/11/19 15:57:19 ghillie
- Added missing throw() declarations
- phew. Added error handling. All exceptions are caught now.
Revision 1.1 2002/11/14 17:05:58 ghillie
initial checkin
*/
|
/*
* uicartridge.h - Cartridge save image dialog for the Xaw widget set.
*
* Written by
* pottendo <pottendo@gmx.net>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* 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 VICE_HAVE_UICARTRIDGE_H_
#define VICE_HAVE_UICARTRIDGE_H_
#include "vice.h"
void ui_cartridge_save_dialog(int type);
#endif
|
// This file is part of Hermes2D.
//
// Hermes2D 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.
//
// Hermes2D 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 Hermes2D. If not, see <http://www.gnu.org/licenses/>.
#ifndef __H2D_FEPROBLEM_H
#define __H2D_FEPROBLEM_H
#include "matrix.h"
#include "forms.h"
#include "weakform.h"
#include <map>
class Space;
class PrecalcShapeset;
class WeakForm;
class Matrix;
class SparseMatrix;
class Vector;
class Solver;
/// Finite Element problem class
///
/// This class does assembling into passed-in structures.
///
class FeProblem {
public:
FeProblem(WeakForm *wf);
virtual ~FeProblem();
void free();
void set_spaces(int n, ...);
void set_pss(int n, ...);
Space* get_space(int n) { return this->spaces[n]; }
PrecalcShapeset* get_pss(int n) { return this->pss[n]; }
void create(SparseMatrix *mat);
void assemble(const Vector *x, Vector *f, Matrix *jac);
int get_num_dofs();
bool is_matrix_free() { return wf->is_matrix_free(); }
void invalidate_matrix() { have_matrix = false; }
protected:
WeakForm *wf;
int ndofs;
int *sp_seq;
int wf_seq;
Space **spaces;
Solution **slns;
PrecalcShapeset** pss;
int num_user_pss;
bool values_changed;
bool struct_changed;
bool have_spaces;
bool have_matrix;
bool is_up_to_date();
scalar** buffer;
int mat_size;
scalar** get_matrix_buffer(int n)
{
if (n <= mat_size) return buffer;
if (buffer != NULL) delete [] buffer;
return (buffer = new_matrix<scalar>(mat_size = n));
}
ExtData<Ord>* init_ext_fns_ord(std::vector<MeshFunction *> &ext);
ExtData<scalar>* init_ext_fns(std::vector<MeshFunction *> &ext, RefMap *rm, const int order);
Func<double>* get_fn(PrecalcShapeset *fu, RefMap *rm, const int order);
// Key for caching transformed function values on elements
struct Key
{
int index;
int order;
int sub_idx;
int shapeset_type;
Key(int index, int order, int sub_idx, int shapeset_type)
{
this->index = index;
this->order = order;
this->sub_idx = sub_idx;
this->shapeset_type = shapeset_type;
}
};
struct Compare
{
bool operator()(Key a, Key b) const
{
if (a.index < b.index) return true;
else if (a.index > b.index) return false;
else
{
if (a.order < b.order) return true;
else if (a.order > b.order) return false;
else
{
if (a.sub_idx < b.sub_idx) return true;
else if (a.sub_idx > b.sub_idx) return false;
else
{
if (a.shapeset_type < b.shapeset_type) return true;
else return false;
}
}
}
}
};
// Caching transformed values for element
std::map<Key, Func<double>*, Compare> cache_fn;
Geom<double>* cache_e[g_max_quad + 1 + 4];
double* cache_jwt[g_max_quad + 1 + 4];
void init_cache();
void delete_cache();
scalar eval_form(WeakForm::JacFormVol *bf, Solution *sln[], PrecalcShapeset *fu, PrecalcShapeset *fv, RefMap *ru, RefMap *rv);
scalar eval_form(WeakForm::ResFormVol *lf, Solution *sln[], PrecalcShapeset *fv, RefMap *rv);
scalar eval_form(WeakForm::JacFormSurf *bf, Solution *sln[], PrecalcShapeset *fu, PrecalcShapeset *fv, RefMap *ru, RefMap *rv, EdgePos* ep);
scalar eval_form(WeakForm::ResFormSurf *lf, Solution *sln[], PrecalcShapeset *fv, RefMap *rv, EdgePos* ep);
};
///
/// Class for projecting solution, from Meshfunction obtain solution vector
/// Solution vector needed for nonlinear methods as initial guess
///
class Projection
{
public:
Projection(int n, ...);
~Projection();
void set_solver(Solver* solver);
scalar* project();
scalar* get_solution_vector() const { return vec; }
protected:
int num;
MeshFunction* slns[10];
Space* spaces[10];
PrecalcShapeset* pss[10];
Solver* solver;
scalar* vec;
};
#endif
|
/*
* linux/drivers/pcmcia/pxa2xx_palmld.c
*
* Driver for Palm LifeDrive PCMCIA
*
* Copyright (C) 2006 Alex Osborne <ato@meshy.org>
* Copyright (C) 2007-2011 Marek Vasut <marek.vasut@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <asm/mach-types.h>
#include <mach/palmld.h>
#include "soc_common.h"
static struct gpio palmld_pcmcia_gpios[] = {
{ GPIO_NR_PALMLD_PCMCIA_POWER, GPIOF_INIT_LOW, "PCMCIA Power" },
{ GPIO_NR_PALMLD_PCMCIA_RESET, GPIOF_INIT_HIGH,"PCMCIA Reset" },
{ GPIO_NR_PALMLD_PCMCIA_READY, GPIOF_IN, "PCMCIA Ready" },
};
static int palmld_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
{
int ret;
ret = gpio_request_array(palmld_pcmcia_gpios,
ARRAY_SIZE(palmld_pcmcia_gpios));
skt->socket.pci_irq = IRQ_GPIO(GPIO_NR_PALMLD_PCMCIA_READY);
return ret;
}
static void palmld_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
{
gpio_free_array(palmld_pcmcia_gpios, ARRAY_SIZE(palmld_pcmcia_gpios));
}
static void palmld_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
state->detect = 1; /* always inserted */
state->ready = !!gpio_get_value(GPIO_NR_PALMLD_PCMCIA_READY);
state->bvd1 = 1;
state->bvd2 = 1;
state->wrprot = 0;
state->vs_3v = 1;
state->vs_Xv = 0;
}
static int palmld_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state)
{
gpio_set_value(GPIO_NR_PALMLD_PCMCIA_POWER, 1);
gpio_set_value(GPIO_NR_PALMLD_PCMCIA_RESET,
!!(state->flags & SS_RESET));
return 0;
}
static struct pcmcia_low_level palmld_pcmcia_ops = {
.owner = THIS_MODULE,
.first = 1,
.nr = 1,
.hw_init = palmld_pcmcia_hw_init,
.hw_shutdown = palmld_pcmcia_hw_shutdown,
.socket_state = palmld_pcmcia_socket_state,
.configure_socket = palmld_pcmcia_configure_socket,
};
static struct platform_device *palmld_pcmcia_device;
static int __init palmld_pcmcia_init(void)
{
int ret;
if (!machine_is_palmld())
return -ENODEV;
palmld_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
if (!palmld_pcmcia_device)
return -ENOMEM;
ret = platform_device_add_data(palmld_pcmcia_device, &palmld_pcmcia_ops,
sizeof(palmld_pcmcia_ops));
if (!ret)
ret = platform_device_add(palmld_pcmcia_device);
if (ret)
platform_device_put(palmld_pcmcia_device);
return ret;
}
static void __exit palmld_pcmcia_exit(void)
{
platform_device_unregister(palmld_pcmcia_device);
}
module_init(palmld_pcmcia_init);
module_exit(palmld_pcmcia_exit);
MODULE_AUTHOR("Alex Osborne <ato@meshy.org>,"
" Marek Vasut <marek.vasut@gmail.com>");
MODULE_DESCRIPTION("PCMCIA support for Palm LifeDrive");
MODULE_ALIAS("platform:pxa2xx-pcmcia");
MODULE_LICENSE("GPL");
|
/*
FreeCS Project
Copyright (C) 2016, 2017 Marco "eukara" Hladik
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.
*/
/*
TODO: This gamemode is odd about balancing, right now the last surviving terrorist
will decide the match. Still have to think about what rules to set up.
*/
/*
=================
func_escapezone_touch
=================
*/
void func_escapezone_touch( void ) {
if ( ( other.classname == "player" ) && ( other.team == TEAM_T ) ) {
entity eOld = self;
self = other;
Spawn_MakeSpectator();
self.classname = "player";
forceinfokey( self, "*dead", "0" );
iAlivePlayers_T--;
self = eOld;
if ( iAlivePlayers_T == 0 ) {
Rules_RoundOver( TEAM_T, 2500, FALSE );
}
}
}
/*
=================
SPAWN: func_escapezone
Entry function for the terrorist escape zone
=================
*/
void func_escapezone( void ) {
self.angles = '0 0 0';
self.movetype = MOVETYPE_NONE;
self.solid = SOLID_TRIGGER;
if ( self.model ) {
setmodel( self, self.model );
} else {
setsize( self, self.mins, self.maxs );
}
self.model = 0;
self.touch = func_escapezone_touch;
iEscapeZones++;
}
|
../sockets/read_line.c
|
#include <stdint.h>
#include "ball.h"
#include "lcd.h"
void printBall(const struct _ball *const ball, DRAWTYP m)
{
int8_t j,i;
for(j = 0; j <=BALLSIZE; j++)
for(i = -BALLSIZE+j; i <= BALLSIZE-j; i++)
{
MK3_LCD_PIXEL_AT(ball->x+i, ball->y+j, m);
__asm volatile ("nop \n"); // wait a tick
if(j)
{
MK3_LCD_PIXEL_AT(ball->x+i, ball->y-j, m);
__asm volatile ("nop \n"); // wait a tick
}
}
}
void moveBall(struct _ball *const ball)
{
printBall(ball, MODE_RESET);
ball->x += ball->dx;
ball->y += ball->dy;
printBall(ball, MODE_SET);
}
|
/* $Id: termbits.h,v 1.1 2000/07/10 16:32:31 bjornw Exp $ */
#ifndef __ARCH_ETRAX100_TERMBITS_H__
#define __ARCH_ETRAX100_TERMBITS_H__
#include <linux/posix_types.h>
typedef unsigned char cc_t;
typedef unsigned int speed_t;
typedef unsigned int tcflag_t;
#define NCCS 19
struct termios {
tcflag_t c_iflag; /* input mode flags */
tcflag_t c_oflag; /* output mode flags */
tcflag_t c_cflag; /* control mode flags */
tcflag_t c_lflag; /* local mode flags */
cc_t c_line; /* line discipline */
cc_t c_cc[NCCS]; /* control characters */
};
/* c_cc characters */
#define VINTR 0
#define VQUIT 1
#define VERASE 2
#define VKILL 3
#define VEOF 4
#define VTIME 5
#define VMIN 6
#define VSWTC 7
#define VSTART 8
#define VSTOP 9
#define VSUSP 10
#define VEOL 11
#define VREPRINT 12
#define VDISCARD 13
#define VWERASE 14
#define VLNEXT 15
#define VEOL2 16
/* c_iflag bits */
#define IGNBRK 0000001
#define BRKINT 0000002
#define IGNPAR 0000004
#define PARMRK 0000010
#define INPCK 0000020
#define ISTRIP 0000040
#define INLCR 0000100
#define IGNCR 0000200
#define ICRNL 0000400
#define IUCLC 0001000
#define IXON 0002000
#define IXANY 0004000
#define IXOFF 0010000
#define IMAXBEL 0020000
/* c_oflag bits */
#define OPOST 0000001
#define OLCUC 0000002
#define ONLCR 0000004
#define OCRNL 0000010
#define ONOCR 0000020
#define ONLRET 0000040
#define OFILL 0000100
#define OFDEL 0000200
#define NLDLY 0000400
#define NL0 0000000
#define NL1 0000400
#define CRDLY 0003000
#define CR0 0000000
#define CR1 0001000
#define CR2 0002000
#define CR3 0003000
#define TABDLY 0014000
#define TAB0 0000000
#define TAB1 0004000
#define TAB2 0010000
#define TAB3 0014000
#define XTABS 0014000
#define BSDLY 0020000
#define BS0 0000000
#define BS1 0020000
#define VTDLY 0040000
#define VT0 0000000
#define VT1 0040000
#define FFDLY 0100000
#define FF0 0000000
#define FF1 0100000
/* c_cflag bit meaning */
/*
* 3 2 1
* 10 987 654 321 098 765 432 109 876 543 210
* | | ||| CBAUD
* obaud
*
* ||CSIZE
*
* |CSTOP
* |CREAD
* |CPARENB
*
* |CPARODD
* |HUPCL
* |CLOCAL
* |CBAUDEX
* 10 987 654 321 098 765 432 109 876 543 210
* | || || CIBAUD, IBSHIFT=16
* ibaud
* |CMSPAR
* | CRTSCTS
* x x xxx xxx x x xx Free bits
*/
#define CBAUD 0010017
#define B0 0000000 /* hang up */
#define B50 0000001
#define B75 0000002
#define B110 0000003
#define B134 0000004
#define B150 0000005
#define B200 0000006
#define B300 0000007
#define B600 0000010
#define B1200 0000011
#define B1800 0000012
#define B2400 0000013
#define B4800 0000014
#define B9600 0000015
#define B19200 0000016
#define B38400 0000017
#define EXTA B19200
#define EXTB B38400
#define CSIZE 0000060
#define CS5 0000000
#define CS6 0000020
#define CS7 0000040
#define CS8 0000060
#define CSTOPB 0000100
#define CREAD 0000200
#define PARENB 0000400
#define PARODD 0001000
#define HUPCL 0002000
#define CLOCAL 0004000
#define CBAUDEX 0010000
#define B57600 0010001
#define B115200 0010002
#define B230400 0010003
#define B460800 0010004
/* etrax supports these additional three baud rates */
#define B921600 0010005
#define B1843200 0010006
#define B6250000 0010007
/* etrax 200 supports this as well */
#define B12500000 0010010
#define CIBAUD 002003600000 /* input baud rate */
/* The values for CIBAUD bits are the same as the values for CBAUD and CBAUDEX
* shifted left IBSHIFT bits.
*/
#define IBSHIFT 16
#define CMSPAR 010000000000 /* mark or space (stick) parity - PARODD=space*/
#define CRTSCTS 020000000000 /* flow control */
/* c_lflag bits */
#define ISIG 0000001
#define ICANON 0000002
#define XCASE 0000004
#define ECHO 0000010
#define ECHOE 0000020
#define ECHOK 0000040
#define ECHONL 0000100
#define NOFLSH 0000200
#define TOSTOP 0000400
#define ECHOCTL 0001000
#define ECHOPRT 0002000
#define ECHOKE 0004000
#define FLUSHO 0010000
#define PENDIN 0040000
#define IEXTEN 0100000
/* tcflow() and TCXONC use these */
#define TCOOFF 0
#define TCOON 1
#define TCIOFF 2
#define TCION 3
/* tcflush() and TCFLSH use these */
#define TCIFLUSH 0
#define TCOFLUSH 1
#define TCIOFLUSH 2
/* tcsetattr uses these */
#define TCSANOW 0
#define TCSADRAIN 1
#define TCSAFLUSH 2
#endif
|
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include "threads.h"
static struct pthread_node * head;
void add_thread(pthread_t tid){
struct pthread_node * new_node =malloc(sizeof(struct pthread_node));
if(new_node == NULL){perror("malloc add_thread");exit(-1);}
new_node->ptid = tid;
new_node->next = head;
head = new_node;
}
void del_thread(pthread_t tid){
struct pthread_node fake_head;
fake_head.next = head;
struct pthread_node * punt = &fake_head;
while(punt->next != NULL){
if(pthread_equal (punt->next->ptid,tid)){
punt->next = punt->next->next;
#ifdef DEBUG
char name[22];
pthread_getname_np(pthread_self(),name,sizeof(name));
printf("deleted thread: \"%s\" from threads-struct\n", name);
#endif
break;
}
}
head = fake_head.next;
}
void kill_all_threads(){
#ifdef DEBUG
char name[22];
pthread_getname_np(pthread_self(),name,sizeof(name));
printf("thread: \"%s\" is killing all other thread\n",name);
#endif
struct pthread_node * punt = head;
while(punt != NULL){
if(!pthread_equal(punt->ptid,pthread_self())){
#ifdef DEBUG
pthread_getname_np(punt->ptid,name,sizeof(name));
printf("killing thread: \"%s\"\n",name);
#endif
if(pthread_cancel(punt->ptid))
puts("error closing thread");
pthread_join(punt->ptid,NULL);
}
struct pthread_node * temp = punt;
punt = punt->next;
free(temp);
}
}
|
//
// SnacksViewController.h
// skipers
//
// Created by Jorge Raul Ovalle Zuleta on 3/30/14.
// Copyright (c) 2014 jomobile.co. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface SnacksViewController : UIViewController <UIPickerViewDataSource, UIPickerViewDelegate>{
NSMutableArray *VeggieArray;
bool locked;
}
@property int language;
@property int size;
@property int sizeImg;
@property int sizeSlot;
@property (strong,nonatomic) IBOutlet UIButton *btnLock;
@property (strong,nonatomic) IBOutlet UILabel *lblIngredient;
@property (strong,nonatomic) IBOutlet UIPickerView *veggiePicker;
@property bool locked;
-(void)action;
@property (strong, nonatomic) IBOutlet UILabel *lblInstruct1;
@property (strong, nonatomic) IBOutlet UILabel *lblInstruct2;
@property (strong, nonatomic) IBOutlet UILabel *lblInstruct3;
@property (strong, nonatomic) IBOutlet UILabel *lblInstruct4;
@end
|
/**
* Copyright (C) 2005 - 2014 Emulex
* 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
* as published by the Free Software Foundation. The full GNU General
* Public License is included in this distribution in the file called COPYING.
*
* Contact Information:
* linux-drivers@emulex.com
*
* Emulex
* 3333 Susan Street
* Costa Mesa, CA 92626
*/
#ifndef BEISCSI_H
#define BEISCSI_H
#include <linux/pci.h>
#include <linux/if_vlan.h>
#include <linux/blk-iopoll.h>
#define FW_VER_LEN 32
#define MCC_Q_LEN 128
#define MCC_CQ_LEN 256
#define MAX_MCC_CMD 16
/* BladeEngine Generation numbers */
#define BE_GEN2 2
#define BE_GEN3 3
#define BE_GEN4 4
struct be_dma_mem {
void *va;
dma_addr_t dma;
u32 size;
};
struct be_queue_info {
struct be_dma_mem dma_mem;
u16 len;
u16 entry_size; /* Size of an element in the queue */
u16 id;
u16 tail, head;
bool created;
atomic_t used; /* Number of valid elements in the queue */
};
static inline u32 MODULO(u16 val, u16 limit)
{
WARN_ON(limit & (limit - 1));
return val & (limit - 1);
}
static inline void index_inc(u16 *index, u16 limit)
{
*index = MODULO((*index + 1), limit);
}
static inline void *queue_head_node(struct be_queue_info *q)
{
return q->dma_mem.va + q->head * q->entry_size;
}
static inline void *queue_get_wrb(struct be_queue_info *q, unsigned int wrb_num)
{
return q->dma_mem.va + wrb_num * q->entry_size;
}
static inline void *queue_tail_node(struct be_queue_info *q)
{
return q->dma_mem.va + q->tail * q->entry_size;
}
static inline void queue_head_inc(struct be_queue_info *q)
{
index_inc(&q->head, q->len);
}
static inline void queue_tail_inc(struct be_queue_info *q)
{
index_inc(&q->tail, q->len);
}
/*ISCSI */
struct be_eq_obj {
bool todo_mcc_cq;
bool todo_cq;
struct be_queue_info q;
struct beiscsi_hba *phba;
struct be_queue_info *cq;
struct work_struct work_cqs; /* Work Item */
struct blk_iopoll iopoll;
};
struct be_mcc_obj {
struct be_queue_info q;
struct be_queue_info cq;
};
struct be_ctrl_info {
u8 __iomem *csr;
u8 __iomem *db; /* Door Bell */
u8 __iomem *pcicfg; /* PCI config space */
struct pci_dev *pdev;
/* Mbox used for cmd request/response */
spinlock_t mbox_lock; /* For serializing mbox cmds to BE card */
struct be_dma_mem mbox_mem;
/* Mbox mem is adjusted to align to 16 bytes. The allocated addr
* is stored for freeing purpose */
struct be_dma_mem mbox_mem_alloced;
/* MCC Rings */
struct be_mcc_obj mcc_obj;
spinlock_t mcc_lock; /* For serializing mcc cmds to BE card */
spinlock_t mcc_cq_lock;
wait_queue_head_t mcc_wait[MAX_MCC_CMD + 1];
unsigned int mcc_tag[MAX_MCC_CMD];
unsigned int mcc_numtag[MAX_MCC_CMD + 1];
unsigned short mcc_alloc_index;
unsigned short mcc_free_index;
unsigned int mcc_tag_available;
};
#include "be_cmds.h"
#define PAGE_SHIFT_4K 12
#define PAGE_SIZE_4K (1 << PAGE_SHIFT_4K)
#define mcc_timeout 120000 /* 12s timeout */
/* Returns number of pages spanned by the data starting at the given addr */
#define PAGES_4K_SPANNED(_address, size) \
((u32)((((size_t)(_address) & (PAGE_SIZE_4K - 1)) + \
(size) + (PAGE_SIZE_4K - 1)) >> PAGE_SHIFT_4K))
/* Returns bit offset within a DWORD of a bitfield */
#define AMAP_BIT_OFFSET(_struct, field) \
(((size_t)&(((_struct *)0)->field))%32)
/* Returns the bit mask of the field that is NOT shifted into location. */
static inline u32 amap_mask(u32 bitsize)
{
return (bitsize == 32 ? 0xFFFFFFFF : (1 << bitsize) - 1);
}
static inline void amap_set(void *ptr, u32 dw_offset, u32 mask,
u32 offset, u32 value)
{
u32 *dw = (u32 *) ptr + dw_offset;
*dw &= ~(mask << offset);
*dw |= (mask & value) << offset;
}
#define AMAP_SET_BITS(_struct, field, ptr, val) \
amap_set(ptr, \
offsetof(_struct, field)/32, \
amap_mask(sizeof(((_struct *)0)->field)), \
AMAP_BIT_OFFSET(_struct, field), \
val)
static inline u32 amap_get(void *ptr, u32 dw_offset, u32 mask, u32 offset)
{
u32 *dw = ptr;
return mask & (*(dw + dw_offset) >> offset);
}
#define AMAP_GET_BITS(_struct, field, ptr) \
amap_get(ptr, \
offsetof(_struct, field)/32, \
amap_mask(sizeof(((_struct *)0)->field)), \
AMAP_BIT_OFFSET(_struct, field))
#define be_dws_cpu_to_le(wrb, len) swap_dws(wrb, len)
#define be_dws_le_to_cpu(wrb, len) swap_dws(wrb, len)
static inline void swap_dws(void *wrb, int len)
{
#ifdef __BIG_ENDIAN
u32 *dw = wrb;
WARN_ON(len % 4);
do {
*dw = cpu_to_le32(*dw);
dw++;
len -= 4;
} while (len);
#endif /* __BIG_ENDIAN */
}
#endif /* BEISCSI_H */
|
#ifndef WIDGETSKU_H
#define WIDGETSKU_H
#include <TaoApiCpp/TaoDomain.h>
#include <QString>
/**
* @brief 组件sku信息
*
* @author sd44 <sd44sdd44@yeah.net>
*/
class WidgetSku : public TaoDomain
{
public:
virtual ~WidgetSku() { }
QString getPrice() const;
void setPrice (QString price);
QString getProps() const;
void setProps (QString props);
qlonglong getQuantity() const;
void setQuantity (qlonglong quantity);
qlonglong getSkuId() const;
void setSkuId (qlonglong skuId);
virtual void parseResponse();
private:
/**
* @brief sku的价格,对应Sku的price字段
**/
QString price;
/**
* @brief sku的属性串,根据pid的大小从小到大排列,前后都加";"。类型Sku的properties字段
**/
QString props;
/**
* @brief sku的库存数量,对应Sku的quantity字段
**/
qlonglong quantity;
/**
* @brief sku的id,对应Sku的sku_id字段
**/
qlonglong skuId;
};
#endif /* WIDGETSKU_H */
|
/* -*- c++ -*- ----------------------------------------------------------
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 PAIR_CLASS
PairStyle(spin/dmi,PairSpinDmi)
#else
#ifndef LMP_PAIR_SPIN_DMI_H
#define LMP_PAIR_SPIN_DMI_H
#include "pair_spin.h"
namespace LAMMPS_NS {
class PairSpinDmi : public PairSpin {
public:
PairSpinDmi(class LAMMPS *);
virtual ~PairSpinDmi();
void settings(int, char **);
void coeff(int, char **);
void init_style();
double init_one(int, int);
void *extract(const char *, int &);
void compute(int, int);
void compute_single_pair(int, double *);
void compute_dmi(int, int, double *, double *, double *);
void compute_dmi_mech(double *);
void write_restart(FILE *);
void read_restart(FILE *);
void write_restart_settings(FILE *);
void read_restart_settings(FILE *);
double cut_spin_dmi_global; // short range pair cutoff
protected:
double **DM; // dmi coeff in eV
double **v_dmx, **v_dmy, **v_dmz; // dmi direction
double **cut_spin_dmi; // cutoff distance dmi
int lattice_flag; // flag for mech force computation
class FixNVESpin *lockfixnvespin; // ptr to FixNVESpin for setups
void allocate();
};
}
#endif
#endif
/* ERROR/WARNING messages:
E: Incorrect args in pair_spin command
Self-explanatory.
E: Spin simulations require metal unit style
Self-explanatory.
E: Incorrect args for pair coefficients
Self-explanatory. Check the input script or data file.
E: Pair spin requires atom attribute spin
The atom style defined does not have these attributes.
*/
|
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
#include "stringpool.h"
#include "op.h"
GBLREF spdesc stringpool;
void op_fnzbitxor(mval *dst, mval *bitstr1, mval *bitstr2)
{
int new_str_len;
int str_len1, str_len2;
unsigned char *byte_1, *byte_n;
unsigned char *byte1_1, *byte1_n, byte1_len;
unsigned char *byte2_1, *byte2_n, byte2_len;
static const unsigned char mask[8]={0xFF,0xFE,0xFC,0xF8,0xF0,0xE0,0xC0,0x80};
int n;
error_def(ERR_INVBITSTR);
MV_FORCE_STR(bitstr1);
MV_FORCE_STR(bitstr2);
if (!bitstr1->str.len || !bitstr2->str.len)
rts_error(VARLSTCNT(1) ERR_INVBITSTR);
byte1_len = *(unsigned char *)bitstr1->str.addr;
str_len1 = (bitstr1->str.len -1) * 8;
if (byte1_len > 7)
{
rts_error(VARLSTCNT(1) ERR_INVBITSTR);
}
byte2_len = *(unsigned char *)bitstr2->str.addr;
str_len2 = (bitstr2->str.len -1) * 8;
if ((byte2_len < 0) || (byte2_len > 7))
{
rts_error(VARLSTCNT(1) ERR_INVBITSTR);
}
if (str_len1 - byte1_len > str_len2 - byte2_len)
{
new_str_len = str_len2 - byte2_len;
}
else
{
new_str_len = str_len1 - byte1_len;
}
n = (new_str_len + 7)/8 ;
if (stringpool.top - stringpool.free < n + 1)
stp_gcol(n + 1);
byte_1 = (unsigned char *)stringpool.free;
*byte_1 = n * 8 - new_str_len;
byte1_1 = (unsigned char *)bitstr1->str.addr;
byte2_1 = (unsigned char *)bitstr2->str.addr;
for(byte_n = byte_1 + 1, byte1_n = byte1_1 + 1, byte2_n = byte2_1 + 1 ;
byte_n <= (byte_1 + n); byte_n++, byte1_n++, byte2_n++)
{
*byte_n = *byte1_n ^ *byte2_n;
}
*--byte_n &= mask[*byte_1];
dst->mvtype = MV_STR;
dst->str.addr = (char *)stringpool.free;
dst->str.len = n + 1;
stringpool.free += n + 1;
}
|
/*
XEvol3D Rendering Engine . (http://gforge.osdn.net.cn/projects/xevol3d/)
Stanly.Lee 2006
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 __MAX_NODE_MESH_H__
#define __MAX_NODE_MESH_H__
#include "MaxEnv.h"
#include "Math.h"
#include "DataDefine.h"
using namespace XEvol3DModel;
#include <vector>
#include <string>
#include <hash_map>
using namespace std;
using namespace stdext;
#include "MaxMeshDefine.h"
class CMaxSubMesh : public sSubMeshDesc_t
{
public:
typedef sFace_t* sFaces_t;
public:
CMaxSubMesh()
{
m_nFace = 0 ;
m_Faces = NULL;
}
~CMaxSubMesh()
{
}
void Free()
{
if(m_Faces)
{
delete [] m_Faces;
m_Faces = NULL;
}
}
sSubMeshDesc_t GetSubMeshDesc()
{
sSubMeshDesc_t desc;
desc.m_nFace = m_nFace;
desc.m_nMatIndex = m_nMatIndex;
return desc;
}
IGameMaterial* m_pGameMaterial;
sFaces_t m_Faces;
int m_MatID;
};
class xMeshData
{
public:
typedef std::vector<CMaxSubMesh> vMaxSubMeshs;
sVertexData_t m_VertexData;
Materials_t m_MatsExport;
sMeshDesc_t m_MeshDesc;
sBoundBox_t m_BoundBox;
INode* m_pNode;
xMeshBones_t m_UsedBones;
wstring m_MatName;
vMaxSubMeshs m_vSubMeshs;
};
class CMaxMesh : public xMeshData
{
public:
typedef std::map<int , IGameMaterial*> vGameMaterials;
typedef std::map<CMaxVertexIndex , int> vMaxVertexIndexMap;
typedef std::vector<CMaxVertexIndex> vMaxVertexIndexs;
vector<sMaxMorphTarget_t> m_MorphTargets;
IGameNode* m_pGameNode;
IGameMesh* m_pGameMesh;
IGameObject* m_pGameObject;
IGameMorpher* m_pMorpModifer;
IGameSkin* m_pSkinModifer;
IGameMaterial* m_pGameMaterial;
vGameMaterials m_vGameMaterials;
bool m_bFaceInCreated;
Tab<int> m_ActiveChannels;
int m_CurrentTime;
int m_CurrentFrame;
//¶¥µãË÷Òý
vMaxVertexIndexs m_MaxVertexIndexs;
//
Mesh* m_pMaxMesh;
bool m_bMirrored;
public:
~CMaxMesh();
CMaxMesh();
CMaxMesh(INode* pNode , CSkeletonExporter* pSkeleton);
void SetScale(float scale);
void SetColorScale(float r_s, float g_s , float b_s , float a_s);
bool Init(INode* pNode , CSkeletonExporter* pSkeleton);
bool ParseGameMaterial(IGameMaterial* pGameMaterial , int matID);
bool CreateFaces();
bool CreateMesh(unsigned int iMaxTime , CSkeletonExporter* pSkeleton);
bool IsMeshMirror();
int AddMaxVertexIndex(CMaxVertexIndex& indx , vMaxVertexIndexMap& _map);
int MapChannel2UVIndex(int mapChannel);
int MapMatID2MatIndex(IGameMaterial* pMaterial);
bool BuildMaterialExport();
bool BuildMeshDesc();
bool Free();
bool IsExportable();
Matrix3 Transpose(Matrix3& matrix);
IGameMaterial* FindGameMaterialByMatID(int matID);
Matrix3 FindMapChannelTM(int chIdx, IGameMaterial* pMaterial);
bool BuildVertexData(CSkeletonExporter* pSkeleton);
bool BuildVertexWeights(CSkeletonExporter* pSkeleton);
bool ExtractVertexWeights(CSkeletonExporter* pSkeleton);
bool ExtractVertexWeightsFromModifier(IGameSkin* pGameSkin ,CSkeletonExporter* pSkeleton);
bool ExtractVertexWeightsFromLink(INode* pFakeBone, CSkeletonExporter* pSkeleton);
bool CalcTBN(sFace_t& face,bool isSkin);
void CalcTangents(bool isSkin);
bool BuildMorphTarget();
void FindAllUsedBone(CSkeletonExporter* pSkeleton);
void InitSkeleton(CSkeletonExporter* pSkeleton);
protected:
void _InitData();
private:
/*ºÍMeshÊý¾ÝÏà¹ØµÄ¶«Î÷*/
sMeshDataFlag m_MeshDataFlag;
public:
void addUsedBone(xMeshBone_t& bone)
{
for(size_t i = 0 ; i < m_UsedBones.size(); ++i)
{
if(m_UsedBones[i].m_pBone == bone.m_pBone)
return ;
}
m_UsedBones.push_back(bone);
}
private:
sVectors_t m_VertexNormals;
sVectors_t m_FaceNormals;
protected:
//¹Ç÷À¶¯»Ïà¹ØµÄÊý¾Ý
sWeightedVertexs_t m_VertexWeights;
};
typedef std::vector<CMaxMesh> MaxMeshs;
#include "MaxMeshBuilder.h"
#endif
|
/* Copyright (c) 2020, 2021, MariaDB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#pragma once
#ifdef __cplusplus
#include <atomic>
/**
A wrapper for std::atomic, defaulting to std::memory_order_relaxed.
When it comes to atomic loads or stores at std::memory_order_relaxed
on IA-32 or AMD64, this wrapper is only introducing some constraints
to the C++ compiler, to prevent some optimizations of loads or
stores.
On POWER and ARM, atomic loads and stores involve different instructions
from normal loads and stores and will thus incur some overhead.
Because atomic read-modify-write operations will always incur
overhead, we intentionally do not define
operator++(), operator--(), operator+=(), operator-=(), or similar,
to make the overhead stand out in the users of this code.
*/
template <typename Type> class Atomic_relaxed
{
std::atomic<Type> m;
public:
Atomic_relaxed(const Atomic_relaxed<Type> &rhs)
{ m.store(rhs, std::memory_order_relaxed); }
Atomic_relaxed(Type val) : m(val) {}
Atomic_relaxed() {}
Type load(std::memory_order o= std::memory_order_relaxed) const
{ return m.load(o); }
void store(Type i, std::memory_order o= std::memory_order_relaxed)
{ m.store(i, o); }
operator Type() const { return m.load(); }
Type operator=(const Type i) { store(i); return i; }
Type operator=(const Atomic_relaxed<Type> &rhs) { return *this= Type{rhs}; }
Type operator+=(const Type i) { return fetch_add(i); }
Type fetch_add(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_add(i, o); }
Type fetch_sub(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_sub(i, o); }
Type fetch_xor(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_xor(i, o); }
Type fetch_and(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_and(i, o); }
Type fetch_or(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.fetch_or(i, o); }
bool compare_exchange_strong(Type& i1, const Type i2,
std::memory_order o1= std::memory_order_relaxed,
std::memory_order o2= std::memory_order_relaxed)
{ return m.compare_exchange_strong(i1, i2, o1, o2); }
Type exchange(const Type i, std::memory_order o= std::memory_order_relaxed)
{ return m.exchange(i, o); }
};
#endif /* __cplusplus */
|
#pragma once
#include "Common/Common.h"
#include "Common/MemoryUtil.h"
#include "Core/ThreadEventQueue.h"
#include "GPU/GPUInterface.h"
#include "GPU/Common/GPUDebugInterface.h"
#if defined(__ANDROID__)
#include <atomic>
#elif defined(_M_SSE)
#include <xmmintrin.h>
#endif
typedef ThreadEventQueue<GPUInterface, GPUEvent, GPUEventType, GPU_EVENT_INVALID, GPU_EVENT_SYNC_THREAD, GPU_EVENT_FINISH_EVENT_LOOP> GPUThreadEventQueue;
class GPUCommon : public GPUThreadEventQueue, public GPUDebugInterface {
public:
GPUCommon();
virtual ~GPUCommon();
void Reinitialize() override;
void BeginHostFrame() override;
void EndHostFrame() override;
void InterruptStart(int listid) override;
void InterruptEnd(int listid) override;
void SyncEnd(GPUSyncType waitType, int listid, bool wokeThreads) override;
void EnableInterrupts(bool enable) override {
interruptsEnabled_ = enable;
}
void ExecuteOp(u32 op, u32 diff) override;
void PreExecuteOp(u32 op, u32 diff) override;
bool InterpretList(DisplayList &list) override;
virtual bool ProcessDLQueue();
u32 UpdateStall(int listid, u32 newstall) override;
u32 EnqueueList(u32 listpc, u32 stall, int subIntrBase, PSPPointer<PspGeListArgs> args, bool head) override;
u32 DequeueList(int listid) override;
int ListSync(int listid, int mode) override;
u32 DrawSync(int mode) override;
int GetStack(int index, u32 stackPtr) override;
void DoState(PointerWrap &p) override;
bool FramebufferDirty() override {
SyncThread();
return true;
}
bool FramebufferReallyDirty() override {
SyncThread();
return true;
}
bool BusyDrawing() override;
u32 Continue() override;
u32 Break(int mode) override;
void ReapplyGfxState() override;
void Execute_OffsetAddr(u32 op, u32 diff);
void Execute_Origin(u32 op, u32 diff);
void Execute_Jump(u32 op, u32 diff);
void Execute_BJump(u32 op, u32 diff);
void Execute_Call(u32 op, u32 diff);
void Execute_Ret(u32 op, u32 diff);
void Execute_End(u32 op, u32 diff);
u64 GetTickEstimate() override {
#if defined(_M_X64) || defined(__ANDROID__)
return curTickEst_;
#elif defined(_M_SSE)
__m64 result = *(__m64 *)&curTickEst_;
u64 safeResult = *(u64 *)&result;
_mm_empty();
return safeResult;
#else
lock_guard guard(curTickEstLock_);
return curTickEst_;
#endif
}
#ifdef USE_CRT_DBG
#undef new
#endif
void *operator new(size_t s) {
return AllocateAlignedMemory(s, 16);
}
void operator delete(void *p) {
FreeAlignedMemory(p);
}
#ifdef USE_CRT_DBG
#define new DBG_NEW
#endif
bool DescribeCodePtr(const u8 *ptr, std::string &name) override {
return false;
}
// From GPUDebugInterface.
bool GetCurrentDisplayList(DisplayList &list) override;
std::vector<DisplayList> ActiveDisplayLists() override;
void ResetListPC(int listID, u32 pc) override;
void ResetListStall(int listID, u32 stall) override;
void ResetListState(int listID, DisplayListState state) override;
GPUDebugOp DissassembleOp(u32 pc, u32 op) override;
std::vector<GPUDebugOp> DissassembleOpRange(u32 startpc, u32 endpc) override;
void NotifySteppingEnter() override;
void NotifySteppingExit() override;
u32 GetRelativeAddress(u32 data) override;
u32 GetVertexAddress() override;
u32 GetIndexAddress() override;
GPUgstate GetGState() override;
void SetCmdValue(u32 op) override;
DisplayList* getList(int listid) override {
return &dls[listid];
}
const std::list<int>& GetDisplayLists() override {
return dlQueue;
}
virtual bool DecodeTexture(u8* dest, const GPUgstate &state) override {
return false;
}
std::vector<FramebufferInfo> GetFramebufferList() override {
return std::vector<FramebufferInfo>();
}
void ClearShaderCache() override {}
void CleanupBeforeUI() override {}
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override { return std::vector<std::string>(); };
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override {
return "N/A";
}
protected:
// To avoid virtual calls to PreExecuteOp().
virtual void FastRunLoop(DisplayList &list) = 0;
void SlowRunLoop(DisplayList &list);
void UpdatePC(u32 currentPC, u32 newPC);
void UpdatePC(u32 currentPC) {
UpdatePC(currentPC, currentPC);
}
void UpdateState(GPURunState state);
void PopDLQueue();
void CheckDrawSync();
int GetNextListIndex();
void ProcessDLQueueInternal();
virtual void ReapplyGfxStateInternal();
virtual void FastLoadBoneMatrix(u32 target);
void ProcessEvent(GPUEvent ev) override;
bool ShouldExitEventLoop() override {
return coreState != CORE_RUNNING;
}
virtual void FinishDeferred() {
}
void AdvanceVerts(u32 vertType, int count, int bytesRead);
// Allows early unlocking with a guard. Do not double unlock.
class easy_guard {
public:
easy_guard(recursive_mutex &mtx) : mtx_(mtx), locked_(true) { mtx_.lock(); }
~easy_guard() { if (locked_) mtx_.unlock(); }
void unlock() { if (locked_) mtx_.unlock(); else Crash(); locked_ = false; }
private:
recursive_mutex &mtx_;
bool locked_;
};
typedef std::list<int> DisplayListQueue;
int nextListID;
DisplayList dls[DisplayListMaxCount];
DisplayList *currentList;
DisplayListQueue dlQueue;
recursive_mutex listLock;
bool interruptRunning;
GPURunState gpuState;
bool isbreak;
u64 drawCompleteTicks;
u64 busyTicks;
int downcount;
u64 startingTicks;
u32 cycleLastPC;
int cyclesExecuted;
bool dumpNextFrame_;
bool dumpThisFrame_;
bool interruptsEnabled_;
private:
// For CPU/GPU sync.
#ifdef __ANDROID__
std::atomic<u64> curTickEst_;
#else
volatile MEMORY_ALIGNED16(u64) curTickEst_;
recursive_mutex curTickEstLock_;
#endif
inline void UpdateTickEstimate(u64 value) {
#if defined(_M_X64) || defined(__ANDROID__)
curTickEst_ = value;
#elif defined(_M_SSE)
__m64 result = *(__m64 *)&value;
*(__m64 *)&curTickEst_ = result;
_mm_empty();
#else
lock_guard guard(curTickEstLock_);
curTickEst_ = value;
#endif
}
// Debug stats.
double timeSteppingStarted_;
double timeSpentStepping_;
};
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2000-2003, Ximian, Inc.
*/
#ifndef SOUP_SERVER_H
#define SOUP_SERVER_H 1
#include <libsoup/soup-types.h>
#include <libsoup/soup-uri.h>
G_BEGIN_DECLS
#define SOUP_TYPE_SERVER (soup_server_get_type ())
#define SOUP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SOUP_TYPE_SERVER, SoupServer))
#define SOUP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SOUP_TYPE_SERVER, SoupServerClass))
#define SOUP_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SOUP_TYPE_SERVER))
#define SOUP_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), SOUP_TYPE_SERVER))
#define SOUP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SOUP_TYPE_SERVER, SoupServerClass))
typedef struct SoupClientContext SoupClientContext;
GType soup_client_context_get_type (void);
#define SOUP_TYPE_CLIENT_CONTEXT (soup_client_context_get_type ())
struct _SoupServer {
GObject parent;
};
typedef struct {
GObjectClass parent_class;
/* signals */
void (*request_started) (SoupServer *server, SoupMessage *msg,
SoupClientContext *client);
void (*request_read) (SoupServer *server, SoupMessage *msg,
SoupClientContext *client);
void (*request_finished) (SoupServer *server, SoupMessage *msg,
SoupClientContext *client);
void (*request_aborted) (SoupServer *server, SoupMessage *msg,
SoupClientContext *client);
/* Padding for future expansion */
void (*_libsoup_reserved1) (void);
void (*_libsoup_reserved2) (void);
void (*_libsoup_reserved3) (void);
void (*_libsoup_reserved4) (void);
} SoupServerClass;
GType soup_server_get_type (void);
typedef void (*SoupServerCallback) (SoupServer *server,
SoupMessage *msg,
const char *path,
GHashTable *query,
SoupClientContext *client,
gpointer user_data);
#define SOUP_SERVER_PORT "port"
#define SOUP_SERVER_INTERFACE "interface"
#define SOUP_SERVER_SSL_CERT_FILE "ssl-cert-file"
#define SOUP_SERVER_SSL_KEY_FILE "ssl-key-file"
#define SOUP_SERVER_TLS_CERTIFICATE "tls-certificate"
#define SOUP_SERVER_ASYNC_CONTEXT "async-context"
#define SOUP_SERVER_RAW_PATHS "raw-paths"
#define SOUP_SERVER_SERVER_HEADER "server-header"
SoupServer *soup_server_new (const char *optname1,
...) G_GNUC_NULL_TERMINATED;
gboolean soup_server_is_https (SoupServer *server);
guint soup_server_get_port (SoupServer *server);
SoupSocket *soup_server_get_listener (SoupServer *server);
void soup_server_run (SoupServer *server);
void soup_server_run_async (SoupServer *server);
void soup_server_quit (SoupServer *server);
void soup_server_disconnect (SoupServer *server);
GMainContext *soup_server_get_async_context (SoupServer *server);
/* Handlers and auth */
void soup_server_add_handler (SoupServer *server,
const char *path,
SoupServerCallback callback,
gpointer user_data,
GDestroyNotify destroy);
void soup_server_remove_handler (SoupServer *server,
const char *path);
void soup_server_add_auth_domain (SoupServer *server,
SoupAuthDomain *auth_domain);
void soup_server_remove_auth_domain (SoupServer *server,
SoupAuthDomain *auth_domain);
/* I/O */
void soup_server_pause_message (SoupServer *server,
SoupMessage *msg);
void soup_server_unpause_message (SoupServer *server,
SoupMessage *msg);
/* Client context */
SoupSocket *soup_client_context_get_socket (SoupClientContext *client);
SoupAddress *soup_client_context_get_address (SoupClientContext *client);
const char *soup_client_context_get_host (SoupClientContext *client);
SoupAuthDomain *soup_client_context_get_auth_domain (SoupClientContext *client);
const char *soup_client_context_get_auth_user (SoupClientContext *client);
G_END_DECLS
#endif /* SOUP_SERVER_H */
|
/***************************************************************************
vrrubberband.h
-------------------
copyright : (C) 2010 CREALP Lucien Schreiber
***************************************************************************/
/***************************************************************************
* *
* 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 _VRRUBBERBAND_H
#define _VRRUBBERBAND_H
#include <wx/wxprec.h>
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/overlay.h>
class vrRubberBand {
private:
wxWindow *m_Window;
wxPoint m_PointStart;
wxPoint m_PointEnd;
wxOverlay m_Overlay;
wxRect _CreateRect();
public:
vrRubberBand(wxWindow *window);
virtual ~vrRubberBand();
void SetPointFirst(const wxPoint &pt);
void SetPointLast(const wxPoint &pt);
wxRect GetRect();
bool IsValid();
bool IsPositive();
void Update();
};
#endif
|
/*
*** BasisShell Variable and Array
*** src/parser/basisfunction.h
Copyright T. Youngs 2007-2018
This file is part of Aten.
Aten is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Aten 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 Aten. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef ATEN_BASISSHELLVARIABLE_H
#define ATEN_BASISSHELLVARIABLE_H
#include "parser/pvariable.h"
#include "parser/accessor.h"
ATEN_BEGIN_NAMESPACE
// Forward Declarations (Aten)
class BasisShell;
// BasisShell Variable
class BasisShellVariable : public PointerVariable
{
public:
// Constructor / Destructor
BasisShellVariable(BasisShell *func = NULL, bool constant = false);
~BasisShellVariable();
/*
* Access Data
*/
public:
// Accessor list
enum Accessors { AtomId, NPrimitives, Primitives, Type, nAccessors };
// Function list
enum Functions { AddPrimitive, Copy, nFunctions };
// Search variable access list for provided accessor
StepNode* findAccessor(QString name, TreeNode* arrayIndex, TreeNode* argList = NULL);
// Static function to search accessors
static StepNode* accessorSearch(QString name, TreeNode* arrayIndex, TreeNode* argList = NULL);
// Retrieve desired value
static bool retrieveAccessor(int i, ReturnValue& rv, bool hasArrayIndex, int arrayIndex = -1);
// Set desired value
static bool setAccessor(int i, ReturnValue& sourcerv, ReturnValue& newValue, bool hasArrayIndex, int arrayIndex = -1);
// Perform desired function
static bool performFunction(int i, ReturnValue& rv, TreeNode* node);
// Accessor data
static Accessor accessorData[nAccessors];
// Function Accessor data
static FunctionAccessor functionData[nFunctions];
};
// BasisShell Array Variable
class BasisShellArrayVariable : public PointerArrayVariable
{
public:
// Constructor / Destructor
BasisShellArrayVariable(TreeNode* sizeexpr, bool constant = false);
/*
* Inherited Virtuals
*/
public:
// Search variable access list for provided accessor
StepNode* findAccessor(QString name, TreeNode* arrayIndex, TreeNode* argList = NULL);
};
ATEN_END_NAMESPACE
#endif
|
#undef TRACE_SYSTEM
#define TRACE_SYSTEM irq
#if !defined(_TRACE_IRQ_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_IRQ_H
#include <linux/tracepoint.h>
struct irqaction;
struct softirq_action;
#define softirq_name(sirq) { sirq##_SOFTIRQ, #sirq }
#define show_softirq_name(val) \
__print_symbolic(val, \
softirq_name(HI), \
softirq_name(TIMER), \
softirq_name(NET_TX), \
softirq_name(NET_RX), \
softirq_name(BLOCK), \
softirq_name(BLOCK_IOPOLL), \
softirq_name(TASKLET), \
softirq_name(SCHED), \
softirq_name(HRTIMER), \
softirq_name(RCU))
/**
* irq_handler_entry - called immediately before the irq action handler
* @irq: irq number
* @action: pointer to struct irqaction
*
* The struct irqaction pointed to by @action contains various
* information about the handler, including the device name,
* @action->name, and the device id, @action->dev_id. When used in
* conjunction with the irq_handler_exit tracepoint, we can figure
* out irq handler latencies.
*/
TRACE_EVENT(irq_handler_entry,
TP_PROTO(int irq, struct irqaction *action),
TP_ARGS(irq, action),
TP_STRUCT__entry(
__field( int, irq )
__string( name, action->name )
__field(void*, handler)
),
TP_fast_assign(
__entry->irq = irq;
__assign_str(name, action->name);
__entry->handler = action->handler;
),
TP_printk("irq=%d name=%s handler=%pf",
__entry->irq, __get_str(name), __entry->handler)
);
/**
* irq_handler_exit - called immediately after the irq action handler returns
* @irq: irq number
* @action: pointer to struct irqaction
* @ret: return value
*
* If the @ret value is set to IRQ_HANDLED, then we know that the corresponding
* @action->handler scuccessully handled this irq. Otherwise, the irq might be
* a shared irq line, or the irq was not handled successfully. Can be used in
* conjunction with the irq_handler_entry to understand irq handler latencies.
*/
TRACE_EVENT(irq_handler_exit,
TP_PROTO(int irq, struct irqaction *action, int ret),
TP_ARGS(irq, action, ret),
TP_STRUCT__entry(
__field( int, irq )
__field( int, ret )
),
TP_fast_assign(
__entry->irq = irq;
__entry->ret = ret;
),
TP_printk("irq=%d ret=%s",
__entry->irq, __entry->ret ? "handled" : "unhandled")
);
DECLARE_EVENT_CLASS(softirq,
TP_PROTO(unsigned int vec_nr),
TP_ARGS(vec_nr),
TP_STRUCT__entry(
__field( unsigned int, vec )
),
TP_fast_assign(
__entry->vec = vec_nr;
),
TP_printk("vec=%u [action=%s]", __entry->vec,
show_softirq_name(__entry->vec))
);
/**
* softirq_entry - called immediately before the softirq handler
* @vec_nr: softirq vector number
*
* When used in combination with the softirq_exit tracepoint
* we can determine the softirq handler runtine.
*/
DEFINE_EVENT(softirq, softirq_entry,
TP_PROTO(unsigned int vec_nr),
TP_ARGS(vec_nr)
);
/**
* softirq_exit - called immediately after the softirq handler returns
* @vec_nr: softirq vector number
*
* When used in combination with the softirq_entry tracepoint
* we can determine the softirq handler runtine.
*/
DEFINE_EVENT(softirq, softirq_exit,
TP_PROTO(unsigned int vec_nr),
TP_ARGS(vec_nr)
);
/**
* softirq_raise - called immediately when a softirq is raised
* @vec_nr: softirq vector number
*
* When used in combination with the softirq_entry tracepoint
* we can determine the softirq raise to run latency.
*/
DEFINE_EVENT(softirq, softirq_raise,
TP_PROTO(unsigned int vec_nr),
TP_ARGS(vec_nr)
);
TRACE_EVENT(ipi_enter,
TP_PROTO(u32 irq),
TP_ARGS(irq),
TP_STRUCT__entry(
__field( u32, irq)
),
TP_fast_assign(
__entry->irq = irq;
),
TP_printk("ipinr=%d", __entry->irq)
);
TRACE_EVENT(ipi_exit,
TP_PROTO(u32 irq),
TP_ARGS(irq),
TP_STRUCT__entry(
__field( u32, irq)
),
TP_fast_assign(
__entry->irq = irq;
),
TP_printk("ipinr=%d", __entry->irq)
);
#endif /* _TRACE_IRQ_H */
/* This part must be outside protection */
#include <trace/define_trace.h>
|
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>
MODULE_INFO(vermagic, VERMAGIC_STRING);
struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
.name = KBUILD_MODNAME,
.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
.exit = cleanup_module,
#endif
.arch = MODULE_ARCH_INIT,
};
static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
{ 0x9e770581, "module_layout" },
{ 0x4172a276, "platform_driver_register" },
{ 0xa82edc2a, "_dev_info" },
{ 0xa5cbb81f, "dev_set_drvdata" },
{ 0x25277497, "rfkill_register" },
{ 0xa4b9e8fa, "rfkill_alloc" },
{ 0x1dd8093a, "kmem_cache_alloc_trace" },
{ 0x552137ab, "kmalloc_caches" },
{ 0x5e63b25, "regulator_get_exclusive" },
{ 0x3d3d1a77, "dev_err" },
{ 0x37a0cba, "kfree" },
{ 0xd85ac634, "regulator_put" },
{ 0xdb68bbad, "rfkill_destroy" },
{ 0x83eb21c, "rfkill_unregister" },
{ 0xcc6711f0, "dev_get_drvdata" },
{ 0xd64e6f3c, "platform_driver_unregister" },
{ 0x1258d9d9, "regulator_disable" },
{ 0x8a5c7a80, "regulator_enable" },
{ 0xda3a7ca9, "regulator_is_enabled" },
{ 0xb4390f9a, "mcount" },
};
static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";
MODULE_INFO(srcversion, "5C2FA7A8E72EDEA8DA1815E");
|
/* --------------------------------------------------------------------
EXTREME TUXRACER
Copyright (C) 1999-2001 Jasmin F. Patry (Tuxracer)
Copyright (C) 2010 Extreme Tuxracer Team
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
---------------------------------------------------------------------*/
#ifndef COMMON_H
#define COMMON_H
#include "bh.h"
#include "matrices.h"
#define clamp(minimum, x, maximum) (std::max(std::min(x, maximum), minimum))
#ifndef M_PI
# define M_PI 3.1415926535
#endif
#ifndef EPS
# define EPS 1.0e-13
#endif
#define ANGLES_TO_RADIANS(x) (M_PI / 180.0 * (x))
#define RADIANS_TO_ANGLES(x) (180.0 / M_PI * (x))
#define MAG_SQD(vec) ((vec).x * (vec).x + (vec).y * (vec).y + (vec).z * (vec).z)
// --------------------------------------------------------------------
// color utils
// --------------------------------------------------------------------
#define colTransp sf::Color::Transparent
#define colWhite sf::Color::White
#define colBlack sf::Color::Black
#define colRed sf::Color::Red
#define colYellow sf::Color::Yellow
#define colBlue sf::Color::Blue
extern const sf::Color colTBackr;
extern const sf::Color colDYell;
extern const sf::Color colDDYell;
extern const sf::Color colLYell;
extern const sf::Color colOrange;
extern const sf::Color colLRed;
extern const sf::Color colDRed;
extern const sf::Color colGrey;
extern const sf::Color colLGrey;
extern const sf::Color colDGrey;
extern const sf::Color colLBlue;
extern const sf::Color colDBlue;
extern const sf::Color colBackgr;
extern const sf::Color colDBackgr;
extern const sf::Color colDDBackgr;
extern const sf::Color colMBackgr;
extern const sf::Color colLBackgr;
extern const sf::Color colMess;
extern const sf::Color colSky;
extern const sf::Color colBronze;
extern const sf::Color colSilver;
extern const sf::Color colGold;
extern const sf::Color colGreen;
// --------------------------------------------------------------------
// print utils
// --------------------------------------------------------------------
// some simple functions to print out values on the
// terminal. Only used for development.
void PrintInt(const int val);
void PrintInt(const std::string& s, const int val);
void PrintStr(const char *val);
void PrintString(const std::string& s);
void PrintDouble(const double val);
void PrintVector(const TVector3d& v);
void PrintVector4(const TVector4d& v);
void PrintColor(const sf::Color& c);
void PrintVector2(const TVector2d& v);
template<int x, int y>
void PrintMatrix(const TMatrix<x, y>& mat);
void PrintQuaternion(const TQuaternion& q);
// --------------------------------------------------------------------
// file utils
// --------------------------------------------------------------------
bool FileExists(const std::string& filename);
bool FileExists(const std::string& dir, const std::string& filename);
bool DirExists(const char *dirname);
// --------------------------------------------------------------------
// message utils
// --------------------------------------------------------------------
void Message(const char *msg, const char *desc);
void Message(const char *msg);
void Message(const std::string& a, const std::string& b);
void Message(const std::string& a);
void SaveMessages();
// --------------------------------------------------------------------
// date and time
// --------------------------------------------------------------------
void GetTimeComponents(double time, int *min, int *sec, int *hundr);
std::string GetTimeString();
#endif
|
/* (C) IT Sky Consulting GmbH 2015
* http://www.it-sky-consulting.com/
* Author: Karl Brodowsky
* Date: 2015-03-11
* License: GPL v2 (See https://de.wikipedia.org/wiki/GNU_General_Public_License )
*/
#include <stdio.h>
#include <stdlib.h>
#include <arithmetic.h>
const uint128 TEN_18 = 1000000000000000000L;
const uint128 TEN_19 = 10000000000000000000L;
// const uint128 TEN_36 = TEN_19*TEN_19;
const uint128 EIGHT_21 = ((uint128)1)<<(21*3);
unsigned_result_with_carry adc(uint64 x, uint64 y, uint8 carry) {
unsigned_result_with_carry result;
uint64 z = x + y + carry;
int xh = CHECK_HIGHEST_BIT(x);
int yh = CHECK_HIGHEST_BIT(y);
int zh = CHECK_HIGHEST_BIT(z);
int cc = zh ? (xh & yh) : (xh | yh);
result.value = z;
result.carry = (uint8) cc;
return result;
}
unsigned_result_with_carry add(uint64 x, uint64 y) {
return adc(x, y, 0);
}
unsigned_result_with_carry adc_sx(unsigned_result_with_carry rx, uint64 y) {
return adc(rx.value, y, rx.carry);
}
unsigned_result_with_carry adc_sy(uint64 x, unsigned_result_with_carry ry) {
return adc(x, ry.value, ry.carry);
}
unsigned_result_with_carry sbb(uint64 x, uint64 y, uint8 carry) {
unsigned_result_with_carry result;
uint64 z = x - y - carry;
int xh = CHECK_HIGHEST_BIT(x);
int yh = CHECK_HIGHEST_BIT(y);
int zh = CHECK_HIGHEST_BIT(z);
int cc = xh ? (yh & zh) : (yh | zh);
result.value = z;
result.carry = (uint8) cc;
return result;
}
unsigned_result_with_carry sub(uint64 x, uint64 y) {
return sbb(x, y, 0);
}
uint64 lower(uint128 x) {
return (uint64) x;
}
uint64 upper(uint128 x) {
return (uint64) (x >> 64);
}
uint128 combine(uint64 upper, uint64 lower) {
return (((uint128) upper)<<64) + lower;
}
uint128 mul(uint64 x, uint64 y) {
uint128 result = (uint128) x * (uint128) y;
return result;
}
unsigned_divx_result divx(uint128 x, uint64 y) {
// printf("x=%lld y=%lld\n", (uint64) x, y);
// fflush(stdout);
uint128 q = x / y;
/* printf("q=%lld x=%lld y=%lld\n", (uint64) q, (uint64) x, y); */
/* fflush(stdout); */
uint64 r = x % y;
/* printf("r=%lld q=%lld x=%lld y=%lld\n", r, (uint64) q, (uint64) x, y); */
/* fflush(stdout); */
uint64 ql = lower(q);
/* printf("ql=%lld r=%lld q=%lld x=%lld y=%lld\n", ql, r, (uint64) q, (uint64) x, y); */
/* fflush(stdout); */
uint64 qu = upper(q);
/* printf("qu=%lld ql=%lld r=%lld q=%lld x=%lld y=%lld\n", qu, ql, r, (uint64) q, (uint64) x, y); */
/* fflush(stdout); */
unsigned_divx_result result;
result.quotient = ql;
result.remainder = r;
result.overflow = (qu != 0);
return result;
}
void sprint_uint128_dec(char *buf, uint128 x) {
uint64 xl = (uint64) (x % TEN_18);
uint128 xx = x / TEN_18;
uint64 xm = (uint64) (xx % TEN_18);
uint64 xh = (uint64) (xx / TEN_18);
if (xh != 0) {
sprintf(buf, "%llu%018llu%018llu", xh, xm, xl);
} else if (xm != 0) {
sprintf(buf, "%llu%018llu", xm, xl);
} else {
sprintf(buf, "%llu", xl);
}
}
void sprint_uint128_hex(char *buf, uint128 x) {
uint64 xl = lower(x);
uint64 xh = upper(x);
if (xh != 0) {
sprintf(buf, "%llx%016llx", xh, xl);
} else {
sprintf(buf, "%llx", xl);
}
}
void sprint_uint128_oct(char *buf, uint128 x) {
uint64 xl = (uint64) (x % EIGHT_21);
uint128 xx = x / EIGHT_21;
uint64 xm = (uint64) (xx % EIGHT_21);
uint64 xh = (uint64) (xx / EIGHT_21);
if (xh != 0) {
sprintf(buf, "%llo%021llo%021llo", xh, xm, xl);
} else if (xm != 0) {
sprintf(buf, "%llo%021llo", xm, xl);
} else {
sprintf(buf, "%llo", xl);
}
}
|
#ifndef FIRST_NOT_REPEAT_CHAR_H_
#define FIRST_NOT_REPEAT_CHAR_H_
#include <cstring>
char firstNotRepeatCharByArray(char* str) {
int data[256];
char* p;
if (str == NULL)
return '\0';
memset(data, 0, sizeof(data));
p = str;
while (*p != '\0') {
int index = *p - 'a';
++data[index];
++p;
}
while (*str != '\0') {
int index = *str - 'a';
if (data[index] == 1)
return *str;
++str;
}
return '\0';
}
#endif // FIRST_NOT_REPEAT_CHAR_H_
|
#include "at24cxx.h"
void AT24Cxx_init(struct AT24Cxx_init_struct* init)
{
I2C_InitTypeDef I2C_InitStructure;
GPIO_InitTypeDef GPIO_InitStructure;
/* Configure clocks */
RCC_APB1PeriphClockCmd(init->I2C_clock, ENABLE);
RCC_APB2PeriphClockCmd(init->GPIO_clock | RCC_APB2Periph_AFIO , ENABLE);
/* Configure I2C pins: SCL and SDA */
GPIO_InitStructure.GPIO_Pin = init->GPIO_SCL_pin | init->GPIO_SDA_pin;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
GPIO_Init(init->GPIO_peripheral, &GPIO_InitStructure);
/* Configure I2C */
I2C_DeInit(init->I2C_peripheral);
I2C_InitStructure.I2C_Mode = I2C_Mode_I2C;
I2C_InitStructure.I2C_DutyCycle = I2C_DutyCycle_2;
I2C_InitStructure.I2C_OwnAddress1 = init->I2C_master_address;
I2C_InitStructure.I2C_Ack = I2C_Ack_Enable;
I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit;
I2C_InitStructure.I2C_ClockSpeed = 10000;
I2C_Cmd(init->I2C_peripheral, ENABLE);
I2C_Init(init->I2C_peripheral, &I2C_InitStructure);
I2C_AcknowledgeConfig(init->I2C_peripheral, ENABLE);
}
#ifdef ACK_POLLING_SUPPORT
static void AT24Cxx_ack_polling(struct AT24Cxx_init_struct* init)
{
/* Until ack fails (I2C_FLAG_AF) continue with the polling */
do {
I2C_GenerateSTART(init->I2C_peripheral, ENABLE);
I2C_Send7bitAddress(init->I2C_peripheral, init->I2C_address, I2C_Direction_Transmitter);
} while((I2C_GetLastEvent(init->I2C_peripheral) & I2C_FLAG_AF));
I2C_ClearFlag(init->I2C_peripheral, I2C_FLAG_AF);
I2C_GenerateSTOP(init->I2C_peripheral, ENABLE);
}
#endif
static uint32_t AT24Cxx_write_page(struct AT24Cxx_init_struct* init, uint8_t addr, uint8_t* buff, uint8_t count)
{
uint8_t _count = count;
/* start, I2c_address, memory_address, data(n), data(n+1), ... , stop */
I2C_GenerateSTART(init->I2C_peripheral, ENABLE);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_MODE_SELECT));
I2C_Send7bitAddress(init->I2C_peripheral, init->I2C_address, I2C_Direction_Transmitter);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
I2C_SendData(init->I2C_peripheral, addr);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_BYTE_TRANSMITTED));
while(count--) {
I2C_SendData(init->I2C_peripheral, *buff);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_BYTE_TRANSMITTED));
buff++;
}
I2C_GenerateSTOP(init->I2C_peripheral, ENABLE);
#ifdef ACK_POLLING_SUPPORT
AT24Cxx_ack_polling(init);
#endif
/* After stop let the EEPROM to complete the internal write cycle */
init->delay_fn(init->t_write);
return _count;
}
uint32_t AT24Cxx_write(struct AT24Cxx_init_struct* init, uint8_t addr, uint8_t* buff, uint32_t count)
{
uint8_t n = 0; /* number of bytes to write for each page */
uint32_t written = 0; /* total number of written bytes */
/* Is it a valid address? */
if((addr + count) > (init->pages) * (init->page_size))
return 0;
uint8_t page = (addr / init->page_size);
uint8_t page_boundary = (page + 1) * init->page_size - 1;
/* Write as much bytes as possible until the page boundary */
while(count) {
n = page_boundary - addr + 1;
if(n > count)
n = count;
written += AT24Cxx_write_page(init, addr, buff, n);
buff += n;
addr += n;
count -= n;
page_boundary = (++page + 1) * init->page_size - 1;
}
return written;
}
uint32_t AT24Cxx_read(struct AT24Cxx_init_struct* init, uint8_t addr, uint8_t* buff, uint32_t count)
{
/* Is it a valid address? */
if((addr + count) > (init->pages) * (init->page_size))
return 0;
/* start, dummy write, read, stop */
/* start, I2c_address(W), memory_address, start, I2C_address(R), receive, stop */
I2C_GenerateSTART(init->I2C_peripheral, ENABLE);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_MODE_SELECT));
I2C_Send7bitAddress(init->I2C_peripheral, init->I2C_address, I2C_Direction_Transmitter);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_TRANSMITTER_MODE_SELECTED));
I2C_SendData(init->I2C_peripheral, addr);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_BYTE_TRANSMITTED));
I2C_GenerateSTART(init->I2C_peripheral, ENABLE);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_MODE_SELECT));
I2C_Send7bitAddress(init->I2C_peripheral, init->I2C_address, I2C_Direction_Receiver);
while (!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_RECEIVER_MODE_SELECTED));
while (count--) {
/* In a sequential read if the master does not ack then this is the last byte to read */
if(count == 0)
I2C_AcknowledgeConfig(init->I2C_peripheral, DISABLE);
while(!I2C_CheckEvent(init->I2C_peripheral, I2C_EVENT_MASTER_BYTE_RECEIVED));
*buff = I2C_ReceiveData(init->I2C_peripheral);
buff++;
}
/* Re-enable ack */
I2C_AcknowledgeConfig(init->I2C_peripheral, ENABLE);
I2C_GenerateSTOP(init->I2C_peripheral, ENABLE);
return count;
}
|
#pragma once
// Return Codes
enum
{
CELL_ATRAC_OK = 0x00000000,
CELL_ATRAC_ERROR_API_FAIL = 0x80610301,
CELL_ATRAC_ERROR_READSIZE_OVER_BUFFER = 0x80610311,
CELL_ATRAC_ERROR_UNKNOWN_FORMAT = 0x80610312,
CELL_ATRAC_ERROR_READSIZE_IS_TOO_SMALL = 0x80610313,
CELL_ATRAC_ERROR_ILLEGAL_SAMPLING_RATE = 0x80610314,
CELL_ATRAC_ERROR_ILLEGAL_DATA = 0x80610315,
CELL_ATRAC_ERROR_NO_DECODER = 0x80610321,
CELL_ATRAC_ERROR_UNSET_DATA = 0x80610322,
CELL_ATRAC_ERROR_DECODER_WAS_CREATED = 0x80610323,
CELL_ATRAC_ERROR_ALLDATA_WAS_DECODED = 0x80610331,
CELL_ATRAC_ERROR_NODATA_IN_BUFFER = 0x80610332,
CELL_ATRAC_ERROR_NOT_ALIGNED_OUT_BUFFER = 0x80610333,
CELL_ATRAC_ERROR_NEED_SECOND_BUFFER = 0x80610334,
CELL_ATRAC_ERROR_ALLDATA_IS_ONMEMORY = 0x80610341,
CELL_ATRAC_ERROR_ADD_DATA_IS_TOO_BIG = 0x80610342,
CELL_ATRAC_ERROR_NONEED_SECOND_BUFFER = 0x80610351,
CELL_ATRAC_ERROR_UNSET_LOOP_NUM = 0x80610361,
CELL_ATRAC_ERROR_ILLEGAL_SAMPLE = 0x80610371,
CELL_ATRAC_ERROR_ILLEGAL_RESET_BYTE = 0x80610372,
CELL_ATRAC_ERROR_ILLEGAL_PPU_THREAD_PRIORITY = 0x80610381,
CELL_ATRAC_ERROR_ILLEGAL_SPU_THREAD_PRIORITY = 0x80610382,
};
// Remain Frame
enum
{
CELL_ATRAC_ALLDATA_IS_ON_MEMORY = -1,
CELL_ATRAC_NONLOOP_STREAM_DATA_IS_ON_MEMORY = -2,
CELL_ATRAC_LOOP_STREAM_DATA_IS_ON_MEMORY = -3,
};
union CellAtracHandle
{
u8 uiWorkMem[512];
struct AtracHandle
{
u32 pucWorkMem_addr;
} data;
};
struct CellAtracBufferInfo
{
be_t<u32> pucWriteAddr;
be_t<u32> uiWritableByte;
be_t<u32> uiMinWriteByte;
be_t<u32> uiReadPosition;
};
struct CellAtracExtRes
{
be_t<u32> pSpurs_addr;
u8 priority[8];
};
|
#ifndef __FIH_EMMC_H
#define __FIH_EMMC_H
#define FIH_EMMC_SIZE (64)
void fih_emmc_setup(char *info);
#endif /* __FIH_EMMD_H */
|
/* $Id: client.h,v 1.14 2006/05/13 01:12:59 jonz Exp $ */
/*
DSPAM
COPYRIGHT (C) 2002-2006 JONATHAN A. ZDZIARSKI
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; version 2
of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _CLIENT_H
# define _CLIENT_H
#ifdef HAVE_CONFIG_H
#include <auto-config.h>
#endif
#ifdef DAEMON
#include <sys/types.h>
#ifndef _WIN32
#include <pwd.h>
#endif
#include "dspam.h"
#include "buffer.h"
int client_process (AGENT_CTX *ATX, buffer *msg);
int client_connect (AGENT_CTX *ATX, int flags);
int client_authenticate (THREAD_CTX *TTX, const char *mode);
int client_parsecode (char *err);
int client_getcode (THREAD_CTX *TTX, char *err, size_t len);
char * client_expect (THREAD_CTX *TTX, int code, char *err, size_t len);
char * client_getline (THREAD_CTX *TTX, int timeout);
int deliver_socket (AGENT_CTX *ATX, const char *msg, int proto);
char *pop_buffer (THREAD_CTX *TTX);
int send_socket (THREAD_CTX *TTX, const char *ptr);
#define CCF_PROCESS 0x00 /* use ClientHost */
#define CCF_DELIVERY 0x01 /* use DeliveryHost */
#define DDP_LMTP 0x00
#define DDP_SMTP 0x01
#endif /* _CLIENT_H */
#endif /* DAEMON */
|
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Code Aurora Forum nor
* the names of its contributors may be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* Alternatively, provided that this notice is retained in full, this software
* may be relicensed by the recipient under the terms of the GNU General Public
* License version 2 ("GPL") and only version 2, in which case the provisions of
* the GPL apply INSTEAD OF those given above. If the recipient relicenses the
* software under the GPL, then the identification text in the MODULE_LICENSE
* macro must be changed to reflect "GPLv2" instead of "Dual BSD/GPL". Once a
* recipient changes the license terms to the GPL, subsequent recipients shall
* not relicense under alternate licensing terms, including the BSD or dual
* BSD/GPL terms. In addition, the following license statement immediately
* below and between the words START and END shall also then apply when this
* software is relicensed under the GPL:
*
* START
*
* 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.
*
* 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.
*
* END
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef _QDSP6AUDIOENCSESSION_H_
#define _QDSP6AUDIOENCSESSION_H_
#include <mach/qdsp6/msm8k_cad_q6enc_drvi.h>
s32 cad_q6enc_session_init(struct q6_enc_session_data *self);
s32 cad_q6enc_session_dinit(struct q6_enc_session_data *self);
s32 cad_q6enc_session_open(struct q6_enc_session_data *self,
s32 session_id,
struct cad_open_struct_type *open_param);
s32 cad_q6enc_session_read(struct q6_enc_session_data *self,
struct cad_buf_struct_type *buf);
s32 cad_q6enc_session_close(struct q6_enc_session_data *self);
s32 cad_q6enc_session_ioctl(struct q6_enc_session_data *self,
u32 cmd,
void *cmd_buf);
#endif
|
/*
* Copyright (C) 2001 Peter Kelly (pmk@post.com)
* Copyright (C) 2001 Tobias Anton (anton@stud.fbi.fh-darmstadt.de)
* Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
* Copyright (C) 2003, 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/
#ifndef MutationEvent_h
#define MutationEvent_h
#include "Event.h"
#include "Node.h"
namespace WebCore {
class MutationEvent final : public Event {
public:
virtual ~MutationEvent();
enum attrChangeType {
MODIFICATION = 1,
ADDITION = 2,
REMOVAL = 3
};
static Ref<MutationEvent> create(const AtomicString& type, bool canBubble, PassRefPtr<Node> relatedNode = nullptr,
const String& prevValue = String(), const String& newValue = String(), const String& attrName = String(), unsigned short attrChange = 0)
{
return adoptRef(*new MutationEvent(type, canBubble, false, relatedNode, prevValue, newValue, attrName, attrChange));
}
static Ref<MutationEvent> createForBindings()
{
return adoptRef(*new MutationEvent);
}
void initMutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
const String& prevValue, const String& newValue,
const String& attrName, unsigned short attrChange);
Node* relatedNode() const { return m_relatedNode.get(); }
String prevValue() const { return m_prevValue; }
String newValue() const { return m_newValue; }
String attrName() const { return m_attrName; }
unsigned short attrChange() const { return m_attrChange; }
virtual EventInterface eventInterface() const override;
private:
#if PLATFORM(JAVA) //XXX: used in JavaEvent.cpp, or enable RTTI
virtual bool isMutationEvent() const override final { return true; }
#endif
MutationEvent();
MutationEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<Node> relatedNode,
const String& prevValue, const String& newValue,
const String& attrName, unsigned short attrChange);
RefPtr<Node> m_relatedNode;
String m_prevValue;
String m_newValue;
String m_attrName;
unsigned short m_attrChange;
};
} // namespace WebCore
#if PLATFORM(JAVA) //XXX: used in JavaEvent.cpp, or enable RTTI
SPECIALIZE_TYPE_TRAITS_EVENT(MutationEvent)
#endif
#endif // MutationEvent_h
|
/* $Id: makesalt.c,v 1.2 2005/06/04 18:01:32 hisi Exp $ */
/************************************************************************
* psybnc2.2.2, tools/makesalt.c
* Copyright (C) 2001 the most psychoid and
* the cool lam3rz IRC Group, IRCnet
* http://www.psychoid.lam3rz.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 1, 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.
*/
#ifndef lint
static char rcsid[] = "@(#)$Id: makesalt.c,v 1.2 2005/06/04 18:01:32 hisi Exp $";
#endif
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <time.h>
char rbuf[100];
const char *randstring(int length)
{
char *po;
int i;
po=rbuf;
if (length>100) length=100;
for(i=0;i<length;i++) {*po=(char)(0x61+(rand()&15)); po++;}
*po=0;
po=rbuf;
return po;
}
int main(void)
{
FILE* salt;
int saltlen1;
int saltlen2;
int foo;
srand(time(NULL));
saltlen1=(rand()&20)+5;
saltlen2=(rand()&20)+5;
if ( (salt=fopen("salt.h","r"))!=NULL) {
fclose(salt);
printf("Using existent Salt-File\n");
exit(0x0);
}
printf("Creating Salt File\n");
if ( (salt=fopen("salt.h","w"))==NULL) {
printf("Cannot created Salt-File.. aborting\n");
exit(0x1);
}
fprintf(salt,"/* The 1. Salt -> string containing anything, %d chars */\n",saltlen1);
fprintf(salt,"#define SALT1 %c%s%c\n",34,randstring(saltlen1),34);
fprintf(salt,"\n");
fprintf(salt,"/* The 2. Salt -> string containing anything, %d chars */\n",saltlen2);
fprintf(salt,"#define SALT2 %c%s%c\n",34,randstring(saltlen2),34);
fprintf(salt,"\n");
fprintf(salt,"/* the 1. Code -> a one byte startup code */\n");
fprintf(salt,"#define CODE1 %d\n",64+(rand()&15));
fprintf(salt,"\n");
fprintf(salt,"/* the 2. Code -> a one byte startup code */\n");
fprintf(salt,"#define CODE2 %d\n",64+(rand()&15));
fprintf(salt,"\n");
fprintf(salt,"/* the 1. Salt Offset -> value from 0-%d */\n",saltlen1-1);
fprintf(salt,"#define SA1 %d\n",rand()&(saltlen1-1));
fprintf(salt,"\n");
fprintf(salt,"/* the 2. Salt Offset -> value from 0-%d */\n",saltlen2-1);
fprintf(salt,"#define SA2 %d\n",rand()&(saltlen2-1));
fprintf(salt,"\n");
fprintf(salt,"/* the make salt routine */\n");
fprintf(salt,"/* dont wonder about the redundance, its needed to somehow hide the fully salts */\n");
fprintf(salt,"\n");
fprintf(salt,"/* salt buffers */\n");
fprintf(salt,"\n");
fprintf(salt,"unsigned char slt1[%d];\n",saltlen1+1);
fprintf(salt,"unsigned char slt2[%d];\n",saltlen2+1);
fprintf(salt,"\n");
fprintf(salt,"int makesalt(void)\n");
fprintf(salt,"{\n");
for (foo=0;foo<saltlen1;foo++)
fprintf(salt," slt1[%d]=SALT1[%d];\n",foo,foo);
fprintf(salt," slt1[%d]=0;\n",saltlen1);
for (foo=0;foo<saltlen2;foo++)
fprintf(salt," slt2[%d]=SALT2[%d];\n",foo,foo);
fprintf(salt," slt2[%d]=0;\n",saltlen2);
fprintf(salt,"}");
fprintf(salt,"\n");
fclose(salt);
printf("Salt File created. Move the Salt File to a safe location after\n");
printf("psyBNC was compiled and delete it on your shell. You will need\n");
printf("the File later for update Compiling.\n");
exit (0x0);
}
|
/*
* MARS Long Distance Replication Software
*
* This file is part of MARS project: http://schoebel.github.io/mars/
*
* Copyright (C) 2010-2014 Thomas Schoebel-Theuer
* Copyright (C) 2011-2014 1&1 Internet AG
*
* 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 MARS_SIO_H
#define MARS_SIO_H
#include "lib_mapfree.h"
#define WITH_THREAD 16
struct sio_mref_aspect {
GENERIC_ASPECT(mref);
struct list_head io_head;
int alloc_len;
bool do_dealloc;
};
struct sio_brick {
MARS_BRICK(sio);
// parameters
bool o_direct;
bool o_fdsync;
};
struct sio_input {
MARS_INPUT(sio);
};
struct sio_threadinfo {
struct sio_output *output;
struct list_head mref_list;
struct task_struct *thread;
wait_queue_head_t event;
spinlock_t lock;
atomic_t queue_count;
atomic_t fly_count;
atomic_t total_count;
unsigned long last_jiffies;
};
struct sio_output {
MARS_OUTPUT(sio);
// private
struct mapfree_info *mf;
struct sio_threadinfo tinfo[WITH_THREAD+1];
spinlock_t g_lock;
atomic_t work_count;
int index;
int error;
};
MARS_TYPES(sio);
#endif
|
#ifndef CMD_LINE_H
#define CMD_LINE_H
#include <QString>
static const QString CMD_LINE_DEVELOPER_TOOLS = "--developer-tools";
#endif // CMD_LINE_H
|
#include <linux/cpumask.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <linux/smp.h>
#include <linux/sched.h>
#include <linux/elf.h>
#include <asm/cputhreads.h>
#include "bgq.h"
static int __init smp_bgq_probe(void)
{
return num_possible_cpus();
}
static int smp_bgq_cpu_bootable(unsigned int nr)
{
/*
* Special case - we inhibit secondary thread startup
* during boot if the user requests it.
*/
if (system_state < SYSTEM_RUNNING && cpu_has_feature(CPU_FTR_SMT)) {
if (!smt_enabled_at_boot && cpu_thread_in_core(nr) != 0)
return 0;
if (smt_enabled_at_boot &&
cpu_thread_in_core(nr) >= smt_enabled_at_boot)
return 0;
}
return 1;
}
static int __devinit smp_bgq_kick_cpu(int nr)
{
struct device_node *np;
int tid;
const char *enable_method;
if (nr < 0 || nr >= num_possible_cpus())
return -ENOENT;
np = of_get_cpu_node(nr, &tid);
if (!np)
return -ENODEV;
enable_method = of_get_property(np, "enable-method", NULL);
if (!enable_method) {
pr_err("CPU%d has no enable-method\n", nr);
return -ENOENT;
}
pr_devel("CPU%d has enable-method: \"%s\"\n", nr, enable_method);
if (strcmp(enable_method, "kexec") != 0) {
pr_err("CPU%d: This kernel does not support the \"%s\"\n",
nr, enable_method);
return -EINVAL;
}
/*
* The processor is currently spinning, waiting for the
* cpu_start field to become non-zero. After we set
* cpu_start, the processor will continue on to
* secondary_start
*/
paca[nr].cpu_start = 1;
/* barrier so other CPU can see it */
smp_mb();
return 0;
}
static void __devinit smp_bgq_setup_cpu(int cpu)
{
bgq_setup_cpu(cpu);
}
static struct smp_ops_t bgq_smp_ops = {
.probe = smp_bgq_probe,
.kick_cpu = smp_bgq_kick_cpu,
.cpu_bootable = smp_bgq_cpu_bootable,
.setup_cpu = smp_bgq_setup_cpu,
.cause_ipi = bgq_cause_ipi,
.message_pass = NULL, /* use the muxed_ipi stuff */
};
void __init bgq_setup_smp(void)
{
smp_ops = &bgq_smp_ops;
}
|
#ifndef _SATOSHI_BLOCK_H_
#define _SATOSHI_BLOCK_H_
#include <stdint.h>
#include "satoshi_protocol.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct block_file_header
{
uint32_t magic;
uint32_t length;
}block_file_header_t;
typedef struct satoshi_block_header
{
int32_t version;
unsigned char prev_hash[32];
unsigned char merkle_root[32];
uint32_t timestamp;
uint32_t bits;
uint32_t nonce;
}satoshi_block_header_t;
typedef struct satoshi_block
{
satoshi_block_header_t hdr;
unsigned char txn_count[1];
}satoshi_block_t;
typedef struct satoshi_tx
{
int32_t version;
unsigned char txin_count[1];
// satoshi_txin_t txin[];
// satoshi_txout_t txout[];
// uint32_t locktime
}satoshi_tx_t;
typedef struct satoshi_outpoint
{
unsigned char hash[32];
uint32_t index;
}satoshi_outpoint_t;
typedef struct satoshi_txin
{
satoshi_outpoint_t outpoint;
varstr_t sig_script;
// uint32_t sequence;
}satoshi_txin_t;
#define SATOSHI_TXIN_SEQ(txin) *(uint32_t *)(((unsigned char *)txin->sig_script) + varstr_size(txin->sig_script))
typedef struct satoshi_txout
{
int64_t value;
varstr_t pk_script;
}satoshi_txout_t;
typedef struct tx_parser
{
union
{
const satoshi_tx_t * tx;
const unsigned char * raw_data;
};
size_t tx_size;
unsigned char hash[32];
int txin_count;
int txout_count;
satoshi_txin_t ** pp_txin;
satoshi_txout_t ** pp_txout;
uint32_t locktime;
}tx_parser_t;
const unsigned char * tx_parser_attach(tx_parser_t * tp, const unsigned char * p_begin, const unsigned char * p_end);
void tx_parser_detach(tx_parser_t * tp);
typedef struct block_parser
{
union
{
const satoshi_block_t * block;
const unsigned char * raw_data;
};
uint32_t length;
unsigned char hash[32];
int txn_count;
tx_parser_t * p_tp;
}block_parser_t;
const unsigned char * block_parser_attach(block_parser_t * bp, const unsigned char * p_begin, uint32_t length);
void block_parser_detach(block_parser_t * bp);
void block_parser_dump(block_parser_t * bp);
#ifdef __cplusplus
}
#endif
#endif
|
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: kernel
* PURPOSE: GDI EngCopyBits Function
* FILE: win32ss/gdi/eng/copybits.c
* PROGRAMER: Jason Filby
*/
#include <win32k.h>
#define NDEBUG
#include <debug.h>
/*
* @implemented
*/
BOOL APIENTRY
EngCopyBits(
_In_ SURFOBJ *psoDest,
_In_ SURFOBJ *psoSource,
_In_opt_ CLIPOBJ *Clip,
_In_opt_ XLATEOBJ *ColorTranslation,
_In_ RECTL *DestRect,
_In_ POINTL *SourcePoint)
{
BOOL ret;
BYTE clippingType;
RECT_ENUM RectEnum;
BOOL EnumMore;
BLTINFO BltInfo;
SURFACE *psurfDest;
SURFACE *psurfSource;
RECTL rclDest = *DestRect;
POINTL ptlSrc = *SourcePoint;
ASSERT(psoDest != NULL && psoSource != NULL && DestRect != NULL && SourcePoint != NULL);
psurfSource = CONTAINING_RECORD(psoSource, SURFACE, SurfObj);
psurfDest = CONTAINING_RECORD(psoDest, SURFACE, SurfObj);
/* Clip dest rect against source surface size / source point */
if (psoSource->sizlBitmap.cx - ptlSrc.x < rclDest.right - rclDest.left)
rclDest.right = rclDest.left + psoSource->sizlBitmap.cx - ptlSrc.x;
if (psoSource->sizlBitmap.cy - ptlSrc.y < rclDest.bottom - rclDest.top)
rclDest.bottom = rclDest.top + psoSource->sizlBitmap.cy - ptlSrc.y;
/* Clip dest rect against target surface size */
if (rclDest.right > psoDest->sizlBitmap.cx)
rclDest.right = psoDest->sizlBitmap.cx;
if (rclDest.bottom > psoDest->sizlBitmap.cy)
rclDest.bottom = psoDest->sizlBitmap.cy;
if (RECTL_bIsEmptyRect(&rclDest)) return TRUE;
DestRect = &rclDest;
// FIXME: Don't punt to the driver's DrvCopyBits immediately. Instead,
// mark the copy block function to be DrvCopyBits instead of the
// GDI's copy bit function so as to remove clipping from the
// driver's responsibility
// If one of the surfaces isn't managed by the GDI
if ((psoDest->iType!=STYPE_BITMAP) || (psoSource->iType!=STYPE_BITMAP))
{
// Destination surface is device managed
if (psoDest->iType!=STYPE_BITMAP)
{
/* FIXME: Eng* functions shouldn't call Drv* functions. ? */
if (psurfDest->flags & HOOK_COPYBITS)
{
ret = GDIDEVFUNCS(psoDest).CopyBits(
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
goto cleanup;
}
}
// Source surface is device managed
if (psoSource->iType!=STYPE_BITMAP)
{
/* FIXME: Eng* functions shouldn't call Drv* functions. ? */
if (psurfSource->flags & HOOK_COPYBITS)
{
ret = GDIDEVFUNCS(psoSource).CopyBits(
psoDest, psoSource, Clip, ColorTranslation, DestRect, SourcePoint);
goto cleanup;
}
}
// If CopyBits wasn't hooked, BitBlt must be
ret = IntEngBitBlt(psoDest, psoSource,
NULL, Clip, ColorTranslation, DestRect, SourcePoint,
NULL, NULL, NULL, ROP4_FROM_INDEX(R3_OPINDEX_SRCCOPY));
goto cleanup;
}
// Determine clipping type
if (!Clip)
{
clippingType = DC_TRIVIAL;
}
else
{
clippingType = Clip->iDComplexity;
}
BltInfo.DestSurface = psoDest;
BltInfo.SourceSurface = psoSource;
BltInfo.PatternSurface = NULL;
BltInfo.XlateSourceToDest = ColorTranslation;
BltInfo.Rop4 = ROP4_FROM_INDEX(R3_OPINDEX_SRCCOPY);
switch (clippingType)
{
case DC_TRIVIAL:
BltInfo.DestRect = *DestRect;
BltInfo.SourcePoint = *SourcePoint;
ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
break;
case DC_RECT:
// Clip the blt to the clip rectangle
RECTL_bIntersectRect(&BltInfo.DestRect, DestRect, &Clip->rclBounds);
BltInfo.SourcePoint.x = SourcePoint->x + BltInfo.DestRect.left - DestRect->left;
BltInfo.SourcePoint.y = SourcePoint->y + BltInfo.DestRect.top - DestRect->top;
ret = DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo);
break;
case DC_COMPLEX:
CLIPOBJ_cEnumStart(Clip, FALSE, CT_RECTANGLES, CD_ANY, 0);
do
{
EnumMore = CLIPOBJ_bEnum(Clip,(ULONG) sizeof(RectEnum), (PVOID) &RectEnum);
if (RectEnum.c > 0)
{
RECTL* prclEnd = &RectEnum.arcl[RectEnum.c];
RECTL* prcl = &RectEnum.arcl[0];
do
{
RECTL_bIntersectRect(&BltInfo.DestRect, prcl, DestRect);
BltInfo.SourcePoint.x = SourcePoint->x + BltInfo.DestRect.left - DestRect->left;
BltInfo.SourcePoint.y = SourcePoint->y + BltInfo.DestRect.top - DestRect->top;
if (!DibFunctionsForBitmapFormat[psoDest->iBitmapFormat].DIB_BitBltSrcCopy(&BltInfo))
{
ret = FALSE;
goto cleanup;
}
prcl++;
} while (prcl < prclEnd);
}
} while (EnumMore);
ret = TRUE;
break;
default:
ASSERT(FALSE);
ret = FALSE;
break;
}
cleanup:
return ret;
}
BOOL APIENTRY
IntEngCopyBits(
SURFOBJ *psoDest,
SURFOBJ *psoSource,
CLIPOBJ *pco,
XLATEOBJ *pxlo,
RECTL *prclDest,
POINTL *ptlSource)
{
return EngCopyBits(psoDest, psoSource, pco, pxlo, prclDest, ptlSource);
}
/* EOF */
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_
#define CHROME_BROWSER_NET_PROXY_SERVICE_FACTORY_H_
#include "base/basictypes.h"
class CommandLine;
class PrefProxyConfigTracker;
class PrefService;
namespace net {
class NetLog;
class NetworkDelegate;
class ProxyConfigService;
class ProxyService;
class URLRequestContext;
}
class ProxyServiceFactory {
public:
static net::ProxyConfigService* CreateProxyConfigService(
PrefProxyConfigTracker* tracker);
static PrefProxyConfigTracker* CreatePrefProxyConfigTrackerOfProfile(
PrefService* profile_prefs,
PrefService* local_state_prefs);
static PrefProxyConfigTracker* CreatePrefProxyConfigTrackerOfLocalState(
PrefService* local_state_prefs);
static net::ProxyService* CreateProxyService(
net::NetLog* net_log,
net::URLRequestContext* context,
net::NetworkDelegate* network_delegate,
net::ProxyConfigService* proxy_config_service,
const CommandLine& command_line);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ProxyServiceFactory);
};
#endif
|
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdio.h>
#include <poll.h>
#include <signal.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <string.h>
#define KER_RW_R8 0
#define KER_RW_R16 1
#define KER_RW_R32 2
#define KER_RW_W8 3
#define KER_RW_W16 4
#define KER_RW_W32 5
/* Usage:
* ./regeditor r8 addr [num]
* ./regeditor r16 addr [num]
* ./regeditor r32 addr [num]
*
* ./regeditor w8 addr val
* ./regeditor w16 addr val
* ./regeditor w32 addr val
*/
void print_usage(char *file)
{
printf("Usage:\n");
printf("%s <r8 | r16 | r32> <phy addr> [num]\n", file);
printf("%s <w8 | w16 | w32> <phy addr> <val>\n", file);
}
int main(int argc, char **argv)
{
int fd;
unsigned int buf[2];
unsigned int i;
unsigned int num;
if ((argc != 3) && (argc != 4))
{
print_usage(argv[0]);
return -1;
}
fd = open("/dev/ker_rw", O_RDWR);
if (fd < 0)
{
printf("can't open /dev/ker_rw\n");
return -2;
}
/* addr */
buf[0] = strtoul(argv[2], NULL, 0);
if (argc == 4)
{
buf[1] = strtoul(argv[3], NULL, 0);
num = buf[1];
}
else
{
num = 1;
}
if (strcmp(argv[1], "r8") == 0)
{
for ( i = 0; i < num; i++)
{
ioctl(fd, KER_RW_R8, buf); /* val = buf[1] */
printf("%02d. [%08x] = %02x\n", i, buf[0], (unsigned char)buf[1]);
buf[0] += 1;
}
}
else if (strcmp(argv[1], "r16") == 0)
{
for ( i = 0; i < num; i++)
{
ioctl(fd, KER_RW_R16, buf); /* val = buf[1] */
printf("%02d. [%08x] = %02x\n", i, buf[0], (unsigned short)buf[1]);
buf[0] += 2;
}
}
else if (strcmp(argv[1], "r32") == 0)
{
for ( i = 0; i < num; i++)
{
ioctl(fd, KER_RW_R32, buf); /* val = buf[1] */
printf("%02d. [%08x] = %02x\n", i, buf[0], (unsigned int)buf[1]);
buf[0] += 4;
}
}
else if (strcmp(argv[1], "w8") == 0)
{
ioctl(fd, KER_RW_W8, buf); /* val = buf[1] */
}
else if (strcmp(argv[1], "w16") == 0)
{
ioctl(fd, KER_RW_W16, buf); /* val = buf[1] */
}
else if (strcmp(argv[1], "w32") == 0)
{
ioctl(fd, KER_RW_W32, buf); /* val = buf[1] */
}
else
{
printf(argv[0]);
return -1;
}
return 0;
}
|
/***************************************************************************
qgspalettedrasterrenderer.h
---------------------------
begin : December 2011
copyright : (C) 2011 by Marco Hugentobler
email : marco at sourcepole dot ch
***************************************************************************/
/***************************************************************************
* *
* 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 QGSPALETTEDRASTERRENDERER_H
#define QGSPALETTEDRASTERRENDERER_H
#include <QVector>
#include "qgsrasterrenderer.h"
class QColor;
class QDomElement;
/** \ingroup core
* Renderer for paletted raster images.
*/
class CORE_EXPORT QgsPalettedRasterRenderer: public QgsRasterRenderer
{
public:
/**Renderer owns color array*/
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray, int nColors, const QVector<QString> labels = QVector<QString>() );
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QRgb* colorArray, int nColors, const QVector<QString> labels = QVector<QString>() );
~QgsPalettedRasterRenderer();
QgsRasterInterface * clone() const override;
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input );
QgsRasterBlock* block( int bandNo, const QgsRectangle & extent, int width, int height ) override;
QgsRasterBlock* block2( int bandNo, const QgsRectangle & extent, int width, int height, QgsRasterBlockFeedback *feedback = nullptr ) override;
/**Returns number of colors*/
int nColors() const { return mNColors; }
/**Returns copy of color array (caller takes ownership)*/
QColor* colors() const;
/**Returns copy of rgb array (caller takes ownership)
@note not available in python bindings
*/
QRgb* rgbArray() const;
/** Return optional category label
* @note added in 2.1 */
QString label( int idx ) const { return mLabels.value( idx ); }
/** Set category label
* @note added in 2.1 */
void setLabel( int idx, QString label );
void writeXML( QDomDocument& doc, QDomElement& parentElem ) const override;
void legendSymbologyItems( QList< QPair< QString, QColor > >& symbolItems ) const override;
QList<int> usesBands() const override;
private:
int mBand;
/**Color array*/
QRgb* mColors;
/**Number of colors*/
int mNColors;
/** Optional category labels, size of vector may be < mNColors */
QVector<QString> mLabels;
};
#endif // QGSPALETTEDRASTERRENDERER_H
|
/* vi:ai:et:ts=8 sw=2
*/
/*
*
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h> /* isspace */
#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
#include <time.h>
#ifndef WIN32
#include <unistd.h>
#ifndef BSD
#include <crypt.h>
#endif /* BSD */
#else /* WIN32 */
# include "wzd_crypt.h"
#endif
#include "wzd_auth.h"
#include "wzd_krb5.h"
#include "wzd_md5crypt.h"
#include "wzd_md5.h"
#include "wzd_pam.h"
#include "wzd_sha1.h"
#include "wzd_tls.h"
static void _pass_get_random(char *buffer, size_t len);
/* return 1 if password matches */
int checkpass_crypt(const char *pass, const char *encrypted)
{
char * cipher;
if (!pass || !encrypted) return 0;
/* FIXME - crypt is NOT reentrant */
cipher = crypt(pass,encrypted);
return strcmp(cipher,encrypted)==0;
}
/* return 1 if password matches */
int checkpass_md5(const char *pass, const char *encrypted)
{
char * cipher;
if (!pass || !encrypted) return 0;
/* FIXME - md5_crypt is NOT reentrant */
cipher = md5_crypt(pass,encrypted);
return strcmp(cipher+3 /* skip $1$ */,encrypted)==0;
}
int checkpass_sha(const char *pass, const char *encrypted)
{
const char * cipher;
if (!pass || !encrypted) return 0;
/* FIXME - sha1_hash is NOT reentrant */
cipher = sha1_hash(pass);
return strcmp(cipher,encrypted)==0;
}
int changepass_crypt(const char *pass, char *buffer, size_t len)
{
char * cipher;
char salt[3];
if (!pass || !buffer || len<=0) return -1;
salt[0] = 'a' + (char)(rand()%26);
salt[1] = 'a' + (char)((rand()*72+3)%26);
/* FIXME - crypt is NOT reentrant */
cipher = crypt(pass, salt);
strncpy(buffer,cipher,len);
return 0;
}
/** \brief Encrypt password using MD5 and store it into buffer
*/
int changepass_md5(const char *pass, char *buffer, size_t len)
{
const char * cipher;
char randbuffer[16];
if (!pass || !buffer || len<=0) return -1;
_pass_get_random(randbuffer,sizeof(randbuffer));
/* FIXME - md5_crypt is NOT reentrant */
cipher = md5_crypt(pass,randbuffer);
strncpy(buffer,cipher,len);
return 0;
}
/** \brief Encrypt password using SHA and store it into buffer
*/
int changepass_sha(const char *pass, char *buffer, size_t len)
{
const char * cipher;
if (!pass || !buffer || len<=0) return -1;
if (len < strlen(AUTH_SIG_SHA) + SHA1_DIGEST_SIZE) return -1;
strncpy(buffer,AUTH_SIG_SHA,len);
/* FIXME - sha1_hash is NOT reentrant */
cipher = sha1_hash(pass);
strncpy(buffer+strlen(AUTH_SIG_SHA),cipher,len);
return 0;
}
/* first chars of challenge indicate the password form (crypt, md5, etc.) */
int checkpass(const char *user, const char *pass, const char *challenge)
{
if (!user || !pass) return 0;
if (challenge) {
if (strcmp(challenge,"pam")==0)
return checkpass_pam(user,pass);
}
return 0;
}
/* first chars of challenge indicate the password form (crypt, md5, etc.) */
int check_auth(const char *user, const char *data, const char *challenge)
{
if (!user || !challenge) return 0;
if (strncmp(challenge,AUTH_SIG_MD5,strlen(AUTH_SIG_MD5))==0)
return checkpass_md5(data,challenge+strlen(AUTH_SIG_MD5));
if (strncmp(challenge,AUTH_SIG_SHA,strlen(AUTH_SIG_SHA))==0)
return checkpass_sha(data,challenge+strlen(AUTH_SIG_SHA));
if (strncmp(challenge,AUTH_SIG_PAM,strlen(AUTH_SIG_PAM))==0)
return checkpass_pam(user,data);
if (strncmp(challenge,AUTH_SIG_CERT,strlen(AUTH_SIG_CERT))==0)
return check_certificate(user,challenge+strlen(AUTH_SIG_CERT));
if (strncmp(challenge,AUTH_SIG_KRB,strlen(AUTH_SIG_KRB))==0)
return check_krb5(user,challenge+strlen(AUTH_SIG_KRB));
/* in doubt, check for crypt() */
return checkpass_crypt(data,challenge);
return 0;
}
/** \brief Change password when possible.
*
* The first characters of \a pass are used to determine the method. If
* \a buffer is not \a NULL, it is used to write the correct password
* string into the \a userpass field of wzd_user_t .
*
* \return 0 if ok
*/
int changepass(const char *user, const char *pass, char *buffer, size_t len)
{
if (!user) return -1;
if (strncmp(pass,AUTH_SIG_MD5,strlen(AUTH_SIG_MD5))==0)
return changepass_md5(pass+strlen(AUTH_SIG_MD5),buffer,len);
if (strncmp(pass,AUTH_SIG_SHA,strlen(AUTH_SIG_SHA))==0)
return changepass_sha(pass+strlen(AUTH_SIG_SHA),buffer,len);
if (strncmp(pass,AUTH_SIG_PAM,strlen(AUTH_SIG_PAM))==0)
return changepass_pam(user,pass+strlen(AUTH_SIG_PAM),buffer,len);
if (strncmp(pass,AUTH_SIG_CERT,strlen(AUTH_SIG_CERT))==0)
return changepass_cert(pass+strlen(AUTH_SIG_CERT),buffer,len);
/* in doubt, use crypt() */
return changepass_crypt(pass,buffer,len);
return -1;
}
static void _pass_get_random(char *buffer, size_t len)
{
#ifdef HAVE_DEVRANDOM
/** \todo Implement me */
#else
struct {
time_t tv;
} s;
MD5_DIGEST d;
int i;
time(&s.tv);
md5_digest(&s, sizeof(s), d);
for (i=0; i<8; i++)
buffer[i]=itoa64[((unsigned char *)d)[i]];
#endif
}
|
/*
Begin-Doc
Name: debug.c
Description: debug routines
End-Doc
*/
int DEBUG;
char *ARGV0;
|
/* ---------------------------------------------------------------------- *
* commune.h
* This file is part of lincity.
* Lincity is copyright (c) I J Peters 1995-1997, (c) Greg Sharp 1997-2001.
* (c) Corey Keasling, 2004
* ---------------------------------------------------------------------- */
#ifndef __commune_h__
#define __commune_h__
void do_commune(int x, int y);
void mps_commune(int x, int y);
#endif /* __commune_h__ */
|
/*
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*/
//
// MainViewController.h
// VCam
//
// Created by ___FULLUSERNAME___ on ___DATE___.
// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//
#import <Cordova/CDVViewController.h>
#import <Cordova/CDVCommandDelegateImpl.h>
#import <Cordova/CDVCommandQueue.h>
@interface MainViewController : CDVViewController
@end
@interface MainCommandDelegate : CDVCommandDelegateImpl
@end
@interface MainCommandQueue : CDVCommandQueue
@end
|
/*
FLVMeta - FLV Metadata Editor
Copyright (C) 2007-2019 Marc Noirot <marc.noirot AT gmail.com>
This file is part of FLVMeta.
FLVMeta 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.
FLVMeta 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 FLVMeta; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef __DUMP_JSON_H__
#define __DUMP_JSON_H__
#include "flvmeta.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
/* JSON dumping functions */
void dump_json_setup_metadata_dump(flv_parser * parser);
int dump_json_file(flv_parser * parser, const flvmeta_opts * options);
int dump_json_amf_data(const amf_data * data);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __DUMP_JSON_H__ */
|
// Copyright 2013 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include "VideoCommon/VideoCommon.h"
#include "VideoBackends/DX9/D3DUtil.h"
namespace DX9
{
// "Depalletize" means to remove stuff from a wooden pallet.
// "Depalettize" means to convert from a color-indexed image to a direct-color
// image.
class Depalettizer
{
public:
enum InternalPaletteFormat
{
IA = 0,
RGB565,
RGBA8
};
enum BaseType
{
Unorm4 = 0,
Unorm8
};
Depalettizer();
~Depalettizer();
bool Depalettize(LPDIRECT3DTEXTURE9 dstTex, LPDIRECT3DTEXTURE9 baseTex,
BaseType baseType);
void UploadPalette(u32 tlutFmt, void* addr, u32 size);
private:
LPDIRECT3DPIXELSHADER9 GetShader(BaseType type);
InternalPaletteFormat m_PalleteFormat;
LPDIRECT3DTEXTURE9 m_palette_texture[3][2];
LPDIRECT3DTEXTURE9 m_staging_texture[3][2];
// Depalettizing shader for 4-bit indices as normalized float
LPDIRECT3DPIXELSHADER9 m_unorm4Shader;
// Depalettizing shader for 8-bit indices as normalized float
LPDIRECT3DPIXELSHADER9 m_unorm8Shader;
// Depalettizing shader for 16-bit indices as normalized float
LPDIRECT3DPIXELSHADER9 m_unorm16Shader;
u32 m_last_tlutFmt = {};
void* m_last_addr = {};
u32 m_last_size = {};
u64 m_last_hash = {};
};
}
|
/**
* @file op_scu.c
* MPCORE Snoop Control Unit Event Monitor Driver
* @remark Copyright 2004 ARM SMP Development Team
* @remark Copyright 2000-2004 Deepak Saxena <dsaxena@mvista.com>
* @remark Copyright 2000-2004 MontaVista Software Inc
* @remark Copyright 2004 Dave Jiang <dave.jiang@intel.com>
* @remark Copyright 2004 Intel Corporation
* @remark Copyright 2004 Zwane Mwaikambo <zwane@arm.linux.org.uk>
* @remark Copyright 2004 Oprofile Authors
*
* @remark Read the file COPYING
*
* @author Zwane Mwaikambo
*/
#ifndef OP_SCU_H
#define OP_SCU_H
void scu_setup(void);
int scu_start(void);
void scu_stop(void);
#endif
|
#ifndef URLRESOLVER_H
#define URLRESOLVER_H
#include <QtCore>
#include <QtNetwork>
class UrlResolver {
public:
static QUrl resolve(const QUrl &origUrl);
private:
static QNetworkRequest request(const QUrl &url);
};
#endif // URLRESOLVER_H
|
#pragma once
#include "Data.h"
class CCenterDbOper :
public CDbOper
{
public:
CCenterDbOper(void);
virtual ~CCenterDbOper(void);
public:
void SetDBInfo(std::string sDBServer,std::string sDBUser,std::string sDBPwd,std::string sDBName);
BOOL MyConnDB();
BOOL ReadAgentMap(AGENT_ADDRESS_MAP &m_agent_address_map);
BOOL ReadAreaMap(AREA_ADDRESS_MAP &m_area_address_map);
BOOL ReadSLBlackList(SL_BLACK_LIST &m_sl_black_list);
BOOL ReadIpMap(IP_DATA_LIST &_list);
BOOL ReadIpMapMutiThread(IP_DATA_LIST &_list);
private:
DWORD mTotalIpData;
std::string mDBServer;
std::string mDBUser;
std::string mDBPwd;
std::string mDBName;
};
|
#ifndef Renderer_Context_h
#define Renderer_Context_h
#include "RenderState/RenderStateOperations.h"
//#include "../Math/Geometry/GeometryOperations.h"
#include "Buffers/BuffersOperations.h"
#include "VertexArray/VertexArrayOperations.h"
#include "ShaderVertexAttributeCollection.h"
namespace Aurora {
namespace Renderer {
using namespace Aurora::Math::Geometry;
using namespace Aurora::Renderer::Buffers;
using namespace Aurora::Renderer::VertexArray;
enum class ClearBuffers
{
ColorBuffer = 1,
DepthBuffer = 2,
StencilBuffer = 4,
ColorAndDepthBuffer = ColorBuffer | DepthBuffer,
All = ColorBuffer | DepthBuffer | StencilBuffer
};
template<typename Type>
class Context
{
private:
public:
Context() = default;
virtual ~Context() = default;
virtual void MakeCurrent() = 0;
//virtual VertexArray<Type> CreateVertexArray(const Mesh &mesh, SharedShaderVertexAttributeCollection shaderAttributes, BufferHint usageHint);
};
};
};
#endif
|
#ifndef _SPARC64_PAGE_H
#define _SPARC64_PAGE_H
#include <linux/const.h>
#if defined(CONFIG_SPARC64_PAGE_SIZE_8KB)
#define PAGE_SHIFT 13
#elif defined(CONFIG_SPARC64_PAGE_SIZE_64KB)
#define PAGE_SHIFT 16
#else
#error No page size specified in kernel configuration
#endif
#define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT)
#define PAGE_MASK (~(PAGE_SIZE-1))
#if PAGE_SHIFT < 14
#define DCACHE_ALIASING_POSSIBLE
#endif
#if defined(CONFIG_HUGETLB_PAGE_SIZE_4MB)
#define HPAGE_SHIFT 22
#elif defined(CONFIG_HUGETLB_PAGE_SIZE_512K)
#define HPAGE_SHIFT 19
#elif defined(CONFIG_HUGETLB_PAGE_SIZE_64K)
#define HPAGE_SHIFT 16
#endif
#ifdef CONFIG_HUGETLB_PAGE
#define HPAGE_SIZE (_AC(1,UL) << HPAGE_SHIFT)
#define HPAGE_MASK (~(HPAGE_SIZE - 1UL))
#define HUGETLB_PAGE_ORDER (HPAGE_SHIFT - PAGE_SHIFT)
#define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
#endif
#ifndef __ASSEMBLY__
#define WANT_PAGE_VIRTUAL
extern void _clear_page(void *page);
#define clear_page(X) _clear_page((void *)(X))
struct page;
extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page);
#define copy_page(X,Y) memcpy((void *)(X), (void *)(Y), PAGE_SIZE)
extern void copy_user_page(void *to, void *from, unsigned long vaddr, struct page *topage);
#define STRICT_MM_TYPECHECKS
#ifdef STRICT_MM_TYPECHECKS
/* These are used to make use of C type-checking.. */
typedef struct { unsigned long pte; } pte_t;
typedef struct { unsigned long iopte; } iopte_t;
typedef struct { unsigned int pmd; } pmd_t;
typedef struct { unsigned int pgd; } pgd_t;
typedef struct { unsigned long pgprot; } pgprot_t;
#define pte_val(x) ((x).pte)
#define iopte_val(x) ((x).iopte)
#define pmd_val(x) ((x).pmd)
#define pgd_val(x) ((x).pgd)
#define pgprot_val(x) ((x).pgprot)
#define __pte(x) ((pte_t) { (x) } )
#define __iopte(x) ((iopte_t) { (x) } )
#define __pmd(x) ((pmd_t) { (x) } )
#define __pgd(x) ((pgd_t) { (x) } )
#define __pgprot(x) ((pgprot_t) { (x) } )
#else
/* .. while these make it easier on the compiler */
typedef unsigned long pte_t;
typedef unsigned long iopte_t;
typedef unsigned int pmd_t;
typedef unsigned int pgd_t;
typedef unsigned long pgprot_t;
#define pte_val(x) (x)
#define iopte_val(x) (x)
#define pmd_val(x) (x)
#define pgd_val(x) (x)
#define pgprot_val(x) (x)
#define __pte(x) (x)
#define __iopte(x) (x)
#define __pmd(x) (x)
#define __pgd(x) (x)
#define __pgprot(x) (x)
#endif /* (STRICT_MM_TYPECHECKS) */
typedef struct page *pgtable_t;
#define TASK_UNMAPPED_BASE (test_thread_flag(TIF_32BIT) ? \
(_AC(0x0000000070000000,UL)) : \
(_AC(0xfffff80000000000,UL) + (1UL << 32UL)))
#include <asm-generic/memory_model.h>
#endif /* !(__ASSEMBLY__) */
#define PAGE_OFFSET _AC(0xFFFFF80000000000,UL)
#ifndef __ASSEMBLY__
#define __pa(x) ((unsigned long)(x) - PAGE_OFFSET)
#define __va(x) ((void *)((unsigned long) (x) + PAGE_OFFSET))
#define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT)
#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr)>>PAGE_SHIFT)
#define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
#define virt_to_phys __pa
#define phys_to_virt __va
#endif /* !(__ASSEMBLY__) */
#define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \
VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
#include <asm-generic/getorder.h>
#endif /* _SPARC64_PAGE_H */
|
/*
* This file is part of the libpayload project.
*
* Copyright (c) 2012 The Chromium OS Authors.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#ifndef _ENDIAN_H_
#define _ENDIAN_H_
#include <arch/io.h>
#include <arch/types.h>
#include <libpayload-config.h>
static inline uint16_t swap_bytes16(uint16_t in)
{
return ((in & 0xFF) << 8) | ((in & 0xFF00) >> 8);
}
static inline uint32_t swap_bytes32(uint32_t in)
{
return ((in & 0xFF) << 24) | ((in & 0xFF00) << 8) |
((in & 0xFF0000) >> 8) | ((in & 0xFF000000) >> 24);
}
static inline uint64_t swap_bytes64(uint64_t in)
{
return ((uint64_t)swap_bytes32((uint32_t)in) << 32) |
((uint64_t)swap_bytes32((uint32_t)(in >> 32)));
}
/* Endian functions from glibc 2.9 / BSD "endian.h" */
#if CONFIG(LP_BIG_ENDIAN)
#define htobe16(in) (in)
#define htobe32(in) (in)
#define htobe64(in) (in)
#define htole16(in) swap_bytes16(in)
#define htole32(in) swap_bytes32(in)
#define htole64(in) swap_bytes64(in)
#elif CONFIG(LP_LITTLE_ENDIAN)
#define htobe16(in) swap_bytes16(in)
#define htobe32(in) swap_bytes32(in)
#define htobe64(in) swap_bytes64(in)
#define htole16(in) (in)
#define htole32(in) (in)
#define htole64(in) (in)
#else
#error Cant tell if the CPU is little or big endian.
#endif /* CONFIG_*_ENDIAN */
#define be16toh(in) htobe16(in)
#define be32toh(in) htobe32(in)
#define be64toh(in) htobe64(in)
#define le16toh(in) htole16(in)
#define le32toh(in) htole32(in)
#define le64toh(in) htole64(in)
#define htonw(in) htobe16(in)
#define htonl(in) htobe32(in)
#define htonll(in) htobe64(in)
#define ntohw(in) be16toh(in)
#define ntohl(in) be32toh(in)
#define ntohll(in) be64toh(in)
/*
* Alignment-agnostic encode/decode bytestream to/from little/big endian.
*/
static inline uint16_t be16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[0] << 8) | p[1]);
}
static inline uint32_t be32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return (((unsigned)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
}
static inline uint16_t le16dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[1] << 8) | p[0]);
}
static inline uint32_t le32dec(const void *pp)
{
uint8_t const *p = (uint8_t const *)pp;
return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]);
}
static inline void bebitenc(void *pp, uint32_t u, uint8_t b)
{
uint8_t *p = (uint8_t *)pp;
int i;
for (i = 0; i < b; i++)
p[(b - 1) - i] = (u >> i*8) & 0xFF;
}
static inline void be16enc(void *pp, uint16_t u)
{
bebitenc(pp, u, 2);
}
static inline void be32enc(void *pp, uint32_t u)
{
bebitenc(pp, u, 4);
}
static inline void lebitenc(void *pp, uint32_t u, uint8_t b)
{
uint8_t *p = (uint8_t *)pp;
int i;
for (i = 0; i < b; i++)
p[i] = (u >> i*8) & 0xFF;
}
static inline void le16enc(void *pp, uint16_t u)
{
lebitenc(pp, u, 2);
}
static inline void le32enc(void *pp, uint32_t u)
{
lebitenc(pp, u, 4);
}
/* Deprecated names (not in glibc / BSD) */
#define htobew(in) htobe16(in)
#define htobel(in) htobe32(in)
#define htobell(in) htobe64(in)
#define htolew(in) htole16(in)
#define htolel(in) htole32(in)
#define htolell(in) htole64(in)
#define betohw(in) be16toh(in)
#define betohl(in) be32toh(in)
#define betohll(in) be64toh(in)
#define letohw(in) le16toh(in)
#define letohl(in) le32toh(in)
#define letohll(in) le64toh(in)
/* Handy bit manipulation macros */
#define clrsetbits_le32(addr, clear, set) writel(htole32((le32toh(readl(addr)) \
& ~(clear)) | (set)), (addr))
#define setbits_le32(addr, set) writel(htole32(le32toh(readl(addr)) \
| (set)), (addr))
#define clrbits_le32(addr, clear) writel(htole32(le32toh(readl(addr)) \
& ~(clear)), (addr))
#define clrsetbits_be32(addr, clear, set) writel(htobe32((be32toh(readl(addr)) \
& ~(clear)) | (set)), (addr))
#define setbits_be32(addr, set) writel(htobe32(be32toh(readl(addr)) \
| (set)), (addr))
#define clrbits_be32(addr, clear) writel(htobe32(be32toh(readl(addr)) \
& ~(clear)), (addr))
#endif /* _ENDIAN_H_ */
|
/*
* Interrupts_XPlained.h
*
* Created: 26.10.2014 16:01:24
* Author: InfangerIvo
*/
#ifndef INTERRUPTS_XPLAINED_H_
#define INTERRUPTS_XPLAINED_H_
#include "Globals.h"
#endif /* INTERRUPTS_XPLAINED_H_ */
|
#ifndef DOTCONFPP_H
#define DOTCONFPP_H
#include <list>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifdef WIN32
#define PATH_MAX _MAX_PATH
#define snprintf _snprintf
#define strcasecmp stricmp
#define realpath(path,resolved_path) _fullpath(resolved_path, path, _MAX_PATH)
#include <io.h>
#else
#include <unistd.h>
#include <limits.h>
#include <stdint.h>
#include <strings.h>
#endif
#include "mempool.h"
class DOTCONFDocument;
class DOTCONFDocumentNode
{
friend class DOTCONFDocument;
private:
DOTCONFDocumentNode * previousNode;
DOTCONFDocumentNode * nextNode;
DOTCONFDocumentNode * parentNode;
DOTCONFDocumentNode * childNode;
char ** values;
int valuesCount;
char * name;
const DOTCONFDocument * document;
int lineNum;
char * fileName;
bool closed;
void pushValue(char * _value);
public:
DOTCONFDocumentNode();
~DOTCONFDocumentNode();
const char * getConfigurationFileName()const { return fileName; }
int getConfigurationLineNumber() const { return lineNum; }
const DOTCONFDocumentNode * getNextNode() const { return nextNode; }
const DOTCONFDocumentNode * getPreviuosNode() const { return previousNode; }
const DOTCONFDocumentNode * getParentNode() const { return parentNode; }
const DOTCONFDocumentNode * getChildNode() const { return childNode; }
const char* getValue(int index = 0) const;
const char * getName() const { return name; }
const DOTCONFDocument * getDocument() const { return document; }
};
class DOTCONFDocument
{
public:
enum CaseSensitive { CASESENSETIVE, CASEINSENSETIVE };
protected:
AsyncDNSMemPool * mempool;
private:
DOTCONFDocumentNode * curParent;
DOTCONFDocumentNode * curPrev;
int curLine;
bool quoted;
std::list<DOTCONFDocumentNode*> nodeTree;
std::list<char*> requiredOptions;
std::list<char*> processedFiles;
FILE * file;
char * fileName;
std::list<char*> words;
int (*cmp_func)(const char *, const char *);
int checkRequiredOptions();
int parseLine();
int parseFile(DOTCONFDocumentNode * _parent = NULL);
int checkConfig(const std::list<DOTCONFDocumentNode*>::iterator & from);
int cleanupLine(char * line);
char * getSubstitution(char * macro, int lineNum);
int macroSubstitute(DOTCONFDocumentNode * tagNode, int valueIndex);
protected:
virtual void error(int lineNum, const char * fileName, const char * fmt, ...);
public:
DOTCONFDocument(CaseSensitive caseSensitivity = CASESENSETIVE);
virtual ~DOTCONFDocument();
int setContent(const char * _fileName);
void setRequiredOptionNames(const char ** requiredOptionNames);
const DOTCONFDocumentNode * getFirstNode() const;
const DOTCONFDocumentNode * findNode(const char * nodeName, const DOTCONFDocumentNode * parentNode = NULL, const DOTCONFDocumentNode * startNode = NULL) const;
};
#endif
|
/*
* Authors: James LewisMoss <jlm@racemi.com>
*
* Copyright (c) 2006 Racemi 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifndef RREGADMIN_UTIL_INTUTILS_H
#define RREGADMIN_UTIL_INTUTILS_H 1
#include <glib/gtypes.h>
#include <glib/garray.h>
#include <rregadmin/util/macros.h>
#include <rregadmin/util/ustring.h>
G_BEGIN_DECLS
/** Convert a string into a signed 8 bit integer.
*
* @param in_str the string to convert. It must contain only leading and
* trailing whitespace and the digits for the number.
* @param out_val Where the value parsed is placed. If an error occurs
* this variable will remain unchanged. This MUST
* point to a valid location.
* @return whether the function succeeded.
*
* @ingroup util_group
*/
gboolean str_to_gint8(const char *in_str, gint8 *out_val);
/** Convert a string into a signed 16 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_gint16(const char *in_str, gint16 *out_val);
/** Convert a string into a signed 32 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_gint32(const char *in_str, gint32 *out_val);
/** Convert a string into a signed 64 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_gint64(const char *in_str, gint64 *out_val);
/** Convert a string into a unsigned 8 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_guint8(const char *in_str, guint8 *out_val);
/** Convert a string into a unsigned 16 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_guint16(const char *in_str, guint16 *out_val);
/** Convert a string into a unsigned 32 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_guint32(const char *in_str, guint32 *out_val);
/** Convert a string into a unsigned 64 bit integer.
*
* @see str_to_gint8
*
* @ingroup util_group
*/
gboolean str_to_guint64(const char *in_str, guint64 *out_val);
G_END_DECLS
#endif // RREGADMIN_UTIL_INTUTILS_H
|
/****************************************************************************
* Copyright (C) 2012 by Jens Nissen jens-chessx@gmx.net *
****************************************************************************/
#ifndef __ECOTHREAD_H__
#define __ECOTHREAD_H__
#include <QThread>
#include "game.h"
/** @ingroup GUI
A small little class to handle loading of the ECO file for the
mainwindow */
class EcoThread : public QThread
{
Q_OBJECT
public:
EcoThread() {};
void run()
{
bool ok = true;
ok |= Game::loadEcoFile(":chessx.eco");
ok |= Board::loadEcoFile(":chessx.gtm");
emit loaded(this, ok);
};
signals:
void loaded(QObject*, bool);
};
#endif // __ECOTHREAD_H__
|
/* (C) IT Sky Consulting GmbH 2014
* http://www.it-sky-consulting.com/
* Author: Karl Brodowsky
* Date: 2014-02-27
* License: GPL v2 (See https://de.wikipedia.org/wiki/GNU_General_Public_License )
*/
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <termios.h>
#include <unistd.h>
#include <itskylib.h>
void usage(char *argv0, char *msg) {
printf("%s\n", msg);
printf("Usage:\n\n");
printf("%s file1 file2 file3 ... filen\n", argv0);
printf(" reads each file and creates an array of strings from the file in the order read, separating strings by sequences of control characters or spaces\n\n");
exit(1);
}
int main(int argc, char *argv[]) {
if (argc >= 2 && strcmp(argv[1], "-h") == 0) {
usage(argv[0], "");
}
for (int i = 1; i < argc; i++) {
int fd = open(argv[i], O_RDONLY);
struct string_array result = read_to_array(fd);
close(fd);
printf("------------------------------------------------------------\n");
printf("file=%s %d strings\n", argv[i], result.len);
printf("------------------------------------------------------------\n");
for (int j = 0; j < result.len; j++) {
printf("%4d: \"%s\"\n", j, result.strings[j]);
}
printf("------------------------------------------------------------\n\n");
}
}
|
/*
* This source code is a part of coLinux source package.
*
* Dan Aloni <da-x@colinux.org>, 2003 (c)
*
* The code is licensed under the GPL. See the COPYING file at
* the root directory.
*/
#ifndef __CO_KERNEL_QUEUE_H__
#define __CO_KERNEL_QUEUE_H__
#include "list.h"
#include "common.h"
typedef struct co_queue_item {
co_list_t node;
unsigned char data[];
} co_queue_item_t;
typedef struct co_queue {
co_list_t head;
long items_count;
} co_queue_t;
/**
* init a user-allocated queue.
*/
extern co_rc_t co_queue_init(co_queue_t *queue);
/**
* free all the queue items (allocated using co_queue_malloc*()).
*/
extern co_rc_t co_queue_flush(co_queue_t *queue);
/**
* return the number of items in the queue.
*/
static inline uintptr_t co_queue_size(co_queue_t *queue)
{ return queue->items_count; }
/**
* add an item (allocated by co_queue_malloc*()) to the queue, as
* the head position.
*/
extern void co_queue_add_head(co_queue_t *queue, void *ptr);
/**
* add an item (allocated by co_queue_malloc*()) to the queue, as
* the tail position.
*/
extern void co_queue_add_tail(co_queue_t *queue, void *ptr);
/**
* get the item at the tail but do not remove it.
*/
extern co_rc_t co_queue_get_tail(co_queue_t *queue, void **ptr);
/**
* get the previous item in the queue (or NULL if we reached the head)
*/
extern co_rc_t co_queue_get_prev(co_queue_t *queue, void **ptr);
/**
* removes an item from the tail and returns a pointer to it.
*/
extern co_rc_t co_queue_pop_tail(co_queue_t *queue, void **ptr);
/**
* only peeks at an item from the tail and returns a pointer to it.
*/
extern co_rc_t co_queue_peek_tail(co_queue_t *queue, void **ptr);
/**
* frees a buffer allocated by co_queue_malloc*().
*/
extern co_rc_t co_queue_free(co_queue_t *queue, void *ptr);
/**
* allocate a queue item.
*/
extern co_rc_t co_queue_malloc(co_queue_t *queue, long bytes, void **ptr);
/**
* allocate a queue item as a copy of a given buffer.
*/
extern co_rc_t co_queue_malloc_copy(co_queue_t *queue, void *fromptr, long bytes, void **ptr);
#endif
|
#ifndef _MENU_GEAR_H_
#define _MENU_GEAR_H_
#include "uiuc_aircraft.h"
#include "uiuc_convert.h"
#include "uiuc_1DdataFileReader.h"
#include "uiuc_2DdataFileReader.h"
#include "uiuc_menu_functions.h"
#include <FDM/LaRCsim/ls_generic.h>
#include <FDM/LaRCsim/ls_cockpit.h> /* Long_trim defined */
#include <FDM/LaRCsim/ls_constants.h> /* INVG defined */
void parse_gear( const string& linetoken2, const string& linetoken3,
const string& linetoken4, const string& linetoken5,
const string& linetoken6, const string& linetoken7,
const string& linetoken8, const string& linetoken9,
const string& linetoken10, const string& aircraft_directory,
LIST command_line );
#endif //_MENU_GEAR_H_
|
// -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
#ifndef VEGASTRIKE_CMD_AI_AUTODOCKING_H
#define VEGASTRIKE_CMD_AI_AUTODOCKING_H
#include <deque>
#include <boost/shared_ptr.hpp>
#include "cmd/ai/order.h"
#include "gfx/vec.h"
class Unit;
namespace Orders
{
// Navigate the player to the closest auto-dockable port.
//
// If the station is too far away, the normal auto pilot will move the player
// to the station.
//
// An auto-dockable port may have a row of waypoints associated with it. This
// order will face and move towards the first waypoint. When this is reached,
// it will face and move towards the next waypoint, and so on until the docking
// port is reached.
//
// When the docking port is reached the player is docked at the station.
//
// Pre-condition:
// o A station has been selected.
// o Docking clearance has been obtained.
// o The station has at least one docking port that is auto-dockable, available,
// and big enough to fit the player.
// o The nearest available docking port must be in line-of-sight.
//
// Post-condition:
// o One of
// - The player has been docked.
// - No suitable docking port is available.
// - The player or the station has been destroyed.
//
// Limitations:
// o The player moves directly towards the first waypoint. If the station is
// between the player and the waypoint, the player will collide with the
// station.
// o If auto-docking is disengaged after travelling through a couple of
// waypoints and then re-engaged, then the player will start by moving directly
// towards the first waypoint.
// o The player cannot auto-dock on capital ships. It cannot handle moving
// stations, and it does not request clearance at fixed intervals to prevent
// the capital ship from moving away.
// o Cannot dock capital ships. A capital ship must align one of its docking
// ports with one of the station's docking ports to dock, and this order does
// not do that.
class AutoDocking : public Order
{
typedef void (AutoDocking::*StateFunction)(Unit *, Unit *);
public:
typedef std::deque<int> DockingPath;
AutoDocking(Unit *destination);
void Execute();
static bool CanDock(Unit *player, Unit *station);
protected:
// States
void InitialState(Unit *player, Unit *station);
void SelectionState(Unit *, Unit *);
void ApproachState(Unit *, Unit *);
void DockingState(Unit *, Unit *);
void DockedState(Unit *, Unit *);
void UndockingState(Unit *, Unit *);
void DepartureState(Unit *, Unit *);
void AbortState(Unit *, Unit *);
void EndState(Unit *, Unit *);
void EnqueuePort(Unit *, Unit *, size_t);
void EraseOrders();
private:
StateFunction state;
UnitContainer target;
// waypoints followed by docking port (back)
DockingPath dockingPath;
};
} // namespace Orders
#endif
|
/*
* File : listctrl.h
* This file is part of RTGUI in RT-Thread RTOS
* COPYRIGHT (C) 2010, 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
* 2010-12-06 Bernard first version
*/
#ifndef __RTGUI_LISTCTRL_H__
#define __RTGUI_LISTCTRL_H__
#include <rtgui/rtgui.h>
#include <rtgui/image.h>
#include <rtgui/rtgui_system.h>
#include <rtgui/widgets/widget.h>
/** Gets the type of a list ctrl */
#define RTGUI_LISTCTRL_TYPE (rtgui_listctrl_type_get())
/** Casts the object to a filelist */
#define RTGUI_LISTCTRL(obj) (RTGUI_OBJECT_CAST((obj), RTGUI_LISTCTRL_TYPE, rtgui_listctrl_t))
/** Checks if the object is a filelist ctrl */
#define RTGUI_IS_LISTCTRL(obj) (RTGUI_OBJECT_CHECK_TYPE((obj), RTGUI_LISTCTRL_TYPE))
struct rtgui_listctrl
{
struct rtgui_widget parent;
/* widget private data */
/* listctrl items */
rt_uint32_t items;
/* total number of items */
rt_uint16_t items_count;
/* the number of item in a page */
rt_uint16_t page_items;
/* current item */
rt_uint16_t current_item;
/* item event handler */
void (*on_item)(rtgui_widget_t *widget, struct rtgui_event* event);
void (*on_item_draw)(struct rtgui_listctrl *list, struct rtgui_dc* dc, rtgui_rect_t* rect, rt_uint16_t index);
};
typedef struct rtgui_listctrl rtgui_listctrl_t;
typedef void (*rtgui_onitem_func_t)(struct rtgui_widget* widget, rtgui_event_t *event);
typedef void (*rtgui_onitem_draw_t)(struct rtgui_listctrl *list, struct rtgui_dc* dc, rtgui_rect_t* rect, rt_uint16_t index);
rtgui_type_t *rtgui_listctrl_type_get(void);
rtgui_listctrl_t* rtgui_listctrl_create(rt_uint32_t items, rt_uint16_t count,
rtgui_rect_t *rect, rtgui_onitem_draw_t ondraw);
void rtgui_listctrl_destroy(rtgui_listctrl_t* ctrl);
rt_bool_t rtgui_listctrl_event_handler(struct rtgui_widget* widget, struct rtgui_event* event);
void rtgui_listctrl_set_onitem(rtgui_listctrl_t* ctrl, rtgui_onitem_func_t func);
void rtgui_listctrl_set_items(rtgui_listctrl_t* ctrl, rt_uint32_t items, rt_uint16_t count);
rt_bool_t rtgui_listctrl_get_item_rect(rtgui_listctrl_t* ctrl, rt_uint16_t item, rtgui_rect_t* item_rect);
#endif
|
// Copyright 2010 Google Inc. All Rights Reserved.
// Use of this source code is governed by a BSD-style license
#ifndef WEBP_DEC_VP8I_H_
#define WEBP_DEC_VP8I_H_
#include <string.h>
#include "./vp8li.h"
#include "../utils/bit_reader.h"
#include "../utils/thread.h"
#include "../dsp/dsp.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
#endif
#define DEC_MAJ_VERSION 0
#define DEC_MIN_VERSION 3
#define DEC_REV_VERSION 1
#define ONLY_KEYFRAME_CODE
enum { B_DC_PRED = 0,
B_TM_PRED,
B_VE_PRED,
B_HE_PRED,
B_RD_PRED,
B_VR_PRED,
B_LD_PRED,
B_VL_PRED,
B_HD_PRED,
B_HU_PRED,
NUM_BMODES = B_HU_PRED + 1 - B_DC_PRED,
DC_PRED = B_DC_PRED, V_PRED = B_VE_PRED,
H_PRED = B_HE_PRED, TM_PRED = B_TM_PRED,
B_PRED = NUM_BMODES,
B_DC_PRED_NOTOP = 4,
B_DC_PRED_NOLEFT = 5,
B_DC_PRED_NOTOPLEFT = 6,
NUM_B_DC_MODES = 7 };
enum { MB_FEATURE_TREE_PROBS = 3,
NUM_MB_SEGMENTS = 4,
NUM_REF_LF_DELTAS = 4,
NUM_MODE_LF_DELTAS = 4,
MAX_NUM_PARTITIONS = 8,
NUM_TYPES = 4,
NUM_BANDS = 8,
NUM_CTX = 3,
NUM_PROBAS = 11,
NUM_MV_PROBAS = 19 };
#define BPS 32
#define YUV_SIZE (BPS * 17 + BPS * 9)
#define Y_SIZE (BPS * 17)
#define Y_OFF (BPS * 1 + 8)
#define U_OFF (Y_OFF + BPS * 16 + BPS)
#define V_OFF (U_OFF + 16)
typedef struct {
uint8_t key_frame_;
uint8_t profile_;
uint8_t show_;
uint32_t partition_length_;
} VP8FrameHeader;
typedef struct {
uint16_t width_;
uint16_t height_;
uint8_t xscale_;
uint8_t yscale_;
uint8_t colorspace_;
uint8_t clamp_type_;
} VP8PictureHeader;
typedef struct {
int use_segment_;
int update_map_;
int absolute_delta_;
int8_t quantizer_[NUM_MB_SEGMENTS];
int8_t filter_strength_[NUM_MB_SEGMENTS];
} VP8SegmentHeader;
typedef struct {
uint8_t segments_[MB_FEATURE_TREE_PROBS];
uint8_t coeffs_[NUM_TYPES][NUM_BANDS][NUM_CTX][NUM_PROBAS];
#ifndef ONLY_KEYFRAME_CODE
uint8_t ymode_[4], uvmode_[3];
uint8_t mv_[2][NUM_MV_PROBAS];
#endif
} VP8Proba;
typedef struct {
int simple_;
int level_;
int sharpness_;
int use_lf_delta_;
int ref_lf_delta_[NUM_REF_LF_DELTAS];
int mode_lf_delta_[NUM_MODE_LF_DELTAS];
} VP8FilterHeader;
typedef struct {
unsigned int f_level_:6;
unsigned int f_ilevel_:6;
unsigned int f_inner_:1;
} VP8FInfo;
typedef struct {
unsigned int nz_:24;
unsigned int dc_nz_:1;
unsigned int skip_:1;
} VP8MB;
typedef int quant_t[2];
typedef struct {
quant_t y1_mat_, y2_mat_, uv_mat_;
} VP8QuantMatrix;
typedef struct {
int id_;
int mb_y_;
int filter_row_;
VP8FInfo* f_info_;
VP8Io io_;
} VP8ThreadContext;
struct VP8Decoder {
VP8StatusCode status_;
int ready_;
const char* error_msg_;
VP8BitReader br_;
VP8FrameHeader frm_hdr_;
VP8PictureHeader pic_hdr_;
VP8FilterHeader filter_hdr_;
VP8SegmentHeader segment_hdr_;
WebPWorker worker_;
int use_threads_;
int cache_id_;
int num_caches_;
VP8ThreadContext thread_ctx_;
int mb_w_, mb_h_;
int tl_mb_x_, tl_mb_y_;
int br_mb_x_, br_mb_y_;
int num_parts_;
VP8BitReader parts_[MAX_NUM_PARTITIONS];
uint32_t buffer_flags_;
VP8QuantMatrix dqm_[NUM_MB_SEGMENTS];
VP8Proba proba_;
int use_skip_proba_;
uint8_t skip_p_;
#ifndef ONLY_KEYFRAME_CODE
uint8_t intra_p_, last_p_, golden_p_;
VP8Proba proba_saved_;
int update_proba_;
#endif
uint8_t* intra_t_;
uint8_t intra_l_[4];
uint8_t* y_t_;
uint8_t* u_t_, *v_t_;
VP8MB* mb_info_;
VP8FInfo* f_info_;
uint8_t* yuv_b_;
int16_t* coeffs_;
uint8_t* cache_y_;
uint8_t* cache_u_;
uint8_t* cache_v_;
int cache_y_stride_;
int cache_uv_stride_;
void* mem_;
size_t mem_size_;
int mb_x_, mb_y_;
uint8_t is_i4x4_;
uint8_t imodes_[16];
uint8_t uvmode_;
uint8_t segment_;
uint32_t non_zero_;
uint32_t non_zero_ac_;
int filter_type_;
int filter_row_;
VP8FInfo fstrengths_[NUM_MB_SEGMENTS][2];
const uint8_t* alpha_data_;
size_t alpha_data_size_;
int is_alpha_decoded_;
uint8_t* alpha_plane_;
int layer_colorspace_;
const uint8_t* layer_data_;
size_t layer_data_size_;
};
int VP8SetError(VP8Decoder* const dec,
VP8StatusCode error, const char* const msg);
void VP8ResetProba(VP8Proba* const proba);
void VP8ParseProba(VP8BitReader* const br, VP8Decoder* const dec);
void VP8ParseIntraMode(VP8BitReader* const br, VP8Decoder* const dec);
void VP8ParseQuant(VP8Decoder* const dec);
int VP8InitFrame(VP8Decoder* const dec, VP8Io* io);
void VP8ReconstructBlock(VP8Decoder* const dec);
VP8StatusCode VP8EnterCritical(VP8Decoder* const dec, VP8Io* const io);
int VP8ExitCritical(VP8Decoder* const dec, VP8Io* const io);
int VP8ProcessRow(VP8Decoder* const dec, VP8Io* const io);
void VP8InitScanline(VP8Decoder* const dec);
int VP8DecodeMB(VP8Decoder* const dec, VP8BitReader* const token_br);
const uint8_t* VP8DecompressAlphaRows(VP8Decoder* const dec,
int row, int num_rows);
int VP8DecodeLayer(VP8Decoder* const dec);
#if defined(__cplusplus) || defined(c_plusplus)
}
#endif
#endif
|
#ifndef AUTO_CONNECT_SCREEN_H
#define AUTO_CONNECT_SCREEN_H
#include "gui/gui2_canvas.h"
#include "playerInfo.h"
class GuiLabel;
class GuiOverlay;
class AutoConnectScreen : public GuiCanvas, public Updatable
{
GuiOverlay* screen_connect;
P<ServerScanner> scanner;
sf::IpAddress connect_to_address;
ECrewPosition crew_position;
bool control_main_screen;
int auto_mainscreen;
std::map<string, string> ship_filters;
GuiLabel* status_label;
GuiLabel* filter_label;
public:
AutoConnectScreen(ECrewPosition crew_position, int auto_mainscreen, bool control_main_screen, string ship_filter);
virtual ~AutoConnectScreen();
virtual void update(float delta);
private:
bool isValidShip(int index);
void connectToShip(int index);
};
#endif//AUTO_CONNECT_SCREEN_H
|
/* pcapio.h
* Declarations of our own routins for writing libpcap files.
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* Derived from code in the Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
*
* 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.
*/
/** Returns a FILE * to write to on success, NULL on failure */
extern FILE *
libpcap_fdopen(int fd, int *err);
/** Write the file header to a dump file.
Returns TRUE on success, FALSE on failure.
Sets "*err" to an error code, or 0 for a short write, on failure*/
extern gboolean
libpcap_write_file_header(FILE *fp, int linktype, int snaplen, gboolean ts_nsecs, long *bytes_written, int *err);
/** Write a record for a packet to a dump file.
Returns TRUE on success, FALSE on failure. */
extern gboolean
libpcap_write_packet(FILE *fp, const struct pcap_pkthdr *phdr, const u_char *pd,
long *bytes_written, int *err);
/** Write a section header block (SHB)
*
*/
extern gboolean
libpcap_write_session_header_block(FILE *fp, /**< File pointer */
const char *comment, /**< Comment on the section, Optinon 1 opt_comment
* A UTF-8 string containing a comment that is associated to the current block.
*/
const char *hw, /**< HW, Optinon 2 shb_hardware
* An UTF-8 string containing the description of the hardware used to create this section.
*/
const char *os, /**< Operating system name, Optinon 3 shb_os
* An UTF-8 string containing the name of the operating system used to create this section.
*/
const char *appname, /**< Application name, Optinon 4 shb_userappl
* An UTF-8 string containing the name of the application used to create this section.
*/
guint64 section_length,
long *bytes_written,
int *err);
extern gboolean
libpcap_write_interface_description_block(FILE *fp,
const char *comment, /* OPT_COMMENT 1 */
const char *name, /* IDB_NAME 2 */
const char *descr, /* IDB_DESCRIPTION 3 */
const char *filter, /* IDB_FILTER 11 */
const char *os, /* IDB_OS 12 */
int link_type,
int snap_len,
long *bytes_written,
guint64 if_speed, /* IDB_IF_SPEED 8 */
guint8 tsresol, /* IDB_TSRESOL 9 */
int *err);
extern gboolean
libpcap_write_interface_statistics_block(FILE *fp,
guint32 interface_id,
pcap_t *pd,
long *bytes_written,
const char *comment, /* OPT_COMMENT 1 */
guint64 isb_starttime, /* ISB_STARTTIME 2 */
guint64 isb_endtime, /* ISB_ENDTIME 3 */
int *err);
extern gboolean
libpcap_write_enhanced_packet_block(FILE *fp,
const struct pcap_pkthdr *phdr,
guint32 interface_id,
guint ts_mul,
const u_char *pd,
long *bytes_written,
int *err);
extern gboolean
libpcap_dump_flush(FILE *pd, int *err);
extern gboolean
libpcap_dump_close(FILE *pd, int *err);
|
/** $lic$
* Copyright (C) 2012-2014 by Massachusetts Institute of Technology
* Copyright (C) 2010-2013 by The Board of Trustees of Stanford University
*
* This file is part of zsim.
*
* zsim 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.
*
* If you use this software in your research, we request that you reference
* the zsim paper ("ZSim: Fast and Accurate Microarchitectural Simulation of
* Thousand-Core Systems", Sanchez and Kozyrakis, ISCA-40, June 2013) as the
* source of the simulator in any publications that use this software, and that
* you send us a citation of your work.
*
* zsim 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/>.
*/
/* General logging/info/warn/panic routines */
#ifndef LOG_H_
#define LOG_H_
#include <stdio.h>
#include <stdlib.h>
void __log_lock();
void __log_unlock();
#ifdef MT_SAFE_LOG
#define log_lock() __log_lock()
#define log_unlock() __log_unlock()
#else
#define log_lock()
#define log_unlock()
#endif
#define PANIC_EXIT_CODE (112)
// assertions are often frequently executed but never inlined. Might as well tell the compiler about it
#define likely(x) __builtin_expect((x), 1)
#define unlikely(x) __builtin_expect((x), 0)
typedef enum {
LOG_Harness,
LOG_Config,
LOG_Process,
LOG_Cache,
LOG_Mem,
LOG_Sched,
LOG_FSVirt,
LOG_TimeVirt,
} LogType;
// defined in log.cpp
extern const char* logTypeNames[];
extern const char* logHeader;
extern FILE* logFdOut;
extern FILE* logFdErr;
/* Set per-process header for log/info/warn/panic messages
* Calling this is not needed (the default header is ""),
* but it helps in multi-process runs
* If file is NULL or InitLog is not called, logs to stdout/stderr
*/
void InitLog(const char* header, const char* file = NULL);
#define panic(args...) \
{ \
fprintf(logFdErr, "%sPanic on %s:%d: ", logHeader, __FILE__, __LINE__); \
fprintf(logFdErr, args); \
fprintf(logFdErr, "\n"); \
fflush(logFdErr); \
/**reinterpret_cast<int*>(0L) = 42;*/ /*SIGSEGVs*/ \
exit(PANIC_EXIT_CODE); \
}
#define warn(args...) \
{ \
log_lock(); \
fprintf(logFdErr, "%sWARN: ", logHeader); \
fprintf(logFdErr, args); \
fprintf(logFdErr, "\n"); \
fflush(logFdErr); \
log_unlock(); \
}
#define info(args...) \
{ \
log_lock(); \
fprintf(logFdOut, "%s", logHeader); \
fprintf(logFdOut, args); \
fprintf(logFdOut, "\n"); \
fflush(logFdOut); \
log_unlock(); \
}
/* I would call these macros log, but there's this useless math function
* that happens to conflict with this...
*/
/* FIXME: Better conditional tracing (e.g., via mask) */
#ifdef _LOG_TRACE_
#define trace(type, args...) \
{ \
if ( LOG_##type == LOG_Sched) { \
log_lock(); \
fprintf(logFdErr, "%sLOG(%s): ", logHeader, logTypeNames[(int) LOG_##type]); \
fprintf(logFdErr, args); \
fprintf(logFdErr, "\n"); \
fflush(logFdErr); \
log_unlock(); \
} \
}
#else
#define trace(type, args...)
#endif
#ifndef NASSERT
#define assert(cond) \
if (unlikely(!(cond))) { \
fprintf(logFdErr, "%sFailed assertion on %s:%d\n", logHeader, __FILE__, __LINE__); \
fflush(logFdErr); \
*reinterpret_cast<int*>(0L) = 42; /*SIGSEGVs*/ \
exit(1); \
};
#define assert_msg(cond, args...) \
if (unlikely(!(cond))) { \
fprintf(logFdErr, "%sFailed assertion on %s:%d: ", logHeader, __FILE__, __LINE__); \
fprintf(logFdErr, args); \
fprintf(logFdErr, "\n"); \
fflush(logFdErr); \
*reinterpret_cast<int*>(0L) = 42; /*SIGSEGVs*/ \
exit(1); \
};
#else
// Avoid unused warnings, never emit any code
// see http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
#define assert(cond) do { (void)sizeof(cond); } while (0);
#define assert_msg(cond, args...) do { (void)sizeof(cond); } while (0);
#endif
#define checkpoint() \
do { \
info("%s:%d %s", __FILE__, __LINE__, __FUNCTION__); \
} while (0)
#endif // LOG_H_
|
/*
* Copyright (C) 2002-2020 The DOSBox Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef DOSBOX_SHELL_H
#define DOSBOX_SHELL_H
#include <ctype.h>
#ifndef DOSBOX_DOSBOX_H
#include "dosbox.h"
#endif
#ifndef DOSBOX_PROGRAMS_H
#include "programs.h"
#endif
#include <string>
#include <list>
#define CMD_MAXLINE 4096
#define CMD_MAXCMDS 20
#define CMD_OLDSIZE 4096
extern Bitu call_shellstop;
class DOS_Shell;
/* first_shell is used to add and delete stuff from the shell env
* by "external" programs. (config) */
extern DOS_Shell * first_shell;
class BatchFile {
public:
BatchFile(DOS_Shell * host,char const* const resolved_name,char const* const entered_name, char const * const cmd_line);
virtual ~BatchFile();
virtual bool ReadLine(char * line);
bool Goto(char * where);
void Shift(void);
Bit16u file_handle;
Bit32u location;
bool echo;
DOS_Shell * shell;
BatchFile * prev;
CommandLine * cmd;
std::string filename;
};
class AutoexecEditor;
class DOS_Shell : public Program {
private:
friend class AutoexecEditor;
std::list<std::string> l_history, l_completion;
char *completion_start;
Bit16u completion_index;
public:
DOS_Shell();
void Run(void);
void RunInternal(void); //for command /C
/* A load of subfunctions */
void ParseLine(char * line);
Bitu GetRedirection(char *s, char **ifn, char **ofn,bool * append);
void InputCommand(char * line);
void ShowPrompt();
void DoCommand(char * cmd);
bool Execute(char * name,char * args);
/* Checks if it matches a hardware-property */
bool CheckConfig(char* cmd_in,char*line);
/* Some internal used functions */
char * Which(char * name);
/* Some supported commands */
void CMD_HELP(char * args);
void CMD_CLS(char * args);
void CMD_COPY(char * args);
void CMD_DATE(char * args);
void CMD_TIME(char * args);
void CMD_DIR(char * args);
void CMD_DELETE(char * args);
void CMD_ECHO(char * args);
void CMD_EXIT(char * args);
void CMD_MKDIR(char * args);
void CMD_CHDIR(char * args);
void CMD_RMDIR(char * args);
void CMD_SET(char * args);
void CMD_IF(char * args);
void CMD_GOTO(char * args);
void CMD_TYPE(char * args);
void CMD_REM(char * args);
void CMD_RENAME(char * args);
void CMD_CALL(char * args);
void SyntaxError(void);
void CMD_PAUSE(char * args);
void CMD_SUBST(char* args);
void CMD_LOADHIGH(char* args);
void CMD_CHOICE(char * args);
void CMD_ATTRIB(char * args);
void CMD_PATH(char * args);
void CMD_SHIFT(char * args);
void CMD_VER(char * args);
/* The shell's variables */
Bit16u input_handle;
BatchFile * bf;
bool echo;
bool exit;
bool call;
};
struct SHELL_Cmd {
const char * name; /* Command name*/
Bit32u flags; /* Flags about the command */
void (DOS_Shell::*handler)(char * args); /* Handler for this command */
const char * help; /* String with command help */
};
/* Object to manage lines in the autoexec.bat The lines get removed from
* the file if the object gets destroyed. The environment is updated
* as well if the line set a a variable */
class AutoexecObject{
private:
bool installed;
std::string buf;
public:
AutoexecObject():installed(false){ };
void Install(std::string const &in);
void InstallBefore(std::string const &in);
~AutoexecObject();
private:
void CreateAutoexec(void);
};
#endif
|
/* This file is part of KDevelop
Copyright 2002-2005 Roberto Raggi <roberto@kdevelop.org>
Copyright 2006 Adam Treat <treat@kde.org>
Copyright 2006-2008 Hamish Rodda <rodda@kde.org>
Copyright 2007-2008 David Nolden <david.nolden.kdevelop@art-master.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef CONSTANTINTEGRALTYPE_H
#define CONSTANTINTEGRALTYPE_H
#include "integraltype.h"
#include "typesystemdata.h"
namespace KDevelop
{
template<typename T>
T constant_value(const qint64* realval)
{
T value;
memcpy(&value, realval, sizeof(T));
return value;
}
class KDEVPLATFORMLANGUAGE_EXPORT ConstantIntegralType : public IntegralType
{
public:
ConstantIntegralType(const ConstantIntegralType& rhs);
ConstantIntegralType(ConstantIntegralTypeData& data);
ConstantIntegralType(uint type = TypeNone);
typedef TypePtr<ConstantIntegralType> Ptr;
/**The types and modifiers are not changed!
* The values are casted internally to the local representation, so you can lose precision.
* */
template<class ValueType>
void setValue(ValueType value) {
if(AbstractType::modifiers() & UnsignedModifier)
setValueInternal<quint64>(value);
else if(IntegralType::dataType() == TypeFloat)
setValueInternal<float>(value);
else if(IntegralType::dataType() == TypeDouble)
setValueInternal<double>(value);
else
setValueInternal<qint64>(value);
}
/**
* For booleans, the value is 1 for true, and 0 for false.
* All signed values should be retrieved and set through value(),
*
* */
template<class ValueType>
ValueType value() const {
if(modifiers() & UnsignedModifier) {
return constant_value<quint64>(&d_func()->m_value);
} else if(dataType() == TypeFloat) {
return constant_value<float>(&d_func()->m_value);
} else if(dataType() == TypeDouble) {
return constant_value<double>(&d_func()->m_value);
} else {
return constant_value<qint64>(&d_func()->m_value);
}
}
qint64 plainValue() const;
virtual QString toString() const;
virtual bool equals(const KDevelop::AbstractType* rhs) const;
virtual KDevelop::AbstractType* clone() const;
virtual uint hash() const;
enum {
Identity = 14
};
typedef ConstantIntegralTypeData Data;
protected:
TYPE_DECLARE_DATA(ConstantIntegralType);
private:
//Sets the value without casting
template<class ValueType>
void setValueInternal(ValueType value);
};
template<>
inline ConstantIntegralType* fastCast<ConstantIntegralType*>(AbstractType* from) {
if(!from || from->whichType() != KDevelop::AbstractType::TypeIntegral)
return 0;
else
return dynamic_cast<ConstantIntegralType*>(from);
}
}
#endif // CPPTYPES_H
|
/*
** RopGadget - Release v4.0.0
** Allan Wirth - http://allanwirth.com/
** Jonathan Salwan - http://twitter.com/JonathanSalwan
** 2013-1-20
**
** 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 "ropgadget.h"
void print_real_string(unsigned char *str)
{
size_t l;
size_t i;
l = strlen(stringmode.string);
for (i = 0; i < l; i++)
uprintf((str[i] >= 0x20 && str[i] <= 0x7e)?"%c":"\\x%.2x", str[i]);
}
unsigned char *real_string_stringmode(char *base_string, unsigned char *data)
{
unsigned char *real_string;
size_t i;
real_string = xmalloc((strlen(base_string) + 1) * sizeof(char));
/* Loop through ?s and set them to the same index in data */
for (i = 0; base_string[i]; i++)
if (base_string[i] == '?')
real_string[i] = data[i];
else
real_string[i] = (unsigned char)base_string[i];
real_string[i] = '\0';
return real_string;
}
|
#include "allegro-main.h"
#include "ibm.h"
#include "video.h"
#include "allegro-video.h"
static PALETTE cgapal=
{
{0,0,0},{0,42,0},{42,0,0},{42,21,0},
{0,0,0},{0,42,42},{42,0,42},{42,42,42},
{0,0,0},{21,63,21},{63,21,21},{63,63,21},
{0,0,0},{21,63,63},{63,21,63},{63,63,63},
{0,0,0},{0,0,42},{0,42,0},{0,42,42},
{42,0,0},{42,0,42},{42,21,00},{42,42,42},
{21,21,21},{21,21,63},{21,63,21},{21,63,63},
{63,21,21},{63,21,63},{63,63,21},{63,63,63},
{0,0,0},{0,21,0},{0,0,42},{0,42,42},
{42,0,21},{21,10,21},{42,0,42},{42,0,63},
{21,21,21},{21,63,21},{42,21,42},{21,63,63},
{63,0,0},{42,42,0},{63,21,42},{41,41,41},
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
{0,0,0},{0,42,42},{42,0,0},{42,42,42},
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
{0,0,0},{0,63,63},{63,0,0},{63,63,63},
};
static uint32_t pal_lookup[256];
static void allegro_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h);
static void allegro_blit_memtoscreen_8(int x, int y, int w, int h);
static BITMAP *buffer32_vscale;
void allegro_video_init()
{
int c;
set_color_depth(32);
set_gfx_mode(GFX_AUTODETECT_WINDOWED, 640, 480, 0, 0);
video_blit_memtoscreen = allegro_blit_memtoscreen;
video_blit_memtoscreen_8 = allegro_blit_memtoscreen_8;
for (c = 0; c < 256; c++)
pal_lookup[c] = makecol(cgapal[c].r << 2, cgapal[c].g << 2, cgapal[c].b << 2);
buffer32_vscale = create_bitmap(2048, 2048);
}
void allegro_video_close()
{
destroy_bitmap(buffer32_vscale);
}
void allegro_video_update_size(int x, int y)
{
if (set_gfx_mode(GFX_AUTODETECT_WINDOWED, x, y, 0, 0))
fatal("Failed to set gfx mode %i,%i : %s\n", x, y, allegro_error);
}
static void allegro_blit_memtoscreen(int x, int y, int y1, int y2, int w, int h)
{
if (h < winsizey)
{
int yy;
for (yy = y+y1; yy < y+y2; yy++)
{
if (yy >= 0)
{
memcpy(&((uint32_t *)buffer32_vscale->line[yy*2])[x], &((uint32_t *)buffer32->line[yy])[x], w*4);
memcpy(&((uint32_t *)buffer32_vscale->line[(yy*2)+1])[x], &((uint32_t *)buffer32->line[yy])[x], w*4);
}
}
blit(buffer32_vscale, screen, x, (y+y1)*2, 0, y1, w, (y2-y1)*2);
}
else
blit(buffer32, screen, x, y+y1, 0, y1, w, y2-y1);
}
static void allegro_blit_memtoscreen_8(int x, int y, int w, int h)
{
int xx, yy;
int line_double = (winsizey > h) ? 1 : 0;
if (y < 0)
{
h += y;
y = 0;
}
for (yy = y; yy < y+h; yy++)
{
int dy = line_double ? yy*2 : yy;
if (dy < buffer->h)
{
if (line_double)
{
for (xx = x; xx < x+w; xx++)
{
((uint32_t *)buffer32->line[dy])[xx] =
((uint32_t *)buffer32->line[dy + 1])[xx] = pal_lookup[buffer->line[yy][xx]];
}
}
else
{
for (xx = x; xx < x+w; xx++)
((uint32_t *)buffer32->line[dy])[xx] = pal_lookup[buffer->line[yy][xx]];
}
}
}
if (readflash)
{
if (line_double)
rectfill(buffer32, x+SCREEN_W-40, y*2+8, SCREEN_W-8, y*2+14, makecol(255, 255, 255));
else
rectfill(buffer32, x+SCREEN_W-40, y+8, SCREEN_W-8, y+14, makecol(255, 255, 255));
readflash = 0;
}
if (line_double)
blit(buffer32, screen, x, y*2, 0, 0, w, h*2);
else
blit(buffer32, screen, x, y, 0, 0, w, h);
}
|
/* ======================================================================
USER-GFMD - Elastic half-space methods for LAMMPS
https://github.com/Atomistica/user-gfmd
Copyright (2011-2016,2021)
Lars Pastewka <lars.pastewka@imtek.uni-freiburg>,
Tristan A. Sharp and others.
See the AUTHORS file in the top-level USER-GFMD directory.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
====================================================================== */
/* ----------------------------------------------------------------------
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(fire,FixFIRE)
#else
#ifndef LMP_FIX_FIRE_H
#define LMP_FIX_FIRE_H
#include "fix.h"
namespace LAMMPS_NS {
class FixFIRE : public Fix {
public:
FixFIRE(class LAMMPS *, int, char **);
virtual ~FixFIRE() {}
int setmask();
virtual void init();
virtual void initial_integrate(int);
virtual void final_integrate();
virtual void reset_dt();
protected:
int minsteps,cut;
double mix,incfac,decfac,mix_in,mixdec,max_dt,limit_dx;
double dtv,dtf;
double xlimit,vlimitsq; // TAS to allow limit of dstep size
};
}
#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.
*/
|
/*
* SerialComm.h
*
* Created: 30/03/2014 4:18:01 PM
* Author: Kianoosh
*/
#ifdef F_CPU
#undef F_CPU
#define F_CPU 8000000UL
#else
#define F_CPU 8000000UL
#endif
#ifndef SERIALCOMM_H_
#define SERIALCOMM_H_
#include <stdint.h>
//#define BAUD 2400
#define BAUD 9600
#define BUFFER_SIZE 512
#define PCKT_QUEUE_SIZE 8
extern int8_t speed_l_desired;
extern int8_t speed_r_desired;
extern uint8_t motor_enable;
extern float kp;
extern uint8_t kd;
extern float ki;
//initialize USART
extern void SerialComm_initUSART(uint16_t ubrr);
//send debug message
extern void SerialComm_sendText(char* msg);
extern void SerialComm_sendTextf(char* format, ...);
//send byte
extern void SerialComm_sendByte(uint8_t byte);
//read byte
extern void SerialComm_readByte();
extern void SerialComm_sendData(void* data, uint8_t size);
void sendNextByte();
//process received data
extern void SerialComm_ProcessPackets();
//Debug
uint8_t SerialComm_canprint();
//parse data
//data coming from PC would be:
// speed of each motor, start, stop command
//and debug command requesting encoder readings, etc
#endif /* SERIALCOMM_H_ */
|
#pragma once
#include "Evento.h"
#include "CampoCosmico.h"
#include "AtaqueXenomorfo.h"
#include "AtaquePiratas.h"
#include "ChuvaMeteoritos.h"
#include "Alojamento_Capitao.h"
#include "Auto_Reparador.h"
#include "Beliche.h"
#include "Controlo_Escudo.h"
#include "Oficina_Robotica.h"
#include "Ponte.h"
#include "Propulsor.h"
#include "Raio_Laser.h"
#include "Sala_Armas.h"
#include "Sala_Maquinas.h"
#include "Sistema_Seguranca_Interno.h"
#include "Suporte_Vida.h"
#include "Enfermaria.h"
#include "Jogo.h"
class Interacao {
Consola c;
public:
Interacao();
void Entrada(); //Função só para ficar com um aspeto grafico inicial mais bonito
void Configurar_Nave(); //Função para ler comandos inseridos pelo utilizador
void MostraAmbienteGrafico(); //Mostrar nave
void next() { }
void Novo_Jogo();
void Jogar();
void gerirEvento();
void Jogo_A_Iniciar();
//int escreveIntegridade(int pos);
private:
bool jogo_criado;
void limpaParteDireita();
int opcaoEvento();
bool verificaExisteEvento(string e);
int posEvento(string e);
};
|
//
// "$Id$"
//
// MD5 support code for HTMLDOC.
//
// Copyright 2011 by Michael R Sweet.
// Copyright 2001-2008 by Easy Software Products.
// Copyright 1999 Aladdin Enterprises. All rights reserved.
//
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
//
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
//
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
// 2. Altered source versions must be plainly marked as such, and must not be
// misrepresented as being the original software.
// 3. This notice may not be removed or altered from any source distribution.
//
// L. Peter Deutsch
// ghost@aladdin.com
//
//
// Independent implementation of MD5 (RFC 1321).
//
// This code implements the MD5 Algorithm defined in RFC 1321.
// It is derived directly from the text of the RFC and not from the
// reference implementation.
//
// The original and principal author of md5.h is L. Peter Deutsch
// <ghost@aladdin.com>. Other authors are noted in the change history
// that follows (in reverse chronological order):
//
// 1999-11-04 lpd Edited comments slightly for automatic TOC extraction.
// 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5);
// added conditionalization for C++ compilation from Martin
// Purschke <purschke@bnl.gov>.
// 1999-05-03 lpd Original version.
//
#ifndef _HTMLDOC_MD5_H_
# define _HTMLDOC_MD5_H_
# include "types.h"
//
// This code has some adaptations for the Ghostscript environment, but it
// will compile and run correctly in any environment with 8-bit chars and
// 32-bit ints. Specifically, it assumes that if the following are
// defined, they have the same meaning as in Ghostscript: P1, P2, P3,
// ARCH_IS_BIG_ENDIAN.
//
// Define the state of the MD5 Algorithm.
struct hdMD5
{
hdWord count[2]; // message length in bits, lsw first
hdWord abcd[4]; // digest buffer
hdByte buf[64]; // accumulate block
void append(const hdByte *data, int nbytes);
void finish(hdByte *digest);
void init();
void process(const hdByte *data);
};
#endif // !_HTMLDOC_MD5_H_
//
// End of "$Id$".
//
|
/* QuestDesigner - Open Legends's Project
Copyright (C) 2003-2005. Germán Méndez Bravo (Kronuz)
Copyright (C) 2001-2003. Open Legends's Project
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/////////////////////////////////////////////////////////////////////////////
/*! \file Memento.h
\author Germán Méndez Bravo (Kronuz)
\brief Interface for CMemento.
\date July 15, 2005:
* Creation date.
This interface records the internal state of an object. This can be used to implement
checkpoints for undo/redo mechanism that allow the user to back out of operations or
recover from errors.
The basic functionality is implemented through a set of methods that let the derivated class
to keep track of the state of the object at any given point in time, using checkpoints.
For instance, when the object is first created no state has yet been saved, but as soon as
the first checkpoint message is received, the full state of the object is saved within the
current chekpoint mark, this can happen several times and all the states are saved in the
current checkpoint mark, which is ideally incremented before any more changes take place;
later when the user wants to recover a prior state in time, it sends a message to the
CMemento interface asking for the state of the object at a given checkpoint mark; CMemento
resolves by replacing the actual state of the object with the saved information.
\remarks
It is needed, for each derived class, to implement the pure virtual functions:
_SaveState(checkpoint); - Saves the state of the object.
_RestoreState(checkpoint); - Recovers the state of an object.
DestroyCheckpoint(data); - Gives the object a chance to clean or delete data pointer
at the time a checkpointed state is deleted.
For that, the implementation must use the protected members:
SetState(checkpoint, data); - Sets the checkpointed state to point
to a void* that keeps the state of the object.
data GetState(checkpoint); - Gets a pointer to a void* that keeps the state of the object.
The Interface implements a list of chekpointed states and maintains it clean, by flushing all the
saved states after the checkpoint indicated by SaveState. for every saved checkpoint state that is
flushed it's data pointer is deleted.
CMemento is basic implementation of the explained interface.
*/
#pragma once
#include <IConsole.h>
#include <Core.h>
#include <vector>
#include <functional>
#include <algorithm>
/////////////////////////////////////////////////////////////////////////////
/*! \class CMemento
\brief Memento object state saving.
\author Germán Méndez Bravo (Kronuz)
\version 1.0
\date July 15, 2005
This class implements the basic interface to mantain the state of objects.
*/
class CMemento
{
protected:
struct StateData {
virtual bool operator==(const StateData& state) const = 0;
};
SIMPLEPROC *m__DestroyCheckpoint;
LPARAM m__lParam;
private:
struct State {
UINT checkpoint;
StateData *data;
State(UINT checkpoint_, StateData *data_) : checkpoint(checkpoint_), data(data_) {}
};
const struct CheckpointDestroy :
public std::binary_function<State*, UINT, bool> {
CMemento *m_pMemento;
CheckpointDestroy(CMemento *pMemento) : m_pMemento(pMemento) { /* Warning C4355: THIS CONSTRUCTOR MUST NEVER MAKE ACCESS ANY MEMBERS OF pMemento */}
bool operator()(State* &a, const UINT b) const;
} m_destroyCheckpoint;
const struct CheckpointCmp :
public std::binary_function<State*, UINT, bool> {
bool operator()(State* const &a, State* const &b) const;
} m_cmpCheckpoint;
typedef std::vector<State*> Checkpoints;
Checkpoints m_Checkpoints;
void Flush(UINT checkpoint = 0);
protected:
int SetState(UINT checkpoint, StateData *data);
StateData* GetState(UINT checkpoint);
int StateCount(UINT checkpoint); //!< Returns the number of states bellow checkpoint saved for the child
virtual int _SaveState(UINT checkpoint) = 0;
virtual int _RestoreState(UINT checkpoint) = 0;
virtual void ReadState(StateData *data) = 0;
virtual void WriteState(StateData *data) = 0;
public:
// DestroyCheckpoint callback function must ALWAYS delete the Interface pointer passed:
inline void DestroyStateCallback(SIMPLEPROC _DestroyCheckpoint, LPARAM _lParam) {
m__DestroyCheckpoint = _DestroyCheckpoint;
m__lParam = _lParam;
}
CMemento();
~CMemento();
};
|
// Code from Amarok.
/***************************************************************************
* Copyright (C) 2005 Max Howell <max.howell@methylblue.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 CRASH_H
#define CRASH_H
#include <kcrash.h> //for main.cpp
/**
* @author Max Howell
* @short The amaroK crash-handler
*
* I'm not entirely sure why this had to be inside a class, but it
* wouldn't work otherwise *shrug*
*/
class Crash
{
public:
static void crashHandler( int signal );
};
#endif
|
/*
* Copyright (C) 2013 Intel, 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Author: Thomas Wood <thomas.wood@intel.com>
*
*/
#include "cc-media-sharing.h"
#include <gio/gio.h>
#include <gio/gdesktopappinfo.h>
#include <glib/gstdio.h>
static GKeyFile*
cc_media_sharing_open_key_file (void)
{
gchar *path;
GKeyFile *file;
file = g_key_file_new ();
path = g_build_filename (g_get_user_config_dir (), "rygel.conf", NULL);
g_key_file_load_from_file (file, path,
G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS,
NULL);
g_free (path);
return file;
}
void
cc_media_sharing_get_preferences (gchar ***folders)
{
GKeyFile *file;
file = cc_media_sharing_open_key_file ();
if (folders)
{
gsize length;
GPtrArray *array;
char **str_list, **orig_list;
str_list = g_key_file_get_string_list (file, "MediaExport", "uris",
&length, NULL);
orig_list = str_list;
array = g_ptr_array_new ();
while (str_list && *str_list)
{
const char *dir;
if (g_str_equal (*str_list, "@MUSIC@"))
dir = g_get_user_special_dir (G_USER_DIRECTORY_MUSIC);
else if (g_str_equal (*str_list, "@VIDEOS@"))
dir = g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS);
else if (g_str_equal (*str_list, "@PICTURES@"))
dir = g_get_user_special_dir (G_USER_DIRECTORY_PICTURES);
else
dir = g_strdup (*str_list);
if (dir != NULL)
g_ptr_array_add (array, g_strdup (dir));
str_list++;
}
g_ptr_array_add (array, NULL);
*folders = (char **) g_ptr_array_free (array, FALSE);
g_strfreev (orig_list);
}
g_key_file_free (file);
}
void
cc_media_sharing_set_preferences (gchar **folders)
{
GKeyFile *file;
gchar **str_list;
gchar *path;
gsize length;
gchar *data;
file = cc_media_sharing_open_key_file ();
g_key_file_set_boolean (file, "general", "upnp-enabled", TRUE);
g_key_file_set_boolean (file, "MediaExport", "enabled", TRUE);
str_list = folders;
length = 0;
while (str_list && *str_list)
{
if (g_strcmp0 (*str_list, g_get_user_special_dir (G_USER_DIRECTORY_MUSIC)) == 0)
{
g_free (*str_list);
*str_list = g_strdup ("@MUSIC@");
}
if (g_strcmp0 (*str_list, g_get_user_special_dir (G_USER_DIRECTORY_VIDEOS)) == 0)
{
g_free (*str_list);
*str_list = g_strdup ("@VIDEOS@");
}
if (g_strcmp0 (*str_list, g_get_user_special_dir (G_USER_DIRECTORY_PICTURES)) == 0)
{
g_free (*str_list);
*str_list = g_strdup ("@PICTURES@");
}
str_list++;
length++;
}
g_key_file_set_string_list (file, "MediaExport", "uris", (const gchar**) folders, length);
data = g_key_file_to_data (file, NULL, NULL);
path = g_build_filename (g_get_user_config_dir (), "rygel.conf", NULL);
g_file_set_contents (path, data, -1, NULL);
g_free (path);
g_key_file_free (file);
}
|
#ifndef IO_XYZ_H
#define IO_XYZ_H
#include <vector>
#include <string>
#include <iostream>
namespace kit { namespace io {
void load_xyz(std::istream& is,
std::string& comment,
std::vector<std::string>& elements, // clears the original
std::vector<double>& xyz); // clears the original
void load_xyz(std::istream& is,
int& natoms,
std::string& comment,
std::vector<std::string>& elements, // clears the original
std::vector<double>& xyz); // clears the original
void load_pdb(std::istream& is,
int& natoms,
std::string& comment,
std::vector<std::string>& elements, // clears the original
std::vector<double>& xyz); // clears the original
void save_xyz(std::ostream& os,
const std::string& comment,
const std::vector<std::string>& elements,
const std::vector<double>& xyz);
}} // namespace kit::io
#endif // IO_XYZ_H
|
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#if !defined(CROFFSYSTEM_H_INC)
#define CROFFSYSTEM_H_INC
#ifndef __Q_SHARED_H
#include "../qcommon/q_shared.h" //needs to be in here for entityState_t
#endif
#if !defined(SERVER_H_INC)
#include "../server/server.h"
#endif
#include <vector>
#include <map>
using namespace std;
// ROFF Defines
//-------------------
#define ROFF_VERSION 1
#define ROFF_NEW_VERSION 2
#define ROFF_STRING "ROFF"
#define ROFF_SAMPLE_RATE 10 // 10hz
#define ROFF_AUTO_FIX_BAD_ANGLES // exporter can mess up angles,
// defining this attempts to detect and fix these problems
// The CROFFSystem object provides all of the functionality of ROFF
// caching, playback, and clean-up, plus some useful debug features.
//--------------------------------------
class CROFFSystem
//--------------------------------------
{
private:
//------
// forward declarations
class CROFF;
struct SROFFEntity;
typedef map <int, CROFF *> TROFFList;
typedef vector <SROFFEntity *> TROFFEntList;
TROFFList mROFFList; // List of cached roffs
int mID; // unique ID generator for new roff objects
TROFFEntList mROFFEntList; // List of roffing entities
// ROFF Header file definition, nothing else needs to see this
typedef struct tROFFHeader
//-------------------------------
{
char mHeader[4]; // should match roff_string defined above
int mVersion; // version num, supported version defined above
float mCount; // I think this is a float because of a limitation of the roff exporter
} TROFFHeader;
// ROFF Entry, nothing else needs to see this
typedef struct tROFFEntry
//-------------------------------
{
float mOriginOffset[3];
float mRotateOffset[3];
} TROFFEntry;
typedef struct tROFF2Header
//-------------------------------
{
char mHeader[4]; // should match roff_string defined above
int mVersion; // version num, supported version defined above
int mCount; // I think this is a float because of a limitation of the roff exporter
int mFrameRate; // Frame rate the roff should be played at
int mNumNotes; // number of notes (null terminated strings) after the roff data
} TROFF2Header;
// ROFF Entry, nothing else needs to see this
typedef struct tROFF2Entry
//-------------------------------
{
float mOriginOffset[3];
float mRotateOffset[3];
int mStartNote, mNumNotes; // note track info
} TROFF2Entry;
// An individual ROFF object,
// contains actual rotation/offset information
//--------------------------------------
class CROFF
//--------------------------------------
{
public:
//------
int mID; // id for this roff file
char mROFFFilePath[MAX_QPATH]; // roff file path
int mROFFEntries; // count of move/rotate commands
int mFrameTime; // frame rate
int mLerp; // Lerp rate (FPS)
TROFF2Entry *mMoveRotateList; // move rotate/command list
int mNumNoteTracks;
char **mNoteTrackIndexes;
qboolean mUsedByClient;
qboolean mUsedByServer;
CROFF()
{
mUsedByClient = mUsedByServer = qfalse;
}
CROFF( char *file, int id );
~CROFF();
}; // class CROFF
// The roff system tracks entities that are
// roffing, so this is the internal structure
// that represents these objects.
//--------------------------------------
struct SROFFEntity
//--------------------------------------
{
int mEntID; // the entity that is currently roffing
int mROFFID; // the roff to be applied to that entity
int mNextROFFTime; // next time we should roff
int mROFFFrame; // current roff frame we are applying
qboolean mKill; // flag to kill a roffing ent
qboolean mSignal; // TODO: Need to implement some sort of signal to Icarus when roff is done.
qboolean mTranslated; // should this roff be "rotated" to fit the entity's initial position?
qboolean mIsClient;
vec3_t mStartAngles; // initial angle of the entity
}; // struct SROFFEntity
qboolean IsROFF( byte *file ); // Makes sure the file is a valid roff file
qboolean InitROFF( byte *file, CROFF *obj ); // Handles stashing raw roff data into the roff object
qboolean InitROFF2( byte *file, CROFF *obj ); // Handles stashing raw roff data into the roff object
void FixBadAngles(CROFF *obj);
int NewID() { return ++mID; } // Increment before return so we can use zero as failed return val
qboolean ApplyROFF( SROFFEntity *roff_ent,
CROFFSystem::CROFF *roff ); // True = success; False = roff complete
void ProcessNote(SROFFEntity *roff_ent, char *note);
void SetLerp( trajectory_t *tr,
trType_t, vec3_t origin,
vec3_t delta, int time, int rate );
qboolean ClearLerp( SROFFEntity *roff_ent ); // Clears out the angular and position lerp fields
public:
//------
CROFFSystem() { mID = 0; }
~CROFFSystem() { Restart(); }
qboolean Restart(); // Free up all system resources and reset the ID counter
int Cache( char *file, qboolean isClient ); // roffs should be precached at the start of each level
int GetID( char *file ); // find the roff id by filename
qboolean Unload( int id ); // when a roff is done, it can be removed to free up resources
qboolean Clean(qboolean isClient); // should be called when level is done, frees all roff resources
void List(void); // dumps a list of all cached roff files to the console
qboolean List( int id ); // dumps the contents of the specified roff to the console
qboolean Play( int entID, int roffID, qboolean doTranslation, qboolean isClient); // TODO: implement signal on playback completion.
void ListEnts(); // List the entities that are currently roffing
qboolean PurgeEnt( int entID, qboolean isClient ); // Purge the specified entity from the entity list by id
qboolean PurgeEnt( char *file ); // Purge the specified entity from the entity list by name
void UpdateEntities(qboolean isClient); // applys roff data to roffing entities.
}; // class CROFFSystem
extern CROFFSystem theROFFSystem;
#endif // CROFFSYSTEM_H_INC
|
#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/blkdev.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/genhd.h>
#include <linux/moduleparam.h>
#include <linux/workqueue.h>
#include <linux/kthread.h>
#include <net/net_namespace.h>
#include <asm/unaligned.h>
#include <linux/uio.h>
struct bvec_iter *iter;
struct bvec_iter *test_fn(int n)
{
return iter + n;
}
|
/* This file is part of the KDE project
Copyright (C) 2005-2006 Jarosław Staniek <staniek@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KEXIFORMEVENTHANDLER_H
#define KEXIFORMEVENTHANDLER_H
#include <QWidget>
#include <kaction.h>
#include <kexi_export.h>
namespace KexiPart
{
class Info;
}
//! The KexiFormEventHandler class handles events defined within Kexi Forms
/*! For now only "onClickAction" property of Push Button widget is handled:
It's possible to connect this event to predefined global action.
Note: This interface will be extended in the future!
@see KexiFormPart::slotAssignAction()
*/
class KFORMEDITOR_EXPORT KexiFormEventHandler
{
public:
KexiFormEventHandler();
virtual ~KexiFormEventHandler();
/*! Sets \a mainWidget to be a main widget for this handler.
Also find widgets having action assigned and connects them
to appropriate actions.
For now, all of them must be KexiPushButton). */
void setMainWidgetForEventHandling(QWidget* mainWidget);
private:
class Private;
Private* const d;
};
//! @internal form-level action for handling "on click" actions
class KFORMEDITOR_EXPORT KexiFormEventAction : public KAction
{
Q_OBJECT
public:
//! A structure used in currentActionName()
class KFORMEDITOR_EXPORT ActionData
{
public:
ActionData();
/*! Decodes action string into action type/action argument parts.
Action string has to be in a form of "actiontype:actionarg"
- Action type is passed to \a actionType on success. Action type can be "kaction"
or any of the part names (see KexiPart::Info::objectName()), e.g. "table", "query", etc.
- Action argument can be an action name in case of "kaction" type or object name
in case of action of type "table", "query", etc.
\a ok is set to true on success and to false on failure. On failure no other
values are passed.
\return part info if action type is "table", "query", etc., or 0 for "kaction" type. */
KexiPart::Info* decodeString(QString& actionType, QString& actionArg, bool& ok) const;
//! \return true if the action is empty
bool isEmpty() const;
QString string; //!< action string with prefix, like "kaction:edit_copy" or "table:<tableName>"
QString option; //!< option used when name is "table/query/etc.:\<objectName\>" is set;
//!< can be set to "open", "design", "editText", etc.
//!< @see ActionToExecuteListView::showActionsForPartClass()
};
KexiFormEventAction(QObject* parent, const QString& actionName,
const QString& objectName, const QString& actionOption);
virtual ~KexiFormEventAction();
public Q_SLOTS:
//! Activates the action. If the object supports executing (macro, script),
//! it is executed; otherwise (table, query, form,...) it is opened in its data view.
void slotTrigger();
private:
class Private;
Private* const d;
};
#endif
|
/*************************************************************************/ /*!
@Title System Description Header
@Copyright Copyright (c) Imagination Technologies Ltd. All Rights Reserved
@Description This header provides system-specific declarations and macros
@License Dual MIT/GPLv2
The contents of this file are subject to the MIT license as set out below.
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.
Alternatively, the contents of this file may be used under the terms of
the GNU General Public License Version 2 ("GPL") in which case the provisions
of GPL are applicable instead of those above.
If you wish to allow use of your version of this file only under the terms of
GPL, and not to allow others to use your version of this file under the terms
of the MIT license, indicate your decision by deleting the provisions above
and replace them with the notice and other provisions required by GPL as set
out in the file called "GPL-COPYING" included in this distribution. If you do
not delete the provisions above, a recipient may use your version of this file
under the terms of either the MIT license or GPL.
This License is also included in this distribution in the file called
"MIT-COPYING".
EXCEPT AS OTHERWISE STATED IN A NEGOTIATED AGREEMENT: (A) 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; AND (B) 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.
*/ /**************************************************************************/
#if !defined(__SOCCONFIG_H__)
#define __SOCCONFIG_H__
#define VS_PRODUCT_NAME "OMAP4"
#if defined(SGX540) && (SGX_CORE_REV == 120)
#define SYS_SGX_CLOCK_SPEED 307200000
#else
#define SYS_SGX_CLOCK_SPEED 304742400
#endif
#define SYS_SGX_HWRECOVERY_TIMEOUT_FREQ (100) // 10ms (100hz)
#define SYS_SGX_PDS_TIMER_FREQ (1000) // 1ms (1000hz)
/* Allow the AP parameters to be overridden in the build config */
#if !defined(SYS_SGX_ACTIVE_POWER_MODE)
#define SYS_SGX_ACTIVE_POWER_MODE (1)
#endif
#if !defined(SYS_SGX_ACTIVE_POWER_LATENCY_MS)
#define SYS_SGX_ACTIVE_POWER_LATENCY_MS (2)
#endif
#define SYS_OMAP4430_SGX_REGS_SYS_PHYS_BASE 0x56000000
#define SYS_OMAP4430_SGX_REGS_SIZE 0xFFFF
#define SYS_OMAP4430_SGX_IRQ 53 /* OMAP4 IRQ's are offset by 32 */
#define SYS_OMAP4430_DSS_REGS_SYS_PHYS_BASE 0x58000000
#define SYS_OMAP4430_DSS_REGS_SIZE 0x7000
#define SYS_OMAP4430_DSS_HDMI_INTERRUPT_STATUS_REG 0x6028
#define SYS_OMAP4430_DSS_HDMI_INTERRUPT_ENABLE_REG 0x602c
#define SYS_OMAP4430_DSS_HDMI_INTERRUPT_VSYNC_ENABLE_MASK 0x10000
#define SYS_OMAP4430_DSS_HDMI_INTERRUPT_VSYNC_STATUS_MASK 0x10000
#define SYS_OMAP4430_DSS_LCD_INTERRUPT_STATUS_REG 0x1018
#define SYS_OMAP4430_DSS_LCD_INTERRUPT_ENABLE_REG 0x101c
#define SYS_OMAP4430_DSS_LCD_INTERRUPT_VSYNC_ENABLE_MASK 0x40002
#define SYS_OMAP4430_DSS_LCD_INTERRUPT_VSYNC_STATUS_MASK 0x40002
#define SYS_OMAP4430_GP11TIMER_ENABLE_SYS_PHYS_BASE 0x48088038
#define SYS_OMAP4430_GP11TIMER_REGS_SYS_PHYS_BASE 0x4808803C
#define SYS_OMAP4430_GP11TIMER_TSICR_SYS_PHYS_BASE 0x48088054
/* Interrupt bits */
#define DEVICE_SGX_INTERRUPT (1<<0)
#define DEVICE_MSVDX_INTERRUPT (1<<1)
#define DEVICE_DISP_INTERRUPT (1<<2)
#if defined(__linux__)
/*
* Recent OMAP4 kernels register SGX as platform device "omap_gpu".
* This device must be used with the Linux power management calls
* in sysutils_linux.c, in order for SGX to be powered on.
*/
#if defined(PVR_LDM_PLATFORM_PRE_REGISTERED_DEV)
#define SYS_SGX_DEV_NAME PVR_LDM_PLATFORM_PRE_REGISTERED_DEV
#else
#define SYS_SGX_DEV_NAME "omap_gpu"
#endif /* defined(PVR_LDM_PLATFORM_PRE_REGISTERED_DEV) */
#endif /* defined(__linux__) */
/*****************************************************************************
* system specific data structures
*****************************************************************************/
#endif /* __SYSCONFIG_H__ */
|
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/keysym.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <X11/extensions/XShm.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <gdk/gdkpixmap.h>
#include <gdk/gdkprivate.h>
#include "bg.h"
#include "dbg.h"
#include "config.h"
static Display *dpy;
//static int screen;
static Window xroot;
static Pixmap xrootbg = 0xc046ad;
static GC gc;
static Atom id = 0;
static Pixmap
bg_get_root_bg()
{
Pixmap ret;
ENTER;
ret = None;
if (id) {
int act_format, c = 2 ;
u_long nitems ;
u_long bytes_after ;
u_char *prop ;
Atom dummy_id;
do {
if (XGetWindowProperty(dpy, xroot, id, 0, 1,
False, XA_PIXMAP, &dummy_id, &act_format,
&nitems, &bytes_after, &prop) == Success) {
if (prop) {
ret = *((Pixmap *)prop);
XFree(prop);
break;
}
}
} while (--c > 0);
}
//fprintf(stderr, "_XROOTPMAP_ID = 0x%x\n", ret);
RET(ret);
}
GdkPixmap *
bg_new_for_win(Window win)
{
Window dummy;
Pixmap bgpix;
GdkPixmap *gbgpix;
int width, height ;
int border, depth, x, y ;
ENTER;
XGetGeometry(dpy, win, &dummy, &x, &y, &width, &height, &border, &depth);
XTranslateCoordinates(dpy, win, xroot, 0, 0, &x, &y, &dummy);
gbgpix = gdk_pixmap_new(NULL, width, height, depth);
if (!gbgpix)
RET(NULL);
bgpix = gdk_x11_drawable_get_xid(gbgpix);
XSetTSOrigin(dpy, gc, -x, -y) ;
XFillRectangle(dpy, bgpix, gc, 0, 0, width, height);
RET(gbgpix);
}
void
bg_init(Display *dpyn)
{
XGCValues gcv;
uint mask;
ENTER;
dpy = dpyn;
id = XInternAtom(dpy, "_XROOTPMAP_ID", False);
xroot = DefaultRootWindow(dpy);
xrootbg = bg_get_root_bg();
gcv.ts_x_origin = 0;
gcv.ts_y_origin = 0;
gcv.fill_style = FillTiled;
mask = GCTileStipXOrigin | GCTileStipYOrigin | GCFillStyle;
if (xrootbg) {
gcv.tile = xrootbg;
mask |= GCTile ;
}
gc = XCreateGC (dpy, xroot, mask, &gcv) ;
RET();
}
void
bg_rootbg_changed()
{
ENTER;
xrootbg = bg_get_root_bg();
if (xrootbg != None) {
XGCValues gcv;
gcv.tile = xrootbg;
XChangeGC(dpy, gc, GCTile, &gcv);
DBG("changed\n");
}
RET();
}
void
bg_close()
{
ENTER;
XFreeGC(dpy, gc);
RET();
}
void
modify_drawable(GdkDrawable *base, GdkGC *gc, guint32 tintcolor, gint alpha)
{
int w, h;
GdkPixbuf *ret, *ret2;
static GdkColormap *cmap = NULL;
ENTER;
gdk_drawable_get_size (base, &w, &h);
if (!cmap) {
cmap = gdk_colormap_get_system ();
}
ret = gdk_pixbuf_get_from_drawable (NULL, base, cmap, 0, 0, 0, 0, w, h);
if (!ret)
RET();
ret2 = gdk_pixbuf_composite_color_simple(ret, w, h,
GDK_INTERP_HYPER, alpha, MIN(w, h), tintcolor, tintcolor);
//gdk_pixbuf_render_to_drawable (ret2, base, gc, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0);
gdk_draw_pixbuf (base, gc, ret2, 0, 0, 0, 0, w, h, GDK_RGB_DITHER_NONE, 0, 0);
g_object_unref(ret);
g_object_unref(ret2);
RET();
}
#ifdef TRANSPARENCY
#include <gdk/gdkwindow.h>
//#include <gdk/gdkinternals.h>
#include <gdk/gdk.h> /* For gdk_rectangle_union() */
#include <gdk/gdkpixmap.h>
#include <gdk/gdkdrawable.h>
#include <gdk/gdkpixmap.h>
#include <gdk/gdkscreen.h>
typedef struct _GdkWindowPaint GdkWindowPaint;
struct _GdkWindowPaint
{
GdkRegion *region;
GdkPixmap *pixmap;
gint x_offset;
gint y_offset;
};
GdkGC *
gdk_window_get_bg_gc (GdkWindow *window,
GdkWindowPaint *paint)
{
GdkWindowObject *private = (GdkWindowObject *)window;
guint gc_mask = 0;
GdkGCValues gc_values;
ENTER;
if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent) {
GdkWindowPaint tmp_paint = *paint;
tmp_paint.x_offset += private->x;
tmp_paint.y_offset += private->y;
return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
} else if (private->bg_pixmap &&
private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
private->bg_pixmap != GDK_NO_BG) {
gc_values.fill = GDK_TILED;
gc_values.tile = private->bg_pixmap;
gc_values.ts_x_origin = -paint->x_offset;
gc_values.ts_y_origin = -paint->y_offset;
gc_mask = GDK_GC_FILL | GDK_GC_TILE | GDK_GC_TS_X_ORIGIN | GDK_GC_TS_Y_ORIGIN;
DBG("x_offset=%d y_offset=%d\n", paint->x_offset, paint->y_offset);
return gdk_gc_new_with_values (paint->pixmap, &gc_values, gc_mask);
} else {
GdkGC *gc = _gdk_drawable_get_scratch_gc (paint->pixmap, FALSE);
gdk_gc_set_foreground (gc, &(private->bg_color));
return g_object_ref (gc);
}
}
#endif
|
#include <unistd.h>
#include <idt.h>
#include <int.h>
pid_t curr_pid;
pid_t get_current_pid()
{
return curr_pid;
}
void sleep()
{
__asm__ ("mov $0, %%eax":::"memory");
call_int(PROC_YIELD);
}
|
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <linux/soundcard.h>
#ifdef HAVE_ALSA
#include <alsa/asoundlib.h>
#endif
#define AUDIO_DEVICE "/dev/dsp"
#define ALSA_MAX_BUF_SIZE 655350
#ifdef HAVE_ALSA
int play_sound_Alsa(char* filename,int rate,int bits,int channel,int order)
{
int rc,size;
char *buffer;
unsigned int val;
snd_pcm_t *handle;
snd_pcm_hw_params_t *params;
snd_pcm_uframes_t frames,periodsize;
snd_mixer_t *mixer;
snd_mixer_elem_t *pcm_element;
struct stat buf;
if(stat(filename, &buf)<0)
{
return -1;
}
size=(unsigned long)buf.st_size;
FILE *fp = fopen(filename,"rb");
if(NULL == fp)
{
printf("can't open file!\n");
return -1;
}
rc = snd_pcm_open(&handle,"default",SND_PCM_STREAM_PLAYBACK,0);
snd_pcm_hw_params_alloca(¶ms);
snd_pcm_hw_params_any(handle,params);
snd_pcm_hw_params_set_access(handle,params,SND_PCM_ACCESS_RW_INTERLEAVED);
switch(order){
case 1:
snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE);
break;
case 2:
snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE);
break;
defualt:
break;
}
snd_pcm_hw_params_set_channels(handle,params,channel);
val = rate;
snd_pcm_hw_params_set_rate_near(handle,params,&val,0);
snd_pcm_hw_params_get_buffer_size_max(params,&frames);
frames = frames < ALSA_MAX_BUF_SIZE? frames:ALSA_MAX_BUF_SIZE;
rc = snd_pcm_hw_params_set_buffer_size_near(handle,params,&frames);
snd_pcm_hw_params_get_period_size_min(params,&periodsize,NULL);
if(!periodsize){
periodsize=size/4;
}
rc = snd_pcm_hw_params_set_period_size_near(handle,params,&periodsize,NULL);
rc = snd_pcm_hw_params(handle,params);
snd_mixer_open(&mixer,0);
snd_mixer_attach(mixer,"default");
snd_mixer_selem_register(mixer,NULL,NULL);
snd_mixer_load(mixer);
for(pcm_element = snd_mixer_first_elem(mixer);pcm_element;pcm_element=snd_mixer_elem_next(pcm_element))
{
if(snd_mixer_elem_get_type(pcm_element)==SND_MIXER_ELEM_SIMPLE && snd_mixer_selem_is_active(pcm_element))
{
if(!strcmp(snd_mixer_selem_get_name(pcm_element),"Master"))
{
snd_mixer_selem_set_playback_volume_range(pcm_element,0,100);
snd_mixer_selem_set_playback_volume_all(pcm_element,(long)100);
}
}
}
buffer = (char*)malloc(size);
rc = fread(buffer,1,size,fp);
if(0== rc)
return -1;
snd_pcm_writei(handle,buffer,size);
snd_pcm_prepare(handle);
snd_pcm_hw_params_free(params);
snd_mixer_close(mixer);
snd_pcm_close(handle);
free(buffer);
fclose(fp);
return 0;
}
#endif
int play_sound_OSS(char *filename,int rate,int bits){
struct stat stat_buf;
unsigned char *buf = NULL;
int result,arg,status,handler,fd;
fd = open(filename,O_RDONLY);
if(fd<0)
return -1;
if(fstat(fd,&stat_buf))
{
close(fd);
return -1;
}
if(!stat_buf.st_size)
{
close(fd);
return -1;
}
buf=malloc(stat_buf.st_size);
if(!buf){
close(fd);
return -1;
}
if(read(fd,buf,stat_buf.st_size)<0){
free(buf);
close(fd);
return -1;
}
handler = open(AUDIO_DEVICE,O_WRONLY);
if(-1 == handler){
return -1;
}
arg = rate*2;
status = ioctl(handler,SOUND_PCM_WRITE_RATE,&arg);
if(-1 == status)
return -1;
arg = bits;
status = ioctl(handler,SOUND_PCM_WRITE_BITS,&arg);
if(-1 == status)
return -1;
result = write(handler,buf,stat_buf.st_size);
if(-1 == result)
return -1;
free(buf);
close(fd);
close(handler);
return result;
}
/*中文显示乱码问题*/
int main(int argc,char** argv){
if(*argv[4] == '1')
play_sound_OSS(argv[1],atoi(argv[2]),atoi(argv[3]));
#ifdef HAVE_ALSA
else
play_sound_Alsa(argv[1],atoi(argv[2]),atoi(argv[3]),atoi(argv[5]),atoi(argv[6]));
#endif
return 0;
}
|
/***************************************************************************
markerdialog.h
----------------
begin : Wed April 21 2004
copyright : (C) 2003 by Michael Margraf
email : michael.margraf@alumni.tu-berlin.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. *
* *
***************************************************************************/
#ifndef MARKERDIALOG_H
#define MARKERDIALOG_H
#include "marker.h"
#include <qdialog.h>
#include <qlineedit.h>
#include <qcombobox.h>
#include <qcheckbox.h>
class MarkerDialog : public QDialog {
Q_OBJECT
public:
MarkerDialog(Marker *pm_, QWidget *parent=0);
~MarkerDialog();
private slots:
void slotAcceptValues();
public:
Marker *pMarker;
QComboBox *NumberBox;
QLineEdit *Precision;
QLineEdit *SourceImpedance;
QCheckBox *TransBox;
};
#endif
|
/*
* 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.
*
* Low level exception handling
*
* Copyright (C) 1998, 1999 by Ralf Baechle
*/
#ifndef _ASM_UCONTEXT_H
#define _ASM_UCONTEXT_H
struct ucontext {
unsigned long uc_flags;
struct ucontext *uc_link;
stack_t uc_stack;
struct sigcontext uc_mcontext;
sigset_t uc_sigmask; /* mask last for extensibility */
};
#endif /* _ASM_UCONTEXT_H */
|
#include "assert.h"
static int global_value;
static int second_value;
static int* global_ptr;
static init_pointer() {
global_value = 99;
global_ptr = &global_value;
}
static reinit_pointer(int** ppint) {
*ppint = &second_value;
}
void test_addressable_pointers() {
init_pointer();
ASSERT(*global_ptr == 99);
reinit_pointer(&global_ptr);
second_value = 41;
ASSERT(*global_ptr == 41);
}
|
#include "threads.h"
#include <stdlib.h>
#include <time.h>
void writing_phase(int file_num, char const *filenames[])
{
int i, rand_number, total_lines = 0;
/* We create a pthread_t array with a file_num number of elements.*/
pthread_t * threads = (pthread_t *)
malloc(file_num * sizeof(pthread_t));
/* We create a thread_params array with a file_num number of elements.*/
thread_params * params = (thread_params *)
malloc(file_num * sizeof(thread_params));
srand(time(NULL));
for (i = 0; i < file_num; i++) {
rand_number = (rand() % 100) + 1;
printf("Writing %d lines in file \"%s\".\n",
rand_number, filenames[i+1]);
/* We assign the needed fields on each thread_params structure. */
params[i].file = fopen(filenames[i+1], "wt");
params[i].writing_lines_num = rand_number;
total_lines += rand_number;
/* We create each thread with the defaults attributes, save its ID in an
* element of threads and execute the thread_writing function. */
pthread_create(&threads[i], NULL,
(void *) &thread_writing,
(void *) ¶ms[i]
);
}
/* We wait for every thread to terminate. */
for (i = 0; i < file_num; i++)
pthread_join(threads[i], (void *) NULL);
printf("Total of writen lines: %d.\n\n", total_lines);
free(threads);
free(params);
}
void reading_phase(int file_num, char const *filenames[])
{
int i, *lines_num, total_lines = 0;
/* We create a pthread_t array with a file_num number of elements.*/
pthread_t * threads = (pthread_t *)
malloc(file_num * sizeof(pthread_t));
/* We create a thread_params array with a file_num number of elements.*/
thread_params * params = (thread_params *)
malloc(file_num * sizeof(thread_params));
for (i = 0; i < file_num; i++) {
/* We assign the needed fields on each thread_params structure. */
params[i].file = fopen(filenames[i+1], "rt");
params[i].reading_lines_num = 0;
/* We create each thread with the defaults attributes, save its ID in an
* element of threads and execute the thread_reading function. */
pthread_create(&threads[i], NULL,
(void *) &thread_reading,
(void *) ¶ms[i]
);
}
/* We wait for every thread to terminate and receive the number of lines
* that were read from the file in the lines_num variable. */
for (i = 0; i < file_num; i++) {
pthread_join(threads[i], (void *) &lines_num);
printf("%d lines read from file \"%s\".\n", *lines_num, filenames[i+1]);
total_lines += (*lines_num);
}
printf("Total of read lines: %d.\n\n", total_lines);
free(threads);
free(params);
}
void * thread_writing(void * params)
{
/* We cast the parameters that were passed to the function for easier use
* within the same. */
thread_params * aux = (thread_params *) params;
int i;
/* We write the required number of lines to the file. */
for (i = 0; i < aux->writing_lines_num; i++)
fprintf(aux->file, "Random line %d\n", i + 1);
fclose(aux->file);
/* We terminate the thread. */
pthread_exit((void *) NULL);
}
void * thread_reading(void * params)
{
/* We cast the parameters that were passed to the function for easier use
* within the same. */
thread_params * aux = (thread_params *) params;
char c;
/* We count the number of lines in the file. */
while ((c = getc(aux->file)) != EOF)
if (c == '\n')
aux->reading_lines_num++;
fclose(aux->file);
/* We terminate the thread and return the number of read lines. */
pthread_exit((void *) &aux->reading_lines_num);
}
|
/*
**********************************************************************************************************************
*
* the Embedded Secure Bootloader System
*
*
* Copyright(C), 2006-2014, Allwinnertech Co., Ltd.
* All Rights Reserved
*
* File :
*
* By :
*
* Version : V2.00
*
* Date :
*
* Descript:
**********************************************************************************************************************
*/
#include "common.h"
#include "asm/io.h"
#include "asm/armv7.h"
#include "asm/arch/cpu.h"
#include "asm/arch/ccmu.h"
#include "asm/arch/timer.h"
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
static int clk_set_divd(void)
{
unsigned int reg_val;
//config axi
reg_val = readl(CCM_CPU_L2_AXI_CTRL);
reg_val &= ~(0x03 << 0);
reg_val |= (0x02 << 0);
writel(reg_val, CCM_CPU_L2_AXI_CTRL);
//config ahb
reg_val = readl(CCM_AHB1_APB1_CTRL);;
reg_val &= ~((0x03 << 12) | (0x03 << 8) | (0x03 << 6) | (0x03 << 4));
reg_val |= (0x03 << 12);
reg_val |= (2 << 6);
reg_val |= (1 << 8);
writel(reg_val, CCM_AHB1_APB1_CTRL);
return 0;
}
/*******************************************************************************
*º¯ÊýÃû³Æ: set_pll
*º¯ÊýÔÐÍ£ºvoid set_pll( void )
*º¯Êý¹¦ÄÜ: µ÷ÕûCPUƵÂÊ
*Èë¿Ú²ÎÊý: void
*·µ »Ø Öµ: void
*±¸ ×¢:
*******************************************************************************/
void set_pll( void )
{
unsigned int reg_val;
unsigned int i;
//ÉèÖÃʱÖÓΪĬÈÏ408M
//Çл»µ½24M
reg_val = readl(CCM_CPU_L2_AXI_CTRL);
reg_val &= ~(0x03 << 16);
reg_val |= (0x01 << 16);
writel(reg_val, CCM_CPU_L2_AXI_CTRL);
//ÑÓʱ£¬µÈ´ýʱÖÓÎȶ¨
for(i=0; i<0x400; i++);
//»ØÐ´PLL1
reg_val = readl(CCM_PLL1_CPUX_CTRL);
reg_val &= ~((0x03 << 16) | (0x1f << 8) | (0x03 << 4) | (0x03 << 0));
reg_val |= (16<<8);
writel(reg_val, CCM_PLL1_CPUX_CTRL);
//ÑÓʱ£¬µÈ´ýʱÖÓÎȶ¨
#ifndef CONFIG_FPGA
do
{
reg_val = readl(CCM_PLL1_CPUX_CTRL);
}
while(!(reg_val & (0x1 << 28)));
#endif
//ÐÞ¸ÄAXI,AHB,APB·ÖƵ
clk_set_divd();
//Çл»Ê±ÖÓµ½COREPLLÉÏ
reg_val = readl(CCM_CPU_L2_AXI_CTRL);
reg_val &= ~(0x03 << 16);
reg_val |= (0x02 << 16);
writel(reg_val, CCM_CPU_L2_AXI_CTRL);
return 0;
}
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
void reset_pll( void )
{
//Çл»CPUʱÖÓԴΪ24M
writel(0x00000000, CCM_CPU_L2_AXI_CTRL);
//»¹ÔPLL1ΪĬÈÏÖµ
writel(0x00001000, CCM_PLL1_CPUX_CTRL);
return ;
}
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
void set_gpio_gate(void)
{
writel(readl(CCM_APB1_GATE0_CTRL) | (1 << 5), CCM_APB1_GATE0_CTRL);
}
/*
************************************************************************************************************
*
* function
*
* º¯ÊýÃû³Æ£º
*
* ²ÎÊýÁÐ±í£º
*
* ·µ»ØÖµ £º
*
* ˵Ã÷ £º
*
*
************************************************************************************************************
*/
void set_ccmu_normal(void)
{
writel(7, CCM_SECURITY_REG);
}
|
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2003 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package 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/>.
*/
#pragma once
#include "synergy/KeyState.h"
#include "common/stdmap.h"
#include "common/stdvector.h"
#if X_DISPLAY_MISSING
# error X11 is required to build synergy
#else
# include <X11/Xlib.h>
# if HAVE_X11_EXTENSIONS_XTEST_H
# include <X11/extensions/XTest.h>
# else
# error The XTest extension is required to build synergy
# endif
# if HAVE_XKB_EXTENSION
# include <X11/extensions/XKBstr.h>
# endif
#endif
class IEventQueue;
//! X Windows key state
/*!
A key state for X Windows.
*/
class XWindowsKeyState : public KeyState {
public:
typedef std::vector<int> KeycodeList;
enum {
kGroupPoll = -1,
kGroupPollAndSet = -2
};
XWindowsKeyState(Display*, bool useXKB, IEventQueue* events);
XWindowsKeyState(Display*, bool useXKB,
IEventQueue* events, synergy::KeyMap& keyMap);
~XWindowsKeyState();
//! @name modifiers
//@{
//! Set active group
/*!
Sets the active group to \p group. This is the group returned by
\c pollActiveGroup(). If \p group is \c kGroupPoll then
\c pollActiveGroup() will really poll, but that's a slow operation
on X11. If \p group is \c kGroupPollAndSet then this will poll the
active group now and use it for future calls to \c pollActiveGroup().
*/
void setActiveGroup(SInt32 group);
//! Set the auto-repeat state
/*!
Sets the auto-repeat state.
*/
void setAutoRepeat(const XKeyboardState&);
//@}
//! @name accessors
//@{
//! Convert X modifier mask to synergy mask
/*!
Returns the synergy modifier mask corresponding to the X modifier
mask in \p state.
*/
KeyModifierMask mapModifiersFromX(unsigned int state) const;
//! Convert synergy modifier mask to X mask
/*!
Converts the synergy modifier mask to the corresponding X modifier
mask. Returns \c true if successful and \c false if any modifier
could not be converted.
*/
bool mapModifiersToX(KeyModifierMask, unsigned int&) const;
//! Convert synergy key to all corresponding X keycodes
/*!
Converts the synergy key \p key to all of the keycodes that map to
that key.
*/
void mapKeyToKeycodes(KeyID key,
KeycodeList& keycodes) const;
//@}
// IKeyState overrides
virtual bool fakeCtrlAltDel();
virtual KeyModifierMask
pollActiveModifiers() const;
virtual SInt32 pollActiveGroup() const;
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
protected:
// KeyState overrides
virtual void getKeyMap(synergy::KeyMap& keyMap);
virtual void fakeKey(const Keystroke& keystroke);
private:
void init(Display* display, bool useXKB);
void updateKeysymMap(synergy::KeyMap&);
void updateKeysymMapXKB(synergy::KeyMap&);
bool hasModifiersXKB() const;
int getEffectiveGroup(KeyCode, int group) const;
UInt32 getGroupFromState(unsigned int state) const;
static void remapKeyModifiers(KeyID, SInt32,
synergy::KeyMap::KeyItem&, void*);
private:
struct XKBModifierInfo {
public:
unsigned char m_level;
UInt32 m_mask;
bool m_lock;
};
#ifdef TEST_ENV
public: // yuck
#endif
typedef std::vector<KeyModifierMask> KeyModifierMaskList;
private:
typedef std::map<KeyModifierMask, unsigned int> KeyModifierToXMask;
typedef std::multimap<KeyID, KeyCode> KeyToKeyCodeMap;
typedef std::map<KeyCode, unsigned int> NonXKBModifierMap;
typedef std::map<UInt32, XKBModifierInfo> XKBModifierMap;
Display* m_display;
#if HAVE_XKB_EXTENSION
XkbDescPtr m_xkb;
#endif
SInt32 m_group;
XKBModifierMap m_lastGoodXKBModifiers;
NonXKBModifierMap m_lastGoodNonXKBModifiers;
// X modifier (bit number) to synergy modifier (mask) mapping
KeyModifierMaskList m_modifierFromX;
// synergy modifier (mask) to X modifier (mask)
KeyModifierToXMask m_modifierToX;
// map KeyID to all keycodes that can synthesize that KeyID
KeyToKeyCodeMap m_keyCodeFromKey;
// autorepeat state
XKeyboardState m_keyboardState;
#ifdef TEST_ENV
public:
SInt32 group() const { return m_group; }
void group(const SInt32& group) { m_group = group; }
KeyModifierMaskList modifierFromX() const { return m_modifierFromX; }
#endif
};
|
/*
This file is part of LPIC++, a particle-in-cell code for
simulating the interaction of laser light with plasma.
Copyright (C) 1994-1997 Roland Lichters
LPIC++ 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 UHR_H
#define UHR_H
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <fstream>
#include <iomanip>
#include <error.h>
#include <parameter.h>
class uhr {
private:
double h_cpu, m_cpu, s_cpu; // total time
double h_sys, m_sys, s_sys; // intermediate time
clock_t start_clock, stop_clock; // clock ticks
time_t start_time, stop_time; // system time
char errname[filename_size];
public:
uhr( parameter &p );
void proc( void );
void sys( void );
void init( void );
void exit( void );
};
#endif
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.