code
stringlengths 3
1.05M
| repo_name
stringlengths 4
116
| path
stringlengths 3
942
| language
stringclasses 30
values | license
stringclasses 15
values | size
int32 3
1.05M
|
---|---|---|---|---|---|
/*
* HA-JDBC: High-Availability JDBC
* Copyright (C) 2013 Paul Ferraro
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package net.sf.hajdbc.sql.io;
import java.io.OutputStream;
import java.sql.SQLException;
import java.util.Map;
import net.sf.hajdbc.Database;
import net.sf.hajdbc.invocation.Invoker;
import net.sf.hajdbc.sql.ProxyFactory;
/**
* @author Paul Ferraro
*/
public class OutputStreamProxyFactory<Z, D extends Database<Z>, P> extends OutputProxyFactory<Z, D, P, OutputStream>
{
public OutputStreamProxyFactory(P parentProxy, ProxyFactory<Z, D, P, SQLException> parent, Invoker<Z, D, P, OutputStream, SQLException> invoker, Map<D, OutputStream> outputs)
{
super(parentProxy, parent, invoker, outputs);
}
@Override
public OutputStream createProxy()
{
return new OutputStreamProxy<>(this);
}
}
| ha-jdbc/ha-jdbc | core/src/main/java/net/sf/hajdbc/sql/io/OutputStreamProxyFactory.java | Java | lgpl-3.0 | 1,449 |
/**
* Copyright © 2002 Instituto Superior Técnico
*
* This file is part of FenixEdu Academic.
*
* FenixEdu Academic is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FenixEdu Academic 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 FenixEdu Academic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.fenixedu.academic.domain.accounting;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Stream;
import org.apache.commons.lang.StringUtils;
import org.fenixedu.academic.domain.Person;
import org.fenixedu.academic.domain.exceptions.DomainException;
import org.fenixedu.academic.domain.exceptions.DomainExceptionWithLabelFormatter;
import org.fenixedu.academic.domain.organizationalStructure.Party;
import org.fenixedu.academic.util.LabelFormatter;
import org.fenixedu.academic.util.Money;
import org.fenixedu.bennu.core.domain.Bennu;
import org.fenixedu.bennu.core.domain.User;
import org.fenixedu.bennu.core.security.Authenticate;
import org.fenixedu.bennu.core.signals.DomainObjectEvent;
import org.fenixedu.bennu.core.signals.Signal;
import org.joda.time.DateTime;
import org.joda.time.LocalDate;
import org.joda.time.YearMonthDay;
/**
* Two-ledged accounting transaction
*
* @author naat
*
*/
public class AccountingTransaction extends AccountingTransaction_Base {
public static final String SIGNAL_ANNUL = AccountingTransaction.class.getName() + ".annul";
public static Comparator<AccountingTransaction> COMPARATOR_BY_WHEN_REGISTERED =
(leftAccountingTransaction, rightAccountingTransaction) -> {
int comparationResult =
leftAccountingTransaction.getWhenRegistered().compareTo(rightAccountingTransaction.getWhenRegistered());
return (comparationResult == 0) ? leftAccountingTransaction.getExternalId().compareTo(
rightAccountingTransaction.getExternalId()) : comparationResult;
};
protected AccountingTransaction() {
super();
super.setRootDomainObject(Bennu.getInstance());
}
public AccountingTransaction(User responsibleUser, Event event, Entry debit, Entry credit,
AccountingTransactionDetail transactionDetail) {
this();
init(responsibleUser, event, debit, credit, transactionDetail);
}
private AccountingTransaction(User responsibleUser, Entry debit, Entry credit, AccountingTransactionDetail transactionDetail,
AccountingTransaction transactionToAdjust) {
this();
init(responsibleUser, transactionToAdjust.getEvent(), debit, credit, transactionDetail, transactionToAdjust);
}
protected void init(User responsibleUser, Event event, Entry debit, Entry credit,
AccountingTransactionDetail transactionDetail) {
init(responsibleUser, event, debit, credit, transactionDetail, null);
}
protected void init(User responsibleUser, Event event, Entry debit, Entry credit,
AccountingTransactionDetail transactionDetail, AccountingTransaction transactionToAdjust) {
checkParameters(event, debit, credit);
// check for operations after registered date
List<String> operationsAfter = event.getOperationsAfter(transactionDetail.getWhenProcessed());
if (!operationsAfter.isEmpty()) {
throw new DomainException("error.accounting.AccountingTransaction.cannot.create.transaction",
String.join(",", operationsAfter));
}
super.setEvent(event);
super.setResponsibleUser(responsibleUser);
super.addEntries(debit);
super.addEntries(credit);
super.setAdjustedTransaction(transactionToAdjust);
super.setTransactionDetail(transactionDetail);
}
private void checkParameters(Event event, Entry debit, Entry credit) {
if (event == null) {
throw new DomainException("error.accounting.accountingTransaction.event.cannot.be.null");
}
if (debit == null) {
throw new DomainException("error.accounting.accountingTransaction.debit.cannot.be.null");
}
if (credit == null) {
throw new DomainException("error.accounting.accountingTransaction.credit.cannot.be.null");
}
}
@Override
public void addEntries(Entry entries) {
throw new DomainException("error.accounting.accountingTransaction.cannot.add.entries");
}
@Override
public Set<Entry> getEntriesSet() {
return Collections.unmodifiableSet(super.getEntriesSet());
}
@Override
public void removeEntries(Entry entries) {
throw new DomainException("error.accounting.accountingTransaction.cannot.remove.entries");
}
@Override
public void setEvent(Event event) {
super.setEvent(event);
}
@Override
public void setResponsibleUser(User responsibleUser) {
throw new DomainException("error.accounting.accountingTransaction.cannot.modify.responsibleUser");
}
@Override
public void setAdjustedTransaction(AccountingTransaction adjustedTransaction) {
throw new DomainException("error.accounting.accountingTransaction.cannot.modify.adjustedTransaction");
}
@Override
public void setTransactionDetail(AccountingTransactionDetail transactionDetail) {
throw new DomainException("error.accounting.AccountingTransaction.cannot.modify.transactionDetail");
}
@Override
public void addAdjustmentTransactions(AccountingTransaction accountingTransaction) {
throw new DomainException(
"error.org.fenixedu.academic.domain.accounting.AccountingTransaction.cannot.add.accountingTransaction");
}
@Override
public Set<AccountingTransaction> getAdjustmentTransactionsSet() {
return Collections.unmodifiableSet(super.getAdjustmentTransactionsSet());
}
public Stream<AccountingTransaction> getAdjustmentTransactionStream() {
return super.getAdjustmentTransactionsSet().stream();
}
@Override
public void removeAdjustmentTransactions(AccountingTransaction adjustmentTransactions) {
throw new DomainException(
"error.org.fenixedu.academic.domain.accounting.AccountingTransaction.cannot.remove.accountingTransaction");
}
public LabelFormatter getDescriptionForEntryType(EntryType entryType) {
return getEvent().getDescriptionForEntryType(entryType);
}
public Account getFromAccount() {
return getEntry(false).getAccount();
}
public Account getToAccount() {
return getEntry(true).getAccount();
}
public Entry getToAccountEntry() {
return getEntry(true);
}
public Entry getFromAccountEntry() {
return getEntry(false);
}
private Entry getEntry(boolean positive) {
for (final Entry entry : super.getEntriesSet()) {
if (entry.isPositiveAmount() == positive) {
return entry;
}
}
throw new DomainException("error.accounting.accountingTransaction.transaction.data.is.corrupted");
}
public AccountingTransaction reimburse(User responsibleUser, PaymentMethod paymentMethod,String
paymentReference, Money amountToReimburse) {
return reimburse(responsibleUser, paymentMethod,paymentReference, amountToReimburse, null);
}
public AccountingTransaction reimburse(User responsibleUser, PaymentMethod paymentMethod, String
paymentReference, Money amountToReimburse, String comments) {
return reimburse(responsibleUser, paymentMethod, paymentReference, amountToReimburse, comments, true);
}
public AccountingTransaction reimburse(User responsibleUser, PaymentMethod paymentMethod, String
paymentReference, Money amountToReimburse,
DateTime reimburseDate, String comments) {
return reimburse(responsibleUser, paymentMethod, paymentReference, amountToReimburse, comments, true, reimburseDate);
}
public AccountingTransaction reimburseWithoutRules(User responsibleUser, PaymentMethod paymentMethod, String
paymentReference, Money amountToReimburse) {
return reimburseWithoutRules(responsibleUser, paymentMethod, paymentReference, amountToReimburse, null);
}
public AccountingTransaction reimburseWithoutRules(User responsibleUser, PaymentMethod paymentMethod, String
paymentReference, Money amountToReimburse,
String comments) {
return reimburse(responsibleUser, paymentMethod, paymentReference, amountToReimburse, comments, false);
}
public void annul(final User responsibleUser, final String reason) {
if (StringUtils.isEmpty(reason)) {
throw new DomainException(
"error.org.fenixedu.academic.domain.accounting.AccountingTransaction.cannot.annul.without.reason");
}
checkRulesToAnnul();
annulReceipts();
Signal.emit(SIGNAL_ANNUL, new DomainObjectEvent<AccountingTransaction>(this));
reimburseWithoutRules(responsibleUser, getTransactionDetail().getPaymentMethod(), getTransactionDetail()
.getPaymentReference(), getAmountWithAdjustment(), reason);
}
private void checkRulesToAnnul() {
final List<String> operationsAfter = getEvent().getOperationsAfter(getWhenProcessed());
if (!operationsAfter.isEmpty()) {
throw new DomainException("error.accounting.AccountingTransaction.cannot.annul.operations.after",
String.join(",", operationsAfter));
}
}
private void annulReceipts() {
getToAccountEntry().getReceiptsSet().stream().filter(Receipt::isActive).forEach(r -> {
Person responsible = Optional.ofNullable(Authenticate.getUser()).map(User::getPerson).orElse(null);
r.annul(responsible);
});
}
private AccountingTransaction reimburse(User responsibleUser, PaymentMethod paymentMethod, String paymentReference, Money
amountToReimburse,
String comments, boolean checkRules) {
return reimburse(responsibleUser, paymentMethod, paymentReference, amountToReimburse, comments, checkRules, new DateTime
());
}
private AccountingTransaction reimburse(User responsibleUser, PaymentMethod paymentMethod, String paymentReference, Money
amountToReimburse,
String comments, boolean checkRules, DateTime reimburseDate) {
if (checkRules && !canApplyReimbursement(amountToReimburse)) {
throw new DomainException("error.accounting.AccountingTransaction.cannot.reimburse.events.that.may.open");
}
if (!getToAccountEntry().canApplyReimbursement(amountToReimburse)) {
throw new DomainExceptionWithLabelFormatter(
"error.accounting.AccountingTransaction.amount.to.reimburse.exceeds.entry.amount", getToAccountEntry()
.getDescription());
}
final AccountingTransaction transaction =
new AccountingTransaction(responsibleUser, new Entry(EntryType.ADJUSTMENT, amountToReimburse.negate(),
getToAccount()), new Entry(EntryType.ADJUSTMENT, amountToReimburse, getFromAccount()),
new AccountingTransactionDetail(reimburseDate, paymentMethod, paymentReference, comments), this);
getEvent().recalculateState(new DateTime());
return transaction;
}
public DateTime getWhenRegistered() {
return getTransactionDetail().getWhenRegistered();
}
public DateTime getWhenProcessed() {
return getTransactionDetail().getWhenProcessed();
}
public String getComments() {
return getTransactionDetail().getComments();
}
public boolean isPayed(final int civilYear) {
return getWhenRegistered().getYear() == civilYear;
}
public boolean isAdjustingTransaction() {
return getAdjustedTransaction() != null;
}
public boolean hasBeenAdjusted() {
return !super.getAdjustmentTransactionsSet().isEmpty();
}
public Entry getEntryFor(final Account account) {
for (final Entry accountingEntry : super.getEntriesSet()) {
if (accountingEntry.getAccount() == account) {
return accountingEntry;
}
}
throw new DomainException(
"error.accounting.accountingTransaction.transaction.data.is.corrupted.because.no.entry.belongs.to.account");
}
private boolean canApplyReimbursement(final Money amount) {
return getEvent().canApplyReimbursement(amount);
}
public boolean isSourceAccountFromParty(Party party) {
return getFromAccount().getParty() == party;
}
@Override
protected void checkForDeletionBlockers(Collection<String> blockers) {
super.checkForDeletionBlockers(blockers);
blockers.addAll(getEvent().getOperationsAfter(getWhenProcessed()));
}
public void delete() {
DomainException.throwWhenDeleteBlocked(getDeletionBlockers());
super.setAdjustedTransaction(null);
for (; !getAdjustmentTransactionsSet().isEmpty(); getAdjustmentTransactionsSet().iterator().next().delete()) {
;
}
if (getTransactionDetail() != null) {
getTransactionDetail().delete();
}
for (; !getEntriesSet().isEmpty(); getEntriesSet().iterator().next().delete()) {
;
}
super.setResponsibleUser(null);
super.setEvent(null);
setRootDomainObject(null);
super.deleteDomainObject();
}
public Money getAmountWithAdjustment() {
return getToAccountEntry().getAmountWithAdjustment();
}
public boolean isInsidePeriod(final YearMonthDay startDate, final YearMonthDay endDate) {
return isInsidePeriod(startDate.toLocalDate(), endDate.toLocalDate());
}
public boolean isInsidePeriod(final LocalDate startDate, final LocalDate endDate) {
return !getWhenRegistered().toLocalDate().isBefore(startDate) && !getWhenRegistered().toLocalDate().isAfter(endDate);
}
public boolean isInstallment() {
return false;
}
public PaymentMethod getPaymentMethod() {
return getTransactionDetail().getPaymentMethod();
}
public Money getOriginalAmount() {
return getToAccountEntry().getOriginalAmount();
}
}
| sergiofbsilva/fenixedu-academic | src/main/java/org/fenixedu/academic/domain/accounting/AccountingTransaction.java | Java | lgpl-3.0 | 15,077 |
package net.amygdalum.testrecorder.profile;
import static org.assertj.core.api.Assertions.assertThat;
import java.io.ByteArrayOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
import java.util.Enumeration;
import java.util.stream.Stream;
import org.junit.jupiter.api.Nested;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import net.amygdalum.testrecorder.util.ExtensibleClassLoader;
import net.amygdalum.testrecorder.util.LogLevel;
import net.amygdalum.testrecorder.util.LoggerExtension;
public class ClassPathConfigurationLoaderTest {
@Nested
class testLoad {
@Test
void common() throws Exception {
ExtensibleClassLoader classLoader = new ExtensibleClassLoader(ClassPathConfigurationLoaderTest.class.getClassLoader());
classLoader.defineResource("agentconfig/net.amygdalum.testrecorder.profile.ConfigNoArgumentsNonExclusive", "net.amygdalum.testrecorder.profile.DefaultConfigNoArguments".getBytes());
ClassPathConfigurationLoader loader = new ClassPathConfigurationLoader(classLoader);
assertThat(loader.load(ConfigNoArgumentsNonExclusive.class).findFirst()).containsInstanceOf(DefaultConfigNoArguments.class);
}
@ExtendWith(LoggerExtension.class)
@Test
void withClassLoaderError(@LogLevel("error") ByteArrayOutputStream error) throws Exception {
ExtensibleClassLoader classLoader = new ExtensibleClassLoader(ClassPathConfigurationLoaderTest.class.getClassLoader()) {
@Override
public Enumeration<URL> getResources(String name) throws IOException {
throw new IOException();
}
};
classLoader.defineResource("agentconfig/net.amygdalum.testrecorder.profile.ConfigNoArgumentsNonExclusive", "net.amygdalum.testrecorder.profile.DefaultConfigNoArguments".getBytes());
ClassPathConfigurationLoader loader = new ClassPathConfigurationLoader(classLoader);
assertThat(loader.load(ConfigNoArgumentsNonExclusive.class).findFirst()).isNotPresent();
assertThat(error.toString()).contains("cannot load configuration from classpath");
}
@ExtendWith(LoggerExtension.class)
@Test
void withFileNotFound(@LogLevel("debug") ByteArrayOutputStream debug) throws Exception {
ExtensibleClassLoader classLoader = new ExtensibleClassLoader(ClassPathConfigurationLoaderTest.class.getClassLoader());
classLoader.defineResource("agentconfig/net.amygdalum.testrecorder.profile.ConfigNoArgumentsNonExclusive", "net.amygdalum.testrecorder.profile.DefaultConfigNoArguments".getBytes());
ClassPathConfigurationLoader loader = new ClassPathConfigurationLoader(classLoader) {
@Override
protected <T> Stream<T> configsFrom(Path path, Class<T> clazz, Object[] args) throws IOException {
throw new FileNotFoundException();
}
};
assertThat(loader.load(ConfigNoArgumentsNonExclusive.class).findFirst()).isNotPresent();
assertThat(debug.toString()).contains("did not find configuration file");
}
@ExtendWith(LoggerExtension.class)
@Test
void withIOException(@LogLevel("error") ByteArrayOutputStream error) throws Exception {
ExtensibleClassLoader classLoader = new ExtensibleClassLoader(ClassPathConfigurationLoaderTest.class.getClassLoader());
classLoader.defineResource("agentconfig/net.amygdalum.testrecorder.profile.ConfigNoArgumentsNonExclusive", "net.amygdalum.testrecorder.profile.DefaultConfigNoArguments".getBytes());
ClassPathConfigurationLoader loader = new ClassPathConfigurationLoader(classLoader) {
@Override
protected <T> Stream<T> configsFrom(Path path, Class<T> clazz, Object[] args) throws IOException {
throw new IOException();
}
};
assertThat(loader.load(ConfigNoArgumentsNonExclusive.class).findFirst()).isNotPresent();
assertThat(error.toString()).contains("cannot load configuration file");
}
}
}
| almondtools/testrecorder | testrecorder-agent/src/test/java/net/amygdalum/testrecorder/profile/ClassPathConfigurationLoaderTest.java | Java | lgpl-3.0 | 3,862 |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_TAGRESOURCEREQUEST_H
#define QTAWS_TAGRESOURCEREQUEST_H
#include "iot1clickdevicesservicerequest.h"
namespace QtAws {
namespace IoT1ClickDevicesService {
class TagResourceRequestPrivate;
class QTAWSIOT1CLICKDEVICESSERVICE_EXPORT TagResourceRequest : public IoT1ClickDevicesServiceRequest {
public:
TagResourceRequest(const TagResourceRequest &other);
TagResourceRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(TagResourceRequest)
};
} // namespace IoT1ClickDevicesService
} // namespace QtAws
#endif
| pcolby/libqtaws | src/iot1clickdevicesservice/tagresourcerequest.h | C | lgpl-3.0 | 1,429 |
/* ========================================================================
* PlantUML : a free UML diagram generator
* ========================================================================
*
* (C) Copyright 2009-2014, Arnaud Roques
*
* Project Info: http://plantuml.sourceforge.net
*
* This file is part of PlantUML.
*
* PlantUML is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* PlantUML distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
* USA.
*
*
* Original Author: Arnaud Roques
*/
package net.sourceforge.plantuml.graphic;
import java.awt.geom.Dimension2D;
import net.sourceforge.plantuml.ugraphic.UChangeBackColor;
import net.sourceforge.plantuml.ugraphic.UChangeColor;
import net.sourceforge.plantuml.ugraphic.UGraphic;
import net.sourceforge.plantuml.ugraphic.URectangle;
import net.sourceforge.plantuml.ugraphic.UStroke;
public class TextBlockGeneric implements TextBlock {
private final TextBlock textBlock;
private final HtmlColor background;
private final HtmlColor border;
public TextBlockGeneric(TextBlock textBlock, HtmlColor background, HtmlColor border) {
this.textBlock = textBlock;
this.border = border;
this.background = background;
}
public Dimension2D calculateDimension(StringBounder stringBounder) {
final Dimension2D dim = textBlock.calculateDimension(stringBounder);
return dim;
}
public void drawU(UGraphic ug) {
ug = ug.apply(new UChangeBackColor(background));
ug = ug.apply(new UChangeColor(border));
final Dimension2D dim = calculateDimension(ug.getStringBounder());
ug.apply(new UStroke(2, 2, 1)).draw(new URectangle(dim.getWidth(), dim.getHeight()));
textBlock.drawU(ug);
}
}
| mar9000/plantuml | src/net/sourceforge/plantuml/graphic/TextBlockGeneric.java | Java | lgpl-3.0 | 2,272 |
/*
* SonarQube
* Copyright (C) 2009-2022 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.server.authentication.ws;
import org.junit.Test;
import org.sonar.core.platform.ListContainer;
import static org.assertj.core.api.Assertions.assertThat;
public class AuthenticationWsModuleTest {
@Test
public void verify_count_of_added_components() {
ListContainer container = new ListContainer();
new AuthenticationWsModule().configure(container);
assertThat(container.getAddedObjects()).hasSize(4);
}
}
| SonarSource/sonarqube | server/sonar-webserver-webapi/src/test/java/org/sonar/server/authentication/ws/AuthenticationWsModuleTest.java | Java | lgpl-3.0 | 1,286 |
/*
* Copyright (C) 2015 Morwenn
*
* The SGL is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* The SGL is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not,
* see <http://www.gnu.org/licenses/>.
*/
#ifndef SGL_TYPE_TRAITS_IS_FLOATING_POINT_H_
#define SGL_TYPE_TRAITS_IS_FLOATING_POINT_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <sgl/detail/common.h>
#define sgl_is_floating_point(value) \
_Generic( (value), \
float: true, \
double: true, \
long double: true, \
default: false \
)
#endif // SGL_TYPE_TRAITS_IS_FLOATING_POINT_H_
| Morwenn/SGL | include/sgl/type_traits/is_floating_point.h | C | lgpl-3.0 | 1,260 |
<?php
/*************************************************************************************/
/* This file is part of the RainbowPHP package. If you think this file is lost, */
/* please send it to anyone kind enough to take care of it. Thank you. */
/* */
/* email : [email protected] */
/* web : http://www.benjaminperche.fr */
/* */
/* For the full copyright and license information, please view the LICENSE.txt */
/* file that was distributed with this source code. */
/*************************************************************************************/
namespace RainbowPHP\Generator;
use RainbowPHP\DataProvider\DataProviderInterface;
use RainbowPHP\File\FileHandlerInterface;
use RainbowPHP\Formatter\FormatterInterface;
use RainbowPHP\Formatter\LineFormatter;
use RainbowPHP\Transformer\TransformerInterface;
/**
* Class FileGenerator
* @package RainbowPHP\Generator
* @author Benjamin Perche <[email protected]>
*/
class FileGenerator implements FileGeneratorInterface
{
protected $fileHandler;
protected $transformer;
protected $dataProvider;
protected $formatter;
public function __construct(
FileHandlerInterface $fileHandler,
TransformerInterface $transformer,
DataProviderInterface $dataProvider,
FormatterInterface $formatter = null
) {
$this->fileHandler = $fileHandler;
$this->transformer = $transformer;
$this->dataProvider = $dataProvider;
$this->formatter = $formatter ?: new LineFormatter();
}
public function generateFile()
{
foreach ($this->dataProvider->generate() as $value) {
if (null !== $value) {
$this->fileHandler->writeLine($this->formatter->format($value, $this->transformer->transform($value)));
}
}
}
}
| lovenunu/RainbowPHP | src/RainbowPHP/Generator/FileGenerator.php | PHP | lgpl-3.0 | 2,135 |
/***************************************************************************
* Copyright (C) 2010 by Ralf Kaestner, Nikolas Engelhard, Yves Pilat *
* [email protected] *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#ifndef BOX_H
#define BOX_H
#include "utils/geometry.h"
template <typename T, size_t K> class Box :
public Geometry<T, K> {
public:
template <typename... P> inline Box(const P&... parameters);
inline ~Box();
inline Box& operator=(const Box<T, K>& src);
};
#include "utils/box.tpp"
#endif
| jmaye/janeth-ros-viewer | src/janeth_viewer/lib/utils/box.h | C | lgpl-3.0 | 1,766 |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_DESCRIBEPULLREQUESTEVENTSREQUEST_H
#define QTAWS_DESCRIBEPULLREQUESTEVENTSREQUEST_H
#include "codecommitrequest.h"
namespace QtAws {
namespace CodeCommit {
class DescribePullRequestEventsRequestPrivate;
class QTAWSCODECOMMIT_EXPORT DescribePullRequestEventsRequest : public CodeCommitRequest {
public:
DescribePullRequestEventsRequest(const DescribePullRequestEventsRequest &other);
DescribePullRequestEventsRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(DescribePullRequestEventsRequest)
};
} // namespace CodeCommit
} // namespace QtAws
#endif
| pcolby/libqtaws | src/codecommit/describepullrequesteventsrequest.h | C | lgpl-3.0 | 1,476 |
<?php
namespace pocketmine\entity;
use pocketmine\item\Item as ItemItem;
use pocketmine\nbt\tag\IntTag;
class Slime extends Monster{
const NETWORK_ID = self::SLIME;
const DATA_SIZE = 16;
public $height = 2;
public $width = 2;
public $lenght = 2;//TODO: Size
protected $exp_min = 1;
protected $exp_max = 1;//TODO: Size
public function initEntity(){
$this->setMaxHealth(1);
parent::initEntity();
if (!isset($this->namedtag->Size)){
$this->setSize(mt_rand(0, 3));
}
$this->setSize($this->getSize());
}
public function getName(): string{
return "Slime";
}
public function getDrops(): array{
return [
ItemItem::get(ItemItem::SLIMEBALL, 0, mt_rand(0, 2))
];
}
public function setSize($value){
$this->namedtag->Size = new IntTag("Size", $value);
$this->setDataProperty(self::DATA_SIZE, self::DATA_TYPE_INT, $value);
}
public function getSize(){
return $this->namedtag["Size"];
}
}
| ClearSkyTeam/PocketMine-MP | src/pocketmine/entity/Slime.php | PHP | lgpl-3.0 | 931 |
using System.Globalization;
using System.ServiceProcess;
using System.Threading;
using Castle.Core.Logging;
using Consumentor.ShopGun.Component;
using Consumentor.ShopGun.Configuration;
namespace Consumentor.ShopGun.Services
{
public abstract class ServiceHostBase : ServiceBase
{
public abstract void OnStartService(string[] args);
public abstract void OnStopService();
protected IContainer IocContainer { get; private set; }
protected ServiceHostBase(IContainer iocContainer, string serviceName)
{
IocContainer = iocContainer;
ServiceName = serviceName;
}
public ILogger Log { get; set; }
protected override void OnStart(string[] args)
{
Log.Debug("Service OnStart");
SetCultureInfo();
OnStartService(args);
base.OnStart(args);
}
protected void SetCultureInfo()
{
var cultureConfiguration = IocContainer.Resolve<IServiceCultureConfiguration>();
Thread.CurrentThread.CurrentCulture = cultureConfiguration.CultureInfo;
Thread.CurrentThread.CurrentUICulture = cultureConfiguration.UICulture;
Log.Debug("Service {0} started with CurrentCulture: {1}", ServiceName, CultureInfo.CurrentCulture.ToString());
Log.Debug("Service {0} started with CurrentUICulture: {1}", ServiceName, CultureInfo.CurrentUICulture.ToString());
}
protected override void OnStop()
{
Log.Debug("Service OnStop");
OnStopService();
base.OnStop();
}
}
} | consumentor/Server | trunk/src/Infrastructure/Services/ServiceHostBase.cs | C# | lgpl-3.0 | 1,683 |
#include "GAPhysicsBaseTemp.h"
//------------------------------GAPhysicsBase------------------------------------------
GAPhysicsBase::GAPhysicsBase()
{
}
int GAPhysicsBase::testCollideWith(GAPhysicsBase* object2,GAVector3& collidePoint)
{
return 0;
}
//--------------------------------GALine-----------------------------------------------
GALine::GALine()
{
p1=GAVector3(0,0,0);
p2=GAVector3(1,1,1);
}
GALine::GALine(GAVector3 p1_,GAVector3 p2_)
{
p1=p1_;
p2=p2_;
}
//-------------------------------GASegment---------------------------------------------
GASegment::GASegment()
{
pstart=GAVector3(0,0,0);
pend=GAVector3(1,1,1);
}
GASegment::GASegment(GAVector3 pstart_,GAVector3 pend_)
{
pstart=pstart_;
pend=pend_;
}
//-------------------------------GAPlane-----------------------------------------------
GAPlane::GAPlane()
{
}
int GAPlane::testCollideWith(GAPhysicsBase* object2,GAVector3& collidePoint)
{
return 0;
}
//-----------------------------------GACube--------------------------------------------
GACube::GACube()
{
}
int GACube::testCollideWith(GAPhysicsBase* object2,GAVector3& collidePoint)
{
return 0;
}
int GACube::testCollideWithCube(GACube* object2,GAVector3& collidePoint)
{
return 0;
}
//--------------------------------GACylinder-------------------------------------------
//--------------------------------GASphere---------------------------------------------
//--------------------------------GACapsule-------------------------------------------- | grandiazhao/Grandia-Engine | GrandArtProcessor/GrandArtProcessor/GAPhysicsBaseTemp.cpp | C++ | lgpl-3.0 | 1,506 |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_DELETEHOSTEDZONEREQUEST_H
#define QTAWS_DELETEHOSTEDZONEREQUEST_H
#include "route53request.h"
namespace QtAws {
namespace Route53 {
class DeleteHostedZoneRequestPrivate;
class QTAWSROUTE53_EXPORT DeleteHostedZoneRequest : public Route53Request {
public:
DeleteHostedZoneRequest(const DeleteHostedZoneRequest &other);
DeleteHostedZoneRequest();
virtual bool isValid() const Q_DECL_OVERRIDE;
protected:
virtual QtAws::Core::AwsAbstractResponse * response(QNetworkReply * const reply) const Q_DECL_OVERRIDE;
private:
Q_DECLARE_PRIVATE(DeleteHostedZoneRequest)
};
} // namespace Route53
} // namespace QtAws
#endif
| pcolby/libqtaws | src/route53/deletehostedzonerequest.h | C | lgpl-3.0 | 1,389 |
/*******************************************************************************
* Este arquivo é parte do Biblivre5.
*
* Biblivre5 é um software livre; você pode redistribuí-lo e/ou
* modificá-lo dentro dos termos da Licença Pública Geral GNU como
* publicada pela Fundação do Software Livre (FSF); na versão 3 da
* Licença, ou (caso queira) qualquer versão posterior.
*
* Este programa é distribuído na esperança de que possa ser útil,
* mas SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de
* MERCANTIBILIDADE OU ADEQUAÇÃO PARA UM FIM PARTICULAR. Veja a
* Licença Pública Geral GNU para maiores detalhes.
*
* Você deve ter recebido uma cópia da Licença Pública Geral GNU junto
* com este programa, Se não, veja em <http://www.gnu.org/licenses/>.
*
* @author Alberto Wagner <[email protected]>
* @author Danniel Willian <[email protected]>
******************************************************************************/
package biblivre.core;
import java.io.File;
import java.util.LinkedList;
import org.json.JSONArray;
public class JavascriptCacheableList<T extends IFJson> extends LinkedList<T> implements IFCacheableJavascript {
private static final long serialVersionUID = 1L;
private String variable;
private String prefix;
private String suffix;
private JavascriptCache cache;
public JavascriptCacheableList(String variable, String prefix, String suffix) {
this.variable = variable;
this.prefix = prefix;
this.suffix = suffix;
}
@Override
public String getCacheFileNamePrefix() {
return this.prefix;
}
@Override
public String getCacheFileNameSuffix() {
return this.suffix;
}
@Override
public String toJavascriptString() {
JSONArray array = new JSONArray();
for (T el : this) {
array.put(el.toJSONObject());
}
return this.variable + " = " + array.toString() + ";";
}
@Override
public File getCacheFile() {
if (this.cache == null) {
this.cache = new JavascriptCache(this);
}
return this.cache.getCacheFile();
}
@Override
public String getCacheFileName() {
if (this.cache == null) {
this.cache = new JavascriptCache(this);
}
return this.cache.getFileName();
}
@Override
public void invalidateCache() {
this.cache = null;
}
}
| Biblivre/Biblivre-5 | src/java/biblivre/core/JavascriptCacheableList.java | Java | lgpl-3.0 | 2,296 |
package yaycrawler.admin;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
| liushuishang/YayCrawler | yaycrawler.admin/src/main/java/yaycrawler/admin/ServletInitializer.java | Java | lgpl-3.0 | 392 |
// Copyright © 2004, 2010, Oracle and/or its affiliates. All rights reserved.
//
// MySQL Connector/NET is licensed under the terms of the GPLv2
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
// MySQL Connectors. There are special exceptions to the terms and
// conditions of the GPLv2 as it is applied to this software, see the
// FLOSS License Exception
// <http://www.mysql.com/about/legal/licensing/foss-exception.html>.
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published
// by the Free Software Foundation; version 2 of the License.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
// for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Security;
using System.Security.Permissions;
namespace MySql.Data.MySqlClient
{
[Serializable, AttributeUsage(AttributeTargets.Method | AttributeTargets.Constructor | AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Assembly, AllowMultiple = true, Inherited = false)]
public sealed class MySqlClientPermissionAttribute : DBDataPermissionAttribute
{
// Methods
public MySqlClientPermissionAttribute(SecurityAction action) : base(action)
{
}
public override IPermission CreatePermission()
{
return new MySqlClientPermission(this);
}
}
}
| ramayasket/Kwisatz-Haderach | MySql.Data/MySqlClientPermissionAttribute.cs | C# | lgpl-3.0 | 1,830 |
using System;
using System.Linq;
using System.Threading;
using System.Web.Mvc;
using Arashi.Core;
using Arashi.Core.Domain;
using Arashi.Services.Localization;
namespace Arashi.Web.Mvc.Views
{
public abstract class AdminViewUserControlBase : WebViewPage //ViewUserControl
{
private ILocalizationService localizationService;
/// <summary>
/// Constructor
/// </summary>
protected AdminViewUserControlBase()
{
localizationService = IoC.Resolve<ILocalizationService>();
}
/// <summary>
/// Get the current RequestContext
/// </summary>
public IRequestContext RequestContext
{
get
{
if (ViewData.ContainsKey("Context") && ViewData["Context"] != null)
return ViewData["Context"] as IRequestContext;
else
return null;
}
}
#region Localization Support
/// <summary>
/// Get a localized global resource
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
protected string GlobalResource(string token)
{
return localizationService.GlobalResource(token, Thread.CurrentThread.CurrentUICulture);
}
/// <summary>
/// Get a localized global resource filled with format parameters
/// </summary>
/// <param name="token"></param>
/// <param name="args"></param>
/// <returns></returns>
protected string GlobalResource(string token, params object[] args)
{
return string.Format(GlobalResource(token), args);
}
#endregion
}
public abstract class AdminViewUserControlBase<TModel> : WebViewPage<TModel> // ViewUserControl<TModel>
where TModel : class
{
private ILocalizationService localizationService;
/// <summary>
/// Constructor
/// </summary>
protected AdminViewUserControlBase()
{
localizationService = IoC.Resolve<ILocalizationService>();
}
/// <summary>
/// Get the current RequestContext
/// </summary>
public IRequestContext RequestContext
{
get
{
if (ViewData.ContainsKey("Context") && ViewData["Context"] != null)
return ViewData["Context"] as IRequestContext;
else
return null;
}
}
#region Localization Support
/// <summary>
/// Get a localized global resource
/// </summary>
/// <param name="token"></param>
/// <returns></returns>
protected string GlobalResource(string token)
{
return localizationService.GlobalResource(token, Thread.CurrentThread.CurrentUICulture);
}
/// <summary>
/// Get a localized global resource filled with format parameters
/// </summary>
/// <param name="token"></param>
/// <param name="args"></param>
/// <returns></returns>
protected string GlobalResource(string token, params object[] args)
{
return string.Format(GlobalResource(token), args);
}
#endregion
}
} | aozora/arashi | src/Web.Mvc/Views/AdminViewUserControlBase.cs | C# | lgpl-3.0 | 3,173 |
/**
* Kopernicus Planetary System Modifier
* -------------------------------------------------------------
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301 USA
*
* This library is intended to be used as a plugin for Kerbal Space Program
* which is copyright of TakeTwo Interactive. Your usage of Kerbal Space Program
* itself is governed by the terms of its EULA, not the license above.
*
* https://kerbalspaceprogram.com
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;
using KSP;
using KSP.IO;
using UnityEngine;
namespace Kopernicus.Configuration
{
public class ConfigReader
{
[Persistent]
public bool EnforceShaders = false;
[Persistent]
public bool WarnShaders = false;
[Persistent]
public int EnforcedShaderLevel = 2;
[Persistent]
public int ScatterCullDistance = 5000;
[Persistent]
public string UseKopernicusAsteroidSystem = "True";
[Persistent]
public int SolarRefreshRate = 1;
public UrlDir.UrlConfig[] baseConfigs;
public void loadMainSettings()
{
baseConfigs = GameDatabase.Instance.GetConfigs("Kopernicus_config");
if (baseConfigs.Length == 0)
{
Debug.LogWarning("No Kopernicus_Config file found, using defaults");
return;
}
if (baseConfigs.Length > 1)
{
Debug.LogWarning("Multiple Kopernicus_Config files detected, check your install");
}
try
{
ConfigNode.LoadObjectFromConfig(this, baseConfigs[0].config);
}
catch
{
Debug.LogWarning("Error loading config, using defaults");
}
}
}
}
| BryceSchroeder/Kopernicus | src/Kopernicus/Configuration/ConfigReader.cs | C# | lgpl-3.0 | 2,301 |
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
namespace pocketmine\entity;
use pocketmine\nbt\tag\String;
class Creeper extends Monster implements Explosive{
protected function initEntity(){
$this->namedtag->id = new String("id", "Creeper");
}
} | zxl777/PocketMine-MP | src/pocketmine/entity/Creeper.php | PHP | lgpl-3.0 | 920 |
/**********************************************************
DO NOT EDIT
This file was generated from stone specification "users"
www.prokarpaty.net
***********************************************************/
#include "dropbox/users/UsersFullAccount.h"
using namespace dropboxQt;
namespace dropboxQt{
namespace users{
///FullAccount
FullAccount::operator QJsonObject()const{
QJsonObject js;
this->toJson(js);
return js;
}
void FullAccount::toJson(QJsonObject& js)const{
Account::toJson(js);
if(!m_country.isEmpty())
js["country"] = QString(m_country);
if(!m_locale.isEmpty())
js["locale"] = QString(m_locale);
if(!m_referral_link.isEmpty())
js["referral_link"] = QString(m_referral_link);
js["team"] = (QJsonObject)m_team;
if(!m_team_member_id.isEmpty())
js["team_member_id"] = QString(m_team_member_id);
js["is_paired"] = m_is_paired;
m_account_type.toJson(js, "account_type");
}
void FullAccount::fromJson(const QJsonObject& js){
Account::fromJson(js);
m_country = js["country"].toString();
m_locale = js["locale"].toString();
m_referral_link = js["referral_link"].toString();
m_team.fromJson(js["team"].toObject());
m_team_member_id = js["team_member_id"].toString();
m_is_paired = js["is_paired"].toVariant().toBool();
m_account_type.fromJson(js["account_type"].toObject());
}
QString FullAccount::toString(bool multiline)const
{
QJsonObject js;
toJson(js);
QJsonDocument doc(js);
QString s(doc.toJson(multiline ? QJsonDocument::Indented : QJsonDocument::Compact));
return s;
}
std::unique_ptr<FullAccount> FullAccount::factory::create(const QByteArray& data)
{
QJsonDocument doc = QJsonDocument::fromJson(data);
QJsonObject js = doc.object();
return create(js);
}
std::unique_ptr<FullAccount> FullAccount::factory::create(const QJsonObject& js)
{
std::unique_ptr<FullAccount> rv;
rv = std::unique_ptr<FullAccount>(new FullAccount);
rv->fromJson(js);
return rv;
}
}//users
}//dropboxQt
| kratos83/FabariaGest | qtdropbox/dropbox/users/UsersFullAccount.cpp | C++ | lgpl-3.0 | 2,066 |
# Documentation: https://github.com/Homebrew/homebrew/blob/master/share/doc/homebrew/Formula-Cookbook.md
# /usr/local/Library/Contributions/example-formula.rb
# PLEASE REMOVE ALL GENERATED COMMENTS BEFORE SUBMITTING YOUR PULL REQUEST!
class RubyDmSqliteAdapter < Formula
homepage ""
head "git://git.kali.org/packages/ruby-dm-sqlite-adapter.git"
version "dm"
# depends_on "cmake" => :build
depends_on :x11 # if your formula requires any X11/XQuartz components
def install
# ENV.deparallelize # if your formula fails when building in parallel
# Remove unrecognized options if warned by configure
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
# system "cmake", ".", *std_cmake_args
system "make", "install" # if this fails, try separate make/make install steps
end
test do
# `test do` will create, run in and delete a temporary directory.
#
# This test will fail and we won't accept that! It's enough to just replace
# "false" with the main program this formula installs, but it'd be nice if you
# were more thorough. Run the test with `brew test ruby-dm-sqlite-adapter`. Options passed
# to `brew install` such as `--HEAD` also need to be provided to `brew test`.
#
# The installed folder is not in the path, so use the entire path to any
# executables being tested: `system "#{bin}/program", "do", "something"`.
system "false"
end
end
| feffi/homebrew-penbrew | Formula/ruby-dm-sqlite-adapter.rb | Ruby | lgpl-3.0 | 1,589 |
#include "zjson.h"
#define Start 0x1<<1
#define ObjectInitial 0x1<<2
#define MemberKey 0x1<<3
#define KeyValueDelimiter 0x1<<4
#define MemberValue 0x1<<5
#define MemberDelimiter 0x1<<6
#define ObjectFinish 0x1<<7
#define ArrayInitial 0x1<<8
#define Element 0x1<<9
#define ElementDelimiter 0x1<<10
#define ArrayFinish 0x1<<11
#define Finish 0x1<<12
/*
* Log macro
* What we can catch:
* - JSON string
* - current state
* - current character
* - current token start and end positions
* - current line number and column number
*/
#define ERR(e) do{\
put_err_token(); \
printf("Unexpected char: '%c'\n" \
"\tstatus [%s] \n" \
"\tfunction %s:%d\n" \
"\ttoken position:(%d,%d)\n", \
*(e),StateStrings[_log2(state)-1],__FUNCTION__,__LINE__,line,column);\
exit(EXIT_FAILURE);\
}while(0)
#define match(s, st) (s)&(st)
#define SET_TOKEN_START(ptr) token_start = (ptr)
#define SET_TOKEN_END(ptr) token_end = (ptr)
#define PEEK(ptr) (*(ptr))
#define EAT(ptr) do{SET_TOKEN_START(ptr);(ptr)++;column++;}while(0);
typedef int State;
typedef struct stack {
jval *head;
struct stack *next;
} stack;
static inline int is_xdigit(jchar ch);
static inline int is_digit(jchar ch);
static inline int _log2(int n);
static void put_err_token(void);
static void put_context(void);
static void stack_push(stack *st, jval *elem);
static jval *stack_pop(stack *st);
static jstr eat_key(const jchar **pp);
static jval *eat_string(const jchar **);
static jval *eat_num(const jchar **);
static jval *eat_true(const jchar **);
static jval *eat_false(const jchar **);
static jval *eat_null(const jchar **);
static const char *StateStrings[] = {
"Start", "ObjectInitial", "MemberKey", "KeyValueDelimiter",
"MemberValue", "MemberDelimiter", "ObjectFinish", "ArrayInitial",
"Element", "ElementDelimiter", "ArrayFinish", "Finish"
};
static const unsigned char firstByteMark[7] = {0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC};
static State state = Start;
static int line = 1, column = 1;
static const char *token_start = NULL, *token_end = NULL, *JSON = NULL;
static inline int _log2(int n) {
int e = 0;
while (n >>= 1) e++;
return e;
}
static void put_context(void) {
const char *ptr = JSON;
int count = 0;
while (count < line) {
ptr++;
if (*ptr == '\n')
count++;
}
}
static void put_err_token(void) {
printf("Error Token:\n\t");
const char *ptr = token_start, *ptr2 = token_start;
while (ptr <= token_end) printf("%c", *ptr++);
printf("\n\t");
while (ptr2++ < token_end) printf(" ");
printf("^");
printf("\n\t");
}
static void literal_value_handler(const jchar **pp,
jval *currentNode, jstr currentKey,
jval *(*handle)(const jchar **)) {
if (match(state, ArrayInitial | ElementDelimiter)) {
state = Element;
zJSON_set_arr_value(currentNode, handle(pp));
} else if (match(state, KeyValueDelimiter)) {
state = MemberValue;
zJSON_set_key_value(currentNode, currentKey, handle(pp));
} else
ERR(*pp);
}
static void obj_arr_handler(const jchar **pp,
vtype type, jval **pcurrentNode,
stack *nodeStack, jchar *currentKey) {
jval *newObjOrArray = zJSON_new_jval(type);
if (match(state, Start)) {
EAT(*pp);
} else if (match(state, KeyValueDelimiter)) {
zJSON_set_key_value(*pcurrentNode, currentKey, newObjOrArray);
stack_push(nodeStack, *pcurrentNode);
EAT(*pp);
} else if (match(state, ArrayInitial | ElementDelimiter)) {
zJSON_set_arr_value(*pcurrentNode, newObjOrArray);
stack_push(nodeStack, *pcurrentNode);
EAT(*pp);
} else {
ERR(*pp);
}
state = (type == OBJ) ? ObjectInitial : ArrayInitial;
*pcurrentNode = newObjOrArray;
}
static jval *eat_literal(const jchar **pp, const char *str) {
SET_TOKEN_START(*pp);
const char *s = str;
jval *v = NULL;
while (*s) {
if (**pp == *s) {
(*pp)++;
s++;
} else {
ERR(*pp);
}
}
if (*str == 't') {
v = zJSON_new_true();
}
if (*str == 'f') {
v = zJSON_new_false();
}
if (*str == 'n') {
v = zJSON_new_null();
}
SET_TOKEN_END(*pp);
return v;
}
inline jval *eat_true(const jchar **pp) {
return eat_literal(pp, "true");
}
inline jval *eat_false(const jchar **pp) {
return eat_literal(pp, "false");
}
inline jval *eat_null(const jchar **pp) {
return eat_literal(pp, "null");
}
#define __PREV(pp) (*(*pp-1))
#define __NEXT(pp) (*(*pp+1))
static unsigned parse_hex4(const char *str) {
unsigned hex = 0;
for (int i = 0; i < 4; ++i) {
unsigned hc = 0;
int ex = 0x1000 >> (i * 4);
if ('0' <= str[i] && str[i] <= '9') { hc = 00 + str[i] - '0'; } else
if ('A' <= str[i] && str[i] <= 'Z') { hc = 10 + str[i] - 'A'; } else
if ('a' <= str[i] && str[i] <= 'z') { hc = 10 + str[i] - 'a'; } else
return -1;
hex += hc * ex;
}
return hex;
}
jstr eat_key(const jchar **pp) {
SET_TOKEN_START(*pp);
(*pp)++;/* skip the first '"'*/
const jchar *start_pos = *pp,*end_pos;
size_t len = 0,unicode_len;
unsigned uc,uc2;
while (*pp && !(**pp == '\"' && __PREV(pp) != '\\') && ++len){
if (*((*pp)++) == '\\') (*pp)++;
} /* Skip every escaped character, calculate the lenghth,
Each unicode char occupies 5 bytes */
jstr str = malloc(len + 1); /* free() at free_jpair() */
end_pos = *pp;
*pp = start_pos;
char * ptr = str;
while (*pp <= end_pos && !(**pp == '\"' && __PREV(pp) != '\\')){
if (**pp != '\\') {
*ptr++ = *((*pp)++);
} else {
switch (__NEXT(pp)) {
case 'b': *ptr++ = '\b'; (*pp) += 2; break;
case 'f': *ptr++ = '\f'; (*pp) += 2; break;
case 'n': *ptr++ = '\n'; (*pp) += 2; break;
case 'r': *ptr++ = '\r'; (*pp) += 2; break;
case 't': *ptr++ = '\t'; (*pp) += 2; break;
case '"': *ptr++ = '"'; (*pp) += 2; break;
case '/': *ptr++ = '/'; (*pp) += 2; break;
case '\\':*ptr++ = '\\'; (*pp) += 2; break;
case 'u':
uc = parse_hex4((*pp)+2);
(*pp) += 6;/* Why ? */
if ((uc >= 0xDC00 && uc <= 0xDFFF) || uc == 0) { ERR((*pp)); } /* invalid unicode number */
if (uc >= 0xD800 && uc <= 0xDBFF) {
uc2 = parse_hex4((*pp)+2);
(*pp) += 6;
if ((uc2 >= 0xDC00 && uc2 <= 0xDFFF) || uc2 == 0) { ERR((*pp)); }
uc = 0x10000 + (((uc & 0x3FF) << 10) | (uc2 & 0x3FF));
}
unicode_len = 4;
if (uc < 0x80)
unicode_len = 1;
else if (uc < 0x800)
unicode_len = 2;
else if (uc < 0x10000)
unicode_len = 3;
ptr += unicode_len;
switch (unicode_len) {
case 4: *--ptr = ((uc | 0x80) & 0xBF); uc >>= 6;
case 3: *--ptr = ((uc | 0x80) & 0xBF); uc >>= 6;
case 2: *--ptr = ((uc | 0x80) & 0xBF); uc >>= 6;
case 1: *--ptr = ( uc | firstByteMark[unicode_len]);
}
ptr += unicode_len;
break;
default:
ERR(*pp);
}
}
}
str[len] = 0;
(*pp)++;/*skip the last '"'*/
column += len;
SET_TOKEN_END(*pp);
return str;
}
jval *eat_string(const jchar **pp) {
strv->vstr = eat_key(pp);
return strv;
}
static inline int is_digit(jchar ch) {
return ((ch >= '0') && (ch <= '9')) || (ch == '.');
}
static inline int is_xdigit(jchar ch) {
return ((ch >= '0') && (ch <= '9'))
|| ((ch >= 'A') && (ch <= 'F'))
|| ((ch >= 'a') && (ch <= 'f'));
}
jval *eat_num(const jchar **pp) {
//TODO
SET_TOKEN_START(*pp);
jchar buffer[41] = {0};
jchar *ptr = buffer;
int dbl_flag = 0;
if (**pp == '-') *(ptr++) = *((*pp)++);
if (**pp != '.') {
while (is_digit(**pp)) { *(ptr++) = *((*pp)++); }
} else {
ERR(*pp);
}
ptr = buffer;
while (*ptr) if(*ptr++ == '.')dbl_flag = 1;
jval *intv = zJSON_new_jval(dbl_flag?DBL:NUM);
intv->vdouble = atof(buffer);
SET_TOKEN_END(*pp);
return intv;
}
void stack_push(stack *st, jval *head) {
stack *e = malloc(sizeof(stack)); /* free at stack_pop() */
assert(e);
e->head = head;
e->next = st->next;
st->next = e;
}
jval *stack_pop(stack *st) {
if (st->next == NULL)
return NULL;
jval *head = st->next->head;
stack *e = st->next;
st->next = e->next;
free(e);//crash here invalid next size FIXME!
return head;
}
jval *zJSON_parse(const jchar *json) {
JSON = json;
const jchar *p = json;
token_start = json;
token_end = token_start;
jval *currentNode = NULL;
jchar *currentKey = NULL;
stack *nodeStack = malloc(sizeof(stack)); /* free() at this function's end */
nodeStack->head = NULL;
nodeStack->next = NULL;
while (1) {
switch (PEEK(p)) {
case '{':
case '[':
obj_arr_handler(&p,(*p == '{')?OBJ:ARR,¤tNode,nodeStack,currentKey);
break;
case '"':
if (match(state, ObjectInitial | MemberDelimiter)) {
state = MemberKey;
zJSON_set_key(currentNode, currentKey = eat_key(&p));
} else
literal_value_handler(&p, currentNode, currentKey, eat_string);
break;
case 't':
literal_value_handler(&p, currentNode, currentKey, eat_true);
break;
case 'f':
literal_value_handler(&p, currentNode, currentKey, eat_false);
break;
case 'n':
literal_value_handler(&p, currentNode, currentKey, eat_null);
break;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
case '-':
literal_value_handler(&p, currentNode, currentKey, eat_num);
break;
case '}':
case ']':
if (match(state, ObjectInitial | MemberValue | ArrayInitial | Element)) {
jval *t_currentNode;
if ((t_currentNode = stack_pop(nodeStack))) {
currentNode = t_currentNode;
state = (currentNode->type == ARR) ? Element : MemberValue;
EAT(p);
} else {
EAT(p);
goto AUTOMATA_END;
}
} else
ERR(p);
break;
case ',':
if (match(state, MemberValue)) {
state = MemberDelimiter;
EAT(p);
} else if (match(state, Element)) {
state = ElementDelimiter;
EAT(p);
} else
ERR(p);
break;
case ':':
if (match(state, MemberKey)) {
state = KeyValueDelimiter;
EAT(p);
} else
ERR(p);
break;
case '\n':
line++;
column = 1;
/*NO break here*/
case '\t':
case ' ':
EAT(p);
break;
case '\0':
if (match(state, ArrayFinish | ObjectFinish))
state = Finish;
else
ERR(p);
goto AUTOMATA_END;
default:
ERR(p);
}
}
AUTOMATA_END:
free(nodeStack);
state = Start;
return currentNode;
}
| zuoxinyu/zlibc | misc/zjson/src/parser.c | C | lgpl-3.0 | 10,987 |
# Define helper methods to create test data
# for mail view
module MailViewTestData
def admin_email
@admin_email ||= FactoryGirl.build(:email, address: "[email protected]")
end
def admin
@admin ||= FactoryGirl.build(:person, emails: [admin_email])
end
def author
@author ||= FactoryGirl.build(:person)
end
def starter
@starter ||= FactoryGirl.build(:person)
end
def member
return @member unless @member.nil?
@member ||= FactoryGirl.build(:person)
@member.emails.first.confirmation_token = "123456abcdef"
@member
end
def community_memberships
@community_memberships ||= [
FactoryGirl.build(:community_membership, person: admin, admin: true),
FactoryGirl.build(:community_membership, person: author),
FactoryGirl.build(:community_membership, person: starter),
FactoryGirl.build(:community_membership, person: member)
]
end
def members
@members ||= [admin, author, starter, member]
end
def payment_gateway
@braintree_payment_gateway ||= FactoryGirl.build(:braintree_payment_gateway)
end
def checkout_payment_gateway
@checkout_payment_gateway ||= FactoryGirl.build(:checkout_payment_gateway)
end
def payment
return @payment unless @payment.nil?
@payment ||= FactoryGirl.build(:braintree_payment,
id: 55,
payment_gateway:
payment_gateway,
payer: starter,
recipient: author
)
# Avoid infinite loop, set conversation here
@payment.transaction = transaction
@payment
end
def checkout_payment
return @checkout_payment unless @checkout_payment.nil?
@checkout_payment ||= FactoryGirl.build(:checkout_payment,
id: 55,
payment_gateway: checkout_payment_gateway,
payer: starter,
recipient: author
)
# Avoid infinite loop, set conversation here
@checkout_payment.conversation = conversation
@checkout_payment
end
def listing
@listing ||= FactoryGirl.build(:listing,
author: author,
id: 123
)
end
def participations
@participations ||= [
FactoryGirl.build(:participation, person: author),
FactoryGirl.build(:participation, person: starter, is_starter: true)
]
end
def transaction
@transaction ||= FactoryGirl.build(:transaction,
id: 99,
community: community,
listing: listing,
payment: payment,
conversation: conversation,
automatic_confirmation_after_days: 5
)
end
def paypal_transaction
@paypal_transaction ||= FactoryGirl.build(:transaction,
id: 100,
community: paypal_community,
listing: listing,
conversation: conversation,
payment_gateway: :paypal,
current_state: :paid,
shipping_price_cents: 100
)
end
def paypal_community
@paypal_community ||= FactoryGirl.build(:community,
custom_color1: "00FF99",
id: 999
)
end
def conversation
@conversation ||= FactoryGirl.build(:conversation,
id: 99,
community: community,
listing: listing,
participations: participations,
participants: [author, starter],
messages: [message]
)
end
def message
@message ||= FactoryGirl.build(:message,
sender: starter,
id: 123
)
end
def community
@community ||= FactoryGirl.build(:community,
payment_gateway: payment_gateway,
custom_color1: "FF0099",
admins: [admin],
members: members,
community_memberships: community_memberships
)
end
def checkout_community
@checkout_community ||= FactoryGirl.build(:community,
payment_gateway: checkout_payment_gateway,
custom_color1: "FF0099",
admins: [admin],
members: members,
community_memberships: community_memberships
)
end
end
| ziyoucaishi/marketplace | app/mailers/mail_view_test_data.rb | Ruby | lgpl-3.0 | 3,816 |
package br.com.vepo.datatransform.model;
import org.springframework.beans.factory.annotation.Autowired;
public abstract class Repository<T> {
@Autowired
protected MongoConnection mongoConnection;
public <V> T find(Class<T> clazz, V key) {
return mongoConnection.getMorphiaDataStore().get(clazz, key);
}
public void persist(T obj) {
mongoConnection.getMorphiaDataStore().save(obj);
}
}
| vepo/data-refine | src/main/java/br/com/vepo/datatransform/model/Repository.java | Java | lgpl-3.0 | 399 |
--Copyright (C) 2009 <SWGEmu>
--This File is part of Core3.
--This program is free software; you can redistribute
--it and/or modify it under the terms of the GNU Lesser
--General Public License as published by the Free Software
--Foundation; either version 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 Lesser General Public License for
--more details.
--You should have received a copy of the GNU Lesser General
--Public License along with this program; if not, write to
--the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--Linking Engine3 statically or dynamically with other modules
--is making a combined work based on Engine3.
--Thus, the terms and conditions of the GNU Lesser General Public License
--cover the whole combination.
--In addition, as a special exception, the copyright holders of Engine3
--give you permission to combine Engine3 program with free software
--programs or libraries that are released under the GNU LGPL and with
--code included in the standard release of Core3 under the GNU LGPL
--license (or modified versions of such code, with unchanged license).
--You may copy and distribute such a system following the terms of the
--GNU LGPL for Engine3 and the licenses of the other code concerned,
--provided that you include the source code of that other code when
--and as the GNU LGPL requires distribution of source code.
--Note that people who make modified versions of Engine3 are not obligated
--to grant this special exception for their modified versions;
--it is their choice whether to do so. The GNU Lesser General Public License
--gives permission to release a modified version without this exception;
--this exception also makes it possible to release a modified version
--which carries forward this exception.
object_weapon_melee_2h_sword_base_shared_2h_sword_base = SharedWeaponObjectTemplate:new {
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/hold_r.iff",
attackType = 1,
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "clientdata/weapon/client_melee_sword_basic.cdf",
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 1,
containerVolumeLimit = 0,
customizationVariableMapping = {},
detailedDescription = "string_id_table",
gameObjectType = 131080,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_weapon",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/default_weapon.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
useStructureFootprintOutline = 0,
weaponEffect = "bolt",
weaponEffectIndex = 0
}
ObjectTemplates:addTemplate(object_weapon_melee_2h_sword_base_shared_2h_sword_base, 3231039364)
object_weapon_melee_2h_sword_base_shared_crafted_lightsaber_base = SharedWeaponObjectTemplate:new {
appearanceFilename = "",
arrangementDescriptorFilename = "abstract/slot/arrangement/wearables/hold_both.iff",
attackType = 1,
certificationsRequired = {},
clearFloraRadius = 0,
clientDataFile = "clientdata/weapon/client_melee_lightsaber_basic.cdf",
collisionActionBlockFlags = 0,
collisionActionFlags = 51,
collisionActionPassFlags = 1,
collisionMaterialBlockFlags = 0,
collisionMaterialFlags = 1,
collisionMaterialPassFlags = 0,
containerType = 1,
containerVolumeLimit = 0,
customizationVariableMapping = {},
detailedDescription = "string_id_table",
gameObjectType = 131080,
locationReservationRadius = 0,
lookAtText = "string_id_table",
noBuildRadius = 0,
objectName = "@obj_n:unknown_weapon",
onlyVisibleInTools = 0,
paletteColorCustomizationVariables = {},
portalLayoutFilename = "",
rangedIntCustomizationVariables = {},
scale = 1,
scaleThresholdBeforeExtentTest = 0.5,
sendToClient = 1,
slotDescriptorFilename = "abstract/slot/descriptor/default_lightsaber.iff",
snapToTerrain = 1,
socketDestinations = {},
structureFootprintFileName = "",
surfaceType = 0,
targetable = 1,
useStructureFootprintOutline = 0,
weaponEffect = "bolt",
weaponEffectIndex = 0
}
ObjectTemplates:addTemplate(object_weapon_melee_2h_sword_base_shared_crafted_lightsaber_base, 3974479430)
| TheAnswer/FirstTest | bin/scripts/object/weapon/melee/2h_sword/base/objects.lua | Lua | lgpl-3.0 | 4,968 |
// Copyright 2012, 2013 Canonical Ltd.
// Licensed under the AGPLv3, see LICENCE file for details.
package charmrepo_test
import (
jc "github.com/juju/testing/checkers"
gc "gopkg.in/check.v1"
"gopkg.in/juju/charm.v6-unstable"
"gopkg.in/juju/charmrepo.v0"
"gopkg.in/juju/charmrepo.v0/csclient"
charmtesting "gopkg.in/juju/charmrepo.v0/testing"
)
var TestCharms = charmtesting.NewRepo("internal/test-charm-repo", "quantal")
type inferRepoSuite struct{}
var _ = gc.Suite(&inferRepoSuite{})
var inferRepositoryTests = []struct {
url string
localRepoPath string
err string
}{{
url: "cs:trusty/django",
}, {
url: "local:precise/wordpress",
err: "path to local repository not specified",
}, {
url: "local:precise/haproxy-47",
localRepoPath: "/tmp/repo-path",
}}
func (s *inferRepoSuite) TestInferRepository(c *gc.C) {
for i, test := range inferRepositoryTests {
c.Logf("test %d: %s", i, test.url)
ref := charm.MustParseReference(test.url)
repo, err := charmrepo.InferRepository(
ref, charmrepo.NewCharmStoreParams{}, test.localRepoPath)
if test.err != "" {
c.Assert(err, gc.ErrorMatches, test.err)
c.Assert(repo, gc.IsNil)
continue
}
c.Assert(err, jc.ErrorIsNil)
switch store := repo.(type) {
case *charmrepo.LocalRepository:
c.Assert(store.Path, gc.Equals, test.localRepoPath)
case *charmrepo.CharmStore:
c.Assert(store.URL(), gc.Equals, csclient.ServerURL)
default:
c.Fatal("unknown repository type")
}
}
}
| jrwren/charmrepo | repo_test.go | GO | lgpl-3.0 | 1,499 |
<?php
namespace Clearbooks\Labs\Toggle\Entity;
class Parasol extends ToggleStub
{
protected $name = "Parasol";
protected $desc = "An MASsIVE Umbrella";
protected $id = 2;
protected $toggleTitle = "Parasols 4 Dayz";
} | clearbooks/labs | test/Toggle/Entity/Parasol.php | PHP | lgpl-3.0 | 233 |
package org.com.json;
/*
Copyright (c) 2002 JSON.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
The Software shall be used for Good, not Evil.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
import java.util.Iterator;
/**
* This provides static methods to convert an XML text into a JSONObject,
* and to covert a JSONObject into an XML text.
* @author JSON.org
* @version 2008-10-14
*/
public class XML {
/** The Character '&'. */
public static final Character AMP = new Character('&');
/** The Character '''. */
public static final Character APOS = new Character('\'');
/** The Character '!'. */
public static final Character BANG = new Character('!');
/** The Character '='. */
public static final Character EQ = new Character('=');
/** The Character '>'. */
public static final Character GT = new Character('>');
/** The Character '<'. */
public static final Character LT = new Character('<');
/** The Character '?'. */
public static final Character QUEST = new Character('?');
/** The Character '"'. */
public static final Character QUOT = new Character('"');
/** The Character '/'. */
public static final Character SLASH = new Character('/');
/**
* Replace special characters with XML escapes:
* <pre>
* & <small>(ampersand)</small> is replaced by &amp;
* < <small>(less than)</small> is replaced by &lt;
* > <small>(greater than)</small> is replaced by &gt;
* " <small>(double quote)</small> is replaced by &quot;
* </pre>
* @param string The string to be escaped.
* @return The escaped string.
*/
public static String escape(String string) {
StringBuffer sb = new StringBuffer();
for (int i = 0, len = string.length(); i < len; i++) {
char c = string.charAt(i);
switch (c) {
case '&':
sb.append("&");
break;
case '<':
sb.append("<");
break;
case '>':
sb.append(">");
break;
case '"':
sb.append(""");
break;
default:
sb.append(c);
}
}
return sb.toString();
}
/**
* Throw an exception if the string contains whitespace.
* Whitespace is not allowed in tagNames and attributes.
* @param string
* @throws JSONException
*/
public static void noSpace(String string) throws JSONException {
int i, length = string.length();
if (length == 0) {
throw new JSONException("Empty string.");
}
for (i = 0; i < length; i += 1) {
if (Character.isWhitespace(string.charAt(i))) {
throw new JSONException("'" + string +
"' contains a space character.");
}
}
}
/**
* Scan the content following the named tag, attaching it to the context.
* @param x The XMLTokener containing the source string.
* @param context The JSONObject that will include the new material.
* @param name The tag name.
* @return true if the close tag is processed.
* @throws JSONException
*/
private static boolean parse(XMLTokener x, JSONObject context,
String name) throws JSONException {
char c;
int i;
String n;
JSONObject o = null;
String s;
Object t;
// Test for and skip past these forms:
// <!-- ... -->
// <! ... >
// <![ ... ]]>
// <? ... ?>
// Report errors for these forms:
// <>
// <=
// <<
t = x.nextToken();
// <!
if (t == BANG) {
c = x.next();
if (c == '-') {
if (x.next() == '-') {
x.skipPast("-->");
return false;
}
x.back();
} else if (c == '[') {
t = x.nextToken();
if (t.equals("CDATA")) {
if (x.next() == '[') {
s = x.nextCDATA();
if (s.length() > 0) {
context.accumulate("content", s);
}
return false;
}
}
throw x.syntaxError("Expected 'CDATA['");
}
i = 1;
do {
t = x.nextMeta();
if (t == null) {
throw x.syntaxError("Missing '>' after '<!'.");
} else if (t == LT) {
i += 1;
} else if (t == GT) {
i -= 1;
}
} while (i > 0);
return false;
} else if (t == QUEST) {
// <?
x.skipPast("?>");
return false;
} else if (t == SLASH) {
// Close tag </
t = x.nextToken();
if (name == null) {
throw x.syntaxError("Mismatched close tag" + t);
}
if (!t.equals(name)) {
throw x.syntaxError("Mismatched " + name + " and " + t);
}
if (x.nextToken() != GT) {
throw x.syntaxError("Misshaped close tag");
}
return true;
} else if (t instanceof Character) {
throw x.syntaxError("Misshaped tag");
// Open tag <
} else {
n = (String)t;
t = null;
o = new JSONObject();
for (;;) {
if (t == null) {
t = x.nextToken();
}
// attribute = value
if (t instanceof String) {
s = (String)t;
t = x.nextToken();
if (t == EQ) {
t = x.nextToken();
if (!(t instanceof String)) {
throw x.syntaxError("Missing value");
}
o.accumulate(s, JSONObject.stringToValue((String)t));
t = null;
} else {
o.accumulate(s, "");
}
// Empty tag <.../>
} else if (t == SLASH) {
if (x.nextToken() != GT) {
throw x.syntaxError("Misshaped tag");
}
context.accumulate(n, o);
return false;
// Content, between <...> and </...>
} else if (t == GT) {
for (;;) {
t = x.nextContent();
if (t == null) {
if (n != null) {
throw x.syntaxError("Unclosed tag " + n);
}
return false;
} else if (t instanceof String) {
s = (String)t;
if (s.length() > 0) {
o.accumulate("content", JSONObject.stringToValue(s));
}
// Nested element
} else if (t == LT) {
if (parse(x, o, n)) {
if (o.length() == 0) {
context.accumulate(n, "");
} else if (o.length() == 1 &&
o.opt("content") != null) {
context.accumulate(n, o.opt("content"));
} else {
context.accumulate(n, o);
}
return false;
}
}
}
} else {
throw x.syntaxError("Misshaped tag");
}
}
}
}
/**
* Convert a well-formed (but not necessarily valid) XML string into a
* JSONObject. Some information may be lost in this transformation
* because JSON is a data format and XML is a document format. XML uses
* elements, attributes, and content text, while JSON uses unordered
* collections of name/value pairs and arrays of values. JSON does not
* does not like to distinguish between elements and attributes.
* Sequences of similar elements are represented as JSONArrays. Content
* text may be placed in a "content" member. Comments, prologs, DTDs, and
* <code><[ [ ]]></code> are ignored.
* @param string The source string.
* @return A JSONObject containing the structured data from the XML string.
* @throws JSONException
*/
public static JSONObject toJSONObject(String string) throws JSONException {
JSONObject o = new JSONObject();
XMLTokener x = new XMLTokener(string);
while (x.more() && x.skipPast("<")) {
parse(x, o, null);
}
return o;
}
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o) throws JSONException {
return toString(o, null);
}
/**
* Convert a JSONObject into a well-formed, element-normal XML string.
* @param o A JSONObject.
* @param tagName The optional name of the enclosing tag.
* @return A string.
* @throws JSONException
*/
public static String toString(Object o, String tagName)
throws JSONException {
StringBuffer b = new StringBuffer();
int i;
JSONArray ja;
JSONObject jo;
String k;
Iterator keys;
int len;
String s;
Object v;
if (o instanceof JSONObject) {
// Emit <tagName>
if (tagName != null) {
b.append('<');
b.append(tagName);
b.append('>');
}
// Loop thru the keys.
jo = (JSONObject)o;
keys = jo.keys();
while (keys.hasNext()) {
k = keys.next().toString();
v = jo.opt(k);
if (v == null) {
v = "";
}
if (v instanceof String) {
s = (String)v;
} else {
s = null;
}
// Emit content in body
if (k.equals("content")) {
if (v instanceof JSONArray) {
ja = (JSONArray)v;
len = ja.length();
for (i = 0; i < len; i += 1) {
if (i > 0) {
b.append('\n');
}
b.append(escape(ja.get(i).toString()));
}
} else {
b.append(escape(v.toString()));
}
// Emit an array of similar keys
} else if (v instanceof JSONArray) {
ja = (JSONArray)v;
len = ja.length();
for (i = 0; i < len; i += 1) {
v = ja.get(i);
if (v instanceof JSONArray) {
b.append('<');
b.append(k);
b.append('>');
b.append(toString(v));
b.append("</");
b.append(k);
b.append('>');
} else {
b.append(toString(v, k));
}
}
} else if (v.equals("")) {
b.append('<');
b.append(k);
b.append("/>");
// Emit a new tag <k>
} else {
b.append(toString(v, k));
}
}
if (tagName != null) {
// Emit the </tagname> close tag
b.append("</");
b.append(tagName);
b.append('>');
}
return b.toString();
// XML does not have good support for arrays. If an array appears in a place
// where XML is lacking, synthesize an <array> element.
} else if (o instanceof JSONArray) {
ja = (JSONArray)o;
len = ja.length();
for (i = 0; i < len; ++i) {
v = ja.opt(i);
b.append(toString(v, (tagName == null) ? "array" : tagName));
}
return b.toString();
} else {
s = (o == null) ? "null" : escape(o.toString());
return (tagName == null) ? "\"" + s + "\"" :
(s.length() == 0) ? "<" + tagName + "/>" :
"<" + tagName + ">" + s + "</" + tagName + ">";
}
}
} | jongos/Question_Box_Desktop | Json/src/org/com/json/XML.java | Java | lgpl-3.0 | 14,112 |
ALTER TABLE [dbo].[StockTechnicalIndicators] WITH CHECK ADD CONSTRAINT [FK_StockTechnicalIndicators_Stock] FOREIGN KEY([StockNo])
REFERENCES [dbo].[Stock] ([StockNo])
GO
ALTER TABLE [dbo].[StockTechnicalIndicators] CHECK CONSTRAINT [FK_StockTechnicalIndicators_Stock]
GO
| flight-tom/StockCrawler | database/MSSQL/30_foreign_keys/StockTechnicalIndicators.FK.sql | SQL | lgpl-3.0 | 274 |
package com.silicolife.textmining.processes.ie.ner.nerlexicalresources;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.silicolife.textmining.core.datastructures.documents.AnnotatedDocumentImpl;
import com.silicolife.textmining.core.datastructures.exceptions.process.InvalidConfigurationException;
import com.silicolife.textmining.core.datastructures.init.InitConfiguration;
import com.silicolife.textmining.core.datastructures.process.ProcessOriginImpl;
import com.silicolife.textmining.core.datastructures.report.processes.NERProcessReportImpl;
import com.silicolife.textmining.core.datastructures.utils.GenerateRandomId;
import com.silicolife.textmining.core.datastructures.utils.Utils;
import com.silicolife.textmining.core.datastructures.utils.conf.GlobalOptions;
import com.silicolife.textmining.core.datastructures.utils.conf.OtherConfigurations;
import com.silicolife.textmining.core.datastructures.utils.multithearding.IParallelJob;
import com.silicolife.textmining.core.interfaces.core.dataaccess.exception.ANoteException;
import com.silicolife.textmining.core.interfaces.core.document.IAnnotatedDocument;
import com.silicolife.textmining.core.interfaces.core.document.IPublication;
import com.silicolife.textmining.core.interfaces.core.document.corpus.ICorpus;
import com.silicolife.textmining.core.interfaces.core.report.processes.INERProcessReport;
import com.silicolife.textmining.core.interfaces.process.IProcessOrigin;
import com.silicolife.textmining.core.interfaces.process.IE.IIEProcess;
import com.silicolife.textmining.core.interfaces.process.IE.INERProcess;
import com.silicolife.textmining.core.interfaces.process.IE.ner.INERConfiguration;
import com.silicolife.textmining.processes.ie.ner.nerlexicalresources.configuration.INERLexicalResourcesConfiguration;
import com.silicolife.textmining.processes.ie.ner.nerlexicalresources.configuration.INERLexicalResourcesPreProcessingModel;
import com.silicolife.textmining.processes.ie.ner.nerlexicalresources.configuration.NERLexicalResourcesPreProssecingEnum;
import com.silicolife.textmining.processes.ie.ner.nerlexicalresources.multithreading.NERParallelStep;
import com.silicolife.textmining.processes.ie.ner.nerlexicalresources.preprocessingmodel.NERPreprocessingFactory;
public class NERLexicalResources implements INERProcess{
public static String nerlexicalresourcesTagger = "NER Lexical Resources Tagger";
public static final IProcessOrigin nerlexicalresourcesOrigin= new ProcessOriginImpl(GenerateRandomId.generateID(),nerlexicalresourcesTagger);
private boolean stop = false;
private ExecutorService executor;
public NERLexicalResources() {
}
public INERProcessReport executeCorpusNER(INERConfiguration configuration) throws ANoteException, InvalidConfigurationException {
validateConfiguration(configuration);
INERLexicalResourcesConfiguration lexicalResurcesConfiguration = (INERLexicalResourcesConfiguration) configuration;
NERLexicalResourcesPreProssecingEnum preprocessing = lexicalResurcesConfiguration.getPreProcessingOption();
INERLexicalResourcesPreProcessingModel model = NERPreprocessingFactory.build(lexicalResurcesConfiguration,preprocessing);
IIEProcess processToRun = getIEProcess(lexicalResurcesConfiguration,model);
// creates the thread executor that in each thread executes the ner for a document
executor = Executors.newFixedThreadPool(OtherConfigurations.getThreadsNumber());
InitConfiguration.getDataAccess().createIEProcess(processToRun);
InitConfiguration.getDataAccess().registerCorpusProcess(configuration.getCorpus(), processToRun);
NERProcessReportImpl report = new NERProcessReportImpl(nerlexicalresourcesTagger,processToRun);
stop = false;
if(!stop)
{
processingParallelNER(report,lexicalResurcesConfiguration,processToRun,model);
}
else
{
report.setFinishing(false);
}
return report;
}
private IIEProcess getIEProcess(INERLexicalResourcesConfiguration lexicalResurcesConfiguration,INERLexicalResourcesPreProcessingModel model) {
String description = NERLexicalResources.nerlexicalresourcesTagger + " " +Utils.SimpleDataFormat.format(new Date());
Properties properties = model.getProperties(lexicalResurcesConfiguration);
IIEProcess processToRun = lexicalResurcesConfiguration.getIEProcess();
processToRun.setName(description);
processToRun.setProperties(properties);
if(processToRun.getCorpus() == null)
processToRun.setCorpus(lexicalResurcesConfiguration.getCorpus());
return processToRun;
}
private void processingParallelNER(NERProcessReportImpl report,INERLexicalResourcesConfiguration configuration,IIEProcess process,INERLexicalResourcesPreProcessingModel model) throws ANoteException {
int size = process.getCorpus().getCorpusStatistics().getDocumentNumber();
long startTime = Calendar.getInstance().getTimeInMillis();
long actualTime,differTime;
int i=0;
Collection<IPublication> docs = process.getCorpus().getArticlesCorpus().getAllDocuments().values();
List<IParallelJob<Integer>> jobs = new ArrayList<>();
for(IPublication pub:docs)
{
if(!stop)
{
List<Long> classIdCaseSensative = new ArrayList<Long>();
IAnnotatedDocument annotDoc = new AnnotatedDocumentImpl(pub,process, process.getCorpus());
String text = annotDoc.getDocumentAnnotationText();
if(text==null)
{
// Logger logger = Logger.getLogger(Workbench.class.getName());
// logger.warn("The article whit id: "+pub.getId()+"not contains abstract ");
System.err.println("The article whit id: "+pub.getId()+"not contains abstract ");
}
else
{
jobs.add(executeNER(process.getCorpus(), executor,classIdCaseSensative, annotDoc, text,configuration,model,process));
}
report.incrementDocument();
}
else
{
report.setFinishing(false);
break;
}
}
startTime = Calendar.getInstance().getTimeInMillis();
executor.shutdown();
// loop to give the progress bar of jobs
while(!jobs.isEmpty() && !stop){
actualTime = Calendar.getInstance().getTimeInMillis();
differTime = actualTime - startTime;
Iterator<IParallelJob<Integer>> itjobs = jobs.iterator();
while(itjobs.hasNext() && !stop){
IParallelJob<Integer> job = itjobs.next();
if(job.isFinished()){
report.incrementEntitiesAnnotated(job.getResultJob());
itjobs.remove();
}
}
if(differTime > 10000 * i) {
int step = size-jobs.size();
memoryAndProgressAndTime(step, size, startTime);
i++;
}
}
//in case of stop, that will kill the running jobs
if(stop){
for(IParallelJob<Integer> job : jobs)
job.kill();
}
try {
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
} catch (InterruptedException e) {
throw new ANoteException(e);
}
actualTime = Calendar.getInstance().getTimeInMillis();
report.setTime(actualTime-startTime);
}
@JsonIgnore
protected void memoryAndProgress(int step, int total) {
System.out.println((GlobalOptions.decimalformat.format((double) step / (double) total * 100)) + " %...");
// System.gc();
// System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024) + " MB ");
}
@JsonIgnore
protected void memoryAndProgressAndTime(int step, int total, long startTime) {
System.out.println((GlobalOptions.decimalformat.format((double) step / (double) total * 100)) + " %...");
// System.gc();
// System.out.println((Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / (1024 * 1024) + " MB ");
}
private IParallelJob<Integer> executeNER(ICorpus corpus,ExecutorService executor,List<Long> classIdCaseSensative,IAnnotatedDocument annotDoc,String text,INERLexicalResourcesConfiguration confguration,INERLexicalResourcesPreProcessingModel nerpreprocessingmodel,IIEProcess process) {
IParallelJob<Integer> job = new NERParallelStep(nerpreprocessingmodel,annotDoc, process, corpus, text, classIdCaseSensative,confguration.getCaseSensitive(),confguration.isNormalized());
executor.submit(job);
return job;
}
public void stop() {
stop = true;
//removes the jobs from executor and attempts to interrput the threads
executor.shutdownNow();
}
@Override
public void validateConfiguration(INERConfiguration configuration)throws InvalidConfigurationException {
if(configuration instanceof INERLexicalResourcesConfiguration)
{
INERLexicalResourcesConfiguration lexicalResurcesConfiguration = (INERLexicalResourcesConfiguration) configuration;
if(lexicalResurcesConfiguration.getCorpus()==null)
{
throw new InvalidConfigurationException("Corpus can not be null");
}
}
else
throw new InvalidConfigurationException("configuration must be INERLexicalResourcesConfiguration isntance");
}
}
| biotextmining/processes | src/main/java/com/silicolife/textmining/processes/ie/ner/nerlexicalresources/NERLexicalResources.java | Java | lgpl-3.0 | 9,063 |
/*!
* angular-datatables - v0.4.1
* https://github.com/l-lin/angular-datatables
* License: MIT
*/
!function(a,b,c,d){"use strict";function e(a,b){function c(a){function c(a,c){function e(a){var c="T";return h.dom=h.dom?h.dom:b.dom,-1===h.dom.indexOf(c)&&(h.dom=c+h.dom),h.hasTableTools=!0,d.isString(a)&&h.withTableToolsOption("sSwfPath",a),h}function f(a,b){return d.isString(a)&&(h.oTableTools=h.oTableTools&&null!==h.oTableTools?h.oTableTools:{},h.oTableTools[a]=b),h}function g(a){return d.isArray(a)&&h.withTableToolsOption("aButtons",a),h}var h=a(c);return h.withTableTools=e,h.withTableToolsOption=f,h.withTableToolsButtons=g,h}var e=a.newOptions,f=a.fromSource,g=a.fromFnPromise;return a.newOptions=function(){return c(e)},a.fromSource=function(a){return c(f,a)},a.fromFnPromise=function(a){return c(g,a)},a}a.decorator("DTOptionsBuilder",c),c.$inject=["$delegate"]}d.module("datatables.tabletools",["datatables"]).config(e),e.$inject=["$provide","DT_DEFAULT_OPTIONS"]}(window,document,jQuery,angular); | Shohiek/weblims | assets/bower_components/angular-datatables/dist/plugins/tabletools/angular-datatables.tabletools.min.js | JavaScript | lgpl-3.0 | 1,014 |
# Copyright (c) 2013 - The pycangjie authors
#
# This file is part of pycangjie, the Python bindings to libcangjie.
#
# pycangjie is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# pycangjie 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 pycangjie. If not, see <http://www.gnu.org/licenses/>.
import itertools
import operator
import string
import subprocess
import unittest
import cangjie
class MetaTest(type):
"""Metaclass for our test cases
The goal is to provide every TestCase class with methods like test_a(),
test_b(), etc..., in other words, one method per potential Cangjie input
code.
Well, not quite, because that would be 12356630 methods (the number of
strings composed of 1 to 5 lowercase ascii letters), and even though my
laptop has 8Go of RAM, the test process gets killed by the OOM killer. :)
So we cheat, and use libcangjie's wildcard support, so that we only
generate 26 + 26^2 = 702 methods.
"""
def __init__(cls, name, bases, dct):
super(MetaTest, cls).__init__(name, bases, dct)
def gen_codes():
"""Generate the 702 possible input codes"""
# First, the 1-character codes
for c in string.ascii_lowercase:
yield c
# Next, the 2-characters-with-wildcard codes
for t in itertools.product(string.ascii_lowercase, repeat=2):
yield '*'.join(t)
def tester(code):
def func(cls):
return cls.run_test(code)
return func
# Generate the test_* methods
for code in gen_codes():
setattr(cls, "test_%s" % code.replace("*", ""), tester(code))
class BaseTestCase(unittest.TestCase):
"""Base test class, grouping the common stuff for all our unit tests"""
def __init__(self, name):
super().__init__(name)
self.cli_cmd = ["/usr/bin/libcangjie_cli"] + self.cli_options
self.language = (cangjie.filters.BIG5 | cangjie.filters.HKSCS |
cangjie.filters.PUNCTUATION |
cangjie.filters.CHINESE |
cangjie.filters.ZHUYIN | cangjie.filters.KANJI |
cangjie.filters.KATAKANA |
cangjie.filters.HIRAGANA |
cangjie.filters.SYMBOLS)
def setUp(self):
self.cj = cangjie.Cangjie(self.version, self.language)
def tearDown(self):
del self.cj
def run_command(self, cmd):
"""Run a command, deal with errors, and return its stdout"""
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = proc.communicate()
try:
cangjie.errors.handle_error_code(proc.returncode,
msg="Unknown error while running"
" libcangjie_cli (%d)"
% proc.returncode)
except cangjie.errors.CangjieNoCharsError:
return ""
try:
return out.decode("utf-8")
except UnicodeDecodeError:
# Python's 'utf-8' codec trips over b"\xed\xa1\x9d\xed\xbc\xb2",
# but according to [1] and [2], it is a valid sequence of 2 chars:
# U+D85D \xed\xa1\x9d
# U+DF32 \xed\xbc\xb2
# [1] http://www.utf8-chartable.de/unicode-utf8-table.pl?start=55389&utf8=string-literal
# [2] http://www.utf8-chartable.de/unicode-utf8-table.pl?start=57138&utf8=string-literal
# TODO: Investigate this further, and eventually open a bug report
out2 = []
for line in out.split("\n".encode("utf-8")):
try:
out2.append(line.decode("utf-8"))
except UnicodeDecodeError:
pass
return "\n".join(out2)
def run_test(self, input_code):
"""Run the actual test
This compares the output of the libcangjie_cli tool with the output
from pycangjie.
The idea is that if pycangjie produces the same results as a C++ tool
compiled against libcangjie, then pycangjie properly wraps libcangjie.
We do not try to verify that pycangjie produces valid results here,
validity is to be checked in libcangjie.
Note that this whole test is based on scraping the output of
libcangjie_cli, which is quite fragile.
"""
# Get a list of CangjieChar from libcangjie_cli as a reference
tmp_expected = self.run_command(self.cli_cmd+[input_code]).split("\n")
tmp_expected = map(lambda x: x.strip(" \n"), tmp_expected)
tmp_expected = filter(lambda x: len(x) > 0, tmp_expected)
expected = []
for item in tmp_expected:
chchar, simpchar, code, frequency = item.split(", ")
chchar = chchar.split(": ")[-1].strip("'")
simpchar = simpchar.split(": ")[-1].strip("'")
code = code.split(": ")[-1].strip("'")
frequency = int(frequency.split(" ")[-1])
expected.append(cangjie._core.CangjieChar(chchar.encode("utf-8"),
simpchar.encode("utf-8"),
code.encode("utf-8"),
frequency))
expected = sorted(expected, key=operator.attrgetter('chchar', 'code'))
try:
# And compare with what pycangjie produces
results = sorted(self.cj.get_characters(input_code),
key=operator.attrgetter('chchar', 'code'))
self.assertEqual(results, expected)
except cangjie.errors.CangjieNoCharsError:
self.assertEqual(len(expected), 0)
| Cangjians/pycangjie | tests/__init__.py | Python | lgpl-3.0 | 6,379 |
/*#include "StdAfx.h"*/
#include "Sqlite3Ex.h"
#include <string.h>
Sqlite3Ex::Sqlite3Ex(void) :m_pSqlite(NULL)
{
memset(m_szErrMsg, 0x00, ERRMSG_LENGTH);
}
Sqlite3Ex::~Sqlite3Ex(void)
{
}
bool Sqlite3Ex::Open(const wchar_t* szDbPath)
{
int nRet = sqlite3_open16(szDbPath, &m_pSqlite);
if (SQLITE_OK != nRet)
{
SetErrMsg(sqlite3_errmsg(m_pSqlite));
return false;
}
return true;
}
bool Sqlite3Ex::Close()
{
bool bRet = false;
if (SQLITE_OK == sqlite3_close(m_pSqlite))
{
bRet = true;
m_pSqlite = NULL;
}
return bRet;
}
bool Sqlite3Ex::CreateTable(const char* szTableName, int nColNum, Sqlite3ExColumnAttrib emColAttrib, ...)
{
if (NULL == szTableName || 0 == strlen(szTableName) || 0 >= nColNum)
{
SetErrMsg("Parameter is invalid.");
return false;
}
std::string strSql("CREATE TABLE ");
strSql += szTableName;
strSql += "(";
va_list ap;
va_start(ap, nColNum);
char szTmp[SQLITE3EX_COLSTRFORPARAM_LEN];
for (int i = 0; i != nColNum; ++i)
{
::memset(szTmp, 0x00, SQLITE3EX_COLSTRFORPARAM_LEN);
Sqlite3ExColumnAttrib & ta = va_arg(ap, Sqlite3ExColumnAttrib);
ta.GetStringForSQL(szTmp);
strSql += szTmp;
strSql += ",";
}
va_end(ap);
*(strSql.end() - 1) = ')';
return Sqlite3Ex_ExecuteNonQuery(strSql.c_str());
}
bool Sqlite3Ex::BegTransAction()
{
return Sqlite3Ex_ExecuteNonQuery("BEGIN TRANSACTION");
}
bool Sqlite3Ex::EndTransAction()
{
return Sqlite3Ex_ExecuteNonQuery("END TRANSACTION");
}
bool Sqlite3Ex::Sqlite3Ex_Exec(const char* szQuery, LPEXEC_CALLBACK callback, void* pFirstParam)
{
char* szErrMsg = NULL;
int nRet = sqlite3_exec(m_pSqlite, szQuery, callback, pFirstParam, &szErrMsg);
if (SQLITE_OK != nRet)
{
SetErrMsg(szErrMsg);
sqlite3_free(szErrMsg);
return false;
}
return true;
}
bool Sqlite3Ex::GetTableNames(std::vector<std::string> & vecTableNames)
{
char* szErrMsg = NULL;
char** pRetData = NULL;
int nRow, nCol;
int nRet = sqlite3_get_table(m_pSqlite,
"SELECT name FROM sqlite_master WHERE type='table'",
&pRetData, &nRow, &nCol, &szErrMsg);
if (SQLITE_OK != nRet)
{
SetErrMsg(szErrMsg);
sqlite3_free(szErrMsg);
return false;
}
vecTableNames.resize(nRow);
for (int i = 1; i <= nRow; ++i)
//i´Ó1¿ªÊ¼,ÒÔΪË÷Òý0´¦µÄ¹Ì¶¨ÖµÊÇ"name"
vecTableNames[i - 1] = pRetData[i];
sqlite3_free_table(pRetData);
return true;
}
//////////////////////////////////////////////////////////////////////////
int Sqlite3Ex::ExecuteReader_CallBack(void* pFirstParam, int iColNum, char** pRecordArr, char** pColNameArr)
{
if (iColNum <= 0)
return 0;
Sqlite3Ex_Reader* pReader = (Sqlite3Ex_Reader*)pFirstParam;
if (NULL == pReader)
return 0;
std::vector<std::string>* pVecLine = new std::vector<std::string>;
pVecLine->resize(iColNum);
for (int i = 0; i != iColNum; ++i)
(*pVecLine)[i] = pRecordArr[i];
pReader->m_vecResult.push_back(pVecLine);
return 0;
}
bool Sqlite3Ex::Sqlite3Ex_ExecuteReader(const char* szQuery, Sqlite3Ex_Reader* pReader)
{
char* szErrMsg = NULL;
if (SQLITE_OK == sqlite3_exec(m_pSqlite, szQuery, ExecuteReader_CallBack, (void*)pReader, &szErrMsg))
return true;
SetErrMsg(szErrMsg);
sqlite3_free(szErrMsg);
return false;
}
bool Sqlite3Ex::Sqlite3Ex_ExecuteNonQuery(const char* szQuery)
{
char* szErrMsg = NULL;
if (SQLITE_OK == sqlite3_exec(m_pSqlite, szQuery, NULL, NULL, &szErrMsg))
return true;
SetErrMsg(szErrMsg);
sqlite3_free(szErrMsg);
return false;
}
bool Sqlite3Ex::IsOpen()
{
if (!m_pSqlite)
return false;
return true;
}
//////////////////////////////////////////////////////////////////////////
| CUCKOO0615/CUCKOO0615_Utils | CUCKOO0615_Utils/Sqlite3Ex.cpp | C++ | lgpl-3.0 | 4,082 |
<?php
/**
* @license LGPLv3, http://opensource.org/licenses/LGPL-3.0
* @copyright Aimeos (aimeos.org), 2018-2022
*/
namespace Aimeos\Admin\JQAdm\Type\Media\Property;
class StandardTest extends \PHPUnit\Framework\TestCase
{
private $context;
private $object;
private $view;
protected function setUp() : void
{
$this->view = \TestHelper::view();
$this->context = \TestHelper::context();
$this->object = new \Aimeos\Admin\JQAdm\Type\Media\Property\Standard( $this->context );
$this->object = new \Aimeos\Admin\JQAdm\Common\Decorator\Page( $this->object, $this->context );
$this->object->setAimeos( \TestHelper::getAimeos() );
$this->object->setView( $this->view );
}
protected function tearDown() : void
{
unset( $this->object, $this->view, $this->context );
}
public function testCreate()
{
$result = $this->object->create();
$this->assertStringContainsString( 'media/property', $result );
$this->assertEmpty( $this->view->get( 'errors' ) );
}
public function testCreateException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'getSubClients' ) )
->getMock();
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->create();
}
public function testCopy()
{
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = ['type' => 'unittest', 'id' => $manager->find( 'size', [], 'media' )->getId()];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->copy();
$this->assertStringContainsString( 'size', $result );
}
public function testCopyException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'getSubClients' ) )
->getMock();
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->copy();
}
public function testDelete()
{
$this->assertNull( $this->getClientMock( ['redirect'], false )->delete() );
}
public function testDeleteException()
{
$object = $this->getClientMock( ['getSubClients', 'search'] );
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->expects( $this->once() )->method( 'search' );
$object->delete();
}
public function testGet()
{
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = ['type' => 'unittest', 'id' => $manager->find( 'size', [], 'media' )->getId()];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->get();
$this->assertStringContainsString( 'size', $result );
}
public function testGetException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'getSubClients' ) )
->getMock();
$object->expects( $this->once() )->method( 'getSubClients' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->get();
}
public function testSave()
{
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = array(
'type' => 'unittest',
'item' => array(
'media.property.type.id' => '',
'media.property.type.status' => '1',
'media.property.type.domain' => 'product',
'media.property.type.code' => 'jqadm@test',
'media.property.type.label' => 'jqadm test',
),
);
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->save();
$manager->delete( $manager->find( 'jqadm@test', [], 'product' )->getId() );
$this->assertEmpty( $this->view->get( 'errors' ) );
$this->assertNull( $result );
}
public function testSaveException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'fromArray' ) )
->getMock();
$object->expects( $this->once() )->method( 'fromArray' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->save();
}
public function testSearch()
{
$param = array(
'type' => 'unittest', 'locale' => 'de',
'filter' => array(
'key' => array( 0 => 'media.property.type.code' ),
'op' => array( 0 => '==' ),
'val' => array( 0 => 'size' ),
),
'sort' => array( '-media.property.type.id' ),
);
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $this->view, $param );
$this->view->addHelper( 'param', $helper );
$result = $this->object->search();
$this->assertStringContainsString( '>size<', $result );
}
public function testSearchException()
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( array( 'initCriteria' ) )
->getMock();
$object->expects( $this->once() )->method( 'initCriteria' )
->will( $this->throwException( new \RuntimeException() ) );
$object->setView( $this->getViewNoRender() );
$object->search();
}
public function testGetSubClientInvalid()
{
$this->expectException( \Aimeos\Admin\JQAdm\Exception::class );
$this->object->getSubClient( '$unknown$' );
}
public function testGetSubClientUnknown()
{
$this->expectException( \Aimeos\Admin\JQAdm\Exception::class );
$this->object->getSubClient( 'unknown' );
}
public function getClientMock( $methods, $real = true )
{
$object = $this->getMockBuilder( \Aimeos\Admin\JQAdm\Type\Media\Property\Standard::class )
->setConstructorArgs( array( $this->context, \TestHelper::getTemplatePaths() ) )
->setMethods( (array) $methods )
->getMock();
$object->setAimeos( \TestHelper::getAimeos() );
$object->setView( $this->getViewNoRender( $real ) );
return $object;
}
protected function getViewNoRender( $real = true )
{
$view = $this->getMockBuilder( \Aimeos\MW\View\Standard::class )
->setConstructorArgs( array( [] ) )
->setMethods( array( 'render' ) )
->getMock();
$manager = \Aimeos\MShop::create( $this->context, 'media/property/type' );
$param = ['site' => 'unittest', 'id' => $real ? $manager->find( 'size', [], 'media' )->getId() : -1];
$helper = new \Aimeos\MW\View\Helper\Param\Standard( $view, $param );
$view->addHelper( 'param', $helper );
$helper = new \Aimeos\MW\View\Helper\Config\Standard( $view, $this->context->config() );
$view->addHelper( 'config', $helper );
$helper = new \Aimeos\MW\View\Helper\Access\Standard( $view, [] );
$view->addHelper( 'access', $helper );
return $view;
}
}
| aimeos/ai-admin-jqadm | tests/Admin/JQAdm/Type/Media/Property/StandardTest.php | PHP | lgpl-3.0 | 7,433 |
#############################################################################
# Makefile for building: animatedtiles.app/Contents/MacOS/animatedtiles
# Generated by qmake (2.01a) (Qt 4.7.4) on: ? 4? 16 23:07:08 2015
# Project: animatedtiles.pro
# Template: app
# Command: /Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/bin/qmake -spec ../../../mkspecs/macx-g++ -o Makefile animatedtiles.pro
#############################################################################
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_HAVE_SSE3 -DQT_HAVE_SSSE3 -DQT_HAVE_SSE4_1 -DQT_HAVE_SSE4_2 -DQT_HAVE_AVX -DQT_SHARED
CFLAGS = -pipe -Xarch_x86_64 -mmacosx-version-min=10.5 -g -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W $(DEFINES)
CXXFLAGS = -pipe -Xarch_x86_64 -mmacosx-version-min=10.5 -g -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Wall -W $(DEFINES)
INCPATH = -I../../../mkspecs/macx-g++ -I. -I../../../include/QtCore -I../../../include/QtGui -I../../../include -I.moc/debug-shared -F/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib
LINK = g++
LFLAGS = -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 -Xarch_x86_64 -mmacosx-version-min=10.5
LIBS = $(SUBLIBS) -F/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib -L/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib -framework QtGui -L/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib -F/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib -framework QtCore
AR = ar cq
RANLIB = ranlib -s
QMAKE = /Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = cp -f
COPY_DIR = cp -f -R
STRIP =
INSTALL_FILE = $(COPY_FILE)
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = $(COPY_FILE)
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
export MACOSX_DEPLOYMENT_TARGET = 10.5
####### Output directory
OBJECTS_DIR = .obj/debug-shared/
####### Files
SOURCES = main.cpp .rcc/debug-shared/qrc_animatedtiles.cpp
OBJECTS = .obj/debug-shared/main.o \
.obj/debug-shared/qrc_animatedtiles.o
DIST = ../../../mkspecs/common/unix.conf \
../../../mkspecs/common/mac.conf \
../../../mkspecs/common/mac-g++.conf \
../../../mkspecs/features/exclusive_builds.prf \
../../../mkspecs/features/default_pre.prf \
../../../mkspecs/features/mac/default_pre.prf \
../../../.qmake.cache \
../../../mkspecs/qconfig.pri \
../../../mkspecs/modules/qt_webkit_version.pri \
../../../mkspecs/features/qt_functions.prf \
../../../mkspecs/features/qt_config.prf \
../../../mkspecs/features/debug.prf \
../../../mkspecs/features/default_post.prf \
../../../mkspecs/features/mac/default_post.prf \
../../../mkspecs/features/mac/x86_64.prf \
../../../mkspecs/features/mac/objective_c.prf \
../../../mkspecs/features/unix/dylib.prf \
../../../mkspecs/features/unix/largefile.prf \
../../../mkspecs/features/dll.prf \
../../../mkspecs/features/shared.prf \
../../../mkspecs/features/warn_on.prf \
../../../mkspecs/features/qt.prf \
../../../mkspecs/features/unix/thread.prf \
../../../mkspecs/features/moc.prf \
../../../mkspecs/features/mac/rez.prf \
../../../mkspecs/features/mac/sdk.prf \
../../../mkspecs/features/resources.prf \
../../../mkspecs/features/uic.prf \
../../../mkspecs/features/yacc.prf \
../../../mkspecs/features/lex.prf \
animatedtiles.pro
QMAKE_TARGET = animatedtiles
DESTDIR =
TARGET = animatedtiles.app/Contents/MacOS/animatedtiles
####### Custom Compiler Variables
QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS = -pipe \
-Xarch_x86_64 \
-mmacosx-version-min=10.5 \
-g \
-arch \
x86_64 \
-Xarch_x86_64 \
-mmacosx-version-min=10.5 \
-Wall \
-W
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
all: Makefile animatedtiles.app/Contents/PkgInfo animatedtiles.app/Contents/Resources/empty.lproj animatedtiles.app/Contents/Info.plist $(TARGET)
$(TARGET): $(OBJECTS)
@$(CHK_DIR_EXISTS) animatedtiles.app/Contents/MacOS/ || $(MKDIR) animatedtiles.app/Contents/MacOS/
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: animatedtiles.pro ../../../.qmake.cache ../../../mkspecs/macx-g++/qmake.conf ../../../mkspecs/common/unix.conf \
../../../mkspecs/common/mac.conf \
../../../mkspecs/common/mac-g++.conf \
../../../mkspecs/features/exclusive_builds.prf \
../../../mkspecs/features/default_pre.prf \
../../../mkspecs/features/mac/default_pre.prf \
../../../.qmake.cache \
../../../mkspecs/qconfig.pri \
../../../mkspecs/modules/qt_webkit_version.pri \
../../../mkspecs/features/qt_functions.prf \
../../../mkspecs/features/qt_config.prf \
../../../mkspecs/features/debug.prf \
../../../mkspecs/features/default_post.prf \
../../../mkspecs/features/mac/default_post.prf \
../../../mkspecs/features/mac/x86_64.prf \
../../../mkspecs/features/mac/objective_c.prf \
../../../mkspecs/features/unix/dylib.prf \
../../../mkspecs/features/unix/largefile.prf \
../../../mkspecs/features/dll.prf \
../../../mkspecs/features/shared.prf \
../../../mkspecs/features/warn_on.prf \
../../../mkspecs/features/qt.prf \
../../../mkspecs/features/unix/thread.prf \
../../../mkspecs/features/moc.prf \
../../../mkspecs/features/mac/rez.prf \
../../../mkspecs/features/mac/sdk.prf \
../../../mkspecs/features/resources.prf \
../../../mkspecs/features/uic.prf \
../../../mkspecs/features/yacc.prf \
../../../mkspecs/features/lex.prf \
/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib/QtGui.framework/QtGui.prl \
/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib/QtCore.framework/QtCore.prl
$(QMAKE) -spec ../../../mkspecs/macx-g++ -o Makefile animatedtiles.pro
../../../mkspecs/common/unix.conf:
../../../mkspecs/common/mac.conf:
../../../mkspecs/common/mac-g++.conf:
../../../mkspecs/features/exclusive_builds.prf:
../../../mkspecs/features/default_pre.prf:
../../../mkspecs/features/mac/default_pre.prf:
../../../.qmake.cache:
../../../mkspecs/qconfig.pri:
../../../mkspecs/modules/qt_webkit_version.pri:
../../../mkspecs/features/qt_functions.prf:
../../../mkspecs/features/qt_config.prf:
../../../mkspecs/features/debug.prf:
../../../mkspecs/features/default_post.prf:
../../../mkspecs/features/mac/default_post.prf:
../../../mkspecs/features/mac/x86_64.prf:
../../../mkspecs/features/mac/objective_c.prf:
../../../mkspecs/features/unix/dylib.prf:
../../../mkspecs/features/unix/largefile.prf:
../../../mkspecs/features/dll.prf:
../../../mkspecs/features/shared.prf:
../../../mkspecs/features/warn_on.prf:
../../../mkspecs/features/qt.prf:
../../../mkspecs/features/unix/thread.prf:
../../../mkspecs/features/moc.prf:
../../../mkspecs/features/mac/rez.prf:
../../../mkspecs/features/mac/sdk.prf:
../../../mkspecs/features/resources.prf:
../../../mkspecs/features/uic.prf:
../../../mkspecs/features/yacc.prf:
../../../mkspecs/features/lex.prf:
/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib/QtGui.framework/QtGui.prl:
/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/lib/QtCore.framework/QtCore.prl:
qmake: FORCE
@$(QMAKE) -spec ../../../mkspecs/macx-g++ -o Makefile animatedtiles.pro
animatedtiles.app/Contents/PkgInfo:
@$(CHK_DIR_EXISTS) animatedtiles.app/Contents || $(MKDIR) animatedtiles.app/Contents
@$(DEL_FILE) animatedtiles.app/Contents/PkgInfo
@echo "APPL????" >animatedtiles.app/Contents/PkgInfo
animatedtiles.app/Contents/Resources/empty.lproj:
@$(CHK_DIR_EXISTS) animatedtiles.app/Contents/Resources || $(MKDIR) animatedtiles.app/Contents/Resources
@touch animatedtiles.app/Contents/Resources/empty.lproj
animatedtiles.app/Contents/Info.plist:
@$(CHK_DIR_EXISTS) animatedtiles.app/Contents || $(MKDIR) animatedtiles.app/Contents
@$(DEL_FILE) animatedtiles.app/Contents/Info.plist
@sed -e "s,@ICON@,,g" -e "s,@EXECUTABLE@,animatedtiles,g" -e "s,@TYPEINFO@,????,g" ../../../mkspecs/macx-g++/Info.plist.app >animatedtiles.app/Contents/Info.plist
dist:
@$(CHK_DIR_EXISTS) .obj/debug-shared/animatedtiles1.0.0 || $(MKDIR) .obj/debug-shared/animatedtiles1.0.0
$(COPY_FILE) --parents $(SOURCES) $(DIST) .obj/debug-shared/animatedtiles1.0.0/ && $(COPY_FILE) --parents animatedtiles.qrc .obj/debug-shared/animatedtiles1.0.0/ && $(COPY_FILE) --parents main.cpp .obj/debug-shared/animatedtiles1.0.0/ && (cd `dirname .obj/debug-shared/animatedtiles1.0.0` && $(TAR) animatedtiles1.0.0.tar animatedtiles1.0.0 && $(COMPRESS) animatedtiles1.0.0.tar) && $(MOVE) `dirname .obj/debug-shared/animatedtiles1.0.0`/animatedtiles1.0.0.tar.gz . && $(DEL_FILE) -r .obj/debug-shared/animatedtiles1.0.0
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
####### Sub-libraries
distclean: clean
-$(DEL_FILE) -r animatedtiles.app
-$(DEL_FILE) Makefile
check: first
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
compiler_objective_c_make_all:
compiler_objective_c_clean:
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_rcc_make_all: .rcc/debug-shared/qrc_animatedtiles.cpp
compiler_rcc_clean:
-$(DEL_FILE) .rcc/debug-shared/qrc_animatedtiles.cpp
.rcc/debug-shared/qrc_animatedtiles.cpp: animatedtiles.qrc
/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/bin/rcc -name animatedtiles animatedtiles.qrc -o .rcc/debug-shared/qrc_animatedtiles.cpp
compiler_image_collection_make_all: .uic/debug-shared/qmake_image_collection.cpp
compiler_image_collection_clean:
-$(DEL_FILE) .uic/debug-shared/qmake_image_collection.cpp
compiler_moc_source_make_all: .moc/debug-shared/main.moc
compiler_moc_source_clean:
-$(DEL_FILE) .moc/debug-shared/main.moc
.moc/debug-shared/main.moc: ../../../include/QtGui/QtGui \
../../../include/QtCore/QtCore \
../../../include/QtCore/qxmlstream.h \
../../../src/corelib/xml/qxmlstream.h \
../../../include/QtCore/qiodevice.h \
../../../src/corelib/io/qiodevice.h \
../../../include/QtCore/qobject.h \
../../../src/corelib/kernel/qobject.h \
../../../include/QtCore/qobjectdefs.h \
../../../src/corelib/kernel/qobjectdefs.h \
../../../include/QtCore/qnamespace.h \
../../../src/corelib/global/qnamespace.h \
../../../include/QtCore/qglobal.h \
../../../src/corelib/global/qglobal.h \
../../../include/QtCore/qconfig.h \
../../../src/corelib/global/qconfig.h \
../../../include/QtCore/qfeatures.h \
../../../src/corelib/global/qfeatures.h \
../../../include/QtCore/qstring.h \
../../../src/corelib/tools/qstring.h \
../../../include/QtCore/qchar.h \
../../../src/corelib/tools/qchar.h \
../../../include/QtCore/qbytearray.h \
../../../src/corelib/tools/qbytearray.h \
../../../include/QtCore/qatomic.h \
../../../src/corelib/thread/qatomic.h \
../../../include/QtCore/qbasicatomic.h \
../../../src/corelib/thread/qbasicatomic.h \
../../../include/QtCore/qatomic_bootstrap.h \
../../../src/corelib/arch/qatomic_bootstrap.h \
../../../include/QtCore/qatomic_arch.h \
../../../src/corelib/arch/qatomic_arch.h \
../../../include/QtCore/qatomic_vxworks.h \
../../../src/corelib/arch/qatomic_vxworks.h \
../../../include/QtCore/qatomic_powerpc.h \
../../../src/corelib/arch/qatomic_powerpc.h \
../../../include/QtCore/qatomic_alpha.h \
../../../src/corelib/arch/qatomic_alpha.h \
../../../include/QtCore/qatomic_arm.h \
../../../src/corelib/arch/qatomic_arm.h \
../../../include/QtCore/qatomic_armv6.h \
../../../src/corelib/arch/qatomic_armv6.h \
../../../include/QtCore/qatomic_avr32.h \
../../../src/corelib/arch/qatomic_avr32.h \
../../../include/QtCore/qatomic_bfin.h \
../../../src/corelib/arch/qatomic_bfin.h \
../../../include/QtCore/qatomic_generic.h \
../../../src/corelib/arch/qatomic_generic.h \
../../../include/QtCore/qatomic_i386.h \
../../../src/corelib/arch/qatomic_i386.h \
../../../include/QtCore/qatomic_ia64.h \
../../../src/corelib/arch/qatomic_ia64.h \
../../../include/QtCore/qatomic_macosx.h \
../../../src/corelib/arch/qatomic_macosx.h \
../../../include/QtCore/qatomic_x86_64.h \
../../../src/corelib/arch/qatomic_x86_64.h \
../../../include/QtCore/qatomic_mips.h \
../../../src/corelib/arch/qatomic_mips.h \
../../../include/QtCore/qatomic_parisc.h \
../../../src/corelib/arch/qatomic_parisc.h \
../../../include/QtCore/qatomic_s390.h \
../../../src/corelib/arch/qatomic_s390.h \
../../../include/QtCore/qatomic_sparc.h \
../../../src/corelib/arch/qatomic_sparc.h \
../../../include/QtCore/qatomic_windows.h \
../../../src/corelib/arch/qatomic_windows.h \
../../../include/QtCore/qatomic_windowsce.h \
../../../src/corelib/arch/qatomic_windowsce.h \
../../../include/QtCore/qatomic_symbian.h \
../../../src/corelib/arch/qatomic_symbian.h \
../../../include/QtCore/qatomic_sh.h \
../../../src/corelib/arch/qatomic_sh.h \
../../../include/QtCore/qatomic_sh4a.h \
../../../src/corelib/arch/qatomic_sh4a.h \
../../../include/Qt3Support/q3cstring.h \
../../../src/qt3support/tools/q3cstring.h \
../../../include/QtCore/qstringbuilder.h \
../../../src/corelib/tools/qstringbuilder.h \
../../../include/QtCore/qmap.h \
../../../src/corelib/tools/qmap.h \
../../../include/QtCore/qiterator.h \
../../../src/corelib/tools/qiterator.h \
../../../include/QtCore/qlist.h \
../../../src/corelib/tools/qlist.h \
../../../include/QtCore/qalgorithms.h \
../../../src/corelib/tools/qalgorithms.h \
../../../include/QtCore/qcoreevent.h \
../../../src/corelib/kernel/qcoreevent.h \
../../../include/QtCore/qscopedpointer.h \
../../../src/corelib/tools/qscopedpointer.h \
../../../include/QtCore/qvector.h \
../../../src/corelib/tools/qvector.h \
../../../include/QtCore/QPointF \
../../../include/QtCore/qpoint.h \
../../../src/corelib/tools/qpoint.h \
../../../include/QtCore/QPoint \
../../../include/QtCore/qtextcodec.h \
../../../src/corelib/codecs/qtextcodec.h \
../../../include/QtCore/qtextcodecplugin.h \
../../../src/corelib/codecs/qtextcodecplugin.h \
../../../include/QtCore/qplugin.h \
../../../src/corelib/plugin/qplugin.h \
../../../include/QtCore/qpointer.h \
../../../src/corelib/kernel/qpointer.h \
../../../include/QtCore/qfactoryinterface.h \
../../../src/corelib/plugin/qfactoryinterface.h \
../../../include/QtCore/qstringlist.h \
../../../src/corelib/tools/qstringlist.h \
../../../include/QtCore/qdatastream.h \
../../../src/corelib/io/qdatastream.h \
../../../include/QtCore/qregexp.h \
../../../src/corelib/tools/qregexp.h \
../../../include/QtCore/qstringmatcher.h \
../../../src/corelib/tools/qstringmatcher.h \
../../../include/Qt3Support/q3valuelist.h \
../../../src/qt3support/tools/q3valuelist.h \
../../../include/QtCore/qlinkedlist.h \
../../../src/corelib/tools/qlinkedlist.h \
../../../include/QtCore/qabstracteventdispatcher.h \
../../../src/corelib/kernel/qabstracteventdispatcher.h \
../../../include/QtCore/qeventloop.h \
../../../src/corelib/kernel/qeventloop.h \
../../../include/QtCore/qabstractitemmodel.h \
../../../src/corelib/kernel/qabstractitemmodel.h \
../../../include/QtCore/qvariant.h \
../../../src/corelib/kernel/qvariant.h \
../../../include/QtCore/qmetatype.h \
../../../src/corelib/kernel/qmetatype.h \
../../../include/QtCore/qhash.h \
../../../src/corelib/tools/qhash.h \
../../../include/QtCore/qpair.h \
../../../src/corelib/tools/qpair.h \
../../../include/QtCore/qbasictimer.h \
../../../src/corelib/kernel/qbasictimer.h \
../../../include/QtCore/qcoreapplication.h \
../../../src/corelib/kernel/qcoreapplication.h \
../../../include/QtCore/qmath.h \
../../../src/corelib/kernel/qmath.h \
../../../include/QtCore/qmetaobject.h \
../../../src/corelib/kernel/qmetaobject.h \
../../../include/QtCore/qmimedata.h \
../../../src/corelib/kernel/qmimedata.h \
../../../include/QtCore/qobjectcleanuphandler.h \
../../../src/corelib/kernel/qobjectcleanuphandler.h \
../../../include/QtCore/qsharedmemory.h \
../../../src/corelib/kernel/qsharedmemory.h \
../../../include/QtCore/qsignalmapper.h \
../../../src/corelib/kernel/qsignalmapper.h \
../../../include/QtCore/qsocketnotifier.h \
../../../src/corelib/kernel/qsocketnotifier.h \
../../../include/QtCore/qsystemsemaphore.h \
../../../src/corelib/kernel/qsystemsemaphore.h \
../../../include/QtCore/qtimer.h \
../../../src/corelib/kernel/qtimer.h \
../../../include/QtCore/qtranslator.h \
../../../src/corelib/kernel/qtranslator.h \
../../../include/QtCore/qabstractanimation.h \
../../../src/corelib/animation/qabstractanimation.h \
../../../include/QtCore/qanimationgroup.h \
../../../src/corelib/animation/qanimationgroup.h \
../../../include/QtCore/qparallelanimationgroup.h \
../../../src/corelib/animation/qparallelanimationgroup.h \
../../../include/QtCore/qpauseanimation.h \
../../../src/corelib/animation/qpauseanimation.h \
../../../include/QtCore/qpropertyanimation.h \
../../../src/corelib/animation/qpropertyanimation.h \
../../../include/QtCore/qvariantanimation.h \
../../../src/corelib/animation/qvariantanimation.h \
../../../include/QtCore/qeasingcurve.h \
../../../src/corelib/tools/qeasingcurve.h \
../../../include/QtCore/qsequentialanimationgroup.h \
../../../src/corelib/animation/qsequentialanimationgroup.h \
../../../include/QtCore/qendian.h \
../../../src/corelib/global/qendian.h \
../../../include/QtCore/qlibraryinfo.h \
../../../src/corelib/global/qlibraryinfo.h \
../../../include/QtCore/QDate \
../../../include/QtCore/qdatetime.h \
../../../src/corelib/tools/qdatetime.h \
../../../include/QtCore/qsharedpointer.h \
../../../src/corelib/tools/qsharedpointer.h \
../../../include/QtCore/qshareddata.h \
../../../src/corelib/tools/qshareddata.h \
../../../include/QtCore/qsharedpointer_impl.h \
../../../src/corelib/tools/qsharedpointer_impl.h \
../../../include/QtCore/qnumeric.h \
../../../src/corelib/global/qnumeric.h \
../../../include/QtCore/qmutex.h \
../../../src/corelib/thread/qmutex.h \
../../../include/QtCore/qreadwritelock.h \
../../../src/corelib/thread/qreadwritelock.h \
../../../include/QtCore/qsemaphore.h \
../../../src/corelib/thread/qsemaphore.h \
../../../include/QtCore/qthread.h \
../../../src/corelib/thread/qthread.h \
../../../include/QtCore/qthreadstorage.h \
../../../src/corelib/thread/qthreadstorage.h \
../../../include/QtCore/qwaitcondition.h \
../../../src/corelib/thread/qwaitcondition.h \
../../../include/QtCore/qabstractstate.h \
../../../src/corelib/statemachine/qabstractstate.h \
../../../include/QtCore/qabstracttransition.h \
../../../src/corelib/statemachine/qabstracttransition.h \
../../../include/QtCore/qeventtransition.h \
../../../src/corelib/statemachine/qeventtransition.h \
../../../include/QtCore/qfinalstate.h \
../../../src/corelib/statemachine/qfinalstate.h \
../../../include/QtCore/qhistorystate.h \
../../../src/corelib/statemachine/qhistorystate.h \
../../../include/QtCore/qsignaltransition.h \
../../../src/corelib/statemachine/qsignaltransition.h \
../../../include/QtCore/qstate.h \
../../../src/corelib/statemachine/qstate.h \
../../../include/QtCore/qstatemachine.h \
../../../src/corelib/statemachine/qstatemachine.h \
../../../include/QtCore/qset.h \
../../../src/corelib/tools/qset.h \
../../../include/QtCore/qabstractfileengine.h \
../../../src/corelib/io/qabstractfileengine.h \
../../../include/QtCore/qdir.h \
../../../src/corelib/io/qdir.h \
../../../include/QtCore/qfileinfo.h \
../../../src/corelib/io/qfileinfo.h \
../../../include/QtCore/qfile.h \
../../../src/corelib/io/qfile.h \
../../../include/QtCore/qbuffer.h \
../../../src/corelib/io/qbuffer.h \
../../../include/QtCore/qdebug.h \
../../../src/corelib/io/qdebug.h \
../../../include/QtCore/qtextstream.h \
../../../src/corelib/io/qtextstream.h \
../../../include/QtCore/qlocale.h \
../../../src/corelib/tools/qlocale.h \
../../../include/QtCore/qcontiguouscache.h \
../../../src/corelib/tools/qcontiguouscache.h \
../../../include/QtCore/qdiriterator.h \
../../../src/corelib/io/qdiriterator.h \
../../../include/QtCore/qfilesystemwatcher.h \
../../../src/corelib/io/qfilesystemwatcher.h \
../../../include/QtCore/qfsfileengine.h \
../../../src/corelib/io/qfsfileengine.h \
../../../include/QtCore/qprocess.h \
../../../src/corelib/io/qprocess.h \
../../../include/QtCore/qresource.h \
../../../src/corelib/io/qresource.h \
../../../include/QtCore/qsettings.h \
../../../src/corelib/io/qsettings.h \
../../../include/QtCore/qtemporaryfile.h \
../../../src/corelib/io/qtemporaryfile.h \
../../../include/QtCore/qurl.h \
../../../src/corelib/io/qurl.h \
../../../include/QtCore/qfuture.h \
../../../src/corelib/concurrent/qfuture.h \
../../../include/QtCore/qfutureinterface.h \
../../../src/corelib/concurrent/qfutureinterface.h \
../../../include/QtCore/qrunnable.h \
../../../src/corelib/concurrent/qrunnable.h \
../../../include/QtCore/qtconcurrentexception.h \
../../../src/corelib/concurrent/qtconcurrentexception.h \
../../../include/QtCore/qtconcurrentresultstore.h \
../../../src/corelib/concurrent/qtconcurrentresultstore.h \
../../../include/QtCore/qtconcurrentcompilertest.h \
../../../src/corelib/concurrent/qtconcurrentcompilertest.h \
../../../include/QtCore/qfuturesynchronizer.h \
../../../src/corelib/concurrent/qfuturesynchronizer.h \
../../../include/QtCore/qfuturewatcher.h \
../../../src/corelib/concurrent/qfuturewatcher.h \
../../../include/QtCore/qtconcurrentfilter.h \
../../../src/corelib/concurrent/qtconcurrentfilter.h \
../../../include/QtCore/qtconcurrentfilterkernel.h \
../../../src/corelib/concurrent/qtconcurrentfilterkernel.h \
../../../include/QtCore/qtconcurrentiteratekernel.h \
../../../src/corelib/concurrent/qtconcurrentiteratekernel.h \
../../../include/QtCore/qtconcurrentmedian.h \
../../../src/corelib/concurrent/qtconcurrentmedian.h \
../../../include/QtCore/qtconcurrentthreadengine.h \
../../../src/corelib/concurrent/qtconcurrentthreadengine.h \
../../../include/QtCore/qthreadpool.h \
../../../src/corelib/concurrent/qthreadpool.h \
../../../include/QtCore/qtconcurrentmapkernel.h \
../../../src/corelib/concurrent/qtconcurrentmapkernel.h \
../../../include/QtCore/qtconcurrentreducekernel.h \
../../../src/corelib/concurrent/qtconcurrentreducekernel.h \
../../../include/QtCore/qtconcurrentfunctionwrappers.h \
../../../src/corelib/concurrent/qtconcurrentfunctionwrappers.h \
../../../include/QtCore/qtconcurrentmap.h \
../../../src/corelib/concurrent/qtconcurrentmap.h \
../../../include/QtCore/qtconcurrentrun.h \
../../../src/corelib/concurrent/qtconcurrentrun.h \
../../../include/QtCore/qtconcurrentrunbase.h \
../../../src/corelib/concurrent/qtconcurrentrunbase.h \
../../../include/QtCore/qtconcurrentstoredfunctioncall.h \
../../../src/corelib/concurrent/qtconcurrentstoredfunctioncall.h \
../../../include/QtCore/qlibrary.h \
../../../src/corelib/plugin/qlibrary.h \
../../../include/QtCore/qpluginloader.h \
../../../src/corelib/plugin/qpluginloader.h \
../../../include/QtCore/quuid.h \
../../../src/corelib/plugin/quuid.h \
../../../include/QtCore/qbitarray.h \
../../../src/corelib/tools/qbitarray.h \
../../../include/QtCore/qbytearraymatcher.h \
../../../src/corelib/tools/qbytearraymatcher.h \
../../../include/QtCore/qcache.h \
../../../src/corelib/tools/qcache.h \
../../../include/QtCore/qcontainerfwd.h \
../../../src/corelib/tools/qcontainerfwd.h \
../../../include/QtCore/qcryptographichash.h \
../../../src/corelib/tools/qcryptographichash.h \
../../../include/QtCore/qelapsedtimer.h \
../../../src/corelib/tools/qelapsedtimer.h \
../../../include/QtCore/qline.h \
../../../src/corelib/tools/qline.h \
../../../include/QtCore/qmargins.h \
../../../src/corelib/tools/qmargins.h \
../../../include/QtCore/qqueue.h \
../../../src/corelib/tools/qqueue.h \
../../../include/QtCore/qrect.h \
../../../src/corelib/tools/qrect.h \
../../../include/QtCore/qsize.h \
../../../src/corelib/tools/qsize.h \
../../../include/QtCore/qstack.h \
../../../src/corelib/tools/qstack.h \
../../../include/QtCore/qtextboundaryfinder.h \
../../../src/corelib/tools/qtextboundaryfinder.h \
../../../include/QtCore/qtimeline.h \
../../../src/corelib/tools/qtimeline.h \
../../../include/QtCore/qvarlengtharray.h \
../../../src/corelib/tools/qvarlengtharray.h \
../../../include/QtGui/qbrush.h \
../../../src/gui/painting/qbrush.h \
../../../include/QtGui/qcolor.h \
../../../src/gui/painting/qcolor.h \
../../../include/QtGui/qrgb.h \
../../../src/gui/painting/qrgb.h \
../../../include/QtGui/qmatrix.h \
../../../src/gui/painting/qmatrix.h \
../../../include/QtGui/qpolygon.h \
../../../src/gui/painting/qpolygon.h \
../../../include/QtGui/qregion.h \
../../../src/gui/painting/qregion.h \
../../../include/QtGui/qwindowdefs.h \
../../../src/gui/kernel/qwindowdefs.h \
../../../include/QtGui/qmacdefines_mac.h \
../../../src/gui/kernel/qmacdefines_mac.h \
../../../include/QtGui/qwindowdefs_win.h \
../../../src/gui/kernel/qwindowdefs_win.h \
../../../include/QtGui/qwmatrix.h \
../../../src/gui/painting/qwmatrix.h \
../../../include/QtGui/qtransform.h \
../../../src/gui/painting/qtransform.h \
../../../include/QtGui/qpainterpath.h \
../../../src/gui/painting/qpainterpath.h \
../../../include/QtGui/qimage.h \
../../../src/gui/image/qimage.h \
../../../include/QtGui/qpaintdevice.h \
../../../src/gui/painting/qpaintdevice.h \
../../../include/QtGui/qpixmap.h \
../../../src/gui/image/qpixmap.h \
../../../include/QtGui/qcolormap.h \
../../../src/gui/painting/qcolormap.h \
../../../include/QtGui/qdrawutil.h \
../../../src/gui/painting/qdrawutil.h \
../../../include/QtGui/qpaintengine.h \
../../../src/gui/painting/qpaintengine.h \
../../../include/QtGui/qpainter.h \
../../../src/gui/painting/qpainter.h \
../../../include/QtGui/qtextoption.h \
../../../src/gui/text/qtextoption.h \
../../../include/QtGui/qpen.h \
../../../src/gui/painting/qpen.h \
../../../include/QtGui/qfontinfo.h \
../../../src/gui/text/qfontinfo.h \
../../../include/QtGui/qfont.h \
../../../src/gui/text/qfont.h \
../../../include/QtGui/qfontmetrics.h \
../../../src/gui/text/qfontmetrics.h \
../../../include/QtGui/qprintengine.h \
../../../src/gui/painting/qprintengine.h \
../../../include/QtGui/qprinter.h \
../../../src/gui/painting/qprinter.h \
../../../include/QtGui/qprinterinfo.h \
../../../src/gui/painting/qprinterinfo.h \
../../../include/QtGui/QPrinter \
../../../include/QtCore/QList \
../../../include/QtGui/qstylepainter.h \
../../../src/gui/painting/qstylepainter.h \
../../../include/QtGui/qstyle.h \
../../../src/gui/styles/qstyle.h \
../../../include/QtGui/qicon.h \
../../../src/gui/image/qicon.h \
../../../include/QtGui/qpalette.h \
../../../src/gui/kernel/qpalette.h \
../../../include/QtGui/qsizepolicy.h \
../../../src/gui/kernel/qsizepolicy.h \
../../../include/QtGui/qwidget.h \
../../../src/gui/kernel/qwidget.h \
../../../include/QtGui/qcursor.h \
../../../src/gui/kernel/qcursor.h \
../../../include/QtGui/qkeysequence.h \
../../../src/gui/kernel/qkeysequence.h \
../../../include/QtGui/qevent.h \
../../../src/gui/kernel/qevent.h \
../../../include/QtGui/qmime.h \
../../../src/gui/kernel/qmime.h \
../../../include/QtGui/qdrag.h \
../../../src/gui/kernel/qdrag.h \
../../../include/QtGui/qaction.h \
../../../src/gui/kernel/qaction.h \
../../../include/QtGui/qactiongroup.h \
../../../src/gui/kernel/qactiongroup.h \
../../../include/QtGui/qapplication.h \
../../../src/gui/kernel/qapplication.h \
../../../include/QtGui/qdesktopwidget.h \
../../../src/gui/kernel/qdesktopwidget.h \
../../../include/QtGui/qtransportauth_qws.h \
../../../src/gui/embedded/qtransportauth_qws.h \
../../../include/QtGui/qboxlayout.h \
../../../src/gui/kernel/qboxlayout.h \
../../../include/QtGui/qlayout.h \
../../../src/gui/kernel/qlayout.h \
../../../include/QtGui/qlayoutitem.h \
../../../src/gui/kernel/qlayoutitem.h \
../../../include/QtGui/qgridlayout.h \
../../../src/gui/kernel/qgridlayout.h \
../../../include/QtGui/qclipboard.h \
../../../src/gui/kernel/qclipboard.h \
../../../include/QtGui/qformlayout.h \
../../../src/gui/kernel/qformlayout.h \
../../../include/QtGui/QLayout \
../../../include/QtGui/qgesture.h \
../../../src/gui/kernel/qgesture.h \
../../../include/QtGui/qgesturerecognizer.h \
../../../src/gui/kernel/qgesturerecognizer.h \
../../../include/QtGui/qsessionmanager.h \
../../../src/gui/kernel/qsessionmanager.h \
../../../include/QtGui/qshortcut.h \
../../../src/gui/kernel/qshortcut.h \
../../../include/QtGui/qsound.h \
../../../src/gui/kernel/qsound.h \
../../../include/QtGui/qstackedlayout.h \
../../../src/gui/kernel/qstackedlayout.h \
../../../include/QtGui/qtooltip.h \
../../../src/gui/kernel/qtooltip.h \
../../../include/QtGui/qwhatsthis.h \
../../../src/gui/kernel/qwhatsthis.h \
../../../include/QtGui/qwidgetaction.h \
../../../src/gui/kernel/qwidgetaction.h \
../../../include/QtGui/qgraphicsanchorlayout.h \
../../../src/gui/graphicsview/qgraphicsanchorlayout.h \
../../../include/QtGui/qgraphicsitem.h \
../../../src/gui/graphicsview/qgraphicsitem.h \
../../../include/QtGui/qgraphicslayout.h \
../../../src/gui/graphicsview/qgraphicslayout.h \
../../../include/QtGui/qgraphicslayoutitem.h \
../../../src/gui/graphicsview/qgraphicslayoutitem.h \
../../../include/QtGui/qgraphicsgridlayout.h \
../../../src/gui/graphicsview/qgraphicsgridlayout.h \
../../../include/QtGui/qgraphicsitemanimation.h \
../../../src/gui/graphicsview/qgraphicsitemanimation.h \
../../../include/QtGui/qgraphicslinearlayout.h \
../../../src/gui/graphicsview/qgraphicslinearlayout.h \
../../../include/QtGui/qgraphicsproxywidget.h \
../../../src/gui/graphicsview/qgraphicsproxywidget.h \
../../../include/QtGui/qgraphicswidget.h \
../../../src/gui/graphicsview/qgraphicswidget.h \
../../../include/QtGui/qgraphicsscene.h \
../../../src/gui/graphicsview/qgraphicsscene.h \
../../../include/QtGui/qgraphicssceneevent.h \
../../../src/gui/graphicsview/qgraphicssceneevent.h \
../../../include/QtGui/qgraphicstransform.h \
../../../src/gui/graphicsview/qgraphicstransform.h \
../../../include/QtCore/QObject \
../../../include/QtGui/QVector3D \
../../../include/QtGui/qvector3d.h \
../../../src/gui/math3d/qvector3d.h \
../../../include/QtGui/QTransform \
../../../include/QtGui/QMatrix4x4 \
../../../include/QtGui/qmatrix4x4.h \
../../../src/gui/math3d/qmatrix4x4.h \
../../../include/QtGui/qvector4d.h \
../../../src/gui/math3d/qvector4d.h \
../../../include/QtGui/qquaternion.h \
../../../src/gui/math3d/qquaternion.h \
../../../include/QtGui/qgenericmatrix.h \
../../../src/gui/math3d/qgenericmatrix.h \
../../../include/QtGui/qgraphicsview.h \
../../../src/gui/graphicsview/qgraphicsview.h \
../../../include/QtGui/qscrollarea.h \
../../../src/gui/widgets/qscrollarea.h \
../../../include/QtGui/qabstractscrollarea.h \
../../../src/gui/widgets/qabstractscrollarea.h \
../../../include/QtGui/qframe.h \
../../../src/gui/widgets/qframe.h \
../../../include/QtGui/qkeyeventtransition.h \
../../../src/gui/statemachine/qkeyeventtransition.h \
../../../include/QtGui/qmouseeventtransition.h \
../../../src/gui/statemachine/qmouseeventtransition.h \
../../../include/QtGui/qbitmap.h \
../../../src/gui/image/qbitmap.h \
../../../include/QtGui/qiconengine.h \
../../../src/gui/image/qiconengine.h \
../../../include/QtGui/qiconengineplugin.h \
../../../src/gui/image/qiconengineplugin.h \
../../../include/QtGui/qimageiohandler.h \
../../../src/gui/image/qimageiohandler.h \
../../../include/QtGui/qimagereader.h \
../../../src/gui/image/qimagereader.h \
../../../include/QtGui/qimagewriter.h \
../../../src/gui/image/qimagewriter.h \
../../../include/QtGui/qmovie.h \
../../../src/gui/image/qmovie.h \
../../../include/QtGui/qpicture.h \
../../../src/gui/image/qpicture.h \
../../../include/QtGui/qpictureformatplugin.h \
../../../src/gui/image/qpictureformatplugin.h \
../../../include/QtGui/qpixmapcache.h \
../../../src/gui/image/qpixmapcache.h \
../../../include/QtGui/qabstracttextdocumentlayout.h \
../../../src/gui/text/qabstracttextdocumentlayout.h \
../../../include/QtGui/qtextlayout.h \
../../../src/gui/text/qtextlayout.h \
../../../include/QtGui/qtextformat.h \
../../../src/gui/text/qtextformat.h \
../../../include/QtGui/qtextdocument.h \
../../../src/gui/text/qtextdocument.h \
../../../include/QtGui/qtextcursor.h \
../../../src/gui/text/qtextcursor.h \
../../../include/QtGui/qfontdatabase.h \
../../../src/gui/text/qfontdatabase.h \
../../../include/QtGui/qstatictext.h \
../../../src/gui/text/qstatictext.h \
../../../include/QtGui/qsyntaxhighlighter.h \
../../../src/gui/text/qsyntaxhighlighter.h \
../../../include/QtGui/qtextobject.h \
../../../src/gui/text/qtextobject.h \
../../../include/QtGui/qtextdocumentfragment.h \
../../../src/gui/text/qtextdocumentfragment.h \
../../../include/QtGui/qtextdocumentwriter.h \
../../../src/gui/text/qtextdocumentwriter.h \
../../../include/QtGui/qtextlist.h \
../../../src/gui/text/qtextlist.h \
../../../include/QtGui/qtexttable.h \
../../../src/gui/text/qtexttable.h \
../../../include/QtGui/qvector2d.h \
../../../src/gui/math3d/qvector2d.h \
../../../include/QtGui/qabstractbutton.h \
../../../src/gui/widgets/qabstractbutton.h \
../../../include/QtGui/qabstractslider.h \
../../../src/gui/widgets/qabstractslider.h \
../../../include/QtGui/qabstractspinbox.h \
../../../src/gui/widgets/qabstractspinbox.h \
../../../include/QtGui/qvalidator.h \
../../../src/gui/widgets/qvalidator.h \
../../../include/QtGui/qbuttongroup.h \
../../../src/gui/widgets/qbuttongroup.h \
../../../include/QtGui/qcalendarwidget.h \
../../../src/gui/widgets/qcalendarwidget.h \
../../../include/QtGui/qcheckbox.h \
../../../src/gui/widgets/qcheckbox.h \
../../../include/QtGui/qcombobox.h \
../../../src/gui/widgets/qcombobox.h \
../../../include/QtGui/qabstractitemdelegate.h \
../../../src/gui/itemviews/qabstractitemdelegate.h \
../../../include/QtGui/qstyleoption.h \
../../../src/gui/styles/qstyleoption.h \
../../../include/QtGui/qslider.h \
../../../src/gui/widgets/qslider.h \
../../../include/QtGui/qtabbar.h \
../../../src/gui/widgets/qtabbar.h \
../../../include/QtGui/qtabwidget.h \
../../../src/gui/widgets/qtabwidget.h \
../../../include/QtGui/qrubberband.h \
../../../src/gui/widgets/qrubberband.h \
../../../include/QtGui/qcommandlinkbutton.h \
../../../src/gui/widgets/qcommandlinkbutton.h \
../../../include/QtGui/qpushbutton.h \
../../../src/gui/widgets/qpushbutton.h \
../../../include/QtGui/qdatetimeedit.h \
../../../src/gui/widgets/qdatetimeedit.h \
../../../include/QtGui/qdial.h \
../../../src/gui/widgets/qdial.h \
../../../include/QtGui/qdialogbuttonbox.h \
../../../src/gui/widgets/qdialogbuttonbox.h \
../../../include/QtGui/qdockwidget.h \
../../../src/gui/widgets/qdockwidget.h \
../../../include/QtGui/qfocusframe.h \
../../../src/gui/widgets/qfocusframe.h \
../../../include/QtGui/qfontcombobox.h \
../../../src/gui/widgets/qfontcombobox.h \
../../../include/QtGui/qgroupbox.h \
../../../src/gui/widgets/qgroupbox.h \
../../../include/QtGui/qlabel.h \
../../../src/gui/widgets/qlabel.h \
../../../include/QtGui/qlcdnumber.h \
../../../src/gui/widgets/qlcdnumber.h \
../../../include/QtGui/qlineedit.h \
../../../src/gui/widgets/qlineedit.h \
../../../include/QtGui/qmainwindow.h \
../../../src/gui/widgets/qmainwindow.h \
../../../include/QtGui/qmdiarea.h \
../../../src/gui/widgets/qmdiarea.h \
../../../include/QtGui/qmdisubwindow.h \
../../../src/gui/widgets/qmdisubwindow.h \
../../../include/QtGui/qmenu.h \
../../../src/gui/widgets/qmenu.h \
../../../include/QtGui/qmenubar.h \
../../../src/gui/widgets/qmenubar.h \
../../../include/QtGui/qmenudata.h \
../../../src/gui/widgets/qmenudata.h \
../../../include/QtGui/qplaintextedit.h \
../../../src/gui/widgets/qplaintextedit.h \
../../../include/QtGui/qtextedit.h \
../../../src/gui/widgets/qtextedit.h \
../../../include/QtGui/qprintpreviewwidget.h \
../../../src/gui/widgets/qprintpreviewwidget.h \
../../../include/QtGui/qprogressbar.h \
../../../src/gui/widgets/qprogressbar.h \
../../../include/QtGui/qradiobutton.h \
../../../src/gui/widgets/qradiobutton.h \
../../../include/QtGui/qscrollbar.h \
../../../src/gui/widgets/qscrollbar.h \
../../../include/QtGui/qsizegrip.h \
../../../src/gui/widgets/qsizegrip.h \
../../../include/QtGui/qspinbox.h \
../../../src/gui/widgets/qspinbox.h \
../../../include/QtGui/qsplashscreen.h \
../../../src/gui/widgets/qsplashscreen.h \
../../../include/QtGui/qsplitter.h \
../../../src/gui/widgets/qsplitter.h \
../../../include/QtGui/qstackedwidget.h \
../../../src/gui/widgets/qstackedwidget.h \
../../../include/QtGui/qstatusbar.h \
../../../src/gui/widgets/qstatusbar.h \
../../../include/QtGui/qtextbrowser.h \
../../../src/gui/widgets/qtextbrowser.h \
../../../include/QtGui/qtoolbar.h \
../../../src/gui/widgets/qtoolbar.h \
../../../include/QtGui/qtoolbox.h \
../../../src/gui/widgets/qtoolbox.h \
../../../include/QtGui/qtoolbutton.h \
../../../src/gui/widgets/qtoolbutton.h \
../../../include/QtGui/qworkspace.h \
../../../src/gui/widgets/qworkspace.h \
../../../include/QtGui/qaccessible.h \
../../../src/gui/accessible/qaccessible.h \
../../../include/QtGui/qaccessible2.h \
../../../src/gui/accessible/qaccessible2.h \
../../../include/QtGui/qaccessiblebridge.h \
../../../src/gui/accessible/qaccessiblebridge.h \
../../../include/QtGui/qaccessibleobject.h \
../../../src/gui/accessible/qaccessibleobject.h \
../../../include/QtGui/qaccessibleplugin.h \
../../../src/gui/accessible/qaccessibleplugin.h \
../../../include/QtGui/qaccessiblewidget.h \
../../../src/gui/accessible/qaccessiblewidget.h \
../../../include/QtGui/qsymbianevent.h \
../../../src/gui/symbian/qsymbianevent.h \
../../../include/QtGui/qcompleter.h \
../../../src/gui/util/qcompleter.h \
../../../include/QtGui/qdesktopservices.h \
../../../src/gui/util/qdesktopservices.h \
../../../include/QtGui/qsystemtrayicon.h \
../../../src/gui/util/qsystemtrayicon.h \
../../../include/QtGui/qundogroup.h \
../../../src/gui/util/qundogroup.h \
../../../include/QtGui/qundostack.h \
../../../src/gui/util/qundostack.h \
../../../include/QtGui/qundoview.h \
../../../src/gui/util/qundoview.h \
../../../include/QtGui/qlistview.h \
../../../src/gui/itemviews/qlistview.h \
../../../include/QtGui/qabstractitemview.h \
../../../src/gui/itemviews/qabstractitemview.h \
../../../include/QtGui/qitemselectionmodel.h \
../../../src/gui/itemviews/qitemselectionmodel.h \
../../../include/QtGui/qcdestyle.h \
../../../src/gui/styles/qcdestyle.h \
../../../include/QtGui/qmotifstyle.h \
../../../src/gui/styles/qmotifstyle.h \
../../../include/QtGui/qcommonstyle.h \
../../../src/gui/styles/qcommonstyle.h \
../../../include/QtGui/qcleanlooksstyle.h \
../../../src/gui/styles/qcleanlooksstyle.h \
../../../include/QtGui/qwindowsstyle.h \
../../../src/gui/styles/qwindowsstyle.h \
../../../include/QtGui/qgtkstyle.h \
../../../src/gui/styles/qgtkstyle.h \
../../../include/QtGui/QCleanlooksStyle \
../../../include/QtGui/QPalette \
../../../include/QtGui/QFont \
../../../include/QtGui/QFileDialog \
../../../include/QtGui/qfiledialog.h \
../../../src/gui/dialogs/qfiledialog.h \
../../../include/QtGui/qdialog.h \
../../../src/gui/dialogs/qdialog.h \
../../../include/QtGui/qplastiquestyle.h \
../../../src/gui/styles/qplastiquestyle.h \
../../../include/QtGui/qproxystyle.h \
../../../src/gui/styles/qproxystyle.h \
../../../include/QtGui/QCommonStyle \
../../../include/QtGui/qs60style.h \
../../../src/gui/styles/qs60style.h \
../../../include/QtGui/qstylefactory.h \
../../../src/gui/styles/qstylefactory.h \
../../../include/QtGui/qstyleplugin.h \
../../../src/gui/styles/qstyleplugin.h \
../../../include/QtGui/qwindowscestyle.h \
../../../src/gui/styles/qwindowscestyle.h \
../../../include/QtGui/qwindowsmobilestyle.h \
../../../src/gui/styles/qwindowsmobilestyle.h \
../../../include/QtGui/qwindowsvistastyle.h \
../../../src/gui/styles/qwindowsvistastyle.h \
../../../include/QtGui/qwindowsxpstyle.h \
../../../src/gui/styles/qwindowsxpstyle.h \
../../../include/QtGui/qabstractproxymodel.h \
../../../src/gui/itemviews/qabstractproxymodel.h \
../../../include/QtGui/qcolumnview.h \
../../../src/gui/itemviews/qcolumnview.h \
../../../include/QtGui/qdatawidgetmapper.h \
../../../src/gui/itemviews/qdatawidgetmapper.h \
../../../include/QtGui/qdirmodel.h \
../../../src/gui/itemviews/qdirmodel.h \
../../../include/QtGui/qfileiconprovider.h \
../../../src/gui/itemviews/qfileiconprovider.h \
../../../include/QtGui/qheaderview.h \
../../../src/gui/itemviews/qheaderview.h \
../../../include/QtGui/qitemdelegate.h \
../../../src/gui/itemviews/qitemdelegate.h \
../../../include/QtGui/qitemeditorfactory.h \
../../../src/gui/itemviews/qitemeditorfactory.h \
../../../include/QtGui/qlistwidget.h \
../../../src/gui/itemviews/qlistwidget.h \
../../../include/QtGui/qproxymodel.h \
../../../src/gui/itemviews/qproxymodel.h \
../../../include/QtGui/qsortfilterproxymodel.h \
../../../src/gui/itemviews/qsortfilterproxymodel.h \
../../../include/QtGui/qstandarditemmodel.h \
../../../src/gui/itemviews/qstandarditemmodel.h \
../../../include/QtGui/qstringlistmodel.h \
../../../src/gui/itemviews/qstringlistmodel.h \
../../../include/QtGui/qstyleditemdelegate.h \
../../../src/gui/itemviews/qstyleditemdelegate.h \
../../../include/QtGui/qtableview.h \
../../../src/gui/itemviews/qtableview.h \
../../../include/QtGui/qtablewidget.h \
../../../src/gui/itemviews/qtablewidget.h \
../../../include/QtGui/qtreeview.h \
../../../src/gui/itemviews/qtreeview.h \
../../../include/QtGui/qtreewidget.h \
../../../src/gui/itemviews/qtreewidget.h \
../../../include/QtGui/qtreewidgetitemiterator.h \
../../../src/gui/itemviews/qtreewidgetitemiterator.h \
../../../include/QtGui/qgraphicseffect.h \
../../../src/gui/effects/qgraphicseffect.h \
../../../include/QtGui/qs60mainapplication.h \
../../../src/gui/s60framework/qs60mainapplication.h \
../../../include/QtGui/qs60mainappui.h \
../../../src/gui/s60framework/qs60mainappui.h \
../../../include/QtGui/qs60maindocument.h \
../../../src/gui/s60framework/qs60maindocument.h \
../../../include/QtGui/qinputcontext.h \
../../../src/gui/inputmethod/qinputcontext.h \
../../../include/QtGui/qinputcontextfactory.h \
../../../src/gui/inputmethod/qinputcontextfactory.h \
../../../include/QtGui/qinputcontextplugin.h \
../../../src/gui/inputmethod/qinputcontextplugin.h \
../../../include/QtGui/qabstractpagesetupdialog.h \
../../../src/gui/dialogs/qabstractpagesetupdialog.h \
../../../include/QtGui/qabstractprintdialog.h \
../../../src/gui/dialogs/qabstractprintdialog.h \
../../../include/QtGui/qcolordialog.h \
../../../src/gui/dialogs/qcolordialog.h \
../../../include/QtGui/qerrormessage.h \
../../../src/gui/dialogs/qerrormessage.h \
../../../include/QtGui/qfilesystemmodel.h \
../../../src/gui/dialogs/qfilesystemmodel.h \
../../../include/QtGui/qfontdialog.h \
../../../src/gui/dialogs/qfontdialog.h \
../../../include/QtGui/qinputdialog.h \
../../../src/gui/dialogs/qinputdialog.h \
../../../include/QtGui/qmessagebox.h \
../../../src/gui/dialogs/qmessagebox.h \
../../../include/QtGui/qpagesetupdialog.h \
../../../src/gui/dialogs/qpagesetupdialog.h \
../../../include/QtGui/qprintdialog.h \
../../../src/gui/dialogs/qprintdialog.h \
../../../include/QtGui/qprintpreviewdialog.h \
../../../src/gui/dialogs/qprintpreviewdialog.h \
../../../include/QtGui/qprogressdialog.h \
../../../src/gui/dialogs/qprogressdialog.h \
../../../include/QtGui/qwizard.h \
../../../src/gui/dialogs/qwizard.h \
../../../include/QtGui/qvfbhdr.h \
../../../src/gui/embedded/qvfbhdr.h \
../../../include/QtGui/qwsembedwidget.h \
../../../src/gui/embedded/qwsembedwidget.h \
main.cpp
/Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/bin/moc $(DEFINES) $(INCPATH) -D__APPLE__ -D__GNUC__ main.cpp -o .moc/debug-shared/main.moc
compiler_rez_source_make_all:
compiler_rez_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_rcc_clean compiler_moc_source_clean
####### Compile
.obj/debug-shared/main.o: main.cpp ../../../include/QtGui/QtGui \
../../../include/QtCore/QtCore \
../../../include/QtCore/qxmlstream.h \
../../../src/corelib/xml/qxmlstream.h \
../../../include/QtCore/qiodevice.h \
../../../src/corelib/io/qiodevice.h \
../../../include/QtCore/qobject.h \
../../../src/corelib/kernel/qobject.h \
../../../include/QtCore/qobjectdefs.h \
../../../src/corelib/kernel/qobjectdefs.h \
../../../include/QtCore/qnamespace.h \
../../../src/corelib/global/qnamespace.h \
../../../include/QtCore/qglobal.h \
../../../src/corelib/global/qglobal.h \
../../../include/QtCore/qconfig.h \
../../../src/corelib/global/qconfig.h \
../../../include/QtCore/qfeatures.h \
../../../src/corelib/global/qfeatures.h \
../../../include/QtCore/qstring.h \
../../../src/corelib/tools/qstring.h \
../../../include/QtCore/qchar.h \
../../../src/corelib/tools/qchar.h \
../../../include/QtCore/qbytearray.h \
../../../src/corelib/tools/qbytearray.h \
../../../include/QtCore/qatomic.h \
../../../src/corelib/thread/qatomic.h \
../../../include/QtCore/qbasicatomic.h \
../../../src/corelib/thread/qbasicatomic.h \
../../../include/QtCore/qatomic_bootstrap.h \
../../../src/corelib/arch/qatomic_bootstrap.h \
../../../include/QtCore/qatomic_arch.h \
../../../src/corelib/arch/qatomic_arch.h \
../../../include/QtCore/qatomic_vxworks.h \
../../../src/corelib/arch/qatomic_vxworks.h \
../../../include/QtCore/qatomic_powerpc.h \
../../../src/corelib/arch/qatomic_powerpc.h \
../../../include/QtCore/qatomic_alpha.h \
../../../src/corelib/arch/qatomic_alpha.h \
../../../include/QtCore/qatomic_arm.h \
../../../src/corelib/arch/qatomic_arm.h \
../../../include/QtCore/qatomic_armv6.h \
../../../src/corelib/arch/qatomic_armv6.h \
../../../include/QtCore/qatomic_avr32.h \
../../../src/corelib/arch/qatomic_avr32.h \
../../../include/QtCore/qatomic_bfin.h \
../../../src/corelib/arch/qatomic_bfin.h \
../../../include/QtCore/qatomic_generic.h \
../../../src/corelib/arch/qatomic_generic.h \
../../../include/QtCore/qatomic_i386.h \
../../../src/corelib/arch/qatomic_i386.h \
../../../include/QtCore/qatomic_ia64.h \
../../../src/corelib/arch/qatomic_ia64.h \
../../../include/QtCore/qatomic_macosx.h \
../../../src/corelib/arch/qatomic_macosx.h \
../../../include/QtCore/qatomic_x86_64.h \
../../../src/corelib/arch/qatomic_x86_64.h \
../../../include/QtCore/qatomic_mips.h \
../../../src/corelib/arch/qatomic_mips.h \
../../../include/QtCore/qatomic_parisc.h \
../../../src/corelib/arch/qatomic_parisc.h \
../../../include/QtCore/qatomic_s390.h \
../../../src/corelib/arch/qatomic_s390.h \
../../../include/QtCore/qatomic_sparc.h \
../../../src/corelib/arch/qatomic_sparc.h \
../../../include/QtCore/qatomic_windows.h \
../../../src/corelib/arch/qatomic_windows.h \
../../../include/QtCore/qatomic_windowsce.h \
../../../src/corelib/arch/qatomic_windowsce.h \
../../../include/QtCore/qatomic_symbian.h \
../../../src/corelib/arch/qatomic_symbian.h \
../../../include/QtCore/qatomic_sh.h \
../../../src/corelib/arch/qatomic_sh.h \
../../../include/QtCore/qatomic_sh4a.h \
../../../src/corelib/arch/qatomic_sh4a.h \
../../../include/Qt3Support/q3cstring.h \
../../../src/qt3support/tools/q3cstring.h \
../../../include/QtCore/qstringbuilder.h \
../../../src/corelib/tools/qstringbuilder.h \
../../../include/QtCore/qmap.h \
../../../src/corelib/tools/qmap.h \
../../../include/QtCore/qiterator.h \
../../../src/corelib/tools/qiterator.h \
../../../include/QtCore/qlist.h \
../../../src/corelib/tools/qlist.h \
../../../include/QtCore/qalgorithms.h \
../../../src/corelib/tools/qalgorithms.h \
../../../include/QtCore/qcoreevent.h \
../../../src/corelib/kernel/qcoreevent.h \
../../../include/QtCore/qscopedpointer.h \
../../../src/corelib/tools/qscopedpointer.h \
../../../include/QtCore/qvector.h \
../../../src/corelib/tools/qvector.h \
../../../include/QtCore/QPointF \
../../../include/QtCore/qpoint.h \
../../../src/corelib/tools/qpoint.h \
../../../include/QtCore/QPoint \
../../../include/QtCore/qtextcodec.h \
../../../src/corelib/codecs/qtextcodec.h \
../../../include/QtCore/qtextcodecplugin.h \
../../../src/corelib/codecs/qtextcodecplugin.h \
../../../include/QtCore/qplugin.h \
../../../src/corelib/plugin/qplugin.h \
../../../include/QtCore/qpointer.h \
../../../src/corelib/kernel/qpointer.h \
../../../include/QtCore/qfactoryinterface.h \
../../../src/corelib/plugin/qfactoryinterface.h \
../../../include/QtCore/qstringlist.h \
../../../src/corelib/tools/qstringlist.h \
../../../include/QtCore/qdatastream.h \
../../../src/corelib/io/qdatastream.h \
../../../include/QtCore/qregexp.h \
../../../src/corelib/tools/qregexp.h \
../../../include/QtCore/qstringmatcher.h \
../../../src/corelib/tools/qstringmatcher.h \
../../../include/Qt3Support/q3valuelist.h \
../../../src/qt3support/tools/q3valuelist.h \
../../../include/QtCore/qlinkedlist.h \
../../../src/corelib/tools/qlinkedlist.h \
../../../include/QtCore/qabstracteventdispatcher.h \
../../../src/corelib/kernel/qabstracteventdispatcher.h \
../../../include/QtCore/qeventloop.h \
../../../src/corelib/kernel/qeventloop.h \
../../../include/QtCore/qabstractitemmodel.h \
../../../src/corelib/kernel/qabstractitemmodel.h \
../../../include/QtCore/qvariant.h \
../../../src/corelib/kernel/qvariant.h \
../../../include/QtCore/qmetatype.h \
../../../src/corelib/kernel/qmetatype.h \
../../../include/QtCore/qhash.h \
../../../src/corelib/tools/qhash.h \
../../../include/QtCore/qpair.h \
../../../src/corelib/tools/qpair.h \
../../../include/QtCore/qbasictimer.h \
../../../src/corelib/kernel/qbasictimer.h \
../../../include/QtCore/qcoreapplication.h \
../../../src/corelib/kernel/qcoreapplication.h \
../../../include/QtCore/qmath.h \
../../../src/corelib/kernel/qmath.h \
../../../include/QtCore/qmetaobject.h \
../../../src/corelib/kernel/qmetaobject.h \
../../../include/QtCore/qmimedata.h \
../../../src/corelib/kernel/qmimedata.h \
../../../include/QtCore/qobjectcleanuphandler.h \
../../../src/corelib/kernel/qobjectcleanuphandler.h \
../../../include/QtCore/qsharedmemory.h \
../../../src/corelib/kernel/qsharedmemory.h \
../../../include/QtCore/qsignalmapper.h \
../../../src/corelib/kernel/qsignalmapper.h \
../../../include/QtCore/qsocketnotifier.h \
../../../src/corelib/kernel/qsocketnotifier.h \
../../../include/QtCore/qsystemsemaphore.h \
../../../src/corelib/kernel/qsystemsemaphore.h \
../../../include/QtCore/qtimer.h \
../../../src/corelib/kernel/qtimer.h \
../../../include/QtCore/qtranslator.h \
../../../src/corelib/kernel/qtranslator.h \
../../../include/QtCore/qabstractanimation.h \
../../../src/corelib/animation/qabstractanimation.h \
../../../include/QtCore/qanimationgroup.h \
../../../src/corelib/animation/qanimationgroup.h \
../../../include/QtCore/qparallelanimationgroup.h \
../../../src/corelib/animation/qparallelanimationgroup.h \
../../../include/QtCore/qpauseanimation.h \
../../../src/corelib/animation/qpauseanimation.h \
../../../include/QtCore/qpropertyanimation.h \
../../../src/corelib/animation/qpropertyanimation.h \
../../../include/QtCore/qvariantanimation.h \
../../../src/corelib/animation/qvariantanimation.h \
../../../include/QtCore/qeasingcurve.h \
../../../src/corelib/tools/qeasingcurve.h \
../../../include/QtCore/qsequentialanimationgroup.h \
../../../src/corelib/animation/qsequentialanimationgroup.h \
../../../include/QtCore/qendian.h \
../../../src/corelib/global/qendian.h \
../../../include/QtCore/qlibraryinfo.h \
../../../src/corelib/global/qlibraryinfo.h \
../../../include/QtCore/QDate \
../../../include/QtCore/qdatetime.h \
../../../src/corelib/tools/qdatetime.h \
../../../include/QtCore/qsharedpointer.h \
../../../src/corelib/tools/qsharedpointer.h \
../../../include/QtCore/qshareddata.h \
../../../src/corelib/tools/qshareddata.h \
../../../include/QtCore/qsharedpointer_impl.h \
../../../src/corelib/tools/qsharedpointer_impl.h \
../../../include/QtCore/qnumeric.h \
../../../src/corelib/global/qnumeric.h \
../../../include/QtCore/qmutex.h \
../../../src/corelib/thread/qmutex.h \
../../../include/QtCore/qreadwritelock.h \
../../../src/corelib/thread/qreadwritelock.h \
../../../include/QtCore/qsemaphore.h \
../../../src/corelib/thread/qsemaphore.h \
../../../include/QtCore/qthread.h \
../../../src/corelib/thread/qthread.h \
../../../include/QtCore/qthreadstorage.h \
../../../src/corelib/thread/qthreadstorage.h \
../../../include/QtCore/qwaitcondition.h \
../../../src/corelib/thread/qwaitcondition.h \
../../../include/QtCore/qabstractstate.h \
../../../src/corelib/statemachine/qabstractstate.h \
../../../include/QtCore/qabstracttransition.h \
../../../src/corelib/statemachine/qabstracttransition.h \
../../../include/QtCore/qeventtransition.h \
../../../src/corelib/statemachine/qeventtransition.h \
../../../include/QtCore/qfinalstate.h \
../../../src/corelib/statemachine/qfinalstate.h \
../../../include/QtCore/qhistorystate.h \
../../../src/corelib/statemachine/qhistorystate.h \
../../../include/QtCore/qsignaltransition.h \
../../../src/corelib/statemachine/qsignaltransition.h \
../../../include/QtCore/qstate.h \
../../../src/corelib/statemachine/qstate.h \
../../../include/QtCore/qstatemachine.h \
../../../src/corelib/statemachine/qstatemachine.h \
../../../include/QtCore/qset.h \
../../../src/corelib/tools/qset.h \
../../../include/QtCore/qabstractfileengine.h \
../../../src/corelib/io/qabstractfileengine.h \
../../../include/QtCore/qdir.h \
../../../src/corelib/io/qdir.h \
../../../include/QtCore/qfileinfo.h \
../../../src/corelib/io/qfileinfo.h \
../../../include/QtCore/qfile.h \
../../../src/corelib/io/qfile.h \
../../../include/QtCore/qbuffer.h \
../../../src/corelib/io/qbuffer.h \
../../../include/QtCore/qdebug.h \
../../../src/corelib/io/qdebug.h \
../../../include/QtCore/qtextstream.h \
../../../src/corelib/io/qtextstream.h \
../../../include/QtCore/qlocale.h \
../../../src/corelib/tools/qlocale.h \
../../../include/QtCore/qcontiguouscache.h \
../../../src/corelib/tools/qcontiguouscache.h \
../../../include/QtCore/qdiriterator.h \
../../../src/corelib/io/qdiriterator.h \
../../../include/QtCore/qfilesystemwatcher.h \
../../../src/corelib/io/qfilesystemwatcher.h \
../../../include/QtCore/qfsfileengine.h \
../../../src/corelib/io/qfsfileengine.h \
../../../include/QtCore/qprocess.h \
../../../src/corelib/io/qprocess.h \
../../../include/QtCore/qresource.h \
../../../src/corelib/io/qresource.h \
../../../include/QtCore/qsettings.h \
../../../src/corelib/io/qsettings.h \
../../../include/QtCore/qtemporaryfile.h \
../../../src/corelib/io/qtemporaryfile.h \
../../../include/QtCore/qurl.h \
../../../src/corelib/io/qurl.h \
../../../include/QtCore/qfuture.h \
../../../src/corelib/concurrent/qfuture.h \
../../../include/QtCore/qfutureinterface.h \
../../../src/corelib/concurrent/qfutureinterface.h \
../../../include/QtCore/qrunnable.h \
../../../src/corelib/concurrent/qrunnable.h \
../../../include/QtCore/qtconcurrentexception.h \
../../../src/corelib/concurrent/qtconcurrentexception.h \
../../../include/QtCore/qtconcurrentresultstore.h \
../../../src/corelib/concurrent/qtconcurrentresultstore.h \
../../../include/QtCore/qtconcurrentcompilertest.h \
../../../src/corelib/concurrent/qtconcurrentcompilertest.h \
../../../include/QtCore/qfuturesynchronizer.h \
../../../src/corelib/concurrent/qfuturesynchronizer.h \
../../../include/QtCore/qfuturewatcher.h \
../../../src/corelib/concurrent/qfuturewatcher.h \
../../../include/QtCore/qtconcurrentfilter.h \
../../../src/corelib/concurrent/qtconcurrentfilter.h \
../../../include/QtCore/qtconcurrentfilterkernel.h \
../../../src/corelib/concurrent/qtconcurrentfilterkernel.h \
../../../include/QtCore/qtconcurrentiteratekernel.h \
../../../src/corelib/concurrent/qtconcurrentiteratekernel.h \
../../../include/QtCore/qtconcurrentmedian.h \
../../../src/corelib/concurrent/qtconcurrentmedian.h \
../../../include/QtCore/qtconcurrentthreadengine.h \
../../../src/corelib/concurrent/qtconcurrentthreadengine.h \
../../../include/QtCore/qthreadpool.h \
../../../src/corelib/concurrent/qthreadpool.h \
../../../include/QtCore/qtconcurrentmapkernel.h \
../../../src/corelib/concurrent/qtconcurrentmapkernel.h \
../../../include/QtCore/qtconcurrentreducekernel.h \
../../../src/corelib/concurrent/qtconcurrentreducekernel.h \
../../../include/QtCore/qtconcurrentfunctionwrappers.h \
../../../src/corelib/concurrent/qtconcurrentfunctionwrappers.h \
../../../include/QtCore/qtconcurrentmap.h \
../../../src/corelib/concurrent/qtconcurrentmap.h \
../../../include/QtCore/qtconcurrentrun.h \
../../../src/corelib/concurrent/qtconcurrentrun.h \
../../../include/QtCore/qtconcurrentrunbase.h \
../../../src/corelib/concurrent/qtconcurrentrunbase.h \
../../../include/QtCore/qtconcurrentstoredfunctioncall.h \
../../../src/corelib/concurrent/qtconcurrentstoredfunctioncall.h \
../../../include/QtCore/qlibrary.h \
../../../src/corelib/plugin/qlibrary.h \
../../../include/QtCore/qpluginloader.h \
../../../src/corelib/plugin/qpluginloader.h \
../../../include/QtCore/quuid.h \
../../../src/corelib/plugin/quuid.h \
../../../include/QtCore/qbitarray.h \
../../../src/corelib/tools/qbitarray.h \
../../../include/QtCore/qbytearraymatcher.h \
../../../src/corelib/tools/qbytearraymatcher.h \
../../../include/QtCore/qcache.h \
../../../src/corelib/tools/qcache.h \
../../../include/QtCore/qcontainerfwd.h \
../../../src/corelib/tools/qcontainerfwd.h \
../../../include/QtCore/qcryptographichash.h \
../../../src/corelib/tools/qcryptographichash.h \
../../../include/QtCore/qelapsedtimer.h \
../../../src/corelib/tools/qelapsedtimer.h \
../../../include/QtCore/qline.h \
../../../src/corelib/tools/qline.h \
../../../include/QtCore/qmargins.h \
../../../src/corelib/tools/qmargins.h \
../../../include/QtCore/qqueue.h \
../../../src/corelib/tools/qqueue.h \
../../../include/QtCore/qrect.h \
../../../src/corelib/tools/qrect.h \
../../../include/QtCore/qsize.h \
../../../src/corelib/tools/qsize.h \
../../../include/QtCore/qstack.h \
../../../src/corelib/tools/qstack.h \
../../../include/QtCore/qtextboundaryfinder.h \
../../../src/corelib/tools/qtextboundaryfinder.h \
../../../include/QtCore/qtimeline.h \
../../../src/corelib/tools/qtimeline.h \
../../../include/QtCore/qvarlengtharray.h \
../../../src/corelib/tools/qvarlengtharray.h \
../../../include/QtGui/qbrush.h \
../../../src/gui/painting/qbrush.h \
../../../include/QtGui/qcolor.h \
../../../src/gui/painting/qcolor.h \
../../../include/QtGui/qrgb.h \
../../../src/gui/painting/qrgb.h \
../../../include/QtGui/qmatrix.h \
../../../src/gui/painting/qmatrix.h \
../../../include/QtGui/qpolygon.h \
../../../src/gui/painting/qpolygon.h \
../../../include/QtGui/qregion.h \
../../../src/gui/painting/qregion.h \
../../../include/QtGui/qwindowdefs.h \
../../../src/gui/kernel/qwindowdefs.h \
../../../include/QtGui/qmacdefines_mac.h \
../../../src/gui/kernel/qmacdefines_mac.h \
../../../include/QtGui/qwindowdefs_win.h \
../../../src/gui/kernel/qwindowdefs_win.h \
../../../include/QtGui/qwmatrix.h \
../../../src/gui/painting/qwmatrix.h \
../../../include/QtGui/qtransform.h \
../../../src/gui/painting/qtransform.h \
../../../include/QtGui/qpainterpath.h \
../../../src/gui/painting/qpainterpath.h \
../../../include/QtGui/qimage.h \
../../../src/gui/image/qimage.h \
../../../include/QtGui/qpaintdevice.h \
../../../src/gui/painting/qpaintdevice.h \
../../../include/QtGui/qpixmap.h \
../../../src/gui/image/qpixmap.h \
../../../include/QtGui/qcolormap.h \
../../../src/gui/painting/qcolormap.h \
../../../include/QtGui/qdrawutil.h \
../../../src/gui/painting/qdrawutil.h \
../../../include/QtGui/qpaintengine.h \
../../../src/gui/painting/qpaintengine.h \
../../../include/QtGui/qpainter.h \
../../../src/gui/painting/qpainter.h \
../../../include/QtGui/qtextoption.h \
../../../src/gui/text/qtextoption.h \
../../../include/QtGui/qpen.h \
../../../src/gui/painting/qpen.h \
../../../include/QtGui/qfontinfo.h \
../../../src/gui/text/qfontinfo.h \
../../../include/QtGui/qfont.h \
../../../src/gui/text/qfont.h \
../../../include/QtGui/qfontmetrics.h \
../../../src/gui/text/qfontmetrics.h \
../../../include/QtGui/qprintengine.h \
../../../src/gui/painting/qprintengine.h \
../../../include/QtGui/qprinter.h \
../../../src/gui/painting/qprinter.h \
../../../include/QtGui/qprinterinfo.h \
../../../src/gui/painting/qprinterinfo.h \
../../../include/QtGui/QPrinter \
../../../include/QtCore/QList \
../../../include/QtGui/qstylepainter.h \
../../../src/gui/painting/qstylepainter.h \
../../../include/QtGui/qstyle.h \
../../../src/gui/styles/qstyle.h \
../../../include/QtGui/qicon.h \
../../../src/gui/image/qicon.h \
../../../include/QtGui/qpalette.h \
../../../src/gui/kernel/qpalette.h \
../../../include/QtGui/qsizepolicy.h \
../../../src/gui/kernel/qsizepolicy.h \
../../../include/QtGui/qwidget.h \
../../../src/gui/kernel/qwidget.h \
../../../include/QtGui/qcursor.h \
../../../src/gui/kernel/qcursor.h \
../../../include/QtGui/qkeysequence.h \
../../../src/gui/kernel/qkeysequence.h \
../../../include/QtGui/qevent.h \
../../../src/gui/kernel/qevent.h \
../../../include/QtGui/qmime.h \
../../../src/gui/kernel/qmime.h \
../../../include/QtGui/qdrag.h \
../../../src/gui/kernel/qdrag.h \
../../../include/QtGui/qaction.h \
../../../src/gui/kernel/qaction.h \
../../../include/QtGui/qactiongroup.h \
../../../src/gui/kernel/qactiongroup.h \
../../../include/QtGui/qapplication.h \
../../../src/gui/kernel/qapplication.h \
../../../include/QtGui/qdesktopwidget.h \
../../../src/gui/kernel/qdesktopwidget.h \
../../../include/QtGui/qtransportauth_qws.h \
../../../src/gui/embedded/qtransportauth_qws.h \
../../../include/QtGui/qboxlayout.h \
../../../src/gui/kernel/qboxlayout.h \
../../../include/QtGui/qlayout.h \
../../../src/gui/kernel/qlayout.h \
../../../include/QtGui/qlayoutitem.h \
../../../src/gui/kernel/qlayoutitem.h \
../../../include/QtGui/qgridlayout.h \
../../../src/gui/kernel/qgridlayout.h \
../../../include/QtGui/qclipboard.h \
../../../src/gui/kernel/qclipboard.h \
../../../include/QtGui/qformlayout.h \
../../../src/gui/kernel/qformlayout.h \
../../../include/QtGui/QLayout \
../../../include/QtGui/qgesture.h \
../../../src/gui/kernel/qgesture.h \
../../../include/QtGui/qgesturerecognizer.h \
../../../src/gui/kernel/qgesturerecognizer.h \
../../../include/QtGui/qsessionmanager.h \
../../../src/gui/kernel/qsessionmanager.h \
../../../include/QtGui/qshortcut.h \
../../../src/gui/kernel/qshortcut.h \
../../../include/QtGui/qsound.h \
../../../src/gui/kernel/qsound.h \
../../../include/QtGui/qstackedlayout.h \
../../../src/gui/kernel/qstackedlayout.h \
../../../include/QtGui/qtooltip.h \
../../../src/gui/kernel/qtooltip.h \
../../../include/QtGui/qwhatsthis.h \
../../../src/gui/kernel/qwhatsthis.h \
../../../include/QtGui/qwidgetaction.h \
../../../src/gui/kernel/qwidgetaction.h \
../../../include/QtGui/qgraphicsanchorlayout.h \
../../../src/gui/graphicsview/qgraphicsanchorlayout.h \
../../../include/QtGui/qgraphicsitem.h \
../../../src/gui/graphicsview/qgraphicsitem.h \
../../../include/QtGui/qgraphicslayout.h \
../../../src/gui/graphicsview/qgraphicslayout.h \
../../../include/QtGui/qgraphicslayoutitem.h \
../../../src/gui/graphicsview/qgraphicslayoutitem.h \
../../../include/QtGui/qgraphicsgridlayout.h \
../../../src/gui/graphicsview/qgraphicsgridlayout.h \
../../../include/QtGui/qgraphicsitemanimation.h \
../../../src/gui/graphicsview/qgraphicsitemanimation.h \
../../../include/QtGui/qgraphicslinearlayout.h \
../../../src/gui/graphicsview/qgraphicslinearlayout.h \
../../../include/QtGui/qgraphicsproxywidget.h \
../../../src/gui/graphicsview/qgraphicsproxywidget.h \
../../../include/QtGui/qgraphicswidget.h \
../../../src/gui/graphicsview/qgraphicswidget.h \
../../../include/QtGui/qgraphicsscene.h \
../../../src/gui/graphicsview/qgraphicsscene.h \
../../../include/QtGui/qgraphicssceneevent.h \
../../../src/gui/graphicsview/qgraphicssceneevent.h \
../../../include/QtGui/qgraphicstransform.h \
../../../src/gui/graphicsview/qgraphicstransform.h \
../../../include/QtCore/QObject \
../../../include/QtGui/QVector3D \
../../../include/QtGui/qvector3d.h \
../../../src/gui/math3d/qvector3d.h \
../../../include/QtGui/QTransform \
../../../include/QtGui/QMatrix4x4 \
../../../include/QtGui/qmatrix4x4.h \
../../../src/gui/math3d/qmatrix4x4.h \
../../../include/QtGui/qvector4d.h \
../../../src/gui/math3d/qvector4d.h \
../../../include/QtGui/qquaternion.h \
../../../src/gui/math3d/qquaternion.h \
../../../include/QtGui/qgenericmatrix.h \
../../../src/gui/math3d/qgenericmatrix.h \
../../../include/QtGui/qgraphicsview.h \
../../../src/gui/graphicsview/qgraphicsview.h \
../../../include/QtGui/qscrollarea.h \
../../../src/gui/widgets/qscrollarea.h \
../../../include/QtGui/qabstractscrollarea.h \
../../../src/gui/widgets/qabstractscrollarea.h \
../../../include/QtGui/qframe.h \
../../../src/gui/widgets/qframe.h \
../../../include/QtGui/qkeyeventtransition.h \
../../../src/gui/statemachine/qkeyeventtransition.h \
../../../include/QtGui/qmouseeventtransition.h \
../../../src/gui/statemachine/qmouseeventtransition.h \
../../../include/QtGui/qbitmap.h \
../../../src/gui/image/qbitmap.h \
../../../include/QtGui/qiconengine.h \
../../../src/gui/image/qiconengine.h \
../../../include/QtGui/qiconengineplugin.h \
../../../src/gui/image/qiconengineplugin.h \
../../../include/QtGui/qimageiohandler.h \
../../../src/gui/image/qimageiohandler.h \
../../../include/QtGui/qimagereader.h \
../../../src/gui/image/qimagereader.h \
../../../include/QtGui/qimagewriter.h \
../../../src/gui/image/qimagewriter.h \
../../../include/QtGui/qmovie.h \
../../../src/gui/image/qmovie.h \
../../../include/QtGui/qpicture.h \
../../../src/gui/image/qpicture.h \
../../../include/QtGui/qpictureformatplugin.h \
../../../src/gui/image/qpictureformatplugin.h \
../../../include/QtGui/qpixmapcache.h \
../../../src/gui/image/qpixmapcache.h \
../../../include/QtGui/qabstracttextdocumentlayout.h \
../../../src/gui/text/qabstracttextdocumentlayout.h \
../../../include/QtGui/qtextlayout.h \
../../../src/gui/text/qtextlayout.h \
../../../include/QtGui/qtextformat.h \
../../../src/gui/text/qtextformat.h \
../../../include/QtGui/qtextdocument.h \
../../../src/gui/text/qtextdocument.h \
../../../include/QtGui/qtextcursor.h \
../../../src/gui/text/qtextcursor.h \
../../../include/QtGui/qfontdatabase.h \
../../../src/gui/text/qfontdatabase.h \
../../../include/QtGui/qstatictext.h \
../../../src/gui/text/qstatictext.h \
../../../include/QtGui/qsyntaxhighlighter.h \
../../../src/gui/text/qsyntaxhighlighter.h \
../../../include/QtGui/qtextobject.h \
../../../src/gui/text/qtextobject.h \
../../../include/QtGui/qtextdocumentfragment.h \
../../../src/gui/text/qtextdocumentfragment.h \
../../../include/QtGui/qtextdocumentwriter.h \
../../../src/gui/text/qtextdocumentwriter.h \
../../../include/QtGui/qtextlist.h \
../../../src/gui/text/qtextlist.h \
../../../include/QtGui/qtexttable.h \
../../../src/gui/text/qtexttable.h \
../../../include/QtGui/qvector2d.h \
../../../src/gui/math3d/qvector2d.h \
../../../include/QtGui/qabstractbutton.h \
../../../src/gui/widgets/qabstractbutton.h \
../../../include/QtGui/qabstractslider.h \
../../../src/gui/widgets/qabstractslider.h \
../../../include/QtGui/qabstractspinbox.h \
../../../src/gui/widgets/qabstractspinbox.h \
../../../include/QtGui/qvalidator.h \
../../../src/gui/widgets/qvalidator.h \
../../../include/QtGui/qbuttongroup.h \
../../../src/gui/widgets/qbuttongroup.h \
../../../include/QtGui/qcalendarwidget.h \
../../../src/gui/widgets/qcalendarwidget.h \
../../../include/QtGui/qcheckbox.h \
../../../src/gui/widgets/qcheckbox.h \
../../../include/QtGui/qcombobox.h \
../../../src/gui/widgets/qcombobox.h \
../../../include/QtGui/qabstractitemdelegate.h \
../../../src/gui/itemviews/qabstractitemdelegate.h \
../../../include/QtGui/qstyleoption.h \
../../../src/gui/styles/qstyleoption.h \
../../../include/QtGui/qslider.h \
../../../src/gui/widgets/qslider.h \
../../../include/QtGui/qtabbar.h \
../../../src/gui/widgets/qtabbar.h \
../../../include/QtGui/qtabwidget.h \
../../../src/gui/widgets/qtabwidget.h \
../../../include/QtGui/qrubberband.h \
../../../src/gui/widgets/qrubberband.h \
../../../include/QtGui/qcommandlinkbutton.h \
../../../src/gui/widgets/qcommandlinkbutton.h \
../../../include/QtGui/qpushbutton.h \
../../../src/gui/widgets/qpushbutton.h \
../../../include/QtGui/qdatetimeedit.h \
../../../src/gui/widgets/qdatetimeedit.h \
../../../include/QtGui/qdial.h \
../../../src/gui/widgets/qdial.h \
../../../include/QtGui/qdialogbuttonbox.h \
../../../src/gui/widgets/qdialogbuttonbox.h \
../../../include/QtGui/qdockwidget.h \
../../../src/gui/widgets/qdockwidget.h \
../../../include/QtGui/qfocusframe.h \
../../../src/gui/widgets/qfocusframe.h \
../../../include/QtGui/qfontcombobox.h \
../../../src/gui/widgets/qfontcombobox.h \
../../../include/QtGui/qgroupbox.h \
../../../src/gui/widgets/qgroupbox.h \
../../../include/QtGui/qlabel.h \
../../../src/gui/widgets/qlabel.h \
../../../include/QtGui/qlcdnumber.h \
../../../src/gui/widgets/qlcdnumber.h \
../../../include/QtGui/qlineedit.h \
../../../src/gui/widgets/qlineedit.h \
../../../include/QtGui/qmainwindow.h \
../../../src/gui/widgets/qmainwindow.h \
../../../include/QtGui/qmdiarea.h \
../../../src/gui/widgets/qmdiarea.h \
../../../include/QtGui/qmdisubwindow.h \
../../../src/gui/widgets/qmdisubwindow.h \
../../../include/QtGui/qmenu.h \
../../../src/gui/widgets/qmenu.h \
../../../include/QtGui/qmenubar.h \
../../../src/gui/widgets/qmenubar.h \
../../../include/QtGui/qmenudata.h \
../../../src/gui/widgets/qmenudata.h \
../../../include/QtGui/qplaintextedit.h \
../../../src/gui/widgets/qplaintextedit.h \
../../../include/QtGui/qtextedit.h \
../../../src/gui/widgets/qtextedit.h \
../../../include/QtGui/qprintpreviewwidget.h \
../../../src/gui/widgets/qprintpreviewwidget.h \
../../../include/QtGui/qprogressbar.h \
../../../src/gui/widgets/qprogressbar.h \
../../../include/QtGui/qradiobutton.h \
../../../src/gui/widgets/qradiobutton.h \
../../../include/QtGui/qscrollbar.h \
../../../src/gui/widgets/qscrollbar.h \
../../../include/QtGui/qsizegrip.h \
../../../src/gui/widgets/qsizegrip.h \
../../../include/QtGui/qspinbox.h \
../../../src/gui/widgets/qspinbox.h \
../../../include/QtGui/qsplashscreen.h \
../../../src/gui/widgets/qsplashscreen.h \
../../../include/QtGui/qsplitter.h \
../../../src/gui/widgets/qsplitter.h \
../../../include/QtGui/qstackedwidget.h \
../../../src/gui/widgets/qstackedwidget.h \
../../../include/QtGui/qstatusbar.h \
../../../src/gui/widgets/qstatusbar.h \
../../../include/QtGui/qtextbrowser.h \
../../../src/gui/widgets/qtextbrowser.h \
../../../include/QtGui/qtoolbar.h \
../../../src/gui/widgets/qtoolbar.h \
../../../include/QtGui/qtoolbox.h \
../../../src/gui/widgets/qtoolbox.h \
../../../include/QtGui/qtoolbutton.h \
../../../src/gui/widgets/qtoolbutton.h \
../../../include/QtGui/qworkspace.h \
../../../src/gui/widgets/qworkspace.h \
../../../include/QtGui/qaccessible.h \
../../../src/gui/accessible/qaccessible.h \
../../../include/QtGui/qaccessible2.h \
../../../src/gui/accessible/qaccessible2.h \
../../../include/QtGui/qaccessiblebridge.h \
../../../src/gui/accessible/qaccessiblebridge.h \
../../../include/QtGui/qaccessibleobject.h \
../../../src/gui/accessible/qaccessibleobject.h \
../../../include/QtGui/qaccessibleplugin.h \
../../../src/gui/accessible/qaccessibleplugin.h \
../../../include/QtGui/qaccessiblewidget.h \
../../../src/gui/accessible/qaccessiblewidget.h \
../../../include/QtGui/qsymbianevent.h \
../../../src/gui/symbian/qsymbianevent.h \
../../../include/QtGui/qcompleter.h \
../../../src/gui/util/qcompleter.h \
../../../include/QtGui/qdesktopservices.h \
../../../src/gui/util/qdesktopservices.h \
../../../include/QtGui/qsystemtrayicon.h \
../../../src/gui/util/qsystemtrayicon.h \
../../../include/QtGui/qundogroup.h \
../../../src/gui/util/qundogroup.h \
../../../include/QtGui/qundostack.h \
../../../src/gui/util/qundostack.h \
../../../include/QtGui/qundoview.h \
../../../src/gui/util/qundoview.h \
../../../include/QtGui/qlistview.h \
../../../src/gui/itemviews/qlistview.h \
../../../include/QtGui/qabstractitemview.h \
../../../src/gui/itemviews/qabstractitemview.h \
../../../include/QtGui/qitemselectionmodel.h \
../../../src/gui/itemviews/qitemselectionmodel.h \
../../../include/QtGui/qcdestyle.h \
../../../src/gui/styles/qcdestyle.h \
../../../include/QtGui/qmotifstyle.h \
../../../src/gui/styles/qmotifstyle.h \
../../../include/QtGui/qcommonstyle.h \
../../../src/gui/styles/qcommonstyle.h \
../../../include/QtGui/qcleanlooksstyle.h \
../../../src/gui/styles/qcleanlooksstyle.h \
../../../include/QtGui/qwindowsstyle.h \
../../../src/gui/styles/qwindowsstyle.h \
../../../include/QtGui/qgtkstyle.h \
../../../src/gui/styles/qgtkstyle.h \
../../../include/QtGui/QCleanlooksStyle \
../../../include/QtGui/QPalette \
../../../include/QtGui/QFont \
../../../include/QtGui/QFileDialog \
../../../include/QtGui/qfiledialog.h \
../../../src/gui/dialogs/qfiledialog.h \
../../../include/QtGui/qdialog.h \
../../../src/gui/dialogs/qdialog.h \
../../../include/QtGui/qplastiquestyle.h \
../../../src/gui/styles/qplastiquestyle.h \
../../../include/QtGui/qproxystyle.h \
../../../src/gui/styles/qproxystyle.h \
../../../include/QtGui/QCommonStyle \
../../../include/QtGui/qs60style.h \
../../../src/gui/styles/qs60style.h \
../../../include/QtGui/qstylefactory.h \
../../../src/gui/styles/qstylefactory.h \
../../../include/QtGui/qstyleplugin.h \
../../../src/gui/styles/qstyleplugin.h \
../../../include/QtGui/qwindowscestyle.h \
../../../src/gui/styles/qwindowscestyle.h \
../../../include/QtGui/qwindowsmobilestyle.h \
../../../src/gui/styles/qwindowsmobilestyle.h \
../../../include/QtGui/qwindowsvistastyle.h \
../../../src/gui/styles/qwindowsvistastyle.h \
../../../include/QtGui/qwindowsxpstyle.h \
../../../src/gui/styles/qwindowsxpstyle.h \
../../../include/QtGui/qabstractproxymodel.h \
../../../src/gui/itemviews/qabstractproxymodel.h \
../../../include/QtGui/qcolumnview.h \
../../../src/gui/itemviews/qcolumnview.h \
../../../include/QtGui/qdatawidgetmapper.h \
../../../src/gui/itemviews/qdatawidgetmapper.h \
../../../include/QtGui/qdirmodel.h \
../../../src/gui/itemviews/qdirmodel.h \
../../../include/QtGui/qfileiconprovider.h \
../../../src/gui/itemviews/qfileiconprovider.h \
../../../include/QtGui/qheaderview.h \
../../../src/gui/itemviews/qheaderview.h \
../../../include/QtGui/qitemdelegate.h \
../../../src/gui/itemviews/qitemdelegate.h \
../../../include/QtGui/qitemeditorfactory.h \
../../../src/gui/itemviews/qitemeditorfactory.h \
../../../include/QtGui/qlistwidget.h \
../../../src/gui/itemviews/qlistwidget.h \
../../../include/QtGui/qproxymodel.h \
../../../src/gui/itemviews/qproxymodel.h \
../../../include/QtGui/qsortfilterproxymodel.h \
../../../src/gui/itemviews/qsortfilterproxymodel.h \
../../../include/QtGui/qstandarditemmodel.h \
../../../src/gui/itemviews/qstandarditemmodel.h \
../../../include/QtGui/qstringlistmodel.h \
../../../src/gui/itemviews/qstringlistmodel.h \
../../../include/QtGui/qstyleditemdelegate.h \
../../../src/gui/itemviews/qstyleditemdelegate.h \
../../../include/QtGui/qtableview.h \
../../../src/gui/itemviews/qtableview.h \
../../../include/QtGui/qtablewidget.h \
../../../src/gui/itemviews/qtablewidget.h \
../../../include/QtGui/qtreeview.h \
../../../src/gui/itemviews/qtreeview.h \
../../../include/QtGui/qtreewidget.h \
../../../src/gui/itemviews/qtreewidget.h \
../../../include/QtGui/qtreewidgetitemiterator.h \
../../../src/gui/itemviews/qtreewidgetitemiterator.h \
../../../include/QtGui/qgraphicseffect.h \
../../../src/gui/effects/qgraphicseffect.h \
../../../include/QtGui/qs60mainapplication.h \
../../../src/gui/s60framework/qs60mainapplication.h \
../../../include/QtGui/qs60mainappui.h \
../../../src/gui/s60framework/qs60mainappui.h \
../../../include/QtGui/qs60maindocument.h \
../../../src/gui/s60framework/qs60maindocument.h \
../../../include/QtGui/qinputcontext.h \
../../../src/gui/inputmethod/qinputcontext.h \
../../../include/QtGui/qinputcontextfactory.h \
../../../src/gui/inputmethod/qinputcontextfactory.h \
../../../include/QtGui/qinputcontextplugin.h \
../../../src/gui/inputmethod/qinputcontextplugin.h \
../../../include/QtGui/qabstractpagesetupdialog.h \
../../../src/gui/dialogs/qabstractpagesetupdialog.h \
../../../include/QtGui/qabstractprintdialog.h \
../../../src/gui/dialogs/qabstractprintdialog.h \
../../../include/QtGui/qcolordialog.h \
../../../src/gui/dialogs/qcolordialog.h \
../../../include/QtGui/qerrormessage.h \
../../../src/gui/dialogs/qerrormessage.h \
../../../include/QtGui/qfilesystemmodel.h \
../../../src/gui/dialogs/qfilesystemmodel.h \
../../../include/QtGui/qfontdialog.h \
../../../src/gui/dialogs/qfontdialog.h \
../../../include/QtGui/qinputdialog.h \
../../../src/gui/dialogs/qinputdialog.h \
../../../include/QtGui/qmessagebox.h \
../../../src/gui/dialogs/qmessagebox.h \
../../../include/QtGui/qpagesetupdialog.h \
../../../src/gui/dialogs/qpagesetupdialog.h \
../../../include/QtGui/qprintdialog.h \
../../../src/gui/dialogs/qprintdialog.h \
../../../include/QtGui/qprintpreviewdialog.h \
../../../src/gui/dialogs/qprintpreviewdialog.h \
../../../include/QtGui/qprogressdialog.h \
../../../src/gui/dialogs/qprogressdialog.h \
../../../include/QtGui/qwizard.h \
../../../src/gui/dialogs/qwizard.h \
../../../include/QtGui/qvfbhdr.h \
../../../src/gui/embedded/qvfbhdr.h \
../../../include/QtGui/qwsembedwidget.h \
../../../src/gui/embedded/qwsembedwidget.h \
.moc/debug-shared/main.moc
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/debug-shared/main.o main.cpp
.obj/debug-shared/qrc_animatedtiles.o: .rcc/debug-shared/qrc_animatedtiles.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o .obj/debug-shared/qrc_animatedtiles.o .rcc/debug-shared/qrc_animatedtiles.cpp
####### Install
install_target: all FORCE
@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/animatedtiles.app"
-$(INSTALL_DIR) "animatedtiles.app" "$(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/animatedtiles.app"
uninstall_target: FORCE
-$(DEL_FILE) -r "$(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/animatedtiles.app"
-$(DEL_DIR) $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
install_sources: all FORCE
@$(CHK_DIR_EXISTS) $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/ || $(MKDIR) $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
-$(INSTALL_FILE) /Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/examples/animation/animatedtiles/main.cpp $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
-$(INSTALL_FILE) /Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/examples/animation/animatedtiles/animatedtiles.qrc $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
-$(INSTALL_FILE) /Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/examples/animation/animatedtiles/animatedtiles.pro $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
-$(INSTALL_DIR) /Users/ssangkong/NVRAM_KWU/qt-everywhere-opensource-src-4.7.4/examples/animation/animatedtiles/images $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
uninstall_sources: FORCE
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/main.cpp
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/animatedtiles.qrc
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/animatedtiles.pro
-$(DEL_FILE) -r $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/images
-$(DEL_DIR) $(INSTALL_ROOT)/usr/local/Trolltech/Qt-4.7.4/examples/animation/animatedtiles/
install: install_target install_sources FORCE
uninstall: uninstall_target uninstall_sources FORCE
FORCE:
| ssangkong/NVRAM_KWU | qt-everywhere-opensource-src-4.7.4/examples/animation/animatedtiles/Makefile | Makefile | lgpl-3.0 | 84,057 |
package repack.org.bouncycastle.crypto.agreement;
import repack.org.bouncycastle.crypto.BasicAgreement;
import repack.org.bouncycastle.crypto.CipherParameters;
import repack.org.bouncycastle.crypto.params.ECDomainParameters;
import repack.org.bouncycastle.crypto.params.ECPrivateKeyParameters;
import repack.org.bouncycastle.crypto.params.ECPublicKeyParameters;
import repack.org.bouncycastle.crypto.params.MQVPrivateParameters;
import repack.org.bouncycastle.crypto.params.MQVPublicParameters;
import repack.org.bouncycastle.math.ec.ECAlgorithms;
import repack.org.bouncycastle.math.ec.ECConstants;
import repack.org.bouncycastle.math.ec.ECPoint;
import java.math.BigInteger;
public class ECMQVBasicAgreement
implements BasicAgreement
{
MQVPrivateParameters privParams;
public void init(
CipherParameters key)
{
this.privParams = (MQVPrivateParameters) key;
}
public BigInteger calculateAgreement(CipherParameters pubKey)
{
MQVPublicParameters pubParams = (MQVPublicParameters) pubKey;
ECPrivateKeyParameters staticPrivateKey = privParams.getStaticPrivateKey();
ECPoint agreement = calculateMqvAgreement(staticPrivateKey.getParameters(), staticPrivateKey,
privParams.getEphemeralPrivateKey(), privParams.getEphemeralPublicKey(),
pubParams.getStaticPublicKey(), pubParams.getEphemeralPublicKey());
return agreement.getX().toBigInteger();
}
// The ECMQV Primitive as described in SEC-1, 3.4
private ECPoint calculateMqvAgreement(
ECDomainParameters parameters,
ECPrivateKeyParameters d1U,
ECPrivateKeyParameters d2U,
ECPublicKeyParameters Q2U,
ECPublicKeyParameters Q1V,
ECPublicKeyParameters Q2V)
{
BigInteger n = parameters.getN();
int e = (n.bitLength() + 1) / 2;
BigInteger powE = ECConstants.ONE.shiftLeft(e);
// The Q2U public key is optional
ECPoint q;
if(Q2U == null)
{
q = parameters.getG().multiply(d2U.getD());
}
else
{
q = Q2U.getQ();
}
BigInteger x = q.getX().toBigInteger();
BigInteger xBar = x.mod(powE);
BigInteger Q2UBar = xBar.setBit(e);
BigInteger s = d1U.getD().multiply(Q2UBar).mod(n).add(d2U.getD()).mod(n);
BigInteger xPrime = Q2V.getQ().getX().toBigInteger();
BigInteger xPrimeBar = xPrime.mod(powE);
BigInteger Q2VBar = xPrimeBar.setBit(e);
BigInteger hs = parameters.getH().multiply(s).mod(n);
// ECPoint p = Q1V.getQ().multiply(Q2VBar).add(Q2V.getQ()).multiply(hs);
ECPoint p = ECAlgorithms.sumOfTwoMultiplies(
Q1V.getQ(), Q2VBar.multiply(hs).mod(n), Q2V.getQ(), hs);
if(p.isInfinity())
{
throw new IllegalStateException("Infinity is not a valid agreement value for MQV");
}
return p;
}
}
| SafetyCulture/DroidText | app/src/main/java/bouncycastle/repack/org/bouncycastle/crypto/agreement/ECMQVBasicAgreement.java | Java | lgpl-3.0 | 2,651 |
/**
* Copyright (C) 2015 Łukasz Tomczak <[email protected]>.
*
* This file is part of OpenInTerminal plugin.
*
* OpenInTerminal plugin is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* OpenInTerminal plugin 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 OpenInTerminal plugin. If not, see <http://www.gnu.org/licenses/>.
*/
package settings;
/**
* @author Łukasz Tomczak <[email protected]>
*/
public class OpenInTerminalSettingsState {
private String terminalCommand;
private String terminalCommandOptions;
public OpenInTerminalSettingsState() {
}
public OpenInTerminalSettingsState(String terminalCommand, String terminalCommandOptions) {
this.terminalCommand = terminalCommand;
this.terminalCommandOptions = terminalCommandOptions;
}
public String getTerminalCommand() {
return terminalCommand;
}
public void setTerminalCommand(String terminalCommand) {
this.terminalCommand = terminalCommand;
}
public String getTerminalCommandOptions() {
return terminalCommandOptions;
}
public void setTerminalCommandOptions(String terminalCommandOptions) {
this.terminalCommandOptions = terminalCommandOptions;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
OpenInTerminalSettingsState that = (OpenInTerminalSettingsState) o;
if (!terminalCommand.equals(that.terminalCommand)) return false;
return terminalCommandOptions.equals(that.terminalCommandOptions);
}
@Override
public int hashCode() {
int result = terminalCommand.hashCode();
result = 31 * result + terminalCommandOptions.hashCode();
return result;
}
}
| luktom/OpenInTerminal | src/main/java/settings/OpenInTerminalSettingsState.java | Java | lgpl-3.0 | 2,288 |
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* gmpy_mpz_prp.h *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Python interface to the GMP or MPIR, MPFR, and MPC multiple precision *
* libraries. *
* *
* Copyright 2012 - 2022 Case Van Horsen *
* *
* This file is part of GMPY2. *
* *
* GMPY2 is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License, or (at your *
* option) any later version. *
* *
* GMPY2 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 GMPY2; if not, see <http://www.gnu.org/licenses/> *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifndef GMPY_PRP_H
#define GMPY_PRP_H
#ifdef __cplusplus
extern "C" {
#endif
static PyObject * GMPY_mpz_is_fermat_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_euler_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_strong_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_fibonacci_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_lucas_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_stronglucas_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_extrastronglucas_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_selfridge_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_strongselfridge_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_bpsw_prp(PyObject *self, PyObject *args);
static PyObject * GMPY_mpz_is_strongbpsw_prp(PyObject *self, PyObject *args);
#ifdef __cplusplus
}
#endif
#endif
| aleaxit/gmpy | src/gmpy_mpz_prp.h | C | lgpl-3.0 | 2,732 |
<?php
namespace pocketmine\item;
class Melon extends Food{
public function __construct($meta = 0, $count = 1){
parent::__construct(self::MELON, $meta, $count, "Melon");
}
public function getFoodRestore(){
return 2;
}
public function getSaturationRestore(){
return 1.2;
}
}
| ClearSkyTeam/ClearSky | src/pocketmine/item/Melon.php | PHP | lgpl-3.0 | 289 |
require 'support/matchers/type'
| ehannes/fortnox-api | spec/support/matchers.rb | Ruby | lgpl-3.0 | 32 |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_PUTCONFIGURATIONSETDELIVERYOPTIONSREQUEST_P_H
#define QTAWS_PUTCONFIGURATIONSETDELIVERYOPTIONSREQUEST_P_H
#include "pinpointemailrequest_p.h"
#include "putconfigurationsetdeliveryoptionsrequest.h"
namespace QtAws {
namespace PinpointEmail {
class PutConfigurationSetDeliveryOptionsRequest;
class PutConfigurationSetDeliveryOptionsRequestPrivate : public PinpointEmailRequestPrivate {
public:
PutConfigurationSetDeliveryOptionsRequestPrivate(const PinpointEmailRequest::Action action,
PutConfigurationSetDeliveryOptionsRequest * const q);
PutConfigurationSetDeliveryOptionsRequestPrivate(const PutConfigurationSetDeliveryOptionsRequestPrivate &other,
PutConfigurationSetDeliveryOptionsRequest * const q);
private:
Q_DECLARE_PUBLIC(PutConfigurationSetDeliveryOptionsRequest)
};
} // namespace PinpointEmail
} // namespace QtAws
#endif
| pcolby/libqtaws | src/pinpointemail/putconfigurationsetdeliveryoptionsrequest_p.h | C | lgpl-3.0 | 1,670 |
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterUsersTable2 extends Migration
{
/**
* Run the migrations.
*
* Here, we are adding a new column to the users table called "age_range"
*
* They types of values we store in here will be:
* - under_18
* - 18_24
* - etc.
*
* @return void
*/
public function up()
{
Schema::table('users', function (Blueprint $table) {
$table->string('age_range')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['age_range']);
});
}
}
| travishathaway/canopy-story | database/migrations/2017_07_24_011059_alter_users_table_2.php | PHP | lgpl-3.0 | 843 |
<h3>Lucky Guess? Or Calculated Risk?</h3>
<h4>(λ)</h4>
<p>From the example on the previous page, it looks like our game will need at least 3 different kinds of expressions:<code>guess</code>, <code>smaller</code>, and <code>bigger</code>.</p>
<p>For the expressions to do what we want, we need to define the functions behind them.</p>
<p>Before we do that, let's think about the strategy behind this simple game. The basic steps are:
<ul>
<li><span>set the upper and lower limits of the player's number</span></li>
<li><span>guess a number halfway between the upper and lower limits</span></li>
<li><span>lower the upper limit if the player says the number is smaller</span></li>
<li><span>raise the lower limit if the player says the number is bigger</span></li>
</ul>
</p>
<p>I'll let you in on a secret: your program won't actually <em>guess</em> the number, it will <em>find</em> it using a simple and effective <font class="red">binary search</font> algorithm.</p>
<p>The risk? There isn't one… seemed like a cool title.</p>
<p>Now type: <code class="expr">(define lower 1)</code></p>
<aside id="info">
<span><font class="red">binary search</font><br>divides a range of values into halves, and continues to narrow down the field of search until the unknown value is found. It is the classic example of a "divide and conquer" algorithm.</span>
</aside>
| arguello/trycode.io | templates/tutorial/0004.html | HTML | lgpl-3.0 | 1,374 |
<!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' lang='he' dir='rtl'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1255' />
<meta charset='windows-1255' />
<meta http-equiv='Content-Script-Type' content='text/javascript' />
<meta http-equiv='revisit-after' content='15 days' />
<title>òùå ëîå òùá</title>
<link rel='stylesheet' type='text/css' href='../../_script/klli.css' />
<link rel='stylesheet' type='text/css' href='../../tnk1/_themes/klli.css' />
<meta property='og:url' content='https://tora.us.fm/tnk1/messages/prqim_t0125_2.html'/>
<meta name='author' content="çâé äåôø" />
<meta name='receiver' content="" />
<meta name='jmQovc' content="tnk1/messages/prqim_t0125_2.html" />
<meta name='tvnit' content="" />
<link rel='canonical' href='https://tora.us.fm/tnk1/messages/prqim_t0125_2.html' />
</head>
<!--
PHP Programming by Erel Segal-Halevi
-->
<body lang='he' dir='rtl' id = 'tnk1_messages_prqim_t0125_2' class='prfym1 '>
<div class='pnim'>
<script type='text/javascript' src='../../_script/vars.js'></script>
<!--NiwutElyon0-->
<div class='NiwutElyon'>
<div class='NiwutElyon'><a class='link_to_homepage' href='../../tnk1/index.html'>øàùé</a>><a href='../../tnk1/dmut/index.html'>àéùéí áúð"ê</a>><a href='../../tnk1/sig/prtdmut.html'>ôøèé ãîåéåú</a>><a href='../../tnk1/dmut/mjmauyot.html'>îùîòåéåú ùì ùîåú</a>></div>
</div>
<!--NiwutElyon1-->
<h1 id='h1'>òùå ëîå òùá</h1>
<div id='idfields'>
<p>÷åã: òùå ëîå òùá áúð"ê</p>
<p>ñåâ: ôøèéí1</p>
<p>îàú: çâé äåôø</p>
<p>àì: </p>
</div>
<script type='text/javascript'>kotrt()</script>
<div id='tokn'>
"åéöà äøàùåï àãîåðé ëåìå ëàãøú ùéòø åé÷øàå ùîå òùå" (áøàùéú, ëä', 25).<br />ôéøåù äùí - ëîå òùá. åòùå âí äâãéì ìòùåú áöéãå, àê æäå ëáø ãøù (åáàéåá, îà', 5 - "àéï òì àôø îùìå äòùå ìáìé çú", åáàéåá, î', 19 - "äåà øàùéú ãøëé àì äòùå éâù çøáå", ëùí ùááøàùéú, ëæ', 40 äåà àåîø - "òì çøáê úçéä")
<br />
<br />
</div><!--tokn-->
<h2 id='tguvot'>úâåáåú</h2>
<ul id='ultguvot'>
<li></li>
</ul><!--end-->
<script type='text/javascript'>tguva(); txtit()</script>
</div><!--pnim-->
</body>
</html>
| erelsgl/erel-sites | tnk1/messages/prqim_t0125_2.html | HTML | lgpl-3.0 | 2,218 |
<!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' lang='he' dir='rtl'>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=windows-1255' />
<meta http-equiv='Content-Script-Type' content='text/javascript' />
<meta http-equiv='revisit-after' content='15 days' />
<title>ìçùåá ìôðé ùîãáøéí - ëãé ìà ìäâéã ùèåéåú</title>
<link rel='stylesheet' type='text/css' href='../../../_script/klli.css' />
<link rel='stylesheet' type='text/css' href='../../../tnk1/_themes/klli.css' />
<meta property='og:url' content='http://tora.us.fm/tnk1/ktuv/mjly/mj-18-13.html'/>
<meta name='author' content="àøàì (äâää: éòì)" />
<meta name='receiver' content="ñâìåú îùìé" />
<meta name='jmQovc' content="tnk1/ktuv/mjly/mj-18-13.html" />
<meta name='tvnit' content="" />
<link rel='canonical' href='http://tora.us.fm/tnk1/ktuv/mjly/mj-18-13.html' />
</head>
<!--
PHP Programming by Erel Segal - Rent a Brain http://tora.us.fm/rentabrain
-->
<body lang='he' dir='rtl' id = 'tnk1_ktuv_mjly_mj_18_13' class='twkn1 '>
<div class='pnim'>
<script type='text/javascript' src='../../../_script/vars.js'></script>
<!--NiwutElyon0-->
<div class='NiwutElyon'>
<div class='NiwutElyon'><a class='link_to_homepage' href='../../../tnk1/index.html'>øàùé</a>><a href='../../../tnk1/prqim/ktuv.html'>ëúåáéí</a>><a href='../../../tnk1/prqim/t28.htm'>îùìé</a>><a href='../../../tnk1/ktuv/mjly/sgulot.html'>ñâìåú îùìé ìôé ôø÷éí</a>><a href='../../../tnk1/ktuv/mjly/sgulot18.html'>ñâìåú îùìé éç</a>></div>
<div class='NiwutElyon'><a class='link_to_homepage' href='../../../tnk1/index.html'>øàùé</a>><a href='../../../tnk1/msr/0.html'>áéï àãí ìðôùå</a>><a href='../../../tnk1/msr/0hamqa.html'>äòî÷ä</a>><a href='../../../tnk1/ktuv/mjly/ewil_dibur.html'>àåéìéí åãéáåøéí</a>></div>
<div class='NiwutElyon'><a class='link_to_homepage' href='../../../tnk1/index.html'>øàùé</a>><a href='../../../tnk1/msr/3.html'>áéï àãí ìçáøå</a>><a href='../../../tnk1/ktuv/mjly/dibur_wjtiqa.html'>ãéáåøéí</a>><a href='../../../tnk1/msr/3wikux.html'>åéëåçéí</a>><a href='../../../tnk1/msr/svlnut_dibur.html'>ñáìðåú áãéáåø</a>></div>
<div class='NiwutElyon'><a class='link_to_homepage' href='../../../tnk1/index.html'>øàùé</a>><a href='../../../tnk1/msr/0.html'>áéï àãí ìðôùå</a>><a href='../../../tnk1/msr/0xpzon.html'>îéãú äçéôæåï</a>></div>
</div>
<!--NiwutElyon1-->
<h1 id='h1'>ìçùåá ìôðé ùîãáøéí - ëãé ìà ìäâéã ùèåéåú</h1>
<div id='idfields'>
<p>÷åã: áéàåø:îùìé éç13 áúð"ê</p>
<p>ñåâ: úåëï1</p>
<p>îàú: àøàì (äâää: éòì)</p>
<p>àì: ñâìåú îùìé</p>
</div>
<script type='text/javascript'>kotrt()</script>
<div id='tokn'>
<p>
<a class="psuq" href="/tnk1/prqim/t2818.htm#13">îùìé éç13</a>: "<q class="psuq">îÅùÑÄéá ãÌÈáÈø áÌÀèÆøÆí éÄùÑÀîÈò - àÄåÌÆìÆú äÄéà ìåÉ åëÀìÄîÌÈä</q>"</p>
<p>îé ùòåðä
<strong>úùåáä</strong> ìôðé
<strong>ùùîò</strong> (äáéï) òã äñåó àú äèòðä ùì äöã äùðé - úùåáúå úäéä
<strong>àåéìéú</strong> (ùèçéú) åúáéà òìéå áåùä
<strong>åëìéîä</strong>.</p>
<h2>òöåú</h2>
<p>ìôòîéí, áîäìê åéëåç ñåòø, àçã äöããéí îáéï ùäåà èòä, àáì ÷ùä ìå
ìäåãåú áèòåú; äåà äâï ëì-ëê áìäè òì òîãúå, ù÷ùä ìå ìäåãåú ùëì ääúìäáåú
äæàú äéúä áçéðí. àí éáéò çøèä, äåà òìåì ìáééù àú òöîå. äôúøåï ìáòéä æå äåà ìäéæäø - ìà ìäâéã àú ëì îä ùçåùáéí
ááú-àçú:
</p>
<p>
<strong>ãáø</strong>
<a href="/tnk1/kma/qjrim1/dbr.html">= ãéáåø</a>;
<strong>  éùîò</strong>
<a href="/tnk1/kma/hvdlim1/jma_hqjiv.html"> = éáéï</a>;   åäôñå÷ îìîãðå, ùìôðé ùäàãí
<strong>îùéá áãéáåøå</strong>, äåà öøéê
<strong>ìùîåò</strong> åìäáéï äéèá àú äùàìä àå äèòðä ùäåà îùéá òìéä.
</p>
<p>
<strong>àéååìú</strong>
<a href="/tnk1/kma/qjrim1/ewil.html"> = ùèçéåú</a>;   åäôñå÷ îìîãðå, ùîé ùàéðå çåùá ìôðé ùäåà òåðä - òìåì ìòðåú úùåáä ùèçéú, ùúëìéí àåúå áôðé äùåîòéí.
</p>
<p>éùðï ëîä ñéáåú ùáâììï àðùéí èåòéí å"îùéáéí ãáø áèøí éùîòå". ðúàø àåúï áäãøâä îä÷ìä àì ä÷ùä:
</p>
<ul>
<li>
äñéáä ä÷ìä áéåúø (ëìåîø, äëé ôçåú îæé÷ä) äéà
<strong>äøöåï ìäôâéï éãò</strong>: ñéáä æå îàôééðú úìîéãéí áëéúä àå îúîåããéí áçéãåï, ùîøåá äúìäáåúí ìäôâéï àú éãéòåúéäí,
<q class="psuq">îùéáéí</q> îééã ìàçø ùäùåàì äúçéì ìùàåì, òåã
<q class="psuq">ìôðé ùùîòå</q> àú ñåó äùàìä. ìôòîéí äí èåòéí åòåðéí òì ùàìä ùåðä îæå ùäúëååï äùåàì ìùàåì (<q class="psuq">àéååìú</q>), ãáø ùîòìä çéåëéí òì ôðéäí ùì äúìîéãéí àå äîúîåããéí äàçøéí (<q class="psuq">ëìéîä</q>), áîéåçã àí äçéãåï äåà çéãåï úð"ê... </li>
<li>
ñéáä ÷ùä éåúø äéà
<strong>äøöåï ìäåëéç òîãä</strong>: ñéáä æå îàôééðú àðùéí ùîòåøáéí áåéëåç ñåòø, áîéåçã òì ø÷ò àéãéàåìåâé, ùîøåá ìäéèåúí ìäåëéç àú öã÷ú òîãúí, äí çåùùéí ùäåéëåç éñúééí ìôðé ùéñôé÷å ìäâéã àú ãòúí, å-
<q class="psuq">îùéáéí</q> ìèòðåú ùì äéøéá òåã
<q class="psuq">ìôðé ùùîòå åäáéðå</q> àåúï òã äñåó. ìôòîéí äí ìà òåðéí áãéå÷ òì äèòðåú ùì äéøéá àìà òì èòðåú ÷öú ùåðåú, åáëì î÷øä ëàùø òåðéí îäø îãé äúùåáåú äï áøîä ðîåëä (<q class="psuq">àéååìú</q>), å÷ì îàã ìéøéá ìãçåú àåúï (<q class="psuq">ëìéîä</q>).</li>
<li>
äñéáä ÷ùä éåúø äéà
<strong>äæìæåì</strong>: ñéáä æå îàôééðú àðùéí áòìé äù÷ôú-òåìí îâåáùú åáèçåï òöîé øá. ëàùø îéùäå áà åèåòï èòðä ðâã äù÷ôú äòåìí ùìäí, äí áèåçéí ùäí ëáø ùîòå àú äèòðä äæàú, åùëáø éù ìäí úùåáä (ùîöàå áòöîí áòáø, àå ù÷øàå áñôø/áòéúåï). àéï ìäí æîï ìçùåá îçãù - äí ôùåè ùåìôéí úùåáä îåëðä
<q class="psuq">åîùéáéí, </q>
<q class="psuq">ìôðé ùùîòå</q> åäáéðå òã äñåó àú äèòðä (åáðéâåã ìñòéó ä÷åãí - äí ìà ôåòìéí îúåê ìäéèåú åñòøú-øâùåú, àìà îúåê áèçåï òöîé îåôøæ). àê áëì èòðä, âí àí äéà ðùîòú îåëøú, éù çéãåù; åëàùø îðñéí "ìçñåê" åìòðåú úùåáåú îåëðåú ìèòðåú çãùåú - äúåöàä äéà úùåáåú ìà ðëåðåú (<q class="psuq">àéååìú</q>), ùâåøîåú ðæ÷ ìäù÷ôú äòåìí ùòìéä îðñéí ìäâï (<q class="psuq">ëìéîä</q>).</li></ul>
<p>äîùåúó ìëì äñéáåú äåà - çåñø ñáìðåú. åäîñø - ìä÷ùéá åìçùåá äéèá ìôðé ùòåðéí! áéï àí îãåáø áëéúä àå áåéëåç, áðåùà ìéîåãé àéùé àå àéãéàåìåâé - öøéê ìä÷ùéá äéèá ìãáøé äöã äùðé, ìçùåá òìéäí, ìòëì àåúí, ìùúå÷ ëîä ùðéåú (ìôçåú), åø÷ àçø-ëê ìäùéá.
</p>
<p>åëê àîøå çæ"ì: "<q class="mfrj">çëí... àéðå ðáäì ìäùéá... åçéìåôéäï áâåìí</q>"
<small>(<a href="http://www.mechon-mamre.org/b/h/h49.htm">îùðä àáåú ä å</a>)</small>.</p>
<h2>ä÷áìåú</h2>
<p>äôñå÷ îîùéê àú äôñå÷ ä÷åãí, äîãáø òì âåáä ìá, ëé äâàåä âåøîú "<q class="mfrj">ìäéåú äàãí ðáäì ìäùéá, ëé ðøàä ìå ùàí éàçø áîòðä ôéå, ééâøò îòøëå åîçæ÷úå, åæä âåøí ùëîä ôòîéí éùéá ãáøéí ùìà ëäìëä, ëãé ìîäø úùåáúå ìùåàì...</q>"
<small class="small"> (øî"ã ååàìé)</small>.</p>
<div class="advanced">
<h2>"îùéá ãáø" áàéðèøðè
</h2>
<p>àðé ëåúá áôåøåîéí áàéðèøðè ëáø ùðéí øáåú. ôòîéí øáåú àðé øåàä áôåøåí äåãòä ùàðé îøâéù ùàðé çééá ìäâéá òìéä îééã. áäúçìä áàîú äééúé îâéá îééã, åëîòè úîéã äúçøèúé òì äúâåáä îàåçø éåúø, ëùøàéúé àéê äîâéáéí äáàéí "÷èìå" àåúä. àáì ôòí àçú, äúâåáä ùìé ìà ð÷ìèä áâìì ú÷ìä èëðéú, åðàìöúé áöòø øá ìëúåá àåúä ùåá ìîçøú. ìäôúòúé, äè÷ñè äùðé ùëúáúé äéä ááéøåø äøáä éåúø èåá, ù÷åì åøöéðé îäè÷ñè äøàùåï ùðîç÷ - ñåó-ñåó ôøñîúé úâåáä ùìà äúçøèúé òìéä îàåçø éåúø!</p>
<p>åàæ äçìèúé, ùëãàé ìðäåâ áàåúå àåôï âí ëùàéï ú÷ìä èëðéú: ôùåè ìùîåø àú äè÷ñè äøàùåï ùòåìä áãòúé á÷åáõ òì äîçùá ùìé, ìòáåø òìéå ùåá ìàçø ëîä ùòåú ëùääúøâùåú äøàùåðéú ùåëëú, åø÷ àæ ìôøñí. àó ôòí ìà äúçøèúé òì äîúðä îñåâ æä - ëì òéëåá áôøñåí úîéã äéä ìèåáä. </p>
<p>ìëï ùîçúé îàã ëùâéìéúé ùáùéøåú äãåàì ùì gmail ðéúï ìäåñéó äùäéä îúåçëîú ìôðé ùìéçú ãåàì. ðéúï ìá÷ù îäàúø, ùáëì ôòí ùùåìçéí ãåàì áùòåú îñåééîåú, äåà éùàì àú äùåìç çîù ùàìåú ôùåèåú áçùáåï, òì-îðú ìååãà ùäåà òøðé. àí äåà èåòä, äàúø àåîø ìå "àúä ëðøàä òééó, ìê úùúä îéí åúðåç, åúðñä ùåá". ëùæä ÷åøä ìé, àðé ÷åøà ùåá àú ëì ääåãòä, åëîòè úîéã îâìä ùèòéúé âí áäåãòä òöîä... îåîìõ!</p></div>
</div><!--tokn-->
<h2 id='tguvot'>úâåáåú</h2>
<ul id='ultguvot'>
</ul><!--end-->
<script type='text/javascript'>tguva(); txtit()</script>
</div><!--pnim-->
</body>
</html>
| erelsgl/erel-sites | tnk1/ktuv/mjly/mj-18-13.html | HTML | lgpl-3.0 | 7,954 |
package org.ocbc.utils;
import org.json.JSONObject;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
public class request {
public static JSONObject get(String url, HashMap<String, String> headers) {
BufferedReader in = null;
StringBuffer response = null;
try {
URL obj = new URL(url);
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
for (String key : headers.keySet()) {
con.setRequestProperty(key, headers.get(key));
}
in = new BufferedReader(new InputStreamReader(con.getInputStream()));
response = new StringBuffer();
String inputLine;
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
} catch(Exception exception) {
System.out.println(exception);
return null;
}
return new JSONObject(response.toString());
}
} | connect2ocbc/jocbc | src/main/java/org/ocbc/utils/request.java | Java | lgpl-3.0 | 1,151 |
/*
* Mounts a BitLocker Drive Encrypted (BDE) volume
*
* Copyright (C) 2011-2015, Joachim Metz <[email protected]>
*
* Refer to AUTHORS for acknowledgements.
*
* This software is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include <common.h>
#include <memory.h>
#include <types.h>
#include <stdio.h>
#if defined( HAVE_ERRNO_H )
#include <errno.h>
#endif
#if defined( HAVE_UNISTD_H )
#include <unistd.h>
#endif
#if defined( HAVE_STDLIB_H ) || defined( WINAPI )
#include <stdlib.h>
#endif
#if !defined( WINAPI ) || defined( USE_CRT_FUNCTIONS )
#if defined( TIME_WITH_SYS_TIME )
#include <sys/time.h>
#include <time.h>
#elif defined( HAVE_SYS_TIME_H )
#include <sys/time.h>
#else
#include <time.h>
#endif
#endif
#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE )
#define FUSE_USE_VERSION 26
#if defined( HAVE_LIBFUSE )
#include <fuse.h>
#elif defined( HAVE_LIBOSXFUSE )
#include <osxfuse/fuse.h>
#endif
#elif defined( HAVE_LIBDOKAN )
#include <dokan.h>
#endif
#include "bdeoutput.h"
#include "bdetools_libbde.h"
#include "bdetools_libcerror.h"
#include "bdetools_libclocale.h"
#include "bdetools_libcnotify.h"
#include "bdetools_libcstring.h"
#include "bdetools_libcsystem.h"
#include "mount_handle.h"
mount_handle_t *bdemount_mount_handle = NULL;
int bdemount_abort = 0;
/* Prints the executable usage information
*/
void usage_fprint(
FILE *stream )
{
if( stream == NULL )
{
return;
}
fprintf( stream, "Use bdemount to mount a BitLocker Drive Encrypted (BDE) volume\n\n" );
fprintf( stream, "Usage: bdemount [ -k keys ] [ -o offset ] [ -p password ]\n"
" [ -r password ] [ -s filename ] [ -X extended_options ]\n"
" [ -hvV ] source mount_point\n\n" );
fprintf( stream, "\tsource: the source file or device\n" );
fprintf( stream, "\tmount_point: the directory to serve as mount point\n\n" );
fprintf( stream, "\t-h: shows this help\n" );
fprintf( stream, "\t-k: the full volume encryption key and tweak key\n"
"\t formatted in base16 and separated by a : character\n"
"\t e.g. FKEV:TWEAK\n" );
fprintf( stream, "\t-o: specify the volume offset in bytes\n" );
fprintf( stream, "\t-p: specify the password/passphrase\n" );
fprintf( stream, "\t-r: specify the recovery password\n" );
fprintf( stream, "\t-s: specify the file containing the startup key.\n"
"\t typically this file has the extension .BEK\n" );
fprintf( stream, "\t-v: verbose output to stderr\n"
"\t bdemount will remain running in the foreground\n" );
fprintf( stream, "\t-V: print version\n" );
fprintf( stream, "\t-X: extended options to pass to sub system\n" );
}
/* Signal handler for bdemount
*/
void bdemount_signal_handler(
libcsystem_signal_t signal LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_signal_handler";
LIBCSYSTEM_UNREFERENCED_PARAMETER( signal )
bdemount_abort = 1;
if( bdemount_mount_handle != NULL )
{
if( mount_handle_signal_abort(
bdemount_mount_handle,
&error ) != 1 )
{
libcnotify_printf(
"%s: unable to signal mount handle to abort.\n",
function );
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
}
/* Force stdin to close otherwise any function reading it will remain blocked
*/
if( libcsystem_file_io_close(
0 ) != 0 )
{
libcnotify_printf(
"%s: unable to close stdin.\n",
function );
}
}
#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE )
#if ( SIZEOF_OFF_T != 8 ) && ( SIZEOF_OFF_T != 4 )
#error Size of off_t not supported
#endif
static char *bdemount_fuse_path = "/bde1";
static size_t bdemount_fuse_path_length = 5;
#if defined( HAVE_TIME )
time_t bdemount_timestamp = 0;
#endif
/* Opens a file
* Returns 0 if successful or a negative errno value otherwise
*/
int bdemount_fuse_open(
const char *path,
struct fuse_file_info *file_info )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_fuse_open";
size_t path_length = 0;
int result = 0;
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -EINVAL;
goto on_error;
}
if( file_info == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid file info.",
function );
result = -EINVAL;
goto on_error;
}
path_length = libcstring_narrow_string_length(
path );
if( ( path_length != bdemount_fuse_path_length )
|| ( libcstring_narrow_string_compare(
path,
bdemount_fuse_path,
bdemount_fuse_path_length ) != 0 ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path.",
function );
result = -ENOENT;
goto on_error;
}
if( ( file_info->flags & 0x03 ) != O_RDONLY )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE,
"%s: write access currently not supported.",
function );
result = -EACCES;
goto on_error;
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Reads a buffer of data at the specified offset
* Returns number of bytes read if successful or a negative errno value otherwise
*/
int bdemount_fuse_read(
const char *path,
char *buffer,
size_t size,
off_t offset,
struct fuse_file_info *file_info )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_fuse_read";
size_t path_length = 0;
ssize_t read_count = 0;
int result = 0;
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -EINVAL;
goto on_error;
}
if( size > (size_t) INT_MAX )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
"%s: invalid size value exceeds maximum.",
function );
result = -EINVAL;
goto on_error;
}
if( file_info == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid file info.",
function );
result = -EINVAL;
goto on_error;
}
path_length = libcstring_narrow_string_length(
path );
if( ( path_length != bdemount_fuse_path_length )
|| ( libcstring_narrow_string_compare(
path,
bdemount_fuse_path,
bdemount_fuse_path_length ) != 0 ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path.",
function );
result = -ENOENT;
goto on_error;
}
if( mount_handle_seek_offset(
bdemount_mount_handle,
(off64_t) offset,
SEEK_SET,
&error ) == -1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_IO,
LIBCERROR_IO_ERROR_SEEK_FAILED,
"%s: unable to seek offset in mount handle.",
function );
result = -EIO;
goto on_error;
}
read_count = mount_handle_read_buffer(
bdemount_mount_handle,
(uint8_t *) buffer,
size,
&error );
if( read_count == -1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_IO,
LIBCERROR_IO_ERROR_READ_FAILED,
"%s: unable to read from mount handle.",
function );
result = -EIO;
goto on_error;
}
return( (int) read_count );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Sets the values in a stat info structure
* Returns 1 if successful or -1 on error
*/
int bdemount_fuse_set_stat_info(
struct stat *stat_info,
uint64_t creation_time,
uint64_t modification_time,
uint64_t access_time,
size64_t size,
int number_of_sub_items,
uint8_t use_mount_time,
libcerror_error_t **error )
{
static char *function = "bdemount_fuse_set_stat_info";
if( stat_info == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid stat info.",
function );
return( -1 );
}
if( use_mount_time == 0 )
{
/* TODO check size fo time_t if 64-bit allow for more precision */
if( creation_time != 0 )
{
creation_time /= 10000000;
if( creation_time < 11644473600UL )
{
creation_time = 0;
}
else
{
creation_time -= 11644473600UL;
}
/* TODO check upper bound */
stat_info->st_ctime = (time_t) creation_time;
}
if( modification_time != 0 )
{
modification_time /= 10000000;
if( modification_time < 11644473600UL )
{
modification_time = 0;
}
else
{
modification_time -= 11644473600UL;
}
/* TODO check upper bound */
stat_info->st_mtime = (time_t) modification_time;
}
if( access_time != 0 )
{
access_time /= 10000000;
if( access_time < 11644473600UL )
{
access_time = 0;
}
else
{
access_time -= 11644473600UL;
}
/* TODO check upper bound */
stat_info->st_atime = (time_t) access_time;
}
}
#if defined( HAVE_TIME )
else
{
if( bdemount_timestamp == 0 )
{
if( time(
&bdemount_timestamp ) == (time_t) -1 )
{
bdemount_timestamp = 0;
}
}
stat_info->st_atime = bdemount_timestamp;
stat_info->st_mtime = bdemount_timestamp;
stat_info->st_ctime = bdemount_timestamp;
}
#endif
if( size != 0 )
{
#if SIZEOF_OFF_T <= 4
if( size > (size64_t) UINT32_MAX )
#else
if( size > (size64_t) INT64_MAX )
#endif
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS,
"%s: invalid size value out of bounds.",
function );
return( -1 );
}
stat_info->st_size = (off_t) size;
}
if( number_of_sub_items > 0 )
{
stat_info->st_mode = S_IFDIR | 0555;
stat_info->st_nlink = 2;
}
else
{
stat_info->st_mode = S_IFREG | 0444;
stat_info->st_nlink = 1;
}
#if defined( HAVE_GETEUID )
stat_info->st_uid = geteuid();
#endif
#if defined( HAVE_GETEGID )
stat_info->st_gid = getegid();
#endif
return( 1 );
}
/* Fills a directory entry
* Returns 1 if successful or -1 on error
*/
int bdemount_fuse_filldir(
void *buffer,
fuse_fill_dir_t filler,
char *name,
size_t name_size,
struct stat *stat_info,
mount_handle_t *mount_handle,
uint8_t use_mount_time,
libcerror_error_t **error )
{
static char *function = "bdemount_fuse_filldir";
size64_t volume_size = 0;
uint64_t creation_time = 0;
int number_of_sub_items = 0;
if( filler == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid filler.",
function );
return( -1 );
}
if( mount_handle == NULL )
{
number_of_sub_items = 1;
}
else
{
if( mount_handle_get_creation_time(
mount_handle,
&creation_time,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve creation time.",
function );
return( -1 );
}
if( mount_handle_get_size(
mount_handle,
&volume_size,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve volume size.",
function );
return( -1 );
}
}
if( memory_set(
stat_info,
0,
sizeof( struct stat ) ) == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_SET_FAILED,
"%s: unable to clear stat info.",
function );
return( -1 );
}
if( bdemount_fuse_set_stat_info(
stat_info,
creation_time,
creation_time,
creation_time,
volume_size,
number_of_sub_items,
use_mount_time,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set stat info.",
function );
return( -1 );
}
if( filler(
buffer,
name,
stat_info,
0 ) == 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set directory entry.",
function );
return( -1 );
}
return( 1 );
}
/* Reads a directory
* Returns 0 if successful or a negative errno value otherwise
*/
int bdemount_fuse_readdir(
const char *path,
void *buffer,
fuse_fill_dir_t filler,
off_t offset LIBCSYSTEM_ATTRIBUTE_UNUSED,
struct fuse_file_info *file_info LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
struct stat *stat_info = NULL;
static char *function = "bdemount_fuse_readdir";
size_t path_length = 0;
int result = 0;
LIBCSYSTEM_UNREFERENCED_PARAMETER( offset )
LIBCSYSTEM_UNREFERENCED_PARAMETER( file_info )
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -EINVAL;
goto on_error;
}
path_length = libcstring_narrow_string_length(
path );
if( ( path_length != 1 )
|| ( path[ 0 ] != '/' ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path.",
function );
result = -ENOENT;
goto on_error;
}
stat_info = memory_allocate_structure(
struct stat );
if( stat_info == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_INSUFFICIENT,
"%s: unable to create stat info.",
function );
result = errno;
goto on_error;
}
if( bdemount_fuse_filldir(
buffer,
filler,
".",
2,
stat_info,
NULL,
1,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set directory entry.",
function );
result = -EIO;
goto on_error;
}
if( bdemount_fuse_filldir(
buffer,
filler,
"..",
3,
stat_info,
NULL,
0,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set directory entry.",
function );
result = -EIO;
goto on_error;
}
if( bdemount_fuse_filldir(
buffer,
filler,
&( bdemount_fuse_path[ 1 ] ),
bdemount_fuse_path_length + 1,
stat_info,
bdemount_mount_handle,
0,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set directory entry.",
function );
result = -EIO;
goto on_error;
}
memory_free(
stat_info );
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
if( stat_info != NULL )
{
memory_free(
stat_info );
}
return( result );
}
/* Retrieves the file stat info
* Returns 0 if successful or a negative errno value otherwise
*/
int bdemount_fuse_getattr(
const char *path,
struct stat *stat_info )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_fuse_getattr";
size64_t volume_size = 0;
uint64_t creation_time = 0;
size_t path_length = 0;
int number_of_sub_items = 0;
int result = -ENOENT;
uint8_t use_mount_time = 0;
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -EINVAL;
goto on_error;
}
if( stat_info == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid stat info.",
function );
result = -EINVAL;
goto on_error;
}
if( memory_set(
stat_info,
0,
sizeof( struct stat ) ) == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_SET_FAILED,
"%s: unable to clear stat info.",
function );
result = errno;
goto on_error;
}
path_length = libcstring_narrow_string_length(
path );
if( path_length == 1 )
{
if( path[ 0 ] == '/' )
{
number_of_sub_items = 1;
use_mount_time = 1;
result = 0;
}
}
else if( path_length == bdemount_fuse_path_length )
{
if( libcstring_narrow_string_compare(
path,
bdemount_fuse_path,
bdemount_fuse_path_length ) == 0 )
{
if( mount_handle_get_creation_time(
bdemount_mount_handle,
&creation_time,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve creation time.",
function );
result = -EIO;
goto on_error;
}
if( mount_handle_get_size(
bdemount_mount_handle,
&volume_size,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve volume size.",
function );
result = -EIO;
goto on_error;
}
result = 0;
}
}
if( result == 0 )
{
if( bdemount_fuse_set_stat_info(
stat_info,
creation_time,
creation_time,
creation_time,
volume_size,
number_of_sub_items,
use_mount_time,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set stat info.",
function );
result = -EIO;
goto on_error;
}
}
return( result );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Cleans up when fuse is done
*/
void bdemount_fuse_destroy(
void *private_data LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_fuse_destroy";
LIBCSYSTEM_UNREFERENCED_PARAMETER( private_data )
if( bdemount_mount_handle != NULL )
{
if( mount_handle_free(
&bdemount_mount_handle,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_FINALIZE_FAILED,
"%s: unable to free mount handle.",
function );
goto on_error;
}
}
return;
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return;
}
#elif defined( HAVE_LIBDOKAN )
static wchar_t *bdemount_dokan_path = L"\\BDE1";
static size_t bdemount_dokan_path_length = 5;
/* Opens a file or directory
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_CreateFile(
const wchar_t *path,
DWORD desired_access,
DWORD share_mode LIBCSYSTEM_ATTRIBUTE_UNUSED,
DWORD creation_disposition,
DWORD attribute_flags LIBCSYSTEM_ATTRIBUTE_UNUSED,
DOKAN_FILE_INFO *file_info )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_CreateFile";
size_t path_length = 0;
int result = 0;
LIBCSYSTEM_UNREFERENCED_PARAMETER( share_mode )
LIBCSYSTEM_UNREFERENCED_PARAMETER( attribute_flags )
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
if( ( desired_access & GENERIC_WRITE ) != 0 )
{
return( -ERROR_WRITE_PROTECT );
}
/* Ignore the share_mode
*/
if( creation_disposition == CREATE_NEW )
{
return( -ERROR_FILE_EXISTS );
}
else if( creation_disposition == CREATE_ALWAYS )
{
return( -ERROR_ALREADY_EXISTS );
}
else if( creation_disposition == OPEN_ALWAYS )
{
return( -ERROR_FILE_NOT_FOUND );
}
else if( creation_disposition == TRUNCATE_EXISTING )
{
return( -ERROR_FILE_NOT_FOUND );
}
else if( creation_disposition != OPEN_EXISTING )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid creation disposition.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
if( file_info == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid file info.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
path_length = libcstring_wide_string_length(
path );
if( path_length == 1 )
{
if( path[ 0 ] != (wchar_t) '\\' )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
}
else
{
if( ( path_length != bdemount_dokan_path_length )
|| ( libcstring_wide_string_compare(
path,
bdemount_dokan_path,
bdemount_dokan_path_length ) != 0 ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Opens a directory
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_OpenDirectory(
const wchar_t *path,
DOKAN_FILE_INFO *file_info LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_OpenDirectory";
size_t path_length = 0;
int result = 0;
LIBCSYSTEM_UNREFERENCED_PARAMETER( file_info )
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
path_length = libcstring_wide_string_length(
path );
if( ( path_length != 1 )
|| ( path[ 0 ] != (wchar_t) '\\' ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Closes a file or direcotry
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_CloseFile(
const wchar_t *path,
DOKAN_FILE_INFO *file_info LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_CloseFile";
int result = 0;
LIBCSYSTEM_UNREFERENCED_PARAMETER( file_info )
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Reads a buffer of data at the specified offset
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_ReadFile(
const wchar_t *path,
void *buffer,
DWORD number_of_bytes_to_read,
DWORD *number_of_bytes_read,
LONGLONG offset,
DOKAN_FILE_INFO *file_info LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_ReadFile";
size_t path_length = 0;
ssize_t read_count = 0;
int result = 0;
LIBCSYSTEM_UNREFERENCED_PARAMETER( file_info )
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
if( number_of_bytes_to_read > (DWORD) INT32_MAX )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
"%s: invalid number of bytes to read value exceeds maximum.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
if( number_of_bytes_read == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid number of bytes read.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
path_length = libcstring_wide_string_length(
path );
if( ( path_length != bdemount_dokan_path_length )
|| ( libcstring_wide_string_compare(
path,
bdemount_dokan_path,
bdemount_dokan_path_length ) != 0 ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
if( mount_handle_seek_offset(
bdemount_mount_handle,
(off64_t) offset,
SEEK_SET,
&error ) == -1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_IO,
LIBCERROR_IO_ERROR_SEEK_FAILED,
"%s: unable to seek offset in mount handle.",
function );
result = -ERROR_SEEK_ON_DEVICE;
goto on_error;
}
read_count = mount_handle_read_buffer(
bdemount_mount_handle,
(uint8_t *) buffer,
(size_t) number_of_bytes_to_read,
&error );
if( read_count == -1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_IO,
LIBCERROR_IO_ERROR_READ_FAILED,
"%s: unable to read from mount handle.",
function );
result = -ERROR_READ_FAULT;
goto on_error;
}
if( read_count > (size_t) INT32_MAX )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_VALUE_EXCEEDS_MAXIMUM,
"%s: invalid read count value exceeds maximum.",
function );
result = -ERROR_READ_FAULT;
goto on_error;
}
/* Dokan does not require the read function to return ERROR_HANDLE_EOF
*/
*number_of_bytes_read = (DWORD) read_count;
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Sets the values in a find data structure
* Returns 1 if successful or -1 on error
*/
int bdemount_dokan_set_find_data(
WIN32_FIND_DATAW *find_data,
uint64_t creation_time,
uint64_t modification_time,
uint64_t access_time,
size64_t size,
int number_of_sub_items,
uint8_t use_mount_time,
libcerror_error_t **error )
{
static char *function = "bdemount_dokan_set_find_data";
if( find_data == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid find data.",
function );
return( -1 );
}
if( use_mount_time == 0 )
{
if( creation_time != 0 )
{
find_data->ftCreationTime.dwLowDateTime = (uint32_t) ( creation_time & 0x00000000ffffffffULL );
find_data->ftCreationTime.dwHighDateTime = creation_time >> 32;
}
if( modification_time != 0 )
{
find_data->ftLastWriteTime.dwLowDateTime = (uint32_t) ( modification_time & 0x00000000ffffffffULL );
find_data->ftLastWriteTime.dwHighDateTime = modification_time >> 32;
}
if( access_time != 0 )
{
find_data->ftLastAccessTime.dwLowDateTime = (uint32_t) ( access_time & 0x00000000ffffffffULL );
find_data->ftLastAccessTime.dwHighDateTime = access_time >> 32;
}
}
/* TODO implement
else
{
}
*/
if( size > 0 )
{
find_data->nFileSizeHigh = (DWORD) ( size >> 32 );
find_data->nFileSizeLow = (DWORD) ( size & 0xffffffffUL );
}
find_data->dwFileAttributes = FILE_ATTRIBUTE_READONLY;
if( number_of_sub_items > 0 )
{
find_data->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
}
return( 1 );
}
/* Fills a directory entry
* Returns 1 if successful or -1 on error
*/
int bdemount_dokan_filldir(
PFillFindData fill_find_data,
DOKAN_FILE_INFO *file_info,
wchar_t *name,
size_t name_size,
WIN32_FIND_DATAW *find_data,
mount_handle_t *mount_handle,
uint8_t use_mount_time,
libcerror_error_t **error )
{
static char *function = "bdemount_dokan_filldir";
size64_t volume_size = 0;
uint64_t creation_time = 0;
int number_of_sub_items = 0;
if( fill_find_data == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid fill find data.",
function );
return( -1 );
}
if( name == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid name.",
function );
return( -1 );
}
if( name_size > (size_t) MAX_PATH )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_VALUE_OUT_OF_BOUNDS,
"%s: invalid name size value out of bounds.",
function );
return( -1 );
}
if( mount_handle == NULL )
{
number_of_sub_items = 1;
}
else
{
if( mount_handle_get_creation_time(
mount_handle,
&creation_time,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve creation time.",
function );
return( -1 );
}
if( mount_handle_get_size(
mount_handle,
&volume_size,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve volume size.",
function );
return( -1 );
}
}
if( memory_set(
find_data,
0,
sizeof( WIN32_FIND_DATAW ) ) == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_SET_FAILED,
"%s: unable to clear find data.",
function );
return( -1 );
}
if( libcstring_wide_string_copy(
find_data->cFileName,
name,
name_size ) == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_COPY_FAILED,
"%s: unable to copy filename.",
function );
return( -1 );
}
if( name_size <= (size_t) 14 )
{
if( libcstring_wide_string_copy(
find_data->cAlternateFileName,
name,
name_size ) == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_COPY_FAILED,
"%s: unable to copy alternate filename.",
function );
return( -1 );
}
}
if( bdemount_dokan_set_find_data(
find_data,
creation_time,
creation_time,
creation_time,
volume_size,
number_of_sub_items,
use_mount_time,
error ) != 1 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set find data.",
function );
return( -1 );
}
if( fill_find_data(
find_data,
file_info ) != 0 )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set directory entry.",
function );
return( -1 );
}
return( 1 );
}
/* Reads a directory
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_FindFiles(
const wchar_t *path,
PFillFindData fill_find_data,
DOKAN_FILE_INFO *file_info )
{
WIN32_FIND_DATAW find_data;
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_FindFiles";
size_t path_length = 0;
int result = 0;
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
path_length = libcstring_wide_string_length(
path );
if( ( path_length != 1 )
|| ( path[ 0 ] != (wchar_t) '\\' ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
if( bdemount_dokan_filldir(
fill_find_data,
file_info,
L".",
2,
&find_data,
NULL,
1,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set find data.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
if( bdemount_dokan_filldir(
fill_find_data,
file_info,
L"..",
3,
&find_data,
NULL,
0,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set find data.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
if( bdemount_dokan_filldir(
fill_find_data,
file_info,
&( bdemount_dokan_path[ 1 ] ),
bdemount_dokan_path_length,
&find_data,
bdemount_mount_handle,
0,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set find data.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Sets the values in a file information structure
* Returns 1 if successful or -1 on error
*/
int bdemount_dokan_set_file_information(
BY_HANDLE_FILE_INFORMATION *file_information,
uint64_t creation_time,
uint64_t modification_time,
uint64_t access_time,
size64_t size,
int number_of_sub_items,
uint8_t use_mount_time,
libcerror_error_t **error )
{
static char *function = "bdemount_dokan_set_file_information";
if( file_information == NULL )
{
libcerror_error_set(
error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid file information.",
function );
return( -1 );
}
if( use_mount_time == 0 )
{
if( creation_time != 0 )
{
file_information->ftCreationTime.dwLowDateTime = (uint32_t) ( creation_time & 0x00000000ffffffffULL );
file_information->ftCreationTime.dwHighDateTime = creation_time >> 32;
}
if( modification_time != 0 )
{
file_information->ftLastWriteTime.dwLowDateTime = (uint32_t) ( modification_time & 0x00000000ffffffffULL );
file_information->ftLastWriteTime.dwHighDateTime = modification_time >> 32;
}
if( access_time != 0 )
{
file_information->ftLastAccessTime.dwLowDateTime = (uint32_t) ( access_time & 0x00000000ffffffffULL );
file_information->ftLastAccessTime.dwHighDateTime = access_time >> 32;
}
}
/* TODO implement
else
{
}
*/
if( size > 0 )
{
file_information->nFileSizeHigh = (DWORD) ( size >> 32 );
file_information->nFileSizeLow = (DWORD) ( size & 0xffffffffUL );
}
file_information->dwFileAttributes = FILE_ATTRIBUTE_READONLY;
if( number_of_sub_items > 0 )
{
file_information->dwFileAttributes |= FILE_ATTRIBUTE_DIRECTORY;
}
return( 1 );
}
/* Retrieves the file information
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_GetFileInformation(
const wchar_t *path,
BY_HANDLE_FILE_INFORMATION *file_information,
DOKAN_FILE_INFO *file_info )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_GetFileInformation";
size64_t volume_size = 0;
uint64_t creation_time = 0;
size_t path_length = 0;
int number_of_sub_items = 0;
int result = 0;
uint8_t use_mount_time = 0;
if( path == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid path.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
if( file_info == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE,
"%s: invalid file info.",
function );
result = -ERROR_BAD_ARGUMENTS;
goto on_error;
}
path_length = libcstring_wide_string_length(
path );
if( path_length == 1 )
{
if( path[ 0 ] != (wchar_t) '\\' )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
number_of_sub_items = 1;
use_mount_time = 1;
}
else
{
if( ( path_length != bdemount_dokan_path_length )
|| ( libcstring_wide_string_compare(
path,
bdemount_dokan_path,
bdemount_dokan_path_length ) != 0 ) )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_ARGUMENTS,
LIBCERROR_ARGUMENT_ERROR_UNSUPPORTED_VALUE,
"%s: unsupported path: %ls.",
function,
path );
result = -ERROR_FILE_NOT_FOUND;
goto on_error;
}
if( mount_handle_get_creation_time(
bdemount_mount_handle,
&creation_time,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve creation time.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
if( mount_handle_get_size(
bdemount_mount_handle,
&volume_size,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_GET_FAILED,
"%s: unable to retrieve volume size.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
}
if( bdemount_dokan_set_file_information(
file_information,
creation_time,
creation_time,
creation_time,
volume_size,
number_of_sub_items,
use_mount_time,
&error ) != 1 )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_RUNTIME,
LIBCERROR_RUNTIME_ERROR_SET_FAILED,
"%s: unable to set file info.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Retrieves the volume information
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_GetVolumeInformation(
wchar_t *volume_name,
DWORD volume_name_size,
DWORD *volume_serial_number,
DWORD *maximum_filename_length,
DWORD *file_system_flags,
wchar_t *file_system_name,
DWORD file_system_name_size,
DOKAN_FILE_INFO *file_info LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
libcerror_error_t *error = NULL;
static char *function = "bdemount_dokan_GetVolumeInformation";
int result = 0;
LIBCSYSTEM_UNREFERENCED_PARAMETER( file_info )
if( ( volume_name != NULL )
&& ( volume_name_size > (DWORD) ( sizeof( wchar_t ) * 4 ) ) )
{
/* Using wcsncpy seems to cause strange behavior here
*/
if( memory_copy(
volume_name,
L"BDE",
sizeof( wchar_t ) * 4 ) == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_COPY_FAILED,
"%s: unable to copy volume name.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
}
if( volume_serial_number != NULL )
{
/* If this value contains 0 it can crash the system is this an issue in Dokan?
*/
*volume_serial_number = 0x19831116;
}
if( maximum_filename_length != NULL )
{
*maximum_filename_length = 256;
}
if( file_system_flags != NULL )
{
*file_system_flags = FILE_CASE_SENSITIVE_SEARCH
| FILE_CASE_PRESERVED_NAMES
| FILE_UNICODE_ON_DISK
| FILE_READ_ONLY_VOLUME;
}
if( ( file_system_name != NULL )
&& ( file_system_name_size > (DWORD) ( sizeof( wchar_t ) * 6 ) ) )
{
/* Using wcsncpy seems to cause strange behavior here
*/
if( memory_copy(
file_system_name,
L"Dokan",
sizeof( wchar_t ) * 6 ) == NULL )
{
libcerror_error_set(
&error,
LIBCERROR_ERROR_DOMAIN_MEMORY,
LIBCERROR_MEMORY_ERROR_COPY_FAILED,
"%s: unable to copy file system name.",
function );
result = -ERROR_GEN_FAILURE;
goto on_error;
}
}
return( 0 );
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
return( result );
}
/* Unmount the image
* Returns 0 if successful or a negative error code otherwise
*/
int __stdcall bdemount_dokan_Unmount(
DOKAN_FILE_INFO *file_info LIBCSYSTEM_ATTRIBUTE_UNUSED )
{
static char *function = "bdemount_dokan_Unmount";
LIBCSYSTEM_UNREFERENCED_PARAMETER( file_info )
return( 0 );
}
#endif
/* The main program
*/
#if defined( LIBCSTRING_HAVE_WIDE_SYSTEM_CHARACTER )
int wmain( int argc, wchar_t * const argv[] )
#else
int main( int argc, char * const argv[] )
#endif
{
libbde_error_t *error = NULL;
libcstring_system_character_t *mount_point = NULL;
libcstring_system_character_t *option_extended_options = NULL;
libcstring_system_character_t *option_keys = NULL;
libcstring_system_character_t *option_password = NULL;
libcstring_system_character_t *option_recovery_password = NULL;
libcstring_system_character_t *option_startup_key_filename = NULL;
libcstring_system_character_t *option_volume_offset = NULL;
libcstring_system_character_t *source = NULL;
char *program = "bdemount";
libcstring_system_integer_t option = 0;
int result = 0;
int verbose = 0;
#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE )
struct fuse_operations bdemount_fuse_operations;
struct fuse_args bdemount_fuse_arguments = FUSE_ARGS_INIT(0, NULL);
struct fuse_chan *bdemount_fuse_channel = NULL;
struct fuse *bdemount_fuse_handle = NULL;
#elif defined( HAVE_LIBDOKAN )
DOKAN_OPERATIONS bdemount_dokan_operations;
DOKAN_OPTIONS bdemount_dokan_options;
#endif
libcnotify_stream_set(
stderr,
NULL );
libcnotify_verbose_set(
1 );
if( libclocale_initialize(
"bdetools",
&error ) != 1 )
{
fprintf(
stderr,
"Unable to initialize locale values.\n" );
goto on_error;
}
if( libcsystem_initialize(
_IONBF,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to initialize system values.\n" );
goto on_error;
}
bdeoutput_version_fprint(
stdout,
program );
while( ( option = libcsystem_getopt(
argc,
argv,
_LIBCSTRING_SYSTEM_STRING( "hk:o:p:r:s:vVX:" ) ) ) != (libcstring_system_integer_t) -1 )
{
switch( option )
{
case (libcstring_system_integer_t) '?':
default:
fprintf(
stderr,
"Invalid argument: %" PRIs_LIBCSTRING_SYSTEM "\n",
argv[ optind - 1 ] );
usage_fprint(
stdout );
return( EXIT_FAILURE );
case (libcstring_system_integer_t) 'h':
usage_fprint(
stdout );
return( EXIT_SUCCESS );
case (libcstring_system_integer_t) 'k':
option_keys = optarg;
break;
case (libcstring_system_integer_t) 'o':
option_volume_offset = optarg;
break;
case (libcstring_system_integer_t) 'p':
option_password = optarg;
break;
case (libcstring_system_integer_t) 'r':
option_recovery_password = optarg;
break;
case (libcstring_system_integer_t) 's':
option_startup_key_filename = optarg;
break;
case (libcstring_system_integer_t) 'v':
verbose = 1;
break;
case (libcstring_system_integer_t) 'V':
bdeoutput_copyright_fprint(
stdout );
return( EXIT_SUCCESS );
case (libcstring_system_integer_t) 'X':
option_extended_options = optarg;
break;
}
}
if( optind == argc )
{
fprintf(
stderr,
"Missing source file or device.\n" );
usage_fprint(
stdout );
return( EXIT_FAILURE );
}
source = argv[ optind++ ];
if( optind == argc )
{
fprintf(
stderr,
"Missing mount point.\n" );
usage_fprint(
stdout );
return( EXIT_FAILURE );
}
mount_point = argv[ optind ];
libcnotify_verbose_set(
verbose );
libbde_notify_set_stream(
stderr,
NULL );
libbde_notify_set_verbose(
verbose );
if( mount_handle_initialize(
&bdemount_mount_handle,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to initialize mount handle.\n" );
goto on_error;
}
if( option_keys != NULL )
{
if( mount_handle_set_keys(
bdemount_mount_handle,
option_keys,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to set keys.\n" );
goto on_error;
}
}
if( option_password != NULL )
{
if( mount_handle_set_password(
bdemount_mount_handle,
option_password,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to set password.\n" );
goto on_error;
}
}
if( option_recovery_password != NULL )
{
if( mount_handle_set_recovery_password(
bdemount_mount_handle,
option_recovery_password,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to set recovery password.\n" );
goto on_error;
}
}
if( option_startup_key_filename != NULL )
{
if( mount_handle_read_startup_key(
bdemount_mount_handle,
option_startup_key_filename,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to read startup key.\n" );
goto on_error;
}
}
if( option_volume_offset != NULL )
{
if( mount_handle_set_volume_offset(
bdemount_mount_handle,
option_volume_offset,
&error ) != 1 )
{
fprintf(
stderr,
"Unable to set volume offset.\n" );
goto on_error;
}
}
result = mount_handle_open_input(
bdemount_mount_handle,
source,
&error );
if( result != 1 )
{
fprintf(
stderr,
"Unable to open: %" PRIs_LIBCSTRING_SYSTEM ".\n",
source );
goto on_error;
}
result = mount_handle_input_is_locked(
bdemount_mount_handle,
&error );
if( result != 0 )
{
fprintf(
stderr,
"Unable to unlock volume.\n" );
goto on_error;
}
#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE )
if( memory_set(
&bdemount_fuse_operations,
0,
sizeof( struct fuse_operations ) ) == NULL )
{
fprintf(
stderr,
"Unable to clear fuse operations.\n" );
goto on_error;
}
if( option_extended_options != NULL )
{
/* This argument is required but ignored
*/
if( fuse_opt_add_arg(
&bdemount_fuse_arguments,
"" ) != 0 )
{
fprintf(
stderr,
"Unable add fuse arguments.\n" );
goto on_error;
}
if( fuse_opt_add_arg(
&bdemount_fuse_arguments,
"-o" ) != 0 )
{
fprintf(
stderr,
"Unable add fuse arguments.\n" );
goto on_error;
}
if( fuse_opt_add_arg(
&bdemount_fuse_arguments,
option_extended_options ) != 0 )
{
fprintf(
stderr,
"Unable add fuse arguments.\n" );
goto on_error;
}
}
bdemount_fuse_operations.open = &bdemount_fuse_open;
bdemount_fuse_operations.read = &bdemount_fuse_read;
bdemount_fuse_operations.readdir = &bdemount_fuse_readdir;
bdemount_fuse_operations.getattr = &bdemount_fuse_getattr;
bdemount_fuse_operations.destroy = &bdemount_fuse_destroy;
bdemount_fuse_channel = fuse_mount(
mount_point,
&bdemount_fuse_arguments );
if( bdemount_fuse_channel == NULL )
{
fprintf(
stderr,
"Unable to create fuse channel.\n" );
goto on_error;
}
bdemount_fuse_handle = fuse_new(
bdemount_fuse_channel,
&bdemount_fuse_arguments,
&bdemount_fuse_operations,
sizeof( struct fuse_operations ),
bdemount_mount_handle );
if( bdemount_fuse_handle == NULL )
{
fprintf(
stderr,
"Unable to create fuse handle.\n" );
goto on_error;
}
if( verbose == 0 )
{
if( fuse_daemonize(
0 ) != 0 )
{
fprintf(
stderr,
"Unable to daemonize fuse.\n" );
goto on_error;
}
}
result = fuse_loop(
bdemount_fuse_handle );
if( result != 0 )
{
fprintf(
stderr,
"Unable to run fuse loop.\n" );
goto on_error;
}
fuse_destroy(
bdemount_fuse_handle );
fuse_opt_free_args(
&bdemount_fuse_arguments );
return( EXIT_SUCCESS );
#elif defined( HAVE_LIBDOKAN )
if( memory_set(
&bdemount_dokan_operations,
0,
sizeof( DOKAN_OPERATIONS ) ) == NULL )
{
fprintf(
stderr,
"Unable to clear dokan operations.\n" );
goto on_error;
}
if( memory_set(
&bdemount_dokan_options,
0,
sizeof( DOKAN_OPTIONS ) ) == NULL )
{
fprintf(
stderr,
"Unable to clear dokan options.\n" );
goto on_error;
}
bdemount_dokan_options.Version = 600;
bdemount_dokan_options.ThreadCount = 0;
bdemount_dokan_options.MountPoint = mount_point;
if( verbose != 0 )
{
bdemount_dokan_options.Options |= DOKAN_OPTION_STDERR;
#if defined( HAVE_DEBUG_OUTPUT )
bdemount_dokan_options.Options |= DOKAN_OPTION_DEBUG;
#endif
}
/* This will only affect the drive properties
bdemount_dokan_options.Options |= DOKAN_OPTION_REMOVABLE;
*/
bdemount_dokan_options.Options |= DOKAN_OPTION_KEEP_ALIVE;
bdemount_dokan_operations.CreateFile = &bdemount_dokan_CreateFile;
bdemount_dokan_operations.OpenDirectory = &bdemount_dokan_OpenDirectory;
bdemount_dokan_operations.CreateDirectory = NULL;
bdemount_dokan_operations.Cleanup = NULL;
bdemount_dokan_operations.CloseFile = &bdemount_dokan_CloseFile;
bdemount_dokan_operations.ReadFile = &bdemount_dokan_ReadFile;
bdemount_dokan_operations.WriteFile = NULL;
bdemount_dokan_operations.FlushFileBuffers = NULL;
bdemount_dokan_operations.GetFileInformation = &bdemount_dokan_GetFileInformation;
bdemount_dokan_operations.FindFiles = &bdemount_dokan_FindFiles;
bdemount_dokan_operations.FindFilesWithPattern = NULL;
bdemount_dokan_operations.SetFileAttributes = NULL;
bdemount_dokan_operations.SetFileTime = NULL;
bdemount_dokan_operations.DeleteFile = NULL;
bdemount_dokan_operations.DeleteDirectory = NULL;
bdemount_dokan_operations.MoveFile = NULL;
bdemount_dokan_operations.SetEndOfFile = NULL;
bdemount_dokan_operations.SetAllocationSize = NULL;
bdemount_dokan_operations.LockFile = NULL;
bdemount_dokan_operations.UnlockFile = NULL;
bdemount_dokan_operations.GetFileSecurity = NULL;
bdemount_dokan_operations.SetFileSecurity = NULL;
bdemount_dokan_operations.GetDiskFreeSpace = NULL;
bdemount_dokan_operations.GetVolumeInformation = &bdemount_dokan_GetVolumeInformation;
bdemount_dokan_operations.Unmount = &bdemount_dokan_Unmount;
result = DokanMain(
&bdemount_dokan_options,
&bdemount_dokan_operations );
switch( result )
{
case DOKAN_SUCCESS:
break;
case DOKAN_ERROR:
fprintf(
stderr,
"Unable to run dokan main: generic error\n" );
break;
case DOKAN_DRIVE_LETTER_ERROR:
fprintf(
stderr,
"Unable to run dokan main: bad drive letter\n" );
break;
case DOKAN_DRIVER_INSTALL_ERROR:
fprintf(
stderr,
"Unable to run dokan main: unable to load driver\n" );
break;
case DOKAN_START_ERROR:
fprintf(
stderr,
"Unable to run dokan main: driver error\n" );
break;
case DOKAN_MOUNT_ERROR:
fprintf(
stderr,
"Unable to run dokan main: unable to assign drive letter\n" );
break;
case DOKAN_MOUNT_POINT_ERROR:
fprintf(
stderr,
"Unable to run dokan main: mount point error\n" );
break;
default:
fprintf(
stderr,
"Unable to run dokan main: unknown error: %d\n",
result );
break;
}
return( EXIT_SUCCESS );
#else
fprintf(
stderr,
"No sub system to mount BDE volume.\n" );
return( EXIT_FAILURE );
#endif
on_error:
if( error != NULL )
{
libcnotify_print_error_backtrace(
error );
libcerror_error_free(
&error );
}
#if defined( HAVE_LIBFUSE ) || defined( HAVE_LIBOSXFUSE )
if( bdemount_fuse_handle != NULL )
{
fuse_destroy(
bdemount_fuse_handle );
}
fuse_opt_free_args(
&bdemount_fuse_arguments );
#endif
if( bdemount_mount_handle != NULL )
{
mount_handle_free(
&bdemount_mount_handle,
NULL );
}
return( EXIT_FAILURE );
}
| windworst/libbde | bdetools/bdemount.c | C | lgpl-3.0 | 55,128 |
###说明
- 这是用C++实现的二分搜索树
####使用工具
- CMake
- make
####使用代码
- 注意请安装cmake3.5以上版本
- 新建一个文件夹
`mkdir build`
- 进入build目录
`cd build`
- cmake配置
`cmake ..`
- 编译执行
`make`
- 进入bin目录下
`cd bin/`
- 执行代码
`./BinarySearchTree`
| houpengfei88/Play-With-C | DataStructure/BinarySearchTree/README.md | Markdown | lgpl-3.0 | 329 |
/*
* Copyright (C) 2014 Stuart Howarth <[email protected]>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU Lesser General Public License,
* version 3, as published by the Free Software Foundation.
*
* This program is distributed in the hope it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
* more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MASKEDITEM_H
#define MASKEDITEM_H
#include "maskeffect.h"
#include <QDeclarativeItem>
class MaskEffect;
class QDeclarativeComponent;
class MaskedItem : public QDeclarativeItem
{
Q_OBJECT
Q_PROPERTY(QDeclarativeComponent *mask
READ mask
WRITE setMask
NOTIFY maskChanged)
public:
MaskedItem(QDeclarativeItem *parent = 0);
virtual ~MaskedItem();
QDeclarativeComponent *mask() const;
void setMask(QDeclarativeComponent *component);
signals:
void maskChanged();
private:
MaskEffect *m_effect;
QDeclarativeComponent *m_maskComponent;
};
#endif // MASKEDITEM_H
| marxoft/qdl | qdl-app/src/harmattan/maskeditem.h | C | lgpl-3.0 | 1,408 |
/*
* Copyright(c) 2013 Tim Ruehsen
* Copyright(c) 2015-2016 Free Software Foundation, Inc.
*
* This file is part of libwget.
*
* Libwget is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libwget 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 libwget. If not, see <https://www.gnu.org/licenses/>.
*
*
* Highlevel HTTP functions
*
* Changelog
* 21.01.2013 Tim Ruehsen created
*
*/
#if HAVE_CONFIG_H
# include <config.h>
#endif
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <wget.h>
#include "private.h"
static int _stream_callback(wget_http_response_t *resp G_GNUC_WGET_UNUSED, void *user_data, const char *data, size_t length)
{
FILE *stream = (FILE *) user_data;
size_t nbytes = fwrite(data, 1, length, stream);
if (nbytes != length) {
error_printf(_("Failed to write %zu bytes of data (%d)\n"), length, errno);
if (feof(stream))
return -1;
}
return 0;
}
static int _fd_callback(wget_http_response_t *resp G_GNUC_WGET_UNUSED, void *user_data, const char *data, size_t length)
{
int fd = *(int *) user_data;
ssize_t nbytes = write(fd, data, length);
if (nbytes == -1 || (size_t) nbytes != length)
error_printf(_("Failed to write %zu bytes of data (%d)\n"), length, errno);
return 0;
}
wget_http_response_t *wget_http_get(int first_key, ...)
{
wget_vector_t *headers = wget_vector_create(8, 8, NULL);
wget_iri_t *uri = NULL;
wget_http_connection_t *conn = NULL, **connp = NULL;
wget_http_request_t *req;
wget_http_response_t *resp = NULL;
wget_vector_t *challenges = NULL;
wget_cookie_db_t *cookie_db = NULL;
FILE *saveas_stream = NULL;
wget_http_body_callback_t saveas_callback = NULL;
int saveas_fd = -1;
wget_http_header_callback_t header_callback = NULL;
va_list args;
const char *url = NULL, *url_encoding = NULL, *scheme = "GET";
const char *http_username = NULL, *http_password = NULL;
const char *saveas_name = NULL;
int key, it, max_redirections = 5, redirection_level = 0;
size_t bodylen = 0;
const void *body = NULL;
void *header_user_data = NULL, *body_user_data = NULL;
struct {
unsigned int
cookies_enabled : 1,
keep_header : 1,
free_uri : 1;
} bits = {
.cookies_enabled = !!wget_global_get_int(WGET_COOKIES_ENABLED)
};
va_start(args, first_key);
for (key = first_key; key; key = va_arg(args, int)) {
switch (key) {
case WGET_HTTP_URL:
url = va_arg(args, const char *);
break;
case WGET_HTTP_URI:
uri = va_arg(args, wget_iri_t *);
break;
case WGET_HTTP_URL_ENCODING:
url_encoding = va_arg(args, const char *);
break;
case WGET_HTTP_HEADER_ADD:
{
wget_http_header_param_t param = {
.name = va_arg(args, const char *),
.value = va_arg(args, const char *)
};
wget_vector_add(headers, ¶m, sizeof(param));
break;
}
case WGET_HTTP_CONNECTION_PTR:
connp = va_arg(args, wget_http_connection_t **);
if (connp)
conn = *connp;
break;
case WGET_HTTP_RESPONSE_KEEPHEADER:
bits.keep_header = va_arg(args, int);
break;
case WGET_HTTP_MAX_REDIRECTIONS:
max_redirections = va_arg(args, int);
break;
case WGET_HTTP_BODY_SAVEAS:
saveas_name = va_arg(args, const char *);
break;
case WGET_HTTP_BODY_SAVEAS_STREAM:
saveas_stream = va_arg(args, FILE *);
break;
case WGET_HTTP_BODY_SAVEAS_FUNC:
saveas_callback = va_arg(args, wget_http_body_callback_t);
body_user_data = va_arg(args, void *);
break;
case WGET_HTTP_BODY_SAVEAS_FD:
saveas_fd = va_arg(args, int);
break;
case WGET_HTTP_HEADER_FUNC:
header_callback = va_arg(args, wget_http_header_callback_t);
header_user_data = va_arg(args, void *);
break;
case WGET_HTTP_SCHEME:
scheme = va_arg(args, const char *);
break;
case WGET_HTTP_BODY:
body = va_arg(args, const void *);
bodylen = va_arg(args, size_t);
break;
default:
error_printf(_("Unknown option %d\n"), key);
goto out;
}
}
va_end(args);
if (url && !uri) {
uri = wget_iri_parse(url, url_encoding);
if (!uri) {
error_printf (_("Error parsing URL\n"));
goto out;
}
bits.free_uri = 1;
}
if (!uri) {
error_printf(_("Missing URL/URI\n"));
goto out;
}
if (bits.cookies_enabled)
cookie_db = (wget_cookie_db_t *)wget_global_get_ptr(WGET_COOKIE_DB);
while (uri && redirection_level <= max_redirections) {
// create a HTTP/1.1 GET request.
// the only default header is 'Host: domain' (taken from uri)
req = wget_http_create_request(uri, scheme);
// add HTTP headers
for (it = 0; it < wget_vector_size(headers); it++) {
wget_http_add_header_param(req, wget_vector_get(headers, it));
}
if (challenges) {
// There might be more than one challenge, we could select the most secure one.
// For simplicity and testing we just take the first for now.
// the following adds an Authorization: HTTP header
wget_http_add_credentials(req, wget_vector_get(challenges, 0), http_username, http_password);
wget_http_free_challenges(&challenges);
}
// use keep-alive if you want to send more requests on the same connection
// http_add_header(req, "Connection", "keep-alive");
// enrich the HTTP request with the uri-related cookies we have
if (cookie_db) {
const char *cookie_string;
if ((cookie_string = wget_cookie_create_request_header(cookie_db, uri))) {
wget_http_add_header(req, "Cookie", cookie_string);
xfree(cookie_string);
}
}
if (connp) {
wget_http_add_header(req, "Connection", "keepalive");
}
// open/reopen/reuse HTTP/HTTPS connection
if (conn && !wget_strcmp(conn->esc_host, uri->host) &&
conn->scheme == uri->scheme &&
!wget_strcmp(conn->port, uri->resolv_port))
{
debug_printf("reuse connection %s\n", conn->esc_host);
} else {
if (conn) {
debug_printf("close connection %s\n", conn->esc_host);
wget_http_close(&conn);
}
if (wget_http_open(&conn, uri) == WGET_E_SUCCESS)
debug_printf("opened connection %s\n", conn->esc_host);
}
if (conn) {
int rc;
if (body && bodylen)
wget_http_request_set_body(req, NULL, wget_memdup(body, bodylen), bodylen);
rc = wget_http_send_request(conn, req);
if (rc == 0) {
wget_http_request_set_header_cb(req, header_callback, header_user_data);
wget_http_request_set_int(req, WGET_HTTP_RESPONSE_KEEPHEADER, 1);
if (saveas_name) {
FILE *fp;
if ((fp = fopen(saveas_name, "w"))) {
wget_http_request_set_body_cb(req, _stream_callback, fp);
resp = wget_http_get_response(conn);
fclose(fp);
} else
debug_printf("Failed to open '%s' for writing\n", saveas_name);
}
else if (saveas_stream) {
wget_http_request_set_body_cb(req, _stream_callback, saveas_stream);
resp = wget_http_get_response(conn);
} else if (saveas_callback) {
wget_http_request_set_body_cb(req, saveas_callback, body_user_data);
resp = wget_http_get_response(conn);
} else if (saveas_fd != -1) {
wget_http_request_set_body_cb(req, _fd_callback, &saveas_fd);
resp = wget_http_get_response(conn);
} else
resp = wget_http_get_response(conn);
}
}
wget_http_free_request(&req);
if (!resp)
goto out;
// server doesn't support or want keep-alive
if (!resp->keep_alive)
wget_http_close(&conn);
if (cookie_db) {
// check and normalization of received cookies
wget_cookie_normalize_cookies(uri, resp->cookies);
// put cookies into cookie-store (also known as cookie-jar)
wget_cookie_store_cookies(cookie_db, resp->cookies);
}
if (resp->code == 401 && !challenges) { // Unauthorized
if ((challenges = resp->challenges)) {
resp->challenges = NULL;
wget_http_free_response(&resp);
if (redirection_level == 0 && max_redirections) {
redirection_level = max_redirections; // just try one more time with authentication
continue; // try again with credentials
}
}
break;
}
// 304 Not Modified
if (resp->code / 100 == 2 || resp->code / 100 >= 4 || resp->code == 304)
break; // final response
if (resp->location) {
char uri_sbuf[1024];
wget_buffer_t uri_buf;
// if relative location, convert to absolute
wget_buffer_init(&uri_buf, uri_sbuf, sizeof(uri_sbuf));
wget_iri_relative_to_abs(uri, resp->location, strlen(resp->location), &uri_buf);
if (bits.free_uri)
wget_iri_free(&uri);
uri = wget_iri_parse(uri_buf.data, NULL);
bits.free_uri = 1;
wget_buffer_deinit(&uri_buf);
redirection_level++;
continue;
}
break;
}
out:
if (connp) {
*connp = conn;
} else {
wget_http_close(&conn);
}
wget_http_free_challenges(&challenges);
// wget_vector_clear_nofree(headers);
wget_vector_free(&headers);
if (bits.free_uri)
wget_iri_free(&uri);
return resp;
}
| darnir/wget2 | libwget/http_highlevel.c | C | lgpl-3.0 | 9,190 |
<?php
/**
*
* Copyright (c) 2014 gfg-development
*
* @link http://www.gfg-development.de
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*/
$GLOBALS['TL_LANG']['tl_linkslist_list']['title_legend'] = 'Titel';
$GLOBALS['TL_LANG']['tl_linkslist_list']['config_legend'] = 'Einstellungen';
$GLOBALS['TL_LANG']['tl_linkslist_list']['name'][0] = 'Titel';
$GLOBALS['TL_LANG']['tl_linkslist_list']['name'][1] = 'Geben Sie hier den Linklist Titel ein.';
$GLOBALS['TL_LANG']['tl_linkslist_list']['new'][0] = 'Neue Linkliste';
$GLOBALS['TL_LANG']['tl_linkslist_list']['new'][1] = 'Eine neue Linkliste anlegen';
$GLOBALS['TL_LANG']['tl_linkslist_list']['edit'][0] = 'Linkliste bearbeiten';
$GLOBALS['TL_LANG']['tl_linkslist_list']['edit'][1] = 'Linkliste ID %s bearbeiten';
$GLOBALS['TL_LANG']['tl_linkslist_list']['delete'][0] = 'Linkliste löschen';
$GLOBALS['TL_LANG']['tl_linkslist_list']['delete'][1] = 'Linkliste ID %s löchen';
$GLOBALS['TL_LANG']['tl_linkslist_list']['show'][0] = 'Linklistendetails';
$GLOBALS['TL_LANG']['tl_linkslist_list']['show'][1] = 'Details der Linkliste ID %s anzeigen';
$GLOBALS['TL_LANG']['tl_linkslist_list']['target'][0] = 'Links in neuem Fenster öffnen';
$GLOBALS['TL_LANG']['tl_linkslist_list']['target'][1] = 'Bitte wählen sie aus, ob die Links in einem neuen Fenster geöffnet werden sollen (target="_blank").';
?> | gfg-development/linkslist | languages/de/tl_linkslist_list.php | PHP | lgpl-3.0 | 1,409 |
namespace MoCap.Manager
{
class Dispatcher : IComMsg
{
}
}
| christiansax/MoCap | PlexByte.App.MoCap.Manager/Manager/Dispatcher.cs | C# | lgpl-3.0 | 74 |
/**********************************************************************
* Copyright (c) 2010, j. montgomery *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* + Redistributions of source code must retain the above copyright *
* notice, this list of conditions and the following disclaimer. *
* *
* + Redistributions in binary form must reproduce the above copyright*
* notice, this list of conditions and the following disclaimer *
* in the documentation and/or other materials provided with the *
* distribution. *
* *
* + Neither the name of j. montgomery's employer nor the names of *
* its contributors may be used to endorse or promote products *
* derived from this software without specific prior written *
* permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS*
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS *
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,*
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR *
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,*
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) *
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED*
* OF THE POSSIBILITY OF SUCH DAMAGE. *
**********************************************************************/
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using DnDns.Records;
using DnDns.Enums;
namespace DnDns.Query
{
/// <summary>
/// Summary description for DnsQueryResponse.
/// </summary>
public class DnsQueryResponse : DnsQueryBase
{
#region Fields
private DnsQueryRequest _queryRequest = new DnsQueryRequest();
private IDnsRecord[] _answers;
private IDnsRecord[] _authoritiveNameServers;
private IDnsRecord[] _additionalRecords;
private int _bytesReceived = 0;
#endregion Fields
#region properties
public DnsQueryRequest QueryRequest
{
get { return _queryRequest; }
}
public IDnsRecord[] Answers
{
get { return _answers; }
}
public IDnsRecord[] AuthoritiveNameServers
{
get { return _authoritiveNameServers; }
}
public IDnsRecord[] AdditionalRecords
{
get { return _additionalRecords; }
}
public int BytesReceived
{
get { return _bytesReceived; }
}
#endregion
/// <summary>
///
/// </summary>
public DnsQueryResponse()
{
}
private DnsQueryRequest ParseQuery(ref MemoryStream ms)
{
DnsQueryRequest queryRequest = new DnsQueryRequest();
// Read name
queryRequest.Name = DnsRecordBase.ParseName(ref ms);
return queryRequest;
}
internal void ParseResponse(byte[] recvBytes, ProtocolType protocol)
{
MemoryStream ms = new MemoryStream(recvBytes);
byte[] flagBytes = new byte[2];
byte[] transactionId = new byte[2];
byte[] questions = new byte[2];
byte[] answerRRs = new byte[2];
byte[] authorityRRs = new byte[2];
byte[] additionalRRs = new byte[2];
byte[] nsType = new byte[2];
byte[] nsClass = new byte[2];
this._bytesReceived = recvBytes.Length;
// Parse DNS Response
ms.Read(transactionId, 0, 2);
ms.Read(flagBytes, 0, 2);
ms.Read(questions, 0, 2);
ms.Read(answerRRs, 0, 2);
ms.Read(authorityRRs, 0, 2);
ms.Read(additionalRRs ,0, 2);
// Parse Header
_transactionId = (ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(transactionId, 0));
_flags = (ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(flagBytes, 0));
_queryResponse = (QueryResponse)(_flags & (ushort)FlagMasks.QueryResponseMask);
_opCode = (OpCode)(_flags & (ushort)FlagMasks.OpCodeMask);
_nsFlags = (NsFlags)(_flags & (ushort)FlagMasks.NsFlagMask);
_rCode = (RCode)(_flags & (ushort)FlagMasks.RCodeMask);
// Parse Questions Section
_questions = (ushort)IPAddress.NetworkToHostOrder((short)BitConverter.ToUInt16(questions, 0));
_answerRRs = (ushort)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(answerRRs, 0));
_authorityRRs = (ushort)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(authorityRRs, 0));
_additionalRRs = (ushort)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(additionalRRs, 0));
_additionalRecords = new DnsRecordBase[_additionalRRs];
_answers = new DnsRecordBase[_answerRRs];
_authoritiveNameServers = new DnsRecordBase[_authorityRRs];
// Parse Queries
_queryRequest = this.ParseQuery(ref ms);
// Read dnsType
ms.Read(nsType, 0, 2);
// Read dnsClass
ms.Read(nsClass, 0, 2);
_nsType = (NsType)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(nsType, 0));
_nsClass = (NsClass)IPAddress.NetworkToHostOrder(BitConverter.ToInt16(nsClass, 0));
// Read in Answer Blocks
for (int i=0; i < _answerRRs; i++)
{
_answers[i] = RecordFactory.Create(ref ms);
}
// Parse Authority Records
for (int i=0; i < _authorityRRs; i++)
{
_authoritiveNameServers[i] = RecordFactory.Create(ref ms);
}
// Parse Additional Records
for (int i=0; i < _additionalRRs; i++)
{
_additionalRecords[i] = RecordFactory.Create(ref ms);
}
}
}
}
| RELOAD-NET/RELOAD.NET | DnDns/Query/DnsQueryResponse.cs | C# | lgpl-3.0 | 6,689 |
<?php
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* This project is provided in good faith and hope to be usable by anyone.
*
* @package contao-community-alliance/dc-general
* @author Christian Schiffler <[email protected]>
* @author Tristan Lins <[email protected]>
* @author Sven Baumann <[email protected]>
* @copyright 2013-2019 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
namespace ContaoCommunityAlliance\DcGeneral\Contao\View\Contao2BackendView\Event;
/**
* Class GetGlobalButtonEvent.
*
* This event gets issued when the top level buttons in the listing view are being retrieved.
*
* These buttons include, but are not limited to, the "back" button and the "edit multiple" button.
*/
class GetGlobalButtonEvent extends BaseButtonEvent
{
public const NAME = 'dc-general.view.contao2backend.get-global-button';
/**
* The hotkey for the button.
*
* @var string
*/
protected $accessKey;
/**
* The css class to use.
*
* @var string
*/
protected $class;
/**
* The href to use.
*
* @var string
*/
protected $href;
/**
* Set the hotkey for the button.
*
* @param string $accessKey The hotkey for the button.
*
* @return $this
*/
public function setAccessKey($accessKey)
{
$this->accessKey = $accessKey;
return $this;
}
/**
* Get the hotkey for the button.
*
* @return string
*/
public function getAccessKey()
{
return $this->accessKey;
}
/**
* Set the css class for this button.
*
* @param string $class The css class.
*
* @return $this
*/
public function setClass($class)
{
$this->class = $class;
return $this;
}
/**
* Get the css class for this button.
*
* @return string
*/
public function getClass()
{
return $this->class;
}
/**
* Set the href for this button.
*
* @param string $href The href.
*
* @return $this
*/
public function setHref($href)
{
$this->href = $href;
return $this;
}
/**
* Get the href for this button.
*
* @return string
*/
public function getHref()
{
return $this->href;
}
}
| contao-community-alliance/dc-general | src/Contao/View/Contao2BackendView/Event/GetGlobalButtonEvent.php | PHP | lgpl-3.0 | 2,680 |
/*
* Copyright 2016 - 2021 Marcin Matula
*
* This file is part of Oap.
*
* Oap 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.
*
* Oap 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 Oap. If not, see <http://www.gnu.org/licenses/>.
*/
#include "gtest/gtest.h"
#include "oapHostMemoryApi.h"
class OapMemoryApiTests : public testing::Test
{
public:
virtual void SetUp() {}
virtual void TearDown() {}
};
TEST_F(OapMemoryApiTests, Test_1)
{
oap::Memory memory = oap::host::NewMemory ({1, 1});
oap::Memory memory1 = oap::host::ReuseMemory (memory);
oap::Memory memory2 = oap::host::ReuseMemory (memory);
oap::host::DeleteMemory (memory);
oap::host::DeleteMemory (memory1);
oap::host::DeleteMemory (memory2);
}
TEST_F(OapMemoryApiTests, Test_2)
{
oap::Memory memory = oap::host::NewMemoryWithValues ({2, 1}, 2.f);
oap::host::DeleteMemory (memory);
}
| Mamatu/oap | oapHostTests/oapMemoryApiTests.cpp | C++ | lgpl-3.0 | 1,337 |
package org.openbase.bco.device.openhab.communication;
/*-
* #%L
* BCO Openhab Device Manager
* %%
* Copyright (C) 2015 - 2021 openbase.org
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this program. If not, see
* <http://www.gnu.org/licenses/gpl-3.0.html>.
* #L%
*/
import com.google.gson.*;
import org.eclipse.smarthome.core.internal.service.CommandDescriptionServiceImpl;
import org.eclipse.smarthome.core.internal.types.CommandDescriptionImpl;
import org.eclipse.smarthome.core.types.CommandDescription;
import org.eclipse.smarthome.core.types.CommandDescriptionBuilder;
import org.eclipse.smarthome.core.types.CommandOption;
import org.openbase.bco.device.openhab.jp.JPOpenHABURI;
import org.openbase.jps.core.JPService;
import org.openbase.jps.exception.JPNotAvailableException;
import org.openbase.jul.exception.InstantiationException;
import org.openbase.jul.exception.*;
import org.openbase.jul.exception.printer.ExceptionPrinter;
import org.openbase.jul.exception.printer.LogLevel;
import org.openbase.jul.iface.Shutdownable;
import org.openbase.jul.pattern.Observable;
import org.openbase.jul.pattern.ObservableImpl;
import org.openbase.jul.pattern.Observer;
import org.openbase.jul.schedule.GlobalScheduledExecutorService;
import org.openbase.jul.schedule.SyncObject;
import org.openbase.type.domotic.state.ConnectionStateType.ConnectionState;
import org.openbase.type.domotic.state.ConnectionStateType.ConnectionState.State;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.ws.rs.ProcessingException;
import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Entity;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.sse.InboundSseEvent;
import javax.ws.rs.sse.SseEventSource;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
public abstract class OpenHABRestConnection implements Shutdownable {
public static final String SEPARATOR = "/";
public static final String REST_TARGET = "rest";
public static final String APPROVE_TARGET = "approve";
public static final String EVENTS_TARGET = "events";
public static final String TOPIC_KEY = "topic";
public static final String TOPIC_SEPARATOR = SEPARATOR;
private static final Logger LOGGER = LoggerFactory.getLogger(OpenHABRestConnection.class);
private final SyncObject topicObservableMapLock = new SyncObject("topicObservableMapLock");
private final SyncObject connectionStateSyncLock = new SyncObject("connectionStateSyncLock");
private final Map<String, ObservableImpl<Object, JsonObject>> topicObservableMap;
private final Client restClient;
private final WebTarget restTarget;
private SseEventSource sseSource;
private boolean shutdownInitiated = false;
protected final JsonParser jsonParser;
protected final Gson gson;
private ScheduledFuture<?> connectionTask;
protected ConnectionState.State openhabConnectionState = State.DISCONNECTED;
public OpenHABRestConnection() throws InstantiationException {
try {
this.topicObservableMap = new HashMap<>();
this.gson = new GsonBuilder().setExclusionStrategies(new ExclusionStrategy() {
@Override
public boolean shouldSkipField(FieldAttributes fieldAttributes) {
return false;
}
@Override
public boolean shouldSkipClass(Class<?> aClass) {
// ignore Command Description because its an interface and can not be serialized without any instance creator.
if(aClass.equals(CommandDescription.class)) {
return true;
}
return false;
}
}).create();
this.jsonParser = new JsonParser();
this.restClient = ClientBuilder.newClient();
this.restTarget = restClient.target(JPService.getProperty(JPOpenHABURI.class).getValue().resolve(SEPARATOR + REST_TARGET));
this.setConnectState(State.CONNECTING);
} catch (JPNotAvailableException ex) {
throw new InstantiationException(this, ex);
}
}
private boolean isTargetReachable() {
try {
testConnection();
} catch (CouldNotPerformException e) {
if (e.getCause() instanceof ProcessingException) {
return false;
}
}
return true;
}
protected abstract void testConnection() throws CouldNotPerformException;
public void waitForConnectionState(final ConnectionState.State connectionState, final long timeout, final TimeUnit timeUnit) throws InterruptedException {
synchronized (connectionStateSyncLock) {
while (getOpenhabConnectionState() != connectionState) {
connectionStateSyncLock.wait(timeUnit.toMillis(timeout));
}
}
}
public void waitForConnectionState(final ConnectionState.State connectionState) throws InterruptedException {
synchronized (connectionStateSyncLock) {
while (getOpenhabConnectionState() != connectionState) {
connectionStateSyncLock.wait();
}
}
}
private void setConnectState(final ConnectionState.State connectState) {
synchronized (connectionStateSyncLock) {
// filter non changing states
if (connectState == this.openhabConnectionState) {
return;
}
LOGGER.trace("Openhab Connection State changed to: "+connectState);
// update state
this.openhabConnectionState = connectState;
// handle state change
switch (connectState) {
case CONNECTING:
LOGGER.info("Wait for openHAB...");
try {
connectionTask = GlobalScheduledExecutorService.scheduleWithFixedDelay(() -> {
if (isTargetReachable()) {
// set connected
setConnectState(State.CONNECTED);
// cleanup own task
connectionTask.cancel(false);
}
}, 0, 15, TimeUnit.SECONDS);
} catch (NotAvailableException | RejectedExecutionException ex) {
// if global executor service is not available we have no chance to connect.
LOGGER.warn("Wait for openHAB...", ex);
setConnectState(State.DISCONNECTED);
}
break;
case CONNECTED:
LOGGER.info("Connection to OpenHAB established.");
initSSE();
break;
case RECONNECTING:
LOGGER.warn("Connection to OpenHAB lost!");
resetConnection();
setConnectState(State.CONNECTING);
break;
case DISCONNECTED:
LOGGER.info("Connection to OpenHAB closed.");
resetConnection();
break;
}
// notify state change
connectionStateSyncLock.notifyAll();
// apply next state if required
switch (connectState) {
case RECONNECTING:
setConnectState(State.CONNECTING);
break;
}
}
}
private void initSSE() {
// activate sse source if not already done
if (sseSource != null) {
LOGGER.warn("SSE already initialized!");
return;
}
final WebTarget webTarget = restTarget.path(EVENTS_TARGET);
sseSource = SseEventSource.target(webTarget).reconnectingEvery(15, TimeUnit.SECONDS).build();
sseSource.open();
final Consumer<InboundSseEvent> evenConsumer = inboundSseEvent -> {
// dispatch event
try {
final JsonObject payload = jsonParser.parse(inboundSseEvent.readData()).getAsJsonObject();
for (Entry<String, ObservableImpl<Object, JsonObject>> topicObserverEntry : topicObservableMap.entrySet()) {
try {
if (payload.get(TOPIC_KEY).getAsString().matches(topicObserverEntry.getKey())) {
topicObserverEntry.getValue().notifyObservers(payload);
}
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not notify listeners on topic[" + topicObserverEntry.getKey() + "]", ex), LOGGER);
}
}
} catch (Exception ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not handle SSE payload!", ex), LOGGER);
}
};
final Consumer<Throwable> errorHandler = ex -> {
ExceptionPrinter.printHistory("Openhab connection error detected!", ex, LOGGER, LogLevel.DEBUG);
checkConnectionState();
};
final Runnable reconnectHandler = () -> {
checkConnectionState();
};
sseSource.register(evenConsumer, errorHandler, reconnectHandler);
}
public State getOpenhabConnectionState() {
return openhabConnectionState;
}
public void checkConnectionState() {
synchronized (connectionStateSyncLock) {
// only validate if connected
if (!isConnected()) {
return;
}
// if not reachable init a reconnect
if (!isTargetReachable()) {
setConnectState(State.RECONNECTING);
}
}
}
public boolean isConnected() {
return getOpenhabConnectionState() == State.CONNECTED;
}
public void addSSEObserver(Observer<Object, JsonObject> observer) {
addSSEObserver(observer, "");
}
public void addSSEObserver(final Observer<Object, JsonObject> observer, final String topicRegex) {
synchronized (topicObservableMapLock) {
if (topicObservableMap.containsKey(topicRegex)) {
topicObservableMap.get(topicRegex).addObserver(observer);
return;
}
final ObservableImpl<Object, JsonObject> observable = new ObservableImpl<>(this);
observable.addObserver(observer);
topicObservableMap.put(topicRegex, observable);
}
}
public void removeSSEObserver(Observer<Object, JsonObject> observer) {
removeSSEObserver(observer, "");
}
public void removeSSEObserver(Observer<Object, JsonObject> observer, final String topicFilter) {
synchronized (topicObservableMapLock) {
if (topicObservableMap.containsKey(topicFilter)) {
topicObservableMap.get(topicFilter).removeObserver(observer);
}
}
}
private void resetConnection() {
// cancel ongoing connection task
if (!connectionTask.isDone()) {
connectionTask.cancel(false);
}
// close sse
if (sseSource != null) {
sseSource.close();
sseSource = null;
}
}
public void validateConnection() throws CouldNotPerformException {
if (!isConnected()) {
throw new InvalidStateException("Openhab not reachable yet!");
}
}
private String validateResponse(final Response response) throws CouldNotPerformException, ProcessingException {
return validateResponse(response, false);
}
private String validateResponse(final Response response, final boolean skipConnectionValidation) throws CouldNotPerformException, ProcessingException {
final String result = response.readEntity(String.class);
if (response.getStatus() == 200 || response.getStatus() == 201 || response.getStatus() == 202) {
return result;
} else if (response.getStatus() == 404) {
if (!skipConnectionValidation) {
checkConnectionState();
}
throw new NotAvailableException("URL");
} else if (response.getStatus() == 503) {
if (!skipConnectionValidation) {
checkConnectionState();
}
// throw a processing exception to indicate that openHAB is still not fully started, this is used to wait for openHAB
throw new ProcessingException("OpenHAB server not ready");
} else {
throw new CouldNotPerformException("Response returned with ErrorCode[" + response.getStatus() + "], Result[" + result + "] and ErrorMessage[" + response.getStatusInfo().getReasonPhrase() + "]");
}
}
protected String get(final String target) throws CouldNotPerformException {
return get(target, false);
}
protected String get(final String target, final boolean skipValidation) throws CouldNotPerformException {
try {
// handle validation
if (!skipValidation) {
validateConnection();
}
final WebTarget webTarget = restTarget.path(target);
final Response response = webTarget.request().get();
return validateResponse(response, skipValidation);
} catch (CouldNotPerformException | ProcessingException ex) {
if (isShutdownInitiated()) {
ExceptionProcessor.setInitialCause(ex, new ShutdownInProgressException(this));
}
throw new CouldNotPerformException("Could not get sub-URL[" + target + "]", ex);
}
}
protected String delete(final String target) throws CouldNotPerformException {
try {
validateConnection();
final WebTarget webTarget = restTarget.path(target);
final Response response = webTarget.request().delete();
return validateResponse(response);
} catch (CouldNotPerformException | ProcessingException ex) {
if (isShutdownInitiated()) {
ExceptionProcessor.setInitialCause(ex, new ShutdownInProgressException(this));
}
throw new CouldNotPerformException("Could not delete sub-URL[" + target + "]", ex);
}
}
protected String putJson(final String target, final Object value) throws CouldNotPerformException {
return put(target, gson.toJson(value), MediaType.APPLICATION_JSON_TYPE);
}
protected String put(final String target, final String value, final MediaType mediaType) throws CouldNotPerformException {
try {
validateConnection();
final WebTarget webTarget = restTarget.path(target);
final Response response = webTarget.request().put(Entity.entity(value, mediaType));
return validateResponse(response);
} catch (CouldNotPerformException | ProcessingException ex) {
if (isShutdownInitiated()) {
ExceptionProcessor.setInitialCause(ex, new ShutdownInProgressException(this));
}
throw new CouldNotPerformException("Could not put value[" + value + "] on sub-URL[" + target + "]", ex);
}
}
protected String postJson(final String target, final Object value) throws CouldNotPerformException {
return post(target, gson.toJson(value), MediaType.APPLICATION_JSON_TYPE);
}
protected String post(final String target, final String value, final MediaType mediaType) throws CouldNotPerformException {
try {
validateConnection();
final WebTarget webTarget = restTarget.path(target);
final Response response = webTarget.request().post(Entity.entity(value, mediaType));
return validateResponse(response);
} catch (CouldNotPerformException | ProcessingException ex) {
if (isShutdownInitiated()) {
ExceptionProcessor.setInitialCause(ex, new ShutdownInProgressException(this));
}
throw new CouldNotPerformException("Could not post Value[" + value + "] of MediaType[" + mediaType + "] on sub-URL[" + target + "]", ex);
}
}
public boolean isShutdownInitiated() {
return shutdownInitiated;
}
@Override
public void shutdown() {
// prepare shutdown
shutdownInitiated = true;
setConnectState(State.DISCONNECTED);
// stop rest service
restClient.close();
// stop sse service
synchronized (topicObservableMapLock) {
for (final Observable<Object, JsonObject> jsonObjectObservable : topicObservableMap.values()) {
jsonObjectObservable.shutdown();
}
topicObservableMap.clear();
resetConnection();
}
}
}
| DivineCooperation/bco.core-manager | openhab/src/main/java/org/openbase/bco/device/openhab/communication/OpenHABRestConnection.java | Java | lgpl-3.0 | 17,838 |
#include "gitrepository.h"
#include <qtcacheexception.h>
#include <git2.h>
inline void git_eval(int err){
if (err) {
const git_error* err = giterr_last();
throw QtC::QtCacheException(err->message);
}
}
template<typename T> class git_auto
{
public:
git_auto(T* object = NULL)
: ref(object)
{}
~git_auto();
operator T*() const { return ref; }
T** operator &() {return &ref; }
private:
T* ref;
};
git_auto<git_repository>::~git_auto() { git_repository_free(this->ref); }
git_auto<git_signature>::~git_auto() { git_signature_free(this->ref); }
git_auto<git_index>::~git_auto() { git_index_free(this->ref); }
git_auto<git_tree>::~git_auto() { git_tree_free(this->ref); }
git_auto<git_reference>::~git_auto() { git_reference_free(this->ref); }
git_auto<git_commit>::~git_auto() { git_commit_free(this->ref); }
git_auto<git_status_list>::~git_auto() { git_status_list_free(this->ref); }
git_auto<git_remote>::~git_auto() {
if (this->ref && git_remote_connected(this->ref)) {
git_remote_disconnect(this->ref);
}
git_remote_free(this->ref);
}
GitRepository::GitRepository(const QString &localDirPath)
: m_local_dir_path(localDirPath),
m_repo(NULL),
m_signature(NULL)
{
git_libgit2_init();
}
GitRepository::~GitRepository()
{
if (NULL != m_signature) {
git_signature_free(m_signature);
}
if (NULL != m_repo) {
git_repository_free(m_repo);
}
git_libgit2_shutdown();
}
bool GitRepository::isOpen()
{
return NULL != m_repo;
}
void GitRepository::setRepository(git_repository* repo)
{
if (NULL != m_repo){
git_repository_free(m_repo);
}
m_repo = repo;
}
git_repository* GitRepository::repository()
{
if (NULL == m_repo){
try{
open();
}catch(...){
try{
init();
}catch(...){
throw;
}
}
}
return m_repo;
}
void GitRepository::open()
{
git_repository* repo = NULL;
git_eval(git_repository_open(&repo, m_local_dir_path.absolutePath().toLocal8Bit()));
setRepository(repo);
}
void GitRepository::init()
{
git_repository* repo = NULL;
git_repository_init_options initopts = GIT_REPOSITORY_INIT_OPTIONS_INIT;
initopts.flags = GIT_REPOSITORY_INIT_MKPATH;
git_eval(git_repository_init_ext(&repo, m_local_dir_path.absolutePath().toLocal8Bit(), &initopts));
git_auto<git_index> index;
git_eval(git_repository_index(&index, repo));
git_oid tree_id;
git_eval(git_index_write_tree(&tree_id, index));
git_auto<git_tree> tree;
git_eval(git_tree_lookup(&tree, repo, &tree_id));
git_oid commit_id;
git_eval(git_commit_create_v(&commit_id, repo, "HEAD", signature(), signature(), NULL, "Initial commit", tree, 0));
setRepository(repo);
}
void GitRepository::branch(const QString& name)
{
git_repository* repo = repository();
git_auto<git_reference> branch;
int err = git_branch_lookup(&branch, repo, name.toLatin1(), GIT_BRANCH_LOCAL);
if (err == GIT_ENOTFOUND){
git_oid parent_id;
git_auto<git_commit> parent;
git_eval(git_reference_name_to_id(&parent_id, repo, "HEAD"));
git_eval(git_commit_lookup(&parent, repo, &parent_id));
git_eval(git_branch_create(&branch, repo, name.toLocal8Bit(), parent, 1));
}else{
git_eval(err);
}
git_eval(git_repository_set_head(repo, git_reference_name(branch)));
git_checkout_options opts = GIT_CHECKOUT_OPTIONS_INIT;
opts.checkout_strategy = GIT_CHECKOUT_FORCE;
git_eval(git_checkout_head(repo, &opts));
}
void GitRepository::add(const QString& filepath)
{
git_repository* repo = repository();
git_auto<git_index> index;
git_eval(git_repository_index(&index, repo));
git_eval(git_index_add_bypath(index, filepath.toLatin1()));
git_index_write(index);
git_index_free(index);
}
void GitRepository::commit(const QString& message)
{
git_repository* repo = repository();
{
git_auto<git_status_list> changes;
git_eval(git_status_list_new(&changes, repo, NULL));
if (git_status_list_entrycount(changes) == 0) { return; }
}
git_auto<git_index> index;
git_eval(git_repository_index(&index, repo));
git_oid tree_id;
git_eval(git_index_write_tree(&tree_id, index));
git_auto<git_tree> tree;
git_eval(git_tree_lookup(&tree, repo, &tree_id));
git_oid parent_id;
git_eval(git_reference_name_to_id(&parent_id, repo, "HEAD"));
git_auto<git_commit> parent;
git_eval(git_commit_lookup(&parent, repo, &parent_id));
git_oid commit_id;
git_signature* sig = signature();
git_eval(git_commit_create_v(&commit_id, repo, "HEAD", sig, sig, NULL, message.toLocal8Bit(), tree, 1, parent));
}
void GitRepository::clone(const QString& url)
{
git_repository* repo = NULL;
git_clone_options opts = GIT_CLONE_OPTIONS_INIT;
opts.checkout_branch = "master";
git_eval(git_clone(&repo, url.toLatin1(), m_local_dir_path.absolutePath().toLocal8Bit(), &opts));
setRepository(repo);
}
void GitRepository::push()
{
git_repository* repo = repository();
const char* remote_name = "origin";
git_auto<git_remote> remote;
git_eval(git_remote_lookup(&remote, repo, remote_name));
git_eval(git_remote_connect(remote, GIT_DIRECTION_PUSH, NULL, NULL));
git_auto<git_reference> head;
git_eval(git_repository_head(&head, repo));
QString refname = QString("+%1:%1").arg(git_reference_name(head));
git_eval(git_remote_add_push(repo, remote_name, refname.toLatin1()));
git_eval(git_remote_upload(remote, NULL, NULL));
}
void GitRepository::fetch()
{
git_repository* repo = repository();
const char* remote_name = "origin";
git_auto<git_remote> remote;
git_eval(git_remote_lookup(&remote, repo, remote_name));
git_eval(git_remote_connect(remote, GIT_DIRECTION_FETCH, NULL, NULL));
git_eval(git_remote_fetch(remote, NULL, NULL, NULL));
}
void GitRepository::setSignature(const QString& authorName, const QString& authorEmail)
{
git_signature* sig = m_signature;
if (sig) { git_signature_free(sig); }
git_eval(git_signature_now(&sig, authorName.toLocal8Bit(), authorEmail.toLocal8Bit()));
m_signature = sig;
}
git_signature* GitRepository::signature()
{
if (!m_signature) { setSignature(); }
return m_signature;
}
| entwickler42/QtCache | QtCacheGitPlugin/gitrepository.cpp | C++ | lgpl-3.0 | 6,672 |
/*
* SonarLint for Visual Studio
* Copyright (C) 2016-2017 SonarSource SA
* mailto:info AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
using System;
using SonarLint.VisualStudio.Progress.Controller;
namespace SonarLint.VisualStudio.Progress.UnitTests
{
/// <summary>
/// Partial class implementation of <see cref="IProgressStepExecutionEvents"/>
/// </summary>
public partial class ConfigurableProgressController : IProgressStepExecutionEvents
{
void IProgressStepExecutionEvents.ProgressChanged(string progressDetailText, double progress)
{
this.progressChanges.Add(Tuple.Create(progressDetailText, progress));
}
}
} | duncanpMS/sonarlint-visualstudio | src/Progress.TestFramework/ConfigurableProgressController.IProgressStepExecutionEvents.cs | C# | lgpl-3.0 | 1,405 |
<?php
/**
* @copyright Copyright (c) Metaways Infosystems GmbH, 2011
* @license LGPLv3, http://www.arcavias.com/en/license
* @package MShop
* @subpackage Common
*/
/**
* Common interface for items that carry sorting informations.
*
* @package MShop
* @subpackage Common
*/
interface MShop_Common_Item_Position_Interface
{
/**
* Returns the position of the item in the list.
*
* @return integer Position of the item in the list
*/
public function getPosition();
/**
* Sets the new position of the item in the list.
*
* @param integer $pos position of the item in the list
* @return void
*/
public function setPosition( $pos );
}
| Arcavias/arcavias-core | lib/mshoplib/src/MShop/Common/Item/Position/Interface.php | PHP | lgpl-3.0 | 664 |
#!/bin/zsh
export PATH="${HOME}/bin:${HOME}/script:${PATH}"
export HISTSIZE=1000000
if [[ -z "${HOSTNAME}" ]] ; then
export HOSTNAME="${HOST:-$(hostname)}"
fi
if [[ -d "${MYSHELL}/plugins" ]]; then
for i in "${MYSHELL}/plugins/"* ; do
source "${i}"
done
fi
function prompt_char() {
if [ $UID -eq 0 ]; then echo "#"; else echo $; fi
}
local ret_status="%(?:%{$fg_bold[green]%}$(prompt_char) :%{$fg_bold[red]%}$(prompt_char) %s)"
PROMPT='%(!.%{$fg_bold[red]%}.%{$fg_bold[red]%}%m%{$fg_bold[green]%} )%n %{$fg_bold[blue]%}%(!.%1~.%~) $(git_prompt_info)%_${ret_status}%{$reset_color%}'
ZSH_THEME_GIT_PROMPT_PREFIX="(%{$fg[red]%}"
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
ZSH_THEME_GIT_PROMPT_DIRTY="%{$fg[blue]%}%{$fg[yellow]%}*%{$fg[blue]%}) "
ZSH_THEME_GIT_PROMPT_CLEAN="%{$fg[blue]%}) "
lsopt="-F"
dfopt="-h"
if [ -x /usr/bin/dircolors ]; then
lsopt="${lsopt} --color=auto"
alias grep='grep --color=auto'
fi
if [[ "$(uname)" == "FreeBSD" ]] || [[ "$(uname)" == "Darwin" ]] ; then
lsopt="${lsopt} -GF"
else
lshelp="$(ls --help)"
[ "$(grep -- "--show-control-chars" <<<"${lshelp}")" ] && \
lsopt="${lsopt} --show-control-chars"
[ "$(grep -- "--group-directories-first" <<<"${lshelp}")" ] && \
lsopt="${lsopt} --group-directories-first"
dfopt="${dfopt} -T -x supermount"
fi
alias l="ls ${lsopt}"
alias la='l -a'
alias l1='l -1'
alias ll='l -l'
alias lla='l -la'
alias lsd='l -d */'
alias df="df ${dfopt}"
unset lshelp lsopt dfopt
alias ssu='sudo -H bash --rcfile "${HOME}/.bashrc"'
alias myip='dig +short myip.opendns.com @resolver1.opendns.com || wget -qO /dev/stdout "http://icanhazip.com" || curl -s "http://icanhazip.com"'
if (( $+commands[ssh] )) ; then
alias ssh='ssh -oStrictHostKeyChecking=no'
alias ssht='ssh [email protected]'
fi
if (( $+commands[vim] )) ; then
export EDITOR="${EDITOR:-vim}"
fi
if (( $+commands[direnv] )) ; then
eval "$(direnv hook zsh)"
fi
if (( $+commands[docker] )) ; then
alias dklog="docker logs -f"
alias dkre="docker restart -t 0"
fi
if (( $+commands[gitk] )) ; then
alias gitk='gitk --all &'
fi
if [[ "${TERM}" == "xterm" ]] ; then
if (( $+commands[tmux] )) ; then
if [[ -z "${TMUX}" ]] ; then
tmux attach || tmux
fi
elif (( $+commands[screen] )) ; then
screen -wipe
screen -x "$(whoami)" || screen -S "$(whoami)"
elif [ "$(uname -s)" != "Darwin" ] ; then
[ "$(id -u)" -ne 0 ] && [ -n "$(type -p last)" ] && last -5
fi
elif [ "$(uname -s)" != "Darwin" ] ; then
[ "$(id -u)" -ne 0 ] && [ -n "$(type -p last)" ] && last -5
fi
if (( $+functions[kube_ps1] )); then
KUBE_PS1_SUFFIX=") "
PROMPT='$(kube_ps1)'${PROMPT}
fi
# load custom script post login
if [ -d "${MYSHELL}/custom/zsh/login-post" ] ; then
for i in $(find "${MYSHELL}/custom/zsh/login-post" -iname \*.zsh) ; do
source "${i}"
done
fi
[ -f "${HOME}/.zshrc.local" ] && \
source "${HOME}/.zshrc.local"
unset i
| tsaikd/bash | zsh/tsaikd.zsh | Shell | lgpl-3.0 | 2,879 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qdeclarativefontloader.cpp -->
<title>Qt 4.7: List of All Members for FontLoader</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li><a href="qdeclarativeelements.html">QML Elements</a></li>
<li>List of All Members for FontLoader</li>
</ul>
</div>
</div>
<div class="content mainContent">
<h1 class="title">List of All Members for FontLoader</h1>
<p>This is the complete list of members for <a href="qml-fontloader.html">QML FontLoader Element</a>, including inherited members.</p>
<ul>
<li class="fn"><span class="name"><b><a href="qml-fontloader.html#name-prop">name</a></b></span></li>
<li class="fn"><span class="name"><b><a href="qml-fontloader.html#source-prop">source</a></b></span></li>
<li class="fn"><span class="name"><b><a href="qml-fontloader.html#status-prop">status</a></b></span></li>
</ul>
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2008-2011 Nokia Corporation and/or its
subsidiaries. Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide.</p>
<p>
All other trademarks are property of their respective owners. <a title="Privacy Policy"
href="http://qt.nokia.com/about/privacy-policy">Privacy Policy</a></p>
<br />
<p>
Licensees holding valid Qt Commercial licenses may use this document in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and Nokia.</p>
<p>
Alternatively, this document may be used under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU
Free Documentation License version 1.3</a>
as published by the Free Software Foundation.</p>
</div>
</body>
</html>
| ssangkong/NVRAM_KWU | qt-everywhere-opensource-src-4.7.4/doc/html/qml-fontloader-members.html | HTML | lgpl-3.0 | 2,486 |
#!/bin/sh
#cabal install msgpack-rpc
ghc --make ping.hs
| turkia/msgpack_rpc_server | examples/haskell/compile.sh | Shell | lgpl-3.0 | 56 |
create schema if not exists toughradius collate utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS raduser@'172.%.%.%' identified by 'radpwd';
GRANT ALL PRIVILEGES ON toughradius.* TO raduser@'172.%.%.%';
ALTER USER 'raduser'@'172.%.%.%' IDENTIFIED WITH mysql_native_password BY 'radpwd';
use toughradius;
create table if not exists tr_bras
(
id bigint auto_increment primary key,
identifier varchar(128) null,
name varchar(64) not null,
ipaddr varchar(32) null,
vendor_id varchar(32) not null,
portal_vendor varchar(32) not null,
secret varchar(64) not null,
coa_port int not null,
ac_port int not null,
auth_limit int null,
acct_limit int null,
status enum('enabled', 'disabled') null,
remark varchar(512) null,
create_time datetime not null
);
create index ix_tr_bras_identifier on tr_bras (identifier);
create index ix_tr_bras_ipaddr on tr_bras (ipaddr);
create table if not exists tr_config
(
id bigint auto_increment primary key,
type varchar(32) not null,
name varchar(128) not null,
value varchar(255) null,
remark varchar(255) null
);
create table if not exists tr_subscribe
(
id bigint auto_increment primary key,
node_id bigint default 0 not null,
subscriber varchar(32) null,
realname varchar(32) null,
password varchar(128) not null,
domain varchar(128) null,
addr_pool varchar(128) null,
policy varchar(512) null,
is_online int null,
active_num int null,
bind_mac tinyint(1) null,
bind_vlan tinyint(1) null,
ip_addr varchar(32) null,
mac_addr varchar(32) null,
in_vlan int null,
out_vlan int null,
up_rate bigint null,
down_rate bigint null,
up_peak_rate bigint null,
down_peak_rate bigint null,
up_rate_code varchar(32) null,
down_rate_code varchar(32) null,
status enum('enabled', 'disabled') null,
remark varchar(512) null,
begin_time datetime not null,
expire_time datetime not null,
create_time datetime not null,
update_time datetime null
);
create index ix_tr_subscribe_create_time
on tr_subscribe (create_time);
create index ix_tr_subscribe_expire_time
on tr_subscribe (expire_time);
create index ix_tr_subscribe_status
on tr_subscribe (status);
create index ix_tr_subscribe_subscriber
on tr_subscribe (subscriber);
create index ix_tr_subscribe_update_time
on tr_subscribe (update_time);
use toughradius;
INSERT INTO toughradius.tr_bras
(identifier, name, ipaddr, vendor_id, portal_vendor,secret, coa_port,ac_port, auth_limit, acct_limit, STATUS, remark, create_time)
VALUES ('radius-tester', 'radius-tester', '127.0.0.1', '14988',"cmccv1", 'secret', 3799,2000, 1000, 1000, NULL, '0', '2019-03-01 14:07:46');
INSERT INTO toughradius.tr_subscribe
(node_id, subscriber, realname, password, domain, addr_pool, policy, is_online, active_num,
bind_mac, bind_vlan, ip_addr, mac_addr, in_vlan, out_vlan, up_rate, down_rate, up_peak_rate, down_peak_rate, up_rate_code,
down_rate_code, status, remark, begin_time, expire_time, create_time, update_time)
VALUES (0, 'test01', '', '888888', null, null, null, null, 10, 0, 0, '', '', 0, 0, 10.000, 10.000, 100.000, 100.000,
'10', '10', 'enabled', '', '2019-03-01 14:13:02', '2019-03-01 14:13:00', '2019-03-01 14:12:59', '2019-03-01 14:12:56'); | talkincode/ToughRADIUS | docker/toughradius.db.sql | SQL | lgpl-3.0 | 3,175 |
/*
* =====================================================================================
*
* Filename: select-sort.c
*
* Description:
*
* Version: 1.0
* Created: 12/23/2016 04:47:42 PM
* Revision: none
* Compiler: gcc
*
* Author: YOUR NAME (),
* Organization:
*
* =====================================================================================
*/
#include <stdio.h>
#include <stdlib.h>
int icomp = 0;
int iswap = 0;
int cmp_fun(int a, int b) {
icomp++;
return a > b;
}
int swap(int * a, int * b) {
*a = *a ^ *b;
*b = *a ^ *b;
*a = *a ^ *b;
iswap ++;
return 1;
}
int select_sort(int *pList, int len) {
if(NULL == pList || len < 0) {
return -1;
}
int i = 0;
for(i = 0; i < len; i++) {
int iTop = pList[i];
int iPos = i;
int j = 0;
for(j = i + 1; j < len; j++) {
if(cmp_fun(iTop, pList[j])) {
iTop = pList[j];
iPos = j;
}
}
if(i != iPos) {
swap(&pList[i], &pList[iPos]);
}
}
return 0;
}
int get_list(int *list, int len) {
srand(374676);
int i = 0;
for(i = 0; i < len; i++) {
list[i] = rand() % (len * 20);
}
return 0;
}
int check_list(int *list, int len) {
int i;
int iCnt = 0;
for(i = 0; i < len - 1; i++) {
if(cmp_fun(list[i], list[i + 1])) {
iCnt++;
}
}
return iCnt;
}
void show_list(int *pList, int len) {
int i = 0;
for(i = 0; i < len; i++) {
printf("%d ", pList[i]);
}
printf("\n");
}
int test_sort(int n) {
icomp = 0;
iswap = 0;
int *pList = (int*)malloc(sizeof(int) * n);
get_list(pList, n);
//show_list(pList, n);
select_sort(pList, n);
int iThro = n * (n + 1) / 2;
printf("n = %d, tcmp = %d, rcmp = %d, dc = %lf\n", n, iThro, icomp, (double)icomp / iThro);
printf("n = %d, tswp = %d, rswp = %d, ds = %lf\n", n, n - 1, iswap, (double)iswap / (n - 1));
int iT = check_list(pList, n);
if(iT) {
printf("sort faild, [%d]\n", iT);
}
//show_list(pList, n);
free(pList);
printf("\n");
return 0;
}
int main() {
int i = 0;
for(i = 16; i <= 1024 * 16; i *= 2) {
test_sort(i);
}
return 0;
}
| fengbohello/practice | clang/algorithm/select-sort.c | C | lgpl-3.0 | 2,362 |
## Welcome to GitHub Pages
You can use the [editor on GitHub](https://github.com/ldscholar/ldscholar.github.io/edit/master/README.md) to maintain and preview the content for your website in Markdown files.
Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
### Markdown
Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
```markdown
Syntax highlighted code block
# Header 1
## Header 2
### Header 3
- Bulleted
- List
1. Numbered
2. List
**Bold** and _Italic_ and `Code` text
[Link](url) and 
```
For more details see [GitHub Flavored Markdown](https://guides.github.com/features/mastering-markdown/).
### Jekyll Themes
Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/ldscholar/ldscholar.github.io/settings). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
### Support or Contact
Having trouble with Pages? Check out our [documentation](https://help.github.com/categories/github-pages-basics/) or [contact support](https://github.com/contact) and we’ll help you sort it out.
| ldscholar/ldscholar.github.io | README.md | Markdown | lgpl-3.0 | 1,295 |
#include "StructuralInterface.h"
StructuralInterface::StructuralInterface (StructuralEntity *parent)
: StructuralEntity (parent)
{
setCategory (Structural::Interface);
setStructuralType (Structural::NoType);
setResizable (false);
setTop (0);
setLeft (0);
setWidth (ST_DEFAULT_INTERFACE_W);
setHeight (ST_DEFAULT_INTERFACE_H);
if (!ST_OPT_SHOW_INTERFACES)
setHidden (true);
}
void
StructuralInterface::adjust (bool collision, bool recursion)
{
StructuralEntity::adjust (collision, recursion);
// Adjusting position...
StructuralEntity *parent = structuralParent ();
if (parent || !ST_OPT_WITH_BODY)
{
if (!collision)
{
// Tries (10x) to find a position where there is no collision with others
// relatives
for (int i = 0; i < 10; i++)
{
bool colliding = false;
for (StructuralEntity *ent : StructuralUtil::neighbors (this))
{
if (ent != this)
{
int n = 0, max = 1000;
qreal current = 0.0;
ent->setSelectable (false);
while (collidesWithItem (ent, Qt::IntersectsItemBoundingRect))
{
QLineF line
= QLineF (left () + width () / 2, top () + height () / 2,
ent->width () / 2, ent->height () / 2);
line.setAngle (qrand () % 360);
current += (double)(qrand () % 100) / 1000.0;
setTop (top () + line.pointAt (current / 2).y ()
- line.p1 ().y ());
setLeft (left () + line.pointAt (current / 2).x ()
- line.p1 ().x ());
if (++n > max)
break;
}
constrain ();
ent->setSelectable (true);
}
}
for (StructuralEntity *ent : StructuralUtil::neighbors (this))
if (collidesWithItem (ent, Qt::IntersectsItemBoundingRect))
colliding = true;
if (!colliding)
break;
}
}
constrain ();
StructuralUtil::adjustEdges (this);
}
}
void
StructuralInterface::constrain ()
{
StructuralEntity *parent = structuralParent ();
if (parent != nullptr)
{
QPointF tail (parent->width () / 2, parent->height () / 2);
QPointF head (left () + width () / 2, top () + height () / 2);
if (tail == head)
{
head.setX (tail.x ());
head.setY (tail.y () - 10);
}
QPointF p = head;
QLineF line (tail, head);
bool status = true;
qreal current = 1.0;
qreal step = 0.01;
if (!parent->contains (p))
{
step = -0.01;
status = false;
}
do
{
current += step;
p = line.pointAt (current);
} while (parent->contains (p) == status);
if (QLineF (p, head).length () > 7)
{
setTop (p.y () - height () / 2);
setLeft (p.x () - width () / 2);
}
}
}
void
StructuralInterface::draw (QPainter *painter)
{
int x = ST_DEFAULT_ENTITY_PADDING + ST_DEFAULT_INTERFACE_PADDING;
int y = ST_DEFAULT_ENTITY_PADDING + ST_DEFAULT_INTERFACE_PADDING;
int w = width () - 2 * ST_DEFAULT_INTERFACE_PADDING;
int h = height () - 2 * ST_DEFAULT_INTERFACE_PADDING;
painter->drawPixmap (x, y, w, h,
QPixmap (StructuralUtil::icon (structuralType ())));
if (!ST_OPT_WITH_BODY && !ST_OPT_USE_FLOATING_INTERFACES)
{
if (property (ST_ATTR_ENT_AUTOSTART) == ST_VALUE_TRUE)
{
painter->setPen (QPen (QBrush (QColor (76, 76, 76)), 2));
painter->drawRect (x, y, w, h);
}
}
if (!error ().isEmpty () || !warning ().isEmpty ())
{
QString icon;
if (!error ().isEmpty ())
icon = QString (ST_DEFAULT_ALERT_ERROR_ICON);
else
icon = QString (ST_DEFAULT_ALERT_WARNING_ICON);
painter->drawPixmap (x + w / 2 - (ST_DEFAULT_ALERT_ICON_W - 3) / 2,
y + h / 2 - (ST_DEFAULT_ALERT_ICON_H - 3) / 2,
ST_DEFAULT_ALERT_ICON_W - 3,
ST_DEFAULT_ALERT_ICON_H - 3, QPixmap (icon));
}
if (isMoving ())
{
painter->setBrush (QBrush (Qt::NoBrush));
painter->setPen (QPen (QBrush (Qt::black), 0));
int moveX = x + moveLeft () - left ();
int moveY = y + moveTop () - top ();
int moveW = w;
int moveH = h;
painter->drawRect (moveX, moveY, moveW, moveH);
}
}
| TeleMidia/nclcomposer | src/plugins/ncl-structural-view/view/StructuralInterface.cpp | C++ | lgpl-3.0 | 4,376 |
/*
* SonarQube
* Copyright (C) 2009-2016 SonarSource SA
* mailto:contact AT sonarsource DOT com
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.api.server.authentication;
import javax.annotation.concurrent.Immutable;
import static com.google.common.base.Preconditions.checkArgument;
import static org.apache.commons.lang.StringUtils.isNotBlank;
/**
* Display information provided by the Identity Provider to be displayed into the login form.
*
* @since 5.4
*/
@Immutable
public final class Display {
private final String iconPath;
private final String backgroundColor;
private Display(Builder builder) {
this.iconPath = builder.iconPath;
this.backgroundColor = builder.backgroundColor;
}
/**
* URL path to the provider icon, as deployed at runtime, for example "/static/authgithub/github.svg" (in this
* case "authgithub" is the plugin key. Source file is "src/main/resources/static/github.svg").
* It can also be an external URL, for example "http://www.mydomain/myincon.png".
*
* Must not be blank.
* <br>
* The recommended format is SVG with a size of 24x24 pixels.
* Other supported format is PNG, with a size of 40x40 pixels.
*/
public String getIconPath() {
return iconPath;
}
/**
* Background color for the provider button displayed in the login form.
* It's a Hexadecimal value, for instance #205081.
* <br>
* If not provided, the default value is #236a97
*/
public String getBackgroundColor() {
return backgroundColor;
}
public static Builder builder() {
return new Builder();
}
public static class Builder {
private String iconPath;
private String backgroundColor = "#236a97";
private Builder() {
}
/**
* @see Display#getIconPath()
*/
public Builder setIconPath(String iconPath) {
this.iconPath = iconPath;
return this;
}
/**
* @see Display#getBackgroundColor()
*/
public Builder setBackgroundColor(String backgroundColor) {
this.backgroundColor = backgroundColor;
return this;
}
public Display build() {
checkArgument(isNotBlank(iconPath), "Icon path must not be blank");
validateBackgroundColor();
return new Display(this);
}
private void validateBackgroundColor() {
checkArgument(isNotBlank(backgroundColor), "Background color must not be blank");
checkArgument(backgroundColor.length() == 7 && backgroundColor.indexOf('#') == 0,
"Background color must begin with a sharp followed by 6 characters");
}
}
}
| Builders-SonarSource/sonarqube-bis | sonar-plugin-api/src/main/java/org/sonar/api/server/authentication/Display.java | Java | lgpl-3.0 | 3,286 |
<?php
/*
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
declare(strict_types=1);
namespace pocketmine\thread;
use pocketmine\scheduler\AsyncTask;
use const PTHREADS_INHERIT_NONE;
/**
* Specialized Worker class for PocketMine-MP-related use cases. It handles setting up autoloading and error handling.
*
* Workers are a special type of thread which execute tasks passed to them during their lifetime. Since creating a new
* thread has a high resource cost, workers can be kept around and reused for lots of short-lived tasks.
*
* As a plugin developer, you'll rarely (if ever) actually need to use this class directly.
* If you want to run tasks on other CPU cores, check out AsyncTask first.
* @see AsyncTask
*/
abstract class Worker extends \Worker{
use CommonThreadPartsTrait;
public function start(int $options = PTHREADS_INHERIT_NONE) : bool{
//this is intentionally not traitified
ThreadManager::getInstance()->add($this);
if($this->getClassLoaders() === null){
$this->setClassLoaders();
}
return parent::start($options);
}
/**
* Stops the thread using the best way possible. Try to stop it yourself before calling this.
*/
public function quit() : void{
$this->isKilled = true;
if(!$this->isShutdown()){
while($this->unstack() !== null);
$this->notify();
$this->shutdown();
}
ThreadManager::getInstance()->remove($this);
}
}
| pmmp/PocketMine-MP | src/thread/Worker.php | PHP | lgpl-3.0 | 2,040 |
/*
* SonarQube, open source software quality management tool.
* Copyright (C) 2008-2014 SonarSource
* mailto:contact AT sonarsource DOT com
*
* SonarQube is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* SonarQube is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package org.sonar.server.computation.step;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.ibatis.session.ResultContext;
import org.apache.ibatis.session.ResultHandler;
import org.sonar.api.utils.System2;
import org.sonar.batch.protocol.output.BatchReport;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.persistence.MyBatis;
import org.sonar.core.source.db.FileSourceDto;
import org.sonar.core.source.db.FileSourceDto.Type;
import org.sonar.server.computation.batch.BatchReportReader;
import org.sonar.server.computation.component.Component;
import org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor;
import org.sonar.server.computation.component.TreeRootHolder;
import org.sonar.server.computation.source.ComputeFileSourceData;
import org.sonar.server.computation.source.CoverageLineReader;
import org.sonar.server.computation.source.DuplicationLineReader;
import org.sonar.server.computation.source.HighlightingLineReader;
import org.sonar.server.computation.source.LineReader;
import org.sonar.server.computation.source.ScmLineReader;
import org.sonar.server.computation.source.SymbolsLineReader;
import org.sonar.server.db.DbClient;
import org.sonar.server.source.db.FileSourceDb;
import org.sonar.server.util.CloseableIterator;
import static org.sonar.server.computation.component.DepthTraversalTypeAwareVisitor.Order.PRE_ORDER;
public class PersistFileSourcesStep implements ComputationStep {
private final DbClient dbClient;
private final System2 system2;
private final TreeRootHolder treeRootHolder;
private final BatchReportReader reportReader;
public PersistFileSourcesStep(DbClient dbClient, System2 system2, TreeRootHolder treeRootHolder, BatchReportReader reportReader) {
this.dbClient = dbClient;
this.system2 = system2;
this.treeRootHolder = treeRootHolder;
this.reportReader = reportReader;
}
@Override
public void execute() {
// Don't use batch insert for file_sources since keeping all data in memory can produce OOM for big files
DbSession session = dbClient.openSession(false);
try {
new FileSourceVisitor(session).visit(treeRootHolder.getRoot());
} finally {
MyBatis.closeQuietly(session);
}
}
private class FileSourceVisitor extends DepthTraversalTypeAwareVisitor {
private final DbSession session;
private Map<String, FileSourceDto> previousFileSourcesByUuid = new HashMap<>();
private String projectUuid;
private FileSourceVisitor(DbSession session) {
super(Component.Type.FILE, PRE_ORDER);
this.session = session;
}
@Override
public void visitProject(Component project) {
this.projectUuid = project.getUuid();
session.select("org.sonar.core.source.db.FileSourceMapper.selectHashesForProject", ImmutableMap.of("projectUuid", projectUuid, "dataType", Type.SOURCE),
new ResultHandler() {
@Override
public void handleResult(ResultContext context) {
FileSourceDto dto = (FileSourceDto) context.getResultObject();
previousFileSourcesByUuid.put(dto.getFileUuid(), dto);
}
});
}
@Override
public void visitFile(Component file) {
int fileRef = file.getRef();
BatchReport.Component component = reportReader.readComponent(fileRef);
CloseableIterator<String> linesIterator = reportReader.readFileSource(fileRef);
LineReaders lineReaders = new LineReaders(reportReader, fileRef);
try {
ComputeFileSourceData computeFileSourceData = new ComputeFileSourceData(linesIterator, lineReaders.readers(), component.getLines());
ComputeFileSourceData.Data fileSourceData = computeFileSourceData.compute();
persistSource(fileSourceData, file.getUuid());
} catch (Exception e) {
throw new IllegalStateException(String.format("Cannot persist sources of %s", file.getKey()), e);
} finally {
linesIterator.close();
lineReaders.close();
}
}
private void persistSource(ComputeFileSourceData.Data fileSourceData, String componentUuid) {
FileSourceDb.Data fileData = fileSourceData.getFileSourceData();
byte[] data = FileSourceDto.encodeSourceData(fileData);
String dataHash = DigestUtils.md5Hex(data);
String srcHash = fileSourceData.getSrcHash();
String lineHashes = fileSourceData.getLineHashes();
FileSourceDto previousDto = previousFileSourcesByUuid.get(componentUuid);
if (previousDto == null) {
FileSourceDto dto = new FileSourceDto()
.setProjectUuid(projectUuid)
.setFileUuid(componentUuid)
.setDataType(Type.SOURCE)
.setBinaryData(data)
.setSrcHash(srcHash)
.setDataHash(dataHash)
.setLineHashes(lineHashes)
.setCreatedAt(system2.now())
.setUpdatedAt(system2.now());
dbClient.fileSourceDao().insert(session, dto);
session.commit();
} else {
// Update only if data_hash has changed or if src_hash is missing (progressive migration)
boolean binaryDataUpdated = !dataHash.equals(previousDto.getDataHash());
boolean srcHashUpdated = !srcHash.equals(previousDto.getSrcHash());
if (binaryDataUpdated || srcHashUpdated) {
previousDto
.setBinaryData(data)
.setDataHash(dataHash)
.setSrcHash(srcHash)
.setLineHashes(lineHashes);
// Optimization only change updated at when updating binary data to avoid unnecessary indexation by E/S
if (binaryDataUpdated) {
previousDto.setUpdatedAt(system2.now());
}
dbClient.fileSourceDao().update(previousDto);
session.commit();
}
}
}
}
private static class LineReaders {
private final List<LineReader> readers = new ArrayList<>();
private final List<CloseableIterator<?>> iterators = new ArrayList<>();
LineReaders(BatchReportReader reportReader, int componentRef) {
CloseableIterator<BatchReport.Coverage> coverageReportIterator = reportReader.readComponentCoverage(componentRef);
BatchReport.Changesets scmReport = reportReader.readChangesets(componentRef);
CloseableIterator<BatchReport.SyntaxHighlighting> highlightingIterator = reportReader.readComponentSyntaxHighlighting(componentRef);
List<BatchReport.Symbols.Symbol> symbols = reportReader.readComponentSymbols(componentRef);
List<BatchReport.Duplication> duplications = reportReader.readComponentDuplications(componentRef);
if (coverageReportIterator != null) {
iterators.add(coverageReportIterator);
readers.add(new CoverageLineReader(coverageReportIterator));
}
if (scmReport != null) {
readers.add(new ScmLineReader(scmReport));
}
if (highlightingIterator != null) {
iterators.add(highlightingIterator);
readers.add(new HighlightingLineReader(highlightingIterator));
}
if (!duplications.isEmpty()) {
readers.add(new DuplicationLineReader(duplications));
}
if (!symbols.isEmpty()) {
readers.add(new SymbolsLineReader(symbols));
}
}
List<LineReader> readers() {
return readers;
}
void close() {
for (CloseableIterator<?> reportIterator : iterators) {
reportIterator.close();
}
}
}
@Override
public String getDescription() {
return "Persist file sources";
}
}
| jblievremont/sonarqube | server/sonar-server/src/main/java/org/sonar/server/computation/step/PersistFileSourcesStep.java | Java | lgpl-3.0 | 8,521 |
package com.wangdaye.common.base.fragment;
import com.wangdaye.common.base.activity.LoadableActivity;
import java.util.List;
/**
* Loadable fragment.
* */
public abstract class LoadableFragment<T> extends MysplashFragment {
/**
* {@link LoadableActivity#loadMoreData(List, int, boolean)}.
* */
public abstract List<T> loadMoreData(List<T> list, int headIndex, boolean headDirection);
}
| WangDaYeeeeee/Mysplash | common/src/main/java/com/wangdaye/common/base/fragment/LoadableFragment.java | Java | lgpl-3.0 | 411 |
/* ========================================================================== */
/* === SuiteSparse_config =================================================== */
/* ========================================================================== */
/* Configuration file for SuiteSparse: a Suite of Sparse matrix packages
* (AMD, COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, and others).
*
* SuiteSparse_config.h provides the definition of the long integer. On most
* systems, a C program can be compiled in LP64 mode, in which long's and
* pointers are both 64-bits, and int's are 32-bits. Windows 64, however, uses
* the LLP64 model, in which int's and long's are 32-bits, and long long's and
* pointers are 64-bits.
*
* SuiteSparse packages that include long integer versions are
* intended for the LP64 mode. However, as a workaround for Windows 64
* (and perhaps other systems), the long integer can be redefined.
*
* If _WIN64 is defined, then the __int64 type is used instead of long.
*
* The long integer can also be defined at compile time. For example, this
* could be added to SuiteSparse_config.mk:
*
* CFLAGS = -O -D'SuiteSparse_long=long long' \
* -D'SuiteSparse_long_max=9223372036854775801' -D'SuiteSparse_long_idd="lld"'
*
* This file defines SuiteSparse_long as either long (on all but _WIN64) or
* __int64 on Windows 64. The intent is that a SuiteSparse_long is always a
* 64-bit integer in a 64-bit code. ptrdiff_t might be a better choice than
* long; it is always the same size as a pointer.
*
* This file also defines the SUITESPARSE_VERSION and related definitions.
*
* Copyright (c) 2012, Timothy A. Davis. No licensing restrictions apply
* to this file or to the SuiteSparse_config directory.
* Author: Timothy A. Davis.
*/
#ifndef _SUITESPARSECONFIG_H
#define _SUITESPARSECONFIG_H
#ifdef __cplusplus
extern "C" {
#endif
#include <limits.h>
#include <stdlib.h>
/* ========================================================================== */
/* === SuiteSparse_long ===================================================== */
/* ========================================================================== */
#ifndef SuiteSparse_long
#ifdef _WIN64
#define SuiteSparse_long __int64
#define SuiteSparse_long_max _I64_MAX
#define SuiteSparse_long_idd "I64d"
#else
#define SuiteSparse_long long
#define SuiteSparse_long_max LONG_MAX
#define SuiteSparse_long_idd "ld"
#endif
#define SuiteSparse_long_id "%" SuiteSparse_long_idd
#endif
/* For backward compatibility with prior versions of SuiteSparse. The UF_*
* macros are deprecated and will be removed in a future version. */
#ifndef UF_long
#define UF_long SuiteSparse_long
#define UF_long_max SuiteSparse_long_max
#define UF_long_idd SuiteSparse_long_idd
#define UF_long_id SuiteSparse_long_id
#endif
/* ========================================================================== */
/* === SuiteSparse_config parameters and functions ========================== */
/* ========================================================================== */
/* SuiteSparse-wide parameters will be placed in this struct. */
typedef struct SuiteSparse_config_struct
{
void *(*malloc_memory) (size_t) ; /* pointer to malloc */
void *(*realloc_memory) (void *, size_t) ; /* pointer to realloc */
void (*free_memory) (void *) ; /* pointer to free */
void *(*calloc_memory) (size_t, size_t) ; /* pointer to calloc */
} SuiteSparse_config ;
void *SuiteSparse_malloc /* pointer to allocated block of memory */
(
size_t nitems, /* number of items to malloc (>=1 is enforced) */
size_t size_of_item, /* sizeof each item */
int *ok, /* TRUE if successful, FALSE otherwise */
SuiteSparse_config *config /* SuiteSparse-wide configuration */
) ;
void *SuiteSparse_free /* always returns NULL */
(
void *p, /* block to free */
SuiteSparse_config *config /* SuiteSparse-wide configuration */
) ;
void SuiteSparse_tic /* start the timer */
(
double tic [2] /* output, contents undefined on input */
) ;
double SuiteSparse_toc /* return time in seconds since last tic */
(
double tic [2] /* input: from last call to SuiteSparse_tic */
) ;
double SuiteSparse_time /* returns current wall clock time in seconds */
(
void
) ;
/* determine which timer to use, if any */
#ifndef NTIMER
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 199309L
#define SUITESPARSE_TIMER_ENABLED
#endif
#endif
#endif
/* ========================================================================== */
/* === SuiteSparse version ================================================== */
/* ========================================================================== */
/* SuiteSparse is not a package itself, but a collection of packages, some of
* which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD,
* COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the
* collection itself. The versions of packages within each version of
* SuiteSparse are meant to work together. Combining one packge from one
* version of SuiteSparse, with another package from another version of
* SuiteSparse, may or may not work.
*
* SuiteSparse contains the following packages:
*
* SuiteSparse_config version 4.0.0 (version always the same as SuiteSparse)
* AMD version 2.3.0
* BTF version 1.2.0
* CAMD version 2.3.0
* CCOLAMD version 2.8.0
* CHOLMOD version 2.0.0
* COLAMD version 2.8.0
* CSparse version 3.1.0
* CXSparse version 3.1.0
* KLU version 1.2.0
* LDL version 2.1.0
* RBio version 2.1.0
* SPQR version 1.3.0 (full name is SuiteSparseQR)
* UMFPACK version 5.6.0
* MATLAB_Tools various packages & M-files
*
* Other package dependencies:
* BLAS required by CHOLMOD and UMFPACK
* LAPACK required by CHOLMOD
* METIS 4.0.1 required by CHOLMOD (optional) and KLU (optional)
*/
#define SUITESPARSE_DATE "Jun 1, 2012"
#define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub))
#define SUITESPARSE_MAIN_VERSION 4
#define SUITESPARSE_SUB_VERSION 0
#define SUITESPARSE_SUBSUB_VERSION 0
#define SUITESPARSE_VERSION \
SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION)
#ifdef __cplusplus
}
#endif
#endif
| eokeeffe/SSBA | SuiteSparse_config/SuiteSparse_config.h | C | lgpl-3.0 | 6,488 |
<?php if (!defined('TL_ROOT')) die('You can not access this file directly!');
/**
* Contao Open Source CMS
* Copyright (C) 2005-2012 Leo Feyer
*
* Formerly known as TYPOlight Open Source CMS.
*
* This program is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program. If not, please visit the Free
* Software Foundation website at <http://www.gnu.org/licenses/>.
*
* PHP version 5
* @copyright Roger Pau 2009
* @copyright Patricio F. Hamann 2010
* @copyright Juan José Olivera 2010
* @copyright Klaus Bogotz 2010
* @copyright Rogelio Jacinto 2011
* @copyright Jasmin S. 2012
* @author Patricio F. Hamann <[email protected]>
* @author Juan José Olivera <[email protected]>
* @author Klaus Bogotz 2010 <[email protected]>
* @author Rogelio Jacinto <[email protected]>
* @author Jasmin S. <[email protected]>
* @package Spanish
* @license LGPL
* @filesource
*/
$GLOBALS['TL_LANG']['tl_newsletter_channel']['title'] = array('Título', 'Por favor introduce el título del canal');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['jumpTo'] = array('Saltar a página', 'Por favor seleccion la página a la que los visitantes serán redirigidos cuando seleccionen una newsletter.');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['useSMTP'] = array('Servidor SMTP personalizado', 'Utilizar un servidor SMTP específico para enviar boletines.');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['smtpHost'] = array('Nombre de servidor SMTP', 'Indique el nombre del servidor SMTP.');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['smtpUser'] = array('Nombre de usuario SMTP', 'Permite indicar el nombre de usuario para identificarse con el servidor SMTP.');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['smtpPass'] = array('Contraseña SMTP', 'Permite indicar la contraseña para identificarse con el servidor SMTP.');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['smtpEnc'] = array('Cifrado SMTP', 'Aqui puedes seleccionar un método de cifrado (SSL o TLS).');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['smtpPort'] = array('Número de puerto SMTP', 'Indique el número de puerto del servidor SMTP.');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['tstamp'] = array('Fecha de revisión', 'Fecha y hora de la última revisión');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['title_legend'] = 'Título y redirección';
$GLOBALS['TL_LANG']['tl_newsletter_channel']['smtp_legend'] = 'Configuación SMTP';
$GLOBALS['TL_LANG']['tl_newsletter_channel']['new'] = array('Nuevo canal', 'Crear un canal nuevo');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['show'] = array('Detalles de canal', 'Mostrar los detalles del canal con ID %s');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['edit'] = array('Editar canal', 'Editar canal con ID %s');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['editheader'] = array('Editar ajustes de canal', 'Editar los ajsutes del canal con ID %s');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['copy'] = array('Copiar canal', 'Copiar canal con ID %s');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['delete'] = array('Eliminar canal', 'Eliminar cana con ID %s');
$GLOBALS['TL_LANG']['tl_newsletter_channel']['recipients'] = array('Editar receptores', 'Editar los receptores del canal con ID %s');
?> | kikmedia/contao-spanish | system/modules/newsletter/languages/es/tl_newsletter_channel.php | PHP | lgpl-3.0 | 3,823 |
/*---
iGeo - http://igeo.jp
Copyright (c) 2002-2013 Satoru Sugihara
This file is part of iGeo.
iGeo 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, version 3.
iGeo 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 iGeo. If not, see <http://www.gnu.org/licenses/>.
---*/
package igeo;
import java.awt.*;
import igeo.gui.*;
/**
Class of point object.
@author Satoru Sugihara
*/
public class IPoint extends IGeometry implements IVecI{
//public IVecI pos;
public IVec pos;
public IPoint(){ pos = new IVec(); initPoint(null); }
public IPoint(IVec v){ pos = v; initPoint(null); }
public IPoint(IVecI v){ pos = v.get(); initPoint(null); }
public IPoint(double x, double y, double z){ pos = new IVec(x,y,z); initPoint(null); }
public IPoint(double x, double y){ pos = new IVec(x,y); initPoint(null); }
public IPoint(IServerI s){ super(s); pos = new IVec(0,0,0); initPoint(s); }
public IPoint(IServerI s, IVec v){ super(s); pos = v; initPoint(s); }
public IPoint(IServerI s, IVecI v){ super(s); pos = v.get(); initPoint(s); }
public IPoint(IServerI s, double x, double y, double z){
super(s); pos = new IVec(x,y,z); initPoint(s);
}
public IPoint(IServerI s, double x, double y){
super(s); pos = new IVec(x,y); initPoint(s);
}
public IPoint(IPoint p){
super(p);
pos = p.pos.dup();
initPoint(p.server);
//setColor(p.getColor());
}
public IPoint(IServerI s, IPoint p){
super(s,p);
pos = p.pos.dup();
initPoint(s);
//setColor(p.getColor());
}
public /*protected*/ void initPoint(IServerI s){
if(pos==null){
IOut.err("null value is set in IPoint"); //
return;
}
// // costly to use instanceof?
//if(pos instanceof IVec) parameter = (IVec)pos;
//else if(pos instanceof IVecR) parameter = (IVecR)pos;
//else if(pos instanceof IVec4) parameter = (IVec4)pos;
//else if(pos instanceof IVec4R) parameter = (IVec4R)pos;
//addGraphic(new IPointGraphic(this));
if(graphics==null) initGraphic(s); // not init when using copy constructor
}
public IGraphicObject createGraphic(IGraphicMode m){
if(m.isNone()) return null;
return new IPointGraphic(this);
}
synchronized public double x(){ return pos.x(); }
synchronized public double y(){ return pos.y(); }
synchronized public double z(){ return pos.z(); }
synchronized public IPoint x(double vx){ pos.x(vx); return this; }
synchronized public IPoint y(double vy){ pos.y(vy); return this; }
synchronized public IPoint z(double vz){ pos.z(vz); return this; }
synchronized public IPoint x(IDoubleI vx){ pos.x(vx); return this; }
synchronized public IPoint y(IDoubleI vy){ pos.y(vy); return this; }
synchronized public IPoint z(IDoubleI vz){ pos.z(vz); return this; }
synchronized public IPoint x(IVecI vx){ pos.x(vx); return this; }
synchronized public IPoint y(IVecI vy){ pos.y(vy); return this; }
synchronized public IPoint z(IVecI vz){ pos.z(vz); return this; }
synchronized public IPoint x(IVec2I vx){ pos.x(vx); return this; }
synchronized public IPoint y(IVec2I vy){ pos.y(vy); return this; }
synchronized public double x(ISwitchE e){ return pos.x(e); }
synchronized public double y(ISwitchE e){ return pos.y(e); }
synchronized public double z(ISwitchE e){ return pos.z(e); }
synchronized public IDouble x(ISwitchR r){ return pos.x(r); }
synchronized public IDouble y(ISwitchR r){ return pos.y(r); }
synchronized public IDouble z(ISwitchR r){ return pos.z(r); }
//synchronized public IVec get(){ return pos.get(); } // when pos is IVecI
synchronized public IVec get(){ return pos; }
/** passing position field */
synchronized public IVec pos(){ return pos; }
/** center is same with position */
synchronized public IVec center(){ return pos(); }
synchronized public IPoint dup(){ return new IPoint(this); }
synchronized public IVec2 to2d(){ return pos.to2d(); }
synchronized public IVec2 to2d(IVecI projectionDir){ return pos.to2d(projectionDir); }
synchronized public IVec2 to2d(IVecI xaxis, IVecI yaxis){ return pos.to2d(xaxis,yaxis); }
synchronized public IVec2 to2d(IVecI xaxis, IVecI yaxis, IVecI origin){ return pos.to2d(xaxis,yaxis,origin); }
synchronized public IVec4 to4d(){ return pos.to4d(); }
synchronized public IVec4 to4d(double w){ return pos.to4d(w); }
synchronized public IVec4 to4d(IDoubleI w){ return pos.to4d(w); }
synchronized public IDouble getX(){ return pos.getX(); }
synchronized public IDouble getY(){ return pos.getY(); }
synchronized public IDouble getZ(){ return pos.getZ(); }
synchronized public IPoint set(IVecI v){ pos.set(v); return this; }
synchronized public IPoint set(double x, double y, double z){ pos.set(x,y,z); return this;}
synchronized public IPoint set(IDoubleI x, IDoubleI y, IDoubleI z){ pos.set(x,y,z); return this; }
synchronized public IPoint add(double x, double y, double z){ pos.add(x,y,z); return this; }
synchronized public IPoint add(IDoubleI x, IDoubleI y, IDoubleI z){ pos.add(x,y,z); return this; }
synchronized public IPoint add(IVecI v){ pos.add(v); return this; }
synchronized public IPoint sub(double x, double y, double z){ pos.sub(x,y,z); return this; }
synchronized public IPoint sub(IDoubleI x, IDoubleI y, IDoubleI z){ pos.sub(x,y,z); return this; }
synchronized public IPoint sub(IVecI v){ pos.sub(v); return this; }
synchronized public IPoint mul(IDoubleI v){ pos.mul(v); return this; }
synchronized public IPoint mul(double v){ pos.mul(v); return this; }
synchronized public IPoint div(IDoubleI v){ pos.div(v); return this; }
synchronized public IPoint div(double v){ pos.div(v); return this; }
synchronized public IPoint neg(){ pos.neg(); return this; }
synchronized public IPoint rev(){ return neg(); }
synchronized public IPoint flip(){ return neg(); }
synchronized public IPoint zero(){ pos.zero(); return this; }
/** scale add */
synchronized public IPoint add(IVecI v, double f){ pos.add(v,f); return this; }
synchronized public IPoint add(IVecI v, IDoubleI f){ pos.add(v,f); return this; }
/** scale add alias */
synchronized public IPoint add(double f, IVecI v){ return add(v,f); }
synchronized public IPoint add(IDoubleI f, IVecI v){ return add(v,f); }
synchronized public double dot(IVecI v){ return pos.dot(v); }
synchronized public double dot(double vx, double vy, double vz){ return pos.dot(vx,vy,vz); }
synchronized public double dot(ISwitchE e, IVecI v){ return pos.dot(e,v); }
synchronized public IDouble dot(ISwitchR r, IVecI v){ return pos.dot(r,v); }
// creating IPoint is too much (in terms of memory occupancy)
//synchronized public IPoint cross(IVecI v){ return dup().set(pos.cross(v)); }
synchronized public IVec cross(IVecI v){ return pos.cross(v); }
synchronized public IVec cross(double vx, double vy, double vz){ return pos.cross(vx,vy,vz); }
synchronized public double len(){ return pos.len(); }
synchronized public double len(ISwitchE e){ return pos.len(e); }
synchronized public IDouble len(ISwitchR r){ return pos.len(r); }
synchronized public double len2(){ return pos.len2(); }
synchronized public double len2(ISwitchE e){ return pos.len2(e); }
synchronized public IDouble len2(ISwitchR r){ return pos.len2(r); }
synchronized public IPoint len(IDoubleI l){ pos.len(l); return this; }
synchronized public IPoint len(double l){ pos.len(l); return this; }
synchronized public IPoint unit(){ pos.unit(); return this; }
synchronized public double dist(IVecI v){ return pos.dist(v); }
synchronized public double dist(double vx, double vy, double vz){ return pos.dist(vx,vy,vz); }
synchronized public double dist(ISwitchE e, IVecI v){ return pos.dist(e,v); }
synchronized public IDouble dist(ISwitchR r, IVecI v){ return pos.dist(r,v); }
synchronized public double dist2(IVecI v){ return pos.dist2(v); }
synchronized public double dist2(double vx, double vy, double vz){ return pos.dist2(vx,vy,vz); }
synchronized public double dist2(ISwitchE e, IVecI v){ return pos.dist2(e,v); }
synchronized public IDouble dist2(ISwitchR r, IVecI v){ return pos.dist2(r,v); }
synchronized public boolean eq(IVecI v){ return pos.eq(v); }
synchronized public boolean eq(double vx, double vy, double vz){ return pos.eq(vx,vy,vz); }
synchronized public boolean eq(ISwitchE e, IVecI v){ return pos.eq(e,v); }
synchronized public IBool eq(ISwitchR r, IVecI v){ return pos.eq(r,v); }
synchronized public boolean eq(IVecI v, double tolerance){ return pos.eq(v,tolerance); }
synchronized public boolean eq(double vx, double vy, double vz, double tolerance){ return pos.eq(vx,vy,vz,tolerance); }
synchronized public boolean eq(ISwitchE e, IVecI v, double tolerance){ return pos.eq(e,v,tolerance); }
synchronized public IBool eq(ISwitchR r, IVecI v, IDoubleI tolerance){ return pos.eq(r,v,tolerance); }
synchronized public boolean eqX(IVecI v){ return pos.eqX(v); }
synchronized public boolean eqY(IVecI v){ return pos.eqY(v); }
synchronized public boolean eqZ(IVecI v){ return pos.eqZ(v); }
synchronized public boolean eqX(double vx){ return pos.eqX(vx); }
synchronized public boolean eqY(double vy){ return pos.eqY(vy); }
synchronized public boolean eqZ(double vz){ return pos.eqZ(vz); }
synchronized public boolean eqX(ISwitchE e, IVecI v){ return pos.eqX(e,v); }
synchronized public boolean eqY(ISwitchE e, IVecI v){ return pos.eqY(e,v); }
synchronized public boolean eqZ(ISwitchE e, IVecI v){ return pos.eqZ(e,v); }
synchronized public IBool eqX(ISwitchR r, IVecI v){ return pos.eqX(r,v); }
synchronized public IBool eqY(ISwitchR r, IVecI v){ return pos.eqY(r,v); }
synchronized public IBool eqZ(ISwitchR r, IVecI v){ return pos.eqZ(r,v); }
synchronized public boolean eqX(IVecI v, double tolerance){ return pos.eqX(v,tolerance); }
synchronized public boolean eqY(IVecI v, double tolerance){ return pos.eqY(v,tolerance); }
synchronized public boolean eqZ(IVecI v, double tolerance){ return pos.eqZ(v,tolerance); }
synchronized public boolean eqX(double vx, double tolerance){ return pos.eqX(vx,tolerance); }
synchronized public boolean eqY(double vy, double tolerance){ return pos.eqY(vy,tolerance); }
synchronized public boolean eqZ(double vz, double tolerance){ return pos.eqZ(vz,tolerance); }
synchronized public boolean eqX(ISwitchE e, IVecI v, double tolerance){ return pos.eqX(e,v,tolerance); }
synchronized public boolean eqY(ISwitchE e, IVecI v, double tolerance){ return pos.eqY(e,v,tolerance); }
synchronized public boolean eqZ(ISwitchE e, IVecI v, double tolerance){ return pos.eqZ(e,v,tolerance); }
synchronized public IBool eqX(ISwitchR r, IVecI v, IDoubleI tolerance){ return pos.eqX(r,v,tolerance); }
synchronized public IBool eqY(ISwitchR r, IVecI v, IDoubleI tolerance){ return pos.eqY(r,v,tolerance); }
synchronized public IBool eqZ(ISwitchR r, IVecI v, IDoubleI tolerance){ return pos.eqZ(r,v,tolerance); }
synchronized public double angle(IVecI v){ return pos.angle(v); }
synchronized public double angle(double vx, double vy, double vz){ return pos.angle(vx,vy,vz); }
synchronized public double angle(ISwitchE e, IVecI v){ return pos.angle(e,v); }
synchronized public IDouble angle(ISwitchR r, IVecI v){ return pos.angle(r,v); }
synchronized public double angle(IVecI v, IVecI axis){ return pos.angle(v,axis); }
synchronized public double angle(double vx, double vy, double vz, double axisX, double axisY, double axisZ){
return pos.angle(vx,vy,vz,axisX,axisY,axisZ);
}
synchronized public double angle(ISwitchE e, IVecI v, IVecI axis){ return pos.angle(e,v,axis); }
synchronized public IDouble angle(ISwitchR r, IVecI v, IVecI axis){ return pos.angle(r,v,axis); }
synchronized public IPoint rot(IDoubleI angle){ pos.rot(angle); return this; }
synchronized public IPoint rot(double angle){ pos.rot(angle); return this; }
synchronized public IPoint rot(IVecI axis, IDoubleI angle){ pos.rot(axis,angle); return this; }
synchronized public IPoint rot(IVecI axis, double angle){ pos.rot(axis,angle); return this; }
synchronized public IPoint rot(double axisX, double axisY, double axisZ, double angle){
pos.rot(axisX,axisY,axisZ,angle); return this;
}
synchronized public IPoint rot(IVecI center, IVecI axis, double angle){
pos.rot(center, axis,angle); return this;
}
synchronized public IPoint rot(double centerX, double centerY, double centerZ,
double axisX, double axisY, double axisZ, double angle){
pos.rot(centerX, centerY, centerZ, axisX, axisY, axisZ, angle); return this;
}
synchronized public IPoint rot(IVecI center, IVecI axis, IDoubleI angle){
pos.rot(center, axis,angle); return this;
}
/** Rotate to destination direction vector. */
synchronized public IPoint rot(IVecI axis, IVecI destDir){ pos.rot(axis,destDir); return this; }
/** Rotate to destination point location. */
synchronized public IPoint rot(IVecI center, IVecI axis, IVecI destPt){
pos.rot(center,axis,destPt); return this;
}
synchronized public IPoint rot2(IDoubleI angle){ pos.rot2(angle); return this; }
synchronized public IPoint rot2(double angle){ pos.rot2(angle); return this; }
synchronized public IPoint rot2(IVecI center, double angle){ pos.rot2(center, angle); return this; }
synchronized public IPoint rot2(double centerX, double centerY, double angle){
pos.rot2(centerX, centerY, angle); return this;
}
synchronized public IPoint rot2(IVecI center, IDoubleI angle){ pos.rot2(center, angle); return this; }
/** Rotate to destination direction vector. */
synchronized public IPoint rot2(IVecI destDir){ pos.rot2(destDir); return this; }
/** Rotate to destination point location. */
synchronized public IPoint rot2(IVecI center, IVecI destPt){ pos.rot2(center,destPt); return this; }
/** alias of mul */
synchronized public IPoint scale(IDoubleI f){ pos.scale(f); return this; }
/** alias of mul */
synchronized public IPoint scale(double f){ pos.scale(f); return this; }
synchronized public IPoint scale(IVecI center, IDoubleI f){ pos.scale(center,f); return this; }
synchronized public IPoint scale(IVecI center, double f){ pos.scale(center,f); return this; }
synchronized public IPoint scale(double centerX, double centerY, double centerZ, double f){
pos.scale(centerX, centerY, centerZ, f); return this;
}
/** scale only in 1 direction */
synchronized public IPoint scale1d(IVecI axis, double f){ pos.scale1d(axis,f); return this; }
synchronized public IPoint scale1d(double axisX, double axisY, double axisZ, double f){
pos.scale1d(axisX,axisY,axisZ,f); return this;
}
synchronized public IPoint scale1d(IVecI axis, IDoubleI f){ pos.scale1d(axis,f); return this; }
synchronized public IPoint scale1d(IVecI center, IVecI axis, double f){
pos.scale1d(center,axis,f); return this;
}
synchronized public IPoint scale1d(double centerX, double centerY, double centerZ,
double axisX, double axisY, double axisZ, double f){
pos.scale1d(centerX,centerY,centerZ,axisX,axisY,axisZ,f); return this;
}
synchronized public IPoint scale1d(IVecI center, IVecI axis, IDoubleI f){
pos.scale1d(center,axis,f); return this;
}
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint ref(IVecI planeDir){ pos.ref(planeDir); return this; }
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint ref(double planeX, double planeY, double planeZ){
pos.ref(planeX,planeY,planeZ); return this;
}
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint ref(IVecI center, IVecI planeDir){
pos.ref(center,planeDir); return this;
}
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint ref(double centerX, double centerY, double centerZ,
double planeX, double planeY, double planeZ){
pos.ref(centerX,centerY,centerZ,planeX,planeY,planeZ); return this;
}
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint mirror(IVecI planeDir){ pos.ref(planeDir); return this; }
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint mirror(double planeX, double planeY, double planeZ){
pos.ref(planeX,planeY,planeZ); return this;
}
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint mirror(IVecI center, IVecI planeDir){
pos.ref(center,planeDir); return this;
}
/** reflect (mirror) 3 dimensionally to the other side of the plane */
synchronized public IPoint mirror(double centerX, double centerY, double centerZ,
double planeX, double planeY, double planeZ){
pos.ref(centerX,centerY,centerZ,planeX,planeY,planeZ); return this;
}
/** shear operation */
synchronized public IPoint shear(double sxy, double syx, double syz,
double szy, double szx, double sxz){
pos.shear(sxy,syx,syz,szy,szx,sxz); return this;
}
synchronized public IPoint shear(IDoubleI sxy, IDoubleI syx, IDoubleI syz,
IDoubleI szy, IDoubleI szx, IDoubleI sxz){
pos.shear(sxy,syx,syz,szy,szx,sxz); return this;
}
synchronized public IPoint shear(IVecI center, double sxy, double syx, double syz,
double szy, double szx, double sxz){
pos.shear(center,sxy,syx,syz,szy,szx,sxz); return this;
}
synchronized public IPoint shear(IVecI center, IDoubleI sxy, IDoubleI syx, IDoubleI syz,
IDoubleI szy, IDoubleI szx, IDoubleI sxz){
pos.shear(center,sxy,syx,syz,szy,szx,sxz); return this;
}
synchronized public IPoint shearXY(double sxy, double syx){ pos.shearXY(sxy,syx); return this; }
synchronized public IPoint shearXY(IDoubleI sxy, IDoubleI syx){ pos.shearXY(sxy,syx); return this; }
synchronized public IPoint shearXY(IVecI center, double sxy, double syx){
pos.shearXY(center,sxy,syx); return this;
}
synchronized public IPoint shearXY(IVecI center, IDoubleI sxy, IDoubleI syx){
pos.shearXY(center,sxy,syx); return this;
}
synchronized public IPoint shearYZ(double syz, double szy){ pos.shearYZ(syz,szy); return this; }
synchronized public IPoint shearYZ(IDoubleI syz, IDoubleI szy){ pos.shearYZ(syz,szy); return this; }
synchronized public IPoint shearYZ(IVecI center, double syz, double szy){
pos.shearYZ(center,syz,szy); return this;
}
synchronized public IPoint shearYZ(IVecI center, IDoubleI syz, IDoubleI szy){
pos.shearYZ(center,syz,szy); return this;
}
synchronized public IPoint shearZX(double szx, double sxz){ pos.shearZX(szx,sxz); return this; }
synchronized public IPoint shearZX(IDoubleI szx, IDoubleI sxz){ pos.shearZX(szx,sxz); return this; }
synchronized public IPoint shearZX(IVecI center, double szx, double sxz){
pos.shearZX(center,szx,sxz); return this;
}
synchronized public IPoint shearZX(IVecI center, IDoubleI szx, IDoubleI sxz){
pos.shearZX(center,szx,sxz); return this;
}
/** translate is alias of add() */
synchronized public IPoint translate(double x, double y, double z){ pos.translate(x,y,z); return this; }
synchronized public IPoint translate(IDoubleI x, IDoubleI y, IDoubleI z){ pos.translate(x,y,z); return this; }
synchronized public IPoint translate(IVecI v){ pos.translate(v); return this; }
synchronized public IPoint transform(IMatrix3I mat){ pos.transform(mat); return this; }
synchronized public IPoint transform(IMatrix4I mat){ pos.transform(mat); return this; }
synchronized public IPoint transform(IVecI xvec, IVecI yvec, IVecI zvec){
pos.transform(xvec,yvec,zvec); return this;
}
synchronized public IPoint transform(IVecI xvec, IVecI yvec, IVecI zvec, IVecI translate){
pos.transform(xvec,yvec,zvec,translate); return this;
}
/** mv() is alias of add() */
synchronized public IPoint mv(double x, double y, double z){ return add(x,y,z); }
synchronized public IPoint mv(IDoubleI x, IDoubleI y, IDoubleI z){ return add(x,y,z); }
synchronized public IPoint mv(IVecI v){ return add(v); }
// method name cp() is used as getting control point method in curve and surface but here used also as copy because of the priority of variable fitting of diversed users' mind set over the clarity of the code organization
/** cp() is alias of dup() */
synchronized public IPoint cp(){ return dup(); }
/** cp() is alias of dup().add() */
synchronized public IPoint cp(double x, double y, double z){ return dup().add(x,y,z); }
synchronized public IPoint cp(IDoubleI x, IDoubleI y, IDoubleI z){ return dup().add(x,y,z); }
synchronized public IPoint cp(IVecI v){ return dup().add(v); }
// methods creating new instance // returns IPoint?, not IVec?
// returns IVec, not IPoint (2011/10/12)
//synchronized public IPoint diff(IVecI v){ return dup().sub(v); }
synchronized public IVec dif(IVecI v){ return pos.dif(v); }
synchronized public IVec dif(double vx, double vy, double vz){ return pos.dif(vx,vy,vz); }
synchronized public IVec diff(IVecI v){ return dif(v); }
synchronized public IVec diff(double vx, double vy, double vz){ return dif(vx,vy,vz); }
//synchronized public IPoint mid(IVecI v){ return dup().add(v).div(2); }
synchronized public IVec mid(IVecI v){ return pos.mid(v); }
synchronized public IVec mid(double vx, double vy, double vz){ return pos.mid(vx,vy,vz); }
//synchronized public IPoint sum(IVecI v){ return dup().add(v); }
synchronized public IVec sum(IVecI v){ return pos.sum(v); }
synchronized public IVec sum(double vx, double vy, double vz){ return pos.sum(vx,vy,vz); }
//synchronized public IPoint sum(IVecI... v){ IPoint ret = this.dup(); for(IVecI vi: v) ret.add(vi); return ret; }
synchronized public IVec sum(IVecI... v){ return pos.sum(v); }
//synchronized public IPoint bisect(IVecI v){ return dup().unit().add(v.dup().unit()); }
synchronized public IVec bisect(IVecI v){ return pos.bisect(v); }
synchronized public IVec bisect(double vx, double vy, double vz){ return pos.bisect(vx,vy,vz); }
/**
weighted sum.
@return IVec
*/
//synchronized public IPoint sum(IVecI v2, double w1, double w2){ return dup().mul(w1).add(v2,w2); }
synchronized public IVec sum(IVecI v2, double w1, double w2){ return pos.sum(v2,w1,w2); }
//synchronized public IPoint sum(IVecI v2, double w2){ return dup().mul(1.0-w2).add(v2,w2); }
synchronized public IVec sum(IVecI v2, double w2){ return pos.sum(v2,w2); }
//synchronized public IPoint sum(IVecI v2, IDoubleI w1, IDoubleI w2){ return dup().mul(w1).add(v2,w2); }
synchronized public IVec sum(IVecI v2, IDoubleI w1, IDoubleI w2){ return sum(v2,w1,w2); }
//synchronized public IPoint sum(IVecI v2, IDoubleI w2){ return dup().mul(new IDouble(1.0).sub(w2)).add(v2,w2); }
synchronized public IVec sum(IVecI v2, IDoubleI w2){ return sum(v2,w2); }
/** alias of cross. (not unitized ... ?) */
//synchronized public IPoint nml(IVecI v){ return cross(v); }
synchronized public IVec nml(IVecI v){ return pos.nml(v); }
synchronized public IVec nml(double vx, double vy, double vz){ return pos.nml(vx,vy,vz); }
/** create normal vector from 3 points of self, pt1 and pt2 */
//synchronized public IPoint nml(IVecI pt1, IVecI pt2){ return this.diff(pt1).cross(this.diff(pt2)).unit(); }
synchronized public IVec nml(IVecI pt1, IVecI pt2){ return pos.nml(pt1,pt2); }
synchronized public IVec nml(double vx1, double vy1, double vz1, double vx2, double vy2, double vz2){
return pos.nml(vx1,vy1,vz1,vx2,vy2,vz2);
}
/** checking x, y, and z is valid number (not Infinite, nor NaN). */
synchronized public boolean isValid(){ if(pos==null){ return false; } return pos.isValid(); }
synchronized public String toString(){
if(pos==null) return super.toString();
return pos.toString();
}
/** default setting in each object class; to be overridden in a child class */
public IAttribute defaultAttribute(){
IAttribute a = new IAttribute();
a.weight = IConfig.pointSize;
return a;
}
/** set size of dot in graphic ; it's just alias of weight() */
synchronized public IPoint setSize(double sz){ return weight(sz); }
synchronized public IPoint size(double sz){ return weight(sz); }
/*
synchronized public IPoint setSize(double sz){ return size(sz); }
synchronized public IPoint size(double sz){
for(int i=0; graphics!=null && i<graphics.size(); i++)
if(graphics.get(i) instanceof IPointGraphic)
((IPointGraphic)graphics.get(i)).size(sz);
return this;
}
*/
synchronized public double getSize(){ return size(); }
public double size(){
if(graphics==null){
IOut.err("no graphics is set"); //
return -1;
}
for(int i=0; graphics!=null && i<graphics.size(); i++)
if(graphics.get(i) instanceof IPointGraphic)
return ((IPointGraphic)graphics.get(i)).size();
return -1;
}
synchronized public IPoint name(String nm){ super.name(nm); return this; }
synchronized public IPoint layer(ILayer l){ super.layer(l); return this; }
synchronized public IPoint layer(String l){ super.layer(l); return this; }
synchronized public IPoint attr(IAttribute at){ super.attr(at); return this; }
synchronized public IPoint hide(){ super.hide(); return this; }
synchronized public IPoint show(){ super.show(); return this; }
synchronized public IPoint clr(IColor c){ super.clr(c); return this; }
synchronized public IPoint clr(IColor c, int alpha){ super.clr(c,alpha); return this; }
synchronized public IPoint clr(IColor c, float alpha){ super.clr(c,alpha); return this; }
synchronized public IPoint clr(IColor c, double alpha){ super.clr(c,alpha); return this; }
synchronized public IPoint clr(IObject o){ super.clr(o); return this; }
synchronized public IPoint clr(Color c){ super.clr(c); return this; }
synchronized public IPoint clr(Color c, int alpha){ super.clr(c,alpha); return this; }
synchronized public IPoint clr(Color c, float alpha){ super.clr(c,alpha); return this; }
synchronized public IPoint clr(Color c, double alpha){ super.clr(c,alpha); return this; }
synchronized public IPoint clr(int gray){ super.clr(gray); return this; }
synchronized public IPoint clr(float fgray){ super.clr(fgray); return this; }
synchronized public IPoint clr(double dgray){ super.clr(dgray); return this; }
synchronized public IPoint clr(int gray, int alpha){ super.clr(gray,alpha); return this; }
synchronized public IPoint clr(float fgray, float falpha){ super.clr(fgray,falpha); return this; }
synchronized public IPoint clr(double dgray, double dalpha){ super.clr(dgray,dalpha); return this; }
synchronized public IPoint clr(int r, int g, int b){ super.clr(r,g,b); return this; }
synchronized public IPoint clr(float fr, float fg, float fb){ super.clr(fr,fg,fb); return this; }
synchronized public IPoint clr(double dr, double dg, double db){ super.clr(dr,dg,db); return this; }
synchronized public IPoint clr(int r, int g, int b, int a){ super.clr(r,g,b,a); return this; }
synchronized public IPoint clr(float fr, float fg, float fb, float fa){ super.clr(fr,fg,fb,fa); return this; }
synchronized public IPoint clr(double dr, double dg, double db, double da){ super.clr(dr,dg,db,da); return this; }
synchronized public IPoint hsb(float h, float s, float b, float a){ super.hsb(h,s,b,a); return this; }
synchronized public IPoint hsb(double h, double s, double b, double a){ super.hsb(h,s,b,a); return this; }
synchronized public IPoint hsb(float h, float s, float b){ super.hsb(h,s,b); return this; }
synchronized public IPoint hsb(double h, double s, double b){ super.hsb(h,s,b); return this; }
synchronized public IPoint setColor(IColor c){ super.setColor(c); return this; }
synchronized public IPoint setColor(IColor c, int alpha){ super.setColor(c,alpha); return this; }
synchronized public IPoint setColor(IColor c, float alpha){ super.setColor(c,alpha); return this; }
synchronized public IPoint setColor(IColor c, double alpha){ super.setColor(c,alpha); return this; }
synchronized public IPoint setColor(Color c){ super.setColor(c); return this; }
synchronized public IPoint setColor(Color c, int alpha){ super.setColor(c,alpha); return this; }
synchronized public IPoint setColor(Color c, float alpha){ super.setColor(c,alpha); return this; }
synchronized public IPoint setColor(Color c, double alpha){ super.setColor(c,alpha); return this; }
synchronized public IPoint setColor(int gray){ super.setColor(gray); return this; }
synchronized public IPoint setColor(float fgray){ super.setColor(fgray); return this; }
synchronized public IPoint setColor(double dgray){ super.setColor(dgray); return this; }
synchronized public IPoint setColor(int gray, int alpha){ super.setColor(gray,alpha); return this; }
synchronized public IPoint setColor(float fgray, float falpha){ super.setColor(fgray,falpha); return this; }
synchronized public IPoint setColor(double dgray, double dalpha){ super.setColor(dgray,dalpha); return this; }
synchronized public IPoint setColor(int r, int g, int b){ super.setColor(r,g,b); return this; }
synchronized public IPoint setColor(float fr, float fg, float fb){ super.setColor(fr,fg,fb); return this; }
synchronized public IPoint setColor(double dr, double dg, double db){ super.setColor(dr,dg,db); return this; }
synchronized public IPoint setColor(int r, int g, int b, int a){ super.setColor(r,g,b,a); return this; }
synchronized public IPoint setColor(float fr, float fg, float fb, float fa){ super.setColor(fr,fg,fb,fa); return this; }
synchronized public IPoint setColor(double dr, double dg, double db, double da){ super.setColor(dr,dg,db,da); return this; }
synchronized public IPoint setHSBColor(float h, float s, float b, float a){ super.setHSBColor(h,s,b,a); return this; }
synchronized public IPoint setHSBColor(double h, double s, double b, double a){ super.setHSBColor(h,s,b,a); return this; }
synchronized public IPoint setHSBColor(float h, float s, float b){ super.setHSBColor(h,s,b); return this; }
synchronized public IPoint setHSBColor(double h, double s, double b){ super.setHSBColor(h,s,b); return this; }
synchronized public IPoint weight(double w){ super.weight(w); return this; }
synchronized public IPoint weight(float w){ super.weight(w); return this; }
}
| sghr/iGeo | IPoint.java | Java | lgpl-3.0 | 31,733 |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QTAWS_CREATERESERVEDINSTANCESLISTINGREQUEST_P_H
#define QTAWS_CREATERESERVEDINSTANCESLISTINGREQUEST_P_H
#include "ec2request_p.h"
#include "createreservedinstanceslistingrequest.h"
namespace QtAws {
namespace EC2 {
class CreateReservedInstancesListingRequest;
class CreateReservedInstancesListingRequestPrivate : public Ec2RequestPrivate {
public:
CreateReservedInstancesListingRequestPrivate(const Ec2Request::Action action,
CreateReservedInstancesListingRequest * const q);
CreateReservedInstancesListingRequestPrivate(const CreateReservedInstancesListingRequestPrivate &other,
CreateReservedInstancesListingRequest * const q);
private:
Q_DECLARE_PUBLIC(CreateReservedInstancesListingRequest)
};
} // namespace EC2
} // namespace QtAws
#endif
| pcolby/libqtaws | src/ec2/createreservedinstanceslistingrequest_p.h | C | lgpl-3.0 | 1,576 |
<?php
/**
* This file is part of contao-community-alliance/dc-general.
*
* (c) 2013-2019 Contao Community Alliance.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* This project is provided in good faith and hope to be usable by anyone.
*
* @package contao-community-alliance/dc-general
* @author Christian Schiffler <[email protected]>
* @author Sven Baumann <[email protected]>
* @copyright 2013-2019 Contao Community Alliance.
* @license https://github.com/contao-community-alliance/dc-general/blob/master/LICENSE LGPL-3.0-or-later
* @filesource
*/
namespace ContaoCommunityAlliance\DcGeneral\Data;
/**
* This class is the base implementation for LanguageInformationCollectionInterface.
*/
class DefaultLanguageInformationCollection implements LanguageInformationCollectionInterface
{
/**
* The language information stored in this collection.
*
* @var LanguageInformationInterface[]
*/
protected $languages = [];
/**
* {@inheritDoc}
*/
public function add(LanguageInformationInterface $language)
{
$this->languages[] = $language;
return $this;
}
/**
* Get a iterator for this collection.
*
* @return \ArrayIterator
*/
public function getIterator()
{
return new \ArrayIterator($this->languages);
}
/**
* Count the contained language information.
*
* @return int
*/
public function count()
{
return \count($this->languages);
}
}
| contao-community-alliance/dc-general | src/Data/DefaultLanguageInformationCollection.php | PHP | lgpl-3.0 | 1,624 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Test 6</title>
<script src="sxz.js"></script>
</head>
<body>
<img src="lena_std.jpg" align="left" alt="original image" />
<canvas id="canvasid" width="512" height="512"></canvas>
<script>
var canvas = document.getElementById('canvasid');
var sxz = new Sxz();
sxz.Load(sxz, "lena_std.sxz", canvas, Render);
function Render(sxz) {
sxz.Render();
}
</script>
</body>
</html>
| DarkLilac/Sxz | Polyfill/lena_demo.html | HTML | lgpl-3.0 | 586 |
/*
* PROJECT: NyARToolkitCS
* --------------------------------------------------------------------------------
*
* The NyARToolkitCS is C# edition NyARToolKit class library.
* Copyright (C)2008-2012 Ryo Iizuka
*
* This work is based on the ARToolKit developed by
* Hirokazu Kato
* Mark Billinghurst
* HITLab, University of Washington, Seattle
* http://www.hitl.washington.edu/artoolkit/
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as publishe
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For further information please contact.
* http://nyatla.jp/nyatoolkit/
* <airmail(at)ebony.plala.or.jp> or <nyatla(at)nyatla.jp>
*
*/
using System;
namespace jp.nyatla.nyartoolkit.cs.core
{
/**
* このクラスは、樽型歪み設定/解除クラスです。
*/
public interface INyARCameraDistortionFactor
{
/**
* この関数は、座標点を理想座標系から観察座標系へ変換します。
* @param i_in
* 変換元の座標
* @param o_out
* 変換後の座標を受け取るオブジェクト
*/
void ideal2Observ(NyARDoublePoint2d i_in, NyARDoublePoint2d o_out);
/**
* この関数は、座標点を理想座標系から観察座標系へ変換します。
* @param i_in
* 変換元の座標
* @param o_out
* 変換後の座標を受け取るオブジェクト
*/
void ideal2Observ(NyARDoublePoint2d i_in, NyARIntPoint2d o_out);
/**
* この関数は、座標点を理想座標系から観察座標系へ変換します。
* @param i_in
* 変換元の座標
* @param o_out
* 変換後の座標を受け取るオブジェクト
*/
void ideal2Observ(double i_x, double i_y, NyARDoublePoint2d o_out);
/**
* この関数は、座標点を理想座標系から観察座標系へ変換します。
* @param i_x
* 変換元の座標
* @param i_y
* 変換元の座標
* @param o_out
* 変換後の座標を受け取るオブジェクト
*/
void ideal2Observ(double i_x, double i_y, NyARIntPoint2d o_out);
/**
* この関数は、複数の座標点を、一括して理想座標系から観察座標系へ変換します。
* i_inとo_outには、同じインスタンスを指定できます。
* @param i_in
* 変換元の座標配列
* @param o_out
* 変換後の座標を受け取る配列
* @param i_size
* 変換する座標の個数。
*/
void ideal2ObservBatch(NyARDoublePoint2d[] i_in, NyARDoublePoint2d[] o_out, int i_size);
/**
* この関数は、複数の座標点を、一括して理想座標系から観察座標系へ変換します。
* i_inとo_outには、同じインスタンスを指定できます。
* @param i_in
* 変換元の座標配列
* @param o_out
* 変換後の座標を受け取る配列
* @param i_size
* 変換する座標の個数。
*/
void ideal2ObservBatch(NyARDoublePoint2d[] i_in, NyARIntPoint2d[] o_out, int i_size);
/**
* この関数は、座標を観察座標系から理想座標系へ変換します。
* @param ix
* 変換元の座標
* @param iy
* 変換元の座標
* @param o_point
* 変換後の座標を受け取るオブジェクト
*/
void observ2Ideal(double ix, double iy, NyARDoublePoint2d o_point);
/**
* {@link #observ2Ideal(double, double, NyARDoublePoint2d)}のラッパーです。
* i_inとo_pointには、同じオブジェクトを指定できます。
* @param i_in
* @param o_point
*/
void observ2Ideal(NyARDoublePoint2d i_in, NyARDoublePoint2d o_point);
/**
* この関数は、観察座標を理想座標へ変換します。
* 入力できる値範囲は、コンストラクタに設定したスクリーンサイズの範囲内です。
* @param ix
* 観察座標の値
* @param iy
* 観察座標の値
* @param o_point
* 理想座標を受け取るオブジェクト。
*/
void observ2Ideal(int ix, int iy, NyARDoublePoint2d o_point);
/**
* 座標配列全てに対して、{@link #observ2Ideal(double, double, NyARDoublePoint2d)}を適応します。
* @param i_in
* @param o_out
* @param i_size
*/
void observ2IdealBatch(NyARDoublePoint2d[] i_in, NyARDoublePoint2d[] o_out, int i_size);
void observ2IdealBatch(NyARIntPoint2d[] i_in, NyARDoublePoint2d[] o_out, int i_size);
}
}
| nyatla/NyARToolkitCS | lib/src/cs/core/param/distfactor/INyARCameraDistortionFactor.cs | C# | lgpl-3.0 | 5,500 |
/* radare - LGPLv3 - Copyright 2014-2015 - pancake, jvoisin, jfrankowski */
#include <dirent.h>
#include <r_core.h>
#include <r_lib.h>
#include <yara.h>
#undef R_API
#define R_API static
#undef R_IPI
#define R_IPI static
// true if the plugin has been initialized.
static int initialized = false;
static bool print_strings = 0;
static unsigned int flagidx = 0;
static bool io_va = true;
#if YR_MAJOR_VERSION < 4
static int callback(int message, void* rule, void* data);
#else
static int callback(YR_SCAN_CONTEXT* context, int message, void* rule, void* data);
#endif
static int r_cmd_yara_add (const RCore* core, const char* input);
static int r_cmd_yara_add_file (const char* rules_path);
static int r_cmd_yara_call(void *user, const char *input);
static int r_cmd_yara_clear();
static int r_cmd_yara_init(void *user, const char *cmd);
static int r_cmd_yara_help(const RCore* core);
static int r_cmd_yara_process(const RCore* core, const char* input);
static int r_cmd_yara_scan(const RCore* core, const char* option);
static int r_cmd_yara_load_default_rules (const RCore* core);
static const char* yara_rule_template = "rule RULE_NAME {\n\tstrings:\n\n\tcondition:\n}";
/* Because of how the rules are compiled, we are not allowed to add more
* rules to a compiler once it has compiled. That's why we keep a list
* of those compiled rules.
*/
static RList* rules_list;
#if YR_MAJOR_VERSION < 4
static int callback (int message, void *msg_data, void *user_data) {
RCore *core = (RCore *) user_data;
RPrint *print = core->print;
unsigned int ruleidx;
st64 offset = 0;
ut64 n = 0;
YR_RULE* rule = msg_data;
if (message == CALLBACK_MSG_RULE_MATCHING)
{
YR_STRING* string;
r_cons_printf("%s\n", rule->identifier);
ruleidx = 0;
yr_rule_strings_foreach(rule, string)
{
YR_MATCH* match;
yr_string_matches_foreach(string, match)
{
n = match->base + match->offset;
// Find virtual address if needed
if (io_va) {
RIOMap *map = r_io_map_get_paddr (core->io, n);
if (map) {
offset = r_io_map_begin (map) - map->delta;
}
}
const char *flag = sdb_fmt ("%s%d_%s_%d", "yara", flagidx, rule->identifier, ruleidx);
if (print_strings) {
r_cons_printf("0x%08" PFMT64x ": %s : ", n + offset, flag);
r_print_bytes(print, match->data, match->data_length, "%02x");
}
r_flag_set (core->flags, flag, n + offset, match->data_length);
ruleidx++;
}
}
flagidx++;
}
return CALLBACK_CONTINUE;
}
static void compiler_callback(int error_level, const char* file_name,
int line_number, const char* message, void* user_data) {
eprintf ("file: %s line_number: %d.\n%s", file_name, line_number, message);
return;
}
#else
static int callback (YR_SCAN_CONTEXT* context, int message, void *msg_data, void *user_data) {
RCore *core = (RCore *) user_data;
RPrint *print = core->print;
unsigned int ruleidx;
st64 offset = 0;
ut64 n = 0;
YR_RULE* rule = msg_data;
if (message == CALLBACK_MSG_RULE_MATCHING)
{
YR_STRING* string;
r_cons_printf("%s\n", rule->identifier);
ruleidx = 0;
yr_rule_strings_foreach(rule, string)
{
YR_MATCH* match;
yr_string_matches_foreach(context, string, match)
{
n = match->base + match->offset;
// Find virtual address if needed
if (io_va) {
RIOMap *map = r_io_map_get_paddr (core->io, n);
if (map) {
offset = r_io_map_begin (map) - map->delta;
}
}
const char *flag = sdb_fmt ("%s%d_%s_%d", "yara", flagidx, rule->identifier, ruleidx);
if (print_strings) {
r_cons_printf("0x%08" PFMT64x ": %s : ", n + offset, flag);
r_print_bytes(print, match->data, match->data_length, "%02x");
}
r_flag_set (core->flags, flag, n + offset, match->data_length);
ruleidx++;
}
}
flagidx++;
}
return CALLBACK_CONTINUE;
}
static void compiler_callback(int error_level, const char* file_name,
int line_number, const struct YR_RULE *rule, const char* message, void* user_data) {
eprintf ("file: %s line_number: %d.\n%s", file_name, line_number, message);
return;
}
#endif
static int r_cmd_yara_scan(const RCore* core, const char* option) {
RListIter* rules_it;
YR_RULES* rules;
void* to_scan;
int result;
r_flag_space_push (core->flags, "yara");
const unsigned int to_scan_size = r_io_size (core->io);
io_va = r_config_get_b (core->config, "io.va");
if (to_scan_size < 1) {
eprintf ("Invalid file size\n");
return false;
}
if( *option == '\0') {
print_strings = 0;
}
else if (*option == 'S') {
print_strings = 1;
}
else {
print_strings = 0;
eprintf ("Invalid option\n");
return false;
}
to_scan = malloc (to_scan_size);
if (!to_scan) {
eprintf ("Something went wrong during memory allocation\n");
return false;
}
result = r_io_pread_at (core->io, 0L, to_scan, to_scan_size);
if (!result) {
eprintf ("Something went wrong during r_io_read_at\n");
free (to_scan);
return false;
}
r_list_foreach (rules_list, rules_it, rules) {
yr_rules_scan_mem (rules, to_scan, to_scan_size, 0, callback, (void *)core, 0);
}
free (to_scan);
return true;
}
static int r_cmd_yara_show(const char * name) {
/* List loaded rules containing name */
RListIter* rules_it;
YR_RULES* rules;
YR_RULE* rule;
r_list_foreach (rules_list, rules_it, rules) {
yr_rules_foreach (rules, rule) {
if (r_str_casestr (rule->identifier, name)) {
r_cons_printf ("%s\n", rule->identifier);
}
}
}
return true;
}
static int r_cmd_yara_tags() {
/* List tags from all the different loaded rules */
RListIter* rules_it;
RListIter *tags_it;
YR_RULES* rules;
YR_RULE* rule;
const char* tag_name;
RList *tag_list = r_list_new();
tag_list->free = free;
r_list_foreach (rules_list, rules_it, rules) {
yr_rules_foreach(rules, rule) {
yr_rule_tags_foreach(rule, tag_name) {
if (! r_list_find (tag_list, tag_name, (RListComparator)strcmp)) {
r_list_add_sorted (tag_list,
strdup (tag_name), (RListComparator)strcmp);
}
}
}
}
r_cons_printf ("[YARA tags]\n");
r_list_foreach (tag_list, tags_it, tag_name) {
r_cons_printf ("%s\n", tag_name);
}
r_list_free (tag_list);
return true;
}
static int r_cmd_yara_tag (const char * search_tag) {
/* List rules with tag search_tag */
RListIter* rules_it;
YR_RULES* rules;
YR_RULE* rule;
const char* tag_name;
r_list_foreach (rules_list, rules_it, rules) {
yr_rules_foreach (rules, rule) {
yr_rule_tags_foreach(rule, tag_name) {eprintf ("Invalid option\n");
if (r_str_casestr (tag_name, search_tag)) {
r_cons_printf("%s\n", rule->identifier);
break;
}
}
}
}
return true;
}
static int r_cmd_yara_list () {
/* List all loaded rules */
RListIter* rules_it;
YR_RULES* rules;
YR_RULE* rule;
r_list_foreach (rules_list, rules_it, rules) {
yr_rules_foreach (rules, rule) {
r_cons_printf("%s\n", rule->identifier);
}
}
return true;
}
static int r_cmd_yara_clear () {
/* Clears all loaded rules */
r_list_free (rules_list);
rules_list = r_list_newf((RListFree) yr_rules_destroy);
eprintf ("Rules cleared.\n");
return true;
}
static int r_cmd_yara_add(const RCore* core, const char* input) {
/* Add a rule with user input */
YR_COMPILER* compiler = NULL;
char* modified_template = NULL;
char* old_template = NULL;
int result, i, continue_edit;
for( i = 0; input[i] != '\0'; i++) {
if (input[i] != ' ') {
return r_cmd_yara_add_file (input + i);
}
}
if (yr_compiler_create (&compiler) != ERROR_SUCCESS) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
return false;
}
old_template = strdup(yara_rule_template);
do {
modified_template = r_core_editor (core, NULL, old_template);
free(old_template);
old_template = NULL;
if (!modified_template) {
eprintf("Something happened with the temp file");
goto err_exit;
}
result = yr_compiler_add_string (compiler, modified_template, NULL);
if( result > 0 ) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
continue_edit = r_cons_yesno('y', "Do you want to continue editing the rule? [y]/n\n");
if (!continue_edit) {
goto err_exit;
}
old_template = modified_template;
modified_template = NULL;
}
} while (result > 0);
free(modified_template);
yr_compiler_destroy (compiler);
r_cons_printf ("Rule successfully added.\n");
return true;
err_exit:
if (compiler) yr_compiler_destroy (compiler);
if (modified_template) free (modified_template);
if (old_template) free (old_template);
return false;
}
static int r_cmd_yara_add_file(const char* rules_path) {
YR_COMPILER* compiler = NULL;
YR_RULES* rules;
FILE* rules_file = NULL;
int result;
if (!rules_path) {
eprintf ("Please tell me what am I supposed to load\n");
return false;
}
rules_file = r_sandbox_fopen (rules_path, "r");
if (!rules_file) {
eprintf ("Unable to open %s\n", rules_path);
return false;
}
if (yr_compiler_create (&compiler) != ERROR_SUCCESS) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
goto err_exit;
}
result = yr_compiler_add_file (compiler, rules_file, NULL, rules_path);
fclose (rules_file);
rules_file = NULL;
if (result > 0) {
char buf[64];
eprintf ("Error: %s : %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)),
rules_path);
goto err_exit;
}
if (yr_compiler_get_rules (compiler, &rules) != ERROR_SUCCESS) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
goto err_exit;
}
r_list_append(rules_list, rules);
yr_compiler_destroy (compiler);
return true;
err_exit:
if (compiler) yr_compiler_destroy (compiler);
if (rules_file) fclose (rules_file);
return false;
}
static int r_cmd_yara_help(const RCore* core) {
const char * help_message[] = {
"Usage: yara", "", " Yara plugin",
"add", " [file]", "Add yara rules from file, or open $EDITOR with yara rule template",
"clear", "", "Clear all rules",
"help", "", "Show this help",
"list", "", "List all rules",
"scan", "[S]", "Scan the current file, if S option is given it prints matching strings.",
"show", " name", "Show rules containing name",
"tag", " name", "List rules with tag 'name'",
"tags", "", "List tags from the loaded rules",
NULL
};
r_core_cmd_help (core, help_message);
return true;
}
static int r_cmd_yara_process(const RCore* core, const char* input) {
if (!strncmp (input, "add", 3))
return r_cmd_yara_add (core, input + 3);
else if (!strncmp (input, "clear", 4))
return r_cmd_yara_clear ();
else if (!strncmp (input, "list", 4))
return r_cmd_yara_list ();
else if (!strncmp (input, "scan", 4))
return r_cmd_yara_scan (core, input + 4);
else if (!strncmp (input, "show", 4))
return r_cmd_yara_show (input + 5);
else if (!strncmp (input, "tags", 4))
return r_cmd_yara_tags ();
else if (!strncmp (input, "tag ", 4))
return r_cmd_yara_tag (input + 4);
else
return r_cmd_yara_help (core);
}
static int r_cmd_yara_call(void *user, const char *input) {
const char *args;
RCore* core = (RCore*) user;
if (strncmp (input, "yara", 4)) {
return false;
}
if (strncmp (input, "yara ", 5)) {
return r_cmd_yara_help (core);
}
args = input + 4;
if (! initialized && !r_cmd_yara_init (core, NULL)) {
return false;
}
if (*args) {
args++;
}
r_cmd_yara_process (core, args);
return true;
}
static int r_cmd_yara_load_default_rules (const RCore* core) {
RListIter* iter = NULL;
YR_COMPILER* compiler = NULL;
YR_RULES* yr_rules;
char* filename, *complete_path;
char* rules = NULL;
char* y3_rule_dir = r_str_newf ("%s%s%s", r_str_home(R2_HOME_PLUGINS), R_SYS_DIR, "rules-yara3");
RList* list = r_sys_dir (y3_rule_dir);
if (yr_compiler_create (&compiler) != ERROR_SUCCESS) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
goto err_exit;
}
yr_compiler_set_callback(compiler, compiler_callback, NULL);
r_list_foreach (list, iter, filename) {
if (filename[0] != '.') { // skip '.', '..' and hidden files
complete_path = r_str_newf ("%s%s%s", y3_rule_dir, R_SYS_DIR, filename);
rules = (char*)r_file_gzslurp (complete_path, NULL, true);
free (complete_path);
complete_path = NULL;
if (yr_compiler_add_string (compiler, rules, NULL) > 0) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
}
free (rules);
rules = NULL;
}
}
r_list_free (list);
if (yr_compiler_get_rules (compiler, &yr_rules) != ERROR_SUCCESS) {
char buf[64];
eprintf ("Error: %s\n",
yr_compiler_get_error_message (compiler, buf, sizeof (buf)));
goto err_exit;
}
r_list_append(rules_list, yr_rules);
yr_compiler_destroy (compiler);
return true;
err_exit:
if (y3_rule_dir) free (y3_rule_dir);
if (compiler) yr_compiler_destroy (compiler);
if (list) r_list_free (list);
if (rules) free (rules);
return false;
}
static int r_cmd_yara_init(void *user, const char *cmd) {
RCore* core = (RCore *)user;
rules_list = r_list_newf((RListFree) yr_rules_destroy);
yr_initialize ();
r_cmd_yara_load_default_rules (core);
initialized = true;
flagidx = 0;
return true;
}
static int r_cmd_yara_fini(){
if (initialized) {
r_list_free (rules_list);
yr_finalize();
initialized = false;
}
return true;
}
RCorePlugin r_core_plugin_yara = {
.name = "yara",
.desc = "YARA integration",
.license = "LGPL",
.call = r_cmd_yara_call,
.init = r_cmd_yara_init,
.fini = r_cmd_yara_fini
};
#ifndef CORELIB
RLibStruct radare_plugin = {
.type = R_LIB_TYPE_CORE,
.data = &r_core_plugin_yara,
.version = R2_VERSION
};
#endif
| radare/radare2-extras | yara/yara/core_yara.c | C | lgpl-3.0 | 13,849 |
# Change Log
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
### Added
- Added support for decoding HTML entities (decode_html_entities()) (2018-09-28).
- Added serialisation through the [cereal](http://uscilab.github.io/cereal/index.html) C++ library. Library headers have been copied to src/CDM/cereal (2017-02-26).
- Added UNICODE normalisation (NFC) through boost::locale.
- Changed unsigned long to uint32\_t.
- Allowed Tcl functions \(tip\_\*\) to accept either CDM objects wrapped as Tcl value objects, or as SWIG objects. For example, all "tip\_GetType [CDM::Annotation -args token]", "tip\_GetType [CDM::Annotation ann token]" and "tip\_GetType {{} token {} {}}" are valid.
### Changed
### Deprecated
### Removed
### Fixed
### Security
| petasis/ellogon | CHANGELOG.md | Markdown | lgpl-3.0 | 926 |
package org.yawlfoundation.yawl.worklet.client;
import org.yawlfoundation.yawl.editor.ui.specification.SpecificationModel;
import org.yawlfoundation.yawl.engine.YSpecificationID;
import java.io.IOException;
import java.util.Map;
/**
* @author Michael Adams
* @date 18/02/2016
*/
public class TaskIDChangeMap {
private Map<String, String> _changedIdentifiers;
public TaskIDChangeMap(Map<String, String> changeMap) {
_changedIdentifiers = changeMap;
}
public String getID(String oldID) {
String newID = _changedIdentifiers.get(oldID);
return newID != null ? newID : oldID;
}
public String getOldID(String newID) {
for (String oldID : _changedIdentifiers.keySet()) {
if (_changedIdentifiers.get(oldID).equals(newID)) {
return oldID;
}
}
return newID;
}
// called when a user changes a taskID
public void add(String oldID, String newID) {
// need to handle the case where this id has been updated
// more than once between saves
_changedIdentifiers.put(getOldID(oldID), newID);
}
public void saveChanges() {
if (! _changedIdentifiers.isEmpty()) {
YSpecificationID specID = SpecificationModel.getHandler().
getSpecification().getSpecificationID();
try {
if (WorkletClient.getInstance().updateRdrSetTaskIDs(specID, _changedIdentifiers)) {
_changedIdentifiers.clear();
}
}
catch (IOException ignore) {
//
}
}
}
}
| yawlfoundation/editor | source/org/yawlfoundation/yawl/worklet/client/TaskIDChangeMap.java | Java | lgpl-3.0 | 1,648 |
rori_wood_mite_lair_neutral_small_02 = Lair:new {
mobiles = {},
spawnLimit = 15,
buildingsVeryEasy = {},
buildingsEasy = {},
buildingsMedium = {},
buildingsHard = {},
buildingsVeryHard = {},
}
addLairTemplate("rori_wood_mite_lair_neutral_small_02", rori_wood_mite_lair_neutral_small_02)
| kidaa/Awakening-Core3 | bin/scripts/mobile/lair/creature_lair/rori_wood_mite_lair_neutral_small_02.lua | Lua | lgpl-3.0 | 295 |
// This code contains NVIDIA Confidential Information and is disclosed to you
// under a form of NVIDIA software license agreement provided separately to you.
//
// Notice
// NVIDIA Corporation and its licensors retain all intellectual property and
// proprietary rights in and to this software and related documentation and
// any modifications thereto. Any use, reproduction, disclosure, or
// distribution of this software and related documentation without an express
// license agreement from NVIDIA Corporation is strictly prohibited.
//
// ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
// NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
// THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
// MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
//
// Information and code furnished is believed to be accurate and reliable.
// However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
// information or for any infringement of patents or other rights of third parties that may
// result from its use. No license is granted by implication or otherwise under any patent
// or patent rights of NVIDIA Corporation. Details are subject to change without notice.
// This code supersedes and replaces all information previously supplied.
// NVIDIA Corporation products are not authorized for use as critical
// components in life support devices or systems without express written approval of
// NVIDIA Corporation.
//
// Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
#ifndef PXPVDSDK_PXPVDMEMCLIENT_H
#define PXPVDSDK_PXPVDMEMCLIENT_H
#include "PxPvdClient.h"
#include "PsHashMap.h"
#include "PsMutex.h"
#include "PsBroadcast.h"
#include "PxProfileEventBufferClient.h"
#include "PxProfileMemory.h"
namespace physx
{
class PvdDataStream;
namespace pvdsdk
{
class PvdImpl;
class PvdMemClient : public PvdClient,
public profile::PxProfileEventBufferClient,
public shdfnd::UserAllocated
{
PX_NOCOPY(PvdMemClient)
public:
PvdMemClient(PvdImpl& pvd);
virtual ~PvdMemClient();
bool isConnected() const;
void onPvdConnected();
void onPvdDisconnected();
void flush();
PvdDataStream* getDataStream();
PvdUserRenderer* getUserRender();
// memory event
void onAllocation(size_t size, const char* typeName, const char* filename, int line, void* allocatedMemory);
void onDeallocation(void* addr);
private:
PvdImpl& mSDKPvd;
PvdDataStream* mPvdDataStream;
bool mIsConnected;
// mem profile
shdfnd::Mutex mMutex; // mem onallocation can called from different threads
profile::PxProfileMemoryEventBuffer& mMemEventBuffer;
void handleBufferFlush(const uint8_t* inData, uint32_t inLength);
void handleClientRemoved();
};
} // namespace pvdsdk
} // namespace physx
#endif // PXPVDSDK_PXPVDMEMCLIENT_H
| Bang3DEngine/Bang | Compile/CompileDependencies/ThirdParty/PhysX/PxShared/src/pvd/src/PxPvdMemClient.h | C | lgpl-3.0 | 3,051 |
/**
The GPL License (GPL)
Copyright (c) 2012 Andreas Herz
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
**/
/**
* @class graphiti.Connection
* A Connection is the line between two {@link graphiti.Port}s.
*
* @inheritable
* @author Andreas Herz
* @extends graphiti.shape.basic.Line
*/
graphiti.Connection = graphiti.shape.basic.PolyLine.extend({
NAME : "graphiti.Connection",
DEFAULT_ROUTER: new graphiti.layout.connection.DirectRouter(),
//DEFAULT_ROUTER: new graphiti.layout.connection.ManhattanConnectionRouter(),
//DEFAULT_ROUTER: new graphiti.layout.connection.BezierConnectionRouter(),
//DEFAULT_ROUTER: new graphiti.layout.connection.ConnectionRouter(),
/**
* @constructor
* Creates a new figure element which are not assigned to any canvas.
*/
init: function() {
this._super();
this.sourcePort = null;
this.targetPort = null;
this.oldPoint=null;
this.sourceDecorator = null; /*:graphiti.ConnectionDecorator*/
this.targetDecorator = null; /*:graphiti.ConnectionDecorator*/
// decoration of the polyline
//
this.startDecoSet = null;
this.endDecoSet=null;
this.regulated = false;
this.draggable = false;
this.selectable = false;
//this.Activator = new g.Buttons.Activate();
//this.Repressor = new g.Buttons.Inhibit();
//this.remove = new g.Buttons.Remove();
//this.addFigure(this.remove, new graphiti.layout.locator.ConnectionLocator());
this.sourceAnchor = new graphiti.ConnectionAnchor(this);
this.targetAnchor = new graphiti.ConnectionAnchor(this);
this.router = this.DEFAULT_ROUTER;
this.setColor("#4cbf2f");
this.setStroke(3);
},
/**
* @private
**/
disconnect : function()
{
if (this.sourcePort !== null) {
this.sourcePort.detachMoveListener(this);
this.fireSourcePortRouteEvent();
}
if (this.targetPort !== null) {
this.targetPort.detachMoveListener(this);
this.fireTargetPortRouteEvent();
}
},
/**
* @private
**/
reconnect : function()
{
if (this.sourcePort !== null) {
this.sourcePort.attachMoveListener(this);
this.fireSourcePortRouteEvent();
}
if (this.targetPort !== null) {
this.targetPort.attachMoveListener(this);
this.fireTargetPortRouteEvent();
}
this.routingRequired =true;
this.repaint();
},
/**
* You can't drag&drop the resize handles of a connector.
* @type boolean
**/
isResizeable : function()
{
return this.isDraggable();
},
/**
* @method
* Add a child figure to the Connection. The hands over figure doesn't support drag&drop
* operations. It's only a decorator for the connection.<br>
* Mainly for labels or other fancy decorations :-)
*
* @param {graphiti.Figure} figure the figure to add as decoration to the connection.
* @param {graphiti.layout.locator.ConnectionLocator} locator the locator for the child.
**/
addFigure : function(child, locator)
{
// just to ensure the right interface for the locator.
// The base class needs only 'graphiti.layout.locator.Locator'.
if(!(locator instanceof graphiti.layout.locator.ConnectionLocator)){
throw "Locator must implement the class graphiti.layout.locator.ConnectionLocator";
}
this._super(child, locator);
},
/**
* @method
* Set the ConnectionDecorator for this object.
*
* @param {graphiti.decoration.connection.Decorator} the new source decorator for the connection
**/
setSourceDecorator:function( decorator)
{
this.sourceDecorator = decorator;
this.routingRequired = true;
this.repaint();
},
/**
* @method
* Get the current source ConnectionDecorator for this object.
*
* @type graphiti.ConnectionDecorator
**/
getSourceDecorator:function()
{
return this.sourceDecorator;
},
/**
* @method
* Set the ConnectionDecorator for this object.
*
* @param {graphiti.decoration.connection.Decorator} the new target decorator for the connection
**/
setTargetDecorator:function( decorator)
{
this.targetDecorator = decorator;
this.routingRequired =true;
this.repaint();
},
/**
* @method
* Get the current target ConnectionDecorator for this object.
*
* @type graphiti.ConnectionDecorator
**/
getTargetDecorator:function()
{
return this.targetDecorator;
},
/**
* @method
* Set the ConnectionAnchor for this object. An anchor is responsible for the endpoint calculation
* of an connection.
*
* @param {graphiti.ConnectionAnchor} the new source anchor for the connection
**/
setSourceAnchor:function(/*:graphiti.ConnectionAnchor*/ anchor)
{
this.sourceAnchor = anchor;
this.sourceAnchor.setOwner(this.sourcePort);
this.routingRequired =true;
this.repaint();
},
/**
* @method
* Set the ConnectionAnchor for this object.
*
* @param {graphiti.ConnectionAnchor} the new target anchor for the connection
**/
setTargetAnchor:function(/*:graphiti.ConnectionAnchor*/ anchor)
{
this.targetAnchor = anchor;
this.targetAnchor.setOwner(this.targetPort);
this.routingRequired =true;
this.repaint();
},
/**
* @method
* Set the ConnectionRouter.
*
**/
setRouter:function(/*:graphiti.ConnectionRouter*/ router)
{
if(router !==null){
this.router = router;
}
else{
this.router = new graphiti.layout.connection.NullRouter();
}
this.routingRequired =true;
// repaint the connection with the new router
this.repaint();
},
/**
* @method
* Return the current active router of this connection.
*
* @type graphiti.ConnectionRouter
**/
getRouter:function()
{
return this.router;
},
/**
* @method
* Calculate the path of the polyline
*
* @private
*/
calculatePath: function(){
if(this.sourcePort===null || this.targetPort===null){
return;
}
this._super();
},
/**
* @private
**/
repaint:function(attributes)
{
if(this.repaintBlocked===true || this.shape===null){
return;
}
if(this.sourcePort===null || this.targetPort===null){
return;
}
this._super(attributes);
// paint the decorator if any exists
//
if(this.getSource().getParent().isMoving===false && this.getTarget().getParent().isMoving===false )
{
if(this.targetDecorator!==null && this.endDecoSet===null){
this.endDecoSet= this.targetDecorator.paint(this.getCanvas().paper);
}
if(this.sourceDecorator!==null && this.startDecoSet===null){
this.startDecoSet= this.sourceDecorator.paint(this.getCanvas().paper);
}
}
// translate/transform the decorations to the end/start of the connection
// and rotate them as well
//
if(this.startDecoSet!==null){
this.startDecoSet.transform("r"+this.getStartAngle()+"," + this.getStartX() + "," + this.getStartY()+" t" + this.getStartX() + "," + this.getStartY());
}
if(this.endDecoSet!==null){
this.endDecoSet.transform("r"+this.getEndAngle()+"," + this.getEndX() + "," + this.getEndY()+" t" + this.getEndX() + "," + this.getEndY());
}
},
postProcess: function(postPorcessCache){
this.router.postProcess(this, this.getCanvas(), postPorcessCache);
},
/**
* @method
* Called by the framework during drag&drop operations.
*
* @param {graphiti.Figure} draggedFigure The figure which is currently dragging
*
* @return {Boolean} true if this port accepts the dragging port for a drop operation
* @template
**/
onDragEnter : function( draggedFigure )
{
this.setGlow(true);
return true;
},
/**
* @method
* Called if the DragDrop object leaving the current hover figure.
*
* @param {graphiti.Figure} draggedFigure The figure which is currently dragging
* @template
**/
onDragLeave:function( draggedFigure )
{
this.setGlow(false);
},
/**
* Return the recalculated position of the start point if we have set an anchor.
*
* @return graphiti.geo.Point
**/
getStartPoint:function()
{
if(this.isMoving===false){
return this.sourceAnchor.getLocation(this.targetAnchor.getReferencePoint());
}
else{
return this._super();
}
},
/**
* Return the recalculated position of the start point if we have set an anchor.
*
* @return graphiti.geo.Point
**/
getEndPoint:function()
{
if(this.isMoving===false){
return this.targetAnchor.getLocation(this.sourceAnchor.getReferencePoint());
}
else{
return this._super();
}
},
/**
* @method
* Set the new source port of this connection. This enforce a repaint of the connection.
*
* @param {graphiti.Port} port The new source port of this connection.
*
**/
setSource:function( port)
{
if(this.sourcePort!==null){
this.sourcePort.detachMoveListener(this);
}
this.sourcePort = port;
if(this.sourcePort===null){
return;
}
this.routingRequired = true;
this.sourceAnchor.setOwner(this.sourcePort);
this.fireSourcePortRouteEvent();
this.sourcePort.attachMoveListener(this);
this.setStartPoint(port.getAbsoluteX(), port.getAbsoluteY());
},
/**
* @method
* Returns the source port of this connection.
*
* @type graphiti.Port
**/
getSource:function()
{
return this.sourcePort;
},
/**
* @method
* Set the target port of this connection. This enforce a repaint of the connection.
*
* @param {graphiti.Port} port The new target port of this connection
**/
setTarget:function( port)
{
if(this.targetPort!==null){
this.targetPort.detachMoveListener(this);
}
this.targetPort = port;
if(this.targetPort===null){
return;
}
this.routingRequired = true;
this.targetAnchor.setOwner(this.targetPort);
this.fireTargetPortRouteEvent();
this.targetPort.attachMoveListener(this);
this.setEndPoint(port.getAbsoluteX(), port.getAbsoluteY());
},
/**
* @method
* Returns the target port of this connection.
*
* @type graphiti.Port
**/
getTarget:function()
{
return this.targetPort;
},
/**
*
**/
onOtherFigureIsMoving:function(/*:graphiti.Figure*/ figure)
{
if(figure===this.sourcePort){
this.setStartPoint(this.sourcePort.getAbsoluteX(), this.sourcePort.getAbsoluteY());
}
else{
this.setEndPoint(this.targetPort.getAbsoluteX(), this.targetPort.getAbsoluteY());
}
this._super(figure);
},
/**
* Returns the angle of the connection at the output port (source)
*
**/
getStartAngle:function()
{
// return a good default value if the connection is not routed at the
// moment
if( this.lineSegments.getSize()===0){
return 0;
}
var p1 = this.lineSegments.get(0).start;
var p2 = this.lineSegments.get(0).end;
// if(this.router instanceof graphiti.layout.connection.BezierConnectionRouter)
// {
// p2 = this.lineSegments.get(5).end;
// }
var length = Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
var angle = -(180/Math.PI) *Math.asin((p1.y-p2.y)/length);
if(angle<0)
{
if(p2.x<p1.x){
angle = Math.abs(angle) + 180;
}
else{
angle = 360- Math.abs(angle);
}
}
else
{
if(p2.x<p1.x){
angle = 180-angle;
}
}
return angle;
},
getEndAngle:function()
{
// return a good default value if the connection is not routed at the
// moment
if (this.lineSegments.getSize() === 0) {
return 90;
}
var p1 = this.lineSegments.get(this.lineSegments.getSize()-1).end;
var p2 = this.lineSegments.get(this.lineSegments.getSize()-1).start;
// if(this.router instanceof graphiti.layout.connection.BezierConnectionRouter)
// {
// p2 = this.lineSegments.get(this.lineSegments.getSize()-5).end;
// }
var length = Math.sqrt((p1.x-p2.x)*(p1.x-p2.x)+(p1.y-p2.y)*(p1.y-p2.y));
var angle = -(180/Math.PI) *Math.asin((p1.y-p2.y)/length);
if(angle<0)
{
if(p2.x<p1.x){
angle = Math.abs(angle) + 180;
}
else{
angle = 360- Math.abs(angle);
}
}
else
{
if(p2.x<p1.x){
angle = 180-angle;
}
}
return angle;
},
/**
* @private
**/
fireSourcePortRouteEvent:function()
{
// enforce a repaint of all connections which are related to this port
// this is required for a "FanConnectionRouter" or "ShortesPathConnectionRouter"
//
var connections = this.sourcePort.getConnections();
for(var i=0; i<connections.getSize();i++)
{
connections.get(i).repaint();
}
},
/**
* @private
**/
fireTargetPortRouteEvent:function()
{
// enforce a repaint of all connections which are related to this port
// this is required for a "FanConnectionRouter" or "ShortesPathConnectionRouter"
//
var connections = this.targetPort.getConnections();
for(var i=0; i<connections.getSize();i++)
{
connections.get(i).repaint();
}
},
/**
* @method
* Returns the Command to perform the specified Request or null.
*
* @param {graphiti.command.CommandType} request describes the Command being requested
* @return {graphiti.command.Command} null or a Command
**/
createCommand:function( request)
{
if(request.getPolicy() === graphiti.command.CommandType.MOVE_BASEPOINT)
{
// DragDrop of a connection doesn't create a undo command at this point. This will be done in
// the onDrop method
return new graphiti.command.CommandReconnect(this);
}
return this._super(request);
},
/**
* @method
* Return an objects with all important attributes for XML or JSON serialization
*
* @returns {Object}
*/
getPersistentAttributes : function()
{
var memento = this._super();
delete memento.x;
delete memento.y;
delete memento.width;
delete memento.height;
memento.source = {
node:this.getSource().getParent().getId(),
port: this.getSource().getName()
};
memento.target = {
node:this.getTarget().getParent().getId(),
port:this.getTarget().getName()
};
return memento;
},
/**
* @method
* Read all attributes from the serialized properties and transfer them into the shape.
*
* @param {Object} memento
* @returns
*/
setPersistentAttributes : function(memento)
{
this._super(memento);
// no extra param to read.
// Reason: done by the Layoute/Router
},
onClick: function() {
// wait to be implemented
/*$("#right-container").css({right: '0px'});
var hasClassIn = $("#collapseTwo").hasClass('in');
if(!hasClassIn) {
$("#collapseOne").toggleClass('in');
$("#collapseOne").css({height: '0'});
$("#collapseTwo").toggleClass('in');
$("#collapseTwo").css({height: "auto"});
}
$("#exogenous-factors-config").css({"display": "none"});
$("#protein-config").css({"display": "none"});
$("#component-config").css({"display": "none"});
$("#arrow-config").css({"display": "block"});*/
/*if (this.TYPE == "Activator") {
this.TYPE = "Inhibit";
this.setColor(new graphiti.util.Color("#43B967"));
} else {
this.TYPE = "Activator";
this.setColor(new graphiti.util.Color("#E14545"));
}*/
},
/*onDoubleClick: function() {
this.getCanvas().removeFigure(this);
}*/
});
| igemsoftware/SYSU-Software_2014 | server/static/js/graphiti/Connection.js | JavaScript | lgpl-3.0 | 16,767 |
/*
Logic.h -- part of the VaRGB library.
Copyright (C) 2013 Pat Deegan.
http://www.flyingcarsandstuff.com/projects/vargb/
Created on: 2013-03-05
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 3 of the License, or (at your option) any later version.
This 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 file LICENSE.txt for further informations on licensing terms.
***************************** OVERVIEW *****************************
Unlike the atomic curves "logical" curves, based on the
vargb::Curve::Logic class here, don't specify how the red, green
and blue values change with time. Instead, these curves act to
combine or otherwise transform other curves.
The name "Logic Curve" is mainly historical, as these curves started
out as simply AND-combined and OR-combined curves.
Now additional derivatives exist, such as Shift and Threshold, but
whatevs.
Logic curves need at least one, or optionally two, curves on which to operate.
These are stored in the (protected member) curves[]. The methods are constructed
to always check both children for required updates etc, so in cases where you
are only operating on a single child curve, the second curve is a static Dummy
curve, which basically never requires an update and never terminates.
*/
#ifndef LOGIC_H_
#define LOGIC_H_
#include "../VaRGBConfig.h"
#include "../Curve.h"
#include "Dummy.h"
namespace vargb {
namespace Curve {
#define VARGB_CURVE_LOGIC_NUMCURVES 2
class Logic : public vargb::Curve::Curve {
public:
/*
* Logic Curve constructor
* Takes one, or two, pointers to other curves on which to operate.
*/
Logic(vargb::Curve::Curve * curve_a, vargb::Curve::Curve * curve_b=NULL);
#ifdef VaRGB_CLASS_DESTRUCTORS_ENABLE
virtual ~Logic() {}
#endif
virtual bool completed();
virtual void settingsUpdated();
virtual void start(IlluminationSettings* initial_settings = NULL);
virtual void setTick(VaRGBTimeValue setTo,
IlluminationSettings* initial_settings = NULL);
virtual void tick(uint8_t num = 1);
virtual void reset();
protected:
/*
* childUpdated()
* This base class will check the children to see if they've been updated
* after every tick. If this happens to be the case, the childUpdated()
* method will be called so the Logic curve instance can do its thing.
*
* This is an abstract method, which you must override in any derived classes.
*/
virtual void childUpdated() = 0;
vargb::Curve::Curve * curves[VARGB_CURVE_LOGIC_NUMCURVES];
private:
static Dummy dummy_curve;
};
} /* namespace Curve */
} /* namespace vargb */
#endif /* LOGIC_H_ */
| psychogenic/VaRGB | includes/Curves/Logic.h | C | lgpl-3.0 | 2,887 |
package idare.imagenode.internal.GUI.DataSetController;
import idare.imagenode.ColorManagement.ColorScalePane;
import idare.imagenode.Interfaces.DataSets.DataSet;
import idare.imagenode.Interfaces.Layout.DataSetLayoutProperties;
import idare.imagenode.internal.GUI.DataSetController.DataSetSelectionModel.ColorPaneBox;
import idare.imagenode.internal.GUI.DataSetController.DataSetSelectionModel.ComboBoxRenderer;
import javax.swing.JTable;
import javax.swing.table.TableCellEditor;
import javax.swing.table.TableCellRenderer;
/**
* A DataSetSelectionTable, that is specific to the {@link DataSetSelectionModel}, using its unique renderers and editors.
* @author Thomas Pfau
*
*/
public class DataSetSelectionTable extends JTable {
DataSetSelectionModel tablemodel;
public DataSetSelectionTable(DataSetSelectionModel mod)
{
super(mod);
tablemodel = mod;
}
/**
* Move the selected entry (we assume single selection) down one row.
* If the selected row is already the top row, nothing happens.
*/
public void moveEntryUp()
{
int row = getSelectedRow();
if(row > 0)
{
tablemodel.moveRowUp(row);
}
getSelectionModel().setSelectionInterval(row-1, row-1);
}
/**
* Move the selected entry (we assume single selection) down one row.
* If the selected row is already the last row, nothing happens.
*/
public void moveEntryDown()
{
int row = getSelectedRow();
if(row >= 0 & row < getRowCount()-1 )
{
tablemodel.moveRowDown(row);
}
getSelectionModel().setSelectionInterval(row+1, row+1);
}
@Override
public TableCellEditor getCellEditor(int row, int column) {
Object value = super.getValueAt(row, column);
if(value != null) {
// we need very specific Editors for ColorScales and Dataset Properties.
if(value instanceof DataSetLayoutProperties) {
return tablemodel.getPropertiesEditor(row);
}
if(value instanceof ColorScalePane)
{
return tablemodel.getColorScaleEditor(row);
}
if(value instanceof DataSet)
{
return tablemodel.getDataSetEditor(row);
}
return getDefaultEditor(value.getClass());
}
return super.getCellEditor(row, column);
}
@Override
public TableCellRenderer getCellRenderer(int row, int column) {
Object value = super.getValueAt(row, column);
if(value != null) {
// we need very specific renderers for ColorScales and Dataset Properties.
if(value instanceof ComboBoxRenderer || value instanceof DataSetLayoutProperties) {
TableCellRenderer current = tablemodel.getPropertiesRenderer(row);
if(current != null)
return current;
else
return super.getCellRenderer(row, column);
}
if(value instanceof ColorPaneBox|| value instanceof ColorScalePane) {
TableCellRenderer current = tablemodel.getColorScaleRenderer(row);
if(current != null)
return current;
else
return super.getCellRenderer(row, column);
}
return getDefaultRenderer(value.getClass());
}
return super.getCellRenderer(row, column);
}
} | sysbiolux/IDARE | METANODE-CREATOR/src/main/java/idare/imagenode/internal/GUI/DataSetController/DataSetSelectionTable.java | Java | lgpl-3.0 | 3,145 |
// mksysnum_linux.pl /usr/include/asm/unistd_64.h
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build amd64,linux
package unix
const (
SYS_READ = 0
SYS_WRITE = 1
SYS_OPEN = 2
SYS_CLOSE = 3
SYS_STAT = 4
SYS_FSTAT = 5
SYS_LSTAT = 6
SYS_POLL = 7
SYS_LSEEK = 8
SYS_MMAP = 9
SYS_MPROTECT = 10
SYS_MUNMAP = 11
SYS_BRK = 12
SYS_RT_SIGACTION = 13
SYS_RT_SIGPROCMASK = 14
SYS_RT_SIGRETURN = 15
SYS_IOCTL = 16
SYS_PREAD64 = 17
SYS_PWRITE64 = 18
SYS_READV = 19
SYS_WRITEV = 20
SYS_ACCESS = 21
SYS_PIPE = 22
SYS_SELECT = 23
SYS_SCHED_YIELD = 24
SYS_MREMAP = 25
SYS_MSYNC = 26
SYS_MINCORE = 27
SYS_MADVISE = 28
SYS_SHMGET = 29
SYS_SHMAT = 30
SYS_SHMCTL = 31
SYS_DUP = 32
SYS_DUP2 = 33
SYS_PAUSE = 34
SYS_NANOSLEEP = 35
SYS_GETITIMER = 36
SYS_ALARM = 37
SYS_SETITIMER = 38
SYS_GETPID = 39
SYS_SENDFILE = 40
SYS_SOCKET = 41
SYS_CONNECT = 42
SYS_ACCEPT = 43
SYS_SENDTO = 44
SYS_RECVFROM = 45
SYS_SENDMSG = 46
SYS_RECVMSG = 47
SYS_SHUTDOWN = 48
SYS_BIND = 49
SYS_LISTEN = 50
SYS_GETSOCKNAME = 51
SYS_GETPEERNAME = 52
SYS_SOCKETPAIR = 53
SYS_SETSOCKOPT = 54
SYS_GETSOCKOPT = 55
SYS_CLONE = 56
SYS_FORK = 57
SYS_VFORK = 58
SYS_EXECVE = 59
SYS_EXIT = 60
SYS_WAIT4 = 61
SYS_KILL = 62
SYS_UNAME = 63
SYS_SEMGET = 64
SYS_SEMOP = 65
SYS_SEMCTL = 66
SYS_SHMDT = 67
SYS_MSGGET = 68
SYS_MSGSND = 69
SYS_MSGRCV = 70
SYS_MSGCTL = 71
SYS_FCNTL = 72
SYS_FLOCK = 73
SYS_FSYNC = 74
SYS_FDATASYNC = 75
SYS_TRUNCATE = 76
SYS_FTRUNCATE = 77
SYS_GETDENTS = 78
SYS_GETCWD = 79
SYS_CHDIR = 80
SYS_FCHDIR = 81
SYS_RENAME = 82
SYS_MKDIR = 83
SYS_RMDIR = 84
SYS_CREAT = 85
SYS_LINK = 86
SYS_UNLINK = 87
SYS_SYMLINK = 88
SYS_READLINK = 89
SYS_CHMOD = 90
SYS_FCHMOD = 91
SYS_CHOWN = 92
SYS_FCHOWN = 93
SYS_LCHOWN = 94
SYS_UMASK = 95
SYS_GETTIMEOFDAY = 96
SYS_GETRLIMIT = 97
SYS_GETRUSAGE = 98
SYS_SYSINFO = 99
SYS_TIMES = 100
SYS_PTRACE = 101
SYS_GETUID = 102
SYS_SYSLOG = 103
SYS_GETGID = 104
SYS_SETUID = 105
SYS_SETGID = 106
SYS_GETEUID = 107
SYS_GETEGID = 108
SYS_SETPGID = 109
SYS_GETPPID = 110
SYS_GETPGRP = 111
SYS_SETSID = 112
SYS_SETREUID = 113
SYS_SETREGID = 114
SYS_GETGROUPS = 115
SYS_SETGROUPS = 116
SYS_SETRESUID = 117
SYS_GETRESUID = 118
SYS_SETRESGID = 119
SYS_GETRESGID = 120
SYS_GETPGID = 121
SYS_SETFSUID = 122
SYS_SETFSGID = 123
SYS_GETSID = 124
SYS_CAPGET = 125
SYS_CAPSET = 126
SYS_RT_SIGPENDING = 127
SYS_RT_SIGTIMEDWAIT = 128
SYS_RT_SIGQUEUEINFO = 129
SYS_RT_SIGSUSPEND = 130
SYS_SIGALTSTACK = 131
SYS_UTIME = 132
SYS_MKNOD = 133
SYS_USELIB = 134
SYS_PERSONALITY = 135
SYS_USTAT = 136
SYS_STATFS = 137
SYS_FSTATFS = 138
SYS_SYSFS = 139
SYS_GETPRIORITY = 140
SYS_SETPRIORITY = 141
SYS_SCHED_SETPARAM = 142
SYS_SCHED_GETPARAM = 143
SYS_SCHED_SETSCHEDULER = 144
SYS_SCHED_GETSCHEDULER = 145
SYS_SCHED_GET_PRIORITY_MAX = 146
SYS_SCHED_GET_PRIORITY_MIN = 147
SYS_SCHED_RR_GET_INTERVAL = 148
SYS_MLOCK = 149
SYS_MUNLOCK = 150
SYS_MLOCKALL = 151
SYS_MUNLOCKALL = 152
SYS_VHANGUP = 153
SYS_MODIFY_LDT = 154
SYS_PIVOT_ROOT = 155
SYS__SYSCTL = 156
SYS_PRCTL = 157
SYS_ARCH_PRCTL = 158
SYS_ADJTIMEX = 159
SYS_SETRLIMIT = 160
SYS_CHROOT = 161
SYS_SYNC = 162
SYS_ACCT = 163
SYS_SETTIMEOFDAY = 164
SYS_MOUNT = 165
SYS_UMOUNT2 = 166
SYS_SWAPON = 167
SYS_SWAPOFF = 168
SYS_REBOOT = 169
SYS_SENTRUSTOSTNAME = 170
SYS_SETDOMAINNAME = 171
SYS_IOPL = 172
SYS_IOPERM = 173
SYS_CREATE_MODULE = 174
SYS_INIT_MODULE = 175
SYS_DELETE_MODULE = 176
SYS_GET_KERNEL_SYMS = 177
SYS_QUERY_MODULE = 178
SYS_QUOTACTL = 179
SYS_NFSSERVCTL = 180
SYS_GETPMSG = 181
SYS_PUTPMSG = 182
SYS_AFS_SYSCALL = 183
SYS_TUXCALL = 184
SYS_SECURITY = 185
SYS_GETTID = 186
SYS_READAHEAD = 187
SYS_SETXATTR = 188
SYS_LSETXATTR = 189
SYS_FSETXATTR = 190
SYS_GETXATTR = 191
SYS_LGETXATTR = 192
SYS_FGETXATTR = 193
SYS_LISTXATTR = 194
SYS_LLISTXATTR = 195
SYS_FLISTXATTR = 196
SYS_REMOVEXATTR = 197
SYS_LREMOVEXATTR = 198
SYS_FREMOVEXATTR = 199
SYS_TKILL = 200
SYS_TIME = 201
SYS_FUTEX = 202
SYS_SCHED_SETAFFINITY = 203
SYS_SCHED_GETAFFINITY = 204
SYS_SET_THREAD_AREA = 205
SYS_IO_SETUP = 206
SYS_IO_DESTROY = 207
SYS_IO_GETEVENTS = 208
SYS_IO_SUBMIT = 209
SYS_IO_CANCEL = 210
SYS_GET_THREAD_AREA = 211
SYS_LOOKUP_DCOOKIE = 212
SYS_EPOLL_CREATE = 213
SYS_EPOLL_CTL_OLD = 214
SYS_EPOLL_WAIT_OLD = 215
SYS_REMAP_FILE_PAGES = 216
SYS_GETDENTS64 = 217
SYS_SET_TID_ADDRESS = 218
SYS_RESTART_SYSCALL = 219
SYS_SEMTIMEDOP = 220
SYS_FADVISE64 = 221
SYS_TIMER_CREATE = 222
SYS_TIMER_SETTIME = 223
SYS_TIMER_GETTIME = 224
SYS_TIMER_GETOVERRUN = 225
SYS_TIMER_DELETE = 226
SYS_CLOCK_SETTIME = 227
SYS_CLOCK_GETTIME = 228
SYS_CLOCK_GETRES = 229
SYS_CLOCK_NANOSLEEP = 230
SYS_EXIT_GROUP = 231
SYS_EPOLL_WAIT = 232
SYS_EPOLL_CTL = 233
SYS_TGKILL = 234
SYS_UTIMES = 235
SYS_VSERVER = 236
SYS_MBIND = 237
SYS_SET_MEMPOLICY = 238
SYS_GET_MEMPOLICY = 239
SYS_MQ_OPEN = 240
SYS_MQ_UNLINK = 241
SYS_MQ_TIMEDSEND = 242
SYS_MQ_TIMEDRECEIVE = 243
SYS_MQ_NOTIFY = 244
SYS_MQ_GETSETATTR = 245
SYS_KEXEC_LOAD = 246
SYS_WAITID = 247
SYS_ADD_KEY = 248
SYS_REQUEST_KEY = 249
SYS_KEYCTL = 250
SYS_IOPRIO_SET = 251
SYS_IOPRIO_GET = 252
SYS_INOTIFY_INIT = 253
SYS_INOTIFY_ADD_WATCH = 254
SYS_INOTIFY_RM_WATCH = 255
SYS_MIGRATE_PAGES = 256
SYS_OPENAT = 257
SYS_MKDIRAT = 258
SYS_MKNODAT = 259
SYS_FCHOWNAT = 260
SYS_FUTIMESAT = 261
SYS_NEWFSTATAT = 262
SYS_UNLINKAT = 263
SYS_RENAMEAT = 264
SYS_LINKAT = 265
SYS_SYMLINKAT = 266
SYS_READLINKAT = 267
SYS_FCHMODAT = 268
SYS_FACCESSAT = 269
SYS_PSELECT6 = 270
SYS_PPOLL = 271
SYS_UNSHARE = 272
SYS_SET_ROBUST_LIST = 273
SYS_GET_ROBUST_LIST = 274
SYS_SPLICE = 275
SYS_TEE = 276
SYS_SYNC_FILE_RANGE = 277
SYS_VMSPLICE = 278
SYS_MOVE_PAGES = 279
SYS_UTIMENSAT = 280
SYS_EPOLL_PWAIT = 281
SYS_SIGNALFD = 282
SYS_TIMERFD_CREATE = 283
SYS_EVENTFD = 284
SYS_FALLOCATE = 285
SYS_TIMERFD_SETTIME = 286
SYS_TIMERFD_GETTIME = 287
SYS_ACCEPT4 = 288
SYS_SIGNALFD4 = 289
SYS_EVENTFD2 = 290
SYS_EPOLL_CREATE1 = 291
SYS_DUP3 = 292
SYS_PIPE2 = 293
SYS_INOTIFY_INIT1 = 294
SYS_PREADV = 295
SYS_PWRITEV = 296
SYS_RT_TGSIGQUEUEINFO = 297
SYS_PERF_EVENT_OPEN = 298
SYS_RECVMMSG = 299
SYS_FANOTIFY_INIT = 300
SYS_FANOTIFY_MARK = 301
SYS_PRLIMIT64 = 302
SYS_NAME_TO_HANDLE_AT = 303
SYS_OPEN_BY_HANDLE_AT = 304
SYS_CLOCK_ADJTIME = 305
SYS_SYNCFS = 306
SYS_SENDMMSG = 307
SYS_SETNS = 308
SYS_GETCPU = 309
SYS_PROCESS_VM_READV = 310
SYS_PROCESS_VM_WRITEV = 311
)
| trust-tech/go-trustmachine | vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go | GO | lgpl-3.0 | 10,655 |
/* Mesquite source code. Copyright 1997-2009 W. Maddison and D. Maddison.
Version 2.7, August 2009.
Disclaimer: The Mesquite source code is lengthy and we are few. There are no doubt inefficiencies and goofs in this code.
The commenting leaves much to be desired. Please approach this source code with the spirit of helping out.
Perhaps with your help we can be more than a few, and make Mesquite better.
Mesquite is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY.
Mesquite's web site is http://mesquiteproject.org
This source code and its compiled class files are free and modifiable under the terms of
GNU Lesser General Public License. (http://www.gnu.org/copyleft/lesser.html)
*/
package mesquite.lib;
import java.util.*;
import java.io.*;
import org.dom4j.*;
import org.dom4j.io.*;
public class XMLUtil {
/*.................................................................................................................*/
public static Element addFilledElement(Element containingElement, String name, String content) {
if (content == null || name == null)
return null;
Element element = DocumentHelper.createElement(name);
element.addText(content);
containingElement.add(element);
return element;
}
/*.................................................................................................................*/
public static Element addFilledElement(Element containingElement, String name, CDATA cdata) {
if (cdata == null || name == null)
return null;
Element element = DocumentHelper.createElement(name);
element.add(cdata);
containingElement.add(element);
return element;
}
public static String getTextFromElement(Element containingElement, String name){
Element e = containingElement.element(name);
if (e == null)
return null;
else return e.getText();
}
/*.................................................................................................................*/
public static String getDocumentAsXMLString(Document doc, boolean escapeText)
{
try {
String encoding = doc.getXMLEncoding();
if (encoding == null)
encoding = "UTF-8";
Writer osw = new StringWriter();
OutputFormat opf = new OutputFormat(" ", true, encoding);
XMLWriter writer = new XMLWriter(osw, opf);
writer.setEscapeText(escapeText);
writer.write(doc);
writer.close();
return osw.toString();
} catch (IOException e) {
MesquiteMessage.warnProgrammer("XML Document could not be returned as string.");
}
return null;
}
/*.................................................................................................................*/
public static String getElementAsXMLString(Element doc, String encoding, boolean escapeText)
{
try {
Writer osw = new StringWriter();
OutputFormat opf = new OutputFormat(" ", true, encoding);
XMLWriter writer = new XMLWriter(osw, opf);
writer.setEscapeText(escapeText);
writer.write(doc);
writer.close();
return osw.toString();
} catch (IOException e) {
MesquiteMessage.warnProgrammer("XML Document could not be returned as string.");
}
return null;
}
/*.................................................................................................................*/
public static String getDocumentAsXMLString(Document doc) {
return getDocumentAsXMLString(doc,true);
}
/*.................................................................................................................*/
public static String getDocumentAsXMLString2(Document doc)
{
try {
String encoding = doc.getXMLEncoding();
//if (encoding == null)
// encoding = "UTF-8";
Writer osw = new StringWriter();
OutputFormat opf = new OutputFormat(" ", true);
XMLWriter writer = new XMLWriter(osw, opf);
writer.write(doc);
writer.close();
return osw.toString();
} catch (IOException e) {
MesquiteMessage.warnProgrammer("XML Document could not be returned as string.");
}
return null;
}
/*.................................................................................................................*/
public static Document getDocumentFromString(String rootElementName, String contents) {
Document doc = null;
try {
doc = DocumentHelper.parseText(contents);
} catch (Exception e) {
return null;
}
if (doc == null || doc.getRootElement() == null) {
return null;
} else if (!StringUtil.blank(rootElementName) && !doc.getRootElement().getName().equals(rootElementName)) {
return null;
}
return doc;
}
/*.................................................................................................................*/
public static Document getDocumentFromString(String contents) {
return getDocumentFromString("",contents);
}
/*.................................................................................................................*/
public static Element getRootXMLElementFromString(String rootElementName, String contents) {
Document doc = getDocumentFromString(rootElementName, contents);
if (doc==null)
return null;
return doc.getRootElement();
}
/*.................................................................................................................*/
public static Element getRootXMLElementFromString(String contents) {
return getRootXMLElementFromString("",contents);
}
/*.................................................................................................................*/
public static Element getRootXMLElementFromURL(String rootElementName, String url) {
SAXReader saxReader = new SAXReader();
Document doc = null;
try {
doc = saxReader.read(url);
} catch (Exception e) {
return null;
}
if (doc == null || doc.getRootElement() == null) {
return null;
} else if (!StringUtil.blank(rootElementName) && !doc.getRootElement().getName().equals(rootElementName)) {
return null;
}
Element root = doc.getRootElement();
return root;
}
/*.................................................................................................................*/
public static Element getRootXMLElementFromURL(String url) {
return getRootXMLElementFromURL("",url);
}
/*.................................................................................................................*/
public static void readXMLPreferences(MesquiteModule module, XMLPreferencesProcessor xmlPrefProcessor, String contents) {
Element root = getRootXMLElementFromString("mesquite",contents);
if (root==null)
return;
Element element = root.element(module.getXMLModuleName());
if (element != null) {
Element versionElement = element.element("version");
if (versionElement == null)
return ;
else {
int version = MesquiteInteger.fromString(element.elementText("version"));
boolean acceptableVersion = (module.getXMLPrefsVersion()==version || !module.xmlPrefsVersionMustMatch());
if (acceptableVersion)
processPreferencesFromXML(xmlPrefProcessor, element);
else
return;
}
}
}
/*.................................................................................................................*/
public static void processPreferencesFromXML ( XMLPreferencesProcessor xmlPrefProcessor, Element element) {
List prefElement = element.elements();
for (Iterator iter = prefElement.iterator(); iter.hasNext();) { // this is going through all of the notices
Element messageElement = (Element) iter.next();
xmlPrefProcessor.processSingleXMLPreference(messageElement.getName(), messageElement.getText());
}
}
}
| MesquiteProject/MesquiteArchive | releases/Mesquite2.7/Mesquite Project/Source/mesquite/lib/XMLUtil.java | Java | lgpl-3.0 | 7,607 |
/*
* XAdES4j - A Java library for generation and verification of XAdES signatures.
* Copyright (C) 2010 Luis Goncalves.
*
* XAdES4j is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or any later version.
*
* XAdES4j 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 XAdES4j. If not, see <http://www.gnu.org/licenses/>.
*/
package xades4j.xml.marshalling;
import java.util.EnumMap;
import java.util.List;
import xades4j.properties.IdentifierType;
import xades4j.properties.ObjectIdentifier;
import xades4j.properties.data.BaseCertRefsData;
import xades4j.properties.data.CertRef;
import xades4j.xml.bind.xades.XmlCertIDListType;
import xades4j.xml.bind.xades.XmlCertIDType;
import xades4j.xml.bind.xades.XmlDigestAlgAndValueType;
import xades4j.xml.bind.xades.XmlIdentifierType;
import xades4j.xml.bind.xades.XmlObjectIdentifierType;
import xades4j.xml.bind.xades.XmlQualifierType;
import xades4j.xml.bind.xmldsig.XmlDigestMethodType;
import xades4j.xml.bind.xmldsig.XmlX509IssuerSerialType;
/**
* @author Luís
*/
class ToXmlUtils
{
ToXmlUtils()
{
}
private static final EnumMap<IdentifierType, XmlQualifierType> identifierTypeConv;
static
{
identifierTypeConv = new EnumMap(IdentifierType.class);
identifierTypeConv.put(IdentifierType.OIDAsURI, XmlQualifierType.OID_AS_URI);
identifierTypeConv.put(IdentifierType.OIDAsURN, XmlQualifierType.OID_AS_URN);
}
static XmlObjectIdentifierType getXmlObjectId(ObjectIdentifier objId)
{
XmlObjectIdentifierType xmlObjId = new XmlObjectIdentifierType();
// Object identifier
XmlIdentifierType xmlId = new XmlIdentifierType();
xmlId.setValue(objId.getIdentifier());
// If it is IdentifierType.URI the converter returns null, which is the
// same as not specifying a qualifier.
xmlId.setQualifier(identifierTypeConv.get(objId.getIdentifierType()));
xmlObjId.setIdentifier(xmlId);
return xmlObjId;
}
/**/
static XmlCertIDListType getXmlCertRefList(BaseCertRefsData certRefsData)
{
XmlCertIDListType xmlCertRefListProp = new XmlCertIDListType();
List<XmlCertIDType> xmlCertRefList = xmlCertRefListProp.getCert();
XmlDigestAlgAndValueType certDigest;
XmlDigestMethodType certDigestMethod;
XmlX509IssuerSerialType issuerSerial;
XmlCertIDType certID;
for (CertRef certRef : certRefsData.getCertRefs())
{
certDigestMethod = new XmlDigestMethodType();
certDigestMethod.setAlgorithm(certRef.digestAlgUri);
certDigest = new XmlDigestAlgAndValueType();
certDigest.setDigestMethod(certDigestMethod);
certDigest.setDigestValue(certRef.digestValue);
issuerSerial = new XmlX509IssuerSerialType();
issuerSerial.setX509IssuerName(certRef.issuerDN);
issuerSerial.setX509SerialNumber(certRef.serialNumber);
certID = new XmlCertIDType();
certID.setCertDigest(certDigest);
certID.setIssuerSerial(issuerSerial);
xmlCertRefList.add(certID);
}
return xmlCertRefListProp;
}
}
| entaksi/xades4j | src/main/java/xades4j/xml/marshalling/ToXmlUtils.java | Java | lgpl-3.0 | 3,617 |
/*
* This file is part of RskJ
* Copyright (C) 2017 RSK Labs Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package co.rsk.core;
import com.google.common.primitives.UnsignedBytes;
import org.ethereum.rpc.TypeConverter;
import org.ethereum.util.ByteUtil;
import org.ethereum.vm.DataWord;
import java.util.Arrays;
import java.util.Comparator;
/**
* Immutable representation of an RSK address.
* It is a simple wrapper on the raw byte[].
*
* @author Ariel Mendelzon
*/
public class RskAddress {
/**
* This is the size of an RSK address in bytes.
*/
public static final int LENGTH_IN_BYTES = 20;
private static final RskAddress NULL_ADDRESS = new RskAddress();
/**
* This compares using the lexicographical order of the sender unsigned bytes.
*/
public static final Comparator<RskAddress> LEXICOGRAPHICAL_COMPARATOR = Comparator.comparing(
RskAddress::getBytes,
UnsignedBytes.lexicographicalComparator());
private final byte[] bytes;
/**
* @param address a data word containing an address in the last 20 bytes.
*/
public RskAddress(DataWord address) {
this(address.getLast20Bytes());
}
/**
* @param address the hex-encoded 20 bytes long address, with or without 0x prefix.
*/
public RskAddress(String address) {
this(TypeConverter.stringHexToByteArray(address));
}
/**
* @param bytes the 20 bytes long raw address bytes.
*/
public RskAddress(byte[] bytes) {
if (bytes.length != LENGTH_IN_BYTES) {
throw new RuntimeException(String.format("An RSK address must be %d bytes long", LENGTH_IN_BYTES));
}
this.bytes = bytes;
}
/**
* This instantiates the contract creation address.
*/
private RskAddress() {
this.bytes = new byte[0];
}
/**
* @return the null address, which is the receiver of contract creation transactions.
*/
public static RskAddress nullAddress() {
return NULL_ADDRESS;
}
public byte[] getBytes() {
return bytes;
}
public String toHexString() {
return ByteUtil.toHexString(bytes);
}
@Override
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (other == null || this.getClass() != other.getClass()) {
return false;
}
RskAddress otherSender = (RskAddress) other;
return Arrays.equals(bytes, otherSender.bytes);
}
@Override
public int hashCode() {
return Arrays.hashCode(bytes);
}
/**
* @return a DEBUG representation of the address, mainly used for logging.
*/
@Override
public String toString() {
return toHexString();
}
public String toJsonString() {
if (NULL_ADDRESS.equals(this)) {
return null;
}
return TypeConverter.toUnformattedJsonHex(this.getBytes());
}
}
| rsksmart/rskj | rskj-core/src/main/java/co/rsk/core/RskAddress.java | Java | lgpl-3.0 | 3,619 |
/*
Copyright 2013-2021 Paul Colby
This file is part of QtAws.
QtAws is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QtAws 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 the QtAws. If not, see <http://www.gnu.org/licenses/>.
*/
#include "deleterepositoryresponse.h"
#include "deleterepositoryresponse_p.h"
#include <QDebug>
#include <QNetworkReply>
#include <QXmlStreamReader>
namespace QtAws {
namespace ECRPublic {
/*!
* \class QtAws::ECRPublic::DeleteRepositoryResponse
* \brief The DeleteRepositoryResponse class provides an interace for ECRPublic DeleteRepository responses.
*
* \inmodule QtAwsECRPublic
*
* <fullname>Amazon Elastic Container Registry Public</fullname>
*
* Amazon Elastic Container Registry (Amazon ECR) is a managed container image registry service. Amazon ECR provides both
* public and private registries to host your container images. You can use the familiar Docker CLI, or their preferred
* client, to push, pull, and manage images. Amazon ECR provides a secure, scalable, and reliable registry for your Docker
* or Open Container Initiative (OCI) images. Amazon ECR supports public repositories with this API. For information about
* the Amazon ECR API for private repositories, see <a
* href="https://docs.aws.amazon.com/AmazonECR/latest/APIReference/Welcome.html">Amazon Elastic Container Registry API
*
* \sa ECRPublicClient::deleteRepository
*/
/*!
* Constructs a DeleteRepositoryResponse object for \a reply to \a request, with parent \a parent.
*/
DeleteRepositoryResponse::DeleteRepositoryResponse(
const DeleteRepositoryRequest &request,
QNetworkReply * const reply,
QObject * const parent)
: ECRPublicResponse(new DeleteRepositoryResponsePrivate(this), parent)
{
setRequest(new DeleteRepositoryRequest(request));
setReply(reply);
}
/*!
* \reimp
*/
const DeleteRepositoryRequest * DeleteRepositoryResponse::request() const
{
Q_D(const DeleteRepositoryResponse);
return static_cast<const DeleteRepositoryRequest *>(d->request);
}
/*!
* \reimp
* Parses a successful ECRPublic DeleteRepository \a response.
*/
void DeleteRepositoryResponse::parseSuccess(QIODevice &response)
{
//Q_D(DeleteRepositoryResponse);
QXmlStreamReader xml(&response);
/// @todo
}
/*!
* \class QtAws::ECRPublic::DeleteRepositoryResponsePrivate
* \brief The DeleteRepositoryResponsePrivate class provides private implementation for DeleteRepositoryResponse.
* \internal
*
* \inmodule QtAwsECRPublic
*/
/*!
* Constructs a DeleteRepositoryResponsePrivate object with public implementation \a q.
*/
DeleteRepositoryResponsePrivate::DeleteRepositoryResponsePrivate(
DeleteRepositoryResponse * const q) : ECRPublicResponsePrivate(q)
{
}
/*!
* Parses a ECRPublic DeleteRepository response element from \a xml.
*/
void DeleteRepositoryResponsePrivate::parseDeleteRepositoryResponse(QXmlStreamReader &xml)
{
Q_ASSERT(xml.name() == QLatin1String("DeleteRepositoryResponse"));
Q_UNUSED(xml) ///< @todo
}
} // namespace ECRPublic
} // namespace QtAws
| pcolby/libqtaws | src/ecrpublic/deleterepositoryresponse.cpp | C++ | lgpl-3.0 | 3,571 |
#pragma once
#include <type_traits>
#include <limits>
#include <utility>
namespace sio {
template<typename T>
struct is_bit_enum: public std::false_type {};
template<typename Enum, std::enable_if_t<std::is_enum<Enum>{}, int> = 0>
class bitfield {
public:
using integer = std::underlying_type_t<Enum>;
private:
integer bits;
public:
constexpr bitfield() noexcept: bits(0) {}
constexpr bitfield(Enum bit) noexcept: bits(static_cast<integer>(bit)) {}
explicit constexpr bitfield(integer value) noexcept: bits(value) {}
bitfield &operator|=(bitfield rhs) noexcept {
bits |= rhs.bits;
return *this;
}
bitfield &operator&=(bitfield rhs) noexcept {
bits &= rhs.bits;
return *this;
}
bitfield &operator^=(bitfield rhs) noexcept {
bits ^= rhs.bits;
return *this;
}
constexpr bitfield operator|(bitfield rhs) const noexcept {
return bitfield { bits | rhs.bits };
}
constexpr bitfield operator&(bitfield rhs) const noexcept {
return bitfield { bits & rhs.bits };
}
constexpr bitfield operator^(bitfield rhs) const noexcept {
return bitfield { bits ^ rhs.bits };
}
constexpr bitfield operator~() const noexcept {
return bitfield { ~bits };
}
constexpr operator bool() const noexcept {
return !!bits;
}
constexpr bool operator==(bitfield rhs) const noexcept {
return bits == rhs.bits;
}
constexpr bool operator!=(bitfield rhs) const noexcept {
return bits != rhs.bits;
}
};
template<typename Writer, typename Enum>
void
write(Writer &&w, bitfield<Enum> field) {
bool first = true;
for (int i = std::numeric_limits<typename bitfield<Enum>::integer>::digits-1; i >= 0; --i) {
Enum bit = static_cast<Enum>(1 << i);
if (field & bit) {
if (!first) {
write(std::forward<Writer>(w), " | ");
} else {
first = false;
}
write(std::forward<Writer>(w), bit);
}
}
}
} // namespace sio
template<typename Enum,
std::enable_if_t<sio::is_bit_enum<Enum>{}, int> = 0>
sio::bitfield<Enum> operator|(Enum lhs, sio::bitfield<decltype(lhs)> rhs) {
return rhs | lhs;
}
template<typename Enum,
std::enable_if_t<sio::is_bit_enum<Enum>{}, int> = 0>
sio::bitfield<Enum> operator&(Enum lhs, sio::bitfield<decltype(lhs)> rhs) {
return rhs & lhs;
}
template<typename Enum,
std::enable_if_t<sio::is_bit_enum<Enum>{}, int> = 0>
sio::bitfield<Enum> operator^(Enum lhs, sio::bitfield<decltype(lhs)> rhs) {
return rhs ^ lhs;
}
template<typename Enum,
std::enable_if_t<sio::is_bit_enum<Enum>{}, int> = 0>
sio::bitfield<Enum> operator~(Enum lhs) {
return ~sio::bitfield<Enum>(lhs);
}
| fknorr/sio | include/sio/bitfield.hh | C++ | lgpl-3.0 | 2,838 |
package com.hyenawarrior.oldnorsedictionary.modelview.meaning_panel
import android.app.Activity
import android.view.{View, ViewGroup}
import android.widget.{EditText, TextView}
import com.hyenawarrior.oldnorsedictionary.R
import com.hyenawarrior.oldnorsedictionary.modelview.{ClickListener, DynamicListView, EditTextTypeListener}
import com.hyenawarrior.oldnorsedictionary.new_word.pages.MeaningDef
/**
* Created by HyenaWarrior on 2017.07.22..
*/
class MeaningDefListView(activity: Activity, hostView: ViewGroup)
extends DynamicListView[MeaningDef](hostView, R.layout.meaning_record, activity)
{
private var meanings: Map[View, (String, String, ExampleRecordView)] = Map()
override protected def applyToView(optElem: Option[MeaningDef], meaningRecordView: View): Unit =
{
val elem = optElem getOrElse MeaningDef("", "", Seq())
val btnRemove = meaningRecordView.findViewById[View](R.id.ibRemove)
btnRemove setOnClickListener ClickListener(onRemoveMeaningDef(meaningRecordView))
val etMeaning = meaningRecordView.findViewById[EditText](R.id.et_setmeaning_Desc)
etMeaning.setText(elem.meaning, TextView.BufferType.EDITABLE)
etMeaning addTextChangedListener new EditTextTypeListener(onMeaningChange(meaningRecordView))
val etNote = meaningRecordView.findViewById[EditText](R.id.et_setmeaning_Note)
etNote.setText(elem.note, TextView.BufferType.EDITABLE)
etNote addTextChangedListener new EditTextTypeListener(onNoteChange(meaningRecordView))
val subControlOfHost = meaningRecordView.findViewById[ViewGroup](R.id.tl_setmeaning_Examples)
val exRecHandler = new ExampleRecordView(activity, subControlOfHost)
for(exStr <- elem.examples)
{
exRecHandler add exStr
}
meanings = meanings + ((meaningRecordView, (elem.meaning, elem.note, exRecHandler)))
}
private def onRemoveMeaningDef(meaningRecordView: View)(): Unit =
{
meanings = meanings - meaningRecordView
remove(meaningRecordView)
}
private def onMeaningChange(meaningRecordView: View)(text: String): Unit =
{
val item = meanings(meaningRecordView)
val newEntry = (meaningRecordView, (text, item._2, item._3))
meanings = (meanings - meaningRecordView) + newEntry
}
private def onNoteChange(meaningRecordView: View)(text: String): Unit =
{
val item = meanings(meaningRecordView)
val newEntry = (meaningRecordView, (item._1, text, item._3))
meanings = (meanings - meaningRecordView) + newEntry
}
def fetch(): List[MeaningDef] = meanings.values.map
{
case (meaning, note, exs) => MeaningDef(meaning, note, exs.fetch())
}
.toList
}
| HyenaSoftware/IG-Dictionary | app/src/main/scala/com/hyenawarrior/oldnorsedictionary/modelview/meaning_panel/MeaningDefListView.scala | Scala | lgpl-3.0 | 2,563 |
#include <bits/stdc++.h>
using namespace std;
#define DEBUG // comment this line to pull out print statements
#ifdef DEBUG
// completely copied from http://saadahmad.ca/cc-preprocessor-metaprogramming-2/
const char NEWLINE[] = "\n";
const char TAB[] = "\t";
#define EMPTY()
#define DEFER(...) __VA_ARGS__ EMPTY()
#define DEFER2(...) __VA_ARGS__ DEFER(EMPTY) ()
#define DEFER3(...) __VA_ARGS__ DEFER2(EMPTY) ()
#define EVAL_1(...) __VA_ARGS__
#define EVAL_2(...) EVAL_1(EVAL_1(__VA_ARGS__))
#define EVAL_3(...) EVAL_2(EVAL_2(__VA_ARGS__))
#define EVAL_4(...) EVAL_3(EVAL_3(__VA_ARGS__))
#define EVAL_5(...) EVAL_4(EVAL_4(__VA_ARGS__))
#define EVAL_6(...) EVAL_5(EVAL_5(__VA_ARGS__))
#define EVAL_7(...) EVAL_6(EVAL_6(__VA_ARGS__))
#define EVAL_8(...) EVAL_7(EVAL_7(__VA_ARGS__))
#define EVAL(...) EVAL_8(__VA_ARGS__)
#define NOT_0 EXISTS(1)
#define NOT(x) TRY_EXTRACT_EXISTS ( CAT(NOT_, x), 0 )
#define IS_ENCLOSED(x, ...) TRY_EXTRACT_EXISTS ( IS_ENCLOSED_TEST x, 0 )
#define ENCLOSE_EXPAND(...) EXPANDED, ENCLOSED, (__VA_ARGS__) ) EAT (
#define GET_CAT_EXP(a, b) (a, ENCLOSE_EXPAND b, DEFAULT, b )
#define CAT_WITH_ENCLOSED(a, b) a b
#define CAT_WITH_DEFAULT(a, b) a ## b
#define CAT_WITH(a, _, f, b) CAT_WITH_ ## f (a, b)
#define EVAL_CAT_WITH(...) CAT_WITH __VA_ARGS__
#define CAT(a, b) EVAL_CAT_WITH ( GET_CAT_EXP(a, b) )
#define IF_1(true, ...) true
#define IF_0(true, ...) __VA_ARGS__
#define IF(value) CAT(IF_, value)
#define HEAD(x, ...) x
#define TAIL(x, ...) __VA_ARGS__
#define TEST_LAST EXISTS(1)
#define IS_LIST_EMPTY(...) TRY_EXTRACT_EXISTS( DEFER(HEAD) (__VA_ARGS__ EXISTS(1)) , 0)
#define IS_LIST_NOT_EMPTY(...) NOT(IS_LIST_EMPTY(__VA_ARGS__))
#define DOES_VALUE_EXIST_EXISTS(...) 1
#define DOES_VALUE_EXIST_DOESNT_EXIST 0
#define DOES_VALUE_EXIST(x) CAT(DOES_VALUE_EXIST_, x)
#define TRY_EXTRACT_EXISTS(value, ...) IF ( DOES_VALUE_EXIST(TEST_EXISTS(value)) ) \
( EXTRACT_VALUE(value), __VA_ARGS__ )
#define EXTRACT_VALUE_EXISTS(...) __VA_ARGS__
#define EXTRACT_VALUE(value) CAT(EXTRACT_VALUE_, value)
#define EAT(...)
#define EXPAND_TEST_EXISTS(...) EXPANDED, EXISTS(__VA_ARGS__) ) EAT (
#define GET_TEST_EXISTS_RESULT(x) ( CAT(EXPAND_TEST_, x), DOESNT_EXIST )
#define GET_TEST_EXIST_VALUE_(expansion, existValue) existValue
#define GET_TEST_EXIST_VALUE(x) GET_TEST_EXIST_VALUE_ x
#define TEST_EXISTS(x) GET_TEST_EXIST_VALUE ( GET_TEST_EXISTS_RESULT(x) )
#define ENCLOSE(...) ( __VA_ARGS__ )
#define REM_ENCLOSE_(...) __VA_ARGS__
#define REM_ENCLOSE(...) REM_ENCLOSE_ __VA_ARGS__
#define IF_ENCLOSED_1(true, ...) true
#define IF_ENCLOSED_0(true, ...) __VA_ARGS__
#define IF_ENCLOSED(...) CAT(IF_ENCLOSED_, IS_ENCLOSED(__VA_ARGS__))
#define OPT_REM_ENCLOSE(...) \
IF_ENCLOSED (__VA_ARGS__) ( REM_ENCLOSE(__VA_ARGS__), __VA_ARGS__ )
#define FOR_EACH_INDIRECT() FOR_EACH_NO_EVAL
#define FOR_EACH_NO_EVAL(fVisitor, ...) \
IF ( IS_LIST_NOT_EMPTY( __VA_ARGS__ ) ) \
( \
fVisitor( OPT_REM_ENCLOSE(HEAD(__VA_ARGS__)) ) \
DEFER2 ( FOR_EACH_INDIRECT )() (fVisitor, TAIL(__VA_ARGS__)) \
)
#define FOR_EACH(fVisitor, ...) \
EVAL(FOR_EACH_NO_EVAL(fVisitor, __VA_ARGS__))
#define STRINGIFY(x) #x
#define DUMP_VAR(x) std::cout << STRINGIFY(x) << ": " << x << TAB;
#define debug(...) FOR_EACH(DUMP_VAR, __VA_ARGS__); std::cout << NEWLINE;
#define dbg(block) block
#else
#define debug(...)
#define dbg(block)
#endif
const double EPS = 1E-9;
// --- GEOMETRY ---
// --- points, lines, functions for lines and points, triangles,
// --- circles.
// -- insert geometry.hh here for geometric functions
// --- END GEOMETRY ---
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
#define UN(v) SORT(v),v.erase(unique(v.begin(),v.end()),v.end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for (int i=(a); i < (b); i++)
#define REP(i,n) FOR(i,0,(int)n)
#define CL(a,b) memset(a,b,sizeof(a))
#define CL2d(a,b,x,y) memset(a, b, sizeof(a[0][0])*x*y)
/* global variables */
int W, N;
int l, w;
int i, j, k;
char Ws[20], Ns[20];
int total_area;
char line[100];
//char answers[10000][21];
char answers[100000];
int ans, ansb;
int tlen, clen;
/* global variables */
void dump()
{
// dump data
}
bool getInput()
{
if (feof(stdin)) return false;
return true;
}
void process()
{
// int a = 2, b = 5, c = 3;
// debug(a, b, c); // debugging example
// printf("%d\n", total_area/W);
}
int main()
{
ios_base::sync_with_stdio(false);
char digits[10];
fgets_unlocked(line, 99, stdin);
do
{
for (i = 0; line[i] != '\n'; ++i) {
Ws[i] = line[i];
}
Ws[i] = 0;
for (k = 0; k < i-1; ++k) {
W += Ws[k]-'0';
W *= 10;
}
W += Ws[k]-'0';
fgets_unlocked(line, 99, stdin);
for (j = 0; line[j] != '\n'; ++j) {
Ns[j] = line[j];
}
for (k = 0; k < j-1; ++k) {
N += Ns[k]-'0';
N *= 10;
}
N += Ns[k]-'0';
REP(counter, N) {
l = w = 0;
fgets_unlocked(line, 99, stdin);
for (i = 0; line[i] != ' '; ++i) {
Ws[i] = line[i];
}
Ws[i+1] = 0;
for (k = 0; k < i-1; ++k) {
l += Ws[k]-'0';
l *= 10;
}
l += Ws[k]-'0';
while (line[i] == ' ') {
++i;
}
for (j = 0; line[i] != '\n' && line[i] != 0; ++i, ++j) {
Ns[j] = line[i];
}
Ns[j+1] = 0;
for (k = 0; k < j-1; ++k) {
w += Ns[k]-'0';
w *= 10;
}
w += Ns[k]-'0';
total_area += l*w;
}
ans = total_area/W, ansb = ans;
digits[9] = '\n';
clen = 9;
while (ans != 0) {
digits[--clen] = (ans%10)+'0';
ans /= 10;
}
memcpy(&answers[tlen], &digits[clen], 10-clen);
tlen += 10-clen;
/* CLEAR GLOBAL VARIABLES! */
total_area = 0;
W = 0;
N = 0;
l = 0;
w = 0;
/* CLEAR GLOBAL VARIABLES! */
fgets_unlocked(line, 99, stdin);
} while (!feof_unlocked(stdin));
fwrite_unlocked(&answers, sizeof(char), tlen, stdout);
return 0;
}
| mgavin/acm-code | uva/code/13287_cake.cc | C++ | lgpl-3.0 | 5,774 |
XCC = xmpcc
XRUN = mpiexec
TESTS = $(wildcard *.c)
EXES = $(TESTS:.c=.x)
OBJS = $(TESTS:.c=.o)
.PHONY: clean all default run submit showlog cleanlog
all default: $(EXES)
.SUFFIXES: .x
.c.x:
$(XCC) -o $@ $<
run:
$(XRUN) -n 1 ./coarray_translation.x
$(XRUN) -n 2 ./coarray_scalar.x
$(XRUN) -n 2 ./coarray_vector.x
$(XRUN) -n 2 ./coarray_stride.x
$(XRUN) -n 2 ./coarray_scalar_mput.x
$(XRUN) -n 2 ./coarray_scalar_mget.x
$(XRUN) -n 2 ./coarray_scalar_mget_2.x
$(XRUN) -n 2 ./coarray_put_1dim.x
$(XRUN) -n 2 ./coarray_put_2dims.x
$(XRUN) -n 2 ./coarray_put_3dims.x
$(XRUN) -n 2 ./coarray_put_4dims.x
$(XRUN) -n 2 ./coarray_get_1dim.x
$(XRUN) -n 2 ./coarray_get_2dims.x
$(XRUN) -n 2 ./coarray_get_3dims.x
$(XRUN) -n 2 ./coarray_get_4dims.x
$(XRUN) -n 1 ./coarray_local_put.x
$(XRUN) -n 1 ./coarray_local_get.x
RUN:
mkdir RUN
RUN/%.x:: %.x
cp $< $@
RUN/go.sh: go.template Makefile
cp $< $@ && grep XRUN Makefile | sed -e 's/(XRUN)/{XRUN}/' -e 's/ *= */=/' | grep -v Makefile >>$@
submit: all RUN RUN/go.sh $(EXES:%=RUN/%)
cd RUN; pjsub go.sh
showlog:
cat RUN/go.sh.e* RUN/go.sh.o*
cleanlog:
rm -rf RUN
clean: cleanlog
rm -f $(EXES) $(OBJS)
| MeteoSwiss-APN/omni-compiler | tests/xcalablemp/local-view/coarray/C/Makefile | Makefile | lgpl-3.0 | 1,182 |
# -*- coding: utf-8 -*-
"""
This module put my utility functions
"""
__author__ = "Jiang Yu-Kuan <[email protected]>"
__date__ = "2016/02/08 (initial version) ~ 2019/04/17 (last revision)"
import re
import os
import sys
#------------------------------------------------------------------------------
# File
#------------------------------------------------------------------------------
def save_utf8_file(fn, lines):
"""Save string lines into an UTF8 text files.
"""
with open(fn, "w") as out_file:
out_file.write("\n".join(lines).encode("utf-8"))
def main_basename(path):
r"""Return a main name of a basename of a given file path.
Example
-------
>>> main_basename('c:\code\langconv\MsgID.h')
'MsgID.h'
"""
base = os.path.basename(path)
base_main, _base_ext = os.path.splitext(base)
return base_main
#------------------------------------------------------------------------------
# Math
#------------------------------------------------------------------------------
def is_numeric(str):
try:
_offset = int(eval(str))
except:
return False
return True
#------------------------------------------------------------------------------
# String
#------------------------------------------------------------------------------
def replace_chars(text, replaced_pairs='', deleted_chars=''):
"""Return a char replaced text.
Arguments
---------
text -- the text
replaced_pairs -- the replaced chars
Example
-------
>>> replaced = [('a','b'), ('c','d')]
>>> removed = 'e'
>>> replace_chars('abcde', replaced, removed)
'bbdd'
"""
for old, new in replaced_pairs:
text = text.replace(old, new)
for ch in deleted_chars:
text = text.replace(ch, '')
return text
def camel_case(string):
"""Return camel case string from a space-separated string.
Example
-------
>>> camel_case('good job')
'GoodJob'
"""
return ''.join(w.capitalize() for w in string.split())
def replace_punctuations(text):
"""Replace punctuation characters with abbreviations for a string.
"""
punctuations = [
('?', 'Q'), # Q: question mark
('.', 'P'), # P: period; full stop
('!', 'E'), # E: exclamation mark
("'", 'SQ'), # SQ: single quotation mark; single quote
('"', 'DQ'), # DQ: double quotation mark; double quotes
('(', 'LP'), # LP: left parenthese
(')', 'RP'), # RP: right parenthese
(':', 'Cn'), # Cn: colon
(',', 'Ca'), # Ca: comma
(';', 'S'), # S: semicolon
]
deleted = '+-*/^=%$#@|\\<>{}[]'
return replace_chars(text, punctuations, deleted)
def remain_alnum(text):
"""Remain digits and English letters of a string.
"""
return ''.join(c for c in text if c.isalnum()
and ord(' ') <= ord(c) <= ord('z'))
#------------------------------------------------------------------------------
# For code generation
#------------------------------------------------------------------------------
def c_identifier(text):
"""Convert input text into an legal identifier in C.
Example
-------
>>> c_identifier("Hello World")
'HelloWorld'
>>> c_identifier("Anti-Shake")
'Antishake'
"""
if ' ' in text:
text = camel_case(text)
text = re.sub(r'\+\d+', lambda x: x.group().replace('+', 'P'), text)
text = re.sub(r'\-\d+', lambda x: x.group().replace('-', 'N'), text)
text = replace_punctuations(text)
return remain_alnum(text)
def wrap_header_guard(lines, h_fn):
"""Wrap a C header guard for a given line list.
"""
def underscore(txt):
"""Return an under_scores text from a CamelCase text.
This function will leave a CamelCase text unchanged.
"""
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', txt)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
h_fn_sig = '%s_H_' % underscore(main_basename(h_fn)).upper()
begin = ['#ifndef %s' % h_fn_sig]
begin += ['#define %s' % h_fn_sig, '', '']
end = ['', '', '#endif // %s' % h_fn_sig, '']
return begin + lines + end
def prefix_info(lines, software, version, author, comment_mark='//'):
"""Prefix information to the given lines with given comment-mark.
"""
prefix = ['%s Generated by the %s v%s' % (comment_mark,
software, version)]
prefix += ['%s !author: %s' % (comment_mark, author)]
prefix += ['%s !trail: %s %s' % (comment_mark,
os.path.basename(sys.argv[0]), ' '.join(sys.argv[1:]))]
return prefix + lines
| YorkJong/pyResourceLink | reslnk/myutil.py | Python | lgpl-3.0 | 4,850 |
/**
\file millionaire_prob.cpp
\author [email protected]
\copyright ABY - A Framework for Efficient Mixed-protocol Secure Two-party Computation
Copyright (C) 2019 Engineering Cryptographic Protocols Group, TU Darmstadt
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
ABY is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
\brief Implementation of the millionaire problem using ABY Framework.
*/
#include "millionaire_prob.h"
#include "../../../abycore/circuit/booleancircuits.h"
#include "../../../abycore/sharing/sharing.h"
int32_t test_millionaire_prob_circuit(e_role role, const std::string& address, uint16_t port, seclvl seclvl,
uint32_t bitlen, uint32_t nthreads, e_mt_gen_alg mt_alg, e_sharing sharing) {
/**
Step 1: Create the ABYParty object which defines the basis of all the
operations which are happening. Operations performed are on the
basis of the role played by this object.
*/
ABYParty* party = new ABYParty(role, address, port, seclvl, bitlen, nthreads,
mt_alg);
/**
Step 2: Get to know all the sharing types available in the program.
*/
std::vector<Sharing*>& sharings = party->GetSharings();
/**
Step 3: Create the circuit object on the basis of the sharing type
being inputed.
*/
Circuit* circ = sharings[sharing]->GetCircuitBuildRoutine();
/**
Step 4: Creating the share objects - s_alice_money, s_bob_money which
is used as input to the computation function. Also s_out
which stores the output.
*/
share *s_alice_money, *s_bob_money, *s_out;
/**
Step 5: Initialize Alice's and Bob's money with random values.
Both parties use the same seed, to be able to verify the
result. In a real example each party would only supply
one input value.
*/
uint32_t alice_money, bob_money, output;
srand(time(NULL));
alice_money = rand();
bob_money = rand();
/**
Step 6: Copy the randomly generated money into the respective
share objects using the circuit object method PutINGate()
for my inputs and PutDummyINGate() for the other parties input.
Also mention who is sharing the object.
*/
//s_alice_money = circ->PutINGate(alice_money, bitlen, CLIENT);
//s_bob_money = circ->PutINGate(bob_money, bitlen, SERVER);
if(role == SERVER) {
s_alice_money = circ->PutDummyINGate(bitlen);
s_bob_money = circ->PutINGate(bob_money, bitlen, SERVER);
} else { //role == CLIENT
s_alice_money = circ->PutINGate(alice_money, bitlen, CLIENT);
s_bob_money = circ->PutDummyINGate(bitlen);
}
/**
Step 7: Call the build method for building the circuit for the
problem by passing the shared objects and circuit object.
Don't forget to type cast the circuit object to type of share
*/
s_out = BuildMillionaireProbCircuit(s_alice_money, s_bob_money,
(BooleanCircuit*) circ);
/**
Step 8: Modify the output receiver based on the role played by
the server and the client. This step writes the output to the
shared output object based on the role.
*/
s_out = circ->PutOUTGate(s_out, ALL);
/**
Step 9: Executing the circuit using the ABYParty object evaluate the
problem.
*/
party->ExecCircuit();
/**
Step 10:Type casting the value to 32 bit unsigned integer for output.
*/
output = s_out->get_clear_value<uint32_t>();
std::cout << "Testing Millionaire's Problem in " << get_sharing_name(sharing)
<< " sharing: " << std::endl;
std::cout << "\nAlice Money:\t" << alice_money;
std::cout << "\nBob Money:\t" << bob_money;
std::cout << "\nCircuit Result:\t" << (output ? ALICE : BOB);
std::cout << "\nVerify Result: \t" << ((alice_money > bob_money) ? ALICE : BOB)
<< "\n";
delete party;
return 0;
}
share* BuildMillionaireProbCircuit(share *s_alice, share *s_bob,
BooleanCircuit *bc) {
share* out;
/** Calling the greater than equal function in the Boolean circuit class.*/
out = bc->PutGTGate(s_alice, s_bob);
return out;
}
| encryptogroup/ABY | src/examples/millionaire_prob/common/millionaire_prob.cpp | C++ | lgpl-3.0 | 4,536 |
<?php
/*
dvdetect DVD detection, analysis & DVDETECT lookup library
Copyright (C) 2013-2015 Norbert Schlia <[email protected]>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU LESSER GENERAL PUBLIC LICENSE for more details.
You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*! \file functions.search.inc.php
*
* \brief PHP function collection
*/
function addVideoStream($mysqli, $tagDVDVIDEOSTREAM, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDVIDEOSTREAM->attributes();
$Type = value_or_null($attributes["Type"]);
$ID = value_or_null($attributes["ID"]);
$VideoCodingMode = value_or_null($attributes["VideoCodingMode"]);
$VideoStandard = value_or_null($attributes["VideoStandard"]);
$VideoAspect = value_or_null($attributes["VideoAspect"]);
$AutomaticPanScanDisallowed = value_or_null($attributes["AutomaticPanScanDisallowed"]);
$CCForLine21Field1InGOP = value_or_null($attributes["CCForLine21Field1InGOP"]);
$CCForLine21Field2InGOP = value_or_null($attributes["CCForLine21Field2InGOP"]);
$CBR = value_or_null($attributes["CBR"]);
$Resolution = value_or_null($attributes["Resolution"]);
$LetterBoxed = value_or_null($attributes["LetterBoxed"]);
$SourceFilm = value_or_null($attributes["SourceFilm"]);
if ($idDVDVTS == null)
{
$Type = "VMG";
}
$strSQL = "INSERT INTO DVDVIDEOSTREAM (DVDVMGMKey, DVDVTSKey, Type, ID, VideoCodingMode, VideoStandard, VideoAspect, AutomaticPanScanDisallowed, CCForLine21Field1InGOP, CCForLine21Field2InGOP, CBR, Resolution, LetterBoxed, SourceFilm) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iisisssiiiisii", $idDVDVMGM, $idDVDVTS, $Type, $ID, $VideoCodingMode, $VideoStandard, $VideoAspect, $AutomaticPanScanDisallowed, $CCForLine21Field1InGOP, $CCForLine21Field2InGOP, $CBR, $Resolution, $LetterBoxed, $SourceFilm))
{
$ResponseText = "Error binding parameters for DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function updateVideoStream($mysqli, $tagDVDVIDEOSTREAM, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDVIDEOSTREAM->attributes();
$Type = value_or_null($attributes["Type"]);
$ID = value_or_null($attributes["ID"]);
$VideoCodingMode = value_or_null($attributes["VideoCodingMode"]);
$VideoStandard = value_or_null($attributes["VideoStandard"]);
$VideoAspect = value_or_null($attributes["VideoAspect"]);
$AutomaticPanScanDisallowed = value_or_null($attributes["AutomaticPanScanDisallowed"]);
$CCForLine21Field1InGOP = value_or_null($attributes["CCForLine21Field1InGOP"]);
$CCForLine21Field2InGOP = value_or_null($attributes["CCForLine21Field2InGOP"]);
$CBR = value_or_null($attributes["CBR"]);
$Resolution = value_or_null($attributes["Resolution"]);
$LetterBoxed = value_or_null($attributes["LetterBoxed"]);
$SourceFilm = value_or_null($attributes["SourceFilm"]);
if ($idDVDVMGM == null)
{
$Type = "VMG";
}
$strSQL = "UPDATE DVDVIDEOSTREAM SET ID = ?, VideoCodingMode = ?, VideoStandard = ?, VideoAspect = ?, AutomaticPanScanDisallowed = ?, CCForLine21Field1InGOP = ?, CCForLine21Field2InGOP = ?, CBR = ?, Resolution = ?, LetterBoxed = ?, SourceFilm = ? ";
if ($idDVDVMGM != null)
{
$strSQL .= "WHERE DVDVMGMKey = ? AND DVDVTSKey IS NULL AND Type = ?;";
}
else
{
$strSQL .= "WHERE DVDVMGMKey IS NULL AND DVDVTSKey = ? AND Type = ?;";
}
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing update statement for DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if ($idDVDVMGM != null)
{
if (!$stmt->bind_param("isssiiiisiiis", $ID, $VideoCodingMode, $VideoStandard, $VideoAspect, $AutomaticPanScanDisallowed, $CCForLine21Field1InGOP, $CCForLine21Field2InGOP, $CBR, $Resolution, $LetterBoxed, $SourceFilm, $idDVDVMGM, $Type))
{
$ResponseText = "Error binding parameters for DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
else
{
if (!$stmt->bind_param("isssiiiisiiis", $ID, $VideoCodingMode, $VideoStandard, $VideoAspect, $AutomaticPanScanDisallowed, $CCForLine21Field1InGOP, $CCForLine21Field2InGOP, $CBR, $Resolution, $LetterBoxed, $SourceFilm, $idDVDVTS, $Type))
{
$ResponseText = "Error binding parameters for DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDVIDEOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function addAudioStream($mysqli, $tagDVDAUDIOSTREAM, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDAUDIOSTREAM->attributes();
$Number = value_or_null($attributes["Number"]);
$Type = value_or_null($attributes["Type"]);
$ID = value_or_null($attributes["ID"]);
$Channels = value_or_null($attributes["Channels"]);
$SampleRate = value_or_null($attributes["SampleRate"]);
$Quantisation = value_or_null($attributes["Quantisation"]);
$MultichannelExtPresent = value_or_null($attributes["MultichannelExtPresent"]);
$CodingMode = value_or_null($attributes["CodingMode"]);
if ($idDVDVTS == null)
{
$Type = "VMG";
}
$strSQL = "INSERT INTO DVDAUDIOSTREAM (DVDVMGMKey, DVDVTSKey, Number, Type, ID, SampleRate, Channels, Quantisation, CodingMode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiisiiiss", $idDVDVMGM, $idDVDVTS, $Number, $Type, $ID, $SampleRate, $Channels, $Quantisation, $CodingMode))
{
$ResponseText = "Error binding parameters for DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function updateAudioStream($mysqli, $tagDVDAUDIOSTREAM, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDAUDIOSTREAM->attributes();
$Number = value_or_null($attributes["Number"]);
$Type = value_or_null($attributes["Type"]);
$ID = value_or_null($attributes["ID"]);
$Channels = value_or_null($attributes["Channels"]);
$SampleRate = value_or_null($attributes["SampleRate"]);
$Quantisation = value_or_null($attributes["Quantisation"]);
$MultichannelExtPresent = value_or_null($attributes["MultichannelExtPresent"]);
$CodingMode = value_or_null($attributes["CodingMode"]);
if ($idDVDVTS == null)
{
$Type = "VMG";
}
$strSQL = "UPDATE DVDAUDIOSTREAM SET ID = ?, SampleRate = ?, Channels = ?, Quantisation = ?, CodingMode = ? ";
if ($idDVDVMGM != null)
{
$strSQL .= "WHERE DVDVMGMKey = ? AND DVDVTSKey IS NULL AND Number = ? AND Type = ?;";
}
else
{
$strSQL .= "WHERE DVDVMGMKey IS NULL AND DVDVTSKey = ? AND Number = ? AND Type = ?;";
}
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing update statement for DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if ($idDVDVMGM != null)
{
if (!$stmt->bind_param("iiissiis", $ID, $SampleRate, $Channels, $Quantisation, $CodingMode, $idDVDVMGM, $Number, $Type))
{
$ResponseText = "Error binding parameters for DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
else
{
if (!$stmt->bind_param("iiissiis", $ID, $SampleRate, $Channels, $Quantisation, $CodingMode, $idDVDVTS, $Number, $Type))
{
$ResponseText = "Error binding parameters for DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDAUDIOSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function addAudioStreamEx($mysqli, $audiostreamExTag, $idDVDVTS)
{
$attributes = $audiostreamExTag->attributes();
$Number = value_or_null($attributes["Number"]);
$Type = value_or_null($attributes["Type"]);
$SuitableForDolbySurroundDecoding = value_or_null($attributes["SuitableForDolbySurroundDecoding"]);
$KaraokeVersion = value_or_null($attributes["KaraokeVersion"]);
$ApplicationMode = value_or_null($attributes["ApplicationMode"]);
$MCIntroPresent = value_or_null($attributes["MCIntroPresent"]);
$LanguageCodePresent = value_or_null($attributes["LanguageCodePresent"]);
$LanguageCode = value_or_null($attributes["LanguageCode"]);
$CodeExtPresent = value_or_null($attributes["CodeExtPresent"]);
$CodeExt = value_or_null($attributes["CodeExt"]);
if ($idDVDVTS == null)
{
$Type = "VMG";
}
$strSQL = "INSERT INTO DVDAUDIOSTREAMEX (DVDVTSKey, Number, SuitableForDolbySurroundDecoding, KaraokeVersion, ApplicationMode, MCIntroPresent, LanguageCodePresent, LanguageCode, CodeExtPresent, CodeExt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDAUDIOSTREAMEX table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiiisiisii", $idDVDVTS, $Number, $SuitableForDolbySurroundDecoding, $KaraokeVersion, $ApplicationMode, $MCIntroPresent, $LanguageCodePresent, $LanguageCode, $CodeExtPresent, $CodeExt))
{
$ResponseText = "Error binding parameters for DVDAUDIOSTREAMEX table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDAUDIOSTREAMEX table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function updateAudioStreamEx($mysqli, $audiostreamExTag, $idDVDVTS)
{
$attributes = $audiostreamExTag->attributes();
$Number = value_or_null($attributes["Number"]);
$SuitableForDolbySurroundDecoding = value_or_null($attributes["SuitableForDolbySurroundDecoding"]);
$KaraokeVersion = value_or_null($attributes["KaraokeVersion"]);
$ApplicationMode = value_or_null($attributes["ApplicationMode"]);
$MCIntroPresent = value_or_null($attributes["MCIntroPresent"]);
$LanguageCodePresent = value_or_null($attributes["LanguageCodePresent"]);
$LanguageCode = value_or_null($attributes["LanguageCode"]);
$CodeExtPresent = value_or_null($attributes["CodeExtPresent"]);
$CodeExt = value_or_null($attributes["CodeExt"]);
$strSQL = "UPDATE DVDAUDIOSTREAMEX SET SuitableForDolbySurroundDecoding = ?, KaraokeVersion = ?, ApplicationMode = ?, MCIntroPresent = ?, LanguageCodePresent = ?, LanguageCode = ?, CodeExtPresent = ?, CodeExt = ? WHERE DVDVTSKey = ? AND Number = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing update statement for DVDAUDIOSTREAMEX table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("isiisiiiii", $SuitableForDolbySurroundDecoding, $KaraokeVersion, $ApplicationMode, $MCIntroPresent, $LanguageCodePresent, $LanguageCode, $CodeExtPresent, $CodeExt, $idDVDVTS, $Number))
{
$ResponseText = "Error binding parameters for DVDAUDIOSTREAMEX table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDAUDIOSTREAMEX table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function addSubPictureStream($mysqli, $tagDVDSUBPICSTREAM, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDSUBPICSTREAM->attributes();
$Number = value_or_null($attributes["Number"]);
$ID = value_or_null($attributes["ID"]);
$Type = value_or_null($attributes["Type"]);
$CodingMode = value_or_null($attributes["CodingMode"]);
$LanguageCodePresent = value_or_null($attributes["LanguageCodePresent"]);
$LanguageCode = value_or_null($attributes["LanguageCode"]);
$CodeExtPresent = value_or_null($attributes["CodeExtPresent"]);
$CodeExt = value_or_null($attributes["CodeExt"]);
if ($idDVDVTS == null)
{
$Type = "VMG";
}
$strSQL = "INSERT INTO DVDSUBPICSTREAM (DVDVMGMKey, DVDVTSKey, Number, ID, Type, CodingMode, LanguageCodePresent, LanguageCode, CodeExtPresent, CodeExt) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiissiisii", $idDVDVMGM, $idDVDVTS, $Number, $ID, $Type, $CodingMode, $LanguageCodePresent, $LanguageCode, $CodeExtPresent, $CodeExt))
{
$ResponseText = "Error binding parameters for DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function updateSubPictureStream($mysqli, $tagDVDSUBPICSTREAM, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDSUBPICSTREAM->attributes();
$Number = value_or_null($attributes["Number"]);
$ID = value_or_null($attributes["ID"]);
$Type = value_or_null($attributes["Type"]);
$CodingMode = value_or_null($attributes["CodingMode"]);
$LanguageCodePresent = value_or_null($attributes["LanguageCodePresent"]);
$LanguageCode = value_or_null($attributes["LanguageCode"]);
$CodeExtPresent = value_or_null($attributes["CodeExtPresent"]);
$CodeExt = value_or_null($attributes["CodeExt"]);
if ($idDVDVTS == null)
{
$Type = "VMG";
}
$strSQL = "UPDATE DVDSUBPICSTREAM SET ID = ?, CodingMode = ?, LanguageCodePresent = ?, LanguageCode = ?, CodeExtPresent = ?, CodeExt = ? ";
if ($idDVDVMGM != null)
{
$strSQL .= "WHERE DVDVMGMKey = ? AND DVDVTSKey IS NULL AND Number = ? AND Type = ?;";
}
else
{
$strSQL .= "WHERE DVDVMGMKey IS NULL AND DVDVTSKey = ? AND Number = ? AND Type = ?;";
}
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing update statement for DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if ($idDVDVMGM != null)
{
if (!$stmt->bind_param("siisiiiis", $ID, $CodingMode, $LanguageCodePresent, $LanguageCode, $CodeExtPresent, $CodeExt, $idDVDVMGM, $Number, $Type))
{
$ResponseText = "Error binding parameters for DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
else
{
if (!$stmt->bind_param("siisiiiis", $ID, $CodingMode, $LanguageCodePresent, $LanguageCode, $CodeExtPresent, $CodeExt, $idDVDVTS, $Number, $Type))
{
$ResponseText = "Error binding parameters for DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDSUBPICSTREAM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function addFileset($mysqli, $tagDVDFILE, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDFILE->attributes();
$FileSetNo = value_or_null($attributes["Number"]);
$Type = value_or_null($attributes["Type"]);
$VobNo = value_or_null($attributes["VobNo"]);
$Size = value_or_null($attributes["Size"]);
$Date = value_or_null($attributes["Date"]);
$strSQL = "INSERT INTO DVDFILE (DVDVMGMKey, DVDVTSKey, FileSetNo, Type, VobNo, Size, Date) VALUES (?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiisiis", $idDVDVMGM, $idDVDVTS, $FileSetNo, $Type, $VobNo, $Size, $Date))
{
$ResponseText = "Error binding parameters for DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function updateFileset($mysqli, $tagDVDFILE, $idDVDVMGM, $idDVDVTS)
{
$attributes = $tagDVDFILE->attributes();
$FileSetNo = value_or_null($attributes["Number"]);
$Type = value_or_null($attributes["Type"]);
$VobNo = value_or_null($attributes["VobNo"]);
$Size = value_or_null($attributes["Size"]);
$Date = value_or_null($attributes["Date"]);
$strSQL = "UPDATE `DVDFILE` SET `Type` = ?, `VobNo` = ?, `Size` = ?, `Date` = ? ";
if ($idDVDVMGM != null)
{
$strSQL .= "WHERE DVDVMGMKey = ? AND DVDVTSKey IS NULL AND FileSetNo = ?;";
}
else
{
$strSQL .= "WHERE DVDVMGMKey IS NULL AND DVDVTSKey = ? AND FileSetNo = ?;";
}
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if ($idDVDVMGM != null)
{
if (!$stmt->bind_param("siisii", $Type, $VobNo, $Size, $Date, $idDVDVMGM, $FileSetNo))
{
$ResponseText = "Error binding parameters for DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
else
{
if (!$stmt->bind_param("siisii", $Type, $VobNo, $Size, $Date, $idDVDVTS, $FileSetNo))
{
$ResponseText = "Error binding parameters for DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDFILE table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
}
function submit($mysqli, $xml, $XmlVersion)
{
/*
query_server($mysqli, "TRUNCATE TABLE `DVDAUDIOSTREAM`;");
query_server($mysqli, "TRUNCATE TABLE `DVDAUDIOSTREAMEX`;");
query_server($mysqli, "TRUNCATE TABLE `DVDSUBPICSTREAM`;");
query_server($mysqli, "TRUNCATE TABLE `DVDVIDEOSTREAM`;");
query_server($mysqli, "TRUNCATE TABLE `DVDFILE`;");
query_server($mysqli, "TRUNCATE TABLE `DVDPTTVMG`;");
query_server($mysqli, "TRUNCATE TABLE `DVDPTTVTS`;");
query_server($mysqli, "TRUNCATE TABLE `DVDUNIT`;");
query_server($mysqli, "TRUNCATE TABLE `DVDCELL`;");
query_server($mysqli, "TRUNCATE TABLE `DVDPROGRAM`;");
query_server($mysqli, "TRUNCATE TABLE `DVDPGC`;");
query_server($mysqli, "TRUNCATE TABLE `DVDVTS`;");
query_server($mysqli, "TRUNCATE TABLE `DVDVMGM`;");
*/
// Start a transaction
query_server($mysqli, "START TRANSACTION;");
foreach ($xml->DVD as $tagDVDVMGM)
{
$attributes = $tagDVDVMGM->attributes();
$Hash = value_or_null($attributes["Hash"]);
$SubmitterIP = value_or_null($_SERVER['REMOTE_ADDR']);
$Album = value_or_null($tagDVDVMGM->Album);
$OriginalAlbum = value_or_null($tagDVDVMGM->OriginalAlbum);
$AlbumArtist = value_or_null($tagDVDVMGM->AlbumArtist);
$Genre = value_or_null($tagDVDVMGM->Genre);
$Cast = value_or_null($tagDVDVMGM->Cast);
$Crew = value_or_null($tagDVDVMGM->Crew);
$Director = value_or_null($tagDVDVMGM->Director);
$Screenplay = value_or_null($tagDVDVMGM->Screenplay);
$Producer = value_or_null($tagDVDVMGM->Producer);
$Editing = value_or_null($tagDVDVMGM->Editing);
$Cinematography = value_or_null($tagDVDVMGM->Cinematography);
$Country = value_or_null($tagDVDVMGM->Country);
$OriginalLanguage = value_or_null($tagDVDVMGM->OriginalLanguage);
$ReleaseDate = date_or_null($tagDVDVMGM->ReleaseDate);
$SpecialFeatures = value_or_null($tagDVDVMGM->SpecialFeatures);
$EAN_UPC = value_or_null($tagDVDVMGM->EAN_UPC);
$Storyline = value_or_null($tagDVDVMGM->Storyline);
$Submitter = value_or_null($tagDVDVMGM->Submitter);
$Client = value_or_null($tagDVDVMGM->Client);
$Remarks = value_or_null($tagDVDVMGM->Remarks);
$Keywords = value_or_null($tagDVDVMGM->Keywords);
$RegionProhibited1 = value_or_null($attributes["RegionProhibited1"]);
$RegionProhibited2 = value_or_null($attributes["RegionProhibited2"]);
$RegionProhibited3 = value_or_null($attributes["RegionProhibited3"]);
$RegionProhibited4 = value_or_null($attributes["RegionProhibited4"]);
$RegionProhibited5 = value_or_null($attributes["RegionProhibited5"]);
$RegionProhibited6 = value_or_null($attributes["RegionProhibited6"]);
$RegionProhibited7 = value_or_null($attributes["RegionProhibited7"]);
$RegionProhibited8 = value_or_null($attributes["RegionProhibited8"]);
$VersionNumberMajor = value_or_null($attributes["VersionNumberMajor"]);
$VersionNumberMinor = value_or_null($attributes["VersionNumberMinor"]);
$NumberOfVolumes = value_or_null($attributes["NumberOfVolumes"]);
$VolumeNumber = value_or_null($attributes["VolumeNumber"]);
$SideID = value_or_null($attributes["SideID"]);
if ($Submitter == DEFSUBMITTER)
{
$Submitter = null;
}
// Check if dataset exists
$found = FALSE;
/* Feature #884: deactivated unstable feature for rev 0.40
$strSQL = "SELECT `idDVDVMGM`, `RowLastChanged`, `RowCreationDate`, `Submitter`, `SubmitterIP` FROM `DVDVMGM` ".
"WHERE `Hash` = '" . $Hash . "' AND `Active` = 1 " .
"ORDER BY `Revision` DESC;";
$rsDVDVMGM = query_server($mysqli, $strSQL);
if (is_array($Cols = $rsDVDVMGM->fetch_row()))
{
$idDVDVMGM = $Cols[0];
$RowLastChanged = $Cols[1];
$RowCreationDate = $Cols[2];
$LastSubmitter = $Cols[3];
$LastSubmitterIP = $Cols[4];
// TODO: maybe check submission time
if ($Submitter == $LastSubmitter && $SubmitterIP == $LastSubmitterIP)
{
$found = TRUE;
}
}
$rsDVDVMGM->close();
*/
if (!$found)
{
// Not found: insert new
$strSQL = "INSERT INTO `DVDVMGM` (`Hash`, `Album`, `AlbumArtist`, `Genre`, `Cast`, `Crew`, `Director`, `Country`, `ReleaseDate`, `SpecialFeatures`, `EAN_UPC`, `Storyline`, `Remarks`, `Submitter`, `SubmitterIP`, `Client`, `Keywords`, `RegionProhibited1`, `RegionProhibited2`, `RegionProhibited3`, `RegionProhibited4`, `RegionProhibited5`, `RegionProhibited6`, `RegionProhibited7`, `RegionProhibited8`, `VersionNumberMajor`, `VersionNumberMinor`, `NumberOfVolumes`, `VolumeNumber`, `SideID`, `OriginalAlbum`, `Screenplay`, `Producer`, `Editing`, `Cinematography`, `OriginalLanguage`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDVMGM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("sssssssssssssssssiiiiiiiiiiiiissssss", $Hash, $Album, $AlbumArtist, $Genre, $Cast, $Crew, $Director, $Country, $ReleaseDate, $SpecialFeatures, $EAN_UPC, $Storyline, $Remarks, $Submitter, $SubmitterIP, $Client, $Keywords, $RegionProhibited1, $RegionProhibited2, $RegionProhibited3, $RegionProhibited4, $RegionProhibited5, $RegionProhibited6, $RegionProhibited7, $RegionProhibited8, $VersionNumberMajor, $VersionNumberMinor, $NumberOfVolumes, $VolumeNumber, $SideID, $OriginalAlbum, $Screenplay, $Producer, $Editing, $Cinematography, $OriginalLanguage))
{
$ResponseText = "Error binding parameters for DVDVMGM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
$stmt = null;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDVMGM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
$stmt = null;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$idDVDVMGM = $mysqli->insert_id;
$stmt->close();
$stmt = null;
// Physical structure
$tagPhysical = $tagDVDVMGM->physical;
foreach ($tagPhysical->DVDVTS as $tagDVDVTS)
{
// Insert DVDVTS (Video Title Set)
$attributes = $tagDVDVTS->attributes();
$TitleSetNo = $attributes["TitleSetNo"];
$VersionNumberMajor = value_or_null($attributes["VersionNumberMajor"]);
$VersionNumberMinor = value_or_null($attributes["VersionNumberMinor"]);
$strSQL = "INSERT INTO `DVDVTS` (`DVDVMGMKey`, `TitleSetNo`, `VersionNumberMajor`, `VersionNumberMinor`) VALUES (?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiii", $idDVDVMGM, $TitleSetNo, $VersionNumberMajor, $VersionNumberMinor))
{
$ResponseText = "Error binding parameters for DVDVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$idDVDVTS = $mysqli->insert_id;
$stmt->close();
foreach ($tagDVDVTS->DVDPGC as $tagDVDPGC)
{
// Insert DVDPGC (Program Chain)
$attributes = $tagDVDPGC->attributes();
$ProgramChainNo = value_or_null($attributes["Number"]);
$EntryPGC = value_or_null($attributes["EntryPGC"]);
$strSQL = "INSERT INTO `DVDPGC` (`DVDVTSKey`, `ProgramChainNo`, `EntryPGC`) VALUES (?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDPGC table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iii", $idDVDVTS, $ProgramChainNo, $EntryPGC))
{
$ResponseText = "Error binding parameters for DVDPGC table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDPGC table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$idDVDPGC = $mysqli->insert_id;
$stmt->close();
foreach ($tagDVDPGC->DVDPROGRAM as $tagDVDPROGRAM)
{
// Insert DVDPGC (Program)
$attributes = $tagDVDPROGRAM->attributes();
$ProgramNo = value_or_null($attributes["Number"]);
$strSQL = "INSERT INTO `DVDPROGRAM` (`DVDPGCKey`, `ProgramNo`) VALUES (?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for chapter table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("ii", $idDVDPGC, $ProgramNo))
{
$ResponseText = "Error binding parameters for chapter table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on chapter table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$idDVDPROGRAM = $mysqli->insert_id;
$stmt->close();
foreach ($tagDVDPROGRAM->DVDCELL as $tagDVDCELL)
{
// Insert DVDCELL (Cell)
$attributes = $tagDVDCELL->attributes();
$CellNo = value_or_null($attributes["Number"]);
$CellType = value_or_null($attributes["CellType"]);
$BlockType = value_or_null($attributes["BlockType"]);
$SeamlessMultiplex = value_or_null($attributes["SeamlessMultiplex"]);
$Interleaved = value_or_null($attributes["Interleaved"]);
$SCRdiscontinuity = value_or_null($attributes["SCRdiscontinuity"]);
$SeamlessAngleLinkedInDSI = value_or_null($attributes["SeamlessAngleLinkedInDSI"]);
$VOBStillMode = value_or_null($attributes["VOBStillMode"]);
$StopsTrickPlay = value_or_null($attributes["StopsTrickPlay"]);
$CellStillTime = value_or_null($attributes["CellStillTime"]);
$CellCommand = value_or_null($attributes["CellCommand"]);
$PlayTime = value_or_null($attributes["PlayTime"]);
$FrameRate = value_or_null($attributes["FrameRate"]);
$FirstVOBUStartSector = value_or_null($attributes["FirstVOBUStartSector"]);
$FirstILVUEndSector = value_or_null($attributes["FirstILVUEndSector"]);
$LastVOBUStartSector = value_or_null($attributes["LastVOBUStartSector"]);
$LastVOBUEndSector = value_or_null($attributes["LastVOBUEndSector"]);
$VOBidn = value_or_null($attributes["VOBidn"]);
$CELLidn = value_or_null($attributes["CELLidn"]);
$NumberOfVOBIds = value_or_null($attributes["NumberOfVOBIds"]);
$strSQL = "INSERT INTO `DVDCELL` (`DVDPROGRAMKey`, `CellNo`, `CellType`, `BlockType`, `SeamlessMultiplex`, `Interleaved`, `SCRdiscontinuity`, `SeamlessAngleLinkedInDSI`, `VOBStillMode`, `StopsTrickPlay`, `CellStillTime`, `CellCommand`, `PlayTime`, `FrameRate`, `FirstVOBUStartSector`, `FirstILVUEndSector`, `LastVOBUStartSector`, `LastVOBUEndSector`, `VOBidn`, `CELLidn`, `NumberOfVOBIds`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDCELL table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iissiiiiiiiiiiiiiiiii", $idDVDPROGRAM, $CellNo, $CellType, $BlockType, $SeamlessMultiplex, $Interleaved, $SCRdiscontinuity, $SeamlessAngleLinkedInDSI, $VOBStillMode, $StopsTrickPlay, $CellStillTime, $CellCommand, $PlayTime, $FrameRate, $FirstVOBUStartSector, $FirstILVUEndSector, $LastVOBUStartSector, $LastVOBUEndSector, $VOBidn, $CELLidn, $NumberOfVOBIds))
{
$ResponseText = "Error binding parameters for DVDCELL table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDCELL table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$idDVDCELL = $mysqli->insert_id;
$stmt->close();
foreach ($tagDVDCELL->DVDUNIT as $tagDVDUNIT)
{
// Insert DVDUNIT (Unit)
$attributes = $tagDVDUNIT->attributes();
$UnitNo = value_or_null($attributes["Number"]);
$StartSector = value_or_null($attributes["StartSector"]);
$EndSector = value_or_null($attributes["EndSector"]);
$strSQL = "INSERT INTO `DVDUNIT` (`DVDCELLKey`, `UnitNo`, `StartSector`, `EndSector`) VALUES (?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDUNIT table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiii", $idDVDCELL, $UnitNo, $StartSector, $EndSector))
{
$ResponseText = "Error binding parameters for DVDUNIT table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDUNIT table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
//$idDVDUNIT = $mysqli->insert_id;
$stmt->close();
}
}
}
}
// DVDVIDEOSTREAM
foreach ($tagDVDVTS->DVDVIDEOSTREAM as $tagDVDVIDEOSTREAM)
{
addVideoStream($mysqli, $tagDVDVIDEOSTREAM, null, $idDVDVTS);
}
// DVDAUDIOSTREAM
foreach ($tagDVDVTS->DVDAUDIOSTREAM as $tagDVDAUDIOSTREAM)
{
addAudioStream($mysqli, $tagDVDAUDIOSTREAM, null, $idDVDVTS);
}
// DVDAUDIOSTREAMEX
foreach ($tagDVDVTS->DVDAUDIOSTREAMEX as $audiostreamExTag)
{
addAudioStreamEx($mysqli, $audiostreamExTag, $idDVDVTS);
}
// DVDSUBPICSTREAM
foreach ($tagDVDVTS->DVDSUBPICSTREAM as $tagDVDSUBPICSTREAM)
{
addSubpictureStream($mysqli, $tagDVDSUBPICSTREAM, null, $idDVDVTS);
}
// Fileset
foreach ($tagDVDVTS->DVDFILE as $tagDVDFILE)
{
addFileset($mysqli, $tagDVDFILE, null, $idDVDVTS);
}
}
// Virtual structure
$tagVirtual = $tagDVDVMGM->virtual;
foreach ($tagVirtual->DVDPTTVMG as $tagDVDPTTVMG)
{
// Insert DVDPTTVMG (Video Title Set)
$attributes = $tagDVDPTTVMG->attributes();
$Title = value_or_null($tagDVDPTTVMG->Title);
$TitleSetNo = value_or_null($attributes["TitleSetNo"]);
$PlaybackType = value_or_null($attributes["PlaybackType"]);
$NumberOfVideoAngles = value_or_null($attributes["NumberOfVideoAngles"]);
$ParentalMgmMaskVMG = value_or_null($attributes["ParentalMgmMaskVMG"]);
$ParentalMgmMaskVTS = value_or_null($attributes["ParentalMgmMaskVTS"]);
$NumberOfVideoAngles = value_or_null($attributes["NumberOfVideoAngles"]);
$VideoTitleSetNo = value_or_null($attributes["VideoTitleSetNo"]);
$TitleNo = value_or_null($attributes["TitleNo"]);
$strSQL = "INSERT INTO `DVDPTTVMG` (`DVDVMGMKey`, `TitleSetNo`, `Title`, `PlaybackType`, `NumberOfVideoAngles`, `ParentalMgmMaskVMG`, `ParentalMgmMaskVTS`, `VideoTitleSetNo`, `TitleNo`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDPTTVMG table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iisiiiiii", $idDVDVMGM, $TitleSetNo, $Title, $PlaybackType, $NumberOfVideoAngles, $ParentalMgmMaskVMG, $ParentalMgmMaskVTS, $VideoTitleSetNo, $TitleNo))
{
$ResponseText = "Error binding parameters for DVDPTTVMG table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDPTTVMG table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$idDVDPTTVMG = $mysqli->insert_id;
$stmt->close();
foreach ($tagDVDPTTVMG->DVDPTTVTS as $tagDVDPTTVTS)
{
// Insert DVDPTTVTS (Chapter)
$attributes = $tagDVDPTTVTS->attributes();
$Title = value_or_null($tagDVDPTTVTS->Title);
$Artist = value_or_null($tagDVDPTTVTS->Artist);
$ProgramChainNo = value_or_null($attributes["ProgramChainNo"]);
$ProgramNo = value_or_null($attributes["ProgramNo"]);
$PttTitleSetNo = value_or_null($attributes["PttTitleSetNo"]);
$PttChapterNo = value_or_null($attributes["Number"]);
$TitleSetNo = value_or_null($attributes["TitleSetNo"]);
$strSQL = "INSERT INTO `DVDPTTVTS` (`DVDPTTVMGKey`, `Artist`, `Title`, `ProgramChainNo`, `ProgramNo`, `PttTitleSetNo`, `PttChapterNo`, `TitleSetNo`) VALUES (?, ?, ?, ?, ?, ?, ?, ?);";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDPTTVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("issiiiii", $idDVDPTTVMG, $Artist, $Title, $ProgramChainNo, $ProgramNo, $PttTitleSetNo, $PttChapterNo, $TitleSetNo))
{
$ResponseText = "Error binding parameters for DVDPTTVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDPTTVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
//$idDVDPTTVTS = $mysqli->insert_id;
$stmt->close();
}
}
// DVDVIDEOSTREAM
foreach ($tagDVDVMGM->DVDVIDEOSTREAM as $tagDVDVIDEOSTREAM)
{
addVideoStream($mysqli, $tagDVDVIDEOSTREAM, $idDVDVMGM, null);
}
// DVDAUDIOSTREAM
foreach ($tagDVDVMGM->DVDAUDIOSTREAM as $tagDVDAUDIOSTREAM)
{
addAudioStream($mysqli, $tagDVDAUDIOSTREAM, $idDVDVMGM, null);
}
// DVDSUBPICSTREAM
foreach ($tagDVDVMGM->DVDSUBPICSTREAM as $tagDVDSUBPICSTREAM)
{
addSubpictureStream($mysqli, $tagDVDSUBPICSTREAM, $idDVDVMGM, null);
}
// Fileset
foreach ($tagDVDVMGM->DVDFILE as $tagDVDFILE)
{
addFileset($mysqli, $tagDVDFILE, $idDVDVMGM, null);
}
}
else
{
// Found: do an update
$strSQL = "UPDATE `DVDVMGM` SET `Album` = ?, `AlbumArtist` = ?, `Genre` = ?, `Cast` = ?, `Crew` = ?, `Director` = ?, `Country` = ?, `ReleaseDate` = ?, `SpecialFeatures` = ?, `EAN_UPC` = ?, `Storyline` = ?, `Remarks` = ?, `Submitter` = ?, `SubmitterIP` = ?, `Client` = ?, `Keywords` = ?, `RegionProhibited1` = ?, `RegionProhibited2` = ?, `RegionProhibited3` = ?, `RegionProhibited4` = ?, `RegionProhibited5` = ?, `RegionProhibited6` = ?, `RegionProhibited7` = ?, `RegionProhibited8` = ?, `VersionNumberMajor` = ?, `VersionNumberMinor` = ?, `NumberOfVolumes` = ?, `VolumeNumber` = ?, `OriginalAlbum` = ?, `Screenplay` = ?, `Producer` = ?, `Editing` = ?, `Cinematography` = ?, `OriginalLanguage` = ?, `SideID` = ? WHERE `idDVDVMGM` = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing update statement for DVDVMGM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("ssssssssssssssssiiiiiiiiiiiissssssii", $Album, $AlbumArtist, $Genre, $Cast, $Crew, $Director, $Country, $ReleaseDate, $SpecialFeatures, $EAN_UPC, $Storyline, $Remarks, $Submitter, $SubmitterIP, $Client, $Keywords, $RegionProhibited1, $RegionProhibited2, $RegionProhibited3, $RegionProhibited4, $RegionProhibited5, $RegionProhibited6, $RegionProhibited7, $RegionProhibited8, $VersionNumberMajor, $VersionNumberMinor, $NumberOfVolumes, $VolumeNumber, $OriginalAlbum, $Screenplay, $Producer, $Editing, $Cinematography, $OriginalLanguage, $SideID, $idDVDVMGM))
{
$ResponseText = "Error binding parameters for DVDVMGM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
$stmt = null;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDVMGM table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
$stmt = null;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
$stmt = null;
// Physical structure
$tagPhysical = $tagDVDVMGM->physical;
foreach ($tagPhysical->DVDVTS as $tagDVDVTS)
{
// Update DVDVTS (Video Title Set)
$attributes = $tagDVDVTS->attributes();
$TitleSetNo = $attributes["TitleSetNo"];
$VersionNumberMajor = value_or_null($attributes["VersionNumberMajor"]);
$VersionNumberMinor = value_or_null($attributes["VersionNumberMinor"]);
$idDVDVTS = getPrimaryKey($mysqli, "DVDVTS", "idDVDVTS", "`DVDVMGMKey` = $idDVDVMGM AND `TitleSetNo` = $TitleSetNo");
$strSQL = "UPDATE `DVDVTS` SET `TitleSetNo` = ?, `VersionNumberMajor` = ?, `VersionNumberMinor` = ? WHERE `idDVDVTS` = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing update statement for DVDVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiii", $TitleSetNo, $VersionNumberMajor, $VersionNumberMinor, $idDVDVTS))
{
$ResponseText = "Error binding parameters for DVDVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
foreach ($tagDVDVTS->DVDPGC as $tagDVDPGC)
{
// Update DVDPGC (Program Chain)
$attributes = $tagDVDPGC->attributes();
$ProgramChainNo = value_or_null($attributes["Number"]);
$EntryPGC = value_or_null($attributes["EntryPGC"]);
$idDVDPGC = getPrimaryKey($mysqli, "DVDPGC", "idDVDPGC", "`DVDVTSKey` = $idDVDVTS AND `ProgramChainNo` = $ProgramChainNo");
$strSQL = "UPDATE `DVDPGC` SET `EntryPGC` = ? WHERE `idDVDPGC` = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDPGC table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("ii", $EntryPGC, $idDVDPGC))
{
$ResponseText = "Error binding parameters for DVDPGC table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDPGC table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
foreach ($tagDVDPGC->DVDPROGRAM as $tagDVDPROGRAM)
{
// Update DVDPGC (Program)
$attributes = $tagDVDPROGRAM->attributes();
$ProgramNo = value_or_null($attributes["Number"]);
// Nothing to update...
$idDVDPROGRAM = getPrimaryKey($mysqli, "DVDPROGRAM", "idDVDPROGRAM", "`DVDPGCKey` = $idDVDPGC AND `ProgramNo` = $ProgramNo");
foreach ($tagDVDPROGRAM->DVDCELL as $tagDVDCELL)
{
// Update DVDCELL (Cell)
$attributes = $tagDVDCELL->attributes();
$CellNo = value_or_null($attributes["Number"]);
$CellType = value_or_null($attributes["CellType"]);
$BlockType = value_or_null($attributes["BlockType"]);
$SeamlessMultiplex = value_or_null($attributes["SeamlessMultiplex"]);
$Interleaved = value_or_null($attributes["Interleaved"]);
$SCRdiscontinuity = value_or_null($attributes["SCRdiscontinuity"]);
$SeamlessAngleLinkedInDSI = value_or_null($attributes["SeamlessAngleLinkedInDSI"]);
$VOBStillMode = value_or_null($attributes["VOBStillMode"]);
$StopsTrickPlay = value_or_null($attributes["StopsTrickPlay"]);
$CellStillTime = value_or_null($attributes["CellStillTime"]);
$CellCommand = value_or_null($attributes["CellCommand"]);
$PlayTime = value_or_null($attributes["PlayTime"]);
$FrameRate = value_or_null($attributes["FrameRate"]);
$FirstVOBUStartSector = value_or_null($attributes["FirstVOBUStartSector"]);
$FirstILVUEndSector = value_or_null($attributes["FirstILVUEndSector"]);
$LastVOBUStartSector = value_or_null($attributes["LastVOBUStartSector"]);
$LastVOBUEndSector = value_or_null($attributes["LastVOBUEndSector"]);
$VOBidn = value_or_null($attributes["VOBidn"]);
$CELLidn = value_or_null($attributes["CELLidn"]);
$NumberOfVOBIds = value_or_null($attributes["NumberOfVOBIds"]);
$idDVDCELL = getPrimaryKey($mysqli, "DVDCELL", "idDVDCELL", "`DVDPROGRAMKey` = $idDVDPROGRAM AND `CellNo` = $CellNo");
$strSQL = "UPDATE `DVDCELL` SET `CellType` = ?, `BlockType` = ?, `SeamlessMultiplex` = ?, `Interleaved` = ?, `SCRdiscontinuity` = ?, `SeamlessAngleLinkedInDSI` = ?, `VOBStillMode` = ?, `StopsTrickPlay` = ?, `CellStillTime` = ?, `CellCommand` = ?, `PlayTime` = ?, `FrameRate` = ?, `FirstVOBUStartSector` = ?, `FirstILVUEndSector` = ?, `LastVOBUStartSector` = ?, `LastVOBUEndSector` = ?, `VOBidn` = ?, `CELLidn` = ?, `NumberOfVOBIds` = ? WHERE `idDVDCELL` = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDCELL table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("ssiiiiiiiiiiiiiiiiii", $CellType, $BlockType, $SeamlessMultiplex, $Interleaved, $SCRdiscontinuity, $SeamlessAngleLinkedInDSI, $VOBStillMode, $StopsTrickPlay, $CellStillTime, $CellCommand, $PlayTime, $FrameRate, $FirstVOBUStartSector, $FirstILVUEndSector, $LastVOBUStartSector, $LastVOBUEndSector, $VOBidn, $CELLidn, $NumberOfVOBIds, $idDVDCELL))
{
$ResponseText = "Error binding parameters for DVDCELL table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDCELL table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
foreach ($tagDVDCELL->DVDUNIT as $tagDVDUNIT)
{
// Update DVDUNIT (Unit)
$attributes = $tagDVDUNIT->attributes();
$UnitNo = value_or_null($attributes["Number"]);
$StartSector = value_or_null($attributes["StartSector"]);
$EndSector = value_or_null($attributes["EndSector"]);
$strSQL = "UPDATE `DVDUNIT` SET `StartSector` = ?, `EndSector` = ? WHERE `DVDCELLKey` = ? AND `UnitNo` = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDUNIT table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("iiii", $StartSector, $EndSector, $idDVDCELL, $UnitNo))
{
$ResponseText = "Error binding parameters for DVDUNIT table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDUNIT table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
//$idDVDUNIT = $mysqli->insert_id;
$stmt->close();
}
}
}
}
// DVDVIDEOSTREAM
foreach ($tagDVDVTS->DVDVIDEOSTREAM as $tagDVDVIDEOSTREAM)
{
updateVideoStream($mysqli, $tagDVDVIDEOSTREAM, null, $idDVDVTS);
}
// DVDAUDIOSTREAM
foreach ($tagDVDVTS->DVDAUDIOSTREAM as $tagDVDAUDIOSTREAM)
{
updateAudioStream($mysqli, $tagDVDAUDIOSTREAM, null, $idDVDVTS);
}
// DVDAUDIOSTREAMEX
foreach ($tagDVDVTS->DVDAUDIOSTREAMEX as $audiostreamExTag)
{
updateAudioStreamEx($mysqli, $audiostreamExTag, $idDVDVTS);
}
// DVDSUBPICSTREAM
foreach ($tagDVDVTS->DVDSUBPICSTREAM as $tagDVDSUBPICSTREAM)
{
updateSubpictureStream($mysqli, $tagDVDSUBPICSTREAM, null, $idDVDVTS);
}
// Fileset
foreach ($tagDVDVTS->DVDFILE as $tagDVDFILE)
{
updateFileset($mysqli, $tagDVDFILE, null, $idDVDVTS);
}
}
// Virtual structure
$tagVirtual = $tagDVDVMGM->virtual;
foreach ($tagVirtual->DVDPTTVMG as $tagDVDPTTVMG)
{
// Update DVDPTTVMG (Video Title Set)
$attributes = $tagDVDPTTVMG->attributes();
$Title = value_or_null($tagDVDPTTVMG->Title);
$TitleSetNo = value_or_null($attributes["TitleSetNo"]);
$PlaybackType = value_or_null($attributes["PlaybackType"]);
$NumberOfVideoAngles = value_or_null($attributes["NumberOfVideoAngles"]);
$ParentalMgmMaskVMG = value_or_null($attributes["ParentalMgmMaskVMG"]);
$ParentalMgmMaskVTS = value_or_null($attributes["ParentalMgmMaskVTS"]);
$NumberOfVideoAngles = value_or_null($attributes["NumberOfVideoAngles"]);
$VideoTitleSetNo = value_or_null($attributes["VideoTitleSetNo"]);
$TitleNo = value_or_null($attributes["TitleNo"]);
$idDVDPTTVMG = getPrimaryKey($mysqli, "DVDPTTVMG", "idDVDPTTVMG", "`DVDVMGMKey` = $idDVDVMGM AND `TitleSetNo` = $TitleSetNo");
$strSQL = "UPDATE `DVDPTTVMG` SET `Title` = ?, `PlaybackType` = ?, `NumberOfVideoAngles` = ?, `ParentalMgmMaskVMG` = ?, `ParentalMgmMaskVTS` = ?, `VideoTitleSetNo` = ?, `TitleNo` = ? WHERE `idDVDPTTVMG` = ?;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDPTTVMG table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("siiiiiii", $Title, $PlaybackType, $NumberOfVideoAngles, $ParentalMgmMaskVMG, $ParentalMgmMaskVTS, $VideoTitleSetNo, $TitleNo, $idDVDPTTVMG))
{
$ResponseText = "Error binding parameters for DVDPTTVMG table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDPTTVMG table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
$stmt->close();
foreach ($tagDVDPTTVMG->DVDPTTVTS as $tagDVDPTTVTS)
{
// Update DVDPTTVTS (Chapter)
$attributes = $tagDVDPTTVTS->attributes();
$Title = value_or_null($tagDVDPTTVTS->Title);
$Artist = value_or_null($tagDVDPTTVTS->Artist);
$ProgramChainNo = value_or_null($attributes["ProgramChainNo"]);
$ProgramNo = value_or_null($attributes["ProgramNo"]);
$PttTitleSetNo = value_or_null($attributes["PttTitleSetNo"]);
$PttChapterNo = value_or_null($attributes["Number"]);
$TitleSetNo = value_or_null($attributes["TitleSetNo"]);
$strSQL = "UPDATE `DVDPTTVTS` SET `Artist` = ?, `Title` = ?, `ProgramChainNo` = ?, `ProgramNo` = ?, `PttTitleSetNo` = ?, TitleSetNo = ? WHERE `DVDPTTVMGKey` = ? AND `PttChapterNo` = ? ;";
$stmt = $mysqli->prepare($strSQL);
if (!$stmt)
{
$ResponseText = "Error preparing insert statement for DVDPTTVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->bind_param("ssiiiiii", $Artist, $Title, $ProgramChainNo, $ProgramNo, $PttTitleSetNo, $TitleSetNo, $idDVDPTTVMG, $PttChapterNo))
{
$ResponseText = "Error binding parameters for DVDPTTVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
if (!$stmt->execute())
{
$ResponseText = "Error executing statement on DVDPTTVTS table.\nSQL Error: " . $mysqli->error . "\nSQL State: " . $mysqli->sqlstate;
$stmt->close();
throw new Exception($ResponseText, XMLRESULT_SQL_ERROR);
}
//$idDVDPTTVTS = $mysqli->insert_id;
$stmt->close();
}
}
// DVDVIDEOSTREAM
foreach ($tagDVDVMGM->DVDVIDEOSTREAM as $tagDVDVIDEOSTREAM)
{
updateVideoStream($mysqli, $tagDVDVIDEOSTREAM, $idDVDVMGM, null);
}
// DVDAUDIOSTREAM
foreach ($tagDVDVMGM->DVDAUDIOSTREAM as $tagDVDAUDIOSTREAM)
{
updateAudioStream($mysqli, $tagDVDAUDIOSTREAM, $idDVDVMGM, null);
}
// DVDSUBPICSTREAM
foreach ($tagDVDVMGM->DVDSUBPICSTREAM as $tagDVDSUBPICSTREAM)
{
updateSubpictureStream($mysqli, $tagDVDSUBPICSTREAM, $idDVDVMGM, null);
}
// Fileset
foreach ($tagDVDVMGM->DVDFILE as $tagDVDFILE)
{
updateFileset($mysqli, $tagDVDFILE, $idDVDVMGM, null);
}
}
}
// Commit the transaction
$rs = query_server($mysqli, "COMMIT;");
}
?>
| nschlia/libdvdetect | php/inc/functions.submit.inc.php | PHP | lgpl-3.0 | 70,731 |
/***********************************************************************
Copyright (c) 2006-2011, Skype Limited. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, (subject to the limitations in the disclaimer below)
are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
- Neither the name of Skype Limited, nor the names of specific
contributors, may be used to endorse or promote products derived from
this software without specific prior written permission.
NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED
BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
***********************************************************************/
#include "SKP_Silk_main_FLP.h"
#include "SKP_Silk_tuning_parameters.h"
/* Compute gain to make warped filter coefficients have a zero mean log frequency response on a */
/* non-warped frequency scale. (So that it can be implemented with a minimum-phase monic filter.) */
SKP_INLINE SKP_float warped_gain(
const SKP_float *coefs,
SKP_float lambda,
SKP_int order
) {
SKP_int i;
SKP_float gain;
lambda = -lambda;
gain = coefs[ order - 1 ];
for( i = order - 2; i >= 0; i-- ) {
gain = lambda * gain + coefs[ i ];
}
return (SKP_float)( 1.0f / ( 1.0f - lambda * gain ) );
}
/* Convert warped filter coefficients to monic pseudo-warped coefficients and limit maximum */
/* amplitude of monic warped coefficients by using bandwidth expansion on the true coefficients */
SKP_INLINE void warped_true2monic_coefs(
SKP_float *coefs_syn,
SKP_float *coefs_ana,
SKP_float lambda,
SKP_float limit,
SKP_int order
) {
SKP_int i, iter, ind = 0;
SKP_float tmp, maxabs, chirp, gain_syn, gain_ana;
/* Convert to monic coefficients */
for( i = order - 1; i > 0; i-- ) {
coefs_syn[ i - 1 ] -= lambda * coefs_syn[ i ];
coefs_ana[ i - 1 ] -= lambda * coefs_ana[ i ];
}
gain_syn = ( 1.0f - lambda * lambda ) / ( 1.0f + lambda * coefs_syn[ 0 ] );
gain_ana = ( 1.0f - lambda * lambda ) / ( 1.0f + lambda * coefs_ana[ 0 ] );
for( i = 0; i < order; i++ ) {
coefs_syn[ i ] *= gain_syn;
coefs_ana[ i ] *= gain_ana;
}
/* Limit */
for( iter = 0; iter < 10; iter++ ) {
/* Find maximum absolute value */
maxabs = -1.0f;
for( i = 0; i < order; i++ ) {
tmp = SKP_max( SKP_abs_float( coefs_syn[ i ] ), SKP_abs_float( coefs_ana[ i ] ) );
if( tmp > maxabs ) {
maxabs = tmp;
ind = i;
}
}
if( maxabs <= limit ) {
/* Coefficients are within range - done */
return;
}
/* Convert back to true warped coefficients */
for( i = 1; i < order; i++ ) {
coefs_syn[ i - 1 ] += lambda * coefs_syn[ i ];
coefs_ana[ i - 1 ] += lambda * coefs_ana[ i ];
}
gain_syn = 1.0f / gain_syn;
gain_ana = 1.0f / gain_ana;
for( i = 0; i < order; i++ ) {
coefs_syn[ i ] *= gain_syn;
coefs_ana[ i ] *= gain_ana;
}
/* Apply bandwidth expansion */
chirp = 0.99f - ( 0.8f + 0.1f * iter ) * ( maxabs - limit ) / ( maxabs * ( ind + 1 ) );
SKP_Silk_bwexpander_FLP( coefs_syn, order, chirp );
SKP_Silk_bwexpander_FLP( coefs_ana, order, chirp );
/* Convert to monic warped coefficients */
for( i = order - 1; i > 0; i-- ) {
coefs_syn[ i - 1 ] -= lambda * coefs_syn[ i ];
coefs_ana[ i - 1 ] -= lambda * coefs_ana[ i ];
}
gain_syn = ( 1.0f - lambda * lambda ) / ( 1.0f + lambda * coefs_syn[ 0 ] );
gain_ana = ( 1.0f - lambda * lambda ) / ( 1.0f + lambda * coefs_ana[ 0 ] );
for( i = 0; i < order; i++ ) {
coefs_syn[ i ] *= gain_syn;
coefs_ana[ i ] *= gain_ana;
}
}
SKP_assert( 0 );
}
/* Compute noise shaping coefficients and initial gain values */
void SKP_Silk_noise_shape_analysis_FLP(
SKP_Silk_encoder_state_FLP *psEnc, /* I/O Encoder state FLP */
SKP_Silk_encoder_control_FLP *psEncCtrl, /* I/O Encoder control FLP */
const SKP_float *pitch_res, /* I LPC residual from pitch analysis */
const SKP_float *x /* I Input signal [frame_length + la_shape] */
)
{
SKP_Silk_shape_state_FLP *psShapeSt = &psEnc->sShape;
SKP_int k, nSamples;
SKP_float SNR_adj_dB, HarmBoost, HarmShapeGain, Tilt;
SKP_float nrg, pre_nrg, log_energy, log_energy_prev, energy_variation;
SKP_float delta, BWExp1, BWExp2, gain_mult, gain_add, strength, b, warping;
SKP_float x_windowed[ SHAPE_LPC_WIN_MAX ];
SKP_float auto_corr[ MAX_SHAPE_LPC_ORDER + 1 ];
const SKP_float *x_ptr, *pitch_res_ptr;
/* Point to start of first LPC analysis block */
x_ptr = x - psEnc->sCmn.la_shape;
/****************/
/* CONTROL SNR */
/****************/
/* Reduce SNR_dB values if recent bitstream has exceeded TargetRate */
psEncCtrl->current_SNR_dB = psEnc->SNR_dB - 0.05f * psEnc->BufferedInChannel_ms;
/* Reduce SNR_dB if inband FEC used */
if( psEnc->speech_activity > LBRR_SPEECH_ACTIVITY_THRES ) {
psEncCtrl->current_SNR_dB -= psEnc->inBandFEC_SNR_comp;
}
/****************/
/* GAIN CONTROL */
/****************/
/* Input quality is the average of the quality in the lowest two VAD bands */
psEncCtrl->input_quality = 0.5f * ( psEncCtrl->input_quality_bands[ 0 ] + psEncCtrl->input_quality_bands[ 1 ] );
/* Coding quality level, between 0.0 and 1.0 */
psEncCtrl->coding_quality = SKP_sigmoid( 0.25f * ( psEncCtrl->current_SNR_dB - 18.0f ) );
/* Reduce coding SNR during low speech activity */
b = 1.0f - psEnc->speech_activity;
SNR_adj_dB = psEncCtrl->current_SNR_dB -
BG_SNR_DECR_dB * psEncCtrl->coding_quality * ( 0.5f + 0.5f * psEncCtrl->input_quality ) * b * b;
if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
/* Reduce gains for periodic signals */
SNR_adj_dB += HARM_SNR_INCR_dB * psEnc->LTPCorr;
} else {
/* For unvoiced signals and low-quality input, adjust the quality slower than SNR_dB setting */
SNR_adj_dB += ( -0.4f * psEncCtrl->current_SNR_dB + 6.0f ) * ( 1.0f - psEncCtrl->input_quality );
}
/*************************/
/* SPARSENESS PROCESSING */
/*************************/
/* Set quantizer offset */
if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
/* Initally set to 0; may be overruled in process_gains(..) */
psEncCtrl->sCmn.QuantOffsetType = 0;
psEncCtrl->sparseness = 0.0f;
} else {
/* Sparseness measure, based on relative fluctuations of energy per 2 milliseconds */
nSamples = 2 * psEnc->sCmn.fs_kHz;
energy_variation = 0.0f;
log_energy_prev = 0.0f;
pitch_res_ptr = pitch_res;
for( k = 0; k < FRAME_LENGTH_MS / 2; k++ ) {
nrg = ( SKP_float )nSamples + ( SKP_float )SKP_Silk_energy_FLP( pitch_res_ptr, nSamples );
log_energy = SKP_Silk_log2( nrg );
if( k > 0 ) {
energy_variation += SKP_abs_float( log_energy - log_energy_prev );
}
log_energy_prev = log_energy;
pitch_res_ptr += nSamples;
}
psEncCtrl->sparseness = SKP_sigmoid( 0.4f * ( energy_variation - 5.0f ) );
/* Set quantization offset depending on sparseness measure */
if( psEncCtrl->sparseness > SPARSENESS_THRESHOLD_QNT_OFFSET ) {
psEncCtrl->sCmn.QuantOffsetType = 0;
} else {
psEncCtrl->sCmn.QuantOffsetType = 1;
}
/* Increase coding SNR for sparse signals */
SNR_adj_dB += SPARSE_SNR_INCR_dB * ( psEncCtrl->sparseness - 0.5f );
}
/*******************************/
/* Control bandwidth expansion */
/*******************************/
/* More BWE for signals with high prediction gain */
strength = FIND_PITCH_WHITE_NOISE_FRACTION * psEncCtrl->predGain; /* between 0.0 and 1.0 */
BWExp1 = BWExp2 = BANDWIDTH_EXPANSION / ( 1.0f + strength * strength );
delta = LOW_RATE_BANDWIDTH_EXPANSION_DELTA * ( 1.0f - 0.75f * psEncCtrl->coding_quality );
BWExp1 -= delta;
BWExp2 += delta;
/* BWExp1 will be applied after BWExp2, so make it relative */
BWExp1 /= BWExp2;
if( psEnc->sCmn.warping_Q16 > 0 ) {
/* Slightly more warping in analysis will move quantization noise up in frequency, where it's better masked */
warping = (SKP_float)psEnc->sCmn.warping_Q16 / 65536.0f + 0.01f * psEncCtrl->coding_quality;
} else {
warping = 0.0f;
}
/********************************************/
/* Compute noise shaping AR coefs and gains */
/********************************************/
for( k = 0; k < NB_SUBFR; k++ ) {
/* Apply window: sine slope followed by flat part followed by cosine slope */
SKP_int shift, slope_part, flat_part;
flat_part = psEnc->sCmn.fs_kHz * 5;
slope_part = ( psEnc->sCmn.shapeWinLength - flat_part ) / 2;
SKP_Silk_apply_sine_window_FLP( x_windowed, x_ptr, 1, slope_part );
shift = slope_part;
SKP_memcpy( x_windowed + shift, x_ptr + shift, flat_part * sizeof(SKP_float) );
shift += flat_part;
SKP_Silk_apply_sine_window_FLP( x_windowed + shift, x_ptr + shift, 2, slope_part );
/* Update pointer: next LPC analysis block */
x_ptr += psEnc->sCmn.subfr_length;
if( psEnc->sCmn.warping_Q16 > 0 ) {
/* Calculate warped auto correlation */
SKP_Silk_warped_autocorrelation_FLP( auto_corr, x_windowed, warping,
psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder );
} else {
/* Calculate regular auto correlation */
SKP_Silk_autocorrelation_FLP( auto_corr, x_windowed, psEnc->sCmn.shapeWinLength, psEnc->sCmn.shapingLPCOrder + 1 );
}
/* Add white noise, as a fraction of energy */
auto_corr[ 0 ] += auto_corr[ 0 ] * SHAPE_WHITE_NOISE_FRACTION;
/* Convert correlations to prediction coefficients, and compute residual energy */
nrg = SKP_Silk_levinsondurbin_FLP( &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], auto_corr, psEnc->sCmn.shapingLPCOrder );
psEncCtrl->Gains[ k ] = ( SKP_float )sqrt( nrg );
if( psEnc->sCmn.warping_Q16 > 0 ) {
/* Adjust gain for warping */
psEncCtrl->Gains[ k ] *= warped_gain( &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], warping, psEnc->sCmn.shapingLPCOrder );
}
/* Bandwidth expansion for synthesis filter shaping */
SKP_Silk_bwexpander_FLP( &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], psEnc->sCmn.shapingLPCOrder, BWExp2 );
/* Compute noise shaping filter coefficients */
SKP_memcpy(
&psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER ],
&psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ],
psEnc->sCmn.shapingLPCOrder * sizeof( SKP_float ) );
/* Bandwidth expansion for analysis filter shaping */
SKP_Silk_bwexpander_FLP( &psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER ], psEnc->sCmn.shapingLPCOrder, BWExp1 );
/* Ratio of prediction gains, in energy domain */
SKP_Silk_LPC_inverse_pred_gain_FLP( &pre_nrg, &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], psEnc->sCmn.shapingLPCOrder );
SKP_Silk_LPC_inverse_pred_gain_FLP( &nrg, &psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER ], psEnc->sCmn.shapingLPCOrder );
psEncCtrl->GainsPre[ k ] = 1.0f - 0.7f * ( 1.0f - pre_nrg / nrg );
/* Convert to monic warped prediction coefficients and limit absolute values */
warped_true2monic_coefs( &psEncCtrl->AR2[ k * MAX_SHAPE_LPC_ORDER ], &psEncCtrl->AR1[ k * MAX_SHAPE_LPC_ORDER ],
warping, 3.999f, psEnc->sCmn.shapingLPCOrder );
}
/*****************/
/* Gain tweaking */
/*****************/
/* Increase gains during low speech activity and put lower limit on gains */
gain_mult = ( SKP_float )pow( 2.0f, -0.16f * SNR_adj_dB );
gain_add = ( SKP_float )pow( 2.0f, 0.16f * NOISE_FLOOR_dB ) +
( SKP_float )pow( 2.0f, 0.16f * RELATIVE_MIN_GAIN_dB ) * psEnc->avgGain;
for( k = 0; k < NB_SUBFR; k++ ) {
psEncCtrl->Gains[ k ] *= gain_mult;
psEncCtrl->Gains[ k ] += gain_add;
psEnc->avgGain += psEnc->speech_activity * GAIN_SMOOTHING_COEF * ( psEncCtrl->Gains[ k ] - psEnc->avgGain );
}
/************************************************/
/* Decrease level during fricatives (de-essing) */
/************************************************/
gain_mult = 1.0f + INPUT_TILT + psEncCtrl->coding_quality * HIGH_RATE_INPUT_TILT;
if( psEncCtrl->input_tilt <= 0.0f && psEncCtrl->sCmn.sigtype == SIG_TYPE_UNVOICED ) {
SKP_float essStrength = -psEncCtrl->input_tilt * psEnc->speech_activity * ( 1.0f - psEncCtrl->sparseness );
if( psEnc->sCmn.fs_kHz == 24 ) {
gain_mult *= ( SKP_float )pow( 2.0f, -0.16f * DE_ESSER_COEF_SWB_dB * essStrength );
} else if( psEnc->sCmn.fs_kHz == 16 ) {
gain_mult *= (SKP_float)pow( 2.0f, -0.16f * DE_ESSER_COEF_WB_dB * essStrength );
} else {
SKP_assert( psEnc->sCmn.fs_kHz == 12 || psEnc->sCmn.fs_kHz == 8 );
}
}
for( k = 0; k < NB_SUBFR; k++ ) {
psEncCtrl->GainsPre[ k ] *= gain_mult;
}
/************************************************/
/* Control low-frequency shaping and noise tilt */
/************************************************/
/* Less low frequency shaping for noisy inputs */
strength = LOW_FREQ_SHAPING * ( 1.0f + LOW_QUALITY_LOW_FREQ_SHAPING_DECR * ( psEncCtrl->input_quality_bands[ 0 ] - 1.0f ) );
if( psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
/* Reduce low frequencies quantization noise for periodic signals, depending on pitch lag */
/*f = 400; freqz([1, -0.98 + 2e-4 * f], [1, -0.97 + 7e-4 * f], 2^12, Fs); axis([0, 1000, -10, 1])*/
for( k = 0; k < NB_SUBFR; k++ ) {
b = 0.2f / psEnc->sCmn.fs_kHz + 3.0f / psEncCtrl->sCmn.pitchL[ k ];
psEncCtrl->LF_MA_shp[ k ] = -1.0f + b;
psEncCtrl->LF_AR_shp[ k ] = 1.0f - b - b * strength;
}
Tilt = - HP_NOISE_COEF -
(1 - HP_NOISE_COEF) * HARM_HP_NOISE_COEF * psEnc->speech_activity;
} else {
b = 1.3f / psEnc->sCmn.fs_kHz;
psEncCtrl->LF_MA_shp[ 0 ] = -1.0f + b;
psEncCtrl->LF_AR_shp[ 0 ] = 1.0f - b - b * strength * 0.6f;
for( k = 1; k < NB_SUBFR; k++ ) {
psEncCtrl->LF_MA_shp[ k ] = psEncCtrl->LF_MA_shp[ 0 ];
psEncCtrl->LF_AR_shp[ k ] = psEncCtrl->LF_AR_shp[ 0 ];
}
Tilt = -HP_NOISE_COEF;
}
/****************************/
/* HARMONIC SHAPING CONTROL */
/****************************/
/* Control boosting of harmonic frequencies */
HarmBoost = LOW_RATE_HARMONIC_BOOST * ( 1.0f - psEncCtrl->coding_quality ) * psEnc->LTPCorr;
/* More harmonic boost for noisy input signals */
HarmBoost += LOW_INPUT_QUALITY_HARMONIC_BOOST * ( 1.0f - psEncCtrl->input_quality );
if( USE_HARM_SHAPING && psEncCtrl->sCmn.sigtype == SIG_TYPE_VOICED ) {
/* Harmonic noise shaping */
HarmShapeGain = HARMONIC_SHAPING;
/* More harmonic noise shaping for high bitrates or noisy input */
HarmShapeGain += HIGH_RATE_OR_LOW_QUALITY_HARMONIC_SHAPING *
( 1.0f - ( 1.0f - psEncCtrl->coding_quality ) * psEncCtrl->input_quality );
/* Less harmonic noise shaping for less periodic signals */
HarmShapeGain *= ( SKP_float )sqrt( psEnc->LTPCorr );
} else {
HarmShapeGain = 0.0f;
}
/*************************/
/* Smooth over subframes */
/*************************/
for( k = 0; k < NB_SUBFR; k++ ) {
psShapeSt->HarmBoost_smth += SUBFR_SMTH_COEF * ( HarmBoost - psShapeSt->HarmBoost_smth );
psEncCtrl->HarmBoost[ k ] = psShapeSt->HarmBoost_smth;
psShapeSt->HarmShapeGain_smth += SUBFR_SMTH_COEF * ( HarmShapeGain - psShapeSt->HarmShapeGain_smth );
psEncCtrl->HarmShapeGain[ k ] = psShapeSt->HarmShapeGain_smth;
psShapeSt->Tilt_smth += SUBFR_SMTH_COEF * ( Tilt - psShapeSt->Tilt_smth );
psEncCtrl->Tilt[ k ] = psShapeSt->Tilt_smth;
}
}
| fingi/csipsimple | jni/silk/sources/SILK_SDK_SRC_FLP_v1.0.8/src/SKP_Silk_noise_shape_analysis_FLP.c | C | lgpl-3.0 | 18,214 |
/*
Galois, a framework to exploit amorphous data-parallelism in irregular
programs.
Copyright (C) 2010, The University of Texas at Austin. All rights reserved.
UNIVERSITY EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES CONCERNING THIS SOFTWARE
AND DOCUMENTATION, INCLUDING ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR ANY
PARTICULAR PURPOSE, NON-INFRINGEMENT AND WARRANTIES OF PERFORMANCE, AND ANY
WARRANTY THAT MIGHT OTHERWISE ARISE FROM COURSE OF DEALING OR USAGE OF TRADE.
NO WARRANTY IS EITHER EXPRESS OR IMPLIED WITH RESPECT TO THE USE OF THE
SOFTWARE OR DOCUMENTATION. Under no circumstances shall University be liable
for incidental, special, indirect, direct or consequential damages or loss of
profits, interruption of business, or related expenses which may arise from use
of Software or Documentation, including but not limited to those resulting from
defects in Software and/or Documentation, or loss or inaccuracy of data of any
kind.
File: GNode.java
*/
package galois.objects.graph;
import galois.objects.GObject;
import galois.objects.Lockable;
import galois.objects.Mappable;
import galois.runtime.Replayable;
/**
* A node in a graph.
*
* @param <N> the type of the data stored in each node
*/
public interface GNode<N> extends Replayable, Lockable, Mappable<GNode<N>>, GObject {
/**
* Retrieves the node data associated with the vertex
*
* All the Galois runtime actions (e.g., conflict detection) will be performed when
* the method is executed.
*
* @return the data contained in the node
*/
public N getData();
/**
* Retrieves the node data associated with the vertex. Equivalent to {@link #getData(byte, byte)}
* passing <code>flags</code> to both parameters.
*
* @param flags Galois runtime actions (e.g., conflict detection) that need to be executed
* upon invocation of this method. See {@link galois.objects.MethodFlag}
* @return the data contained in the node
*/
public N getData(byte flags);
/**
* Retrieves the node data associated with the vertex. For convenience, this method
* also calls {@link GObject#access(byte)} on the returned data.
*
* <p>Recall that the
* {@link GNode} object maintains information about the vertex and its connectivity
* in the graph. This is separate from the data itself. For example,
* <code>getData(MethodFlag.NONE, MethodFlag.SAVE_UNDO)</code>
* does not acquire an abstract lock on the {@link GNode} (perhaps because
* it was returned by a call to {@link GNode#map(util.fn.LambdaVoid)}), but it
* saves undo information on the returned data in case the iteration needs to
* be rolled back.
* </p>
*
* @param nodeFlags Galois runtime actions (e.g., conflict detection) that need to be executed
* upon invocation of this method on the <i>node itself</i>.
* See {@link galois.objects.MethodFlag}
* @param dataFlags Galois runtime actions (e.g., conflict detection) that need to be executed
* upon invocation of this method on the <i>data</i> contained in the node.
* See {@link galois.objects.MethodFlag}
* @return the data contained in the node
*/
public N getData(byte nodeFlags, byte dataFlags);
/**
* Sets the node data.
*
* All the Galois runtime actions (e.g., conflict detection) will be performed when
* the method is executed.
*
* @param d the data to be stored
* @return the old data associated with the node
*/
public N setData(N d);
/**
* Sets the node data.
*
* @param d the data to be stored
* @param flags Galois runtime actions (e.g., conflict detection) that need to be executed
* upon invocation of this method. See {@link galois.objects.MethodFlag}
* @return the old data associated with the node
*/
public N setData(N d, byte flags);
}
| chmaruni/SCJ | Shared/libs_src/Galois-2.0/src/galois/objects/graph/GNode.java | Java | lgpl-3.0 | 3,896 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.