text stringlengths 4 6.14k |
|---|
#include "alsa-autoconf.h"
#include "adriver.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 4, 0)
#include "tea575x-tuner-3.3.c"
#elif LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 5, 0)
#define v4l2_disable_ioctl(x, y) /* NOP */
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 6, 0)
#define V4L2_TUNER_CAP_HWSEEK_BOUNDED 0
#endif
#include "tea575x-tuner-3.6.c"
#else
#include "../../alsa-kernel/i2c/other/tea575x-tuner.c"
#endif
|
/*
* 1-5.c - By furzoom @ Jan 10, 2016
*/
#include <stdio.h>
int main()
{
float fahr, celsius;
float lower, upper, step;
lower = 0;
upper = 300;
step = 20;
printf("FAHR CELSIUS\n");
for (fahr = upper; fahr >= lower; fahr = fahr - step) {
celsius = (5.0 / 9.0) * (fahr - 32.0);
printf("%3.0f %6.1f\n", fahr, celsius);
}
return 0;
}
|
/* This file is (C) copyright 2001-2004 Software Improvements, Pty Ltd */
/* This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <unistd.h>
#include <common/voter_electorate.h>
#include <common/cursor.h>
#include "accumulate_preferences.h"
#include "message.h"
#include "image.h"
#include "input.h"
#include "verify_barcode.h"
#include "get_rotation.h"
#include "get_cursor.h"
#include "main_screen.h"
#include "keystroke.h"
#include "undo_pref.h"
#include "add_preference.h"
#include "move_cursor.h"
#include "start_again.h"
#include "initiate_session.h"
#include "draw_group_entry.h"
#include "audio.h"
/* DDS3.2.6: Display Acknowledgement Screen */
void display_ack_screen(void)
{
struct image *image;
unsigned int language;
language = get_language();
/* Draw background */
paste_image(0, 0, get_message(language, MSG_BACKGROUND));
/* Draw acknowledgement in centre of screen */
image = get_message(language, MSG_ACKNOWLEDGEMENT);
paste_image((get_screen_width()-image_width(image))/2,
(get_screen_height()-image_height(image))/2,
image);
/* Play the acknowledgement */
play_audio(true, get_audio("ack.raw"));
sleep(10);
}
void accumulate_preferences(void)
{
const struct electorate *electorate;
enum input_event key;
bool restart, continue_voting= true;
struct cursor cursor;
unsigned int language;
struct cursor default_cursor;
electorate = get_voter_electorate();
get_rotation(electorate);
default_cursor.screen_candidate_index = -1;
default_cursor.group_index = get_initial_cursor(electorate);
set_cursor_position(default_cursor);
/* Audio for the first time on the main voting screen */
play_audio(true,
get_audio("electorates/%u/main_screen.raw",
electorate->code));
dsp_mn_vt_scn();
/* Do not interrupt intro audio */
draw_group_entry(default_cursor, YES, false);
while(continue_voting == true) {
key = interpret_keystroke();
if (key == INPUT_UNDO) {
undo_pref();
}
else if (key == INPUT_SELECT) {
add_preference();
}
else if (key == INPUT_START_AGAIN) {
cursor = get_cursor_position();
restart = start_again();
dsp_mn_vt_scn();
if (restart) {
play_audio(true,
get_audio("started_again.raw"));
set_cursor_position(default_cursor);
/* Do not interrupt started again message */
draw_group_entry(default_cursor, YES, false);
}
/* If not restarting, highlight last cursor position */
else {
play_audio(true,
get_audio("not_started_again.raw"));
/* Don't interrupt audio */
draw_group_entry(cursor, YES, false);
}
}
else if (key == INPUT_FINISH) {
language = get_language();
cursor = get_cursor_position();
continue_voting = confirm_and_commit_vote(language);
if (continue_voting) {
dsp_mn_vt_scn();
/* Audio for the main voting screen */
/* SIPL 2014-03-18 Fixed the path to
the audio file. */
play_audio(true,
get_audio("electorates/%u/main_screen.raw",
electorate->code));
/* Do not interrupt main screen speil */
draw_group_entry(cursor, YES, false);
}
}
else if (key == INPUT_VOLUME_UP) {
increase_volume();
}
else if (key == INPUT_VOLUME_DOWN) {
decrease_volume();
}
else {
move_cursor(key);
}
}
}
|
/**
* This header is generated by class-dump-z 0.2b.
*
* Source: /System/Library/PrivateFrameworks/iTunesStore.framework/iTunesStore
*/
#import <iTunesStore/ISURLOperationDelegate.h>
@protocol ISStoreURLOperationDelegate <ISURLOperationDelegate>
@optional
- (BOOL)operation:(id)operation shouldSetStoreFrontID:(id)anId;
- (void)operation:(id)operation didAuthenticateWithDSID:(id)dsid;
@end
|
/************************************************************************
$Id$
RTB - Team Framework: Framework for RealTime Battle robots to communicate efficiently in a team
Copyright (C) 2004 The RTB- Team Framework Group: http://rtb-team.sourceforge.net
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Log$
Revision 1.2 2005/02/24 10:27:53 jonico
Updated newest version of the framework
Revision 1.2 2005/01/06 17:59:31 jonico
Now all files in the repository have their new header format.
**************************************************************************/
#ifndef SERVERISPRESENTEXCEPTION_H
#define SERVERISPRESENTEXCEPTION_H
#include "rtbexception.h"
/**
* Namespace Exception
*/
namespace Exceptions {
/**
* Class ServerIsPresentException
* This exception is thrown when
* a) the ServerGameController tries to accept another client
* and the RTB server has already written something over the RTBConnection
* b) the MRC tries to get a ServerGameControl object but a server socket was already established
* Exceptions is thrown from the IOFactory family
*/
class ServerIsPresentException : public RTBException {
/*
* Public stuff
*/
public:
/*
* Constructors
*/
/**
* Constructs an ServerIsPresentException with a concrete errormessage
* @param message Concrete error message
*/
ServerIsPresentException(const string& errormessage):_message("ServerIsPresentException: "+errormessage) {};
/**
* Constructs an ServerIsPresentException with default errormessage
*/
ServerIsPresentException():_message("ServerIsPresentException: The resource could not be allocated, because another process has already done it!") {};
/*
* Operations
*/
/**
* Returns the concrete error message
*/
virtual const string& getMessage () const throw();
/**
* destructor, does nothing by default
*/
virtual ~ServerIsPresentException () throw();
/*
* Private stuff
*/
private:
/*
* Fields
*/
/**
* Contains the concrete error message
*/
string _message;
};
}
#endif //SERVERISPRESENTEXCEPTION_H
|
//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
/////////////////////////////////////////////////////////////////////////////////
// Name: src/objects/PTextBox.h
// Purpose: Contains generic specs for non-editable a text box
// Author: Shane T. Mueller, Ph.D.
// Copyright: (c) 2003-2011 Shane T. Mueller <smueller@obereed.net>
// License: GPL 2
//
//
//
// This file is part of the PEBL project.
//
// PEBL 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.
//
// PEBL 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 PEBL; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
#ifndef __PTEXTBOX_H__
#define __PTEXTBOX_H__
#include "SDL/SDL.h" //For Uint16 definition
#include "PTextObject.h"
#include "PFont.h"
#include "../utility/rc_ptrs.h"
#include <string>
///
/// This class is the basic generic text box.
class PTextBox: virtual public PTextObject
{
public:
PTextBox();
PTextBox(std::string text, int width, int height);
PTextBox(PTextBox & textbox);
virtual ~PTextBox();
//overloaded generic PObject methods
virtual bool SetProperty(std::string, Variant v);
virtual Variant GetProperty(std::string)const;
virtual ObjectValidationError ValidateProperty(std::string, Variant v)const;
virtual ObjectValidationError ValidateProperty(std::string)const;
virtual void SetHeight(int h);
virtual void SetWidth(int w);
virtual void InsertText(std::string character);
virtual void InsertText(char character);
virtual void DeleteText(int length);
virtual void SetEditable(bool val){mEditable = val; mCursorChanged=true;};
virtual bool GetEditable(){return mEditable;};
virtual void SetCursorPosition(int pos){mCursorChanged = true; mCursorPos = pos;};
virtual int GetCursorPosition(){return mCursorPos;};
virtual int IncrementCursor();
virtual int DecrementCursor();
virtual void SetLineWrap(bool state);
virtual void HandleKeyPress(int keycode, int modkeys,Uint16 unicode);
virtual bool AtPrintableCharacter(unsigned int x);
virtual std::string ObjectName() const;
private:
protected:
virtual std::ostream & SendToStream(std::ostream& out) const{return out;};
bool mEditable; //Whether the box is editable.
int mCursorPos; //The character position of the cursor.
bool mCursorChanged; //True if cursor has moved.
bool mLineWrap; //Should lines get wrapped, or just truncated?
};
#endif
|
/*
* Copyright 2014 Vincent Sanders <vince@netsurf-browser.org>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
* NetSurf is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* NetSurf is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* \file
* top level interface table.
*
* \note This should probably not be included directly but rather
* through netsurf.h or gui_internal.h
*/
#ifndef _NETSURF_DESKTOP_GUI_TABLE_H_
#define _NETSURF_DESKTOP_GUI_TABLE_H_
struct gui_browser_table;
struct gui_window_table;
struct gui_download_table;
struct gui_clipboard_table;
struct gui_fetch_table;
struct gui_file_table;
struct gui_utf8_table;
struct gui_search_table;
struct gui_search_web_table;
struct gui_llcache_table;
/**
* NetSurf operation function table
*
* Function table implementing interface operations for the browser core.
*/
struct netsurf_table {
/**
* Browser table.
*
* Provides miscellaneous browser functionality. The table
* is mandatory and must be provided.
*/
struct gui_browser_table *browser;
/**
* Window table.
*
* Provides all operations which affect a frontends display window.
*/
struct gui_window_table *window;
/**
* Download table.
*
* operations table for the download windows.
*/
struct gui_download_table *download;
/**
* Clipboard table.
*/
struct gui_clipboard_table *clipboard;
/**
* Fetcher table
*/
struct gui_fetch_table *fetch;
/**
* File table
*
* Provides file and filename operations to the core. The
* table is optional and may be NULL in which case the default
* posix compliant operations will be used.
*/
struct gui_file_table *file;
/**
* UTF8 table.
*
* Provides for conversion between the gui local character
* encoding and utf8. The table optional and may be NULL which
* implies the local encoding is utf8.
*/
struct gui_utf8_table *utf8;
/**
* Page search table.
*
* Provides routines for the interactive text search on a page.
*/
struct gui_search_table *search;
/**
* Web search table.
*
* Used by the web search provider system. The table is
* optional and may be NULL which uses the default empty
* implementation.
*/
struct gui_search_web_table *search_web;
/**
* Low level cache table.
*
* Used by the low level cache to push objects to persistent
* storage. The table is optional and may be NULL which
* uses the default implementation.
*/
struct gui_llcache_table *llcache;
};
#endif
|
// FileSJ.h : main header file for the PROJECT_NAME application
//
#pragma once
#ifndef __AFXWIN_H__
#error "include 'stdafx.h' before including this file for PCH"
#endif
#include "resource.h" // main symbols
// CFileSJApp:
// See FileSJ.cpp for the implementation of this class
//
class CFileSJApp : public CWinApp
{
public:
CFileSJApp();
// Overrides
public:
virtual BOOL InitInstance();
// Implementation
DECLARE_MESSAGE_MAP()
};
extern CFileSJApp theApp; |
#ifndef TEST_H
#define TEST_H
#include "unfold.h"
void check_co(co_t *co);
void check_co_cond(co_cond_t *cond);
void pred_check(pred_t *pred, int len);
#endif
|
/*
* Copyright (c) 2004, Bull S.A.. All rights reserved.
* Created by: Sebastien Decugis
* This program is free software; you can redistribute it and/or modify it
* under the terms of version 2 of the GNU General Public License as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it would be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* This sample test aims to check the following assertion:
*
* The CPU-time clock of the new process/ new process's thread is initialized to 0.
* The steps are:
* -> compute until the parent process CPU-time clock is greater than 1 sec.
* -> fork
* -> check the child process process CPU time and thread CPU time clocks.
* The test fails if any of these clocks are > 1sec.
*/
/********************************************************************************************/
/****************************** standard includes *****************************************/
/********************************************************************************************/
#include <pthread.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/wait.h>
#include <errno.h>
#include <time.h>
/********************************************************************************************/
/****************************** Test framework *****************************************/
/********************************************************************************************/
#include "../testfrmw/testfrmw.h"
#include "../testfrmw/testfrmw.c"
/* This header is responsible for defining the following macros:
* UNRESOLVED(ret, descr);
* where descr is a description of the error and ret is an int (error code for example)
* FAILED(descr);
* where descr is a short text saying why the test has failed.
* PASSED();
* No parameter.
*
* Both three macros shall terminate the calling process.
* The testcase shall not terminate in any other maneer.
*
* The other file defines the functions
* void output_init()
* void output(char * string, ...)
*
* Those may be used to output information.
*/
/********************************************************************************************/
/********************************** Configuration ******************************************/
/********************************************************************************************/
#ifndef VERBOSE
#define VERBOSE 1
#endif
/********************************************************************************************/
/*********************************** Test case *****************************************/
/********************************************************************************************/
/* The main test function. */
int main(int argc, char *argv[])
{
int ret, status;
pid_t child, ctl;
long ctp, ctt;
clockid_t clp, clt;
struct timespec tp;
/* Initialize output */
output_init();
ctp = sysconf(_SC_CPUTIME);
ctt = sysconf(_SC_THREAD_CPUTIME);
if ((ctp == -1) && (ctt == -1)) {
UNTESTED
("The testcase needs CPUTIME or THREAD_CPUTIME support");
}
#if VERBOSE > 0
output("System abilities:\n");
output(" _POSIX_CPUTIME : %ld\n", ctp);
output(" _POSIX_THREAD_CPUTIME : %ld\n", ctt);
#endif
if (ctp > 0) {
ret = clock_getcpuclockid(0, &clp);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the process");
}
do {
ret = clock_gettime(clp, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read CPU time clock");
}
}
while (tp.tv_sec < 1);
}
if (ctt > 0) {
ret = pthread_getcpuclockid(pthread_self(), &clt);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the thread");
}
do {
ret = clock_gettime(clt, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read thread CPU time clock");
}
}
while (tp.tv_sec < 1);
}
/* Create the child */
child = fork();
if (child == -1) {
UNRESOLVED(errno, "Failed to fork");
}
/* child */
if (child == 0) {
if (ctp > 0) {
ret = clock_getcpuclockid(0, &clp);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the process");
}
ret = clock_gettime(clp, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read CPU time clock");
}
if (tp.tv_sec > 0) {
FAILED
("The process CPU-time clock was not reset in child\n");
}
}
if (ctt > 0) {
ret = pthread_getcpuclockid(pthread_self(), &clt);
if (ret != 0) {
UNRESOLVED(ret,
"Unable to get cpu-time clock id of the thread");
}
ret = clock_gettime(clt, &tp);
if (ret != 0) {
UNRESOLVED(errno,
"Failed to read thread CPU time clock");
}
if (tp.tv_sec > 0) {
FAILED
("The thread CPU-time clock was not reset in child\n");
}
}
/* We're done */
exit(PTS_PASS);
}
/* Parent joins the child */
ctl = waitpid(child, &status, 0);
if (ctl != child) {
UNRESOLVED(errno, "Waitpid returned the wrong PID");
}
if (!WIFEXITED(status) || (WEXITSTATUS(status) != PTS_PASS)) {
FAILED("Child exited abnormally");
}
/* Test passed */
#if VERBOSE > 0
output("Test passed\n");
#endif
PASSED;
}
|
/* An alternative to qsort, with an identical interface.
This file is part of the GNU C Library.
Copyright (C) 1992, 1995, 1996, 1997 Free Software Foundation, Inc.
Written by Mike Haertel, September 1988.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include <alloca.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <memcopy.h>
#include <errno.h>
static void msort_with_tmp (void *b, size_t n, size_t s,
__compar_fn_t cmp, char *t);
static void
msort_with_tmp (void *b, size_t n, size_t s, __compar_fn_t cmp,
char *t)
{
char *tmp;
char *b1, *b2;
size_t n1, n2;
if (n <= 1)
return;
n1 = n / 2;
n2 = n - n1;
b1 = b;
b2 = (char *) b + (n1 * s);
msort_with_tmp (b1, n1, s, cmp, t);
msort_with_tmp (b2, n2, s, cmp, t);
tmp = t;
if (s == OPSIZ && (b1 - (char *) 0) % OPSIZ == 0)
/* We are operating on aligned words. Use direct word stores. */
while (n1 > 0 && n2 > 0)
{
if ((*cmp) (b1, b2) <= 0)
{
--n1;
*((op_t *) tmp) = *((op_t *) b1);
tmp += sizeof (op_t);
b1 += sizeof (op_t);
}
else
{
--n2;
*((op_t *) tmp) = *((op_t *) b2);
tmp += sizeof (op_t);
b2 += sizeof (op_t);
}
}
else
while (n1 > 0 && n2 > 0)
{
if ((*cmp) (b1, b2) <= 0)
{
tmp = (char *) __mempcpy (tmp, b1, s);
b1 += s;
--n1;
}
else
{
tmp = (char *) __mempcpy (tmp, b2, s);
b2 += s;
--n2;
}
}
if (n1 > 0)
memcpy (tmp, b1, n1 * s);
memcpy (b, t, (n - n2) * s);
}
void
qsort (void *b, size_t n, size_t s, __compar_fn_t cmp)
{
const size_t size = n * s;
if (size < 1024)
/* The temporary array is small, so put it on the stack. */
msort_with_tmp (b, n, s, cmp, __alloca (size));
else
{
/* It's somewhat large, so malloc it. */
int save = errno;
char *tmp = malloc (size);
if (tmp == NULL)
{
/* Couldn't get space, so use the slower algorithm
that doesn't need a temporary array. */
extern void _quicksort __P ((void *const __base,
size_t __nmemb, size_t __size,
__compar_fn_t __compar));
_quicksort (b, n, s, cmp);
}
else
{
msort_with_tmp (b, n, s, cmp, tmp);
free (tmp);
}
__set_errno (save);
}
}
|
/*HEADER**********************************************************************
Copyright (c)
All rights reserved
This software embodies materials and concepts that are confidential to Redpine
Signals and is made available solely pursuant to the terms of a written license
agreement with Redpine Signals
Project name : RS22
Module name : SPI driver
File Name : rs22_firmware.h
File Description:
Author :
Rev History:
Ver By date Description
---------------------------------------------------------
1.1 Redpine Signals
--------------------------------------------------------
*END**************************************************************************/
#ifndef __RS22_FIRMWARE_H__
#define __RS22_FIRMWARE_H__
const uint8_t sbtaim1[] = {
#include "sbinst1.map"
};
const uint8_t sbtaim2[] = {
#include "sbinst2.map"
};
const uint8_t sbtadm[] = {
#include "sbdata1.map"
};
#if 1
const uint8_t iutaim1[] = {
#include "iuinst1.map"
};
const uint8_t iutaim2[] = {
#include "iuinst2.map"
};
const uint8_t iutadm[] = {
#include "iudata.map"
};
const uint8_t fftaim1[] = {
#include "ffinst1.map"
};
const uint8_t fftaim2[] = {
#include "ffinst2.map"
};
const uint8_t fftadm[] = {
#include "ffdata.map"
};
const uint8_t sbtadm2[] = {
#include "sbdata2.map"
};
#endif
#endif
|
/*
* CpuStatistics.c
*
* Created on: Jun 27, 2011
*/
#include "CpuStatistics.h"
#include <stdlib.h>
#include "../Common/FunctionTracing.h"
/**
* @parm pCpuInfoStruct, this must be null, prior to call.
* @return Point to CpuInformationStructure if success, otherwise NULL.
*/
struct CpuInformationStructure *CreateCpuInformationStruct() {
struct CpuInformationStructure *pCpuInfoStruct = malloc(
sizeof(struct CpuInformationStructure));
TRACEF(7,(" CreateCpuStatistics() sizeof(struct CpuInformationStructure) = %Zi\n", sizeof(struct CpuInformationStructure)));
if (pCpuInfoStruct != NULL) {
// Note this allocates the Pointer array.
pCpuInfoStruct->pCpuStatisticsStorage = malloc(
sizeof(struct CpuStatistics) * MAX_NUMBER_OF_SUPPORTED_CPUS);
if (pCpuInfoStruct->pCpuStatisticsStorage == NULL) {
free(pCpuInfoStruct);
pCpuInfoStruct = NULL;
} else {
int nCount = 0;
for (nCount = 0; nCount < MAX_NUMBER_OF_SUPPORTED_CPUS; nCount++) {
pCpuInfoStruct->arCpuStatisticsPointerArray[nCount]
= pCpuInfoStruct->pCpuStatisticsStorage + nCount
* sizeof(struct CpuStatistics);
// TRACEF(7,(" CreateCpuStatistics() Init arCpuStatisticsPointerArray[%d] = %p\n", nCount, pCpuInfoStruct->pCpuStatisticsStorage+ nCount* sizeof(struct CpuStatistics)));
} // next ncount.
pCpuInfoStruct->nNumberOfCpusSupported = 0; // init it so DumpCpuInformationStructure doesn't dump garbage.
}
} // end pCpuInfoStruct not null.
return (pCpuInfoStruct);
} // end initcpustatistics.
int DestroyCpuInfromationStruct(struct CpuInformationStructure *pCpuInfoStruct) {
int nStatus = -1;
if (pCpuInfoStruct != NULL) {
/*
if (pCpuInfoStruct->arCpuStatisticsPointerArray !=NULL) {
free(pCpuInfoStruct->arCpuStatisticsPointerArray);
}
*/
if (pCpuInfoStruct->pCpuStatisticsStorage != NULL) {
free(pCpuInfoStruct->pCpuStatisticsStorage);
nStatus = 0;
}
free(pCpuInfoStruct);
}
return (nStatus);
} // end destroycpustatistics.
void DumpCpuInformationStructure(struct CpuInformationStructure *pStruct) {
printf("pStruct.....: %p\n", (void *) pStruct);
printf("Current CPUs: %d\n", pStruct->nNumberOfCpusSupported);
printf("Max CPUs..: %d\n", MAX_NUMBER_OF_SUPPORTED_CPUS);
int nCount = 0;
for (nCount = 0; nCount < pStruct->nNumberOfCpusSupported; nCount++) {
printf("CpuStat struct: %p\n",
pStruct->arCpuStatisticsPointerArray[nCount]);
DumpCpuStatistics(pStruct->arCpuStatisticsPointerArray[nCount]);
} // next ncount.
}
void DumpCpuStatistics(struct CpuStatistics *pStruct) {
printf(" User............: %lu\n", pStruct->User);
printf(" UseNice.........: %lu\n", pStruct->UseNice);
printf(" System..........: %lu\n", pStruct->System);
printf(" IoWait..........: %lu\n", pStruct->IoWait);
printf(" Idle............: %lu\n", pStruct->Idle);
printf(" ContextSwitches.: %lu\n", pStruct->ContextSwitches);
printf(" InvolCntxtSwtchs: %lu\n", pStruct->InvolentaryContextSwitches);
printf(" CrossCalls......: %lu\n", pStruct->CrossCalls);
printf(" Migration.......: %lu\n", pStruct->Migration);
printf(" Interrupts......: %lu\n", pStruct->Interrupts);
printf(" SMutex..........: %lu\n", pStruct->SMutex);
printf(" SysExec.........: %lu\n", pStruct->SysExec);
printf(" RunQueue........: %lu\n", pStruct->RunQueue);
} // end dumpcpustatistics
int InitCpuStatStruct(struct CpuStatistics *pStruct) {
int nStatus = 0;
pStruct->User = 0;
pStruct->UseNice = 0;
pStruct->System = 0;
pStruct->IoWait = 0;
pStruct->Idle = 0;
pStruct->ContextSwitches = 0;
pStruct->InvolentaryContextSwitches = 0;
pStruct->CrossCalls = 0;
pStruct->Migration = 0;
pStruct->Interrupts = 0;
pStruct->Irqs = 0;
pStruct->SoftIrqs = 0;
pStruct->Steal = 0;
pStruct->Guest = 0;
pStruct->SMutex = 0;
pStruct->SysExec = 0;
pStruct->RunQueue = 0;
return (nStatus);
}
/**
* @return 0 - ok
* -98 - nNumberOfCpus outside range [1;MAX_NUMBER_OF_SUPPORTED_CPUS].
*/
int InitCpuInformationStruct(struct CpuInformationStructure *pStruct,
int nNumberOfCpus) {
int nStatus = 0;
if ((nNumberOfCpus > 0) && (nNumberOfCpus <= MAX_NUMBER_OF_SUPPORTED_CPUS)) {
int nCount = 0;
nStatus = 0;
pStruct->nNumberOfCpusSupported = nNumberOfCpus;
while ((nStatus == 0) && (nCount < nNumberOfCpus)) {
// Init the CpuStatistics structure.
nStatus = InitCpuStatStruct(
pStruct->arCpuStatisticsPointerArray[nCount]);
nCount++;
} // end while.
} else { // endif #cpus <= max.
nStatus = -98; // arbitrary value to make it likely the InitCpuStatistics() doesn't return a similar number.
}
return (nStatus);
}
|
/* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef MERGE_SORT_INCLUDED
#define MERGE_SORT_INCLUDED
/**
@file
@brief
Merge sort and insert sort implementations. These sorting functions
are primarily intended for sorting of JOIN_TABs before the greedy
search algorithm is applied. Since the JOIN_TAB comparison functions
(Join_tab_compare*) are not transitive, the resulting order depends
on the sorting implementation to a certain degree.
Since the std::stable_sort and std::sort implementations differ
between platforms, the result of sorting JOIN_TABs may also differ.
In turn, the query execution plan would differ between platforms and
that is a problem with mtr tests (EXPLAIN output would vary).
If you intend to sort something transitive (which means almost
everything except JOIN_TABs) you should most likely use one of the
std sorting functions instead of this.
*/
#include <queue>
#include "my_dbug.h"
/**
Sorts the elements in the range [first,last) into ascending order
using insertion sort.
@param first First element in an array of pointers to be sorted
@param last Element after the last element in an array of pointers
to be sorted
@param comp Comparison function object that, taking two pointers
of the same type as those contained in the range,
returns true if the first argument goes before the
second argument in the specific strict weak ordering
it defines, and false otherwise.
In our case comp should be a function object with an operator:
bool operator()(Element_type*, Element_type*)
*/
template<typename Element_type, typename Comp_func>
void insert_sort(Element_type **first, Element_type **last, Comp_func comp)
{
for (Element_type **high_water_mark= first+1;
high_water_mark < last;
high_water_mark++)
{
for (Element_type **cur= high_water_mark; cur > first ; cur--)
{
if (comp(*(cur-1), *cur))
break;
Element_type *tmp= *(cur-1);
*(cur-1)= *cur;
*cur= tmp;
}
}
}
/**
Sorts the elements in the range [first,last) into ascending order
using merge sort.
@param first First element in an array of pointers to be sorted
@param last Element after the last element in an array of pointers
to be sorted
@param comp Comparison function object that, taking two pointers
of the same type as those contained in the range,
returns true if the first argument goes before the
second argument in the specific strict weak ordering
it defines, and false otherwise.
In our case comp should be a function object with an operator:
bool operator()(Element_type*, Element_type*)
*/
template<typename Element_type, typename Comp_func>
void merge_sort(Element_type **first, Element_type **last, Comp_func comp)
{
const uint elements= static_cast<uint>(last - first);
/*
Tests showed that the value 5 was a good number for JOIN_TAB
ordering, which is the primary use case for this function
*/
if (elements < 5)
{
insert_sort(first, last, comp);
return;
}
Element_type **middle= first + (elements)/2;
merge_sort (first, middle, comp);
merge_sort (middle, last, comp);
std::queue<Element_type *> merged;
Element_type **cur1= first;
Element_type **cur2= middle;
for (uint i= 0; i < elements; i++)
{
DBUG_ASSERT (cur1 < middle || cur2 < last);
if (cur1 == middle)
merged.push(*cur2++);
else if (cur2 == last)
merged.push(*cur1++);
else if (comp(*cur1, *cur2))
merged.push(*cur1++);
else
merged.push(*cur2++);
}
Element_type **result= first;
while (!merged.empty())
{
*result++= merged.front();
merged.pop();
}
}
#endif /* MERGE_SORT_INCLUDED */
|
/* crypto/hmac/hmac.h */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* 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 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. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#ifndef HEADER_HMAC_H
#define HEADER_HMAC_H
#include <openssl/opensslconf.h>
#ifdef OPENSSL_NO_HMAC
#error HMAC is disabled.
#endif
#include <openssl/evp.h>
#define HMAC_MAX_MD_CBLOCK 128 /* largest known is SHA512 */
#ifdef __cplusplus
extern "C" {
#endif
typedef struct hmac_ctx_st
{
const EVP_MD *md;
EVP_MD_CTX md_ctx;
EVP_MD_CTX i_ctx;
EVP_MD_CTX o_ctx;
unsigned int key_length;
unsigned char key[HMAC_MAX_MD_CBLOCK];
} HMAC_CTX;
#define HMAC_size(e) (EVP_MD_size((e)->md))
void HMAC_CTX_init(HMAC_CTX *ctx);
void HMAC_CTX_cleanup(HMAC_CTX *ctx);
#define HMAC_cleanup(ctx) HMAC_CTX_cleanup(ctx) /* deprecated */
void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md); /* deprecated */
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl);
void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len);
void HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len);
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len);
#ifdef __cplusplus
}
#endif
#endif
|
/** osdep_stdint.h
*
* Wrapper for system header osdep_stdint.h
*/
/*****************************************************************************
* Copyright (c) 2017 INSIDE Secure Oy. All Rights Reserved.
*
* The latest version of this code is available at http://www.matrixssl.org
*
* This software is open source; 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 General Public License does NOT permit incorporating this software
* into proprietary programs. If you are unable to comply with the GPL, a
* commercial license for this software may be purchased from INSIDE at
* http://www.insidesecure.com/
*
* This program is distributed in 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
* http://www.gnu.org/copyleft/gpl.html
*****************************************************************************/
/* This file just includes system header stdint.h.
In case your system does not include all functions
via that file or
does not have implementation of stdint.h, please
customize this place holder header.
*/
#ifndef OSDEP_STDINT_H_DEFINED
#define OSDEP_STDINT_H_DEFINED 1
#include <stdint.h>
/* You may redefine the wrappers below in case your target system does not
provide all of the functions below. The functions are from C standard
ISO C99 and other common standards.
The defines may be overrided from command line. */
#endif /* OSDEP_STDINT_H_DEFINED */
|
/*
* OpenTyrian Classic: A modern cross-platform port of Tyrian
* Copyright (C) 2007-2009 The OpenTyrian Development Team
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "input.h"
#include "keyboard.h"
#include "network.h"
#include "opentyr.h"
#include "varz.h"
#include "video.h"
#include "video_scale.h"
#include "SDL.h"
JE_boolean ESCPressed;
JE_boolean newkey, newmouse, keydown, mousedown;
SDLKey lastkey_sym;
SDLMod lastkey_mod;
unsigned char lastkey_char;
Uint8 lastmouse_but;
Uint16 lastmouse_x, lastmouse_y;
JE_boolean mouse_pressed[3] = {false, false, false};
Uint16 mouse_x, mouse_y;
int numkeys;
Uint8 *keysactive;
#ifdef NDEBUG
bool input_grab_enabled = true,
#else
bool input_grab_enabled = false,
#endif
input_grabbed = false;
void flush_events_buffer( void )
{
SDL_Event ev;
while (SDL_PollEvent(&ev));
}
void wait_input( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick )
{
inputFound = update_input();
while (!inputFound)
{
SDL_Delay(SDL_POLL_INTERVAL);
inputFound = update_input();
}
}
void wait_noinput( JE_boolean keyboard, JE_boolean mouse, JE_boolean joystick )
{
inputFound = update_input();
while (inputFound)
{
SDL_Delay(SDL_POLL_INTERVAL);
inputFound = update_input();
}
}
void init_keyboard( void )
{
//keysactive = SDL_GetKeyboardState(&numkeys);
SDL_EnableKeyRepeat(500, 60);
newkey = newmouse = false;
keydown = mousedown = false;
SDL_EnableUNICODE(1);
}
void input_grab( void )
{
#if defined(TARGET_GP2X) || defined(TARGET_DINGUX)
input_grabbed = true;
#else
input_grabbed = input_grab_enabled || fullscreen_enabled;
#endif
SDL_ShowCursor(input_grabbed ? SDL_DISABLE : SDL_ENABLE);
#ifdef NDEBUG
SDL_WM_GrabInput(input_grabbed ? SDL_GRAB_ON : SDL_GRAB_OFF);
#endif
}
JE_word JE_mousePosition( JE_word *mouseX, JE_word *mouseY )
{
service_SDL_events(false);
*mouseX = mouse_x;
*mouseY = mouse_y;
return mousedown ? lastmouse_but : 0;
}
void set_mouse_position( int x, int y )
{
if (input_grabbed)
{
SDL_WarpMouse(x * scalers[scaler].width / vga_width, y * scalers[scaler].height / vga_height);
mouse_x = x;
mouse_y = y;
}
}
void service_SDL_events( JE_boolean clear_new )
{
SDL_Event ev;
if (clear_new)
newkey = newmouse = false;
while (SDL_PollEvent(&ev))
{
switch (ev.type)
{
case SDL_FINGERUP:
lastkey_sym = SDLK_RETURN;
keydown = true;
newkey = true;
return;
case SDL_MOUSEMOTION:
mouse_x = ev.motion.x * vga_width / scalers[scaler].width;
mouse_y = ev.motion.y * vga_height / scalers[scaler].height;
break;
case SDL_KEYDOWN:
if (ev.key.keysym.mod & KMOD_CTRL)
{
/* <ctrl><bksp> emergency kill */
if (ev.key.keysym.sym == SDLK_BACKSPACE)
{
puts("\n\n\nCtrl+Backspace pressed. Doing emergency quit.\n");
SDL_Quit();
exit(1);
}
/* <ctrl><f10> toggle input grab */
if (ev.key.keysym.sym == SDLK_F10)
{
input_grab_enabled = !input_grab_enabled;
input_grab();
break;
}
}
if (ev.key.keysym.mod & KMOD_ALT)
{
/* <alt><enter> toggle fullscreen */
if (ev.key.keysym.sym == SDLK_RETURN)
{
if (!init_scaler(scaler, !fullscreen_enabled) && // try new fullscreen state
!init_any_scaler(!fullscreen_enabled) && // try any scaler in new fullscreen state
!init_scaler(scaler, fullscreen_enabled)) // revert on fail
{
exit(EXIT_FAILURE);
}
break;
}
/* <alt><tab> disable input grab and fullscreen */
if (ev.key.keysym.sym == SDLK_TAB)
{
input_grab_enabled = false;
input_grab();
if (!init_scaler(scaler, false) && // try windowed
!init_any_scaler(false) && // try any scaler windowed
!init_scaler(scaler, fullscreen_enabled)) // revert on fail
{
exit(EXIT_FAILURE);
}
break;
}
}
newkey = true;
lastkey_sym = ev.key.keysym.sym;
lastkey_mod = (SDLMod)ev.key.keysym.mod;
lastkey_char = ev.key.keysym.unicode;
keydown = true;
return;
case SDL_KEYUP:
keydown = false;
return;
case SDL_MOUSEBUTTONDOWN:
if (!input_grabbed)
{
input_grab_enabled = !input_grab_enabled;
input_grab();
break;
}
case SDL_MOUSEBUTTONUP:
if (ev.type == SDL_MOUSEBUTTONDOWN)
{
newmouse = true;
lastmouse_but = ev.button.button;
lastmouse_x = ev.button.x * vga_width / scalers[scaler].width;
lastmouse_y = ev.button.y * vga_height / scalers[scaler].height;
mousedown = true;
}
else
{
mousedown = false;
}
switch (ev.button.button)
{
case SDL_BUTTON_LEFT:
mouse_pressed[0] = mousedown; break;
case SDL_BUTTON_RIGHT:
mouse_pressed[1] = mousedown; break;
case SDL_BUTTON_MIDDLE:
mouse_pressed[2] = mousedown; break;
}
break;
case SDL_QUIT:
JE_cleanup();
exit(0);
break;
}
}
}
void JE_clearKeyboard( void )
{
// /!\ Doesn't seems important. I think. D:
}
// kate: tab-width 4; vim: set noet:
|
#ifndef __LINSCHED_UNISTD_H
#define __LINSCHED_UNISTD_H
#include <asm-generic/unistd.h>
#endif
|
#pragma config(Hubs, S1, HTMotor, HTMotor, none, none)
#pragma config(Hubs, S1, HTMotor, HTMotor, HTMotor, HTMotor)
#pragma config(Hubs, S3, HTServo, HTServo, none, none)
#pragma config(Sensor, S1, motors, sensorNone)
#pragma config(Sensor, S2, SMUX, sensorI2CCustom9V)
#pragma config(Sensor, S3, servos, sensorNone)
#pragma config(Sensor, S4, gyroSensor, sensorI2CHiTechnicGyro)
#pragma config(Motor, motorA, flagMotorA, tmotorNXT, openLoop, encoder)
#pragma config(Motor, motorB, flagMotorB, tmotorNXT, openLoop, reversed, encoder)
#pragma config(Motor, motorC, , tmotorNXT, openLoop, encoder)
#pragma config(Motor, mtr_S1_C1_1, leftFrontMotor, tmotorTetrix, openLoop, reversed)
#pragma config(Motor, mtr_S1_C1_2, leftRearMotor, tmotorTetrix, openLoop, reversed, encoder)
#pragma config(Motor, mtr_S1_C2_1, rightFrontMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C2_2, rightRearMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_1, spinnerMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C3_2, liftMotor, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C4_1, rightWinch, tmotorTetrix, openLoop)
#pragma config(Motor, mtr_S1_C4_2, leftWinch, tmotorTetrix, openLoop, reversed)
#pragma config(Servo, srvo_S3_C1_1, leftHook, tServoStandard)
#pragma config(Servo, srvo_S3_C1_2, rightHook, tServoStandard)
#pragma config(Servo, srvo_S3_C1_3, unusedS3C13, tServoStandard)
#pragma config(Servo, srvo_S3_C1_4, unusedS3C14, tServoStandard)
#pragma config(Servo, srvo_S3_C1_5, unusedS3C15, tServoStandard)
#pragma config(Servo, srvo_S3_C1_6, unusedS3C16, tServoStandard)
#pragma config(Servo, srvo_S3_C2_1, leftHopper, tServoStandard)
#pragma config(Servo, srvo_S3_C2_2, rightHopper, tServoStandard)
#pragma config(Servo, srvo_S3_C2_3, unusedS3C23, tServoStandard)
#pragma config(Servo, srvo_S3_C2_4, unusedS3C24, tServoStandard)
#pragma config(Servo, srvo_S3_C2_5, unusedS3C25, tServoStandard)
#pragma config(Servo, srvo_S3_C2_6, unusedS3C26, tServoStandard)
//*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
///// MAIN TASK /////
task main() {
// Read the battery voltages in volts
float nxt_battery = (float)nAvgBatteryLevel / 1000.0;
float motor_battery = (float)externalBatteryAvg / 1000.0;
if (motor_battery < 1) {
motor_battery = 0;
}
// Clear the display
eraseDisplay();
// Display the battery voltages
nxtDisplayString(2, "NXT: %.2f", nxt_battery);
nxtDisplayString(4, "Motor: %.2f", motor_battery);
// Wait 10 seconds before exiting
wait1Msec(10 * 1000);
}
|
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id: read_image.c 22232 2009-08-09 22:20:14Z bertrik $
*
* Copyright (C) 2009 by Andrew Mahone
*
* This is a wrapper for the core jpeg_load.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 software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
****************************************************************************/
#include <plugin.h>
#include "feature_wrappers.h"
#include "read_image.h"
int read_image_file(const char* filename, struct bitmap *bm, int maxsize,
int format, const struct custom_format *cformat)
{
int namelen = rb->strlen(filename);
if (rb->strcmp(filename + namelen - 4, ".bmp"))
return read_jpeg_file(filename, bm, maxsize, format, cformat);
else
return scaled_read_bmp_file(filename, bm, maxsize, format, cformat);
}
|
/*
* Copyright (C) 2003-2016 SICOM Systems, INC.
*
* Authors: Bob Doan <bdoan@sicompos.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <stdio.h>
#include <rlib.h>
#include <rlib_input.h>
struct _data {
char name[MAXSTRLEN];
char address[MAXSTRLEN];
};
int main(int argc, char **argv) {
char *conn;
rlib *r;
if(argc != 2) {
fprintf(stderr, "%s requires 2 arguments POSTGRES conn str\n", argv[0]);
fprintf(stderr, "You provided %d\n", argc-1);
return -1;
}
conn = argv[1];
fprintf(stderr, "CONN IS %s\n", conn);
r = rlib_init();
rlib_add_datasource_postgres(r, "local_postgres", conn);
rlib_add_query_as(r, "local_postgres", "select * from example", "example");
rlib_add_report(r, "report.xml");
rlib_set_output_format(r, RLIB_FORMAT_PDF);
rlib_execute(r);
rlib_spool(r);
rlib_free(r);
return 0;
}
|
/*
Author bobness09, Mail bobnessdev@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef walkeratelemout_h
#define walkeratelemout_h
#include <FastSerial.h>
#include "SimpleTelemetry.h"
#include <SoftwareSerial.h>
/*
* DEVO-M Dataframe
* ----------------------------
*
* Length : 20 Bytes
* Syncbyte : 0xAA
* Payload with Checksum : 19 Bytes
* Checksum : crc8 accumulate uint8_t
*
* 0xAA : byte 01 : <sync header>
* 0xD7 : byte 02 : <gps longitude int32_t lowest byte>
* 0x60 : byte 03 : <gps longitude int32_t>
* 0xF5 : byte 04 : <gps longitude int32_t>
* 0x1E : byte 05 : <gps longitude int32_t highest byte>
* 0x0A : byte 06 : <gps lattitude int32_t lowest byte>
* 0x96 : byte 07 : <gps lattitude int32_t>
* 0x89 : byte 08 : <gps lattitude int32_t>
* 0x04 : byte 09 : <gps lattitude int32_t highest byte>
* 0x76 : byte 10 : <gps altitude int32_t lowest byte>
* 0x00 : byte 11 : <gps altitude int32_t>
* 0x00 : byte 12 : <gps altitude int32_t>
* 0x00 : byte 13 : <gps altitude int32_t highest byte>
* 0x00 : byte 14 : <gps ground speed uint16_t lowest byte>
* 0x00 : byte 15 : <gps ground speed uint16_t highest byte>
* 0x00 : byte 16 : <unknown value uint16_t lowest byte>
* 0x00 : byte 17 : <unknown value uint16_t highest byte>
* 0x52 : byte 18 : <voltage in millivolts uint16_t lower byte>
* 0x30 : byte 19 : <voltage in millivolts uint16_t upper byte>
* 0x19 : byte 20 : <crc8 checksum over byte 1-19>
*
*/
#define DEVOM_DATA_LENGTH 18
#define DEVOM_SYNC_BYTE 0xAA
#pragma pack(push, 1)
typedef struct {
uint8_t header; ///< 0xAA for a valid packet
uint8_t data[DEVOM_DATA_LENGTH]; ///< ChannelData
uint8_t crc8; ///< CRC8
} DevoMPacket;
#pragma pack(pop)
class WalkeraTelem
{
public:
WalkeraTelem();
~WalkeraTelem(void);
void sendFrSky5Hz(SoftwareSerial* serialPort, ITelemDataProvider* dataProvider);
void sendTelemetry(SoftwareSerial* serialPort, ITelemDataProvider* dataProvider);
void sendFrSky05Hz(SoftwareSerial* serialPort, ITelemDataProvider* dataProvider);
void printValues(SoftwareSerial* debugSerial, ITelemDataProvider* dataProvider);
private:
DevoMPacket devoPacket;
byte lsByte(int value);
byte s8Byte(int value);
byte s16Byte(int32_t value);
byte s24Byte(int32_t value);
void writeToPort(SoftwareSerial* serialPort, uint8_t writeByte);
void sendWalkeraBuffer(SoftwareSerial* serialPort);
};
#endif
|
/*
* boxes - Command line filter to draw/remove ASCII boxes around text
* Copyright (c) 1999-2021 Thomas Jensen and the boxes contributors
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License, version 2, as published
* by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/
/*
* Discovery of the configuration file.
*/
#ifndef BOXES_DISCOVERY_H
#define BOXES_DISCOVERY_H
char *discover_config_file(const int global_only);
#endif /* BOXES_DISCOVERY_H */
/*EOF*/ /* vim: set cindent sw=4: */
|
/**
* Maxima, a chess playing program.
* Copyright (C) 1996-2015 Erik van het Hof and Hermen Reitsma
*
* 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, If not, see <http://www.gnu.org/licenses/>.
*
* File: timeman.h
* Time Manager, calculating how much time to spent on thinking, this is roughly
* the time left shared by the amount of moves left. The amount of moves
* left is assumed to be no more than 30.
* In emergency situations more time can be used. For easy moves less time can be used.
*
* Created on 16 mei 2011, 22:37
*/
#ifndef TIMEMAN_H
#define TIMEMAN_H
#include "bits.h"
class time_manager_t;
namespace time_man {
const double ONE_MS = CLOCKS_PER_SEC / 1000;
const int INFINITE_TIME = 24 * 60 * 60 * 1000;
const int M = 24; //assume game is decided after M moves from now
const int M_MIN = M*2;
const int M_MAX = M/4;
const int M_MIN_LOW_TIME = M*4;
const int M_MAX_LOW_TIME = M;
const int LOW_TIME = 60000; //one minute
const int LAG_TIME = 50; //interface + initialization lag time in ms per move
};
class time_manager_t {
private:
clock_t start; //in ticks
clock_t min; //minimum time to use, in ticks
clock_t max; //maximum time to use, in ticks
int tot_min;
int tot_max;
public:
time_manager_t();
void clear();
void set(const int my_time, const int opp_time, const int my_inc, const int opp_inc, const int moves_left);
clock_t ticks(const int time_in_ms) {
return time_in_ms * time_man::ONE_MS;
}
void set_start() {
start = clock();
}
void set_min(const int ms) {
min = start + ticks(ms);
}
void set_max(const int ms) {
max = start + ticks(ms);
}
int get_min() {
return min;
}
bool time_is_up() {
return clock() >= max;
}
int elapsed() {
clock_t ticks = clock() - start;
return ticks / time_man::ONE_MS;
}
int reserved_min() {
if (tot_min <= 0) {
tot_min = (min - start) / time_man::ONE_MS;
}
return tot_min;
}
int reserved_max() {
if (tot_max <= 0) {
tot_max = (max - start) / time_man::ONE_MS;
}
return tot_max;
}
};
#endif /* TIMEMANAGER_H */
|
/*
* Copyright (C) 2003-2013 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef PCM_CONVERT_H
#define PCM_CONVERT_H
#include "pcm_dsd.h"
#include "pcm_resample.h"
#include "pcm_dither.h"
#include "pcm_buffer.h"
#include <glib.h>
struct audio_format;
/**
* This object is statically allocated (within another struct), and
* holds buffer allocations and the state for all kinds of PCM
* conversions.
*/
struct pcm_convert_state {
struct pcm_dsd dsd;
struct pcm_resample_state resample;
struct pcm_dither dither;
/** the buffer for converting the sample format */
struct pcm_buffer format_buffer;
/** the buffer for converting the channel count */
struct pcm_buffer channels_buffer;
};
static inline GQuark
pcm_convert_quark(void)
{
return g_quark_from_static_string("pcm_convert");
}
G_BEGIN_DECLS
/**
* Initializes a pcm_convert_state object.
*/
void pcm_convert_init(struct pcm_convert_state *state);
/**
* Deinitializes a pcm_convert_state object and frees allocated
* memory.
*/
void pcm_convert_deinit(struct pcm_convert_state *state);
/**
* Reset the pcm_convert_state object. Use this at the boundary
* between two distinct songs and each time the format changes.
*/
void
pcm_convert_reset(struct pcm_convert_state *state);
/**
* Converts PCM data between two audio formats.
*
* @param state an initialized pcm_convert_state object
* @param src_format the source audio format
* @param src the source PCM buffer
* @param src_size the size of #src in bytes
* @param dest_format the requested destination audio format
* @param dest_size_r returns the number of bytes of the destination buffer
* @param error_r location to store the error occurring, or NULL to
* ignore errors
* @return the destination buffer, or NULL on error
*/
const void *
pcm_convert(struct pcm_convert_state *state,
const struct audio_format *src_format,
const void *src, size_t src_size,
const struct audio_format *dest_format,
size_t *dest_size_r,
GError **error_r);
G_END_DECLS
#endif
|
/*____________________________________________________________________________
FreeAmp - The Free MP3 Player
Portions Copyright (C) 1998-1999 EMusic.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
$Id: win32impl.h,v 1.4 2000/05/24 17:08:33 ijr Exp $
____________________________________________________________________________*/
#ifndef INCLUDED_WIN32IMPL_H_
#define INCLUDED_WIN32IMPL_H_
#include "config.h"
class FILETIME {
public:
int32 dwLowDateTime;
int32 dwHighDateTime;
};
#define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
#define FILE_ATTRIBUTE_NORMAL 0x00000080L
/* Not in Win32, but something is needed to indicate a symlink */
#define FILE_ATTRIBUTE_SYMLINK 0x00000040L
class WIN32_FIND_DATA {
public:
int32 dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
int32 nFileSizeHigh;
int32 nFileSizeLow;
int32 dwReserved0;
int32 dwReserved1;
char cFileName[ MAX_PATH ];
char cAlternateFileName[ 14 ];
};
typedef void *HANDLE;
#define INVALID_HANDLE_VALUE ((HANDLE)-1)
typedef void *HMODULE;
#define HINSTANCE HMODULE
typedef void *FARPROC;
HANDLE FindFirstFile(char *lpFileName, WIN32_FIND_DATA *lpFindFileData);
bool FindNextFile(HANDLE hFindFile, WIN32_FIND_DATA *lpFindFileData);
bool FindClose(HANDLE hFindFile);
HINSTANCE LoadLibrary(char *lpLibFileName);
bool FreeLibrary(HMODULE hLibModule);
FARPROC GetProcAddress(HMODULE hModule, const char *lpProcName);
#endif
|
/* $Id: spp_arpspoof.h,v 1.17 2015/04/23 18:28:10 jocornet Exp $ */
/*
** Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved.
** Copyright (C) 2003-2013 Sourcefire, Inc.
** Copyright (C) 2001-2003 Jeff Nathan <jeff@snort.org>
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License Version 2 as
** published by the Free Software Foundation. You may not use, modify or
** distribute this program under any other version of the GNU General
** Public License.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/* Snort ARPspoof Preprocessor Plugin
* by Jeff Nathan <jeff@snort.org>
* Version 0.1.3
*/
#ifndef __SPP_ARPSPOOF_H__
#define __SPP_ARPSPOOF_H__
void SetupARPspoof(void);
#endif /* __SPP_ARPSPOOF_H__ */
|
/*
* Copyright (C) 2006 Christoph Hohmann
*
* 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 PINENTRY_H
#define PINENTRY_H
char *getpin(char *desc, char *prompt);
#endif
|
/*
* MP3 decoding support using libmpg123, loosely based on an SDL_mixer
* See: http://bubu.lv/changeset/4/public/libs/SDL/generated/SDL_mixer
*
* Copyright (C) 2011-2012 O.Sezer <sezero@users.sourceforge.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "quakedef.h"
#if defined(USE_CODEC_MP3)
#include "snd_codec.h"
#include "snd_codeci.h"
#include "snd_mp3.h"
#include <errno.h>
#define MPG123_DEF_SSIZE_T /* we do define ssize_t in our stdinc.h */
#include <mpg123.h>
#if !defined(MPG123_API_VERSION) || (MPG123_API_VERSION < 24)
#error minimum required libmpg123 version is 1.12.0 (api version 24)
#endif /* MPG123_API_VERSION */
/* Private data */
typedef struct _mp3_priv_t
{
int handle_newed, handle_opened;
mpg123_handle* handle;
} mp3_priv_t;
/* CALLBACK FUNCTIONS: */
/* CAREFUL: libmpg123 expects POSIX read() and lseek() behavior,
* however our FS_fread() and FS_fseek() return fread() and fseek()
* compatible values. */
static ssize_t mp3_read (void *f, void *buf, size_t size)
{
ssize_t ret = (ssize_t) FS_fread(buf, 1, size, (fshandle_t *)f);
if (ret == 0 && errno != 0)
ret = -1;
return ret;
}
static off_t mp3_seek (void *f, off_t offset, int whence)
{
if (f == NULL) return (-1);
if (FS_fseek((fshandle_t *)f, (long) offset, whence) < 0)
return (off_t)-1;
return (off_t) FS_ftell((fshandle_t *)f);
}
static qboolean S_MP3_CodecInitialize (void)
{
if (!mp3_codec.initialized)
{
if (mpg123_init() != MPG123_OK)
{
Con_Printf ("Could not initialize mpg123\n");
return false;
}
mp3_codec.initialized = true;
return true;
}
return true;
}
static void S_MP3_CodecShutdown (void)
{
if (mp3_codec.initialized)
{
mp3_codec.initialized = false;
mpg123_exit();
}
}
static qboolean S_MP3_CodecOpenStream (snd_stream_t *stream)
{
long rate = 0;
int encoding = 0, channels = 0;
mp3_priv_t *priv = NULL;
stream->priv = Z_Malloc(sizeof(mp3_priv_t));
priv = (mp3_priv_t *) stream->priv;
priv->handle = mpg123_new(NULL, NULL);
if (priv->handle == NULL)
{
Con_Printf("Unable to allocate mpg123 handle\n");
goto _fail;
}
priv->handle_newed = 1;
if (mpg123_replace_reader_handle(priv->handle, mp3_read, mp3_seek, NULL) != MPG123_OK ||
mpg123_open_handle(priv->handle, &stream->fh) != MPG123_OK)
{
Con_Printf("Unable to open mpg123 handle\n");
goto _fail;
}
priv->handle_opened = 1;
if (mpg123_getformat(priv->handle, &rate, &channels, &encoding) != MPG123_OK)
{
Con_Printf("Unable to retrieve mpg123 format for %s\n", stream->name);
goto _fail;
}
switch (channels)
{
case MPG123_MONO:
stream->info.channels = 1;
break;
case MPG123_STEREO:
stream->info.channels = 2;
break;
default:
Con_Printf("Unsupported number of channels %d in %s\n", channels, stream->name);
goto _fail;
}
stream->info.rate = rate;
switch (encoding)
{
case MPG123_ENC_UNSIGNED_8:
stream->info.bits = 8;
stream->info.width = 1;
break;
case MPG123_ENC_SIGNED_8:
/* unsupported: force mpg123 to convert */
stream->info.bits = 8;
stream->info.width = 1;
encoding = MPG123_ENC_UNSIGNED_8;
break;
case MPG123_ENC_SIGNED_16:
stream->info.bits = 16;
stream->info.width = 2;
break;
case MPG123_ENC_UNSIGNED_16:
default:
/* unsupported: force mpg123 to convert */
stream->info.bits = 16;
stream->info.width = 2;
encoding = MPG123_ENC_SIGNED_16;
break;
}
if (mpg123_format_support(priv->handle, rate, encoding) == 0)
{
Con_Printf("Unsupported format for %s\n", stream->name);
goto _fail;
}
mpg123_format_none(priv->handle);
mpg123_format(priv->handle, rate, channels, encoding);
return true;
_fail:
if (priv)
{
if (priv->handle_opened)
mpg123_close(priv->handle);
if (priv->handle_newed)
mpg123_delete(priv->handle);
Z_Free(stream->priv);
}
return false;
}
static int S_MP3_CodecReadStream (snd_stream_t *stream, int bytes, void *buffer)
{
mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
size_t bytes_read = 0;
int res = mpg123_read (priv->handle, (unsigned char *)buffer, (size_t)bytes, &bytes_read);
switch (res)
{
case MPG123_DONE:
Con_DPrintf("mp3 EOF\n");
case MPG123_OK:
return (int)bytes_read;
}
return -1; /* error */
}
static void S_MP3_CodecCloseStream (snd_stream_t *stream)
{
mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
mpg123_close(priv->handle);
mpg123_delete(priv->handle);
Z_Free(stream->priv);
S_CodecUtilClose(&stream);
}
static int S_MP3_CodecRewindStream (snd_stream_t *stream)
{
mp3_priv_t *priv = (mp3_priv_t *) stream->priv;
off_t res = mpg123_seek(priv->handle, 0, SEEK_SET);
if (res >= 0) return (0);
return res;
}
snd_codec_t mp3_codec =
{
CODECTYPE_MP3,
false,
"mp3",
S_MP3_CodecInitialize,
S_MP3_CodecShutdown,
S_MP3_CodecOpenStream,
S_MP3_CodecReadStream,
S_MP3_CodecRewindStream,
S_MP3_CodecCloseStream,
NULL
};
#endif /* USE_CODEC_MP3 */
|
#ifndef _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
#define _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_
#define __const_hweight8(w) \
( (!!((w) & (1ULL << 0))) + \
(!!((w) & (1ULL << 1))) + \
(!!((w) & (1ULL << 2))) + \
(!!((w) & (1ULL << 3))) + \
(!!((w) & (1ULL << 4))) + \
(!!((w) & (1ULL << 5))) + \
(!!((w) & (1ULL << 6))) + \
(!!((w) & (1ULL << 7))) )
#define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
#define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
#define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
#define hweight8(w) (__builtin_constant_p(w) ? __const_hweight8(w) : __arch_hweight8(w))
#define hweight16(w) (__builtin_constant_p(w) ? __const_hweight16(w) : __arch_hweight16(w))
#define hweight32(w) (__builtin_constant_p(w) ? __const_hweight32(w) : __arch_hweight32(w))
#define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
#define HWEIGHT8(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight8(w))
#define HWEIGHT16(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight16(w))
#define HWEIGHT32(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight32(w))
#define HWEIGHT64(w) (BUILD_BUG_ON_ZERO(!__builtin_constant_p(w)) + __const_hweight64(w))
#define HWEIGHT(w) HWEIGHT64((u64)w)
#endif /* _ASM_GENERIC_BITOPS_CONST_HWEIGHT_H_ */
|
/* Pascal language support definitions for GDB, the GNU debugger.
Copyright (C) 2000, 2005, 2006, 2007, 2008, 2009, 2010, 2011
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This file is derived from c-lang.h */
struct value;
/* Defined in p-lang.c */
extern const char *pascal_main_name (void);
extern int pascal_parse (void); /* Defined in p-exp.y */
extern void pascal_error (char *); /* Defined in p-exp.y */
/* Defined in p-typeprint.c */
extern void pascal_print_type (struct type *, const char *, struct ui_file *,
int, int);
extern void pascal_print_typedef (struct type *, struct symbol *,
struct ui_file *);
extern int pascal_val_print (struct type *, const gdb_byte *, int,
CORE_ADDR, struct ui_file *, int,
const struct value *,
const struct value_print_options *);
extern int pascal_value_print (struct value *, struct ui_file *,
const struct value_print_options *);
extern void pascal_type_print_method_args (const char *, const char *,
struct ui_file *);
/* These are in p-lang.c: */
extern int
is_pascal_string_type (struct type *, int *, int *, int *,
struct type **, char **);
extern void pascal_printchar (int, struct type *, struct ui_file *);
extern void pascal_printstr (struct ui_file *, struct type *, const gdb_byte *,
unsigned int, const char *, int,
const struct value_print_options *);
extern struct type **const (pascal_builtin_types[]);
/* These are in p-typeprint.c: */
extern void
pascal_type_print_base (struct type *, struct ui_file *, int, int);
extern void
pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int);
extern void pascal_object_print_value_fields (struct type *, const gdb_byte *,
int,
CORE_ADDR, struct ui_file *,
int,
const struct value *,
const struct value_print_options *,
struct type **, int);
extern int pascal_object_is_vtbl_ptr_type (struct type *);
extern int pascal_object_is_vtbl_member (struct type *);
|
/* vi: set sw=4 ts=4: */
/*
* xreadlink.c - safe implementation of readlink.
* Returns a NULL on failure...
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
#include "libbb.h"
/* some systems (eg Hurd) does not have MAXSYMLINKS definition,
* set it to some reasonable value if it isn't defined */
#ifndef MAXSYMLINKS
# define MAXSYMLINKS 20
#endif
/*
* NOTE: This function returns a malloced char* that you will have to free
* yourself.
*/
char* FAST_FUNC xmalloc_readlink(const char *path)
{
enum { GROWBY = 80 }; /* how large we will grow strings by */
char *buf = NULL;
int bufsize = 0, readsize = 0;
do {
bufsize += GROWBY;
buf = xrealloc(buf, bufsize);
readsize = readlink(path, buf, bufsize);
if (readsize == -1) {
free(buf);
return NULL;
}
} while (bufsize < readsize + 1);
buf[readsize] = '\0';
return buf;
}
/*
* This routine is not the same as realpath(), which
* canonicalizes the given path completely. This routine only
* follows trailing symlinks until a real file is reached and
* returns its name. If the path ends in a dangling link or if
* the target doesn't exist, the path is returned in any case.
* Intermediate symlinks in the path are not expanded -- only
* those at the tail.
* A malloced char* is returned, which must be freed by the caller.
*/
char* FAST_FUNC xmalloc_follow_symlinks(const char *path)
{
char *buf;
char *lpc;
char *linkpath;
int bufsize;
int looping = MAXSYMLINKS + 1;
buf = xstrdup(path);
goto jump_in;
while (1) {
linkpath = xmalloc_readlink(buf);
if (!linkpath) {
/* not a symlink, or doesn't exist */
if (errno == EINVAL || errno == ENOENT)
return buf;
goto free_buf_ret_null;
}
if (!--looping) {
free(linkpath);
free_buf_ret_null:
free(buf);
return NULL;
}
if (*linkpath != '/') {
bufsize += strlen(linkpath);
buf = xrealloc(buf, bufsize);
lpc = bb_get_last_path_component_strip(buf);
strcpy(lpc, linkpath);
free(linkpath);
} else {
free(buf);
buf = linkpath;
jump_in:
bufsize = strlen(buf) + 1;
}
}
}
char* FAST_FUNC xmalloc_readlink_or_warn(const char *path)
{
char *buf = xmalloc_readlink(path);
if (!buf) {
/* EINVAL => "file: Invalid argument" => puzzled user */
const char *errmsg = "not a symlink";
int err = errno;
if (err != EINVAL)
errmsg = strerror(err);
bb_error_msg("%s: cannot read link: %s", path, errmsg);
}
return buf;
}
char* FAST_FUNC xmalloc_realpath(const char *path)
{
#if defined(__GLIBC__) && \
(!defined(__UCLIBC__) || UCLIBC_VERSION >= KERNEL_VERSION(0, 9, 31))
/* glibc provides a non-standard extension */
/* new: POSIX.1-2008 specifies this behavior as well */
return realpath(path, NULL);
#else
char buf[PATH_MAX+1];
/* on error returns NULL (xstrdup(NULL) == NULL) */
return xstrdup(realpath(path, buf));
#endif
}
|
/****************************************************************
* *
* Copyright 2001 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
#include "hashdef.h"
#include "lv_val.h"
#include "toktyp.h"
#include "compiler.h"
#include "opcode.h"
#include "indir_enum.h"
#include "mdq.h"
#include "advancewindow.h"
#include "cache.h"
#include "op.h"
#include "underr.h"
GBLREF char window_token, director_token;
GBLREF mident window_ident;
GBLREF mval **ind_source_sp, **ind_source_top;
GBLREF mval **ind_result_sp, **ind_result_top;
GBLREF bool shift_gvrefs;
GBLREF triple *expr_start;
void op_indo2(mval *dst, mval *target, mval *value)
{
error_def(ERR_INDMAXNEST);
error_def(ERR_VAREXPECTED);
bool rval;
mstr object, *obj;
oprtype v, sav_opr;
triple *s, *src, *oldchain, tmpchain, *r;
MV_FORCE_DEFINED(value);
MV_FORCE_STR(target);
if (!(obj = cache_get(indir_fnorder2, &target->str)))
{
comp_init(&target->str);
src = newtriple(OC_IGETSRC);
s = maketriple(OC_NOOP); /* we'll fill it in as we go along */
switch (window_token)
{
case TK_IDENT:
if (director_token != TK_LPAREN)
{ s->opcode = OC_FNLVNAMEO2;
s->operand[0] = put_str(&window_ident.c[0],sizeof(mident));
s->operand[1] = put_tref(src);
ins_triple(s);
advancewindow();
rval = TRUE;
break;
}
if (rval = lvn(&s->operand[0], OC_SRCHINDX, s))
{
s->opcode = OC_FNO2;
sav_opr = s->operand[1];
r = newtriple(OC_PARAMETER);
r->operand[0] = sav_opr;
r->operand[1] = put_tref(src);
s->operand[1] = put_tref(r);
ins_triple(s);
}
break;
case TK_CIRCUMFLEX:
if (rval = gvn())
{
s->opcode = OC_GVO2;
s->operand[0] = put_tref(src);
ins_triple(s);
}
break;
case TK_ATSIGN:
if (shift_gvrefs)
{
dqinit(&tmpchain, exorder);
oldchain = setcurtchain(&tmpchain);
if (rval = indirection(&s->operand[0]))
{
s->opcode = OC_INDO2;
s->operand[1] = put_tref(src);
ins_triple(s);
newtriple(OC_GVSAVTARG);
setcurtchain(oldchain);
dqadd(expr_start, &tmpchain, exorder);
expr_start = tmpchain.exorder.bl;
r = newtriple(OC_GVRECTARG);
r->operand[0] = put_tref(expr_start);
}
else
{ setcurtchain(oldchain);
}
}
else
{
if (rval = indirection(&s->operand[0]))
{
s->opcode = OC_INDO2;
s->operand[1] = put_tref(src);
ins_triple(s);
}
}
break;
default:
stx_error(ERR_VAREXPECTED);
break;
}
v = put_tref(s);
if (comp_fini(rval, &object, OC_IRETMVAL, &v, target->str.len))
{ cache_put(indir_fnorder2, &target->str, &object);
if (ind_source_sp + 1 >= ind_source_top || ind_result_sp + 1 >= ind_result_top)
rts_error(VARLSTCNT(1) ERR_INDMAXNEST);
*ind_result_sp++ = dst;
*ind_source_sp++ = value;
comp_indr(&object);
}
}
else
{
if (ind_source_sp + 1 >= ind_source_top || ind_result_sp + 1 >= ind_result_top)
rts_error(VARLSTCNT(1) ERR_INDMAXNEST);
*ind_result_sp++ = dst;
*ind_source_sp++ = value;
comp_indr(obj);
}
}
|
/* Hey EMACS -*- linux-c -*- */
/* $Id: clist.h 4392 2011-08-01 09:24:05Z debrouxl $ */
/* TiLP - Tilp Is a Linking Program
* Copyright (C) 1999-2006 Romain Lievin
*
* 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 __CLIST_H__
#define __CLIST_H__
void clist_init(void);
void clist_refresh(void);
void clist_selection_refresh(void);
#endif
|
//
// Copyright (C) 2006-2011 Christoph Sommer <christoph.sommer@uibk.ac.at>
//
// Documentation for these modules is at http://veins.car2x.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 TraCIRVVmap11p_H
#define TraCIRVVmap11p_H
#include "veins/modules/application/ieee80211p/BaseWaveApplLayer.h"
#include "veins/modules/mobility/traci/TraCIMobility.h"
#include "veins/modules/mobility/traci/TraCICommandInterface.h"
using Veins::TraCIMobility;
using Veins::TraCICommandInterface;
using Veins::AnnotationManager;
/**
* Small IVC Demo using 11p
*/
class TraCIRVVmap11p : public BaseWaveApplLayer {
public:
virtual void initialize(int stage);
virtual void receiveSignal(cComponent* source, simsignal_t signalID, cObject* obj);
class Statistics {
public:
//Basic stats
cOutVector xCoord;
cOutVector yCoord;
cOutVector zCoord;
void initialize();
};
enum WaveApplMessageKinds {
SERVICE_PROVIDER = LAST_BASE_APPL_MESSAGE_KIND,
SEND_BEACON_EVT,
SEND_HELLO
};
protected:
TraCIMobility* mobility;
TraCICommandInterface* traci;
TraCICommandInterface::Vehicle* traciVehicle;
AnnotationManager* annotations;
simtime_t lastDroveAt;
bool sentMessage;
bool isParking;
bool sendWhileParking;
static const simsignalwrap_t parkingStateChangedSignal;
static const simsignalwrap_t neighbors;
cMessage* sendHelloTimer;
int capacity;
double probCH;
//create the maps of neighbors
std::map<int, double> neighborsdDistCalc;
std::map<int, simtime_t> neighborsdTime;
Statistics statistics;
protected:
virtual void onBeacon(WaveShortMessage* wsm);
virtual void onData(WaveShortMessage* wsm);
void sendMessage(std::string blockedRoadId);
void sendRVVMessage(std::string type, int toNode);
virtual void handlePositionUpdate(cObject* obj);
virtual void handleParkingUpdate(cObject* obj);
virtual void sendWSM(WaveShortMessage* wsm);
virtual void handleSelfMsg(cMessage* msg);
virtual void handleLowerMsg(cMessage* msg);
void updateInfo(WaveShortMessage* data);
void changeNodeState();
double calcUtility(double sqrD);
};
#endif
|
/* Add subsystem definitions of the form SUBSYS(<name>) in this
* file. Surround each one by a line of comment markers so that
* patches don't collide
*/
/* */
/* */
#ifdef CONFIG_CPUSETS
SUBSYS(cpuset)
#endif
/* */
#ifdef CONFIG_CGROUP_DEBUG
SUBSYS(debug)
#endif
/* */
#ifdef CONFIG_CGROUP_NS
SUBSYS(ns)
#endif
/* */
#ifdef CONFIG_CGROUP_SCHED
SUBSYS(cpu_cgroup)
#endif
/* */
#ifdef CONFIG_CGROUP_CPUACCT
SUBSYS(cpuacct)
#endif
/* */
#ifdef CONFIG_CGROUP_MEM_RES_CTLR
SUBSYS(mem_cgroup)
#endif
/* */
#ifdef CONFIG_CGROUP_DEVICE
SUBSYS(devices)
#endif
/* */
#ifdef CONFIG_CGROUP_FREEZER
SUBSYS(freezer)
#endif
/* */
#ifdef CONFIG_NET_CLS_CGROUP
SUBSYS(net_cls)
#endif
/* */
#ifdef CONFIG_CGROUP_BFQIO
SUBSYS(bfqio)
#endif
/* */
|
/* Driver for routine flmoon */
#include <stdio.h>
#define NRANSI
#include "nr.h"
#define ZON (-5.0)
int main(void)
{
int i,i1,i2,i3,id,im,iy,n,nph=2;
float timzon=ZON/24.0,frac,secs;
long j1,j2;
static char *phase[]={"new moon","first quarter",
"full moon","last quarter"};
printf("Date of the next few phases of the moon\n");
printf("Enter today\'s date (e.g. 12 15 1992) : \n");
scanf("%d %d %d",&im,&id,&iy);
/* Approximate number of full moons since january 1900 */
n=(int)(12.37*(iy-1900+((im-0.5)/12.0)));
j1=julday(im,id,iy);
flmoon(n,nph,&j2,&frac);
n += (int) ((j1-j2)/29.53 + (j1 >= j2 ? 0.5 : -0.5));
printf("\n%10s %19s %9s\n","date","time(EST)","phase");
for (i=1;i<=20;i++) {
flmoon(n,nph,&j2,&frac);
frac=24.0*(frac+timzon);
if (frac < 0.0) {
--j2;
frac += 24.0;
}
if (frac > 12.0) {
++j2;
frac -= 12.0;
} else
frac += 12.0;
i1=(int) frac;
secs=3600.0*(frac-i1);
i2=(int) (secs/60.0);
i3=(int) (secs-60*i2+0.5);
caldat(j2,&im,&id,&iy);
printf("%5d %3d %5d %7d:%2d:%2d %s\n",
im,id,iy,i1,i2,i3,phase[nph]);
if (nph == 3) {
nph=0;
++n;
} else
++nph;
}
return 0;
}
#undef NRANSI
|
#include <linux/moduleloader.h>
#include <linux/elf.h>
#include <linux/vmalloc.h>
#include <linux/fs.h>
#include <linux/string.h>
#include <linux/kernel.h>
#if 0
#define DEBUGP printk
#else
#define DEBUGP(fmt...)
#endif
void *module_alloc(unsigned long size)
{
if (size == 0)
return NULL;
return vmalloc(size);
}
/* Free memory returned from module_alloc */
void module_free(struct module *mod, void *module_region)
{
vfree(module_region);
}
/* We don't need anything special. */
int module_frob_arch_sections(Elf_Ehdr *hdr,
Elf_Shdr *sechdrs,
char *secstrings,
struct module *mod)
{
return 0;
}
int apply_relocate(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
unsigned int i;
Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr;
Elf32_Sym *sym;
uint32_t *location;
DEBUGP("Applying relocate section %u to %u\n", relsec,
sechdrs[relsec].sh_info);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
/* This is where to make the change */
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset;
/* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rel[i].r_info);
switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_68K_32:
/* We add the value into the location given */
*location += sym->st_value;
break;
case R_68K_PC32:
/* Add the value, subtract its postition */
*location += sym->st_value - (uint32_t)location;
break;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC;
}
}
return 0;
}
int apply_relocate_add(Elf32_Shdr *sechdrs,
const char *strtab,
unsigned int symindex,
unsigned int relsec,
struct module *me)
{
unsigned int i;
Elf32_Rela *rel = (void *)sechdrs[relsec].sh_addr;
Elf32_Sym *sym;
uint32_t *location;
DEBUGP("Applying relocate_add section %u to %u\n", relsec,
sechdrs[relsec].sh_info);
for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
/* This is where to make the change */
location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+ rel[i].r_offset;
/* This is the symbol it is referring to. Note that all
undefined symbols have been resolved. */
sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
+ ELF32_R_SYM(rel[i].r_info);
switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_68K_32:
/* We add the value into the location given */
*location = rel[i].r_addend + sym->st_value;
break;
case R_68K_PC32:
/* Add the value, subtract its postition */
*location = rel[i].r_addend + sym->st_value - (uint32_t)location;
break;
default:
printk(KERN_ERR "module %s: Unknown relocation: %u\n",
me->name, ELF32_R_TYPE(rel[i].r_info));
return -ENOEXEC;
}
}
return 0;
}
int module_finalize(const Elf_Ehdr *hdr,
const Elf_Shdr *sechdrs,
struct module *me)
{
return 0;
}
void module_arch_cleanup(struct module *mod)
{
}
|
/* clock.h
* Copyright (C) 2002 Laurent Belmonte
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef CLOCK_H
#define CLOCK_H
#include <gtk/gtk.h>
G_BEGIN_DECLS
#define TYPE_CLOCK (clock_get_type())
#define CLOCK(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TYPE_CLOCK,Clock))
#define CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_CLOCK,ClockClass))
#define IS_CLOCK(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TYPE_CLOCK))
#define IS_CLOCK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_CLOCK))
#define CLOCK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_CLOCK, ClockClass))
typedef struct ClockPrivate ClockPrivate;
typedef struct {
GObject parent_instance;
ClockPrivate * private;
} Clock;
typedef struct {
GObjectClass parent_class;
} ClockClass;
GType clock_get_type(void);
Clock * clock_new(void);
void clock_start(Clock * clock);
void clock_pause(Clock * clock,gboolean paused);
gint clock_get_time(Clock * clock);
G_END_DECLS
#endif
|
// -*- C++ -*-
/*!
\file FunctionWithQuadraticPenalty.h
\brief An objective function with a quadratic penalty.
*/
#if !defined(__numerical_FunctionWithQuadraticPenalty_h__)
#define __numerical_FunctionWithQuadraticPenalty_h__
#include "../defs.h"
#include <functional>
#include <cassert>
// If we are debugging the whole numerical package.
#if defined(DEBUG_numerical) && !defined(DEBUG_FunctionWithQuadraticPenalty)
#define DEBUG_FunctionWithQuadraticPenalty
#endif
BEGIN_NAMESPACE_NUMERICAL
//! An objective function with a quadratic penalty.
/*!
\param N is the problem dimension.
\param _Function is the functor to minimize.
\param Constraint is the equality constraint functor.
\param T is the number type. By default it is _Function::result_type;
\param Point is the point type. By default it is _Function::argument_type;
*/
template <int N, class _Function, class Constraint,
typename T = typename _Function::result_type,
typename Point = typename _Function::argument_type>
class FunctionWithQuadraticPenalty :
public std::unary_function<Point,T> {
private:
typedef std::unary_function<Point,T> base_type;
public:
//
// Public types.
//
//! The argument type.
typedef typename base_type::argument_type argument_type;
//! The result type.
typedef typename base_type::result_type result_type;
private:
//
// Private types.
//
// The function type.
typedef _Function function_type;
// The constraint type.
typedef Constraint constraint_type;
// The number type.
typedef result_type number_type;
// A point in N dimensions.
typedef argument_type point_type;
private:
//
// Member data.
//
// The objective function.
const function_type& _function;
// The constraint function.
const constraint_type& _constraint;
// The penalty parameter.
mutable number_type _penalty_parameter;
// The penalty parameter reduction factor.
mutable number_type _reduction_factor;
//
// Not implemented.
//
// Default constructor not implemented.
FunctionWithQuadraticPenalty();
// Assignment operator not implemented.
FunctionWithQuadraticPenalty&
operator=(const FunctionWithQuadraticPenalty&);
public:
//--------------------------------------------------------------------------
//! \name Constructors etc.
// @{
//! Construct from the objective function, the constraint and the penalty parameter.
FunctionWithQuadraticPenalty(const function_type& function,
const constraint_type& constraint,
const number_type penalty_parameter = 1,
const number_type reduction_factor = 0.1);
//! Copy constructor.
FunctionWithQuadraticPenalty(const FunctionWithQuadraticPenalty& x);
//! Destructor.
virtual
~FunctionWithQuadraticPenalty()
{}
// @}
//--------------------------------------------------------------------------
//! \name Functor.
// @{
//! Return the value of the objective function with a quadratic penalty.
result_type
operator()(const argument_type& x) const;
//! Calculate the gradient of the objective function with a quadratic penalty.
void
gradient(const argument_type& x, argument_type& gradient) const;
// @}
//--------------------------------------------------------------------------
//! \name Accessors.
// @{
//! Return a const reference to the objective function.
const function_type&
function() const {
return _function;
}
//! Return a const reference to the constraint function.
const constraint_type&
constraint() const {
return _constraint;
}
//! Return the value of the penalty parameter.
number_type
penalty_parameter() const {
return _penalty_parameter;
}
//! Return the value of the penalty parameter reduction factor.
number_type
reduction_factor() const {
return _reduction_factor;
}
// @}
//--------------------------------------------------------------------------
//! \name Manipulators.
// @{
//! Increase the penalty be decreasing the penalty parameter by the reduction factor.
void
increase_penalty() const {
_penalty_parameter *= _reduction_factor;
}
//! Set the penalty parameter.
void
set_penalty_parameter(const number_type penalty_parameter) const {
_penalty_parameter = penalty_parameter;
}
//! Set the reduction factor.
void
set_reduction_factor(const number_type reduction_factor) const {
_reduction_factor = reduction_factor;
}
// @}
};
END_NAMESPACE_NUMERICAL
#define __FunctionWithQuadraticPenalty_ipp__
#include "FunctionWithQuadraticPenalty.ipp"
#undef __FunctionWithQuadraticPenalty_ipp__
#endif
|
#ifndef USB_H
#define USB_H
#include <pspusb.h>
#include <pspusbstor.h>
#include <pspsdk.h>
#define oslGetUsbState sceUsbGetState
/** @defgroup Usb USB
USB functions to start/stop usb storage
@{
*/
enum {OSL_USB_ACTIVATED=PSP_USB_ACTIVATED,
OSL_USB_CABLE_CONNECTED=PSP_USB_CABLE_CONNECTED,
OSL_USB_CONNECTION_ESTABLISHED=PSP_USB_CONNECTION_ESTABLISHED};
/** Initializes USB modules, must be called before oslStartUsbStorage.
Returns 0 on success.*/
extern int oslInitUsbStorage();
/** Starts USB storage
Returns 0 on success.*/
extern int oslStartUsbStorage();
/** Stops USB storage
Returns 0 on success.*/
extern int oslStopUsbStorage();
/** Deinitializes USB modules. */
extern int oslDeinitUsbStorage();
/** @} */ // end of USB
#endif
|
/*
tea6420 - i2c-driver for the tea6420 by SGS Thomson
Copyright (C) 1998-2003 Michael Hunold <michael@mihu.de>
Copyright (C) 2008 Hans Verkuil <hverkuil@xs4all.nl>
The tea6420 is a bus controlled audio-matrix with 5 stereo inputs,
4 stereo outputs and gain control for each output.
It is cascadable, i.e. it can be found at the addresses 0x98
and 0x9a on the i2c-bus.
For detailed informations download the specifications directly
from SGS Thomson at http://www.st.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/module.h>
#include <linux/ioctl.h>
#include <linux/slab.h>
#include <linux/i2c.h>
#include <media/v4l2-device.h>
#include <media/v4l2-chip-ident.h>
#include "tea6420.h"
MODULE_AUTHOR("Michael Hunold <michael@mihu.de>");
MODULE_DESCRIPTION("tea6420 driver");
MODULE_LICENSE("GPL");
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-1)");
/* make a connection between the input 'i' and the output 'o'
with gain 'g' (note: i = 6 means 'mute') */
static int tea6420_s_routing(struct v4l2_subdev *sd,
u32 i, u32 o, u32 config)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
int g = (o >> 4) & 0xf;
u8 byte;
int ret;
o &= 0xf;
v4l2_dbg(1, debug, sd, "i=%d, o=%d, g=%d\n", i, o, g);
/* check if the parameters are valid */
if (i < 1 || i > 6 || o < 1 || o > 4 || g < 0 || g > 6 || g % 2 != 0)
return -EINVAL;
byte = ((o - 1) << 5);
byte |= (i - 1);
/* to understand this, have a look at the tea6420-specs (p.5) */
switch (g) {
case 0:
byte |= (3 << 3);
break;
case 2:
byte |= (2 << 3);
break;
case 4:
byte |= (1 << 3);
break;
case 6:
break;
}
ret = i2c_smbus_write_byte(client, byte);
if (ret) {
v4l2_dbg(1, debug, sd,
"i2c_smbus_write_byte() failed, ret:%d\n", ret);
return -EIO;
}
return 0;
}
static int tea6420_g_chip_ident(struct v4l2_subdev *sd, struct v4l2_dbg_chip_ident *chip)
{
struct i2c_client *client = v4l2_get_subdevdata(sd);
return v4l2_chip_ident_i2c_client(client, chip, V4L2_IDENT_TEA6420, 0);
}
/* ----------------------------------------------------------------------- */
static const struct v4l2_subdev_core_ops tea6420_core_ops = {
.g_chip_ident = tea6420_g_chip_ident,
};
static const struct v4l2_subdev_audio_ops tea6420_audio_ops = {
.s_routing = tea6420_s_routing,
};
static const struct v4l2_subdev_ops tea6420_ops = {
.core = &tea6420_core_ops,
.audio = &tea6420_audio_ops,
};
static int tea6420_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
struct v4l2_subdev *sd;
int err, i;
/* let's see whether this adapter can support what we need */
if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_WRITE_BYTE))
return -EIO;
v4l_info(client, "chip found @ 0x%x (%s)\n",
client->addr << 1, client->adapter->name);
sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL);
if (sd == NULL)
return -ENOMEM;
v4l2_i2c_subdev_init(sd, client, &tea6420_ops);
/* set initial values: set "mute"-input to all outputs at gain 0 */
err = 0;
for (i = 1; i < 5; i++)
err += tea6420_s_routing(sd, 6, i, 0);
if (err) {
v4l_dbg(1, debug, client, "could not initialize tea6420\n");
return -ENODEV;
}
return 0;
}
static int tea6420_remove(struct i2c_client *client)
{
struct v4l2_subdev *sd = i2c_get_clientdata(client);
v4l2_device_unregister_subdev(sd);
kfree(sd);
return 0;
}
static const struct i2c_device_id tea6420_id[] = {
{ "tea6420", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, tea6420_id);
static struct i2c_driver tea6420_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "tea6420",
},
.probe = tea6420_probe,
.remove = tea6420_remove,
.id_table = tea6420_id,
};
static __init int init_tea6420(void)
{
return i2c_add_driver(&tea6420_driver);
}
static __exit void exit_tea6420(void)
{
i2c_del_driver(&tea6420_driver);
}
module_init(init_tea6420);
module_exit(exit_tea6420);
|
/*
* menu_joyport.h - Joyport menu for SDL UI.
*
* Written by
* Marco van den Heuvel <blackystardust68@yahoo.com>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
* 02111-1307 USA.
*
*/
#ifndef VICE_MENU_JOYPORT_H
#define VICE_MENU_JOYPORT_H
#include "vice.h"
#include "types.h"
#include "uimenu.h"
extern ui_menu_entry_t joyport_menu[];
extern void uijoyport_menu_create(int port1, int port2, int port3, int port4, int port5);
extern void uijoyport_menu_shutdown(void);
#endif
|
/*
* Print Dialog for Canon LIPS/PS/LIPSLX/UFR2/CAPT Printer.
* Copyright (C) 2010-2011 Canon Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; 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 _ENTRY
#define _ENTRY
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "widgets.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct{
int id;
char *widget_name;
int length;
char *numeric;
}EntryData;
void ConnectEntrySignal(GladeXML *xml, cngplpData* data, gpointer *widget);
void InitEntry(GladeXML *xml, cngplpData* data, const gpointer *widget);
void EntrySpecialFunction(cngplpData* data, const char *widget_name);
#ifdef __cplusplus
}
#endif
#endif
|
/*
* Copyright (C) 2010-2011 ARM Limited. All rights reserved.
*
* This program is free software and is provided to you under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation, and any use by you of this program is subject to the terms of such GNU licence.
*
* A copy of the licence is included with the program, and can also be obtained from Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/**
* @file mali_osk_math.c
* Implementation of the OS abstraction layer for the kernel device driver
*/
#include "mali_osk.h"
#include <linux/bitops.h>
u32 inline _mali_osk_clz( u32 input )
{
return 32-fls(input);
}
|
#include "globals.h"
void buy_handler(struct player_t *player)
{
output("Enter the ticker symbol of the stock you wish to purchase: ");
char *sym = read_ticker();
struct money_t price;
output("Getting stock information...\n");
char *name;
if(!get_stock_info(sym, &price, &name))
{
output("Failed to get query information for '%s'.\n", sym);
free(sym);
return;
}
output("Stock name: %s\n", name);
output("Price per share: $%llu.%02llu\n",
price.cents / 100, price.cents % 100);
output("Enter the number of shares to be purchased (maximum %llu): ",
player->cash.cents / price.cents);
ullong count = read_int();
if(count <= 0)
{
output("Purchase cancelled.\n");
return;
}
ullong cost = price.cents * count;
if(cost > player->cash.cents)
{
output("Not enough money!\n");
return;
}
output("This will cost $%llu.%02llu. Are you sure? ",
cost / 100, cost % 100);
char *response = read_string();
all_lower(response);
if(response[0] == 'y')
{
output("Confirmed.\n");
struct stock_t *stock = find_stock(player, sym);
/* add the stock to the portfolio or increase the count of a stock */
if(stock)
{
stock->count += count;
stock->current_price.cents = price.cents;
}
else
{
/* stock is not in portfolio yet, add it */
player->portfolio_len += 1;
player->portfolio = realloc(player->portfolio,
player->portfolio_len * sizeof(struct stock_t));
player->need_to_free_portfolio = true;
stock = player->portfolio + player->portfolio_len - 1;
memset(stock, 0, sizeof(struct stock_t));
stock->symbol = sym;
stock->fullname = name;
stock->count = count;
stock->current_price.cents = price.cents;
}
player->cash.cents -= cost;
add_hist(stock, BUY, count);
/* sort the portfolio alphabetically by ticker symbol */
qsort(player->portfolio,
player->portfolio_len, sizeof(struct stock_t),
compare_stocks);
}
else
{
output("Not confirmed.\n");
}
free(response);
}
|
// qtractor.h
//
/****************************************************************************
Copyright (C) 2005-2022, rncbc aka Rui Nuno Capela. 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 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 __qtractor_h
#define __qtractor_h
#include "qtractorAbout.h"
#include <QApplication>
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#if defined(Q_WS_X11)
#define CONFIG_X11
#endif
#endif
// Forward decls.
class QWidget;
class QTranslator;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef CONFIG_XUNIQUE
#ifdef CONFIG_X11
#include <QX11Info>
typedef unsigned long Window;
typedef unsigned long Atom;
#endif // CONFIG_X11
#endif // CONFIG_XUNIQUE
#else
#ifdef CONFIG_XUNIQUE
class QSharedMemory;
class QLocalServer;
#endif // CONFIG_XUNIQUE
#endif
//-------------------------------------------------------------------------
// Singleton application instance stuff (Qt/X11 only atm.)
//
class qtractorApplication : public QApplication
{
Q_OBJECT
public:
// Constructor.
qtractorApplication(int& argc, char **argv);
// Destructor.
~qtractorApplication();
// Main application widget accessors.
void setMainWidget(QWidget *pWidget);
QWidget *mainWidget() const
{ return m_pWidget; }
// Check if another instance is running,
// and raise its proper main widget...
bool setup();
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef CONFIG_X11
#ifdef CONFIG_XUNIQUE
void x11PropertyNotify(Window w);
#endif // CONFIG_XUNIQUE
bool x11EventFilter(XEvent *pEv);
#endif // CONFIG_X11
#else
#ifdef CONFIG_XUNIQUE
protected slots:
// Local server slots.
void newConnectionSlot();
void readyReadSlot();
#endif // CONFIG_XUNIQUE
#endif
private:
// Translation support.
QTranslator *m_pQtTranslator;
QTranslator *m_pMyTranslator;
// Instance variables.
QWidget *m_pWidget;
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
#ifdef CONFIG_XUNIQUE
#ifdef CONFIG_X11
Display *m_pDisplay;
Atom m_aUnique;
Window m_wOwner;
#endif // CONFIG_X11
#endif // CONFIG_XUNIQUE
#else
#ifdef CONFIG_XUNIQUE
QString m_sUnique;
QSharedMemory *m_pMemory;
QLocalServer *m_pServer;
#endif // CONFIG_XUNIQUE
#endif
};
#endif // __qtractor_h
// end of qtractor.h
|
/** @file
* REM - The Recompiled Execution Manager.
*/
/*
* Copyright (C) 2006-2015 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* you can redistribute it and/or modify it under the terms of the GNU
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___VBox_vmm_rem_h
#define ___VBox_vmm_rem_h
#include <VBox/types.h>
#include <VBox/vmm/pgm.h>
#include <VBox/vmm/vmapi.h>
RT_C_DECLS_BEGIN
/** @defgroup grp_rem The Recompiled Execution Manager API
* @ingroup grp_vmm
* @{
*/
/** No pending interrupt. */
#define REM_NO_PENDING_IRQ (~(uint32_t)0)
#if defined(IN_RING0) || defined(IN_RC)
VMMDECL(void) REMNotifyInvalidatePage(PVM pVM, RTGCPTR GCPtrPage);
VMMDECL(void) REMNotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
VMMDECL(void) REMNotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
VMMDECL(void) REMNotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
#endif /* IN_RING0 || IN_RC */
#ifdef IN_RC
VMMDECL(void) REMNotifyHandlerPhysicalFlushIfAlmostFull(PVM pVM, PVMCPU pVCpu);
#endif
VMMDECL(void) REMFlushTBs(PVM pVM);
#ifdef IN_RING3
/** @defgroup grp_rem_r3 REM Host Context Ring 3 API
* @{
*/
REMR3DECL(int) REMR3Init(PVM pVM);
REMR3DECL(int) REMR3InitFinalize(PVM pVM);
REMR3DECL(int) REMR3Term(PVM pVM);
REMR3DECL(void) REMR3Reset(PVM pVM);
REMR3DECL(int) REMR3Run(PVM pVM, PVMCPU pVCpu);
REMR3DECL(int) REMR3EmulateInstruction(PVM pVM, PVMCPU pVCpu);
REMR3DECL(int) REMR3Step(PVM pVM, PVMCPU pVCpu);
REMR3DECL(int) REMR3BreakpointSet(PVM pVM, RTGCUINTPTR Address);
REMR3DECL(int) REMR3BreakpointClear(PVM pVM, RTGCUINTPTR Address);
REMR3DECL(int) REMR3State(PVM pVM, PVMCPU pVCpu);
REMR3DECL(int) REMR3StateBack(PVM pVM, PVMCPU pVCpu);
REMR3DECL(void) REMR3StateUpdate(PVM pVM, PVMCPU pVCpu);
REMR3DECL(void) REMR3A20Set(PVM pVM, PVMCPU pVCpu, bool fEnable);
REMR3DECL(int) REMR3DisasEnableStepping(PVM pVM, bool fEnable);
REMR3DECL(void) REMR3ReplayHandlerNotifications(PVM pVM);
REMR3DECL(int) REMR3NotifyCodePageChanged(PVM pVM, PVMCPU pVCpu, RTGCPTR pvCodePage);
REMR3DECL(void) REMR3NotifyPhysRamRegister(PVM pVM, RTGCPHYS GCPhys, RTGCPHYS cb, unsigned fFlags);
/** @name Flags for REMR3NotifyPhysRamRegister.
* @{ */
#define REM_NOTIFY_PHYS_RAM_FLAGS_RAM RT_BIT(16)
#define REM_NOTIFY_PHYS_RAM_FLAGS_MMIO2 RT_BIT(17)
/** @} */
REMR3DECL(void) REMR3NotifyPhysRomRegister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb, void *pvCopy, bool fShadow);
REMR3DECL(void) REMR3NotifyPhysRamDeregister(PVM pVM, RTGCPHYS GCPhys, RTUINT cb);
REMR3DECL(void) REMR3NotifyHandlerPhysicalRegister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler);
REMR3DECL(void) REMR3NotifyHandlerPhysicalDeregister(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhys, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
REMR3DECL(void) REMR3NotifyHandlerPhysicalModify(PVM pVM, PGMPHYSHANDLERKIND enmKind, RTGCPHYS GCPhysOld, RTGCPHYS GCPhysNew, RTGCPHYS cb, bool fHasHCHandler, bool fRestoreAsRAM);
REMR3DECL(void) REMR3NotifyInterruptSet(PVM pVM, PVMCPU pVCpu);
REMR3DECL(void) REMR3NotifyInterruptClear(PVM pVM, PVMCPU pVCpu);
REMR3DECL(void) REMR3NotifyTimerPending(PVM pVM, PVMCPU pVCpuDst);
REMR3DECL(void) REMR3NotifyDmaPending(PVM pVM);
REMR3DECL(void) REMR3NotifyQueuePending(PVM pVM);
REMR3DECL(void) REMR3NotifyFF(PVM pVM);
REMR3DECL(bool) REMR3IsPageAccessHandled(PVM pVM, RTGCPHYS GCPhys);
/** @} */
#endif /* IN_RING3 */
/** @} */
RT_C_DECLS_END
#endif
|
/** -*- c++ -*-
* Copyright (C) 2011 Hypertable, Inc.
*
* This file is part of Hypertable.
*
* Hypertable is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; version 2 of the
* License, or any later version.
*
* Hypertable 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 HYPERTABLE_PHANTOMRANGE_H
#define HYPERTABLE_PHANTOMRANGE_H
#include <map>
#include <vector>
#include "Common/String.h"
#include "Hypertable/Lib/Types.h"
#include "Hypertable/Lib/FileSystem.h"
#include "Range.h"
#include "FragmentData.h"
namespace Hypertable {
using namespace std;
/**
* Represents a table row range.
*/
class PhantomRange {
public:
enum State {
INIT=0,
FINISHED_REPLAY=1,
RANGE_CREATED=2,
RANGE_PREPARED=3
};
PhantomRange(const QualifiedRangeSpec &range, SchemaPtr &schema,
const vector<uint32_t> &fragments);
~PhantomRange() {}
/**
*
* @param fragment fragment id
* @param more if false this is the last data for this fragment
* @param event contains data fort his fragment
* @return true if the add succeded, false means the fragment is already complete
*/
bool add(uint32_t fragment, bool more, EventPtr &event);
void finish_fragment(uint32_t fragment);
int get_state();
void create_range(RangePtr &range);
QualifiedRangeSpec get_qualified_range() { return m_spec; }
void purge_incomplete_fragments();
void get_incomplete_fragments(vector<uint32_t> &fragments);
RangePtr create_range_and_transfer_log(MasterClientPtr &master_client,
TableInfo &table_info, FileSystemPtr &log_dfs, String &log_dir);
RangePtr get_range() {
ScopedLock lock(m_mutex);
return m_range;
}
void populate_range_and_log(FileSystemPtr &log_dfs);
CommitLogPtr get_transfer_log();
private:
typedef std::map<uint32_t, FragmentDataPtr> FragmentMap;
Mutex m_mutex;
FragmentMap m_fragments;
QualifiedRangeSpecManaged m_spec;
SchemaPtr m_schema;
size_t m_outstanding;
RangePtr m_range;
CommitLogPtr m_transfer_log;
int m_state;
};
typedef intrusive_ptr<PhantomRange> PhantomRangePtr;
} // namespace Hypertable
#endif // HYPERTABLE_PHANTOMRANGE_H
|
#ifndef __LINUX_BRIDGE_EBT_AMONG_H
#define __LINUX_BRIDGE_EBT_AMONG_H
#define EBT_AMONG_DST 0x01
#define EBT_AMONG_SRC 0x02
/* Grzegorz Borowiak <grzes@gnu.univ.gda.pl> 2003
*
* Write-once-read-many hash table, used for checking if a given
* MAC address belongs to a set or not and possibly for checking
* if it is related with a given IPv4 address.
*
* The hash value of an address is its last byte.
*
* In real-world ethernet addresses, values of the last byte are
* evenly distributed and there is no need to consider other bytes.
* It would only slow the routines down.
*
* For MAC address comparison speedup reasons, we introduce a trick.
* MAC address is mapped onto an array of two 32-bit integers.
* This pair of integers is compared with MAC addresses in the
* hash table, which are stored also in form of pairs of integers
* (in `cmp' array). This is quick as it requires only two elementary
* number comparisons in worst case. Further, we take advantage of
* fact that entropy of 3 last bytes of address is larger than entropy
* of 3 first bytes. So first we compare 4 last bytes of addresses and
* if they are the same we compare 2 first.
*
* Yes, it is a memory overhead, but in 2003 AD, who cares?
*/
struct ebt_mac_wormhash_tuple {
uint32_t cmp[2];
__be32 ip;
};
struct ebt_mac_wormhash {
int table[257];
int poolsize;
struct ebt_mac_wormhash_tuple pool[0];
};
#define ebt_mac_wormhash_size(x) ((x) ? sizeof(struct ebt_mac_wormhash) \
+ (x)->poolsize * sizeof(struct ebt_mac_wormhash_tuple) : 0)
struct ebt_among_info {
int wh_dst_ofs;
int wh_src_ofs;
int bitmask;
};
#define EBT_AMONG_DST_NEG 0x1
#define EBT_AMONG_SRC_NEG 0x2
#define ebt_among_wh_dst(x) ((x)->wh_dst_ofs ? \
(struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_dst_ofs) : NULL)
#define ebt_among_wh_src(x) ((x)->wh_src_ofs ? \
(struct ebt_mac_wormhash*)((char*)(x) + (x)->wh_src_ofs) : NULL)
#define EBT_AMONG_MATCH "among"
#endif
|
#ifndef K3DSDK_QTUI_UTILITY_H
#define K3DSDK_QTUI_UTILITY_H
// K-3D
// Copyright (c) 1995-2010, Timothy M. Shead
//
// Contact: tshead@k-3d.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public
// License as published by the Free Software Foundation; either
// version 2 of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public
// License along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/** \file
\author Bart Janssens
*/
#include <k3dsdk/result.h>
#include <k3dsdk/types.h>
#include <QStringList>
#include <QtQml>
#include <QUrl>
class QQuickItem;
class QQmlProperty;
namespace k3d
{
namespace qtui
{
/// Load the given QmlFile and return a pointer to the top-level Item
QQuickItem* load_qml(const QUrl& QmlFile, QQuickItem* Parent);
/// Register the template corresponding to a Qml class
void register_qml_template(const k3d::string_t& Name, const QUrl TemplateUrl, const bool UserInstantiable);
/// Get the URL for the QML template associated with the given K-3D Qml type
QUrl get_template_url(const k3d::string_t& Name);
/// List of the registered types
QStringList registered_types();
const char* qml_type_name(const QMetaObject& MetaObject);
/// Helper to register a Qml type in its cpp file by simply declaring a global variable of this type
template<typename QmlType>
struct qml_type_registrator
{
qml_type_registrator(const QUrl TemplateURL = QUrl(), const bool UserInstantiable = false)
{
const char* name = qml_type_name(QmlType::staticMetaObject);
assert_error(name != "");
register_qml_template(name, TemplateURL, UserInstantiable);
qmlRegisterType<QmlType>("K3D", 1, 0, name);
}
};
/// Register a meta type
template<typename QmlType>
struct qml_meta_type_registrator
{
qml_meta_type_registrator(const k3d::string_t& Name)
{
qRegisterMetaType<QmlType>(Name.c_str());
}
};
k3d::string_t property_value_to_string(const QQmlProperty& Property);
} // namespace qtui
} // namespace k3d
#endif // !K3DSDK_QTUI_UTILITY_H
|
/*
* compiler/core/define.c - keeps a list of things that have been defined
* and provided means for checking if something has been
* defined
*
* MS 92
* Copyright (C) 1991, 1992 Michael Sample
* and the University of British Columbia
*
* 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.
*
* $Header: /usr/app/odstb/CVS/snacc/compiler/core/define.c,v 1.4 1997/10/10 13:43:15 wan Exp $
* $Log: define.c,v $
* Revision 1.4 1997/10/10 13:43:15 wan
* Corrected bug in generic table decoder wrt. indefinite length elements
* Corrected compiler access to freed memory (bug reported by Markku Savela)
* Broke asnwish.c into two pieces so that one can build ones on wish
* Added beredit tool (based on asnwish, allowes to edit BER messages)
*
* Revision 1.3 1995/07/25 19:41:21 rj
* changed `_' to `-' in file names.
*
* Revision 1.2 1994/09/01 00:27:38 rj
* snacc_config.h removed.
*
* Revision 1.1 1994/08/28 09:48:58 rj
* first check-in. for a list of changes to the snacc-1.1 distribution please refer to the ChangeLog.
*
*/
#include "asn-incl.h"
#include "mem.h"
#include "define.h"
/* for CompareOids from snacc_util.c*/
int CompareOids PROTO ((OID *oid1, OID *oid2));
/* cmp routine for a null terminated string object type */
int
StrObjCmp PARAMS ((s1, s2),
void *s1 _AND_
void *s2)
{
if (strcmp ((char*)s1, (char*) s2) == 0)
return TRUE;
else
return FALSE;
}
/* cmp routine for a integer object type */
int
IntObjCmp PARAMS ((s1, s2),
void *s1 _AND_
void *s2)
{
if (*((int*) s1) == *((int*) s2))
return TRUE;
else
return FALSE;
}
/* cmp routine for a OID object type */
int
OidObjCmp PARAMS ((o1, o2),
void *o1 _AND_
void *o2)
{
return CompareOids ((OID*)o1, (OID*)o2);
}
/* special cmp routine - compares the pointers themselves */
int
ObjPtrCmp PARAMS ((s1, s2),
void *s1 _AND_
void *s2)
{
if (s1 == s2)
return TRUE;
else
return FALSE;
}
DefinedObj*
NewObjList()
{
return NULL;
}
/*
* puts the given object into the give object list
* does not check for duplicates - you should do that
* before calling this - if you care.
*/
void
DefineObj PARAMS ((objListHndl, obj),
DefinedObj **objListHndl _AND_
void *obj)
{
DefinedObj *new;
new = MT (DefinedObj);
new->obj = obj;
/* insert new one at head */
new->next = *objListHndl;
*objListHndl = new;
} /* DefineObj */
/*
* removes the first identical object from the list
* - if you are allowing duplicates use another routine.
* this only removes the first for efficiency reasons - all
* current usage of the DefineObj stuff does not allow duplicates.
*/
void
UndefineObj PARAMS ((objListHndl, obj, cmpRoutine),
DefinedObj **objListHndl _AND_
void *obj _AND_
CmpObjsRoutine cmpRoutine)
{
DefinedObj *objListPtr;
DefinedObj **prevHndl;
objListPtr = *objListHndl;
prevHndl = objListHndl;
for ( ; objListPtr != NULL; objListPtr = *prevHndl)
{
if (cmpRoutine (objListPtr->obj, obj))
{
/* found object, now remove it */
*prevHndl = objListPtr->next;
Free (objListPtr);
}
else
prevHndl = &objListPtr->next;
}
} /* UndefineObj */
/*
* given an object list, an object and an object comparison routine,
* ObjIsDefined returns non-zero if the given object is already in
* the object list. The comparison routine should take two objects and
* return non-zero if the objects are equivalent
*/
int
ObjIsDefined PARAMS ((objListPtr, obj, cmpRoutine),
DefinedObj *objListPtr _AND_
void *obj _AND_
CmpObjsRoutine cmpRoutine)
{
for ( ; objListPtr != NULL; objListPtr = objListPtr->next)
{
if (cmpRoutine (objListPtr->obj, obj))
return TRUE;
}
return FALSE;
} /* ObjIsDefined */
/*
* Frees the list holding the defined objects.
* Does not free the objects.
*/
void
FreeDefinedObjs PARAMS ((objListHndl),
DefinedObj **objListHndl)
{
DefinedObj *dO;
DefinedObj *tmpDO;
for (dO = *objListHndl; dO != NULL; )
{
tmpDO = dO->next;
Free (dO);
dO = tmpDO;
}
*objListHndl = NULL;
} /* FreeDefinedObjs */
/*
* Frees the list holding the defined objects.
* Does free the objects.
*/
void
FreeDefinedObjsAndContent PARAMS ((objListHndl),
DefinedObj **objListHndl)
{
DefinedObj *dO;
DefinedObj *tmpDO;
for (dO = *objListHndl; dO != NULL; )
{
tmpDO = dO->next;
Free (dO->obj);
Free (dO);
dO = tmpDO;
}
*objListHndl = NULL;
} /* FreeDefinedObjs */
|
/*
*
* (c) 2005 Laurent Vivier <Laurent@Vivier.EU>
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "libstream.h"
#ifdef FLOPPY_SUPPORT
#include <libfloppy.h>
#endif
#ifdef SCSI_SUPPORT
#include <libscsi.h>
#endif
#ifdef BLOCK_SUPPORT
#include <libblock.h>
#endif
#ifdef CONTAINER_SUPPORT
#include <libcontainer.h>
#endif
#ifdef ISO9660_SUPPORT
#include <libiso9660.h>
#endif
#ifdef EXT2_SUPPORT
#include <libext2.h>
#endif
#ifdef MAP_SUPPORT
#include <libmap.h>
#endif
extern int default_unit;
static char* get_fs(char *path, fs_t *fs)
{
#ifdef BLOCK_SUPPORT
if (strncmp("block:", path, 6) == 0)
{
*fs = fs_BLOCK;
return path + 6;
}
#endif
#ifdef CONTAINER_SUPPORT
if (strncmp("container:", path, 10) == 0)
{
*fs = fs_CONTAINER;
return path + 10;
}
#endif
#ifdef ISO9660_SUPPORT
if (strncmp("iso9660:", path, 8) == 0)
{
*fs = fs_ISO9660;
return path + 8;
}
#endif
#ifdef EXT2_SUPPORT
if (strncmp("ext2:", path, 5) == 0)
{
*fs = fs_EXT2;
return path + 5;
}
#endif
*fs = fs_NONE;
return path;
}
static char *get_device(char* path,
device_t *device, int *unit, int* partition)
{
if (*path == '(') {
int nb;
path++;
#ifdef FLOPPY_SUPPORT
if (strncmp("fd", path, 2) == 0) {
*device = device_FLOPPY;
path += 2;
} else
#endif
#ifdef SCSI_SUPPORT
if (strncmp("sd", path, 2) == 0) {
*device = device_SCSI;
path += 2;
} else
#endif
return NULL;
nb = 0;
while ( (*path >= '0') && (*path <= '9') ) {
nb = (nb * 10) + (*path - '0');
path++;
}
*unit = nb;
*partition = -1;
if ( (*path == 0) || (*path == ')') )
{
path++;
return path;
}
if (*path != ',')
return NULL;
path++;
nb = 0;
while ( (*path >= '0') && (*path <= '9') ) {
nb = (nb * 10) + (*path - '0');
path++;
}
*partition = nb;
if ( (*path == 0) || (*path == ')') )
{
path++;
return path;
}
} else if (default_unit != -1) {
*device = device_SCSI;
*unit = default_unit;
*partition = -1;
return path;
}
return NULL;
}
stream_t *stream_open(char *dev)
{
stream_t *stream;
fs_t fs;
device_t device;
int unit, partition;
char *current;
int ret;
current = get_fs(dev, &fs);
current = get_device(current, &device, &unit, &partition);
if (current == NULL)
{
printf("Cannot identify given device\n");
return NULL;
}
stream = (stream_t*)malloc(sizeof(stream_t));
stream->fs_id = fs,
stream->device_id = device;
stream->unit = unit;
stream->partition = partition;
switch(device)
{
#ifdef FLOPPY_SUPPORT
case device_FLOPPY:
if (partition != -1)
{
free(stream);
return NULL;
}
stream->device.data = floppy_open(unit);
if (stream->device.data == NULL)
{
free(stream);
return NULL;
}
stream->device.read_sector =
(stream_read_sector_t)floppy_read_sector;
stream->device.close = (stream_close_t)floppy_close;
stream->device.get_blocksize =
(stream_get_blocksize_t)floppy_get_blocksize;
break;
#endif /* FLOPPY_SUPPORT */
#ifdef SCSI_SUPPORT
case device_SCSI:
stream->device.data = scsi_open(unit);
if (stream->device.data == NULL)
{
free(stream);
return NULL;
}
stream->device.read_sector =
(stream_read_sector_t)scsi_read_sector;
stream->device.close = (stream_close_t)scsi_close;
stream->device.get_blocksize =
(stream_get_blocksize_t)scsi_get_blocksize;
break;
#endif /* SCSI_SUPPORT */
default:
free(stream);
return NULL;
break;
}
if (partition != -1)
{
#ifdef MAP_SUPPORT
if (map_init(&stream->device, partition) == -1)
{
printf("Cannot open map\n");
stream->device.close(stream->volume);
free(stream);
return NULL;
}
#else
stream->device.close(stream->device.data);
free(stream);
return NULL;
#endif /* MAP_SUPPORT */
}
switch(fs)
{
#ifdef EXT2_SUPPORT
case fs_EXT2:
ret = ext2_init(&stream->device, &stream->fs);
break;
#endif
#ifdef ISO9660_SUPPORT
case fs_ISO9660:
ret = iso9660_init(&stream->device, &stream->fs);
break;
#endif
#ifdef CONTAINER_SUPPORT
case fs_CONTAINER:
ret = container_init(&stream->device, &stream->fs);
break;
#endif
#ifdef BLOCK_SUPPORT
case fs_BLOCK:
ret = block_init(&stream->device, &stream->fs);
break;
#endif
case fs_NONE:
ret = -1;
#ifdef EXT2_SUPPORT
ret = ext2_init(&stream->device, &stream->fs);
#endif
#ifdef ISO9660_SUPPORT
if (ret == -1)
ret = iso9660_init(&stream->device, &stream->fs);
#endif
break;
default:
ret = -1;
break;
}
if (ret == -1)
{
stream->device.close(stream->device.data);
free(stream);
return NULL;
}
stream->volume = stream->fs.mount(&stream->device);
if (stream->volume == NULL) {
stream->device.close(stream->device.data);
free(stream);
return NULL;
}
stream->file = stream->fs.open(stream->volume, current);
if (stream->file == NULL) {
stream->fs.umount(stream->volume);
stream->device.close(stream->device.data);
free(stream);
return NULL;
}
return stream;
}
|
/*
* include/net/9p/transport.h
*
* Transport Definition
*
* Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net>
* Copyright (C) 2004-2008 by Eric Van Hensbergen <ericvh@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2
* as published by the Free Software Foundation.
*
* 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:
* Free Software Foundation
* 51 Franklin Street, Fifth Floor
* Boston, MA 02111-1301 USA
*
*/
#ifndef NET_9P_TRANSPORT_H
#define NET_9P_TRANSPORT_H
#define P9_TRANS_PREF_PAYLOAD_MASK 0x1
/* Default. Add Payload to PDU before sending it down to transport layer */
#define P9_TRANS_PREF_PAYLOAD_DEF 0x0
/* Send pay load separately to transport layer along with PDU.*/
#define P9_TRANS_PREF_PAYLOAD_SEP 0x1
/**
* struct p9_trans_module - transport module interface
* @list: used to maintain a list of currently available transports
* @name: the human-readable name of the transport
* @maxsize: transport provided maximum packet size
* @pref: Preferences of this transport
* @def: set if this transport should be considered the default
* @create: member function to create a new connection on this transport
* @close: member function to discard a connection on this transport
* @request: member function to issue a request to the transport
* @cancel: member function to cancel a request (if it hasn't been sent)
*
* This is the basic API for a transport module which is registered by the
* transport module with the 9P core network module and used by the client
* to instantiate a new connection on a transport.
*
* The transport module list is protected by v9fs_trans_lock.
*/
struct p9_trans_module {
struct list_head list;
char *name; /* name of transport */
int maxsize; /* max message size of transport */
int pref; /* Preferences of this transport */
int def; /* this transport should be default */
struct module *owner;
int (*create)(struct p9_client *, const char *, char *);
void (*close) (struct p9_client *);
int (*request) (struct p9_client *, struct p9_req_t *req);
int (*cancel) (struct p9_client *, struct p9_req_t *req);
};
void v9fs_register_trans(struct p9_trans_module *m);
void v9fs_unregister_trans(struct p9_trans_module *m);
struct p9_trans_module *v9fs_get_trans_by_name(char *s);
struct p9_trans_module *v9fs_get_default_trans(void);
void v9fs_put_trans(struct p9_trans_module *m);
#endif /* NET_9P_TRANSPORT_H */
|
#ifdef _3DS
#include <3ds.h>
#include <3ds/types.h>
#include "gl.h"
#include <math.h>
#include <stdlib.h>
#include <malloc.h>
#include "DoomDef.h"
#include "R_local.h"
#include "map.h"
#include "keyboard.h"
touchPosition g_lastTouch = { 0, 0 };
touchPosition g_currentTouch = { 0, 0 };
//0=DS Bit,1=game key, 2=menu key
u32 keys3ds[32][3] = {
{ KEY_A, KEY_RCTRL, KEY_ENTER }, //bit 00
{ KEY_B, ' ', KEY_ESCAPE }, //bit 01
{ KEY_SELECT, KEY_ENTER, 0 }, //bit 02
{ KEY_START, KEY_ESCAPE, 0 }, //bit 03
{ KEY_DRIGHT, KEY_RIGHTARROW,0 }, //bit 04
{ KEY_DLEFT, KEY_LEFTARROW, 0 }, //bit 05
{ KEY_DUP, KEY_UPARROW, 0 }, //bit 06
{ KEY_DDOWN, KEY_DOWNARROW, 0 }, //bit 07
{ KEY_R, '.', 0 }, //bit 08
{ KEY_L, ',', 0 }, //bit 09
{ KEY_X, 'x', 0 }, //bit 10
{ KEY_Y, 'y', 'y' }, //bit 11
{ 0, 0, 0 }, //bit 12
{ 0, 0, 0 }, //bit 13
{ KEY_ZL, '[', 0 }, //bit 14
{ KEY_ZR, ']', 0 }, //bit 15
{ 0, 0, 0 }, //bit 16
{ 0, 0, 0 }, //bit 17
{ 0, 0, 0 }, //bit 18
{ 0, 0, 0 }, //bit 19
{ 0, 0, 0 }, //bit 20
{ 0, 0, 0 }, //bit 21
{ 0, 0, 0 }, //bit 22
{ 0, 0, 0 }, //bit 23
#if 0
{ KEY_CSTICK_RIGHT, KEYD_CSTICK_RIGHT, 0 }, //bit 24
{ KEY_CSTICK_LEFT, KEYD_CSTICK_LEFT, 0 }, //bit 25
{ KEY_CSTICK_UP, KEYD_CSTICK_UP, 0 }, //bit 26
{ KEY_CSTICK_DOWN, KEYD_CSTICK_DOWN, 0 }, //bit 27
{ KEY_CPAD_RIGHT, KEYD_CPAD_RIGHT, 0 }, //bit 28
{ KEY_CPAD_LEFT, KEYD_CPAD_LEFT, 0 }, //bit 29
{ KEY_CPAD_UP, KEYD_CPAD_UP, 0 }, //bit 30
{ KEY_CPAD_DOWN, KEYD_CPAD_DOWN, 0 }, //bit 31
#endif
};
extern boolean setup_select; // changing an item
void _3ds_controls(void) {
touchPosition touch;
circlePosition nubPos = { 0, 0 };
circlePosition cstickPos = { 0, 0 };
int dx, dy;
event_t ev;
scanKeys(); // Do DS input housekeeping
u32 keys = keysDown();
u32 held = keysHeld();
u32 up = keysUp();
int i;
boolean altmode = false;// menuactive && !setup_select;
if (held & KEY_TOUCH) {
touchRead(&touch);
}
for (i = 0; i<24; i++) {
//send key down
if (keys3ds[i][0] & keys) {
event_t ev;
ev.type = ev_keydown;
ev.data1 = keys3ds[i][(altmode && keys3ds[i][2]) ? 2 : 1];
//printf("key down: %d\n", ev.data1);
D_PostEvent(&ev);
}
//send key up
if (keys3ds[i][0] & up) {
event_t ev;
ev.type = ev_keyup;
ev.data1 = keys3ds[i][(altmode && keys3ds[i][2]) ? 2 : 1];
//printf("key up: %d\n", ev.data1);
D_PostEvent(&ev);
}
}
if (keysDown() & KEY_TOUCH)
{
touchRead(&g_lastTouch);
g_lastTouch.px <<= 7;
g_lastTouch.py <<= 7;
}
if (keysHeld() & KEY_TOUCH) // this is only for x axis
{
touchRead(&g_currentTouch);// = touchReadXY();
// let's use some fixed point magic to improve touch smoothing accuracy
g_currentTouch.px <<= 7;
g_currentTouch.py <<= 7;
dx = (g_currentTouch.px - g_lastTouch.px) >> 6;
dy = (g_currentTouch.py - g_lastTouch.py) >> 6;
ev.type = ev_mouse;
ev.data1 = 0;
ev.data2 = (dx << 3) * (mouseSensitivity + 5) / 10;
ev.data3 = (dy >> 1) * (mouseSensitivity + 5) / 10;
D_PostEvent(&ev);
g_lastTouch.px = (g_lastTouch.px + g_currentTouch.px) / 2;
g_lastTouch.py = (g_lastTouch.py + g_currentTouch.py) / 2;
}
irrstCstickRead(&nubPos);
if (abs(nubPos.dx) > 20 || abs(nubPos.dy) > 20) {
dx = 0;
dy = 0;
if (abs(nubPos.dx) > 20) {
dx = (nubPos.dx) * (nubSensitivity + 5) / 10;
}
if (abs(nubPos.dy) > 20) {
dy = -(nubPos.dy) * (nubSensitivity + 5) / 10;
}
ev.type = ev_nub;
ev.data1 = 0;
ev.data2 = dx;
ev.data3 = dy;
D_PostEvent(&ev);
}
circleRead(&cstickPos);
if (abs(cstickPos.dx) > 20 || abs(cstickPos.dy) > 20) {
dx = 0;
dy = 0;
if (abs(cstickPos.dx) > 20) {
dx = (cstickPos.dx >> 2) * (cstickSensitivity + 5) / 10;
}
if (abs(cstickPos.dy) > 20) {
dy = (cstickPos.dy >> 2) * (cstickSensitivity + 5) / 10;
}
ev.type = ev_cstick;
ev.data1 = 0;
ev.data2 = dx;
ev.data3 = dy;
D_PostEvent(&ev);
}
keyboard_input();
}
#endif
|
/*
* Copyright 2010 Tilera Corporation. All Rights Reserved.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, version 2.
*
* 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, GOOD TITLE or
* NON INFRINGEMENT. See the GNU General Public License for
* more details.
*/
#ifndef _ASM_TILE_SECTIONS_H
#define _ASM_TILE_SECTIONS_H
#define arch_is_kernel_data arch_is_kernel_data
#include <asm-generic/sections.h>
/* Text and data are at different areas in the kernel VA space. */
extern char _sinitdata[], _einitdata[];
/* Write-once data is writable only till the end of initialization. */
extern char __w1data_begin[], __w1data_end[];
/* Not exactly sections, but PC comparison points in the code. */
extern __visible char __rt_sigreturn[], __rt_sigreturn_end[];
#ifndef __tilegx__
extern __visible char sys_cmpxchg[], __sys_cmpxchg_end[];
extern __visible char __sys_cmpxchg_grab_lock[];
extern __visible char __start_atomic_asm_code[], __end_atomic_asm_code[];
#endif
/* Handle the discontiguity between _sdata and _stext. */
static inline int arch_is_kernel_data(unsigned long addr)
{
return addr >= (unsigned long)_sdata &&
addr < (unsigned long)_end;
}
#endif /* _ASM_TILE_SECTIONS_H */
|
/*
===========================================================================
Copyright (C) 2006 Dmn_clown (aka: Bob Isaac (rjisaac@gmail.com))
This file is part of Open Arena and is based upon Mr. Elusive's fuzzy logic
system found in Quake 3 Arena.
Open Arena 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.
Open Arena 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 Foobar; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
===========================================================================
*/
#include "inv.h"
//health
#define FPH 2
//armor
#define FPA 2
//without the weapons
//shotgun
#define SGW 90
//machinegun
#define MGW 50
//grenadelauncher
#define GLW 150
//rocket launcher
#define RLW 220
//rail gun
#define RGW 160
//bfg10k
#define BFW 150
//lightninggun
#define LGW 195
//plasmagun
#define PGW 260
//prox-launcher
#define PXW 180
//nailgun
#define NGW 350
//chaingun
#define CGW 100
//with the weapons
//shotgun
#define GSGW 50
//machinegun
#define GMGW 50
//grenadelauncher
#define GGLW 110
//rocketlauncher
#define GRLW 120
//railgun
#define GRGW 150
//bfg10k
#define GBFW 50
//lightninggun
#define GLGW 100
//plasmagun
#define GPGW 150
//prox-launcher
#define GPXW 100
//nailgun
#define GNGW 120
//chaingun
#define GCGW 125
//individual powerups
//teleport
#define TELW 140
//medkit
#define MEDW 190
//quad-damage
#define QW 200
//envirosuit
#define ENVW 150
//haste
#define HAW 125
//invisibility
#define INW 130
//regeneration
#define REGW 150
//flight
#define FLW 150
//kamikaze
#define KAMW 390
//invulnerability
#define IBW 150
//portal
#define PORW 130
//scout
#define SCW 190
//guard
#define GUW 180
//doubler
#define DUBW 110
//ammo-regen
#define AMRW 160
//red-cube
#define REDCW 200
//blue-cube
#define BLCW 200
//ctf flag weight
#define FGW 450
//
#include "fuzi.c"
|
/*-
* Copyright (c) 1997 Jonathan Lemon
* 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 AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: release/8.2.0/sys/i386/include/pcb_ext.h 199583 2009-11-20 15:27:52Z jhb $
*/
#ifndef _I386_PCB_EXT_H_
#define _I386_PCB_EXT_H_
/*
* Extension to the 386 process control block
*/
#include <machine/tss.h>
#include <machine/vm86.h>
#include <machine/segments.h>
struct pcb_ext {
struct segment_descriptor ext_tssd; /* tss descriptor */
struct i386tss ext_tss; /* per-process i386tss */
caddr_t ext_iomap; /* i/o permission bitmap */
struct vm86_kernel ext_vm86; /* vm86 area */
};
#ifdef _KERNEL
extern int private_tss;
int i386_extend_pcb(struct thread *);
#endif
#endif /* _I386_PCB_EXT_H_ */
|
#if !defined(HISTORYSTATS_GUARD_UTILS_PATTERN_H)
#define HISTORYSTATS_GUARD_UTILS_PATTERN_H
namespace pattern
{
template<typename T_>
class NotCopyable
{
private:
NotCopyable(const NotCopyable&);
const NotCopyable& operator =(const NotCopyable&);
protected:
NotCopyable()
{
}
~NotCopyable()
{
}
};
template<typename T_>
class NotInstantiable
{
private:
NotInstantiable(const NotInstantiable&);
const NotInstantiable& operator =(const NotInstantiable&);
protected:
NotInstantiable();
~NotInstantiable()
{
}
};
}
#endif // HISTORYSTATS_GUARD_UTILS_PATTERN_H |
/** \file globalfunctions.h defines hlper functions */
#ifndef __GLOBAL_F__
#define __GLOBAL_F__
#include <cmath>
#include "kernel/displayparams.h"
//TODO asi by t mohlo byt vacsie, na viac desatinnych miest
#define PI 3.14
#define min(a,b) (a) < (b)? (a):(b)
#define max(a,b) (a) > (b)? (a):(b)
/** \brief converts degres to radians */
float toRadians(int angle);
/** \brief converts degrees to radians */
int toDegree(float angle);
/** rotates the position*/
/** rotates the positin around origin (0,0) ny angle */
void rotate(int angle, double& x, double& y);
template<typename T>
void rotatePosition( T xin, T yin, T& xout, T &yout, int angle )
{
float s = sqrt(static_cast<double>(xin*xin+yin*yin));
xout = s*cos(toRadians(angle));
yout = s*sin(toRadians(angle));
};
void rotatePdf( pdfobjects::DisplayParams displayparams, double& x,double& y, bool toUpPosition);
#define ANNOTS(XX) \
XX("Text", Text) \
XX("Link", Link) \
XX("Highlight", Highlight) \
XX("", Supported) \
#define AENUMS(a,b) A##b,
#define CREATE_ARRAY(a,b) a,
/** \brief enum for supported annotations */
/** annotation not define here will not be handled */
enum SupportedAnnotation
{
ANNOTS(AENUMS)
};
#endif // __GLOBAL_F__
|
#ifndef IVL_globals_H
#define IVL_globals_H
/*
* Copyright (c) 2000-2014 Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
# include <stddef.h>
/* Count errors in the command file. */
extern int command_file_errors;
/* This is the integer-width argument that will be passed to ivl. */
extern unsigned integer_width;
/* This is the width-cap argument that will be passed to ivl. */
extern unsigned width_cap;
extern const char*vhdlpp_work;
extern const char**vhdlpp_libdir;
extern unsigned vhdlpp_libdir_cnt;
/* Perform variable substitutions on the string. */
extern char* substitutions(const char*str);
/* Add the name to the list of source files. */
extern void process_file_name(const char*name, int lib_flag);
/* Add the name to the list of library directories. */
extern void process_library_switch(const char*name);
extern void process_library_nocase_switch(const char*name);
extern void process_library2_switch(const char*name);
/* Add a new include file search directory */
extern void process_include_dir(const char*name);
/* Add a new -D define. */
extern void process_define(const char*name);
/* Add a new parameter definition */
extern void process_parameter(const char*name);
/* Set the default timescale for the simulator. */
extern void process_timescale(const char*ts_string);
#endif /* IVL_globals_H */
|
Complex frenel(const Doub x) {
static const Int MAXIT=100;
static const Doub PI=3.141592653589793238, PIBY2=(PI/2.0), XMIN=1.5,
EPS=numeric_limits<Doub>::epsilon(),
FPMIN=numeric_limits<Doub>::min(),
BIG=numeric_limits<Doub>::max()*EPS;
Bool odd;
Int k,n;
Doub a,ax,fact,pix2,sign,sum,sumc,sums,term,test;
Complex b,cc,d,h,del,cs;
if ((ax=abs(x)) < sqrt(FPMIN)) {
cs=ax;
} else if (ax <= XMIN) {
sum=sums=0.0;
sumc=ax;
sign=1.0;
fact=PIBY2*ax*ax;
odd=true;
term=ax;
n=3;
for (k=1;k<=MAXIT;k++) {
term *= fact/k;
sum += sign*term/n;
test=abs(sum)*EPS;
if (odd) {
sign = -sign;
sums=sum;
sum=sumc;
} else {
sumc=sum;
sum=sums;
}
if (term < test) break;
odd=!odd;
n += 2;
}
if (k > MAXIT) throw("series failed in frenel");
cs=Complex(sumc,sums);
} else {
pix2=PI*ax*ax;
b=Complex(1.0,-pix2);
cc=BIG;
d=h=1.0/b;
n = -1;
for (k=2;k<=MAXIT;k++) {
n += 2;
a = -n*(n+1);
b += 4.0;
d=1.0/(a*d+b);
cc=b+a/cc;
del=cc*d;
h *= del;
if (abs(real(del)-1.0)+abs(imag(del)) <= EPS) break;
}
if (k > MAXIT) throw("cf failed in frenel");
h *= Complex(ax,-ax);
cs=Complex(0.5,0.5)
*(1.0-Complex(cos(0.5*pix2),sin(0.5*pix2))*h);
}
if (x < 0.0) cs = -cs;
return cs;
}
|
#pragma once
class DlgBorrowShell :
public jkBaseDialog
{
public:
DlgBorrowShell(void);
~DlgBorrowShell(void);
virtual void OnInitDialog();
virtual void OnOk();
};
|
/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2007 by Steve Nygard.
*/
#import "NSObject.h"
@class SBApplication, SBButtonBar, SBContentLayer, SBZoomView, UIView, UIWindow;
@interface SBUIController : NSObject
{
UIWindow *_window; // 4 = 0x4
UIView *_iconsView; // 8 = 0x8
SBButtonBar *_buttonBar; // 12 = 0xc
SBContentLayer *_contentLayer; // 16 = 0x10
SBZoomView *_zoomLayer; // 20 = 0x14
SBApplication *_launchedApp; // 24 = 0x18
int _launchState; // 28 = 0x1c
BOOL _lastVolumeDownToControl; // 32 = 0x20
BOOL _shouldAutoLock; // 33 = 0x21
int _batteryCapacity; // 36 = 0x24
BOOL _isBatteryCharging; // 40 = 0x28
BOOL _isOnAC; // 41 = 0x29
BOOL _cancelingLaunch; // 42 = 0x2a
int _batteryLoggingStartCapacity; // 44 = 0x2c
unsigned char _headsetBatteryCapacity; // 48 = 0x30
BOOL _isHeadsetCharging; // 49 = 0x31
BOOL _isHeadsetDocked; // 50 = 0x32
}
+ (int)displayedLevelForBatteryLevel:(int)fp8; // IMP=0x0000bcb4
+ (int)displayedLevelForBatteryStatusBarLevel:(int)fp8; // IMP=0x0000bf50
+ (id)sharedInstance; // IMP=0x0000c78c
- (void)ACPowerChanged; // IMP=0x0000f43c
- (void)_indicateConnectedToPower; // IMP=0x0000bc9c
- (struct CGAffineTransform)_initialStatusBarTransformForScale:(float)fp8; // IMP=0x0000e364
- (double)animateLaunchForReturnToLastApp:(id)fp8; // IMP=0x0000ec94
- (void)animateLaunchIcon:(id)fp8; // IMP=0x0000eba8
- (void)animateLaunchOfApplication:(id)fp8; // IMP=0x0000eb40
- (void)animateLaunchOfApplication:(id)fp8 afterDelay:(double)fp12 startingAtTime:(double)fp20 forDuration:(double)fp28 includingIconsAndButtonBar:(BOOL)fp36 initialZoomScale:(float)fp40 fadeInZoom:(BOOL)fp44; // IMP=0x0000e3d4
- (void)applicationExited:(id)fp8; // IMP=0x0000f41c
- (void)applicationSuspended:(id)fp8; // IMP=0x0000f420
- (int)batteryCapacity; // IMP=0x0000f424
- (id)buttonBar; // IMP=0x0000d940
- (float)calculateStartupTime; // IMP=0x0000c8c4
- (void)cancelLaunchAnimationDidStop:(id)fp8 finished:(id)fp12; // IMP=0x0000eea0
- (void)cancelLaunchOfApplication:(id)fp8 duration:(double)fp12; // IMP=0x0000e95c
- (void)clearLaunchedAfterLanguageRestart; // IMP=0x0000c888
- (void)clearZoomLayer; // IMP=0x0000d834
- (void)clickedMenuButton; // IMP=0x0000eefc
- (void)completeAlertDisplay; // IMP=0x0000f0a0
- (id)contentView; // IMP=0x0000d8f8
- (void)dealloc; // IMP=0x0000c7dc
- (void)finishLaunching; // IMP=0x0000d210
- (void)finishedFadingInButtonBar; // IMP=0x0000ed48
- (id)getVMstats; // IMP=0x0000c9bc
- (void)handleAccessoryAvailabilityChange:(struct __GSEvent *)fp8 removal:(BOOL)fp12; // IMP=0x0000f5c0
- (void)handleAccessoryEvent:(struct __GSEvent *)fp8; // IMP=0x0000f628
- (void)handleVolumeEvent:(struct __GSEvent *)fp8; // IMP=0x0000f23c
- (unsigned char)headsetBatteryCapacity; // IMP=0x0000f5b8
- (void)hideIconListAndBar:(BOOL)fp8; // IMP=0x0000dcb8
- (id)init; // IMP=0x0000f74c
- (BOOL)isBatteryCharging; // IMP=0x0000f42c
- (BOOL)isHeadsetBatteryCharging; // IMP=0x0000f5b0
- (BOOL)isHeadsetDocked; // IMP=0x0000f5a8
- (BOOL)isOnAC; // IMP=0x0000f434
- (void)languageChanged; // IMP=0x0000ce6c
- (int)launchState; // IMP=0x0000d82c
- (BOOL)launchedAfterLanguageRestart; // IMP=0x0000c860
- (void)lock; // IMP=0x0000d80c
- (void)lock:(BOOL)fp8; // IMP=0x0000d4bc
- (void)logStartupData; // IMP=0x0000cc68
- (void)noteStatusBarHeightChanged:(float)fp8 duration:(double)fp12; // IMP=0x0000f4a8
- (void)quitTopApplication; // IMP=0x0000e33c
- (void)restoreIconList:(BOOL)fp8 force:(BOOL)fp12; // IMP=0x0000dd20
- (void)setState:(int)fp8; // IMP=0x0000d874
- (BOOL)shouldDisconnectCallsOnLockPress; // IMP=0x0000d4b4
- (void)showButtonBar:(BOOL)fp8 animate:(BOOL)fp12 action:(SEL)fp16 delegate:(id)fp20; // IMP=0x0000e184
- (void)showZoomLayerAnimationDidStop:(id)fp8 finished:(id)fp12; // IMP=0x0000edb8
- (void)showZoomLayerForApp:(id)fp8; // IMP=0x0000d948
- (id)statusBarWindow; // IMP=0x0000d900
- (void)stopAllAnimations; // IMP=0x0000dcb4
- (void)stopRestoringIconList; // IMP=0x0000e0b4
- (void)systemControllerRouteChanged:(id)fp8; // IMP=0x0000d480
- (void)wakeUp:(id)fp8; // IMP=0x0000f140
- (id)window; // IMP=0x0000d938
@end
|
/* drotg.f -- translated by f2c (version 20031025).
You must link the resulting object file with libf2c:
on Microsoft Windows system, link with libf2c.lib;
on Linux or Unix systems, link with .../path/to/libf2c.a -lm
or, if you install libf2c.a in a standard place, with -lf2c -lm
-- in that order, at the end of the command line, as in
cc *.o -lf2c -lm
Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
http://www.netlib.org/f2c/libf2c.zip
*/
#include "f2c.h"
/* Table of constant values */
static double c_b4 = 1.;
/* Subroutine */ int drotg_(double *da, double *db, double *c__,
double *s)
{
/* System generated locals */
double d__1, d__2;
/* Builtin functions */
double sqrt(double), d_sign(double *, double *);
/* Local variables */
static double r__, z__, roe, scale;
/* construct givens plane rotation. */
/* jack dongarra, linpack, 3/11/78. */
roe = *db;
if (abs(*da) > abs(*db)) {
roe = *da;
}
scale = abs(*da) + abs(*db);
if (scale != 0.) {
goto L10;
}
*c__ = 1.;
*s = 0.;
r__ = 0.;
z__ = 0.;
goto L20;
L10:
/* Computing 2nd power */
d__1 = *da / scale;
/* Computing 2nd power */
d__2 = *db / scale;
r__ = scale * sqrt(d__1 * d__1 + d__2 * d__2);
r__ = d_sign(&c_b4, &roe) * r__;
*c__ = *da / r__;
*s = *db / r__;
z__ = 1.;
if (abs(*da) > abs(*db)) {
z__ = *s;
}
if (abs(*db) >= abs(*da) && *c__ != 0.) {
z__ = 1. / *c__;
}
L20:
*da = r__;
*db = z__;
return 0;
} /* drotg_ */
|
/************************************************************************
$Id: bfclientshoottwicestate.h,v 1.2 2005/01/06 17:59:26 jonico Exp $
RTB - Team Framework: Framework for RealTime Battle robots to communicate efficiently in a team
Copyright (C) 2004 The RTB- Team Framework Group: http://rtb-team.sourceforge.net
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
$Log: bfclientshoottwicestate.h,v $
Revision 1.2 2005/01/06 17:59:26 jonico
Now all files in the repository have their new header format.
**************************************************************************/
#ifndef BFCLIENTSHOOTTWICESTATE_H
#define BFCLIENTSHOOTTWICESTATE_H
#include "bfclientbasicstate.h"
/**
* Namespace Brotfrucht
*/
namespace Brotfrucht {
/**
* Class BFClientShootTwiceState
*/
class BFClientShootTwiceState: public BFClientBasicState {
public:
BFClientShootTwiceState(ClientCoordinator* i,BFClientSpecificRepository* bfcsp,const GameOptionsRepository* go) throw (StrategyException,bad_exception);
/**
* This method is called when the RTB message "RobotsLeft [num]" occurs. This message is sent at the beginning of the game and after a robot has been killed.
* @param num The number of remaining robots
*/
void receiveRTBMessageRobotsLeft(int num) throw (StrategyException, bad_exception);
private:
BFClientSpecificRepository* _bfcsp;
};
}
#endif
|
/**********************************************************************
Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
***********************************************************************/
#ifndef FC__THREAD_H
#define FC__THREAD_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "support.h" /* bool */
#ifdef HAVE_PTHREAD
#include <pthread.h>
#define fc_thread pthread_t
#define fc_mutex pthread_mutex_t
#define fc_thread_cond pthread_cond_t
#elif defined (HAVE_WINTHREADS)
#include <windows.h>
#define fc_thread HANDLE *
#define fc_mutex HANDLE *
#ifndef HAVE_THREAD_COND
#define fc_thread_cond char
#else /* HAVE_THREAD_COND */
#warning HAVE_THREAD_COND defined but we have no real Windows implementation
#endif /* HAVE_THREAD_COND */
#else /* No pthreads nor winthreads */
/* Dummy */
/* These must be real types with size instead of 'void' */
#define fc_thread char
#define fc_mutex char
#define fc_thread_cond char
#endif /* HAVE_PTHREAD */
int fc_thread_start(fc_thread *thread, void (*function) (void *arg), void *arg);
void fc_thread_wait(fc_thread *thread);
void fc_init_mutex(fc_mutex *mutex);
void fc_destroy_mutex(fc_mutex *mutex);
void fc_allocate_mutex(fc_mutex *mutex);
void fc_release_mutex(fc_mutex *mutex);
void fc_thread_cond_init(fc_thread_cond *cond);
void fc_thread_cond_destroy(fc_thread_cond *cond);
void fc_thread_cond_wait(fc_thread_cond *cond, fc_mutex *mutex);
void fc_thread_cond_signal(fc_thread_cond *cond);
bool has_thread_impl(void);
bool has_thread_cond_impl(void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* FC__THREAD_H */
|
/*
* This file is part of the coreboot project.
*
* Copyright (C) 2015-2016 Advanced Micro Devices, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#include <AGESA.h>
#include <agesawrapper.h>
#include <PlatformMemoryConfiguration.h>
#define FILECODE PROC_GNB_PCIE_FAMILY_0X15_F15PCIECOMPLEXCONFIG_FILECODE
static const PCIe_PORT_DESCRIPTOR PortList[] = {
/* Initialize Port descriptor (PCIe port, Lanes 7:4, D2F1) for NC*/
{
0,
PCIE_ENGINE_DATA_INITIALIZER(PcieUnusedEngine, 4, 7),
PCIE_PORT_DATA_INITIALIZER_V2(PortDisabled, ChannelTypeExt6db,
2, 1,
HotplugDisabled,
PcieGenMaxSupported,
PcieGenMaxSupported,
AspmL0sL1, 0x04, 0)
},
/* Initialize Port descriptor (PCIe port, Lanes 0:0, D2F2) for WLAN */
{
0,
PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 0, 0),
PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db,
2, 2,
HotplugDisabled,
PcieGenMaxSupported,
PcieGenMaxSupported,
AspmL0sL1, 0x2, 0)
},
/* Init Port descriptor (PCIe port, Lanes 1:1, D2F3) for Card Reader */
{
0,
PCIE_ENGINE_DATA_INITIALIZER(PciePortEngine, 1, 1),
PCIE_PORT_DATA_INITIALIZER_V2(PortEnabled, ChannelTypeExt6db,
2, 3,
HotplugDisabled,
PcieGenMaxSupported,
PcieGenMaxSupported,
AspmL0sL1, 0x3, 0)
},
/* Initialize Port descriptor (PCIe port, Lane 2, D2F4) for NC */
{
0,
PCIE_ENGINE_DATA_INITIALIZER(PcieUnusedEngine, 2, 2),
PCIE_PORT_DATA_INITIALIZER_V2(PortDisabled, ChannelTypeExt6db,
2, 4,
HotplugDisabled,
PcieGenMaxSupported,
PcieGenMaxSupported,
AspmL0sL1, 0, 0)
},
/* Initialize Port descriptor (PCIe port, Lane3, D2F5) for NC */
{
DESCRIPTOR_TERMINATE_LIST,
PCIE_ENGINE_DATA_INITIALIZER(PcieUnusedEngine, 3, 3),
PCIE_PORT_DATA_INITIALIZER_V2(PortDisabled, ChannelTypeExt6db,
2, 5,
HotplugDisabled,
PcieGenMaxSupported,
PcieGenMaxSupported,
AspmL0sL1, 0, 0)
},
};
static const PCIe_DDI_DESCRIPTOR DdiList[] = {
/* DDI0 - eDP */
{
0,
PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 8, 11),
PCIE_DDI_DATA_INITIALIZER(ConnectorTypeEDP, Aux1, Hdp1)
},
/* DDI1 - DP */
{
0,
PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 12, 15),
PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP, Aux2, Hdp2)
},
/* DDI2 - DP */
{
DESCRIPTOR_TERMINATE_LIST,
PCIE_ENGINE_DATA_INITIALIZER(PcieDdiEngine, 16, 19),
PCIE_DDI_DATA_INITIALIZER(ConnectorTypeDP, Aux3, Hdp3)
},
};
static const PCIe_COMPLEX_DESCRIPTOR PcieComplex = {
.Flags = DESCRIPTOR_TERMINATE_LIST,
.SocketId = 0,
.PciePortList = (void *)PortList,
.DdiLinkList = (void *)DdiList
};
/*---------------------------------------------------------------------------*/
/**
* OemCustomizeInitEarly
*
* Description:
* This is the stub function will call the host environment through the
* binary block interface (call-out port) to provide a user hook opportunity.
*
* Parameters:
* @param[in] **PeiServices
* @param[in] *InitEarly
*
* @retval VOID
*
**/
/*---------------------------------------------------------------------------*/
VOID OemCustomizeInitEarly(IN OUT AMD_EARLY_PARAMS *InitEarly)
{
InitEarly->GnbConfig.PcieComplexList = (void *)&PcieComplex;
InitEarly->PlatformConfig.GnbAzI2sBusSelect = GnbAcpI2sBus;
InitEarly->PlatformConfig.GnbAzI2sBusPinConfig = GnbAcp2Tx4RxBluetooth;
}
|
/*
* The ManaPlus Client
* Copyright (C) 2004-2009 The Mana World Development Team
* Copyright (C) 2009-2010 The Mana Developers
* Copyright (C) 2011-2018 The ManaPlus Developers
*
* This file is part of The ManaPlus Client.
*
* 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
* 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 GUI_WINDOWS_EGGSELECTIONDIALOG_H
#define GUI_WINDOWS_EGGSELECTIONDIALOG_H
#include "gui/widgets/selldialog.h"
class EggSelectionDialog final : public SellDialog
{
public:
/**
* Constructor.
*
* @see Window::Window
*/
EggSelectionDialog();
A_DELETE_COPY(EggSelectionDialog)
protected:
void initButtons() override final;
void sellAction(const ActionEvent &event) override final;
};
#endif // GUI_WINDOWS_EGGSELECTIONDIALOG_H
|
/****************************************************************************
**
** Copyright (C) 2008 Ben Klopfenstein <benklop@gmail.com>
**
** This file is part of QtEmu.
**
** 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 Library General Public License
** along with this library; see the file COPYING.LIB. If not, write to
** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
** Boston, MA 02110-1301, USA.
**
****************************************************************************/
#ifndef USBMODEL_H
#define USBMODEL_H
#include <QStandardItemModel>
#include "halobject.h"
class MachineConfigObject;
class UsbModel : public QStandardItemModel
{
Q_OBJECT
public:
UsbModel(MachineConfigObject * config, QObject * parent);
private:
void getUsbDevices();
void loadConfig();
void checkDevice(QString deviceName);
void addItem(QString deviceName, QString id);
MachineConfigObject *config;
HalObject *hal;
private slots:
void getChange(QStandardItem * item);
void deviceAdded(QString name, UsbDevice device);
void deviceRemoved(QString name, UsbDevice device);
signals:
void vmDeviceAdded(QString identifier);
void vmDeviceRemoved(QString identifier);
};
#endif // USBMODEL_H
|
#ifndef _DVB_USB_CXUSB_H_
#define _DVB_USB_CXUSB_H_
#define DVB_USB_LOG_PREFIX "cxusb"
#include "dvb-usb.h"
/* usb commands - some of it are guesses, don't have a reference yet */
#define CMD_BLUEBIRD_GPIO_RW 0x05
#define CMD_I2C_WRITE 0x08
#define CMD_I2C_READ 0x09
#define CMD_GPIO_READ 0x0d
#define CMD_GPIO_WRITE 0x0e
#define GPIO_TUNER 0x02
#define CMD_POWER_OFF 0xdc
#define CMD_POWER_ON 0xde
#define CMD_STREAMING_ON 0x36
#define CMD_STREAMING_OFF 0x37
#define CMD_AVER_STREAM_ON 0x18
#define CMD_AVER_STREAM_OFF 0x19
#define CMD_GET_IR_CODE 0x47
#define CMD_ANALOG 0x50
#define CMD_DIGITAL 0x51
struct cxusb_state {
u8 gpio_write_state[3];
struct mutex stream_mutex;
u8 last_lock;
int (*fe_read_status)(struct dvb_frontend *fe,
enum fe_status *status);
};
#endif
|
/*
* mmu.h
*/
#ifndef __MMU_H__
#define __MMU_H__
#include "hal/isr.h" // For struct registers
#include "page.h"
#include "mutex.h"
struct pdir;
/*
* MMU context
*/
struct mmu_ctx {
/* Virtual address of the page directory */
struct pdir *pdir;
/* Physical address of the page directory */
phys_addr_t pdbr;
/* MMU context lock */
struct mutex lock;
};
extern struct mmu_ctx _kernel_mmu_ctx;
/* Macro that expands to a pointer to the current address space */
#define CURR_ASPACE (CURR_CORE->aspace)
/* Determine if an MMU context is the kernel context */
#define IS_KERNEL_CTX(ctx) (ctx == &_kernel_mmu_ctx)
/* Flags for MMU map */
#define MMU_MAP_READ (1<<0)
#define MMU_MAP_WRITE (1<<1)
#define MMU_MAP_EXEC (1<<2)
extern void page_fault(struct registers *regs);
extern struct mmu_ctx *mmu_create_ctx();
extern struct page *mmu_get_page(struct mmu_ctx *ctx, ptr_t addr, boolean_t make, int mmflag);
extern int mmu_map(struct mmu_ctx *ctx, ptr_t virt, phys_addr_t phys, int flags);
extern int mmu_unmap(struct mmu_ctx *ctx, ptr_t virt, boolean_t shared, phys_addr_t *physp);
extern void mmu_load_ctx(struct mmu_ctx *ctx);
extern void mmu_clone_ctx(struct mmu_ctx *dst, struct mmu_ctx *src);
extern void mmu_destroy_ctx(struct mmu_ctx *ctx);
extern void init_mmu_percore();
extern void init_mmu();
#endif /* __MMU_H__ */
|
/*
* File : libc.h
* Brief : armcc libc header file
*
* This file is part of RT-Thread RTOS
* COPYRIGHT (C) 2006 - 2017, RT-Thread Development Team
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Change Logs:
* Date Author Notes
* 2017/10/15 bernard the first version
*/
#ifndef __RTT_LIBC_H__
#define __RTT_LIBC_H__
#include <stddef.h>
int libc_system_init(void);
int libc_stdio_set_console(const char* device_name, int mode);
int libc_stdio_read (void *buffer, size_t size);
int libc_stdio_write(const void *buffer, size_t size);
#endif
|
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*-
#ifndef __java_lang_ref_Reference__
#define __java_lang_ref_Reference__
#pragma interface
#include <java/lang/Object.h>
extern "Java"
{
namespace gnu
{
namespace gcj
{
class RawData;
}
}
}
class java::lang::ref::Reference : public ::java::lang::Object
{
public: // actually package-private
Reference (::java::lang::Object *);
Reference (::java::lang::Object *, ::java::lang::ref::ReferenceQueue *);
private:
void create (::java::lang::Object *);
public:
virtual ::java::lang::Object *get ();
virtual void clear ();
virtual jboolean isEnqueued ();
virtual jboolean enqueue ();
public: // actually package-private
::gnu::gcj::RawData * __attribute__((aligned(__alignof__( ::java::lang::Object )))) referent;
::gnu::gcj::RawData *copy;
jboolean cleared;
::java::lang::ref::ReferenceQueue *queue;
::java::lang::ref::Reference *nextOnQueue;
static ::java::lang::Object *lock;
public:
static ::java::lang::Class class$;
};
#endif /* __java_lang_ref_Reference__ */
|
//
// CAPPPageControl.h
// Infinite page control for CERN.app
//
// Created by Timur Pocheptsov on 16/12/13.
//
#import <UIKit/UIKit.h>
@class CAPPPageControl;
@protocol CAPPPageControlDelegate
@optional
- (void) pageControlDidEndAnimating : (CAPPPageControl *) control;
@end
@interface CAPPPageControl : UIView<UIScrollViewDelegate>
@property (nonatomic, weak) NSObject<CAPPPageControlDelegate> *delegate;
@property (nonatomic) BOOL animating;
@property (nonatomic) NSUInteger numberOfPages;
@property (nonatomic) NSUInteger activePage;
@end
|
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "parse.h"
#include "http.h"
#include "handle.h"
#include <unistd.h>
#ifndef DEBUG
#define DEBUG 0
#endif
static void error (int fd, int errcode, char *msg);
static void parse(int fd);
// utilities
void die (const char *msg)
{
fprintf (stderr, "Error: %s\n", msg);
exit (0);
}
void kprint (const char *msg)
{
write (1, msg, sizeof (msg));
return;
}
void write_file (int sockfd, const char *s)
{
int size = strlen (s);
write (sockfd, s, size);
return;
}
int main (int argc, char **argv)
{
Http_t tree;
if (argc<2)
die ("server bug");
signal(SIGCHLD, SIG_IGN);
// get the pipe fd
int pipefd = atoi (argv[1]);
if (DEBUG)
printf ("pipefd = %d\n", pipefd);
while (1){
char uri_str[1024];
int sockfd;
recvfd (pipefd, uri_str, sizeof(uri_str), &sockfd);
if (DEBUG){
printf("uri=[%s]\n", uri_str);
printf ("banksv client recieves a sockfd = %d\n", sockfd);
}
if(fork() == 0){
int ruid, euid, suid;
getresuid(&ruid, &euid, &suid);
if (DEBUG)
printf("ruid=[%d], euid=[%d], suid=[%d]\n"
, ruid
, euid
, suid);
ReqLine_t reqline = ReqLine_new(REQ_KIND_POST
, uri_str
, HTTP_ONE_ONE);
tree = Parse_parse(sockfd, 0);
tree->reqLine = reqline;
//response
Handle_main (sockfd, tree);
close(sockfd);
exit(0);
}
close(sockfd);
}
return 0;
}
void error (int fd, int errCode, char *msg)
{
int c;
while(read(fd, &c, 1)!=-1)
;
close (fd);
fprintf (stderr, "%d\n", errCode);
fprintf (stderr, "%s\n", msg);
exit (0);
return;
}
|
/**************************************************************
* Copyright (C) 2010 STMicroelectronics. All Rights Reserved.
* This file is part of the latest release of the Multicom4 project. This release
* is fully functional and provides all of the original MME functionality.This
* release is now considered stable and ready for integration with other software
* components.
* Multicom4 is a free software; you can redistribute it and/or modify it under the
* terms of the GNU General Public License as published by the Free Software Foundation
* version 2.
* Multicom4 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 Multicom4;
* see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place -
* Suite 330, Boston, MA 02111-1307, USA.
* Written by Multicom team at STMicroelectronics in November 2010.
* Contact multicom.support@st.com.
**************************************************************/
/*
*
*/
#include <bsp/_bsp.h>
#define MBOX0_ADDR 0xfe211000
#define MBOX1_ADDR 0xfe212000
#include <os21/st200.h>
/* #include <os21/st200/sti7111.h> */
extern interrupt_name_t OS21_INTERRUPT_MBOX_SH4;
struct bsp_mbox_regs bsp_mailboxes[] =
{
{
.base = (void *) (MBOX0_ADDR), /* Video LX Mailbox (MBOX0.1) */
.interrupt = (unsigned int) &OS21_INTERRUPT_MBOX_SH4,/* *WE* own this one */
.flags = 0
},
{
.base = (void *) (MBOX0_ADDR+0x100), /* Video LX Mailbox (MBOX0.2) */
.interrupt = 0,
.flags = 0
},
{ .base = (void *) (MBOX1_ADDR), /* Audio LX Mailbox (MBOX1.1) */
.interrupt = 0,
.flags = 0
},
{ .base = (void *) (MBOX1_ADDR+0x100), /* Audio LX Mailbox (MBOX1.2) */
.interrupt = 0,
.flags = 0
},
};
unsigned int bsp_mailbox_count = sizeof(bsp_mailboxes)/sizeof(bsp_mailboxes[0]);
/*
* Local Variables:
* tab-width: 8
* c-indent-level: 2
* c-basic-offset: 2
* End:
*/
|
/*
* arch/arm/include/asm/pgtable-2level-hwdef.h
*
* Copyright (C) 1995-2002 Russell King
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
#ifndef _ASM_PGTABLE_2LEVEL_HWDEF_H
#define _ASM_PGTABLE_2LEVEL_HWDEF_H
/*
* Hardware page table definitions.
*
* + Level 1 descriptor (PMD)
* - common
*/
#define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0)
#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0)
#define PMD_TYPE_TABLE (_AT(pmdval_t, 1) << 0)
#define PMD_TYPE_SECT (_AT(pmdval_t, 2) << 0)
#define PMD_BIT4 (_AT(pmdval_t, 1) << 4)
#define PMD_DOMAIN(x) (_AT(pmdval_t, (x)) << 5)
#define PMD_PROTECTION (_AT(pmdval_t, 1) << 9) /* v5 */
/*
* - section
*/
#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
#define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3)
#define PMD_SECT_XN (_AT(pmdval_t, 1) << 4) /* v6 */
#define PMD_SECT_AP_WRITE (_AT(pmdval_t, 1) << 10)
#define PMD_SECT_AP_READ (_AT(pmdval_t, 1) << 11)
#define PMD_SECT_TEX(x) (_AT(pmdval_t, (x)) << 12) /* v5 */
#define PMD_SECT_APX (_AT(pmdval_t, 1) << 15) /* v6 */
#define PMD_SECT_S (_AT(pmdval_t, 1) << 16) /* v6 */
#define PMD_SECT_nG (_AT(pmdval_t, 1) << 17) /* v6 */
#define PMD_SECT_SUPER (_AT(pmdval_t, 1) << 18) /* v6 */
#define PMD_SECT_AF (_AT(pmdval_t, 0))
#define PMD_SECT_UNCACHED (_AT(pmdval_t, 0))
#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
/*
* - coarse table (not used)
*/
/*
* + Level 2 descriptor (PTE)
* - common
*/
#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0)
#define PTE_TYPE_LARGE (_AT(pteval_t, 1) << 0)
#define PTE_TYPE_SMALL (_AT(pteval_t, 2) << 0)
#define PTE_TYPE_EXT (_AT(pteval_t, 3) << 0) /* v5 */
#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2)
#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3)
/*
* - extended small page/tiny page
*/
/*! 20131019 H/W ARM PTE 구조 */
#define PTE_EXT_XN (_AT(pteval_t, 1) << 0) /* v6 */
#define PTE_EXT_AP_MASK (_AT(pteval_t, 3) << 4)
#define PTE_EXT_AP0 (_AT(pteval_t, 1) << 4)
#define PTE_EXT_AP1 (_AT(pteval_t, 2) << 4)
#define PTE_EXT_AP_UNO_SRO (_AT(pteval_t, 0) << 4)
#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
#define PTE_EXT_TEX(x) (_AT(pteval_t, (x)) << 6) /* v5 */
#define PTE_EXT_APX (_AT(pteval_t, 1) << 9) /* v6 */
#define PTE_EXT_COHERENT (_AT(pteval_t, 1) << 9) /* XScale3 */
#define PTE_EXT_SHARED (_AT(pteval_t, 1) << 10) /* v6 */
#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* v6 */
/*
* - small page
*/
#define PTE_SMALL_AP_MASK (_AT(pteval_t, 0xff) << 4)
#define PTE_SMALL_AP_UNO_SRO (_AT(pteval_t, 0x00) << 4)
#define PTE_SMALL_AP_UNO_SRW (_AT(pteval_t, 0x55) << 4)
#define PTE_SMALL_AP_URO_SRW (_AT(pteval_t, 0xaa) << 4)
#define PTE_SMALL_AP_URW_SRW (_AT(pteval_t, 0xff) << 4)
#define PHYS_MASK (~0UL)
#endif
|
/* copied from linux wireless-2.6/net/mac80211/util.c */
/*
* Copyright 2002-2005, Instant802 Networks, Inc.
* Copyright 2005-2006, Devicescape Software, Inc.
* Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
* Copyright 2007 Johannes Berg <johannes@sipsolutions.net>
* Copyright 2014-2015 Bruno Randolf (br1@einfach.org)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* utilities for mac80211
*/
#include <stddef.h>
#include <string.h>
#include <math.h>
#include "ieee80211_util.h"
#include "wlan80211.h"
#include "main.h"
#include "util.h"
/* from mac80211/ieee80211_i.c, slightly modified */
/**
* ieee80211_is_erp_rate - Check if a rate is an ERP rate
* @phymode: The PHY-mode for this rate (MODE_IEEE80211...)
* @rate: Transmission rate to check, in 100 kbps
*
* Check if a given rate is an Extended Rate PHY (ERP) rate.
*/
static inline bool
ieee80211_is_erp_rate(int phymode, int rate)
{
if (phymode & PHY_FLAG_G) {
if (rate != 10 && rate != 20 &&
rate != 55 && rate != 110) {
DEBUG("erp\n");
return true;
}
}
DEBUG("no erp\n");
return false;
}
static int
get_cw_time(int cw_min, int cw_max, int retries, int slottime)
{
int cw = pow(2, (cw_min + retries)) - 1;
cw_max = pow(2, cw_max) - 1;
if(cw > cw_max)
cw = cw_max;
DEBUG("CW min %d max %d ret %d = %d\n", cw_min, cw_max, retries, cw);
return (cw * slottime) / 2;
}
static const unsigned char ieee802_1d_to_ac[8] = { 0, 1, 1, 0, 2, 2, 3, 3 };
/* BE BK VI VO */
static const unsigned char ac_to_aifs[4] = { 3, 7, 2, 2};
static const unsigned char ac_to_cwmin[4] = { 4, 4, 3, 2};
static const unsigned int ac_to_cwmax[4] = { 10, 10, 4, 3};
/* from mac80211/util.c, modified */
int
ieee80211_frame_duration(int phymode, size_t len, int rate, int short_preamble,
int shortslot, int type, char qos_class, int retries)
{
int dur;
bool erp;
int sifs, slottime;
static int last_was_cts;
erp = ieee80211_is_erp_rate(phymode, rate);
/* calculate duration (in microseconds, rounded up to next higher
* integer if it includes a fractional microsecond) to send frame of
* len bytes (does not include FCS) at the given rate. Duration will
* also include SIFS.
*
* rate is in 100 kbps, so divident is multiplied by 10 in the
* DIV_ROUND_UP() operations.
*/
DEBUG("DUR mode %d, len %d, rate %d, shortpre %d shortslot %d type %x UP %d\n", phymode, (int)len, rate, short_preamble, shortslot, type, qos_class);
if (phymode == PHY_FLAG_A || erp) {
DEBUG("OFDM\n");
/*
* OFDM:
*
* N_DBPS = DATARATE x 4
* N_SYM = Ceiling((16+8xLENGTH+6) / N_DBPS)
* (16 = SIGNAL time, 6 = tail bits)
* TXTIME = T_PREAMBLE + T_SIGNAL + T_SYM x N_SYM + Signal Ext
*
* T_SYM = 4 usec
* 802.11a - 17.5.2: aSIFSTime = 16 usec
* 802.11g - 19.8.4: aSIFSTime = 10 usec +
* signal ext = 6 usec
*/
sifs = 16; /* SIFS + signal ext */
slottime = 9;
dur = 16; /* 17.3.2.3: T_PREAMBLE = 16 usec */
dur += 4; /* 17.3.2.3: T_SIGNAL = 4 usec */
dur += 4 * DIV_ROUND_UP((16 + 8 * (len + 4) + 6) * 10,
4 * rate); /* T_SYM x N_SYM */
} else {
DEBUG("CCK\n");
/*
* 802.11b or 802.11g with 802.11b compatibility:
* 18.3.4: TXTIME = PreambleLength + PLCPHeaderTime +
* Ceiling(((LENGTH+PBCC)x8)/DATARATE). PBCC=0.
*
* 802.11 (DS): 15.3.3, 802.11b: 18.3.4
* aSIFSTime = 10 usec
* aPreambleLength = 144 usec or 72 usec with short preamble
* aPLCPHeaderLength = 48 usec or 24 usec with short preamble
*/
sifs = 10; /* aSIFSTime = 10 usec */
slottime = shortslot ? 9 : 20;
dur = short_preamble ? (72 + 24) : (144 + 48);
dur += DIV_ROUND_UP(8 * (len + 4) * 10, rate);
}
if (type == WLAN_FRAME_CTS ||
type == WLAN_FRAME_ACK) {
//TODO: also fragments
DEBUG("DUR SIFS\n");
dur += sifs;
}
else if (type == WLAN_FRAME_BEACON) {
/* TODO: which AIFS and CW should be used for beacons? */
dur += sifs + (2 * slottime); /* AIFS */
dur += (slottime * 1) / 2; /* contention */
}
else if (WLAN_FRAME_IS_DATA(type) && last_was_cts) {
DEBUG("DUR LAST CTS\n");
dur += sifs;
}
else if (type == WLAN_FRAME_QDATA) {
unsigned char ac = ieee802_1d_to_ac[(unsigned char)qos_class];
dur += sifs + (ac_to_aifs[ac] * slottime); /* AIFS */
dur += get_cw_time(ac_to_cwmin[ac], ac_to_cwmax[ac], retries, slottime);
DEBUG("DUR AIFS %d CWMIN %d AC %d, UP %d\n", ac_to_aifs[ac], ac_to_cwmin[ac], ac, qos_class);
}
else {
DEBUG("DUR DIFS\n");
dur += sifs + (2 * slottime); /* DIFS */
dur += get_cw_time(4, 10, retries, slottime);
}
if (type == WLAN_FRAME_CTS) {
DEBUG("SET CTS\n");
last_was_cts = 1;
}
else
last_was_cts = 0;
/* TODO: Add EIFS (SIFS + ACKTXTIME) to frames with CRC errors, if we can get them */
DEBUG("DUR %d\n", dur);
return dur;
}
int ieee80211_freq2channel(int freq)
{
if (freq == 2484)
return 14;
else if (freq < 2484)
return (freq - 2407) / 5;
else if (freq >= 4910 && freq <= 4980)
return (freq - 4000) / 5;
else
return (freq - 5000) / 5;
}
|
// *************************************************************************
//
// Copyright 2004-2010 Bruno PAGES .
//
// This file is part of the BOUML Uml Toolkit.
//
// 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.
//
// e-mail : bouml@free.fr
// home : http://bouml.free.fr
//
// *************************************************************************
#ifndef ACTIVITYACTIONCANVAS_H
#define ACTIVITYACTIONCANVAS_H
#include <qobject.h>
#include <q3valuelist.h>
//Added by qt3to4:
#include <Q3TextStream>
#include "DiagramCanvas.h"
#include "Settings.h"
#define ACTIVITYACTION_MIN_SIZE 40
class PinCanvas;
class ParameterSetCanvas;
class InfoCanvas;
class ActivityActionCanvas : public QObject, public DiagramCanvas {
Q_OBJECT
protected:
Q3ValueList<PinCanvas *> pins;
Q3ValueList<ParameterSetCanvas *> paramsets;
InfoCanvas * pre;
InfoCanvas * post;
InfoCanvas * constraint;
ActivityDrawingSettings settings;
ActivityDrawingSettings used_settings;
Uml3States show_opaque_action_definition;
UmlColor itscolor;
UmlColor used_color;
int align;
QString s;
protected:
ActivityActionCanvas(UmlCanvas * canvas, int id);
void check_pins();
void check_parametersets();
void check_conditions_constraint();
public:
ActivityActionCanvas(BrowserNode * bn, UmlCanvas * canvas, int x, int y);
virtual ~ActivityActionCanvas();
Q3ValueList<PinCanvas *> get_pins() { return pins; }
void add(PinCanvas * p) { pins.append(p); }
void force_pins_arround();
bool force_inside();
void check_parameter_sets_position();
int shadow_margin() const;
virtual void delete_it();
void update();
void deleted(PinCanvas *);
void deleted(ParameterSetCanvas *);
virtual void draw(QPainter & p);
virtual void change_scale();
virtual UmlCode type() const;
virtual void delete_available(BooL & in_model, BooL & out_model) const;
virtual bool alignable() const;
virtual bool copyable() const;
virtual void remove(bool from_model);
virtual void open();
virtual void menu(const QPoint&);
virtual QString may_start(UmlCode &) const;
virtual QString may_connect(UmlCode & l, const DiagramItem * dest) const;
virtual void connexion(UmlCode, DiagramItem *, const QPoint &, const QPoint &);
virtual void set_z(double z);
virtual aCorner on_resize_point(const QPoint & p);
virtual void resize(aCorner c, int dx, int dy, QPoint &);
virtual void resize(const QSize & sz, bool w, bool h);
virtual bool move_with_its_package() const;
virtual void moveBy(double dx, double dy);
virtual bool has_drawing_settings() const;
virtual void edit_drawing_settings(Q3PtrList<DiagramItem> &);
virtual void same_drawing_settings(Q3PtrList<DiagramItem> &);
void edit_drawing_settings();
virtual bool get_show_stereotype_properties() const;
virtual void apply_shortcut(QString s);
virtual void save(Q3TextStream & st, bool ref, QString & warning) const;
static ActivityActionCanvas * read(char * &, UmlCanvas *, char *);
virtual void post_loaded();
virtual void history_save(QBuffer &) const;
virtual void history_load(QBuffer &);
virtual void history_hide();
private slots:
void modified(); // canvas must be updated
void deleted();
};
#endif
|
/*
* \brief ELF binary utility
* \author Christian Helmuth
* \date 2006-05-04
*/
/*
* Copyright (C) 2006-2012 Genode Labs GmbH
*
* This file is part of the Genode OS framework, which is distributed
* under the terms of the GNU General Public License version 2.
*/
#ifndef _INCLUDE__BASE__ELF_H_
#define _INCLUDE__BASE__ELF_H_
#include <base/stdint.h>
namespace Genode {
class Elf_segment;
class Elf_binary
{
public:
/**
* Default constructor creates invalid object
*/
Elf_binary() : _valid(false) { }
/**
* Constructor
*
* The object is only useful if valid() returns true.
*/
explicit Elf_binary(addr_t start);
/* special types */
struct Flags {
unsigned r:1;
unsigned w:1;
unsigned x:1;
unsigned skip:1;
};
/**
* Read information about program segments
*
* \return properties of the specified program segment
*/
Elf_segment get_segment(unsigned num);
/**
* Check validity
*/
bool valid() { return _valid; }
/**
* Check for dynamic elf
*/
bool is_dynamically_linked() { return (_dynamic && _interp); }
/************************
** Accessor functions **
************************/
addr_t entry() { return valid() ? _entry : 0; }
private:
/* validity indicator indicates if the loaded ELF is valid and supported */
bool _valid;
/* dynamically linked */
bool _dynamic;
/* dynamic linker name matches 'genode' */
bool _interp;
/* ELF start pointer in memory */
addr_t _start;
/* ELF entry point */
addr_t _entry;
/* program segments */
addr_t _ph_table;
size_t _phentsize;
unsigned _phnum;
/************
** Helper **
************/
/**
* Check ELF header compatibility
*/
int _ehdr_check_compat();
/**
* Check program header compatibility
*/
int _ph_table_check_compat();
/**
* Check for dynamic program segments
*/
bool _dynamic_check_compat(unsigned type);
};
class Elf_segment
{
public:
/**
* Standard constructor creates invalid object
*/
Elf_segment() : _valid(false) { }
Elf_segment(const Elf_binary *elf, void *start, size_t file_offset,
size_t file_size, size_t mem_size, Elf_binary::Flags flags)
: _elf(elf), _start((unsigned char *)start), _file_offset(file_offset),
_file_size(file_size), _mem_size(mem_size), _flags(flags)
{
_valid = elf ? true : false;
}
const Elf_binary * elf() { return _elf; }
void * start() { return (void *)_start; }
size_t file_offset() { return _file_offset; }
size_t file_size() { return _file_size; }
size_t mem_size() { return _mem_size; }
Elf_binary::Flags flags() { return _flags; }
/**
* Check validity
*/
bool valid() { return _valid; }
private:
const Elf_binary *_elf;
bool _valid; /* validity indicator */
unsigned char *_start;
size_t _file_offset;
size_t _file_size;
size_t _mem_size;
Elf_binary::Flags _flags;
};
}
#endif /* _INCLUDE__BASE__ELF_H_ */
|
/*
This file is part of Valgrind, a dynamic binary instrumentation
framework.
Copyright (C) 2006-2012 OpenWorks LLP
info@open-works.co.uk
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307, USA.
The GNU General Public License is contained in the file COPYING.
*/
#ifndef __PUB_CORE_INITIMG_H
#define __PUB_CORE_INITIMG_H
typedef struct _IICreateImageInfo IICreateImageInfo;
typedef struct _IIFinaliseImageInfo IIFinaliseImageInfo;
extern
IIFinaliseImageInfo VG_(ii_create_image)( IICreateImageInfo );
extern
void VG_(ii_finalise_image)( IIFinaliseImageInfo );
#if defined(VGO_linux)
struct _IICreateImageInfo {
HChar* toolname;
Addr sp_at_startup;
Addr clstack_top;
HChar** argv;
HChar** envp;
};
struct _IIFinaliseImageInfo {
SizeT clstack_max_size;
Addr initial_client_SP;
Addr initial_client_IP;
Addr initial_client_TOC;
UInt* client_auxv;
};
#elif defined(VGO_darwin)
struct _IICreateImageInfo {
HChar* toolname;
Addr sp_at_startup;
Addr clstack_top;
HChar** argv;
HChar** envp;
Addr entry;
Addr init_ip;
Addr stack_start;
Addr stack_end;
Addr text;
Bool dynamic;
HChar* executable_path;
};
struct _IIFinaliseImageInfo {
SizeT clstack_max_size;
Addr initial_client_SP;
Addr initial_client_IP;
};
#else
# error "Unknown OS"
#endif
#endif
|
#ifndef __MMU_H
#define __MMU_H
typedef volatile unsigned long mm_context_t;
typedef unsigned long nv_mm_context_t;
#endif
|
/*
*
* Definitions for mount interface. This describes the in the kernel build
* linkedlist with mounted filesystems.
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
* Version: $Id: mount.h,v 2.0 1996/11/17 16:48:14 mvw Exp mvw $
*
*/
#ifndef _LINUX_MOUNT_H
#define _LINUX_MOUNT_H
#ifdef __KERNEL__
#include <linux/list.h>
#include <linux/spinlock.h>
#include <asm/atomic.h>
/*在已安装文件系统中禁止setuid和setgid标志*/
#define MNT_NOSUID 1
/*在已安装文件系统中禁止访问设备文件*/
#define MNT_NODEV 2
/*在已安装文件系统中不允许程序执行*/
#define MNT_NOEXEC 4
struct vfsmount
{
/*用户散列表链表的指针*/
struct list_head mnt_hash;
/*指向父文件系统,这个文件系统安装在其上*/
struct vfsmount *mnt_parent; /* fs we are mounted on */
/*指向这个文件系统安装点目录的dentry*/
struct dentry *mnt_mountpoint; /* dentry of mountpoint */
/*指向这个文件系统根目录的 dentry*/
struct dentry *mnt_root; /* root of the mounted tree */
/*指向这个文件系统的超级块对象*/
struct super_block *mnt_sb; /* pointer to superblock */
/*包含所有文件系统描述符链表的头*/
struct list_head mnt_mounts; /* list of children, anchored here */
/*用于已安装文件系统链表mnt_mounts的指针*/
struct list_head mnt_child; /* and going through their mnt_child */
/*引用计数器(增加该值以禁止文件系统被卸载)*/
atomic_t mnt_count;
/*标志*/
int mnt_flags;
/*如果文件系统标记为到期,那么就设置该标志为true(如果设置来该标志,并且没有任何人使用它,那么就可以自动卸载这个文件系统来)*/
int mnt_expiry_mark; /* true if marked for expiry */
/*设备文件名*/
char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */
/*已安装文件系统描述符的namespace 链表的指针*/
struct list_head mnt_list;
/*具体文件系统到期链表的指针*/
struct list_head mnt_fslink; /* link in fs-specific expiry list */
/*指向安装了文件系统的进程命名空间的指针*/
struct namespace *mnt_namespace; /* containing namespace */
};
static inline struct vfsmount *mntget(struct vfsmount *mnt)
{
if (mnt)
atomic_inc(&mnt->mnt_count);
return mnt;
}
extern void __mntput(struct vfsmount *mnt);
static inline void _mntput(struct vfsmount *mnt)
{
if (mnt) {
if (atomic_dec_and_test(&mnt->mnt_count))
__mntput(mnt);
}
}
static inline void mntput(struct vfsmount *mnt)
{
if (mnt) {
mnt->mnt_expiry_mark = 0;
_mntput(mnt);
}
}
extern void free_vfsmnt(struct vfsmount *mnt);
extern struct vfsmount *alloc_vfsmnt(const char *name);
extern struct vfsmount *do_kern_mount(const char *fstype, int flags,
const char *name, void *data);
struct nameidata;
extern int do_add_mount(struct vfsmount *newmnt, struct nameidata *nd,
int mnt_flags, struct list_head *fslist);
extern void mark_mounts_for_expiry(struct list_head *mounts);
extern spinlock_t vfsmount_lock;
#endif
#endif /* _LINUX_MOUNT_H */
|
#ifdef _CREAT_STACK_H
struct node* creat_stack(void);
#endif
|
/*
Copyright 2004, Xavier Neys (neysx@gentoo.org)
This file is part of gorg.
gorg 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.
gorg 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 Foobar; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __XSL_H__
#define __XSL_H__
#include <sys/stat.h>
#include <assert.h>
#include <unistd.h>
#include <ruby.h>
#include <libxslt/xslt.h>
#include <libexslt/exslt.h>
#include <libxslt/xsltInternals.h>
#include <libxslt/extra.h>
#include <libxslt/xsltutils.h>
#include <libxslt/transform.h>
typedef struct S_cleanup
{
char *params;
xmlDocPtr docxml, docxsl, docres;
xsltStylesheetPtr xsl;
xmlChar *docstr;
}
s_cleanup;
#define XSL_VERSION "0.1"
#endif
|
/***************************************************************************
LIANE-TTS COMPILER - C Version
Portuguese Text To Speech Compiler for the MBROLA Synthesizer
Copyright (C) 2010 - Serpro - ServiçFederal de Processamento de Dados
Author: Anibal Anibal de Souza Teles - NCE/UFRJ
Based on the original LianeTTS synthesizer - Pascal Version
Programmed by Joséntonio dos Santos Borges - NCE/UFRJ
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 <stdlib.h>
#include <string.h>
#include "liane-util.h"
/************************************************************************
* *
* trata_crlf *
* *
************************************************************************/
void trata_crlf (char *linha)
{
char *ultimo_ch;
ultimo_ch = linha + strlen (linha) - 1;
*ultimo_ch-- = '\0'; // newline
if (*ultimo_ch == '\r') *ultimo_ch = '\0';
str_strip (linha);
}
/************************************************************************
* *
* eh_comentario *
* *
************************************************************************/
bool eh_comentario (char *linha)
{
return (*linha == '\0') || (*linha == ';');
}
|
/* arch/arm/mach-msm/include/mach/memory.h
*
* Copyright (C) 2007 Google, Inc.
* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved.
*
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#ifndef __ASM_ARCH_MEMORY_H
#define __ASM_ARCH_MEMORY_H
#include <linux/types.h>
/* physical offset of RAM */
#define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET)
#if defined(CONFIG_KEXEC_HARDBOOT)
#if defined(CONFIG_MACH_APQ8064_FLO)
#define KEXEC_HB_PAGE_ADDR UL(0x88C00000)
#elif defined(CONFIG_MACH_APQ8064_MAKO)
#define KEXEC_HB_PAGE_ADDR UL(0x88600000)
#elif defined(CONFIG_ARCH_MSM8226)
#define KEXEC_HB_PAGE_ADDR UL(0x3e9e0000)
/*#define KEXEC_HB_KERNEL_LOC UL(0x5000000)*/
#else
#error "Adress for kexec hardboot page not defined"
#endif
#endif
#define MAX_PHYSMEM_BITS 32
#define SECTION_SIZE_BITS 28
/* Maximum number of Memory Regions
* The largest system can have 4 memory banks, each divided into 8 regions
*/
#define MAX_NR_REGIONS 32
/* The number of regions each memory bank is divided into */
#define NR_REGIONS_PER_BANK 8
/* Certain configurations of MSM7x30 have multiple memory banks.
* One or more of these banks can contain holes in the memory map as well.
* These macros define appropriate conversion routines between the physical
* and virtual address domains for supporting these configurations using
* SPARSEMEM and a 3G/1G VM split.
*/
#if defined(CONFIG_ARCH_MSM7X30)
#define EBI0_PHYS_OFFSET PHYS_OFFSET
#define EBI0_PAGE_OFFSET PAGE_OFFSET
#define EBI0_SIZE 0x10000000
#ifndef __ASSEMBLY__
extern unsigned long ebi1_phys_offset;
#define EBI1_PHYS_OFFSET (ebi1_phys_offset)
#define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE)
#if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G))
#define __phys_to_virt(phys) \
((phys) >= EBI1_PHYS_OFFSET ? \
(phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \
(phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET)
#define __virt_to_phys(virt) \
((virt) >= EBI1_PAGE_OFFSET ? \
(virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \
(virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET)
#endif
#endif
#endif
#ifndef __ASSEMBLY__
void *allocate_contiguous_ebi(unsigned long, unsigned long, int);
phys_addr_t allocate_contiguous_ebi_nomap(unsigned long, unsigned long);
void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long);
void clean_caches(unsigned long, unsigned long, unsigned long);
void invalidate_caches(unsigned long, unsigned long, unsigned long);
int msm_get_memory_type_from_name(const char *memtype_name);
unsigned long get_ddr_size(void);
#if defined(CONFIG_ARCH_MSM_ARM11) || defined(CONFIG_ARCH_MSM_CORTEX_A5)
void write_to_strongly_ordered_memory(void);
void map_page_strongly_ordered(void);
#endif
#ifdef CONFIG_CACHE_L2X0
extern void l2x0_cache_sync(void);
#define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0)
#endif
#if defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960)
extern void store_ttbr0(void);
#define finish_arch_switch(prev) do { store_ttbr0(); } while (0)
#endif
#define MAX_HOLE_ADDRESS (PHYS_OFFSET + 0x10000000)
extern phys_addr_t memory_hole_offset;
extern phys_addr_t memory_hole_start;
extern phys_addr_t memory_hole_end;
extern unsigned long memory_hole_align;
extern unsigned long virtual_hole_start;
extern unsigned long virtual_hole_end;
#ifdef CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0
void find_memory_hole(void);
#define MEM_HOLE_END_PHYS_OFFSET (memory_hole_end)
#define MEM_HOLE_PAGE_OFFSET (PAGE_OFFSET + memory_hole_offset + \
memory_hole_align)
#define __phys_to_virt(phys) \
(unsigned long)\
((MEM_HOLE_END_PHYS_OFFSET && ((phys) >= MEM_HOLE_END_PHYS_OFFSET)) ? \
(phys) - MEM_HOLE_END_PHYS_OFFSET + MEM_HOLE_PAGE_OFFSET : \
(phys) - PHYS_OFFSET + PAGE_OFFSET)
#define __virt_to_phys(virt) \
(unsigned long)\
((MEM_HOLE_END_PHYS_OFFSET && ((virt) >= MEM_HOLE_PAGE_OFFSET)) ? \
(virt) - MEM_HOLE_PAGE_OFFSET + MEM_HOLE_END_PHYS_OFFSET : \
(virt) - PAGE_OFFSET + PHYS_OFFSET)
#endif
/*
* Need a temporary unique variable that no one will ever see to
* hold the compat string. Line number gives this easily.
* Need another layer of indirection to get __LINE__ to expand
* properly as opposed to appending and ending up with
* __compat___LINE__
*/
#define __CONCAT(a, b) ___CONCAT(a, b)
#define ___CONCAT(a, b) a ## b
#define EXPORT_COMPAT(com) \
static char *__CONCAT(__compat_, __LINE__) __used \
__attribute((__section__(".exportcompat.init"))) = com
extern char *__compat_exports_start[];
extern char *__compat_exports_end[];
#endif
#if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_KRAIT
#define arch_has_speculative_dfetch() 1
#endif
#endif
/* these correspond to values known by the modem */
#define MEMORY_DEEP_POWERDOWN 0
#define MEMORY_SELF_REFRESH 1
#define MEMORY_ACTIVE 2
#define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd"
#ifndef CONFIG_ARCH_MSM7X27
#define CONSISTENT_DMA_SIZE (SZ_1M * 14)
#endif
|
/* $Header$ */
/*
$Log$
Revision 1.1 2003/02/11 18:36:09 hines
Initial revision
Revision 1.1.1.1 2003/01/01 17:46:34 hines
NEURON -- Version 5.4 2002/12/23 from prospero as of 1-1-2003
Revision 1.1.1.1 2002/06/26 16:23:07 hines
NEURON 5.3 2002/06/04
* Revision 1.1.1.1 2001/01/01 20:30:35 hines
* preparation for general sparse matrix
*
* Revision 1.1.1.1 2000/03/09 13:55:34 hines
* almost working
*
* Revision 1.2 1994/10/26 17:24:59 hines
* access name changed to an explicit hoc_access and taken out of redef.h
*
* Revision 1.1.1.1 1994/10/12 17:22:02 hines
* NEURON 3.0 distribution
*
* Revision 1.1 91/10/11 11:12:26 hines
* Initial revision
*
* Revision 3.28 89/09/29 16:02:46 mlh
* need to use -1 as falg for unsigned variable
*
* Revision 2.0 89/07/07 11:30:34 mlh
* Preparation for newcable
*
* Revision 1.1 89/07/07 11:15:45 mlh
* Initial revision
*
*/
extern int do_equation; /* switch for determining access to dep vars */
extern int *hoc_access; /* links to next accessed variables */
extern int var_access; /* variable number as pointer into access array */
extern int araypt();
extern int eqn_name(), eqn_init(), eqn_lhs(), eqn_rhs(), dep_make();
|
/*
* (c) Copyright 1992 by Panagiotis Tsirigotis
* (c) Sections Copyright 1998-2001 by Rob Braun
* All rights reserved. The file named COPYRIGHT specifies the terms
* and conditions for redistribution.
*/
#ifndef LOG_H
#define LOG_H
#include <sys/socket.h>
#include "defs.h"
#include "access.h"
/*
* $Id: log.h,v 1.2 2003/05/08 14:52:24 steveg Exp $
*/
/*
* Meaning of logtype flags:
*
* L_NONE: no logging
* L_FILE: log output goes to a file
* L_SYSLOG: log output goes to syslog(3)
* L_COMMON_FILE: log output goes to the file specified in defaults
*/
typedef enum { L_NONE = 0, L_FILE, L_SYSLOG, L_COMMON_FILE } logtype_e ;
struct filelog
{
char *fl_filename ; /* always malloc'ed */
unsigned fl_soft_limit ;
unsigned fl_hard_limit ;
} ;
#define FILELOG_SIZE_CONTROL( flp ) ( flp->fl_soft_limit != 0 )
struct syslog
{
int sl_facility ;
int sl_level ;
} ;
struct log
{
logtype_e l_type ;
struct filelog l_fl ;
struct syslog l_sl ;
} ;
#define LOG_GET_TYPE( lp ) (lp)->l_type
#define LOG_SET_TYPE( lp, type ) (lp)->l_type = (type)
#define LOG_GET_FILELOG( lp ) (&(lp)->l_fl)
#define LOG_GET_SYSLOG( lp ) (&(lp)->l_sl)
const char *xaddrname(const union xsockaddr *inaddr);
uint16_t xaddrport(const union xsockaddr *inaddr);
void svc_log_success(struct service *sp, const connection_s *cp,pid_t pid);
void svc_log_failure(struct service *sp, const connection_s *cp,access_e access_failure);
void svc_log_exit(struct service *sp,const struct server *serp);
void svc_logprint(struct service *sp,const char *line_id,const char *fmt,...)
#ifdef __GNUC__
__attribute__ ((format (printf, 3, 4)));
#else
;
#endif
#endif /* LOG_H */
|
/* netscreen.h
*
* $Id: netscreen.h 37572 2011-06-06 16:39:23Z gerald $
*
* Juniper NetScreen snoop output parser
* Created by re-using a lot of code from cosine.c
* Copyright (c) 2007 by Sake Blok <sake@euronet.nl>
*
* Wiretap Library
* Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
#ifndef __W_NETSCREEN_H__
#define __W_NETSCREEN_H__
#include <glib.h>
#include <wtap.h>
/* Magic text to check for NetScreen snoop output */
#define NETSCREEN_HDR_MAGIC_STR1 "(i) len="
#define NETSCREEN_HDR_MAGIC_STR2 "(o) len="
/* Magic text for start of packet */
#define NETSCREEN_REC_MAGIC_STR1 NETSCREEN_HDR_MAGIC_STR1
#define NETSCREEN_REC_MAGIC_STR2 NETSCREEN_HDR_MAGIC_STR2
#define NETSCREEN_LINE_LENGTH 128
#define NETSCREEN_HEADER_LINES_TO_CHECK 32
#define NETSCREEN_MAX_INFOLINES 8
#define NETSCREEN_SPACES_ON_INFO_LINE 14
#define NETSCREEN_MAX_INT_NAME_LENGTH 16
#define NETSCREEN_INGRESS FALSE
#define NETSCREEN_EGRESS TRUE
#define NETSCREEN_MAX_PACKET_LEN 65536
int netscreen_open(wtap *wth, int *err, gchar **err_info);
#endif
|
#pragma once
/*
* Copyright (c) 1992, 1993 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, 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 software; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <string>
#include "global.h"
inline bool using_curses = false;
inline bool user_wants_headless = false;
/* Cell size paramaters. */
inline unsigned int default_width = 8;
inline unsigned int default_height = 1;
/* clear_spreadsheet () uses these to restore default */
inline unsigned int saved_default_width = 8;
inline unsigned int saved_default_height = 1;
/* Other cell defaults: */
inline int default_jst = base_default_jst;
inline int default_fmt = FMT_GEN;
inline int default_prc = 0x0F; /* FIX ME */
inline int default_lock = LCK_UNL;
/* When printing ascii output, this controls page width. */
//inline int modified;
//inline int option_filter;
inline std::string option_tests_argument = "regular";
extern void set_options (char * ptr);
extern void show_options (void);
extern void read_mp_usr_fmt (char *ptr);
extern void write_mp_options (FILE *fp);
extern void read_mp_options (char *str);
extern void show_all_var (void);
extern void write_variables (FILE * fp);
extern void read_variables (FILE * fp);
extern void InitializeGlobals(void);
void choose_display(bool force_cmd_graphics);
bool get_option_tests();
|
#ifndef NORTHBRIDGE_AMD_GX2_H
#define NORTHBRIDGE_AMD_GX2_H
#if !defined(__ROMCC__) && !defined(ASSEMBLY)
#if defined(__PRE_RAM__)
#else
unsigned int gx2_scan_root_bus(device_t root, unsigned int max);
int sizeram(void);
void graphics_init(void);
void northbridgeinit(void);
#endif
#endif
#endif /* NORTHBRIDGE_AMD_GX2_H */
|
#include <hf-risc.h>
int moves = 0;
/* disk, source, dest, spare */
int hanoi(int n, int a, int b, int c){
if (n == 1){
printf("move disc %d from peg %d to peg %d\n", n, a, b);
}else{
hanoi(n-1, a, c, b);
printf("move disc %d from peg %d to peg %d\n", n, a, b);
hanoi(n-1, c, b, a);
}
moves++;
}
int main(){
hanoi(10, 1, 3, 2);
printf("done in %d moves.\n", moves);
}
|
//------------------------------------------------------------------------------
/* multimin/steepest_descent.c
*
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Fabrice Rossi
*
*/
/* steepest_descent.c -- the steepest descent algorithm */
/* Modified by Brian Gough to use single iteration structure */
//------------------------------------------------------------------------------
#include "config.h"
#include "gsl_multimin.h"
#include "gsl_blas_types.h"
#include "gsl_blas.h"
#include "XXX.h"
//------------------------------------------------------------------------------
typedef struct
{
double step;
double max_step;
double tol;
gsl_vector *x1;
gsl_vector *g1;
}
steepest_descent_state_t; // xxx_conjugate_state_t
//------------------------------------------------------------------------------
int
steepest_descent_alloc (void *vstate, size_t n)
{
steepest_descent_state_t *state = (steepest_descent_state_t *) vstate;
state->x1 = gsl_vector_alloc (n);
if (state->x1 == NULL) {
GSL_ERROR ("failed to allocate space for x1", GSL_ENOMEM);
}
state->g1 = gsl_vector_alloc (n);
if (state->g1 == NULL) {
GSL_ERROR ("failed to allocate space for g1", GSL_ENOMEM);
}
return GSL_SUCCESS;
}
//------------------------------------------------------------------------------
int
steepest_descent_set (void *vstate,
gsl_multimin_function_fdf *fdf,
const gsl_vector *x,
double *f,
gsl_vector *gradient,
double step_size, double tol)
{
steepest_descent_state_t *state = (steepest_descent_state_t *) vstate;
GSL_MULTIMIN_FN_EVAL_F_DF (fdf, x, f, gradient);
state->step = step_size;
state->max_step = step_size;
state->tol = tol;
return GSL_SUCCESS;
}
//------------------------------------------------------------------------------
void
steepest_descent_free (void *vstate)
{
steepest_descent_state_t *state = (steepest_descent_state_t *) vstate;
gsl_vector_free (state->x1);
gsl_vector_free (state->g1);
}
//------------------------------------------------------------------------------
int
steepest_descent_restart (void *vstate)
{
steepest_descent_state_t *state = (steepest_descent_state_t *) vstate;
state->step = state->max_step;
return GSL_SUCCESS;
}
//------------------------------------------------------------------------------
int
steepest_descent_iterate (void *vstate,
gsl_multimin_function_fdf *fdf,
gsl_vector *x, // ×ÈÏÄÎÁÑ ÔÏÞËÁ ÉÔeÒÁÃÉÉ (ÏÎÁ Öe ×ÙÈÏÄÎÁÑ)
double *f, // ÚÎÁÞeÎÉe ÆÕÎËÃÉÉ × ÔÏÞËe
gsl_vector *gradient, // ÇÒÁÄÉeÎÔ × ÔÏÞËe
gsl_vector *dx) // ×eËÔÏÒ-ÐÒÉÒÁÝeÎÉe (ÚÁÞeÍ ÏÎ ÔÕÔ?)
{
steepest_descent_state_t *state = (steepest_descent_state_t *) vstate;
gsl_vector *x1 = state->x1;
gsl_vector *g1 = state->g1;
double f0 = *f;
double f1;
double step = state->step, tol = state->tol;
int failed = 0;
/* compute new trial point at x1= x - step * dir, where dir is the
normalized gradient */
double gnorm = gsl_blas_dnrm2 (gradient);
if (gnorm == 0.0)
{
gsl_vector_set_zero (dx);
return GSL_ENOPROG;
}
// ÐÒÏÂÕeÍ ÓÄeÌÁÔØ ÛÁÇ, eÓÌÉ Îe ÐÏÌÕÞÁeÔÓÑ, ÔÏ ÕÍeÎØÛÁeÍ ÛÁÇ
while (1) {
take_step (x, gradient, step, 1.0 / gnorm, x1, dx); // dx = dx - step / gnorm * p
// x1 = x1 + 1.0 * dx
/* evaluate function and gradient at new point x1 */
GSL_MULTIMIN_FN_EVAL_F_DF (fdf, x1, &f1, g1);
if (f1 <= f0) break; // ×Óe ÈÏÒÏÛÏ, ÕÍeÎØÛÉÌÉ ÚÎÁÞeÎÉe, ×ÙÈÏÄÉÍ ÉÚ ÃÉËÌÁ
/* downhill step failed, reduce step-size and try again */
failed = 1;
step *= tol;
};
if (failed) step *= tol; // ÂÙÌÉ ÐÒÏÂÌeÍÙ -> EýE ÒÁÚ ÕÍeÎØÛÁeÍ ÛÁÇ ÄÌÑ ÓÌeÄ. ÉÔeÒÁÃÉÉ
else step *= 2.0; // ×Óe ÂÙÌÏ ÈÏÒÏÛÏ, ÐÏÐÒÏÂÕeÍ ÎÁ ÓÌeÄ. ÉÔeÒÁÃÉÉ ÂÏÌØÛÉÊ ÛÁÇ
state->step = step;
gsl_vector_memcpy (x, x1);
*f = f1;
gsl_vector_memcpy (gradient, g1);
return GSL_SUCCESS;
}
//------------------------------------------------------------------------------
static const gsl_multimin_fdfminimizer_type steepest_descent_type =
{ "steepest_descent", /* name */
sizeof (steepest_descent_state_t),
&steepest_descent_alloc,
&steepest_descent_set,
&steepest_descent_iterate,
&steepest_descent_restart,
&steepest_descent_free
};
const gsl_multimin_fdfminimizer_type
* gsl_multimin_fdfminimizer_steepest_descent = &steepest_descent_type;
//------------------------------------------------------------------------------
|
/****************************************************************
* *
* Copyright 2001, 2004 Sanchez Computer Associates, Inc. *
* *
* This source code contains the intellectual property *
* of its copyright holder(s), and is made available *
* under a license. If you do not know the terms of *
* the license, please stop and do not read further. *
* *
****************************************************************/
#include "mdef.h"
#include "io_params.h"
#include "io.h"
#include "iombdef.h"
GBLREF io_pair io_curr_device;
short iomb_rdone(mint *v,int4 t)
{
short status;
io_desc *io_ptr;
d_mb_struct *mb_ptr;
status = TRUE;
io_ptr = io_curr_device.in;
mb_ptr = (d_mb_struct *) io_ptr->dev_sp;
assert (io_ptr->state == dev_open);
if(mb_ptr->in_top == mb_ptr->in_pos)
status = iomb_dataread(t);
if (!status)
{
*v = -1;
return status;
}
*v = *mb_ptr->in_pos++;
io_ptr->dollar.x++;
return TRUE;
}
|
/*
Copyright (c) 2004-2007 Gordon Gremme <gremme@zbh.uni-hamburg.de>
Copyright (c) 2004-2007 Center for Bioinformatics, University of Hamburg
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "gth/gthxml.h"
void gth_xml_show_leader(bool intermediate, GtFile *outfp)
{
gt_file_xprintf(outfp,
"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n");
if (intermediate) {
gt_file_xprintf(outfp, "<SplicedAlignment xmlns="
"\"http://www.GenomeThreader.org/SplicedAlignment/\" "
"GTH_spliced_alignment_XML_version=\"%s\">\n",
GTH_SPLICED_ALIGNMENT_XML_VERSION);
}
else {
gt_file_xprintf(outfp, "<GTH_output xmlns="
"\"http://www.genomethreader.org/GTH_output/\" "
"GTH_XML_version=\"%s\">\n", GTH_XML_VERSION);
}
}
void gth_xml_show_trailer(bool intermediate, GtFile *outfp)
{
if (intermediate)
gt_file_xprintf(outfp, "</SplicedAlignment>\n");
else
gt_file_xprintf(outfp, "</GTH_output>\n");
}
|
/*
** rq_routing_ids.c
**
** Written by Brett Hutley - brett@hutley.net
**
** Copyright (C) 2002-2008 Brett Hutley
**
** This file is part of the Risk Quantify Library
**
** Risk Quantify is free software; you can redistribute it and/or
** modify it under the terms of the GNU Library General Public
** License as published by the Free Software Foundation; either
** version 2 of the License, or (at your option) any later version.
**
** Risk Quantify is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Library General Public License for more details.
**
** You should have received a copy of the GNU Library General Public
** License along with Risk Quantify; if not, write to the Free
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "rq_routing_ids.h"
#include <stdlib.h>
RQ_EXPORT void
rq_routing_ids_init(struct rq_routing_ids *p)
{
p->routing_id_list = rq_array_alloc(free);
}
RQ_EXPORT void
rq_routing_ids_clear(struct rq_routing_ids *p)
{
if (p->routing_id_list)
{
rq_array_free(p->routing_id_list);
p->routing_id_list = NULL;
}
}
RQ_EXPORT int
rq_routing_ids_write_xml(struct rq_routing_ids *p, rq_stream_t output_stream)
{
unsigned int i;
rq_stream_write_string(output_stream, "<routingIds>");
for (i = 0; i < rq_array_size(p->routing_id_list); i++)
{
const char *routing_id = (const char *)rq_array_get_at(p->routing_id_list, i);
rq_stream_write_string(output_stream, "<routingId>");
rq_stream_write_string(output_stream, routing_id);
rq_stream_write_string(output_stream, "</routingId>");
}
rq_stream_write_string(output_stream, "</routingIds>");
return 0;
}
RQ_EXPORT void
rq_routing_ids_free(struct rq_routing_ids *p)
{
rq_routing_ids_clear(p);
free(p);
}
|
//
// ToDoListTableViewController.h
// HelloWorld
//
// Created by user on 15/5/22.
// Copyright (c) 2015年 iotek. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface ToDoListTableViewController : UITableViewController
- (IBAction)unwindToList:(UIStoryboardSegue *)segue;
@end
|
/* $Id$ */
/* DO NOT EDIT - file generated by ObitTables.pl */
/*--------------------------------------------------------------------*/
/*; Copyright (C) 2014 */
/*; Associated Universities, Inc. Washington DC, USA. */
/*; */
/*; 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 Massachusetts Ave, Cambridge, */
/*; MA 02139, USA. */
/*; */
/*;Correspondence about this software should be addressed as follows: */
/*; Internet email: bcotton@nrao.edu. */
/*; Postal address: William Cotton */
/*; National Radio Astronomy Observatory */
/*; 520 Edgemont Road */
/*; Charlottesville, VA 22903-2475 USA */
/*--------------------------------------------------------------------*/
/* Define the basic components of the ObitTableCC structure */
/* This is intended to be included in a class structure definition */
/**
* \file ObitTableCCDef.h
* ObitTableCC structure members for derived classes.
*/
#include "ObitTableDef.h" /* Parent class definitions */
/** Number of parameters for non point components, usually 0 or 4+ */
oint noParms;
/** Column offset for Component flux density in table record */
olong FluxOff;
/** Physical column number for Component flux density in table record */
olong FluxCol;
/** Column offset for Component X position. in table record */
olong DeltaXOff;
/** Physical column number for Component X position. in table record */
olong DeltaXCol;
/** Column offset for Component Y position. in table record */
olong DeltaYOff;
/** Physical column number for Component Y position. in table record */
olong DeltaYCol;
/** Column offset for [OPTIONAL]Component Z position. in table record */
olong DeltaZOff;
/** Physical column number for [OPTIONAL]Component Z position. in table record */
olong DeltaZCol;
/** Column offset for [OPTIONAL] Component parameters; in table record */
olong parmsOff;
/** Physical column number for [OPTIONAL] Component parameters; in table record */
olong parmsCol;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.