text stringlengths 4 6.14k |
|---|
#include "base.h"
int main(){
std::cout<<"main ..." <<std::endl;
}
|
/* initialize_settings.c - Initialize settings for the Snow Leopard C/C++
* Compiler
*/
/*
* Copyright (C) 2014 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/>.
*/
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include "../include/sl/config/config.h"
#include "../include/sl/slcc/features.h"
#include "../include/sl/slcc/settings.h"
/*-----------------------------------------------------------------------------
* Function initialize_settings
*
* Initialize the settings structure, setting all defaults the can't be set
* by regular initialization.
*
* Arguments
* struct settings * settings - Pointer to settings structure
* Returns
* true - Initialize succeeded
* false - Initialize failed
*/
bool
initialize_settings (struct settings * settings)
{
/* Initialize source paths */
settings->source_paths = malloc (sizeof (char *) * __SL_MAX_SOURCE_PATHS);
if (settings->source_paths == NULL)
{
/* TODO Report EC_MEMORY_ALLOCATION_FAILED */
return false;
}
settings->n_source_paths = 0;
/* Initialize include paths */
settings->include_paths = malloc (sizeof (char *) * __SL_MAX_INCLUDE_PATHS);
if (settings->include_paths == NULL)
{
/* TODO Report EC_MEMORY_ALLOCATION_FAILED */
return false;
}
settings->n_include_paths = 0;
/* Initialize library paths */
settings->library_paths = malloc (sizeof (char *) * __SL_MAX_LIBRARY_PATHS);
if (settings->library_paths == NULL)
{
/* TODO Report EC_MEMORY_ALLOCATION_FAILED */
return false;
}
settings->n_library_paths = 0;
/* Initialize features */
settings->features = malloc (sizeof (enum features) * __SL_MAX_FEATURES);
if (settings->features == NULL)
{
/* TODO Report EC_MEMORY_ALLOCATION_FAILED */
return false;
}
settings->n_features = 0;
return true;
}
/*-<EOF>-*/
|
/* DreamChess
**
** DreamChess is the legal property of its developers, whose names are too
** numerous to list here. Please refer to the COPYRIGHT file distributed
** with this source distribution.
**
** This program is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 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 <gamegui/bin.h>
gg_class_id gg_bin_get_class_id(void)
{
GG_CHILD(gg_container_get_class_id())
}
gg_widget_t *gg_bin_get_child(gg_bin_t *bin)
{
return gg_container_get_child(GG_CONTAINER(bin), 0);
}
void gg_bin_set_size(gg_widget_t *widget, int width, int height)
{
gg_widget_t *child = gg_bin_get_child(GG_BIN(widget));
if (child)
child->set_size(child, width, height);
gg_set_size(widget, width, height);
}
int gg_bin_set_focus_pos(gg_widget_t *widget, int x, int y)
{
gg_widget_t *child = gg_bin_get_child(GG_BIN(widget));
if (child)
return child->set_focus_pos(child, x, y);
return 0;
}
int gg_bin_input(gg_widget_t *widget, gg_event_t event)
{
gg_widget_t *child = gg_bin_get_child(GG_BIN(widget));
if (child)
return child->input(child, event);
return 0;
}
void gg_bin_init(gg_bin_t *bin, gg_widget_t *child)
{
gg_container_init((gg_container_t *) bin);
bin->set_size = gg_bin_set_size;
bin->set_focus_pos = gg_bin_set_focus_pos;
bin->input = gg_bin_input;
bin->id = gg_bin_get_class_id();
bin->enabled = child->enabled;
gg_container_append(GG_CONTAINER(bin), child);
}
|
#ifndef PROM_IF_IFC_H
#define PROM_IF_IFC_H
extern void PromIfInit(HWND hwnd, void (*rx)(HWND, BYTE*, DWORD));
extern BYTE PromIfReadData(BYTE *data, DWORD length);
extern BOOL PromIfWriteData(HANDLE hFile, BYTE *data, DWORD length);
#endif
|
//
// HYPhotoNetwork.h
// HYChatProject
//
// Created by erpapa on 16/5/12.
// Copyright © 2016年 erpapa. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "HYQNAuthPolicy.h"
#import "HYAudioModel.h"
typedef void (^HYPhotoNetworkDidUploadSuccessBlock) (BOOL success); // 上传成功/失败
typedef void (^HYPhotoNetworkDidDownloadSuccessBlock) (BOOL success); // 上传成功/失败
@interface HYNetworkManager : NSObject
+ (instancetype)sharedInstance;
/* 开始上传指定文件 */
- (void)uploadImage:(NSData *)imageData imageName:(NSString *)imageName successBlock:(HYPhotoNetworkDidUploadSuccessBlock)successBlock;
- (void)uploadFilePath:(NSString *)filePath fileName:(NSString *)fileName successBlock:(HYPhotoNetworkDidUploadSuccessBlock)successBlock;
/* 下载文件 */
- (void)downloadVideoUrl:(NSString *)videoUrl successBlock:(HYPhotoNetworkDidDownloadSuccessBlock)successBlock;
- (void)downloadAudioModel:(HYAudioModel *)audioModel successBlock:(HYPhotoNetworkDidDownloadSuccessBlock)successBlock;
@end
|
#ifndef POSITIVEINTEGERTYPE_H
#define POSITIVEINTEGERTYPE_H
// Librerías Internas
#include "../../xsd_global.h"
#include "NonNegativeIntegerType.h"
// Librerías Externas
#include "Enumeration.h"
// Librerías Qt
#include <QMetaEnum>
#include <QObject>
namespace Com {
namespace Ecosoftware {
namespace Engines {
namespace Xsd {
class XSDSHARED_EXPORT PositiveIntegerType : public NonNegativeIntegerType {
Q_OBJECT
Q_ENUMS ( facets )
public:
PositiveIntegerType ();
PositiveIntegerType ( const PositiveIntegerType& );
~PositiveIntegerType ();
enum facets {
ASSERTIONS = FacetAbs::facets::ASSERTIONS,
ENUMERATION = FacetAbs::facets::ENUMERATION,
MAXEXCLUSIVE = FacetAbs::facets::MAXEXCLUSIVE,
MAXINCLUSIVE = FacetAbs::facets::MAXINCLUSIVE,
MINEXCLUSIVE = FacetAbs::facets::MINEXCLUSIVE,
TOTALDIGITS = FacetAbs::facets::TOTALDIGITS
};
Q_ENUM ( facets )
};
}
}
}
}
Q_DECLARE_METATYPE ( Com::Ecosoftware::Engines::Xsd::PositiveIntegerType )
#endif // POSITIVEINTEGERTYPE_H
|
/*
* This is a part of the BugTrap package.
* Copyright (c) 2005-2007 IntelleSoft.
* All rights reserved.
*
* Description: Splitter control class.
* Author: Maksim Pyatkovskiy.
*
* This source code is only intended as a supplement to the
* BugTrap package reference and related electronic documentation
* provided with the product. See these sources for detailed
* information regarding the BugTrap package.
*/
#pragma once
/// Splitter control class.
class CSplitter
{
public:
/// Splitter direction.
enum SPLITTER_DIRECTION
{
/// Vertical splitter.
SD_VERTICAL = 0,
/// Horizontal splitter.
SD_HORIZONTAL = 1,
};
enum
{
/// Number of panels.
NUM_PANELS = 2
};
/// Initialize the object.
CSplitter(SPLITTER_DIRECTION eDirection = SD_VERTICAL, bool bProportionalMode = false);
/// Attach splitter object to window handle.
void Attach(HWND hwnd);
/// Detach splitter object to window handle.
void Detach(void);
/// Get splitter direction.
SPLITTER_DIRECTION GetDirection(void) const;
/// Set splitter direction.
void SetDirection(SPLITTER_DIRECTION eDirection);
/// Get panel handle.
HWND GetPanel(int iPanel) const;
/// Set panel handle.
BOOL SetPanel(int iPanel, HWND hwndPanel);
/// Update panels layout.
void UpdateLayout(void);
/// Reset splitter position.
void ResetSplitterPos(void);
/// Set splitter position.
void SetSplitterPos(int nSplitterPos);
/// Get current splitter position.
int GetSplitterPos(void) const;
/// Set proportional mode.
void SetProportionalMode(bool bProportionalMode);
/// Get proportional mode.
bool GetProportionalMode(void) const;
private:
/// Protect the class from being accidentally copied.
CSplitter(const CSplitter& rSplitter);
/// Protect the class from being accidentally copied.
CSplitter& operator=(const CSplitter& rSplitter);
/// Window procedure of splitter window.
static LRESULT CALLBACK SplitterWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
/// Draw splitter area.
void DrawSplitter(HDC hdc) const;
/// Draw splitter bar.
void DrawSplitterBar(HDC hdc) const;
/// Draw panel area.
BOOL DrawPanel(HDC hdc, int iPanel) const;
/// Check if point appears within splitter bar.
BOOL HitTest(const POINT& point) const;
/// Check if point appears within splitter bar.
BOOL HitTest(int x, int y) const;
/// Calculates splitter bar rectangle.
void GetSplitterBarRect(RECT& rect) const;
/// Calculate panel rectangle based on panel index.
BOOL CalcPanelRect(int iPanel, RECT& rect, bool bShrinkRect) const;
/// Resize splitter window and update panels layout.
void ResizeSplitter(int nSplitterSize);
/// Clear splitter size and position.
void ClearSplitterPos(void);
/// Clear panel windows.
void ClearPanels(void);
/// Calculate splitter size.
int CalcSplitterSize(void) const;
/// Window handle.
HWND m_hwnd;
/// Old window procedure.
WNDPROC m_pfnOldSplitterWndProc;
/// Splitter direction.
SPLITTER_DIRECTION m_eDirection;
/// Splitter position.
int m_nSplitterPos;
/// Ideal slider position.
int m_nIdealPos;
/// Keeps ideal window size.
int m_nSplitterSize;
/// Proportional mode flag.
bool m_bProportionalMode;
/// Panel handles.
HWND m_arrPanels[NUM_PANELS];
};
/**
* @return current splitter direction.
*/
inline CSplitter::SPLITTER_DIRECTION CSplitter::GetDirection(void) const
{
return m_eDirection;
}
/**
* @param iPanel - panel number.
* @return panel window handle.
*/
inline HWND CSplitter::GetPanel(int iPanel) const
{
return (iPanel >= 0 && iPanel < NUM_PANELS ? m_arrPanels[iPanel] : NULL);
}
/**
* @return current splitter position.
*/
inline int CSplitter::GetSplitterPos(void) const
{
return m_nSplitterPos;
}
/**
* @param bProportionalMode - new proportional mode.
*/
inline void CSplitter::SetProportionalMode(bool bProportionalMode)
{
m_bProportionalMode = bProportionalMode;
}
/**
* @return active proportional mode.
*/
inline bool CSplitter::GetProportionalMode(void) const
{
return m_bProportionalMode;
}
|
/*
* arch/score/lib/ucmpdi2.c
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see the file COPYING, or write
* to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <linux/module.h>
#include "libgcc.h"
word_type __ucmpdi2(unsigned long long a, unsigned long long b)
{
const DWunion au = {.ll = a};
const DWunion bu = {.ll = b};
if ((unsigned int) au.s.high < (unsigned int) bu.s.high)
{
return 0;
}
else if ((unsigned int) au.s.high > (unsigned int) bu.s.high)
{
return 2;
}
if ((unsigned int) au.s.low < (unsigned int) bu.s.low)
{
return 0;
}
else if ((unsigned int) au.s.low > (unsigned int) bu.s.low)
{
return 2;
}
return 1;
}
EXPORT_SYMBOL(__ucmpdi2);
|
/* Ross Meikleham 2014*/
#ifndef CPU_H
#define CPU_H
#include <stdint.h>
extern int halted;
extern int stopped;
/* Call interrupt handler code */
void restart(uint8_t addr);
void update_all_cycles(long cycles);
/* Check if master interrupts are enabled */
int master_interrupts_enabled();
void master_interrupts_disable();
void master_interrupts_enable();
void reset_cpu();
/* Executes current instruction and returns
* the number of machine cycles it took */
int exec_opcode(int skip_bug);
void print_regs();
#endif
|
#ifndef REFERENCECOMBOBOX_H
#define REFERENCECOMBOBOX_H
#include <QComboBox>
class ReferenceComboBox final : public QComboBox
{
Q_OBJECT
Q_PROPERTY(QVariant currentData READ currentData WRITE
setCurrentData NOTIFY currentDataChanged USER true)
public:
explicit ReferenceComboBox(QWidget *parent = nullptr);
void setCurrentData(QVariant data);
void validate();
QSize minimumSizeHint() const override;
void showPopup() override;
void showEvent(QShowEvent *event) override;
Q_SIGNALS:
QVariantList listRequired();
QString textRequired(QVariant data);
void currentDataChanged(QVariant data);
protected:
void paintEvent(QPaintEvent *event) override;
private:
void refreshList();
void insertItem(int index, QVariant data);
bool mSuspendDataChangedSignal{ };
};
#endif // REFERENCECOMBOBOX_H
|
/**************************************************************************
* Otter Browser: Web browser controlled by the user, not vice-versa.
* Copyright (C) 2021 Michal Dutkiewicz aka Emdek <michal@emdek.pl>
*
* 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 OTTER_XBELBOOKMARKSEXPORTDATAEXCHANGER_H
#define OTTER_XBELBOOKMARKSEXPORTDATAEXCHANGER_H
#include "../../../core/DataExchanger.h"
namespace Otter
{
class XbelBookmarksExportDataExchanger final : public ExportDataExchanger
{
Q_OBJECT
public:
explicit XbelBookmarksExportDataExchanger(QObject *parent = nullptr);
QString getName() const override;
QString getTitle() const override;
QString getDescription() const override;
QString getVersion() const override;
QString getSuggestedPath(const QString &path = {}) const override;
QString getGroup() const override;
QUrl getHomePage() const override;
QStringList getFileFilters() const override;
ExchangeType getExchangeType() const override;
public slots:
bool exportData(const QString &path) override;
};
}
#endif
|
#ifndef PARTITIONINGNODE_H
#define PARTITIONINGNODE_H
#include "node.h"
#include <iostream>
namespace fl {
/// \class PartitioningNode
///
/// \brief `PartitioningNode` is a single element of any partitioning
/// component tree.
///
/// The concrete class `PartitioningNode`. The constraint on the
/// contents of this type of `Node` depend on whether it is a leaf
/// or an inner `Node`. `Nodes` in any partitioning tree follow these
/// rules:
/// - leaf `Node`: contains one or more elements (pixels)
/// -# all the leaf `Node`s in a single partitioning tree must
/// cover all the elements (pixels) of the image used in
/// construction
/// - inner `Node`: comprises only elements of it's children `Node`s
/// -# constructed, a `PartitioningNode` can not contain any of
/// it's own elements if it has any children
/// -# the number of children of a `PartitioningNode` is always
/// /(2/) or more.
///
/// \note The constraints of a `PartitioningNode` are only partially
/// ensured by the structure for complexity and performance reasons.
class PartitioningNode : public fl::Node{
protected:
/// \brief Check if the constraints are valid for a `PartitioningNode`.
virtual void checkConstraints(void) const;
public:
/// \brief Constructor assigning pixels to the `PartitioningNode`.
PartitioningNode(const std::vector< std::pair< int, int > >& S);
/// \brief Constructor assigning both pixels and all children to the `PartitioningNode`.
PartitioningNode(const std::vector< std::pair< int, int > >& S,
const std::vector< fl::PartitioningNode* >& children);
/// \brief Constructor assigning all the children to this `PartitioningNode`
PartitioningNode(const std::vector< fl::PartitioningNode* >& children);
/// \brief Class destructor
virtual ~PartitioningNode() { }
/// \brief \copybrief Node::deleteChild().
bool deleteChild(int childIndex);
private:
};
}
#endif // PARTITIONINGNODE_H
|
/**
******************************************************************************
* @file Examples_LL/RTC/RTC_TimeStamp/Src/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.0.0
* @date 17-February-2017
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @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 "stm32f4xx_it.h"
/** @addtogroup STM32F4xx_LL_Examples
* @{
*/
/** @addtogroup RTC_TimeStamp
* @{
*/
/* 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 Timestamp interrupt request.
* @param None
* @retval None
*/
void TAMP_STAMP_IRQHandler(void)
{
/* Get the TimeStamp interrupt source enable status */
if(LL_RTC_IsEnabledIT_TS(RTC) != 0)
{
/* Get the pending status of the TIMESTAMP Interrupt */
if(LL_RTC_IsActiveFlag_TS(RTC) != 0)
{
/* TIMESTAMP callback */
TimeStampEvent_Callback();
/* Clear the TIMESTAMP interrupt pending bit */
LL_RTC_ClearFlag_TS(RTC);
}
}
/* Clear the EXTI's Flag for RTC TimeStamp and Tamper */
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_21);
}
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
//
// LogViewController.h
// Se Le Tiene
//
// Created by Jorge Raul Ovalle Zuleta on 10/7/14.
// Copyright (c) 2014 Olinguito. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "APIManager.h"
#import "JOAlert.h"
@interface LogViewController : UIViewController <UITextFieldDelegate,APIManagerDelegate>{
int yPos;
int sW;
int sH;
APIManager *APIManagerClass;
JOAlert *loader;
}
extern int dev;
extern NSString* token;
@property (weak, nonatomic) IBOutlet UITextField *txtEmail;
@property (weak, nonatomic) IBOutlet UITextField *txtPassword;
@property (weak, nonatomic) IBOutlet UIButton *btnSignIn;
@property (strong, nonatomic) JOAlert *alert;
@end
|
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef BASE_THREADING_WORKER_POOL_H_
#define BASE_THREADING_WORKER_POOL_H_
#pragma once
#include "base/base_export.h"
#include "base/callback.h"
class Task;
namespace tracked_objects {
class Location;
} // namespace tracked_objects
namespace base {
// This is a facility that runs tasks that don't require a specific thread or
// a message loop.
//
// WARNING: This shouldn't be used unless absolutely necessary. We don't wait
// for the worker pool threads to finish on shutdown, so the tasks running
// inside the pool must be extremely careful about other objects they access
// (MessageLoops, Singletons, etc). During shutdown these object may no longer
// exist.
class BASE_EXPORT WorkerPool {
public:
// This function posts |task| to run on a worker thread. |task_is_slow|
// should be used for tasks that will take a long time to execute. Returns
// false if |task| could not be posted to a worker thread. Regardless of
// return value, ownership of |task| is transferred to the worker pool.
//
// TODO(ajwong): Remove the Task* based overload once we've finishsed the
// Task -> Closure migration.
static bool PostTask(const tracked_objects::Location& from_here,
Task* task, bool task_is_slow);
static bool PostTask(const tracked_objects::Location& from_here,
const base::Closure& task, bool task_is_slow);
// Just like MessageLoopProxy::PostTaskAndReply, except the destination
// for |task| is a worker thread and you can specify |task_is_slow| just
// like you can for PostTask above.
static bool PostTaskAndReply(const tracked_objects::Location& from_here,
const Closure& task,
const Closure& reply,
bool task_is_slow);
};
} // namespace base
#endif // BASE_THREADING_WORKER_POOL_H_
|
/*
Shirken's Snake
Copyright (C) 2007-2014 Juan Delgado dp.juan@gmail.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __CLASE__TABLERO__
#define __CLASE__TABLERO__
#include <fstream>
#include <iostream>
#include <cstdlib>
#include "global.h"
using namespace std;
class Tablero{
private:
//Atributos
TContenido m[MAX][MAX];
public:
Tablero(const char fichero[]); //carga el mapa del fichero
~Tablero();
int GetDimension(); //obtiene el tamano maximo del tablero
void SetContenido(int x, int y, TContenido Contenido); //Establece el contenido de una posicion
TContenido GetContenido(int x, int y); //obtiene el contenido de una posicion
void Refrescar(); //refresca el contenido vaciando los elementos no obstaculos
void ObtenerPosicionAleatoria(int &x, int &y); //Devuelve una posicion aleatoria valida del tablero
};
#endif
|
/*
* Generated by asn1c-0.9.29 (http://lionet.info/asn1c)
* From ASN.1 module "S1AP-IEs"
* found in "../support/s1ap-r16.1.0/36413-g10.asn"
* `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps`
*/
#ifndef _S1AP_UE_S1AP_IDs_H_
#define _S1AP_UE_S1AP_IDs_H_
#include <asn_application.h>
/* Including external dependencies */
#include "S1AP_MME-UE-S1AP-ID.h"
#include <constr_CHOICE.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Dependencies */
typedef enum S1AP_UE_S1AP_IDs_PR {
S1AP_UE_S1AP_IDs_PR_NOTHING, /* No components present */
S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair,
S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID
/* Extensions may appear below */
} S1AP_UE_S1AP_IDs_PR;
/* Forward declarations */
struct S1AP_UE_S1AP_ID_pair;
/* S1AP_UE-S1AP-IDs */
typedef struct S1AP_UE_S1AP_IDs {
S1AP_UE_S1AP_IDs_PR present;
union S1AP_UE_S1AP_IDs_u {
struct S1AP_UE_S1AP_ID_pair *uE_S1AP_ID_pair;
S1AP_MME_UE_S1AP_ID_t mME_UE_S1AP_ID;
/*
* This type is extensible,
* possible extensions are below.
*/
} choice;
/* Context for parsing across buffer boundaries */
asn_struct_ctx_t _asn_ctx;
} S1AP_UE_S1AP_IDs_t;
/* Implementation */
extern asn_TYPE_descriptor_t asn_DEF_S1AP_UE_S1AP_IDs;
#ifdef __cplusplus
}
#endif
#endif /* _S1AP_UE_S1AP_IDs_H_ */
#include <asn_internal.h>
|
/*
* CommandInclude.h
*
* Created on: 19 wrz 2017
* Author: Peter
*/
#ifndef COMMANDINCLUDE_H_
#define COMMANDINCLUDE_H_
#include "Command.h"
#include "GeneralCommand.h"
#include "ModeCommand.h"
#endif /* COMMANDINCLUDE_H_ */
|
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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/>.
*
*/
/**
* feature/runout.h - Runout sensor support
*/
#ifndef _RUNOUT_H_
#define _RUNOUT_H_
#include "../sd/cardreader.h"
#include "../module/printcounter.h"
#include "../module/stepper.h"
#include "../gcode/queue.h"
#include "../inc/MarlinConfig.h"
#define FIL_RUNOUT_THRESHOLD 5
class FilamentRunoutSensor {
public:
FilamentRunoutSensor() {}
static void setup();
FORCE_INLINE static void reset() { runout_count = 0; filament_ran_out = false; }
FORCE_INLINE static void run() {
if ((IS_SD_PRINTING || print_job_timer.isRunning()) && check() && !filament_ran_out) {
filament_ran_out = true;
enqueue_and_echo_commands_P(PSTR(FILAMENT_RUNOUT_SCRIPT));
stepper.synchronize();
}
}
private:
static bool filament_ran_out;
static uint8_t runout_count;
FORCE_INLINE static bool check() {
#if NUM_RUNOUT_SENSORS < 2
// A single sensor applying to all extruders
const bool is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING;
#else
// Read the sensor for the active extruder
bool is_out;
switch (active_extruder) {
case 0: is_out = READ(FIL_RUNOUT_PIN) == FIL_RUNOUT_INVERTING; break;
case 1: is_out = READ(FIL_RUNOUT2_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 2
case 2: is_out = READ(FIL_RUNOUT3_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 3
case 3: is_out = READ(FIL_RUNOUT4_PIN) == FIL_RUNOUT_INVERTING; break;
#if NUM_RUNOUT_SENSORS > 4
case 4: is_out = READ(FIL_RUNOUT5_PIN) == FIL_RUNOUT_INVERTING; break;
#endif
#endif
#endif
}
#endif
return (is_out ? ++runout_count : (runout_count = 0)) > FIL_RUNOUT_THRESHOLD;
}
};
extern FilamentRunoutSensor runout;
#endif // _RUNOUT_H_
|
/*******************************************************************************
* BEGIN COPYRIGHT NOTICE
*
* This file is part of program "I-Trigue 2.1 3300 Digital Control"
* Copyright 2013-2014 R. Lemos
*
* 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/>.
*
* END COPYRIGHT NOTICE
******************************************************************************/
extern int run_server (void);
int
main (int argc, char *argv[])
{
return run_server();
}
|
/***************************************************************************
* Copyright (C) 2009 - 2010 by Simon Qian <SimonQian@SimonQian.com> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef __VSFIP_DHCPC_H_INCLUDED__
#define __VSFIP_DHCPC_H_INCLUDED__
#define VSFIP_DHCPC_XID 0xABCD1234
struct vsfip_dhcpc_local_t
{
uint32_t xid;
};
struct vsfip_dhcpc_t
{
struct vsfip_netif_t *netif;
struct vsfsm_t sm;
struct vsfip_socket_t *so;
struct vsfip_sockaddr_t sockaddr;
struct vsfip_buffer_t *outbuffer;
struct vsfip_buffer_t *inbuffer;
struct vsfip_ipaddr_t ipaddr;
struct vsfip_ipaddr_t gw;
struct vsfip_ipaddr_t netmask;
struct vsfip_ipaddr_t dns[2];
struct vsfsm_sem_t update_sem;
struct vsftimer_t *to;
uint32_t xid;
uint32_t optlen;
uint32_t retry;
uint32_t arp_retry;
uint32_t leasetime;
uint32_t renew_time;
uint32_t rebinding_time;
unsigned ready : 1;
};
#ifdef VSFCFG_STANDALONE_MODULE
#define VSFIP_DHCPC_MODNAME "vsf.stack.net.tcpip.proto.dhcpc"
struct vsfip_dhcpc_modifs_t
{
struct vsfip_dhcpc_local_t dhcpc;
vsf_err_t (*start)(struct vsfip_netif_t*, struct vsfip_dhcpc_t*);
};
vsf_err_t vsfip_dhcpc_modexit(struct vsf_module_t*);
vsf_err_t vsfip_dhcpc_modinit(struct vsf_module_t*, struct app_hwcfg_t const*);
#define VSFIP_DHCPCMOD \
((struct vsfip_dhcpc_modifs_t *)vsf_module_load(VSFIP_DHCPC_MODNAME, true))
#define vsfip_dhcpc VSFIP_DHCPCMOD->dhcpc
#define vsfip_dhcpc_start VSFIP_DHCPCMOD->start
#else
vsf_err_t vsfip_dhcpc_start(struct vsfip_netif_t*, struct vsfip_dhcpc_t*);
#endif
#endif // __VSFIP_DHCPC_H_INCLUDED__
|
#include "debounce_comp.h"
#include "commands.h"
#include "hal.h"
#include "math.h"
#include "defines.h"
#include "angle.h"
HAL_COMP(debounce);
HAL_PIN(in);
HAL_PIN(out);
HAL_PIN(debounce_time);
HAL_PIN(timer);
static void rt_func(float period, void *ctx_ptr, hal_pin_inst_t *pin_ptr) {
//struct debounce_ctx_t *ctx = (struct debounce_ctx_t *)ctx_ptr;
struct debounce_pin_ctx_t *pins = (struct debounce_pin_ctx_t *)pin_ptr;
if(PIN(in) > 0.0){
PIN(timer) += period;
}
else{
PIN(timer) -= period;
}
if(PIN(timer) > PIN(debounce_time)){
PIN(timer) = PIN(debounce_time);
PIN(out) = 1.0;
}
else if(PIN(timer) <= 0.0){
PIN(timer) = 0.0;
PIN(out) = 0.0;
}
}
hal_comp_t debounce_comp_struct = {
.name = "debounce",
.nrt = 0,
.rt = rt_func,
.frt = 0,
.nrt_init = 0,
.rt_start = 0,
.frt_start = 0,
.rt_stop = 0,
.frt_stop = 0,
.ctx_size = 0,
.pin_count = sizeof(struct debounce_pin_ctx_t) / sizeof(struct hal_pin_inst_t),
};
|
#include "mm.h"
#include <stdlib.h>
#include <stdio.h>
int main(int argc, char** argv){
struct mm_cache *mc1 = mm_cache_create("mc1", 100, 0, NULL, NULL);
struct mm_cache *mc2 = mm_cache_create("mc2", 200, 0, NULL, NULL);
struct mm_cache *mc3 = mm_cache_create("mc3", 300, 0, NULL, NULL);
struct mm_cache *mc4 = mm_cache_create("mc4", 400, 0, NULL, NULL);
struct mm_cache *mc5 = mm_cache_create("mc5", 500, 0, NULL, NULL);
struct mm_cache *mc6 = mm_cache_create("mc6", 600, 0, NULL, NULL);
struct mm_cache *mc7 = mm_cache_create("mc7", 700, 0, NULL, NULL);
mm_show();
mm_cache_destroy(mc1);
mm_cache_destroy(mc5);
mm_cache_destroy(mc7);
mm_show();
return 0;
}
|
/**
*
* \section COPYRIGHT
*
* Copyright 2013-2015 Software Radio Systems Limited
*
* \section LICENSE
*
* This file is part of the srsLTE library.
*
* srsLTE is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* srsLTE 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 Affero General Public License for more details.
*
* A copy of the GNU Affero General Public License can be found in
* the LICENSE file in the top-level directory of this distribution
* and at http://www.gnu.org/licenses/.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "srslte/phy/common/phy_common.h"
#include "srslte/phy/fec/tc_interl.h"
#include "srslte/phy/fec/turbocoder.h"
#include "srslte/phy/fec/cbsegm.h"
#include "srslte/phy/utils/debug.h"
/************************************************
*
* LTE TURBO CODE INTERLEAVER
*
************************************************/
const uint32_t f1_list[SRSLTE_NOF_TC_CB_SIZES] = { 3, 7, 19, 7, 7, 11, 5, 11, 7, 41, 103,
15, 9, 17, 9, 21, 101, 21, 57, 23, 13, 27, 11, 27, 85, 29, 33, 15, 17, 33,
103, 19, 19, 37, 19, 21, 21, 115, 193, 21, 133, 81, 45, 23, 243, 151, 155,
25, 51, 47, 91, 29, 29, 247, 29, 89, 91, 157, 55, 31, 17, 35, 227, 65, 19,
37, 41, 39, 185, 43, 21, 155, 79, 139, 23, 217, 25, 17, 127, 25, 239, 17,
137, 215, 29, 15, 147, 29, 59, 65, 55, 31, 17, 171, 67, 35, 19, 39, 19, 199,
21, 211, 21, 43, 149, 45, 49, 71, 13, 17, 25, 183, 55, 127, 27, 29, 29, 57,
45, 31, 59, 185, 113, 31, 17, 171, 209, 253, 367, 265, 181, 39, 27, 127,
143, 43, 29, 45, 157, 47, 13, 111, 443, 51, 51, 451, 257, 57, 313, 271, 179,
331, 363, 375, 127, 31, 33, 43, 33, 477, 35, 233, 357, 337, 37, 71, 71, 37,
39, 127, 39, 39, 31, 113, 41, 251, 43, 21, 43, 45, 45, 161, 89, 323, 47, 23,
47, 263 };
const uint32_t f2_list[SRSLTE_NOF_TC_CB_SIZES] = { 10, 12, 42, 16, 18, 20, 22, 24, 26, 84,
90, 32, 34, 108, 38, 120, 84, 44, 46, 48, 50, 52, 36, 56, 58, 60, 62, 32,
198, 68, 210, 36, 74, 76, 78, 120, 82, 84, 86, 44, 90, 46, 94, 48, 98, 40,
102, 52, 106, 72, 110, 168, 114, 58, 118, 180, 122, 62, 84, 64, 66, 68, 420,
96, 74, 76, 234, 80, 82, 252, 86, 44, 120, 92, 94, 48, 98, 80, 102, 52, 106,
48, 110, 112, 114, 58, 118, 60, 122, 124, 84, 64, 66, 204, 140, 72, 74, 76,
78, 240, 82, 252, 86, 88, 60, 92, 846, 48, 28, 80, 102, 104, 954, 96, 110,
112, 114, 116, 354, 120, 610, 124, 420, 64, 66, 136, 420, 216, 444, 456,
468, 80, 164, 504, 172, 88, 300, 92, 188, 96, 28, 240, 204, 104, 212, 192,
220, 336, 228, 232, 236, 120, 244, 248, 168, 64, 130, 264, 134, 408, 138,
280, 142, 480, 146, 444, 120, 152, 462, 234, 158, 80, 96, 902, 166, 336,
170, 86, 174, 176, 178, 120, 182, 184, 186, 94, 190, 480 };
int srslte_tc_interl_LTE_gen(srslte_tc_interl_t *h, uint32_t long_cb)
{
return srslte_tc_interl_LTE_gen_interl(h, long_cb, 1);
}
#define deinter(x,win) ((x%(long_cb/win))*(win)+x/(long_cb/win))
#define inter(x,win) ((x%win)*(long_cb/win)+x/win)
int srslte_tc_interl_LTE_gen_interl(srslte_tc_interl_t *h, uint32_t long_cb, uint32_t interl_win) {
uint32_t cb_table_idx, f1, f2;
uint64_t i, j;
if (long_cb > h->max_long_cb) {
fprintf(stderr, "Interleaver initiated for max_long_cb=%d\n",
h->max_long_cb);
return -1;
}
cb_table_idx = srslte_cbsegm_cbindex(long_cb);
if (cb_table_idx == -1) {
fprintf(stderr, "Can't find long_cb=%d in valid TC CB table\n", long_cb);
return -1;
}
f1 = f1_list[cb_table_idx];
f2 = f2_list[cb_table_idx];
h->forward[0] = 0;
h->reverse[0] = 0;
for (i = 1; i < long_cb; i++) {
j = (f1 * i + f2 * i * i) % (long_cb);
h->forward[i] = (uint32_t) j;
h->reverse[j] = (uint32_t) i;
}
if (interl_win != 1) {
uint16_t *f = malloc(long_cb*sizeof(uint16_t));
uint16_t *r = malloc(long_cb*sizeof(uint16_t));
memcpy(f, h->forward, long_cb*sizeof(uint16_t));
memcpy(r, h->reverse, long_cb*sizeof(uint16_t));
for (i = 0; i < long_cb; i++) {
h->forward[i] = deinter(f[inter(i,interl_win)],interl_win);
h->reverse[i] = deinter(r[inter(i,interl_win)],interl_win);
}
free(f);
free(r);
}
return 0;
}
|
////////////////////////////////////////////////////////////////////////////
// Created : 29.03.2010
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#ifndef INTERPOLATOR_VISITOR_H_INCLUDED
#define INTERPOLATOR_VISITOR_H_INCLUDED
namespace xray {
namespace animation {
class instant_interpolator;
class linear_interpolator;
class fermi_dirac_interpolator;
struct XRAY_NOVTABLE interpolator_visitor {
virtual bool visit ( instant_interpolator& other ) = 0;
virtual bool visit ( instant_interpolator const& other ) const = 0;
virtual bool visit ( linear_interpolator const& other ) const = 0;
virtual bool visit ( fermi_dirac_interpolator const& other ) const = 0;
protected:
XRAY_DECLARE_PURE_VIRTUAL_DESTRUCTOR( interpolator_visitor )
}; // class interpolator_visitor
} // namespace animation
} // namespace xray
#endif // #ifndef INTERPOLATOR_VISITOR_H_INCLUDED |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
char str[10];
printf("input 9 character\n");
scanf("%s",str);
for(int i = 0; str[i] != '\0'; ++i)
{
printf("%c",str[i]);
}
printf("\n");
puts(str);
return 0;
}
|
#define _XOPEN_SOURCE 600
#include <errno.h>
#include <inttypes.h>
#include <netdb.h>
#include <netinet/tcp.h>
#include <setjmp.h>
#include <signal.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <sys/wait.h>
#include <syslog.h>
#include <unistd.h>
#include <io_file.h>
#include "rfsd.h"
#ifndef NI_MAXHOST
#define NI_MAXHOST 1025
#endif
#ifndef NI_MAXSERV
#define NI_MAXSERV 32
#endif
static struct ipc ipc;
static sig_atomic_t should_stop;
static sigjmp_buf exit_env;
static int session(int sock, const struct sockaddr *addr, socklen_t addr_len)
{
char node[NI_MAXHOST];
char service[NI_MAXSERV];
int gnierr = getnameinfo(addr, addr_len, node, sizeof(node),
service, sizeof(service),
NI_NUMERICHOST | NI_NUMERICSERV);
if (gnierr == 0)
syslog(LOG_INFO, "New connection from [%s]:%s", node, service);
else
syslog(LOG_INFO, "New connection from unknown address "
"(getnameinfo: %s)", gai_strerror(gnierr));
ipc_init(&ipc);
io_file_init(&ipc.io, sock);
syslog(LOG_DEBUG, "Starting RFS session");
rfs_init();
while (ipc_process_rfs(&ipc) && !should_stop)
;
syslog(LOG_DEBUG, "Closing RFS session");
rfs_destroy();
if (close(sock) == -1)
syslog(LOG_WARNING, "Closing client socket: %s",
strerror(errno));
return 0;
}
static void set_term_sigs(void (*handler)(int))
{
struct sigaction sa = {.sa_handler = handler};
sigemptyset(&sa.sa_mask);
sigaddset(&sa.sa_mask, SIGINT);
sigaddset(&sa.sa_mask, SIGTERM);
sigaction(SIGINT, &sa, NULL);
sigaction(SIGTERM, &sa, NULL);
}
static void rfsd_shutdown(int sig)
{
kill(0, sig);
siglongjmp(exit_env, 1);
}
static void rfsd_exit_one(int sig)
{
(void)sig;
set_term_sigs(SIG_IGN);
should_stop = 1;
const struct itimerval delay = {
.it_value = {1, 0},
};
if (setitimer(ITIMER_REAL, &delay, NULL) == -1)
_exit(0);
}
static int setup_socket(const char *nodename, const char *servname)
{
syslog(LOG_INFO, "Requested to listen on %s:%s", nodename, servname);
const struct addrinfo hints = {
.ai_family = AF_UNSPEC,
.ai_socktype = SOCK_STREAM,
};
struct addrinfo *list, *p;
int gaierr = getaddrinfo(nodename, servname, &hints, &list);
if (gaierr) {
syslog(LOG_ERR, "Failed to resolve name: %s",
gai_strerror(gaierr));
return -1;
}
int sock = -1;
for (p = list; p != NULL; p = p->ai_next) {
char node[NI_MAXHOST];
char service[NI_MAXSERV];
int gnierr = getnameinfo(p->ai_addr, p->ai_addrlen, node,
sizeof(node), service, sizeof(service),
NI_NUMERICHOST | NI_NUMERICSERV);
if (gnierr == 0)
syslog(LOG_DEBUG, "Trying to listen on [%s]:%s",
node, service);
else
syslog(LOG_DEBUG,
"Trying to listen on unknown address "
"(getnameinfo: %s", gai_strerror(gnierr));
sock = socket(p->ai_family, p->ai_socktype, p->ai_protocol);
if (sock == -1) {
syslog(LOG_DEBUG, "Failed to open socket: %s",
strerror(errno));
continue;
}
if (bind(sock, p->ai_addr, p->ai_addrlen) == -1) {
syslog(LOG_DEBUG, "Failed to bind: %s",
strerror(errno));
goto fail;
}
if (listen(sock, 1) == -1) {
syslog(LOG_DEBUG, "Failed to listen: %s",
strerror(errno));
goto fail;
}
int keepalive = 1;
if (setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE,
&keepalive, sizeof(keepalive)) == -1)
syslog(LOG_NOTICE, "Failed to enable keep-alive: %s",
strerror(errno));
if (p->ai_protocol == IPPROTO_TCP) {
int nodelay = 1;
if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
&nodelay, sizeof(nodelay)) == -1)
syslog(LOG_NOTICE,
"Failed to enable TCP_NODELAY: %s",
strerror(errno));
}
syslog(LOG_DEBUG, "Server socket is ready");
break;
fail:
if (close(sock) == -1)
syslog(LOG_DEBUG, "Closing socket: %s",
strerror(errno));
sock = -1;
}
freeaddrinfo(list);
return sock;
}
static void main_loop(int sock)
{
syslog(LOG_DEBUG, "Running main loop");
sigset_t allsig;
sigfillset(&allsig);
for (;;) {
struct sockaddr_storage addr;
socklen_t addr_len = sizeof(addr);
int rsock = accept(sock, (struct sockaddr *)&addr, &addr_len);
if (rsock == -1) {
syslog(LOG_WARNING, "Accepting new connection: %s",
strerror(errno));
continue;
}
sigset_t oldmask;
sigprocmask(SIG_BLOCK, &allsig, &oldmask);
if (fork() == 0) {
set_term_sigs(rfsd_exit_one);
sigprocmask(SIG_SETMASK, &oldmask, NULL);
if (close(sock) == -1)
syslog(LOG_WARNING,
"Closing listen socket: %s",
strerror(errno));
session(rsock, (struct sockaddr *)&addr, addr_len);
return;
}
sigprocmask(SIG_SETMASK, &oldmask, NULL);
if (close(rsock) == -1)
syslog(LOG_WARNING, "Closing client socket: %s",
strerror(errno));
}
}
int main(int argc, char **argv)
{
openlog(argv[0],
#ifdef LOG_PERROR
LOG_PERROR |
#endif
LOG_PID | LOG_CONS | LOG_NOWAIT, LOG_USER);
if (argc != 3) {
syslog(LOG_EMERG,
"%d arguments passed, while 2 are required", argc);
return 1;
}
setpgrp();
set_term_sigs(rfsd_shutdown);
sigignore(SIGCHLD);
int sock = setup_socket(argv[1], argv[2]);
if (sock == -1) {
syslog(LOG_EMERG, "Cannot listen requested address!");
return 1;
}
if (!sigsetjmp(exit_env, 0))
main_loop(sock);
else {
syslog(LOG_DEBUG, "Stopping the server");
if (close(sock) == -1)
syslog(LOG_WARNING, "Closing listen socket: %s",
strerror(errno));
syslog(LOG_DEBUG, "Waiting for children...");
while (wait(NULL) != -1 || errno != ECHILD)
;
}
syslog(LOG_INFO, "Bye-bye!");
closelog();
return 0;
}
|
#include"data_gen.h"
#include <time.h>
#include <stdlib.h>
double* rand_double_arr(int size){
double* res = (double*) malloc(size * sizeof(double));
srand((unsigned)time(NULL));
for (int i = 0; i < size; ++i) {
res[i] = (double)rand()/RAND_MAX;
}
return res;
}
int* rand_int_arr(int size){
int* res = (int*) malloc(size * sizeof(int));
srand((unsigned)time(NULL));
for (int i = 0; i < size; ++i) {
res[i] = (int)rand();
}
return res;
}
char* rand_char_arr(int size){
char* res = (char*) malloc(size * sizeof(char));
srand((unsigned)time(NULL));
for (int i = 0; i < size; ++i) {
res[i] = (char)rand();
}
return res;
}
float* rand_float_arr(int size){
float* res = (float*) malloc(size * sizeof(float));
srand((unsigned)time(NULL));
for (int i = 0; i < size; ++i) {
res[i] = (float)rand();
}
return res;
}
|
/* Replacement grp.h file for building GNU Emacs on Windows.
Copyright (C) 2003-2011 Free Software Foundation, Inc.
This file is part of GNU Emacs.
GNU Emacs 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.
GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifndef _GRP_H
#define _GRP_H
#include <pwd.h> /* gid_t defined here */
/* Emacs uses only gr_name */
struct group {
char *gr_name; /* group name */
gid_t gr_gid; /* group numerical ID */
};
struct group *getgrgid(gid_t);
#endif /* _GRP_H */
|
// Copyright (c) 2006-2007 Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org); you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 3 of the License,
// or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: LGPL-3.0+
//
//
// Author(s) : Michael Hemmer <hemmer@mpi-inf.mpg.de>
//
// =============================================================================
/*! \file CGAL/Algebraic_extension_traits.h
* \brief Defines traits class CGAL::Algebraic_extension_traits.
*/
#ifndef CGAL_ALGEBRAIC_NUMBER_TRAITS_H
#define CGAL_ALGEBRAIC_NUMBER_TRAITS_H 1
#include <numeric> // for std::accumulate
#include <CGAL/tags.h>
#include <CGAL/Algebraic_structure_traits.h>
namespace CGAL {
template< class T >
class Algebraic_extension_traits {
public:
//! \name Typedefs
//! the number type for which this instance has been instantiated
typedef T Type;
//! standard number types are not extended
typedef CGAL::Tag_false Is_extended;
//! computes the factor which normalizes a number to be integral after
// multiplication
class Normalization_factor
: public CGAL::unary_function<Type,Type> {
private:
static Type
normalization_factor(const Type&,Integral_domain_without_division_tag){
return Type(1);
}
static Type
normalization_factor(const Type& a, Field_tag){
return Type(1)/a;
}
public:
//! determine normalization factor
Type operator () (const Type& a) {
CGAL_precondition(a != Type(0));
typedef typename Algebraic_structure_traits<Type>::Algebraic_category
Tag;
return normalization_factor(a, Tag());
}
};
class Denominator_for_algebraic_integers
: public CGAL::unary_function<Type,Type> {
public:
//! determine normalization factor
Type operator () (const Type&) {
return Type(1);
}
template <class InputIterator>
Type operator () (InputIterator, InputIterator) {
return Type(1);
}
};
};
} //namespace CGAL
#endif // NiX_ALGEBRAIC_NUMBER_TRAITS_H
// EOF
|
/* Copyright (C) 2012,2013 Renier Yves
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 <stdio.h>
//#include <string.h>
//#include <stdlib.h>
//#include <mgl/mgl_fltk.h>
#include <mgl/mgl_zb.h>
//#include <unistd.h>
#ifndef LOGIC_INPUT
#define LOGIC_INPUT
#include "logic_input.h"
#endif
#ifndef TRANSITION
#define TRANSITION
#include "transition.h"
#endif
#ifndef BINARY
#define BINARY
#include "binary.h"
#endif
#ifndef ACTIVITY
#define ACTIVITY
#include "activity.h"
#endif
#ifndef PROTOCOL
#define PROTOCOL
#include "protocol.h"
#endif
#ifndef DEBUG_H
#define DEBUG_H
#include "debug.h"
#endif
//! Default class herited from protocol. No decoding performed
class raw: public protocol
{
public:
//! Constructor.
/*! call init_acquisition()*/
raw(uint8_t pins[]=NULL,uint8_t npin=4);
//! Destructor
~raw();
//! no decoding performed.
void decode ();
//! Draw all captured data
/*! \param gr pointer to mglGraph object*/
int Draw(mglGraph *gr);
};
|
/*
* Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/>
* Copyright (C) 2005-2012 MaNGOS <http://www.getmangos.com/>
* Copyright (C) 2008-2012 Trinity <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITY_DEFINE_H
#define TRINITY_DEFINE_H
#include <sys/types.h>
#include <ace/Basic_Types.h>
#include <ace/ACE_export.h>
#include "CompilerDefs.h"
#define TRINITY_LITTLEENDIAN 0
#define TRINITY_BIGENDIAN 1
#if !defined(TRINITY_ENDIAN)
# if defined (ACE_BIG_ENDIAN)
# define TRINITY_ENDIAN TRINITY_BIGENDIAN
# else //ACE_BYTE_ORDER != ACE_BIG_ENDIAN
# define TRINITY_ENDIAN TRINITY_LITTLEENDIAN
# endif //ACE_BYTE_ORDER
#endif //TRINITY_ENDIAN
#if PLATFORM == PLATFORM_WINDOWS
# define TRINITY_PATH_MAX MAX_PATH
# ifndef DECLSPEC_NORETURN
# define DECLSPEC_NORETURN __declspec(noreturn)
# endif //DECLSPEC_NORETURN
#else //PLATFORM != PLATFORM_WINDOWS
# define TRINITY_PATH_MAX PATH_MAX
# define DECLSPEC_NORETURN
#endif //PLATFORM
#if !defined(COREDEBUG)
# define TRINITY_INLINE inline
#else //COREDEBUG
# if !defined(TRINITY_DEBUG)
# define TRINITY_DEBUG
# endif //TRINITY_DEBUG
# define TRINITY_INLINE
#endif //!COREDEBUG
#if COMPILER == COMPILER_GNU
# define ATTR_NORETURN __attribute__((noreturn))
# define ATTR_PRINTF(F, V) __attribute__ ((format (printf, F, V)))
#else //COMPILER != COMPILER_GNU
# define ATTR_NORETURN
# define ATTR_PRINTF(F, V)
#endif //COMPILER == COMPILER_GNU
typedef ACE_INT64 int64;
typedef ACE_INT32 int32;
typedef ACE_INT16 int16;
typedef ACE_INT8 int8;
#ifndef _UINT64 //Fix for Mac OS X 10.7
typedef ACE_UINT64 uint64;
#define _UINT64
#endif
#ifndef _UINT32 //Fix for Mac OS X 10.7
typedef ACE_UINT32 uint32;
#define _UINT32
#endif
#ifndef _UINT16 //Fix for Mac OS X 10.7
typedef ACE_UINT16 uint16;
#define _UINT16
#endif
#ifndef _UINT8 //Fix for Mac OS X 10.7
typedef ACE_UINT8 uint8;
#define _UINT8
#endif
enum
{
FT_NA='x', //not used or unknown, 4 byte size
FT_NA_BYTE='X', //not used or unknown, byte
FT_STRING='s', //char*
FT_FLOAT='f', //float
FT_INT='i', //uint32
FT_BYTE='b', //uint8
FT_SORT='d', //sorted by this field, field is not included
FT_IND='n', //the same, but parsed to data
FT_LOGIC='l', //Logical (boolean)
FT_SQL_PRESENT='p', //Used in sql format to mark column present in sql dbc
FT_SQL_ABSENT='a' //Used in sql format to mark column absent in sql dbc
};
#endif //TRINITY_DEFINE_H
|
/*
VitaShell
Copyright (C) 2015-2018, TheFloW
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 "main.h"
#include "pfs.h"
/*
SceAppMgr mount IDs:
0x64: ux0:picture
0x65: ur0:user/00/psnfriend
0x66: ur0:user/00/psnmsg
0x69: ux0:music
0x6E: ux0:appmeta
0xC8: ur0:temp/sqlite
0xCD: ux0:cache
0x12E: ur0:user/00/trophy/data/sce_trop
0x12F: ur0:user/00/trophy/data
0x3E8: ux0:app, vs0:app, gro0:app
0x3E9: ux0:patch
0x3EB: ?
0x3EA: ux0:addcont
0x3EC: ux0:theme
0x3ED: ux0:user/00/savedata
0x3EE: ur0:user/00/savedata
0x3EF: vs0:sys/external
0x3F0: vs0:data/external
*/
char pfs_mounted_path[MAX_PATH_LENGTH];
char pfs_mount_point[MAX_MOUNT_POINT_LENGTH];
int read_only;
int known_pfs_ids[] = {
0x6E,
0x12E,
0x12F,
0x3ED,
};
int pfsMount(const char *path) {
int res;
char work_path[MAX_PATH_LENGTH];
char klicensee[0x10];
char license_buf[0x200];
ShellMountIdArgs args;
memset(klicensee, 0, sizeof(klicensee));
/*
snprintf(work_path, MAX_PATH_LENGTH, "%ssce_sys/package/work.bin", path);
if (ReadFile(work_path, license_buf, sizeof(license_buf)) == sizeof(license_buf)) {
int res = shellUserGetRifVitaKey(license_buf, klicensee);
debugPrintf("read license: 0x%08X\n", res);
}
*/
args.process_titleid = VITASHELL_TITLEID;
args.path = path;
args.desired_mount_point = NULL;
args.klicensee = klicensee;
args.mount_point = pfs_mount_point;
read_only = 0;
int i;
for (i = 0; i < sizeof(known_pfs_ids) / sizeof(int); i++) {
args.id = known_pfs_ids[i];
res = shellUserMountById(&args);
if (res >= 0)
return res;
}
read_only = 1;
return sceAppMgrGameDataMount(path, 0, 0, pfs_mount_point);
}
int pfsUmount() {
if (pfs_mount_point[0] == 0)
return -1;
int res = sceAppMgrUmount(pfs_mount_point);
if (res >= 0) {
memset(pfs_mount_point, 0, sizeof(pfs_mount_point));
memset(pfs_mounted_path, 0, sizeof(pfs_mounted_path));
}
return res;
} |
#ifndef PANE_H
#define PANE_H
#include "../All.h"
typedef struct Pane{
void (*draw)(void);
}Pane;
void sj_getPane(Pane* pane);
#endif
|
// $Id: GTScalers.H,v 1.2 2007/09/17 12:33:27 franklan Exp $
// Author: $Author: franklan $
//-*************************************************************************
// GTGanilData.cpp - Main Header to ROOTGAnilTape
// -------------------
// begin : Thu Jun 14 2001
// copyright : (C) 2001 by Garp
// email : patois@ganil.fr
//////////////////////////////////////////////////////////////////////////
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
// CVS Log:
// ---------------------------------------------------------------------------
#ifndef GT_GTScalers_H
#define GT_GTScalers_H
#include <TObject.h>
#include <TClonesArray.h>
class GTOneScaler;
/**
\class GTScalers
\brief Handle scaler buffers in GANIL DAQ data
\ingroup DAQ
*/
class GTScalers : public TObject {
public:
GTScalers(void);
~GTScalers(void);
void Fill(void*); // Vocabulary: Set or Fill ?
void DumpScalers(void);
const GTOneScaler* GetScalerPtr(Int_t index) const;
Int_t GetNbChannel(void) const
{
return fNbChannel;
}
protected:
Int_t fNbChannel; // Number of individual scales
TClonesArray fScalerArray; // Array of scalers
public:
ClassDef(GTScalers, 2) // Scaler events class
};
#endif
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: /Code/Dev/appNativa/source/rareobjc/../rare/core/com/appnativa/rare/viewer/aToolBarViewer.java
//
// Created by decoteaud on 3/11/16.
//
#ifndef _RAREaToolBarViewer_H_
#define _RAREaToolBarViewer_H_
@class RAREBeanWidget;
@class RARESPOTPushButton;
@class RARESPOTToolBar;
@class RARESPOTViewer;
@class RARESPOTWidget;
@class RAREUIAction;
@protocol RAREiContainer;
@protocol RAREiPlatformComponent;
@protocol RAREiTarget;
@protocol RAREiWidget;
#import "JreEmulation.h"
#include "com/appnativa/rare/ui/iToolBar.h"
#include "com/appnativa/rare/viewer/aContainer.h"
@interface RAREaToolBarViewer : RAREaContainer < RAREiToolBar > {
@public
BOOL buttonShowTextDefault_;
}
+ (RARESPOTPushButton *)toolbar_button;
+ (void)setToolbar_button:(RARESPOTPushButton *)toolbar_button;
+ (RARESPOTPushButton *)hyperlink_toolbar_button;
+ (void)setHyperlink_toolbar_button:(RARESPOTPushButton *)hyperlink_toolbar_button;
- (id)init;
- (id)initWithRAREiContainer:(id<RAREiContainer>)parent;
- (void)addWidgetWithRAREiWidget:(id<RAREiWidget>)widget;
- (id<RAREiWidget>)addWithRAREiPlatformComponent:(id<RAREiPlatformComponent>)comp;
- (id<RAREiWidget>)addWithRAREUIAction:(RAREUIAction *)a;
- (id<RAREiWidget>)addWithRARESPOTWidget:(RARESPOTWidget *)cfg;
- (void)addWithRAREiWidget:(id<RAREiWidget>)widget;
- (void)reverseWidgetOrder;
- (id<RAREiWidget>)addWithNSString:(NSString *)name
withRAREiPlatformComponent:(id<RAREiPlatformComponent>)comp;
- (id<RAREiWidget>)addWithNSString:(NSString *)name
withRAREUIAction:(RAREUIAction *)a;
- (void)addDefaultActions;
- (void)addExpader;
- (void)setAsExpanderWithRAREiWidget:(id<RAREiWidget>)widget
withBoolean:(BOOL)expander;
- (void)addSeparator;
- (id<RAREiWidget>)addWidgetWithRARESPOTWidget:(RARESPOTWidget *)cfg;
- (void)configureWithRARESPOTViewer:(RARESPOTViewer *)vcfg;
- (void)createComponentsWithBoolean:(BOOL)horizontal;
- (void)dispose;
- (void)targetAcquiredWithRAREiTarget:(id<RAREiTarget>)target;
- (id<RAREiWidget>)removeWidgetWithNSString:(NSString *)name;
- (void)setHorizontalWithBoolean:(BOOL)horizontal;
- (void)setParentHorizontalWithRAREBeanWidget:(RAREBeanWidget *)widget
withBoolean:(BOOL)horizontal;
- (void)setSretchButtonsToFillSpaceWithBoolean:(BOOL)stretch;
- (void)setToolbarNameWithNSString:(NSString *)name;
- (id<RAREiPlatformComponent>)getComponent;
- (NSString *)getToolbarName;
- (BOOL)isHolder;
- (BOOL)isHorizontal;
- (void)setComponentSpacingWithInt:(int)spacing;
- (int)getComponentSpacingWithInt:(int)spacing;
- (void)addComponentExWithRAREiPlatformComponent:(id<RAREiPlatformComponent>)component;
- (void)configureExWithRARESPOTToolBar:(RARESPOTToolBar *)cfg;
- (void)copyAllFieldsTo:(RAREaToolBarViewer *)other;
@end
typedef RAREaToolBarViewer ComAppnativaRareViewerAToolBarViewer;
#endif // _RAREaToolBarViewer_H_
|
#ifndef ABSTRACTWEAPON_H
#define ABSTRACTWEAPON_H
/**
* @file abstractweapon.h
*/
#include "../abstractcomponent.h"
/**
* @brief The AbstractWeapon class. An abstract weapon. Lot to do here.
*/
class AbstractWeapon: public AbstractComponent
{
public:
/**
* @brief AbstractWeapon The constructor.
* @param name The name.
* @param description The description.
* @param ship The ship.
*/
AbstractWeapon(const std::string & name, const std::string & description, IShip *ship);
};
#endif // ABSTRACTWEAPON_H
|
/* This file is part of the 'neper' program. */
/* Copyright (C) 2003-2012, Romain Quey. */
/* See the COPYING file in the top-level directory. */
#include"nevs_data.h"
void
nevs_data (char** argv, int* pi, struct GEO Geo, struct NODES Nodes, struct MESH Mesh1D,
struct MESH Mesh, struct GEODATA* pGeoData, struct MESHDATA* pMeshData)
{
char* entity = ut_alloc_1d_char (100);
char* type = ut_alloc_1d_char (100);
nevs_data_string_entity_type (argv[(*pi)], entity, type);
if (strcmp (entity, "poly") == 0
|| strcmp (entity, "edge") == 0
|| strcmp (entity, "face") == 0
|| strcmp (entity, "ver" ) == 0)
nevs_geodata_fscanf (Geo, entity, type, argv[++(*pi)], pGeoData);
else if (
strncmp (entity, "elt" , 3) == 0
|| strncmp (entity, "node" , 4) == 0
|| strncmp (entity, "elset", 5) == 0)
nevs_meshdata_fscanf (Nodes, Mesh1D, Mesh, entity, type, argv[++(*pi)], pMeshData);
else
ut_print_message (1, 0, "Unknown entity = %s - skipping.\n", entity);
ut_free_1d_char (entity);
ut_free_1d_char (type);
return;
}
void
nevs_data_init (struct GEO Geo, struct GEODATA* pGeoData,
struct NODES Nodes, struct MESH Mesh3D,
struct MESHDATA* pMeshData)
{
if ((*pGeoData).polyqty > 0)
nevs_geodata_init (Geo, pGeoData);
if ((*pMeshData).elt3dqty > 0)
nevs_meshdata_init (Nodes, Mesh3D, pMeshData);
return;
}
|
/*
HashSHA512 - Generate SHA512 hashes
Copyright (C) 2016 @maldevel
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 <Windows.h>
#include <stdio.h>
#include <VersionHelpers.h>
#include "Hash.h"
int main(int argc, char **argv)
{
HCRYPTPROV hCryptProv = 0;
HCRYPTHASH hCryptHash = 0;
unsigned char hash[SHA512_LENGTH] = { 0 };
unsigned long hashLen = SHA512_LENGTH;
if (argc != 2)
{
printf("usage: HashSHA512.exe <string to hash>\n");
return EXIT_FAILURE;
}
if (!IsWindowsXPSP3OrGreater())//Win XP, Win XP SP1 and Win XP SP2 doesn't support SHA512
{
printf("Minimum supported OS, Windows XP SP3.\n");
return EXIT_FAILURE;
}
printf("\nText: %s\n", argv[1]);
if (!HashInit(&hCryptHash, &hCryptProv))
{
printf("Hash 512 generation failed\n");
return EXIT_FAILURE;
}
if (GenerateHash(hCryptHash, hash, hashLen, (unsigned char*)argv[1], (unsigned long)strlen(argv[1])))
{
printf("Hash SHA 512: ");
for (unsigned long i = 0; i < hashLen; i++) printf("%02X", hash[i]);
printf("\n");
}
HashUninit(hCryptHash, hCryptProv);
return EXIT_SUCCESS;
}
|
#include <stdio.h>
int main () {
char nome;
double salario_fixo, vendas_efetuadas, total_mes;
scanf("%s", & nome);
scanf("%lf", & salario_fixo);
scanf("%lf", & vendas_efetuadas);
total_mes = ((vendas_efetuadas * 0.15) + salario_fixo);
printf ("TOTAL = R$ %.2lf\n", total_mes);
return 0;
}
//Accepted
|
// Define of hardware design
#include "p18f4680.h"
#include "def.h"
#include "Can.h"
#define MCU PIC18F4680
#define OUTPUT_MAX_NB 0
//
#define SORTIE0 LATAbits.LATA0
#define SORTIE1 LATAbits.LATA1
#define SORTIE2 LATAbits.LATA2
#define SORTIE3 LATAbits.LATA3
/*#define SORTIE4 LATAbits.LATA4
#define SORTIE5 LATAbits.LATA5
#define SORTIE6 LATEbits.LATE0
#define SORTIE7 LATEbits.LATE1
#define SORTIE8 LATEbits.LATE2
#define SORTIE9 LATCbits.LATC0
#define SORTIE10 LATCbits.LATC1
#define SORTIE11 LATCbits.LATC2
#define SORTIE12 LATCbits.LATC3
#define SORTIE13 LATDbits.LATD0
#define SORTIE14 LATDbits.LATD1
#define SORTIE15 LATDbits.LATD2
*/
#define LED1 LATAbits.LATA2
#define LED2 LATAbits.LATA3
#define LED3 LATAbits.LATA4
#define LED4 LATAbits.LATA5
//#define LED7 LATDbits.LATD2
#define LED9 LATEbits.LATE2
#define CAN_EN LATBbits.LATB1
//#define CAN_FREQ CAN_FREQ_250kbps
#define CLOCK_FREQ CLOCK_FREQ_8MHz
//#define OWN_NODE_ID 0x75 /*between 0x01 and 0xFF, means up to 255 nodes)*/
#define OWN_CAN_ID 0x0075
#define CAN_ID_BROADCAST 0x0000 |
/***************************************************************************
**
** This file is part of Qt Creator
**
** Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
**
** Contact: Qt Software Information (qt-info@nokia.com)
**
**
** Non-Open Source Usage
**
** Licensees may use this file in accordance with the Qt Beta Version
** License Agreement, Agreement version 2.2 provided with the Software or,
** alternatively, in accordance with the terms contained in a written
** agreement between you and Nokia.
**
** GNU General Public License Usage
**
** Alternatively, this file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the packaging
** of this file. Please review the following information to ensure GNU
** General Public Licensing requirements will be met:
**
** http://www.fsf.org/licensing/licenses/info/GPLv2.html and
** http://www.gnu.org/copyleft/gpl.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt GPL Exception
** version 1.3, included in the file GPL_EXCEPTION.txt in this package.
**
***************************************************************************/
#ifndef TABPOSITIONINDICATOR_H
#define TABPOSITIONINDICATOR_H
#include <QtGui/QWidget>
#define TABPOSITIONINDICATOR_WIDTH 2
namespace Core {
namespace Internal {
class TabPositionIndicator : public QWidget
{
Q_OBJECT
public:
TabPositionIndicator();
int indicatorWidth() { return TABPOSITIONINDICATOR_WIDTH; }
private:
void paintEvent(QPaintEvent *event);
};
} // namespace Internal
} // namespace Core
#endif // TABPOSITIONINDICATOR_H
|
/*
Editor: http://www.visualmicro.com
visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten
the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project
all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!).
note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again
Hardware: Generic ESP8266 Module, Platform=esp8266, Package=esp8266
*/
#if defined(_VMICRO_INTELLISENSE)
#ifndef _VSARDUINO_H_
#define _VSARDUINO_H_
#define __ESP8266_ESp8266__
#define __ESP8266_ESP8266__
#define _VMDEBUG 1
#define __ets__
#define ICACHE_FLASH
#define F_CPU 80000000L
#define LWIP_OPEN_SRC
#define ARDUINO 10802
#define ARDUINO_ESP8266_ESP01
#define ARDUINO_ARCH_ESP8266
#define ESP8266
#define __cplusplus 201103L
#undef __cplusplus
#define __cplusplus 201103L
#define __STDC__
#define __ARM__
#define __arm__
#define __inline__
#define __asm__(x)
#define __asm__
#define __extension__
#define __ATTR_PURE__
#define __ATTR_CONST__
#define __volatile__
#define __ASM
#define __INLINE
#define __attribute__(noinline)
//#define _STD_BEGIN
//#define EMIT
#define WARNING
#define _Lockit
#define __CLR_OR_THIS_CALL
#define C4005
//
//typedef int uint8_t;
//#define __ARMCC_VERSION 400678
//#define PROGMEM
//#define string_literal
//
//#define prog_void
//#define PGM_VOID_P int
//
typedef int _read;
typedef int _seek;
typedef int _write;
typedef int _close;
typedef int __cleanup;
//#define inline
#define __builtin_clz
#define __builtin_clzl
#define __builtin_clzll
#define __builtin_labs
#define __builtin_va_list
typedef int __gnuc_va_list;
#define __ATOMIC_ACQ_REL
#define __CHAR_BIT__
#define _EXFUN()
typedef unsigned char byte;
extern "C" void __cxa_pure_virtual() {;}
typedef long __INTPTR_TYPE__ ;
typedef long __UINTPTR_TYPE__ ;
typedef long __SIZE_TYPE__ ;
typedef long __PTRDIFF_TYPE__;
#include "new"
#include "Esp.h"
#include <arduino.h>
#include <common.h>
#include <pins_arduino.h>
#include "..\generic\Common.h"
#include "..\generic\pins_arduino.h"
#undef F
#define F(string_literal) ((const PROGMEM char *)(string_literal))
#undef PSTR
#define PSTR(string_literal) ((const PROGMEM char *)(string_literal))
//current vc++ does not understand this syntax so use older arduino example for intellisense
//todo:move to the new clang/gcc project types.
#define interrupts() sei()
#define noInterrupts() cli()
#include "GNSS2WEB.ino"
#endif
#endif
|
#include "gui-menu.h"
void jld_gui_menu_init(jld_gui_menu_t* menu)
{
menu->accel_group = gtk_accel_group_new();
menu->menu_bar = gtk_menu_bar_new();
GtkWidget* file_menu = gtk_menu_new();
GtkWidget* file = gtk_menu_item_new_with_mnemonic("_File");
menu->new_entry = gtk_menu_item_new_with_mnemonic("_New Entry");
menu->delete_entry = gtk_menu_item_new_with_mnemonic("_Delete Entry");
menu->rename_entry = gtk_menu_item_new_with_mnemonic("_Rename Entry");
menu->today = gtk_menu_item_new_with_mnemonic("_Today");
menu->save = gtk_menu_item_new_with_mnemonic("_Save");
menu->quit = gtk_menu_item_new_with_mnemonic("_Quit");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(file), file_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu->new_entry);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu->delete_entry);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu->rename_entry);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu->today);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu->save);
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(file_menu), menu->quit);
GtkWidget* edit_menu = gtk_menu_new();
GtkWidget* edit = gtk_menu_item_new_with_mnemonic("_Edit");
menu->undo = gtk_menu_item_new_with_mnemonic("_Undo");
menu->redo = gtk_menu_item_new_with_mnemonic("_Redo");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(edit), edit_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), menu->undo);
gtk_menu_shell_append(GTK_MENU_SHELL(edit_menu), menu->redo);
GtkWidget* format_menu = gtk_menu_new();
GtkWidget* format = gtk_menu_item_new_with_mnemonic("Format");
menu->bold = gtk_menu_item_new_with_mnemonic("_Bold");
menu->italic = gtk_menu_item_new_with_mnemonic("_Italic");
menu->strike = gtk_menu_item_new_with_mnemonic("_Strike");
menu->header1 = gtk_menu_item_new_with_mnemonic("Header _1");
menu->header2 = gtk_menu_item_new_with_mnemonic("Header _2");
menu->header3 = gtk_menu_item_new_with_mnemonic("Header _3");
menu->show_markup_cursor = gtk_check_menu_item_new_with_label("Show Markup Under Cursor");
menu->show_markup = gtk_check_menu_item_new_with_label("Show Markup");
gtk_menu_item_set_submenu(GTK_MENU_ITEM(format), format_menu);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->bold);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->italic);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->strike);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->header1);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->header2);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->header3);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), gtk_separator_menu_item_new());
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->show_markup_cursor);
gtk_menu_shell_append(GTK_MENU_SHELL(format_menu), menu->show_markup);
gtk_menu_shell_append(GTK_MENU_SHELL(menu->menu_bar), file);
gtk_menu_shell_append(GTK_MENU_SHELL(menu->menu_bar), edit);
gtk_menu_shell_append(GTK_MENU_SHELL(menu->menu_bar), format);
}
|
/** AceUnit test header file for fixture readTest.
*
* You may wonder why this is a header file and yet generates program elements.
* This allows you to declare test methods as static.
*
* @warning This is a generated file. Do not edit. Your changes will be lost.
* @file readTest.h
*/
#ifndef _READTEST_H
/** Include shield to protect this header file from being included more than once. */
#define _READTEST_H
/** The id of this fixture. */
#define A_FIXTURE_ID 2
#include "AceUnit.h"
/* The prototypes are here to be able to include this header file at the beginning of the test file instead of at the end. */
A_Test void testReadError(void);
A_Test void testReadSmall(void);
A_Test void testReadMedium(void);
A_Test void testReadLarge(void);
A_Before void testReadSetup(void);
A_After void testReadCleanup(void);
/** The test case ids of this fixture. */
static const TestCaseId_t testIds[] = {
3, /* testReadError */
4, /* testReadSmall */
5, /* testReadMedium */
6, /* testReadLarge */
};
#ifndef ACEUNIT_EMBEDDED
/** The test names of this fixture. */
static const char *const testNames[] = {
"testReadError",
"testReadSmall",
"testReadMedium",
"testReadLarge",
};
#endif
#ifdef ACEUNIT_LOOP
/** The loops of this fixture. */
static const aceunit_loop_t loops[] = {
1,
1,
1,
1,
};
#endif
#ifdef ACEUNIT_GROUP
/** The groups of this fixture. */
static const AceGroupId_t groups[] = {
0,
0,
0,
0,
};
#endif
/** The test cases of this fixture. */
static const testMethod_t testCases[] = {
testReadError,
testReadSmall,
testReadMedium,
testReadLarge,
NULL
};
/** The before methods of this fixture. */
static const testMethod_t before[] = {
testReadSetup,
NULL
};
/** The after methods of this fixture. */
static const testMethod_t after[] = {
testReadCleanup,
NULL
};
/** The beforeClass methods of this fixture. */
static const testMethod_t beforeClass[] = {
NULL
};
/** The afterClass methods of this fixture. */
static const testMethod_t afterClass[] = {
NULL
};
/** This fixture. */
#if defined __cplusplus
extern
#endif
const TestFixture_t readTestFixture = {
2,
#ifndef ACEUNIT_EMBEDDED
"readTest",
#endif
#ifdef ACEUNIT_SUITES
NULL,
#endif
testIds,
#ifndef ACEUNIT_EMBEDDED
testNames,
#endif
#ifdef ACEUNIT_LOOP
loops,
#endif
#ifdef ACEUNIT_GROUP
groups,
#endif
testCases,
before,
after,
beforeClass,
afterClass
};
#endif /* _READTEST_H */
|
//control.c
//placeholder file
#include <stdio.h>
int main(void)
{
printf("\nplaceholder for sloadhost-aduc8051\n");
return(1);
}
|
/************************************************************************/
/* rop-tool - A Return Oriented Programming and binary exploitation */
/* tool */
/* */
/* Copyright 2013-2015, -TOSH- */
/* File coded by -TOSH- */
/* */
/* This file is part of rop-tool. */
/* */
/* rop-tool is free software: you can redistribute it and/or modif */
/* 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. */
/* */
/* rop-tool 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 rop-tool. If not, see <http://www.gnu.org/licenses/> */
/************************************************************************/
#include "api/disassemble.h"
/* Init the disassembler */
int r_disa_init(r_disa_s *dis, r_binfmt_arch_e arch) {
int cs_mode;
int cs_arch;
assert(dis != NULL);
memset(dis, 0, sizeof(*dis));
if(arch == R_BINFMT_ARCH_X86_64) {
cs_mode = CS_MODE_64;
cs_arch = CS_ARCH_X86;
} else if(arch == R_BINFMT_ARCH_X86) {
cs_mode = CS_MODE_32;
cs_arch = CS_ARCH_X86;
}else if(arch == R_BINFMT_ARCH_ARM) {
cs_mode = CS_MODE_ARM;
cs_arch = CS_ARCH_ARM;
} else if(arch == R_BINFMT_ARCH_ARM64) {
cs_mode = CS_MODE_ARM;
cs_arch = CS_ARCH_ARM64;
} else {
return 0;
}
if(cs_open(cs_arch, cs_mode, &dis->handle) != CS_ERR_OK)
return 0;
dis->arch = arch;
dis->flavor = R_DISA_FLAVOR_INTEL;
return 1;
}
int r_disa_set_flavor(r_disa_s *dis, r_disa_flavor_e flavor) {
assert(dis != NULL);
dis->flavor = flavor;
if(flavor == R_DISA_FLAVOR_INTEL)
return cs_option(dis->handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_INTEL) == CS_ERR_OK;
if(flavor == R_DISA_FLAVOR_ATT)
return cs_option(dis->handle, CS_OPT_SYNTAX, CS_OPT_SYNTAX_ATT) == CS_ERR_OK;
return 0;
}
/* Free the instruction list */
void r_disa_free_instr_lst(r_disa_s *dis) {
assert(dis != NULL);
if(dis->instr_lst.count > 0) {
cs_free(dis->instr_lst.head, dis->instr_lst.count);
dis->instr_lst.count = 0;
dis->instr_lst.head = NULL;
dis->instr_lst.cur = 0;
}
}
/* Close the disassembler */
void r_disa_close(r_disa_s *dis) {
assert(dis != NULL);
cs_close(&dis->handle);
r_disa_free_instr_lst(dis);
}
/* Disassemble code */
size_t r_disa_code(r_disa_s *dis, byte_t *code, len_t len, addr_t addr, size_t count) {
assert(dis != NULL);
assert(code != NULL);
r_disa_free_instr_lst(dis);
dis->instr_lst.count = cs_disasm(dis->handle, code, len, addr, count, &dis->instr_lst.head);
return dis->instr_lst.count;
}
r_disa_instr_t* r_disa_next_instr(r_disa_s *dis) {
r_disa_instr_t *instr;
assert(dis != NULL);
if(dis->instr_lst.cur >= dis->instr_lst.count)
return NULL;
instr = &dis->instr_lst.head[dis->instr_lst.cur];
dis->instr_lst.cur++;
return instr;
}
/* Check if last instruction is a CALL */
int r_disa_end_is_call(r_disa_s *dis) {
size_t end;
assert(dis != NULL);
if(dis->instr_lst.count == 0)
return 0;
end = dis->instr_lst.count-1;
return (!strncmp(dis->instr_lst.head[end].mnemonic, "call", 4));
}
/* Check if last instruction is a JMP */
int r_disa_end_is_jmp(r_disa_s *dis) {
size_t end;
assert(dis != NULL);
if(dis->instr_lst.count == 0)
return 0;
end = dis->instr_lst.count-1;
return (!strncmp(dis->instr_lst.head[end].mnemonic, "jmp", 3));
}
/* Check if last instruction is a syscall */
int r_disa_end_is_syscall(r_disa_s *dis) {
size_t end;
assert(dis != NULL);
if(dis->instr_lst.count == 0)
return 0;
end = dis->instr_lst.count-1;
if(!strncmp(dis->instr_lst.head[end].mnemonic, "int", 3) && !strncmp(dis->instr_lst.head[end].op_str, "0x80", 4))
return 1;
if(!strncmp(dis->instr_lst.head[end].mnemonic, "syscall", 7))
return 1;
return 0;
}
/* Check if last instruction is a RET */
int r_disa_end_is_ret(r_disa_s *dis) {
size_t end;
assert(dis != NULL);
if(dis->instr_lst.count == 0)
return 0;
end = dis->instr_lst.count-1;
return (!strncmp(dis->instr_lst.head[end].mnemonic, "ret", 3));
}
/* Transform the instr list to string : [INSTR1; [INSTR2];...]
The string is allocated with malloc, she must be freed by the caller
*/
char* r_disa_instr_lst_to_str(r_disa_s *dis) {
char *string;
size_t i;
size_t size;
assert(dis != NULL);
size = 0;
for(i = 0; i < dis->instr_lst.count; i++) {
size += strlen(dis->instr_lst.head[i].mnemonic);
size += strlen(dis->instr_lst.head[i].op_str);
size += 3;
}
size++;
string = r_utils_malloc(size);
*string = '\0';
for(i = 0; i < dis->instr_lst.count; i++) {
strcat(string, dis->instr_lst.head[i].mnemonic);
strcat(string, " ");
strcat(string, dis->instr_lst.head[i].op_str);
strcat(string, "; ");
}
return string;
}
/* Get the flavor corresponding to a string */
r_disa_flavor_e r_disa_string_to_flavor(const char *string) {
if(!strcmp(string, "intel"))
return R_DISA_FLAVOR_INTEL;
if(!strcmp(string, "att"))
return R_DISA_FLAVOR_ATT;
return R_DISA_FLAVOR_UNDEF;
}
|
/*
drv_timer.h : timer support for STM32F103CB
Adapted from https://github.com/multiwii/baseflight/blob/master/src/drv_timer.h
This file is part of BreezySTM32.
BreezySTM32 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.
BreezySTM32 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 BreezySTM32. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
typedef void timerCCCallbackPtr(uint8_t port, uint16_t capture);
typedef struct {
TIM_TypeDef *tim;
GPIO_TypeDef *gpio;
uint32_t pin;
uint8_t channel;
uint8_t irq;
uint8_t outputEnable;
} timerHardware_t;
extern const timerHardware_t timerHardware[];
void configTimeBase(TIM_TypeDef *tim, uint16_t period, uint8_t mhz);
void timerConfigure(const timerHardware_t *timerHardwarePtr, uint16_t period, uint8_t mhz);
void timerNVICConfigure(uint8_t irq);
void configureTimerInputCaptureCompareChannel(TIM_TypeDef *tim, const uint8_t channel);
void configureTimerCaptureCompareInterrupt(const timerHardware_t *timerHardwarePtr, uint8_t reference, timerCCCallbackPtr *callback);
void configureTimerChannelCallback(TIM_TypeDef *tim, uint8_t channel, uint8_t reference, timerCCCallbackPtr *callback);
|
/*--------------------------------------------------------------------
QCViewer
Copyright (C) 2011 Alex Parent and The University of Waterloo,
Institute for Quantum Computing, Quantum Circuits Group
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.
See also 'ADDITIONAL TERMS' at the end of the included LICENSE file.
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/>.
QCViewer is a trademark of the of the The University of Waterloo,
Institute for Quantum Computing, Quantum Circuits Group
Authors: Alex Parent, Jacob Parker, Marc Burns
---------------------------------------------------------------------*/
/*! \file circuit.h
\brief Defines the circuit class and some other related classes
*/
#ifndef CIRCUIT
#define CIRCUIT
#include "gate.h"
#include "types.h"
#include <vector>
#include <string>
#include <memory>
#include <map>
class Line
{
public:
Line (std::string);
std::string getInputLabel () const;
std::string getOutputLabel() const;
std::string lineName;
std::string outLabel;
bool constant;
bool garbage;
int initValue;
};
/*!
\brief Defines a circuit
*/
class Circuit
{
public:
Circuit ();
~Circuit ();
int QCost();
/*!
\brief Append a new line to circuit.
\param line Name of the line
*/
void addLine(std::string line);
/*!
\brief Returns a const Line for reading
\param pos Line number to get
Use this function if you do not wish to
modify the line so that const correctness
can be maintained
*/
const Line& getLine(int pos) const;
/*!
\brief Returns a referance to Line for modification
\param pos Line number to get
Use this if you wish to get a line and want to modify
it
*/
Line& getLineModify(int pos);
//! Returns the circuit name
std::string getName();
//! Sets the circuit name
void setName(std::string);
//! Expands all subcircuits
void expandAll();
unsigned int numLines() const;
/*! @name Gates
Functions that have to do with manipulating gates.
*/
///@{
//! Appends gate to the end of the circuit
void addGate(std::shared_ptr<Gate> newGate);
//! Inserts gate at pos
void addGate(std::shared_ptr<Gate> newGate, unsigned int pos);
/*!
\brief Sets gate at pos
\param newGate gate to set
\param pos postion of gate to be replaced
Use this to replace a gate in the the circuit.
Note: You may want to delete the old gate if it is no longer in use
*/
void setGate(std::shared_ptr<Gate> newGate, unsigned int pos);
//! removes gate at pos
void removeGate (unsigned int pos);
//! Swaps gates at a and b
void swapGate (unsigned int a, unsigned int b);
//! returns gate at pos
std::shared_ptr<Gate> getGate(int pos) const;
//! Returns the number of gates counting subcircuits as 1 gate
unsigned int numGates() const;
///@}
/*! @name Statistics
These functions are used to retrive circuit statistics
*/
///@{
//! Returns the total number of gates in the circuit counting all gates in subcircuits
unsigned int totalGates() const;
//! Returns the total number of gates with some name
unsigned int gateCount(std::string gateName);
//! Returns the Circuit Depth
unsigned int depth();
///@}
//! Returns a std::vector of ints specifying the last gate in each parallel block.
std::vector<int> getParallel() const;
//! Mapping of names to circuits storing subcircuits that might appear in this circuit
std::map<std::string,std::shared_ptr<Circuit>> subcircuits;
private:
std::string name;
std::vector <std::shared_ptr<Gate>> gates;
std::vector <Line> lines;
std::vector <unsigned int> breakpoints;
bool allExpanded;
};
#endif
|
/************************************************************************
* fspy - experimental POC linux filesystem activity monitor *
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *
* it's based on the new linux kernel inotify interface (merged into *
* the 2.6.13 linux kernel) *
* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ *
* this code was tested on 2.6.18.4 and newer kernels *
************************************************************************
* Copyright (C) 2007 Richard Sammet (e-axe) *
* *
* 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. *
* *
* http://www.gnu.org/licenses/gpl.txt *
************************************************************************
* Contact, Bugs & Infos: *
* richard.sammet@gmail.com *
************************************************************************
* Some infos: *
* - tabstop size: *
* set ts=2 *
************************************************************************/
#include <ctype.h>
#include "fspy.h"
#include "isnumber.h"
int isnumber(char *nbrstr) {
int i = 0;
while(nbrstr[i] != '\0') {
if(!isdigit(nbrstr[i]))
return FALSE;
i++;
}
return TRUE;
}
|
#define HAVE_GSL
#define HAVE_PNG
#define HAVE_LIBMATHEVAL
#define UT_VERSION_MAJOR 1
#define UT_VERSION_MINOR 0
#define UT_VERSION_PATCH 0
|
/*
* Copyright (C) 2009 Daniel Prevost <dprevost@photonsoftware.org>
*
* This file is part of Photon (photonsoftware.org).
*
* This file may be distributed and/or modified under the terms of the
* GNU General Public License version 2 or version 3 as published by the
* Free Software Foundation and appearing in the file COPYING.GPL2 and
* COPYING.GPL3 included in the packaging of this software.
*
* Licensees holding a valid Photon Commercial license can use this file
* in accordance with the terms of their license.
*
* This software 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.
*/
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
#include "folderTest.h"
#include <photon/psoCommon.h>
const bool expectedToPass = false;
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
int main()
{
#if defined(USE_DBC)
psonFolder * pTopFolder;
psonSessionContext context;
bool ok;
psoObjectDefinition def = { PSO_HASH_MAP, 0, 0, 0 };
psonKeyDefinition keyDef;
psonDataDefinition fieldDef;
psonKeyDefinition * retKeyDef = NULL;
psonDataDefinition * retDataDef = NULL;
pTopFolder = initTopFolderTest( expectedToPass, &context );
ok = psonTopFolderCreateObject( pTopFolder,
"Test1",
strlen("Test1"),
&def,
&fieldDef,
&keyDef,
&context );
if ( ok != true ) {
ERROR_EXIT( expectedToPass, &context.errorHandler, ; );
}
ok = psonTopFolderGetDef( pTopFolder,
"Test1",
strlen("Test1"),
NULL,
&retDataDef,
&retKeyDef,
&context );
ERROR_EXIT( expectedToPass, NULL, ; );
#else
return 1;
#endif
}
/* --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- */
|
/****
*
* TÍTULO: FUNÇÃO RETORNA CAMINHO DO ARQUIVO/TABELA
* AUTOR: LEVY MARLON SOUZA SANTIAGO
*
* DATA DA CRIAÇÃO: 03/08/2017
* ÚLTIMA MODIFICAÇÃO: 04/08/2017
*
* DESCRIÇÃO: ESTA FUNÇÃO IRÁ RECEBER O NOME DE UMA TABELA E RETORNAR O CAMINHO DO ARQUIVO NO QUAL ELA SERÁ GUARDADA
*
* PARÂMETROS: - (char *): UM PONTEIRO A CHAR, QUE SERÁ O NOME DA TABELA QUE DESEJAMOS OBTER O CAMINHO CORRESPONDENTE
*
* VALOR DE RETORNO: - (char *): O CAMINHO DO ARQUIVO EM QUE A TABELA ESTÁ
* - (NULL): SE O NOME DA TABELA É NULO
*
****/
char * getCaminhoTabela(char *);
/****
*
* TÍTULO: FUNÇÃO SPLIT
* AUTOR: LEVY MARLON SOUZA SANTIAGO
*
* DATA DA CRIAÇÃO: 03/08/2017
* ÚLTIMA MODIFICAÇÃO: 04/08/2017
*
* DESCRIÇÃO: ESTA FUNÇÃO IRÁ RECEBER UMA STRING E DIVIDIR ELA EM DUAS A PARTIR DO CARACTERE '.' (PONTO)
*
* PARÂMETROS: - (int): O TAMANHO DO VETOR (STRING) QUE VAI SER DIVIDIDA
*
* VALOR DE RETORNO: - (char **): UM VETOR QUE GUARDA AS DUAS STRINGS DIVIDIDAS
* - (NULL): SE NÃO FOI POSSÍVEL FAZER A DIVISÃO (NESSE CASO CHAMAR A HELP)
*
****/
char ** split(int, char *);
/****
*
* TÍTULO: FUNÇÃO de conversão, inteiro para string.
*
* AUTOR: TULIO CAMPOS SILVA
*
* DATA DA CRIAÇÃO: 09/08/17
* ÚLTIMA MODIFICAÇÃO: 09/08/17
*
* DESCRIÇÃO: Esta função irá receber um inteiro e convertê-lo para string.
*
* PARÂMETROS: - (int): O número a ser convertido.
* - (char**): O ponteiro duplo ao vetor de char.
*
* VALOR DE RETORNO: - (void):
****/
void intToString(int, char **);
/****
*
* TÍTULO: FUNÇÃO DE CONCATENAÇÃO DE UM CHAR A UMA STRING
*
* AUTOR: ÍCARO MARADEI COSTA BORGES
*
* DATA DA CRIAÇÃO: 12/08/17
* ÚLTIMA MODIFICAÇÃO: 17/08/17
*
* DESCRIÇÃO: ESTA FUNÇÃO IRÁ RECEBER UMA STRING E UM CHAR, E CONCATENAR ESTE CHAR AO FINAL DA STRING
*
* PARÂMETROS: - (char* ): A STRING ORIGINAL QUE SERÁ ALTERADA
* - (char): O CHAR QUE SERÁ CONCATENADO AO FINAL DA STRING
*
* VALOR DE RETORNO: - (char*): A STRING CONCATENADA AO CHAR
****/
char* catChStr(char* sString, char cChar);
|
#ifndef __UIGROUPBOX_H__
#define __UIGROUPBOX_H__
#pragma once
namespace ui
{
class UILIB_API GroupBox : public VBox
{
DECLARE_DUICONTROL(GroupBox)
public:
GroupBox();
~GroupBox();
std::wstring GetClass() const;
LPVOID GetInterface(std::wstring pstrName);
void SetTextColor(DWORD dwTextColor);
DWORD GetTextColor() const;
void SetDisabledTextColor(DWORD dwTextColor);
DWORD GetDisabledTextColor() const;
void SetFont(int index);
int GetFont() const;
protected:
//Paint
virtual void PaintText(HDC hDC);
virtual void PaintBorder(HDC hDC);
virtual void SetAttribute(std::wstring pstrName, std::wstring pstrValue);
private:
SIZE CalcrectSize(SIZE szAvailable);
protected:
DWORD text_color_;
DWORD disabled_text_color_;
int font_;
UINT text_style_;
};
}
#endif // __UIGROUPBOX_H__ |
#ifndef ZNETINTERFACEINFO_H
#define ZNETINTERFACEINFO_H
#include <QObject>
#include <libzee.h>
#include <zutil.h>
#include <zsigarmodule.h>
class ZNetInterfaceInfo : public ZSigarModule
{
Q_OBJECT
public:
ZNetInterfaceInfo(QString ifname, sigar_t *s, QObject *parent=0);
public slots:
virtual void refresh();
private:
void init();
private:
quint64 _lastCollectTime;
quint64 _lastRxBits;
quint64 _lastTxBits;
const char *_ifname;
};
#endif // ZNETINTERFACEINFO_H
|
/*
GormTextFieldAttributesInspector.h
Copyright (C) 2001-2005 Free Software Foundation, Inc.
Author: Adam Fedor <fedor@gnu.org>
Laurent Julliard <laurent@julliard-online.org>
Date: Aug 2001
This file is part of GNUstep.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
*/
/*
July 2005 : Spilt inspector in separate classes.
Always use ok: revert: methods
Clean up
Author : Fabien Vallon <fabien@sonappart.net>
*/
#ifndef INCLUDED_GormTextFieldAttributesInspector_h
#define INCLUDED_GormTextFieldAttributesInspector_h
#include <InterfaceBuilder/InterfaceBuilder.h>
@class NSButton;
@class NSColorWell;
@class NSForm;
@class NSMatrix;
@interface GormTextFieldAttributesInspector: IBInspector
{
NSMatrix *alignMatrix;
NSColorWell *backgroundColor;
NSButton *drawsBackground;
NSColorWell *textColor;
NSMatrix *borderMatrix;
NSButton *editableSwitch;
NSButton *selectableSwitch;
NSButton *scrollableSwitch;
NSButton *singleLineMode;
NSForm *tagForm;
NSMatrix *sendActionMatrix;
}
@end
#endif
|
#ifndef RATIONAL
#define RATIONAL
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
class Rational
{
public:
Rational();
Rational(int, int);
const Rational& operator=(const Rational&);
~Rational();
void setNumerator(int);
void setDenumerator(int);
int getNumerator() const;
int getDenumerator() const;
const Rational& add(const Rational&);
const Rational& substract(const Rational&);
const Rational& multiply(const Rational&);
const Rational& divide(const Rational&);
Rational operator+(const Rational&);
Rational operator-(const Rational&);
Rational operator*(const Rational&);
Rational operator/(const Rational&);
friend ostream& operator<< (ostream&, const Rational&);
friend istream& operator>> (istream&, Rational&);
private:
int num, denum;
void simplify();
};
#endif |
#include<common.h>
#include<stdio.h>
#define IDENTITY(i, j) ((i == j) ? 1 : 0)
#define UPTRIANGLE(i, j) ((i <= j) ? 1 : 0)
#define DOWNTRIANGLE(i, j) ((i >= j) ? 1 : 0)
#define min(X, Y) (X < Y) ? (X) : (Y)
int main(int argc, char * argv[]){
matrix_t A=matones(3,1);
matrix_t B=matgetcol(A,0);
matmultscalar(B,3);
matsetcol(A,B,0);
matprint(A);
int i,j;
printf("IDENTITY:\n");
for(i=0; i<5; i++){
for(j=0; j<5; j++)
printf("%d\t", IDENTITY(i, j));
printf("\n");
}
printf("UPTRIANGLE:\n");
for(i=0; i<5; i++){
for(j=0; j<5; j++)
printf("%d\t", UPTRIANGLE(i, j));
printf("\n");
}
printf("DOWNTRIANGLE:\n");
for(i=0; i<5; i++){
for(j=0; j<5; j++)
printf("%d\t", DOWNTRIANGLE(i, j));
printf("\n");
}
matfree(&B);
matfree(&A);
return 0;
}
|
// -*- c++ -*-
// Copyright 2008 Isis Innovation Limited
//
// System.h
//
// Defines the System class
//
// This stores the main functional classes of the system, like the
// mapmaker, map, tracker etc, and spawns the working threads.
//
#ifndef __SYSTEM_H
#define __SYSTEM_H
#include "VideoSource_Linux.h"
#include "GLWindow2.h"
#include <cvd/image.h>
#include <cvd/rgb.h>
#include <cvd/byte.h>
#include <boost/thread.hpp>
class ATANCamera;
class Map;
class MapMaker;
class Tracker;
class ARDriver;
class MapViewer;
class System
{
public:
System(bool automate_start = false);
void GetCurrentPose(double *pose) const;
int GetCurrentKeyframes(void) const;
int GetCurrentPoints(void) const;
int GetDiscardedPoints(void) const;
void Run();
void Stop();
bool setARModel(const std::string model_file);
void resetMap(void);
bool isAlive(void) const;
private:
bool b_done;
bool b_is_alive;
bool b_automated_track_start;
// Handle GUI
bool b_draw_gui;
VideoSource mVideoSource;
GLWindow2 mGLWindow;
CVD::Image<CVD::Rgb<CVD::byte> > mimFrameRGB;
CVD::Image<CVD::byte> mimFrameBW;
boost::thread *sys_thread;
// SLAM part
Map *mpMap;
MapMaker *mpMapMaker;
Tracker *mpTracker;
ATANCamera *mpCamera;
MapViewer *mpMapViewer;
// AR part
ARDriver *mpARDriver;
bool ARDriver_initialized;
std::string AR_assets_filename;
static void GUICommandCallBack(void* ptr, std::string sCommand, std::string sParams);
};
#endif
|
/**
* libcrippy-1.0 - architecture.c
* Copyright (C) 2013 Crippy-Dev Team
* Copyright (C) 2010-2013 Joshua Hill
*
* 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 "libcrippy-1.0/architecture.h"
|
/*!
* \file GPS_L2C.h
* \brief Defines system parameters for GPS L2C signal
* \author Javier Arribas, 2015. jarribas(at)cttc.es
*
* -------------------------------------------------------------------------
*
* Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
*
* GNSS-SDR is a software defined Global Navigation
* Satellite Systems receiver
*
* This file is part of GNSS-SDR.
*
* GNSS-SDR 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.
*
* GNSS-SDR 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 GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
*
* -------------------------------------------------------------------------
*/
#ifndef GNSS_SDR_GPS_L2C_H_
#define GNSS_SDR_GPS_L2C_H_
#include <cstdint>
#include <vector>
#include <utility> // std::pair
#include "MATH_CONSTANTS.h"
#include "gnss_frequencies.h"
#include "GPS_CNAV.h"
#define GPS_L2M_CN0_ESTIMATION_SAMPLES 10
#define GPS_L2M_MINIMUM_VALID_CN0 25
#define GPS_L2M_MAXIMUM_LOCK_FAIL_COUNTER 50
#define GPS_L2M_CARRIER_LOCK_THRESHOLD 0.75
// Physical constants
const double GPS_L2_C_m_s = 299792458.0; //!< The speed of light, [m/s]
const double GPS_L2_C_m_ms = 299792.4580; //!< The speed of light, [m/ms]
const double GPS_L2_PI = 3.1415926535898; //!< Pi as defined in IS-GPS-200E
const double GPS_L2_TWO_PI = 6.283185307179586; //!< 2Pi as defined in IS-GPS-200E
const double GPS_L2_OMEGA_EARTH_DOT = 7.2921151467e-5; //!< Earth rotation rate, [rad/s]
const double GPS_L2_GM = 3.986005e14; //!< Universal gravitational constant times the mass of the Earth, [m^3/s^2]
const double GPS_L2_F = -4.442807633e-10; //!< Constant, [s/(m)^(1/2)]
// carrier and code frequencies
const double GPS_L2_FREQ_HZ = FREQ2; //!< L2 [Hz]
const double GPS_L2_M_CODE_RATE_HZ = 0.5115e6; //!< GPS L2 M code rate [chips/s]
const int GPS_L2_M_CODE_LENGTH_CHIPS = 10230; //!< GPS L2 M code length [chips]
const double GPS_L2_M_PERIOD = 0.02; //!< GPS L2 M code period [seconds]
const double GPS_L2_L_CODE_RATE_HZ = 0.5115e6; //!< GPS L2 L code rate [chips/s]
const int GPS_L2_L_CODE_LENGTH_CHIPS = 767250; //!< GPS L2 L code length [chips]
const double GPS_L2_L_PERIOD = 1.5; //!< GPS L2 L code period [seconds]
const int GPS_L2C_HISTORY_DEEP = 5;
const int32_t GPS_L2C_M_INIT_REG[115] =
{0742417664, 0756014035,0002747144,0066265724, // 1:4
0601403471, 0703232733, 0124510070, 0617316361, // 5:8
0047541621, 0733031046, 0713512145, 0024437606,
0021264003, 0230655351, 0001314400, 0222021506,
0540264026, 0205521705, 0064022144, 0120161274,
0044023533, 0724744327, 0045743577, 0741201660,
0700274134, 0010247261, 0713433445, 0737324162,
0311627434, 0710452007, 0722462133, 0050172213,
0500653703, 0755077436, 0136717361, 0756675453,
0435506112, 0771353753, 0226107701, 0022025110,
0402466344, 0752566114, 0702011164, 0041216771,
0047457275, 0266333164, 0713167356, 0060546335,
0355173035, 0617201036, 0157465571, 0767360553,
0023127030, 0431343777, 0747317317, 0045706125,
0002744276, 0060036467, 0217744147, 0603340174,//57:60
0326616775, 0063240065, 0111460621, //61:63
0604055104, 0157065232, 0013305707, 0603552017,//159:162
0230461355, 0603653437, 0652346475, 0743107103,
0401521277, 0167335110, 0014013575, 0362051132,
0617753265, 0216363634, 0755561123, 0365304033,
0625025543, 0054420334, 0415473671, 0662364360,
0373446602, 0417564100, 0000526452, 0226631300,
0113752074, 0706134401, 0041352546, 0664630154,
0276524255, 0714720530, 0714051771, 0044526647,
0207164322, 0262120161, 0204244652, 0202133131,
0714351204, 0657127260, 0130567507, 0670517677,
0607275514, 0045413633, 0212645405, 0613700455,
0706202440, 0705056276, 0020373522, 0746013617,
0132720621, 0434015513, 0566721727, 0140633660};
const int GPS_L2_CNAV_DATA_PAGE_BITS = 300; //!< GPS L2 CNAV page length, including preamble and CRC [bits]
const int GPS_L2_SYMBOLS_PER_BIT = 2;
const int GPS_L2_SAMPLES_PER_SYMBOL = 1;
const int GPS_L2_CNAV_DATA_PAGE_SYMBOLS = 600;
const int GPS_L2_CNAV_DATA_PAGE_DURATION_S = 12;
#endif /* GNSS_SDR_GPS_L2C_H_ */
|
/*
* This file is part of assimp2ctm.
*
* assimp2ctm 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.
*
* assimp2ctm 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 assimp2ctm. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MESH_H
#define MESH_H
#include "common.h"
class LogStream : public Assimp::LogStream
{
public:
LogStream (void);
~LogStream (void);
void write (const char *msg);
const std::string &get (void);
void clear (void);
private:
std::string str;
};
class Mesh
{
public:
Mesh (void);
~Mesh (void);
bool Load (aiMesh *mesh);
void Sanitize (void);
std::vector<CTMuint> indices;
std::vector<CTMfloat> vertices;
std::vector<CTMfloat> normals;
std::vector<CTMfloat> texcoords;
std::vector<CTMfloat> tangents;
std::vector<CTMfloat> bitangents;
glm::vec3 min;
glm::vec3 max;
};
bool LoadMeshes (const char *filename);
#endif /* !defined MESH_H */
|
#ifndef CONFIG_H
#define CONFIG_H
// Comment out this line if your application has a QtGui
#define USE_QTGUI
#define PROGRAM_NAME "realsense_camera"
#define SERVER_FULL_NAME "RoboComp realsense_camera:: realsense_camera"
#endif
|
/*----------------------------------------------------------------------------
*
* Copyright (C) 2016 - 2020 Antonio Augusto Alves Junior
*
* This file is part of Hydra Data Analysis Framework.
*
* Hydra 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.
*
* Hydra 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 Hydra. If not, see <http://www.gnu.org/licenses/>.
*
*---------------------------------------------------------------------------*/
/*
* PlanesDeltaAngle.h
*
* Created on: 04/05/2018
* Author: Davide Brundu
.* Address: davide.brundu@cern.ch
.* GitHub: dbrundu
*/
#ifndef PLANESDELTAANGLE_H_
#define PLANESDELTAANGLE_H_
#include <hydra/detail/Config.h>
#include <hydra/detail/BackendPolicy.h>
#include <hydra/Types.h>
#include <hydra/Function.h>
#include <hydra/detail/utility/CheckValue.h>
#include <hydra/Tuple.h>
#include <tuple>
#include <limits>
#include <stdexcept>
#include <assert.h>
#include <utility>
#include <cmath>
namespace hydra {
/**
* \ingroup common_functions
* \class PlanesDeltaAngle
*
* This functor calculates the delta angle between decay plane of the particle with four-vector d2 and d3 (same plane)
* and h1 (other plane)
*/
class PlanesDeltaAngle:public BaseFunctor<PlanesDeltaAngle, double, 0>
{
public:
__hydra_host__ __hydra_device__
PlanesDeltaAngle(){}; //class_name ( const class_name & )
__hydra_host__ __hydra_device__
PlanesDeltaAngle( PlanesDeltaAngle const& other):
BaseFunctor<PlanesDeltaAngle,double, 0>(other)
{}
__hydra_host__ __hydra_device__ inline
PlanesDeltaAngle& operator=( PlanesDeltaAngle const& other){
if(this==&other) return *this;
BaseFunctor<PlanesDeltaAngle,double, 0>::operator=(other);
return *this;
}
__hydra_host__ __hydra_device__ inline
double Evaluate(unsigned int , hydra::Vector4R* p) const {
hydra::Vector4R d2 = p[0];
hydra::Vector4R d3 = p[1];
hydra::Vector4R h1 = p[2];
return chi_angle( d2, d3, h1);
}
template<typename T>
__hydra_host__ __hydra_device__ inline
double Evaluate(T p) const {
hydra::Vector4R d2 = get<0>(p);
hydra::Vector4R d3 = get<1>(p);
hydra::Vector4R h1 = get<2>(p);
return chi_angle( d2, d3, h1);
}
__hydra_host__ __hydra_device__ inline
double operator()(Vector4R const& d2, Vector4R const& d3, Vector4R const& h1, Vector4R const& h2) const {
return chi_angle( d2, d3, h1);
}
private:
__hydra_host__ __hydra_device__ inline
GReal_t chi_angle(Vector4R const& d2, Vector4R const& d3, Vector4R const& h1)const {
hydra::Vector4R D = d2 + d3;
hydra::Vector4R d1_perp = d2 - (D.dot(d2) / D.dot(D)) * D;
hydra::Vector4R h1_perp = h1 - (D.dot(h1) / D.dot(D)) * D;
// orthogonal to both D and d1_perp
hydra::Vector4R d1_prime = D.cross(d1_perp);
d1_perp = d1_perp / d1_perp.d3mag();
d1_prime = d1_prime / d1_prime.d3mag();
GReal_t x, y;
x = d1_perp.dot(h1_perp);
y = d1_prime.dot(h1_perp);
GReal_t chi = ::atan2(y, x);
return chi;
}
};
} // namespace hydra
#endif /* PLANESDELTAANGLE_H_ */
|
/**********************************************************************************
* Copyright © 2015 Pavel A. Puchkov *
* *
* This file is part of IqOrm. *
* *
* IqOrm 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. *
* *
* IqOrm 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 IqOrm. If not, see <http://www.gnu.org/licenses/>. *
**********************************************************************************/
#ifndef IQORMSQLMANYTOONEPROPERTYDESCRIPTIONPROCESSOR_H
#define IQORMSQLMANYTOONEPROPERTYDESCRIPTIONPROCESSOR_H
#include "iqormsqloneobjectdescrtibingpropertydescriptionprocessor.h"
#include "iqorm_global.h"
class IQORMSHARED_EXPORT IqOrmSqlManyToOnePropertyDescriptionProcessor : public IqOrmSqlOneObjectDescrtibingPropertyDescriptionProcessor
{
public:
explicit IqOrmSqlManyToOnePropertyDescriptionProcessor();
public:
const IqOrmBaseManyToOnePropertyDescription *propertyDescription() const;
virtual QString selectFieldName() const Q_DECL_OVERRIDE;
virtual QString insertFieldName() const Q_DECL_OVERRIDE;
virtual QString updateFieldName() const Q_DECL_OVERRIDE;
virtual QVariant insertValue() const Q_DECL_OVERRIDE;
virtual QVariant updateValue() const Q_DECL_OVERRIDE;
virtual QList<IqOrmSqlJoinOperation> selectJoinOperations() const Q_DECL_OVERRIDE;
virtual bool insertAllowed(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool updateAllowed(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool removeAllowed(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool preInsert(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool preUpdate(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool preRemove(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool postInsert(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool postUpdate(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
virtual bool postRemove(IqOrmDataSourceOperationResult *result) const Q_DECL_OVERRIDE;
private:
QString escapedJoinColumnName() const;
const IqOrmBaseOneToManyPropertyDescription *associatedPropertyDescription() const;
};
#endif // IQORMSQLMANYTOONEPROPERTYDESCRIPTIONPROCESSOR_H
|
//
// RVTestResultsRecorder.h
//
// Copyright 2011 Matthew Flint <m@tthew.org>
//
//
// This file is part of RVUISpec.
//
// RVUISpec 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.
//
// RVUISpec 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 RVUISpec. If not, see <http://www.gnu.org/licenses/>.
//
#import <Foundation/Foundation.h>
#import "UILog.h"
@class RVExample;
@interface RVTestResultsRecorder : NSObject <UILog> {
NSString *currentSpecName;
NSString *currentExampleName;
RVExample *currentExample;
int testsExecuted;
int testsPassed;
int testsFailed;
}
-(int)testsExecuted;
-(int)testsPassed;
-(int)testsFailed;
@end
|
/*
* Copyright (C) 1991, 1992 Linus Torvalds
* Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
* Copyright (C) 2009 Matt Fleming
* Copyright (C) 2002 - 2012 Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*/
#include <linux/kallsyms.h>
#include <linux/ftrace.h>
#include <linux/debug_locks.h>
#include <linux/kdebug.h>
#include <linux/export.h>
#include <linux/uaccess.h>
#include <asm/unwinder.h>
#include <asm/stacktrace.h>
void dump_mem(const char *str, unsigned long bottom, unsigned long top)
{
unsigned long p;
int i;
printk("%s(0x%08lx to 0x%08lx)\n", str, bottom, top);
for (p = bottom & ~31; p < top; )
{
printk("%04lx: ", p & 0xffff);
for (i = 0; i < 8; i++, p += 4)
{
unsigned int val;
if (p < bottom || p >= top)
{
printk(" ");
}
else
{
if (__get_user(val, (unsigned int __user *)p))
{
printk("\n");
return;
}
printk("%08x ", val);
}
}
printk("\n");
}
}
void printk_address(unsigned long address, int reliable)
{
printk(" [<%p>] %s%pS\n", (void *) address,
reliable ? "" : "? ", (void *) address);
}
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
static void
print_ftrace_graph_addr(unsigned long addr, void *data,
const struct stacktrace_ops *ops,
struct thread_info *tinfo, int *graph)
{
struct task_struct *task = tinfo->task;
unsigned long ret_addr;
int index = task->curr_ret_stack;
if (addr != (unsigned long)return_to_handler)
{
return;
}
if (!task->ret_stack || index < *graph)
{
return;
}
index -= *graph;
ret_addr = task->ret_stack[index].ret;
ops->address(data, ret_addr, 1);
(*graph)++;
}
#else
static inline void
print_ftrace_graph_addr(unsigned long addr, void *data,
const struct stacktrace_ops *ops,
struct thread_info *tinfo, int *graph)
{ }
#endif
void
stack_reader_dump(struct task_struct *task, struct pt_regs *regs,
unsigned long *sp, const struct stacktrace_ops *ops,
void *data)
{
struct thread_info *context;
int graph = 0;
context = (struct thread_info *)
((unsigned long)sp & (~(THREAD_SIZE - 1)));
while (!kstack_end(sp))
{
unsigned long addr = *sp++;
if (__kernel_text_address(addr))
{
ops->address(data, addr, 1);
print_ftrace_graph_addr(addr, data, ops,
context, &graph);
}
}
}
static int print_trace_stack(void *data, char *name)
{
printk("%s <%s> ", (char *)data, name);
return 0;
}
/*
* Print one address/symbol entries per line.
*/
static void print_trace_address(void *data, unsigned long addr, int reliable)
{
printk("%s", (char *)data);
printk_address(addr, reliable);
}
static const struct stacktrace_ops print_trace_ops =
{
.stack = print_trace_stack,
.address = print_trace_address,
};
void show_trace(struct task_struct *tsk, unsigned long *sp,
struct pt_regs *regs)
{
if (regs && user_mode(regs))
{
return;
}
printk("\nCall trace:\n");
unwind_stack(tsk, regs, sp, &print_trace_ops, "");
printk("\n");
if (!tsk)
{
tsk = current;
}
debug_show_held_locks(tsk);
}
void show_stack(struct task_struct *tsk, unsigned long *sp)
{
unsigned long stack;
if (!tsk)
{
tsk = current;
}
if (tsk == current)
{
sp = (unsigned long *)current_stack_pointer;
}
else
{
sp = (unsigned long *)tsk->thread.sp;
}
stack = (unsigned long)sp;
dump_mem("Stack: ", stack, THREAD_SIZE +
(unsigned long)task_stack_page(tsk));
show_trace(tsk, sp, NULL);
}
|
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. 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
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebUserMediaRequest_h
#define WebUserMediaRequest_h
#include "WebSecurityOrigin.h"
#include "platform/WebCommon.h"
#include "platform/WebPrivatePtr.h"
namespace WebCore {
class UserMediaRequest;
}
namespace WebKit {
class WebMediaStreamSource;
class WebString;
template <typename T> class WebVector;
class WebUserMediaRequest {
public:
WebUserMediaRequest() { }
WebUserMediaRequest(const WebUserMediaRequest& request) { assign(request); }
~WebUserMediaRequest() { reset(); }
WebUserMediaRequest& operator=(const WebUserMediaRequest& other)
{
assign(other);
return *this;
}
WEBKIT_EXPORT void reset();
bool isNull() const { return m_private.isNull(); }
WEBKIT_EXPORT bool equals(const WebUserMediaRequest&) const;
WEBKIT_EXPORT void assign(const WebUserMediaRequest&);
WEBKIT_EXPORT bool audio() const;
WEBKIT_EXPORT bool video() const;
WEBKIT_EXPORT WebSecurityOrigin securityOrigin() const;
WEBKIT_EXPORT void requestSucceeded(const WebVector<WebMediaStreamSource>& audioSources, const WebVector<WebMediaStreamSource>& videoSources);
WEBKIT_EXPORT void requestFailed();
#if WEBKIT_IMPLEMENTATION
WebUserMediaRequest(const PassRefPtr<WebCore::UserMediaRequest>&);
operator WebCore::UserMediaRequest*() const;
#endif
private:
WebPrivatePtr<WebCore::UserMediaRequest> m_private;
};
inline bool operator==(const WebUserMediaRequest& a, const WebUserMediaRequest& b)
{
return a.equals(b);
}
} // namespace WebKit
#endif // WebUserMediaRequest_h
|
#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include "avl.c"
int cmp(const void* key, const void* payload) {
return ((int) key) - (*(int*) payload);
}
_Bool ctor(const void* key, void* placement) {
*(int*) placement = (int) key;
return 1;
}
_Bool bad_ctor(const void* key, void* placement) {
(void) placement;
fprintf(stderr, "ctor should never be called for %p\n", key);
assert(0);
return 0;
}
_Bool failed_ctor(const void* key, void* placement) {
(void) key;
(void) placement;
return 0;
}
void counter(void* data, void* placement) {
(void) placement;
++*(int*) data;
}
void print_tree(const struct reinvented_avl* root, size_t indent) {
for (size_t i = 0; i < indent; ++i) {
putc(' ', stderr);
}
if (root) {
fprintf(
stderr,
"%zu %d %p %p %p\n",
root->height,
*(int*) root->payload,
root,
root->left,
root->right);
if (root->left || root->right) {
print_tree(root->left, indent + 2);
print_tree(root->right, indent + 2);
}
} else {
puts("0 (nil)");
}
}
size_t validate_tree_balance(const struct reinvented_avl* root) {
if (root) {
size_t left = validate_tree_balance(root->left);
size_t right = validate_tree_balance(root->right);
if (left > right + 1 || right > left + 1) {
fprintf(
stderr,
"Tree is not balanced: left is %zu, right is %zu\n",
left,
right);
print_tree(root, 0);
assert(0);
}
return (left < right ? right : left) + 1;
}
return 0;
}
#define insert(elem, ctor)\
reinvented_avl_insert(&t, elem, cmp, sizeof(int), ctor)
#define insert_flag(elem, ctor)\
reinvented_avl_insert_flag(&t, elem, cmp, sizeof(int), ctor, &inserted)
int main() {
struct reinvented_avl* t = 0;
void* minus1 = (void*) -1;
void* one = (void*) 1;
void* two = (void*) 2;
void* three = (void*) 3;
void* four = (void*) 4;
void* five = (void*) 5;
void* six = (void*) 6;
void* eight = (void*) 8;
void* nine = (void*) 9;
void* ten = (void*) 10;
void* eleven = (void*) 11;
void* twelve = (void*) 12;
void* p13 = (void*) 13;
void* p14 = (void*) 14;
void* p15 = (void*) 15;
void* p16 = (void*) 16;
void* p17 = (void*) 17;
void* p20 = (void*) 20;
void* p21 = (void*) 21;
void* p22 = (void*) 22;
assert(*(int*) insert(five, ctor) == 5);
assert(*(int*) insert(five, bad_ctor) == 5);
assert(*(int*) insert(three, ctor) == 3);
assert(*(int*) insert(four, ctor) == 4);
assert(validate_tree_balance(t) == 2);
assert(*(int*) reinvented_avl_find(t, five, cmp) == 5);
assert(reinvented_avl_find(t, six, cmp) == 0);
_Bool inserted = 0;
assert(*(int*) insert_flag(eight, ctor) == 8);
assert(inserted);
assert(*(int*) insert_flag(eight, bad_ctor) == 8);
assert(!inserted);
assert(*(int*) insert(six, ctor) == 6);
assert(validate_tree_balance(t) == 3);
assert(reinvented_avl_find(t, 0, cmp) == 0);
assert(*(int*) insert(one, ctor) == 1);
assert(*(int*) insert(two, ctor) == 2);
assert(validate_tree_balance(t) == 3);
assert(*(int*) insert(0, ctor) == 0);
assert(*(int*) insert(minus1, ctor) == -1);
assert(validate_tree_balance(t) == 4);
assert(*(int*) insert(nine, ctor) == 9);
assert(*(int*) insert(ten, ctor) == 10);
assert(validate_tree_balance(t) == 4);
assert(*(int*) insert(eleven, ctor) == 11);
assert(*(int*) insert(twelve, ctor) == 12);
assert(validate_tree_balance(t) == 4);
assert(*(int*) insert(p20, ctor) == 20);
assert(*(int*) insert(p21, ctor) == 21);
assert(*(int*) insert(p22, ctor) == 22);
assert(validate_tree_balance(t) == 5);
assert(*(int*) insert(p13, ctor) == 13);
assert(*(int*) insert(p14, ctor) == 14);
assert(*(int*) insert(p15, ctor) == 15);
assert(*(int*) insert(p16, ctor) == 16);
assert(*(int*) insert(p17, ctor) == 17);
inserted = 1;
assert(*(int*) insert_flag(p17, bad_ctor) == 17);
assert(!inserted);
assert(validate_tree_balance(t) == 5);
print_tree(t, 0);
int deletions = 0;
reinvented_avl_destroy(t, counter, &deletions);
assert(deletions == 21);
t = 0;
assert(*(int*) insert(five, ctor) == 5);
assert(*(int*) insert(two, ctor) == 2);
assert(*(int*) insert(six, ctor) == 6);
assert(*(int*) insert(one, ctor) == 1);
assert(*(int*) insert(three, ctor) == 3);
assert(*(int*) insert(four, ctor) == 4);
assert(validate_tree_balance(t) == 3);
deletions = 0;
reinvented_avl_destroy(t, counter, &deletions);
assert(deletions == 6);
t = 0;
assert(*(int*) insert(0, ctor) == 0);
assert(*(int*) insert(one, ctor) == 1);
assert(*(int*) insert(four, ctor) == 4);
assert(*(int*) insert(five, ctor) == 5);
assert(*(int*) insert(three, ctor) == 3);
assert(*(int*) insert(two, ctor) == 2);
assert(validate_tree_balance(t) == 3);
deletions = 0;
reinvented_avl_destroy(t, counter, &deletions);
assert(deletions == 6);
t = 0;
assert(insert(0, failed_ctor) == 0);
assert(t == 0);
size_t bad_size = SIZE_MAX - sizeof(struct reinvented_avl);
assert(reinvented_avl_insert(&t, one, cmp, bad_size, bad_ctor) == 0);
assert(t == 0);
}
|
//
// C++ Interface: HelpMessage
//
// Description:
//
//
// Author: Tiberiu Paunescu <tpa12@sfu.ca>, (C) 2010
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software Foundation,
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.//
//
#ifndef EMBEROGRE_HELPMESSAGE_H
#define EMBEROGRE_HELPMESSAGE_H
#include <string>
#include <vector>
namespace Ember {
namespace OgreView {
namespace Gui {
/**
@author Tiberiu Paunescu <tpa12@sfu.ca>
@brief Class that holds help messages.
Currently, it only holds plain text messages but future implementations will contain more information regarding the text.
*/
struct HelpMessage {
public:
/**
* @brief Constructor
*/
HelpMessage(std::string title, std::string message, const std::string& tags, std::string id = "");
/**
* @brief Iterates over the list of tags and returns a string containing all of them
* @return String containing all of the tags
*/
std::string getTags() const;
/**
* @brief Stores the title of the message.
*/
std::string mTitle;
/**
* @brief Stores the plain text message.
*/
std::string mMessage;
/**
* @brief Stores the various tags for the message.
*/
std::vector<std::string> mTags;
/**
* @brief Stores the optional id.
*/
std::string mId;
};
}
}
}
#endif
|
#include <linux/moduleloader.h>
#include <linux/elf.h>
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/kernel.h>
int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
unsigned int i;
Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
pr_debug("Applying relocate section %u to %u\n", relsec,
sechdrs[relsec].sh_info);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rela); i++)
{
/* This is where to make the change */
uint32_t *loc =
(uint32_t *)(sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rela[i].r_offset);
/* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
Elf32_Sym *sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rela[i].r_info);
uint32_t v = sym->st_value + rela[i].r_addend;
switch (ELF32_R_TYPE(rela[i].r_info))
{
case R_H8_DIR24R8:
loc = (uint32_t *)((uint32_t)loc - 1);
*loc = (*loc & 0xff000000) | ((*loc & 0xffffff) + v);
break;
case R_H8_DIR24A8:
if (ELF32_R_SYM(rela[i].r_info))
{
*loc += v;
}
break;
case R_H8_DIR32:
case R_H8_DIR32A16:
*loc += v;
break;
case R_H8_PCREL16:
v -= (unsigned long)loc + 2;
if ((Elf32_Sword)v > 0x7fff ||
(Elf32_Sword)v < -(Elf32_Sword)0x8000)
{
goto overflow;
}
else
{
*(unsigned short *)loc = v;
}
break;
case R_H8_PCREL8:
v -= (unsigned long)loc + 1;
if ((Elf32_Sword)v > 0x7f ||
(Elf32_Sword)v < -(Elf32_Sword)0x80)
{
goto overflow;
}
else
{
*(unsigned char *)loc = v;
}
break;
default:
pr_err("module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rela[i].r_info));
return -ENOEXEC;
}
}
return 0;
overflow:
pr_err("module %s: relocation offset overflow: %08x\n",
me->name, rela[i].r_offset);
return -ENOEXEC;
}
|
/*
-----------------------------------------------------------------------------------------------
This source file is part of the Particle Universe product.
Copyright (c) 2010 Henry van Merode
Usage of this program is licensed under the terms of the Particle Universe Commercial License.
You can find a copy of the Commercial License in the Particle Universe package.
-----------------------------------------------------------------------------------------------
*/
#ifndef __PU_ONEMISSION_OBSERVER_FACTORY_H__
#define __PU_ONEMISSION_OBSERVER_FACTORY_H__
#include "ParticleUniversePrerequisites.h"
#include "ParticleUniverseObserverFactory.h"
#include "ParticleUniverseOnEmissionObserver.h"
#include "ParticleUniverseOnEmissionObserverTokens.h"
namespace ParticleUniverse
{
/** Factory class responsible for creating the OnEmissionObserver.
*/
class _ParticleUniverseExport OnEmissionObserverFactory : public ParticleObserverFactory
{
public:
OnEmissionObserverFactory(void) {};
virtual ~OnEmissionObserverFactory(void) {};
/** See ParticleObserverFactory */
virtual String getObserverType(void) const
{
return "OnEmission";
}
/** See ParticleObserverFactory */
virtual ParticleObserver* createObserver(void)
{
return _createObserver<OnEmissionObserver>();
}
/* */
virtual void write(ParticleScriptSerializer* serializer, const IElement* element)
{
// Delegate
mOnEmissionObserverWriter.write(serializer, element);
}
protected:
OnEmissionObserverWriter mOnEmissionObserverWriter;
};
}
#endif
|
/******************************************************************************
*
* $Id: classlist.h,v 1.8 2001/03/19 19:27:39 root Exp $
*
* Copyright (C) 1997-2012 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
* granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
* Documents produced by Doxygen are derivative works derived from the
* input used in their production; they are not affected by this license.
*
*/
#ifndef CLASSLIST_H
#define CLASSLIST_H
#include <qlist.h>
#include <qdict.h>
#include "classdef.h"
#include "sortdict.h"
class Definition;
/** A list of ClassDef objects. */
class ClassList : public QList<ClassDef>
{
public:
ClassList();
~ClassList();
int compareItems(GCI item1,GCI item2);
};
/** An iterator for ClassDef objects in a ClassList. */
class ClassListIterator : public QListIterator<ClassDef>
{
public:
ClassListIterator(const ClassList &list);
};
/** An unsorted dictionary of ClassDef objects. */
class ClassDict : public QDict<ClassDef>
{
public:
ClassDict(int size) : QDict<ClassDef>(size) {}
~ClassDict() {}
};
/** A sorted dictionary of ClassDef objects. */
class ClassSDict : public SDict<ClassDef>
{
public:
ClassSDict(int size=17) : SDict<ClassDef>(size) {}
~ClassSDict() {}
int compareItems(GCI item1,GCI item2);
void writeDeclaration(OutputList &ol,const ClassDef::CompoundType *filter=0,
const char *header=0,bool localNames=FALSE);
void writeDocumentation(OutputList &ol,Definition *container=0);
bool declVisible(const ClassDef::CompoundType *filter=0) const;
};
#endif
|
#include "unpipc.h"
int
main(int argc, char **argv)
{
int fd;
fd = Open("test1.data", O_RDWR | O_CREAT, FILE_MODE);
Write_lock(fd, 0, SEEK_SET, 0); /* parent write locks entire file */
printf("%s: parent has write lock\n", Gf_time());
if (Fork() == 0) {
/* 4first child */
sleep(3);
printf("%s: first child tries to obtain write lock\n", Gf_time());
Writew_lock(fd, 0, SEEK_SET, 0); /* this should block */
printf("%s: first child obtains write lock\n", Gf_time());
sleep(2);
Un_lock(fd, 0, SEEK_SET, 0);
printf("%s: first child releases write lock\n", Gf_time());
exit(0);
}
if (Fork() == 0) {
/* 4second child */
sleep(1);
printf("%s: second child tries to obtain read lock\n", Gf_time());
Readw_lock(fd, 0, SEEK_SET, 0);
printf("%s: second child obtains read lock\n", Gf_time());
sleep(4);
Un_lock(fd, 0, SEEK_SET, 0);
printf("%s: second child releases read lock\n", Gf_time());
exit(0);
}
/* parent */
sleep(5);
Un_lock(fd, 0, SEEK_SET, 0);
printf("%s: parent releases write lock\n", Gf_time());
exit(0);
}
|
/* {{{
This file is part of DPGSolver.
DPGSolver is free software: you can redistribute it and/or modify it under the terms of the GNU
General Public License as published by the Free Software Foundation, either version 3 of the
License, or any later version.
DPGSolver 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 DPGSolver. If not, see
<http://www.gnu.org/licenses/>.
}}} */
/** \file
* \brief Provides the macro definitions used for c-style templating related to the solution functions for the
* euler equations (test case: supersonic vortex).
*/
#if TYPE_RC == TYPE_REAL
///\{ \name Function names
#define set_sol_supersonic_vortex_T set_sol_supersonic_vortex
#define constructor_const_sol_supersonic_vortex_T constructor_const_sol_supersonic_vortex
///\}
///\{ \name Static names
#define constructor_sol_supersonic_vortex constructor_sol_supersonic_vortex
#define Sol_Data__sv Sol_Data__sv
#define get_sol_data get_sol_data
#define read_data_supersonic_vortex read_data_supersonic_vortex
///\}
#elif TYPE_RC == TYPE_COMPLEX
///\{ \name Function names
#define set_sol_supersonic_vortex_T set_sol_supersonic_vortex_c
#define constructor_const_sol_supersonic_vortex_T constructor_const_sol_supersonic_vortex_c
///\}
///\{ \name Static names
#define constructor_sol_supersonic_vortex constructor_sol_supersonic_vortex_c
#define Sol_Data__sv Sol_Data__sv_c
#define get_sol_data get_sol_data_c
#define read_data_supersonic_vortex read_data_supersonic_vortex_c
///\}
#endif
|
/*
* Copyright (c) 2020, Sergey Bugaev <bugaevc@serenityos.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY 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.
*/
#pragma once
#include <AK/Vector.h>
#include <LibGUI/AbstractView.h>
namespace GUI {
class ColumnsView : public AbstractView {
C_OBJECT(ColumnsView)
public:
int model_column() const { return m_model_column; }
void set_model_column(int column) { m_model_column = column; }
virtual ModelIndex index_at_event_position(const Gfx::Point&) const override;
private:
ColumnsView();
virtual ~ColumnsView() override;
void push_column(ModelIndex& parent_index);
void update_column_sizes();
int item_height() const { return 16; }
int icon_size() const { return 16; }
int icon_spacing() const { return 2; }
int text_padding() const { return 2; }
virtual void did_update_model() override;
virtual void paint_event(PaintEvent&) override;
virtual void mousedown_event(MouseEvent& event) override;
virtual void keydown_event(KeyEvent& event) override;
virtual void select_all() override;
struct Column {
ModelIndex parent_index;
int width;
// TODO: per-column vertical scroll?
};
Vector<Column> m_columns;
int m_model_column { 0 };
};
}
|
/****************************************************************************
**
** Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Stephen Kelly <stephen.kelly@kdab.com>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:GPL-EXCEPT$
** 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.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QWidget>
class MainWindow : public QWidget
{
Q_OBJECT
public:
MainWindow(QWidget *parent = 0);
signals:
void somethingHappened();
};
#endif
|
/*
* Copyright (c) 2015 Clement Deschamps and Luc Michel
*
* This file is part of Rabbits.
*
* Rabbits 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.
*
* Rabbits 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 Rabbits. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _RPI_DMA_H
#define _RPI_DMA_H
#include <queue>
#include "components/rabbits/slave.h"
class rpi_dma: public Slave
{
private:
struct ctrl_blk
{
uint32_t ti;
uint32_t src_addr;
uint32_t dst_addr;
uint32_t trsf_len;
uint32_t stride;
uint32_t nextcb;
uint32_t reserved[2];
};
enum reg_offset_e
{
REG_CS = 0x0,
REG_CONBLK_AD = 0x4,
REG_TI = 0x8,
REG_SOURCE_AD = 0xc,
REG_DEST_AD = 0x10,
REG_TXFR_LEN = 0x14,
REG_STRIDE = 0x18,
REG_NEXTCONBK = 0x1c,
REG_DEBUG = 0x20
};
class dma_channel
{
protected:
uint32_t m_regs[8];
public:
uint32_t read_reg(int reg);
void write_reg(int reg, uint32_t v);
};
sc_event irq_update;
void bus_cb_read_32(uint64_t addr, uint32_t *data, bool &bErr);
void bus_cb_write_32(uint64_t addr, uint32_t *data, bool &bErr);
void irq_thread();
public:
SC_HAS_PROCESS (rpi_dma);
rpi_dma(sc_module_name modname);
virtual ~rpi_dma()
{
}
//sc_out<bool> irq_line;
};
#endif
|
/**
* \file
*
* Copyright (c) 2014-2015 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/*
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _SAM3S8_WDT_INSTANCE_
#define _SAM3S8_WDT_INSTANCE_
/* ========== Register definition for WDT peripheral ========== */
#if (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__))
#define REG_WDT_CR (0x400E1450U) /**< \brief (WDT) Control Register */
#define REG_WDT_MR (0x400E1454U) /**< \brief (WDT) Mode Register */
#define REG_WDT_SR (0x400E1458U) /**< \brief (WDT) Status Register */
#else
#define REG_WDT_CR (*(WoReg*)0x400E1450U) /**< \brief (WDT) Control Register */
#define REG_WDT_MR (*(RwReg*)0x400E1454U) /**< \brief (WDT) Mode Register */
#define REG_WDT_SR (*(RoReg*)0x400E1458U) /**< \brief (WDT) Status Register */
#endif /* (defined(__ASSEMBLY__) || defined(__IAR_SYSTEMS_ASM__)) */
#endif /* _SAM3S8_WDT_INSTANCE_ */
|
/****************************************************************************
# Copyright (C) 2008 Robolab-UEx #
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #
# #
****************************************************************************/
#ifndef ROBEXHANDLER_H
#define ROBEXHANDLER_H
#include "handler.h"
#include <q4serialport/q4serialport.h>
#include <qlog/qlog.h>
// Timeouts
#define COMMAND_RESPONSE_TIMEOUT 100
#define COMMAND_FREE_MOTORS_CHECK_INTERVAL 3000
#define COMMAND_FREE_MOTORS_TIMEOUT 5000
// Set Base Speed commands: adv (mm/s) rot(rads/seg) C0:SAaasBbb:0*
#define MOTION_BASE_COMMAND_STRING "C0:"
#define MOTION_BASE_COMMAND_CRC "0*"
// Set Right Wheel Speed: Motor motion commands
#define MOTION_RIGHT_COMMAND_STRING "A1:"
#define MOTION_RIGHT_COMMAND_CRC "1*"
// Set Left Wheel Speed: Motor motion commands
#define MOTION_LEFT_COMMAND_STRING "B1:"
#define MOTION_LEFT_COMMAND_CRC "1*"
// Set Both Wheels Speed: Motor motion commands C1:SAaasBbb:1*
#define MOTION_COMMAND_STRING "C1:"
#define MOTION_COMMAND_CRC "1*"
// Set motors state command
#define MOTION_MOTORS_STATE_COMMAND_STRING "C9:"
#define MOTION_MOTORS_STATE_COMMAND_CRC "9*"
// Motors States
#define MOTORS_STATE_NORMAL 0
#define MOTORS_STATE_FREE 1
#define MOTORS_STATE_BREAK 2
// Get Base data command: Reductora, Radio, Separación entre ruedas
#define BASEDATA_GET_COMMAND_STRING "D0:"
#define BASEDATA_GET_COMMAND_CRC "0*"
#define BASEDATA_DATA_SIZE 3+2+1+2+1+3+2
#define BASEDATA_GETGEAR_DATASIZE 2
#define BASEDATA_GETRADIO_DATASIZE 2
#define BASEDATA_GETBASELINE_DATASIZE 3
// Odometer commands
#define ODOMETER_RESET_STRING "D1:"
#define ODOMETER_RESET_CRC "1*"
#define ODOMETER_GETPOSWHEELS_STRING "D2:"
#define ODOMETER_GETPOSWHEELS_CRC "2*"
// 3 bytes per parameter
#define ODOMETER_GETPOSWHEELS_DATA_SIZE 3
#define ODOMETER_GETSPEEDWHEELS_STRING "D3:"
#define ODOMETER_GETSPEEDWHEELS_CRC "1*"
#define ODOMETER_GETSPEEDWHEELS_DATA_SIZE 3
#define ODOMETER_GETPOSBASE_STRING "E1:"
#define ODOMETER_GETPOSBASE_CRC "1*"
#define ODOMETER_GETPOSBASE_DATA_SIZE 10
// Odometer commands Version binario
#define ODOMETER_GETPOSWHEELS_B_STRING "D4:"
#define ODOMETER_GETPOSWHEELS_B_CRC "4*"
#define ODOMETER_GETPOSWHEELS_B_DATA_SIZE 4
//Encoder steps per turn HP
#define ENCODER_STEPS 2000
/**
*\brief This class is an handler for mobile robot Robex.
* This object interacts with the Robex-AVR, a microcontroller based device that controls the motors of the robots using PID loops
* @author Robolab staff
*/
class RobexHandler: public Handler
{
Q_OBJECT
private:
//Structure that holds mechanical parameters
RoboCompDifferentialRobot::TMechParams mechParams;
QSerialPort MotionDevice;
QTime LastCmdTimestamp; // Timestamp of last command received
bool AreMotorsActivated;
int lant,rant; //t-1 values of wheels pos used in computePosBase. ResetOdometer zeroes them
float adv,rot;
float advE,rotE;
bool commandToSend;
bool result;
QMutex *bstate_mutex,*speed_mutex;
RoboCompDifferentialRobot::TBaseState bState;
unsigned char stringEnviado[200], stringRecibido[200];
int numEnviado, numRecibido;
public:
RobexHandler(RoboCompDifferentialRobot::TMechParams params);
~RobexHandler();
//accesible
//odometer
bool resetOdometer();
bool setOdometer(RoboCompDifferentialRobot::TBaseState bState);
void correctOdometer(float x, float z, float alpha);
//speed
bool stopBase();
bool setSpeedBase(float adv,float rot);
RoboCompDifferentialRobot::TBaseState getBaseState();
RoboCompDifferentialRobot::TMechParams getMechParams();
void compute();
private: //internal
bool executeSpeed(float adv,float rot);
bool getBaseData(); //read mechanical parameters
bool getPosWheels(int &izq, int &der);
bool setSpeedWheels ( float left, float right );
bool setMotorsState(int);
void computePosBase();
void computeAutonomy();
void checkMotorsState();
bool ascii2dec(char*, int, int&);
//command
bool sendCommand( QString , char*, int);
};
#endif
|
#ifndef KERNEL_KMEMORY_H
#define KERNEL_KMEMORY_H
/*
* kernel/include/kmemory.h
* Kernel-mode memory management
*
* Copyright (C) 2013 James Cowgill
*
* 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 "global.h"
#include "multiboot.h"
// Returns a pointer which can be used to access the first 4GB of physical memory
static inline void * KMemFromPhysical(uint32_t pAddr)
{
// FFFF FF80 0000 0000
return (void *) (0xFFFFFF8000000000 + pAddr);
}
// Initializes the kernel memory manager using the given region of memory
// The base address is a physical address
// The base address and length must be page aligned
void KMemInit(uint32_t base, uint32_t length);
// Allocates 1 page of kernel memory
// ZAllocate zeros the page before returning it
// Returns NULL if out of memory
void * KMemAllocate(void);
void * KMemZAllocate(void);
// Frees 1 page of kernel memory
void KMemFree(void * page);
#endif
|
int f2(int x, int y);
|
/*
Simple, QaD tool to splice a file into another file
Copyright (C) 2008 Jeroen Domburg <jeroen@spritesmods.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
static char *progname = NULL;
static void pfatal(const char *msg) {
fprintf(stderr, "%s: ", progname);
perror(msg);
exit(1);
}
static void fatal(const char *msg) {
fprintf(stderr, "%s: %s\n", progname, msg);
exit(1);
}
int main(int argc, char **argv) {
int f1,f2,r;
long size, size2;
unsigned int offset;
char *buff;
struct stat sbuff;
progname = argv[0];
if (argc!=4) {
printf("Usage: %s file1 file2 offset\n"
"Overwrites the byte in file1 with"
"those of file2, starting at offset.\n", argv[0]);
exit(0);
}
r=stat(argv[1],&sbuff);
if (r!=0)
pfatal("Couldn't stat file1");
size=sbuff.st_size;
buff=malloc(size);
if (buff==NULL)
fatal("Couldn't malloc bytes for file1");
f1=open(argv[1],O_RDONLY);
if (f1<0)
pfatal("Couldn't open file1");
if (read(f1,buff,size) != size)
pfatal("Couldn't read file1");
if (close(f1) != 0)
pfatal("Error while closing file1");
offset= strtol(argv[3], (char **)NULL, 0);
if (offset>size)
fatal("Offset bigger than size of file!");
printf("Splicing in at offset 0x%X.\n",offset);
r=stat(argv[2],&sbuff);
if (r!=0)
pfatal("Couldn't stat file2");
size2=sbuff.st_size;
f2=open(argv[2],O_RDONLY);
if (f2<0)
pfatal("Couldn't open file2");
if (read(f2,buff+offset,size) != size2)
pfatal("Couldn't read file2");
if (close(f2) != 0)
pfatal("Error while closing file2");
f2=open(argv[1],O_CREAT|O_TRUNC|O_WRONLY,444);
if (f2<0)
pfatal("Couldn't open file1 for writing");
if (write(f2,buff,size) != size)
pfatal("Couldn't write to file2");
if (close(f2) != 0)
pfatal("Error while closing file2 after writing");
printf("All done. Thank you, come again.\n");
exit(0);
}
|
# gpu header for modulefiles created by EasyBuild
conflict craype-broadwell
conflict daint-mc
prereq daint-gpu
|
//===- ScriptScanner.h ----------------------------------------------------===//
//
// The MCLinker Project
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef MCLD_SCRIPT_SCRIPTSCANNER_H
#define MCLD_SCRIPT_SCRIPTSCANNER_H
#ifndef __FLEX_LEXER_H
#include "FlexLexer.h"
#endif
#ifndef YY_DECL
#define YY_DECL \
mcld::ScriptParser::token_type \
mcld::ScriptScanner::lex(mcld::ScriptParser::semantic_type* yylval, \
mcld::ScriptParser::location_type* yylloc, \
const mcld::ScriptFile& pScriptFile)
#endif
#include <mcld/Script/ScriptFile.h>
#include "ScriptParser.h"
#include <stack>
namespace mcld {
/** \class ScriptScanner
*
*/
class ScriptScanner : public yyFlexLexer
{
public:
ScriptScanner(std::istream* yyin = NULL, std::ostream* yyout = NULL);
virtual ~ScriptScanner();
virtual ScriptParser::token_type lex(ScriptParser::semantic_type* yylval,
ScriptParser::location_type* yylloc,
const ScriptFile& pScriptFile);
void setLexState(ScriptFile::Kind pKind);
void popLexState();
private:
void enterComments(ScriptParser::location_type& pLocation);
private:
ScriptFile::Kind m_Kind;
std::stack<ScriptFile::Kind> m_StateStack;
};
} // namespace of mcld
#endif
|
#ifndef FRSKY_DATAAPP_H
#define FRSKY_DATAAPP_H
/*
Copyright (c) 2012 - 2013 Andy Little
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 <wx/app.h>
class frsky_dataApp : public wxApp
{
public:
virtual bool OnInit();
};
DECLARE_APP(frsky_dataApp)
#endif // FRSKY_DATAAPP_H
|
/*
Copyright Rene Rivera 2008-2015
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef BHO_PREDEF_ARCHITECTURE_IA64_H
#define BHO_PREDEF_ARCHITECTURE_IA64_H
#include <bho/predef/version_number.h>
#include <bho/predef/make.h>
/* tag::reference[]
= `BHO_ARCH_IA64`
http://en.wikipedia.org/wiki/Ia64[Intel Itanium 64] architecture.
[options="header"]
|===
| {predef_symbol} | {predef_version}
| `+__ia64__+` | {predef_detection}
| `+_IA64+` | {predef_detection}
| `+__IA64__+` | {predef_detection}
| `+__ia64+` | {predef_detection}
| `+_M_IA64+` | {predef_detection}
| `+__itanium__+` | {predef_detection}
|===
*/ // end::reference[]
#define BHO_ARCH_IA64 BHO_VERSION_NUMBER_NOT_AVAILABLE
#if defined(__ia64__) || defined(_IA64) || \
defined(__IA64__) || defined(__ia64) || \
defined(_M_IA64) || defined(__itanium__)
# undef BHO_ARCH_IA64
# define BHO_ARCH_IA64 BHO_VERSION_NUMBER_AVAILABLE
#endif
#if BHO_ARCH_IA64
# define BHO_ARCH_IA64_AVAILABLE
#endif
#if BHO_ARCH_IA64
# undef BHO_ARCH_WORD_BITS_64
# define BHO_ARCH_WORD_BITS_64 BHO_VERSION_NUMBER_AVAILABLE
#endif
#define BHO_ARCH_IA64_NAME "Intel Itanium 64"
#endif
#include <bho/predef/detail/test.h>
BHO_PREDEF_DECLARE_TEST(BHO_ARCH_IA64,BHO_ARCH_IA64_NAME)
|
/*
* Copyright (C) Liu Lantao
*/
#ifndef _NGX_HTTP_ACCOUNTING_MODULE_H_INCLUDED_
#define _NGX_HTTP_ACCOUNTING_MODULE_H_INCLUDED_
#include <ngx_core.h>
#include <ngx_http.h>
#include "../ngx_traffic_accounting_module.h"
typedef ngx_traffic_accounting_main_conf_t ngx_http_accounting_main_conf_t;
typedef ngx_traffic_accounting_loc_conf_t ngx_http_accounting_loc_conf_t;
extern ngx_module_t ngx_http_accounting_module;
// Status Code. Default 0
#define NGX_HTTP_STATUS_UNSET 0
#define NGX_HTTP_MAX_STATUS NGX_HTTP_INSUFFICIENT_STORAGE
extern ngx_uint_t ngx_http_statuses[];
extern ngx_uint_t ngx_http_statuses_len;
#endif /* _NGX_HTTP_ACCOUNTING_MODULE_H_INCLUDED_ */
|
/*
This source file is part of Rigs of Rods
Copyright 2005-2012 Pierre-Michel Ricordel
Copyright 2007-2012 Thomas Fischer
Copyright 2013-2014 Petr Ohlidal
For more information, see http://www.rigsofrods.org/
Rigs of Rods 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.
Rigs of Rods 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 Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
*/
/**
@file RigDef_Prerequisites.h
@author Petr Ohlidal
@date 12/2013
*/
namespace RigDef
{
/* File structures declarations */
/* TODO: Complete list */
struct AeroAnimator;
struct Airbrake;
struct Animation;
struct AntiLockBrakes;
struct Axle;
struct Beam;
struct BeamDefaults;
struct BeamDefaultsScale;
struct Brakes;
struct Cab;
struct CameraRail;
struct CameraSettings;
struct Cinecam;
struct CollisionBox;
struct Command2;
struct CruiseControl;
struct Engine;
struct Engoption;
struct Engturbo;
struct ExtCamera;
struct File;
struct Flare;
struct Flare2;
struct FlexBody;
struct FlexBodyWheel;
struct Fusedrag;
struct Globals;
struct GuiSettings;
struct Hook;
struct Hydro;
struct Inertia;
struct Lockgroup;
struct ManagedMaterialsOptions;
struct Meshwheel;
struct Meshwheel2;
struct Node;
struct NodeDefaults;
struct Particle;
struct Pistonprop;
struct Prop;
struct RailGroup;
struct Ropable;
struct ShadowOptions;
struct VideoCamera;
/* Parser classes */
class Parser;
class Validator;
class SequentialImporter;
} /* namespace RigDef */ |
/* RetroArch - A frontend for libretro.
* Copyright (C) 2010-2012 - Hans-Kristian Arntzen
* Copyright (C) 2011-2012 - 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/>.
*/
#ifndef _PS3_CTX_H
#define _PS3_CTX_H
void gfx_ctx_get_available_resolutions (void);
int gfx_ctx_check_resolution(unsigned resolution_id);
const char *ps3_get_resolution_label(uint32_t resolution);
void gfx_ctx_set_projection(gl_t *gl, const struct gl_ortho *ortho, bool allow_rotate);
void gfx_ctx_set_aspect_ratio(void *data, unsigned aspectratio_index);
void gfx_ctx_set_overscan(void);
void gfx_ctx_set_fbo(bool enable);
void gfx_ctx_clear(void);
void gfx_ctx_set_blend(bool enable);
#endif
|
/*
NOTICE
The software accompanying this notice (the "Software") is provided to you
free of charge to facilitate your use of the data collected by the Mars
Orbiter Camera (the "MOC Data"). Malin Space Science Systems ("MSSS")
grants to you (either as an individual or entity) a personal,
non-transferable, and non-exclusive right (i) to use and reproduce the
Software solely for the purpose of accessing the MOC Data; (ii) to modify
the source code of the Software as necessary to maintain or adapt the
Software to run on alternate computer platforms; and (iii) to compile, use
and reproduce the modified versions of the Software solely for the purpose
of accessing the MOC Data. In addition, you may distribute the Software,
including any modifications thereof, solely for use with the MOC Data,
provided that (i) you must include this notice with all copies of the
Software to be distributed; (ii) you may not remove or alter any
proprietary notices contained in the Software; (iii) you may not charge any
third party for the Software; and (iv) you will not export the Software
without the appropriate United States and foreign government licenses.
You acknowledge that no title to the intellectual property in the Software
is transferred to you. You further acknowledge that title and full
ownership rights to the Software will remain the exclusive property of MSSS
or its suppliers, and you will not acquire any rights to the Software
except as expressly set forth above. The Software is provided to you AS
IS. MSSS MAKES NO WARRANTY, EXPRESS OR IMPLIED, WITH RESPECT TO THE
SOFTWARE, AND SPECIFICALLY DISCLAIMS THE IMPLIED WARRANTIES OF
NON-INFRINGEMENT OF THIRD PARTY RIGHTS, MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR
LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO SUCH LIMITATIONS OR
EXCLUSIONS MAY NOT APPLY TO YOU.
Your use or reproduction of the Software constitutes your agreement to the
terms of this Notice. If you do not agree with the terms of this notice,
promptly return or destroy all copies of the Software in your possession.
Copyright (C) 1999 Malin Space Science Systems. All Rights Reserved.
SCCSID @(#)readBits.h 1.1 10/04/99
*/
/* SCCShid @(#)readBits.h (readBits.h) 1.2 */
#ifndef readBits_h
#define readBits_h
#include <stdio.h>
#include "fs.h"
#define MAXQUEUESIZE 4096
typedef struct bitStruct BITSTRUCT;
struct bitStruct {
uint32 bitQueue;
uint8 bitCount;
FILE *file;
uint32 byteCount;
#ifdef FILEBITS
uint8 byteQueue[MAXQUEUESIZE];
#else
uint8 *byteQueue;
#endif
uint32 queueSize;
};
extern BITSTRUCT *initBits(uint8 *data, int len);
extern uint32 readBits(register uint8 bitCount, register BITSTRUCT *bitStuff);
#endif
|
/**
******************************************************************************
* @file UART/UART_TwoBoards_ComPolling/Inc/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.0.5
* @date 17-February-2017
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @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.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
void EXTI0_IRQHandler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|
/*******************************************************************************
* Project: IECC (IEC 61131-3 Languages Compiler for Arduino). *
* Authors: Paulo H. Torrens <paulotorrens AT gnu DOT org>. *
* License: GNU GPLv3+. *
* *
* Language: (Legacy) Objective-C. *
* Description: *
********************************************************************************
* Copyright (C) 2015 - Paulo H. Torrens. 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 __IECC_INCLUDE_IECC_TYPES_ANY_INT_INCLUDE__
#define __IECC_INCLUDE_IECC_TYPES_ANY_INT_INCLUDE__
#include "types/IECCAnyNum.h"
#endif
//
#ifndef __IECC_INCLUDE_IECC_TYPES_ANY_INT_DEFINE__
#ifdef __IECC_INCLUDE_IECC_TYPES_ANY_NUM_DEFINE__
#define __IECC_INCLUDE_IECC_TYPES_ANY_INT_DEFINE__
//
@interface IECCAnyInt: IECCAnyNum
@end
#endif
#endif
|
#define MODEL_BASIC_LIBRARIES
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
// #include <complex.h>
#include <time.h>
#include <assert.h>
#include <gsl/gsl_sf.h>
#include <gsl/gsl_math.h>
#include <gsl/gsl_vector.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_errno.h>
#include <gsl/gsl_randist.h>
#include <gsl/gsl_cdf.h>
#include <gsl/gsl_sort.h>
#include <gsl/gsl_sort_vector.h>
#include <gsl/gsl_permutation.h>
#include <gsl/gsl_multimin.h>
#include <gsl/gsl_histogram.h>
// Curiously R.h is incompatible with the C general header complex.h
// If you are not requiring funcions on the complex plane, you are OK!!!
#include <R.h>
#include "MODEL_Time_Control_STRUCT_DEF.h"
#include "MODEL_Parameter_Model_STRUCT_DEF.h"
#include "MODEL_SP_Matrix_Data_STRUCT_DEF.h"
#include "MODEL_Parameter_Space_STRUCT_DEF.h"
#include "MODEL_Parameter_Fitting_STRUCT_DEF.h"
#include "../lib/da_IBT_Functions.h"
#include "../lib_opt/da_IBT_Optimization.h"
#define MAX(A,B) ((A)>(B)? A:B)
#define MIN(A,B) ((A)<(B)? A:B)
#define No_of_SPECIES_MAX 10000
#define MODEL_PARAMETERS_MAXIMUM 4
#define No_of_TIME_OBS_MAX 100000 // Maximum number of temporal observations
// (total temporal columns in the data matrix)
#define ROW_TAG_LENGTH_MAX 100 // Maximum number of characters of the label
// of each row of a given Presence Absence
// data
|
//
// Generated by the J2ObjC translator. DO NOT EDIT!
// source: ../pdfreporter-core/src/org/oss/pdfreporter/engine/xml/JRStyleFactory.java
//
#include "J2ObjC_header.h"
#pragma push_macro("INCLUDE_ALL_OrgOssPdfreporterEngineXmlJRStyleFactory")
#ifdef RESTRICT_OrgOssPdfreporterEngineXmlJRStyleFactory
#define INCLUDE_ALL_OrgOssPdfreporterEngineXmlJRStyleFactory 0
#else
#define INCLUDE_ALL_OrgOssPdfreporterEngineXmlJRStyleFactory 1
#endif
#undef RESTRICT_OrgOssPdfreporterEngineXmlJRStyleFactory
#if !defined (OrgOssPdfreporterEngineXmlJRStyleFactory_) && (INCLUDE_ALL_OrgOssPdfreporterEngineXmlJRStyleFactory || defined(INCLUDE_OrgOssPdfreporterEngineXmlJRStyleFactory))
#define OrgOssPdfreporterEngineXmlJRStyleFactory_
#define RESTRICT_OrgOssPdfreporterEngineXmlJRAbstractStyleFactory 1
#define INCLUDE_OrgOssPdfreporterEngineXmlJRAbstractStyleFactory 1
#include "org/oss/pdfreporter/engine/xml/JRAbstractStyleFactory.h"
@class OrgOssPdfreporterEngineDesignJRDesignStyle;
@interface OrgOssPdfreporterEngineXmlJRStyleFactory : OrgOssPdfreporterEngineXmlJRAbstractStyleFactory
#pragma mark Public
- (instancetype)init;
#pragma mark Protected
- (void)setParentStyleWithOrgOssPdfreporterEngineDesignJRDesignStyle:(OrgOssPdfreporterEngineDesignJRDesignStyle *)currentStyle
withNSString:(NSString *)parentStyleName;
@end
J2OBJC_EMPTY_STATIC_INIT(OrgOssPdfreporterEngineXmlJRStyleFactory)
FOUNDATION_EXPORT void OrgOssPdfreporterEngineXmlJRStyleFactory_init(OrgOssPdfreporterEngineXmlJRStyleFactory *self);
FOUNDATION_EXPORT OrgOssPdfreporterEngineXmlJRStyleFactory *new_OrgOssPdfreporterEngineXmlJRStyleFactory_init() NS_RETURNS_RETAINED;
FOUNDATION_EXPORT OrgOssPdfreporterEngineXmlJRStyleFactory *create_OrgOssPdfreporterEngineXmlJRStyleFactory_init();
J2OBJC_TYPE_LITERAL_HEADER(OrgOssPdfreporterEngineXmlJRStyleFactory)
#endif
#pragma pop_macro("INCLUDE_ALL_OrgOssPdfreporterEngineXmlJRStyleFactory")
|
/*
* Copyright (C) 2007 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef LayoutState_h
#define LayoutState_h
#include "ColumnInfo.h"
#include "LayoutTypes.h"
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
namespace WebCore {
class RenderArena;
class RenderBlock;
class RenderBox;
class RenderObject;
class RenderFlowThread;
class LayoutState {
WTF_MAKE_NONCOPYABLE(LayoutState);
public:
LayoutState()
: m_clipped(false)
, m_isPaginated(false)
, m_pageLogicalHeight(0)
, m_pageLogicalHeightChanged(false)
, m_columnInfo(0)
, m_lineGrid(0)
, m_next(0)
#ifndef NDEBUG
, m_renderer(0)
#endif
{
}
LayoutState(LayoutState*, RenderBox*, const LayoutSize& offset, LayoutUnit pageHeight, bool pageHeightChanged, ColumnInfo*);
LayoutState(LayoutState*, RenderFlowThread*, bool regionsChanged);
LayoutState(RenderObject*);
void destroy(RenderArena*);
// Overloaded new operator.
void* operator new(size_t, RenderArena*);
// Overridden to prevent the normal delete from being called.
void operator delete(void*, size_t);
void clearPaginationInformation();
bool isPaginatingColumns() const { return m_columnInfo && m_columnInfo->paginationUnit() == ColumnInfo::Column; }
bool isPaginated() const { return m_isPaginated; }
// The page logical offset is the object's offset from the top of the page in the page progression
// direction (so an x-offset in vertical text and a y-offset for horizontal text).
LayoutUnit pageLogicalOffset(LayoutUnit childLogicalOffset) const;
void addForcedColumnBreak(LayoutUnit childLogicalOffset);
LayoutUnit pageLogicalHeight() const { return m_pageLogicalHeight; }
bool pageLogicalHeightChanged() const { return m_pageLogicalHeightChanged; }
RenderBlock* lineGrid() const { return m_lineGrid; }
LayoutSize lineGridOffset() const { return m_lineGridOffset; }
LayoutSize lineGridPaginationOrigin() const { return m_lineGridPaginationOrigin; }
LayoutSize layoutOffset() const { return m_layoutOffset; }
bool needsBlockDirectionLocationSetBeforeLayout() const { return m_lineGrid || (m_isPaginated && m_pageLogicalHeight); }
private:
// The normal operator new is disallowed.
void* operator new(size_t) throw();
void propagateLineGridInfo(RenderBox*);
void establishLineGrid(RenderBlock*);
void computeLineGridPaginationOrigin(RenderBox*);
public:
bool m_clipped;
bool m_isPaginated;
LayoutRect m_clipRect;
// x/y offset from container. Includes relative positioning and scroll offsets.
LayoutSize m_paintOffset;
// x/y offset from container. Does not include relative positioning or scroll offsets.
LayoutSize m_layoutOffset;
// Transient offset from the final position of the object
// used to ensure that repaints happen in the correct place.
// This is a total delta accumulated from the root.
LayoutSize m_layoutDelta;
// The current page height for the pagination model that encloses us.
LayoutUnit m_pageLogicalHeight;
// If our page height has changed, this will force all blocks to relayout.
bool m_pageLogicalHeightChanged;
// The offset of the start of the first page in the nearest enclosing pagination model.
LayoutSize m_pageOffset;
// If the enclosing pagination model is a column model, then this will store column information for easy retrieval/manipulation.
ColumnInfo* m_columnInfo;
// The current line grid that we're snapping to and the offset of the start of the grid.
RenderBlock* m_lineGrid;
LayoutSize m_lineGridOffset;
LayoutSize m_lineGridPaginationOrigin;
LayoutState* m_next;
#ifndef NDEBUG
RenderObject* m_renderer;
#endif
};
} // namespace WebCore
#endif // LayoutState_h
|
/* $Id$ */
/** @file
* kmk_cc - Make "Compiler".
*/
/*
* Copyright (c) 2015 knut st. osmundsen <bird-kBuild-spamx@anduin.net>
*
* This file is part of kBuild.
*
* kBuild 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.
*
* kBuild 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 kBuild. If not, see <http://www.gnu.org/licenses/>
*
*/
#ifndef ___kmk_cc_and_exech
#define ___kmk_cc_and_exech
#ifdef CONFIG_WITH_COMPILER
#include <stdio.h>
void kmk_cc_init(void);
void kmk_cc_print_stats(void);
struct variable;
extern struct kmk_cc_expandprog *kmk_cc_compile_variable_for_expand(struct variable *pVar);
extern struct kmk_cc_evalprog *kmk_cc_compile_variable_for_eval(struct variable *pVar);
extern struct kmk_cc_evalprog *kmk_cc_compile_file_for_eval(FILE *pFile, const char *pszFilename);
extern char *kmk_exec_expand_to_var_buf(struct variable *pVar, char *pchDst);
extern void kmk_exec_eval_file(struct kmk_cc_evalprog *pProg);
extern void kmk_exec_eval_variable(struct variable *pVar);
extern void kmk_cc_variable_changed(struct variable *pVar);
extern void kmk_cc_variable_deleted(struct variable *pVar);
#endif /* CONFIG_WITH_COMPILER */
#endif
|
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//
// BSFacebookLoginService.h
// BeSport Mobile
//
// Created by François-Xavier Thomas on 5/9/12.
// Copyright (c) 2012 BeSport. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "BSLoginService.h"
#import "FBConnect.h"
@class BSFacebookLoginService;
@protocol BSFacebookLoginProvider <NSObject>
- (BSFacebookLoginService*) facebookLoginService;
@end
@protocol BSFacebookUserAuthDataSource <NSObject>
- (NSString*) facebookId;
- (NSString*) facebookSessionToken;
@end
@interface BSFacebookLoginService : BSLoginService <FBSessionDelegate, FBRequestDelegate, BSUserInfoDataSource, BSFacebookUserAuthDataSource>
// Some facebook-related properties
@property (nonatomic, retain) Facebook* facebook;
@property (nonatomic, retain) NSArray *permissions;
// User information
@property (nonatomic, retain) NSString *email;
@property (nonatomic, retain) NSString *firstName;
@property (nonatomic, retain) NSString *lastName;
@property (nonatomic, retain) NSDate *birthdayDate;
// Facebook information
@property (nonatomic, retain) NSString *facebookId;
@property (nonatomic, retain) NSString *facebookSessionToken;
- (id) initWithAppId:(NSString*)appId;
@end |
#ifndef VIRTUAL_KEYWORDS_PLUGIN_H
#define VIRTUAL_KEYWORDS_PLUGIN_H
extern const char *virtual_keywords_plugin_dependencies[];
extern const char virtual_keywords_plugin_binary_dependency[];
void virtual_keywords_plugin_init(struct module *module);
void virtual_keywords_plugin_deinit(void);
#endif
|
/*
ClrUSct.c - routine to clear the free space in a volume.
Copyright (C) 2002 Imre Leber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
If you have any questions, comments, suggestions, or fixes please
email me at: imre.leber@worldonline.be
*/
#include <stdlib.h>
#include <string.h>
#include "fte.h"
static BOOL UnusedSectorClearer(RDWRHandle handle, CLUSTER label,
SECTOR datasector, void** structure);
BOOL ClearUnusedSectors(RDWRHandle handle)
{
return LinearTraverseFat(handle, UnusedSectorClearer, NULL);
}
static BOOL UnusedSectorClearer(RDWRHandle handle, CLUSTER label,
SECTOR datasector, void** structure)
{
SECTOR sector;
char sectbuf[BYTESPERSECTOR];
structure = structure;
memset(sectbuf, 0xfd, BYTESPERSECTOR);
if (FAT_FREE(label))
{
for (sector = 0; sector < GetSectorsPerCluster(handle); sector++)
if (!WriteDataSectors(handle, 1, datasector+sector, sectbuf))
RETURN_FTEERR(FAIL);
}
return TRUE;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.