code stringlengths 3 1.01M | repo_name stringlengths 5 116 | path stringlengths 3 311 | language stringclasses 30 values | license stringclasses 15 values | size int64 3 1.01M |
|---|---|---|---|---|---|
/* ============================================================
*
* This file is a part of kipi-plugins project
* http://www.digikam.org
*
* Date : 2004-10-01
* Description : a kipi plugin to batch process images
*
* Copyright (C) 2004-2009 by Gilles Caulier <caulier dot gilles at gmail dot 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, 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 EFFECTOPTIONSDIALOG_H
#define EFFECTOPTIONSDIALOG_H
// Qt includes
#include <QString>
// KDE includes
#include <kdialog.h>
class KIntNumInput;
namespace KIPIBatchProcessImagesPlugin
{
class EffectOptionsDialog : public KDialog
{
Q_OBJECT
public:
explicit EffectOptionsDialog(QWidget *parent = 0, int EffectType = 0);
~EffectOptionsDialog();
KIntNumInput *m_latWidth;
KIntNumInput *m_latHeight;
KIntNumInput *m_latOffset;
KIntNumInput *m_charcoalRadius;
KIntNumInput *m_charcoalDeviation;
KIntNumInput *m_edgeRadius;
KIntNumInput *m_embossRadius;
KIntNumInput *m_embossDeviation;
KIntNumInput *m_implodeFactor;
KIntNumInput *m_paintRadius;
KIntNumInput *m_shadeAzimuth;
KIntNumInput *m_shadeElevation;
KIntNumInput *m_solarizeFactor;
KIntNumInput *m_spreadRadius;
KIntNumInput *m_swirlDegrees;
KIntNumInput *m_waveAmplitude;
KIntNumInput *m_waveLength;
};
} // namespace KIPIBatchProcessImagesPlugin
#endif // EFFECTOPTIONSDIALOG_H
| centic9/digikam-ppa | extra/kipi-plugins/batchprocessimages/tools/effectoptionsdialog.h | C | gpl-2.0 | 1,965 |
package sp.phone.mvp.model.entity;
import android.os.Parcel;
import android.os.Parcelable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class BoardCategory implements Parcelable {
private List<Board> mBoardList;
private Map<Board.BoardKey, Board> mBoardMap;
private String mCategoryName;
private boolean mIsBookmarkCategory;
private List<BoardCategory> mSubCategoryList;
public BoardCategory(String name) {
mBoardList = new ArrayList<>();
mBoardMap = new HashMap<>();
mCategoryName = name;
}
public void addSubCategory(BoardCategory category) {
if (mSubCategoryList == null) {
mSubCategoryList = new ArrayList<>();
}
mSubCategoryList.add(category);
}
public List<BoardCategory> getSubCategoryList() {
return mSubCategoryList;
}
public BoardCategory getSubCategory(int index) {
return mSubCategoryList.get(index);
}
protected BoardCategory(Parcel in) {
mBoardList = in.createTypedArrayList(Board.CREATOR);
mCategoryName = in.readString();
mIsBookmarkCategory = in.readByte() != 0;
if (mBoardList == null) {
mBoardList = new ArrayList<>();
}
mBoardMap = new HashMap<>();
for (Board board : mBoardList) {
mBoardMap.put(board.getBoardKey(), board);
}
mSubCategoryList = in.createTypedArrayList(BoardCategory.CREATOR);
}
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeTypedList(mBoardList);
dest.writeString(mCategoryName);
dest.writeByte((byte) (mIsBookmarkCategory ? 1 : 0));
dest.writeTypedList(mSubCategoryList);
}
@Override
public int describeContents() {
return 0;
}
public static final Creator<BoardCategory> CREATOR = new Creator<BoardCategory>() {
@Override
public BoardCategory createFromParcel(Parcel in) {
return new BoardCategory(in);
}
@Override
public BoardCategory[] newArray(int size) {
return new BoardCategory[size];
}
};
public String getName() {
return mCategoryName;
}
public List<Board> getBoardList() {
return mBoardList;
}
public int size() {
return mBoardList.size();
}
public void addBoards(List<Board> data) {
mBoardList.addAll(data);
for (Board board : data) {
mBoardMap.put(board.getBoardKey(), board);
}
}
public void addBoard(Board board) {
mBoardList.add(board);
mBoardMap.put(board.getBoardKey(), board);
}
public void removeAllBoards() {
mBoardList.clear();
mBoardMap.clear();
}
public void removeBoard(Board board) {
mBoardList.remove(board);
mBoardMap.remove(board.getBoardKey());
}
public boolean removeBoard(Board.BoardKey boardKey) {
Board board = mBoardMap.remove(boardKey);
if (board != null) {
return mBoardList.remove(board);
} else {
return false;
}
}
public boolean isBookmarkCategory() {
return mIsBookmarkCategory;
}
public void setBookmarkCategory(boolean bookmarkCategory) {
mIsBookmarkCategory = bookmarkCategory;
}
public Board getBoard(int index) {
return mBoardList.get(index);
}
public Board getBoard(Board.BoardKey boardKey) {
if (mSubCategoryList == null) {
return mBoardMap.get(boardKey);
} else {
for (BoardCategory category : mSubCategoryList) {
Board board = category.getBoard(boardKey);
if (board != null) {
return board;
}
}
}
return null;
}
public boolean contains(Board board) {
return mBoardList.contains(board);
}
public boolean contains(Board.BoardKey boardKey) {
return mBoardMap.containsKey(boardKey);
}
}
| Justwen/NGA-CLIENT-VER-OPEN-SOURCE | nga_phone_base_3.0/src/main/java/sp/phone/mvp/model/entity/BoardCategory.java | Java | gpl-2.0 | 4,122 |
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2004 Chris Schoeneman
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "platform/OSXClipboardAnyTextConverter.h"
//! Convert to/from UTF-16 encoding
class OSXClipboardUTF16Converter : public OSXClipboardAnyTextConverter {
public:
OSXClipboardUTF16Converter();
virtual ~OSXClipboardUTF16Converter();
// IOSXClipboardAnyTextConverter overrides
virtual CFStringRef
getOSXFormat() const;
protected:
// OSXClipboardAnyTextConverter overrides
virtual String doFromIClipboard(const String&) const;
virtual String doToIClipboard(const String&) const;
};
| ommokazza/synergy | src/lib/platform/OSXClipboardUTF16Converter.h | C | gpl-2.0 | 1,248 |
/*
* Copyright 2010, Intel Corporation
*
* This file is part of PowerTOP
*
* This program file 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 in a file named COPYING; if not, write to the
* Free Software Foundation, Inc,
* 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
* or just google for it.
*
* Authors:
* Arjan van de Ven <arjan@linux.intel.com>
*/
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include "perf_event.h"
#include "perf.h"
#include "../lib.h"
#include "../display.h"
struct pevent *perf_event::pevent;
static int get_trace_type(const char *eventname)
{
string str;
int this_trace;
str = read_sysfs_string("/sys/kernel/debug/tracing/events/%s/id",
eventname);
if (str.length() < 1)
return -1;
this_trace = strtoull(str.c_str(), NULL, 10);
return this_trace;
}
static inline int sys_perf_event_open(struct perf_event_attr *attr,
pid_t pid, int cpu, int group_fd,
unsigned long flags)
{
attr->size = sizeof(*attr);
return syscall(__NR_perf_event_open, attr, pid, cpu,
group_fd, flags);
}
void perf_event::create_perf_event(char *eventname, int _cpu)
{
struct perf_event_attr attr;
int ret;
struct {
__u64 count;
__u64 time_enabled;
__u64 time_running;
__u64 id;
} read_data;
if (perf_fd != -1)
clear();
memset(&attr, 0, sizeof(attr));
attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
PERF_FORMAT_TOTAL_TIME_RUNNING |
PERF_FORMAT_ID;
attr.sample_freq = 0;
attr.sample_period = 1;
attr.sample_type |= PERF_SAMPLE_RAW | PERF_SAMPLE_CPU | PERF_SAMPLE_TIME;
attr.mmap = 1;
attr.comm = 1;
attr.inherit = 0;
attr.disabled = 1;
attr.type = PERF_TYPE_TRACEPOINT;
attr.config = trace_type;
if (attr.config <= 0)
return;
perf_fd = sys_perf_event_open(&attr, -1, _cpu, -1, 0);
if (perf_fd < 0) {
reset_display();
fprintf(stderr, _("PowerTOP %s needs the kernel to support the 'perf' subsystem\n"), POWERTOP_VERSION);
fprintf(stderr, _("as well as support for trace points in the kernel:\n"));
fprintf(stderr, "CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n");
exit(EXIT_FAILURE);
}
if (read(perf_fd, &read_data, sizeof(read_data)) == -1) {
reset_display();
perror("Unable to read perf file descriptor\n");
exit(-1);
}
fcntl(perf_fd, F_SETFL, O_NONBLOCK);
perf_mmap = mmap(NULL, (bufsize+1)*getpagesize(),
PROT_READ | PROT_WRITE, MAP_SHARED, perf_fd, 0);
if (perf_mmap == MAP_FAILED) {
fprintf(stderr, "failed to mmap with %d (%s)\n", errno, strerror(errno));
return;
}
ret = ioctl(perf_fd, PERF_EVENT_IOC_ENABLE, 0);
if (ret < 0) {
fprintf(stderr, "failed to enable perf \n");
}
pc = (perf_event_mmap_page *)perf_mmap;
data_mmap = (unsigned char *)perf_mmap + getpagesize();
}
void perf_event::set_event_name(const char *event_name)
{
if (name)
free(name);
name = strdup(event_name);
if (!name) {
fprintf(stderr, "failed to allocate event name\n");
return;
}
char *c;
c = strchr(name, ':');
if (c)
*c = '/';
trace_type = get_trace_type(name);
}
perf_event::~perf_event(void)
{
if (name)
free(name);
if (perf_event::pevent->ref_count == 1) {
pevent_free(perf_event::pevent);
perf_event::pevent = NULL;
} else
pevent_unref(perf_event::pevent);
}
void perf_event::set_cpu(int _cpu)
{
cpu = _cpu;
}
static void allocate_pevent(void)
{
if (!perf_event::pevent)
perf_event::pevent = pevent_alloc();
else
pevent_ref(perf_event::pevent);
}
perf_event::perf_event(const char *event_name, int _cpu, int buffer_size)
{
allocate_pevent();
name = NULL;
perf_fd = -1;
bufsize = buffer_size;
cpu = _cpu;
perf_mmap = NULL;
trace_type = 0;
set_event_name(event_name);
}
perf_event::perf_event(void)
{
allocate_pevent();
name = NULL;
perf_fd = -1;
bufsize = 128;
perf_mmap = NULL;
cpu = 0;
trace_type = 0;
}
void perf_event::start(void)
{
create_perf_event(name, cpu);
}
void perf_event::stop(void)
{
int ret;
ret = ioctl(perf_fd, PERF_EVENT_IOC_DISABLE, 0);
if (ret)
cout << "stop failing\n";
}
void perf_event::process(void *cookie)
{
struct perf_event_header *header;
if (perf_fd < 0)
return;
while (pc->data_tail != pc->data_head ) {
while (pc->data_tail >= (unsigned int)bufsize * getpagesize())
pc->data_tail -= bufsize * getpagesize();
header = (struct perf_event_header *)( (unsigned char *)data_mmap + pc->data_tail);
if (header->size == 0)
break;
pc->data_tail += header->size;
while (pc->data_tail >= (unsigned int)bufsize * getpagesize())
pc->data_tail -= bufsize * getpagesize();
if (header->type == PERF_RECORD_SAMPLE)
handle_event(header, cookie);
}
pc->data_tail = pc->data_head;
}
void perf_event::clear(void)
{
if (perf_mmap) {
// memset(perf_mmap, 0, (bufsize)*getpagesize());
munmap(perf_mmap, (bufsize+1)*getpagesize());
perf_mmap = NULL;
}
if (perf_fd != -1)
close(perf_fd);
perf_fd = -1;
}
| philippedeswert/powertop | src/perf/perf.cpp | C++ | gpl-2.0 | 5,651 |
/*
* This file is part of the MediaWiki extension MultimediaViewer.
*
* MultimediaViewer 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.
*
* MultimediaViewer 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 MultimediaViewer. If not, see <http://www.gnu.org/licenses/>.
*/
( function ( mw, $ ) {
QUnit.module( 'mmv.logging.PerformanceLogger', QUnit.newMwEnvironment() );
function createFakeXHR( response ) {
return {
readyState: 0,
open: $.noop,
send: function () {
var xhr = this;
setTimeout( function () {
xhr.readyState = 4;
xhr.response = response;
if ( $.isFunction( xhr.onreadystatechange ) ) {
xhr.onreadystatechange();
}
}, 0 );
}
};
}
QUnit.test( 'recordEntry: basic', 7, function ( assert ) {
var performance = new mw.mmv.logging.PerformanceLogger(),
fakeEventLog = { logEvent: this.sandbox.stub() },
type = 'gender',
total = 100;
this.sandbox.stub( performance, 'loadDependencies' ).returns( $.Deferred().resolve() );
this.sandbox.stub( performance, 'isInSample' );
performance.setEventLog( fakeEventLog );
performance.isInSample.returns( false );
performance.recordEntry( type, total );
assert.strictEqual( fakeEventLog.logEvent.callCount, 0, 'No stats should be logged if not in sample' );
performance.isInSample.returns( true );
performance.recordEntry( type, total );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 0 ], 'MultimediaViewerNetworkPerformance', 'EventLogging schema is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].type, type, 'type is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].total, total, 'total is correct' );
assert.strictEqual( fakeEventLog.logEvent.callCount, 1, 'Stats should be logged' );
performance.recordEntry( type, total, 'URL' );
assert.strictEqual( fakeEventLog.logEvent.callCount, 2, 'Stats should be logged' );
performance.recordEntry( type, total, 'URL' );
assert.strictEqual( fakeEventLog.logEvent.callCount, 2, 'Stats should not be logged a second time for the same URL' );
} );
QUnit.test( 'recordEntry: with Navigation Timing data', 29, function ( assert ) {
var fakeRequest,
varnish1 = 'cp1061',
varnish2 = 'cp3006',
varnish3 = 'cp3005',
varnish1hits = 0,
varnish2hits = 2,
varnish3hits = 1,
xvarnish = '1754811951 1283049064, 1511828531, 1511828573 1511828528',
xcache = varnish1 + ' miss (0), ' + varnish2 + ' miss (2), ' + varnish3 + ' frontend hit (1), malformed(5)',
age = '12345',
contentLength = '23456',
urlHost = 'fail',
date = 'Tue, 04 Feb 2014 11:11:50 GMT',
timestamp = 1391512310,
url = 'https://' + urlHost + '/balls.jpg',
redirect = 500,
dns = 2,
tcp = 10,
request = 25,
response = 50,
cache = 1,
perfData = {
initiatorType: 'xmlhttprequest',
name: url,
duration: 12345,
redirectStart: 1000,
redirectEnd: 1500,
domainLookupStart: 2,
domainLookupEnd: 4,
connectStart: 50,
connectEnd: 60,
requestStart: 125,
responseStart: 150,
responseEnd: 200,
fetchStart: 1
},
country = 'FR',
type = 'image',
performance = new mw.mmv.logging.PerformanceLogger(),
status = 200,
metered = true,
bandwidth = 45.67,
fakeEventLog = { logEvent: this.sandbox.stub() };
this.sandbox.stub( performance, 'loadDependencies' ).returns( $.Deferred().resolve() );
performance.setEventLog( fakeEventLog );
performance.schemaSupportsCountry = this.sandbox.stub().returns( true );
this.sandbox.stub( performance, 'getWindowPerformance' ).returns( {
getEntriesByName: function () {
return [perfData, {
initiatorType: 'bogus',
duration: 1234,
name: url
}];
}
} );
this.sandbox.stub( performance, 'getNavigatorConnection' ).returns( { metered: metered, bandwidth: bandwidth } );
this.sandbox.stub( performance, 'isInSample' ).returns( true );
fakeRequest = {
getResponseHeader: function ( header ) {
switch ( header ) {
case 'X-Cache':
return xcache;
case 'X-Varnish':
return xvarnish;
case 'Age':
return age;
case 'Content-Length':
return contentLength;
case 'Date':
return date;
}
},
status: status
};
performance.setGeo( { country: country } );
performance.recordEntry( type, 100, url, fakeRequest );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 0 ], 'MultimediaViewerNetworkPerformance', 'EventLogging schema is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].type, type, 'type is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish1, varnish1, 'varnish1 is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish2, varnish2, 'varnish2 is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish3, varnish3, 'varnish3 is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish4, undefined, 'varnish4 is undefined' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish1hits, varnish1hits, 'varnish1hits is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish2hits, varnish2hits, 'varnish2hits is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish3hits, varnish3hits, 'varnish3hits is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].varnish4hits, undefined, 'varnish4hits is undefined' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].XVarnish, xvarnish, 'XVarnish is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].XCache, xcache, 'XCache is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].age, parseInt( age, 10 ), 'age is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].contentLength, parseInt( contentLength, 10 ), 'contentLength is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].contentHost, window.location.host, 'contentHost is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].urlHost, urlHost, 'urlHost is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].timestamp, timestamp, 'timestamp is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].total, perfData.duration, 'total is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].redirect, redirect, 'redirect is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].dns, dns, 'dns is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].tcp, tcp, 'tcp is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].request, request, 'request is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].response, response, 'response is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].cache, cache, 'cache is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].country, country, 'country is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].isHttps, true, 'isHttps is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].status, status, 'status is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].metered, metered, 'metered is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].bandwidth, Math.round( bandwidth ), 'bandwidth is correct' );
} );
QUnit.test( 'recordEntry: with async extra stats', 11, function ( assert ) {
var performance = new mw.mmv.logging.PerformanceLogger(),
fakeEventLog = { logEvent: this.sandbox.stub() },
type = 'gender',
total = 100,
overriddenType = 'image',
foo = 'bar',
extraStatsPromise = $.Deferred();
this.sandbox.stub( performance, 'loadDependencies' ).returns( $.Deferred().resolve() );
this.sandbox.stub( performance, 'isInSample' );
performance.setEventLog( fakeEventLog );
performance.isInSample.returns( true );
performance.recordEntry( type, total, 'URL1', undefined, extraStatsPromise );
assert.strictEqual( fakeEventLog.logEvent.callCount, 0, 'Stats should not be logged if the promise hasn\'t completed yet' );
extraStatsPromise.reject();
assert.strictEqual( fakeEventLog.logEvent.callCount, 1, 'Stats should be logged' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 0 ], 'MultimediaViewerNetworkPerformance', 'EventLogging schema is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].type, type, 'type is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 0 ).args[ 1 ].total, total, 'total is correct' );
extraStatsPromise = $.Deferred();
performance.recordEntry( type, total, 'URL2', undefined, extraStatsPromise );
assert.strictEqual( fakeEventLog.logEvent.callCount, 1, 'Stats should not be logged if the promise hasn\'t been resolved yet' );
extraStatsPromise.resolve( { type: overriddenType, foo: foo } );
assert.strictEqual( fakeEventLog.logEvent.callCount, 2, 'Stats should be logged' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 1 ).args[ 0 ], 'MultimediaViewerNetworkPerformance', 'EventLogging schema is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 1 ).args[ 1 ].type, overriddenType, 'type is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 1 ).args[ 1 ].total, total, 'total is correct' );
assert.strictEqual( fakeEventLog.logEvent.getCall( 1 ).args[ 1 ].foo, foo, 'extra stat is correct' );
} );
QUnit.test( 'parseVarnishXCacheHeader', 15, function ( assert ) {
var varnish1 = 'cp1061',
varnish2 = 'cp3006',
varnish3 = 'cp3005',
testString = varnish1 + ' miss (0), ' + varnish2 + ' miss (0), ' + varnish3 + ' frontend hit (1)',
performance = new mw.mmv.logging.PerformanceLogger(),
varnishXCache = performance.parseVarnishXCacheHeader( testString );
assert.strictEqual( varnishXCache.varnish1, varnish1, 'First varnish server name extracted' );
assert.strictEqual( varnishXCache.varnish2, varnish2, 'Second varnish server name extracted' );
assert.strictEqual( varnishXCache.varnish3, varnish3, 'Third varnish server name extracted' );
assert.strictEqual( varnishXCache.varnish4, undefined, 'Fourth varnish server is undefined' );
assert.strictEqual( varnishXCache.varnish1hits, 0, 'First varnish hit count extracted' );
assert.strictEqual( varnishXCache.varnish2hits, 0, 'Second varnish hit count extracted' );
assert.strictEqual( varnishXCache.varnish3hits, 1, 'Third varnish hit count extracted' );
assert.strictEqual( varnishXCache.varnish4hits, undefined, 'Fourth varnish hit count is undefined' );
testString = varnish1 + ' miss (36), ' + varnish2 + ' miss (2)';
varnishXCache = performance.parseVarnishXCacheHeader( testString );
assert.strictEqual( varnishXCache.varnish1, varnish1, 'First varnish server name extracted' );
assert.strictEqual( varnishXCache.varnish2, varnish2, 'Second varnish server name extracted' );
assert.strictEqual( varnishXCache.varnish3, undefined, 'Third varnish server is undefined' );
assert.strictEqual( varnishXCache.varnish1hits, 36, 'First varnish hit count extracted' );
assert.strictEqual( varnishXCache.varnish2hits, 2, 'Second varnish hit count extracted' );
assert.strictEqual( varnishXCache.varnish3hits, undefined, 'Third varnish hit count is undefined' );
varnishXCache = performance.parseVarnishXCacheHeader( 'garbage' );
assert.ok( $.isEmptyObject( varnishXCache ), 'Varnish cache results are empty' );
} );
QUnit.test( 'record()', 4, function ( assert ) {
var type = 'foo',
url = 'http://example.com/',
response = {},
performance = new mw.mmv.logging.PerformanceLogger();
performance.newXHR = function () { return createFakeXHR( response ); };
QUnit.stop();
performance.recordEntryDelayed = function ( recordType, _, recordUrl, recordRequest ) {
assert.strictEqual( recordType, type, 'type is recorded correctly' );
assert.strictEqual( recordUrl, url, 'url is recorded correctly' );
assert.strictEqual( recordRequest.response, response, 'response is recorded correctly' );
QUnit.start();
};
QUnit.stop();
performance.record( type, url ).done( function ( recordResponse ) {
assert.strictEqual( recordResponse, response, 'response is passed to callback' );
QUnit.start();
} );
} );
QUnit.asyncTest( 'record() with old browser', 1, function ( assert ) {
var type = 'foo',
url = 'http://example.com/',
performance = new mw.mmv.logging.PerformanceLogger();
performance.newXHR = function () { throw 'XMLHttpRequest? What\'s that?'; };
performance.record( type, url ).fail( function () {
assert.ok( true, 'the promise is rejected when XMLHttpRequest is not supported' );
QUnit.start();
} );
} );
QUnit.test( 'mw.mmv.logging.Api', 3, function ( assert ) {
var api,
oldRecord = mw.mmv.logging.PerformanceLogger.prototype.recordJQueryEntryDelayed,
oldAjax = mw.Api.prototype.ajax,
ajaxCalled = false,
fakeJqxhr = {};
mw.Api.prototype.ajax = function () {
ajaxCalled = true;
return $.Deferred().resolve( {}, fakeJqxhr );
};
mw.mmv.logging.PerformanceLogger.prototype.recordJQueryEntryDelayed = function ( type, total, jqxhr ) {
assert.strictEqual( type, 'foo', 'type was passed correctly' );
assert.strictEqual( jqxhr, fakeJqxhr, 'jqXHR was passed correctly' );
};
api = new mw.mmv.logging.Api( 'foo' );
api.ajax();
assert.ok( ajaxCalled, 'parent ajax() function was called' );
mw.mmv.logging.PerformanceLogger.prototype.recordJQueryEntryDelayed = oldRecord;
mw.Api.prototype.ajax = oldAjax;
} );
}( mediaWiki, jQuery ) );
| tuxun/smw-funwiki | extensions/MultimediaViewer/tests/qunit/mmv/logging/mmv.logging.PerformanceLogger.test.js | JavaScript | gpl-2.0 | 14,429 |
<?php
/**
* Qlue Sitemap
*
* @author Jon Boutell
* @package QMap
* @license GNU/GPL
* @version 1.0
*
* This component gathers information from various Joomla Components and
* compiles them into a sitemap, supporting both an HTML view and an XML
* format for search engines.
*
*/
defined('_JEXEC') or die('Restricted Access');
JLoader::import('joomla.base.object');
class SitemapHelper {
public static function getActions() {
$user = JFactory::getUser();
$result = new JObject();
$actions = array('core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete');
foreach ($actions as $action) {
$result->set($action, $user->authorise($action, 'com_sitemap'));
}
return $result;
}
}
?> | shamusdougan/MMA_Webpage | administrator/components/com_sitemap/helpers/helper.php | PHP | gpl-2.0 | 738 |
<?php
// load wordpress
require_once('get_wp.php');
class col_shortcodes
{
var $conf;
var $popup;
var $params;
var $shortcode;
var $cparams;
var $cshortcode;
var $popup_title;
var $no_preview;
var $has_child;
var $output;
var $errors;
// --------------------------------------------------------------------------
function __construct( $popup )
{
if( file_exists( dirname(__FILE__) . '/config.php' ) )
{
$this->conf = dirname(__FILE__) . '/config.php';
$this->popup = $popup;
$this->formate_shortcode();
}
else
{
$this->append_error('Config file does not exist');
}
}
// --------------------------------------------------------------------------
function formate_shortcode()
{
// get config file
require_once( $this->conf );
if( isset( $col_shortcodes[$this->popup]['child_shortcode'] ) )
$this->has_child = true;
if( isset( $col_shortcodes ) && is_array( $col_shortcodes ) )
{
// get shortcode config stuff
$this->params = $col_shortcodes[$this->popup]['params'];
$this->shortcode = $col_shortcodes[$this->popup]['shortcode'];
$this->popup_title = $col_shortcodes[$this->popup]['popup_title'];
// adds stuff for js use
$this->append_output( "\n" . '<div id="_col_shortcode" class="hidden">' . $this->shortcode . '</div>' );
$this->append_output( "\n" . '<div id="_col_popup" class="hidden">' . $this->popup . '</div>' );
if( isset( $col_shortcodes[$this->popup]['no_preview'] ) && $col_shortcodes[$this->popup]['no_preview'] )
{
$this->append_output( "\n" . '<div id="_col_preview" class="hidden">false</div>' );
$this->no_preview = true;
}
// filters and excutes params
foreach( $this->params as $pkey => $param )
{
// prefix the fields names and ids with col_
$pkey = 'col_' . $pkey;
// popup form row start
$row_start = '<tbody>' . "\n";
$row_start .= '<tr class="form-row">' . "\n";
$row_start .= '<td class="label">' . $param['label'] . '</td>' . "\n";
$row_start .= '<td class="field">' . "\n";
// popup form row end
$row_end = '<span class="col-form-desc">' . $param['desc'] . '</span>' . "\n";
$row_end .= '</td>' . "\n";
$row_end .= '</tr>' . "\n";
$row_end .= '</tbody>' . "\n";
switch( $param['type'] )
{
case 'text' :
// prepare
$output = $row_start;
$output .= '<input type="text" class="col-form-text col-input" name="' . $pkey . '" id="' . $pkey . '" value="' . $param['std'] . '" />' . "\n";
$output .= $row_end;
// append
$this->append_output( $output );
break;
case 'textarea' :
// prepare
$output = $row_start;
$output .= '<textarea rows="10" cols="30" name="' . $pkey . '" id="' . $pkey . '" class="col-form-textarea col-input">' . $param['std'] . '</textarea>' . "\n";
$output .= $row_end;
// append
$this->append_output( $output );
break;
case 'select' :
// prepare
$output = $row_start;
$output .= '<select name="' . $pkey . '" id="' . $pkey . '" class="col-form-select col-input">' . "\n";
foreach( $param['options'] as $value => $option )
{
$output .= '<option value="' . $value . '">' . $option . '</option>' . "\n";
}
$output .= '</select>' . "\n";
$output .= $row_end;
// append
$this->append_output( $output );
break;
case 'checkbox' :
// prepare
$output = $row_start;
$output .= '<label for="' . $pkey . '" class="col-form-checkbox">' . "\n";
$output .= '<input type="checkbox" class="col-input" name="' . $pkey . '" id="' . $pkey . '" ' . ( $param['std'] ? 'checked' : '' ) . ' />' . "\n";
$output .= ' ' . $param['checkbox_text'] . '</label>' . "\n";
$output .= $row_end;
// append
$this->append_output( $output );
break;
}
}
// checks if has a child shortcode
if( isset( $col_shortcodes[$this->popup]['child_shortcode'] ) )
{
// set child shortcode
$this->cparams = $col_shortcodes[$this->popup]['child_shortcode']['params'];
$this->cshortcode = $col_shortcodes[$this->popup]['child_shortcode']['shortcode'];
// popup parent form row start
$prow_start = '<tbody>' . "\n";
$prow_start .= '<tr class="form-row has-child">' . "\n";
$prow_start .= '<td><a href="#" id="form-child-add" class="button-secondary">' . $col_shortcodes[$this->popup]['child_shortcode']['clone_button'] . '</a>' . "\n";
$prow_start .= '<div class="child-clone-rows">' . "\n";
// for js use
$prow_start .= '<div id="_col_cshortcode" class="hidden">' . $this->cshortcode . '</div>' . "\n";
$ko = rand(1,900);
// start the default row
$prow_start .= '<div class="child-clone-row"><a href="#" class="child-clone-row-remove">×</a>' . "\n";
$prow_start .= '<ul class="child-clone-row-form">' . "\n";
// add $prow_start to output
$this->append_output( $prow_start );
foreach( $this->cparams as $cpkey => $cparam )
{
// prefix the fields names and ids with col_
$cpkey = 'col_' . $cpkey;
// popup form row start
$crow_start = '<li class="child-clone-row-form-row">' . "\n";
$crow_start .= '<div class="child-clone-row-label">' . "\n";
$crow_start .= '<label>' . $cparam['label'] . '</label>' . "\n";
$crow_start .= '</div>' . "\n";
$crow_start .= '<div class="child-clone-row-field">' . "\n";
// popup form row end
$crow_end = '<span class="child-clone-row-desc">' . $cparam['desc'] . '</span>' . "\n";
$crow_end .= '</div>' . "\n";
$crow_end .= '</li>' . "\n";
switch( $cparam['type'] )
{
case 'text' :
// prepare
$coutput = $crow_start;
$coutput .= '<input type="text" class="col-form-text col-cinput" name="' . $cpkey . '" id="' . $cpkey . '" value="' . $cparam['std'] . '" />' . "\n";
$coutput .= $crow_end;
// append
$this->append_output( $coutput );
break;
case 'textarea' :
// prepare
$coutput = $crow_start;
$coutput .= '<textarea rows="10" cols="30" name="' . $cpkey . '" id="' . $cpkey . '" class="col-form-textarea col-cinput">' . $cparam['std'] . '</textarea>' . "\n";
$coutput .= $crow_end;
// append
$this->append_output( $coutput );
break;
case 'select' :
// prepare
$coutput = $crow_start;
$coutput .= '<select name="' . $cpkey . '" id="' . $cpkey . '" class="col-form-select col-cinput" style="min-width:200px">' . "\n";
foreach( $cparam['options'] as $value => $option )
{
$coutput .= '<option value="' . $value . '">' . $option . '</option>' . "\n";
}
$coutput .= '</select>' . "\n";
$coutput .= $crow_end;
// append
$this->append_output( $coutput );
break;
case 'checkbox' :
// prepare
$coutput = $crow_start;
$coutput .= '<label for="' . $cpkey . '" class="col-form-checkbox">' . "\n";
$coutput .= '<input type="checkbox" class="col-cinput" name="' . $cpkey . '" id="' . $cpkey . '" ' . ( $cparam['std'] ? 'checked' : '' ) . ' />' . "\n";
$coutput .= ' ' . $cparam['checkbox_text'] . '</label>' . "\n";
$coutput .= $crow_end;
// append
$this->append_output( $coutput );
break;
}
}
// popup parent form row end
$prow_end = '</ul>' . "\n"; // end .child-clone-row-form
$prow_end .= '</div>' . "\n"; // end .child-clone-row
$prow_end .= '</div>' . "\n"; // end .child-clone-rows
$prow_end .= '</td>' . "\n";
$prow_end .= '</tr>' . "\n";
$prow_end .= '</tbody>' . "\n";
// add $prow_end to output
$this->append_output( $prow_end );
}
}
}
// --------------------------------------------------------------------------
function append_output( $output )
{
$this->output = $this->output . "\n" . $output;
}
// --------------------------------------------------------------------------
function reset_output( $output )
{
$this->output = '';
}
// --------------------------------------------------------------------------
function append_error( $error )
{
$this->errors = $this->errors . "\n" . $error;
}
}
?> | geginho/studio_mova | wp-content/themes/reframe_1/framework/tinymce/shortcodes.class.php | PHP | gpl-2.0 | 8,647 |
<?php
/**
* WPBakery Visual Composer helpers functions
*
* @package WPBakeryVisualComposer
*
*/
if ( ! defined( 'WPB_VC_VERSION' ) ) die( '-1' ); // Check if this file is loaded in js_composer
function wpb_getImageBySize( $params = array( 'post_id' => NULL, 'attach_id' => NULL, 'thumb_size' => 'thumbnail', 'class' => '' ) ) {
//array( 'post_id' => $post_id, 'thumb_size' => $grid_thumb_size )
if ( ( ! isset( $params['attach_id'] ) || $params['attach_id'] == NULL ) && ( ! isset( $params['post_id'] ) || $params['post_id'] == NULL ) ) return;
$post_id = isset( $params['post_id'] ) ? $params['post_id'] : 0;
if ( $post_id ) $attach_id = get_post_thumbnail_id( $post_id );
else $attach_id = $params['attach_id'];
$thumb_size = $params['thumb_size'];
$thumb_class = ( isset( $params['class'] ) && $params['class'] != '' ) ? $params['class'] . ' ' : '';
global $_wp_additional_image_sizes;
$thumbnail = '';
if ( is_string( $thumb_size ) && ( ( ! empty( $_wp_additional_image_sizes[$thumb_size] ) && is_array( $_wp_additional_image_sizes[$thumb_size] ) ) || in_array( $thumb_size, array( 'thumbnail', 'thumb', 'medium', 'large', 'full' ) ) ) ) {
//$thumbnail = get_the_post_thumbnail( $post_id, $thumb_size );
$thumbnail = wp_get_attachment_image( $attach_id, $thumb_size, false, array( 'class' => $thumb_class . 'attachment-' . $thumb_size ) );
// TODO: APPLY FILTER
} elseif ( $attach_id ) {
if ( is_string( $thumb_size ) ) {
preg_match_all( '/\d+/', $thumb_size, $thumb_matches );
if ( isset( $thumb_matches[0] ) ) {
$thumb_size = array();
if ( count( $thumb_matches[0] ) > 1 ) {
$thumb_size[] = $thumb_matches[0][0]; // width
$thumb_size[] = $thumb_matches[0][1]; // height
} elseif ( count( $thumb_matches[0] ) > 0 && count( $thumb_matches[0] ) < 2 ) {
$thumb_size[] = $thumb_matches[0][0]; // width
$thumb_size[] = $thumb_matches[0][0]; // height
} else {
$thumb_size = false;
}
}
}
if ( is_array( $thumb_size ) ) {
// Resize image to custom size
$p_img = wpb_resize( $attach_id, null, $thumb_size[0], $thumb_size[1], true );
$alt = trim( strip_tags( get_post_meta( $attach_id, '_wp_attachment_image_alt', true ) ) );
if ( empty( $alt ) ) {
$attachment = get_post( $attach_id );
$alt = trim( strip_tags( $attachment->post_excerpt ) ); // If not, Use the Caption
}
if ( empty( $alt ) )
$alt = trim( strip_tags( $attachment->post_title ) ); // Finally, use the title
if ( $p_img ) {
$img_class = '';
//if ( $grid_layout == 'thumbnail' ) $img_class = ' no_bottom_margin'; class="'.$img_class.'"
$thumbnail = '<img class="' . $thumb_class . '" src="' . $p_img['url'] . '" width="' . $p_img['width'] . '" height="' . $p_img['height'] . '" alt="' . $alt . '" />';
//TODO: APPLY FILTER
}
}
}
$p_img_large = wp_get_attachment_image_src( $attach_id, 'large' );
return array( 'thumbnail' => $thumbnail, 'p_img_large' => $p_img_large );
}
function wpb_getColumnControls( $width ) {
switch ( $width ) {
case "vc_col-md-2" :
$w = "1/6";
break;
case "vc_col-sm-3" :
$w = "1/4";
break;
case "vc_col-sm-4" :
$w = "1/3";
break;
case "vc_col-sm-6" :
$w = "1/2";
break;
case "vc_col-sm-8" :
$w = "2/3";
break;
case "vc_col-sm-9" :
$w = "3/4";
break;
case "vc_col-sm-12" :
$w = "1/1";
break;
default :
$w = $width;
}
return $w;
}
/* Convert vc_col-sm-3 to 1/4
---------------------------------------------------------- */
function wpb_translateColumnWidthToFractional( $width ) {
switch ( $width ) {
case "vc_col-sm-2" :
$w = "1/6";
break;
case "vc_col-sm-3" :
$w = "1/4";
break;
case "vc_col-sm-4" :
$w = "1/3";
break;
case "vc_col-sm-6" :
$w = "1/2";
break;
case "vc_col-sm-8" :
$w = "2/3";
break;
case "vc_col-sm-9" :
$w = "3/4";
break;
case "vc_col-sm-12" :
$w = "1/1";
break;
default :
$w = $width;
}
return $w;
}
/* Convert 2 to
---------------------------------------------------------- */
function wpb_translateColumnsCountToSpanClass( $grid_columns_count ) {
$teaser_width = '';
switch ( $grid_columns_count ) {
case '1' :
$teaser_width = 'vc_col-sm-12';
break;
case '2' :
$teaser_width = 'vc_col-sm-6';
break;
case '3' :
$teaser_width = 'vc_col-sm-4';
break;
case '4' :
$teaser_width = 'vc_col-sm-3';
break;
case '5':
$teaser_width = 'vc_col-sm-10';
break;
case '6' :
$teaser_width = 'vc_col-sm-2';
break;
}
//return $teaser_width;
$custom = get_custom_column_class( $teaser_width );
return $custom ? $custom : $teaser_width;
}
function wpb_translateColumnWidthToSpan( $width, $front = true ) {
if ( preg_match( '/^(\d{1,2})\/12$/', $width, $match ) ) {
$w = 'vc_col-sm-'.$match[1];
} else {
$w = 'vc_col-sm-';
switch ( $width ) {
case "1/6" :
$w .= '2';
break;
case "1/4" :
$w .= '3';
break;
case "1/3" :
$w .= '4';
break;
case "1/2" :
$w .= '6';
break;
case "2/3" :
$w .= '8';
break;
case "3/4" :
$w .= '9';
break;
case "5/6" :
$w .= '10';
break;
case "1/1" :
$w .= '12';
break;
default :
$w = $width;
}
}
$custom = $front ? get_custom_column_class( $w ) : false;
return $custom ? $custom : $w;
}
/*
function wpb_js_remove_wpautop( $content, $autop = false ) {
if ( $autop ) { // Possible to use !preg_match('('.WPBMap::getTagsRegexp().')', $content)
$content = wpautop( preg_replace( '/<\/?p\>/', "\n", $content ) . "\n" );
}
return do_shortcode( shortcode_unautop( $content) );
}
*/
function wpb_js_remove_wpautop( $content, $autop = false ) {
$content = do_shortcode( shortcode_unautop($content) );
$content = preg_replace( '#^<\/p>|^<br \/>|<p>$#', '', $content );
return $content;
}
if ( ! function_exists( 'shortcode_exists' ) ) {
/**
* Check if a shortcode is registered in WordPress.
*
* Examples: shortcode_exists( 'caption' ) - will return true.
* shortcode_exists( 'blah' ) - will return false.
*/
function shortcode_exists( $shortcode = false ) {
global $shortcode_tags;
if ( ! $shortcode )
return false;
if ( array_key_exists( $shortcode, $shortcode_tags ) )
return true;
return false;
}
}
/* Helper function which returs list of site attached images,
and if image is attached to the current post it adds class
'added'
---------------------------------------------------------- */
if ( ! function_exists( 'siteAttachedImages' ) ) {
function siteAttachedImages( $att_ids = array() ) {
$output = '';
global $wpdb;
$media_images = $wpdb->get_results( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' order by ID desc" );
foreach ( $media_images as $image_post ) {
$thumb_src = wp_get_attachment_image_src( $image_post->ID, 'thumbnail' );
$thumb_src = $thumb_src[0];
$class = ( in_array( $image_post->ID, $att_ids ) ) ? ' class="added"' : '';
$output .= '<li' . $class . '>
<img rel="' . $image_post->ID . '" src="' . $thumb_src . '" />
<span class="img-added">' . __( 'Added', LANGUAGE_ZONE ) . '</span>
</li>';
}
if ( $output != '' ) {
$output = '<ul class="gallery_widget_img_select">' . $output . '</ul>';
}
return $output;
} // end siteAttachedImages()
}
function fieldAttachedImages( $att_ids = array() ) {
$output = '';
foreach ( $att_ids as $th_id ) {
$thumb_src = wp_get_attachment_image_src( $th_id, 'thumbnail' );
if ( $thumb_src ) {
$thumb_src = $thumb_src[0];
$output .= '
<li class="added">
<img rel="' . $th_id . '" src="' . $thumb_src . '" />
<a href="#" class="icon-remove"></a>
</li>';
}
}
if ( $output != '' ) {
return $output;
}
}
function wpb_removeNotExistingImgIDs( $param_value ) {
$tmp = explode( ",", $param_value );
$return_ar = array();
foreach ( $tmp as $id ) {
if ( wp_get_attachment_image( $id ) ) {
$return_ar[] = $id;
}
}
$tmp = implode( ",", $return_ar );
return $tmp;
}
/*
* Resize images dynamically using wp built in functions
* Victor Teixeira
*
* php 5.2+
*
* Exemplo de uso:
*
* <?php
* $thumb = get_post_thumbnail_id();
* $image = vt_resize( $thumb, '', 140, 110, true );
* ?>
* <img src="<?php echo $image[url]; ?>" width="<?php echo $image[width]; ?>" height="<?php echo $image[height]; ?>" />
*
* @param int $attach_id
* @param string $img_url
* @param int $width
* @param int $height
* @param bool $crop
* @return array
*/
if ( ! function_exists( 'wpb_resize' ) ) {
function wpb_resize( $attach_id = null, $img_url = null, $width, $height, $crop = false ) {
// this is an attachment, so we have the ID
if ( $attach_id ) {
$image_src = wp_get_attachment_image_src( $attach_id, 'full' );
$actual_file_path = get_attached_file( $attach_id );
// this is not an attachment, let's use the image url
} else if ( $img_url ) {
$file_path = parse_url( $img_url );
$actual_file_path = $_SERVER['DOCUMENT_ROOT'] . $file_path['path'];
$actual_file_path = ltrim( $file_path['path'], '/' );
$actual_file_path = rtrim( ABSPATH, '/' ) . $file_path['path'];
$orig_size = getimagesize( $actual_file_path );
$image_src[0] = $img_url;
$image_src[1] = $orig_size[0];
$image_src[2] = $orig_size[1];
}
$file_info = pathinfo( $actual_file_path );
$extension = '.' . $file_info['extension'];
// the image path without the extension
$no_ext_path = $file_info['dirname'] . '/' . $file_info['filename'];
$cropped_img_path = $no_ext_path . '-' . $width . 'x' . $height . $extension;
// checking if the file size is larger than the target size
// if it is smaller or the same size, stop right here and return
if ( $image_src[1] > $width || $image_src[2] > $height ) {
// the file is larger, check if the resized version already exists (for $crop = true but will also work for $crop = false if the sizes match)
if ( file_exists( $cropped_img_path ) ) {
$cropped_img_url = str_replace( basename( $image_src[0] ), basename( $cropped_img_path ), $image_src[0] );
$vt_image = array(
'url' => $cropped_img_url,
'width' => $width,
'height' => $height
);
return $vt_image;
}
// $crop = false
if ( $crop == false ) {
// calculate the size proportionaly
$proportional_size = wp_constrain_dimensions( $image_src[1], $image_src[2], $width, $height );
$resized_img_path = $no_ext_path . '-' . $proportional_size[0] . 'x' . $proportional_size[1] . $extension;
// checking if the file already exists
if ( file_exists( $resized_img_path ) ) {
$resized_img_url = str_replace( basename( $image_src[0] ), basename( $resized_img_path ), $image_src[0] );
$vt_image = array(
'url' => $resized_img_url,
'width' => $proportional_size[0],
'height' => $proportional_size[1]
);
return $vt_image;
}
}
// no cache files - let's finally resize it
$img_editor = wp_get_image_editor( $actual_file_path );
if ( is_wp_error( $img_editor ) || is_wp_error( $img_editor->resize( $width, $height, $crop ) ) ) {
return array(
'url' => '',
'width' => '',
'height' => ''
);
}
$new_img_path = $img_editor->generate_filename();
if ( is_wp_error( $img_editor->save( $new_img_path ) ) ) {
return array(
'url' => '',
'width' => '',
'height' => ''
);
}
if ( ! is_string( $new_img_path ) ) {
return array(
'url' => '',
'width' => '',
'height' => ''
);
}
$new_img_size = getimagesize( $new_img_path );
$new_img = str_replace( basename( $image_src[0] ), basename( $new_img_path ), $image_src[0] );
// resized output
$vt_image = array(
'url' => $new_img,
'width' => $new_img_size[0],
'height' => $new_img_size[1]
);
return $vt_image;
}
// default output - without resizing
$vt_image = array(
'url' => $image_src[0],
'width' => $image_src[1],
'height' => $image_src[2]
);
return $vt_image;
}
}
if ( ! function_exists( 'wpb_debug' ) ) {
function wpb_debug() {
if ( isset( $_GET['wpb_debug'] ) && $_GET['wpb_debug'] == 'wpb_debug' ) return true;
else return false;
}
}
function js_composer_body_class( $classes ) {
$classes[] = 'wpb-js-composer js-comp-ver-' . WPB_VC_VERSION;
return $classes;
}
function wpb_js_force_send( $args ) {
$args['send'] = true;
return $args;
}
function vc_get_interface_version() {
global $post_id;
if ( $post_id === NULL ) return 2;
return (int)get_post_meta( $post_id, '_wpb_vc_js_interface_version', true );
}
function vc_get_initerface_version() {
return vc_get_interface_version();
}
function vc_convert_shortcode( $m ) {
list( $output, $m_one, $tag, $attr_string, $m_four, $content ) = $m;
$result = $width = $el_position = '';
$shortcode_attr = shortcode_parse_atts( $attr_string );
extract( shortcode_atts( array(
'width' => '1/1',
'el_class' => '',
'el_position' => ''
), $shortcode_attr ) );
if ( $tag == 'vc_row' ) return $output;
// Start
if ( preg_match( '/first/', $el_position ) || empty( $shortcode_attr['width'] ) || $shortcode_attr['width'] === '1/1' ) $result = '[vc_row]';
if ( $tag != 'vc_column' ) $result .= "\n" . '[vc_column width="' . $width . '"]';
// Tag
$pattern = get_shortcode_regex();
if ( $tag == 'vc_column' ) {
$result .= "[{$m_one}{$tag} {$attr_string}]" . preg_replace_callback( "/{$pattern}/s", 'vc_convert_inner_shortcode', $content ) . "[/{$tag}{$m_four}]";
} elseif ( $tag == 'vc_tabs' || $tag == 'vc_accordion' || $tag == 'vc_tour' ) {
$result .= "[{$m_one}{$tag} {$attr_string}]" . preg_replace_callback( "/{$pattern}/s", 'vc_convert_tab_inner_shortcode', $content ) . "[/{$tag}{$m_four}]";
} else {
$result .= preg_replace( '/(\"\d\/\d\")/', '"1/1"', $output );
}
// $content = preg_replace_callback( "/{$pattern}/s", 'vc_convert_inner_shortcode', $content );
// End
if ( $tag != 'vc_column' ) $result .= '[/vc_column]';
if ( preg_match( '/last/', $el_position ) || empty( $shortcode_attr['width'] ) || $shortcode_attr['width'] === '1/1' ) $result .= '[/vc_row]' . "\n";
return $result;
}
function vc_convert_tab_inner_shortcode( $m ) {
list( $output, $m_one, $tag, $attr_string, $m_four, $content ) = $m;
$result = $width = $el_position = '';
extract( shortcode_atts( array(
'width' => '1/1',
'el_class' => '',
'el_position' => ''
), shortcode_parse_atts( $attr_string ) ) );
$pattern = get_shortcode_regex();
$result .= "[{$m_one}{$tag} {$attr_string}]" . preg_replace_callback( "/{$pattern}/s", 'vc_convert_inner_shortcode', $content ) . "[/{$tag}{$m_four}]";
return $result;
}
function vc_convert_inner_shortcode( $m ) {
list( $output, $m_one, $tag, $attr_string, $m_four, $content ) = $m;
$result = $width = $el_position = '';
extract( shortcode_atts( array(
'width' => '1/1',
'el_class' => '',
'el_position' => ''
), shortcode_parse_atts( $attr_string ) ) );
if ( $width != '1/1' ) {
if ( preg_match( '/first/', $el_position ) ) $result .= '[vc_row_inner]';
$result .= "\n" . '[vc_column_inner width="' . $width . '" el_position="' . $el_position . '"]';
$attr = '';
foreach ( shortcode_parse_atts( $attr_string ) as $key => $value ) {
if ( $key == 'width' ) $value = '1/1';
elseif ( $key == 'el_position' ) $value = 'first last';
$attr .= ' ' . $key . '="' . $value . '"';
}
$result .= "[{$m_one}{$tag} {$attr}]" . $content . "[/{$tag}{$m_four}]";
$result .= '[/vc_column_inner]';
if ( preg_match( '/last/', $el_position ) ) $result .= '[/vc_row_inner]' . "\n";
} else {
$result = $output;
}
return $result;
}
global $vc_row_layouts;
$vc_row_layouts = array(
/*
* How to count mask?
* mask = column_count . sum of all numbers. Example layout 12_12 mask = (column count=2)(1+2+1+2=6)= 26
*/
array( 'cells' => '11', 'mask' => '12', 'title' => '1/1', 'icon_class' => 'l_11' ),
array( 'cells' => '12_12', 'mask' => '26', 'title' => '1/2 + 1/2', 'icon_class' => 'l_12_12' ),
array( 'cells' => '23_13', 'mask' => '29', 'title' => '2/3 + 1/3', 'icon_class' => 'l_23_13' ),
array( 'cells' => '13_13_13', 'mask' => '312', 'title' => '1/3 + 1/3 + 1/3', 'icon_class' => 'l_13_13_13' ),
array( 'cells' => '14_14_14_14', 'mask' => '420', 'title' => '1/4 + 1/4 + 1/4 + 1/4', 'icon_class' => 'l_14_14_14_14' ),
array( 'cells' => '14_34', 'mask' => '212', 'title' => '1/4 + 3/4', 'icon_class' => 'l_14_34' ),
array( 'cells' => '14_12_14', 'mask' => '313', 'title' => '1/4 + 1/2 + 1/4', 'icon_class' => 'l_14_12_14' ),
array( 'cells' => '56_16', 'mask' => '218', 'title' => '5/6 + 1/6', 'icon_class' => 'l_56_16' ),
array( 'cells' => '16_16_16_16_16_16', 'mask' => '642', 'title' => '1/6 + 1/6 + 1/6 + 1/6 + 1/6 + 1/6', 'icon_class' => 'l_16_16_16_16_16_16' ),
array( 'cells' => '16_23_16', 'mask' => '319', 'title' => '1/6 + 4/6 + 1/6', 'icon_class' => 'l_16_46_16' ),
array( 'cells' => '16_16_16_12', 'mask' => '424', 'title' => '1/6 + 1/6 + 1/6 + 1/2', 'icon_class' => 'l_16_16_16_12' )
);
function wpb_vc_get_column_width_indent( $width ) {
$identy = '11';
if ( $width == 'vc_col-sm-6' ) {
$identy = '12';
} elseif ( $width == 'vc_col-sm-3' ) {
$identy = '14';
} elseif ( $width == 'vc_col-sm-4' ) {
$identy = '13';
} elseif ( $width == 'vc_col-sm-8' ) {
$identy = '23';
} elseif ( $width == 'vc_col-sm-2' ) {
$identy = '16';
} elseif ( $width == 'vc_col-sm-9' ) {
$identy = '34';
} elseif ( $width == 'vc_col-sm-2' ) {
$identy = '16';
} elseif ( $width == 'vc_col-sm-10' ) {
$identy = '56';
}
return $identy;
}
function get_row_css_class() {
$custom = vc_settings()->get( 'row_css_class' );
return ! empty( $custom ) ? $custom : 'vc_row-fluid';
}
function get_custom_column_class( $class ) {
$custom_array = (array)vc_settings()->get( 'column_css_classes' );
return ! empty( $custom_array[$class] ) ? $custom_array[$class] : '';
}
/* Make any HEX color lighter or darker
---------------------------------------------------------- */
function vc_colorCreator( $colour, $per ) {
$colour = substr( $colour, 1 ); // Removes first character of hex string (#)
$rgb = ''; // Empty variable
$per = $per / 100 * 255; // Creates a percentage to work with. Change the middle figure to control colour temperature
if ( $per < 0 ) // Check to see if the percentage is a negative number
{
// DARKER
$per = abs( $per ); // Turns Neg Number to Pos Number
for ( $x = 0; $x < 3; $x ++ ) {
$c = hexdec( substr( $colour, ( 2 * $x ), 2 ) ) - $per;
$c = ( $c < 0 ) ? 0 : dechex( $c );
$rgb .= ( strlen( $c ) < 2 ) ? '0' . $c : $c;
}
} else {
// LIGHTER
for ( $x = 0; $x < 3; $x ++ ) {
$c = hexdec( substr( $colour, ( 2 * $x ), 2 ) ) + $per;
$c = ( $c > 255 ) ? 'ff' : dechex( $c );
$rgb .= ( strlen( $c ) < 2 ) ? '0' . $c : $c;
}
}
return '#' . $rgb;
}
/* HEX to RGB converter
---------------------------------------------------------- */
function vc_hex2rgb( $color ) {
if ( ! empty( $color ) && $color[0] == '#' )
$color = substr( $color, 1 );
if ( strlen( $color ) == 6 )
list( $r, $g, $b ) = array( $color[0] . $color[1],
$color[2] . $color[3],
$color[4] . $color[5] );
elseif ( strlen( $color ) == 3 )
list( $r, $g, $b ) = array( $color[0] . $color[0], $color[1] . $color[1], $color[2] . $color[2] );
else
return false;
$r = hexdec( $r );
$g = hexdec( $g );
$b = hexdec( $b );
return array( $r, $g, $b );
}
/**
* Parse string like "title:Hello world|weekday:Monday" to array('title' => 'Hello World', 'weekday' => 'Monday')
*/
function vc_parse_multi_attribute( $value, $default = array() ) {
$result = $default;
$params_pairs = explode( '|', $value );
foreach ( $params_pairs as $pair ) {
$param = preg_split( '/\:/', $pair );
if ( ! empty( $param[0] ) && isset( $param[1] ) ) {
$result[$param[0]] = rawurldecode( $param[1] );
}
}
return $result;
}
function wpb_stripslashes_if_gpc_magic_quotes( $string ) {
if ( get_magic_quotes_gpc() ) {
return stripslashes( $string );
} else {
return $string;
}
}
function vc_param_options_parse_values( $v ) {
return rawurldecode( $v );
}
function vc_param_options_get_settings( $name, $settings ) {
foreach ( $settings as $params ) {
if ( isset( $params['name'] ) && $params['name'] === $name && isset( $params['type'] ) )
return $params;
}
return false;
}
function vc_convert_atts_to_string( $atts ) {
$output = '';
foreach ( $atts as $key => $value ) {
$output .= ' ' . $key . '="' . $value . '"';
}
return $output;
}
function vc_parse_options_string( $string, $tag, $param ) {
$options = $option_settings_list = array();
$settings = WPBMap::getParam( $tag, $param );
foreach ( preg_split( '/\|/', $string ) as $value ) {
if ( preg_match( '/\:/', $value ) ) {
$split = preg_split( '/\:/', $value );
$option_name = $split[0];
$option_settings = $option_settings_list[$option_name] = vc_param_options_get_settings( $option_name, $settings['options'] );
if ( isset( $option_settings['type'] ) && $option_settings['type'] === 'checkbox' ) {
$option_value = array_map( 'vc_param_options_parse_values', preg_split( '/\,/', $split[1] ) );
} else {
$option_value = rawurldecode( $split[1] );
}
$options[$option_name] = $option_value;
}
}
if ( isset( $settings['options'] ) ) {
foreach ( $settings['options'] as $setting_option ) {
if ( $setting_option['type'] !== 'separator' && isset( $setting_option['value'] ) && empty( $options[$setting_option['name']] ) ) {
$options[$setting_option['name']] = $setting_option['type'] === 'checkbox' ? preg_split( '/\,/', $setting_option['value'] ) : $setting_option['value'];
}
if ( isset( $setting_option['name'] ) && isset( $options[$setting_option['name']] ) && isset( $setting_option['value_type'] ) ) {
if ( $setting_option['value_type'] === 'integer' ) {
$options[$setting_option['name']] = (int)$options[$setting_option['name']];
} elseif ( $setting_option['value_type'] === 'float' ) {
$options[$setting_option['name']] = (float)$options[$setting_option['name']];
} elseif ( $setting_option['value_type'] === 'boolean' ) {
$options[$setting_option['name']] = (boolean)$options[$setting_option['name']];
}
}
}
}
return $options;
}
function wpb_js_composer_check_version_schedule_deactivation() {
wp_clear_scheduled_hook( 'wpb_check_for_update' );
delete_option( 'wpb_js_composer_show_new_version_message' );
}
/**
* Helper function to add new third-party adaptation class.
*
* @since 4.3
* @param Vc_Vendor_Interface $vendor - instance of class.
*/
function vc_add_vendor(Vc_Vendor_Interface $vendor) {
visual_composer()->vendorsManager()->add($vendor);
}
/**
* Convert string to a valid css class name.
*
* @since 4.3
* @param string $class
* @return string
*/
function vc_build_safe_css_class( $class ) {
return preg_replace( '/\W+/', '', strtolower( str_replace( " ", "_", strip_tags( $class ) ) ) );
}
/**
* Include template from templates dir.
*
* @since 4.3
* @param $template
* @param array $variables - passed variables to the template.
*/
function vc_include_template($template, $variables = array(), $once = false) {
is_array($variables) && extract($variables);
if($once) {
require_once vc_template($template);
} else {
require vc_template($template);
}
}
/**
* if php version < 5.3 this function is required.
*/
if(function_exists('lcfirst') === false) {
function lcfirst($str) {
$str[0] = mb_strtolower($str[0]);
return $str;
}
}
/**
* VC Convert a value to studly caps case.
*
* @since 4.3
* @param string $value
* @return string
*/
function vc_studly($value) {
$value = ucwords(str_replace(array('-', '_'), ' ', $value));
return str_replace(' ', '', $value);
}
/**
* VC Convert a value to camel case.
*
* @since 4.3
* @param string $value
* @return string
*/
function vc_camel_case($value) {
return lcfirst(vc_studly($value));
}
| proj-2014/vlan247-test-wp | wp-content/themes/dt-the7/wpbakery/js_composer/include/helpers/helpers.php | PHP | gpl-2.0 | 24,666 |
#
# Makefile for the touchscreen drivers.
#
# Each configuration option enables a list of files.
wm97xx-ts-y := wm97xx-core.o
obj-$(CONFIG_TOUCHSCREEN_88PM860X) += 88pm860x-ts.o
obj-$(CONFIG_TOUCHSCREEN_AD7877) += ad7877.o
obj-$(CONFIG_TOUCHSCREEN_AD7879) += ad7879.o
obj-$(CONFIG_TOUCHSCREEN_AD7879_I2C) += ad7879-i2c.o
obj-$(CONFIG_TOUCHSCREEN_AD7879_SPI) += ad7879-spi.o
obj-$(CONFIG_TOUCHSCREEN_ADS7846) += ads7846.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_MXT) += atmel_mxt_ts.o
obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC) += atmel_tsadcc.o
obj-$(CONFIG_TOUCHSCREEN_AUO_PIXCIR) += auo-pixcir-ts.o
obj-$(CONFIG_TOUCHSCREEN_BU21013) += bu21013_ts.o
obj-$(CONFIG_TOUCHSCREEN_CY8CTMG110) += cy8ctmg110_ts.o
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_CORE) += cyttsp_core.o
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_I2C) += cyttsp_i2c.o
obj-$(CONFIG_TOUCHSCREEN_CYTTSP_SPI) += cyttsp_spi.o
obj-$(CONFIG_TOUCHSCREEN_DA9034) += da9034-ts.o
obj-$(CONFIG_TOUCHSCREEN_DA9052) += da9052_tsi.o
obj-$(CONFIG_TOUCHSCREEN_DYNAPRO) += dynapro.o
obj-$(CONFIG_TOUCHSCREEN_EDT_FT5X06) += edt-ft5x06.o
obj-$(CONFIG_TOUCHSCREEN_HAMPSHIRE) += hampshire.o
obj-$(CONFIG_TOUCHSCREEN_GUNZE) += gunze.o
obj-$(CONFIG_TOUCHSCREEN_EETI) += eeti_ts.o
obj-$(CONFIG_TOUCHSCREEN_ELO) += elo.o
obj-$(CONFIG_TOUCHSCREEN_EGALAX) += egalax_ts.o
obj-$(CONFIG_TOUCHSCREEN_FUJITSU) += fujitsu_ts.o
obj-$(CONFIG_TOUCHSCREEN_GEN_VKEYS) += gen_vkeys.o
obj-$(CONFIG_TOUCHSCREEN_ILI210X) += ili210x.o
obj-$(CONFIG_TOUCHSCREEN_INEXIO) += inexio.o
obj-$(CONFIG_TOUCHSCREEN_INTEL_MID) += intel-mid-touch.o
obj-$(CONFIG_TOUCHSCREEN_LPC32XX) += lpc32xx_ts.o
obj-$(CONFIG_TOUCHSCREEN_MAX11801) += max11801_ts.o
obj-$(CONFIG_TOUCHSCREEN_MC13783) += mc13783_ts.o
obj-$(CONFIG_TOUCHSCREEN_MCS5000) += mcs5000_ts.o
obj-$(CONFIG_TOUCHSCREEN_MIGOR) += migor_ts.o
obj-$(CONFIG_TOUCHSCREEN_MMS114) += mms114.o
obj-$(CONFIG_TOUCHSCREEN_MTOUCH) += mtouch.o
obj-$(CONFIG_TOUCHSCREEN_MK712) += mk712.o
obj-$(CONFIG_TOUCHSCREEN_HP600) += hp680_ts_input.o
obj-$(CONFIG_TOUCHSCREEN_HP7XX) += jornada720_ts.o
obj-$(CONFIG_TOUCHSCREEN_HTCPEN) += htcpen.o
obj-$(CONFIG_TOUCHSCREEN_USB_COMPOSITE) += usbtouchscreen.o
obj-$(CONFIG_TOUCHSCREEN_PCAP) += pcap_ts.o
obj-$(CONFIG_TOUCHSCREEN_PENMOUNT) += penmount.o
obj-$(CONFIG_TOUCHSCREEN_PIXCIR) += pixcir_i2c_ts.o
obj-$(CONFIG_TOUCHSCREEN_S3C2410) += s3c2410_ts.o
obj-$(CONFIG_TOUCHSCREEN_ST1232) += st1232.o
obj-$(CONFIG_TOUCHSCREEN_STMPE) += stmpe-ts.o
obj-$(CONFIG_TOUCHSCREEN_TI_AM335X_TSC) += ti_am335x_tsc.o
obj-$(CONFIG_TOUCHSCREEN_TNETV107X) += tnetv107x-ts.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHIT213) += touchit213.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHRIGHT) += touchright.o
obj-$(CONFIG_TOUCHSCREEN_TOUCHWIN) += touchwin.o
obj-$(CONFIG_TOUCHSCREEN_TSC_SERIO) += tsc40.o
obj-$(CONFIG_TOUCHSCREEN_TSC2005) += tsc2005.o
obj-$(CONFIG_TOUCHSCREEN_TSC2007) += tsc2007.o
obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o
obj-$(CONFIG_TOUCHSCREEN_WACOM_W8001) += wacom_w8001.o
obj-$(CONFIG_TOUCHSCREEN_WACOM_I2C) += wacom_i2c.o
obj-$(CONFIG_TOUCHSCREEN_WM831X) += wm831x-ts.o
obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o
wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o
wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o
wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o
obj-$(CONFIG_TOUCHSCREEN_WM97XX_ATMEL) += atmel-wm97xx.o
obj-$(CONFIG_TOUCHSCREEN_WM97XX_MAINSTONE) += mainstone-wm97xx.o
obj-$(CONFIG_TOUCHSCREEN_WM97XX_ZYLONITE) += zylonite-wm97xx.o
obj-$(CONFIG_TOUCHSCREEN_W90X900) += w90p910_ts.o
obj-$(CONFIG_TOUCHSCREEN_TPS6507X) += tps6507x-ts.o
obj-$(CONFIG_TOUCHSCREEN_FT5X06) += ft5x06_ts.o
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += synaptics_i2c_rmi4.o
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_RMI4_DEV) += synaptics_rmi_dev.o
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_DSX_FW_UPDATE) += synaptics_fw_update.o
obj-$(CONFIG_TOUCHSCREEN_GT9XX) += gt9xx/
| chadouming/canuck-3.10 | drivers/input/touchscreen/Makefile | Makefile | gpl-2.0 | 3,824 |
/*
FreeRTOS V7.2.0 - Copyright (C) 2012 Real Time Engineers Ltd.
***************************************************************************
* *
* FreeRTOS tutorial books are available in pdf and paperback. *
* Complete, revised, and edited pdf reference manuals are also *
* available. *
* *
* Purchasing FreeRTOS documentation will not only help you, by *
* ensuring you get running as quickly as possible and with an *
* in-depth knowledge of how to use FreeRTOS, it will also help *
* the FreeRTOS project to continue with its mission of providing *
* professional grade, cross platform, de facto standard solutions *
* for microcontrollers - completely free of charge! *
* *
* >>> See http://www.FreeRTOS.org/Documentation for details. <<< *
* *
* Thank you for using FreeRTOS, and thank you for your support! *
* *
***************************************************************************
This file is part of the FreeRTOS distribution.
FreeRTOS is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License (version 2) as published by the
Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
>>>NOTE<<< The modification to the GPL is included to allow you to
distribute a combined work that includes FreeRTOS without being obliged to
provide the source code for proprietary components outside of the FreeRTOS
kernel. FreeRTOS is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details. You should have received a copy of the GNU General Public
License and the FreeRTOS license exception along with FreeRTOS; if not it
can be viewed here: http://www.freertos.org/a00114.html and also obtained
by writing to Richard Barry, contact details for whom are available on the
FreeRTOS WEB site.
1 tab == 4 spaces!
***************************************************************************
* *
* Having a problem? Start by reading the FAQ "My application does *
* not run, what could be wrong? *
* *
* http://www.FreeRTOS.org/FAQHelp.html *
* *
***************************************************************************
http://www.FreeRTOS.org - Documentation, training, latest information,
license and contact details.
http://www.FreeRTOS.org/plus - A selection of FreeRTOS ecosystem products,
including FreeRTOS+Trace - an indispensable productivity tool.
Real Time Engineers ltd license FreeRTOS to High Integrity Systems, who sell
the code with commercial support, indemnification, and middleware, under
the OpenRTOS brand: http://www.OpenRTOS.com. High Integrity Systems also
provide a safety engineered and independently SIL3 certified version under
the SafeRTOS brand: http://www.SafeRTOS.com.
*/
#ifndef PORTMACRO_H
#define PORTMACRO_H
/*-----------------------------------------------------------
* Port specific definitions.
*
* The settings in this file configure FreeRTOS correctly for the
* given hardware and compiler.
*
* These settings should not be altered.
*-----------------------------------------------------------
*/
/* Type definitions. */
#define portCHAR char
#define portFLOAT float
#define portDOUBLE double
#define portLONG long
#define portSHORT short
#define portSTACK_TYPE unsigned portCHAR
#define portBASE_TYPE char
#if( configUSE_16_BIT_TICKS == 1 )
typedef unsigned portSHORT portTickType;
#define portMAX_DELAY ( portTickType ) 0xffff
#else
typedef unsigned portLONG portTickType;
#define portMAX_DELAY ( portTickType ) 0xffffffff
#endif
/*-----------------------------------------------------------*/
/* Hardware specifics. */
#define portBYTE_ALIGNMENT 1
#define portSTACK_GROWTH ( -1 )
#define portTICK_RATE_MS ( ( portTickType ) 1000 / configTICK_RATE_HZ )
#define portYIELD() __asm( "swi" );
#define portNOP() __asm( "nop" );
/*-----------------------------------------------------------*/
/* Critical section handling. */
#define portENABLE_INTERRUPTS() __asm( "cli" )
#define portDISABLE_INTERRUPTS() __asm( "sei" )
/*
* Disable interrupts before incrementing the count of critical section nesting.
* The nesting count is maintained so we know when interrupts should be
* re-enabled. Once interrupts are disabled the nesting count can be accessed
* directly. Each task maintains its own nesting count.
*/
#define portENTER_CRITICAL() \
{ \
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\
portDISABLE_INTERRUPTS(); \
uxCriticalNesting++; \
}
/*
* Interrupts are disabled so we can access the nesting count directly. If the
* nesting is found to be 0 (no nesting) then we are leaving the critical
* section and interrupts can be re-enabled.
*/
#define portEXIT_CRITICAL() \
{ \
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\
uxCriticalNesting--; \
if( uxCriticalNesting == 0 ) \
{ \
portENABLE_INTERRUPTS(); \
} \
}
/*-----------------------------------------------------------*/
/* Task utilities. */
/*
* These macros are very simple as the processor automatically saves and
* restores its registers as interrupts are entered and exited. In
* addition to the (automatically stacked) registers we also stack the
* critical nesting count. Each task maintains its own critical nesting
* count as it is legitimate for a task to yield from within a critical
* section. If the banked memory model is being used then the PPAGE
* register is also stored as part of the tasks context.
*/
#ifdef BANKED_MODEL
/*
* Load the stack pointer for the task, then pull the critical nesting
* count and PPAGE register from the stack. The remains of the
* context are restored by the RTI instruction.
*/
#define portRESTORE_CONTEXT() \
{ \
extern volatile void * pxCurrentTCB; \
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\
__asm( "ldx pxCurrentTCB" ); \
__asm( "lds 0, x" ); \
__asm( "pula" ); \
__asm( "staa uxCriticalNesting" ); \
__asm( "pula" ); \
__asm( "staa 0x30" ); /* 0x30 = PPAGE */ \
}
/*
* By the time this macro is called the processor has already stacked the
* registers. Simply stack the nesting count and PPAGE value, then save
* the task stack pointer.
*/
#define portSAVE_CONTEXT() \
{ \
extern volatile void * pxCurrentTCB; \
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\
__asm( "ldaa 0x30" ); /* 0x30 = PPAGE */ \
__asm( "psha" ); \
__asm( "ldaa uxCriticalNesting" ); \
__asm( "psha" ); \
__asm( "ldx pxCurrentTCB" ); \
__asm( "sts 0, x" ); \
}
#else
/*
* These macros are as per the BANKED versions above, but without saving
* and restoring the PPAGE register.
*/
#define portRESTORE_CONTEXT() \
{ \
extern volatile void * pxCurrentTCB; \
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\
__asm( "ldx pxCurrentTCB" ); \
__asm( "lds 0, x" ); \
__asm( "pula" ); \
__asm( "staa uxCriticalNesting" ); \
}
#define portSAVE_CONTEXT() \
{ \
extern volatile void * pxCurrentTCB; \
extern volatile unsigned portBASE_TYPE uxCriticalNesting; \
\
__asm( "ldaa uxCriticalNesting" ); \
__asm( "psha" ); \
__asm( "ldx pxCurrentTCB" ); \
__asm( "sts 0, x" ); \
}
#endif
/*
* Utility macro to call macros above in correct order in order to perform a
* task switch from within a standard ISR. This macro can only be used if
* the ISR does not use any local (stack) variables. If the ISR uses stack
* variables portYIELD() should be used in it's place.
*/
#define portTASK_SWITCH_FROM_ISR() \
portSAVE_CONTEXT(); \
vTaskSwitchContext(); \
portRESTORE_CONTEXT();
/* Task function macros as described on the FreeRTOS.org WEB site. */
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
#endif /* PORTMACRO_H */
| GraniteDevices/ArgonServoDriveFirmware | freertos/portable/CodeWarrior/HCS12/portmacro.h | C | gpl-2.0 | 9,777 |
include ../../Makefile.omd
NAME = nagios
VERSION = 3.5.0
DIR = $(NAME)-$(VERSION)
# Configure options for Nagios. Since we want to compile
# as non-root, we use our own user and group for compiling.
# All files will be packaged as user 'root' later anyway.
CONFIGUREOPTS = \
--sbindir=$(OMD_ROOT)/lib/nagios/cgi-bin \
--bindir=$(OMD_ROOT)/bin \
--datadir=$(OMD_ROOT)/share/nagios/htdocs \
--with-nagios-user=$$(id -un) \
--with-nagios-group=$$(id -gn) \
--with-perlcache \
--enable-embedded-perl \
build:
$(MAKE) prep
$(MAKE) compile
prep:
$(MAKE) unpack
$(MAKE) patch
compile:
cd $(DIR) ; ./configure $(CONFIGUREOPTS)
$(MAKE) -C $(DIR) all
unpack:
rm -rf $(DIR)
tar xzf $(DIR).tar.gz
mv nagios $(DIR)
patch:
set -e ; for p in patches/*.dif ; do \
echo "applying $$p..." ; \
( cd $(DIR) ; patch -p1 -b ) < $$p ; \
done
install:
$(MAKE) DESTDIR=$(DESTDIR) -C $(DIR) install-base install-cgis install-html install-classicui
rm -f $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/config.php.inc
# Install Themes
mkdir -p $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/classicui
cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/stylesheets $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/classicui/
cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/images $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/classicui/
$(MAKE) DESTDIR=$(DESTDIR) -C $(DIR) install-exfoliation
mkdir -p $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/exfoliation
cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/stylesheets $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/exfoliation/
cp -a $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/images $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/themes/exfoliation/
# remove original files
rm -rf $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/stylesheets
rm -rf $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/images
# Link ClassicUI
cd $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs; rm -rf styleshets; ln -sfn themes/classicui/stylesheets
cd $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs; rm -rf images; ln -sfn themes/classicui/images
mkdir -p $(DESTDIR)$(OMD_ROOT)/lib/nagios
install -m 664 $(DIR)/p1.pl $(DESTDIR)$(OMD_ROOT)/lib/nagios
mkdir -p $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi
install -m 755 ssi-wrapper.pl $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi
for f in common avail cmd config extinfo histogram history notifications outages showlog status statusmap statuswml statuswrl summary tac trends ; do \
ln -sfn ssi-wrapper.pl $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi/$$f-header.ssi ; \
ln -sfn ssi-wrapper.pl $(DESTDIR)$(OMD_ROOT)/share/nagios/htdocs/ssi/$$f-footer.ssi ; \
done
# Copy package documentations to have these information in the binary packages
mkdir -p $(DESTDIR)$(OMD_ROOT)/share/doc/$(NAME)
for file in README THANKS LEGAL LICENSE ; do \
install -m 644 $(DIR)/$$file $(DESTDIR)$(OMD_ROOT)/share/doc/$(NAME); \
done
mkdir -p $(DESTDIR)$(OMD_ROOT)/bin
install -m 755 merge-nagios-config $(DESTDIR)$(OMD_ROOT)/bin
# Install the diskspace cleanup plugin
mkdir -p $(DESTDIR)$(OMD_ROOT)/share/diskspace
install -m 644 diskspace $(DESTDIR)$(OMD_ROOT)/share/diskspace/nagios
clean:
rm -rf $(DIR)
testpatches:
@rm -rf $(DIR)
@tar xzf $(DIR).tar.gz
@set -e ; for p in patches/*.dif ; do \
rm -rf $(DIR).orig; \
cp -rp $(DIR) $(DIR).orig; \
( cd $(DIR) ; patch -sNt -p1 -r - ) < $$p > /dev/null; \
find $(DIR) -name \*.orig -exec rm {} \;; \
[ $$(diff -wr $(DIR).orig/. $(DIR)/. | wc -l) = 0 ] && echo "-> patch $$p did not change anything (already applied or broken)" || echo -n ""; \
done
@rm -rf $(DIR).orig
@echo "all patches tested"
| NeilBryant/omd | packages/nagios/Makefile | Makefile | gpl-2.0 | 3,715 |
(function( $ ) {
/**
* Activity reply object for the activity index screen
*
* @since ajency-activity-and-notifications (1.6)
*/
var activityReply = {
/**
* Attach event handler functions to the relevant elements.
*
* @since ajency-activity-and-notifications (1.6)
*/
init : function() {
$(document).on( 'click', '.row-actions a.reply', activityReply.open );
$(document).on( 'click', '#bp-activities-container a.cancel', activityReply.close );
$(document).on( 'click', '#bp-activities-container a.save', activityReply.send );
// Close textarea on escape
$(document).on( 'keyup', '#bp-activities:visible', function( e ) {
if ( 27 == e.which ) {
activityReply.close();
}
});
},
/**
* Reveals the entire row when "reply" is pressed.
*
* @since ajency-activity-and-notifications (1.6)
*/
open : function( e ) {
// Hide the container row, and move it to the new location
var box = $( '#bp-activities-container' ).hide();
$( this ).parents( 'tr' ).after( box );
// Fade the whole row in, and set focus on the text area.
box.fadeIn( '300' );
$( '#bp-activities' ).focus();
return false;
},
/**
* Hide and reset the entire row when "cancel", or escape, are pressed.
*
* @since ajency-activity-and-notifications (1.6)
*/
close : function( e ) {
// Hide the container row
$('#bp-activities-container').fadeOut( '200', function () {
// Empty and unfocus the text area
$( '#bp-activities' ).val( '' ).blur();
// Remove any error message and disable the spinner
$( '#bp-replysubmit .error' ).html( '' ).hide();
$( '#bp-replysubmit .waiting' ).hide();
});
return false;
},
/**
* Submits "form" via AJAX back to WordPress.
*
* @since ajency-activity-and-notifications (1.6)
*/
send : function( e ) {
// Hide any existing error message, and show the loading spinner
$( '#bp-replysubmit .error' ).hide();
$( '#bp-replysubmit .waiting' ).show();
// Grab the nonce
var reply = {};
reply['_ajax_nonce-bp-activity-admin-reply'] = $( '#bp-activities-container input[name="_ajax_nonce-bp-activity-admin-reply"]' ).val();
// Get the rest of the data
reply.action = 'bp-activity-admin-reply';
reply.content = $( '#bp-activities' ).val();
reply.parent_id = $( '#bp-activities-container' ).prev().data( 'parent_id' );
reply.root_id = $( '#bp-activities-container' ).prev().data( 'root_id' );
// Make the AJAX call
$.ajax({
data : reply,
type : 'POST',
url : ajaxurl,
// Callbacks
error : function( r ) { activityReply.error( r ); },
success : function( r ) { activityReply.show( r ); }
});
return false;
},
/**
* send() error message handler
*
* @since ajency-activity-and-notifications (1.6)
*/
error : function( r ) {
var er = r.statusText;
$('#bp-replysubmit .waiting').hide();
if ( r.responseText ) {
er = r.responseText.replace( /<.[^<>]*?>/g, '' );
}
if ( er ) {
$('#bp-replysubmit .error').html( er ).show();
}
},
/**
* send() success handler
*
* @since ajency-activity-and-notifications (1.6)
*/
show : function ( xml ) {
var bg, id, response;
// Handle any errors in the response
if ( typeof( xml ) == 'string' ) {
activityReply.error( { 'responseText': xml } );
return false;
}
response = wpAjax.parseAjaxResponse( xml );
if ( response.errors ) {
activityReply.error( { 'responseText': wpAjax.broken } );
return false;
}
response = response.responses[0];
// Close and reset the reply row, and add the new Activity item into the list.
$('#bp-activities-container').fadeOut( '200', function () {
// Empty and unfocus the text area
$( '#bp-activities' ).val( '' ).blur();
// Remove any error message and disable the spinner
$( '#bp-replysubmit .error' ).html( '' ).hide();
$( '#bp-replysubmit .waiting' ).hide();
// Insert new activity item
$( '#bp-activities-container' ).before( response.data );
// Get background colour and animate the flash
id = $( '#activity-' + response.id );
bg = id.closest( '.widefat' ).css( 'backgroundColor' );
id.animate( { 'backgroundColor': '#CEB' }, 300 ).animate( { 'backgroundColor': bg }, 300 );
});
}
};
$(document).ready( function () {
// Create the Activity reply object after domready event
activityReply.init();
// On the edit screen, unload the close/open toggle js for the action & content metaboxes
$( '#ajan_activity_action h3, #ajan_activity_content h3' ).unbind( 'click' );
// redo the post box toggles to reset the one made by comment.js in favor
// of activity administration page id so that metaboxes are still collapsible
// in single Activity Administration screen.
postboxes.add_postbox_toggles( ajan_activity_admin_vars.page );
});
})(jQuery); | ajency/minyawns | wp-content/plugins/ajency-activity-and-notifications/ajan-activity/admin/js/admin.js | JavaScript | gpl-2.0 | 4,814 |
/***************************************************************************
qgsafsproviderextern.cpp
------------------------
begin : Nov 26, 2015
copyright : (C) 2015 Sandro Mani
email : smani@sourcepole.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgis.h"
#include "qgsafsdataitems.h"
#include "qgsafsprovider.h"
#include "qgsafssourceselect.h"
#include "qgsowsconnection.h"
const QString AFS_KEY = QStringLiteral( "arcgisfeatureserver" );
const QString AFS_DESCRIPTION = QStringLiteral( "ArcGIS Feature Server data provider" );
QGISEXTERN QgsAfsProvider * classFactory( const QString *uri )
{
return new QgsAfsProvider( *uri );
}
QGISEXTERN QString providerKey()
{
return AFS_KEY;
}
QGISEXTERN QString description()
{
return AFS_DESCRIPTION;
}
QGISEXTERN bool isProvider()
{
return true;
}
QGISEXTERN QgsAfsSourceSelect *selectWidget( QWidget *parent, Qt::WindowFlags fl )
{
return new QgsAfsSourceSelect( parent, fl );
}
QGISEXTERN int dataCapabilities()
{
return QgsDataProvider::Net;
}
QGISEXTERN QgsDataItem *dataItem( QString thePath, QgsDataItem *parentItem )
{
if ( thePath.isEmpty() )
{
return new QgsAfsRootItem( parentItem, QStringLiteral( "ArcGisFeatureServer" ), QStringLiteral( "arcgisfeatureserver:" ) );
}
// path schema: afs:/connection name (used by OWS)
if ( thePath.startsWith( QLatin1String( "afs:/" ) ) )
{
QString connectionName = thePath.split( '/' ).last();
if ( QgsOwsConnection::connectionList( QStringLiteral( "ArcGisFeatureServer" ) ).contains( connectionName ) )
{
QgsOwsConnection connection( QStringLiteral( "ArcGisFeatureServer" ), connectionName );
return new QgsAfsConnectionItem( parentItem, QStringLiteral( "ArcGisFeatureServer" ), thePath, connection.uri().param( QStringLiteral( "url" ) ) );
}
}
return 0;
}
/*
QGISEXTERN bool saveStyle( const QString& uri, const QString& qmlStyle, const QString& sldStyle,
const QString& styleName, const QString& styleDescription,
const QString& uiFileContent, bool useAsDefault, QString& errCause )
{
}
QGISEXTERN QString loadStyle( const QString& uri, QString& errCause )
{
}
QGISEXTERN int listStyles( const QString &uri, QStringList &ids, QStringList &names,
QStringList &descriptions, QString& errCause )
{
}
QGISEXTERN QString getStyleById( const QString& uri, QString styleId, QString& errCause )
{
}
*/
| drnextgis/QGIS | src/providers/arcgisrest/qgsafsproviderextern.cpp | C++ | gpl-2.0 | 3,179 |
/*
* BCMSDH Function Driver for the native SDIO/MMC driver in the Linux Kernel
*
* Copyright (C) 1999-2010, Broadcom Corporation
*
* Unless you and Broadcom execute a separate written software license
* agreement governing use of this software, this software is licensed to you
* under the terms of the GNU General Public License version 2 (the "GPL"),
* available at http://www.broadcom.com/licenses/GPLv2.php, with the
* following added to such license:
*
* As a special exception, the copyright holders of this software give you
* permission to link this software with independent modules, and to copy and
* distribute the resulting executable under terms of your choice, provided that
* you also meet, for each linked independent module, the terms and conditions of
* the license of that module. An independent module is a module which is not
* derived from this software. The special exception does not apply to any
* modifications of the software.
*
* Notwithstanding the above, under no circumstances may you combine this
* software in any way with any other Broadcom software provided under a license
* other than the GPL, without Broadcom's express prior written consent.
*
* $Id: bcmsdh_sdmmc.c,v 1.1.2.5.6.29 2010/03/19 17:16:08 Exp $
*/
#include <typedefs.h>
#include <bcmdevs.h>
#include <bcmendian.h>
#include <bcmutils.h>
#include <osl.h>
#include <sdio.h> /* SDIO Device and Protocol Specs */
#include <sdioh.h> /* SDIO Host Controller Specification */
#include <bcmsdbus.h> /* bcmsdh to/from specific controller APIs */
#include <sdiovar.h> /* ioctl/iovars */
#include <linux/mmc/core.h>
#if defined(CONFIG_LGE_BCM432X_PATCH)
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
#endif /* CONFIG_LGE_BCM432X_PATCH */
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <dngl_stats.h>
#include <dhd.h>
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)) && defined(CONFIG_PM_SLEEP)
#include <linux/suspend.h>
extern volatile bool dhd_mmc_suspend;
#endif
#include "bcmsdh_sdmmc.h"
#ifndef BCMSDH_MODULE
extern int sdio_function_init(void);
extern void sdio_function_cleanup(void);
#endif /* BCMSDH_MODULE */
#if !defined(OOB_INTR_ONLY)
static void IRQHandler(struct sdio_func *func);
static void IRQHandlerF2(struct sdio_func *func);
#endif
static int sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr);
extern int sdio_reset_comm(struct mmc_card *card);
extern PBCMSDH_SDMMC_INSTANCE gInstance;
uint sd_sdmode = SDIOH_MODE_SD4; /* Use SD4 mode by default */
#if !defined(CONFIG_LGE_BCM432X_PATCH)
uint sd_f2_blocksize = 512; /* Default blocksize */
#else
uint sd_f2_blocksize = 64; /* Default blocksize */
#endif /* CONFIG_LGE_BCM432X_PATCH */
uint sd_divisor = 2; /* Default 48MHz/2 = 24MHz */
uint sd_power = 1; /* Default to SD Slot powered ON */
uint sd_clock = 1; /* Default to SD Clock turned ON */
uint sd_hiok = FALSE; /* Don't use hi-speed mode by default */
uint sd_msglevel = 0x01;
uint sd_use_dma = TRUE;
DHD_PM_RESUME_WAIT_INIT(sdioh_request_byte_wait);
DHD_PM_RESUME_WAIT_INIT(sdioh_request_word_wait);
DHD_PM_RESUME_WAIT_INIT(sdioh_request_packet_wait);
DHD_PM_RESUME_WAIT_INIT(sdioh_request_buffer_wait);
#define DMA_ALIGN_MASK 0x03
int sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data);
static int
sdioh_sdmmc_card_enablefuncs(sdioh_info_t *sd)
{
int err_ret;
uint32 fbraddr;
uint8 func;
sd_trace(("%s\n", __FUNCTION__));
/* Get the Card's common CIS address */
sd->com_cis_ptr = sdioh_sdmmc_get_cisaddr(sd, SDIOD_CCCR_CISPTR_0);
sd->func_cis_ptr[0] = sd->com_cis_ptr;
sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr));
/* Get the Card's function CIS (for each function) */
for (fbraddr = SDIOD_FBR_STARTADDR, func = 1;
func <= sd->num_funcs; func++, fbraddr += SDIOD_FBR_SIZE) {
sd->func_cis_ptr[func] = sdioh_sdmmc_get_cisaddr(sd, SDIOD_FBR_CISPTR_0 + fbraddr);
sd_info(("%s: Function %d CIS Ptr = 0x%x\n",
__FUNCTION__, func, sd->func_cis_ptr[func]));
}
sd->func_cis_ptr[0] = sd->com_cis_ptr;
sd_info(("%s: Card's Common CIS Ptr = 0x%x\n", __FUNCTION__, sd->com_cis_ptr));
/* Enable Function 1 */
sdio_claim_host(gInstance->func[1]);
err_ret = sdio_enable_func(gInstance->func[1]);
sdio_release_host(gInstance->func[1]);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to enable F1 Err: 0x%08x", err_ret));
}
return FALSE;
}
/*
* Public entry points & extern's
*/
extern sdioh_info_t *
sdioh_attach(osl_t *osh, void *bar0, uint irq)
{
sdioh_info_t *sd;
int err_ret;
sd_trace(("%s\n", __FUNCTION__));
if (gInstance == NULL) {
sd_err(("%s: SDIO Device not present\n", __FUNCTION__));
return NULL;
}
if ((sd = (sdioh_info_t *)MALLOC(osh, sizeof(sdioh_info_t))) == NULL) {
sd_err(("sdioh_attach: out of memory, malloced %d bytes\n", MALLOCED(osh)));
return NULL;
}
bzero((char *)sd, sizeof(sdioh_info_t));
sd->osh = osh;
if (sdioh_sdmmc_osinit(sd) != 0) {
sd_err(("%s:sdioh_sdmmc_osinit() failed\n", __FUNCTION__));
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
return NULL;
}
sd->num_funcs = 2;
sd->sd_blockmode = TRUE;
sd->use_client_ints = TRUE;
sd->client_block_size[0] = 64;
gInstance->sd = sd;
/* Claim host controller */
sdio_claim_host(gInstance->func[1]);
sd->client_block_size[1] = 64;
err_ret = sdio_set_block_size(gInstance->func[1], 64);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n"));
}
/* Release host controller F1 */
sdio_release_host(gInstance->func[1]);
if (gInstance->func[2]) {
/* Claim host controller F2 */
sdio_claim_host(gInstance->func[2]);
sd->client_block_size[2] = sd_f2_blocksize;
err_ret = sdio_set_block_size(gInstance->func[2], sd_f2_blocksize);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to set F2 blocksize to %d\n",
sd_f2_blocksize));
}
/* Release host controller F2 */
sdio_release_host(gInstance->func[2]);
}
sdioh_sdmmc_card_enablefuncs(sd);
sd_trace(("%s: Done\n", __FUNCTION__));
return sd;
}
extern SDIOH_API_RC
sdioh_detach(osl_t *osh, sdioh_info_t *sd)
{
sd_trace(("%s\n", __FUNCTION__));
if (sd) {
/* Disable Function 2 */
sdio_claim_host(gInstance->func[2]);
sdio_disable_func(gInstance->func[2]);
sdio_release_host(gInstance->func[2]);
/* Disable Function 1 */
sdio_claim_host(gInstance->func[1]);
sdio_disable_func(gInstance->func[1]);
sdio_release_host(gInstance->func[1]);
/* deregister irq */
sdioh_sdmmc_osfree(sd);
MFREE(sd->osh, sd, sizeof(sdioh_info_t));
}
return SDIOH_API_RC_SUCCESS;
}
#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
extern SDIOH_API_RC
sdioh_enable_func_intr(void)
{
uint8 reg;
int err;
if (gInstance->func[0]) {
sdio_claim_host(gInstance->func[0]);
reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err);
if (err) {
sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
sdio_release_host(gInstance->func[0]);
return SDIOH_API_RC_FAIL;
}
/* Enable F1 and F2 interrupts, set master enable */
reg |= (INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN | INTR_CTL_MASTER_EN);
sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
sdio_release_host(gInstance->func[0]);
if (err) {
sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
return SDIOH_API_RC_FAIL;
}
}
return SDIOH_API_RC_SUCCESS;
}
extern SDIOH_API_RC
sdioh_disable_func_intr(void)
{
uint8 reg;
int err;
if (gInstance->func[0]) {
sdio_claim_host(gInstance->func[0]);
reg = sdio_readb(gInstance->func[0], SDIOD_CCCR_INTEN, &err);
if (err) {
sd_err(("%s: error for read SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
sdio_release_host(gInstance->func[0]);
return SDIOH_API_RC_FAIL;
}
reg &= ~(INTR_CTL_FUNC1_EN | INTR_CTL_FUNC2_EN);
/* Disable master interrupt with the last function interrupt */
if (!(reg & 0xFE))
reg = 0;
sdio_writeb(gInstance->func[0], reg, SDIOD_CCCR_INTEN, &err);
sdio_release_host(gInstance->func[0]);
if (err) {
sd_err(("%s: error for write SDIO_CCCR_IENx : 0x%x\n", __FUNCTION__, err));
return SDIOH_API_RC_FAIL;
}
}
return SDIOH_API_RC_SUCCESS;
}
#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
/* Configure callback to client when we recieve client interrupt */
extern SDIOH_API_RC
sdioh_interrupt_register(sdioh_info_t *sd, sdioh_cb_fn_t fn, void *argh)
{
sd_trace(("%s: Entering\n", __FUNCTION__));
if (fn == NULL) {
sd_err(("%s: interrupt handler is NULL, not registering\n", __FUNCTION__));
return SDIOH_API_RC_FAIL;
}
#if !defined(OOB_INTR_ONLY)
sd->intr_handler = fn;
sd->intr_handler_arg = argh;
sd->intr_handler_valid = TRUE;
/* register and unmask irq */
if (gInstance->func[2]) {
sdio_claim_host(gInstance->func[2]);
sdio_claim_irq(gInstance->func[2], IRQHandlerF2);
sdio_release_host(gInstance->func[2]);
}
if (gInstance->func[1]) {
sdio_claim_host(gInstance->func[1]);
sdio_claim_irq(gInstance->func[1], IRQHandler);
sdio_release_host(gInstance->func[1]);
}
#elif defined(HW_OOB)
sdioh_enable_func_intr();
#endif /* defined(OOB_INTR_ONLY) */
return SDIOH_API_RC_SUCCESS;
}
extern SDIOH_API_RC
sdioh_interrupt_deregister(sdioh_info_t *sd)
{
sd_trace(("%s: Entering\n", __FUNCTION__));
#if !defined(OOB_INTR_ONLY)
if (gInstance->func[1]) {
/* register and unmask irq */
sdio_claim_host(gInstance->func[1]);
sdio_release_irq(gInstance->func[1]);
sdio_release_host(gInstance->func[1]);
}
if (gInstance->func[2]) {
/* Claim host controller F2 */
sdio_claim_host(gInstance->func[2]);
sdio_release_irq(gInstance->func[2]);
/* Release host controller F2 */
sdio_release_host(gInstance->func[2]);
}
sd->intr_handler_valid = FALSE;
sd->intr_handler = NULL;
sd->intr_handler_arg = NULL;
#elif defined(HW_OOB)
sdioh_disable_func_intr();
#endif /* !defined(OOB_INTR_ONLY) */
return SDIOH_API_RC_SUCCESS;
}
extern SDIOH_API_RC
sdioh_interrupt_query(sdioh_info_t *sd, bool *onoff)
{
sd_trace(("%s: Entering\n", __FUNCTION__));
*onoff = sd->client_intr_enabled;
return SDIOH_API_RC_SUCCESS;
}
#if defined(DHD_DEBUG)
extern bool
sdioh_interrupt_pending(sdioh_info_t *sd)
{
return (0);
}
#endif
uint
sdioh_query_iofnum(sdioh_info_t *sd)
{
return sd->num_funcs;
}
/* IOVar table */
enum {
IOV_MSGLEVEL = 1,
IOV_BLOCKMODE,
IOV_BLOCKSIZE,
IOV_DMA,
IOV_USEINTS,
IOV_NUMINTS,
IOV_NUMLOCALINTS,
IOV_HOSTREG,
IOV_DEVREG,
IOV_DIVISOR,
IOV_SDMODE,
IOV_HISPEED,
IOV_HCIREGS,
IOV_POWER,
IOV_CLOCK,
IOV_RXCHAIN
};
const bcm_iovar_t sdioh_iovars[] = {
{"sd_msglevel", IOV_MSGLEVEL, 0, IOVT_UINT32, 0 },
{"sd_blockmode", IOV_BLOCKMODE, 0, IOVT_BOOL, 0 },
{"sd_blocksize", IOV_BLOCKSIZE, 0, IOVT_UINT32, 0 }, /* ((fn << 16) | size) */
{"sd_dma", IOV_DMA, 0, IOVT_BOOL, 0 },
{"sd_ints", IOV_USEINTS, 0, IOVT_BOOL, 0 },
{"sd_numints", IOV_NUMINTS, 0, IOVT_UINT32, 0 },
{"sd_numlocalints", IOV_NUMLOCALINTS, 0, IOVT_UINT32, 0 },
{"sd_hostreg", IOV_HOSTREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
{"sd_devreg", IOV_DEVREG, 0, IOVT_BUFFER, sizeof(sdreg_t) },
{"sd_divisor", IOV_DIVISOR, 0, IOVT_UINT32, 0 },
{"sd_power", IOV_POWER, 0, IOVT_UINT32, 0 },
{"sd_clock", IOV_CLOCK, 0, IOVT_UINT32, 0 },
{"sd_mode", IOV_SDMODE, 0, IOVT_UINT32, 100},
{"sd_highspeed", IOV_HISPEED, 0, IOVT_UINT32, 0 },
{"sd_rxchain", IOV_RXCHAIN, 0, IOVT_BOOL, 0 },
{NULL, 0, 0, 0, 0 }
};
int
sdioh_iovar_op(sdioh_info_t *si, const char *name,
void *params, int plen, void *arg, int len, bool set)
{
const bcm_iovar_t *vi = NULL;
int bcmerror = 0;
int val_size;
int32 int_val = 0;
bool bool_val;
uint32 actionid;
ASSERT(name);
ASSERT(len >= 0);
/* Get must have return space; Set does not take qualifiers */
ASSERT(set || (arg && len));
ASSERT(!set || (!params && !plen));
sd_trace(("%s: Enter (%s %s)\n", __FUNCTION__, (set ? "set" : "get"), name));
if ((vi = bcm_iovar_lookup(sdioh_iovars, name)) == NULL) {
bcmerror = BCME_UNSUPPORTED;
goto exit;
}
if ((bcmerror = bcm_iovar_lencheck(vi, arg, len, set)) != 0)
goto exit;
/* Set up params so get and set can share the convenience variables */
if (params == NULL) {
params = arg;
plen = len;
}
if (vi->type == IOVT_VOID)
val_size = 0;
else if (vi->type == IOVT_BUFFER)
val_size = len;
else
val_size = sizeof(int);
if (plen >= (int)sizeof(int_val))
bcopy(params, &int_val, sizeof(int_val));
bool_val = (int_val != 0) ? TRUE : FALSE;
actionid = set ? IOV_SVAL(vi->varid) : IOV_GVAL(vi->varid);
switch (actionid) {
case IOV_GVAL(IOV_MSGLEVEL):
int_val = (int32)sd_msglevel;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_MSGLEVEL):
sd_msglevel = int_val;
break;
case IOV_GVAL(IOV_BLOCKMODE):
int_val = (int32)si->sd_blockmode;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_BLOCKMODE):
si->sd_blockmode = (bool)int_val;
/* Haven't figured out how to make non-block mode with DMA */
break;
case IOV_GVAL(IOV_BLOCKSIZE):
if ((uint32)int_val > si->num_funcs) {
bcmerror = BCME_BADARG;
break;
}
int_val = (int32)si->client_block_size[int_val];
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_BLOCKSIZE):
{
uint func = ((uint32)int_val >> 16);
uint blksize = (uint16)int_val;
uint maxsize;
if (func > si->num_funcs) {
bcmerror = BCME_BADARG;
break;
}
switch (func) {
case 0: maxsize = 32; break;
case 1: maxsize = BLOCK_SIZE_4318; break;
case 2: maxsize = BLOCK_SIZE_4328; break;
default: maxsize = 0;
}
if (blksize > maxsize) {
bcmerror = BCME_BADARG;
break;
}
if (!blksize) {
blksize = maxsize;
}
/* Now set it */
si->client_block_size[func] = blksize;
break;
}
case IOV_GVAL(IOV_RXCHAIN):
int_val = FALSE;
bcopy(&int_val, arg, val_size);
break;
case IOV_GVAL(IOV_DMA):
int_val = (int32)si->sd_use_dma;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_DMA):
si->sd_use_dma = (bool)int_val;
break;
case IOV_GVAL(IOV_USEINTS):
int_val = (int32)si->use_client_ints;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_USEINTS):
si->use_client_ints = (bool)int_val;
if (si->use_client_ints)
si->intmask |= CLIENT_INTR;
else
si->intmask &= ~CLIENT_INTR;
break;
case IOV_GVAL(IOV_DIVISOR):
int_val = (uint32)sd_divisor;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_DIVISOR):
sd_divisor = int_val;
break;
case IOV_GVAL(IOV_POWER):
int_val = (uint32)sd_power;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_POWER):
sd_power = int_val;
break;
case IOV_GVAL(IOV_CLOCK):
int_val = (uint32)sd_clock;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_CLOCK):
sd_clock = int_val;
break;
case IOV_GVAL(IOV_SDMODE):
int_val = (uint32)sd_sdmode;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_SDMODE):
sd_sdmode = int_val;
break;
case IOV_GVAL(IOV_HISPEED):
int_val = (uint32)sd_hiok;
bcopy(&int_val, arg, val_size);
break;
case IOV_SVAL(IOV_HISPEED):
sd_hiok = int_val;
break;
case IOV_GVAL(IOV_NUMINTS):
int_val = (int32)si->intrcount;
bcopy(&int_val, arg, val_size);
break;
case IOV_GVAL(IOV_NUMLOCALINTS):
int_val = (int32)0;
bcopy(&int_val, arg, val_size);
break;
case IOV_GVAL(IOV_HOSTREG):
{
sdreg_t *sd_ptr = (sdreg_t *)params;
if (sd_ptr->offset < SD_SysAddr || sd_ptr->offset > SD_MaxCurCap) {
sd_err(("%s: bad offset 0x%x\n", __FUNCTION__, sd_ptr->offset));
bcmerror = BCME_BADARG;
break;
}
sd_trace(("%s: rreg%d at offset %d\n", __FUNCTION__,
(sd_ptr->offset & 1) ? 8 : ((sd_ptr->offset & 2) ? 16 : 32),
sd_ptr->offset));
if (sd_ptr->offset & 1)
int_val = 8; /* sdioh_sdmmc_rreg8(si, sd_ptr->offset); */
else if (sd_ptr->offset & 2)
int_val = 16; /* sdioh_sdmmc_rreg16(si, sd_ptr->offset); */
else
int_val = 32; /* sdioh_sdmmc_rreg(si, sd_ptr->offset); */
bcopy(&int_val, arg, sizeof(int_val));
break;
}
case IOV_SVAL(IOV_HOSTREG):
{
sdreg_t *sd_ptr = (sdreg_t *)params;
if (sd_ptr->offset < SD_SysAddr || sd_ptr->offset > SD_MaxCurCap) {
sd_err(("%s: bad offset 0x%x\n", __FUNCTION__, sd_ptr->offset));
bcmerror = BCME_BADARG;
break;
}
sd_trace(("%s: wreg%d value 0x%08x at offset %d\n", __FUNCTION__, sd_ptr->value,
(sd_ptr->offset & 1) ? 8 : ((sd_ptr->offset & 2) ? 16 : 32),
sd_ptr->offset));
break;
}
case IOV_GVAL(IOV_DEVREG):
{
sdreg_t *sd_ptr = (sdreg_t *)params;
uint8 data = 0;
if (sdioh_cfg_read(si, sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = BCME_SDIO_ERROR;
break;
}
int_val = (int)data;
bcopy(&int_val, arg, sizeof(int_val));
break;
}
case IOV_SVAL(IOV_DEVREG):
{
sdreg_t *sd_ptr = (sdreg_t *)params;
uint8 data = (uint8)sd_ptr->value;
if (sdioh_cfg_write(si, sd_ptr->func, sd_ptr->offset, &data)) {
bcmerror = BCME_SDIO_ERROR;
break;
}
break;
}
default:
bcmerror = BCME_UNSUPPORTED;
break;
}
exit:
return bcmerror;
}
#if defined(OOB_INTR_ONLY) && defined(HW_OOB)
SDIOH_API_RC
sdioh_enable_hw_oob_intr(sdioh_info_t *sd, bool enable)
{
SDIOH_API_RC status;
uint8 data;
if (enable)
data = 3; /* enable hw oob interrupt */
else
data = 4; /* disable hw oob interrupt */
status = sdioh_request_byte(sd, SDIOH_WRITE, 0, 0xf2, &data);
return status;
}
#endif /* defined(OOB_INTR_ONLY) && defined(HW_OOB) */
extern SDIOH_API_RC
sdioh_cfg_read(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data)
{
SDIOH_API_RC status;
/* No lock needed since sdioh_request_byte does locking */
status = sdioh_request_byte(sd, SDIOH_READ, fnc_num, addr, data);
return status;
}
extern SDIOH_API_RC
sdioh_cfg_write(sdioh_info_t *sd, uint fnc_num, uint32 addr, uint8 *data)
{
/* No lock needed since sdioh_request_byte does locking */
SDIOH_API_RC status;
status = sdioh_request_byte(sd, SDIOH_WRITE, fnc_num, addr, data);
return status;
}
static int
sdioh_sdmmc_get_cisaddr(sdioh_info_t *sd, uint32 regaddr)
{
/* read 24 bits and return valid 17 bit addr */
int i;
uint32 scratch, regdata;
uint8 *ptr = (uint8 *)&scratch;
for (i = 0; i < 3; i++) {
if ((sdioh_sdmmc_card_regread (sd, 0, regaddr, 1, ®data)) != SUCCESS)
sd_err(("%s: Can't read!\n", __FUNCTION__));
*ptr++ = (uint8) regdata;
regaddr++;
}
/* Only the lower 17-bits are valid */
scratch = ltoh32(scratch);
scratch &= 0x0001FFFF;
return (scratch);
}
extern SDIOH_API_RC
sdioh_cis_read(sdioh_info_t *sd, uint func, uint8 *cisd, uint32 length)
{
uint32 count;
int offset;
uint32 foo;
uint8 *cis = cisd;
sd_trace(("%s: Func = %d\n", __FUNCTION__, func));
if (!sd->func_cis_ptr[func]) {
bzero(cis, length);
sd_err(("%s: no func_cis_ptr[%d]\n", __FUNCTION__, func));
return SDIOH_API_RC_FAIL;
}
sd_err(("%s: func_cis_ptr[%d]=0x%04x\n", __FUNCTION__, func, sd->func_cis_ptr[func]));
for (count = 0; count < length; count++) {
offset = sd->func_cis_ptr[func] + count;
if (sdioh_sdmmc_card_regread (sd, 0, offset, 1, &foo) < 0) {
sd_err(("%s: regread failed: Can't read CIS\n", __FUNCTION__));
return SDIOH_API_RC_FAIL;
}
*cis = (uint8)(foo & 0xff);
cis++;
}
return SDIOH_API_RC_SUCCESS;
}
extern SDIOH_API_RC
sdioh_request_byte(sdioh_info_t *sd, uint rw, uint func, uint regaddr, uint8 *byte)
{
/* LGE_CHANGE_S, [dongp.kim@lge.com], 2010-04-22, WBT Fix */
int err_ret = 0;
/* LGE_CHANGE_S, [dongp.kim@lge.com], 2010-04-22, WBT Fix */
sd_info(("%s: rw=%d, func=%d, addr=0x%05x\n", __FUNCTION__, rw, func, regaddr));
DHD_PM_RESUME_WAIT(sdioh_request_byte_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
if(rw) { /* CMD52 Write */
if (func == 0) {
/* Can only directly write to some F0 registers. Handle F2 enable
* as a special case.
*/
if (regaddr == SDIOD_CCCR_IOEN) {
if (gInstance->func[2]) {
sdio_claim_host(gInstance->func[2]);
if (*byte & SDIO_FUNC_ENABLE_2) {
/* Enable Function 2 */
err_ret = sdio_enable_func(gInstance->func[2]);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: enable F2 failed:%d",
err_ret));
}
} else {
/* Disable Function 2 */
err_ret = sdio_disable_func(gInstance->func[2]);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Disab F2 failed:%d",
err_ret));
}
}
sdio_release_host(gInstance->func[2]);
}
}
#if defined(MMC_SDIO_ABORT)
/* to allow abort command through F1 */
else if (regaddr == SDIOD_CCCR_IOABORT) {
sdio_claim_host(gInstance->func[func]);
/*
* this sdio_f0_writeb() can be replaced with another api
* depending upon MMC driver change.
* As of this time, this is temporaray one
*/
sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
sdio_release_host(gInstance->func[func]);
}
#endif /* MMC_SDIO_ABORT */
else if (regaddr < 0xF0) {
sd_err(("bcmsdh_sdmmc: F0 Wr:0x%02x: write disallowed\n", regaddr));
} else {
/* Claim host controller, perform F0 write, and release */
sdio_claim_host(gInstance->func[func]);
sdio_f0_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
sdio_release_host(gInstance->func[func]);
}
} else {
/* Claim host controller, perform Fn write, and release */
sdio_claim_host(gInstance->func[func]);
sdio_writeb(gInstance->func[func], *byte, regaddr, &err_ret);
sdio_release_host(gInstance->func[func]);
}
} else { /* CMD52 Read */
/* Claim host controller, perform Fn read, and release */
sdio_claim_host(gInstance->func[func]);
if (func == 0) {
*byte = sdio_f0_readb(gInstance->func[func], regaddr, &err_ret);
} else {
*byte = sdio_readb(gInstance->func[func], regaddr, &err_ret);
}
sdio_release_host(gInstance->func[func]);
}
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to %s byte F%d:@0x%05x=%02x, Err: %d\n",
rw ? "Write" : "Read", func, regaddr, *byte, err_ret));
}
return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
}
extern SDIOH_API_RC
sdioh_request_word(sdioh_info_t *sd, uint cmd_type, uint rw, uint func, uint addr,
uint32 *word, uint nbytes)
{
int err_ret = SDIOH_API_RC_FAIL;
if (func == 0) {
sd_err(("%s: Only CMD52 allowed to F0.\n", __FUNCTION__));
return SDIOH_API_RC_FAIL;
}
sd_info(("%s: cmd_type=%d, rw=%d, func=%d, addr=0x%05x, nbytes=%d\n",
__FUNCTION__, cmd_type, rw, func, addr, nbytes));
DHD_PM_RESUME_WAIT(sdioh_request_word_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
/* Claim host controller */
sdio_claim_host(gInstance->func[func]);
if(rw) { /* CMD52 Write */
if (nbytes == 4) {
sdio_writel(gInstance->func[func], *word, addr, &err_ret);
} else if (nbytes == 2) {
sdio_writew(gInstance->func[func], (*word & 0xFFFF), addr, &err_ret);
} else {
sd_err(("%s: Invalid nbytes: %d\n", __FUNCTION__, nbytes));
}
} else { /* CMD52 Read */
if (nbytes == 4) {
*word = sdio_readl(gInstance->func[func], addr, &err_ret);
} else if (nbytes == 2) {
*word = sdio_readw(gInstance->func[func], addr, &err_ret) & 0xFFFF;
} else {
sd_err(("%s: Invalid nbytes: %d\n", __FUNCTION__, nbytes));
}
}
/* Release host controller */
sdio_release_host(gInstance->func[func]);
if (err_ret) {
sd_err(("bcmsdh_sdmmc: Failed to %s word, Err: 0x%08x",
rw ? "Write" : "Read", err_ret));
}
return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
}
static SDIOH_API_RC
sdioh_request_packet(sdioh_info_t *sd, uint fix_inc, uint write, uint func,
uint addr, void *pkt)
{
bool fifo = (fix_inc == SDIOH_DATA_FIX);
uint32 SGCount = 0;
int err_ret = 0;
void *pnext;
sd_trace(("%s: Enter\n", __FUNCTION__));
ASSERT(pkt);
DHD_PM_RESUME_WAIT(sdioh_request_packet_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
/* Claim host controller */
sdio_claim_host(gInstance->func[func]);
for (pnext = pkt; pnext; pnext = PKTNEXT(sd->osh, pnext)) {
uint pkt_len = PKTLEN(sd->osh, pnext);
pkt_len += 3;
pkt_len &= 0xFFFFFFFC;
#ifdef CONFIG_MMC_MSM7X00A
if ((pkt_len % 64) == 32) {
sd_trace(("%s: Rounding up TX packet +=32\n", __FUNCTION__));
pkt_len += 32;
}
#endif /* CONFIG_MMC_MSM7X00A */
/* Make sure the packet is aligned properly. If it isn't, then this
* is the fault of sdioh_request_buffer() which is supposed to give
* us something we can work with.
*/
ASSERT(((uint32)(PKTDATA(sd->osh, pkt)) & DMA_ALIGN_MASK) == 0);
if ((write) && (!fifo)) {
err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
((uint8*)PKTDATA(sd->osh, pnext)),
pkt_len);
} else if (write) {
err_ret = sdio_memcpy_toio(gInstance->func[func], addr,
((uint8*)PKTDATA(sd->osh, pnext)),
pkt_len);
} else if (fifo) {
err_ret = sdio_readsb(gInstance->func[func],
((uint8*)PKTDATA(sd->osh, pnext)),
addr,
pkt_len);
} else {
err_ret = sdio_memcpy_fromio(gInstance->func[func],
((uint8*)PKTDATA(sd->osh, pnext)),
addr,
pkt_len);
}
if (err_ret) {
sd_err(("%s: %s FAILED %p[%d], addr=0x%05x, pkt_len=%d, ERR=0x%08x\n",
__FUNCTION__,
(write) ? "TX" : "RX",
pnext, SGCount, addr, pkt_len, err_ret));
} else {
sd_trace(("%s: %s xfr'd %p[%d], addr=0x%05x, len=%d\n",
__FUNCTION__,
(write) ? "TX" : "RX",
pnext, SGCount, addr, pkt_len));
}
if (!fifo) {
addr += pkt_len;
}
SGCount ++;
}
/* Release host controller */
sdio_release_host(gInstance->func[func]);
sd_trace(("%s: Exit\n", __FUNCTION__));
return ((err_ret == 0) ? SDIOH_API_RC_SUCCESS : SDIOH_API_RC_FAIL);
}
#if defined(CONFIG_LGE_BCM432X_PATCH)
#define PKTALIGN(osh, p, len, align) \
do { \
uint datalign; \
datalign = (uintptr)PKTDATA((osh), (p)); \
datalign = ROUNDUP(datalign, (align)) - datalign; \
ASSERT(datalign < (align)); \
ASSERT(PKTLEN((osh), (p)) >= ((len) + datalign)); \
if (datalign) \
PKTPULL((osh), (p), datalign); \
PKTSETLEN((osh), (p), (len)); \
} while (0)
#endif /* CONFIG_LGE_BCM432X_PATCH */
/*
* This function takes a buffer or packet, and fixes everything up so that in the
* end, a DMA-able packet is created.
*
* A buffer does not have an associated packet pointer, and may or may not be aligned.
* A packet may consist of a single packet, or a packet chain. If it is a packet chain,
* then all the packets in the chain must be properly aligned. If the packet data is not
* aligned, then there may only be one packet, and in this case, it is copied to a new
* aligned packet.
*
*/
extern SDIOH_API_RC
sdioh_request_buffer(sdioh_info_t *sd, uint pio_dma, uint fix_inc, uint write, uint func,
uint addr, uint reg_width, uint buflen_u, uint8 *buffer, void *pkt)
{
SDIOH_API_RC Status;
void *mypkt = NULL;
sd_trace(("%s: Enter\n", __FUNCTION__));
DHD_PM_RESUME_WAIT(sdioh_request_buffer_wait);
DHD_PM_RESUME_RETURN_ERROR(SDIOH_API_RC_FAIL);
/* Case 1: we don't have a packet. */
if (pkt == NULL) {
sd_data(("%s: Creating new %s Packet, len=%d\n",
__FUNCTION__, write ? "TX" : "RX", buflen_u));
#ifdef DHD_USE_STATIC_BUF
#if !defined(CONFIG_LGE_BCM432X_PATCH)
if (!(mypkt = PKTGET_STATIC(sd->osh, buflen_u, write ? TRUE : FALSE))) {
#else
if (!(mypkt = PKTGET_STATIC(sd->osh, buflen_u + DHD_SDALIGN, write ? TRUE : FALSE))) {
#endif /* CONFIG_LGE_BCM432X_PATCH */
#else
#if !defined(CONFIG_LGE_BCM432X_PATCH)
if (!(mypkt = PKTGET(sd->osh, buflen_u, write ? TRUE : FALSE))) {
#else
if (!(mypkt = PKTGET(sd->osh, buflen_u + DHD_SDALIGN, write ? TRUE : FALSE))) {
#endif /* CONFIG_LGE_BCM432X_PATCH */
#endif /* DHD_USE_STATIC_BUF */
sd_err(("%s: PKTGET failed: len %d\n",
__FUNCTION__, buflen_u));
return SDIOH_API_RC_FAIL;
}
#if defined(CONFIG_LGE_BCM432X_PATCH)
PKTALIGN(osh, mypkt, buflen_u, DHD_SDALIGN);
#endif /* CONFIG_LGE_BCM432X_PATCH */
/* For a write, copy the buffer data into the packet. */
if (write) {
bcopy(buffer, PKTDATA(sd->osh, mypkt), buflen_u);
}
Status = sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */
if (!write) {
bcopy(PKTDATA(sd->osh, mypkt), buffer, buflen_u);
}
#ifdef DHD_USE_STATIC_BUF
PKTFREE_STATIC(sd->osh, mypkt, write ? TRUE : FALSE);
#else
PKTFREE(sd->osh, mypkt, write ? TRUE : FALSE);
#endif /* DHD_USE_STATIC_BUF */
} else if (((uint32)(PKTDATA(sd->osh, pkt)) & DMA_ALIGN_MASK) != 0) {
/* Case 2: We have a packet, but it is unaligned. */
/* In this case, we cannot have a chain. */
ASSERT(PKTNEXT(sd->osh, pkt) == NULL);
sd_data(("%s: Creating aligned %s Packet, len=%d\n",
__FUNCTION__, write ? "TX" : "RX", PKTLEN(sd->osh, pkt)));
#ifdef DHD_USE_STATIC_BUF
#if !defined(CONFIG_LGE_BCM432X_PATCH)
if (!(mypkt = PKTGET_STATIC(sd->osh, PKTLEN(sd->osh, pkt), write ? TRUE : FALSE))) {
#else
if (!(mypkt = PKTGET_STATIC(sd->osh, PKTLEN(sd->osh, pkt) + DHD_SDALIGN, write ? TRUE : FALSE))) {
#endif /* CONFIG_LGE_BCM432X_PATCH */
#else
#if !defined(CONFIG_LGE_BCM432X_PATCH)
if (!(mypkt = PKTGET(sd->osh, PKTLEN(sd->osh, pkt), write ? TRUE : FALSE))) {
#else
if (!(mypkt = PKTGET(sd->osh, PKTLEN(sd->osh, pkt) + DHD_SDALIGN, write ? TRUE : FALSE))) {
#endif
#endif /* DHD_USE_STATIC_BUF */
sd_err(("%s: PKTGET failed: len %d\n",
__FUNCTION__, PKTLEN(sd->osh, pkt)));
return SDIOH_API_RC_FAIL;
}
#if defined(CONFIG_LGE_BCM432X_PATCH)
PKTALIGN(osh, mypkt, PKTLEN(sd->osh, pkt), DHD_SDALIGN);
#endif /* CONFIG_LGE_BCM432X_PATCH */
/* For a write, copy the buffer data into the packet. */
if (write) {
bcopy(PKTDATA(sd->osh, pkt),
PKTDATA(sd->osh, mypkt),
PKTLEN(sd->osh, pkt));
}
Status = sdioh_request_packet(sd, fix_inc, write, func, addr, mypkt);
/* For a read, copy the packet data back to the buffer. */
if (!write) {
bcopy(PKTDATA(sd->osh, mypkt),
PKTDATA(sd->osh, pkt),
PKTLEN(sd->osh, mypkt));
}
#ifdef DHD_USE_STATIC_BUF
PKTFREE_STATIC(sd->osh, mypkt, write ? TRUE : FALSE);
#else
PKTFREE(sd->osh, mypkt, write ? TRUE : FALSE);
#endif /* DHD_USE_STATIC_BUF */
} else { /* case 3: We have a packet and it is aligned. */
sd_data(("%s: Aligned %s Packet, direct DMA\n",
__FUNCTION__, write ? "Tx" : "Rx"));
Status = sdioh_request_packet(sd, fix_inc, write, func, addr, pkt);
}
return (Status);
}
extern int
sdioh_abort(sdioh_info_t *sd, uint func)
{
sd_trace(("%s: Enter\n", __FUNCTION__));
#if defined(MMC_SDIO_ABORT)
/* issue abort cmd52 command through F1 */
sdioh_request_byte(sd, SD_IO_OP_WRITE, SDIO_FUNC_0, SDIOD_CCCR_IOABORT, (uint8 *)&func);
#endif /* defined(MMC_SDIO_ABORT) */
sd_trace(("%s: Exit\n", __FUNCTION__));
return SDIOH_API_RC_SUCCESS;
}
/* Reset and re-initialize the device */
int sdioh_sdio_reset(sdioh_info_t *si)
{
sd_trace(("%s: Enter\n", __FUNCTION__));
sd_trace(("%s: Exit\n", __FUNCTION__));
return SDIOH_API_RC_SUCCESS;
}
/* Disable device interrupt */
void
sdioh_sdmmc_devintr_off(sdioh_info_t *sd)
{
#if defined(CONFIG_LGE_BCM432X_PATCH)
struct mmc_card *card = gInstance->func[0]->card;
struct mmc_host *host = card->host;
host->ops->enable_sdio_irq(host, 0);
#endif /* CONFIG_LGE_BCM432X_PATCH */
sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints));
sd->intmask &= ~CLIENT_INTR;
}
/* Enable device interrupt */
void
sdioh_sdmmc_devintr_on(sdioh_info_t *sd)
{
#if defined(CONFIG_LGE_BCM432X_PATCH)
struct mmc_card *card = gInstance->func[0]->card;
struct mmc_host *host = card->host;
#endif /* CONFIG_LGE_BCM432X_PATCH */
sd_trace(("%s: %d\n", __FUNCTION__, sd->use_client_ints));
sd->intmask |= CLIENT_INTR;
#if defined(CONFIG_LGE_BCM432X_PATCH)
host->ops->enable_sdio_irq(host, 1);
#endif /* CONFIG_LGE_BCM432X_PATCH */
}
/* Read client card reg */
int
sdioh_sdmmc_card_regread(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 *data)
{
if ((func == 0) || (regsize == 1)) {
uint8 temp = 0;
sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
*data = temp;
*data &= 0xff;
sd_data(("%s: byte read data=0x%02x\n",
__FUNCTION__, *data));
} else {
sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, data, regsize);
if (regsize == 2)
*data &= 0xffff;
sd_data(("%s: word read data=0x%08x\n",
__FUNCTION__, *data));
}
return SUCCESS;
}
#if !defined(OOB_INTR_ONLY)
/* bcmsdh_sdmmc interrupt handler */
static void IRQHandler(struct sdio_func *func)
{
sdioh_info_t *sd;
sd_trace(("bcmsdh_sdmmc: ***IRQHandler\n"));
sd = gInstance->sd;
ASSERT(sd != NULL);
sdio_release_host(gInstance->func[0]);
if (sd->use_client_ints) {
sd->intrcount++;
ASSERT(sd->intr_handler);
ASSERT(sd->intr_handler_arg);
(sd->intr_handler)(sd->intr_handler_arg);
} else {
sd_err(("bcmsdh_sdmmc: ***IRQHandler\n"));
sd_err(("%s: Not ready for intr: enabled %d, handler %p\n",
__FUNCTION__, sd->client_intr_enabled, sd->intr_handler));
}
sdio_claim_host(gInstance->func[0]);
}
/* bcmsdh_sdmmc interrupt handler for F2 (dummy handler) */
static void IRQHandlerF2(struct sdio_func *func)
{
sdioh_info_t *sd;
sd_trace(("bcmsdh_sdmmc: ***IRQHandlerF2\n"));
sd = gInstance->sd;
ASSERT(sd != NULL);
}
#endif /* !defined(OOB_INTR_ONLY) */
#ifdef NOTUSED
/* Write client card reg */
static int
sdioh_sdmmc_card_regwrite(sdioh_info_t *sd, int func, uint32 regaddr, int regsize, uint32 data)
{
if ((func == 0) || (regsize == 1)) {
uint8 temp;
temp = data & 0xff;
sdioh_request_byte(sd, SDIOH_READ, func, regaddr, &temp);
sd_data(("%s: byte write data=0x%02x\n",
__FUNCTION__, data));
} else {
if (regsize == 2)
data &= 0xffff;
sdioh_request_word(sd, 0, SDIOH_READ, func, regaddr, &data, regsize);
sd_data(("%s: word write data=0x%08x\n",
__FUNCTION__, data));
}
return SUCCESS;
}
#endif /* NOTUSED */
int
sdioh_start(sdioh_info_t *si, int stage)
{
int ret;
sdioh_info_t *sd = gInstance->sd;
/* Need to do this stages as we can't enable the interrupt till
downloading of the firmware is complete, other wise polling
sdio access will come in way
*/
if (gInstance->func[0]) {
if (stage == 0) {
/* Since the power to the chip is killed, we will have
re enumerate the device again. Set the block size
and enable the fucntion 1 for in preparation for
downloading the code
*/
/* sdio_reset_comm() - has been fixed in latest kernel/msm.git for Linux
2.6.27. The implementation prior to that is buggy, and needs broadcom's
patch for it
*/
if ((ret = sdio_reset_comm(gInstance->func[0]->card)))
sd_err(("%s Failed, error = %d\n", __FUNCTION__, ret));
else {
sd->num_funcs = 2;
sd->sd_blockmode = TRUE;
sd->use_client_ints = TRUE;
sd->client_block_size[0] = 64;
/* Claim host controller */
sdio_claim_host(gInstance->func[1]);
sd->client_block_size[1] = 64;
if (sdio_set_block_size(gInstance->func[1], 64)) {
sd_err(("bcmsdh_sdmmc: Failed to set F1 blocksize\n"));
}
/* Release host controller F1 */
sdio_release_host(gInstance->func[1]);
if (gInstance->func[2]) {
/* Claim host controller F2 */
sdio_claim_host(gInstance->func[2]);
sd->client_block_size[2] = sd_f2_blocksize;
if (sdio_set_block_size(gInstance->func[2],
sd_f2_blocksize)) {
sd_err(("bcmsdh_sdmmc: Failed to set F2 "
"blocksize to %d\n", sd_f2_blocksize));
}
/* Release host controller F2 */
sdio_release_host(gInstance->func[2]);
}
sdioh_sdmmc_card_enablefuncs(sd);
}
} else {
#if !defined(OOB_INTR_ONLY)
sdio_claim_host(gInstance->func[0]);
sdio_claim_irq(gInstance->func[2], IRQHandlerF2);
sdio_claim_irq(gInstance->func[1], IRQHandler);
sdio_release_host(gInstance->func[0]);
#else /* defined(OOB_INTR_ONLY) */
#if defined(HW_OOB)
sdioh_enable_func_intr();
#endif
bcmsdh_oob_intr_set(TRUE);
#endif /* !defined(OOB_INTR_ONLY) */
}
}
else
sd_err(("%s Failed\n", __FUNCTION__));
return (0);
}
int
sdioh_stop(sdioh_info_t *si)
{
/* MSM7201A Android sdio stack has bug with interrupt
So internaly within SDIO stack they are polling
which cause issue when device is turned off. So
unregister interrupt with SDIO stack to stop the
polling
*/
if (gInstance->func[0]) {
#if !defined(OOB_INTR_ONLY)
sdio_claim_host(gInstance->func[0]);
sdio_release_irq(gInstance->func[1]);
sdio_release_irq(gInstance->func[2]);
sdio_release_host(gInstance->func[0]);
#else /* defined(OOB_INTR_ONLY) */
#if defined(HW_OOB)
sdioh_disable_func_intr();
#endif
bcmsdh_oob_intr_set(FALSE);
#endif /* !defined(OOB_INTR_ONLY) */
}
else
sd_err(("%s Failed\n", __FUNCTION__));
return (0);
}
| venkatkamesh/lg_ally_kernel-2.6.XX | drivers/net/wireless/bcm4329/src_239/bcmsdio/sys/bcmsdh_sdmmc.c | C | gpl-2.0 | 36,900 |
---------------------------------------------------------------------------
-- A flexible separator widget.
--
-- By default, this widget display a simple line, but can be extended by themes
-- (or directly) to display much more complex visuals.
--
-- This widget is mainly intended to be used alongside the `spacing_widget`
-- property supported by various layouts such as:
--
-- * `wibox.layout.fixed`
-- * `wibox.layout.flex`
-- * `wibox.layout.ratio`
--
-- When used with these layouts, it is also possible to provide custom clipping
-- functions. This is useful when the layout has overlapping widgets (negative
-- spacing).
--
--@DOC_wibox_widget_defaults_separator_EXAMPLE@
--
-- @author Emmanuel Lepage Vallee <elv1313@gmail.com>
-- @copyright 2014, 2017 Emmanuel Lepage Vallee
-- @widgetmod wibox.widget.separator
---------------------------------------------------------------------------
local beautiful = require( "beautiful" )
local base = require( "wibox.widget.base" )
local color = require( "gears.color" )
local gtable = require( "gears.table" )
local separator = {}
--- The separator's orientation.
--
-- Valid values are:
--
-- * *vertical*: From top to bottom
-- * *horizontal*: From left to right
-- * *auto*: Decide depending on the widget geometry (default)
--
-- The default value is selected automatically. If the widget is taller than
-- large, it will use vertical and vice versa.
--
--@DOC_wibox_widget_separator_orientation_EXAMPLE@
--
-- @property orientation
-- @tparam string orientation
-- @propemits true false
--- The separator's thickness.
--
-- This is used by the default line separator, but ignored when a shape is used.
--
-- @property thickness
-- @tparam number thickness
-- @propbeautiful
-- @propemits true false
--- The separator's shape.
--
--@DOC_wibox_widget_separator_shape_EXAMPLE@
--
-- @property shape
-- @tparam function shape A valid shape function
-- @propbeautiful
-- @propemits true false
-- @see gears.shape
--- The relative percentage covered by the bar.
--
-- @property span_ratio
-- @tparam[opt=1] number A number between 0 and 1.
-- @propbeautiful
-- @propemits true false
--- The separator's color.
-- @property color
-- @tparam color color
-- @propbeautiful
-- @propemits true false
-- @see gears.color
--- The separator's border color.
--
--@DOC_wibox_widget_separator_border_color_EXAMPLE@
--
-- @property border_color
-- @tparam color border_color
-- @propbeautiful
-- @propemits true false
-- @see gears.color
--- The separator's border width.
-- @property border_width
-- @tparam number border_width
-- @propbeautiful
-- @propemits true false
--- The separator thickness.
-- @beautiful beautiful.separator_thickness
-- @param number
-- @see thickness
--- The separator border color.
-- @beautiful beautiful.separator_border_color
-- @param color
-- @see border_color
--- The separator border width.
-- @beautiful beautiful.separator_border_width
-- @param number
-- @see border_width
--- The relative percentage covered by the bar.
-- @beautiful beautiful.separator_span_ratio
-- @tparam[opt=1] number A number between 0 and 1.
--- The separator's color.
-- @beautiful beautiful.separator_color
-- @param string
-- @see gears.color
--- The separator's shape.
--
-- @beautiful beautiful.separator_shape
-- @tparam function shape A valid shape function
-- @see gears.shape
local function draw_shape(self, _, cr, width, height, shape)
local bw = self._private.border_width or beautiful.separator_border_width or 0
local bc = self._private.border_color or beautiful.separator_border_color
cr:translate(bw/2, bw/2)
shape(cr, width-bw, height-bw)
if bw == 0 then
cr:fill()
elseif bc then
cr:fill_preserve()
cr:set_source(color(bc))
cr:set_line_width(bw)
cr:stroke()
end
end
local function draw_line(self, _, cr, width, height)
local thickness = self._private.thickness or beautiful.separator_thickness or 1
local orientation = self._private.orientation ~= "auto" and
self._private.orientation or (width > height and "horizontal" or "vertical")
local span_ratio = self.span_ratio or 1
if orientation == "horizontal" then
local w = width*span_ratio
cr:rectangle((width-w)/2, height/2 - thickness/2, w, thickness)
else
local h = height*span_ratio
cr:rectangle(width/2 - thickness/2, (height-h)/2, thickness, h)
end
cr:fill()
end
local function draw(self, _, cr, width, height)
-- In case there is a specialized.
local draw_custom = self._private.draw or beautiful.separator_draw
if draw_custom then
return draw_custom(self, _, cr, width, height)
end
local col = self._private.color or beautiful.separator_color
if col then
cr:set_source(color(col))
end
local s = self._private.shape or beautiful.separator_shape
if s then
draw_shape(self, _, cr, width, height, s)
else
draw_line(self, _, cr, width, height)
end
end
local function fit(_, _, width, height)
return width, height
end
for _, prop in ipairs {"orientation", "color", "thickness", "span_ratio",
"border_width", "border_color", "shape" } do
separator["set_"..prop] = function(self, value)
self._private[prop] = value
self:emit_signal("property::"..prop, value)
self:emit_signal("widget::redraw_needed")
end
separator["get_"..prop] = function(self)
return self._private[prop] or beautiful["separator_"..prop]
end
end
--- Create a new separator.
-- @constructorfct wibox.widget.separator
-- @tparam table args The arguments (all properties are available).
local function new(args)
local ret = base.make_widget(nil, nil, {
enable_properties = true,
})
gtable.crush(ret, separator, true)
gtable.crush(ret, args or {})
ret._private.orientation = ret._private.orientation or "auto"
rawset(ret, "fit" , fit )
rawset(ret, "draw", draw)
return ret
end
--@DOC_widget_COMMON@
--@DOC_object_COMMON@
return setmetatable(separator, { __call = function(_, ...) return new(...) end })
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80
| petoju/awesome | lib/wibox/widget/separator.lua | Lua | gpl-2.0 | 6,268 |
package android.support.v4.p004h;
import android.view.View;
import java.util.WeakHashMap;
/* renamed from: android.support.v4.h.ca */
class ca extends by {
static boolean f445b;
static {
f445b = false;
}
ca() {
}
public void m1096a(View view, C0147a c0147a) {
cl.m1154a(view, c0147a == null ? null : c0147a.m826a());
}
public boolean m1097a(View view, int i) {
return cl.m1155a(view, i);
}
public dh m1098j(View view) {
if (this.a == null) {
this.a = new WeakHashMap();
}
dh dhVar = (dh) this.a.get(view);
if (dhVar != null) {
return dhVar;
}
dhVar = new dh(view);
this.a.put(view, dhVar);
return dhVar;
}
}
| Qwaz/solved-hacking-problem | holyshield/2016/mobile_sound_meter/source_refactored/android/support/v4/p004h/ca.java | Java | gpl-2.0 | 771 |
// Copyright (c) 2002 Rob Kaper <cap@capsi.com>
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License version 2.1 as published by the Free Software Foundation.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser 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.
// WARNING: this codebase is not being used yet. Please use AtlantikNetwork
// until the protocol seperation has been completed.
#ifndef MONOPDPROTOCOL_H_H
#define MONOPDPROTOCOL_H_H
#include <qobject.h>
class QString;
/*
class AtlanticCore;
class Player;
class EstateGroup;
class Trade;
class Auction;
*/
class Estate;
class MonopdProtocol : public QObject
{
Q_OBJECT
public:
MonopdProtocol();
private slots:
void auctionEstate();
void buyEstate();
void confirmTokenLocation(Estate *estate);
void endTurn();
void rollDice();
void setName(QString name);
void startGame();
private:
virtual void sendData(QString data);
};
#endif
| serghei/kde3-kdegames | atlantik/libatlantikclient/monopdprotocol.h | C | gpl-2.0 | 1,406 |
import scipy.io.wavfile
from os.path import expanduser
import os
import array
from pylab import *
import scipy.signal
import scipy
import wave
import numpy as np
import time
import sys
import math
import matplotlib
import subprocess
# Author: Brian K. Vogel
# brian.vogel@gmail.com
fft_size = 2048
iterations = 300
hopsamp = fft_size // 8
def ensure_audio():
if not os.path.exists("audio"):
print("Downloading audio dataset...")
subprocess.check_output(
"curl -SL https://storage.googleapis.com/wandb/audio.tar.gz | tar xz", shell=True)
def griffin_lim(stft, scale):
# Undo the rescaling.
stft_modified_scaled = stft / scale
stft_modified_scaled = stft_modified_scaled**0.5
# Use the Griffin&Lim algorithm to reconstruct an audio signal from the
# magnitude spectrogram.
x_reconstruct = reconstruct_signal_griffin_lim(stft_modified_scaled,
fft_size, hopsamp,
iterations)
# The output signal must be in the range [-1, 1], otherwise we need to clip or normalize.
max_sample = np.max(abs(x_reconstruct))
if max_sample > 1.0:
x_reconstruct = x_reconstruct / max_sample
return x_reconstruct
def hz_to_mel(f_hz):
"""Convert Hz to mel scale.
This uses the formula from O'Shaugnessy's book.
Args:
f_hz (float): The value in Hz.
Returns:
The value in mels.
"""
return 2595*np.log10(1.0 + f_hz/700.0)
def mel_to_hz(m_mel):
"""Convert mel scale to Hz.
This uses the formula from O'Shaugnessy's book.
Args:
m_mel (float): The value in mels
Returns:
The value in Hz
"""
return 700*(10**(m_mel/2595) - 1.0)
def fft_bin_to_hz(n_bin, sample_rate_hz, fft_size):
"""Convert FFT bin index to frequency in Hz.
Args:
n_bin (int or float): The FFT bin index.
sample_rate_hz (int or float): The sample rate in Hz.
fft_size (int or float): The FFT size.
Returns:
The value in Hz.
"""
n_bin = float(n_bin)
sample_rate_hz = float(sample_rate_hz)
fft_size = float(fft_size)
return n_bin*sample_rate_hz/(2.0*fft_size)
def hz_to_fft_bin(f_hz, sample_rate_hz, fft_size):
"""Convert frequency in Hz to FFT bin index.
Args:
f_hz (int or float): The frequency in Hz.
sample_rate_hz (int or float): The sample rate in Hz.
fft_size (int or float): The FFT size.
Returns:
The FFT bin index as an int.
"""
f_hz = float(f_hz)
sample_rate_hz = float(sample_rate_hz)
fft_size = float(fft_size)
fft_bin = int(np.round((f_hz*2.0*fft_size/sample_rate_hz)))
if fft_bin >= fft_size:
fft_bin = fft_size-1
return fft_bin
def make_mel_filterbank(min_freq_hz, max_freq_hz, mel_bin_count,
linear_bin_count, sample_rate_hz):
"""Create a mel filterbank matrix.
Create and return a mel filterbank matrix `filterbank` of shape (`mel_bin_count`,
`linear_bin_couont`). The `filterbank` matrix can be used to transform a
(linear scale) spectrum or spectrogram into a mel scale spectrum or
spectrogram as follows:
`mel_scale_spectrum` = `filterbank`*'linear_scale_spectrum'
where linear_scale_spectrum' is a shape (`linear_bin_count`, `m`) and
`mel_scale_spectrum` is shape ('mel_bin_count', `m`) where `m` is the number
of spectral time slices.
Likewise, the reverse-direction transform can be performed as:
'linear_scale_spectrum' = filterbank.T`*`mel_scale_spectrum`
Note that the process of converting to mel scale and then back to linear
scale is lossy.
This function computes the mel-spaced filters such that each filter is triangular
(in linear frequency) with response 1 at the center frequency and decreases linearly
to 0 upon reaching an adjacent filter's center frequency. Note that any two adjacent
filters will overlap having a response of 0.5 at the mean frequency of their
respective center frequencies.
Args:
min_freq_hz (float): The frequency in Hz corresponding to the lowest
mel scale bin.
max_freq_hz (flloat): The frequency in Hz corresponding to the highest
mel scale bin.
mel_bin_count (int): The number of mel scale bins.
linear_bin_count (int): The number of linear scale (fft) bins.
sample_rate_hz (float): The sample rate in Hz.
Returns:
The mel filterbank matrix as an 2-dim Numpy array.
"""
min_mels = hz_to_mel(min_freq_hz)
max_mels = hz_to_mel(max_freq_hz)
# Create mel_bin_count linearly spaced values between these extreme mel values.
mel_lin_spaced = np.linspace(min_mels, max_mels, num=mel_bin_count)
# Map each of these mel values back into linear frequency (Hz).
center_frequencies_hz = np.array([mel_to_hz(n) for n in mel_lin_spaced])
mels_per_bin = float(max_mels - min_mels)/float(mel_bin_count - 1)
mels_start = min_mels - mels_per_bin
hz_start = mel_to_hz(mels_start)
fft_bin_start = hz_to_fft_bin(hz_start, sample_rate_hz, linear_bin_count)
#print('fft_bin_start: ', fft_bin_start)
mels_end = max_mels + mels_per_bin
hz_stop = mel_to_hz(mels_end)
fft_bin_stop = hz_to_fft_bin(hz_stop, sample_rate_hz, linear_bin_count)
#print('fft_bin_stop: ', fft_bin_stop)
# Map each center frequency to the closest fft bin index.
linear_bin_indices = np.array([hz_to_fft_bin(
f_hz, sample_rate_hz, linear_bin_count) for f_hz in center_frequencies_hz])
# Create filterbank matrix.
filterbank = np.zeros((mel_bin_count, linear_bin_count))
for mel_bin in range(mel_bin_count):
center_freq_linear_bin = int(linear_bin_indices[mel_bin].item())
# Create a triangular filter having the current center freq.
# The filter will start with 0 response at left_bin (if it exists)
# and ramp up to 1.0 at center_freq_linear_bin, and then ramp
# back down to 0 response at right_bin (if it exists).
# Create the left side of the triangular filter that ramps up
# from 0 to a response of 1 at the center frequency.
if center_freq_linear_bin > 1:
# It is possible to create the left triangular filter.
if mel_bin == 0:
# Since this is the first center frequency, the left side
# must start ramping up from linear bin 0 or 1 mel bin before the center freq.
left_bin = max(0, fft_bin_start)
else:
# Start ramping up from the previous center frequency bin.
left_bin = int(linear_bin_indices[mel_bin - 1].item())
for f_bin in range(left_bin, center_freq_linear_bin+1):
if (center_freq_linear_bin - left_bin) > 0:
response = float(f_bin - left_bin) / \
float(center_freq_linear_bin - left_bin)
filterbank[mel_bin, f_bin] = response
# Create the right side of the triangular filter that ramps down
# from 1 to 0.
if center_freq_linear_bin < linear_bin_count-2:
# It is possible to create the right triangular filter.
if mel_bin == mel_bin_count - 1:
# Since this is the last mel bin, we must ramp down to response of 0
# at the last linear freq bin.
right_bin = min(linear_bin_count - 1, fft_bin_stop)
else:
right_bin = int(linear_bin_indices[mel_bin + 1].item())
for f_bin in range(center_freq_linear_bin, right_bin+1):
if (right_bin - center_freq_linear_bin) > 0:
response = float(right_bin - f_bin) / \
float(right_bin - center_freq_linear_bin)
filterbank[mel_bin, f_bin] = response
filterbank[mel_bin, center_freq_linear_bin] = 1.0
return filterbank
def stft_for_reconstruction(x, fft_size, hopsamp):
"""Compute and return the STFT of the supplied time domain signal x.
Args:
x (1-dim Numpy array): A time domain signal.
fft_size (int): FFT size. Should be a power of 2, otherwise DFT will be used.
hopsamp (int):
Returns:
The STFT. The rows are the time slices and columns are the frequency bins.
"""
window = np.hanning(fft_size)
fft_size = int(fft_size)
hopsamp = int(hopsamp)
return np.array([np.fft.rfft(window*x[i:i+fft_size])
for i in range(0, len(x)-fft_size, hopsamp)])
def istft_for_reconstruction(X, fft_size, hopsamp):
"""Invert a STFT into a time domain signal.
Args:
X (2-dim Numpy array): Input spectrogram. The rows are the time slices and columns are the frequency bins.
fft_size (int):
hopsamp (int): The hop size, in samples.
Returns:
The inverse STFT.
"""
fft_size = int(fft_size)
hopsamp = int(hopsamp)
window = np.hanning(fft_size)
time_slices = X.shape[0]
len_samples = int(time_slices*hopsamp + fft_size)
x = np.zeros(len_samples)
for n, i in enumerate(range(0, len(x)-fft_size, hopsamp)):
x[i:i+fft_size] += window*np.real(np.fft.irfft(X[n]))
return x
def get_signal(in_file, expected_fs=44100):
"""Load a wav file.
If the file contains more than one channel, return a mono file by taking
the mean of all channels.
If the sample rate differs from the expected sample rate (default is 44100 Hz),
raise an exception.
Args:
in_file: The input wav file, which should have a sample rate of `expected_fs`.
expected_fs (int): The expected sample rate of the input wav file.
Returns:
The audio siganl as a 1-dim Numpy array. The values will be in the range [-1.0, 1.0]. fixme ( not yet)
"""
fs, y = scipy.io.wavfile.read(in_file)
num_type = y[0].dtype
if num_type == 'int16':
y = y*(1.0/32768)
elif num_type == 'int32':
y = y*(1.0/2147483648)
elif num_type == 'float32':
# Nothing to do
pass
elif num_type == 'uint8':
raise Exception('8-bit PCM is not supported.')
else:
raise Exception('Unknown format.')
if fs != expected_fs:
raise Exception('Invalid sample rate.')
if y.ndim == 1:
return y
else:
return y.mean(axis=1)
def reconstruct_signal_griffin_lim(magnitude_spectrogram, fft_size, hopsamp, iterations):
"""Reconstruct an audio signal from a magnitude spectrogram.
Given a magnitude spectrogram as input, reconstruct
the audio signal and return it using the Griffin-Lim algorithm from the paper:
"Signal estimation from modified short-time fourier transform" by Griffin and Lim,
in IEEE transactions on Acoustics, Speech, and Signal Processing. Vol ASSP-32, No. 2, April 1984.
Args:
magnitude_spectrogram (2-dim Numpy array): The magnitude spectrogram. The rows correspond to the time slices
and the columns correspond to frequency bins.
fft_size (int): The FFT size, which should be a power of 2.
hopsamp (int): The hope size in samples.
iterations (int): Number of iterations for the Griffin-Lim algorithm. Typically a few hundred
is sufficient.
Returns:
The reconstructed time domain signal as a 1-dim Numpy array.
"""
time_slices = magnitude_spectrogram.shape[0]
len_samples = int(time_slices*hopsamp + fft_size)
# Initialize the reconstructed signal to noise.
x_reconstruct = np.random.randn(len_samples)
n = iterations # number of iterations of Griffin-Lim algorithm.
while n > 0:
n -= 1
reconstruction_spectrogram = stft_for_reconstruction(
x_reconstruct, fft_size, hopsamp)
reconstruction_angle = np.angle(reconstruction_spectrogram)
# Discard magnitude part of the reconstruction and use the supplied magnitude spectrogram instead.
proposal_spectrogram = magnitude_spectrogram * \
np.exp(1.0j*reconstruction_angle)
prev_x = x_reconstruct
x_reconstruct = istft_for_reconstruction(
proposal_spectrogram, fft_size, hopsamp)
diff = sqrt(sum((x_reconstruct - prev_x)**2)/x_reconstruct.size)
#print('Reconstruction iteration: {}/{} RMSE: {} '.format(iterations - n, iterations, diff))
return x_reconstruct
def save_audio_to_file(x, sample_rate, outfile='out.wav'):
"""Save a mono signal to a file.
Args:
x (1-dim Numpy array): The audio signal to save. The signal values should be in the range [-1.0, 1.0].
sample_rate (int): The sample rate of the signal, in Hz.
outfile: Name of the file to save.
"""
x_max = np.max(abs(x))
assert x_max <= 1.0, 'Input audio value is out of range. Should be in the range [-1.0, 1.0].'
x = x*32767.0
data = array.array('h')
for i in range(len(x)):
cur_samp = int(round(x[i]))
data.append(cur_samp)
f = wave.open(outfile, 'w')
f.setparams((1, 2, sample_rate, 0, "NONE", "Uncompressed"))
f.writeframes(data.tostring())
f.close()
| lukas/ml-class | examples/keras-audio/audio_utilities.py | Python | gpl-2.0 | 13,234 |
<?php
/******************************************************************************/
// //
// InstantCMS v1.10 //
// http://www.instantcms.ru/ //
// //
// written by InstantCMS Team, 2007-2012 //
// produced by InstantSoft, (www.instantsoft.ru) //
// //
// LICENSED BY GNU/GPL v2 //
// //
/******************************************************************************/
function routes_board(){
$routes[] = array(
'_uri' => '/^board\/([0-9]+)$/i',
1 => 'category_id'
);
$routes[] = array(
'_uri' => '/^board\/([0-9]+)\/type\/(.+)$/i',
1 => 'category_id',
2 => 'obtype'
);
$routes[] = array(
'_uri' => '/^board\/type\/(.+)$/i',
1 => 'obtype'
);
$routes[] = array(
'_uri' => '/^board\/([0-9]+)\-([0-9]+)$/i',
1 => 'category_id',
2 => 'page'
);
$routes[] = array(
'_uri' => '/^board\/([0-9]+)\/add.html$/i',
'do' => 'additem',
1 => 'category_id'
);
$routes[] = array(
'_uri' => '/^board\/add.html$/i',
'do' => 'additem'
);
$routes[] = array(
'_uri' => '/^board\/edit([0-9]+).html$/i',
'do' => 'edititem',
1 => 'id'
);
$routes[] = array(
'_uri' => '/^board\/delete([0-9]+).html$/i',
'do' => 'delete',
1 => 'id'
);
$routes[] = array(
'_uri' => '/^board\/publish([0-9]+).html$/i',
'do' => 'publish',
1 => 'id'
);
$routes[] = array(
'_uri' => '/^board\/read([0-9]+).html$/i',
'do' => 'read',
1 => 'id'
);
$routes[] = array(
'_uri' => '/^board\/city\/(.+)$/i',
1 => 'city'
);
$routes[] = array(
'_uri' => '/^board\/by_user_([a-zA-z0-9\.]+)$/i',
'do' => 'by_user',
1 => 'login'
);
$routes[] = array(
'_uri' => '/^board\/by_user_([a-zA-z0-9\.]+)\/page\-([0-9]+)$/i',
'do' => 'by_user',
1 => 'login',
2 => 'page'
);
return $routes;
}
?>
| pgena/instance-portal | components/board/router.php | PHP | gpl-2.0 | 3,769 |
/**
* @file sipe-http-request.c
*
* pidgin-sipe
*
* Copyright (C) 2013 SIPE Project <http://sipe.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
*
*
* SIPE HTTP request layer implementation
*
* - request handling: creation, parameters, deletion, cancelling
* - session handling: creation, closing
* - client authorization handling
* - connection request queue handling
* - compile HTTP header contents and hand-off to transport layer
* - process HTTP response and hand-off to user callback
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <string.h>
#include <glib.h>
#include "sipmsg.h"
#include "sip-sec.h"
#include "sipe-backend.h"
#include "sipe-core.h"
#include "sipe-core-private.h"
#include "sipe-http.h"
#define _SIPE_HTTP_PRIVATE_IF_REQUEST
#include "sipe-http-request.h"
#define _SIPE_HTTP_PRIVATE_IF_TRANSPORT
#include "sipe-http-transport.h"
struct sipe_http_session {
gchar *cookie; /* extremely simplistic cookie jar :-) */
};
struct sipe_http_request {
struct sipe_http_connection_public *connection;
struct sipe_http_session *session;
gchar *path;
gchar *headers;
gchar *body; /* NULL for GET */
gchar *content_type; /* NULL if body == NULL */
gchar *authorization;
const gchar *domain; /* not copied */
const gchar *user; /* not copied */
const gchar *password; /* not copied */
sipe_http_response_callback *cb;
gpointer cb_data;
guint32 flags;
};
#define SIPE_HTTP_REQUEST_FLAG_FIRST 0x00000001
#define SIPE_HTTP_REQUEST_FLAG_REDIRECT 0x00000002
#define SIPE_HTTP_REQUEST_FLAG_AUTHDATA 0x00000004
static void sipe_http_request_free(struct sipe_core_private *sipe_private,
struct sipe_http_request *req,
guint status)
{
if (req->cb)
/* Callback: aborted/failed/cancelled */
(*req->cb)(sipe_private,
status,
NULL,
NULL,
req->cb_data);
g_free(req->path);
g_free(req->headers);
g_free(req->body);
g_free(req->content_type);
g_free(req->authorization);
g_free(req);
}
static void sipe_http_request_send(struct sipe_http_connection_public *conn_public)
{
struct sipe_http_request *req = conn_public->pending_requests->data;
gchar *header;
gchar *content = NULL;
gchar *cookie = NULL;
if (req->body)
content = g_strdup_printf("Content-Length: %" G_GSIZE_FORMAT "\r\n"
"Content-Type: %s\r\n",
strlen(req->body),
req->content_type);
if (req->session && req->session->cookie)
cookie = g_strdup_printf("Cookie: %s\r\n", req->session->cookie);
header = g_strdup_printf("%s /%s HTTP/1.1\r\n"
"Host: %s\r\n"
"User-Agent: Sipe/" PACKAGE_VERSION "\r\n"
"%s%s%s%s",
content ? "POST" : "GET",
req->path,
conn_public->host,
conn_public->cached_authorization ? conn_public->cached_authorization :
req->authorization ? req->authorization : "",
req->headers ? req->headers : "",
cookie ? cookie : "",
content ? content : "");
g_free(cookie);
g_free(content);
/* only use authorization once */
g_free(req->authorization);
req->authorization = NULL;
sipe_http_transport_send(conn_public,
header,
req->body);
g_free(header);
}
gboolean sipe_http_request_pending(struct sipe_http_connection_public *conn_public)
{
return(conn_public->pending_requests != NULL);
}
void sipe_http_request_next(struct sipe_http_connection_public *conn_public)
{
sipe_http_request_send(conn_public);
}
static void sipe_http_request_enqueue(struct sipe_core_private *sipe_private,
struct sipe_http_request *req,
const struct sipe_http_parsed_uri *parsed_uri)
{
struct sipe_http_connection_public *conn_public;
req->path = g_strdup(parsed_uri->path);
req->connection = conn_public = sipe_http_transport_new(sipe_private,
parsed_uri->host,
parsed_uri->port,
parsed_uri->tls);
if (!sipe_http_request_pending(conn_public))
req->flags |= SIPE_HTTP_REQUEST_FLAG_FIRST;
conn_public->pending_requests = g_slist_append(conn_public->pending_requests,
req);
}
/* TRUE indicates failure */
static gboolean sipe_http_request_response_redirection(struct sipe_core_private *sipe_private,
struct sipe_http_request *req,
struct sipmsg *msg)
{
const gchar *location = sipmsg_find_header(msg, "Location");
gboolean failed = TRUE;
if (location) {
struct sipe_http_parsed_uri *parsed_uri = sipe_http_parse_uri(location);
if (parsed_uri) {
/* remove request from old connection */
struct sipe_http_connection_public *conn_public = req->connection;
conn_public->pending_requests = g_slist_remove(conn_public->pending_requests,
req);
/* free old request data */
g_free(req->path);
req->flags &= ~SIPE_HTTP_REQUEST_FLAG_FIRST;
/* resubmit request on other connection */
sipe_http_request_enqueue(sipe_private, req, parsed_uri);
failed = FALSE;
sipe_http_parsed_uri_free(parsed_uri);
} else
SIPE_DEBUG_INFO("sipe_http_request_response_redirection: invalid redirection to '%s'",
location);
} else
SIPE_DEBUG_INFO_NOFORMAT("sipe_http_request_response_redirection: no URL found?!?");
return(failed);
}
/* TRUE indicates failure */
static gboolean sipe_http_request_response_unauthorized(struct sipe_core_private *sipe_private,
struct sipe_http_request *req,
struct sipmsg *msg)
{
const gchar *header = NULL;
const gchar *name;
guint type;
gboolean failed = TRUE;
#if defined(HAVE_LIBKRB5) || defined(HAVE_SSPI)
#define DEBUG_STRING ", NTLM and Negotiate"
/* Use "Negotiate" unless the user requested "NTLM" */
if (sipe_private->authentication_type != SIPE_AUTHENTICATION_TYPE_NTLM)
header = sipmsg_find_auth_header(msg, "Negotiate");
if (header) {
type = SIPE_AUTHENTICATION_TYPE_NEGOTIATE;
name = "Negotiate";
} else
#else
#define DEBUG_STRING " and NTLM"
(void) sipe_private; /* keep compiler happy */
#endif
{
header = sipmsg_find_auth_header(msg, "NTLM");
type = SIPE_AUTHENTICATION_TYPE_NTLM;
name = "NTLM";
}
/* only fall back to "Basic" after everything else fails */
if (!header) {
header = sipmsg_find_auth_header(msg, "Basic");
type = SIPE_AUTHENTICATION_TYPE_BASIC;
name = "Basic";
}
if (header) {
struct sipe_http_connection_public *conn_public = req->connection;
if (!conn_public->context) {
gboolean valid = req->flags & SIPE_HTTP_REQUEST_FLAG_AUTHDATA;
conn_public->context = sip_sec_create_context(type,
!valid, /* Single Sign-On flag */
TRUE, /* connection-based for HTTP */
valid ? req->domain : NULL,
valid ? req->user : NULL,
valid ? req->password : NULL);
}
if (conn_public->context) {
gchar **parts = g_strsplit(header, " ", 0);
gchar *spn = g_strdup_printf("HTTP/%s", conn_public->host);
gchar *token;
SIPE_DEBUG_INFO("sipe_http_request_response_unauthorized: init context target '%s' token '%s'",
spn, parts[1] ? parts[1] : "<NULL>");
if (sip_sec_init_context_step(conn_public->context,
spn,
parts[1],
&token,
NULL)) {
/* generate authorization header */
req->authorization = g_strdup_printf("Authorization: %s %s\r\n",
name,
token ? token : "");
g_free(token);
/*
* authorization never changes for Basic
* authentication scheme, so we can keep it.
*/
if (type == SIPE_AUTHENTICATION_TYPE_BASIC) {
g_free(conn_public->cached_authorization);
conn_public->cached_authorization = g_strdup(req->authorization);
}
/*
* Keep the request in the queue. As it is at
* the head it will be pulled automatically
* by the transport layer after returning.
*/
failed = FALSE;
} else
SIPE_DEBUG_INFO_NOFORMAT("sipe_http_request_response_unauthorized: security context init step failed");
g_free(spn);
g_strfreev(parts);
} else
SIPE_DEBUG_INFO_NOFORMAT("sipe_http_request_response_unauthorized: security context creation failed");
} else
SIPE_DEBUG_INFO_NOFORMAT("sipe_http_request_response_unauthorized: only Basic" DEBUG_STRING " authentication schemes are supported");
return(failed);
}
static void sipe_http_request_response_callback(struct sipe_core_private *sipe_private,
struct sipe_http_request *req,
struct sipmsg *msg)
{
const gchar *hdr;
/* Set-Cookie: RMID=732423sdfs73242; expires=Fri, 31-Dec-2010 23:59:59 GMT; path=/; domain=.example.net */
if (req->session &&
((hdr = sipmsg_find_header(msg, "Set-Cookie")) != NULL)) {
gchar **parts, **current;
const gchar *part;
gchar *new = NULL;
g_free(req->session->cookie);
req->session->cookie = NULL;
current = parts = g_strsplit(hdr, ";", 0);
while ((part = *current++) != NULL) {
/* strip these parts from cookie */
if (!(strstr(part, "path=") ||
strstr(part, "domain=") ||
strstr(part, "expires=") ||
strstr(part, "secure"))) {
gchar *tmp = new;
new = new ?
g_strconcat(new, ";", part, NULL) :
g_strdup(part);
g_free(tmp);
}
}
g_strfreev(parts);
if (new) {
req->session->cookie = new;
SIPE_DEBUG_INFO("sipe_http_request_response_callback: cookie: %s", new);
}
}
/* Callback: success */
(*req->cb)(sipe_private,
msg->response,
msg->headers,
msg->body,
req->cb_data);
/* remove completed request */
sipe_http_request_cancel(req);
}
void sipe_http_request_response(struct sipe_http_connection_public *conn_public,
struct sipmsg *msg)
{
struct sipe_core_private *sipe_private = conn_public->sipe_private;
struct sipe_http_request *req = conn_public->pending_requests->data;
gboolean failed;
if ((req->flags & SIPE_HTTP_REQUEST_FLAG_REDIRECT) &&
(msg->response >= SIPE_HTTP_STATUS_REDIRECTION) &&
(msg->response < SIPE_HTTP_STATUS_CLIENT_ERROR)) {
failed = sipe_http_request_response_redirection(sipe_private,
req,
msg);
} else if (msg->response == SIPE_HTTP_STATUS_CLIENT_UNAUTHORIZED) {
failed = sipe_http_request_response_unauthorized(sipe_private,
req,
msg);
} else {
/* On some errors throw away the security context */
if (((msg->response == SIPE_HTTP_STATUS_CLIENT_FORBIDDEN) ||
(msg->response == SIPE_HTTP_STATUS_CLIENT_PROXY_AUTH) ||
(msg->response >= SIPE_HTTP_STATUS_SERVER_ERROR)) &&
conn_public->context) {
SIPE_DEBUG_INFO("sipe_http_request_response: response was %d, throwing away security context",
msg->response);
g_free(conn_public->cached_authorization);
conn_public->cached_authorization = NULL;
sip_sec_destroy_context(conn_public->context);
conn_public->context = NULL;
}
/* All other cases are passed on to the user */
sipe_http_request_response_callback(sipe_private, req, msg);
/* req is no longer valid */
failed = FALSE;
}
if (failed) {
/* Callback: request failed */
(*req->cb)(sipe_private,
SIPE_HTTP_STATUS_FAILED,
NULL,
NULL,
req->cb_data);
/* remove failed request */
sipe_http_request_cancel(req);
}
}
void sipe_http_request_shutdown(struct sipe_http_connection_public *conn_public,
gboolean abort)
{
if (conn_public->pending_requests) {
GSList *entry = conn_public->pending_requests;
while (entry) {
sipe_http_request_free(conn_public->sipe_private,
entry->data,
abort ?
SIPE_HTTP_STATUS_ABORTED :
SIPE_HTTP_STATUS_FAILED);
entry = entry->next;
}
g_slist_free(conn_public->pending_requests);
conn_public->pending_requests = NULL;
}
if (conn_public->context) {
g_free(conn_public->cached_authorization);
conn_public->cached_authorization = NULL;
sip_sec_destroy_context(conn_public->context);
conn_public->context = NULL;
}
}
struct sipe_http_request *sipe_http_request_new(struct sipe_core_private *sipe_private,
const struct sipe_http_parsed_uri *parsed_uri,
const gchar *headers,
const gchar *body,
const gchar *content_type,
sipe_http_response_callback *callback,
gpointer callback_data)
{
struct sipe_http_request *req;
if (!parsed_uri)
return(NULL);
if (sipe_http_shutting_down(sipe_private)) {
SIPE_DEBUG_ERROR("sipe_http_request_new: new HTTP request during shutdown: THIS SHOULD NOT HAPPEN! Debugging information:\n"
"Host: %s\n"
"Port: %d\n"
"Path: %s\n"
"Headers: %s\n"
"Body: %s\n",
parsed_uri->host,
parsed_uri->port,
parsed_uri->path,
headers ? headers : "<NONE>",
body ? body : "<EMPTY>");
return(NULL);
}
req = g_new0(struct sipe_http_request, 1);
req->flags = 0;
req->cb = callback;
req->cb_data = callback_data;
if (headers)
req->headers = g_strdup(headers);
if (body) {
req->body = g_strdup(body);
req->content_type = g_strdup(content_type);
}
/* default authentication */
if (!SIPE_CORE_PRIVATE_FLAG_IS(SSO))
sipe_http_request_authentication(req,
sipe_private->authdomain,
sipe_private->authuser,
sipe_private->password);
sipe_http_request_enqueue(sipe_private, req, parsed_uri);
return(req);
}
void sipe_http_request_ready(struct sipe_http_request *request)
{
struct sipe_http_connection_public *conn_public = request->connection;
/* pass first request on already opened connection through directly */
if ((request->flags & SIPE_HTTP_REQUEST_FLAG_FIRST) &&
conn_public->connected)
sipe_http_request_send(conn_public);
}
struct sipe_http_session *sipe_http_session_start(void)
{
return(g_new0(struct sipe_http_session, 1));
}
void sipe_http_session_close(struct sipe_http_session *session)
{
if (session) {
g_free(session->cookie);
g_free(session);
}
}
void sipe_http_request_cancel(struct sipe_http_request *request)
{
struct sipe_http_connection_public *conn_public = request->connection;
conn_public->pending_requests = g_slist_remove(conn_public->pending_requests,
request);
/* cancelled by requester, don't use callback */
request->cb = NULL;
sipe_http_request_free(conn_public->sipe_private,
request,
SIPE_HTTP_STATUS_CANCELLED);
}
void sipe_http_request_session(struct sipe_http_request *request,
struct sipe_http_session *session)
{
request->session = session;
}
void sipe_http_request_allow_redirect(struct sipe_http_request *request)
{
request->flags |= SIPE_HTTP_REQUEST_FLAG_REDIRECT;
}
void sipe_http_request_authentication(struct sipe_http_request *request,
const gchar *domain,
const gchar *user,
const gchar *password)
{
request->flags |= SIPE_HTTP_REQUEST_FLAG_AUTHDATA;
request->domain = domain;
request->user = user;
request->password = password;
}
/*
Local Variables:
mode: c
c-file-style: "bsd"
indent-tabs-mode: t
tab-width: 8
End:
*/
| stan3/debian-pidgin-sipe | src/core/sipe-http-request.c | C | gpl-2.0 | 15,575 |
#include<stdio.h>
int main(){
int i,k,n,j;
k=0;
do {
k=k+1;
} while (k<=19);
if (k=19); {
do {
k=k+2;
if (k%3==0 && k%7==0){
printf("%d\n",k);}
} while (k<=30000); }
return 0;
}
| EvtimPavlov/c-programming-2014-2015-homework | B/17_lubomir/homework_3/task_5.c | C | gpl-2.0 | 213 |
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<title>Zen 7.x-6.x Style Guide</title>
<meta name="description" content="">
<meta name="generator" content="kss-node">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="kss-assets/kss.css">
<link rel="stylesheet" href="../css/styles.css">
<link rel="stylesheet" href="../css/style-guide/chroma-kss-styles.css">
<link rel="stylesheet" href="../css/style-guide/kss-only.css">
</head>
<body id="kss-node" class="kss-fullscreen-mode">
<div class="kss-sidebar kss-style">
<header class="kss-header">
<h1 class="kss-doc-title">Zen 7.x-6.x Style Guide</h1>
</header>
<nav class="kss-nav">
<ul class="kss-nav__menu">
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="./">
<span class="kss-nav__ref">0</span
><span class="kss-nav__name">Overview</span>
</a>
</li>
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="section-sass.html">
<span class="kss-nav__ref">1</span><span class="kss-nav__name">Colors and Sass</span>
</a>
</li>
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="section-base.html">
<span class="kss-nav__ref">2</span><span class="kss-nav__name">Defaults</span>
</a>
</li>
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="section-layouts.html">
<span class="kss-nav__ref">3</span><span class="kss-nav__name">Layouts</span>
</a>
</li>
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="section-components.html">
<span class="kss-nav__ref">4</span><span class="kss-nav__name">Components</span>
</a>
</li>
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="section-navigation.html">
<span class="kss-nav__ref">5</span><span class="kss-nav__name">Navigation</span>
</a>
</li>
<li class="kss-nav__menu-item">
<a class="kss-nav__menu-link" href="section-forms.html">
<span class="kss-nav__ref">6</span><span class="kss-nav__name">Forms</span>
</a>
</li>
</ul>
</nav>
</div>
<article role="main" class="kss-main">
<div id="kssref-sass-variables-breakpoints" class="kss-section kss-section--depth-3 is-fullscreen">
<div class="kss-style">
<h3 class="kss-title kss-title--level-3">
<a class="kss-title__permalink" href="#kssref-sass-variables-breakpoints">
<span class="kss-title__ref">
1.4.1
<span class="kss-title__permalink-hash">
sass.variables.breakpoints
</span>
</span>
Breakpoints
</a>
</h3>
<div class="kss-description">
<p>Use the <code>respond-to()</code> mixin to use named breakpoints. Documentation is
available in the <a href="https://github.com/at-import/breakpoint/wiki/Respond-To">Breakpoint wiki
pages</a>.</p>
</div>
</div>
<div class="kss-source kss-style">
Source: <code>init/_variables.scss</code>, line 114
</div>
</div>
</article>
<!-- SCRIPTS -->
<script src="kss-assets/kss.js"></script>
<script src="kss-assets/scrollspy.js"></script>
<script src="kss-assets/prettify.js"></script>
<script src="kss-assets/kss-fullscreen.js"></script>
<script src="kss-assets/kss-guides.js"></script>
<script src="kss-assets/kss-markup.js"></script>
<script>
prettyPrint();
var spy = new ScrollSpy('#kss-node', {
nav: '.kss-nav__menu-child > li > a',
className: 'is-in-viewport'
});
var kssFullScreen = new KssFullScreen({
idPrefix: 'kss-fullscreen-',
bodyClass: 'kss-fullscreen-mode',
elementClass: 'is-fullscreen'
});
var kssGuides = new KssGuides({
bodyClass: 'kss-guides-mode'
});
var kssMarkup = new KssMarkup({
bodyClass: 'kss-markup-mode',
detailsClass: 'kss-markup'
});
</script>
<!-- Automatically built using <a href="https://github.com/kss-node/kss-node">kss-node</a>. -->
</body>
</html>
| jdcamp/cameron_bakery | sites/all/themes/new_zen/styleguide/item-sass-variables-breakpoints.html | HTML | gpl-2.0 | 4,355 |
/*
* CDE - Common Desktop Environment
*
* Copyright (c) 1993-2012, The Open Group. All rights reserved.
*
* These libraries and programs are free software; you can
* redistribute them and/or modify them under the terms of the GNU
* Lesser General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* any later version.
*
* These libraries and programs are distributed in the hope that
* they will be useful, but WITHOUT ANY WARRANTY; without even the
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with these librararies and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
/* $XConsortium: olias_font.h /main/3 1996/06/11 16:48:44 cde-hal $ */
/* Actual Names */
#define OLIAS_DEFAULT ('\0')
#define OLIAS_SPACE (' ')
#define OLIAS_FILLED_RIGHT_ARROW ('>')
#define OLIAS_HOLLOW_RIGHT_ARROW ('?')
#define OLIAS_FILLED_DOWN_ARROW ('V')
#define OLIAS_HOLLOW_DOWN_ARROW ('W')
#define OLIAS_SOLID_TRACKER ('*')
#define OLIAS_HOLLOW_TRACKER ('+')
#define OLIAS_LEAF_ICON ('.')
#define OLIAS_SPACE01 (char)(201)
#define OLIAS_SPACE02 (char)(202)
#define OLIAS_SPACE04 (char)(204)
#define OLIAS_SPACE08 (char)(208)
#define OLIAS_SPACE12 (char)(212)
#define OLIAS_SPACE14 (char)(214)
#define OLIAS_SPACE16 (char)(216)
#define OLIAS_SPACE32 (char)(232)
#define OLIAS_ANNOTATION_MULTI_ICON ('A')
#define OLIAS_BOOKMARK_MULTI_ICON ('B')
#define OLIAS_LINK_MULTI_ICON ('L')
#define OLIAS_ANNOTATION_ICON ('a')
#define OLIAS_BOOKMARK_ICON ('b')
#define OLIAS_LINK_ICON ('l')
#define OLIAS_ICON_SPACE OLIAS_SPACE16
#define OLIAS_PIE_0 ('0')
#define OLIAS_PIE_1 ('1')
#define OLIAS_PIE_2 ('2')
#define OLIAS_PIE_3 ('3')
#define OLIAS_PIE_4 ('4')
#define OLIAS_PIE_5 ('5')
#define OLIAS_PIE_6 ('6')
#define OLIAS_PIE_7 ('7')
#define OLIAS_PIE_8 ('8')
#define OLIAS_INFOLIB_ICON (char)(110)
#define OLIAS_INFOBASE_ICON (char)(111)
#define OLIAS_BOOK_ICON (char)(112)
/* Content Names */
#define OLIAS_CONTRACTED_ICON OLIAS_FILLED_RIGHT_ARROW
#define OLIAS_EXPANDED_ICON OLIAS_FILLED_DOWN_ARROW
#define FILLED (0)
#define HOLLOW (1)
#define OLIAS_NO_CHILDREN_ICON OLIAS_LEAF_ICON
#define OLIAS_PLACEHOLDER_ICON OLIAS_SPACE14
#define OLIAS_RELEVANCY_ICON OLIAS_PIE_0
/* Font Names */
#define OLIAS_FONT "olias"
#define OLIAS_SPACE_FONT "ospace"
| sTeeLM/MINIME | toolkit/srpm/SOURCES/cde-2.2.4/programs/dtinfo/dtinfo/src/olias_font.h | C | gpl-2.0 | 2,809 |
#include <defs.h>
#include <mmu.h>
#include <memlayout.h>
#include <clock.h>
#include <trap.h>
#include <x86.h>
#include <stdio.h>
#include <assert.h>
#include <console.h>
#include <vmm.h>
#include <swap.h>
#include <kdebug.h>
#define TICK_NUM 100
static void print_ticks() {
cprintf("%d ticks\n",TICK_NUM);
#ifdef DEBUG_GRADE
cprintf("End of Test.\n");
panic("EOT: kernel seems ok.");
#endif
}
/* *
* Interrupt descriptor table:
*
* Must be built at run time because shifted function addresses can't
* be represented in relocation records.
* */
static struct gatedesc idt[256] = {{0}};
static struct pseudodesc idt_pd = {
sizeof(idt) - 1, (uintptr_t)idt
};
/* idt_init - initialize IDT to each of the entry points in kern/trap/vectors.S */
void
idt_init(void) {
/* LAB1 2013011377 : STEP 2 */
/* (1) Where are the entry addrs of each Interrupt Service Routine (ISR)?
* All ISR's entry addrs are stored in __vectors. where is uintptr_t __vectors[] ?
* __vectors[] is in kern/trap/vector.S which is produced by tools/vector.c
* (try "make" command in lab1, then you will find vector.S in kern/trap DIR)
* You can use "extern uintptr_t __vectors[];" to define this extern variable which will be used later.
* (2) Now you should setup the entries of ISR in Interrupt Description Table (IDT).
* Can you see idt[256] in this file? Yes, it's IDT! you can use SETGATE macro to setup each item of IDT
* (3) After setup the contents of IDT, you will let CPU know where is the IDT by using 'lidt' instruction.
* You don't know the meaning of this instruction? just google it! and check the libs/x86.h to know more.
* Notice: the argument of lidt is idt_pd. try to find it!
*/
extern uintptr_t __vectors[];
int i;
for (i = 0; i < 256; i++)
SETGATE(idt[i], 0, GD_KTEXT, __vectors[i], DPL_KERNEL);
SETGATE(idt[T_SYSCALL], 1, GD_KTEXT, __vectors[T_SYSCALL], DPL_USER);
lidt(&idt_pd);
}
static const char *
trapname(int trapno) {
static const char * const excnames[] = {
"Divide error",
"Debug",
"Non-Maskable Interrupt",
"Breakpoint",
"Overflow",
"BOUND Range Exceeded",
"Invalid Opcode",
"Device Not Available",
"Double Fault",
"Coprocessor Segment Overrun",
"Invalid TSS",
"Segment Not Present",
"Stack Fault",
"General Protection",
"Page Fault",
"(unknown trap)",
"x87 FPU Floating-Point Error",
"Alignment Check",
"Machine-Check",
"SIMD Floating-Point Exception"
};
if (trapno < sizeof(excnames)/sizeof(const char * const)) {
return excnames[trapno];
}
if (trapno >= IRQ_OFFSET && trapno < IRQ_OFFSET + 16) {
return "Hardware Interrupt";
}
return "(unknown trap)";
}
/* trap_in_kernel - test if trap happened in kernel */
bool
trap_in_kernel(struct trapframe *tf) {
return (tf->tf_cs == (uint16_t)KERNEL_CS);
}
static const char *IA32flags[] = {
"CF", NULL, "PF", NULL, "AF", NULL, "ZF", "SF",
"TF", "IF", "DF", "OF", NULL, NULL, "NT", NULL,
"RF", "VM", "AC", "VIF", "VIP", "ID", NULL, NULL,
};
void
print_trapframe(struct trapframe *tf) {
cprintf("trapframe at %p\n", tf);
print_regs(&tf->tf_regs);
cprintf(" ds 0x----%04x\n", tf->tf_ds);
cprintf(" es 0x----%04x\n", tf->tf_es);
cprintf(" fs 0x----%04x\n", tf->tf_fs);
cprintf(" gs 0x----%04x\n", tf->tf_gs);
cprintf(" trap 0x%08x %s\n", tf->tf_trapno, trapname(tf->tf_trapno));
cprintf(" err 0x%08x\n", tf->tf_err);
cprintf(" eip 0x%08x\n", tf->tf_eip);
cprintf(" cs 0x----%04x\n", tf->tf_cs);
cprintf(" flag 0x%08x ", tf->tf_eflags);
int i, j;
for (i = 0, j = 1; i < sizeof(IA32flags) / sizeof(IA32flags[0]); i ++, j <<= 1) {
if ((tf->tf_eflags & j) && IA32flags[i] != NULL) {
cprintf("%s,", IA32flags[i]);
}
}
cprintf("IOPL=%d\n", (tf->tf_eflags & FL_IOPL_MASK) >> 12);
if (!trap_in_kernel(tf)) {
cprintf(" esp 0x%08x\n", tf->tf_esp);
cprintf(" ss 0x----%04x\n", tf->tf_ss);
}
}
void
print_regs(struct pushregs *regs) {
cprintf(" edi 0x%08x\n", regs->reg_edi);
cprintf(" esi 0x%08x\n", regs->reg_esi);
cprintf(" ebp 0x%08x\n", regs->reg_ebp);
cprintf(" oesp 0x%08x\n", regs->reg_oesp);
cprintf(" ebx 0x%08x\n", regs->reg_ebx);
cprintf(" edx 0x%08x\n", regs->reg_edx);
cprintf(" ecx 0x%08x\n", regs->reg_ecx);
cprintf(" eax 0x%08x\n", regs->reg_eax);
}
static inline void
print_pgfault(struct trapframe *tf) {
/* error_code:
* bit 0 == 0 means no page found, 1 means protection fault
* bit 1 == 0 means read, 1 means write
* bit 2 == 0 means kernel, 1 means user
* */
cprintf("page fault at 0x%08x: %c/%c [%s].\n", rcr2(),
(tf->tf_err & 4) ? 'U' : 'K',
(tf->tf_err & 2) ? 'W' : 'R',
(tf->tf_err & 1) ? "protection fault" : "no page found");
}
static int
pgfault_handler(struct trapframe *tf) {
extern struct mm_struct *check_mm_struct;
print_pgfault(tf);
if (check_mm_struct != NULL) {
return do_pgfault(check_mm_struct, tf->tf_err, rcr2());
}
panic("unhandled page fault.\n");
}
static volatile int in_swap_tick_event = 0;
extern struct mm_struct *check_mm_struct;
static void
trap_dispatch(struct trapframe *tf) {
char c;
int ret;
switch (tf->tf_trapno) {
case T_PGFLT: //page fault
if ((ret = pgfault_handler(tf)) != 0) {
print_trapframe(tf);
panic("handle pgfault failed. %e\n", ret);
}
break;
case IRQ_OFFSET + IRQ_TIMER:
#if 0
LAB3 : If some page replacement algorithm(such as CLOCK PRA) need tick to change the priority of pages,
then you can add code here.
#endif
/* LAB1 2013011377 : STEP 3 */
/* handle the timer interrupt */
/* (1) After a timer interrupt, you should record this event using a global variable (increase it), such as ticks in kern/driver/clock.c
* (2) Every TICK_NUM cycle, you can print some info using a funciton, such as print_ticks().
* (3) Too Simple? Yes, I think so!
*/
ticks++;
if (ticks == TICK_NUM) {
print_ticks();
ticks = 0;
}
break;
case IRQ_OFFSET + IRQ_COM1:
c = cons_getc();
cprintf("serial [%03d] %c\n", c, c);
break;
case IRQ_OFFSET + IRQ_KBD:
c = cons_getc();
cprintf("kbd [%03d] %c\n", c, c);
break;
//LAB1 CHALLENGE 1 : YOUR CODE you should modify below codes.
case T_SWITCH_TOU:
case T_SWITCH_TOK:
panic("T_SWITCH_** ??\n");
break;
case IRQ_OFFSET + IRQ_IDE1:
case IRQ_OFFSET + IRQ_IDE2:
/* do nothing */
break;
default:
// in kernel, it must be a mistake
if ((tf->tf_cs & 3) == 0) {
print_trapframe(tf);
panic("unexpected trap in kernel.\n");
}
}
}
/* *
* trap - handles or dispatches an exception/interrupt. if and when trap() returns,
* the code in kern/trap/trapentry.S restores the old CPU state saved in the
* trapframe and then uses the iret instruction to return from the exception.
* */
void
trap(struct trapframe *tf) {
// dispatch based on what type of trap occurred
trap_dispatch(tf);
}
| coolyangzc/ucore_os_lab | labcodes/lab4/kern/trap/trap.c | C | gpl-2.0 | 7,524 |
.github img {
position: absolute;
top: 0;
right: 0;
border: 0;
}
/* BUTTONS */
/* http://hellohappy.org/css3-buttons/ */
.buttons {
margin: 0 auto 40px auto;
width: 345px;
}
.buttons button {
margin: 0 10px 0 10px;
}
button.blue-pill {
background-color: #a5b8da;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7bc0eb), color-stop(100%, #59a6d6));
background-image: -webkit-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: -moz-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: -ms-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: -o-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: linear-gradient(top, #7bc0eb, #59a6d6);
border-top: 1px solid #758fba;
border-right: 1px solid #6c84ab;
border-bottom: 1px solid #5c6f91;
border-left: 1px solid #6c84ab;
-webkit-border-radius: 18px;
-moz-border-radius: 18px;
border-radius: 18px;
-webkit-box-shadow: inset 0 1px 0 0 #aec3e5;
-moz-box-shadow: inset 0 1px 0 0 #aec3e5;
box-shadow: inset 0 1px 0 0 #aec3e5;
color: #fff;
font-family: 'Source Sans Pro', sans-serif;
font-size: 12px;
font-weight: 700;
line-height: 1;
padding: 8px 0;
text-align: center;
text-shadow: 0 -1px 1px #4f768e;
text-transform: uppercase;
width: 150px;
}
button.blue-pill:hover {
background-color: #9badcc;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #71b1da), color-stop(100%, #478dba));
background-image: -webkit-linear-gradient(top, #71b1da, #478dba);
background-image: -moz-linear-gradient(top, #71b1da, #478dba);
background-image: -ms-linear-gradient(top, #71b1da, #478dba);
background-image: -o-linear-gradient(top, #71b1da, #478dba);
background-image: linear-gradient(top, #71b1da, #478dba);
border-top: 1px solid #4f768e;
border-right: 1px solid #4f768e;
border-bottom: 1px solid #4f768e;
border-left: 1px solid #4f768e;
cursor: pointer;
}
button.blue-pill:active {
border: 1px solid #4f768e;
-webkit-box-shadow: inset 0 0 8px 2px #5285a5, 0 1px 0 0 #eeeeee;
-moz-box-shadow: inset 0 0 8px 2px #5285a5, 0 1px 0 0 #eeeeee;
box-shadow: inset 0 0 8px 2px #5285a5, 0 1px 0 0 #eeeeee;
}
button.blue-pill.deactivated {
opacity: .4;
}
button.blue-pill.deactivated:hover {
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #7bc0eb), color-stop(100%, #59a6d6));
background-image: -webkit-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: -moz-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: -ms-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: -o-linear-gradient(top, #7bc0eb, #59a6d6);
background-image: linear-gradient(top, #7bc0eb, #59a6d6);
border-top: 1px solid #758fba;
border-right: 1px solid #6c84ab;
border-bottom: 1px solid #5c6f91;
border-left: 1px solid #6c84ab;
cursor: auto;
}
/******* EXAMPLE A *******/
.rating-a .br-widget {
/*height: 52px;*/
}
.rating-a .br-widget a {
display: block;
width: 15px;
padding: 5px 0 5px 0;
/* height: 30px;*/
float: left;
background-color: #e3e3e3;
margin: 1px;
text-align: center;
}
.rating-a .br-widget a.br-active,
.rating-a .br-widget a.br-selected {
background-color: #59a6d6;
}
.rating-a .br-widget .br-current-rating {
font-size: 20px;
line-height: 2;
float: left;
padding: 0 20px 0 20px;
color: #646464;
}
/******* EXAMPLE B *******/
.rating-b .br-widget {
height: 25px;
}
.rating-b .br-widget a {
display: block;
width: 70px;
height: 16px;
float: left;
background-color: #e3e3e3;
margin: 1px;
}
.rating-b .br-widget a.br-active,
.rating-b .br-widget a.br-selected {
background-color: #59a6d6;
}
.rating-b .br-widget .br-current-rating {
line-height: 1.1;
float: left;
padding: 0 20px 0 20px;
color: #646464;
}
.rating-b .br-readonly a.br-active,
.rating-b .br-readonly a.br-selected {
background-color: #cbcbcb;
}
/******* EXAMPLE C *******/
.rating-c .br-widget {
height: 52px;
}
.rating-c .br-widget a {
display: block;
width: 35px;
height: 35px;
float: left;
background-color: #e3e3e3;
margin: 2px;
text-decoration: none;
font-size: 16px;
font-weight: 400;
line-height: 2.2;
text-align: center;
color: #b6b6b6;
}
.rating-c .br-widget a.br-active,
.rating-c .br-widget a.br-selected {
background-color: #59a6d6;
color: white;
}
/******* EXAMPLE D *******/
.rating-d .br-widget {
height: 52px;
}
.rating-d .br-widget a {
display: block;
width: 40px;
padding: 5px 0 5px 0;
height: 30px;
float: left;
background-color: white;
border-bottom: 2px solid #e3e3e3;
color: #646464;
margin: 1px;
text-decoration: none;
line-height: 2.1;
text-align: center;
}
.rating-d .br-widget a span {
color: white;
}
.rating-d .br-widget a.br-active,
.rating-d .br-widget a.br-selected {
border-bottom: 2px solid #646464;
}
.rating-d .br-widget a:hover span,
.rating-d .br-widget a.br-current span {
color: #646464;
}
/******* EXAMPLE E *******/
.rating-e .br-widget a {
padding: 5px;
color: #646464;
text-decoration: none;
font-size: 11px;
font-weight: 400;
line-height: 3;
text-align: center;
}
.rating-e .br-widget a.br-active {
background-color: #e3e3e3;
color: #646464;
}
.rating-e .br-widget a.br-selected {
background-color: #59a6d6;
color: white;
}
/******* EXAMPLE F *******/
.rating-f .br-widget {
height: 24px;
}
.rating-f .br-widget a {
background: url('../img/star.png');
width: 24px;
height: 24px;
display: block;
float: left;
}
.rating-f .br-widget a:hover,
.rating-f .br-widget a.br-active,
.rating-f .br-widget a.br-selected {
background-position: 0 24px;
}
/******* EXAMPLE G *******/
.rating-g .br-widget {
height: 25px;
}
.rating-g .br-widget a {
display: block;
width: 50px;
height: 16px;
float: left;
background-color: #e3e3e3;
margin: 1px;
}
.rating-g .br-widget a.br-active,
.rating-g .br-widget a.br-selected {
background-color: #59a6d6;
}
.rating-g .br-widget .br-current-rating {
line-height: 1.1;
float: left;
padding: 0 20px 0 20px;
color: #646464;
}
@media
only screen and (-webkit-min-device-pixel-ratio: 1.5),
only screen and (min-device-pixel-ratio : 1.5),
(min-resolution: 192dpi) {
.rating-f .br-widget a {
background: url('../img/star@2x.png');
background-size: 24px 48px;
}
} | marvin-aoanan/WP-Site-Dev | wp-content/themes/CybroSolutions/framework/jquery-bar-rating/examples/css/examples.css | CSS | gpl-2.0 | 6,701 |
/**
Copyright (C) SYSTAP, LLC 2006-2015. All rights reserved.
Contact:
SYSTAP, LLC
2501 Calvert ST NW #106
Washington, DC 20008
licenses@systap.com
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
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
*/
/*
* Created on Oct 20, 2011
*/
package com.bigdata.rdf.internal;
import com.bigdata.rdf.model.BigdataValue;
/**
* A class which does not support any extensions.
*
* @author <a href="mailto:thompsonbry@users.sourceforge.net">Bryan Thompson</a>
* @version $Id$
*/
public class NoExtensionFactory implements IExtensionFactory {
@Override
public void init(final IDatatypeURIResolver lex,
final ILexiconConfiguration<BigdataValue> config) {
}
@Override
public IExtension[] getExtensions() {
return new IExtension[]{};
}
}
| smalyshev/blazegraph | bigdata-rdf/src/java/com/bigdata/rdf/internal/NoExtensionFactory.java | Java | gpl-2.0 | 1,434 |
<?xml version="1.0" ?><!DOCTYPE TS><TS language="hi" version="2.0">
<context>
<name>CacheCleaner</name>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="14"/>
<source>Cache Cleaner - Octopi</source>
<translation>कैश हटाने हेतु साधन - ऑक्टोपी</translation>
</message>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="49"/>
<source>Uninstalled packages</source>
<translation>हटाए गए पैकेज</translation>
</message>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="75"/>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="150"/>
<source>Keep :</source>
<translation>रखें :</translation>
</message>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="82"/>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="157"/>
<source>Number of old versions to keep</source>
<translation>रखने हेतु पुराने पैकेज की संस्करण संख्या</translation>
</message>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="102"/>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="183"/>
<source>Refresh</source>
<translation> रिफ्रेश करें</translation>
</message>
<message>
<location filename="Projects/octopi/cachecleaner/ui/cachecleaner.ui" line="127"/>
<source>Installed packages</source>
<translation>इंस्टॉल हो रखें पैकेज</translation>
</message>
</context>
<context>
<name>PackageGroupModel</name>
<message>
<location filename="Projects/octopi/cachecleaner/packagegroupmodel.cpp" line="199"/>
<source>Clean</source>
<translation>हटाएँ</translation>
</message>
<message>
<location filename="Projects/octopi/cachecleaner/packagegroupmodel.cpp" line="222"/>
<source>Clean %1</source>
<translation>%1 हटाएँ</translation>
</message>
</context>
</TS> | offa/octopi | cachecleaner/resources/translations/octopi_cachecleaner_hi.ts | TypeScript | gpl-2.0 | 2,373 |
<?php
/*
* Copyright (C) Vulcan Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program.If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* @file
* @ingroup LinkedData
*/
global $smwgHaloIP;
require_once($smwgHaloIP."/includes/storage/SMW_RESTWebserviceConnector.php");
/**
* This is the implementation for accessing the mapping endpoint at the TSC.
*
* Note: There is no SOAP implementation available, because the TSC does not
* support SOAP any more.
*
* @author Kai, ingo Steinbauer
* Date: 28.5.2010
*
*/
class LODMappingTripleStore implements ILODMappingStore {
/**
* Deletes all mappings that are stored in the article with the name
* $articleName. Also calls remove all Mappings in order to delte
* mappings from TSC
*
* @param string $articleName
* Fully qualified name of an article
*/
public function removeAllMappingsFromPage($articleName) {
$db = LODStorage::getDatabase();
$sourceTargetPairs = $db->getMappingsInArticle($articleName);
if (isset($sourceTargetPairs)) {
foreach ($sourceTargetPairs as $stp) {
$source = $stp[0];
$target = $stp[1];
$this->removeAllMappings($source, $target, $articleName);
}
$db->removeAllMappingsFromPage($articleName);
}
}
/**
* Deletes all mappings having source and range $source and $target.
*
* @param string source
* ID of the source. If <null>, all mappings with the to the given target
* are deleted.
* @param string target
* ID of the target. If <null>, all mappings from the given source are
* deleted.
* @param string $persistencyLayerId
* Must be the same Id that was used when storing the triples.
*
*/
public function removeAllMappings($source, $target, $persistencyLayerId) {
$tripleStoreAccess = new TSCPersistentTripleStoreAccess(true);
$pm = TSCPrefixManager::getInstance();
$property = 'smw-lde:linksFrom';
$property = $pm->makeAbsoluteURI($property);
$source = 'smwDatasources:'.$source;
$source = $pm->makeAbsoluteURI($source);
$where = '?mapping '.$property.' '.$source.'. ';
$property = 'smw-lde:linksTo';
$property = $pm->makeAbsoluteURI($property);
$target = 'smwDatasources:'.$target;
$target = $pm->makeAbsoluteURI($target);
$where .= '?mapping '.$property.' '.$target.'. ';
$graph = 'smwGraphs:MappingRepository';
$graph = $pm->makeAbsoluteURI($graph, false);
$tripleStoreAccess->deleteTriples($graph, $where, $where);
$tripleStoreAccess->flushCommands();
$tripleStoreAccess->deletePersistentTriples('MappingStore', $persistencyLayerId);
}
/**
* Deletes a mapping.
*
* @param string $uri
* The uri of the mapping to be removed
*/
public function removeMapping($uri) {
$tripleStoreAccess = new TSCPersistentTripleStoreAccess(true);
$pm = TSCPrefixManager::getInstance();
$graph = 'smwGraphs:MappingRepository';
$graph = $pm->makeAbsoluteURI($graph, false);
$where = "?s ?p ?o";
$template = "<$uri> ?p ?o";
$tripleStoreAccess->deleteTriples($graph, $where, $template);
return $tripleStoreAccess->flushCommands();
}
/**
* Adds the given mapping to the store. Already existing mappings with the
* same source and target are not replaced but enhanced.
*
* @param LODMapping $mapping
* This object defines a mapping for a linked data source.
*
* @return bool
* <true> if the mapping was stored successfully or
* <false> otherwise
*
* @param string persistencyLayerId
* An id, that adresses the tripples of this mapping in the
* persistency layer. Normally the article name is used.
*/
public function addMapping(LODMapping $mapping, $persistencyLayerId) {
$triples = $mapping->getTriples();
$tripleStoreAccess = new TSCPersistentTripleStoreAccess(true);
$pm = TSCPrefixManager::getInstance();
$graph = 'smwGraphs:MappingRepository';
$graph = $pm->makeAbsoluteURI($graph, false);
$tripleStoreAccess->addPrefixes($pm->getSPARQLPrefixes(array('xsd')));
$tripleStoreAccess->insertTriples($graph, $triples);
$result = $tripleStoreAccess->flushCommands('MappingStore', $persistencyLayerId);
return $result;
}
/**
* As mappings are stored in articles the system must know which mappings
* (i.e. source-target pairs) are stored in an article.
* This function stores a source-target pairs for an article.
* @param string $articleName
* Fully qualified name of an article
* @param string $source
* Name of the mapping source
* @param string $target
* Name of the mapping target
*/
public function addMappingToPage($articleName, $source, $target) {
$db = LODStorage::getDatabase();
$db->addMappingToPage($articleName, $source, $target);
}
/**
* Returns an array of source-target pairs of mappings that are stored in the
* article with the name $articleName
* @param string $articleName
* Fully qualified name of an article
* @return array(array(string source, string $target))
*/
public function getMappingsInArticle($articleName, $askTSC = false) {
$db = LODStorage::getDatabase();
$sourceTargetPairs = $db->getMappingsInArticle($articleName);
if(!$askTSC){
return $sourceTargetPairs;
} else {
$pairs = array();
foreach($sourceTargetPairs as $pair){
$pairs[$pair[0]][] = $pair[1];
}
$mappings = array();
foreach($pairs as $source => $targets){
foreach($targets as $target){
$mappings = array_merge($mappings,
$this->getAllMappings($source, $target));
}
}
return $mappings;
}
}
/**
* Loads all definitions of mappings between $source and $target.
*
* @param string source
* ID of the source. If <null>, all mappings with the to the given target
* are returned.
* @param string target
* ID of the target. If <null>, all mappings from the given source are
* returned.
* If both parameters are <null>, all existing mappings are returned.
*
* @return array<LODMapping>
* The definitions of matching mappings or an empty array, if there are
* no such mappings.
*/
public function getAllMappings($source = null, $target = null, $typeId = null) {
$tripleStoreAccess = new TSCPersistentTripleStoreAccess(true);
$pm = TSCPrefixManager::getInstance();
$graph = 'smwGraphs:MappingRepository';
$graph = $pm->makeAbsoluteURI($graph, false);
$query = LODMapping::getQueryString($source, $target);
$queryResult = $tripleStoreAccess->queryTripleStore($query, $graph);
$mappings = array();
if($queryResult instanceof TSCSparqlQueryResult){
foreach($queryResult -> getRows() as $row){
$mappings[$row->getResult('mapping')->getValue()][$row->getResult('p')->getValue()][] =
$row->getResult('o')->getValue();
}
}
foreach($mappings as $subjectURI => $mappingData){
$mappings[$subjectURI] =
LODMapping::createMappingFromSPARQLResult($mappingData, $subjectURI);
}
return $mappings;
}
/**
* Loads a mapping definition based on the mapping URI
*
* @param string mappingUri
*
* @return LODMapping
* The definition of matching mappings or null
*/
public function getMapping($mappingUri) {
$tripleStoreAccess = new TSCPersistentTripleStoreAccess(true);
$pm = TSCPrefixManager::getInstance();
$graph = 'smwGraphs:MappingRepository';
$graph = $pm->makeAbsoluteURI($graph, false);
$query = "SELECT ?p ?o WHERE { <$mappingUri> ?p ?o }";
$queryResult = $tripleStoreAccess->queryTripleStore($query, $graph);
$mappingData = array();
if($queryResult instanceof TSCSparqlQueryResult){
foreach($queryResult -> getRows() as $row){
$mappingData[$row->getResult('p')->getValue()][] =
$row->getResult('o')->getValue();
}
return LODMapping::createMappingFromSPARQLResult($mappingData, $mappingUri);
} else {
return null;
}
}
/**
* Checks if a mapping exists in the Mapping Store
*
* @param LODMapping mapping
* The mapping to check for
*
* @return bool
* <true>, if the mapping exists
* <false> otherwise
*
*/
public function existsMapping($mapping){
if($mapping instanceof LODSILKMapping){
$mappingType = 'SILK';
} else {
$mappingType = 'R2R';
}
$mappings = $this->getAllMappings($mapping->getSource(), $mapping->getTarget(), $mappingType);
foreach($mappings as $existsCandidate){
if($mapping->equals($existsCandidate)){
return true;
}
}
return false;
}
}
| jheizmann/LinkedData | includes/LODMapping/LOD_MappingTripleStore.php | PHP | gpl-2.0 | 9,356 |
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package dot.junit.opcodes.sput_wide;
import dot.junit.DxTestCase;
import dot.junit.DxUtil;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_1;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_10;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_11;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_12;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_13;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_14;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_15;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_17;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_5;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_7;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_8;
import dot.junit.opcodes.sput_wide.d.T_sput_wide_9;
public class Test_sput_wide extends DxTestCase {
/**
* @title put long into static field
*/
public void testN1() {
T_sput_wide_1 t = new T_sput_wide_1();
assertEquals(0, T_sput_wide_1.st_i1);
t.run();
assertEquals(778899112233l, T_sput_wide_1.st_i1);
}
/**
* @title put double into static field
*/
public void testN2() {
T_sput_wide_5 t = new T_sput_wide_5();
assertEquals(0.0d, T_sput_wide_5.st_i1);
t.run();
assertEquals(0.5d, T_sput_wide_5.st_i1);
}
/**
* @title modification of final field
*/
public void testN3() {
T_sput_wide_12 t = new T_sput_wide_12();
assertEquals(0, T_sput_wide_12.st_i1);
t.run();
assertEquals(77, T_sput_wide_12.st_i1);
}
/**
* @title modification of protected field from subclass
*/
public void testN4() {
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_1
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_14
T_sput_wide_14 t = new T_sput_wide_14();
assertEquals(0, T_sput_wide_14.getProtectedField());
t.run();
assertEquals(77, T_sput_wide_14.getProtectedField());
}
/**
* @title initialization of referenced class throws exception
*/
public void testE6() {
T_sput_wide_13 t = new T_sput_wide_13();
try {
t.run();
fail("expected Error");
} catch (Error e) {
// expected
}
}
/**
* @constraint A12
* @title constant pool index
*/
public void testVFE1() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_3");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint A23
* @title number of registers
*/
public void testVFE2() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_4");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B13
* @title put int into long field - only field with same name but
* different type exists
*/
public void testVFE5() {
try {
new T_sput_wide_17().run();
fail("expected NoSuchFieldError");
} catch (NoSuchFieldError t) {
}
}
/**
*
* @constraint B13
* @title type of field doesn't match opcode - attempt to modify float
* field with double-width register
*/
public void testVFE7() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_18");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint A12
* @title Attempt to set non-static field.Dalvik throws IncompatibleClassChangeError when
* executing the code.
*/
public void testVFE8() {
try {
new T_sput_wide_7().run();
fail("expected IncompatibleClassChangeError");
} catch (IncompatibleClassChangeError t) {
}
}
/**
* @constraint n/a
* @title Attempt to modify inaccessible field. Dalvik throws IllegalAccessError when executing
* the code.
*/
public void testVFE9() {
//@uses dot.junit.opcodes.sput_wide.TestStubs
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_8
try {
new T_sput_wide_8().run();
fail("expected IllegalAccessError");
} catch (IllegalAccessError t) {
}
}
/**
* @constraint n/a
* @title Attempt to modify field of undefined class. Dalvik throws NoClassDefFoundError when
* executing the code.
*/
public void testVFE10() {
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_9
try {
new T_sput_wide_9().run();
fail("expected NoClassDefFoundError");
} catch (NoClassDefFoundError t) {
}
}
/**
* @constraint n/a
* @title Attempt to modify undefined field. Dalvik throws NoSuchFieldError when executing the
* code.
*/
public void testVFE11() {
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_10
try {
new T_sput_wide_10().run();
fail("expected NoSuchFieldError");
} catch (NoSuchFieldError t) {
}
}
/**
* @constraint n/a
* @title Attempt to modify superclass' private field from subclass. Dalvik throws
* IllegalAccessError when executing the code.
*/
public void testVFE12() {
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_1
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_15
try {
new T_sput_wide_15().run();
fail("expected IllegalAccessError");
} catch (IllegalAccessError t) {
DxUtil.checkVerifyException(t);
}
}
/**
* @constraint B1
* @title sput-wide shall not work for single-width numbers
*/
public void testVFE13() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_2");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B1
* @title sput-wide shall not work for reference fields
*/
public void testVFE14() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_20");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B1
* @title sput-wide shall not work for char fields
*/
public void testVFE15() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_21");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B1
* @title sput-wide shall not work for int fields
*/
public void testVFE16() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_22");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B1
* @title sput-wide shall not work for byte fields
*/
public void testVFE17() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_23");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B1
* @title sput-wide shall not work for boolean fields
*/
public void testVFE18() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_24");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
*
* @constraint B1
* @title sput-wide shall not work for short fields
*/
public void testVFE6() {
try {
Class.forName("dot.junit.opcodes.sput_wide.d.T_sput_wide_6");
fail("expected a verification exception");
} catch (Throwable t) {
DxUtil.checkVerifyException(t);
}
}
/**
* @constraint n/a
* @title Modification of final field in other class
*/
public void testVFE19() {
//@uses dot.junit.opcodes.sput_wide.TestStubs
//@uses dot.junit.opcodes.sput_wide.d.T_sput_wide_11
try {
new T_sput_wide_11().run();
fail("expected IllegalAccessError");
} catch (IllegalAccessError t) {
}
}
}
| rex-xxx/mt6572_x201 | cts/tools/vm-tests-tf/src/dot/junit/opcodes/sput_wide/Test_sput_wide.java | Java | gpl-2.0 | 9,495 |
<!DOCTYPE html>
<html>
<head>
<title>Logarithmic axis</title>
<meta charset="utf-8">
<link href="../content/shared/styles/examples-offline.css" rel="stylesheet">
<link href="../../styles/kendo.common.min.css" rel="stylesheet">
<link href="../../styles/kendo.rtl.min.css" rel="stylesheet">
<link href="../../styles/kendo.default.min.css" rel="stylesheet">
<link href="../../styles/kendo.dataviz.min.css" rel="stylesheet">
<link href="../../styles/kendo.dataviz.default.min.css" rel="stylesheet">
<script src="../../js/jquery.min.js"></script>
<script src="../../js/kendo.all.min.js"></script>
<script src="../content/shared/js/console.js"></script>
<script>
</script>
</head>
<body>
<a class="offline-button" href="../index.html">Back</a>
<div id="example">
<div class="demo-section k-content">
<div id="chart"></div>
</div>
<script>
function fibonacciSequence(n) {
var data = [1, 1];
for (var i = 2; i < n; i++) {
data.push(data[i - 1] + data[i - 2]);
}
return data;
}
function createChart() {
$("#chart").kendoChart({
title: {
text: "Fibonacci sequence"
},
series: [{
data: fibonacciSequence(39)
}],
tooltip: {
visible: true
},
valueAxis: {
type: "log",
minorGridLines: {
visible: true
}
}
});
}
$(document).ready(createChart);
$(document).bind("kendo:skinChange", createChart);
</script>
</div>
</body>
</html>
| cuongnd/test_pro | media/Kendo_UI_Professional_Q2_2015/examples/bar-charts/logarithmic-axis.html | HTML | gpl-2.0 | 1,848 |
<?php
/**
* @group link
*/
class Tests_Link extends WP_UnitTestCase {
function tearDown() {
global $wp_rewrite;
parent::tearDown();
$wp_rewrite->init();
}
function _get_pagenum_link_cb( $url ) {
return $url . '/WooHoo';
}
/**
* @ticket 8847
*/
function test_get_pagenum_link_case_insensitivity() {
$old_req_uri = $_SERVER['REQUEST_URI'];
global $wp_rewrite;
$wp_rewrite->set_permalink_structure('/%year%/%monthnum%/%day%/%postname%/');
$wp_rewrite->flush_rules();
add_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
$_SERVER['REQUEST_URI'] = '/woohoo';
$paged = get_pagenum_link( 2 );
remove_filter( 'home_url', array( $this, '_get_pagenum_link_cb' ) );
$this->assertEquals( $paged, home_url( '/WooHoo/page/2/' ) );
$_SERVER['REQUEST_URI'] = $old_req_uri;
}
function test_wp_get_shortlink() {
global $wp_rewrite;
$post_id = $this->factory->post->create();
$post_id2 = $this->factory->post->create();
$wp_rewrite->init();
$wp_rewrite->set_permalink_structure( '' );
$wp_rewrite->flush_rules();
// Basic case
$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
unset( $GLOBALS['post'] );
// Global post is not set
$this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
$this->assertEquals( '', wp_get_shortlink( 0 ) );
$this->assertEquals( '', wp_get_shortlink() );
$GLOBALS['post'] = get_post( $post_id );
// Global post is set
$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0, 'post' ) );
$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink( 0 ) );
$this->assertEquals( get_permalink( $post_id ), wp_get_shortlink() );
// Not the global post
$this->assertEquals( get_permalink( $post_id2 ), wp_get_shortlink( $post_id2, 'post' ) );
unset( $GLOBALS['post'] );
// Global post is not set, once again
$this->assertEquals( '', wp_get_shortlink( 0, 'post' ) );
$this->assertEquals( '', wp_get_shortlink( 0 ) );
$this->assertEquals( '', wp_get_shortlink() );
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
$wp_rewrite->flush_rules();
// With a permalink structure set, get_permalink() will no longer match.
$this->assertNotEquals( get_permalink( $post_id ), wp_get_shortlink( $post_id, 'post' ) );
$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
// Global post and permalink structure are set
$GLOBALS['post'] = get_post( $post_id );
$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0, 'post' ) );
$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( 0 ) );
$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink() );
}
function test_wp_get_shortlink_with_page() {
$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
// Basic case
// Don't test against get_permalink() since it uses ?page_id= for pages.
$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
global $wp_rewrite;
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
$wp_rewrite->flush_rules();
$this->assertEquals( home_url( '?p=' . $post_id ), wp_get_shortlink( $post_id, 'post' ) );
}
/**
* @ticket 26871
*/
function test_wp_get_shortlink_with_home_page() {
$post_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
update_option( 'show_on_front', 'page' );
update_option( 'page_on_front', $post_id );
$this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
global $wp_rewrite;
$wp_rewrite->permalink_structure = '';
$wp_rewrite->set_permalink_structure( '/%year%/%monthnum%/%day%/%postname%/' );
$wp_rewrite->flush_rules();
$this->assertEquals( home_url( '/' ), wp_get_shortlink( $post_id, 'post' ) );
}
/**
* @ticket 17807
*/
function test_get_adjacent_post() {
// Need some sample posts to test adjacency
$post_one = $this->factory->post->create_and_get( array(
'post_title' => 'First',
'post_date' => '2012-01-01 12:00:00'
) );
$post_two = $this->factory->post->create_and_get( array(
'post_title' => 'Second',
'post_date' => '2012-02-01 12:00:00'
) );
$post_three = $this->factory->post->create_and_get( array(
'post_title' => 'Third',
'post_date' => '2012-03-01 12:00:00'
) );
$post_four = $this->factory->post->create_and_get( array(
'post_title' => 'Fourth',
'post_date' => '2012-04-01 12:00:00'
) );
// Assign some terms
wp_set_object_terms( $post_one->ID, 'wordpress', 'category', false );
wp_set_object_terms( $post_three->ID, 'wordpress', 'category', false );
wp_set_object_terms( $post_two->ID, 'plugins', 'post_tag', false );
wp_set_object_terms( $post_four->ID, 'plugins', 'post_tag', false );
// Test normal post adjacency
$this->go_to( get_permalink( $post_two->ID ) );
$this->assertEquals( $post_one, get_adjacent_post( false, '', true ) );
$this->assertEquals( $post_three, get_adjacent_post( false, '', false ) );
$this->assertNotEquals( $post_two, get_adjacent_post( false, '', true ) );
$this->assertNotEquals( $post_two, get_adjacent_post( false, '', false ) );
// Test category adjacency
$this->go_to( get_permalink( $post_one->ID ) );
$this->assertEquals( '', get_adjacent_post( true, '', true, 'category' ) );
$this->assertEquals( $post_three, get_adjacent_post( true, '', false, 'category' ) );
// Test tag adjacency
$this->go_to( get_permalink( $post_two->ID ) );
$this->assertEquals( '', get_adjacent_post( true, '', true, 'post_tag' ) );
$this->assertEquals( $post_four, get_adjacent_post( true, '', false, 'post_tag' ) );
// Test normal boundary post
$this->go_to( get_permalink( $post_two->ID ) );
$this->assertEquals( array( $post_one ), get_boundary_post( false, '', true ) );
$this->assertEquals( array( $post_four ), get_boundary_post( false, '', false ) );
// Test category boundary post
$this->go_to( get_permalink( $post_one->ID ) );
$this->assertEquals( array( $post_one ), get_boundary_post( true, '', true, 'category' ) );
$this->assertEquals( array( $post_three ), get_boundary_post( true, '', false, 'category' ) );
// Test tag boundary post
$this->go_to( get_permalink( $post_two->ID ) );
$this->assertEquals( array( $post_two ), get_boundary_post( true, '', true, 'post_tag' ) );
$this->assertEquals( array( $post_four ), get_boundary_post( true, '', false, 'post_tag' ) );
}
/**
* @ticket 22112
*/
function test_get_adjacent_post_exclude_self_term() {
$include = $this->factory->category->create();
$exclude = $this->factory->category->create();
$one = $this->factory->post->create_and_get( array(
'post_date' => '2012-01-01 12:00:00',
'post_category' => array( $include, $exclude ),
) );
$two = $this->factory->post->create_and_get( array(
'post_date' => '2012-01-02 12:00:00',
'post_category' => array(),
) );
$three = $this->factory->post->create_and_get( array(
'post_date' => '2012-01-03 12:00:00',
'post_category' => array( $include, $exclude ),
) );
$four = $this->factory->post->create_and_get( array(
'post_date' => '2012-01-04 12:00:00',
'post_category' => array( $include ),
) );
$five = $this->factory->post->create_and_get( array(
'post_date' => '2012-01-05 12:00:00',
'post_category' => array( $include, $exclude ),
) );
// First post
$this->go_to( get_permalink( $one ) );
$this->assertEquals( $two, get_adjacent_post( false, array(), false ) );
$this->assertEquals( $three, get_adjacent_post( true, array(), false ) );
$this->assertEquals( $two, get_adjacent_post( false, array( $exclude ), false ) );
$this->assertEquals( $four, get_adjacent_post( true, array( $exclude ), false ) );
$this->assertEmpty( get_adjacent_post( false, array(), true ) );
// Fourth post
$this->go_to( get_permalink( $four ) );
$this->assertEquals( $five, get_adjacent_post( false, array(), false ) );
$this->assertEquals( $five, get_adjacent_post( true, array(), false ) );
$this->assertEmpty( get_adjacent_post( false, array( $exclude ), false ) );
$this->assertEmpty( get_adjacent_post( true, array( $exclude ), false ) );
$this->assertEquals( $three, get_adjacent_post( false, array(), true ) );
$this->assertEquals( $three, get_adjacent_post( true, array(), true ) );
$this->assertEquals( $two, get_adjacent_post( false, array( $exclude ), true ) );
$this->assertEmpty( get_adjacent_post( true, array( $exclude ), true ) );
// Last post
$this->go_to( get_permalink( $five ) );
$this->assertEquals( $four, get_adjacent_post( false, array(), true ) );
$this->assertEquals( $four, get_adjacent_post( true, array(), true ) );
$this->assertEquals( $four, get_adjacent_post( false, array( $exclude ), true ) );
$this->assertEquals( $four, get_adjacent_post( true, array( $exclude ), true ) );
$this->assertEmpty( get_adjacent_post( false, array(), false ) );
}
} | jomijournal/jomi_wp | unit-test/tests/phpunit/tests/link.php | PHP | gpl-2.0 | 9,029 |
#ifndef LEX_INCLUDED
#define LEX_INCLUDED
/* Copyright (c) 2000, 2010, 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,
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
/* This file includes all reserved words and functions */
#include "lex_symbol.h"
SYM_GROUP sym_group_common= {"", ""};
SYM_GROUP sym_group_geom= {"Spatial extentions", "HAVE_SPATIAL"};
SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
/* We don't want to include sql_yacc.h into gen_lex_hash */
#ifdef NO_YACC_SYMBOLS
#define SYM_OR_NULL(A) 0
#else
#define SYM_OR_NULL(A) A
#endif
#define SYM(A) SYM_OR_NULL(A),0,&sym_group_common
/*
Symbols are broken into separated arrays to allow field names with
same name as functions.
These are kept sorted for human lookup (the symbols are hashed).
NOTE! The symbol tables should be the same regardless of what features
are compiled into the server. Don't add ifdef'ed symbols to the
lists
*/
static SYMBOL symbols[] = {
{ "&&", SYM(AND_AND_SYM)},
{ "<", SYM(LT)},
{ "<=", SYM(LE)},
{ "<>", SYM(NE)},
{ "!=", SYM(NE)},
{ "=", SYM(EQ)},
{ ">", SYM(GT_SYM)},
{ ">=", SYM(GE)},
{ "<<", SYM(SHIFT_LEFT)},
{ ">>", SYM(SHIFT_RIGHT)},
{ "<=>", SYM(EQUAL_SYM)},
{ "ACCESSIBLE", SYM(ACCESSIBLE_SYM)},
{ "ACTION", SYM(ACTION)},
{ "ADD", SYM(ADD)},
{ "AFTER", SYM(AFTER_SYM)},
{ "AGAINST", SYM(AGAINST)},
{ "AGGREGATE", SYM(AGGREGATE_SYM)},
{ "ALL", SYM(ALL)},
{ "ALGORITHM", SYM(ALGORITHM_SYM)},
{ "ALTER", SYM(ALTER)},
{ "ANALYSE", SYM(ANALYSE_SYM)}, // this one is for PROCEDURE ANALYSE
{ "ANALYZE", SYM(ANALYZE_SYM)}, // this one is for ANALYZE TABLE etc
{ "AND", SYM(AND_SYM)},
{ "ANY", SYM(ANY_SYM)},
{ "ARCHIVED", SYM(ARCHIVED_SYM)},
{ "AS", SYM(AS)},
{ "ASC", SYM(ASC)},
{ "ASCII", SYM(ASCII_SYM)},
{ "ASENSITIVE", SYM(ASENSITIVE_SYM)},
{ "AT", SYM(AT_SYM)},
{ "AUTO_INCREMENT", SYM(AUTO_INC)},
{ "AUTOEXTEND_SIZE", SYM(AUTOEXTEND_SIZE_SYM)},
{ "AVG", SYM(AVG_SYM)},
{ "AVG_ROW_LENGTH", SYM(AVG_ROW_LENGTH)},
{ "BACKUP", SYM(BACKUP_SYM)},
{ "BEFORE", SYM(BEFORE_SYM)},
{ "BEGIN", SYM(BEGIN_SYM)},
{ "BETWEEN", SYM(BETWEEN_SYM)},
{ "BIGINT", SYM(BIGINT)},
{ "BINARY", SYM(BINARY)},
{ "BINLOG", SYM(BINLOG_SYM)},
{ "BIT", SYM(BIT_SYM)},
{ "BLOB", SYM(BLOB_SYM)},
{ "BLOCK", SYM(BLOCK_SYM)},
{ "BOOL", SYM(BOOL_SYM)},
{ "BOOLEAN", SYM(BOOLEAN_SYM)},
{ "BOTH", SYM(BOTH)},
{ "BTREE", SYM(BTREE_SYM)},
{ "BY", SYM(BY)},
{ "BYTE", SYM(BYTE_SYM)},
{ "CACHE", SYM(CACHE_SYM)},
{ "CALL", SYM(CALL_SYM)},
{ "CASCADE", SYM(CASCADE)},
{ "CASCADED", SYM(CASCADED)},
{ "CASE", SYM(CASE_SYM)},
{ "CATALOG_NAME", SYM(CATALOG_NAME_SYM)},
{ "CHAIN", SYM(CHAIN_SYM)},
{ "CHANGE", SYM(CHANGE)},
{ "CHANGED", SYM(CHANGED)},
{ "CHANGED_PAGE_BITMAPS", SYM(CHANGED_PAGE_BITMAPS_SYM)},
{ "CHAR", SYM(CHAR_SYM)},
{ "CHARACTER", SYM(CHAR_SYM)},
{ "CHARSET", SYM(CHARSET)},
{ "CHECK", SYM(CHECK_SYM)},
{ "CHECKSUM", SYM(CHECKSUM_SYM)},
{ "CIPHER", SYM(CIPHER_SYM)},
{ "CLASS_ORIGIN", SYM(CLASS_ORIGIN_SYM)},
{ "CLIENT", SYM(CLIENT_SYM)},
{ "CLIENT_STATISTICS", SYM(CLIENT_STATS_SYM)},
{ "CLOSE", SYM(CLOSE_SYM)},
{ "CLUSTERING", SYM(CLUSTERING_SYM)},
{ "COALESCE", SYM(COALESCE)},
{ "CODE", SYM(CODE_SYM)},
{ "COLLATE", SYM(COLLATE_SYM)},
{ "COLLATION", SYM(COLLATION_SYM)},
{ "COLUMN", SYM(COLUMN_SYM)},
{ "COLUMN_FORMAT", SYM(COLUMN_FORMAT_SYM)},
{ "COLUMN_NAME", SYM(COLUMN_NAME_SYM)},
{ "COLUMNS", SYM(COLUMNS)},
{ "COMMENT", SYM(COMMENT_SYM)},
{ "COMMIT", SYM(COMMIT_SYM)},
{ "COMMITTED", SYM(COMMITTED_SYM)},
{ "COMPACT", SYM(COMPACT_SYM)},
{ "COMPLETION", SYM(COMPLETION_SYM)},
{ "COMPRESSED", SYM(COMPRESSED_SYM)},
{ "CONCURRENT", SYM(CONCURRENT)},
{ "CONDITION", SYM(CONDITION_SYM)},
{ "CONNECTION", SYM(CONNECTION_SYM)},
{ "CONSISTENT", SYM(CONSISTENT_SYM)},
{ "CONSTRAINT", SYM(CONSTRAINT)},
{ "CONSTRAINT_CATALOG", SYM(CONSTRAINT_CATALOG_SYM)},
{ "CONSTRAINT_NAME", SYM(CONSTRAINT_NAME_SYM)},
{ "CONSTRAINT_SCHEMA", SYM(CONSTRAINT_SCHEMA_SYM)},
{ "CONTAINS", SYM(CONTAINS_SYM)},
{ "CONTEXT", SYM(CONTEXT_SYM)},
{ "CONTINUE", SYM(CONTINUE_SYM)},
{ "CONVERT", SYM(CONVERT_SYM)},
{ "CPU", SYM(CPU_SYM)},
{ "CREATE", SYM(CREATE)},
{ "CROSS", SYM(CROSS)},
{ "CUBE", SYM(CUBE_SYM)},
{ "CURRENT", SYM(CURRENT_SYM)},
{ "CURRENT_DATE", SYM(CURDATE)},
{ "CURRENT_TIME", SYM(CURTIME)},
{ "CURRENT_TIMESTAMP", SYM(NOW_SYM)},
{ "CURRENT_USER", SYM(CURRENT_USER)},
{ "CURSOR", SYM(CURSOR_SYM)},
{ "CURSOR_NAME", SYM(CURSOR_NAME_SYM)},
{ "DATA", SYM(DATA_SYM)},
{ "DATABASE", SYM(DATABASE)},
{ "DATABASES", SYM(DATABASES)},
{ "DATAFILE", SYM(DATAFILE_SYM)},
{ "DATE", SYM(DATE_SYM)},
{ "DATETIME", SYM(DATETIME)},
{ "DAY", SYM(DAY_SYM)},
{ "DAY_HOUR", SYM(DAY_HOUR_SYM)},
{ "DAY_MICROSECOND", SYM(DAY_MICROSECOND_SYM)},
{ "DAY_MINUTE", SYM(DAY_MINUTE_SYM)},
{ "DAY_SECOND", SYM(DAY_SECOND_SYM)},
{ "DEALLOCATE", SYM(DEALLOCATE_SYM)},
{ "DEC", SYM(DECIMAL_SYM)},
{ "DECIMAL", SYM(DECIMAL_SYM)},
{ "DECLARE", SYM(DECLARE_SYM)},
{ "DEFAULT", SYM(DEFAULT)},
{ "DEFAULT_AUTH", SYM(DEFAULT_AUTH_SYM)},
{ "DEFINER", SYM(DEFINER_SYM)},
{ "DELAYED", SYM(DELAYED_SYM)},
{ "DELAY_KEY_WRITE", SYM(DELAY_KEY_WRITE_SYM)},
{ "DELETE", SYM(DELETE_SYM)},
{ "DESC", SYM(DESC)},
{ "DESCRIBE", SYM(DESCRIBE)},
{ "DES_KEY_FILE", SYM(DES_KEY_FILE)},
{ "DETERMINISTIC", SYM(DETERMINISTIC_SYM)},
{ "DIAGNOSTICS", SYM(DIAGNOSTICS_SYM)},
{ "DIRECTORY", SYM(DIRECTORY_SYM)},
{ "DISABLE", SYM(DISABLE_SYM)},
{ "DISCARD", SYM(DISCARD)},
{ "DISK", SYM(DISK_SYM)},
{ "DISTINCT", SYM(DISTINCT)},
{ "DISTINCTROW", SYM(DISTINCT)}, /* Access likes this */
{ "DIV", SYM(DIV_SYM)},
{ "DO", SYM(DO_SYM)},
{ "DOUBLE", SYM(DOUBLE_SYM)},
{ "DROP", SYM(DROP)},
{ "DUAL", SYM(DUAL_SYM)},
{ "DUMPFILE", SYM(DUMPFILE)},
{ "DUPLICATE", SYM(DUPLICATE_SYM)},
{ "DYNAMIC", SYM(DYNAMIC_SYM)},
{ "EACH", SYM(EACH_SYM)},
{ "ELSE", SYM(ELSE)},
{ "ELSEIF", SYM(ELSEIF_SYM)},
{ "ENABLE", SYM(ENABLE_SYM)},
{ "ENCLOSED", SYM(ENCLOSED)},
{ "END", SYM(END)},
{ "ENDS", SYM(ENDS_SYM)},
{ "ENGINE", SYM(ENGINE_SYM)},
{ "ENGINES", SYM(ENGINES_SYM)},
{ "ENUM", SYM(ENUM)},
{ "ERROR", SYM(ERROR_SYM)},
{ "ERRORS", SYM(ERRORS)},
{ "ESCAPE", SYM(ESCAPE_SYM)},
{ "ESCAPED", SYM(ESCAPED)},
{ "EVENT", SYM(EVENT_SYM)},
{ "EVENTS", SYM(EVENTS_SYM)},
{ "EVERY", SYM(EVERY_SYM)},
{ "EXCHANGE", SYM(EXCHANGE_SYM)},
{ "EXECUTE", SYM(EXECUTE_SYM)},
{ "EXISTS", SYM(EXISTS)},
{ "EXIT", SYM(EXIT_SYM)},
{ "EXPANSION", SYM(EXPANSION_SYM)},
{ "EXPORT", SYM(EXPORT_SYM)},
{ "EXPIRE", SYM(EXPIRE_SYM)},
{ "EXPLAIN", SYM(DESCRIBE)},
{ "EXTENDED", SYM(EXTENDED_SYM)},
{ "EXTENT_SIZE", SYM(EXTENT_SIZE_SYM)},
{ "FALSE", SYM(FALSE_SYM)},
{ "FAST", SYM(FAST_SYM)},
{ "FAULTS", SYM(FAULTS_SYM)},
{ "FETCH", SYM(FETCH_SYM)},
{ "FIELDS", SYM(COLUMNS)},
{ "FILE", SYM(FILE_SYM)},
{ "FIRST", SYM(FIRST_SYM)},
{ "FIXED", SYM(FIXED_SYM)},
{ "FLOAT", SYM(FLOAT_SYM)},
{ "FLOAT4", SYM(FLOAT_SYM)},
{ "FLOAT8", SYM(DOUBLE_SYM)},
{ "FLUSH", SYM(FLUSH_SYM)},
{ "FOR", SYM(FOR_SYM)},
{ "FORCE", SYM(FORCE_SYM)},
{ "FOREIGN", SYM(FOREIGN)},
{ "FORMAT", SYM(FORMAT_SYM)},
{ "FOUND", SYM(FOUND_SYM)},
{ "FROM", SYM(FROM)},
{ "FULL", SYM(FULL)},
{ "FULLTEXT", SYM(FULLTEXT_SYM)},
{ "FUNCTION", SYM(FUNCTION_SYM)},
{ "GENERAL", SYM(GENERAL)},
{ "GEOMETRY", SYM(GEOMETRY_SYM)},
{ "GEOMETRYCOLLECTION",SYM(GEOMETRYCOLLECTION)},
{ "GET_FORMAT", SYM(GET_FORMAT)},
{ "GET", SYM(GET_SYM)},
{ "GLOBAL", SYM(GLOBAL_SYM)},
{ "GRANT", SYM(GRANT)},
{ "GRANTS", SYM(GRANTS)},
{ "GROUP", SYM(GROUP_SYM)},
{ "HANDLER", SYM(HANDLER_SYM)},
{ "HASH", SYM(HASH_SYM)},
{ "HAVING", SYM(HAVING)},
{ "HELP", SYM(HELP_SYM)},
{ "HIGH_PRIORITY", SYM(HIGH_PRIORITY)},
{ "HOST", SYM(HOST_SYM)},
{ "HOSTS", SYM(HOSTS_SYM)},
{ "HOUR", SYM(HOUR_SYM)},
{ "HOUR_MICROSECOND", SYM(HOUR_MICROSECOND_SYM)},
{ "HOUR_MINUTE", SYM(HOUR_MINUTE_SYM)},
{ "HOUR_SECOND", SYM(HOUR_SECOND_SYM)},
{ "IDENTIFIED", SYM(IDENTIFIED_SYM)},
{ "IF", SYM(IF)},
{ "IGNORE", SYM(IGNORE_SYM)},
{ "IGNORE_SERVER_IDS", SYM(IGNORE_SERVER_IDS_SYM)},
{ "IMPORT", SYM(IMPORT)},
{ "IN", SYM(IN_SYM)},
{ "INDEX", SYM(INDEX_SYM)},
{ "INDEXES", SYM(INDEXES)},
{ "INDEX_STATISTICS", SYM(INDEX_STATS_SYM)},
{ "INFILE", SYM(INFILE)},
{ "INITIAL_SIZE", SYM(INITIAL_SIZE_SYM)},
{ "INNER", SYM(INNER_SYM)},
{ "INOUT", SYM(INOUT_SYM)},
{ "INSENSITIVE", SYM(INSENSITIVE_SYM)},
{ "INSERT", SYM(INSERT)},
{ "INSERT_METHOD", SYM(INSERT_METHOD)},
{ "INSTALL", SYM(INSTALL_SYM)},
{ "INT", SYM(INT_SYM)},
{ "INT1", SYM(TINYINT)},
{ "INT2", SYM(SMALLINT)},
{ "INT3", SYM(MEDIUMINT)},
{ "INT4", SYM(INT_SYM)},
{ "INT8", SYM(BIGINT)},
{ "INTEGER", SYM(INT_SYM)},
{ "INTERVAL", SYM(INTERVAL_SYM)},
{ "INTO", SYM(INTO)},
{ "IO", SYM(IO_SYM)},
{ "IO_AFTER_GTIDS", SYM(IO_AFTER_GTIDS)},
{ "IO_BEFORE_GTIDS", SYM(IO_BEFORE_GTIDS)},
{ "IO_THREAD", SYM(RELAY_THREAD)},
{ "IPC", SYM(IPC_SYM)},
{ "IS", SYM(IS)},
{ "ISOLATION", SYM(ISOLATION)},
{ "ISSUER", SYM(ISSUER_SYM)},
{ "ITERATE", SYM(ITERATE_SYM)},
{ "INVOKER", SYM(INVOKER_SYM)},
{ "JOIN", SYM(JOIN_SYM)},
{ "KEY", SYM(KEY_SYM)},
{ "KEYS", SYM(KEYS)},
{ "KEY_BLOCK_SIZE", SYM(KEY_BLOCK_SIZE)},
{ "KILL", SYM(KILL_SYM)},
{ "LANGUAGE", SYM(LANGUAGE_SYM)},
{ "LAST", SYM(LAST_SYM)},
{ "LEADING", SYM(LEADING)},
{ "LEAVE", SYM(LEAVE_SYM)},
{ "LEAVES", SYM(LEAVES)},
{ "LEFT", SYM(LEFT)},
{ "LESS", SYM(LESS_SYM)},
{ "LEVEL", SYM(LEVEL_SYM)},
{ "LIKE", SYM(LIKE)},
{ "LIMIT", SYM(LIMIT)},
{ "LINEAR", SYM(LINEAR_SYM)},
{ "LINES", SYM(LINES)},
{ "LINESTRING", SYM(LINESTRING)},
{ "LIST", SYM(LIST_SYM)},
{ "LOAD", SYM(LOAD)},
{ "LOCAL", SYM(LOCAL_SYM)},
{ "LOCALTIME", SYM(NOW_SYM)},
{ "LOCALTIMESTAMP", SYM(NOW_SYM)},
{ "LOCK", SYM(LOCK_SYM)},
{ "LOCKS", SYM(LOCKS_SYM)},
{ "LOGFILE", SYM(LOGFILE_SYM)},
{ "LOGS", SYM(LOGS_SYM)},
{ "LONG", SYM(LONG_SYM)},
{ "LONGBLOB", SYM(LONGBLOB)},
{ "LONGTEXT", SYM(LONGTEXT)},
{ "LOOP", SYM(LOOP_SYM)},
{ "LOW_PRIORITY", SYM(LOW_PRIORITY)},
{ "MASTER", SYM(MASTER_SYM)},
{ "MASTER_AUTO_POSITION", SYM(MASTER_AUTO_POSITION_SYM)},
{ "MASTER_BIND", SYM(MASTER_BIND_SYM)},
{ "MASTER_CONNECT_RETRY", SYM(MASTER_CONNECT_RETRY_SYM)},
{ "MASTER_DELAY", SYM(MASTER_DELAY_SYM)},
{ "MASTER_HOST", SYM(MASTER_HOST_SYM)},
{ "MASTER_LOG_FILE", SYM(MASTER_LOG_FILE_SYM)},
{ "MASTER_LOG_POS", SYM(MASTER_LOG_POS_SYM)},
{ "MASTER_PASSWORD", SYM(MASTER_PASSWORD_SYM)},
{ "MASTER_PORT", SYM(MASTER_PORT_SYM)},
{ "MASTER_RETRY_COUNT", SYM(MASTER_RETRY_COUNT_SYM)},
{ "MASTER_SERVER_ID", SYM(MASTER_SERVER_ID_SYM)},
{ "MASTER_SSL", SYM(MASTER_SSL_SYM)},
{ "MASTER_SSL_CA", SYM(MASTER_SSL_CA_SYM)},
{ "MASTER_SSL_CAPATH",SYM(MASTER_SSL_CAPATH_SYM)},
{ "MASTER_SSL_CERT", SYM(MASTER_SSL_CERT_SYM)},
{ "MASTER_SSL_CIPHER",SYM(MASTER_SSL_CIPHER_SYM)},
{ "MASTER_SSL_CRL", SYM(MASTER_SSL_CRL_SYM)},
{ "MASTER_SSL_CRLPATH",SYM(MASTER_SSL_CRLPATH_SYM)},
{ "MASTER_SSL_KEY", SYM(MASTER_SSL_KEY_SYM)},
{ "MASTER_SSL_VERIFY_SERVER_CERT", SYM(MASTER_SSL_VERIFY_SERVER_CERT_SYM)},
{ "MASTER_USER", SYM(MASTER_USER_SYM)},
{ "MASTER_HEARTBEAT_PERIOD", SYM(MASTER_HEARTBEAT_PERIOD_SYM)},
{ "MATCH", SYM(MATCH)},
{ "MAX_CONNECTIONS_PER_HOUR", SYM(MAX_CONNECTIONS_PER_HOUR)},
{ "MAX_QUERIES_PER_HOUR", SYM(MAX_QUERIES_PER_HOUR)},
{ "MAX_ROWS", SYM(MAX_ROWS)},
{ "MAX_SIZE", SYM(MAX_SIZE_SYM)},
{ "MAX_UPDATES_PER_HOUR", SYM(MAX_UPDATES_PER_HOUR)},
{ "MAX_USER_CONNECTIONS", SYM(MAX_USER_CONNECTIONS_SYM)},
{ "MAXVALUE", SYM(MAX_VALUE_SYM)},
{ "MEDIUM", SYM(MEDIUM_SYM)},
{ "MEDIUMBLOB", SYM(MEDIUMBLOB)},
{ "MEDIUMINT", SYM(MEDIUMINT)},
{ "MEDIUMTEXT", SYM(MEDIUMTEXT)},
{ "MEMORY", SYM(MEMORY_SYM)},
{ "MERGE", SYM(MERGE_SYM)},
{ "MESSAGE_TEXT", SYM(MESSAGE_TEXT_SYM)},
{ "MICROSECOND", SYM(MICROSECOND_SYM)},
{ "MIDDLEINT", SYM(MEDIUMINT)}, /* For powerbuilder */
{ "MIGRATE", SYM(MIGRATE_SYM)},
{ "MINUTE", SYM(MINUTE_SYM)},
{ "MINUTE_MICROSECOND", SYM(MINUTE_MICROSECOND_SYM)},
{ "MINUTE_SECOND", SYM(MINUTE_SECOND_SYM)},
{ "MIN_ROWS", SYM(MIN_ROWS)},
{ "MOD", SYM(MOD_SYM)},
{ "MODE", SYM(MODE_SYM)},
{ "MODIFIES", SYM(MODIFIES_SYM)},
{ "MODIFY", SYM(MODIFY_SYM)},
{ "MONTH", SYM(MONTH_SYM)},
{ "MULTILINESTRING", SYM(MULTILINESTRING)},
{ "MULTIPOINT", SYM(MULTIPOINT)},
{ "MULTIPOLYGON", SYM(MULTIPOLYGON)},
{ "MUTEX", SYM(MUTEX_SYM)},
{ "MYSQL_ERRNO", SYM(MYSQL_ERRNO_SYM)},
{ "NAME", SYM(NAME_SYM)},
{ "NAMES", SYM(NAMES_SYM)},
{ "NATIONAL", SYM(NATIONAL_SYM)},
{ "NATURAL", SYM(NATURAL)},
{ "NDB", SYM(NDBCLUSTER_SYM)},
{ "NDBCLUSTER", SYM(NDBCLUSTER_SYM)},
{ "NCHAR", SYM(NCHAR_SYM)},
{ "NEW", SYM(NEW_SYM)},
{ "NEXT", SYM(NEXT_SYM)},
{ "NO", SYM(NO_SYM)},
{ "NO_WAIT", SYM(NO_WAIT_SYM)},
{ "NODEGROUP", SYM(NODEGROUP_SYM)},
{ "NONE", SYM(NONE_SYM)},
{ "NOT", SYM(NOT_SYM)},
{ "NO_WRITE_TO_BINLOG", SYM(NO_WRITE_TO_BINLOG)},
{ "NOLOCK", SYM(NOLOCK_SYM)},
{ "NULL", SYM(NULL_SYM)},
{ "NUMBER", SYM(NUMBER_SYM)},
{ "NUMERIC", SYM(NUMERIC_SYM)},
{ "NVARCHAR", SYM(NVARCHAR_SYM)},
{ "OFFSET", SYM(OFFSET_SYM)},
{ "OLD_PASSWORD", SYM(OLD_PASSWORD)},
{ "ON", SYM(ON)},
{ "ONE", SYM(ONE_SYM)},
{ "ONLY", SYM(ONLY_SYM)},
{ "OPEN", SYM(OPEN_SYM)},
{ "OPTIMIZE", SYM(OPTIMIZE)},
{ "OPTIONS", SYM(OPTIONS_SYM)},
{ "OPTION", SYM(OPTION)},
{ "OPTIONALLY", SYM(OPTIONALLY)},
{ "OR", SYM(OR_SYM)},
{ "ORDER", SYM(ORDER_SYM)},
{ "OUT", SYM(OUT_SYM)},
{ "OUTER", SYM(OUTER)},
{ "OUTFILE", SYM(OUTFILE)},
{ "OWNER", SYM(OWNER_SYM)},
{ "PACK_KEYS", SYM(PACK_KEYS_SYM)},
{ "PARSER", SYM(PARSER_SYM)},
{ "PAGE", SYM(PAGE_SYM)},
{ "PARTIAL", SYM(PARTIAL)},
{ "PARTITION", SYM(PARTITION_SYM)},
{ "PARTITIONING", SYM(PARTITIONING_SYM)},
{ "PARTITIONS", SYM(PARTITIONS_SYM)},
{ "PASSWORD", SYM(PASSWORD)},
{ "PHASE", SYM(PHASE_SYM)},
{ "PLUGIN", SYM(PLUGIN_SYM)},
{ "PLUGINS", SYM(PLUGINS_SYM)},
{ "PLUGIN_DIR", SYM(PLUGIN_DIR_SYM)},
{ "POINT", SYM(POINT_SYM)},
{ "POLYGON", SYM(POLYGON)},
{ "PORT", SYM(PORT_SYM)},
{ "PRECISION", SYM(PRECISION)},
{ "PREPARE", SYM(PREPARE_SYM)},
{ "PRESERVE", SYM(PRESERVE_SYM)},
{ "PREV", SYM(PREV_SYM)},
{ "PRIMARY", SYM(PRIMARY_SYM)},
{ "PRIVILEGES", SYM(PRIVILEGES)},
{ "PROCEDURE", SYM(PROCEDURE_SYM)},
{ "PROCESS" , SYM(PROCESS)},
{ "PROCESSLIST", SYM(PROCESSLIST_SYM)},
{ "PROFILE", SYM(PROFILE_SYM)},
{ "PROFILES", SYM(PROFILES_SYM)},
{ "PROXY", SYM(PROXY_SYM)},
{ "PURGE", SYM(PURGE)},
{ "QUARTER", SYM(QUARTER_SYM)},
{ "QUERY", SYM(QUERY_SYM)},
{ "QUICK", SYM(QUICK)},
{ "RANGE", SYM(RANGE_SYM)},
{ "READ", SYM(READ_SYM)},
{ "READ_ONLY", SYM(READ_ONLY_SYM)},
{ "READ_WRITE", SYM(READ_WRITE_SYM)},
{ "READS", SYM(READS_SYM)},
{ "REAL", SYM(REAL)},
{ "REBUILD", SYM(REBUILD_SYM)},
{ "RECOVER", SYM(RECOVER_SYM)},
{ "REDO_BUFFER_SIZE", SYM(REDO_BUFFER_SIZE_SYM)},
{ "REDOFILE", SYM(REDOFILE_SYM)},
{ "REDUNDANT", SYM(REDUNDANT_SYM)},
{ "REFERENCES", SYM(REFERENCES)},
{ "REGEXP", SYM(REGEXP)},
{ "RELAY", SYM(RELAY)},
{ "RELAYLOG", SYM(RELAYLOG_SYM)},
{ "RELAY_LOG_FILE", SYM(RELAY_LOG_FILE_SYM)},
{ "RELAY_LOG_POS", SYM(RELAY_LOG_POS_SYM)},
{ "RELAY_THREAD", SYM(RELAY_THREAD)},
{ "RELEASE", SYM(RELEASE_SYM)},
{ "RELOAD", SYM(RELOAD)},
{ "REMOVE", SYM(REMOVE_SYM)},
{ "RENAME", SYM(RENAME)},
{ "REORGANIZE", SYM(REORGANIZE_SYM)},
{ "REPAIR", SYM(REPAIR)},
{ "REPEATABLE", SYM(REPEATABLE_SYM)},
{ "REPLACE", SYM(REPLACE)},
{ "REPLICATION", SYM(REPLICATION)},
{ "REPEAT", SYM(REPEAT_SYM)},
{ "REQUIRE", SYM(REQUIRE_SYM)},
{ "RESET", SYM(RESET_SYM)},
{ "RESIGNAL", SYM(RESIGNAL_SYM)},
{ "RESTORE", SYM(RESTORE_SYM)},
{ "RESTRICT", SYM(RESTRICT)},
{ "RESUME", SYM(RESUME_SYM)},
{ "RETURNED_SQLSTATE",SYM(RETURNED_SQLSTATE_SYM)},
{ "RETURN", SYM(RETURN_SYM)},
{ "RETURNS", SYM(RETURNS_SYM)},
{ "REVERSE", SYM(REVERSE_SYM)},
{ "REVOKE", SYM(REVOKE)},
{ "RIGHT", SYM(RIGHT)},
{ "RLIKE", SYM(REGEXP)}, /* Like in mSQL2 */
{ "ROLLBACK", SYM(ROLLBACK_SYM)},
{ "ROLLUP", SYM(ROLLUP_SYM)},
{ "ROUTINE", SYM(ROUTINE_SYM)},
{ "ROW", SYM(ROW_SYM)},
{ "ROW_COUNT", SYM(ROW_COUNT_SYM)},
{ "ROWS", SYM(ROWS_SYM)},
{ "ROW_FORMAT", SYM(ROW_FORMAT_SYM)},
{ "RTREE", SYM(RTREE_SYM)},
{ "SAVEPOINT", SYM(SAVEPOINT_SYM)},
{ "SCHEDULE", SYM(SCHEDULE_SYM)},
{ "SCHEMA", SYM(DATABASE)},
{ "SCHEMA_NAME", SYM(SCHEMA_NAME_SYM)},
{ "SCHEMAS", SYM(DATABASES)},
{ "SECOND", SYM(SECOND_SYM)},
{ "SECOND_MICROSECOND", SYM(SECOND_MICROSECOND_SYM)},
{ "SECURITY", SYM(SECURITY_SYM)},
{ "SELECT", SYM(SELECT_SYM)},
{ "SENSITIVE", SYM(SENSITIVE_SYM)},
{ "SEPARATOR", SYM(SEPARATOR_SYM)},
{ "SERIAL", SYM(SERIAL_SYM)},
{ "SERIALIZABLE", SYM(SERIALIZABLE_SYM)},
{ "SESSION", SYM(SESSION_SYM)},
{ "SERVER", SYM(SERVER_SYM)},
{ "SET", SYM(SET)},
{ "SHARE", SYM(SHARE_SYM)},
{ "SHOW", SYM(SHOW)},
{ "SHUTDOWN", SYM(SHUTDOWN)},
{ "SIGNAL", SYM(SIGNAL_SYM)},
{ "SIGNED", SYM(SIGNED_SYM)},
{ "SIMPLE", SYM(SIMPLE_SYM)},
{ "SLAVE", SYM(SLAVE)},
{ "SLOW", SYM(SLOW)},
{ "SNAPSHOT", SYM(SNAPSHOT_SYM)},
{ "SMALLINT", SYM(SMALLINT)},
{ "SOCKET", SYM(SOCKET_SYM)},
{ "SOME", SYM(ANY_SYM)},
{ "SONAME", SYM(SONAME_SYM)},
{ "SOUNDS", SYM(SOUNDS_SYM)},
{ "SOURCE", SYM(SOURCE_SYM)},
{ "SPATIAL", SYM(SPATIAL_SYM)},
{ "SPECIFIC", SYM(SPECIFIC_SYM)},
{ "SQL", SYM(SQL_SYM)},
{ "SQLEXCEPTION", SYM(SQLEXCEPTION_SYM)},
{ "SQLSTATE", SYM(SQLSTATE_SYM)},
{ "SQLWARNING", SYM(SQLWARNING_SYM)},
{ "SQL_AFTER_GTIDS", SYM(SQL_AFTER_GTIDS)},
{ "SQL_AFTER_MTS_GAPS", SYM(SQL_AFTER_MTS_GAPS)},
{ "SQL_BEFORE_GTIDS", SYM(SQL_BEFORE_GTIDS)},
{ "SQL_BIG_RESULT", SYM(SQL_BIG_RESULT)},
{ "SQL_BUFFER_RESULT", SYM(SQL_BUFFER_RESULT)},
{ "SQL_CACHE", SYM(SQL_CACHE_SYM)},
{ "SQL_CALC_FOUND_ROWS", SYM(SQL_CALC_FOUND_ROWS)},
{ "SQL_NO_CACHE", SYM(SQL_NO_CACHE_SYM)},
{ "SQL_SMALL_RESULT", SYM(SQL_SMALL_RESULT)},
{ "SQL_THREAD", SYM(SQL_THREAD)},
{ "SQL_TSI_SECOND", SYM(SECOND_SYM)},
{ "SQL_TSI_MINUTE", SYM(MINUTE_SYM)},
{ "SQL_TSI_HOUR", SYM(HOUR_SYM)},
{ "SQL_TSI_DAY", SYM(DAY_SYM)},
{ "SQL_TSI_WEEK", SYM(WEEK_SYM)},
{ "SQL_TSI_MONTH", SYM(MONTH_SYM)},
{ "SQL_TSI_QUARTER", SYM(QUARTER_SYM)},
{ "SQL_TSI_YEAR", SYM(YEAR_SYM)},
{ "SSL", SYM(SSL_SYM)},
{ "START", SYM(START_SYM)},
{ "STARTING", SYM(STARTING)},
{ "STARTS", SYM(STARTS_SYM)},
{ "STATEMENT", SYM(STATEMENT_SYM)},
{ "STATS_AUTO_RECALC",SYM(STATS_AUTO_RECALC_SYM)},
{ "STATS_PERSISTENT", SYM(STATS_PERSISTENT_SYM)},
{ "STATS_SAMPLE_PAGES",SYM(STATS_SAMPLE_PAGES_SYM)},
{ "STATUS", SYM(STATUS_SYM)},
{ "STOP", SYM(STOP_SYM)},
{ "STORAGE", SYM(STORAGE_SYM)},
{ "STRAIGHT_JOIN", SYM(STRAIGHT_JOIN)},
{ "STRING", SYM(STRING_SYM)},
{ "SUBCLASS_ORIGIN", SYM(SUBCLASS_ORIGIN_SYM)},
{ "SUBJECT", SYM(SUBJECT_SYM)},
{ "SUBPARTITION", SYM(SUBPARTITION_SYM)},
{ "SUBPARTITIONS", SYM(SUBPARTITIONS_SYM)},
{ "SUPER", SYM(SUPER_SYM)},
{ "SUSPEND", SYM(SUSPEND_SYM)},
{ "SWAPS", SYM(SWAPS_SYM)},
{ "SWITCHES", SYM(SWITCHES_SYM)},
{ "TABLE", SYM(TABLE_SYM)},
{ "TABLE_NAME", SYM(TABLE_NAME_SYM)},
{ "TABLES", SYM(TABLES)},
{ "TABLESPACE", SYM(TABLESPACE)},
{ "TABLE_CHECKSUM", SYM(TABLE_CHECKSUM_SYM)},
{ "TABLE_STATISTICS", SYM(TABLE_STATS_SYM)},
{ "TEMPORARY", SYM(TEMPORARY)},
{ "TEMPTABLE", SYM(TEMPTABLE_SYM)},
{ "TERMINATED", SYM(TERMINATED)},
{ "TEXT", SYM(TEXT_SYM)},
{ "THAN", SYM(THAN_SYM)},
{ "THEN", SYM(THEN_SYM)},
{ "THREAD_STATISTICS", SYM(THREAD_STATS_SYM)},
{ "TIME", SYM(TIME_SYM)},
{ "TIMESTAMP", SYM(TIMESTAMP)},
{ "TIMESTAMPADD", SYM(TIMESTAMP_ADD)},
{ "TIMESTAMPDIFF", SYM(TIMESTAMP_DIFF)},
{ "TINYBLOB", SYM(TINYBLOB)},
{ "TINYINT", SYM(TINYINT)},
{ "TINYTEXT", SYM(TINYTEXT)},
{ "TO", SYM(TO_SYM)},
{ "TOKUDB_UNCOMPRESSED", SYM(TOKU_UNCOMPRESSED_SYM)},
{ "TOKUDB_ZLIB", SYM(TOKU_ZLIB_SYM)},
{ "TOKUDB_QUICKLZ", SYM(TOKU_QUICKLZ_SYM)},
{ "TOKUDB_LZMA", SYM(TOKU_LZMA_SYM)},
{ "TOKUDB_FAST", SYM(TOKU_FAST_SYM)},
{ "TOKUDB_SMALL", SYM(TOKU_SMALL_SYM)},
{ "TRAILING", SYM(TRAILING)},
{ "TRANSACTION", SYM(TRANSACTION_SYM)},
{ "TRIGGER", SYM(TRIGGER_SYM)},
{ "TRIGGERS", SYM(TRIGGERS_SYM)},
{ "TRUE", SYM(TRUE_SYM)},
{ "TRUNCATE", SYM(TRUNCATE_SYM)},
{ "TYPE", SYM(TYPE_SYM)},
{ "TYPES", SYM(TYPES_SYM)},
{ "UNCOMMITTED", SYM(UNCOMMITTED_SYM)},
{ "UNDEFINED", SYM(UNDEFINED_SYM)},
{ "UNDO_BUFFER_SIZE", SYM(UNDO_BUFFER_SIZE_SYM)},
{ "UNDOFILE", SYM(UNDOFILE_SYM)},
{ "UNDO", SYM(UNDO_SYM)},
{ "UNICODE", SYM(UNICODE_SYM)},
{ "UNION", SYM(UNION_SYM)},
{ "UNIQUE", SYM(UNIQUE_SYM)},
{ "UNKNOWN", SYM(UNKNOWN_SYM)},
{ "UNLOCK", SYM(UNLOCK_SYM)},
{ "UNINSTALL", SYM(UNINSTALL_SYM)},
{ "UNSIGNED", SYM(UNSIGNED)},
{ "UNTIL", SYM(UNTIL_SYM)},
{ "UPDATE", SYM(UPDATE_SYM)},
{ "UPGRADE", SYM(UPGRADE_SYM)},
{ "USAGE", SYM(USAGE)},
{ "USE", SYM(USE_SYM)},
{ "USER", SYM(USER)},
{ "USER_RESOURCES", SYM(RESOURCES)},
{ "USER_STATISTICS", SYM(USER_STATS_SYM)},
{ "USE_FRM", SYM(USE_FRM)},
{ "USING", SYM(USING)},
{ "UTC_DATE", SYM(UTC_DATE_SYM)},
{ "UTC_TIME", SYM(UTC_TIME_SYM)},
{ "UTC_TIMESTAMP", SYM(UTC_TIMESTAMP_SYM)},
{ "VALUE", SYM(VALUE_SYM)},
{ "VALUES", SYM(VALUES)},
{ "VARBINARY", SYM(VARBINARY)},
{ "VARCHAR", SYM(VARCHAR)},
{ "VARCHARACTER", SYM(VARCHAR)},
{ "VARIABLES", SYM(VARIABLES)},
{ "VARYING", SYM(VARYING)},
{ "WAIT", SYM(WAIT_SYM)},
{ "WARNINGS", SYM(WARNINGS)},
{ "WEEK", SYM(WEEK_SYM)},
{ "WEIGHT_STRING", SYM(WEIGHT_STRING_SYM)},
{ "WHEN", SYM(WHEN_SYM)},
{ "WHERE", SYM(WHERE)},
{ "WHILE", SYM(WHILE_SYM)},
{ "VIEW", SYM(VIEW_SYM)},
{ "WITH", SYM(WITH)},
{ "WORK", SYM(WORK_SYM)},
{ "WRAPPER", SYM(WRAPPER_SYM)},
{ "WRITE", SYM(WRITE_SYM)},
{ "X509", SYM(X509_SYM)},
{ "XOR", SYM(XOR)},
{ "XA", SYM(XA_SYM)},
{ "XML", SYM(XML_SYM)}, /* LOAD XML Arnold/Erik */
{ "YEAR", SYM(YEAR_SYM)},
{ "YEAR_MONTH", SYM(YEAR_MONTH_SYM)},
{ "ZEROFILL", SYM(ZEROFILL)},
{ "||", SYM(OR_OR_SYM)}
};
static SYMBOL sql_functions[] = {
{ "ADDDATE", SYM(ADDDATE_SYM)},
{ "BIT_AND", SYM(BIT_AND)},
{ "BIT_OR", SYM(BIT_OR)},
{ "BIT_XOR", SYM(BIT_XOR)},
{ "CAST", SYM(CAST_SYM)},
{ "COUNT", SYM(COUNT_SYM)},
{ "CURDATE", SYM(CURDATE)},
{ "CURTIME", SYM(CURTIME)},
{ "DATE_ADD", SYM(DATE_ADD_INTERVAL)},
{ "DATE_SUB", SYM(DATE_SUB_INTERVAL)},
{ "EXTRACT", SYM(EXTRACT_SYM)},
{ "GROUP_CONCAT", SYM(GROUP_CONCAT_SYM)},
{ "MAX", SYM(MAX_SYM)},
{ "MID", SYM(SUBSTRING)}, /* unireg function */
{ "MIN", SYM(MIN_SYM)},
{ "NOW", SYM(NOW_SYM)},
{ "POSITION", SYM(POSITION_SYM)},
{ "SESSION_USER", SYM(USER)},
{ "STD", SYM(STD_SYM)},
{ "STDDEV", SYM(STD_SYM)},
{ "STDDEV_POP", SYM(STD_SYM)},
{ "STDDEV_SAMP", SYM(STDDEV_SAMP_SYM)},
{ "SUBDATE", SYM(SUBDATE_SYM)},
{ "SUBSTR", SYM(SUBSTRING)},
{ "SUBSTRING", SYM(SUBSTRING)},
{ "SUM", SYM(SUM_SYM)},
{ "SYSDATE", SYM(SYSDATE)},
{ "SYSTEM_USER", SYM(USER)},
{ "TRIM", SYM(TRIM)},
{ "VARIANCE", SYM(VARIANCE_SYM)},
{ "VAR_POP", SYM(VARIANCE_SYM)},
{ "VAR_SAMP", SYM(VAR_SAMP_SYM)},
};
#endif /* LEX_INCLUDED */
| javacruft/percona-xtradb-cluster-5.6 | sql/lex.h | C | gpl-2.0 | 25,669 |
/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2012, Digium, Inc.
*
* Mark Spencer <markster@digium.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
/*! \file
*
* \brief Channel Accessor API
*
* This file is intended to be the only file that ever accesses the
* internals of an ast_channel. All other files should use the
* accessor functions defined here.
*
* \author Terry Wilson
*/
/*** MODULEINFO
<support_level>core</support_level>
***/
#include "asterisk.h"
ASTERISK_REGISTER_FILE()
#include <unistd.h>
#include <fcntl.h>
#include "asterisk/paths.h"
#include "asterisk/channel.h"
#include "asterisk/channel_internal.h"
#include "asterisk/data.h"
#include "asterisk/endpoints.h"
#include "asterisk/indications.h"
#include "asterisk/stasis_cache_pattern.h"
#include "asterisk/stasis_channels.h"
#include "asterisk/stasis_endpoints.h"
#include "asterisk/stringfields.h"
#include "asterisk/test.h"
/*!
* \brief Channel UniqueId structure
* \note channel creation time used for determining LinkedId Propagation
*/
struct ast_channel_id {
time_t creation_time; /*!< Creation time */
int creation_unique; /*!< sub-second unique value */
char unique_id[AST_MAX_UNIQUEID]; /*!< Unique Identifier */
};
/*!
* \brief Main Channel structure associated with a channel.
*
* \note When adding fields to this structure, it is important to add the field
* 'in position' with like-aligned fields, so as to keep the compiler from
* having to add padding to align fields. The structure's fields are sorted
* in this order: pointers, structures, long, int/enum, short, char. This
* is especially important on 64-bit architectures, where mixing 4-byte
* and 8-byte fields causes 4 bytes of padding to be added before many
* 8-byte fields.
*/
struct ast_channel {
const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */
void *tech_pvt; /*!< Private data used by the technology driver */
void *music_state; /*!< Music State*/
void *generatordata; /*!< Current generator data if there is any */
struct ast_generator *generator; /*!< Current active data generator */
struct ast_channel *masq; /*!< Channel that will masquerade as us */
struct ast_channel *masqr; /*!< Who we are masquerading as */
const char *blockproc; /*!< Procedure causing blocking */
const char *appl; /*!< Current application */
const char *data; /*!< Data passed to current application */
struct ast_sched_context *sched; /*!< Schedule context */
struct ast_filestream *stream; /*!< Stream itself. */
struct ast_filestream *vstream; /*!< Video Stream itself. */
ast_timing_func_t timingfunc;
void *timingdata;
struct ast_pbx *pbx; /*!< PBX private structure for this channel */
struct ast_trans_pvt *writetrans; /*!< Write translation path */
struct ast_trans_pvt *readtrans; /*!< Read translation path */
struct ast_audiohook_list *audiohooks;
struct ast_framehook_list *framehooks;
struct ast_cdr *cdr; /*!< Call Detail Record */
struct ast_tone_zone *zone; /*!< Tone zone as set in indications.conf or
* in the CHANNEL dialplan function */
struct ast_channel_monitor *monitor; /*!< Channel monitoring */
ast_callid callid; /*!< Bound call identifier pointer */
#ifdef HAVE_EPOLL
struct ast_epoll_data *epfd_data[AST_MAX_FDS];
#endif
struct ao2_container *dialed_causes; /*!< Contains tech-specific and Asterisk cause data from dialed channels */
AST_DECLARE_STRING_FIELDS(
AST_STRING_FIELD(name); /*!< ASCII unique channel name */
AST_STRING_FIELD(language); /*!< Language requested for voice prompts */
AST_STRING_FIELD(musicclass); /*!< Default music class */
AST_STRING_FIELD(latest_musicclass); /*!< Latest active music class */
AST_STRING_FIELD(accountcode); /*!< Account code for billing */
AST_STRING_FIELD(peeraccount); /*!< Peer account code for billing */
AST_STRING_FIELD(userfield); /*!< Userfield for CEL billing */
AST_STRING_FIELD(call_forward); /*!< Where to forward to if asked to dial on this interface */
AST_STRING_FIELD(parkinglot); /*! Default parking lot, if empty, default parking lot */
AST_STRING_FIELD(hangupsource); /*! Who is responsible for hanging up this channel */
AST_STRING_FIELD(dialcontext); /*!< Dial: Extension context that we were called from */
);
struct ast_channel_id uniqueid; /*!< Unique Channel Identifier - can be specified on creation */
struct ast_channel_id linkedid; /*!< Linked Channel Identifier - oldest propagated when bridged */
struct timeval whentohangup; /*!< Non-zero, set to actual time when channel is to be hung up */
pthread_t blocker; /*!< If anyone is blocking, this is them */
/*!
* \brief Dialed/Called information.
* \note Set on incoming channels to indicate the originally dialed party.
* \note Dialed Number Identifier (DNID)
*/
struct ast_party_dialed dialed;
/*!
* \brief Channel Caller ID information.
* \note The caller id information is the caller id of this
* channel when it is used to initiate a call.
*/
struct ast_party_caller caller;
/*!
* \brief Channel Connected Line ID information.
* \note The connected line information identifies the channel
* connected/bridged to this channel.
*/
struct ast_party_connected_line connected;
/*!
* \brief Channel Connected Line ID information that was last indicated.
*/
struct ast_party_connected_line connected_indicated;
/*! \brief Redirecting/Diversion information */
struct ast_party_redirecting redirecting;
struct ast_frame dtmff; /*!< DTMF frame */
struct varshead varshead; /*!< A linked list for channel variables. See \ref AstChanVar */
ast_group_t callgroup; /*!< Call group for call pickups */
ast_group_t pickupgroup; /*!< Pickup group - which calls groups can be picked up? */
struct ast_namedgroups *named_callgroups; /*!< Named call group for call pickups */
struct ast_namedgroups *named_pickupgroups; /*!< Named pickup group - which call groups can be picked up? */
struct timeval creationtime; /*!< The time of channel creation */
struct timeval answertime; /*!< The time the channel was answered */
struct ast_readq_list readq;
struct ast_jb jb; /*!< The jitterbuffer state */
struct timeval dtmf_tv; /*!< The time that an in process digit began, or the last digit ended */
struct ast_hangup_handler_list hangup_handlers;/*!< Hangup handlers on the channel. */
struct ast_datastore_list datastores; /*!< Data stores on the channel */
struct ast_autochan_list autochans; /*!< Autochans on the channel */
unsigned long insmpl; /*!< Track the read/written samples for monitor use */
unsigned long outsmpl; /*!< Track the read/written samples for monitor use */
int fds[AST_MAX_FDS]; /*!< File descriptors for channel -- Drivers will poll on
* these file descriptors, so at least one must be non -1.
* See \arg \ref AstFileDesc */
int softhangup; /*!< Whether or not we have been hung up... Do not set this value
* directly, use ast_softhangup() */
int unbridged; /*!< If non-zero, the bridge core needs to re-evaluate the current
bridging technology which is in use by this channel's bridge. */
int fdno; /*!< Which fd had an event detected on */
int streamid; /*!< For streaming playback, the schedule ID */
int vstreamid; /*!< For streaming video playback, the schedule ID */
struct ast_format *oldwriteformat; /*!< Original writer format */
int timingfd; /*!< Timing fd */
enum ast_channel_state state; /*!< State of line -- Don't write directly, use ast_setstate() */
int rings; /*!< Number of rings so far */
int priority; /*!< Dialplan: Current extension priority */
int macropriority; /*!< Macro: Current non-macro priority. See app_macro.c */
int amaflags; /*!< Set BEFORE PBX is started to determine AMA flags */
enum ast_channel_adsicpe adsicpe; /*!< Whether or not ADSI is detected on CPE */
unsigned int fin; /*!< Frames in counters. The high bit is a debug mask, so
* the counter is only in the remaining bits */
unsigned int fout; /*!< Frames out counters. The high bit is a debug mask, so
* the counter is only in the remaining bits */
int hangupcause; /*!< Why is the channel hanged up. See causes.h */
unsigned int finalized:1; /*!< Whether or not the channel has been successfully allocated */
struct ast_flags flags; /*!< channel flags of AST_FLAG_ type */
int alertpipe[2];
struct ast_format_cap *nativeformats; /*!< Kinds of data this channel can natively handle */
struct ast_format *readformat; /*!< Requested read format (after translation) */
struct ast_format *writeformat; /*!< Requested write format (before translation) */
struct ast_format *rawreadformat; /*!< Raw read format (before translation) */
struct ast_format *rawwriteformat; /*!< Raw write format (after translation) */
unsigned int emulate_dtmf_duration; /*!< Number of ms left to emulate DTMF for */
#ifdef HAVE_EPOLL
int epfd;
#endif
int visible_indication; /*!< Indication currently playing on the channel */
int hold_state; /*!< Current Hold/Unhold state */
unsigned short transfercapability; /*!< ISDN Transfer Capability - AST_FLAG_DIGITAL is not enough */
struct ast_bridge *bridge; /*!< Bridge this channel is participating in */
struct ast_bridge_channel *bridge_channel;/*!< The bridge_channel this channel is linked with. */
struct ast_timer *timer; /*!< timer object that provided timingfd */
char context[AST_MAX_CONTEXT]; /*!< Dialplan: Current extension context */
char exten[AST_MAX_EXTENSION]; /*!< Dialplan: Current extension number */
char macrocontext[AST_MAX_CONTEXT]; /*!< Macro: Current non-macro context. See app_macro.c */
char macroexten[AST_MAX_EXTENSION]; /*!< Macro: Current non-macro extension. See app_macro.c */
char dtmf_digit_to_emulate; /*!< Digit being emulated */
char sending_dtmf_digit; /*!< Digit this channel is currently sending out. (zero if not sending) */
struct timeval sending_dtmf_tv; /*!< The time this channel started sending the current digit. (Invalid if sending_dtmf_digit is zero.) */
struct stasis_cp_single *topics; /*!< Topic for all channel's events */
struct stasis_forward *endpoint_forward; /*!< Subscription for event forwarding to endpoint's topic */
struct stasis_forward *endpoint_cache_forward; /*!< Subscription for cache updates to endpoint's topic */
};
/*! \brief The monotonically increasing integer counter for channel uniqueids */
static int uniqueint;
/* AST_DATA definitions, which will probably have to be re-thought since the channel will be opaque */
#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
#define DATA_EXPORT_CALLERID(MEMBER) \
MEMBER(ast_callerid, cid_dnid, AST_DATA_STRING) \
MEMBER(ast_callerid, cid_num, AST_DATA_STRING) \
MEMBER(ast_callerid, cid_name, AST_DATA_STRING) \
MEMBER(ast_callerid, cid_ani, AST_DATA_STRING) \
MEMBER(ast_callerid, cid_pres, AST_DATA_INTEGER) \
MEMBER(ast_callerid, cid_ani2, AST_DATA_INTEGER) \
MEMBER(ast_callerid, cid_tag, AST_DATA_STRING)
AST_DATA_STRUCTURE(ast_callerid, DATA_EXPORT_CALLERID);
#endif
#define DATA_EXPORT_CHANNEL(MEMBER) \
MEMBER(ast_channel, blockproc, AST_DATA_STRING) \
MEMBER(ast_channel, appl, AST_DATA_STRING) \
MEMBER(ast_channel, data, AST_DATA_STRING) \
MEMBER(ast_channel, name, AST_DATA_STRING) \
MEMBER(ast_channel, language, AST_DATA_STRING) \
MEMBER(ast_channel, musicclass, AST_DATA_STRING) \
MEMBER(ast_channel, accountcode, AST_DATA_STRING) \
MEMBER(ast_channel, peeraccount, AST_DATA_STRING) \
MEMBER(ast_channel, userfield, AST_DATA_STRING) \
MEMBER(ast_channel, call_forward, AST_DATA_STRING) \
MEMBER(ast_channel, parkinglot, AST_DATA_STRING) \
MEMBER(ast_channel, hangupsource, AST_DATA_STRING) \
MEMBER(ast_channel, dialcontext, AST_DATA_STRING) \
MEMBER(ast_channel, rings, AST_DATA_INTEGER) \
MEMBER(ast_channel, priority, AST_DATA_INTEGER) \
MEMBER(ast_channel, macropriority, AST_DATA_INTEGER) \
MEMBER(ast_channel, adsicpe, AST_DATA_INTEGER) \
MEMBER(ast_channel, fin, AST_DATA_UNSIGNED_INTEGER) \
MEMBER(ast_channel, fout, AST_DATA_UNSIGNED_INTEGER) \
MEMBER(ast_channel, emulate_dtmf_duration, AST_DATA_UNSIGNED_INTEGER) \
MEMBER(ast_channel, visible_indication, AST_DATA_INTEGER) \
MEMBER(ast_channel, context, AST_DATA_STRING) \
MEMBER(ast_channel, exten, AST_DATA_STRING) \
MEMBER(ast_channel, macrocontext, AST_DATA_STRING) \
MEMBER(ast_channel, macroexten, AST_DATA_STRING)
AST_DATA_STRUCTURE(ast_channel, DATA_EXPORT_CHANNEL);
static void channel_data_add_flags(struct ast_data *tree,
struct ast_channel *chan)
{
ast_data_add_bool(tree, "DEFER_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEFER_DTMF));
ast_data_add_bool(tree, "WRITE_INT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_WRITE_INT));
ast_data_add_bool(tree, "BLOCKING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BLOCKING));
ast_data_add_bool(tree, "ZOMBIE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ZOMBIE));
ast_data_add_bool(tree, "EXCEPTION", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EXCEPTION));
ast_data_add_bool(tree, "MOH", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MOH));
ast_data_add_bool(tree, "SPYING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_SPYING));
ast_data_add_bool(tree, "IN_AUTOLOOP", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_AUTOLOOP));
ast_data_add_bool(tree, "OUTGOING", ast_test_flag(ast_channel_flags(chan), AST_FLAG_OUTGOING));
ast_data_add_bool(tree, "IN_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_IN_DTMF));
ast_data_add_bool(tree, "EMULATE_DTMF", ast_test_flag(ast_channel_flags(chan), AST_FLAG_EMULATE_DTMF));
ast_data_add_bool(tree, "END_DTMF_ONLY", ast_test_flag(ast_channel_flags(chan), AST_FLAG_END_DTMF_ONLY));
ast_data_add_bool(tree, "MASQ_NOSTREAM", ast_test_flag(ast_channel_flags(chan), AST_FLAG_MASQ_NOSTREAM));
ast_data_add_bool(tree, "BRIDGE_HANGUP_RUN", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_HANGUP_RUN));
ast_data_add_bool(tree, "DISABLE_WORKAROUNDS", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_WORKAROUNDS));
ast_data_add_bool(tree, "DISABLE_DEVSTATE_CACHE", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DISABLE_DEVSTATE_CACHE));
ast_data_add_bool(tree, "BRIDGE_DUAL_REDIRECT_WAIT", ast_test_flag(ast_channel_flags(chan), AST_FLAG_BRIDGE_DUAL_REDIRECT_WAIT));
ast_data_add_bool(tree, "ORIGINATED", ast_test_flag(ast_channel_flags(chan), AST_FLAG_ORIGINATED));
ast_data_add_bool(tree, "DEAD", ast_test_flag(ast_channel_flags(chan), AST_FLAG_DEAD));
}
int ast_channel_data_add_structure(struct ast_data *tree,
struct ast_channel *chan, int add_bridged)
{
struct ast_data *data_bridged;
struct ast_data *data_cdr;
struct ast_data *data_flags;
struct ast_data *data_zones;
struct ast_data *enum_node;
struct ast_data *data_softhangup;
#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
struct ast_data *data_callerid;
char value_str[100];
#endif
if (!tree) {
return -1;
}
ast_data_add_structure(ast_channel, tree, chan);
if (add_bridged) {
RAII_VAR(struct ast_channel *, bc, ast_channel_bridge_peer(chan), ast_channel_cleanup);
if (bc) {
data_bridged = ast_data_add_node(tree, "bridged");
if (!data_bridged) {
return -1;
}
ast_channel_data_add_structure(data_bridged, bc, 0);
}
}
ast_data_add_str(tree, "uniqueid", ast_channel_uniqueid(chan));
ast_data_add_str(tree, "linkedid", ast_channel_linkedid(chan));
ast_data_add_codec(tree, "oldwriteformat", ast_channel_oldwriteformat(chan));
ast_data_add_codec(tree, "readformat", ast_channel_readformat(chan));
ast_data_add_codec(tree, "writeformat", ast_channel_writeformat(chan));
ast_data_add_codec(tree, "rawreadformat", ast_channel_rawreadformat(chan));
ast_data_add_codec(tree, "rawwriteformat", ast_channel_rawwriteformat(chan));
ast_data_add_codecs(tree, "nativeformats", ast_channel_nativeformats(chan));
/* state */
enum_node = ast_data_add_node(tree, "state");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_state2str(ast_channel_state(chan)));
ast_data_add_int(enum_node, "value", ast_channel_state(chan));
/* hangupcause */
enum_node = ast_data_add_node(tree, "hangupcause");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_cause2str(ast_channel_hangupcause(chan)));
ast_data_add_int(enum_node, "value", ast_channel_hangupcause(chan));
/* amaflags */
enum_node = ast_data_add_node(tree, "amaflags");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_channel_amaflags2string(ast_channel_amaflags(chan)));
ast_data_add_int(enum_node, "value", ast_channel_amaflags(chan));
/* transfercapability */
enum_node = ast_data_add_node(tree, "transfercapability");
if (!enum_node) {
return -1;
}
ast_data_add_str(enum_node, "text", ast_transfercapability2str(ast_channel_transfercapability(chan)));
ast_data_add_int(enum_node, "value", ast_channel_transfercapability(chan));
/* _softphangup */
data_softhangup = ast_data_add_node(tree, "softhangup");
if (!data_softhangup) {
return -1;
}
ast_data_add_bool(data_softhangup, "dev", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_DEV);
ast_data_add_bool(data_softhangup, "asyncgoto", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO);
ast_data_add_bool(data_softhangup, "shutdown", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_SHUTDOWN);
ast_data_add_bool(data_softhangup, "timeout", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_TIMEOUT);
ast_data_add_bool(data_softhangup, "appunload", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_APPUNLOAD);
ast_data_add_bool(data_softhangup, "explicit", ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_EXPLICIT);
/* channel flags */
data_flags = ast_data_add_node(tree, "flags");
if (!data_flags) {
return -1;
}
channel_data_add_flags(data_flags, chan);
ast_data_add_uint(tree, "timetohangup", ast_channel_whentohangup(chan)->tv_sec);
#if 0 /* XXX AstData: ast_callerid no longer exists. (Equivalent code not readily apparent.) */
/* callerid */
data_callerid = ast_data_add_node(tree, "callerid");
if (!data_callerid) {
return -1;
}
ast_data_add_structure(ast_callerid, data_callerid, &(chan->cid));
/* insert the callerid ton */
enum_node = ast_data_add_node(data_callerid, "cid_ton");
if (!enum_node) {
return -1;
}
ast_data_add_int(enum_node, "value", chan->cid.cid_ton);
snprintf(value_str, sizeof(value_str), "TON: %s/Plan: %s",
party_number_ton2str(chan->cid.cid_ton),
party_number_plan2str(chan->cid.cid_ton));
ast_data_add_str(enum_node, "text", value_str);
#endif
/* tone zone */
if (ast_channel_zone(chan)) {
data_zones = ast_data_add_node(tree, "zone");
if (!data_zones) {
return -1;
}
ast_tone_zone_data_add_structure(data_zones, ast_channel_zone(chan));
}
/* insert cdr */
data_cdr = ast_data_add_node(tree, "cdr");
if (!data_cdr) {
return -1;
}
return 0;
}
int ast_channel_data_cmp_structure(const struct ast_data_search *tree,
struct ast_channel *chan, const char *structure_name)
{
return ast_data_search_cmp_structure(tree, ast_channel, chan, structure_name);
}
/* ACCESSORS */
#define DEFINE_STRINGFIELD_SETTERS_FOR(field, publish, assert_on_null) \
void ast_channel_##field##_set(struct ast_channel *chan, const char *value) \
{ \
if ((assert_on_null)) ast_assert(!ast_strlen_zero(value)); \
if (!strcmp(value, chan->field)) return; \
ast_string_field_set(chan, field, value); \
if (publish && ast_channel_internal_is_finalized(chan)) ast_channel_publish_snapshot(chan); \
} \
\
void ast_channel_##field##_build_va(struct ast_channel *chan, const char *fmt, va_list ap) \
{ \
ast_string_field_build_va(chan, field, fmt, ap); \
if (publish && ast_channel_internal_is_finalized(chan)) ast_channel_publish_snapshot(chan); \
} \
void ast_channel_##field##_build(struct ast_channel *chan, const char *fmt, ...) \
{ \
va_list ap; \
va_start(ap, fmt); \
ast_channel_##field##_build_va(chan, fmt, ap); \
va_end(ap); \
}
DEFINE_STRINGFIELD_SETTERS_FOR(name, 0, 1);
DEFINE_STRINGFIELD_SETTERS_FOR(language, 1, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(musicclass, 0, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(latest_musicclass, 0, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(accountcode, 1, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(peeraccount, 1, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(userfield, 0, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(call_forward, 0, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(parkinglot, 0, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(hangupsource, 0, 0);
DEFINE_STRINGFIELD_SETTERS_FOR(dialcontext, 0, 0);
#define DEFINE_STRINGFIELD_GETTER_FOR(field) const char *ast_channel_##field(const struct ast_channel *chan) \
{ \
return chan->field; \
}
DEFINE_STRINGFIELD_GETTER_FOR(name);
DEFINE_STRINGFIELD_GETTER_FOR(language);
DEFINE_STRINGFIELD_GETTER_FOR(musicclass);
DEFINE_STRINGFIELD_GETTER_FOR(latest_musicclass);
DEFINE_STRINGFIELD_GETTER_FOR(accountcode);
DEFINE_STRINGFIELD_GETTER_FOR(peeraccount);
DEFINE_STRINGFIELD_GETTER_FOR(userfield);
DEFINE_STRINGFIELD_GETTER_FOR(call_forward);
DEFINE_STRINGFIELD_GETTER_FOR(parkinglot);
DEFINE_STRINGFIELD_GETTER_FOR(hangupsource);
DEFINE_STRINGFIELD_GETTER_FOR(dialcontext);
const char *ast_channel_uniqueid(const struct ast_channel *chan)
{
ast_assert(chan->uniqueid.unique_id[0] != '\0');
return chan->uniqueid.unique_id;
}
const char *ast_channel_linkedid(const struct ast_channel *chan)
{
ast_assert(chan->linkedid.unique_id[0] != '\0');
return chan->linkedid.unique_id;
}
const char *ast_channel_appl(const struct ast_channel *chan)
{
return chan->appl;
}
void ast_channel_appl_set(struct ast_channel *chan, const char *value)
{
chan->appl = value;
}
const char *ast_channel_blockproc(const struct ast_channel *chan)
{
return chan->blockproc;
}
void ast_channel_blockproc_set(struct ast_channel *chan, const char *value)
{
chan->blockproc = value;
}
const char *ast_channel_data(const struct ast_channel *chan)
{
return chan->data;
}
void ast_channel_data_set(struct ast_channel *chan, const char *value)
{
chan->data = value;
}
const char *ast_channel_context(const struct ast_channel *chan)
{
return chan->context;
}
void ast_channel_context_set(struct ast_channel *chan, const char *value)
{
ast_copy_string(chan->context, value, sizeof(chan->context));
}
const char *ast_channel_exten(const struct ast_channel *chan)
{
return chan->exten;
}
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
{
ast_copy_string(chan->exten, value, sizeof(chan->exten));
}
const char *ast_channel_macrocontext(const struct ast_channel *chan)
{
return chan->macrocontext;
}
void ast_channel_macrocontext_set(struct ast_channel *chan, const char *value)
{
ast_copy_string(chan->macrocontext, value, sizeof(chan->macrocontext));
}
const char *ast_channel_macroexten(const struct ast_channel *chan)
{
return chan->macroexten;
}
void ast_channel_macroexten_set(struct ast_channel *chan, const char *value)
{
ast_copy_string(chan->macroexten, value, sizeof(chan->macroexten));
}
char ast_channel_dtmf_digit_to_emulate(const struct ast_channel *chan)
{
return chan->dtmf_digit_to_emulate;
}
void ast_channel_dtmf_digit_to_emulate_set(struct ast_channel *chan, char value)
{
chan->dtmf_digit_to_emulate = value;
}
char ast_channel_sending_dtmf_digit(const struct ast_channel *chan)
{
return chan->sending_dtmf_digit;
}
void ast_channel_sending_dtmf_digit_set(struct ast_channel *chan, char value)
{
chan->sending_dtmf_digit = value;
}
struct timeval ast_channel_sending_dtmf_tv(const struct ast_channel *chan)
{
return chan->sending_dtmf_tv;
}
void ast_channel_sending_dtmf_tv_set(struct ast_channel *chan, struct timeval value)
{
chan->sending_dtmf_tv = value;
}
enum ama_flags ast_channel_amaflags(const struct ast_channel *chan)
{
return chan->amaflags;
}
void ast_channel_amaflags_set(struct ast_channel *chan, enum ama_flags value)
{
if (chan->amaflags == value) {
return;
}
chan->amaflags = value;
ast_channel_publish_snapshot(chan);
}
#ifdef HAVE_EPOLL
int ast_channel_epfd(const struct ast_channel *chan)
{
return chan->epfd;
}
void ast_channel_epfd_set(struct ast_channel *chan, int value)
{
chan->epfd = value;
}
#endif
int ast_channel_fdno(const struct ast_channel *chan)
{
return chan->fdno;
}
void ast_channel_fdno_set(struct ast_channel *chan, int value)
{
chan->fdno = value;
}
int ast_channel_hangupcause(const struct ast_channel *chan)
{
return chan->hangupcause;
}
void ast_channel_hangupcause_set(struct ast_channel *chan, int value)
{
chan->hangupcause = value;
}
int ast_channel_macropriority(const struct ast_channel *chan)
{
return chan->macropriority;
}
void ast_channel_macropriority_set(struct ast_channel *chan, int value)
{
chan->macropriority = value;
}
int ast_channel_priority(const struct ast_channel *chan)
{
return chan->priority;
}
void ast_channel_priority_set(struct ast_channel *chan, int value)
{
chan->priority = value;
}
int ast_channel_rings(const struct ast_channel *chan)
{
return chan->rings;
}
void ast_channel_rings_set(struct ast_channel *chan, int value)
{
chan->rings = value;
}
int ast_channel_streamid(const struct ast_channel *chan)
{
return chan->streamid;
}
void ast_channel_streamid_set(struct ast_channel *chan, int value)
{
chan->streamid = value;
}
int ast_channel_timingfd(const struct ast_channel *chan)
{
return chan->timingfd;
}
void ast_channel_timingfd_set(struct ast_channel *chan, int value)
{
chan->timingfd = value;
}
int ast_channel_visible_indication(const struct ast_channel *chan)
{
return chan->visible_indication;
}
void ast_channel_visible_indication_set(struct ast_channel *chan, int value)
{
chan->visible_indication = value;
}
int ast_channel_hold_state(const struct ast_channel *chan)
{
return chan->hold_state;
}
void ast_channel_hold_state_set(struct ast_channel *chan, int value)
{
chan->hold_state = value;
}
int ast_channel_vstreamid(const struct ast_channel *chan)
{
return chan->vstreamid;
}
void ast_channel_vstreamid_set(struct ast_channel *chan, int value)
{
chan->vstreamid = value;
}
unsigned short ast_channel_transfercapability(const struct ast_channel *chan)
{
return chan->transfercapability;
}
void ast_channel_transfercapability_set(struct ast_channel *chan, unsigned short value)
{
chan->transfercapability = value;
}
unsigned int ast_channel_emulate_dtmf_duration(const struct ast_channel *chan)
{
return chan->emulate_dtmf_duration;
}
void ast_channel_emulate_dtmf_duration_set(struct ast_channel *chan, unsigned int value)
{
chan->emulate_dtmf_duration = value;
}
unsigned int ast_channel_fin(const struct ast_channel *chan)
{
return chan->fin;
}
void ast_channel_fin_set(struct ast_channel *chan, unsigned int value)
{
chan->fin = value;
}
unsigned int ast_channel_fout(const struct ast_channel *chan)
{
return chan->fout;
}
void ast_channel_fout_set(struct ast_channel *chan, unsigned int value)
{
chan->fout = value;
}
unsigned long ast_channel_insmpl(const struct ast_channel *chan)
{
return chan->insmpl;
}
void ast_channel_insmpl_set(struct ast_channel *chan, unsigned long value)
{
chan->insmpl = value;
}
unsigned long ast_channel_outsmpl(const struct ast_channel *chan)
{
return chan->outsmpl;
}
void ast_channel_outsmpl_set(struct ast_channel *chan, unsigned long value)
{
chan->outsmpl = value;
}
void *ast_channel_generatordata(const struct ast_channel *chan)
{
return chan->generatordata;
}
void ast_channel_generatordata_set(struct ast_channel *chan, void *value)
{
chan->generatordata = value;
}
void *ast_channel_music_state(const struct ast_channel *chan)
{
return chan->music_state;
}
void ast_channel_music_state_set(struct ast_channel *chan, void *value)
{
chan->music_state = value;
}
void *ast_channel_tech_pvt(const struct ast_channel *chan)
{
return chan->tech_pvt;
}
void ast_channel_tech_pvt_set(struct ast_channel *chan, void *value)
{
chan->tech_pvt = value;
}
void *ast_channel_timingdata(const struct ast_channel *chan)
{
return chan->timingdata;
}
void ast_channel_timingdata_set(struct ast_channel *chan, void *value)
{
chan->timingdata = value;
}
struct ast_audiohook_list *ast_channel_audiohooks(const struct ast_channel *chan)
{
return chan->audiohooks;
}
void ast_channel_audiohooks_set(struct ast_channel *chan, struct ast_audiohook_list *value)
{
chan->audiohooks = value;
}
struct ast_cdr *ast_channel_cdr(const struct ast_channel *chan)
{
return chan->cdr;
}
void ast_channel_cdr_set(struct ast_channel *chan, struct ast_cdr *value)
{
chan->cdr = value;
}
struct ast_channel *ast_channel_masq(const struct ast_channel *chan)
{
return chan->masq;
}
void ast_channel_masq_set(struct ast_channel *chan, struct ast_channel *value)
{
chan->masq = value;
}
struct ast_channel *ast_channel_masqr(const struct ast_channel *chan)
{
return chan->masqr;
}
void ast_channel_masqr_set(struct ast_channel *chan, struct ast_channel *value)
{
chan->masqr = value;
}
struct ast_channel_monitor *ast_channel_monitor(const struct ast_channel *chan)
{
return chan->monitor;
}
void ast_channel_monitor_set(struct ast_channel *chan, struct ast_channel_monitor *value)
{
chan->monitor = value;
}
struct ast_filestream *ast_channel_stream(const struct ast_channel *chan)
{
return chan->stream;
}
void ast_channel_stream_set(struct ast_channel *chan, struct ast_filestream *value)
{
chan->stream = value;
}
struct ast_filestream *ast_channel_vstream(const struct ast_channel *chan)
{
return chan->vstream;
}
void ast_channel_vstream_set(struct ast_channel *chan, struct ast_filestream *value)
{
chan->vstream = value;
}
struct ast_format_cap *ast_channel_nativeformats(const struct ast_channel *chan)
{
return chan->nativeformats;
}
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
{
ao2_replace(chan->nativeformats, value);
}
struct ast_framehook_list *ast_channel_framehooks(const struct ast_channel *chan)
{
return chan->framehooks;
}
void ast_channel_framehooks_set(struct ast_channel *chan, struct ast_framehook_list *value)
{
chan->framehooks = value;
}
struct ast_generator *ast_channel_generator(const struct ast_channel *chan)
{
return chan->generator;
}
void ast_channel_generator_set(struct ast_channel *chan, struct ast_generator *value)
{
chan->generator = value;
}
struct ast_pbx *ast_channel_pbx(const struct ast_channel *chan)
{
return chan->pbx;
}
void ast_channel_pbx_set(struct ast_channel *chan, struct ast_pbx *value)
{
chan->pbx = value;
}
struct ast_sched_context *ast_channel_sched(const struct ast_channel *chan)
{
return chan->sched;
}
void ast_channel_sched_set(struct ast_channel *chan, struct ast_sched_context *value)
{
chan->sched = value;
}
struct ast_timer *ast_channel_timer(const struct ast_channel *chan)
{
return chan->timer;
}
void ast_channel_timer_set(struct ast_channel *chan, struct ast_timer *value)
{
chan->timer = value;
}
struct ast_tone_zone *ast_channel_zone(const struct ast_channel *chan)
{
return chan->zone;
}
void ast_channel_zone_set(struct ast_channel *chan, struct ast_tone_zone *value)
{
chan->zone = value;
}
struct ast_trans_pvt *ast_channel_readtrans(const struct ast_channel *chan)
{
return chan->readtrans;
}
void ast_channel_readtrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
{
chan->readtrans = value;
}
struct ast_trans_pvt *ast_channel_writetrans(const struct ast_channel *chan)
{
return chan->writetrans;
}
void ast_channel_writetrans_set(struct ast_channel *chan, struct ast_trans_pvt *value)
{
chan->writetrans = value;
}
const struct ast_channel_tech *ast_channel_tech(const struct ast_channel *chan)
{
return chan->tech;
}
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
{
chan->tech = value;
}
enum ast_channel_adsicpe ast_channel_adsicpe(const struct ast_channel *chan)
{
return chan->adsicpe;
}
void ast_channel_adsicpe_set(struct ast_channel *chan, enum ast_channel_adsicpe value)
{
chan->adsicpe = value;
}
enum ast_channel_state ast_channel_state(const struct ast_channel *chan)
{
return chan->state;
}
ast_callid ast_channel_callid(const struct ast_channel *chan)
{
return chan->callid;
}
void ast_channel_callid_set(struct ast_channel *chan, ast_callid callid)
{
char call_identifier_from[AST_CALLID_BUFFER_LENGTH];
char call_identifier_to[AST_CALLID_BUFFER_LENGTH];
call_identifier_from[0] = '\0';
ast_callid_strnprint(call_identifier_to, sizeof(call_identifier_to), callid);
if (chan->callid) {
ast_callid_strnprint(call_identifier_from, sizeof(call_identifier_from), chan->callid);
ast_debug(3, "Channel Call ID changing from %s to %s\n", call_identifier_from, call_identifier_to);
}
chan->callid = callid;
ast_test_suite_event_notify("CallIDChange",
"State: CallIDChange\r\n"
"Channel: %s\r\n"
"CallID: %s\r\n"
"PriorCallID: %s",
ast_channel_name(chan),
call_identifier_to,
call_identifier_from);
}
void ast_channel_state_set(struct ast_channel *chan, enum ast_channel_state value)
{
chan->state = value;
}
void ast_channel_set_oldwriteformat(struct ast_channel *chan, struct ast_format *format)
{
ao2_replace(chan->oldwriteformat, format);
}
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
{
ao2_replace(chan->rawreadformat, format);
}
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
{
ao2_replace(chan->rawwriteformat, format);
}
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
{
ao2_replace(chan->readformat, format);
}
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
{
ao2_replace(chan->writeformat, format);
}
struct ast_format *ast_channel_oldwriteformat(struct ast_channel *chan)
{
return chan->oldwriteformat;
}
struct ast_format *ast_channel_rawreadformat(struct ast_channel *chan)
{
return chan->rawreadformat;
}
struct ast_format *ast_channel_rawwriteformat(struct ast_channel *chan)
{
return chan->rawwriteformat;
}
struct ast_format *ast_channel_readformat(struct ast_channel *chan)
{
return chan->readformat;
}
struct ast_format *ast_channel_writeformat(struct ast_channel *chan)
{
return chan->writeformat;
}
struct ast_hangup_handler_list *ast_channel_hangup_handlers(struct ast_channel *chan)
{
return &chan->hangup_handlers;
}
struct ast_datastore_list *ast_channel_datastores(struct ast_channel *chan)
{
return &chan->datastores;
}
struct ast_autochan_list *ast_channel_autochans(struct ast_channel *chan)
{
return &chan->autochans;
}
struct ast_readq_list *ast_channel_readq(struct ast_channel *chan)
{
return &chan->readq;
}
struct ast_frame *ast_channel_dtmff(struct ast_channel *chan)
{
return &chan->dtmff;
}
struct ast_jb *ast_channel_jb(struct ast_channel *chan)
{
return &chan->jb;
}
struct ast_party_caller *ast_channel_caller(struct ast_channel *chan)
{
return &chan->caller;
}
struct ast_party_connected_line *ast_channel_connected(struct ast_channel *chan)
{
return &chan->connected;
}
struct ast_party_connected_line *ast_channel_connected_indicated(struct ast_channel *chan)
{
return &chan->connected_indicated;
}
struct ast_party_id ast_channel_connected_effective_id(struct ast_channel *chan)
{
return ast_party_id_merge(&chan->connected.id, &chan->connected.priv);
}
struct ast_party_dialed *ast_channel_dialed(struct ast_channel *chan)
{
return &chan->dialed;
}
struct ast_party_redirecting *ast_channel_redirecting(struct ast_channel *chan)
{
return &chan->redirecting;
}
struct ast_party_id ast_channel_redirecting_effective_orig(struct ast_channel *chan)
{
return ast_party_id_merge(&chan->redirecting.orig, &chan->redirecting.priv_orig);
}
struct ast_party_id ast_channel_redirecting_effective_from(struct ast_channel *chan)
{
return ast_party_id_merge(&chan->redirecting.from, &chan->redirecting.priv_from);
}
struct ast_party_id ast_channel_redirecting_effective_to(struct ast_channel *chan)
{
return ast_party_id_merge(&chan->redirecting.to, &chan->redirecting.priv_to);
}
struct timeval *ast_channel_dtmf_tv(struct ast_channel *chan)
{
return &chan->dtmf_tv;
}
struct timeval *ast_channel_whentohangup(struct ast_channel *chan)
{
return &chan->whentohangup;
}
struct varshead *ast_channel_varshead(struct ast_channel *chan)
{
return &chan->varshead;
}
void ast_channel_dtmff_set(struct ast_channel *chan, struct ast_frame *value)
{
chan->dtmff = *value;
}
void ast_channel_jb_set(struct ast_channel *chan, struct ast_jb *value)
{
chan->jb = *value;
}
void ast_channel_caller_set(struct ast_channel *chan, struct ast_party_caller *value)
{
chan->caller = *value;
}
void ast_channel_connected_set(struct ast_channel *chan, struct ast_party_connected_line *value)
{
chan->connected = *value;
}
void ast_channel_dialed_set(struct ast_channel *chan, struct ast_party_dialed *value)
{
chan->dialed = *value;
}
void ast_channel_redirecting_set(struct ast_channel *chan, struct ast_party_redirecting *value)
{
chan->redirecting = *value;
}
void ast_channel_dtmf_tv_set(struct ast_channel *chan, struct timeval *value)
{
chan->dtmf_tv = *value;
}
void ast_channel_whentohangup_set(struct ast_channel *chan, struct timeval *value)
{
chan->whentohangup = *value;
}
void ast_channel_varshead_set(struct ast_channel *chan, struct varshead *value)
{
chan->varshead = *value;
}
struct timeval ast_channel_creationtime(struct ast_channel *chan)
{
return chan->creationtime;
}
void ast_channel_creationtime_set(struct ast_channel *chan, struct timeval *value)
{
chan->creationtime = *value;
}
struct timeval ast_channel_answertime(struct ast_channel *chan)
{
return chan->answertime;
}
void ast_channel_answertime_set(struct ast_channel *chan, struct timeval *value)
{
chan->answertime = *value;
}
/* Evil softhangup accessors */
int ast_channel_softhangup_internal_flag(struct ast_channel *chan)
{
return chan->softhangup;
}
void ast_channel_softhangup_internal_flag_set(struct ast_channel *chan, int value)
{
chan->softhangup = value;
}
void ast_channel_softhangup_internal_flag_add(struct ast_channel *chan, int value)
{
chan->softhangup |= value;
}
void ast_channel_softhangup_internal_flag_clear(struct ast_channel *chan, int value)
{
chan ->softhangup &= ~value;
}
int ast_channel_unbridged_nolock(struct ast_channel *chan)
{
return chan->unbridged;
}
int ast_channel_unbridged(struct ast_channel *chan)
{
int res;
ast_channel_lock(chan);
res = ast_channel_unbridged_nolock(chan);
ast_channel_unlock(chan);
return res;
}
void ast_channel_set_unbridged_nolock(struct ast_channel *chan, int value)
{
chan->unbridged = value;
ast_queue_frame(chan, &ast_null_frame);
}
void ast_channel_set_unbridged(struct ast_channel *chan, int value)
{
ast_channel_lock(chan);
ast_channel_set_unbridged_nolock(chan, value);
ast_channel_unlock(chan);
}
void ast_channel_callid_cleanup(struct ast_channel *chan)
{
chan->callid = 0;
}
/* Typedef accessors */
ast_group_t ast_channel_callgroup(const struct ast_channel *chan)
{
return chan->callgroup;
}
void ast_channel_callgroup_set(struct ast_channel *chan, ast_group_t value)
{
chan->callgroup = value;
}
ast_group_t ast_channel_pickupgroup(const struct ast_channel *chan)
{
return chan->pickupgroup;
}
void ast_channel_pickupgroup_set(struct ast_channel *chan, ast_group_t value)
{
chan->pickupgroup = value;
}
struct ast_namedgroups *ast_channel_named_callgroups(const struct ast_channel *chan)
{
return chan->named_callgroups;
}
void ast_channel_named_callgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
{
ast_unref_namedgroups(chan->named_callgroups);
chan->named_callgroups = ast_ref_namedgroups(value);
}
struct ast_namedgroups *ast_channel_named_pickupgroups(const struct ast_channel *chan)
{
return chan->named_pickupgroups;
}
void ast_channel_named_pickupgroups_set(struct ast_channel *chan, struct ast_namedgroups *value)
{
ast_unref_namedgroups(chan->named_pickupgroups);
chan->named_pickupgroups = ast_ref_namedgroups(value);
}
/* Alertpipe functions */
int ast_channel_alert_write(struct ast_channel *chan)
{
char blah = 0x7F;
return ast_channel_alert_writable(chan) && write(chan->alertpipe[1], &blah, sizeof(blah)) != sizeof(blah);
}
ast_alert_status_t ast_channel_internal_alert_read(struct ast_channel *chan)
{
int flags;
char blah;
if (!ast_channel_internal_alert_readable(chan)) {
return AST_ALERT_NOT_READABLE;
}
flags = fcntl(chan->alertpipe[0], F_GETFL);
/* For some odd reason, the alertpipe occasionally loses nonblocking status,
* which immediately causes a deadlock scenario. Detect and prevent this. */
if ((flags & O_NONBLOCK) == 0) {
ast_log(LOG_ERROR, "Alertpipe on channel %s lost O_NONBLOCK?!!\n", ast_channel_name(chan));
if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return AST_ALERT_READ_FATAL;
}
}
if (read(chan->alertpipe[0], &blah, sizeof(blah)) < 0) {
if (errno != EINTR && errno != EAGAIN) {
ast_log(LOG_WARNING, "read() failed: %s\n", strerror(errno));
return AST_ALERT_READ_FAIL;
}
}
return AST_ALERT_READ_SUCCESS;
}
int ast_channel_alert_writable(struct ast_channel *chan)
{
return chan->alertpipe[1] > -1;
}
int ast_channel_internal_alert_readable(struct ast_channel *chan)
{
return chan->alertpipe[0] > -1;
}
void ast_channel_internal_alertpipe_clear(struct ast_channel *chan)
{
chan->alertpipe[0] = chan->alertpipe[1] = -1;
}
void ast_channel_internal_alertpipe_close(struct ast_channel *chan)
{
if (ast_channel_internal_alert_readable(chan)) {
close(chan->alertpipe[0]);
}
if (ast_channel_alert_writable(chan)) {
close(chan->alertpipe[1]);
}
}
int ast_channel_internal_alertpipe_init(struct ast_channel *chan)
{
if (pipe(chan->alertpipe)) {
ast_log(LOG_WARNING, "Channel allocation failed: Can't create alert pipe! Try increasing max file descriptors with ulimit -n\n");
return -1;
} else {
int flags = fcntl(chan->alertpipe[0], F_GETFL);
if (fcntl(chan->alertpipe[0], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
flags = fcntl(chan->alertpipe[1], F_GETFL);
if (fcntl(chan->alertpipe[1], F_SETFL, flags | O_NONBLOCK) < 0) {
ast_log(LOG_WARNING, "Channel allocation failed: Unable to set alertpipe nonblocking! (%d: %s)\n", errno, strerror(errno));
return -1;
}
}
return 0;
}
int ast_channel_internal_alert_readfd(struct ast_channel *chan)
{
return chan->alertpipe[0];
}
void ast_channel_internal_alertpipe_swap(struct ast_channel *chan1, struct ast_channel *chan2)
{
int i;
for (i = 0; i < ARRAY_LEN(chan1->alertpipe); i++) {
SWAP(chan1->alertpipe[i], chan2->alertpipe[i]);
}
}
/* file descriptor array accessors */
void ast_channel_internal_fd_set(struct ast_channel *chan, int which, int value)
{
chan->fds[which] = value;
}
void ast_channel_internal_fd_clear(struct ast_channel *chan, int which)
{
ast_channel_internal_fd_set(chan, which, -1);
}
void ast_channel_internal_fd_clear_all(struct ast_channel *chan)
{
int i;
for (i = 0; i < AST_MAX_FDS; i++) {
ast_channel_internal_fd_clear(chan, i);
}
}
int ast_channel_fd(const struct ast_channel *chan, int which)
{
return chan->fds[which];
}
int ast_channel_fd_isset(const struct ast_channel *chan, int which)
{
return ast_channel_fd(chan, which) > -1;
}
#ifdef HAVE_EPOLL
struct ast_epoll_data *ast_channel_internal_epfd_data(const struct ast_channel *chan, int which)
{
return chan->epfd_data[which];
}
void ast_channel_internal_epfd_data_set(struct ast_channel *chan, int which , struct ast_epoll_data *value)
{
chan->epfd_data[which] = value;
}
#endif
pthread_t ast_channel_blocker(const struct ast_channel *chan)
{
return chan->blocker;
}
void ast_channel_blocker_set(struct ast_channel *chan, pthread_t value)
{
chan->blocker = value;
}
ast_timing_func_t ast_channel_timingfunc(const struct ast_channel *chan)
{
return chan->timingfunc;
}
void ast_channel_timingfunc_set(struct ast_channel *chan, ast_timing_func_t value)
{
chan->timingfunc = value;
}
struct ast_bridge *ast_channel_internal_bridge(const struct ast_channel *chan)
{
return chan->bridge;
}
void ast_channel_internal_bridge_set(struct ast_channel *chan, struct ast_bridge *value)
{
chan->bridge = value;
ast_channel_publish_snapshot(chan);
}
struct ast_bridge_channel *ast_channel_internal_bridge_channel(const struct ast_channel *chan)
{
return chan->bridge_channel;
}
void ast_channel_internal_bridge_channel_set(struct ast_channel *chan, struct ast_bridge_channel *value)
{
chan->bridge_channel = value;
}
struct ast_flags *ast_channel_flags(struct ast_channel *chan)
{
return &chan->flags;
}
static int collect_names_cb(void *obj, void *arg, int flags) {
struct ast_control_pvt_cause_code *cause_code = obj;
struct ast_str **str = arg;
ast_str_append(str, 0, "%s%s", (ast_str_strlen(*str) ? "," : ""), cause_code->chan_name);
return 0;
}
struct ast_str *ast_channel_dialed_causes_channels(const struct ast_channel *chan)
{
struct ast_str *chanlist = ast_str_create(128);
if (!chanlist) {
return NULL;
}
ao2_callback(chan->dialed_causes, 0, collect_names_cb, &chanlist);
return chanlist;
}
struct ast_control_pvt_cause_code *ast_channel_dialed_causes_find(const struct ast_channel *chan, const char *chan_name)
{
return ao2_find(chan->dialed_causes, chan_name, OBJ_KEY);
}
int ast_channel_dialed_causes_add(const struct ast_channel *chan, const struct ast_control_pvt_cause_code *cause_code, int datalen)
{
struct ast_control_pvt_cause_code *ao2_cause_code;
ao2_find(chan->dialed_causes, cause_code->chan_name, OBJ_KEY | OBJ_UNLINK | OBJ_NODATA);
ao2_cause_code = ao2_alloc(datalen, NULL);
if (ao2_cause_code) {
memcpy(ao2_cause_code, cause_code, datalen);
ao2_link(chan->dialed_causes, ao2_cause_code);
ao2_ref(ao2_cause_code, -1);
return 0;
} else {
return -1;
}
}
void ast_channel_dialed_causes_clear(const struct ast_channel *chan)
{
ao2_callback(chan->dialed_causes, OBJ_UNLINK | OBJ_NODATA | OBJ_MULTIPLE, NULL, NULL);
}
/* \brief Hash function for pvt cause code frames */
static int pvt_cause_hash_fn(const void *vpc, const int flags)
{
const struct ast_control_pvt_cause_code *pc = vpc;
return ast_str_hash(ast_tech_to_upper(ast_strdupa(pc->chan_name)));
}
/* \brief Comparison function for pvt cause code frames */
static int pvt_cause_cmp_fn(void *obj, void *vstr, int flags)
{
struct ast_control_pvt_cause_code *pc = obj;
char *str = ast_tech_to_upper(ast_strdupa(vstr));
char *pc_str = ast_tech_to_upper(ast_strdupa(pc->chan_name));
return !strcmp(pc_str, str) ? CMP_MATCH | CMP_STOP : 0;
}
#define DIALED_CAUSES_BUCKETS 37
struct ast_channel *__ast_channel_internal_alloc(void (*destructor)(void *obj), const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *file, int line, const char *function)
{
struct ast_channel *tmp;
tmp = __ao2_alloc(sizeof(*tmp), destructor,
AO2_ALLOC_OPT_LOCK_MUTEX, "", file, line, function);
if (!tmp) {
return NULL;
}
if ((ast_string_field_init(tmp, 128))) {
return ast_channel_unref(tmp);
}
if (!(tmp->dialed_causes = ao2_container_alloc(DIALED_CAUSES_BUCKETS, pvt_cause_hash_fn, pvt_cause_cmp_fn))) {
return ast_channel_unref(tmp);
}
/* set the creation time in the uniqueid */
tmp->uniqueid.creation_time = time(NULL);
tmp->uniqueid.creation_unique = ast_atomic_fetchadd_int(&uniqueint, 1);
/* use provided id or default to historical {system-}time.# format */
if (assignedids && !ast_strlen_zero(assignedids->uniqueid)) {
ast_copy_string(tmp->uniqueid.unique_id, assignedids->uniqueid, sizeof(tmp->uniqueid.unique_id));
} else if (ast_strlen_zero(ast_config_AST_SYSTEM_NAME)) {
snprintf(tmp->uniqueid.unique_id, sizeof(tmp->uniqueid.unique_id), "%li.%d",
(long)(tmp->uniqueid.creation_time),
tmp->uniqueid.creation_unique);
} else {
snprintf(tmp->uniqueid.unique_id, sizeof(tmp->uniqueid.unique_id), "%s-%li.%d",
ast_config_AST_SYSTEM_NAME,
(long)(tmp->uniqueid.creation_time),
tmp->uniqueid.creation_unique);
}
/* copy linked id from parent channel if known */
if (requestor) {
tmp->linkedid = requestor->linkedid;
} else {
tmp->linkedid = tmp->uniqueid;
}
return tmp;
}
struct ast_channel *ast_channel_internal_oldest_linkedid(struct ast_channel *a, struct ast_channel *b)
{
ast_assert(a->linkedid.creation_time != 0);
ast_assert(b->linkedid.creation_time != 0);
if (a->linkedid.creation_time < b->linkedid.creation_time) {
return a;
}
if (b->linkedid.creation_time < a->linkedid.creation_time) {
return b;
}
if (a->linkedid.creation_unique < b->linkedid.creation_unique) {
return a;
}
return b;
}
void ast_channel_internal_copy_linkedid(struct ast_channel *dest, struct ast_channel *source)
{
if (dest->linkedid.creation_time == source->linkedid.creation_time
&& dest->linkedid.creation_unique == source->linkedid.creation_unique
&& !strcmp(dest->linkedid.unique_id, source->linkedid.unique_id)) {
return;
}
dest->linkedid = source->linkedid;
ast_channel_publish_snapshot(dest);
}
void ast_channel_internal_swap_uniqueid_and_linkedid(struct ast_channel *a, struct ast_channel *b)
{
struct ast_channel_id temp;
temp = a->uniqueid;
a->uniqueid = b->uniqueid;
b->uniqueid = temp;
temp = a->linkedid;
a->linkedid = b->linkedid;
b->linkedid = temp;
}
void ast_channel_internal_swap_topics(struct ast_channel *a, struct ast_channel *b)
{
struct stasis_cp_single *temp;
temp = a->topics;
a->topics = b->topics;
b->topics = temp;
}
void ast_channel_internal_set_fake_ids(struct ast_channel *chan, const char *uniqueid, const char *linkedid)
{
ast_copy_string(chan->uniqueid.unique_id, uniqueid, sizeof(chan->uniqueid.unique_id));
ast_copy_string(chan->linkedid.unique_id, linkedid, sizeof(chan->linkedid.unique_id));
}
void ast_channel_internal_cleanup(struct ast_channel *chan)
{
if (chan->dialed_causes) {
ao2_t_ref(chan->dialed_causes, -1,
"done with dialed causes since the channel is going away");
chan->dialed_causes = NULL;
}
ast_string_field_free_memory(chan);
chan->endpoint_forward = stasis_forward_cancel(chan->endpoint_forward);
chan->endpoint_cache_forward = stasis_forward_cancel(chan->endpoint_cache_forward);
stasis_cp_single_unsubscribe(chan->topics);
chan->topics = NULL;
}
void ast_channel_internal_finalize(struct ast_channel *chan)
{
chan->finalized = 1;
}
int ast_channel_internal_is_finalized(struct ast_channel *chan)
{
return chan->finalized;
}
struct stasis_topic *ast_channel_topic(struct ast_channel *chan)
{
if (!chan) {
return ast_channel_topic_all();
}
return stasis_cp_single_topic(chan->topics);
}
struct stasis_topic *ast_channel_topic_cached(struct ast_channel *chan)
{
if (!chan) {
return ast_channel_topic_all_cached();
}
return stasis_cp_single_topic_cached(chan->topics);
}
int ast_channel_forward_endpoint(struct ast_channel *chan,
struct ast_endpoint *endpoint)
{
ast_assert(chan != NULL);
ast_assert(endpoint != NULL);
chan->endpoint_forward =
stasis_forward_all(ast_channel_topic(chan),
ast_endpoint_topic(endpoint));
if (!chan->endpoint_forward) {
return -1;
}
chan->endpoint_cache_forward = stasis_forward_all(ast_channel_topic_cached(chan),
ast_endpoint_topic(endpoint));
if (!chan->endpoint_cache_forward) {
chan->endpoint_forward = stasis_forward_cancel(chan->endpoint_forward);
return -1;
}
return 0;
}
int ast_channel_internal_setup_topics(struct ast_channel *chan)
{
const char *topic_name = chan->uniqueid.unique_id;
ast_assert(chan->topics == NULL);
if (ast_strlen_zero(topic_name)) {
topic_name = "<dummy-channel>";
}
chan->topics = stasis_cp_single_create(
ast_channel_cache_all(), topic_name);
if (!chan->topics) {
return -1;
}
return 0;
}
| leedm777/asterisk | main/channel_internal_api.c | C | gpl-2.0 | 52,802 |
/*
* Copyright (C) 2009 BuS Elektronik GmbH & Co. KG
* Jens Scharsig (esw@bus-elektronik.de)
*
* (C) Copyright 2003
* Author : Hamid Ikdoumi (Atmel)
* SPDX-License-Identifier: GPL-2.0+
*/
#include <common.h>
#include <asm/io.h>
#include <asm/arch/hardware.h>
#include <asm/arch/at91_emac.h>
#include <asm/arch/clk.h>
#include <asm/arch/at91_pio.h>
#include <net.h>
#include <netdev.h>
#include <malloc.h>
#include <miiphy.h>
#include <linux/mii.h>
#undef MII_DEBUG
#undef ET_DEBUG
#if (CONFIG_SYS_RX_ETH_BUFFER > 1024)
#error AT91 EMAC supports max 1024 RX buffers. \
Please decrease the CONFIG_SYS_RX_ETH_BUFFER value
#endif
#ifndef CONFIG_DRIVER_AT91EMAC_PHYADDR
#define CONFIG_DRIVER_AT91EMAC_PHYADDR 0
#endif
/* MDIO clock must not exceed 2.5 MHz, so enable MCK divider */
#if (AT91C_MASTER_CLOCK > 80000000)
#define HCLK_DIV AT91_EMAC_CFG_MCLK_64
#elif (AT91C_MASTER_CLOCK > 40000000)
#define HCLK_DIV AT91_EMAC_CFG_MCLK_32
#elif (AT91C_MASTER_CLOCK > 20000000)
#define HCLK_DIV AT91_EMAC_CFG_MCLK_16
#else
#define HCLK_DIV AT91_EMAC_CFG_MCLK_8
#endif
#ifdef ET_DEBUG
#define DEBUG_AT91EMAC 1
#else
#define DEBUG_AT91EMAC 0
#endif
#ifdef MII_DEBUG
#define DEBUG_AT91PHY 1
#else
#define DEBUG_AT91PHY 0
#endif
#ifndef CONFIG_DRIVER_AT91EMAC_QUIET
#define VERBOSEP 1
#else
#define VERBOSEP 0
#endif
#define RBF_ADDR 0xfffffffc
#define RBF_OWNER (1<<0)
#define RBF_WRAP (1<<1)
#define RBF_BROADCAST (1<<31)
#define RBF_MULTICAST (1<<30)
#define RBF_UNICAST (1<<29)
#define RBF_EXTERNAL (1<<28)
#define RBF_UNKNOWN (1<<27)
#define RBF_SIZE 0x07ff
#define RBF_LOCAL4 (1<<26)
#define RBF_LOCAL3 (1<<25)
#define RBF_LOCAL2 (1<<24)
#define RBF_LOCAL1 (1<<23)
#define RBF_FRAMEMAX CONFIG_SYS_RX_ETH_BUFFER
#define RBF_FRAMELEN 0x600
typedef struct {
unsigned long addr, size;
} rbf_t;
typedef struct {
rbf_t rbfdt[RBF_FRAMEMAX];
unsigned long rbindex;
} emac_device;
void at91emac_EnableMDIO(at91_emac_t *at91mac)
{
/* Mac CTRL reg set for MDIO enable */
writel(readl(&at91mac->ctl) | AT91_EMAC_CTL_MPE, &at91mac->ctl);
}
void at91emac_DisableMDIO(at91_emac_t *at91mac)
{
/* Mac CTRL reg set for MDIO disable */
writel(readl(&at91mac->ctl) & ~AT91_EMAC_CTL_MPE, &at91mac->ctl);
}
int at91emac_read(at91_emac_t *at91mac, unsigned char addr,
unsigned char reg, unsigned short *value)
{
unsigned long netstat;
at91emac_EnableMDIO(at91mac);
writel(AT91_EMAC_MAN_HIGH | AT91_EMAC_MAN_RW_R |
AT91_EMAC_MAN_REGA(reg) | AT91_EMAC_MAN_CODE_802_3 |
AT91_EMAC_MAN_PHYA(addr),
&at91mac->man);
do {
netstat = readl(&at91mac->sr);
debug_cond(DEBUG_AT91PHY, "poll SR %08lx\n", netstat);
} while (!(netstat & AT91_EMAC_SR_IDLE));
*value = readl(&at91mac->man) & AT91_EMAC_MAN_DATA_MASK;
at91emac_DisableMDIO(at91mac);
debug_cond(DEBUG_AT91PHY,
"AT91PHY read %p REG(%d)=%x\n", at91mac, reg, *value);
return 0;
}
int at91emac_write(at91_emac_t *at91mac, unsigned char addr,
unsigned char reg, unsigned short value)
{
unsigned long netstat;
debug_cond(DEBUG_AT91PHY,
"AT91PHY write %p REG(%d)=%p\n", at91mac, reg, &value);
at91emac_EnableMDIO(at91mac);
writel(AT91_EMAC_MAN_HIGH | AT91_EMAC_MAN_RW_W |
AT91_EMAC_MAN_REGA(reg) | AT91_EMAC_MAN_CODE_802_3 |
AT91_EMAC_MAN_PHYA(addr) | (value & AT91_EMAC_MAN_DATA_MASK),
&at91mac->man);
do {
netstat = readl(&at91mac->sr);
debug_cond(DEBUG_AT91PHY, "poll SR %08lx\n", netstat);
} while (!(netstat & AT91_EMAC_SR_IDLE));
at91emac_DisableMDIO(at91mac);
return 0;
}
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
at91_emac_t *get_emacbase_by_name(const char *devname)
{
struct eth_device *netdev;
netdev = eth_get_dev_by_name(devname);
return (at91_emac_t *) netdev->iobase;
}
int at91emac_mii_read(const char *devname, unsigned char addr,
unsigned char reg, unsigned short *value)
{
at91_emac_t *emac;
emac = get_emacbase_by_name(devname);
at91emac_read(emac , addr, reg, value);
return 0;
}
int at91emac_mii_write(const char *devname, unsigned char addr,
unsigned char reg, unsigned short value)
{
at91_emac_t *emac;
emac = get_emacbase_by_name(devname);
at91emac_write(emac, addr, reg, value);
return 0;
}
#endif
static int at91emac_phy_reset(struct eth_device *netdev)
{
int i;
u16 status, adv;
at91_emac_t *emac;
emac = (at91_emac_t *) netdev->iobase;
adv = ADVERTISE_CSMA | ADVERTISE_ALL;
at91emac_write(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_ADVERTISE, adv);
debug_cond(VERBOSEP, "%s: Starting autonegotiation...\n", netdev->name);
at91emac_write(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR, MII_BMCR,
(BMCR_ANENABLE | BMCR_ANRESTART));
for (i = 0; i < 30000; i++) {
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_BMSR, &status);
if (status & BMSR_ANEGCOMPLETE)
break;
udelay(100);
}
if (status & BMSR_ANEGCOMPLETE) {
debug_cond(VERBOSEP,
"%s: Autonegotiation complete\n", netdev->name);
} else {
printf("%s: Autonegotiation timed out (status=0x%04x)\n",
netdev->name, status);
return -1;
}
return 0;
}
static int at91emac_phy_init(struct eth_device *netdev)
{
u16 phy_id, status, adv, lpa;
int media, speed, duplex;
int i;
at91_emac_t *emac;
emac = (at91_emac_t *) netdev->iobase;
/* Check if the PHY is up to snuff... */
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_PHYSID1, &phy_id);
if (phy_id == 0xffff) {
printf("%s: No PHY present\n", netdev->name);
return -1;
}
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_BMSR, &status);
if (!(status & BMSR_LSTATUS)) {
/* Try to re-negotiate if we don't have link already. */
if (at91emac_phy_reset(netdev))
return -2;
for (i = 0; i < 100000 / 100; i++) {
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_BMSR, &status);
if (status & BMSR_LSTATUS)
break;
udelay(100);
}
}
if (!(status & BMSR_LSTATUS)) {
debug_cond(VERBOSEP, "%s: link down\n", netdev->name);
return -3;
} else {
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_ADVERTISE, &adv);
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR,
MII_LPA, &lpa);
media = mii_nway_result(lpa & adv);
speed = (media & (ADVERTISE_100FULL | ADVERTISE_100HALF)
? 1 : 0);
duplex = (media & ADVERTISE_FULL) ? 1 : 0;
debug_cond(VERBOSEP, "%s: link up, %sMbps %s-duplex\n",
netdev->name,
speed ? "100" : "10",
duplex ? "full" : "half");
}
return 0;
}
int at91emac_UpdateLinkSpeed(at91_emac_t *emac)
{
unsigned short stat1;
at91emac_read(emac, CONFIG_DRIVER_AT91EMAC_PHYADDR, MII_BMSR, &stat1);
if (!(stat1 & BMSR_LSTATUS)) /* link status up? */
return -1;
if (stat1 & BMSR_100FULL) {
/*set Emac for 100BaseTX and Full Duplex */
writel(readl(&emac->cfg) |
AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD,
&emac->cfg);
return 0;
}
if (stat1 & BMSR_10FULL) {
/*set MII for 10BaseT and Full Duplex */
writel((readl(&emac->cfg) &
~(AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD)
) | AT91_EMAC_CFG_FD,
&emac->cfg);
return 0;
}
if (stat1 & BMSR_100HALF) {
/*set MII for 100BaseTX and Half Duplex */
writel((readl(&emac->cfg) &
~(AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD)
) | AT91_EMAC_CFG_SPD,
&emac->cfg);
return 0;
}
if (stat1 & BMSR_10HALF) {
/*set MII for 10BaseT and Half Duplex */
writel((readl(&emac->cfg) &
~(AT91_EMAC_CFG_SPD | AT91_EMAC_CFG_FD)),
&emac->cfg);
return 0;
}
return 0;
}
static int at91emac_init(struct eth_device *netdev, bd_t *bd)
{
int i;
u32 value;
emac_device *dev;
at91_emac_t *emac;
at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIO;
emac = (at91_emac_t *) netdev->iobase;
dev = (emac_device *) netdev->priv;
/* PIO Disable Register */
value = ATMEL_PMX_AA_EMDIO | ATMEL_PMX_AA_EMDC |
ATMEL_PMX_AA_ERXER | ATMEL_PMX_AA_ERX1 |
ATMEL_PMX_AA_ERX0 | ATMEL_PMX_AA_ECRS |
ATMEL_PMX_AA_ETX1 | ATMEL_PMX_AA_ETX0 |
ATMEL_PMX_AA_ETXEN | ATMEL_PMX_AA_EREFCK;
writel(value, &pio->pioa.pdr);
writel(value, &pio->pioa.asr);
#ifdef CONFIG_RMII
value = ATMEL_PMX_BA_ERXCK;
#else
value = ATMEL_PMX_BA_ERXCK | ATMEL_PMX_BA_ECOL |
ATMEL_PMX_BA_ERXDV | ATMEL_PMX_BA_ERX3 |
ATMEL_PMX_BA_ERX2 | ATMEL_PMX_BA_ETXER |
ATMEL_PMX_BA_ETX3 | ATMEL_PMX_BA_ETX2;
#endif
writel(value, &pio->piob.pdr);
writel(value, &pio->piob.bsr);
at91_periph_clk_enable(ATMEL_ID_EMAC);
writel(readl(&emac->ctl) | AT91_EMAC_CTL_CSR, &emac->ctl);
/* Init Ethernet buffers */
for (i = 0; i < RBF_FRAMEMAX; i++) {
dev->rbfdt[i].addr = (unsigned long) net_rx_packets[i];
dev->rbfdt[i].size = 0;
}
dev->rbfdt[RBF_FRAMEMAX - 1].addr |= RBF_WRAP;
dev->rbindex = 0;
writel((u32) &(dev->rbfdt[0]), &emac->rbqp);
writel(readl(&emac->rsr) &
~(AT91_EMAC_RSR_OVR | AT91_EMAC_RSR_REC | AT91_EMAC_RSR_BNA),
&emac->rsr);
value = AT91_EMAC_CFG_CAF | AT91_EMAC_CFG_NBC |
HCLK_DIV;
#ifdef CONFIG_RMII
value |= AT91_EMAC_CFG_RMII;
#endif
writel(value, &emac->cfg);
writel(readl(&emac->ctl) | AT91_EMAC_CTL_TE | AT91_EMAC_CTL_RE,
&emac->ctl);
if (!at91emac_phy_init(netdev)) {
at91emac_UpdateLinkSpeed(emac);
return 0;
}
return -1;
}
static void at91emac_halt(struct eth_device *netdev)
{
at91_emac_t *emac;
emac = (at91_emac_t *) netdev->iobase;
writel(readl(&emac->ctl) & ~(AT91_EMAC_CTL_TE | AT91_EMAC_CTL_RE),
&emac->ctl);
debug_cond(DEBUG_AT91EMAC, "halt MAC\n");
}
static int at91emac_send(struct eth_device *netdev, void *packet, int length)
{
at91_emac_t *emac;
emac = (at91_emac_t *) netdev->iobase;
while (!(readl(&emac->tsr) & AT91_EMAC_TSR_BNQ))
;
writel((u32) packet, &emac->tar);
writel(AT91_EMAC_TCR_LEN(length), &emac->tcr);
while (AT91_EMAC_TCR_LEN(readl(&emac->tcr)))
;
debug_cond(DEBUG_AT91EMAC, "Send %d\n", length);
writel(readl(&emac->tsr) | AT91_EMAC_TSR_COMP, &emac->tsr);
return 0;
}
static int at91emac_recv(struct eth_device *netdev)
{
emac_device *dev;
at91_emac_t *emac;
rbf_t *rbfp;
int size;
emac = (at91_emac_t *) netdev->iobase;
dev = (emac_device *) netdev->priv;
rbfp = &dev->rbfdt[dev->rbindex];
while (rbfp->addr & RBF_OWNER) {
size = rbfp->size & RBF_SIZE;
net_process_received_packet(net_rx_packets[dev->rbindex], size);
debug_cond(DEBUG_AT91EMAC, "Recv[%ld]: %d bytes @ %lx\n",
dev->rbindex, size, rbfp->addr);
rbfp->addr &= ~RBF_OWNER;
rbfp->size = 0;
if (dev->rbindex < (RBF_FRAMEMAX-1))
dev->rbindex++;
else
dev->rbindex = 0;
rbfp = &(dev->rbfdt[dev->rbindex]);
if (!(rbfp->addr & RBF_OWNER))
writel(readl(&emac->rsr) | AT91_EMAC_RSR_REC,
&emac->rsr);
}
if (readl(&emac->isr) & AT91_EMAC_IxR_RBNA) {
/* EMAC silicon bug 41.3.1 workaround 1 */
writel(readl(&emac->ctl) & ~AT91_EMAC_CTL_RE, &emac->ctl);
writel(readl(&emac->ctl) | AT91_EMAC_CTL_RE, &emac->ctl);
dev->rbindex = 0;
printf("%s: reset receiver (EMAC dead lock bug)\n",
netdev->name);
}
return 0;
}
static int at91emac_write_hwaddr(struct eth_device *netdev)
{
at91_emac_t *emac;
emac = (at91_emac_t *) netdev->iobase;
at91_periph_clk_enable(ATMEL_ID_EMAC);
debug_cond(DEBUG_AT91EMAC,
"init MAC-ADDR %02x:%02x:%02x:%02x:%02x:%02x\n",
netdev->enetaddr[5], netdev->enetaddr[4], netdev->enetaddr[3],
netdev->enetaddr[2], netdev->enetaddr[1], netdev->enetaddr[0]);
writel( (netdev->enetaddr[0] | netdev->enetaddr[1] << 8 |
netdev->enetaddr[2] << 16 | netdev->enetaddr[3] << 24),
&emac->sa2l);
writel((netdev->enetaddr[4] | netdev->enetaddr[5] << 8), &emac->sa2h);
debug_cond(DEBUG_AT91EMAC, "init MAC-ADDR %x%x\n",
readl(&emac->sa2h), readl(&emac->sa2l));
return 0;
}
int at91emac_register(bd_t *bis, unsigned long iobase)
{
emac_device *emac;
emac_device *emacfix;
struct eth_device *dev;
if (iobase == 0)
iobase = ATMEL_BASE_EMAC;
emac = malloc(sizeof(*emac)+512);
if (emac == NULL)
return -1;
dev = malloc(sizeof(*dev));
if (dev == NULL) {
free(emac);
return -1;
}
/* alignment as per Errata (64 bytes) is insufficient! */
emacfix = (emac_device *) (((unsigned long) emac + 0x1ff) & 0xFFFFFE00);
memset(emacfix, 0, sizeof(emac_device));
memset(dev, 0, sizeof(*dev));
strcpy(dev->name, "emac");
dev->iobase = iobase;
dev->priv = emacfix;
dev->init = at91emac_init;
dev->halt = at91emac_halt;
dev->send = at91emac_send;
dev->recv = at91emac_recv;
dev->write_hwaddr = at91emac_write_hwaddr;
eth_register(dev);
#if defined(CONFIG_MII) || defined(CONFIG_CMD_MII)
miiphy_register(dev->name, at91emac_mii_read, at91emac_mii_write);
#endif
return 1;
}
| cosino/u-boot-enigma | drivers/net/at91_emac.c | C | gpl-2.0 | 12,460 |
/*******************************************************************************
* This file is part of OpenNMS(R).
*
* Copyright (C) 2011 The OpenNMS Group, Inc.
* OpenNMS(R) is Copyright (C) 1999-2011 The OpenNMS Group, Inc.
*
* OpenNMS(R) is a registered trademark of The OpenNMS Group, Inc.
*
* OpenNMS(R) 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.
*
* OpenNMS(R) 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 OpenNMS(R). If not, see:
* http://www.gnu.org/licenses/
*
* For more information contact:
* OpenNMS(R) Licensing <license@opennms.org>
* http://www.opennms.org/
* http://www.opennms.com/
*******************************************************************************/
package org.opennms.netmgt.config.datacollection;
import java.io.IOException;
import java.io.Reader;
import java.io.Serializable;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import org.exolab.castor.xml.MarshalException;
import org.exolab.castor.xml.Marshaller;
import org.exolab.castor.xml.Unmarshaller;
import org.exolab.castor.xml.ValidationException;
import org.exolab.castor.xml.Validator;
import org.opennms.core.xml.ValidateUsing;
import org.xml.sax.ContentHandler;
/**
* Top-level element for the datacollection group
* configuration file.
*/
@XmlRootElement(name="datacollection-group", namespace="http://xmlns.opennms.org/xsd/config/datacollection")
@XmlAccessorType(XmlAccessType.NONE)
@XmlType(propOrder={"name", "resourceType", "group", "systemDef"})
@ValidateUsing("datacollection-groups.xsd")
public class DatacollectionGroup implements Serializable {
private static final long serialVersionUID = 659689462266282039L;
private static final SystemDef[] EMPTY_SYSTEMDEF_ARRAY = new SystemDef[0];
private static final ResourceType[] EMPTY_RESOURCETYPE_ARRAY = new ResourceType[0];
private static final Group[] EMPTY_GROUP_ARRAY = new Group[0];
/**
* data collector group name
*/
private String m_name;
/**
* Custom resource types
*/
private List<ResourceType> m_resourceTypes = new ArrayList<ResourceType>();
/**
* a MIB object group
*/
private List<Group> m_groups = new ArrayList<Group>();
/**
* list of system definitions
*/
private List<SystemDef> m_systemDefs = new ArrayList<SystemDef>();
public DatacollectionGroup() {
super();
}
/**
*
*
* @param group
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void addGroup(final Group group) throws IndexOutOfBoundsException {
m_groups.add(group);
}
/**
*
*
* @param index
* @param group
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void addGroup(final int index, final Group group) throws IndexOutOfBoundsException {
m_groups.add(index, group);
}
/**
*
*
* @param resourceType
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void addResourceType(final ResourceType resourceType) throws IndexOutOfBoundsException {
m_resourceTypes.add(resourceType);
}
/**
*
*
* @param index
* @param resourceType
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void addResourceType(final int index, final ResourceType resourceType) throws IndexOutOfBoundsException {
m_resourceTypes.add(index, resourceType);
}
/**
*
*
* @param systemDef
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void addSystemDef(final SystemDef systemDef) throws IndexOutOfBoundsException {
m_systemDefs.add(systemDef);
}
/**
*
*
* @param index
* @param systemDef
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void addSystemDef(final int index, final SystemDef systemDef) throws IndexOutOfBoundsException {
m_systemDefs.add(index, systemDef);
}
/**
* Method enumerateGroup.
*
* @return an Enumeration over all possible elements of this
* collection
*/
public Enumeration<Group> enumerateGroup() {
return Collections.enumeration(m_groups);
}
/**
* Method enumerateResourceType.
*
* @return an Enumeration over all possible elements of this
* collection
*/
public Enumeration<ResourceType> enumerateResourceType() {
return Collections.enumeration(m_resourceTypes);
}
/**
* Method enumerateSystemDef.
*
* @return an Enumeration over all possible elements of this
* collection
*/
public Enumeration<SystemDef> enumerateSystemDef() {
return Collections.enumeration(m_systemDefs);
}
/**
* Overrides the java.lang.Object.equals method.
*
* @param obj
* @return true if the objects are equal.
*/
@Override()
public boolean equals(final Object obj) {
if ( this == obj )
return true;
if (obj instanceof DatacollectionGroup) {
final DatacollectionGroup temp = (DatacollectionGroup)obj;
if (m_name != null) {
if (temp.m_name == null) return false;
else if (!(m_name.equals(temp.m_name)))
return false;
}
else if (temp.m_name != null)
return false;
if (m_resourceTypes != null) {
if (temp.m_resourceTypes == null) return false;
else if (!(m_resourceTypes.equals(temp.m_resourceTypes)))
return false;
}
else if (temp.m_resourceTypes != null)
return false;
if (m_groups != null) {
if (temp.m_groups == null) return false;
else if (!(m_groups.equals(temp.m_groups)))
return false;
}
else if (temp.m_groups != null)
return false;
if (m_systemDefs != null) {
if (temp.m_systemDefs == null) return false;
else if (!(m_systemDefs.equals(temp.m_systemDefs)))
return false;
}
else if (temp.m_systemDefs != null)
return false;
return true;
}
return false;
}
/**
* Method getGroup.
*
* @param index
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
* @return the value of the
* Group at the
* given index
*/
public Group getGroup(final int index) throws IndexOutOfBoundsException {
if (index < 0 || index >= m_groups.size()) {
throw new IndexOutOfBoundsException("getGroup: Index value '" + index + "' not in range [0.." + (m_groups.size() - 1) + "]");
}
return m_groups.get(index);
}
/**
* Method getGroup.Returns the contents of the collection in an
* Array. <p>Note: Just in case the collection contents are
* changing in another thread, we pass a 0-length Array of the
* correct type into the API call. This way we <i>know</i>
* that the Array returned is of exactly the correct length.
*
* @return this collection as an Array
*/
@XmlElement(name="group")
public Group[] getGroup() {
return m_groups.toArray(EMPTY_GROUP_ARRAY);
}
/**
* Method getGroupCollection.Returns a reference to
* '_groupList'. No type checking is performed on any
* modifications to the Vector.
*
* @return a reference to the Vector backing this class
*/
public List<Group> getGroupCollection() {
return m_groups;
}
/**
* Method getGroupCount.
*
* @return the size of this collection
*/
public int getGroupCount() {
return m_groups.size();
}
/**
* Returns the value of field 'name'. The field 'name' has the
* following description: data collector group name
*
* @return the value of field 'Name'.
*/
@XmlAttribute(name="name", required=true)
public String getName() {
return m_name;
}
/**
* Method getResourceType.
*
* @param index
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
* @return the value of the
* ResourceType
* at the given index
*/
public ResourceType getResourceType(final int index) throws IndexOutOfBoundsException {
if (index < 0 || index >= m_resourceTypes.size()) {
throw new IndexOutOfBoundsException("getResourceType: Index value '" + index + "' not in range [0.." + (m_resourceTypes.size() - 1) + "]");
}
return m_resourceTypes.get(index);
}
/**
* Method getResourceType.Returns the contents of the
* collection in an Array. <p>Note: Just in case the
* collection contents are changing in another thread, we pass
* a 0-length Array of the correct type into the API call.
* This way we <i>know</i> that the Array returned is of
* exactly the correct length.
*
* @return this collection as an Array
*/
@XmlElement(name="resourceType")
public ResourceType[] getResourceType() {
return m_resourceTypes.toArray(EMPTY_RESOURCETYPE_ARRAY);
}
/**
* Method getResourceTypeCollection.Returns a reference to
* '_resourceTypeList'. No type checking is performed on any
* modifications to the Vector.
*
* @return a reference to the Vector backing this class
*/
public List<ResourceType> getResourceTypeCollection() {
return m_resourceTypes;
}
/**
* Method getResourceTypeCount.
*
* @return the size of this collection
*/
public int getResourceTypeCount() {
return m_resourceTypes.size();
}
/**
* Method getSystemDef.
*
* @param index
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
* @return the value of the
* SystemDef at
* the given index
*/
public SystemDef getSystemDef(final int index) throws IndexOutOfBoundsException {
if (index < 0 || index >= m_systemDefs.size()) {
throw new IndexOutOfBoundsException("getSystemDef: Index value '" + index + "' not in range [0.." + (m_systemDefs.size() - 1) + "]");
}
return m_systemDefs.get(index);
}
/**
* Method getSystemDef.Returns the contents of the collection
* in an Array. <p>Note: Just in case the collection contents
* are changing in another thread, we pass a 0-length Array of
* the correct type into the API call. This way we <i>know</i>
* that the Array returned is of exactly the correct length.
*
* @return this collection as an Array
*/
@XmlElement(name="systemDef")
public SystemDef[] getSystemDef() {
return m_systemDefs.toArray(EMPTY_SYSTEMDEF_ARRAY);
}
/**
* Method getSystemDefCollection.Returns a reference to
* '_systemDefList'. No type checking is performed on any
* modifications to the Vector.
*
* @return a reference to the Vector backing this class
*/
public List<SystemDef> getSystemDefCollection() {
return m_systemDefs;
}
/**
* Method getSystemDefCount.
*
* @return the size of this collection
*/
public int getSystemDefCount() {
return m_systemDefs.size();
}
/**
* Overrides the java.lang.Object.hashCode method.
* <p>
* The following steps came from <b>Effective Java Programming
* Language Guide</b> by Joshua Bloch, Chapter 3
*
* @return a hash code value for the object.
*/
public int hashCode() {
int result = 17;
if (m_name != null) {
result = 37 * result + m_name.hashCode();
}
if (m_resourceTypes != null) {
result = 37 * result + m_resourceTypes.hashCode();
}
if (m_groups != null) {
result = 37 * result + m_groups.hashCode();
}
if (m_systemDefs != null) {
result = 37 * result + m_systemDefs.hashCode();
}
return result;
}
/**
* Method isValid.
*
* @return true if this object is valid according to the schema
*/
@Deprecated
public boolean isValid() {
try {
validate();
} catch (final ValidationException vex) {
return false;
}
return true;
}
/**
* Method iterateGroup.
*
* @return an Iterator over all possible elements in this
* collection
*/
public Iterator<Group> iterateGroup() {
return m_groups.iterator();
}
/**
* Method iterateResourceType.
*
* @return an Iterator over all possible elements in this
* collection
*/
public Iterator<ResourceType> iterateResourceType() {
return m_resourceTypes.iterator();
}
/**
* Method iterateSystemDef.
*
* @return an Iterator over all possible elements in this
* collection
*/
public Iterator<SystemDef> iterateSystemDef() {
return m_systemDefs.iterator();
}
/**
*
*
* @param out
* @throws MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws ValidationException if this
* object is an invalid instance according to the schema
*/
@Deprecated
public void marshal(final Writer out) throws MarshalException, ValidationException {
Marshaller.marshal(this, out);
}
/**
*
*
* @param handler
* @throws java.io.IOException if an IOException occurs during
* marshaling
* @throws ValidationException if this
* object is an invalid instance according to the schema
* @throws MarshalException if object is
* null or if any SAXException is thrown during marshaling
*/
@Deprecated
public void marshal(final ContentHandler handler) throws IOException, MarshalException, ValidationException {
Marshaller.marshal(this, handler);
}
/**
*/
public void removeAllGroup() {
m_groups.clear();
}
/**
*/
public void removeAllResourceType() {
m_resourceTypes.clear();
}
/**
*/
public void removeAllSystemDef() {
m_systemDefs.clear();
}
/**
* Method removeGroup.
*
* @param group
* @return true if the object was removed from the collection.
*/
public boolean removeGroup(final Group group) {
return m_groups.remove(group);
}
/**
* Method removeGroupAt.
*
* @param index
* @return the element removed from the collection
*/
public Group removeGroupAt(final int index) {
return m_groups.remove(index);
}
/**
* Method removeResourceType.
*
* @param resourceType
* @return true if the object was removed from the collection.
*/
public boolean removeResourceType(final ResourceType resourceType) {
return m_resourceTypes.remove(resourceType);
}
/**
* Method removeResourceTypeAt.
*
* @param index
* @return the element removed from the collection
*/
public ResourceType removeResourceTypeAt(final int index) {
return m_resourceTypes.remove(index);
}
/**
* Method removeSystemDef.
*
* @param systemDef
* @return true if the object was removed from the collection.
*/
public boolean removeSystemDef(final SystemDef systemDef) {
return m_systemDefs.remove(systemDef);
}
/**
* Method removeSystemDefAt.
*
* @param index
* @return the element removed from the collection
*/
public SystemDef removeSystemDefAt(final int index) {
return m_systemDefs.remove(index);
}
/**
*
*
* @param index
* @param group
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void setGroup(final int index, final Group group) throws IndexOutOfBoundsException {
if (index < 0 || index >= m_groups.size()) {
throw new IndexOutOfBoundsException("setGroup: Index value '" + index + "' not in range [0.." + (m_groups.size() - 1) + "]");
}
m_groups.set(index, group);
}
/**
*
*
* @param groups
*/
public void setGroup(final Group[] groups) {
m_groups.clear();
for (int i = 0; i < groups.length; i++) {
m_groups.add(groups[i]);
}
}
/**
* Sets the value of '_groupList' by copying the given Vector.
* All elements will be checked for type safety.
*
* @param groups the Vector to copy.
*/
public void setGroup(final List<Group> groups) {
m_groups.clear();
m_groups.addAll(groups);
}
/**
* Sets the value of '_groupList' by setting it to the given
* Vector. No type checking is performed.
* @deprecated
*
* @param groups the Vector to set.
*/
public void setGroupCollection(final List<Group> groups) {
m_groups = groups;
}
/**
* Sets the value of field 'name'. The field 'name' has the
* following description: data collector group name
*
* @param name the value of field 'name'.
*/
public void setName(final String name) {
m_name = name.intern();
}
/**
*
*
* @param index
* @param resourceType
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void setResourceType(final int index, final ResourceType resourceType) throws IndexOutOfBoundsException {
if (index < 0 || index >= m_resourceTypes.size()) {
throw new IndexOutOfBoundsException("setResourceType: Index value '" + index + "' not in range [0.." + (m_resourceTypes.size() - 1) + "]");
}
m_resourceTypes.set(index, resourceType);
}
/**
*
*
* @param resourceTypes
*/
public void setResourceType(final ResourceType[] resourceTypes) {
m_resourceTypes.clear();
for (int i = 0; i < resourceTypes.length; i++) {
m_resourceTypes.add(resourceTypes[i]);
}
}
/**
* Sets the value of '_resourceTypeList' by copying the given
* Vector. All elements will be checked for type safety.
*
* @param resourceTypes the Vector to copy.
*/
public void setResourceType(final List<ResourceType> resourceTypes) {
m_resourceTypes.clear();
m_resourceTypes.addAll(resourceTypes);
}
/**
* Sets the value of '_resourceTypeList' by setting it to the
* given Vector. No type checking is performed.
* @deprecated
*
* @param resourceTypes the Vector to set.
*/
public void setResourceTypeCollection(final List<ResourceType> resourceTypes) {
m_resourceTypes = resourceTypes;
}
/**
*
*
* @param index
* @param systemDef
* @throws IndexOutOfBoundsException if the index
* given is outside the bounds of the collection
*/
public void setSystemDef(final int index, final SystemDef systemDef) throws IndexOutOfBoundsException {
if (index < 0 || index >= m_systemDefs.size()) {
throw new IndexOutOfBoundsException("setSystemDef: Index value '" + index + "' not in range [0.." + (m_systemDefs.size() - 1) + "]");
}
m_systemDefs.set(index, systemDef);
}
/**
*
*
* @param systemDefs
*/
public void setSystemDef(final SystemDef[] systemDefs) {
m_systemDefs.clear();
for (int i = 0; i < systemDefs.length; i++) {
m_systemDefs.add(systemDefs[i]);
}
}
/**
* Sets the value of '_systemDefList' by copying the given
* Vector. All elements will be checked for type safety.
*
* @param systemDefs the Vector to copy.
*/
public void setSystemDef(final List<SystemDef> systemDefs) {
m_systemDefs.clear();
m_systemDefs.addAll(systemDefs);
}
/**
* Sets the value of '_systemDefList' by setting it to the
* given Vector. No type checking is performed.
* @deprecated
*
* @param systemDefs the Vector to set.
*/
public void setSystemDefCollection(final List<SystemDef> systemDefs) {
m_systemDefs = systemDefs;
}
/**
* Method unmarshal.
*
* @param reader
* @throws MarshalException if object is
* null or if any SAXException is thrown during marshaling
* @throws ValidationException if this
* object is an invalid instance according to the schema
* @return the unmarshaled
* DatacollectionGroup
*/
@Deprecated
public static DatacollectionGroup unmarshal(final Reader reader) throws MarshalException, ValidationException {
return (DatacollectionGroup) Unmarshaller.unmarshal(DatacollectionGroup.class, reader);
}
/**
*
*
* @throws ValidationException if this
* object is an invalid instance according to the schema
*/
@Deprecated
public void validate() throws ValidationException {
new Validator().validate(this);
}
}
| tharindum/opennms_dashboard | opennms-config/src/main/java/org/opennms/netmgt/config/datacollection/DatacollectionGroup.java | Java | gpl-2.0 | 22,786 |
#include "mmath.h"
namespace Math {
// Constantes
const float piDiv180= M_PI / 180.0;
float rad2deg(const float &angle)
{
return angle * 1/piDiv180;
}
float deg2rad(const float &angle)
{
return angle * piDiv180;
}
float pow2(const float &val)
{
return val*val;
}
float SIN(const float &ang)
{
return sin(ang * piDiv180);
}
float COS(const float &ang)
{
return cos(ang * piDiv180);
}
float TAN(const float &ang)
{
return tan(ang);
}
float ASIN(const float &val)
{
return asin(val) / piDiv180;
}
float ACOS(const float &val)
{
return acos(val) / piDiv180;
}
float ATAN(const float &val)
{
return atan(val) / piDiv180;
}
float ATAN2(const float &val1, const float &val2)
{
return atan2(val1, val2) / piDiv180;
}
Vec3 triangleNormal(const Vec3 &v1, const Vec3 &v2, const Vec3 &v3)
{
/*
Counter Clock-Wise (right hand rule)
*/
Vec3 ret;
ret.x = (v2.y-v1.y)*(v3.z-v1.z)-(v2.z-v1.z)*(v3.y-v1.y);
ret.y = (v2.z-v1.z)*(v3.x-v1.x)-(v2.x-v1.x)*(v3.z-v1.z);
ret.z = (v2.x-v1.x)*(v3.y-v1.y)-(v2.y-v1.y)*(v3.x-v1.x);
return ret.normalize();
}
Vec3 quadNormal(const Vec3 &v1, const Vec3 &v2, const Vec3 &v3, const Vec3 &v4)
{
/*
Calculates a quad normal as an average of the triangle
normals at the four corners
1------4
| · · | Counter Clock-Wise (right hand rule)
| |
| · · |
2------3
*/
Vec3 ret;
ret= triangleNormal(v1, v2, v4) + triangleNormal(v2, v3, v1) +
triangleNormal(v3, v4, v2) + triangleNormal(v4, v1, v3);
return ret.normalize();
}
Vec3 getCartesian(const float &rho, const float &phi, const float &theta)
{
return Vec3(
rho * SIN(phi) * COS(theta),
rho * SIN(phi) * SIN(theta),
rho * COS(phi));
}
float dot(const Vec3 &v1, const Vec3 &v2)
{
return v1.x*v2.x + v1.y*v2.y + v1.z*v2.z;
}
Vec3 cross(const Vec3 &v1, const Vec3 &v2)
{
return Vec3(v1.y * v2.z - v1.z * v2.y,
v1.z * v2.x - v1.x * v2.z,
v1.x * v2.y - v1.y * v2.x);
}
Vec3 mix(const Vec3 &v1, const Vec3 &v2, const float &porc)
{
// Similar to GLSL vector mix
float porc1= 1-porc;
return v1*porc1 + v2*porc;
}
}
| groleo/qantenna | src/mmath.cpp | C++ | gpl-2.0 | 2,202 |
package cis501;
public interface IUopFactory {
/** Create a Uop from a line of the trace file. */
public Uop create(String line);
/** Used for testing the pipeline simulator */
public Uop create(int sr1, int sr2, int dr, Uop.MemoryOp mop);
}
| arch2792/TraceAnalyzer | src/main/java/cis501/IUopFactory.java | Java | gpl-2.0 | 262 |
require "singleton"
require "webrick";
class SimpleHTTPServer
include Singleton
include WEBrick
def start(dir, options)
mime_types = WEBrick::HTTPUtils::DefaultMimeTypes
mime_types.store 'js', 'application/javascript'
mime_types.store 'svg', 'image/svg+xml'
mime_types.store 'mp3', 'audio/mpeg'
mime_types.store 'mp4', 'video/mp4'
mime_types.store 'ogv', 'video/ogg'
mime_types.store 'webm', 'video/webm'
options={
:Port => 24680,
:MimeTypes => mime_types
}.merge(options)
stop
@http_server = HTTPServer.new(options) unless @http_server
@http_server_thread = Thread.new do
@http_server.mount("/",HTTPServlet::FileHandler, dir, {
:FancyIndexing => true
});
@http_server.start
end
end
def stop
@http_server.shutdown if @http_server
@http_server = nil
@http_server_thread.kill if @http_server_thread && @http_server_thread.alive?
sleep 1 if org.jruby.platform.Platform::IS_WINDOWS # windows need time to release port
end
end
| KKBOX/CompassApp | src/simplehttpserver.rb | Ruby | gpl-2.0 | 1,057 |
/*
############################################################################
##
## Copyright (C) 2006-2009 University of Utah. All rights reserved.
##
## This file is part of DeepPeep.
##
## This file may be used under the terms of the GNU General Public
## License version 2.0 as published by the Free Software Foundation
## and appearing in the file LICENSE.GPL included in the packaging of
## this file. Please review the following to ensure GNU General Public
## Licensing requirements will be met:
## http://www.opensource.org/licenses/gpl-license.php
##
## If you are unsure which license is appropriate for your use (for
## instance, you are interested in developing a commercial derivative
## of DeepPeep), please contact us at deeppeep@sci.utah.edu.
##
## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
##
############################################################################
*/
package focusedCrawler.util.distribution;
import java.io.*;
import java.util.*;
import java.net.*;
public class HTTPMessage {
public HTTPMessage() {
}
public String sendGET(Hashtable prop) throws MalformedURLException, IOException {
String url = (String) prop.get("url");
String queryString = toQueryString(prop);
String urlS = url + (queryString != null ? "?" + queryString : "");
URLConnection connection = createConnection(urlS);
String result;
connection.setDoInput(true);
sendHeader(connection, prop);
result = readInput(connection);
if (connection != null && connection instanceof HttpURLConnection) {
((HttpURLConnection) connection).disconnect();
}
return result;
}
public String sendPOST(Hashtable prop) throws MalformedURLException, IOException {
String url = (String) prop.get("url");
String contentType = (String) prop.get("content-type");
String result = "";
URLConnection connection = null;
if ("application/x-www-form-urlencoded".equals(contentType)) {
connection = createConnection(url);
String queryString = toQueryString(prop);
connection.setDoInput(true);
connection.setDoOutput(true);
sendHeader(connection, prop);
writeOutput(queryString, connection);
result = readInput(connection);
}
if (connection != null && connection instanceof HttpURLConnection) {
((HttpURLConnection) connection).disconnect();
}
return result;
}
public String toQueryString(Hashtable prop) {
Enumeration e = (Enumeration) prop.get("parameterNames");
String result = "";
boolean first = true;
while (e.hasMoreElements()) {
String paramName = (String) e.nextElement();
String[] param = (String[]) prop.get(paramName);
for (int i = 0; i < param.length; i++) {
if (first) {
result = paramName + "=" + param[i];
first = false;
} else result = result + "&" + paramName + "=" + param[i];
}
}
return result;
}
protected void sendHeader(URLConnection connection, Hashtable prop) {
Enumeration e = (Enumeration) prop.get("headerNames");
while (e.hasMoreElements()) {
String headerName = (String) e.nextElement();
String header = (String) prop.get(headerName);
connection.setRequestProperty(headerName, header);
}
}
protected URLConnection createConnection(String url) throws MalformedURLException, IOException {
URL urlU = new URL(url);
return urlU.openConnection();
}
protected String readInput(URLConnection connection) throws IOException {
String result = "";
BufferedReader d = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line = d.readLine();
boolean first = true;
while (line != null) {
if (first) {
result = line;
first = false;
} else result = result + "\n" + line;
line = d.readLine();
}
d.close();
return result;
}
protected void writeOutput(String data, URLConnection connection) throws IOException {
byte[] dataBytes = data.getBytes();
OutputStream out = connection.getOutputStream();
out.write(dataBytes, 0, dataBytes.length);
out.flush();
out.close();
}
} | chdoig/ache | src/main/java/focusedCrawler/util/distribution/HTTPMessage.java | Java | gpl-2.0 | 4,955 |
# Movable Type (r) Open Source (C) 2001-2010 Six Apart, Ltd.
# This program is distributed under the terms of the
# GNU General Public License, version 2.
#
# $Id$
# Adapted from DateTime package to avoid requirement of DateTime package.
package MT::DateTime;
use Exporter;
@MT::DateTime::ISA = qw( Exporter );
use vars qw( @EXPORT_OK );
@EXPORT_OK = qw( ymd2rd tz_offset_as_seconds );
use MT::Util qw( epoch2ts );
sub new {
my $class = shift;
my (%param) = @_;
my $self = \%param;
bless $self, $class || __PACKAGE__;
}
sub week_year { ( shift->week )[0] }
sub week_number { ( shift->week )[1] }
sub year { shift->{year} }
sub month { shift->{month} }
sub day { shift->{day} }
sub hour { shift->{hour} }
sub minute { shift->{minute} }
sub second { shift->{second} }
sub time_zone { shift->{time_zone} }
sub day_of_year {
my $self = shift;
return $self->{local_c}{day_of_year} if $self->{local_c}{day_of_year};
my $year = $self->year;
my $days = 0;
require MT::Util;
for ( my $i = 1; $i < $self->month; $i++ ) {
$days += MT::Util::days_in( $i, $year );
}
$days += $self->day;
$self->{local_c}{day_of_year} = $days;
}
sub week {
my $self = shift;
unless ( defined $self->{local_c}{week_year} ) {
my $jan_one_dow_m1
= ( ( $self->ymd2rd( $self->year, 1, 1 ) + 6 ) % 7 );
$self->{local_c}{week_number}
= int( ( ( $self->day_of_year ) + $jan_one_dow_m1 ) / 7 );
$self->{local_c}{week_number}++ if $jan_one_dow_m1 < 4;
if ( $self->{local_c}{week_number} == 0 ) {
$self->{local_c}{week_year} = $self->year - 1;
$self->{local_c}{week_number}
= $self->weeks_in_year( $self->{local_c}{week_year} );
}
elsif ( $self->{local_c}{week_number} == 53
&& $self->weeks_in_year( $self->year ) == 52 )
{
$self->{local_c}{week_number} = 1;
$self->{local_c}{week_year} = $self->year + 1;
}
else {
$self->{local_c}{week_year} = $self->year;
}
} ## end unless ( defined $self->{local_c...})
return @{ $self->{local_c} }{ 'week_year', 'week_number' };
} ## end sub week
sub weeks_in_year {
my $self = shift;
my $year = shift;
my $jan_one_dow = ( ( $self->ymd2rd( $year, 1, 1 ) + 6 ) % 7 ) + 1;
my $dec_31_dow = ( ( $self->ymd2rd( $year, 12, 31 ) + 6 ) % 7 ) + 1;
return $jan_one_dow == 4 || $dec_31_dow == 4 ? 53 : 52;
}
sub ymd2rd {
my $self = shift;
use integer;
my ( $y, $m, $d );
if (@_) {
( $y, $m, $d ) = @_;
}
elsif ( ref $self ) {
( $y, $m, $d ) = ( $self->{year}, $self->{month}, $self->{day} );
}
my $adj;
# make month in range 3..14 (treat Jan & Feb as months 13..14 of
# prev year)
if ( $m <= 2 ) {
$y -= ( $adj = ( 14 - $m ) / 12 );
$m += 12 * $adj;
}
elsif ( $m > 14 ) {
$y += ( $adj = ( $m - 3 ) / 12 );
$m -= 12 * $adj;
}
# make year positive (oh, for a use integer 'sane_div'!)
if ( $y < 0 ) {
$d -= 146097 * ( $adj = ( 399 - $y ) / 400 );
$y += 400 * $adj;
}
# add: day of month, days of previous 0-11 month period that began
# w/March, days of previous 0-399 year period that began w/March
# of a 400-multiple year), days of any 400-year periods before
# that, and 306 days to adjust from Mar 1, year 0-relative to Jan
# 1, year 1-relative (whew)
$d
+= ( $m * 367 - 1094 ) / 12
+ $y % 100 * 1461 / 4
+ ( $y / 100 * 36524 + $y / 400 ) - 306;
} ## end sub ymd2rd
sub tz_offset_as_seconds {
my $self = shift;
my $offset = shift;
if ( ref $self ) {
$offset = $self->{time_zone};
}
return undef unless defined $offset;
return 0 if $offset eq '0';
my ( $sign, $hours, $minutes, $seconds );
if ( $offset =~ /^([\+\-])?(\d\d?):(\d\d)(?::(\d\d))?$/ ) {
( $sign, $hours, $minutes, $seconds ) = ( $1, $2, $3, $4 );
}
elsif ( $offset =~ /^([\+\-])?(\d\d)(\d\d)(\d\d)?$/ ) {
( $sign, $hours, $minutes, $seconds ) = ( $1, $2, $3, $4 );
}
else {
return undef;
}
$sign = '+' unless defined $sign;
return undef unless $hours >= 0 && $hours <= 99;
return undef unless $minutes >= 0 && $minutes <= 59;
return undef
unless !defined($seconds) || ( $seconds >= 0 && $seconds <= 59 );
my $total = $hours * 3600 + $minutes * 60;
$total += $seconds if $seconds;
$total *= -1 if $sign eq '-';
return $total;
} ## end sub tz_offset_as_seconds
sub _param2ts {
my ( $param, $blog ) = @_;
my ( $type, $value );
if ( 'HASH' eq ref($param) ) {
$type = $param->{type};
$value = $param->{value};
}
else {
$type = 'ts';
$value = $param;
}
if ( 'CODE' eq ref($value) ) {
$value = $value->();
}
my $ts;
if ( 'epoch' eq $type ) {
$ts = epoch2ts( $blog, $value );
}
elsif ( 'datetime' eq $type ) {
$ts = sprintf "%04d%02d%02d%02d%02d%02d", $value->year, $value->month,
$value->day, $value->hour, $value->minute, $value->second;
}
else {
$ts = $value;
}
$ts;
} ## end sub _param2ts
sub compare {
my $self = shift;
my %param = @_;
# a => $ts | CODE | { value => CODE|$v, type => ts|epoch|datetime }
# b => $ts | CODE | { value => CODE|$v, type => ts|epoch|datetime }
# blog => ref|N|undef
# comparer => CODE|undef
my $blog = $param{blog};
if ( defined($blog) && !ref($blog) ) {
$blog = MT->model('blog')->load($blog);
$blog = undef unless ref($blog);
}
if ( !exists( $param{a} ) && ref($self) ) {
$param{a} = { value => $self, type => 'datetime' };
}
my $ts_a = _param2ts( $param{a}, $blog );
if ( !exists( $param{b} ) && ref($self) ) {
$param{b} = { value => $self, type => 'datetime' };
}
my $ts_b = _param2ts( $param{b}, $blog );
my $comparer = $param{code};
if ( 'CODE' eq ref($comparer) ) {
return $comparer->( $ts_a, $ts_b );
}
else {
return $ts_a - $ts_b;
}
} ## end sub compare
1;
__END__
=head1 NAME
MT::DateTime - A utility package for handling date/time values for Movable
Type.
=head1 METHODS
=head2 MT::DateTime->new(%attr)
Constructs a new C<MT::DateTime> object using the values in C<%attr>.
C<%attr> may contain:
=over 4
=item * year
A 4-digit year.
=item * month
Month number, where January is 0.
=item * day
Day number, from 1 to 31.
=item * hour
Hour in 24 hour notation (0-23).
=item * minute
Minutes (0-59).
=item * second
Seconds (0-59).
=item * time_zone
Timezone, in '+HH:MM', '-HH:MM', '+HH', or '-HH' notation.
=back
=head2 compare( a => $a, b => $b, blog => $blog )
Compares two timestamp strings and returns negative valye, 0, or
positive value depending on whether the "a" argument is less than,
equal to, or greater than the "b" argument.
You can specify scalar value to "a" and "b". They are treated as
timestamp values (e.g. 20080405123456). You can also specify either
epoch string (e.g the string returned from time method), or C<MT::DateTime>
object. In those cases, you must specify both value and type in a hash,
for example:
MT::DateTime->compare( blog => $blog,
a => '20041231123456', b => { value => time(), type => 'epoch' } );
=head2 $datetime->week_year()
Returns the year for the start of the week for the object.
=head2 $datetime->week_number()
Returns the week number calculated for the object.
=head2 $datetime->year()
Returns the year component of the object.
=head2 $datetime->month()
Returns the month component of the object.
=head2 $datetime->day()
Returns the day component of the object.
=head2 $datetime->hour()
Returns the hours component of the object.
=head2 $datetime->minute()
Returns the minutes component of the object.
=head2 $datetime->second()
Returns the seconds component of the object.
=head2 $datetime->time_zone()
Returns the time zone component of the object.
=head2 $datetime->day_of_year()
Returns the day number of the year of the object.
=head2 $datetime->week()
Returns a list containing the year of the week (C<week_year>) and
the week number (C<week_number>).
=head2 MT::DateTime->weeks_in_year($year)
Returns the number of weeks that are in the specified C<$year>. Returns
either 52 or 53, depending on the year.
=head2 $datetime->ymd2rd( [ $year, $month, $day ])
Converts the given C<$year>, C<$month>, C<$day> (or, if unspecified,
uses the year, month, day elements from C<$datetime>) into a 'Rata Die'
days value.
=head2 $datetime->tz_offset_as_seconds( [$offset] )
Converts the given C<$offset> (or, if absent, uses the time_zone
component of C<$datetime>) into an expression of seconds. I.e.,
an C<$offset> of '-1:30' would yield -5400.
=head1 AUTHOR & COPYRIGHT
Please see L<MT/AUTHOR & COPYRIGHT>.
=cut
| openmelody/melody | lib/MT/DateTime.pm | Perl | gpl-2.0 | 9,050 |
<?php
/**
* @version 0.9 $Id: eventlist_venues.php 507 2008-01-03 15:48:34Z schlu $
* @package Joomla
* @subpackage EventList
* @copyright (C) 2005 - 2008 Christoph Lukes
* @license GNU/GPL, see LICENSE.php
* EventList is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License 2
* as published by the Free Software Foundation.
* EventList 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 EventList; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
defined('_JEXEC') or die('Restricted access');
/**
* EventList venues Model class
*
* @package Joomla
* @subpackage EventList
* @since 0.9
*/
class eventlist_venues extends JTable
{
/**
* Primary Key
* @var int
*/
var $id = null;
/** @var string */
var $venue = null;
/** @var string */
var $alias = null;
/** @var string */
var $url = null;
/** @var string */
var $street = null;
/** @var string */
var $plz = null;
/** @var string */
var $city = null;
/** @var string */
var $state = null;
/** @var string */
var $country = null;
/** @var string */
var $locdescription = null;
/** @var string */
var $meta_description = null;
/** @var string */
var $meta_keywords = null;
/** @var string */
var $locimage = null;
/** @var int */
var $map = null;
/** @var int */
var $created_by = null;
/** @var string */
var $author_ip = null;
/** @var date */
var $created = null;
/** @var date */
var $modified = null;
/** @var int */
var $modified_by = null;
/** @var int */
var $published = null;
/** @var int */
var $checked_out = null;
/** @var date */
var $checked_out_time = null;
/** @var int */
var $ordering = null;
function eventlist_venues(& $db) {
parent::__construct('#__eventlist_venues', 'id', $db);
}
// overloaded check function
function check($elsettings)
{
// not typed in a venue name
if(!trim($this->venue)) {
$this->_error = JText::_( 'ADD VENUE');
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
$alias = JFilterOutput::stringURLSafe($this->venue);
if(empty($this->alias) || $this->alias === $alias ) {
$this->alias = $alias;
}
if ( $this->map ){
if ((!trim($this->street)) || (!trim($this->plz)) || (!trim($this->city)) || (!trim($this->country))) {
$this->_error = JText::_( 'ADD ADDRESS');
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
}
if (JFilterInput::checkAttribute(array ('href', $this->url))) {
$this->_error = JText::_( 'ERROR URL WRONG FORMAT' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
if (trim($this->url)) {
$this->url = strip_tags($this->url);
$urllength = strlen($this->url);
if ($urllength > 150) {
$this->_error = JText::_( 'ERROR URL LONG' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
if (!preg_match( '/^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}'
.'((:[0-9]{1,5})?\/.*)?$/i' , $this->url)) {
$this->_error = JText::_( 'ERROR URL WRONG FORMAT' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
}
$this->street = strip_tags($this->street);
$streetlength = JString::strlen($this->street);
if ($streetlength > 50) {
$this->_error = JText::_( 'ERROR STREET LONG' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
$this->plz = strip_tags($this->plz);
$plzlength = JString::strlen($this->plz);
if ($plzlength > 10) {
$this->_error = JText::_( 'ERROR ZIP LONG' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
$this->city = strip_tags($this->city);
$citylength = JString::strlen($this->city);
if ($citylength > 50) {
$this->_error = JText::_( 'ERROR CITY LONG' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
$this->state = strip_tags($this->state);
$statelength = JString::strlen($this->state);
if ($statelength > 50) {
$this->_error = JText::_( 'ERROR STATE LONG' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
$this->country = strip_tags($this->country);
$countrylength = JString::strlen($this->country);
if ($countrylength > 2) {
$this->_error = JText::_( 'ERROR COUNTRY LONG' );
JError::raiseWarning('SOME_ERROR_CODE', $this->_error );
return false;
}
/** check for existing name */
$query = 'SELECT id FROM #__eventlist_venues WHERE venue = '.$this->_db->Quote($this->venue);
$this->_db->setQuery($query);
$xid = intval($this->_db->loadResult());
if ($xid && $xid != intval($this->id)) {
JError::raiseWarning('SOME_ERROR_CODE', JText::sprintf('VENUE NAME ALREADY EXIST', $this->venue));
return false;
}
return true;
}
}
?> | reeleis/ohiocitycycles | administrator/components/com_eventlist/tables/eventlist_venues.php | PHP | gpl-2.0 | 5,348 |
script('../node_modules/domready/ready.js', function () {
domready(function() {
sink('Basic', function(test, ok, before, after) {
test('should call from chained ready calls', 4, function() {
script.ready('jquery', function() {
ok(true, 'loaded from ready callback')
})
script.ready('jquery', function() {
ok(true, 'called jquery callback again')
})
.ready('jquery', function() {
ok(true, 'called ready on a chain')
})
script('../vendor/jquery.js', 'jquery', function() {
ok(true, 'loaded from base callback')
})
})
test('multiple files can be loaded at once', 1, function() {
script(['../demos/js/foo.js', '../demos/js/bar.js'], function() {
ok(true, 'foo and bar have been loaded')
})
})
test('ready should wait for multiple files by name', 1, function() {
script(['../demos/js/baz.js', '../demos/js/thunk.js'], 'bundle').ready('bundle', function() {
ok(true, 'batch has been loaded')
})
})
test('ready should wait for several batches by name', 1, function() {
script('../vendor/yui-utilities.js', 'yui')
script('../vendor/mootools.js', 'moomoo')
script.ready(['yui', 'moomoo'], function() {
console.log('ONCE')
ok(true, 'multiple batch has been loaded')
})
})
test('ready should not call a duplicate callback', 1, function() {
script.ready(['yui', 'moomoo'], function() {
console.log('TWICE')
ok(true, 'found yui and moomoo again')
})
})
test('ready should not call a callback a third time', 1, function() {
script.ready(['yui', 'moomoo'], function() {
console.log('THREE')
ok(true, 'found yui and moomoo again')
})
})
test('should load a single file without extra arguments', 1, function () {
var err = false
try {
script('../vendor/yui-utilities.js')
} catch (ex) {
err = true
console.log('wtf ex', ex)
} finally {
ok(!err, 'no error')
}
})
test('should callback a duplicate file without loading the file', 1, function () {
script('../vendor/yui-utilities.js', function () {
ok(true, 'loaded yui twice. nice')
})
})
test('onerror', 1, function () {
script('waaaaaaaaaaaa', function () {
ok(true, 'no waaaa')
})
})
test('setting script path', 3, function () {
script.path('../vendor/')
script(['patha', 'pathb', 'http://ded.github.com/morpheus/morpheus.js'], function () {
ok(patha == true, 'loaded patha.js')
ok(pathb == true, 'loaded pathb.js')
ok(typeof morpheus !== 'undefined', 'loaded morpheus.js from http')
})
})
test('syncronous ordered loading', 2, function () {
script.order(['order-a', 'order-b', 'order-c'], 'ordered-id', function () {
ok(true, 'loaded each file in order')
console.log('loaded each file in order')
})
script.ready('ordered-id', function () {
console.log('readiness by id')
ok(ordera && orderb && orderc, 'done listen for readiness by id')
})
})
})
start()
})
}) | unicef/uPortal | sites/all/libraries/scriptjs/tests/tests.js | JavaScript | gpl-2.0 | 3,404 |
var winston = require('winston');
module.exports = function(app, models, tasks, channel) {
// initialize the sync of a repo
app.post('/', function (req, res) {
winston.log("info", "POST /");
channel.sendToQueue("gms.queue", new Buffer(JSON.stringify(req.body)), {deliveryMode: true});
res.sendStatus(201);
});
};
| git-mirror-sync/git-mirror-sync | routes/hooks.js | JavaScript | gpl-2.0 | 333 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.6"/>
<title>VirtualBoard: Miembros de los ficheros</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">VirtualBoard
 <span id="projectnumber">0.1</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generado por Doxygen 1.8.6 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Buscar');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Página principal</span></a></li>
<li><a href="annotated.html"><span>Clases</span></a></li>
<li class="current"><a href="files.html"><span>Archivos</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Buscar" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>Lista de archivos</span></a></li>
<li class="current"><a href="globals.html"><span>Miembros de los ficheros</span></a></li>
</ul>
</div>
<div id="navrow3" class="tabs2">
<ul class="tablist">
<li class="current"><a href="globals.html"><span>Todo</span></a></li>
<li><a href="globals_vars.html"><span>Variables</span></a></li>
</ul>
</div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>Todo</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Clases</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Archivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Funciones</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="contents">
<div class="textblock">Lista de todos los mienbros de los ficheros con enlaces a los ficheros a los que corresponden:</div><ul>
<li>$data
: <a class="el" href="df/d85/GetData_8php.html#a6efc15b5a2314dd4b5aaa556a375c6d6">GetData.php</a>
, <a class="el" href="d9/d4b/PutData_8php.html#a6efc15b5a2314dd4b5aaa556a375c6d6">PutData.php</a>
</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generado el Domingo, 18 de Enero de 2015 13:28:23 para VirtualBoard por  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.6
</small></address>
</body>
</html>
| IV-2014/VirtualBoard | ServerConfiguration/PHP/docPut/html/globals.html | HTML | gpl-2.0 | 4,864 |
/*
* This is the source code of Telegram for Android v. 1.7.x.
* It is licensed under GNU GPL v. 2 or later.
* You should have received a copy of the license in this archive (see LICENSE).
*
* Copyright Nikolai Kudashov, 2013-2014.
*/
package org.telegram.ui.Cells;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.Gravity;
import android.widget.FrameLayout;
import android.widget.TextView;
import org.telegram.android.AndroidUtilities;
import org.telegram.android.LocaleController;
public class HeaderCell extends FrameLayout {
private TextView textView;
private void init() {
textView = new TextView(getContext());
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 15);
textView.setTypeface(AndroidUtilities.getTypeface("fonts/rmedium.ttf"));
//textView.setTextColor(0xff3e90cf);
//
textView.setTextColor(AndroidUtilities.getIntColor("themeColor"));
//
textView.setGravity((LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT) | Gravity.CENTER_VERTICAL);
addView(textView);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)textView.getLayoutParams();
layoutParams.width = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.height = FrameLayout.LayoutParams.MATCH_PARENT;
layoutParams.leftMargin = AndroidUtilities.dp(17);
layoutParams.rightMargin = AndroidUtilities.dp(17);
layoutParams.topMargin = AndroidUtilities.dp(15);
layoutParams.gravity = LocaleController.isRTL ? Gravity.RIGHT : Gravity.LEFT;
textView.setLayoutParams(layoutParams);
}
public HeaderCell(Context context) {
super(context);
init();
}
public HeaderCell(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public HeaderCell(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init();
}
public HeaderCell(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
init();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(38), MeasureSpec.EXACTLY));
}
public void setText(String text) {
textView.setText(text);
}
}
| rafalense/Plus-Messenger | TMessagesProj/src/main/java/org/telegram/ui/Cells/HeaderCell.java | Java | gpl-2.0 | 2,588 |
/*
* Copyright (C) 2012 Spreadtrum Communications Inc.
*
* 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.
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/wait.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/io.h>
#include <asm/uaccess.h>
#include <linux/debugfs.h>
#include <linux/seq_file.h>
#include <linux/sipc.h>
#include "sbuf.h"
static struct sbuf_mgr *sbufs[SIPC_ID_NR][SMSG_CH_NR];
#ifdef CONFIG_SPRD_SIMDET_IOCTL
void sbuf_ring_rx_wakeup(uint8_t dst, uint8_t channel, uint32_t bufnum)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
struct sbuf_ring *ring = NULL;
if (!sbuf) {
printk(KERN_ERR "%s: invalid sbuf: %d-%d\n",
__func__, dst, channel);
return;
}
ring = &(sbuf->rings[bufnum]);
wake_up_interruptible_all(&ring->rxwait);
printk(KERN_INFO "%s: wake up ring %d-%d-%d\n",
__func__, dst, channel, bufnum);
}
EXPORT_SYMBOL(sbuf_ring_rx_wakeup);
#endif
static int sbuf_thread(void *data)
{
struct sbuf_mgr *sbuf = data;
struct smsg mcmd, mrecv;
int rval, bufid;
struct sched_param param = {.sched_priority = 90};
/*set the thread as a real time thread, and its priority is 90*/
sched_setscheduler(current, SCHED_RR, ¶m);
/* since the channel open may hang, we call it in the sbuf thread */
rval = smsg_ch_open(sbuf->dst, sbuf->channel, -1);
if (rval != 0) {
printk(KERN_ERR "Failed to open channel %d\n", sbuf->channel);
/* assign NULL to thread poniter as failed to open channel */
sbuf->thread = NULL;
return rval;
}
/* sbuf init done, handle the ring rx events */
while (!kthread_should_stop()) {
/* monitor sbuf rdptr/wrptr update smsg */
smsg_set(&mrecv, sbuf->channel, 0, 0, 0);
rval = smsg_recv(sbuf->dst, &mrecv, -1);
if (rval == -EIO) {
/* channel state is free */
msleep(5);
continue;
}
pr_debug("sbuf thread recv msg: dst=%d, channel=%d, "
"type=%d, flag=0x%04x, value=0x%08x\n",
sbuf->dst, sbuf->channel,
mrecv.type, mrecv.flag, mrecv.value);
switch (mrecv.type) {
case SMSG_TYPE_OPEN:
/* handle channel recovery */
smsg_open_ack(sbuf->dst, sbuf->channel);
break;
case SMSG_TYPE_CLOSE:
/* handle channel recovery */
smsg_close_ack(sbuf->dst, sbuf->channel);
sbuf->state = SBUF_STATE_IDLE;
break;
case SMSG_TYPE_CMD:
/* respond cmd done for sbuf init */
WARN_ON(mrecv.flag != SMSG_CMD_SBUF_INIT);
smsg_set(&mcmd, sbuf->channel, SMSG_TYPE_DONE,
SMSG_DONE_SBUF_INIT, sbuf->smem_addr);
smsg_send(sbuf->dst, &mcmd, -1);
sbuf->state = SBUF_STATE_READY;
pr_info("sbuf-%d-%d is ready\n", sbuf->dst, sbuf->channel);
break;
case SMSG_TYPE_EVENT:
bufid = mrecv.value;
WARN_ON(bufid >= sbuf->ringnr);
switch (mrecv.flag) {
case SMSG_EVENT_SBUF_RDPTR:
wake_up_interruptible_all(&(sbuf->rings[bufid].txwait));
if (sbuf->rings[bufid].handler) {
sbuf->rings[bufid].handler(SBUF_NOTIFY_WRITE, sbuf->rings[bufid].data);
}
break;
case SMSG_EVENT_SBUF_WRPTR:
wake_up_interruptible_all(&(sbuf->rings[bufid].rxwait));
if (sbuf->rings[bufid].handler) {
sbuf->rings[bufid].handler(SBUF_NOTIFY_READ, sbuf->rings[bufid].data);
}
break;
default:
rval = 1;
break;
}
break;
default:
rval = 1;
break;
};
if (rval) {
printk(KERN_WARNING "non-handled sbuf msg: %d-%d, %d, %d, %d\n",
sbuf->dst, sbuf->channel,
mrecv.type, mrecv.flag, mrecv.value);
rval = 0;
}
}
return 0;
}
int sbuf_create(uint8_t dst, uint8_t channel, uint32_t bufnum,
uint32_t txbufsize, uint32_t rxbufsize)
{
struct sbuf_mgr *sbuf;
volatile struct sbuf_smem_header *smem;
volatile struct sbuf_ring_header *ringhd;
int hsize, i, result;
sbuf = kzalloc(sizeof(struct sbuf_mgr), GFP_KERNEL);
if (!sbuf) {
printk(KERN_ERR "Failed to allocate mgr for sbuf\n");
return -ENOMEM;
}
sbuf->state = SBUF_STATE_IDLE;
sbuf->dst = dst;
sbuf->channel = channel;
sbuf->ringnr = bufnum;
/* allocate smem */
hsize = sizeof(struct sbuf_smem_header) + sizeof(struct sbuf_ring_header) * bufnum;
sbuf->smem_size = hsize + (txbufsize + rxbufsize) * bufnum;
sbuf->smem_addr = smem_alloc(sbuf->smem_size);
if (!sbuf->smem_addr) {
printk(KERN_ERR "Failed to allocate smem for sbuf\n");
kfree(sbuf);
return -ENOMEM;
}
sbuf->smem_virt = ioremap_nocache(sbuf->smem_addr, sbuf->smem_size);
if (!sbuf->smem_virt) {
printk(KERN_ERR "Failed to map smem for sbuf\n");
smem_free(sbuf->smem_addr, sbuf->smem_size);
kfree(sbuf);
return -EFAULT;
}
/* allocate rings description */
sbuf->rings = kzalloc(sizeof(struct sbuf_ring) * bufnum, GFP_KERNEL);
if (!sbuf->rings) {
printk(KERN_ERR "Failed to allocate rings for sbuf\n");
iounmap(sbuf->smem_virt);
smem_free(sbuf->smem_addr, sbuf->smem_size);
kfree(sbuf);
return -ENOMEM;
}
/* initialize all ring bufs */
smem = (volatile struct sbuf_smem_header *)sbuf->smem_virt;
smem->ringnr = bufnum;
for (i = 0; i < bufnum; i++) {
ringhd = (volatile struct sbuf_ring_header *)&(smem->headers[i]);
ringhd->txbuf_addr = sbuf->smem_addr + hsize +
(txbufsize + rxbufsize) * i;
ringhd->txbuf_size = txbufsize;
ringhd->txbuf_rdptr = 0;
ringhd->txbuf_wrptr = 0;
ringhd->rxbuf_addr = smem->headers[i].txbuf_addr + txbufsize;
ringhd->rxbuf_size = rxbufsize;
ringhd->rxbuf_rdptr = 0;
ringhd->rxbuf_wrptr = 0;
sbuf->rings[i].header = ringhd;
sbuf->rings[i].txbuf_virt = sbuf->smem_virt + hsize +
(txbufsize + rxbufsize) * i;
sbuf->rings[i].rxbuf_virt = sbuf->rings[i].txbuf_virt + txbufsize;
init_waitqueue_head(&(sbuf->rings[i].txwait));
init_waitqueue_head(&(sbuf->rings[i].rxwait));
mutex_init(&(sbuf->rings[i].txlock));
mutex_init(&(sbuf->rings[i].rxlock));
}
sbuf->thread = kthread_create(sbuf_thread, sbuf,
"sbuf-%d-%d", dst, channel);
if (IS_ERR(sbuf->thread)) {
printk(KERN_ERR "Failed to create kthread: sbuf-%d-%d\n", dst, channel);
kfree(sbuf->rings);
iounmap(sbuf->smem_virt);
smem_free(sbuf->smem_addr, sbuf->smem_size);
result = PTR_ERR(sbuf->thread);
kfree(sbuf);
return result;
}
sbufs[dst][channel] = sbuf;
wake_up_process(sbuf->thread);
return 0;
}
void sbuf_destroy(uint8_t dst, uint8_t channel)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
int i;
if (sbuf == NULL) {
return;
}
sbuf->state = SBUF_STATE_IDLE;
smsg_ch_close(dst, channel, -1);
/* stop sbuf thread if it's created successfully and still alive */
if (!IS_ERR_OR_NULL(sbuf->thread)) {
kthread_stop(sbuf->thread);
}
if (sbuf->rings) {
for (i = 0; i < sbuf->ringnr; i++) {
wake_up_interruptible_all(&sbuf->rings[i].txwait);
wake_up_interruptible_all(&sbuf->rings[i].rxwait);
}
kfree(sbuf->rings);
}
if (sbuf->smem_virt) {
iounmap(sbuf->smem_virt);
}
smem_free(sbuf->smem_addr, sbuf->smem_size);
kfree(sbuf);
sbufs[dst][channel] = NULL;
}
int sbuf_write(uint8_t dst, uint8_t channel, uint32_t bufid,
void *buf, uint32_t len, int timeout)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
struct sbuf_ring *ring = NULL;
volatile struct sbuf_ring_header *ringhd = NULL;
struct smsg mevt;
void *txpos;
int rval, left, tail, txsize;
if (!sbuf) {
return -ENODEV;
}
ring = &(sbuf->rings[bufid]);
ringhd = ring->header;
if (sbuf->state != SBUF_STATE_READY) {
printk(KERN_ERR "sbuf-%d-%d not ready to write!\n", dst, channel);
return -ENODEV;
}
pr_debug("sbuf_write: dst=%d, channel=%d, bufid=%d, len=%d, timeout=%d\n",
dst, channel, bufid, len, timeout);
pr_debug("sbuf_write: channel=%d, wrptr=%d, rdptr=%d",
channel, ringhd->txbuf_wrptr, ringhd->txbuf_rdptr);
rval = 0;
left = len;
if (timeout) {
mutex_lock(&ring->txlock);
} else {
if (!mutex_trylock(&(ring->txlock))) {
printk(KERN_INFO "sbuf_write busy!\n");
return -EBUSY;
}
}
if (timeout == 0) {
/* no wait */
if ((int)(ringhd->txbuf_wrptr - ringhd->txbuf_rdptr) >=
ringhd->txbuf_size) {
printk(KERN_WARNING "sbuf %d-%d ring %d txbuf is full!\n",
dst, channel, bufid);
rval = -EBUSY;
}
} else if (timeout < 0) {
/* wait forever */
rval = wait_event_interruptible(ring->txwait,
(int)(ringhd->txbuf_wrptr - ringhd->txbuf_rdptr) <
ringhd->txbuf_size || sbuf->state == SBUF_STATE_IDLE);
if (rval < 0) {
printk(KERN_WARNING "sbuf_write wait interrupted!\n");
}
if (sbuf->state == SBUF_STATE_IDLE) {
printk(KERN_ERR "sbuf_write sbuf state is idle!\n");
rval = -EIO;
}
} else {
/* wait timeout */
rval = wait_event_interruptible_timeout(ring->txwait,
(int)(ringhd->txbuf_wrptr - ringhd->txbuf_rdptr) <
ringhd->txbuf_size || sbuf->state == SBUF_STATE_IDLE,
timeout);
if (rval < 0) {
printk(KERN_WARNING "sbuf_write wait interrupted!\n");
} else if (rval == 0) {
printk(KERN_WARNING "sbuf_write wait timeout!\n");
rval = -ETIME;
}
if (sbuf->state == SBUF_STATE_IDLE) {
printk(KERN_ERR "sbuf_write sbuf state is idle!\n");
rval = -EIO;
}
}
while (left && (int)(ringhd->txbuf_wrptr - ringhd->txbuf_rdptr) < ringhd->txbuf_size &&
sbuf->state == SBUF_STATE_READY) {
/* calc txpos & txsize */
txpos = ring->txbuf_virt + ringhd->txbuf_wrptr % ringhd->txbuf_size;
txsize = ringhd->txbuf_size - (int)(ringhd->txbuf_wrptr - ringhd->txbuf_rdptr);
txsize = min(txsize, left);
tail = txpos + txsize - (ring->txbuf_virt + ringhd->txbuf_size);
if (tail > 0) {
/* ring buffer is rounded */
if ((uintptr_t)buf > TASK_SIZE) {
unalign_memcpy(txpos, buf, txsize - tail);
unalign_memcpy(ring->txbuf_virt, buf + txsize - tail, tail);
} else {
if(unalign_copy_from_user(txpos, (void __user *)buf, txsize - tail) ||
unalign_copy_from_user(ring->txbuf_virt,
(void __user *)(buf + txsize - tail), tail)) {
printk(KERN_ERR "sbuf_write: failed to copy from user!\n");
rval = -EFAULT;
break;
}
}
} else {
if ((uintptr_t)buf > TASK_SIZE) {
unalign_memcpy(txpos, buf, txsize);
} else {
/* handle the user space address */
if(unalign_copy_from_user(txpos, (void __user *)buf, txsize)) {
printk(KERN_ERR "sbuf_write: failed to copy from user!\n");
rval = -EFAULT;
break;
}
}
}
pr_debug("sbuf_write: channel=%d, txpos=%p, txsize=%d\n", channel, txpos, txsize);
/* update tx wrptr */
ringhd->txbuf_wrptr = ringhd->txbuf_wrptr + txsize;
/* tx ringbuf is empty, so need to notify peer side */
if(ringhd->txbuf_wrptr - ringhd->txbuf_rdptr == txsize) {
smsg_set(&mevt, channel, SMSG_TYPE_EVENT, SMSG_EVENT_SBUF_WRPTR, bufid);
smsg_send(dst, &mevt, -1);
}
left -= txsize;
buf += txsize;
}
mutex_unlock(&ring->txlock);
pr_debug("sbuf_write done: channel=%d, len=%d\n", channel, len - left);
if (len == left) {
return rval;
} else {
return (len - left);
}
}
int sbuf_read(uint8_t dst, uint8_t channel, uint32_t bufid,
void *buf, uint32_t len, int timeout)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
struct sbuf_ring *ring = NULL;
volatile struct sbuf_ring_header *ringhd = NULL;
struct smsg mevt;
void *rxpos;
int rval, left, tail, rxsize;
if (!sbuf) {
return -ENODEV;
}
ring = &(sbuf->rings[bufid]);
ringhd = ring->header;
if (sbuf->state != SBUF_STATE_READY) {
printk(KERN_ERR "sbuf-%d-%d not ready to read!\n", dst, channel);
return -ENODEV;
}
pr_debug("sbuf_read: dst=%d, channel=%d, bufid=%d, len=%d, timeout=%d\n",
dst, channel, bufid, len, timeout);
pr_debug("sbuf_read: channel=%d, wrptr=%d, rdptr=%d",
channel, ringhd->rxbuf_wrptr, ringhd->rxbuf_rdptr);
rval = 0;
left = len;
if (timeout) {
mutex_lock(&ring->rxlock);
} else {
if (!mutex_trylock(&(ring->rxlock))) {
printk(KERN_INFO "sbuf_read busy!\n");
return -EBUSY;
}
}
if (ringhd->rxbuf_wrptr == ringhd->rxbuf_rdptr) {
if (timeout == 0) {
/* no wait */
printk(KERN_WARNING "sbuf %d-%d ring %d rxbuf is empty!\n",
dst, channel, bufid);
rval = -ENODATA;
} else if (timeout < 0) {
/* wait forever */
rval = wait_event_interruptible(ring->rxwait,
ringhd->rxbuf_wrptr != ringhd->rxbuf_rdptr ||
sbuf->state == SBUF_STATE_IDLE);
if (rval < 0) {
printk(KERN_WARNING "sbuf_read wait interrupted!\n");
}
if (sbuf->state == SBUF_STATE_IDLE) {
printk(KERN_ERR "sbuf_read sbuf state is idle!\n");
rval = -EIO;
}
} else {
/* wait timeout */
rval = wait_event_interruptible_timeout(ring->rxwait,
ringhd->rxbuf_wrptr != ringhd->rxbuf_rdptr ||
sbuf->state == SBUF_STATE_IDLE, timeout);
if (rval < 0) {
printk(KERN_WARNING "sbuf_read wait interrupted!\n");
} else if (rval == 0) {
printk(KERN_WARNING "sbuf_read wait timeout!\n");
rval = -ETIME;
}
if (sbuf->state == SBUF_STATE_IDLE) {
printk(KERN_ERR "sbuf_read sbuf state is idle!\n");
rval = -EIO;
}
}
}
while (left && (ringhd->rxbuf_wrptr != ringhd->rxbuf_rdptr) &&
sbuf->state == SBUF_STATE_READY) {
/* calc rxpos & rxsize */
rxpos = ring->rxbuf_virt + ringhd->rxbuf_rdptr % ringhd->rxbuf_size;
rxsize = (int)(ringhd->rxbuf_wrptr - ringhd->rxbuf_rdptr);
/* check overrun */
WARN_ON(rxsize > ringhd->rxbuf_size);
rxsize = min(rxsize, left);
pr_debug("sbuf_read: channel=%d, buf=%p, rxpos=%p, rxsize=%d\n", channel, buf, rxpos, rxsize);
tail = rxpos + rxsize - (ring->rxbuf_virt + ringhd->rxbuf_size);
if (tail > 0) {
/* ring buffer is rounded */
if ((uintptr_t)buf > TASK_SIZE) {
unalign_memcpy(buf, rxpos, rxsize - tail);
unalign_memcpy(buf + rxsize - tail, ring->rxbuf_virt, tail);
} else {
/* handle the user space address */
if(unalign_copy_to_user((void __user *)buf, rxpos, rxsize - tail) ||
unalign_copy_to_user((void __user *)(buf + rxsize - tail),
ring->rxbuf_virt, tail)) {
printk(KERN_ERR "sbuf_read: failed to copy to user!\n");
rval = -EFAULT;
break;
}
}
} else {
if ((uintptr_t)buf > TASK_SIZE) {
unalign_memcpy(buf, rxpos, rxsize);
} else {
/* handle the user space address */
if (unalign_copy_to_user((void __user *)buf, rxpos, rxsize)) {
printk(KERN_ERR "sbuf_read: failed to copy to user!\n");
rval = -EFAULT;
break;
}
}
}
/* update rx rdptr */
ringhd->rxbuf_rdptr = ringhd->rxbuf_rdptr + rxsize;
/* rx ringbuf is full ,so need to notify peer side */
if(ringhd->rxbuf_wrptr - ringhd->rxbuf_rdptr == ringhd->rxbuf_size - rxsize) {
smsg_set(&mevt, channel, SMSG_TYPE_EVENT, SMSG_EVENT_SBUF_RDPTR, bufid);
smsg_send(dst, &mevt, -1);
}
left -= rxsize;
buf += rxsize;
}
mutex_unlock(&ring->rxlock);
pr_debug("sbuf_read done: channel=%d, len=%d", channel, len - left);
if (len == left) {
return rval;
} else {
return (len - left);
}
}
int sbuf_poll_wait(uint8_t dst, uint8_t channel, uint32_t bufid,
struct file *filp, poll_table *wait)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
struct sbuf_ring *ring = NULL;
volatile struct sbuf_ring_header *ringhd = NULL;
unsigned int mask = 0;
if (!sbuf) {
return -ENODEV;
}
ring = &(sbuf->rings[bufid]);
ringhd = ring->header;
if (sbuf->state != SBUF_STATE_READY) {
printk(KERN_ERR "sbuf-%d-%d not ready to poll !\n", dst, channel);
return -ENODEV;
}
poll_wait(filp, &ring->txwait, wait);
poll_wait(filp, &ring->rxwait, wait);
if (ringhd->rxbuf_wrptr != ringhd->rxbuf_rdptr) {
mask |= POLLIN | POLLRDNORM;
}
if (ringhd->txbuf_wrptr - ringhd->txbuf_rdptr < ringhd->txbuf_size) {
mask |= POLLOUT | POLLWRNORM;
}
return mask;
}
int sbuf_status(uint8_t dst, uint8_t channel)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
if (!sbuf) {
return -ENODEV;
}
if (sbuf->state != SBUF_STATE_READY) {
return -ENODEV;
}
return 0;
}
int sbuf_register_notifier(uint8_t dst, uint8_t channel, uint32_t bufid,
void (*handler)(int event, void *data), void *data)
{
struct sbuf_mgr *sbuf = sbufs[dst][channel];
struct sbuf_ring *ring = NULL;
if (!sbuf) {
return -ENODEV;
}
ring = &(sbuf->rings[bufid]);
ring->handler = handler;
ring->data = data;
return 0;
}
#if defined(CONFIG_DEBUG_FS)
static int sbuf_debug_show(struct seq_file *m, void *private)
{
struct sbuf_mgr *sbuf = NULL;
struct sbuf_ring *rings = NULL;
volatile struct sbuf_ring_header *ring = NULL;
int i, j, n;
for (i = 0; i < SIPC_ID_NR; i++) {
for (j=0; j< SMSG_CH_NR; j++) {
sbuf = sbufs[i][j];
if (!sbuf) {
continue;
}
seq_printf(m, "sbuf dst 0x%0x, channel: 0x%0x, state: %d, smem_virt: 0x%lx, smem_addr: 0x%0x, smem_size: 0x%0x, ringnr: %d \n",
sbuf->dst, sbuf->channel, sbuf->state, (size_t)sbuf->smem_virt, sbuf->smem_addr, sbuf->smem_size, sbuf->ringnr);
for (n=0; n < sbuf->ringnr; n++) {
rings = &(sbuf->rings[n]);
ring = rings->header;
seq_printf(m, "sbuf ring[%d]: rxbuf_addr :0x%0x, rxbuf_rdptr :0x%0x, rxbuf_wrptr :0x%0x, rxbuf_size :0x%0x \n", n, ring->rxbuf_addr, ring->rxbuf_rdptr, ring->rxbuf_wrptr, ring->rxbuf_size);
seq_printf(m, "sbuf ring[%d]: txbuf_addr :0x%0x, txbuf_rdptr :0x%0x, txbuf_wrptr :0x%0x, txbuf_size :0x%0x \n", n, ring->txbuf_addr, ring->txbuf_rdptr, ring->txbuf_wrptr, ring->txbuf_size);
}
}
}
return 0;
}
static int sbuf_debug_open(struct inode *inode, struct file *file)
{
return single_open(file, sbuf_debug_show, inode->i_private);
}
static const struct file_operations sbuf_debug_fops = {
.open = sbuf_debug_open,
.read = seq_read,
.llseek = seq_lseek,
.release = single_release,
};
int sbuf_init_debugfs( void *root )
{
if (!root)
return -ENXIO;
debugfs_create_file("sbuf", S_IRUGO, (struct dentry *)root, NULL, &sbuf_debug_fops);
return 0;
}
#endif /* CONFIG_DEBUG_FS */
EXPORT_SYMBOL(sbuf_create);
EXPORT_SYMBOL(sbuf_destroy);
EXPORT_SYMBOL(sbuf_write);
EXPORT_SYMBOL(sbuf_read);
EXPORT_SYMBOL(sbuf_poll_wait);
EXPORT_SYMBOL(sbuf_status);
EXPORT_SYMBOL(sbuf_register_notifier);
MODULE_AUTHOR("Chen Gaopeng");
MODULE_DESCRIPTION("SIPC/SBUF driver");
MODULE_LICENSE("GPL");
| AndroidDevelopersTeam/android_kernel_samsung_j2xlte_dd | drivers/sipc/sbuf.c | C | gpl-2.0 | 18,438 |
/***************************************************************************
qgsprocessingparametertypeimpl.h
------------------------
begin : March 2018
copyright : (C) 2018 by Matthias Kuhn
email : matthias@opengis.ch
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSPROCESSINGPARAMETERTYPEIMPL_H
#define QGSPROCESSINGPARAMETERTYPEIMPL_H
#include "qgis.h"
#include "qgis_sip.h"
#include "qgsprocessingparametertype.h"
#include <QCoreApplication>
#define SIP_NO_FILE
/**
* A raster layer parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeRasterLayer : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterRasterLayer( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A raster layer parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Raster Layer" );
}
virtual QString id() const override
{
return QStringLiteral( "raster" );
}
};
/**
* A vector layer parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeVectorLayer : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterVectorLayer( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A vector layer parameter, e.g. for algorithms which change layer styles, edit layers in place, or other operations which affect an entire layer." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Vector Layer" );
}
virtual QString id() const override
{
return QStringLiteral( "vector" );
}
};
/**
* A boolean parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeBoolean : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterBoolean( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A boolean parameter, for true/false values." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Boolean" );
}
virtual QString id() const override
{
return QStringLiteral( "boolean" );
}
};
/**
* A crs parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeCrs : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterCrs( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A coordinate reference system (CRS) input parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "CRS" );
}
virtual QString id() const override
{
return QStringLiteral( "crs" );
}
};
/**
* A numeric range parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeRange : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterRange( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A numeric range parameter for processing algorithms." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Range" );
}
virtual QString id() const override
{
return QStringLiteral( "range" );
}
};
/**
* A point parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypePoint : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterPoint( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A geographic point parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Point" );
}
virtual QString id() const override
{
return QStringLiteral( "point" );
}
};
/**
* An enum based parameter for processing algorithms, allowing for selection from predefined values.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeEnum : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterEnum( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "TODO." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Enum" );
}
virtual QString id() const override
{
return QStringLiteral( "enum" );
}
};
/**
* A rectangular map extent parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeExtent : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterExtent( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A map extent parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Extent" );
}
virtual QString id() const override
{
return QStringLiteral( "extent" );
}
};
/**
* A table (matrix) parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeMatrix : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterMatrix( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A table (matrix) parameter for processing algorithms." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Matrix" );
}
virtual QString id() const override
{
return QStringLiteral( "matrix" );
}
};
/**
* An input file or folder parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeFile : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterFile( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A file parameter, for use with non-map layer file sources." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "File" );
}
virtual QString id() const override
{
return QStringLiteral( "file" );
}
};
/**
* A vector layer or feature source field parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeField : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterField( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A vector field parameter, for selecting an existing field from a vector source." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Vector Field" );
}
virtual QString id() const override
{
return QStringLiteral( "field" );
}
};
/**
* A vector layer destination parameter, for specifying the destination path for a vector layer
* created by the algorithm.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeVectorDestination : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterVectorDestination( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A vector layer destination parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Vector Destination" );
}
virtual QString id() const override
{
return QStringLiteral( "vectorDestination" );
}
virtual ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();
#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif
return flags;
}
};
/**
* A generic file based destination parameter, for specifying the destination path for a file (non-map layer)
* created by the algorithm.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeFileDestination : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterFileDestination( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A generic file based destination parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "File Destination" );
}
virtual QString id() const override
{
return QStringLiteral( "fileDestination" );
}
virtual ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();
#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif
return flags;
}
};
/**
* A folder destination parameter, for specifying the destination path for a folder created
* by the algorithm or used for creating new files within the algorithm.
* A folder output parameter.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeFolderDestination : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterFolderDestination( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A folder destination parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Folder Destination" );
}
virtual QString id() const override
{
return QStringLiteral( "folderDestination" );
}
virtual ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();
#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif
return flags;
}
};
/**
* A raster layer destination parameter, for specifying the destination path for a raster layer
* created by the algorithm.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeRasterDestination : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterRasterDestination( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A raster layer destination parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Raster Destination" );
}
virtual QString id() const override
{
return QStringLiteral( "rasterDestination" );
}
virtual ParameterFlags flags() const override
{
ParameterFlags flags = QgsProcessingParameterType::flags();
#if QT_VERSION >= 0x50700
flags.setFlag( ParameterFlag::ExposeToModeler, false );
#else
flags &= ~ParameterFlag::ExposeToModeler;
#endif
return flags;
}
};
/**
* A string parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeString : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterString( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A freeform string parameter." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "String" );
}
virtual QString id() const override
{
return QStringLiteral( "string" );
}
};
/**
* A parameter for processing algorithms which accepts multiple map layers.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeMultipleLayers : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterMultipleLayers( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "An input allowing selection of multiple sources, including multiple map layers or file sources." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Multiple Input" );
}
virtual QString id() const override
{
return QStringLiteral( "multilayer" );
}
};
/**
* An input feature source (such as vector layers) parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeFeatureSource : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterFeatureSource( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A vector feature parameter, e.g. for algorithms which operate on the features within a layer." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Vector Features" );
}
virtual QString id() const override
{
return QStringLiteral( "source" );
}
};
/**
* A numeric parameter for processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeNumber : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterNumber( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A numeric parameter, including float or integer values." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Number" );
}
virtual QString id() const override
{
return QStringLiteral( "number" );
}
};
/**
* A raster band parameter for Processing algorithms.
*
* \since QGIS 3.2
* \ingroup core
* \note No Python bindings available. Get your copy from QgsApplication.processingRegistry().parameterType()
*/
class CORE_EXPORT QgsProcessingParameterTypeBand : public QgsProcessingParameterType
{
virtual QgsProcessingParameterDefinition *create( const QString &name ) const override SIP_FACTORY
{
return new QgsProcessingParameterBand( name );
}
virtual QString description() const override
{
return QCoreApplication::translate( "Processing", "A raster band parameter, for selecting an existing band from a raster source." );
}
virtual QString name() const override
{
return QCoreApplication::translate( "Processing", "Raster Band" );
}
virtual QString id() const override
{
return QStringLiteral( "band" );
}
};
#endif // QGSPROCESSINGPARAMETERTYPEIMPL_H
| CS-SI/QGIS | src/core/processing/qgsprocessingparametertypeimpl.h | C | gpl-2.0 | 20,557 |
<?php get_header(); ?>
</div><!-- header-area -->
</div><!-- end rays -->
</div><!-- end header-holder -->
</div><!-- end header -->
<?php truethemes_before_main_hook();// action hook, see truethemes_framework/global/hooks.php ?>
<div id="main">
<?php
$ka_results_title = get_option('ka_results_title');
$ka_results_fallback = get_option('ka_results_fallback');
$ka_404message = get_option('ka_404message');
$ka_404sitemap = get_option('ka_404sitemap');
$ka_searchbar = get_option('ka_searchbar');
$ka_crumbs = get_option('ka_crumbs');
?>
<div class="main-area search-main-area">
<div class="tools">
<div class="holder">
<div class="frame">
<?php truethemes_before_article_title_hook();// action hook, see truethemes_framework/global/hooks.php ?>
<h1><?php echo $ka_results_title; ?></h1>
<?php if ($ka_searchbar == "true"){get_template_part('searchform','childtheme');} else {} ?>
<?php if ($ka_crumbs == "true"){ $bc = new simple_breadcrumb;} else {} ?>
<?php truethemes_after_searchform_hook();// action hook, see truethemes_framework/global/hooks.php ?>
</div><!-- end frame -->
</div><!-- end holder -->
</div><!-- end tools -->
<div class="main-holder">
<div id="content">
<h2 class="search-title">Search Results for "<?php the_search_query(); ?>"</h2><br />
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<ul class="search-list">
<li><strong><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></strong><br />
<?php
ob_start();
the_content();
$old_content = ob_get_clean();
$new_content = strip_tags($old_content);
echo substr($new_content,0,300).'...';
?>
</li>
</ul>
<?php endwhile; else: ?>
<?php echo $ka_results_fallback; ?>
<?php endif; ?>
<?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?>
</div><!-- end content -->
<div id="sidebar" class="right_sidebar">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar("Search Results Sidebar") ) : ?><?php endif; ?>
</div><!-- end sidebar -->
</div><!-- end main-holder -->
</div><!-- main-area -->
<?php get_footer(); ?> | oniiru/iono | wp-content/themes/Karma/search.php | PHP | gpl-2.0 | 2,080 |
/**
* Tests the OutOfDomainException
*/
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/ui/text/TestRunner.h>
#include "OutOfDomainException.h"
int
main(int argc, char* argv[])
{
// Get the top level suite from the registry
CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest();
// Adds the test to the list of test to run
CppUnit::TextUi::TestRunner runner;
runner.addTest( suite );
// Change the default outputter to a compiler error format outputter
runner.setOutputter( new CppUnit::CompilerOutputter( &runner.result(),
std::cerr ) );
// Run the tests.
bool wasSucessful = runner.run();
// Return error code 1 if the one of test failed.
return wasSucessful ? 0 : 1;
}
| jbavari/DestructionOverdrive | test/XmlSerializationExceptionTest/check_XmlSerializationException.cpp | C++ | gpl-2.0 | 842 |
include ../build.mk
.PHONY: all
default: all
all: sstring.o array.o splitline.o base64.o flags.o irc_string.o strlfunc.o sha1.o irc_ipv6.o rijndael.o sha2.o hmac.o prng.o md5.o stringbuf.o cbc.o
| NikosPapakonstantinou/newserv | lib/Makefile | Makefile | gpl-2.0 | 198 |
# -*- coding: utf-8 -*-
from harpia.model.connectionmodel import ConnectionModel as ConnectionModel
from harpia.system import System as System
class DiagramModel(object):
# ----------------------------------------------------------------------
def __init__(self):
self.last_id = 1 # first block is n1, increments to each new block
self.blocks = {} # GUI blocks
self.connectors = []
self.zoom = 1.0 # pixels per unit
self.file_name = "Untitled"
self.modified = False
self.language = None
self.undo_stack = []
self.redo_stack = []
# ----------------------------------------------------------------------
@property
def patch_name(self):
return self.file_name.split("/").pop()
# ----------------------------------------------------------------------
| llgoncalves/harpia | harpia/model/diagrammodel.py | Python | gpl-2.0 | 854 |
# Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
import os
from PyQt4 import QtGui, Qt, QtCore
from opus_gui.general_manager.views.ui_dependency_viewer import Ui_DependencyViewer
class DependencyViewer(QtGui.QDialog, Ui_DependencyViewer):
def __init__(self, parent_window):
flags = QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowSystemMenuHint | QtCore.Qt.WindowMaximizeButtonHint
QtGui.QDialog.__init__(self, parent_window, flags)
self.setupUi(self)
self.setModal(True) #TODO: this shouldn't be necessary, but without it the window is unresponsive
def show_error_message(self):
self.lbl_error.setVisible(True)
self.scrollArea.setVisible(False)
def show_graph(self, file_path, name):
self.lbl_error.setVisible(False)
self.scrollArea.setVisible(True)
self.setWindowTitle("Dependency graph of %s" % name)
self.image_file = file_path
pix = QtGui.QPixmap.fromImage(QtGui.QImage(file_path))
self.label.setPixmap(pix)
self.scrollAreaWidgetContents.setMinimumSize(pix.width(), pix.height())
self.label.setMinimumSize(pix.width(), pix.height())
rect = Qt.QApplication.desktop().screenGeometry(self)
self.resize(min(rect.width(), pix.width() + 35), min(rect.height(), pix.height() + 80))
self.update()
def on_closeWindow_released(self):
self.close()
os.remove(self.image_file)
| christianurich/VIBe2UrbanSim | 3rdparty/opus/src/opus_gui/general_manager/controllers/dependency_viewer.py | Python | gpl-2.0 | 1,509 |
/**
* Copyright (c) 2012 Anders Ekdahl (http://coffeescripter.com/)
* Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
* and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
*
* Version: 1.2.7
*
* Demo and documentation: http://coffeescripter.com/code/ad-gallery/
*/
.ad-gallery {
width: 95%;
}
.ad-gallery, .ad-gallery * {
margin:auto;
padding: 0;
}
.ad-gallery .ad-image-wrapper {
width: 95%;
height: 250px;
margin-bottom: 10px;
position: relative;
overflow: hidden;
margin:auto;
}
.ad-gallery .ad-image-wrapper .ad-loader {
position: absolute;
z-index: 10;
top: 48%;
left: 48%;
border: 1px solid #CCC;
}
.ad-gallery .ad-image-wrapper .ad-next {
position: absolute;
right: 0;
top: 0;
width: 10%;
height: 100%;
cursor: pointer;
display: block;
z-index: 200;
}
.ad-gallery .ad-image-wrapper .ad-prev {
position: absolute;
left: 0;
top: 0;
width: 10%;
height: 100%;
cursor: pointer;
display: block;
z-index: 200;
}
.ad-gallery .ad-image-wrapper .ad-prev, .ad-gallery .ad-image-wrapper .ad-next {
/* Or else IE will hide it */
background: url(trans.gif);
}
.ad-gallery .ad-image-wrapper .ad-prev .ad-prev-image, .ad-gallery .ad-image-wrapper .ad-next .ad-next-image {
background: url(ad_prev.png);
width: 30px;
height: 30px;
display: none;
position: absolute;
top: 47%;
left: 0;
z-index: 101;
}
.ad-gallery .ad-image-wrapper .ad-next .ad-next-image {
background: url(ad_next.png);
width: 30px;
height: 30px;
right: 0;
left: auto;
}
.ad-gallery .ad-image-wrapper .ad-image {
position: absolute;
overflow: hidden;
top: 0;
left: 0;
z-index: 9;
}
.ad-gallery .ad-image-wrapper .ad-image a img {
border: 0;
}
.ad-gallery .ad-image-wrapper .ad-image .ad-image-description {
position: absolute;
bottom: 0px;
left: 0px;
padding: 7px;
text-align: center;
width: 100%;
z-index: 2;
background: url(opa75.png);
color: rgb(250, 55, 94);
}
* html .ad-gallery .ad-image-wrapper .ad-image .ad-image-description {
background: none;
filter:progid:DXImageTransform.Microsoft.AlphaImageLoader (enabled=true, sizingMethod=scale, src='opa75.png');
}
.ad-gallery .ad-image-wrapper .ad-image .ad-image-description .ad-description-title {
display: block;
}
.ad-gallery .ad-controls {
height: 20px;
}
.ad-gallery .ad-info {
float: left;
}
.ad-gallery .ad-slideshow-controls {
float: right;
}
.ad-gallery .ad-slideshow-controls .ad-slideshow-start, .ad-gallery .ad-slideshow-controls .ad-slideshow-stop {
padding-left: 5px;
cursor: pointer;
}
.ad-gallery .ad-slideshow-controls .ad-slideshow-countdown {
padding-left: 5px;
font-size: 0.9em;
}
.ad-gallery .ad-slideshow-running .ad-slideshow-start {
cursor: default;
font-style: italic;
}
.ad-gallery .ad-nav {
width: 95%;
position: relative;
margin:auto;
height: 100px;
}
.ad-gallery .ad-forward, .ad-gallery .ad-back {
position: absolute;
top: 0;
height: 100%;
z-index: 10;
}
/* IE 6 doesn't like height: 100% */
* html .ad-gallery .ad-forward, .ad-gallery .ad-back {
height: 100px;
}
.ad-gallery .ad-back {
cursor: pointer;
left: -20px;
width: 13px;
display: block;
background: url(ad_scroll_back.png) 0px 22px no-repeat;
}
.ad-gallery .ad-forward {
cursor: pointer;
display: block;
right: -20px;
width: 13px;
background: url(ad_scroll_forward.png) 0px 22px no-repeat;
}
.ad-gallery .ad-nav .ad-thumbs {
overflow: hidden;
width: 95%;
}
.ad-gallery .ad-thumbs .ad-thumb-list {
float: left;
width: 9000px;
list-style: none;
}
.ad-gallery .ad-thumbs li {
float: left;
padding-right: 5px;
}
.ad-gallery .ad-thumbs li a {
display: block;
}
.ad-gallery .ad-thumbs li a img {
border: 3px solid #CCC;
display: block;
}
.ad-gallery .ad-thumbs li a.ad-active img {
border: 3px solid #616161;
}
/* Can't do display none, since Opera won't load the images then */
.ad-preloads {
position: absolute;
left: -9000px;
top: -9000px;
}
.ad-image {
cursor: pointer;
}
table { table-layout: fixed; width: 100%; }
| EasyLovine/ZencTbi | ezl_utile/editionSEO/ckeditor/plugins/3rdParty/ad-gallery/jquery.ad-gallery.css | CSS | gpl-2.0 | 4,885 |
<?php
/**
* Column menu options
*
* @package Lambda
* @subpackage Admin
*
* @copyright (c) 2015 Oxygenna.com
* @license **LICENSE**
* @version 1.17.0
* @author Oxygenna.com
*/
require_once OXY_TF_DIR . 'inc/options/fields/select/OxygennaSelect.php';
// create options and value for icon select
$widget_option = array(
'name' => 'Widget',
'desc' => 'Widget',
'id' => 'Widget',
'type' => 'select',
'options' => array(
'on' => __('On', 'lambda-admin-td'),
'' => __('Off', 'lambda-admin-td'),
),
'default' => ''
);
$widget_select_value = isset($item->oxy_widget) ? esc_attr($item->oxy_widget) : '';
$widget_select = new OxygennaSelect($widget_option, $widget_select_value, array(
'id' => 'edit-menu-item-widget-' . $item_id,
'name' => 'menu-item-oxy_widget[' . $item_id . ']',
'class' => 'widefat edit-menu-item-widget',
));
?>
<p class="field-widget oxy-widget description-wide">
<label for="edit-menu-item-oxy-widget-<?php echo $item_id; ?>">
<?php _e('Use Column As Widget', 'lambda-admin-td'); ?><br />
<?php $widget_select->render(); ?>
<span class="description"><?php _e('This will set this column up to be used as a widget position.', 'lambda-admin-td'); ?></span>
</label>
</p>
<p class="field-url oxy_col_url description-wide">
<label for="edit-menu-item-oxy_col_url-<?php echo $item_id; ?>">
<?php _e('Column Title URL', 'lambda-admin-td'); ?><br />
<input type="text" id="edit-menu-item-oxy_col_url-<?php echo $item_id; ?>" class="widefat code edit-menu-item-oxy_col_url" name="menu-item-oxy_col_url[<?php echo $item_id; ?>]" value="<?php echo esc_attr($item->oxy_col_url); ?>" />
<span class="description"><?php _e('Leave blank if column title is not linkable.', 'lambda-admin-td'); ?></span>
</label>
</p>
| ntngiri/Wordpress-dhaba | wp-content/themes/themeSite1/vendor/oxygenna/oxygenna-mega-menu/partials/options/top/oxy_mega_columns.php | PHP | gpl-2.0 | 1,861 |
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
* Copyright (c) 2005, 2006, 2007, 2008, 2009 Ciaran McCreesh
*
* This file is part of the Paludis package manager. Paludis 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.
*
* Paludis 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 <paludis/repositories/e/traditional_profile.hh>
#include <paludis/repositories/e/profile_file.hh>
#include <paludis/repositories/e/e_repository_mask_file.hh>
#include <paludis/repositories/e/e_repository_exceptions.hh>
#include <paludis/repositories/e/e_repository.hh>
#include <paludis/repositories/e/eapi.hh>
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/save.hh>
#include <paludis/util/system.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/wrapped_output_iterator.hh>
#include <paludis/util/join.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/set.hh>
#include <paludis/util/options.hh>
#include <paludis/util/iterator_funcs.hh>
#include <paludis/util/create_iterator-impl.hh>
#include <paludis/util/config_file.hh>
#include <paludis/util/hashes.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/map.hh>
#include <paludis/choice.hh>
#include <paludis/dep_tag.hh>
#include <paludis/environment.hh>
#include <paludis/match_package.hh>
#include <paludis/distribution.hh>
#include <paludis/package_id.hh>
#include <paludis/metadata_key.hh>
#include <tr1/unordered_map>
#include <tr1/unordered_set>
#include <list>
#include <algorithm>
#include <set>
#include <vector>
#include <strings.h>
#include <ctype.h>
using namespace paludis;
using namespace paludis::erepository;
typedef std::tr1::unordered_map<std::string, std::tr1::shared_ptr<Set<UnprefixedChoiceName> > > KnownMap;
namespace
{
typedef std::tr1::unordered_map<std::string, std::string, Hash<std::string> > EnvironmentVariablesMap;
typedef std::tr1::unordered_map<QualifiedPackageName,
std::list<std::pair<std::tr1::shared_ptr<const PackageDepSpec>, std::tr1::shared_ptr<const RepositoryMaskInfo> > >,
Hash<QualifiedPackageName> > PackageMaskMap;
typedef std::tr1::unordered_map<ChoiceNameWithPrefix, bool, Hash<ChoiceNameWithPrefix> > FlagStatusMap;
typedef std::list<std::pair<std::tr1::shared_ptr<const PackageDepSpec>, FlagStatusMap> > PackageFlagStatusMapList;
struct StackedValues
{
std::string origin;
FlagStatusMap use_mask;
FlagStatusMap use_force;
PackageFlagStatusMapList package_use;
PackageFlagStatusMapList package_use_mask;
PackageFlagStatusMapList package_use_force;
StackedValues(const std::string & o) :
origin(o)
{
}
};
typedef std::list<StackedValues> StackedValuesList;
}
namespace paludis
{
/**
* Implementation for TraditionalProfile.
*
* \ingroup grperepository
* \see TraditionalProfile
*/
template<>
class Implementation<TraditionalProfile>
{
private:
void load_environment();
void load_profile_directory_recursively(const FSEntry & dir);
void load_profile_parent(const FSEntry & dir);
void load_profile_make_defaults(const FSEntry & dir);
void load_basic_use_file(const FSEntry & file, FlagStatusMap & m);
void load_spec_use_file(const EAPI &, const FSEntry & file, PackageFlagStatusMapList & m);
void add_use_expand_to_use();
void fish_out_use_expand_names();
void make_vars_from_file_vars();
void handle_profile_arch_var(const std::string &);
void load_special_make_defaults_vars(const FSEntry &);
ProfileFile<LineConfigFile> packages_file;
ProfileFile<LineConfigFile> virtuals_file;
ProfileFile<MaskFile> package_mask_file;
bool is_incremental(const EAPI &, const std::string & s) const;
public:
///\name General variables
///\{
const Environment * const env;
const ERepository * const repository;
std::tr1::shared_ptr<FSEntrySequence> profiles_with_parents;
///\}
///\name Environment variables
///\{
EnvironmentVariablesMap environment_variables;
///\}
///\name System package set
///\{
std::tr1::shared_ptr<SetSpecTree> system_packages;
std::tr1::shared_ptr<GeneralSetDepTag> system_tag;
///\}
///\name Virtuals
///\{
std::tr1::shared_ptr<Map<QualifiedPackageName, PackageDepSpec> > virtuals;
///\}
///\name USE related values
///\{
std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> > use;
std::tr1::shared_ptr<Set<std::string> > use_expand;
std::tr1::shared_ptr<Set<std::string> > use_expand_hidden;
std::tr1::shared_ptr<Set<std::string> > use_expand_unprefixed;
std::tr1::shared_ptr<Set<std::string> > use_expand_implicit;
std::tr1::shared_ptr<Set<std::string> > iuse_implicit;
std::tr1::unordered_map<std::string, std::tr1::shared_ptr<Set<std::string> > > use_expand_values;
KnownMap known_choice_value_names;
mutable Mutex known_choice_value_names_for_separator_mutex;
mutable std::tr1::unordered_map<char, KnownMap> known_choice_value_names_for_separator;
StackedValuesList stacked_values_list;
///\}
///\name Masks
///\{
PackageMaskMap package_mask;
///\}
///\name Basic operations
///\{
Implementation(const Environment * const e, const ERepository * const p,
const RepositoryName & name, const FSEntrySequence & dirs,
const std::string & arch_var_if_special, const bool profiles_explicitly_set) :
packages_file(p),
virtuals_file(p),
package_mask_file(p),
env(e),
repository(p),
profiles_with_parents(new FSEntrySequence),
system_packages(new SetSpecTree(make_shared_ptr(new AllDepSpec))),
system_tag(new GeneralSetDepTag(SetName("system"), stringify(name))),
virtuals(new Map<QualifiedPackageName, PackageDepSpec>),
use_expand(new Set<std::string>),
use_expand_hidden(new Set<std::string>),
use_expand_unprefixed(new Set<std::string>),
use_expand_implicit(new Set<std::string>),
iuse_implicit(new Set<std::string>)
{
Context context("When loading profiles '" + join(dirs.begin(), dirs.end(), "' '") + "' for repository '" + stringify(name) + "':");
if (dirs.empty())
throw ERepositoryConfigurationError("No profiles directories specified");
load_environment();
for (FSEntrySequence::ConstIterator d(dirs.begin()), d_end(dirs.end()) ;
d != d_end ; ++d)
{
Context subcontext("When using directory '" + stringify(*d) + "':");
if (profiles_explicitly_set)
if (! p->params().ignore_deprecated_profiles())
if ((*d / "deprecated").is_regular_file_or_symlink_to_regular_file())
Log::get_instance()->message("e.profile.deprecated", ll_warning, lc_context) << "Profile directory '" << *d
<< "' is deprecated. See the file '" << (*d / "deprecated") << "' for details";
load_profile_directory_recursively(*d);
}
make_vars_from_file_vars();
load_special_make_defaults_vars(*dirs.begin());
add_use_expand_to_use();
fish_out_use_expand_names();
if (! arch_var_if_special.empty())
handle_profile_arch_var(arch_var_if_special);
}
~Implementation()
{
}
///\}
};
}
void
Implementation<TraditionalProfile>::load_environment()
{
environment_variables["CONFIG_PROTECT"] = getenv_with_default("CONFIG_PROTECT", "/etc");
environment_variables["CONFIG_PROTECT_MASK"] = getenv_with_default("CONFIG_PROTECT_MASK", "");
}
void
Implementation<TraditionalProfile>::load_profile_directory_recursively(const FSEntry & dir)
{
Context context("When adding profile directory '" + stringify(dir) + ":");
if (! dir.is_directory_or_symlink_to_directory())
{
Log::get_instance()->message("e.profile.not_a_directory", ll_warning, lc_context)
<< "Profile component '" << dir << "' is not a directory";
return;
}
const std::tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(
repository->eapi_for_file(dir / "use.mask")));
if (! eapi->supported())
throw ERepositoryConfigurationError("Can't use profile directory '" + stringify(dir) +
"' because it uses an unsupported EAPI");
stacked_values_list.push_back(StackedValues(stringify(dir)));
load_profile_parent(dir);
load_profile_make_defaults(dir);
load_basic_use_file(dir / "use.mask", stacked_values_list.back().use_mask);
load_basic_use_file(dir / "use.force", stacked_values_list.back().use_force);
load_spec_use_file(*eapi, dir / "package.use", stacked_values_list.back().package_use);
load_spec_use_file(*eapi, dir / "package.use.mask", stacked_values_list.back().package_use_mask);
load_spec_use_file(*eapi, dir / "package.use.force", stacked_values_list.back().package_use_force);
packages_file.add_file(dir / "packages");
if ((*DistributionData::get_instance()->distribution_from_string(env->distribution())).support_old_style_virtuals())
virtuals_file.add_file(dir / "virtuals");
package_mask_file.add_file(dir / "package.mask");
profiles_with_parents->push_back(dir);
}
void
Implementation<TraditionalProfile>::load_profile_parent(const FSEntry & dir)
{
Context context("When handling parent file for profile directory '" + stringify(dir) + ":");
if (! (dir / "parent").exists())
return;
LineConfigFile file(dir / "parent", LineConfigFileOptions() + lcfo_disallow_continuations);
LineConfigFile::ConstIterator i(file.begin()), i_end(file.end());
bool once(false);
if (i == i_end)
Log::get_instance()->message("e.profile.parent.empty", ll_warning, lc_context) << "parent file is empty";
else
for ( ; i != i_end ; ++i)
{
if ('#' == i->at(0))
{
if (! once)
Log::get_instance()->message("e.profile.parent.no_comments", ll_qa, lc_context)
<< "Comments not allowed in '" << (dir / "parent") << "'";
once = true;
continue;
}
FSEntry parent_dir(dir);
do
{
try
{
parent_dir = (parent_dir / *i).realpath();
}
catch (const FSError & e)
{
Log::get_instance()->message("e.profile.parent.skipping", ll_warning, lc_context)
<< "Skipping parent '" << *i << "' due to exception: " << e.message() << " (" << e.what() << ")";
continue;
}
load_profile_directory_recursively(parent_dir);
} while (false);
}
}
void
Implementation<TraditionalProfile>::load_profile_make_defaults(const FSEntry & dir)
{
Context context("When handling make.defaults file for profile directory '" + stringify(dir) + ":");
if (! (dir / "make.defaults").exists())
return;
const std::tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(
repository->eapi_for_file(dir / "make.defaults")));
if (! eapi->supported())
throw ERepositoryConfigurationError("Can't use profile directory '" + stringify(dir) +
"' because it uses an unsupported EAPI");
KeyValueConfigFile file(dir / "make.defaults", KeyValueConfigFileOptions() +
kvcfo_disallow_source + kvcfo_disallow_space_inside_unquoted_values + kvcfo_allow_inline_comments + kvcfo_allow_multiple_assigns_per_line,
&KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation);
for (KeyValueConfigFile::ConstIterator k(file.begin()), k_end(file.end()) ;
k != k_end ; ++k)
{
if (is_incremental(*eapi, k->first))
{
std::list<std::string> val, val_add;
tokenise_whitespace(environment_variables[k->first], std::back_inserter(val));
tokenise_whitespace(k->second, std::back_inserter(val_add));
for (std::list<std::string>::const_iterator v(val_add.begin()), v_end(val_add.end()) ;
v != v_end ; ++v)
{
if (v->empty())
continue;
if (*v == "-*")
val.clear();
else if ('-' == v->at(0))
val.remove(v->substr(1));
else
val.push_back(*v);
}
environment_variables[k->first] = join(val.begin(), val.end(), " ");
}
else
environment_variables[k->first] = k->second;
}
std::string use_expand_var(eapi->supported()->ebuild_environment_variables()->env_use_expand());
try
{
use_expand->clear();
if (! use_expand_var.empty())
tokenise_whitespace(environment_variables[use_expand_var], use_expand->inserter());
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.use_expand_failure", ll_warning, lc_context)
<< "Loading '" << use_expand_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
std::string use_expand_unprefixed_var(eapi->supported()->ebuild_environment_variables()->env_use_expand_unprefixed());
try
{
use_expand_unprefixed->clear();
if (! use_expand_unprefixed_var.empty())
tokenise_whitespace(environment_variables[use_expand_unprefixed_var], use_expand_unprefixed->inserter());
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.use_expand_unprefixed_failure", ll_warning, lc_context)
<< "Loading '" << use_expand_unprefixed_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
std::string use_expand_implicit_var(eapi->supported()->ebuild_environment_variables()->env_use_expand_implicit());
try
{
use_expand_implicit->clear();
if (! use_expand_implicit_var.empty())
tokenise_whitespace(environment_variables[use_expand_implicit_var], use_expand_implicit->inserter());
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.use_expand_implicit_failure", ll_warning, lc_context)
<< "Loading '" << use_expand_implicit_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
std::string iuse_implicit_var(eapi->supported()->ebuild_environment_variables()->env_iuse_implicit());
try
{
iuse_implicit->clear();
if (! iuse_implicit_var.empty())
tokenise_whitespace(environment_variables[iuse_implicit_var], iuse_implicit->inserter());
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.iuse_implicit_failure", ll_warning, lc_context)
<< "Loading '" << iuse_implicit_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
std::string use_expand_values_part_var(eapi->supported()->ebuild_environment_variables()->env_use_expand_values_part());
try
{
use_expand_values.clear();
if (! use_expand_values_part_var.empty())
{
for (Set<std::string>::ConstIterator x(use_expand->begin()), x_end(use_expand->end()) ;
x != x_end ; ++x)
{
std::tr1::shared_ptr<Set<std::string> > v(new Set<std::string>);
tokenise_whitespace(environment_variables[use_expand_values_part_var + *x], v->inserter());
use_expand_values.insert(std::make_pair(*x, v));
}
for (Set<std::string>::ConstIterator x(use_expand_unprefixed->begin()), x_end(use_expand_unprefixed->end()) ;
x != x_end ; ++x)
{
std::tr1::shared_ptr<Set<std::string> > v(new Set<std::string>);
tokenise_whitespace(environment_variables[use_expand_values_part_var + *x], v->inserter());
use_expand_values.insert(std::make_pair(*x, v));
}
}
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.iuse_implicit_failure", ll_warning, lc_context)
<< "Loading '" << iuse_implicit_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
}
void
Implementation<TraditionalProfile>::load_special_make_defaults_vars(const FSEntry & dir)
{
const std::tr1::shared_ptr<const EAPI> eapi(EAPIData::get_instance()->eapi_from_string(
repository->eapi_for_file(dir / "make.defaults")));
if (! eapi->supported())
throw ERepositoryConfigurationError("Can't use profile directory '" + stringify(dir) +
"' because it uses an unsupported EAPI");
std::string use_var(eapi->supported()->ebuild_environment_variables()->env_use());
try
{
use.clear();
if (! use_var.empty())
{
std::list<std::string> tokens;
tokenise_whitespace(environment_variables[use_var], std::back_inserter(tokens));
for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
t != t_end ; ++t)
use.insert(std::make_pair("", *t));
}
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.use_failure", ll_warning, lc_context)
<< "Loading '" << use_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
std::string use_expand_var(eapi->supported()->ebuild_environment_variables()->env_use_expand());
try
{
use_expand->clear();
if (! use_expand_var.empty())
tokenise_whitespace(environment_variables[use_expand_var], use_expand->inserter());
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.use_expand_failure", ll_warning, lc_context)
<< "Loading '" << use_expand_var << "' failed due to exception: " << e.message() << " (" << e.what() << ")";
}
std::string use_expand_hidden_var(eapi->supported()->ebuild_environment_variables()->env_use_expand_hidden());
try
{
use_expand_hidden->clear();
if (! use_expand_hidden_var.empty())
tokenise_whitespace(environment_variables[use_expand_hidden_var], use_expand_hidden->inserter());
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.make_defaults.use_expand_hidden_failure", ll_warning, lc_context)
<< "Loading '" << use_expand_hidden_var << "' failed due to exception: "
<< e.message() << " (" << e.what() << ")";
}
}
bool
Implementation<TraditionalProfile>::is_incremental(const EAPI & e, const std::string & s) const
{
Context c("When checking whether '" + s + "' is incremental:");
return (! s.empty()) && (
(s == e.supported()->ebuild_environment_variables()->env_use())
|| (s == e.supported()->ebuild_environment_variables()->env_use_expand())
|| (s == e.supported()->ebuild_environment_variables()->env_use_expand_hidden())
|| (s == e.supported()->ebuild_environment_variables()->env_use_expand_unprefixed())
|| (s == e.supported()->ebuild_environment_variables()->env_use_expand_implicit())
|| (s == e.supported()->ebuild_environment_variables()->env_iuse_implicit())
|| s == "CONFIG_PROTECT"
|| s == "CONFIG_PROTECT_MASK");
}
void
Implementation<TraditionalProfile>::make_vars_from_file_vars()
{
try
{
if (! repository->params().master_repositories())
for (ProfileFile<LineConfigFile>::ConstIterator i(packages_file.begin()),
i_end(packages_file.end()) ; i != i_end ; ++i)
{
if (0 != i->second.compare(0, 1, "*", 0, 1))
continue;
Context context_spec("When parsing '" + i->second + "':");
std::tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(
parse_elike_package_dep_spec(i->second.substr(1),
i->first->supported()->package_dep_spec_parse_options(),
i->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
spec->set_tag(system_tag);
system_packages->root()->append(spec);
}
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.packages.failure", ll_warning, lc_context) << "Loading packages "
" failed due to exception: " << e.message() << " (" << e.what() << ")";
}
if ((*DistributionData::get_instance()->distribution_from_string(
env->distribution())).support_old_style_virtuals())
try
{
for (ProfileFile<LineConfigFile>::ConstIterator line(virtuals_file.begin()), line_end(virtuals_file.end()) ;
line != line_end ; ++line)
{
std::vector<std::string> tokens;
tokenise_whitespace(line->second, std::back_inserter(tokens));
if (tokens.size() < 2)
continue;
QualifiedPackageName v(tokens[0]);
virtuals->erase(v);
virtuals->insert(v, parse_elike_package_dep_spec(tokens[1],
line->first->supported()->package_dep_spec_parse_options(),
line->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>()));
}
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.virtuals.failure", ll_warning, lc_context)
<< "Loading virtuals failed due to exception: " << e.message() << " (" << e.what() << ")";
}
for (ProfileFile<MaskFile>::ConstIterator line(package_mask_file.begin()), line_end(package_mask_file.end()) ;
line != line_end ; ++line)
{
if (line->second.first.empty())
continue;
try
{
std::tr1::shared_ptr<const PackageDepSpec> a(new PackageDepSpec(
parse_elike_package_dep_spec(line->second.first,
line->first->supported()->package_dep_spec_parse_options(),
line->first->supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
if (a->package_ptr())
package_mask[*a->package_ptr()].push_back(std::make_pair(a, line->second.second));
else
Log::get_instance()->message("e.profile.package_mask.bad_spec", ll_warning, lc_context)
<< "Loading package.mask spec '" << line->second.first << "' failed because specification does not restrict to a "
"unique package";
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.package_mask.bad_spec", ll_warning, lc_context)
<< "Loading package.mask spec '" << line->second.first << "' failed due to exception '" << e.message() << "' ("
<< e.what() << ")";
}
}
}
void
Implementation<TraditionalProfile>::load_basic_use_file(const FSEntry & file, FlagStatusMap & m)
{
if (! file.exists())
return;
Context context("When loading basic use file '" + stringify(file) + ":");
LineConfigFile f(file, LineConfigFileOptions() + lcfo_disallow_continuations);
for (LineConfigFile::ConstIterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
{
std::list<std::string> tokens;
tokenise_whitespace(*line, std::back_inserter(tokens));
for (std::list<std::string>::const_iterator t(tokens.begin()), t_end(tokens.end()) ;
t != t_end ; ++t)
{
try
{
if (t->empty())
continue;
if ('-' == t->at(0))
m[ChoiceNameWithPrefix(t->substr(1))] = false;
else
m[ChoiceNameWithPrefix(*t)] = true;
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.failure", ll_warning, lc_context) << "Ignoring token '"
<< *t << "' due to exception '" << e.message() << "' (" << e.what() << ")";
}
}
}
}
void
Implementation<TraditionalProfile>::load_spec_use_file(const EAPI & eapi, const FSEntry & file, PackageFlagStatusMapList & m)
{
if (! file.exists())
return;
Context context("When loading specised use file '" + stringify(file) + ":");
LineConfigFile f(file, LineConfigFileOptions() + lcfo_disallow_continuations);
for (LineConfigFile::ConstIterator line(f.begin()), line_end(f.end()) ;
line != line_end ; ++line)
{
std::list<std::string> tokens;
tokenise_whitespace(*line, std::back_inserter(tokens));
if (tokens.empty())
continue;
try
{
std::tr1::shared_ptr<const PackageDepSpec> spec(new PackageDepSpec(
parse_elike_package_dep_spec(*tokens.begin(), eapi.supported()->package_dep_spec_parse_options(),
eapi.supported()->version_spec_options(),
std::tr1::shared_ptr<const PackageID>())));
PackageFlagStatusMapList::iterator n(m.insert(m.end(), std::make_pair(spec, FlagStatusMap())));
for (std::list<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
t != t_end ; ++t)
{
try
{
if (t->empty())
continue;
if ('-' == t->at(0))
n->second[ChoiceNameWithPrefix(t->substr(1))] = false;
else
n->second[ChoiceNameWithPrefix(*t)] = true;
}
catch (const InternalError &)
{
throw;
}
catch (const Exception & e)
{
Log::get_instance()->message("e.profile.failure", ll_warning, lc_context) << "Ignoring token '"
<< *t << "' due to exception '" << e.message() << "' (" << e.what() << ")";
}
}
}
catch (const PackageDepSpecError & e)
{
Log::get_instance()->message("e.profile.failure", ll_warning, lc_context) << "Ignoring line '"
<< *line << "' due to exception '" << e.message() << "' (" << e.what() << ")";
}
}
}
void
Implementation<TraditionalProfile>::add_use_expand_to_use()
{
Context context("When adding USE_EXPAND to USE:");
stacked_values_list.push_back(StackedValues("use_expand special values"));
for (Set<std::string>::ConstIterator x(use_expand->begin()), x_end(use_expand->end()) ;
x != x_end ; ++x)
{
std::string lower_x;
std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
std::list<std::string> uses;
tokenise_whitespace(environment_variables[stringify(*x)], std::back_inserter(uses));
for (std::list<std::string>::const_iterator u(uses.begin()), u_end(uses.end()) ;
u != u_end ; ++u)
use.insert(std::make_pair(lower_x, *u));
}
}
void
Implementation<TraditionalProfile>::fish_out_use_expand_names()
{
Context context("When finding all known USE_EXPAND names:");
for (Set<std::string>::ConstIterator x(use_expand->begin()), x_end(use_expand->end()) ;
x != x_end ; ++x)
{
std::string lower_x;
std::transform(x->begin(), x->end(), std::back_inserter(lower_x), &::tolower);
known_choice_value_names.insert(std::make_pair(lower_x, make_shared_ptr(new Set<UnprefixedChoiceName>)));
}
for (std::set<std::pair<ChoicePrefixName, UnprefixedChoiceName> >::const_iterator u(use.begin()), u_end(use.end()) ;
u != u_end ; ++u)
{
if (! stringify(u->first).empty())
{
KnownMap::iterator i(known_choice_value_names.find(stringify(u->first)));
if (i == known_choice_value_names.end())
throw InternalError(PALUDIS_HERE, stringify(u->first));
i->second->insert(u->second);
}
}
}
void
Implementation<TraditionalProfile>::handle_profile_arch_var(const std::string & s)
{
Context context("When handling profile " + s + " variable:");
std::string arch_s(environment_variables[s]);
if (arch_s.empty())
throw ERepositoryConfigurationError("Variable '" + s + "' is unset or empty");
stacked_values_list.push_back(StackedValues("arch special values"));
try
{
std::string arch(arch_s);
use.insert(std::make_pair(ChoicePrefixName(""), arch));
stacked_values_list.back().use_force[ChoiceNameWithPrefix(arch)] = true;
}
catch (const InternalError &)
{
throw;
}
catch (const Exception &)
{
throw ERepositoryConfigurationError("Variable '" + s + "' has invalid value '" + arch_s + "'");
}
}
TraditionalProfile::TraditionalProfile(
const Environment * const env, const ERepository * const p, const RepositoryName & name,
const FSEntrySequence & location,
const std::string & arch_var_if_special, const bool x) :
PrivateImplementationPattern<TraditionalProfile>(
new Implementation<TraditionalProfile>(env, p, name, location, arch_var_if_special, x))
{
}
TraditionalProfile::~TraditionalProfile()
{
}
std::tr1::shared_ptr<const FSEntrySequence>
TraditionalProfile::profiles_with_parents() const
{
return _imp->profiles_with_parents;
}
bool
TraditionalProfile::use_masked(
const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const Choice> & choice,
const UnprefixedChoiceName & value_unprefixed,
const ChoiceNameWithPrefix & value_prefixed
) const
{
if (stringify(choice->prefix()).empty() &&
_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(value_unprefixed) &&
(! use_state_ignoring_masks(id, choice, value_unprefixed, value_prefixed).is_true()))
return true;
bool result(false);
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
{
FlagStatusMap::const_iterator f(i->use_mask.find(value_prefixed));
if (i->use_mask.end() != f)
result = f->second;
for (PackageFlagStatusMapList::const_iterator g(i->package_use_mask.begin()),
g_end(i->package_use_mask.end()) ; g != g_end ; ++g)
{
if (! match_package(*_imp->env, *g->first, *id, MatchPackageOptions()))
continue;
FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
if (g->second.end() != h)
result = h->second;
}
}
return result;
}
bool
TraditionalProfile::use_forced(
const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const Choice> & choice,
const UnprefixedChoiceName & value_unprefixed,
const ChoiceNameWithPrefix & value_prefixed
) const
{
if (use_masked(id, choice, value_unprefixed, value_prefixed))
return false;
if (stringify(choice->prefix()).empty() && (_imp->repository->arch_flags()->end() != _imp->repository->arch_flags()->find(value_unprefixed)))
return true;
bool result(false);
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
{
FlagStatusMap::const_iterator f(i->use_force.find(value_prefixed));
if (i->use_force.end() != f)
result = f->second;
for (PackageFlagStatusMapList::const_iterator g(i->package_use_force.begin()),
g_end(i->package_use_force.end()) ; g != g_end ; ++g)
{
if (! match_package(*_imp->env, *g->first, *id, MatchPackageOptions()))
continue;
FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
if (g->second.end() != h)
result = h->second;
}
}
return result;
}
Tribool
TraditionalProfile::use_state_ignoring_masks(
const std::tr1::shared_ptr<const PackageID> & id,
const std::tr1::shared_ptr<const Choice> & choice,
const UnprefixedChoiceName & value_unprefixed,
const ChoiceNameWithPrefix & value_prefixed
) const
{
std::pair<ChoicePrefixName, UnprefixedChoiceName> prefix_value(choice->prefix(), value_unprefixed);
Tribool result(_imp->use.end() != _imp->use.find(prefix_value) ? Tribool(true) : Tribool(indeterminate));
for (StackedValuesList::const_iterator i(_imp->stacked_values_list.begin()),
i_end(_imp->stacked_values_list.end()) ; i != i_end ; ++i)
{
for (PackageFlagStatusMapList::const_iterator g(i->package_use.begin()),
g_end(i->package_use.end()) ; g != g_end ; ++g)
{
if (! match_package(*_imp->env, *g->first, *id, MatchPackageOptions()))
continue;
FlagStatusMap::const_iterator h(g->second.find(value_prefixed));
if (g->second.end() != h)
result = h->second ? true : false;
}
}
return result;
}
namespace
{
void
add_flag_status_map(const std::tr1::shared_ptr<Set<UnprefixedChoiceName> > result,
const FlagStatusMap & m, const std::string & prefix)
{
for (FlagStatusMap::const_iterator it(m.begin()),
it_end(m.end()); it_end != it; ++it)
if (0 == stringify(it->first).compare(0, prefix.length(), prefix))
result->insert(UnprefixedChoiceName(stringify(it->first).substr(prefix.length())));
}
void
add_package_flag_status_map_list(const std::tr1::shared_ptr<Set<UnprefixedChoiceName> > result,
const PackageFlagStatusMapList & m, const std::string & prefix)
{
for (PackageFlagStatusMapList::const_iterator it(m.begin()),
it_end(m.end()); it_end != it; ++it)
add_flag_status_map(result, it->second, prefix);
}
}
const std::tr1::shared_ptr<const Set<UnprefixedChoiceName> >
TraditionalProfile::known_choice_value_names(
const std::tr1::shared_ptr<const ERepositoryID> & id,
const std::tr1::shared_ptr<const Choice> & choice
) const
{
Lock l(_imp->known_choice_value_names_for_separator_mutex);
char separator(id->eapi()->supported()->choices_options()->use_expand_separator());
std::tr1::unordered_map<char, KnownMap>::iterator it(_imp->known_choice_value_names_for_separator.find(separator));
if (_imp->known_choice_value_names_for_separator.end() == it)
it = _imp->known_choice_value_names_for_separator.insert(std::make_pair(separator, KnownMap())).first;
std::string lower_x;
std::transform(choice->raw_name().begin(), choice->raw_name().end(), std::back_inserter(lower_x), &::tolower);
KnownMap::const_iterator it2(it->second.find(lower_x));
if (it->second.end() == it2)
{
std::tr1::shared_ptr<Set<UnprefixedChoiceName> > result(new Set<UnprefixedChoiceName>);
it2 = it->second.insert(std::make_pair(lower_x, result)).first;
KnownMap::const_iterator i(_imp->known_choice_value_names.find(lower_x));
if (_imp->known_choice_value_names.end() == i)
throw InternalError(PALUDIS_HERE, lower_x);
std::copy(i->second->begin(), i->second->end(), result->inserter());
std::string prefix(lower_x);
prefix += separator;
for (StackedValuesList::const_iterator sit(_imp->stacked_values_list.begin()),
sit_end(_imp->stacked_values_list.end()); sit_end != sit; ++sit)
{
add_flag_status_map(result, sit->use_mask, prefix);
add_flag_status_map(result, sit->use_force, prefix);
add_package_flag_status_map_list(result, sit->package_use, prefix);
add_package_flag_status_map_list(result, sit->package_use_mask, prefix);
add_package_flag_status_map_list(result, sit->package_use_force, prefix);
}
}
return it2->second;
}
const std::string
TraditionalProfile::environment_variable(const std::string & s) const
{
EnvironmentVariablesMap::const_iterator i(_imp->environment_variables.find(s));
if (_imp->environment_variables.end() == i)
return "";
else
return i->second;
}
const std::tr1::shared_ptr<const SetSpecTree>
TraditionalProfile::system_packages() const
{
return _imp->system_packages;
}
const std::tr1::shared_ptr<const Map<QualifiedPackageName, PackageDepSpec> >
TraditionalProfile::virtuals() const
{
return _imp->virtuals;
}
const std::tr1::shared_ptr<const RepositoryMaskInfo>
TraditionalProfile::profile_masked(const PackageID & id) const
{
PackageMaskMap::const_iterator rr(_imp->package_mask.find(id.name()));
if (_imp->package_mask.end() == rr)
return std::tr1::shared_ptr<const RepositoryMaskInfo>();
else
{
for (std::list<std::pair<std::tr1::shared_ptr<const PackageDepSpec>, std::tr1::shared_ptr<const RepositoryMaskInfo> > >::const_iterator k(rr->second.begin()),
k_end(rr->second.end()) ; k != k_end ; ++k)
if (match_package(*_imp->env, *k->first, id, MatchPackageOptions()))
return k->second;
}
return std::tr1::shared_ptr<const RepositoryMaskInfo>();
}
const std::tr1::shared_ptr<const Set<std::string> >
TraditionalProfile::use_expand() const
{
return _imp->use_expand;
}
const std::tr1::shared_ptr<const Set<std::string> >
TraditionalProfile::use_expand_hidden() const
{
return _imp->use_expand_hidden;
}
const std::tr1::shared_ptr<const Set<std::string> >
TraditionalProfile::use_expand_unprefixed() const
{
return _imp->use_expand_unprefixed;
}
const std::tr1::shared_ptr<const Set<std::string> >
TraditionalProfile::use_expand_implicit() const
{
return _imp->use_expand_implicit;
}
const std::tr1::shared_ptr<const Set<std::string> >
TraditionalProfile::use_expand_values(const std::string & x) const
{
Context context("When finding USE_EXPAND_VALUES_" + x + ":");
std::tr1::unordered_map<std::string, std::tr1::shared_ptr<Set<std::string> > >::const_iterator i(_imp->use_expand_values.find(x));
if (i == _imp->use_expand_values.end())
throw InternalError(PALUDIS_HERE, "Oops. We need USE_EXPAND_VALUES_" + x + ", but it's not in the map");
return i->second;
}
const std::tr1::shared_ptr<const Set<std::string> >
TraditionalProfile::iuse_implicit() const
{
return _imp->iuse_implicit;
}
| pioto/paludis-pioto | paludis/repositories/e/traditional_profile.cc | C++ | gpl-2.0 | 41,906 |
# -*- coding: utf-8 -*-
# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: http://doc.scrapy.org/en/latest/topics/item-pipeline.html
class WebofknowledgePipeline(object):
def process_item(self, item, spider):
return item
| alabarga/wos-scrapy | webofknowledge/pipelines.py | Python | gpl-2.0 | 294 |
<?php
global $mymail_autoresponder;
$mymail_autoresponder_info = array(
'units' => apply_filters('mymail_autoresponder_units', array(
'minute' => __('minute(s)', 'mymail'),
'hour' => __('hour(s)', 'mymail'),
'day' => __('day(s)', 'mymail'),
'week' => __('week(s)', 'mymail'),
'year' => __('year(s)', 'mymail'),
)),
'actions' => apply_filters('mymail_autoresponder_actions', array(
'mymail_subscriber_insert' => array(
'label' => __('user signed up', 'mymail'),
'hook' => 'mymail_subscriber_insert'
),
'mymail_subscriber_unsubscribed' => array(
'label' => __('user unsubscribed', 'mymail'),
'hook' => 'mymail_subscriber_unsubscribed'
),
'mymail_post_published' => array(
'label' => __('something has been published', 'mymail'),
'hook' => 'transition_post_status'
),
'mymail_autoresponder_timebased' => array(
'label' => __('at a specific time', 'mymail'),
'hook' => 'mymail_autoresponder_timebased'
),
'mymail_autoresponder_usertime' => array(
'label' => __('a specific user time', 'mymail'),
'hook' => 'mymail_autoresponder_usertime'
),
'mymail_autoresponder_followup' => array(
'label' => __('a specific campaign', 'mymail'),
'hook' => 'mymail_autoresponder_followup'
),
'mymail_autoresponder_hook' => array(
'label' => __('a specific action hook', 'mymail'),
'hook' => 'mymail_autoresponder_hook'
),
)),
);
?> | MagicMediaInc/ironmanrecovery | wp-content/plugins/mymail2018/includes/autoresponder.php | PHP | gpl-2.0 | 1,401 |
<?php
/**
* Milestone Countdown Widget
*
* @package automattic/jetpack
*/
use Automattic\Jetpack\Assets;
/**
* Class Milestone_Widget
*/
class Milestone_Widget extends WP_Widget {
/**
* Holding array for widget configuration and localization.
*
* @var array
*/
private static $config_js = array();
/**
* Available time units sorted in descending order.
*
* @var Array
*/
protected $available_units = array(
'years',
'months',
'days',
'hours',
'minutes',
'seconds',
);
/**
* Milestone_Widget constructor.
*/
public function __construct() {
$widget = array(
'classname' => 'milestone-widget',
'description' => __( 'Display a countdown to a certain date.', 'jetpack' ),
);
parent::__construct(
'Milestone_Widget',
/** This filter is documented in modules/widgets/facebook-likebox.php */
apply_filters( 'jetpack_widget_name', __( 'Milestone', 'jetpack' ) ),
$widget
);
add_action( 'wp_enqueue_scripts', array( __class__, 'enqueue_template' ) );
add_action( 'admin_enqueue_scripts', array( __class__, 'enqueue_admin' ) );
add_action( 'wp_footer', array( $this, 'localize_script' ) );
if ( is_active_widget( false, false, $this->id_base, true ) || is_active_widget( false, false, 'monster', true ) || is_customize_preview() ) {
add_action( 'wp_head', array( __class__, 'styles_template' ) );
}
}
/**
* Enqueue admin assets.
*
* @param string $hook_suffix Hook suffix provided by WordPress.
*/
public static function enqueue_admin( $hook_suffix ) {
if ( 'widgets.php' === $hook_suffix ) {
wp_enqueue_style( 'milestone-admin', plugin_dir_url( __FILE__ ) . 'style-admin.css', array(), '20201113' );
wp_enqueue_script(
'milestone-admin-js',
Assets::get_file_url_for_environment(
'_inc/build/widgets/milestone/admin.min.js',
'modules/widgets/milestone/admin.js'
),
array( 'jquery' ),
'20201113',
true
);
}
}
/**
* Enqueue the frontend JS.
*/
public static function enqueue_template() {
if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
return;
}
wp_enqueue_script(
'milestone',
Assets::get_file_url_for_environment(
'_inc/build/widgets/milestone/milestone.min.js',
'modules/widgets/milestone/milestone.js'
),
array(),
'20201113',
true
);
}
/**
* Output the frontend styling.
*/
public static function styles_template() {
global $themecolors;
$colors = wp_parse_args(
$themecolors,
array(
'bg' => 'ffffff',
'border' => 'cccccc',
'text' => '333333',
)
);
?>
<style>
.milestone-widget {
margin-bottom: 1em;
}
.milestone-content {
line-height: 2;
margin-top: 5px;
max-width: 100%;
padding: 0;
text-align: center;
}
.milestone-header {
background-color: <?php echo self::sanitize_color_hex( $colors['text'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>;
color: <?php echo self::sanitize_color_hex( $colors['bg'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>;
line-height: 1.3;
margin: 0;
padding: .8em;
}
.milestone-header .event,
.milestone-header .date {
display: block;
}
.milestone-header .event {
font-size: 120%;
}
.milestone-countdown .difference {
display: block;
font-size: 500%;
font-weight: bold;
line-height: 1.2;
}
.milestone-countdown,
.milestone-message {
background-color: <?php echo self::sanitize_color_hex( $colors['bg'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>;
border: 1px solid <?php echo self::sanitize_color_hex( $colors['border'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>;
border-top: 0;
color: <?php echo self::sanitize_color_hex( $colors['text'] ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>;
padding-bottom: 1em;
}
.milestone-message {
padding-top: 1em
}
</style>
<?php
}
/**
* Ensure that a string representing a color in hexadecimal
* notation is safe for use in css and database saves.
*
* @param string $hex Hexademical code to sanitize.
* @param string $prefix Prefix for the hex code.
*
* @return string Color in hexadecimal notation on success - the string "transparent" otherwise.
*/
public static function sanitize_color_hex( $hex, $prefix = '#' ) {
$hex = trim( $hex );
/* Strip recognized prefixes. */
if ( 0 === strpos( $hex, '#' ) ) {
$hex = substr( $hex, 1 );
} elseif ( 0 === strpos( $hex, '%23' ) ) {
$hex = substr( $hex, 3 );
}
if ( 0 !== preg_match( '/^[0-9a-fA-F]{6}$/', $hex ) ) {
return $prefix . $hex;
}
return 'transparent';
}
/**
* Localize Front-end Script.
*
* Print the javascript configuration array only if the
* current template has an instance of the widget that
* is still counting down. In all other cases, this
* function will dequeue milestone.js.
*
* Hooks into the "wp_footer" action.
*/
public function localize_script() {
if ( class_exists( 'Jetpack_AMP_Support' ) && Jetpack_AMP_Support::is_amp_request() ) {
return;
}
if ( empty( self::$config_js['instances'] ) ) {
wp_dequeue_script( 'milestone' );
return;
}
self::$config_js['api_root'] = esc_url_raw( rest_url() );
wp_localize_script( 'milestone', 'MilestoneConfig', self::$config_js );
}
/**
* Widget
*
* @param array $args Widget args.
* @param array $instance Widget instance.
*/
public function widget( $args, $instance ) {
echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
/** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */
$title = apply_filters( 'widget_title', $instance['title'] );
if ( ! empty( $title ) ) {
echo $args['before_title'] . esc_html( $title ) . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
$data = $this->get_widget_data( $instance );
$config = array(
'id' => $args['widget_id'],
'message' => $data['message'],
'refresh' => $data['refresh'],
);
/*
* Sidebars may be configured to not expose the `widget_id`. Example: `twentytwenty` footer areas.
*
* We need our own unique identifier.
*/
$config['content_id'] = $args['widget_id'] . '-content';
self::$config_js['instances'][] = $config;
echo sprintf( '<div id="%s" class="milestone-content">', esc_html( $config['content_id'] ) );
echo '<div class="milestone-header">';
echo '<strong class="event">' . esc_html( $instance['event'] ) . '</strong>';
echo '<span class="date">' . esc_html( date_i18n( get_option( 'date_format' ), $data['milestone'] ) ) . '</span>';
echo '</div>';
echo wp_kses_post( $data['message'] );
echo '</div><!--milestone-content-->';
echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
/** This action is documented in modules/widgets/gravatar-profile.php */
do_action( 'jetpack_stats_extra', 'widget_view', 'milestone' );
}
/**
* Getter for the widget data.
*
* @param array $instance Widget instance.
*
* @return array
*/
public function get_widget_data( $instance ) {
$data = array();
$instance = $this->sanitize_instance( $instance );
$milestone = mktime( $instance['hour'], $instance['min'], 0, $instance['month'], $instance['day'], $instance['year'] );
$now = (int) current_time( 'timestamp' ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested
$type = $instance['type'];
if ( 'since' === $type ) {
$diff = (int) floor( $now - $milestone );
} else {
$diff = (int) floor( $milestone - $now );
}
$data['diff'] = $diff;
$data['unit'] = $this->get_unit( $diff, $instance['unit'] );
// Setting the refresh counter to equal the number of seconds it takes to flip a unit.
$refresh_intervals = array(
0, // should be YEAR_IN_SECONDS, but doing setTimeout for a year doesn't seem to be logical.
0, // same goes for MONTH_IN_SECONDS.
DAY_IN_SECONDS,
HOUR_IN_SECONDS,
MINUTE_IN_SECONDS,
1,
);
$data['refresh'] = $refresh_intervals[ array_search( $data['unit'], $this->available_units, true ) ];
$data['milestone'] = $milestone;
if ( ( 1 > $diff ) && ( 'until' === $type ) ) {
$data['message'] = '<div class="milestone-message">' . $instance['message'] . '</div>';
$data['refresh'] = 0; // No need to refresh, the milestone has been reached.
} else {
$interval_text = $this->get_interval_in_units( $diff, $data['unit'] );
$interval = (int) $interval_text;
if ( 'since' === $type ) {
switch ( $data['unit'] ) {
case 'years':
$data['message'] = sprintf(
/* translators: %s is the number of year(s). */
_n(
'<span class="difference">%s</span> <span class="label">year ago.</span>',
'<span class="difference">%s</span> <span class="label">years ago.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'months':
$data['message'] = sprintf(
/* translators: %s is the number of month(s). */
_n(
'<span class="difference">%s</span> <span class="label">month ago.</span>',
'<span class="difference">%s</span> <span class="label">months ago.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'days':
$data['message'] = sprintf(
/* translators: %s is the number of days(s). */
_n(
'<span class="difference">%s</span> <span class="label">day ago.</span>',
'<span class="difference">%s</span> <span class="label">days ago.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'hours':
$data['message'] = sprintf(
/* translators: %s is the number of hours(s). */
_n(
'<span class="difference">%s</span> <span class="label">hour ago.</span>',
'<span class="difference">%s</span> <span class="label">hours ago.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'minutes':
$data['message'] = sprintf(
/* translators: %s is the number of minutes(s). */
_n(
'<span class="difference">%s</span> <span class="label">minute ago.</span>',
'<span class="difference">%s</span> <span class="label">minutes ago.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'seconds':
$data['message'] = sprintf(
/* translators: %s is the number of second(s). */
_n(
'<span class="difference">%s</span> <span class="label">second ago.</span>',
'<span class="difference">%s</span> <span class="label">seconds ago.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
}
} else {
switch ( $this->get_unit( $diff, $instance['unit'] ) ) {
case 'years':
$data['message'] = sprintf(
/* translators: %s is the number of year(s). */
_n(
'<span class="difference">%s</span> <span class="label">year to go.</span>',
'<span class="difference">%s</span> <span class="label">years to go.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'months':
$data['message'] = sprintf(
/* translators: %s is the number of month(s). */
_n(
'<span class="difference">%s</span> <span class="label">month to go.</span>',
'<span class="difference">%s</span> <span class="label">months to go.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'days':
$data['message'] = sprintf(
/* translators: %s is the number of days(s). */
_n(
'<span class="difference">%s</span> <span class="label">day to go.</span>',
'<span class="difference">%s</span> <span class="label">days to go.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'hours':
$data['message'] = sprintf(
/* translators: %s is the number of hour(s). */
_n(
'<span class="difference">%s</span> <span class="label">hour to go.</span>',
'<span class="difference">%s</span> <span class="label">hours to go.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'minutes':
$data['message'] = sprintf(
/* translators: %s is the number of minute(s). */
_n(
'<span class="difference">%s</span> <span class="label">minute to go.</span>',
'<span class="difference">%s</span> <span class="label">minutes to go.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
case 'seconds':
$data['message'] = sprintf(
/* translators: %s is the number of second(s). */
_n(
'<span class="difference">%s</span> <span class="label">second to go.</span>',
'<span class="difference">%s</span> <span class="label">seconds to go.</span>',
$interval,
'jetpack'
),
$interval_text
);
break;
}
}
$data['message'] = '<div class="milestone-countdown">' . $data['message'] . '</div>';
}
return $data;
}
/**
* Return the largest possible time unit that the difference will be displayed in.
*
* @param Integer $seconds the interval in seconds.
* @param String $maximum_unit the maximum unit that will be used. Optional.
* @return String $calculated_unit
*/
protected function get_unit( $seconds, $maximum_unit = 'automatic' ) {
$unit = '';
if ( $seconds >= YEAR_IN_SECONDS * 2 ) {
// more than 2 years - show in years, one decimal point.
$unit = 'years';
} elseif ( $seconds >= YEAR_IN_SECONDS ) {
if ( 'years' === $maximum_unit ) {
$unit = 'years';
} else {
// automatic mode - showing months even if it's between one and two years.
$unit = 'months';
}
} elseif ( $seconds >= MONTH_IN_SECONDS * 3 ) {
// fewer than 2 years - show in months.
$unit = 'months';
} elseif ( $seconds >= MONTH_IN_SECONDS ) {
if ( 'months' === $maximum_unit ) {
$unit = 'months';
} else {
// automatic mode - showing days even if it's between one and three months.
$unit = 'days';
}
} elseif ( $seconds >= DAY_IN_SECONDS - 1 ) {
// fewer than a month - show in days.
$unit = 'days';
} elseif ( $seconds >= HOUR_IN_SECONDS - 1 ) {
// less than 1 day - show in hours.
$unit = 'hours';
} elseif ( $seconds >= MINUTE_IN_SECONDS - 1 ) {
// less than 1 hour - show in minutes.
$unit = 'minutes';
} else {
// less than 1 minute - show in seconds.
$unit = 'seconds';
}
$maximum_unit_index = array_search( $maximum_unit, $this->available_units, true );
$unit_index = array_search( $unit, $this->available_units, true );
if (
false === $maximum_unit_index // the maximum unit parameter is automatic.
|| $unit_index > $maximum_unit_index // there is not enough seconds for even one maximum time unit.
) {
return $unit;
}
return $maximum_unit;
}
/**
* Returns a time difference value in specified units.
*
* @param int $seconds Number of seconds.
* @param string $units Unit.
* @return int $time_in_units.
*/
protected function get_interval_in_units( $seconds, $units ) {
switch ( $units ) {
case 'years':
$years = $seconds / YEAR_IN_SECONDS;
$decimals = abs( round( $years, 1 ) - round( $years ) ) > 0 ? 1 : 0;
return number_format_i18n( $years, $decimals );
case 'months':
return (int) ( $seconds / 60 / 60 / 24 / 30 );
case 'days':
return (int) ( $seconds / 60 / 60 / 24 + 1 );
case 'hours':
return (int) ( $seconds / 60 / 60 );
case 'minutes':
return (int) ( $seconds / 60 + 1 );
default:
return $seconds;
}
}
/**
* Update widget.
*
* @param array $new_instance New instance of the widget being saved.
* @param array $old_instance Previous instance being saved over.
*
* @return array
*/
public function update( $new_instance, $old_instance ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
return $this->sanitize_instance( $new_instance );
}
/**
* Make sure that a number is within a certain range.
* If the number is too small it will become the possible lowest value.
* If the number is too large it will become the possible highest value.
*
* @param int $n The number to check.
* @param int $floor The lowest possible value.
* @param int $ceil The highest possible value.
*/
public function sanitize_range( $n, $floor, $ceil ) {
$n = (int) $n;
if ( $n < $floor ) {
$n = $floor;
} elseif ( $n > $ceil ) {
$n = $ceil;
}
return $n;
}
/**
* Sanitize an instance of this widget.
*
* Date ranges match the documentation for mktime in the php manual.
*
* @see https://php.net/manual/en/function.mktime.php#refsect1-function.mktime-parameters
*
* @uses Milestone_Widget::sanitize_range().
*
* @param array $dirty Unsantized data for the widget.
*
* @return array Santized data.
*/
public function sanitize_instance( $dirty ) {
$now = (int) current_time( 'timestamp' ); // phpcs:ignore WordPress.DateTime.CurrentTimeTimestamp.Requested
$dirty = wp_parse_args(
$dirty,
array(
'title' => '',
'event' => __( 'The Big Day', 'jetpack' ),
'unit' => 'automatic',
'type' => 'until',
'message' => __( 'The big day is here.', 'jetpack' ),
'day' => gmdate( 'd', $now ),
'month' => gmdate( 'm', $now ),
'year' => gmdate( 'Y', $now ),
'hour' => 0,
'min' => 0,
)
);
$allowed_tags = array(
'a' => array(
'title' => array(),
'href' => array(),
'target' => array(),
),
'em' => array( 'title' => array() ),
'strong' => array( 'title' => array() ),
);
$clean = array(
'title' => trim( wp_strip_all_tags( stripslashes( $dirty['title'] ) ) ),
'event' => trim( wp_strip_all_tags( stripslashes( $dirty['event'] ) ) ),
'unit' => $dirty['unit'],
'type' => $dirty['type'],
'message' => wp_kses( $dirty['message'], $allowed_tags ),
'year' => $this->sanitize_range( $dirty['year'], 1901, 2037 ),
'month' => $this->sanitize_range( $dirty['month'], 1, 12 ),
'hour' => $this->sanitize_range( $dirty['hour'], 0, 23 ),
'min' => zeroise( $this->sanitize_range( $dirty['min'], 0, 59 ), 2 ),
);
$clean['day'] = $this->sanitize_range( $dirty['day'], 1, gmdate( 't', mktime( 0, 0, 0, $clean['month'], 1, $clean['year'] ) ) );
return $clean;
}
/**
* Form
*
* @param array $instance Widget instance.
*/
public function form( $instance ) {
$instance = $this->sanitize_instance( $instance );
$units = array(
'automatic' => _x( 'Automatic', 'Milestone widget: mode in which the date unit is determined automatically', 'jetpack' ),
'years' => _x( 'Years', 'Milestone widget: mode in which the date unit is set to years', 'jetpack' ),
'months' => _x( 'Months', 'Milestone widget: mode in which the date unit is set to months', 'jetpack' ),
'days' => _x( 'Days', 'Milestone widget: mode in which the date unit is set to days', 'jetpack' ),
'hours' => _x( 'Hours', 'Milestone widget: mode in which the date unit is set to hours', 'jetpack' ),
);
?>
<div class="milestone-widget">
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title', 'jetpack' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr( $this->get_field_id( 'event' ) ); ?>"><?php esc_html_e( 'Description', 'jetpack' ); ?></label>
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'event' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'event' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['event'] ); ?>" />
</p>
<fieldset class="jp-ms-data-time">
<legend><?php esc_html_e( 'Date', 'jetpack' ); ?></legend>
<label for="<?php echo esc_attr( $this->get_field_id( 'month' ) ); ?>" class="assistive-text"><?php esc_html_e( 'Month', 'jetpack' ); ?></label>
<select id="<?php echo esc_attr( $this->get_field_id( 'month' ) ); ?>" class="month" name="<?php echo esc_attr( $this->get_field_name( 'month' ) ); ?>">
<?php
global $wp_locale;
for ( $i = 1; $i < 13; $i++ ) {
$monthnum = zeroise( $i, 2 );
printf(
'<option value="%s" %s>%s-%s</option>',
esc_attr( $monthnum ),
selected( $i, $instance['month'], false ),
esc_attr( $monthnum ),
esc_attr( $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) ) )
);
}
?>
</select>
<label for="<?php echo esc_attr( $this->get_field_id( 'day' ) ); ?>" class="assistive-text"><?php esc_html_e( 'Day', 'jetpack' ); ?></label>
<input id="<?php echo esc_attr( $this->get_field_id( 'day' ) ); ?>" class="day" name="<?php echo esc_attr( $this->get_field_name( 'day' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['day'] ); ?>">,
<label for="<?php echo esc_attr( $this->get_field_id( 'year' ) ); ?>" class="assistive-text"><?php esc_html_e( 'Year', 'jetpack' ); ?></label>
<input id="<?php echo esc_attr( $this->get_field_id( 'year' ) ); ?>" class="year" name="<?php echo esc_attr( $this->get_field_name( 'year' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['year'] ); ?>">
</fieldset>
<fieldset class="jp-ms-data-time">
<legend><?php esc_html_e( 'Time', 'jetpack' ); ?></legend>
<label for="<?php echo esc_attr( $this->get_field_id( 'hour' ) ); ?>" class="assistive-text"><?php esc_html_e( 'Hour', 'jetpack' ); ?></label>
<input id="<?php echo esc_attr( $this->get_field_id( 'hour' ) ); ?>" class="hour" name="<?php echo esc_attr( $this->get_field_name( 'hour' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['hour'] ); ?>">
<label for="<?php echo esc_attr( $this->get_field_id( 'min' ) ); ?>" class="assistive-text"><?php esc_html_e( 'Minutes', 'jetpack' ); ?></label>
<span class="time-separator">:</span>
<input id="<?php echo esc_attr( $this->get_field_id( 'min' ) ); ?>" class="minutes" name="<?php echo esc_attr( $this->get_field_name( 'min' ) ); ?>" type="text" value="<?php echo esc_attr( $instance['min'] ); ?>">
</fieldset>
<fieldset class="jp-ms-data-unit">
<legend><?php esc_html_e( 'Time Unit', 'jetpack' ); ?></legend>
<label for="<?php echo esc_attr( $this->get_field_id( 'unit' ) ); ?>" class="assistive-text">
<?php esc_html_e( 'Time Unit', 'jetpack' ); ?>
</label>
<select id="<?php echo esc_attr( $this->get_field_id( 'unit' ) ); ?>" class="unit" name="<?php echo esc_attr( $this->get_field_name( 'unit' ) ); ?>">
<?php
foreach ( $units as $key => $unit ) {
printf(
'<option value="%s" %s>%s</option>',
esc_attr( $key ),
selected( $key, $instance['unit'], false ),
esc_html( $unit )
);
}
?>
</select>
</fieldset>
<ul class="milestone-type">
<li>
<label>
<input
<?php checked( $instance['type'], 'until' ); ?>
name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>"
type="radio"
value="until"
/>
<?php esc_html_e( 'Until your milestone', 'jetpack' ); ?>
</label>
</li>
<li>
<label>
<input
<?php checked( $instance['type'], 'since' ); ?>
name="<?php echo esc_attr( $this->get_field_name( 'type' ) ); ?>"
type="radio"
value="since"
/>
<?php esc_html_e( 'Since your milestone', 'jetpack' ); ?>
</label>
</li>
</ul>
<p class="milestone-message-wrapper">
<label for="<?php echo esc_attr( $this->get_field_id( 'message' ) ); ?>"><?php esc_html_e( 'Milestone Reached Message', 'jetpack' ); ?></label>
<textarea id="<?php echo esc_attr( $this->get_field_id( 'message' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'message' ) ); ?>" class="widefat" rows="3"><?php echo esc_textarea( $instance['message'] ); ?></textarea>
</p>
</div>
<?php
}
}
| Automattic/vip-go-mu-plugins | jetpack-9.8/modules/widgets/milestone/class-milestone-widget.php | PHP | gpl-2.0 | 24,576 |
Copy patches that can be applied in the site.
Patches that must be applied should be specified in the Makefile.
| sfl-drupal/indus-profile | build/patches/README.md | Markdown | gpl-2.0 | 112 |
BindGlobal()
local CFG = TheMod:GetConfig()
local assets =
{
Asset("ANIM", "anim/gummybear_naughty.zip"),
Asset("ANIM", "anim/gummybear_nice.zip"),
Asset("ANIM", "anim/ds_pig_basic.zip"),
Asset("ANIM", "anim/ds_pig_actions.zip"),
Asset("ANIM", "anim/ds_pig_attacks.zip"),
Asset("ANIM", "anim/pig_build.zip"),
Asset("ANIM", "anim/pigspotted_build.zip"),
Asset("ANIM", "anim/pig_guard_build.zip"),
Asset("ANIM", "anim/werepig_build.zip"),
Asset("ANIM", "anim/werepig_basic.zip"),
Asset("ANIM", "anim/werepig_actions.zip"),
Asset("SOUND", "sound/pig.fsb"),
}
local prefabs = CFG.GUMMYBEAR.PREFABS
SetSharedLootTable( "gummybear", CFG.GUMMYBEAR.LOOT)
local function become_nice(inst)
if inst:HasTag("cuddly") then return end
inst.AnimState:SetBuild("gummybear_nice")
-- Tag added in the stategraph event handler.
inst:PushEvent("becomenice")
end
local function become_naughty(inst)
if not inst:HasTag("cuddly") then return end
inst.AnimState:SetBuild("gummybear_naughty")
-- Tag removed in the stategraph event handler.
inst:PushEvent("becomenaughty")
end
local function OnNewTarget(inst, data)
--print(inst, "OnNewTarget", data.target)
inst.components.combat:ShareTarget(inst.components.combat.target, 30, function(dude) return dude:HasTag("gumbear") and not dude.components.health:IsDead() end, 12)
become_naughty(inst)
end
local function retargetfn(inst)
local entity = FindEntity(inst, 10, function(guy)
return inst.components.combat:CanTarget(guy)
and not guy:HasTag("gumbear")
and not guy:HasTag("cloudneutral")
end)
return entity
end
local function CalcSanityAura(inst, observer)
if inst.components.combat.target then
return -TUNING.SANITYAURA_SMALL
end
return 0
end
local function OnAttacked(inst, data)
inst.components.combat:SetTarget(data.attacker)
inst.components.combat:ShareTarget(data.attacker, 30, function(dude) return dude:HasTag("gumbear") and not dude.components.health:IsDead() end, 6)
end
local function bear()
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
local physics = inst.entity:AddPhysics()
local sound = inst.entity:AddSoundEmitter()
inst.Transform:SetFourFaced()
local shadow = inst.entity:AddDynamicShadow()
shadow:SetSize( 1.5, .75 )
inst.Transform:SetScale(CFG.GUMMYBEAR.SCALE, CFG.GUMMYBEAR.SCALE, CFG.GUMMYBEAR.SCALE)
MakeCharacterPhysics(inst, 50, .5)
inst.AnimState:SetBank("pigman")
inst.AnimState:SetBuild("gummybear_nice")
inst.AnimState:PlayAnimation("idle", true)
inst.AnimState:SetMultColour(CFG.GUMMYBEAR.COLOR(), CFG.GUMMYBEAR.COLOR(), CFG.GUMMYBEAR.COLOR(), CFG.GUMMYBEAR.ALPHA())
-----------------------------------------------------------------------
SetupNetwork(inst)
-----------------------------------------------------------------------
inst:AddComponent("locomotor") -- locomotor must be constructed before the stategraph
inst.components.locomotor.runspeed = CFG.GUMMYBEAR.RUNSPEED
inst.components.locomotor.walkspeed = CFG.GUMMYBEAR.WALKSPEED
inst:AddComponent("follower")
inst:AddComponent("inventory")
------------------------------------------
inst:AddComponent("lootdropper")
inst.components.lootdropper:SetChanceLootTable("gummybear")
------------------------------------------
inst:AddComponent("knownlocations")
inst:AddTag("monster")
inst:AddTag("hostile")
inst:AddTag("cuddly")
inst:AddTag("gumbear")
inst:AddTag("wet")
inst:AddTag("cloudmonster")
inst:AddTag("notraptrigger")
inst:AddComponent("inspectable")
inst:AddComponent("named")
inst.components.named.possiblenames = STRINGS.GUMMYBEAR_NAMES
inst.components.named:PickNewName()
local brain = require "brains/gummybearbrain"
inst:SetBrain(brain)
inst:SetStateGraph("SGgummybear")
inst:AddComponent("sanityaura")
inst.components.sanityaura.aurafn = CalcSanityAura
inst:AddComponent("health")
inst.components.health:SetMaxHealth(CFG.GUMMYBEAR.HEALTH) --Old was 360
inst:AddComponent("eater")
inst.components.eater:SetCarnivore()
inst.components.eater:SetCanEatHorrible()
inst.components.eater.strongstomach = true -- can eat monster meat!
inst:AddComponent("combat")
inst.components.combat:SetDefaultDamage(CFG.GUMMYBEAR.DAMAGE)
inst.components.combat:SetAttackPeriod(CFG.GUMMYBEAR.ATTACK_PERIOD)
inst.components.combat:SetRange(CFG.GUMMYBEAR.RANGE)
inst.components.combat:SetRetargetFunction(3, retargetfn)
inst:ListenForEvent("attacked", OnAttacked)
-- Already handled by the periodic task.
--[[
inst:ListenForEvent("losttarget", function(inst)
inst:AddTag("cuddly")
end)
inst:ListenForEvent("giveuptarget", function(inst)
inst:AddTag("cuddly")
end)
]]--
inst:ListenForEvent("newcombattarget", function(inst, data)
if data.target ~= nil then
OnNewTarget(inst)
end
end)
local cuddlyness_thread
cuddlyness_thread = inst:StartThread(function()
local function resume()
WakeTask(cuddlyness_thread)
end
while inst:IsValid() do
Sleep(30/100)
if inst:IsAsleep() then
Game.ListenForEventOnce(inst, "entitywake", resume)
Hibernate()
end
if not inst.components.combat.target then
Sleep(1)
if not inst.components.combat.target then
become_nice(inst)
end
else
become_naughty(inst)
end
end
end)
return inst
end
local function rainbow()
local inst = CreateEntity()
inst.persists = false
inst.entity:AddTransform()
inst.entity:AddAnimState()
inst.AnimState:SetBank("collapse")
inst.AnimState:SetBuild("structure_collapse_fx")
inst:AddTag("NOCLICK")
inst.AnimState:PlayAnimation("collapse_large")
inst:AddTag("FX")
------------------------------------------------------------------------
SetupNetwork(inst)
------------------------------------------------------------------------
inst:ListenForEvent("animover", function() inst:Remove() end)
inst:StartThread(function()
inst.AnimState:SetMultColour(0.7, 0.3, 0.3, 1)
Sleep(0.25)
inst.AnimState:SetMultColour(0.7, 0.7, 0.3, 1)
Sleep(0.25)
inst.AnimState:SetMultColour(0.3, 0.7, 0.3, 1)
Sleep(0.25)
inst.AnimState:SetMultColour(0.3, 0.7, 0.7, 1)
Sleep(0.25)
inst.AnimState:SetMultColour(0.3, 0.3, 0.7, 1)
end)
return inst
end
--[[
local function KeepTarget(isnt, target)
return true
end
]]--
return {
Prefab( "common/monsters/gummybear", bear, assets, prefabs),
Prefab( "common/monsters/gummybear_rainbow", rainbow, assets, prefabs)
}
| adan830/UpAndAway | code/prefabs/gummybear.lua | Lua | gpl-2.0 | 7,330 |
/*****************************************************************************
* predict.h: arm intra prediction
*****************************************************************************
* Copyright (C) 2009-2021 x264 project
*
* Authors: David Conrad <lessen42@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111, USA.
*
* This program is also available under a commercial proprietary license.
* For more information, contact us at licensing@x264.com.
*****************************************************************************/
#ifndef X264_ARM_PREDICT_H
#define X264_ARM_PREDICT_H
#define x264_predict_4x4_dc_armv6 x264_template(predict_4x4_dc_armv6)
void x264_predict_4x4_dc_armv6( uint8_t *src );
#define x264_predict_4x4_dc_top_neon x264_template(predict_4x4_dc_top_neon)
void x264_predict_4x4_dc_top_neon( uint8_t *src );
#define x264_predict_4x4_v_armv6 x264_template(predict_4x4_v_armv6)
void x264_predict_4x4_v_armv6( uint8_t *src );
#define x264_predict_4x4_h_armv6 x264_template(predict_4x4_h_armv6)
void x264_predict_4x4_h_armv6( uint8_t *src );
#define x264_predict_4x4_ddr_armv6 x264_template(predict_4x4_ddr_armv6)
void x264_predict_4x4_ddr_armv6( uint8_t *src );
#define x264_predict_4x4_ddl_neon x264_template(predict_4x4_ddl_neon)
void x264_predict_4x4_ddl_neon( uint8_t *src );
#define x264_predict_8x8c_dc_neon x264_template(predict_8x8c_dc_neon)
void x264_predict_8x8c_dc_neon( uint8_t *src );
#define x264_predict_8x8c_dc_top_neon x264_template(predict_8x8c_dc_top_neon)
void x264_predict_8x8c_dc_top_neon( uint8_t *src );
#define x264_predict_8x8c_dc_left_neon x264_template(predict_8x8c_dc_left_neon)
void x264_predict_8x8c_dc_left_neon( uint8_t *src );
#define x264_predict_8x8c_h_neon x264_template(predict_8x8c_h_neon)
void x264_predict_8x8c_h_neon( uint8_t *src );
#define x264_predict_8x8c_v_neon x264_template(predict_8x8c_v_neon)
void x264_predict_8x8c_v_neon( uint8_t *src );
#define x264_predict_8x8c_p_neon x264_template(predict_8x8c_p_neon)
void x264_predict_8x8c_p_neon( uint8_t *src );
#define x264_predict_8x16c_h_neon x264_template(predict_8x16c_h_neon)
void x264_predict_8x16c_h_neon( uint8_t *src );
#define x264_predict_8x16c_dc_top_neon x264_template(predict_8x16c_dc_top_neon)
void x264_predict_8x16c_dc_top_neon( uint8_t *src );
#define x264_predict_8x16c_p_neon x264_template(predict_8x16c_p_neon)
void x264_predict_8x16c_p_neon( uint8_t *src );
#define x264_predict_8x8_dc_neon x264_template(predict_8x8_dc_neon)
void x264_predict_8x8_dc_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_ddl_neon x264_template(predict_8x8_ddl_neon)
void x264_predict_8x8_ddl_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_ddr_neon x264_template(predict_8x8_ddr_neon)
void x264_predict_8x8_ddr_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_vl_neon x264_template(predict_8x8_vl_neon)
void x264_predict_8x8_vl_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_vr_neon x264_template(predict_8x8_vr_neon)
void x264_predict_8x8_vr_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_v_neon x264_template(predict_8x8_v_neon)
void x264_predict_8x8_v_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_h_neon x264_template(predict_8x8_h_neon)
void x264_predict_8x8_h_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_hd_neon x264_template(predict_8x8_hd_neon)
void x264_predict_8x8_hd_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_8x8_hu_neon x264_template(predict_8x8_hu_neon)
void x264_predict_8x8_hu_neon( uint8_t *src, uint8_t edge[36] );
#define x264_predict_16x16_dc_neon x264_template(predict_16x16_dc_neon)
void x264_predict_16x16_dc_neon( uint8_t *src );
#define x264_predict_16x16_dc_top_neon x264_template(predict_16x16_dc_top_neon)
void x264_predict_16x16_dc_top_neon( uint8_t *src );
#define x264_predict_16x16_dc_left_neon x264_template(predict_16x16_dc_left_neon)
void x264_predict_16x16_dc_left_neon( uint8_t *src );
#define x264_predict_16x16_h_neon x264_template(predict_16x16_h_neon)
void x264_predict_16x16_h_neon( uint8_t *src );
#define x264_predict_16x16_v_neon x264_template(predict_16x16_v_neon)
void x264_predict_16x16_v_neon( uint8_t *src );
#define x264_predict_16x16_p_neon x264_template(predict_16x16_p_neon)
void x264_predict_16x16_p_neon( uint8_t *src );
#define x264_predict_4x4_init_arm x264_template(predict_4x4_init_arm)
void x264_predict_4x4_init_arm( uint32_t cpu, x264_predict_t pf[12] );
#define x264_predict_8x8_init_arm x264_template(predict_8x8_init_arm)
void x264_predict_8x8_init_arm( uint32_t cpu, x264_predict8x8_t pf[12], x264_predict_8x8_filter_t *predict_filter );
#define x264_predict_8x8c_init_arm x264_template(predict_8x8c_init_arm)
void x264_predict_8x8c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_8x16c_init_arm x264_template(predict_8x16c_init_arm)
void x264_predict_8x16c_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#define x264_predict_16x16_init_arm x264_template(predict_16x16_init_arm)
void x264_predict_16x16_init_arm( uint32_t cpu, x264_predict_t pf[7] );
#endif
| qyot27/x264 | common/arm/predict.h | C | gpl-2.0 | 5,797 |
package tests;
import org.checkerframework.framework.test.CheckerFrameworkTest;
import java.io.File;
import org.junit.runners.Parameterized.Parameters;
/**
* Created by jthaine on 6/25/15.
*/
public class AnnotatedForTest extends CheckerFrameworkTest {
public AnnotatedForTest(File testFile) {
super(testFile,
org.checkerframework.common.subtyping.SubtypingChecker.class,
"subtyping",
"-Anomsgtext",
"-Aquals=tests.util.SubQual,tests.util.SuperQual",
"-AuseDefaultsForUncheckedCode=source,bytecode");
}
@Parameters
public static String [] getTestDirs() {
return new String[]{"conservative-defaults/annotatedfor"};
}
}
| atomicknight/checker-framework | framework/tests/src/tests/AnnotatedForTest.java | Java | gpl-2.0 | 734 |
/* gnome-terminal */
TerminalScreen {
-TerminalScreen-background-darkness: 0.95;
background-color: #000;
color: #fff;
}
/*
TerminalWindow,
TerminalWindow.background {
background-color: @dark_bg_color;
color: @dark_fg_color;
}
*/
/* notebook */
/*
TerminalWindow .notebook {
background-image: none;
background-color: shade (@dark_bg_color, 1.02);
border-radius: 3;
-unico-border-gradient: -gtk-gradient (linear, left top, right top,
from (shade (@dark_bg_color, 0.93)),
to (shade (@dark_bg_color, 0.93)));
-unico-inner-stroke-width: 0;
-unico-outer-stroke-width: 0;
}
TerminalWindow .notebook tab {
background-image: -gtk-gradient (linear, left top, left bottom,
from (shade (@dark_bg_color, 0.92)),
color-stop (0.60, shade (@dark_bg_color, 0.9)),
to (shade (@dark_bg_color, 0.85)));
padding: 0;
color: @dark_fg_color;
-unico-inner-stroke-color: alpha (shade (@dark_bg_color, 1.26), 0.2);
}
TerminalWindow .notebook tab:active {
background-image: -gtk-gradient (linear, left top, left bottom,
from (shade (@dark_bg_color, 1.2)),
to (shade (@dark_bg_color, 1.12)));
-unico-inner-stroke-color: alpha (shade (@dark_bg_color, 1.26), 1.0);
}
TerminalWindow .notebook .button,
TerminalWindow .notebook .button:active {
background-image: -gtk-gradient (linear, left top, right top,
from (shade (@dark_bg_color, 1.08)),
to (shade (@dark_bg_color, 0.92)));
-unico-border-gradient: -gtk-gradient (linear, left top, right top,
from (shade (@dark_bg_color, 0.9)),
to (shade (@dark_bg_color, 0.9)));
-unico-inner-stroke-color: alpha (shade (@dark_bg_color, 1.26), 0.7);
-unico-outer-stroke-style: none;
}
*/
/* Scrollbars */
/*
TerminalWindow .scrollbar {
border-radius: 20;
-unico-border-gradient: -gtk-gradient (linear, left top, left bottom,
from (shade (@dark_bg_color, 0.74)),
to (shade (@dark_bg_color, 0.74)));
}
TerminalWindow .scrollbar.trough {
background-image: -gtk-gradient (linear, left top, right top,
from (shade (@dark_bg_color, 0.9)),
to (shade (@dark_bg_color, 0.95)));
}
TerminalWindow .scrollbar.trough.horizontal {
background-image: -gtk-gradient (linear, left top, left bottom,
from (shade (@dark_bg_color, 0.9)),
to (shade (@dark_bg_color, 0.95)));
}
TerminalWindow .scrollbar.slider,
TerminalWindow .scrollbar.slider:prelight,
TerminalWindow .scrollbar.button,
TerminalWindow .scrollbar.button:insensitive {
background-image: -gtk-gradient (linear, left top, right top,
from (shade (@dark_bg_color, 1.08)),
to (shade (@dark_bg_color, 0.92)));
-unico-border-gradient: -gtk-gradient (linear, left top, right top,
from (shade (@dark_bg_color, 0.74)),
to (shade (@dark_bg_color, 0.74)));
-unico-inner-stroke-color: alpha (shade (@dark_bg_color, 1.26), 0.7);
}
TerminalWindow .scrollbar.slider.horizontal,
TerminalWindow .scrollbar.slider.horizontal:prelight,
TerminalWindow .scrollbar.button.horizontal,
TerminalWindow .scrollbar.button:insensitive {
background-image: -gtk-gradient (linear, left top, left bottom,
from (shade (@dark_bg_color, 1.08)),
to (shade (@dark_bg_color, 0.92)));
-unico-border-gradient: -gtk-gradient (linear, left top, left bottom,
from (shade (@dark_bg_color, 0.74)),
to (shade (@dark_bg_color, 0.74)));
-unico-inner-stroke-color: alpha (shade (@dark_bg_color, 1.26), 0.7);
}
*/
| inukaze/maestro | Temas/usr/share/themes/Windows Vista/gtk-3.0/apps/gnome-terminal.css | CSS | gpl-2.0 | 4,527 |
<?php
class PMXI_CsvParser
{
public
/**
* csv parsing default-settings
*
* @var array
* @access public
*/
$settings = array(
'delimiter' => ',',
'eol' => '',
'length' => 999999,
'escape' => '"'
),
$tmp_files = array(),
$xpath = '',
$delimiter = '',
$htmlentities = false,
$xml_path = '',
$iteration = 0,
$csv_encoding = 'UTF-8',
$is_csv = false,
$targetDir = '',
$auto_encoding = true;
protected
/**
* imported data from csv
*
* @var array
* @access protected
*/
$rows = array(),
/**
* csv file to parse
*
* @var string
* @access protected
*/
$_filename = '',
/**
* csv headers to parse
*
* @var array
* @access protected
*/
$headers = array();
/**
* data load initialize
*
* @param mixed $filename please look at the load() method
*
* @access public
* @see load()
* @return void
*/
public function __construct( $options = array('filename' => null, 'xpath' => '', 'delimiter' => '', 'encoding' => '', 'xml_path' => '', 'targetDir' => false) )
{
PMXI_Plugin::$csv_path = $options['filename'];
$this->xpath = (!empty($options['xpath']) ? $options['xpath'] : ((!empty($_POST['xpath'])) ? $_POST['xpath'] : '/node'));
if ( ! empty($options['delimiter']) ){
$this->delimiter = $options['delimiter'];
}
else{
$input = new PMXI_Input();
$id = $input->get('id', 0);
if (!$id){
$id = $input->get('import_id', 0);
}
if ( $id ){
$import = new PMXI_Import_Record();
$import->getbyId($id);
if ( ! $import->isEmpty() ){
$this->delimiter = $import->options['delimiter'];
}
}
}
if ( ! empty($options['encoding'])){
$this->csv_encoding = $options['encoding'];
$this->auto_encoding = false;
}
if (!empty($options['xml_path'])) $this->xml_path = $options['xml_path'];
@ini_set( "display_errors", 0);
@ini_set('auto_detect_line_endings', true);
$file_params = self::analyse_file($options['filename'], 1);
$this->set_settings(array('delimiter' => $file_params['delimiter']['value'], 'eol' => $file_params['line_ending']['value']));
unset($file_params);
$wp_uploads = wp_upload_dir();
$this->targetDir = (empty($options['targetDir'])) ? pmxi_secure_file($wp_uploads['basedir'] . '/wpallimport/uploads', 'uploads') : $options['targetDir'];
$this->load($options['filename']);
}
/**
* csv file loader
*
* indicates the object which file is to be loaded
*
*
* @param string $filename the csv filename to load
*
* @access public
* @return boolean true if file was loaded successfully
* @see isSymmetric(), getAsymmetricRows(), symmetrize()
*/
public function load($filename)
{
$this->_filename = $filename;
$this->flush();
return $this->parse();
}
/**
* settings alterator
*
* lets you define different settings for scanning
*
*
* @param mixed $array containing settings to use
*
* @access public
* @return boolean true if changes where applyed successfully
* @see $settings
*/
public function set_settings($array)
{
$this->settings = array_merge($this->settings, $array);
}
/**
* header fetcher
*
* gets csv headers into an array
*
* @access public
* @return array
*/
public function getHeaders()
{
return $this->headers;
}
/**
* header counter
*
* retrives the total number of loaded headers
*
* @access public
* @return integer gets the length of headers
*/
public function countHeaders()
{
return count($this->headers);
}
/**
* header and row relationship builder
*
* Attempts to create a relationship for every single cell that
* was captured and its corresponding header. The sample below shows
* how a connection/relationship is built.
*
* @param array $columns the columns to connect, if nothing
* is given all headers will be used to create a connection
*
* @access public
* @return array If the data is not symmetric an empty array
* will be returned instead
* @see isSymmetric(), getAsymmetricRows(), symmetrize(), getHeaders()
*/
public function connect($columns = array())
{
if (!$this->isSymmetric()) {
return array();
}
if (!is_array($columns)) {
return array();
}
if ($columns === array()) {
$columns = $this->headers;
}
$ret_arr = array();
foreach ($this->rows as $record) {
$item_array = array();
foreach ($record as $column => $value) {
$header = $this->headers[$column];
if (in_array($header, $columns)) {
$item_array[$header] = $value;
}
}
// do not append empty results
if ($item_array !== array()) {
array_push($ret_arr, $item_array);
}
}
return $ret_arr;
}
/**
* data length/symmetry checker
*
* tells if the headers and all of the contents length match.
* Note: there is a lot of methods that won't work if data is not
* symmetric this method is very important!
*
* @access public
* @return boolean
* @see symmetrize(), getAsymmetricRows(), isSymmetric()
*/
public function isSymmetric()
{
$hc = count($this->headers);
foreach ($this->rows as $row) {
if (count($row) != $hc) {
return false;
}
}
return true;
}
/**
* asymmetric data fetcher
*
* finds the rows that do not match the headers length
*
* lets assume that we add one more row to our csv file.
* that has only two values. Something like
*
* @access public
* @return array filled with rows that do not match headers
* @see getHeaders(), symmetrize(), isSymmetric(),
* getAsymmetricRows()
*/
public function getAsymmetricRows()
{
$ret_arr = array();
$hc = count($this->headers);
foreach ($this->rows as $row) {
if (count($row) != $hc) {
$ret_arr[] = $row;
}
}
return $ret_arr;
}
/**
* all rows length equalizer
*
* makes the length of all rows and headers the same. If no $value is given
* all unexistent cells will be filled with empty spaces
*
* @param mixed $value the value to fill the unexistent cells
*
* @access public
* @return array
* @see isSymmetric(), getAsymmetricRows(), symmetrize()
*/
public function symmetrize($value = '')
{
$max_length = 0;
$headers_length = count($this->headers);
foreach ($this->rows as $row) {
$row_length = count($row);
if ($max_length < $row_length) {
$max_length = $row_length;
}
}
if ($max_length < $headers_length) {
$max_length = $headers_length;
}
foreach ($this->rows as $key => $row) {
$this->rows[$key] = array_pad($row, $max_length, $value);
}
$this->headers = array_pad($this->headers, $max_length, $value);
}
/**
* grid walker
*
* travels through the whole dataset executing a callback per each
* cell
*
* Note: callback functions get the value of the cell as an
* argument, and whatever that callback returns will be used to
* replace the current value of that cell.
*
* @param string $callback the callback function to be called per
* each cell in the dataset.
*
* @access public
* @return void
* @see walkColumn(), walkRow(), fillColumn(), fillRow(), fillCell()
*/
public function walkGrid($callback)
{
foreach (array_keys($this->getRows()) as $key) {
if (!$this->walkRow($key, $callback)) {
return false;
}
}
return true;
}
/**
* column fetcher
*
* gets all the data for a specific column identified by $name
*
* Note $name is the same as the items returned by getHeaders()
*
* @param string $name the name of the column to fetch
*
* @access public
* @return array filled with values of a column
* @see getHeaders(), fillColumn(), appendColumn(), getCell(), getRows(),
* getRow(), hasColumn()
*/
public function getColumn($name)
{
if (!in_array($name, $this->headers)) {
return array();
}
$ret_arr = array();
$key = array_search($name, $this->headers, true);
foreach ($this->rows as $data) {
$ret_arr[] = $data[$key];
}
return $ret_arr;
}
/**
* column existance checker
*
* checks if a column exists, columns are identified by their
* header name.
*
* @param string $string an item returned by getHeaders()
*
* @access public
* @return boolean
* @see getHeaders()
*/
public function hasColumn($string)
{
return in_array($string, $this->headers);
}
/**
* column appender
*
* Appends a column and each or all values in it can be
*
* @param string $column an item returned by getHeaders()
* @param mixed $values same as fillColumn()
*
* @access public
* @return boolean
* @see getHeaders(), fillColumn(), fillCell(), createHeaders(),
* setHeaders()
*/
public function appendColumn($column, $values = null)
{
if ($this->hasColumn($column)) {
return false;
}
$this->headers[] = $column;
$length = $this->countHeaders();
$rows = array();
foreach ($this->rows as $row) {
$rows[] = array_pad($row, $length, '');
}
$this->rows = $rows;
if ($values === null) {
$values = '';
}
return $this->fillColumn($column, $values);
}
/**
* collumn data injector
*
* fills alll the data in the given column with $values
*
* @param mixed $column the column identified by a string
* @param mixed $values ither one of the following
* - (Number) will fill the whole column with the value of number
* - (String) will fill the whole column with the value of string
* - (Array) will fill the while column with the values of array
* the array gets ignored if it does not match the length of rows
*
* @access public
* @return void
*/
public function fillColumn($column, $values = null)
{
if (!$this->hasColumn($column)) {
return false;
}
if ($values === null) {
return false;
}
if (!$this->isSymmetric()) {
return false;
}
$y = array_search($column, $this->headers);
if (is_numeric($values) || is_string($values)) {
foreach (range(0, $this->countRows() -1) as $x) {
$this->fillCell($x, $y, $values);
}
return true;
}
if ($values === array()) {
return false;
}
$length = $this->countRows();
if (is_array($values) && $length == count($values)) {
for ($x = 0; $x < $length; $x++) {
$this->fillCell($x, $y, $values[$x]);
}
return true;
}
return false;
}
/**
* column remover
*
* Completly removes a whole column identified by $name
*
* @param string $name same as the ones returned by getHeaders();
*
* @access public
* @return boolean
* @see hasColumn(), getHeaders(), createHeaders(), setHeaders(),
* isSymmetric(), getAsymmetricRows()
*/
public function removeColumn($name)
{
if (!in_array($name, $this->headers)) {
return false;
}
if (!$this->isSymmetric()) {
return false;
}
$key = array_search($name, $this->headers);
unset($this->headers[$key]);
$this->resetKeys($this->headers);
foreach ($this->rows as $target => $row) {
unset($this->rows[$target][$key]);
$this->resetKeys($this->rows[$target]);
}
return $this->isSymmetric();
}
/**
* column walker
*
* goes through the whole column and executes a callback for each
* one of the cells in it.
*
* Note: callback functions get the value of the cell as an
* argument, and whatever that callback returns will be used to
* replace the current value of that cell.
*
* @param string $name the header name used to identify the column
* @param string $callback the callback function to be called per
* each cell value
*
* @access public
* @return boolean
* @see getHeaders(), fillColumn(), appendColumn()
*/
public function walkColumn($name, $callback)
{
if (!$this->isSymmetric()) {
return false;
}
if (!$this->hasColumn($name)) {
return false;
}
if (!function_exists($callback)) {
return false;
}
$column = $this->getColumn($name);
foreach ($column as $key => $cell) {
$column[$key] = $callback($cell);
}
return $this->fillColumn($name, $column);
}
/**
* cell fetcher
*
* gets the value of a specific cell by given coordinates
*
* @param integer $x the row to fetch
* @param integer $y the column to fetch
*
* @access public
* @return mixed|false the value of the cell or false if the cell does
* not exist
* @see getHeaders(), hasCell(), getRow(), getRows(), getColumn()
*/
public function getCell($x, $y)
{
if ($this->hasCell($x, $y)) {
$row = $this->getRow($x);
return $row[$y];
}
return false;
}
/**
* cell value filler
*
* replaces the value of a specific cell
*
* @param integer $x the row to fetch
* @param integer $y the column to fetch
* @param mixed $value the value to fill the cell with
*
* @access public
* @return boolean
* @see hasCell(), getRow(), getRows(), getColumn()
*/
public function fillCell($x, $y, $value)
{
if (!$this->hasCell($x, $y)) {
return false;
}
$row = $this->getRow($x);
$row[$y] = $value;
$this->rows[$x] = $row;
return true;
}
/**
* checks if a coordinate is valid
*
* @param mixed $x the row to fetch
* @param mixed $y the column to fetch
*
* @access public
* @return void
*/
public function hasCell($x, $y)
{
$has_x = array_key_exists($x, $this->rows);
$has_y = array_key_exists($y, $this->headers);
return ($has_x && $has_y);
}
/**
* row fetcher
*
* Note: first row is zero
*
* @param integer $number the row number to fetch
*
* @access public
* @return array the row identified by number, if $number does
* not exist an empty array is returned instead
*/
public function getRow($number)
{
$raw = $this->rows;
if (array_key_exists($number, $raw)) {
return $raw[$number];
}
return array();
}
/**
* multiple row fetcher
*
* Extracts a rows in the following fashion
* - all rows if no $range argument is given
* - a range of rows identified by their key
* - if rows in range are not found nothing is retrived instead
* - if no rows were found an empty array is returned
*
* @param array $range a list of rows to retrive
*
* @access public
* @return array
*/
public function getRows($range = array())
{
if (is_array($range) && ($range === array())) {
return $this->rows;
}
if (!is_array($range)) {
return $this->rows;
}
$ret_arr = array();
foreach ($this->rows as $key => $row) {
if (in_array($key, $range)) {
$ret_arr[] = $row;
}
}
return $ret_arr;
}
/**
* row counter
*
* This function will exclude the headers
*
* @access public
* @return integer
*/
public function countRows()
{
return count($this->rows);
}
/**
* row appender
*
* Aggregates one more row to the currently loaded dataset
*
* @param array $values the values to be appended to the row
*
* @access public
* @return boolean
*/
public function appendRow($values)
{
$this->rows[] = array();
$this->symmetrize();
return $this->fillRow($this->countRows() - 1, $values);
}
/**
* fillRow
*
* Replaces the contents of cells in one given row with $values.
*
* @param integer $row the row to fill identified by its key
* @param mixed $values the value to use, if a string or number
* is given the whole row will be replaced with this value.
* if an array is given instead the values will be used to fill
* the row. Only when the currently loaded dataset is symmetric
*
* @access public
* @return boolean
* @see isSymmetric(), getAsymmetricRows(), symmetrize(), fillColumn(),
* fillCell(), appendRow()
*/
public function fillRow($row, $values)
{
if (!$this->hasRow($row)) {
return false;
}
if (is_string($values) || is_numeric($values)) {
foreach ($this->rows[$row] as $key => $cell) {
$this->rows[$row][$key] = $values;
}
return true;
}
$eql_to_headers = ($this->countHeaders() == count($values));
if (is_array($values) && $this->isSymmetric() && $eql_to_headers) {
$this->rows[$row] = $values;
return true;
}
return false;
}
/**
* row existance checker
*
* Scans currently loaded dataset and
* checks if a given row identified by $number exists
*
* @param mixed $number a numeric value that identifies the row
* you are trying to fetch.
*
* @access public
* @return boolean
* @see getRow(), getRows(), appendRow(), fillRow()
*/
public function hasRow($number)
{
return (in_array($number, array_keys($this->rows)));
}
/**
* row remover
*
* removes one row from the current data set.
*
*
* @param mixed $number the key that identifies that row
*
* @access public
* @return boolean
* @see hasColumn(), getHeaders(), createHeaders(), setHeaders(),
* isSymmetric(), getAsymmetricRows()
*/
public function removeRow($number)
{
$cnt = $this->countRows();
$row = $this->getRow($number);
if (is_array($row) && ($row != array())) {
unset($this->rows[$number]);
} else {
return false;
}
$this->resetKeys($this->rows);
return ($cnt == ($this->countRows() + 1));
}
/**
* row walker
*
* goes through one full row of data and executes a callback
* function per each cell in that row.
*
* Note: callback functions get the value of the cell as an
* argument, and whatever that callback returns will be used to
* replace the current value of that cell.
*
* @param string|integer $row anything that is numeric is a valid row
* identificator. As long as it is within the range of the currently
* loaded dataset
*
* @param string $callback the callback function to be executed
* per each cell in a row
*
* @access public
* @return boolean
* - false if callback does not exist
* - false if row does not exits
*/
public function walkRow($row, $callback)
{
if (!function_exists($callback)) {
return false;
}
if ($this->hasRow($row)) {
foreach ($this->getRow($row) as $key => $value) {
$this->rows[$row][$key] = $callback($value);
}
return true;
}
return false;
}
/**
* raw data as array
*
* Gets the data that was retrived from the csv file as an array
*
* Note: that changes and alterations made to rows, columns and
* values will also reflect on what this function retrives.
*
* @access public
* @return array
* @see connect(), getHeaders(), getRows(), isSymmetric(), getAsymmetricRows(),
* symmetrize()
*/
public function getRawArray()
{
$ret_arr = array();
foreach ($this->rows as $key => $row) {
$item = array();
foreach ($this->headers as $col => $value) {
$item[$value] = $this->fixEncoding($row[$col]);
}
array_push($ret_arr, $item);
unset($item);
}
return $ret_arr;
}
// Fixes the encoding to uf8
function fixEncoding($in_str)
{
if (function_exists('mb_detect_encoding') and function_exists('mb_check_encoding')){
$cur_encoding = mb_detect_encoding($in_str) ;
if ( $cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8") ){
return $in_str;
}
else
return utf8_encode($in_str);
}
return $in_str;
} // fixEncoding
/**
* header creator
*
* uses prefix and creates a header for each column suffixed by a
* numeric value
*
* @param string $prefix string to use as prefix for each
* independent header
*
* @access public
* @return boolean fails if data is not symmetric
* @see isSymmetric(), getAsymmetricRows()
*/
public function createHeaders($prefix)
{
if (!$this->isSymmetric()) {
return false;
}
$length = count($this->headers) + 1;
$this->moveHeadersToRows();
$ret_arr = array();
for ($i = 1; $i < $length; $i ++) {
$ret_arr[] = $prefix . "_$i";
}
$this->headers = $ret_arr;
return $this->isSymmetric();
}
/**
* header injector
*
* uses a $list of values which wil be used to replace current
* headers.
*
*
* @param array $list a collection of names to use as headers,
*
* @access public
* @return boolean fails if data is not symmetric
* @see isSymmetric(), getAsymmetricRows(), getHeaders(), createHeaders()
*/
public function setHeaders($list)
{
if (!$this->isSymmetric()) {
return false;
}
if (!is_array($list)) {
return false;
}
if (count($list) != count($this->headers)) {
return false;
}
$this->moveHeadersToRows();
$this->headers = $list;
return true;
}
/**
* csv parser
*
* reads csv data and transforms it into php-data
*
* @access protected
* @return boolean
*/
protected function parse()
{
if (!$this->validates()) {
return false;
}
$tmpname = wp_unique_filename($this->targetDir, str_replace("csv", "xml", basename($this->_filename)));
if ("" == $this->xml_path)
$this->xml_path = $this->targetDir .'/'. url_title($tmpname);
$this->toXML(true);
/*$file = new PMXI_Chunk($this->xml_path, array('element' => 'node'));
if ( empty($file->options['element']) ){
$this->toXML(true); // Remove non ASCII symbols and write CDATA
}*/
return true;
}
function toXML( $fixBrokenSymbols = false ){
$c = 0;
$d = ( "" != $this->delimiter ) ? $this->delimiter : $this->settings['delimiter'];
$e = $this->settings['escape'];
$l = $this->settings['length'];
$this->is_csv = $d;
$is_html = false;
$f = @fopen($this->_filename, "rb");
while (!@feof($f)) {
$chunk = @fread($f, 1024);
if (strpos($chunk, "<!DOCTYPE") === 0) $is_html = true;
break;
}
if ($is_html) return;
$res = fopen($this->_filename, 'rb');
$xmlWriter = new XMLWriter();
$xmlWriter->openURI($this->xml_path);
$xmlWriter->setIndent(true);
$xmlWriter->setIndentString("\t");
$xmlWriter->startDocument('1.0', $this->csv_encoding);
$xmlWriter->startElement('data');
$create_new_headers = false;
while ($keys = fgetcsv($res, $l, $d, $e)) {
if ($c == 0) {
$buf_keys = $keys;
foreach ($keys as $key => $value) {
if (!$create_new_headers and (preg_match('%\W(http:|https:|ftp:)$%i', $value) or is_numeric($value))) $create_new_headers = true;
$value = trim(strtolower(preg_replace('/^[0-9]{1}/','el_', preg_replace('/[^a-z0-9_]/i', '', $value))));
$keys[$key] = (!empty($value) and strlen($value) <= 30) ? $value : 'undefined' . $key;
}
$this->headers = $keys;
if ($create_new_headers){
$this->createHeaders('column');
$keys = $buf_keys;
}
}
if ( $c or $create_new_headers ) {
if (!empty($keys)){
$chunk = array();
foreach ($this->headers as $key => $header) $chunk[$header] = $this->fixEncoding( $keys[$key] );
if ( ! empty($chunk) )
{
$xmlWriter->startElement('node');
foreach ($chunk as $header => $value)
{
$xmlWriter->startElement($header);
if ($fixBrokenSymbols){
// Remove non ASCII symbols and write CDATA
$xmlWriter->writeCData(preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', ' ', $value));
}
else{
$xmlWriter->writeCData($value);
}
$xmlWriter->endElement();
}
$xmlWriter->endElement();
}
}
}
$c ++;
}
fclose($res);
$xmlWriter->endElement();
$xmlWriter->flush(true);
return true;
}
/**
* empty row remover
*
* removes all records that have been defined but have no data.
*
* @access protected
* @return array containing only the rows that have data
*/
protected function removeEmpty()
{
$ret_arr = array();
foreach ($this->rows as $row) {
$line = trim(join('', $row));
if (!empty($line)) {
$ret_arr[] = $row;
}
}
$this->rows = $ret_arr;
}
/**
* csv file validator
*
* checks wheather if the given csv file is valid or not
*
* @access protected
* @return boolean
*/
protected function validates()
{
// file existance
if (!file_exists($this->_filename)) {
return false;
}
// file readability
if (!is_readable($this->_filename)) {
return false;
}
return true;
}
/**
* header relocator
*
* @access protected
* @return void
*/
protected function moveHeadersToRows()
{
$arr = array();
$arr[] = $this->headers;
foreach ($this->rows as $row) {
$arr[] = $row;
}
$this->rows = $arr;
$this->headers = array();
}
/**
* array key reseter
*
* makes sure that an array's keys are setted in a correct numerical order
*
* Note: that this function does not return anything, all changes
* are made to the original array as a reference
*
* @param array &$array any array, if keys are strings they will
* be replaced with numeric values
*
* @access protected
* @return void
*/
protected function resetKeys(&$array)
{
$arr = array();
foreach ($array as $item) {
$arr[] = $item;
}
$array = $arr;
}
/**
* object data flusher
*
* tells this object to forget all data loaded and start from
* scratch
*
* @access protected
* @return void
*/
protected function flush()
{
$this->rows = array();
$this->headers = array();
}
function analyse_file($file, $capture_limit_in_kb = 10) {
// capture starting memory usage
$output['peak_mem']['start'] = memory_get_peak_usage(true);
// log the limit how much of the file was sampled (in Kb)
$output['read_kb'] = $capture_limit_in_kb;
// read in file
$fh = fopen($file, 'r');
$contents = fgets($fh);
fclose($fh);
// specify allowed field delimiters
$delimiters = array(
'comma' => ',',
'semicolon' => ';',
'pipe' => '|',
'tabulation' => "\t"
);
// specify allowed line endings
$line_endings = array(
'rn' => "\r\n",
'n' => "\n",
'r' => "\r",
'nr' => "\n\r"
);
// loop and count each line ending instance
foreach ($line_endings as $key => $value) {
$line_result[$key] = substr_count($contents, $value);
}
// sort by largest array value
asort($line_result);
// log to output array
$output['line_ending']['results'] = $line_result;
$output['line_ending']['count'] = end($line_result);
$output['line_ending']['key'] = key($line_result);
$output['line_ending']['value'] = $line_endings[$output['line_ending']['key']];
$lines = explode($output['line_ending']['value'], $contents);
// remove last line of array, as this maybe incomplete?
array_pop($lines);
// create a string from the legal lines
$complete_lines = implode(' ', $lines);
// log statistics to output array
$output['lines']['count'] = count($lines);
$output['lines']['length'] = strlen($complete_lines);
// loop and count each delimiter instance
foreach ($delimiters as $delimiter_key => $delimiter) {
$delimiter_result[$delimiter_key] = substr_count($complete_lines, $delimiter);
}
// sort by largest array value
asort($delimiter_result);
// log statistics to output array with largest counts as the value
$output['delimiter']['results'] = $delimiter_result;
$output['delimiter']['count'] = end($delimiter_result);
$output['delimiter']['key'] = key($delimiter_result);
$output['delimiter']['value'] = $delimiters[$output['delimiter']['key']];
// capture ending memory usage
$output['peak_mem']['end'] = memory_get_peak_usage(true);
return $output;
}
}
?>
| cyberfly/apcwp | wp-content/plugins/wp-all-import-pro/libraries/XmlImportCsvParse.php | PHP | gpl-2.0 | 33,488 |
/*
** The cvsgui protocol used by WinCvs
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/*!
\file cvsgui_process.cpp
\brief CvsGui process code implementation
\author Alexandre Parenteau <aubonbeurre@hotmail.com> --- November 1999
\note To be used by GUI and CVS client
\note Derived from plugin.c in GIMP
*/
#ifdef _WIN32
// Microsoft braindamage reversal.
#define _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifdef HAVE_CONFIG_H
extern "C" {
#include "config.h"
}
#endif
#ifdef HAVE_STRINGS_H
# include <strings.h>
#endif
#include <errno.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <time.h>
#include <stdarg.h> // hpux requirement f/c++ apps
#ifndef WIN32
# include <sys/wait.h>
# include <sys/time.h>
# include <sys/param.h>
# include <unistd.h>
#endif
#include <stack>
#include <vector>
#include <algorithm>
#include "cvsgui_process.h"
#include "cvsgui_protocol.h"
static int cvs_process_write(pipe_t fd, guint8* buf, gulong count);
static int cvs_process_flush(pipe_t fd);
static void cvs_process_push(CvsProcess* cvs_process);
static void cvs_process_pop(void);
static void cvs_process_recv_message(CvsProcess* p);
static void cvs_process_handle_message(WireMessage* msg);
void cvs_process_kill(CvsProcess* cvs_process);
static void cvs_process_close(CvsProcess* cvs_process, int kill_it);
static void cvs_process_destroy(CvsProcess* cvs_process);
static CvsProcess* cvs_process_new(char* name, int argc, char** argv);
static std::deque<CvsProcess*>cvs_process_stack; /*!< Process stack container */
static std::vector<CvsProcess*>open_cvs_process; /*!< Open process container */
static CvsProcess* current_cvs_process = NULL; /*!< Current CVS process */
static int current_write_buffer_index = 0; /*!< Current write buffer index */
static char* current_write_buffer = NULL; /*!< Current write buffer */
static char process_write_buffer[WRITE_BUFFER_SIZE]; /*!< Buffer for writing, only for the process */
#ifdef WIN32
/// Use the runtime to initialize and delete a critical section
class CDummyInit
{
public:
// Construction
CDummyInit()
{
::InitializeCriticalSection(&m_destroyLock);
::InitializeCriticalSection(&m_stackLock);
}
~CDummyInit()
{
::DeleteCriticalSection(&m_destroyLock);
::DeleteCriticalSection(&m_stackLock);
}
private:
// Data members
static CRITICAL_SECTION m_destroyLock; /*!< Destroy lock */
static CRITICAL_SECTION m_stackLock; /*!< Stack lock */
public:
// Interface
/// Get the destroy lock
inline static CRITICAL_SECTION* GetDestroyLock()
{
return &m_destroyLock;
}
/// Get the stack lock
inline static CRITICAL_SECTION* GetStackLock()
{
return &m_stackLock;
}
} sDummyObject;
CRITICAL_SECTION CDummyInit::m_destroyLock;
CRITICAL_SECTION CDummyInit::m_stackLock;
/*!
Write data to a file
\param fd File handle
\param buf Data to be written
\param count Buffer size
\return The count of data written
\note Wraps ::WriteFile API
*/
static int write(pipe_t fd, const void* buf, int count)
{
DWORD write;
if( !WriteFile(fd, buf, count, &write, NULL) )
{
errno = EINVAL;
return -1;
}
return write;
}
/*!
Callback enumerating all top-level windows and posting the WM_CLOSE message to the process that matches given process ID
\param hWnd Window handle
\param lParam Process ID to post message to
\return TRUE to continue enumerate, FALSE to stop
*/
BOOL CALLBACK PostCloseEnum(HWND hWnd, LPARAM lParam)
{
DWORD pid = 0;
GetWindowThreadProcessId(hWnd, &pid);
if( pid == (DWORD)lParam )
{
PostMessage(hWnd, WM_CLOSE, 0, 0);
}
return TRUE;
}
/*!
Terminate cvs process
\param cvs_process Cvs process to be terminated
\return true if process was terminate, false otherwise
\note See also Q178893 - HOWTO: Terminate an Application "Cleanly" in Win32
*/
bool cvs_process_terminate(CvsProcess* cvs_process)
{
bool res = FALSE;
EnumWindows((WNDENUMPROC)PostCloseEnum, (LPARAM)cvs_process->threadID);
if( WaitForSingleObject(cvs_process->pid, 300) == WAIT_OBJECT_0 )
{
res = TRUE;
}
else
{
res = TerminateProcess(cvs_process->pid, 0) != 0;
}
return res;
}
/// Critical section used when destroying cvs process
struct CDestroyThreadLock
{
public:
// Construction
inline CDestroyThreadLock()
{
EnterCriticalSection(CDummyInit::GetDestroyLock());
}
inline ~CDestroyThreadLock()
{
LeaveCriticalSection(CDummyInit::GetDestroyLock());
}
};
/// Critical section used for cvs process stack operations
struct CStackThreadLock
{
public:
inline CStackThreadLock()
{
EnterCriticalSection(CDummyInit::GetStackLock());
}
inline ~CStackThreadLock()
{
LeaveCriticalSection(CDummyInit::GetStackLock());
}
};
#else
/// Dummy critical section used when destroying cvs process
struct CDestroyThreadLock
{
public:
inline CDestroyThreadLock()
{
}
inline ~CDestroyThreadLock()
{
}
};
/// Dummy critical section used for cvs process stack operations
struct CStackThreadLock
{
public:
inline CStackThreadLock()
{
}
inline ~CStackThreadLock()
{
}
};
#endif
/*!
Read the exit code message from the pipe
\param fd Pipe
\param msg Message
*/
static void _gp_quit_read(pipe_t fd, WireMessage* msg)
{
GPT_QUIT* t = (GPT_QUIT*)malloc(sizeof(GPT_QUIT));
if( t == 0L )
return;
if( !wire_read_int32(fd, (guint32*)&t->code, 1) )
return;
msg->data = t;
}
/*!
Write the exit code message to the pipe
\param fd Pipe
\param msg Message
*/
static void _gp_quit_write(pipe_t fd, WireMessage* msg)
{
GPT_QUIT* t = (GPT_QUIT*)msg->data;
if( !wire_write_int32(fd, (guint32*)&t->code, 1) )
return;
}
/*!
Destroy message data
\param msg Message
*/
static void _gp_quit_destroy(WireMessage* msg)
{
free(msg->data);
}
/*!
Read the environment message from the pipe
\param fd Pipe
\param msg Message
*/
static void _gp_getenv_read(pipe_t fd, WireMessage* msg)
{
GPT_GETENV* t = (GPT_GETENV*)malloc(sizeof(GPT_GETENV));
if( t == 0L )
return;
if( !wire_read_int8(fd, &t->empty, 1) )
return;
if( !wire_read_string(fd, &t->str, 1) )
return;
msg->data = t;
}
/*!
Write the environment message to the pipe
\param fd Pipe
\param msg Message
*/
static void _gp_getenv_write(pipe_t fd, WireMessage* msg)
{
GPT_GETENV* t = (GPT_GETENV*)msg->data;
if( !wire_write_int8(fd, &t->empty, 1) )
return;
if( !wire_write_string(fd, &t->str, 1, -1) )
return;
}
/*!
Destroy environment data
\param msg Message
*/
static void _gp_getenv_destroy(WireMessage* msg)
{
GPT_GETENV* t = (GPT_GETENV*)msg->data;
free(t->str);
free(t);
}
/*!
Read the console message from the pipe
\param fd Pipe
\param msg Message
*/
static void _gp_console_read(pipe_t fd, WireMessage* msg)
{
GPT_CONSOLE* t = (GPT_CONSOLE*)malloc(sizeof(GPT_CONSOLE));
if( t == 0L )
return;
if( !wire_read_int8(fd, &t->isStderr, 1) )
return;
if( !wire_read_int32(fd, &t->len, 1) )
return;
if( !wire_read_string(fd, &t->str, 1) )
return;
msg->data = t;
}
/*!
Write the console message to the pipe
\param fd Pipe
\param msg Message
*/
static void _gp_console_write(pipe_t fd, WireMessage* msg)
{
GPT_CONSOLE* t = (GPT_CONSOLE*)msg->data;
if( !wire_write_int8(fd, &t->isStderr, 1) )
return;
if( !wire_write_int32(fd, &t->len, 1) )
return;
if( !wire_write_string(fd, &t->str, 1, t->len) )
return;
}
/*!
Destroy console data
\param msg Message
*/
static void _gp_console_destroy(WireMessage* msg)
{
GPT_CONSOLE* t = (GPT_CONSOLE*)msg->data;
free(t->str);
free(t);
}
/*!
Register read, write and destroy functions
*/
static void gp_init()
{
wire_register(GP_QUIT,
_gp_quit_read,
_gp_quit_write,
_gp_quit_destroy);
wire_register(GP_GETENV,
_gp_getenv_read,
_gp_getenv_write,
_gp_getenv_destroy);
wire_register(GP_CONSOLE,
_gp_console_read,
_gp_console_write,
_gp_console_destroy);
}
/*!
Write the exit code to the pipe
\param fd Pipe
\param code Exit code
\return TRUE on success, FALSE otherwise
*/
int gp_quit_write(pipe_t fd, int code)
{
WireMessage msg;
GPT_QUIT* t = (GPT_QUIT*)malloc(sizeof(GPT_QUIT));
msg.type = GP_QUIT;
msg.data = t;
t->code = code;
if( !wire_write_msg(fd, &msg) )
return FALSE;
if( !wire_flush(fd) )
return FALSE;
return TRUE;
}
/*!
Write the environment variable to the pipe
\param fd Pipe
\param env Name of the environment variable
\return TRUE on success, FALSE otherwise
*/
int gp_getenv_write(pipe_t fd, const char* env)
{
WireMessage msg;
GPT_GETENV* t = (GPT_GETENV*)malloc(sizeof(GPT_GETENV));
msg.type = GP_GETENV;
msg.data = t;
t->empty = env == 0L;
t->str = strdup(env == 0L ? "" : env);
if( !wire_write_msg(fd, &msg) )
return FALSE;
wire_destroy(&msg);
if( !wire_flush(fd) )
return FALSE;
return TRUE;
}
/*!
Read the environment variable from the pipe
\param fd Pipe
\return The value of environment variable
*/
char* gp_getenv_read(pipe_t fd)
{
WireMessage msg;
char* res;
memset(&msg, 0, sizeof(WireMessage));
if( !wire_read_msg(fd, &msg) || msg.type != GP_GETENV )
{
fprintf(stderr, "cvsgui protocol error !\n");
exit(-1);
}
GPT_GETENV* t = (GPT_GETENV*)msg.data;
res = t->empty ? 0L : strdup(t->str);
wire_destroy(&msg);
return res;
}
#ifdef WIN32
extern "C"
#endif
/*!
Write the console data to the pipe
\param fd Pipe
\param str Data to be written
\param len Data length
\param isStderr Non-zero to write <b>stderr</b>, otherwise write <b>stdout</b>
\param binary Non-zero if data is binary, text data otherwise
\return TRUE on success, FALSE otherwise
\note For binary data an additional empty message is written first before the actual data
*/
int gp_console_write(pipe_t fd, const char* str, int len, int isStderr, int binary)
{
WireMessage msg;
GPT_CONSOLE* t = (GPT_CONSOLE*)malloc(sizeof(GPT_CONSOLE));
if( binary )
{
// Sending an empty message to indicate the binary stream coming
gp_console_write(fd, "", 0, 0, 0);
}
msg.type = GP_CONSOLE;
msg.data = t;
t->isStderr = isStderr;
t->len = len;
t->str = (char*)malloc((len + 1) * sizeof(char));
memcpy(t->str, str, len * sizeof(char));
t->str[len] = '\0';
if( !wire_write_msg(fd, &msg) )
return FALSE;
if( !wire_flush(fd) )
return FALSE;
return TRUE;
}
/*!
Initialize the protocol library (both for the process and the application)
*/
void cvs_process_init()
{
gp_init();
wire_set_writer(cvs_process_write);
wire_set_flusher(cvs_process_flush);
}
/*!
Create new cvs process object and initialize it's data members
\param name Command
\param argc Arguments count
\param argv Arguments
\return Pointer to the newly allocated object
\note You must free allocated memory using cvs_process_destroy
*/
static CvsProcess* cvs_process_new(const char* name, int argc, char** argv)
{
CvsProcess* cvs_process;
cvs_process_init();
cvs_process = (CvsProcess*)malloc(sizeof(CvsProcess));
if( cvs_process == 0L )
return 0L;
cvs_process->open = FALSE;
cvs_process->destroy = FALSE;
#ifdef WIN32
cvs_process->starting = TRUE;
cvs_process->threadID = 0;
#endif
cvs_process->pid = 0;
cvs_process->callbacks = 0L;
cvs_process->argc = argc + 4;
cvs_process->args = (char**)malloc((cvs_process->argc + 1) * sizeof(char*));
cvs_process->args[0] = strdup(name);
cvs_process->args[1] = strdup("-cvsgui");
cvs_process->args[2] = (char*)malloc(16 * sizeof(char));
cvs_process->args[3] = (char*)malloc(16 * sizeof(char));
for(int i = 0; i < argc; i++)
{
cvs_process->args[4 + i] = strdup(argv[i]);
}
cvs_process->args[cvs_process->argc] = 0L;
cvs_process->my_read = 0;
cvs_process->my_write = 0;
cvs_process->his_read = 0;
cvs_process->his_write = 0;
cvs_process->write_buffer_index = 0;
cvs_process->pstdin = 0;
cvs_process->pstdout = 0;
cvs_process->pstderr = 0;
cvs_process->appData = 0L;
#ifdef WIN32
memset(cvs_process->threads, 0, sizeof(cvs_process->threads));
memset(cvs_process->threadsID, 0, sizeof(cvs_process->threadsID));
cvs_process->stopProcessEvent = NULL;
#endif
return cvs_process;
}
/*!
Destroy cvs process object and free allocated memory
\param cvs_process Cvs process to be destroyed
*/
static void cvs_process_destroy(CvsProcess* cvs_process)
{
if( cvs_process )
{
cvs_process_close(cvs_process, TRUE);
if( cvs_process->args != 0L )
{
for(int i = 0; i < cvs_process->argc; i++)
{
if( cvs_process->args[i] )
{
free(cvs_process->args[i]);
cvs_process->args[i] = 0L;
}
}
free(cvs_process->args);
cvs_process->args = 0L;
}
if( cvs_process == current_cvs_process )
cvs_process_pop();
if( !cvs_process->destroy )
{
cvs_process->destroy = TRUE;
#ifdef WIN32
// wait so the threads do not continue to use the pointer
HANDLE WaitH[4];
int cnt = 0;
DWORD curT = GetCurrentThreadId();
for(int i = 0; i < 4; i++)
{
if( cvs_process->threads[i] && curT != cvs_process->threadsID[i] )
WaitH[cnt++] = cvs_process->threads[i];
}
WaitForMultipleObjects(cnt, WaitH, TRUE, INFINITE);
// Close the handles
for(int i = 0; i < 4; i++)
{
if( cvs_process->threads[i] && CloseHandle(cvs_process->threads[i]) )
{
cvs_process->threads[i] = NULL;
}
}
if( cvs_process->stopProcessEvent )
{
CloseHandle(cvs_process->stopProcessEvent);
}
#endif
free(cvs_process);
}
}
}
#ifdef WIN32
/*!
Given an array of arguments that one might pass to spawnv
construct a command line that one might pass to CreateProcess
\param argc Arguments count
\param argv Arguments
\return The built command string
\note Tries to quote things appropriately
*/
static char* build_command(int argc, char* const* argv)
{
int len;
/* Compute the total length the command will have. */
{
int i;
len = 0;
for(i = 0; i < argc; i++)
{
char* p;
len += 2; /* for the double quotes */
for(p = argv[i]; *p; p++)
{
if( *p == '"' )
len += 2;
else
len++;
}
len++; /* for the space or the '\0' */
}
}
{
/* The + 10 is in case len is 0. */
char* command = (char*)malloc(len + 10);
int i;
char* p;
if( !command )
{
errno = ENOMEM;
return command;
}
p = command;
*p = '\0';
/* copy each element of argv to command, putting each command
in double quotes, and backslashing any quotes that appear
within an argument. */
for(i = 0; i < argc; i++)
{
char* a;
*p++ = '"';
for(a = argv[i]; *a; a++)
{
if( *a == '"' )
*p++ = '\\', *p++ = '"';
else
*p++ = *a;
}
*p++ = '"';
*p++ = ' ';
}
if( p > command )
p[-1] = '\0';
return command;
}
}
/// Read file buffer size
#define BUFFSIZE 1024
/// Thread return value to mark successful completion
#define THREAD_EXIT_SUCCESS (1)
/*!
Worker thread to read the cvs process stdout
\param process Cvs process
\return THREAD_EXIT_SUCCESS
*/
static DWORD GetChldOutput(CvsProcess* process)
{
char buff[BUFFSIZE];
DWORD dread;
while( ReadFile(process->pstdout, buff, BUFFSIZE-1, &dread, NULL) )
{
buff[dread] = '\0';
process->callbacks->consoleout(buff, dread, process);
}
return THREAD_EXIT_SUCCESS;
}
/*!
Worker thread to read the cvs process stderr
\param process Cvs process
\return THREAD_EXIT_SUCCESS
*/
static DWORD GetChldError(CvsProcess* process)
{
char buff[BUFFSIZE];
DWORD dread;
while( ReadFile(process->pstderr, buff, BUFFSIZE-1, &dread, NULL) )
{
buff[dread] = '\0';
process->callbacks->consoleerr(buff, dread, process);
}
return THREAD_EXIT_SUCCESS;
}
/*!
Worker thread to monitor the cvs process operation and stop request
\param process Cvs process
\return THREAD_EXIT_SUCCESS
*/
static DWORD MonitorChld(CvsProcess* process)
{
HANDLE waitHandles[2] = { process->pid, process->stopProcessEvent };
const DWORD waitResult = WaitForMultipleObjects(2, waitHandles, FALSE, INFINITE);
if( waitResult == (WAIT_OBJECT_0 + 1) )
{
cvs_process_kill(process);
}
else
{
cvs_process_destroy(process);
}
return THREAD_EXIT_SUCCESS;
}
/*!
Worker thread to read and process pipe communication
\param process Cvs process
\return THREAD_EXIT_SUCCESS
*/
static DWORD ServeProtocol(CvsProcess* process)
{
while( process->starting )
{
Sleep(20);
continue;
}
DWORD avail;
while( cvs_process_is_active(process) && process->open )
{
if( !PeekNamedPipe(process->my_read, 0L, 0 , 0L, &avail, 0L) )
break;
if( avail == 0 )
{
Sleep(20);
continue;
}
cvs_process_recv_message(process);
}
return THREAD_EXIT_SUCCESS;
}
#endif
#ifndef WIN32
/// Pointer to the process if sigtt_handler is forced to kill
CvsProcess* sigtt_cvs_process = NULL;
#define SIGTT_ERR "This CVS command required an interactive TTY, I had to kill it.\n"
/*!
Signal handler
\param sig Signal
*/
static void sigtt_handler(int sig)
{
if( sigtt_cvs_process )
{
// Keep that for later
CvsProcessCallbacks* callbacks = sigtt_cvs_process->callbacks;
// Killing the cvs process avoids getting stuck in a SIGSTOP
cvs_process_destroy(sigtt_cvs_process);
callbacks->consoleerr(SIGTT_ERR, strlen(SIGTT_ERR), sigtt_cvs_process);
}
sigtt_cvs_process = NULL;
}
#endif
/*!
Start the cvs process
\param name Command to be started
\param argc Arguments count
\param argv Arguments
\param callbacks <b>stdout</b>/<b>stderr</b> redirection callbacks
\param startupInfo Additional parameters to control command's execution
\param appData Application-specific data
\return Pointer to the new CvsProcess on success, NULL otherwise
*/
CvsProcess* cvs_process_run(const char* name, int argc, char** argv,
CvsProcessCallbacks* callbacks, CvsProcessStartupInfo* startupInfo,
void* appData)
{
if( !callbacks || !startupInfo )
return 0L;
CvsProcess* cvs_process = cvs_process_new(name, argc, argv);
if( !cvs_process || !callbacks || !startupInfo )
return 0L;
cvs_process->callbacks = callbacks;
cvs_process->appData = appData;
#ifndef WIN32
int my_read[2] = { 0, 0 };
int my_write[2] = { 0, 0 };
/* Open two pipes. (Bidirectional communication). */
if( (pipe(my_read) == -1) || (pipe(my_write) == -1) )
{
fprintf(stderr, "unable to open pipe\n");
cvs_process_destroy(cvs_process);
return 0L;
}
cvs_process->my_read = my_read[0];
cvs_process->my_write = my_write[1];
cvs_process->his_read = my_write[0];
cvs_process->his_write = my_read[1];
/* Remember the file descriptors for the pipes. */
sprintf(cvs_process->args[2], "%d", cvs_process->his_read);
sprintf(cvs_process->args[3], "%d", cvs_process->his_write);
/* Add the relevant commands to spawn in a terminal if necessary */
if( startupInfo->hasTty )
{
cvs_process->argc += 2;
char** old_args = cvs_process->args;
cvs_process->args = (char**)malloc((cvs_process->argc + 1) * sizeof(char*));
cvs_process->args[0] = strdup("xterm");
cvs_process->args[1] = strdup("-e");
int i = 0;
while( old_args[i] )
{
cvs_process->args[i+2] = old_args[i];
i++;
}
cvs_process->args[cvs_process->argc] = 0L;
free(old_args);
}
/* If we are running non interactively (i.e. gcvs&), it is
* possible that the cvs process would require entering a password
* or something similar (happens in some cases for CVS_RSH=ssh)
* this would raise a SIGTTOU, which turns into a SIGSTOP if not handled
*/
sigtt_cvs_process = cvs_process;
signal(SIGTTIN, sigtt_handler); // TODO: check if necessary on Mac
signal(SIGTTOU, sigtt_handler); // TODO: check if necessary on Mac
/* Fork another process. We'l remember the process id
* so that we can later use it to kill the filter if
* necessary.
*/
cvs_process->pid = fork();
if( cvs_process->pid == 0 )
{
close(cvs_process->my_read);
close(cvs_process->my_write);
/* Execute the filter. The "_exit" call should never
* be reached, unless some strange error condition
* exists.
*/
execvp(cvs_process->args[0], cvs_process->args);
_exit(1);
}
else if( cvs_process->pid == -1 )
{
cvs_process_destroy(cvs_process);
// fork failed
sigtt_cvs_process = NULL;
return 0L;
}
close(cvs_process->his_read);
cvs_process->his_read = -1;
close(cvs_process->his_write);
cvs_process->his_write = -1;
#else
SECURITY_ATTRIBUTES lsa = { 0 };
STARTUPINFOA si = { 0 };
PROCESS_INFORMATION pi = { 0 };
HANDLE dupIn = 0L, dupOut = 0L;
HANDLE stdChildIn = 0L, stdChildOut = 0L, stdChildErr = 0L;
HANDLE stdoldIn = 0L, stdoldOut = 0L, stdoldErr = 0L;
HANDLE stddupIn = 0L, stddupOut = 0L, stddupErr = 0L;
char* command = 0L;
BOOL resCreate;
int cnt, i;
LPTHREAD_START_ROUTINE threadsFunc[4];
lsa.nLength = sizeof(SECURITY_ATTRIBUTES);
lsa.lpSecurityDescriptor = NULL;
lsa.bInheritHandle = TRUE;
// Create the pipes used for the cvsgui protocol
if( !CreatePipe(&cvs_process->his_read, &dupIn, &lsa, 0) )
goto error;
if( !CreatePipe(&dupOut, &cvs_process->his_write, &lsa, 0) )
goto error;
// Duplicate the application side handles so they lose the inheritance
if( !DuplicateHandle(GetCurrentProcess(), dupIn,
GetCurrentProcess(), &cvs_process->my_write, 0, FALSE, DUPLICATE_SAME_ACCESS) )
{
goto error;
}
CloseHandle(dupIn);
dupIn = 0;
if( !DuplicateHandle(GetCurrentProcess(), dupOut,
GetCurrentProcess(), &cvs_process->my_read, 0, FALSE, DUPLICATE_SAME_ACCESS) )
{
goto error;
}
CloseHandle(dupOut);
dupOut = 0;
if( !startupInfo->hasTty )
{
// redirect stdout, stderr, stdin
if( !CreatePipe(&stdChildIn, &stddupIn, &lsa, 0) )
goto error;
if( !CreatePipe(&stddupOut, &stdChildOut, &lsa, 0) )
goto error;
if( !CreatePipe(&stddupErr, &stdChildErr, &lsa, 0) )
goto error;
// same thing as above
if( !DuplicateHandle(GetCurrentProcess(), stddupIn,
GetCurrentProcess(), &cvs_process->pstdin, 0, FALSE, DUPLICATE_SAME_ACCESS) )
{
goto error;
}
CloseHandle(stddupIn);
stddupIn = 0;
if( !DuplicateHandle(GetCurrentProcess(), stddupOut,
GetCurrentProcess(), &cvs_process->pstdout, 0, FALSE, DUPLICATE_SAME_ACCESS) )
{
goto error;
}
CloseHandle(stddupOut);
stddupOut = 0;
if( !DuplicateHandle(GetCurrentProcess(), stddupErr,
GetCurrentProcess(), &cvs_process->pstderr, 0, FALSE, DUPLICATE_SAME_ACCESS) )
{
goto error;
}
CloseHandle(stddupErr);
stddupErr = 0;
}
// Build the arguments for cvs
sprintf(cvs_process->args[2], "%d", (int)cvs_process->his_read);
sprintf(cvs_process->args[3], "%d", (int)cvs_process->his_write);
command = build_command(cvs_process->argc, cvs_process->args);
if( command == 0L )
goto error;
// Redirect Console StdHandles and set the start options
si.cb = sizeof(STARTUPINFO);
si.dwFlags = startupInfo->hasTty ? 0 : STARTF_USESTDHANDLES;
si.hStdInput = stdChildIn;
si.hStdOutput = stdChildOut;
si.hStdError = stdChildErr;
if( !startupInfo->hasTty )
{
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWMINNOACTIVE;
stdoldIn = GetStdHandle(STD_INPUT_HANDLE);
stdoldOut = GetStdHandle(STD_OUTPUT_HANDLE);
stdoldErr = GetStdHandle(STD_ERROR_HANDLE);
SetStdHandle(STD_INPUT_HANDLE, stdChildIn);
SetStdHandle(STD_OUTPUT_HANDLE, stdChildOut);
SetStdHandle(STD_ERROR_HANDLE, stdChildErr);
}
// Create Child Process
resCreate = CreateProcessA(
NULL,
command,
NULL,
NULL,
TRUE,
NORMAL_PRIORITY_CLASS | CREATE_SUSPENDED,
NULL,
startupInfo->currentDirectory && strlen(startupInfo->currentDirectory) ? startupInfo->currentDirectory : NULL,
&si,
&pi);
if( !startupInfo->hasTty )
{
SetStdHandle(STD_INPUT_HANDLE, stdoldIn);
SetStdHandle(STD_OUTPUT_HANDLE, stdoldOut);
SetStdHandle(STD_ERROR_HANDLE, stdoldErr);
}
if( !resCreate )
goto error;
cvs_process->threadID = pi.dwProcessId;
cvs_process->pid = pi.hProcess;
cnt = 0;
// Create a stop process event
cvs_process->stopProcessEvent = ::CreateEvent(NULL, FALSE, FALSE, NULL);
if( !cvs_process->stopProcessEvent )
{
goto error;
}
// Now open-up threads which will serve the pipes
threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)ServeProtocol;
threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)MonitorChld;
if( !startupInfo->hasTty )
{
threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldOutput;
threadsFunc[cnt++] = (LPTHREAD_START_ROUTINE)GetChldError;
}
for(i = 0; i < cnt; i++)
{
if( (cvs_process->threads[i] = ::CreateThread(
(LPSECURITY_ATTRIBUTES)NULL, // No security attributes.
(DWORD)0, // Use same stack size.
(LPTHREAD_START_ROUTINE)threadsFunc[i], // Thread procedure.
(LPVOID)cvs_process, // Parameter to pass.
(DWORD)0, // Run immediately.
(LPDWORD)&cvs_process->threadsID[i])) == NULL )
{
TerminateProcess(cvs_process->pid, 0);
goto error;
}
}
// Close unnecessary Handles
CloseHandle(cvs_process->his_read);
cvs_process->his_read = 0;
CloseHandle(cvs_process->his_write);
cvs_process->his_write = 0;
if( !startupInfo->hasTty )
{
CloseHandle(stdChildIn);
CloseHandle(stdChildOut);
CloseHandle(stdChildErr);
}
// Resume process execution
ResumeThread(pi.hThread);
CloseHandle(pi.hThread);
// Small tactical delay to reduce problems with process termination
Sleep(100);
free(command);
goto goodboy;
error:
if( cvs_process->his_read != 0L )
CloseHandle(cvs_process->his_read);
if( cvs_process->his_write != 0L )
CloseHandle(cvs_process->his_write);
if( dupIn != 0L )
CloseHandle(dupIn);
if( dupOut != 0L )
CloseHandle(dupOut);
if( cvs_process->my_read != 0L )
CloseHandle(cvs_process->my_read);
if( cvs_process->my_write != 0L )
CloseHandle(cvs_process->my_write);
if( command != 0L )
free(command);
if( stdChildIn != 0L )
CloseHandle(stdChildIn);
if( stdChildOut != 0L )
CloseHandle(stdChildOut);
if( stdChildErr != 0L )
CloseHandle(stdChildErr);
if( stddupIn != 0L )
CloseHandle(stddupIn);
if( stddupOut != 0L )
CloseHandle(stddupOut);
if( stddupErr != 0L )
CloseHandle(stddupErr);
if( cvs_process->pstdin != 0L )
CloseHandle(cvs_process->pstdin);
if( cvs_process->pstdout != 0L )
CloseHandle(cvs_process->pstdout);
if( cvs_process->pstderr != 0L )
CloseHandle(cvs_process->pstderr);
cvs_process_destroy(cvs_process);
return 0L;
goodboy:
#endif
{
CStackThreadLock locker;
open_cvs_process.push_back(cvs_process);
}
cvs_process->open = TRUE;
#ifdef WIN32
cvs_process->starting = FALSE;
#endif
return cvs_process;
}
/*!
Close cvs project
\param cvs_process Cvs process to be closed
\param kill_it Flag indicating whether to kill the process
*/
static void cvs_process_close(CvsProcess* cvs_process, int kill_it)
{
CDestroyThreadLock locker;
if( cvs_process && cvs_process->open )
{
#ifdef WIN32
if( GetCurrentThreadId() != cvs_process->threadsID[0] )
{
// We wait for all the protocol to be over before we close the process and the pipe.
WaitForSingleObject(cvs_process->threads[0], 500);
cvs_process->open = FALSE;
WaitForSingleObject(cvs_process->threads[0], 500);
}
#endif
cvs_process->open = FALSE;
#ifndef WIN32
int status;
/* If necessary, kill the filter. */
if( kill_it && cvs_process->pid )
status = kill(cvs_process->pid, SIGKILL);
/* Wait for the process to exit. This will happen
* immediately if it was just killed.
*/
if( cvs_process->pid )
waitpid(cvs_process->pid, &status, 0);
/* Close the pipes. */
if( cvs_process->my_read )
close(cvs_process->my_read);
if( cvs_process->my_write )
close(cvs_process->my_write);
if( cvs_process->his_read )
close(cvs_process->his_read);
if( cvs_process->his_write )
close(cvs_process->his_write);
#else
cvs_process->starting = TRUE;
if( kill_it && cvs_process->pid )
{
cvs_process_terminate(cvs_process);
}
if( cvs_process->pid )
CloseHandle(cvs_process->pid);
if( cvs_process->my_read )
CloseHandle(cvs_process->my_read);
if( cvs_process->my_write )
CloseHandle(cvs_process->my_write);
if( cvs_process->his_read )
CloseHandle(cvs_process->his_read);
if( cvs_process->his_write )
CloseHandle(cvs_process->his_write);
if( cvs_process->pstdin )
CloseHandle(cvs_process->pstdin);
if( cvs_process->pstdout )
CloseHandle(cvs_process->pstdout);
if( cvs_process->pstderr )
CloseHandle(cvs_process->pstderr);
#endif
wire_clear_error();
/* Set the fields to null values */
cvs_process->pid = 0;
cvs_process->my_read = 0;
cvs_process->my_write = 0;
cvs_process->his_read = 0;
cvs_process->his_write = 0;
cvs_process->pstdin = 0;
cvs_process->pstdout = 0;
cvs_process->pstderr = 0;
{
CStackThreadLock locker;
std::vector<CvsProcess*>::iterator i = std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
if( i != open_cvs_process.end() )
open_cvs_process.erase(i);
}
}
}
/*!
Tells if the process is still alive
\param cvs_process Cvs process to be tested
\return Zero if process not active, non-zero otherwise
*/
int cvs_process_is_active(const CvsProcess* cvs_process)
{
int res;
{
CStackThreadLock locker;
std::vector<CvsProcess*>::iterator i = std::find(open_cvs_process.begin(), open_cvs_process.end(), cvs_process);
res = i != open_cvs_process.end() ? 1 : 0;
}
return res;
}
/*!
Close a process. This kills the process and releases its resources
\param cvs_process Cvs process to be killed
*/
void cvs_process_kill(CvsProcess* cvs_process)
{
if( cvs_process_is_active(cvs_process) )
{
cvs_process_destroy(cvs_process);
}
}
/*!
Stop the process
\param cvs_process Cvs process to be stopped
*/
void cvs_process_stop(CvsProcess* cvs_process)
{
#ifdef WIN32
// On windows we need to kill process "from within" to avoid race condition with MonitorChld thread
SetEvent(cvs_process->stopProcessEvent);
#else
cvs_process_kill(cvs_process);
#endif
}
/*!
Called by the application to answer calls from the process
\return Non-zero if a message from cvs was handled, zero otherwise
*/
int cvs_process_give_time(void)
{
#ifndef WIN32
fd_set rset;
int ready;
int maxfd = 0;
int fd;
struct timeval tv;
int didone = 0;
FD_ZERO(&rset);
std::vector<CvsProcess*>::iterator i;
for(i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
{
fd = (*i)->my_read;
FD_SET(fd, &rset);
if( fd > maxfd )
maxfd = fd;
}
tv.tv_sec = 0;
tv.tv_usec = 10000; // was 100000, but this blocks the interactive dialogs e.g. password dialog
ready = select(maxfd + 1, &rset, 0L, 0L, &tv);
std::vector<CvsProcess*> toFire;
if( ready > 0 )
{
for(i = open_cvs_process.begin(); i != open_cvs_process.end(); ++i)
{
fd = (*i)->my_read;
if( FD_ISSET(fd, &rset) )
toFire.push_back(*i);
}
}
for(i = toFire.begin(); i != toFire.end(); ++i)
{
fd = (*i)->my_read;
if( FD_ISSET(fd, &rset) )
{
cvs_process_recv_message(*i);
didone = 1;
}
}
return didone;
#else
// We don't have to do yield since we use preemptive threads
return 0;
#endif
}
/*!
Receive messages
\param cvs_process Cvs process
*/
static void cvs_process_recv_message(CvsProcess* cvs_process)
{
WireMessage msg;
cvs_process_push(cvs_process);
memset(&msg, 0, sizeof(WireMessage));
if( !wire_read_msg(cvs_process->my_read, &msg) )
{
cvs_process_close(cvs_process, TRUE);
}
else
{
cvs_process_handle_message(&msg);
wire_destroy(&msg);
}
if( cvs_process_is_active(current_cvs_process) )
{
if( !current_cvs_process->open )
{
#ifndef WIN32
cvs_process_destroy(current_cvs_process);
#endif
}
else
cvs_process_pop();
}
}
/*!
Handle message
\param msg Message to be handled
*/
static void cvs_process_handle_message(WireMessage* msg)
{
switch(msg->type)
{
case GP_QUIT:
{
GPT_QUIT* t = (GPT_QUIT*)msg->data;
#ifdef WIN32
// Small delay to work around problems on Win9x (we will have to find the "real" solution in the future though...)
Sleep(100);
#endif
current_cvs_process->callbacks->exit(t->code, current_cvs_process);
cvs_process_close(current_cvs_process, FALSE);
break;
}
case GP_GETENV:
{
GPT_GETENV* t = (GPT_GETENV*)msg->data;
cvs_process_push(current_cvs_process);
gp_getenv_write(current_cvs_process->my_write, current_cvs_process->callbacks->getenv(t->str, current_cvs_process));
cvs_process_pop();
break;
}
case GP_CONSOLE:
{
GPT_CONSOLE* t = (GPT_CONSOLE*)msg->data;
if( t->isStderr )
current_cvs_process->callbacks->consoleerr(t->str, t->len, current_cvs_process);
else
current_cvs_process->callbacks->consoleout(t->str, t->len, current_cvs_process);
break;
}
}
}
/*!
Write data to the cvs process
\param fd Pipe
\param buf Buffer
\param count Buffer size
\return TRUE if written, FALSE otherwise
*/
static int cvs_process_write(pipe_t fd, guint8* buf, gulong count)
{
gulong bytes;
if( current_write_buffer == 0L )
current_write_buffer = process_write_buffer;
while( count > 0 )
{
if( (current_write_buffer_index + count) >= WRITE_BUFFER_SIZE )
{
bytes = WRITE_BUFFER_SIZE - current_write_buffer_index;
memcpy(¤t_write_buffer[current_write_buffer_index], buf, bytes);
current_write_buffer_index += bytes;
if( !wire_flush(fd) )
return FALSE;
}
else
{
bytes = count;
memcpy(¤t_write_buffer[current_write_buffer_index], buf, bytes);
current_write_buffer_index += bytes;
}
buf += bytes;
count -= bytes;
}
return TRUE;
}
/*!
Flush cvs process data
\param fd Pipe
\return TRUE if succesfull, FALSE otherwise
*/
static int cvs_process_flush(pipe_t fd)
{
int count;
int bytes;
if( current_write_buffer_index > 0 )
{
count = 0;
while( count != current_write_buffer_index )
{
do
{
bytes = write(fd, ¤t_write_buffer[count], (current_write_buffer_index - count));
}while( (bytes == -1) && (errno == EAGAIN) );
if( bytes == -1 )
return FALSE;
count += bytes;
}
current_write_buffer_index = 0;
}
return TRUE;
}
/*!
Puts cvs process to the stack
\param cvs_process Cvs process to be put
*/
static void cvs_process_push(CvsProcess* cvs_process)
{
CStackThreadLock locker;
if( cvs_process )
{
current_cvs_process = cvs_process;
cvs_process_stack.push_back(current_cvs_process);
current_write_buffer_index = current_cvs_process->write_buffer_index;
current_write_buffer = current_cvs_process->write_buffer;
}
else
{
current_write_buffer_index = 0;
current_write_buffer = NULL;
}
}
/*!
Take cvs process from the stack
*/
static void cvs_process_pop()
{
CStackThreadLock locker;
if( current_cvs_process )
{
current_cvs_process->write_buffer_index = current_write_buffer_index;
cvs_process_stack.pop_back();
}
if( !cvs_process_stack.empty() )
{
current_cvs_process = cvs_process_stack.back();
current_write_buffer_index = current_cvs_process->write_buffer_index;
current_write_buffer = current_cvs_process->write_buffer;
}
else
{
current_cvs_process = NULL;
current_write_buffer_index = 0;
current_write_buffer = NULL;
}
}
| surfnzdotcom/cvsnt-fork | cvsgui/cvsgui_process.cpp | C++ | gpl-2.0 | 35,733 |
<!-- =========================
SECTION: BRIEF LEFT
============================== -->
<?php
global $wp_customize;
$paralax_one_our_story_image = get_theme_mod('paralax_one_our_story_image', parallax_get_file('/images/about-us.png'));
$parallax_one_our_story_title = get_theme_mod('parallax_one_our_story_title',esc_html__('Our Story','parallax-one'));
$parallax_one_our_story_text = get_theme_mod('parallax_one_our_story_text',esc_html__('Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.','parallax-one'));
if(!empty($paralax_one_our_story_image) || !empty($parallax_one_our_story_title) || !empty($parallax_one_our_story_content)){
?>
<section class="brief text-left brief-design-one brief-left" id="story" role="region" aria-label="<?php esc_html_e('About','parallax-one') ?>">
<div class="section-overlay-layer">
<div class="container">
<div class="row">
<!-- BRIEF IMAGE -->
<?php
if( !empty($paralax_one_our_story_image) ){
if( !empty($parallax_one_our_story_title) ){
echo '<div class="col-md-6 brief-content-two"><div class="brief-image-right"><img src="'.parallax_one_make_protocol_relative_url(esc_url($paralax_one_our_story_image)).'" alt="'.esc_attr($parallax_one_our_story_title).'"></div></div>';
} else {
echo '<div class="col-md-6 brief-content-two"><div class="brief-image-right"><img src="'.parallax_one_make_protocol_relative_url(esc_url($paralax_one_our_story_image)).'" alt="'.esc_html__('About','parallax-one').'"></div></div>';
}
} elseif ( isset( $wp_customize ) ) {
echo '<div class="col-md-6 brief-content-two paralax_one_only_customizer"><img src="" alt=""><div class="brief-image-right"></div></div>';
}
?>
<!-- BRIEF HEADING -->
<div class="col-md-6 content-section brief-content-one">
<?php
if( !empty($parallax_one_our_story_title) ){
echo '<h2 class="text-left dark-text">'.esc_attr($parallax_one_our_story_title).'</h2><div class="colored-line-left"></div>';
} elseif ( isset( $wp_customize ) ) {
echo '<h2 class="text-left dark-text paralax_one_only_customizer"></h2><div class="colored-line-left paralax_one_only_customizer"></div>';
}
?>
<?php
if( !empty($parallax_one_our_story_text) ){
echo '<div class="brief-content-text">'.$parallax_one_our_story_text.'</div>';
} elseif ( isset( $wp_customize ) ) {
echo '<div class="brief-content-text paralax_one_only_customizer"></div>';
}
?>
</div><!-- .brief-content-one-->
</div>
</div>
</div>
</section><!-- .brief-design-one -->
<?php
} else {
if( isset( $wp_customize ) ) {
?>
<section class="brief text-left brief-design-one brief-left paralax_one_only_customizer" id="story" role="region" aria-label="<?php esc_html_e('About','parallax-one') ?>">
<div class="col-md-6 brief-content-two paralax_one_only_customizer"><img src="" alt=""><div class="brief-image-right"></div></div>
<div class="col-md-6 content-section brief-content-one">
<h2 class="text-left dark-text paralax_one_only_customizer"></h2><div class="colored-line-left paralax_one_only_customizer"></div>
<div class="brief-content-text paralax_one_only_customizer"></div>
</div>
</section>
<?php
}
}
?> | vanlight/wp | wp-content/themes/Parallax-One/sections/parallax_one_our_story_section.php | PHP | gpl-2.0 | 3,528 |
/**
* collectd - src/zfs_arc.c
* Copyright (C) 2009 Anthony Dewhurst
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; only version 2 of the License is applicable.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* Anthony Dewhurst <dewhurst at gmail>
**/
#include "collectd.h"
#include "common.h"
#include "plugin.h"
/*
* Global variables
*/
static kstat_t *ksp;
extern kstat_ctl_t *kc;
static void za_submit (const char* type, const char* type_instance, value_t* values, int values_len)
{
value_list_t vl = VALUE_LIST_INIT;
vl.values = values;
vl.values_len = values_len;
sstrncpy (vl.host, hostname_g, sizeof (vl.host));
sstrncpy (vl.plugin, "zfs_arc", sizeof (vl.plugin));
sstrncpy (vl.type, type, sizeof (vl.type));
sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance));
plugin_dispatch_values (&vl);
}
static void za_submit_gauge (const char* type, const char* type_instance, gauge_t value)
{
value_t vv;
vv.gauge = value;
za_submit (type, type_instance, &vv, 1);
}
static void za_submit_derive (const char* type, const char* type_instance, derive_t dv)
{
value_t vv;
vv.derive = dv;
za_submit (type, type_instance, &vv, 1);
}
static void za_submit_ratio (const char* type_instance, gauge_t hits, gauge_t misses)
{
gauge_t ratio = NAN;
if (!isfinite (hits) || (hits < 0.0))
hits = 0.0;
if (!isfinite (misses) || (misses < 0.0))
misses = 0.0;
if ((hits != 0.0) || (misses != 0.0))
ratio = hits / (hits + misses);
za_submit_gauge ("cache_ratio", type_instance, ratio);
}
static int za_read (void)
{
gauge_t arc_size, l2_size;
derive_t demand_data_hits,
demand_metadata_hits,
prefetch_data_hits,
prefetch_metadata_hits,
demand_data_misses,
demand_metadata_misses,
prefetch_data_misses,
prefetch_metadata_misses;
gauge_t arc_hits, arc_misses, l2_hits, l2_misses;
value_t l2_io[2];
get_kstat (&ksp, "zfs", 0, "arcstats");
if (ksp == NULL)
{
ERROR ("zfs_arc plugin: Cannot find zfs:0:arcstats kstat.");
return (-1);
}
/* Sizes */
arc_size = get_kstat_value(ksp, "size");
l2_size = get_kstat_value(ksp, "l2_size");
za_submit_gauge ("cache_size", "arc", arc_size);
za_submit_gauge ("cache_size", "L2", l2_size);
/* Hits / misses */
demand_data_hits = get_kstat_value(ksp, "demand_data_hits");
demand_metadata_hits = get_kstat_value(ksp, "demand_metadata_hits");
prefetch_data_hits = get_kstat_value(ksp, "prefetch_data_hits");
prefetch_metadata_hits = get_kstat_value(ksp, "prefetch_metadata_hits");
demand_data_misses = get_kstat_value(ksp, "demand_data_misses");
demand_metadata_misses = get_kstat_value(ksp, "demand_metadata_misses");
prefetch_data_misses = get_kstat_value(ksp, "prefetch_data_misses");
prefetch_metadata_misses = get_kstat_value(ksp, "prefetch_metadata_misses");
za_submit_derive ("cache_result", "demand_data-hit", demand_data_hits);
za_submit_derive ("cache_result", "demand_metadata-hit", demand_metadata_hits);
za_submit_derive ("cache_result", "prefetch_data-hit", prefetch_data_hits);
za_submit_derive ("cache_result", "prefetch_metadata-hit", prefetch_metadata_hits);
za_submit_derive ("cache_result", "demand_data-miss", demand_data_misses);
za_submit_derive ("cache_result", "demand_metadata-miss", demand_metadata_misses);
za_submit_derive ("cache_result", "prefetch_data-miss", prefetch_data_misses);
za_submit_derive ("cache_result", "prefetch_metadata-miss", prefetch_metadata_misses);
/* Ratios */
arc_hits = (gauge_t) get_kstat_value(ksp, "hits");
arc_misses = (gauge_t) get_kstat_value(ksp, "misses");
l2_hits = (gauge_t) get_kstat_value(ksp, "l2_hits");
l2_misses = (gauge_t) get_kstat_value(ksp, "l2_misses");
za_submit_ratio ("arc", arc_hits, arc_misses);
za_submit_ratio ("L2", l2_hits, l2_misses);
/* I/O */
l2_io[0].derive = get_kstat_value(ksp, "l2_read_bytes");
l2_io[1].derive = get_kstat_value(ksp, "l2_write_bytes");
za_submit ("io_octets", "L2", l2_io, /* num values = */ 2);
return (0);
} /* int za_read */
static int za_init (void) /* {{{ */
{
ksp = NULL;
/* kstats chain already opened by update_kstat (using *kc), verify everything went fine. */
if (kc == NULL)
{
ERROR ("zfs_arc plugin: kstat chain control structure not available.");
return (-1);
}
return (0);
} /* }}} int za_init */
void module_register (void)
{
plugin_register_init ("zfs_arc", za_init);
plugin_register_read ("zfs_arc", za_read);
} /* void module_register */
/* vmi: set sw=8 noexpandtab fdm=marker : */
| ceph/collectd | src/zfs_arc.c | C | gpl-2.0 | 5,108 |
/*
* Copyright (C) 2011-2014 Freescale Semiconductor, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/spinlock.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/gcd.h>
#include <linux/platform_device.h>
#include <linux/regulator/machine.h>
#include <asm/mach-types.h>
#include <video/mxc_hdmi.h>
#include <linux/ipu-v3.h>
#include <video/mxc_edid.h>
#include "../mxc/ipu3/ipu_prv.h"
#include <linux/mfd/mxc-hdmi-core.h>
#include <linux/of_device.h>
#include <linux/mod_devicetable.h>
struct mxc_hdmi_data {
struct platform_device *pdev;
unsigned long __iomem *reg_base;
unsigned long reg_phys_base;
struct device *dev;
};
struct mxc_hdmi_ctsn_t {
int freq;
int n;
int cts;
};
struct mxc_hdmi_ctsn {
int pixclk;
struct mxc_hdmi_ctsn_t ctsn[3];
};
static void __iomem *hdmi_base;
static struct clk *isfr_clk;
static struct clk *iahb_clk;
static struct clk *mipi_core_clk;
static spinlock_t irq_spinlock;
static spinlock_t edid_spinlock;
static unsigned int sample_rate;
static unsigned long pixel_clk_rate;
static struct clk *pixel_clk;
static int hdmi_ratio;
int mxc_hdmi_ipu_id;
int mxc_hdmi_disp_id;
static int hdmi_core_edid_status;
static struct mxc_edid_cfg hdmi_core_edid_cfg;
static int hdmi_core_init;
static unsigned int hdmi_dma_running;
static struct snd_pcm_substream *hdmi_audio_stream_playback;
static unsigned int hdmi_cable_state;
static unsigned int hdmi_blank_state;
static unsigned int hdmi_abort_state;
static spinlock_t hdmi_audio_lock, hdmi_blank_state_lock, hdmi_cable_state_lock;
void hdmi_set_dvi_mode(unsigned int state)
{
if (state) {
mxc_hdmi_abort_stream();
#if defined(CONFIG_MXC_HDMI_CEC) || defined(CONFIG_MXC_HDMI_CEC_V30)
hdmi_cec_stop_device();
} else {
hdmi_cec_start_device();
#endif
}
}
EXPORT_SYMBOL(hdmi_set_dvi_mode);
unsigned int hdmi_set_cable_state(unsigned int state)
{
unsigned long flags;
struct snd_pcm_substream *substream = hdmi_audio_stream_playback;
spin_lock_irqsave(&hdmi_cable_state_lock, flags);
hdmi_cable_state = state;
spin_unlock_irqrestore(&hdmi_cable_state_lock, flags);
if (check_hdmi_state() && substream && hdmi_abort_state) {
hdmi_abort_state = 0;
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START);
}
return 0;
}
EXPORT_SYMBOL(hdmi_set_cable_state);
unsigned int hdmi_set_blank_state(unsigned int state)
{
unsigned long flags;
struct snd_pcm_substream *substream = hdmi_audio_stream_playback;
spin_lock_irqsave(&hdmi_blank_state_lock, flags);
hdmi_blank_state = state;
spin_unlock_irqrestore(&hdmi_blank_state_lock, flags);
if (check_hdmi_state() && substream && hdmi_abort_state) {
hdmi_abort_state = 0;
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_START);
}
return 0;
}
EXPORT_SYMBOL(hdmi_set_blank_state);
static void hdmi_audio_abort_stream(struct snd_pcm_substream *substream)
{
unsigned long flags;
snd_pcm_stream_lock_irqsave(substream, flags);
if (snd_pcm_running(substream)) {
hdmi_abort_state = 1;
substream->ops->trigger(substream, SNDRV_PCM_TRIGGER_STOP);
}
snd_pcm_stream_unlock_irqrestore(substream, flags);
}
int mxc_hdmi_abort_stream(void)
{
unsigned long flags;
spin_lock_irqsave(&hdmi_audio_lock, flags);
if (hdmi_audio_stream_playback)
hdmi_audio_abort_stream(hdmi_audio_stream_playback);
spin_unlock_irqrestore(&hdmi_audio_lock, flags);
return 0;
}
EXPORT_SYMBOL(mxc_hdmi_abort_stream);
int check_hdmi_state(void)
{
unsigned long flags1, flags2;
unsigned int ret;
spin_lock_irqsave(&hdmi_cable_state_lock, flags1);
spin_lock_irqsave(&hdmi_blank_state_lock, flags2);
ret = hdmi_cable_state && hdmi_blank_state;
spin_unlock_irqrestore(&hdmi_blank_state_lock, flags2);
spin_unlock_irqrestore(&hdmi_cable_state_lock, flags1);
return ret;
}
EXPORT_SYMBOL(check_hdmi_state);
int mxc_hdmi_register_audio(struct snd_pcm_substream *substream)
{
unsigned long flags, flags1;
int ret = 0;
snd_pcm_stream_lock_irqsave(substream, flags);
if (substream && check_hdmi_state()) {
spin_lock_irqsave(&hdmi_audio_lock, flags1);
if (hdmi_audio_stream_playback) {
pr_err("%s unconsist hdmi auido stream!\n", __func__);
ret = -EINVAL;
}
hdmi_audio_stream_playback = substream;
hdmi_abort_state = 0;
spin_unlock_irqrestore(&hdmi_audio_lock, flags1);
} else
ret = -EINVAL;
snd_pcm_stream_unlock_irqrestore(substream, flags);
return ret;
}
EXPORT_SYMBOL(mxc_hdmi_register_audio);
void mxc_hdmi_unregister_audio(struct snd_pcm_substream *substream)
{
unsigned long flags;
spin_lock_irqsave(&hdmi_audio_lock, flags);
hdmi_audio_stream_playback = NULL;
hdmi_abort_state = 0;
spin_unlock_irqrestore(&hdmi_audio_lock, flags);
}
EXPORT_SYMBOL(mxc_hdmi_unregister_audio);
u8 hdmi_readb(unsigned int reg)
{
u8 value;
value = __raw_readb(hdmi_base + reg);
return value;
}
EXPORT_SYMBOL(hdmi_readb);
#ifdef DEBUG
static bool overflow_lo;
static bool overflow_hi;
bool hdmi_check_overflow(void)
{
u8 val, lo, hi;
val = hdmi_readb(HDMI_IH_FC_STAT2);
lo = (val & HDMI_IH_FC_STAT2_LOW_PRIORITY_OVERFLOW) != 0;
hi = (val & HDMI_IH_FC_STAT2_HIGH_PRIORITY_OVERFLOW) != 0;
if ((lo != overflow_lo) || (hi != overflow_hi)) {
pr_debug("%s LowPriority=%d HighPriority=%d <=======================\n",
__func__, lo, hi);
overflow_lo = lo;
overflow_hi = hi;
return true;
}
return false;
}
#else
bool hdmi_check_overflow(void)
{
return false;
}
#endif
EXPORT_SYMBOL(hdmi_check_overflow);
void hdmi_writeb(u8 value, unsigned int reg)
{
hdmi_check_overflow();
__raw_writeb(value, hdmi_base + reg);
hdmi_check_overflow();
}
EXPORT_SYMBOL(hdmi_writeb);
void hdmi_mask_writeb(u8 data, unsigned int reg, u8 shift, u8 mask)
{
u8 value = hdmi_readb(reg) & ~mask;
value |= (data << shift) & mask;
hdmi_writeb(value, reg);
}
EXPORT_SYMBOL(hdmi_mask_writeb);
unsigned int hdmi_read4(unsigned int reg)
{
/* read a four byte address from registers */
return (hdmi_readb(reg + 3) << 24) |
(hdmi_readb(reg + 2) << 16) |
(hdmi_readb(reg + 1) << 8) |
hdmi_readb(reg);
}
EXPORT_SYMBOL(hdmi_read4);
void hdmi_write4(unsigned int value, unsigned int reg)
{
/* write a four byte address to hdmi regs */
hdmi_writeb(value & 0xff, reg);
hdmi_writeb((value >> 8) & 0xff, reg + 1);
hdmi_writeb((value >> 16) & 0xff, reg + 2);
hdmi_writeb((value >> 24) & 0xff, reg + 3);
}
EXPORT_SYMBOL(hdmi_write4);
static void initialize_hdmi_ih_mutes(void)
{
u8 ih_mute;
/*
* Boot up defaults are:
* HDMI_IH_MUTE = 0x03 (disabled)
* HDMI_IH_MUTE_* = 0x00 (enabled)
*/
/* Disable top level interrupt bits in HDMI block */
ih_mute = hdmi_readb(HDMI_IH_MUTE) |
HDMI_IH_MUTE_MUTE_WAKEUP_INTERRUPT |
HDMI_IH_MUTE_MUTE_ALL_INTERRUPT;
hdmi_writeb(ih_mute, HDMI_IH_MUTE);
/* by default mask all interrupts */
hdmi_writeb(0xff, HDMI_VP_MASK);
hdmi_writeb(0xff, HDMI_FC_MASK0);
hdmi_writeb(0xff, HDMI_FC_MASK1);
hdmi_writeb(0xff, HDMI_FC_MASK2);
hdmi_writeb(0xff, HDMI_PHY_MASK0);
hdmi_writeb(0xff, HDMI_PHY_I2CM_INT_ADDR);
hdmi_writeb(0xff, HDMI_PHY_I2CM_CTLINT_ADDR);
hdmi_writeb(0xff, HDMI_AUD_INT);
hdmi_writeb(0xff, HDMI_AUD_SPDIFINT);
hdmi_writeb(0xff, HDMI_AUD_HBR_MASK);
hdmi_writeb(0xff, HDMI_GP_MASK);
hdmi_writeb(0xff, HDMI_A_APIINTMSK);
hdmi_writeb(0xff, HDMI_CEC_MASK);
hdmi_writeb(0xff, HDMI_I2CM_INT);
hdmi_writeb(0xff, HDMI_I2CM_CTLINT);
/* Disable interrupts in the IH_MUTE_* registers */
hdmi_writeb(0xff, HDMI_IH_MUTE_FC_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_FC_STAT1);
hdmi_writeb(0xff, HDMI_IH_MUTE_FC_STAT2);
hdmi_writeb(0xff, HDMI_IH_MUTE_AS_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_PHY_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_I2CM_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_CEC_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_VP_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_I2CMPHY_STAT0);
hdmi_writeb(0xff, HDMI_IH_MUTE_AHBDMAAUD_STAT0);
/* Enable top level interrupt bits in HDMI block */
ih_mute &= ~(HDMI_IH_MUTE_MUTE_WAKEUP_INTERRUPT |
HDMI_IH_MUTE_MUTE_ALL_INTERRUPT);
hdmi_writeb(ih_mute, HDMI_IH_MUTE);
}
static void hdmi_set_clock_regenerator_n(unsigned int value)
{
u8 val;
if (!hdmi_dma_running) {
hdmi_writeb(value & 0xff, HDMI_AUD_N1);
hdmi_writeb(0, HDMI_AUD_N2);
hdmi_writeb(0, HDMI_AUD_N3);
}
hdmi_writeb(value & 0xff, HDMI_AUD_N1);
hdmi_writeb((value >> 8) & 0xff, HDMI_AUD_N2);
hdmi_writeb((value >> 16) & 0x0f, HDMI_AUD_N3);
/* nshift factor = 0 */
val = hdmi_readb(HDMI_AUD_CTS3);
val &= ~HDMI_AUD_CTS3_N_SHIFT_MASK;
hdmi_writeb(val, HDMI_AUD_CTS3);
}
static void hdmi_set_clock_regenerator_cts(unsigned int cts)
{
u8 val;
if (!hdmi_dma_running) {
hdmi_writeb(cts & 0xff, HDMI_AUD_CTS1);
hdmi_writeb(0, HDMI_AUD_CTS2);
hdmi_writeb(0, HDMI_AUD_CTS3);
}
/* Must be set/cleared first */
val = hdmi_readb(HDMI_AUD_CTS3);
val &= ~HDMI_AUD_CTS3_CTS_MANUAL;
hdmi_writeb(val, HDMI_AUD_CTS3);
hdmi_writeb(cts & 0xff, HDMI_AUD_CTS1);
hdmi_writeb((cts >> 8) & 0xff, HDMI_AUD_CTS2);
hdmi_writeb(((cts >> 16) & HDMI_AUD_CTS3_AUDCTS19_16_MASK) |
HDMI_AUD_CTS3_CTS_MANUAL, HDMI_AUD_CTS3);
}
static const struct mxc_hdmi_ctsn mxc_hdmi_ctsn_tbl[] = {
/* 32kHz 44.1kHz 48kHz */
/* Clock N CTS N CTS N CTS */
{ 25175, { { 32000, 4096, 25175 }, { 44100, 28224, 125875 }, { 48000, 6144, 25175 } } }, /* 25,20/1.001 MHz */
{ 25200, { { 32000, 4096, 25200 }, { 44100, 6272, 28000 }, { 48000, 6144, 25200 } } }, /* 25.20 MHz */
{ 27000, { { 32000, 4096, 27000 }, { 44100, 6272, 30000 }, { 48000, 6144, 27000 } } }, /* 27.00 MHz */
{ 27027, { { 32000, 4096, 27027 }, { 44100, 6272, 30030 }, { 48000, 6144, 27027 } } }, /* 27.00*1.001 MHz */
{ 54000, { { 32000, 4096, 54000 }, { 44100, 6272, 60000 }, { 48000, 6144, 54000 } } }, /* 54.00 MHz */
{ 54054, { { 32000, 4096, 54054 }, { 44100, 6272, 60060 }, { 48000, 6144, 54054 } } }, /* 54.00*1.001 MHz */
{ 74176, { { 32000, 4096, 74176 }, { 44100, 5733, 75335 }, { 48000, 6144, 74176 } } }, /* 74.25/1.001 MHz */
{ 74250, { { 32000, 4096, 74250 }, { 44100, 6272, 82500 }, { 48000, 6144, 74250 } } }, /* 74.25 MHz */
{148352, { { 32000, 4096, 148352 }, { 44100, 5733, 150670 }, { 48000, 6144, 148352 } } }, /* 148.50/1.001 MHz */
{148500, { { 32000, 4096, 148500 }, { 44100, 6272, 165000 }, { 48000, 6144, 148500 } } }, /* 148.50 MHz */
};
static bool hdmi_compute_cts_n(unsigned int freq, unsigned long pixel_clk,
unsigned int *N, unsigned int *CTS)
{
int n, cts;
unsigned long div, mul;
/* Safe, but overly large values */
n = 128 * freq;
cts = pixel_clk;
/* Smallest valid fraction */
div = gcd(n, cts);
n /= div;
cts /= div;
/*
* The optimal N is 128*freq/1000. Calculate the closest larger
* value that doesn't truncate any bits.
*/
mul = ((128*freq/1000) + (n-1))/n;
n *= mul;
cts *= mul;
/* Check that we are in spec (not always possible) */
if (n < (128*freq/1500)) {
pr_warn("%s: calculated ACR N value is too small. Audio will be disabled.\n", __func__);
return false;
}
if (n > (128*freq/300)) {
pr_warn("%s: calculated ACR N value is too large. Audio will be disabled.\n", __func__);
return false;
}
*N = n;
*CTS = cts;
return true;
}
static void hdmi_lookup_cts_n(unsigned int freq, unsigned long pixel_clk,
unsigned int *n, unsigned int *cts)
{
unsigned int clk = pixel_clk / 1000;
unsigned int frq = freq;
int i, j;
*n = 1;
switch (frq) {
case 88200:
frq = 44100;
*n = 2;
break;
case 96000:
frq = 48000;
*n = 2;
break;
case 176400:
frq = 44100;
*n = 4;
break;
case 192000:
frq = 48000;
*n = 4;
break;
default:
break;
}
for (i = 0; i < ARRAY_SIZE(mxc_hdmi_ctsn_tbl); i++) {
if (mxc_hdmi_ctsn_tbl[i].pixclk == clk) {
for (j = 0; j < 3; j++) {
if (mxc_hdmi_ctsn_tbl[i].ctsn[j].freq == frq) {
*n *= mxc_hdmi_ctsn_tbl[i].ctsn[j].n;
*cts = mxc_hdmi_ctsn_tbl[i].ctsn[j].cts;
return;
}
}
}
}
}
static void hdmi_set_clk_regenerator(void)
{
unsigned int clk_n, clk_cts = 0;
hdmi_lookup_cts_n(sample_rate, pixel_clk_rate, &clk_n, &clk_cts);
if (clk_cts == 0 && hdmi_compute_cts_n(sample_rate, pixel_clk_rate, &clk_n, &clk_cts))
pr_debug("%s: pixel clock not supported - using fallback calculation.\n", __func__);
else if (clk_cts == 0) {
mxc_hdmi_abort_stream();
return;
}
if (hdmi_ratio != 100)
clk_cts = (clk_cts * hdmi_ratio) / 100;
pr_debug("%s: samplerate=%d ratio=%d pixelclk=%d N=%d cts=%d\n",
__func__, sample_rate, hdmi_ratio, (int)pixel_clk_rate,
clk_n, clk_cts);
hdmi_set_clock_regenerator_cts(clk_cts);
hdmi_set_clock_regenerator_n(clk_n);
}
static int hdmi_core_get_of_property(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
int err;
int ipu_id, disp_id;
err = of_property_read_u32(np, "ipu_id", &ipu_id);
if (err) {
dev_dbg(&pdev->dev, "get of property ipu_id fail\n");
return err;
}
err = of_property_read_u32(np, "disp_id", &disp_id);
if (err) {
dev_dbg(&pdev->dev, "get of property disp_id fail\n");
return err;
}
mxc_hdmi_ipu_id = ipu_id;
mxc_hdmi_disp_id = disp_id;
return err;
}
/* Need to run this before phy is enabled the first time to prevent
* overflow condition in HDMI_IH_FC_STAT2 */
void hdmi_init_clk_regenerator(void)
{
if (pixel_clk_rate == 0) {
pixel_clk_rate = 74250000;
hdmi_set_clk_regenerator();
}
}
EXPORT_SYMBOL(hdmi_init_clk_regenerator);
void hdmi_clk_regenerator_update_pixel_clock(u32 pixclock, u32 vmode)
{
/* Translate pixel clock in ps (pico seconds) to Hz */
pixel_clk_rate = mxcPICOS2KHZ(pixclock, vmode) * 1000UL;
hdmi_set_clk_regenerator();
}
EXPORT_SYMBOL(hdmi_clk_regenerator_update_pixel_clock);
void hdmi_set_dma_mode(unsigned int dma_running)
{
hdmi_dma_running = dma_running;
hdmi_set_clk_regenerator();
}
EXPORT_SYMBOL(hdmi_set_dma_mode);
void hdmi_set_sample_rate(unsigned int rate)
{
sample_rate = rate;
}
EXPORT_SYMBOL(hdmi_set_sample_rate);
void hdmi_set_edid_cfg(int edid_status, struct mxc_edid_cfg *cfg)
{
unsigned long flags;
spin_lock_irqsave(&edid_spinlock, flags);
hdmi_core_edid_status = edid_status;
memcpy(&hdmi_core_edid_cfg, cfg, sizeof(struct mxc_edid_cfg));
spin_unlock_irqrestore(&edid_spinlock, flags);
}
EXPORT_SYMBOL(hdmi_set_edid_cfg);
int hdmi_get_edid_cfg(struct mxc_edid_cfg *cfg)
{
unsigned long flags;
spin_lock_irqsave(&edid_spinlock, flags);
memcpy(cfg, &hdmi_core_edid_cfg, sizeof(struct mxc_edid_cfg));
spin_unlock_irqrestore(&edid_spinlock, flags);
return hdmi_core_edid_status;
}
EXPORT_SYMBOL(hdmi_get_edid_cfg);
void hdmi_set_registered(int registered)
{
hdmi_core_init = registered;
}
EXPORT_SYMBOL(hdmi_set_registered);
int hdmi_get_registered(void)
{
return hdmi_core_init;
}
EXPORT_SYMBOL(hdmi_get_registered);
static int mxc_hdmi_core_probe(struct platform_device *pdev)
{
struct mxc_hdmi_data *hdmi_data;
struct resource *res;
unsigned long flags;
int ret = 0;
#ifdef DEBUG
overflow_lo = false;
overflow_hi = false;
#endif
hdmi_core_init = 0;
hdmi_dma_running = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENOENT;
ret = hdmi_core_get_of_property(pdev);
if (ret < 0) {
dev_err(&pdev->dev, "get hdmi of property fail\n");
return -ENOENT;
}
hdmi_data = devm_kzalloc(&pdev->dev, sizeof(struct mxc_hdmi_data), GFP_KERNEL);
if (!hdmi_data) {
dev_err(&pdev->dev, "Couldn't allocate mxc hdmi mfd device\n");
return -ENOMEM;
}
hdmi_data->pdev = pdev;
pixel_clk = NULL;
sample_rate = 48000;
pixel_clk_rate = 0;
hdmi_ratio = 100;
spin_lock_init(&irq_spinlock);
spin_lock_init(&edid_spinlock);
spin_lock_init(&hdmi_cable_state_lock);
spin_lock_init(&hdmi_blank_state_lock);
spin_lock_init(&hdmi_audio_lock);
spin_lock_irqsave(&hdmi_cable_state_lock, flags);
hdmi_cable_state = 0;
spin_unlock_irqrestore(&hdmi_cable_state_lock, flags);
spin_lock_irqsave(&hdmi_blank_state_lock, flags);
hdmi_blank_state = 0;
spin_unlock_irqrestore(&hdmi_blank_state_lock, flags);
spin_lock_irqsave(&hdmi_audio_lock, flags);
hdmi_audio_stream_playback = NULL;
hdmi_abort_state = 0;
spin_unlock_irqrestore(&hdmi_audio_lock, flags);
mipi_core_clk = clk_get(&hdmi_data->pdev->dev, "mipi_core");
if (IS_ERR(mipi_core_clk)) {
ret = PTR_ERR(mipi_core_clk);
dev_err(&hdmi_data->pdev->dev,
"Unable to get mipi core clk: %d\n", ret);
goto eclkg;
}
ret = clk_prepare_enable(mipi_core_clk);
if (ret < 0) {
dev_err(&pdev->dev, "Cannot enable mipi core clock: %d\n", ret);
goto eclke;
}
isfr_clk = clk_get(&hdmi_data->pdev->dev, "hdmi_isfr");
if (IS_ERR(isfr_clk)) {
ret = PTR_ERR(isfr_clk);
dev_err(&hdmi_data->pdev->dev,
"Unable to get HDMI isfr clk: %d\n", ret);
goto eclkg1;
}
ret = clk_prepare_enable(isfr_clk);
if (ret < 0) {
dev_err(&pdev->dev, "Cannot enable HDMI clock: %d\n", ret);
goto eclke1;
}
pr_debug("%s isfr_clk:%d\n", __func__,
(int)clk_get_rate(isfr_clk));
iahb_clk = clk_get(&hdmi_data->pdev->dev, "hdmi_iahb");
if (IS_ERR(iahb_clk)) {
ret = PTR_ERR(iahb_clk);
dev_err(&hdmi_data->pdev->dev,
"Unable to get HDMI iahb clk: %d\n", ret);
goto eclkg2;
}
ret = clk_prepare_enable(iahb_clk);
if (ret < 0) {
dev_err(&pdev->dev, "Cannot enable HDMI clock: %d\n", ret);
goto eclke2;
}
hdmi_data->reg_phys_base = res->start;
if (!request_mem_region(res->start, resource_size(res),
dev_name(&pdev->dev))) {
dev_err(&pdev->dev, "request_mem_region failed\n");
ret = -EBUSY;
goto emem;
}
hdmi_data->reg_base = ioremap(res->start, resource_size(res));
if (!hdmi_data->reg_base) {
dev_err(&pdev->dev, "ioremap failed\n");
ret = -ENOMEM;
goto eirq;
}
hdmi_base = hdmi_data->reg_base;
pr_debug("\n%s hdmi hw base = 0x%08x\n\n", __func__, (int)res->start);
initialize_hdmi_ih_mutes();
/* Disable HDMI clocks until video/audio sub-drivers are initialized */
clk_disable_unprepare(isfr_clk);
clk_disable_unprepare(iahb_clk);
clk_disable_unprepare(mipi_core_clk);
/* Replace platform data coming in with a local struct */
platform_set_drvdata(pdev, hdmi_data);
return ret;
eirq:
release_mem_region(res->start, resource_size(res));
emem:
clk_disable_unprepare(iahb_clk);
eclke2:
clk_put(iahb_clk);
eclkg2:
clk_disable_unprepare(isfr_clk);
eclke1:
clk_put(isfr_clk);
eclkg1:
clk_disable_unprepare(mipi_core_clk);
eclke:
clk_put(mipi_core_clk);
eclkg:
return ret;
}
static int __exit mxc_hdmi_core_remove(struct platform_device *pdev)
{
struct mxc_hdmi_data *hdmi_data = platform_get_drvdata(pdev);
struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
iounmap(hdmi_data->reg_base);
release_mem_region(res->start, resource_size(res));
return 0;
}
static const struct of_device_id imx_hdmi_dt_ids[] = {
{ .compatible = "fsl,imx6q-hdmi-core", },
{ .compatible = "fsl,imx6dl-hdmi-core", },
{ /* sentinel */ }
};
static struct platform_driver mxc_hdmi_core_driver = {
.driver = {
.name = "mxc_hdmi_core",
.of_match_table = imx_hdmi_dt_ids,
.owner = THIS_MODULE,
},
.remove = __exit_p(mxc_hdmi_core_remove),
};
static int __init mxc_hdmi_core_init(void)
{
return platform_driver_probe(&mxc_hdmi_core_driver,
mxc_hdmi_core_probe);
}
static void __exit mxc_hdmi_core_exit(void)
{
platform_driver_unregister(&mxc_hdmi_core_driver);
}
subsys_initcall(mxc_hdmi_core_init);
module_exit(mxc_hdmi_core_exit);
MODULE_DESCRIPTION("Core driver for Freescale i.Mx on-chip HDMI");
MODULE_AUTHOR("Freescale Semiconductor, Inc.");
MODULE_LICENSE("GPL");
| rdm-dev/linux-curie | drivers/mfd/mxc-hdmi-core.c | C | gpl-2.0 | 20,423 |
<?php
global $em_vocations;
$em_vocations = array();
$em_vocations['500'] = '»¥ÁªÍø';
$em_vocations['501'] = 'ÍøÕ¾ÖÆ×÷';
$em_vocations['501.001'] = 'ÆóÒµÍøÕ¾';
$em_vocations['501.002'] = 'ÃÅ»§¿ª·¢';
$em_vocations['501.003'] = 'ÉÌÒµÍøÕ¾';
$em_vocations['501.004'] = '¸öÈ˲©¿Í';
$em_vocations['502'] = 'ÐéÐÄ';
$em_vocations['502.001'] = 'ËÉËÉɢɢ';
$em_vocations['502.002'] = '²âÊÔ·ÖÀà';
$em_vocations['502.003'] = 'ddddd';
$em_vocations['502.004'] = 'ѧϰÏÂ';
$em_vocations['503'] = 'cmsÖÆ×÷';
$em_vocations['503.001'] = 'Ä£°åÖÆ×÷';
$em_vocations['503.002'] = 'Ä£¿é¿ª·¢';
$em_vocations['1000'] = '»úе';
$em_vocations['1001'] = 'ũҵ»úе';
$em_vocations['1001.001'] = '×Ô¶¯ÊÕ¸î»ú';
$em_vocations['1001.002'] = 'ÔËÊä»ú';
$em_vocations['1002'] = '»ú´²';
$em_vocations['1002.001'] = 'ËÜÁÏÇиî»ú';
$em_vocations['1002.002'] = '´òÄ¥»ú';
$em_vocations['1002.003'] = 'Ë®»õ»úÆ÷';
$em_vocations['1003'] = '·ÄÖ¯É豸ºÍÆ÷²Ä';
$em_vocations['1004'] = '·ç»ú/ÅÅ·çÉ豸';
$em_vocations['1500'] = '»¯¹¤';
$em_vocations['1501'] = 'ËÜÁÏ»¯¹¤';
$em_vocations['1501.001'] = '¼Ó¹¤';
$em_vocations['1501.002'] = 'Éú²ú';
$em_vocations['1501.003'] = 'ÎïÁ÷';
$em_vocations['2000'] = '°¤Ìß¹¤×÷Õß';
$em_vocations['2001'] = '³ÌÐòÔ±';
$em_vocations['2002'] = 'ÃÀ¹¤Éè¼Æ';
$em_vocations['2002.001'] = 'ÅäÉ«';
$em_vocations['2002.002'] = 'ÃÀѧÉè¼Æ';
$em_vocations['2003'] = 'ǰ¶Ë¿ª·¢';
?> | bylu/Test | wulu/2015.11.23/qipai/data/enums/vocation.php | PHP | gpl-2.0 | 1,390 |
/************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
*
* Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved.
*
* Use is subject to license terms.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0. You can also
* obtain a copy of the License at http://odftoolkit.org/docs/license.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
* See the License for the specific language governing permissions and
* limitations under the License.
*
************************************************************************/
/*
* This file is automatically generated.
* Don't edit manually.
*/
package org.odftoolkit.odfdom.dom.element.db;
import org.odftoolkit.odfdom.pkg.OdfElement;
import org.odftoolkit.odfdom.pkg.ElementVisitor;
import org.odftoolkit.odfdom.pkg.OdfFileDom;
import org.odftoolkit.odfdom.pkg.OdfName;
import org.odftoolkit.odfdom.dom.OdfDocumentNamespace;
import org.odftoolkit.odfdom.dom.DefaultElementVisitor;
/**
* DOM implementation of OpenDocument element {@odf.element db:queries}.
*
*/
public class DbQueriesElement extends OdfElement {
public static final OdfName ELEMENT_NAME = OdfName.newName(OdfDocumentNamespace.DB, "queries");
/**
* Create the instance of <code>DbQueriesElement</code>
*
* @param ownerDoc The type is <code>OdfFileDom</code>
*/
public DbQueriesElement(OdfFileDom ownerDoc) {
super(ownerDoc, ELEMENT_NAME);
}
/**
* Get the element name
*
* @return return <code>OdfName</code> the name of element {@odf.element db:queries}.
*/
public OdfName getOdfName() {
return ELEMENT_NAME;
}
/**
* Create child element {@odf.element db:query}.
*
* @param dbCommandValue the <code>String</code> value of <code>DbCommandAttribute</code>, see {@odf.attribute db:command} at specification
* @param dbNameValue the <code>String</code> value of <code>DbNameAttribute</code>, see {@odf.attribute db:name} at specification
* Child element is new in Odf 1.2
*
* @return the element {@odf.element db:query}
*/
public DbQueryElement newDbQueryElement(String dbCommandValue, String dbNameValue) {
DbQueryElement dbQuery = ((OdfFileDom) this.ownerDocument).newOdfElement(DbQueryElement.class);
dbQuery.setDbCommandAttribute(dbCommandValue);
dbQuery.setDbNameAttribute(dbNameValue);
this.appendChild(dbQuery);
return dbQuery;
}
/**
* Create child element {@odf.element db:query-collection}.
*
* @param dbNameValue the <code>String</code> value of <code>DbNameAttribute</code>, see {@odf.attribute db:name} at specification
* Child element is new in Odf 1.2
*
* @return the element {@odf.element db:query-collection}
*/
public DbQueryCollectionElement newDbQueryCollectionElement(String dbNameValue) {
DbQueryCollectionElement dbQueryCollection = ((OdfFileDom) this.ownerDocument).newOdfElement(DbQueryCollectionElement.class);
dbQueryCollection.setDbNameAttribute(dbNameValue);
this.appendChild(dbQueryCollection);
return dbQueryCollection;
}
@Override
public void accept(ElementVisitor visitor) {
if (visitor instanceof DefaultElementVisitor) {
DefaultElementVisitor defaultVisitor = (DefaultElementVisitor) visitor;
defaultVisitor.visit(this);
} else {
visitor.visit(this);
}
}
}
| jbjonesjr/geoproponis | external/odfdom-java-0.8.10-incubating-sources/org/odftoolkit/odfdom/dom/element/db/DbQueriesElement.java | Java | gpl-2.0 | 3,685 |
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fr">
<context>
<name>AboutDlg</name>
<message>
<location filename="../gui/about.ui" line="21"/>
<source>About qBittorrent</source>
<translation>À propos de qBittorrent</translation>
</message>
<message>
<location filename="../gui/about.ui" line="83"/>
<source>About</source>
<translation>À propos</translation>
</message>
<message>
<location filename="../gui/about.ui" line="128"/>
<source>Author</source>
<translation>Auteur</translation>
</message>
<message>
<location filename="../gui/about.ui" line="216"/>
<location filename="../gui/about.ui" line="293"/>
<source>Name:</source>
<translation>Nom :</translation>
</message>
<message>
<location filename="../gui/about.ui" line="240"/>
<location filename="../gui/about.ui" line="281"/>
<source>Country:</source>
<translation>Pays :</translation>
</message>
<message>
<location filename="../gui/about.ui" line="228"/>
<location filename="../gui/about.ui" line="312"/>
<source>E-mail:</source>
<translation>Courriel :</translation>
</message>
<message>
<location filename="../gui/about.ui" line="262"/>
<source>Greece</source>
<translation>Grèce</translation>
</message>
<message>
<location filename="../gui/about.ui" line="341"/>
<source>Current maintainer</source>
<translation>Mainteneur actuel</translation>
</message>
<message>
<location filename="../gui/about.ui" line="354"/>
<source>Original author</source>
<translation>Auteur original</translation>
</message>
<message>
<location filename="../gui/about.ui" line="412"/>
<source>Libraries</source>
<translation>Bibliothèques</translation>
</message>
<message>
<location filename="../gui/about.ui" line="424"/>
<source>This version of qBittorrent was built against the following libraries:</source>
<translation>Cette version de qBittorrent utilise les bibliothèques suivantes :</translation>
</message>
<message>
<location filename="../gui/about.ui" line="184"/>
<source>France</source>
<translation>France</translation>
</message>
<message>
<location filename="../gui/about.ui" line="382"/>
<source>Translation</source>
<translation>Traduction</translation>
</message>
<message>
<location filename="../gui/about.ui" line="399"/>
<source>License</source>
<translation>Licence</translation>
</message>
<message>
<location filename="../gui/about.ui" line="365"/>
<source>Thanks to</source>
<translation>Remerciements</translation>
</message>
</context>
<context>
<name>AddNewTorrentDialog</name>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="29"/>
<source>Save as</source>
<translation>Enregistrer sous</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="53"/>
<source>Browse...</source>
<translation>Parcourir...</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="62"/>
<source>Set as default save path</source>
<translation>Utiliser comme dossier de sauvegarde par défaut</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="72"/>
<source>Never show again</source>
<translation>Ne plus afficher</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="89"/>
<source>Torrent settings</source>
<translation>Paramètres du torrent</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="95"/>
<source>Start torrent</source>
<translation>Démarrer le torrent</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="107"/>
<source>Label:</source>
<translation>Catégorie :</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="126"/>
<source>Skip hash check</source>
<translation>Ne pas vérifier les données du torrent</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="136"/>
<source>Torrent Information</source>
<translation>Informations sur le torrent</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="144"/>
<source>Size:</source>
<translation>Taille :</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="158"/>
<source>Comment:</source>
<translation>Commentaire :</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="184"/>
<source>Date:</source>
<translation>Date :</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="198"/>
<source>Info Hash:</source>
<translation>Info hachage :</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="289"/>
<source>Normal</source>
<translation>Normale</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="294"/>
<source>High</source>
<translation>Haute</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="299"/>
<source>Maximum</source>
<translation>Maximale</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.ui" line="304"/>
<source>Do not download</source>
<translation>Ne pas télécharger</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="165"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="636"/>
<source>I/O Error</source>
<translation>Erreur E/S</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="165"/>
<source>The torrent file does not exist.</source>
<translation>Le fichier torrent n'existe pas.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="173"/>
<source>Invalid torrent</source>
<translation>Torrent invalide</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="173"/>
<source>Failed to load the torrent: %1</source>
<translation>Impossible de charger le torrent : %1</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="185"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="213"/>
<source>Already in download list</source>
<translation>Déjà présent dans la liste des téléchargements</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="333"/>
<source>Free disk space: %1</source>
<translation>Espace disque libre : %1</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="662"/>
<source>Not Available</source>
<comment>This comment is unavailable</comment>
<translation>Non disponible</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="663"/>
<source>Not Available</source>
<comment>This date is unavailable</comment>
<translation>Non disponible</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="671"/>
<source>Not available</source>
<translation>Non disponible</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="202"/>
<source>Invalid magnet link</source>
<translation>Lien magnet invalide</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="185"/>
<source>Torrent is already in download list. Trackers were merged.</source>
<translation>Impossible d'ajouter le torrent</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="188"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="216"/>
<source>Cannot add torrent</source>
<translation>Impossible d'ajouter le torrent</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="188"/>
<source>Cannot add this torrent. Perhaps it is already in adding state.</source>
<translation>Impossible d'ajouter ce torrent. Peut-être est-il déjà en cours d'ajout.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="202"/>
<source>This magnet link was not recognized</source>
<translation>Ce lien magnet n'a pas été reconnu</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="213"/>
<source>Magnet link is already in download list. Trackers were merged.</source>
<translation>Le lien magnet est déjà dans la liste des téléchargements. Les trackers ont été fusionnés.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="216"/>
<source>Cannot add this torrent. Perhaps it is already in adding.</source>
<translation>Impossible d'ajouter ce torrent. Peut-être est-il déjà en cours d'ajout.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="225"/>
<source>Magnet link</source>
<translation>Lien magnet</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="232"/>
<source>Retrieving metadata...</source>
<translation>Récupération des métadonnées…</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="331"/>
<source>Not Available</source>
<comment>This size is unavailable.</comment>
<translation>Non disponible</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="362"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="370"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="372"/>
<source>Choose save path</source>
<translation>Choisir un répertoire de destination</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="421"/>
<source>Rename the file</source>
<translation>Renommer le fichier</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="422"/>
<source>New name:</source>
<translation>Nouveau nom :</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="426"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="451"/>
<source>The file could not be renamed</source>
<translation>Le fichier n'a pas pu être renommé</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="427"/>
<source>This file name contains forbidden characters, please choose a different one.</source>
<translation>Ce nom de fichier contient des caractères interdits, veuillez en choisir un autre.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="452"/>
<location filename="../gui/addnewtorrentdialog.cpp" line="485"/>
<source>This name is already in use in this folder. Please use a different name.</source>
<translation>Ce nom de fichier est déjà utilisé dans ce dossier. Veuillez utiliser un autre nom.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="484"/>
<source>The folder could not be renamed</source>
<translation>Le dossier n'a pas pu être renommé</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="541"/>
<source>Rename...</source>
<translation>Renommer…</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="545"/>
<source>Priority</source>
<translation>Priorité</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="637"/>
<source>Invalid metadata</source>
<translation>Metadata invalides.</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="644"/>
<source>Parsing metadata...</source>
<translation>Analyse syntaxique des métadonnées...</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="648"/>
<source>Metadata retrieval complete</source>
<translation>Récuperation des métadonnées terminée</translation>
</message>
<message>
<location filename="../gui/addnewtorrentdialog.cpp" line="708"/>
<source>Download Error</source>
<translation>Erreur de téléchargement</translation>
</message>
</context>
<context>
<name>AdvancedSettings</name>
<message>
<location filename="../gui/advancedsettings.h" line="219"/>
<source>Disk write cache size</source>
<translation>Taille du cache disque</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="201"/>
<source> MiB</source>
<translation>Mio</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="239"/>
<source>Outgoing ports (Min) [0: Disabled]</source>
<translation>Ports sortants (min) [0: désactivé]</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="244"/>
<source>Outgoing ports (Max) [0: Disabled]</source>
<translation>Ports sortants (max) [0: désactivé]</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="247"/>
<source>Recheck torrents on completion</source>
<translation>Revérifier les torrents lorsqu'ils sont terminés</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="253"/>
<source>Transfer list refresh interval</source>
<translation>Intervalle d'actualisation de la liste de transfert</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="252"/>
<source> ms</source>
<comment> milliseconds</comment>
<translation>ms</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="80"/>
<source>Setting</source>
<translation>Paramètre</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="80"/>
<source>Value</source>
<comment>Value set for this setting</comment>
<translation>Valeur</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="199"/>
<source> (auto)</source>
<translation>(automatique)</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="224"/>
<source> s</source>
<comment> seconds</comment>
<translation>s</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="225"/>
<source>Disk cache expiry interval</source>
<translation>Intervalle de l'expiration du cache disque</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="228"/>
<source>Enable OS cache</source>
<translation>Activer le cache du système d’exploitation</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="233"/>
<source> m</source>
<comment> minutes</comment>
<translation>m</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="256"/>
<source>Resolve peer countries (GeoIP)</source>
<translation>Afficher le pays des pairs (GeoIP)</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="259"/>
<source>Resolve peer host names</source>
<translation>Afficher le nom d'hôte des pairs</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="264"/>
<source>Maximum number of half-open connections [0: Disabled]</source>
<translation>Nombre maximum de connexions à moitié ouvertes [0: désactivé]</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="267"/>
<source>Strict super seeding</source>
<translation>Super-partage strict</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="287"/>
<source>Network Interface (requires restart)</source>
<translation>Interface réseau (redémarrage requis)</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="290"/>
<source>Listen on IPv6 address (requires restart)</source>
<translation>Écouter sur l’adresse IPv6 (redémarrage requis)</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="315"/>
<source>Confirm torrent recheck</source>
<translation>Confirmer la revérification du torrent</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="318"/>
<source>Exchange trackers with other peers</source>
<translation>Échanger les trackers avec d'autres pairs</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="321"/>
<source>Always announce to all trackers</source>
<translation>Toujours contacter tous les trackers</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="269"/>
<source>Any interface</source>
<comment>i.e. Any network interface</comment>
<translation>N'importe quelle interface</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="234"/>
<source>Save resume data interval</source>
<comment>How often the fastresume file is saved.</comment>
<translation>Intervalle de sauvegarde des données de reprise</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="293"/>
<source>IP Address to report to trackers (requires restart)</source>
<translation>Adresse IP annoncée aux trackers (Redémarrage requis)</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="296"/>
<source>Display program on-screen notifications</source>
<translation>Afficher les messages de notification à l'écran</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="299"/>
<source>Enable embedded tracker</source>
<translation>Activer le tracker intégré</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="304"/>
<source>Embedded tracker port</source>
<translation>Port du tracker intégré</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="307"/>
<source>Check for software updates</source>
<translation>Vérifier les mises à jour du logiciel</translation>
</message>
<message>
<location filename="../gui/advancedsettings.h" line="311"/>
<source>Use system icon theme</source>
<translation>Utiliser le thème d'icônes du système</translation>
</message>
</context>
<context>
<name>Application</name>
<message>
<location filename="../app/application.cpp" line="105"/>
<source>qBittorrent %1 started</source>
<comment>qBittorrent v3.2.0alpha started</comment>
<translation>qBittorrent %1 démarré.</translation>
</message>
<message>
<location filename="../app/application.cpp" line="262"/>
<source>Information</source>
<translation>Information</translation>
</message>
<message>
<location filename="../app/application.cpp" line="263"/>
<source>To control qBittorrent, access the Web UI at http://localhost:%1</source>
<translation>Pour contrôler qBittorrent, accédez à l'interface web via http://localhost:%1</translation>
</message>
<message>
<location filename="../app/application.cpp" line="264"/>
<source>The Web UI administrator user name is: %1</source>
<translation>Le nom d'utilisateur de l'administrateur de l'interface web est : %1</translation>
</message>
<message>
<location filename="../app/application.cpp" line="267"/>
<source>The Web UI administrator password is still the default one: %1</source>
<translation>Le mot de passe de l'administrateur de l'interface web est toujours celui par défaut : %1</translation>
</message>
<message>
<location filename="../app/application.cpp" line="268"/>
<source>This is a security risk, please consider changing your password from program preferences.</source>
<translation>Ceci peut être dangereux, veuillez penser à changer votre mot de passe dans les options.</translation>
</message>
<message>
<location filename="../app/application.cpp" line="442"/>
<source>Saving torrent progress...</source>
<translation>Sauvegarde de l'avancement du torrent.</translation>
</message>
</context>
<context>
<name>AutomatedRssDownloader</name>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="208"/>
<source>Save to:</source>
<translation>Sauvegarder sous :</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="14"/>
<source>RSS Downloader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="26"/>
<source>Enable Automated RSS Downloader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="48"/>
<source>Download Rules</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="88"/>
<source>Rule Definition</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="94"/>
<source>Use Regular Expressions</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="103"/>
<source>Must Contain:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="110"/>
<source>Must Not Contain:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="117"/>
<source>Episode Filter:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="180"/>
<source>Assign Label:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="196"/>
<source>Save to a Different Directory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="236"/>
<source>Ignore Subsequent Matches for (0 to Disable)</source>
<comment>... X days</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="246"/>
<source> days</source>
<translation>jours</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="276"/>
<source>Add Paused:</source>
<translation>Ajouter en pause :</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="284"/>
<source>Use global settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="289"/>
<source>Always</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="294"/>
<source>Never</source>
<translation type="unfinished">Jamais</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="315"/>
<source>Apply Rule to Feeds:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="337"/>
<source>Matching RSS Articles</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="362"/>
<source>&Import...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.ui" line="369"/>
<source>&Export...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="77"/>
<source>Matches articles based on episode filter.</source>
<translation>Articles correspondants basés sur le filtrage épisode</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="77"/>
<source>Example: </source>
<translation>Exemple :</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="78"/>
<source> will match 2, 5, 8 through 15, 30 and onward episodes of season one</source>
<comment>example X will match</comment>
<translation>correspondra aux épisodes 2, 5, 8 et 15-30 et supérieurs de la saison 1</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="79"/>
<source>Episode filter rules: </source>
<translation>Règles de filtrage d'épisodes :</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="79"/>
<source>Season number is a mandatory non-zero value</source>
<translation>Le numéro de saison est une valeur obligatoire différente de zéro</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="80"/>
<source>Episode number is a mandatory non-zero value</source>
<translation>Le numéro d'épisode est une valeur obligatoire différente de zéro</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="81"/>
<source>Filter must end with semicolon</source>
<translation>Le filtre doit se terminer avec un point-virgule</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="82"/>
<source>Three range types for episodes are supported: </source>
<translation>Trois types d'intervalles d'épisodes sont pris en charge :</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="83"/>
<source>Single number: <b>1x25;</b> matches episode 25 of season one</source>
<translation>Nombre simple : <b>1×25;</b> correspond à l'épisode 25 de la saison 1</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="84"/>
<source>Normal range: <b>1x25-40;</b> matches episodes 25 through 40 of season one</source>
<translation>Intervalle standard : <b>1×25-40;</b> correspond aux épisodes 25 à 40 de la saison 1</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="85"/>
<source>Infinite range: <b>1x25-;</b> matches episodes 25 and upward of season one</source>
<translation>Intervalle infinie : <b>1×25-;</b> correspond aux épisodes 25 et suivants de la saison 1</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="266"/>
<source>Last Match: %1 days ago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="268"/>
<source>Last Match: Unknown</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="361"/>
<source>New rule name</source>
<translation>Nouveau nom pour la règle</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="361"/>
<source>Please type the name of the new download rule.</source>
<translation>Veuillez entrer le nom de la nouvelle règle de téléchargement.</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="365"/>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="483"/>
<source>Rule name conflict</source>
<translation>Conflit dans les noms de règle</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="365"/>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="483"/>
<source>A rule with this name already exists, please choose another name.</source>
<translation>Une règle avec ce nom existe déjà, veuillez en choisir un autre.</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="383"/>
<source>Are you sure you want to remove the download rule named '%1'?</source>
<translation>Êtes vous certain de vouloir supprimer la règle de téléchargement '%1'</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="385"/>
<source>Are you sure you want to remove the selected download rules?</source>
<translation>Voulez-vous vraiment supprimer les règles sélectionnées ?</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="386"/>
<source>Rule deletion confirmation</source>
<translation>Confirmation de la suppression</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="402"/>
<source>Destination directory</source>
<translation>Répertoire de destination</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="410"/>
<source>Invalid action</source>
<translation>Action invalide</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="410"/>
<source>The list is empty, there is nothing to export.</source>
<translation>La liste est vide, il n'y a rien à exporter.</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="414"/>
<source>Where would you like to save the list?</source>
<translation>Où désirez-vous sauvegarder cette liste ?</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="414"/>
<source>Rules list (*.rssrules)</source>
<translation>Liste de règles (*.rssrules)</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="419"/>
<source>I/O Error</source>
<translation>Erreur E/S</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="419"/>
<source>Failed to create the destination file</source>
<translation>Impossible de créer le fichier de destination</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="427"/>
<source>Please point to the RSS download rules file</source>
<translation>Veuillez indiquer le fichier contenant les règles de téléchargement RSS</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="427"/>
<source>Rules list</source>
<translation>Liste des règles</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="431"/>
<source>Import Error</source>
<translation>Erreur lors de l'importation</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="431"/>
<source>Failed to import the selected rules file</source>
<translation>Impossible d'importer le fichier de règles sélectionné</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="442"/>
<source>Add new rule...</source>
<translation>Ajouter une nouvelle règle…</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="448"/>
<source>Delete rule</source>
<translation>Supprimer la règle</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="450"/>
<source>Rename rule...</source>
<translation>Renommer la règle…</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="452"/>
<source>Delete selected rules</source>
<translation>Supprimer les règles sélectionnées</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="479"/>
<source>Rule renaming</source>
<translation>Renommage de la règle</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="479"/>
<source>Please type the new rule name</source>
<translation>Veuillez enter le nouveau nom pour la règle</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="581"/>
<source>Regex mode: use Perl-like regular expressions</source>
<translation>Mode regex : utiliser des expressions régulières similaires à celles de Perl</translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="585"/>
<source>Wildcard mode: you can use<ul><li>? to match any single character</li><li>* to match zero or more of any characters</li><li>Whitespaces count as AND operators</li></ul></source>
<translation>Mode simplifié : vous pouvez utiliser<ul><li>? pour remplacer n'importe quel caractère</li><li>* pour remplacer zéro ou plusieurs caractères</li><li>Les espaces sont considérés équivalent à des opérateurs ET</li></ul></translation>
</message>
<message>
<location filename="../gui/rss/automatedrssdownloader.cpp" line="587"/>
<source>Wildcard mode: you can use<ul><li>? to match any single character</li><li>* to match zero or more of any characters</li><li>| is used as OR operator</li></ul></source>
<translation>Mode simplifié : vous pouvez utiliser<ul><li>? pour remplacer n'importe quel caractère</li><li>* pour remplacer zéro ou plusieurs caractères</li><li>| est utilisé comme opérateur OU</li></ul></translation>
</message>
</context>
<context>
<name>BitTorrent::Session</name>
<message>
<location filename="../core/bittorrent/session.cpp" line="173"/>
<source>Peer ID: </source>
<translation>ID du pair :</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="316"/>
<source>HTTP User-Agent is '%1'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="343"/>
<source>Anonymous mode [ON]</source>
<translation>Mode anonyme [ACTIVE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="345"/>
<source>Anonymous mode [OFF]</source>
<translation>Mode anonyme [DESACTIVE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="535"/>
<source>PeX support [ON]</source>
<translation>Prise en charge de PeX [ACTIVÉE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="537"/>
<source>PeX support [OFF]</source>
<translation>Prise en charge de PeX [DÉSACTIVÉE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="539"/>
<source>Restart is required to toggle PeX support</source>
<translation>Un redémarrage est nécessaire pour changer le support PeX</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="544"/>
<source>Local Peer Discovery support [ON]</source>
<translation>Découverte de pairs sur le réseau local [ACTIVÉE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="548"/>
<source>Local Peer Discovery support [OFF]</source>
<translation>Découverte de pairs sur le réseau local [DÉSACTIVÉE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="561"/>
<source>Encryption support [ON]</source>
<translation>Support de cryptage [ACTIVE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="566"/>
<source>Encryption support [FORCED]</source>
<translation>Support de cryptage [FORCE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="571"/>
<source>Encryption support [OFF]</source>
<translation>Support de cryptage [DESACTIVE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="649"/>
<source>Embedded Tracker [ON]</source>
<translation>Tracker intégré [ACTIVÉ]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="651"/>
<source>Failed to start the embedded tracker!</source>
<translation>Impossible de démarrer le tracker intégré !</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="654"/>
<source>Embedded Tracker [OFF]</source>
<translation>Tracker intégré [DÉSACTIVÉ]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="692"/>
<source>'%1' reached the maximum ratio you set. Removing...</source>
<translation>'%1' a atteint le ratio maximum que vous avez défini. Suppression...</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="698"/>
<source>'%1' reached the maximum ratio you set. Pausing...</source>
<translation>'%1' a atteint le ratio maximum que vous avez défini. Mise en pause...</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1175"/>
<source>Error: Could not create torrent export directory: '%1'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1203"/>
<source>Error: could not export torrent '%1', maybe it has not metadata yet.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1430"/>
<source>System network status changed to %1</source>
<comment>e.g: System network status changed to ONLINE</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1430"/>
<source>ONLINE</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1430"/>
<source>OFFLINE</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1438"/>
<source>Network configuration of %1 has changed, refreshing session binding</source>
<comment>e.g: Network configuration of tun0 has changed, refreshing session binding</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1721"/>
<source>Unable to decode '%1' torrent file.</source>
<translation>Impossible de décoder le fichier torrent '%1'</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1827"/>
<source>Recursive download of file '%1' embedded in torrent '%2'</source>
<comment>Recursive download of 'test.torrent' embedded in torrent 'test2'</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2138"/>
<source>Couldn't save '%1.torrent'</source>
<translation>Impossible de sauvegarder '%1.torrent"</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2240"/>
<source>because %1 is disabled.</source>
<comment>this peer was blocked because uTP is disabled.</comment>
<translation>parce que '%1' est désactivé</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2243"/>
<source>because %1 is disabled.</source>
<comment>this peer was blocked because TCP is disabled.</comment>
<translation>parce que '%1' est désactivé</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2261"/>
<source>URL seed lookup failed for URL: '%1', message: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="811"/>
<source>'%1' was removed from transfer list and hard disk.</source>
<comment>'xxx.avi' was removed...</comment>
<translation>'%1' a été supprimé de la liste de transferts et du disque.</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="813"/>
<source>'%1' was removed from transfer list.</source>
<comment>'xxx.avi' was removed...</comment>
<translation>'%1' a été supprimé de la liste de transferts.</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="972"/>
<source>Downloading '%1', please wait...</source>
<comment>e.g: Downloading 'xxx.torrent', please wait...</comment>
<translation>Téléchargement de '%1', veuillez patienter...</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1183"/>
<source>Torrent Export: torrent is invalid, skipping...</source>
<translation>Exportation de torrents : le torrent est invalide et a été ignoré...</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1276"/>
<source>DHT support [ON]</source>
<translation>Prise en charge de DHT [ACTIVÉE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1281"/>
<source>DHT support [OFF]. Reason: %1</source>
<translation>Prise en charge de DHT [DÉSACTIVÉE]. Motif : %1</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1289"/>
<source>DHT support [OFF]</source>
<translation>Prise en charge de DHT [DÉSACTIVÉE]</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="165"/>
<location filename="../core/bittorrent/session.cpp" line="1508"/>
<source>qBittorrent is trying to listen on any interface port: %1</source>
<comment>e.g: qBittorrent is trying to listen on any interface port: TCP/6881</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1512"/>
<source>qBittorrent failed to listen on any interface port: %1. Reason: %2</source>
<comment>e.g: qBittorrent failed to listen on any interface port: TCP/6881. Reason: no such interface</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1461"/>
<source>The network interface defined is invalid: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="169"/>
<location filename="../core/bittorrent/session.cpp" line="1519"/>
<source>qBittorrent is trying to listen on interface %1 port: %2</source>
<comment>e.g: qBittorrent is trying to listen on interface 192.168.0.1 port: TCP/6881</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1485"/>
<source>qBittorrent didn't find an %1 local address to listen on</source>
<comment>qBittorrent didn't find an IPv4 local address to listen on</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1633"/>
<source>Tracker '%1' was added to torrent '%2'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1643"/>
<source>Tracker '%1' was deleted from torrent '%2'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1658"/>
<source>URL seed '%1' was added to torrent '%2'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1664"/>
<source>URL seed '%1' was removed from torrent '%2'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1943"/>
<source>Unable to resume torrent '%1'.</source>
<comment>e.g: Unable to resume torrent 'hash'.</comment>
<translation>Impossible de résumer le torrent "%1".</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1966"/>
<source>Successfully parsed the provided IP filter: %1 rules were applied.</source>
<comment>%1 is a number</comment>
<translation type="unfinished">Le filtre IP a été correctement chargé : %1 règles ont été appliquées.</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="1972"/>
<source>Error: Failed to parse the provided IP filter.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2100"/>
<source>Couldn't add torrent. Reason: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2121"/>
<source>'%1' resumed. (fast resume)</source>
<comment>'torrent name' was resumed. (fast resume)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2152"/>
<source>'%1' added to download list.</source>
<comment>'torrent name' was added to download list.</comment>
<translation>'%1' ajouté à la liste de téléchargement.</translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2204"/>
<source>An I/O error occurred, '%1' paused. %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2212"/>
<source>UPnP/NAT-PMP: Port mapping failure, message: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2218"/>
<source>UPnP/NAT-PMP: Port mapping successful, message: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2228"/>
<source>due to IP filter.</source>
<comment>this peer was blocked due to ip filter.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2231"/>
<source>due to port filter.</source>
<comment>this peer was blocked due to port filter.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2234"/>
<source>due to i2p mixed mode restrictions.</source>
<comment>this peer was blocked due to i2p mixed mode restrictions.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2237"/>
<source>because it has a low port.</source>
<comment>this peer was blocked because it has a low port.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2275"/>
<source>qBittorrent is successfully listening on interface %1 port: %2/%3</source>
<comment>e.g: qBittorrent is successfully listening on interface 192.168.0.1 port: TCP/6881</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2301"/>
<source>qBittorrent failed listening on interface %1 port: %2/%3. Reason: %4</source>
<comment>e.g: qBittorrent failed listening on interface 192.168.0.1 port: TCP/6881. Reason: already in use</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/session.cpp" line="2310"/>
<source>External IP: %1</source>
<comment>e.g. External IP: 192.168.0.1</comment>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>BitTorrent::TorrentHandle</name>
<message>
<location filename="../core/bittorrent/torrenthandle.cpp" line="1315"/>
<source>Could not move torrent: '%1'. Reason: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/torrenthandle.cpp" line="1456"/>
<source>File sizes mismatch for torrent '%1', pausing it.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/torrenthandle.cpp" line="1462"/>
<source>Fast resume data was rejected for torrent '%1'. Reason: %2. Checking again...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>CookiesDlg</name>
<message>
<location filename="../gui/rss/cookiesdlg.ui" line="14"/>
<source>Cookies management</source>
<translation>Gestion des cookies</translation>
</message>
<message>
<location filename="../gui/rss/cookiesdlg.ui" line="36"/>
<source>Key</source>
<extracomment>As in Key/Value pair</extracomment>
<translation>Clé</translation>
</message>
<message>
<location filename="../gui/rss/cookiesdlg.ui" line="41"/>
<source>Value</source>
<extracomment>As in Key/Value pair</extracomment>
<translation>Valeur</translation>
</message>
<message>
<location filename="../gui/rss/cookiesdlg.cpp" line="48"/>
<source>Common keys for cookies are: '%1', '%2'.
You should get this information from your Web browser preferences.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>DeletionConfirmationDlg</name>
<message>
<location filename="../gui/deletionconfirmationdlg.h" line="48"/>
<source>Are you sure you want to delete '%1' from the transfer list?</source>
<comment>Are you sure you want to delete 'ubuntu-linux-iso' from the transfer list?</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/deletionconfirmationdlg.h" line="50"/>
<source>Are you sure you want to delete these %1 torrents from the transfer list?</source>
<comment>Are you sure you want to delete these 5 torrents from the transfer list?</comment>
<translation>Voulez-vous vraiment supprimer ces %1 torrents de la liste des transferts ?</translation>
</message>
</context>
<context>
<name>DownloadedPiecesBar</name>
<message>
<location filename="../gui/properties/downloadedpiecesbar.cpp" line="37"/>
<source>White: Missing pieces</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/downloadedpiecesbar.cpp" line="37"/>
<source>Green: Partial pieces</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/downloadedpiecesbar.cpp" line="37"/>
<source>Blue: Completed pieces</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ExecutionLog</name>
<message>
<location filename="../gui/executionlog.ui" line="27"/>
<source>General</source>
<translation>Général</translation>
</message>
<message>
<location filename="../gui/executionlog.ui" line="33"/>
<source>Blocked IPs</source>
<translation>Adresses IP bloquées</translation>
</message>
<message>
<location filename="../gui/executionlog.cpp" line="101"/>
<source><font color='red'>%1</font> was blocked %2</source>
<comment>x.y.z.w was blocked</comment>
<translation><font color='red'>%1</font> a été bloqué %2</translation>
</message>
<message>
<location filename="../gui/executionlog.cpp" line="103"/>
<source><font color='red'>%1</font> was banned</source>
<comment>x.y.z.w was banned</comment>
<translation><font color='red'>%1</font> a été banni</translation>
</message>
</context>
<context>
<name>FeedListWidget</name>
<message>
<location filename="../gui/rss/feedlistwidget.cpp" line="41"/>
<source>RSS feeds</source>
<translation>Flux RSS</translation>
</message>
<message>
<location filename="../gui/rss/feedlistwidget.cpp" line="43"/>
<source>Unread</source>
<translation>Non lu</translation>
</message>
</context>
<context>
<name>FilterParserThread</name>
<message>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="65"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="159"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="267"/>
<source>I/O Error: Could not open ip filter file in read mode.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="278"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="290"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="311"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="320"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="330"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="340"/>
<location filename="../core/bittorrent/private/filterparserthread.cpp" line="360"/>
<source>Parsing Error: The filter file is not a valid PeerGuardian P2B file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>GeoIPDatabase</name>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="101"/>
<location filename="../core/net/private/geoipdatabase.cpp" line="131"/>
<source>Unsupported database file size.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="236"/>
<source>Metadata error: '%1' entry not found.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="237"/>
<source>Metadata error: '%1' entry has invalid type.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="246"/>
<source>Unsupported database version: %1.%2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="253"/>
<source>Unsupported IP version: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="260"/>
<source>Unsupported record size: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="273"/>
<source>Invalid database type: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/private/geoipdatabase.cpp" line="294"/>
<source>Database corrupted: no data section found.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>HttpServer</name>
<message>
<location filename="../webui/extra_translations.h" line="36"/>
<source>File</source>
<translation>Fichier</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="37"/>
<source>Edit</source>
<translation>Édition</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="38"/>
<source>Help</source>
<translation>Aide</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="40"/>
<source>Download Torrents from their URL or Magnet link</source>
<translation>Téléchargement de torrents depuis leur URL ou lien magnet</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="41"/>
<source>Only one link per line</source>
<translation>Un seul lien par ligne</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="42"/>
<source>Download local torrent</source>
<translation>Téléchargement d'un torrent local</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="43"/>
<source>Download</source>
<translation>Télécharger</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="45"/>
<source>Global upload rate limit must be greater than 0 or disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="46"/>
<source>Global download rate limit must be greater than 0 or disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="47"/>
<source>Alternative upload rate limit must be greater than 0 or disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="48"/>
<source>Alternative download rate limit must be greater than 0 or disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="49"/>
<source>Maximum active downloads must be greater than -1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="50"/>
<source>Maximum active uploads must be greater than -1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="51"/>
<source>Maximum active torrents must be greater than -1.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="52"/>
<source>Maximum number of connections limit must be greater than 0 or disabled.</source>
<translation>Le nombre maximum de connexions doit être supérieur à 0 ou désactivé.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="53"/>
<source>Maximum number of connections per torrent limit must be greater than 0 or disabled.</source>
<translation>Le nombre maximum de connexions par torrent doit être supérieur à 0 ou désactivé.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="54"/>
<source>Maximum number of upload slots per torrent limit must be greater than 0 or disabled.</source>
<translation>Le nombre maximum de slots d'envoi par torrent doit être supérieur à 0 ou désactivé.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="55"/>
<source>Unable to save program preferences, qBittorrent is probably unreachable.</source>
<translation>Impossible de sauvegarder les préférences, qBittorrent est probablement injoignable.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="56"/>
<source>Language</source>
<translation>Langue</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="57"/>
<source>The port used for incoming connections must be between 1 and 65535.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="58"/>
<source>The port used for the Web UI must be between 1 and 65535.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="68"/>
<source>Unable to log in, qBittorrent is probably unreachable.</source>
<translation>Impossible de se connecter, qBittorrent est probablement inaccessible.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="69"/>
<source>Invalid Username or Password.</source>
<translation>Nom d'utilisateur ou mot de passe invalide.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="70"/>
<source>Password</source>
<translation>Mot de passe</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="71"/>
<source>Login</source>
<translation>Identifiant</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="72"/>
<source>Upload Failed!</source>
<translation>Le transfert a échoué !</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="73"/>
<source>Original authors</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="74"/>
<source>Upload limit:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="75"/>
<source>Download limit:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="76"/>
<source>Apply</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="77"/>
<source>Add</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="78"/>
<source>Upload Torrents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="79"/>
<source>All</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="80"/>
<source>Downloading</source>
<translation type="unfinished">En téléchargement</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="81"/>
<source>Seeding</source>
<translation type="unfinished">En partage</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="82"/>
<source>Completed</source>
<translation type="unfinished">Terminé</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="83"/>
<source>Resumed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="84"/>
<source>Paused</source>
<translation type="unfinished">En pause</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="85"/>
<source>Active</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="86"/>
<source>Inactive</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="90"/>
<source>Downloaded</source>
<comment>Is the file downloaded or not?</comment>
<translation>Téléchargé</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="39"/>
<source>Logout</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="44"/>
<source>Are you sure you want to delete the selected torrents from the transfer list?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="59"/>
<source>The Web UI username must be at least 3 characters long.</source>
<translation>Le nom d'utilisateur pour l'interface eb doit contenir au moins trois caractères.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="60"/>
<source>The Web UI password must be at least 3 characters long.</source>
<translation>Le mot de passe pour l'interface web doit contenir au moins trois caractères.</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="61"/>
<source>Save</source>
<translation>Sauvegarder</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="62"/>
<source>qBittorrent client is not reachable</source>
<translation>Le logiciel qBittorrent n'est pas accessible</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="63"/>
<source>HTTP Server</source>
<translation>Serveur HTTP</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="64"/>
<source>The following parameters are supported:</source>
<translation>Les paramètres suivants sont pris en charge :</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="65"/>
<source>Torrent path</source>
<translation>Chemin du torrent</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="66"/>
<source>Torrent name</source>
<translation>Nom du torrent</translation>
</message>
<message>
<location filename="../webui/extra_translations.h" line="67"/>
<source>qBittorrent has been shutdown.</source>
<translation>qBittorrent a été arrêté.</translation>
</message>
</context>
<context>
<name>LabelFiltersList</name>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="189"/>
<source>All (0)</source>
<comment>this is for the label filter</comment>
<translation>Toutes Catégories (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="192"/>
<source>Unlabeled (0)</source>
<translation>Sans Catégorie</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="214"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="260"/>
<source>All (%1)</source>
<comment>this is for the label filter</comment>
<translation>Toutes Catégories (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="217"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="235"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="263"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="268"/>
<source>Unlabeled (%1)</source>
<translation>Sans Catégorie</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="239"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="276"/>
<source>%1 (%2)</source>
<comment>label_name (10)</comment>
<translation>%1 (%2)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="330"/>
<source>Add label...</source>
<translation>Ajouter catégorie...</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="334"/>
<source>Remove label</source>
<translation>Supprimer catégorie</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="335"/>
<source>Remove unused labels</source>
<translation>Supprimer les catégories inutilisées</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="337"/>
<source>Resume torrents</source>
<translation>Démarrer les torrents</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="338"/>
<source>Pause torrents</source>
<translation>Mettre en pause les torrents</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="339"/>
<source>Delete torrents</source>
<translation>Supprimer les torrents</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="366"/>
<source>New Label</source>
<translation>Nouvelle catégorie</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="366"/>
<source>Label:</source>
<translation>Catégorie :</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="372"/>
<source>Invalid label name</source>
<translation>Nom de catégorie invalide</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="372"/>
<source>Please don't use any special characters in the label name.</source>
<translation>N'utilisez pas des caractères spéciaux dans le nom de catégorie.</translation>
</message>
</context>
<context>
<name>LineEdit</name>
<message>
<location filename="../gui/lineedit/src/lineedit.cpp" line="30"/>
<source>Clear the text</source>
<translation>Effacer le texte</translation>
</message>
</context>
<context>
<name>LogListWidget</name>
<message>
<location filename="../gui/loglistwidget.cpp" line="47"/>
<source>Copy</source>
<translation>Copier</translation>
</message>
<message>
<location filename="../gui/loglistwidget.cpp" line="48"/>
<source>Clear</source>
<translation>Effacer</translation>
</message>
</context>
<context>
<name>MainWindow</name>
<message>
<location filename="../gui/mainwindow.ui" line="37"/>
<source>&Edit</source>
<translation>&Édition</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="60"/>
<source>&Tools</source>
<translation>Ou&tils</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="80"/>
<source>&File</source>
<translation>&Fichier</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="50"/>
<source>&Help</source>
<translation>&Aide</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="64"/>
<source>On Downloads &Done</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="90"/>
<source>&View</source>
<translation>A&ffichage</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="161"/>
<source>&Options...</source>
<translation>&Options...</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="174"/>
<source>&Resume</source>
<translation>&Démarrer</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="206"/>
<source>Torrent &Creator</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="211"/>
<source>Set Upload Limit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="216"/>
<source>Set Download Limit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="226"/>
<source>Set Global Download Limit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="231"/>
<source>Set Global Upload Limit...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="236"/>
<source>Minimum Priority</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="244"/>
<source>Top Priority</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="252"/>
<source>Decrease Priority</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="260"/>
<source>Increase Priority</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="271"/>
<location filename="../gui/mainwindow.ui" line="274"/>
<source>Alternative Speed Limits</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="282"/>
<source>&Top Toolbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="285"/>
<source>Display Top Toolbar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="293"/>
<source>S&peed in Title Bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="296"/>
<source>Show Transfer Speed in Title Bar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="304"/>
<source>&RSS Reader</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="312"/>
<source>Search &Engine</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="317"/>
<source>L&ock qBittorrent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="331"/>
<source>&Import Existing Torrent...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="334"/>
<source>Import Torrent...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="339"/>
<source>Do&nate!</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="347"/>
<source>R&esume All</source>
<translation>Tout Dé&marrer</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="360"/>
<source>&Log</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="371"/>
<source>&Exit qBittorrent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="379"/>
<source>&Suspend System</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="387"/>
<source>&Hibernate System</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="395"/>
<source>S&hutdown System</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="403"/>
<source>&Disabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="418"/>
<source>&Statistics</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="423"/>
<source>Check for Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="426"/>
<source>Check for Program Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="169"/>
<source>&About</source>
<translation>&À propos</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="156"/>
<source>Exit</source>
<translation>Quitter</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="182"/>
<source>&Pause</source>
<translation>Mettre en &pause</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="190"/>
<source>&Delete</source>
<translation>&Supprimer</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="352"/>
<source>P&ause All</source>
<translation>Tout &mettre en pause</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="145"/>
<source>&Add Torrent File...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="148"/>
<source>Open</source>
<translation>Ouvrir</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="153"/>
<source>E&xit</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="164"/>
<source>Options</source>
<translation>Options</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="177"/>
<source>Resume</source>
<translation>Démarrer</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="185"/>
<source>Pause</source>
<translation>Mettre en pause</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="193"/>
<source>Delete</source>
<translation>Supprimer</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="201"/>
<source>Open URL</source>
<translation>Ouvrir URL</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="221"/>
<source>&Documentation</source>
<translation>&Documentation</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="320"/>
<source>Lock</source>
<translation>Verrouiller</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="408"/>
<location filename="../gui/mainwindow.cpp" line="1293"/>
<source>Show</source>
<translation>Afficher</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1480"/>
<source>Check for program updates</source>
<translation>Vérifier la disponibilité de mises à jour du logiciel</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="323"/>
<source>Lock qBittorrent</source>
<translation>Verrouiller qBittorrent</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="198"/>
<source>Add Torrent &Link...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="342"/>
<source>If you like qBittorrent, please donate!</source>
<translation>Si vous aimez qBittorrent, faites un don !</translation>
</message>
<message>
<location filename="../gui/mainwindow.ui" line="363"/>
<location filename="../gui/mainwindow.cpp" line="1508"/>
<source>Execution Log</source>
<translation>Journal d'exécution</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="478"/>
<source>Clear the password</source>
<translation>Effacer le mot de passe</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="187"/>
<source>Filter torrent list...</source>
<translation>Filtrer la liste des torrents…</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="158"/>
<source>&Set Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="160"/>
<source>&Clear Password</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="205"/>
<source>Transfers</source>
<translation>Transferts</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="343"/>
<source>Torrent file association</source>
<translation>Association aux fichiers torrent</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="344"/>
<source>qBittorrent is not the default application to open torrent files or Magnet links.
Do you want to associate qBittorrent to torrent files and Magnet links?</source>
<translation>qBittorrent n'est pas l'application par défaut utilisée pour ouvrir les fichiers torrent ou les liens magnet.
Voulez-vous associer qBittorrent aux fichiers torrent et liens magnet ?</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="375"/>
<source>Icons Only</source>
<translation>Icônes seulement</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="377"/>
<source>Text Only</source>
<translation>Texte seulement</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="379"/>
<source>Text Alongside Icons</source>
<translation>Texte à côté des Icônes</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="381"/>
<source>Text Under Icons</source>
<translation>Texte sous les Icônes</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="383"/>
<source>Follow System Style</source>
<translation>Suivre le style du système</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="463"/>
<location filename="../gui/mainwindow.cpp" line="490"/>
<location filename="../gui/mainwindow.cpp" line="792"/>
<source>UI lock password</source>
<translation>Mot de passe de verrouillage</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="463"/>
<location filename="../gui/mainwindow.cpp" line="490"/>
<location filename="../gui/mainwindow.cpp" line="792"/>
<source>Please type the UI lock password:</source>
<translation>Veuillez entrer le mot de passe de verrouillage :</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="467"/>
<source>The password should contain at least 3 characters</source>
<translation>The mot de passe doit contenir au moins 3 caractères</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="472"/>
<source>Password update</source>
<translation>Mise à jour du mot de passe</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="472"/>
<source>The UI lock password has been successfully updated</source>
<translation>Le mot de passe de verrouillage a été mis à jour</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="478"/>
<source>Are you sure you want to clear the password?</source>
<translation>Êtes vous sûr de vouloir effacer le mot de passe ?</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="530"/>
<source>Search</source>
<translation>Recherche</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="541"/>
<source>Transfers (%1)</source>
<translation>Transferts (%1)</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="632"/>
<source>Error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="632"/>
<source>Failed to add torrent: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="638"/>
<source>Download completion</source>
<translation>Fin du téléchargement</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="644"/>
<source>I/O Error</source>
<comment>i.e: Input/Output Error</comment>
<translation>Erreur E/S</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="705"/>
<source>Recursive download confirmation</source>
<translation>Confirmation pour téléchargement récursif</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="706"/>
<source>Yes</source>
<translation>Oui</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="707"/>
<source>No</source>
<translation>Non</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="708"/>
<source>Never</source>
<translation>Jamais</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="728"/>
<source>Global Upload Speed Limit</source>
<translation>Limite globale de la vitesse d'envoi</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="744"/>
<source>Global Download Speed Limit</source>
<translation>Limite globale de la vitesse de réception</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="894"/>
<source>&No</source>
<translation type="unfinished">&Non</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="895"/>
<source>&Yes</source>
<translation type="unfinished">&Oui</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="896"/>
<source>&Always Yes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1379"/>
<source>Python found in %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1394"/>
<source>Old Python Interpreter</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1464"/>
<source>qBittorrent Update Available</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1474"/>
<source>Already Using the Latest qBittorrent Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1404"/>
<source>Undetermined Python version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="638"/>
<source>'%1' has finished downloading.</source>
<comment>e.g: xxx.avi has finished downloading.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="644"/>
<source>An I/O error occurred for torrent '%1'.
Reason: %2</source>
<comment>e.g: An error occurred for torrent 'xxx.avi'.
Reason: disk is full.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="705"/>
<source>The torrent '%1' contains torrent files, do you want to proceed with their download?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="720"/>
<source>Couldn't download file at URL '%1', reason: %2.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1394"/>
<source>Your Python version %1 is outdated. Please upgrade to latest version for search engines to work. Minimum requirement: 2.7.0/3.3.0.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1404"/>
<source>Couldn't determine your Python version (%1). Search engine disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1415"/>
<location filename="../gui/mainwindow.cpp" line="1427"/>
<source>Missing Python Interpreter</source>
<translation>L’interpréteur Python est absent</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1416"/>
<source>Python is required to use the search engine but it does not seem to be installed.
Do you want to install it now?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1427"/>
<source>Python is required to use the search engine but it does not seem to be installed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1465"/>
<source>A new version is available.
Update to version %1?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1475"/>
<source>No updates available.
You are already using the latest version.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1479"/>
<source>&Check for Updates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1577"/>
<source>Checking for Updates...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1578"/>
<source>Already checking for program updates in the background</source>
<translation>Recherche de mises à jour déjà en cours en tâche de fond</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1593"/>
<source>Python found in '%1'</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1646"/>
<source>Download error</source>
<translation>Erreur de téléchargement</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1646"/>
<source>Python setup could not be downloaded, reason: %1.
Please install it manually.</source>
<translation>L’installateur Python ne peut pas être téléchargé pour la raison suivante : %1.
Veuillez l’installer manuellement.</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="467"/>
<location filename="../gui/mainwindow.cpp" line="806"/>
<source>Invalid password</source>
<translation>Mot de passe invalide</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="508"/>
<location filename="../gui/mainwindow.cpp" line="520"/>
<source>RSS (%1)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="720"/>
<source>URL download error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="806"/>
<source>The password is invalid</source>
<translation>Le mot de passe fourni est invalide</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1188"/>
<location filename="../gui/mainwindow.cpp" line="1195"/>
<source>DL speed: %1</source>
<comment>e.g: Download speed: 10 KiB/s</comment>
<translation>Vitesse de réception : %1</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1191"/>
<location filename="../gui/mainwindow.cpp" line="1197"/>
<source>UP speed: %1</source>
<comment>e.g: Upload speed: 10 KiB/s</comment>
<translation>Vitesse d'envoi : %1</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1202"/>
<source>[D: %1, U: %2] qBittorrent %3</source>
<comment>D = Download; U = Upload; %3 is qBittorrent version</comment>
<translation>[R : %1, E : %2] qBittorrent %3</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1293"/>
<source>Hide</source>
<translation>Cacher</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="891"/>
<source>Exiting qBittorrent</source>
<translation>Fermeture de qBittorrent</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="892"/>
<source>Some files are currently transferring.
Are you sure you want to quit qBittorrent?</source>
<translation>Certains fichiers sont en cours de transfert.
Êtes-vous sûr de vouloir quitter qBittorrent ?</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1033"/>
<source>Open Torrent Files</source>
<translation>Ouvrir fichiers torrent</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1034"/>
<source>Torrent Files</source>
<translation>Fichiers torrent</translation>
</message>
<message>
<location filename="../gui/mainwindow.cpp" line="1069"/>
<source>Options were saved successfully.</source>
<translation>Préférences sauvegardées avec succès.</translation>
</message>
</context>
<context>
<name>Net::DNSUpdater</name>
<message>
<location filename="../core/net/dnsupdater.cpp" line="200"/>
<source>Your dynamic DNS was successfully updated.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="204"/>
<source>Dynamic DNS error: The service is temporarily unavailable, it will be retried in 30 minutes.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="213"/>
<source>Dynamic DNS error: hostname supplied does not exist under specified account.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="218"/>
<source>Dynamic DNS error: Invalid username/password.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="223"/>
<source>Dynamic DNS error: qBittorrent was blacklisted by the service, please report a bug at http://bugs.qbittorrent.org.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="229"/>
<source>Dynamic DNS error: %1 was returned by the service, please report a bug at http://bugs.qbittorrent.org.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="235"/>
<source>Dynamic DNS error: Your username was blocked due to abuse.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="256"/>
<source>Dynamic DNS error: supplied domain name is invalid.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="267"/>
<source>Dynamic DNS error: supplied username is too short.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/dnsupdater.cpp" line="278"/>
<source>Dynamic DNS error: supplied password is too short.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Net::DownloadHandler</name>
<message>
<location filename="../core/net/downloadhandler.cpp" line="104"/>
<source>I/O Error</source>
<translation type="unfinished">Erreur E/S</translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="117"/>
<source>The file size is %1. It exceeds the download limit of %2.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="186"/>
<source>Unexpected redirect to magnet URI.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Net::GeoIPManager</name>
<message>
<location filename="../core/net/geoipmanager.cpp" line="104"/>
<location filename="../core/net/geoipmanager.cpp" line="432"/>
<source>GeoIP database loaded. Type: %1. Build time: %2.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="108"/>
<location filename="../core/net/geoipmanager.cpp" line="453"/>
<source>Couldn't load GeoIP database. Reason: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="141"/>
<location filename="../core/net/geoipmanager.cpp" line="398"/>
<source>N/A</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="142"/>
<source>Asia/Pacific Region</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="143"/>
<source>Europe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="144"/>
<source>Andorra</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="145"/>
<source>United Arab Emirates</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="146"/>
<source>Afghanistan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="147"/>
<source>Antigua and Barbuda</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="148"/>
<source>Anguilla</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="149"/>
<source>Albania</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="150"/>
<source>Armenia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="151"/>
<source>Netherlands Antilles</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="152"/>
<source>Angola</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="153"/>
<source>Antarctica</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="154"/>
<source>Argentina</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="155"/>
<source>American Samoa</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="156"/>
<source>Austria</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="157"/>
<source>Australia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="158"/>
<source>Aruba</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="159"/>
<source>Azerbaijan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="160"/>
<source>Bosnia and Herzegovina</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="161"/>
<source>Barbados</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="162"/>
<source>Bangladesh</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="163"/>
<source>Belgium</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="164"/>
<source>Burkina Faso</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="165"/>
<source>Bulgaria</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="166"/>
<source>Bahrain</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="167"/>
<source>Burundi</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="168"/>
<source>Benin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="169"/>
<source>Bermuda</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="170"/>
<source>Brunei Darussalam</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="171"/>
<source>Bolivia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="172"/>
<source>Brazil</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="173"/>
<source>Bahamas</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="174"/>
<source>Bhutan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="175"/>
<source>Bouvet Island</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="176"/>
<source>Botswana</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="177"/>
<source>Belarus</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="178"/>
<source>Belize</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="179"/>
<source>Canada</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="180"/>
<source>Cocos (Keeling) Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="181"/>
<source>Congo, The Democratic Republic of the</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="182"/>
<source>Central African Republic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="183"/>
<source>Congo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="184"/>
<source>Switzerland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="185"/>
<source>Cote D'Ivoire</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="186"/>
<source>Cook Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="187"/>
<source>Chile</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="188"/>
<source>Cameroon</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="189"/>
<source>China</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="190"/>
<source>Colombia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="191"/>
<source>Costa Rica</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="192"/>
<source>Cuba</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="193"/>
<source>Cape Verde</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="194"/>
<source>Christmas Island</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="195"/>
<source>Cyprus</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="196"/>
<source>Czech Republic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="197"/>
<source>Germany</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="198"/>
<source>Djibouti</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="199"/>
<source>Denmark</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="200"/>
<source>Dominica</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="201"/>
<source>Dominican Republic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="202"/>
<source>Algeria</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="203"/>
<source>Ecuador</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="204"/>
<source>Estonia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="205"/>
<source>Egypt</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="206"/>
<source>Western Sahara</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="207"/>
<source>Eritrea</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="208"/>
<source>Spain</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="209"/>
<source>Ethiopia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="210"/>
<source>Finland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="211"/>
<source>Fiji</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="212"/>
<source>Falkland Islands (Malvinas)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="213"/>
<source>Micronesia, Federated States of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="214"/>
<source>Faroe Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="215"/>
<source>France</source>
<translation type="unfinished">France</translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="216"/>
<source>France, Metropolitan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="217"/>
<source>Gabon</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="218"/>
<source>United Kingdom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="219"/>
<source>Grenada</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="220"/>
<source>Georgia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="221"/>
<source>French Guiana</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="222"/>
<source>Ghana</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="223"/>
<source>Gibraltar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="224"/>
<source>Greenland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="225"/>
<source>Gambia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="226"/>
<source>Guinea</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="227"/>
<source>Guadeloupe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="228"/>
<source>Equatorial Guinea</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="229"/>
<source>Greece</source>
<translation type="unfinished">Grèce</translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="230"/>
<source>South Georgia and the South Sandwich Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="231"/>
<source>Guatemala</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="232"/>
<source>Guam</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="233"/>
<source>Guinea-Bissau</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="234"/>
<source>Guyana</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="235"/>
<source>Hong Kong</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="236"/>
<source>Heard Island and McDonald Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="237"/>
<source>Honduras</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="238"/>
<source>Croatia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="239"/>
<source>Haiti</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="240"/>
<source>Hungary</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="241"/>
<source>Indonesia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="242"/>
<source>Ireland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="243"/>
<source>Israel</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="244"/>
<source>India</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="245"/>
<source>British Indian Ocean Territory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="246"/>
<source>Iraq</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="247"/>
<source>Iran, Islamic Republic of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="248"/>
<source>Iceland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="249"/>
<source>Italy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="250"/>
<source>Jamaica</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="251"/>
<source>Jordan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="252"/>
<source>Japan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="253"/>
<source>Kenya</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="254"/>
<source>Kyrgyzstan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="255"/>
<source>Cambodia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="256"/>
<source>Kiribati</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="257"/>
<source>Comoros</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="258"/>
<source>Saint Kitts and Nevis</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="259"/>
<source>Korea, Democratic People's Republic of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="260"/>
<source>Korea, Republic of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="261"/>
<source>Kuwait</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="262"/>
<source>Cayman Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="263"/>
<source>Kazakhstan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="264"/>
<source>Lao People's Democratic Republic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="265"/>
<source>Lebanon</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="266"/>
<source>Saint Lucia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="267"/>
<source>Liechtenstein</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="268"/>
<source>Sri Lanka</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="269"/>
<source>Liberia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="270"/>
<source>Lesotho</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="271"/>
<source>Lithuania</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="272"/>
<source>Luxembourg</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="273"/>
<source>Latvia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="274"/>
<source>Libyan Arab Jamahiriya</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="275"/>
<source>Morocco</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="276"/>
<source>Monaco</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="277"/>
<source>Moldova, Republic of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="278"/>
<source>Madagascar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="279"/>
<source>Marshall Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="280"/>
<source>Macedonia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="281"/>
<source>Mali</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="282"/>
<source>Myanmar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="283"/>
<source>Mongolia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="284"/>
<source>Macau</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="285"/>
<source>Northern Mariana Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="286"/>
<source>Martinique</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="287"/>
<source>Mauritania</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="288"/>
<source>Montserrat</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="289"/>
<source>Malta</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="290"/>
<source>Mauritius</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="291"/>
<source>Maldives</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="292"/>
<source>Malawi</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="293"/>
<source>Mexico</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="294"/>
<source>Malaysia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="295"/>
<source>Mozambique</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="296"/>
<source>Namibia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="297"/>
<source>New Caledonia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="298"/>
<source>Niger</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="299"/>
<source>Norfolk Island</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="300"/>
<source>Nigeria</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="301"/>
<source>Nicaragua</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="302"/>
<source>Netherlands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="303"/>
<source>Norway</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="304"/>
<source>Nepal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="305"/>
<source>Nauru</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="306"/>
<source>Niue</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="307"/>
<source>New Zealand</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="308"/>
<source>Oman</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="309"/>
<source>Panama</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="310"/>
<source>Peru</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="311"/>
<source>French Polynesia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="312"/>
<source>Papua New Guinea</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="313"/>
<source>Philippines</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="314"/>
<source>Pakistan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="315"/>
<source>Poland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="316"/>
<source>Saint Pierre and Miquelon</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="317"/>
<source>Pitcairn Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="318"/>
<source>Puerto Rico</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="319"/>
<source>Palestinian Territory</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="320"/>
<source>Portugal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="321"/>
<source>Palau</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="322"/>
<source>Paraguay</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="323"/>
<source>Qatar</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="324"/>
<source>Reunion</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="325"/>
<source>Romania</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="326"/>
<source>Russian Federation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="327"/>
<source>Rwanda</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="328"/>
<source>Saudi Arabia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="329"/>
<source>Solomon Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="330"/>
<source>Seychelles</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="331"/>
<source>Sudan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="332"/>
<source>Sweden</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="333"/>
<source>Singapore</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="334"/>
<source>Saint Helena</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="335"/>
<source>Slovenia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="336"/>
<source>Svalbard and Jan Mayen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="337"/>
<source>Slovakia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="338"/>
<source>Sierra Leone</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="339"/>
<source>San Marino</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="340"/>
<source>Senegal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="341"/>
<source>Somalia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="342"/>
<source>Suriname</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="343"/>
<source>Sao Tome and Principe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="344"/>
<source>El Salvador</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="345"/>
<source>Syrian Arab Republic</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="346"/>
<source>Swaziland</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="347"/>
<source>Turks and Caicos Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="348"/>
<source>Chad</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="349"/>
<source>French Southern Territories</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="350"/>
<source>Togo</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="351"/>
<source>Thailand</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="352"/>
<source>Tajikistan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="353"/>
<source>Tokelau</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="354"/>
<source>Turkmenistan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="355"/>
<source>Tunisia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="356"/>
<source>Tonga</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="357"/>
<source>Timor-Leste</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="358"/>
<source>Turkey</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="359"/>
<source>Trinidad and Tobago</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="360"/>
<source>Tuvalu</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="361"/>
<source>Taiwan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="362"/>
<source>Tanzania, United Republic of</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="363"/>
<source>Ukraine</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="364"/>
<source>Uganda</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="365"/>
<source>United States Minor Outlying Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="366"/>
<source>United States</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="367"/>
<source>Uruguay</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="368"/>
<source>Uzbekistan</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="369"/>
<source>Holy See (Vatican City State)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="370"/>
<source>Saint Vincent and the Grenadines</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="371"/>
<source>Venezuela</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="372"/>
<source>Virgin Islands, British</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="373"/>
<source>Virgin Islands, U.S.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="374"/>
<source>Vietnam</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="375"/>
<source>Vanuatu</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="376"/>
<source>Wallis and Futuna</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="377"/>
<source>Samoa</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="378"/>
<source>Yemen</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="379"/>
<source>Mayotte</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="380"/>
<source>Serbia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="381"/>
<source>South Africa</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="382"/>
<source>Zambia</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="383"/>
<source>Montenegro</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="384"/>
<source>Zimbabwe</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="385"/>
<source>Anonymous Proxy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="386"/>
<source>Satellite Provider</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="387"/>
<source>Other</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="388"/>
<source>Aland Islands</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="389"/>
<source>Guernsey</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="390"/>
<source>Isle of Man</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="391"/>
<source>Jersey</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="392"/>
<source>Saint Barthelemy</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="393"/>
<source>Saint Martin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="421"/>
<source>Could not uncompress GeoIP database file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="442"/>
<source>Couldn't save downloaded GeoIP database file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="445"/>
<source>Successfully updated GeoIP database.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/geoipmanager.cpp" line="460"/>
<source>Couldn't download GeoIP database file. Reason: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Net::PortForwarder</name>
<message>
<location filename="../core/net/portforwarder.cpp" line="110"/>
<source>UPnP / NAT-PMP support [ON]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/portforwarder.cpp" line="119"/>
<source>UPnP / NAT-PMP support [OFF]</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Net::Smtp</name>
<message>
<location filename="../core/net/smtp.cpp" line="501"/>
<source>Email Notification Error:</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PeerListWidget</name>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="68"/>
<source>IP</source>
<translation>IP</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="69"/>
<source>Port</source>
<translation>Port</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="70"/>
<source>Flags</source>
<translation>Indicateurs</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="71"/>
<source>Connection</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="72"/>
<source>Client</source>
<comment>i.e.: Client application</comment>
<translation>Logiciel</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="73"/>
<source>Progress</source>
<comment>i.e: % downloaded</comment>
<translation>Progression</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="74"/>
<source>Down Speed</source>
<comment>i.e: Download speed</comment>
<translation>Vitesse DL</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="75"/>
<source>Up Speed</source>
<comment>i.e: Upload speed</comment>
<translation>Vitesse UP</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="76"/>
<source>Downloaded</source>
<comment>i.e: total data downloaded</comment>
<translation>Téléchargé</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="77"/>
<source>Uploaded</source>
<comment>i.e: total data uploaded</comment>
<translation>Envoyé</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="78"/>
<source>Relevance</source>
<comment>i.e: How relevant this peer is to us. How many pieces it has that we don't.</comment>
<translation>Pertinence</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="166"/>
<source>Add a new peer...</source>
<translation>Ajouter un nouveau pair…</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="172"/>
<source>Copy selected</source>
<translation>Copie sélectionnée</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="174"/>
<location filename="../gui/properties/peerlistwidget.cpp" line="212"/>
<source>Ban peer permanently</source>
<translation>Bloquer le pair indéfiniment</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="186"/>
<source>Manually adding peer '%1'...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="190"/>
<source>The peer '%1' could not be added to this torrent.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="223"/>
<source>Manually banning peer '%1'...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="194"/>
<location filename="../gui/properties/peerlistwidget.cpp" line="196"/>
<source>Peer addition</source>
<translation>Ajout d'un pair</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="194"/>
<source>Some peers could not be added. Check the Log for details.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="196"/>
<source>The peers were added to this torrent.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="212"/>
<source>Are you sure you want to ban permanently the selected peers?</source>
<translation>Êtes-vous sûr de vouloir bloquer les pairs sélectionnés ?</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="213"/>
<source>&Yes</source>
<translation>&Oui</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="213"/>
<source>&No</source>
<translation>&Non</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="388"/>
<source>interested(local) and choked(peer)</source>
<translation>intéressé (local) et engorgé (pair)</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="394"/>
<source>interested(local) and unchoked(peer)</source>
<translation>intéressé (local) et non engorgé (pair)</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="403"/>
<source>interested(peer) and choked(local)</source>
<translation>intéressé (pair) et engorgé (local)</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="409"/>
<source>interested(peer) and unchoked(local)</source>
<translation>intéressé (pair) et non engorgé (local)</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="417"/>
<source>optimistic unchoke</source>
<translation>non-étranglement optimiste</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="424"/>
<source>peer snubbed</source>
<translation>pair évité</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="431"/>
<source>incoming connection</source>
<translation>connexion entrante</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="438"/>
<source>not interested(local) and unchoked(peer)</source>
<translation>non intéressé (local) et non engorgé (pair)</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="445"/>
<source>not interested(peer) and unchoked(local)</source>
<translation>non intéressé (pair) et non engorgé (local)</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="452"/>
<source>peer from PEX</source>
<translation>pair issu de PEX</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="459"/>
<source>peer from DHT</source>
<translation>pair issu du DHT</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="466"/>
<source>encrypted traffic</source>
<translation>trafic chiffré</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="473"/>
<source>encrypted handshake</source>
<translation>poignée de main chiffrée</translation>
</message>
<message>
<location filename="../gui/properties/peerlistwidget.cpp" line="488"/>
<source>peer from LSD</source>
<translation>pair issu de LSD</translation>
</message>
</context>
<context>
<name>PeersAdditionDlg</name>
<message>
<location filename="../gui/properties/peersadditiondlg.cpp" line="58"/>
<source>No peer entered</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peersadditiondlg.cpp" line="59"/>
<source>Please type at least one peer.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peersadditiondlg.cpp" line="69"/>
<source>Invalid peer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peersadditiondlg.cpp" line="70"/>
<source>The peer '%1' is invalid.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PieceAvailabilityBar</name>
<message>
<location filename="../gui/properties/pieceavailabilitybar.cpp" line="39"/>
<source>White: Unavailable pieces</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/pieceavailabilitybar.cpp" line="39"/>
<source>Blue: Available pieces</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Preferences</name>
<message>
<location filename="../gui/options.ui" line="69"/>
<source>Downloads</source>
<translation>Téléchargements</translation>
</message>
<message>
<location filename="../gui/options.ui" line="80"/>
<source>Connection</source>
<translation>Connexion</translation>
</message>
<message>
<location filename="../gui/options.ui" line="91"/>
<source>Speed</source>
<translation>Vitesse</translation>
</message>
<message>
<location filename="../gui/options.ui" line="113"/>
<source>Web UI</source>
<translation>Interface web</translation>
</message>
<message>
<location filename="../gui/options.ui" line="124"/>
<source>Advanced</source>
<translation>Avancé</translation>
</message>
<message>
<location filename="../gui/options.ui" line="209"/>
<source>(Requires restart)</source>
<translation>(Redémarrage nécessaire)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="253"/>
<source>Use alternating row colors</source>
<extracomment>In transfer list, one every two rows will have grey background.</extracomment>
<translation>Alterner la couleur des lignes</translation>
</message>
<message>
<location filename="../gui/options.ui" line="295"/>
<location filename="../gui/options.ui" line="321"/>
<source>Start / Stop Torrent</source>
<translation>Démarrer / Arrêter torrent</translation>
</message>
<message>
<location filename="../gui/options.ui" line="305"/>
<location filename="../gui/options.ui" line="331"/>
<source>No action</source>
<translation>Aucune action</translation>
</message>
<message>
<location filename="../gui/options.ui" line="701"/>
<source>Append .!qB extension to incomplete files</source>
<translation>Ajouter l'extension .!qB aux noms des fichiers incomplets</translation>
</message>
<message>
<location filename="../gui/options.ui" line="804"/>
<source>Copy .torrent files to:</source>
<translation>Copier les fichiers .torrent dans :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1121"/>
<source>Connections Limits</source>
<translation>Limites de connexions</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1274"/>
<source>Proxy Server</source>
<translation>Serveur mandataire (proxy)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1577"/>
<source>Global Rate Limits</source>
<translation>Limites de vitesse globales</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1879"/>
<source>Apply rate limit to transport overhead</source>
<translation>Appliquer les limites de vitesse au surplus généré par le protocole</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1672"/>
<source>Schedule the use of alternative rate limits</source>
<translation>Planifier l'utilisation des vitesses limites alternatives</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1684"/>
<source>From:</source>
<extracomment>from (time1 to time2)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1708"/>
<source>To:</source>
<extracomment>time1 to time2</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1993"/>
<source>Enable Local Peer Discovery to find more peers</source>
<translation>Activer la découverte de sources sur le réseau local</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2005"/>
<source>Encryption mode:</source>
<translation>Mode de chiffrement :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2013"/>
<source>Prefer encryption</source>
<translation>Chiffrement préféré</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2018"/>
<source>Require encryption</source>
<translation>Chiffrement requis</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2023"/>
<source>Disable encryption</source>
<translation>Chiffrement désactivé</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2058"/>
<source> (<a href="http://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode">More information</a>)</source>
<translation>(<a href="http://github.com/qbittorrent/qBittorrent/wiki/Anonymous-Mode">Plus d'information</a>)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2101"/>
<source>Maximum active downloads:</source>
<translation>Nombre maximum de téléchargements actifs :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2121"/>
<source>Maximum active uploads:</source>
<translation>Nombre maximum d'envois actifs :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2141"/>
<source>Maximum active torrents:</source>
<translation>Nombre maximum de torrents actifs :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="537"/>
<source>When adding a torrent</source>
<translation>À l'ajout d'un torrent</translation>
</message>
<message>
<location filename="../gui/options.ui" line="58"/>
<source>Behavior</source>
<translation>Comportement</translation>
</message>
<message>
<location filename="../gui/options.ui" line="173"/>
<source>Language</source>
<translation>Langue</translation>
</message>
<message>
<location filename="../gui/options.ui" line="553"/>
<source>Display torrent content and some options</source>
<translation>Afficher le contenu du torrent et quelques paramètres</translation>
</message>
<message>
<location filename="../gui/options.ui" line="994"/>
<source>Run external program on torrent completion</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1057"/>
<source>Port used for incoming connections:</source>
<translation>Port pour les connexions entrantes :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1077"/>
<source>Random</source>
<translation>Aléatoire</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1127"/>
<source>Global maximum number of connections:</source>
<translation>Nombre maximum global de connexions :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1153"/>
<source>Maximum number of connections per torrent:</source>
<translation>Nombre maximum de connexions par torrent :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1176"/>
<source>Maximum number of upload slots per torrent:</source>
<translation>Nombre maximum d'emplacements d'envoi par torrent :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1599"/>
<location filename="../gui/options.ui" line="1790"/>
<source>Upload:</source>
<translation>Envoi :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1643"/>
<location filename="../gui/options.ui" line="1797"/>
<source>Download:</source>
<translation>Réception :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1606"/>
<location filename="../gui/options.ui" line="1629"/>
<location filename="../gui/options.ui" line="1836"/>
<location filename="../gui/options.ui" line="1843"/>
<source>KiB/s</source>
<translation>Kio/s</translation>
</message>
<message>
<location filename="../gui/options.ui" line="771"/>
<source>Remove folder</source>
<translation>Supprimer le dossier</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1749"/>
<source>Every day</source>
<translation>Tous les jours</translation>
</message>
<message utf8="true">
<location filename="../gui/options.ui" line="1977"/>
<source>Exchange peers with compatible Bittorrent clients (µTorrent, Vuze, ...)</source>
<translation>Échanger des pairs avec les applications compatibles (µTorrent, Vuze, …)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1316"/>
<source>Host:</source>
<translation>Hôte :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1295"/>
<source>SOCKS4</source>
<translation>SOCKS4</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1282"/>
<source>Type:</source>
<translation>Type :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="14"/>
<source>Options</source>
<translation>Options</translation>
</message>
<message>
<location filename="../gui/options.ui" line="269"/>
<source>Action on double-click</source>
<translation>Action du double-clic</translation>
</message>
<message>
<location filename="../gui/options.ui" line="278"/>
<source>Downloading torrents:</source>
<translation>Torrents incomplets :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="300"/>
<location filename="../gui/options.ui" line="326"/>
<source>Open destination folder</source>
<translation>Ouvrir le répertoire de destination</translation>
</message>
<message>
<location filename="../gui/options.ui" line="313"/>
<source>Completed torrents:</source>
<translation>Torrents complets :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="345"/>
<source>Desktop</source>
<translation>Bureau</translation>
</message>
<message>
<location filename="../gui/options.ui" line="358"/>
<source>Show splash screen on start up</source>
<translation>Afficher l'écran de démarrage</translation>
</message>
<message>
<location filename="../gui/options.ui" line="368"/>
<source>Start qBittorrent minimized</source>
<translation>Démarrer qBittorrent avec la fenêtre réduite</translation>
</message>
<message>
<location filename="../gui/options.ui" line="394"/>
<source>Minimize qBittorrent to notification area</source>
<translation>Réduire qBittorrent dans la zone de notification</translation>
</message>
<message>
<location filename="../gui/options.ui" line="404"/>
<source>Close qBittorrent to notification area</source>
<comment>i.e: The systray tray icon will still be visible when closing the main window.</comment>
<translation>Conserver dans la zone de notification à la fermeture</translation>
</message>
<message>
<location filename="../gui/options.ui" line="413"/>
<source>Tray icon style:</source>
<translation>Style de l'icône :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="421"/>
<source>Normal</source>
<translation>Normale</translation>
</message>
<message>
<location filename="../gui/options.ui" line="426"/>
<source>Monochrome (Dark theme)</source>
<translation>Monochrome (thème foncé)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="431"/>
<source>Monochrome (Light theme)</source>
<translation>Monochrome (thème clair)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="181"/>
<source>User Interface Language:</source>
<translation>Langue de l'interface utilisateur :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="237"/>
<source>Transfer List</source>
<translation>Liste des transferts</translation>
</message>
<message>
<location filename="../gui/options.ui" line="243"/>
<source>Confirm when deleting torrents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="351"/>
<source>Start qBittorrent on Windows start up</source>
<translation>Démarrer qBittorrent au lancement de Windows</translation>
</message>
<message>
<location filename="../gui/options.ui" line="375"/>
<source>Confirmation on exit when torrents are active</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="385"/>
<source>Show qBittorrent in notification area</source>
<translation>Afficher l'icône de qBittorrent dans la zone de notification</translation>
</message>
<message>
<location filename="../gui/options.ui" line="444"/>
<source>File association</source>
<translation>Association des fichiers</translation>
</message>
<message>
<location filename="../gui/options.ui" line="450"/>
<source>Use qBittorrent for .torrent files</source>
<translation>Utiliser qBittorrent pour les fichiers .torrent</translation>
</message>
<message>
<location filename="../gui/options.ui" line="457"/>
<source>Use qBittorrent for magnet links</source>
<translation>Utiliser qBittorrent pour les liens magnet</translation>
</message>
<message>
<location filename="../gui/options.ui" line="470"/>
<source>Power Management</source>
<translation>Gestion de l'énergie</translation>
</message>
<message>
<location filename="../gui/options.ui" line="476"/>
<source>Inhibit system sleep when torrents are active</source>
<translation>Empêcher la mise en veille lorsque des torrents sont actifs</translation>
</message>
<message>
<location filename="../gui/options.ui" line="546"/>
<source>Do not start the download automatically</source>
<comment>The torrent will be added to download list in pause state</comment>
<translation>Ne pas démarrer le téléchargement automatiquement</translation>
</message>
<message>
<location filename="../gui/options.ui" line="562"/>
<source>Bring torrent dialog to the front</source>
<translation>Mettre la boite de dialogue du torrent en avant-plan</translation>
</message>
<message>
<location filename="../gui/options.ui" line="584"/>
<source>Hard Disk</source>
<translation>Disque dur</translation>
</message>
<message>
<location filename="../gui/options.ui" line="590"/>
<source>Save files to location:</source>
<translation>Sauvegarder les fichiers vers :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="638"/>
<source>Append the label of the torrent to the save path</source>
<translation>Ajouter à la fin du chemin la catégorie du torrent</translation>
</message>
<message>
<location filename="../gui/options.ui" line="648"/>
<source>Pre-allocate disk space for all files</source>
<translation>Pré-allouer l'espace disque pour tous les fichiers</translation>
</message>
<message>
<location filename="../gui/options.ui" line="655"/>
<source>Keep incomplete torrents in:</source>
<translation>Conserver les torrents incomplets dans :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="708"/>
<source>Automatically add torrents from:</source>
<translation>Ajouter automatiquement les torrents présents dans :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="761"/>
<source>Add folder...</source>
<translation>Ajouter un dossier…</translation>
</message>
<message>
<location filename="../gui/options.ui" line="853"/>
<source>Copy .torrent files for finished downloads to:</source>
<translation>Copier les fichiers .torrent des téléchargements terminés dans :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="909"/>
<source>Email notification upon download completion</source>
<translation>Notification par courriel de fin de téléchargement</translation>
</message>
<message>
<location filename="../gui/options.ui" line="923"/>
<source>Destination email:</source>
<translation>Courriel de destination :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="933"/>
<source>SMTP server:</source>
<translation>Serveur SMTP :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="982"/>
<source>This server requires a secure connection (SSL)</source>
<translation>Ce serveur nécessite une connexion sécurisée (SSL)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1049"/>
<source>Listening Port</source>
<translation>Port d'écoute</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1099"/>
<source>Use UPnP / NAT-PMP port forwarding from my router</source>
<translation>Utiliser la redirection de port sur mon routeur via UPnP / NAT-PMP</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1109"/>
<source>Use different port on each startup</source>
<translation>Utiliser un port différent à chaque démarrage</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1235"/>
<source>Global maximum number of upload slots:</source>
<translation>Nombre maximum global d'emplacements d'envoi :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1370"/>
<source>Otherwise, the proxy server is only used for tracker connections</source>
<translation>Dans le cas contraire, le proxy sera uniquement utilisé pour contacter les trackers</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1373"/>
<source>Use proxy for peer connections</source>
<translation>Utiliser le serveur mandataire pour se connecter aux utilisateurs (pairs)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1380"/>
<source>Disable connections not supported by proxies</source>
<translation>Les connexions désactivées ne sont pas supportées par les proxys.</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1393"/>
<source>Use proxy only for torrents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1390"/>
<source>RSS feeds, search engine, software updates or anything else other than torrent transfers and related operations (such as peer exchanges) will use a direct connection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1462"/>
<source>Info: The password is saved unencrypted</source>
<translation>Information : le mot de passe est sauvegardé en clair</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1475"/>
<source>IP Filtering</source>
<translation>Filtrage IP</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1516"/>
<source>Reload the filter</source>
<translation>Recharger le filtre</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1532"/>
<source>Apply to trackers</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1872"/>
<source>Apply rate limit to peers on LAN</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1735"/>
<source>When:</source>
<translation>Quand :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1754"/>
<source>Weekdays</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1759"/>
<source>Weekends</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1866"/>
<source>Rate Limits Settings</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../gui/options.ui" line="1886"/>
<source>Enable µTP protocol</source>
<translation type="unfinished"></translation>
</message>
<message utf8="true">
<location filename="../gui/options.ui" line="1893"/>
<source>Apply rate limit to µTP protocol</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="1961"/>
<source>Privacy</source>
<translation>Vie privée</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1967"/>
<source>Enable DHT (decentralized network) to find more peers</source>
<translation>Activer le DHT (réseau décentralisé) pour trouver plus de pairs</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1980"/>
<source>Enable Peer Exchange (PeX) to find more peers</source>
<translation>Activer l'échange de pairs (PeX) avec les autres utilisateurs</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1990"/>
<source>Look for peers on your local network</source>
<translation>Rechercher des pairs sur votre réseau local</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2048"/>
<source>Enable when using a proxy or a VPN connection</source>
<translation>Activez quand vous utilisez une connexion par proxy ou par VPN</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2051"/>
<source>Enable anonymous mode</source>
<translation>Activer le mode anonyme</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2200"/>
<source>Do not count slow torrents in these limits</source>
<translation>Ne pas compter les torrents lents dans ces limites</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2221"/>
<source>Seed torrents until their ratio reaches</source>
<translation>Partager les torrents jusqu'à un ratio de</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2250"/>
<source>then</source>
<translation>puis</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2261"/>
<source>Pause them</source>
<translation>Les mettre en pause</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2266"/>
<source>Remove them</source>
<translation>Les supprimer</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2285"/>
<source>Automatically add these trackers to new downloads:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="2404"/>
<source>Use UPnP / NAT-PMP to forward the port from my router</source>
<translation>Utiliser la redirection de port sur mon routeur via UPnP / NAT-PMP</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2414"/>
<source>Use HTTPS instead of HTTP</source>
<translation>Utiliser HTTPS au lieu de HTTP</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2457"/>
<source>Import SSL Certificate</source>
<translation>Importer un certificat SSL</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2510"/>
<source>Import SSL Key</source>
<translation>Importer une clé SSL</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2445"/>
<source>Certificate:</source>
<translation>Certificat :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1666"/>
<source>Alternative Rate Limits</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options.ui" line="2498"/>
<source>Key:</source>
<translation>Clé :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2532"/>
<source><a href=http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html#aboutcerts>Information about certificates</a></source>
<translation><a href=http://httpd.apache.org/docs/2.2/ssl/ssl_faq.html#aboutcerts>Plus d'information sur les certificats</a></translation>
</message>
<message>
<location filename="../gui/options.ui" line="2577"/>
<source>Bypass authentication for localhost</source>
<translation>Contourner l'authentification pour localhost</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2601"/>
<source>Update my dynamic domain name</source>
<translation>Mettre à jour mon nom de domaine dynamique</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2613"/>
<source>Service:</source>
<translation>Service :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2636"/>
<source>Register</source>
<translation>Créer un compte</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2645"/>
<source>Domain name:</source>
<translation>Nom de domaine :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1290"/>
<source>(None)</source>
<translation>(Aucun)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="102"/>
<source>BitTorrent</source>
<translation>BitTorrent</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1305"/>
<source>HTTP</source>
<translation>HTTP</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1342"/>
<location filename="../gui/options.ui" line="2369"/>
<source>Port:</source>
<translation>Port :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="943"/>
<location filename="../gui/options.ui" line="1406"/>
<location filename="../gui/options.ui" line="2545"/>
<source>Authentication</source>
<translation>Authentification</translation>
</message>
<message>
<location filename="../gui/options.ui" line="955"/>
<location filename="../gui/options.ui" line="1420"/>
<location filename="../gui/options.ui" line="2584"/>
<location filename="../gui/options.ui" line="2659"/>
<source>Username:</source>
<translation>Nom d'utilisateur :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="965"/>
<location filename="../gui/options.ui" line="1440"/>
<location filename="../gui/options.ui" line="2591"/>
<location filename="../gui/options.ui" line="2673"/>
<source>Password:</source>
<translation>Mot de passe :</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2086"/>
<source>Torrent Queueing</source>
<translation>Priorisation des torrents</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2210"/>
<source>Share Ratio Limiting</source>
<translation>Limitation du ratio de partage</translation>
</message>
<message>
<location filename="../gui/options.ui" line="2355"/>
<source>Enable Web User Interface (Remote control)</source>
<translation>Activer l'interface web (contrôle distant)</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1300"/>
<source>SOCKS5</source>
<translation>SOCKS5</translation>
</message>
<message>
<location filename="../gui/options.ui" line="1487"/>
<source>Filter path (.dat, .p2p, .p2b):</source>
<translation>Chemin du filtre (.dat, .p2p, .p2b) :</translation>
</message>
<message>
<location filename="../core/preferences.cpp" line="79"/>
<source>Detected unclean program exit. Using fallback file to restore settings.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/preferences.cpp" line="174"/>
<source>An access error occurred while trying to write the configuration file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/preferences.cpp" line="176"/>
<source>A format error occurred while trying to write the configuration file.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>PreviewSelect</name>
<message>
<location filename="../gui/previewselect.cpp" line="54"/>
<source>Name</source>
<translation>Nom</translation>
</message>
<message>
<location filename="../gui/previewselect.cpp" line="55"/>
<source>Size</source>
<translation>Taille</translation>
</message>
<message>
<location filename="../gui/previewselect.cpp" line="56"/>
<source>Progress</source>
<translation>Progression</translation>
</message>
<message>
<location filename="../gui/previewselect.cpp" line="90"/>
<location filename="../gui/previewselect.cpp" line="127"/>
<source>Preview impossible</source>
<translation>Prévisualisation impossible</translation>
</message>
<message>
<location filename="../gui/previewselect.cpp" line="90"/>
<location filename="../gui/previewselect.cpp" line="127"/>
<source>Sorry, we can't preview this file</source>
<translation>Désolé, il est impossible de prévisualiser ce fichier</translation>
</message>
</context>
<context>
<name>PropListDelegate</name>
<message>
<location filename="../gui/properties/proplistdelegate.cpp" line="106"/>
<source>Not downloaded</source>
<translation>Non téléchargé</translation>
</message>
<message>
<location filename="../gui/properties/proplistdelegate.cpp" line="115"/>
<location filename="../gui/properties/proplistdelegate.cpp" line="162"/>
<source>Normal</source>
<comment>Normal (priority)</comment>
<translation>Normale</translation>
</message>
<message>
<location filename="../gui/properties/proplistdelegate.cpp" line="109"/>
<location filename="../gui/properties/proplistdelegate.cpp" line="163"/>
<source>High</source>
<comment>High (priority)</comment>
<translation>Haute</translation>
</message>
<message>
<location filename="../gui/properties/proplistdelegate.cpp" line="103"/>
<source>Mixed</source>
<comment>Mixed (priorities</comment>
<translation>Mixtes</translation>
</message>
<message>
<location filename="../gui/properties/proplistdelegate.cpp" line="112"/>
<location filename="../gui/properties/proplistdelegate.cpp" line="164"/>
<source>Maximum</source>
<comment>Maximum (priority)</comment>
<translation>Maximale</translation>
</message>
</context>
<context>
<name>PropTabBar</name>
<message>
<location filename="../gui/properties/proptabbar.cpp" line="46"/>
<source>General</source>
<translation>Général</translation>
</message>
<message>
<location filename="../gui/properties/proptabbar.cpp" line="51"/>
<source>Trackers</source>
<translation>Trackers</translation>
</message>
<message>
<location filename="../gui/properties/proptabbar.cpp" line="55"/>
<source>Peers</source>
<translation>Pairs</translation>
</message>
<message>
<location filename="../gui/properties/proptabbar.cpp" line="59"/>
<source>HTTP Sources</source>
<translation>Sources HTTP</translation>
</message>
<message>
<location filename="../gui/properties/proptabbar.cpp" line="63"/>
<source>Content</source>
<translation>Contenu</translation>
</message>
<message>
<location filename="../gui/properties/proptabbar.cpp" line="69"/>
<source>Speed</source>
<translation type="unfinished">Vitesse</translation>
</message>
</context>
<context>
<name>PropertiesWidget</name>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="336"/>
<source>Downloaded:</source>
<translation>Téléchargé :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="113"/>
<source>Availability:</source>
<translation>Disponibilité :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="84"/>
<source>Progress:</source>
<translation type="unfinished">Progression :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="160"/>
<source>Transfer</source>
<translation>Transfert</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="552"/>
<source>Time Active:</source>
<extracomment>Time (duration) the torrent is active (not paused)</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="581"/>
<source>ETA:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="510"/>
<source>Uploaded:</source>
<translation>Envoyé :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="439"/>
<source>Seeds:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="455"/>
<source>Download Speed:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="191"/>
<source>Upload Speed:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="220"/>
<source>Peers:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="278"/>
<source>Download Limit:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="352"/>
<source>Upload Limit:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="597"/>
<source>Wasted:</source>
<translation>Gaspillé :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="236"/>
<source>Connections:</source>
<translation>Connexions :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="610"/>
<source>Information</source>
<translation>Informations</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="869"/>
<source>Comment:</source>
<translation>Commentaire :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1054"/>
<source>Torrent content:</source>
<translation>Contenu du torrent :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1021"/>
<source>Select All</source>
<translation>Tout sélectionner</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1028"/>
<source>Select None</source>
<translation>Ne rien sélectionner</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1107"/>
<source>Normal</source>
<translation>Normale</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1102"/>
<source>High</source>
<translation>Haute</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="294"/>
<source>Share Ratio:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="410"/>
<source>Reannounce In:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="368"/>
<source>Last Seen Complete:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="628"/>
<source>Total Size:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="657"/>
<source>Pieces:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="686"/>
<source>Created By:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="715"/>
<source>Added On:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="744"/>
<source>Completed On:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="773"/>
<source>Created On:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="802"/>
<source>Torrent Hash:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="834"/>
<source>Save Path:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1097"/>
<source>Maximum</source>
<translation>Maximale</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.ui" line="1089"/>
<location filename="../gui/properties/propertieswidget.ui" line="1092"/>
<source>Do not download</source>
<translation>Ne pas télécharger</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="428"/>
<source>Never</source>
<translation type="unfinished">Jamais</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="435"/>
<source>%1 x %2 (have %3)</source>
<comment>(torrent pieces) eg 152 x 4MB (have 25)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="380"/>
<location filename="../gui/properties/propertieswidget.cpp" line="383"/>
<source>%1 (%2 this session)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="392"/>
<source>%1 (seeded for %2)</source>
<comment>e.g. 4m39s (seeded for 3m10s)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="399"/>
<source>%1 (%2 max)</source>
<comment>%1 and %2 are numbers, e.g. 3 (10 max)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="412"/>
<location filename="../gui/properties/propertieswidget.cpp" line="416"/>
<source>%1 (%2 total)</source>
<comment>%1 and %2 are numbers, e.g. 3 (10 total)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="420"/>
<location filename="../gui/properties/propertieswidget.cpp" line="424"/>
<source>%1 (%2 avg.)</source>
<comment>%1 and %2 are speed rates, e.g. 200KiB/s (100KiB/s avg.)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="565"/>
<source>Open</source>
<translation>Ouvert</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="566"/>
<source>Open Containing Folder</source>
<translation>Ouvrir le contenu du dossier</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="567"/>
<source>Rename...</source>
<translation>Renommer…</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="572"/>
<source>Priority</source>
<translation>Priorité</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="618"/>
<source>New Web seed</source>
<translation>Nouvelle source web</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="624"/>
<source>Remove Web seed</source>
<translation>Supprimer la source web</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="626"/>
<source>Copy Web seed URL</source>
<translation>Copier l'URL de la source web</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="627"/>
<source>Edit Web seed URL</source>
<translation>Modifier l'URL de la source web</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="652"/>
<source>Rename the file</source>
<translation>Renommer le fichier</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="653"/>
<source>New name:</source>
<translation>Nouveau nom :</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="657"/>
<location filename="../gui/properties/propertieswidget.cpp" line="688"/>
<source>The file could not be renamed</source>
<translation>Le fichier n'a pas pu être renommé</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="658"/>
<source>This file name contains forbidden characters, please choose a different one.</source>
<translation>Ce nom de fichier contient des caractères interdits, veuillez en choisir un autre.</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="689"/>
<location filename="../gui/properties/propertieswidget.cpp" line="727"/>
<source>This name is already in use in this folder. Please use a different name.</source>
<translation>Ce nom est déjà utilisé au sein de ce dossier. Veuillez choisir un nom différent.</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="726"/>
<source>The folder could not be renamed</source>
<translation>Le dossier n'a pas pu être renommé</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="829"/>
<source>qBittorrent</source>
<translation>qBittorrent</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="81"/>
<source>Filter files...</source>
<translation>Filtrer les fichiers…</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="772"/>
<source>New URL seed</source>
<comment>New HTTP source</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="773"/>
<source>New URL seed:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="779"/>
<location filename="../gui/properties/propertieswidget.cpp" line="830"/>
<source>This URL seed is already in the list.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="822"/>
<source>Web seed editing</source>
<translation>Modification de la source web</translation>
</message>
<message>
<location filename="../gui/properties/propertieswidget.cpp" line="823"/>
<source>Web seed URL:</source>
<translation>URL de la source web :</translation>
</message>
</context>
<context>
<name>QObject</name>
<message>
<location filename="../webui/abstractwebapplication.cpp" line="110"/>
<source>Your IP address has been banned after too many failed authentication attempts.</source>
<translation>Votre adresse IP a été bannie après un nombre excessif de tentatives d'authentification échouées.</translation>
</message>
<message>
<location filename="../webui/webapplication.cpp" line="340"/>
<source>Error: '%1' is not a valid torrent file.
</source>
<translation>Erreur : « %1 » n'est pas un fichier torrent valide.
</translation>
</message>
<message>
<location filename="../webui/webapplication.cpp" line="345"/>
<source>Error: Could not add torrent to session.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../webui/webapplication.cpp" line="354"/>
<source>I/O Error: Could not create temporary file.</source>
<translation>Erreur d'entrée/sortie : le fichier temporaire n'a pas pu être créé.</translation>
</message>
<message>
<location filename="../app/main.cpp" line="140"/>
<source>%1 is an unknown command line parameter.</source>
<comment>--random-parameter is an unknown command line parameter.</comment>
<translation> %1 est un paramètre de ligne de commande inconnu.</translation>
</message>
<message>
<location filename="../app/main.cpp" line="152"/>
<location filename="../app/main.cpp" line="165"/>
<source>%1 must be the single command line parameter.</source>
<translation>%1 doit être le paramètre de ligne de commande unique.</translation>
</message>
<message>
<location filename="../app/main.cpp" line="175"/>
<source>%1 must specify the correct port (1 to 65535).</source>
<translation>%1 doit spécifier le port correct (1 à 65535).</translation>
</message>
<message>
<location filename="../app/main.cpp" line="199"/>
<source>You cannot use %1: qBittorrent is already running for this user.</source>
<translation>Vous ne pouvez pas utiliser% 1: qBittorrent est déjà en cours d'exécution pour cet utilisateur.</translation>
</message>
<message>
<location filename="../app/main.cpp" line="384"/>
<source>Usage:</source>
<translation>Utilisation :</translation>
</message>
<message>
<location filename="../app/main.cpp" line="397"/>
<source>Options:</source>
<translation>Options</translation>
</message>
<message>
<location filename="../app/main.cpp" line="399"/>
<source>Displays program version</source>
<translation>Afficher la version du programme</translation>
</message>
<message>
<location filename="../app/main.cpp" line="401"/>
<source>Displays this help message</source>
<translation>Afficher ce message d'aide</translation>
</message>
<message>
<location filename="../app/main.cpp" line="403"/>
<source>Changes the Web UI port (current: %1)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/main.cpp" line="406"/>
<source>Disable splash screen</source>
<translation>Désactiver l'écran de démarrage</translation>
</message>
<message>
<location filename="../app/main.cpp" line="408"/>
<source>Run in daemon-mode (background)</source>
<translation>Exécuter en tâche de fond</translation>
</message>
<message>
<location filename="../app/main.cpp" line="410"/>
<source>Downloads the torrents passed by the user</source>
<translation>Télécharger les torrents transmis par l'utilisateur</translation>
</message>
<message>
<location filename="../app/main.cpp" line="420"/>
<source>Help</source>
<translation>Aide</translation>
</message>
<message>
<location filename="../app/main.cpp" line="429"/>
<source>Run application with -h option to read about command line parameters.</source>
<translation>Exécuter le programme avec l'option -h pour afficher les paramètres de ligne de commande.</translation>
</message>
<message>
<location filename="../app/main.cpp" line="431"/>
<source>Bad command line</source>
<translation>Mauvaise ligne de commande</translation>
</message>
<message>
<location filename="../app/main.cpp" line="437"/>
<source>Bad command line: </source>
<translation>Mauvaise ligne de commande :</translation>
</message>
<message>
<location filename="../app/main.cpp" line="450"/>
<source>Legal Notice</source>
<translation>Information légale</translation>
</message>
<message>
<location filename="../app/main.cpp" line="451"/>
<location filename="../app/main.cpp" line="461"/>
<source>qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility.
No further notices will be issued.</source>
<translation>qBittorrent est un logiciel de partage de fichiers. Lors de l'ajout d'un torrent, les données que vous téléchargez sont mises à disposition des autres utilisateurs. Vous êtes responsable du contenu que vous partagez.
Ce message d'avertissement ne sera plus affiché.</translation>
</message>
<message>
<location filename="../app/main.cpp" line="452"/>
<source>Press %1 key to accept and continue...</source>
<translation>Appuyez sur la touche %1 pour accepter et continuer…</translation>
</message>
<message>
<location filename="../app/main.cpp" line="462"/>
<source>Legal notice</source>
<translation>Information légale</translation>
</message>
<message>
<location filename="../app/main.cpp" line="463"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
<location filename="../app/main.cpp" line="464"/>
<source>I Agree</source>
<translation>J'accepte</translation>
</message>
<message>
<location filename="../app/application.cpp" line="122"/>
<source>Torrent name: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/application.cpp" line="123"/>
<source>Torrent size: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/application.cpp" line="124"/>
<source>Save path: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/application.cpp" line="125"/>
<source>The torrent was downloaded in %1.</source>
<comment>The torrent was downloaded in 1 hour and 20 seconds</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/application.cpp" line="128"/>
<source>Thank you for using qBittorrent.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/application.cpp" line="134"/>
<source>[qBittorrent] '%1' has finished downloading</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="204"/>
<source>The remote host name was not found (invalid hostname)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="206"/>
<source>The operation was canceled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="208"/>
<source>The remote server closed the connection prematurely, before the entire reply was received and processed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="210"/>
<source>The connection to the remote server timed out</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="212"/>
<source>SSL/TLS handshake failed</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="214"/>
<source>The remote server refused the connection</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="216"/>
<source>The connection to the proxy server was refused</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="218"/>
<source>The proxy server closed the connection prematurely</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="220"/>
<source>The proxy host name was not found</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="222"/>
<source>The connection to the proxy timed out or the proxy did not reply in time to the request sent</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="224"/>
<source>The proxy requires authentication in order to honor the request but did not accept any credentials offered</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="226"/>
<source>The access to the remote content was denied (401)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="228"/>
<source>The operation requested on the remote content is not permitted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="230"/>
<source>The remote content was not found at the server (404)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="232"/>
<source>The remote server requires authentication to serve the content but the credentials provided were not accepted</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="234"/>
<source>The Network Access API cannot honor the request because the protocol is not known</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="236"/>
<source>The requested operation is invalid for this protocol</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="238"/>
<source>An unknown network-related error was detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="240"/>
<source>An unknown proxy-related error was detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="242"/>
<source>An unknown error related to the remote content was detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="244"/>
<source>A breakdown in protocol was detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/net/downloadhandler.cpp" line="246"/>
<source>Unknown error</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/upgrade.h" line="50"/>
<location filename="../app/upgrade.h" line="63"/>
<source>Upgrade</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/upgrade.h" line="53"/>
<source>You updated from an older version that saved things differently. You must migrate to the new saving system. You will not be able to use an older version than v3.3.0 again. Continue? [y/n]</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/upgrade.h" line="62"/>
<source>You updated from an older version that saved things differently. You must migrate to the new saving system. If you continue, you will not be able to use an older version than v3.3.0 again.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/upgrade.h" line="121"/>
<source>Couldn't migrate torrent with hash: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../app/upgrade.h" line="124"/>
<source>Couldn't migrate torrent. Invalid fastresume file name: %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RSS</name>
<message>
<location filename="../gui/rss/rss.ui" line="17"/>
<source>Search</source>
<translation>Rechercher</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="31"/>
<source>New subscription</source>
<translation>Nouvelle souscription</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="47"/>
<location filename="../gui/rss/rss.ui" line="195"/>
<location filename="../gui/rss/rss.ui" line="198"/>
<source>Mark items read</source>
<translation>Marquer comme lu</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="66"/>
<source>Update all</source>
<translation>Tout mettre à jour</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="95"/>
<source>RSS Downloader...</source>
<translation>Téléchargeur de RSS…</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="102"/>
<source>Settings...</source>
<translation>Paramètres…</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="124"/>
<source>Torrents: (double-click to download)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="158"/>
<location filename="../gui/rss/rss.ui" line="161"/>
<source>Delete</source>
<translation>Supprimer</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="166"/>
<source>Rename...</source>
<translation>Renommer…</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="169"/>
<source>Rename</source>
<translation>Renommer</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="174"/>
<location filename="../gui/rss/rss.ui" line="177"/>
<source>Update</source>
<translation>Mettre à jour</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="182"/>
<source>New subscription...</source>
<translation>Nouvelle souscription…</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="187"/>
<location filename="../gui/rss/rss.ui" line="190"/>
<source>Update all feeds</source>
<translation>Tout mettre à jour</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="203"/>
<source>Download torrent</source>
<translation>Télécharger le torrent</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="208"/>
<source>Open news URL</source>
<translation>Ouvrir l'URL de l'article</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="213"/>
<source>Copy feed URL</source>
<translation>Copier l'URL du flux</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="218"/>
<source>New folder...</source>
<translation>Nouveau dossier…</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="223"/>
<source>Manage cookies...</source>
<translation>Gestion des cookies…</translation>
</message>
<message>
<location filename="../gui/rss/rss.ui" line="63"/>
<source>Refresh RSS streams</source>
<translation>Rafraîchir les flux RSS</translation>
</message>
</context>
<context>
<name>RSSImp</name>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="218"/>
<source>Stream URL:</source>
<translation>URL du flux :</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="218"/>
<source>Please type a RSS stream URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="228"/>
<source>This RSS feed is already in the list.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="173"/>
<source>Please choose a folder name</source>
<translation>Veuillez indiquer un nom de dossier</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="173"/>
<source>Folder name:</source>
<translation>Nom du dossier :</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="173"/>
<source>New folder</source>
<translation>Nouveau dossier</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="254"/>
<source>Deletion confirmation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="255"/>
<source>Are you sure you want to delete the selected RSS feeds?</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="406"/>
<source>Please choose a new name for this RSS feed</source>
<translation>Veuillez choisir un nouveau nom pour ce flux RSS</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="406"/>
<source>New feed name:</source>
<translation>Nouveau nom du flux :</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="410"/>
<source>Name already in use</source>
<translation>Nom déjà utilisé</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="410"/>
<source>This name is already used by another item, please choose another one.</source>
<translation>Ce nom est déjà utilisé par un autre élément, veuillez en choisir un autre.</translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="580"/>
<source>Date: </source>
<translation>Date : </translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="582"/>
<source>Author: </source>
<translation>Auteur : </translation>
</message>
<message>
<location filename="../gui/rss/rss_imp.cpp" line="659"/>
<source>Unread</source>
<translation>Non lu</translation>
</message>
</context>
<context>
<name>RssFeed</name>
<message>
<location filename="../gui/rss/rssfeed.cpp" line="368"/>
<source>Automatic download of '%1' from '%2' RSS feed failed because it doesn't contain a torrent or a magnet link...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/rss/rssfeed.cpp" line="373"/>
<source>Automatically downloading '%1' torrent from '%2' RSS feed...</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RssParser</name>
<message>
<location filename="../gui/rss/rssparser.cpp" line="464"/>
<source>Failed to open downloaded RSS file.</source>
<translation>Échec de l'ouverture du fichier RSS téléchargé.</translation>
</message>
<message>
<location filename="../gui/rss/rssparser.cpp" line="501"/>
<source>Invalid RSS feed at '%1'.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>RssSettingsDlg</name>
<message>
<location filename="../gui/rss/rsssettingsdlg.ui" line="14"/>
<source>RSS Reader Settings</source>
<translation>Paramètres du lecteur RSS</translation>
</message>
<message>
<location filename="../gui/rss/rsssettingsdlg.ui" line="47"/>
<source>RSS feeds refresh interval:</source>
<translation>Intervalle de rafraîchissement des flux RSS :</translation>
</message>
<message>
<location filename="../gui/rss/rsssettingsdlg.ui" line="70"/>
<source>minutes</source>
<translation>minutes</translation>
</message>
<message>
<location filename="../gui/rss/rsssettingsdlg.ui" line="77"/>
<source>Maximum number of articles per feed:</source>
<translation>Numbre maximum d'articles par flux :</translation>
</message>
</context>
<context>
<name>ScanFoldersModel</name>
<message>
<location filename="../core/scanfoldersmodel.cpp" line="157"/>
<source>Watched Folder</source>
<translation>Répertoire surveillé</translation>
</message>
<message>
<location filename="../core/scanfoldersmodel.cpp" line="160"/>
<source>Download here</source>
<translation>Télécharger ici</translation>
</message>
<message>
<location filename="../core/scanfoldersmodel.cpp" line="163"/>
<source>Download path</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SearchCategories</name>
<message>
<location filename="../searchengine/supportedengines.h" line="53"/>
<source>All categories</source>
<translation>Toutes catégories</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="54"/>
<source>Movies</source>
<translation>Films</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="55"/>
<source>TV shows</source>
<translation>Séries TV</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="56"/>
<source>Music</source>
<translation>Musique</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="57"/>
<source>Games</source>
<translation>Jeux</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="58"/>
<source>Anime</source>
<translation>Animé</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="59"/>
<source>Software</source>
<translation>Logiciels</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="60"/>
<source>Pictures</source>
<translation>Photos</translation>
</message>
<message>
<location filename="../searchengine/supportedengines.h" line="61"/>
<source>Books</source>
<translation>Livres</translation>
</message>
</context>
<context>
<name>SearchEngine</name>
<message>
<location filename="../searchengine/searchengine.cpp" line="190"/>
<location filename="../searchengine/searchengine.cpp" line="220"/>
<location filename="../searchengine/searchengine.cpp" line="479"/>
<source>Search</source>
<translation>Rechercher</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="203"/>
<source>Please install Python to use the Search Engine.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="233"/>
<source>Empty search pattern</source>
<translation>Motif de recherche vide</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="233"/>
<source>Please type a search pattern first</source>
<translation>Veuillez entrer un motif de recherche</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="313"/>
<source>Searching...</source>
<translation>Recherche en cours…</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="316"/>
<source>Stop</source>
<translation>Arrêter</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="203"/>
<location filename="../searchengine/searchengine.cpp" line="453"/>
<source>Search Engine</source>
<translation>Moteur de recherche</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="453"/>
<location filename="../searchengine/searchengine.cpp" line="474"/>
<source>Search has finished</source>
<translation>Fin de la recherche</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="463"/>
<source>An error occurred during search...</source>
<translation>Une erreur s'est produite lors de la recherche…</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="461"/>
<location filename="../searchengine/searchengine.cpp" line="468"/>
<source>Search aborted</source>
<translation>La recherche a été interrompue</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="118"/>
<source>All enabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="119"/>
<source>All engines</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="122"/>
<location filename="../searchengine/searchengine.cpp" line="177"/>
<source>Multiple...</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="262"/>
<location filename="../searchengine/searchengine.cpp" line="334"/>
<source>Results <i>(%1)</i>:</source>
<comment>i.e: Search results</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="472"/>
<source>Search returned no results</source>
<translation>La recherche n'a retourné aucun résultat</translation>
</message>
<message>
<location filename="../searchengine/searchengine.cpp" line="561"/>
<source>Stopped</source>
<translation type="unfinished">Arrêtée</translation>
</message>
</context>
<context>
<name>SearchListDelegate</name>
<message>
<location filename="../searchengine/searchlistdelegate.h" line="60"/>
<location filename="../searchengine/searchlistdelegate.h" line="64"/>
<source>Unknown</source>
<translation type="unfinished">Inconnue</translation>
</message>
</context>
<context>
<name>SearchTab</name>
<message>
<location filename="../searchengine/searchtab.cpp" line="66"/>
<source>Name</source>
<comment>i.e: file name</comment>
<translation>Nom</translation>
</message>
<message>
<location filename="../searchengine/searchtab.cpp" line="67"/>
<source>Size</source>
<comment>i.e: file size</comment>
<translation>Taille</translation>
</message>
<message>
<location filename="../searchengine/searchtab.cpp" line="68"/>
<source>Seeders</source>
<comment>i.e: Number of full sources</comment>
<translation>Sources complètes</translation>
</message>
<message>
<location filename="../searchengine/searchtab.cpp" line="69"/>
<source>Leechers</source>
<comment>i.e: Number of partial sources</comment>
<translation>Sources partielles</translation>
</message>
<message>
<location filename="../searchengine/searchtab.cpp" line="70"/>
<source>Search engine</source>
<translation>Moteur de recherche</translation>
</message>
</context>
<context>
<name>ShutdownConfirmDlg</name>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="45"/>
<source>Exit confirmation</source>
<translation>Confirmation de quitter</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="46"/>
<source>Exit now</source>
<translation>Quitter maintenant</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="49"/>
<source>Shutdown confirmation</source>
<translation>Confirmation de l'extinction</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="50"/>
<source>Shutdown now</source>
<translation>Éteindre maintenant</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="109"/>
<source>qBittorrent will now exit unless you cancel within the next %1 seconds.</source>
<translation>qBittorrent va s’éteindre à moins que vous annuliez dans les prochaines %1 secondes.</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="112"/>
<source>The computer will now be switched off unless you cancel within the next %1 seconds.</source>
<translation>L’ordinateur va s’éteindre à moins que l’annuliez dans les prochaines %1 secondes.</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="115"/>
<source>The computer will now go to sleep mode unless you cancel within the next %1 seconds.</source>
<translation>L’ordinateur va passer en mode veille à moins que vous l’annuliez dans les %1 prochaines secondes.</translation>
</message>
<message>
<location filename="../gui/shutdownconfirm.cpp" line="118"/>
<source>The computer will now go to hibernation mode unless you cancel within the next %1 seconds.</source>
<translation>L’ordinateur va hiberner à moins que vous l’annuliez dans les %1 prochaines secondes.</translation>
</message>
</context>
<context>
<name>SpeedLimitDialog</name>
<message>
<location filename="../gui/speedlimitdlg.cpp" line="78"/>
<source>KiB/s</source>
<translation>Kio/s</translation>
</message>
</context>
<context>
<name>SpeedPlotView</name>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="47"/>
<source>Total Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="48"/>
<source>Total Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="52"/>
<source>Payload Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="53"/>
<source>Payload Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="57"/>
<source>Overhead Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="58"/>
<source>Overhead Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="62"/>
<source>DHT Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="63"/>
<source>DHT Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="67"/>
<source>Tracker Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedplotview.cpp" line="68"/>
<source>Tracker Download</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SpeedWidget</name>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="68"/>
<source>Period:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="71"/>
<source>1 Minute</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="72"/>
<source>5 Minutes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="73"/>
<source>30 Minutes</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="74"/>
<source>6 Hours</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="103"/>
<source>Select Graphs</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="79"/>
<source>Total Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="80"/>
<source>Total Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="81"/>
<source>Payload Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="82"/>
<source>Payload Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="83"/>
<source>Overhead Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="84"/>
<source>Overhead Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="85"/>
<source>DHT Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="86"/>
<source>DHT Download</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="87"/>
<source>Tracker Upload</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/speedwidget.cpp" line="88"/>
<source>Tracker Download</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StatsDialog</name>
<message>
<location filename="../gui/statsdialog.ui" line="14"/>
<source>Statistics</source>
<translation>Statistiques</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="20"/>
<source>User statistics</source>
<translation>Statistiques utilisateur</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="26"/>
<source>Total peer connections:</source>
<translation>Nombre total de connexions aux pairs :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="33"/>
<source>Global ratio:</source>
<translation>Ratio global :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="47"/>
<source>Alltime download:</source>
<translation>Téléchargé depuis la première utilisation :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="68"/>
<source>Alltime upload:</source>
<translation>Envoyé depuis la première utilisation :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="82"/>
<source>Total waste (this session):</source>
<translation>Total gaspillé (durant cette session) :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="99"/>
<source>Cache statistics</source>
<translation>Statistiques du tampon</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="105"/>
<source>Read cache Hits:</source>
<translation>Succès de tampon en lecture :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="126"/>
<source>Total buffers size:</source>
<translation>Taille totale des buffers :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="136"/>
<source>Performance statistics</source>
<translation>Statistiques de performance</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="170"/>
<source>Queued I/O jobs:</source>
<translation>Actions d'E/S en file d'attente :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="177"/>
<source>Write cache overload:</source>
<translation>Surcharge du tampon d'écriture :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="184"/>
<source>Average time in queue (ms):</source>
<translation>Temps moyen passé en file d'attente (ms) :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="191"/>
<source>Read cache overload:</source>
<translation>Surcharge du tampon de lecture :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="198"/>
<source>Total queued size:</source>
<translation>Taille totale des fichiers en file d'attente :</translation>
</message>
<message>
<location filename="../gui/statsdialog.ui" line="243"/>
<source>OK</source>
<translation>OK</translation>
</message>
</context>
<context>
<name>StatusBar</name>
<message>
<location filename="../gui/statusbar.cpp" line="59"/>
<location filename="../gui/statusbar.cpp" line="171"/>
<source>Connection status:</source>
<translation>Statut de la connexion :</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="59"/>
<location filename="../gui/statusbar.cpp" line="171"/>
<source>No direct connections. This may indicate network configuration problems.</source>
<translation>Aucune connexion directe. Ceci peut être signe d'une mauvaise configuration réseau.</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="73"/>
<location filename="../gui/statusbar.cpp" line="178"/>
<source>DHT: %1 nodes</source>
<translation>DHT : %1 nœuds</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="141"/>
<source>qBittorrent needs to be restarted</source>
<translation>qBittorrent doit être redémarré</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="151"/>
<source>qBittorrent was just updated and needs to be restarted for the changes to be effective.</source>
<translation>qBittorrent vient d'être mis à jour et doit être redémarré pour que les changements soient pris en compte.</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="163"/>
<location filename="../gui/statusbar.cpp" line="168"/>
<source>Connection Status:</source>
<translation>État de la connexion :</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="163"/>
<source>Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections.</source>
<translation>Hors ligne. Ceci signifie généralement que qBittorrent s'a pas pu se mettre en écoute sur le port défini pour les connexions entrantes.</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="168"/>
<source>Online</source>
<translation>Connecté</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="203"/>
<source>Click to switch to alternative speed limits</source>
<translation>Cliquez ici pour utiliser les limites de vitesse alternatives</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="199"/>
<source>Click to switch to regular speed limits</source>
<translation>Cliquez ici pour utiliser les limites de vitesse normales</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="212"/>
<source>Manual change of rate limits mode. The scheduler is disabled.</source>
<translation>Mode de changement manuel des limites de taux. Le planificateur est désactivé.</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="219"/>
<source>Global Download Speed Limit</source>
<translation>Limite globale de la vitesse de réception</translation>
</message>
<message>
<location filename="../gui/statusbar.cpp" line="245"/>
<source>Global Upload Speed Limit</source>
<translation>Limite globale de la vitesse d'envoi</translation>
</message>
</context>
<context>
<name>StatusFiltersWidget</name>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="117"/>
<source>All (0)</source>
<comment>this is for the status filter</comment>
<translation>Tous (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="120"/>
<source>Downloading (0)</source>
<translation>En Téléchargement (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="123"/>
<source>Seeding (0)</source>
<translation>En Partage (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="126"/>
<source>Completed (0)</source>
<translation>Terminés (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="129"/>
<source>Resumed (0)</source>
<translation>Démarrés (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="132"/>
<source>Paused (0)</source>
<translation>En Pause (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="135"/>
<source>Active (0)</source>
<translation>Actifs (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="138"/>
<source>Inactive (0)</source>
<translation>Inactifs (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="141"/>
<source>Errored (0)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="158"/>
<source>All (%1)</source>
<translation>Tous (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="159"/>
<source>Downloading (%1)</source>
<translation>En Téléchargement (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="160"/>
<source>Seeding (%1)</source>
<translation>En Partage (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="161"/>
<source>Completed (%1)</source>
<translation>Terminés (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="162"/>
<source>Paused (%1)</source>
<translation>En Pause (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="163"/>
<source>Resumed (%1)</source>
<translation>Démarrés (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="164"/>
<source>Active (%1)</source>
<translation>Actifs (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="165"/>
<source>Inactive (%1)</source>
<translation>Inactifs (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="166"/>
<source>Errored (%1)</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>TorrentContentModel</name>
<message>
<location filename="../gui/torrentcontentmodel.cpp" line="56"/>
<source>Name</source>
<translation>Nom</translation>
</message>
<message>
<location filename="../gui/torrentcontentmodel.cpp" line="56"/>
<source>Size</source>
<translation>Taille</translation>
</message>
<message>
<location filename="../gui/torrentcontentmodel.cpp" line="57"/>
<source>Progress</source>
<translation>Progression</translation>
</message>
<message>
<location filename="../gui/torrentcontentmodel.cpp" line="57"/>
<source>Priority</source>
<translation>Priorité</translation>
</message>
</context>
<context>
<name>TorrentCreatorDlg</name>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="78"/>
<source>Select a folder to add to the torrent</source>
<translation>Sélectionner un dossier à ajouter au torrent</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="92"/>
<source>Select a file to add to the torrent</source>
<translation>Sélectionner un fichier à ajouter au torrent</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="114"/>
<source>No input path set</source>
<translation>Aucun fichier inclu</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="114"/>
<source>Please type an input path first</source>
<translation>Veuillez sélectionner un fichier ou un dossier à inclure d'abord</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="124"/>
<source>Select destination torrent file</source>
<translation>Sélectionner le torrent à créer</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="124"/>
<source>Torrent Files (*.torrent)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="176"/>
<source>Torrent was created successfully: %1</source>
<comment>%1 is the path of the torrent</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="152"/>
<location filename="../gui/torrentcreatordlg.cpp" line="165"/>
<location filename="../gui/torrentcreatordlg.cpp" line="176"/>
<source>Torrent creation</source>
<translation>Création d'un torrent</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="152"/>
<source>Torrent creation was unsuccessful, reason: %1</source>
<translation>La création du torrent a échoué, raison : %1</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.cpp" line="165"/>
<source>Created torrent file is invalid. It won't be added to download list.</source>
<translation>Le torrent créé est invalide. Il ne sera pas ajouté à la liste des téléchargements.</translation>
</message>
</context>
<context>
<name>TorrentImportDlg</name>
<message>
<location filename="../gui/torrentimportdlg.ui" line="14"/>
<source>Torrent Import</source>
<translation>Import de torrent</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.ui" line="53"/>
<source>This assistant will help you share with qBittorrent a torrent that you have already downloaded.</source>
<translation>Cet assistant va vous aider à partager avec qBittorrent un torrent que vous avez déjà téléchargé.</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.ui" line="65"/>
<source>Torrent file to import:</source>
<translation>Fichier torrent à importer :</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.ui" line="109"/>
<source>...</source>
<translation>…</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.ui" line="90"/>
<source>Content location:</source>
<translation>Chemin vers le contenu :</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.ui" line="121"/>
<source>Skip the data checking stage and start seeding immediately</source>
<translation>Ne pas procéder à la vérification et partager directement le torrent</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.ui" line="131"/>
<source>Import</source>
<translation>Importer</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="65"/>
<source>Torrent file to import</source>
<translation>Fichier torrent à importer</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="65"/>
<source>Torrent files</source>
<translation>Fichiers torrent</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="89"/>
<source>'%1' Files</source>
<comment>%1 is a file extension (e.g. PDF)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="91"/>
<source>Please provide the location of '%1'</source>
<comment>%1 is a file name</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="124"/>
<source>Please point to the location of the torrent: %1</source>
<translation>Veuillez indiquer le chemin vers le contenu du torrent : %1</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="222"/>
<source>Invalid torrent file</source>
<translation>Fichier torrent invalide</translation>
</message>
<message>
<location filename="../gui/torrentimportdlg.cpp" line="222"/>
<source>This is not a valid torrent file.</source>
<translation>Il ne s'agit pas d'un fichier torrent valide.</translation>
</message>
</context>
<context>
<name>TorrentModel</name>
<message>
<location filename="../gui/torrentmodel.cpp" line="97"/>
<source>Name</source>
<comment>i.e: torrent name</comment>
<translation>Nom</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="98"/>
<source>Size</source>
<comment>i.e: torrent size</comment>
<translation>Taille</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="99"/>
<source>Done</source>
<comment>% Done</comment>
<translation>Progression</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="100"/>
<source>Status</source>
<comment>Torrent status (e.g. downloading, seeding, paused)</comment>
<translation>Statut</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="101"/>
<source>Seeds</source>
<comment>i.e. full sources (often untranslated)</comment>
<translation>Sources</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="102"/>
<source>Peers</source>
<comment>i.e. partial sources (often untranslated)</comment>
<translation>Pairs</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="103"/>
<source>Down Speed</source>
<comment>i.e: Download speed</comment>
<translation>Vitesse DL</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="104"/>
<source>Up Speed</source>
<comment>i.e: Upload speed</comment>
<translation>Vitesse UP</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="105"/>
<source>Ratio</source>
<comment>Share ratio</comment>
<translation>Ratio</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="106"/>
<source>ETA</source>
<comment>i.e: Estimated Time of Arrival / Time left</comment>
<translation>Temps restant</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="107"/>
<source>Label</source>
<translation>Catégorie</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="108"/>
<source>Added On</source>
<comment>Torrent was added to transfer list on 01/01/2010 08:00</comment>
<translation>Ajouté le</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="109"/>
<source>Completed On</source>
<comment>Torrent was completed on 01/01/2010 08:00</comment>
<translation>Terminé le</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="110"/>
<source>Tracker</source>
<translation>Tracker</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="111"/>
<source>Down Limit</source>
<comment>i.e: Download limit</comment>
<translation>Limite réception</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="112"/>
<source>Up Limit</source>
<comment>i.e: Upload limit</comment>
<translation>Limite envoi</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="113"/>
<source>Downloaded</source>
<comment>Amount of data downloaded (e.g. in MB)</comment>
<translation>Téléchargé</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="114"/>
<source>Uploaded</source>
<comment>Amount of data uploaded (e.g. in MB)</comment>
<translation>Envoyé</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="115"/>
<source>Session Download</source>
<comment>Amount of data downloaded since program open (e.g. in MB)</comment>
<translation>Téléchargement de la session</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="116"/>
<source>Session Upload</source>
<comment>Amount of data uploaded since program open (e.g. in MB)</comment>
<translation>Émission de la session</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="117"/>
<source>Remaining</source>
<comment>Amount of data left to download (e.g. in MB)</comment>
<translation>Restant</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="118"/>
<source>Time Active</source>
<comment>Time (duration) the torrent is active (not paused)</comment>
<translation>Actif pendant</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="119"/>
<source>Save path</source>
<comment>Torrent save path</comment>
<translation>Chemin d'enregistrement</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="120"/>
<source>Completed</source>
<comment>Amount of data completed (e.g. in MB)</comment>
<translation>Terminé</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="121"/>
<source>Ratio Limit</source>
<comment>Upload share ratio limit</comment>
<translation>Limite de ratio</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="122"/>
<source>Last Seen Complete</source>
<comment>Indicates the time when the torrent was last seen complete/whole</comment>
<translation>Dernière fois vu complet</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="123"/>
<source>Last Activity</source>
<comment>Time passed since a chunk was downloaded/uploaded</comment>
<translation>Dernière activité</translation>
</message>
<message>
<location filename="../gui/torrentmodel.cpp" line="124"/>
<source>Total Size</source>
<comment>i.e. Size including unwanted data</comment>
<translation>Taille totale</translation>
</message>
</context>
<context>
<name>TrackerFiltersList</name>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="428"/>
<source>All (0)</source>
<comment>this is for the label filter</comment>
<translation>Tous (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="431"/>
<source>Trackerless (0)</source>
<translation>Sans tracker (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="434"/>
<source>Error (0)</source>
<translation>Erreur (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="437"/>
<source>Warning (0)</source>
<translation>Alerte (0)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="478"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="535"/>
<source>Trackerless (%1)</source>
<translation>Sans tracker (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="484"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="530"/>
<source>%1 (%2)</source>
<comment>openbittorrent.com (10)</comment>
<translation>%1 (%2)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="560"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="592"/>
<source>Error (%1)</source>
<translation>Erreur (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="573"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="607"/>
<source>Warning (%1)</source>
<translation>Alerte (%1)</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="635"/>
<source>Couldn't decode favicon for URL '%1'. Trying to download favicon in PNG format.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="640"/>
<source>Couldn't decode favicon for URL '%1'.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="654"/>
<source>Couldn't download favicon for URL '%1'. Reason: %2</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="663"/>
<source>Resume torrents</source>
<translation>Démarrer les torrents</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="664"/>
<source>Pause torrents</source>
<translation>Mettre en pause les torrents</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="665"/>
<source>Delete torrents</source>
<translation>Supprimer les torrents</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="699"/>
<location filename="../gui/transferlistfilterswidget.cpp" line="713"/>
<source>All (%1)</source>
<comment>this is for the tracker filter</comment>
<translation>Tous (%1)</translation>
</message>
</context>
<context>
<name>TrackerList</name>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="69"/>
<source>URL</source>
<translation>URL</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="70"/>
<source>Status</source>
<translation>Statut</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="71"/>
<source>Peers</source>
<translation>Pairs</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="72"/>
<source>Message</source>
<translation>Message</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="217"/>
<location filename="../gui/properties/trackerlist.cpp" line="286"/>
<source>Working</source>
<translation>Fonctionne</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="218"/>
<source>Disabled</source>
<translation>Désactivé</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="239"/>
<source>This torrent is private</source>
<translation>Ce torrent est privé</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="290"/>
<source>Updating...</source>
<translation>Mise à jour…</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="294"/>
<source>Not working</source>
<translation>Ne fonctionne pas</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="298"/>
<source>Not contacted yet</source>
<translation>Pas encore contacté</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="380"/>
<source>Tracker URL:</source>
<translation>URL du tracker :</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="380"/>
<source>Tracker editing</source>
<translation>Modification du tracker</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="386"/>
<location filename="../gui/properties/trackerlist.cpp" line="397"/>
<source>Tracker editing failed</source>
<translation>Échec de la modification du tracker</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="386"/>
<source>The tracker URL entered is invalid.</source>
<translation>L'URL du tracker fourni est invalide. </translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="397"/>
<source>The tracker URL already exists.</source>
<translation>L'URL du tracker existe déjà.</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="448"/>
<source>Add a new tracker...</source>
<translation>Ajouter un nouveau tracker…</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="454"/>
<source>Copy tracker URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="455"/>
<source>Edit selected tracker URL</source>
<translation>Modifier l'URL du tracker sélectionné</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="460"/>
<source>Force reannounce to selected trackers</source>
<translation>Forcer une nouvelle annonce aux trackers sélectionnés</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="462"/>
<source>Force reannounce to all trackers</source>
<translation>Forcer une nouvelle annonce à tous les trackers</translation>
</message>
<message>
<location filename="../gui/properties/trackerlist.cpp" line="453"/>
<source>Remove tracker</source>
<translation>Supprimer le tracker</translation>
</message>
</context>
<context>
<name>TrackersAdditionDlg</name>
<message>
<location filename="../gui/properties/trackersadditiondlg.ui" line="14"/>
<source>Trackers addition dialog</source>
<translation>Fenêtre d'ajout de trackers</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.ui" line="20"/>
<source>List of trackers to add (one per line):</source>
<translation>Liste des trackers à ajouter (un par ligne) :</translation>
</message>
<message utf8="true">
<location filename="../gui/properties/trackersadditiondlg.ui" line="44"/>
<source>µTorrent compatible list URL:</source>
<translation>URL de la liste compatible avec µTorrent :</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.cpp" line="73"/>
<source>I/O Error</source>
<translation>Erreur E/S</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.cpp" line="73"/>
<source>Error while trying to open the downloaded file.</source>
<translation>Erreur à l'ouverture du fichier téléchargé.</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.cpp" line="111"/>
<source>No change</source>
<translation>Aucun changement</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.cpp" line="111"/>
<source>No additional trackers were found.</source>
<translation>Aucun tracker supplémentaire n'est disponible.</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.cpp" line="119"/>
<source>Download error</source>
<translation>Erreur de téléchargement</translation>
</message>
<message>
<location filename="../gui/properties/trackersadditiondlg.cpp" line="119"/>
<source>The trackers list could not be downloaded, reason: %1</source>
<translation>La liste de trackers n'a pas pu être téléchargée, raison : %1</translation>
</message>
</context>
<context>
<name>TransferListDelegate</name>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="97"/>
<source>Downloading</source>
<translation>En téléchargement</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="103"/>
<source>Downloading metadata</source>
<comment>used when loading a magnet link</comment>
<translation>Téléchargement des métadonnées</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="109"/>
<source>Allocating</source>
<comment>qBittorrent is allocating the files on disk</comment>
<translation>Attribution</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="133"/>
<source>Paused</source>
<translation>En pause</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="120"/>
<source>Queued</source>
<comment>i.e. torrent is queued</comment>
<translation>En file d'attente</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="113"/>
<source>Seeding</source>
<comment>Torrent is complete and in upload-only mode</comment>
<translation>En partage</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="100"/>
<source>Stalled</source>
<comment>Torrent is waiting for download to begin</comment>
<translation>En attente</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="106"/>
<source>[F] Downloading</source>
<comment>used when the torrent is forced started. You probably shouldn't translate the F.</comment>
<translation>[F] Téléchargement</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="116"/>
<source>[F] Seeding</source>
<comment>used when the torrent is forced started. You probably shouldn't translate the F.</comment>
<translation>[F] Émission</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="124"/>
<source>Checking</source>
<comment>Torrent local data is being checked</comment>
<translation>Vérification</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="127"/>
<source>Queued for checking</source>
<comment>i.e. torrent is queued for hash checking</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="130"/>
<source>Checking resume data</source>
<comment>used when loading the torrents from disk after qbt is launched. It checks the correctness of the .fastresume file. Normally it is completed in a fraction of a second, unless loading many many torrents.</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="136"/>
<source>Completed</source>
<translation>Terminé</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="139"/>
<source>Missing Files</source>
<translation>Fichiers manquants</translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="142"/>
<source>Errored</source>
<comment>torrent status, the torrent has an error</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="172"/>
<source>%1 (seeded for %2)</source>
<comment>e.g. 4m39s (seeded for 3m10s)</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/transferlistdelegate.cpp" line="237"/>
<source>%1 ago</source>
<comment>e.g.: 1h 20m ago</comment>
<translation>il y a %1</translation>
</message>
</context>
<context>
<name>TransferListFiltersWidget</name>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="792"/>
<source>Status</source>
<translation>Statut</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="800"/>
<source>Labels</source>
<translation>Catégories</translation>
</message>
<message>
<location filename="../gui/transferlistfilterswidget.cpp" line="808"/>
<source>Trackers</source>
<translation>Trackers</translation>
</message>
</context>
<context>
<name>TransferListWidget</name>
<message>
<location filename="../gui/transferlistwidget.cpp" line="511"/>
<source>Column visibility</source>
<translation>Visibilité des colonnes</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="763"/>
<source>Label</source>
<translation>Catégorie</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="252"/>
<source>Choose save path</source>
<translation>Choix du répertoire de destination</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="439"/>
<source>Torrent Download Speed Limiting</source>
<translation>Limitation de la vitesse de réception</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="468"/>
<source>Torrent Upload Speed Limiting</source>
<translation>Limitation de la vitesse d'émission</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="499"/>
<source>Recheck confirmation</source>
<translation>Revérifier la confirmation</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="499"/>
<source>Are you sure you want to recheck the selected torrent(s)?</source>
<translation>Êtes-vous sur de vouloir revérifier le ou les torrent(s) sélectionné(s) ?</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="575"/>
<source>New Label</source>
<translation>Nouvelle catégorie</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="575"/>
<source>Label:</source>
<translation>Catégorie :</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="581"/>
<source>Invalid label name</source>
<translation>Nom de catégorie incorrect</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="581"/>
<source>Please don't use any special characters in the label name.</source>
<translation>N'utilisez pas de caractères spéciaux dans le nom de catégorie.</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="600"/>
<source>Rename</source>
<translation>Renommer</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="600"/>
<source>New name:</source>
<translation>Nouveau nom :</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="629"/>
<source>Resume</source>
<comment>Resume/start the torrent</comment>
<translation>Démarrer</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="633"/>
<source>Force Resume</source>
<comment>Force Resume/start the torrent</comment>
<translation>Forcer la reprise</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="631"/>
<source>Pause</source>
<comment>Pause the torrent</comment>
<translation>Mettre en pause</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="635"/>
<source>Delete</source>
<comment>Delete the torrent</comment>
<translation>Supprimer</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="637"/>
<source>Preview file...</source>
<translation>Prévisualiser le fichier…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="639"/>
<source>Limit share ratio...</source>
<translation>Limiter le ratio de partage…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="641"/>
<source>Limit upload rate...</source>
<translation>Limiter la vitesse d'envoi…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="643"/>
<source>Limit download rate...</source>
<translation>Limiter la vitesse de réception…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="645"/>
<source>Open destination folder</source>
<translation>Ouvrir le répertoire de destination</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="647"/>
<source>Move up</source>
<comment>i.e. move up in the queue</comment>
<translation>Déplacer vers le haut</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="649"/>
<source>Move down</source>
<comment>i.e. Move down in the queue</comment>
<translation>Déplacer vers le bas</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="651"/>
<source>Move to top</source>
<comment>i.e. Move to top of the queue</comment>
<translation>Déplacer tout en haut</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="653"/>
<source>Move to bottom</source>
<comment>i.e. Move to bottom of the queue</comment>
<translation>Déplacer tout en bas</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="655"/>
<source>Set location...</source>
<translation>Chemin de sauvegarde…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="661"/>
<source>Copy name</source>
<translation>Copier nom</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="813"/>
<source>Priority</source>
<translation>Priorité</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="657"/>
<source>Force recheck</source>
<translation>Forcer une revérification</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="659"/>
<source>Copy magnet link</source>
<translation>Copier le lien magnet</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="663"/>
<source>Super seeding mode</source>
<translation>Mode de super-partage</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="666"/>
<source>Rename...</source>
<translation>Renommer…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="668"/>
<source>Download in sequential order</source>
<translation>Téléchargement séquentiel</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="671"/>
<source>Download first and last piece first</source>
<translation>Téléchargement prioritaire du début et de la fin</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="764"/>
<source>New...</source>
<comment>New label...</comment>
<translation>Nouvelle catégorie…</translation>
</message>
<message>
<location filename="../gui/transferlistwidget.cpp" line="765"/>
<source>Reset</source>
<comment>Reset label</comment>
<translation>Réinitialiser la catégorie</translation>
</message>
</context>
<context>
<name>UpDownRatioDlg</name>
<message>
<location filename="../gui/updownratiodlg.ui" line="14"/>
<source>Torrent Upload/Download Ratio Limiting</source>
<translation>Limitation du ratio de partage</translation>
</message>
<message>
<location filename="../gui/updownratiodlg.ui" line="20"/>
<source>Use global ratio limit</source>
<translation>Utiliser la limite globale</translation>
</message>
<message>
<location filename="../gui/updownratiodlg.ui" line="23"/>
<location filename="../gui/updownratiodlg.ui" line="33"/>
<location filename="../gui/updownratiodlg.ui" line="45"/>
<source>buttonGroup</source>
<translation>buttonGroup</translation>
</message>
<message>
<location filename="../gui/updownratiodlg.ui" line="30"/>
<source>Set no ratio limit</source>
<translation>Ne pas limiter le ratio</translation>
</message>
<message>
<location filename="../gui/updownratiodlg.ui" line="42"/>
<source>Set ratio limit to</source>
<translation>Limiter le ratio à</translation>
</message>
</context>
<context>
<name>WebUI</name>
<message>
<location filename="../webui/webui.cpp" line="84"/>
<source>The Web UI is listening on port %1</source>
<translation>L'interface web est associée au port %1</translation>
</message>
<message>
<location filename="../webui/webui.cpp" line="86"/>
<source>Web UI Error - Unable to bind Web UI to port %1</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>about</name>
<message>
<location filename="../gui/about_imp.h" line="55"/>
<source>An advanced BitTorrent client programmed in <nobr>C++</nobr>, based on Qt toolkit and libtorrent-rasterbar.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/about_imp.h" line="57"/>
<source>Copyright %1 2006-2015 The qBittorrent project</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/about_imp.h" line="59"/>
<source>Home Page: </source>
<translation>Site officiel :</translation>
</message>
<message>
<location filename="../gui/about_imp.h" line="61"/>
<source>Bug Tracker: </source>
<translation>Suivi des bogues :</translation>
</message>
<message>
<location filename="../gui/about_imp.h" line="63"/>
<source>Forum: </source>
<translation>Forum :</translation>
</message>
<message>
<location filename="../gui/about_imp.h" line="66"/>
<source>IRC: #qbittorrent on Freenode</source>
<translation>IRC : #qbittorrent sur freenode</translation>
</message>
</context>
<context>
<name>addPeersDialog</name>
<message>
<location filename="../gui/properties/peersadditiondlg.ui" line="14"/>
<source>Add Peers</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peersadditiondlg.ui" line="20"/>
<source>List of peers to add (one per line):</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/properties/peersadditiondlg.ui" line="37"/>
<source>Format: IPv4:port / [IPv6]:port</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>authentication</name>
<message>
<location filename="../gui/login.ui" line="14"/>
<location filename="../gui/login.ui" line="47"/>
<source>Tracker authentication</source>
<translation>Authentification du tracker</translation>
</message>
<message>
<location filename="../gui/login.ui" line="64"/>
<source>Tracker:</source>
<translation>Tracker :</translation>
</message>
<message>
<location filename="../gui/login.ui" line="86"/>
<source>Login</source>
<translation>Authentification</translation>
</message>
<message>
<location filename="../gui/login.ui" line="94"/>
<source>Username:</source>
<translation>Nom d'utilisateur :</translation>
</message>
<message>
<location filename="../gui/login.ui" line="117"/>
<source>Password:</source>
<translation>Mot de passe :</translation>
</message>
<message>
<location filename="../gui/login.ui" line="154"/>
<source>Log in</source>
<translation>S'authentifier</translation>
</message>
<message>
<location filename="../gui/login.ui" line="161"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
</context>
<context>
<name>confirmDeletionDlg</name>
<message>
<location filename="../gui/confirmdeletiondlg.ui" line="20"/>
<source>Deletion confirmation - qBittorrent</source>
<translation>Confirmation de la suppression – qBittorrent</translation>
</message>
<message>
<location filename="../gui/confirmdeletiondlg.ui" line="67"/>
<source>Remember choice</source>
<translation>Se souvenir du choix</translation>
</message>
<message>
<location filename="../gui/confirmdeletiondlg.ui" line="94"/>
<source>Also delete the files on the hard disk</source>
<translation>Supprimer également les fichiers sur le disque</translation>
</message>
</context>
<context>
<name>createTorrentDialog</name>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="308"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="14"/>
<source>Torrent Creation Tool</source>
<translation>Utilitaire de création de torrent</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="38"/>
<source>Torrent file creation</source>
<translation>Création d'un fichier torrent</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="60"/>
<source>Add file</source>
<translation>Ajouter un fichier</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="67"/>
<source>Add folder</source>
<translation>Ajouter un dossier</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="48"/>
<source>File or folder to add to the torrent:</source>
<translation>Fichier ou dossier à ajouter au torrent :</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="78"/>
<source>Tracker URLs:</source>
<translation>URL des trackers :</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="88"/>
<source>Web seeds urls:</source>
<translation>URL des sources web :</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="98"/>
<source>Comment:</source>
<translation>Commentaire :</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="127"/>
<source>You can separate tracker tiers / groups with an empty line.</source>
<comment>A tracker tier is a group of trackers, consisting of a main tracker and its mirrors.</comment>
<translation>Vous pouvez séparer les niveaux / groupes du tracker par une ligne vide.</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="148"/>
<source>Piece size:</source>
<translation>Taille des morceaux :</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="165"/>
<source>16 KiB</source>
<translation type="unfinished">512 Kio {16 ?}</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="170"/>
<source>32 KiB</source>
<translation>32 Kio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="175"/>
<source>64 KiB</source>
<translation>64 Kio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="180"/>
<source>128 KiB</source>
<translation>128 Kio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="185"/>
<source>256 KiB</source>
<translation>256 Kio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="190"/>
<source>512 KiB</source>
<translation>512 Kio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="195"/>
<source>1 MiB</source>
<translation>1 Mio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="200"/>
<source>2 MiB</source>
<translation>2 Mio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="205"/>
<source>4 MiB</source>
<translation>4 Mio</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="210"/>
<source>8 MiB</source>
<translation type="unfinished">4 Mio {8 ?}</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="215"/>
<source>16 MiB</source>
<translation type="unfinished">4 Mio {16 ?}</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="223"/>
<source>Auto</source>
<translation>Automatique</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="248"/>
<source>Private (won't be distributed on DHT network if enabled)</source>
<translation>Privé (ne sera pas distribué sur le réseau DHT si activé)</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="255"/>
<source>Start seeding after creation</source>
<translation>Commencer le partage directement</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="265"/>
<source>Ignore share ratio limits for this torrent</source>
<translation>Ignorer les limites du ratio de partage pour ce torrent</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="301"/>
<source>Create and save...</source>
<translation>Créer et sauvegarder…</translation>
</message>
<message>
<location filename="../gui/torrentcreatordlg.ui" line="272"/>
<source>Progress:</source>
<translation>Progression :</translation>
</message>
</context>
<context>
<name>downloadFromURL</name>
<message>
<location filename="../gui/downloadfromurldlg.ui" line="28"/>
<source>Add torrent links</source>
<translation>Ajout de liens vers des torrents</translation>
</message>
<message>
<location filename="../gui/downloadfromurldlg.ui" line="58"/>
<source>One per line (HTTP links, Magnet links and info-hashes are supported)</source>
<translation>Un par ligne (les liens HTTP, liens magnet et info-hachages sont supportés)</translation>
</message>
<message>
<location filename="../gui/downloadfromurldlg.ui" line="80"/>
<source>Download</source>
<translation>Télécharger</translation>
</message>
<message>
<location filename="../gui/downloadfromurldlg.ui" line="87"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
<message>
<location filename="../gui/downloadfromurldlg.ui" line="14"/>
<source>Download from urls</source>
<translation>Téléchargement depuis des URL</translation>
</message>
<message>
<location filename="../gui/downloadfromurldlg.h" line="96"/>
<source>No URL entered</source>
<translation>Aucune URL entrée</translation>
</message>
<message>
<location filename="../gui/downloadfromurldlg.h" line="96"/>
<source>Please type at least one URL.</source>
<translation>Veuillez entrer au moins une URL.</translation>
</message>
</context>
<context>
<name>engineSelect</name>
<message>
<location filename="../searchengine/engineselect.ui" line="17"/>
<source>Search plugins</source>
<translation>Greffons de recherche</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="30"/>
<source>Installed search engines:</source>
<translation>Moteurs de recherche installés :</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="50"/>
<source>Name</source>
<translation>Nom</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="55"/>
<source>Version</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="60"/>
<source>Url</source>
<translation>URL</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="65"/>
<location filename="../searchengine/engineselect.ui" line="124"/>
<source>Enabled</source>
<translation>Activé</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="83"/>
<source>You can get new search engine plugins here: <a href="http://plugins.qbittorrent.org">http://plugins.qbittorrent.org</a></source>
<translation>D’avantage de greffons de recherche ici : <a href="http://plugins.qbittorrent.org">http://plugins.qbittorrent.org</a></translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="98"/>
<source>Install a new one</source>
<translation>Installer un nouveau</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="105"/>
<source>Check for updates</source>
<translation>Mettre à jour</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="112"/>
<source>Close</source>
<translation>Fermer</translation>
</message>
<message>
<location filename="../searchengine/engineselect.ui" line="129"/>
<source>Uninstall</source>
<translation>Désinstaller</translation>
</message>
</context>
<context>
<name>engineSelectDlg</name>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="203"/>
<source>Uninstall warning</source>
<translation>Désinstallation</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="205"/>
<source>Uninstall success</source>
<translation>Désinstallation réussie</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="264"/>
<source>Invalid plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="264"/>
<source>The search engine plugin is invalid, please contact the author.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="270"/>
<source>A more recent version of '%1' search engine plugin is already installed.</source>
<comment>%1 is the name of the search engine</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="295"/>
<source>'%1' search engine plugin could not be updated, keeping old version.</source>
<comment>%1 is the name of the search engine</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="300"/>
<source>'%1' search engine plugin could not be installed.</source>
<comment>%1 is the name of the search engine</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="310"/>
<source>'%1' search engine plugin was successfully updated.</source>
<comment>%1 is the name of the search engine</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="313"/>
<source>'%1' search engine plugin was successfully installed.</source>
<comment>%1 is the name of the search engine</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="381"/>
<source>The link doesn't seem to point to a search engine plugin.</source>
<translation>Le lien ne semble pas pointer sur un plugin de moteur de recherche.</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="396"/>
<source>Select search plugins</source>
<translation>Sélectionnez les greffons</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="517"/>
<source>Sorry, '%1' search plugin installation failed.</source>
<comment>%1 is the name of the search engine</comment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="270"/>
<location filename="../searchengine/engineselectdlg.cpp" line="295"/>
<location filename="../searchengine/engineselectdlg.cpp" line="300"/>
<location filename="../searchengine/engineselectdlg.cpp" line="310"/>
<location filename="../searchengine/engineselectdlg.cpp" line="313"/>
<source>Search plugin install</source>
<translation>Installation d'un greffon de recherche</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="146"/>
<location filename="../searchengine/engineselectdlg.cpp" line="217"/>
<location filename="../searchengine/engineselectdlg.cpp" line="333"/>
<source>Yes</source>
<translation>Oui</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="149"/>
<location filename="../searchengine/engineselectdlg.cpp" line="183"/>
<location filename="../searchengine/engineselectdlg.cpp" line="220"/>
<location filename="../searchengine/engineselectdlg.cpp" line="336"/>
<source>No</source>
<translation>Non</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="397"/>
<source>qBittorrent search plugin</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="448"/>
<location filename="../searchengine/engineselectdlg.cpp" line="489"/>
<location filename="../searchengine/engineselectdlg.cpp" line="510"/>
<location filename="../searchengine/engineselectdlg.cpp" line="517"/>
<source>Search plugin update</source>
<translation>Mise à jour du greffon de recherche</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="489"/>
<location filename="../searchengine/engineselectdlg.cpp" line="510"/>
<source>Sorry, update server is temporarily unavailable.</source>
<translation>Désolé, le serveur de mise à jour est temporairement indisponible.</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="448"/>
<source>All your plugins are already up to date.</source>
<translation>Tous vos greffons de recherche sont déjà à jour.</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="205"/>
<source>All selected plugins were uninstalled successfully</source>
<translation>Tous les greffons sélectionnés ont été désinstallés avec succès</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="203"/>
<source>Some plugins could not be uninstalled because they are included in qBittorrent. Only the ones you added yourself can be uninstalled.
Those plugins were disabled.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="381"/>
<source>Invalid link</source>
<translation>Lien invalide</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="373"/>
<location filename="../searchengine/engineselectdlg.cpp" line="382"/>
<source>New search engine plugin URL</source>
<translation>Adresse du nouveau greffon de recherche</translation>
</message>
<message>
<location filename="../searchengine/engineselectdlg.cpp" line="374"/>
<location filename="../searchengine/engineselectdlg.cpp" line="383"/>
<source>URL:</source>
<translation>Adresse :</translation>
</message>
</context>
<context>
<name>errorDialog</name>
<message>
<location filename="../app/stacktrace_win_dlg.ui" line="14"/>
<source>Crash info</source>
<translation>Information de plantage</translation>
</message>
</context>
<context>
<name>fsutils</name>
<message>
<location filename="../core/utils/fs.cpp" line="444"/>
<location filename="../core/utils/fs.cpp" line="451"/>
<location filename="../core/utils/fs.cpp" line="461"/>
<location filename="../core/utils/fs.cpp" line="494"/>
<location filename="../core/utils/fs.cpp" line="506"/>
<source>Downloads</source>
<translation>Téléchargements</translation>
</message>
</context>
<context>
<name>misc</name>
<message>
<location filename="../core/utils/misc.cpp" line="82"/>
<source>B</source>
<comment>bytes</comment>
<translation>o</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="83"/>
<source>KiB</source>
<comment>kibibytes (1024 bytes)</comment>
<translation>Kio</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="84"/>
<source>MiB</source>
<comment>mebibytes (1024 kibibytes)</comment>
<translation>Mio</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="85"/>
<source>GiB</source>
<comment>gibibytes (1024 mibibytes)</comment>
<translation>Gio</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="86"/>
<source>TiB</source>
<comment>tebibytes (1024 gibibytes)</comment>
<translation>Tio</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="283"/>
<source>Python not detected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="311"/>
<source>Python version: %1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="338"/>
<source>/s</source>
<comment>per second</comment>
<translation>/s</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="426"/>
<source>%1h %2m</source>
<comment>e.g: 3hours 5minutes</comment>
<translation>%1h %2m</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="430"/>
<source>%1d %2h</source>
<comment>e.g: 2days 10hours</comment>
<translation>%1j %2h</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="326"/>
<source>Unknown</source>
<comment>Unknown (size)</comment>
<translation>Inconnue</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="206"/>
<source>qBittorrent will shutdown the computer now because all downloads are complete.</source>
<translation>qBittorrent va maintenant éteindre l'ordinateur car tous les téléchargements sont terminés.</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="419"/>
<source>< 1m</source>
<comment>< 1 minute</comment>
<translation>< 1min</translation>
</message>
<message>
<location filename="../core/utils/misc.cpp" line="422"/>
<source>%1m</source>
<comment>e.g: 10minutes</comment>
<translation>%1min</translation>
</message>
<message>
<location filename="../webui/btjson.cpp" line="388"/>
<source>Working</source>
<translation>Fonctionne</translation>
</message>
<message>
<location filename="../webui/btjson.cpp" line="386"/>
<source>Updating...</source>
<translation>Mise à jour…</translation>
</message>
<message>
<location filename="../webui/btjson.cpp" line="390"/>
<source>Not working</source>
<translation>Ne fonctionne pas</translation>
</message>
<message>
<location filename="../webui/btjson.cpp" line="384"/>
<source>Not contacted yet</source>
<translation>Pas encore contacté</translation>
</message>
</context>
<context>
<name>options_imp</name>
<message>
<location filename="../gui/options_imp.cpp" line="1249"/>
<location filename="../gui/options_imp.cpp" line="1251"/>
<source>Choose export directory</source>
<translation>Choisir un dossier pour l'export</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1289"/>
<location filename="../gui/options_imp.cpp" line="1291"/>
<location filename="../gui/options_imp.cpp" line="1302"/>
<location filename="../gui/options_imp.cpp" line="1304"/>
<source>Choose a save directory</source>
<translation>Choisir un répertoire de sauvegarde</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1202"/>
<source>Add directory to scan</source>
<translation>Ajouter un dossier à surveiller</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="185"/>
<source>Supported parameters (case sensitive):</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="186"/>
<source>%N: Torrent name</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="187"/>
<source>%L: Label</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="188"/>
<source>%F: Content path (same as root path for multifile torrent)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="189"/>
<source>%R: Root path (first torrent subdirectory path)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="190"/>
<source>%D: Save path</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="191"/>
<source>%C: Number of files</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="192"/>
<source>%Z: Torrent size (bytes)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="193"/>
<source>%T: Current tracker</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="194"/>
<source>%I: Info hash</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1209"/>
<source>Folder is already being watched.</source>
<translation>Ce dossier est déjà surveillé.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1212"/>
<source>Folder does not exist.</source>
<translation>Ce dossier n'existe pas.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1215"/>
<source>Folder is not readable.</source>
<translation>Ce dossier n'est pas accessible en lecture.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1225"/>
<source>Failure</source>
<translation>Échec</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1225"/>
<source>Failed to add Scan Folder '%1': %2</source>
<translation>Impossible d'ajouter le dossier surveillé « %1 » : %2</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1275"/>
<location filename="../gui/options_imp.cpp" line="1277"/>
<source>Filters</source>
<translation>Filtres</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1275"/>
<location filename="../gui/options_imp.cpp" line="1277"/>
<source>Choose an IP filter file</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1344"/>
<source>SSL Certificate</source>
<translation>Certificat SSL</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1356"/>
<source>SSL Key</source>
<translation>Clé SSL</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1389"/>
<source>Parsing error</source>
<translation>Erreur de traitement</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1389"/>
<source>Failed to parse the provided IP filter</source>
<translation>Impossible de charger le filtre IP fourni</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1391"/>
<source>Successfully refreshed</source>
<translation>Correctement rechargé</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1391"/>
<source>Successfully parsed the provided IP filter: %1 rules were applied.</source>
<comment>%1 is a number</comment>
<translation>Le filtre IP a été correctement chargé : %1 règles ont été appliquées.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1479"/>
<source>Invalid key</source>
<translation>Clé invalide</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1479"/>
<source>This is not a valid SSL key.</source>
<translation>Ceci n'est pas une clé SSL valide.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1495"/>
<source>Invalid certificate</source>
<translation>Certificat invalide</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1495"/>
<source>This is not a valid SSL certificate.</source>
<translation>Ceci n'est pas un certificat SSL valide.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1505"/>
<source>The start time and the end time can't be the same.</source>
<translation>Les heures de début et de fin ne peuvent être les mêmes.</translation>
</message>
<message>
<location filename="../gui/options_imp.cpp" line="1508"/>
<source>Time Error</source>
<translation>Erreur de temps</translation>
</message>
</context>
<context>
<name>pluginSourceDlg</name>
<message>
<location filename="../searchengine/pluginsource.ui" line="13"/>
<source>Plugin source</source>
<translation>Source du greffon</translation>
</message>
<message>
<location filename="../searchengine/pluginsource.ui" line="26"/>
<source>Search plugin source:</source>
<translation>Source du greffon de recherche :</translation>
</message>
<message>
<location filename="../searchengine/pluginsource.ui" line="35"/>
<source>Local file</source>
<translation>Fichier local</translation>
</message>
<message>
<location filename="../searchengine/pluginsource.ui" line="42"/>
<source>Web link</source>
<translation>Lien web</translation>
</message>
</context>
<context>
<name>preview</name>
<message>
<location filename="../gui/preview.ui" line="14"/>
<source>Preview selection</source>
<translation>Sélection du fichier à prévisualiser</translation>
</message>
<message>
<location filename="../gui/preview.ui" line="26"/>
<source>The following files support previewing, please select one of them:</source>
<translation>Les fichiers suivants prennent en charge la prévisualisation, sélectionnez-en un :</translation>
</message>
<message>
<location filename="../gui/preview.ui" line="61"/>
<source>Preview</source>
<translation>Prévisualiser</translation>
</message>
<message>
<location filename="../gui/preview.ui" line="68"/>
<source>Cancel</source>
<translation>Annuler</translation>
</message>
</context>
<context>
<name>search_engine</name>
<message>
<location filename="../searchengine/search.ui" line="14"/>
<location filename="../searchengine/search.ui" line="28"/>
<source>Search</source>
<translation>Recherche</translation>
</message>
<message>
<location filename="../searchengine/search.ui" line="51"/>
<source>Status:</source>
<translation>Statut :</translation>
</message>
<message>
<location filename="../searchengine/search.ui" line="75"/>
<source>Stopped</source>
<translation>Arrêtée</translation>
</message>
<message>
<location filename="../searchengine/search.ui" line="107"/>
<source>Download</source>
<translation>Télécharger</translation>
</message>
<message>
<location filename="../searchengine/search.ui" line="117"/>
<source>Go to description page</source>
<translation>Aller à la page de description</translation>
</message>
<message>
<location filename="../searchengine/search.ui" line="127"/>
<source>Copy description page URL</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../searchengine/search.ui" line="147"/>
<source>Search engines...</source>
<translation>Moteurs de recherche…</translation>
</message>
</context>
</TS>
| TheNain38/qBittorrent | src/lang/qbittorrent_fr.ts | TypeScript | gpl-2.0 | 343,896 |
/*
* Clock Manager - rtems_clock_get_tod
*
* COPYRIGHT (c) 1989-2007.
* On-Line Applications Research Corporation (OAR).
*
* The license and distribution terms for this file may be
* found in the file LICENSE in this distribution or at
* http://www.rtems.com/license/LICENSE.
*
* $Id: clockgettod.c,v 1.3 2009/11/30 15:59:55 ralf Exp $
*/
#if HAVE_CONFIG_H
#include "config.h"
#endif
#include <rtems/system.h>
#include <rtems/config.h>
#include <rtems/rtems/status.h>
#include <rtems/rtems/clock.h>
#include <rtems/score/isr.h>
#include <rtems/score/thread.h>
#include <rtems/score/tod.h>
#include <rtems/score/watchdog.h>
rtems_status_code rtems_clock_get_tod(
rtems_time_of_day *time_buffer
)
{
rtems_time_of_day *tmbuf = time_buffer;
struct tm time;
struct timeval now;
if ( !time_buffer )
return RTEMS_INVALID_ADDRESS;
if ( !_TOD_Is_set )
return RTEMS_NOT_DEFINED;
/* Obtain the current time */
_TOD_Get_timeval( &now );
/* Split it into a closer format */
gmtime_r( &now.tv_sec, &time );
/* Now adjust it to the RTEMS format */
tmbuf->year = time.tm_year + 1900;
tmbuf->month = time.tm_mon + 1;
tmbuf->day = time.tm_mday;
tmbuf->hour = time.tm_hour;
tmbuf->minute = time.tm_min;
tmbuf->second = time.tm_sec;
tmbuf->ticks = now.tv_usec /
rtems_configuration_get_microseconds_per_tick();
return RTEMS_SUCCESSFUL;
}
| yunusdawji/rtems-at91sam9g20ek | cpukit/rtems/src/clockgettod.c | C | gpl-2.0 | 1,405 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.4"/>
<title>CORE POS - IS4C: LocalTransTodayModel Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() {
if ($('.searchresults').length > 0) { searchBox.DOMSearchField().focus(); }
});
</script>
<link rel="search" href="search-opensearch.php?v=opensearch.xml" type="application/opensearchdescription+xml" title="CORE POS - IS4C"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">CORE POS - IS4C
</div>
<div id="projectbrief">The CORE POS front end</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.4 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
<li><a href="examples.html"><span>Examples</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<div class="left">
<form id="FSearchBox" action="search.php" method="get">
<img id="MSearchSelect" src="search/mag.png" alt=""/>
<input type="text" id="MSearchField" name="query" value="Search" size="20" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"/>
</form>
</div><div class="right"></div>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="#pro-attribs">Protected Attributes</a> |
<a href="class_local_trans_today_model-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">LocalTransTodayModel Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<div class="dynheader">
Inheritance diagram for LocalTransTodayModel:</div>
<div class="dyncontent">
<div class="center">
<img src="class_local_trans_today_model.png" usemap="#LocalTransTodayModel_map" alt=""/>
<map id="LocalTransTodayModel_map" name="LocalTransTodayModel_map">
<area href="class_local_trans_model.html" alt="LocalTransModel" shape="rect" coords="0,112,145,136"/>
<area href="class_d_transactions_model.html" alt="DTransactionsModel" shape="rect" coords="0,56,145,80"/>
<area href="class_basic_model.html" alt="BasicModel" shape="rect" coords="0,0,145,24"/>
</map>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a48eb532b9993bbad4b64e7b5f45a556f"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_local_trans_today_model.html#a48eb532b9993bbad4b64e7b5f45a556f">__construct</a> ($con)</td></tr>
<tr class="separator:a48eb532b9993bbad4b64e7b5f45a556f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aae5c835aaeeb5f1819967c2916d0dd37"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_local_trans_today_model.html#aae5c835aaeeb5f1819967c2916d0dd37">normalize</a> ($db_name, $mode=<a class="el" href="class_basic_model.html#a984e5d160a7f726db726054a46a2d0cc">BasicModel::NORMALIZE_MODE_CHECK</a>, $doCreate=False)</td></tr>
<tr class="separator:aae5c835aaeeb5f1819967c2916d0dd37"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_methods_class_local_trans_model"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_local_trans_model')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="class_local_trans_model.html">LocalTransModel</a></td></tr>
<tr class="memitem:ad050baf2b446a0b335872e42055f9e90 inherit pub_methods_class_local_trans_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad050baf2b446a0b335872e42055f9e90"></a>
 </td><td class="memItemRight" valign="bottom"><b>__construct</b> ($con)</td></tr>
<tr class="separator:ad050baf2b446a0b335872e42055f9e90 inherit pub_methods_class_local_trans_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_methods_class_d_transactions_model"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_d_transactions_model')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="class_d_transactions_model.html">DTransactionsModel</a></td></tr>
<tr class="memitem:a1f8bec14a8647b91759c36bf04490b35 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1f8bec14a8647b91759c36bf04490b35"></a>
 </td><td class="memItemRight" valign="bottom"><b>datetime</b> ()</td></tr>
<tr class="separator:a1f8bec14a8647b91759c36bf04490b35 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a60f7bba6301ca609071dd231c4aedd53 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a60f7bba6301ca609071dd231c4aedd53"></a>
 </td><td class="memItemRight" valign="bottom"><b>store_id</b> ()</td></tr>
<tr class="separator:a60f7bba6301ca609071dd231c4aedd53 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a17da49f18b004779d4c8c2d7bb8fd831 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a17da49f18b004779d4c8c2d7bb8fd831"></a>
 </td><td class="memItemRight" valign="bottom"><b>register_no</b> ()</td></tr>
<tr class="separator:a17da49f18b004779d4c8c2d7bb8fd831 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a81a0793936cfe9cf27fd3682699014da inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a81a0793936cfe9cf27fd3682699014da"></a>
 </td><td class="memItemRight" valign="bottom"><b>emp_no</b> ()</td></tr>
<tr class="separator:a81a0793936cfe9cf27fd3682699014da inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aac53e3e82e78136b1fd620cd854be7ee inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aac53e3e82e78136b1fd620cd854be7ee"></a>
 </td><td class="memItemRight" valign="bottom"><b>trans_no</b> ()</td></tr>
<tr class="separator:aac53e3e82e78136b1fd620cd854be7ee inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab76b38a996e2faf2b92912671675ab5b inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab76b38a996e2faf2b92912671675ab5b"></a>
 </td><td class="memItemRight" valign="bottom"><b>upc</b> ()</td></tr>
<tr class="separator:ab76b38a996e2faf2b92912671675ab5b inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a579fb260b5facaa566ed54e9f5883f7f inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a579fb260b5facaa566ed54e9f5883f7f"></a>
 </td><td class="memItemRight" valign="bottom"><b>description</b> ()</td></tr>
<tr class="separator:a579fb260b5facaa566ed54e9f5883f7f inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a46bbc2fb2e3c0cfab4540689c112850b inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a46bbc2fb2e3c0cfab4540689c112850b"></a>
 </td><td class="memItemRight" valign="bottom"><b>trans_type</b> ()</td></tr>
<tr class="separator:a46bbc2fb2e3c0cfab4540689c112850b inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2e8e17d4f10cae5b7fd439264ad4a03d inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2e8e17d4f10cae5b7fd439264ad4a03d"></a>
 </td><td class="memItemRight" valign="bottom"><b>trans_subtype</b> ()</td></tr>
<tr class="separator:a2e8e17d4f10cae5b7fd439264ad4a03d inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a9657c81203911569fd22fa9878380ba6 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9657c81203911569fd22fa9878380ba6"></a>
 </td><td class="memItemRight" valign="bottom"><b>trans_status</b> ()</td></tr>
<tr class="separator:a9657c81203911569fd22fa9878380ba6 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a449bed2fd768e401bcbc01a49986c76e inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a449bed2fd768e401bcbc01a49986c76e"></a>
 </td><td class="memItemRight" valign="bottom"><b>department</b> ()</td></tr>
<tr class="separator:a449bed2fd768e401bcbc01a49986c76e inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a6b9ebd5d30df815e57bdeaf6e8adedf1 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6b9ebd5d30df815e57bdeaf6e8adedf1"></a>
 </td><td class="memItemRight" valign="bottom"><b>quantity</b> ()</td></tr>
<tr class="separator:a6b9ebd5d30df815e57bdeaf6e8adedf1 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0d38cbd168a1a91d850024b50ee0f5f5 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0d38cbd168a1a91d850024b50ee0f5f5"></a>
 </td><td class="memItemRight" valign="bottom"><b>scale</b> ()</td></tr>
<tr class="separator:a0d38cbd168a1a91d850024b50ee0f5f5 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a05a43c61be5246cfa022ac4b3af6cbf6 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a05a43c61be5246cfa022ac4b3af6cbf6"></a>
 </td><td class="memItemRight" valign="bottom"><b>cost</b> ()</td></tr>
<tr class="separator:a05a43c61be5246cfa022ac4b3af6cbf6 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4758047599e50ec4e18650913b8b561a inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4758047599e50ec4e18650913b8b561a"></a>
 </td><td class="memItemRight" valign="bottom"><b>unitPrice</b> ()</td></tr>
<tr class="separator:a4758047599e50ec4e18650913b8b561a inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8389fa762259b3456e01db39cc548117 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8389fa762259b3456e01db39cc548117"></a>
 </td><td class="memItemRight" valign="bottom"><b>total</b> ()</td></tr>
<tr class="separator:a8389fa762259b3456e01db39cc548117 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af8a1e6f2dfe5b1486ad39317690edc32 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af8a1e6f2dfe5b1486ad39317690edc32"></a>
 </td><td class="memItemRight" valign="bottom"><b>regPrice</b> ()</td></tr>
<tr class="separator:af8a1e6f2dfe5b1486ad39317690edc32 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac1a0ff39c6cc1fc9e3783fdcf6d5ff44 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ac1a0ff39c6cc1fc9e3783fdcf6d5ff44"></a>
 </td><td class="memItemRight" valign="bottom"><b>tax</b> ()</td></tr>
<tr class="separator:ac1a0ff39c6cc1fc9e3783fdcf6d5ff44 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0a70e02c0ff074f7ca9e37c17dbc6e9f inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0a70e02c0ff074f7ca9e37c17dbc6e9f"></a>
 </td><td class="memItemRight" valign="bottom"><b>foodstamp</b> ()</td></tr>
<tr class="separator:a0a70e02c0ff074f7ca9e37c17dbc6e9f inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a75b536f92ebe53ab0afb77c72e573534 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a75b536f92ebe53ab0afb77c72e573534"></a>
 </td><td class="memItemRight" valign="bottom"><b>discount</b> ()</td></tr>
<tr class="separator:a75b536f92ebe53ab0afb77c72e573534 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a3157f137517ce40a2952c3360ab72ae3 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3157f137517ce40a2952c3360ab72ae3"></a>
 </td><td class="memItemRight" valign="bottom"><b>memDiscount</b> ()</td></tr>
<tr class="separator:a3157f137517ce40a2952c3360ab72ae3 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a216a028f91182ee8f286171298f8df57 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a216a028f91182ee8f286171298f8df57"></a>
 </td><td class="memItemRight" valign="bottom"><b>discountable</b> ()</td></tr>
<tr class="separator:a216a028f91182ee8f286171298f8df57 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a5ceaf4fae245ada5e30dac571ec92421 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5ceaf4fae245ada5e30dac571ec92421"></a>
 </td><td class="memItemRight" valign="bottom"><b>discounttype</b> ()</td></tr>
<tr class="separator:a5ceaf4fae245ada5e30dac571ec92421 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7b5c6bf2e148695d91c9cbd870ed5238 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7b5c6bf2e148695d91c9cbd870ed5238"></a>
 </td><td class="memItemRight" valign="bottom"><b>voided</b> ()</td></tr>
<tr class="separator:a7b5c6bf2e148695d91c9cbd870ed5238 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a061b60f91872eb16687f01501e3c20c0 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a061b60f91872eb16687f01501e3c20c0"></a>
 </td><td class="memItemRight" valign="bottom"><b>percentDiscount</b> ()</td></tr>
<tr class="separator:a061b60f91872eb16687f01501e3c20c0 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8b425794056c69caae490bca8c0a7cf7 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8b425794056c69caae490bca8c0a7cf7"></a>
 </td><td class="memItemRight" valign="bottom"><b>ItemQtty</b> ()</td></tr>
<tr class="separator:a8b425794056c69caae490bca8c0a7cf7 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ad8879a0fc227996230298d4350ba88fa inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad8879a0fc227996230298d4350ba88fa"></a>
 </td><td class="memItemRight" valign="bottom"><b>volDiscType</b> ()</td></tr>
<tr class="separator:ad8879a0fc227996230298d4350ba88fa inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a33b6f74a374b3e7cb2022560db574763 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a33b6f74a374b3e7cb2022560db574763"></a>
 </td><td class="memItemRight" valign="bottom"><b>volume</b> ()</td></tr>
<tr class="separator:a33b6f74a374b3e7cb2022560db574763 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af8b16d4e878f1035fc18ef05d136e132 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af8b16d4e878f1035fc18ef05d136e132"></a>
 </td><td class="memItemRight" valign="bottom"><b>VolSpecial</b> ()</td></tr>
<tr class="separator:af8b16d4e878f1035fc18ef05d136e132 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a62957844f8b8263fc76ec86159c3b04e inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a62957844f8b8263fc76ec86159c3b04e"></a>
 </td><td class="memItemRight" valign="bottom"><b>mixMatch</b> ()</td></tr>
<tr class="separator:a62957844f8b8263fc76ec86159c3b04e inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab15795df82ca48722b66b7052c9dba6f inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab15795df82ca48722b66b7052c9dba6f"></a>
 </td><td class="memItemRight" valign="bottom"><b>matched</b> ()</td></tr>
<tr class="separator:ab15795df82ca48722b66b7052c9dba6f inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:afca714598eac913e4519806f50aa2f6b inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afca714598eac913e4519806f50aa2f6b"></a>
 </td><td class="memItemRight" valign="bottom"><b>memType</b> ()</td></tr>
<tr class="separator:afca714598eac913e4519806f50aa2f6b inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8986ea2b3de7fdda809b9acda20761af inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8986ea2b3de7fdda809b9acda20761af"></a>
 </td><td class="memItemRight" valign="bottom"><b>staff</b> ()</td></tr>
<tr class="separator:a8986ea2b3de7fdda809b9acda20761af inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a305c82d833bd7cd73713cbc3859b4223 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a305c82d833bd7cd73713cbc3859b4223"></a>
 </td><td class="memItemRight" valign="bottom"><b>numflag</b> ()</td></tr>
<tr class="separator:a305c82d833bd7cd73713cbc3859b4223 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8f9d92e95e8f7a45fa349f4b7d5b81a0 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8f9d92e95e8f7a45fa349f4b7d5b81a0"></a>
 </td><td class="memItemRight" valign="bottom"><b>charflag</b> ()</td></tr>
<tr class="separator:a8f9d92e95e8f7a45fa349f4b7d5b81a0 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1481a036d6dbfad5a2acc161fc2b5a83 inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1481a036d6dbfad5a2acc161fc2b5a83"></a>
 </td><td class="memItemRight" valign="bottom"><b>card_no</b> ()</td></tr>
<tr class="separator:a1481a036d6dbfad5a2acc161fc2b5a83 inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4bbb7f8f2c44f804cac3ae501145094b inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4bbb7f8f2c44f804cac3ae501145094b"></a>
 </td><td class="memItemRight" valign="bottom"><b>trans_id</b> ()</td></tr>
<tr class="separator:a4bbb7f8f2c44f804cac3ae501145094b inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2c0762c9f97367c5f13125e6ba13c39f inherit pub_methods_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2c0762c9f97367c5f13125e6ba13c39f"></a>
 </td><td class="memItemRight" valign="bottom"><b>pos_row_id</b> ()</td></tr>
<tr class="separator:a2c0762c9f97367c5f13125e6ba13c39f inherit pub_methods_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pub_methods_class_basic_model"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_class_basic_model')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="class_basic_model.html">BasicModel</a></td></tr>
<tr class="memitem:aead7a57330b79d78a75749bf5569e660 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aead7a57330b79d78a75749bf5569e660"></a>
 </td><td class="memItemRight" valign="bottom"><b>db</b> ()</td></tr>
<tr class="separator:aead7a57330b79d78a75749bf5569e660 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a00a6a86c114ad7366170746246676ade inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a00a6a86c114ad7366170746246676ade"></a>
 </td><td class="memItemRight" valign="bottom"><b>preferredDB</b> ()</td></tr>
<tr class="separator:a00a6a86c114ad7366170746246676ade inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:adf202d3a03b0a2501bd3f0b83bf22d67 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#adf202d3a03b0a2501bd3f0b83bf22d67">__construct</a> ($con)</td></tr>
<tr class="separator:adf202d3a03b0a2501bd3f0b83bf22d67 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a07cb63f68ee61f6d5905f6c0f77aec13 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a07cb63f68ee61f6d5905f6c0f77aec13">create</a> ()</td></tr>
<tr class="separator:a07cb63f68ee61f6d5905f6c0f77aec13 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aff6cbd91e7375c800f9e4fcaf6b624e3 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#aff6cbd91e7375c800f9e4fcaf6b624e3">createIfNeeded</a> ($db_name)</td></tr>
<tr class="separator:aff6cbd91e7375c800f9e4fcaf6b624e3 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a4031bc47c8e845f9c73c31b3960b06e2 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a4031bc47c8e845f9c73c31b3960b06e2">load</a> ()</td></tr>
<tr class="separator:a4031bc47c8e845f9c73c31b3960b06e2 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa4721eae41003b845413b41e6e80142c inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#aa4721eae41003b845413b41e6e80142c">reset</a> ()</td></tr>
<tr class="separator:aa4721eae41003b845413b41e6e80142c inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aed84dccb2ca2d6a7217a03bdba4e05cc inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aed84dccb2ca2d6a7217a03bdba4e05cc"></a>
 </td><td class="memItemRight" valign="bottom"><b>getColumns</b> ()</td></tr>
<tr class="separator:aed84dccb2ca2d6a7217a03bdba4e05cc inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a45086d944a1313262b273b8fb9b2a7cf inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a45086d944a1313262b273b8fb9b2a7cf"></a>
 </td><td class="memItemRight" valign="bottom"><b>getName</b> ()</td></tr>
<tr class="separator:a45086d944a1313262b273b8fb9b2a7cf inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a68e405b0f97beae140cf26da15a4d610 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a68e405b0f97beae140cf26da15a4d610">find</a> ($sort='', $reverse=false)</td></tr>
<tr class="separator:a68e405b0f97beae140cf26da15a4d610 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab08858d99837bd1b0372487920544580 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#ab08858d99837bd1b0372487920544580">delete</a> ()</td></tr>
<tr class="separator:ab08858d99837bd1b0372487920544580 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8e7db58e82d910a6375796ec85f1febf inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a8e7db58e82d910a6375796ec85f1febf">save</a> ()</td></tr>
<tr class="separator:a8e7db58e82d910a6375796ec85f1febf inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af55a6522e5de219f5e79e174b4c4ba19 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#af55a6522e5de219f5e79e174b4c4ba19">normalize</a> ($db_name, $mode=<a class="el" href="class_basic_model.html#a984e5d160a7f726db726054a46a2d0cc">BasicModel::NORMALIZE_MODE_CHECK</a>, $doCreate=False)</td></tr>
<tr class="separator:af55a6522e5de219f5e79e174b4c4ba19 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aed0266392f6fe63c65b52a6f4e01ea91 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#aed0266392f6fe63c65b52a6f4e01ea91">generate</a> ($filename)</td></tr>
<tr class="separator:aed0266392f6fe63c65b52a6f4e01ea91 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1538f9ab2aa7631b0cf0dc8cf97f302e inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1538f9ab2aa7631b0cf0dc8cf97f302e"></a>
 </td><td class="memItemRight" valign="bottom"><b>newModel</b> ($name)</td></tr>
<tr class="separator:a1538f9ab2aa7631b0cf0dc8cf97f302e inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aa7dd5a31fd19610473446b28e2d63d02 inherit pub_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#aa7dd5a31fd19610473446b28e2d63d02">getModels</a> ()</td></tr>
<tr class="separator:aa7dd5a31fd19610473446b28e2d63d02 inherit pub_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:acfb1760f1e98ae663fa461fcc3490531"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acfb1760f1e98ae663fa461fcc3490531"></a>
 </td><td class="memItemRight" valign="bottom"><b>$name</b> = "localtranstoday"</td></tr>
<tr class="separator:acfb1760f1e98ae663fa461fcc3490531"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pro_attribs_class_local_trans_model"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_class_local_trans_model')"><img src="closed.png" alt="-"/> Protected Attributes inherited from <a class="el" href="class_local_trans_model.html">LocalTransModel</a></td></tr>
<tr class="memitem:a140cd71ed54fcd6666caef90314384c9 inherit pro_attribs_class_local_trans_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a140cd71ed54fcd6666caef90314384c9"></a>
 </td><td class="memItemRight" valign="bottom"><b>$name</b> = "localtrans"</td></tr>
<tr class="separator:a140cd71ed54fcd6666caef90314384c9 inherit pro_attribs_class_local_trans_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pro_attribs_class_d_transactions_model"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_class_d_transactions_model')"><img src="closed.png" alt="-"/> Protected Attributes inherited from <a class="el" href="class_d_transactions_model.html">DTransactionsModel</a></td></tr>
<tr class="memitem:ad5370341cf02b95beee02a63281be5aa inherit pro_attribs_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad5370341cf02b95beee02a63281be5aa"></a>
 </td><td class="memItemRight" valign="bottom"><b>$name</b> = 'dtransactions'</td></tr>
<tr class="separator:ad5370341cf02b95beee02a63281be5aa inherit pro_attribs_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a41a8fb697b7816e4b65ea2642c4262a4 inherit pro_attribs_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a41a8fb697b7816e4b65ea2642c4262a4"></a>
 </td><td class="memItemRight" valign="bottom"><b>$preferred_db</b> = 'trans'</td></tr>
<tr class="separator:a41a8fb697b7816e4b65ea2642c4262a4 inherit pro_attribs_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:aabbc1e18098e793a12303d2ad44b10aa inherit pro_attribs_class_d_transactions_model"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aabbc1e18098e793a12303d2ad44b10aa"></a>
 </td><td class="memItemRight" valign="bottom"><b>$columns</b></td></tr>
<tr class="separator:aabbc1e18098e793a12303d2ad44b10aa inherit pro_attribs_class_d_transactions_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pro_attribs_class_basic_model"><td colspan="2" onclick="javascript:toggleInherit('pro_attribs_class_basic_model')"><img src="closed.png" alt="-"/> Protected Attributes inherited from <a class="el" href="class_basic_model.html">BasicModel</a></td></tr>
<tr class="memitem:a9a9082e64851d3775053251ceb07a254 inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a9a9082e64851d3775053251ceb07a254">$name</a></td></tr>
<tr class="separator:a9a9082e64851d3775053251ceb07a254 inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1b24494ccb12866ca5182b6007959573 inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a1b24494ccb12866ca5182b6007959573">$columns</a> = array()</td></tr>
<tr class="separator:a1b24494ccb12866ca5182b6007959573 inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a22029e2f6093f788faf482d27e6a7d6d inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a22029e2f6093f788faf482d27e6a7d6d">$unique</a> = array()</td></tr>
<tr class="separator:a22029e2f6093f788faf482d27e6a7d6d inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ae4e4d256128d9d816c17f562c9ab83c6 inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#ae4e4d256128d9d816c17f562c9ab83c6">$meta_types</a></td></tr>
<tr class="separator:ae4e4d256128d9d816c17f562c9ab83c6 inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a38b97fe85217dcfb3b01bd397afe11b2 inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a38b97fe85217dcfb3b01bd397afe11b2">$connection</a> = false</td></tr>
<tr class="separator:a38b97fe85217dcfb3b01bd397afe11b2 inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ac7bfb6675b1777ad47b62bd631bd138e inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#ac7bfb6675b1777ad47b62bd631bd138e">$instance</a> = array()</td></tr>
<tr class="separator:ac7bfb6675b1777ad47b62bd631bd138e inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a8d6bc78c84c629fdf43fcc3662438a37 inherit pro_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a8d6bc78c84c629fdf43fcc3662438a37">$preferred_db</a> = ''</td></tr>
<tr class="separator:a8d6bc78c84c629fdf43fcc3662438a37 inherit pro_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="inherited"></a>
Additional Inherited Members</h2></td></tr>
<tr class="inherit_header pub_attribs_class_basic_model"><td colspan="2" onclick="javascript:toggleInherit('pub_attribs_class_basic_model')"><img src="closed.png" alt="-"/> Public Attributes inherited from <a class="el" href="class_basic_model.html">BasicModel</a></td></tr>
<tr class="memitem:a984e5d160a7f726db726054a46a2d0cc inherit pub_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top">const </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a984e5d160a7f726db726054a46a2d0cc">NORMALIZE_MODE_CHECK</a> = 1</td></tr>
<tr class="separator:a984e5d160a7f726db726054a46a2d0cc inherit pub_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:af71bad9cde0f24c517b70b94106ca0cf inherit pub_attribs_class_basic_model"><td class="memItemLeft" align="right" valign="top">const </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#af71bad9cde0f24c517b70b94106ca0cf">NORMALIZE_MODE_APPLY</a> = 2</td></tr>
<tr class="separator:af71bad9cde0f24c517b70b94106ca0cf inherit pub_attribs_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="inherit_header pro_methods_class_basic_model"><td colspan="2" onclick="javascript:toggleInherit('pro_methods_class_basic_model')"><img src="closed.png" alt="-"/> Protected Member Functions inherited from <a class="el" href="class_basic_model.html">BasicModel</a></td></tr>
<tr class="memitem:ac663435bf0402735a2a440b6be9e741c inherit pro_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#ac663435bf0402735a2a440b6be9e741c">getMeta</a> ($type, $dbms)</td></tr>
<tr class="separator:ac663435bf0402735a2a440b6be9e741c inherit pro_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a46794db9b7e559b918dbfb7f162f3e4d inherit pro_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a46794db9b7e559b918dbfb7f162f3e4d">insertRecord</a> ()</td></tr>
<tr class="separator:a46794db9b7e559b918dbfb7f162f3e4d inherit pro_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a1f67fa760de9bd20d0c2bd42c8cb8f21 inherit pro_methods_class_basic_model"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_basic_model.html#a1f67fa760de9bd20d0c2bd42c8cb8f21">updateRecord</a> ()</td></tr>
<tr class="separator:a1f67fa760de9bd20d0c2bd42c8cb8f21 inherit pro_methods_class_basic_model"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="a48eb532b9993bbad4b64e7b5f45a556f"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">LocalTransTodayModel::__construct </td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>$con</em>)</td><td></td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add extra indexes besides the ones in the parent table dtransactions </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aae5c835aaeeb5f1819967c2916d0dd37"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">LocalTransTodayModel::normalize </td>
<td>(</td>
<td class="paramtype"> </td>
<td class="paramname"><em>$db_name</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$mode</em> = <code><a class="el" href="class_basic_model.html#a984e5d160a7f726db726054a46a2d0cc">BasicModel::NORMALIZE_MODE_CHECK</a></code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"> </td>
<td class="paramname"><em>$doCreate</em> = <code>False</code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>localtranstoday used to be a view; recreate it as a table if needed. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>pos/is4c-nf/lib/models/trans/LocalTransTodayModel.php</li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Thu Apr 2 2015 12:27:46 for CORE POS - IS4C by  <a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.4
</small></address>
</body>
</html>
| joelbrock/HARVEST_CORE | documentation/doxy/output/is4c-nf/html/class_local_trans_today_model.html | HTML | gpl-2.0 | 42,588 |
#ifndef QEMU_NET_H
#define QEMU_NET_H
#include "qemu-common.h"
/* VLANs support */
typedef ssize_t (IOReadvHandler)(void *, const struct iovec *, int);
typedef struct VLANClientState VLANClientState;
typedef void (NetCleanup) (VLANClientState *);
typedef void (LinkStatusChanged)(VLANClientState *);
struct VLANClientState {
IOReadHandler *fd_read;
IOReadvHandler *fd_readv;
/* Packets may still be sent if this returns zero. It's used to
rate-limit the slirp code. */
IOCanRWHandler *fd_can_read;
NetCleanup *cleanup;
LinkStatusChanged *link_status_changed;
int link_down;
void *opaque;
struct VLANClientState *next;
struct VLANState *vlan;
char *model;
char *name;
char info_str[256];
};
typedef struct VLANPacket VLANPacket;
struct VLANPacket {
struct VLANPacket *next;
VLANClientState *sender;
int size;
uint8_t data[0];
};
struct VLANState {
int id;
VLANClientState *first_client;
struct VLANState *next;
unsigned int nb_guest_devs, nb_host_devs;
VLANPacket *send_queue;
int delivering;
};
VLANState *qemu_find_vlan(int id);
VLANClientState *qemu_new_vlan_client(VLANState *vlan,
const char *model,
const char *name,
IOReadHandler *fd_read,
IOCanRWHandler *fd_can_read,
NetCleanup *cleanup,
void *opaque);
void qemu_del_vlan_client(VLANClientState *vc);
VLANClientState *qemu_find_vlan_client(VLANState *vlan, void *opaque);
int qemu_can_send_packet(VLANClientState *vc);
ssize_t qemu_sendv_packet(VLANClientState *vc, const struct iovec *iov,
int iovcnt);
void qemu_send_packet(VLANClientState *vc, const uint8_t *buf, int size);
void qemu_format_nic_info_str(VLANClientState *vc, uint8_t macaddr[6]);
void qemu_check_nic_model(NICInfo *nd, const char *model);
void qemu_check_nic_model_list(NICInfo *nd, const char * const *models,
const char *default_model);
void qemu_handler_true(void *opaque);
void do_info_network(Monitor *mon);
int do_set_link(Monitor *mon, const char *name, const char *up_or_down);
/* NIC info */
#define MAX_NICS 8
struct NICInfo {
uint8_t macaddr[6];
const char *model;
const char *name;
VLANState *vlan;
void *private;
int used;
};
extern int nb_nics;
extern NICInfo nd_table[MAX_NICS];
/* BT HCI info */
struct HCIInfo {
int (*bdaddr_set)(struct HCIInfo *hci, const uint8_t *bd_addr);
void (*cmd_send)(struct HCIInfo *hci, const uint8_t *data, int len);
void (*sco_send)(struct HCIInfo *hci, const uint8_t *data, int len);
void (*acl_send)(struct HCIInfo *hci, const uint8_t *data, int len);
void *opaque;
void (*evt_recv)(void *opaque, const uint8_t *data, int len);
void (*acl_recv)(void *opaque, const uint8_t *data, int len);
};
struct HCIInfo *qemu_next_hci(void);
/* checksumming functions (net-checksum.c) */
uint32_t net_checksum_add(int len, uint8_t *buf);
uint16_t net_checksum_finish(uint32_t sum);
uint16_t net_checksum_tcpudp(uint16_t length, uint16_t proto,
uint8_t *addrs, uint8_t *buf);
void net_checksum_calculate(uint8_t *data, int length);
/* from net.c */
int net_client_init(const char *device, const char *p);
void net_client_uninit(NICInfo *nd);
int net_client_parse(const char *str);
void net_slirp_smb(const char *exported_dir);
void net_slirp_redir(Monitor *mon, const char *redir_str, const char *redir_opt2);
void net_cleanup(void);
int slirp_is_inited(void);
void net_client_check(void);
void net_host_device_add(Monitor *mon, const char *device, const char *opts);
void net_host_device_remove(Monitor *mon, int vlan_id, const char *device);
#define DEFAULT_NETWORK_SCRIPT "/etc/qemu-ifup"
#define DEFAULT_NETWORK_DOWN_SCRIPT "/etc/qemu-ifdown"
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
#define SMBD_COMMAND "/usr/sbin/smbd"
#endif
void qdev_get_macaddr(DeviceState *dev, uint8_t *macaddr);
VLANClientState *qdev_get_vlan_client(DeviceState *dev,
IOReadHandler *fd_read,
IOCanRWHandler *fd_can_read,
NetCleanup *cleanup,
void *opaque);
#endif
| legumbre/qemu-z80 | net.h | C | gpl-2.0 | 4,471 |
// -*- c++ -*-
// Copyright 2000, Karl Einar Nelson
/* This is a generated file, do not edit. Generated from template.macros.m4 */
#ifndef SIGC_OBJECT_SLOT
#define SIGC_OBJECT_SLOT
#include <sigc++/slot.h>
#include <sigc++/object.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
/**************************************************************/
// These are internal classes used to represent function varients of slots
// (internal)
struct LIBSIGC_API ObjectSlotNode : public SlotNode
{
#ifdef _MSC_VER
private:
/** the sole purpose of this declaration is to introduce a new type that is
guaranteed not to be related to any other type. (Ab)using class SigC::Object
for this lead to some faulty conversions taking place with MSVC6. */
class GenericObject;
typedef void (GenericObject::*Method)(void);
public:
#else
typedef void (Object::*Method)(void);
#endif
Control_ *control_;
void *object_;
Method method_;
Link link_;
// Can be a dependency
virtual Link* link();
virtual void notify(bool from_child);
template <class T,class T2>
ObjectSlotNode(FuncPtr proxy,T* control,void *object,T2 method)
: SlotNode(proxy)
{ init(control,object,reinterpret_cast<Method&>(method)); }
void init(Object* control, void* object, Method method);
virtual ~ObjectSlotNode();
};
// These do not derive from ObjectSlot, they merely are extended
// ctor wrappers. They introduce how to deal with the proxy.
template <class R,class Obj>
struct ObjectSlot0_
{
typedef typename Trait<R>::type RType;
static RType proxy(void * s)
{
typedef RType (Obj::*Method)();
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))();
}
};
template <class R,class O1,class O2>
Slot0<R>
slot(O1& obj,R (O2::*method)())
{
typedef ObjectSlot0_<R,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class O1,class O2>
Slot0<R>
slot(O1& obj,R (O2::*method)() const)
{
typedef ObjectSlot0_<R,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class Obj>
struct ObjectSlot1_
{
typedef typename Trait<R>::type RType;
static RType proxy(typename Trait<P1>::ref p1,void * s)
{
typedef RType (Obj::*Method)(P1);
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))(p1);
}
};
template <class R,class P1,class O1,class O2>
Slot1<R,P1>
slot(O1& obj,R (O2::*method)(P1))
{
typedef ObjectSlot1_<R,P1,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class O1,class O2>
Slot1<R,P1>
slot(O1& obj,R (O2::*method)(P1) const)
{
typedef ObjectSlot1_<R,P1,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class Obj>
struct ObjectSlot2_
{
typedef typename Trait<R>::type RType;
static RType proxy(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,void * s)
{
typedef RType (Obj::*Method)(P1,P2);
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))(p1,p2);
}
};
template <class R,class P1,class P2,class O1,class O2>
Slot2<R,P1,P2>
slot(O1& obj,R (O2::*method)(P1,P2))
{
typedef ObjectSlot2_<R,P1,P2,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class O1,class O2>
Slot2<R,P1,P2>
slot(O1& obj,R (O2::*method)(P1,P2) const)
{
typedef ObjectSlot2_<R,P1,P2,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class Obj>
struct ObjectSlot3_
{
typedef typename Trait<R>::type RType;
static RType proxy(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,void * s)
{
typedef RType (Obj::*Method)(P1,P2,P3);
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))(p1,p2,p3);
}
};
template <class R,class P1,class P2,class P3,class O1,class O2>
Slot3<R,P1,P2,P3>
slot(O1& obj,R (O2::*method)(P1,P2,P3))
{
typedef ObjectSlot3_<R,P1,P2,P3,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class O1,class O2>
Slot3<R,P1,P2,P3>
slot(O1& obj,R (O2::*method)(P1,P2,P3) const)
{
typedef ObjectSlot3_<R,P1,P2,P3,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class P4,class Obj>
struct ObjectSlot4_
{
typedef typename Trait<R>::type RType;
static RType proxy(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,void * s)
{
typedef RType (Obj::*Method)(P1,P2,P3,P4);
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))(p1,p2,p3,p4);
}
};
template <class R,class P1,class P2,class P3,class P4,class O1,class O2>
Slot4<R,P1,P2,P3,P4>
slot(O1& obj,R (O2::*method)(P1,P2,P3,P4))
{
typedef ObjectSlot4_<R,P1,P2,P3,P4,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class P4,class O1,class O2>
Slot4<R,P1,P2,P3,P4>
slot(O1& obj,R (O2::*method)(P1,P2,P3,P4) const)
{
typedef ObjectSlot4_<R,P1,P2,P3,P4,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class P4,class P5,class Obj>
struct ObjectSlot5_
{
typedef typename Trait<R>::type RType;
static RType proxy(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5,void * s)
{
typedef RType (Obj::*Method)(P1,P2,P3,P4,P5);
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))(p1,p2,p3,p4,p5);
}
};
template <class R,class P1,class P2,class P3,class P4,class P5,class O1,class O2>
Slot5<R,P1,P2,P3,P4,P5>
slot(O1& obj,R (O2::*method)(P1,P2,P3,P4,P5))
{
typedef ObjectSlot5_<R,P1,P2,P3,P4,P5,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class P4,class P5,class O1,class O2>
Slot5<R,P1,P2,P3,P4,P5>
slot(O1& obj,R (O2::*method)(P1,P2,P3,P4,P5) const)
{
typedef ObjectSlot5_<R,P1,P2,P3,P4,P5,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class P4,class P5,class P6,class Obj>
struct ObjectSlot6_
{
typedef typename Trait<R>::type RType;
static RType proxy(typename Trait<P1>::ref p1,typename Trait<P2>::ref p2,typename Trait<P3>::ref p3,typename Trait<P4>::ref p4,typename Trait<P5>::ref p5,typename Trait<P6>::ref p6,void * s)
{
typedef RType (Obj::*Method)(P1,P2,P3,P4,P5,P6);
ObjectSlotNode* os = (ObjectSlotNode*)s;
return ((Obj*)(os->object_)
->*(reinterpret_cast<Method&>(os->method_)))(p1,p2,p3,p4,p5,p6);
}
};
template <class R,class P1,class P2,class P3,class P4,class P5,class P6,class O1,class O2>
Slot6<R,P1,P2,P3,P4,P5,P6>
slot(O1& obj,R (O2::*method)(P1,P2,P3,P4,P5,P6))
{
typedef ObjectSlot6_<R,P1,P2,P3,P4,P5,P6,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
template <class R,class P1,class P2,class P3,class P4,class P5,class P6,class O1,class O2>
Slot6<R,P1,P2,P3,P4,P5,P6>
slot(O1& obj,R (O2::*method)(P1,P2,P3,P4,P5,P6) const)
{
typedef ObjectSlot6_<R,P1,P2,P3,P4,P5,P6,O2> SType;
O2& obj_of_method = obj;
return new ObjectSlotNode((FuncPtr)(&SType::proxy),
&obj,
&obj_of_method,
method);
}
#ifdef SIGC_CXX_NAMESPACES
}
#endif
#endif /* SIGC_OBJECT_SLOT */
| KAMI911/openmortal | src/sigc++/object_slot.h | C | gpl-2.0 | 10,196 |
/*
* Copyright (C) 2013 Fighter Sun <wanmyqawdr@126.com>
* JZ4780 SoC NAND controller driver
*
* 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.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __MACH_JZ4780_NAND_H__
#define __MACH_JZ4780_NAND_H__
#include <linux/completion.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/nand.h>
#include <linux/mtd/partitions.h>
#include <soc/gpemc.h>
#define MAX_NUM_NAND_IF 7
struct jz4780_nand;
typedef enum {
/* NAND_XFER_<Data path driver>_<R/B# indicator> */
NAND_XFER_CPU_IRQ = 0,
NAND_XFER_CPU_POLL,
NAND_XFER_DMA_IRQ,
NAND_XFER_DMA_POLL
} nand_xfer_type_t;
typedef enum {
NAND_ECC_TYPE_HW = 0,
NAND_ECC_TYPE_SW
} nand_ecc_type_t;
typedef enum {
NAND_OUTPUT_NORMAL_DRIVER = 0,
NAND_OUTPUT_UNDER_DRIVER1,
NAND_OUTPUT_UNDER_DRIVER2,
NAND_OUTPUT_OVER_DRIVER1,
NAND_OUTPUT_OVER_DRIVER2,
CAN_NOT_ADJUST_OUTPUT_STRENGTH,
} nand_output_driver_strength_t;
typedef enum {
NAND_RB_DOWN_FULL_DRIVER = 0,
NAND_RB_DOWN_THREE_QUARTER_DRIVER,
NAND_RB_DOWN_ONE_HALF_DRIVER,
NAND_RB_DOWN_ONE_QUARTER_DRIVER,
CAN_NOT_ADJUST_RB_DOWN_STRENGTH
} nand_rb_down_driver_strength_t;
typedef struct {
int bank;
int busy_gpio;
int busy_gpio_low_assert;
int wp_gpio; /* -1 if does not exist */
int wp_gpio_low_assert;
gpemc_bank_t cs;
int busy_irq;
struct completion ready;
unsigned int ready_timout_ms;
unsigned int curr_command;
} nand_flash_if_t;
typedef struct {
common_nand_timing_t common_nand_timing;
toggle_nand_timing_t toggle_nand_timing;
} nand_timing_t;
typedef struct {
const char *name;
unsigned int nand_mfr_id;
unsigned int nand_dev_id;
bank_type_t type;
struct {
int data_size;
int ecc_bits;
} ecc_step;
nand_timing_t nand_timing;
nand_output_driver_strength_t output_strength;
nand_rb_down_driver_strength_t rb_down_strength;
struct {
int timing_mode;
} onfi_special;
int (*nand_pre_init)(struct jz4780_nand *nand);
} nand_flash_info_t;
struct jz4780_nand_platform_data {
struct mtd_partition *part_table; /* MTD partitions array */
int num_part; /* number of partitions */
nand_flash_if_t *nand_flash_if_table;
int num_nand_flash_if;
nand_flash_info_t *nand_flash_info_table;
int num_nand_flash_info;
nand_xfer_type_t xfer_type; /* transfer type */
nand_ecc_type_t ecc_type;
int num_nand_flash;
/* not NULL to override default built-in settings in driver */
struct nand_flash_dev *nand_flash_table;
int try_to_reloc_hot;
int flash_bbt;
};
#define COMMON_NAND_CHIP_INFO(_NAME, _MFR_ID, _DEV_ID, \
_DATA_SIZE_PRE_ECC_STEP, \
_ECC_BITS_PRE_ECC_STEP, \
_ALL_TIMINGS_PLUS, \
_Tcls, _Tclh, _Tals, _Talh, \
_Tcs, _Tch, _Tds, _Tdh, _Twp, \
_Twh, _Twc, _Trc, _Tadl, _Tccs, _Trhw, _Twhr, _Twhr2, \
_Trp, _Trr, _Tcwaw, _Twb, _Tww, \
_Trst, _Tfeat, _Tdcbsyr, _Tdcbsyr2, _TIMING_MODE, _BW, \
_OUTPUT_STRENGTH, _RB_DOWN_STRENGTH, \
_NAND_PRE_INIT) \
.name = (_NAME), \
.nand_mfr_id = (_MFR_ID), \
.nand_dev_id = (_DEV_ID), \
.type = BANK_TYPE_NAND, \
.ecc_step = { \
.data_size = (_DATA_SIZE_PRE_ECC_STEP), \
.ecc_bits = (_ECC_BITS_PRE_ECC_STEP), \
}, \
.nand_timing = { \
.common_nand_timing = { \
.Tcls = (_Tcls), \
.Tclh = (_Tclh), \
.Tals = (_Tals), \
.Talh = (_Talh), \
.Tch = (_Tch), \
.Tds = (_Tds), \
.Tdh = (_Tdh), \
.Twp = (_Twp), \
.Twh = (_Twh), \
.Twc = (_Twc), \
.Trc = (_Trc), \
.Trhw = (_Trhw), \
.Trp = (_Trp), \
\
.busy_wait_timing = { \
.Tcs = (_Tcs), \
.Tadl = (_Tadl), \
.Tccs = (_Tccs), \
.Trr = (_Trr), \
.Tcwaw = (_Tcwaw), \
.Twb = (_Twb), \
.Tww = (_Tww), \
.Trst = (_Trst), \
.Tfeat = (_Tfeat), \
.Tdcbsyr = (_Tdcbsyr), \
.Tdcbsyr2 = (_Tdcbsyr2), \
.Twhr = (_Twhr), \
.Twhr2 = (_Twhr2), \
}, \
\
.BW = (_BW), \
.all_timings_plus = (_ALL_TIMINGS_PLUS), \
}, \
}, \
\
.output_strength = (_OUTPUT_STRENGTH), \
.rb_down_strength = (_RB_DOWN_STRENGTH), \
.onfi_special.timing_mode = (_TIMING_MODE), \
.nand_pre_init = (_NAND_PRE_INIT),
/* TODO: implement it */
#define TOGGLE_NAND_CHIP_INFO(TODO)
#define COMMON_NAND_INTERFACE(BANK, \
BUSY_GPIO, BUSY_GPIO_LOW_ASSERT, \
WP_GPIO, WP_GPIO_LOW_ASSERT) \
.bank = (BANK), \
.busy_gpio = (BUSY_GPIO), \
.busy_gpio_low_assert = (BUSY_GPIO_LOW_ASSERT), \
.wp_gpio = (WP_GPIO), \
.wp_gpio_low_assert = (WP_GPIO_LOW_ASSERT), \
.cs = { \
.bank_type = (BANK_TYPE_NAND), \
}, \
/* TODO: implement it */
#define TOGGLE_NAND_INTERFACE(TODO)
#define LP_OPTIONS NAND_SAMSUNG_LP_OPTIONS
#define LP_OPTIONS16 (LP_OPTIONS | NAND_BUSWIDTH_16)
extern int micron_nand_pre_init(struct jz4780_nand *nand);
extern int samsung_nand_pre_init(struct jz4780_nand *nand);
#endif
| IngenicSemiconductor/kernel-inwatch | arch/mips/xburst/soc-4780/include/mach/jz4780_nand.h | C | gpl-2.0 | 5,187 |
# -*- coding: utf-8 -*-
"""
***************************************************************************
AutoincrementalField.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot 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. *
* *
***************************************************************************
"""
__author__ = 'Victor Olaya'
__date__ = 'August 2012'
__copyright__ = '(C) 2012, Victor Olaya'
# This will get replaced with a git SHA1 when you do a git archive
__revision__ = '$Format:%H$'
from PyQt4.QtCore import QVariant
from qgis.core import QgsField, QgsFeature, QgsGeometry
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.parameters import ParameterVector
from processing.core.outputs import OutputVector
from processing.tools import dataobjects, vector
class AutoincrementalField(GeoAlgorithm):
INPUT = 'INPUT'
OUTPUT = 'OUTPUT'
def processAlgorithm(self, progress):
output = self.getOutputFromName(self.OUTPUT)
vlayer = \
dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))
vprovider = vlayer.dataProvider()
fields = vprovider.fields()
fields.append(QgsField('AUTO', QVariant.Int))
writer = output.getVectorWriter(fields, vprovider.geometryType(),
vlayer.crs())
inFeat = QgsFeature()
outFeat = QgsFeature()
inGeom = QgsGeometry()
nElement = 0
features = vector.features(vlayer)
nFeat = len(features)
for inFeat in features:
progress.setPercentage(int(100 * nElement / nFeat))
nElement += 1
inGeom = inFeat.geometry()
outFeat.setGeometry(inGeom)
attrs = inFeat.attributes()
attrs.append(nElement)
outFeat.setAttributes(attrs)
writer.addFeature(outFeat)
del writer
def defineCharacteristics(self):
self.name = 'Add autoincremental field'
self.group = 'Vector table tools'
self.addParameter(ParameterVector(self.INPUT,
self.tr('Input layer'), [ParameterVector.VECTOR_TYPE_ANY]))
self.addOutput(OutputVector(self.OUTPUT, self.tr('Incremented')))
| dracos/QGIS | python/plugins/processing/algs/qgis/AutoincrementalField.py | Python | gpl-2.0 | 2,809 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_22) on Sun May 01 02:05:57 CEST 2011 -->
<TITLE>
es.tid.corba.ExceptionHandlerAdmin
</TITLE>
<META NAME="date" CONTENT="2011-05-01">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="es.tid.corba.ExceptionHandlerAdmin";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
TIDNotifJ API</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../es/tid/corba/EventData/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../es/tid/corba/TIDDistribAdmin/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?es/tid/corba/ExceptionHandlerAdmin/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<H2>
Package es.tid.corba.ExceptionHandlerAdmin
</H2>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Interface Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/DistributionHandler.html" title="interface in es.tid.corba.ExceptionHandlerAdmin">DistributionHandler</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/DistributionHandlerOperations.html" title="interface in es.tid.corba.ExceptionHandlerAdmin">DistributionHandlerOperations</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/ExceptionHandler.html" title="interface in es.tid.corba.ExceptionHandlerAdmin">ExceptionHandler</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/ExceptionHandlerOperations.html" title="interface in es.tid.corba.ExceptionHandlerAdmin">ExceptionHandlerOperations</A></B></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/_DistributionHandlerStub.html" title="class in es.tid.corba.ExceptionHandlerAdmin">_DistributionHandlerStub</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/_ExceptionHandlerStub.html" title="class in es.tid.corba.ExceptionHandlerAdmin">_ExceptionHandlerStub</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/CannotProceedHelper.html" title="class in es.tid.corba.ExceptionHandlerAdmin">CannotProceedHelper</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/CannotProceedHolder.html" title="class in es.tid.corba.ExceptionHandlerAdmin">CannotProceedHolder</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/DistributionHandlerHelper.html" title="class in es.tid.corba.ExceptionHandlerAdmin">DistributionHandlerHelper</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/DistributionHandlerHolder.html" title="class in es.tid.corba.ExceptionHandlerAdmin">DistributionHandlerHolder</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/DistributionHandlerPOA.html" title="class in es.tid.corba.ExceptionHandlerAdmin">DistributionHandlerPOA</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/DistributionHandlerPOATie.html" title="class in es.tid.corba.ExceptionHandlerAdmin">DistributionHandlerPOATie</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/ExceptionHandlerHelper.html" title="class in es.tid.corba.ExceptionHandlerAdmin">ExceptionHandlerHelper</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/ExceptionHandlerHolder.html" title="class in es.tid.corba.ExceptionHandlerAdmin">ExceptionHandlerHolder</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/ExceptionHandlerPOA.html" title="class in es.tid.corba.ExceptionHandlerAdmin">ExceptionHandlerPOA</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/ExceptionHandlerPOATie.html" title="class in es.tid.corba.ExceptionHandlerAdmin">ExceptionHandlerPOATie</A></B></TD>
<TD> </TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/TransformingRuleIdHelper.html" title="class in es.tid.corba.ExceptionHandlerAdmin">TransformingRuleIdHelper</A></B></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Exception Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../es/tid/corba/ExceptionHandlerAdmin/CannotProceed.html" title="class in es.tid.corba.ExceptionHandlerAdmin">CannotProceed</A></B></TD>
<TD> </TD>
</TR>
</TABLE>
<P>
<DL>
</DL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
TIDNotifJ API</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../es/tid/corba/EventData/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../es/tid/corba/TIDDistribAdmin/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?es/tid/corba/ExceptionHandlerAdmin/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
</BODY>
</HTML>
| AlvaroVega/TIDNotifJ | test/doc_api/war/es/tid/corba/ExceptionHandlerAdmin/package-summary.html | HTML | gpl-2.0 | 10,931 |
define(
//begin v1.x content
{
"decimal": ".",
"group": ",",
"list": ";",
"percentSign": "%",
"plusSign": "+",
"minusSign": "-",
"exponential": "E",
"perMille": "‰",
"infinity": "∞",
"nan": "NaN",
"decimalFormat": "#,##0.###",
"decimalFormat-short": "000조",
"scientificFormat": "#E0",
"percentFormat": "#,##0%",
"currencyFormat": "¤#,##0.00"
}
//end v1.x content
); | Gambiit/pmb-on-docker | web_appli/pmb/javascript/dojo/dojo/cldr/nls/ko/number.js | JavaScript | gpl-2.0 | 387 |
<?php
/**
* Class MailSyncObserver
*
* @package ModelFramework\ModelViewService
* @author Vladimir Pasechnik vladimir.pasechnik@gmail.com
* @author Stanislav Burikhin stanislav.burikhin@gmail.com
*/
namespace ModelFramework\LogicService\Observer;
use ModelFramework\ConfigService\ConfigAwareInterface;
use ModelFramework\ConfigService\ConfigAwareTrait;
use ModelFramework\FormService\StaticDataConfig\StaticDataConfig;
use ModelFramework\Utility\SplSubject\SubjectAwareInterface;
use ModelFramework\Utility\SplSubject\SubjectAwareTrait;
use Wepo\Model\Status;
class MailSyncObserver
implements \SplObserver, ConfigAwareInterface, SubjectAwareInterface
{
use ConfigAwareTrait, SubjectAwareTrait;
public function update(\SplSubject $subject)
{
$this->setSubject($subject);
$users = $subject->getEventObject();
$action = $this->getRootConfig()['action'];
$mails = [];
if ( !(is_array($users) || $users instanceof ResultSetInterface)) {
$users = [$users];
}
switch ($action) {
case 'fetch':
foreach ($users as $_k => $user) {
list($count, $resMails) = $this->syncMails($user);
$mails = array_merge($mails, $resMails);
}
break;
case 'send':
foreach ($users as $user) {
$resMails = $this->sendMails($user);
$mails = array_merge($mails, $resMails);
}
//todo move here mail send observer logic
break;
}
$this->getSubject()->getLogicService()
->get('postsync', 'MailDetail')->trigger($mails);
// exit;
}
public function syncMails($user)
{
$settings = $this->getFetchSettings($user);
$count = 0;
//prn( $this->getSubject()->getModelServiceVerify()->get( 'MailDetail' ) );
//exit;
$modelService = $this->getSubject()->getModelServiceVerify();
$mailGW = $this->getSubject()->getGatewayService()->get('MailDetail');
//$chainGW = $this->getSubject()->getGatewayService()->get( 'Mail' );
$mails = $mailGW->find(['owner_id' => $user->id()]);
$newMails = [];
$fetchedMailsGW
= $this->getSubject()->getGatewayService()->get('MailRaw');
foreach ($settings as $setting) {
$exceptUids = [];
foreach ($mails as $mail) {
if (isset($mail->protocol_ids[$setting->id()])) {
$exceptUids[] = $mail->protocol_ids[$setting->id()];
}
}
// prn($exceptUids, $setting);
//exit();
// prn($setting,$user);
// exit;
$syncService = $this->getFetchTransport($setting);
$uids = $syncService->fetchAll($exceptUids);
//prn($fetchedMails);
//exit;
if ($syncService->lastSyncIsSuccessful()) {
$email = $setting->email;
$mailSendGW = $this->getSubject()->getGatewayService()
->get('MailSendSetting');
$sendSettings = $mailSendGW->find([
'email' => $email,
'user_id' => $user->_id
]);
$ssIds = [];
foreach ($sendSettings as $sendSetting) {
$ssIds[] = $sendSetting->_id;
}
$resMails = $mailGW->find([
'status_id' => Status::SEND,
'protocol_ids' => $ssIds
]);
$mailsToUnchain = [];
foreach ($resMails as $mail) {
$mailsToUnchain[] = $mail;
}
$this->getSubject()->getLogicService()
->get('delete', 'MailDetail')
->trigger($mailsToUnchain);
$mailGW->delete([
'status_id' => Status::SEND,
'protocol_ids' => $ssIds
]);
}
//prn( $fetchedMails );
//exit;
$fetchedMails = $fetchedMailsGW->find([
'protocol_ids.' . $setting->id() => $uids
]);
foreach ($fetchedMails as $mail) {
// prn($mail->message_id, $mail->protocol_ids);
$key = $mail->message_id;
$temp = $mail->converted_mail;
$temp['protocol_ids'] = $mail->protocol_ids;
$mail = $temp;
if (isset($newMails[$key])) {
$newMails[$key]->protocol_ids
= array_merge($newMails[$key]->protocol_ids,
$mail['protocol_ids']);
} else {
//$newMails[ $key ] = $this->model( 'Mail' )->exchangeArray( $mail );
$newMails[$key] = $modelService->get('MailDetail')
->exchangeArray($mail);
$this->configureFetchedMail($user, $setting,
$newMails[$key]);
}
}
}
// exit;
$oldMails = count($newMails) ? $mailGW->find([
'header.message-id' => array_keys($newMails),
'owner_id' => $user->id(),
]) : [];
foreach ($oldMails as $oldMail) {
$newMail = $newMails[$oldMail->header['message-id']];
unset($newMails[$oldMail->header['message-id']]);
$oldMail->protocol_ids
= array_merge($oldMail->protocol_ids, $newMail->protocol_ids);
$mailGW->save($oldMail);
}
$returnMails = [];
$unchainedMail = $mailGW->find(['chain_id' => '']);
// foreach ($unchainedMail as $mail) {
// $newMails[ ] = $mail;
// }
foreach ($newMails as $newMail) {
if (count($newMail->header) > 3) {
$this->getSubject()->getLogicService()
->get('presave', 'MailDetail')
->trigger($newMail);
$mailGW->save($newMail);
$newMail->_id = $mailGW->getLastInsertId();
$returnMails[] = $newMail;
}
$count++;
}
return [$count, $returnMails];
}
public function getFetchSettings($user)
{
// prn( $user->id() );
// $protocols = array_keys( $this->getSubject()->getConfigServiceVerify()
// ->get( 'StaticDataSource',
// 'ReceiveMailProtocol',
// new StaticDataConfig() )->options );
$gw = $this->getSubject()->getGatewayService()
->get('MailReceiveSetting');
// exit;
$settings = $gw->find([
'user_id' => $user->id(),
// 'setting_protocol_id' => $protocols,
'status_id' => [Status::NORMAL, Status::NEW_,],
]);
return $settings;
}
/**
* @param Object $setting
*
* @return \Mail\Receive\BaseTransport|\Mail\Send\BaseTransport
*/
public function getFetchTransport($setting)
{
$tm = $this->getSubject()->getMailService();
$purpose = 'Receive';
$protocolName = $setting->setting_protocol_id;
$settingId = (string)$setting->_id;
$setting = [
'host' => $setting->setting_host,
'user' => $setting->setting_user,
'password' => $setting->pass,
'ssl' => $setting->setting_security_id,
'port' => $setting->setting_port,
];
return $tm->getGateway($purpose, $protocolName, $setting, $settingId);
}
public function configureFetchedMail($user, $setting, $mail)
{
$mail->from_id = $setting->user_id;
$mail->status_id = Status::NORMAL;
foreach ($mail->header['to'] as $email) {
$email = strtolower(trim($email));
$settingEmail = strtolower(trim($setting->email));
if ($email == $settingEmail) {
$mail->type = 'inbox';
$mail->to_id = $setting->user_id;
$mail->from_id = '';
$mail->status_id = Status::NEW_;
break;
}
}
$mail->owner_id = $user->id();
$mail->title = $mail->header['subject'];
$timezone = new \DateTimeZone(date_default_timezone_get());
try {
$date = new \DateTime($mail->header['date']);
} catch (\Exception $ex) {
$date = strstr($mail->header['date'], " (", true);
$date = new \DateTime($date);
}
$date->setTimezone($timezone);
$mail->date = $date->format('Y-m-d H:i:s');
}
public function sendMails($user)
{
$mails = [];
$settings = $this->getSendSetting($user);
foreach ($settings as $setting) {
$mailsGW
= $this->getSubject()->getGatewayService()->get('MailDetail');
$mailsToSend
= $mailsGW->find([
'protocol_ids' => [$setting->_id],
'status_id' => Status::SENDING
]);
$gw = $this->getSendTransport($setting);
foreach ($mailsToSend as $mail) {
try {
$res = $gw->sendMail([
'text' => $mail->text,
'header' => $mail->header,
'link' => []
]);
$mail->status_id = Status::SEND;
} catch (\Exception $ex) {
$mail->error
= array_merge([$ex->getMessage()],
$mail->error);
$mail->status_id = Status::SENDERROR;
}
$mails[] = $mail;
}
}
return $mails;
}
public function getSendSetting($user)
{
$protocols = array_keys($this->getSubject()->getConfigServiceVerify()
->get('StaticDataSource',
'SendMailProtocol',
new StaticDataConfig())->options);
$gw = $this->getSubject()->getGatewayService()
->get('MailSendSetting');
$settings = $gw->find([
'user_id' => $user->id(),
// 'setting_protocol_id' => $protocols,
'status_id' => [
Status::NORMAL,
Status::NEW_,
],
]);
return $settings;
}
/**
* @param Object $setting
*
* @return \Mail\Receive\BaseTransport|\Mail\Send\BaseTransport
*/
public function getSendTransport($setting)
{
$tm = $this->getSubject()->getMailService();
$purpose = 'Send';
$protocolName = $setting->setting_protocol_id;
$settingId = (string)$setting->_id;
$setting = [
'name' => 'Wepo',
'host' => $setting->setting_host,
'port' => $setting->setting_port,
'connection_class' => 'login',
'connection_config' => [
'ssl' => $setting->setting_security_id,
'username' => $setting->setting_user,
'password' => $setting->pass,
],
];
return $tm->getGateway($purpose, $protocolName, $setting, $settingId);
}
}
| modelframework/modelframework | src/ModelFramework/LogicService/Observer/MailSyncObserver.php | PHP | gpl-2.0 | 11,776 |
<?php
// +-------------------------------------------------+
// | 2002-2011 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: cms_module_shelveslist.class.php,v 1.1 2013-01-23 11:30:08 apetithomme Exp $
if (stristr($_SERVER['REQUEST_URI'], ".class.php")) die("no access");
class cms_module_shelveslist extends cms_module_common_module {
public function __construct($id=0){
$this->module_path = str_replace(basename(__FILE__),"",__FILE__);
parent::__construct($id);
}
} | Gambiit/pmb-on-docker | web_appli/pmb/opac_css/cms/modules/shelveslist/cms_module_shelveslist.class.php | PHP | gpl-2.0 | 569 |
#!/bin/bash
# -----------------------------------------------------------------------------
# Check source-tree for anomalies
#
# Copyright (C) 2005-2007 by Ivo van Poorten
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#
# Thanks to Melchior Franz of the FlightGear project for the original idea
# of a source-tree checker and Torinthiel for the feedback along the way.
# $Id$
# -----------------------------------------------------------------------------
# All yes/no flags. Spaces around flagnames are important!
testflags=" spaces extensions crlf tabs trailws rcsid oll charset stupid gnu \
res depr "
allflags="$testflags showcont color head svn "
# -----------------------------------------------------------------------------
# Avoid locale problems
export LC_ALL=C
# -----------------------------------------------------------------------------
# Helper functions
set_all_tests() {
for i in $testflags ; do
eval _$i=$1
done
}
printoption() {
test -n "$3" && def=$3 || eval def=\$_$1
echo " -(no)$1 $2 [default: $def]"
}
printhead() {
test "$_head" = "yes" && echo -e "$COLB$1$COLE"
}
all_filenames() {
test "$_files" != "" && echo "$_files" && return
if [ "$_svn" = "no" ]; then
find . -type f \
| grep -v "\.\#\|\~$\|\.depend\|\/\.svn\/\|config.mak\|^\./config\.h" \
| grep -v "^\./version\.h\|\.o$\|\.a$\|configure.log\|^\./help_mp.h"
else
for p in . libavcodec libavutil libavformat libpostproc ; do
svn info -R $p 2>/dev/null | sed -n \
'/Path:/bb; :a; d; b; :b; s/Path: /.\//; h; :c; n;
/Node Kind:/bd; bc; :d; /directory/ba; g; p;'
done
fi
}
# -----------------------------------------------------------------------------
# Default settings
set_all_tests no
_spaces=yes
_extensions=yes
_crlf=yes
_showcont=no
_color=yes
_head=yes
_svn=yes
_files=
# Parse command line
for i in "$@"; do
case "$i" in
-help|--help|-h|-\?)
echo -e "\n$0 [options] [files]\n"
echo -e "options:\n"
printoption "spaces " "test for spaces in filenames"
printoption "extensions" "test for uppercase extensions"
printoption "crlf " "test for MSDOS line endings"
printoption "tabs " "test for tab characters"
printoption "trailws " "test for trailing whitespace"
printoption "rcsid " "test for missing RCS Id's"
printoption "oll " "test for overly long lines"
printoption "charset " "test for wrong charset"
printoption "stupid " "test for stupid code"
printoption "gnu " "test for GNUisms"
printoption "res " "test for reserved identifiers"
printoption "depr " "test for deprecated function calls"
echo
printoption "all " "enable all tests" "no"
echo " (-noall can be specified as -none)"
echo
printoption "showcont " "show offending content of file(s)"
echo
printoption "color " "colored output"
printoption "head " "print heading for each test"
printoption "svn " \
"use svn info to determine which files to check"
echo -e "\nIf no files are specified, the whole tree is traversed."
echo -e "If there are, -(no)svn has no effect.\n"
exit
;;
-all)
set_all_tests yes
;;
-noall)
set_all_tests no
;;
-none)
set_all_tests no
;;
-*)
var=`echo X$i | sed 's/^X-//'`
val=yes
case "$var" in
no*)
var=`echo "$var" | cut -c 3-`
val=no
;;
esac
case "$allflags" in
*\ $var\ *)
eval _$var=$val
;;
*)
echo "unknown option: $i" >&2
exit 0
;;
esac
;;
*)
_files="$_files $i"
;;
esac
done
# -----------------------------------------------------------------------------
# Set heading color
if [ "$_color" = "yes" ]; then
COLB="\e[36m"
COLE="\e[m"
else
COLB=""
COLE=""
fi
# Test presence of svn info
if [ "$_svn" = "yes" -a ! -d .svn ] ; then
echo "No svn info available. Please use -nosvn." >&2
exit 1
fi
# Generate filelist once so -svn isn't _that_ much slower than -nosvn anymore
filelist=`all_filenames`
case "$_stupid$_res$_depr$_gnu" in
*yes*)
# generate 'shortlist' to avoid false positives in xpm files, docs, etc,
# when one only needs to check .c and .h files
chfilelist=`echo $filelist | tr ' ' '\n' | grep "[\.][ch]$"`
;;
esac
if [ "$_showcont" = "yes" ]; then
_diffopts="-u"
_grepopts="-n -I"
else
_diffopts="-q"
_grepopts="-l -I"
fi
TAB=`echo " " | tr ' ' '\011'`
# -----------------------------------------------------------------------------
# DO CHECKS
# -----------------------------------------------------------------------------
if [ "$_spaces" = "yes" ]; then
printhead "checking for spaces in filenames ..."
find . | grep " "
fi
# -----------------------------------------------------------------------------
if [ "$_extensions" = "yes" ]; then
printhead "checking for uppercase extensions ..."
echo $filelist | grep "\.[[:upper:]]\+$" | grep -v "\.S$"
fi
# -----------------------------------------------------------------------------
if [ "$_crlf" = "yes" ]; then
printhead "checking for MSDOS line endings ..."
CR=`echo " " | tr ' ' '\015'`
grep $_grepopts "$CR" $filelist
fi
# -----------------------------------------------------------------------------
if [ "$_tabs" = "yes" ]; then
printhead "checking for TAB characters ..."
grep $_grepopts "$TAB" $filelist
fi
# -----------------------------------------------------------------------------
if [ "$_trailws" = "yes" ]; then
printhead "checking for trailing whitespace ..."
grep $_grepopts "[[:space:]]\+$" $filelist
fi
# -----------------------------------------------------------------------------
if [ "$_rcsid" = "yes" ]; then
printhead "checking for missing RCS \$Id\$ or \$Revision\$ tags ..."
grep -L -I "\$\(Id\|Revision\)[[:print:]]\+\$" $filelist
fi
# -----------------------------------------------------------------------------
if [ "$_oll" = "yes" ]; then
printhead "checking for overly long lines (over 79 characters) ..."
grep $_grepopts "^[[:print:]]\{80,\}$" $filelist
fi
# -----------------------------------------------------------------------------
if [ "$_gnu" = "yes" -a -n "$chfilelist" ]; then
printhead "checking for GNUisms ..."
grep $_grepopts "case.*\.\.\..*:" $chfilelist
fi
# -----------------------------------------------------------------------------
if [ "$_res" = "yes" -a -n "$chfilelist" ]; then
printhead "checking for reserved identifiers ..."
grep $_grepopts "#[ $TAB]*define[ $TAB]\+_[[:upper:]].*" $chfilelist
grep $_grepopts "#[ $TAB]*define[ $TAB]\+__.*" $chfilelist
fi
# -----------------------------------------------------------------------------
if [ "$_charset" = "yes" ]; then
printhead "checking bad charsets ..."
for I in $filelist ; do
case "$I" in
./help/help_mp-*.h)
;;
./DOCS/*)
;;
*.c|*.h)
iconv -c -f ascii -t ascii "$I" | diff $_diffopts "$I" -
;;
esac
done
fi
# -----------------------------------------------------------------------------
if [ "$_stupid" = "yes" -a -n "$chfilelist" ]; then
printhead "checking for stupid code ..."
for i in calloc malloc realloc memalign av_malloc av_mallocz faad_malloc \
lzo_malloc safe_malloc mpeg2_malloc _ogg_malloc; do
printhead "--> casting of void* $i()"
grep $_grepopts "([ $TAB]*[a-zA-Z_]\+[ $TAB]*\*.*)[ $TAB]*$i" \
$chfilelist
done
for i in "" signed unsigned; do
printhead "--> usage of sizeof($i char)"
grep $_grepopts "sizeof[ $TAB]*([ $TAB]*$i[ $TAB]*char[ $TAB]*)" \
$chfilelist
done
for i in int8_t uint8_t; do
printhead "--> usage of sizeof($i)"
grep $_grepopts "sizeof[ $TAB]*([ $TAB]*$i[ $TAB]*)" $chfilelist
done
printhead "--> usage of &&1"
grep $_grepopts "&&[ $TAB]*1" $chfilelist
printhead "--> usage of ||0"
grep $_grepopts "||[ $TAB]*0" $chfilelist
# added a-fA-F_ to eliminate some false positives
printhead "--> usage of *0"
grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*\*[ $TAB]*0[^.0-9xa-fA-F_]" \
$chfilelist
printhead "--> usage of *1"
grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*\*[ $TAB]*1[^.0-9ea-fA-F_]" \
$chfilelist
printhead "--> usage of +0"
grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*+[ $TAB]*0[^.0-9xa-fA-F_]" \
$chfilelist
printhead "--> usage of -0"
grep $_grepopts "[a-zA-Z0-9)]\+[ $TAB]*-[ $TAB]*0[^.0-9xa-fA-F_]" \
$chfilelist
fi
# -----------------------------------------------------------------------------
if [ "$_depr" = "yes" -a -n "$chfilelist" ]; then
printhead "checking for deprecated and obsolete function calls ..."
for i in bcmp bcopy bzero getcwd getipnodebyname inet_ntoa inet_addr \
atoq ecvt fcvt ecvt_r fcvt_r qecvt_r qfcvt_r finite ftime gcvt herror \
hstrerror getpass getpw getutent getutid getutline pututline setutent \
endutent utmpname gsignal ssignal gsignal_r ssignal_r infnan memalign \
valloc re_comp re_exec drem dremf dreml rexec svc_getreq sigset \
sighold sigrelse sigignore sigvec sigmask sigblock sigsetmask \
siggetmask ualarm ulimit usleep statfs fstatfs ustat get_kernel_syms \
query_module sbrk tempnam tmpnam mktemp mkstemp
do
printhead "--> $i()"
grep $_grepopts "[^a-zA-Z0-9]$i[ $TAB]*(" $chfilelist
done
fi
| azuwis/mplayer-fork | TOOLS/checktree.sh | Shell | gpl-2.0 | 10,979 |
/*
* (C) Copyright 2002
* Gary Jennejohn, DENX Software Engineering, <gj@denx.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <common.h>
#if defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) || \
defined(CONFIG_S3C2440) || defined (CONFIG_TRAB)
#if defined(CONFIG_S3C2400) || defined(CONFIG_TRAB)
#include <s3c2400.h>
#elif defined(CONFIG_S3C2410)
#include <s3c2410.h>
#elif defined(CONFIG_S3C2440)
#include <s3c2440.h>
#endif
DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_SERIAL1
#define UART_NR S3C24X0_UART0
#elif defined(CONFIG_SERIAL2)
# if defined(CONFIG_TRAB)
# error "TRAB supports only CONFIG_SERIAL1"
# endif
#define UART_NR S3C24X0_UART1
#elif defined(CONFIG_SERIAL3)
# if defined(CONFIG_TRAB)
# #error "TRAB supports only CONFIG_SERIAL1"
# endif
#define UART_NR S3C24X0_UART2
#else
#error "Bad: you didn't configure serial ..."
#endif
void serial_setbrg (void)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
int i;
unsigned int reg = 0;
/* value is calculated so : (int)(PCLK/16./baudrate) -1 */
reg = get_PCLK() / (16 * gd->baudrate) - 1;
/* FIFO enable, Tx/Rx FIFO clear */
uart->UFCON = 0x07;
uart->UMCON = 0x0;
/* Normal,No parity,1 stop,8 bit */
uart->ULCON = 0x3;
/*
* tx=level,rx=edge,disable timeout int.,enable rx error int.,
* normal,interrupt or polling
*/
uart->UCON = 0x245;
uart->UBRDIV = reg;
#ifdef CONFIG_HWFLOW
uart->UMCON = 0x1; /* RTS up */
#endif
for (i = 0; i < 100; i++);
}
/*
* Initialise the serial port with the given baudrate. The settings
* are always 8 data bits, no parity, 1 stop bit, no start bits.
*
*/
int serial_init (void)
{
serial_setbrg ();
return (0);
}
/*
* Read a single byte from the serial port. Returns 1 on success, 0
* otherwise. When the function is succesfull, the character read is
* written into its argument c.
*/
int serial_getc (void)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
/* wait for character to arrive */
while (!(uart->UTRSTAT & 0x1));
return uart->URXH & 0xff;
}
#ifdef CONFIG_HWFLOW
static int hwflow = 0; /* turned off by default */
int hwflow_onoff(int on)
{
switch(on) {
case 0:
default:
break; /* return current */
case 1:
hwflow = 1; /* turn on */
break;
case -1:
hwflow = 0; /* turn off */
break;
}
return hwflow;
}
#endif
#ifdef CONFIG_MODEM_SUPPORT
static int be_quiet = 0;
void disable_putc(void)
{
be_quiet = 1;
}
void enable_putc(void)
{
be_quiet = 0;
}
#endif
/*
* Output a single byte to the serial port.
*/
void serial_putc (const char c)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
#ifdef CONFIG_MODEM_SUPPORT
if (be_quiet)
return;
#endif
/* wait for room in the tx FIFO */
while (!(uart->UTRSTAT & 0x2));
#ifdef CONFIG_HWFLOW
/* Wait for CTS up */
while(hwflow && !(uart->UMSTAT & 0x1))
;
#endif
uart->UTXH = c;
/* If \n, also do \r */
if (c == '\n')
serial_putc ('\r');
}
/*
* Test whether a character is in the RX buffer
*/
int serial_tstc (void)
{
S3C24X0_UART * const uart = S3C24X0_GetBase_UART(UART_NR);
return uart->UTRSTAT & 0x1;
}
void
serial_puts (const char *s)
{
while (*s) {
serial_putc (*s++);
}
}
#endif /* defined(CONFIG_S3C2400) || defined (CONFIG_S3C2410) ||
defined(CONFIG_S3C2440) || defined (CONFIG_TRAB) */
| tsuibin/uboot-1.1.6_akae24xx | cpu/arm920t/s3c24x0/serial.c | C | gpl-2.0 | 3,972 |
/* This file is part of the ScriptDev2 Project. See AUTHORS file for Copyright information
* 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
*/
/* ScriptData
SDName: Boss_Rajaxx
SD%Complete: 100
SDComment: General Andorov script
SDCategory: Ruins of Ahn'Qiraj
EndScriptData
*/
#include "AI/ScriptDevAI/include/sc_common.h"
#include "ruins_of_ahnqiraj.h"
#include "AI/ScriptDevAI/base/CombatAI.h"
enum
{
// Event yells
SAY_ANDOROV_INTRO_1 = -1509004,
SAY_ANDOROV_INTRO_2 = -1509031,
SAY_ANDOROV_INTRO_3 = -1509003,
SAY_ANDOROV_INTRO_4 = -1509029,
SAY_ANDOROV_ATTACK_START = -1509030,
SAY_ANDOROV_DESPAWN = -1509032,
// Rajaxx kills Andorov
SAY_KILLS_ANDOROV = -1509016,
// probably related to the opening of AQ event
SAY_UNK1 = -1509011,
SAY_UNK2 = -1509012,
SAY_UNK3 = -1509013,
SAY_UNK4 = -1509014,
// gossip items
GOSSIP_TEXT_ID_INTRO = 7883,
GOSSIP_TEXT_ID_TRADE = 8305,
GOSSIP_ITEM_START = -3509000,
GOSSIP_ITEM_TRADE = -3509001,
// Andorov spells
SPELL_AURA_OF_COMMAND = 25516,
SPELL_BASH = 25515,
SPELL_STRIKE = 22591,
// Kaldorei spell
SPELL_CLEAVE = 26350,
SPELL_MORTAL_STRIKE = 16856,
POINT_ID_MOVE_INTRO = 2,
POINT_ID_MOVE_ATTACK = 4,
};
static const DialogueEntry aIntroDialogue[] =
{
{SAY_ANDOROV_INTRO_1, NPC_GENERAL_ANDOROV, 7000},
{SAY_ANDOROV_INTRO_2, NPC_GENERAL_ANDOROV, 0},
{SAY_ANDOROV_INTRO_3, NPC_GENERAL_ANDOROV, 4000},
{SAY_ANDOROV_INTRO_4, NPC_GENERAL_ANDOROV, 6000},
{SAY_ANDOROV_ATTACK_START, NPC_GENERAL_ANDOROV, 0},
{0, 0, 0},
};
enum AndorovActions
{
ANDOROV_COMMAND_AURA,
ANDOROV_BASH,
ANDOROV_STRIKE,
ANDOROV_ACTION_MAX,
ANDOROV_MOVE,
ANDOROV_DESPAWN,
};
struct npc_general_andorovAI : public CombatAI, private DialogueHelper
{
npc_general_andorovAI(Creature* creature) : CombatAI(creature, ANDOROV_ACTION_MAX), m_instance(static_cast<instance_ruins_of_ahnqiraj*>(creature->GetInstanceData())),
DialogueHelper(aIntroDialogue)
{
InitializeDialogueHelper(m_instance);
m_pointId = 0;
AddCombatAction(ANDOROV_COMMAND_AURA, 1000, 3000);
AddCombatAction(ANDOROV_BASH, 8000, 11000);
AddCombatAction(ANDOROV_STRIKE, 2000, 5000);
AddCustomAction(ANDOROV_MOVE, true, [&]() { HandleMove(); });
AddCustomAction(ANDOROV_DESPAWN, true, [&]() { HandleDespawn(); });
}
instance_ruins_of_ahnqiraj* m_instance;
uint8 m_pointId;
void JustRespawned() override
{
ResetTimer(ANDOROV_MOVE, 5000);
}
void MoveInLineOfSight(Unit* who) override
{
// If Rajaxx is in range attack him
if (who->GetEntry() == NPC_RAJAXX && m_creature->IsWithinDistInMap(who, 50.0f))
AttackStart(who);
ScriptedAI::MoveInLineOfSight(who);
}
void JustDied(Unit* killer) override
{
if (killer->GetEntry() != NPC_RAJAXX)
return;
// Yell when killed by Rajaxx
if (m_instance)
{
if (Creature* pRajaxx = m_instance->GetSingleCreatureFromStorage(NPC_RAJAXX))
DoScriptText(SAY_KILLS_ANDOROV, pRajaxx);
}
}
void JustDidDialogueStep(int32 entry) override
{
// Start the event when the dialogue is finished
if (entry == SAY_ANDOROV_ATTACK_START)
{
if (m_instance)
m_instance->SetData(TYPE_RAJAXX, IN_PROGRESS);
}
}
void MovementInform(uint32 uiType, uint32 uiPointId) override
{
if (uiType != POINT_MOTION_TYPE)
return;
switch (uiPointId)
{
case 0:
case 1:
case 3:
++m_pointId;
m_creature->GetMotionMaster()->MovePoint(m_pointId, aAndorovMoveLocs[m_pointId].m_fX, aAndorovMoveLocs[m_pointId].m_fY, aAndorovMoveLocs[m_pointId].m_fZ);
break;
case POINT_ID_MOVE_INTRO:
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
m_creature->SetFacingTo(aAndorovMoveLocs[3].m_fO);
++m_pointId;
break;
case POINT_ID_MOVE_ATTACK:
// Start dialogue only the first time it reaches the point
if (m_pointId == 4)
{
StartNextDialogueText(SAY_ANDOROV_INTRO_3);
++m_pointId;
}
break;
}
}
void EnterEvadeMode() override
{
if (!m_instance)
return;
m_creature->RemoveAllAurasOnEvade();
m_creature->CombatStop(true);
if (m_creature->IsAlive())
{
// reset to combat position
if (m_pointId >= 4)
m_creature->GetMotionMaster()->MovePoint(POINT_ID_MOVE_ATTACK, aAndorovMoveLocs[4].m_fX, aAndorovMoveLocs[4].m_fY, aAndorovMoveLocs[4].m_fZ);
// reset to intro position
else
m_creature->GetMotionMaster()->MovePoint(POINT_ID_MOVE_INTRO, aAndorovMoveLocs[2].m_fX, aAndorovMoveLocs[2].m_fY, aAndorovMoveLocs[2].m_fZ);
}
m_creature->SetLootRecipient(nullptr);
Reset();
}
// Wrapper to start initialize Kaldorei followers
void DoInitializeFollowers()
{
if (!m_instance)
return;
GuidList m_lKaldoreiGuids;
m_instance->GetKaldoreiGuidList(m_lKaldoreiGuids);
for (GuidList::const_iterator itr = m_lKaldoreiGuids.begin(); itr != m_lKaldoreiGuids.end(); ++itr)
if (Creature* kaldorei = m_creature->GetMap()->GetCreature(*itr))
kaldorei->GetMotionMaster()->MoveFollow(m_creature, kaldorei->GetDistance(m_creature), kaldorei->GetAngle(m_creature));
}
// Wrapper to start the event
void DoMoveToEventLocation()
{
m_creature->GetMotionMaster()->MovePoint(m_pointId, aAndorovMoveLocs[m_pointId].m_fX, aAndorovMoveLocs[m_pointId].m_fY, aAndorovMoveLocs[m_pointId].m_fZ);
m_creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
GuidList m_lKaldoreiGuids;
m_instance->GetKaldoreiGuidList(m_lKaldoreiGuids);
for (GuidList::const_iterator itr = m_lKaldoreiGuids.begin(); itr != m_lKaldoreiGuids.end(); ++itr)
if (Creature* kaldorei = m_creature->GetMap()->GetCreature(*itr))
kaldorei->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);
StartNextDialogueText(SAY_ANDOROV_INTRO_1);
}
void ReceiveAIEvent(AIEventType eventType, Unit* /*sender*/, Unit* /*invoker*/, uint32 /*miscValue*/) override
{
if (eventType == AI_EVENT_CUSTOM_A)
{
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP | UNIT_NPC_FLAG_VENDOR);
ResetTimer(ANDOROV_DESPAWN, 135000u);
}
}
void HandleDespawn()
{
DoScriptText(SAY_ANDOROV_DESPAWN, m_creature);
m_creature->ForcedDespawn(2500);
}
void HandleMove()
{
m_creature->SetWalk(false);
m_creature->GetMotionMaster()->MovePoint(m_pointId, aAndorovMoveLocs[m_pointId].m_fX, aAndorovMoveLocs[m_pointId].m_fY, aAndorovMoveLocs[m_pointId].m_fZ);
DoInitializeFollowers();
}
void ExecuteAction(uint32 action) override
{
switch (action)
{
case ANDOROV_COMMAND_AURA:
{
if (DoCastSpellIfCan(nullptr, SPELL_AURA_OF_COMMAND) == CAST_OK)
ResetCombatAction(action, urand(30000, 45000));
break;
}
case ANDOROV_BASH:
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_BASH) == CAST_OK)
ResetCombatAction(action, urand(12000, 15000));
break;
}
case ANDOROV_STRIKE:
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_STRIKE) == CAST_OK)
ResetCombatAction(action, urand(4000, 6000));
break;
}
}
}
void UpdateAI(const uint32 diff) override
{
DialogueUpdate(diff);
CombatAI::UpdateAI(diff);
}
};
UnitAI* GetAI_npc_general_andorov(Creature* creature)
{
return new npc_general_andorovAI(creature);
}
bool GossipHello_npc_general_andorov(Player* player, Creature* creature)
{
if (instance_ruins_of_ahnqiraj* instance = static_cast<instance_ruins_of_ahnqiraj*>(creature->GetInstanceData()))
{
if (instance->GetData(TYPE_RAJAXX) == IN_PROGRESS)
return true;
if (instance->GetData(TYPE_RAJAXX) == NOT_STARTED || instance->GetData(TYPE_RAJAXX) == FAIL)
player->ADD_GOSSIP_ITEM_ID(GOSSIP_ICON_CHAT, GOSSIP_ITEM_START, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
if (creature->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR))
player->ADD_GOSSIP_ITEM_ID(GOSSIP_ICON_VENDOR, GOSSIP_ITEM_TRADE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
player->SEND_GOSSIP_MENU(GOSSIP_TEXT_ID_INTRO, creature->GetObjectGuid());
}
return true;
}
bool GossipSelect_npc_general_andorov(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
{
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
if (npc_general_andorovAI* andorovAI = dynamic_cast<npc_general_andorovAI*>(creature->AI()))
andorovAI->DoMoveToEventLocation();
player->CLOSE_GOSSIP_MENU();
}
if (action == GOSSIP_ACTION_TRADE)
player->SEND_VENDORLIST(creature->GetObjectGuid());
return true;
}
enum KaldoreiEliteActions
{
KALDOREI_CLEAVE,
KALDOREI_STRIKE,
KALDOREI_ACTION_MAX,
};
struct npc_kaldorei_eliteAI : public CombatAI
{
npc_kaldorei_eliteAI(Creature* creature) : CombatAI(creature, KALDOREI_ACTION_MAX), m_instance(static_cast<ScriptedInstance*>(creature->GetInstanceData()))
{
AddCombatAction(KALDOREI_CLEAVE, 2000, 4000);
AddCombatAction(KALDOREI_STRIKE, 8000, 11000);
}
ScriptedInstance* m_instance;
void EnterEvadeMode() override
{
if (!m_instance)
return;
m_creature->RemoveAllAurasOnEvade();
m_creature->CombatStop(true);
// reset only to the last position
if (m_creature->IsAlive())
{
if (Creature* andorov = m_instance->GetSingleCreatureFromStorage(NPC_GENERAL_ANDOROV))
{
if (andorov->IsAlive())
m_creature->GetMotionMaster()->MoveFollow(andorov, m_creature->GetDistance(andorov), m_creature->GetAngle(andorov));
}
}
m_creature->SetLootRecipient(nullptr);
Reset();
}
void ExecuteAction(uint32 action) override
{
switch (action)
{
case KALDOREI_CLEAVE:
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_CLEAVE) == CAST_OK)
ResetCombatAction(action, urand(5000, 7000));
break;
}
case KALDOREI_STRIKE:
{
if (DoCastSpellIfCan(m_creature->GetVictim(), SPELL_MORTAL_STRIKE) == CAST_OK)
ResetCombatAction(action, urand(9000, 13000));
break;
}
}
}
};
UnitAI* GetAI_npc_kaldorei_elite(Creature* creature)
{
return new npc_kaldorei_eliteAI(creature);
}
void AddSC_boss_rajaxx()
{
Script* pNewScript = new Script;
pNewScript->Name = "npc_general_andorov";
pNewScript->GetAI = &GetAI_npc_general_andorov;
pNewScript->pGossipHello = &GossipHello_npc_general_andorov;
pNewScript->pGossipSelect = &GossipSelect_npc_general_andorov;
pNewScript->RegisterSelf();
pNewScript = new Script;
pNewScript->Name = "npc_kaldorei_elite";
pNewScript->GetAI = &GetAI_npc_kaldorei_elite;
pNewScript->RegisterSelf();
}
| catterpiler74/mangos-classic | src/game/AI/ScriptDevAI/scripts/kalimdor/ruins_of_ahnqiraj/boss_rajaxx.cpp | C++ | gpl-2.0 | 12,914 |
/*
* see license.txt
*/
package seventh.game.net;
import harenet.IOBuffer;
import seventh.game.entities.Entity.Type;
/**
* @author Tony
*
*/
public class NetLight extends NetEntity {
public short r, g, b;
public short luminacity;
public short size;
/**
*/
public NetLight() {
this.type = Type.LIGHT_BULB.netValue();
}
/* (non-Javadoc)
* @see seventh.game.net.NetEntity#read(java.nio.ByteBuffer)
*/
@Override
public void read(IOBuffer buffer) {
super.read(buffer);
r = (short)(buffer.getUnsignedByte());
g = (short)(buffer.getUnsignedByte());
b = (short)(buffer.getUnsignedByte());
luminacity = (short)(buffer.getUnsignedByte());
size = buffer.getShort();
}
/* (non-Javadoc)
* @see seventh.game.net.NetEntity#write(java.nio.ByteBuffer)
*/
@Override
public void write(IOBuffer buffer) {
super.write(buffer);
buffer.putUnsignedByte(r);
buffer.putUnsignedByte(g);
buffer.putUnsignedByte(b);
buffer.putUnsignedByte(luminacity);
buffer.putShort(size);
}
}
| skaghzz/seventh | src/seventh/game/net/NetLight.java | Java | gpl-2.0 | 1,208 |
/* linux/arch/arm/plat-s5pc1xx/s5pc1xx-time.c
*
* Copyright (C) 2003-2005 Simtec Electronics
* Jongpill Lee, <boyko.lee@samsung.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
* This code is based on plat-s3c/time.c
*/
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/err.h>
#include <linux/clk.h>
#include <linux/io.h>
#include <asm/system.h>
#include <asm/leds.h>
#include <asm/mach-types.h>
#include <asm/irq.h>
#include <asm/mach/time.h>
#include <mach/map.h>
#include <mach/regs-irq.h>
#include <mach/tick.h>
#include <plat/regs-sys-timer.h>
#include <plat/clock.h>
#include <plat/cpu.h>
#include <plat/regs-gpio.h>
#include <plat/gpio-bank-a1.h>
#include <plat/gpio-bank-d.h>
#include <plat/regs-clock.h>
static unsigned long timer_startval;
static unsigned long timer_usec_ticks;
static unsigned long timer_icnt;
#ifndef TICK_MAX
#define TICK_MAX (0xffff)
#endif
//#define T32_DEBUG_GPD
//#define CLK_OUT_PROBING
#define TIMER_USEC_SHIFT 16
static unsigned int s5pc1xx_systimer_read(unsigned int *reg_offset)
{
return __raw_readl(reg_offset);
}
static unsigned int s5pc1xx_systimer_write(unsigned int *reg_offset, unsigned int value)
{
unsigned int temp_regs;
__raw_writel(value, reg_offset);
if (reg_offset == S3C_SYSTIMER_TCON) {
while(!(__raw_readl(S3C_SYSTIMER_INT_CSTAT) & S3C_SYSTIMER_INT_TCON));
temp_regs = __raw_readl(S3C_SYSTIMER_INT_CSTAT);
temp_regs |= S3C_SYSTIMER_INT_TCON;
__raw_writel(temp_regs, S3C_SYSTIMER_INT_CSTAT);
} else if (reg_offset == S3C_SYSTIMER_ICNTB) {
while(!(__raw_readl(S3C_SYSTIMER_INT_CSTAT) & S3C_SYSTIMER_INT_ICNTB));
temp_regs = __raw_readl(S3C_SYSTIMER_INT_CSTAT);
temp_regs |= S3C_SYSTIMER_INT_ICNTB;
__raw_writel(temp_regs, S3C_SYSTIMER_INT_CSTAT);
} else if (reg_offset == S3C_SYSTIMER_TCNTB) {
while(!(__raw_readl(S3C_SYSTIMER_INT_CSTAT) & S3C_SYSTIMER_INT_TCNTB));
temp_regs = __raw_readl(S3C_SYSTIMER_INT_CSTAT);
temp_regs |= S3C_SYSTIMER_INT_TCNTB;
__raw_writel(temp_regs, S3C_SYSTIMER_INT_CSTAT);
}
return 0;
}
/*
* S5PC1XX has system timer to use as OS tick Timer.
* System Timer provides two distincive feature. Accurate timer which provides
* exact 1ms time tick at any power mode except sleep mode. Second one is chageable
* interrupt interval without stopping reference tick timer.
*/
/*
* timer_mask_usec_ticks
*
* given a clock and divisor, make the value to pass into timer_ticks_to_usec
* to scale the ticks into usecs
*/
static inline unsigned long timer_mask_usec_ticks(unsigned long scaler, unsigned long pclk)
{
unsigned long den = pclk / 1000;
return ((1000 << TIMER_USEC_SHIFT) * scaler + (den >> 1)) / den;
}
/*
* timer_ticks_to_usec
*
* convert timer ticks to usec.
*/
static inline unsigned long timer_ticks_to_usec(unsigned long ticks)
{
unsigned long res;
res = ticks * timer_usec_ticks;
res += 1 << (TIMER_USEC_SHIFT - 4); /* round up slightly */
return res >> TIMER_USEC_SHIFT;
}
/*
* Returns microsecond since last clock interrupt. Note that interrupts
* will have been disabled by do_gettimeoffset()
* IRQs are disabled before entering here from do_gettimeofday()
*/
static unsigned long s5pc1xx_gettimeoffset (void)
{
unsigned long tdone;
unsigned long tval;
unsigned long clk_tick_totcnt;
clk_tick_totcnt = (timer_icnt + 1) * timer_startval;
/* work out how many ticks have gone since last timer interrupt */
tval = s5pc1xx_systimer_read(S3C_SYSTIMER_ICNTO) * timer_startval;
tval += s5pc1xx_systimer_read(S3C_SYSTIMER_TCNTO);
tdone = clk_tick_totcnt - tval;
/* check to see if there is an interrupt pending */
if (s5pc1xx_ostimer_pending()) {
/* re-read the timer, and try and fix up for the missed
* interrupt. Note, the interrupt may go off before the
* timer has re-loaded from wrapping.
*/
tval = s5pc1xx_systimer_read(S3C_SYSTIMER_ICNTO) * timer_startval;
tval += s5pc1xx_systimer_read(S3C_SYSTIMER_TCNTO);
tdone = clk_tick_totcnt - tval;
if (tval != 0)
tdone += clk_tick_totcnt;
}
return timer_ticks_to_usec(tdone);
}
/*
* IRQ handler for the timer
*/
static irqreturn_t s5pc1xx_timer_interrupt(int irq, void *dev_id)
{
volatile unsigned int temp_cstat;
temp_cstat = s5pc1xx_systimer_read(S3C_SYSTIMER_INT_CSTAT);
temp_cstat |= S3C_SYSTIMER_INT_STATS;
s5pc1xx_systimer_write(S3C_SYSTIMER_INT_CSTAT, temp_cstat);
#ifdef T32_DEBUG_GPD
u32 tmp;
tmp = __raw_readl(S5PC1XX_GPDDAT);
tmp |= (0x1<<1);
__raw_writel(tmp, S5PC1XX_GPDDAT);
#endif
#if 0
do {
if(!(s5pc1xx_systimer_read(S3C_SYSTIMER_INT_CSTAT) & S3C_SYSTIMER_INT_STATS))
break;
} while(1);
#endif
#ifdef T32_DEBUG_GPD
tmp = __raw_readl(S5PC1XX_GPDDAT);
tmp &=~(0x1<<1);
__raw_writel(tmp, S5PC1XX_GPDDAT);
#endif
timer_tick();
return IRQ_HANDLED;
}
static struct irqaction s5pc1xx_timer_irq = {
.name = "S5PC1XX System Timer",
.flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
.handler = s5pc1xx_timer_interrupt,
};
/*
* Set up timer interrupt, and return the current time in seconds.
*
*/
static void s5pc1xx_timer_setup (void)
{
unsigned long tcon;
unsigned long tcnt;
unsigned long tcfg;
/* clock configuration setting and enable */
unsigned long pclk;
struct clk *clk;
#if defined(T32_DEBUG_GPD)||defined(CLK_OUT_PROBING)
unsigned long reg;
#endif
#ifdef T32_DEBUG_GPD
reg = __raw_readl(S5PC1XX_GPDCON);
reg &=~(0xf << 4);
reg |= (0x1 << 4);
__raw_writel(reg, S5PC1XX_GPDCON);
reg = __raw_readl(S5PC1XX_GPDDAT);
reg &=~(0x1<<1);
__raw_writel(reg, S5PC1XX_GPDDAT);
#endif
#ifdef CLK_OUT_PROBING
reg = __raw_readl(S5P_CLK_OUT);
reg &=~(0x1f<<12);
reg |= (0x6<<12);
__raw_writel(reg, S5P_CLK_OUT);
#endif
tcnt = TICK_MAX; /* default value for tcnt */
/* initialize system timer clock */
tcfg = s5pc1xx_systimer_read(S3C_SYSTIMER_TCFG);
tcfg &= ~S3C_SYSTIMER_TCLK_MASK;
tcfg |= S3C_SYSTIMER_TCLK_PCLK;
s5pc1xx_systimer_write(S3C_SYSTIMER_TCFG, tcfg);
/* TCFG must not be changed at run-time. If you want to change TCFG, stop timer(TCON[0] = 0) */
s5pc1xx_systimer_write(S3C_SYSTIMER_TCON, 0);
/* read the current timer configuration bits */
tcon = s5pc1xx_systimer_read(S3C_SYSTIMER_TCON);
tcfg = s5pc1xx_systimer_read(S3C_SYSTIMER_TCFG);
clk = clk_get(NULL, "systimer");
if (IS_ERR(clk))
panic("failed to get clock for system timer");
clk_enable(clk);
pclk = clk_get_rate(clk);
/* configure clock tick */
timer_usec_ticks = timer_mask_usec_ticks(S3C_SYSTIMER_PRESCALER, pclk);
tcfg &= ~S3C_SYSTIMER_TCLK_MASK;
tcfg |= S3C_SYSTIMER_TCLK_PCLK;
tcfg &= ~S3C_SYSTIMER_PRESCALER_MASK;
tcfg |= S3C_SYSTIMER_PRESCALER - 1;
tcnt = ((pclk / S3C_SYSTIMER_PRESCALER) / S3C_SYSTIMER_TARGET_HZ) - 1;
/* check to see if timer is within 16bit range... */
if (tcnt > TICK_MAX) {
panic("setup_timer: HZ is too small, cannot configure timer!");
return;
}
s5pc1xx_systimer_write(S3C_SYSTIMER_TCFG, tcfg);
timer_startval = tcnt;
s5pc1xx_systimer_write(S3C_SYSTIMER_TCNTB, tcnt);
/* set Interrupt tick value */
timer_icnt = (S3C_SYSTIMER_TARGET_HZ / HZ) - 1;
s5pc1xx_systimer_write(S3C_SYSTIMER_ICNTB, timer_icnt);
tcon = S3C_SYSTIMER_INT_AUTO | S3C_SYSTIMER_START | S3C_SYSTIMER_INT_START | S3C_SYSTIMER_AUTO_RELOAD;
s5pc1xx_systimer_write(S3C_SYSTIMER_TCON, tcon);
pr_debug("timer tcon=%08lx, tcnt %04lx, icnt %04lx, tcfg %08lx, usec %08lx\n",
tcon, tcnt, timer_icnt, tcfg, timer_usec_ticks);
/* Interrupt Start and Enable */
s5pc1xx_systimer_write(S3C_SYSTIMER_INT_CSTAT, (S3C_SYSTIMER_INT_ICNTEIE));
}
static void __init s5pc1xx_timer_init(void)
{
s5pc1xx_timer_setup();
setup_irq(IRQ_SYSTIMER, &s5pc1xx_timer_irq);
}
struct sys_timer s5pc1xx_timer = {
.init = s5pc1xx_timer_init,
.offset = s5pc1xx_gettimeoffset,
.resume = s5pc1xx_timer_setup
};
| maliyu/SMDKV210-kernel | arch/arm/plat-s5pc1xx/s5pc1xx-time.c | C | gpl-2.0 | 8,456 |
/*
* sound/uart6850.c
*
*
* Copyright (C) by Hannu Savolainen 1993-1997
*
* OSS/Free for Linux is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)
* Version 2 (June 1991). See the "COPYING" file distributed with this software
* for more info.
* Extended by Alan Cox for Red Hat Software. Now a loadable MIDI driver.
* 28/4/97 - (C) Copyright Alan Cox. Released under the GPL version 2.
*
* Alan Cox: Updated for new modular code. Removed snd_* irq handling. Now
* uses native linux resources
* Christoph Hellwig: Adapted to module_init/module_exit
* Jeff Garzik: Made it work again, in theory
* FIXME: If the request_irq() succeeds, the probe succeeds. Ug.
*
* Status: Testing required (no shit -jgarzik)
*
*
*/
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/spinlock.h>
/* Mon Nov 22 22:38:35 MET 1993 marco@driq.home.usn.nl:
* added 6850 support, used with COVOX SoundMaster II and custom cards.
*/
#include "sound_config.h"
static int uart6850_base = 0x330;
static int *uart6850_osp;
#define DATAPORT (uart6850_base)
#define COMDPORT (uart6850_base+1)
#define STATPORT (uart6850_base+1)
static int uart6850_status(void)
{
return inb(STATPORT);
}
#define input_avail() (uart6850_status()&INPUT_AVAIL)
#define output_ready() (uart6850_status()&OUTPUT_READY)
static void uart6850_cmd(unsigned char cmd)
{
outb(cmd, COMDPORT);
}
static int uart6850_read(void)
{
return inb(DATAPORT);
}
static void uart6850_write(unsigned char byte)
{
outb(byte, DATAPORT);
}
#define OUTPUT_READY 0x02 /* Mask for data ready Bit */
#define INPUT_AVAIL 0x01 /* Mask for Data Send Ready Bit */
#define UART_RESET 0x95
#define UART_MODE_ON 0x03
static int uart6850_opened;
static int uart6850_irq;
static int uart6850_detected;
static int my_dev;
static DEFINE_SPINLOCK(lock);
static void (*midi_input_intr) (int dev, unsigned char data);
static void poll_uart6850(unsigned long dummy);
static struct timer_list uart6850_timer =
TIMER_INITIALIZER(poll_uart6850, 0, 0);
static void uart6850_input_loop(void)
{
int count = 10;
while (count)
{
/*
* Not timed out
*/
if (input_avail())
{
unsigned char c = uart6850_read();
count = 100;
if (uart6850_opened & OPEN_READ)
midi_input_intr(my_dev, c);
}
else
{
while (!input_avail() && count)
count--;
}
}
}
static irqreturn_t m6850intr(int irq, void *dev_id, struct pt_regs *dummy)
{
if (input_avail())
uart6850_input_loop();
return IRQ_HANDLED;
}
/*
* It looks like there is no input interrupts in the UART mode. Let's try
* polling.
*/
static void poll_uart6850(unsigned long dummy)
{
unsigned long flags;
if (!(uart6850_opened & OPEN_READ))
return; /* Device has been closed */
spin_lock_irqsave(&lock,flags);
if (input_avail())
uart6850_input_loop();
uart6850_timer.expires = 1 + jiffies;
add_timer(&uart6850_timer);
/*
* Come back later
*/
spin_unlock_irqrestore(&lock,flags);
}
static int uart6850_open(int dev, int mode,
void (*input) (int dev, unsigned char data),
void (*output) (int dev)
)
{
if (uart6850_opened)
{
/* printk("Midi6850: Midi busy\n");*/
return -EBUSY;
};
uart6850_cmd(UART_RESET);
uart6850_input_loop();
midi_input_intr = input;
uart6850_opened = mode;
poll_uart6850(0); /*
* Enable input polling
*/
return 0;
}
static void uart6850_close(int dev)
{
uart6850_cmd(UART_MODE_ON);
del_timer(&uart6850_timer);
uart6850_opened = 0;
}
static int uart6850_out(int dev, unsigned char midi_byte)
{
int timeout;
unsigned long flags;
/*
* Test for input since pending input seems to block the output.
*/
spin_lock_irqsave(&lock,flags);
if (input_avail())
uart6850_input_loop();
spin_unlock_irqrestore(&lock,flags);
/*
* Sometimes it takes about 13000 loops before the output becomes ready
* (After reset). Normally it takes just about 10 loops.
*/
for (timeout = 30000; timeout > 0 && !output_ready(); timeout--); /*
* Wait
*/
if (!output_ready())
{
printk(KERN_WARNING "Midi6850: Timeout\n");
return 0;
}
uart6850_write(midi_byte);
return 1;
}
static inline int uart6850_command(int dev, unsigned char *midi_byte)
{
return 1;
}
static inline int uart6850_start_read(int dev)
{
return 0;
}
static inline int uart6850_end_read(int dev)
{
return 0;
}
static inline void uart6850_kick(int dev)
{
}
static inline int uart6850_buffer_status(int dev)
{
return 0; /*
* No data in buffers
*/
}
#define MIDI_SYNTH_NAME "6850 UART Midi"
#define MIDI_SYNTH_CAPS SYNTH_CAP_INPUT
#include "midi_synth.h"
static struct midi_operations uart6850_operations =
{
.owner = THIS_MODULE,
.info = {"6850 UART", 0, 0, SNDCARD_UART6850},
.converter = &std_midi_synth,
.in_info = {0},
.open = uart6850_open,
.close = uart6850_close,
.outputc = uart6850_out,
.start_read = uart6850_start_read,
.end_read = uart6850_end_read,
.kick = uart6850_kick,
.command = uart6850_command,
.buffer_status = uart6850_buffer_status
};
static void __init attach_uart6850(struct address_info *hw_config)
{
int ok, timeout;
unsigned long flags;
if (!uart6850_detected)
return;
if ((my_dev = sound_alloc_mididev()) == -1)
{
printk(KERN_INFO "uart6850: Too many midi devices detected\n");
return;
}
uart6850_base = hw_config->io_base;
uart6850_osp = hw_config->osp;
uart6850_irq = hw_config->irq;
spin_lock_irqsave(&lock,flags);
for (timeout = 30000; timeout > 0 && !output_ready(); timeout--); /*
* Wait
*/
uart6850_cmd(UART_MODE_ON);
ok = 1;
spin_unlock_irqrestore(&lock,flags);
conf_printf("6850 Midi Interface", hw_config);
std_midi_synth.midi_dev = my_dev;
hw_config->slots[4] = my_dev;
midi_devs[my_dev] = &uart6850_operations;
sequencer_init();
}
static inline int reset_uart6850(void)
{
uart6850_read();
return 1; /*
* OK
*/
}
static int __init probe_uart6850(struct address_info *hw_config)
{
int ok;
uart6850_osp = hw_config->osp;
uart6850_base = hw_config->io_base;
uart6850_irq = hw_config->irq;
if (request_irq(uart6850_irq, m6850intr, 0, "MIDI6850", NULL) < 0)
return 0;
ok = reset_uart6850();
uart6850_detected = ok;
return ok;
}
static void __exit unload_uart6850(struct address_info *hw_config)
{
free_irq(hw_config->irq, NULL);
sound_unload_mididev(hw_config->slots[4]);
}
static struct address_info cfg_mpu;
static int __initdata io = -1;
static int __initdata irq = -1;
MODULE_PARM(io,"i");
MODULE_PARM(irq,"i");
static int __init init_uart6850(void)
{
cfg_mpu.io_base = io;
cfg_mpu.irq = irq;
if (cfg_mpu.io_base == -1 || cfg_mpu.irq == -1) {
printk(KERN_INFO "uart6850: irq and io must be set.\n");
return -EINVAL;
}
if (probe_uart6850(&cfg_mpu))
return -ENODEV;
attach_uart6850(&cfg_mpu);
return 0;
}
static void __exit cleanup_uart6850(void)
{
unload_uart6850(&cfg_mpu);
}
module_init(init_uart6850);
module_exit(cleanup_uart6850);
#ifndef MODULE
static int __init setup_uart6850(char *str)
{
/* io, irq */
int ints[3];
str = get_options(str, ARRAY_SIZE(ints), ints);
io = ints[1];
irq = ints[2];
return 1;
}
__setup("uart6850=", setup_uart6850);
#endif
MODULE_LICENSE("GPL");
| fzqing/linux-2.6 | sound/oss/uart6850.c | C | gpl-2.0 | 7,277 |
#!/usr/bin/env python
# print_needed_variables.py
#
# Copyright (C) 2014, 2015 Kano Computing Ltd.
# License: http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License v2
#
import os
import sys
if __name__ == '__main__' and __package__ is None:
dir_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
if dir_path != '/usr':
sys.path.insert(1, dir_path)
from kano_profile.badges import load_badge_rules
from kano.utils import write_json, uniqify_list
all_rules = load_badge_rules()
variables_needed = dict()
for category, subcats in all_rules.iteritems():
for subcat, items in subcats.iteritems():
for item, rules in items.iteritems():
targets = rules['targets']
for target in targets:
app = target[0]
variable = target[1]
variables_needed.setdefault(app, list()).append(variable)
for key in variables_needed.iterkeys():
variables_needed[key] = uniqify_list(variables_needed[key])
write_json('variables_needed.json', variables_needed, False)
| rcocetta/kano-profile | tools/print_needed_variables.py | Python | gpl-2.0 | 1,082 |
#!/usr/bin/python
# (c) 2017, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
module: sf_snapshot_schedule_manager
short_description: Manage SolidFire snapshot schedules
extends_documentation_fragment:
- netapp.solidfire
version_added: '2.3'
author: Sumit Kumar (sumit4@netapp.com)
description:
- Create, destroy, or update accounts on SolidFire
options:
state:
description:
- Whether the specified schedule should exist or not.
required: true
choices: ['present', 'absent']
paused:
description:
- Pause / Resume a schedule.
required: false
recurring:
description:
- Should the schedule recur?
required: false
time_interval_days:
description: Time interval in days.
required: false
default: 1
time_interval_hours:
description: Time interval in hours.
required: false
default: 0
time_interval_minutes:
description: Time interval in minutes.
required: false
default: 0
name:
description:
- Name for the snapshot schedule.
required: true
snapshot_name:
description:
- Name for the created snapshots.
required: false
volumes:
description:
- Volume IDs that you want to set the snapshot schedule for.
- At least 1 volume ID is required for creating a new schedule.
- required when C(state=present)
required: false
retention:
description:
- Retention period for the snapshot.
- Format is 'HH:mm:ss'.
required: false
schedule_id:
description:
- The schedule ID for the schedule that you want to update or delete.
required: false
starting_date:
description:
- Starting date for the schedule.
- Required when C(state=present).
- Please use two '-' in the above format, or you may see an error- TypeError, is not JSON serializable description.
- "Format: C(2016--12--01T00:00:00Z)"
required: false
'''
EXAMPLES = """
- name: Create Snapshot schedule
sf_snapshot_schedule_manager:
hostname: "{{ solidfire_hostname }}"
username: "{{ solidfire_username }}"
password: "{{ solidfire_password }}"
state: present
name: Schedule_A
time_interval_days: 1
starting_date: 2016--12--01T00:00:00Z
volumes: 7
- name: Update Snapshot schedule
sf_snapshot_schedule_manager:
hostname: "{{ solidfire_hostname }}"
username: "{{ solidfire_username }}"
password: "{{ solidfire_password }}"
state: present
schedule_id: 6
recurring: True
snapshot_name: AnsibleSnapshots
- name: Delete Snapshot schedule
sf_snapshot_schedule_manager:
hostname: "{{ solidfire_hostname }}"
username: "{{ solidfire_username }}"
password: "{{ solidfire_password }}"
state: absent
schedule_id: 6
"""
RETURN = """
schedule_id:
description: Schedule ID of the newly created schedule
returned: success
type: string
"""
import traceback
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils._text import to_native
import ansible.module_utils.netapp as netapp_utils
HAS_SF_SDK = netapp_utils.has_sf_sdk()
class SolidFireSnapShotSchedule(object):
def __init__(self):
self.argument_spec = netapp_utils.ontap_sf_host_argument_spec()
self.argument_spec.update(dict(
state=dict(required=True, choices=['present', 'absent']),
name=dict(required=True, type='str'),
time_interval_days=dict(required=False, type='int', default=1),
time_interval_hours=dict(required=False, type='int', default=0),
time_interval_minutes=dict(required=False, type='int', default=0),
paused=dict(required=False, type='bool'),
recurring=dict(required=False, type='bool'),
starting_date=dict(type='str'),
snapshot_name=dict(required=False, type='str'),
volumes=dict(required=False, type='list'),
retention=dict(required=False, type='str'),
schedule_id=dict(type='int'),
))
self.module = AnsibleModule(
argument_spec=self.argument_spec,
required_if=[
('state', 'present', ['starting_date', 'volumes'])
],
supports_check_mode=True
)
p = self.module.params
# set up state variables
self.state = p['state']
self.name = p['name']
# self.interval = p['interval']
self.time_interval_days = p['time_interval_days']
self.time_interval_hours = p['time_interval_hours']
self.time_interval_minutes = p['time_interval_minutes']
self.paused = p['paused']
self.recurring = p['recurring']
self.starting_date = p['starting_date']
if self.starting_date is not None:
self.starting_date = self.starting_date.replace("--", "-")
self.snapshot_name = p['snapshot_name']
self.volumes = p['volumes']
self.retention = p['retention']
self.schedule_id = p['schedule_id']
self.create_schedule_result = None
if HAS_SF_SDK is False:
self.module.fail_json(msg="Unable to import the SolidFire Python SDK")
else:
self.sfe = netapp_utils.create_sf_connection(module=self.module)
def get_schedule(self):
schedule_list = self.sfe.list_schedules()
for schedule in schedule_list.schedules:
if schedule.name == self.name:
# Update self.schedule_id:
if self.schedule_id is not None:
if schedule.schedule_id == self.schedule_id:
return schedule
else:
self.schedule_id = schedule.schedule_id
return schedule
return None
def create_schedule(self):
try:
sched = netapp_utils.Schedule()
# if self.interval == 'time_interval':
sched.frequency = netapp_utils.TimeIntervalFrequency(days=self.time_interval_days,
hours=self.time_interval_hours,
minutes=self.time_interval_minutes)
# Create schedule
sched.name = self.name
sched.schedule_info = netapp_utils.ScheduleInfo(
volume_ids=self.volumes,
snapshot_name=self.snapshot_name,
retention=self.retention
)
sched.paused = self.paused
sched.recurring = self.recurring
sched.starting_date = self.starting_date
self.create_schedule_result = self.sfe.create_schedule(schedule=sched)
except Exception as e:
self.module.fail_json(msg='Error creating schedule %s: %s' % (self.name, to_native(e)),
exception=traceback.format_exc())
def delete_schedule(self):
try:
get_schedule_result = self.sfe.get_schedule(schedule_id=self.schedule_id)
sched = get_schedule_result.schedule
sched.to_be_deleted = True
self.sfe.modify_schedule(schedule=sched)
except Exception as e:
self.module.fail_json(msg='Error deleting schedule %s: %s' % (self.name, to_native(e)),
exception=traceback.format_exc())
def update_schedule(self):
try:
get_schedule_result = self.sfe.get_schedule(schedule_id=self.schedule_id)
sched = get_schedule_result.schedule
# Update schedule properties
# if self.interval == 'time_interval':
temp_frequency = netapp_utils.TimeIntervalFrequency(days=self.time_interval_days,
hours=self.time_interval_hours,
minutes=self.time_interval_minutes)
if sched.frequency.days != temp_frequency.days or \
sched.frequency.hours != temp_frequency.hours \
or sched.frequency.minutes != temp_frequency.minutes:
sched.frequency = temp_frequency
sched.name = self.name
if self.volumes is not None:
sched.schedule_info.volume_ids = self.volumes
if self.retention is not None:
sched.schedule_info.retention = self.retention
if self.snapshot_name is not None:
sched.schedule_info.snapshot_name = self.snapshot_name
if self.paused is not None:
sched.paused = self.paused
if self.recurring is not None:
sched.recurring = self.recurring
if self.starting_date is not None:
sched.starting_date = self.starting_date
# Make API call
self.sfe.modify_schedule(schedule=sched)
except Exception as e:
self.module.fail_json(msg='Error updating schedule %s: %s' % (self.name, to_native(e)),
exception=traceback.format_exc())
def apply(self):
changed = False
schedule_exists = False
update_schedule = False
schedule_detail = self.get_schedule()
if schedule_detail:
schedule_exists = True
if self.state == 'absent':
changed = True
elif self.state == 'present':
# Check if we need to update the account
if self.retention is not None and schedule_detail.schedule_info.retention != self.retention:
update_schedule = True
changed = True
elif schedule_detail.name != self.name:
update_schedule = True
changed = True
elif self.snapshot_name is not None and schedule_detail.schedule_info.snapshot_name != self.snapshot_name:
update_schedule = True
changed = True
elif self.volumes is not None and schedule_detail.schedule_info.volume_ids != self.volumes:
update_schedule = True
changed = True
elif self.paused is not None and schedule_detail.paused != self.paused:
update_schedule = True
changed = True
elif self.recurring is not None and schedule_detail.recurring != self.recurring:
update_schedule = True
changed = True
elif self.starting_date is not None and schedule_detail.starting_date != self.starting_date:
update_schedule = True
changed = True
elif self.time_interval_minutes is not None or self.time_interval_hours is not None \
or self.time_interval_days is not None:
temp_frequency = netapp_utils.TimeIntervalFrequency(days=self.time_interval_days,
hours=self.time_interval_hours,
minutes=self.time_interval_minutes)
if schedule_detail.frequency.days != temp_frequency.days or \
schedule_detail.frequency.hours != temp_frequency.hours \
or schedule_detail.frequency.minutes != temp_frequency.minutes:
update_schedule = True
changed = True
else:
if self.state == 'present':
changed = True
if changed:
if self.module.check_mode:
# Skip changes
pass
else:
if self.state == 'present':
if not schedule_exists:
self.create_schedule()
elif update_schedule:
self.update_schedule()
elif self.state == 'absent':
self.delete_schedule()
if self.create_schedule_result is not None:
self.module.exit_json(changed=changed, schedule_id=self.create_schedule_result.schedule_id)
else:
self.module.exit_json(changed=changed)
def main():
v = SolidFireSnapShotSchedule()
v.apply()
if __name__ == '__main__':
main()
| jimi-c/ansible | lib/ansible/modules/storage/netapp/sf_snapshot_schedule_manager.py | Python | gpl-3.0 | 13,004 |
// Always include the necessary header files.
// Including SFGUI/Widgets.hpp includes everything
// you can possibly need automatically.
#include <SFGUI/SFGUI.hpp>
#include <SFGUI/Widgets.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/OpenGL.hpp>
#include <cmath>
int main() {
// Create the main SFML window
sf::RenderWindow app_window( sf::VideoMode( 800, 600 ), "SFGUI Canvas Example", sf::Style::Titlebar | sf::Style::Close );
// We have to do this because we don't use SFML to draw.
app_window.resetGLStates();
// Create an SFGUI. This is required before doing anything with SFGUI.
sfg::SFGUI sfgui;
// Create our OpenGL canvas window
auto opengl_window = sfg::Window::Create();
opengl_window->SetTitle( "OpenGL canvas" );
opengl_window->SetPosition( sf::Vector2f( 50.f, 50.f ) );
// Create our SFML canvas window
auto sfml_window = sfg::Window::Create();
sfml_window->SetTitle( "SFML canvas" );
sfml_window->SetPosition( sf::Vector2f( 300.f, 50.f ) );
// Create our SFML scrollable canvas window
auto sfml_scrollable_window = sfg::Window::Create( sfg::Window::Style::TITLEBAR | sfg::Window::Style::BACKGROUND );
sfml_scrollable_window->SetTitle( "SFML scrollable canvas" );
sfml_scrollable_window->SetPosition( sf::Vector2f( 300.f, 200.f ) );
// Create the Canvases.
// Passing true in to Create() tells SFGUI
// to create a depth buffer for the canvas.
// This might be needed for your OpenGL rendering.
// Specifying nothing defaults to no depth buffer.
auto opengl_canvas = sfg::Canvas::Create( true );
auto sfml_canvas = sfg::Canvas::Create();
auto sfml_scrollable_canvas = sfg::Canvas::Create();
// Create a pair of scrollbars.
auto horizontal_scrollbar = sfg::Scrollbar::Create( sfg::Scrollbar::Orientation::HORIZONTAL );
auto vertical_scrollbar = sfg::Scrollbar::Create( sfg::Scrollbar::Orientation::VERTICAL );
// Create a table to put the scrollbars and scrollable canvas in.
auto table = sfg::Table::Create();
table->Attach( sfml_scrollable_canvas, sf::Rect<sf::Uint32>( 0, 0, 1, 1 ), sfg::Table::FILL | sfg::Table::EXPAND, sfg::Table::FILL | sfg::Table::EXPAND );
table->Attach( vertical_scrollbar, sf::Rect<sf::Uint32>( 1, 0, 1, 1 ), 0, sfg::Table::FILL );
table->Attach( horizontal_scrollbar, sf::Rect<sf::Uint32>( 0, 1, 1, 1 ), sfg::Table::FILL, 0 );
// Add the Canvases to the windows.
opengl_window->Add( opengl_canvas );
sfml_window->Add( sfml_canvas );
sfml_scrollable_window->Add( table );
// Create an sf::Sprite for demonstration purposes.
sf::Texture texture;
texture.loadFromFile( "data/sfgui.png" );
sf::Sprite sprite;
sprite.setTexture( texture );
// Create an sf::RectangleShape for demonstration purposes.
sf::RectangleShape rectangle_shape( sf::Vector2f( 218.f * 20, 84.f * 20 ) );
rectangle_shape.setTexture( &texture );
const static auto scrollable_canvas_size = 300.f;
// Create an sf::View to control which part of our rectangle is drawn.
sf::View view( sf::Vector2f( 100.f, 100.f ), sf::Vector2f( scrollable_canvas_size, scrollable_canvas_size ) );
// Link the adjustments to our view.
auto horizontal_adjustment = horizontal_scrollbar->GetAdjustment();
auto vertical_adjustment = vertical_scrollbar->GetAdjustment();
horizontal_adjustment->SetLower( scrollable_canvas_size / 2.f );
horizontal_adjustment->SetUpper( 218.f * 20 - scrollable_canvas_size / 2.f );
horizontal_adjustment->SetMinorStep( 20.f );
horizontal_adjustment->SetMajorStep( scrollable_canvas_size );
horizontal_adjustment->SetPageSize( scrollable_canvas_size );
vertical_adjustment->SetLower( scrollable_canvas_size / 2.f );
vertical_adjustment->SetUpper( 84.f * 20 - scrollable_canvas_size / 2.f );
vertical_adjustment->SetMinorStep( 20.f );
vertical_adjustment->SetMajorStep( scrollable_canvas_size );
vertical_adjustment->SetPageSize( scrollable_canvas_size );
horizontal_adjustment->GetSignal( sfg::Adjustment::OnChange ).Connect( [&view, &horizontal_adjustment]() {
view.setCenter( horizontal_adjustment->GetValue(), view.getCenter().y );
} );
vertical_adjustment->GetSignal( sfg::Adjustment::OnChange ).Connect( [&view, &vertical_adjustment]() {
view.setCenter( view.getCenter().x, vertical_adjustment->GetValue() );
} );
// Because Canvases provide a virtual surface to draw
// on much like a ScrolledWindow, specifying their
// minimum requisition is necessary.
opengl_canvas->SetRequisition( sf::Vector2f( 200.f, 150.f ) );
sfml_canvas->SetRequisition( sf::Vector2f( texture.getSize() ) );
sfml_scrollable_canvas->SetRequisition( sf::Vector2f( scrollable_canvas_size, scrollable_canvas_size ) );
// Create a desktop to contain our Windows.
sfg::Desktop desktop;
desktop.Add( opengl_window );
desktop.Add( sfml_window );
desktop.Add( sfml_scrollable_window );
sf::Clock clock;
sf::Clock rotation_clock;
// Update an initial time to construct the GUI before drawing begins.
// This makes sure that there are no frames in which no GUI is visible.
desktop.Update( 0.f );
// Start the game loop
while ( app_window.isOpen() ) {
// Process events
sf::Event event;
while ( app_window.pollEvent( event ) ) {
// Handle events
desktop.HandleEvent( event );
// Close window : exit
if ( event.type == sf::Event::Closed ) {
return EXIT_SUCCESS;
}
}
// Update the GUI every 5ms
if( clock.getElapsedTime().asMicroseconds() >= 5000 ) {
// Update() takes the elapsed time in seconds.
desktop.Update( static_cast<float>( clock.getElapsedTime().asMicroseconds() ) / 1000000.f );
clock.restart();
}
// Clear screen
app_window.clear();
// We bind the Canvases and draw whatever we want to them.
// This must occur BEFORE the GUI is displayed.
// You must not forget to set whatever context was active
// before to active again after you unbind a Canvas.
// Clear() takes an RGBA color and a bool which specifies
// if you want to clear the depth buffer as well. In this
// case, we do.
// First the Canvas for OpenGL rendering.
opengl_canvas->Bind();
opengl_canvas->Clear( sf::Color( 0, 0, 0, 0 ), true );
// Do some OpenGL drawing. If you don't intend
// on drawing with OpenGL just ignore this section.
glEnable( GL_DEPTH_TEST );
glDepthMask( GL_TRUE );
glDisable( GL_TEXTURE_2D );
glMatrixMode( GL_MODELVIEW );
glPushMatrix();
glLoadIdentity();
glTranslatef( 0.f, 0.f, -2.f );
glRotatef( rotation_clock.getElapsedTime().asSeconds() * 30.f, 0.f, 0.f, 1.f );
glDisable( GL_TEXTURE_2D );
glMatrixMode( GL_PROJECTION );
glPushMatrix();
glLoadIdentity();
glViewport( 0, 0, static_cast<int>( opengl_canvas->GetAllocation().width ), static_cast<int>( opengl_canvas->GetAllocation().height ) );
static const auto pi = 3.1415926535897932384626433832795f;
static const auto fov = 90.f;
static const auto near_distance = 1.f;
static const auto far_distance = 20.f;
auto aspect = opengl_canvas->GetAllocation().width / opengl_canvas->GetAllocation().height;
auto frustum_height = std::tan( fov / 360 * pi ) * near_distance;
auto frustum_width = frustum_height * aspect;
glFrustum( -frustum_width, frustum_width, -frustum_height, frustum_height, near_distance, far_distance );
glBegin( GL_QUADS );
glVertex2s( -1, 1 );
glVertex2s( -1, -1 );
glVertex2s( 1, -1 );
glVertex2s( 1, 1 );
glEnd();
glPopMatrix();
glMatrixMode( GL_MODELVIEW );
glPopMatrix();
glViewport( 0, 0, static_cast<int>( app_window.getSize().x ), static_cast<int>( app_window.getSize().y ) );
glEnable( GL_TEXTURE_2D );
glDisable( GL_DEPTH_TEST );
opengl_canvas->Display();
opengl_canvas->Unbind();
// Then the Canvas for SFML rendering.
sfml_canvas->Bind();
sfml_canvas->Clear( sf::Color( 0, 0, 0, 0 ) );
// Draw the SFML Sprite.
sfml_canvas->Draw( sprite );
sfml_canvas->Display();
sfml_canvas->Unbind();
// Then the scrollable Canvas for SFML rendering.
sfml_scrollable_canvas->Bind();
sfml_scrollable_canvas->Clear( sf::Color( 0, 0, 0, 0 ) );
// Draw the SFML Sprite.
sfml_scrollable_canvas->SetView( view );
sfml_scrollable_canvas->Draw( rectangle_shape );
sfml_scrollable_canvas->Display();
sfml_scrollable_canvas->Unbind();
// This is important.
app_window.setActive( true );
// Draw the GUI
sfgui.Display( app_window );
// Update the window
app_window.display();
}
return EXIT_SUCCESS;
}
| AdrienJarretier/MathGame | extlibs/sfgui-0.3.2-vs2017-64/examples/Canvas.cpp | C++ | gpl-3.0 | 8,376 |
<div>
<h2 piwik-enriched-headline
class="card-title"
help-url="http://piwik.org/docs/manage-websites/#all-websites-dashboard"
feature-name="{{ 'General_AllWebsitesDashboard'|translate }}">
{{ 'General_AllWebsitesDashboard'|translate }}
<span class='smallTitle'
title="{{ 'General_EvolutionSummaryGeneric'|translate:('General_NVisits'|translate:model.totalVisits):date:model.lastVisits:model.lastVisitsDate:(model.totalVisits|evolution:model.lastVisits)}}"
ng-bind-html="'General_TotalVisitsPageviewsActionsRevenue' | translate:('<strong>'+model.totalVisits+'</strong>'):('<strong>'+model.totalPageviews+'</strong>'):('<strong>'+model.totalActions+'</strong>'):('<strong>' + model.totalRevenue + '</strong>')">
</span>
</h2>
<table id="mt" class="dataTable" cellspacing="0">
<thead>
<tr>
<th id="names" class="label" ng-click="model.sortBy('label')" ng-class="{columnSorted: 'label' == model.sortColumn}">
<span class="heading">{{ 'General_Website'|translate }}</span>
<span ng-class="{multisites_asc: !model.reverse && 'label' == model.sortColumn, multisites_desc: model.reverse && 'label' == model.sortColumn}" class="arrow"></span>
</th>
<th id="visits" class="multisites-column" ng-click="model.sortBy('nb_visits')" ng-class="{columnSorted: 'nb_visits' == model.sortColumn}">
<span ng-class="{multisites_asc: !model.reverse && 'nb_visits' == model.sortColumn, multisites_desc: model.reverse && 'nb_visits' == model.sortColumn}" class="arrow"></span>
<span class="heading">{{ 'General_ColumnNbVisits'|translate }}</span>
</th>
<th id="pageviews" class="multisites-column" ng-click="model.sortBy('nb_pageviews')" ng-class="{columnSorted: 'nb_pageviews' == model.sortColumn}">
<span ng-class="{multisites_asc: !model.reverse && 'nb_pageviews' == model.sortColumn, multisites_desc: model.reverse && 'nb_pageviews' == model.sortColumn}" class="arrow"></span>
<span class="heading">{{ 'General_ColumnPageviews'|translate }}</span>
</th>
<th ng-if="displayRevenueColumn" id="revenue" class="multisites-column" ng-click="model.sortBy('revenue')" ng-class="{columnSorted: 'revenue' == model.sortColumn}">
<span ng-class="{multisites_asc: !model.reverse && 'revenue' == model.sortColumn, multisites_desc: model.reverse && 'revenue' == model.sortColumn}" class="arrow"></span>
<span class="heading">{{ 'General_ColumnRevenue'|translate }}</span>
</th>
<th id="evolution" colspan="{{ showSparklines ? 2 : 1 }}" ng-class="{columnSorted: evolutionSelector == model.sortColumn}">
<span class="arrow" ng-class="{multisites_asc: !model.reverse && evolutionSelector == model.sortColumn, multisites_desc: model.reverse && evolutionSelector == model.sortColumn}"></span>
<span class="evolution"
ng-click="model.sortBy(evolutionSelector)"> {{ 'MultiSites_Evolution'|translate }}</span>
<select class="selector browser-default" id="evolution_selector" ng-model="evolutionSelector"
ng-change="model.sortBy(evolutionSelector)">
<option value="visits_evolution">{{ 'General_ColumnNbVisits'|translate }}</option>
<option value="pageviews_evolution">{{ 'General_ColumnPageviews'|translate }}</option>
<option ng-if="displayRevenueColumn" value="revenue_evolution">{{ 'General_ColumnRevenue'|translate }}</option>
</select>
</th>
</tr>
</thead>
<tbody id="tb" ng-if="model.isLoading">
<tr>
<td colspan="7" class="allWebsitesLoading">
<div piwik-activity-indicator loading-message="model.loadingMessage" loading="model.isLoading"></div>
</td>
</tr>
</tbody>
<tbody id="tb" ng-if="!model.isLoading">
<tr ng-if="model.errorLoadingSites">
<td colspan="7">
<div class="notification system notification-error">
{{ 'General_ErrorRequest'|translate:(''):('') }}
<br /><br />
{{ 'General_NeedMoreHelp'|translate }}
<a rel="noreferrer" target="_blank" href="https://piwik.org/faq/troubleshooting/faq_19489/">{{ 'General_Faq'|translate }}</a>
–
<a rel="noreferrer" target="_blank" href="http://forum.piwik.org/">{{ 'Feedback_CommunityHelp'|translate }}</a>
<span ng-show="areAdsForProfessionalServicesEnabled"> – </span>
<a ng-show="areAdsForProfessionalServicesEnabled" rel="noreferrer" target="_blank" href="https://piwik.org/support/?pk_campaign=Help&pk_medium=AjaxError&pk_content=MultiSites&pk_source=Piwik_App">{{ 'Feedback_ProfessionalHelp'|translate }}</a>.
</div>
</td>
</tr>
<tr website="website"
evolution-metric="evolutionSelector"
piwik-multisites-site
date-sparkline="dateSparkline"
show-sparklines="showSparklines"
metric="model.sortColumn"
display-revenue-column="displayRevenueColumn"
ng-repeat="website in model.sites">
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="8" class="paging" ng-hide="model.numberOfPages() <= 1">
<div class="row">
<div class="col s3 add_new_site">
<a ng-if="hasSuperUserAccess" href="{{ url }}?module=SitesManager&action=index&showaddsite=1&period={{ period }}&date={{ date }}&idSite={{ idSite }}">
<span class="icon-add"></span> {{ 'SitesManager_AddSite'|translate }}
</a>
</div>
<div class="col s6">
<span id="prev" class="previous dataTablePrevious" ng-hide="model.currentPage == 0" ng-click="model.previousPage()">
<span style="cursor:pointer;">« {{ 'General_Previous'|translate }}</span>
</span>
<span class="dataTablePages">
<span id="counter">
{{ 'General_Pagination'|translate:model.getCurrentPagingOffsetStart():model.getCurrentPagingOffsetEnd():model.getNumberOfFilteredSites() }}
</span>
</span>
<span id="next" class="next dataTableNext" ng-hide="model.currentPage >= model.getNumberOfPages()" ng-click="model.nextPage()">
<span style="cursor:pointer;" class="pointer">{{ 'General_Next'|translate }} »</span>
</span>
</div>
<div class="col s3"> </div>
</div>
</td>
</tr>
<tr row_id="last">
<td colspan="8" class="input-field site_search">
<input type="text"
ng-model="searchTerm"
class="browser-default"
piwik-onenter="model.searchSite(searchTerm)"
placeholder="{{ 'Actions_SubmenuSitesearch' | translate }}">
<span title="{{ 'General_ClickToSearch' | translate }}"
ng-click="model.searchSite(searchTerm)"
class="icon-search search_ico"></span>
</td>
</tr>
</tfoot>
</table>
</div>
| Morerice/piwik | plugins/MultiSites/angularjs/dashboard/dashboard.directive.html | HTML | gpl-3.0 | 7,860 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Change default module name</title>
</head>
<body><div class="manualnavbar" style="text-align: center;">
<div class="prev" style="text-align: left; float: left;"><a href="yaf-dispatcher.setdefaultcontroller.html">Yaf_Dispatcher::setDefaultController</a></div>
<div class="next" style="text-align: right; float: right;"><a href="yaf-dispatcher.seterrorhandler.html">Yaf_Dispatcher::setErrorHandler</a></div>
<div class="up"><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></div>
<div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="yaf-dispatcher.setdefaultmodule" class="refentry">
<div class="refnamediv">
<h1 class="refname">Yaf_Dispatcher::setDefaultModule</h1>
<p class="verinfo">(Yaf >=1.0.0)</p><p class="refpurpose"><span class="refname">Yaf_Dispatcher::setDefaultModule</span> — <span class="dc-title">Change default module name</span></p>
</div>
<div class="refsect1 description" id="refsect1-yaf-dispatcher.setdefaultmodule-description">
<h3 class="title">Description</h3>
<div class="methodsynopsis dc-description">
<span class="modifier">public</span> <span class="type"><a href="class.yaf-dispatcher.html" class="type Yaf_Dispatcher">Yaf_Dispatcher</a></span> <span class="methodname"><strong>Yaf_Dispatcher::setDefaultModule</strong></span>
( <span class="methodparam"><span class="type">string</span> <code class="parameter">$module</code></span>
)</div>
<p class="para rdfs-comment">
</p>
</div>
<div class="refsect1 parameters" id="refsect1-yaf-dispatcher.setdefaultmodule-parameters">
<h3 class="title">Parameters</h3>
<dl>
<dt>
<code class="parameter">module</code></dt>
<dd>
<p class="para">
</p>
</dd>
</dl>
</div>
<div class="refsect1 returnvalues" id="refsect1-yaf-dispatcher.setdefaultmodule-returnvalues">
<h3 class="title">Return Values</h3>
<p class="para">
</p>
</div>
</div><hr /><div class="manualnavbar" style="text-align: center;">
<div class="prev" style="text-align: left; float: left;"><a href="yaf-dispatcher.setdefaultcontroller.html">Yaf_Dispatcher::setDefaultController</a></div>
<div class="next" style="text-align: right; float: right;"><a href="yaf-dispatcher.seterrorhandler.html">Yaf_Dispatcher::setErrorHandler</a></div>
<div class="up"><a href="class.yaf-dispatcher.html">Yaf_Dispatcher</a></div>
<div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
| rafaelgou/the-phpjs-local-docs-collection | php/5.5/yaf-dispatcher.setdefaultmodule.html | HTML | gpl-3.0 | 2,673 |
package com.earth2me.essentials.api;
public class InvalidNameException extends Exception {
/**
* NOTE: This is not implemented yet, just here for future 3.x api support Allow serialization of the InvalidNameException exception
*/
private static final long serialVersionUID = 1485321420293663139L;
public InvalidNameException(Throwable thrwbl) {
super(thrwbl);
}
}
| RubyFreedomDevelopmentTeam/TF-Essentials | Essentials/src/com/earth2me/essentials/api/InvalidNameException.java | Java | gpl-3.0 | 401 |
var tinymce_cnf = {
selector: 'textarea.tinymce',
plugins: 'link table code fullscreen preview textcolor paste image media responsivefilemanager anchor codesample',
toolbar: "responsivefilemanager undo redo | styleselect | bold italic forecolor | alignleft aligncenter alignright alignjustify | bullist numlist indent outdent | link unlink anchor | image media | code | codesample",
min_height: 160,
paste_as_text: true,
relative_urls: false,
valid_elements : '*[*]',
external_filemanager_path: get_public_url()+"filemanager/",
filemanager_title: "Responsive Filemanager",
external_plugins: { "filemanager" : get_public_url()+"filemanager/plugin.min.js"}
};
var tinymce_fetched_cms_pages = false;
function load_editor_js(rerun) {
if (rerun != undefined) {
$('.tinymce').each(function() {
if ($(this).attr('addedmce') == undefined) {
$(this).attr('addedmce', 'true');
tinymce.execCommand('mceRemoveEditor',true,$(this).attr('id'));
tinymce.execCommand('mceAddEditor',true,$(this).attr('id'));
}
});
}
else {
if (!tinymce_fetched_cms_pages) {
$.ajax({
url: route('coaster.admin.pages.tinymce-page-list'),
dataType: 'json',
success: function(r) {
tinymce_cnf['link_list'] = r;
tinymce.init(tinymce_cnf);
},
error: function() {
tinymce.init(tinymce_cnf);
}
});
tinymce_fetched_cms_pages = true;
}
else {
tinymce.init(tinymce_cnf);
}
}
// fileupload
$('.iframe-btn').fancybox({
'type' : 'iframe',
'autoSize' : false,
beforeLoad : function() {
this.width = 900;
this.height = 600;
},
afterClose: function() {
$('.img_src').each(function() {
$('#'+$(this).attr('id').replace('source', 'image')).attr("src", $(this).val());
});
}
});
// date time block
$('.datetimepicker').datetimepicker({dateFormat: dateFormat, timeFormat: timeFormat});
// image blocks
$(".fancybox").fancybox();
$('.img_src').change(function() {
$('#'+$(this).attr('id').replace('source', 'image')).attr("src", $(this).val());
});
// forms blocks
$(".form-template").change(function() {
var captcha_checkbox = $('[name="'+$(this).attr('name').replace('template', 'captcha')+'"]');
if ($(this).find("option:selected").text().indexOf('does not support captcha') != -1) {
captcha_checkbox.parent().parent().hide();
captcha_checkbox.prop('checked', false);
}
else {
captcha_checkbox.parent().parent().show();
}
}).trigger('change');
// repeater blocks
$(".repeater-table tbody").sortable({
handle: 'td:first',
items: 'tr'
});
$(".repeater_button").unbind('click').bind('click', function() {
$(this).parent().parent().parent().parent().attr('class', 'col-sm-10 col-sm-offset-2');
var repeater_id = $(this).attr("data-repeater");
var page_id = $(this).attr("data-page");
var block_id = $(this).attr("data-block");
$.ajax({
url: route('coaster.admin.repeaters'),
type: 'POST',
data: {repeater_id: repeater_id, block_id: block_id, page_id: page_id},
success: function(r) {
$("#repeater_"+repeater_id).parent().removeClass("hide");
$("#repeater_"+repeater_id+" > tbody").append(r);
load_editor_js(1);
}
});
});
// multi-select / video select
$(".chosen-select").select2();
$(".chosen-select-class").select2({
escapeMarkup: function (m) {
return m;
},
templateResult: function (data) {
return '<span class="'+data.text+'"></span> '+" "+data.text;
},
templateSelection: function (data) {
return '<span class="'+data.text+'"></span> '+" "+data.text;
}
});
var videoTokens = {};
$(".video-search").select2({
placeholder: 'Insert youtube link link or search for video ...',
minimumInputLength: 3,
ajax: {
url: 'https://www.googleapis.com/youtube/v3/search',
dataType: 'json',
quietMillis: 100,
data: function (params) { // page is the one-based page number tracked by Select2
if (videoTokens[params.term] == undefined) {
videoTokens[params.term] = '';
}
return {
q: params.term, //search term
part: 'id,snippet',
maxResults: 10,
type: 'video',
pageToken: videoTokens[params.term]['next'],
key: ytBrowserKey
};
},
processResults: function (data, params) {
params.page = params.page || 1;
$.each(data.items, function (k, v) {
v.id = v.id.videoId;
data.items[k] = v;
});
videoTokens[params.term] = {'next': data.nextPageToken};
return {
results: data.items,
pagination: {
more: (params.page * data.pageInfo.resultsPerPage) < data.pageInfo.totalResults
}
};
},
error: function () {
throw new Error("Invalid API key");
}
},
templateResult: function (video) {
if (!video.id || !video.snippet) return video.text;
var t = new Date(video.snippet.publishedAt);
return '<b>' + video.snippet.title + '</b> (' + video.snippet.channelTitle + ' ' + t.getDate() + '/' + (t.getMonth() + 1) + '/' + t.getFullYear() + ')<br /><i>https://www.youtube.com/watch?v=' + video.id + '</i>';
},
templateSelection: function (video) {
if (!video.id || !video.snippet) return video.text;
var t = new Date(video.snippet.publishedAt);
return '<b>' + video.snippet.title + '</b> (' + video.snippet.channelTitle + ' ' + t.getDate() + '/' + (t.getMonth() + 1) + '/' + t.getFullYear() + ')';
},
escapeMarkup: function (m) {
return m;
} // we do not want to escape markup since we are displaying html in results
}).on("change", function () {
$('#' + this.id + '_preview').attr('src', 'http://www.youtube.com/embed/' + $(this).val()).css('display', 'block');
});
// select colour options
var select_colour_els = $('.select_colour');
select_colour_els.find('option').each(function () {
if ($(this).val() != 'none') $(this).css('background-color', $(this).val());
});
select_colour_els.change(function () {
if ($(this).val() != 'none') $(this).css('background-color', $(this).val());
}).trigger('change');
// page select block
$('.custom-link').change(function () {
$('[name="'+$(this).attr('name').replace('custom', 'internal')+'"]').val(0);
});
$('.internal-link').change(function () {
if ($(this).val() > 0) {
$('[name="'+$(this).attr('name').replace('internal', 'custom')+'"]').val('');
}
});
}
function repeater_delete(repeater_id, row_id) {
$("#"+repeater_id+"_"+row_id).remove();
} | gayathma/footballs | vendor/web-feet/coasterframework/public/app/js/editor.js | JavaScript | gpl-3.0 | 7,677 |
package org.gmod.schema.mapped;
// Generated Aug 31, 2006 4:02:18 PM by Hibernate Tools 3.2.0.beta7
import org.gmod.schema.utils.propinterface.PropertyI;
import static javax.persistence.GenerationType.SEQUENCE; //Added explicit sequence generation behaviour 2.12.2015
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.persistence.SequenceGenerator;
import javax.persistence.GeneratedValue;
/**
* PhylonodeProp generated by hbm2java
*/
@Entity
@Table(name = "phylonodeprop", uniqueConstraints = { @UniqueConstraint(columnNames = {
"phylonode_id", "type_id", "value", "rank" }) })
public class PhylonodeProp implements java.io.Serializable, PropertyI {
// Fields
@SequenceGenerator(name = "generator", sequenceName = "phylonodeprop_phylonodeprop_id_seq", allocationSize=1)
@Id @GeneratedValue(strategy = SEQUENCE, generator = "generator")
@Column(name = "phylonodeprop_id", unique = true, nullable = false, insertable = true, updatable = true)
private int phylonodePropId;
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "type_id", unique = false, nullable = false, insertable = true, updatable = true)
private CvTerm cvTerm;
@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
@JoinColumn(name = "phylonode_id", unique = false, nullable = false, insertable = true, updatable = true)
private Phylonode phylonode;
@Column(name="value", unique=false, nullable=false, insertable=true, updatable=true)
private String value;
@Column(name = "rank", unique = false, nullable = false, insertable = true, updatable = true)
private int rank;
// Constructors
PhylonodeProp() {
// Deliberately empty default constructor
}
/** full constructor */
public PhylonodeProp(Phylonode phylonode, CvTerm type, String value, int rank) {
this.cvTerm = type;
this.phylonode = phylonode;
this.value = value;
this.rank = rank;
}
// Property accessors
public int getPhylonodePropId() {
return this.phylonodePropId;
}
public CvTerm getType() {
return this.cvTerm;
}
void setType(CvTerm cvTerm) {
this.cvTerm = cvTerm;
}
public Phylonode getPhylonode() {
return this.phylonode;
}
void setPhylonode(Phylonode phylonode) {
this.phylonode = phylonode;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
public int getRank() {
return this.rank;
}
}
| sanger-pathogens/GeneDB | ng/src/org/gmod/schema/mapped/PhylonodeProp.java | Java | gpl-3.0 | 2,816 |
#region License
// ====================================================
// Project Porcupine Copyright(C) 2016 Team Porcupine
// This program comes with ABSOLUTELY NO WARRANTY; This is free software,
// and you are welcome to redistribute it under certain conditions; See
// file LICENSE, which is part of this source code package, for details.
// ====================================================
#endregion
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UnityEngine;
/// <summary>
/// Sprite Manager isn't responsible for actually creating GameObjects.
/// That is going to be the job of the individual ________SpriteController scripts.
/// Our job is simply to load all sprites from disk and keep the organized.
/// </summary>
public static class SpriteManager
{
private static Texture2D noResourceTexture;
private static Dictionary<string, Dictionary<string, Sprite>> sprites;
private static bool isInitialized;
/// <summary>
/// Initializes a new instance of the <see cref="SpriteManager"/> class.
/// </summary>
public static void Initialize()
{
if (isInitialized)
{
return;
}
sprites = new Dictionary<string, Dictionary<string, Sprite>>();
CreateEmptyTexture();
isInitialized = true;
}
/// <summary>
/// Creates a sprite with an error texture.
/// </summary>
/// <returns>The error sprite.</returns>
public static Sprite CreateErrorSprite()
{
return Sprite.Create(noResourceTexture, new Rect(Vector2.zero, new Vector3(32, 32)), new Vector2(0.5f, 0.5f), 32);
}
/// <summary>
/// Gets the sprite for the given category and name.
/// </summary>
/// <returns>The sprite.</returns>
/// <param name="categoryName">Category name.</param>
/// <param name="spriteName">Sprite name.</param>
public static Sprite GetSprite(string categoryName, string spriteName)
{
Dictionary<string, Sprite> categorySprites;
Sprite sprite;
if (sprites.TryGetValue(categoryName, out categorySprites))
{
if (categorySprites.TryGetValue(spriteName, out sprite))
{
return sprite;
}
}
// Return a pink square as a error indication
UnityDebugger.Debugger.LogWarningFormat("SpriteManager", "No sprite: {0}, using fallback sprite.", spriteName);
return CreateErrorSprite();
}
/// <summary>
/// Gets a random sprite from a category.
/// </summary>
/// <returns>The sprite.</returns>
/// <param name="categoryName">Category name.</param>
public static Sprite GetRandomSprite(string categoryName)
{
Dictionary<string, Sprite> spritesFromCategory;
Sprite sprite = null;
if (sprites.TryGetValue(categoryName, out spritesFromCategory))
{
if (spritesFromCategory.Count > 0)
{
System.Random rand = new System.Random();
sprite = spritesFromCategory.ElementAt(rand.Next(0, spritesFromCategory.Count)).Value;
}
}
return sprite;
}
/// <summary>
/// Determines if there is a sprite with the specified category and name.
/// </summary>
/// <returns><c>true</c> if there is a sprite with the specified category and name; otherwise, <c>false</c>.</returns>
/// <param name="categoryName">Category name.</param>
/// <param name="spriteName">Sprite name.</param>
public static bool HasSprite(string categoryName, string spriteName)
{
// NOTE! This method is a bad idea. Every time we want to know
// if a sprite exists we always want the sprite too
// So it's wastefull to check before
Dictionary<string, Sprite> categorySprites;
if (sprites.TryGetValue(categoryName, out categorySprites))
{
return categorySprites.ContainsKey(spriteName);
}
else
{
return false;
}
}
/// <summary>
/// Loads the sprites from the given directory path.
/// </summary>
/// <param name="directoryPath">Directory path.</param>
public static void LoadSpriteFiles(string directoryPath)
{
// First, we're going to see if we have any more sub-directories,
// if so -- call LoadSpritesFromDirectory on that.
string[] subDirectories = Directory.GetDirectories(directoryPath);
foreach (string subDirectory in subDirectories)
{
LoadSpriteFiles(subDirectory);
}
string[] filesInDir = Directory.GetFiles(directoryPath);
foreach (string fileName in filesInDir)
{
// Is this an image file?
// Unity's LoadImage seems to support only png and jpg
// NOTE: We **could** try to check file extensions, but why not just
// have Unity **attempt** to load the image, and if it doesn't work,
// then I guess it wasn't an image! An advantage of this, is that we
// don't have to worry about oddball filenames, nor do we have to worry
// about what happens if Unity adds support for more image format
// or drops support for existing ones.
string spriteCategory = new DirectoryInfo(directoryPath).Name;
LoadImage(spriteCategory, fileName);
}
}
/// <summary>
/// Loads a single image from the given filePath, if possible.
/// </summary>
/// <param name="spriteCategory">Sprite category.</param>
/// <param name="filePath">File path.</param>
private static void LoadImage(string spriteCategory, string filePath)
{
// TODO: LoadImage is returning TRUE for things like .meta and .json files. What??!
// So as a temporary fix, let's just bail if we have something we KNOW should not
// be an image.
if (filePath.Contains(".json") || filePath.Contains(".meta") || filePath.Contains(".db"))
{
return;
}
// Load the file into a texture
byte[] imageBytes = File.ReadAllBytes(filePath);
// Create some kind of dummy instance of Texture2D
Texture2D imageTexture = new Texture2D(2, 2, TextureFormat.ARGB32, false);
// LoadImage will correctly resize the texture based on the image file
if (imageTexture.LoadImage(imageBytes))
{
// Image was successfully loaded.
imageTexture.filterMode = FilterMode.Point;
// So let's see if there's a matching JSON file for this image.
string baseSpriteName = Path.GetFileNameWithoutExtension(filePath);
string basePath = Path.GetDirectoryName(filePath);
// NOTE: The extension must be in lower case!
string jsonPath = Path.Combine(basePath, baseSpriteName + ".json");
if (File.Exists(jsonPath))
{
StreamReader reader = File.OpenText(jsonPath);
JToken protoJson = JToken.ReadFrom(new JsonTextReader(reader));
reader.Close();
JArray array = (JArray)protoJson;
// Loop through the json file for each object
// and calling LoadSprite once for each of them.
foreach (JObject obj in array)
{
try
{
ReadSpriteFromJson(spriteCategory, obj, imageTexture);
}
catch (Exception e)
{
UnityDebugger.Debugger.LogWarning("SpriteManager", obj);
throw new Exception("Error in file " + jsonPath, e);
}
}
}
else
{
// File couldn't be read, probably because it doesn't exist
// so we'll just assume the whole image is one sprite with pixelPerUnit = 64
LoadSprite(spriteCategory, baseSpriteName, imageTexture, new Rect(0, 0, imageTexture.width, imageTexture.height), 64, new Vector2(0.5f, 0.5f));
}
// Attempt to load/parse the data file to get information on the sprite(s)
}
// Else, the file wasn't actually a image file, so just move on.
}
/// <summary>
/// Reads the sprite from data file for the image.
/// </summary>
/// <param name="spriteCategory">Sprite category.</param>
/// <param name="obj">The Json Object Reader.</param>
/// <param name="imageTexture">Image texture.</param>
private static void ReadSpriteFromJson(string spriteCategory, JObject obj, Texture2D imageTexture)
{
string name = PrototypeReader.ReadJson(string.Empty, obj["name"]);
int x = PrototypeReader.ReadJson(0, obj["x"]);
int y = PrototypeReader.ReadJson(0, obj["y"]);
int w = PrototypeReader.ReadJson(1, obj["w"]);
int h = PrototypeReader.ReadJson(1, obj["h"]);
float pivotX = PrototypeReader.ReadJson(0.5f, obj["pivotX"]);
float pivotY = PrototypeReader.ReadJson(0.5f, obj["pivotY"]);
if (pivotX < 0 || pivotX > 1 || pivotY < 0 || pivotY > 1)
{
UnityDebugger.Debugger.LogWarning("SpriteManager", "Pivot for object " + name + " has pivots of " + pivotX + "," + pivotY);
}
int pixelPerUnit = int.Parse(obj["pixelPerUnit"].ToString());
LoadSprite(spriteCategory, name, imageTexture, new Rect(x * pixelPerUnit, y * pixelPerUnit, w * pixelPerUnit, h * pixelPerUnit), pixelPerUnit, new Vector2(pivotX, pivotY));
}
/// <summary>
/// Creates and stores the sprite.
/// </summary>
/// <param name="spriteCategory">Sprite category.</param>
/// <param name="spriteName">Sprite name.</param>
/// <param name="imageTexture">Image texture.</param>
/// <param name="spriteCoordinates">Sprite coordinates.</param>
/// <param name="pixelsPerUnit">Pixels per unit.</param>
/// <param name="pivotPoint">Pivot point.</param>
private static void LoadSprite(string spriteCategory, string spriteName, Texture2D imageTexture, Rect spriteCoordinates, int pixelsPerUnit, Vector2 pivotPoint)
{
Sprite s = Sprite.Create(imageTexture, spriteCoordinates, pivotPoint, pixelsPerUnit);
Dictionary<string, Sprite> categorySprites;
if (sprites.TryGetValue(spriteCategory, out categorySprites) == false)
{
// If this category didn't exist until now, we create it
categorySprites = new Dictionary<string, Sprite>();
sprites[spriteCategory] = categorySprites;
}
// Add the sprite to the category
categorySprites[spriteName] = s;
}
/// <summary>
/// Creates the no resource texture.
/// </summary>
private static void CreateEmptyTexture()
{
// Generate a 32x32 magenta image
noResourceTexture = new Texture2D(32, 32, TextureFormat.ARGB32, false);
Color32[] pixels = noResourceTexture.GetPixels32();
for (int i = 0; i < pixels.Length; i++)
{
pixels[i] = new Color32(255, 0, 255, 255);
}
noResourceTexture.SetPixels32(pixels);
noResourceTexture.Apply();
}
}
| NogginBops/ProjectPorcupine | Assets/Scripts/Models/InputOutput/SpriteManager.cs | C# | gpl-3.0 | 11,384 |
#!/usr/bin/python
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# vim:ft=python
| dozzie/yumbootstrap | lib/yumbootstrap/__init__.py | Python | gpl-3.0 | 194 |
<?php
/**
* Class with the properties needs to generate a class file.
*
* @author Jeremie Litzler
* @copyright Copyright (c) 2015
* @licence http://opensource.org/licenses/gpl-license.php GNU Public License
* @link https://github.com/WebDevJL/EasyMvc
* @since Version 1.0.0
* @package BaseClassGenerator
* @see http://php.net/manual/en/language.types.intro.php
*/
namespace ScalarType;
use Library\Interfaces;
if (!defined('__EXECUTION_ACCESS_RESTRICTION__'))
exit('No direct script access allowed');
class ObjectBase implements Interfaces\IObject, Interfaces\IString {
protected $value;
/**
*
* @return string The type of the instance.
* @see http://php.net/manual/en/function.gettype.php
*/
public function GetType() {
return gettype($this);
}
/**
*
* @return string The class name of the instance
* @see http://php.net/manual/en/function.get-class.php (go to Example #2)
*/
public function GetClass() {
return get_class();
}
/**
*
* @return string The string cast of $value field of the instance.
*/
public function ToString() {
return (string) $this->value;
}
}
| WebDevJL/EasyMVC | ScarlarType/ObjectBase.php | PHP | gpl-3.0 | 1,153 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
PyChess arena tournament script.
This script executes a tournament between the engines installed on your
system. The script is executed from a terminal with the usual environment.
'''
import os
import sys
###############################################################################
# Set up important things
from gi.repository import GLib
from gi.repository import GObject
GObject.threads_init()
mainloop = GLib.MainLoop()
from pychess.Utils.const import *
###############################################################################
# Fix environment
if "PYTHONPATH" in os.environ:
os.environ["PYTHONPATH"] = os.pathsep.join(
os.path.abspath(p) for p in os.environ["PYTHONPATH"].split(os.pathsep))
###############################################################################
from pychess.System import Log
Log.DEBUG = False
###############################################################################
# Do the rest of the imports
from pychess.Players.engineNest import discoverer
from pychess.Savers.pgn import save
from pychess.Utils.GameModel import GameModel
from pychess.Utils.TimeModel import TimeModel
from pychess.Variants import variants
###############################################################################
# Look up engines
def prepare():
print("Discovering engines", end=' ')
discoverer.connect('discovering_started', cb_started)
discoverer.connect('engine_discovered', cb_gotone)
discoverer.connect('all_engines_discovered', start)
discoverer.discover()
def cb_started(discoverer, binnames):
print("Wait a moment while we discover %d engines" % len(binnames))
def cb_gotone (discoverer, binname, engine):
sys.stdout.write(".")
###############################################################################
# Ask the user for details
engines = []
results = []
minutes = 0
current = [0,0]
def start(discoverer):
global engines, results, minutes
engines = discoverer.getEngines()
n = len(engines)
for i in range(n):
results.append([None]*n)
print()
print("Your installed engines are:")
for i, engine in enumerate(engines):
name = discoverer.getName(engine)
print("[%s] %s" % (name[:3], name))
print("The total amount of fights will be %d" % (n*(n-1)))
print()
minutes = int(input("Please enter the clock minutes for each game [n]: "))
print("The games will last up to %d minutes." % (2*n*(n-1)*minutes))
print("You will be informed of the progress as the games finish.")
print()
runGame()
###############################################################################
# Run games
def runGame():
a, b = findMatch()
if a == None:
print("All games have now been played. Here are the final scores:")
printResults()
mainloop.quit()
return
current[0] = a
current[1] = b
game = GameModel(TimeModel(minutes*60,0))
game.connect('game_started', cb_gamestarted)
game.connect('game_ended', cb_gameended)
p0 = discoverer.initPlayerEngine(engines[a], WHITE, 8, variants[NORMALCHESS], secs=minutes*60, incr=0, forcePonderOff=True)
p1 = discoverer.initPlayerEngine(engines[b], BLACK, 8, variants[NORMALCHESS], secs=minutes*60, incr=0, forcePonderOff=True)
game.setPlayers([p0,p1])
game.start()
def cb_gamestarted(game):
print("Starting the game between %s and %s" % tuple(game.players))
def cb_gameended(game, reason):
print("The game between %s and %s ended %s" % (tuple(game.players)+(reprResult[game.status],)))
if game.status not in (DRAW, WHITEWON, BLACKWON):
print("Something must have gone wrong. But we'll just try to continue!")
else:
i, j = current
results[i][j] = game.status
print("The current scores are:")
printScoreboard()
print()
with open("arena.pgn", "a+") as fh:
save(fh, game)
runGame()
###############################################################################
# A few helpers
def printScoreboard():
names = [discoverer.getName(e)[:3] for e in engines]
print(r"W\B", " ".join(names))
for i, nameA in enumerate(names):
print(nameA, end=' ')
for j, nameB in enumerate(names):
if i == j: print(" # ", end=' ')
elif results[i][j] == DRAW: print("½-½", end=' ')
elif results[i][j] == WHITEWON: print("1-0", end=' ')
elif results[i][j] == BLACKWON: print("0-1", end=' ')
else: print(" . ", end=' ')
print()
def printResults():
scores = []
for i in range(len(engines)):
points = sum(2 for j in range(len(engines)) if results[i][j] == WHITEWON) \
+ sum(1 for j in range(len(engines)) if results[i][j] == DRAW) \
+ sum(2 for j in range(len(engines)) if results[j][i] == BLACKWON) \
+ sum(1 for j in range(len(engines)) if results[j][i] == DRAW)
scores.append((points, i))
scores.sort(reverse=True)
for points, i in scores:
print(discoverer.getName(engines[i]), ":", points/2, "½"*(points%2))
#def findMatch():
# for i, engineA in enumerate(engines):
# for j, engineB in enumerate(engines):
# if i != j and results[i][j] == None:
# return i, j
# return None, None
import random
def findMatch():
pos = [(i,j) for i in range(len(engines))
for j in range(len(engines))
if i != j and results[i][j] == None]
#pos = [(i,j) for i,j in pos if
# "pychess" in discoverer.getName(engines[i]).lower() or
# "pychess" in discoverer.getName(engines[j]).lower()]
if not pos:
return None, None
return random.choice(pos)
###############################################################################
# Push onto the mainloop and start it
#glib.idle_add(prepare)
prepare()
def do(discoverer):
game = GameModel(TimeModel(60,0))
#game.connect('game_started', cb_gamestarted2)
game.connect('game_ended', lambda *a: mainloop.quit())
p0 = discoverer.initPlayerEngine(discoverer.getEngines()['rybka'], WHITE, 7, variants[NORMALCHESS], 60)
p1 = discoverer.initPlayerEngine(discoverer.getEngines()['gnuchess'], BLACK, 7, variants[NORMALCHESS], 60)
game.setPlayers([p0,p1])
game.start()
#discoverer.connect('all_engines_discovered', do)
#discoverer.start()
mainloop.run()
| pychess/pychess | utilities/arena.py | Python | gpl-3.0 | 6,460 |
function run()
r = provider.formfunction("employee_assignment_convert")( input:get())
for v,t in r:get() do
output:print( v,t)
end
end
| ProjectTegano/Tegano | tests/wolfilter/scripts/formfunc_iterator.lua | Lua | gpl-3.0 | 141 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.