text
stringlengths 4
6.14k
|
|---|
/****************************************************************************
**
** Copyright (C) 2017-2016 Ford Motor Company
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtRemoteObjects module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QNXIPCPRIVATE_GLOBAL_H
#define QNXIPCPRIVATE_GLOBAL_H
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists purely as an
// implementation detail. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#include <sys/neutrino.h>
#include <sys/dispatch.h>
#include <sys/siginfo.h>
#include <unistd.h> // provides SETIOV
#include <sys/netmgr.h> //FOR ND_LOCAL_NODE
#include <errno.h>
#include <QThread>
#ifdef USE_HAM
# include <ha/ham.h>
#endif
#define WARNING(cmd) qCWarning(QT_REMOTEOBJECT) << "Warning " #cmd << strerror(errno) \
<< Q_FUNC_INFO << __FILE__ << __LINE__;
#define WARN_ON_ERROR(cmd, ...) if (cmd(__VA_ARGS__) == -1) qCWarning(QT_REMOTEOBJECT) \
<< "Error " #cmd << strerror(errno) << Q_FUNC_INFO << __FILE__ << __LINE__;
#define WARN_AND_RETURN_ON_ERROR(cmd, retval, ...) if (cmd(__VA_ARGS__) == -1) \
{ qCWarning(QT_REMOTEOBJECT) << "Error " #cmd << strerror(errno) \
<< Q_FUNC_INFO << __FILE__ << __LINE__; return (retval); }
#define FATAL_ON_ERROR(cmd, ...) if (cmd(__VA_ARGS__) == -1) qFatal("Error %s: %s %s %s %d", \
#cmd, strerror(errno), Q_FUNC_INFO, __FILE__, __LINE__);
const int MAX_RETRIES = 3;
enum MsgType : uint16_t { REPLICA_INIT = _IO_MAX+100,
REPLICA_TX_RECV,
SOURCE_TX_RESP,
SOURCE_TX_RESP_REPEAT,
};
enum PulseType : uint8_t { SOURCE_TX_RQ = _PULSE_CODE_MINAVAIL+42,
REPLICA_WRITE,
TERMINATE,
NODE_DEATH
};
union recv_msgs
{
struct _pulse pulse;
uint16_t type;
};
template <typename T>
class Thread : public QThread
{
public:
Thread(T *obj, const QString &name = QString()) : QThread(), m_obj(obj)
{
if (!name.isEmpty())
setObjectName(name);
}
void run() override
{
m_obj->thread_func();
}
private:
T *m_obj;
};
#endif // QNXIPCPRIVATE_GLOBAL_H
|
#include "../../../../../src/charts/legend/qbarlegendmarker_p.h"
|
/*---
Flow*: A Taylor Model Based Flowpipe analyzer.
Authors: Xin Chen, Erika Abraham and Sriram Sankaranarayanan.
Email: Xin Chen <xin.chen@cs.rwth-aachen.de> if you have questions or comments.
The code is released as is under the GNU General Public License (GPL). Please consult the file LICENSE.txt for
further information.
---*/
#ifndef INTERVAL_H_
#define INTERVAL_H_
#include "include.h"
extern mpfr_prec_t intervalNumPrecision;
class Interval
{
private:
mpfr_t lo; // the lower bound
mpfr_t up; // the upper bound
public:
Interval();
Interval(const double c);
Interval(const double l, const double u);
Interval(const char *strLo, const char *strUp);
Interval(const Interval & I);
~Interval();
void set(const double l, const double u);
void set(const double c);
void setInf(const double l);
void setInf(const Interval & I);
void setSup(const double u);
void setSup(const Interval & S);
void split(Interval & left, Interval & right) const; // split the interval at the midpoint
void split(list<Interval> & result, const int n) const; // split the interval uniformly by n parts
void set_inf();
double sup() const;
double inf() const;
void sup(Interval & S) const;
void inf(Interval & I) const;
double midpoint() const;
void midpoint(Interval & M) const;
void remove_midpoint(Interval & M);
void bloat(const double e);
bool within(const Interval & I, const double e) const;
double width() const;
void width(Interval & W) const;
double mag() const; // max{|lo|,|up|}
void mag(Interval & M) const;
void abs(Interval & result) const;
void abs_assign(); // absolute value
bool subseteq(const Interval & I) const; // returns true if the interval is a subset of I
bool supseteq(const Interval & I) const; // returns true if the interval is a superset of I
bool valid() const;
bool operator == (const Interval & I) const;
bool operator != (const Interval & I) const;
bool operator > (const Interval & I) const; // lo > up
bool operator < (const Interval & I) const; // up < lo
bool operator <= (const Interval & I) const; // lo < lo
bool operator >= (const Interval & I) const; // up > up
bool smallereq(const Interval & I) const; // up <= lo
Interval & operator = (const Interval & I);
Interval & operator += (const Interval & I);
Interval & operator -= (const Interval & I);
Interval & operator *= (const Interval & I);
Interval & operator /= (const Interval & I);
Interval & operator ++ ();
Interval & operator -- ();
const Interval operator + (const Interval & I) const;
const Interval operator - (const Interval & I) const;
const Interval operator * (const Interval & I) const;
const Interval operator / (const Interval & I) const;
void sqrt(Interval & result) const; // square root
void inv(Interval & result) const; // additive inverse
void rec(Interval & result) const; // reciprocal
void sqrt_assign();
void inv_assign();
void rec_assign();
void add_assign(const double c);
void sub_assign(const double c);
void mul_assign(const double c);
void div_assign(const double c);
Interval pow(const unsigned int n) const;
Interval exp() const;
Interval sin() const;
Interval cos() const;
Interval log() const;
void pow_assign(const unsigned int n);
void exp_assign();
void sin_assign();
void cos_assign();
void log_assign();
double widthRatio(const Interval & I) const;
void toString(string & result) const;
void dump(FILE *fp) const;
void output(FILE *fp, const char * msg, const char * msg2) const;
};
#endif /* INTERVAL_H_ */
|
//
// Created by david on 2016-07-24.
//
#ifndef WL_COUNTERS_TIMERS_H
#define WL_COUNTERS_TIMERS_H
namespace counter {
//Counters
extern int MCS;
extern int walks;
extern int swaps;
extern int swap_accepts;
extern int merges;
};
namespace timer {
extern int increment;
extern int add_hist_volume;
extern int check_finish_line;
extern int check_saturation;
extern int backup;
extern int print;
extern int swap;
extern int sync_team;
extern int setup_team;
extern int divide_range;
extern int sampling;
}
#endif //WL_COUNTERS_TIMERS_H
|
/*
droid vnc server - Android VNC server
Copyright (C) 2011 Jose Pereira <onaips@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <dlfcn.h>
#include "flinger.h"
#include "common.h"
void *flinger_lib = NULL;
close_fn_type close_flinger = NULL;
readfb_fn_type readfb_flinger = NULL;
checkfb_fn_type checkfb_flinger = NULL;
getscreenformat_fn_type getscreenformat_flinger = NULL;
int initFlinger(void)
{
L("--Loading flinger native lib--\n");
int i,len;
char lib_name[64];
sprintf(lib_name, DVNC_LIB_PATH "/libdvnc_flinger_sdk.so");
// 1. Open lib
flinger_lib = dlopen(lib_name, RTLD_NOW);
if (flinger_lib == NULL) {
L("Couldnt load flinger library %s! Error string: %s\n", lib_name, dlerror());
return -1;
}
// 2. Bind functions
init_fn_type init_flinger = dlsym(flinger_lib,"init_flinger");
if (init_flinger == NULL) {
L("Couldn't load init_flinger! Error string: %s\n", dlerror());
return -1;
}
close_flinger = dlsym(flinger_lib,"close_flinger");
if (close_flinger == NULL) {
L("Couldn't load close_flinger! Error string: %s\n", dlerror());
return -1;
}
readfb_flinger = dlsym(flinger_lib,"readfb_flinger");
if (readfb_flinger == NULL) {
L("Couldn't load readfb_flinger! Error string: %s\n", dlerror());
return -1;
}
checkfb_flinger = dlsym(flinger_lib,"checkfb_flinger");
if (checkfb_flinger == NULL) {
L("Couldn't load checkfb_flinger! Error string: %s\n", dlerror());
return -1;
}
getscreenformat_flinger = dlsym(flinger_lib,"getscreenformat_flinger");
if (getscreenformat_flinger == NULL) {
L("Couldn't load get_screenformat! Error string: %s\n", dlerror());
return -1;
}
int ret = init_flinger();
if (ret == -1) {
L("flinger method not supported by this device!\n");
return -1;
}
screenformat = getScreenFormatFlinger();
if (screenformat.width <= 0) {
L("Error: I have received a bad screen size from flinger.\n");
return -1;
}
if (checkBufferFlinger() == NULL) {
L("Error: Could not read surfaceflinger buffer!\n");
return -1;
}
return 0;
}
screenFormat getScreenFormatFlinger(void)
{
screenFormat f;
memset(&f, 0, sizeof(f));
if (getscreenformat_flinger)
f = getscreenformat_flinger();
return f;
}
void closeFlinger(void)
{
if (close_flinger)
close_flinger();
if (flinger_lib)
dlclose(flinger_lib);
}
unsigned char *readBufferFlinger(int saveAsPng)
{
if (readfb_flinger)
return readfb_flinger(saveAsPng);
return NULL;
}
unsigned char *checkBufferFlinger(void)
{
if (checkfb_flinger)
return checkfb_flinger();
return NULL;
}
|
/////////////////////////////////////////////////////////////////////////////////
//
// jHako
// Copyright (C) 2014-2015 Komatsu Yuji(Zheng Chuyu)
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
/////////////////////////////////////////////////////////////////////////////////
#ifndef JHAKO_JHKWSMAN_H
#define JHAKO_JHKWSMAN_H
#include <wsman-api.h>
#include "jobresult.h"
#define XML_NS_RSP "http://schemas.microsoft.com/wbem/wsman/1/windows/shell"
#define XML_NSDATA_RSP "rsp"
#define XML_NS_P "http://schemas.microsoft.com/wbem/wsman/1/wsman.xsd"
#define XML_NSDATA_P "p"
#define XML_NS_CFG "http://schemas.microsoft.com/wbem/wsman/1/config"
#define XML_NSDATA_CFG "cfg"
#define RESOURCE_URI_CMD "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd"
#define ACTION_COMMAND "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Command"
#define ACTION_RECEIVE "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Receive"
#define ACTION_SIGNAL "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/Signal"
#define ACTION_DELETE "http://schemas.xmlsoap.org/ws/2004/09/transfer/Delete"
#define RSP_CODE "http://schemas.microsoft.com/wbem/wsman/1/windows/shell/signal/terminate"
#define XML_LANG "xml:lang"
#define MS_WORKING_DIRECTORY "WorkingDirectory"
#define MS_IDLE_TIME_OUT "IdleTimeOut"
#define MS_SHELL "Shell"
#define MS_INPUT_STREAMS "InputStreams"
#define MS_OUTPUT_STREAMS "OutputStreams"
#define MS_DATA_LOCALE "DataLocale"
#define MS_COMMAND_LINE "CommandLine"
#define MS_COMMAND "Command"
#define MS_RECEIVE "Receive"
#define MS_DESIRED_STREAM "DesiredStream"
#define MS_SIGNAL "Signal"
#define MS_CODE "Code"
#define JHK_WSMAN_SIZE 256
typedef struct {
WsManClient *client;
char shell_id[JHK_WSMAN_SIZE];
char command_id[JHK_WSMAN_SIZE];
int command_done;
char errmsg[JHK_WSMAN_SIZE];
} jhkwsman_t;
jhkwsman_t *jhkwsman_new(void);
void jhkwsman_destroy(jhkwsman_t * obj);
int jhkwsman_init(jhkwsman_t * obj);
int jhkwsman_set(jhkwsman_t * obj, const char *username,
const char *password, const char *scheme,
const char *host, const int port, const char *path,
const char *auth);
WsXmlDocH jhkwsman_send(jhkwsman_t * obj, WsXmlDocH request);
int jhkwsman_soap_header(jhkwsman_t * obj, WsXmlDocH doc,
const char *action, const char *resource_uri,
const char *shell_id, const char *message_id);
int jhkwsman_open_shell(jhkwsman_t * obj, const char *i_stream,
const char *o_stream,
const char *working_directory,
const char *env_vars, const char *noprofile,
const int codepage, const char *idle_timeout);
int jhkwsman_run_command(jhkwsman_t * obj, const char *command,
const char *console_mode_stdin,
const char *skip_cmd_shell);
int jhkwsman_raw_get_command_output(jhkwsman_t * obj,
jobresult_t * obj_jobres,
const int codepage);
int jhkwsman_get_command_output(jhkwsman_t * obj, jobresult_t * obj_jobres,
const int codepage);
int jhkwsman_cleanup_command(jhkwsman_t * obj);
int jhkwsman_close_shell(jhkwsman_t * obj);
int jhkwsman_exec(jhkwsman_t * obj, jobresult_t * obj_jobres,
const char *command, const int codepage);
#endif
|
#ifndef _GUI_H
#define _GUI_H
// generic gui definitions
#include "gui_ext.h"
// use the terminal shell
#include "gui_terminal.h"
#endif
|
/******************************************************************************
* Copyright 2010 Emma Goldberg
*
* This file is part of SimTreeSDD.
*
* SimTreeSDD 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.
*
* SimTreeSDD 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 SimTreeSDD. If not, see <http://www.gnu.org/licenses/>.
******************************************************************************/
#ifndef __NODES_H__
#define __NODES_H__
/*******************************************************************************
* management of the tree nodes themselves
* define what's in a node
* create a node
* destroy a node
* free all nodes in a tree
******************************************************************************/
typedef struct tnode
{
double time, length;
struct tnode *left, *right, *anc;
int index, trait;
double atime; // for absolute ages
int ptrait; // for 2regions and allopatric speciation
} TreeNode;
TreeNode *NewNode(TreeNode *ancestor, double t);
TreeNode *FreeNode(TreeNode *here);
void FreeTree(TreeNode *p);
/*******************************************************************************
* information about a tree (a collection of nodes)
******************************************************************************/
typedef struct
{
TreeNode *root;
double *node_times; // can point to an array containing node times
double start_t; // time of root
double end_t; // time of tips
int n_tips; // # of tips (# of internal nodes = n_tips-1)
int n_param;
char *name;
} TreeInfo;
TreeInfo *NewTreeInfo();
void FreeTreeInfo(TreeInfo *tree);
#endif
|
/*****
*
* Description: File Handling Function Headers
*
* Copyright (c) 2010-2017, Ron Dilley
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
****/
#ifndef FILEHANDLERS_DOT_H
#define FILEHANDLERS_DOT_H
/****
*
* defines
*
****/
#define FORMAT_VERSION "1"
#define MD5_HASH_LEN 16
#define SHA256_HASH_LEN 32
#define TIME_DATE_LEN 22
/****
*
* includes
*
****/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <sysdep.h>
#ifndef __SYSDEP_H__
# error something is messed up
#endif
#include <stdio.h>
#include <common.h>
#include "util.h"
#include "mem.h"
#include "hash.h"
#include "md5.h"
#include "parser.h"
#include "processDir.h"
#if ! defined HAVE_FTW && ! defined HAVE_NFTW
# include "noftw.h"
#endif
/****
*
* consts & enums
*
****/
/****
*
* typedefs & structs
*
****/
/****
*
* function prototypes
*
****/
int writeRecord2File( const struct hashRec_s *hashRec );
int writeDirHash2File( const struct hash_s *dirHash, const char *base, const char *outFile );
int loadFile( const char *fName );
int loadV1File( FILE *inFile );
int loadV2File( FILE *inFile );
int loadExclusions( char *fName );
#endif /* FILEHANDLERS_DOT_H */
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2016-2017 - Gregor Richards
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __RARCH_NETPLAY_DISCOVERY_H
#define __RARCH_NETPLAY_DISCOVERY_H
#include <net/net_compat.h>
#include <net/net_ifinfo.h>
#include <retro_miscellaneous.h>
#define NETPLAY_HOST_STR_LEN 32
#define NETPLAY_HOST_LONGSTR_LEN 256
enum rarch_netplay_discovery_ctl_state
{
RARCH_NETPLAY_DISCOVERY_CTL_NONE = 0,
RARCH_NETPLAY_DISCOVERY_CTL_LAN_SEND_QUERY,
RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES,
RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES
};
struct netplay_host
{
struct sockaddr addr;
socklen_t addrlen;
char address[NETPLAY_HOST_STR_LEN];
char nick[NETPLAY_HOST_STR_LEN];
char frontend[NETPLAY_HOST_STR_LEN];
char core[NETPLAY_HOST_STR_LEN];
char core_version[NETPLAY_HOST_STR_LEN];
char retroarch_version[NETPLAY_HOST_STR_LEN];
char content[NETPLAY_HOST_LONGSTR_LEN];
int content_crc;
int port;
};
struct netplay_host_list
{
struct netplay_host *hosts;
size_t size;
};
enum netplay_host_method
{
NETPLAY_HOST_METHOD_UNKNOWN = 0,
NETPLAY_HOST_METHOD_MANUAL,
NETPLAY_HOST_METHOD_UPNP,
NETPLAY_HOST_METHOD_MITM
};
struct netplay_room
{
char nickname [PATH_MAX_LENGTH];
char address [PATH_MAX_LENGTH];
char mitm_address[PATH_MAX_LENGTH];
int port;
int mitm_port;
char corename [PATH_MAX_LENGTH];
char frontend [PATH_MAX_LENGTH];
char coreversion [PATH_MAX_LENGTH];
char gamename [PATH_MAX_LENGTH];
int gamecrc;
int timestamp;
int host_method;
bool has_password;
bool has_spectate_password;
bool lan;
bool fixed;
char retroarch_version[PATH_MAX_LENGTH];
char country[PATH_MAX_LENGTH];
struct netplay_room *next;
};
extern struct netplay_room *netplay_room_list;
extern int netplay_room_count;
/** Initialize Netplay discovery */
bool init_netplay_discovery(void);
/** Deinitialize and free Netplay discovery */
void deinit_netplay_discovery(void);
/** Discovery control */
bool netplay_discovery_driver_ctl(enum rarch_netplay_discovery_ctl_state state, void *data);
#endif
|
#include <nibobee/iodefs.h>
#include <nibobee/led.h>
#include <nibobee/sens.h>
int main() {
led_init(); // LED IO initialisieren
sens_init(); // Odometriesensor IO initialisieren
while (1 == 1) {
int8_t status_L = sens_getLeft();
// Linke LEDs ein- oder ausschalten,
// abhängig vom Status des linken Fühlers
switch (status_L) {
case -1: led_set(LED_L_RD, 0); led_set(LED_L_YE, 1);
break;
case +1: led_set(LED_L_RD, 1); led_set(LED_L_YE, 0);
break;
default: led_set(LED_L_RD, 0); led_set(LED_L_YE, 0);
break;
}
int8_t status_R = sens_getRight();
// Rechte LEDs ein- oder ausschalten,
// abhängig vom Status des rechten Fühlers
switch (status_R) {
case -1: led_set(LED_R_RD, 0); led_set(LED_R_YE, 1);
break;
case +1: led_set(LED_R_RD, 1); led_set(LED_R_YE, 0);
break;
default: led_set(LED_R_RD, 0); led_set(LED_R_YE, 0);
break;
}
}
return 0;
}
|
/*
The proceeding code was authored by:
d88b d8888b. db db d88888b .d8888. .d8888.
`8P' 88 `8D 88 88 88' 88' YP 88' YP
88 88 88 88ooo88 88ooooo `8bo. `8bo.
88 88 88 88~~~88 88~~~~~ `Y8b. `Y8b.
db. 88 88 .8D 88 88 88. db 8D db 8D
Y8888P Y8888D' YP YP Y88888P `8888Y' `8888Y'
Created for the fulfillment of the requirements for CS460 and should hereafter be considered to be released to the public domain under the terms of the GNU GPL version 3.
*/
//Prog#:8
//Name: Hess,Jared
//WSUID: N575U698
//Email: jdhess@wichita.edu
//Notes for the grader:
//Program must be compiled with the "-std=c99" option. For example:
//gcc -Wall -std=c99 prog8.c
//Also, currently the program is only set for 10k numbers instead of the 100k requested so it runs in a reasonable time on my computer.
//If you want to change this value, you can change the global "size" variable.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include <sys/time.h>
int size = 100000;
//Required Function Prototypes
char UserMenu( char *opt ); /* display menu and receive option */
void PopulateArrayDes( int *A ); /* populate array A in descending order */
void CopyArrays( int *A1, int *A2 ); /* copy array A1 into array A2 */
void DisplayArray10Items( int *A ); /* display the first 10 items in array A */
void ShellSortAsc( int *B ); /* sort array B in ascending order using bubble sort algorithm */
void HeapSortAsc( int *I ); /* sort array I in ascending order using insertion sort algorithm */
int CalculateTimeSS( int *A ); /* return the time needed to bubble sort an unsorted array A */
int CalculateTimeHS( int *A ); /* return the time needed to insertion sort an unsorted array A */
void ExitProg( void ); /* normal exit */
//Mine
void siftDown( int *I, int start, int end);
int main()
{
//Do something
int desArray[size];//Our Descending numbers to sort
int myArray[size];//Array for working with stuff
char choice = '0';
while (choice != '1'){
UserMenu(&choice);
switch(choice){
case '2': PopulateArrayDes(myArray);break;
case '3': CopyArrays(desArray,myArray);break;
case '4': DisplayArray10Items(myArray);break;
case '5': ShellSortAsc(myArray);break;
case '6': ShellSortAsc(myArray);break;
case '7': CalculateTimeSS(myArray);break;
case '8': CalculateTimeSS(myArray);break;
}//switch
}//while
ExitProg();
return 0;
}
char UserMenu( char *opt ) /* display menu and receive option */
{
char buffer[100];
printf("1) Exit\n");
printf("2) Populate array\n");
printf("3) Copy array\n");
printf("4) Display array (first 10 items)\n");
printf("5) Shell Sort Ascending\n");
printf("6) Heap Sort Ascending\n");
printf("7) Calculate Time for Shell Sort\n");
printf("8) Calculate Time for Heap Sort\n");
printf("Enter Selection: ");
scanf("%s",buffer);
*opt = buffer[0];
return buffer[0];
}
void PopulateArrayDes( int *A ) /* populate array A in descending order */
{
for(int i = 0; i<size; i++){
A[i] = size - i;
}
return;
}
void CopyArrays( int *A1, int *A2 ) /* copy array A1 into array A2 */
{
memcpy( A1, A2, size*sizeof(int));
return;
}
void DisplayArray10Items( int *A ) /* display the first 10 items in array A */
{
for(int i = 0; i < 10; i++){
printf("%i\n",A[i]);
}
return;
}
void ShellSortAsc( int *B ) /* sort array B in ascending order using shell sort algorithm */
{
int gapSeq[]={1,4,10,23,57,132,301,701};
int gapSize=sizeof(gapSeq)/sizeof(gapSeq[0]);
int currentGap,currentSeq;
for(currentSeq = gapSize-1; currentSeq>=0; currentSeq--){
int key,i,j;
currentGap = gapSeq[currentSeq];
for(i = 1; i*currentGap < size; i++){
key = B[i*currentGap];
for(j = i-1; (j >= 0) && (B[j*currentGap] > key); j--){
B[(j+1)*currentGap]=B[j*currentGap];
}
B[(j+1)*currentGap]=key;
}
}
return;
}
void HeapSortAsc( int *I ) /* sort array I in ascending order using heap sort algorithm */
{
int i, tmp;
//Make a heap!
//Heapify
for (i = (size-2)/2; i >=0; i--)
siftDown(I,i,size);
for (i = size-1; i >= 1; i--){
tmp = I[0];
I[0] = I[i];
I[i] = tmp;
siftDown(I,0,i);
}
return;
}
void siftDown( int *I, int start, int end)
{
int done, maxChild,tmp;
done = 0;
while((start*2 <= end) && !done){
if(start*2 <= end)
maxChild = start*2;
else if (I[start*2] > I[start*2+1])
maxChild = start*2;
else
maxChild = start*2+1;
if (I[start] < I[maxChild]){
tmp = I[start];
I[start] = I[maxChild];
I[maxChild] = tmp;
start = maxChild;
}
else
done = 1;
}
return;
}
int CalculateTimeSS( int *A ) /* return the time needed to bubble sort an unsorted array A */
{
//Local Declarations
struct timeval tim; //Time struct that allows us to use usec
PopulateArrayDes(A);//Make sure it's unsorted
//Get time before sort
gettimeofday(&tim,NULL);
double t1 = tim.tv_sec+(tim.tv_usec/1000000.0); //Convert to fractional seconds
ShellSortAsc(A);//Sort
//Time after sort
gettimeofday(&tim,NULL);
double t2 = tim.tv_sec+(tim.tv_usec/1000000.0); //Convert to fractional seconds
printf("Before: %.6lf seconds since epoch\n",t1);
printf("After: %.6lf seconds since epoch\n",t2);
printf("Running time: %.6lf seconds\n",t2-t1);
return 1;
}
int CalculateTimeHS( int *A ) /* return the time needed to insertion sort an unsorted array A */
{ //Local Declarations
struct timeval tim; //Time struct that allows us to use usec
PopulateArrayDes(A);//Make sure it's unsorted
//Get time before sort
gettimeofday(&tim,NULL);
double t1 = tim.tv_sec+(tim.tv_usec/1000000.0); //Convert to fractional seconds
HeapSortAsc(A);//Sort
//Time after sort
gettimeofday(&tim,NULL);
double t2 = tim.tv_sec+(tim.tv_usec/1000000.0); //Convert to fractional seconds
printf("Before: %.6lf seconds since epoch\n",t1);
printf("After: %.6lf seconds since epoch\n",t2);
printf("Running time: %.6lf seconds\n",t2-t1);
return 1;
}
void ExitProg( void ) /* normal exit */
{
//Do nothing
return;
}
|
/*
* Empire - A multi-player, client/server Internet based war game.
* Copyright (C) 1986-2017, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* ---
*
* See files README, COPYING and CREDITS in the root of the source
* tree for related information and legal notices. It is expected
* that future projects/authors will amend these files as needed.
*
* ---
*
* mobility.c: Add mobility to each of the items which accumulate mobility.
*
* Known contributors to this file:
* Dave Pare, 1986
* Steve McClure, 1998-1999
* Markus Armbruster, 2004-2016
*/
#include <config.h>
#include "game.h"
#include "land.h"
#include "optlist.h"
#include "plane.h"
#include "sect.h"
#include "ship.h"
#include "update.h"
/* Increase mobility of everything for @etus ETUs, update timestamps */
void
mob_inc_all(int etus)
{
struct sctstr *sectp;
struct shpstr *sp;
struct plnstr *pp;
struct lndstr *lp;
int i;
time_t now;
time(&now);
for (i = 0; (sectp = getsectid(i)); i++) {
sectp->sct_timestamp = now;
if (!opt_MOB_ACCESS)
mob_inc_sect(sectp, etus);
}
for (i = 0; (sp = getshipp(i)); i++) {
sp->shp_timestamp = now;
if (!opt_MOB_ACCESS)
mob_inc_ship(sp, etus);
}
for (i = 0; (pp = getplanep(i)); i++) {
pp->pln_timestamp = now;
if (!opt_MOB_ACCESS)
mob_inc_plane(pp, etus);
}
for (i = 0; (lp = getlandp(i)); i++) {
lp->lnd_timestamp = now;
if (!opt_MOB_ACCESS)
mob_inc_land(lp, etus);
}
}
/* Increase @sp's mobility for @etus ETUs */
void
mob_inc_sect(struct sctstr *sp, int etus)
{
int value;
if (CANT_HAPPEN(etus < 0))
etus = 0;
if (sp->sct_own == 0)
return;
if (sp->sct_type == SCT_WATER || sp->sct_type == SCT_SANCT)
return;
value = sp->sct_mobil + ((float)etus * sect_mob_scale);
if (value > sect_mob_max)
value = sect_mob_max;
sp->sct_mobil = value;
}
/* Increase @sp's mobility for @etus ETUs */
void
mob_inc_ship(struct shpstr *sp, int etus)
{
int value;
if (CANT_HAPPEN(etus < 0))
etus = 0;
if (sp->shp_own == 0)
return;
value = sp->shp_mobil + (float)etus * ship_mob_scale;
if (value > ship_mob_max)
value = ship_mob_max;
sp->shp_mobil = (signed char)value;
}
/* Increase @lp's mobility for @etus ETUs */
void
mob_inc_land(struct lndstr *lp, int etus)
{
int value;
if (CANT_HAPPEN(etus < 0))
etus = 0;
if (lp->lnd_own == 0)
return;
value = lp->lnd_mobil + ((float)etus * land_mob_scale);
if (value > land_mob_max) {
if (lp->lnd_harden < land_mob_max && !opt_MOB_ACCESS) {
/*
* Automatic fortification on excess mobility.
* Disabled for MOB_ACCESS, because it leads to
* excessively deep recursion and thus miserable
* performance as the number of land units grows.
*
* Provide mobility to be used in lnd_fortify()
* without overflowing lnd_mobil.
*/
lp->lnd_mobil = land_mob_max;
lnd_fortify(lp, value - land_mob_max);
}
value = land_mob_max;
}
lp->lnd_mobil = value;
}
/* Increase @pp's mobility for @etus ETUs */
void
mob_inc_plane(struct plnstr *pp, int etus)
{
int value;
if (CANT_HAPPEN(etus < 0))
etus = 0;
if (pp->pln_own == 0)
return;
value = pp->pln_mobil + ((float)etus * plane_mob_scale);
if (value > plane_mob_max)
value = plane_mob_max;
pp->pln_mobil = value;
}
/*
* Credit the turn's remaining MOB_ACCESS mobility.
* Exactly as if everything was accessed right now.
*/
void
mob_access_all(void)
{
struct sctstr *sectp;
struct shpstr *sp;
struct plnstr *pp;
struct lndstr *lp;
int i;
if (CANT_HAPPEN(!opt_MOB_ACCESS))
return;
for (i = 0; (sectp = getsectid(i)); i++)
mob_inc_sect(sectp, game_reset_tick(§p->sct_access));
for (i = 0; (sp = getshipp(i)); i++)
mob_inc_ship(sp, game_reset_tick(&sp->shp_access));
for (i = 0; (pp = getplanep(i)); i++)
mob_inc_plane(pp, game_reset_tick(&pp->pln_access));
for (i = 0; (lp = getlandp(i)); i++)
mob_inc_land(lp, game_reset_tick(&lp->lnd_access));
}
|
// This is the first sentence.
// This is the second sentence.
// This is the third sentence.
//
// <table attribute="value">
// <tr>
// <td>Aha!</td>
// </tr>
// </table>
//
// This is the fourth sentence.
// This is the fifth sentence.
// This is the sixth sentence.
|
#include <zconf.h>
#include "openrmpriv.h"
#include "stringbuilder.h"
void ormpriv_HandleRubyError()
{
ormutil_StringBuilder sb = ormutil_StringBuilderCreate();
VALUE exception = rb_errinfo();
VALUE inspect = rb_funcall(exception,rb_intern("inspect"),0);
VALUE backtrace = rb_funcall(exception,rb_intern("backtrace"),0);
SBCAT(sb,StringValuePtr(inspect));
SBCAT(sb,"\n--- Backtrace ---\n");
for(int i = 0;i < RARRAY_LEN(backtrace);i++)
{
VALUE backtraceItem = rb_ary_entry(backtrace,i);
SBCAT(sb,StringValuePtr(backtraceItem));
SBCAT(sb,"\n");
}
ormpriv_SendEvent(ORMRubyError,(void*)ormutil_StringBuilderGetString(sb));
ormutil_StringBuilderFree(sb);
}
void ormpriv_SendEvent(ORMEvent type, void *data)
{
if(eventCb != NULL) eventCb(type,data);
}
VALUE ormpriv_CallLoadGameProject(VALUE arg)
{
return rb_funcall(Qnil,rb_intern("__OpenRM_LoadGameProject"),1,rb_str_new2(gameDir));
}
VALUE ormpriv_ChangeDirectory(VALUE dir)
{
//chdir(StringValuePtr(dir));
// FIXME:dir is nil?!
chdir(gameDir); // FIXME:TEMP
return Qnil;
}
|
/*
* QArv, a Qt interface to aravis.
* Copyright (C) 2012-2014 Jure Varlec <jure.varlec@ad-vega.si>
* Andrej Lajovic <andrej.lajovic@ad-vega.si>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BAYERGB8_H
#define BAYERGB8_H
extern "C" {
#include <arv.h>
}
#include "api/qarvdecoder.h"
#include <QDataStream>
#include <opencv2/imgproc/imgproc.hpp>
// Some formats appeared only after aravis-0.2.0, so
// we check for their presence. The 12_PACKED formats
// were added individually.
namespace QArv {
class BayerGB8 : public QObject, public QArvPixelFormat
{
Q_OBJECT
Q_INTERFACES(QArvPixelFormat)
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QArvPixelFormat")
public:
ArvPixelFormat pixelFormat() { return ARV_PIXEL_FORMAT_BAYER_GB_8; }
QArvDecoder* makeDecoder(QSize size)
{
return new BayerDecoder<ARV_PIXEL_FORMAT_BAYER_GB_8>(size);
}
};
}
#endif
|
/*
* This file is part of the Black Magic Debug project.
*
* Copyright (C) 2011 Black Sphere Technologies Ltd.
* Written by Gareth McMullin <gareth@blacksphere.co.nz>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* This file implements the SW-DP specific functions of the
* ARM Debug Interface v5 Architecure Specification, ARM doc IHI0031A.
*/
#include "general.h"
#include "adiv5.h"
#include "swdptap.h"
#include "jtagtap.h"
#include "command.h"
#include "morse.h"
#define SWDP_ACK_OK 0x01
#define SWDP_ACK_WAIT 0x02
#define SWDP_ACK_FAULT 0x04
static uint32_t adiv5_swdp_read(ADIv5_DP_t *dp, uint16_t addr);
static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp);
static uint32_t adiv5_swdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
uint16_t addr, uint32_t value);
int adiv5_swdp_scan(void)
{
uint8_t ack;
target_list_free();
ADIv5_DP_t *dp = (void*)calloc(1, sizeof(*dp));
swdptap_init();
if(connect_assert_srst)
jtagtap_srst(true); /* will be deasserted after attach */
/* Read the SW-DP IDCODE register to syncronise */
/* This could be done with adiv_swdp_low_access(), but this doesn't
* allow the ack to be checked here. */
swdptap_seq_out(0xA5, 8);
ack = swdptap_seq_in(3);
if((ack != SWDP_ACK_OK) || swdptap_seq_in_parity(&dp->idcode, 32)) {
DEBUG("\n");
morse("NO TARGETS.", 1);
free(dp);
return -1;
}
dp->dp_read = adiv5_swdp_read;
dp->error = adiv5_swdp_error;
dp->low_access = adiv5_swdp_low_access;
adiv5_swdp_error(dp);
adiv5_dp_init(dp);
if(!target_list) morse("NO TARGETS.", 1);
else morse(NULL, 0);
return target_list?1:0;
}
static uint32_t adiv5_swdp_read(ADIv5_DP_t *dp, uint16_t addr)
{
if (addr & ADIV5_APnDP) {
adiv5_dp_low_access(dp, ADIV5_LOW_READ, addr, 0);
return adiv5_dp_low_access(dp, ADIV5_LOW_READ,
ADIV5_DP_RDBUFF, 0);
} else {
return adiv5_swdp_low_access(dp, ADIV5_LOW_READ, addr, 0);
}
}
static uint32_t adiv5_swdp_error(ADIv5_DP_t *dp)
{
uint32_t err, clr = 0;
err = adiv5_swdp_read(dp, ADIV5_DP_CTRLSTAT) &
(ADIV5_DP_CTRLSTAT_STICKYORUN | ADIV5_DP_CTRLSTAT_STICKYCMP |
ADIV5_DP_CTRLSTAT_STICKYERR | ADIV5_DP_CTRLSTAT_WDATAERR);
if(err & ADIV5_DP_CTRLSTAT_STICKYORUN)
clr |= ADIV5_DP_ABORT_ORUNERRCLR;
if(err & ADIV5_DP_CTRLSTAT_STICKYCMP)
clr |= ADIV5_DP_ABORT_STKCMPCLR;
if(err & ADIV5_DP_CTRLSTAT_STICKYERR)
clr |= ADIV5_DP_ABORT_STKERRCLR;
if(err & ADIV5_DP_CTRLSTAT_WDATAERR)
clr |= ADIV5_DP_ABORT_WDERRCLR;
adiv5_dp_write(dp, ADIV5_DP_ABORT, clr);
dp->fault = 0;
return err;
}
static uint32_t adiv5_swdp_low_access(ADIv5_DP_t *dp, uint8_t RnW,
uint16_t addr, uint32_t value)
{
bool APnDP = addr & ADIV5_APnDP;
addr &= 0xff;
uint8_t request = 0x81;
uint32_t response;
uint8_t ack;
if(APnDP && dp->fault) return 0;
if(APnDP) request ^= 0x22;
if(RnW) request ^= 0x24;
addr &= 0xC;
request |= (addr << 1) & 0x18;
if((addr == 4) || (addr == 8))
request ^= 0x20;
size_t tries = 1000;
do {
swdptap_seq_out(request, 8);
ack = swdptap_seq_in(3);
} while(--tries && ack == SWDP_ACK_WAIT);
if (dp->allow_timeout && (ack == SWDP_ACK_WAIT))
return 0;
if(ack == SWDP_ACK_FAULT) {
dp->fault = 1;
return 0;
}
if(ack != SWDP_ACK_OK) {
/* Fatal error if invalid ACK response */
PLATFORM_FATAL_ERROR(1);
}
if(RnW) {
if(swdptap_seq_in_parity(&response, 32)) /* Give up on parity error */
PLATFORM_FATAL_ERROR(1);
} else {
swdptap_seq_out_parity(value, 32);
}
/* REMOVE THIS */
swdptap_seq_out(0, 8);
return response;
}
|
#define static_assert(a, b) _Static_assert(a, b)
#define SA(a) static_assert(a, #a)
enum {
F = 1,
B = F + 1,
SA(F > B)
};
SA(F > B);
int main(void)
{
return 0;
}
|
/*
* puk_switch.h
*
* Created on: 19.10.2016
* Author: abr468
*/
#ifndef PUK_SWITCH_H_
#define PUK_SWITCH_H_
#include "hal_component.h"
#include <pthread.h>
#include <stdint.h>
/**
*
*/
class Puk_switch:Hal_component{
public:
/*
* Opens the Puk-Switch
*/
void open();
/*
* Closes the Puk-Switch
*/
void close();
/*
* Returns the pointer of the instance
* @return
*/
static Puk_switch* get_instance();
~Puk_switch();
private:
static pthread_mutex_t init_mtx;
static Puk_switch* instance_;
Puk_switch();
uint16_t BASE;
uint8_t OPEN_BIT;
};
#endif /* PUK_SWITCH_H_ */
|
#ifndef SM_HW_MOTOR_H
#define SM_HW_MOTOR_H
#include "sm_hal_abstract_gpio.h"
#include "sm_hal_sys_timer.h"
#include "sm_hw_powermgr.h"
#include "sm_hw_keyboard.h"
/// @brief Vibration motor control
class SmHwMotor: public SmHalSysTimerIface, public SmHwPowerMgrIface
{
public:
/// @brief Initialize motor control GPIO and subscribe to the system timer events
SmHwMotor();
void startNotification(uint32_t pattern, uint8_t pulses);
void stopNotification(void);
private:
void onTimer(uint32_t timeStamp);
void onSleep(void);
void onWake(uint32_t wakeSource);
SmHalAbstractGpio * mGpio;
inline void enable(void) { mGpio->setPin(); }
inline void disable(void) { mGpio->resetPin(); }
uint32_t mPattern;
uint32_t mLength;
};
#endif // SM_HW_MOTOR_H
|
/*
* Library header for busybox/Bled
*
* Rewritten for Bled (Base Library for Easy Decompression)
* Copyright © 2014-2015 Pete Batard <pete@akeo.ie>
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
/* Memory leaks detection - define _CRTDBG_MAP_ALLOC as preprocessor macro */
#ifdef _CRTDBG_MAP_ALLOC
#include <stdlib.h>
#include <crtdbg.h>
#endif
#ifndef LIBBB_H
#define LIBBB_H 1
#ifndef _WIN32
#error Only Windows platforms are supported
#endif
#include "platform.h"
#include "msapi_utf8.h"
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <stddef.h>
#include <string.h>
#include <time.h>
#include <direct.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <io.h>
#ifdef BUFSIZ
#undef BUFSIZ
#endif
#define BUFSIZ 65536
#define IF_DESKTOP(x) x
#define IF_NOT_DESKTOP(x)
#define IF_NOT_FEATURE_LZMA_FAST(x) x
#define uoff_t unsigned off_t
#define OFF_FMT "I64"
#ifndef _MODE_T_
#define _MODE_T_
typedef unsigned short mode_t;
#endif
#ifndef _PID_T_
#define _PID_T_
typedef int pid_t;
#endif
#ifndef _GID_T_
#define _GID_T_
typedef unsigned int gid_t;
#endif
#ifndef _UID_T_
#define _UID_T_
typedef unsigned int uid_t;
#endif
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef MAX
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef PATH_MAX
#define PATH_MAX MAX_PATH
#endif
#ifndef get_le64
#define get_le64(ptr) (*(const uint64_t *)(ptr))
#endif
#ifndef get_le32
#define get_le32(ptr) (*(const uint32_t *)(ptr))
#endif
#ifndef get_le16
#define get_le16(ptr) (*(const uint16_t *)(ptr))
#endif
extern smallint bb_got_signal;
extern uint32_t *global_crc32_table;
extern jmp_buf bb_error_jmp;
uint32_t* crc32_filltable(uint32_t *crc_table, int endian);
uint32_t crc32_le(uint32_t crc, unsigned char const *p, size_t len, uint32_t *crc32table_le);
uint32_t crc32_be(uint32_t crc, unsigned char const *p, size_t len, uint32_t *crc32table_be);
#define crc32_block_endian0 crc32_le
#define crc32_block_endian1 crc32_be
#if defined(_MSC_VER)
#if _FILE_OFFSET_BITS == 64
#define stat _stat32i64
#define lseek _lseeki64
#else
#define stat _stat32
#define lseek _lseek
#endif
#endif
typedef struct _llist_t {
struct _llist_t *link;
char *data;
} llist_t;
extern void (*bled_printf) (const char* format, ...);
extern void (*bled_progress) (const uint64_t processed_bytes);
extern unsigned long* bled_cancel_request;
#define xfunc_die() longjmp(bb_error_jmp, 1)
#define bb_printf(...) do { if (bled_printf != NULL) bled_printf(__VA_ARGS__); \
else { printf(__VA_ARGS__); putchar('\n'); } } while(0)
#define bb_error_msg(...) bb_printf("Error: " __VA_ARGS__)
#define bb_error_msg_and_die(...) do {bb_error_msg(__VA_ARGS__); xfunc_die();} while(0)
#define bb_error_msg_and_err(...) do {bb_error_msg(__VA_ARGS__); goto err;} while(0)
#define bb_perror_msg bb_error_msg
#define bb_perror_msg_and_die bb_error_msg_and_die
#define bb_putchar putchar
static inline void *xrealloc(void *ptr, size_t size) {
void *ret = realloc(ptr, size);
if (!ret)
free(ptr);
return ret;
}
#define bb_msg_read_error "read error"
#define bb_msg_write_error "write error"
#define bb_mode_string(mode) "[not implemented]"
#define bb_copyfd_exact_size(fd1, fd2, size) bb_error_msg("Not implemented")
#define bb_make_directory(path, mode, flags) SHCreateDirectoryExU(NULL, path, NULL)
static inline int link(const char *oldpath, const char *newpath) {errno = ENOSYS; return -1;}
static inline int symlink(const char *oldpath, const char *newpath) {errno = ENOSYS; return -1;}
static inline int chown(const char *path, uid_t owner, gid_t group) {errno = ENOSYS; return -1;}
static inline int mknod(const char *pathname, mode_t mode, dev_t dev) {errno = ENOSYS; return -1;}
static inline int utimes(const char *filename, const struct timeval times[2]) {errno = ENOSYS; return -1;}
static inline int fnmatch(const char *pattern, const char *string, int flags) {return PathMatchSpecA(string, pattern)?0:1;}
static inline pid_t wait(int* status) { *status = 4; return -1; }
#define wait_any_nohang wait
/* This override enables the display of a progress based on the number of bytes read */
extern uint64_t bb_total_rb;
static inline int full_read(int fd, void *buf, size_t count) {
int rb;
if (fd < 0) {
errno = EBADF;
return -1;
}
if (buf == NULL) {
errno = EFAULT;
return -1;
}
if ((bled_cancel_request != NULL) && (*bled_cancel_request != 0)) {
errno = EINTR;
return -1;
}
rb = _read(fd, buf, (int)count);
if (rb > 0) {
bb_total_rb += rb;
if (bled_progress != NULL)
bled_progress(bb_total_rb);
}
return rb;
}
static inline struct tm *localtime_r(const time_t *timep, struct tm *result) {
if (localtime_s(result, timep) != 0)
result = NULL;
return result;
}
#define full_write _write
#define safe_read full_read
#define lstat stat
#define xmalloc malloc
#define xzalloc(x) calloc(x, 1)
#define malloc_or_warn malloc
#define mkdir(x, y) _mkdirU(x)
#if defined(_MSC_VER)
#define _S_IFBLK 0x3000
#define S_IFMT _S_IFMT
#define S_IFDIR _S_IFDIR
#define S_IFCHR _S_IFCHR
#define S_IFIFO _S_IFIFO
#define S_IFREG _S_IFREG
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define S_IEXEC _S_IEXEC
#define S_IFBLK _S_IFBLK
#define S_ISDIR(m) (((m) & _S_IFMT) == _S_IFDIR)
#define S_ISFIFO(m) (((m) & _S_IFMT) == _S_IFIFO)
#define S_ISCHR(m) (((m) & _S_IFMT) == _S_IFCHR)
#define S_ISBLK(m) (((m) & _S_IFMT) == _S_IFBLK)
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_APPEND _O_APPEND
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
#define O_EXCL _O_EXCL
#endif
/* MinGW doesn't know these */
#define _S_IFLNK 0xA000
#define _S_IFSOCK 0xC000
#define S_IFLNK _S_IFLNK
#define S_IFSOCK _S_IFSOCK
#define S_ISLNK(m) (((m) & _S_IFMT) == _S_IFLNK)
#define S_ISSOCK(m) (((m) & _S_IFMT) == _S_IFSOCK)
#endif
|
/**
* This file is part of Gem.
*
* Gem 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.
*
* Gem 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 Gem. If not, see <http://www.gnu.org/licenses/\>.
*/
#ifndef _ITEM_COLLECTION_H_
#define _ITEM_COLLECTION_H_
#include <game/item.h>
#include <runite/util/object.h>
struct item_collection {
object_t object;
int size;
item_t* collection;
};
typedef struct item_collection item_collection_t;
extern object_proto_t item_collection_proto;
void item_collection_alloc(item_collection_t* item_collection, int size);
int item_collection_insert(item_collection_t* item_collection, item_t item);
int item_collection_insert_at(item_collection_t* item_collection, int index, item_t item);
int item_collection_contains(item_collection_t* item_collection, item_definition_t definition);
item_t* item_collection_find_first(item_collection_t* item_collection, item_definition_t definition);
int item_collection_count(item_collection_t* item_collection, item_definition_t definition);
int item_collection_remove(item_collection_t* item_collection, item_definition_t definition, int count);
item_t* item_collection_get(item_collection_t* item_collection, int index);
#endif /* _ITEM_COLLECTION_H_ */
|
/*
* Copyright 2009 Nathan Matthews <lowentropy@gmail.com>
*
* This file is part of SimpleX3D.
*
* SimpleX3D 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.
*
* SimpleX3D 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 SimpleX3D. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _X3D_BUILTIN_H_
#define _X3D_BUILTIN_H_
namespace X3D {
class Profile;
/**
* Contains a single function which initializes all the
* X3D types implemented by simpleX3D.
*/
class Builtin {
public:
/**
* Initialize the given profile with known types.
*
* @param profile built-in supported profile
*/
static void init(Profile* profile);
};
}
#endif // #ifndef _X3D_BUILTIN_H_
|
/* AUDEX CDDA EXTRACTOR
* Copyright (C) 2007-2015 Marco Nelles (audex@maniatek.com)
* <http://userbase.kde.org/Audex>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CUSTOMWIDGET_H
#define CUSTOMWIDGET_H
#include <QWidget>
#include <QDir>
#include <KDebug>
#include <KDialog>
#include "utils/error.h"
#include "utils/parameters.h"
#include "utils/encoderassistant.h"
#include "dialogs/commandwizarddialog.h"
#include "ui_customwidgetUI.h"
class customWidgetUI : public QWidget, public Ui::CustomWidgetUI {
public:
explicit customWidgetUI(QWidget *parent) : QWidget(parent) {
setupUi(this);
}
};
class customWidget : public customWidgetUI {
Q_OBJECT
public:
explicit customWidget(Parameters *parameters, QWidget *parent = 0);
~customWidget();
Error lastError() const { return error; }
inline bool isChanged() const { return changed; }
public slots:
bool save();
void pattern_wizard();
signals:
void triggerChanged();
private slots:
void trigger_changed();
private:
Parameters *parameters;
Error error;
bool changed;
};
#endif
|
/***************************************************************************
* nc_data_hubble_bao.h
*
* Thu Apr 22 14:35:37 2010
* Copyright 2010 Sandro Dias Pinto Vitenti
* <sandro@isoftware.com.br>
****************************************************************************/
/*
* numcosmo
* Copyright (C) 2012 Sandro Dias Pinto Vitenti <sandro@isoftware.com.br>
*
* numcosmo 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.
*
* numcosmo is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NC_DATA_HUBBLE_BAO_H_
#define _NC_DATA_HUBBLE_BAO_H_
#include <glib.h>
#include <glib-object.h>
#include <numcosmo/build_cfg.h>
#include <numcosmo/math/ncm_data_gauss_diag.h>
#include <numcosmo/nc_distance.h>
G_BEGIN_DECLS
#define NC_TYPE_DATA_HUBBLE_BAO (nc_data_hubble_bao_get_type ())
#define NC_DATA_HUBBLE_BAO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NC_TYPE_DATA_HUBBLE_BAO, NcDataHubbleBao))
#define NC_DATA_HUBBLE_BAO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NC_TYPE_DATA_HUBBLE_BAO, NcDataHubbleBaoClass))
#define NC_IS_DATA_HUBBLE_BAO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NC_TYPE_DATA_HUBBLE_BAO))
#define NC_IS_DATA_HUBBLE_BAO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NC_TYPE_DATA_HUBBLE_BAO))
#define NC_DATA_HUBBLE_BAO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NC_TYPE_DATA_HUBBLE_BAO, NcDataHubbleBaoClass))
typedef struct _NcDataHubbleBaoClass NcDataHubbleBaoClass;
typedef struct _NcDataHubbleBao NcDataHubbleBao;
/**
* NcDataHubbleBaoId:
* @NC_DATA_HUBBLE_BAO_BUSCA2013: FIXME
*
* FIXME
*/
typedef enum _NcDataHubbleBaoId
{
NC_DATA_HUBBLE_BAO_BUSCA2013,
/* < private > */
NC_DATA_HUBBLE_BAO_NSAMPLES, /*< skip >*/
} NcDataHubbleBaoId;
struct _NcDataHubbleBaoClass
{
/*< private >*/
NcmDataGaussDiagClass parent_class;
};
struct _NcDataHubbleBao
{
/*< private >*/
NcmDataGaussDiag parent_instance;
NcDistance *dist;
NcmVector *x;
};
GType nc_data_hubble_bao_get_type (void) G_GNUC_CONST;
NcmData *nc_data_hubble_bao_new (NcDistance *dist, NcDataHubbleBaoId id);
void nc_data_hubble_bao_set_sample (NcDataHubbleBao *hubble_bao, NcDataHubbleBaoId id);
G_END_DECLS
#endif /* _NC_DATA_HUBBLE_BAO_H_ */
|
/*
* TU Eindhoven
* Eindhoven, The Netherlands
*
* Name : graph.h
*
* Author : Sander Stuijk (sander@ics.ele.tue.nl)
*
* Date : July 13, 2005
*
* Function : CSDF graph
*
* History :
* 13-07-05 : Initial version.
*
* $Id: graph.h,v 1.1.1.1 2007/10/02 10:59:49 sander Exp $
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation.
*
* This program is distributed in the hope that it 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* In other words, you are welcome to use, share and improve this program.
* You are forbidden to forbid anyone else to use, share and improve
* what you give them. Happy coding!
*/
#ifndef CSDF_BASE_GRAPH_H_INCLUDED
#define CSDF_BASE_GRAPH_H_INCLUDED
#include "channel.h"
/**
* CSDFgraph
* Container for CSDF graph.
*/
class CSDFgraph : public CSDFcomponent
{
public:
// Constructor
CSDFgraph(CSDFcomponent &c);
// Destructor
virtual ~CSDFgraph();
// Construct
virtual CSDFgraph *create(CSDFcomponent &c) const;
virtual CSDFgraph *createCopy(CSDFcomponent &c) const;
virtual CSDFgraph *clone(CSDFcomponent &c) const;
void construct(const CNodePtr graphNode);
// Type
CString getType() const { return type; };
void setType(const CString &t) { type = t; };
// Actors
CSDFactor *getActor(const CId id);
CSDFactor *getActor(const CString &name);
CSDFactors &getActors() { return actors; };
uint nrActors() const { return actors.size(); };
CSDFactorsIter actorsBegin() { return actors.begin(); };
CSDFactorsIter actorsEnd() { return actors.end(); };
CSDFactorsCIter actorsBegin() const { return actors.begin(); };
CSDFactorsCIter actorsEnd() const { return actors.end(); };
void addActor(CSDFactor *a);
void removeActor(const CString &name);
virtual CSDFactor *createActor();
virtual CSDFactor *createActor(CSDFcomponent &c);
// Channels
CSDFchannel *getChannel(const CId id);
CSDFchannel *getChannel(const CString &name);
CSDFchannels &getChannels() { return channels; };
uint nrChannels() const { return channels.size(); };
CSDFchannelsIter channelsBegin() { return channels.begin(); };
CSDFchannelsIter channelsEnd() { return channels.end(); };
CSDFchannelsCIter channelsBegin() const { return channels.begin(); };
CSDFchannelsCIter channelsEnd() const { return channels.end(); };
void addChannel(CSDFchannel *c);
void removeChannel(const CString &name);
virtual CSDFchannel *createChannel(CSDFcomponent &c);
CSDFchannel *createChannel(CSDFactor *src, CSDFrate rateSrc, CSDFactor *dst,
CSDFrate rateDst);
// Properties
bool isConnected() const;
bool isConsistent();
typedef std::vector<int> RepetitionVector;
typedef RepetitionVector::iterator RepetitonVectorIter;
typedef RepetitionVector::const_iterator RepetitonVectorCIter;
virtual RepetitionVector getRepetitionVector();
// Print
ostream &print(ostream &out);
friend ostream &operator<<(ostream &out, CSDFgraph &g)
{ return g.print(out); };
private:
// Repetition vector
void calcFractionsConnectedActors(CFractions &fractions, CSDFactor *a,
uint ratePeriod);
RepetitionVector calcRepetitionVector(CFractions &fractions,
uint ratePeriod);
// Information
CString type;
// Actors and channels
CSDFactors actors;
CSDFchannels channels;
};
typedef list<CSDFgraph*> CSDFgraphs;
typedef CSDFgraphs::iterator CSDFgraphsIter;
typedef CSDFgraphs::const_iterator CSDFgraphsCIter;
/**
* constructCSDFgraph ()
* Construct an CSDF graph.
*/
CSDFgraph *constructCSDFgraph(const CNodePtr csdfNode);
#endif
|
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo
* This benchmark is part of SWSC */
#include <assert.h>
#include <stdint.h>
#include <stdatomic.h>
#include <pthread.h>
atomic_int vars[3];
atomic_int atom_1_r1_1;
atomic_int atom_1_r11_1;
void *t0(void *arg){
label_1:;
atomic_store_explicit(&vars[0], 2, memory_order_seq_cst);
atomic_store_explicit(&vars[1], 1, memory_order_seq_cst);
return NULL;
}
void *t1(void *arg){
label_2:;
int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
atomic_store_explicit(&vars[1], 2, memory_order_seq_cst);
int v4_r4 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v6_r5 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v7_r6 = v6_r5 ^ v6_r5;
int v10_r7 = atomic_load_explicit(&vars[2+v7_r6], memory_order_seq_cst);
int v11_r9 = v10_r7 ^ v10_r7;
int v12_r9 = v11_r9 + 1;
atomic_store_explicit(&vars[0], v12_r9, memory_order_seq_cst);
int v14_r11 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v24 = (v2_r1 == 1);
atomic_store_explicit(&atom_1_r1_1, v24, memory_order_seq_cst);
int v25 = (v14_r11 == 1);
atomic_store_explicit(&atom_1_r11_1, v25, memory_order_seq_cst);
return NULL;
}
int main(int argc, char *argv[]){
pthread_t thr0;
pthread_t thr1;
atomic_init(&vars[0], 0);
atomic_init(&vars[1], 0);
atomic_init(&vars[2], 0);
atomic_init(&atom_1_r1_1, 0);
atomic_init(&atom_1_r11_1, 0);
pthread_create(&thr0, NULL, t0, NULL);
pthread_create(&thr1, NULL, t1, NULL);
pthread_join(thr0, NULL);
pthread_join(thr1, NULL);
int v15 = atomic_load_explicit(&vars[0], memory_order_seq_cst);
int v16 = (v15 == 2);
int v17 = atomic_load_explicit(&vars[1], memory_order_seq_cst);
int v18 = (v17 == 2);
int v19 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst);
int v20 = atomic_load_explicit(&atom_1_r11_1, memory_order_seq_cst);
int v21_conj = v19 & v20;
int v22_conj = v18 & v21_conj;
int v23_conj = v16 & v22_conj;
if (v23_conj == 1) assert(0);
return 0;
}
|
#ifndef SPOT_MANAGER_H
#define SPOT_MANAGER_H
#include <QObject>
#include <QList>
#include <QVariant>
#include "spotlib_global.h"
class AbstractFactory;
class AbstractSpot;
template <class T> class Singleton;
/*
* This class is to keep all spots and provide appropriate data to QML
*/
class SPOTLIB_SHARED_EXPORT SpotManager : public QObject
{
Q_OBJECT
friend class Singleton<class SpotManager>;
#if BUILD_SUB_TYPE == 1 // client
Q_PROPERTY(QList<QObject*> spots READ spots NOTIFY spotsChanged)
Q_PROPERTY(int size READ getSize NOTIFY spotsChanged)
#endif
public:
virtual ~SpotManager();
bool addSpot(AbstractSpot *new_spot, bool del_on_failure = true);
#if BUILD_SUB_TYPE == 1 // client
QList<QObject*> spots(); // obtain spots list for QML
int getSize() { return m_spots.size(); } // Obtain spots count for QML
#endif
/*
* Add new sensor's data, appropriate spot and sensor should be exist
*/
bool setSensorValue(int spot_id, int sensor_id, const QVariant &val);
/*
* Find spot by it's ID
*/
AbstractSpot* find(int spot_id);
/*
* Remove all spots and sensors
*/
void clear();
// Serialization
virtual void toStream(QDataStream& stream);
virtual void fromStream(QDataStream& stream, AbstractFactory &factory);
signals:
void spotsChanged();
void sensorValueChanged(int spot_id, int sensor_id, QVariant val);
protected slots:
/*
* Handle signal from a spots from the spots list
*/
void onSensorValueChanged(int spot_id, int sensor_id, QVariant val);
protected:
explicit SpotManager(QObject *parent = 0);
private:
QList<AbstractSpot*> m_spots;
};
#endif // SPOT_MANAGER_H
|
/* behold-columbus.h - Keytable for behold_columbus Remote Controller
*
* keymap imported from ir-keymaps.c
*
* Copyright (c) 2010 by Mauro Carvalho Chehab
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
#include <media/rc-map.h>
#include <linux/module.h>
/* Beholder Intl. Ltd. 2008
* Dmitry Belimov d.belimov@google.com
* Keytable is used by BeholdTV Columbus
* The "ascii-art picture" below (in comments, first row
* is the keycode in hex, and subsequent row(s) shows
* the button labels (several variants when appropriate)
* helps to descide which keycodes to assign to the buttons.
*/
static struct rc_map_table behold_columbus[] =
{
/* 0x13 0x11 0x1C 0x12 *
* Mute Source TV/FM Power *
* */
{ 0x13, KEY_MUTE },
{ 0x11, KEY_VIDEO },
{ 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */
{ 0x12, KEY_POWER },
/* 0x01 0x02 0x03 0x0D *
* 1 2 3 Stereo *
* *
* 0x04 0x05 0x06 0x19 *
* 4 5 6 Snapshot *
* *
* 0x07 0x08 0x09 0x10 *
* 7 8 9 Zoom *
* */
{ 0x01, KEY_1 },
{ 0x02, KEY_2 },
{ 0x03, KEY_3 },
{ 0x0D, KEY_SETUP }, /* Setup key */
{ 0x04, KEY_4 },
{ 0x05, KEY_5 },
{ 0x06, KEY_6 },
{ 0x19, KEY_CAMERA }, /* Snapshot key */
{ 0x07, KEY_7 },
{ 0x08, KEY_8 },
{ 0x09, KEY_9 },
{ 0x10, KEY_ZOOM },
/* 0x0A 0x00 0x0B 0x0C *
* RECALL 0 ChannelUp VolumeUp *
* */
{ 0x0A, KEY_AGAIN },
{ 0x00, KEY_0 },
{ 0x0B, KEY_CHANNELUP },
{ 0x0C, KEY_VOLUMEUP },
/* 0x1B 0x1D 0x15 0x18 *
* Timeshift Record ChannelDown VolumeDown *
* */
{ 0x1B, KEY_TIME },
{ 0x1D, KEY_RECORD },
{ 0x15, KEY_CHANNELDOWN },
{ 0x18, KEY_VOLUMEDOWN },
/* 0x0E 0x1E 0x0F 0x1A *
* Stop Pause Previouse Next *
* */
{ 0x0E, KEY_STOP },
{ 0x1E, KEY_PAUSE },
{ 0x0F, KEY_PREVIOUS },
{ 0x1A, KEY_NEXT },
};
static struct rc_map_list behold_columbus_map =
{
.map = {
.scan = behold_columbus,
.size = ARRAY_SIZE(behold_columbus),
.rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
.name = RC_MAP_BEHOLD_COLUMBUS,
}
};
static int __init init_rc_map_behold_columbus(void)
{
return rc_map_register(&behold_columbus_map);
}
static void __exit exit_rc_map_behold_columbus(void)
{
rc_map_unregister(&behold_columbus_map);
}
module_init(init_rc_map_behold_columbus)
module_exit(exit_rc_map_behold_columbus)
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Mauro Carvalho Chehab");
|
#ifndef VARIANT_CONVERT_H
#define VARIANT_CONVERT_H
#ifdef QT_CORE_LIB
#include <QVariant>
#include <QString>
#include <QDate>
namespace luavm
{
template<class T, typename T2 = typename std::enable_if<!std::is_enum<T>::value, void>::type>
T variantTo(const QVariant& var)
{
return qvariant_cast<T>(var);
}
//to resolve enum is ambiqous with ints ... making different amount of template args
template<typename T, typename T3 = int, typename T2 = typename std::enable_if<std::is_enum<T>::value, T>::type>
inline
T variantTo(const QVariant& var)
{
return static_cast<T>(var.toInt());
}
}
#endif
#endif // VARIANT_CONVERT_H
|
#ifndef _Array_H_
#define _Array_H_
#include <list>
using std::list;
namespace KeiUI{
template<class I, class V>
struct ArrayNode
{
I index;
V value;
ArrayNode(I index, V value)
{
this->index = index;
this->value = value;
}
};
template<class I, class V>
class Array{
private:
list<ArrayNode<I, V>> nodeList;
public:
Array(){
this->nodeList = list<ArrayNode<I, V>>();
}
void add(I index, V value){
this->nodeList.push_back(ArrayNode<I, V>(index, value));
}
int size(){
return this->nodeList.size();
}
bool exist(I index){
list<ArrayNode<I, V>>::iterator iter;
for(iter = this->nodeList.begin(); iter != this->nodeList.end(); iter++){
if(iter->index == index){
return true;
}
}
return false;
}
V get(I index){
list<ArrayNode<I, V>>::iterator iter;
for(iter = this->nodeList.begin(); iter != this->nodeList.end(); iter++){
if(iter->index == index){
return iter->value;
}
}
return V();
}
void clear(){
this->nodeList.clear();
}
void remove(I index){
list<ArrayNode<I, V>>::iterator iter;
for(iter = this->nodeList.begin(); iter != this->nodeList.end(); iter++){
if(iter->index == index){
this->nodeList.erase(iter);
return;
}
}
}
void set(I index, V value){
list<ArrayNode<I, V>>::iterator iter;
for(iter = this->nodeList.begin(); iter != this->nodeList.end(); iter++){
if(iter->index == index){
iter->value = value;
return;
}
}
}
void remove(){
list<ArrayNode<I, V>>::iterator iter = this->nodeList.end();
iter--;
this->nodeList.erase(iter);
}
V last(){
list<ArrayNode<I, V>>::iterator iter = this->nodeList.end();
iter--;
return iter->value;
}
};
};
#endif _Array_H_
|
/* Unix Headers */
#include <stdio.h>
#include <string.h>
int main(int argc, char *argv[])
{
printf("ls\n");
printf("echo hello\n");
}
|
/*
* Copyright (C) 2006-2010 - Frictional Games
*
* This file is part of HPL1 Engine.
*
* HPL1 Engine 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.
*
* HPL1 Engine 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 HPL1 Engine. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef HPL_NODE3D_H
#define HPL_NODE3D_H
#include <list>
#include "math/MathTypes.h"
#include "scene/Node.h"
namespace hpl {
//------------------------------------
kSaveData_ChildClass(iNode,cNode3D)
{
kSaveData_ClassInit(cNode3D)
public:
tString msName;
tString msSource;
bool mbAutoDeleteChildren;
cMatrixf m_mtxLocalTransform;
int mlParentId;
iSaveObject* CreateSaveObject(cSaveObjectHandler *apSaveObjectHandler,cGame *apGame);
int GetSaveCreatePrio();
};
//------------------------------------
class cNode3D : public iNode
{
#ifdef __GNUC__
typedef iNode __super;
#endif
public:
cNode3D(const tString &asName="", bool abAutoDeleteChildren = true);
virtual ~cNode3D();
iNode* CreateChild();
cNode3D* CreateChild3D(const tString &asName="", bool abAutoDeleteChildren = true);
cVector3f GetLocalPosition();
cMatrixf& GetLocalMatrix();
cVector3f GetWorldPosition();
cMatrixf& GetWorldMatrix();
void SetPosition(const cVector3f& avPos);
void SetMatrix(const cMatrixf& a_mtxTransform, bool abSetChildrenUpdated=true);
void SetWorldPosition(const cVector3f& avWorldPos);
void SetWorldMatrix(const cMatrixf& a_mtxWorldTransform);
const char* GetName();
cNode3D* GetParent();
void AddRotation(const cVector3f& avRot, eEulerRotationOrder aOrder);
void AddRotation(const cQuaternion& aqRotation);
void AddScale(const cVector3f& avScale);
void AddTranslation(const cVector3f& avTrans);
void SetSource(const tString &asSource);
const char* GetSource();
/**
* Updates the matrix with the added scales, translations and rotation. It also resets these values.
*/
void UpdateMatrix(bool abSetChildrenUpdated);
//Extra stuff that shouldn't be used externally
void SetParent(cNode3D* apNode);
void AddChild(cNode3D* apChild);
//SaveObject implementation
virtual iSaveData* CreateSaveData();
virtual void SaveToSaveData(iSaveData *apSaveData);
virtual void LoadFromSaveData(iSaveData *apSaveData);
virtual void SaveDataSetup(cSaveObjectHandler *apSaveObjectHandler, cGame *apGame);
void UpdateWorldTransform();
void SetWorldTransformUpdated();
private:
tString msName;
tString msSource;
bool mbAutoDeleteChildren;
cMatrixf m_mtxLocalTransform;
cMatrixf m_mtxWorldTransform;
cVector3f mvWorldPosition;
cMatrixf m_mtxRotation;
cVector3f mvScale;
cVector3f mvTranslation;
bool mbTransformUpdated;
cNode3D* mpParent;
};
};
#endif // HPL_NODE3D_H
|
#ifndef _SPARC_USER_H
#define _SPARC_USER_H
/* Nothing to define. */
#endif /* !(_SPARC_USER_H) */
|
/*
Unix SMB/CIFS implementation.
NBT server task
Copyright (C) Andrew Tridgell 2005
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "includes.h"
#include "smbd/service_task.h"
#include "smbd/service.h"
#include "nbt_server/nbt_server.h"
#include "nbt_server/wins/winsserver.h"
#include "system/network.h"
#include "lib/socket/netif.h"
#include "auth/auth.h"
#include "dsdb/samdb/samdb.h"
#include "param/param.h"
NTSTATUS server_service_nbtd_init(TALLOC_CTX *);
/*
startup the nbtd task
*/
static void nbtd_task_init(struct task_server *task)
{
struct nbtd_server *nbtsrv;
NTSTATUS status;
struct interface *ifaces;
load_interface_list(task, task->lp_ctx, &ifaces);
if (iface_list_count(ifaces) == 0) {
task_server_terminate(task, "nbtd: no network interfaces configured", false);
return;
}
if (lpcfg_disable_netbios(task->lp_ctx)) {
task_server_terminate(task, "nbtd: 'disable netbios = yes' set in smb.conf, shutting down nbt server", false);
return;
}
task_server_set_title(task, "task[nbtd]");
nbtsrv = talloc(task, struct nbtd_server);
if (nbtsrv == NULL) {
task_server_terminate(task, "nbtd: out of memory", true);
return;
}
nbtsrv->task = task;
nbtsrv->interfaces = NULL;
nbtsrv->bcast_interface = NULL;
nbtsrv->wins_interface = NULL;
/* start listening on the configured network interfaces */
status = nbtd_startup_interfaces(nbtsrv, task->lp_ctx, ifaces);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "nbtd failed to setup interfaces", true);
return;
}
nbtsrv->sam_ctx = samdb_connect(nbtsrv,
task->event_ctx,
task->lp_ctx,
system_session(task->lp_ctx),
NULL,
0);
if (nbtsrv->sam_ctx == NULL) {
task_server_terminate(task, "nbtd failed to open samdb", true);
return;
}
/* start the WINS server, if appropriate */
status = nbtd_winsserver_init(nbtsrv);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "nbtd failed to start WINS server", true);
return;
}
nbtd_register_irpc(nbtsrv);
/* start the process of registering our names on all interfaces */
nbtd_register_names(nbtsrv);
irpc_add_name(task->msg_ctx, "nbt_server");
}
/*
register ourselves as a available server
*/
NTSTATUS server_service_nbtd_init(TALLOC_CTX *ctx)
{
struct service_details details = {
.inhibit_fork_on_accept = true,
.inhibit_pre_fork = true
};
return register_server_service(ctx, "nbt", nbtd_task_init, &details);
}
|
/*
* Copyright (c) 2010-2019 Belledonne Communications SARL.
*
* This file is part of Liblinphone.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _L_CLONABLE_OBJECT_H_
#define _L_CLONABLE_OBJECT_H_
#include "object-head.h"
#include "property-container.h"
// =============================================================================
#define L_USE_DEFAULT_CLONABLE_OBJECT_SHARED_IMPL(CLASS) \
CLASS::CLASS (const CLASS &other) : ClonableObject( \
const_cast<std::decay<decltype(*other.getPrivate())>::type &>(*other.getPrivate()) \
) {} \
CLASS &CLASS::operator= (const CLASS &other) { \
if (this != &other) \
setRef(*other.getPrivate()); \
return *this; \
}
LINPHONE_BEGIN_NAMESPACE
/*
* Clonable Object of Linphone. Generally it's just a data object with no
* intelligence.
*/
class LINPHONE_PUBLIC ClonableObject : public PropertyContainer {
L_OBJECT;
public:
virtual ~ClonableObject ();
virtual ClonableObject* clone () const = 0;
protected:
explicit ClonableObject (ClonableObjectPrivate &p);
// Change the ClonableObjectPrivate. Unref previous.
void setRef (const ClonableObjectPrivate &p);
ClonableObjectPrivate *mPrivate = nullptr;
private:
L_DECLARE_PRIVATE(ClonableObject);
// Yeah, it's a `ClonableObject` that cannot be copied.
// Only inherited classes must implement copy.
L_DISABLE_COPY(ClonableObject);
};
LINPHONE_END_NAMESPACE
#endif // ifndef _L_CLONABLE_OBJECT_H_
|
/*
ASCII Art Raspberry Pi 2 B2 GPIO
PINOS
+3V3 [01] [02] +5V
SDA1 / GPIO 2 [03] [04] +5V
SCL1 / GPIO 3 [05] [06] GND
GPIO 4 [07] [08] GPIO 14 / TXD0
GND [09] [10] GPIO 15 / RXD0
GPIO 17 [11] [12] GPIO 18
GPIO 27 [13] [14] GND
GPIO 22 [15] [16] GPIO 23
+3V3 [17] [18] GPIO 24
MOSI / GPIO 10 [19] [20] GND
MISO / GPIO 9 [21] [22] GPIO 25
SCLK / GPIO 11 [23] [24] GPIO 8 / CE0#
GND [25] [26] GPIO 7 / CE1#
ID_SD / GPIO 0 [27] [28] GPIO 1 / ID_SC
GPIO 5 [29] [30] GND
GPIO 6 [31] [32] GPIO 12
GPIO 13 [33] [34] GND
MISO / GPIO 19 [35] [36] GPIO 16 / CE2#
GPIO 26 [37] [38] GPIO 20 / MOSI
GND [39] [40] GPIO 21 / SCLK
*/
#ifndef _RASPBERRYGPIO_H_
#define _RASPBERRYGPIO_H_
#include<sys/stat.h>
#include<sys/types.h>
#include<fcntl.h>
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<stdbool.h>
#define ENTRADA 1
#define SAIDA 0
#define INPUT 1
#define OUTPUT 0
#define HIGH 1
#define LOW 0
#define ALTO 1
#define BAIXO 0
/*Protótipos das Funções*/
bool GPIOExport(unsigned int pino);
bool GPIODirection(unsigned int pino,unsigned int direcao);
bool GPIOWrite(unsigned int pino,unsigned int valor);
bool GPIORead(unsigned int pino);
bool GPIOUnexport(unsigned int pino);
bool GPIOSetup(unsigned int pino,unsigned int direcao);
void delay_ms(unsigned int tempo);
void delay_s(unsigned int tempo);
#endif
|
#ifndef __HOOKS_H
#define __HOOKS_H
typedef HRESULT(__stdcall *D3D11PresentHook) (IDXGISwapChain* pSwapChain, UINT SyncInterval, UINT Flags);
typedef void(__stdcall *D3D11DrawIndexedHook) (ID3D11DeviceContext* pContext, UINT IndexCount, UINT StartIndexLocation, INT BaseVertexLocation);
typedef void(__stdcall *D3D11PSSetShaderResourcesHook) (ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumViews, ID3D11ShaderResourceView *const *ppShaderResourceViews);
typedef void(__stdcall *D3D11CreateQueryHook) (ID3D11Device* pDevice, const D3D11_QUERY_DESC *pQueryDesc, ID3D11Query **ppQuery);
typedef void(__stdcall *D3D11DrawIndexedInstancedHook) (ID3D11DeviceContext* pContext, UINT IndexCountPerInstance, UINT InstanceCount, UINT StartIndexLocation, INT BaseVertexLocation, UINT StartInstanceLocation);
typedef void(__stdcall *D3D11DrawHook) (ID3D11DeviceContext* pContext, UINT VertexCount, UINT StartVertexLocation);
typedef void(__stdcall *D3D11DrawInstancedHook) (ID3D11DeviceContext* pContext, UINT VertexCountPerInstance, UINT InstanceCount, UINT StartVertexLocation, UINT StartInstanceLocation);
typedef void(__stdcall *D3D11DrawInstancedIndirectHook) (ID3D11DeviceContext* pContext, ID3D11Buffer *pBufferForArgs, UINT AlignedByteOffsetForArgs);
typedef void(__stdcall *D3D11DrawIndexedInstancedIndirectHook) (ID3D11DeviceContext* pContext, ID3D11Buffer *pBufferForArgs, UINT AlignedByteOffsetForArgs);
typedef void(__stdcall *D3D11VSSetConstantBuffersHook) (ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumBuffers, ID3D11Buffer *const *ppConstantBuffers);
typedef void(__stdcall *D3D11PSSetSamplersHook) (ID3D11DeviceContext* pContext, UINT StartSlot, UINT NumSamplers, ID3D11SamplerState *const *ppSamplers);
D3D11PresentHook phookD3D11Present = NULL;
D3D11DrawIndexedHook phookD3D11DrawIndexed = NULL;
D3D11PSSetShaderResourcesHook phookD3D11PSSetShaderResources = NULL;
D3D11CreateQueryHook phookD3D11CreateQuery = NULL;
D3D11DrawIndexedInstancedHook phookD3D11DrawIndexedInstanced = NULL;
D3D11DrawHook phookD3D11Draw = NULL;
D3D11DrawInstancedHook phookD3D11DrawInstanced = NULL;
D3D11DrawInstancedIndirectHook phookD3D11DrawInstancedIndirect = NULL;
D3D11DrawIndexedInstancedIndirectHook phookD3D11DrawIndexedInstancedIndirect = NULL;
D3D11VSSetConstantBuffersHook phookD3D11VSSetConstantBuffers = NULL;
D3D11PSSetSamplersHook phookD3D11PSSetSamplers = NULL;
ID3D11Device *pDevice = NULL;
ID3D11DeviceContext *pContext = NULL;
DWORD_PTR* pSwapChainVtable = NULL;
DWORD_PTR* pContextVTable = NULL;
DWORD_PTR* pDeviceVTable = NULL;
#endif
|
//
// EditProfileViewController.h
// levelUp
//
// Created by Vinícius Lemes on 2016-08-07.
// Copyright © 2016 Yasmin Benatti. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface EditProfileViewController : UIViewController <UITextFieldDelegate>
@property (weak, nonatomic) IBOutlet UIButton *editImageButton;
@property (weak, nonatomic) IBOutlet UITextField *petNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *birthdateTextField;
@property (weak, nonatomic) IBOutlet UITextField *ownerNameTextField;
- (IBAction)hideKeyboard:(id)sender;
@end
|
/*
* Copyright 2014-2020 Markus Prasser
*
* This file is part of Labcontrol.
*
* Labcontrol 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.
*
* Labcontrol 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 Labcontrol. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CLIENTHELPNOTIFICATIONSERVER_H
#define CLIENTHELPNOTIFICATIONSERVER_H
#include <QObject>
class QNetworkSession;
class QTcpServer;
namespace lc {
/*!
* \brief A server listing for connections from clients which will be
* interpreted as help requests
*/
class ClientHelpNotificationServer : public QObject {
Q_OBJECT
public:
explicit ClientHelpNotificationServer(QObject *argParent = nullptr);
private:
QTcpServer *helpMessageServer = nullptr;
const QString hostAddress;
QNetworkSession *networkSession = nullptr;
private slots:
void OpenSession();
void SendReply();
};
} // namespace lc
#endif // CLIENTHELPNOTIFICATIONSERVER_H
|
/* This file is part of gPHPEdit, a GNOME2 PHP Editor.
Copyright (C) 2003, 2004, 2005 Andy Jeffries <andy at gphpedit.org>
Copyright (C) 2009 Anoop John <anoop dot john at zyxware.com>
For more information or to find the latest release, visit our
website at http://www.gphpedit.org/
gPHPEdit 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.
gPHPEdit 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 gPHPEdit. If not, see <http://www.gnu.org/licenses/>.
The GNU General Public License is contained in the file COPYING.
*/
#include "config.h"
#include <glib/gi18n.h>
#include "main_window.h"
#include "templates.h"
#include "edit_template.h"
EditTemplateDialog edit_template_dialog;
void create_edit_template_dialog (void)
{
edit_template_dialog.window1 = gtk_dialog_new_with_buttons(_("Add/Edit Template"),
GTK_WINDOW(main_window.window), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,NULL);
edit_template_dialog.hbox2 = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG(edit_template_dialog.window1))),edit_template_dialog.hbox2);
gtk_container_set_border_width (GTK_CONTAINER (edit_template_dialog.hbox2), 8);
edit_template_dialog.label2 = gtk_label_new (_("Name/Shortcut:"));
gtk_box_pack_start (GTK_BOX (edit_template_dialog.hbox2), edit_template_dialog.label2, FALSE, FALSE, 0);
edit_template_dialog.entry1 = gtk_entry_new ();
gtk_box_pack_start (GTK_BOX (edit_template_dialog.hbox2), edit_template_dialog.entry1, FALSE, FALSE, 8);
edit_template_dialog.hbox3 = gtk_hbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area(GTK_DIALOG(edit_template_dialog.window1))),edit_template_dialog.hbox3);
gtk_container_set_border_width (GTK_CONTAINER (edit_template_dialog.hbox3), 8);
edit_template_dialog.label3 = gtk_label_new (_("Code:"));
gtk_box_pack_start (GTK_BOX (edit_template_dialog.hbox3), edit_template_dialog.label3, FALSE, FALSE, 0);
edit_template_dialog.scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX (edit_template_dialog.hbox3), edit_template_dialog.scrolledwindow1, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER (edit_template_dialog.scrolledwindow1), 8);
edit_template_dialog.textview1 = gtk_text_view_new ();
gtk_container_add (GTK_CONTAINER (edit_template_dialog.scrolledwindow1), edit_template_dialog.textview1);
gtk_widget_show_all(edit_template_dialog.window1);
}
|
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2016 - Daniel De Matteis
*
* RetroArch 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 Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch 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 RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdint.h>
#include <stdlib.h>
#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif
#ifdef _XBOX
#include <xtl.h>
#endif
#include <boolean.h>
#include <libretro.h>
#include "../input_joypad_driver.h"
#include "../../configuration.h"
#define MAX_PADS 4
typedef struct xdk_input
{
bool blocked;
const input_device_driver_t *joypad;
} xdk_input_t;
static void xdk_input_poll(void *data)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (xdk && xdk->joypad)
xdk->joypad->poll();
}
static int16_t xdk_input_state(void *data, const struct retro_keybind **binds,
unsigned port, unsigned device,
unsigned index, unsigned id)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (port >= MAX_PADS)
return 0;
switch (device)
{
case RETRO_DEVICE_JOYPAD:
if (binds[port] && binds[port][id].valid)
return input_joypad_pressed(xdk->joypad, port, binds[port], id);
break;
case RETRO_DEVICE_ANALOG:
if (binds[port])
return input_joypad_analog(xdk->joypad, port, index, id, binds[port]);
break;
}
return 0;
}
static void xdk_input_free_input(void *data)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (!xdk)
return;
if (xdk->joypad)
xdk->joypad->destroy();
free(xdk);
}
static void *xdk_input_init(void)
{
settings_t *settings = config_get_ptr();
xdk_input_t *xdk = (xdk_input_t*)calloc(1, sizeof(*xdk));
if (!xdk)
return NULL;
xdk->joypad = input_joypad_init_driver(settings->input.joypad_driver, xdk);
return xdk;
}
static bool xdk_input_meta_key_pressed(void *data, int key)
{
return false;
}
static uint64_t xdk_input_get_capabilities(void *data)
{
(void)data;
return (1 << RETRO_DEVICE_JOYPAD) | (1 << RETRO_DEVICE_ANALOG);
}
/* FIXME - are we sure about treating low frequency motor as the
* "strong" motor? Does it apply for Xbox too? */
static bool xdk_input_set_rumble(void *data, unsigned port,
enum retro_rumble_effect effect, uint16_t strength)
{
xdk_input_t *xdk = (xdk_input_t*)data;
(void)xdk;
bool val = false;
#if 0
#if defined(_XBOX360)
XINPUT_VIBRATION rumble_state;
if (effect == RETRO_RUMBLE_STRONG)
rumble_state.wLeftMotorSpeed = strength;
else if (effect == RETRO_RUMBLE_WEAK)
rumble_state.wRightMotorSpeed = strength;
val = XInputSetState(port, &rumble_state) == ERROR_SUCCESS;
#elif defined(_XBOX1)
#if 0
XINPUT_FEEDBACK rumble_state;
if (effect == RETRO_RUMBLE_STRONG)
rumble_state.Rumble.wLeftMotorSpeed = strength;
else if (effect == RETRO_RUMBLE_WEAK)
rumble_state.Rumble.wRightMotorSpeed = strength;
val = XInputSetState(xdk->gamepads[port], &rumble_state) == ERROR_SUCCESS;
#endif
#endif
#endif
return val;
}
static const input_device_driver_t *xdk_input_get_joypad_driver(void *data)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (!xdk)
return NULL;
return xdk->joypad;
}
static void xdk_input_grab_mouse(void *data, bool state)
{
(void)data;
(void)state;
}
static bool xdk_keyboard_mapping_is_blocked(void *data)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (!xdk)
return false;
return xdk->blocked;
}
static void xdk_keyboard_mapping_set_block(void *data, bool value)
{
xdk_input_t *xdk = (xdk_input_t*)data;
if (!xdk)
return;
xdk->blocked = value;
}
input_driver_t input_xinput = {
xdk_input_init,
xdk_input_poll,
xdk_input_state,
xdk_input_meta_key_pressed,
xdk_input_free_input,
NULL,
NULL,
xdk_input_get_capabilities,
"xinput",
xdk_input_grab_mouse,
NULL,
xdk_input_set_rumble,
xdk_input_get_joypad_driver,
NULL,
xdk_keyboard_mapping_is_blocked,
xdk_keyboard_mapping_set_block,
};
|
#ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 200112L
#endif
#include <time.h>
#include <stdint.h>
#include "config.h"
#ifdef REDFST_FUN_IN_H
static inline
#endif
uint64_t __redfst_time_now(){
struct timespec spec;
clock_gettime(CLOCK_MONOTONIC, &spec);
return ((uint64_t)1e9) * spec.tv_sec + spec.tv_nsec;
}
|
/**
* This file is part of the "FnordMetric" project
* Copyright (c) 2011-2014 Paul Asmuth, Google Inc.
*
* FnordMetric is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License v3.0. You should have received a
* copy of the GNU General Public License along with this program. If not, see
* <http://www.gnu.org/licenses/>.
*/
#ifndef _FNORDMETRIC_QUERY_RESULTLIST_H
#define _FNORDMETRIC_QUERY_RESULTLIST_H
#include <stdlib.h>
#include <string>
#include <vector>
#include <memory>
#include <csql/runtime/rowsink.h>
#include <csql/runtime/queryplan.h>
#include <csql/svalue.h>
namespace csql {
class ResultList : public RowSink {
public:
ResultList() {}
ResultList(const ResultList& copy) = delete;
ResultList& operator=(const ResultList& copy) = delete;
ResultList(ResultList&& move) :
columns_(std::move(move.columns_)),
rows_(std::move(move.rows_)) {}
size_t getNumColumns() const {
return columns_.size();
}
size_t getNumRows() const {
return rows_.size();
}
const std::vector<std::string>& getRow(size_t index) const {
if (index >= rows_.size()) {
RAISE(kRuntimeError, "invalid index");
}
return rows_[index];
}
const std::vector<std::string>& getColumns() const {
return columns_;
}
int getColumnIndex(const std::string& column_name) const {
for (int i = 0; i < columns_.size(); ++i) {
if (columns_[i] == column_name) {
return i;
}
}
return -1;
}
void addHeader(const std::vector<std::string>& columns) {
columns_ = columns;
}
bool addRow(const csql::SValue* row, int row_len) {
if (row_len > columns_.size()) {
row_len = columns_.size();
}
Vector<String> str_row;
for (int i = 0; i < row_len; ++i) {
str_row.emplace_back(row[i].getString());
}
rows_.emplace_back(str_row);
return true;
}
void debugPrint() const {
auto os = OutputStream::getStderr();
debugPrint(os.get());
}
void debugPrint(OutputStream* os) const {
std::vector<int> col_widths;
int total_width = 0;
for (size_t i = 0; i < columns_.size(); ++i) {
col_widths.push_back(20);
total_width += 20;
}
auto print_hsep = [os, &col_widths] () {
for (auto w : col_widths) {
for (int i = 0; i < w; ++i) {
char c = (i == 0 || i == w - 1) ? '+' : '-';
os->printf("%c", c);
}
}
os->printf("\n");
};
auto print_row = [this, os, &col_widths] (const std::vector<std::string>& row) {
for (int n = 0; n < row.size(); ++n) {
const auto& val = row[n];
os->printf("| %s", val.c_str());
for (int i = col_widths[n] - val.size() - 3; i > 0; --i) {
os->printf(" ");
}
}
os->printf("|\n");
};
print_hsep();
print_row(columns_);
print_hsep();
for (const auto& row : rows_) {
print_row(row);
}
print_hsep();
}
protected:
std::vector<std::string> columns_;
std::vector<std::vector<std::string>> rows_;
};
}
#endif
|
//
// fft-bench2.c: this file is part of the SL program suite.
//
// Copyright (C) 2009 Universiteit van Amsterdam.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 3
// of the License, or (at your option) any later version.
//
// The complete GNU General Public Licence Notice can be found as the
// `COPYING' file in the root directory.
//
#define EXTRA_COMMENT "(small lookup table)"
#include "fft-bench.c"
#include "fft_impl2.c"
#include "fft_extra.c"
|
//===- ShaktiFrameLowering.h - Define frame lowering for Shakti --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_SHAKTI_SHAKTIFRAMELOWERING_H
#define LLVM_LIB_TARGET_SHAKTI_SHAKTIFRAMELOWERING_H
#include "Shakti.h"
#include "llvm/Target/TargetFrameLowering.h"
namespace llvm {
class ShaktiSubtarget;
class ShaktiFrameLowering : public TargetFrameLowering {
public:
explicit ShaktiFrameLowering(const ShaktiSubtarget &ST)
: TargetFrameLowering(TargetFrameLowering::StackGrowsDown, 64, 0, 64) {}
void emitPrologue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
void emitEpilogue(MachineFunction &MF, MachineBasicBlock &MBB) const override;
MachineBasicBlock::iterator
eliminateCallFramePseudoInstr(MachineFunction &MF, MachineBasicBlock &MBB,
MachineBasicBlock::iterator I) const override;
void determineCalleeSaves(MachineFunction &MF, BitVector &SavedRegs,
RegScavenger *RS) const override;
bool hasFP(const MachineFunction &MF) const override;
bool hasReservedCallFrame(const MachineFunction &MF) const override;
private:
uint64_t getWorstCaseStackSize(const MachineFunction &MF) const;
};
} // namespace llvm
#endif
|
#include "uart.h"
void main(void)
{
unsigned char c = 0;
P2 = 0;
uart_init(115200UL);
// timer0_init(100);
EA = 1;
printf("build: %s %s\r\n", __TIME__, __DATE__);
while (1) {
printf("%u\r\n", c++);
}
}
|
#ifndef STAR_PARTICLE_H
#define STAR_PARTICLE_H
#include <THEngine.h>
using namespace THEngine;
class StarParticle : public Particle3D
{
public:
StarParticle();
virtual ~StarParticle() = default;
static Ptr<Texture> tex;
};
#endif
|
/*
* main.c
*
* Created on: 30 set 2015
* Author: ntonjeta
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <termios.h>
/* My Arduino is on /dev/ttyACM0 */
char *portname = "/dev/ttyACM0";
char *r="a";
void configure (int *fd);
void singleMode (int fd,char * jstring);
void rawMode (int fd,char * jstring);
int main (int argc, char* argv[]){
int fd,n;
char response[256];
/* Open the file descriptor in non-blocking mode */
if(fd = open(portname,O_RDWR | O_NOCTTY | O_NONBLOCK)){
printf("stream aperto\n");
}else{
printf("errora nell'apertura dello stream\n");
return 0;
}
/* Set up the control structure */
struct termios toptions;
/* Get currently set options for the tty */
tcgetattr(fd, &toptions);
/* Set custom options */
/* 9600 baud */
cfsetispeed(&toptions, B9600);
cfsetospeed(&toptions, B9600);
/* 8 bits, no parity, no stop bits */
toptions.c_cflag &= ~PARENB;
toptions.c_cflag &= ~CSTOPB;
toptions.c_cflag &= ~CSIZE;
toptions.c_cflag |= CS8;
/* no hardware flow control */
toptions.c_cflag &= ~CRTSCTS;
/* enable receiver, ignore status lines */
toptions.c_cflag |= CREAD | CLOCAL;
/* disable input/output flow control, disable restart chars */
toptions.c_iflag &= ~(IXON | IXOFF | IXANY);
/* disable canonical input, disable echo,
disable visually erase chars,
disable terminal-generated signals */
toptions.c_iflag &= ~(ICANON | ECHO | ECHOE | ISIG);
/* disable output processing */
toptions.c_oflag &= ~OPOST;
/* wait for 24 characters to come in before read returns */
toptions.c_cc[VMIN] = 12;
/* no minimum time to wait before read returns */
toptions.c_cc[VTIME] = 0;
/* commit the options */
tcsetattr(fd, TCSANOW, &toptions);
/* Wait for the Arduino to reset */
usleep(1000*1000);
/* Flush anything already in the serial buffer */
tcflush(fd, TCIFLUSH);
char *jstring = "{ \"command\" : \"read\",\"ID\" : 1}\n";
//Write on COM port
rawMode(fd,jstring);
tcflush(fd,TCIOFLUSH);
/*Wait the board build a answer */
usleep(1000*1000);
char buf[]="\0";
// while(n=read(fd,&buf,sizeof(char)) == -1){
// printf("code : %d",n);
// }
//if (read(fd,&buf,sizeof(char)) == 0) printf("risposta : %s",buf);
//else printf("Error %s",buf);
while(read(fd,&buf,sizeof(char)) == -1);
printf("risposta: %c", *buf);
//read(fd,buf,1);
//printf("risposta: %c", *buf);
return 0;
}
//Write 1 bit for time
void singleMode(int fd,char * jstring){
int i = 0;
char buf = '\0';
while(buf != '\n'){
buf = jstring[i];
write(fd,&buf,1);
usleep(26*100);
i++;
}
}
void rawMode (int fd,char * jstring){
write(fd,jstring,strlen(jstring));
usleep((25+strlen(jstring))*100);
}
//
//void USB_read (int *fd,char *buf)
//{
// /* read up to 128 bytes from the fd */
//
// // /* print how many bytes read */
// // printf("%i bytes got read...\n", n);
// // print what's in the buffer
// // printf("Buffer contains...\n%s\n", buf);
//}
//
//void USB_write(int *fd,char *buf ){
//
//}
//
|
// Mantid Repository : https://github.com/mantidproject/mantid
//
// Copyright © 2012 ISIS Rutherford Appleton Laboratory UKRI,
// NScD Oak Ridge National Laboratory, European Spallation Source
// & Institut Laue - Langevin
// SPDX - License - Identifier: GPL - 3.0 +
#ifndef REF_SLIDER_HANDLER_H
#define REF_SLIDER_HANDLER_H
#include "MantidQtWidgets/SpectrumViewer/ISliderHandler.h"
#include <QRect>
#include "MantidQtWidgets/RefDetectorView/DllOption.h"
#include "MantidQtWidgets/SpectrumViewer/SpectrumDataSource.h"
#include "ui_RefImageView.h"
/**
@class SliderHandler
This manages the horizontal and vertical scroll bars for the
SpectrumView data viewer.
@author Dennis Mikkelson
@date 2012-04-03
*/
namespace MantidQt {
namespace RefDetectorViewer {
class EXPORT_OPT_MANTIDQT_REFDETECTORVIEWER RefSliderHandler
: public SpectrumView::ISliderHandler {
public:
/// Construct object to manage image scrollbars from the specified UI
RefSliderHandler(Ui_RefImageViewer *ivUI);
/// Configure the image scrollbars for the specified data and drawing area
void
configureSliders(QRect drawArea,
SpectrumView::SpectrumDataSource_sptr dataSource) override;
/// Configure the horizontal scrollbar to cover the specified range
void configureHSlider(int nDataSteps, int nPixels) override;
/// Return true if the image horizontal scrollbar is enabled.
bool hSliderOn() override;
/// Return true if the image vertical scrollbar is enabled.
bool vSliderOn() override;
/// Get the range of columns to display in the image.
void getHSliderInterval(int &xMin, int &xMax) override;
/// Get the range of rows to display in the image.
void getVSliderInterval(int &yMin, int &yMax) override;
private:
/// Configure the specified scrollbar to cover the specified range
void configureSlider(QScrollBar *scrollBar, int nDataSteps, int nPixels,
int val);
Ui_RefImageViewer *m_ivUI;
};
} // namespace RefDetectorViewer
} // namespace MantidQt
#endif // REF_SLIDER_HANDLER_H
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "projectexplorer_export.h"
#include <utils/osspecificaspects.h>
#include <QList>
#include <QHash>
#include <vector>
namespace Utils { class FilePath; }
namespace ProjectExplorer {
// --------------------------------------------------------------------------
// ABI (documentation inside)
// --------------------------------------------------------------------------
class Abi;
using Abis = QVector<Abi>;
class PROJECTEXPLORER_EXPORT Abi
{
public:
enum Architecture {
ArmArchitecture,
X86Architecture,
ItaniumArchitecture,
MipsArchitecture,
PowerPCArchitecture,
ShArchitecture,
AvrArchitecture,
Avr32Architecture,
XtensaArchitecture,
Mcs51Architecture,
Mcs251Architecture,
AsmJsArchitecture,
Stm8Architecture,
Msp430Architecture,
Rl78Architecture,
C166Architecture,
V850Architecture,
Rh850Architecture,
RxArchitecture,
K78Architecture,
M68KArchitecture,
M32CArchitecture,
M16CArchitecture,
M32RArchitecture,
R32CArchitecture,
CR16Architecture,
RiscVArchitecture,
UnknownArchitecture
};
enum OS {
BsdOS,
LinuxOS,
DarwinOS,
UnixOS,
WindowsOS,
VxWorks,
QnxOS,
BareMetalOS,
UnknownOS
};
enum OSFlavor {
// BSDs
FreeBsdFlavor,
NetBsdFlavor,
OpenBsdFlavor,
// Linux
AndroidLinuxFlavor,
// Unix
SolarisUnixFlavor,
// Windows
WindowsMsvc2005Flavor,
WindowsMsvc2008Flavor,
WindowsMsvc2010Flavor,
WindowsMsvc2012Flavor,
WindowsMsvc2013Flavor,
WindowsMsvc2015Flavor,
WindowsMsvc2017Flavor,
WindowsMsvc2019Flavor,
WindowsLastMsvcFlavor = WindowsMsvc2019Flavor,
WindowsMSysFlavor,
WindowsCEFlavor,
// Embedded
VxWorksFlavor,
// Generic:
RtosFlavor,
GenericFlavor,
UnknownFlavor // keep last in this enum!
};
enum BinaryFormat {
ElfFormat,
MachOFormat,
PEFormat,
RuntimeQmlFormat,
UbrofFormat,
OmfFormat,
EmscriptenFormat,
UnknownFormat
};
Abi(const Architecture &a = UnknownArchitecture, const OS &o = UnknownOS,
const OSFlavor &so = UnknownFlavor, const BinaryFormat &f = UnknownFormat,
unsigned char w = 0, const QString &p = {});
static Abi abiFromTargetTriplet(const QString &machineTriple);
static Utils::OsType abiOsToOsType(const OS os);
bool operator != (const Abi &other) const;
bool operator == (const Abi &other) const;
bool isCompatibleWith(const Abi &other) const;
bool isValid() const;
bool isNull() const;
Architecture architecture() const { return m_architecture; }
OS os() const { return m_os; }
OSFlavor osFlavor() const { return m_osFlavor; }
BinaryFormat binaryFormat() const { return m_binaryFormat; }
unsigned char wordWidth() const { return m_wordWidth; }
QString toString() const;
QString param() const;
static QString toString(const Architecture &a);
static QString toString(const OS &o);
static QString toString(const OSFlavor &of);
static QString toString(const BinaryFormat &bf);
static QString toString(int w);
static Architecture architectureFromString(const QString &a);
static OS osFromString(const QString &o);
static OSFlavor osFlavorFromString(const QString &of, const OS os);
static BinaryFormat binaryFormatFromString(const QString &bf);
static unsigned char wordWidthFromString(const QString &w);
static OSFlavor registerOsFlavor(const std::vector<OS> &oses, const QString &flavorName);
static QList<OSFlavor> flavorsForOs(const OS &o);
static QList<OSFlavor> allOsFlavors();
static bool osSupportsFlavor(const OS &os, const OSFlavor &flavor);
static OSFlavor flavorForMsvcVersion(int version);
static Abi fromString(const QString &abiString);
static Abi hostAbi();
static Abis abisOfBinary(const Utils::FilePath &path);
private:
Architecture m_architecture;
OS m_os;
OSFlavor m_osFlavor;
BinaryFormat m_binaryFormat;
unsigned char m_wordWidth;
QString m_param;
};
inline auto qHash(const ProjectExplorer::Abi &abi)
{
int h = abi.architecture()
+ (abi.os() << 3)
+ (abi.osFlavor() << 6)
+ (abi.binaryFormat() << 10)
+ (abi.wordWidth() << 13);
return QT_PREPEND_NAMESPACE(qHash)(h);
}
} // namespace ProjectExplorer
|
/* initialize_lexer - Initializes the lexer for the Snow Leopard Parser
* Library
*/
/*
* Copyright (C) 2015 Roel Sergeant (rsergeant@panix.com).
*
* This file is part of the Snow Leopard project.
*
* The Snow Leopard project is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3, or (at your option) any later
* version.
*
* The Snow Leopard project 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
* the Snow Leopard project; see the file COPYING. If not see
* <http://www.gnu.org/licenses/>.
*/
/* Standard headers */
#include <stdbool.h>
#include <stddef.h>
/* Public headers */
#include "sl/ds/string.h"
#include "sl/p/lexer.h"
/* Private headers */
#include "sl/p/_lexer.h"
/*-----------------------------------------------------------------------------
* Function initialize_lexer
*
* Initializes the lexer's global variables.
*
* Returns
* true - Lexer is correctly initialized
* false - An error occured initializing the lexer
*/
bool
initialize_lexer (void)
{
_Current_string = create_string ();
if (_Current_string == NULL)
{
/* <TODO> Report string allocation error */
return false;
}
return true;
}
/*-<EOF>-*/
|
#ifndef TYPECHECKER_H
#define TYPECHECKER_H
#include "DrawableObject.h"
namespace grumpy
{
class ASTNode;
class RTLCompiler;
enum TypeCheckerState : int
{
TYPECHECKER_STATE_WAITING,
TYPECHECKER_STATE_TYPECHECKING,
TYPECHECKER_STATE_DONE
};
class TypeChecker : public puddi::DrawableObject
{
public:
TypeChecker(Object* par, ASTNode *root);
TypeChecker(Object* par, ASTNode *root, puddi::SchematicNode *schematic);
void Update();
float GetVelocity() const;
void SetVelocity(float v);
void SetHomePosition(glm::vec4 v);
void SetRTLCompiler(RTLCompiler *c);
void Start();
private:
ASTNode *astRoot;
std::vector<ASTNode*> nodesVector;
size_t currentNodeIndex;
float velocity;
TypeCheckerState state;
glm::vec4 homePosition;
RTLCompiler *rtlCompiler;
void init(ASTNode *root);
void createNodesVector();
void addToNodesVectorRecursive(ASTNode *node);
void finish();
};
}
#endif
|
#ifndef MANTIDQT_CUSTOM_DIALOGS_SORTTABLEWORKSPACEDIALOG_H
#define MANTIDQT_CUSTOM_DIALOGS_SORTTABLEWORKSPACEDIALOG_H
//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------
#include "MantidQtWidgets/Common/AlgorithmDialog.h"
#include "ui_SortTableWorkspaceDialog.h"
#include <QMap>
namespace MantidQt {
namespace CustomDialogs {
/**
This class gives specialised dialog for the SortTableWorkspace algorithm.
@date 1/12/2014
Copyright © 2011 ISIS Rutherford Appleton Laboratory & NScD Oak Ridge
National Laboratory
This file is part of Mantid.
Mantid 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.
Mantid 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/>.
File change history is stored at: <https://github.com/mantidproject/mantid>
Code Documentation is available at: <http://doxygen.mantidproject.org>
*/
class SortTableWorkspaceDialog : public API::AlgorithmDialog {
Q_OBJECT
public:
/// Default constructor
SortTableWorkspaceDialog(QWidget *parent = nullptr);
private:
/// Initialize the layout
void initLayout() override;
/// Pass input from non-standard GUI elements to the algorithm
void parseInput() override;
/// Tie static widgets to their properties
void tieStaticWidgets(const bool readHistory);
private slots:
/// Update GUI after workspace changes
void workspaceChanged(const QString &wsName);
/// Add GUI elements to set a new column as a sorting key
void addColumn();
/// Sync the GUI after a sorting column name changes
void changedColumnName(int);
/// Remove a column to sort by.
void removeColumn();
/// Clear the GUI form the workspace specific data/elements
void clearGUI();
private:
/// Form
Ui::SortTableWorkspaceDialog m_form;
/// Names of the columns in the workspace
QStringList m_columnNames;
/// Names of columns used to sort the table
QStringList m_sortColumns;
};
} // CustomDialogs
} // MantidQt
#endif // MANTIDQT_CUSTOM_DIALOGS_SORTTABLEWORKSPACEDIALOG_H
|
/*
* Generated by asn1c-0.9.28 (http://lionet.info/asn1c)
* From ASN.1 module "PMCPDLCMessageSetVersion1"
* found in "../../../dumpvdl2.asn1/atn-b1_cpdlc-v1.asn1"
* `asn1c -fcompound-names -fincludes-quoted -gen-PER`
*/
#include "Turbulence.h"
int
Turbulence_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
/* Replace with underlying type checker */
td->check_constraints = asn_DEF_NativeEnumerated.check_constraints;
return td->check_constraints(td, sptr, ctfailcb, app_key);
}
/*
* This type is implemented using NativeEnumerated,
* so here we adjust the DEF accordingly.
*/
static void
Turbulence_1_inherit_TYPE_descriptor(asn_TYPE_descriptor_t *td) {
td->free_struct = asn_DEF_NativeEnumerated.free_struct;
td->print_struct = asn_DEF_NativeEnumerated.print_struct;
td->check_constraints = asn_DEF_NativeEnumerated.check_constraints;
td->ber_decoder = asn_DEF_NativeEnumerated.ber_decoder;
td->der_encoder = asn_DEF_NativeEnumerated.der_encoder;
td->xer_decoder = asn_DEF_NativeEnumerated.xer_decoder;
td->xer_encoder = asn_DEF_NativeEnumerated.xer_encoder;
td->uper_decoder = asn_DEF_NativeEnumerated.uper_decoder;
td->uper_encoder = asn_DEF_NativeEnumerated.uper_encoder;
if(!td->per_constraints)
td->per_constraints = asn_DEF_NativeEnumerated.per_constraints;
td->elements = asn_DEF_NativeEnumerated.elements;
td->elements_count = asn_DEF_NativeEnumerated.elements_count;
/* td->specifics = asn_DEF_NativeEnumerated.specifics; // Defined explicitly */
}
void
Turbulence_free(asn_TYPE_descriptor_t *td,
void *struct_ptr, int contents_only) {
Turbulence_1_inherit_TYPE_descriptor(td);
td->free_struct(td, struct_ptr, contents_only);
}
int
Turbulence_print(asn_TYPE_descriptor_t *td, const void *struct_ptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->print_struct(td, struct_ptr, ilevel, cb, app_key);
}
asn_dec_rval_t
Turbulence_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const void *bufptr, size_t size, int tag_mode) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->ber_decoder(opt_codec_ctx, td, structure, bufptr, size, tag_mode);
}
asn_enc_rval_t
Turbulence_encode_der(asn_TYPE_descriptor_t *td,
void *structure, int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->der_encoder(td, structure, tag_mode, tag, cb, app_key);
}
asn_dec_rval_t
Turbulence_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void **structure, const char *opt_mname, const void *bufptr, size_t size) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->xer_decoder(opt_codec_ctx, td, structure, opt_mname, bufptr, size);
}
asn_enc_rval_t
Turbulence_encode_xer(asn_TYPE_descriptor_t *td, void *structure,
int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->xer_encoder(td, structure, ilevel, flags, cb, app_key);
}
asn_dec_rval_t
Turbulence_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **structure, asn_per_data_t *per_data) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->uper_decoder(opt_codec_ctx, td, constraints, structure, per_data);
}
asn_enc_rval_t
Turbulence_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints,
void *structure, asn_per_outp_t *per_out) {
Turbulence_1_inherit_TYPE_descriptor(td);
return td->uper_encoder(td, constraints, structure, per_out);
}
static asn_per_constraints_t asn_PER_type_Turbulence_constr_1 GCC_NOTUSED = {
{ APC_CONSTRAINED, 2, 2, 0, 2 } /* (0..2) */,
{ APC_UNCONSTRAINED, -1, -1, 0, 0 },
0, 0 /* No PER value map */
};
static const asn_INTEGER_enum_map_t asn_MAP_Turbulence_value2enum_1[] = {
{ 0, 5, "light" },
{ 1, 8, "moderate" },
{ 2, 6, "severe" }
};
static const unsigned int asn_MAP_Turbulence_enum2value_1[] = {
0, /* light(0) */
1, /* moderate(1) */
2 /* severe(2) */
};
static const asn_INTEGER_specifics_t asn_SPC_Turbulence_specs_1 = {
asn_MAP_Turbulence_value2enum_1, /* "tag" => N; sorted by tag */
asn_MAP_Turbulence_enum2value_1, /* N => "tag"; sorted by N */
3, /* Number of elements in the maps */
0, /* Enumeration is not extensible */
1, /* Strict enumeration */
0, /* Native long size */
0
};
static const ber_tlv_tag_t asn_DEF_Turbulence_tags_1[] = {
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2))
};
asn_TYPE_descriptor_t asn_DEF_Turbulence = {
"Turbulence",
"Turbulence",
Turbulence_free,
Turbulence_print,
Turbulence_constraint,
Turbulence_decode_ber,
Turbulence_encode_der,
Turbulence_decode_xer,
Turbulence_encode_xer,
Turbulence_decode_uper,
Turbulence_encode_uper,
0, /* Use generic outmost tag fetcher */
asn_DEF_Turbulence_tags_1,
sizeof(asn_DEF_Turbulence_tags_1)
/sizeof(asn_DEF_Turbulence_tags_1[0]), /* 1 */
asn_DEF_Turbulence_tags_1, /* Same as above */
sizeof(asn_DEF_Turbulence_tags_1)
/sizeof(asn_DEF_Turbulence_tags_1[0]), /* 1 */
&asn_PER_type_Turbulence_constr_1,
0, 0, /* Defined elsewhere */
&asn_SPC_Turbulence_specs_1 /* Additional specs */
};
|
#include<stdarg.h>/*Y=\f*/
#include<stdio.h>/*.(\x.f(*/
#define z return/*xx))(\x.*/
#include<stdlib.h>/*f(xx))*/
typedef union w w;union w{
#define L(f,y,x,t) w _ ##\
f(w x,...){va_list argh;w\
y; va_start(argh,x);y= *\
(va_arg(argh,w*));va_end\
(argh);z(t);} w f (w fw)\
{r((w){.c= &_## f}, fw);}
int _; void*p;w(*c)(w,...
#define r(x,y)w*k=malloc\
(sizeof(w)<<1); k[0]= x\
; k[1]=y; z((w) {.p= k})
#define l(f,x,t)w _##f(\
w x,...){z(t);}w f={.p\
=(w[1]){{.c= &_##f}}};
);};w a(w f,w x){w*d=f
.p;z((*d->c)(x,d+1)
) ; }
w a_(w f,w fw){r(f,
fw);}w _(w f){w*k=f.p,r=
a(*k,k[1]); free(k) ;z(r);}
L(F,f,x,(w){._=x._?x._*a(_(f),
(w){._=x._-1})._:1})l(F_,f,F(f)
)L( W,(f),/*=\*/x,a(f,a_(x,x))
)l( Y,/*=\*/f,a(W(f),W(f))
)int main(){printf("%.""f\n",
a(a(Y,F_),(w){._=10})._
/60./60/24/*d */
) ; }
|
/******************************************************************************
* Copyright © 2012-2014 Institut für Nachrichtentechnik, Universität Rostock *
* Copyright © 2006-2012 Quality & Usability Lab, *
* Telekom Innovation Laboratories, TU Berlin *
* *
* This file is part of the SoundScape Renderer (SSR). *
* *
* The SSR 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. *
* *
* The SSR 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/>. *
* *
* The SSR is a tool for real-time spatial audio reproduction providing a *
* variety of rendering algorithms. *
* *
* http://spatialaudio.net/ssr ssr@spatialaudio.net *
******************************************************************************/
/// @file
/// NetworkSubscriber (definition).
#ifndef SSR_NETWORKSUBSCRIBER_H
#define SSR_NETWORKSUBSCRIBER_H
#include "api.h"
#include <map>
namespace ssr
{
namespace legacy_network
{
class Connection;
/** NetworkSubscriber.
* This Subscriber turns function calls to the Subscriber interface into
* strings (XML-messages in ASDF format) and sends it over a Connection to
* the connected client.
**/
class NetworkSubscriber : public api::SceneControlEvents
, public api::RendererControlEvents
, public api::SourceMetering
, public api::OutputActivity
{
public:
explicit NetworkSubscriber(Connection &connection)
: _connection(connection)
{}
private:
// SceneControlEvents
void auto_rotate_sources(bool) override {}
void delete_source(id_t id) override;
void source_active(id_t id, bool active) override;
void source_position(id_t id, const Pos& position) override;
void source_rotation(id_t id, const Rot& rotation) override;
void source_volume(id_t id, float gain) override;
void source_mute(id_t id, bool mute) override;
void source_name(id_t, const std::string&) override;
void source_model(id_t id, const std::string& model) override;
void source_fixed(id_t id, bool fix) override;
void reference_position(const Pos& position) override;
void reference_rotation(const Rot& rotation) override;
void master_volume(float volume) override;
void decay_exponent(float) override {}
void amplitude_reference_distance(float) override {}
void transport_rolling(bool) override {}
// RendererControlEvents
void processing(bool) override {}
void reference_position_offset(const Pos& position) override;
void reference_rotation_offset(const Rot& rotation) override;
// SourceMetering
void source_level(id_t id, float level) override;
// OutputActivity
void output_activity(id_t id, float* first, float* last) override;
void _send_message(const std::string& str);
void _send_source_message(
const std::string& first_part, id_t id, const std::string& second_part);
Connection &_connection;
};
} // namespace legacy_network
} // namespace ssr
#endif
|
/* Minable.h
Copyright (c) 2016 by Michael Zahniser
Endless Sky 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.
Endless Sky 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 MINABLE_H_
#define MINABLE_H_
#include "Body.h"
#include "Angle.h"
#include <list>
#include <map>
#include <memory>
#include <string>
#include <vector>
class DataNode;
class Effect;
class Flotsam;
class Outfit;
class Projectile;
class Visual;
// Class representing an asteroid or other minable object that orbits in an
// ellipse around the system center.
class Minable : public Body {
public:
/* Inherited from Body:
Frame GetFrame(int step = -1) const;
const Mask &GetMask(int step = -1) const;
const Point &Position() const;
const Point &Velocity() const;
const Angle &Facing() const;
Point Unit() const; */
// Load a definition of a minable object.
void Load(const DataNode &node);
const std::string &Name() const;
// Place a minable object with up to the given energy level, on a random
// orbit and a random position along that orbit.
void Place(double energy, double beltRadius);
// Move the object forward one step. If it has been reduced to zero hull, it
// will "explode" instead of moving, creating flotsam and explosion effects.
// In that case it will return false, meaning it should be deleted.
bool Move(std::vector<Visual> &visuals, std::list<std::shared_ptr<Flotsam>> &flotsam);
// Damage this object (because a projectile collided with it).
void TakeDamage(const Projectile &projectile);
private:
std::string name;
// Current angular position relative to the focus of the elliptical orbit,
// in radians. An angle of zero is the periapsis point.
double theta;
// Eccentricity of the orbit. 0 is circular and 1 is a parabola.
double eccentricity;
// Angular momentum (radius^2 * angular velocity) will always be conserved.
// The object's mass can be ignored, because it is a constant.
double angularMomentum;
// Scale of the orbit. This is the orbital radius when theta is 90 degrees.
// The periapsis and apoapsis radii are scale / (1 +- eccentricity).
double scale;
// Rotation of the orbit - that is, the angle of periapsis - in radians.
double rotation;
// Rate of spin of the object.
Angle spin;
// Cache the current orbital radius. It can be calculated from theta and the
// parameters above, but this avoids having to calculate every radius twice.
double radius;
// Remaining "hull" strength of the object, before it is destroyed.
double hull = 1000.;
// Material released when this object is destroyed. Each payload item only
// has a 25% chance of surviving, meaning that usually the yield is much
// lower than the defined limit but occasionally you get quite lucky.
std::map<const Outfit *, int> payload;
// Explosion effects created when this object is destroyed.
std::map<const Effect *, int> explosions;
};
#endif
|
/*
Copyright (C) Hongsen Liao
Institute of Computer Graphics and Computer Aided Design
School of Software, Tsinghua University
Contact: liaohs082@gmail.com
All rights reserved.
*/
#ifndef RANDOM_WALKER_H_
#define RANDOM_WALKER_H_
#include <vector>
using namespace std;
class RandomWalker
{
public:
RandomWalker();
~RandomWalker();
static bool GenerateProb(vector<vector<bool>>& connect, vector<vector<float>>& distance, vector<float>& labels);
};
#endif
|
#pragma once
#include "D3D11RHI.h"
#include "UnrealMath.h"
void InitBasePass();
|
/**
******************************************************************************
* @file HAL/HAL_TimeBase_RTC_ALARM/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.3.0
* @date 17-February-2017
* @brief Interrupt Service Routines.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2>>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "main.h"
#include "stm32f4xx_it.h"
/** @addtogroup STM32F4xx_HAL_Examples
* @{
*/
/** @addtogroup HAL_TimeBase_RTC_Alarm
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles External lines 10 to 15 interrupt request.
* @param None
* @retval None
*/
void EXTI15_10_IRQHandler(void)
{
HAL_GPIO_EXTI_IRQHandler(KEY_BUTTON_PIN);
}
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 2013 James Haley et al.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see http://www.gnu.org/licenses/
//
//--------------------------------------------------------------------------
//
// DESCRIPTION:
// System specific interface stuff.
//
//-----------------------------------------------------------------------------
#ifndef D_TICCMD_H__
#define D_TICCMD_H__
#include "doomtype.h"
// NETCODE_FIXME: ticcmd_t lives here. It's the structure used to hold
// all player input that can currently be transmitted across the network.
// It is NOT sufficient for the following reasons:
// 1) It cannot efficiently transmit console cmd/cvar changes
// 2) It cannot efficiently transmit player chat (and never has)
// 3) Weapon changes and special events are packed into buttons using
// special bit codes. This is hackish and artificially limiting, and
// will create severe problems for the future generalized weapon
// system.
// 4) There is no packing currently, so the entire ticcmd_t structure
// is sent every tic, sometimes multiple times. This is horribly
// inefficient and is hampering the addition of more inputs such as
// flying, swimming, jumping, inventory use, etc.
//
// DEMO_FIXME: Warning -- changes to ticcmd_t must be reflected in the
// code that reads and writes demos as well.
// ticcmds are built in G_BuildTiccmd or by G_ReadDemoTiccmd
// ticcmds are transmitted over the network by code in d_net.c
//
// haleyjd 10/16/07: ticcmd_t must be packed
#if defined(_MSC_VER) || defined(__GNUC__)
#pragma pack(push, 1)
#endif
// The data sampled per tick (single player)
// and transmitted to other peers (multiplayer).
// Mainly movements/button commands per game tick,
// plus a checksum for internal state consistency.
struct ticcmd_t
{
int8_t forwardmove; // *2048 for move
int8_t sidemove; // *2048 for move
int8_t fly; // haleyjd: flight
int16_t look; // haleyjd: <<16 for look delta
int16_t angleturn; // <<16 for angle delta
int16_t consistency; // checks for net game
byte chatchar;
byte buttons;
byte actions;
};
#if defined(_MSC_VER) || defined(__GNUC__)
#pragma pack(pop)
#endif
#endif
//----------------------------------------------------------------------------
//
// $Log: d_ticcmd.h,v $
// Revision 1.2 1998/01/26 19:26:36 phares
// First rev with no ^Ms
//
// Revision 1.1.1.1 1998/01/19 14:03:08 rand
// Lee's Jan 19 sources
//
//
//----------------------------------------------------------------------------
|
#ifndef TWORKER_H
#define TWORKER_H
#include <QDebug>
#include <QThread>
#include <QObject>
#include <QMutex>
#include <QTimer>
#include <QEventLoop>
#include <QLabel>
#include <QPixmap>
class TWorker : public QObject
{
Q_OBJECT
public:
explicit TWorker(QObject *parent = 0);
~TWorker();
void requestWork();
void abort();
QLabel * imageLabel;
QList<QPixmap *> CoverArtList;
QString dirpath;
private:
bool _working;
bool _abort;
QMutex mutex;
quint16 imagecounter = 0;
signals:
void workRequested();
void valueChanged(const QString &value);
void finished();
public slots:
void doWork();
};
#endif // TWORKER_H
|
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Charts module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 or (at your option) any later version
** approved by the KDE Free Qt Foundation. The licenses are as published by
** the Free Software Foundation and appearing in the file LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CANDLESTICKDATAREADER_H
#define CANDLESTICKDATAREADER_H
#include <QtCharts/QCandlestickSet>
#include <QtCore/QTextStream>
QT_USE_NAMESPACE
class CandlestickDataReader : public QTextStream
{
public:
explicit CandlestickDataReader(QIODevice *device);
~CandlestickDataReader();
void readFile(QIODevice *device);
QCandlestickSet *readCandlestickSet();
};
#endif // CANDLESTICKDATAREADER_H
|
// *************************************************************************
// This file is part of the SimpleGUI Example Module by Steaphan Greene
//
// Copyright 2005-2015 Steaphan Greene <steaphan@gmail.com>
//
// SimpleGUI 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.
//
// SimpleGUI 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 SimpleGUI (see the file named "COPYING");
// If not, see <http://www.gnu.org/licenses/>.
//
// *************************************************************************
// Rob W. Brooks (rob@atomicpenguin.net) is to be blamed for any problems
// with this module in its mature state.
#ifndef SG_LISTBOX_H
#define SG_LISTBOX_H
#include <set>
#include <deque>
#include <map>
using namespace std;
#include "sg_compound.h"
#include "simpletexture.h"
#include "sg_panel.h"
#include "sg_stickybutton.h"
class SG_Button;
class SG_TextArea;
class SG_ListBox : public SG_Compound {
public:
SG_ListBox(const vector<SG_Widget*>& items, SimpleTexture desel,
SimpleTexture sel, SimpleTexture click, SimpleTexture disable,
unsigned int min = 1, unsigned int max = 1, bool vert = true,
float border = 0.1);
virtual ~SG_ListBox();
bool SetSelection(const set<int>& toselect);
void AddItem(SG_Widget* w, int at = -1);
// Adds the passed widget pointer to the list
// If at == -1 or at >= number of items in the list, it is added to the end of
// the list
// (NOTE passing a value larger then the number of items will NOT expand
// the list
// accomodate the passed index, it will expand the list item count by ONE)
// If at >= 0 && a < number of items it will be inserted at that the passed
// position
// and will push the former occupier and all the follow one position
// forward
bool RemoveItem(unsigned int item);
// Removes item number from list
// Will succeed only if with this item the minimum selection count can still
// be satisified
// If selected and at minimum selection the minimum will be satisified
// starting with the
// first item and proceeding down the list until the minimum is reached
// virtual bool SetDefaultCursor(GL_MODEL *cur);
virtual bool ChildEvent(SDL_Event* event);
deque<int> Which() { return selhistory; }
protected:
void Select(int ind);
bool Deselect(bool override = false, int ind = -1);
// static GL_MODEL Default_Mouse_Cursor;
bool vertical;
unsigned int listsize;
unsigned int minsel, maxsel;
float alignborder;
SimpleTexture texdesel, texsel, texclick, texdisable;
deque<int> selhistory;
vector<SG_StickyButton*> stickies;
vector<SG_Alignment*> aligns;
map<SG_StickyButton*, int> ptr2pos;
};
#endif // SG_LISTBOX_H
|
/* jconfig.vc --- jconfig.h for Microsoft Visual C++ on Windows 95 or NT. */
/* see jconfig.doc for explanations */
#define HAVE_PROTOTYPES
#define HAVE_UNSIGNED_CHAR
#define HAVE_UNSIGNED_SHORT
/* #define void char */
/* #define const */
#undef CHAR_IS_UNSIGNED
#define HAVE_STDDEF_H
#define HAVE_STDLIB_H
#undef NEED_BSD_STRINGS
#undef NEED_SYS_TYPES_H
#undef NEED_FAR_POINTERS /* we presume a 32-bit flat memory model */
#undef NEED_SHORT_EXTERNAL_NAMES
#undef INCOMPLETE_TYPES_BROKEN
/* Define "boolean" as unsigned char, not int, per Windows custom */
#ifndef __RPCNDR_H__ /* don't conflict if rpcndr.h already read */
typedef unsigned char boolean;
#endif
#define HAVE_BOOLEAN /* prevent jmorecfg.h from redefining it */
#ifdef JPEG_INTERNALS
#undef RIGHT_SHIFT_IS_UNSIGNED
#endif /* JPEG_INTERNALS */
#ifdef JPEG_CJPEG_DJPEG
#define BMP_SUPPORTED /* BMP image file format */
#define GIF_SUPPORTED /* GIF image file format */
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
#undef RLE_SUPPORTED /* Utah RLE image file format */
#define TARGA_SUPPORTED /* Targa image file format */
#define TWO_FILE_COMMANDLINE /* optional */
#define USE_SETMODE /* Microsoft has setmode() */
#undef NEED_SIGNAL_CATCHER
#undef DONT_USE_B_MODE
#undef PROGRESS_REPORT /* optional */
#endif /* JPEG_CJPEG_DJPEG */
|
#ifndef CONTROLLER_H
#define CONTROLLER_H
#include "controller_struct.h"
#include <fstream>
#include "QDebug"
using namespace std;
class Controller : public QObject
{
Q_OBJECT
public:
explicit Controller(QObject *parent = 0);
ControllerResult calc(ControllerInput &ci);
private:
QTime timer;
RobotSpeed calcRobotSpeed_main(ControllerInput &ci);
MotorSpeed calcSimul(RobotSpeed rs, ControllerInput &ci);
private:
Vector2D err0,err1;
Vector2D u1;
Vector2D derived0,derived1;
Vector2D integral;
Vector2D last_setpoint ;
//kamin
Vector2D LinearSpeed;
Vector2D LinearSpeed_past;
//kamout
double wu1,wu1_last,wintegral,werr0,werr1;
double wderived0,wderived1;
///////////////////////////////////////////////////////////////new controller
double wp,wi,wd;
Vector2D p,i,d,i_near,i_far;
int fault_counter;
///////////////////////////////////////////////////////////////
int stateCTRL;
ofstream out;
};
#endif // CONTROLLER_H
|
/* PSPPIRE - a graphical user interface for PSPP.
Copyright (C) 2016 Free Software Foundation
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#ifndef WINDOWS_MENU_H
#define WINDOWS_MENU_H
#include <gtk/gtk.h>
GtkWidget * create_windows_menu (GtkWindow *toplevel);
#endif
|
////////////////////////////////////////////////////////////////////////////////////
//
// FILE: uMT.h
// AUTHOR: Antonio Pastore - March 2017
// Program originally written by Antonio Pastore, Torino, ITALY.
// UPDATED: 6 May 2017
//
////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) <2017> Antonio Pastore, Torino, ITALY.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
////////////////////////////////////////////////////////////////////////////////////
#ifndef uMT_ERRNO_H
#define uMT_ERRNO_H
////////////////////////////////////////////////////////////////////////////////////
//
// uMT ERRNO
//
////////////////////////////////////////////////////////////////////////////////////
enum Errno_t
{
/* 00 */ E_SUCCESS, // SUCCESS
/* 01 */ E_ALREADY_INITED, // KERNEL already inited
/* 02 */ E_ALREADY_STARTED, // TASK already started
/* 03 */ E_NOT_INITED, // KERNEL not inited
/* 04 */ E_WOULD_BLOCK, // Operation would block calling TASK
/* 05 */ E_NOMORE_TASKS, // No more TASK entries available
/* 06 */ E_INVALID_TASKID, // Invalid TASK Id
/* 07 */ E_INVALID_TIMERID, // Invalid TIMER Id
/* 08 */ E_INVALID_MAX_TASK_NUM, // Not enough TASK entries configured in the Kernel (Kn_Start) or too many
/* 09 */ E_INVALID_SEMID, // Invalid SEMAPHORE Id
/* 10 */ E_INVALID_TIMEOUT, // Invalid timeout (zero or too large)
/* 11 */ E_OVERFLOW_SEM, // Semaphore counter overflow
/* 12 */ E_NOMORE_TIMERS, // No more Timers available
/* 13 */ E_NOT_OWNED_TIMER, // TIMER is not owned by this task
/* 14 */ E_TASK_NOT_STARTED, // TASK not started, cannot ReStartTask()
/* 15 */ E_TIMEOUT, // Timeout
/* 16 */ E_NOT_ALLOWED, // Not allowed [Tk_ReStartTask() suicide]
/* 17 */ E_INVALID_OPTION, // Invalid additional option
/* 18 */ E_NO_MORE_MEMORY, // No more memory available [Tk_CreateTask()]
/* 19 */ E_INVALID_STACK_SIZE, // Invalid STACK size [Tk_CreateTask()]
/* 20 */ E_INVALID_MAX_TIMER_NUM, // Invalid max Timer number [Kn_start()]
/* 21 */ E_INVALID_MAX_SEM_NUM // Invalid max Semaphore number [Kn_start()]
};
#endif
////////////// EOF
|
/*
* Multi2Sim
* Copyright (C) 2012 Rafael Ubal (ubal@ece.neu.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
*/
#include <assert.h>
#include <lib/esim/esim.h>
#include <lib/mhandle/mhandle.h>
#include <lib/util/debug.h>
#include <lib/util/list.h>
#include <lib/util/string.h>
#include "buffer.h"
#include "link.h"
#include "network.h"
#include "node.h"
struct net_link_t *net_link_create(struct net_t *net,
struct net_node_t *src_node,struct net_node_t *dst_node,
int bandwidth, int virtual_channel)
{
struct net_link_t *link;
struct net_buffer_t *src_buffer;
struct net_buffer_t *dst_buffer;
char name[MAX_STRING_SIZE];
/* Fields */
link = xcalloc(1, sizeof(struct net_link_t));
link->net = net;
link->src_node = src_node;
link->dst_node = dst_node;
link->bandwidth = bandwidth;
link->virtual_channel = virtual_channel;
for (int i = 0; i < virtual_channel ; i++)
{
src_buffer = net_node_add_output_buffer(src_node);
dst_buffer = net_node_add_input_buffer(dst_node);
if (i == 0)
{
/* Name */
snprintf(name, sizeof(name), "link_<%s.%s>_<%s.%s>", src_node->name,
src_buffer->name, dst_node->name, dst_buffer->name);
link->name = xstrdup(name);
link->src_buffer = src_buffer;
link->dst_buffer = dst_buffer;
}
/* Connect buffers to link */
assert(!src_buffer->link);
assert(!dst_buffer->link);
src_buffer->link = link;
dst_buffer->link = link;
}
if (bandwidth < 1)
panic("%s: invalid bandwidth", __FUNCTION__);
/* Return */
return link;
}
void net_link_free(struct net_link_t *link)
{
free(link->name);
free(link);
}
void net_link_dump_report(struct net_link_t *link, FILE *f)
{
struct net_t *net = link->net;
fprintf(f, "[ Network.%s.Link.%s ]\n", net->name, link->name);
fprintf(f, "Config.Bandwidth = %d\n", link->bandwidth);
fprintf(f, "TransferredMessages = %lld\n", link->transferred_msgs);
fprintf(f, "TransferredBytes = %lld\n", link->transferred_bytes);
fprintf(f, "BusyCycles = %lld\n", link->busy_cycles);
fprintf(f, "BytesPerCycle = %.4f\n", esim_cycle ?
(double) link->transferred_bytes / esim_cycle : 0.0);
fprintf(f, "Utilization = %.4f\n", esim_cycle ?
(double) link->transferred_bytes / (esim_cycle * link->bandwidth) : 0.0);
fprintf(f, "\n");
}
struct net_buffer_t *net_link_arbitrator_vc(struct net_link_t *link, struct net_node_t *node)
{
struct net_node_t *src_node = link->src_node;
struct net_node_t *dst_node = link->dst_node;
struct net_buffer_t *output_buffer;
struct net_msg_t *msg;
int output_buffer_count = list_count(src_node->output_buffer_list);
int input_buffer_count = list_count(dst_node->input_buffer_list);
/* Keeping indexes of last chosen buffer*/
int last_output_buffer_vc_index ;
int output_buffer_vc_index;
int i;
/*performing the check */
assert(node == src_node);
/* Getting the indexes of first output buffer and input buffer that are *
* connected to a link with virtual channel capability */
int out_vc_count = 0;
int in_vc_count = 0;
int first_src_buffer_act_index = 0;
int first_dst_buffer_act_index = 0;
for (i = 0; i < output_buffer_count; i++)
{
struct net_buffer_t *temp_out_buffer;
temp_out_buffer = list_get(src_node->output_buffer_list,i);
if (temp_out_buffer->link == link)
out_vc_count++;
if (out_vc_count == 1)
first_src_buffer_act_index = temp_out_buffer->index;
}
for (int j = 0; j < input_buffer_count; j++)
{
struct net_buffer_t *temp_in_buffer;
temp_in_buffer = list_get(dst_node->input_buffer_list, j);
if (temp_in_buffer->link == link)
in_vc_count++;
if (in_vc_count == 1)
first_dst_buffer_act_index = temp_in_buffer->index;
}
/* Checks */
assert (in_vc_count == link->virtual_channel);
assert (out_vc_count == link->virtual_channel);
/* If last decision was within the same cycle, return the same value */
if (link->sched_when == esim_cycle)
return link->sched_buffer;
/*make a new decision */
link->sched_when = esim_cycle;
last_output_buffer_vc_index = link->sched_buffer ?
(link->sched_buffer->index - first_src_buffer_act_index) : 0;
/*link must be ready*/
if (link->busy >= esim_cycle)
{
link->sched_buffer = NULL;
return NULL;
}
/*find output buffer to fetch from */
for (i = 0; i < link->virtual_channel; i ++)
{
output_buffer_vc_index = (last_output_buffer_vc_index + i + 1) % link->virtual_channel ;
output_buffer = list_get(node->output_buffer_list,
(output_buffer_vc_index + first_src_buffer_act_index));
assert(output_buffer->link == link);
/*msg should be at head*/
msg =list_get(output_buffer->msg_list,0);
if (!msg)
continue;
/*msg must be ready */
if (msg->busy >= esim_cycle)
continue;
/*output buffer must be ready */
if (output_buffer->read_busy >= esim_cycle)
continue;
/*ALL conditions satisfied */
link->sched_buffer = output_buffer ;
link->src_buffer = output_buffer;
struct net_buffer_t *input_buffer ;
input_buffer = list_get(dst_node->input_buffer_list, (output_buffer_vc_index + first_dst_buffer_act_index));
assert (input_buffer->link == link);
link->dst_buffer = input_buffer;
return output_buffer;
}
/*No output buffer ready */
link->sched_buffer = NULL;
return NULL;
}
|
#ifndef VDB_PRINT_H
#define VDB_PRINT_H
namespace vdis
{
struct abstract_siman_pdu_t;
struct application_control_pdu_t;
class pdu_t;
}
namespace vdb
{
class pdu_data_t;
class print
{
public:
static void print_pdu(
const pdu_data_t &data,
const vdis::pdu_t &pdu,
std::ostream &out
);
static bool print_pdu_source_time;
private:
static void print_data(
const pdu_data_t &data,
std::ostream &out
);
static void print_pdu_extracted(
const pdu_data_t &data,
const vdis::pdu_t &pdu,
std::ostream &out
);
static void print_pdu_hex_dump(
const pdu_data_t &data,
std::ostream &out
);
static void print_pdu_normal(
const pdu_data_t &data,
const vdis::pdu_t &pdu,
std::ostream &out
);
static void print_pdu_summary(
const vdis::pdu_t &pdu,
std::ostream &out
);
static void print_datum_record_summary(
const vdis::abstract_siman_pdu_t &pdu,
std::ostream &out
);
static void print_standard_variable_record_summary(
const vdis::application_control_pdu_t &pdu,
std::ostream &out
);
};
}
#endif
|
// This file is part of the PATH PLANNING PLUGIN for V-REP
//
// Copyright 2006-2014 Coppelia Robotics GmbH. All rights reserved.
// marc@coppeliarobotics.com
// www.coppeliarobotics.com
//
// The PATH PLANNING PLUGIN is licensed under the terms of EITHER:
// 1. PATH PLANNING PLUGIN commercial license (contact us for details)
// 2. PATH PLANNING PLUGIN educational license (see below)
//
// PATH PLANNING PLUGIN educational license:
// -------------------------------------------------------------------
// The PATH PLANNING PLUGIN educational license applies only to EDUCATIONAL
// ENTITIES composed by following people and institutions:
//
// 1. Hobbyists, students, teachers and professors
// 2. Schools and universities
//
// EDUCATIONAL ENTITIES do NOT include companies, research institutions,
// non-profit organisations, foundations, etc.
//
// An EDUCATIONAL ENTITY may use, modify, compile and distribute the
// modified/unmodified PATH PLANNING PLUGIN under following conditions:
//
// 1. Distribution should be free of charge.
// 2. Distribution should be to EDUCATIONAL ENTITIES only.
// 3. Usage should be non-commercial.
// 4. Altered source versions must be plainly marked as such and distributed
// along with any compiled code.
// 5. When using the PATH PLANNING PLUGIN in conjunction with V-REP, the "EDU"
// watermark in the V-REP scene view should not be removed.
// 6. The origin of the PATH PLANNING PLUGIN must not be misrepresented. you must
// not claim that you wrote the original software.
//
// THE PATH PLANNING PLUGIN IS DISTRIBUTED "AS IS", WITHOUT ANY EXPRESS OR
// IMPLIED WARRANTY. THE USER WILL USE IT AT HIS/HER OWN RISK. THE ORIGINAL
// AUTHORS AND COPPELIA ROBOTICS GMBH WILL NOT BE LIABLE FOR DATA LOSS,
// DAMAGES, LOSS OF PROFITS OR ANY OTHER KIND OF LOSS WHILE USING OR
// MISUSING THIS SOFTWARE.
// -------------------------------------------------------------------
//
// This file was automatically created for V-REP release V3.1.3 on Sept. 30th 2014
#ifndef LAZY_RRGSTAR_H_
#define LAZY_RRGSTAR_H_
#include <vector>
#include "HolonomicPathPlanning.h"
#include "LazyRRGstarNode.h"
#include "dummyClasses.h"
#include "4Vector.h"
#include "7Vector.h"
// using namespace std;
class LazyRRGstar : public CHolonomicPathPlanning
{
public:
LazyRRGstar(int theStartDummyID,int theGoalDummyID,
int theRobotCollectionID,int theObstacleCollectionID,int ikGroupID,
int thePlanningType,float theAngularCoeff,
float theStepSize,
const float theSearchMinVal[4],const float theSearchRange[4],
const int theDirectionConstraints[4],const float clearanceAndMaxDistance[2],const C3Vector& gammaAxis);
virtual ~LazyRRGstar();
// Following functions are inherited from CPathPlanning:
int searchPath(int maxTimePerPass);
void getPathData(std::vector<float> &data);
bool setPartialPath();
void getSearchTreeData(std::vector<float>& data, bool fromStart);
float getNearNeighborK(void);
float getNearNeighborRadius(void);
// <Set/Getters
void setGoalBias(float goalBias) { _goalBias = goalBias; }
float getGoalBias(void) { return _goalBias; }
void setMaxDistance(float maxDistance) { _maxDistance = maxDistance; }
float getMaxDistance(void) { return _maxDistance; }
// >
// Return the length of best solution path and its actual sequence of configurations
// as vector form.
float getBestSolutionPath(LazyRRGstarNode* goal_node);
private:
float distance(LazyRRGstarNode* a, LazyRRGstarNode* b);
// int getVector(LazyRRGstarNode* fromPoint,LazyRRGstarNode* toPoint,float vect[7],float e,float& artificialLength,bool dontDivide);
std::vector<LazyRRGstarNode*> getNearNeighborNodes(std::vector<LazyRRGstarNode*>& nodes, LazyRRGstarNode* node, float radius);
LazyRRGstarNode* extend(LazyRRGstarNode* from, LazyRRGstarNode* to,
bool shouldBeConnected, CDummyDummy* dummy, float &artificialCost);
LazyRRGstarNode* lazyExtend(LazyRRGstarNode* from, LazyRRGstarNode* to,
bool shouldBeConnected, CDummyDummy* dummy, float &artificialCost);
LazyRRGstarNode* slerp(LazyRRGstarNode*, LazyRRGstarNode*, float t);
bool isFree(LazyRRGstarNode*, CDummyDummy *dummy);
bool shouldBeLazy(LazyRRGstarNode* from, LazyRRGstarNode* to);
void DynamicShortestPathUpdate(CDummyDummy* startDummy);
void DynamicDecrease(LazyRRGstarNode *node);
void DynamicIncrease(LazyRRGstarNode *from, LazyRRGstarNode *to);
void DynamicDelete(LazyRRGstarNode *from, LazyRRGstarNode *to);
bool gotPotential(LazyRRGstarNode* it);
std::shared_ptr<ompl::NearestNeighbors<LazyRRGstarNode*> > _nn;
// <RRG controllable parameters
float _kConstant;
float _rConstant;
float _ballRadiusMax;
float _goalBias;
float _maxDistance;
// >
LazyRRGstarNode* _start_node;
LazyRRGstarNode* _goal_node;
float _best_cost;
float _dimension;
std::vector<int> _nn_cache;
std::vector<int> _depth_table;
std::vector<LazyRRGstarNode*> _witnesses;
// <For evaluation
int _skipped_collision_detection_count;
int _dynamic_increase_count;
int _dynamic_decrease_count;
int _remove_time;
int _collision_detection_time; // in ms
int _dynamic_increase_time;
int _dynamic_decrease_time;
int _near_neighbor_search_time;
// >
};
#endif //LAZY_RRGSTAR_H_
|
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#define AMP_MAX 255
#define AMP_MIN 0
#define PI 3.14159265358979323846264338327
int main(int argc, char** argv) {
// set start values for vars
int period, i, out;
double stepRad;
// get period
if (argc == 2) {
// cast the bytes from pos 1 in argv
// to an integer
period = atoi(argv[1]);
} else {
// set default
period = 400;
}
// work out steps to make complete cycle
// in radians
stepRad = (2 * PI) / period;
// set counter
i = 0;
// generate wave infinitely
while (1) {
if (i == period) {
i = 0;
}
out = round(sin(stepRad * i) * ((AMP_MAX - 1) / 2));
putchar(out + 127);
i += 1;
}
return 0;
}
|
////////////////////////////////////////////////////////////////////////////////
//
// (C) Andy Thomason 2012-2014
//
// Modular Framework for OpenGLES2 rendering on multiple platforms.
//
// raw 3D mesh container
//
namespace octet { namespace scene {
class skin : public resource {
// the original transform of the skin to world space (bind space)
mat4t modelToBind;
// for each scene_node, map from world space (bind space) to model space
dynarray<mat4t> bindToModel;
// a name for each joint (sid)
dynarray<atom_t> joints;
public:
RESOURCE_META(skin)
skin() {
}
skin(const mat4t &modelToBind) {
this->modelToBind = modelToBind;
}
void visit(visitor &v) {
v.visit(modelToBind, atom_modelToBind);
v.visit(bindToModel, atom_bindToModel);
v.visit(joints, atom_joints);
}
void add_joint(const mat4t &bindToModel, atom_t sid) {
this->bindToModel.push_back(bindToModel);
joints.push_back(sid);
log("skin: add_joint %d\n", sid);
}
int find_joint(atom_t sid) {
for (unsigned i = 0; i != joints.size(); ++i) {
if (joints[i] == sid) {
return i;
}
}
return -1;
}
const mat4t &get_bindToModel(int i) const { return bindToModel[i]; }
const mat4t &get_modelToBind() const { return modelToBind; }
atom_t get_joint(int i) const { return joints[i]; }
unsigned get_num_joints() const { return joints.size(); }
};
}}
|
#include <glib.h>
GQuark
missing_file_gquark (void)
{
return g_quark_from_static_string ("missing_file");
}
GQuark
bad_tag_gquark (void)
{
return g_quark_from_static_string ("bad_tag");
}
GQuark
key_deriv_gquark (void)
{
return g_quark_from_static_string ("key_deriv");
}
GQuark
file_too_big_gquark (void)
{
return g_quark_from_static_string ("file_too_big");
}
GQuark
generic_error_gquark (void)
{
return g_quark_from_static_string ("generic_error");
}
GQuark
memlock_error_gquark (void)
{
return g_quark_from_static_string ("memlock_error");
}
|
// <osiris_sps_source_header>
// This file is part of Osiris Serverless Portal System.
// Copyright (C)2005-2012 Osiris Team (info@osiris-sps.org) / http://www.osiris-sps.org )
//
// Osiris Serverless Portal System 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.
//
// Osiris Serverless Portal System 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 Osiris Serverless Portal System. If not, see <http://www.gnu.org/licenses/>.
// </osiris_sps_source_header>
#ifndef _IDE_BBCODES_GOTO_H
#define _IDE_BBCODES_GOTO_H
#include "iomlcode.h"
#include "ideide.h"
#include "portalsportals.h"
//////////////////////////////////////////////////////////////////////
OS_NAMESPACE_BEGIN()
//////////////////////////////////////////////////////////////////////
class EngineExport OMLGoto : public IOMLCode
{
// Construction
public:
OMLGoto(const String& tag);
virtual ~OMLGoto();
// Operation
// ICode implementation
public:
virtual String processHtml(shared_ptr<OMLItem> i, shared_ptr<OMLContext> context) const;
};
//////////////////////////////////////////////////////////////////////
OS_NAMESPACE_END()
//////////////////////////////////////////////////////////////////////
#endif // _IDE_BBCODES_GOTO_H
|
/*
* Copyright (c) 2015 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. The rights granted to you under the License
* may not be used to create, or enable the creation or redistribution of,
* unlawful or unlicensed copies of an Apple operating system, or to
* circumvent, violate, or enable the circumvention or violation of, any
* terms of an Apple operating system software license agreement.
*
* Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
#ifndef _MACHINE_ATOMIC_H
#define _MACHINE_ATOMIC_H
#include <stdatomic.h>
#if defined (__x86_64__)
#include "i386/atomic.h"
#elif defined (__arm__) || defined (__arm64__)
#include "arm/atomic.h"
#else
#error architecture not supported
#endif
#endif /* _MACHINE_ATOMIC_H */
|
/**********************************************************************/
/* ____ ____ */
/* / /\/ / */
/* /___/ \ / */
/* \ \ \/ */
/* \ \ Copyright (c) 2003-2009 Xilinx, Inc. */
/* / / All Right Reserved. */
/* /---/ /\ */
/* \ \ / \ */
/* \___\/\___\ */
/***********************************************************************/
/* This file is designed for use with ISim build 0xfbc00daa */
#define XSI_HIDE_SYMBOL_SPEC true
#include "xsi.h"
#include <memory.h>
#ifdef __GNUC__
#include <stdlib.h>
#else
#include <malloc.h>
#define alloca _alloca
#endif
static const char *ng0 = "/home/robert/Github/UMD_RISC-16G5/ProjectLab1/Poject_Lab01/Project1/DATA_CTL.vhd";
extern char *IEEE_P_2592010699;
unsigned char ieee_p_2592010699_sub_2763492388968962707_503743352(char *, char *, unsigned int , unsigned int );
static void work_a_3760980685_3212880686_p_0(char *t0)
{
char *t1;
char *t2;
unsigned char t3;
char *t4;
char *t5;
char *t6;
char *t7;
char *t8;
LAB0: xsi_set_current_line(44, ng0);
LAB3: t1 = (t0 + 1832U);
t2 = *((char **)t1);
t3 = *((unsigned char *)t2);
t1 = (t0 + 4072);
t4 = (t1 + 56U);
t5 = *((char **)t4);
t6 = (t5 + 56U);
t7 = *((char **)t6);
*((unsigned char *)t7) = t3;
xsi_driver_first_trans_fast_port(t1);
LAB2: t8 = (t0 + 3960);
*((int *)t8) = 1;
LAB1: return;
LAB4: goto LAB2;
}
static void work_a_3760980685_3212880686_p_1(char *t0)
{
char *t1;
char *t2;
unsigned char t3;
char *t4;
char *t5;
char *t6;
char *t7;
char *t8;
LAB0: xsi_set_current_line(45, ng0);
LAB3: t1 = (t0 + 1992U);
t2 = *((char **)t1);
t3 = *((unsigned char *)t2);
t1 = (t0 + 4136);
t4 = (t1 + 56U);
t5 = *((char **)t4);
t6 = (t5 + 56U);
t7 = *((char **)t6);
*((unsigned char *)t7) = t3;
xsi_driver_first_trans_fast_port(t1);
LAB2: t8 = (t0 + 3976);
*((int *)t8) = 1;
LAB1: return;
LAB4: goto LAB2;
}
static void work_a_3760980685_3212880686_p_2(char *t0)
{
char *t1;
unsigned char t2;
char *t3;
char *t4;
char *t5;
int t6;
char *t7;
int t9;
char *t10;
char *t11;
char *t12;
char *t13;
char *t14;
LAB0: xsi_set_current_line(48, ng0);
t1 = (t0 + 992U);
t2 = ieee_p_2592010699_sub_2763492388968962707_503743352(IEEE_P_2592010699, t1, 0U, 0U);
if (t2 != 0)
goto LAB2;
LAB4:
LAB3: t1 = (t0 + 3992);
*((int *)t1) = 1;
LAB1: return;
LAB2: xsi_set_current_line(49, ng0);
t3 = (t0 + 1352U);
t4 = *((char **)t3);
t3 = (t0 + 6560);
t6 = xsi_mem_cmp(t3, t4, 4U);
if (t6 == 1)
goto LAB6;
LAB9: t7 = (t0 + 6564);
t9 = xsi_mem_cmp(t7, t4, 4U);
if (t9 == 1)
goto LAB7;
LAB10:
LAB8: xsi_set_current_line(54, ng0);
t1 = (t0 + 4200);
t3 = (t1 + 56U);
t4 = *((char **)t3);
t5 = (t4 + 56U);
t7 = *((char **)t5);
*((unsigned char *)t7) = (unsigned char)2;
xsi_driver_first_trans_fast(t1);
xsi_set_current_line(55, ng0);
t1 = (t0 + 4264);
t3 = (t1 + 56U);
t4 = *((char **)t3);
t5 = (t4 + 56U);
t7 = *((char **)t5);
*((unsigned char *)t7) = (unsigned char)2;
xsi_driver_first_trans_fast(t1);
LAB5: goto LAB3;
LAB6: xsi_set_current_line(50, ng0);
t10 = (t0 + 4200);
t11 = (t10 + 56U);
t12 = *((char **)t11);
t13 = (t12 + 56U);
t14 = *((char **)t13);
*((unsigned char *)t14) = (unsigned char)3;
xsi_driver_first_trans_fast(t10);
xsi_set_current_line(51, ng0);
t1 = (t0 + 4264);
t3 = (t1 + 56U);
t4 = *((char **)t3);
t5 = (t4 + 56U);
t7 = *((char **)t5);
*((unsigned char *)t7) = (unsigned char)2;
xsi_driver_first_trans_fast(t1);
goto LAB5;
LAB7: xsi_set_current_line(52, ng0);
t1 = (t0 + 4200);
t3 = (t1 + 56U);
t4 = *((char **)t3);
t5 = (t4 + 56U);
t7 = *((char **)t5);
*((unsigned char *)t7) = (unsigned char)2;
xsi_driver_first_trans_fast(t1);
xsi_set_current_line(53, ng0);
t1 = (t0 + 4264);
t3 = (t1 + 56U);
t4 = *((char **)t3);
t5 = (t4 + 56U);
t7 = *((char **)t5);
*((unsigned char *)t7) = (unsigned char)3;
xsi_driver_first_trans_fast(t1);
goto LAB5;
LAB11:;
}
extern void work_a_3760980685_3212880686_init()
{
static char *pe[] = {(void *)work_a_3760980685_3212880686_p_0,(void *)work_a_3760980685_3212880686_p_1,(void *)work_a_3760980685_3212880686_p_2};
xsi_register_didat("work_a_3760980685_3212880686", "isim/TopLevel_tb_isim_beh.exe.sim/work/a_3760980685_3212880686.didat");
xsi_register_executes(pe);
}
|
/*
* RiverSystemMethods.h
*
* Copyright (C) 2014 Swiss Federal Research Institute WSL (http://www.wsl.ch)
* Developed by F.U.M. Heimann
* Published by the Swiss Federal Research Institute WSL
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3
* 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, see http://www.gnu.org/licenses
*
* This software is part of the model sedFlow,
* which is intended for the simulation of bedload dynamics in mountain streams.
*
* For details on sedFlow see http://www.wsl.ch/sedFlow
*/
#ifndef RIVERSYSTEMMETHODS_H_
#define RIVERSYSTEMMETHODS_H_
#include "RegularRiverSystemMethods.h"
#include "AdditionalRiverSystemMethods.h"
#include "RiverSystemProperties.h"
#include "OverallMethods.h"
#include "ConstructionVariables.h"
namespace SedFlow {
class RiverSystemMethods {
private:
RegularRiverSystemMethods regularRiverSystemMethods;
AdditionalRiverSystemMethods additionalRiverSystemMethods;
RiverSystemProperties& riverSystemProperties;
const OverallMethods& overallMethods;
public:
RiverSystemMethods(RegularRiverSystemMethods regularRiverSystemMethods,
AdditionalRiverSystemMethods additionalRiverSystemMethods,
RiverSystemProperties& riverSystemProperties,
const OverallMethods& overallMethods);
virtual ~RiverSystemMethods(){}
ConstructionVariables createConstructionVariables()const;
void throwExceptionIfWaterFlowIsNotHighestOrderFlowMethod();
void calculateAndModifyChangeRates();
double calculateTimeStep();
void calculateAndHandDownChanges();
void performAdditionalReachActions();
void applyChanges();
void updateRegularProperties();
void updateAdditionalRiverReachProperties();
int getNumberOfCells() const;
void updateBedSlopes();
void updateEnergySlopes();
void updateAdditionalRiverSystemProperties();
void performAdditionalRiverSystemActions();
const RegularRiverSystemMethods& getRegularRiverSystemMethods() const {const RegularRiverSystemMethods& result (this->regularRiverSystemMethods); return result; }
const AdditionalRiverSystemMethods& getAdditionalRiverSystemMethods() const {const AdditionalRiverSystemMethods& result (this->additionalRiverSystemMethods); return result; }
};
}
#endif /* RIVERSYSTEMMETHODS_H_ */
|
/* Copyright (C) All Rights Reserved
** Written by Gottem <support@gottem.nl>
** Website: https://gitgud.malvager.net/Wazakindjes/unrealircd_mods
** License: https://gitgud.malvager.net/Wazakindjes/unrealircd_mods/raw/master/LICENSE
*/
// One include for all cross-platform compatibility thangs
#include "unrealircd.h"
#define MYHEWK HOOKTYPE_PRE_USERMSG
#define MYCONF "pmdelay"
// Quality fowod declarations
char *pmdelay_hook_preusermsg(aClient *sptr, aClient *to, char *text, int notice);
int pmdelay_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs);
int pmdelay_configrun(ConfigFile *cf, ConfigEntry *ce, int type);
int pmdelay_rehash(void);
// Muh globals
static ModuleInfo *pmdelayMI = NULL; // Store ModuleInfo so we can use it to check for errors in MOD_LOAD
Hook *pmdelayHook = NULL;
int muhDelay = 60; // Default to 1 minute yo
// Dat dere module header
ModuleHeader MOD_HEADER(m_pmdelay) = {
"m_pmdelay", // Module name
"$Id: v1.01 2018/12/22 Gottem$", // Version
"Disallow new clients trying to send private messages until exceeding a certain timeout", // Description
"3.2-b8-1", // Modversion, not sure wat do
NULL
};
// Configuration testing-related hewks go in testing phase obv
MOD_TEST(m_pmdelay) {
// We have our own config block so we need to checkem config obv m9
// Priorities don't really matter here
HookAdd(modinfo->handle, HOOKTYPE_CONFIGTEST, 0, pmdelay_configtest);
return MOD_SUCCESS;
}
// Initialisation routine (register hooks, commands and modes or create structs etc)
MOD_INIT(m_pmdelay) {
pmdelayMI = modinfo; // Store module info yo
// Add a hook with priority 0 (i.e. normal) that returns a char *
pmdelayHook = HookAddPChar(modinfo->handle, MYHEWK, 0, pmdelay_hook_preusermsg);
// Muh config hewks
HookAdd(modinfo->handle, HOOKTYPE_REHASH, 0, pmdelay_rehash);
HookAdd(modinfo->handle, HOOKTYPE_CONFIGRUN, 0, pmdelay_configrun);
return MOD_SUCCESS; // Let MOD_LOAD handle errors and shyte
}
// Actually load the module here
MOD_LOAD(m_pmdelay) {
// Check if module handle is available, also check for hooks that weren't added for some raisin
if(ModuleGetError(pmdelayMI->handle) != MODERR_NOERROR || !pmdelayHook) {
// Display error string kek
config_error("A critical error occurred when loading module %s: %s", MOD_HEADER(m_pmdelay).name, ModuleGetErrorStr(pmdelayMI->handle));
return MOD_FAILED; // No good
}
return MOD_SUCCESS; // We good
}
// Called on unload/rehash obv
MOD_UNLOAD(m_pmdelay) {
return MOD_SUCCESS; // We good
}
// Actual hewk functions m8
char *pmdelay_hook_preusermsg(aClient *sptr, aClient *to, char *text, int notice) {
/* Arg00ments:
** sptr: Pointer to user executing command
** to: Similar pointer to the target user
** text: Raw text yo
** notice: Should be obvious ;];]
*/
// Let's allow opers/servers/U:Lines to always send, also from anyone TO U:Lines (muh /ns identify lol)
if(!MyConnect(sptr) || sptr == to || IsULine(sptr) || IsULine(to) || IsOper(sptr) || !IsPerson(sptr) || !IsPerson(to))
return text;
// Sanity check + delay check =]
if(sptr->local && TStime() - sptr->local->firsttime < muhDelay) {
sendnotice(sptr, "You have to be connected for at least %d seconds before sending private messages", muhDelay);
return NULL;
}
return text;
}
int pmdelay_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs) {
int errors = 0; // Error count
int i; // iter8or m8
// Since we'll add a directive to the already existing set { } block in unrealircd.conf, need to filter on CONFIG_SET lmao
if(type != CONFIG_SET)
return 0; // Returning 0 means idgaf bout dis
// Check for valid config entries first
if(!ce || !ce->ce_varname)
return 0;
// If it isn't our directive, idc
if(strcmp(ce->ce_varname, MYCONF))
return 0;
// r u insaiyan?
if(!ce->ce_vardata || !strlen(ce->ce_vardata)) {
config_error("%s:%i: no argument given for set::%s (should be an integer of >= 10)", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF); // Rep0t error
errors++; // Increment err0r count fam
*errs = errors;
return -1; // KBAI
}
// Should be an integer yo
for(i = 0; ce->ce_vardata[i]; i++) {
if(!isdigit(ce->ce_vardata[i])) {
config_error("%s:%i: set::%s must be an integer of >= 10", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF);
errors++; // Increment err0r count fam
break;
}
}
if(!errors && atoi(ce->ce_vardata) < 10) {
config_error("%s:%i: set::%s must be an integer of >= 10", ce->ce_fileptr->cf_filename, ce->ce_varlinenum, MYCONF);
errors++; // Increment err0r count fam
}
*errs = errors;
return errors ? -1 : 1; // Returning 1 means "all good", -1 means we shat our panties
}
// "Run" the config (everything should be valid at this point)
int pmdelay_configrun(ConfigFile *cf, ConfigEntry *ce, int type) {
// Since we'll add a directive to the already existing set { } block in unrealircd.conf, need to filter on CONFIG_SET lmao
if(type != CONFIG_SET)
return 0; // Returning 0 means idgaf bout dis
// Check for valid config entries first
if(!ce || !ce->ce_varname || !ce->ce_vardata)
return 0;
// If it isn't pmdelay, idc
if(strcmp(ce->ce_varname, MYCONF))
return 0;
muhDelay = atoi(ce->ce_vardata);
return 1; // We good
}
int pmdelay_rehash(void) {
// Reset config defaults
muhDelay = 60;
return HOOK_CONTINUE;
}
|
//
// Created by liu on 16-12-26.
//
#pragma once
#include "Base.h"
#include "Category.h"
#include "Type.h"
#include "TypeDefault.h"
#include "Param.h"
#include "Event.h"
#include "Condition.h"
#include "Action.h"
#include "Call.h"
#include "WEString.h"
|
/*
* Copyright (c) 2017 Brian Barto
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GPL License. See LICENSE for more details.
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/ioctl.h>
#include "nmseffect.h"
int main(void) {
int termCols, spaces = 0;
unsigned char *display_uc = NULL;
char *display = NULL;
char *head1Left = "DATANET PROC RECORD: 45-3456-W-3452";
char *head1Right = "Transnet on/xc-3";
char *head2Center = "FEDERAL RESERVE TRANSFER NODE";
char *head3Center = "National Headquarters";
char *head4Center = "************ Remote Systems Network Input Station ************";
char *head5Center = "================================================================";
char *menu1 = "[1] Interbank Funds Transfer (Code Prog: 485-GWU)";
char *menu2 = "[2] International Telelink Access (Code Lim: XRP-262)";
char *menu3 = "[3] Remote Facsimile Send/Receive (Code Tran: 2LZP-517)";
char *menu4 = "[4] Regional Bank Interconnect (Security Code: 47-B34)";
char *menu5 = "[5] Update System Parameters (Entry Auth. Req.)";
char *menu6 = "[6] Remote Operator Logon/Logoff";
char *foot1Center = "================================================================";
char *foot2Center = "[ ] Select Option or ESC to Abort";
// Get terminal dimentions (needed for centering)
struct winsize w;
// if not an interactive tty, w is not populated, resulting in UB
if (ioctl(0, TIOCGWINSZ, &w) == -1) {
perror("Input not from an interactive terminal");
return 1;
}
termCols = w.ws_col;
// Allocate space for our display string
if ((display = malloc(20 * termCols)) == NULL)
{
fprintf(stderr, "Memory Allocation Error. Quitting!\n");
return 1;
}
// Allocate space for our display string
if ((display_uc = malloc(20 * termCols)) == NULL)
{
free(display);
fprintf(stderr, "Memory Allocation Error. Quitting!\n");
return 1;
}
memset(display, 0, 20 * termCols);
memset(display_uc, 0, 20 * termCols);
// Start building the display string
strcpy(display, head1Left);
spaces = termCols - strlen(head1Left) - strlen(head1Right);
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, head1Right);
strcat(display, "\n");
spaces = (termCols - strlen(head2Center)) / 2;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, head2Center);
strcat(display, "\n");
strcat(display, "\n");
spaces = (termCols - strlen(head3Center)) / 2;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, head3Center);
strcat(display, "\n");
strcat(display, "\n");
spaces = (termCols - strlen(head4Center)) / 2;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, head4Center);
strcat(display, "\n");
spaces = (termCols - strlen(head5Center)) / 2;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, head5Center);
strcat(display, "\n");
strcat(display, "\n");
spaces = ((termCols - strlen(head5Center)) / 2) + 3;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, menu1);
strcat(display, "\n");
spaces = ((termCols - strlen(head5Center)) / 2) + 3;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, menu2);
strcat(display, "\n");
spaces = ((termCols - strlen(head5Center)) / 2) + 3;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, menu3);
strcat(display, "\n");
spaces = ((termCols - strlen(head5Center)) / 2) + 3;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, menu4);
strcat(display, "\n");
spaces = ((termCols - strlen(head5Center)) / 2) + 3;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, menu5);
strcat(display, "\n");
spaces = ((termCols - strlen(head5Center)) / 2) + 3;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, menu6);
strcat(display, "\n");
strcat(display, "\n");
spaces = (termCols - strlen(foot1Center)) / 2;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, foot1Center);
strcat(display, "\n");
strcat(display, "\n");
spaces = (termCols - strlen(foot2Center)) / 2;
while (spaces > 0) {
strcat(display, " ");
--spaces;
}
strcat(display, foot2Center);
nmseffect_set_clearscr(1);
memcpy(display_uc, display, 20 * termCols);
// Execute effect
nmseffect_exec(display_uc, strlen(display));
free(display);
free(display_uc);
return 0;
}
|
/*
Ordo is program for calculating ratings of engine or chess players
Copyright 2013 Miguel A. Ballicora
This file is part of Ordo.
Ordo 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.
Ordo 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 Ordo. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(H_INIDONE)
#define H_INIDONE
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>*/
#include "mytypes.h"
extern bool_t ratings_init (player_t n, struct RATINGS *r);
extern void ratings_done (struct RATINGS *r);
extern bool_t ratings_replicate (const struct RATINGS *src, struct RATINGS *tgt);
extern bool_t games_init (gamesnum_t n, struct GAMES *g);
extern void games_done (struct GAMES *g);
extern bool_t games_replicate (const struct GAMES *src, struct GAMES *tgt);
extern bool_t players_init (player_t n, struct PLAYERS *x);
extern void players_done (struct PLAYERS *x);
extern bool_t players_replicate (const struct PLAYERS *src, struct PLAYERS *tgt);
extern bool_t supporting_auxmem_init
( player_t nplayers
, struct prior **pPP
, struct prior **pPP_store
);
extern void supporting_auxmem_done
( struct prior **pPP
, struct prior **pPP_store);
extern struct prior *priorlist_init (player_t nplayers);
extern void priorlist_done (struct prior **pPP);
extern bool_t priorlist_replicate ( player_t nplayers
, struct prior *PP
, struct prior **pQQ);
/*<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
#endif
|
#include "schnaps.h"
#include <stdio.h>
#include <assert.h>
#include "test.h"
#include "collision.h"
#include "quantities_vp.h"
#include "solverpoisson.h"
void TestPoisson_ImposedData(const real x[3],const real t,real w[]);
void TestPoisson_InitData(real x[3],real w[]);
void TestPoisson_BoundaryFlux(real x[3],real t,real wL[],real* vnorm,
real* flux);
int main(void)
{
// unit tests
int resu = TestPoisson2d();
if (resu) printf("2d poisson test OK !\n");
else printf("2d poisson test failed !\n");
return !resu;
}
int TestPoisson2d(void)
{
bool test = true;
field f;
init_empty_field(&f);
int vec=1;
// num of conservative variables f(vi) for each vi, phi, E, rho, u,
// p, e (ou T)
f.model.m=_INDEX_MAX;
f.vmax = _VMAX; // maximal wave speed
f.model.NumFlux = VlasovP_Lagrangian_NumFlux;
f.model.Source = VlasovP_Lagrangian_Source;
//f.model.Source = NULL;
f.model.BoundaryFlux = TestPoisson_BoundaryFlux;
f.model.InitData = TestPoisson_InitData;
f.model.ImposedData = TestPoisson_ImposedData;
f.model.Source = NULL;
f.varindex = GenericVarindex;
f.pre_dtfield = NULL;
f.update_after_rk = NULL;
f.interp.interp_param[0] = f.model.m; // _M
f.interp.interp_param[1] = 3; // x direction degree
f.interp.interp_param[2] = 3; // y direction degree
f.interp.interp_param[3] = 0; // z direction degree
f.interp.interp_param[4] = 2; // x direction refinement
f.interp.interp_param[5] = 2; // y direction refinement
f.interp.interp_param[6] = 1; // z direction refinement
// read the gmsh file
ReadMacroMesh(&(f.macromesh),"test/testdisque2d.msh");
//ReadMacroMesh(&(f.macromesh),"geo/square.msh");
// try to detect a 2d mesh
//bool is1d=Detect1DMacroMesh(&(f.macromesh));
Detect2DMacroMesh(&(f.macromesh));
bool is2d=f.macromesh.is2d;
assert(is2d);
// mesh preparation
BuildConnectivity(&(f.macromesh));
PrintMacroMesh(&(f.macromesh));
//assert(1==2);
//AffineMapMacroMesh(&(f.macromesh));
// prepare the initial fields
Initfield(&f);
f.nb_diags=0;
// prudence...
CheckMacroMesh(&(f.macromesh),f.interp.interp_param+1);
printf("cfl param =%f\n",f.hmin);
PoissonSolver ps;
InitPoissonSolver(&ps,&f,_INDEX_PHI);
SolvePoisson2D(&ps,_Dirichlet_Poisson_BC);
real errl2 = L2error(&f);
printf("Erreur L2=%f\n",errl2);
test = test && (errl2 < 4e-4);
printf("Plot...\n");
Plotfield(_INDEX_PHI, false, &f, NULL, "dgvisu.msh");
Plotfield(_INDEX_EX, false, &f, NULL, "dgex.msh");
return test;
}
void TestPoisson_ImposedData(const real x[3], const real t, real w[])
{
for(int i = 0; i < _INDEX_MAX; i++){
w[i] = 0;
}
// exact value of the potential
// and electric field
w[_INDEX_PHI] = (x[0] * x[0] + x[1] * x[1])/4;
w[_INDEX_EX] = -x[0]/2;
w[_INDEX_RHO] = -1; //rho init
/* w[_INDEX_PHI] = x[0] ; */
/* w[_INDEX_EX] = -1; */
/* w[_INDEX_RHO] = 0; //rho init */
}
void TestPoisson_InitData(real x[3], real w[])
{
real t = 0;
TestPoisson_ImposedData(x, t, w);
}
void TestPoisson_BoundaryFlux(real x[3], real t, real wL[], real *vnorm,
real *flux)
{
real wR[_INDEX_MAX];
TestPoisson_ImposedData(x, t, wR);
VlasovP_Lagrangian_NumFlux(wL, wR, vnorm, flux);
}
|
// Copyright © 2008-2016 Pioneer Developers. See AUTHORS.txt for details
// Licensed under the terms of the GPL v3. See licenses/GPL-3.txt
#ifndef _INICONFIG_H
#define _INICONFIG_H
#include "libs.h"
#include <map>
#include <string>
namespace FileSystem {
class FileData;
class FileSource;
class FileSourceFS;
}
class IniConfig {
public:
IniConfig() {}
void Read(FileSystem::FileSource &fs, const std::string &path);
void Read(const FileSystem::FileData &data);
bool Write(FileSystem::FileSourceFS &fs, const std::string &path);
void SetInt(const std::string §ion, const std::string &key, int val);
void SetFloat(const std::string §ion, const std::string &key, float val);
void SetString(const std::string §ion, const std::string &key, const std::string &val);
int Int(const std::string §ion, const std::string &key, int defval) const;
float Float(const std::string §ion, const std::string &key, float defval) const;
std::string String(const std::string §ion, const std::string &key, const std::string &defval) const;
void SetInt(const std::string &key, int val) { SetInt("", key, val); }
void SetFloat(const std::string &key, float val) { SetFloat("", key, val); }
void SetString(const std::string &key, const std::string &val) { SetString("", key, val); }
int Int(const std::string &key, int defval = 0) const { return Int("", key, defval); }
float Float(const std::string &key, float defval = 0.0f) const { return Float("", key, defval); }
std::string String(const std::string &key, const std::string &defval = std::string()) const { return String("", key, defval); }
bool HasSection(const std::string §ion) const {
SectionMapType::const_iterator it = m_map.find(section);
return (it != m_map.end()) && (!it->second.empty());
}
bool HasEntry(const std::string §ion, const std::string &key) const {
SectionMapType::const_iterator it = m_map.find(section);
return (it != m_map.end()) && it->second.count(key);
}
bool HasEntry(const std::string &key) const { return HasEntry("", key); }
protected:
typedef std::map<std::string, std::string> MapType;
typedef std::map<std::string, MapType> SectionMapType;
SectionMapType m_map;
};
#endif /* _INICONFIG_H */
|
/* Copyright (C) 1998-2000 Matthes Bender RedWolf Design */
/* A wrapper class to DirectDraw */
const int MaxResX = 1024, MaxResY = 768;
const int CBlack=0,CGray1=1,CGray2=2,CGray3=3,CGray4=4,CGray5=5,CWhite=6,
CDRed=7,CDGreen=8,CDBlue=9,CRed=10,CGreen=11,CLBlue=12,CYellow=13,CBlue=14;
class CStdDDraw
{
public:
CStdDDraw();
~CStdDDraw();
public:
SURFACE lpPrimary;
SURFACE lpBack;
int ClipX1,ClipX2,ClipY1,ClipY2;
int StoreClipX1,StoreClipX2,StoreClipY1,StoreClipY2;
protected:
LPDIRECTDRAW lpDirectDraw;
LPDIRECTDRAWPALETTE lpPalette;
LPDIRECTDRAWCLIPPER lpClipper;
LPDIRECTDRAWCLIPPER lpWindowClipper;
BOOL fBackAttached;
BOOL fPageLock;
CStdFont Font;
BYTE *Pattern;
int PatWdt,PatHgt,PatWdtMod,PatHgtMod;
BOOL PatQuickMod;
public:
// General
BOOL Init(HWND hWnd, BOOL Fullscreen, int iResX, int iResY, BOOL fUsePageLock);
void Clear();
void Default();
BOOL PageFlip();
// Palette
BOOL SetPrimaryPalette(BYTE *pBuf);
BOOL SetPrimaryPaletteQuad(BYTE *pBuf);
BOOL AttachPrimaryPalette(SURFACE sfcSurface);
// Clipper
BOOL GetPrimaryClipper(int &rX1, int &rY1, int &rX2, int &rY2);
BOOL SetPrimaryClipper(int iX1, int iY1, int iX2, int iY2);
BOOL SubPrimaryClipper(int iX1, int iY1, int iX2, int iY2);
BOOL RestorePrimaryClipper();
BOOL NoPrimaryClipper();
BOOL ApplyPrimaryClipper(SURFACE sfcSurface);
BOOL DetachPrimaryClipper(SURFACE sfcSurface);
// Surface
BYTE *LockSurface(SURFACE sfcSurface, int &lPitch, int *lpSfcWdt=0, int *lpSfcHgt=0);
void UnLockSurface(SURFACE sfcSurface);
BOOL GetSurfaceSize(SURFACE sfcSurface, int &iWdt, int &iHgt);
HDC GetSurfaceDC(SURFACE sfcSurface);
BOOL WipeSurface(SURFACE sfcSurface);
SURFACE DuplicateSurface(SURFACE sfcSurface);
void DestroySurface(SURFACE sfcSurface);
SURFACE CreateSurface(int iWdt, int iHgt);
void SurfaceShiftColor(SURFACE sfcSfc, int iShift);
void SurfaceShiftColorRange(SURFACE sfcSfc, int iRngLo, int iRngHi, int iShift);
void SurfaceAllowColor(SURFACE sfcSfc, BYTE iRngLo, BYTE iRngHi, BOOL fAllowZero=FALSE);
// Blit
BOOL BlitFast(SURFACE sfcSource, int fx, int fy,
SURFACE sfcTarget, int tx, int ty, int wdt, int hgt);
BOOL Blit(SURFACE sfcSource, int fx, int fy, int fwdt, int fhgt,
SURFACE sfcTarget, int tx, int ty, int twdt, int thgt,
BOOL fSrcColKey=FALSE);
BOOL BlitRotate(SURFACE sfcSource, int fx, int fy, int fwdt, int fhgt,
SURFACE sfcTarget, int tx, int ty, int twdt, int thgt,
int iAngle);
BOOL BlitRotateOriginal(SURFACE sfcSource, int fx, int fy, int fwdt, int fhgt,
SURFACE sfcTarget, int tx, int ty, int twdt, int thgt,
int iAngle);
BOOL BlitSurface(SURFACE sfcSurface, SURFACE sfcTarget, int tx, int ty);
BOOL BlitSurfaceTile(SURFACE sfcSurface, SURFACE sfcTarget, int iToX, int iToY, int iToWdt, int iToHgt, int iOffsetX=0, int iOffsetY=0, BOOL fSrcColKey=FALSE);
BOOL BlitSurface2Window(SURFACE sfcSource, int fX, int fY, int fWdt, int fHgt, HWND hWnd, int tX, int tY, int tWdt, int tHgt);
// Text
BOOL InitFont(const char *szFontName, int iSize);
BOOL TextExtent(const char *szString, int &rWdt, int &rHgt);
int TextHeight(const char *szText=NULL);
int TextWidth(const char *szText=NULL);
BOOL TextOut(const char *szText, SURFACE sfcDest, int iTx, int iTy, int iFCol=FWhite, int iBCol=FBlack, BYTE byForm=ALeft);
BOOL StringOut(const char *szText, SURFACE sfcDest, int iTx, int iTy, int iFCol=FWhite, int iBCol=FBlack, BYTE byForm=ALeft);
// Drawing
BOOL SetPixel(SURFACE sfcDest, int tx, int ty, BYTE col);
BYTE GetPixel(SURFACE sfcSource, int fx, int fy);
void DrawBox(SURFACE sfcDest, int x1, int y1, int x2, int y2, BYTE col);
void DrawBoxColorTable(SURFACE sfcDest, int x1, int y1, int x2, int y2, BYTE *bypColorTable);
void DrawCircle(SURFACE sfcDest, int x, int y, int r, BYTE col);
void DrawHorizontalLine(SURFACE sfcDest, int x1, int x2, int y, BYTE col);
void DrawVerticalLine(SURFACE sfcDest, int x, int y1, int y2, BYTE col);
void DrawFrame(SURFACE sfcDest, int x1, int y1, int x2, int y2, BYTE col);
void DrawInline(SURFACE sfcDest, int iX1, int iY1, int iX2, int iY2, BYTE byCol, BYTE byOnCol, BYTE byAdjacentCol);
BOOL DrawLine(SURFACE sfcTarget, int x1, int y1, int x2, int y2, BYTE byCol);
BOOL DrawPolygon(SURFACE sfcTarget, int iNum, int *ipVtx, int iCol);
// Pattern
BOOL DefinePattern(SURFACE sfcSource);
void NoPattern();
protected:
BOOL CreatePrimaryPalette(SURFACE sfcAttachTo);
BOOL CreatePrimaryClipper();
BOOL CreatePrimarySurfaces(BOOL fFlipAttach);
BOOL Error(const char *szMsg);
BOOL SetDisplayMode(int iResX, int iResY, int iColorDepth);
BOOL SetCooperativeLevel(HWND hWnd, DWORD dwLevel);
BOOL CreateDirectDraw();
int SfcCall(HRESULT ddrval);
BOOL SurfaceSetColorKey(SURFACE sfcSurface, BYTE byCol);
};
// Global DDraw access pointer
extern CStdDDraw *lpDDraw;
|
//
// LifeConstants.h
// Life
//
// Created by Arya McCarthy on 12/8/14.
// Copyright (c) 2014 Arya McCarthy. All rights reserved.
//
#ifndef Life_LifeConstants_h
#define Life_LifeConstants_h
static const size_t kMaxAge = 12;
// This times kNumRows and kNumCols should
// equal the dimensions of the view.
static const size_t kCellDimension = 20;
#endif
|
//============== IV:Multiplayer - https://github.com/Neproify/ivmultiplayer ==============
//
// File: CClientFileManager.h
// Project: Server.Core
// Author(s): mabako
// License: See LICENSE in root directory
//
//==============================================================================
#include <map>
#include "CServer.h"
#include <CFileChecksum.h>
class CClientFileManager : public std::map<String, CFileChecksum>
{
public:
CClientFileManager(bool bScriptManager);
~CClientFileManager() { };
bool Start(String strName);
bool Stop(String strName);
bool Restart(String strName);
bool Exists(String strName);
void HandleClientJoin(EntityId playerId);
private:
bool bIsScriptManager;
};
|
/**
* OSM
* Copyright (C) 2021 Pavel Smokotnin
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef CHART_MAGNITUDESERIESNODE_H
#define CHART_MAGNITUDESERIESNODE_H
#include "xyseriesnode.h"
#include "../frequencybasedserieshelper.h"
#include "../magnitudeplot.h"
namespace chart {
class MagnitudeSeriesNode : public XYSeriesNode, public FrequencyBasedSeriesHelper
{
Q_OBJECT
public:
MagnitudeSeriesNode(QQuickItem *item);
~MagnitudeSeriesNode();
protected:
void initRender() override;
void synchronizeSeries() override;
void renderSeries() override;
void updateMatrix() override;
Source *source() const override;
private:
unsigned int m_pointsPerOctave;
float m_coherenceThreshold;
bool m_coherence, m_invert;
//! MTLRenderPipelineState
void *m_pipeline;
MagnitudePlot::Mode m_mode;
};
}
#endif // CHART_MAGNITUDESERIESNODE_H
|
/* Copyright (C) 2007-2016 B.A.T.M.A.N. contributors:
*
* Marek Lindner, Simon Wunderlich
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _NET_BATMAN_ADV_ORIGINATOR_H_
#define _NET_BATMAN_ADV_ORIGINATOR_H_
#include "main.h"
#include <linux/compiler.h>
#include <linux/if_ether.h>
#include <linux/jhash.h>
#include <linux/kref.h>
#include <linux/rculist.h>
#include <linux/rcupdate.h>
#include <linux/stddef.h>
#include <linux/types.h>
#include "hash.h"
struct netlink_callback;
struct seq_file;
struct sk_buff;
bool batadv_compare_orig(const struct hlist_node *node, const void *data2);
int batadv_originator_init(struct batadv_priv *bat_priv);
void batadv_originator_free(struct batadv_priv *bat_priv);
void batadv_purge_orig_ref(struct batadv_priv *bat_priv);
void batadv_orig_node_put(struct batadv_orig_node *orig_node);
struct batadv_orig_node *batadv_orig_node_new(struct batadv_priv *bat_priv,
const u8 *addr);
struct batadv_hardif_neigh_node *
batadv_hardif_neigh_get(const struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr);
void
batadv_hardif_neigh_put(struct batadv_hardif_neigh_node *hardif_neigh);
struct batadv_neigh_node *
batadv_neigh_node_get_or_create(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *hard_iface,
const u8 *neigh_addr);
void batadv_neigh_node_put(struct batadv_neigh_node *neigh_node);
struct batadv_neigh_node *
batadv_orig_router_get(struct batadv_orig_node *orig_node,
const struct batadv_hard_iface *if_outgoing);
struct batadv_neigh_ifinfo *
batadv_neigh_ifinfo_new(struct batadv_neigh_node *neigh,
struct batadv_hard_iface *if_outgoing);
struct batadv_neigh_ifinfo *
batadv_neigh_ifinfo_get(struct batadv_neigh_node *neigh,
struct batadv_hard_iface *if_outgoing);
void batadv_neigh_ifinfo_put(struct batadv_neigh_ifinfo *neigh_ifinfo);
int batadv_hardif_neigh_dump(struct sk_buff *msg, struct netlink_callback *cb);
int batadv_hardif_neigh_seq_print_text(struct seq_file *seq, void *offset);
struct batadv_orig_ifinfo *
batadv_orig_ifinfo_get(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *if_outgoing);
struct batadv_orig_ifinfo *
batadv_orig_ifinfo_new(struct batadv_orig_node *orig_node,
struct batadv_hard_iface *if_outgoing);
void batadv_orig_ifinfo_put(struct batadv_orig_ifinfo *orig_ifinfo);
int batadv_orig_seq_print_text(struct seq_file *seq, void *offset);
int batadv_orig_dump(struct sk_buff *msg, struct netlink_callback *cb);
int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset);
int batadv_orig_hash_add_if(struct batadv_hard_iface *hard_iface,
int max_if_num);
int batadv_orig_hash_del_if(struct batadv_hard_iface *hard_iface,
int max_if_num);
struct batadv_orig_node_vlan *
batadv_orig_node_vlan_new(struct batadv_orig_node *orig_node,
unsigned short vid);
struct batadv_orig_node_vlan *
batadv_orig_node_vlan_get(struct batadv_orig_node *orig_node,
unsigned short vid);
void batadv_orig_node_vlan_put(struct batadv_orig_node_vlan *orig_vlan);
/* hashfunction to choose an entry in a hash table of given size
* hash algorithm from http://en.wikipedia.org/wiki/Hash_table
*/
static inline u32 batadv_choose_orig(const void *data, u32 size)
{
u32 hash = 0;
hash = jhash(data, ETH_ALEN, hash);
return hash % size;
}
static inline struct batadv_orig_node *
batadv_orig_hash_find(struct batadv_priv *bat_priv, const void *data)
{
struct batadv_hashtable *hash = bat_priv->orig_hash;
struct hlist_head *head;
struct batadv_orig_node *orig_node, *orig_node_tmp = NULL;
int index;
if (!hash)
{
return NULL;
}
index = batadv_choose_orig(data, hash->size);
head = &hash->table[index];
rcu_read_lock();
hlist_for_each_entry_rcu(orig_node, head, hash_entry)
{
if (!batadv_compare_eth(orig_node, data))
{
continue;
}
if (!kref_get_unless_zero(&orig_node->refcount))
{
continue;
}
orig_node_tmp = orig_node;
break;
}
rcu_read_unlock();
return orig_node_tmp;
}
#endif /* _NET_BATMAN_ADV_ORIGINATOR_H_ */
|
/*
* Tree search generalized from Knuth (6.2.2) Algorithm T just like
* the AT&T man page says.
*
* The node_t structure is for internal use only, lint doesn't grok it.
*
* Written by reading the System V Interface Definition, not the code.
*
* Totally public domain.
*/
/*LINTLIBRARY*/
#include "search.h"
#include "search-node.h"
#if defined(WIN32) || defined (_WIN32)
#if defined (_INC_STDLIB)
#undef _INC_STDLIB
#endif
#include <stdlib.h>
#endif
//void *tsearch(key, rp, compar)
///* find or insert datum into search tree */
//const void *key; /* key to be located */
//void **rp; /* address of tree root */
//int (*compar)(); /* ordering function */
//void *tsearch( const void *key, void **rp, int( *compar )( ) )
const void* tsearch( const void *key, void **rp, int( *compar )( const void*, const void* ) )
{
struct node_t *pnode;
struct node_t **rootp = ( struct node_t** )rp; /* address of tree root */
if ( rootp == ( struct node_t ** )0 )
return 0;
while ( *rootp != ( struct node_t * )0 ) /* Knuth's T1: */
{
int r;
if ( ( r = ( *compar )( key, ( *rootp )->key ) ) == 0 ) /* T2: */
return &( *rootp )->key; /* we found it! */
rootp = ( r < 0 ) ?
&( *rootp )->left : /* T3: follow left branch */
&( *rootp )->right; /* T4: follow right branch */
}
//pnode = ( struct node_t * ) malloc( sizeof( struct node_t ) ); /* T5: key not found */
pnode = malloc( sizeof( struct node_t ) ); /* T5: key not found */
if ( pnode != ( struct node_t * )0 ) /* make new struct node_t */
{
*rootp = pnode; /* link new struct node_t to old */
pnode->key = key; /* initialize new struct node_t */
pnode->left = pnode->right = ( struct node_t * )0;
}
return &pnode->key;
}
|
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define len 10
#define students 40
#define days 2
int main()
{
//welcome message
printf("+++++++++++++++++++++++++++++++++\n");
printf("| Welcome to attendance system |\n");
printf("+++++++++++++++++++++++++++++++++\n");
//some needed variables
char studentIDs[students][12];
char courseCode[len]="\0";
char section[len]="\0";
int lCounter;//loop counter
int lCounter2;//loop counter 2
//get input for course code
printf("\nEnter the course code:");
scanf("%s", courseCode);
//get inpur for section
printf("\nEnter the section:");
scanf("%s", section);
//compare inputs
if(strcmp(courseCode,"cse123")==0 && strcmp(section,"s")==0){
//file read write pointer
FILE *stdIdReadPointer,*stdAtdWritePointer;
//read students id file 'input.txt'
stdIdReadPointer = fopen("input.txt","r");
if(stdIdReadPointer==null){
printf("'input.txt' file doesn't exists!");
return 0;
}
//message
printf("Students id is reading.....\n");
//read 40 students id from file
for(lCounter=0;lCounter<students;lCounter++){
fscanf(stdIdReadPointer,"%s\n",studentIDs[lCounter]);
}
//close file read pointer
fclose(stdIdReadPointer);
printf("Students id reading complete.\n");
//open attenace file to write
stdAtdWritePointer = fopen("attendance.txt","a");
//all students presents holder
int presents[students]={0};
//get attenace for x days of all students
for(lCounter=0;lCounter<days;lCounter++){
printf("\nAttendance for day:%d",lCounter+1);
//get attenace for x studens
for(lCounter2=0;lCounter2<students;lCounter2++){
printf("\nStudent ID:%s\nIf present press 1 or 0 for absent.\n",studentIDs[lCounter2]);
int present=0;//present value holder
scanf("%d",&present);
//write present to file
fprintf(stdAtdWritePointer,"%d\n",present);
presents[lCounter2]+=present;//add current present with previous
}
}
//close attendance file write pointer
fclose(stdAtdWritePointer);
//marks calucalation of x students for x days
printf("\nPresents marks is calculating....\n");
float marks=0.00;
printf("\n\n+++++++++++++++++++++++++\n");
printf("| Student ID | Marks |\n");
printf("+++++++++++++++++++++++++\n");
for(lCounter2=0;lCounter2<students;lCounter2++){
marks=(presents[lCounter2]*7)/days;
printf("|%s | %0.2f |\n",studentIDs[lCounter2],marks);
printf("|-----------------------|\n");
}
//thanks message
printf("\n\n\n++++++++++++++++++++++++++++++++++++++++\n");
printf("| (-:Thank You:-) |\n");
printf("| For using my program. |\n");
printf("| Programmer: H.R.Shadhin |\n");
printf("| email:hrshadhin.i386@gmail.com |\n");
printf("| website:hrshadhin.me |\n");
printf("| ====]:------------:[==== |\n");
printf("++++++++++++++++++++++++++++++++++++++++\n");
}
else{
//try again message
printf("++++++++++++++++++++++++++++++++++++++++\n");
printf("| Sorry :-) |\n");
printf("|Your inputs are not correct try again.|\n");
printf("++++++++++++++++++++++++++++++++++++++++\n");
}
return 0;
}
|
/***********************************************************
*
* Twitturse v 0.1.1
*
* Nic0 <nicolas.caen (at) gmail.com>
* 03/05/2010
*
* Software distributed under GPL licence
*
***********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <pthread.h>
//#include <libintl.h>
#include <locale.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
#include "init.h"
#include "status.h"
#include "config.h"
#include "curl.h"
#include "ncurse.h"
#define ERROR fprintf (stderr, \
"%s:%d Error (%d) : %s\n", \
__FILE__, __LINE__, \
errno, strerror(errno))
pthread_mutex_t mutex;
int
main (void)
{
setlocale (LC_ALL, "");
data_t *data = NULL;
if ((data = initData(data)) == NULL) {
ERROR;
return EXIT_FAILURE;
}
if ((get_config_filedir(data->config)) != 0)
return EXIT_FAILURE;
if ((check_configfile(data->config)) != 0)
return EXIT_FAILURE;
if ((getConfiguration(data->config)) != 0)
return EXIT_FAILURE;
xmlInitParser();
pthread_t pidStatuses;
if (pthread_create(&pidStatuses, NULL, getNewStatuses, data) != 0) {
ERROR;
return EXIT_FAILURE;
}
pthread_t pidCurse;
if (pthread_create(&pidCurse, NULL, ncurseApplication, data) != 0) {
ERROR;
return EXIT_FAILURE;
}
//pthread_join (pidStatuses, NULL);
pthread_join (pidCurse, NULL);
freeStatuses(data->statuses);
return EXIT_SUCCESS;
}
|
#pragma once
#include <Windows.h>
void shipRotBackward();
void shipRotForward();
void FTLSSMain (void);
extern HWND ftlWindow;
|
#include <stdio.h>
int main(int argc, char *args[])
{
printf("Hello, world!\n");
printf("Hello, world!\n");
printf("Hello, world!\n");
return 0;
}
|
#include <GL/glut.h>
#include "math.h"
#include <iostream>
#define PI 3.1415265359
#define PIdiv180 3.1415265359/180.0
#define CAMERA_RADIUS 2
//Note: All angles in degrees
struct SF3dVector {
GLfloat x,y,z;
};
struct SF2dVector {
GLfloat x,y;
};
class CCamera {
private:
SF3dVector Position;
/*
Not used for rendering the camera, but for "moveforwards"
So it is not necessary to "actualize" it always. It is only
actualized when ViewDirChanged is true and moveforwards is called
*/
SF3dVector ViewDir;
bool ViewDirChanged;
GLfloat RotatedX, RotatedY, RotatedZ;
void GetViewDir ( void );
public:
//inits the values (Position: (0|0|0) Target: (0|0|-1) )
CCamera();
void Render ( void );
//executes some glRotates and a glTranslate command
//Note: You should call glLoadIdentity before using Render
void Orbit( GLfloat Angle, GLfloat offset, GLfloat positionX, GLfloat positionZ);
void Move ( SF3dVector Direction );
void RotateX ( GLfloat Angle );
void RotateY ( GLfloat Angle );
void MoveForwards ( GLfloat Distance );
SF3dVector getViewDirection();
};
SF3dVector F3dVector ( GLfloat x, GLfloat y, GLfloat z );
SF3dVector AddF3dVectors ( SF3dVector * u, SF3dVector * v);
void AddF3dVectorToVector ( SF3dVector * Dst, SF3dVector * V2);
|
/*
*
* j-chkmail - Mail Server Filter for sendmail
*
* Copyright (c) 2001-2017 - Jose-Marcio Martins da Cruz
*
* Auteur : Jose Marcio Martins da Cruz
* jose.marcio.mc@gmail.org
*
* Historique :
* Creation : Tue Jan 17 14:47:29 CET 2006
*
* This program is free software, but with restricted license :
*
* - j-chkmail is distributed only to registered users
* - j-chkmail license is available only non-commercial applications,
* this means, you can use j-chkmail if you make no profit with it.
* - redistribution of j-chkmail in any way : binary, source in any
* media, is forbidden
*
* 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.
*
* More details about j-chkmail license can be found at j-chkmail
* web site : http://foss.jose-marcio.org
*/
#ifndef J_LOG_QUARANTINE_H
void log_quarantine(SMFICTX *, attachment_T *);
bool log_quarantine_reopen();
# define J_LOG_QUARANTINE_H 1
#endif /* J_LOG_QUARANTINE_H */
|
#ifndef p1_mac_plugins_detect_audio_inputs_h
#define p1_mac_plugins_detect_audio_inputs_h
#include "p1stream.h"
#include "module.h"
namespace p1_mac_plugins {
#define EV_AUDIO_INPUTS_CHANGED 'ainp'
class detect_audio_inputs : public ObjectWrap, public lockable {
public:
detect_audio_inputs();
lockable_mutex mutex;
event_buffer buffer;
bool running;
// Internal.
void emit_change();
// Public JavaScript methods.
void init(const FunctionCallbackInfo<Value>& args);
void destroy();
// Lockable implementation.
virtual lockable *lock() final;
// Module init.
static void init_prototype(Handle<FunctionTemplate> func);
};
} // namespace p1_mac_plugins
#endif // p1_mac_plugins_detect_audio_inputs.h
|
/*********************************************************************
CombLayer : MCNP(X) Input builder
* File: constructInc/JawFlange.h
*
* Copyright (c) 2004-2021 by Stuart Ansell
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
****************************************************************************/
#ifndef constructSystem_JawFlange_h
#define constructSystem_JawFlange_h
class Simulation;
namespace constructSystem
{
/*!
\class JawFlange
\version 1.0
\author S. Ansell
\date January 2018
\brief JawFlange unit
*/
class JawFlange :
public attachSystem::FixedOffsetGroup,
public attachSystem::ContainedComp,
public attachSystem::CellMap,
public attachSystem::SurfMap,
public attachSystem::FrontBackCut
{
private:
double length; ///< Void length
double radius; ///< Void radius
double jOpen; ///< Jaw-gap
double jYStep; ///< Step in beam direction
double jThick; ///< Blade thickness [beam]
double jHeight; ///< Height in flange direction
double jWidth; ///< length beam x flange
int voidMat; ///< Void material
int jawMat; ///< Jaw material
HeadRule cylRule; ///< Cylinder/Surround rule
int cutCell; ///< Cell to cut
void calcBeamCentre();
void populate(const FuncDataBase&);
void createUnitVector(const attachSystem::FixedComp&,const long int,
const attachSystem::FixedComp&,const long int);
void createSurfaces();
void createObjects(Simulation&);
void createLinks();
public:
JawFlange(const std::string&);
JawFlange(const JawFlange&);
JawFlange& operator=(const JawFlange&);
virtual ~JawFlange();
void setFillRadius(const attachSystem::FixedComp&,
const std::string&,const int);
using FixedComp::createAll;
void createAll(Simulation&,const attachSystem::FixedComp&,
const long int);
void createAll(Simulation&,const attachSystem::FixedComp&,
const long int,const attachSystem::FixedComp&,
const long int);
void createAll(Simulation&,
const attachSystem::FixedComp&,const std::string&,
const attachSystem::FixedComp&,const std::string&);
};
}
#endif
|
//# VisResamplerScalar.h: Convolutional AW resampler for LOFAR data
//# Copyright (C) 2011
//# Associated Universities, Inc. Washington DC, USA.
//#
//# 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; if not, write to the Free Software Foundation,
//# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
//#
//# Correspondence concerning AIPS++ should be addressed as follows:
//# Internet email: aips2-request@nrao.edu.
//# Postal address: AIPS++ Project Office
//# National Radio Astronomy Observatory
//# 520 Edgemont Road
//# Charlottesville, VA 22903-2475 USA
//#
//# $Id: VisResampler.h 28512 2014-03-05 01:07:53Z vdtol $
#ifndef LOFAR_LOFARFT_VISRESAMPLERSCALAR_H
#define LOFAR_LOFARFT_VISRESAMPLERSCALAR_H
#include <AWImager2/VisResampler.h>
namespace LOFAR { //# NAMESPACE LOFAR - BEGIN
namespace LofarFT {
class VisResamplerScalar: public VisResampler
{
public:
VisResamplerScalar(): VisResampler() {}
virtual ~VisResamplerScalar() {}
// Re-sample the griddedData on the VisBuffer (a.k.a gridding).
virtual void DataToGrid (
casacore::Array<casacore::Complex>& griddedData,
VBStore& vbs,
const casacore::Vector<casacore::uInt>& rows,
casacore::Int rbeg,
casacore::Int rend,
casacore::Matrix<casacore::Double>& sumwt,
const casacore::Bool& dopsf,
CFStore& cfs)
{
DataToGridImpl_p(griddedData, vbs, rows, rbeg, rend, sumwt,dopsf,cfs);
}
virtual void DataToGrid (
casacore::Array<casacore::DComplex>& griddedData,
VBStore& vbs,
const casacore::Vector<casacore::uInt>& rows,
casacore::Int rbeg,
casacore::Int rend,
casacore::Matrix<casacore::Double>& sumwt,
const casacore::Bool& dopsf,
CFStore& cfs)
{
DataToGridImpl_p(griddedData, vbs, rows, rbeg, rend, sumwt,dopsf,cfs);
}
virtual void GridToData(
VBStore& vbs,
const casacore::Array<casacore::Complex>& grid,
const casacore::Vector<casacore::uInt>& rows,
casacore::Int rbeg,
casacore::Int rend,
CFStore& cfs);
private:
// Re-sample the griddedData on the VisBuffer (a.k.a de-gridding).
//
template <class T>
void DataToGridImpl_p(casacore::Array<T>& griddedData, VBStore& vb,
const casacore::Vector<casacore::uInt>& rows,
casacore::Int rbeg, casacore::Int rend,
casacore::Matrix<casacore::Double>& sumwt,const casacore::Bool& dopsf,
CFStore& cfs);
casacore::Vector<casacore::Int> cfMap_p, conjCFMap_p;
};
} // end namespace LofarFT
} // end namespace LOFAR
#endif //
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.