answer
stringlengths 15
1.25M
|
|---|
mod actor_state;
mod character;
mod openable;
mod respawnable;
mod stats_item;
pub use actor_state::*;
pub use character::*;
pub use openable::*;
pub use respawnable::*;
pub use stats_item::*;
|
import React from 'react';
import { Card } from 'bm-kit';
import './_pillar.schedule.source.scss';
const friday = [
{
start: '6:00 PM',
name: ' Check in begins'
},
{
start: '8:00 PM',
name: ' Opening Ceremonies'
},
{
start: '9:00 PM',
name: '🤝 Team assembly'
},
{
start: '9:30 PM',
name: ' Dinner'
},
{
start: '10:00 PM',
name: ' Hacking Begins'
},
{
start: '10:00 PM',
name: '🤖 Fundamentals of AI with Intel'
},
{
start: '12:00 AM',
name: '🥋 Ninja'
}
];
let saturday = [
{
start: '3:00 AM',
name: ' Late Night Snack'
},
{
start: '8:00 AM',
name: '🥓 Breakfast'
},
{
start: '9:00 AM',
name: ' Workshop'
},
{
start: '12:30 PM',
name: ' Lunch'
},
{
start: '1:00 PM',
name: ' Facebook Tech Talk'
},
{
start: '2:00 PM',
name: ' Doggos/Woofers'
},
{
start: '2:30 PM',
name: ' Rockwell Collins Talk'
},
{
start: '3:00 PM',
name: ' Snack'
},
{
start: '3:00 PM',
name: ' Activity'
},
{
start: '4:00 PM',
name: ' Startups with T.A. MaCann'
},
{
start: '6:00 PM',
name: ' Dinner'
},
{
start: '9:00 PM',
name: '🥤 Cup stacking with MLH'
},
{
start: '10:00 PM',
name: ' Donuts and Kona Ice'
},
{
start: '10:00 PM',
name: ' Jenga'
}
];
let sunday = [
{
start: '1:00 AM',
name: ' Late Night Snack'
},
{
start: '8:00 AM',
name: ' Breakfast'
},
{
start: '9:30 AM',
name: ' Hacking Ends'
},
{
start: '10:00 AM',
name: ' Expo Begins'
},
{
start: '11:30 AM',
name: ' Lunch'
},
{
start: '1:00 PM',
name: ' Closing Ceremonies'
},
{
start: '2:30 PM',
name: ' Buses Depart'
}
];
const ScheduleDay = ({ dayData, title }) => (
<Card className="p-schedule__day">
<h3 className="text-center">{title}</h3>
{dayData.map(item => (
<div className="p-schedule__item" key={item.name + item.start}>
<div className="<API key>">
<span className="<API key>">{item.start}</span>
<span className="<API key>">{item.name}</span>
</div>
<div className="<API key>">{item.info}</div>
</div>
))}
</Card>
);
const Schedule = ({ small }) => (
<div className="p-schedule">
{small ? <h3 style={{ marginTop: 0 }}>Schedule</h3> : <h1>Schedule</h1>}
<div className="p-schedule__days">
<ScheduleDay dayData={friday} title="Friday (10/19)" />
<ScheduleDay dayData={saturday} title="Saturday (10/20)" />
<ScheduleDay dayData={sunday} title="Sunday (10/21)" />
</div>
</div>
);
export default Schedule;
|
// This program is free software: you can redistribute it and/or modify
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#ifndef INTEGERINFORECORD_H
#define INTEGERINFORECORD_H
#include "datainforecord.h"
namespace spss
{
/**
* @brief The IntegerInfoRecord class
*
* Associated with record type <API key> = rectype_meta_data = 7, sub type recsubtype_integer = 3,
*/
class IntegerInfoRecord : public DataInfoRecord<recsubtype_integer>
{
public:
/**
* @brief IntegerInfoRecord default Ctor
*/
IntegerInfoRecord();
/**
* @brief IntegerInfoRecord Ctor
* @param Converters fixer Fixes endainness.
* @param fileSubType The record subtype value, as found in the file.
* @param fileType The record type value, as found in the file.
* @param fromStream The file to read from.
*
* NB This constructor will modify the contents of fixer!
*/
IntegerInfoRecord(NumericConverter &fixer, RecordSubTypes fileSubType, RecordTypes fileType, SPSSStream &fromStream);
virtual ~IntegerInfoRecord();
/*
* Data!
*/
<API key>(int32_t, version_major)
<API key>(int32_t, version_minor)
<API key>(int32_t, version_revision)
<API key>(int32_t, machine_code)
<API key>(int32_t, floating_point_rep)
<API key>(int32_t, compression_code)
<API key>(int32_t, endianness)
<API key>(int32_t, character_code)
/**
* @brief process Manipulates columns by adding the contents of thie record.
* @param columns
*
* Implematations should examine columns to determine the record history.
*/
virtual void process(SPSSColumns & columns);
};
}
#endif // INTEGERINFORECORD_H
|
window.addEventListener("DOMContentLoaded", () => {
let watchers = {};
new DOM('@Dialog').forEach((dialog) => {
dialogPolyfill.registerDialog(dialog);
if (dialog.querySelector('Button[Data-Action="Dialog_Submit"]')) {
dialog.addEventListener("keydown", (event) => {
if (event.ctrlKey && event.keyCode == 13) dialog.querySelector('Button[Data-Action="Dialog_Submit"]').click();
});
}
dialog.querySelectorAll('Dialog *[Required]').forEach((input) => {
input.addEventListener("input", () => {
let result = true;
dialog.querySelectorAll('Dialog *[Required]').forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
if (result) {
dialog.querySelector('Button[Data-Action="Dialog_Submit"]').classList.remove("<API key>");
} else {
dialog.querySelector('Button[Data-Action="Dialog_Submit"]').classList.add("<API key>");
}
});
});
dialog.querySelectorAll('Dialog Button[Data-Action="Dialog_Close"]').forEach((btn) => {
btn.addEventListener("click", () => {
btn.offsetParent.close();
});
});
});
new DOM("#<API key>").addEventListener("input", () => {
if (new DOM("#<API key>").value == base.user.email) {
new DOM("#<API key>").classList.remove("<API key>");
} else {
new DOM("#<API key>").classList.add("<API key>");
}
});
new DOM("#<API key>").addEventListener("click", (event) => {
if (new DOM("#<API key>").value == base.user.email) {
base.delete();
} else {
new DOM("#<API key>").classList.add("is-invalid");
}
});
watchers["<API key>"] = {
valueObj: { value: "" },
watcher: null
}; watchers["<API key>"].watcher = new DOM.Watcher({
target: watchers["<API key>"].valueObj,
onGet: () => { watchers["<API key>"].valueObj.value = new DOM("#<API key>").value },
onChange: (watcher) => {
base.Database.get(base.Database.ONCE, `users/${watcher.newValue}`, (res) => {
new DOM("#<API key>").dataset.uid = watcher.newValue,
new DOM("#<API key>").textContent = res.userName,
new DOM("#<API key>").textContent = res.detail;
while (new DOM("#<API key>").childNodes.length > 0) new DOM("#<API key>").childNodes[0].remove();
if (res.links) {
for (let i = 0; i < res.links.length; i++) {
let link = new Component.Dialogs.Profile.InfoViewer.Links.Link(res.links[i].name, res.links[i].url);
new DOM("#<API key>").appendChild(link);
}
}
});
}
});
new DOM("#<API key>").addEventListener("click", () => {
base.Database.delete(`threads/${new DOM("#<API key>").value}/`);
parent.document.querySelector("IFrame.mdl-layout__content").contentWindow.postMessage({ code: "Code-Refresh" }, "*");
new DOM("#<API key>").showModal();
});
new DOM("@#<API key> *[Required]").forEach((input) => {
input.addEventListener("input", () => {
let result = true;
let list = [
new DOM("#<API key>"),
new DOM("#<API key>")
];
if (new DOM("#<API key>").checked) list.push(new DOM("#<API key>"));
list.forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
if (result) {
new DOM("#<API key>").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.remove("<API key>");
});
} else {
new DOM("#<API key>").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.add("<API key>");
});
}
});
});
new DOM("#<API key>").addEventListener("change", (event) => {
let result = true;
switch (event.target.checked) {
case true:
new DOM("#<API key>").classList.remove("<API key>");
[new DOM("#<API key>"), new DOM("#<API key>"), new DOM("#<API key>")].forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
break;
case false:
new DOM("#<API key>").classList.add("<API key>");
[new DOM("#<API key>"), new DOM("#<API key>")].forEach(requiredField => {
if (requiredField.value.replace(/\s/g, "").length == 0) {
result = false;
return;
}
});
break;
}
if (result) {
new DOM("#<API key>").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.remove("<API key>");
});
} else {
new DOM("#<API key>").querySelectorAll('Button[Data-Action="Dialog_Submit"]').forEach(btn => {
btn.classList.add("<API key>");
});
}
});
new DOM("#<API key>").addEventListener("click", (event) => {
base.Database.transaction("threads", (res) => {
let now = new Date().getTime();
base.Database.set("threads/" + res.length, {
title: new DOM("#<API key>").value,
overview: new DOM("#<API key>").value,
detail: new DOM("#<API key>").value,
jobs: {
Owner: (() => {
let owner = {}; owner[base.user.uid] = "";
return owner;
})(),
Admin: {
}
},
createdAt: now,
data: [
{
uid: "!SYSTEM_INFO",
content: new DOM("#<API key>").value,
createdAt: now
}
],
password: new DOM("#<API key>").checked ? Encrypter.encrypt(new DOM("#<API key>").value) : ""
});
new DOM("#<API key>").close();
parent.document.querySelector("IFrame.mdl-layout__content").src = "Thread/Viewer/?tid=" + res.length;
});
});
new DOM("#<API key>").addEventListener("click", (event) => {
base.Database.update(`threads/${new DOM("#<API key>").value}/`, {
title: new DOM("#<API key>").value,
overview: new DOM("#<API key>").value,
detail: new DOM("#<API key>").value,
password: new DOM("#<API key>").checked ? Encrypter.encrypt(new DOM("#<API key>").value) : ""
});
new DOM("#<API key>").close();
new DOM("#<API key>").showModal();
});
new DOM("#Dialogs_Thread_<API key>).addEventListener("click", (event) => {
if (Encrypter.encrypt(new DOM("#Dialogs_Thread_<API key>).value) == new DOM("#Dialogs_Thread_<API key>).value) {
sessionStorage.setItem("com.GenbuProject.SimpleThread.currentPassword", new DOM("#Dialogs_Thread_<API key>).value);
new DOM("$IFrame.mdl-layout__content").src = new DOM("#<API key>").value;
new DOM("#<API key>").value = "",
new DOM("#Dialogs_Thread_<API key>).value = "";
} else {
new DOM("#Dialogs_Thread_<API key>).classList.add("is-invalid");
}
});
new DOM("#Dialogs_Thread_<API key>).addEventListener("click", (event) => {
new DOM("$IFrame.mdl-layout__content").src = "/SimpleThread/Thread/";
});
watchers["<API key>"] = {
valueObj: { value: "0" },
watcher: null
}; watchers["<API key>"].watcher = new DOM.Watcher({
target: watchers["<API key>"].valueObj,
onGet: () => { watchers["<API key>"].valueObj.value = new DOM("#<API key>").value },
onChange: (watcher) => {
base.Database.get(base.Database.ONCE, `threads/${watcher.newValue}`, (res) => {
new DOM("#<API key>").textContent = res.title,
new DOM("#<API key>").textContent = res.overview,
new DOM("#<API key>").textContent = res.detail;
URL.filter(new DOM("#<API key>").textContent).forEach((urlString) => {
new DOM("#<API key>").innerHTML = new DOM("#<API key>").innerHTML.replace(urlString, `<A Href = "${urlString}" Target = "_blank">${urlString}</A>`);
});
URL.filter(new DOM("#<API key>").textContent).forEach((urlString) => {
new DOM("#<API key>").innerHTML = new DOM("#<API key>").innerHTML.replace(urlString, `<A Href = "${urlString}" Target = "_blank">${urlString}</A>`);
});
});
}
});
new DOM("#<API key>").addEventListener("click", () => {
new DOM("#<API key>").showModal();
});
new DOM("#<API key>").addEventListener("click", () => {
new DOM("#<API key>").close();
let picker = new Picker.PhotoPicker(data => {
console.log(data);
switch (data[google.picker.Response.ACTION]) {
case google.picker.Action.CANCEL:
case google.picker.Action.PICKED:
new DOM("#<API key>").showModal();
break;
}
});
picker.show();
});
new DOM("#<API key>").addEventListener("click", () => {
new DOM("#<API key>").close();
let picker = new Picker.FilePicker(data => {
console.log(data);
switch (data[google.picker.Response.ACTION]) {
case google.picker.Action.CANCEL:
case google.picker.Action.PICKED:
new DOM("#<API key>").showModal();
break;
}
});
picker.show();
});
new DOM("#<API key>").addEventListener("keydown", (event) => {
let inputter = event.target;
let selectionStart = inputter.selectionStart,
selectionEnd = inputter.selectionEnd;
switch (event.keyCode) {
case 9:
event.preventDefault();
inputter.value = `${inputter.value.slice(0, selectionStart)}\t${inputter.value.slice(selectionEnd)}`;
inputter.setSelectionRange(selectionStart + 1, selectionStart + 1);
new DOM("#<API key>").classList.add("is-dirty");
break;
}
});
new DOM("#<API key>").addEventListener("click", (event) => {
base.Database.transaction("threads/" + new DOM("#<API key>").value + "/data", (res) => {
base.Database.set("threads/" + new DOM("#<API key>").value + "/data/" + res.length, {
uid: base.user.uid,
content: new DOM("#<API key>").value,
createdAt: new Date().getTime()
});
new DOM("#<API key>").classList.add("<API key>"),
new DOM("#<API key>").classList.remove("is-dirty"),
new DOM("#<API key>").value = "";
new DOM("#Page").contentDocument.querySelector("#<API key>").removeAttribute("Disabled");
new DOM("#<API key>").close();
});
});
new DOM("#<API key>").addEventListener("click", () => {
new DOM("#<API key>").classList.add("<API key>"),
new DOM("#<API key>").classList.remove("is-dirty"),
new DOM("#<API key>").value = "";
new DOM("#Page").contentDocument.querySelector("#<API key>").removeAttribute("Disabled");
});
for (let watcherName in watchers) DOM.Watcher.addWatcher(watchers[watcherName].watcher);
});
|
{% extends "happyapp/base.html" %}
{% load i18n %}
{% block title %}{% trans "Good for you, continue beeing happy :D" %}{% endblock %}
{% block content %}
<h1 class="ok">
{% blocktrans %}
Good for you, continue beeing happy, you are doing it ok.
{% endblocktrans %}
</h1>
{% include "happyapp/makead.html" %}
{% endblock %}
|
package com.simplyian.superplots.actions;
import static org.mockito.Matchers.contains;
import static org.mockito.Mockito.verify;
import static org.powermock.api.mockito.PowerMockito.mock;
import static org.powermock.api.mockito.PowerMockito.when;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.simplyian.superplots.EconHook;
import com.simplyian.superplots.SPSettings;
import com.simplyian.superplots.SuperPlotsPlugin;
import com.simplyian.superplots.plot.Plot;
import com.simplyian.superplots.plot.PlotManager;
public class ActionWithdrawTest {
private SuperPlotsPlugin main;
private ActionWithdraw action;
private PlotManager plotManager;
private Player player;
private EconHook econ;
@Before
public void setup() {
main = mock(SuperPlotsPlugin.class);
action = new ActionWithdraw(main);
econ = mock(EconHook.class);
when(main.getEconomy()).thenReturn(econ);
plotManager = mock(PlotManager.class);
when(main.getPlotManager()).thenReturn(plotManager);
SPSettings settings = mock(SPSettings.class);
when(main.getSettings()).thenReturn(settings);
when(settings.<API key>()).thenReturn(1.5);
when(settings.getInitialPlotSize()).thenReturn(10);
player = mock(Player.class);
when(player.getName()).thenReturn("albireox");
}
@After
public void tearDown() {
main = null;
action = null;
plotManager = null;
player = null;
}
@Test
public void <API key>() {
World world = mock(World.class);
Location playerLoc = new Location(world, 0, 0, 0);
when(plotManager.getPlotAt(playerLoc)).thenReturn(null);
List<String> args = Arrays.asList("asdf");
action.perform(player, args);
verify(player).sendMessage(contains("not in a plot"));
}
@Test
public void <API key>() {
World world = mock(World.class);
Location playerLoc = new Location(world, 0, 0, 0);
when(player.getLocation()).thenReturn(playerLoc);
Plot plot = mock(Plot.class);
when(plotManager.getPlotAt(playerLoc)).thenReturn(plot);
when(plot.isAdministrator("albireox")).thenReturn(false);
when(player.getName()).thenReturn("albireox");
List<String> args = Arrays.asList();
action.perform(player, args);
verify(player).sendMessage(contains("must be an administrator"));
}
@Test
public void <API key>() {
World world = mock(World.class);
Location playerLoc = new Location(world, 0, 0, 0);
when(player.getLocation()).thenReturn(playerLoc);
Plot plot = mock(Plot.class);
when(plotManager.getPlotAt(playerLoc)).thenReturn(plot);
when(plot.isAdministrator("albireox")).thenReturn(true);
when(player.getName()).thenReturn("albireox");
List<String> args = Arrays.asList();
action.perform(player, args);
verify(player).sendMessage(contains("did not specify"));
}
@Test
public void <API key>() {
World world = mock(World.class);
Location playerLoc = new Location(world, 0, 0, 0);
when(player.getLocation()).thenReturn(playerLoc);
Plot plot = mock(Plot.class);
when(plotManager.getPlotAt(playerLoc)).thenReturn(plot);
when(plot.isAdministrator("albireox")).thenReturn(true);
when(player.getName()).thenReturn("albireox");
when(econ.getBalance("albireox")).thenReturn(200.0);
List<String> args = Arrays.asList("400x");
action.perform(player, args);
verify(player).sendMessage(contains("not a valid amount"));
}
@Test
public void <API key>() {
World world = mock(World.class);
Location playerLoc = new Location(world, 0, 0, 0);
when(player.getLocation()).thenReturn(playerLoc);
Plot plot = mock(Plot.class);
when(plotManager.getPlotAt(playerLoc)).thenReturn(plot);
when(plot.isAdministrator("albireox")).thenReturn(true);
when(player.getName()).thenReturn("albireox");
when(plot.getFunds()).thenReturn(200);
List<String> args = Arrays.asList("400");
action.perform(player, args);
verify(player).sendMessage(contains("doesn't have that much money"));
}
@Test
public void <API key>() {
World world = mock(World.class);
Location playerLoc = new Location(world, 0, 0, 0);
when(player.getLocation()).thenReturn(playerLoc);
Plot plot = mock(Plot.class);
when(plotManager.getPlotAt(playerLoc)).thenReturn(plot);
when(plot.isAdministrator("albireox")).thenReturn(true);
when(player.getName()).thenReturn("albireox");
when(plot.getFunds()).thenReturn(400);
List<String> args = Arrays.asList("400");
action.perform(player, args);
verify(player).sendMessage(contains("has been withdrawn"));
verify(plot).subtractFunds(400);
verify(econ).addBalance("albireox", 400);
}
}
|
# -*- encoding: utf-8 -*-
from . import res_partner_bank
from . import <API key>
|
import {login, signup} from '../../src/app/actions/authActions';
import ActionsConstants from '../../src/common/constants/actionsConstants';
describe('auth actions', () => {
describe('if we create a login action', () => {
let userId = 'TestUser';
it('should generate action with payload', () => {
expect(login(userId)).toEqual({
type: ActionsConstants.Login,
payload: userId
});
});
});
describe('if we create a login action without a userId', () => {
const error = new TypeError('not a string');
it('should fail', () => {
expect(login(error)).toEqual({
type: ActionsConstants.Login,
payload: error,
error: true
});
});
});
describe('if we create a signup action', () => {
it('should generate action with payload', () => {
expect(signup()).toEqual({
type: ActionsConstants.SignUp
});
});
});
});
|
"""
Tests course_creators.admin.py.
"""
from django.test import TestCase
from django.contrib.auth.models import User
from django.contrib.admin.sites import AdminSite
from django.http import HttpRequest
import mock
from course_creators.admin import CourseCreatorAdmin
from course_creators.models import CourseCreator
from django.core import mail
from student.roles import CourseCreatorRole
from student import auth
def <API key>(template_name, context):
"""Return a string that encodes template_name and context"""
return str((template_name, context))
class <API key>(TestCase):
"""
Tests for course creator admin.
"""
def setUp(self):
""" Test case setup """
super(<API key>, self).setUp()
self.user = User.objects.create_user('test_user', 'test_user+courses@edx.org', 'foo')
self.table_entry = CourseCreator(user=self.user)
self.table_entry.save()
self.admin = User.objects.create_user('Mark', 'admin+courses@edx.org', 'foo')
self.admin.is_staff = True
self.request = HttpRequest()
self.request.user = self.admin
self.creator_admin = CourseCreatorAdmin(self.table_entry, AdminSite())
self.<API key> = 'mark@marky.mark'
self.<API key> = {
"<API key>": True,
"<API key>": self.<API key>
}
@mock.patch('course_creators.admin.render_to_string', mock.Mock(side_effect=<API key>, autospec=True))
@mock.patch('django.contrib.auth.models.User.email_user')
def test_change_status(self, email_user):
"""
Tests that updates to state impact the creator group maintained in authz.py and that e-mails are sent.
"""
def <API key>(state, is_creator):
""" Changes user state, verifies creator status, and verifies e-mail is sent based on transition """
self._change_state(state)
self.assertEqual(is_creator, auth.user_has_role(self.user, CourseCreatorRole()))
context = {'<API key>': self.<API key>}
if state == CourseCreator.GRANTED:
template = 'emails/<API key>.txt'
elif state == CourseCreator.DENIED:
template = 'emails/<API key>.txt'
else:
template = 'emails/<API key>.txt'
email_user.assert_called_with(
<API key>('emails/<API key>.txt', context),
<API key>(template, context),
self.<API key>
)
with mock.patch.dict('django.conf.settings.FEATURES', self.<API key>):
# User is initially unrequested.
self.assertFalse(auth.user_has_role(self.user, CourseCreatorRole()))
<API key>(CourseCreator.GRANTED, True)
<API key>(CourseCreator.DENIED, False)
<API key>(CourseCreator.GRANTED, True)
<API key>(CourseCreator.PENDING, False)
<API key>(CourseCreator.GRANTED, True)
<API key>(CourseCreator.UNREQUESTED, False)
<API key>(CourseCreator.DENIED, False)
@mock.patch('course_creators.admin.render_to_string', mock.Mock(side_effect=<API key>, autospec=True))
def <API key>(self):
"""
Tests that the admin account is notified when a user is in the 'pending' state.
"""
def <API key>(state, <API key>, expect_sent_to_user):
""" Changes user state and verifies e-mail sent to admin address only when pending. """
mail.outbox = []
self._change_state(state)
# If a message is sent to the user about course creator status change, it will be the first
# message sent. Admin message will follow.
base_num_emails = 1 if expect_sent_to_user else 0
if <API key>:
context = {'user_name': "test_user", 'user_email': u'test_user+courses@edx.org'}
self.assertEquals(base_num_emails + 1, len(mail.outbox), 'Expected admin message to be sent')
sent_mail = mail.outbox[base_num_emails]
self.assertEquals(
<API key>('emails/<API key>.txt', context),
sent_mail.subject
)
self.assertEquals(
<API key>('emails/<API key>.txt', context),
sent_mail.body
)
self.assertEquals(self.<API key>, sent_mail.from_email)
self.assertEqual([self.<API key>], sent_mail.to)
else:
self.assertEquals(base_num_emails, len(mail.outbox))
with mock.patch.dict('django.conf.settings.FEATURES', self.<API key>):
# E-mail message should be sent to admin only when new state is PENDING, regardless of what
# previous state was (unless previous state was already PENDING).
# E-mail message sent to user only on transition into and out of GRANTED state.
<API key>(CourseCreator.UNREQUESTED, <API key>=False, expect_sent_to_user=False)
<API key>(CourseCreator.PENDING, <API key>=True, expect_sent_to_user=False)
<API key>(CourseCreator.GRANTED, <API key>=False, expect_sent_to_user=True)
<API key>(CourseCreator.DENIED, <API key>=False, expect_sent_to_user=True)
<API key>(CourseCreator.GRANTED, <API key>=False, expect_sent_to_user=True)
<API key>(CourseCreator.PENDING, <API key>=True, expect_sent_to_user=True)
<API key>(CourseCreator.PENDING, <API key>=False, expect_sent_to_user=False)
<API key>(CourseCreator.DENIED, <API key>=False, expect_sent_to_user=True)
def _change_state(self, state):
""" Helper method for changing state """
self.table_entry.state = state
self.creator_admin.save_model(self.request, self.table_entry, None, True)
def test_add_permission(self):
"""
Tests that staff cannot add entries
"""
self.assertFalse(self.creator_admin.has_add_permission(self.request))
def <API key>(self):
"""
Tests that staff cannot delete entries
"""
self.assertFalse(self.creator_admin.<API key>(self.request))
def <API key>(self):
"""
Tests that only staff can change entries
"""
self.assertTrue(self.creator_admin.<API key>(self.request))
self.request.user = self.user
self.assertFalse(self.creator_admin.<API key>(self.request))
|
<?php
$mod_strings = array_merge($mod_strings,
array(
'<API key>' => "Não Herdável",
)
);
?>
|
DELETE FROM `weenie` WHERE `class_Id` = 14030;
INSERT INTO `weenie` (`class_Id`, `class_Name`, `type`, `last_Modified`)
VALUES (14030, 'housecottage2338', 53, '2019-02-10 00:00:00') /* House */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (14030, 1, 128) /* ItemType - Misc */
, (14030, 5, 10) /* EncumbranceVal */
, (14030, 16, 1) /* ItemUseable - No */
, (14030, 93, 52) /* PhysicsState - Ethereal, IgnoreCollisions, NoDraw */
, (14030, 155, 1) /* HouseType - Cottage */
, (14030, 8041, 101) /* <API key> - Resting */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (14030, 1, True ) /* Stuck */
, (14030, 24, True ) /* UiHidden */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (14030, 39, 0.1) /* DefaultScale */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (14030, 1, 'Cottage') /* Name */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (14030, 1, 0x02000A42) /* Setup */
, (14030, 8, 0x06002181) /* Icon */
, (14030, 30, 152) /* PhysicsScript - <API key> */
, (14030, 8001, 203423760) /* <API key> - Usable, Burden, HouseRestrictions, PScript */
, (14030, 8003, 148) /* <API key> - Stuck, Attackable, UiHidden */
, (14030, 8005, 163969) /* <API key> - CSetup, ObjScale, Position, AnimationFrame */;
INSERT INTO `<API key>` (`object_Id`, `position_Type`, `obj_Cell_Id`, `origin_X`, `origin_Y`, `origin_Z`, `angles_W`, `angles_X`, `angles_Y`, `angles_Z`)
VALUES (14030, 8040, 0x6B8E0112, 33.9241, 135.967, 17.9995, -0.66963, 0, 0, -0.742695) /* <API key> */
/* @teleloc 0x6B8E0112 [33.924100 135.967000 17.999500] -0.669630 0.000000 0.000000 -0.742695 */;
INSERT INTO `<API key>` (`object_Id`, `type`, `value`)
VALUES (14030, 8000, 0x76B8E1A2) /* <API key> */;
|
<?php
namespace Isbn;
/**
* Validation.
*/
class Validation
{
/**
* Check Instance.
*
* @var Check
*/
private $check;
/**
* Hyphens Instance.
*
* @var Hyphens
*/
private $hyphens;
/**
* Constructor.
*
* @param Check $check
* @param Hyphens $hyphens
*/
public function __construct(Check $check, Hyphens $hyphens)
{
$this->check = $check;
$this->hyphens = $hyphens;
}
/**
* Validate the ISBN $isbn.
*
* @param string $isbn
*
* @return bool
*/
public function isbn($isbn)
{
if ($this->check->is13($isbn)) {
return $this->isbn13($isbn);
}
if ($this->check->is10($isbn)) {
return $this->isbn10($isbn);
}
return false;
}
/**
* Validate the ISBN-10 $isbn.
*
* @param string $isbn
*
* @throws Exception
*
* @return bool
*/
public function isbn10($isbn)
{
if (\is_string($isbn) === false) {
throw new Exception('Invalid parameter type.');
}
//Verify ISBN-10 scheme
$isbn = $this->hyphens->removeHyphens($isbn);
if (\strlen($isbn) != 10) {
return false;
}
if (\preg_match('/\d{9}[0-9xX]/i', $isbn) == false) {
return false;
}
//Verify checksum
$check = 0;
for ($i = 0; $i < 10; $i++) {
if (\strtoupper($isbn[$i]) === 'X') {
$check += 10 * \intval(10 - $i);
} else {
$check += \intval($isbn[$i]) * \intval(10 - $i);
}
}
return $check % 11 === 0;
}
/**
* Validate the ISBN-13 $isbn.
*
* @param string $isbn
*
* @throws Exception
*
* @return bool
*/
public function isbn13($isbn)
{
if (\is_string($isbn) === false) {
throw new Exception('Invalid parameter type.');
}
//Verify ISBN-13 scheme
$isbn = $this->hyphens->removeHyphens($isbn);
if (\strlen($isbn) != 13) {
return false;
}
if (\preg_match('/\d{13}/i', $isbn) == false) {
return false;
}
//Verify checksum
$check = 0;
for ($i = 0; $i < 13; $i += 2) {
$check += \substr($isbn, $i, 1);
}
for ($i = 1; $i < 12; $i += 2) {
$check += 3 * \substr($isbn, $i, 1);
}
return $check % 10 === 0;
}
}
|
import unittest
from app import read_config
class <API key>(unittest.TestCase):
def test_read(self):
config = read_config('config')
self.assertEqual(config['cmus_host'], 'raspberry')
self.assertEqual(config['cmus_passwd'], 'PaSsWd')
self.assertEqual(config['app_host'], 'localhost')
self.assertEqual(config['app_port'], '8080')
if __name__ == '__main__':
unittest.main()
|
#global-loading {
width: 100%;
height: 100%;
}
#undo-container {
position: fixed;
top: 0px;
width: 100%;
text-align: center;
z-index: 101;
line-height: 1.2;
}
#undo {
z-index:101;
background-color:#fc4;
border:0;
padding:0 .7em .3em;
display:none;
position: relative;
top:0;
<API key>:1em;
<API key>:1em;
}
#undo a {
font-weight: bold;
}
#undo a:hover {
text-decoration: underline;
}
|
chunker_bully = Creature:new {
objectName = "@mob/creature_names:chunker_bully",
randomNameType = NAME_GENERIC_TAG,
socialGroup = "chunker",
faction = "thug",
level = 10,
chanceHit = 0.280000,
damageMin = 90,
damageMax = 110,
baseXp = 356,
baseHAM = 810,
baseHAMmax = 990,
armor = 0,
resists = {0,0,0,0,0,0,0,-1,-1},
meatType = "",
meatAmount = 0,
hideType = "",
hideAmount = 0,
boneType = "",
boneAmount = 0,
milk = 0,
tamingChance = 0.000000,
ferocity = 0,
pvpBitmask = ATTACKABLE,
creatureBitmask = PACK + STALKER,
diet = HERBIVORE,
templates = {"object/mobile/dressed_mugger.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/<API key>.iff",
"object/mobile/dressed_mugger.iff"},
lootGroups = {
{
groups = {
{group = "junk", chance = 1200000},
{group = "rifles", chance = 700000},
{group = "melee_knife", chance = 700000},
{group = "pistols", chance = 700000},
{group = "carbines", chance = 700000},
{group = "chunker_common", chance = 6000000},
}
}
},
weapons = {"ranged_weapons"},
reactionStf = "@npc_reaction/slang",
attacks = merge(marksmannovice,brawlernovice)
}
CreatureTemplates:addCreatureTemplate(chunker_bully, "chunker_bully")
|
# <API key>: true
require 'ffaker'
FactoryBot.define do
sequence(:random_string) { FFaker::Lorem.sentence }
sequence(:random_description) { FFaker::Lorem.paragraphs(Kernel.rand(1..5)).join("\n") }
sequence(:random_email) { FFaker::Internet.email }
factory :classification, class: Spree::Classification do
end
factory :exchange, class: Exchange do
incoming { false }
order_cycle { OrderCycle.first || FactoryBot.create(:simple_order_cycle) }
sender { incoming ? FactoryBot.create(:enterprise) : order_cycle.coordinator }
receiver { incoming ? order_cycle.coordinator : FactoryBot.create(:enterprise) }
end
factory :schedule, class: Schedule do
sequence(:name) { |n| "Schedule
transient do
order_cycles { [OrderCycle.first || create(:simple_order_cycle)] }
end
before(:create) do |schedule, evaluator|
evaluator.order_cycles.each do |order_cycle|
order_cycle.schedules << schedule
end
end
end
factory :proxy_order, class: ProxyOrder do
subscription
order_cycle { subscription.order_cycles.first }
before(:create) do |proxy_order, _proxy|
proxy_order.order&.update_attribute(:order_cycle_id, proxy_order.order_cycle_id)
end
end
factory :variant_override, class: VariantOverride do
price { 77.77 }
on_demand { false }
count_on_hand { 11_111 }
default_stock { 2000 }
resettable { false }
trait :on_demand do
on_demand { true }
count_on_hand { nil }
end
trait :<API key> do
on_demand { nil }
count_on_hand { nil }
end
end
factory :inventory_item, class: InventoryItem do
enterprise
variant
visible { true }
end
factory :<API key> do
end
factory :enterprise_role do
end
factory :enterprise_group, class: EnterpriseGroup do
name { 'Enterprise group' }
sequence(:permalink) { |n| "group
description { 'this is a group' }
on_front_page { false }
address { FactoryBot.build(:address) }
end
factory :enterprise_fee, class: EnterpriseFee do
transient { amount { nil } }
sequence(:name) { |n| "Enterprise fee
sequence(:fee_type) { |n| EnterpriseFee::FEE_TYPES[n % EnterpriseFee::FEE_TYPES.count] }
enterprise { Enterprise.first || FactoryBot.create(:supplier_enterprise) }
calculator { build(:calculator_per_item, preferred_amount: amount) }
after(:create) { |ef| ef.calculator.save! }
trait :flat_rate do
transient { amount { 1 } }
calculator { build(:<API key>, preferred_amount: amount) }
end
trait :per_item do
transient { amount { 1 } }
calculator { build(:calculator_per_item, preferred_amount: amount) }
end
end
factory :adjustment_metadata, class: AdjustmentMetadata do
adjustment { FactoryBot.create(:adjustment) }
enterprise { FactoryBot.create(:<API key>) }
fee_name { 'fee' }
fee_type { 'packing' }
enterprise_role { 'distributor' }
end
factory :producer_property, class: ProducerProperty do
value { 'abc123' }
producer { create(:supplier_enterprise) }
property
end
factory :stripe_account do
enterprise { FactoryBot.create(:<API key>) }
stripe_user_id { "abc123" }
<API key> { "xyz456" }
end
end
|
module CC::Exporter::Epub
module Exportable
def content_cartridge
self.attachment
end
def convert_to_epub(opts={})
exporter = CC::Exporter::Epub::Exporter.new(content_cartridge.open, opts[:sort_by_content])
epub = CC::Exporter::Epub::Book.new(exporter.templates)
epub.create
end
end
end
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Netto-Lohn</title>
<meta name="viewport" content="user-scalable=no">
<link rel="stylesheet" href="../shared/css/export-email.css">
<script src="../shared/config.js" defer></script>
<script src="../dojotoolkit/dojo/dojo.js" defer></script>
<script src="export-email.js" defer></script>
</head>
<body>
</body>
</html>
|
#ifndef <API key>
#define <API key>
#include <stdio.h>
#include <limits.h>
#include "Types.h"
#include "../../Common/kernel_config.h"
namespace NSBase64
{
const int <API key> = 0;
const int <API key> = 1;
const int <API key> = 2;
#define _BASE64_INT_MAX 2147483647
KERNEL_DECL int <API key>(int nSrcLen, DWORD dwFlags = <API key>);
KERNEL_DECL int <API key>(int nSrcLen);
KERNEL_DECL int Base64Encode(const BYTE *pbSrcData, int nSrcLen, BYTE* szDest, int *pnDestLen, DWORD dwFlags = <API key>);
KERNEL_DECL int DecodeBase64Char(unsigned int ch);
KERNEL_DECL int Base64Decode(const char* szSrc, int nSrcLen, BYTE *pbDest, int *pnDestLen);
}
#endif//<API key>
|
#ifndef WDTFILE_H
#define WDTFILE_H
#include "mpq_libmpq04.h"
#include <string>
class ADTFile;
class WDTFile
{
public:
WDTFile(char* file_name, char* file_name1);
~WDTFile(void);
bool init(char* map_id, unsigned int mapID);
ADTFile* GetMap(int x, int z);
std::string* gWmoInstansName;
int gnWMO;
private:
MPQFile WDT;
std::string filename;
};
#endif //WDTFILE_H
|
from django.conf.urls.defaults import *
import frontend.views as frontend_views
import codewiki.views
import codewiki.viewsuml
from django.contrib.syndication.views import feed as feed_view
from django.views.generic import date_based, list_detail
from django.views.generic.simple import direct_to_template
from django.contrib import admin
import django.contrib.auth.views as auth_views
from django.conf import settings
from django.core.urlresolvers import reverse
from django.http import <API key>, <API key>
from django.contrib import admin
admin.autodiscover()
# Need to move this somewhere more useful and try to make it less hacky but
# seems to be the easiest way unfortunately.
from django.contrib.auth.models import User
User._meta.ordering = ['username']
from frontend.feeds import LatestCodeObjects, <API key>, <API key>, LatestViewObjects, <API key>
feeds = {
'all_code_objects': LatestCodeObjects,
'all_scrapers': <API key>,
'all_views': LatestViewObjects,
'<API key>': <API key>,
'<API key>': <API key>,
}
urlpatterns = patterns('',
url(r'^$', frontend_views.frontpage, name="frontpage"),
# redirects from old version (would clashes if you happen to have a scraper whose name is list!)
(r'^scrapers/list/$', lambda request: <API key>(reverse('<API key>', args=['scraper']))),
url(r'^', include('codewiki.urls')),
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name="logout"),
url(r'^accounts/', include('registration.urls')),
url(r'^accounts/<API key>/', frontend_views.<API key>, name="<API key>"),
url(r'^captcha/', include('captcha.urls')),
url(r'^attachauth', codewiki.views.attachauth),
# allows direct viewing of the django tables
url(r'^admin/', include(admin.site.urls)),
# favicon
(r'^favicon\.ico$', 'django.views.generic.simple.redirect_to', {'url': '/media/images/favicon.ico'}),
# RSS feeds
url(r'^feeds/(?P<url>.*)/$', 'django.contrib.syndication.views.feed', {'feed_dict': feeds}, name='feeds'),
# API
(r'^api/', include('api.urls', namespace='foo', app_name='api')),
# Status
url(r'^status/$', codewiki.viewsuml.status, name='status'),
# Documentation
(r'^docs/', include('documentation.urls')),
# Robots.txt
(r'^robots.txt$', direct_to_template, {'template': 'robots.txt', 'mimetype': 'text/plain'}),
# pdf cropper technology
(r'^cropper/', include('cropper.urls')),
# froth
(r'^froth/', include('froth.urls')),
# static media server for the dev sites / local dev
url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_DIR, 'show_indexes':True}),
url(r'^media-admin/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ADMIN_DIR, 'show_indexes':True}),
#Rest of the site
url(r'^', include('frontend.urls')),
# redirects from old version
(r'^editor/$', lambda request: <API key>('/scrapers/new/python?template=<API key>')),
(r'^scrapers/show/(?P<short_name>[\w_\-]+)/(?:data/|map-only/)?$',
lambda request, short_name: <API key>(reverse('code_overview', args=['scraper', short_name]))),
)
|
function timenow(){
var timenow1 = Date.getHours();
return timenow1;
}
|
<!-- | FUNCTION show page to edit account -->
<?php
function $$$showEditAccount () {
global $TSunic;
// activate template
$data = array('User' => $TSunic->Usr);
$TSunic->Tmpl->activate('$$$showEditAccount', '$system$content', $data);
$TSunic->Tmpl->activate('$system$html', false, array('title' => '{<API key>}'));
return true;
}
?>
|
package cz.plichtanet.honza;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.<API key>;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.<API key>;
import org.springframework.security.crypto.bcrypt.<API key>;
import org.springframework.security.crypto.password.PasswordEncoder;
import javax.sql.DataSource;
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends <API key> {
@Autowired
private DataSource dataSource;
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
/*
// pro lokalni testovani bez databaze
auth
.<API key>()
.withUser("jenda").password("604321192").roles("USER","PDF_USER","ADMIN");
*/
PasswordEncoder encoder = passwordEncoder();
auth.jdbcAuthentication().dataSource(dataSource).passwordEncoder(encoder)
/*
.withUser("petra").password(encoder.encode("737438719")).roles("USER")
.and()
.withUser("kuba").password(encoder.encode("737438719")).roles("USER")
.and()
.withUser("jenda").password(encoder.encode("604321192")).roles("USER","ADMIN")
*/
;
}
@Bean
public PasswordEncoder passwordEncoder() {
return new <API key>();
}
}
|
'use strict';
angular.module('cheeperApp')
.controller('AuthCtrl', function ($scope, $http) {
$scope.signin = function() {
$http
.post('http://127.0.0.1:8000/auth-token/', $scope.credentials)
.success(function(data, status, headers, config) {
$scope.token = data.token;
})
.error(function(data, status, headers, config) {
console.log(data);
});
};
});
|
<?php
//Harvie's PHP HTTP-Auth script (2oo7-2o1o)
//CopyLefted4U ;)
SETTINGS
//Login
/*$realm = 'music'; //This is used by browser to identify protected area and saving passwords (one_site+one_realm==one_user+one_password)
$users = array( //You can specify multiple users in this array
'music' => 'passw'
);*/
//Misc
$require_login = true; //Require login? (if false, no login needed) - WARNING!!!
$location = '401'; //Location after logout - 401 = default logout page (can be overridden by ?logout=[LOCATION])
//CopyLeft
$ver = '2o1o-3.9';
$link = '<a href="https://blog.harvie.cz/">blog.harvie.cz</a>';
$banner = "Harvie's PHP HTTP-Auth script (v$ver)";
$hbanner = "<hr /><i>$banner\n-\n$link</i>\n";
$cbanner = "<!-- $banner -->\n";
//Config file
@include('./_config.php');
//MANUAL/////////////////////////////////////////////////////////////////////////////////////////////////////////
/* HOWTO
* To each file, you want to lock add this line (at begin of first line - Header-safe):
* <?php require_once('http_auth.php'); ?> //Password Protection 8')
* Protected file have to be php script (if it's html, simply rename it to .php)
* Server needs to have PHP as module (not CGI).
* You need HTTP Basic auth enabled on server and php.
*/
/CODE
function send_auth_headers($realm='') {
Header('WWW-Authenticate: Basic realm="'.$realm.'"');
Header('HTTP/1.0 401 Unauthorized');
}
function check_auth($PHP_AUTH_USER, $PHP_AUTH_PW) { //Check if login is succesfull (U can modify this to use DB, or anything else)
return (isset($GLOBALS['users'][$PHP_AUTH_USER]) && ($GLOBALS['users'][$PHP_AUTH_USER] == $PHP_AUTH_PW));
}
function unauth() { //Do this when login fails
$cbanner = $GLOBALS['cbanner'];
$hbanner = $GLOBALS['hbanner'];
die("$cbanner<title>401 - Forbidden</title>\n<h1>401 - Forbidden</h1>\n<a href=\"?\">Login...</a>\n$hbanner"); //Show warning and die
die(); //Don't forget!!!
}
//Backward compatibility
if(isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_PW'] != '') $PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER'];
if(isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] != '') $PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];
//Logout
if(isset($_GET['logout'])) { //script.php?logout
if(isset($PHP_AUTH_USER) || isset($PHP_AUTH_PW)) {
Header('WWW-Authenticate: Basic realm="'.$realm.'"');
Header('HTTP/1.0 401 Unauthorized');
} else {
if($_GET['logout'] != '') $location = $_GET['logout'];
if(trim($location) != '401') Header('Location: '.$location);
die("$cbanner<title>401 - Log out successfull</title>\n<h1>401 - Log out successfull</h1>\n<a href=\"?\">Continue...</a>\n$hbanner");
}
}
if($require_login) {
if(!isset($PHP_AUTH_USER)) { //Storno or first visit of page
send_auth_headers($realm);
unauth();
} else { //Login sent
if (check_auth($PHP_AUTH_USER, $PHP_AUTH_PW)) { //Login succesfull - probably do nothing
} else { //Bad login
send_auth_headers($realm);
unauth();
}
}
}
//Rest of file will be displayed only if login is correct
|
/* $OpenBSD: bcrypt_pbkdf.c,v 1.4 2013/07/29 00:55:53 tedu Exp $ */
#ifndef HAVE_BCRYPT_PBKDF
#include "libssh2_priv.h"
#include <stdlib.h>
#include <sys/types.h>
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
#include "blf.h"
#define MINIMUM(a,b) (((a) < (b)) ? (a) : (b))
/*
* pkcs #5 pbkdf2 implementation using the "bcrypt" hash
*
* The bcrypt hash function is derived from the bcrypt password hashing
* function with the following modifications:
* 1. The input password and salt are preprocessed with SHA512.
* 2. The output length is expanded to 256 bits.
* 3. Subsequently the magic string to be encrypted is lengthened and modified
* to "<API key>"
* 4. The hash function is defined to perform 64 rounds of initial state
* expansion. (More rounds are performed by iterating the hash.)
*
* Note that this implementation pulls the SHA512 operations into the caller
* as a performance optimization.
*
* One modification from official pbkdf2. Instead of outputting key material
* linearly, we mix it. pbkdf2 has a known weakness where if one uses it to
* generate (i.e.) 512 bits of key material for use as two 256 bit keys, an
* attacker can merely run once through the outer loop below, but the user
* always runs it twice. Shuffling output bytes requires computing the
* entirety of the key material to assemble any subkey. This is something a
* wise caller could do; we just do it for you.
*/
#define BCRYPT_BLOCKS 8
#define BCRYPT_HASHSIZE (BCRYPT_BLOCKS * 4)
static void
bcrypt_hash(uint8_t *sha2pass, uint8_t *sha2salt, uint8_t *out)
{
blf_ctx state;
uint8_t ciphertext[BCRYPT_HASHSIZE] =
"<API key>";
uint32_t cdata[BCRYPT_BLOCKS];
int i;
uint16_t j;
size_t shalen = <API key>;
/* key expansion */
Blowfish_initstate(&state);
<API key>(&state, sha2salt, shalen, sha2pass, shalen);
for(i = 0; i < 64; i++) {
<API key>(&state, sha2salt, shalen);
<API key>(&state, sha2pass, shalen);
}
/* encryption */
j = 0;
for(i = 0; i < BCRYPT_BLOCKS; i++)
cdata[i] = <API key>(ciphertext, sizeof(ciphertext),
&j);
for(i = 0; i < 64; i++)
blf_enc(&state, cdata, sizeof(cdata) / sizeof(uint64_t));
/* copy out */
for(i = 0; i < BCRYPT_BLOCKS; i++) {
out[4 * i + 3] = (cdata[i] >> 24) & 0xff;
out[4 * i + 2] = (cdata[i] >> 16) & 0xff;
out[4 * i + 1] = (cdata[i] >> 8) & 0xff;
out[4 * i + 0] = cdata[i] & 0xff;
}
/* zap */
<API key>(ciphertext, sizeof(ciphertext));
<API key>(cdata, sizeof(cdata));
<API key>(&state, sizeof(state));
}
int
bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt,
size_t saltlen,
uint8_t *key, size_t keylen, unsigned int rounds)
{
uint8_t sha2pass[<API key>];
uint8_t sha2salt[<API key>];
uint8_t out[BCRYPT_HASHSIZE];
uint8_t tmpout[BCRYPT_HASHSIZE];
uint8_t *countsalt;
size_t i, j, amt, stride;
uint32_t count;
size_t origkeylen = keylen;
libssh2_sha512_ctx ctx;
/* nothing crazy */
if(rounds < 1)
return -1;
if(passlen == 0 || saltlen == 0 || keylen == 0 ||
keylen > sizeof(out) * sizeof(out) || saltlen > 1<<20)
return -1;
countsalt = calloc(1, saltlen + 4);
if(countsalt == NULL)
return -1;
stride = (keylen + sizeof(out) - 1) / sizeof(out);
amt = (keylen + stride - 1) / stride;
memcpy(countsalt, salt, saltlen);
/* collapse password */
libssh2_sha512_init(&ctx);
<API key>(ctx, pass, passlen);
<API key>(ctx, sha2pass);
/* generate key, sizeof(out) at a time */
for(count = 1; keylen > 0; count++) {
countsalt[saltlen + 0] = (count >> 24) & 0xff;
countsalt[saltlen + 1] = (count >> 16) & 0xff;
countsalt[saltlen + 2] = (count >> 8) & 0xff;
countsalt[saltlen + 3] = count & 0xff;
/* first round, salt is salt */
libssh2_sha512_init(&ctx);
<API key>(ctx, countsalt, saltlen + 4);
<API key>(ctx, sha2salt);
bcrypt_hash(sha2pass, sha2salt, tmpout);
memcpy(out, tmpout, sizeof(out));
for(i = 1; i < rounds; i++) {
/* subsequent rounds, salt is previous output */
libssh2_sha512_init(&ctx);
<API key>(ctx, tmpout, sizeof(tmpout));
<API key>(ctx, sha2salt);
bcrypt_hash(sha2pass, sha2salt, tmpout);
for(j = 0; j < sizeof(out); j++)
out[j] ^= tmpout[j];
}
/*
* pbkdf2 deviation: output the key material non-linearly.
*/
amt = MINIMUM(amt, keylen);
for(i = 0; i < amt; i++) {
size_t dest = i * stride + (count - 1);
if(dest >= origkeylen) {
break;
}
key[dest] = out[i];
}
keylen -= i;
}
/* zap */
<API key>(out, sizeof(out));
free(countsalt);
return 0;
}
#endif /* HAVE_BCRYPT_PBKDF */
|
// This library is free software; you can redistribute it and/or modify
// (version 2.1) as published by the Free Software Foundation.
// This library is distributed in the hope that it will be useful, but
// for more details.
// along with this library; if not, write to the Free Software Foundation, Inc.,
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef <API key>
#define <API key>
/*! \file <API key>.h This file provides types to store results for a familial file.
*/
#include "calvin_files/parameter/src/<API key>.h"
#include "calvin_files/portability/src/AffymetrixBaseTypes.h"
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
namespace <API key>
{
/*! Stores the segment overlap from a familial file. */
typedef struct <API key>
{
/*! The type of segment; the name of the data set in which the segment appears in the CYCHP file. */
std::string segmentType;
/*! The key identifying the sample from the Samples data set. */
u_int32_t referenceSampleKey;
/*! The ID of the segment of the reference sample. */
std::string referenceSegmentID;
/*! The key identifying the sample from the Samples data set. */
u_int32_t familialSampleKey;
/*! The ID of the segment of the compare sample. */
std::string familialSegmentID;
} <API key>;
/*! Stores information about the sample for a familial file. */
typedef struct _FamilialSample
{
/*! Local arbitrary unique sample identifier used within the file. */
u_int32_t sampleKey;
/*! The identifier of the ARR file associated with the sample. If no ARR file was used in generating the associated CYCHP files, this value will be the empty string. */
std::string arrID;
/*! The identifier of the CYCHP file containing the sample data. */
std::string chpID;
/*! The filename (not the complete path) of the CYCHP file containing the sample data. */
std::wstring chpFilename;
std::string role;
/*! The call of whether the assigned role is correct. */
bool roleValidity;
/*! The confidence that the assigned role is correct */
float roleConfidence;
} FamilialSample;
}
#endif
|
#ifndef <API key>
#define <API key>
#include "config.h"
#include <sofa/core/objectmodel/BaseObject.h>
#include <sofa/core/collision/Contact.h>
//#include <sofa/core/collision/DetectionOutput.h>
#include <sofa/helper/vector.h>
//#include <sofa/core/CollisionModel.h>
namespace sofa
{
namespace core
{
// forward declaration
class CollisionModel;
namespace collision
{
// forward declaration
class <API key>;
class <API key> ContactListener : public virtual core::objectmodel::BaseObject
{
public:
SOFA_CLASS(ContactListener, core::objectmodel::BaseObject);
protected:
ContactListener( CollisionModel* collModel1 = NULL, CollisionModel* collModel2 = NULL );
virtual ~ContactListener();
// DetectionOutput iterators
typedef helper::vector<const helper::vector<DetectionOutput>* >::const_iterator <API key>;
typedef helper::vector<DetectionOutput>::const_iterator ContactsIterator;
virtual void beginContact(const helper::vector<const helper::vector<DetectionOutput>* >& ) {}
virtual void endContact(void*) {}
protected:
const CollisionModel* mCollisionModel1;
const CollisionModel* mCollisionModel2;
/ are these SingleLinks necessary ? they are used only in canCreate(...) and create functions(...)
//SingleLink<ContactListener, CollisionModel, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK> <API key>;
// Pointer to the next (finer / lower / child level) CollisionModel in the hierarchy.
//SingleLink<ContactListener, CollisionModel, BaseLink::FLAG_STOREPATH|BaseLink::FLAG_STRONGLINK> <API key>;
private:
helper::vector<const helper::vector<DetectionOutput>* > mContactsVector;
core::collision::<API key>* mNarrowPhase;
public:
virtual void init(void) override;
virtual void handleEvent( core::objectmodel::Event* event ) override;
template<class T>
static bool canCreate(T*& obj, core::objectmodel::BaseContext* context, core::objectmodel::<API key>* arg)
{
core::CollisionModel* collModel1 = NULL;
core::CollisionModel* collModel2 = NULL;
std::string collModelPath1;
std::string collModelPath2;
if (arg->getAttribute("collisionModel1"))
collModelPath1 = arg->getAttribute("collisionModel1");
else
collModelPath1 = "";
context->findLinkDest(collModel1, collModelPath1, NULL);
if (arg->getAttribute("collisionModel2"))
collModelPath2 = arg->getAttribute("collisionModel2");
else
collModelPath2 = "";
context->findLinkDest(collModel2, collModelPath2, NULL);
if (collModel1 == NULL && collModel2 == NULL )
{
context->serr << "Creation of " << className(obj) <<
" CollisonListener failed because no Collision Model links are found: \"" << collModelPath1
<< "\" and \"" << collModelPath2 << "\" " << context->sendl;
return false;
}
return BaseObject::canCreate(obj, context, arg);
}
template<class T>
static typename T::SPtr create(T* , core::objectmodel::BaseContext* context, core::objectmodel::<API key>* arg)
{
CollisionModel* collModel1 = NULL;
CollisionModel* collModel2 = NULL;
std::string collModelPath1;
std::string collModelPath2;
if(arg)
{
collModelPath1 = arg->getAttribute(std::string("collisionModel1"), NULL );
collModelPath2 = arg->getAttribute(std::string("collisionModel2"), NULL );
// now 3 cases
if ( strcmp( collModelPath1.c_str(),"" ) != 0 )
{
context->findLinkDest(collModel1, collModelPath1, NULL);
if ( strcmp( collModelPath2.c_str(),"" ) != 0 )
{
context->findLinkDest(collModel2, collModelPath2, NULL);
}
}
else
{
context->findLinkDest(collModel1, collModelPath2, NULL);
}
}
typename T::SPtr obj = sofa::core::objectmodel::New<T>( collModel1, collModel2 );
//if ( obj )
// obj-><API key>.setPath( collModelPath1 );
// obj-><API key>.setPath( collModelPath2 );
if (context)
{
context->addObject(obj);
}
if (arg)
{
obj->parse(arg);
}
return obj;
}
};
} // namespace collision
} // namespace core
} // namespace sofa
#endif // <API key>
|
#ifndef <API key>
#define <API key>
#include "activatable.h"
namespace Knm
{
class <API key> : public Activatable
{
Q_OBJECT
public:
<API key>(const QString &deviceUni, QObject *parent);
virtual ~<API key>();
};
}
#endif // <API key>
|
#ifndef HIGHSCORE_HPP
#define HIGHSCORE_HPP
#include <cassert>
#include <sstream>
#include "framework.hpp"
#include "./config.hpp"
#include "./media.hpp"
class Highscore
{
public:
Highscore();
~Highscore();
/* Load/Save */
void load();
void save();
/* Access particular difficulties */
util::Highscore &getHighscore(LEVEL_DIFFICULTY difficulty);
/* Draw */
void draw();
private:
/* Data */
util::Timer timer;
util::Highscore highscore[<API key>];
double offset;
int haltstart;
int difficulty;
bool shifting;
struct
{
font::TtfLabel difficulty[<API key>];
font::TtfLabel place[3/*<API key>*/];
font::TtfLabel score[<API key>][3/*<API key>*/];
font::TtfLabel prescore[<API key>][3/*<API key>*/];
}label;
};
#endif // HIGHSCORE_HPP
|
#ifndef TABLE_H
#define TABLE_H 1
#include <stdbool.h>
#include <gpg-error.h>
/* The indexed list type. */
struct scute_table;
typedef struct scute_table *scute_table_t;
/* TABLE interface. */
/* A table entry allocator function callback. Should return the new
table entry in DATA_R. */
typedef gpg_error_t (*<API key>) (void **data_r, void *hook);
/* A table entry deallocator function callback. */
typedef void (*<API key>) (void *data);
/* Allocate a new table and return it in TABLE_R. */
gpg_error_t scute_table_create (scute_table_t *table_r,
<API key> alloc,
<API key> dealloc);
/* Destroy the indexed list TABLE. This also calls the deallocator on
all entries. */
void scute_table_destroy (scute_table_t table);
/* Allocate a new table entry with a free index. Returns the index
pointing to the new list entry in INDEX_R. This calls the
allocator on the new entry before returning. Also returns the
table entry in *DATA_R if this is not NULL. */
gpg_error_t scute_table_alloc (scute_table_t table, int *index_r,
void **data_r, void *hook);
/* Deallocate the list entry index. Afterwards, INDEX points to the
following entry. This calls the deallocator on the entry before
returning. */
void scute_table_dealloc (scute_table_t table, int *index);
/* Return the index for the beginning of the list TABLE. */
int scute_table_first (scute_table_t table);
/* Return the index following INDEX. If INDEX is the last element in
the list, return 0. */
int scute_table_next (scute_table_t table, int index);
/* Return true iff INDEX is the end-of-list marker. */
bool scute_table_last (scute_table_t table, int index);
/* Return the user data associated with INDEX. Return NULL if INDEX is
the end-of-list marker. */
void *scute_table_data (scute_table_t table, int index);
/* Return the number of entries in the table TABLE. */
int scute_table_used (scute_table_t table);
#endif /* !TABLE_H */
|
#include "bsefilter.hh"
#include <sfi/sfi.hh>
using namespace Bse;
const gchar*
<API key> (BseIIRFilterKind fkind)
{
switch (fkind)
{
case <API key>: return "Butterworth";
case <API key>: return "Bessel";
case <API key>: return "Chebyshev1";
case <API key>: return "Chebyshev2";
case <API key>: return "Elliptic";
default: return "?unknown?";
}
}
const gchar*
<API key> (BseIIRFilterType ftype)
{
switch (ftype)
{
case <API key>: return "Low-pass";
case <API key>: return "Band-pass";
case <API key>: return "High-pass";
case <API key>: return "Band-stop";
default: return "?unknown?";
}
}
gchar*
<API key> (const BseIIRFilterRequest *ifr)
{
String s;
s += <API key> (ifr->kind);
s += " ";
s += <API key> (ifr->type);
s += " order=" + string_from_int (ifr->order);
s += " sample-rate=" + string_from_float (ifr->sampling_frequency);
if (ifr->kind == <API key> || ifr->kind == <API key>)
s += " passband-ripple-db=" + string_from_float (ifr->passband_ripple_db);
s += " passband-edge=" + string_from_float (ifr->passband_edge);
if (ifr->type == <API key> || ifr->type == <API key>)
s += " passband-edge2=" + string_from_float (ifr->passband_edge2);
if (ifr->kind == <API key> && ifr->stopband_db < 0)
s += " stopband-db=" + string_from_float (ifr->stopband_db);
if (ifr->kind == <API key> && ifr->stopband_edge > 0)
s += " stopband-edge=" + string_from_float (ifr->stopband_edge);
return g_strdup (s.c_str());
}
gchar*
<API key> (const BseIIRFilterDesign *fid)
{
String s;
s += "order=" + string_from_int (fid->order);
s += " sampling-frequency=" + string_from_float (fid->sampling_frequency);
s += " center-frequency=" + string_from_float (fid->center_frequency);
s += " gain=" + string_from_double (fid->gain);
s += " n_zeros=" + string_from_int (fid->n_zeros);
s += " n_poles=" + string_from_int (fid->n_poles);
for (uint i = 0; i < fid->n_zeros; i++)
{
String u ("Zero:");
u += " " + string_from_double (fid->zz[i].re);
u += " + " + string_from_double (fid->zz[i].im) + "*i";
s += "\n" + u;
}
for (uint i = 0; i < fid->n_poles; i++)
{
String u ("Pole:");
u += " " + string_from_double (fid->zp[i].re);
u += " + " + string_from_double (fid->zp[i].im) + "*i";
s += "\n" + u;
}
String u;
#if 0
uint o = fid->order;
u = string_from_double (fid->zn[o]);
while (o
u = "(" + u + ") * z + " + string_from_double (fid->zn[o]);
s += "\nNominator: " + u;
o = fid->order;
u = string_from_double (fid->zd[o]);
while (o
u = "(" + u + ") * z + " + string_from_double (fid->zd[o]);
s += "\nDenominator: " + u;
#endif
return g_strdup (s.c_str());
}
bool
<API key> (const BseIIRFilterRequest *filter_request,
BseIIRFilterDesign *filter_design)
{
if (filter_request->kind == <API key> ||
filter_request->kind == <API key> ||
filter_request->kind == <API key>)
return <API key> (filter_request, filter_design);
return false;
}
|
#include <stdio.h>
#include <QtDebug>
#include "cguitreedomdocument.h"
CGuiTreeDomDocument::CGuiTreeDomDocument()
{
QDomImplementation impl;
impl.<API key>(QDomImplementation::ReturnNullNode);
}
/**
* Get first "guiObject" located in "guiRoot".
*
* @return Node element of first guiObject or an empty element node if there is none.
**/
CGuiTreeDomElement CGuiTreeDomDocument::<API key>()
{
CGuiTreeDomElement domElmGuiTree;
domElmGuiTree = this->firstChildElement("guiRoot");
if(domElmGuiTree.isNull())
return(domElmGuiTree);
return(domElmGuiTree.firstChildElement("guiObject"));
}
|
package mezz.texturedump.dumpers;
import com.google.gson.stream.JsonWriter;
import net.minecraft.client.renderer.texture.TextureAtlas;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.<API key>;
import net.minecraftforge.forgespi.language.IModFileInfo;
import net.minecraftforge.forgespi.language.IModInfo;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.annotation.Nullable;
import java.io.FileWriter;
import java.io.IOException;
import java.nio.file.Path;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
public class ModStatsDumper {
private static final Logger LOGGER = LogManager.getLogger();
public Path saveModStats(String name, TextureAtlas map, Path modStatsDir) throws IOException {
Map<String, Long> modPixelCounts = map.texturesByName.values().stream()
.collect(Collectors.groupingBy(
sprite -> sprite.getName().getNamespace(),
Collectors.summingLong(sprite -> (long) sprite.getWidth() * sprite.getHeight()))
);
final long totalPixels = modPixelCounts.values().stream().mapToLong(longValue -> longValue).sum();
final String filename = name + "_mod_statistics";
Path output = modStatsDir.resolve(filename + ".js");
List<Map.Entry<String, Long>> sortedEntries = modPixelCounts.entrySet().stream()
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
.collect(Collectors.toList());
<API key>.addModMessage("Dumping Mod TextureMap Statistics");
FileWriter fileWriter = new FileWriter(output.toFile());
fileWriter.write("var modStatistics = \n//Start of Data\n");
JsonWriter jsonWriter = new JsonWriter(fileWriter);
jsonWriter.setIndent(" ");
jsonWriter.beginArray();
{
for (Map.Entry<String, Long> modPixels : sortedEntries) {
String resourceDomain = modPixels.getKey();
long pixelCount = modPixels.getValue();
<API key>(jsonWriter, resourceDomain, pixelCount, totalPixels);
}
}
jsonWriter.endArray();
jsonWriter.close();
fileWriter.close();
LOGGER.info("Saved mod statistics to {}.", output.toString());
return output;
}
private static void <API key>(JsonWriter jsonWriter, String resourceDomain, long pixelCount, long totalPixels) throws IOException {
IModInfo modInfo = getModMetadata(resourceDomain);
String modName = modInfo != null ? modInfo.getDisplayName() : "";
jsonWriter.beginObject()
.name("resourceDomain").value(resourceDomain)
.name("pixelCount").value(pixelCount)
.name("percentOfTextureMap").value(pixelCount * 100f / totalPixels)
.name("modName").value(modName)
.name("url").value(getModConfigValue(modInfo, "displayURL"))
.name("issueTrackerUrl").value(getModConfigValue(modInfo, "issueTrackerURL"));
jsonWriter.name("authors").beginArray();
{
String authors = getModConfigValue(modInfo, "authors");
if (!authors.isEmpty()) {
String[] authorList = authors.split(",");
for (String author : authorList) {
jsonWriter.value(author.trim());
}
}
}
jsonWriter.endArray();
jsonWriter.endObject();
}
private static String getModConfigValue(@Nullable IModInfo modInfo, String key) {
if (modInfo == null) {
return "";
}
Map<String, Object> modConfig = modInfo.getModProperties();
Object value = modConfig.getOrDefault(key, "");
if (value instanceof String) {
return (String) value;
}
return "";
}
@Nullable
private static IModInfo getModMetadata(String resourceDomain) {
ModList modList = ModList.get();
IModFileInfo modFileInfo = modList.getModFileById(resourceDomain);
if (modFileInfo == null) {
return null;
}
return modFileInfo.getMods()
.stream()
.findFirst()
.orElse(null);
}
}
|
package unikn.dbis.univis.message;
public interface Internationalizable {
public void internationalize();
}
|
package soot.jimple.toolkits.callgraph;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import soot.AnySubType;
import soot.ArrayType;
import soot.FastHierarchy;
import soot.G;
import soot.NullType;
import soot.PhaseOptions;
import soot.RefType;
import soot.Scene;
import soot.Singletons;
import soot.SootClass;
import soot.SootMethod;
import soot.Type;
import soot.jimple.SpecialInvokeExpr;
import soot.options.CGOptions;
import soot.toolkits.scalar.Pair;
import soot.util.Chain;
import soot.util.HashMultiMap;
import soot.util.LargeNumberedMap;
import soot.util.MultiMap;
import soot.util.NumberedString;
import soot.util.SmallNumberedMap;
import soot.util.queue.ChunkedQueue;
/**
* Resolves virtual calls.
*
* @author Ondrej Lhotak
*/
public class VirtualCalls {
private CGOptions options = new CGOptions(PhaseOptions.v().getPhaseOptions("cg"));
public VirtualCalls(Singletons.Global g) {
}
public static VirtualCalls v() {
return G.v().<API key>();
}
private final LargeNumberedMap<Type, SmallNumberedMap<SootMethod>> typeToVtbl
= new LargeNumberedMap<Type, SmallNumberedMap<SootMethod>>(Scene.v().getTypeNumberer());
public SootMethod resolveSpecial(SpecialInvokeExpr iie, NumberedString subSig, SootMethod container) {
return resolveSpecial(iie, subSig, container, false);
}
public SootMethod resolveSpecial(SpecialInvokeExpr iie, NumberedString subSig, SootMethod container, boolean appOnly) {
SootMethod target = iie.getMethod();
/* cf. JVM spec, invokespecial instruction */
if (Scene.v().<API key>().canStoreType(container.getDeclaringClass().getType(),
target.getDeclaringClass().getType())
&& container.getDeclaringClass().getType() != target.getDeclaringClass().getType()
&& !target.getName().equals("<init>") && subSig != sigClinit) {
return resolveNonSpecial(container.getDeclaringClass().getSuperclass().getType(), subSig, appOnly);
} else {
return target;
}
}
public SootMethod resolveNonSpecial(RefType t, NumberedString subSig) {
return resolveNonSpecial(t, subSig, false);
}
public SootMethod resolveNonSpecial(RefType t, NumberedString subSig, boolean appOnly) {
SmallNumberedMap<SootMethod> vtbl = typeToVtbl.get(t);
if (vtbl == null) {
typeToVtbl.put(t, vtbl = new SmallNumberedMap<SootMethod>());
}
SootMethod ret = vtbl.get(subSig);
if (ret != null) {
return ret;
}
SootClass cls = t.getSootClass();
if (appOnly && cls.isLibraryClass()) {
return null;
}
SootMethod m = cls.getMethodUnsafe(subSig);
if (m != null) {
if (!m.isAbstract()) {
ret = m;
}
} else {
SootClass c = cls.getSuperclassUnsafe();
if (c != null) {
ret = resolveNonSpecial(c.getType(), subSig);
}
}
vtbl.put(subSig, ret);
return ret;
}
protected MultiMap<Type, Type> baseToSubTypes = new HashMultiMap<Type, Type>();
protected MultiMap<Pair<Type, NumberedString>, Pair<Type, NumberedString>> <API key>
= new HashMultiMap<Pair<Type, NumberedString>, Pair<Type, NumberedString>>();
public void resolve(Type t, Type declaredType, NumberedString subSig, SootMethod container,
ChunkedQueue<SootMethod> targets) {
resolve(t, declaredType, null, subSig, container, targets);
}
public void resolve(Type t, Type declaredType, NumberedString subSig, SootMethod container,
ChunkedQueue<SootMethod> targets, boolean appOnly) {
resolve(t, declaredType, null, subSig, container, targets, appOnly);
}
public void resolve(Type t, Type declaredType, Type sigType, NumberedString subSig, SootMethod container,
ChunkedQueue<SootMethod> targets) {
resolve(t, declaredType, sigType, subSig, container, targets, false);
}
public void resolve(Type t, Type declaredType, Type sigType, NumberedString subSig, SootMethod container,
ChunkedQueue<SootMethod> targets, boolean appOnly) {
if (declaredType instanceof ArrayType) {
declaredType = RefType.v("java.lang.Object");
}
if (sigType instanceof ArrayType) {
sigType = RefType.v("java.lang.Object");
}
if (t instanceof ArrayType) {
t = RefType.v("java.lang.Object");
}
FastHierarchy fastHierachy = Scene.v().<API key>();
if (declaredType != null && !fastHierachy.canStoreType(t, declaredType)) {
return;
}
if (sigType != null && !fastHierachy.canStoreType(t, sigType)) {
return;
}
if (t instanceof RefType) {
SootMethod target = resolveNonSpecial((RefType) t, subSig, appOnly);
if (target != null) {
targets.add(target);
}
} else if (t instanceof AnySubType) {
RefType base = ((AnySubType) t).getBase();
/*
* Whenever any sub type of a specific type is considered as receiver for a method to call and the base type is an
* interface, calls to existing methods with matching signature (possible implementation of method to call) are also
* added. As Javas' subtyping allows contra-variance for return types and co-variance for parameters when overriding a
* method, these cases are also considered here.
*
* Example: Classes A, B (B sub type of A), interface I with method public A foo(B b); and a class C with method public
* B foo(A a) { ... }. The extended class hierarchy will contain C as possible implementation of I.
*
* Since Java has no multiple inheritance call by signature resolution is only activated if the base is an interface.
*/
if (options.library() == CGOptions.<API key> && base.getSootClass().isInterface()) {
<API key>(declaredType, sigType, subSig, container, targets, appOnly, base);
} else {
resolveAnySubType(declaredType, sigType, subSig, container, targets, appOnly, base);
}
} else if (t instanceof NullType) {
} else {
throw new RuntimeException("oops " + t);
}
}
public void resolveSuperType(Type t, Type declaredType, NumberedString subSig, ChunkedQueue<SootMethod> targets,
boolean appOnly) {
if (declaredType == null) {
return;
}
if (t == null) {
return;
}
if (declaredType instanceof ArrayType) {
declaredType = RefType.v("java.lang.Object");
}
if (t instanceof ArrayType) {
t = RefType.v("java.lang.Object");
}
if (declaredType instanceof RefType) {
RefType parent = (RefType)declaredType;
SootClass parentClass = parent.getSootClass();
RefType child;
SootClass childClass;
if (t instanceof AnySubType) {
child = ((AnySubType) t).getBase();
} else if (t instanceof RefType) {
child = (RefType)t;
} else {
return;
}
childClass = child.getSootClass();
FastHierarchy fastHierachy = Scene.v().<API key>();
if (fastHierachy.canStoreClass(childClass,parentClass)) {
SootMethod target = resolveNonSpecial(child, subSig, appOnly);
if (target != null) {
targets.add(target);
}
}
}
}
protected void resolveAnySubType(Type declaredType, Type sigType, NumberedString subSig, SootMethod container,
ChunkedQueue<SootMethod> targets, boolean appOnly, RefType base) {
FastHierarchy fastHierachy = Scene.v().<API key>();
{
Set<Type> subTypes = baseToSubTypes.get(base);
if (subTypes != null && !subTypes.isEmpty()) {
for (final Type st : subTypes) {
resolve(st, declaredType, sigType, subSig, container, targets, appOnly);
}
return;
}
}
Set<Type> newSubTypes = new HashSet<>();
newSubTypes.add(base);
LinkedList<SootClass> worklist = new LinkedList<SootClass>();
HashSet<SootClass> workset = new HashSet<SootClass>();
FastHierarchy fh = fastHierachy;
SootClass cl = base.getSootClass();
if (workset.add(cl)) {
worklist.add(cl);
}
while (!worklist.isEmpty()) {
cl = worklist.removeFirst();
if (cl.isInterface()) {
for (Iterator<SootClass> cIt = fh.<API key>(cl).iterator(); cIt.hasNext();) {
final SootClass c = cIt.next();
if (workset.add(c)) {
worklist.add(c);
}
}
} else {
if (cl.isConcrete()) {
resolve(cl.getType(), declaredType, sigType, subSig, container, targets, appOnly);
newSubTypes.add(cl.getType());
}
for (Iterator<SootClass> cIt = fh.getSubclassesOf(cl).iterator(); cIt.hasNext();) {
final SootClass c = cIt.next();
if (workset.add(c)) {
worklist.add(c);
}
}
}
}
baseToSubTypes.putAll(base, newSubTypes);
}
protected void <API key>(Type declaredType, Type sigType, NumberedString subSig, SootMethod container,
ChunkedQueue<SootMethod> targets, boolean appOnly, RefType base) {
FastHierarchy fastHierachy = Scene.v().<API key>();
assert (declaredType instanceof RefType);
Pair<Type, NumberedString> pair = new Pair<Type, NumberedString>(base, subSig);
{
Set<Pair<Type, NumberedString>> types = <API key>.get(pair);
// if this type and method has been resolved earlier we can
// just retrieve the previous result.
if (types != null) {
for (Pair<Type, NumberedString> tuple : types) {
Type st = tuple.getO1();
if (!fastHierachy.canStoreType(st, declaredType)) {
resolve(st, st, sigType, subSig, container, targets, appOnly);
} else {
resolve(st, declaredType, sigType, subSig, container, targets, appOnly);
}
}
return;
}
}
Set<Pair<Type, NumberedString>> types = new HashSet<Pair<Type, NumberedString>>();
// get return type; method name; parameter types
String[] split = subSig.getString().replaceAll("(.*) (.*)\\((.*)\\)", "$1;$2;$3").split(";");
Type declaredReturnType = Scene.v().getType(split[0]);
String declaredName = split[1];
List<Type> declaredParamTypes = new ArrayList<Type>();
// separate the parameter types
if (split.length == 3) {
for (String type : split[2].split(",")) {
declaredParamTypes.add(Scene.v().getType(type));
}
}
Chain<SootClass> classes = Scene.v().getClasses();
for (SootClass sc : classes) {
for (SootMethod sm : sc.getMethods()) {
if (!sm.isAbstract()) {
// method name has to match
if (!sm.getName().equals(declaredName)) {
continue;
}
// the return type has to be a the declared return
// type or a sub type of it
if (!fastHierachy.canStoreType(sm.getReturnType(), declaredReturnType)) {
continue;
}
List<Type> paramTypes = sm.getParameterTypes();
// method parameters have to match to the declared
// ones (same type or super type).
if (declaredParamTypes.size() != paramTypes.size()) {
continue;
}
boolean check = true;
for (int i = 0; i < paramTypes.size(); i++) {
if (!fastHierachy.canStoreType(declaredParamTypes.get(i), paramTypes.get(i))) {
check = false;
break;
}
}
if (check) {
Type st = sc.getType();
if (!fastHierachy.canStoreType(st, declaredType)) {
// final classes can not be extended and
// therefore not used in library client
if (!sc.isFinal()) {
NumberedString newSubSig = sm.<API key>();
resolve(st, st, sigType, newSubSig, container, targets, appOnly);
types.add(new Pair<Type, NumberedString>(st, newSubSig));
}
} else {
resolve(st, declaredType, sigType, subSig, container, targets, appOnly);
types.add(new Pair<Type, NumberedString>(st, subSig));
}
}
}
}
}
<API key>.putAll(pair, types);
}
public final NumberedString sigClinit = Scene.v().getSubSigNumberer().findOrAdd("void <clinit>()");
public final NumberedString sigStart = Scene.v().getSubSigNumberer().findOrAdd("void start()");
public final NumberedString sigRun = Scene.v().getSubSigNumberer().findOrAdd("void run()");
}
|
// The libMesh Finite Element Library.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// You should have received a copy of the GNU Lesser General Public
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#ifndef <API key>
#define <API key>
#include "libmesh/libmesh_config.h"
#ifdef <API key>
// Local includes
#include "libmesh/cell_inf.h"
namespace libMesh
{
/**
* The \p InfPrism is an element in 3D with 4 sides.
* The \f$ 5^{th} \f$ side is theoretically located at infinity,
* and therefore not accounted for.
* However, one could say that the \f$ 5^{th} \f$ side actually
* @e does exist in the mesh, since the outer nodes are located
* at a specific distance from the mesh origin (and therefore
* define a side). Still, this face is not to be used!
*/
class InfPrism : public InfCell
{
public:
/**
* Default infinite prism element, takes number of nodes and
* parent. Derived classes implement 'true' elements.
*/
InfPrism(const unsigned int nn, Elem* p, Node** nodelinkdata);
// /**
// * @returns 4 for the base \p s=0 and 2 for side faces.
// */
// unsigned int n_children_per_side(const unsigned int s) const;
/**
* @returns 4. Infinite elements have one side less
* than their conventional counterparts, since one
* side is supposed to be located at infinity.
*/
unsigned int n_sides() const { return 4; }
/**
* @returns 6. All infinite prisms (in our
* setting) have 6 vertices.
*/
unsigned int n_vertices() const { return 6; }
/**
* @returns 6. All infinite prismahedrals have 6 edges,
* 3 lying in the base, and 3 perpendicular to the base.
*/
unsigned int n_edges() const { return 6; }
/**
* @returns 4. All prisms have 4 faces.
*/
unsigned int n_faces() const { return 4; }
/**
* @returns 4
*/
unsigned int n_children() const { return 4; }
/*
* @returns true iff the specified child is on the
* specified side
*/
virtual bool is_child_on_side(const unsigned int c,
const unsigned int s) const;
/*
* @returns true iff the specified edge is on the specified side
*/
virtual bool is_edge_on_side(const unsigned int e,
const unsigned int s) const;
/**
* @returns an id associated with the \p s side of this element.
* The id is not necessariy unique, but should be close. This is
* particularly useful in the \p MeshBase::find_neighbors() routine.
*/
dof_id_type key (const unsigned int s) const;
/**
* @returns a primitive (3-noded) tri or (4-noded) infquad for
* face i.
*/
AutoPtr<Elem> side (const unsigned int i) const;
protected:
/**
* Data for links to parent/neighbor/interior_parent elements.
*/
Elem* _elemlinks_data[5+(LIBMESH_DIM>3)];
};
// InfPrism class member functions
inline
InfPrism::InfPrism(const unsigned int nn, Elem* p, Node** nodelinkdata) :
InfCell(nn, InfPrism::n_sides(), p, _elemlinks_data, nodelinkdata)
{
}
// inline
// unsigned int InfPrism::n_children_per_side(const unsigned int s) const
// libmesh_assert_less (s, this->n_sides());
// switch (s)
// case 0:
// // every infinite prism has 4 children in the base side
// return 4;
// default:
// // on infinite faces (sides), only 2 children exist
// // note that the face at infinity is already caught by the libmesh_assertion
// return 2;
} // namespace libMesh
#endif // ifdef <API key>
#endif // <API key>
|
#include "cssysdef.h"
#include "csqsqrt.h"
#include "csgeom/box.h"
#include "csgeom/math.h"
#include "csgeom/math3d.h"
#include "csgeom/math2d.h"
#include "csgeom/transfrm.h"
#include "csgfx/renderbuffer.h"
#include "cstool/rbuflock.h"
#include "cstool/rviewclipper.h"
#include "csutil/scfarray.h"
#include "ivaria/reporter.h"
#include "iengine/movable.h"
#include "iengine/rview.h"
#include "ivideo/graph3d.h"
#include "ivideo/graph2d.h"
#include "ivideo/material.h"
#include "ivideo/rendermesh.h"
#include "iengine/material.h"
#include "iengine/camera.h"
#include "igeom/clip2d.h"
#include "iengine/engine.h"
#include "iengine/light.h"
#include "iutil/objreg.h"
#include "spr2d.h"
<API key>(Spr2D)
{
<API key> (<API key>);
<API key> (<API key>::<API key>);
<API key> (<API key>);
<API key>::<API key> (<API key>* factory) :
<API key> (this), uvani (0), vertices_dirty (true),
texels_dirty (true), colors_dirty (true), indicesSize ((size_t)-1),
logparent (0), factory (factory), initialized (false), current_lod (1),
current_features (0)
{
ifactory = scfQueryInterface<iMeshObjectFactory> (factory);
material = factory->GetMaterialWrapper ();
lighting = factory->HasLighting ();
MixMode = factory->GetMixMode ();
}
<API key>::~<API key> ()
{
delete uvani;
}
iColoredVertices* <API key>::GetVertices ()
{
if (!scfVertices.IsValid())
return factory->GetVertices ();
return scfVertices;
}
csColoredVertices* <API key>::GetCsVertices ()
{
if (!scfVertices.IsValid())
return factory->GetCsVertices ();
return &vertices;
}
void <API key>::SetupObject ()
{
if (!initialized)
{
initialized = true;
float max_sq_dist = 0;
size_t i;
csColoredVertices* vertices = GetCsVertices ();
bbox_2d.StartBoundingBox((*vertices)[0].pos);
for (i = 0 ; i < vertices->GetSize () ; i++)
{
csSprite2DVertex& v = (*vertices)[i];
bbox_2d.<API key>(v.pos);
if (!lighting)
{
// If there is no lighting then we need to copy the color_init
// array to color.
v.color = (*vertices)[i].color_init;
v.color.Clamp (2, 2, 2);
}
float sqdist = v.pos.x*v.pos.x + v.pos.y*v.pos.y;
if (sqdist > max_sq_dist) max_sq_dist = sqdist;
}
radius = csQsqrt (max_sq_dist);
bufferHolder.AttachNew (new <API key>);
csRef<<API key>> newAccessor;
newAccessor.AttachNew (new <API key> (this));
bufferHolder->SetAccessor (newAccessor, (uint32)CS_BUFFER_ALL_MASK);
svcontext.AttachNew (new <API key>);
}
}
static csVector3 cam;
void <API key>::UpdateLighting (
const csSafeCopyArray<csLightInfluence>& lights,
const csVector3& pos)
{
if (!lighting) return;
csColor color (0, 0, 0);
// @@@ GET AMBIENT
//csSector* sect = movable.GetSector (0);
//if (sect)
//int r, g, b;
//sect->GetAmbientColor (r, g, b);
//color.Set (r / 128.0, g / 128.0, b / 128.0);
int i;
int num_lights = (int)lights.GetSize ();
for (i = 0; i < num_lights; i++)
{
iLight* li = lights[i].light;
if (!li)
continue;
csColor light_color = li->GetColor ()
* (256. / <API key>);
float sq_light_radius = csSquare (li->GetCutoffDistance ());
// Compute light position.
csVector3 wor_light_pos = li->GetMovable ()->GetFullPosition ();
float wor_sq_dist =
csSquaredDist::PointPoint (wor_light_pos, pos);
if (wor_sq_dist >= sq_light_radius) continue;
float wor_dist = csQsqrt (wor_sq_dist);
float cosinus = 1.0f;
cosinus /= wor_dist;
light_color *= cosinus * li-><API key> (wor_dist);
color += light_color;
}
csColoredVertices* vertices = GetCsVertices ();
for (size_t j = 0 ; j < vertices->GetSize () ; j++)
{
(*vertices)[j].color = (*vertices)[j].color_init + color;
(*vertices)[j].color.Clamp (2, 2, 2);
}
colors_dirty = true;
}
void <API key>::UpdateLighting (
const csSafeCopyArray<csLightInfluence>& lights,
iMovable* movable, csVector3 offset)
{
if (!lighting) return;
csVector3 pos = movable->GetFullPosition ();
UpdateLighting (lights, pos + offset);
}
csRenderMesh** <API key>::GetRenderMeshes (int &n,
iRenderView* rview,
iMovable* movable,
uint32 frustum_mask,
csVector3 offset)
{
SetupObject ();
if (!material)
{
csReport (factory->object_reg, <API key>,
"crystalspace.mesh.sprite2d",
"Error! Trying to draw a sprite with no material!");
return 0;
}
iCamera* camera = rview->GetCamera ();
// Camera transformation for the single 'position' vector.
cam = rview->GetCamera ()->GetTransform ().Other2This (
movable->GetFullPosition () + offset);
if (cam.z < SMALL_Z)
{
n = 0;
return 0;
}
if (factory->light_mgr)
{
csSafeCopyArray<csLightInfluence> lightInfluences;
scfArrayWrap<<API key>, csSafeCopyArray<csLightInfluence> >
relevantLights (lightInfluences); //Yes, know, its on the stack...
factory->light_mgr->GetRelevantLights (logparent, &relevantLights, -1);
UpdateLighting (lightInfluences, movable, offset);
}
<API key> temp = camera->GetTransform ();
if (!movable-><API key> ())
temp /= movable->GetFullTransform ();
int clip_portal, clip_plane, clip_z_plane;
CS::RenderViewClipper::<API key> (rview->GetRenderContext (),
frustum_mask, clip_portal, clip_plane, clip_z_plane);
<API key> tr_o2c;
tr_o2c.SetO2TTranslation (-temp.Other2This (offset));
bool meshCreated;
csRenderMesh*& rm = rmHolder.GetUnusedMesh (meshCreated,
rview-><API key> ());
if (meshCreated)
{
rm->meshtype = <API key>;
rm->buffers = bufferHolder;
rm->variablecontext = svcontext;
rm->geometryInstance = this;
}
rm->material = material;//Moved this statement out of the above 'if'
//to make the change of the material possible at any time
//(thru a call to either iSprite2DState::SetMaterialWrapper () or
//<API key>::SetMaterialWrapper (). Luca
rm->mixmode = MixMode;
rm->clip_portal = clip_portal;
rm->clip_plane = clip_plane;
rm->clip_z_plane = clip_z_plane;
rm->do_mirror = false/* camera->IsMirrored () */;
/*
Force to false as the front-face culling will let the sprite
disappear.
*/
rm->indexstart = 0;
rm->worldspace_origin = movable->GetFullPosition ();
rm->object2world = tr_o2c.GetInverse () * camera->GetTransform ();
rm->bbox = <API key>();
rm->indexend = (uint)GetCsVertices ()->GetSize ();
n = 1;
return &rm;
}
void <API key>::PreGetBuffer (<API key>* holder, csRenderBufferName buffer)
{
if (!holder) return;
csColoredVertices* vertices = GetCsVertices ();
if (buffer == CS_BUFFER_INDEX)
{
size_t indexSize = vertices->GetSize ();
if (!index_buffer.IsValid() ||
(indicesSize != indexSize))
{
index_buffer = csRenderBuffer::<API key> (
indexSize, CS_BUF_DYNAMIC,
<API key>, 0, vertices->GetSize () - 1);
holder->SetRenderBuffer (CS_BUFFER_INDEX, index_buffer);
csRenderBufferLock<uint> indexLock (index_buffer);
uint* ptr = indexLock;
for (size_t i = 0; i < vertices->GetSize (); i++)
{
*ptr++ = (uint)i;
}
indicesSize = indexSize;
}
}
else if (buffer == CS_BUFFER_TEXCOORD0)
{
if (texels_dirty)
{
int texels_count;
const csVector2 *uvani_uv = 0;
if (!uvani)
texels_count = (int)vertices->GetSize ();
else
uvani_uv = uvani->GetVertices (texels_count);
size_t texelSize = texels_count;
if (!texel_buffer.IsValid() || (texel_buffer->GetSize()
!= texelSize * sizeof(float) * 2))
{
texel_buffer = csRenderBuffer::CreateRenderBuffer (
texelSize, CS_BUF_STATIC, CS_BUFCOMP_FLOAT, 2);
holder->SetRenderBuffer (CS_BUFFER_TEXCOORD0, texel_buffer);
}
csRenderBufferLock<csVector2> texelLock (texel_buffer);
for (size_t i = 0; i < (size_t)texels_count; i++)
{
csVector2& v = texelLock[i];
if (!uvani)
{
v.x = (*vertices)[i].u;
v.y = (*vertices)[i].v;
}
else
{
v.x = uvani_uv[i].x;
v.y = uvani_uv[i].y;
}
}
texels_dirty = false;
}
}
else if (buffer == CS_BUFFER_COLOR)
{
if (colors_dirty)
{
size_t color_size = vertices->GetSize ();
if (!color_buffer.IsValid() || (color_buffer->GetSize()
!= color_size * sizeof(float) * 2))
{
color_buffer = csRenderBuffer::CreateRenderBuffer (
color_size, CS_BUF_STATIC,
CS_BUFCOMP_FLOAT, 3);
holder->SetRenderBuffer (CS_BUFFER_COLOR, color_buffer);
}
csRenderBufferLock<csColor> colorLock (color_buffer);
for (size_t i = 0; i < vertices->GetSize (); i++)
{
colorLock[i] = (*vertices)[i].color;
}
colors_dirty = false;
}
}
else if (buffer == CS_BUFFER_POSITION)
{
if (vertices_dirty)
{
size_t vertices_size = vertices->GetSize ();
if (!vertex_buffer.IsValid() || (vertex_buffer->GetSize()
!= vertices_size * sizeof(float) * 3))
{
vertex_buffer = csRenderBuffer::CreateRenderBuffer (
vertices_size, CS_BUF_STATIC,
CS_BUFCOMP_FLOAT, 3);
holder->SetRenderBuffer (CS_BUFFER_POSITION, vertex_buffer);
}
csRenderBufferLock<csVector3> vertexLock (vertex_buffer);
for (size_t i = 0; i < vertices->GetSize (); i++)
{
vertexLock[i].Set ((*vertices)[i].pos.x, (*vertices)[i].pos.y, 0.0f);
}
vertices_dirty = false;
}
}
}
const csBox3& <API key>::<API key> ()
{
SetupObject ();
obj_bbox.Set (-radius, radius);
return obj_bbox;
}
void <API key>::<API key> (const csBox3&)
{
// @@@ TODO
}
void <API key>::HardTransform (const <API key>& t)
{
(void)t;
//@@@ TODO
}
void <API key>::<API key> (int n, bool setuv)
{
double angle_inc = TWO_PI / n;
double angle = 0.0;
csColoredVertices* vertices = GetCsVertices ();
vertices->SetSize (n);
size_t i;
for (i = 0; i < vertices->GetSize (); i++, angle += angle_inc)
{
(*vertices) [i].pos.y = cos (angle);
(*vertices) [i].pos.x = sin (angle);
if (setuv)
{
// reuse sin/cos values and scale to [0..1]
(*vertices) [i].u = (*vertices) [i].pos.x / 2.0f + 0.5f;
(*vertices) [i].v = (*vertices) [i].pos.y / 2.0f + 0.5f;
}
(*vertices) [i].color.Set (1, 1, 1);
(*vertices) [i].color_init.Set (1, 1, 1);
}
vertices_dirty = true;
texels_dirty = true;
colors_dirty = true;
ShapeChanged ();
}
void <API key>::NextFrame (csTicks current_time,
const csVector3& /*pos*/, uint /*currentFrame*/)
{
if (uvani && !uvani->halted)
{
int old_frame_index = uvani->frameindex;
uvani->Advance (current_time);
texels_dirty |= (old_frame_index != uvani->frameindex);
}
}
void <API key>::UpdateLighting (
const csSafeCopyArray<csLightInfluence>& lights,
const <API key>& transform)
{
csVector3 new_pos = transform.This2Other (part_pos);
UpdateLighting (lights, new_pos);
}
void <API key>::AddColor (const csColor& col)
{
iColoredVertices* vertices = GetVertices ();
size_t i;
for (i = 0 ; i < vertices->GetSize(); i++)
vertices->Get (i).color_init += col;
if (!lighting)
for (i = 0 ; i < vertices->GetSize(); i++)
vertices->Get (i).color = vertices->Get (i).color_init;
colors_dirty = true;
}
bool <API key>::SetColor (const csColor& col)
{
iColoredVertices* vertices = GetVertices ();
size_t i;
for (i = 0 ; i < vertices->GetSize(); i++)
vertices->Get (i).color_init = col;
if (!lighting)
for (i = 0 ; i < vertices->GetSize(); i++)
vertices->Get (i).color = col;
colors_dirty = true;
return true;
}
void <API key>::ScaleBy (float factor)
{
iColoredVertices* vertices = GetVertices ();
size_t i;
for (i = 0 ; i < vertices->GetSize(); i++)
vertices->Get (i).pos *= factor;
vertices_dirty = true;
ShapeChanged ();
}
void <API key>::Rotate (float angle)
{
iColoredVertices* vertices = GetVertices ();
size_t i;
for (i = 0 ; i < vertices->GetSize(); i++)
vertices->Get (i).pos.Rotate (angle);
vertices_dirty = true;
ShapeChanged ();
}
void <API key>::SetUVAnimation (const char *name,
int style, bool loop)
{
if (name)
{
<API key> *ani = factory->GetUVAnimation (name);
if (ani && ani->GetFrameCount ())
{
uvani = new uvAnimationControl ();
uvani->ani = ani;
uvani->last_time = 0;
uvani->frameindex = 0;
uvani->framecount = ani->GetFrameCount ();
uvani->frame = ani->GetFrame (0);
uvani->style = style;
uvani->counter = 0;
uvani->loop = loop;
uvani->halted = false;
}
}
else
{
// stop animation and show the normal texture
delete uvani;
uvani = 0;
}
}
void <API key>::StopUVAnimation (int idx)
{
if (uvani)
{
if (idx != -1)
{
uvani->frameindex = csMin (csMax (idx, 0), uvani->framecount-1);
uvani->frame = uvani->ani->GetFrame (uvani->frameindex);
}
uvani->halted = true;
}
}
void <API key>::PlayUVAnimation (int idx, int style, bool loop)
{
if (uvani)
{
if (idx != -1)
{
uvani->frameindex = csMin (csMax (idx, 0), uvani->framecount-1);
uvani->frame = uvani->ani->GetFrame (uvani->frameindex);
}
uvani->halted = false;
uvani->counter = 0;
uvani->last_time = 0;
uvani->loop = loop;
uvani->style = style;
}
}
int <API key>::GetUVAnimationCount () const
{
return factory->GetUVAnimationCount ();
}
<API key> *<API key>::CreateUVAnimation ()
{
return factory->CreateUVAnimation ();
}
void <API key>::RemoveUVAnimation (
<API key> *anim)
{
factory->RemoveUVAnimation (anim);
}
<API key> *<API key>::GetUVAnimation (
const char *name) const
{
return factory->GetUVAnimation (name);
}
<API key> *<API key>::GetUVAnimation (
int idx) const
{
return factory->GetUVAnimation (idx);
}
<API key> *<API key>::GetUVAnimation (
int idx, int &style, bool &loop) const
{
style = uvani->style;
loop = uvani->loop;
return factory->GetUVAnimation (idx);
}
void <API key>::EnsureVertexCopy ()
{
if (!scfVertices.IsValid())
{
scfVertices.AttachNew (new scfArrayWrap<iColoredVertices,
csColoredVertices> (vertices));
vertices = *(factory->GetCsVertices());
}
}
void <API key>::uvAnimationControl::Advance (csTicks current_time)
{
int oldframeindex = frameindex;
// the goal is to find the next frame to show
if (style < 0)
{ // every (-1*style)-th frame show a new pic
counter
if (counter < style)
{
counter = 0;
frameindex++;
if (frameindex == framecount)
{
if (loop)
frameindex = 0;
else
{
frameindex = framecount-1;
halted = true;
}
}
}
}
else if (style > 0)
{ // skip to next frame every <style> millisecond
if (last_time == 0)
last_time = current_time;
counter += (current_time - last_time);
last_time = current_time;
while (counter > style)
{
counter -= style;
frameindex++;
if (frameindex == framecount)
{
if (loop)
frameindex = 0;
else
{
frameindex = framecount-1;
halted = true;
}
}
}
}
else
{ // style == 0 -> use time indices attached to the frames
if (last_time == 0)
last_time = current_time;
while (frame->GetDuration () + last_time < current_time)
{
frameindex++;
if (frameindex == framecount)
{
if (loop)
{
frameindex = 0;
}
else
{
frameindex = framecount-1;
halted = true;
break;
}
}
}
last_time += frame->GetDuration ();
frame = ani->GetFrame (frameindex);
}
if (oldframeindex != frameindex)
frame = ani->GetFrame (frameindex);
}
const csVector2 *<API key>::uvAnimationControl::GetVertices (
int &num)
{
num = frame->GetUVCount ();
return frame->GetUVCoo ();
}
// The hit beam methods in sprite2d make a couple of small presumptions.
// 1) The sprite is always facing the start of the beam.
// 2) Since it is always facing the beam, only one side
// of its bounding box can be hit (if at all).
void <API key>::CheckBeam (const csVector3& /*start*/,
const csVector3& pl, float sqr, csMatrix3& o2t)
{
// This method is an optimized version of LookAt() based on
// the presumption that the up vector is always (0,1,0).
// This is used to create a transform to move the intersection
// to the sprites vector space, then it is tested against the 2d
// coords, which are conveniently located at z=0.
// The transformation matrix is stored and used again if the
// start vector for the beam is in the same position. MHV.
csVector3 pl2 = pl * csQisqrt (sqr);
csVector3 v1( pl2.z, 0, -pl2.x);
sqr = v1*v1;
v1 *= csQisqrt(sqr);
csVector3 v2(pl2.y * v1.z, pl2.z * v1.x - pl2.x * v1.z, -pl2.y * v1.x);
o2t.Set (v1.x, v2.x, pl2.x,
v1.y, v2.y, pl2.y,
v1.z, v2.z, pl2.z);
}
bool <API key>::HitBeamOutline(const csVector3& start,
const csVector3& end, csVector3& isect, float* pr)
{
csVector2 cen = bbox_2d.GetCenter();
csVector3 pl = start - csVector3(cen.x, cen.y, 0);
float sqr = pl * pl;
if (sqr < SMALL_EPSILON) return false; // Too close, Cannot intersect
float dist;
csIntersect3::SegmentPlane(start, end, pl, 0, isect, dist);
if (pr) { *pr = dist; }
csMatrix3 o2t;
CheckBeam (start, pl, sqr, o2t);
csVector3 r = o2t * isect;
csColoredVertices* vertices = GetCsVertices ();
int trail, len = (int)vertices->GetSize ();
trail = len - 1;
csVector2 isec(r.x, r.y);
int i;
for (i = 0; i < len; trail = i++)
{
if (csMath2::WhichSide2D(isec, (*vertices)[trail].pos, (*vertices)[i].pos) > 0)
return false;
}
return true;
}
bool <API key>::HitBeamObject (const csVector3& start, const csVector3& end,
csVector3& isect, float* pr, int* polygon_idx,
iMaterialWrapper** material, bool bf)
{
if (material) *material = <API key>::material;
if (polygon_idx) *polygon_idx = -1;
return HitBeamOutline (start, end, isect, pr);
}
<API key>::<API key> (iMeshObjectType* pParent,
iObjectRegistry* object_reg) : <API key> (this, pParent),
material (0), logparent (0), spr2d_type (pParent), MixMode (0),
lighting (true), object_reg (object_reg)
{
light_mgr = csQueryRegistry<iLightManager> (object_reg);
g3d = csQueryRegistry<iGraphics3D> (object_reg);
scfVertices.AttachNew (new scfArrayWrap<iColoredVertices,
csColoredVertices> (vertices));
ax = -10;
}
<API key>::~<API key> ()
{
}
csPtr<iMeshObject> <API key>::NewInstance ()
{
csRef<<API key>> cm;
cm.AttachNew (new <API key> (this));
csRef<iMeshObject> im (scfQueryInterface<iMeshObject> (cm));
return csPtr<iMeshObject> (im);
}
<API key> (<API key>)
<API key>::<API key> (iBase* pParent) :
<API key> (this, pParent)
{
}
<API key>::~<API key> ()
{
}
csPtr<iMeshObjectFactory> <API key>::NewFactory ()
{
csRef<<API key>> cm;
cm.AttachNew (new <API key> (this,
object_reg));
csRef<iMeshObjectFactory> ifact =
scfQueryInterface<iMeshObjectFactory> (cm);
return csPtr<iMeshObjectFactory> (ifact);
}
bool <API key>::Initialize (iObjectRegistry* object_reg)
{
<API key>::object_reg = object_reg;
return true;
}
}
<API key>(Spr2D)
|
#ifndef _STRINGS_H
#define _STRINGS_H 1
/* We don't need and should not read this file if <string.h> was already
read. The one exception being that if __USE_BSD isn't defined, then
these aren't defined in string.h, so we need to define them here. */
/* keep this file in sync w/ string.h, the glibc version is out of date */
#if !defined _STRING_H || !defined __USE_BSD
# include <features.h>
# define __need_size_t
# include <stddef.h>
__BEGIN_DECLS
# ifdef <API key>
/* Copy N bytes of SRC to DEST (like memmove, but args reversed). */
extern void bcopy (__const void *__src, void *__dest, size_t __n)
__THROW __nonnull ((1, 2));
/* Set N bytes of S to 0. */
extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1));
/* Compare N bytes of S1 and S2 (same as memcmp). */
extern int bcmp (__const void *__s1, __const void *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
/* Find the first occurrence of C in S (same as strchr). */
extern char *index (__const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
/* Find the last occurrence of C in S (same as strrchr). */
extern char *rindex (__const char *__s, int __c)
__THROW __attribute_pure__ __nonnull ((1));
# else
# ifdef <API key>
/* bcopy/bzero/bcmp/index/rindex are marked LEGACY in SuSv3.
* They are replaced as proposed by SuSv3. Don't sync this part
* with glibc and keep it in sync with string.h. */
# define bcopy(src,dest,n) (memmove((dest), (src), (n)), (void) 0)
# define bzero(s,n) (memset((s), '\0', (n)), (void) 0)
# define bcmp(s1,s2,n) memcmp((s1), (s2), (size_t)(n))
# endif
# endif
/* Return the position of the first bit set in I, or 0 if none are set.
The least-significant bit is position 1, the most-significant 32. */
extern int ffs (int __i) __THROW __attribute__ ((__const__));
libc_hidden_proto(ffs)
/* The following two functions are non-standard but necessary for non-32 bit
platforms. */
# ifdef __USE_GNU
extern int ffsl (long int __l) __THROW __attribute__ ((__const__));
# ifdef __GNUC__
__extension__ extern int ffsll (long long int __ll)
__THROW __attribute__ ((__const__));
# endif
# endif
/* Compare S1 and S2, ignoring case. */
extern int strcasecmp (__const char *__s1, __const char *__s2)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strcasecmp)
/* Compare no more than N chars of S1 and S2, ignoring case. */
extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n)
__THROW __attribute_pure__ __nonnull ((1, 2));
libc_hidden_proto(strncasecmp)
#if defined __USE_XOPEN2K8 && defined <API key>
/* The following functions are equivalent to the both above but they
take the locale they use for the collation as an extra argument.
This is not standardsized but something like will come. */
# include <xlocale.h>
/* Again versions of a few functions which use the given locale instead
of the global one. */
extern int strcasecmp_l (__const char *__s1, __const char *__s2,
__locale_t __loc)
__THROW __attribute_pure__ __nonnull ((1, 2, 3));
libc_hidden_proto(strcasecmp_l)
extern int strncasecmp_l (__const char *__s1, __const char *__s2,
size_t __n, __locale_t __loc)
__THROW __attribute_pure__ __nonnull ((1, 2, 4));
libc_hidden_proto(strncasecmp_l)
#endif
__END_DECLS
#ifdef _LIBC
/* comment is wrong and will face this, when HAS_GNU option will be added
* header is SuSv standard */
#error "<strings.h> should not be included from libc."
#endif
#endif /* string.h */
#endif /* strings.h */
|
package org.wildfly.clustering.infinispan.spi.persistence.sifs;
import static org.infinispan.configuration.cache.<API key>.SEGMENTED;
import static org.infinispan.persistence.sifs.configuration.<API key>.<API key>;
import static org.infinispan.persistence.sifs.configuration.<API key>.OPEN_FILES_LIMIT;
import org.infinispan.commons.configuration.attributes.Attribute;
import org.infinispan.configuration.cache.<API key>;
import org.infinispan.configuration.cache.<API key>;
import org.infinispan.configuration.cache.<API key>;
import org.infinispan.configuration.global.GlobalConfiguration;
import org.infinispan.configuration.global.<API key>;
import org.infinispan.persistence.PersistenceUtil;
import org.infinispan.persistence.sifs.Log;
import org.infinispan.persistence.sifs.<API key>;
import org.infinispan.persistence.sifs.configuration.DataConfiguration;
import org.infinispan.persistence.sifs.configuration.<API key>;
import org.infinispan.persistence.sifs.configuration.IndexConfiguration;
import org.infinispan.persistence.sifs.configuration.<API key>;
import org.infinispan.util.logging.LogFactory;
/**
* Workaround for ISPN-13605.
* @author Paul Ferraro
*/
public class <API key> extends <API key><<API key>, <API key>> {
private static final Log LOG = LogFactory.getLog(<API key>.class, Log.class);
protected final <API key> index = new <API key>();
protected final <API key> data = new <API key>();
public <API key>(<API key> builder) {
super(builder, org.infinispan.persistence.sifs.configuration.<API key>.<API key>(), <API key>.<API key>());
}
/**
* The path where the Soft-Index store will keep its data files. Under this location the store will create
* a directory named after the cache name, under which a <code>data</code> directory will be created.
*
* The default behaviour is to use the {@link <API key>#persistentLocation()}.
*/
public <API key> dataLocation(String dataLocation) {
this.data.dataLocation(dataLocation);
return this;
}
/**
* The path where the Soft-Index store will keep its index files. Under this location the store will create
* a directory named after the cache name, under which a <code>index</code> directory will be created.
*
* The default behaviour is to use the {@link <API key>#persistentLocation()}.
*/
public <API key> indexLocation(String indexLocation) {
this.index.indexLocation(indexLocation);
return this;
}
/**
* Number of index segment files. Increasing this value improves throughput but requires more threads to be spawned.
* <p>
* Defaults to <code>16</code>.
*/
public <API key> indexSegments(int indexSegments) {
this.index.indexSegments(indexSegments);
return this;
}
/**
* Sets the maximum size of single data file with entries, in bytes.
*
* Defaults to <code>16777216</code> (16MB).
*/
public <API key> maxFileSize(int maxFileSize) {
this.data.maxFileSize(maxFileSize);
return this;
}
/**
* If the size of the node (continuous block on filesystem used in index implementation) drops below this threshold,
* the node will try to balance its size with some neighbour node, possibly causing join of multiple nodes.
*
* Defaults to <code>0</code>.
*/
public <API key> minNodeSize(int minNodeSize) {
this.index.minNodeSize(minNodeSize);
return this;
}
/**
* Max size of node (continuous block on filesystem used in index implementation), in bytes.
*
* Defaults to <code>4096</code>.
*/
public <API key> maxNodeSize(int maxNodeSize) {
this.index.maxNodeSize(maxNodeSize);
return this;
}
/**
* Sets the maximum number of entry writes that are waiting to be written to the index, per index segment.
*
* Defaults to <code>1000</code>.
*/
public <API key> indexQueueLength(int indexQueueLength) {
this.index.indexQueueLength(indexQueueLength);
return this;
}
/**
* Sets whether writes shoud wait to be fsynced to disk.
*
* Defaults to <code>false</code>.
*/
public <API key> syncWrites(boolean syncWrites) {
this.data.syncWrites(syncWrites);
return this;
}
/**
* Sets the maximum number of open files.
*
* Defaults to <code>1000</code>.
*/
public <API key> openFilesLimit(int openFilesLimit) {
this.attributes.attribute(OPEN_FILES_LIMIT).set(openFilesLimit);
return this;
}
/**
* If the amount of unused space in some data file gets above this threshold, the file is compacted - entries from that file are copied to a new file and the old file is deleted.
*
* Defaults to <code>0.5</code> (50%).
*/
public <API key> compactionThreshold(double compactionThreshold) {
this.attributes.attribute(<API key>).set(compactionThreshold);
return this;
}
@Override
public <API key> create() {
return new <API key>(this.attributes.protect(), this.async.create(), this.index.create(), this.data.create());
}
@Override
public <API key> read(<API key> template) {
super.read(template);
this.index.read(template.index());
this.data.read(template.data());
return this;
}
@Override
public <API key> self() {
return this;
}
@Override
protected void validate (boolean skipClassChecks) {
Attribute<Boolean> segmentedAttribute = this.attributes.attribute(SEGMENTED);
if (segmentedAttribute.isModified() && !segmentedAttribute.get()) {
throw org.infinispan.util.logging.Log.CONFIG.<API key>(<API key>.class.getSimpleName());
}
super.validate(skipClassChecks);
this.index.validate();
double compactionThreshold = this.attributes.attribute(<API key>).get();
if (compactionThreshold <= 0 || compactionThreshold > 1) {
throw LOG.<API key>(compactionThreshold);
}
}
@Override
public void validate(GlobalConfiguration globalConfig) {
PersistenceUtil.<API key>(globalConfig, <API key>.class.getSimpleName(),
this.data.attributes().attribute(DataConfiguration.DATA_LOCATION),
this.index.attributes().attribute(IndexConfiguration.INDEX_LOCATION));
super.validate(globalConfig);
}
@Override
public String toString () {
return String.format("<API key>{index=%s, data=%s, attributes=%s, async=%s}", this.index, this.data, this.attributes, this.async);
}
}
|
#include <config.h>
#include "qemu_domain.h"
#include "qemu_command.h"
#include "memory.h"
#include "logging.h"
#include "virterror_internal.h"
#include "c-ctype.h"
#include <sys/time.h>
#include <libxml/xpathInternals.h>
#define VIR_FROM_THIS VIR_FROM_QEMU
#define QEMU_NAMESPACE_HREF "http://libvirt.org/schemas/domain/qemu/1.0"
#define timeval_to_ms(tv) (((tv).tv_sec * 1000ull) + ((tv).tv_usec / 1000))
static void *<API key>(void)
{
<API key> priv;
if (VIR_ALLOC(priv) < 0)
return NULL;
return priv;
}
static void <API key>(void *data)
{
<API key> priv = data;
<API key>(priv->pciaddrs);
<API key>(priv->monConfig);
VIR_FREE(priv->vcpupids);
/* This should never be non-NULL if we get here, but just in case... */
if (priv->mon) {
VIR_ERROR0(_("Unexpected QEMU monitor still active during domain deletion"));
qemuMonitorClose(priv->mon);
}
VIR_FREE(priv);
}
static int <API key>(virBufferPtr buf, void *data)
{
<API key> priv = data;
const char *monitorpath;
/* priv->monitor_chr is set only for qemu */
if (priv->monConfig) {
switch (priv->monConfig->type) {
case <API key>:
monitorpath = priv->monConfig->data.nix.path;
break;
default:
case <API key>:
monitorpath = priv->monConfig->data.file.path;
break;
}
<API key>(buf, " <monitor path='%s'", monitorpath);
if (priv->monJSON)
virBufferAddLit(buf, " json='1'");
virBufferVSprintf(buf, " type='%s'/>\n",
<API key>(priv->monConfig->type));
}
if (priv->nvcpupids) {
int i;
virBufferAddLit(buf, " <vcpus>\n");
for (i = 0 ; i < priv->nvcpupids ; i++) {
virBufferVSprintf(buf, " <vcpu pid='%d'/>\n", priv->vcpupids[i]);
}
virBufferAddLit(buf, " </vcpus>\n");
}
return 0;
}
static int <API key>(xmlXPathContextPtr ctxt, void *data)
{
<API key> priv = data;
char *monitorpath;
char *tmp;
int n, i;
xmlNodePtr *nodes = NULL;
if (VIR_ALLOC(priv->monConfig) < 0) {
virReportOOMError();
goto error;
}
if (!(monitorpath =
virXPathString("string(./monitor[1]/@path)", ctxt))) {
qemuReportError(<API key>,
"%s", _("no monitor path"));
goto error;
}
tmp = virXPathString("string(./monitor[1]/@type)", ctxt);
if (tmp)
priv->monConfig->type = <API key>(tmp);
else
priv->monConfig->type = <API key>;
VIR_FREE(tmp);
if (virXPathBoolean("count(./monitor[@json = '1']) > 0", ctxt)) {
priv->monJSON = 1;
} else {
priv->monJSON = 0;
}
switch (priv->monConfig->type) {
case <API key>:
priv->monConfig->data.file.path = monitorpath;
break;
case <API key>:
priv->monConfig->data.nix.path = monitorpath;
break;
default:
VIR_FREE(monitorpath);
qemuReportError(<API key>,
_("unsupported monitor type '%s'"),
<API key>(priv->monConfig->type));
goto error;
}
n = virXPathNodeSet("./vcpus/vcpu", ctxt, &nodes);
if (n < 0)
goto error;
if (n) {
priv->nvcpupids = n;
if (VIR_REALLOC_N(priv->vcpupids, priv->nvcpupids) < 0) {
virReportOOMError();
goto error;
}
for (i = 0 ; i < n ; i++) {
char *pidstr = virXMLPropString(nodes[i], "pid");
if (!pidstr)
goto error;
if (virStrToLong_i(pidstr, NULL, 10, &(priv->vcpupids[i])) < 0) {
VIR_FREE(pidstr);
goto error;
}
VIR_FREE(pidstr);
}
VIR_FREE(nodes);
}
return 0;
error:
<API key>(priv->monConfig);
priv->monConfig = NULL;
VIR_FREE(nodes);
return -1;
}
static void
<API key>(void *nsdata)
{
<API key> cmd = nsdata;
unsigned int i;
if (!cmd)
return;
for (i = 0; i < cmd->num_args; i++)
VIR_FREE(cmd->args[i]);
for (i = 0; i < cmd->num_env; i++) {
VIR_FREE(cmd->env_name[i]);
VIR_FREE(cmd->env_value[i]);
}
VIR_FREE(cmd->args);
VIR_FREE(cmd->env_name);
VIR_FREE(cmd->env_value);
VIR_FREE(cmd);
}
static int
<API key>(xmlDocPtr xml,
xmlNodePtr root,
xmlXPathContextPtr ctxt,
void **data)
{
<API key> cmd = NULL;
xmlNsPtr ns;
xmlNodePtr *nodes = NULL;
int n, i;
ns = xmlSearchNs(xml, root, BAD_CAST "qemu");
if (!ns)
/* this is fine; it just means there was no qemu namespace listed */
return 0;
if (STRNEQ((const char *)ns->href, QEMU_NAMESPACE_HREF)) {
qemuReportError(<API key>,
_("Found namespace '%s' doesn't match expected '%s'"),
ns->href, QEMU_NAMESPACE_HREF);
return -1;
}
if (xmlXPathRegisterNs(ctxt, ns->prefix, ns->href) < 0) {
qemuReportError(<API key>,
_("Failed to register xml namespace '%s'"), ns->href);
return -1;
}
if (VIR_ALLOC(cmd) < 0) {
virReportOOMError();
return -1;
}
/* first handle the extra command-line arguments */
n = virXPathNodeSet("./qemu:commandline/qemu:arg", ctxt, &nodes);
if (n < 0)
/* virXPathNodeSet already set the error */
goto error;
if (n && VIR_ALLOC_N(cmd->args, n) < 0)
goto no_memory;
for (i = 0; i < n; i++) {
cmd->args[cmd->num_args] = virXMLPropString(nodes[i], "value");
if (cmd->args[cmd->num_args] == NULL) {
qemuReportError(<API key>,
"%s", _("No qemu command-line argument specified"));
goto error;
}
cmd->num_args++;
}
VIR_FREE(nodes);
/* now handle the extra environment variables */
n = virXPathNodeSet("./qemu:commandline/qemu:env", ctxt, &nodes);
if (n < 0)
/* virXPathNodeSet already set the error */
goto error;
if (n && VIR_ALLOC_N(cmd->env_name, n) < 0)
goto no_memory;
if (n && VIR_ALLOC_N(cmd->env_value, n) < 0)
goto no_memory;
for (i = 0; i < n; i++) {
char *tmp;
tmp = virXMLPropString(nodes[i], "name");
if (tmp == NULL) {
qemuReportError(<API key>,
"%s", _("No qemu environment name specified"));
goto error;
}
if (tmp[0] == '\0') {
qemuReportError(<API key>,
"%s", _("Empty qemu environment name specified"));
goto error;
}
if (!c_isalpha(tmp[0]) && tmp[0] != '_') {
qemuReportError(<API key>,
"%s", _("Invalid environment name, it must begin with a letter or underscore"));
goto error;
}
if (strspn(tmp, "<API key>") != strlen(tmp)) {
qemuReportError(<API key>,
"%s", _("Invalid environment name, it must contain only alphanumerics and underscore"));
goto error;
}
cmd->env_name[cmd->num_env] = tmp;
cmd->env_value[cmd->num_env] = virXMLPropString(nodes[i], "value");
/* a NULL value for command is allowed, since it might be empty */
cmd->num_env++;
}
VIR_FREE(nodes);
*data = cmd;
return 0;
no_memory:
virReportOOMError();
error:
VIR_FREE(nodes);
<API key>(cmd);
return -1;
}
static int
<API key>(virBufferPtr buf,
void *nsdata)
{
<API key> cmd = nsdata;
unsigned int i;
if (!cmd->num_args && !cmd->num_env)
return 0;
virBufferAddLit(buf, " <qemu:commandline>\n");
for (i = 0; i < cmd->num_args; i++)
<API key>(buf, " <qemu:arg value='%s'/>\n",
cmd->args[i]);
for (i = 0; i < cmd->num_env; i++) {
virBufferVSprintf(buf, " <qemu:env name='%s'", cmd->env_name[i]);
if (cmd->env_value[i])
<API key>(buf, " value='%s'", cmd->env_value[i]);
virBufferAddLit(buf, "/>\n");
}
virBufferAddLit(buf, " </qemu:commandline>\n");
return 0;
}
static const char *
<API key>(void)
{
return "xmlns:qemu='" QEMU_NAMESPACE_HREF "'";
}
void <API key>(virCapsPtr caps)
{
/* Domain XML parser hooks */
caps-><API key> = <API key>;
caps->privateDataFreeFunc = <API key>;
caps-><API key> = <API key>;
caps->privateDataXMLParse = <API key>;
}
void <API key>(virCapsPtr caps)
{
/* Domain Namespace XML parser hooks */
caps->ns.parse = <API key>;
caps->ns.free = <API key>;
caps->ns.format = <API key>;
caps->ns.href = <API key>;
}
/*
* obj must be locked before calling, qemud_driver must NOT be locked
*
* This must be called by anything that will change the VM state
* in any way, or anything that will use the QEMU monitor.
*
* Upon successful return, the object will have its ref count increased,
* successful calls must be followed by EndJob eventually
*/
/* Give up waiting for mutex after 30 seconds */
#define QEMU_JOB_WAIT_TIME (1000ull * 30)
int <API key>(virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
struct timeval now;
unsigned long long then;
if (gettimeofday(&now, NULL) < 0) {
<API key>(errno, "%s",
_("cannot get time of day"));
return -1;
}
then = timeval_to_ms(now) + QEMU_JOB_WAIT_TIME;
virDomainObjRef(obj);
while (priv->jobActive) {
if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
virDomainObjUnref(obj);
if (errno == ETIMEDOUT)
qemuReportError(<API key>,
"%s", _("cannot acquire state change lock"));
else
<API key>(errno,
"%s", _("cannot acquire job mutex"));
return -1;
}
}
priv->jobActive = <API key>;
priv->jobSignals = 0;
memset(&priv->jobSignalsData, 0, sizeof(priv->jobSignalsData));
priv->jobStart = timeval_to_ms(now);
memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
return 0;
}
/*
* obj must be locked before calling, qemud_driver must be locked
*
* This must be called by anything that will change the VM state
* in any way, or anything that will use the QEMU monitor.
*/
int <API key>(struct qemud_driver *driver,
virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
struct timeval now;
unsigned long long then;
if (gettimeofday(&now, NULL) < 0) {
<API key>(errno, "%s",
_("cannot get time of day"));
return -1;
}
then = timeval_to_ms(now) + QEMU_JOB_WAIT_TIME;
virDomainObjRef(obj);
qemuDriverUnlock(driver);
while (priv->jobActive) {
if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
virDomainObjUnref(obj);
if (errno == ETIMEDOUT)
qemuReportError(<API key>,
"%s", _("cannot acquire state change lock"));
else
<API key>(errno,
"%s", _("cannot acquire job mutex"));
qemuDriverLock(driver);
return -1;
}
}
priv->jobActive = <API key>;
priv->jobSignals = 0;
memset(&priv->jobSignalsData, 0, sizeof(priv->jobSignalsData));
priv->jobStart = timeval_to_ms(now);
memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
virDomainObjUnlock(obj);
qemuDriverLock(driver);
virDomainObjLock(obj);
return 0;
}
/*
* obj must be locked before calling, qemud_driver does not matter
*
* To be called after completing the work associated with the
* earlier qemuDomainBeginJob() call
*
* Returns remaining refcount on 'obj', maybe 0 to indicated it
* was deleted
*/
int qemuDomainObjEndJob(virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
priv->jobActive = QEMU_JOB_NONE;
priv->jobSignals = 0;
memset(&priv->jobSignalsData, 0, sizeof(priv->jobSignalsData));
priv->jobStart = 0;
memset(&priv->jobInfo, 0, sizeof(priv->jobInfo));
virCondSignal(&priv->jobCond);
return virDomainObjUnref(obj);
}
/*
* obj must be locked before calling, qemud_driver must be unlocked
*
* To be called immediately before any QEMU monitor API call
* Must have already called <API key>(), and checked
* that the VM is still active.
*
* To be followed with <API key>() once complete
*/
void <API key>(virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
qemuMonitorLock(priv->mon);
qemuMonitorRef(priv->mon);
virDomainObjUnlock(obj);
}
/* obj must NOT be locked before calling, qemud_driver must be unlocked
*
* Should be paired with an earlier <API key>() call
*/
void <API key>(virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
int refs;
refs = qemuMonitorUnref(priv->mon);
if (refs > 0)
qemuMonitorUnlock(priv->mon);
virDomainObjLock(obj);
if (refs == 0) {
priv->mon = NULL;
}
}
/*
* obj must be locked before calling, qemud_driver must be locked
*
* To be called immediately before any QEMU monitor API call
* Must have already called <API key>().
*
* To be followed with <API key>() once complete
*/
void <API key>(struct qemud_driver *driver,
virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
qemuMonitorLock(priv->mon);
qemuMonitorRef(priv->mon);
virDomainObjUnlock(obj);
qemuDriverUnlock(driver);
}
/* obj must NOT be locked before calling, qemud_driver must be unlocked,
* and will be locked after returning
*
* Should be paired with an earlier <API key>() call
*/
void <API key>(struct qemud_driver *driver,
virDomainObjPtr obj)
{
<API key> priv = obj->privateData;
int refs;
refs = qemuMonitorUnref(priv->mon);
if (refs > 0)
qemuMonitorUnlock(priv->mon);
qemuDriverLock(driver);
virDomainObjLock(obj);
if (refs == 0) {
priv->mon = NULL;
}
}
void <API key>(struct qemud_driver *driver,
virDomainObjPtr obj)
{
virDomainObjRef(obj);
virDomainObjUnlock(obj);
qemuDriverUnlock(driver);
}
void <API key>(struct qemud_driver *driver,
virDomainObjPtr obj)
{
qemuDriverLock(driver);
virDomainObjLock(obj);
virDomainObjUnref(obj);
}
|
(function(modules) { // webpackBootstrap
// The module cache
var installedModules = {};
// The require function
function __webpack_require__(moduleId) {
// Check if module is in cache
if(installedModules[moduleId])
return installedModules[moduleId].exports;
// Create a new module (and put it into the cache)
var module = installedModules[moduleId] = {
exports: {},
id: moduleId,
loaded: false
};
// Execute the module function
modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
// Flag the module as loaded
module.loaded = true;
// Return the exports of the module
return module.exports;
}
// expose the modules object (__webpack_modules__)
__webpack_require__.m = modules;
// expose the module cache
__webpack_require__.c = installedModules;
// <API key>
__webpack_require__.p = "./";
// Load entry module and return exports
return __webpack_require__(0);
})
([
function(module, exports, __webpack_require__) {
'use strict';
var _addClass = __webpack_require__(25);
var _addClass2 = <API key>(_addClass);
var _removeClass = __webpack_require__(26);
var _removeClass2 = <API key>(_removeClass);
var _after = __webpack_require__(96);
var _after2 = <API key>(_after);
var _browser = __webpack_require__(97);
var _browser2 = <API key>(_browser);
var _fix = __webpack_require__(98);
var _fix2 = <API key>(_fix);
var _util = __webpack_require__(27);
function <API key>(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// fix hexo
function isPathMatch(path, href) {
var reg = /\/|index.html/g;
return path.replace(reg, '') === href.replace(reg, '');
}
function tabActive() {
var $tabs = document.querySelectorAll('.js-header-menu li a');
var path = window.location.pathname;
for (var i = 0, len = $tabs.length; i < len; i++) {
var $tab = $tabs[i];
if (isPathMatch(path, $tab.getAttribute('href'))) {
(0, _addClass2.default)($tab, 'active');
}
}
}
function getElementLeft(element) {
var actualLeft = element.offsetLeft;
var current = element.offsetParent;
while (current !== null) {
actualLeft += current.offsetLeft;
current = current.offsetParent;
}
return actualLeft;
}
function getElementTop(element) {
var actualTop = element.offsetTop;
var current = element.offsetParent;
while (current !== null) {
actualTop += current.offsetTop;
current = current.offsetParent;
}
return actualTop;
}
function scrollStop($dom, top, limit, zIndex, diff) {
var nowLeft = getElementLeft($dom);
var nowTop = getElementTop($dom) - top;
if (nowTop - limit <= diff) {
var $newDom = $dom.$newDom;
if (!$newDom) {
$newDom = $dom.cloneNode(true);
(0, _after2.default)($dom, $newDom);
$dom.$newDom = $newDom;
$newDom.style.position = 'fixed';
$newDom.style.top = (limit || nowTop) + 'px';
$newDom.style.left = nowLeft + 'px';
$newDom.style.zIndex = zIndex || 2;
$newDom.style.width = '100%';
$newDom.style.color = '#fff';
}
$newDom.style.visibility = 'visible';
$dom.style.visibility = 'hidden';
} else {
$dom.style.visibility = 'visible';
var _$newDom = $dom.$newDom;
if (_$newDom) {
_$newDom.style.visibility = 'hidden';
}
}
}
function handleScroll() {
var $overlay = document.querySelector('.js-overlay');
var $menu = document.querySelector('.js-header-menu');
scrollStop($overlay, document.body.scrollTop, -63, 2, 0);
scrollStop($menu, document.body.scrollTop, 1, 3, 0);
}
function bindScroll() {
document.querySelector('#container').addEventListener('scroll', function (e) {
handleScroll();
});
window.addEventListener('scroll', function (e) {
handleScroll();
});
handleScroll();
}
function init() {
if (_browser2.default.versions.mobile && window.screen.width < 800) {
tabActive();
bindScroll();
}
}
init();
(0, _util.addLoadEvent)(function () {
_fix2.default.init();
});
module.exports = {};
},
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
,
function(module, exports) {
/**
* addClass : addClass(el, className)
* Adds a class name to an element. Compare with `$.fn.addClass`.
*
* var addClass = require('dom101/add-class');
*
* addClass(el, 'active');
*/
function addClass (el, className) {
if (el.classList) {
el.classList.add(className);
} else {
el.className += ' ' + className;
}
}
module.exports = addClass;
},
function(module, exports) {
/**
* removeClass : removeClass(el, className)
* Removes a classname.
*
* var removeClass = require('dom101/remove-class');
*
* el.className = 'selected active';
* removeClass(el, 'active');
*
* el.className
* => "selected"
*/
function removeClass (el, className) {
if (el.classList) {
el.classList.remove(className);
} else {
var expr =
new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi');
el.className = el.className.replace(expr, ' ');
}
}
module.exports = removeClass;
},
function(module, exports, __webpack_require__) {
"use strict";
var _typeof2 = __webpack_require__(28);
var _typeof3 = <API key>(_typeof2);
function <API key>(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var e = function () {
function r(e, r, n) {
return r || n ? String.fromCharCode(r || n) : u[e] || e;
}
function n(e) {
return p[e];
}
var t = /"|<|>|&| |'|&#(\d+);|&#(\d+)/g,
o = /['<> "&]/g,
u = {
""": '"',
"<": "<",
">": ">",
"&": "&",
" ": " "
},
c = /\u00a0/g,
a = /<br\s*\/?>/gi,
i = /\r?\n/g,
f = /\s/g,
p = {};
for (var s in u) {
p[u[s]] = s;
}return u["'"] = "'", p["'"] = "&
encode: function encode(e) {
return e ? ("" + e).replace(o, n).replace(i, "<br/>").replace(f, " ") : "";
},
decode: function decode(e) {
return e ? ("" + e).replace(a, "\n").replace(t, r).replace(c, " ") : "";
},
encodeBase16: function encodeBase16(e) {
if (!e) return e;
e += "";
for (var r = [], n = 0, t = e.length; t > n; n++) {
r.push(e.charCodeAt(n).toString(16).toUpperCase());
}return r.join("");
},
encodeBase16forJSON: function encodeBase16forJSON(e) {
if (!e) return e;
e = e.replace(/[\u4E00-\u9FBF]/gi, function (e) {
return escape(e).replace("%u", "\\u");
});
for (var r = [], n = 0, t = e.length; t > n; n++) {
r.push(e.charCodeAt(n).toString(16).toUpperCase());
}return r.join("");
},
decodeBase16: function decodeBase16(e) {
if (!e) return e;
e += "";
for (var r = [], n = 0, t = e.length; t > n; n += 2) {
r.push(String.fromCharCode("0x" + e.slice(n, n + 2)));
}return r.join("");
},
encodeObject: function encodeObject(r) {
if (r instanceof Array) for (var n = 0, t = r.length; t > n; n++) {
r[n] = e.encodeObject(r[n]);
} else if ("object" == (typeof r === "undefined" ? "undefined" : (0, _typeof3.default)(r))) for (var o in r) {
r[o] = e.encodeObject(r[o]);
} else if ("string" == typeof r) return e.encode(r);
return r;
},
loadScript: function loadScript(path) {
var $script = document.createElement('script');
document.<API key>('body')[0].appendChild($script);
$script.setAttribute('src', path);
},
addLoadEvent: function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != "function") {
window.onload = func;
} else {
window.onload = function () {
oldonload();
func();
};
}
}
};
}();
module.exports = e;
},
function(module, exports, __webpack_require__) {
"use strict";
exports.__esModule = true;
var _iterator = __webpack_require__(29);
var _iterator2 = <API key>(_iterator);
var _symbol = __webpack_require__(80);
var _symbol2 = <API key>(_symbol);
var _typeof = typeof _symbol2.default === "function" && typeof _iterator2.default === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj; };
function <API key>(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = typeof _symbol2.default === "function" && _typeof(_iterator2.default) === "symbol" ? function (obj) {
return typeof obj === "undefined" ? "undefined" : _typeof(obj);
} : function (obj) {
return obj && typeof _symbol2.default === "function" && obj.constructor === _symbol2.default && obj !== _symbol2.default.prototype ? "symbol" : typeof obj === "undefined" ? "undefined" : _typeof(obj);
};
},
function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(30), __esModule: true };
},
function(module, exports, __webpack_require__) {
__webpack_require__(31);
__webpack_require__(75);
module.exports = __webpack_require__(79).f('iterator');
},
function(module, exports, __webpack_require__) {
'use strict';
var $at = __webpack_require__(32)(true);
// 21.1.3.27 String.prototype[@@iterator]()
__webpack_require__(35)(String, 'String', function(iterated){
this._t = String(iterated); // target
this._i = 0; // next index
// 21.1.5.2.1 %<API key>%.next()
}, function(){
var O = this._t
, index = this._i
, point;
if(index >= O.length)return {value: undefined, done: true};
point = $at(O, index);
this._i += point.length;
return {value: point, done: false};
});
},
function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(33)
, defined = __webpack_require__(34);
// true -> String
// false -> String#codePointAt
module.exports = function(TO_STRING){
return function(that, pos){
var s = String(defined(that))
, i = toInteger(pos)
, l = s.length
, a, b;
if(i < 0 || i >= l)return TO_STRING ? '' : undefined;
a = s.charCodeAt(i);
return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff
? TO_STRING ? s.charAt(i) : a
: TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
};
};
},
function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil
, floor = Math.floor;
module.exports = function(it){
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
},
function(module, exports) {
// 7.2.1 <API key>(argument)
module.exports = function(it){
if(it == undefined)throw TypeError("Can't call method on " + it);
return it;
};
},
function(module, exports, __webpack_require__) {
'use strict';
var LIBRARY = __webpack_require__(36)
, $export = __webpack_require__(37)
, redefine = __webpack_require__(52)
, hide = __webpack_require__(42)
, has = __webpack_require__(53)
, Iterators = __webpack_require__(54)
, $iterCreate = __webpack_require__(55)
, setToStringTag = __webpack_require__(71)
, getPrototypeOf = __webpack_require__(73)
, ITERATOR = __webpack_require__(72)('iterator')
, BUGGY = !([].keys && 'next' in [].keys()) // Safari has buggy iterators w/o `next`
, FF_ITERATOR = '@@iterator'
, KEYS = 'keys'
, VALUES = 'values';
var returnThis = function(){ return this; };
module.exports = function(Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED){
$iterCreate(Constructor, NAME, next);
var getMethod = function(kind){
if(!BUGGY && kind in proto)return proto[kind];
switch(kind){
case KEYS: return function keys(){ return new Constructor(this, kind); };
case VALUES: return function values(){ return new Constructor(this, kind); };
} return function entries(){ return new Constructor(this, kind); };
};
var TAG = NAME + ' Iterator'
, DEF_VALUES = DEFAULT == VALUES
, VALUES_BUG = false
, proto = Base.prototype
, $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT]
, $default = $native || getMethod(DEFAULT)
, $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined
, $anyNative = NAME == 'Array' ? proto.entries || $native : $native
, methods, key, IteratorPrototype;
// Fix native
if($anyNative){
IteratorPrototype = getPrototypeOf($anyNative.call(new Base));
if(IteratorPrototype !== Object.prototype){
// Set @@toStringTag to native iterators
setToStringTag(IteratorPrototype, TAG, true);
// fix for some old engines
if(!LIBRARY && !has(IteratorPrototype, ITERATOR))hide(IteratorPrototype, ITERATOR, returnThis);
}
}
// fix Array#{values, @@iterator}.name in V8 / FF
if(DEF_VALUES && $native && $native.name !== VALUES){
VALUES_BUG = true;
$default = function values(){ return $native.call(this); };
}
// Define iterator
if((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])){
hide(proto, ITERATOR, $default);
}
// Plug for library
Iterators[NAME] = $default;
Iterators[TAG] = returnThis;
if(DEFAULT){
methods = {
values: DEF_VALUES ? $default : getMethod(VALUES),
keys: IS_SET ? $default : getMethod(KEYS),
entries: $entries
};
if(FORCED)for(key in methods){
if(!(key in proto))redefine(proto, key, methods[key]);
} else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
}
return methods;
};
},
function(module, exports) {
module.exports = true;
},
function(module, exports, __webpack_require__) {
var global = __webpack_require__(38)
, core = __webpack_require__(39)
, ctx = __webpack_require__(40)
, hide = __webpack_require__(42)
, PROTOTYPE = 'prototype';
var $export = function(type, name, source){
var IS_FORCED = type & $export.F
, IS_GLOBAL = type & $export.G
, IS_STATIC = type & $export.S
, IS_PROTO = type & $export.P
, IS_BIND = type & $export.B
, IS_WRAP = type & $export.W
, exports = IS_GLOBAL ? core : core[name] || (core[name] = {})
, expProto = exports[PROTOTYPE]
, target = IS_GLOBAL ? global : IS_STATIC ? global[name] : (global[name] || {})[PROTOTYPE]
, key, own, out;
if(IS_GLOBAL)source = name;
for(key in source){
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
if(own && key in exports)continue;
// export native or passed
out = own ? target[key] : source[key];
// prevent global pollution for namespaces
exports[key] = IS_GLOBAL && typeof target[key] != 'function' ? source[key]
// bind timers to global for call from export context
: IS_BIND && own ? ctx(out, global)
// wrap global constructors for prevent change them in library
: IS_WRAP && target[key] == out ? (function(C){
var F = function(a, b, c){
if(this instanceof C){
switch(arguments.length){
case 0: return new C;
case 1: return new C(a);
case 2: return new C(a, b);
} return new C(a, b, c);
} return C.apply(this, arguments);
};
F[PROTOTYPE] = C[PROTOTYPE];
return F;
// make static versions for prototype methods
})(out) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// export proto methods to core.%CONSTRUCTOR%.methods.%NAME%
if(IS_PROTO){
(exports.virtual || (exports.virtual = {}))[key] = out;
// export proto methods to core.%CONSTRUCTOR%.prototype.%NAME%
if(type & $export.R && expProto && !expProto[key])hide(expProto, key, out);
}
}
};
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
},
function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#<API key>
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
if(typeof __g == 'number')__g = global; // eslint-disable-line no-undef
},
function(module, exports) {
var core = module.exports = {version: '2.4.0'};
if(typeof __e == 'number')__e = core; // eslint-disable-line no-undef
},
function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(41);
module.exports = function(fn, that, length){
aFunction(fn);
if(that === undefined)return fn;
switch(length){
case 1: return function(a){
return fn.call(that, a);
};
case 2: return function(a, b){
return fn.call(that, a, b);
};
case 3: return function(a, b, c){
return fn.call(that, a, b, c);
};
}
return function(/* ...args */){
return fn.apply(that, arguments);
};
};
},
function(module, exports) {
module.exports = function(it){
if(typeof it != 'function')throw TypeError(it + ' is not a function!');
return it;
};
},
function(module, exports, __webpack_require__) {
var dP = __webpack_require__(43)
, createDesc = __webpack_require__(51);
module.exports = __webpack_require__(47) ? function(object, key, value){
return dP.f(object, key, createDesc(1, value));
} : function(object, key, value){
object[key] = value;
return object;
};
},
function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(44)
, IE8_DOM_DEFINE = __webpack_require__(46)
, toPrimitive = __webpack_require__(50)
, dP = Object.defineProperty;
exports.f = __webpack_require__(47) ? Object.defineProperty : function defineProperty(O, P, Attributes){
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if(IE8_DOM_DEFINE)try {
return dP(O, P, Attributes);
} catch(e){ /* empty */ }
if('get' in Attributes || 'set' in Attributes)throw TypeError('Accessors not supported!');
if('value' in Attributes)O[P] = Attributes.value;
return O;
};
},
function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(45);
module.exports = function(it){
if(!isObject(it))throw TypeError(it + ' is not an object!');
return it;
};
},
function(module, exports) {
module.exports = function(it){
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
},
function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(47) && !__webpack_require__(48)(function(){
return Object.defineProperty(__webpack_require__(49)('div'), 'a', {get: function(){ return 7; }}).a != 7;
});
},
function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(48)(function(){
return Object.defineProperty({}, 'a', {get: function(){ return 7; }}).a != 7;
});
},
function(module, exports) {
module.exports = function(exec){
try {
return !!exec();
} catch(e){
return true;
}
};
},
function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(45)
, document = __webpack_require__(38).document
// in old IE typeof document.createElement is 'object'
, is = isObject(document) && isObject(document.createElement);
module.exports = function(it){
return is ? document.createElement(it) : {};
};
},
function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(45);
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function(it, S){
if(!isObject(it))return it;
var fn, val;
if(S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
if(typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it)))return val;
if(!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it)))return val;
throw TypeError("Can't convert object to primitive value");
};
},
function(module, exports) {
module.exports = function(bitmap, value){
return {
enumerable : !(bitmap & 1),
configurable: !(bitmap & 2),
writable : !(bitmap & 4),
value : value
};
};
},
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(42);
},
function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function(it, key){
return hasOwnProperty.call(it, key);
};
},
function(module, exports) {
module.exports = {};
},
function(module, exports, __webpack_require__) {
'use strict';
var create = __webpack_require__(56)
, descriptor = __webpack_require__(51)
, setToStringTag = __webpack_require__(71)
, IteratorPrototype = {};
// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
__webpack_require__(42)(IteratorPrototype, __webpack_require__(72)('iterator'), function(){ return this; });
module.exports = function(Constructor, NAME, next){
Constructor.prototype = create(IteratorPrototype, {next: descriptor(1, next)});
setToStringTag(Constructor, NAME + ' Iterator');
};
},
function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(44)
, dPs = __webpack_require__(57)
, enumBugKeys = __webpack_require__(69)
, IE_PROTO = __webpack_require__(66)('IE_PROTO')
, Empty = function(){ /* empty */ }
, PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function(){
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(49)('iframe')
, i = enumBugKeys.length
, lt = '<'
, gt = '>'
, iframeDocument;
iframe.style.display = 'none';
__webpack_require__(70).appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while(i--)delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties){
var result;
if(O !== null){
Empty[PROTOTYPE] = anObject(O);
result = new Empty;
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
},
function(module, exports, __webpack_require__) {
var dP = __webpack_require__(43)
, anObject = __webpack_require__(44)
, getKeys = __webpack_require__(58);
module.exports = __webpack_require__(47) ? Object.defineProperties : function defineProperties(O, Properties){
anObject(O);
var keys = getKeys(Properties)
, length = keys.length
, i = 0
, P;
while(length > i)dP.f(O, P = keys[i++], Properties[P]);
return O;
};
},
function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(59)
, enumBugKeys = __webpack_require__(69);
module.exports = Object.keys || function keys(O){
return $keys(O, enumBugKeys);
};
},
function(module, exports, __webpack_require__) {
var has = __webpack_require__(53)
, toIObject = __webpack_require__(60)
, arrayIndexOf = __webpack_require__(63)(false)
, IE_PROTO = __webpack_require__(66)('IE_PROTO');
module.exports = function(object, names){
var O = toIObject(object)
, i = 0
, result = []
, key;
for(key in O)if(key != IE_PROTO)has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while(names.length > i)if(has(O, key = names[i++])){
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
},
function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(61)
, defined = __webpack_require__(34);
module.exports = function(it){
return IObject(defined(it));
};
},
function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(62);
module.exports = Object('z').<API key>(0) ? Object : function(it){
return cof(it) == 'String' ? it.split('') : Object(it);
};
},
function(module, exports) {
var toString = {}.toString;
module.exports = function(it){
return toString.call(it).slice(8, -1);
};
},
function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(60)
, toLength = __webpack_require__(64)
, toIndex = __webpack_require__(65);
module.exports = function(IS_INCLUDES){
return function($this, el, fromIndex){
var O = toIObject($this)
, length = toLength(O.length)
, index = toIndex(fromIndex, length)
, value;
// Array#includes uses SameValueZero equality algorithm
if(IS_INCLUDES && el != el)while(length > index){
value = O[index++];
if(value != value)return true;
// Array#toIndex ignores holes, Array#includes - not
} else for(;length > index; index++)if(IS_INCLUDES || index in O){
if(O[index] === el)return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
},
function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(33)
, min = Math.min;
module.exports = function(it){
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
},
function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(33)
, max = Math.max
, min = Math.min;
module.exports = function(index, length){
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
},
function(module, exports, __webpack_require__) {
var shared = __webpack_require__(67)('keys')
, uid = __webpack_require__(68);
module.exports = function(key){
return shared[key] || (shared[key] = uid(key));
};
},
function(module, exports, __webpack_require__) {
var global = __webpack_require__(38)
, SHARED = '__core-js_shared__'
, store = global[SHARED] || (global[SHARED] = {});
module.exports = function(key){
return store[key] || (store[key] = {});
};
},
function(module, exports) {
var id = 0
, px = Math.random();
module.exports = function(key){
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
},
function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,<API key>,toLocaleString,toString,valueOf'
).split(',');
},
function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(38).document && document.documentElement;
},
function(module, exports, __webpack_require__) {
var def = __webpack_require__(43).f
, has = __webpack_require__(53)
, TAG = __webpack_require__(72)('toStringTag');
module.exports = function(it, tag, stat){
if(it && !has(it = stat ? it : it.prototype, TAG))def(it, TAG, {configurable: true, value: tag});
};
},
function(module, exports, __webpack_require__) {
var store = __webpack_require__(67)('wks')
, uid = __webpack_require__(68)
, Symbol = __webpack_require__(38).Symbol
, USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function(name){
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
},
function(module, exports, __webpack_require__) {
// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
var has = __webpack_require__(53)
, toObject = __webpack_require__(74)
, IE_PROTO = __webpack_require__(66)('IE_PROTO')
, ObjectProto = Object.prototype;
module.exports = Object.getPrototypeOf || function(O){
O = toObject(O);
if(has(O, IE_PROTO))return O[IE_PROTO];
if(typeof O.constructor == 'function' && O instanceof O.constructor){
return O.constructor.prototype;
} return O instanceof Object ? ObjectProto : null;
};
},
function(module, exports, __webpack_require__) {
// 7.1.13 ToObject(argument)
var defined = __webpack_require__(34);
module.exports = function(it){
return Object(defined(it));
};
},
function(module, exports, __webpack_require__) {
__webpack_require__(76);
var global = __webpack_require__(38)
, hide = __webpack_require__(42)
, Iterators = __webpack_require__(54)
, TO_STRING_TAG = __webpack_require__(72)('toStringTag');
for(var collections = ['NodeList', 'DOMTokenList', 'MediaList', 'StyleSheetList', 'CSSRuleList'], i = 0; i < 5; i++){
var NAME = collections[i]
, Collection = global[NAME]
, proto = Collection && Collection.prototype;
if(proto && !proto[TO_STRING_TAG])hide(proto, TO_STRING_TAG, NAME);
Iterators[NAME] = Iterators.Array;
}
},
function(module, exports, __webpack_require__) {
'use strict';
var addToUnscopables = __webpack_require__(77)
, step = __webpack_require__(78)
, Iterators = __webpack_require__(54)
, toIObject = __webpack_require__(60);
// 22.1.3.4 Array.prototype.entries()
// 22.1.3.13 Array.prototype.keys()
// 22.1.3.29 Array.prototype.values()
// 22.1.3.30 Array.prototype[@@iterator]()
module.exports = __webpack_require__(35)(Array, 'Array', function(iterated, kind){
this._t = toIObject(iterated); // target
this._i = 0; // next index
this._k = kind; // kind
// 22.1.5.2.1 %<API key>%.next()
}, function(){
var O = this._t
, kind = this._k
, index = this._i++;
if(!O || index >= O.length){
this._t = undefined;
return step(1);
}
if(kind == 'keys' )return step(0, index);
if(kind == 'values')return step(0, O[index]);
return step(0, [index, O[index]]);
}, 'values');
// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
Iterators.Arguments = Iterators.Array;
addToUnscopables('keys');
addToUnscopables('values');
addToUnscopables('entries');
},
function(module, exports) {
module.exports = function(){ /* empty */ };
},
function(module, exports) {
module.exports = function(done, value){
return {value: value, done: !!done};
};
},
function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(72);
},
function(module, exports, __webpack_require__) {
module.exports = { "default": __webpack_require__(81), __esModule: true };
},
function(module, exports, __webpack_require__) {
__webpack_require__(82);
__webpack_require__(93);
__webpack_require__(94);
__webpack_require__(95);
module.exports = __webpack_require__(39).Symbol;
},
function(module, exports, __webpack_require__) {
'use strict';
// ECMAScript 6 symbols shim
var global = __webpack_require__(38)
, has = __webpack_require__(53)
, DESCRIPTORS = __webpack_require__(47)
, $export = __webpack_require__(37)
, redefine = __webpack_require__(52)
, META = __webpack_require__(83).KEY
, $fails = __webpack_require__(48)
, shared = __webpack_require__(67)
, setToStringTag = __webpack_require__(71)
, uid = __webpack_require__(68)
, wks = __webpack_require__(72)
, wksExt = __webpack_require__(79)
, wksDefine = __webpack_require__(84)
, keyOf = __webpack_require__(85)
, enumKeys = __webpack_require__(86)
, isArray = __webpack_require__(89)
, anObject = __webpack_require__(44)
, toIObject = __webpack_require__(60)
, toPrimitive = __webpack_require__(50)
, createDesc = __webpack_require__(51)
, _create = __webpack_require__(56)
, gOPNExt = __webpack_require__(90)
, $GOPD = __webpack_require__(92)
, $DP = __webpack_require__(43)
, $keys = __webpack_require__(58)
, gOPD = $GOPD.f
, dP = $DP.f
, gOPN = gOPNExt.f
, $Symbol = global.Symbol
, $JSON = global.JSON
, _stringify = $JSON && $JSON.stringify
, PROTOTYPE = 'prototype'
, HIDDEN = wks('_hidden')
, TO_PRIMITIVE = wks('toPrimitive')
, isEnum = {}.<API key>
, SymbolRegistry = shared('symbol-registry')
, AllSymbols = shared('symbols')
, OPSymbols = shared('op-symbols')
, ObjectProto = Object[PROTOTYPE]
, USE_NATIVE = typeof $Symbol == 'function'
, QObject = global.QObject;
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
var setSymbolDesc = DESCRIPTORS && $fails(function(){
return _create(dP({}, 'a', {
get: function(){ return dP(this, 'a', {value: 7}).a; }
})).a != 7;
}) ? function(it, key, D){
var protoDesc = gOPD(ObjectProto, key);
if(protoDesc)delete ObjectProto[key];
dP(it, key, D);
if(protoDesc && it !== ObjectProto)dP(ObjectProto, key, protoDesc);
} : dP;
var wrap = function(tag){
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
sym._k = tag;
return sym;
};
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function(it){
return typeof it == 'symbol';
} : function(it){
return it instanceof $Symbol;
};
var $defineProperty = function defineProperty(it, key, D){
if(it === ObjectProto)$defineProperty(OPSymbols, key, D);
anObject(it);
key = toPrimitive(key, true);
anObject(D);
if(has(AllSymbols, key)){
if(!D.enumerable){
if(!has(it, HIDDEN))dP(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if(has(it, HIDDEN) && it[HIDDEN][key])it[HIDDEN][key] = false;
D = _create(D, {enumerable: createDesc(0, false)});
} return setSymbolDesc(it, key, D);
} return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P){
anObject(it);
var keys = enumKeys(P = toIObject(P))
, i = 0
, l = keys.length
, key;
while(l > i)$defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P){
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $<API key> = function <API key>(key){
var E = isEnum.call(this, key = toPrimitive(key, true));
if(this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return false;
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $<API key> = function <API key>(it, key){
it = toIObject(it);
key = toPrimitive(key, true);
if(it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key))return;
var D = gOPD(it, key);
if(D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key]))D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it){
var names = gOPN(toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i){
if(!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META)result.push(key);
} return result;
};
var $<API key> = function <API key>(it){
var IS_OP = it === ObjectProto
, names = gOPN(IS_OP ? OPSymbols : toIObject(it))
, result = []
, i = 0
, key;
while(names.length > i){
if(has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true))result.push(AllSymbols[key]);
} return result;
};
// 19.4.1.1 Symbol([description])
if(!USE_NATIVE){
$Symbol = function Symbol(){
if(this instanceof $Symbol)throw TypeError('Symbol is not a constructor!');
var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
var $set = function(value){
if(this === ObjectProto)$set.call(OPSymbols, value);
if(has(this, HIDDEN) && has(this[HIDDEN], tag))this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
};
if(DESCRIPTORS && setter)setSymbolDesc(ObjectProto, tag, {configurable: true, set: $set});
return wrap(tag);
};
redefine($Symbol[PROTOTYPE], 'toString', function toString(){
return this._k;
});
$GOPD.f = $<API key>;
$DP.f = $defineProperty;
__webpack_require__(91).f = gOPNExt.f = $getOwnPropertyNames;
__webpack_require__(88).f = $<API key>;
__webpack_require__(87).f = $<API key>;
if(DESCRIPTORS && !__webpack_require__(36)){
redefine(ObjectProto, '<API key>', $<API key>, true);
}
wksExt.f = function(name){
return wrap(wks(name));
}
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, {Symbol: $Symbol});
for(var symbols = (
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), i = 0; symbols.length > i; )wks(symbols[i++]);
for(var symbols = $keys(wks.store), i = 0; symbols.length > i; )wksDefine(symbols[i++]);
$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
// 19.4.2.1 Symbol.for(key)
'for': function(key){
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(key){
if(isSymbol(key))return keyOf(SymbolRegistry, key);
throw TypeError(key + ' is not a symbol!');
},
useSetter: function(){ setter = true; },
useSimple: function(){ setter = false; }
});
$export($export.S + $export.F * !USE_NATIVE, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.<API key>(O, P)
<API key>: $<API key>,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.<API key>(O)
<API key>: $<API key>
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function(){
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({a: S}) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
stringify: function stringify(it){
if(it === undefined || isSymbol(it))return; // IE8 returns string on undefined
var args = [it]
, i = 1
, replacer, $replacer;
while(arguments.length > i)args.push(arguments[i++]);
replacer = args[1];
if(typeof replacer == 'function')$replacer = replacer;
if($replacer || !isArray(replacer))replacer = function(key, value){
if($replacer)value = $replacer.call(this, key, value);
if(!isSymbol(value))return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
}
});
// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(42)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
},
function(module, exports, __webpack_require__) {
var META = __webpack_require__(68)('meta')
, isObject = __webpack_require__(45)
, has = __webpack_require__(53)
, setDesc = __webpack_require__(43).f
, id = 0;
var isExtensible = Object.isExtensible || function(){
return true;
};
var FREEZE = !__webpack_require__(48)(function(){
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function(it){
setDesc(it, META, {value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
}});
};
var fastKey = function(it, create){
// return primitive with prefix
if(!isObject(it))return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if(!has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return 'F';
// not necessary to add metadata
if(!create)return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function(it, create){
if(!has(it, META)){
// can't set metadata to uncaught frozen object
if(!isExtensible(it))return true;
// not necessary to add metadata
if(!create)return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function(it){
if(FREEZE && meta.NEED && isExtensible(it) && !has(it, META))setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
},
function(module, exports, __webpack_require__) {
var global = __webpack_require__(38)
, core = __webpack_require__(39)
, LIBRARY = __webpack_require__(36)
, wksExt = __webpack_require__(79)
, defineProperty = __webpack_require__(43).f;
module.exports = function(name){
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
if(name.charAt(0) != '_' && !(name in $Symbol))defineProperty($Symbol, name, {value: wksExt.f(name)});
};
},
function(module, exports, __webpack_require__) {
var getKeys = __webpack_require__(58)
, toIObject = __webpack_require__(60);
module.exports = function(object, el){
var O = toIObject(object)
, keys = getKeys(O)
, length = keys.length
, index = 0
, key;
while(length > index)if(O[key = keys[index++]] === el)return key;
};
},
function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(58)
, gOPS = __webpack_require__(87)
, pIE = __webpack_require__(88);
module.exports = function(it){
var result = getKeys(it)
, getSymbols = gOPS.f;
if(getSymbols){
var symbols = getSymbols(it)
, isEnum = pIE.f
, i = 0
, key;
while(symbols.length > i)if(isEnum.call(it, key = symbols[i++]))result.push(key);
} return result;
};
},
function(module, exports) {
exports.f = Object.<API key>;
},
function(module, exports) {
exports.f = {}.<API key>;
},
function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(62);
module.exports = Array.isArray || function isArray(arg){
return cof(arg) == 'Array';
};
},
function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(60)
, gOPN = __webpack_require__(91).f
, toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function(it){
try {
return gOPN(it);
} catch(e){
return windowNames.slice();
}
};
module.exports.f = function getOwnPropertyNames(it){
return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};
},
function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(59)
, hiddenKeys = __webpack_require__(69).concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O){
return $keys(O, hiddenKeys);
};
},
function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(88)
, createDesc = __webpack_require__(51)
, toIObject = __webpack_require__(60)
, toPrimitive = __webpack_require__(50)
, has = __webpack_require__(53)
, IE8_DOM_DEFINE = __webpack_require__(46)
, gOPD = Object.<API key>;
exports.f = __webpack_require__(47) ? gOPD : function <API key>(O, P){
O = toIObject(O);
P = toPrimitive(P, true);
if(IE8_DOM_DEFINE)try {
return gOPD(O, P);
} catch(e){ /* empty */ }
if(has(O, P))return createDesc(!pIE.f.call(O, P), O[P]);
};
},
function(module, exports) {
},
function(module, exports, __webpack_require__) {
__webpack_require__(84)('asyncIterator');
},
function(module, exports, __webpack_require__) {
__webpack_require__(84)('observable');
},
function(module, exports) {
/**
* after : after(el, newEl)
* Inserts a new element `newEl` just after `el`.
*
* var after = require('dom101/after');
* var newNode = document.createElement('div');
* var button = document.querySelector('#submit');
*
* after(button, newNode);
*/
function after (el, newEl) {
if (typeof newEl === 'string') {
return el.insertAdjacentHTML('afterend', newEl);
} else {
var next = el.nextSibling;
if (next) {
return el.parentNode.insertBefore(newEl, next);
} else {
return el.parentNode.appendChild(newEl);
}
}
}
module.exports = after;
},
function(module, exports) {
'use strict';
var browser = {
versions: function () {
var u = window.navigator.userAgent;
return {
trident: u.indexOf('Trident') > -1,
presto: u.indexOf('Presto') > -1, //opera
webKit: u.indexOf('AppleWebKit') > -1,
gecko: u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1,
mobile: !!u.match(/AppleWebKit.*Mobile.*/),
ios: !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/), //ios
android: u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, //androiduc
iPhone: u.indexOf('iPhone') > -1 || u.indexOf('Mac') > -1, //iPhoneQQ
iPad: u.indexOf('iPad') > -1, //iPad
webApp: u.indexOf('Safari') == -1, //web
weixin: u.indexOf('MicroMessenger') == -1
};
}()
};
module.exports = browser;
},
function(module, exports) {
'use strict';
function init() {
// hexo
var $nav = document.querySelector('#page-nav');
if ($nav && !document.querySelector('#page-nav .extend.prev')) {
$nav.innerHTML = '<a class="extend prev disabled" rel="prev">« Prev</a>' + $nav.innerHTML;
}
if ($nav && !document.querySelector('#page-nav .extend.next')) {
$nav.innerHTML = $nav.innerHTML + '<a class="extend next disabled" rel="next">Next »</a>';
}
if (yiliaConfig && yiliaConfig.open_in_new) {
var $a = document.querySelectorAll('.article-entry a:not(.article-more-a)');
$a.forEach(function ($em) {
$em.setAttribute('target', '_blank');
});
}
// about me
var $aboutme = document.querySelector('#js-aboutme');
if ($aboutme && $aboutme.length !== 0) {
$aboutme.innerHTML = $aboutme.innerText;
}
}
module.exports = {
init: init
};
}
]);
|
/*
aim_rxqueue.c
This file contains the management routines for the receive
(incoming packet) queue. The actual packet handlers are in
aim_rxhandlers.c.
*/
#include "aim.h"
/*
This is a modified read() to make SURE we get the number
of bytes we are told to, otherwise block.
*/
int Read(int fd, u_char *buf, int len)
{
int i = 0;
int j = 0;
while ((i < len) && (!(i < 0)))
{
j = read(fd, &(buf[i]), len-i);
if ( (j < 0) && (errno != EAGAIN))
return -errno; /* fail */
else
i += j; /* success, continue */
}
#if 0
printf("\nRead Block: (%d/%04x)\n", len, len);
printf("\t");
for (j = 0; j < len; j++)
{
if (j % 8 == 0)
printf("\n\t");
if (buf[j] >= ' ' && buf[j] < 127)
printf("%c=%02x ",buf[j], buf[j]);
else
printf("0x%02x ", buf[j]);
}
printf("\n\n");
#endif
return i;
}
/*
struct command_struct *
get_generic(
struct connection_info struct *,
struct command_struct *
)
Grab as many command sequences as we can off the socket, and enqueue
each command in the incoming event queue in a seperate struct.
*/
int aim_get_command(void)
{
int i, readgood, j, isav, err;
int s;
fd_set fds;
struct timeval tv;
char generic[6];
struct command_rx_struct *workingStruct = NULL;
struct command_rx_struct *workingPtr = NULL;
struct aim_conn_t *conn = NULL;
#if debug > 0
printf("Reading generic/unknown response...");
#endif
/* dont wait at all (ie, never call this unless something is there) */
tv.tv_sec = 0;
tv.tv_usec = 0;
conn = aim_select(&tv);
if (conn==NULL)
return 0; /* nothing waiting */
s = conn->fd;
FD_ZERO(&fds);
FD_SET(s, &fds);
tv.tv_sec = 0; /* wait, but only for 10us */
tv.tv_usec = 10;
generic[0] = 0x00;
readgood = 0;
i = 0;
j = 0;
/* read first 6 bytes (the FLAP header only) off the socket */
while ( (select(s+1, &fds, NULL, NULL, &tv) == 1) && (i < 6))
{
if ((err = Read(s, &(generic[i]), 1)) < 0)
{
/* error is probably not recoverable...(must be a pessimistic day) */
aim_conn_close(conn);
return err;
}
if (readgood == 0)
{
if (generic[i] == 0x2a)
{
readgood = 1;
#if debug > 1
printf("%x ", generic[i]);
fflush(stdout);
#endif
i++;
}
else
{
#if debug > 1
printf("skipping 0x%d ", generic[i]);
fflush(stdout);
#endif
j++;
}
}
else
{
#if debug > 1
printf("%x ", generic[i]);
#endif
i++;
}
FD_ZERO(&fds);
FD_SET(s, &fds);
tv.tv_sec= 2;
tv.tv_usec= 2;
}
if (generic[0] != 0x2a)
{
/* this really shouldn't happen, since the main loop
select() should protect us from entering this function
without data waiting */
printf("Bad incoming data!");
return -1;
}
isav = i;
/* allocate a new struct */
workingStruct = (struct command_rx_struct *) malloc(sizeof(struct command_rx_struct));
workingStruct->lock = 1; /* lock the struct */
/* store type -- byte 2 */
workingStruct->type = (char) generic[1];
/* store seqnum -- bytes 3 and 4 */
workingStruct->seqnum = ( (( (unsigned int) generic[2]) & 0xFF) << 8);
workingStruct->seqnum += ( (unsigned int) generic[3]) & 0xFF;
/* store commandlen -- bytes 5 and 6 */
workingStruct->commandlen = ( (( (unsigned int) generic[4]) & 0xFF ) << 8);
workingStruct->commandlen += ( (unsigned int) generic[5]) & 0xFF;
/* malloc for data portion */
workingStruct->data = (char *) malloc(workingStruct->commandlen);
/* read the data portion of the packet */
i = Read(s, workingStruct->data, workingStruct->commandlen);
if (i < 0)
{
aim_conn_close(conn);
return i;
}
#if debug > 0
printf(" done. (%db+%db read, %db skipped)\n", isav, i, j);
#endif
workingStruct->conn = conn;
workingStruct->next = NULL; /* this will always be at the bottom */
workingStruct->lock = 0; /* unlock */
/* enqueue this packet */
if (aim_queue_incoming == NULL)
aim_queue_incoming = workingStruct;
else
{
workingPtr = aim_queue_incoming;
while (workingPtr->next != NULL)
workingPtr = workingPtr->next;
workingPtr->next = workingStruct;
}
return 0;
}
/*
purge_rxqueue()
This is just what it sounds. It purges the receive (rx) queue of
all handled commands. This is normally called from inside
aim_rxdispatch() after it's processed all the commands in the queue.
*/
struct command_rx_struct *aim_purge_rxqueue(struct command_rx_struct *queue)
{
int i = 0;
struct command_rx_struct *workingPtr = NULL;
struct command_rx_struct *workingPtr2 = NULL;
workingPtr = queue;
if (queue == NULL)
{
return queue;
}
else if (queue->next == NULL)
{
if (queue->handled == 1)
{
workingPtr2 = queue;
queue = NULL;
free(workingPtr2->data);
free(workingPtr2);
}
return queue;
}
else
{
for (i = 0; workingPtr != NULL; i++)
{
if (workingPtr->next->handled == 1)
{
/* save struct */
workingPtr2 = workingPtr->next;
/* dequeue */
workingPtr->next = workingPtr2->next;
/* free */
free(workingPtr2->data);
free(workingPtr2);
}
workingPtr = workingPtr->next;
}
}
return queue;
}
|
#ifndef <API key>
#define <API key>
#include <string>
#ifdef HAVE_GLEW
#include "GL/glew.h"
#endif
#include <GLFW/glfw3.h>
#include <utVisualization/utRenderAPI.h>
namespace Ubitrack {
namespace Visualization {
class GLFWWindowImpl : public VirtualWindow {
public:
GLFWWindowImpl(int _width, int _height, const std::string& _title);
~GLFWWindowImpl();
virtual void pre_render();
virtual void post_render();
virtual void reshape(int w, int h);
//custom extensions
virtual void setFullscreen(bool fullscreen);
virtual void onExit();
// Implementation of Public interface
virtual bool is_valid();
virtual bool create();
virtual void initGL(boost::shared_ptr<CameraHandle>& cam);
virtual void destroy();
private:
GLFWwindow* m_pWindow;
boost::shared_ptr<CameraHandle> m_pEventHandler;
};
// callback implementations for GLFW
inline static void <API key>(
GLFWwindow *win,
int w,
int h) {
CameraHandle *cam = static_cast<CameraHandle*>(<API key>(win));
cam->on_window_size(w, h);
}
inline static void <API key>(GLFWwindow *win) {
CameraHandle *cam = static_cast<CameraHandle*>(<API key>(win));
cam->on_render(glfwGetTime());
}
inline static void WindowCloseCallback(GLFWwindow *win) {
CameraHandle *cam = static_cast<CameraHandle*>(<API key>(win));
cam->on_window_close();
}
inline static void WindowKeyCallback(GLFWwindow *win,
int key,
int scancode,
int action,
int mods) {
CameraHandle *cam = static_cast<CameraHandle*>(<API key>(win));
if ((action == GLFW_PRESS) && (mods & GLFW_MOD_ALT)) {
switch (key) {
case GLFW_KEY_F:
cam->on_fullscreen();
return;
default:
break;
}
}
if (action == GLFW_PRESS) {
switch (key) {
case GLFW_KEY_ESCAPE:
cam->on_exit();
return;
default:
cam->on_keypress(key, scancode, action, mods);
break;
}
}
}
inline static void <API key>(GLFWwindow *win,
double xpos,
double ypos) {
CameraHandle *cam = static_cast<CameraHandle*>(<API key>(win));
cam->on_cursorpos(xpos, ypos);
}
}
}
#endif //<API key>
|
// Name: help.cpp
// Purpose: wxHtml sample: help test
// Created: ?
// RCS-ID: $Id$
// Licence: wxWindows licence
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include "wx/image.h"
#include "wx/html/helpfrm.h"
#include "wx/html/helpctrl.h"
#include "wx/filesys.h"
#include "wx/fs_zip.h"
#ifndef <API key>
#include "../../sample.xpm"
#endif
// private classes
// Define a new application type, each program should derive a class from wxApp
class MyApp : public wxApp
{
public:
// override base class virtuals
// this one is called on application startup and is a good place for the app
// initialization (doing it here and not in the ctor allows to have an error
// return: if OnInit() returns false, the application terminates)
virtual bool OnInit();
};
// Define a new frame type: this is going to be our main frame
class MyFrame : public wxFrame
{
public:
// ctor(s)
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
// event handlers (these functions should _not_ be virtual)
void OnQuit(wxCommandEvent& event);
void OnHelp(wxCommandEvent& event);
void OnClose(wxCloseEvent& event);
private:
<API key> help;
// any class wishing to process wxWidgets events must use this macro
DECLARE_EVENT_TABLE()
};
// constants
// IDs for the controls and the menu commands
enum
{
// menu items
Minimal_Quit = 1,
Minimal_Help
};
// event tables and other macros for wxWidgets
// the event tables connect the wxWidgets events with the functions (event
// handlers) which process them. It can be also done at run-time, but for the
// simple menu events like this the static method is much simpler.
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_Help, MyFrame::OnHelp)
EVT_CLOSE(MyFrame::OnClose)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWidgets to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
IMPLEMENT_APP(MyApp)
// implementation
// the application class
// `Main program' equivalent: the program execution "starts" here
bool MyApp::OnInit()
{
if ( !wxApp::OnInit() )
return false;
<API key>();
#if wxUSE_STREAMS && wxUSE_ZIPSTREAM && wxUSE_ZLIB
wxFileSystem::AddHandler(new wxZipFSHandler);
#endif
SetVendorName(wxT("wxWidgets"));
SetAppName(wxT("wxHTMLHelp"));
// Create the main application window
MyFrame *frame = new MyFrame(_("HTML Help Sample"),
wxDefaultPosition, wxDefaultSize);
// Show it
frame->Show(true);
// success: wxApp::OnRun() will be called which will enter the main message
// loop and the application will run. If we returned false here, the
// application would exit immediately.
return true;
}
// main frame
// frame constructor
MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size),
help(wxHF_DEFAULT_STYLE | wxHF_OPEN_FILES)
{
SetIcon(wxICON(sample));
// create a menu bar
wxMenu *menuFile = new wxMenu;
menuFile->Append(Minimal_Help, _("&Help"));
menuFile->Append(Minimal_Quit, _("E&xit"));
// now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, _("&File"));
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
help.UseConfig(wxConfig::Get());
bool ret;
help.SetTempDir(wxT("."));
ret = help.AddBook(wxFileName(wxT("helpfiles/testing.hhp"), wxPATH_UNIX));
if (! ret)
wxMessageBox(wxT("Failed adding book helpfiles/testing.hhp"));
ret = help.AddBook(wxFileName(wxT("helpfiles/another.hhp"), wxPATH_UNIX));
if (! ret)
wxMessageBox(_("Failed adding book helpfiles/another.hhp"));
}
// event handlers
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// true is to force the frame to close
Close(true);
}
void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
{
help.Display(wxT("Test HELPFILE"));
}
void MyFrame::OnClose(wxCloseEvent& event)
{
// Close the help frame; this will cause the config data to
// get written.
if ( help.GetFrame() ) // returns NULL if no help frame active
help.GetFrame()->Close(true);
// now we can safely delete the config pointer
event.Skip();
delete wxConfig::Set(NULL);
}
|
<?php
/**
* @group unit
*/
abstract class <API key> extends <API key>
{
protected $index;
protected function populate($index)
{
$typeFactory = $index->getTypeFactory();
$index->addDocument(
[
'object_type' => $typeFactory->identifier('wikipage?!'),
'object_id' => $typeFactory->identifier('Comité Wiki'),
'description' => $typeFactory->plaintext('a descriptions for the pages éducation Case'),
'contents' => $typeFactory->plaintext('a descriptions for the pages éducation Case'),
'hebrew' => $typeFactory->plaintext('מחשב הוא מכונה המעבדת נתונים על פי תוכנית, כלומר על פי רצף פקודות נתון מראש. מחשבים הם חלק בלתי נפרד מחיי היומיום '),
]
);
}
function <API key>()
{
$query = new Search_Query('description');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function <API key>()
{
$query = new Search_Query('page');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function testSearchAccents()
{
$query = new Search_Query('education');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function <API key>()
{
$query = new Search_Query('éducation');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function <API key>()
{
$query = new Search_Query('pagé');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function testCaseSensitivity()
{
$query = new Search_Query('casE');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function <API key>()
{
$query = new Search_Query;
$query->filterType('wikipage?!');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function testSearchObject()
{
$query = new Search_Query;
$query->addObject('wikipage?!', 'Comité Wiki');
$this->assertGreaterThan(0, count($query->search($this->index)));
}
function testStopWords()
{
$query = new Search_Query('a for the');
$this->assertEquals(0, count($query->search($this->index)));
}
function testHebrewString()
{
$query = new Search_Query;
$query->filterContent('מחשב', 'hebrew');
$this->assertEquals(1, count($query->search($this->index)));
}
}
|
#ifndef _H_MESSAGES
#define _H_MESSAGES
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <spice/protocol.h>
#include <spice/macros.h>
#ifdef USE_SMARTCARD_012
#include <vscard_common.h>
#else
#ifdef USE_SMARTCARD
#include <libcacard.h>
#endif
#endif
#include "draw.h"
SPICE_BEGIN_DECLS
typedef struct SpiceMsgData {
uint32_t data_size;
uint8_t data[0];
} SpiceMsgData;
typedef struct <API key> {
uint8_t type;
uint32_t uncompressed_size;
uint32_t compressed_size;
uint8_t *compressed_data;
} <API key>;
typedef struct SpiceMsgEmpty {
uint8_t padding;
} SpiceMsgEmpty;
typedef struct SpiceMsgInputsInit {
uint32_t keyboard_modifiers;
} SpiceMsgInputsInit;
typedef struct <API key> {
uint32_t modifiers;
} <API key>;
typedef struct <API key> {
uint32_t time;
} <API key>;
typedef struct <API key> {
uint16_t port;
uint16_t sport;
uint32_t host_size;
uint8_t *host_data;
uint16_t pub_key_type;
uint32_t pub_key_size;
uint8_t *pub_key_data;
uint32_t cert_subject_size;
uint8_t *cert_subject_data;
} <API key>;
typedef struct <API key> {
<API key> dst_info;
} <API key>;
typedef struct <API key> {
<API key> dst_info;
uint32_t src_mig_version;
} <API key>;
typedef struct <API key> {
uint32_t src_version;
} <API key>;
typedef struct <API key> {
uint16_t port;
uint16_t sport;
uint32_t host_size;
uint8_t *host_data;
uint32_t cert_subject_size;
uint8_t *cert_subject_data;
} <API key>;
typedef struct SpiceMsgMigrate {
uint32_t flags;
} SpiceMsgMigrate;
typedef struct SpiceResourceID {
uint8_t type;
uint64_t id;
} SpiceResourceID;
typedef struct SpiceResourceList {
uint16_t count;
SpiceResourceID resources[0];
} SpiceResourceList;
typedef struct SpiceMsgSetAck {
uint32_t generation;
uint32_t window;
} SpiceMsgSetAck;
typedef struct SpiceMsgcAckSync {
uint32_t generation;
} SpiceMsgcAckSync;
typedef struct SpiceWaitForChannel {
uint8_t channel_type;
uint8_t channel_id;
uint64_t message_serial;
} SpiceWaitForChannel;
typedef struct <API key> {
uint8_t wait_count;
SpiceWaitForChannel wait_list[0];
} <API key>;
typedef struct SpiceChannelId {
uint8_t type;
uint8_t id;
} SpiceChannelId;
typedef struct SpiceMsgMainInit {
uint32_t session_id;
uint32_t <API key>;
uint32_t <API key>;
uint32_t current_mouse_mode;
uint32_t agent_connected;
uint32_t agent_tokens;
uint32_t multi_media_time;
uint32_t ram_hint;
} SpiceMsgMainInit;
typedef struct SpiceMsgDisconnect {
uint64_t time_stamp;
uint32_t reason; // SPICE_ERR_?
} SpiceMsgDisconnect;
typedef struct SpiceMsgNotify {
uint64_t time_stamp;
uint32_t severity;
uint32_t visibilty;
uint32_t what;
uint32_t message_len;
uint8_t message[0];
} SpiceMsgNotify;
typedef struct SpiceMsgChannels {
uint32_t num_of_channels;
SpiceChannelId channels[0];
} SpiceMsgChannels;
typedef struct SpiceMsgMainName {
uint32_t name_len;
uint8_t name[0];
} SpiceMsgMainName;
typedef struct SpiceMsgMainUuid {
uint8_t uuid[16];
} SpiceMsgMainUuid;
typedef struct <API key> {
uint32_t supported_modes;
uint32_t current_mode;
} <API key>;
typedef struct SpiceMsgPing {
uint32_t id;
uint64_t timestamp;
void *data;
uint32_t data_len;
} SpiceMsgPing;
typedef struct <API key> {
uint32_t error_code; // SPICE_ERR_?
} <API key>;
#define <API key> 2048
typedef struct <API key> {
uint32_t num_tokens;
} <API key>, <API key>, <API key>;
typedef struct <API key> <API key>;
typedef struct SpiceMsgcClientInfo {
uint64_t cache_size;
} SpiceMsgcClientInfo;
typedef struct <API key> {
uint32_t mode;
} <API key>;
typedef struct SpiceCursor {
uint32_t flags;
SpiceCursorHeader header;
uint32_t data_size;
uint8_t *data;
} SpiceCursor;
typedef struct SpiceMsgDisplayMode {
uint32_t x_res;
uint32_t y_res;
uint32_t bits;
} SpiceMsgDisplayMode;
typedef struct <API key> {
uint32_t surface_id;
uint32_t width;
uint32_t height;
uint32_t format;
uint32_t flags;
} <API key>;
typedef struct <API key> {
uint32_t surface_id;
} <API key>;
typedef struct SpiceMsgDisplayBase {
uint32_t surface_id;
SpiceRect box;
SpiceClip clip;
} SpiceMsgDisplayBase;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceFill data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceOpaque data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceCopy data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceTransparent data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceAlphaBlend data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceComposite data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpicePoint src_pos;
} <API key>;
typedef <API key> <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceRop3 data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceBlackness data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceWhiteness data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceInvers data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceStroke data;
} <API key>;
typedef struct <API key> {
SpiceMsgDisplayBase base;
SpiceText data;
} <API key>;
typedef struct <API key> {
uint64_t id;
} <API key>;
typedef struct <API key> {
uint32_t surface_id;
uint32_t id;
uint32_t flags;
uint32_t codec_type;
uint64_t stamp;
uint32_t stream_width;
uint32_t stream_height;
uint32_t src_width;
uint32_t src_height;
SpiceRect dest;
SpiceClip clip;
} <API key>;
typedef struct <API key> {
uint32_t id;
uint32_t multi_media_time;
} <API key>;
typedef struct <API key> {
<API key> base;
uint32_t data_size;
uint8_t data[0];
} <API key>;
typedef struct <API key> {
<API key> base;
uint32_t width;
uint32_t height;
SpiceRect dest;
uint32_t data_size;
uint8_t data[0];
} <API key>;
typedef struct <API key> {
uint32_t id;
SpiceClip clip;
} <API key>;
typedef struct <API key> {
uint32_t id;
} <API key>;
typedef struct <API key> {
uint32_t stream_id;
uint32_t unique_id;
uint32_t max_window_size;
uint32_t timeout_ms;
} <API key>;
typedef struct <API key> {
uint32_t stream_id;
uint32_t unique_id;
uint32_t start_frame_mm_time;
uint32_t end_frame_mm_time;
uint32_t num_frames;
uint32_t num_drops;
int32_t last_frame_delay;
uint32_t audio_delay;
} <API key>;
typedef struct <API key> {
} <API key>;
typedef struct SpiceMsgCursorInit {
SpicePoint16 position;
uint16_t trail_length;
uint16_t trail_frequency;
uint8_t visible;
SpiceCursor cursor;
} SpiceMsgCursorInit;
typedef struct SpiceMsgCursorSet {
SpicePoint16 position;
uint8_t visible;
SpiceCursor cursor;
} SpiceMsgCursorSet;
typedef struct SpiceMsgCursorMove {
SpicePoint16 position;
} SpiceMsgCursorMove;
typedef struct SpiceMsgCursorTrail {
uint16_t length;
uint16_t frequency;
} SpiceMsgCursorTrail;
typedef struct <API key> {
uint8_t pixmap_cache_id;
int64_t pixmap_cache_size; //in pixels
uint8_t glz_dictionary_id;
int32_t <API key>; // in pixels
} <API key>;
typedef struct SpiceMsgcKeyDown {
uint32_t code;
} SpiceMsgcKeyDown;
typedef struct SpiceMsgcKeyUp {
uint32_t code;
} SpiceMsgcKeyUp;
typedef struct <API key> {
uint32_t modifiers;
} <API key>;
typedef struct <API key> {
int32_t dx;
int32_t dy;
uint32_t buttons_state;
} <API key>;
typedef struct <API key> {
uint32_t x;
uint32_t y;
uint32_t buttons_state;
uint8_t display_id;
} <API key>;
typedef struct SpiceMsgcMousePress {
int32_t button;
int32_t buttons_state;
} SpiceMsgcMousePress;
typedef struct <API key> {
int32_t button;
int32_t buttons_state;
} <API key>;
typedef struct SpiceMsgAudioVolume {
uint8_t nchannels;
uint16_t volume[0];
} SpiceMsgAudioVolume;
typedef struct SpiceMsgAudioMute {
uint8_t mute;
} SpiceMsgAudioMute;
typedef struct <API key> {
uint32_t time;
uint32_t mode; //<API key>?
uint8_t *data;
uint32_t data_size;
} <API key>, SpiceMsgcRecordMode;
typedef struct <API key> {
uint32_t channels;
uint32_t format; //SPICE_AUDIO_FMT_?
uint32_t frequency;
uint32_t time;
} <API key>;
typedef struct <API key> {
uint32_t time;
uint8_t *data;
uint32_t data_size;
} <API key>, <API key>;
typedef struct <API key> {
uint32_t latency_ms;
} <API key>;
typedef struct SpiceMsgRecordStart {
uint32_t channels;
uint32_t format; //SPICE_AUDIO_FMT_?
uint32_t frequency;
} SpiceMsgRecordStart;
typedef struct <API key> {
uint32_t time;
} <API key>;
typedef struct SpiceMsgTunnelInit {
uint16_t max_num_of_sockets;
uint32_t <API key>;
} SpiceMsgTunnelInit;
typedef uint8_t SpiceTunnelIPv4[4];
typedef struct <API key> {
uint16_t type;
union {
SpiceTunnelIPv4 ipv4;
} u;
uint8_t data[0];
} <API key>;
typedef struct <API key> {
uint32_t service_id;
<API key> virtual_ip;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
uint32_t service_id;
uint32_t tokens;
} <API key>;
/* connection id must be the first field in msgs directed to a specific connection */
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
uint8_t data[0];
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
uint32_t num_tokens;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint32_t type;
uint32_t id;
uint32_t group;
uint32_t port;
uint64_t name;
uint64_t description;
union {
<API key> ip;
} u;
} <API key>;
typedef struct <API key> {
uint32_t id;
} <API key>;
/* connection id must be the first field in msgs directed to a specific connection */
typedef struct <API key> {
uint16_t connection_id;
uint32_t tokens;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
uint8_t data[0];
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
} <API key>;
typedef struct <API key> {
uint16_t connection_id;
uint32_t num_tokens;
} <API key>;
#ifdef USE_SMARTCARD
typedef struct SpiceMsgSmartcard {
VSCMsgType type;
uint32_t length;
uint32_t reader_id;
uint8_t data[0];
} SpiceMsgSmartcard;
typedef struct SpiceMsgcSmartcard {
VSCMsgHeader header;
union {
VSCMsgError error;
VSCMsgATR atr_data;
VSCMsgReaderAdd add;
};
} SpiceMsgcSmartcard;
#endif
typedef struct SpiceMsgDisplayHead {
uint32_t id;
uint32_t surface_id;
uint32_t width;
uint32_t height;
uint32_t x;
uint32_t y;
uint32_t flags;
} SpiceHead;
typedef struct <API key> {
uint16_t count;
uint16_t max_allowed;
SpiceHead heads[0];
} <API key>;
typedef struct SpiceMsgPortInit {
uint32_t name_size;
uint8_t *name;
uint8_t opened;
} SpiceMsgPortInit;
typedef struct SpiceMsgPortEvent {
uint8_t event;
} SpiceMsgPortEvent;
typedef struct SpiceMsgcPortEvent {
uint8_t event;
} SpiceMsgcPortEvent;
typedef struct <API key> {
uint8_t num_of_codecs;
uint8_t codecs[0];
} <API key>;
typedef struct <API key> {
uint8_t image_compression;
} <API key>;
typedef struct <API key> {
int drm_dma_buf_fd;
uint32_t width;
uint32_t height;
uint32_t stride;
uint32_t drm_fourcc_format;
uint32_t flags;
} <API key>;
typedef struct <API key> {
uint32_t x;
uint32_t y;
uint32_t w;
uint32_t h;
} <API key>;
SPICE_END_DECLS
#endif /* _H_SPICE_PROTOCOL */
|
package org.jboss.as.controller.interfaces;
import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import org.jboss.as.controller.logging.ControllerLogger;
import org.wildfly.security.manager.<API key>;
/**
* Overall interface criteria. Encapsulates a set of individual criteria and selects interfaces and addresses
* that meet them all.
*/
public final class <API key> implements InterfaceCriteria {
// java.net properties
static final String PREFER_IPV4_STACK = "java.net.preferIPv4Stack";
static final String <API key> = "java.net.preferIPv6Addresses";
private static final long serialVersionUID = -<API key>;
private final String interfaceName;
private final Set<InterfaceCriteria> interfaceCriteria;
public <API key>(final String interfaceName, Set<InterfaceCriteria> criteria) {
this.interfaceName = interfaceName;
this.interfaceCriteria = criteria;
}
@Override
public Map<NetworkInterface, Set<InetAddress>> <API key>(Map<NetworkInterface, Set<InetAddress>> candidates) throws SocketException {
Map<NetworkInterface, Set<InetAddress>> result = <API key>.cloneCandidates(candidates);
Set<InterfaceCriteria> sorted = new TreeSet<>(interfaceCriteria);
for (InterfaceCriteria criteria : sorted) {
result = criteria.<API key>(result);
if (result.size() == 0) {
break;
}
}
if (result.size() > 0) {
if (hasMultipleMatches(result)) {
// Multiple options matched the criteria. Eliminate the same address showing up in both
// a subinterface (an alias) and in the parent
result = <API key>(result);
}
if (hasMultipleMatches(result)) {
// Multiple options matched the criteria. Try and narrow the selection based on
// preferences indirectly expressed via -Djava.net.preferIPv4Stack and -Djava.net.preferIPv6Addresses
result = pruneIPTypes(result);
}
if (hasMultipleMatches(result)) {
// Multiple options matched the criteria; Pick one
Map<NetworkInterface, Set<InetAddress>> selected = <API key>(result);
// Warn user their criteria was insufficiently exact
if (interfaceName != null) { // will be null if the resolution is being performed for the "resolved-address"
// user query operation in which case we don't want to log a WARN
Map.Entry<NetworkInterface, Set<InetAddress>> entry = selected.entrySet().iterator().next();
<API key>(interfaceName, result, entry.getKey(), entry.getValue().iterator().next());
}
result = selected;
}
}
return result;
}
public String toString() {
StringBuilder sb = new StringBuilder("<API key>(");
for (InterfaceCriteria criteria : interfaceCriteria) {
sb.append(criteria.toString());
sb.append(",");
}
sb.setLength(sb.length() - 1);
sb.append(")");
return sb.toString();
}
@Override
public int compareTo(InterfaceCriteria o) {
if (this.equals(o)) {
return 0;
}
return 1;
}
private Map<NetworkInterface, Set<InetAddress>> pruneIPTypes(Map<NetworkInterface, Set<InetAddress>> candidates) {
Boolean preferIPv4Stack = getBoolean(PREFER_IPV4_STACK);
Boolean preferIPv6Stack = (preferIPv4Stack != null && !preferIPv4Stack) ? Boolean.TRUE : getBoolean(<API key>);
if (preferIPv4Stack == null && preferIPv6Stack == null) {
// No meaningful user input
return candidates;
}
final Map<NetworkInterface, Set<InetAddress>> result = new HashMap<NetworkInterface, Set<InetAddress>>();
for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : candidates.entrySet()) {
Set<InetAddress> good = null;
for (InetAddress address : entry.getValue()) {
if ((preferIPv4Stack != null && preferIPv4Stack && address instanceof Inet4Address)
|| (preferIPv6Stack != null && preferIPv6Stack && address instanceof Inet6Address)) {
if (good == null) {
good = new HashSet<InetAddress>();
result.put(entry.getKey(), good);
}
good.add(address);
}
}
}
return result.size() == 0 ? candidates : result;
}
static Map<NetworkInterface, Set<InetAddress>> <API key>(Map<NetworkInterface, Set<InetAddress>> result) {
final Map<NetworkInterface, Set<InetAddress>> pruned = new HashMap<NetworkInterface, Set<InetAddress>>();
for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : result.entrySet()) {
NetworkInterface ni = entry.getKey();
if (ni.getParent() != null) {
pruned.put(ni, entry.getValue());
} else {
Set<InetAddress> retained = new HashSet<InetAddress>(entry.getValue());
Enumeration<NetworkInterface> subInterfaces = ni.getSubInterfaces();
while (subInterfaces.hasMoreElements()) {
NetworkInterface sub = subInterfaces.nextElement();
Set<InetAddress> subAddresses = result.get(sub);
if (subAddresses != null) {
retained.removeAll(subAddresses);
}
}
if (retained.size() > 0) {
pruned.put(ni, retained);
}
}
}
return pruned;
}
private static Boolean getBoolean(final String property) {
final String value = <API key>.<API key>(property, null);
return value == null ? null : value.equalsIgnoreCase("true");
}
private static Map<NetworkInterface, Set<InetAddress>> <API key>(Map<NetworkInterface, Set<InetAddress>> acceptable) throws SocketException {
// Give preference to NetworkInterfaces that are 1) up, 2) not loopback 3) not point-to-point.
// If any of these criteria eliminate all interfaces, discard it.
if (acceptable.size() > 1) {
Map<NetworkInterface, Set<InetAddress>> preferred = new HashMap<NetworkInterface, Set<InetAddress>>();
for (NetworkInterface ni : acceptable.keySet()) {
if (ni.isUp()) {
preferred.put(ni, acceptable.get(ni));
}
}
if (preferred.size() > 0) {
acceptable = preferred;
} // else this preference eliminates all interfaces, so ignore it
}
if (acceptable.size() > 1) {
Map<NetworkInterface, Set<InetAddress>> preferred = new HashMap<NetworkInterface, Set<InetAddress>>();
for (NetworkInterface ni : acceptable.keySet()) {
if (!ni.isLoopback()) {
preferred.put(ni, acceptable.get(ni));
}
}
if (preferred.size() > 0) {
acceptable = preferred;
} // else this preference eliminates all interfaces, so ignore it
}
if (acceptable.size() > 1) {
Map<NetworkInterface, Set<InetAddress>> preferred = new HashMap<NetworkInterface, Set<InetAddress>>();
for (NetworkInterface ni : acceptable.keySet()) {
if (!ni.isPointToPoint()) {
preferred.put(ni, acceptable.get(ni));
}
}
if (preferred.size() > 0) {
acceptable = preferred;
} // else this preference eliminates all interfaces, so ignore it
}
if (hasMultipleMatches(acceptable)) {
// Give preference to non-link-local addresses
Map<NetworkInterface, Set<InetAddress>> preferred = new HashMap<NetworkInterface, Set<InetAddress>>();
for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : acceptable.entrySet()) {
Set<InetAddress> acceptableAddresses = entry.getValue();
if (acceptableAddresses.size() > 1) {
Set<InetAddress> preferredAddresses = null;
for (InetAddress addr : acceptableAddresses) {
if (!addr.isLinkLocalAddress()) {
if (preferredAddresses == null) {
preferredAddresses = new HashSet<InetAddress>();
preferred.put(entry.getKey(), preferredAddresses);
}
preferredAddresses.add(addr);
}
}
} else {
acceptable.put(entry.getKey(), acceptableAddresses);
}
}
if (preferred.size() > 0) {
acceptable = preferred;
} // else this preference eliminates all interfaces, so ignore it
}
Map.Entry<NetworkInterface, Set<InetAddress>> entry = acceptable.entrySet().iterator().next();
return Collections.singletonMap(entry.getKey(), Collections.singleton(entry.getValue().iterator().next()));
}
private static boolean hasMultipleMatches(Map<NetworkInterface, Set<InetAddress>> map) {
return map.size() > 1 || (map.size() == 1 && map.values().iterator().next().size() > 1);
}
private static void <API key>(String interfaceName, Map<NetworkInterface, Set<InetAddress>> acceptable,
NetworkInterface selectedInterface, InetAddress selectedAddress) {
Set<String> nis = new HashSet<String>();
Set<InetAddress> addresses = new HashSet<InetAddress>();
for (Map.Entry<NetworkInterface, Set<InetAddress>> entry : acceptable.entrySet()) {
nis.add(entry.getKey().getName());
addresses.addAll(entry.getValue());
}
ControllerLogger.ROOT_LOGGER.<API key>(interfaceName, addresses, nis, selectedAddress, selectedInterface.getName());
}
}
|
package com.worldline.clic.internal.assist;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.<API key>;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.<API key>;
import org.eclipse.jface.viewers.<API key>;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
/**
* This class allows to deal with autocompletion for all commands.
*
* @author mvanbesien
* @since 1.0
* @version 1.0
*/
public class <API key> {
private final StyledText text;
private final IProcessor[] processors;
private final Map<String, Object> properties = new HashMap<String, Object>();
private <API key> <API key>;
private Listener textKeyListener;
private Listener <API key>;
private Listener onSelectionListener;
private Listener onEscapeListener;
private <API key> <API key>;
private Listener focusOutListener;
private Listener vanishListener;
private Table table;
private TableViewer viewer;
private Shell popupShell;
public <API key>(final StyledText text,
final IProcessor... processors) {
this.text = text;
this.processors = processors;
build();
}
public void setProperty(final String key, final Object value) {
properties.put(key, value);
}
private void build() {
// Creation of graphical elements
final Display display = text.getDisplay();
popupShell = new Shell(display, SWT.ON_TOP);
popupShell.setLayout(new FillLayout());
table = new Table(popupShell, SWT.SINGLE);
viewer = new TableViewer(table);
<API key> = <API key>();
textKeyListener = newTextKeyListener();
<API key> = <API key>();
onSelectionListener = <API key>();
onEscapeListener = newOnEscapeListener();
<API key> = <API key>();
focusOutListener = newFocusOutListener();
vanishListener = newVanishListener();
viewer.setContentProvider(<API key>);
text.addListener(SWT.KeyDown, textKeyListener);
text.addListener(SWT.Modify, <API key>);
table.addListener(SWT.DefaultSelection, onSelectionListener);
table.addListener(SWT.KeyDown, onEscapeListener);
viewer.<API key>(<API key>);
table.addListener(SWT.FocusOut, focusOutListener);
text.addListener(SWT.FocusOut, focusOutListener);
text.getShell().addListener(SWT.Move, vanishListener);
text.addDisposeListener(newDisposeListener());
}
private DisposeListener newDisposeListener() {
return new DisposeListener() {
@Override
public void widgetDisposed(final DisposeEvent e) {
text.removeListener(SWT.KeyDown, textKeyListener);
text.removeListener(SWT.Modify, <API key>);
table.removeListener(SWT.DefaultSelection, onSelectionListener);
table.removeListener(SWT.KeyDown, onEscapeListener);
viewer.<API key>(<API key>);
table.removeListener(SWT.FocusOut, focusOutListener);
text.removeListener(SWT.FocusOut, focusOutListener);
text.getShell().removeListener(SWT.Move, vanishListener);
table.dispose();
popupShell.dispose();
}
};
}
private <API key> <API key>() {
return new <API key>() {
@Override
public void inputChanged(final Viewer viewer,
final Object oldInput, final Object newInput) {
}
@Override
public void dispose() {
}
@Override
public Object[] getElements(final Object inputElement) {
final Collection<String> results = new ArrayList<String>();
if (inputElement instanceof String) {
final String input = (String) inputElement;
final ProcessorContext pc = new ProcessorContext(input,
text.getCaretOffset(), properties);
for (final IProcessor processor : processors)
results.addAll(processor.getProposals(pc));
}
return results.toArray();
}
};
}
private Listener <API key>() {
return new Listener() {
@Override
public void handleEvent(final Event event) {
if (event.widget instanceof Text) {
final Text text = (Text) event.widget;
final String string = text.getText();
if (string.length() == 0)
// if (popupShell.isVisible())
popupShell.setVisible(false);
else {
viewer.setInput(string);
final Rectangle textBounds = text.getDisplay().map(
text.getParent(), null, text.getBounds());
popupShell.setBounds(textBounds.x, textBounds.y
+ textBounds.height, textBounds.width, 80);
// if (!popupShell.isVisible())
popupShell.setVisible(true);
}
}
}
};
}
private Listener newVanishListener() {
return new Listener() {
@Override
public void handleEvent(final Event event) {
popupShell.setVisible(false);
}
};
}
private Listener newTextKeyListener() {
return new Listener() {
@Override
public void handleEvent(final Event event) {
switch (event.keyCode) {
case SWT.ARROW_DOWN:
int index = (table.getSelectionIndex() + 1)
% table.getItemCount();
table.setSelection(index);
event.doit = false;
break;
case SWT.ARROW_UP:
index = table.getSelectionIndex() - 1;
if (index < 0)
index = table.getItemCount() - 1;
table.setSelection(index);
event.doit = false;
break;
case SWT.ARROW_RIGHT:
if (popupShell.isVisible()
&& table.getSelectionIndex() != -1) {
text.setText(table.getSelection()[0].getText());
text.setSelection(text.getText().length());
popupShell.setVisible(false);
}
break;
case SWT.ESC:
popupShell.setVisible(false);
break;
}
}
};
}
private <API key> <API key>() {
return new <API key>() {
@Override
public void doubleClick(final DoubleClickEvent event) {
if (popupShell.isVisible() && table.getSelectionIndex() != -1) {
text.setText(table.getSelection()[0].getText());
text.setSelection(text.getText().length());
popupShell.setVisible(false);
}
}
};
}
private Listener <API key>() {
return new Listener() {
@Override
public void handleEvent(final Event event) {
if (event.widget instanceof Text) {
final Text text = (Text) event.widget;
final ISelection selection = viewer.getSelection();
if (selection instanceof <API key>) {
text.setText(((<API key>) selection)
.getFirstElement().toString());
text.setSelection(text.getText().length() - 1);
}
popupShell.setVisible(false);
}
}
};
}
private Listener newOnEscapeListener() {
return new Listener() {
@Override
public void handleEvent(final Event event) {
if (event.keyCode == SWT.ESC)
popupShell.setVisible(false);
}
};
}
private Listener newFocusOutListener() {
return new Listener() {
@Override
public void handleEvent(final Event event) {
popupShell.setVisible(false);
}
};
}
}
|
// NUS - Nemesis Utilities System: A C++ application development framework
// This file is part of NUS
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// You should have received a copy of the GNU Lesser General Public
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#include "nthread.h"
void *<API key>(void *data) {
NThread *thread = static_cast<NThread *>(data);
thread->threadStart();
return NULL;
}
NThread::NThread(void)
: NObject()
{
}
void NThread::threadCreate() {
int ret = 0;
pthread_t a_thread;
ret = pthread_create(&a_thread, NULL, <API key>, (void *) this);
}
|
package com.stek101.projectzulu.common.core;
/**
* For usage see: {@link Pair}
*/
public class PairDirectoryFile<K, V> {
private final K directory;
private final V file;
public static <K, V> PairDirectoryFile<K, V> createPair(K directory, V file) {
return new PairDirectoryFile<K, V>(directory, file);
}
public PairDirectoryFile(K directory, V file) {
this.file = file;
this.directory = directory;
}
public K getDirectory() {
return directory;
}
public V getFile() {
return file;
}
@Override
public boolean equals(Object object){
if (! (object instanceof PairDirectoryFile)) { return false; }
PairDirectoryFile pair = (PairDirectoryFile)object;
return directory.equals(pair.directory) && file.equals(pair.file);
}
@Override
public int hashCode(){
return 7 * directory.hashCode() + 13 * file.hashCode();
}
}
|
using System;
namespace InSimDotNet.Packets {
<summary>
Message to connection packet.
</summary>
<remarks>
Used to send a message to a specific connection or player (can only be used on hosts).
</remarks>
public class IS_MTC : IPacket, ISendable {
<summary>
Gets the size of the packet.
</summary>
public int Size { get; private set; }
<summary>
Gets the type of the packet.
</summary>
public PacketType Type { get; private set; }
<summary>
Gets or sets the request ID.
</summary>
public byte ReqI { get; set; }
<summary>
Gets or sets the sound effect.
</summary>
public MessageSound Sound { get; set; }
<summary>
Gets or sets the unique ID of the connection to send the message to (0 = host / 255 = all).
</summary>
public byte UCID { get; set; }
<summary>
Gets or sets the unique ID of the player to send the message to (if 0 use UCID).
</summary>
public byte PLID { get; set; }
<summary>
Gets or sets the message to send.
</summary>
public string Msg { get; set; }
<summary>
Creates a new message to connection packet.
</summary>
public IS_MTC() {
Size = 8;
Type = PacketType.ISP_MTC;
Msg = String.Empty;
}
<summary>
Returns the packet data.
</summary>
<returns>The packet data.</returns>
public byte[] GetBuffer() {
// Encode string first so we can figure out the packet size.
byte[] buffer = new byte[128];
int length = LfsEncoding.Current.GetBytes(Msg, buffer, 0, 128);
// Get the packet size (MTC needs trailing zero).
Size = (byte)(8 + Math.Min(length + (4 - (length % 4)), 128));
PacketWriter writer = new PacketWriter(Size);
writer.WriteSize(Size);
writer.Write((byte)Type);
writer.Write(ReqI);
writer.Write((byte)Sound);
writer.Write(UCID);
writer.Write(PLID);
writer.Skip(2);
writer.Write(buffer, length);
return writer.GetBuffer();
}
}
}
|
// This file is part of bes, A C++ back-end server implementation framework
// for the OPeNDAP Data Access Protocol.
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// This library is distributed in the hope that it will be useful,
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// You should have received a copy of the GNU Lesser General Public
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
// You can contact University Corporation for Atmospheric Research at
// 3080 Center Green Drive, Boulder, CO 80301
// Authors:
// pwest Patrick West <pwest@ucar.edu>
// jgarcia Jose Garcia <jgarcia@ucar.edu>
#ifndef I_BESWWW_h
#define I_BESWWW_h 1
#include "BESResponseObject.h"
#include "BESDASResponse.h"
#include "BESDDSResponse.h"
/** @brief container for a DAS and DDS needed to write out the usage
* information for a dataset.
*
* This is a container for the usage response information, which needs a DAS
* and a DDS. An instances of BESWWW takes ownership of the das and dds
* passed to it and deletes it in the destructor.
*
* @see BESResponseObject
* @see DAS
* @see DDS
*/
class BESWWW : public BESResponseObject
{
private:
#if 0
BESDASResponse *_das ;
#endif
BESDDSResponse *_dds ;
BESWWW() {}
public:
BESWWW( /* BESDASResponse *das,*/ BESDDSResponse *dds )
: /*_das( das ),*/ _dds( dds ) {}
virtual ~ BESWWW() {
#if 0
if (_das)
delete _das;
#endif
if (_dds)
delete _dds;
}
#if 0
BESDASResponse *get_das() { return _das ; }
#endif
BESDDSResponse *get_dds() { return _dds ; }
/** @brief dumps information about this object
*
* Displays the pointer value of this instance along with the das object
* created
*
* @param strm C++ i/o stream to dump the information to
*/
virtual void dump(ostream & strm) const {
strm << BESIndent::LMarg << "dump - (" << (void *) this << ")" << endl;
BESIndent::Indent();
#if 0
strm << BESIndent::LMarg << "das: " << *_das << endl;
#endif
strm << BESIndent::LMarg << "dds: " << *_dds << endl;
BESIndent::UnIndent();
}
} ;
#endif // I_BESWWW_h
|
package fastSim.data;
import java.io.FileInputStream;
import java.io.<API key>;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.*;
//import fanweizhu.fastSim.util.Config;
//import fanweizhu.fastSim.util.IndexManager;
//import fanweizhu.fastSim.util.KeyValuePair;
//import fanweizhu.fastSim.util.MapCapacity;
import fastSim.util.*;
import fastSim.util.io.DataReader;
import fastSim.util.io.DataWriter;
public class PrimeSim implements Serializable{
private static final long serialVersionUID = -<API key>;
private List<Integer> hubs;
protected Map<Integer, Map<Integer,Double>> map;
protected boolean outG;
protected List<Integer> meetingNodes;
/*public PrimeSim(int capacity) {
super(capacity);
hubs = new ArrayList<Integer>();
}*/
public PrimeSim() {
map = new HashMap<Integer, Map<Integer,Double>>();
hubs = new ArrayList<Integer>();
meetingNodes = new ArrayList<Integer>();
}
public PrimeSim(int numNodes) {
//need to change MapCapacity when double->Map?
map = new HashMap<Integer, Map<Integer,Double>>(MapCapacity.compute(numNodes));
hubs = new ArrayList<Integer>();
}
public Set<Integer> getLengths(){
return map.keySet();
}
public int numHubs() {
return hubs.size();
}
public int numLength(){
return map.size();
}
public Map<Integer,Map<Integer,Double>> getMap(){
return map;
}
public int getHubId(int index) {
return hubs.get(index);
}
public List<Integer> getMeetingNodes(){
return meetingNodes;
}
public void addNewNode(Node h, String simType){
h.isVisited = true;
if(h.isHub)
hubs.add(h.id);
if(simType=="in" && h.out.size()>1) //store meeting nodes for ingraphs //meetingnodes refer to >1 nodes (descendants)
meetingNodes.add(h.id);
}
public void set(int l, Node n, double value) {
// if (n.isVisited == false){
// if (n.isHub)
// hubs.add(n.id);
// if (graphType=="in" && n.in.size()>1)
// meetingNodes.add(n.id);
Map<Integer, Double> nodesVal;
if (map.get(l)!= null)
{
nodesVal = map.get(l);
nodesVal.put(n.id, value);
map.put(l, nodesVal);
}
else
{
nodesVal = new HashMap<Integer,Double>();
nodesVal.put(n.id, value);
map.put(l, nodesVal);
}
}
public void set(int l, Map<Integer,Double> nodeValuePairs){
//System.out.println(l);
Map<Integer, Double> nodesVal = map.get(l);
// for(Integer i:nodeValuePairs.keySet()) {
// System.out.println("PS node: "+ i + " rea: " +nodeValuePairs.get(i));
if(nodesVal == null)
{
map.put(l, nodeValuePairs);
}
else{
System.out.println("
nodesVal.putAll(nodeValuePairs);
map.put(l, nodesVal);
}
//System.out.println("length_Test:" + l + " Map_Size:" + map.get(l).size());
// for(Integer i: map.get(l).keySet())
// System.out.println(map.get(l).get(i));
}
public long <API key>() {
long nodeIdSize = (1 + hubs.size()) * 4;
long mapSize = (1 + map.size()) * 4 + map.size() * 8;
return nodeIdSize + mapSize;
}
public String getCountInfo() {
//int graphSize = map.size();
int hubSize = hubs.size();
int meetingNodesSize = meetingNodes.size();
return "hub size: " + hubSize + " meetingNodesSize: " + meetingNodesSize ;
}
public void trim(double clip) {
Map<Integer, Map<Integer,Double>> newMap = new HashMap<Integer, Map<Integer,Double>>();
List<Integer> newHublist = new ArrayList<Integer>();
List<Integer> newXlist = new ArrayList<Integer>();
for (int l: map.keySet()){
Map<Integer, Double> pairMap =map.get(l);
Map<Integer, Double> newPairs = new HashMap<Integer, Double>();
for (int nid: pairMap.keySet()){
double score = pairMap.get(nid);
if (score > clip){
newPairs.put(nid, score);
if(hubs.contains(nid) && !newHublist.contains(nid))
newHublist.add(nid);
if(meetingNodes.contains(nid) && !newXlist.contains(nid))
newXlist.add(nid);
}
}
newMap.put(l, newPairs);
}
this.map = newMap;
this.hubs = newHublist;
this.meetingNodes = newXlist;
}
public void saveToDisk(int id,String type,boolean doTrim) throws Exception {
String path = "";
if(type == "out")
//path = "./outSim/" + Integer.toString(id);
path = IndexManager.getIndexDeepDir() + "out/" +Integer.toString(id);
else if(type == "in")
//path = "./inSim/" + Integer.toString(id);
path = IndexManager.getIndexDeepDir() + "in/" +Integer.toString(id);
else{
System.out.println("Type of prime graph should be either out or in.");
System.exit(0);
}
// System.out.println(path+"/"+id);
DataWriter out = new DataWriter(path);
if (doTrim)
trim(Config.clip);
out.writeInteger(hubs.size());
for (int i : hubs) {
out.writeInteger(i);
}
out.writeInteger(meetingNodes.size());
for(int i: meetingNodes){
out.writeInteger(i);
}
out.writeInteger(map.size());
for(int i=0; i<map.size();i++){
int pairNum = map.get(i).size();
Map<Integer,Double> pairMap = map.get(i);
out.writeInteger(pairNum);
for(int j: pairMap.keySet()){
out.writeInteger(j);
out.writeDouble(pairMap.get(j));
}
}
out.close();
/*//test: read all the content
DataReader in = new DataReader(path);
while(true){
double oneNum =in.readDouble();
if (oneNum == -1.11)
break;
System.out.print(oneNum+"\t");
}
System.out.println();
in.close();*/
}
public void loadFromDisk(int id,String type) throws Exception {
String path = "";
if(type == "out")
path = IndexManager.getIndexDeepDir() + "out/" + Integer.toString(id);
else if(type == "in")
path = IndexManager.getIndexDeepDir() + "in/" + Integer.toString(id);
else
{
System.out.println("Type of prime graph should be either out or in.");
System.exit(0);
}
DataReader in = new DataReader(path);
int n = in.readInteger();
this.hubs = new ArrayList<Integer>(n);
for (int i = 0; i < n; i++)
this.hubs.add(in.readInteger());
int numM = in.readInteger();
this.meetingNodes=new ArrayList<Integer>(numM);
for(int i =0; i<numM; i++)
this.meetingNodes.add(in.readInteger());
int numL = in.readInteger();
for(int i=0; i<numL; i++){
int numPair = in.readInteger();
Map<Integer,Double> pairMap = new HashMap<Integer, Double>();
for(int j=0; j<numPair; j++){
int nodeId = in.readInteger();
double nodeScore = in.readDouble();
pairMap.put(nodeId, nodeScore);
}
this.map.put(i, pairMap);
}
in.close();
}
public PrimeSim duplicate() {
// TODO Auto-generated method stub
PrimeSim sim = new PrimeSim();
sim.map.putAll(this.map);
return sim;
}
public void addFrom(PrimeSim nextOut, Map<Integer, Double> oneHubValue) {
// TODO Auto-generated method stub
for (int lenToHub : oneHubValue.keySet()){
double hubScoreoflen = oneHubValue.get(lenToHub);
for (int lenFromHub : nextOut.getMap().keySet()){
if(lenFromHub == 0){
// the new score of hub (over length==0) is just the score on prime graph
continue;
}
int newLen = lenToHub + lenFromHub;
if (!this.getMap().containsKey(newLen))
this.getMap().put(newLen, new HashMap<Integer,Double>());
for(int toNode: nextOut.getMap().get(lenFromHub).keySet()){
double oldValue = this.getMap().get(newLen).keySet()
.contains(toNode) ? this.getMap().get(newLen).get(toNode): 0.0;
//System.out.println(oldValue);
double newValue = hubScoreoflen *nextOut.getMap().get(lenFromHub).get(toNode);
// //added aug-29
// if (newValue<Config.epsilon)
// continue;
this.getMap().get(newLen).put(toNode, oldValue + newValue) ;
// PrintInfor.printDoubleMap(this.getMap(), "assemble simout of the hub at length: " + lenFromHub +" node: "+ toNode );
// System.out.println(this.getMap());
}
}
}
}
public void addMeetingNodes(List<Integer> nodes){
for (int nid: nodes){
if (!this.meetingNodes.contains(nid))
this.meetingNodes.add(nid);
}
}
}
|
package org.locationtech.geogig.geotools.data;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.<API key>;
import org.eclipse.jdt.annotation.Nullable;
import org.geotools.data.DataStore;
import org.geotools.data.Transaction;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.data.store.ContentDataStore;
import org.geotools.data.store.ContentEntry;
import org.geotools.data.store.ContentState;
import org.geotools.feature.NameImpl;
import org.locationtech.geogig.data.<API key>;
import org.locationtech.geogig.model.ObjectId;
import org.locationtech.geogig.model.Ref;
import org.locationtech.geogig.model.RevObject.TYPE;
import org.locationtech.geogig.model.RevTree;
import org.locationtech.geogig.model.SymRef;
import org.locationtech.geogig.plumbing.ForEachRef;
import org.locationtech.geogig.plumbing.RefParse;
import org.locationtech.geogig.plumbing.RevParse;
import org.locationtech.geogig.plumbing.TransactionBegin;
import org.locationtech.geogig.porcelain.AddOp;
import org.locationtech.geogig.porcelain.CheckoutOp;
import org.locationtech.geogig.porcelain.CommitOp;
import org.locationtech.geogig.repository.Context;
import org.locationtech.geogig.repository.GeogigTransaction;
import org.locationtech.geogig.repository.NodeRef;
import org.locationtech.geogig.repository.Repository;
import org.locationtech.geogig.repository.WorkingTree;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.feature.type.Name;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.base.Predicate;
import com.google.common.base.Throwables;
import com.google.common.collect.Collections2;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
/**
* A GeoTools {@link DataStore} that serves and edits {@link SimpleFeature}s in a geogig repository.
* <p>
* Multiple instances of this kind of data store may be created against the same repository,
* possibly working against different {@link #setHead(String) heads}.
* <p>
* A head is any commit in GeoGig. If a head has a branch pointing at it then the store allows
* transactions, otherwise no data modifications may be made.
*
* A branch in Geogig is a separate line of history that may or may not share a common ancestor with
* another branch. In the later case the branch is called "orphan" and by convention the default
* branch is called "master", which is created when the geogig repo is first initialized, but does
* not necessarily exist.
* <p>
* Every read operation (like in {@link #getFeatureSource(Name)}) reads committed features out of
* the configured "head" branch. Write operations are only supported if a {@link Transaction} is
* set, in which case a {@link GeogigTransaction} is tied to the geotools transaction by means of a
* {@link <API key>}. During the transaction, read operations will read from the
* transaction's {@link WorkingTree} in order to "see" features that haven't been committed yet.
* <p>
* When the transaction is committed, the changes made inside that transaction are merged onto the
* actual repository. If any other change was made to the repository meanwhile, a rebase will be
* attempted, and the transaction commit will fail if the rebase operation finds any conflict. This
* provides for optimistic locking and reduces thread contention.
*
*/
public class GeoGigDataStore extends ContentDataStore implements DataStore {
private final Repository geogig;
/** @see #setHead(String) */
private String refspec;
/** When the configured head is not a branch, we disallow transactions */
private boolean allowTransactions = true;
public GeoGigDataStore(Repository geogig) {
super();
Preconditions.checkNotNull(geogig);
this.geogig = geogig;
}
@Override
public void dispose() {
super.dispose();
geogig.close();
}
/**
* Instructs the datastore to operate against the specified refspec, or against the checked out
* branch, whatever it is, if the argument is {@code null}.
*
* Editing capabilities are disabled if the refspec is not a local branch.
*
* @param refspec the name of the branch to work against, or {@code null} to default to the
* currently checked out branch
* @see #getConfiguredBranch()
* @see #getOrFigureOutHead()
* @throws <API key> if {@code refspec} is not null and no such commit exists in
* the repository
*/
public void setHead(@Nullable final String refspec) throws <API key> {
if (refspec == null) {
allowTransactions = true; // when no branch name is set we assume we should make
// transactions against the current HEAD
} else {
final Context context = getCommandLocator(null);
Optional<ObjectId> rev = context.command(RevParse.class).setRefSpec(refspec).call();
if (!rev.isPresent()) {
throw new <API key>("Bad ref spec: " + refspec);
}
Optional<Ref> branchRef = context.command(RefParse.class).setName(refspec).call();
if (branchRef.isPresent()) {
Ref ref = branchRef.get();
if (ref instanceof SymRef) {
ref = context.command(RefParse.class).setName(((SymRef) ref).getTarget()).call()
.orNull();
}
Preconditions.checkArgument(ref != null, "refSpec is a dead symref: " + refspec);
if (ref.getName().startsWith(Ref.HEADS_PREFIX)) {
allowTransactions = true;
} else {
allowTransactions = false;
}
} else {
allowTransactions = false;
}
}
this.refspec = refspec;
}
public String getOrFigureOutHead() {
String branch = getConfiguredHead();
if (branch != null) {
return branch;
}
return getCheckedOutBranch();
}
public Repository getGeogig() {
return geogig;
}
/**
* @return the configured refspec of the commit this datastore works against, or {@code null} if
* no head in particular has been set, meaning the data store works against whatever the
* currently checked out branch is.
*/
@Nullable
public String getConfiguredHead() {
return this.refspec;
}
/**
* @return whether or not we can support transactions against the configured head
*/
public boolean isAllowTransactions() {
return this.allowTransactions;
}
/**
* @return the name of the currently checked out branch in the repository, not necessarily equal
* to {@link #getConfiguredBranch()}, or {@code null} in the (improbable) case HEAD is
* on a dettached state (i.e. no local branch is currently checked out)
*/
@Nullable
public String getCheckedOutBranch() {
Optional<Ref> head = getCommandLocator(null).command(RefParse.class).setName(Ref.HEAD)
.call();
if (!head.isPresent()) {
return null;
}
Ref headRef = head.get();
if (!(headRef instanceof SymRef)) {
return null;
}
String refName = ((SymRef) headRef).getTarget();
Preconditions.checkState(refName.startsWith(Ref.HEADS_PREFIX));
String branchName = refName.substring(Ref.HEADS_PREFIX.length());
return branchName;
}
public ImmutableList<String> <API key>() {
ImmutableSet<Ref> heads = getCommandLocator(null).command(ForEachRef.class)
.setPrefixFilter(Ref.HEADS_PREFIX).call();
List<String> list = Lists.newArrayList(Collections2.transform(heads, (ref) -> {
String branchName = ref.getName().substring(Ref.HEADS_PREFIX.length());
return branchName;
}));
Collections.sort(list);
return ImmutableList.copyOf(list);
}
public Context getCommandLocator(@Nullable Transaction transaction) {
Context commandLocator = null;
if (transaction != null && !Transaction.AUTO_COMMIT.equals(transaction)) {
<API key> state;
state = (<API key>) transaction.getState(<API key>.class);
Optional<GeogigTransaction> geogigTransaction = state.<API key>();
if (geogigTransaction.isPresent()) {
commandLocator = geogigTransaction.get();
}
}
if (commandLocator == null) {
commandLocator = geogig.context();
}
return commandLocator;
}
public Name getDescriptorName(NodeRef treeRef) {
Preconditions.checkNotNull(treeRef);
Preconditions.checkArgument(TYPE.TREE.equals(treeRef.getType()));
Preconditions.checkArgument(!treeRef.getMetadataId().isNull(),
"NodeRef '%s' is not a feature type reference", treeRef.path());
return new NameImpl(getNamespaceURI(), NodeRef.nodeFromPath(treeRef.path()));
}
public NodeRef findTypeRef(Name typeName, @Nullable Transaction tx) {
Preconditions.checkNotNull(typeName);
final String localName = typeName.getLocalPart();
final List<NodeRef> typeRefs = findTypeRefs(tx);
Collection<NodeRef> matches = Collections2.filter(typeRefs, new Predicate<NodeRef>() {
@Override
public boolean apply(NodeRef input) {
return NodeRef.nodeFromPath(input.path()).equals(localName);
}
});
switch (matches.size()) {
case 0:
throw new <API key>(
String.format("No tree ref matched the name: %s", localName));
case 1:
return matches.iterator().next();
default:
throw new <API key>(String
.format("More than one tree ref matches the name %s: %s", localName, matches));
}
}
@Override
protected ContentState createContentState(ContentEntry entry) {
return new ContentState(entry);
}
@Override
protected ImmutableList<Name> createTypeNames() throws IOException {
List<NodeRef> typeTrees = findTypeRefs(Transaction.AUTO_COMMIT);
return ImmutableList
.copyOf(Collections2.transform(typeTrees, (ref) -> getDescriptorName(ref)));
}
private List<NodeRef> findTypeRefs(@Nullable Transaction tx) {
final String rootRef = getRootRef(tx);
Context commandLocator = getCommandLocator(tx);
List<NodeRef> typeTrees = commandLocator.command(<API key>.class)
.setRootTreeRef(rootRef).call();
return typeTrees;
}
String getRootRef(@Nullable Transaction tx) {
final String rootRef;
if (null == tx || Transaction.AUTO_COMMIT.equals(tx)) {
rootRef = getOrFigureOutHead();
} else {
rootRef = Ref.WORK_HEAD;
}
return rootRef;
}
@Override
protected GeogigFeatureStore createFeatureSource(ContentEntry entry) throws IOException {
return new GeogigFeatureStore(entry);
}
/**
* Creates a new feature type tree on the {@link #getOrFigureOutHead() current branch}.
* <p>
* Implementation detail: the operation is the homologous to starting a transaction, checking
* out the current/configured branch, creating the type tree inside the transaction, issueing a
* geogig commit, and committing the transaction for the created tree to be merged onto the
* configured branch.
*/
@Override
public void createSchema(SimpleFeatureType featureType) throws IOException {
if (!allowTransactions) {
throw new <API key>("Configured head " + refspec
+ " is not a branch; transactions are not supported.");
}
GeogigTransaction tx = getCommandLocator(null).command(TransactionBegin.class).call();
boolean abort = false;
try {
String treePath = featureType.getName().getLocalPart();
// check out the datastore branch on the transaction space
final String branch = getOrFigureOutHead();
tx.command(CheckoutOp.class).setForce(true).setSource(branch).call();
// now we can use the transaction working tree with the correct branch checked out
WorkingTree workingTree = tx.workingTree();
workingTree.createTypeTree(treePath, featureType);
tx.command(AddOp.class).addPattern(treePath).call();
tx.command(CommitOp.class).setMessage("Created feature type tree " + treePath).call();
tx.commit();
} catch (<API key> alreadyExists) {
abort = true;
throw new IOException(alreadyExists.getMessage(), alreadyExists);
} catch (Exception e) {
abort = true;
throw Throwables.propagate(e);
} finally {
if (abort) {
tx.abort();
}
}
}
// Deliberately leaving the @Override annotation commented out so that the class builds
// both against GeoTools 10.x and 11.x (as the method was added to DataStore in 11.x)
// @Override
public void removeSchema(Name name) throws IOException {
throw new <API key>(
"removeSchema not yet supported by geogig DataStore");
}
// Deliberately leaving the @Override annotation commented out so that the class builds
// both against GeoTools 10.x and 11.x (as the method was added to DataStore in 11.x)
// @Override
public void removeSchema(String name) throws IOException {
throw new <API key>(
"removeSchema not yet supported by geogig DataStore");
}
public static enum ChangeType {
ADDED, REMOVED, CHANGED_NEW, CHANGED_OLD;
}
/**
* Builds a FeatureSource (read-only) that fetches features out of the differences between two
* root trees: a provided tree-ish as the left side of the comparison, and the datastore's
* configured HEAD as the right side of the comparison.
* <p>
* E.g., to get all features of a given feature type that were removed between a given commit
* and its parent:
*
* <pre>
* <code>
* String commitId = ...
* GeoGigDataStore store = new GeoGigDataStore(geogig);
* store.setHead(commitId);
* FeatureSource removed = store.<API key>("roads", commitId + "~1", ChangeType.REMOVED);
* </code>
* </pre>
*
* @param typeName the feature type name to look up a type tree for in the datastore's current
* {@link #getOrFigureOutHead() HEAD}
* @param oldRoot a tree-ish string that resolves to the ROOT tree to be used as the left side
* of the diff
* @param changeType the type of change between {@code oldRoot} and {@link #getOrFigureOutHead()
* head} to pick as the features to return.
* @return a feature source whose features are computed out of the diff between the feature type
* diffs between the given {@code oldRoot} and the datastore's
* {@link #getOrFigureOutHead() HEAD}.
*/
public SimpleFeatureSource <API key>(final String typeName, final String oldRoot,
final ChangeType changeType) throws IOException {
Preconditions.checkNotNull(typeName, "typeName");
Preconditions.checkNotNull(oldRoot, "oldRoot");
Preconditions.checkNotNull(changeType, "changeType");
final Name name = name(typeName);
final ContentEntry entry = ensureEntry(name);
GeogigFeatureSource featureSource = new GeogigFeatureSource(entry);
featureSource.setTransaction(Transaction.AUTO_COMMIT);
featureSource.setChangeType(changeType);
if (ObjectId.NULL.toString().equals(oldRoot)
|| RevTree.EMPTY_TREE_ID.toString().equals(oldRoot)) {
featureSource.setOldRoot(null);
} else {
featureSource.setOldRoot(oldRoot);
}
return featureSource;
}
}
|
/* Attempt to read INT32 as INT64 */
#include "test.h"
#include <inttypes.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
int main(void)
{
const char *filedir = "dirfile";
const char *format = "dirfile/format";
const char *data = "dirfile/data";
const char *format_data = "data RAW INT32 8\n";
int32_t data_data[256];
int64_t c[8];
int fd, i, n, error, r = 0;
DIRFILE *D;
memset(c, 0, 8);
rmdirfile();
mkdir(filedir, 0777);
for (fd = 0; fd < 256; ++fd)
data_data[fd] = fd;
fd = open(format, O_CREAT | O_EXCL | O_WRONLY, 0666);
write(fd, format_data, strlen(format_data));
close(fd);
fd = open(data, O_CREAT | O_EXCL | O_WRONLY | O_BINARY, 0666);
write(fd, data_data, 256 * sizeof(int32_t));
close(fd);
D = gd_open(filedir, GD_RDONLY | GD_VERBOSE);
n = gd_getdata(D, "data", 5, 0, 1, 0, GD_INT64, c);
error = gd_error(D);
gd_close(D);
unlink(data);
unlink(format);
rmdir(filedir);
CHECKI(error, 0);
CHECKI(n, 8);
for (i = 0; i < 8; ++i)
CHECKIi(i,c[i], 40 + i);
return r;
}
|
package org.geotools.data.vpf.exc;
/**
* Class <API key>.java is responsible for
*
* <p>Created: Tue Jan 21 15:12:10 2003
*
* @author <a href="mailto:kobit@users.sourceforge.net">Artur Hefczyc</a>
* @source $URL$
* @version 1.0.0
*/
public class <API key> extends VPFDataException {
/** serialVersionUID */
private static final long serialVersionUID = <API key>;
/** Creates a new <API key> object. */
public <API key>() {
super();
}
/**
* Creates a new <API key> object.
*
* @param message DOCUMENT ME!
*/
public <API key>(String message) {
super(message);
}
}
// <API key>
|
#!/usr/bin/env python
import sys
import gobject
import dbus.mainloop.glib
dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)
import telepathy
DBUS_PROPERTIES = 'org.freedesktop.DBus.Properties'
def get_registry():
reg = telepathy.client.ManagerRegistry()
reg.LoadManagers()
return reg
def <API key>(reg):
cm = reg.GetManager('bluewire')
return cm
class Action(object):
def __init__(self):
self._action = None
def queue_action(self):
pass
def append_action(self, action):
assert self._action is None
self._action = action
def get_next_action(self):
assert self._action is not None
return self._action
def _on_done(self):
if self._action is None:
return
self._action.queue_action()
def _on_error(self, error):
print error
def _on_generic_message(self, *args):
pass
class DummyAction(Action):
def queue_action(self):
gobject.idle_add(self._on_done)
class QuitLoop(Action):
def __init__(self, loop):
super(QuitLoop, self).__init__()
self._loop = loop
def queue_action(self):
self._loop.quit()
class DisplayParams(Action):
def __init__(self, cm):
super(DisplayParams, self).__init__()
self._cm = cm
def queue_action(self):
self._cm[telepathy.interfaces.CONN_MGR_INTERFACE].GetParameters(
'bluetooth,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, params):
print "Connection Parameters:"
for name, flags, signature, default in params:
print "\t%s (%s)" % (name, signature),
if flags & telepathy.constants.<API key>:
print "required",
if flags & telepathy.constants.<API key>:
print "register",
if flags & telepathy.constants.<API key>:
print "secret",
if flags & telepathy.constants.<API key>:
print "dbus-property",
if flags & telepathy.constants.<API key>:
print "has-default(%s)" % default,
print ""
super(DisplayParams, self)._on_done()
class RequestConnection(Action):
def __init__(self, cm, username, password, forward):
super(RequestConnection, self).__init__()
self._cm = cm
self._conn = None
self._serviceName = None
self._username = username
self._password = password
self._forward = forward
@property
def conn(self):
return self._conn
@property
def serviceName(self):
return self._serviceName
def queue_action(self):
self._cm[telepathy.server.CONNECTION_MANAGER].RequestConnection(
'bluetooth",
{
'account': self._username,
'password': self._password,
'forward': self._forward,
},
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, busName, objectPath):
self._serviceName = busName
self._conn = telepathy.client.Connection(busName, objectPath)
super(RequestConnection, self)._on_done()
class Connect(Action):
def __init__(self, connAction):
super(Connect, self).__init__()
self._connAction = connAction
def queue_action(self):
self._connAction.conn[telepathy.server.CONNECTION].connect_to_signal(
'StatusChanged',
self._on_change,
)
self._connAction.conn[telepathy.server.CONNECTION].Connect(
reply_handler = self._on_generic_message,
error_handler = self._on_error,
)
def _on_done(self):
super(Connect, self)._on_done()
def _on_change(self, status, reason):
if status == telepathy.constants.<API key>:
print "Disconnected!"
self._conn = None
elif status == telepathy.constants.<API key>:
print "Connected"
self._on_done()
elif status == telepathy.constants.<API key>:
print "Connecting"
else:
print "Status: %r" % status
class <API key>(Action):
def __init__(self, connAction):
super(<API key>, self).__init__()
self._connAction = connAction
def queue_action(self):
self._connAction.conn[DBUS_PROPERTIES].Get(
telepathy.server.<API key>,
'Statuses',
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, statuses):
print "\tAvailable Statuses"
for (key, value) in statuses.iteritems():
print "\t\t - %s" % key
super(<API key>, self)._on_done()
class NullHandle(object):
@property
def handle(self):
return 0
@property
def handles(self):
return []
class UserHandle(Action):
def __init__(self, connAction):
super(UserHandle, self).__init__()
self._connAction = connAction
self._handle = None
@property
def handle(self):
return self._handle
@property
def handles(self):
return [self._handle]
def queue_action(self):
self._connAction.conn[telepathy.server.CONNECTION].GetSelfHandle(
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, handle):
self._handle = handle
super(UserHandle, self)._on_done()
class RequestHandle(Action):
def __init__(self, connAction, handleType, handleNames):
super(RequestHandle, self).__init__()
self._connAction = connAction
self._handle = None
self._handleType = handleType
self._handleNames = handleNames
@property
def handle(self):
return self._handle
@property
def handles(self):
return [self._handle]
def queue_action(self):
self._connAction.conn[telepathy.server.CONNECTION].RequestHandles(
self._handleType,
self._handleNames,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, handles):
self._handle = handles[0]
super(RequestHandle, self)._on_done()
class RequestChannel(Action):
def __init__(self, connAction, handleAction, channelType, handleType):
super(RequestChannel, self).__init__()
self._connAction = connAction
self._handleAction = handleAction
self._channel = None
self._channelType = channelType
self._handleType = handleType
@property
def channel(self):
return self._channel
def queue_action(self):
self._connAction.conn[telepathy.server.CONNECTION].RequestChannel(
self._channelType,
self._handleType,
self._handleAction.handle,
True,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, channelObjectPath):
self._channel = telepathy.client.Channel(self._connAction.serviceName, channelObjectPath)
super(RequestChannel, self)._on_done()
class EnsureChannel(Action):
def __init__(self, connAction, channelType, handleType, handleId):
super(EnsureChannel, self).__init__()
self._connAction = connAction
self._channel = None
self._channelType = channelType
self._handleType = handleType
self._handleId = handleId
self._handle = None
@property
def channel(self):
return self._channel
@property
def handle(self):
return self._handle
@property
def handles(self):
return [self._handle]
def queue_action(self):
properties = {
telepathy.server.CHANNEL_INTERFACE+".ChannelType": self._channelType,
telepathy.server.CHANNEL_INTERFACE+".TargetHandleType": self._handleType,
telepathy.server.CHANNEL_INTERFACE+".TargetID": self._handleId,
}
self._connAction.conn[telepathy.server.<API key>].EnsureChannel(
properties,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, yours, channelObjectPath, properties):
print "Create?", not not yours
print "Path:", channelObjectPath
print "Properties:", properties
self._channel = telepathy.client.Channel(self._connAction.serviceName, channelObjectPath)
self._handle = properties[telepathy.server.CHANNEL_INTERFACE+".TargetHandle"]
super(EnsureChannel, self)._on_done()
class CloseChannel(Action):
def __init__(self, connAction, chanAction):
super(CloseChannel, self).__init__()
self._connAction = connAction
self._chanAction = chanAction
self._handles = []
def queue_action(self):
self._chanAction.channel[telepathy.server.CHANNEL].Close(
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self):
super(CloseChannel, self)._on_done()
class ContactHandles(Action):
def __init__(self, connAction, chanAction):
super(ContactHandles, self).__init__()
self._connAction = connAction
self._chanAction = chanAction
self._handles = []
@property
def handles(self):
return self._handles
def queue_action(self):
self._chanAction.channel[DBUS_PROPERTIES].Get(
telepathy.server.<API key>,
'Members',
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, handles):
self._handles = list(handles)
super(ContactHandles, self)._on_done()
class <API key>(Action):
def __init__(self, connAction, handleAction):
super(<API key>, self).__init__()
self._connAction = connAction
self._handleAction = handleAction
def queue_action(self):
self._connAction.conn[telepathy.server.<API key>].GetPresences(
self._handleAction.handles,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, aliases):
print "\tPresences:"
for hid, (presenceType, presence, presenceMessage) in aliases.iteritems():
print "\t\t%s:" % hid, presenceType, presence, presenceMessage
super(<API key>, self)._on_done()
class SetSimplePresence(Action):
def __init__(self, connAction, status, message):
super(SetSimplePresence, self).__init__()
self._connAction = connAction
self._status = status
self._message = message
def queue_action(self):
self._connAction.conn[telepathy.server.<API key>].SetPresence(
self._status,
self._message,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self):
super(SetSimplePresence, self)._on_done()
class Aliases(Action):
def __init__(self, connAction, handleAction):
super(Aliases, self).__init__()
self._connAction = connAction
self._handleAction = handleAction
def queue_action(self):
self._connAction.conn[telepathy.server.<API key>].RequestAliases(
self._handleAction.handles,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, aliases):
print "\tAliases:"
for h, alias in zip(self._handleAction.handles, aliases):
print "\t\t", h, alias
super(Aliases, self)._on_done()
class Call(Action):
def __init__(self, connAction, chanAction, handleAction):
super(Call, self).__init__()
self._connAction = connAction
self._chanAction = chanAction
self._handleAction = handleAction
def queue_action(self):
self._chanAction.channel[telepathy.server.<API key>].RequestStreams(
self._handleAction.handle,
[telepathy.constants.<API key>],
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self, handle):
print "Call started"
super(Call, self)._on_done()
class SendText(Action):
def __init__(self, connAction, chanAction, handleAction, messageType, message):
super(SendText, self).__init__()
self._connAction = connAction
self._chanAction = chanAction
self._handleAction = handleAction
self._messageType = messageType
self._message = message
def queue_action(self):
self._chanAction.channel[telepathy.server.CHANNEL_TYPE_TEXT].Send(
self._messageType,
self._message,
reply_handler = self._on_done,
error_handler = self._on_error,
)
def _on_done(self,):
print "Message sent"
super(SendText, self)._on_done()
class Sleep(Action):
def __init__(self, length):
super(Sleep, self).__init__()
self._length = length
def queue_action(self):
gobject.timeout_add(self._length, self._on_done)
class Block(Action):
def __init__(self):
super(Block, self).__init__()
def queue_action(self):
print "Blocking"
def _on_done(self):
#super(SendText, self)._on_done()
pass
class Disconnect(Action):
def __init__(self, connAction):
super(Disconnect, self).__init__()
self._connAction = connAction
def queue_action(self):
self._connAction.conn[telepathy.server.CONNECTION].Disconnect(
reply_handler = self._on_done,
error_handler = self._on_error,
)
if __name__ == '__main__':
loop = gobject.MainLoop()
reg = get_registry()
cm = <API key>(reg)
nullHandle = NullHandle()
dummy = DummyAction()
firstAction = dummy
lastAction = dummy
if True:
dp = DisplayParams(cm)
lastAction.append_action(dp)
lastAction = lastAction.get_next_action()
if True:
username = sys.argv[1]
password = sys.argv[2]
forward = sys.argv[3]
reqcon = RequestConnection(cm, username, password, forward)
lastAction.append_action(reqcon)
lastAction = lastAction.get_next_action()
if False:
reqcon = RequestConnection(cm, username, password, forward)
lastAction.append_action(reqcon)
lastAction = lastAction.get_next_action()
con = Connect(reqcon)
lastAction.append_action(con)
lastAction = lastAction.get_next_action()
if True:
spo = <API key>(reqcon)
lastAction.append_action(spo)
lastAction = lastAction.get_next_action()
if True:
uh = UserHandle(reqcon)
lastAction.append_action(uh)
lastAction = lastAction.get_next_action()
ua = Aliases(reqcon, uh)
lastAction.append_action(ua)
lastAction = lastAction.get_next_action()
sps = <API key>(reqcon, uh)
lastAction.append_action(sps)
lastAction = lastAction.get_next_action()
if False:
setdnd = SetSimplePresence(reqcon, "dnd", "")
lastAction.append_action(setdnd)
lastAction = lastAction.get_next_action()
sps = <API key>(reqcon, uh)
lastAction.append_action(sps)
lastAction = lastAction.get_next_action()
setdnd = SetSimplePresence(reqcon, "available", "")
lastAction.append_action(setdnd)
lastAction = lastAction.get_next_action()
sps = <API key>(reqcon, uh)
lastAction.append_action(sps)
lastAction = lastAction.get_next_action()
if False:
sl = Sleep(10 * 1000)
lastAction.append_action(sl)
lastAction = lastAction.get_next_action()
if False:
rclh = RequestHandle(reqcon, telepathy.HANDLE_TYPE_LIST, ["subscribe"])
lastAction.append_action(rclh)
lastAction = lastAction.get_next_action()
rclc = RequestChannel(
reqcon,
rclh,
telepathy.<API key>,
telepathy.HANDLE_TYPE_LIST,
)
lastAction.append_action(rclc)
lastAction = lastAction.get_next_action()
ch = ContactHandles(reqcon, rclc)
lastAction.append_action(ch)
lastAction = lastAction.get_next_action()
ca = Aliases(reqcon, ch)
lastAction.append_action(ca)
lastAction = lastAction.get_next_action()
if True:
accountNumber = sys.argv[4]
enChan = EnsureChannel(reqcon, telepathy.CHANNEL_TYPE_TEXT, telepathy.HANDLE_TYPE_CONTACT, accountNumber)
lastAction.append_action(enChan)
lastAction = lastAction.get_next_action()
sendDebugtext = SendText(reqcon, enChan, enChan, telepathy.<API key>, "Boo!")
lastAction.append_action(sendDebugtext)
lastAction = lastAction.get_next_action()
if False:
rch = RequestHandle(reqcon, telepathy.HANDLE_TYPE_CONTACT, ["18005558355"]) #(1-800-555-TELL)
lastAction.append_action(rch)
lastAction = lastAction.get_next_action()
# making a phone call
if True:
smHandle = rch
smHandleType = telepathy.HANDLE_TYPE_CONTACT
else:
smHandle = nullHandle
smHandleType = telepathy.HANDLE_TYPE_NONE
rsmc = RequestChannel(
reqcon,
smHandle,
telepathy.<API key>,
smHandleType,
)
lastAction.append_action(rsmc)
lastAction = lastAction.get_next_action()
if False:
call = Call(reqcon, rsmc, rch)
lastAction.append_action(call)
lastAction = lastAction.get_next_action()
# sending a text
rtc = RequestChannel(
reqcon,
rch,
telepathy.CHANNEL_TYPE_TEXT,
smHandleType,
)
lastAction.append_action(rtc)
lastAction = lastAction.get_next_action()
if True:
closechan = CloseChannel(reqcon, rtc)
lastAction.append_action(closechan)
lastAction = lastAction.get_next_action()
rtc = RequestChannel(
reqcon,
rch,
telepathy.CHANNEL_TYPE_TEXT,
smHandleType,
)
lastAction.append_action(rtc)
lastAction = lastAction.get_next_action()
if False:
sendtext = SendText(reqcon, rtc, rch, telepathy.<API key>, "Boo!")
lastAction.append_action(sendtext)
lastAction = lastAction.get_next_action()
if False:
bl = Block()
lastAction.append_action(bl)
lastAction = lastAction.get_next_action()
if False:
sl = Sleep(30 * 1000)
lastAction.append_action(sl)
lastAction = lastAction.get_next_action()
dis = Disconnect(reqcon)
lastAction.append_action(dis)
lastAction = lastAction.get_next_action()
quitter = QuitLoop(loop)
lastAction.append_action(quitter)
lastAction = lastAction.get_next_action()
firstAction.queue_action()
loop.run()
|
// This file was generated by the Gtk# code generator.
// Any changes made will be lost if regenerated.
namespace Pango {
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.InteropServices;
#region Autogenerated code
public partial class FontFace : GLib.Object {
public FontFace (IntPtr raw) : base(raw) {}
protected FontFace() : base(IntPtr.Zero)
{
CreateNativeObject (new string [0], new GLib.Value [0]);
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr <API key>(IntPtr raw);
public Pango.FontDescription Describe() {
IntPtr raw_ret = <API key>(Handle);
Pango.FontDescription ret = raw_ret == IntPtr.Zero ? null : (Pango.FontDescription) GLib.Opaque.GetOpaque (raw_ret, typeof (Pango.FontDescription), true);
return ret;
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr <API key>(IntPtr raw);
public string FaceName {
get {
IntPtr raw_ret = <API key>(Handle);
string ret = GLib.Marshaller.Utf8PtrToString (raw_ret);
return ret;
}
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern IntPtr <API key>();
public static new GLib.GType GType {
get {
IntPtr raw_ret = <API key>();
GLib.GType ret = new GLib.GType(raw_ret);
return ret;
}
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern bool <API key>(IntPtr raw);
public bool IsSynthesized {
get {
bool raw_ret = <API key>(Handle);
bool ret = raw_ret;
return ret;
}
}
[DllImport("libpango-1.0-0.dll", CallingConvention = CallingConvention.Cdecl)]
static extern void <API key>(IntPtr raw, out int sizes, out int n_sizes);
public void ListSizes(out int sizes, out int n_sizes) {
<API key>(Handle, out sizes, out n_sizes);
}
#endregion
}
}
|
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ia">
<context>
<name>LxQtTaskButton</name>
<message>
<location filename="../lxqttaskbutton.cpp" line="367"/>
<source>Application</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="400"/>
<source>To &Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="402"/>
<source>&All Desktops</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="410"/>
<source>Desktop &%1</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="417"/>
<source>&To Current Desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="426"/>
<source>Ma&ximize</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="433"/>
<source>Maximize vertically</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="438"/>
<source>Maximize horizontally</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="444"/>
<source>&Restore</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="448"/>
<source>Mi&nimize</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="454"/>
<source>Roll down</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="460"/>
<source>Roll up</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="468"/>
<source>&Layer</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="470"/>
<source>Always on &top</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="476"/>
<source>&Normal</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="482"/>
<source>Always on &bottom</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../lxqttaskbutton.cpp" line="490"/>
<source>&Close</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name><API key></name>
<message>
<location filename="../<API key>.ui" line="14"/>
<source>Task Manager Settings</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="20"/>
<source>Taskbar Contents</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="26"/>
<source>Show windows from current desktop</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="49"/>
<source>Taskbar Appearance</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="65"/>
<source>Minimum button width</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="88"/>
<source>Auto&rotate buttons when the panel is vertical</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="98"/>
<source>Close on middle-click</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="36"/>
<source>Show windows from all desktops</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.ui" line="55"/>
<source>Button style</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.cpp" line="46"/>
<source>Icon and text</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.cpp" line="47"/>
<source>Only icon</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../<API key>.cpp" line="48"/>
<source>Only text</source>
<translation type="unfinished"></translation>
</message>
</context>
</TS>
|
// modification, are permitted provided that the following conditions are met:
// this list of conditions and the following
// distribution.
// Neither the name of the Ford Motor Company nor the names of its contributors
// may be used to endorse or promote products derived from this software
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#ifndef <API key>
#define <API key>
#include <string>
#include <json/json.h>
#include "../include/JSONHandler/SDLRPCObjects/V2/<API key>.h"
/*
interface Ford Sync RAPI
version 2.0O
date 2012-11-02
generated at Thu Jan 24 06:36:23 2013
source stamp Thu Jan 24 06:35:41 2013
author RC
*/
namespace <API key>
{
struct <API key>
{
static bool checkIntegrity(<API key>& e);
static bool checkIntegrityConst(const <API key>& e);
static bool fromString(const std::string& s,<API key>& e);
static const std::string toString(const <API key>& e);
static bool fromJSON(const Json::Value& s,<API key>& e);
static Json::Value toJSON(const <API key>& e);
};
}
#endif
|
#include <config.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
#include "internal.h"
#include "iptables.h"
#include "util.h"
#include "memory.h"
#include "virterror_internal.h"
#include "logging.h"
enum {
ADD = 0,
REMOVE
};
typedef struct
{
char *table;
char *chain;
} iptRules;
struct _iptablesContext
{
iptRules *input_filter;
iptRules *forward_filter;
iptRules *nat_postrouting;
};
static void
iptRulesFree(iptRules *rules)
{
VIR_FREE(rules->table);
VIR_FREE(rules->chain);
VIR_FREE(rules);
}
static iptRules *
iptRulesNew(const char *table,
const char *chain)
{
iptRules *rules;
if (VIR_ALLOC(rules) < 0)
return NULL;
if (!(rules->table = strdup(table)))
goto error;
if (!(rules->chain = strdup(chain)))
goto error;
return rules;
error:
iptRulesFree(rules);
return NULL;
}
static int ATTRIBUTE_SENTINEL
<API key>(iptRules *rules, int action, const char *arg, ...)
{
va_list args;
int retval = ENOMEM;
const char **argv;
const char *s;
int n;
n = 1 + /* /sbin/iptables */
2 + /* --table foo */
2 + /* --insert bar */
1; /* arg */
va_start(args, arg);
while (va_arg(args, const char *))
n++;
va_end(args);
if (VIR_ALLOC_N(argv, n + 1) < 0)
goto error;
n = 0;
if (!(argv[n++] = strdup(IPTABLES_PATH)))
goto error;
if (!(argv[n++] = strdup("--table")))
goto error;
if (!(argv[n++] = strdup(rules->table)))
goto error;
if (!(argv[n++] = strdup(action == ADD ? "--insert" : "--delete")))
goto error;
if (!(argv[n++] = strdup(rules->chain)))
goto error;
if (!(argv[n++] = strdup(arg)))
goto error;
va_start(args, arg);
while ((s = va_arg(args, const char *))) {
if (!(argv[n++] = strdup(s))) {
va_end(args);
goto error;
}
}
va_end(args);
if (virRun(argv, NULL) < 0) {
retval = errno;
goto error;
}
retval = 0;
error:
if (argv) {
n = 0;
while (argv[n])
VIR_FREE(argv[n++]);
VIR_FREE(argv);
}
return retval;
}
/**
* iptablesContextNew:
*
* Create a new IPtable context
*
* Returns a pointer to the new structure or NULL in case of error
*/
iptablesContext *
iptablesContextNew(void)
{
iptablesContext *ctx;
if (VIR_ALLOC(ctx) < 0)
return NULL;
if (!(ctx->input_filter = iptRulesNew("filter", "INPUT")))
goto error;
if (!(ctx->forward_filter = iptRulesNew("filter", "FORWARD")))
goto error;
if (!(ctx->nat_postrouting = iptRulesNew("nat", "POSTROUTING")))
goto error;
return ctx;
error:
iptablesContextFree(ctx);
return NULL;
}
/**
* iptablesContextFree:
* @ctx: pointer to the IP table context
*
* Free the resources associated with an IP table context
*/
void
iptablesContextFree(iptablesContext *ctx)
{
if (ctx->input_filter)
iptRulesFree(ctx->input_filter);
if (ctx->forward_filter)
iptRulesFree(ctx->forward_filter);
if (ctx->nat_postrouting)
iptRulesFree(ctx->nat_postrouting);
VIR_FREE(ctx);
}
static int
iptablesInput(iptablesContext *ctx,
const char *iface,
int port,
int action,
int tcp)
{
char portstr[32];
snprintf(portstr, sizeof(portstr), "%d", port);
portstr[sizeof(portstr) - 1] = '\0';
return <API key>(ctx->input_filter,
action,
"--in-interface", iface,
"--protocol", tcp ? "tcp" : "udp",
"--destination-port", portstr,
"--jump", "ACCEPT",
NULL);
}
/**
* iptablesAddTcpInput:
* @ctx: pointer to the IP table context
* @iface: the interface name
* @port: the TCP port to add
*
* Add an input to the IP table allowing access to the given @port on
* the given @iface interface for TCP packets
*
* Returns 0 in case of success or an error code in case of error
*/
int
iptablesAddTcpInput(iptablesContext *ctx,
const char *iface,
int port)
{
return iptablesInput(ctx, iface, port, ADD, 1);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the interface name
* @port: the TCP port to remove
*
* Removes an input from the IP table, hence forbidding access to the given
* @port on the given @iface interface for TCP packets
*
* Returns 0 in case of success or an error code in case of error
*/
int
<API key>(iptablesContext *ctx,
const char *iface,
int port)
{
return iptablesInput(ctx, iface, port, REMOVE, 1);
}
/**
* iptablesAddUdpInput:
* @ctx: pointer to the IP table context
* @iface: the interface name
* @port: the UDP port to add
*
* Add an input to the IP table allowing access to the given @port on
* the given @iface interface for UDP packets
*
* Returns 0 in case of success or an error code in case of error
*/
int
iptablesAddUdpInput(iptablesContext *ctx,
const char *iface,
int port)
{
return iptablesInput(ctx, iface, port, ADD, 0);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the interface name
* @port: the UDP port to remove
*
* Removes an input from the IP table, hence forbidding access to the given
* @port on the given @iface interface for UDP packets
*
* Returns 0 in case of success or an error code in case of error
*/
int
<API key>(iptablesContext *ctx,
const char *iface,
int port)
{
return iptablesInput(ctx, iface, port, REMOVE, 0);
}
/* Allow all traffic coming from the bridge, with a valid network address
* to proceed to WAN
*/
static int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev,
int action)
{
if (physdev && physdev[0]) {
return <API key>(ctx->forward_filter,
action,
"--source", network,
"--in-interface", iface,
"--out-interface", physdev,
"--jump", "ACCEPT",
NULL);
} else {
return <API key>(ctx->forward_filter,
action,
"--source", network,
"--in-interface", iface,
"--jump", "ACCEPT",
NULL);
}
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @iface: the source interface name
* @physdev: the physical output device
*
* Add a rule to the IP table context to allow the traffic for the
* network @network via interface @iface to be forwarded to
* @physdev device. This allow the outbound traffic on a bridge.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev)
{
return <API key>(ctx, network, iface, physdev, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @iface: the source interface name
* @physdev: the physical output device
*
* Remove a rule from the IP table context hence forbidding forwarding
* of the traffic for the network @network via interface @iface
* to the @physdev device output. This stops the outbound traffic on a bridge.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev)
{
return <API key>(ctx, network, iface, physdev, REMOVE);
}
/* Allow all traffic destined to the bridge, with a valid network address
* and associated with an existing connection
*/
static int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev,
int action)
{
if (physdev && physdev[0]) {
return <API key>(ctx->forward_filter,
action,
"--destination", network,
"--in-interface", physdev,
"--out-interface", iface,
"--match", "state",
"--state", "ESTABLISHED,RELATED",
"--jump", "ACCEPT",
NULL);
} else {
return <API key>(ctx->forward_filter,
action,
"--destination", network,
"--out-interface", iface,
"--match", "state",
"--state", "ESTABLISHED,RELATED",
"--jump", "ACCEPT",
NULL);
}
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @iface: the output interface name
* @physdev: the physical input device or NULL
*
* Add rules to the IP table context to allow the traffic for the
* network @network on @physdev device to be forwarded to
* interface @iface, if it is part of an existing connection.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev)
{
return <API key>(ctx, network, iface, physdev, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @iface: the output interface name
* @physdev: the physical input device or NULL
*
* Remove rules from the IP table context hence forbidding the traffic for
* network @network on @physdev device to be forwarded to
* interface @iface, if it is part of an existing connection.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev)
{
return <API key>(ctx, network, iface, physdev, REMOVE);
}
/* Allow all traffic destined to the bridge, with a valid network address
*/
static int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev,
int action)
{
if (physdev && physdev[0]) {
return <API key>(ctx->forward_filter,
action,
"--destination", network,
"--in-interface", physdev,
"--out-interface", iface,
"--jump", "ACCEPT",
NULL);
} else {
return <API key>(ctx->forward_filter,
action,
"--destination", network,
"--out-interface", iface,
"--jump", "ACCEPT",
NULL);
}
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @iface: the output interface name
* @physdev: the physical input device or NULL
*
* Add rules to the IP table context to allow the traffic for the
* network @network on @physdev device to be forwarded to
* interface @iface. This allow the inbound traffic on a bridge.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev)
{
return <API key>(ctx, network, iface, physdev, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @iface: the output interface name
* @physdev: the physical input device or NULL
*
* Remove rules from the IP table context hence forbidding the traffic for
* network @network on @physdev device to be forwarded to
* interface @iface. This stops the inbound traffic on a bridge.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *iface,
const char *physdev)
{
return <API key>(ctx, network, iface, physdev, REMOVE);
}
/* Allow all traffic between guests on the same bridge,
* with a valid network address
*/
static int
<API key>(iptablesContext *ctx,
const char *iface,
int action)
{
return <API key>(ctx->forward_filter,
action,
"--in-interface", iface,
"--out-interface", iface,
"--jump", "ACCEPT",
NULL);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the input/output interface name
*
* Add rules to the IP table context to allow traffic to cross that
* interface. It allows all traffic between guests on the same bridge
* represented by that interface.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *iface) {
return <API key>(ctx, iface, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the input/output interface name
*
* Remove rules to the IP table context to block traffic to cross that
* interface. It forbids traffic between guests on the same bridge
* represented by that interface.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *iface) {
return <API key>(ctx, iface, REMOVE);
}
/* Drop all traffic trying to forward from the bridge.
* ie the bridge is the in interface
*/
static int
<API key>(iptablesContext *ctx,
const char *iface,
int action)
{
return <API key>(ctx->forward_filter,
action,
"--in-interface", iface,
"--jump", "REJECT",
NULL);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the output interface name
*
* Add rules to the IP table context to forbid all traffic to that
* interface. It forbids forwarding from the bridge to that interface.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *iface)
{
return <API key>(ctx, iface, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the output interface name
*
* Remove rules from the IP table context forbidding all traffic to that
* interface. It reallow forwarding from the bridge to that interface.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *iface)
{
return <API key>(ctx, iface, REMOVE);
}
/* Drop all traffic trying to forward to the bridge.
* ie the bridge is the out interface
*/
static int
<API key>(iptablesContext *ctx,
const char *iface,
int action)
{
return <API key>(ctx->forward_filter,
action,
"--out-interface", iface,
"--jump", "REJECT",
NULL);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the input interface name
*
* Add rules to the IP table context to forbid all traffic from that
* interface. It forbids forwarding from that interface to the bridge.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *iface)
{
return <API key>(ctx, iface, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @iface: the input interface name
*
* Remove rules from the IP table context forbidding all traffic from that
* interface. It allows forwarding from that interface to the bridge.
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *iface)
{
return <API key>(ctx, iface, REMOVE);
}
/* Masquerade all traffic coming from the network associated
* with the bridge
*/
static int
<API key>(iptablesContext *ctx,
const char *network,
const char *physdev,
int action)
{
if (physdev && physdev[0]) {
return <API key>(ctx->nat_postrouting,
action,
"--source", network,
"!", "--destination", network,
"--out-interface", physdev,
"--jump", "MASQUERADE",
NULL);
} else {
return <API key>(ctx->nat_postrouting,
action,
"--source", network,
"!", "--destination", network,
"--jump", "MASQUERADE",
NULL);
}
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @physdev: the physical input device or NULL
*
* Add rules to the IP table context to allow masquerading
* network @network on @physdev. This allow the bridge to
* masquerade for that network (on @physdev).
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *physdev)
{
return <API key>(ctx, network, physdev, ADD);
}
/**
* <API key>:
* @ctx: pointer to the IP table context
* @network: the source network name
* @physdev: the physical input device or NULL
*
* Remove rules from the IP table context to stop masquerading
* network @network on @physdev. This stops the bridge from
* masquerading for that network (on @physdev).
*
* Returns 0 in case of success or an error code otherwise
*/
int
<API key>(iptablesContext *ctx,
const char *network,
const char *physdev)
{
return <API key>(ctx, network, physdev, REMOVE);
}
|
package compiler.ASTNodes.Operators;
import compiler.ASTNodes.GeneralNodes.Node;
import compiler.ASTNodes.GeneralNodes.UnaryNode;
import compiler.ASTNodes.SyntaxNodes.ExprNode;
import compiler.Visitors.AbstractVisitor;
public class UnaryMinusNode extends ExprNode {
public UnaryMinusNode(Node child) {
super(child, null);
}
@Override
public Object Accept(AbstractVisitor v) {
return v.visit(this);
}
}
|
#include <QtGui>
#include "btglobal.h"
#include "btqlistdelegate.h"
//#include <QMetaType>
btQListDeletgate::btQListDeletgate(QObject *parent)
: QItemDelegate(parent)
{
}
QWidget *btQListDeletgate::createEditor(QWidget *parent, const <API key> &option, const QModelIndex &index) const
{
//qRegisterMetaType<btChildWeights>("btChildWeights");
//qRegisterMetaType<<API key>>("<API key>");
QComboBox *comboBox = new QComboBox(parent);
comboBox->addItem("int", QVariant("int"));
comboBox->addItem("QString", QVariant("QString"));
comboBox->addItem("double", QVariant("double"));
comboBox->addItem("QVariantList", QVariant("QVariantList"));
//comboBox->addItem("btChildWeights", QVariant("btChildWeights"));
comboBox->setCurrentIndex(comboBox->findData(index.data()));
return comboBox;
}
void btQListDeletgate::setEditorData(QWidget *editor, const QModelIndex &index) const
{
QString value = index.model()->data(index, Qt::EditRole).toString();
QComboBox *comboBox = static_cast<QComboBox*>(editor);
comboBox->setCurrentIndex(comboBox->findText(value));//comboBox->findData(value));
}
void btQListDeletgate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
{
QComboBox *comboBox = static_cast<QComboBox*>(editor);
QString value = comboBox->currentText();
model->setData(index, value, Qt::EditRole);
}
void btQListDeletgate::<API key>(QWidget *editor, const <API key> &option, const QModelIndex &/* index */) const
{
editor->setGeometry(option.rect);
}
#include "btqlistdelegate.moc"
|
package org.jouvieje.Fmod.Structures;
import org.jouvieje.Fmod.Misc.Pointer;
public class <API key> extends Pointer
{
/**
* Create a view of the <code>Pointer</code> object as a <code><API key></code> object.<br>
* This view is valid only if the memory holded by the <code>Pointer</code> holds a <API key> object.
*/
public static <API key> createView(Pointer pointer)
{
return new <API key>(Pointer.getPointer(pointer));
}
/**
* Create a new <code><API key></code>.<br>
* The call <code>isNull()</code> on the object created will return false.<br>
* <pre><code> <API key> obj = <API key>.create();
* (obj == null) <=> obj.isNull() <=> false
* </code></pre>
*/
public static <API key> create()
{
return new <API key>(StructureJNI.<API key>());
}
protected <API key>(long pointer)
{
super(pointer);
}
/**
* Create an object that holds a null <code><API key></code>.<br>
* The call <code>isNull()</code> on the object created will returns true.<br>
* <pre><code> <API key> obj = new <API key>();
* (obj == null) <=> false
* obj.isNull() <=> true
* </code></pre>
* To creates a new <code><API key></code>, use the static "constructor" :
* <pre><code> <API key> obj = <API key>.create();</code></pre>
* @see <API key>#create()
*/
public <API key>()
{
super();
}
public void release()
{
if(pointer != 0)
{
StructureJNI.<API key>(pointer);
}
pointer = 0;
}
/**
* -10000, 1000, 0, direct path level (at low and mid frequencies) (WIN32/XBOX)
*/
public void setDirect(int Direct)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, Direct);
}
/**
* @return value of Direct
*/
public int getDirect()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 0, 0, relative direct path level at high frequencies (WIN32/XBOX)
*/
public void setDirectHF(int DirectHF)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, DirectHF);
}
/**
* @return value of DirectHF
*/
public int getDirectHF()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 1000, 0, room effect level (at low and mid frequencies) (WIN32/XBOX/PS2)
*/
public void setRoom(int Room)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, Room);
}
/**
* @return value of Room
*/
public int getRoom()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 0, 0, relative room effect level at high frequencies (WIN32/XBOX)
*/
public void setRoomHF(int RoomHF)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, RoomHF);
}
/**
* @return value of RoomHF
*/
public int getRoomHF()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 0, 0, main obstruction control (attenuation at high frequencies) (WIN32/XBOX)
*/
public void setObstruction(int Obstruction)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, Obstruction);
}
/**
* @return value of Obstruction
*/
public int getObstruction()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 1.0, 0.0, obstruction low-frequency level re. main control (WIN32/XBOX)
*/
public void <API key>(float ObstructionLFRatio)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
ObstructionLFRatio);
}
/**
* @return value of ObstructionLFRatio
*/
public float <API key>()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 0, 0, main occlusion control (attenuation at high frequencies) (WIN32/XBOX)
*/
public void setOcclusion(int Occlusion)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, Occlusion);
}
/**
* @return value of Occlusion
*/
public int getOcclusion()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 1.0, 0.25, occlusion low-frequency level re. main control (WIN32/XBOX)
*/
public void setOcclusionLFRatio(float OcclusionLFRatio)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
OcclusionLFRatio);
}
/**
* @return value of OcclusionLFRatio
*/
public float getOcclusionLFRatio()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 10.0, 1.5, relative occlusion control for room effect (WIN32)
*/
public void <API key>(float OcclusionRoomRatio)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
OcclusionRoomRatio);
}
/**
* @return value of OcclusionRoomRatio
*/
public float <API key>()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 10.0, 1.0, relative occlusion control for direct path (WIN32)
*/
public void <API key>(float <API key>)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
<API key>);
}
/**
* @return value of <API key>
*/
public float <API key>()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 0, 0, main exlusion control (attenuation at high frequencies) (WIN32)
*/
public void setExclusion(int Exclusion)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, Exclusion);
}
/**
* @return value of Exclusion
*/
public int getExclusion()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 1.0, 1.0, exclusion low-frequency level re. main control (WIN32)
*/
public void setExclusionLFRatio(float ExclusionLFRatio)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
ExclusionLFRatio);
}
/**
* @return value of ExclusionLFRatio
*/
public float getExclusionLFRatio()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* -10000, 0, 0, outside sound cone level at high frequencies (WIN32)
*/
public void setOutsideVolumeHF(int OutsideVolumeHF)
{
if(pointer == 0) throw new <API key>();
StructureJNI
.<API key>(pointer, OutsideVolumeHF);
}
/**
* @return value of OutsideVolumeHF
*/
public int getOutsideVolumeHF()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 10.0, 0.0, like DS3D flDopplerFactor but per source (WIN32)
*/
public void setDopplerFactor(float DopplerFactor)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, DopplerFactor);
}
/**
* @return value of DopplerFactor
*/
public float getDopplerFactor()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but per source (WIN32)
*/
public void setRolloffFactor(float RolloffFactor)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, RolloffFactor);
}
/**
* @return value of RolloffFactor
*/
public float getRolloffFactor()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 10.0, 0.0, like DS3D flRolloffFactor but for room effect (WIN32/XBOX)
*/
public void <API key>(float RoomRolloffFactor)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
RoomRolloffFactor);
}
/**
* @return value of RoomRolloverFactor
*/
public float <API key>()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* 0.0, 10.0, 1.0, multiplies AirAbsorptionHF member of <API key> (WIN32)
* */
public void <API key>(float AirAbsorptionFactor)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer,
AirAbsorptionFactor);
}
/**
* @return value of AirAbsorptionFactor
*/
public float <API key>()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
/**
* <API key> - modifies the behavior of properties (WIN32)
*/
public void setFlags(int Flags)
{
if(pointer == 0) throw new <API key>();
StructureJNI.<API key>(pointer, Flags);
}
/**
* @return value of EchoTime
*/
public int getFlags()
{
if(pointer == 0) throw new <API key>();
return StructureJNI.<API key>(pointer);
}
}
|
int SZ(loadelf,)(memory_t *m, char *name, FILE *f, elf_info_t *elf_info)
{
memset(elf_info, 0, sizeof *elf_info);
SZ(Elf,_Ehdr) ehdr;
SZ(Elf,_Phdr) *ph;
if (fread(&ehdr, sizeof ehdr, 1, f) != 1) {
fprintf(stderr, "%s: short header read, file corrupted?\n", name);
return 10;
}
if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB && ehdr.e_ident[EI_DATA] != ELFDATA2LSB) {
fprintf(stderr, "%s: Unsupported endian (%d)\n",
name, ehdr.e_ident[EI_DATA]);
return 11;
}
elf_info->endian_is_big = ehdr.e_ident[EI_DATA] == ELFDATA2MSB;
memory_set_endian(m, elf_info->endian_is_big);
if (NATIVE(ehdr.e_type) != ET_EXEC) {
fprintf(stderr, "%s: Need a fully linked ELF executable, not type %d\n",
name, NATIVE(ehdr.e_type));
return 12;
}
elf_info->machine = NATIVE(ehdr.e_machine);
if (elf_info->machine != EM_ALPHA &&
elf_info->machine != EM_RISCV &&
elf_info->machine != EM_LM32 &&
elf_info->machine != EM_LM32_ALT) {
fprintf(stderr, "%s: Unsupported machine architecture %d\n",
name, NATIVE(ehdr.e_machine));
return 13;
}
if (<API key>) {
printf("%s:\n", name);
printf("%sendian\n", elf_info->endian_is_big ? "big" : "little");
printf("Entry: %016"PRIx64"\n",
(uint64_t) NATIVE(ehdr.e_entry)); /* Entry point virtual address */
printf("Proc Flags: %08x\n",
NATIVE(ehdr.e_flags)); /* Processor-specific flags */
printf("Phdr.tbl entry cnt % 8d\n",
NATIVE(ehdr.e_phnum)); /*Program header table entry count */
printf("Shdr.tbl entry cnt % 8d\n",
NATIVE(ehdr.e_shnum)); /*Section header table entry count */
printf("Shdr.str tbl idx % 8d\n",
NATIVE(ehdr.e_shstrndx)); /*Section header string table index */
}
elf_info->program_entry = NATIVE(ehdr.e_entry);
if (NATIVE(ehdr.e_ehsize) != sizeof ehdr) {
return 14;
}
if (NATIVE(ehdr.e_shentsize) != sizeof(SZ(Elf,_Shdr))) {
return 15;
}
// Allocate program headers
ph = alloca(sizeof *ph * NATIVE(ehdr.e_phnum));
int phnum = NATIVE(ehdr.e_phnum);
for (int i = 0; i < phnum; ++i) {
fseek(f, NATIVE(ehdr.e_phoff) + i * NATIVE(ehdr.e_phentsize), SEEK_SET);
if (fread(ph + i, sizeof *ph, 1, f) != 1)
return 16;
if (<API key>) {
printf("\nProgram header #%d (%lx)\n", i, ftell(f));
printf(" type %08x\n", NATIVE(ph[i].p_type));
printf(" filesz %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_filesz));
printf(" offset %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_offset));
printf(" vaddr %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_vaddr));
printf(" paddr %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_paddr));
printf(" memsz %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_memsz));
printf(" flags %08x\n", NATIVE(ph[i].p_flags));
printf(" align %016"PRIx64"\n", (uint64_t)NATIVE(ph[i].p_align));
}
if (NATIVE(ph[i].p_type) == PT_LOAD && NATIVE(ph[i].p_filesz)) {
if (<API key>)
fprintf(stderr, "Loading section [%016"PRIx64"; %016"PRIx64"]\n",
(uint64_t)NATIVE(ph[i].p_vaddr),
(uint64_t)NATIVE(ph[i].p_vaddr) + NATIVE(ph[i].p_memsz) - 1);
loadsection(f,
(unsigned)NATIVE(ph[i].p_offset),
(unsigned)NATIVE(ph[i].p_filesz),
m,
NATIVE(ph[i].p_vaddr),
NATIVE(ph[i].p_memsz),
elf_info);
}
if (ph[i].p_flags & 1) {
elf_info->text_segments++;
elf_info->text_start = NATIVE(ph[i].p_vaddr);
elf_info->text_size = NATIVE(ph[i].p_memsz);
}
}
if (enable_verb_elf) {
printf("\n");
fseek(f, NATIVE(ehdr.e_shoff), SEEK_SET);
int shnum = NATIVE(ehdr.e_shnum);
for (int i = 0; i < shnum; ++i) {
SZ(Elf,_Shdr) sh;
if (fread(&sh, sizeof sh, 1, f) != 1)
return 17;
printf("\nSection header #%d (%lx)\n", i, ftell(f));
printf(" name %08x\n", NATIVE(sh.sh_name));
printf(" type %08x\n", NATIVE(sh.sh_type));
printf(" flags %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_flags));
printf(" addr %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_addr));
printf(" offset %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_offset));
printf(" size %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_size));
printf(" link %08x\n", NATIVE(sh.sh_link));
printf(" info %08x\n", NATIVE(sh.sh_info));
printf(" addralign %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_addralign));
printf(" entsize %016"PRIx64"\n", (uint64_t)NATIVE(sh.sh_entsize));
}
printf(" (now at %lx)\n", ftell(f));
}
return 0;
}
// Local Variables:
// mode: C
// <API key>: t
// c-file-style: "stroustrup"
// End:
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>getBytes</title>
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700,300italic,400italic,700italic|Source+Code+Pro:300,400,700' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../assets/css/bootstrap.css">
<link rel="stylesheet" href="../assets/css/jquery.bonsai.css">
<link rel="stylesheet" href="../assets/css/main.css">
<link rel="stylesheet" href="../assets/css/icons.css">
<script type="text/javascript" src="../assets/js/jquery-2.1.0.min.js"></script>
<script type="text/javascript" src="../assets/js/bootstrap.js"></script>
<script type="text/javascript" src="../assets/js/jquery.bonsai.js"></script>
<!-- <script type="text/javascript" src="../assets/js/main.js"></script> -->
</head>
<body>
<div>
<!-- Name Title -->
<h1>getBytes</h1>
<!-- Type and Stereotype -->
<section style="margin-top: .5em;">
<span class="alert alert-info">
<span class="node-icon _icon-UMLOperation"></span>
UMLOperation
</span>
</section>
<!-- Path -->
<section style="margin-top: 10px">
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-Project'></span>Untitled</a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLModel'></span>JavaReverse</a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>net</a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>gleamynode</a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>netty</a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLPackage'></span>buffer</a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span><API key></a></span>
<span>::</span>
<span class="label label-info"><a href='<API key>.html'><span class='node-icon _icon-UMLOperation'></span>getBytes</a></span>
</section>
<!-- Diagram -->
<!-- Description -->
<section>
<h3>Description</h3>
<div>
<span class="label label-info">none</span>
</div>
</section>
<!-- Specification -->
<!-- Directed Relationship -->
<!-- Undirected Relationship -->
<!-- Classifier -->
<!-- Interface -->
<!-- Component -->
<!-- Node -->
<!-- Actor -->
<!-- Use Case -->
<!-- Template Parameters -->
<!-- Literals -->
<!-- Attributes -->
<!-- Operations -->
<!-- Receptions -->
<!-- Extension Points -->
<!-- Parameters -->
<section>
<h3>Parameters</h3>
<table class="table table-striped table-bordered">
<tr>
<th>Direction</th>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
<tr>
<td>in</td>
<td><a href="<API key>.html">index</a></td>
<td>int</td>
<td></td>
</tr>
<tr>
<td>in</td>
<td><a href="<API key>.html">dst</a></td>
<td><a href='<API key>.html'><span class='node-icon _icon-UMLClass'></span>ByteBuffer</a></td>
<td></td>
</tr>
<tr>
<td>return</td>
<td><a href="<API key>.html">(unnamed)</a></td>
<td>void</td>
<td></td>
</tr>
</table>
</section>
<!-- Diagrams -->
<!-- Behavior -->
<!-- Action -->
<!-- Interaction -->
<!-- CombinedFragment -->
<!-- Activity -->
<!-- State Machine -->
<!-- State Machine -->
<!-- State -->
<!-- Vertex -->
<!-- Transition -->
<!-- Properties -->
<section>
<h3>Properties</h3>
<table class="table table-striped table-bordered">
<tr>
<th width="50%">Name</th>
<th width="50%">Value</th>
</tr>
<tr>
<td>name</td>
<td>getBytes</td>
</tr>
<tr>
<td>stereotype</td>
<td><span class='label label-info'>null</span></td>
</tr>
<tr>
<td>visibility</td>
<td>public</td>
</tr>
<tr>
<td>isStatic</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>isLeaf</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>parameters</td>
<td>
<a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>index</a>
<span>, </span>
<a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>dst</a>
<span>, </span>
<a href='<API key>.html'><span class='node-icon _icon-UMLParameter'></span>(Parameter)</a>
</td>
</tr>
<tr>
<td>raisedExceptions</td>
<td>
</td>
</tr>
<tr>
<td>concurrency</td>
<td>sequential</td>
</tr>
<tr>
<td>isQuery</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>isAbstract</td>
<td><span class='label label-info'>false</span></td>
</tr>
<tr>
<td>specification</td>
<td></td>
</tr>
</table>
</section>
<!-- Tags -->
<!-- Constraints, Dependencies, Dependants -->
<!-- Relationships -->
<!-- Owned Elements -->
</div>
</body>
</html>
|
// AddIn.cpp : Implementation of DLL Exports.
#include "stdafx.h"
#include "resource.h"
#include "AddIn.h"
CAddInModule _AtlModule;
// DLL Entry Point
extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
_AtlModule.SetResourceInstance(hInstance);
return _AtlModule.DllMain(dwReason, lpReserved);
}
// Used to determine whether the DLL can be unloaded by OLE
STDAPI DllCanUnloadNow(void)
{
return _AtlModule.DllCanUnloadNow();
}
// Returns a class factory to create an object of the requested type
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
{
return _AtlModule.DllGetClassObject(rclsid, riid, ppv);
}
void <API key>(const CString& version, const CString& modulePath, const CString& moduleShortName)
{
CString path = "Software\\Microsoft\\VisualStudio\\" + version;
CRegKey devKey;
if (devKey.Open(HKEY_LOCAL_MACHINE, path) == ERROR_SUCCESS)
{
// Auto create the addins key if it isn't already there.
if (devKey.Create(HKEY_LOCAL_MACHINE, path + "\\AddIns") == ERROR_SUCCESS)
{
// Create the WorkspaceWhiz.DSAddin.1 key.
if (devKey.Create(HKEY_LOCAL_MACHINE, path + "\\AddIns\\LuaPlusDebugger.Connect") == ERROR_SUCCESS)
{
// Remove all old entries.
devKey.SetStringValue("SatelliteDLLPath", modulePath);
devKey.SetStringValue("SatelliteDLLName", moduleShortName);
devKey.SetDWORDValue("LoadBehavior", 3);
devKey.SetStringValue("FriendlyName", "LuaPlus Debugger Window");
devKey.SetStringValue("Description", "The LuaPlus Debugger Window add-in provides support for viewing Lua tables while debugging.");
devKey.SetDWORDValue("CommandPreload", 1);
}
}
}
if (devKey.Open(HKEY_CURRENT_USER, path + "\\PreloadAddinState") == ERROR_SUCCESS)
{
devKey.SetDWORDValue("LuaPlusDebugger.Connect", 1);
}
}
void <API key>(const CString& version)
{
CString path = "Software\\Microsoft\\VisualStudio\\" + version;
CRegKey key;
if (key.Open(HKEY_LOCAL_MACHINE, path + "\\AddIns") == ERROR_SUCCESS)
{
// Remove all old entries.
key.RecurseDeleteKey("LuaPlusDebugger.Connect");
}
}
// DllRegisterServer - Adds entries to the system registry
STDAPI DllRegisterServer(void)
{
// registers object, typelib and all interfaces in typelib
HRESULT hr = _AtlModule.DllRegisterServer();
// Get the module name.
TCHAR moduleName[_MAX_PATH];
moduleName[0] = 0;
::GetModuleFileName(_AtlModule.GetResourceInstance(), (TCHAR*)&moduleName, _MAX_PATH);
// Get the module path.
TCHAR modulePath[_MAX_PATH];
_tcscpy(modulePath, moduleName);
TCHAR* ptr = _tcsrchr(modulePath, '\\');
ptr++;
*ptr++ = 0;
// Get the short module name.
TCHAR moduleShortName[_MAX_PATH];
ptr = _tcsrchr(moduleName, '\\');
_tcscpy(moduleShortName, ptr + 1);
// Register the add-in?
<API key>("7.0", modulePath, moduleShortName);
<API key>("7.1", modulePath, moduleShortName);
return hr;
}
// DllUnregisterServer - Removes entries from the system registry
STDAPI DllUnregisterServer(void)
{
HRESULT hr = _AtlModule.DllUnregisterServer();
// Remove entries.
<API key>("7.0");
<API key>("7.1");
return hr;
}
|
// <auto-generated>
// </auto-generated>
#if !BUILD_LAND_XML
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using XmlSchemaProcessor.Common;
namespace XmlSchemaProcessor.LandXml20
{
public enum CurveType
{
[StringValue("arc")]
Arc,
[StringValue("chord")]
Chord,
}
}
#endif
|
import json
import etcd
from tendrl.gluster_bridge.atoms.volume.set import Set
class SetVolumeOption(object):
def __init__(self, api_job):
super(SetVolumeOption, self).__init__()
self.api_job = api_job
self.atom = SetVolumeOption
def start(self):
attributes = json.loads(self.api_job['attributes'].decode('utf-8'))
vol_name = attributes['volname']
option = attributes['option_name']
option_value = attributes['option_value']
self.atom().start(vol_name, option, option_value)
self.api_job['status'] = "finished"
etcd.Client().write(self.api_job['request_id'],
json.dumps(self.api_job))
|
## State Machine Sequences and Wave-forms
This section provides additional explanation to particular functions of [API Functions](readme.md#functions) by presenting screenshots of state machine sequence diagrams and wave-forms. All wave-forms were taken during operation of application with DimSwitch library controlling OSRAM QUICKTRONIC - INTELLIGENT QTi DALI 2x28/54 DIM electronic ballast.
Table of Contents
* [Toggle Relay](#toggle-relay)
* [Sequence](#<API key>)
* [Wave-forms](#<API key>)
* [Power On](#power-on)
* [Sequence](#power-on-sequence)
* [Wave-forms](#power-on-wave-forms)
* [Power Off](#power-off)
* [Sequence](#power-off-sequence)
* [Wave-forms](#<API key>)
* [Calibrate](#calibrate)
* [Sequence](#calibrate-sequence)
* [Wave-forms](#<API key>)
* [Set Intensity](#set-intensity)
* [Sequence](#<API key>)
* [Wave-forms](#<API key>)
Toggle Relay
# Toggle Relay Sequence

# Toggle Relay Wave-forms

Power On
# Power On Sequence

# Power On Wave-forms

Power Off
# Power Off Sequence

# Power Off Wave-forms


Calibrate
# Calibrate Sequence

# Calibrate Wave-forms


Set Intensity
# Set Intensity Sequence

# Set Intensity Wave-forms
Sequence of setting light intensity depends on initial lamp state (if it is off or already on) and initial direction of intensity change. In later case if initial direction is opposite from desired, the relay is momentary toggled off to change it. See the following wave-forms that illustrate particular cases.
Set the light intensity when the lamp is initially off (below).

Set the light intensity when the lamp is already on (below).

Set the light intensity with altering direction change (below).

Set the light intensity with altering direction change - another example (below).

|
/**
* @file common/js/xml_handler.js
* @brief XE ajax module, act
**/
// xml handler user function
var <API key> = true;
function xml2json(xml, tab, ignoreAttrib) {
var X = {
toObj: function(xml) {
var o = {};
if (xml.nodeType==1) { // element node ..
if (ignoreAttrib && xml.attributes.length) // element with attributes ..
for (var i=0; i<xml.attributes.length; i++)
o["@"+xml.attributes[i].nodeName] = (xml.attributes[i].nodeValue||"").toString();
if (xml.firstChild) { // element has child nodes ..
var textChild=0, cdataChild=0, hasElementChild=false;
for (var n=xml.firstChild; n; n=n.nextSibling) {
if (n.nodeType==1) hasElementChild = true;
else if (n.nodeType==3 && n.nodeValue.match(/[^ \f\n\r\t\v]/)) textChild++; // non-whitespace text
else if (n.nodeType==4) cdataChild++; // cdata section node
}
if (hasElementChild) {
if (textChild < 2 && cdataChild < 2) { // structured element with evtl. a single text or/and cdata node ..
X.removeWhite(xml);
for (var n=xml.firstChild; n; n=n.nextSibling) {
if (n.nodeType == 3) // text node
o = X.escape(n.nodeValue);
else if (n.nodeType == 4) // cdata node
// o["#cdata"] = X.escape(n.nodeValue);
o = X.escape(n.nodeValue);
else if (o[n.nodeName]) { // multiple occurence of element ..
if (o[n.nodeName] instanceof Array)
o[n.nodeName][o[n.nodeName].length] = X.toObj(n);
else
o[n.nodeName] = [o[n.nodeName], X.toObj(n)];
}
else // first occurence of element..
o[n.nodeName] = X.toObj(n);
}
}
else { // mixed content
if (!xml.attributes.length)
o = X.escape(X.innerXml(xml));
else
o["#text"] = X.escape(X.innerXml(xml));
}
}
else if (textChild) { // pure text
if (!xml.attributes.length)
o = X.escape(X.innerXml(xml));
else
o["#text"] = X.escape(X.innerXml(xml));
}
else if (cdataChild) { // cdata
if (cdataChild > 1)
o = X.escape(X.innerXml(xml));
else
for (var n=xml.firstChild; n; n=n.nextSibling){
//o["#cdata"] = X.escape(n.nodeValue);
o = X.escape(n.nodeValue);
}
}
}
if (!xml.attributes.length && !xml.firstChild) o = null;
}
else if (xml.nodeType==9) { // document.node
o = X.toObj(xml.documentElement);
}
else
alert("unhandled node type: " + xml.nodeType);
return o;
},
toJson: function(o, name, ind) {
var json = name ? ("\""+name+"\"") : "";
if (o instanceof Array) {
for (var i=0,n=o.length; i<n; i++)
o[i] = X.toJson(o[i], "", ind+"\t");
json += (name?":[":"[") + (o.length > 1 ? ("\n"+ind+"\t"+o.join(",\n"+ind+"\t")+"\n"+ind) : o.join("")) + "]";
}
else if (o == null)
json += (name&&":") + "null";
else if (typeof(o) == "object") {
var arr = [];
for (var m in o)
arr[arr.length] = X.toJson(o[m], m, ind+"\t");
json += (name?":{":"{") + (arr.length > 1 ? ("\n"+ind+"\t"+arr.join(",\n"+ind+"\t")+"\n"+ind) : arr.join("")) + "}";
}
else if (typeof(o) == "string")
json += (name&&":") + "\"" + o.toString() + "\"";
else
json += (name&&":") + o.toString();
return json;
},
innerXml: function(node) {
var s = ""
if ("innerHTML" in node)
s = node.innerHTML;
else {
var asXml = function(n) {
var s = "";
if (n.nodeType == 1) {
s += "<" + n.nodeName;
for (var i=0; i<n.attributes.length;i++)
s += " " + n.attributes[i].nodeName + "=\"" + (n.attributes[i].nodeValue||"").toString() + "\"";
if (n.firstChild) {
s += ">";
for (var c=n.firstChild; c; c=c.nextSibling)
s += asXml(c);
s += "</"+n.nodeName+">";
}
else
s += "/>";
}
else if (n.nodeType == 3)
s += n.nodeValue;
else if (n.nodeType == 4)
s += "<![CDATA[" + n.nodeValue + "]]>";
return s;
};
for (var c=node.firstChild; c; c=c.nextSibling)
s += asXml(c);
}
return s;
},
escape: function(txt) {
return txt.replace(/[\\]/g, "\\\\")
.replace(/[\"]/g, '\\"')
.replace(/[\n]/g, '\\n')
.replace(/[\r]/g, '\\r');
},
removeWhite: function(e) {
e.normalize();
for (var n = e.firstChild; n; ) {
if (n.nodeType == 3) { // text node
if (!n.nodeValue.match(/[^ \f\n\r\t\v]/)) { // pure whitespace text node
var nxt = n.nextSibling;
e.removeChild(n);
n = nxt;
}
else
n = n.nextSibling;
}
else if (n.nodeType == 1) { // element node
X.removeWhite(n);
n = n.nextSibling;
}
else // any other node
n = n.nextSibling;
}
return e;
}
};
if (xml.nodeType == 9) // document node
xml = xml.documentElement;
var json_obj = X.toObj(X.removeWhite(xml)), json_str;
if (typeof(JSON)=='object' && jQuery.isFunction(JSON.stringify) && false) {
var obj = {}; obj[xml.nodeName] = json_obj;
json_str = JSON.stringify(obj);
return json_str;
} else {
json_str = X.toJson(json_obj, xml.nodeName, "");
return "{" + (tab ? json_str.replace(/\t/g, tab) : json_str.replace(/\t|\n/g, "")) + "}";
}
}
(function($){
/**
* @brief exec_xml
* @author NHN (developers@xpressengine.com)
**/
$.exec_xml = window.exec_xml = function(module, act, params, callback_func, response_tags, callback_func_arg, fo_obj) {
var xml_path = request_uri+"index.php"
if(!params) params = {};
// {{{ set parameters
if($.isArray(params)) params = arr2obj(params);
params['module'] = module;
params['act'] = act;
if(typeof(xeVid)!='undefined') params['vid'] = xeVid;
if(typeof(response_tags)=="undefined" || response_tags.length<1) response_tags = ['error','message'];
else {
response_tags.push('error', 'message');
}
// }}} set parameters
// use ssl?
if ($.isArray(ssl_actions) && params['act'] && $.inArray(params['act'], ssl_actions) >= 0)
{
var url = default_url || request_uri;
var port = window.https_port || 443;
var _ul = $('<a>').attr('href', url)[0];
var target = 'https://' + _ul.hostname.replace(/:\d+$/, '');
if(port != 443) target += ':'+port;
if(_ul.pathname[0] != '/') target += '/';
target += _ul.pathname;
xml_path = target.replace(/\/$/, '')+'/index.php';
}
var _u1 = $('<a>').attr('href', location.href)[0];
var _u2 = $('<a>').attr('href', xml_path)[0];
// url ajax call url schema port form
if(_u1.protocol != _u2.protocol || _u1.port != _u2.port) return send_by_form(xml_path, params);
var xml = [], i = 0;
xml[i++] = '<?xml version="1.0" encoding="utf-8" ?>';
xml[i++] = '<methodCall>';
xml[i++] = '<params>';
$.each(params, function(key, val) {
xml[i++] = '<'+key+'><![CDATA['+val+']]></'+key+'>';
});
xml[i++] = '</params>';
xml[i++] = '</methodCall>';
var _xhr = null;
if (_xhr && _xhr.readyState != 0) _xhr.abort();
function onsuccess(data, textStatus, xhr) {
var resp_xml = $(data).find('response')[0], resp_obj, txt='', ret=[], tags={}, json_str='';
waiting_obj.css('visibility', 'hidden');
if(!resp_xml) {
alert(_xhr.responseText);
return null;
}
json_str = xml2json(resp_xml, false, false);
resp_obj = (typeof(JSON)=='object' && $.isFunction(JSON.parse))?JSON.parse(json_str):eval('('+json_str+')');
resp_obj = resp_obj.response;
if (typeof(resp_obj)=='undefined') {
ret['error'] = -1;
ret['message'] = 'Unexpected error occured.';
try {
if(typeof(txt=resp_xml.childNodes[0].firstChild.data)!='undefined') ret['message'] += '\r\n'+txt;
} catch(e){};
return ret;
}
$.each(response_tags, function(key, val){ tags[val] = true; });
tags["redirect_url"] = true;
tags["act"] = true;
$.each(resp_obj, function(key, val){ if(tags[key]) ret[key] = val; });
if(ret['error'] != 0) {
if ($.isFunction($.exec_xml.onerror)) {
return $.exec_xml.onerror(module, act, ret, callback_func, response_tags, callback_func_arg, fo_obj);
}
alert(ret['message'] || 'error!');
return null;
}
if(ret['redirect_url']) {
location.href = ret['redirect_url'].replace(/&/g, '&');
return null;
}
if($.isFunction(callback_func)) callback_func(ret, response_tags, callback_func_arg, fo_obj);
}
// xml POST . try-catch
try {
$.ajax({
url : xml_path,
type : 'POST',
dataType : 'xml',
data : xml.join('\n'),
contentType : 'text/plain',
beforeSend : function(xhr){ _xhr = xhr; },
success : onsuccess,
error : function(xhr, textStatus) {
waiting_obj.css('visibility', 'hidden');
var msg = '';
if (textStatus == 'parsererror') {
msg = 'The result is not valid XML :\n
if(xhr.responseText == "") return;
msg += xhr.responseText.replace(/<[^>]+>/g, '');
} else {
msg = textStatus;
}
alert(msg);
}
});
} catch(e) {
alert(e);
return;
}
// ajax (show_waiting_message false )
var waiting_obj = $('#<API key>');
if(<API key> && waiting_obj.length) {
var d = $(document);
waiting_obj.html(waiting_message).css({
'top' : (d.scrollTop()+20)+'px',
'left' : (d.scrollLeft()+20)+'px',
'visibility' : 'visible'
});
}
}
function send_by_form(url, params) {
var frame_id = 'xeTmpIframe';
var form_id = 'xeVirtualForm';
if (!$('#'+frame_id).length) {
$('<iframe name="%id%" id="%id%" style="position:absolute;left:-1px;top:1px;width:1px;height:1px"></iframe>'.replace(/%id%/g, frame_id)).appendTo(document.body);
}
$('#'+form_id).remove();
var form = $('<form id="%id%"></form>'.replace(/%id%/g, form_id)).attr({
'id' : form_id,
'method' : 'post',
'action' : url,
'target' : frame_id
});
params['<API key>'] = 'xml';
params['xeRequestURI'] = location.href.replace(/
params['xeVirtualRequestUrl'] = request_uri;
$.each(params, function(key, value){
$('<input type="hidden">').attr('name', key).attr('value', value).appendTo(form);
});
form.appendTo(document.body).submit();
}
function arr2obj(arr) {
var ret = {};
for(var key in arr) {
if(arr.hasOwnProperty(key)) ret[key] = arr[key];
}
return ret;
}
/**
* @brief exec_json (exec_xml )
**/
$.exec_json = function(action,data,func){
if(typeof(data) == 'undefined') data = {};
action = action.split(".");
if(action.length == 2){
if(<API key>) {
$("#<API key>").html(waiting_message).css('top',$(document).scrollTop()+20).css('left',$(document).scrollLeft()+20).css('visibility','visible');
}
$.extend(data,{module:action[0],act:action[1]});
if(typeof(xeVid)!='undefined') $.extend(data,{vid:xeVid});
$.ajax({
type:"POST"
,dataType:"json"
,url:request_uri
,contentType:"application/json"
,data:$.param(data)
,success : function(data){
$("#<API key>").css('visibility','hidden');
if(data.error > 0) alert(data.message);
if($.isFunction(func)) func(data);
}
});
}
};
$.fn.exec_html = function(action,data,type,func,args){
if(typeof(data) == 'undefined') data = {};
if(!$.inArray(type, ['html','append','prepend'])) type = 'html';
var self = $(this);
action = action.split(".");
if(action.length == 2){
if(<API key>) {
$("#<API key>").html(waiting_message).css('top',$(document).scrollTop()+20).css('left',$(document).scrollLeft()+20).css('visibility','visible');
}
$.extend(data,{module:action[0],act:action[1]});
$.ajax({
type:"POST"
,dataType:"html"
,url:request_uri
,data:$.param(data)
,success : function(html){
$("#<API key>").css('visibility','hidden');
self[type](html);
if($.isFunction(func)) func(args);
}
});
}
};
})(jQuery);
|
package org.kore.runtime.jsf.converter;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;
import org.kore.runtime.person.Titel;
/**
*
* @author Konrad Renner
*/
@FacesConverter(value = "CurrencyConverter")
public class TitelConverter implements Converter {
@Override
public Titel getAsObject(FacesContext fc, UIComponent uic, String string) {
if (string == null || string.trim().length() == 0) {
return null;
}
return new Titel(string.trim());
}
@Override
public String getAsString(FacesContext fc, UIComponent uic, Object o) {
if (o == null) {
return null;
}
if (o instanceof Titel) {
return ((Titel) o).getValue();
}
throw new <API key>("Given object is not a org.kore.runtime.person.Titel");
}
}
|
#!/bin/bash
# <API key>: LGPL-2.0-or-later
set -euo pipefail
. $(dirname $0)/libtest.sh
skip_without_bwrap
echo "1..16"
setup_repo
install_repo
cp -a "$G_TEST_BUILDDIR/try-syscall" "$test_tmpdir/try-syscall"
# How this works:
# try-syscall tries to make various syscalls, some benign, some not.
# The parameters are chosen to make them fail with EBADF or EFAULT if
# not blocked. If they are blocked, we get ENOSYS or EPERM. If the syscall
# is impossible for a particular architecture, we get ENOENT.
# The exit status is an errno value, which we can compare with the expected
# errno value.
eval "$("$test_tmpdir/try-syscall" print-errno-values)"
try_syscall () {
${FLATPAK} run \
--filesystem="$test_tmpdir" \
--command="$test_tmpdir/try-syscall" \
$extra_argv \
org.test.Hello "$@"
}
for extra_argv in "" "--allow=multiarch"; do
echo "# testing with extra argv: '$extra_argv'"
echo "# chmod (benign)"
e=0
try_syscall chmod || e="$?"
assert_streq "$e" "$EFAULT"
ok "chmod not blocked"
echo "# chroot (harmful)"
e=0
try_syscall chroot || e="$?"
assert_streq "$e" "$EPERM"
ok "chroot blocked with EPERM"
echo "# clone3 (harmful)"
e=0
try_syscall clone3 || e="$?"
# This is either ENOSYS because the kernel genuinely doesn't implement it,
# or because we successfully blocked it. We can't tell which.
assert_streq "$e" "$ENOSYS"
ok "clone3 blocked with ENOSYS (CVE-2021-41133)"
echo "# ioctl TIOCNOTTY (benign)"
e=0
try_syscall "ioctl TIOCNOTTY" || e="$?"
assert_streq "$e" "$EBADF"
ok "ioctl TIOCNOTTY not blocked"
echo "# ioctl TIOCSTI (CVE-2017-5226)"
e=0
try_syscall "ioctl TIOCSTI" || e="$?"
assert_streq "$e" "$EPERM"
ok "ioctl TIOCSTI blocked (CVE-2017-5226)"
echo "# ioctl TIOCSTI (trying to repeat CVE-2019-10063)"
e=0
try_syscall "ioctl TIOCSTI CVE-2019-10063" || e="$?"
if test "$e" = "$ENOENT"; then
echo "ok # SKIP Cannot replicate CVE-2019-10063 on 32-bit architecture"
else
assert_streq "$e" "$EPERM"
ok "ioctl TIOCSTI with high bits blocked (CVE-2019-10063)"
fi
echo "# listen (benign)"
e=0
try_syscall "listen" || e="$?"
assert_streq "$e" "$EBADF"
ok "listen not blocked"
echo "# prctl (benign)"
e=0
try_syscall "prctl" || e="$?"
assert_streq "$e" "$EFAULT"
ok "prctl not blocked"
done
|
/** include section **/
#include <cstl/cstl_def.h>
#include <cstl/cstl_alloc.h>
#include <cstl/cstl_types.h>
#include <cstl/citerator.h>
#include <cstl/cstring.h>
#include <cstl/<API key>.h>
#include <cstl/<API key>.h>
#include <cstl/cstl_rb_tree.h>
#include "cstl_rb_tree_aux.h"
/** local constant declaration and local macro section **/
/** local data type declaration and local struct, union, enum section **/
/** local function prototype section **/
/** exported global variable definition section **/
/** local global variable definition section **/
/** exported function implementation section **/
/**
* Create rb tree container.
*/
_rb_tree_t* _create_rb_tree(const char* s_typename)
{
_rb_tree_t* pt_rb_tree = NULL;
if ((pt_rb_tree = (_rb_tree_t*)malloc(sizeof(_rb_tree_t))) == NULL) {
return NULL;
}
if (!<API key>(pt_rb_tree, s_typename)) {
free(pt_rb_tree);
return NULL;
}
return pt_rb_tree;
}
/**
* Initialize rb tree container.
*/
void _rb_tree_init(_rb_tree_t* pt_rb_tree, bfun_t t_compare)
{
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_created(pt_rb_tree));
pt_rb_tree->_t_rbroot._pt_left = &pt_rb_tree->_t_rbroot;
pt_rb_tree->_t_rbroot._pt_right = &pt_rb_tree->_t_rbroot;
pt_rb_tree->_t_compare = t_compare != NULL ? t_compare : <API key>(pt_rb_tree);
}
/**
* Destroy rb tree.
*/
void _rb_tree_destroy(_rb_tree_t* pt_rb_tree)
{
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree) || _rb_tree_is_created(pt_rb_tree));
<API key>(pt_rb_tree);
free(pt_rb_tree);
}
/**
* Initialize rb tree container with rb tree.
*/
void _rb_tree_init_copy(_rb_tree_t* pt_dest, const _rb_tree_t* cpt_src)
{
_rb_tree_iterator_t it_iter;
_rb_tree_iterator_t it_begin;
_rb_tree_iterator_t it_end;
assert(pt_dest != NULL);
assert(cpt_src != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(_rb_tree_is_inited(cpt_src));
assert(_rb_tree_same_type(pt_dest, cpt_src));
_rb_tree_init(pt_dest, cpt_src->_t_compare);
it_begin = _rb_tree_begin(cpt_src);
it_end = _rb_tree_end(cpt_src);
for (it_iter = it_begin;
!<API key>(it_iter, it_end);
it_iter = <API key>(it_iter)) {
<API key>(pt_dest, <API key>(it_iter));
}
}
/**
* Initialize rb tree container with specific range.
*/
void <API key>(_rb_tree_t* pt_dest, iterator_t it_begin, iterator_t it_end)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(<API key>(pt_dest, it_begin));
assert(<API key>(pt_dest, it_end));
assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end));
_rb_tree_init(pt_dest, NULL);
<API key>(pt_dest, it_begin, it_end);
}
/**
* Initialize rb tree container with specific range.
*/
void <API key>(_rb_tree_t* pt_dest, iterator_t it_begin, iterator_t it_end)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(<API key>(pt_dest, it_begin));
assert(<API key>(pt_dest, it_end));
assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end));
_rb_tree_init(pt_dest, NULL);
<API key>(pt_dest, it_begin, it_end);
}
/**
* Initialize rb tree container with specific array.
*/
void <API key>(_rb_tree_t* pt_dest, const void* cpv_array, size_t t_count)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(cpv_array != NULL);
_rb_tree_init(pt_dest, NULL);
<API key>(pt_dest, cpv_array, t_count);
}
/**
* Initialize rb tree container with specific array.
*/
void <API key>(_rb_tree_t* pt_dest, const void* cpv_array, size_t t_count)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(cpv_array != NULL);
_rb_tree_init(pt_dest, NULL);
<API key>(pt_dest, cpv_array, t_count);
}
/**
* Initialize rb tree container with specific range and compare function.
*/
void <API key>(
_rb_tree_t* pt_dest, iterator_t it_begin, iterator_t it_end, bfun_t t_compare)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(<API key>(pt_dest, it_begin));
assert(<API key>(pt_dest, it_end));
assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end));
_rb_tree_init(pt_dest, t_compare);
<API key>(pt_dest, it_begin, it_end);
}
/**
* Initialize rb tree container with specific range and compare function.
*/
void <API key>(
_rb_tree_t* pt_dest, iterator_t it_begin, iterator_t it_end, bfun_t t_compare)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(<API key>(pt_dest, it_begin));
assert(<API key>(pt_dest, it_end));
assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end));
_rb_tree_init(pt_dest, t_compare);
<API key>(pt_dest, it_begin, it_end);
}
/**
* Initialize rb tree container with specific array and compare function.
*/
void <API key>(
_rb_tree_t* pt_dest, const void* cpv_array, size_t t_count, bfun_t t_compare)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(cpv_array != NULL);
_rb_tree_init(pt_dest, t_compare);
<API key>(pt_dest, cpv_array, t_count);
}
/**
* Initialize rb tree container with specific array and compare function.
*/
void <API key>(
_rb_tree_t* pt_dest, const void* cpv_array, size_t t_count, bfun_t t_compare)
{
assert(pt_dest != NULL);
assert(_rb_tree_is_created(pt_dest));
assert(cpv_array != NULL);
_rb_tree_init(pt_dest, t_compare);
<API key>(pt_dest, cpv_array, t_count);
}
/**
* Assign rb tree container.
*/
void _rb_tree_assign(_rb_tree_t* pt_dest, const _rb_tree_t* cpt_src)
{
assert(pt_dest != NULL);
assert(cpt_src != NULL);
assert(_rb_tree_is_inited(pt_dest));
assert(_rb_tree_is_inited(cpt_src));
assert(<API key>(pt_dest, cpt_src));
if (!_rb_tree_equal(pt_dest, cpt_src)) {
_rb_tree_iterator_t it_iter;
_rb_tree_iterator_t it_begin;
_rb_tree_iterator_t it_end;
/* clear dest rb tree */
_rb_tree_clear(pt_dest);
it_begin = _rb_tree_begin(cpt_src);
it_end = _rb_tree_end(cpt_src);
/* insert all elements of src into dest */
for (it_iter = it_begin;
!<API key>(it_iter, it_end);
it_iter = <API key>(it_iter)) {
<API key>(pt_dest, <API key>(it_iter));
}
}
}
/**
* Test if an rb tree is empty.
*/
bool_t _rb_tree_empty(const _rb_tree_t* cpt_rb_tree)
{
assert(cpt_rb_tree != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
return cpt_rb_tree->_t_nodecount == 0 ? true : false;
}
/**
* Get the number of elements int the rb tree.
*/
size_t _rb_tree_size(const _rb_tree_t* cpt_rb_tree)
{
assert(cpt_rb_tree != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
return cpt_rb_tree->_t_nodecount;
}
/**
* Get the maximum number of elements int the rb tree.
*/
size_t _rb_tree_max_size(const _rb_tree_t* cpt_rb_tree)
{
assert(cpt_rb_tree != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
return (size_t)(-1) / <API key>(cpt_rb_tree);
}
/**
* Return an iterator that addresses the first element in the rb tree.
*/
_rb_tree_iterator_t _rb_tree_begin(const _rb_tree_t* cpt_rb_tree)
{
_rb_tree_iterator_t it_begin = <API key>();
assert(cpt_rb_tree != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
<API key>(it_begin) = (void*)cpt_rb_tree;
<API key>(it_begin) = (_byte_t*)cpt_rb_tree->_t_rbroot._pt_left;
return it_begin;
}
/**
* Return an iterator that addresses the location succeeding the last element in the rb tree.
*/
_rb_tree_iterator_t _rb_tree_end(const _rb_tree_t* cpt_rb_tree)
{
_rb_tree_iterator_t it_end = <API key>();
assert(cpt_rb_tree != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
<API key>(it_end) = (void*)cpt_rb_tree;
<API key>(it_end) = (_byte_t*)&cpt_rb_tree->_t_rbroot;
return it_end;
}
_rb_tree_iterator_t _rb_tree_rend(const _rb_tree_t* cpt_rb_tree)
{
_rb_tree_iterator_t it_newiterator = <API key>();
assert(cpt_rb_tree != NULL);
<API key>(it_newiterator) = (void*)cpt_rb_tree;
<API key>(it_newiterator) = (_byte_t*)&cpt_rb_tree->_t_rbroot;
return it_newiterator;
}
_rb_tree_iterator_t _rb_tree_rbegin(const _rb_tree_t* cpt_rb_tree)
{
_rb_tree_iterator_t it_newiterator = <API key>();
assert(cpt_rb_tree != NULL);
<API key>(it_newiterator) = (void*)cpt_rb_tree;
<API key>(it_newiterator) = (_byte_t*)cpt_rb_tree->_t_rbroot._pt_right;
return it_newiterator;
}
/**
* Return the compare function of key.
*/
bfun_t _rb_tree_key_comp(const _rb_tree_t* cpt_rb_tree)
{
assert(cpt_rb_tree != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
return cpt_rb_tree->_t_compare;
}
/**
* Find specific element.
*/
_rb_tree_iterator_t _rb_tree_find(const _rb_tree_t* cpt_rb_tree, const void* cpv_value)
{
_rb_tree_iterator_t it_iter;
assert(cpt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
<API key>(it_iter) = (void*)cpt_rb_tree;
<API key>(it_iter) = (_byte_t*)_rb_tree_find_value(
cpt_rb_tree, cpt_rb_tree->_t_rbroot._pt_parent, cpv_value);
if (<API key>(it_iter) == NULL) {
<API key>(it_iter) = (_byte_t*)&cpt_rb_tree->_t_rbroot;
}
return it_iter;
}
/**
* Erases all the elements of an rb tree.
*/
void _rb_tree_clear(_rb_tree_t* pt_rb_tree)
{
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
pt_rb_tree->_t_rbroot._pt_parent = <API key>(pt_rb_tree, pt_rb_tree->_t_rbroot._pt_parent);
assert(pt_rb_tree->_t_rbroot._pt_parent == NULL);
pt_rb_tree->_t_rbroot._pt_left = &pt_rb_tree->_t_rbroot;
pt_rb_tree->_t_rbroot._pt_right = &pt_rb_tree->_t_rbroot;
pt_rb_tree->_t_nodecount = 0;
}
/**
* Tests if the two rb tree are equal.
*/
bool_t _rb_tree_equal(const _rb_tree_t* cpt_first, const _rb_tree_t* cpt_second)
{
_rb_tree_iterator_t it_first;
_rb_tree_iterator_t it_first_begin;
_rb_tree_iterator_t it_first_end;
_rb_tree_iterator_t it_second;
_rb_tree_iterator_t it_second_begin;
_rb_tree_iterator_t it_second_end;
bool_t b_less = false;
bool_t b_greater = false;
assert(cpt_first != NULL);
assert(cpt_second != NULL);
assert(_rb_tree_is_inited(cpt_first));
assert(_rb_tree_is_inited(cpt_second));
assert(<API key>(cpt_first, cpt_second));
if (cpt_first == cpt_second) {
return true;
}
/* test rb tree size */
if (_rb_tree_size(cpt_first) != _rb_tree_size(cpt_second)) {
return false;
}
it_first_begin = _rb_tree_begin(cpt_first);
it_first_end = _rb_tree_end(cpt_first);
it_second_begin = _rb_tree_begin(cpt_second);
it_second_end = _rb_tree_end(cpt_second);
/* test each element */
for (it_first = it_first_begin, it_second = it_second_begin;
!<API key>(it_first, it_first_end) && !<API key>(it_second, it_second_end);
it_first = <API key>(it_first), it_second = <API key>(it_second)) {
b_less = b_greater = <API key>(cpt_first);
<API key>(cpt_first)(
((_rbnode_t*)<API key>(it_first))->_pby_data,
((_rbnode_t*)<API key>(it_second))->_pby_data, &b_less);
<API key>(cpt_first)(
((_rbnode_t*)<API key>(it_second))->_pby_data,
((_rbnode_t*)<API key>(it_first))->_pby_data, &b_greater);
if (b_less || b_greater) {
return false;
}
}
assert(<API key>(it_first, it_first_end) && <API key>(it_second, it_second_end));
return true;
}
/**
* Tests if the two rb tree are not equal.
*/
bool_t _rb_tree_not_equal(const _rb_tree_t* cpt_first, const _rb_tree_t* cpt_second)
{
return !_rb_tree_equal(cpt_first, cpt_second);
}
/**
* Tests if the first rb tree is less than the second rb tree.
*/
bool_t _rb_tree_less(const _rb_tree_t* cpt_first, const _rb_tree_t* cpt_second)
{
_rb_tree_iterator_t it_first;
_rb_tree_iterator_t it_first_begin;
_rb_tree_iterator_t it_first_end;
_rb_tree_iterator_t it_second;
_rb_tree_iterator_t it_second_begin;
_rb_tree_iterator_t it_second_end;
bool_t b_result = false;
assert(cpt_first != NULL);
assert(cpt_second != NULL);
assert(_rb_tree_is_inited(cpt_first));
assert(_rb_tree_is_inited(cpt_second));
assert(<API key>(cpt_first, cpt_second));
it_first_begin = _rb_tree_begin(cpt_first);
it_first_end = _rb_tree_end(cpt_first);
it_second_begin = _rb_tree_begin(cpt_second);
it_second_end = _rb_tree_end(cpt_second);
/* test each element */
for (it_first = it_first_begin, it_second = it_second_begin;
!<API key>(it_first, it_first_end) && !<API key>(it_second, it_second_end);
it_first = <API key>(it_first), it_second = <API key>(it_second)) {
b_result = <API key>(cpt_first);
<API key>(cpt_first)(
((_rbnode_t*)<API key>(it_first))->_pby_data,
((_rbnode_t*)<API key>(it_second))->_pby_data, &b_result);
if (b_result) {
return true;
}
b_result = <API key>(cpt_first);
<API key>(cpt_first)(
((_rbnode_t*)<API key>(it_second))->_pby_data,
((_rbnode_t*)<API key>(it_first))->_pby_data, &b_result);
if (b_result) {
return false;
}
}
return _rb_tree_size(cpt_first) < _rb_tree_size(cpt_second) ? true : false;
}
/**
* Tests if the first rb tree is less than or equal to the second rb tree.
*/
bool_t _rb_tree_less_equal(const _rb_tree_t* cpt_first, const _rb_tree_t* cpt_second)
{
return (_rb_tree_less(cpt_first, cpt_second) || _rb_tree_equal(cpt_first, cpt_second)) ? true : false;
}
/**
* Tests if the first rb tree is greater than the second rb tree.
*/
bool_t _rb_tree_greater(const _rb_tree_t* cpt_first, const _rb_tree_t* cpt_second)
{
return _rb_tree_less(cpt_second, cpt_first);
}
/**
* Tests if the first rb tree is greater than or equal to the second rb tree.
*/
bool_t <API key>(const _rb_tree_t* cpt_first, const _rb_tree_t* cpt_second)
{
return (_rb_tree_greater(cpt_first, cpt_second) || _rb_tree_equal(cpt_first, cpt_second)) ? true : false;
}
/**
* Swap the datas of first rb_tree and second rb_tree.
*/
void _rb_tree_swap(_rb_tree_t* pt_first, _rb_tree_t* pt_second)
{
_rb_tree_t t_temp;
assert(pt_first != NULL);
assert(pt_second != NULL);
assert(_rb_tree_is_inited(pt_first));
assert(_rb_tree_is_inited(pt_second));
assert(<API key>(pt_first, pt_second));
if (_rb_tree_equal(pt_first, pt_second)) {
return;
}
t_temp = *pt_first;
*pt_first = *pt_second;
*pt_second = t_temp;
if (_rb_tree_empty(pt_first)) {
pt_first->_t_rbroot._pt_left = &pt_first->_t_rbroot;
pt_first->_t_rbroot._pt_right = &pt_first->_t_rbroot;
} else {
pt_first->_t_rbroot._pt_parent->_pt_parent = &pt_first->_t_rbroot;
}
if (_rb_tree_empty(pt_second)) {
pt_second->_t_rbroot._pt_left = &pt_second->_t_rbroot;
pt_second->_t_rbroot._pt_right = &pt_second->_t_rbroot;
} else {
pt_second->_t_rbroot._pt_parent->_pt_parent = &pt_second->_t_rbroot;
}
}
/**
* Return the number of specific elements in an rb tree
*/
size_t _rb_tree_count(const _rb_tree_t* cpt_rb_tree, const void* cpv_value)
{
range_t r_range;
assert(cpt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
r_range = <API key>(cpt_rb_tree, cpv_value);
return abs(<API key>(r_range.it_begin, r_range.it_end));
}
/**
* Return an iterator to the first element that is equal to or greater than a specific element.
*/
_rb_tree_iterator_t <API key>(const _rb_tree_t* cpt_rb_tree, const void* cpv_value)
{
_rbnode_t* pt_cur = NULL;
_rbnode_t* pt_prev = NULL;
_rb_tree_iterator_t it_iter;
bool_t b_less = false;
bool_t b_greater = false;
assert(cpt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
it_iter = <API key>();
<API key>(it_iter) = (void*)cpt_rb_tree;
if (!_rb_tree_empty(cpt_rb_tree)) {
pt_prev = cpt_rb_tree->_t_rbroot._pt_parent;
b_less = b_greater = <API key>(cpt_rb_tree);
<API key>(cpt_rb_tree, cpv_value, pt_prev->_pby_data, &b_less);
<API key>(cpt_rb_tree, pt_prev->_pby_data, cpv_value, &b_greater);
pt_cur = (b_less || !b_greater) ? pt_prev->_pt_left : pt_prev->_pt_right;
while (pt_cur != NULL) {
pt_prev = pt_cur;
b_less = b_greater = <API key>(cpt_rb_tree);
<API key>(cpt_rb_tree, cpv_value, pt_prev->_pby_data, &b_less);
<API key>(cpt_rb_tree, pt_prev->_pby_data, cpv_value, &b_greater);
pt_cur = (b_less || !b_greater) ? pt_prev->_pt_left : pt_prev->_pt_right;
}
if (b_less || !b_greater) {
assert(pt_prev->_pt_left == NULL);
<API key>(it_iter) = (_byte_t*)pt_prev;
assert(<API key>(cpt_rb_tree, it_iter));
} else {
assert(pt_prev->_pt_right == NULL);
<API key>(it_iter) = (_byte_t*)pt_prev;
it_iter = <API key>(it_iter);
}
} else {
it_iter = _rb_tree_end(cpt_rb_tree);
}
return it_iter;
}
/**
* Return an iterator to the first element that is greater than a specific element.
*/
_rb_tree_iterator_t <API key>(const _rb_tree_t* cpt_rb_tree, const void* cpv_value)
{
_rbnode_t* pt_cur = NULL;
_rbnode_t* pt_prev = NULL;
_rb_tree_iterator_t it_iter;
bool_t b_result = false;
assert(cpt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
it_iter = <API key>();
<API key>(it_iter) = (void*)cpt_rb_tree;
if (!_rb_tree_empty(cpt_rb_tree)) {
pt_prev = cpt_rb_tree->_t_rbroot._pt_parent;
b_result = <API key>(cpt_rb_tree);
<API key>(cpt_rb_tree, cpv_value, pt_prev->_pby_data, &b_result);
pt_cur = b_result ? pt_prev->_pt_left : pt_prev->_pt_right;
while (pt_cur != NULL) {
pt_prev = pt_cur;
b_result = <API key>(cpt_rb_tree);
<API key>(cpt_rb_tree, cpv_value, pt_prev->_pby_data, &b_result);
pt_cur = b_result ? pt_prev->_pt_left : pt_prev->_pt_right;
}
if (b_result) {
assert(pt_prev->_pt_left == NULL);
<API key>(it_iter) = (_byte_t*)pt_prev;
assert(<API key>(cpt_rb_tree, it_iter));
} else {
assert(pt_prev->_pt_right == NULL);
<API key>(it_iter) = (_byte_t*)pt_prev;
it_iter = <API key>(it_iter);
}
} else {
it_iter = _rb_tree_end(cpt_rb_tree);
}
return it_iter;
}
/**
* Return an iterator range that is equal to a specific element.
*/
range_t <API key>(const _rb_tree_t* cpt_rb_tree, const void* cpv_value)
{
range_t r_range;
assert(cpt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(cpt_rb_tree));
r_range.it_begin = <API key>(cpt_rb_tree, cpv_value);
r_range.it_end = <API key>(cpt_rb_tree, cpv_value);
return r_range;
}
/**
* Inserts an element into a rb tree.
*/
_rb_tree_iterator_t <API key>(_rb_tree_t* pt_rb_tree, const void* cpv_value)
{
_rb_tree_iterator_t it_iter = <API key>();
assert(pt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
<API key>(it_iter) = pt_rb_tree;
<API key>(it_iter) = (_byte_t*)<API key>(pt_rb_tree, cpv_value);
pt_rb_tree->_t_rbroot._pt_left = <API key>(pt_rb_tree->_t_rbroot._pt_parent);
pt_rb_tree->_t_rbroot._pt_right = <API key>(pt_rb_tree->_t_rbroot._pt_parent);
pt_rb_tree->_t_nodecount++;
return it_iter;
}
/**
* Inserts an unique element into a rb tree.
*/
_rb_tree_iterator_t <API key>(_rb_tree_t* pt_rb_tree, const void* cpv_value)
{
assert(pt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
/* if the rb tree is empty */
if (_rb_tree_empty(pt_rb_tree)) {
return <API key>(pt_rb_tree, cpv_value);
} else {
/* find value in rb tree */
_rb_tree_iterator_t it_iter = _rb_tree_find(pt_rb_tree, cpv_value);
/* if the value is exist */
if (!<API key>(it_iter, _rb_tree_end(pt_rb_tree))) {
return _rb_tree_end(pt_rb_tree);
} else {
/* insert value into rb tree */
return <API key>(pt_rb_tree, cpv_value);
}
}
}
/**
* Inserts an range into a rb tree.
*/
void <API key>(_rb_tree_t* pt_rb_tree, iterator_t it_begin, iterator_t it_end)
{
iterator_t it_iter;
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
assert(<API key>(pt_rb_tree, it_begin));
assert(<API key>(pt_rb_tree, it_end));
assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end));
for (it_iter = it_begin; !iterator_equal(it_iter, it_end); it_iter = iterator_next(it_iter)) {
<API key>(pt_rb_tree, <API key>(it_iter));
}
}
/**
* Inserts an array into a rb tree.
*/
void <API key>(_rb_tree_t* pt_rb_tree, const void* cpv_array, size_t t_count)
{
size_t i = 0;
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
assert(cpv_array != NULL);
/*
* Copy the elements from src array to dest rb tree.
* The array of c builtin and user define or cstl builtin are different,
* the elements of c builtin array are element itself, but the elements of
* c string, user define or cstl are pointer of element.
*/
if (strncmp(<API key>(pt_rb_tree), _C_STRING_TYPE, _TYPE_NAME_SIZE) == 0) {
/*
* We need built a string_t for c string element.
*/
string_t* pstr_elem = create_string();
assert(pstr_elem != NULL);
string_init(pstr_elem);
for (i = 0; i < t_count; ++i) {
string_assign_cstr(pstr_elem, *((const char**)cpv_array + i));
<API key>(pt_rb_tree, pstr_elem);
}
string_destroy(pstr_elem);
} else if (<API key>(pt_rb_tree) == _TYPE_C_BUILTIN) {
for (i = 0; i < t_count; ++i) {
<API key>(pt_rb_tree, (unsigned char*)cpv_array + i * <API key>(pt_rb_tree));
}
} else {
for (i = 0; i < t_count; ++i) {
<API key>(pt_rb_tree, *((void**)cpv_array + i));
}
}
}
/**
* Inserts an range of unique element into a rb tree.
*/
void <API key>(_rb_tree_t* pt_rb_tree, iterator_t it_begin, iterator_t it_end)
{
iterator_t it_iter;
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
assert(<API key>(pt_rb_tree, it_begin));
assert(<API key>(pt_rb_tree, it_end));
assert(iterator_equal(it_begin, it_end) || _iterator_before(it_begin, it_end));
for (it_iter = it_begin; !iterator_equal(it_iter, it_end); it_iter = iterator_next(it_iter)) {
<API key>(pt_rb_tree, <API key>(it_iter));
}
}
/**
* Inserts an array of unique element into a rb tree.
*/
void <API key>(_rb_tree_t* pt_rb_tree, const void* cpv_array, size_t t_count)
{
size_t i = 0;
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
assert(cpv_array != NULL);
/*
* Copy the elements from src array to dest rb tree.
* The array of c builtin and user define or cstl builtin are different,
* the elements of c builtin array are element itself, but the elements of
* c string, user define or cstl are pointer of element.
*/
if (strncmp(<API key>(pt_rb_tree), _C_STRING_TYPE, _TYPE_NAME_SIZE) == 0) {
/*
* We need built a string_t for c string element.
*/
string_t* pstr_elem = create_string();
assert(pstr_elem != NULL);
string_init(pstr_elem);
for (i = 0; i < t_count; ++i) {
string_assign_cstr(pstr_elem, *((const char**)cpv_array + i));
<API key>(pt_rb_tree, pstr_elem);
}
string_destroy(pstr_elem);
} else if (<API key>(pt_rb_tree) == _TYPE_C_BUILTIN) {
for (i = 0; i < t_count; ++i) {
<API key>(pt_rb_tree, (unsigned char*)cpv_array + i * <API key>(pt_rb_tree));
}
} else {
for (i = 0; i < t_count; ++i) {
<API key>(pt_rb_tree, *((void**)cpv_array + i));
}
}
}
/*
* Erase an element in an rb tree from specificed position.
*/
void _rb_tree_erase_pos(_rb_tree_t* pt_rb_tree, _rb_tree_iterator_t it_pos)
{
_rbnode_t* pt_parent = NULL;
_rbnode_t* pt_cur = NULL;
_rbnode_t* pt_parenttmp = NULL;
_rbnode_t* pt_curtmp = NULL;
_color_t t_colortmp; /* temporary color for deletion */
bool_t b_result = false;
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
assert(<API key>(pt_rb_tree, it_pos));
assert(!<API key>(it_pos, _rb_tree_end(pt_rb_tree)));
pt_cur = (_rbnode_t*)<API key>(it_pos);
pt_parent = pt_cur->_pt_parent;
/* delete the current node pointted by it_pos */
if (pt_cur == pt_parent->_pt_parent) {
assert(pt_cur == pt_rb_tree->_t_rbroot._pt_parent);
if (pt_cur->_pt_left == NULL && pt_cur->_pt_right == NULL) {
/*
* p p
* | =>
* c
*/
pt_parent->_pt_parent = NULL;
} else if (pt_cur->_pt_left != NULL && pt_cur->_pt_right == NULL) {
/*
* p p
* | |
* c => l
* /
* l
*/
pt_parent->_pt_parent = pt_cur->_pt_left;
pt_parent->_pt_parent->_pt_parent = pt_parent;
pt_parent->_pt_parent->_t_color = _COLOR_BLACK;
} else if (pt_cur->_pt_left == NULL && pt_cur->_pt_right != NULL) {
/*
* p p
* | |
* c => r
* \
* r
*/
pt_parent->_pt_parent = pt_cur->_pt_right;
pt_parent->_pt_parent->_pt_parent = pt_parent;
pt_parent->_pt_parent->_t_color = _COLOR_BLACK;
} else {
/*
* here the real deleted node is pt_curtmp, so the
* color of pt_curtmp is used.
*/
pt_curtmp = <API key>(pt_cur->_pt_right);
t_colortmp = pt_curtmp->_t_color;
if (pt_cur == pt_curtmp->_pt_parent) {
/*
* p p
* | |
* c => r
* / \ / \
* l r l rr
* \
* rr
*/
pt_curtmp->_pt_left = pt_cur->_pt_left;
pt_curtmp->_pt_left->_pt_parent = pt_curtmp;
pt_curtmp->_pt_parent = pt_cur->_pt_parent;
pt_curtmp->_pt_parent->_pt_parent = pt_curtmp;
pt_curtmp->_t_color = pt_cur->_t_color;
pt_cur->_t_color = t_colortmp;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_curtmp->_pt_right, pt_curtmp);
}
} else {
/*
* p p
* | |
* c => rll
* / \ / \
* l r l r
* / \ / \
* rl rr rl rr
* / \ \ \ \
* rll rlr rrr rlr rrr
*/
pt_parenttmp = pt_curtmp->_pt_parent;
pt_parenttmp->_pt_left = pt_curtmp->_pt_right;
if (pt_parenttmp->_pt_left != NULL) {
pt_parenttmp->_pt_left->_pt_parent = pt_parenttmp;
}
pt_curtmp->_pt_left = pt_cur->_pt_left;
pt_curtmp->_pt_left->_pt_parent = pt_curtmp;
pt_curtmp->_pt_right = pt_cur->_pt_right;
pt_curtmp->_pt_right->_pt_parent = pt_curtmp;
pt_curtmp->_pt_parent = pt_cur->_pt_parent;
pt_curtmp->_pt_parent->_pt_parent = pt_curtmp;
pt_curtmp->_t_color = pt_cur->_t_color;
pt_cur->_t_color = t_colortmp;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parenttmp->_pt_left, pt_parenttmp);
}
}
}
} else if (pt_cur == pt_parent->_pt_left) {
if (pt_cur->_pt_left == NULL && pt_cur->_pt_right == NULL) {
/*
* p p
* / =>
* c
*/
pt_parent->_pt_left = NULL;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parent->_pt_left, pt_parent);
}
} else if (pt_cur->_pt_left != NULL && pt_cur->_pt_right == NULL) {
/*
* p p
* / /
* c => l
* /
* l
*/
pt_parent->_pt_left = pt_cur->_pt_left;
pt_parent->_pt_left->_pt_parent = pt_parent;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parent->_pt_left, pt_parent);
}
} else if (pt_cur->_pt_left == NULL && pt_cur->_pt_right != NULL) {
/*
* p p
* / /
* c => r
* \
* r
*/
pt_parent->_pt_left = pt_cur->_pt_right;
pt_parent->_pt_left->_pt_parent = pt_parent;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parent->_pt_left, pt_parent);
}
} else {
/*
* here the real deleted node is pt_curtmp, so the
* color of pt_curtmp is used.
*/
pt_curtmp = <API key>(pt_cur->_pt_right);
t_colortmp = pt_curtmp->_t_color;
if (pt_cur == pt_curtmp->_pt_parent) {
/*
* p p
* / /
* c => r
* / \ / \
* l r l rr
* \
* rr
*/
pt_curtmp->_pt_left = pt_cur->_pt_left;
pt_curtmp->_pt_left->_pt_parent = pt_curtmp;
pt_curtmp->_pt_parent = pt_cur->_pt_parent;
pt_curtmp->_pt_parent->_pt_left = pt_curtmp;
pt_curtmp->_t_color = pt_cur->_t_color;
pt_cur->_t_color = t_colortmp;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_curtmp->_pt_right, pt_curtmp);
}
} else {
/*
* p p
* / /
* c => rll
* / \ / \
* l r l r
* / \ / \
* rl rr rl rr
* / \ \ \ \
* rll rlr rrr rlr rrr
*/
pt_parenttmp = pt_curtmp->_pt_parent;
pt_parenttmp->_pt_left = pt_curtmp->_pt_right;
if (pt_parenttmp->_pt_left != NULL) {
pt_parenttmp->_pt_left->_pt_parent = pt_parenttmp;
}
pt_curtmp->_pt_left = pt_cur->_pt_left;
pt_curtmp->_pt_left->_pt_parent = pt_curtmp;
pt_curtmp->_pt_right = pt_cur->_pt_right;
pt_curtmp->_pt_right->_pt_parent = pt_curtmp;
pt_curtmp->_pt_parent = pt_cur->_pt_parent;
pt_curtmp->_pt_parent->_pt_left = pt_curtmp;
pt_curtmp->_t_color = pt_cur->_t_color;
pt_cur->_t_color = t_colortmp;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parenttmp->_pt_left, pt_parenttmp);
}
}
}
} else {
if (pt_cur->_pt_left == NULL && pt_cur->_pt_right == NULL) {
/*
* p p
* \ =>
* c
*/
pt_parent->_pt_right = NULL;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parent->_pt_right, pt_parent);
}
} else if (pt_cur->_pt_left != NULL && pt_cur->_pt_right == NULL) {
/*
* p p
* \ \
* c => l
* /
* l
*/
pt_parent->_pt_right = pt_cur->_pt_left;
pt_parent->_pt_right->_pt_parent = pt_parent;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parent->_pt_right, pt_parent);
}
} else if (pt_cur->_pt_left == NULL && pt_cur->_pt_right != NULL) {
/*
* p p
* \ \
* c => r
* \
* r
*/
pt_parent->_pt_right = pt_cur->_pt_right;
pt_parent->_pt_right->_pt_parent = pt_parent;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parent->_pt_right, pt_parent);
}
} else {
/*
* here the real deleted node is pt_curtmp, so the
* color of pt_curtmp is used.
*/
pt_curtmp = <API key>(pt_cur->_pt_right);
t_colortmp = pt_curtmp->_t_color;
if (pt_cur == pt_curtmp->_pt_parent) {
/*
* p p
* \ \
* c => r
* / \ / \
* l r l rr
* \
* rr
*/
pt_curtmp->_pt_left = pt_cur->_pt_left;
pt_curtmp->_pt_left->_pt_parent = pt_curtmp;
pt_curtmp->_pt_parent = pt_cur->_pt_parent;
pt_curtmp->_pt_parent->_pt_right = pt_curtmp;
pt_curtmp->_t_color = pt_cur->_t_color;
pt_cur->_t_color = t_colortmp;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_curtmp->_pt_right, pt_curtmp);
}
} else {
/*
* p p
* \ \
* c => rll
* / \ / \
* l r l r
* / \ / \
* rl rr rl rr
* / \ \ \ \
* rll rlr rrr rlr rrr
*/
pt_parenttmp = pt_curtmp->_pt_parent;
pt_parenttmp->_pt_left = pt_curtmp->_pt_right;
if (pt_parenttmp->_pt_left != NULL) {
pt_parenttmp->_pt_left->_pt_parent = pt_parenttmp;
}
pt_curtmp->_pt_left = pt_cur->_pt_left;
pt_curtmp->_pt_left->_pt_parent = pt_curtmp;
pt_curtmp->_pt_right = pt_cur->_pt_right;
pt_curtmp->_pt_right->_pt_parent = pt_curtmp;
pt_curtmp->_pt_parent = pt_cur->_pt_parent;
pt_curtmp->_pt_parent->_pt_right = pt_curtmp;
pt_curtmp->_t_color = pt_cur->_t_color;
pt_cur->_t_color = t_colortmp;
if (_rb_tree_get_color(pt_cur) == _COLOR_BLACK) {
<API key>(pt_rb_tree, pt_parenttmp->_pt_left, pt_parenttmp);
}
}
}
}
/* destroy the node */
b_result = <API key>(pt_rb_tree);
<API key>(pt_rb_tree)(pt_cur->_pby_data, &b_result);
assert(b_result);
_alloc_deallocate(&pt_rb_tree->_t_allocator, pt_cur, _RB_TREE_NODE_SIZE(<API key>(pt_rb_tree)), 1);
pt_rb_tree->_t_nodecount
/* update the left and right pointer */
if (pt_rb_tree->_t_nodecount == 0) {
pt_rb_tree->_t_rbroot._pt_parent = NULL;
pt_rb_tree->_t_rbroot._pt_left = &pt_rb_tree->_t_rbroot;
pt_rb_tree->_t_rbroot._pt_right = &pt_rb_tree->_t_rbroot;
} else {
pt_rb_tree->_t_rbroot._pt_left = <API key>(pt_rb_tree->_t_rbroot._pt_parent);
pt_rb_tree->_t_rbroot._pt_right = <API key>(pt_rb_tree->_t_rbroot._pt_parent);
}
}
/*
* Erase a range of element in an rb tree.
*/
void <API key>(_rb_tree_t* pt_rb_tree, _rb_tree_iterator_t it_begin, _rb_tree_iterator_t it_end)
{
_rb_tree_iterator_t it_iter;
_rb_tree_iterator_t it_next;
assert(pt_rb_tree != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
assert(<API key>(pt_rb_tree, it_begin));
assert(<API key>(pt_rb_tree, it_end));
assert(<API key>(it_begin, it_end) || <API key>(it_begin, it_end));
it_iter = it_next = it_begin;
if (!<API key>(it_next, _rb_tree_end(pt_rb_tree))) {
it_next = <API key>(it_next);
}
while (!<API key>(it_iter, it_end)) {
_rb_tree_erase_pos(pt_rb_tree, it_iter);
it_iter = it_next;
if (!<API key>(it_next, _rb_tree_end(pt_rb_tree))) {
it_next = <API key>(it_next);
}
}
}
/**
* Erase an element from a rb tree that match a specified element.
*/
size_t _rb_tree_erase(_rb_tree_t* pt_rb_tree, const void* cpv_value)
{
size_t t_count = 0;
range_t r_range;
assert(pt_rb_tree != NULL);
assert(cpv_value != NULL);
assert(_rb_tree_is_inited(pt_rb_tree));
t_count = _rb_tree_count(pt_rb_tree, cpv_value);
r_range = <API key>(pt_rb_tree, cpv_value);
if (!<API key>(r_range.it_begin, _rb_tree_end(pt_rb_tree))) {
<API key>(pt_rb_tree, r_range.it_begin, r_range.it_end);
}
return t_count;
}
/** local function implementation section **/
/** eof **/
|
#include <QtTest/QtTest>
#include <qvariant.h>
class tst_QGuiVariant : public QObject
{
Q_OBJECT
public:
tst_QGuiVariant();
private slots:
void <API key>();
};
tst_QGuiVariant::tst_QGuiVariant()
{}
void tst_QGuiVariant::<API key>()
{
QVariant v = QString("red");
QVERIFY(qvariant_cast<QColor>(v) == QColor(Qt::red));
}
QTEST_APPLESS_MAIN(tst_QGuiVariant)
#include "tst_qguivariant.moc"
|
#include "config.h"
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#ifndef _WIN32
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
#ifdef OPENSSL_CRYPTO
#include <openssl/blowfish.h>
#include <openssl/evp.h>
#include <openssl/hmac.h>
#endif
#include "libssh/priv.h"
#include "libssh/session.h"
#include "libssh/wrapper.h"
#include "libssh/crypto.h"
#include "libssh/buffer.h"
uint32_t packet_decrypt_len(ssh_session session, char *crypted){
uint32_t decrypted;
if (session->current_crypto) {
if (packet_decrypt(session, crypted,
session->current_crypto->in_cipher->blocksize) < 0) {
return 0;
}
}
memcpy(&decrypted,crypted,sizeof(decrypted));
return ntohl(decrypted);
}
int packet_decrypt(ssh_session session, void *data,uint32_t len) {
struct ssh_cipher_struct *crypto = session->current_crypto->in_cipher;
char *out = NULL;
assert(len);
if(len % session->current_crypto->in_cipher->blocksize != 0){
ssh_set_error(session, SSH_FATAL, "Cryptographic functions must be set on at least one blocksize (received %d)",len);
return SSH_ERROR;
}
out = malloc(len);
if (out == NULL) {
return -1;
}
if (crypto->set_decrypt_key(crypto, session->current_crypto->decryptkey,
session->current_crypto->decryptIV) < 0) {
SAFE_FREE(out);
return -1;
}
crypto->cbc_decrypt(crypto,data,out,len);
memcpy(data,out,len);
memset(out,0,len);
SAFE_FREE(out);
return 0;
}
unsigned char *packet_encrypt(ssh_session session, void *data, uint32_t len) {
struct ssh_cipher_struct *crypto = NULL;
HMACCTX ctx = NULL;
char *out = NULL;
unsigned int finallen;
uint32_t seq;
assert(len);
if (!session->current_crypto) {
return NULL; /* nothing to do here */
}
if(len % session->current_crypto->in_cipher->blocksize != 0){
ssh_set_error(session, SSH_FATAL, "Cryptographic functions must be set on at least one blocksize (received %d)",len);
return NULL;
}
out = malloc(len);
if (out == NULL) {
return NULL;
}
seq = ntohl(session->send_seq);
crypto = session->current_crypto->out_cipher;
if (crypto->set_encrypt_key(crypto, session->current_crypto->encryptkey,
session->current_crypto->encryptIV) < 0) {
SAFE_FREE(out);
return NULL;
}
if (session->version == 2) {
ctx = hmac_init(session->current_crypto->encryptMAC,20,SSH_HMAC_SHA1);
if (ctx == NULL) {
SAFE_FREE(out);
return NULL;
}
hmac_update(ctx,(unsigned char *)&seq,sizeof(uint32_t));
hmac_update(ctx,data,len);
hmac_final(ctx,session->current_crypto->hmacbuf,&finallen);
#ifdef DEBUG_CRYPTO
ssh_print_hexa("mac: ",data,len);
if (finallen != 20) {
printf("Final len is %d\n",finallen);
}
ssh_print_hexa("Packet hmac", session->current_crypto->hmacbuf, 20);
#endif
}
crypto->cbc_encrypt(crypto, data, out, len);
memcpy(data, out, len);
memset(out, 0, len);
SAFE_FREE(out);
if (session->version == 2) {
return session->current_crypto->hmacbuf;
}
return NULL;
}
/**
* @internal
*
* @brief Verify the hmac of a packet
*
* @param session The session to use.
* @param buffer The buffer to verify the hmac from.
* @param mac The mac to compare with the hmac.
*
* @return 0 if hmac and mac are equal, < 0 if not or an error
* occurred.
*/
int packet_hmac_verify(ssh_session session, ssh_buffer buffer,
unsigned char *mac) {
unsigned char hmacbuf[EVP_MAX_MD_SIZE] = {0};
HMACCTX ctx;
unsigned int len;
uint32_t seq;
ctx = hmac_init(session->current_crypto->decryptMAC, 20, SSH_HMAC_SHA1);
if (ctx == NULL) {
return -1;
}
seq = htonl(session->recv_seq);
hmac_update(ctx, (unsigned char *) &seq, sizeof(uint32_t));
hmac_update(ctx, buffer_get_rest(buffer), buffer_get_rest_len(buffer));
hmac_final(ctx, hmacbuf, &len);
#ifdef DEBUG_CRYPTO
ssh_print_hexa("received mac",mac,len);
ssh_print_hexa("Computed mac",hmacbuf,len);
ssh_print_hexa("seq",(unsigned char *)&seq,sizeof(uint32_t));
#endif
if (memcmp(mac, hmacbuf, len) == 0) {
return 0;
}
return -1;
}
/* vim: set ts=2 sw=2 et cindent: */
|
package org.geotools.referencing.factory.gridshift;
import java.net.URL;
import org.geotools.metadata.iso.citation.Citations;
import org.geotools.util.factory.AbstractFactory;
import org.opengis.metadata.citation.Citation;
/**
* Default grid shift file locator, looks up grids in the classpath
*
* @author Andrea Aime - GeoSolutions
*/
public class <API key> extends AbstractFactory implements GridShiftLocator {
public <API key>() {
super(NORMAL_PRIORITY);
}
@Override
public Citation getVendor() {
return Citations.GEOTOOLS;
}
@Override
public URL locateGrid(String grid) {
return getClass().getResource(grid);
}
}
|
package org.hibernate.dialect.identity;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import org.hibernate.HibernateException;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.identity.<API key>;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.id.<API key>;
/**
* @author Andrea Boriero
*/
public class <API key> extends <API key> {
private String[] keyColumns;
public <API key>(<API key> persister, Dialect dialect) {
super( persister, dialect );
this.keyColumns = getPersister().<API key>();
if ( keyColumns.length > 1 ) {
throw new HibernateException( "Identity generator cannot be used with multi-column keys" );
}
}
@Override
protected PreparedStatement prepare(String insertSQL, SessionImplementor session) throws SQLException {
return session
.getJdbcCoordinator()
.<API key>()
.prepareStatement( insertSQL, keyColumns );
}
}
|
package org.alms.messages;
import org.alms.beans.*;
import javax.ws.rs.core.HttpHeaders;
public interface IMsg
{
public void setHeader(HttpHeaders msgHeaders);
public void setIncomingMessage(String incomingMessage);
public Boolean <API key>();
public RelatedParty getMsgDestination();
public RelatedParty getMsgSending();
public String getMsgId();
public String getUserName();
public String getPassword();
public String getXSDLocation();
public String getIncomingMessage();
public String <API key>();
}
|
#ifndef __HWV1_CONFIG_H
#define __HWV1_CONFIG_H
#include "usb_type.h"
#define <API key> 0x00000040
#define TIM1_CR1 (*((vu32 *)(TIM1_BASE+0x00)))
#define TIM1_CR2 (*((vu32 *)(TIM1_BASE+0x04)))
#define TIM1_DIER (*((vu32 *)(TIM1_BASE+0x0C)))
#define TIM1_SR (*((vu32 *)(TIM1_BASE+0x10)))
#define TIM1_CCMR1 (*((vu32 *)(TIM1_BASE+0x18)))
#define TIM1_CCER (*((vu32 *)(TIM1_BASE+0x20)))
#define TIM1_PSC (*((vu32 *)(TIM1_BASE+0x28)))
#define TIM1_ARR (*((vu32 *)(TIM1_BASE+0x2C)))
#define TIM1_RCR (*((vu32 *)(TIM1_BASE+0x30)))
#define TIM1_CCR1 (*((vu32 *)(TIM1_BASE+0x34)))
#define TIM1_BDTR (*((vu32 *)(TIM1_BASE+0x44)))
#define TIM2_CR1 (*((vu32 *)(TIM2_BASE+0x00)))
#define TIM2_DIER (*((vu32 *)(TIM2_BASE+0x0C)))
#define TIM2_SR (*((vu32 *)(TIM2_BASE+0x10)))
#define TIM2_CCMR2 (*((vu32 *)(TIM2_BASE+0x1C)))
#define TIM2_CCER (*((vu32 *)(TIM2_BASE+0x20)))
#define TIM2_PSC (*((vu32 *)(TIM2_BASE+0x28)))
#define TIM2_ARR (*((vu32 *)(TIM2_BASE+0x2C)))
#define TIM2_CCR4 (*((vu32 *)(TIM2_BASE+0x40)))
#define TIM3_CR1 (*((vu32 *)(TIM3_BASE+0x00)))
#define TIM3_DIER (*((vu32 *)(TIM3_BASE+0x0C)))
#define TIM3_SR (*((vu32 *)(TIM3_BASE+0x10)))
#define TIM3_CCMR2 (*((vu32 *)(TIM3_BASE+0x1C)))
#define TIM3_CCER (*((vu32 *)(TIM3_BASE+0x20)))
#define TIM3_PSC (*((vu32 *)(TIM3_BASE+0x28)))
#define TIM3_ARR (*((vu32 *)(TIM3_BASE+0x2C)))
#define TIM3_CCR1 (*((vu32 *)(TIM3_BASE+0x34)))
#define TIM4_CR1 (*((vu32 *)(TIM4_BASE+0x00)))
#define TIM4_DIER (*((vu32 *)(TIM4_BASE+0x0C)))
#define TIM4_SR (*((vu32 *)(TIM4_BASE+0x10)))
#define TIM4_CCMR1 (*((vu32 *)(TIM4_BASE+0x18)))
#define TIM4_CCMR2 (*((vu32 *)(TIM4_BASE+0x1C)))
#define TIM4_CCER (*((vu32 *)(TIM4_BASE+0x20)))
#define TIM4_PSC (*((vu32 *)(TIM4_BASE+0x28)))
#define TIM4_ARR (*((vu32 *)(TIM4_BASE+0x2C)))
#define TIM4_CCR1 (*((vu32 *)(TIM4_BASE+0x34)))
typedef enum {
BEEP_1MHz,
BEEP_500kHz,
BEEP_200kHz,
BEEP_100kHz,
BEEP_50kHz,
BEEP_20kHz,
BEEP_10kHz,
BEEP_5kHz,
BEEP_2kHz,
BEEP_1kHz,
BEEP_500Hz,
BEEP_200Hz,
BEEP_100Hz,
BEEP_50Hz,
BEEP_20Hz,
BEEP_10Hz} beep_t;
#define ADC2_CR1 (*((vu32 *)(ADC2_BASE+0x04)))
#define ADC2_CR2 (*((vu32 *)(ADC2_BASE+0x08)))
#define ADC2_SMPR1 (*((vu32 *)(ADC2_BASE+0x0C)))
#define ADC2_SMPR2 (*((vu32 *)(ADC2_BASE+0x10)))
#define ADC2_SQR1 (*((vu32 *)(ADC2_BASE+0x2C)))
#define ADC2_SQR3 (*((vu32 *)(ADC2_BASE+0x34)))
#define ADC1_CR1 (*((vu32 *)(0x40012400+0x04)))
#define ADC1_CR2 (*((vu32 *)(0x40012400+0x08)))
#define ADC1_SMPR1 (*((vu32 *)(0x40012400+0x0C)))
#define ADC1_SMPR2 (*((vu32 *)(0x40012400+0x10)))
#define ADC1_SQR1 (*((vu32 *)(0x40012400+0x2C)))
#define ADC1_SQR3 (*((vu32 *)(0x40012400+0x34)))
#define ADC_DR (*((vu32 *)(0x40012400+0x4C)))
#define DMA_ISR (*((vu32 *)(0x40020000+0x00)))
#define DMA_IFCR (*((vu32 *)(0x40020000+0x04)))
#define DMA_CCR1 (*((vu32 *)(0x40020000+0x08)))
#define DMA_CNDTR1 (*((vu32 *)(0x40020000+0x0C)))
#define DMA_CPAR1 (*((vu32 *)(0x40020000+0x10)))
#define DMA_CMAR1 (*((vu32 *)(0x40020000+0x14)))
#define DMA_CCR2 (*((vu32 *)(0x40020000+0x1C)))
#define DMA_CNDTR2 (*((vu32 *)(0x40020000+0x20)))
#define DMA_CPAR2 (*((vu32 *)(0x40020000+0x24)))
#define DMA_CMAR2 (*((vu32 *)(0x40020000+0x28)))
#define ADC1_DR_ADDR ((u32)0x4001244C)
#define GPIOA_CRL (*((vu32 *)(GPIOA_BASE+0x00)))
#define GPIOB_CRL (*((vu32 *)(GPIOB_BASE+0x00)))
#define GPIOC_CRL (*((vu32 *)(GPIOC_BASE+0x00)))
#define GPIOD_CRL (*((vu32 *)(GPIOD_BASE+0x00)))
#define GPIOE_CRL (*((vu32 *)(GPIOE_BASE+0x00)))
#define GPIOA_CRH (*((vu32 *)(GPIOA_BASE+0x04)))
#define GPIOB_CRH (*((vu32 *)(GPIOB_BASE+0x04)))
#define GPIOC_CRH (*((vu32 *)(GPIOC_BASE+0x04)))
#define GPIOD_CRH (*((vu32 *)(GPIOD_BASE+0x04)))
#define GPIOE_CRH (*((vu32 *)(GPIOE_BASE+0x04)))
#define GPIOA_ODR (*((vu32 *)(GPIOA_BASE+0x0C)))
#define GPIOB_ODR (*((vu32 *)(GPIOB_BASE+0x0C)))
#define GPIOC_ODR (*((vu32 *)(GPIOC_BASE+0x0C)))
#define GPIOD_ODR (*((vu32 *)(GPIOD_BASE+0x0C)))
#define GPIOE_ODR (*((vu32 *)(GPIOE_BASE+0x0C)))
#define GPIOA_IDR (*((vu32 *)(GPIOA_BASE+0x08)))
#define GPIOB_IDR (*((vu32 *)(GPIOB_BASE+0x08)))
#define GPIOC_IDR (*((vu32 *)(GPIOC_BASE+0x08)))
#define GPIOD_IDR (*((vu32 *)(GPIOD_BASE+0x08)))
#define GPIOE_IDR (*((vu32 *)(GPIOE_BASE+0x08)))
#define GPIOA_BSRR (*((vu32 *)(GPIOA_BASE+0x10)))
#define GPIOB_BSRR (*((vu32 *)(GPIOB_BASE+0x10)))
#define GPIOC_BSRR (*((vu32 *)(GPIOC_BASE+0x10)))
#define GPIOD_BSRR (*((vu32 *)(GPIOD_BASE+0x10)))
#define GPIOE_BSRR (*((vu32 *)(GPIOE_BASE+0x10)))
#define GPIOA_BRR (*((vu32 *)(GPIOA_BASE+0x14)))
#define GPIOB_BRR (*((vu32 *)(GPIOB_BASE+0x14)))
#define GPIOC_BRR (*((vu32 *)(GPIOC_BASE+0x14)))
#define GPIOD_BRR (*((vu32 *)(GPIOD_BASE+0x14)))
#define GPIOE_BRR (*((vu32 *)(GPIOE_BASE+0x14)))
#define AFIO_MAPR (*((vu32 *)(AFIO_BASE+0x04)))
//These bits are written by software to select the source input for EXTIx external interrupt.
#define PA_x_PIN 0000
#define PB_x_PIN 0001
#define PC_x_PIN 0010
#define PD_x_PIN 0011
#define PE_x_PIN 0100
#define PF_x_PIN 0101
#define PG_x_PIN 0110
#define AFIO_EXTICR1 (*((vu32 *)(AFIO_BASE+0x08))) //EXTI x configuration (x= 0 to 3)
#define AFIO_EXTICR2 (*((vu32 *)(AFIO_BASE+0x0C))) //EXTI x configuration (x= 4 to 7)
#define AFIO_EXTICR3 (*((vu32 *)(AFIO_BASE+0x10))) //EXTI x configuration (x= 8 to 11)
#define AFIO_EXTICR4 (*((vu32 *)(AFIO_BASE+0x14))) //EXTI x configuration (x= 12 to 15)
#define SCS_BASE ((u32)0xE000E000)
#define SysTick_BASE (SCS_BASE + 0x0010)
#define MSD_CS_LOW() GPIOB_BRR = GPIO_Pin_12 //Select MSD Card
#define MSD_CS_HIGH() GPIOB_BSRR = GPIO_Pin_12 //Deselect MSD Card
#define KEY_UP (GPIO_Pin_6) //GPIOA6 (PA_x_PIN << 8)
#define KEY_DOWN (GPIO_Pin_9) //GPIOD9 (PD_x_PIN << 4)
#define KEY_LEFT (GPIO_Pin_5) //GPIOA5 (PA_x_PIN << 4)
#define KEY_RIGHT (GPIO_Pin_7) //GPIOA7 (PA_x_PIN << 12)
#define KEY_PLAY (GPIO_Pin_4) //GPIOA4 (PA_x_PIN << 0)
#define KEY_M (GPIO_Pin_11) //GPIOD11 (PD_x_PIN << 12)
#define KEY_B (GPIO_Pin_3) //GPIOA3 (PA_x_PIN << 12)
typedef enum {
KEYCODE_VOID,
KEYCODE_PLAY,
KEYCODE_M,
KEYCODE_B,
KEYCODE_UP,
KEYCODE_DOWN,
KEYCODE_LEFT,
KEYCODE_RIGHT} KeyCode_t;
#define LDC_DATA_OUT GPIOE_ODR
#define LDC_DATA_INP GPIOE_IDR
#define LCD_DATA_BUS_INP() GPIOC_CRH = 0x44444444; GPIOE_CRL = 0x44444444
#define LCD_DATA_BUS_OUT() GPIOC_CRH = 0x33333333; GPIOE_CRL = 0x33333333
#define LCD_nRST_LOW() GPIOC_BRR = GPIO_Pin_0
#define LCD_nRST_HIGH() GPIOC_BSRR = GPIO_Pin_0
#define LCD_RS_LOW() GPIOD_BRR = GPIO_Pin_1
#define LCD_RS_HIGH() GPIOD_BSRR = GPIO_Pin_1
#define LCD_nWR_LOW() GPIOD_BRR = GPIO_Pin_5
#define LCD_nWR_HIGH() GPIOD_BSRR = GPIO_Pin_5
#define LCD_nWR_ACT() GPIOD_BRR = GPIO_Pin_5; GPIOD_BSRR = GPIO_Pin_5
#define LCD_nRD_LOW() GPIOD_BRR = GPIO_Pin_4
#define LCD_nRD_HIGH() GPIOD_BSRR = GPIO_Pin_4
#define LCD_nRD_ACT() GPIOB_BRR = GPIO_Pin_4; GPIOD_BSRR = GPIO_Pin_4
#define RANGE_A_LOW() GPIOB_BRR = GPIO_Pin_0
#define RANGE_A_HIGH() GPIOB_BSRR = GPIO_Pin_0
#define RANGE_B_LOW() GPIOC_BRR = GPIO_Pin_5
#define RANGE_B_HIGH() GPIOC_BSRR = GPIO_Pin_5
#define RANGE_C_LOW() GPIOC_BRR = GPIO_Pin_4
#define RANGE_C_HIGH() GPIOC_BSRR = GPIO_Pin_4
#define RANGE_D_LOW() GPIOB_BRR = GPIO_Pin_1
#define RANGE_D_HIGH() GPIOB_BSRR = GPIO_Pin_1
void Set_System(void);
void NVIC_Configuration(void);
void GPIO_Config(void);
void <API key>(void);
void SPI_Config(void);
void DMA_Configuration(void);
void ADC_Configuration(void);
void Timer_Configuration(void);
char KeyScan(void);
unsigned char MSD_WriteByte(u8 byte);
unsigned char MSD_ReadByte(void);
void Battery_Detect(void);
void Set_Range(char Range);
void Set_Base(char Base);
void ADC_Start(void);
void Set_Y_Pos(unsigned short Y0);
char Test_USB_ON(void);
char SD_Card_ON(void);
void Delayms(unsigned short delay);
void WaitForKey(void);
extern volatile unsigned short DelayCounter;
extern volatile unsigned short BeepCounter;
extern volatile KeyCode_t KeyBuffer;
void Display_Info(char *Pre, unsigned long Num);
#endif
|
package jastadd.soot.JastAddJ;
import java.util.HashSet;import java.util.LinkedHashSet;import java.io.File;import java.util.*;import jastadd.beaver.*;import java.util.ArrayList;import java.util.zip.*;import java.io.*;import java.io.<API key>;import java.util.Collection;import soot.*;import soot.util.*;import soot.jimple.*;import soot.coffi.ClassFile;import soot.coffi.method_info;import soot.coffi.CONSTANT_Utf8_info;import soot.tagkit.SourceFileTag;import soot.coffi.CoffiMethodSource;
public class <API key> extends ClassInstanceExpr implements Cloneable {
public void flushCache() {
super.flushCache();
}
public void <API key>() {
super.<API key>();
}
@SuppressWarnings({"unchecked", "cast"}) public <API key> clone() throws <API key> {
<API key> node = (<API key>)super.clone();
node.in$Circle(false);
node.is$Final(false);
return node;
}
@SuppressWarnings({"unchecked", "cast"}) public <API key> copy() {
try {
<API key> node = clone();
if(children != null) node.children = children.clone();
return node;
} catch (<API key> e) {
}
System.err.println("Error: Could not clone node of type " + getClass().getName() + "!");
return null;
}
@SuppressWarnings({"unchecked", "cast"}) public <API key> fullCopy() {
<API key> res = copy();
for(int i = 0; i < <API key>(); i++) {
ASTNode node = getChildNoTransform(i);
if(node != null) node = node.fullCopy();
res.setChild(node, i);
}
return res;
}
// Declared in GenericMethods.jrag at line 160
public void toString(StringBuffer s) {
s.append("<");
for(int i = 0; i < getNumTypeArgument(); i++) {
if(i != 0) s.append(", ");
getTypeArgument(i).toString(s);
}
s.append(">");
super.toString(s);
}
// Declared in GenericMethods.ast at line 3
// Declared in GenericMethods.ast line 15
public <API key>() {
super();
setChild(new List(), 1);
setChild(new Opt(), 2);
setChild(new List(), 3);
}
// Declared in GenericMethods.ast at line 13
// Declared in GenericMethods.ast line 15
public <API key>(Access p0, List<Expr> p1, Opt<TypeDecl> p2, List<Access> p3) {
setChild(p0, 0);
setChild(p1, 1);
setChild(p2, 2);
setChild(p3, 3);
}
// Declared in GenericMethods.ast at line 20
protected int numChildren() {
return 4;
}
// Declared in GenericMethods.ast at line 23
public boolean mayHaveRewrite() {
return false;
}
// Declared in java.ast at line 2
// Declared in java.ast line 34
public void setAccess(Access node) {
setChild(node, 0);
}
// Declared in java.ast at line 5
public Access getAccess() {
return (Access)getChild(0);
}
// Declared in java.ast at line 9
public Access <API key>() {
return (Access)getChildNoTransform(0);
}
// Declared in java.ast at line 2
// Declared in java.ast line 34
public void setArgList(List<Expr> list) {
setChild(list, 1);
}
// Declared in java.ast at line 6
public int getNumArg() {
return getArgList().getNumChild();
}
// Declared in java.ast at line 10
@SuppressWarnings({"unchecked", "cast"}) public Expr getArg(int i) {
return getArgList().getChild(i);
}
// Declared in java.ast at line 14
public void addArg(Expr node) {
List<Expr> list = (parent == null || state == null) ? <API key>() : getArgList();
list.addChild(node);
}
// Declared in java.ast at line 19
public void addArgNoTransform(Expr node) {
List<Expr> list = <API key>();
list.addChild(node);
}
// Declared in java.ast at line 24
public void setArg(Expr node, int i) {
List<Expr> list = getArgList();
list.setChild(node, i);
}
// Declared in java.ast at line 28
public List<Expr> getArgs() {
return getArgList();
}
// Declared in java.ast at line 31
public List<Expr> getArgsNoTransform() {
return <API key>();
}
// Declared in java.ast at line 35
@SuppressWarnings({"unchecked", "cast"}) public List<Expr> getArgList() {
List<Expr> list = (List<Expr>)getChild(1);
list.getNumChild();
return list;
}
// Declared in java.ast at line 41
@SuppressWarnings({"unchecked", "cast"}) public List<Expr> <API key>() {
return (List<Expr>)getChildNoTransform(1);
}
// Declared in java.ast at line 2
// Declared in java.ast line 34
public void setTypeDeclOpt(Opt<TypeDecl> opt) {
setChild(opt, 2);
}
// Declared in java.ast at line 6
public boolean hasTypeDecl() {
return getTypeDeclOpt().getNumChild() != 0;
}
// Declared in java.ast at line 10
@SuppressWarnings({"unchecked", "cast"}) public TypeDecl getTypeDecl() {
return getTypeDeclOpt().getChild(0);
}
// Declared in java.ast at line 14
public void setTypeDecl(TypeDecl node) {
getTypeDeclOpt().setChild(node, 0);
}
// Declared in java.ast at line 17
@SuppressWarnings({"unchecked", "cast"}) public Opt<TypeDecl> getTypeDeclOpt() {
return (Opt<TypeDecl>)getChild(2);
}
// Declared in java.ast at line 21
@SuppressWarnings({"unchecked", "cast"}) public Opt<TypeDecl> <API key>() {
return (Opt<TypeDecl>)getChildNoTransform(2);
}
// Declared in GenericMethods.ast at line 2
// Declared in GenericMethods.ast line 15
public void setTypeArgumentList(List<Access> list) {
setChild(list, 3);
}
// Declared in GenericMethods.ast at line 6
public int getNumTypeArgument() {
return getTypeArgumentList().getNumChild();
}
// Declared in GenericMethods.ast at line 10
@SuppressWarnings({"unchecked", "cast"}) public Access getTypeArgument(int i) {
return getTypeArgumentList().getChild(i);
}
// Declared in GenericMethods.ast at line 14
public void addTypeArgument(Access node) {
List<Access> list = (parent == null || state == null) ? <API key>() : getTypeArgumentList();
list.addChild(node);
}
// Declared in GenericMethods.ast at line 19
public void <API key>(Access node) {
List<Access> list = <API key>();
list.addChild(node);
}
// Declared in GenericMethods.ast at line 24
public void setTypeArgument(Access node, int i) {
List<Access> list = getTypeArgumentList();
list.setChild(node, i);
}
// Declared in GenericMethods.ast at line 28
public List<Access> getTypeArguments() {
return getTypeArgumentList();
}
// Declared in GenericMethods.ast at line 31
public List<Access> <API key>() {
return <API key>();
}
// Declared in GenericMethods.ast at line 35
@SuppressWarnings({"unchecked", "cast"}) public List<Access> getTypeArgumentList() {
List<Access> list = (List<Access>)getChild(3);
list.getNumChild();
return list;
}
// Declared in GenericMethods.ast at line 41
@SuppressWarnings({"unchecked", "cast"}) public List<Access> <API key>() {
return (List<Access>)getChildNoTransform(3);
}
// Declared in GenericMethods.jrag at line 126
public NameType <API key>(ASTNode caller, ASTNode child) {
if(caller == <API key>()) {
int childIndex = caller.getIndexOfChild(child);
return NameType.TYPE_NAME;
}
return super.<API key>(caller, child);
}
// Declared in GenericMethods.jrag at line 127
public SimpleSet <API key>(ASTNode caller, ASTNode child, String name) {
if(caller == <API key>()) {
int childIndex = caller.getIndexOfChild(child);
return unqualifiedScope().lookupType(name);
}
return super.<API key>(caller, child, name);
}
public ASTNode rewriteTo() {
return super.rewriteTo();
}
}
|
#include <stdlib.h>
#include <string>
#include "filter_glsl_manager.h"
#include <movit/init.h>
#include <movit/util.h>
#include <movit/effect_chain.h>
#include <movit/resource_pool.h>
#include "mlt_movit_input.h"
#include "mlt_flip_effect.h"
#include <mlt++/MltEvent.h>
#include <mlt++/MltProducer.h>
extern "C" {
#include <framework/mlt_factory.h>
}
#if defined(__APPLE__)
#include <OpenGL/OpenGL.h>
#elif defined(_WIN32)
#include <windows.h>
#include <wingdi.h>
#else
#include <GL/glx.h>
#endif
using namespace movit;
void dec_ref_and_delete(GlslManager *p)
{
if (p->dec_ref() == 0) {
delete p;
}
}
GlslManager::GlslManager()
: Mlt::Filter( mlt_filter_new() )
, resource_pool(new ResourcePool())
, pbo(0)
, initEvent(0)
, closeEvent(0)
, prev_sync(NULL)
{
mlt_filter filter = get_filter();
if ( filter ) {
// Set the mlt_filter child in case we choose to override virtual functions.
filter->child = this;
add_ref(<API key>());
mlt_events_register( get_properties(), "init glsl", NULL );
mlt_events_register( get_properties(), "close glsl", NULL );
initEvent = listen("init glsl", this, (mlt_listener) GlslManager::onInit);
closeEvent = listen("close glsl", this, (mlt_listener) GlslManager::onClose);
}
}
GlslManager::~GlslManager()
{
mlt_log_debug(get_service(), "%s\n", __FUNCTION__);
cleanupContext();
// XXX If there is still a frame holding a reference to a texture after this
// destructor is called, then it will crash in release_texture().
// while (texture_list.peek_back())
// delete (glsl_texture) texture_list.pop_back();
delete initEvent;
delete closeEvent;
if (prev_sync != NULL) {
glDeleteSync( prev_sync );
}
while (syncs_to_delete.count() > 0) {
GLsync sync = (GLsync) syncs_to_delete.pop_front();
glDeleteSync( sync );
}
delete resource_pool;
}
void GlslManager::add_ref(mlt_properties properties)
{
inc_ref();
<API key>(properties, "glslManager", this, 0,
(mlt_destructor) dec_ref_and_delete, NULL);
}
GlslManager* GlslManager::get_instance()
{
return (GlslManager*) <API key>(<API key>(), "glslManager", 0);
}
glsl_texture GlslManager::get_texture(int width, int height, GLint internal_format)
{
lock();
for (int i = 0; i < texture_list.count(); ++i) {
glsl_texture tex = (glsl_texture) texture_list.peek(i);
if (!tex->used && (tex->width == width) && (tex->height == height) && (tex->internal_format == internal_format)) {
glBindTexture(GL_TEXTURE_2D, tex->texture);
glTexParameteri(GL_TEXTURE_2D, <API key>, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, <API key>, GL_NEAREST);
glBindTexture( GL_TEXTURE_2D, 0);
tex->used = 1;
unlock();
return tex;
}
}
unlock();
GLuint tex = 0;
glGenTextures(1, &tex);
if (!tex) {
return NULL;
}
glsl_texture gtex = new glsl_texture_s;
if (!gtex) {
glDeleteTextures(1, &tex);
return NULL;
}
glBindTexture( GL_TEXTURE_2D, tex );
glTexImage2D( GL_TEXTURE_2D, 0, internal_format, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE );
glTexParameteri( GL_TEXTURE_2D, <API key>, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, <API key>, GL_NEAREST );
glBindTexture( GL_TEXTURE_2D, 0 );
gtex->texture = tex;
gtex->width = width;
gtex->height = height;
gtex->internal_format = internal_format;
gtex->used = 1;
lock();
texture_list.push_back(gtex);
unlock();
return gtex;
}
void GlslManager::release_texture(glsl_texture texture)
{
texture->used = 0;
}
void GlslManager::delete_sync(GLsync sync)
{
// We do not know which thread we are called from, and we can only
// delete this if we are in one with a valid OpenGL context.
// Thus, store it for later deletion in <API key>().
GlslManager* g = GlslManager::get_instance();
g->lock();
g->syncs_to_delete.push_back(sync);
g->unlock();
}
glsl_pbo GlslManager::get_pbo(int size)
{
lock();
if (!pbo) {
GLuint pb = 0;
glGenBuffers(1, &pb);
if (!pb) {
unlock();
return NULL;
}
pbo = new glsl_pbo_s;
if (!pbo) {
glDeleteBuffers(1, &pb);
unlock();
return NULL;
}
pbo->pbo = pb;
pbo->size = 0;
}
if (size > pbo->size) {
glBindBuffer(<API key>, pbo->pbo);
glBufferData(<API key>, size, NULL, GL_STREAM_DRAW);
glBindBuffer(<API key>, 0);
pbo->size = size;
}
unlock();
return pbo;
}
void GlslManager::cleanupContext()
{
lock();
while (texture_list.peek_back()) {
glsl_texture texture = (glsl_texture) texture_list.peek_back();
glDeleteTextures(1, &texture->texture);
delete texture;
texture_list.pop_back();
}
if (pbo) {
glDeleteBuffers(1, &pbo->pbo);
delete pbo;
pbo = 0;
}
unlock();
}
void GlslManager::onInit( mlt_properties owner, GlslManager* filter )
{
mlt_log_debug( filter->get_service(), "%s\n", __FUNCTION__ );
#ifdef _WIN32
std::string path = std::string(mlt_environment("MLT_APPDIR")).append("\\share\\movit");
#elif defined(__APPLE__) && defined(RELOCATABLE)
std::string path = std::string(mlt_environment("MLT_APPDIR")).append("/share/movit");
#else
std::string path = std::string(getenv("MLT_MOVIT_PATH") ? getenv("MLT_MOVIT_PATH") : SHADERDIR);
#endif
bool success = init_movit( path, mlt_log_get_level() == MLT_LOG_DEBUG? MOVIT_DEBUG_ON : MOVIT_DEBUG_OFF );
filter->set( "glsl_supported", success );
}
void GlslManager::onClose( mlt_properties owner, GlslManager *filter )
{
filter->cleanupContext();
}
void GlslManager::onServiceChanged( mlt_properties owner, mlt_service aservice )
{
Mlt::Service service( aservice );
service.lock();
service.set( "movit chain", NULL, 0 );
service.unlock();
}
void GlslManager::onPropertyChanged( mlt_properties owner, mlt_service service, const char* property )
{
if ( property && std::string( property ) == "disable" )
onServiceChanged( owner, service );
}
extern "C" {
mlt_filter <API key>( mlt_profile profile, mlt_service_type type, const char *id, char *arg )
{
GlslManager* g = GlslManager::get_instance();
if (g)
g->inc_ref();
else
g = new GlslManager();
return g->get_filter();
}
} // extern "C"
static void deleteChain( GlslChain* chain )
{
// The Input* is owned by the EffectChain, but the MltInput* is not.
// Thus, we have to delete it here.
for (std::map<mlt_producer, MltInput*>::iterator input_it = chain->inputs.begin();
input_it != chain->inputs.end();
++input_it) {
delete input_it->second;
}
delete chain->effect_chain;
delete chain;
}
void* GlslManager::<API key>( mlt_service service, mlt_frame frame, const char *key, int *length )
{
const char *unique_id = mlt_properties_get( <API key>(service), "_unique_id" );
char buf[256];
snprintf( buf, sizeof(buf), "%s_%s", key, unique_id );
return <API key>( <API key>(frame), buf, length );
}
int GlslManager::<API key>( mlt_service service, mlt_frame frame, const char *key, void *value, int length, mlt_destructor destroy, mlt_serialiser serialise )
{
const char *unique_id = mlt_properties_get( <API key>(service), "_unique_id" );
char buf[256];
snprintf( buf, sizeof(buf), "%s_%s", key, unique_id );
return <API key>( <API key>(frame), buf, value, length, destroy, serialise );
}
void GlslManager::set_chain( mlt_service service, GlslChain* chain )
{
<API key>( <API key>(service), "_movit chain", chain, 0, (mlt_destructor) deleteChain, NULL );
}
GlslChain* GlslManager::get_chain( mlt_service service )
{
return (GlslChain*) <API key>( <API key>(service), "_movit chain", NULL );
}
Effect* GlslManager::get_effect( mlt_service service, mlt_frame frame )
{
return (Effect*) <API key>( service, frame, "_movit effect", NULL );
}
Effect* GlslManager::set_effect( mlt_service service, mlt_frame frame, Effect* effect )
{
<API key>( service, frame, "_movit effect", effect, 0, NULL, NULL );
return effect;
}
MltInput* GlslManager::get_input( mlt_producer producer, mlt_frame frame )
{
return (MltInput*) <API key>( <API key>(producer), frame, "_movit input", NULL );
}
MltInput* GlslManager::set_input( mlt_producer producer, mlt_frame frame, MltInput* input )
{
<API key>( <API key>(producer), frame, "_movit input", input, 0, NULL, NULL );
return input;
}
uint8_t* GlslManager::<API key>( mlt_producer producer, mlt_frame frame )
{
return (uint8_t*) <API key>( <API key>(producer), frame, "_movit input pp", NULL );
}
uint8_t* GlslManager::<API key>( mlt_producer producer, mlt_frame frame, uint8_t* image )
{
<API key>( <API key>(producer), frame, "_movit input pp", image, 0, NULL, NULL );
return image;
}
mlt_service GlslManager::get_effect_input( mlt_service service, mlt_frame frame )
{
return (mlt_service) <API key>( service, frame, "_movit effect input", NULL );
}
void GlslManager::set_effect_input( mlt_service service, mlt_frame frame, mlt_service input_service )
{
<API key>( service, frame, "_movit effect input", input_service, 0, NULL, NULL );
}
void GlslManager::<API key>( mlt_service service, mlt_frame frame, mlt_service *input_service, mlt_frame *input_frame)
{
*input_service = (mlt_service) <API key>( service, frame, "_movit effect secondary input", NULL );
*input_frame = (mlt_frame) <API key>( service, frame, "_movit effect secondary input frame", NULL );
}
void GlslManager::<API key>( mlt_service service, mlt_frame frame, mlt_service input_service, mlt_frame input_frame )
{
<API key>( service, frame, "_movit effect secondary input", input_service, 0, NULL, NULL );
<API key>( service, frame, "_movit effect secondary input frame", input_frame, 0, NULL, NULL );
}
void GlslManager::<API key>( mlt_service service, mlt_frame frame, mlt_service *input_service, mlt_frame *input_frame)
{
*input_service = (mlt_service) <API key>( service, frame, "_movit effect third input", NULL );
*input_frame = (mlt_frame) <API key>( service, frame, "_movit effect third input frame", NULL );
}
void GlslManager::<API key>( mlt_service service, mlt_frame frame, mlt_service input_service, mlt_frame input_frame )
{
<API key>( service, frame, "_movit effect third input", input_service, 0, NULL, NULL );
<API key>( service, frame, "_movit effect third input frame", input_frame, 0, NULL, NULL );
}
int GlslManager::<API key>(EffectChain *chain, mlt_frame frame, int width, int height, uint8_t **image)
{
glsl_texture texture = get_texture( width, height, GL_RGBA8 );
if (!texture) {
return 1;
}
GLuint fbo;
glGenFramebuffers( 1, &fbo );
check_error();
glBindFramebuffer( GL_FRAMEBUFFER, fbo );
check_error();
<API key>( GL_FRAMEBUFFER, <API key>, GL_TEXTURE_2D, texture->texture, 0 );
check_error();
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
check_error();
lock();
while (syncs_to_delete.count() > 0) {
GLsync sync = (GLsync) syncs_to_delete.pop_front();
glDeleteSync( sync );
}
unlock();
// Make sure we never have more than one frame pending at any time.
// This ensures we do not swamp the GPU with so much work
// that we cannot actually display the frames we generate.
if (prev_sync != NULL) {
glFlush();
glClientWaitSync( prev_sync, 0, GL_TIMEOUT_IGNORED );
glDeleteSync( prev_sync );
}
chain->render_to_fbo( fbo, width, height );
prev_sync = glFenceSync( <API key>, 0 );
GLsync sync = glFenceSync( <API key>, 0 );
check_error();
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
check_error();
<API key>( 1, &fbo );
check_error();
*image = (uint8_t*) &texture->texture;
mlt_frame_set_image( frame, *image, 0, NULL );
<API key>( <API key>(frame), "movit.convert.texture", texture, 0,
(mlt_destructor) GlslManager::release_texture, NULL );
<API key>( <API key>(frame), "movit.convert.fence", sync, 0,
(mlt_destructor) GlslManager::delete_sync, NULL );
return 0;
}
int GlslManager::render_frame_rgba(EffectChain *chain, mlt_frame frame, int width, int height, uint8_t **image)
{
glsl_texture texture = get_texture( width, height, GL_RGBA8 );
if (!texture) {
return 1;
}
// Use a PBO to hold the data we read back with glReadPixels().
// (Intel/DRI goes into a slow path if we don't read to PBO.)
int img_size = width * height * 4;
glsl_pbo pbo = get_pbo( img_size );
if (!pbo) {
release_texture(texture);
return 1;
}
// Set the FBO
GLuint fbo;
glGenFramebuffers( 1, &fbo );
check_error();
glBindFramebuffer( GL_FRAMEBUFFER, fbo );
check_error();
<API key>( GL_FRAMEBUFFER, <API key>, GL_TEXTURE_2D, texture->texture, 0 );
check_error();
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
check_error();
chain->render_to_fbo( fbo, width, height );
// Read FBO into PBO
glBindFramebuffer( GL_FRAMEBUFFER, fbo );
check_error();
glBindBuffer( <API key>, pbo->pbo );
check_error();
glBufferData( <API key>, img_size, NULL, GL_STREAM_READ );
check_error();
glReadPixels( 0, 0, width, height, GL_BGRA, GL_UNSIGNED_BYTE, BUFFER_OFFSET(0) );
check_error();
// Copy from PBO
uint8_t* buf = (uint8_t*) glMapBuffer( <API key>, GL_READ_ONLY );
check_error();
*image = (uint8_t*) mlt_pool_alloc( img_size );
mlt_frame_set_image( frame, *image, img_size, mlt_pool_release );
memcpy( *image, buf, img_size );
// Convert BGRA to RGBA
register uint8_t *p = *image;
register int n = width * height + 1;
while ( --n ) {
uint8_t b = p[0];
*p = p[2]; p += 2;
*p = b; p += 2;
}
// Release PBO and FBO
glUnmapBuffer( <API key> );
check_error();
glBindBuffer( <API key>, 0 );
check_error();
glBindFramebuffer( GL_FRAMEBUFFER, 0 );
check_error();
glBindTexture( GL_TEXTURE_2D, 0 );
check_error();
<API key>( <API key>(frame), "movit.convert.texture", texture, 0,
(mlt_destructor) GlslManager::release_texture, NULL);
<API key>( 1, &fbo );
check_error();
return 0;
}
void GlslManager::lock_service( mlt_frame frame )
{
Mlt::Producer producer( <API key>( <API key>( frame ) ) );
producer.lock();
}
void GlslManager::unlock_service( mlt_frame frame )
{
Mlt::Producer producer( <API key>( <API key>( frame ) ) );
producer.unlock();
}
|
package org.wingx;
import java.awt.Color;
import org.wings.*;
import org.wings.style.CSSAttributeSet;
import org.wings.style.CSSProperty;
import org.wings.style.CSSStyle;
import org.wings.style.CSSStyleSheet;
import org.wings.style.Selector;
import org.wings.style.Style;
public class XDivision
extends SContainer
implements <API key>
{
String title;
SIcon icon;
/**
* Is the XDivision shaded?
*/
boolean shaded;
/**
* Is the title clickable? Default is false.
*/
protected boolean isTitleClickable = false;
public static final Selector SELECTOR_TITLE = new Selector("xdiv.title");
/**
* Creates a XDivision instance with the specified LayoutManager
* @param l the LayoutManager
*/
public XDivision(SLayoutManager l) {
super(l);
}
/**
* Creates a XDivision instance
*/
public XDivision() {
}
public XDivision(String title) {
this.title = title;
}
/**
* Returns the title of the XDivision.
* @return String the title
*/
public String getTitle() {
return title;
}
/**
* Sets the title of the XDivision.
* @param title the title
*/
public void setTitle(String title) {
String oldVal = this.title;
reloadIfChange(this.title, title);
this.title = title;
<API key>.firePropertyChange("title", oldVal, this.title);
}
/**
* Sets the title-font of the XDivision.
* @param titleFont the font for the title
*/
public void setTitleFont( org.wings.SFont titleFont) {
SFont oldVal = this.getTitleFont();
CSSAttributeSet attributes = CSSStyleSheet.getAttributes(titleFont);
Style style = getDynamicStyle(SELECTOR_TITLE);
if (style == null) {
addDynamicStyle(new CSSStyle(SELECTOR_TITLE, attributes));
}
else {
style.remove(CSSProperty.FONT);
style.remove(CSSProperty.FONT_FAMILY);
style.remove(CSSProperty.FONT_SIZE);
style.remove(CSSProperty.FONT_STYLE);
style.remove(CSSProperty.FONT_WEIGHT);
style.putAll(attributes);
}
<API key>.firePropertyChange("titleFont", oldVal, this.getTitleFont());
}
/**
* Returns the title-font of the XDivision.
* @return SFont the font for the title
*/
public SFont getTitleFont() {
return dynamicStyles == null || dynamicStyles.get(SELECTOR_TITLE) == null ? null : CSSStyleSheet.getFont((CSSAttributeSet) dynamicStyles.get(SELECTOR_TITLE));
}
/**
* Sets the title-color of the XDivision.
* @param titleColor the color for the title
*/
public void setTitleColor( Color titleColor ) {
Color oldVal = this.getTitleColor();
setAttribute( SELECTOR_TITLE, CSSProperty.COLOR, CSSStyleSheet.getAttribute( titleColor ) );
<API key>.firePropertyChange("titleColor", oldVal, this.getTitleColor());
}
/**
* Returns the title-color of the XDivision.
* @return titleColor the color for the title
*/
public Color getTitleColor() {
return dynamicStyles == null || dynamicStyles.get(SELECTOR_TITLE) == null ? null : CSSStyleSheet.getForeground((CSSAttributeSet) dynamicStyles.get(SELECTOR_TITLE));
}
/**
* Determines whether or not the title is clickable.
* @param clickable true if the title is clickable
*/
public void setTitleClickable( boolean clickable ) {
boolean oldVal = this.isTitleClickable;
this.isTitleClickable = clickable;
<API key>.firePropertyChange("titleClickable", oldVal, this.isTitleClickable);
}
/**
* Returns true if the title is clickable.
* @return boolean true if the title is clickable
*/
public boolean isTitleClickable() {
return this.isTitleClickable;
}
public SIcon getIcon() {
return icon;
}
public void setIcon(SIcon icon) {
SIcon oldVal = this.icon;
reloadIfChange(this.icon, icon);
this.icon = icon;
<API key>.firePropertyChange("icon", oldVal, this.icon);
}
/**
* Returns true if the XDivision is shaded.
* @return boolean true if the XDivision is shaded
*/
public boolean isShaded() {
return shaded;
}
/**
* Determines whether or not the XDivision is shaded.
* @param shaded true if the XDivision is shaded
*/
public void setShaded(boolean shaded) {
if (this.shaded != shaded) {
reload();
this.shaded = shaded;
<API key>.firePropertyChange("shaded", !this.shaded, this.shaded);
<API key>(<API key>());
}
}
@Override
public void <API key>(String name, String... values) {
if (values.length == 1 && "t".equals(values[0])) {
setShaded(!shaded);
}
/*
TODO: first focusable component
if (!shaded && getComponentCount() > 0)
getComponent(0).requestFocus();
else
requestFocus();
*/
}
@Override
public void <API key>() {
}
@Override
public boolean isEpochCheckEnabled() {
return false;
}
@Override
protected boolean isShowingChildren() {
return !shaded;
}
}
|
package VASSAL.chat.peer2peer;
import java.beans.PropertyChangeEvent;
import java.beans.<API key>;
import java.beans.<API key>;
import java.net.InetAddress;
import java.net.<API key>;
public class IpWatch implements Runnable {
private <API key> propSupport = new <API key>(this);
private String currentIp;
private long wait = 1000;
public IpWatch(long waitInterval) {
wait = waitInterval;
currentIp = findIp();
}
public IpWatch() {
this(1000);
}
public void <API key>(<API key> l) {
propSupport.<API key>(l);
}
public void run() {
while (true) {
String newIp = findIp();
propSupport.firePropertyChange("address", currentIp, newIp); //$NON-NLS-1$
currentIp = newIp;
try {
Thread.sleep(wait);
}
catch (<API key> ex) {
}
}
}
public String getCurrentIp() {
return currentIp;
}
private String findIp() {
try {
InetAddress a[] = InetAddress.getAllByName(InetAddress.getLocalHost().getHostName());
final StringBuilder buff = new StringBuilder();
for (int i = 0; i < a.length; ++i) {
buff.append(a[i].getHostAddress());
if (i < a.length - 1) {
buff.append(","); //$NON-NLS-1$
}
}
return buff.toString();
}
// FIXME: review error message
catch (<API key> e) {
return null;
}
}
public static void main(String[] args) {
IpWatch w = new IpWatch();
w.<API key>(new <API key>() {
public void propertyChange(PropertyChangeEvent evt) {
System.out.println("Address = " + evt.getNewValue()); //$NON-NLS-1$
}
});
System.out.println("Address = " + w.getCurrentIp()); //$NON-NLS-1$
new Thread(w).start();
}
}
|
package vasco.soot.examples;
import java.util.Map;
import org.junit.Test;
import soot.Local;
import soot.PackManager;
import soot.SceneTransformer;
import soot.SootMethod;
import soot.Transform;
import soot.Unit;
import vasco.DataFlowSolution;
import vasco.soot.examples.SignAnalysis.Sign;
/**
* A Soot {@link SceneTransformer} for performing {@link SignAnalysis}.
*
* @author Rohan Padhye
*/
public class SignTest extends SceneTransformer {
private SignAnalysis analysis;
@Override
protected void internalTransform(String arg0, @SuppressWarnings("rawtypes") Map arg1) {
analysis = new SignAnalysis();
analysis.doAnalysis();
DataFlowSolution<Unit,Map<Local,Sign>> solution = analysis.<API key>();
System.out.println("
for (SootMethod sootMethod : analysis.getMethods()) {
System.out.println(sootMethod);
for (Unit unit : sootMethod.getActiveBody().getUnits()) {
System.out.println("
System.out.println(unit);
System.out.println("IN: " + formatConstants(solution.getValueBefore(unit)));
System.out.println("OUT: " + formatConstants(solution.getValueAfter(unit)));
}
System.out.println("
}
}
public static String formatConstants(Map<Local, Sign> value) {
if (value == null) {
return "";
}
StringBuffer sb = new StringBuffer();
for (Map.Entry<Local,Sign> entry : value.entrySet()) {
Local local = entry.getKey();
Sign sign = entry.getValue();
if (sign != null) {
sb.append("(").append(local).append(": ").append(sign.toString()).append(") ");
}
}
return sb.toString();
}
public SignAnalysis getAnalysis() {
return analysis;
}
public static void main(String args[]) {
String classPath = System.getProperty("java.class.path");
String mainClass = null;
try {
int i=0;
while(true){
if (args[i].equals("-cp")) {
classPath = args[i+1];
i += 2;
} else {
mainClass = args[i];
i++;
break;
}
}
if (i != args.length || mainClass == null)
throw new Exception();
} catch (Exception e) {
System.err.println("Usage: java SignTest [-cp CLASSPATH] MAIN_CLASS");
System.exit(1);
}
String[] sootArgs = {
"-cp", classPath, "-pp",
"-w", "-app",
"-keep-line-number",
"-<API key>",
"-p", "jb", "use-original-names",
"-p", "cg", "implicit-entry:false",
"-p", "cg.spark", "enabled",
"-p", "cg.spark", "simulate-natives",
"-p", "cg", "safe-forname",
"-p", "cg", "safe-newinstance",
"-main-class", mainClass,
"-f", "none", mainClass
};
SignTest sgn = new SignTest();
PackManager.v().getPack("wjtp").add(new Transform("wjtp.sgn", sgn));
soot.Main.main(sootArgs);
}
@Test
public void testSignAnalysis() {
// TODO: Compare output with an ideal (expected) output
SignTest.main(new String[]{"vasco.tests.SignTestCase"});
}
}
|
#ifndef S60CCAMERAENGINE_H
#define S60CCAMERAENGINE_H
// INCLUDES
#include <e32base.h>
#include <ecam.h> // for MCameraObserver(2)
#ifdef <API key>
#include <ccamautofocus.h> // for CCamAutoFocus, <API key>
#endif
// FORWARD DECLARATIONS
class <API key>;
class <API key>;
class <API key>;
class <API key>;
/*
* CameraEngine handling ECam operations needed.
*/
NONSHARABLE_CLASS( CCameraEngine ) : public CBase,
public MCameraObserver,
public MCameraObserver2
#ifdef <API key>
,public <API key>
#endif
{
public: // Enums
enum TCameraEngineState
{
EEngineNotReady = 0, // 0 - No resources reserved
EEngineInitializing, // 1 - Reserving and Powering On
EEngineIdle, // 2 - Reseved and Powered On
EEngineCapturing, // 3 - Capturing Still Image
EEngineFocusing // 4 - Focusing
};
public: // Constructor & Destructor
static CCameraEngine* NewL( TInt aCameraHandle,
TInt aPriority,
<API key>* aObserver );
~CCameraEngine();
public:
/**
* External Advanced Settings callback observer.
*/
void SetAdvancedObserver(<API key> *<API key>);
/**
* External Image Capture callback observer.
*/
void <API key>(<API key> *<API key>);
/**
* External Viewfinder callback observer.
*/
void <API key>(<API key> *aViewfinderObserver);
/**
* Static function that returns the number of cameras on the device.
*/
static TInt CamerasAvailable();
/**
* Returns the index of the currently active camera device
*/
TInt currentCameraIndex() const { return iCameraIndex; }
/**
* Returns the current state (TCameraEngineState)
* of the camera engine.
*/
TCameraEngineState State() const { return iEngineState; }
/**
* Returns true if the camera has been reserved and
* powered on, and not recording or capturing image
*/
TBool IsCameraReady() const;
/**
* Returns whether DirectScreen ViewFinder is supported by the platform
*/
TBool <API key>() const;
/**
* Returns true if the camera supports AutoFocus.
*/
TBool <API key>() const;
/**
* Returns camera info
*/
TCameraInfo *cameraInfo();
/**
* Captures an image. When complete, observer will receive
* <API key>() or <API key>() callback,
* depending on which image format was used in PrepareL().
* @leave May leave with KErrNotReady if camera is not
* reserved or prepared for capture.
*/
void CaptureL();
/**
* Cancels ongoing image capture
*/
void cancelCapture();
/**
* Reserves and powers on the camera. When complete,
* observer will receive MceoCameraReady() callback
*
*/
void ReserveAndPowerOn();
/**
* Releases and powers off the camera
*
*/
void ReleaseAndPowerOff();
/**
* Prepares for image capture.
* @param aCaptureSize requested capture size. On return,
* contains the selected size (closest match)
* @param aFormat Image format to use. Default is JPEG with
* EXIF information as provided by the camera module
* @leave KErrNotSupported, KErrNoMemory, KErrNotReady
*/
void PrepareL( TSize& aCaptureSize,
CCamera::TFormat aFormat = CCamera::EFormatExif );
/**
* Starts the viewfinder. Observer will receive
* <API key>() callbacks periodically.
* @param aSize requested viewfinder size. On return,
* contains the selected size.
*
* @leave KErrNotSupported is viewfinding with bitmaps is not
* supported, KErrNotReady
*/
void StartViewFinderL( TSize& aSize );
/**
* Stops the viewfinder if active.
*/
void StopViewFinder();
void <API key>(RWsSession& aSession,
CWsScreenDevice& aScreenDevice,
RWindowBase& aWindow,
TRect& aSize);
/**
* Releases memory for the last received viewfinder frame.
* Client must call this in response to <API key>()
* callback, after drawing the viewfinder frame is complete.
*/
void <API key>();
/**
* Releases memory for the last captured image.
* Client must call this in response to <API key>()
* or <API key>()callback, after processing the
* data/bitmap is complete.
*/
void ReleaseImageBuffer();
/**
* Starts focusing. Does nothing if AutoFocus is not supported.
* When complete, observer will receive MceoFocusComplete()
* callback.
* @leave KErrInUse, KErrNotReady
*/
void StartFocusL();
/**
* Cancels the ongoing focusing operation.
*/
void FocusCancel();
/**
* Gets a bitfield of supported focus ranges.
* @param aSupportedRanges a bitfield of either TAutoFocusRange
* (S60 3.0/3.1 devices) or TFocusRange (S60 3.2 and onwards) values
*/
void <API key>( TInt& aSupportedRanges ) const;
/**
* Sets the focus range
* @param aFocusRange one of the values returned by
* <API key>().
*/
void SetFocusRange( TInt aFocusRange );
/**
* Returns a pointer to CCamera object used by the engine.
* Allows getting access to additional functionality
* from CCamera - do not use for functionality already provided
* by CCameraEngine methods.
*/
CCamera* Camera() { return iCamera; }
protected: // Protected constructors
CCameraEngine();
CCameraEngine( TInt aCameraHandle,
TInt aPriority,
<API key>* aObserver );
void ConstructL();
protected: // MCameraObserver
/**
* From MCameraObserver
* Gets called when CCamera::Reserve() is completed.
* (V2: Called internally from HandleEvent)
*/
virtual void ReserveComplete(TInt aError);
/**
* From MCameraObserver.
* Gets called when CCamera::PowerOn() is completed.
* (V2: Called internally from HandleEvent)
*/
virtual void PowerOnComplete(TInt aError);
/**
* From MCameraObserver.
* Gets called when CCamera::<API key>() is completed.
* (V2: Called internally from ViewFinderReady)
*/
virtual void <API key>( CFbsBitmap& aFrame );
/**
* From MCameraObserver.
* Gets called when CCamera::CaptureImage() is completed.
*/
virtual void ImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError );
/**
* From MCameraObserver.
* Video capture not implemented.
*/
virtual void FrameBufferReady( MFrameBuffer* /*aFrameBuffer*/, TInt /*aError*/ ) {}
protected: // MCameraObserver2
/**
* From MCameraObserver2
* Camera event handler
*/
virtual void HandleEvent(const TECAMEvent &aEvent);
/**
* From MCameraObserver2
* Notifies the client of new viewfinder data
*/
virtual void ViewFinderReady(MCameraBuffer &aCameraBuffer, TInt aError);
/**
* From MCameraObserver2
* Notifies the client of a new captured image
*/
virtual void ImageBufferReady(MCameraBuffer &aCameraBuffer, TInt aError);
/**
* From MCameraObserver2
* Video capture not implemented.
*/
virtual void VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/, TInt /*aError*/) {}
protected: // <API key>
/**
* From <API key>.
* Delivers notification of completion of auto focus initialisation to
* an interested party.
* @param aError Reason for completion of focus request.
*/
virtual void InitComplete( TInt aError );
/**
* From <API key>.
* Gets called when CCamAutoFocus::<API key>() is
* completed.
* (V2: Called internally from HandleEvent)
*/
virtual void <API key>( TInt aError );
private: // Internal functions
/**
* Internal function to handle ImageReady callbacks from
* both observer (V1 & V2) interfaces
*/
void HandleImageReady(const TInt aError, const bool isBitmap);
private: // Data
CCamera *iCamera;
<API key> *iObserver;
<API key> *<API key>;
<API key> *<API key>;
<API key> *iViewfinderObserver;
MCameraBuffer *iViewFinderBuffer;
/*
* Following pointers are for the image buffers:
* * Makes buffering of 2 concurrent image buffers possible
*/
MCameraBuffer *iImageBuffer1;
MCameraBuffer *iImageBuffer2;
TDesC8 *iImageData1;
TDesC8 *iImageData2;
CFbsBitmap *iImageBitmap1;
CFbsBitmap *iImageBitmap2;
TInt iCameraIndex;
TInt iPriority;
TCameraEngineState iEngineState;
TCameraInfo iCameraInfo;
CCamera::TFormat iImageCaptureFormat;
bool <API key>;
int <API key>; // 0 = Buffer1, 1 = Buffer2
#ifdef <API key>
CCamAutoFocus* iAutoFocus;
CCamAutoFocus::TAutoFocusRange iAFRange;
#endif // <API key>
};
#endif // S60CCAMERAENGINE_H
|
<?php return header("HTTP/1.0 404 Not Found"); exit();
|
<!DOCTYPE HTML PUBLIC "-
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_40) on Wed Feb 10 11:30:31 CST 2016 -->
<title><API key> (Hibernate JavaDocs)</title>
<meta name="date" content="2016-02-10">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="<API key> (Hibernate JavaDocs)";
}
}
catch(err) {
}
var methods = {"i0":6,"i1":6};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="topNav"><a name="navbar.top">
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/<API key>.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/hibernate/context/spi/<API key>.html" title="interface in org.hibernate.context.spi"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/hibernate/context/spi/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
</a></div>
<div class="header">
<div class="subTitle">org.hibernate.context.spi</div>
<h2 title="Interface <API key>" class="title">Interface <API key></h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public interface <span class="typeNameLabel"><API key></span></pre>
<div class="block">A callback registered with the <a href="../../../../org/hibernate/SessionFactory.html" title="interface in org.hibernate"><code>SessionFactory</code></a> that is responsible for resolving the
current tenant identifier for use with <a href="../../../../org/hibernate/context/spi/<API key>.html" title="interface in org.hibernate.context.spi"><code><API key></code></a> and
<a href="../../../../org/hibernate/SessionFactory.html#getCurrentSession--"><code>SessionFactory.getCurrentSession()</code></a></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="method.summary">
</a>
<h3>Method Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/hibernate/context/spi/<API key>.html#<API key>--"><API key></a></span>()</code>
<div class="block">Resolve the current tenant identifier.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/hibernate/context/spi/<API key>.html#<API key>--"><API key></a></span>()</code>
<div class="block">Should we validate that the tenant identifier on "current sessions" that already exist when
<a href="../../../../org/hibernate/context/spi/<API key>.html#currentSession--"><code><API key>.currentSession()</code></a> is called matches the value returned here from
<a href="../../../../org/hibernate/context/spi/<API key>.html#<API key>--"><code><API key>()</code></a>?</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<ul class="blockList">
<li class="blockList"><a name="method.detail">
</a>
<h3>Method Detail</h3>
<a name="<API key>
</a>
<ul class="blockList">
<li class="blockList">
<h4><API key></h4>
<pre><a href="http://download.oracle.com/javase/6/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> <API key>()</pre>
<div class="block">Resolve the current tenant identifier.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>The current tenant identifier</dd>
</dl>
</li>
</ul>
<a name="<API key>
</a>
<ul class="blockListLast">
<li class="blockList">
<h4><API key></h4>
<pre>boolean <API key>()</pre>
<div class="block">Should we validate that the tenant identifier on "current sessions" that already exist when
<a href="../../../../org/hibernate/context/spi/<API key>.html#currentSession--"><code><API key>.currentSession()</code></a> is called matches the value returned here from
<a href="../../../../org/hibernate/context/spi/<API key>.html#<API key>--"><code><API key>()</code></a>?</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> indicates that the extra validation will be performed; <code>false</code> indicates it will not.</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../org/hibernate/context/<API key>.html" title="class in org.hibernate.context"><code><API key></code></a></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="bottomNav"><a name="navbar.bottom">
</a>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="class-use/<API key>.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../index-all.html">Index</a></li>
<li><a href="../../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../org/hibernate/context/spi/<API key>.html" title="interface in org.hibernate.context.spi"><span class="typeNameLink">Prev Class</span></a></li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/hibernate/context/spi/<API key>.html" target="_top">Frames</a></li>
<li><a href="<API key>.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="<API key>">
<li><a href="../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!
allClassesLink = document.getElementById("<API key>");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
</a></div>
<p class="legalCopy"><small>Copyright © 2001-2016 <a href="http:
</body>
</html>
|
#ifndef <API key>
#define <API key>
#include <<API key>.h>
#include <<API key>.h>
class <API key>;
/*!
\class <API key>
\brief <API key> class is a base class for all widget animations.
*/
class M_CORE_EXPORT <API key> : public <API key>
{
Q_OBJECT
Q_DECLARE_PRIVATE(<API key>)
M_ANIMATION_GROUP(<API key>)
protected:
/*!
\brief Constructs the widget animation.
This constructor is meant to be used inside the libmeegotouch to share the
private data class pointer.
*/
<API key>(<API key> *dd, QObject *parent);
public:
/*!
* This enum defines the direction of the widget animation.
*/
enum TransitionDirection {
In, //!< transitioning into the screen/display
Out //!< transitioning out of the screen/display
};
/*!
\brief Constructs the widget animation.
*/
<API key>(QObject *parent = NULL);
/*!
\brief Destructs the widget animation.
*/
virtual ~<API key>();
/*!
Restores the properties of the target widget back to their
original state, before the animation changed them.
*/
virtual void <API key>() = 0;
virtual void setTargetWidget(MWidgetController *widget);
virtual void <API key>(<API key>::TransitionDirection direction) = 0;
MWidgetController *targetWidget();
const MWidgetController *targetWidget() const;
};
#endif
|
#ifndef OPENWITHDIALOG_H
#define OPENWITHDIALOG_H
#include <QtGui/QDialog>
#include "ui_openwithdialog.h"
namespace Core {
class ICore;
namespace Internal {
// Present the user with a file name and a list of available
// editor kinds to choose from.
class OpenWithDialog : public QDialog, public Ui::OpenWithDialog
{
Q_OBJECT
public:
OpenWithDialog(const QString &fileName, QWidget *parent);
void setEditors(const QStringList &);
QString editor() const;
void setCurrentEditor(int index);
private slots:
void currentItemChanged(QListWidgetItem *, QListWidgetItem *);
private:
void setOkButtonEnabled(bool);
};
} // namespace Internal
} // namespace Core
#endif // OPENWITHDIALOG_H
|
package examples.O2AInterface;
import jade.core.Runtime;
import jade.core.Profile;
import jade.core.ProfileImpl;
import jade.wrapper.*;
/**
* This class shows an example of how to run JADE as a library from an external program
* and in particular how to start an agent and interact with it by means of the
* Object-to-Agent (O2A) interface.
*
* @author Giovanni Iavarone - Michele Izzo
*/
public class O2AInterfaceExample {
public static void main(String[] args) throws StaleProxyException, <API key> {
// Get a hold to the JADE runtime
Runtime rt = Runtime.instance();
// Launch the Main Container (with the administration GUI on top) listening on port 8888
System.out.println(">>>>>>>>>>>>>>> Launching the platform Main Container...");
Profile pMain = new ProfileImpl(null, 8888, null);
pMain.setParameter(Profile.GUI, "true");
ContainerController mainCtrl = rt.createMainContainer(pMain);
// Create and start an agent of class CounterAgent
System.out.println(">>>>>>>>>>>>>>> Starting up a CounterAgent...");
AgentController agentCtrl = mainCtrl.createNewAgent("CounterAgent", CounterAgent.class.getName(), new Object[0]);
agentCtrl.start();
// Wait a bit
System.out.println(">>>>>>>>>>>>>>> Wait a bit...");
Thread.sleep(10000);
try {
// Retrieve O2A interface CounterManager1 exposed by the agent to make it activate the counter
System.out.println(">>>>>>>>>>>>>>> Activate counter");
CounterManager1 o2a1 = agentCtrl.getO2AInterface(CounterManager1.class);
o2a1.activateCounter();
// Wait a bit
System.out.println(">>>>>>>>>>>>>>> Wait a bit...");
Thread.sleep(30000);
// Retrieve O2A interface CounterManager2 exposed by the agent to make it de-activate the counter
System.out.println(">>>>>>>>>>>>>>> Deactivate counter");
CounterManager2 o2a2 = agentCtrl.getO2AInterface(CounterManager2.class);
o2a2.deactivateCounter();
}
catch (StaleProxyException e) {
e.printStackTrace();
}
}
}
|
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace PubComp.Caching.Core.UnitTests
{
[TestClass]
public abstract class CacheInterfaceTests
{
protected abstract ICache GetCache(string name);
protected abstract ICache <API key>(string name, TimeSpan slidingExpiration);
protected abstract ICache <API key>(string name, TimeSpan expirationFromAdd);
protected abstract ICache <API key>(string name, DateTimeOffset expireAt);
private IDisposable cacheDirectives;
[TestInitialize]
public void TestInitialize()
{
cacheDirectives = CacheDirectives.SetScope(CacheMethod.GetOrSet, DateTimeOffset.UtcNow);
}
[TestCleanup]
public void TestCleanup()
{
cacheDirectives?.Dispose();
cacheDirectives = null;
}
[TestMethod]
public void TestCacheStruct()
{
var cache = <API key>("cache1", TimeSpan.FromMinutes(2));
cache.ClearAll();
int hits = 0;
Func<int> getter = () => { hits++; return hits; };
int result;
result = cache.Get("key", getter);
Assert.AreEqual(1, hits);
Assert.AreEqual(1, result);
result = cache.Get("key", getter);
Assert.AreEqual(1, hits);
Assert.AreEqual(1, result);
}
[TestMethod]
public void TestCacheObject()
{
var cache = <API key>("cache1", TimeSpan.FromMinutes(2));
cache.ClearAll();
int hits = 0;
Func<string> getter = () => { hits++; return hits.ToString(); };
string result;
result = cache.Get("key", getter);
Assert.AreEqual(1, hits);
Assert.AreEqual("1", result);
result = cache.Get("key", getter);
Assert.AreEqual(1, hits);
Assert.AreEqual("1", result);
}
[TestMethod]
public async Task <API key>()
{
var cache = <API key>("cache1", TimeSpan.FromMinutes(2));
cache.ClearAll();
int hits = 0;
Func<Task<string>> getter = async () => { hits++; return hits.ToString(); };
string result;
result = await cache.GetAsync("key", getter);
Assert.AreEqual(1, hits);
Assert.AreEqual("1", result);
result = await cache.GetAsync("key", getter);
Assert.AreEqual(1, hits);
Assert.AreEqual("1", result);
}
[TestMethod]
public void TestCacheNull()
{
var cache = <API key>("cache1", TimeSpan.FromMinutes(2));
cache.ClearAll();
int misses = 0;
Func<string> getter = () => { misses++; return null; };
string result;
result = cache.Get("key", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual(null, result);
result = cache.Get("key", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual(null, result);
}
[TestMethod]
public void <API key>()
{
var ttl = 3;
int misses = 0;
string result;
var stopwatch = new Stopwatch();
Func<string> getter = () => { misses++; return misses.ToString(); };
var cache = <API key>("insert-expire-cache", TimeSpan.FromSeconds(ttl));
cache.ClearAll();
stopwatch.Start();
result = cache.Get("key", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
result = cache.Get("key", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
CacheTestTools.<API key>(cache, "key", "1", getter, stopwatch, ttl);
// Should expire within TTL+60sec from insert
CacheTestTools.<API key>(cache, "key", "1", getter, stopwatch, 60.1);
result = cache.Get("key", getter);
Assert.AreNotEqual(1, misses);
Assert.AreNotEqual("1", result);
}
[TestMethod]
public void <API key>()
{
return;
var ttl = 3;
int misses = 0;
string result;
var stopwatch = new Stopwatch();
Func<string> getter = () => { misses++; return misses.ToString(); };
var cache = <API key>("<API key>", TimeSpan.FromSeconds(ttl));
cache.ClearAll();
stopwatch.Start();
result = cache.Get("key", getter);
DateTime insertTime = DateTime.Now;
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
result = cache.Get("key", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
CacheTestTools.<API key>(cache, "key", "1", getter, stopwatch, ttl + 60);
// Should expire within TTL+60sec from last access
CacheTestTools.<API key>(cache, "key", "1", getter, stopwatch, ttl + 60.1);
result = cache.Get("key", getter);
Assert.AreNotEqual(1, misses);
Assert.AreNotEqual("1", result);
}
[TestMethod]
public void <API key>()
{
var ttl = 3;
int misses = 0;
string result;
var stopwatch = new Stopwatch();
Func<string> getter = () => { misses++; return misses.ToString(); };
var expireAt = DateTime.Now.AddSeconds(ttl);
stopwatch.Start();
var cache = <API key>("constant-expire", expireAt);
cache.ClearAll();
result = cache.Get("key", getter);
DateTime insertTime = DateTime.Now;
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
result = cache.Get("key", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
CacheTestTools.<API key>(cache, "key", "1", getter, stopwatch, ttl);
// Should expire within TTL+60sec from insert
CacheTestTools.<API key>(cache, "key", "1", getter, stopwatch, 60.1);
result = cache.Get("key", getter);
Assert.AreNotEqual(1, misses);
Assert.AreNotEqual("1", result);
}
[TestMethod]
[Ignore("Diagnose manually the memory consumption")]
public void LotsOfClearAll()
{
var cache = GetCache("cache1");
for (var i = 0; i < 5000; i++)
{
cache.ClearAll();
}
Thread.Sleep(1000);
GC.Collect();
Thread.Sleep(1000);
for (var i = 0; i < 5000; i++)
{
cache.ClearAll();
}
}
[TestMethod]
[Ignore("Diagnose manually the memory consumption")]
public async Task LotsOfClearAsyncAll()
{
var cache = GetCache("cache1");
for (var i = 0; i < 5000; i++)
{
await cache.ClearAllAsync().ConfigureAwait(false);
}
await Task.Delay(1000);
GC.Collect();
await Task.Delay(1000);
for (var i = 0; i < 5000; i++)
{
await cache.ClearAllAsync().ConfigureAwait(false);
}
}
[TestMethod]
public void TestCacheTryGet()
{
var cache = GetCache("cache1");
cache.ClearAll();
cache.Set("key", "1");
var result = cache.TryGet<string>("key", out var value);
Assert.AreEqual("1", value);
Assert.IsTrue(result);
}
[TestMethod]
public void <API key>()
{
var cache = GetCache("cache1");
cache.ClearAll();
cache.Set("key", "1");
var result = cache.TryGet<string>("wrongKey", out var value);
Assert.AreEqual(null, value);
Assert.IsFalse(result);
}
[TestMethod]
public async Task <API key>()
{
var cache = GetCache("cache1");
cache.ClearAll();
cache.Set("key", "1");
var result = await cache.TryGetAsync<string>("key");
Assert.AreEqual("1", result.Value);
Assert.IsTrue(result.WasFound);
}
[TestMethod]
public async Task <API key>()
{
var cache = GetCache("cache1");
cache.ClearAll();
cache.Set("key", "1");
var result = await cache.TryGetAsync<string>("wrongKey");
Assert.AreEqual(null, result.Value);
Assert.IsFalse(result.WasFound);
}
[TestMethod]
public void TestCacheGetTwice()
{
var cache = GetCache("cache1");
cache.ClearAll();
int misses = 0;
Func<string> getter = () => { misses++; return misses.ToString(); };
string result;
result = cache.Get("key", getter);
Assert.AreEqual("1", result);
result = cache.Get("key", getter);
Assert.AreEqual("1", result);
}
[TestMethod]
public void TestCacheSetTwice()
{
var cache = GetCache("cache1");
cache.ClearAll();
int misses = 0;
Func<string> getter = () => { misses++; return misses.ToString(); };
string result;
bool wasFound;
cache.Set("key", getter());
wasFound = cache.TryGet("key", out result);
Assert.AreEqual(true, wasFound);
Assert.AreEqual("1", result);
cache.Set("key", getter());
wasFound = cache.TryGet("key", out result);
Assert.AreEqual(true, wasFound);
Assert.AreEqual("2", result);
}
[TestMethod]
public void TestCacheUpdated()
{
var cache = <API key>("cache1", TimeSpan.FromMinutes(2));
cache.ClearAll();
cache.Set("key", 1);
var result = cache.Get("key", () => 0);
Assert.AreEqual(1, result);
cache.Set("key", 2);
result = cache.Get("key", () => 0);
Assert.AreEqual(2, result);
}
[TestMethod]
public void TestCacheBasic()
{
var cache = <API key>("cache1", TimeSpan.FromMinutes(2));
cache.ClearAll();
int misses = 0;
Func<string> getter = () => { misses++; return misses.ToString(); };
string result;
result = cache.Get("key1", getter);
Assert.AreEqual(1, misses);
Assert.AreEqual("1", result);
result = cache.Get("key2", getter);
Assert.AreEqual(2, misses);
Assert.AreEqual("2", result);
cache.ClearAll();
result = cache.Get("key1", getter);
Assert.AreEqual(3, misses);
Assert.AreEqual("3", result);
result = cache.Get("key2", getter);
Assert.AreEqual(4, misses);
Assert.AreEqual("4", result);
}
[TestMethod]
public void TestCacheTwoCaches()
{
var cache1 = <API key>("cache1", TimeSpan.FromMinutes(2));
cache1.ClearAll();
var cache2 = <API key>("cache2", TimeSpan.FromMinutes(2));
cache2.ClearAll();
int misses1 = 0;
Func<string> getter1 = () => { misses1++; return misses1.ToString(); };
int misses2 = 0;
Func<string> getter2 = () => { misses2++; return misses2.ToString(); };
string result;
result = cache1.Get("key1", getter1);
Assert.AreEqual(1, misses1);
Assert.AreEqual("1", result);
result = cache1.Get("key2", getter1);
Assert.AreEqual(2, misses1);
Assert.AreEqual("2", result);
result = cache2.Get("key1", getter2);
Assert.AreEqual(1, misses2);
Assert.AreEqual("1", result);
result = cache2.Get("key2", getter2);
Assert.AreEqual(2, misses2);
Assert.AreEqual("2", result);
cache1.ClearAll();
result = cache1.Get("key1", getter1);
Assert.AreEqual(3, misses1);
Assert.AreEqual("3", result);
result = cache1.Get("key2", getter1);
Assert.AreEqual(4, misses1);
Assert.AreEqual("4", result);
result = cache2.Get("key1", getter2);
Assert.AreEqual(2, misses2);
Assert.AreEqual("1", result);
result = cache2.Get("key2", getter2);
Assert.AreEqual(2, misses2);
Assert.AreEqual("2", result);
}
}
}
|
import sys
import time
sleep = time.sleep
if sys.platform == 'win32':
time = time.clock
else:
time = time.time
|
#include "plasmaengine.h"
#include <kdebug.h>
#include <plasma/dataenginemanager.h>
#if 0
#include <QFile>
#include <QTextStream>
#endif
\internal helper function that translates plasma data into a QVariantMap.
QVariantMap dataToMap(Plasma::DataEngine::Data data)
{
QVariantMap map;
Plasma::DataEngine::DataIterator it(data);
while( it.hasNext() ) {
it.next();
map.insert(it.key(), it.value());
}
return map;
}
/*
\internal helper function that translates a QVariantMap into plasma data.
Plasma::DataEngine::Data mapToData(QVariantMap map)
{
Plasma::DataEngine::Data data;
for(QVariantMap::Iterator it = map.begin(); it != map.end(); ++it)
data.insert(it.key(), it.value());
return data;
}
*/
/*****************************************************************************************
* <API key>
*/
\internal d-pointer class.
class <API key>::Private
{
public:
Meter* meter;
QString source;
QString format;
};
<API key>::<API key>(Meter *meter, const QString& source) : QObject(meter), d(new Private)
{
//kDebug()<<"<API key> Ctor"<<endl;
setObjectName(source);
d->meter = meter;
d->source = source;
}
<API key>::~<API key>()
{
//kDebug()<<"<API key> Dtor"<<endl;
delete d;
}
Meter* <API key>::meter() const
{
return d->meter;
}
QString <API key>::source() const
{
return d->source;
}
void <API key>::setSource(const QString& source)
{
d->source = source;
}
QString <API key>::format() const
{
return d->format;
}
void <API key>::setFormat(const QString& format)
{
d->format = format;
}
void <API key>::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data)
{
//kDebug()<<"<API key>::dataUpdated d->source="<<d->source<<" source="<<source<<endl;
if( d->source.isEmpty() ) {
emit sourceUpdated(source, dataToMap(data));
return;
}
if( source != d->source ) {
return;
}
QString v = d->format;
Plasma::DataEngine::DataIterator it(data);
while( it.hasNext() ) {
it.next();
QString s = QString("%%1").arg( it.key() );
v.replace(s,it.value().toString());
}
d->meter->setValue(v);
}
/*****************************************************************************************
* PlasmaSensor
*/
\internal d-pointer class.
class PlasmaSensor::Private
{
public:
Plasma::DataEngine* engine;
QString engineName;
explicit Private() : engine(0) {}
};
PlasmaSensor::PlasmaSensor(int msec) : Sensor(msec), d(new Private)
{
kDebug()<<"PlasmaSensor Ctor"<<endl;
}
PlasmaSensor::~PlasmaSensor()
{
kDebug()<<"PlasmaSensor Dtor"<<endl;
delete d;
}
Plasma::DataEngine* PlasmaSensor::engineImpl() const
{
return d->engine;
}
void PlasmaSensor::setEngineImpl(Plasma::DataEngine* engine, const QString& engineName)
{
d->engine = engine;
d->engineName = engineName;
}
QString PlasmaSensor::engine()
{
return d->engine ? d->engineName : QString();
}
void PlasmaSensor::setEngine(const QString& name)
{
//kDebug()<<"PlasmaSensor::setEngine name="<<name<<endl;
if( d->engine ) {
disconnect(d->engine, SIGNAL(newSource(QString)), this, SIGNAL(sourceAdded(QString)));
disconnect(d->engine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourceRemoved(QString)));
Plasma::DataEngineManager::self()->unloadEngine(d->engineName);
}
d->engineName.clear();
d->engine = Plasma::DataEngineManager::self()->engine(name);
if( ! d->engine || ! d->engine->isValid() ) {
d->engine = Plasma::DataEngineManager::self()->loadEngine(name);
if( ! d->engine || ! d->engine->isValid() ) {
kWarning()<<"PlasmaSensor::setEngine: No such engine: "<<name<<endl;
return;
}
}
d->engineName = name;
connect(d->engine, SIGNAL(newSource(QString)), this, SIGNAL(sourceAdded(QString)));
connect(d->engine, SIGNAL(sourceRemoved(QString)), this, SIGNAL(sourceRemoved(QString)));
//d->engine->setProperty("reportSeconds", true);
}
bool PlasmaSensor::isValid() const
{
return d->engine && d->engine->isValid();
}
QStringList PlasmaSensor::sources() const
{
return d->engine ? d->engine->sources() : QStringList();
}
QVariant PlasmaSensor::property(const QByteArray& name) const
{
return d->engine ? d->engine->property(name) : QVariant();
}
void PlasmaSensor::setProperty(const QByteArray& name, const QVariant& value)
{
if( d->engine )
d->engine->setProperty(name, value);
}
QVariantMap PlasmaSensor::query(const QString& source)
{
//kDebug()<<"PlasmaSensor::query"<<endl;
return d->engine ? dataToMap(d->engine->query(source)) : QVariantMap();
}
QObject* PlasmaSensor::connectSource(const QString& source, QObject* visualization)
{
//kDebug()<<"PlasmaSensor::connectSource source="<<source<<endl;
if( ! d->engine ) {
kWarning()<<"PlasmaSensor::connectSource: No engine"<<endl;
return 0;
}
if( Meter* m = dynamic_cast<Meter*>(visualization) ) {
<API key>* c = new <API key>(m, source);
d->engine->connectSource(source, c);
kDebug()<<"PlasmaSensor::connectSource meter, engine isValid="<<d->engine->isValid();
return c;
}
d->engine->connectSource(source, visualization ? visualization : this);
return 0;
}
void PlasmaSensor::disconnectSource(const QString& source, QObject* visualization)
{
//kDebug()<<"PlasmaSensor::disconnectSource"<<endl;
if( Meter* m = dynamic_cast<Meter*>(visualization) ) {
foreach(<API key>* c, m->findChildren<<API key>*>(source))
if( c->meter() == m )
delete c;
}
else if( d->engine ) {
d->engine->disconnectSource(source, visualization ? visualization : this);
}
else
kWarning()<<"PlasmaSensor::disconnectSource: No engine"<<endl;
}
void PlasmaSensor::update()
{
kDebug()<<"PlasmaSensor::update"<<endl;
/*TODO
foreach(QObject *it, *objList) {
SensorParams *sp = qobject_cast<SensorParams*>(it);
Meter *meter = sp->getMeter();
const QString format = sp->getParam("FORMAT");
//if (format.length() == 0) format = "%um";
//format.replace(QRegExp("%fmb", Qt::CaseInsensitive),QString::number((int)((totalMem - usedMemNoBuffers) / 1024.0 + 0.5)));
//meter->setValue(format);
}
*/
}
void PlasmaSensor::dataUpdated(const QString& source, Plasma::DataEngine::Data data)
{
//kDebug()<<"PlasmaSensor::dataUpdated source="<<source<<endl;
emit sourceUpdated(source, dataToMap(data));
}
#include "plasmaengine.moc"
|
body {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 63.125%; /* translate 1.0em to 10px, 1.5em to 15px, etc. */
}
#content {
margin:0 auto;
width: 980px;
text-align: left;
}
#identity {
padding: 25px 0;
}
#identity h1 {
font-size: 2.4em;
font-weight: normal;
color: #73736c;
}
p {
margin: 0 0 1em 0;
font-size: 1.3em;
line-height: 1.4em;
}
a {
color: #b31b1b;
text-decoration: none;
font-size: .9em;
}
a:visited {
color: #b37474;
}
a:hover {
color: #f00;
border-color: #f00;
}
a:active {
color: #b31b1b;
border-color: #e5cfcf;
}
hr {
display: none;
}
form {
margin: 0 0 15px 0;
padding: 0;
float: left;
}
.form-submit {
border: 1px solid #dbdbd2;
margin: 8px;
}
fieldset {
float: left;
margin: 0 auto;
padding: 1em 0 1.5em 0;
width: 35em;
}
.form-pair {
display: inline;
float: left;
margin: .5em .5em 0 .4em;
width: 28em;
}
.form-item {
float: left;
margin-top: 5px;
width: 8em;
font-size: 1.2em;
font-family: verdana, arial, helvetica, sans-serif;
line-height: 1.5em;
text-align: right;
}
.form-value {
float: right;
margin-top: 3px;
width: 16em;
font-size: 1.1em;
font-family: verdana, arial, helvetica, sans-serif;
line-height: 1.5em;
margin-right: 0px;
}
.input-submit, .input-reset {
font-family: verdana, arial, helvetica, sans-serif;
font-size: 1.1em;
border: 1px solid;
background: #f0eee4;
margin-top:0px;
}
.input-submit:hover{
background:#dbdbd2;
}
#offsetlinks ul {
float: left;
margin: 0 0 0 0;
padding: 0px 0 10px 0;
font-size: 1.3em;
line-height: 1.4em;
}
#offsetlinks ul li {
margin: 0 0 0 30em;
padding: 0 0 0 15px;/*was 30*/
list-style: none;
}
#footer {
margin: 0 auto;
padding: 5px 0 1em 0;
width: 68em;
font-size: .9em;
color: #73736c;
float: left;
margin-top: .5em;
}
#footer a {
font-size: 1.0em;
}
|
tinymce.addI18n('it',{
"Cut": "Taglia",
"Heading 5": "Intestazione 5",
"Header 2": "Header 2",
"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Il tuo browser non supporta l'accesso diretto negli Appunti. Per favore usa i tasti di scelta rapida Ctrl+X\/C\/V.",
"Heading 4": "Intestazione 4",
"Div": "Div",
"Heading 2": "Intestazione 2",
"Paste": "Incolla",
"Close": "Chiudi",
"Font Family": "Famiglia font",
"Pre": "Pre",
"Align right": "Allinea a Destra",
"New document": "Nuovo Documento",
"Blockquote": "Blockquote",
"Numbered list": "Elenchi Numerati",
"Heading 1": "Intestazione 1",
"Headings": "Intestazioni",
"Increase indent": "Aumenta Rientro",
"Formats": "Formattazioni",
"Headers": "Intestazioni",
"Select all": "Seleziona Tutto",
"Header 3": "Intestazione 3",
"Blocks": "Blocchi",
"Undo": "Indietro",
"Strikethrough": "Barrato",
"Bullet list": "Elenchi Puntati",
"Header 1": "Intestazione 1",
"Superscript": "Apice",
"Clear formatting": "Cancella Formattazione",
"Font Sizes": "Dimensioni font",
"Subscript": "Pedice",
"Header 6": "Intestazione 6",
"Redo": "Ripeti",
"Paragraph": "Paragrafo",
"Ok": "Ok",
"Bold": "Grassetto",
"Code": "Codice",
"Italic": "Corsivo",
"Align center": "Allinea al Cento",
"Header 5": "Intestazione 5",
"Heading 6": "Intestazione 6",
"Heading 3": "Intestazione 3",
"Decrease indent": "Riduci Rientro",
"Header 4": "Intestazione 4",
"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Incolla \u00e8 in modalit\u00e0 testo normale. I contenuti sono incollati come testo normale se non disattivi l'opzione.",
"Underline": "Sottolineato",
"Cancel": "Annulla",
"Justify": "Giustifica",
"Inline": "Inlinea",
"Copy": "Copia",
"Align left": "Allinea a Sinistra",
"Visual aids": "Elementi Visivi",
"Lower Greek": "Greek Minore",
"Square": "Quadrato",
"Default": "Default",
"Lower Alpha": "Alpha Minore",
"Circle": "Cerchio",
"Disc": "Disco",
"Upper Alpha": "Alpha Superiore",
"Upper Roman": "Roman Superiore",
"Lower Roman": "Roman Minore",
"Name": "Nome",
"Anchor": "Fissa",
"You have unsaved changes are you sure you want to navigate away?": "Non hai salvato delle modifiche, sei sicuro di andartene?",
"Restore last draft": "Ripristina l'ultima bozza.",
"Special character": "Carattere Speciale",
"Source code": "Codice Sorgente",
"B": "B",
"R": "R",
"G": "G",
"Color": "Colore",
"Right to left": "Da Destra a Sinistra",
"Left to right": "Da Sinistra a Destra",
"Emoticons": "Emoction",
"Robots": "Robot",
"Document properties": "Propriet\u00e0 Documento",
"Title": "Titolo",
"Keywords": "Parola Chiave",
"Encoding": "Codifica",
"Description": "Descrizione",
"Author": "Autore",
"Fullscreen": "Schermo Intero",
"Horizontal line": "Linea Orizzontale",
"Horizontal space": "Spazio Orizzontale",
"Insert\/edit image": "Aggiungi\/Modifica Immagine",
"General": "Generale",
"Advanced": "Avanzato",
"Source": "Fonte",
"Border": "Bordo",
"Constrain proportions": "Mantieni Proporzioni",
"Vertical space": "Spazio Verticale",
"Image description": "Descrizione Immagine",
"Style": "Stile",
"Dimensions": "Dimenzioni",
"Insert image": "Inserisci immagine",
"Zoom in": "Ingrandisci",
"Contrast": "Contrasto",
"Back": "Indietro",
"Gamma": "Gamma",
"Flip horizontally": "Rifletti orizzontalmente",
"Resize": "Ridimensiona",
"Sharpen": "Contrasta",
"Zoom out": "Rimpicciolisci",
"Image options": "Opzioni immagine",
"Apply": "Applica",
"Brightness": "Luminosit\u00e0",
"Rotate clockwise": "Ruota in senso orario",
"Rotate counterclockwise": "Ruota in senso antiorario",
"Edit image": "Modifica immagine",
"Color levels": "Livelli colore",
"Crop": "Taglia",
"Orientation": "Orientamento",
"Flip vertically": "Rifletti verticalmente",
"Invert": "Inverti",
"Insert date\/time": "Inserisci Data\/Ora",
"Remove link": "Rimuovi link",
"Url": "Url",
"Text to display": "Testo da Visualizzare",
"Anchors": "Anchors",
"Insert link": "Inserisci il Link",
"New window": "Nuova Finestra",
"None": "No",
"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "L'URL inserito sembra essere un collegamento esterno. Vuoi aggiungere il prefisso necessario http:\/\/?",
"Target": "Target",
"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "L'URL inserito sembra essere un indirizzo email. Vuoi aggiungere il prefisso necessario mailto:?",
"Insert\/edit link": "Inserisci\/Modifica Link",
"Insert\/edit video": "Inserisci\/Modifica Video",
"Poster": "Anteprima",
"Alternative source": "Alternativo",
"Paste your embed code below:": "Incolla il codice d'incorporamento qui:",
"Insert video": "Inserisci Video",
"Embed": "Incorporare",
"Nonbreaking space": "Spazio unificatore",
"Page break": "Interruzione di pagina",
"Paste as text": "incolla come testo",
"Preview": "Anteprima",
"Print": "Stampa",
"Save": "Salva",
"Could not find the specified string.": "Impossibile trovare la parola specifica.",
"Replace": "Sostituisci",
"Next": "Successivo",
"Whole words": "Parole Sbagliate",
"Find and replace": "Trova e Sostituisci",
"Replace with": "Sostituisci Con",
"Find": "Trova",
"Replace all": "Sostituisci Tutto",
"Match case": "Maiuscole\/Minuscole ",
"Prev": "Precedente",
"Spellcheck": "Controllo ortografico",
"Finish": "Termina",
"Ignore all": "Ignora Tutto",
"Ignore": "Ignora",
"Add to Dictionary": "Aggiungi al Dizionario",
"Insert row before": "Inserisci una Riga Prima",
"Rows": "Righe",
"Height": "Altezza",
"Paste row after": "Incolla una Riga Dopo",
"Alignment": "Allineamento",
"Border color": "Colore bordo",
"Column group": "Gruppo di Colonne",
"Row": "Riga",
"Insert column before": "Inserisci una Colonna Prima",
"Split cell": "Dividi Cella",
"Cell padding": "Padding della Cella",
"Cell spacing": "Spaziatura della Cella",
"Row type": "Tipo di Riga",
"Insert table": "Inserisci Tabella",
"Body": "Body",
"Caption": "Didascalia",
"Footer": "Footer",
"Delete row": "Cancella Riga",
"Paste row before": "Incolla una Riga Prima",
"Scope": "Campo",
"Delete table": "Cancella Tabella",
"H Align": "Allineamento H",
"Top": "In alto",
"Header cell": "cella d'intestazione",
"Column": "Colonna",
"Row group": "Gruppo di Righe",
"Cell": "Cella",
"Middle": "In mezzo",
"Cell type": "Tipo di Cella",
"Copy row": "Copia Riga",
"Row properties": "Propriet\u00e0 della Riga",
"Table properties": "Propiet\u00e0 della Tabella",
"Bottom": "In fondo",
"V Align": "Allineamento V",
"Header": "Header",
"Right": "Destra",
"Insert column after": "Inserisci una Colonna Dopo",
"Cols": "Colonne",
"Insert row after": "Inserisci una Riga Dopo",
"Width": "Larghezza",
"Cell properties": "Propiet\u00e0 della Cella",
"Left": "Sinistra",
"Cut row": "Taglia Riga",
"Delete column": "Cancella Colonna",
"Center": "Centro",
"Merge cells": "Unisci Cella",
"Insert template": "Inserisci Template",
"Templates": "Template",
"Background color": "Colore Background",
"Custom...": "Personalizzato...",
"Custom color": "Colore personalizzato",
"No color": "Nessun colore",
"Text color": "Colore Testo",
"Show blocks": "Mostra Blocchi",
"Show invisible characters": "Mostra Caratteri Invisibili",
"Words: {0}": "Parole: {0}",
"Insert": "Inserisci",
"File": "File",
"Edit": "Modifica",
"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Rich Text Area. Premi ALT-F9 per il men\u00f9. Premi ALT-F10 per la barra degli strumenti. Premi ALT-0 per l'aiuto.",
"Tools": "Strumenti",
"View": "Visualizza",
"Table": "Tabella",
"Format": "Formato"
});
|
#ifndef DIFFUTILS_H
#define DIFFUTILS_H
#include "diffeditor_global.h"
#include <QString>
#include <QMap>
#include <QTextEdit>
#include "texteditor/texteditorconstants.h"
namespace TextEditor { class FontSettings; }
namespace DiffEditor {
class Diff;
class DIFFEDITOR_EXPORT DiffFileInfo {
public:
DiffFileInfo() {}
DiffFileInfo(const QString &file) : fileName(file) {}
DiffFileInfo(const QString &file, const QString &type)
: fileName(file), typeInfo(type) {}
QString fileName;
QString typeInfo;
};
class DIFFEDITOR_EXPORT TextLineData {
public:
enum TextLineType {
TextLine,
Separator,
Invalid
};
TextLineData() : textLineType(Invalid) {}
TextLineData(const QString &txt) : textLineType(TextLine), text(txt) {}
TextLineData(TextLineType t) : textLineType(t) {}
TextLineType textLineType;
QString text;
/*
* <start position, end position>
* <-1, n> means this is a continuation from the previous line
* <n, -1> means this will be continued in the next line
* <-1, -1> the whole line is a continuation (from the previous line to the next line)
*/
QMap<int, int> changedPositions; // counting from the beginning of the line
};
class DIFFEDITOR_EXPORT RowData {
public:
RowData() : equal(false) {}
RowData(const TextLineData &l)
: leftLine(l), rightLine(l), equal(true) {}
RowData(const TextLineData &l, const TextLineData &r)
: leftLine(l), rightLine(r), equal(false) {}
TextLineData leftLine;
TextLineData rightLine;
bool equal;
};
class DIFFEDITOR_EXPORT ChunkData {
public:
ChunkData() : contextChunk(false),
<API key>(0), <API key>(0) {}
QList<RowData> rows;
bool contextChunk;
int <API key>;
int <API key>;
QString contextInfo;
};
class DIFFEDITOR_EXPORT FileData {
public:
enum FileOperation {
ChangeFile,
NewFile,
DeleteFile,
CopyFile,
RenameFile
};
FileData()
: fileOperation(ChangeFile),
binaryFiles(false),
<API key>(false),
<API key>(false) {}
FileData(const ChunkData &chunkData)
: fileOperation(ChangeFile),
binaryFiles(false),
<API key>(false),
<API key>(false) { chunks.append(chunkData); }
QList<ChunkData> chunks;
DiffFileInfo leftFileInfo;
DiffFileInfo rightFileInfo;
FileOperation fileOperation;
bool binaryFiles;
bool <API key>;
bool <API key>;
};
class DIFFEDITOR_EXPORT DiffUtils {
public:
enum <API key> {
AddLevel = 0x1, // Add 'a/' , '/b' for git am
GitFormat = AddLevel | 0x2, // Add line 'diff ..' as git does
};
static ChunkData <API key>(const QList<Diff> &leftDiffList,
const QList<Diff> &rightDiffList);
static FileData <API key>(const ChunkData &originalData,
int contextLinesNumber,
int joinChunkThreshold = 1);
static QString makePatchLine(const QChar &startLineCharacter,
const QString &textLine,
bool lastChunk,
bool lastLine);
static QString makePatch(const ChunkData &chunkData,
bool lastChunk = false);
static QString makePatch(const ChunkData &chunkData,
const QString &leftFileName,
const QString &rightFileName,
bool lastChunk = false);
static QString makePatch(const QList<FileData> &fileDataList,
unsigned formatFlags = 0);
static QList<FileData> readPatch(const QString &patch,
bool *ok = 0);
};
} // namespace DiffEditor
#endif // DIFFUTILS_H
|
<html dir="LTR" xmlns:ndoc="urn:ndoc-schema">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="history" name="save" />
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5" />
<title>EntLibLogger Constructor</title>
<xml>
</xml>
<link rel="stylesheet" type="text/css" href="MSDN.css" />
</head>
<body id="bodyID" class="dtBODY">
<div id="nsbanner">
<div id="bannerrow1">
<table class="bannerparthead" cellspacing="0">
<tr id="hdr">
<td class="runninghead">Common Logging 2.0 API Reference</td>
<td class="product">
</td>
</tr>
</table>
</div>
<div id="TitleRow">
<h1 class="dtH1">EntLibLogger Constructor</h1>
</div>
</div>
<div id="nstext">
<p> Initializes a new instance of the <a href="Common.Logging.EntLib41~Common.Logging.EntLib.EntLibLogger.html">EntLibLogger</a> class. </p>
<div class="syntax">
<span class="lang">[Visual Basic]</span>
<br />Public Sub New( _<br /> ByVal <i>category</i> As <a href="">String</a>, _<br /> ByVal <i>logWriter</i> As <a href="">LogWriter</a>, _<br /> ByVal <i>settings</i> As <a href="Common.Logging.EntLib41~Common.Logging.EntLib.<API key>.html"><API key></a> _<br />)</div>
<div class="syntax">
<span class="lang">[C#]</span>
<br />
<a href="Common.Logging.EntLib41~Common.Logging.EntLib.EntLibLogger.html">EntLibLogger</a>(<br /> <a href="">string</a> <i>category</i>,<br /> <a href="">LogWriter</a> <i>logWriter</i>,<br /> <a href="Common.Logging.EntLib41~Common.Logging.EntLib.<API key>.html"><API key></a> <i>settings</i><br />);</div>
<h4 class="dtH4">Parameters</h4>
<dl>
<dt>
<i>category</i>
</dt>
<dd>The category.</dd>
<dt>
<i>logWriter</i>
</dt>
<dd>the <a href="Common.Logging.EntLib41~Common.Logging.EntLib.EntLibLogger.LogWriter.html">LogWriter</a> to write log events to.</dd>
<dt>
<i>settings</i>
</dt>
<dd>the logger settings</dd>
</dl>
<h4 class="dtH4">See Also</h4>
<p>
<a href="Common.Logging.EntLib41~Common.Logging.EntLib.EntLibLogger.html">EntLibLogger Class</a> | <a href="Common.Logging.EntLib41~Common.Logging.EntLib.html">Common.Logging.EntLib Namespace</a></p>
<object type="application/x-oleobject" classid="clsid:<API key>" viewastext="true" style="display: none;">
<param name="Keyword" value="EntLibLogger class, constructor
 ">
</param>
</object>
<hr />
<div id="footer">
<p>
<a href="mailto:netcommon-developer@lists.sourceforge.net?subject=Common%20Logging%202.0%20API%20Reference%20Documentation%20Feedback:%20EntLibLogger Constructor ">Send comments on this topic.</a>
</p>
<p>
<a>© The Common Infrastructure Libraries for .NET Team 2009 All Rights Reserved.</a>
</p>
<p>Generated from assembly Common.Logging.EntLib41 [2.0.0.0] by <a href="http://ndoc3.sourceforget.net">NDoc3</a></p>
</div>
</div>
</body>
</html>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.