text stringlengths 2 99k | meta dict |
|---|---|
<!DOCTYPE html>
<html lang="en">
<head>
<title>Other Protocols Reference</title>
<link rel="stylesheet" type="text/css" href="css/jazzy.css" />
<link rel="stylesheet" type="text/css" href="css/highlight.css" />
<meta charset='utf-8'>
<script src="js/jquery.min.js" defer></script>
<script src="js/jazzy.js" defer></script>
</head>
<body>
<a name="//apple_ref/swift/Section/Other Protocols" class="dashAnchor"></a>
<a title="Other Protocols Reference"></a>
<header>
<div class="content-wrapper">
<p><a href="index.html">AutoMate Docs</a> (100% documented)</p>
</div>
</header>
<div class="content-wrapper">
<p id="breadcrumbs">
<a href="index.html">AutoMate Reference</a>
<img id="carat" src="img/carat.png" />
Other Protocols Reference
</p>
</div>
<div class="content-wrapper">
<nav class="sidebar">
<ul class="nav-groups">
<li class="nav-group-name">
<a href="Guides.html">Guides</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/TestLauncher.html">TestLauncher</a>
</li>
<li class="nav-group-task">
<a href="system-arguments.html">System arguments</a>
</li>
<li class="nav-group-task">
<a href="custom-arguments.html">Custom arguments</a>
</li>
<li class="nav-group-task">
<a href="launch-environments.html">Launch environments</a>
</li>
<li class="nav-group-task">
<a href="automate-environments.html">AutoMate environments</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="XCTest.html">XCTest</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Classes/AppUITestCase.html">AppUITestCase</a>
</li>
<li class="nav-group-task">
<a href="Extensions/XCTestCase.html">XCTestCase</a>
</li>
<li class="nav-group-task">
<a href="Extensions/XCUIApplication.html">XCUIApplication</a>
</li>
<li class="nav-group-task">
<a href="Extensions/XCUIElement.html">XCUIElement</a>
</li>
<li class="nav-group-task">
<a href="Extensions/XCUIElementQuery.html">XCUIElementQuery</a>
</li>
<li class="nav-group-task">
<a href="Extensions/XCUIElementTypeQueryProvider.html">XCUIElementTypeQueryProvider</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Page objects.html">Page objects</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/BaseAppPageProtocol.html">BaseAppPageProtocol</a>
</li>
<li class="nav-group-task">
<a href="Classes/BaseAppPage.html">BaseAppPage</a>
</li>
<li class="nav-group-task">
<a href="Protocols/ModalPage.html">ModalPage</a>
</li>
<li class="nav-group-task">
<a href="Protocols/PushedPage.html">PushedPage</a>
</li>
<li class="nav-group-task">
<a href="Classes/HealthPermissionPage.html">HealthPermissionPage</a>
</li>
<li class="nav-group-task">
<a href="Classes/HealthPermissionPage/Locators.html">– Locators</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Locators.html">Locators</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/Locator.html">Locator</a>
</li>
<li class="nav-group-task">
<a href="Enums/KeyboardLocator.html">KeyboardLocator</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="System alerts.html">System alerts</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/SystemAlert.html">SystemAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/HealthAuthorizationDontAllowAlert.html">HealthAuthorizationDontAllowAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/LocationAlwaysAlert.html">LocationAlwaysAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/LocationUpgradeWhenInUseAlwaysAlert.html">LocationUpgradeWhenInUseAlwaysAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/LocationWhenInUseAlert.html">LocationWhenInUseAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/AddressBookAlert.html">AddressBookAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/BluetoothPeripheralAlert.html">BluetoothPeripheralAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/CalendarAlert.html">CalendarAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/CallsAlert.html">CallsAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/CameraAlert.html">CameraAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/MediaLibraryAlert.html">MediaLibraryAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/MicrophoneAlert.html">MicrophoneAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/MotionAlert.html">MotionAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/PhotosAlert.html">PhotosAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/RemindersAlert.html">RemindersAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/SiriAlert.html">SiriAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/SpeechRecognitionAlert.html">SpeechRecognitionAlert</a>
</li>
<li class="nav-group-task">
<a href="Structs/WillowAlert.html">WillowAlert</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Launch arguments.html">Launch arguments</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/SystemLanguages.html">SystemLanguages</a>
</li>
<li class="nav-group-task">
<a href="Structs/SystemLocale.html">SystemLocale</a>
</li>
<li class="nav-group-task">
<a href="Structs/SoftwareKeyboards.html">SoftwareKeyboards</a>
</li>
<li class="nav-group-task">
<a href="Structs/HardwareKeyboards.html">HardwareKeyboards</a>
</li>
<li class="nav-group-task">
<a href="Structs/SystemKeyboards.html">SystemKeyboards</a>
</li>
<li class="nav-group-task">
<a href="Enums/CoreDataOption.html">CoreDataOption</a>
</li>
<li class="nav-group-task">
<a href="Enums/CoreDataOption/VerbosityLevel.html">– VerbosityLevel</a>
</li>
<li class="nav-group-task">
<a href="Enums/CoreDataOption/DiskSyncing.html">– DiskSyncing</a>
</li>
<li class="nav-group-task">
<a href="Enums/LocalizedStrings.html">LocalizedStrings</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchArgument.html">LaunchArgument</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchArgumentWithSingleValue.html">LaunchArgumentWithSingleValue</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchArgumentWithMultipleValues.html">LaunchArgumentWithMultipleValues</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchArgumentValue.html">LaunchArgumentValue</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Launch environments.html">Launch environments</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/EventLaunchEnvironment.html">EventLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Structs/ReminderLaunchEnvironment.html">ReminderLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Structs/ContactLaunchEnvironment.html">ContactLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Structs/AnimationLaunchEnvironment.html">AnimationLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Structs/IsInUITestLaunchEnvironment.html">IsInUITestLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Protocols/AutoMateLaunchEnvironment.html">AutoMateLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Structs/LaunchEnvironment.html">LaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Structs/LaunchEnvironments.html">LaunchEnvironments</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchEnvironmentProtocol.html">LaunchEnvironmentProtocol</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchEnvironmentWithSingleValue.html">LaunchEnvironmentWithSingleValue</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchEnvironmentWithMultipleValues.html">LaunchEnvironmentWithMultipleValues</a>
</li>
<li class="nav-group-task">
<a href="Protocols/CleanableLaunchEnvironment.html">CleanableLaunchEnvironment</a>
</li>
<li class="nav-group-task">
<a href="Protocols/CleanableLaunchEnvironmentWithMultipleValues.html">CleanableLaunchEnvironmentWithMultipleValues</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchEnvironmentValue.html">LaunchEnvironmentValue</a>
</li>
<li class="nav-group-task">
<a href="Structs/LaunchEnvironmentResourceValue.html">LaunchEnvironmentResourceValue</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Other Enums.html">Other Enumerations</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Enums/AutoMateKey.html">AutoMateKey</a>
</li>
<li class="nav-group-task">
<a href="Enums/AvoidableElement.html">AvoidableElement</a>
</li>
<li class="nav-group-task">
<a href="Enums/BooleanLaunchArgumentValue.html">BooleanLaunchArgumentValue</a>
</li>
<li class="nav-group-task">
<a href="Enums/BooleanLaunchEnvironmentValue.html">BooleanLaunchEnvironmentValue</a>
</li>
<li class="nav-group-task">
<a href="Enums/DeviceType.html">DeviceType</a>
</li>
<li class="nav-group-task">
<a href="Enums/HardwareKeyboard.html">HardwareKeyboard</a>
</li>
<li class="nav-group-task">
<a href="Enums/SoftwareKeyboard.html">SoftwareKeyboard</a>
</li>
<li class="nav-group-task">
<a href="Enums/StringComparisonOperator.html">StringComparisonOperator</a>
</li>
<li class="nav-group-task">
<a href="Enums/SwipeDirection.html">SwipeDirection</a>
</li>
<li class="nav-group-task">
<a href="Enums/SystemCountry.html">SystemCountry</a>
</li>
<li class="nav-group-task">
<a href="Enums/SystemLanguage.html">SystemLanguage</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Other Extensions.html">Other Extensions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Extensions/Array.html">Array</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Bundle.html">Bundle</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Dictionary.html">Dictionary</a>
</li>
<li class="nav-group-task">
<a href="Extensions/RawRepresentable.html">RawRepresentable</a>
</li>
<li class="nav-group-task">
<a href="Extensions/Sequence.html">Sequence</a>
</li>
<li class="nav-group-task">
<a href="Extensions/String.html">String</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Other Functions.html">Other Functions</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Other Functions.html#/s:8AutoMate2eeoiySbAA16LaunchOptionsSetV_ADtF">==(_:_:)</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Other Protocols.html">Other Protocols</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Protocols/Application.html">Application</a>
</li>
<li class="nav-group-task">
<a href="Protocols/DescendantsMatching.html">DescendantsMatching</a>
</li>
<li class="nav-group-task">
<a href="Protocols/HealthAlertAllow.html">HealthAlertAllow</a>
</li>
<li class="nav-group-task">
<a href="Protocols/HealthAlertDeny.html">HealthAlertDeny</a>
</li>
<li class="nav-group-task">
<a href="Protocols/HealthAlertOk.html">HealthAlertOk</a>
</li>
<li class="nav-group-task">
<a href="Protocols/HealthAlertTurnOffAll.html">HealthAlertTurnOffAll</a>
</li>
<li class="nav-group-task">
<a href="Protocols/HealthAlertTurnOnAll.html">HealthAlertTurnOnAll</a>
</li>
<li class="nav-group-task">
<a href="Protocols/IdentifiableByElement.html">IdentifiableByElement</a>
</li>
<li class="nav-group-task">
<a href="Protocols/KeyboardLaunchArgument.html">KeyboardLaunchArgument</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LanguageLaunchArgument.html">LanguageLaunchArgument</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LaunchOption.html">LaunchOption</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocaleLaunchArgument.html">LocaleLaunchArgument</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocationAlertAllow.html">LocationAlertAllow</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocationAlertCancel.html">LocationAlertCancel</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocationAlertDeny.html">LocationAlertDeny</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocationAlertOk.html">LocationAlertOk</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocationAlwaysAlertAllow.html">LocationAlwaysAlertAllow</a>
</li>
<li class="nav-group-task">
<a href="Protocols/LocationAlwaysAlertAllowWhenInUseOnly.html">LocationAlwaysAlertAllowWhenInUseOnly</a>
</li>
<li class="nav-group-task">
<a href="Protocols/SystemAlertAllow.html">SystemAlertAllow</a>
</li>
<li class="nav-group-task">
<a href="Protocols/SystemAlertCancel.html">SystemAlertCancel</a>
</li>
<li class="nav-group-task">
<a href="Protocols/SystemAlertDeny.html">SystemAlertDeny</a>
</li>
<li class="nav-group-task">
<a href="Protocols/SystemAlertOk.html">SystemAlertOk</a>
</li>
<li class="nav-group-task">
<a href="Protocols/SystemMessages.html">SystemMessages</a>
</li>
</ul>
</li>
<li class="nav-group-name">
<a href="Other Structs.html">Other Structures</a>
<ul class="nav-group-tasks">
<li class="nav-group-task">
<a href="Structs/LaunchOptionsSet.html">LaunchOptionsSet</a>
</li>
<li class="nav-group-task">
<a href="Structs/PhotosAddAlert.html">PhotosAddAlert</a>
</li>
</ul>
</li>
</ul>
</nav>
<article class="main-content">
<section>
<section class="section">
<h1>Other Protocols</h1>
<p>The following protocols are available globally.</p>
</section>
<section class="section task-group-section">
<div class="task-group">
<div class="task-name-container">
<a name="/Health%20protocols"></a>
<a name="//apple_ref/swift/Section/Health protocols" class="dashAnchor"></a>
<a href="#/Health%20protocols">
<h3 class="section-name">Health protocols</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/HealthAlertOk" class="dashAnchor"></a>
<a class="token" href="#/">HealthAlertOk</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining health alert OK element.</p>
<a href="Protocols/HealthAlertOk.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Language"></a>
<a name="//apple_ref/swift/Section/Language" class="dashAnchor"></a>
<a href="#/Language">
<h3 class="section-name">Language</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate22LanguageLaunchArgumentP"></a>
<a name="//apple_ref/swift/Protocol/LanguageLaunchArgument" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate22LanguageLaunchArgumentP">LanguageLaunchArgument</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Application language.
More info: <a href="https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html">https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html</a></p>
<a href="Protocols/LanguageLaunchArgument.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LanguageLaunchArgument</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LaunchArgument.html">LaunchArgument</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Locale"></a>
<a name="//apple_ref/swift/Section/Locale" class="dashAnchor"></a>
<a href="#/Locale">
<h3 class="section-name">Locale</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate20LocaleLaunchArgumentP"></a>
<a name="//apple_ref/swift/Protocol/LocaleLaunchArgument" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate20LocaleLaunchArgumentP">LocaleLaunchArgument</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Application locale.
More info: <a href="https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html">https://developer.apple.com/library/ios/documentation/MacOSX/Conceptual/BPInternational/LanguageandLocaleIDs/LanguageandLocaleIDs.html</a></p>
<a href="Protocols/LocaleLaunchArgument.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LocaleLaunchArgument</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LaunchArgument.html">LaunchArgument</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Keyboard"></a>
<a name="//apple_ref/swift/Section/Keyboard" class="dashAnchor"></a>
<a href="#/Keyboard">
<h3 class="section-name">Keyboard</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate22KeyboardLaunchArgumentP"></a>
<a name="//apple_ref/swift/Protocol/KeyboardLaunchArgument" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate22KeyboardLaunchArgumentP">KeyboardLaunchArgument</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Application keyboard.</p>
<a href="Protocols/KeyboardLaunchArgument.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">KeyboardLaunchArgument</span> <span class="p">:</span> <span class="kt"><a href="Protocols/LaunchArgument.html">LaunchArgument</a></span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/LaunchOption%20protocol"></a>
<a name="//apple_ref/swift/Section/LaunchOption protocol" class="dashAnchor"></a>
<a href="#/LaunchOption%20protocol">
<h3 class="section-name">LaunchOption protocol</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate12LaunchOptionP"></a>
<a name="//apple_ref/swift/Protocol/LaunchOption" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate12LaunchOptionP">LaunchOption</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Any type that implements this protocol can be used to configure application
with TestLauncher. Type conforming to this protocol should override default implementation
of <em>launchArguments</em> or <em>launchEnvironments</em>. Choice depends on which type of configuration
option it represents.
For more info about launch arguments and environment variables check:
<a href="https://developer.apple.com/library/ios/recipes/xcode_help-scheme_editor/Articles/SchemeRun.html">here</a></p>
<a href="Protocols/LaunchOption.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">LaunchOption</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Location%20protocols"></a>
<a name="//apple_ref/swift/Section/Location protocols" class="dashAnchor"></a>
<a href="#/Location%20protocols">
<h3 class="section-name">Location protocols</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/LocationAlertAllow" class="dashAnchor"></a>
<a class="token" href="#/">LocationAlertAllow</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining location alert allow element.</p>
<a href="Protocols/LocationAlertAllow.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/LocationAlertDeny" class="dashAnchor"></a>
<a class="token" href="#/">LocationAlertDeny</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining location alert deny element.</p>
<a href="Protocols/LocationAlertDeny.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/LocationAlertOk" class="dashAnchor"></a>
<a class="token" href="#/">LocationAlertOk</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining location alert ok element.</p>
<a href="Protocols/LocationAlertOk.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/LocationAlertCancel" class="dashAnchor"></a>
<a class="token" href="#/">LocationAlertCancel</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining location alert cancel element.</p>
<a href="Protocols/LocationAlertCancel.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/LocationAlwaysAlertAllow" class="dashAnchor"></a>
<a class="token" href="#/">LocationAlwaysAlertAllow</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining location alert allow always element.</p>
<a href="Protocols/LocationAlwaysAlertAllow.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/LocationAlwaysAlertAllowWhenInUseOnly" class="dashAnchor"></a>
<a class="token" href="#/">LocationAlwaysAlertAllowWhenInUseOnly</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining location alert when in use only element.</p>
<a href="Protocols/LocationAlwaysAlertAllowWhenInUseOnly.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Health%20protocols2"></a>
<a name="//apple_ref/swift/Section/Health protocols" class="dashAnchor"></a>
<a href="#/Health%20protocols2">
<h3 class="section-name">Health protocols</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/HealthAlertAllow" class="dashAnchor"></a>
<a class="token" href="#/">HealthAlertAllow</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining health alert allow element and messages.</p>
<a href="Protocols/HealthAlertAllow.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/HealthAlertDeny" class="dashAnchor"></a>
<a class="token" href="#/">HealthAlertDeny</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining health alert deny element and messages.</p>
<a href="Protocols/HealthAlertDeny.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/HealthAlertTurnOffAll" class="dashAnchor"></a>
<a class="token" href="#/">HealthAlertTurnOffAll</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining health alert <q>turn off all</q> element and messages.</p>
<a href="Protocols/HealthAlertTurnOffAll.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/HealthAlertTurnOnAll" class="dashAnchor"></a>
<a class="token" href="#/">HealthAlertTurnOnAll</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining health alert <q>turn on all</q> element and messages.</p>
<a href="Protocols/HealthAlertTurnOnAll.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/System%20alert%20protocols"></a>
<a name="//apple_ref/swift/Section/System alert protocols" class="dashAnchor"></a>
<a href="#/System%20alert%20protocols">
<h3 class="section-name">System alert protocols</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/SystemAlertAllow" class="dashAnchor"></a>
<a class="token" href="#/">SystemAlertAllow</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining system alert allow element.</p>
<a href="Protocols/SystemAlertAllow.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/SystemAlertDeny" class="dashAnchor"></a>
<a class="token" href="#/">SystemAlertDeny</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining system alert deny element.</p>
<a href="Protocols/SystemAlertDeny.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/SystemAlertOk" class="dashAnchor"></a>
<a class="token" href="#/">SystemAlertOk</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining system alert ok element.</p>
<a href="Protocols/SystemAlertOk.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/SystemAlertCancel" class="dashAnchor"></a>
<a class="token" href="#/">SystemAlertCancel</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol defining system alert cancel element.</p>
<a href="Protocols/SystemAlertCancel.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/System%20Messages%20helper%20protocol"></a>
<a name="//apple_ref/swift/Section/System Messages helper protocol" class="dashAnchor"></a>
<a href="#/System%20Messages%20helper%20protocol">
<h3 class="section-name">System Messages helper protocol</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/"></a>
<a name="//apple_ref/swift/Protocol/SystemMessages" class="dashAnchor"></a>
<a class="token" href="#/">SystemMessages</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Helper protocol used to reads localized messages from JSON files.</p>
<a href="Protocols/SystemMessages.html" class="slightly-smaller">See more</a>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/Application"></a>
<a name="//apple_ref/swift/Section/Application" class="dashAnchor"></a>
<a href="#/Application">
<h3 class="section-name">Application</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate11ApplicationP"></a>
<a name="//apple_ref/swift/Protocol/Application" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate11ApplicationP">Application</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Types implementing this protocol can be configured with launch options and variables by the <code><a href="Structs/TestLauncher.html">TestLauncher</a></code>.</p>
<a href="Protocols/Application.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">Application</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<div class="task-name-container">
<a name="/IdentifiableByElement"></a>
<a name="//apple_ref/swift/Section/IdentifiableByElement" class="dashAnchor"></a>
<a href="#/IdentifiableByElement">
<h3 class="section-name">IdentifiableByElement</h3>
</a>
</div>
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate21IdentifiableByElementP"></a>
<a name="//apple_ref/swift/Protocol/IdentifiableByElement" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate21IdentifiableByElementP">IdentifiableByElement</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol used to identify object, eg. PageObject, in the view hierarchy.</p>
<p><strong>Example:</strong></p>
<pre class="highlight swift"><code><span class="kd">open</span> <span class="kd">class</span> <span class="kt">MainPage</span><span class="p">:</span> <span class="kt">BaseAppPage</span> <span class="p">{</span>
<span class="kd">open</span> <span class="k">var</span> <span class="nv">tableView</span><span class="p">:</span> <span class="kt">XCUIElement</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">view</span><span class="o">.</span><span class="n">tables</span><span class="p">[</span><span class="s">"tableView"</span><span class="p">]</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="kd">extension</span> <span class="kt">MainPage</span><span class="p">:</span> <span class="kt">IdentifiableByElement</span> <span class="p">{</span>
<span class="kd">public</span> <span class="k">var</span> <span class="nv">identifingElement</span><span class="p">:</span> <span class="kt">XCUIElement</span> <span class="p">{</span>
<span class="k">return</span> <span class="n">tableView</span>
<span class="p">}</span>
<span class="p">}</span>
</code></pre>
<a href="Protocols/IdentifiableByElement.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">IdentifiableByElement</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
<div class="task-group">
<ul>
<li class="item">
<div>
<code>
<a name="/s:8AutoMate19DescendantsMatchingP"></a>
<a name="//apple_ref/swift/Protocol/DescendantsMatching" class="dashAnchor"></a>
<a class="token" href="#/s:8AutoMate19DescendantsMatchingP">DescendantsMatching</a>
</code>
</div>
<div class="height-container">
<div class="pointer-container"></div>
<section class="section">
<div class="pointer"></div>
<div class="abstract">
<p>Protocol for types that implement <code>descendantsMatchingType</code> method.</p>
<a href="Protocols/DescendantsMatching.html" class="slightly-smaller">See more</a>
</div>
<div class="declaration">
<h4>Declaration</h4>
<div class="language">
<p class="aside-title">Swift</p>
<pre class="highlight swift"><code><span class="kd">public</span> <span class="kd">protocol</span> <span class="kt">DescendantsMatching</span></code></pre>
</div>
</div>
</section>
</div>
</li>
</ul>
</div>
</section>
</section>
<section id="footer">
<p>© 2019 <a class="link" href="https://github.com/PGSSoft/AutoMate" target="_blank" rel="external">Joanna Bednarz, Paweł Szot, Bartosz Janda, Paweł Kania, Michał Myśliwiec, Ewelina Cyło, and Mateusz Nicpoń</a>. All rights reserved. (Last updated: 2019-08-25)</p>
<p>Generated by <a class="link" href="https://github.com/realm/jazzy" target="_blank" rel="external">jazzy ♪♫ v0.10.0</a>, a <a class="link" href="https://realm.io" target="_blank" rel="external">Realm</a> project.</p>
</section>
</article>
</div>
</body>
</div>
</html>
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2016, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#ifndef ERIZO_SRC_ERIZO_PIPELINE_PIPELINE_H_
#define ERIZO_SRC_ERIZO_PIPELINE_PIPELINE_H_
#include <string>
#include <vector>
#include "pipeline/HandlerContext.h"
#include "pipeline/ServiceContext.h"
#include "./MediaDefinitions.h"
namespace erizo {
class PipelineBase;
class PipelineManager {
public:
virtual ~PipelineManager() = default;
virtual void deletePipeline(PipelineBase* pipeline) = 0;
virtual void refreshTimeout() {}
};
class PipelineBase : public std::enable_shared_from_this<PipelineBase> {
public:
virtual ~PipelineBase() = default;
void setPipelineManager(PipelineManager* manager) {
manager_ = manager;
}
PipelineManager* getPipelineManager() {
return manager_;
}
void deletePipeline() {
if (manager_) {
manager_->deletePipeline(this);
}
}
template <class H>
PipelineBase& addBack(std::shared_ptr<H> handler);
template <class H>
PipelineBase& addBack(H&& handler);
template <class H>
PipelineBase& addBack(H* handler);
template <class H>
PipelineBase& addFront(std::shared_ptr<H> handler);
template <class H>
PipelineBase& addFront(H&& handler);
template <class H>
PipelineBase& addFront(H* handler);
template <class H>
PipelineBase& remove(H* handler);
template <class H>
PipelineBase& remove();
PipelineBase& removeFront();
PipelineBase& removeBack();
template <class H>
H* getHandler(int i);
template <class H>
H* getHandler();
template <class H>
typename ContextType<H>::type* getContext(int i);
template <class H>
typename ContextType<H>::type* getContext();
template <class S>
void addService(std::shared_ptr<S> service);
template <class S>
void addService(S&& service);
template <class S>
void addService(S* service);
template <class S>
void removeService();
template <class S>
typename ServiceContextType<S>::type* getServiceContext();
template <class S>
std::shared_ptr<S> getService();
// If one of the handlers owns the pipeline itself, use setOwner to ensure
// that the pipeline doesn't try to detach the handler during destruction,
// lest destruction ordering issues occur.
// See thrift/lib/cpp2/async/Cpp2Channel.cpp for an example
template <class H>
bool setOwner(H* handler);
virtual void finalize() = 0;
protected:
template <class Context>
void addContextFront(Context* ctx);
void detachHandlers();
std::vector<std::shared_ptr<PipelineContext>> ctxs_;
std::vector<PipelineContext*> inCtxs_;
std::vector<PipelineContext*> outCtxs_;
std::vector<std::shared_ptr<PipelineServiceContext>> service_ctxs_;
private:
PipelineManager* manager_{nullptr};
template <class Context>
PipelineBase& addHelper(std::shared_ptr<Context>&& ctx, bool front); // NOLINT
template <class H>
PipelineBase& removeHelper(H* handler, bool checkEqual);
typedef std::vector<std::shared_ptr<PipelineContext>>::iterator
ContextIterator;
ContextIterator removeAt(const ContextIterator& it);
std::shared_ptr<PipelineContext> owner_;
};
/*
* R is the inbound type, i.e. inbound calls start with pipeline.read(R)
* W is the outbound type, i.e. outbound calls start with pipeline.write(W)
*
* Use Unit for one of the types if your pipeline is unidirectional.
* If R is Unit, read(), readEOF(), and readException() will be disabled.
* If W is Unit, write() and close() will be disabled.
*/
class Pipeline : public PipelineBase {
public:
using Ptr = std::shared_ptr<Pipeline>;
static Ptr create() {
return std::shared_ptr<Pipeline>(new Pipeline());
}
~Pipeline();
void read(std::shared_ptr<DataPacket> packet);
void readEOF();
void transportActive();
void transportInactive();
void write(std::shared_ptr<DataPacket> packet);
void close();
void finalize() override;
void notifyUpdate();
void notifyEvent(MediaEventPtr event);
void enable(std::string name);
void disable(std::string name);
protected:
Pipeline();
private:
InboundLink* front_{nullptr};
OutboundLink* back_{nullptr};
};
} // namespace erizo
#include <pipeline/Pipeline-inl.h>
#endif // ERIZO_SRC_ERIZO_PIPELINE_PIPELINE_H_
| {
"pile_set_name": "Github"
} |
# Gopkg.toml example
#
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
# for detailed Gopkg.toml documentation.
#
# required = ["github.com/user/thing/cmd/thing"]
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
#
# [[constraint]]
# name = "github.com/user/project"
# version = "1.0.0"
#
# [[constraint]]
# name = "github.com/user/project2"
# branch = "dev"
# source = "github.com/myfork/project2"
#
# [[override]]
# name = "github.com/x/y"
# version = "2.4.0"
ignored = ["github.com/davecgh/go-spew*","github.com/google/gofuzz*","github.com/stretchr/testify*"]
[[constraint]]
name = "github.com/modern-go/reflect2"
version = "1.0.1"
| {
"pile_set_name": "Github"
} |
#ifndef BOOST_MPL_BITOR_HPP_INCLUDED
#define BOOST_MPL_BITOR_HPP_INCLUDED
// Copyright Aleksey Gurtovoy 2000-2009
// Copyright Jaap Suter 2003
//
// 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/mpl for documentation.
// $Id$
// $Date$
// $Revision$
// agurt, 23/jan/10: workaround a conflict with <iso646.h> header's
// macros, see http://tinyurl.com/ycwdxco; 'defined(bitor)'
// has to be checked in a separate condition, otherwise GCC complains
// about 'bitor' being an alternative token
#if defined(_MSC_VER) && !defined(__clang__)
#ifndef __GCCXML__
#if defined(bitor)
# pragma push_macro("bitor")
# undef bitor
# define bitor(x)
#endif
#endif
#endif
#define AUX778076_OP_NAME bitor_
#define AUX778076_OP_PREFIX bitor
#define AUX778076_OP_TOKEN |
#include <boost/mpl/aux_/arithmetic_op.hpp>
#if defined(_MSC_VER) && !defined(__clang__)
#ifndef __GCCXML__
#if defined(bitor)
# pragma pop_macro("bitor")
#endif
#endif
#endif
#endif // BOOST_MPL_BITOR_HPP_INCLUDED
| {
"pile_set_name": "Github"
} |
<resources>
<style name="AppTheme.NoActionBar">
<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
</style>
</resources>
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2013, 2014 Megion Research and Development GmbH
*
* Licensed under the Microsoft Reference Source License (MS-RSL)
*
* This license governs use of the accompanying software. If you use the software, you accept this license.
* If you do not accept the license, do not use the software.
*
* 1. Definitions
* The terms "reproduce," "reproduction," and "distribution" have the same meaning here as under U.S. copyright law.
* "You" means the licensee of the software.
* "Your company" means the company you worked for when you downloaded the software.
* "Reference use" means use of the software within your company as a reference, in read only form, for the sole purposes
* of debugging your products, maintaining your products, or enhancing the interoperability of your products with the
* software, and specifically excludes the right to distribute the software outside of your company.
* "Licensed patents" means any Licensor patent claims which read directly on the software as distributed by the Licensor
* under this license.
*
* 2. Grant of Rights
* (A) Copyright Grant- Subject to the terms of this license, the Licensor grants you a non-transferable, non-exclusive,
* worldwide, royalty-free copyright license to reproduce the software for reference use.
* (B) Patent Grant- Subject to the terms of this license, the Licensor grants you a non-transferable, non-exclusive,
* worldwide, royalty-free patent license under licensed patents for reference use.
*
* 3. Limitations
* (A) No Trademark License- This license does not grant you any rights to use the Licensor’s name, logo, or trademarks.
* (B) If you begin patent litigation against the Licensor over patents that you think may apply to the software
* (including a cross-claim or counterclaim in a lawsuit), your license to the software ends automatically.
* (C) The software is licensed "as-is." You bear the risk of using it. The Licensor gives no express warranties,
* guarantees or conditions. You may have additional consumer rights under your local laws which this license cannot
* change. To the extent permitted under your local laws, the Licensor excludes the implied warranties of merchantability,
* fitness for a particular purpose and non-infringement.
*/
package com.mycelium.wallet;
import com.mrd.bitlib.model.NetworkParameters;
import com.mycelium.net.HttpEndpoint;
import com.mycelium.net.HttpsEndpoint;
import com.mycelium.net.ServerEndpoints;
import com.mycelium.net.TorHttpsEndpoint;
import com.mycelium.wallet.activity.util.BlockExplorer;
import com.mycelium.wallet.external.BuySellServiceDescriptor;
import com.mycelium.wallet.external.LocalTraderServiceDescription;
import com.mycelium.wallet.external.SepaServiceDescription;
import com.mycelium.wallet.external.SimplexServiceDescription;
import com.mycelium.wapi.wallet.btc.coins.BitcoinTest;
import com.mycelium.wapi.wallet.eth.coins.EthTest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class MbwTestEnvironment extends MbwEnvironment {
@Override
public NetworkParameters getNetwork() {
return NetworkParameters.testNetwork;
}
/**
* Local Trader API for testnet
*/
private static final ServerEndpoints testnetLtEndpoints = new ServerEndpoints(new HttpEndpoint[]{
new HttpsEndpoint("https://mws30.mycelium.com/lttestnet", "ED:C2:82:16:65:8C:4E:E1:C7:F6:A2:2B:15:EC:30:F9:CD:48:F8:DB"),
new TorHttpsEndpoint("https://grrhi6bwwpiarsfl.onion/lttestnet", "D0:09:70:40:98:71:E0:0E:62:08:1A:36:4C:BC:C7:2E:51:40:50:4C"),
});
@Override
public ServerEndpoints getLtEndpoints() {
return testnetLtEndpoints;
}
/**
* Wapi
*/
private static final ServerEndpoints testnetWapiEndpoints = new ServerEndpoints(new HttpEndpoint[]{
new HttpsEndpoint("https://mws30.mycelium.com/wapitestnet", "ED:C2:82:16:65:8C:4E:E1:C7:F6:A2:2B:15:EC:30:F9:CD:48:F8:DB"),
new TorHttpsEndpoint("https://ti4v3ipng2pqutby.onion/wapitestnet", "75:3E:8A:87:FA:95:9F:C6:1A:DB:2A:09:43:CE:52:74:27:B1:80:4B"),
});
@Override
public ServerEndpoints getWapiEndpoints() {
return testnetWapiEndpoints;
}
/**
* Available BlockExplorers
* <p>
* The first is the default block explorer if the requested one is not available
*/
private static final Map<String, List<BlockExplorer>> testnetExplorerClearEndpoints = new HashMap<String, List<BlockExplorer>>() {
{
put(BitcoinTest.get().getName(), new ArrayList<BlockExplorer>() {{
add(new BlockExplorer("SBT", "smartbit", "https://testnet.smartbit.com.au/address/", "https://testnet.smartbit.com.au/tx/", null, null));
add(new BlockExplorer("BTL", "blockTrail", "https://www.blocktrail.com/tBTC/address/", "https://www.blocktrail.com/tBTC/tx/", null, null));
add(new BlockExplorer("BPY", "BitPay", "https://test-insight.bitpay.com/address/", "https://test-insight.bitpay.com/tx/", null, null));
add(new BlockExplorer("BEX", "blockExplorer", "http://blockexplorer.com/testnet/address/", "https://blockexplorer.com/testnet/tx/", null, null));
add(new BlockExplorer("BCY", "blockCypher", "https://live.blockcypher.com/btc-testnet/address/", "https://live.blockcypher.com/btc-testnet/tx/", null, null));
}});
put(EthTest.INSTANCE.getName(), new ArrayList<BlockExplorer>() {{
add(new BlockExplorer("ETS", "etherscan.io", "https://ropsten.etherscan.io/address/", "https://ropsten.etherscan.io/tx/0x", null, null));
}});
}
};
public Map<String, List<BlockExplorer>> getBlockExplorerMap() {
return new HashMap<>(testnetExplorerClearEndpoints);
}
public List<BuySellServiceDescriptor> getBuySellServices() {
return new ArrayList<BuySellServiceDescriptor>() {{
add(new SimplexServiceDescription());
add(new SepaServiceDescription());
add(new LocalTraderServiceDescription());
}};
}
}
| {
"pile_set_name": "Github"
} |
/**
* Return a themed set of status and/or error messages. The messages are grouped
* by type.
*
* @param \$display
* (optional) Set to 'status' or 'error' to display only messages of that type.
*
* @return
* A string containing the messages.
*/
function <?php print $basename; ?>_status_messages(\$display = NULL) {
\$output = '';
foreach (drupal_get_messages(\$display) as \$type => \$messages) {
\$output .= "<div class=\"messages \$type\">\n";
if (count(\$messages) > 1) {
\$output .= " <ul>\n";
foreach (\$messages as \$message) {
\$output .= ' <li>'. \$message ."</li>\n";
}
\$output .= " </ul>\n";
}
else {
\$output .= \$messages[0];
}
\$output .= "</div>\n";
}
return \$output;
}
$1 | {
"pile_set_name": "Github"
} |
using System;
using FlubuCore.Context;
using FlubuCore.Tasks;
using Xunit;
namespace FlubuCore.Tests.Tasks
{
public class DoTaskTests : TaskUnitTestBase
{
[Fact]
public void NewDoTask_DefaultTaskName_IsMethodName()
{
var task = new DoTaskForTests(SomeMethodName);
Assert.Equal("SomeMethodName", task.GetTaskName());
}
[Fact]
public void NewDoTask_DefaultTaskNameAnonymousMethod_IsMethodName()
{
var task = new DoTaskForTests((c) => { return; });
Assert.Equal("<NewDoTask_DefaultTaskNameAnonymousMethod_IsMethodName>b__1_0", task.GetTaskName());
}
private void SomeMethodName(ITaskContext context)
{
}
}
public class DoTaskForTests : DoTask
{
public DoTaskForTests(Action<ITaskContextInternal> taskAction)
: base(taskAction)
{
}
public string GetTaskName()
{
return TaskName;
}
}
}
| {
"pile_set_name": "Github"
} |
package com.example.nanchen.aiyaschoolpush.ui.fragment;
import android.app.Activity;
import android.content.ClipData;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.media.ThumbnailUtils;
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Toast;
import com.example.nanchen.aiyaschoolpush.R;
import com.example.nanchen.aiyaschoolpush.ui.activity.ContextMenuActivity;
import com.example.nanchen.aiyaschoolpush.ui.activity.ImageGridActivity;
import com.example.nanchen.aiyaschoolpush.ui.activity.VideoCallActivity;
import com.example.nanchen.aiyaschoolpush.ui.activity.VoiceCallActivity;
import com.example.nanchen.aiyaschoolpush.im.Constant;
import com.example.nanchen.aiyaschoolpush.im.EmojiconExampleGroupData;
import com.example.nanchen.aiyaschoolpush.ui.view.ChatRowVoiceCall;
import com.hyphenate.chat.EMClient;
import com.hyphenate.chat.EMMessage;
import com.hyphenate.chat.EMTextMessageBody;
import com.hyphenate.easeui.EaseConstant;
import com.hyphenate.easeui.ui.EaseChatFragment;
import com.hyphenate.easeui.ui.EaseChatFragment.EaseChatFragmentHelper;
import com.hyphenate.easeui.widget.chatrow.EaseChatRow;
import com.hyphenate.easeui.widget.chatrow.EaseCustomChatRowProvider;
import com.hyphenate.easeui.widget.emojicon.EaseEmojiconMenu;
import com.hyphenate.util.PathUtil;
import java.io.File;
import java.io.FileOutputStream;
/**
* @author nanchen
* @fileName AiYaSchoolPush
* @packageName com.example.nanchen.aiyaschoolpush.fragment
* @date 2016/10/28 15:27
*/
public class NewChatFragment extends EaseChatFragment implements EaseChatFragmentHelper{
// constant start from 11 to avoid conflict with constant in base class
private static final int ITEM_VIDEO = 11;
private static final int ITEM_FILE = 12;
private static final int ITEM_VOICE_CALL = 13;
private static final int ITEM_VIDEO_CALL = 14;
private static final int REQUEST_CODE_SELECT_VIDEO = 11;
private static final int REQUEST_CODE_SELECT_FILE = 12;
private static final int REQUEST_CODE_GROUP_DETAIL = 13;
private static final int REQUEST_CODE_CONTEXT_MENU = 14;
private static final int REQUEST_CODE_SELECT_AT_USER = 15;
private static final int MESSAGE_TYPE_SENT_VOICE_CALL = 1;
private static final int MESSAGE_TYPE_RECV_VOICE_CALL = 2;
private static final int MESSAGE_TYPE_SENT_VIDEO_CALL = 3;
private static final int MESSAGE_TYPE_RECV_VIDEO_CALL = 4;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
return super.onCreateView(inflater, container, savedInstanceState);
}
@Override
protected void setUpView() {
super.setUpView();
((EaseEmojiconMenu)inputMenu.getEmojiconMenu()).addEmojiconGroup(EmojiconExampleGroupData.getData());
}
@Override
protected void registerExtendMenuItem() {
super.registerExtendMenuItem();
inputMenu.registerExtendMenuItem(R.string.attach_video, R.drawable.em_chat_video_selector, ITEM_VIDEO, extendMenuItemClickListener);
inputMenu.registerExtendMenuItem(R.string.attach_file, R.drawable.em_chat_file_selector, ITEM_FILE, extendMenuItemClickListener);
if(chatType == Constant.CHATTYPE_SINGLE){
inputMenu.registerExtendMenuItem(R.string.attach_voice_call, R.drawable.em_chat_voice_call_selector, ITEM_VOICE_CALL, extendMenuItemClickListener);
inputMenu.registerExtendMenuItem(R.string.attach_video_call, R.drawable.em_chat_video_call_selector, ITEM_VIDEO_CALL, extendMenuItemClickListener);
}
}
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == REQUEST_CODE_CONTEXT_MENU) {
switch (resultCode) {
case ContextMenuActivity.RESULT_CODE_COPY: // copy
clipboard.setPrimaryClip(ClipData.newPlainText(null,
((EMTextMessageBody) contextMenuMessage.getBody()).getMessage()));
break;
case ContextMenuActivity.RESULT_CODE_DELETE: // delete
conversation.removeMessage(contextMenuMessage.getMsgId());
messageList.refresh();
break;
default:
break;
}
}
if(resultCode == Activity.RESULT_OK){
switch (requestCode) {
case REQUEST_CODE_SELECT_VIDEO: //send the video
if (data != null) {
int duration = data.getIntExtra("dur", 0);
String videoPath = data.getStringExtra("path");
File file = new File(PathUtil.getInstance().getImagePath(), "thvideo" + System.currentTimeMillis());
try {
FileOutputStream fos = new FileOutputStream(file);
Bitmap ThumbBitmap = ThumbnailUtils.createVideoThumbnail(videoPath, 3);
ThumbBitmap.compress(CompressFormat.JPEG, 100, fos);
fos.close();
sendVideoMessage(videoPath, file.getAbsolutePath(), duration);
} catch (Exception e) {
e.printStackTrace();
}
}
break;
case REQUEST_CODE_SELECT_FILE: //send the file
if (data != null) {
Uri uri = data.getData();
if (uri != null) {
sendFileByUri(uri);
}
}
break;
//end of red packet code
default:
break;
}
}
}
@Override
public boolean onExtendMenuItemClick(int itemId, View view) {
switch (itemId) {
case ITEM_VIDEO:
Intent intent = new Intent(getActivity(), ImageGridActivity.class);
startActivityForResult(intent, REQUEST_CODE_SELECT_VIDEO);
break;
case ITEM_FILE: //file
selectFileFromLocal();
break;
case ITEM_VOICE_CALL:
startVoiceCall();
break;
case ITEM_VIDEO_CALL:
startVideoCall();
break;
//end of red packet code
default:
break;
}
//keep exist extend menu
return false;
}
/**
* select file
*/
protected void selectFileFromLocal() {
Intent intent = null;
if (Build.VERSION.SDK_INT < 19) { //api 19 and later, we can't use this way, demo just select from images
intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
} else {
intent = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
}
startActivityForResult(intent, REQUEST_CODE_SELECT_FILE);
}
/**
* make a voice call
*/
protected void startVoiceCall() {
if (!EMClient.getInstance().isConnected()) {
Toast.makeText(getActivity(), R.string.not_connect_to_server, Toast.LENGTH_SHORT).show();
} else {
startActivity(new Intent(getActivity(), VoiceCallActivity.class).putExtra("username", toChatUsername)
.putExtra("isComingCall", false));
// voiceCallBtn.setEnabled(false);
inputMenu.hideExtendMenuContainer();
}
}
/**
* make a video call
*/
protected void startVideoCall() {
if (!EMClient.getInstance().isConnected())
Toast.makeText(getActivity(), R.string.not_connect_to_server, Toast.LENGTH_SHORT).show();
else {
startActivity(new Intent(getActivity(), VideoCallActivity.class).putExtra("username", toChatUsername)
.putExtra("isComingCall", false));
// videoCallBtn.setEnabled(false);
inputMenu.hideExtendMenuContainer();
}
}
@Override
public void onSetMessageAttributes(EMMessage message) {
}
@Override
public void onEnterToChatDetails() {
}
@Override
public void onAvatarClick(String username) {
}
@Override
public void onAvatarLongClick(String username) {
}
@Override
public boolean onMessageBubbleClick(EMMessage message) {
// 消息框点击事件
return false;
}
@Override
public void onMessageBubbleLongClick(EMMessage message) {
// no message forward when in chat room
startActivityForResult((new Intent(getActivity(), ContextMenuActivity.class)).putExtra("message",message)
.putExtra("ischatroom", chatType == EaseConstant.CHATTYPE_CHATROOM),
REQUEST_CODE_CONTEXT_MENU);
}
@Override
public EaseCustomChatRowProvider onSetCustomChatRowProvider() {
return new CustomChatRowProvider();
}
/**
* chat row provider
*
*/
private final class CustomChatRowProvider implements EaseCustomChatRowProvider {
@Override
public int getCustomChatRowTypeCount() {
//here the number is the message type in EMMessage::Type
//which is used to count the number of different chat row
return 10;
}
@Override
public int getCustomChatRowType(EMMessage message) {
if(message.getType() == EMMessage.Type.TXT){
//voice call
if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false)){
return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VOICE_CALL : MESSAGE_TYPE_SENT_VOICE_CALL;
}else if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)){
//video call
return message.direct() == EMMessage.Direct.RECEIVE ? MESSAGE_TYPE_RECV_VIDEO_CALL : MESSAGE_TYPE_SENT_VIDEO_CALL;
}
}
return 0;
}
@Override
public EaseChatRow getCustomChatRow(EMMessage message, int position, BaseAdapter adapter) {
if(message.getType() == EMMessage.Type.TXT){
// voice call or video call
if (message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VOICE_CALL, false) ||
message.getBooleanAttribute(Constant.MESSAGE_ATTR_IS_VIDEO_CALL, false)){
return new ChatRowVoiceCall(getActivity(), message, position, adapter);
}
}
return null;
}
}
}
| {
"pile_set_name": "Github"
} |
# Copyright (c) 2019, 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 3 only, as
# published by the Free Software Foundation.
#
# 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 3 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
# 3 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.
# Contains unit-tests of the individual R API functions
printCallPreffix <- function() {
width <- 80L
name <- substr(deparse(sys.call(-1), width)[[1L]], 1, width)
cat(name, paste(rep('.', width + 3L - nchar(name)), collapse=''))
}
assertEquals <- function(expected, actual) {
printCallPreffix()
cat(if (identical(expected, actual)) 'pass' else 'fail', '\n')
}
assertTrue <- function(value) {
printCallPreffix()
cat(if (value) 'pass' else 'fail', '\n')
}
ignore <- function(...) {}
library(testrffi)
# ---------------------------------------------------------------------------------------
# SET_ATTRIB
x <- c(1,3,10)
assertEquals(NULL, api.SET_ATTRIB(x, pairlist(names=c('a','b','q'))))
assertEquals(c('a','b','q'), names(x))
# there is no validation
x <- c(1,3,10)
assertEquals(NULL, api.SET_ATTRIB(x, as.pairlist(list(names=c('a','b')))))
assertEquals(c('a','b'), names(x))
# note: printing x on GNU-R causes segfault
# ---------------------------------------------------------------------------------------
# Rf_mkCharLenCE, note: last arg is encoding and 0 ~ native encoding
assertEquals("hello world", api.Rf_mkCharLenCE("hello world", 11, 0))
ignore("FastR bug", assertEquals("hello", api.Rf_mkCharLenCE("hello this will be cut away", 5, 0)))
# ----------------------------------------------------------------------------------------
# Rf_eval
bar <- function(x) typeof(x)
lang <- quote(bar(x))
lang[[2L]] <- as.pairlist(1)
# lang will be call to "bar" with a pairlist as the argument -- the pairlist is interpreted as the value
assertEquals("pairlist", api.Rf_eval(lang, new.env()))
lang[[2L]] <- quote(1)
# lang will be call to "bar" with "language(1)" as the argument -- the language object is "executed"
assertEquals("double", api.Rf_eval(lang, new.env()))
# ----------------------------------------------------------------------------------------
# Rf_asS4
v <- c(1,2,3)
assertEquals(0L, api.IS_S4_OBJECT(v))
v <- api.Rf_asS4(v, TRUE, 0)
# GnuR returns 16, FastR returns 1
assertTrue(api.IS_S4_OBJECT(v) > 0)
# ----------------------------------------------------------------------------------------
# PRENV: gives environment associated with given promise object
# tricky thing in FastR is that we attempt to optimize promises
getDotsPrenvC <- load.Call(function(env) '
SEXP dots = Rf_findVar(install("..."), env);
assert_equal_i(TYPEOF(CAR(dots)), 5); // PROMSXP
return PRENV(CAR(dots));
')
getDotsPrenv <- function(...) getDotsPrenvC(environment())
assertEquals(globalenv(), getDotsPrenv(2L + 1L)) # expression
assertEquals(globalenv(), getDotsPrenv(var)) # variable lookup
assertEquals(globalenv(), getDotsPrenv(2L)) # constant
assertEquals(globalenv(), getDotsPrenv(bar())) # call
# ----------------------------------------------------------------------------------------
# PRIMFUN: dispatches a call to a primitive function. This test uses the fact that FastR
# accepts any R function, not only primite ones. There is no GNUR counterpart of this test
# as it would be quite difficult to use PRIMFUN that is defined as a macro in Defn.h that
# is not available for non-internal packages, such as testrffi.
if (!is.null(version$engine) && version$engine=="FastR") {
f1 <- function(x) x + 1
res <- rffi.testPRIMFUN(f1, pairlist(1))
assertEquals(2, res)
} else {
# A fake assertion in GNU-R
res <- 2
assertEquals(2, res)
}
# ----------------------------------------------------------------------------------------
# .C downcall interface
dotC <- load.C(function(a = 'int*', b = 'double*') '
assert_equal_i(a[0], 33);
assert_equal_i(b[0], 2);
a[0] = 42;
b[0] = 42;
')
nontempA <- 33L
nontempB <- 2.0
res <- dotC(a = nontempA, b = nontempB)
assertEquals(list(a = 42L, b = 42), res) # result has names and correct values
assertEquals(33L, nontempA) # original vectors were not modified
assertEquals(2.0, nontempB) # original vectors were not modified
# non-vectors are passed as SEXPs to the .C and .Fortran interfaces
# some seem to be supported: environments, closures
# some produce deprecation warning: external pointers, symbols, expressions, language, ...
dotC <- load.C(function(x = 'void*', res = 'int*') 'res[0] = TYPEOF((SEXP) x);')
dummy <- 1L
res <- dotC(new.env(), res = dummy)
assertEquals(4L, res$res) # environment
res <- dotC(function() 42L, res = dummy)
assertEquals(3L, res$res) # function
# lists: data pointer is passed to the native function
dotC <- load.C(function(list = 'void*', res = 'int*') '
res[0] = TYPEOF(((SEXP*) list)[0]); // type of the first SEXP in the list
')
dummy <- 1L
assertEquals(13L, dotC(list(2L), res = dummy)$res)
assertEquals(14L, dotC(list(0.5), res = dummy)$res)
# ----------------------------------------------------------------------------------------
# .Call downcall interface
dotCall <- load.Call(function(intv, realv, fun, str) '
assert_equal_i(TYPEOF(intv), 13);
assert_equal_i(TYPEOF(realv), 14);
assert_equal_i(TYPEOF(fun), 3);
assert_equal_i(TYPEOF(str), 16);
if (INTEGER(intv)[0] == 42) return realv;
else return str;
')
res <- dotCall(42L, 3.14, function() 42L, 'foo')
assertEquals(3.14, res)
res <- dotCall(1L, 3.14, function() 42L, 'foo')
assertEquals('foo', res)
# ----------------------------------------------------------------------------------------
# .External downcall interface
fun <- load.External('
assert_equal_i(TYPEOF(args), 2 /*pairlist*/);
assert_equal_i(TYPEOF(CAR(args)), 16 /*character: name of the C function*/);
return args; // checked on the R side...
')
actual_args <- fun('bar', arg1 = 'foo', arg2 = 42L)
assertEquals('pairlist', typeof(actual_args))
assertEquals('character', typeof(actual_args[[1L]])) # 1st argument should be the name of the native function
assertEquals(list('bar', arg1 = 'foo', arg2 = 42L), as.list(actual_args[-1L]))
# ----------------------------------------------------------------------------------------
# .External2 downcall interface
fun <- load.External2('
SEXP res;
PROTECT(res = allocVector(VECSXP, 4));
SET_VECTOR_ELT(res, 0, call);
SET_VECTOR_ELT(res, 1, op);
SET_VECTOR_ELT(res, 2, args);
SET_VECTOR_ELT(res, 3, rho);
UNPROTECT(1);
return res; // checked on the R side...
')
all_args <- fun('bar', arg1 = 'foo', arg2 = 42L)
# call: should be language object .External2(name, ...)
# ignored: FastR passes string "call" relying on that fact that it is useless anyone and no-one relies on that
ignore(assertEquals('language', typeof(all_args[[1L]])))
ignore(assertEquals(as.symbol('.External2'), all_args[[1L]][[1L]]))
assertEquals('builtin', typeof(all_args[[2L]])) # op
assertEquals('pairlist', typeof(all_args[[3L]])) # args: the same as with .External
actual_args <- all_args[[3L]]
assertEquals('character', typeof(actual_args[[1L]])) # 1st argument should be the name of the native function
assertEquals(list('bar', arg1 = 'foo', arg2 = 42L), as.list(actual_args[-1L]))
assertEquals('environment', typeof(all_args[[4L]])) # rho: calling environment
# ----------------------------------------------------------------------------------------
# Downcall interfaces: call via external ptr and via the NativeSymbolInfo -- requires native functions declated in a package
# Note: in case of GNU-R the external ptr is actually a pointer to R_RegisteredNativeSymbol, not to the C function itself
# In case of External and External2, the first object in the args pair-list is the handle: i.e. external ptr or list of class NativeSymbolInfo
fun <- function() 42L
for (handle in list(testrffi:::C_rapi_dotC$address, testrffi:::C_rapi_dotC)) {
res <- .C(handle, arg1 = 42L, arg2 = 3.14, fun)
assertEquals(list(arg1 = 1L, arg2 = 0.5, fun), res)
}
for (handle in list(testrffi:::C_rapi_dotCall$address, testrffi:::C_rapi_dotCall)) {
res <- .Call(handle, arg1 = 42L, new.env())
assertEquals(13L + 4L, res) # TYPEOF(int) + TYPEOF(env)
}
for (handle in list(testrffi:::C_rapi_dotExternal$address, testrffi:::C_rapi_dotExternal)) {
args <- .External(handle, 'bar', arg1 = 'foo', arg2 = 42L)
assertEquals('pairlist', typeof(args))
assertEquals(list(handle, 'bar', arg1 = 'foo', arg2 = 42L), as.list(args))
}
for (handle in list(testrffi:::C_rapi_dotExternal2$address, testrffi:::C_rapi_dotExternal2)) {
args <- .External2(handle, 'bar', arg1 = 'foo', arg2 = 42L)
assertEquals('pairlist', typeof(args))
assertEquals(list(handle, 'bar', arg1 = 'foo', arg2 = 42L), as.list(args))
}
| {
"pile_set_name": "Github"
} |
<div class="refentry" lang="en" xml:lang="en"><a id="glTexImage3D"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glTexImage3D — specify a three-dimensional texture image</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table><tr><td><code class="funcdef">void <b class="fsfunc">glTexImage3D</b>(</code></td><td>GLenum </td><td><var class="pdparam">target</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">level</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">internalFormat</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">width</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">height</var>, </td></tr><tr><td> </td><td>GLsizei </td><td><var class="pdparam">depth</var>, </td></tr><tr><td> </td><td>GLint </td><td><var class="pdparam">border</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">format</var>, </td></tr><tr><td> </td><td>GLenum </td><td><var class="pdparam">type</var>, </td></tr><tr><td> </td><td>const GLvoid * </td><td><var class="pdparam">data</var><code>)</code>;</td></tr></table></div></div><p>
</p><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>target</code></em></span></dt><dd><p>
Specifies the target texture.
Must be <code class="constant">GL_TEXTURE_3D</code> or <code class="constant">GL_PROXY_TEXTURE_3D</code>.
</p></dd><dt><span class="term"><em class="parameter"><code>level</code></em></span></dt><dd><p>
Specifies the level-of-detail number.
Level 0 is the base image level.
Level
<math overflow="scroll"><mi mathvariant="italic">n</mi></math>
is the
<math overflow="scroll">
<msup><mi mathvariant="italic">n</mi>
<mi mathvariant="italic">th</mi>
</msup>
</math>
mipmap reduction image.
</p></dd><dt><span class="term"><em class="parameter"><code>internalFormat</code></em></span></dt><dd><p>
Specifies the number of color components in the texture.
Must be 1, 2, 3, or 4, or one of the following symbolic constants:
<code class="constant">GL_ALPHA</code>,
<code class="constant">GL_ALPHA4</code>,
<code class="constant">GL_ALPHA8</code>,
<code class="constant">GL_ALPHA12</code>,
<code class="constant">GL_ALPHA16</code>,
<code class="constant">GL_COMPRESSED_ALPHA</code>,
<code class="constant">GL_COMPRESSED_LUMINANCE</code>,
<code class="constant">GL_COMPRESSED_LUMINANCE_ALPHA</code>,
<code class="constant">GL_COMPRESSED_INTENSITY</code>,
<code class="constant">GL_COMPRESSED_RGB</code>,
<code class="constant">GL_COMPRESSED_RGBA</code>,
<code class="constant">GL_LUMINANCE</code>,
<code class="constant">GL_LUMINANCE4</code>,
<code class="constant">GL_LUMINANCE8</code>,
<code class="constant">GL_LUMINANCE12</code>,
<code class="constant">GL_LUMINANCE16</code>,
<code class="constant">GL_LUMINANCE_ALPHA</code>,
<code class="constant">GL_LUMINANCE4_ALPHA4</code>,
<code class="constant">GL_LUMINANCE6_ALPHA2</code>,
<code class="constant">GL_LUMINANCE8_ALPHA8</code>,
<code class="constant">GL_LUMINANCE12_ALPHA4</code>,
<code class="constant">GL_LUMINANCE12_ALPHA12</code>,
<code class="constant">GL_LUMINANCE16_ALPHA16</code>,
<code class="constant">GL_INTENSITY</code>,
<code class="constant">GL_INTENSITY4</code>,
<code class="constant">GL_INTENSITY8</code>,
<code class="constant">GL_INTENSITY12</code>,
<code class="constant">GL_INTENSITY16</code>,
<code class="constant">GL_R3_G3_B2</code>,
<code class="constant">GL_RGB</code>,
<code class="constant">GL_RGB4</code>,
<code class="constant">GL_RGB5</code>,
<code class="constant">GL_RGB8</code>,
<code class="constant">GL_RGB10</code>,
<code class="constant">GL_RGB12</code>,
<code class="constant">GL_RGB16</code>,
<code class="constant">GL_RGBA</code>,
<code class="constant">GL_RGBA2</code>,
<code class="constant">GL_RGBA4</code>,
<code class="constant">GL_RGB5_A1</code>,
<code class="constant">GL_RGBA8</code>,
<code class="constant">GL_RGB10_A2</code>,
<code class="constant">GL_RGBA12</code>,
<code class="constant">GL_RGBA16</code>,
<code class="constant">GL_SLUMINANCE</code>,
<code class="constant">GL_SLUMINANCE8</code>,
<code class="constant">GL_SLUMINANCE_ALPHA</code>,
<code class="constant">GL_SLUMINANCE8_ALPHA8</code>,
<code class="constant">GL_SRGB</code>,
<code class="constant">GL_SRGB8</code>,
<code class="constant">GL_SRGB_ALPHA</code>, or
<code class="constant">GL_SRGB8_ALPHA8</code>.
</p></dd><dt><span class="term"><em class="parameter"><code>width</code></em></span></dt><dd><p>
Specifies the width of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">n</mi>
</msup>
<mo>+</mo>
<mrow>
<mn>2</mn>
<mo></mo>
<mfenced open="(" close=")">
<mi mathvariant="italic">border</mi>
</mfenced>
</mrow>
</mrow>
</math>
for some integer
<math overflow="scroll"><mi mathvariant="italic">n</mi></math>.
All
implementations support 3D texture images that are at least 16 texels
wide.
</p></dd><dt><span class="term"><em class="parameter"><code>height</code></em></span></dt><dd><p>
Specifies the height of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">m</mi>
</msup>
<mo>+</mo>
<mrow>
<mn>2</mn>
<mo></mo>
<mfenced open="(" close=")">
<mi mathvariant="italic">border</mi>
</mfenced>
</mrow>
</mrow>
</math>
for some integer
<math overflow="scroll"><mi mathvariant="italic">m</mi></math>.
All
implementations support 3D texture images that are at least 16 texels
high.
</p></dd><dt><span class="term"><em class="parameter"><code>depth</code></em></span></dt><dd><p>
Specifies the depth of the texture image including the border if any. If the GL version does not support non-power-of-two sizes, this value must be
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">k</mi>
</msup>
<mo>+</mo>
<mrow>
<mn>2</mn>
<mo></mo>
<mfenced open="(" close=")">
<mi mathvariant="italic">border</mi>
</mfenced>
</mrow>
</mrow>
</math>
for some integer
<math overflow="scroll"><mi mathvariant="italic">k</mi></math>.
All
implementations support 3D texture images that are at least 16 texels
deep.
</p></dd><dt><span class="term"><em class="parameter"><code>border</code></em></span></dt><dd><p>
Specifies the width of the border.
Must be either 0 or 1.
</p></dd><dt><span class="term"><em class="parameter"><code>format</code></em></span></dt><dd><p>
Specifies the format of the pixel data.
The following symbolic values are accepted:
<code class="constant">GL_COLOR_INDEX</code>,
<code class="constant">GL_RED</code>,
<code class="constant">GL_GREEN</code>,
<code class="constant">GL_BLUE</code>,
<code class="constant">GL_ALPHA</code>,
<code class="constant">GL_RGB</code>,
<code class="constant">GL_BGR</code>,
<code class="constant">GL_RGBA</code>,
<code class="constant">GL_BGRA</code>,
<code class="constant">GL_LUMINANCE</code>, and
<code class="constant">GL_LUMINANCE_ALPHA</code>.
</p></dd><dt><span class="term"><em class="parameter"><code>type</code></em></span></dt><dd><p>
Specifies the data type of the pixel data.
The following symbolic values are accepted:
<code class="constant">GL_UNSIGNED_BYTE</code>,
<code class="constant">GL_BYTE</code>,
<code class="constant">GL_BITMAP</code>,
<code class="constant">GL_UNSIGNED_SHORT</code>,
<code class="constant">GL_SHORT</code>,
<code class="constant">GL_UNSIGNED_INT</code>,
<code class="constant">GL_INT</code>,
<code class="constant">GL_FLOAT</code>,
<code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
<code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
<code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
<code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
<code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
<code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
<code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, and
<code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>.
</p></dd><dt><span class="term"><em class="parameter"><code>data</code></em></span></dt><dd><p>
Specifies a pointer to the image data in memory.
</p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
Texturing maps a portion of a specified texture image
onto each graphical primitive for which texturing is enabled.
To enable and disable three-dimensional texturing, call <a class="citerefentry" href="glEnable"><span class="citerefentry"><span class="refentrytitle">glEnable</span></span></a>
and <a class="citerefentry" href="glDisable"><span class="citerefentry"><span class="refentrytitle">glDisable</span></span></a> with argument <code class="constant">GL_TEXTURE_3D</code>.
</p><p>
To define texture images, call <code class="function">glTexImage3D</code>.
The arguments describe the parameters of the texture image,
such as height,
width, depth,
width of the border,
level-of-detail number
(see <a class="citerefentry" href="glTexParameter"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a>),
and number of color components provided.
The last three arguments describe how the image is represented in memory;
they are identical to the pixel formats used for <a class="citerefentry" href="glDrawPixels"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>.
</p><p>
If <em class="parameter"><code>target</code></em> is <code class="constant">GL_PROXY_TEXTURE_3D</code>, no data is read from <em class="parameter"><code>data</code></em>, but
all of the texture image state is recalculated, checked for
consistency, and checked
against the implementation's capabilities. If the implementation cannot
handle a texture of the requested texture size, it sets
all of the image state to 0,
but does not generate an error (see <a class="citerefentry" href="glGetError"><span class="citerefentry"><span class="refentrytitle">glGetError</span></span></a>). To query for an
entire mipmap array, use an image array level greater than or equal to
1.
</p><p>
If <em class="parameter"><code>target</code></em> is <code class="constant">GL_TEXTURE_3D</code>,
data is read from <em class="parameter"><code>data</code></em> as a sequence of signed or unsigned bytes,
shorts,
or longs,
or single-precision floating-point values,
depending on <em class="parameter"><code>type</code></em>.
These values are grouped into sets of one,
two,
three,
or four values,
depending on <em class="parameter"><code>format</code></em>,
to form elements.
If <em class="parameter"><code>type</code></em> is <code class="constant">GL_BITMAP</code>,
the data is considered as a string of unsigned bytes (and
<em class="parameter"><code>format</code></em> must be <code class="constant">GL_COLOR_INDEX</code>).
Each data byte is treated as eight 1-bit elements,
with bit ordering determined by <code class="constant">GL_UNPACK_LSB_FIRST</code>
(see <a class="citerefentry" href="glPixelStore"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>).
</p><p>
If a non-zero named buffer object is bound to the <code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target
(see <a class="citerefentry" href="glBindBuffer"><span class="citerefentry"><span class="refentrytitle">glBindBuffer</span></span></a>) while a texture image is
specified, <em class="parameter"><code>data</code></em> is treated as a byte offset into the buffer object's data store.
</p><p>
The first element corresponds to the lower left corner of the texture
image.
Subsequent elements progress left-to-right through the remaining texels
in the lowest row of the texture image, and then in successively higher
rows of the texture image.
The final element corresponds to the upper right corner of the texture
image.
</p><p>
<em class="parameter"><code>format</code></em> determines the composition of each element in <em class="parameter"><code>data</code></em>.
It can assume one of these symbolic values:
</p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_COLOR_INDEX</code></span></dt><dd><p>
Each element is a single value,
a color index.
The GL converts it to fixed point
(with an unspecified number of zero bits to the right of the binary point),
shifted left or right depending on the value and sign of <code class="constant">GL_INDEX_SHIFT</code>,
and added to <code class="constant">GL_INDEX_OFFSET</code>
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
The resulting index is converted to a set of color components
using the
<code class="constant">GL_PIXEL_MAP_I_TO_R</code>,
<code class="constant">GL_PIXEL_MAP_I_TO_G</code>,
<code class="constant">GL_PIXEL_MAP_I_TO_B</code>, and
<code class="constant">GL_PIXEL_MAP_I_TO_A</code> tables,
and clamped to the range [0,1].
</p></dd><dt><span class="term"><code class="constant">GL_RED</code></span></dt><dd><p>
Each element is a single red component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for green and blue, and 1 for alpha.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_GREEN</code></span></dt><dd><p>
Each element is a single green component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red and blue, and 1 for alpha.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_BLUE</code></span></dt><dd><p>
Each element is a single blue component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red and green, and 1 for alpha.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_ALPHA</code></span></dt><dd><p>
Each element is a single alpha component.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 0 for red, green, and blue.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_INTENSITY</code></span></dt><dd><p>
Each element is a single intensity value.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the intensity value
three times for red, green, blue, and alpha.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_RGB</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_BGR</code></span></dt><dd><p>
Each element is an RGB triple.
The GL converts it to floating point and assembles it into an RGBA element
by attaching 1 for alpha.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_RGBA</code></span></dt><dd></dd><dt><span class="term"><code class="constant">GL_BGRA</code></span></dt><dd><p>
Each element contains all four components.
Each component is multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_LUMINANCE</code></span></dt><dd><p>
Each element is a single luminance value.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the luminance value
three times for red, green, and blue and attaching 1 for alpha.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1]
(see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd><dt><span class="term"><code class="constant">GL_LUMINANCE_ALPHA</code></span></dt><dd><p>
Each element is a luminance/alpha pair.
The GL converts it to floating point,
then assembles it into an RGBA element by replicating the luminance value
three times for red, green, and blue.
Each component is then multiplied by the signed scale factor <code class="constant">GL_c_SCALE</code>,
added to the signed bias <code class="constant">GL_c_BIAS</code>,
and clamped to the range [0,1] (see <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>).
</p></dd></dl></div><p>
Refer to the <a class="citerefentry" href="glDrawPixels"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a> reference page for a description of
the acceptable values for the <em class="parameter"><code>type</code></em> parameter.
</p><p>
If an application wants to store the texture at a certain
resolution or in a certain format, it can request the resolution
and format with <em class="parameter"><code>internalFormat</code></em>. The GL will choose an internal
representation that closely approximates that requested by <em class="parameter"><code>internalFormat</code></em>, but
it may not match exactly.
(The representations specified by <code class="constant">GL_LUMINANCE</code>,
<code class="constant">GL_LUMINANCE_ALPHA</code>, <code class="constant">GL_RGB</code>,
and <code class="constant">GL_RGBA</code> must match exactly. The numeric values 1, 2, 3, and 4
may also be used to specify the above representations.)
</p><p>
If the <em class="parameter"><code>internalFormat</code></em> parameter is one of the generic compressed formats,
<code class="constant">GL_COMPRESSED_ALPHA</code>,
<code class="constant">GL_COMPRESSED_INTENSITY</code>,
<code class="constant">GL_COMPRESSED_LUMINANCE</code>,
<code class="constant">GL_COMPRESSED_LUMINANCE_ALPHA</code>,
<code class="constant">GL_COMPRESSED_RGB</code>, or
<code class="constant">GL_COMPRESSED_RGBA</code>, the GL will replace the internal format with the symbolic constant for a specific internal format and compress the texture before storage. If no corresponding internal format is available, or the GL can not compress that image for any reason, the internal format is instead replaced with a corresponding base internal format.
</p><p>
If the <em class="parameter"><code>internalFormat</code></em> parameter is
<code class="constant">GL_SRGB</code>,
<code class="constant">GL_SRGB8</code>,
<code class="constant">GL_SRGB_ALPHA</code>,
<code class="constant">GL_SRGB8_ALPHA8</code>,
<code class="constant">GL_SLUMINANCE</code>,
<code class="constant">GL_SLUMINANCE8</code>,
<code class="constant">GL_SLUMINANCE_ALPHA</code>, or
<code class="constant">GL_SLUMINANCE8_ALPHA8</code>, the texture is treated as if the red, green, blue, or luminance components are encoded in the sRGB color space. Any alpha component is left unchanged. The conversion from the sRGB encoded component
<math overflow="scroll">
<msub><mi mathvariant="italic">c</mi>
<mi mathvariant="italic">s</mi>
</msub>
</math>
to a linear component
<math overflow="scroll">
<msub><mi mathvariant="italic">c</mi>
<mi mathvariant="italic">l</mi>
</msub>
</math>
is:
</p><p>
<math overflow="scroll">
<mrow>
<msub>
<mi mathvariant="italic">c</mi>
<mi mathvariant="italic">l</mi>
</msub>
<mo>=</mo>
<mrow>
<mo>{</mo>
<mtable columnalign="left">
<mtr>
<mtd columnalign="left">
<mfrac>
<msub>
<mi mathvariant="italic">c</mi>
<mi mathvariant="italic">s</mi>
</msub>
<mn>12.92</mn>
</mfrac>
</mtd>
<mtd columnalign="left">
<mrow>
<mspace width="1ex"></mspace>
<mo>if</mo>
<mspace width="1ex"></mspace>
</mrow>
<msub>
<mi mathvariant="italic">c</mi>
<mi mathvariant="italic">s</mi>
</msub>
<mo>≤</mo>
<mn>0.04045</mn>
</mtd>
</mtr>
<mtr>
<mtd columnalign="left">
<msup>
<mrow>
<mo>(</mo>
<mfrac>
<mrow>
<msub>
<mi>c</mi>
<mi>s</mi>
</msub>
<mo>+</mo>
<mn>0.055</mn>
</mrow>
<mn>1.055</mn>
</mfrac>
<mo>)</mo>
</mrow>
<mn>2.4</mn>
</msup>
</mtd>
<mtd columnalign="left">
<mrow>
<mspace width="1ex"></mspace>
<mo>if</mo>
<mspace width="1ex"></mspace>
</mrow>
<msub>
<mi mathvariant="italic">c</mi>
<mi mathvariant="italic">s</mi>
</msub>
<mo>></mo>
<mn>0.04045</mn>
</mtd>
</mtr>
</mtable>
</mrow>
</mrow>
</math>
</p><p>
Assume
<math overflow="scroll">
<msub><mi mathvariant="italic">c</mi>
<mi mathvariant="italic">s</mi>
</msub>
</math>
is the sRGB component in the range [0,1].
</p><p>
Use the <code class="constant">GL_PROXY_TEXTURE_3D</code> target to try out a resolution and
format. The implementation will
update and recompute its best match for the requested storage resolution
and format. To then query this state, call <a class="citerefentry" href="glGetTexLevelParameter"><span class="citerefentry"><span class="refentrytitle">glGetTexLevelParameter</span></span></a>.
If the texture cannot be accommodated, texture state is set to 0.
</p><p>
A one-component texture image uses only the red component of the RGBA
color extracted from <em class="parameter"><code>data</code></em>.
A two-component image uses the R and A values.
A three-component image uses the R, G, and B values.
A four-component image uses all of the RGBA components.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
Texturing has no effect in color index mode.
</p><p>
The texture image can be represented by the same data formats
as the pixels in a <a class="citerefentry" href="glDrawPixels"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a> command,
except that <code class="constant">GL_STENCIL_INDEX</code> and <code class="constant">GL_DEPTH_COMPONENT</code>
cannot be used.
<a class="citerefentry" href="glPixelStore"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a> and <a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a> modes affect texture images
in exactly the way they affect <a class="citerefentry" href="glDrawPixels"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>.
</p><p>
<code class="function">glTexImage3D</code> is available only if the GL version is 1.2 or greater.
</p><p>
Internal formats other than 1, 2, 3, or 4 may be used only if the GL
version is 1.1 or greater.
</p><p>
<em class="parameter"><code>data</code></em> may be a null pointer.
In this case texture memory is
allocated to accommodate a texture of width <em class="parameter"><code>width</code></em>, height <em class="parameter"><code>height</code></em>,
and depth <em class="parameter"><code>depth</code></em>.
You can then download subtextures to initialize this
texture memory.
The image is undefined if the user tries to apply
an uninitialized portion of the texture image to a primitive.
</p><p>
Formats <code class="constant">GL_BGR</code>, and <code class="constant">GL_BGRA</code> and types
<code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
<code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
<code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
<code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
<code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
<code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
<code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, and
<code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code> are available only if the GL version
is 1.2 or greater.
</p><p>
For OpenGL versions 1.3 and greater, or when the <code class="code">ARB_multitexture</code> extension is supported, <code class="function">glTexImage3D</code>
specifies the three-dimensional texture for the current texture unit,
specified with <a class="citerefentry" href="glActiveTexture"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>.
</p><p>
If the <code class="code">ARB_imaging</code> extension is supported, RGBA elements may
also be processed by the imaging pipeline. The following stages may be
applied to an RGBA color before color component clamping to the range
<math overflow="scroll">
<mfenced open="[" close="]">
<mn>0</mn>
<mn>1</mn>
</mfenced>
</math>:
</p><div class="variablelist"><dl><dt><span class="term">1. Color component replacement by the color table specified for</span></dt><dd><p>
<code class="constant">GL_COLOR_TABLE</code>, if enabled. See <a class="citerefentry" href="glColorTable"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>.
</p></dd><dt><span class="term">2. Color component replacement by the color table specified for</span></dt><dd><p>
<code class="constant">GL_POST_CONVOLUTION_COLOR_TABLE</code>, if enabled. See <a class="citerefentry" href="glColorTable"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>.
</p></dd><dt><span class="term">3. Transformation by the color matrix. See <a class="citerefentry" href="glMatrixMode"><span class="citerefentry"><span class="refentrytitle">glMatrixMode</span></span></a>.</span></dt><dd></dd><dt><span class="term">4. RGBA components may be multiplied by <code class="constant">GL_POST_COLOR_MATRIX_c_SCALE</code>,</span></dt><dd><p>
and added to <code class="constant">GL_POST_COLOR_MATRIX_c_BIAS</code>, if enabled. See
<a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>.
</p></dd><dt><span class="term">5. Color component replacement by the color table specified for</span></dt><dd><p>
<code class="constant">GL_POST_COLOR_MATRIX_COLOR_TABLE</code>, if enabled. See
<a class="citerefentry" href="glColorTable"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>.
</p></dd></dl></div><p>
Non-power-of-two textures are supported if the GL version is 2.0 or greater, or if the implementation exports the <code class="constant">GL_ARB_texture_non_power_of_two</code> extension.
</p><p>
The
<code class="constant">GL_SRGB</code>,
<code class="constant">GL_SRGB8</code>,
<code class="constant">GL_SRGB_ALPHA</code>,
<code class="constant">GL_SRGB8_ALPHA8</code>,
<code class="constant">GL_SLUMINANCE</code>,
<code class="constant">GL_SLUMINANCE8</code>,
<code class="constant">GL_SLUMINANCE_ALPHA</code>, and
<code class="constant">GL_SLUMINANCE8_ALPHA8</code>
internal formats are only available if the GL version is 2.1 or greater.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>target</code></em> is not <code class="constant">GL_TEXTURE_3D</code>
or <code class="constant">GL_PROXY_TEXTURE_3D</code>.
</p><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>format</code></em> is not an accepted
format constant. Format constants other than <code class="constant">GL_STENCIL_INDEX</code> and <code class="constant">GL_DEPTH_COMPONENT</code>
are accepted.
</p><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>type</code></em> is not a type constant.
</p><p>
<code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>type</code></em> is <code class="constant">GL_BITMAP</code> and
<em class="parameter"><code>format</code></em> is not <code class="constant">GL_COLOR_INDEX</code>.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>level</code></em> is less than 0.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> may be generated if <em class="parameter"><code>level</code></em> is greater than
<math overflow="scroll">
<mrow>
<msub><mi mathvariant="italic">log</mi>
<mn>2</mn>
</msub>
<mo></mo>
<mfenced open="(" close=")">
<mi mathvariant="italic">max</mi>
</mfenced>
</mrow>
</math>,
where <span class="emphasis"><em>max</em></span> is the returned value of <code class="constant">GL_MAX_TEXTURE_SIZE</code>.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>internalFormat</code></em> is not 1, 2, 3, 4, or one of the
accepted resolution and format symbolic constants.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>width</code></em>, <em class="parameter"><code>height</code></em>, or <em class="parameter"><code>depth</code></em> is less than 0 or greater than 2 + <code class="constant">GL_MAX_TEXTURE_SIZE</code>.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if non-power-of-two textures are not supported and the <em class="parameter"><code>width</code></em>, <em class="parameter"><code>height</code></em>, or <em class="parameter"><code>depth</code></em> cannot be represented as
<math overflow="scroll">
<mrow>
<msup><mn>2</mn>
<mi mathvariant="italic">k</mi>
</msup>
<mo>+</mo>
<mrow>
<mn>2</mn>
<mo></mo>
<mfenced open="(" close=")">
<mi mathvariant="italic">border</mi>
</mfenced>
</mrow>
</mrow>
</math>
for some
integer value of <span class="emphasis"><em>k</em></span>.
</p><p>
<code class="constant">GL_INVALID_VALUE</code> is generated if <em class="parameter"><code>border</code></em> is not 0 or 1.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>type</code></em> is one of
<code class="constant">GL_UNSIGNED_BYTE_3_3_2</code>,
<code class="constant">GL_UNSIGNED_BYTE_2_3_3_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_6_5</code>, or
<code class="constant">GL_UNSIGNED_SHORT_5_6_5_REV</code>
and <em class="parameter"><code>format</code></em> is not <code class="constant">GL_RGB</code>.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>type</code></em> is one of
<code class="constant">GL_UNSIGNED_SHORT_4_4_4_4</code>,
<code class="constant">GL_UNSIGNED_SHORT_4_4_4_4_REV</code>,
<code class="constant">GL_UNSIGNED_SHORT_5_5_5_1</code>,
<code class="constant">GL_UNSIGNED_SHORT_1_5_5_5_REV</code>,
<code class="constant">GL_UNSIGNED_INT_8_8_8_8</code>,
<code class="constant">GL_UNSIGNED_INT_8_8_8_8_REV</code>,
<code class="constant">GL_UNSIGNED_INT_10_10_10_2</code>, or
<code class="constant">GL_UNSIGNED_INT_2_10_10_10_REV</code>
and <em class="parameter"><code>format</code></em> is neither <code class="constant">GL_RGBA</code> nor <code class="constant">GL_BGRA</code>.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <em class="parameter"><code>format</code></em> or <em class="parameter"><code>internalFormat</code></em> is
<code class="constant">GL_DEPTH_COMPONENT</code>, <code class="constant">GL_DEPTH_COMPONENT16</code>,
<code class="constant">GL_DEPTH_COMPONENT24</code>, or <code class="constant">GL_DEPTH_COMPONENT32</code>.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
<code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the buffer object's data store is currently mapped.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
<code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and the data would be unpacked from the buffer
object such that the memory reads required would exceed the data store size.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if a non-zero buffer object name is bound to the
<code class="constant">GL_PIXEL_UNPACK_BUFFER</code> target and <em class="parameter"><code>data</code></em> is not evenly divisible
into the number of bytes needed to store in memory a datum indicated by <em class="parameter"><code>type</code></em>.
</p><p>
<code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glTexImage3D</code>
is executed between the execution of <a class="citerefentry" href="glBegin"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a>
and the corresponding execution of <a class="citerefentry" href="glEnd"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
</p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
<a class="citerefentry" href="glGetTexImage"><span class="citerefentry"><span class="refentrytitle">glGetTexImage</span></span></a>
</p><p>
<a class="citerefentry" href="glIsEnabled"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_TEXTURE_3D</code>
</p><p>
<a class="citerefentry" href="glGet"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_PIXEL_UNPACK_BUFFER_BINDING</code>
</p></div>
{$pipelinestall}{$examples}
<div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
<a class="citerefentry" href="glActiveTexture"><span class="citerefentry"><span class="refentrytitle">glActiveTexture</span></span></a>,
<a class="citerefentry" href="glColorTable"><span class="citerefentry"><span class="refentrytitle">glColorTable</span></span></a>,
<a class="citerefentry" href="glCompressedTexImage1D"><span class="citerefentry"><span class="refentrytitle">glCompressedTexImage1D</span></span></a>,
<a class="citerefentry" href="glCompressedTexImage2D"><span class="citerefentry"><span class="refentrytitle">glCompressedTexImage2D</span></span></a>,
<a class="citerefentry" href="glCompressedTexImage3D"><span class="citerefentry"><span class="refentrytitle">glCompressedTexImage3D</span></span></a>,
<a class="citerefentry" href="glCompressedTexSubImage1D"><span class="citerefentry"><span class="refentrytitle">glCompressedTexSubImage1D</span></span></a>,
<a class="citerefentry" href="glCompressedTexSubImage2D"><span class="citerefentry"><span class="refentrytitle">glCompressedTexSubImage2D</span></span></a>,
<a class="citerefentry" href="glCompressedTexSubImage3D"><span class="citerefentry"><span class="refentrytitle">glCompressedTexSubImage3D</span></span></a>,
<a class="citerefentry" href="glCopyPixels"><span class="citerefentry"><span class="refentrytitle">glCopyPixels</span></span></a>,
<a class="citerefentry" href="glCopyTexImage1D"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage1D</span></span></a>,
<a class="citerefentry" href="glCopyTexImage2D"><span class="citerefentry"><span class="refentrytitle">glCopyTexImage2D</span></span></a>,
<a class="citerefentry" href="glCopyTexSubImage1D"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage1D</span></span></a>,
<a class="citerefentry" href="glCopyTexSubImage2D"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage2D</span></span></a>,
<a class="citerefentry" href="glCopyTexSubImage3D"><span class="citerefentry"><span class="refentrytitle">glCopyTexSubImage3D</span></span></a>,
<a class="citerefentry" href="glDrawPixels"><span class="citerefentry"><span class="refentrytitle">glDrawPixels</span></span></a>,
<a class="citerefentry" href="glGetCompressedTexImage"><span class="citerefentry"><span class="refentrytitle">glGetCompressedTexImage</span></span></a>,
<a class="citerefentry" href="glMatrixMode"><span class="citerefentry"><span class="refentrytitle">glMatrixMode</span></span></a>,
<a class="citerefentry" href="glPixelStore"><span class="citerefentry"><span class="refentrytitle">glPixelStore</span></span></a>,
<a class="citerefentry" href="glPixelTransfer"><span class="citerefentry"><span class="refentrytitle">glPixelTransfer</span></span></a>,
<a class="citerefentry" href="glTexEnv"><span class="citerefentry"><span class="refentrytitle">glTexEnv</span></span></a>,
<a class="citerefentry" href="glTexGen"><span class="citerefentry"><span class="refentrytitle">glTexGen</span></span></a>,
<a class="citerefentry" href="glTexImage1D"><span class="citerefentry"><span class="refentrytitle">glTexImage1D</span></span></a>,
<a class="citerefentry" href="glTexImage2D"><span class="citerefentry"><span class="refentrytitle">glTexImage2D</span></span></a>,
<a class="citerefentry" href="glTexSubImage1D"><span class="citerefentry"><span class="refentrytitle">glTexSubImage1D</span></span></a>,
<a class="citerefentry" href="glTexSubImage2D"><span class="citerefentry"><span class="refentrytitle">glTexSubImage2D</span></span></a>,
<a class="citerefentry" href="glTexSubImage3D"><span class="citerefentry"><span class="refentrytitle">glTexSubImage3D</span></span></a>,
<a class="citerefentry" href="glTexParameter"><span class="citerefentry"><span class="refentrytitle">glTexParameter</span></span></a>
</p></div><div class="refsect1" lang="en" xml:lang="en"><div id="Copyright"><h2>Copyright</h2><p>
Copyright © 1991-2006
Silicon Graphics, Inc. This document is licensed under the SGI
Free Software B License. For details, see
<a class="ulink" href="https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/" target="_top">https://web.archive.org/web/20171022161616/http://oss.sgi.com/projects/FreeB/</a>.
</p></div></div></div>
| {
"pile_set_name": "Github"
} |
// O(sqrt(x)) Exhaustive Primality Test
#include <cmath>
#define EPS 1e-7
typedef long long LL;
bool IsPrimeSlow (LL x)
{
if(x<=1) return false;
if(x<=3) return true;
if (!(x%2) || !(x%3)) return false;
LL s=(LL)(sqrt((double)(x))+EPS);
for(LL i=5;i<=s;i+=6)
{
if (!(x%i) || !(x%(i+2))) return false;
}
return true;
}
// Primes less than 1000:
// 2 3 5 7 11 13 17 19 23 29 31 37
// 41 43 47 53 59 61 67 71 73 79 83 89
// 97 101 103 107 109 113 127 131 137 139 149 151
// 157 163 167 173 179 181 191 193 197 199 211 223
// 227 229 233 239 241 251 257 263 269 271 277 281
// 283 293 307 311 313 317 331 337 347 349 353 359
// 367 373 379 383 389 397 401 409 419 421 431 433
// 439 443 449 457 461 463 467 479 487 491 499 503
// 509 521 523 541 547 557 563 569 571 577 587 593
// 599 601 607 613 617 619 631 641 643 647 653 659
// 661 673 677 683 691 701 709 719 727 733 739 743
// 751 757 761 769 773 787 797 809 811 821 823 827
// 829 839 853 857 859 863 877 881 883 887 907 911
// 919 929 937 941 947 953 967 971 977 983 991 997
// Other primes:
// The largest prime smaller than 10 is 7.
// The largest prime smaller than 100 is 97.
// The largest prime smaller than 1000 is 997.
// The largest prime smaller than 10000 is 9973.
// The largest prime smaller than 100000 is 99991.
// The largest prime smaller than 1000000 is 999983.
// The largest prime smaller than 10000000 is 9999991.
// The largest prime smaller than 100000000 is 99999989.
// The largest prime smaller than 1000000000 is 999999937.
// The largest prime smaller than 10000000000 is 9999999967.
// The largest prime smaller than 100000000000 is 99999999977.
// The largest prime smaller than 1000000000000 is 999999999989.
// The largest prime smaller than 10000000000000 is 9999999999971.
// The largest prime smaller than 100000000000000 is 99999999999973.
// The largest prime smaller than 1000000000000000 is 999999999999989.
// The largest prime smaller than 10000000000000000 is 9999999999999937.
// The largest prime smaller than 100000000000000000 is 99999999999999997.
// The largest prime smaller than 1000000000000000000 is 999999999999999989.
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: 75ccbf856d08c42f8b95ce7c450cee5a
timeCreated: 1458795466
licenseType: Pro
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:
| {
"pile_set_name": "Github"
} |
namespace Ocelot.Request.Mapper
{
using Microsoft.AspNetCore.Http;
using Ocelot.Configuration;
using Ocelot.Responses;
using System.Net.Http;
using System.Threading.Tasks;
public interface IRequestMapper
{
Task<Response<HttpRequestMessage>> Map(HttpRequest request, DownstreamRoute downstreamRoute);
}
}
| {
"pile_set_name": "Github"
} |
{
"jsonSchemaSemanticVersion": "1.0.0",
"imports": [
{
"corpusPath": "cdm:/foundations.1.1.cdm.json"
},
{
"corpusPath": "/core/operationsCommon/Common.1.0.cdm.json",
"moniker": "base_Common"
},
{
"corpusPath": "/core/operationsCommon/DataEntityView.1.0.cdm.json",
"moniker": "base_DataEntityView"
}
],
"definitions": [
{
"entityName": "ResRatingModel",
"extendsEntity": "base_Common/Common",
"exhibitsTraits": [
{
"traitReference": "is.CDM.entityVersion",
"arguments": [
{
"name": "versionNumber",
"value": "1.0"
}
]
}
],
"hasAttributes": [
{
"name": "Name",
"dataType": "Name",
"description": ""
},
{
"name": "Description",
"dataType": "Description",
"isNullable": true,
"description": ""
}
],
"displayName": ""
},
{
"dataTypeName": "Name",
"extendsDataType": "string"
},
{
"dataTypeName": "Description",
"extendsDataType": "string"
}
]
} | {
"pile_set_name": "Github"
} |
#include "../THCTensorMathPointwise.cuh"
#include "../generic/THCTensorMathPointwise.cu"
#include "../THCGenerateByteType.h"
| {
"pile_set_name": "Github"
} |
-----BEGIN CERTIFICATE-----
MIICHTCCAaSgAwIBAgIBEjAJBgcqhkjOPQQBMD4xCzAJBgNVBAYTAk5MMREwDwYD
VQQKEwhQb2xhclNTTDEcMBoGA1UEAxMTUG9sYXJzc2wgVGVzdCBFQyBDQTAeFw0x
MzA5MjQxNjIxMjdaFw0yMzA5MjIxNjIxMjdaMDQxCzAJBgNVBAYTAk5MMREwDwYD
VQQKEwhQb2xhclNTTDESMBAGA1UEAxMJbG9jYWxob3N0MFkwEwYHKoZIzj0CAQYI
KoZIzj0DAQcDQgAEN8xW2XYJHlpyPsdZLf8gbu58+QaRdNCtFLX3aCJZYpJO5QDY
IxH/6i/SNF1dFr2KiMJrdw1VzYoqDvoByLTt/6OBnTCBmjAJBgNVHRMEAjAAMB0G
A1UdDgQWBBRQYaWP1AfZ14IBDOVlf4xjRqcTvjBuBgNVHSMEZzBlgBSdbSAkSQE/
K8t4tRm8fiTJ2/s2fKFCpEAwPjELMAkGA1UEBhMCTkwxETAPBgNVBAoTCFBvbGFy
U1NMMRwwGgYDVQQDExNQb2xhcnNzbCBUZXN0IEVDIENBggkAwUPifmJDzOgwCQYH
KoZIzj0EAQNoADBlAjEAyjvzRWtxbXvkoYTYSQY9gFBpP7/wTZ2q6FbRiAuZULFt
lc0PMPDfVZChgA6iDH+BAjBdkOb73f2pOwZpMRqrOgqSynbt2uWY87mC5lRlNEoR
WXEv1AzIeBCv+81DN1Iuu4w=
-----END CERTIFICATE-----
| {
"pile_set_name": "Github"
} |
-- This test verifies that if the tables location changes, renaming a partition will not change
-- the partition location accordingly
CREATE TABLE rename_partition_table (key STRING, value STRING) PARTITIONED BY (part STRING)
STORED AS RCFILE
LOCATION 'pfile:${system:test.tmp.dir}/rename_partition_table';
INSERT OVERWRITE TABLE rename_partition_table PARTITION (part = '1') SELECT * FROM src;
ALTER TABLE rename_partition_table SET LOCATION 'file:${system:test.tmp.dir}/rename_partition_table';
ALTER TABLE rename_partition_table PARTITION (part = '1') RENAME TO PARTITION (part = '2');
SET hive.exec.post.hooks=org.apache.hadoop.hive.ql.hooks.VerifyPartitionIsNotSubdirectoryOfTableHook;
SELECT count(*) FROM rename_partition_table where part = '2';
SET hive.exec.post.hooks=;
DROP TABLE rename_partition_table;
| {
"pile_set_name": "Github"
} |
/*------------------------------------------------------------------------*/
/* Unicode - Local code bidirectional converter (C)ChaN, 2015 */
/* (SBCS code pages) */
/*------------------------------------------------------------------------*/
/* 437 U.S.
/ 720 Arabic
/ 737 Greek
/ 771 KBL
/ 775 Baltic
/ 850 Latin 1
/ 852 Latin 2
/ 855 Cyrillic
/ 857 Turkish
/ 860 Portuguese
/ 861 Icelandic
/ 862 Hebrew
/ 863 Canadian French
/ 864 Arabic
/ 865 Nordic
/ 866 Russian
/ 869 Greek 2
*/
#include "../ff.h"
#if _CODE_PAGE == 437
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP437(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 720
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP720(0x80-0xFF) to Unicode conversion table */
0x0000, 0x0000, 0x00E9, 0x00E2, 0x0000, 0x00E0, 0x0000, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0000, 0x0000, 0x0000,
0x0000, 0x0651, 0x0652, 0x00F4, 0x00A4, 0x0640, 0x00FB, 0x00F9, 0x0621, 0x0622, 0x0623, 0x0624, 0x00A3, 0x0625, 0x0626, 0x0627,
0x0628, 0x0629, 0x062A, 0x062B, 0x062C, 0x062D, 0x062E, 0x062F, 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x0636, 0x0637, 0x0638, 0x0639, 0x063A, 0x0641, 0x00B5, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, 0x0648, 0x0649, 0x064A,
0x2261, 0x064B, 0x064C, 0x064D, 0x064E, 0x064F, 0x0650, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 737
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP737(0x80-0xFF) to Unicode conversion table */
0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, 0x03A0,
0x03A1, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, 0x03B8,
0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x03C5, 0x03C6, 0x03C7, 0x03C8,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03C9, 0x03AC, 0x03AD, 0x03AE, 0x03CA, 0x03AF, 0x03CC, 0x03CD, 0x03CB, 0x03CE, 0x0386, 0x0388, 0x0389, 0x038A, 0x038C, 0x038E,
0x038F, 0x00B1, 0x2265, 0x2264, 0x03AA, 0x03AB, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 771
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP771(0x80-0xFF) to Unicode conversion table */
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x0104, 0x0105, 0x010C, 0x010D,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x0118, 0x0119, 0x0116, 0x0117, 0x012E, 0x012F, 0x0160, 0x0161, 0x0172, 0x0173, 0x016A, 0x016B, 0x017D, 0x017E, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 775
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP775(0x80-0xFF) to Unicode conversion table */
0x0106, 0x00FC, 0x00E9, 0x0101, 0x00E4, 0x0123, 0x00E5, 0x0107, 0x0142, 0x0113, 0x0156, 0x0157, 0x012B, 0x0179, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x014D, 0x00F6, 0x0122, 0x00A2, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x00A4,
0x0100, 0x012A, 0x00F3, 0x017B, 0x017C, 0x017A, 0x201D, 0x00A6, 0x00A9, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x0141, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0104, 0x010C, 0x0118, 0x0116, 0x2563, 0x2551, 0x2557, 0x255D, 0x012E, 0x0160, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0172, 0x016A, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x017D,
0x0105, 0x010D, 0x0119, 0x0117, 0x012F, 0x0161, 0x0173, 0x016B, 0x017E, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x00D3, 0x00DF, 0x014C, 0x0143, 0x00F5, 0x00D5, 0x00B5, 0x0144, 0x0136, 0x0137, 0x013B, 0x013C, 0x0146, 0x0112, 0x0145, 0x2019,
0x00AD, 0x00B1, 0x201C, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x201E, 0x00B0, 0x2219, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 850
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP850(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x00D7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
0x00F0, 0x00D0, 0x00CA, 0x00CB, 0x00C8, 0x0131, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x00FE, 0x00DE, 0x00DA, 0x00DB, 0x00D9, 0x00FD, 0x00DD, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x2017, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 852
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP852(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x016F, 0x0107, 0x00E7, 0x0142, 0x00EB, 0x0150, 0x0151, 0x00EE, 0x0179, 0x00C4, 0x0106,
0x00C9, 0x0139, 0x013A, 0x00F4, 0x00F6, 0x013D, 0x013E, 0x015A, 0x015B, 0x00D6, 0x00DC, 0x0164, 0x0165, 0x0141, 0x00D7, 0x010D,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x0104, 0x0105, 0x017D, 0x017E, 0x0118, 0x0119, 0x00AC, 0x017A, 0x010C, 0x015F, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x011A, 0x015E, 0x2563, 0x2551, 0x2557, 0x255D, 0x017B, 0x017C, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0102, 0x0103, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
0x0111, 0x0110, 0x010E, 0x00CB, 0x010F, 0x0147, 0x00CD, 0x00CE, 0x011B, 0x2518, 0x250C, 0x2588, 0x2584, 0x0162, 0x016E, 0x2580,
0x00D3, 0x00DF, 0x00D4, 0x0143, 0x0144, 0x0148, 0x0160, 0x0161, 0x0154, 0x00DA, 0x0155, 0x0170, 0x00FD, 0x00DD, 0x0163, 0x00B4,
0x00AD, 0x02DD, 0x02DB, 0x02C7, 0x02D8, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x02D9, 0x0171, 0x0158, 0x0159, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 855
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP855(0x80-0xFF) to Unicode conversion table */
0x0452, 0x0402, 0x0453, 0x0403, 0x0451, 0x0401, 0x0454, 0x0404, 0x0455, 0x0405, 0x0456, 0x0406, 0x0457, 0x0407, 0x0458, 0x0408,
0x0459, 0x0409, 0x045A, 0x040A, 0x045B, 0x040B, 0x045C, 0x040C, 0x045E, 0x040E, 0x045F, 0x040F, 0x044E, 0x042E, 0x044A, 0x042A,
0x0430, 0x0410, 0x0431, 0x0411, 0x0446, 0x0426, 0x0434, 0x0414, 0x0435, 0x0415, 0x0444, 0x0424, 0x0433, 0x0413, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x0445, 0x0425, 0x0438, 0x0418, 0x2563, 0x2551, 0x2557, 0x255D, 0x0439, 0x0419, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x043A, 0x041A, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
0x043B, 0x041B, 0x043C, 0x041C, 0x043D, 0x041D, 0x043E, 0x041E, 0x043F, 0x2518, 0x250C, 0x2588, 0x2584, 0x041F, 0x044F, 0x2580,
0x042F, 0x0440, 0x0420, 0x0441, 0x0421, 0x0442, 0x0422, 0x0443, 0x0423, 0x0436, 0x0416, 0x0432, 0x0412, 0x044C, 0x042C, 0x2116,
0x00AD, 0x044B, 0x042B, 0x0437, 0x0417, 0x0448, 0x0428, 0x044D, 0x042D, 0x0449, 0x0429, 0x0447, 0x0427, 0x00A7, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 857
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP857(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x0131, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x0130, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x015E, 0x015F,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x011E, 0x011F, 0x00BF, 0x00AE, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x00C1, 0x00C2, 0x00C0, 0x00A9, 0x2563, 0x2551, 0x2557, 0x255D, 0x00A2, 0x00A5, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x00E3, 0x00C3, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x00A4,
0x00BA, 0x00AA, 0x00CA, 0x00CB, 0x00C8, 0x0000, 0x00CD, 0x00CE, 0x00CF, 0x2518, 0x250C, 0x2588, 0x2584, 0x00A6, 0x00CC, 0x2580,
0x00D3, 0x00DF, 0x00D4, 0x00D2, 0x00F5, 0x00D5, 0x00B5, 0x0000, 0x00D7, 0x00DA, 0x00DB, 0x00D9, 0x00EC, 0x00FF, 0x00AF, 0x00B4,
0x00AD, 0x00B1, 0x0000, 0x00BE, 0x00B6, 0x00A7, 0x00F7, 0x00B8, 0x00B0, 0x00A8, 0x00B7, 0x00B9, 0x00B3, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 860
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP860(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E3, 0x00E0, 0x00C1, 0x00E7, 0x00EA, 0x00CA, 0x00E8, 0x00CD, 0x00D4, 0x00EC, 0x00C3, 0x00C2,
0x00C9, 0x00C0, 0x00C8, 0x00F4, 0x00F5, 0x00F2, 0x00DA, 0x00F9, 0x00CC, 0x00D5, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x20A7, 0x00D3,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x00D2, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 861
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP861(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00D0, 0x00F0, 0x00DE, 0x00C4, 0x00C5,
0x00C9, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00FE, 0x00FB, 0x00DD, 0x00FD, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00C1, 0x00CD, 0x00D3, 0x00DA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 862
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP862(0x80-0xFF) to Unicode conversion table */
0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6, 0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
0x05E0, 0x05E1, 0x05E2, 0x05E3, 0x05E4, 0x05E5, 0x05E6, 0x05E7, 0x05E8, 0x05E9, 0x05EA, 0x00A2, 0x00A3, 0x00A5, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 863
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP863(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00C2, 0x00E0, 0x00B6, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x2017, 0x00C0,
0x00C9, 0x00C8, 0x00CA, 0x00F4, 0x00CB, 0x00CF, 0x00FB, 0x00F9, 0x00A4, 0x00D4, 0x00DC, 0x00A2, 0x00A3, 0x00D9, 0x00DB, 0x0192,
0x00A6, 0x00B4, 0x00F3, 0x00FA, 0x00A8, 0x00BB, 0x00B3, 0x00AF, 0x00CE, 0x3210, 0x00AC, 0x00BD, 0x00BC, 0x00BE, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2219,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 864
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP864(0x80-0xFF) to Unicode conversion table */
0x00B0, 0x00B7, 0x2219, 0x221A, 0x2592, 0x2500, 0x2502, 0x253C, 0x2524, 0x252C, 0x251C, 0x2534, 0x2510, 0x250C, 0x2514, 0x2518,
0x03B2, 0x221E, 0x03C6, 0x00B1, 0x00BD, 0x00BC, 0x2248, 0x00AB, 0x00BB, 0xFEF7, 0xFEF8, 0x0000, 0x0000, 0xFEFB, 0xFEFC, 0x0000,
0x00A0, 0x00AD, 0xFE82, 0x00A3, 0x00A4, 0xFE84, 0x0000, 0x20AC, 0xFE8E, 0xFE8F, 0xFE95, 0xFE99, 0x060C, 0xFE9D, 0xFEA1, 0xFEA5,
0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669, 0xFED1, 0x061B, 0xFEB1, 0xFEB5, 0xFEB9, 0x061F,
0x00A2, 0xFE80, 0xFE81, 0xFE83, 0xFE85, 0xFECA, 0xFE8B, 0xFE8D, 0xFE91, 0xFE93, 0xFE97, 0xFE9B, 0xFE9F, 0xFEA3, 0xFEA7, 0xFEA9,
0xFEAB, 0xFEAD, 0xFEAF, 0xFEB3, 0xFEB7, 0xFEBB, 0xFEBF, 0xFEC1, 0xFEC5, 0xFECB, 0xFECF, 0x00A6, 0x00AC, 0x00F7, 0x00D7, 0xFEC9,
0x0640, 0xFED3, 0xFED7, 0xFEDB, 0xFEDF, 0xFEE3, 0xFEE7, 0xFEEB, 0xFEED, 0xFEEF, 0xFEF3, 0xFEBD, 0xFECC, 0xFECE, 0xFECD, 0xFEE1,
0xFE7D, 0x0651, 0xFEE5, 0xFEE9, 0xFEEC, 0xFEF0, 0xFEF2, 0xFED0, 0xFED5, 0xFEF5, 0xFEF6, 0xFEDD, 0xFED9, 0xFEF1, 0x25A0, 0x0000
};
#elif _CODE_PAGE == 865
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP865(0x80-0xFF) to Unicode conversion table */
0x00C7, 0x00FC, 0x00E9, 0x00E2, 0x00E4, 0x00E0, 0x00E5, 0x00E7, 0x00EA, 0x00EB, 0x00E8, 0x00EF, 0x00EE, 0x00EC, 0x00C4, 0x00C5,
0x00C5, 0x00E6, 0x00C6, 0x00F4, 0x00F6, 0x00F2, 0x00FB, 0x00F9, 0x00FF, 0x00D6, 0x00DC, 0x00F8, 0x00A3, 0x00D8, 0x20A7, 0x0192,
0x00E1, 0x00ED, 0x00F3, 0x00FA, 0x00F1, 0x00D1, 0x00AA, 0x00BA, 0x00BF, 0x2310, 0x00AC, 0x00BD, 0x00BC, 0x00A1, 0x00AB, 0x00A4,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x2558, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x03B1, 0x00DF, 0x0393, 0x03C0, 0x03A3, 0x03C3, 0x00B5, 0x03C4, 0x03A6, 0x0398, 0x03A9, 0x03B4, 0x221E, 0x03C6, 0x03B5, 0x2229,
0x2261, 0x00B1, 0x2265, 0x2264, 0x2320, 0x2321, 0x00F7, 0x2248, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x207F, 0x00B2, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 866
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP866(0x80-0xFF) to Unicode conversion table */
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0418, 0x0419, 0x041A, 0x041B, 0x041C, 0x041D, 0x041E, 0x041F,
0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042A, 0x042B, 0x042C, 0x042D, 0x042E, 0x042F,
0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, 0x0438, 0x0439, 0x043A, 0x043B, 0x043C, 0x043D, 0x043E, 0x043F,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x2561, 0x2562, 0x2556, 0x2555, 0x2563, 0x2551, 0x2557, 0x255D, 0x255C, 0x255B, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x255E, 0x255F, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x2567,
0x2568, 0x2564, 0x2565, 0x2559, 0x2558, 0x2552, 0x2553, 0x256B, 0x256A, 0x2518, 0x250C, 0x2588, 0x2584, 0x258C, 0x2590, 0x2580,
0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, 0x044A, 0x044B, 0x044C, 0x044D, 0x044E, 0x044F,
0x0401, 0x0451, 0x0404, 0x0454, 0x0407, 0x0457, 0x040E, 0x045E, 0x00B0, 0x2219, 0x00B7, 0x221A, 0x2116, 0x00A4, 0x25A0, 0x00A0
};
#elif _CODE_PAGE == 869
#define _TBLDEF 1
static
const WCHAR Tbl[] = { /* CP869(0x80-0xFF) to Unicode conversion table */
0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x00B7, 0x0386, 0x00B7, 0x00B7, 0x00AC, 0x00A6, 0x2018, 0x2019, 0x0388, 0x2015, 0x0389,
0x038A, 0x03AA, 0x038C, 0x00B7, 0x00B7, 0x038E, 0x03AB, 0x00A9, 0x038F, 0x00B2, 0x00B3, 0x03AC, 0x00A3, 0x03AD, 0x03AE, 0x03AF,
0x03CA, 0x0390, 0x03CC, 0x03CD, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x00BD, 0x0398, 0x0399, 0x00AB, 0x00BB,
0x2591, 0x2592, 0x2593, 0x2502, 0x2524, 0x039A, 0x039B, 0x039C, 0x039D, 0x2563, 0x2551, 0x2557, 0x255D, 0x039E, 0x039F, 0x2510,
0x2514, 0x2534, 0x252C, 0x251C, 0x2500, 0x253C, 0x0A30, 0x03A1, 0x255A, 0x2554, 0x2569, 0x2566, 0x2560, 0x2550, 0x256C, 0x03A3,
0x03A4, 0x03A5, 0x03A6, 0x03A7, 0x03A8, 0x03A9, 0x03B1, 0x03B2, 0x03B3, 0x2518, 0x250C, 0x2588, 0x2584, 0x03B4, 0x03B5, 0x2580,
0x03B6, 0x03B7, 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, 0x03C0, 0x03C1, 0x03C3, 0x03C2, 0x03C4, 0x0384,
0x00AD, 0x00B1, 0x03C5, 0x03C6, 0x03C7, 0x00A7, 0x03C8, 0x0385, 0x00B0, 0x00A8, 0x03C9, 0x03CB, 0x03B0, 0x03CE, 0x25A0, 0x00A0
};
#endif
#if !_TBLDEF || !_USE_LFN
#error This file is not needed at current configuration. Remove from the project.
#endif
WCHAR ff_convert ( /* Converted character, Returns zero on error */
WCHAR chr, /* Character code to be converted */
UINT dir /* 0: Unicode to OEM code, 1: OEM code to Unicode */
)
{
WCHAR c;
if (chr < 0x80) { /* ASCII */
c = chr;
} else {
if (dir) { /* OEM code to Unicode */
c = (chr >= 0x100) ? 0 : Tbl[chr - 0x80];
} else { /* Unicode to OEM code */
for (c = 0; c < 0x80; c++) {
if (chr == Tbl[c]) break;
}
c = (c + 0x80) & 0xFF;
}
}
return c;
}
WCHAR ff_wtoupper ( /* Returns upper converted character */
WCHAR chr /* Unicode character to be upper converted (BMP only) */
)
{
/* Compressed upper conversion table */
static const WCHAR cvt1[] = { /* U+0000 - U+0FFF */
/* Basic Latin */
0x0061,0x031A,
/* Latin-1 Supplement */
0x00E0,0x0317, 0x00F8,0x0307, 0x00FF,0x0001,0x0178,
/* Latin Extended-A */
0x0100,0x0130, 0x0132,0x0106, 0x0139,0x0110, 0x014A,0x012E, 0x0179,0x0106,
/* Latin Extended-B */
0x0180,0x004D,0x0243,0x0181,0x0182,0x0182,0x0184,0x0184,0x0186,0x0187,0x0187,0x0189,0x018A,0x018B,0x018B,0x018D,0x018E,0x018F,0x0190,0x0191,0x0191,0x0193,0x0194,0x01F6,0x0196,0x0197,0x0198,0x0198,0x023D,0x019B,0x019C,0x019D,0x0220,0x019F,0x01A0,0x01A0,0x01A2,0x01A2,0x01A4,0x01A4,0x01A6,0x01A7,0x01A7,0x01A9,0x01AA,0x01AB,0x01AC,0x01AC,0x01AE,0x01AF,0x01AF,0x01B1,0x01B2,0x01B3,0x01B3,0x01B5,0x01B5,0x01B7,0x01B8,0x01B8,0x01BA,0x01BB,0x01BC,0x01BC,0x01BE,0x01F7,0x01C0,0x01C1,0x01C2,0x01C3,0x01C4,0x01C5,0x01C4,0x01C7,0x01C8,0x01C7,0x01CA,0x01CB,0x01CA,
0x01CD,0x0110, 0x01DD,0x0001,0x018E, 0x01DE,0x0112, 0x01F3,0x0003,0x01F1,0x01F4,0x01F4, 0x01F8,0x0128,
0x0222,0x0112, 0x023A,0x0009,0x2C65,0x023B,0x023B,0x023D,0x2C66,0x023F,0x0240,0x0241,0x0241, 0x0246,0x010A,
/* IPA Extensions */
0x0253,0x0040,0x0181,0x0186,0x0255,0x0189,0x018A,0x0258,0x018F,0x025A,0x0190,0x025C,0x025D,0x025E,0x025F,0x0193,0x0261,0x0262,0x0194,0x0264,0x0265,0x0266,0x0267,0x0197,0x0196,0x026A,0x2C62,0x026C,0x026D,0x026E,0x019C,0x0270,0x0271,0x019D,0x0273,0x0274,0x019F,0x0276,0x0277,0x0278,0x0279,0x027A,0x027B,0x027C,0x2C64,0x027E,0x027F,0x01A6,0x0281,0x0282,0x01A9,0x0284,0x0285,0x0286,0x0287,0x01AE,0x0244,0x01B1,0x01B2,0x0245,0x028D,0x028E,0x028F,0x0290,0x0291,0x01B7,
/* Greek, Coptic */
0x037B,0x0003,0x03FD,0x03FE,0x03FF, 0x03AC,0x0004,0x0386,0x0388,0x0389,0x038A, 0x03B1,0x0311,
0x03C2,0x0002,0x03A3,0x03A3, 0x03C4,0x0308, 0x03CC,0x0003,0x038C,0x038E,0x038F, 0x03D8,0x0118,
0x03F2,0x000A,0x03F9,0x03F3,0x03F4,0x03F5,0x03F6,0x03F7,0x03F7,0x03F9,0x03FA,0x03FA,
/* Cyrillic */
0x0430,0x0320, 0x0450,0x0710, 0x0460,0x0122, 0x048A,0x0136, 0x04C1,0x010E, 0x04CF,0x0001,0x04C0, 0x04D0,0x0144,
/* Armenian */
0x0561,0x0426,
0x0000
};
static const WCHAR cvt2[] = { /* U+1000 - U+FFFF */
/* Phonetic Extensions */
0x1D7D,0x0001,0x2C63,
/* Latin Extended Additional */
0x1E00,0x0196, 0x1EA0,0x015A,
/* Greek Extended */
0x1F00,0x0608, 0x1F10,0x0606, 0x1F20,0x0608, 0x1F30,0x0608, 0x1F40,0x0606,
0x1F51,0x0007,0x1F59,0x1F52,0x1F5B,0x1F54,0x1F5D,0x1F56,0x1F5F, 0x1F60,0x0608,
0x1F70,0x000E,0x1FBA,0x1FBB,0x1FC8,0x1FC9,0x1FCA,0x1FCB,0x1FDA,0x1FDB,0x1FF8,0x1FF9,0x1FEA,0x1FEB,0x1FFA,0x1FFB,
0x1F80,0x0608, 0x1F90,0x0608, 0x1FA0,0x0608, 0x1FB0,0x0004,0x1FB8,0x1FB9,0x1FB2,0x1FBC,
0x1FCC,0x0001,0x1FC3, 0x1FD0,0x0602, 0x1FE0,0x0602, 0x1FE5,0x0001,0x1FEC, 0x1FF2,0x0001,0x1FFC,
/* Letterlike Symbols */
0x214E,0x0001,0x2132,
/* Number forms */
0x2170,0x0210, 0x2184,0x0001,0x2183,
/* Enclosed Alphanumerics */
0x24D0,0x051A, 0x2C30,0x042F,
/* Latin Extended-C */
0x2C60,0x0102, 0x2C67,0x0106, 0x2C75,0x0102,
/* Coptic */
0x2C80,0x0164,
/* Georgian Supplement */
0x2D00,0x0826,
/* Full-width */
0xFF41,0x031A,
0x0000
};
const WCHAR *p;
WCHAR bc, nc, cmd;
p = chr < 0x1000 ? cvt1 : cvt2;
for (;;) {
bc = *p++; /* Get block base */
if (!bc || chr < bc) break;
nc = *p++; cmd = nc >> 8; nc &= 0xFF; /* Get processing command and block size */
if (chr < bc + nc) { /* In the block? */
switch (cmd) {
case 0: chr = p[chr - bc]; break; /* Table conversion */
case 1: chr -= (chr - bc) & 1; break; /* Case pairs */
case 2: chr -= 16; break; /* Shift -16 */
case 3: chr -= 32; break; /* Shift -32 */
case 4: chr -= 48; break; /* Shift -48 */
case 5: chr -= 26; break; /* Shift -26 */
case 6: chr += 8; break; /* Shift +8 */
case 7: chr -= 80; break; /* Shift -80 */
case 8: chr -= 0x1C60; break; /* Shift -0x1C60 */
}
break;
}
if (!cmd) p += nc;
}
return chr;
}
| {
"pile_set_name": "Github"
} |
/*
* The raster-color-enhancement property specifies image processing filters to
* be applied to an entire raster layer.
*
* The keyword "none" will cause colors to be included directly; with high
* values encoded as white and low values encoded as black. This is the default
* behavior.
* raster-color-enhancement: none;
*
* The keyword "normalize" will stretch or compress values so that the minimum
* value in the raster is mapped to black and the maximum is mapped to white,
* with intermediate colors mapped linearly along the scale between the two.
* raster-color-enhancement: normalize;
*
* The keyword "histogram" will calculate a color curve such that the output
* image has roughly the same number of pixels at each brightness.
*/
* {
raster-channels: 1;
raster-color-enhancement: histogram;
}
| {
"pile_set_name": "Github"
} |
/*----------------------------------------------------------------------------
* CMSIS-RTOS - RTX
*----------------------------------------------------------------------------
* Name: RT_TYPEDEF.H
* Purpose: Type Definitions
* Rev.: V4.79 (plus large stack)
*----------------------------------------------------------------------------
*
* Copyright (c) 1999-2009 KEIL, 2009-2015 ARM Germany GmbH
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - Neither the name of ARM 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 COPYRIGHT HOLDERS AND 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.
*---------------------------------------------------------------------------*/
/* Types */
typedef char S8;
typedef unsigned char U8;
typedef short S16;
typedef unsigned short U16;
typedef int S32;
typedef unsigned int U32;
typedef long long S64;
typedef unsigned long long U64;
typedef unsigned char BIT;
typedef unsigned int BOOL;
typedef void (*FUNCP)(void);
typedef U32 OS_TID;
typedef void *OS_ID;
typedef U32 OS_RESULT;
typedef struct OS_TCB {
/* General part: identical for all implementations. */
U8 cb_type; /* Control Block Type */
U8 state; /* Task state */
U8 prio; /* Execution priority */
U8 task_id; /* Task ID value for optimized TCB access */
struct OS_TCB *p_lnk; /* Link pointer for ready/sem. wait list */
struct OS_TCB *p_rlnk; /* Link pointer for sem./mbx lst backwards */
struct OS_TCB *p_dlnk; /* Link pointer for delay list */
struct OS_TCB *p_blnk; /* Link pointer for delay list backwards */
U16 delta_time; /* Time until time out */
U16 interval_time; /* Time interval for periodic waits */
U16 events; /* Event flags */
U16 waits; /* Wait flags */
void **msg; /* Direct message passing when task waits */
struct OS_MUCB *p_mlnk; /* Link pointer for mutex owner list */
U8 prio_base; /* Base priority */
/* Hardware dependant part: specific for Cortex processor */
U8 stack_frame; /* Stack frame: 0x0 Basic, 0x1 Extended, 0x2 VFP/D16 stacked, 0x4 NEON/D32 stacked */
#if defined (__ICCARM__)
#ifndef __LARGE_PRIV_STACK
U16 priv_stack; /* Private stack size, 0= system assigned */
#else
U16 reserved; /* Reserved (padding) */
U32 priv_stack; /* Private stack size for LARGE_STACK, 0= system assigned */
#endif /* __LARGE_PRIV_STACK */
#else
U16 reserved; /* Reserved (padding) */
U32 priv_stack; /* Private stack size for LARGE_STACK, 0= system assigned */
#endif
U32 tsk_stack; /* Current task Stack pointer (R13) */
U32 *stack; /* Pointer to Task Stack memory block */
/* Task entry point used for uVision debugger */
FUNCP ptask; /* Task entry address */
void *argv; /* Task argument */
} *P_TCB;
#define TCB_TID 3 /* 'task id' offset */
#define TCB_STACKF 37 /* 'stack_frame' offset */
#if defined (__ICCARM__)
#ifndef __LARGE_PRIV_STACK
#define TCB_TSTACK 40 /* 'tsk_stack' offset */
#else
#define TCB_TSTACK 44 /* 'tsk_stack' offset for LARGE_STACK */
#endif /* __LARGE_PRIV_STACK */
#else
#define TCB_TSTACK 44 /* 'tsk_stack' offset for LARGE_STACK */
#endif
typedef struct OS_PSFE { /* Post Service Fifo Entry */
void *id; /* Object Identification */
U32 arg; /* Object Argument */
} *P_PSFE;
typedef struct OS_PSQ { /* Post Service Queue */
U8 first; /* FIFO Head Index */
U8 last; /* FIFO Tail Index */
U8 count; /* Number of stored items in FIFO */
U8 size; /* FIFO Size */
struct OS_PSFE q[1]; /* FIFO Content */
} *P_PSQ;
typedef struct OS_TSK {
P_TCB run; /* Current running task */
P_TCB new_tsk; /* Scheduled task to run */
} *P_TSK;
typedef struct OS_ROBIN { /* Round Robin Control */
P_TCB task; /* Round Robin task */
U16 time; /* Round Robin switch time */
U16 tout; /* Round Robin timeout */
} *P_ROBIN;
typedef struct OS_XCB {
U8 cb_type; /* Control Block Type */
struct OS_TCB *p_lnk; /* Link pointer for ready/sem. wait list */
struct OS_TCB *p_rlnk; /* Link pointer for sem./mbx lst backwards */
struct OS_TCB *p_dlnk; /* Link pointer for delay list */
struct OS_TCB *p_blnk; /* Link pointer for delay list backwards */
U16 delta_time; /* Time until time out */
} *P_XCB;
typedef struct OS_MCB {
U8 cb_type; /* Control Block Type */
U8 state; /* State flag variable */
U8 isr_st; /* State flag variable for isr functions */
struct OS_TCB *p_lnk; /* Chain of tasks waiting for message */
U16 first; /* Index of the message list begin */
U16 last; /* Index of the message list end */
U16 count; /* Actual number of stored messages */
U16 size; /* Maximum number of stored messages */
void *msg[1]; /* FIFO for Message pointers 1st element */
} *P_MCB;
typedef struct OS_SCB {
U8 cb_type; /* Control Block Type */
U8 mask; /* Semaphore token mask */
U16 tokens; /* Semaphore tokens */
struct OS_TCB *p_lnk; /* Chain of tasks waiting for tokens */
} *P_SCB;
typedef struct OS_MUCB {
U8 cb_type; /* Control Block Type */
U16 level; /* Call nesting level */
struct OS_TCB *p_lnk; /* Chain of tasks waiting for mutex */
struct OS_TCB *owner; /* Mutex owner task */
struct OS_MUCB *p_mlnk; /* Chain of mutexes by owner task */
} *P_MUCB;
typedef struct OS_XTMR {
struct OS_TMR *next;
U16 tcnt;
} *P_XTMR;
typedef struct OS_TMR {
struct OS_TMR *next; /* Link pointer to Next timer */
U16 tcnt; /* Timer delay count */
U16 info; /* User defined call info */
} *P_TMR;
typedef struct OS_BM {
void *free; /* Pointer to first free memory block */
void *end; /* Pointer to memory block end */
U32 blk_size; /* Memory block size */
} *P_BM;
/* Definitions */
#define __TRUE 1U
#define __FALSE 0U
#define NULL ((void *) 0)
/*----------------------------------------------------------------------------
* end of file
*---------------------------------------------------------------------------*/
| {
"pile_set_name": "Github"
} |
<workspace name="timer_pwm_interrupt">
<project device="EFR32BG12P332F1024GL125"
name="EFR32BG12P_timer_pwm_interrupt">
<targets>
<name>slsproj</name>
<name>iar</name>
</targets>
<directories>
<cmsis>$PROJ_DIR$\..\..\..\..\..\platform\CMSIS</cmsis>
<device>$PROJ_DIR$\..\..\..\..\..\platform\Device\SiliconLabs</device>
<emlib>$PROJ_DIR$\..\..\..\..\..\platform\emlib</emlib>
<drivers>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\drivers</drivers>
<bsp>$PROJ_DIR$\..\..\..\..\..\hardware\kit\common\bsp</bsp>
<kitconfig>$PROJ_DIR$\..\..\..\..\..\hardware\kit\EFR32BG12_BRD4103A\config</kitconfig>
</directories>
<includepaths>
<path>##em-path-cmsis##\Include</path>
<path>##em-path-device##\EFR32BG12P\Include</path>
<path>##em-path-emlib##\inc</path>
<path>##em-path-kitconfig##</path>
<path>##em-path-bsp##</path>
<path>##em-path-drivers##</path>
</includepaths>
<group name="CMSIS">
<source>##em-path-device##\EFR32BG12P\Source\$IDE$\startup_efr32bg12p.s</source>
<source>##em-path-device##\EFR32BG12P\Source\system_efr32bg12p.c</source>
</group>
<group name="emlib">
<source>##em-path-emlib##\src\em_system.c</source>
<source>##em-path-emlib##\src\em_core.c</source>
<source>##em-path-emlib##\src\em_cmu.c</source>
<source>##em-path-emlib##\src\em_emu.c</source>
<source>##em-path-emlib##\src\em_gpio.c</source>
<source>##em-path-emlib##\src\em_timer.c</source>
</group>
<group name="Source">
<source>$PROJ_DIR$\..\src\main_s1.c</source>
<source>$PROJ_DIR$\..\readme.txt</source>
</group>
</project>
</workspace>
| {
"pile_set_name": "Github"
} |
/**
* This file is copyright 2017 State of the Netherlands (Ministry of Interior Affairs and Kingdom Relations).
* It is made available under the terms of the GNU Affero General Public License, version 3 as published by the Free Software Foundation.
* The project of which this file is part, may be found at https://github.com/MinBZK/operatieBRP.
*/
package nl.bzk.brp.model.logisch.kern;
import nl.bzk.brp.model.logisch.kern.basis.PersoonVerblijfstitelGroepBasis;
/**
* 1. Vorm van historie: beiden (zowel materi�le als formele historie).
* Het historiepatroon bij verblijfsrecht is bijzonder. De datum aanvang verblijfsrecht wordt aangeleverd door de IND,
* en komt logischerwijs overeen met datum aanvang geldigheid.
* De datum VOORZIEN einde kan in de toekomst liggen, en wijkt derhalve af van een 'normale' datum einde geldigheid, die
* meestal in het verleden zal liggen.
* Vanwege aanlevering vanuit migratie (met een andere granulariteit voor historie) kan datum aanvang geldigheid
* afwijken van de datum aanvang verblijfsrecht.
*
*
*
*/
public interface PersoonVerblijfstitelGroep extends PersoonVerblijfstitelGroepBasis {
}
| {
"pile_set_name": "Github"
} |
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should affect error message after formatting 1`] = `
"
<<<<<< before
no error
======
ERROR: (ter-padded-blocks) /src/tslint-eslint-rules/ter-padded-blocks/test.ts[1, 11]: Block must be padded by blank lines.
ERROR: (ter-padded-blocks) /src/tslint-eslint-rules/ter-padded-blocks/test.ts[3, 1]: Block must be padded by blank lines.
>>>>>> after
"
`;
exports[`should be pretty after formatting 1`] = `
"
<<<<<< before
if (true) {
somebody.doSomething();
}
======
if (true) {
somebody.doSomething();
}
>>>>>> after
"
`;
| {
"pile_set_name": "Github"
} |
package dns
import (
"encoding/base64"
"net"
"strconv"
"strings"
)
// A remainder of the rdata with embedded spaces, return the parsed string (sans the spaces)
// or an error
func endingToString(c *zlexer, errstr string) (string, *ParseError) {
var s string
l, _ := c.Next() // zString
for l.value != zNewline && l.value != zEOF {
if l.err {
return s, &ParseError{"", errstr, l}
}
switch l.value {
case zString:
s += l.token
case zBlank: // Ok
default:
return "", &ParseError{"", errstr, l}
}
l, _ = c.Next()
}
return s, nil
}
// A remainder of the rdata with embedded spaces, split on unquoted whitespace
// and return the parsed string slice or an error
func endingToTxtSlice(c *zlexer, errstr string) ([]string, *ParseError) {
// Get the remaining data until we see a zNewline
l, _ := c.Next()
if l.err {
return nil, &ParseError{"", errstr, l}
}
// Build the slice
s := make([]string, 0)
quote := false
empty := false
for l.value != zNewline && l.value != zEOF {
if l.err {
return nil, &ParseError{"", errstr, l}
}
switch l.value {
case zString:
empty = false
if len(l.token) > 255 {
// split up tokens that are larger than 255 into 255-chunks
sx := []string{}
p, i := 0, 255
for {
if i <= len(l.token) {
sx = append(sx, l.token[p:i])
} else {
sx = append(sx, l.token[p:])
break
}
p, i = p+255, i+255
}
s = append(s, sx...)
break
}
s = append(s, l.token)
case zBlank:
if quote {
// zBlank can only be seen in between txt parts.
return nil, &ParseError{"", errstr, l}
}
case zQuote:
if empty && quote {
s = append(s, "")
}
quote = !quote
empty = true
default:
return nil, &ParseError{"", errstr, l}
}
l, _ = c.Next()
}
if quote {
return nil, &ParseError{"", errstr, l}
}
return s, nil
}
func (rr *A) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
rr.A = net.ParseIP(l.token)
// IPv4 addresses cannot include ":".
// We do this rather than use net.IP's To4() because
// To4() treats IPv4-mapped IPv6 addresses as being
// IPv4.
isIPv4 := !strings.Contains(l.token, ":")
if rr.A == nil || !isIPv4 || l.err {
return &ParseError{"", "bad A A", l}
}
return slurpRemainder(c)
}
func (rr *AAAA) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
rr.AAAA = net.ParseIP(l.token)
// IPv6 addresses must include ":", and IPv4
// addresses cannot include ":".
isIPv6 := strings.Contains(l.token, ":")
if rr.AAAA == nil || !isIPv6 || l.err {
return &ParseError{"", "bad AAAA AAAA", l}
}
return slurpRemainder(c)
}
func (rr *NS) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad NS Ns", l}
}
rr.Ns = name
return slurpRemainder(c)
}
func (rr *PTR) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad PTR Ptr", l}
}
rr.Ptr = name
return slurpRemainder(c)
}
func (rr *NSAPPTR) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad NSAP-PTR Ptr", l}
}
rr.Ptr = name
return slurpRemainder(c)
}
func (rr *RP) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
mbox, mboxOk := toAbsoluteName(l.token, o)
if l.err || !mboxOk {
return &ParseError{"", "bad RP Mbox", l}
}
rr.Mbox = mbox
c.Next() // zBlank
l, _ = c.Next()
rr.Txt = l.token
txt, txtOk := toAbsoluteName(l.token, o)
if l.err || !txtOk {
return &ParseError{"", "bad RP Txt", l}
}
rr.Txt = txt
return slurpRemainder(c)
}
func (rr *MR) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad MR Mr", l}
}
rr.Mr = name
return slurpRemainder(c)
}
func (rr *MB) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad MB Mb", l}
}
rr.Mb = name
return slurpRemainder(c)
}
func (rr *MG) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad MG Mg", l}
}
rr.Mg = name
return slurpRemainder(c)
}
func (rr *HINFO) parse(c *zlexer, o string) *ParseError {
chunks, e := endingToTxtSlice(c, "bad HINFO Fields")
if e != nil {
return e
}
if ln := len(chunks); ln == 0 {
return nil
} else if ln == 1 {
// Can we split it?
if out := strings.Fields(chunks[0]); len(out) > 1 {
chunks = out
} else {
chunks = append(chunks, "")
}
}
rr.Cpu = chunks[0]
rr.Os = strings.Join(chunks[1:], " ")
return nil
}
func (rr *MINFO) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
rmail, rmailOk := toAbsoluteName(l.token, o)
if l.err || !rmailOk {
return &ParseError{"", "bad MINFO Rmail", l}
}
rr.Rmail = rmail
c.Next() // zBlank
l, _ = c.Next()
rr.Email = l.token
email, emailOk := toAbsoluteName(l.token, o)
if l.err || !emailOk {
return &ParseError{"", "bad MINFO Email", l}
}
rr.Email = email
return slurpRemainder(c)
}
func (rr *MF) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad MF Mf", l}
}
rr.Mf = name
return slurpRemainder(c)
}
func (rr *MD) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad MD Md", l}
}
rr.Md = name
return slurpRemainder(c)
}
func (rr *MX) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad MX Pref", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Mx = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad MX Mx", l}
}
rr.Mx = name
return slurpRemainder(c)
}
func (rr *RT) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil {
return &ParseError{"", "bad RT Preference", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Host = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad RT Host", l}
}
rr.Host = name
return slurpRemainder(c)
}
func (rr *AFSDB) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad AFSDB Subtype", l}
}
rr.Subtype = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Hostname = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad AFSDB Hostname", l}
}
rr.Hostname = name
return slurpRemainder(c)
}
func (rr *X25) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
if l.err {
return &ParseError{"", "bad X25 PSDNAddress", l}
}
rr.PSDNAddress = l.token
return slurpRemainder(c)
}
func (rr *KX) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad KX Pref", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Exchanger = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad KX Exchanger", l}
}
rr.Exchanger = name
return slurpRemainder(c)
}
func (rr *CNAME) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad CNAME Target", l}
}
rr.Target = name
return slurpRemainder(c)
}
func (rr *DNAME) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad DNAME Target", l}
}
rr.Target = name
return slurpRemainder(c)
}
func (rr *SOA) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
ns, nsOk := toAbsoluteName(l.token, o)
if l.err || !nsOk {
return &ParseError{"", "bad SOA Ns", l}
}
rr.Ns = ns
c.Next() // zBlank
l, _ = c.Next()
rr.Mbox = l.token
mbox, mboxOk := toAbsoluteName(l.token, o)
if l.err || !mboxOk {
return &ParseError{"", "bad SOA Mbox", l}
}
rr.Mbox = mbox
c.Next() // zBlank
var (
v uint32
ok bool
)
for i := 0; i < 5; i++ {
l, _ = c.Next()
if l.err {
return &ParseError{"", "bad SOA zone parameter", l}
}
if j, e := strconv.ParseUint(l.token, 10, 32); e != nil {
if i == 0 {
// Serial must be a number
return &ParseError{"", "bad SOA zone parameter", l}
}
// We allow other fields to be unitful duration strings
if v, ok = stringToTTL(l.token); !ok {
return &ParseError{"", "bad SOA zone parameter", l}
}
} else {
v = uint32(j)
}
switch i {
case 0:
rr.Serial = v
c.Next() // zBlank
case 1:
rr.Refresh = v
c.Next() // zBlank
case 2:
rr.Retry = v
c.Next() // zBlank
case 3:
rr.Expire = v
c.Next() // zBlank
case 4:
rr.Minttl = v
}
}
return slurpRemainder(c)
}
func (rr *SRV) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad SRV Priority", l}
}
rr.Priority = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad SRV Weight", l}
}
rr.Weight = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad SRV Port", l}
}
rr.Port = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Target = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad SRV Target", l}
}
rr.Target = name
return slurpRemainder(c)
}
func (rr *NAPTR) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad NAPTR Order", l}
}
rr.Order = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad NAPTR Preference", l}
}
rr.Preference = uint16(i)
// Flags
c.Next() // zBlank
l, _ = c.Next() // _QUOTE
if l.value != zQuote {
return &ParseError{"", "bad NAPTR Flags", l}
}
l, _ = c.Next() // Either String or Quote
if l.value == zString {
rr.Flags = l.token
l, _ = c.Next() // _QUOTE
if l.value != zQuote {
return &ParseError{"", "bad NAPTR Flags", l}
}
} else if l.value == zQuote {
rr.Flags = ""
} else {
return &ParseError{"", "bad NAPTR Flags", l}
}
// Service
c.Next() // zBlank
l, _ = c.Next() // _QUOTE
if l.value != zQuote {
return &ParseError{"", "bad NAPTR Service", l}
}
l, _ = c.Next() // Either String or Quote
if l.value == zString {
rr.Service = l.token
l, _ = c.Next() // _QUOTE
if l.value != zQuote {
return &ParseError{"", "bad NAPTR Service", l}
}
} else if l.value == zQuote {
rr.Service = ""
} else {
return &ParseError{"", "bad NAPTR Service", l}
}
// Regexp
c.Next() // zBlank
l, _ = c.Next() // _QUOTE
if l.value != zQuote {
return &ParseError{"", "bad NAPTR Regexp", l}
}
l, _ = c.Next() // Either String or Quote
if l.value == zString {
rr.Regexp = l.token
l, _ = c.Next() // _QUOTE
if l.value != zQuote {
return &ParseError{"", "bad NAPTR Regexp", l}
}
} else if l.value == zQuote {
rr.Regexp = ""
} else {
return &ParseError{"", "bad NAPTR Regexp", l}
}
// After quote no space??
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Replacement = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad NAPTR Replacement", l}
}
rr.Replacement = name
return slurpRemainder(c)
}
func (rr *TALINK) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
previousName, previousNameOk := toAbsoluteName(l.token, o)
if l.err || !previousNameOk {
return &ParseError{"", "bad TALINK PreviousName", l}
}
rr.PreviousName = previousName
c.Next() // zBlank
l, _ = c.Next()
rr.NextName = l.token
nextName, nextNameOk := toAbsoluteName(l.token, o)
if l.err || !nextNameOk {
return &ParseError{"", "bad TALINK NextName", l}
}
rr.NextName = nextName
return slurpRemainder(c)
}
func (rr *LOC) parse(c *zlexer, o string) *ParseError {
// Non zero defaults for LOC record, see RFC 1876, Section 3.
rr.HorizPre = 165 // 10000
rr.VertPre = 162 // 10
rr.Size = 18 // 1
ok := false
// North
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return &ParseError{"", "bad LOC Latitude", l}
}
rr.Latitude = 1000 * 60 * 60 * uint32(i)
c.Next() // zBlank
// Either number, 'N' or 'S'
l, _ = c.Next()
if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok {
goto East
}
i, e = strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return &ParseError{"", "bad LOC Latitude minutes", l}
}
rr.Latitude += 1000 * 60 * uint32(i)
c.Next() // zBlank
l, _ = c.Next()
if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err {
return &ParseError{"", "bad LOC Latitude seconds", l}
} else {
rr.Latitude += uint32(1000 * i)
}
c.Next() // zBlank
// Either number, 'N' or 'S'
l, _ = c.Next()
if rr.Latitude, ok = locCheckNorth(l.token, rr.Latitude); ok {
goto East
}
// If still alive, flag an error
return &ParseError{"", "bad LOC Latitude North/South", l}
East:
// East
c.Next() // zBlank
l, _ = c.Next()
if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err {
return &ParseError{"", "bad LOC Longitude", l}
} else {
rr.Longitude = 1000 * 60 * 60 * uint32(i)
}
c.Next() // zBlank
// Either number, 'E' or 'W'
l, _ = c.Next()
if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok {
goto Altitude
}
if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err {
return &ParseError{"", "bad LOC Longitude minutes", l}
} else {
rr.Longitude += 1000 * 60 * uint32(i)
}
c.Next() // zBlank
l, _ = c.Next()
if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err {
return &ParseError{"", "bad LOC Longitude seconds", l}
} else {
rr.Longitude += uint32(1000 * i)
}
c.Next() // zBlank
// Either number, 'E' or 'W'
l, _ = c.Next()
if rr.Longitude, ok = locCheckEast(l.token, rr.Longitude); ok {
goto Altitude
}
// If still alive, flag an error
return &ParseError{"", "bad LOC Longitude East/West", l}
Altitude:
c.Next() // zBlank
l, _ = c.Next()
if len(l.token) == 0 || l.err {
return &ParseError{"", "bad LOC Altitude", l}
}
if l.token[len(l.token)-1] == 'M' || l.token[len(l.token)-1] == 'm' {
l.token = l.token[0 : len(l.token)-1]
}
if i, e := strconv.ParseFloat(l.token, 32); e != nil {
return &ParseError{"", "bad LOC Altitude", l}
} else {
rr.Altitude = uint32(i*100.0 + 10000000.0 + 0.5)
}
// And now optionally the other values
l, _ = c.Next()
count := 0
for l.value != zNewline && l.value != zEOF {
switch l.value {
case zString:
switch count {
case 0: // Size
e, m, ok := stringToCm(l.token)
if !ok {
return &ParseError{"", "bad LOC Size", l}
}
rr.Size = e&0x0f | m<<4&0xf0
case 1: // HorizPre
e, m, ok := stringToCm(l.token)
if !ok {
return &ParseError{"", "bad LOC HorizPre", l}
}
rr.HorizPre = e&0x0f | m<<4&0xf0
case 2: // VertPre
e, m, ok := stringToCm(l.token)
if !ok {
return &ParseError{"", "bad LOC VertPre", l}
}
rr.VertPre = e&0x0f | m<<4&0xf0
}
count++
case zBlank:
// Ok
default:
return &ParseError{"", "bad LOC Size, HorizPre or VertPre", l}
}
l, _ = c.Next()
}
return nil
}
func (rr *HIP) parse(c *zlexer, o string) *ParseError {
// HitLength is not represented
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad HIP PublicKeyAlgorithm", l}
}
rr.PublicKeyAlgorithm = uint8(i)
c.Next() // zBlank
l, _ = c.Next() // zString
if len(l.token) == 0 || l.err {
return &ParseError{"", "bad HIP Hit", l}
}
rr.Hit = l.token // This can not contain spaces, see RFC 5205 Section 6.
rr.HitLength = uint8(len(rr.Hit)) / 2
c.Next() // zBlank
l, _ = c.Next() // zString
if len(l.token) == 0 || l.err {
return &ParseError{"", "bad HIP PublicKey", l}
}
rr.PublicKey = l.token // This cannot contain spaces
rr.PublicKeyLength = uint16(base64.StdEncoding.DecodedLen(len(rr.PublicKey)))
// RendezvousServers (if any)
l, _ = c.Next()
var xs []string
for l.value != zNewline && l.value != zEOF {
switch l.value {
case zString:
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad HIP RendezvousServers", l}
}
xs = append(xs, name)
case zBlank:
// Ok
default:
return &ParseError{"", "bad HIP RendezvousServers", l}
}
l, _ = c.Next()
}
rr.RendezvousServers = xs
return nil
}
func (rr *CERT) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
if v, ok := StringToCertType[l.token]; ok {
rr.Type = v
} else if i, e := strconv.ParseUint(l.token, 10, 16); e != nil {
return &ParseError{"", "bad CERT Type", l}
} else {
rr.Type = uint16(i)
}
c.Next() // zBlank
l, _ = c.Next() // zString
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad CERT KeyTag", l}
}
rr.KeyTag = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
if v, ok := StringToAlgorithm[l.token]; ok {
rr.Algorithm = v
} else if i, e := strconv.ParseUint(l.token, 10, 8); e != nil {
return &ParseError{"", "bad CERT Algorithm", l}
} else {
rr.Algorithm = uint8(i)
}
s, e1 := endingToString(c, "bad CERT Certificate")
if e1 != nil {
return e1
}
rr.Certificate = s
return nil
}
func (rr *OPENPGPKEY) parse(c *zlexer, o string) *ParseError {
s, e := endingToString(c, "bad OPENPGPKEY PublicKey")
if e != nil {
return e
}
rr.PublicKey = s
return nil
}
func (rr *CSYNC) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
j, e := strconv.ParseUint(l.token, 10, 32)
if e != nil {
// Serial must be a number
return &ParseError{"", "bad CSYNC serial", l}
}
rr.Serial = uint32(j)
c.Next() // zBlank
l, _ = c.Next()
j, e = strconv.ParseUint(l.token, 10, 16)
if e != nil {
// Serial must be a number
return &ParseError{"", "bad CSYNC flags", l}
}
rr.Flags = uint16(j)
rr.TypeBitMap = make([]uint16, 0)
var (
k uint16
ok bool
)
l, _ = c.Next()
for l.value != zNewline && l.value != zEOF {
switch l.value {
case zBlank:
// Ok
case zString:
tokenUpper := strings.ToUpper(l.token)
if k, ok = StringToType[tokenUpper]; !ok {
if k, ok = typeToInt(l.token); !ok {
return &ParseError{"", "bad CSYNC TypeBitMap", l}
}
}
rr.TypeBitMap = append(rr.TypeBitMap, k)
default:
return &ParseError{"", "bad CSYNC TypeBitMap", l}
}
l, _ = c.Next()
}
return nil
}
func (rr *SIG) parse(c *zlexer, o string) *ParseError {
return rr.RRSIG.parse(c, o)
}
func (rr *RRSIG) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
tokenUpper := strings.ToUpper(l.token)
if t, ok := StringToType[tokenUpper]; !ok {
if strings.HasPrefix(tokenUpper, "TYPE") {
t, ok = typeToInt(l.token)
if !ok {
return &ParseError{"", "bad RRSIG Typecovered", l}
}
rr.TypeCovered = t
} else {
return &ParseError{"", "bad RRSIG Typecovered", l}
}
} else {
rr.TypeCovered = t
}
c.Next() // zBlank
l, _ = c.Next()
i, err := strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return &ParseError{"", "bad RRSIG Algorithm", l}
}
rr.Algorithm = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, err = strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return &ParseError{"", "bad RRSIG Labels", l}
}
rr.Labels = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, err = strconv.ParseUint(l.token, 10, 32)
if err != nil || l.err {
return &ParseError{"", "bad RRSIG OrigTtl", l}
}
rr.OrigTtl = uint32(i)
c.Next() // zBlank
l, _ = c.Next()
if i, err := StringToTime(l.token); err != nil {
// Try to see if all numeric and use it as epoch
if i, err := strconv.ParseInt(l.token, 10, 64); err == nil {
// TODO(miek): error out on > MAX_UINT32, same below
rr.Expiration = uint32(i)
} else {
return &ParseError{"", "bad RRSIG Expiration", l}
}
} else {
rr.Expiration = i
}
c.Next() // zBlank
l, _ = c.Next()
if i, err := StringToTime(l.token); err != nil {
if i, err := strconv.ParseInt(l.token, 10, 64); err == nil {
rr.Inception = uint32(i)
} else {
return &ParseError{"", "bad RRSIG Inception", l}
}
} else {
rr.Inception = i
}
c.Next() // zBlank
l, _ = c.Next()
i, err = strconv.ParseUint(l.token, 10, 16)
if err != nil || l.err {
return &ParseError{"", "bad RRSIG KeyTag", l}
}
rr.KeyTag = uint16(i)
c.Next() // zBlank
l, _ = c.Next()
rr.SignerName = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad RRSIG SignerName", l}
}
rr.SignerName = name
s, e := endingToString(c, "bad RRSIG Signature")
if e != nil {
return e
}
rr.Signature = s
return nil
}
func (rr *NSEC) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad NSEC NextDomain", l}
}
rr.NextDomain = name
rr.TypeBitMap = make([]uint16, 0)
var (
k uint16
ok bool
)
l, _ = c.Next()
for l.value != zNewline && l.value != zEOF {
switch l.value {
case zBlank:
// Ok
case zString:
tokenUpper := strings.ToUpper(l.token)
if k, ok = StringToType[tokenUpper]; !ok {
if k, ok = typeToInt(l.token); !ok {
return &ParseError{"", "bad NSEC TypeBitMap", l}
}
}
rr.TypeBitMap = append(rr.TypeBitMap, k)
default:
return &ParseError{"", "bad NSEC TypeBitMap", l}
}
l, _ = c.Next()
}
return nil
}
func (rr *NSEC3) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad NSEC3 Hash", l}
}
rr.Hash = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad NSEC3 Flags", l}
}
rr.Flags = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad NSEC3 Iterations", l}
}
rr.Iterations = uint16(i)
c.Next()
l, _ = c.Next()
if len(l.token) == 0 || l.err {
return &ParseError{"", "bad NSEC3 Salt", l}
}
if l.token != "-" {
rr.SaltLength = uint8(len(l.token)) / 2
rr.Salt = l.token
}
c.Next()
l, _ = c.Next()
if len(l.token) == 0 || l.err {
return &ParseError{"", "bad NSEC3 NextDomain", l}
}
rr.HashLength = 20 // Fix for NSEC3 (sha1 160 bits)
rr.NextDomain = l.token
rr.TypeBitMap = make([]uint16, 0)
var (
k uint16
ok bool
)
l, _ = c.Next()
for l.value != zNewline && l.value != zEOF {
switch l.value {
case zBlank:
// Ok
case zString:
tokenUpper := strings.ToUpper(l.token)
if k, ok = StringToType[tokenUpper]; !ok {
if k, ok = typeToInt(l.token); !ok {
return &ParseError{"", "bad NSEC3 TypeBitMap", l}
}
}
rr.TypeBitMap = append(rr.TypeBitMap, k)
default:
return &ParseError{"", "bad NSEC3 TypeBitMap", l}
}
l, _ = c.Next()
}
return nil
}
func (rr *NSEC3PARAM) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad NSEC3PARAM Hash", l}
}
rr.Hash = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad NSEC3PARAM Flags", l}
}
rr.Flags = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad NSEC3PARAM Iterations", l}
}
rr.Iterations = uint16(i)
c.Next()
l, _ = c.Next()
if l.token != "-" {
rr.SaltLength = uint8(len(l.token))
rr.Salt = l.token
}
return slurpRemainder(c)
}
func (rr *EUI48) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
if len(l.token) != 17 || l.err {
return &ParseError{"", "bad EUI48 Address", l}
}
addr := make([]byte, 12)
dash := 0
for i := 0; i < 10; i += 2 {
addr[i] = l.token[i+dash]
addr[i+1] = l.token[i+1+dash]
dash++
if l.token[i+1+dash] != '-' {
return &ParseError{"", "bad EUI48 Address", l}
}
}
addr[10] = l.token[15]
addr[11] = l.token[16]
i, e := strconv.ParseUint(string(addr), 16, 48)
if e != nil {
return &ParseError{"", "bad EUI48 Address", l}
}
rr.Address = i
return slurpRemainder(c)
}
func (rr *EUI64) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
if len(l.token) != 23 || l.err {
return &ParseError{"", "bad EUI64 Address", l}
}
addr := make([]byte, 16)
dash := 0
for i := 0; i < 14; i += 2 {
addr[i] = l.token[i+dash]
addr[i+1] = l.token[i+1+dash]
dash++
if l.token[i+1+dash] != '-' {
return &ParseError{"", "bad EUI64 Address", l}
}
}
addr[14] = l.token[21]
addr[15] = l.token[22]
i, e := strconv.ParseUint(string(addr), 16, 64)
if e != nil {
return &ParseError{"", "bad EUI68 Address", l}
}
rr.Address = i
return slurpRemainder(c)
}
func (rr *SSHFP) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad SSHFP Algorithm", l}
}
rr.Algorithm = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad SSHFP Type", l}
}
rr.Type = uint8(i)
c.Next() // zBlank
s, e1 := endingToString(c, "bad SSHFP Fingerprint")
if e1 != nil {
return e1
}
rr.FingerPrint = s
return nil
}
func (rr *DNSKEY) parseDNSKEY(c *zlexer, o, typ string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad " + typ + " Flags", l}
}
rr.Flags = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad " + typ + " Protocol", l}
}
rr.Protocol = uint8(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad " + typ + " Algorithm", l}
}
rr.Algorithm = uint8(i)
s, e1 := endingToString(c, "bad "+typ+" PublicKey")
if e1 != nil {
return e1
}
rr.PublicKey = s
return nil
}
func (rr *DNSKEY) parse(c *zlexer, o string) *ParseError {
return rr.parseDNSKEY(c, o, "DNSKEY")
}
func (rr *KEY) parse(c *zlexer, o string) *ParseError {
return rr.parseDNSKEY(c, o, "KEY")
}
func (rr *CDNSKEY) parse(c *zlexer, o string) *ParseError {
return rr.parseDNSKEY(c, o, "CDNSKEY")
}
func (rr *RKEY) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad RKEY Flags", l}
}
rr.Flags = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad RKEY Protocol", l}
}
rr.Protocol = uint8(i)
c.Next() // zBlank
l, _ = c.Next() // zString
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad RKEY Algorithm", l}
}
rr.Algorithm = uint8(i)
s, e1 := endingToString(c, "bad RKEY PublicKey")
if e1 != nil {
return e1
}
rr.PublicKey = s
return nil
}
func (rr *EID) parse(c *zlexer, o string) *ParseError {
s, e := endingToString(c, "bad EID Endpoint")
if e != nil {
return e
}
rr.Endpoint = s
return nil
}
func (rr *NIMLOC) parse(c *zlexer, o string) *ParseError {
s, e := endingToString(c, "bad NIMLOC Locator")
if e != nil {
return e
}
rr.Locator = s
return nil
}
func (rr *GPOS) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
_, e := strconv.ParseFloat(l.token, 64)
if e != nil || l.err {
return &ParseError{"", "bad GPOS Longitude", l}
}
rr.Longitude = l.token
c.Next() // zBlank
l, _ = c.Next()
_, e = strconv.ParseFloat(l.token, 64)
if e != nil || l.err {
return &ParseError{"", "bad GPOS Latitude", l}
}
rr.Latitude = l.token
c.Next() // zBlank
l, _ = c.Next()
_, e = strconv.ParseFloat(l.token, 64)
if e != nil || l.err {
return &ParseError{"", "bad GPOS Altitude", l}
}
rr.Altitude = l.token
return slurpRemainder(c)
}
func (rr *DS) parseDS(c *zlexer, o, typ string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad " + typ + " KeyTag", l}
}
rr.KeyTag = uint16(i)
c.Next() // zBlank
l, _ = c.Next()
if i, e = strconv.ParseUint(l.token, 10, 8); e != nil {
tokenUpper := strings.ToUpper(l.token)
i, ok := StringToAlgorithm[tokenUpper]
if !ok || l.err {
return &ParseError{"", "bad " + typ + " Algorithm", l}
}
rr.Algorithm = i
} else {
rr.Algorithm = uint8(i)
}
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad " + typ + " DigestType", l}
}
rr.DigestType = uint8(i)
s, e1 := endingToString(c, "bad "+typ+" Digest")
if e1 != nil {
return e1
}
rr.Digest = s
return nil
}
func (rr *DS) parse(c *zlexer, o string) *ParseError {
return rr.parseDS(c, o, "DS")
}
func (rr *DLV) parse(c *zlexer, o string) *ParseError {
return rr.parseDS(c, o, "DLV")
}
func (rr *CDS) parse(c *zlexer, o string) *ParseError {
return rr.parseDS(c, o, "CDS")
}
func (rr *TA) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad TA KeyTag", l}
}
rr.KeyTag = uint16(i)
c.Next() // zBlank
l, _ = c.Next()
if i, e := strconv.ParseUint(l.token, 10, 8); e != nil {
tokenUpper := strings.ToUpper(l.token)
i, ok := StringToAlgorithm[tokenUpper]
if !ok || l.err {
return &ParseError{"", "bad TA Algorithm", l}
}
rr.Algorithm = i
} else {
rr.Algorithm = uint8(i)
}
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad TA DigestType", l}
}
rr.DigestType = uint8(i)
s, err := endingToString(c, "bad TA Digest")
if err != nil {
return err
}
rr.Digest = s
return nil
}
func (rr *TLSA) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad TLSA Usage", l}
}
rr.Usage = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad TLSA Selector", l}
}
rr.Selector = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad TLSA MatchingType", l}
}
rr.MatchingType = uint8(i)
// So this needs be e2 (i.e. different than e), because...??t
s, e2 := endingToString(c, "bad TLSA Certificate")
if e2 != nil {
return e2
}
rr.Certificate = s
return nil
}
func (rr *SMIMEA) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad SMIMEA Usage", l}
}
rr.Usage = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad SMIMEA Selector", l}
}
rr.Selector = uint8(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 8)
if e != nil || l.err {
return &ParseError{"", "bad SMIMEA MatchingType", l}
}
rr.MatchingType = uint8(i)
// So this needs be e2 (i.e. different than e), because...??t
s, e2 := endingToString(c, "bad SMIMEA Certificate")
if e2 != nil {
return e2
}
rr.Certificate = s
return nil
}
func (rr *RFC3597) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
if l.token != "\\#" {
return &ParseError{"", "bad RFC3597 Rdata", l}
}
c.Next() // zBlank
l, _ = c.Next()
rdlength, e := strconv.Atoi(l.token)
if e != nil || l.err {
return &ParseError{"", "bad RFC3597 Rdata ", l}
}
s, e1 := endingToString(c, "bad RFC3597 Rdata")
if e1 != nil {
return e1
}
if rdlength*2 != len(s) {
return &ParseError{"", "bad RFC3597 Rdata", l}
}
rr.Rdata = s
return nil
}
func (rr *SPF) parse(c *zlexer, o string) *ParseError {
s, e := endingToTxtSlice(c, "bad SPF Txt")
if e != nil {
return e
}
rr.Txt = s
return nil
}
func (rr *AVC) parse(c *zlexer, o string) *ParseError {
s, e := endingToTxtSlice(c, "bad AVC Txt")
if e != nil {
return e
}
rr.Txt = s
return nil
}
func (rr *TXT) parse(c *zlexer, o string) *ParseError {
// no zBlank reading here, because all this rdata is TXT
s, e := endingToTxtSlice(c, "bad TXT Txt")
if e != nil {
return e
}
rr.Txt = s
return nil
}
// identical to setTXT
func (rr *NINFO) parse(c *zlexer, o string) *ParseError {
s, e := endingToTxtSlice(c, "bad NINFO ZSData")
if e != nil {
return e
}
rr.ZSData = s
return nil
}
func (rr *URI) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad URI Priority", l}
}
rr.Priority = uint16(i)
c.Next() // zBlank
l, _ = c.Next()
i, e = strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad URI Weight", l}
}
rr.Weight = uint16(i)
c.Next() // zBlank
s, err := endingToTxtSlice(c, "bad URI Target")
if err != nil {
return err
}
if len(s) != 1 {
return &ParseError{"", "bad URI Target", l}
}
rr.Target = s[0]
return nil
}
func (rr *DHCID) parse(c *zlexer, o string) *ParseError {
// awesome record to parse!
s, e := endingToString(c, "bad DHCID Digest")
if e != nil {
return e
}
rr.Digest = s
return nil
}
func (rr *NID) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad NID Preference", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
u, err := stringToNodeID(l)
if err != nil || l.err {
return err
}
rr.NodeID = u
return slurpRemainder(c)
}
func (rr *L32) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad L32 Preference", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Locator32 = net.ParseIP(l.token)
if rr.Locator32 == nil || l.err {
return &ParseError{"", "bad L32 Locator", l}
}
return slurpRemainder(c)
}
func (rr *LP) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad LP Preference", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Fqdn = l.token
name, nameOk := toAbsoluteName(l.token, o)
if l.err || !nameOk {
return &ParseError{"", "bad LP Fqdn", l}
}
rr.Fqdn = name
return slurpRemainder(c)
}
func (rr *L64) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad L64 Preference", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
u, err := stringToNodeID(l)
if err != nil || l.err {
return err
}
rr.Locator64 = u
return slurpRemainder(c)
}
func (rr *UID) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return &ParseError{"", "bad UID Uid", l}
}
rr.Uid = uint32(i)
return slurpRemainder(c)
}
func (rr *GID) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 32)
if e != nil || l.err {
return &ParseError{"", "bad GID Gid", l}
}
rr.Gid = uint32(i)
return slurpRemainder(c)
}
func (rr *UINFO) parse(c *zlexer, o string) *ParseError {
s, e := endingToTxtSlice(c, "bad UINFO Uinfo")
if e != nil {
return e
}
if ln := len(s); ln == 0 {
return nil
}
rr.Uinfo = s[0] // silently discard anything after the first character-string
return nil
}
func (rr *PX) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, e := strconv.ParseUint(l.token, 10, 16)
if e != nil || l.err {
return &ParseError{"", "bad PX Preference", l}
}
rr.Preference = uint16(i)
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Map822 = l.token
map822, map822Ok := toAbsoluteName(l.token, o)
if l.err || !map822Ok {
return &ParseError{"", "bad PX Map822", l}
}
rr.Map822 = map822
c.Next() // zBlank
l, _ = c.Next() // zString
rr.Mapx400 = l.token
mapx400, mapx400Ok := toAbsoluteName(l.token, o)
if l.err || !mapx400Ok {
return &ParseError{"", "bad PX Mapx400", l}
}
rr.Mapx400 = mapx400
return slurpRemainder(c)
}
func (rr *CAA) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
i, err := strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return &ParseError{"", "bad CAA Flag", l}
}
rr.Flag = uint8(i)
c.Next() // zBlank
l, _ = c.Next() // zString
if l.value != zString {
return &ParseError{"", "bad CAA Tag", l}
}
rr.Tag = l.token
c.Next() // zBlank
s, e := endingToTxtSlice(c, "bad CAA Value")
if e != nil {
return e
}
if len(s) != 1 {
return &ParseError{"", "bad CAA Value", l}
}
rr.Value = s[0]
return nil
}
func (rr *TKEY) parse(c *zlexer, o string) *ParseError {
l, _ := c.Next()
// Algorithm
if l.value != zString {
return &ParseError{"", "bad TKEY algorithm", l}
}
rr.Algorithm = l.token
c.Next() // zBlank
// Get the key length and key values
l, _ = c.Next()
i, err := strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return &ParseError{"", "bad TKEY key length", l}
}
rr.KeySize = uint16(i)
c.Next() // zBlank
l, _ = c.Next()
if l.value != zString {
return &ParseError{"", "bad TKEY key", l}
}
rr.Key = l.token
c.Next() // zBlank
// Get the otherdata length and string data
l, _ = c.Next()
i, err = strconv.ParseUint(l.token, 10, 8)
if err != nil || l.err {
return &ParseError{"", "bad TKEY otherdata length", l}
}
rr.OtherLen = uint16(i)
c.Next() // zBlank
l, _ = c.Next()
if l.value != zString {
return &ParseError{"", "bad TKEY otherday", l}
}
rr.OtherData = l.token
return nil
}
func (rr *APL) parse(c *zlexer, o string) *ParseError {
var prefixes []APLPrefix
for {
l, _ := c.Next()
if l.value == zNewline || l.value == zEOF {
break
}
if l.value == zBlank && prefixes != nil {
continue
}
if l.value != zString {
return &ParseError{"", "unexpected APL field", l}
}
// Expected format: [!]afi:address/prefix
colon := strings.IndexByte(l.token, ':')
if colon == -1 {
return &ParseError{"", "missing colon in APL field", l}
}
family, cidr := l.token[:colon], l.token[colon+1:]
var negation bool
if family != "" && family[0] == '!' {
negation = true
family = family[1:]
}
afi, err := strconv.ParseUint(family, 10, 16)
if err != nil {
return &ParseError{"", "failed to parse APL family: " + err.Error(), l}
}
var addrLen int
switch afi {
case 1:
addrLen = net.IPv4len
case 2:
addrLen = net.IPv6len
default:
return &ParseError{"", "unrecognized APL family", l}
}
ip, subnet, err := net.ParseCIDR(cidr)
if err != nil {
return &ParseError{"", "failed to parse APL address: " + err.Error(), l}
}
if !ip.Equal(subnet.IP) {
return &ParseError{"", "extra bits in APL address", l}
}
if len(subnet.IP) != addrLen {
return &ParseError{"", "address mismatch with the APL family", l}
}
prefixes = append(prefixes, APLPrefix{
Negation: negation,
Network: *subnet,
})
}
rr.Prefixes = prefixes
return nil
}
| {
"pile_set_name": "Github"
} |
namespace System
{
/// <summary>
/// Extension methods for <see cref="EventHandler"/>.
/// </summary>
public static class AbpEventHandlerExtensions
{
/// <summary>
/// Raises given event safely with given arguments.
/// </summary>
/// <param name="eventHandler">The event handler</param>
/// <param name="sender">Source of the event</param>
public static void InvokeSafely(this EventHandler eventHandler, object sender)
{
eventHandler.InvokeSafely(sender, EventArgs.Empty);
}
/// <summary>
/// Raises given event safely with given arguments.
/// </summary>
/// <param name="eventHandler">The event handler</param>
/// <param name="sender">Source of the event</param>
/// <param name="e">Event argument</param>
public static void InvokeSafely(this EventHandler eventHandler, object sender, EventArgs e)
{
eventHandler?.Invoke(sender, e);
}
/// <summary>
/// Raises given event safely with given arguments.
/// </summary>
/// <typeparam name="TEventArgs">Type of the <see cref="EventArgs"/></typeparam>
/// <param name="eventHandler">The event handler</param>
/// <param name="sender">Source of the event</param>
/// <param name="e">Event argument</param>
public static void InvokeSafely<TEventArgs>(this EventHandler<TEventArgs> eventHandler, object sender, TEventArgs e)
where TEventArgs : EventArgs
{
eventHandler?.Invoke(sender, e);
}
}
} | {
"pile_set_name": "Github"
} |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_03) on Tue Jun 10 03:55:40 CEST 2008 -->
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
org.jasypt.intf.service (JASYPT: Java Simplified Encryption 1.5 API)
</TITLE>
<META NAME="date" CONTENT="2008-06-10">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="org.jasypt.intf.service (JASYPT: Java Simplified Encryption 1.5 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/jasypt/intf/cli/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../org/jasypt/normalization/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/jasypt/intf/service/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<H2>
Package org.jasypt.intf.service
</H2>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Class Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../org/jasypt/intf/service/JasyptStatelessService.html" title="class in org.jasypt.intf.service">JasyptStatelessService</A></B></TD>
<TD>
This class acts as a stateless service for encryption, decryption and
digest operations, letting its clients configure all the jasypt environment
(algorithms, passwords, providers...) from Strings in a single call, be it
using direct values, environment variables or java vm properties.</TD>
</TR>
</TABLE>
<P>
<DL>
</DL>
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../org/jasypt/intf/cli/package-summary.html"><B>PREV PACKAGE</B></A>
<A HREF="../../../../org/jasypt/normalization/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html?org/jasypt/intf/service/package-summary.html" target="_top"><B>FRAMES</B></A>
<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright © 2008 <a href="http://www.jasypt.org">The JASYPT team</a>. All Rights Reserved.
</BODY>
</HTML>
| {
"pile_set_name": "Github"
} |
package org.apache.spark.ml.dsl.utils
import java.util
import com.tribbloids.spookystuff.utils.CachingUtils
import com.tribbloids.spookystuff.utils.CachingUtils.ConcurrentCache
import org.apache.spark.ml.dsl.utils.messaging.MessageAPI
import org.json4s.Extraction._
import org.json4s.JsonAST.JString
import org.json4s._
import org.json4s.reflect.{TypeInfo, _}
object XMLWeakDeserializer {
case class ExceptionMetadata(
jValue: Option[JValue] = None,
typeInfo: Option[String] = None,
serDe: SerDeMetadata
) extends MessageAPI
case class SerDeMetadata(
reporting: Option[String] = None,
primitives: Seq[String] = Nil,
field: Map[String, String] = Map.empty,
custom: Seq[String] = Nil
)
val cached: ConcurrentCache[Long, ParsingException] = CachingUtils.ConcurrentCache[Long, ParsingException]()
trait ExceptionLike extends Throwable with Verbose {
// def metadata: ExceptionMetadata
override def getMessage: String = detailedStr
}
class ParsingException(
override val shortStr: String,
cause: Exception,
val metadata: ExceptionMetadata
) extends MappingException(shortStr, cause)
with ExceptionLike {
{
cached.put(System.currentTimeMillis(), this)
}
override def detail: String =
s"""
|"METADATA": ${metadata.toJSON()}
|""".trim.stripMargin
}
case class UnrecoverableError(
override val shortStr: String,
cause: Throwable
// override val metadata: ExceptionMetadata
) extends Error
with ExceptionLike {
override def detail: String =
s"""
|### [RECENT XML EXCEPTIONS] ###
|
|${cached.toSeq.sortBy(_._1).map(_._2).mkString("\n")}
|""".stripMargin
}
}
abstract class XMLWeakDeserializer[T: Manifest] extends Serializer[T] {
import XMLWeakDeserializer._
// cannot serialize
override def serialize(implicit format: Formats): PartialFunction[Any, JValue] = PartialFunction.empty
def exceptionMetadata(
jValue: JValue,
typeInfo: TypeInfo,
formats: Formats
): ExceptionMetadata = ExceptionMetadata(
Some(jValue),
Some(typeInfo.toString),
SerDeMetadata(
Some(this.getClass.getName),
formats.primitives.toSeq.map(_.toString),
Map(formats.fieldSerializers.map(v => v._1.getName -> v._2.toString): _*),
formats.customSerializers.map(_.toString)
)
)
def wrapException[A](ti: TypeInfo, jv: JValue, format: Formats)(fn: => A): A = {
lazy val metadata = exceptionMetadata(jv, ti, format)
try {
fn
} catch {
case e: MappingException =>
throw new ParsingException(
e.getMessage,
e,
metadata
)
case e: Exception =>
// throw new ParsingException(
// e.getMessage,
// e,
// metadata
// )
throw e
case e: Throwable =>
throw UnrecoverableError(
e.getClass.getSimpleName,
e
)
}
}
override final def deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), T] = {
val result: ((TypeInfo, JValue)) => Option[T] = {
case (ti, jv) =>
wrapException(ti, jv, format) {
_deserialize(format).lift.apply(ti -> jv)
}
}
Function.unlift(result)
}
def _deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), T]
}
// <tag>12</tag> => tag: 12
object StringToNumberDeserializer extends XMLWeakDeserializer[Any] {
override def _deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), Any] = Function.unlift {
case (ti @ TypeInfo(cc, _), JString(v)) =>
val parsed = cc match {
case java.lang.Byte.TYPE => v.toByte
case java.lang.Short.TYPE => v.toShort
case java.lang.Character.TYPE => v.toInt.toChar
case java.lang.Integer.TYPE => v.toInt
case java.lang.Long.TYPE => v.toLong
case java.lang.Float.TYPE => v.toFloat
case java.lang.Double.TYPE => v.toDouble
case java.lang.Boolean.TYPE => v.toBoolean
case _ => null
//TODO: add boxed type, or use try/errorToNone
}
Option(parsed)
case _ => None
}
}
// <tag/> => tag: {}
object EmptyStringToEmptyObjectDeserializer extends XMLWeakDeserializer[Any] {
override def _deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), Any] = Function.unlift {
case (ti @ TypeInfo(cc, _), jv @ JString(str)) if !cc.isAssignableFrom(classOf[String]) && str.trim.isEmpty =>
// wrapException(ti, jv, format) {
Some(extract(JObject(), ti)(format))
// }
case _ => None
}
}
// <tag>12</tag> => tag: [12]
// <tag>abc</tag> => tag: ["abc"]
object ElementToArrayDeserializer extends XMLWeakDeserializer[Any] {
val listClass: Class[List[_]] = classOf[List[_]]
val seqClass: Class[Seq[_]] = classOf[Seq[_]]
val setClass: Class[Set[_]] = classOf[Set[_]]
val arrayListClass: Class[util.ArrayList[_]] = classOf[java.util.ArrayList[_]]
override def _deserialize(implicit format: Formats): PartialFunction[(TypeInfo, JValue), Any] = {
case (ti @ TypeInfo(this.listClass | this.seqClass, _), jv) if !jv.isInstanceOf[JArray] =>
extractInner(ti, jv, format).toList
case (ti @ TypeInfo(this.setClass, _), jv) if !jv.isInstanceOf[JArray] =>
extractInner(ti, jv, format).toSet
case (ti @ TypeInfo(this.arrayListClass, _), jv) if !jv.isInstanceOf[JArray] =>
import scala.collection.JavaConverters._
new java.util.ArrayList[Any](extractInner(ti, jv, format).toList.asJava)
case (ti @ TypeInfo(cc, _), jv) if !jv.isInstanceOf[JArray] && cc.isArray =>
val a = extractInner(ti, jv, format).toArray
mkTypedArray(a, firstTypeArg(ti))
}
def mkTypedArray(a: Array[_], typeArg: ScalaType): AnyRef = {
import java.lang.reflect.Array.{newInstance => newArray}
a.foldLeft((newArray(typeArg.erasure, a.length), 0)) { (tuple, e) =>
{
java.lang.reflect.Array.set(tuple._1, tuple._2, e)
(tuple._1, tuple._2 + 1)
}
}
._1
}
def extractInner(ti: TypeInfo, jv: JValue, format: Formats): Option[Any] = {
// wrapException(ti, jv, format) {
val result = jv match {
case JNothing => None
case _ => Some(extract(jv, firstTypeArg(ti))(format))
}
result
// }
}
def firstTypeArg(ti: TypeInfo): ScalaType = {
val tpe: ScalaType = ScalaType.apply(ti)
val firstTypeArg = tpe.typeArgs.head
firstTypeArg
}
}
| {
"pile_set_name": "Github"
} |
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2009-2012, Willow Garage, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Willow Garage, Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
* $Id: concave_hull.h 5027 2012-03-12 03:10:45Z rusu $
*
*/
#include <pcl/pcl_config.h>
#ifdef HAVE_QHULL
#ifndef PCL_QHULL_H
#define PCL_QHULL_H
#if defined __GNUC__
# pragma GCC system_header
#endif
extern "C"
{
#ifdef HAVE_QHULL_2011
# include "libqhull/libqhull.h"
# include "libqhull/mem.h"
# include "libqhull/qset.h"
# include "libqhull/geom.h"
# include "libqhull/merge.h"
# include "libqhull/poly.h"
# include "libqhull/io.h"
# include "libqhull/stat.h"
#else
# include "qhull/qhull.h"
# include "qhull/mem.h"
# include "qhull/qset.h"
# include "qhull/geom.h"
# include "qhull/merge.h"
# include "qhull/poly.h"
# include "qhull/io.h"
# include "qhull/stat.h"
#endif
}
#endif // PCL_QHULL_H
#endif
| {
"pile_set_name": "Github"
} |
package com.ryanharter.auto.value.parcel;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.RetentionPolicy.SOURCE;
@Target(METHOD)
@Retention(SOURCE)
@Documented
public @interface ParcelAdapter {
Class value();
}
| {
"pile_set_name": "Github"
} |
var fs = require('fs');
var path = require('path');
var glob = require('glob');
var async = require('async');
var Client = require('./client').Client;
var global_client = new Client();
function cp2remote(client, src, dest, callback) {
client.parse(dest);
var _upload = function(files, callback) {
var rootdir = files[0];
async.eachSeries(files, function(fpath, done) {
fs.stat(fpath, function(err, stats) {
if (err) {
done(err);
return;
}
if (stats.isFile()) {
var fname = path.relative(rootdir, fpath);
client.upload(
fpath, path.join(client.remote.path, fname), done
);
} else {
done();
}
});
}, function(err) {
// never forget to close the session
client.on('close', function closeHandler() {
callback(err);
client.removeListener('close', closeHandler);
});
client.close();
});
};
if (src.indexOf('*') === -1) {
fs.stat(src, function(err, stats) {
if (err) {
callback(err);
return;
}
if (stats.isFile()) {
client.upload(src, client.remote.path, function(err) {
client.on('close', function closeHandler() {
callback(err);
client.removeListener('close', closeHandler);
});
client.close();
});
} else if (stats.isDirectory()) {
glob(src.replace(/\/$/, '') + '/**/**', function(err, files) {
if (err) {
callback(err);
} else {
_upload(files, callback);
}
});
} else {
callback('unsupported');
}
});
} else {
glob(src, function(err, files) {
if (err) {
callback(err);
return;
}
_upload(files, callback);
});
}
}
function cp2local(client, src, dest, callback) {
var remote = client.parse(src);
// only works on single file now
// TODO: glob match
if (/\/$/.test(dest)) {
dest = dest + path.basename(remote.path);
}
client.download(remote.path, dest, function () {
client.close();
callback.apply(this, arguments);
});
}
exports = module.exports = global_client;
exports.Client = Client;
exports.scp = function(src, dest, client, callback) {
if (typeof client === 'function') {
callback = client;
client = new Client();
}
client.on('error', callback);
var parsed = client.parse(src);
if (parsed.host && parsed.path) {
cp2local(client, parsed, dest, callback);
} else {
cp2remote(client, src, dest, callback);
}
};
| {
"pile_set_name": "Github"
} |
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions Copyrighted [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS.
*/
/**
* Contains the model, or data access functionality, consumed by the ViewBean context displaying rest-sts instance state
* to be created, edited, or deleted.
*/
package com.sun.identity.console.sts.model; | {
"pile_set_name": "Github"
} |
/**************************************************************************
*
* Copyright (C) 2011 The Xubuntu Community
* Copyright (C) 2009 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Written by: Mad Nick <dr.madnick@gmail.com>
* Modified by EMH-Mark-I <EMH_Mark_I@protonmail.com>
**************************************************************************/
NUM_SCROLL_LINES=20;
LINE_WIDTH=55;
/*
* Related to the screen */
screen_width = Window.GetWidth();
screen_height = Window.GetHeight();
screen_x = Window.GetX();
screen_y = Window.GetY();
/**/
/*
* Images, check bits per pixel
* and load images accordingly */
background_image = Image("wallpaper.png");
passw_dialog_input_image = Image("passw-dialog.png");
bullet_image = Image("test.png");
bpp = Window.GetBitsPerPixel();
if (bpp == 4) {
logotype_image = Image("logo_16bit.png");
progress_meter_image = Image("progress-meter_16bit.png");
progress_fade_image = Image("progress-fade_16bit.png");
fsck_progress_meter_image = Image("progress-meter_16bit.png");
fsck_progress_fade_image = Image("fsck-fade_16bit.png");
}
else {
logotype_image = Image("logo.png");
progress_meter_image = Image("progress-meter.png");
progress_fade_image = Image("progress-fade.png");
fsck_progress_meter_image = Image("progress-meter.png");
fsck_progress_fade_image = Image("fsck-fade.png");
}
/**/
/*
* Sprites */
ratio = screen_height / screen_width;
background_ratio = background_image.GetHeight() / background_image.GetWidth();
factor = 0;
if (ratio > background_ratio) {
factor = screen_height / background_image.GetHeight();
}
else {
factor = screen_width / background_image.GetWidth();
}
scaled = background_image.Scale(background_image.GetWidth() * factor, background_image.GetHeight() * factor);
background_sprite = Sprite(scaled);
background_sprite.SetX(screen_x + screen_width / 2 - scaled.GetWidth() / 2);
background_sprite.SetY(screen_y + screen_height / 2 - scaled.GetHeight() / 2);
logotype_sprite = Sprite(logotype_image);
fsck_progress_meter_sprite = Sprite(fsck_progress_meter_image);
fsck_progress_fade_sprite = Sprite(fsck_progress_fade_image.Scale(1, fsck_progress_fade_image.GetHeight()));
passw_dialog_input_sprite = Sprite(passw_dialog_input_image);
passw_lbl_sprite = Sprite();
msg_label_sprite = Sprite();
/**/
/*
* Misc */
counter = 0;
fade_pos_x = (screen_width / 2) - (progress_meter_image.GetWidth() / 2);
fade_dir = 0; /* 0 = right, 1 = left */
fsck_running = 0;
fsck_dev_array;
fsck_dev_counter = 0;
fsck_fade_in_counter = 0;
fsck_done_fading = 0;
stars_array;
stars_n = 0;
//full_msg = "";
msgs_line = [NULL,NULL,NULL,NULL,NULL];
/**/
/*
* Debug related */
debug = 0;
debug_sprite = Sprite();
fun debugOutput(str) {
/*
* This will print to the top left corner */
debug_sprite.SetImage(Image.Text(str));
}
/**/
/*
* Setup the graphics properties */
logotype_sprite.SetPosition(screen_x + (screen_width / 2) - (logotype_image.GetWidth() / 2), screen_y + (screen_height / 2) - (logotype_image.GetHeight() / 2));
fsck_progress_meter_sprite.SetPosition(screen_x + (screen_width / 2) - (progress_meter_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 25);
fsck_progress_fade_sprite.SetPosition(screen_x + (screen_width / 2) - (progress_meter_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 25);
fsck_progress_meter_sprite.SetOpacity(0);
fsck_progress_fade_sprite.SetOpacity(0);
passw_dialog_input_sprite.SetPosition(screen_x + (screen_width / 2) - (passw_dialog_input_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 70);
passw_dialog_input_sprite.SetOpacity(0);
passw_lbl_sprite.SetOpacity(0);
spin = 0;
/*
* this function only goes up to 100
* because thats all thats needed for
* the progress meter bar */
fun atoi(str) {
int = -1;
for (i = 0; i <= 100; i++) {
if (i + "" == str) {
int = i;
break;
}
}
return int;
}
/*
* This handler will/can be invoked
* 50 times per second.
*
* According to the previous author of the
* splash script, without this callback
* the screen is not updated correctly */
spinner_sprite;
spinner;
fun refreshHandler() {
if (spin < 3.14 * 2) {
spin = spin + 0.1;
}
else {
spin = 0;
}
/* if fsck is running or the password is prompted, hide the spinner */
if (fsck_running == 1 || passw_dialog_input_sprite.GetOpacity() == 1) {
spinner_sprite.SetOpacity(0);
} else {
spinner = Image("spinner.png");
spinner = spinner.Rotate(spin);
spinner_sprite = Sprite(spinner);
spinner_sprite.SetPosition(screen_x + (screen_width / 2) - (spinner.GetWidth() / 2), screen_y + (screen_height / 2) - (spinner.GetHeight() / 2) + 80);
}
if (fade_dir == 0) {
counter++;
if (counter >= 200) {
fade_dir = 1;
}
}
else {
counter--;
if (counter <= 0) {
fade_dir = 0;
}
}
if ((fsck_running == 1) && (fsck_done_fading == 0)) {
fsck_progress_meter_sprite.SetOpacity(fsck_fade_in_counter);
fsck_progress_fade_sprite.SetOpacity(fsck_fade_in_counter);
if (fsck_fade_in_counter < 1) {
fsck_fade_in_counter+= 0.025;
}
else {
fsck_done_fading = 1;
}
}
}
Plymouth.SetRefreshFunction (refreshHandler);
/**/
/*
* This function will display the password related information
* when being prompt with entering a password */
fun showPasswordHandler(prompt, stars) {
if (passw_dialog_input_sprite.GetOpacity() == 0 && passw_lbl_sprite.GetOpacity() == 0) {
passw_dialog_input_sprite.SetOpacity(1);
passw_lbl_sprite.SetOpacity(1);
}
my_image = Image.Text(text, 0, 0, 0);
message_sprite.SetImage(my_image);
tmp_prompt_image = Image.Text(prompt, 0, 0, 0);
passw_lbl_sprite.SetImage(tmp_prompt_image);
passw_lbl_sprite.SetPosition(screen_x + (screen_width / 2) - (tmp_prompt_image.GetWidth() / 2), screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 50);
for(i = 0; i < stars_n; i++) {
stars_array[i] = NULL;
}
stars_n = 0;
for(i = 0; (i < stars) && (i < 15); i++) {
stars_array[i] = Sprite(bullet_image);
stars_array[i].SetPosition(screen_x + (((screen_width / 2) - (passw_dialog_input_image.GetWidth() / 2)) + (18 * i)) + 2, screen_y + (screen_height / 2) + (logotype_image.GetHeight() / 2) + 75);
stars_n++;
}
}
Plymouth.SetDisplayPasswordFunction(showPasswordHandler);
/**/
fun displayNormalHandler() {
/*
* Hide the password dialog and the bullets */
if (passw_dialog_input_sprite.GetOpacity() == 1) {
passw_dialog_input_sprite.SetOpacity(0);
}
if (passw_lbl_sprite.GetOpacity() == 1) {
passw_lbl_sprite.SetOpacity(0);
}
for(i = 0; i < stars_n; i++) {
stars_array[i] = NULL;
}
}
Plymouth.SetDisplayNormalFunction(displayNormalHandler);
fun strlen(string) {
i = 0;
while (String(string).CharAt(i)) {
i++;
}
return i;
}
/*
* This function will display the most current message */
fun messageHandler(msg) {
if ((msg == "") || !msg) {
return 0;
}
if (msg.SubString(0, 5) == "keys:") {
msg = msg.SubString(5, strlen(msg));
}
# Get the message without the "fsckd-cancel-msg" prefix as we don't support i18n
if (msg.SubString(0, 17) == "fsckd-cancel-msg:")
msg = msg.SubString(17, strlen(msg));
//full_msg += msg + " ";
for(i = 4; i > 0; i--) {
msgs_line[i] = msgs_line[i - 1];
}
my_image = Image.Text(text, 0, 0, 0);
message_sprite.SetImage(my_image);
msgs_line[0] = Sprite(Image.Text(msg, 0, 0, 0));
dist = 1;
for(i = 0; i < 5; i++) {
if (msgs_line[i] != NULL) {
my_image = Image.Text(text, 0, 0, 0);
message_sprite.SetImage(my_image);
msgs_line[i].SetPosition(screen_x + (screen_width / 2) - (msgs_line[i].GetImage().GetWidth() / 2), screen_y + (screen_height - msgs_line[i].GetImage().GetHeight()) - 20*dist);
dist++;
}
}
}
Plymouth.SetMessageFunction(messageHandler);
/**/
// Initialising text images and their positions
// 20 is the height (including line spacing) of each line
for (i=0; i < NUM_SCROLL_LINES; i++) {
lines[i]= Image.Text("", 0, 0, 0);
message_sprite[i] = Sprite();
message_sprite[i].SetPosition(screen_width * 0.05, (screen_height * 0.6) + (i * 20), 10000);
}
// From ubuntu-logo
fun StringLength(string) {
index = 0;
str = String(string);
while(str.CharAt(index)) index++;
return index;
}
fun scroll_message_callback(text) {
// Truncate the message if too long
if (StringLength(text) > LINE_WIDTH) {
text = text.SubString(0, LINE_WIDTH - 3);
text += "...";
}
// Shift message one up
for (i = 0; i < NUM_SCROLL_LINES - 1; i++) {
lines[i] = lines[i+1];
}
// Create the image for the latest message
lines[i] = Image.Text(text, 0, 0, 0);
// Re-positioning the text images
for (i = 0; i < NUM_SCROLL_LINES; i++) {
message_sprite[i].SetImage(lines[i]);
}
}
Plymouth.SetUpdateStatusFunction(scroll_message_callback);
/**/
| {
"pile_set_name": "Github"
} |
// node-uuid/uuid.js
//
// Copyright (c) 2010 Robert Kieffer
// Dual licensed under the MIT and GPL licenses.
// Documentation and details at https://github.com/broofa/node-uuid
(function() {
var _global = this;
// Unique ID creation requires a high quality random # generator, but
// Math.random() does not guarantee "cryptographic quality". So we feature
// detect for more robust APIs, normalizing each method to return 128-bits
// (16 bytes) of random data.
var mathRNG, nodeRNG, whatwgRNG;
// Math.random()-based RNG. All platforms, very fast, unknown quality
var _rndBytes = new Array(16);
mathRNG = function() {
var r, b = _rndBytes, i = 0;
for (var i = 0, r; i < 16; i++) {
if ((i & 0x03) == 0) r = Math.random() * 0x100000000;
b[i] = r >>> ((i & 0x03) << 3) & 0xff;
}
return b;
}
// WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto
// WebKit only (currently), moderately fast, high quality
if (_global.crypto && crypto.getRandomValues) {
var _rnds = new Uint32Array(4);
whatwgRNG = function() {
crypto.getRandomValues(_rnds);
for (var c = 0 ; c < 16; c++) {
_rndBytes[c] = _rnds[c >> 2] >>> ((c & 0x03) * 8) & 0xff;
}
return _rndBytes;
}
}
// Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html
// Node.js only, moderately fast, high quality
try {
var _rb = require('crypto').randomBytes;
nodeRNG = _rb && function() {
return _rb(16);
};
} catch (e) {}
// Select RNG with best quality
var _rng = nodeRNG || whatwgRNG || mathRNG;
// Buffer class to use
var BufferClass = typeof(Buffer) == 'function' ? Buffer : Array;
// Maps for number <-> hex string conversion
var _byteToHex = [];
var _hexToByte = {};
for (var i = 0; i < 256; i++) {
_byteToHex[i] = (i + 0x100).toString(16).substr(1);
_hexToByte[_byteToHex[i]] = i;
}
// **`parse()` - Parse a UUID into it's component bytes**
function parse(s, buf, offset) {
var i = (buf && offset) || 0, ii = 0;
buf = buf || [];
s.toLowerCase().replace(/[0-9a-f]{2}/g, function(byte) {
if (ii < 16) { // Don't overflow!
buf[i + ii++] = _hexToByte[byte];
}
});
// Zero out remaining bytes if string was short
while (ii < 16) {
buf[i + ii++] = 0;
}
return buf;
}
// **`unparse()` - Convert UUID byte array (ala parse()) into a string**
function unparse(buf, offset) {
var i = offset || 0, bth = _byteToHex;
return bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] + '-' +
bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]] +
bth[buf[i++]] + bth[buf[i++]];
}
// **`v1()` - Generate time-based UUID**
//
// Inspired by https://github.com/LiosK/UUID.js
// and http://docs.python.org/library/uuid.html
// random #'s we need to init node and clockseq
var _seedBytes = _rng();
// Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
var _nodeId = [
_seedBytes[0] | 0x01,
_seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5]
];
// Per 4.2.2, randomize (14 bit) clockseq
var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff;
// Previous uuid creation time
var _lastMSecs = 0, _lastNSecs = 0;
// See https://github.com/broofa/node-uuid for API details
function v1(options, buf, offset) {
var i = buf && offset || 0;
var b = buf || [];
options = options || {};
var clockseq = options.clockseq != null ? options.clockseq : _clockseq;
// UUID timestamps are 100 nano-second units since the Gregorian epoch,
// (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
// time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
// (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
var msecs = options.msecs != null ? options.msecs : new Date().getTime();
// Per 4.2.1.2, use count of uuid's generated during the current clock
// cycle to simulate higher resolution clock
var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1;
// Time since last uuid creation (in msecs)
var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
// Per 4.2.1.2, Bump clockseq on clock regression
if (dt < 0 && options.clockseq == null) {
clockseq = clockseq + 1 & 0x3fff;
}
// Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
// time interval
if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) {
nsecs = 0;
}
// Per 4.2.1.2 Throw error if too many uuids are requested
if (nsecs >= 10000) {
throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
}
_lastMSecs = msecs;
_lastNSecs = nsecs;
_clockseq = clockseq;
// Per 4.1.4 - Convert from unix epoch to Gregorian epoch
msecs += 12219292800000;
// `time_low`
var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
b[i++] = tl >>> 24 & 0xff;
b[i++] = tl >>> 16 & 0xff;
b[i++] = tl >>> 8 & 0xff;
b[i++] = tl & 0xff;
// `time_mid`
var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
b[i++] = tmh >>> 8 & 0xff;
b[i++] = tmh & 0xff;
// `time_high_and_version`
b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
b[i++] = tmh >>> 16 & 0xff;
// `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
b[i++] = clockseq >>> 8 | 0x80;
// `clock_seq_low`
b[i++] = clockseq & 0xff;
// `node`
var node = options.node || _nodeId;
for (var n = 0; n < 6; n++) {
b[i + n] = node[n];
}
return buf ? buf : unparse(b);
}
// **`v4()` - Generate random UUID**
// See https://github.com/broofa/node-uuid for API details
function v4(options, buf, offset) {
// Deprecated - 'format' argument, as supported in v1.2
var i = buf && offset || 0;
if (typeof(options) == 'string') {
buf = options == 'binary' ? new BufferClass(16) : null;
options = null;
}
options = options || {};
var rnds = options.random || (options.rng || _rng)();
// Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = (rnds[6] & 0x0f) | 0x40;
rnds[8] = (rnds[8] & 0x3f) | 0x80;
// Copy bytes to buffer, if provided
if (buf) {
for (var ii = 0; ii < 16; ii++) {
buf[i + ii] = rnds[ii];
}
}
return buf || unparse(rnds);
}
// Export public API
var uuid = v4;
uuid.v1 = v1;
uuid.v4 = v4;
uuid.parse = parse;
uuid.unparse = unparse;
uuid.BufferClass = BufferClass;
// Export RNG options
uuid.mathRNG = mathRNG;
uuid.nodeRNG = nodeRNG;
uuid.whatwgRNG = whatwgRNG;
if (typeof(module) != 'undefined') {
// Play nice with node.js
module.exports = uuid;
} else {
// Play nice with browsers
var _previousRoot = _global.uuid;
// **`noConflict()` - (browser only) to reset global 'uuid' var**
uuid.noConflict = function() {
_global.uuid = _previousRoot;
return uuid;
}
_global.uuid = uuid;
}
}());
| {
"pile_set_name": "Github"
} |
{
"users": [
{
"id": 5,
"username": "beanow.sc-test",
"name": "Beanow",
"avatar_template": "https://avatars.discourse.org/v4/letter/b/7ea924/{size}.png"
},
{
"id": 2,
"username": "d11",
"name": "D",
"avatar_template": "https://avatars.discourse.org/v4/letter/d/47e85d/{size}.png"
},
{
"id": 3,
"username": "dl-proto",
"name": "dandelion protocol acct",
"avatar_template": "https://avatars.discourse.org/v4/letter/d/8797f3/{size}.png"
}
],
"primary_groups": [],
"topic_list": {
"can_create_topic": false,
"draft": null,
"draft_key": "new_topic",
"draft_sequence": null,
"per_page": 30,
"topics": [
{
"id": 28,
"title": "Filler Topic #2",
"fancy_title": "Filler Topic #2",
"slug": "filler-topic-2",
"posts_count": 1,
"reply_count": 0,
"highest_post_number": 1,
"image_url": null,
"created_at": "2019-11-15T17:50:33.177Z",
"last_posted_at": "2019-11-15T17:50:33.231Z",
"bumped": true,
"bumped_at": "2019-11-15T17:50:33.231Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 515,
"like_count": 0,
"has_summary": false,
"last_poster_username": "beanow.sc-test",
"category_id": 5,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 5,
"primary_group_id": null
}
]
},
{
"id": 27,
"title": "Filler Topic #1",
"fancy_title": "Filler Topic #1",
"slug": "filler-topic-1",
"posts_count": 1,
"reply_count": 0,
"highest_post_number": 1,
"image_url": null,
"created_at": "2019-11-15T17:49:19.140Z",
"last_posted_at": "2019-11-15T17:49:19.198Z",
"bumped": true,
"bumped_at": "2019-11-15T17:49:19.198Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 518,
"like_count": 0,
"has_summary": false,
"last_poster_username": "beanow.sc-test",
"category_id": 5,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 5,
"primary_group_id": null
}
]
},
{
"id": 26,
"title": "Big Filler Topic 1",
"fancy_title": "Big Filler Topic 1",
"slug": "big-filler-topic-1",
"posts_count": 21,
"reply_count": 0,
"highest_post_number": 21,
"image_url": null,
"created_at": "2019-11-15T17:42:13.506Z",
"last_posted_at": "2019-11-15T17:44:32.244Z",
"bumped": true,
"bumped_at": "2019-11-15T17:44:32.244Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 551,
"like_count": 0,
"has_summary": false,
"last_poster_username": "beanow.sc-test",
"category_id": 6,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 5,
"primary_group_id": null
}
]
},
{
"id": 21,
"title": "A Post With References",
"fancy_title": "A Post With References",
"slug": "a-post-with-references",
"posts_count": 1,
"reply_count": 0,
"highest_post_number": 1,
"image_url": null,
"created_at": "2019-10-23T18:26:31.140Z",
"last_posted_at": "2019-10-23T18:26:31.281Z",
"bumped": true,
"bumped_at": "2019-10-23T18:26:31.281Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 535,
"like_count": 0,
"has_summary": false,
"last_poster_username": "d11",
"category_id": 1,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 2,
"primary_group_id": null
}
]
},
{
"id": 20,
"title": "123 a post with numbers in slug",
"fancy_title": "123 a post with numbers in slug",
"slug": "123-a-post-with-numbers-in-slug",
"posts_count": 1,
"reply_count": 0,
"highest_post_number": 1,
"image_url": null,
"created_at": "2019-10-07T03:49:19.868Z",
"last_posted_at": "2019-10-07T03:49:19.922Z",
"bumped": true,
"bumped_at": "2019-10-07T03:49:19.922Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 529,
"like_count": 0,
"has_summary": false,
"last_poster_username": "d11",
"category_id": 1,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 2,
"primary_group_id": null
}
]
},
{
"id": 19,
"title": "This post will be a wiki",
"fancy_title": "This post will be a wiki",
"slug": "this-post-will-be-a-wiki",
"posts_count": 2,
"reply_count": 0,
"highest_post_number": 2,
"image_url": null,
"created_at": "2019-10-02T20:51:31.690Z",
"last_posted_at": "2019-10-02T20:57:16.311Z",
"bumped": true,
"bumped_at": "2019-10-02T20:57:16.311Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 524,
"like_count": 0,
"has_summary": false,
"last_poster_username": "d11",
"category_id": 1,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 2,
"primary_group_id": null
}
]
},
{
"id": 18,
"title": "Test Poll Please Ignore",
"fancy_title": "Test Poll Please Ignore",
"slug": "test-poll-please-ignore",
"posts_count": 1,
"reply_count": 0,
"highest_post_number": 1,
"image_url": null,
"created_at": "2019-10-02T20:50:10.568Z",
"last_posted_at": "2019-10-02T20:50:10.625Z",
"bumped": true,
"bumped_at": "2019-10-02T20:50:10.625Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 522,
"like_count": 0,
"has_summary": false,
"last_poster_username": "d11",
"category_id": 1,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest single",
"description": "Original Poster, Most Recent Poster",
"user_id": 2,
"primary_group_id": null
}
]
},
{
"id": 11,
"title": "My First Test Post",
"fancy_title": "My First Test Post",
"slug": "my-first-test-post",
"posts_count": 3,
"reply_count": 0,
"highest_post_number": 3,
"image_url": null,
"created_at": "2019-08-02T11:12:29.408Z",
"last_posted_at": "2019-08-04T20:50:39.667Z",
"bumped": true,
"bumped_at": "2019-08-04T20:50:39.667Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 574,
"like_count": 1,
"has_summary": false,
"last_poster_username": "d11",
"category_id": 1,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest",
"description": "Original Poster, Most Recent Poster",
"user_id": 2,
"primary_group_id": null
},
{
"extras": null,
"description": "Frequent Poster",
"user_id": 3,
"primary_group_id": null
}
]
},
{
"id": 13,
"title": "A Thread With Links",
"fancy_title": "A Thread With Links",
"slug": "a-thread-with-links",
"posts_count": 2,
"reply_count": 0,
"highest_post_number": 2,
"image_url": null,
"created_at": "2019-08-02T11:15:53.843Z",
"last_posted_at": "2019-08-02T11:16:31.313Z",
"bumped": true,
"bumped_at": "2019-08-02T11:17:12.755Z",
"archetype": "regular",
"unseen": false,
"pinned": false,
"unpinned": null,
"visible": true,
"closed": false,
"archived": false,
"bookmarked": null,
"liked": null,
"views": 533,
"like_count": 0,
"has_summary": false,
"last_poster_username": "dl-proto",
"category_id": 1,
"pinned_globally": false,
"featured_link": null,
"has_accepted_answer": false,
"posters": [
{
"extras": "latest",
"description": "Original Poster, Most Recent Poster",
"user_id": 3,
"primary_group_id": null
},
{
"extras": null,
"description": "Frequent Poster",
"user_id": 2,
"primary_group_id": null
}
]
}
]
}
}
| {
"pile_set_name": "Github"
} |
#!/usr/bin/env python
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from stream import __version__, __maintainer__, __email__, __license__
import sys
tests_require = ["pytest==3.2.5", "unittest2", "pytest-cov", "python-dateutil"]
ci_require = ["flake8", "codecov"]
if sys.version_info >= (3, 6, 0):
ci_require.append("black")
long_description = open("README.md", "r").read()
install_requires = [
"pycryptodomex>=3.8.1,<4",
"requests>=2.3.0,<3",
"pyjwt>=1.3.0,<1.8.0",
"pytz>=2019.3",
]
class PyTest(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(["-v", "--cov=./"])
sys.exit(errno)
setup(
name="stream-python",
version=__version__,
author=__maintainer__,
author_email=__email__,
url="http://github.com/GetStream/stream-python",
description="Client for getstream.io. Build scalable newsfeeds & activity streams in a few hours instead of weeks.",
long_description=long_description,
long_description_content_type="text/markdown",
license=__license__,
packages=find_packages(),
zip_safe=False,
install_requires=install_requires,
extras_require={"test": tests_require, "ci": ci_require},
cmdclass={"test": PyTest},
tests_require=tests_require,
include_package_data=True,
classifiers=[
"Intended Audience :: Developers",
"Intended Audience :: System Administrators",
"Operating System :: OS Independent",
"Topic :: Software Development",
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: BSD License",
"Natural Language :: English",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Topic :: Software Development :: Libraries :: Python Modules",
],
)
| {
"pile_set_name": "Github"
} |
import compiler
import dis
import types
def extract_code_objects(co):
l = [co]
for const in co.co_consts:
if type(const) == types.CodeType:
l.append(const)
return l
def compare(a, b):
if not (a.co_name == "?" or a.co_name.startswith('<lambda')):
assert a.co_name == b.co_name, (a, b)
if a.co_stacksize != b.co_stacksize:
print "stack mismatch %s: %d vs. %d" % (a.co_name,
a.co_stacksize,
b.co_stacksize)
if a.co_stacksize > b.co_stacksize:
print "good code"
dis.dis(a)
print "bad code"
dis.dis(b)
assert 0
def main(files):
for file in files:
print file
buf = open(file).read()
try:
co1 = compile(buf, file, "exec")
except SyntaxError:
print "skipped"
continue
co2 = compiler.compile(buf, file, "exec")
co1l = extract_code_objects(co1)
co2l = extract_code_objects(co2)
for a, b in zip(co1l, co2l):
compare(a, b)
if __name__ == "__main__":
import sys
main(sys.argv[1:])
| {
"pile_set_name": "Github"
} |
/// Copyright (c) 2012 Ecma International. All rights reserved.
/// Ecma International makes this code available under the terms and conditions set
/// forth on http://hg.ecmascript.org/tests/test262/raw-file/tip/LICENSE (the
/// "Use Terms"). Any redistribution of this code must retain the above
/// copyright and this notice and otherwise comply with the Use Terms.
/**
* @path ch12/12.2/12.2.1/12.2.1-28-s.js
* @description arguments as local var identifier assigned to throws SyntaxError in strict mode
* @onlyStrict
*/
function testcase() {
'use strict';
try {
eval('function foo() { var a, arguments = 42;}');
return false;
}
catch (e) {
return (e instanceof SyntaxError);
}
}
runTestCase(testcase); | {
"pile_set_name": "Github"
} |
- name: download VBox (debian)
get_url:
validate_certs: "{{ validate_certs }}"
url: http://download.virtualbox.org/virtualbox/{{ vbox_major_version }}/virtualbox-{{ vbox_version_ubuntu_dist_version[ansible_distribution_release] }}_amd64.deb
dest: /tmp/virtualbox-{{ vbox_major_version }}.deb
force: no
- name: check for installed vbox (ubuntu)
shell: VBoxManage --version
register: vbox_installed_version
ignore_errors: yes
- name: stop vbox service if it is running (ubuntu)
service: name=vbox state=stopped
when: not (vbox_installed_version.stdout | match('.*{{vbox_package_version}}.*'))
ignore_errors: yes
- name: uninstall VBox (ubuntu)
apt: name='virtualbox-*' state=absent
when: not (vbox_installed_version.stdout | match('.*{{vbox_package_version}}.*'))
- name: install VBox (debian)
apt: deb=/tmp/virtualbox-{{ vbox_major_version }}.deb state=present
- name: install VBox dkms (debian)
apt: name=dkms state=latest
- name: copy systemd units for virtualbox-server
template: src=vbox.service.j2 dest=/etc/systemd/system/vbox.service
- name: enable vbox to be started on boot-up and start it as well
service: name=vbox state=started enabled=yes
- name: download vagrant (debian)
get_url:
validate_certs: "{{ validate_certs }}"
url: https://releases.hashicorp.com/vagrant/{{ vagrant_version }}/vagrant_{{ vagrant_version }}_x86_64.deb
dest: /tmp/vagrant_{{ vagrant_version }}.deb
force: no
- name: install vagrant (debian)
apt: deb=/tmp/vagrant_{{ vagrant_version }}.deb state=present
| {
"pile_set_name": "Github"
} |
package cn.nukkit.command.defaults;
import cn.nukkit.Nukkit;
import cn.nukkit.Server;
import cn.nukkit.command.CommandSender;
import cn.nukkit.level.Level;
import cn.nukkit.math.NukkitMath;
import cn.nukkit.utils.TextFormat;
import java.util.Objects;
/**
* Created on 2015/11/11 by xtypr.
* Package cn.nukkit.command.defaults in project Nukkit .
*/
public class StatusCommand extends VanillaCommand {
public StatusCommand(String name) {
super(name, "%nukkit.command.status.description", "%nukkit.command.status.usage");
this.setPermission("nukkit.command.status");
this.commandParameters.clear();
}
@Override
public boolean execute(CommandSender sender, String commandLabel, String[] args) {
if (!this.testPermission(sender)) {
return true;
}
Server server = sender.getServer();
sender.sendMessage(TextFormat.GREEN + "---- " + TextFormat.WHITE + "Server status" + TextFormat.GREEN + " ----");
long time = (System.currentTimeMillis() - Nukkit.START_TIME) / 1000;
int seconds = NukkitMath.floorDouble(time % 60);
int minutes = NukkitMath.floorDouble((time % 3600) / 60);
int hours = NukkitMath.floorDouble(time % (3600 * 24) / 3600);
int days = NukkitMath.floorDouble(time / (3600 * 24));
String upTimeString = TextFormat.RED + "" + days + TextFormat.GOLD + " days " +
TextFormat.RED + hours + TextFormat.GOLD + " hours " +
TextFormat.RED + minutes + TextFormat.GOLD + " minutes " +
TextFormat.RED + seconds + TextFormat.GOLD + " seconds";
sender.sendMessage(TextFormat.GOLD + "Uptime: " + upTimeString);
TextFormat tpsColor = TextFormat.GREEN;
float tps = server.getTicksPerSecond();
if (tps < 17) {
tpsColor = TextFormat.GOLD;
} else if (tps < 12) {
tpsColor = TextFormat.RED;
}
sender.sendMessage(TextFormat.GOLD + "Current TPS: " + tpsColor + NukkitMath.round(tps, 2));
sender.sendMessage(TextFormat.GOLD + "Load: " + tpsColor + server.getTickUsage() + "%");
sender.sendMessage(TextFormat.GOLD + "Network upload: " + TextFormat.GREEN + NukkitMath.round((server.getNetwork().getUpload() / 1024 * 1000), 2) + " kB/s");
sender.sendMessage(TextFormat.GOLD + "Network download: " + TextFormat.GREEN + NukkitMath.round((server.getNetwork().getDownload() / 1024 * 1000), 2) + " kB/s");
sender.sendMessage(TextFormat.GOLD + "Thread count: " + TextFormat.GREEN + Thread.getAllStackTraces().size());
Runtime runtime = Runtime.getRuntime();
double totalMB = NukkitMath.round(((double) runtime.totalMemory()) / 1024 / 1024, 2);
double usedMB = NukkitMath.round((double) (runtime.totalMemory() - runtime.freeMemory()) / 1024 / 1024, 2);
double maxMB = NukkitMath.round(((double) runtime.maxMemory()) / 1024 / 1024, 2);
double usage = usedMB / maxMB * 100;
TextFormat usageColor = TextFormat.GREEN;
if (usage > 85) {
usageColor = TextFormat.GOLD;
}
sender.sendMessage(TextFormat.GOLD + "Used memory: " + usageColor + usedMB + " MB. (" + NukkitMath.round(usage, 2) + "%)");
sender.sendMessage(TextFormat.GOLD + "Total memory: " + TextFormat.RED + totalMB + " MB.");
sender.sendMessage(TextFormat.GOLD + "Maximum VM memory: " + TextFormat.RED + maxMB + " MB.");
sender.sendMessage(TextFormat.GOLD + "Available processors: " + TextFormat.GREEN + runtime.availableProcessors());
TextFormat playerColor = TextFormat.GREEN;
if (((float) server.getOnlinePlayers().size() / (float) server.getMaxPlayers()) > 0.85) {
playerColor = TextFormat.GOLD;
}
sender.sendMessage(TextFormat.GOLD + "Players: " + playerColor + server.getOnlinePlayers().size() + TextFormat.GREEN + " online, " +
TextFormat.RED + server.getMaxPlayers() + TextFormat.GREEN + " max. ");
for (Level level : server.getLevels().values()) {
sender.sendMessage(
TextFormat.GOLD + "World \"" + level.getFolderName() + "\"" + (!Objects.equals(level.getFolderName(), level.getName()) ? " (" + level.getName() + ")" : "") + ": " +
TextFormat.RED + level.getChunks().size() + TextFormat.GREEN + " chunks, " +
TextFormat.RED + level.getEntities().length + TextFormat.GREEN + " entities, " +
TextFormat.RED + level.getBlockEntities().size() + TextFormat.GREEN + " blockEntities." +
" Time " + ((level.getTickRate() > 1 || level.getTickRateTime() > 40) ? TextFormat.RED : TextFormat.YELLOW) + NukkitMath.round(level.getTickRateTime(), 2) + "ms" +
(level.getTickRate() > 1 ? " (tick rate " + level.getTickRate() + ")" : "")
);
}
return true;
}
}
| {
"pile_set_name": "Github"
} |
describe('SessionBuilder', function() {
this.timeout(5000);
var ALICE_ADDRESS = new SignalProtocolAddress("+14151111111", 1);
var BOB_ADDRESS = new SignalProtocolAddress("+14152222222", 1);
describe("basic prekey v3", function() {
var aliceStore = new SignalProtocolStore();
var bobStore = new SignalProtocolStore();
var bobPreKeyId = 1337;
var bobSignedKeyId = 1;
var Curve = libsignal.Curve;
before(function(done) {
Promise.all([
generateIdentity(aliceStore),
generateIdentity(bobStore),
]).then(function() {
return generatePreKeyBundle(bobStore, bobPreKeyId, bobSignedKeyId);
}).then(function(preKeyBundle) {
var builder = new libsignal.SessionBuilder(aliceStore, BOB_ADDRESS);
return builder.processPreKey(preKeyBundle).then(function() {
done();
});
}).catch(done);
});
var originalMessage = util.toArrayBuffer("L'homme est condamné à être libre");
var aliceSessionCipher = new libsignal.SessionCipher(aliceStore, BOB_ADDRESS);
var bobSessionCipher = new libsignal.SessionCipher(bobStore, ALICE_ADDRESS);
it('creates a session', function(done) {
return aliceStore.loadSession(BOB_ADDRESS.toString()).then(function(record) {
assert.isDefined(record);
var sessionRecord = Internal.SessionRecord.deserialize(record);
assert.isTrue(sessionRecord.haveOpenSession());
assert.isDefined(sessionRecord.getOpenSession());
}).then(done, done);
});
it('the session can encrypt', function(done) {
aliceSessionCipher.encrypt(originalMessage).then(function(ciphertext) {
assert.strictEqual(ciphertext.type, 3); // PREKEY_BUNDLE
return bobSessionCipher.decryptPreKeyWhisperMessage(ciphertext.body, 'binary');
}).then(function(plaintext) {
assertEqualArrayBuffers(plaintext, originalMessage);
}).then(done, done);
});
it('the session can decrypt', function(done) {
bobSessionCipher.encrypt(originalMessage).then(function(ciphertext) {
return aliceSessionCipher.decryptWhisperMessage(ciphertext.body, 'binary');
}).then(function(plaintext) {
assertEqualArrayBuffers(plaintext, originalMessage);
}).then(done, done);
});
it('accepts a new preKey with the same identity', function(done) {
generatePreKeyBundle(bobStore, bobPreKeyId + 1, bobSignedKeyId + 1).then(function(preKeyBundle) {
var builder = new libsignal.SessionBuilder(aliceStore, BOB_ADDRESS);
return builder.processPreKey(preKeyBundle).then(function() {
return aliceStore.loadSession(BOB_ADDRESS.toString()).then(function(record) {
assert.isDefined(record);
var sessionRecord = Internal.SessionRecord.deserialize(record);
assert.isTrue(sessionRecord.haveOpenSession());
assert.isDefined(sessionRecord.getOpenSession());
done();
});
});
}).catch(done);
});
it('rejects untrusted identity keys', function(done) {
KeyHelper.generateIdentityKeyPair().then(function(newIdentity) {
var builder = new libsignal.SessionBuilder(aliceStore, BOB_ADDRESS);
return builder.processPreKey({
identityKey: newIdentity.pubKey,
registrationId : 12356
}).then(function(e) {
assert.fail('should not be trusted');
}).catch(function(e) {
assert.strictEqual(e.message, 'Identity key changed');
done();
}).catch(done);
});
});
});
describe("basic v3 NO PREKEY", function() {
var aliceStore = new SignalProtocolStore();
var bobStore = new SignalProtocolStore();
var bobPreKeyId = 1337;
var bobSignedKeyId = 1;
var Curve = libsignal.Curve;
before(function(done) {
Promise.all([
generateIdentity(aliceStore),
generateIdentity(bobStore),
]).then(function() {
return generatePreKeyBundle(bobStore, bobPreKeyId, bobSignedKeyId);
}).then(function(preKeyBundle) {
delete preKeyBundle.preKey;
var builder = new libsignal.SessionBuilder(aliceStore, BOB_ADDRESS);
return builder.processPreKey(preKeyBundle).then(function() {
done();
});
}).catch(done);
});
var originalMessage = util.toArrayBuffer("L'homme est condamné à être libre");
var aliceSessionCipher = new libsignal.SessionCipher(aliceStore, BOB_ADDRESS);
var bobSessionCipher = new libsignal.SessionCipher(bobStore, ALICE_ADDRESS);
it('creates a session', function(done) {
return aliceStore.loadSession(BOB_ADDRESS.toString()).then(function(record) {
assert.isDefined(record);
var sessionRecord = Internal.SessionRecord.deserialize(record);
assert.isTrue(sessionRecord.haveOpenSession());
assert.isDefined(sessionRecord.getOpenSession());
}).then(done, done);
});
it('the session can encrypt', function(done) {
aliceSessionCipher.encrypt(originalMessage).then(function(ciphertext) {
assert.strictEqual(ciphertext.type, 3); // PREKEY_BUNDLE
return bobSessionCipher.decryptPreKeyWhisperMessage(ciphertext.body, 'binary');
}).then(function(plaintext) {
assertEqualArrayBuffers(plaintext, originalMessage);
}).then(done, done);
});
it('the session can decrypt', function(done) {
bobSessionCipher.encrypt(originalMessage).then(function(ciphertext) {
return aliceSessionCipher.decryptWhisperMessage(ciphertext.body, 'binary');
}).then(function(plaintext) {
assertEqualArrayBuffers(plaintext, originalMessage);
}).then(done, done);
});
it('accepts a new preKey with the same identity', function(done) {
generatePreKeyBundle(bobStore, bobPreKeyId + 1, bobSignedKeyId + 1).then(function(preKeyBundle) {
delete preKeyBundle.preKey;
var builder = new libsignal.SessionBuilder(aliceStore, BOB_ADDRESS);
return builder.processPreKey(preKeyBundle).then(function() {
return aliceStore.loadSession(BOB_ADDRESS.toString()).then(function(record) {
assert.isDefined(record);
var sessionRecord = Internal.SessionRecord.deserialize(record);
assert.isTrue(sessionRecord.haveOpenSession());
assert.isDefined(sessionRecord.getOpenSession());
done();
});
});
}).catch(done);
});
it('rejects untrusted identity keys', function(done) {
KeyHelper.generateIdentityKeyPair().then(function(newIdentity) {
var builder = new libsignal.SessionBuilder(aliceStore, BOB_ADDRESS);
return builder.processPreKey({
identityKey: newIdentity.pubKey,
registrationId : 12356
}).then(function(e) {
assert.fail('should not be trusted');
}).catch(function(e) {
assert.strictEqual(e.message, 'Identity key changed');
done();
}).catch(done);
});
});
});
});
| {
"pile_set_name": "Github"
} |
package gov.nysenate.openleg.service.slack;
import com.google.gson.JsonObject;
import gov.nysenate.openleg.model.slack.SlackMessage;
import org.apache.commons.io.IOUtils;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.Charset;
/**
* Copied from https://github.com/gpedro/slack-webhook with some customizations
* (This done before that api was released via maven)
*
* Makes http calls to Slack's webhook api when given a {@link SlackMessage}
*/
public class SlackApi {
private static final String channelNotFoundMessage = "channel_not_found";
private String service;
public SlackApi(String service) {
if(service == null) {
throw new IllegalArgumentException("Missing WebHook URL Configuration @ SlackApi");
} else if (!service.startsWith("https://hooks.slack.com/services/")) {
throw new IllegalArgumentException("Invalid Service URL. WebHook URL Format: https://hooks.slack.com/services/{id_1}/{id_2}/{token}");
}
this.service = service;
}
public void call(SlackMessage message) {
if(message != null) {
this.send(message.prepare());
}
}
private String send(JsonObject message) {
URL url;
HttpURLConnection connection = null;
try {
//Create connection
url = new URL(this.service);
connection = (HttpURLConnection)url.openConnection();
connection.setRequestMethod("POST");
connection.setConnectTimeout(5000);
connection.setUseCaches (false);
connection.setDoInput(true);
connection.setDoOutput(true);
String payload = "payload="+URLEncoder.encode(message.toString(), "UTF-8");
//Send request
DataOutputStream wr = new DataOutputStream (
connection.getOutputStream ());
wr.writeBytes(payload);
wr.flush ();
wr.close ();
//Get Response
int responseCode = connection.getResponseCode();
if (responseCode != 200) {
String errorMessage;
try (InputStream es = connection.getErrorStream()) {
errorMessage = IOUtils.toString(es, Charset.defaultCharset());
}
if (responseCode == 404 && channelNotFoundMessage.equals(errorMessage)) {
throw new SlackChannelNotFoundException(message.get("channel").getAsString(), errorMessage);
}
throw new SlackApiException(errorMessage, responseCode);
}
String responseMessage;
try (InputStream is = connection.getInputStream()) {
responseMessage = IOUtils.toString(is, Charset.defaultCharset());
}
return responseMessage;
} catch (IOException e) {
throw new SlackApiException(e);
} finally {
if(connection != null) {
connection.disconnect();
}
}
}
}
| {
"pile_set_name": "Github"
} |
var convert = require('./convert'),
func = convert('valueOf', require('../valueOf'), require('./_falseOptions'));
func.placeholder = require('./placeholder');
module.exports = func;
| {
"pile_set_name": "Github"
} |
<snippet>
<content><![CDATA[getScrollNodeRect()]]></content>
<tabTrigger>getScrollNodeRect()</tabTrigger>
<scope>source.lua</scope>
<description>UIScrollView</description>
</snippet>
| {
"pile_set_name": "Github"
} |
[Unit]
Description=Homegear Management
After=homegear.service
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
User=homegear
Group=homegear
RuntimeDirectory=homegear
RuntimeDirectoryMode=0755
TimeoutSec=300
LimitRTPRIO=100
ExecStart=/usr/bin/homegear-management -p /var/run/homegear/homegear-management.pid
ExecReload=/bin/kill -HUP $MAINPID
Restart=on-failure
TasksMax=infinity
LimitCORE=infinity
KillMode=process
| {
"pile_set_name": "Github"
} |
local ffi = require( "ffi" )
local sdl = require( "ffi/sdl" )
local wm = require( "lib/wm/sdl" )
local random, floor, pi = math.random, math.floor, math.pi
local lines = {{ x=0, y=0, solid = false }}
-- Preallocate certain ffi structures, to prevent allocations
local gfx = {}
local ui = {}
local function gencode()
local constructors = {
"image_surface_create",
"create",
}
local context_functions = {
"move_to", "line_to", "curve_to", "rel_move_to", "rel_line_to", "rel_curve_to",
"arc", "new_path", "rectangle", "close_path", "set_source_rgb", "set_source_rgba",
"fill_preserve", "stroke_preserve", "stroke", "set_line_width", "show_text", "clip",
"reset_clip", "text_extents", "save", "restore", "set_font_size", "set_operator",
"paint", "select_font_face", "surface_destroy", "destroy"
}
local surface_functions = {
}
local c = { "return {\n" }
for _,n in ipairs(constructors) do
assert( c[#c+1] == nil )
c[#c+1]='["'..n..'"]=function(self,...)return self.library.cairo_' .. n .. "(...)end,\n"
end
for _,n in ipairs(context_functions) do
assert( c[#c+1] == nil )
c[#c+1]='["'..n..'"]=function(self,...)return self.library.cairo_' .. n .. "(self.context,...)end,\n"
end
for _,n in ipairs(surface_functions) do
assert( c[#c+1] == nil )
c[#c+1]='["'..n..'"]=function(self,...)return self.library.cairo_' .. n .. "(self.surface,...)end,\n"
end
c[#c+1] = "}\n"
return table.concat(c)
end
local function fillconstants(m)
local constants = {
"FORMAT_RGB24", "OPERATOR_SOURCE",
}
for _,n in ipairs(constants) do
assert( m[n] == nil )
m[n] = m.library["CAIRO_" .. n]
end
end
--print(gencode())
local cairo = loadstring(gencode())()
cairo.library = require( "ffi/cairo" )
fillconstants(cairo)
cairo.context = {}
cairo.surface = {}
-- From the cairo cookbook
-- http://cairographics.org/cookbook/roundedrectangles/
function gfx:round_rect_a(x,y,width,height,radius)
local radius = radius or 5 -- an approximate curvature radius
local half_radius = radius * 0.5
local double_radius = radius + radius
local x0, y0 = x, y -- + half_radius, y + half_radius
local x1, y1 = x0+width, y0+height
if width < double_radius then
if height < double_radius then
cairo:move_to( x0, (y0 + y1) * 0.5 )
cairo:curve_to( x0, y0, x0, y0, (x0 + x1) * 0.5, y0 )
cairo:curve_to( x1, y0, x1, y0, x1, (y0 + y1) * 0.5 )
cairo:curve_to( x1, y1, x1, y1, (x1 + x0) * 0.5, y1 )
cairo:curve_to( x0, y1, x0, y1, x0, (y0 + y1) * 0.5 )
else
cairo:move_to( x0, y0 + radius )
cairo:curve_to( x0 ,y0, x0, y0, (x0 + x1)/2, y0 )
cairo:curve_to( x1, y0, x1, y0, x1, y0 + radius )
cairo:line_to( x1, y1 - radius )
cairo:curve_to( x1, y1, x1, y1, (x1 + x0)/2, y1 )
cairo:curve_to( x0, y1, x0, y1, x0, y1- radius )
end
else
if height < double_radius then
cairo:move_to( x0, (y0 + y1)/2 )
cairo:curve_to( x0 , y0, x0, y0, x0 + radius, y0 )
cairo:line_to( x1 - radius, y0 )
cairo:curve_to( x1, y0, x1, y0, x1, (y0 + y1)/2 )
cairo:curve_to( x1, y1, x1, y1, x1 - radius, y1 )
cairo:line_to( x0 + radius, y1 )
cairo:curve_to( x0, y1, x0, y1, x0, (y0 + y1)/2 )
else
cairo:move_to( x0, y0 + radius)
cairo:curve_to( x0 , y0, x0 , y0, x0 + radius, y0)
cairo:line_to( x1 - radius, y0)
cairo:curve_to( x1, y0, x1, y0, x1, y0 + radius)
cairo:line_to( x1, y1 - radius)
cairo:curve_to( x1, y1, x1, y1, x1 - radius, y1)
cairo:line_to( x0 + radius, y1)
cairo:curve_to( x0, y1, x0, y1, x0, y1- radius)
end
end
end
function gfx:round_rect_b(x,y,w,h,radius_x,radius_y)
-- http://graphics.stanford.edu/courses/cs248-98-fall/Final/q1.html
local ARC_TO_BEZIER = 0.55228475
local radius_x = radius_x or 5
local radius_y = radius_y or 5
if radius_x > w - radius_x then
radius_x = w * 0.5
end
if radius_y > h - radius_y then
radius_y = h * 0.5
end
-- approximate (quite close) the arc using a bezier curve
local c1 = ARC_TO_BEZIER * radius_x
local c2 = ARC_TO_BEZIER * radius_y
cairo:move_to( x + radius_x, y )
cairo:rel_line_to( w - 2 * radius_x, 0.0 )
cairo:rel_curve_to( c1, 0.0, radius_x, c2, radius_x, radius_y )
cairo:rel_line_to( 0, h - 2 * radius_y )
cairo:rel_curve_to( 0, c2, c1 - radius_x, radius_y, -radius_x, radius_y )
cairo:rel_line_to( -w + 2 * radius_x, 0 )
cairo:rel_curve_to( -c1, 0, -radius_x, -c2, -radius_x, -radius_y )
cairo:rel_line_to( 0, -h + 2 * radius_y )
cairo:rel_curve_to( 0, -c2, radius_x - c1, -radius_y, radius_x, -radius_y )
end
function gfx:round_rect_c(x, y, w, h, r)
local r = r or 5
cairo:move_to( x +r, y )
cairo:line_to( x+w-r, y )
cairo:curve_to( x+w, y, x+w, y, x+w, y +r )
cairo:line_to( x+w, y+h-r )
cairo:curve_to( x+w, y+h, x+w, y+h, x+w-r, y+h )
cairo:line_to( x +r, y+h )
cairo:curve_to( x, y+h, x, y+h, x, y+h-r )
cairo:line_to( x, y +r )
cairo:curve_to( x, y, x, y, x +r, y )
end
function gfx:round_rect_d(x, y, w, h, r)
local r, half_pi = r or 5, pi * 0.5
cairo:new_path()
cairo:arc( x +r, y +r, r, 2*half_pi, 3*half_pi )
cairo:arc( x+w-r, y +r, r, 3*half_pi, 4*half_pi )
cairo:arc( x+w-r, y+h-r, r, 0*half_pi, 1*half_pi )
cairo:arc( x +r, y+h-r, r, 1*half_pi, 2*half_pi )
end
local function take_string( table_or_string, table_key )
local s = table_or_string or "<nil>"
local t, k = type(s), table_key or 1
if t == "string" then
return s
elseif t == "number" or t == "boolean" then
return tostring(s)
elseif t == "table" then
-- The name is either the first element: [1], or .name, or .id
return take_string( s[k] or s.label or s.text or s.name or s.id )
elseif t == "function" then
return take_string( s(k), table_key )
else
-- userdata
-- thread
-- luajit has more I think
-- cdata
--
return "<"..t..">"
end
end
-- items is meta structure
function gfx:list_box(items, x, y, w, h)
local eh = 24 -- element height
local h = h or eh * #items
local ev = floor( h / eh ) -- elements visible
local h = ev * eh
local top = items.top or 1
local bottom = items.bottom or #items
local current = items.current or 1
if top < current - ev + 1 then
top = current - ev + 1
end
bottom = math.min(#items, top + ev - 1)
items.top, items.bottom = top, bottom
-- Make the rectangle path
cairo:rectangle( x, y, w, h )
-- Fill it first, but preserve the path
cairo:set_source_rgb( 1, 1, 1 ) -- listbox background color
cairo:fill_preserve()
-- Next stroke it, and preserve the path
cairo:set_source_rgb( 0, 0, 0 ) -- listbox "wire" color
cairo:set_line_width( 0.25 )
cairo:stroke_preserve()
-- Now set the clip, do not keep the path
cairo:clip()
for i=top, bottom do
local y = y + (i - top) * eh
local current = (i == current)
if current then
cairo:move_to( x, y )
cairo:rel_line_to( w, 0 )
cairo:rel_line_to( 0, eh )
cairo:rel_line_to( -w, 0 )
-- background
cairo:set_source_rgb( 0, 0, 1 )
cairo:fill_preserve()
-- wiring
cairo:set_source_rgb( 1, 1, 1 )
cairo:stroke()
end
cairo:move_to( x + 8, y + eh * 0.8 )
cairo:set_source_rgb( current and 1 or 0, current and 1 or 0, current and 1 or 0 )
cairo:show_text( take_string( items[i] ) )
end
cairo:reset_clip()
end
local gfx_text_extents = ffi.new( "cairo_text_extents_t" )
function gfx:text_extents( text )
cairo:text_extents( text, gfx_text_extents )
return gfx_text_extents
end
function gfx:main_menu(items, x, y, w, h)
local eh = 24 -- element height
local ev = floor( h / eh ) -- elements visible
local h = ev * eh
local current = items.current or 1
local hgap = 8
local vgap = 5
local width = 0
local height = 0
for i=1, #items do
local item = take_string( items[i] )
local te = gfx:text_extents( item )
width = width + te.width + hgap*2
height = math.max(height, te.height)
end
-- Make the rectangle path
cairo:rectangle( x, y, width, height + vgap*2 )
-- Fill it first, but preserve the path
cairo:set_source_rgb( 1, 1, 1 ) -- listbox background color
cairo:fill_preserve( )
-- Next stroke it, and preserve the path
cairo:set_source_rgb( 0, 0, 0 ) -- listbox "wire" color
cairo:set_line_width( 0.25 )
cairo:stroke_preserve()
-- Now set the clip, do not keep the path
cairo:clip()
local cx = hgap
for i=1, #items do
local iw = gfx:text_extents( take_string(items[i]) ).width + hgap*2
local y = 0
local current = (i == current)
local opened = items.opened
if current then
if items.opened then
else
cairo:move_to( cx-hgap, y )
cairo:rel_line_to( iw, 0 )
cairo:rel_line_to( 0, height + vgap*2 )
cairo:rel_line_to( -iw, 0 )
-- background
cairo:set_source_rgb( 0, 0, 1 )
cairo:fill_preserve()
-- wiring
cairo:set_source_rgb( 1, 1, 1 )
cairo:stroke()
end
end
cairo:move_to( cx, y + height*1.2 )
if current and not opened then
cairo:set_source_rgb( 1, 1, 1 )
else
if current and opened then
cairo:set_source_rgb( 0.5, 0.5, 0.5 )
else
cairo:set_source_rgb( 0, 0, 0 )
end
end
local item = take_string( items[i] )
cairo:show_text( item )
if current and opened then
local items = items[i]
if type(items)=="function" then
items = items()
end
local items = items[2]
if items then
cairo:save()
cairo:reset_clip()
gfx:list_box( items, cx, y + height+hgap, 100 )
cairo:restore()
end
end
cx = cx + iw
end
cairo:reset_clip()
end
function ui:list_box(state)
-- Draws a list_box
end
local items = {
"First Item",
"Secod Item",
"Third Item",
"Fourth Item",
"Fifth Item",
"Third Item 1",
"Fourth Item 2",
"Fifth Item 3",
"Third Item 4",
"Fourth Item 5",
"Fifth Item 6",
"Third Item 7",
"Fourth Item 8",
"Fifth Item 9",
selected = { 3, 5 },
current = 2,
}
-- Table is a magic construct :)
-- The menu would be defined in it
-- All "array" elements define order of display
-- All "dictionary" elements define actions
local edit_menu = {
"Edit", {
"Undo", {
"Cut"
},
"Paste", {
"Paste from Kill Menu", {
"Clip1",
"Clip2",
"Clip3"
},
},
},
}
local edit_menu2 = {
"Edit", {
"Undo2", {
"Cut2"
},
"Paste2", {
"Paste2 from Kill Menu", {
"Clip4",
"Clip5",
"Clip6"
},
},
},
}
local which_edit_menu
local test_menu = {
"(Apple)", {
"About This Mac", function() end,
"Software Update...", function() end,
"App Store...", function() end,
"", {},
},
"File", {
},
"Edit", {
},
"Options", {
"Line Wrapping", {
},
{ true, "Smart Word Spacing in Text Modes" },
"", {},
""
},
}
--[[
lua types:
nil, boolean, number, string, function, userdata, thread, and table
First item
if function, then eval it, and put result back here
if string then that's the textual contents
if number
if boolean
Second item
First item -- Visual representation
nil -> ? bad idea to rely on it
boolean -> ? Maybe way to display checked menu items?
number -> ?
string -> The text of the item
function -> Evals the function, then feedback the result back to "First item"
userdata -> ?
thread -> Like function, but actually resumes the thread coroutine, and expects value to be yielded back to "First item"
table -> Special cases - like Check boxed item, or image item, builtin-slider, etc... Maybe widget or whole OO style widgets
cdata -> ?
Second item -- Action to be taken
nil -> ? bad idea to rely on it
boolean -> ? Maybe not active, or disabled or it could be a way to specify checked menu items
number -> This can keep some kind of number identifier - like 513
string -> This can keep some kind of string identifier - like "ID_MENU_ITEM_BLAH123"
function -> Action to be taken when pressed
userdata -> ?
thread -> Like function, but actually resumes the thread coroutine with the action. Could be the only way to implement interactive dialogs in the menu, like in OSX Help ->Search
table -> Sub-items are listed here
cdata -> ?
--]]
-- Menu is defined in pairs of 2
-- First item is the textual representation
-- If it's a string, then it's the text itself
-- If it's a function, then the function returns the representation
-- If it's a table, number, userdata, etc. - undefined for now
-- Second item is either menu expansion or function
-- If it's a table, then it's an expansion
-- Otherwise if it's a function then it acts on it's value.
local main_menu = {
{
"File", {
{ "Visit New File | C-x C-f" },
{ "Open File...", "Test" },
},
},
function()
which_edit_menu = not(which_edit_menu)
return which_edit_menu and edit_menu or edit_menu2
end,
{
"Options", {
"Line Wrapping",
"Smart Word Spacing",
"-------------",
"Show Tabs",
"Show Buffers in new",
"----"
},
},
{
"Buffers", {
{ name1 = "One" },
{ name = "Two" },
{ label = "Treeh" }
},
},
{ "Tools" },
{ "Lua" },
{
"Help", {
function() return "Search [| ]" end,
"Help on Word",
"Documentation",
"About",
},
},
{
function() return os.date( "%X" ) end,
{
function() return os.date( "%A" ) end,
function() return os.date( "%d %b %Y" ) end,
}
},
current = 3,
}
local function make_colors(n)
n = n or 16
local colors = {}
for i=1, n do
local r = random(0.1,0.9)
local g = random(0.1,0.9)
local b = random(0.1,0.9)
local mag = r*r + g*g + b*b
local oolen = 1 / math.sqrt(mag)
r, g, b = r*oolen, g*oolen, b*oolen
v = { random(), random(), random() }
v[random(1,#v)] = 1 --0.50
v[random(1,#v)] = 1 --0.75
colors[#colors+1] = { r*v[1], g*v[1], b*v[2], 1 }
end
return colors
end
local key2cmd = {
--sdl.SDLK_UP = "up",
--sdl.SDLK_DOWN = "down",
--sdl.SDLK_LEFT = "left",
--sdl.SDLK_RIGHT = "right",
--sdl.SDLK_SPACE = "select",
--sdl.SDLK_ENTER = "accept",
}
do
local sdl_surface
function wm:resized()
local format = cairo.FORMAT_RGB24
cairo.surface = ffi.gc(
cairo:image_surface_create( format, self.width, self.height ),
cairo.library.cairo_surface_destroy
)
cairo.context = ffi.gc(
cairo:create( cairo.surface ),
cairo.library.cairo_destroy
)
sdl_surface = ffi.gc(
sdl.SDL_CreateRGBSurfaceFrom(
cairo.library.cairo_image_surface_get_data( cairo.surface ),
self.width, self.height, 32,
cairo.library.cairo_format_stride_for_width( format, self.width ),
0, 0, 0, 0
),
sdl.SDL_FreeSurface
)
sdl.SDL_WM_SetCaption( "GUI Demo", nil )
end
function wm:key_pressed()
if self.kb == 27 then
wm:exit()
end
end
local colors = make_colors()
local frame = 0
while wm:update(false) do
cairo:save()
cairo:set_operator( cairo.OPERATOR_SOURCE )
cairo:set_source_rgba( 1, 0.75, 0.15, 1 )
cairo:paint()
cairo:restore()
cairo:select_font_face( "Tahoma", 0, 0 )
cairo:set_font_size( 16 )
cairo:move_to( wm.width - 50, wm.height - 16 )
cairo:set_source_rgba( 1, 1, 1, 1 )
cairo:show_text( tostring( #lines ))
cairo:set_line_width( 1+math.sqrt(math.max(1,wm.wheel/16)))
local color = 0
for i=1,#lines do
local point = lines[i]
if i > 1 and lines[i-1].solid then
cairo:line_to( point.x, point.y )
else
cairo:move_to( point.x, point.y )
cairo:stroke()
-- cairo:set_line_width( random()*3 + math.sqrt(math.max(1,wm.wheel/16)))
color = color + 1
local color = colors[ color % #colors + 1 ]
cairo:set_source_rgba( color[1], color[2], color[3], color[4] )
end
end
cairo:stroke()
if wm.mb[1] then
local dx = lines[ #lines ].x - wm.mx
local dy = lines[ #lines ].y - wm.my
if math.abs(dx) > 1 or math.abs(dy) > 1 then
lines[ #lines + 1 ] = { x = wm.mx, y = wm.my, solid=true, color = random() }
end
elseif lines[ #lines ].solid then
lines[ #lines + 1 ] = { x=wm.mx, y=wm.my, solid=false, color = random() }
end
if wm.mb[3] then
lines = {{ x=wm.mx, y = wm.my, solid=true }}
colors = make_colors()
end
cairo:set_line_width( 0.5 )
local bw, bh = 128 + 16 + frame,32 + frame
local cols, rows = floor(wm.width / bw) + 1, floor(wm.height / bh) + 1
cols, rows = 4, 4
for i=0, cols*rows - 1 do
local col, row = floor(i / rows), (i % rows)
local x, y = col * bw, row * bh + 50
local inset = 10
local method = (i % 4 + 1) --random(1,4)
cairo:set_source_rgba( 1, 1, 1, 1 )
gfx["round_rect_"..string.char(32+64+method)](gfx, x+inset, y+inset, bw-inset, bh-inset, bh / 3 )
local a, b, c, d = random(#colors), random(#colors),random(#colors),random(#colors)
if i ~= os.time() % (cols*rows) then
cairo:set_source_rgba( 1, 1, 1, 1 )
else
cairo:set_source_rgba( 0.25, 0.5, 1, 1 )
end
cairo:fill_preserve()
cairo:set_source_rgba( 0, 0, 0, 1 )
cairo:stroke()
cairo:move_to( x + 22, y + bh * 0.8 )
cairo:set_font_size( bh * 0.5 )
cairo:show_text( "Aa" )
end
local current = items.current - 1
if wm.kb == sdl.SDLK_UP then items.current = (current - 1) % #items + 1
elseif wm.kb == sdl.SDLK_DOWN then items.current = (current + 1) % #items + 1
elseif wm.kb == sdl.SDLK_LEFT then main_menu.current = (main_menu.current - 2) % #main_menu + 1
elseif wm.kb == sdl.SDLK_RIGHT then main_menu.current = main_menu.current % #main_menu + 1
elseif wm.kb == sdl.SDLK_RETURN then main_menu.opened = not main_menu.opened end
wm.kb = 0
gfx:list_box( items, 10, wm.height/2-50, 100, 200 )
gfx:list_box( items, 170, wm.height/2-25, 175, 300 )
gfx:main_menu( main_menu, 0, 0, wm.width, 100 )
sdl.SDL_UpperBlit( sdl_surface, nil, wm.window, nil )
end
end
| {
"pile_set_name": "Github"
} |
fileFormatVersion: 2
guid: dc7abfa0435174ded902b073322d67cc
folderAsset: yes
DefaultImporter:
userData:
assetBundleName:
| {
"pile_set_name": "Github"
} |
--TEST--
imagerotate() overflow with negative numbers
--SKIPIF--
<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
if (!function_exists('imagerotate')) {
die("skip imagerotate() not available.");
}
?>
--FILE--
<?php
$im = imagecreate(10, 10);
$tmp = imagerotate ($im, 5, -9999999);
var_dump($tmp);
if ($tmp) {
imagedestroy($tmp);
}
if ($im) {
imagedestroy($im);
}
?>
--EXPECT--
bool(false)
| {
"pile_set_name": "Github"
} |
---
-api-id: P:Windows.Devices.Bluetooth.BluetoothLEAppearanceCategories.Thermometer
-api-type: winrt property
-api-device-family-note: xbox
---
<!-- Property syntax
public ushort Thermometer { get; }
-->
# Windows.Devices.Bluetooth.BluetoothLEAppearanceCategories.Thermometer
## -description
Gets the thermometer appearance category code.
## -property-value
The appearance category code for a thermometer Bluetooth LE device.
## -remarks
## -examples
## -see-also
## -capabilities
bluetooth
| {
"pile_set_name": "Github"
} |
/**************************************************************************************
* Copyright (c) 2016-2017, ARM Limited or its affiliates. All rights reserved *
* *
* This file and the related binary are licensed under the following license: *
* *
* ARM Object Code and Header Files License, v1.0 Redistribution. *
* *
* Redistribution and use of object code, header files, and documentation, without *
* modification, are permitted provided that the following conditions are met: *
* *
* 1) Redistributions must reproduce the above copyright notice and the *
* following disclaimer in the documentation and/or other materials *
* provided with the distribution. *
* *
* 2) Unless to the extent explicitly permitted by law, no reverse *
* engineering, decompilation, or disassembly of is permitted. *
* *
* 3) Redistribution and use is permitted solely for the purpose of *
* developing or executing applications that are targeted for use *
* on an ARM-based product. *
* *
* DISCLAIMER. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND *
* CONTRIBUTORS "AS IS." ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT *
* NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, *
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE *
* COPYRIGHT HOLDERS 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. *
**************************************************************************************/
/*!
* \file ssi_bitops.h
* Bit fields operations macros.
*/
#ifndef _SSI_BITOPS_H_
#define _SSI_BITOPS_H_
#define BITMASK(mask_size) (((mask_size) < 32) ? \
((1UL << (mask_size)) - 1) : 0xFFFFFFFFUL)
#define BITMASK_AT(mask_size, mask_offset) (BITMASK(mask_size) << (mask_offset))
#define BITFIELD_GET(word, bit_offset, bit_size) \
(((word) >> (bit_offset)) & BITMASK(bit_size))
#define BITFIELD_SET(word, bit_offset, bit_size, new_val) do { \
word = ((word) & ~BITMASK_AT(bit_size, bit_offset)) | \
(((new_val) & BITMASK(bit_size)) << (bit_offset)); \
} while (0)
/* Is val aligned to "align" ("align" must be power of 2) */
#ifndef IS_ALIGNED
#define IS_ALIGNED(val, align) \
(((uint32_t)(val) & ((align) - 1)) == 0)
#endif
#define SWAP_ENDIAN(word) \
(((word) >> 24) | (((word) & 0x00FF0000) >> 8) | \
(((word) & 0x0000FF00) << 8) | (((word) & 0x000000FF) << 24))
#ifdef BIG__ENDIAN
#define SWAP_TO_LE(word) SWAP_ENDIAN(word)
#define SWAP_TO_BE(word) word
#else
#define SWAP_TO_LE(word) word
#define SWAP_TO_BE(word) SWAP_ENDIAN(word)
#endif
/* Is val a multiple of "mult" ("mult" must be power of 2) */
#define IS_MULT(val, mult) \
(((val) & ((mult) - 1)) == 0)
#define IS_NULL_ADDR(adr) \
(!(adr))
#endif /*_SSI_BITOPS_H_*/
| {
"pile_set_name": "Github"
} |
#ifndef __ASM_AVR32_MODULE_H
#define __ASM_AVR32_MODULE_H
struct mod_arch_syminfo {
unsigned long got_offset;
int got_initialized;
};
struct mod_arch_specific {
/* Starting offset of got in the module core memory. */
unsigned long got_offset;
/* Size of the got. */
unsigned long got_size;
/* Number of symbols in syminfo. */
int nsyms;
/* Additional symbol information (got offsets). */
struct mod_arch_syminfo *syminfo;
};
#define Elf_Shdr Elf32_Shdr
#define Elf_Sym Elf32_Sym
#define Elf_Ehdr Elf32_Ehdr
#define MODULE_PROC_FAMILY "AVR32v1"
#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY
#endif /* __ASM_AVR32_MODULE_H */
| {
"pile_set_name": "Github"
} |
//
// SUVersionComparisonProtocol.h
// Sparkle
//
// Created by Andy Matuschak on 12/21/07.
// Copyright 2007 Andy Matuschak. All rights reserved.
//
#ifndef SUVERSIONCOMPARISONPROTOCOL_H
#define SUVERSIONCOMPARISONPROTOCOL_H
#import <Cocoa/Cocoa.h>
#import "SUExport.h"
/*!
Provides version comparison facilities for Sparkle.
*/
@protocol SUVersionComparison
/*!
An abstract method to compare two version strings.
Should return NSOrderedAscending if b > a, NSOrderedDescending if b < a,
and NSOrderedSame if they are equivalent.
*/
- (NSComparisonResult)compareVersion:(NSString *)versionA toVersion:(NSString *)versionB; // *** MAY BE CALLED ON NON-MAIN THREAD!
@end
#endif
| {
"pile_set_name": "Github"
} |
/*!
* Font Awesome 3.2.1
* the iconic font designed for Bootstrap
* ------------------------------------------------------------------------------
* The full suite of pictographic icons, examples, and documentation can be
* found at http://fontawesome.io. Stay up to date on Twitter at
* http://twitter.com/fontawesome.
*
* License
* ------------------------------------------------------------------------------
* - The Font Awesome font is licensed under SIL OFL 1.1 -
* http://scripts.sil.org/OFL
* - Font Awesome CSS, LESS, and SASS files are licensed under MIT License -
* http://opensource.org/licenses/mit-license.html
* - Font Awesome documentation licensed under CC BY 3.0 -
* http://creativecommons.org/licenses/by/3.0/
* - Attribution is no longer required in Font Awesome 3.0, but much appreciated:
* "Font Awesome by Dave Gandy - http://fontawesome.io"
*
* Author - Dave Gandy
* ------------------------------------------------------------------------------
* Email: dave@fontawesome.io
* Twitter: http://twitter.com/davegandy
* Work: Lead Product Designer @ Kyruus - http://kyruus.com
*/
.icon-large {
font-size: 1.3333333333333333em;
margin-top: -4px;
padding-top: 3px;
margin-bottom: -4px;
padding-bottom: 3px;
vertical-align: middle;
}
.nav [class^="icon-"],
.nav [class*=" icon-"] {
vertical-align: inherit;
margin-top: -4px;
padding-top: 3px;
margin-bottom: -4px;
padding-bottom: 3px;
}
.nav [class^="icon-"].icon-large,
.nav [class*=" icon-"].icon-large {
vertical-align: -25%;
}
.nav-pills [class^="icon-"].icon-large,
.nav-tabs [class^="icon-"].icon-large,
.nav-pills [class*=" icon-"].icon-large,
.nav-tabs [class*=" icon-"].icon-large {
line-height: .75em;
margin-top: -7px;
padding-top: 5px;
margin-bottom: -5px;
padding-bottom: 4px;
}
.btn [class^="icon-"].pull-left,
.btn [class*=" icon-"].pull-left,
.btn [class^="icon-"].pull-right,
.btn [class*=" icon-"].pull-right {
vertical-align: inherit;
}
.btn [class^="icon-"].icon-large,
.btn [class*=" icon-"].icon-large {
margin-top: -0.5em;
}
a [class^="icon-"],
a [class*=" icon-"] {
cursor: pointer;
}
.icon-glass {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-music {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-search {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-envelope-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-heart {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-star {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-star-empty {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-user {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-film {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-th-large {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-th {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-th-list {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ok {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-remove {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-zoom-in {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-zoom-out {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-off {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-power-off {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-signal {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cog {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-gear {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-trash {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-home {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-file-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-time {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-road {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-download-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-download {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-upload {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-inbox {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-play-circle {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-repeat {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-rotate-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-refresh {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-list-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-lock {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-flag {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-headphones {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-volume-off {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-volume-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-volume-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-qrcode {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-barcode {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tag {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tags {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-book {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bookmark {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-print {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-camera {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-font {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bold {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-italic {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-text-height {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-text-width {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-align-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-align-center {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-align-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-align-justify {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-list {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-indent-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-indent-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-facetime-video {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-picture {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-pencil {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-map-marker {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-adjust {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tint {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-edit {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-share {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-check {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-move {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-step-backward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-fast-backward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-backward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-play {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-pause {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-stop {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-forward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-fast-forward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-step-forward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-eject {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-plus-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-minus-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-remove-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ok-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-question-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-info-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-screenshot {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-remove-circle {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ok-circle {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ban-circle {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-arrow-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-arrow-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-arrow-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-arrow-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-share-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-mail-forward {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-resize-full {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-resize-small {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-plus {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-minus {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-asterisk {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-exclamation-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-gift {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-leaf {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-fire {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-eye-open {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-eye-close {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-warning-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-plane {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-calendar {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-random {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-comment {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-magnet {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-retweet {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-shopping-cart {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-folder-close {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-folder-open {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-resize-vertical {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-resize-horizontal {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bar-chart {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-twitter-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-facebook-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-camera-retro {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-key {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cogs {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-gears {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-comments {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-thumbs-up-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-thumbs-down-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-star-half {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-heart-empty {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-signout {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-linkedin-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-pushpin {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-external-link {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-signin {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-trophy {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-github-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-upload-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-lemon {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-phone {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-check-empty {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-unchecked {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bookmark-empty {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-phone-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-twitter {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-facebook {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-github {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-unlock {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-credit-card {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-rss {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-hdd {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bullhorn {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bell {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-certificate {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-hand-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-hand-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-hand-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-hand-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-circle-arrow-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-circle-arrow-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-circle-arrow-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-circle-arrow-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-globe {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-wrench {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tasks {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-filter {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-briefcase {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-fullscreen {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-group {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-link {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cloud {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-beaker {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cut {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-copy {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-paper-clip {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-paperclip {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-save {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sign-blank {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-reorder {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-list-ul {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-list-ol {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-strikethrough {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-underline {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-table {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-magic {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-truck {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-pinterest {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-pinterest-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-google-plus-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-google-plus {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-money {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-caret-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-caret-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-caret-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-caret-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-columns {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-envelope {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-linkedin {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-undo {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-rotate-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-legal {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-dashboard {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-comment-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-comments-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bolt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sitemap {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-umbrella {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-paste {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-lightbulb {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-exchange {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cloud-download {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cloud-upload {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-user-md {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-stethoscope {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-suitcase {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bell-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-coffee {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-food {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-file-text-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-building {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-hospital {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ambulance {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-medkit {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-fighter-jet {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-beer {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-h-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-plus-sign-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-double-angle-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-double-angle-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-double-angle-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-double-angle-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-angle-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-angle-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-angle-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-angle-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-desktop {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-laptop {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tablet {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-mobile-phone {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-circle-blank {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-quote-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-quote-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-spinner {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-circle {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-reply {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-mail-reply {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-github-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-folder-close-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-folder-open-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-expand-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-collapse-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-smile {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-frown {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-meh {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-gamepad {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-keyboard {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-flag-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-flag-checkered {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-terminal {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-code {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-reply-all {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-mail-reply-all {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-star-half-empty {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-star-half-full {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-location-arrow {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-crop {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-code-fork {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-unlink {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-question {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-info {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-exclamation {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-superscript {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-subscript {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-eraser {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-puzzle-piece {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-microphone {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-microphone-off {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-shield {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-calendar-empty {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-fire-extinguisher {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-rocket {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-maxcdn {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-sign-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-sign-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-sign-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-chevron-sign-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-html5 {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-css3 {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-anchor {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-unlock-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bullseye {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ellipsis-horizontal {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ellipsis-vertical {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-rss-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-play-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-ticket {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-minus-sign-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-check-minus {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-level-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-level-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-check-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-edit-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-external-link-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-share-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-compass {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-collapse {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-collapse-top {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-expand {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-eur {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-euro {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-gbp {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-usd {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-dollar {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-inr {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-rupee {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-jpy {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-yen {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-cny {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-renminbi {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-krw {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-won {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-btc {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bitcoin {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-file {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-file-text {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-by-alphabet {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-by-alphabet-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-by-attributes {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-by-attributes-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-by-order {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sort-by-order-alt {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-thumbs-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-thumbs-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-youtube-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-youtube {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-xing {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-xing-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-youtube-play {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-dropbox {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-stackexchange {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-instagram {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-flickr {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-adn {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bitbucket {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bitbucket-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tumblr {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-tumblr-sign {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-long-arrow-down {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-long-arrow-up {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-long-arrow-left {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-long-arrow-right {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-apple {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-windows {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-android {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-linux {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-dribbble {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-skype {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-foursquare {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-trello {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-female {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-male {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-gittip {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-sun {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-moon {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-archive {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-bug {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-vk {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-weibo {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
.icon-renren {
*zoom: expression( this.runtimeStyle['zoom'] = '1', this.innerHTML = '');
}
| {
"pile_set_name": "Github"
} |
ABILITYCATEGORY:Changeling Race Trait VISIBLE:QUALIFY EDITABLE:YES EDITPOOL:NO CATEGORY:Special Ability TYPE:Changeling Race Trait DISPLAYLOCATION:Character
ABILITYCATEGORY:Shifter Race Trait VISIBLE:QUALIFY EDITABLE:YES EDITPOOL:NO CATEGORY:Special Ability TYPE:Shifter Race Trait DISPLAYLOCATION:Character
ABILITYCATEGORY:Warforged Race Trait VISIBLE:QUALIFY EDITABLE:YES EDITPOOL:NO CATEGORY:Special Ability TYPE:Warforged Race Trait DISPLAYLOCATION:Character
ABILITYCATEGORY:Shifter Subrace VISIBLE:QUALIFY EDITABLE:YES EDITPOOL:NO CATEGORY:Internal TYPE:Shifter Subrace DISPLAYLOCATION:Character
ABILITYCATEGORY:Warforged Subrace VISIBLE:QUALIFY EDITABLE:YES EDITPOOL:NO CATEGORY:Internal TYPE:Warforged Subrace DISPLAYLOCATION:Character
ABILITYCATEGORY:Dragonmark House VISIBLE:QUALIFY EDITABLE:YES EDITPOOL:NO CATEGORY:Special Ability TYPE:Dragonmark House DISPLAYLOCATION:Character POOL:Pool_Dragonmark_House
| {
"pile_set_name": "Github"
} |
// untested sections: 3
package matchers
import (
"fmt"
"reflect"
"github.com/onsi/gomega/format"
)
type ReceiveMatcher struct {
Arg interface{}
receivedValue reflect.Value
channelClosed bool
}
func (matcher *ReceiveMatcher) Match(actual interface{}) (success bool, err error) {
if !isChan(actual) {
return false, fmt.Errorf("ReceiveMatcher expects a channel. Got:\n%s", format.Object(actual, 1))
}
channelType := reflect.TypeOf(actual)
channelValue := reflect.ValueOf(actual)
if channelType.ChanDir() == reflect.SendDir {
return false, fmt.Errorf("ReceiveMatcher matcher cannot be passed a send-only channel. Got:\n%s", format.Object(actual, 1))
}
var subMatcher omegaMatcher
var hasSubMatcher bool
if matcher.Arg != nil {
subMatcher, hasSubMatcher = (matcher.Arg).(omegaMatcher)
if !hasSubMatcher {
argType := reflect.TypeOf(matcher.Arg)
if argType.Kind() != reflect.Ptr {
return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nTo:\n%s\nYou need to pass a pointer!", format.Object(actual, 1), format.Object(matcher.Arg, 1))
}
}
}
winnerIndex, value, open := reflect.Select([]reflect.SelectCase{
{Dir: reflect.SelectRecv, Chan: channelValue},
{Dir: reflect.SelectDefault},
})
var closed bool
var didReceive bool
if winnerIndex == 0 {
closed = !open
didReceive = open
}
matcher.channelClosed = closed
if closed {
return false, nil
}
if hasSubMatcher {
if didReceive {
matcher.receivedValue = value
return subMatcher.Match(matcher.receivedValue.Interface())
}
return false, nil
}
if didReceive {
if matcher.Arg != nil {
outValue := reflect.ValueOf(matcher.Arg)
if value.Type().AssignableTo(outValue.Elem().Type()) {
outValue.Elem().Set(value)
return true, nil
}
if value.Type().Kind() == reflect.Interface && value.Elem().Type().AssignableTo(outValue.Elem().Type()) {
outValue.Elem().Set(value.Elem())
return true, nil
} else {
return false, fmt.Errorf("Cannot assign a value from the channel:\n%s\nType:\n%s\nTo:\n%s", format.Object(actual, 1), format.Object(value.Interface(), 1), format.Object(matcher.Arg, 1))
}
}
return true, nil
}
return false, nil
}
func (matcher *ReceiveMatcher) FailureMessage(actual interface{}) (message string) {
subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher)
closedAddendum := ""
if matcher.channelClosed {
closedAddendum = " The channel is closed."
}
if hasSubMatcher {
if matcher.receivedValue.IsValid() {
return subMatcher.FailureMessage(matcher.receivedValue.Interface())
}
return "When passed a matcher, ReceiveMatcher's channel *must* receive something."
}
return format.Message(actual, "to receive something."+closedAddendum)
}
func (matcher *ReceiveMatcher) NegatedFailureMessage(actual interface{}) (message string) {
subMatcher, hasSubMatcher := (matcher.Arg).(omegaMatcher)
closedAddendum := ""
if matcher.channelClosed {
closedAddendum = " The channel is closed."
}
if hasSubMatcher {
if matcher.receivedValue.IsValid() {
return subMatcher.NegatedFailureMessage(matcher.receivedValue.Interface())
}
return "When passed a matcher, ReceiveMatcher's channel *must* receive something."
}
return format.Message(actual, "not to receive anything."+closedAddendum)
}
func (matcher *ReceiveMatcher) MatchMayChangeInTheFuture(actual interface{}) bool {
if !isChan(actual) {
return false
}
return !matcher.channelClosed
}
| {
"pile_set_name": "Github"
} |
__________________________________________________________________________________________________
__________________________________________________________________________________________________
__________________________________________________________________________________________________
| {
"pile_set_name": "Github"
} |
/*
* Copyright 2012 OSBI Ltd
*
* 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.
*/
/**
* The open query tab (Repository viewer)
*/
var OpenQuery = Backbone.View.extend({
className: 'tab_container',
events: {
'click .query': 'view_query',
'dblclick .query': 'select_and_open_query',
'click .add_folder' : 'add_folder',
'click li.folder': 'toggle_folder',
'click .workspace_toolbar a.button' : 'prevent_default',
'click .workspace_toolbar a.run': 'open_query',
'click .workspace_toolbar a.edit': 'edit_query',
'click .workspace_toolbar [href=#edit_folder]': 'edit_folder',
'click .workspace_toolbar [href=#delete_folder]': 'delete_repoObject',
'click .workspace_toolbar [href=#delete_query]': 'delete_repoObject',
'click .workspace_toolbar [href=#edit_permissions]': 'edit_permissions',
'click .queries' : 'click_canvas',
'keyup .search_file' : 'search_file',
'click .cancel_search' : 'cancel_search'
},
template: function() {
return _.template($("#template-open-dialog").html())();
},
template_repository_objects: function( repository ) {
var self = this;
$(this.el).find('.sidebar ul').html(
_.template( $( '#template-repository-objects' ).html( ) )( {
repoObjects: repository
} )
);
},
caption: function() {
return "Repository";
},
/*jshint -W069 */
render: function() {
// Load template
$(this.el).html(this.template());
// Adjust tab when selected
this.tab.bind('tab:select', this.fetch_queries);
this.tab.bind('tab:select', this.adjust);
$(window).resize(this.adjust);
var self = this;
var menuitems = {
"open": {name: "Open", i18n: true },
"edit": {name: "Edit", i18n: true },
// "rename": {name: "Rename", i18n: true },
"delete": {name: "Delete", i18n: true },
"move": {name: "Move", i18n: true},
"sep1": "---------",
"new": {name: "New Folder", i18n: true},
"opencontents": {name: "Open Folder Contents", i18n: true}
};
$.each(menuitems, function(key, item){
recursive_menu_translate(item, Saiku.i18n.po_file);
});
$.contextMenu('destroy', 'li.query, div.folder_row');
$.contextMenu({
selector: 'li.query, div.folder_row',
events: {
show: function(opt) {
$( self.el ).find( '.selected' ).removeClass( 'selected' );
$(this).addClass('selected');
var path = $(this).find('a').attr('href').replace('#', '');
var item = self.queries[path];
if (typeof item.acl != "undefined" && _.indexOf(item.acl, "WRITE") < 0) {
opt.commands['delete'].disabled = true;
opt.items['delete'].disabled = true;
opt.commands['edit'].disabled = true;
opt.items['edit'].disabled = true;
opt.commands['move'].disabled = true;
opt.items['move'].disabled = true;
} else {
opt.commands['delete'].disabled = false;
opt.items['delete'].disabled = false;
opt.commands['edit'].disabled = false;
opt.items['edit'].disabled = false;
opt.commands['move'].disabled = false;
opt.items['move'].disabled = false;
}
if ($(this).hasClass('folder_row')) {
opt.commands.open.disabled = true;
opt.items.open.disabled = true;
} else {
opt.commands.open.disabled = false;
opt.items.open.disabled = false;
}
}
},
callback: function(key, options) {
var path = $(this).find('a').attr('href').replace('#', '');
var item = self.queries[path];
self.selected_query = new SavedQuery({ file: path, name: item.name, type: item.type });
if (key == "open" && $(this).hasClass('query')) {
self.open_query();
} if (key == "edit" && $(this).hasClass('query')) {
self.edit_query();
} else if (key == "new") {
self.add_folder();
} else if (key == "delete") {
self.delete_repoObject();
} else if(key == "move"){
self.move_repoObject();
} else if(key =="opencontents"){
self.open_contents();
}
},
items: menuitems
});
// Fire off new openQuery event
Saiku.session.trigger('openQuery:new', { openQuery: this });
if (Settings.REPOSITORY_LAZY) {
this.$el.find('.search_file').prop('disabled', true);
}
return this;
},
initialize: function(args) {
// Maintain `this`
_.bindAll(this, "adjust", "fetch_queries",
"clear_query","select_and_open_query", "cancel_search", "add_folder");
// Initialize repository
this.repository = new Repository({}, { dialog: this });
},
fetch_queries: function() {
this.repository.fetch();
},
populate: function( repository ) {
var self = this;
self.template_repository_objects( repository );
self.queries = {};
function getQueries( entries ) {
_.forEach( entries, function( entry ) {
self.queries[ entry.path ] = entry;
if( entry.type === 'FOLDER' ) {
getQueries( entry.repoObjects );
}
} );
}
getQueries( repository );
},
search_file: function(event) {
var filter = $(this.el).find('.search_file').val().toLowerCase();
var isEmpty = (typeof filter == "undefined" || filter === "" || filter === null);
if (isEmpty || event.which == 27 || event.which == 9) {
this.cancel_search();
} else {
if ($(this.el).find('.search_file').val()) {
$(this.el).find('.cancel_search').show();
} else {
$(this.el).find('.cancel_search').hide();
}
$(this.el).find('li.query').removeClass('hide');
$(this.el).find('li.query a').each(function (index) {
if($(this).text().toLowerCase().indexOf(filter) == -1) {
$(this).parent('li.query').addClass('hide');
}
});
$(this.el).find('li.folder').addClass('hide');
$(this.el).find('li.query').not('.hide').parents('li.folder').removeClass('hide');
//$(this.el).find( 'li.folder .folder_content').not(':has(.query:visible)').parent().addClass('hide');
//not(':contains("' + filter + '")').parent().hide();
$(this.el).find( 'li.folder .folder_row' ).find('.sprite').removeClass( 'collapsed' );
$(this.el).find( 'li.folder .folder_content' ).removeClass('hide');
}
return false;
},
cancel_search: function(event) {
$(this.el).find('input.search_file').val('');
$(this.el).find('.cancel_search').hide();
$(this.el).find('li.query, li.folder').removeClass('hide');
$(this.el).find( '.folder_row' ).find('.sprite').addClass( 'collapsed' );
$(this.el).find( 'li.folder .folder_content' ).addClass('hide');
$(this.el).find('.search_file').val('').focus();
$(this.el).find('.cancel_search').hide();
},
view_query: function(event) {
event.preventDefault( );
var $currentTarget = $( event.currentTarget );
var $target = $currentTarget.find('a');
this.unselect_current_selected( );
$currentTarget.addClass( 'selected' );
var path = $target.attr('href').replace('#', '');
var name = $target.text();
var query = this.queries[path];
$( this.el ).find( '.workspace_toolbar' ).removeClass( 'hide' );
$( this.el ).find( '.for_queries' ).addClass( 'hide' );
$( this.el ).find( '.for_folder' ).addClass( 'hide' );
$( this.el ).find( '.add_folder' ).parent().addClass( 'hide' );
if (typeof query.acl != "undefined" && _.indexOf(query.acl, "READ") > -1) {
$( this.el ).find( '.for_queries .run' ).parent().removeClass( 'hide' );
}
if (typeof query.acl != "undefined" && _.indexOf(query.acl, "WRITE") > -1) {
$( this.el ).find( '.for_queries .delete' ).parent().removeClass( 'hide' );
$( this.el ).find( '.for_queries .edit' ).parent().removeClass( 'hide' );
}
if (typeof query.acl != "undefined" && _.indexOf(query.acl, "GRANT") > -1) {
$( this.el ).find( '.for_queries .edit_permissions' ).parent().removeClass( 'hide' );
}
try {
var query_path = path.split("/");
if (query_path.length > 1) {
var folder_path = query_path.splice(0,query_path.length - 1).join("/");
var folder = this.queries[folder_path];
if (typeof folder.acl != "undefined" && _.indexOf(folder.acl, "WRITE") > -1) {
$( this.el ).find( '.add_folder' ).parent().removeClass( 'hide' );
}
} else if (query_path.length == 1) {
$( this.el ).find( '.add_folder' ).parent().removeClass( 'hide' );
}
} catch(e) {
//console.log(e);
}
var $results = $(this.el).find('.workspace_results')
.html('<h3><strong>' + query.name + '</strong></h3>');
var $properties = $('<ul id="query_info" />').appendTo($results);
// Iterate through properties and show a key=>value set in the information pane
for (var property in query) {
if (query.hasOwnProperty(property) && property != "name") {
$properties.append($('<li />').html("<strong>" +
property + "</strong> : " + query[property]));
}
}
this.selected_query = new SavedQuery({ file: path, name: name, type: query.type });
return false;
},
view_folder: function( event ) {
var $target = $( event.currentTarget ).children('div').children('a');
var path = $target.attr('href').replace('#', '');
var name = $target.text();
var folder = this.queries[path];
$( this.el ).find( '.workspace_toolbar' ).removeClass( 'hide' );
$( this.el ).find( '.add_folder' ).parent().addClass( 'hide' );
$( this.el ).find( '.for_queries' ).addClass( 'hide' );
$( this.el ).find( '.for_folder' ).addClass( 'hide' );
if (typeof folder.acl != "undefined" && _.indexOf(folder.acl, "WRITE") > -1) {
$( this.el ).find( '.for_folder .delete' ).parent().removeClass( 'hide' );
$( this.el ).find( '.add_folder' ).parent().removeClass( 'hide' );
}
if (typeof folder.acl != "undefined" && _.indexOf(folder.acl, "GRANT") > -1) {
$( this.el ).find( '.for_folder .edit_permissions' ).parent().removeClass( 'hide' );
}
$( this.el ).find( '.workspace_results' )
.html( '<h3><strong>' + name + '</strong></h3>' );
this.selected_query = new SavedQuery({ file: path , name: name, type: folder.type });
},
prevent_default: function(event) {
event.preventDefault();
return false;
},
add_folder: function( event ) {
$selected = $(this.el).find('.selected');
var path ="";
if (typeof $selected !== "undefined" && $selected) {
if ($selected.hasClass('folder_row')) {
path = $selected.children('a').attr('href');
path = path.length > 1 ? path.substring(1,path.length) : path;
path+= "/";
} else if ($selected.hasClass('query') && !$selected.parent().hasClass('RepositoryObjects')) {
var query = $selected.find('a');
path = query.attr('href');
var queryname = query.text();
path = path.substring(1, path.length - queryname.length );
}
}
(new AddFolderModal({
path: path,
success: this.clear_query
})).render().open();
return false;
},
click_canvas: function(event) {
var $target = $( event.currentTarget );
if ($target.hasClass('sidebar')) {
$(this.el).find('.selected').removeClass('selected');
}
$( this.el ).find( '.add_folder' ).parent().removeClass( 'hide' );
return false;
},
toggle_folder: function( event ) {
var $target = $( event.currentTarget );
var path = $target.children('.folder_row').find('a').attr('href');
path = path.replace('#', '');
this.unselect_current_selected( );
$target.children('.folder_row').addClass( 'selected' );
var $queries = $target.children( '.folder_content' );
var isClosed = $target.children( '.folder_row' ).find('.sprite').hasClass( 'collapsed' );
if( isClosed ) {
$target.children( '.folder_row' ).find('.sprite').removeClass( 'collapsed' );
$queries.removeClass( 'hide' );
if (Settings.REPOSITORY_LAZY) {
this.fetch_lazyload($target, path);
}
} else {
$target.children( '.folder_row' ).find('.sprite').addClass( 'collapsed' );
$queries.addClass( 'hide' );
if (Settings.REPOSITORY_LAZY) {
$target.find('.folder_content').remove();
}
}
this.view_folder( event );
return false;
},
fetch_lazyload: function(target, path) {
var repositoryLazyLoad = new RepositoryLazyLoad({}, { dialog: this, folder: target, path: path });
repositoryLazyLoad.fetch();
Saiku.ui.block('Loading...');
},
template_repository_folder_lazyload: function(folder, repository) {
folder.find('.folder_content').remove();
folder.append(
_.template($('#template-repository-folder-lazyload').html())({
repoObjects: repository
})
);
},
populate_lazyload: function(folder, repository) {
Saiku.ui.unblock();
this.template_repository_folder_lazyload(folder, repository);
},
select_and_open_query: function(event) {
var $target = $(event.currentTarget).find('a');
var path = $target.attr('href').replace('#', '');
var name = $target.text();
this.selected_query = new SavedQuery({ file: path, name: path });
this.open_query();
},
open_query: function(viewstate) {
Saiku.ui.block("Opening query...");
var item = this.queries[this.selected_query.get('file')];
var params = _.extend({
file: this.selected_query.get('file'),
formatter: Settings.CELLSET_FORMATTER
}, Settings.PARAMS);
var query = new Query(params,{ name: this.selected_query.get('name') });
var state = null;
if(viewstate && !viewstate.hasOwnProperty('currentTarget')) {
state = viewstate;
}
if (item.fileType === 'saiku') {
var tab = Saiku.tabs.add(new Workspace({ query: query, item: item, viewState: state }));
}
else {
Saiku.session.trigger('openQuery:open_query', { query: query, item: item, viewState: state });
}
return false;
},
open_contents: function(viewstate) {
var files = [];
var itemF = this.queries[this.selected_query.get('file')];
_.forEach( itemF.repoObjects, function( entry){
if(entry.type === "FILE"){
files.push(entry);
}
});
var obj = {files: files, viewstate: viewstate};
(new WarningModal({
title: "Open Multiple Queries", message: "You are about to open "+files.length+" queries",
okay: this.run_open_contents, okayobj: obj
})).render().open();
return false;
},
run_open_contents: function(fileargs){
_.forEach( fileargs.files, function( entry ) {
Saiku.ui.block("Opening query...");
var item = entry;
var params = _.extend({
file: item.path,
formatter: Settings.CELLSET_FORMATTER
}, Settings.PARAMS);
var query = new Query(params,{ name: item.name });
var state = null;
if(fileargs.viewstate && !fileargs.viewstate.hasOwnProperty('currentTarget')) {
state = viewstate;
}
var tab = Saiku.tabs.add(new Workspace({ query: query, item: item, viewState: state }));
});
},
edit_query: function() {
this.open_query('edit');
},
delete_repoObject: function(event) {
(new DeleteRepositoryObject({
query: this.selected_query,
success: this.clear_query
})).render().open();
return false;
},
move_repoObject: function(event) {
(new MoveRepositoryObject({
query: this.selected_query,
success: this.clear_query
})).render().open();
return false;
},
edit_folder: function( event ) {
alert( 'todo: edit folder properties/permissions' );
return false;
},
edit_permissions: function(event) {
(new PermissionsModal({
workspace: this.workspace,
title: "<span class='i18n'>Permissions</span>",
file: this.selected_query.get('file')
})).open();
},
clear_query: function() {
$(this.el).find('.workspace_toolbar').addClass('hide');
$(this.el).find('.workspace_results').html('');
this.fetch_queries();
},
adjust: function() {
// Adjust the height of the separator
$separator = $(this.el).find('.sidebar_separator');
$separator.height($("body").height() - 87);
$(this.el).find('.sidebar').css( { 'width' : 300,
'height' : $("body").height() - 87 });
$(this.el).find('.workspace_inner').css({ 'margin-left' : 305});
$(this.el).find('.workspace').css({ 'margin-left' : -305});
// Adjust the dimensions of the results window
$(this.el).find('.workspace_results').css({
width: $(document).width() - $(this.el).find('.sidebar').width() - 30,
height: $(document).height() - $("#header").height() -
$(this.el).find('.workspace_toolbar').height() -
$(this.el).find('.workspace_fields').height() - 40
});
//$(this.el).find('.canvas_wrapper').show();
},
toggle_sidebar: function() {
// Toggle sidebar
$(this.el).find('.sidebar').toggleClass('hide');
var new_margin = $(this.el).find('.sidebar').hasClass('hide') ?
5 : 265;
$(this.el).find('.workspace_inner').css({ 'margin-left': new_margin });
},
unselect_current_selected: function( ) {
$( this.el ).find( '.selected' ).removeClass( 'selected' );
}
});
| {
"pile_set_name": "Github"
} |
/*=============================================================================
Copyright (c) 2009 Christopher Schmidt
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 BOOST_FUSION_CONTAINER_SET_DETAIL_VALUE_OF_DATA_IMPL_HPP
#define BOOST_FUSION_CONTAINER_SET_DETAIL_VALUE_OF_DATA_IMPL_HPP
#include <boost/fusion/support/config.hpp>
#include <boost/fusion/container/set/detail/value_of_data_impl.hpp>
namespace boost { namespace fusion { namespace extension
{
template <typename>
struct value_of_data_impl;
template <>
struct value_of_data_impl<set_iterator_tag>
: value_of_impl<set_iterator_tag>
{};
}}}
#endif
| {
"pile_set_name": "Github"
} |
NOTE:
We do not provide any help for using the code in a way different from what's described in the README.
If you like to do something different, please understand the code and do it yourself.
If you're using the code in the way described in the README and you meet an
unexpected problem, please include:
### 1. What you did (the commands you run):
### 2. What you observed:
(1) **Include the ENTIRE logs here:**
(2) **Other observations, if any:**
### 3. What you expected, if not obvious.
| {
"pile_set_name": "Github"
} |
'use strict';
/**
* Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/controllers.html#core-controllers)
* to customize this controller
*/
module.exports = {};
| {
"pile_set_name": "Github"
} |
# Event 165 - ScenarioLifecycle
###### Version: 0
## Description
None
## Data Dictionary
|Standard Name|Field Name|Type|Description|Sample Value|
|---|---|---|---|---|
|TBD|ScenarioId|GUID|None|`None`|
|TBD|InstanceId|GUID|None|`None`|
|TBD|OriginalActivityId|GUID|None|`None`|
|TBD|StatusCode|UInt32|None|`None`|
|TBD|DiagnosticModuleImageName|UnicodeString|None|`None`|
|TBD|DiagnosticModuleId|GUID|None|`None`|
## Tags
* etw_level_Warning
* etw_keywords_lifecycle
* etw_opcode_Thiseventisraisedwhenascenariofails
* etw_task_ScenarioLifecycle | {
"pile_set_name": "Github"
} |
# Check whether boolean options are consistently normalized to ON/OFF.
RUN: llvm-config --assertion-mode 2>&1 | FileCheck --check-prefix=CHECK-ONOFF %s
RUN: llvm-config --has-global-isel 2>&1 | FileCheck --check-prefix=CHECK-ONOFF %s
CHECK-ONOFF: {{ON|OFF}}
CHECK-ONOFF-NOT: error:
CHECK-ONOFF-NOT: warning
# ...or to YES/NO.
RUN: llvm-config --has-rtti 2>&1 | FileCheck --check-prefix=CHECK-YESNO %s
CHECK-YESNO: {{YES|NO}}
CHECK-YESNO-NOT: error:
CHECK-YESNO-NOT: warning
# Also check some other multi-choice options.
RUN: llvm-config --build-mode 2>&1 | FileCheck --check-prefix=CHECK-BUILD-MODE %s
CHECK-BUILD-MODE: {{[Dd][Ee][Bb][Uu][Gg]|[Rr][Ee][Ll][Ee][Aa][Ss][Ee]|[Rr][Ee][Ll][Ww][Ii][Tt][Hh][Dd][Ee][Bb][Ii][Nn][Ff][Oo]|[Mm][Ii][Nn][Ss][Ii][Zz][Ee][Rr][Ee][Ll]}}
CHECK-BUILD-MODE-NOT: error:
CHECK-BUILD-MODE-NOT: warning
RUN: llvm-config --build-system 2>&1 | FileCheck --check-prefix=CHECK-BUILD-SYSTEM %s
CHECK-BUILD-SYSTEM: {{cmake|gn}}
CHECK-BUILD-SYSTEM-NOT: error:
CHECK-BUILD-SYSTEM-NOT: warning
RUN: llvm-config --shared-mode 2>&1 | FileCheck --check-prefix=CHECK-SHARED-MODE %s
CHECK-SHARED-MODE: {{static|shared}}
CHECK-SHARED-MODE-NOT: error:
CHECK-SHARED-MODE-NOT: warning
| {
"pile_set_name": "Github"
} |
9
| {
"pile_set_name": "Github"
} |
/*************************************************************
*
* MathJax/jax/output/SVG/fonts/Latin-Modern/Size5/Regular/Main.js
*
* Copyright (c) 2013-2017 The MathJax Consortium
*
* 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.
*/
MathJax.OutputJax['SVG'].FONTDATA.FONTS['LatinModernMathJax_Size5'] = {
directory: 'Size5/Regular',
family: 'LatinModernMathJax_Size5',
id: 'LATINMODERNSIZE5',
0x20: [0,0,332,0,0,''],
0x28: [1296,796,663,201,608,'608 -780c0 -9 -7 -16 -16 -16c-4 0 -7 1 -10 3c-199 150 -381 545 -381 893v300c0 348 182 743 381 893c3 2 6 3 10 3c9 0 16 -7 16 -16c0 -5 -3 -10 -6 -13c-190 -142 -323 -535 -323 -867v-300c0 -332 133 -725 323 -867c3 -3 6 -8 6 -13'],
0x29: [1296,796,663,55,462,'462 100c0 -348 -182 -743 -382 -893c-2 -2 -6 -3 -9 -3c-9 0 -16 7 -16 16c0 5 2 10 6 13c190 142 323 535 323 867v300c0 332 -133 725 -323 867c-4 3 -6 8 -6 13c0 9 7 16 16 16c3 0 7 -1 9 -3c200 -150 382 -545 382 -893v-300'],
0x2F: [2179,1679,1557,57,1502,'1502 2146c0 -3 -1 -7 -2 -11l-1380 -3793c-5 -12 -17 -21 -31 -21c-18 0 -32 15 -32 33c0 3 0 7 1 11l1380 3793c5 12 17 21 31 21c18 0 33 -15 33 -33'],
0x5B: [1300,800,499,230,478,'478 -773c0 -15 -12 -27 -27 -27h-221v2100h221c15 0 27 -12 27 -27s-12 -27 -27 -27h-167v-1992h167c15 0 27 -12 27 -27'],
0x5C: [2179,1679,1557,56,1501,'1501 -1646c0 -18 -15 -33 -33 -33c-14 0 -26 9 -31 21l-1380 3793c-1 4 -1 8 -1 11c0 18 14 33 32 33c14 0 26 -9 31 -21l1380 -3793c1 -4 2 -8 2 -11'],
0x5D: [1300,800,499,21,269,'269 -800h-221c-15 0 -27 12 -27 27s12 27 27 27h167v1992h-167c-15 0 -27 12 -27 27s12 27 27 27h221v-2100'],
0x7B: [1300,800,707,100,608,'608 -780c0 -11 -9 -20 -20 -20c-2 0 -3 0 -5 1c-145 37 -273 148 -273 261v526c0 99 -81 213 -195 243c-9 2 -15 10 -15 19s6 17 15 19c114 30 195 144 195 243v526c0 113 128 224 273 261c2 1 3 1 5 1c11 0 20 -9 20 -20c0 -9 -6 -17 -15 -19 c-114 -29 -195 -134 -195 -223v-526c0 -108 -96 -212 -215 -262c119 -50 215 -154 215 -262v-526c0 -89 81 -194 195 -223c9 -2 15 -10 15 -19'],
0x7C: [1501,1001,278,107,172,'172 -969c0 -18 -15 -32 -33 -32s-32 14 -32 32v2438c0 18 14 32 32 32s33 -14 33 -32v-2438'],
0x7D: [1300,800,707,99,607,'607 250c0 -9 -6 -17 -15 -19c-114 -30 -195 -144 -195 -243v-526c0 -113 -128 -224 -273 -261c-1 -1 -3 -1 -5 -1c-11 0 -20 9 -20 20c0 9 7 17 15 19c114 29 195 134 195 223v526c0 108 97 212 216 262c-119 50 -216 154 -216 262v526c0 89 -81 194 -195 223 c-8 2 -15 10 -15 19c0 11 9 20 20 20c2 0 4 0 5 -1c145 -37 273 -148 273 -261v-526c0 -99 81 -213 195 -243c9 -2 15 -10 15 -19'],
0xA0: [0,0,332,0,0,''],
0x302: [748,-570,1320,0,1320,'1320 598l-6 -28l-654 114l-654 -114l-6 28c219 56 439 106 660 150c221 -44 441 -94 660 -150'],
0x303: [766,-534,1335,0,1335,'1335 752c0 -4 -1 -7 -4 -10c-73 -76 -163 -136 -318 -160c-27 -4 -54 -6 -80 -6c-92 0 -183 22 -273 43c-84 21 -170 42 -256 42c-24 0 -48 -2 -72 -6c-143 -22 -240 -46 -308 -117c-2 -2 -6 -4 -10 -4c-8 0 -14 6 -14 14c0 4 1 7 4 10c73 76 163 136 318 160 c27 4 54 6 81 6c91 0 182 -22 272 -43c84 -21 170 -42 256 -42c24 0 48 2 72 6c143 22 240 46 308 117c3 2 6 4 10 4c8 0 14 -6 14 -14'],
0x306: [742,-575,1341,0,1341,'1341 734c-53 -159 -404 -159 -671 -159c-266 0 -617 0 -670 159l27 8c35 -104 392 -104 643 -104c252 0 609 0 644 104'],
0x30C: [742,-564,1320,0,1320,'1320 714c-219 -56 -439 -106 -660 -150c-221 44 -441 94 -660 150l6 28l654 -114l654 114'],
0x311: [760,-592,1341,0,1341,'1341 600l-27 -8c-35 104 -392 105 -644 105c-251 0 -608 -1 -643 -105l-27 8c53 159 404 160 670 160c267 0 618 -1 671 -160'],
0x32C: [-96,274,1320,0,1320,'1320 -123c-219 -57 -439 -107 -660 -151c-221 44 -441 94 -660 151l6 27l654 -114l654 114'],
0x32D: [-108,286,1320,0,1320,'1320 -258l-6 -28l-654 114l-654 -114l-6 28c219 56 439 106 660 150c221 -44 441 -94 660 -150'],
0x32E: [-96,264,1341,0,1341,'1341 -105c-53 -159 -404 -159 -671 -159c-266 0 -617 0 -670 159l27 9c35 -105 392 -105 643 -105c252 0 609 0 644 105'],
0x32F: [-118,286,1341,0,1341,'1341 -277l-27 -9c-35 105 -392 105 -644 105c-251 0 -608 0 -643 -105l-27 9c53 159 404 159 670 159c267 0 618 0 671 -159'],
0x330: [-118,350,1335,0,1335,'1335 -132c0 -4 -1 -7 -4 -10c-73 -76 -163 -136 -318 -160c-27 -4 -54 -6 -80 -6c-92 0 -183 22 -273 43c-84 21 -170 42 -256 42c-24 0 -48 -2 -72 -6c-143 -22 -240 -46 -308 -117c-2 -2 -6 -4 -10 -4c-8 0 -14 6 -14 14c0 4 1 7 4 10c73 76 163 136 318 160 c27 4 54 6 81 6c91 0 182 -22 272 -43c84 -21 170 -42 256 -42c24 0 48 2 72 6c143 22 240 46 308 117c3 2 6 4 10 4c8 0 14 -6 14 -14'],
0x2016: [1501,1001,396,57,341,'122 -969c0 -18 -15 -32 -33 -32s-32 14 -32 32v2438c0 18 14 32 32 32s33 -14 33 -32v-2438zM341 -969c0 -18 -15 -32 -33 -32s-32 14 -32 32v2438c0 18 14 32 32 32s33 -14 33 -32v-2438'],
0x2044: [2179,1679,1557,57,1502,'1502 2146c0 -3 -1 -7 -2 -11l-1380 -3793c-5 -12 -17 -21 -31 -21c-18 0 -32 15 -32 33c0 3 0 7 1 11l1380 3793c5 12 17 21 31 21c18 0 33 -15 33 -33'],
0x20E9: [757,-521,2235,0,2235,'2235 757v-209c0 -15 -12 -27 -27 -27s-27 12 -27 27v155h-2127v-155c0 -15 -12 -27 -27 -27s-27 12 -27 27v209h2235'],
0x2223: [1501,1001,278,107,172,'172 -969c0 -18 -15 -32 -33 -32s-32 14 -32 32v2438c0 18 14 32 32 32s33 -14 33 -32v-2438'],
0x2225: [1501,1001,396,57,341,'122 -969c0 -18 -15 -32 -33 -32s-32 14 -32 32v2438c0 18 14 32 32 32s33 -14 33 -32v-2438zM341 -969c0 -18 -15 -32 -33 -32s-32 14 -32 32v2438c0 18 14 32 32 32s33 -14 33 -32v-2438'],
0x2308: [1300,800,555,203,528,'528 1273c0 -15 -12 -27 -27 -27h-244v-2019c0 -15 -12 -27 -27 -27s-27 12 -27 27v2073h298c15 0 27 -12 27 -27'],
0x2309: [1300,800,555,27,352,'352 -773c0 -15 -12 -27 -27 -27s-27 12 -27 27v2019h-244c-15 0 -27 12 -27 27s12 27 27 27h298v-2073'],
0x230A: [1300,800,555,203,528,'528 -773c0 -15 -12 -27 -27 -27h-298v2073c0 15 12 27 27 27s27 -12 27 -27v-2019h244c15 0 27 -12 27 -27'],
0x230B: [1300,800,555,27,352,'352 1273v-2073h-298c-15 0 -27 12 -27 27s12 27 27 27h244v2019c0 15 12 27 27 27s27 -12 27 -27'],
0x2329: [1300,800,677,165,623,'623 -773c0 -15 -12 -27 -27 -27c-11 0 -21 7 -25 17l-404 1023c-1 3 -2 7 -2 10s1 7 2 10l404 1023c4 10 14 17 25 17c15 0 27 -12 27 -27c0 -3 -1 -7 -2 -10l-400 -1013l400 -1013c1 -3 2 -7 2 -10'],
0x232A: [1300,800,677,54,512,'512 250c0 -3 -1 -7 -2 -10l-404 -1023c-4 -10 -14 -17 -25 -17c-15 0 -27 12 -27 27c0 3 1 7 2 10l400 1013l-400 1013c-1 3 -2 7 -2 10c0 15 12 27 27 27c11 0 21 -7 25 -17l404 -1023c1 -3 2 -7 2 -10'],
0x23B4: [757,-521,2235,0,2235,'2235 757v-209c0 -15 -12 -27 -27 -27s-27 12 -27 27v155h-2127v-155c0 -15 -12 -27 -27 -27s-27 12 -27 27v209h2235'],
0x23B5: [-91,327,2235,0,2235,'2235 -327h-2235v209c0 15 12 27 27 27s27 -12 27 -27v-155h2127v155c0 15 12 27 27 27s27 -12 27 -27v-209'],
0x23DC: [780,-506,3020,0,3020,'3020 526c0 -11 -9 -20 -20 -20c-6 0 -11 2 -14 6c-117 116 -645 190 -1174 190h-604c-529 0 -1057 -74 -1174 -190c-3 -4 -8 -6 -14 -6c-11 0 -20 9 -20 20c0 5 2 10 6 14c120 120 657 240 1202 240h604c545 0 1082 -120 1202 -240c4 -4 6 -9 6 -14'],
0x23DD: [-76,350,3020,0,3020,'3020 -96c0 -5 -2 -10 -6 -14c-120 -120 -657 -240 -1202 -240h-604c-545 0 -1082 120 -1202 240c-4 4 -6 9 -6 14c0 11 9 20 20 20c6 0 11 -2 14 -6c117 -116 645 -190 1174 -190h604c529 0 1057 74 1174 190c3 4 8 6 14 6c11 0 20 -9 20 -20'],
0x23DE: [838,-500,3000,0,3000,'3000 510c0 -6 -4 -10 -10 -10c-4 0 -8 3 -9 7c-31 83 -215 123 -399 123h-674c-205 0 -367 78 -408 159c-41 -81 -203 -159 -408 -159h-674c-184 0 -368 -40 -399 -123c-1 -4 -5 -7 -9 -7c-6 0 -10 4 -10 10c0 1 0 2 1 3c33 93 214 195 417 195h674 c214 0 398 37 398 120c0 6 4 10 10 10s10 -4 10 -10c0 -83 184 -120 398 -120h674c203 0 384 -102 417 -195c1 -1 1 -2 1 -3'],
0x23DF: [-70,408,3000,0,3000,'3000 -80c0 -1 0 -2 -1 -3c-33 -93 -214 -195 -417 -195h-674c-214 0 -398 -37 -398 -120c0 -6 -4 -10 -10 -10s-10 4 -10 10c0 83 -184 120 -398 120h-674c-203 0 -384 102 -417 195c-1 1 -1 2 -1 3c0 6 4 10 10 10c4 0 8 -3 9 -7c31 -83 215 -123 399 -123h674 c205 0 367 -78 408 -159c41 81 203 159 408 159h674c184 0 368 40 399 123c1 4 5 7 9 7c6 0 10 -4 10 -10'],
0x23E0: [866,-607,3068,0,3068,'3068 607h-88l-171 171h-2550l-171 -171h-88l259 259h2550'],
0x23E1: [-177,436,3068,0,3068,'3068 -177l-259 -259h-2550l-259 259h88l171 -171h2550l171 171h88'],
0x27E6: [1300,800,750,247,727,'727 -773c0 -15 -12 -27 -27 -27h-453v2100h453c15 0 27 -12 27 -27s-12 -27 -27 -27h-172v-1992h172c15 0 27 -12 27 -27zM474 1246h-173v-1992h173v1992'],
0x27E7: [1300,800,750,23,503,'503 1300v-2100h-453c-15 0 -27 12 -27 27s12 27 27 27h172v1992h-172c-15 0 -27 12 -27 27s12 27 27 27h453zM449 -746v1992h-173v-1992h173'],
0x27E8: [1300,800,677,165,623,'623 -773c0 -15 -12 -27 -27 -27c-11 0 -21 7 -25 17l-404 1023c-1 3 -2 7 -2 10s1 7 2 10l404 1023c4 10 14 17 25 17c15 0 27 -12 27 -27c0 -3 -1 -7 -2 -10l-400 -1013l400 -1013c1 -3 2 -7 2 -10'],
0x27E9: [1300,800,677,54,512,'512 250c0 -3 -1 -7 -2 -10l-404 -1023c-4 -10 -14 -17 -25 -17c-15 0 -27 12 -27 27c0 3 1 7 2 10l400 1013l-400 1013c-1 3 -2 7 -2 10c0 15 12 27 27 27c11 0 21 -7 25 -17l404 -1023c1 -3 2 -7 2 -10'],
0x27EA: [1300,800,1011,165,957,'623 -773c0 -15 -12 -27 -27 -27c-11 0 -21 7 -25 17l-404 1023c-1 3 -2 7 -2 10s1 7 2 10l404 1023c4 10 14 17 25 17c15 0 27 -12 27 -27c0 -3 -1 -7 -2 -10l-400 -1013l400 -1013c1 -3 2 -7 2 -10zM957 -773c0 -15 -12 -27 -27 -27c-12 0 -21 7 -25 17l-404 1023 c-2 3 -2 7 -2 10s0 7 2 10l404 1023c4 10 13 17 25 17c15 0 27 -12 27 -27c0 -3 -1 -7 -2 -10l-400 -1013l400 -1013c1 -3 2 -7 2 -10'],
0x27EB: [1300,800,1011,54,846,'846 250c0 -3 -1 -7 -2 -10l-404 -1023c-4 -10 -14 -17 -25 -17c-15 0 -27 12 -27 27c0 3 0 7 2 10l400 1013l-400 1013c-2 3 -2 7 -2 10c0 15 12 27 27 27c11 0 21 -7 25 -17l404 -1023c1 -3 2 -7 2 -10zM512 250c0 -3 -1 -7 -2 -10l-404 -1023c-4 -10 -14 -17 -25 -17 c-15 0 -27 12 -27 27c0 3 1 7 2 10l400 1013l-400 1013c-1 3 -2 7 -2 10c0 15 12 27 27 27c11 0 21 -7 25 -17l404 -1023c1 -3 2 -7 2 -10'],
0x27EE: [1320,820,485,206,429,'429 -800c0 -11 -9 -20 -20 -20c-6 0 -11 2 -14 6c-93 93 -189 444 -189 789v550c0 345 96 696 189 789c3 4 8 6 14 6c11 0 20 -9 20 -20c0 -6 -2 -11 -6 -14c-88 -89 -139 -432 -139 -761v-550c0 -329 51 -672 139 -761c4 -3 6 -8 6 -14'],
0x27EF: [1320,820,485,56,279,'279 -25c0 -345 -96 -696 -189 -789c-3 -4 -8 -6 -14 -6c-11 0 -20 9 -20 20c0 6 2 11 6 14c88 89 139 432 139 761v550c0 329 -51 672 -139 761c-4 3 -6 8 -6 14c0 11 9 20 20 20c6 0 11 -2 14 -6c93 -93 189 -444 189 -789v-550']
};
MathJax.Ajax.loadComplete(MathJax.OutputJax.SVG.fontDir+"/Size5/Regular/Main.js");
| {
"pile_set_name": "Github"
} |
package main
import (
"bufio"
"os/exec"
"regexp"
"strings"
"time"
"github.com/docker/docker/integration-cli/checker"
"github.com/docker/docker/integration-cli/cli"
"github.com/go-check/check"
)
func (s *DockerSuite) TestStatsNoStream(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
id := strings.TrimSpace(out)
c.Assert(waitRun(id), checker.IsNil)
statsCmd := exec.Command(dockerBinary, "stats", "--no-stream", id)
type output struct {
out []byte
err error
}
ch := make(chan output)
go func() {
out, err := statsCmd.Output()
ch <- output{out, err}
}()
select {
case outerr := <-ch:
c.Assert(outerr.err, checker.IsNil, check.Commentf("Error running stats: %v", outerr.err))
c.Assert(string(outerr.out), checker.Contains, id[:12]) //running container wasn't present in output
case <-time.After(3 * time.Second):
statsCmd.Process.Kill()
c.Fatalf("stats did not return immediately when not streaming")
}
}
func (s *DockerSuite) TestStatsContainerNotFound(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
out, _, err := dockerCmdWithError("stats", "notfound")
c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, "No such container: notfound", check.Commentf("Expected to fail on not found container stats, got %q instead", out))
out, _, err = dockerCmdWithError("stats", "--no-stream", "notfound")
c.Assert(err, checker.NotNil)
c.Assert(out, checker.Contains, "No such container: notfound", check.Commentf("Expected to fail on not found container stats with --no-stream, got %q instead", out))
}
func (s *DockerSuite) TestStatsAllRunningNoStream(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
id1 := strings.TrimSpace(out)[:12]
c.Assert(waitRun(id1), check.IsNil)
out, _ = dockerCmd(c, "run", "-d", "busybox", "top")
id2 := strings.TrimSpace(out)[:12]
c.Assert(waitRun(id2), check.IsNil)
out, _ = dockerCmd(c, "run", "-d", "busybox", "top")
id3 := strings.TrimSpace(out)[:12]
c.Assert(waitRun(id3), check.IsNil)
dockerCmd(c, "stop", id3)
out, _ = dockerCmd(c, "stats", "--no-stream")
if !strings.Contains(out, id1) || !strings.Contains(out, id2) {
c.Fatalf("Expected stats output to contain both %s and %s, got %s", id1, id2, out)
}
if strings.Contains(out, id3) {
c.Fatalf("Did not expect %s in stats, got %s", id3, out)
}
// check output contains real data, but not all zeros
reg, _ := regexp.Compile("[1-9]+")
// split output with "\n", outLines[1] is id2's output
// outLines[2] is id1's output
outLines := strings.Split(out, "\n")
// check stat result of id2 contains real data
realData := reg.Find([]byte(outLines[1][12:]))
c.Assert(realData, checker.NotNil, check.Commentf("stat result are empty: %s", out))
// check stat result of id1 contains real data
realData = reg.Find([]byte(outLines[2][12:]))
c.Assert(realData, checker.NotNil, check.Commentf("stat result are empty: %s", out))
}
func (s *DockerSuite) TestStatsAllNoStream(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
out, _ := dockerCmd(c, "run", "-d", "busybox", "top")
id1 := strings.TrimSpace(out)[:12]
c.Assert(waitRun(id1), check.IsNil)
dockerCmd(c, "stop", id1)
out, _ = dockerCmd(c, "run", "-d", "busybox", "top")
id2 := strings.TrimSpace(out)[:12]
c.Assert(waitRun(id2), check.IsNil)
out, _ = dockerCmd(c, "stats", "--all", "--no-stream")
if !strings.Contains(out, id1) || !strings.Contains(out, id2) {
c.Fatalf("Expected stats output to contain both %s and %s, got %s", id1, id2, out)
}
// check output contains real data, but not all zeros
reg, _ := regexp.Compile("[1-9]+")
// split output with "\n", outLines[1] is id2's output
outLines := strings.Split(out, "\n")
// check stat result of id2 contains real data
realData := reg.Find([]byte(outLines[1][12:]))
c.Assert(realData, checker.NotNil, check.Commentf("stat result of %s is empty: %s", id2, out))
// check stat result of id1 contains all zero
realData = reg.Find([]byte(outLines[2][12:]))
c.Assert(realData, checker.IsNil, check.Commentf("stat result of %s should be empty : %s", id1, out))
}
func (s *DockerSuite) TestStatsAllNewContainersAdded(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
id := make(chan string)
addedChan := make(chan struct{})
runSleepingContainer(c, "-d")
statsCmd := exec.Command(dockerBinary, "stats")
stdout, err := statsCmd.StdoutPipe()
c.Assert(err, check.IsNil)
c.Assert(statsCmd.Start(), check.IsNil)
go statsCmd.Wait()
defer statsCmd.Process.Kill()
go func() {
containerID := <-id
matchID := regexp.MustCompile(containerID)
scanner := bufio.NewScanner(stdout)
for scanner.Scan() {
switch {
case matchID.MatchString(scanner.Text()):
close(addedChan)
return
}
}
}()
out := runSleepingContainer(c, "-d")
c.Assert(waitRun(strings.TrimSpace(out)), check.IsNil)
id <- strings.TrimSpace(out)[:12]
select {
case <-time.After(30 * time.Second):
c.Fatal("failed to observe new container created added to stats")
case <-addedChan:
// ignore, done
}
}
func (s *DockerSuite) TestStatsFormatAll(c *check.C) {
// Windows does not support stats
testRequires(c, DaemonIsLinux)
cli.DockerCmd(c, "run", "-d", "--name=RunningOne", "busybox", "top")
cli.WaitRun(c, "RunningOne")
cli.DockerCmd(c, "run", "-d", "--name=ExitedOne", "busybox", "top")
cli.DockerCmd(c, "stop", "ExitedOne")
cli.WaitExited(c, "ExitedOne", 5*time.Second)
out := cli.DockerCmd(c, "stats", "--no-stream", "--format", "{{.Name}}").Combined()
c.Assert(out, checker.Contains, "RunningOne")
c.Assert(out, checker.Not(checker.Contains), "ExitedOne")
out = cli.DockerCmd(c, "stats", "--all", "--no-stream", "--format", "{{.Name}}").Combined()
c.Assert(out, checker.Contains, "RunningOne")
c.Assert(out, checker.Contains, "ExitedOne")
}
| {
"pile_set_name": "Github"
} |
/*
LUFA Library
Copyright (C) Dean Camera, 2014.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaims all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
#include "../../../../Common/Common.h"
#if (ARCH == ARCH_AVR8)
#define __INCLUDE_FROM_USB_DRIVER
#include "../USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "PipeStream_AVR8.h"
uint8_t Pipe_Discard_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t ErrorCode;
uint16_t BytesInTransfer = 0;
Pipe_SetPipeToken(PIPE_TOKEN_IN);
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
Length -= *BytesProcessed;
while (Length)
{
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearIN();
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return PIPE_RWSTREAM_IncompleteTransfer;
}
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
}
else
{
Pipe_Discard_8();
Length--;
BytesInTransfer++;
}
}
return PIPE_RWSTREAM_NoError;
}
uint8_t Pipe_Null_Stream(uint16_t Length,
uint16_t* const BytesProcessed)
{
uint8_t ErrorCode;
uint16_t BytesInTransfer = 0;
Pipe_SetPipeToken(PIPE_TOKEN_OUT);
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
if (BytesProcessed != NULL)
Length -= *BytesProcessed;
while (Length)
{
if (!(Pipe_IsReadWriteAllowed()))
{
Pipe_ClearOUT();
if (BytesProcessed != NULL)
{
*BytesProcessed += BytesInTransfer;
return PIPE_RWSTREAM_IncompleteTransfer;
}
USB_USBTask();
if ((ErrorCode = Pipe_WaitUntilReady()))
return ErrorCode;
}
else
{
Pipe_Write_8(0);
Length--;
BytesInTransfer++;
}
}
return PIPE_RWSTREAM_NoError;
}
/* The following abuses the C preprocessor in order to copy-paste common code with slight alterations,
* so that the code needs to be written once. It is a crude form of templating to reduce code maintenance. */
#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr)
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_Stream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(*BufferPtr)
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_LE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8()
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_Stream_BE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) *BufferPtr = Pipe_Read_8()
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_PStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(pgm_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_LE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Write_EStream_BE
#define TEMPLATE_BUFFER_TYPE const void*
#define TEMPLATE_TOKEN PIPE_TOKEN_OUT
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearOUT()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) Pipe_Write_8(eeprom_read_byte(BufferPtr))
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_LE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) 0
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream += Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8())
#include "Template/Template_Pipe_RW.c"
#define TEMPLATE_FUNC_NAME Pipe_Read_EStream_BE
#define TEMPLATE_BUFFER_TYPE void*
#define TEMPLATE_TOKEN PIPE_TOKEN_IN
#define TEMPLATE_CLEAR_PIPE() Pipe_ClearIN()
#define TEMPLATE_BUFFER_OFFSET(Length) (Length - 1)
#define TEMPLATE_BUFFER_MOVE(BufferPtr, Amount) DataStream -= Amount
#define TEMPLATE_TRANSFER_BYTE(BufferPtr) eeprom_update_byte(BufferPtr, Pipe_Read_8())
#include "Template/Template_Pipe_RW.c"
#endif
#endif
| {
"pile_set_name": "Github"
} |
from os import path
from datetime import datetime
import json
import re
DIR = path.dirname(path.realpath(__file__))
ARG_FORMAT = "{} = '{}'"
FIX_GLOBAL_VARS = {
'i_args': 'i_args',
'i_volume_size': 'i_volume_size',
'i_color_index': 'i_color_index',
'iMirror': 'i_mirror',
'i_axis': 'i_axis',
'iIter': 'i_iter',
}
with open(path.join(DIR, 'shaders.json')) as f:
data = json.load(f)
params = { k: v['params'] for k, v in data['shaders'].items() }
TYPES = data['types']
for shader_name in params.keys():
header = [
'MIT License (MIT)',
'https://github.com/lachlanmcdonald/magicavoxel-shaders',
'Copyright (c) {} Lachlan McDonald'.format(datetime.now().year).strip(),
'',
]
param_strings = ' '.join([ '[{}]'.format(x['name']) for x in params[shader_name] ])
header.append('xs {} {}'.format(shader_name, param_strings))
if len(params[shader_name]) > 0:
header.append('')
header.append('xs_begin')
header.append('author : \'@lachlanmcdonald\'')
for index, param in enumerate(params[shader_name]):
shader_lines = [
ARG_FORMAT.format('id', index),
ARG_FORMAT.format('name', param['name'])
]
for k in ['value', 'range', 'step', 'decimal']:
if k in param:
shader_lines.append(ARG_FORMAT.format(k, param[k]))
elif k in TYPES[param['type']]:
shader_lines.append(ARG_FORMAT.format(k, TYPES[param['type']][k]))
header.append('arg : {{ {} }}'.format(' '.join(shader_lines)))
header.append('xs_end')
header_text = '\n'.join([ '// {}'.format(x) for x in header ])
shader_path = shader_name.replace('/', path.sep)
with open(path.join(DIR, 'shader', "{}.txt".format(shader_path)), 'r') as f:
shader = f.readlines()
with open(path.join(DIR, 'shader', "{}.txt".format(shader_path)), 'w', newline="\n") as f:
has_comment = shader[0].startswith('//')
shader_lines = []
for line in shader:
if has_comment and line.startswith('//'):
continue
else:
has_comment = False
shader_lines.append(line.rstrip())
shader_text = header_text + '\n' + '\n'.join(shader_lines)
shader_text = '\n'.join([line.rstrip() for line in shader_text.splitlines()])
for old, new in FIX_GLOBAL_VARS.items():
shader_text = shader_text.replace(old, new)
f.write(shader_text + '\n')
| {
"pile_set_name": "Github"
} |
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace UnrealEngine.Runtime
{
public interface IYieldInstructionPool
{
void ReturnObject(YieldInstruction obj);
}
public abstract class YieldInstructionPool<T> : IYieldInstructionPool where T : YieldInstruction
{
private Stack<T> available = new Stack<T>();
private uint nextObjectId = 1;
public void ReturnObject(YieldInstruction obj)
{
obj.keepAlive = false;
if (obj.pool != this)
{
throw new InvalidOperationException("Pooled YieldInstruction was returned to the wrong pool");
}
available.Push((T)obj);
}
public T GetObject()
{
if (available.Count != 0)
{
return available.Pop();
}
else
{
T obj = New();
obj.poolId = nextObjectId++;
obj.pool = this;
return obj;
}
}
protected abstract T New();
}
}
| {
"pile_set_name": "Github"
} |
// See www.openfst.org for extensive documentation on this weighted
// finite-state transducer library.
//
// Two FSTS are isomorphic (equal up to state and arc re-ordering) iff their
// exit status is zero. FSTs should be deterministic when viewed as unweighted
// automata.
#include <cstring>
#include <memory>
#include <string>
#include <fst/flags.h>
#include <fst/log.h>
#include <fst/script/isomorphic.h>
DECLARE_double(delta);
int fstisomorphic_main(int argc, char **argv) {
namespace s = fst::script;
using fst::script::FstClass;
string usage =
"Two FSTs are isomorphic iff the exit status is zero.\n\n Usage: ";
usage += argv[0];
usage += " in1.fst in2.fst\n";
std::set_new_handler(FailedNewHandler);
SET_FLAGS(usage.c_str(), &argc, &argv, true);
if (argc != 3) {
ShowUsage();
return 1;
}
const string in1_name = strcmp(argv[1], "-") == 0 ? "" : argv[1];
const string in2_name = strcmp(argv[2], "-") == 0 ? "" : argv[2];
if (in1_name.empty() && in2_name.empty()) {
LOG(ERROR) << argv[0] << ": Can't take both inputs from standard input";
return 1;
}
std::unique_ptr<FstClass> ifst1(FstClass::Read(in1_name));
if (!ifst1) return 1;
std::unique_ptr<FstClass> ifst2(FstClass::Read(in2_name));
if (!ifst2) return 1;
bool result = s::Isomorphic(*ifst1, *ifst2, FLAGS_delta);
if (!result) VLOG(1) << "FSTs are not isomorphic";
return result ? 0 : 2;
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright Camunda Services GmbH and/or licensed to Camunda Services GmbH
* under one or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. Camunda licenses this file to you under the Apache License,
* Version 2.0; 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.camunda.bpm.integrationtest.functional.classloading.variables.beans;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.junit.Assert;
public class GetDeserializableVariableDelegate implements JavaDelegate{
@Override
public void execute(DelegateExecution execution) throws Exception {
SerializableVariable variable = (SerializableVariable) execution.getVariable("var1");
}
}
| {
"pile_set_name": "Github"
} |
/**
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
* the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
* graphic logo is a trademark of OpenMRS Inc.
*/
package org.openmrs.mobile.activities.formdisplay;
import android.os.Bundle;
import android.util.SparseArray;
import androidx.fragment.app.Fragment;
import org.joda.time.LocalDateTime;
import org.openmrs.mobile.activities.BasePresenter;
import org.openmrs.mobile.api.EncounterService;
import org.openmrs.mobile.api.repository.VisitRepository;
import org.openmrs.mobile.dao.PatientDAO;
import org.openmrs.mobile.listeners.retrofitcallbacks.DefaultResponseCallback;
import org.openmrs.mobile.models.Encountercreate;
import org.openmrs.mobile.models.Obscreate;
import org.openmrs.mobile.models.Patient;
import org.openmrs.mobile.utilities.ApplicationConstants;
import org.openmrs.mobile.utilities.InputField;
import org.openmrs.mobile.utilities.SelectOneField;
import java.util.ArrayList;
import java.util.List;
import static org.openmrs.mobile.utilities.FormService.getFormResourceByName;
public class FormDisplayMainPresenter extends BasePresenter implements FormDisplayContract.Presenter.MainPresenter {
private final long mPatientID;
private final String mEncountertype;
private final String mFormname;
private FormDisplayContract.View.MainView mFormDisplayView;
private Patient mPatient;
private FormPageAdapter mPageAdapter;
private VisitRepository visitRepository;
public FormDisplayMainPresenter(FormDisplayContract.View.MainView mFormDisplayView, Bundle bundle, FormPageAdapter mPageAdapter) {
this.mFormDisplayView = mFormDisplayView;
this.mPatientID = (long) bundle.get(ApplicationConstants.BundleKeys.PATIENT_ID_BUNDLE);
this.mPatient = new PatientDAO().findPatientByID(Long.toString(mPatientID));
this.mEncountertype = (String) bundle.get(ApplicationConstants.BundleKeys.ENCOUNTERTYPE);
this.mFormname = (String) bundle.get(ApplicationConstants.BundleKeys.FORM_NAME);
this.mPageAdapter = mPageAdapter;
mFormDisplayView.setPresenter(this);
visitRepository = new VisitRepository();
}
@Override
public void subscribe() {
// This method is intentionally empty
}
@Override
public void createEncounter() {
List<InputField> inputFields = new ArrayList<>();
List<SelectOneField> radioGroupFields = new ArrayList<>();
mFormDisplayView.enableSubmitButton(false);
Encountercreate encountercreate = new Encountercreate();
encountercreate.setPatient(mPatient.getUuid());
encountercreate.setEncounterType(mEncountertype);
List<Obscreate> observations = new ArrayList<>();
SparseArray<Fragment> activefrag = mPageAdapter.getRegisteredFragments();
boolean valid = true;
for (int i = 0; i < activefrag.size(); i++) {
FormDisplayPageFragment formPageFragment = (FormDisplayPageFragment) activefrag.get(i);
if (!formPageFragment.checkInputFields()) {
valid = false;
break;
}
inputFields.addAll(formPageFragment.getInputFields());
radioGroupFields.addAll(formPageFragment.getSelectOneFields());
}
if (valid) {
for (InputField input : inputFields) {
if (input.value != -1.0) {
Obscreate obscreate = new Obscreate();
obscreate.setConcept(input.concept);
obscreate.setValue(String.valueOf(input.value));
LocalDateTime localDateTime = new LocalDateTime();
obscreate.setObsDatetime(localDateTime.toString());
obscreate.setPerson(mPatient.getUuid());
observations.add(obscreate);
}
}
for (SelectOneField radioGroupField : radioGroupFields) {
if (radioGroupField.getChosenAnswer() != null) {
Obscreate obscreate = new Obscreate();
obscreate.setConcept(radioGroupField.getConcept());
obscreate.setValue(radioGroupField.getChosenAnswer().getConcept());
LocalDateTime localDateTime = new LocalDateTime();
obscreate.setObsDatetime(localDateTime.toString());
obscreate.setPerson(mPatient.getUuid());
observations.add(obscreate);
}
}
encountercreate.setObservations(observations);
encountercreate.setFormname(mFormname);
encountercreate.setPatientId(mPatientID);
encountercreate.setFormUuid(getFormResourceByName(mFormname).getUuid());
encountercreate.setId(visitRepository.addEncounterCreated(encountercreate));
if (!mPatient.isSynced()) {
mPatient.addEncounters(encountercreate.getId());
new PatientDAO().updatePatient(mPatient.getId(), mPatient);
mFormDisplayView.showToast();
mFormDisplayView.enableSubmitButton(true);
} else {
new EncounterService().addEncounter(encountercreate, new DefaultResponseCallback() {
@Override
public void onResponse() {
mFormDisplayView.showSuccessfulToast();
mFormDisplayView.enableSubmitButton(true);
}
@Override
public void onErrorResponse(String errorMessage) {
mFormDisplayView.showToast(errorMessage);
mFormDisplayView.enableSubmitButton(true);
}
});
mFormDisplayView.quitFormEntry();
}
} else {
mFormDisplayView.enableSubmitButton(true);
}
}
}
| {
"pile_set_name": "Github"
} |
/**
* \file desfireev1commands.hpp
* \author Maxime C. <maxime-dev@islog.com>
* \brief DESFire EV1 commands.
*/
#ifndef LOGICALACCESS_DESFIREEV1COMMANDS_HPP
#define LOGICALACCESS_DESFIREEV1COMMANDS_HPP
#include <logicalaccess/plugins/cards/desfire/desfirecommands.hpp>
#include <logicalaccess/plugins/cards/desfire/desfireev1location.hpp>
#include <logicalaccess/plugins/cards/iso7816/iso7816commands.hpp>
namespace logicalaccess
{
#ifndef DFEV1_INS
#define DFEV1_INS
#define DFEV1_DESFIRE_AID "\xd2\x76\x00\x00\x85\x01\x00"
#define DFEV1_INS_FREE_MEM 0x6E
#define DFEV1_INS_GET_DF_NAMES 0x6D
#define DFEV1_INS_GET_CARD_UID 0x51
#define DFEV1_INS_GET_ISO_FILE_IDS 0x61
#define DFEV1_INS_SET_CONFIGURATION 0x5C
#define DFEV1_INS_AUTHENTICATE_ISO 0x1A
#define DFEV1_INS_AUTHENTICATE_AES 0xAA
#define SELECT_FILE_BY_AID 0x04
#define SELECT_FILE_BY_FID 0x00
#endif
#define CMD_DESFIRE_EV1 "DESFireEV1"
/**
* \brief The ISO DFName and FID
*/
struct DFName
{
unsigned int AID;
unsigned short FID;
char DF_Name[64];
};
/**
* \brief The FID Support for ISO 7816.
*/
typedef enum { FIDS_NO_ISO_FID = 0x00, FIDS_ISO_FID = 0x20 } FidSupport;
/**
* \brief The DESFire EV1 transmission mode.
*/
typedef enum {
DFEV1_CMD_PLAIN = 0x00,
DFEV1_CMD_NOMACV = 0x01,
DFEV1_CMD_MACV = 0x02
} DESFireEV1TransmissionMode;
/**
* \brief The DESFire EV1 algorithm.
*/
typedef enum {
DF_ALG_BY_CONTEXT = 0x00,
DF_ALG_2K3DES = 0x02,
DF_ALG_3K3DES = 0x04,
DF_ALG_AES = 0x09
} DESFireISOAlgorithm;
class DESFireEV1Chip;
/**
* \brief The DESFire EV1 base commands class.
*/
class LLA_CARDS_DESFIRE_API DESFireEV1Commands : public ICommands
{
public:
DESFireEV1Commands() = default;
/**
* \brief Select an application.
* \param location The DESFire location
*/
virtual void selectApplication(std::shared_ptr<DESFireEV1Location> location);
/**
* \brief Create a new application.
* \param location The DESFire location
* \param settings Key settings
* \param maxNbKeys Maximum number of keys
*/
virtual void createApplication(std::shared_ptr<DESFireEV1Location> location,
DESFireKeySettings settings, unsigned char maxNbKeys);
/**
* \brief Create a new data file in the current application.
* \param location The DESFire location
* \param accessRights The file access rights
* \param fileSize The file size.
*/
virtual void createStdDataFile(std::shared_ptr<DESFireEV1Location> location,
const DESFireAccessRights &accessRights,
unsigned int fileSize);
/**
* \brief Get the value of available bytes.
* \return The available memory in bytes.
*/
virtual unsigned int getFreeMem() = 0;
/**
* \brief Get the ISO DF-Names of all active application.
* \return The DF-Names list.
*/
virtual std::vector<DFName> getDFNames() = 0;
/**
* \brief Get the ISO FID of all active files within the currently selected
* application.
* \return The ISO FID list.
*/
virtual std::vector<unsigned short> getISOFileIDs() = 0;
/**
* \brief Select an application.
* \param aid The Application ID
*/
virtual void selectApplication(unsigned int aid) = 0;
/**
* \brief Create a new application.
* \param aid The Application ID to create
* \param settings Key settings
* \param maxNbKeys Maximum number of keys
*/
virtual void createApplication(unsigned int aid, DESFireKeySettings settings,
unsigned char maxNbKeys, DESFireKeyType cryptoMethod,
FidSupport fidSupported = FIDS_NO_ISO_FID,
unsigned short isoFID = 0x00,
ByteVector isoDFName = ByteVector()) = 0;
/**
* \brief Get key settings on the current application.
* \param settings Key settings
* \param maxNbKeys Maximum number of keys
* \param keyType The key type
*/
virtual void getKeySettings(DESFireKeySettings &settings, unsigned char &maxNbKeys,
DESFireKeyType &keyType) = 0;
/**
* \brief Get a random card UID.
* \return The card UID.
*/
virtual ByteVector getCardUID() = 0;
/**
* \brief Create a new data file in the current application.
* \param fileno The new file number
* \param comSettings The file communication setting
* \param accessRights The file access rights
* \param fileSize The file size (in bytes).
*/
virtual void createStdDataFile(unsigned char fileno, EncryptionMode comSettings,
const DESFireAccessRights &accessRights,
unsigned int fileSize,
unsigned short isoFID = 0x00) = 0;
/**
* \brief Create a new backup file in the current application.
* \param fileno The new file number
* \param comSettings The file communication setting
* \param accessRights The file access rights
* \param fileSize The file size (in bytes).
*/
virtual void createBackupFile(unsigned char fileno, EncryptionMode comSettings,
const DESFireAccessRights &accessRights,
unsigned int fileSize,
unsigned short isoFID = 0x00) = 0;
/**
* \brief Create a new linear record file in the current application.
* \param fileno The new file number
* \param comSettings The file communication setting
* \param accessRights The file access rights
* \param fileSize The file size (in bytes).
* \param maxNumberOfRecords Max number of records in the file.
*/
virtual void createLinearRecordFile(unsigned char fileno, EncryptionMode comSettings,
const DESFireAccessRights &accessRights,
unsigned int fileSize,
unsigned int maxNumberOfRecords,
unsigned short isoFID = 0x00) = 0;
/**
* \brief Create a new cyclic record file in the current application.
* \param fileno The new file number
* \param comSettings The file communication setting
* \param accessRights The file access rights
* \param fileSize The file size (in bytes).
* \param maxNumberOfRecords Max number of records in the file.
*/
virtual void createCyclicRecordFile(unsigned char fileno, EncryptionMode comSettings,
const DESFireAccessRights &accessRights,
unsigned int fileSize,
unsigned int maxNumberOfRecords,
unsigned short isoFID = 0x00) = 0;
/**
* \brief AuthenticateISO command.
* \param keyno The key number.
* \param algorithm The ISO algorithm to use for authentication.
*/
virtual void authenticateISO(unsigned char keyno,
DESFireISOAlgorithm algorithm = DF_ALG_2K3DES) = 0;
/**
* \brief AuthenticateAES command.
* \param keyno The key number.
*/
virtual void authenticateAES(unsigned char keyno) = 0;
/**
* \brief Read data from a specific file.
* \param fileno The file number
* \param offset The byte offset
* \param length The data length to read
* \param data The data buffer
* \param mode The communication mode
* \return The number of bytes read.
*/
// virtual size_t readData(int fileno, size_t offset, size_t length, void* data,
// EncryptionMode mode) = 0;
/**
* \brief Read record from a specific record file.
* \param fileno The file number
* \param offset The byte offset
* \param length The length to read
* \param data The data buffer
* \param mode The communication mode
* \return The number of bytes read.
*/
// virtual size_t readRecords(int fileno, size_t offset, size_t length, void* data,
// EncryptionMode mode) = 0;
/**
* \brief Change file settings of a specific file in the current application.
* \param fileno The file number
* \param comSettings The file communication setting
* \param accessRights The file access rights
* \param plain Communication is currently in plain data.
* \return True on success, false otherwise.
*/
// virtual bool changeFileSettings(int fileno, EncryptionMode comSettings,
// DESFireAccessRights accessRights, bool plain) = 0;
/**
* \brief Change key settings for the current application.
* \param settings The new key settings
* \return True on success, false otherwise.
*/
// virtual bool changeKeySettings(DESFireKeySettings settings) = 0;
/**
* \brief Change a key in the current application.
* \param keyno The key number to change
* \param key The new key
* \return True on success, false otherwise.
*/
// virtual bool changeKey(unsigned char keyno, std::shared_ptr<DESFireKey> key) = 0;
/**
* \brief Get the card version information.
* \param dataVersion The card version information structure that will be filled
* \return True on success, false otherwise.
*/
// virtual bool getVersion(DESFireCommands::DESFireCardVersion& dataVersion) = 0;
/**
* \brief Get the current application list.
* \return The application list.
*/
// virtual std::vector<int> getApplicationIDs() = 0;
/**
* \brief Get the File IDentifiers of all active files within the currently selected
* application
* \return The file ID list.
*/
// virtual std::vector<int> getFileIDs() = 0;
/**
* \brief Get value from a specific value file.
* \param fileno The file number
* \param mode The communication mode
* \param value The value stored in the card
* \return True on success, false otherwise.
*/
// virtual bool getValue(int fileno, EncryptionMode mode, int& value) = 0;
/**
* \brief Set the card configuration.
* \param formatCardEnabled If true, the format card command is enabled.
* \param randomIdEnabled If true, the CSN is random (can't be changed once
* activated).
*/
virtual void setConfiguration(bool formatCardEnabled, bool randomIdEnabled) = 0;
/**
* \brief Set the card configuration default key.
* param defaultKey The new default key.
*/
virtual void setConfiguration(std::shared_ptr<DESFireKey> defaultKey) = 0;
/**
* \brief Set a custom card ATS.
* \param ats The new card ATS.
*/
virtual void setConfiguration(const ByteVector &ats) = 0;
virtual std::shared_ptr<ISO7816Commands> getISO7816Commands() const
{
return std::shared_ptr<ISO7816Commands>();
}
protected:
std::shared_ptr<DESFireEV1Chip> getDESFireEV1Chip() const;
};
}
#endif /* LOGICALACCESS_DESFIREEV1CARDPROVIDER_HPP */ | {
"pile_set_name": "Github"
} |
<resources>
<string name="app_name">AndroidTextToSpeech</string>
</resources>
| {
"pile_set_name": "Github"
} |
-----BEGIN DSA PRIVATE KEY-----
MIIBugIBAAKBgQCErbqKVSlSOvl3DvqB0coqc9bMYR+D6W8JCo0NcDhUPaO42q3h
2K7myIgEOAMmU1NgpQspAGgxeUOUfNJkq3L6JFeOzBxG/6P7W8mYzofWpdWBUil7
LsnCjurDw5kinVsialDfyKpVQOTezI1YORDDdNdoBlbTUITPWdjMvexhvQIVAPyN
b55qHat79ofX4tH7tUWXcerzAoGAfqOEFET/RAOdDzGu5f1L+edM8V01MwVq+015
GEGEuKu6vHnXZnRq0z7dWp2AEghuFUvH3VoRtfsYG02mUJjs7siGTK6JTI//VvNJ
3/N4RwHM+clxFosF4Yk0xi9E8WztznhpkIp0Q6RX7KADdXM+ZjWPb1wZAEFRxnwc
f+cEGlcCgYBPocY4aiBRWpTev7yHKv4/wCYXlSDRAK8uQpjn5TPu4WMV5vTtr1Rb
rqIqAoKBCUzo/hg1CfStVnmXcNl79rBLOiNFvj93oTGYw9VD2K7DlleLKsjF6XWF
pYl8MkL9CCC0838vLGy1+Ah+QLtsnqmSfY2RQ5XKKdWzsWpQZSv9lAIUGg1ZNat+
RdjEFwuIgMXDoO+y3z0=
-----END DSA PRIVATE KEY-----
| {
"pile_set_name": "Github"
} |
//
// LiveUIParView.m
// TILLiveSDKShow
//
// Created by wilderliao on 16/11/9.
// Copyright © 2016年 Tencent. All rights reserved.
//
#import "LiveUIParView.h"
#import "LinkRoomList.h"
#import <ShareSDKUI/ShareSDK+SSUI.h>//用于实现社交分享
#import "SpeedTest.h"
@interface LiveUIParView ()
{
UInt64 _channelId;
NSMutableString *_versionInfo;
}
@end
@implementation LiveUIParView
- (void)configWith:(LiveUIParViewConfig *)config
{
_config = config;
[self addAVParamSubViews];
_resolutionDic = [NSMutableDictionary dictionary];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onParPure:) name:kPureDelete_Notification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onParNoPure:) name:kNoPureDelete_Notification object:nil];
}
- (void)onParPure:(NSNotification *)noti
{
CGRect selfFrame = self.frame;
_restoreRect = selfFrame;
[UIView animateWithDuration:0.5 animations:^{
CGRect moveToRect = CGRectMake(selfFrame.origin.x, -(selfFrame.origin.y+selfFrame.size.height), selfFrame.size.width, selfFrame.size.height);
[self setFrame:moveToRect];
} completion:^(BOOL finished) {
self.hidden = YES;
}];
}
- (void)onParNoPure:(NSNotification *)noti
{
self.hidden = NO;
[UIView animateWithDuration:0.5 animations:^{
[self setFrame:_restoreRect];
} completion:^(BOOL finished) {
}];
}
- (void)addAVParamSubViews
{
_funs = [NSMutableArray array];
//AV Param View
if (_config.isHost)
{
_interactBtn = [[UIButton alloc] init];
[_interactBtn setImage:[UIImage imageNamed:@"interactive"] forState:UIControlStateNormal];
[_interactBtn addTarget:self action:@selector(onInteract:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:_interactBtn];
[_funs addObject:_interactBtn];
}
UIImage *nor = [UIImage imageWithColor:[RGB(220, 220, 220) colorWithAlphaComponent:0.5]];
UIImage *hig = [UIImage imageWithColor:[RGB(110, 110, 110) colorWithAlphaComponent:0.5]];
_parBtn = [[UIButton alloc] init];
[_parBtn setTitle:@"房间信息" forState:UIControlStateNormal];
_parBtn.titleLabel.font = kAppSmallTextFont;
_parBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
[_parBtn addTarget:self action:@selector(onPar:) forControlEvents:UIControlEventTouchUpInside];
[_parBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_parBtn setTitleColor:kColorWhite forState:UIControlStateSelected];
[_parBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_parBtn setBackgroundImage:hig forState:UIControlStateSelected];
_parBtn.layer.cornerRadius = 4;
_parBtn.layer.masksToBounds = YES;
[self addSubview:_parBtn];
[_funs addObject:_parBtn];
UIImage *image = [UIImage imageWithColor:[kColorBlue colorWithAlphaComponent:0.5]];
if (_config.isHost)
{
_pushStreamBtn = [[UIButton alloc] init];
[_pushStreamBtn setTitle:@"开始推流" forState:UIControlStateNormal];
[_pushStreamBtn setTitle:@"关闭推流" forState:UIControlStateSelected];
[_pushStreamBtn addTarget:self action:@selector(onPush:) forControlEvents:UIControlEventTouchUpInside];
_pushStreamBtn.titleLabel.font = kAppSmallTextFont;
[_pushStreamBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_pushStreamBtn setTitleColor:kColorWhite forState:UIControlStateSelected];
[_pushStreamBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_pushStreamBtn setBackgroundImage:hig forState:UIControlStateSelected];
_pushStreamBtn.layer.cornerRadius = 4;
_pushStreamBtn.layer.masksToBounds = YES;
[self addSubview:_pushStreamBtn];
[_funs addObject:_pushStreamBtn];
}
#if !kIsAppstoreVersion
_speedBtn = [[UIButton alloc] init];
[_speedBtn setTitle:@"网络测速" forState:UIControlStateNormal];
[_speedBtn addTarget:self action:@selector(onTestSpeed:) forControlEvents:UIControlEventTouchUpInside];
_speedBtn.titleLabel.font = kAppSmallTextFont;
[_speedBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_speedBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_speedBtn setBackgroundImage:image forState:UIControlStateSelected];
_speedBtn.layer.cornerRadius = 4;
_speedBtn.layer.masksToBounds = YES;
[self addSubview:_speedBtn];
[_funs addObject:_speedBtn];
#endif
if (_config.isHost)
{
_recBtn = [[UIButton alloc] init];
[_recBtn setTitle:@"录制" forState:UIControlStateNormal];
[_recBtn addTarget:self action:@selector(onRecord:) forControlEvents:UIControlEventTouchUpInside];
_recBtn.titleLabel.font = kAppSmallTextFont;
[_recBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_recBtn setTitleColor:kColorWhite forState:UIControlStateSelected];
[_recBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_recBtn setBackgroundImage:image forState:UIControlStateSelected];
_recBtn.layer.cornerRadius = 4;
_recBtn.layer.masksToBounds = YES;
[self addSubview:_recBtn];
[_funs addObject:_recBtn];
_linkRoomBtn = [[UIButton alloc] init];
[_linkRoomBtn setTitle:@"主播串门" forState:UIControlStateNormal];
[_linkRoomBtn addTarget:self action:@selector(onLinkRoomAction) forControlEvents:UIControlEventTouchUpInside];
_linkRoomBtn.titleLabel.font = kAppSmallTextFont;
[_linkRoomBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_linkRoomBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_linkRoomBtn setBackgroundImage:image forState:UIControlStateSelected];
_linkRoomBtn.layer.cornerRadius = 4;
_linkRoomBtn.layer.masksToBounds = YES;
[self addSubview:_linkRoomBtn];
[_funs addObject:_linkRoomBtn];
_unlinkRoomBtn = [[UIButton alloc] init];
[_unlinkRoomBtn setTitle:@"取消串门" forState:UIControlStateNormal];
[_unlinkRoomBtn addTarget:self action:@selector(onUnLinkRoomAction) forControlEvents:UIControlEventTouchUpInside];
_unlinkRoomBtn.titleLabel.font = kAppSmallTextFont;
[_unlinkRoomBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_unlinkRoomBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_unlinkRoomBtn setBackgroundImage:image forState:UIControlStateSelected];
_unlinkRoomBtn.layer.cornerRadius = 4;
_unlinkRoomBtn.layer.masksToBounds = YES;
[self addSubview:_unlinkRoomBtn];
[_funs addObject:_unlinkRoomBtn];
}
_reportBtn = [[UIButton alloc] init];
[_reportBtn setTitle:@"举报" forState:UIControlStateNormal];
[_reportBtn addTarget:self action:@selector(onReport:) forControlEvents:UIControlEventTouchUpInside];
_reportBtn.titleLabel.font = kAppSmallTextFont;
[_reportBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_reportBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_reportBtn setBackgroundImage:image forState:UIControlStateSelected];
_reportBtn.layer.cornerRadius = 4;
_reportBtn.layer.masksToBounds = YES;
[self addSubview:_reportBtn];
[_funs addObject:_reportBtn];
_shieldBtn = [[UIButton alloc] init];
[_shieldBtn setTitle:@"拉黑" forState:UIControlStateNormal];
[_shieldBtn addTarget:self action:@selector(onShield:) forControlEvents:UIControlEventTouchUpInside];
_shieldBtn.titleLabel.font = kAppSmallTextFont;
[_shieldBtn setTitleColor:kColorBlack forState:UIControlStateNormal];
[_shieldBtn setBackgroundImage:nor forState:UIControlStateNormal];
[_shieldBtn setBackgroundImage:image forState:UIControlStateSelected];
_shieldBtn.layer.cornerRadius = 4;
_shieldBtn.layer.masksToBounds = YES;
[self addSubview:_shieldBtn];
[_funs addObject:_shieldBtn];
}
- (void)layoutSubviews
{
[super layoutSubviews];
CGRect rect = self.bounds;
int maxColumn = 5;
NSInteger width = (rect.size.width - (maxColumn + 1)*3) / maxColumn;
if (width > 80)
{
width = 80;
}
CGFloat marginX = 3;
if (_funs.count < 5)//按钮较少时,靠右对齐
{
int magin = ((5 - (int)_funs.count) + 1)*3 + (5 - (int)_funs.count)*(int)width;
rect.origin.x += magin;
}
[self gridViews:_funs inColumn:5 size:CGSizeMake(width, 24) margin:CGSizeMake(marginX, kDefaultMargin) inRect:rect];
}
- (void)onInteract:(UIButton *)button
{
if (self.delegate && [self.delegate respondsToSelector:@selector(onInteract)])
{
[self.delegate onInteract];
}
}
- (void)onPar:(UIButton *)button
{
_versionInfo = [NSMutableString string];
NSString *iliveSDKVer = [NSString stringWithFormat:@"ILiveSDK: %@\n",[[ILiveSDK getInstance] getVersion]];
[_versionInfo appendString:iliveSDKVer];
//TXCVideoPreprocessor
NSString *filterSDKVer = [NSString stringWithFormat:@"TXCVP: %@\n",[TXCVideoPreprocessor getVersion]];
[_versionInfo appendString:filterSDKVer];
NSString *imSDKVer = [NSString stringWithFormat:@"IMSDK: %@\n",[[TIMManager sharedInstance] GetVersion]];
[_versionInfo appendString:imSDKVer];
NSString *avSDKVer = [NSString stringWithFormat:@"AVSDK: %@\n",[QAVContext getVersion]];
[_versionInfo appendString:avSDKVer];
// NSString *tilliveSDKVer = [NSString stringWithFormat:@"TILLiveSDK: %@\n",[[TILLiveManager getInstance] getVersion]];
// [_versionInfo appendString:tilliveSDKVer];
if (!button.selected)
{
__weak typeof(self) ws = self;
ws.paramTextView = [[UITextView alloc] init];
CGRect selfRect = self.frame;
ws.paramTextView.editable = NO;
ws.paramTextView.font = kAppLargeTextFont;
ws.paramTextView.backgroundColor = [kColorLightGray colorWithAlphaComponent:0.5];
[ws.paramTextView setFrame:CGRectMake(0, selfRect.origin.y+selfRect.size.height+kDefaultMargin, selfRect.size.width, 350)];
[self.superview addSubview:ws.paramTextView];
_logTimer = [NSTimer timerWithTimeInterval:1 target:self selector:@selector(onLogTimer) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:_logTimer forMode:NSDefaultRunLoopMode];
}
else
{
if (_paramTextView)
{
[_paramTextView removeFromSuperview];
}
[_logTimer invalidate];
_logTimer = nil;
}
button.selected = !button.selected;
}
- (void)onLogTimer
{
__weak typeof(self) ws = self;
QAVContext *context = [[ILiveSDK getInstance] getAVContext];
if (context.videoCtrl && context.audioCtrl && context.room)
{
ILiveQualityData *qualityData = [[ILiveRoomManager getInstance] getQualityData];
NSMutableString *paramString = [NSMutableString string];
//房间号
int roomid = [[ILiveRoomManager getInstance] getRoomId];
[paramString appendString:[NSString stringWithFormat:@"直播间号: %d\n",roomid]];
//角色
NSString *roleStr = _config.isHost ? @"主播" : @"非主播";
[paramString appendString:[NSString stringWithFormat:@"个人角色: %@\n",roleStr]];
//FPS
[paramString appendString:[NSString stringWithFormat:@"编码帧率: %d\n",qualityData.interactiveSceneFPS/10]];
//Send Recv
[paramString appendString:[NSString stringWithFormat:@"发送码率: %dkbps \n",qualityData.sendRate]];
[paramString appendString:[NSString stringWithFormat:@"接收码率: %ldkbps\n",(long)qualityData.recvRate]];
//sendLossRate recvLossRate
CGFloat sendLossRate = (CGFloat)qualityData.sendLossRate / (CGFloat)100;
CGFloat recvLossRate = (CGFloat)qualityData.recvLossRate / (CGFloat)100;
NSString *per = @"%";
[paramString appendString:[NSString stringWithFormat:@"发送丢包率: %.2f%@\n",sendLossRate,per]];
[paramString appendString:[NSString stringWithFormat:@"接收丢包率: %.2f%@.\n",recvLossRate,per]];
//麦克风
NSString *isOpen = [[ILiveRoomManager getInstance] getCurMicState] ? @"打开" : @"关闭";
[paramString appendString:[NSString stringWithFormat:@"麦克风状态: %@\n",isOpen]];
//扬声器
NSString *isOpenSpeaker = [[ILiveRoomManager getInstance] getCurSpeakerState] ? @"打开" : @"关闭";
[paramString appendString:[NSString stringWithFormat:@"扬声器状态: %@\n",isOpenSpeaker]];
//appcpu syscpu
CGFloat appCpuRate = (CGFloat)qualityData.appCPURate / (CGFloat)100;
CGFloat sysCpuRate = (CGFloat)qualityData.sysCPURate / (CGFloat)100;
[paramString appendString:[NSString stringWithFormat:@"应用CPU占用率: %.2f%@\n",appCpuRate,per]];
[paramString appendString:[NSString stringWithFormat:@"系统CPU占用率: %.2f%@\n",sysCpuRate,per]];
[paramString appendString:[NSString stringWithFormat:@"主播视频分辨率: "]];
//分别角色的分辨率
NSArray *keys = [_resolutionDic allKeys];
for (NSString *key in keys)
{
QAVFrameDesc *desc = _resolutionDic[key];
[paramString appendString:[NSString stringWithFormat:@"%@:%ld * %ld\n",key,desc.width,desc.height]];
}
// //采集信息
// NSString *videoParam = [context.videoCtrl getQualityTips];
// NSArray *array = [videoParam componentsSeparatedByString:@"\n"]; //从字符A中分隔成2个元素的数组
// if (array.count > 3)
// {
// NSString *resolution = [array objectAtIndex:2];
// [paramString appendString:[NSString stringWithFormat:@"%@\n",resolution]];
// }
[paramString appendString:_versionInfo];
dispatch_async(dispatch_get_main_queue(), ^{
ws.paramTextView.text = paramString;
});
}
}
- (void)onPush:(UIButton *)button
{
button.selected = !button.selected;
if (button.selected)
{
__weak typeof(self) ws = self;
AlertActionHandle hlsBlock = ^(UIAlertAction * _Nonnull action){
[ws pushStream:button encodeType:ILive_ENCODE_HLS recordType:ILive_RECORD_FILE_TYPE_MP4];
};
AlertActionHandle rtmpBlock = ^(UIAlertAction * _Nonnull action){
[ws pushStream:button encodeType:ILive_ENCODE_RTMP recordType:ILive_RECORD_FILE_TYPE_MP4];
};
NSDictionary *funs = @{@"HLS推流":hlsBlock, @"RTMP推流":rtmpBlock};
[AlertHelp alertWith:nil message:nil funBtns:funs cancelBtn:@"取消" alertStyle:UIAlertControllerStyleActionSheet cancelAction:^(UIAlertAction * _Nonnull action) {
button.selected = !button.selected;
}];
}
else
{
[self stopPushStream];
}
}
- (void)pushStream:(UIButton *)button encodeType:(ILiveEncodeType)encodeType recordType:(ILiveRecordFileType)recordType
{
ILiveChannelInfo *info = [[ILiveChannelInfo alloc] init];
info.channelName = [NSString stringWithFormat:@"新随心播推流_%@",[[ILiveLoginManager getInstance] getLoginId]];
info.channelDesc = [NSString stringWithFormat:@"新随心播推流描述测试文本"];
ILivePushOption *option = [[ILivePushOption alloc] init];
option.channelInfo = info;
option.encodeType = encodeType;
option.recrodFileType = recordType;
__weak typeof(self) ws = self;
[[ILiveRoomManager getInstance] startPushStream:option succ:^(id selfPtr) {
AVStreamerResp *resp = (AVStreamerResp *)selfPtr;
[ws setChannelId:resp.channelID];
AVLiveUrl *url = nil;
if (resp && resp.urls && resp.urls.count > 0)
{
url = resp.urls[0];
}
NSString *msg = url ? url.playUrl : @"url为nil";
AlertActionHandle copyBlock = ^(UIAlertAction * _Nonnull action) {
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setString:msg];
};
AlertActionHandle copyShareBlock = ^(UIAlertAction * _Nonnull action){
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
[pasteboard setString:msg];
[ws shareLive:msg];
};
NSDictionary *funs = @{@"复制":copyBlock, @"复制并分享":copyShareBlock};
[AlertHelp alertWith:nil message:msg funBtns:funs cancelBtn:@"取消" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
} failed:^(NSString *module, int errId, NSString *errMsg) {
button.selected = !button.selected;
NSString *errinfo = [NSString stringWithFormat:@"push stream fail.module=%@,errid=%d,errmsg=%@",module,errId,errMsg];
[AlertHelp alertWith:@"推流失败" message:errinfo cancelBtn:@"明白了" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}];
}
- (void)shareLive:(NSString *)url
{
//分享链接到社交平台
NSArray* imageArray = @[_config.item.info.cover];
if (!imageArray)
{
return;
}
NSMutableDictionary *shareParams = [NSMutableDictionary dictionary];
[shareParams SSDKSetupShareParamsByText:@"走过路过,不要错过~快来观看直播吧!" images:imageArray url:[NSURL URLWithString:url] title:_config.item.info.title type:SSDKContentTypeAuto];
//有的平台要客户端分享需要加此方法,例如微博
[shareParams SSDKEnableUseClientShare];
//可以弹出分享菜单和编辑界面
[ShareSDK showShareActionSheet:nil items:nil shareParams:shareParams onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData,SSDKContentEntity *contentEntity, NSError *error, BOOL end) {
switch (state)
{
case SSDKResponseStateSuccess:
{
[AlertHelp alertWith:@"分享成功" message:nil cancelBtn:@"确定" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
break;
}
case SSDKResponseStateFail:
{
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[AlertHelp alertWith:@"分享失败" message:[NSString stringWithFormat:@"%@",error] cancelBtn:@"确定" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
});
break;
}
case SSDKResponseStateCancel:
{
break;
}
default:
break;
}
}];
}
- (void)stopPushStream
{
__weak typeof(self) ws = self;
[[ILiveRoomManager getInstance] stopPushStreams:@[@(_channelId)] succ:^{
[ws setChannelId:0];//重置channelid
[AlertHelp alertWith:@"已停止推流" message:nil cancelBtn:@"好的" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
} failed:^(NSString *module, int errId, NSString *errMsg) {
NSString *errinfo = [NSString stringWithFormat:@"push stream fail.module=%@,errid=%d,errmsg=%@",module,errId,errMsg];
[AlertHelp alertWith:@"停止推流失败" message:errinfo cancelBtn:@"明白了" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}];
}
- (void)setChannelId:(UInt64)channelId
{
_channelId = channelId;
}
- (void)onRecord:(UIButton *)button
{
button.selected = !button.selected;
if (button.selected)
{
__weak typeof(self) ws = self;
AlertActionHandle videoRecordBlock = ^(UIAlertAction * _Nonnull action){
[ws startRecord:button type:ILive_RECORD_TYPE_VIDEO];
};
AlertActionHandle audioRecordBlock = ^(UIAlertAction * _Nonnull action){
[ws startRecord:button type:ILive_RECORD_TYPE_AUDIO];
};
NSDictionary *funs = @{@"视频录制":videoRecordBlock,@"纯音频录制":audioRecordBlock};
[AlertHelp alertWith:nil message:nil funBtns:funs cancelBtn:@"取消" alertStyle:UIAlertControllerStyleActionSheet cancelAction:^(UIAlertAction * _Nonnull action) {
button.selected = !button.selected;
}];
}
else
{
[[ILiveRoomManager getInstance] stopRecordVideo:^(id selfPtr) {
[AlertHelp alertWith:@"已停止录制" message:nil cancelBtn:@"好的" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
} failed:^(NSString *module, int errId, NSString *errMsg) {
button.selected = !button.selected;
NSString *errinfo = [NSString stringWithFormat:@"push stream fail.module=%@,errid=%d,errmsg=%@",module,errId,errMsg];
[AlertHelp alertWith:@"停止录制失败" message:errinfo cancelBtn:@"明白了" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}];
}
}
- (void)showEditAlert:(UIViewController *)rootVC title:(NSString *)title message:(NSString *)msg placeholder:(NSString *)holder okTitle:(NSString *)okTitle cancelTitle:(NSString *)cancelTitle ok:(EditAlertHandle)succ cancel:(ActionHandle)fail
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
[alert addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
textField.placeholder = holder;
}];
if (okTitle)
{
[alert addAction:[UIAlertAction actionWithTitle:okTitle style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
succ(alert.textFields.firstObject.text);
}]];
}
if (cancelTitle)
{
[alert addAction:[UIAlertAction actionWithTitle:cancelTitle style:UIAlertActionStyleCancel handler:fail]];
}
[rootVC presentViewController:alert animated:YES completion:nil];
}
- (void)removeSelfAndLinked:(NSMutableArray *)array
{
NSArray *linkedUsers = [[TILLiveManager getInstance] getCurrentLinkedUserArray];
NSMutableArray *willRemoveItems = [NSMutableArray array];
for (TCShowLiveListItem *item in array)
{
if ([item.uid isEqualToString:[[ILiveLoginManager getInstance] getLoginId]])
{
// [array removeObject:item];
[willRemoveItems addObject:item];
}
else
{
NSUInteger index = [linkedUsers indexOfObject:item.uid];
if (index != NSNotFound)
{
// [array removeObject:item];
[willRemoveItems addObject:item];
}
}
}
[array removeObjectsInArray:willRemoveItems];
}
- (void)onLinkRoomAction
{
//向业务后台请求直播间列表
__weak typeof(self) ws = self;
RoomListRequest *listReq = [[RoomListRequest alloc] initWithHandler:^(BaseRequest *request) {
RoomListRequest *wreq = (RoomListRequest *)request;
RoomListRspData *respData = (RoomListRspData *)wreq.response.data;
[ws removeSelfAndLinked:respData.rooms];
dispatch_async(dispatch_get_main_queue(), ^{
LinkRoomList *roomList = [[LinkRoomList alloc] init];
RoomListConfig *config = [[RoomListConfig alloc] init];
CGRect rect = [UIScreen mainScreen].bounds;
config.frame = CGRectMake(rect.origin.x, rect.origin.y-rect.size.height, rect.size.width, rect.size.height);
config.liveList = respData.rooms;
[roomList configRoomList:config];
[ws.superview addSubview:roomList];
[UIView animateWithDuration:0.5 animations:^{
[roomList setFrame:rect];
} completion:^(BOOL finished) {
roomList.roomListconfig.frame = rect;
}];
});
} failHandler:^(BaseRequest *request) {
NSString *logInfo = [NSString stringWithFormat:@"code=%ld,mesg=%@",(long)request.response.errorCode,request.response.errorInfo];
[AlertHelp alertWith:@"获取主播列表失败" message:logInfo cancelBtn:@"算了" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}];
listReq.token = [AppDelegate sharedAppDelegate].token;
listReq.type = @"live";
RequestPageParamItem *pageItem = [[RequestPageParamItem alloc] init];
listReq.index = pageItem.pageIndex;
listReq.size = pageItem.pageSize;
listReq.appid = [ShowAppId intValue];
[[WebServiceEngine sharedEngine] asyncRequest:listReq wait:YES];
}
- (void)onUnLinkRoomAction
{
AlertActionHandle okBlock = ^(UIAlertAction *_Nonnull action){
[[TILLiveManager getInstance] unLinkRoom:^{
[AlertHelp tipWith:@"已结束跨房连麦" wait:1];
} failed:^(NSString *module, int errId, NSString *errMsg) {
NSString *errInfo = [NSString stringWithFormat:@"module=%@,code=%d,msg=%@",module,errId,errMsg];
[AlertHelp alertWith:@"结束跨房连麦失败" message:errInfo cancelBtn:@"明白了" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}];
};
[AlertHelp alertWith:@"结束跨房连麦" message:@"确定结束所有跨房连麦吗?" funBtns:@{@"确定":okBlock} cancelBtn:@"取消" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}
- (void)startRecord:(UIButton *)button type:(ILiveRecordType)recordType
{
__weak typeof(self) ws = self;
[self showEditAlert:[AlertHelp topViewController] title:@"输入录制文件名" message:nil placeholder:@"录制文件名" okTitle:@"确定" cancelTitle:@"取消" ok:^(NSString * _Nonnull editString) {
NSString *recName = editString && editString.length > 0 ? editString : @"sxb默认录制文件名";
if (ws.delegate && [ws.delegate respondsToSelector:@selector(onRecReport:type:)])
{
[ws.delegate onRecReport:recName type:recordType];
}
ILiveRecordOption *option = [[ILiveRecordOption alloc] init];
NSString *identifier = [[ILiveLoginManager getInstance] getLoginId];
option.fileName = [NSString stringWithFormat:@"sxb_%@_%@",identifier,recName];
option.recordType = recordType;
[[ILiveRoomManager getInstance] startRecordVideo:option succ:^{
[AlertHelp alertWith:@"已开始录制" message:nil cancelBtn:@"确定" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
} failed:^(NSString *module, int errId, NSString *errMsg) {
button.selected = !button.selected;
NSString *errinfo = [NSString stringWithFormat:@"push stream fail.module=%@,errid=%d,errmsg=%@",module,errId,errMsg];
[AlertHelp alertWith:@"开始录制失败" message:errinfo cancelBtn:@"确定" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}];
} cancel:^(UIAlertAction * _Nonnull action) {
button.selected = !button.selected;
}];
}
- (void)onTestSpeed:(UIButton *)button
{
[[SpeedTest shareInstance] startTest];
}
//举报
- (void)onReport:(UIButton *)button {
if (self.delegate && [self.delegate respondsToSelector:@selector(onReport)]) {
[self.delegate onReport];
}
}
- (void)onShield:(UIButton *)button {
AlertActionHandle okBlock = ^(UIAlertAction *_Nonnull action){
NSUserDefaults *user = [NSUserDefaults standardUserDefaults];
NSMutableDictionary *blacklist = [NSMutableDictionary dictionaryWithDictionary:[user objectForKey:kShieldMapKey]];
if (blacklist) {
[blacklist setValue:@(1) forKey:_config.item.uid];
} else {
blacklist = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@(1),_config.item.uid,nil];
}
[user setObject:blacklist forKey:kShieldMapKey];
[AlertHelp tipWith:@"已加入黑名单" wait:1.0];
};
[AlertHelp alertWith:@"提示" message:@"确定要拉黑吗" funBtns:@{@"确定":okBlock} cancelBtn:@"取消" alertStyle:UIAlertControllerStyleAlert cancelAction:nil];
}
@end
@implementation LiveUIParViewConfig
@end
| {
"pile_set_name": "Github"
} |
//-----------------------------------------------------------------------------
// MEKA - inputs_f.c
// Inputs File Load/Save - Code
//-----------------------------------------------------------------------------
#include "shared.h"
#include "keyinfo.h"
#include "libparse.h"
//-----------------------------------------------------------------------------
FILE *INP_File;
INLINE void INP_Write_Line (const char *s) { fprintf(INP_File, "%s\n", s); }
INLINE void INP_Write_Str (const char *name, const char *s) { fprintf(INP_File, "%s = %s\n", name, s); }
INLINE void INP_Write_Int (const char *name, int value) { fprintf(INP_File, "%s = %d\n", name, value); }
INLINE void INP_Write_Float (const char *name, float value) { fprintf(INP_File, "%s = %.2f\n", name, value); }
//-----------------------------------------------------------------------------
static const char *Inputs_Src_List_KeyWords [] =
{
"type", "enabled", "player",
"driver", "connection",
"emulate_digital", "emulate_analog", "digital_falloff",
"player_up", "player_down", "player_left", "player_right",
"player_button1", "player_button2", "player_start_pause", "player_reset",
"player_x_axis", "player_y_axis",
"mouse_speed_x", // OBSOLETE
"mouse_speed_y", // OBSOLETE
"cabinet_mode", // particular case
NULL
};
//-----------------------------------------------------------------------------
static int Load_Inputs_Src_Parse_Var (int var_idx, char *s, t_input_src *input_src)
{
char w[256];
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_EMPTY;
switch (var_idx)
{
case 0: // type -----------------------------------------------------------
if (!strcmp(w, "keyboard"))
{
input_src->type = INPUT_SRC_TYPE_KEYBOARD;
input_src->flags = INPUT_SRC_FLAGS_DIGITAL;
input_src->Connected_and_Ready = TRUE;
return MEKA_ERR_OK;
}
if (!strcmp(w, "joypad"))
{
input_src->type = INPUT_SRC_TYPE_JOYPAD;
input_src->flags = INPUT_SRC_FLAGS_DIGITAL;
input_src->Connected_and_Ready = FALSE;
return MEKA_ERR_OK;
}
if (!strcmp(w, "mouse"))
{
input_src->type = INPUT_SRC_TYPE_MOUSE;
input_src->flags = INPUT_SRC_FLAGS_ANALOG;
input_src->Connected_and_Ready = (g_env.mouse_installed ? TRUE : FALSE);
return MEKA_ERR_OK;
}
return MEKA_ERR_SYNTAX;
case 1: // enabled --------------------------------------------------------
if (!strcmp(w, "yes")) { input_src->enabled = TRUE; return MEKA_ERR_OK; }
if (!strcmp(w, "no")) { input_src->enabled = FALSE; return MEKA_ERR_OK; }
return MEKA_ERR_SYNTAX;
case 2: // player ---------------------------------------------------------
input_src->player = atoi(w) - 1;
if (input_src->player != 0 && input_src->player != 1)
return MEKA_ERR_SYNTAX;
return MEKA_ERR_OK;
case 3: // driver ---------------------------------------------------------
// FIXME-OBSOLETE
return MEKA_ERR_OK;
case 4: // connection -----------------------------------------------------
input_src->Connection_Port = atoi(w);
if (input_src->Connection_Port > 0) input_src->Connection_Port -= 1;
return MEKA_ERR_OK;
case 5: // emulate_digital ------------------------------------------------
if (!strcmp(w, "yes")) { input_src->flags |= INPUT_SRC_FLAGS_EMULATE_DIGITAL; return MEKA_ERR_OK; }
if (!strcmp(w, "no")) { input_src->flags &= ~INPUT_SRC_FLAGS_EMULATE_DIGITAL; return MEKA_ERR_OK; }
return MEKA_ERR_SYNTAX;
case 6: // emulate_analog -------------------------------------------------
if (!strcmp(w, "yes")) { input_src->flags |= INPUT_SRC_FLAGS_EMULATE_ANALOG; return MEKA_ERR_OK; }
if (!strcmp(w, "no")) { input_src->flags &= ~INPUT_SRC_FLAGS_EMULATE_ANALOG; return MEKA_ERR_OK; }
return MEKA_ERR_SYNTAX;
case 7: // digital_falloff ------------------------------------------------
input_src->Analog_to_Digital_FallOff = atof (w);
return MEKA_ERR_OK;
case 8: // player_up ------------------------------------------------------
case 9: // player_down ----------------------------------------------------
case 10: // player_left ----------------------------------------------------
case 11: // player_right ---------------------------------------------------
case 12: // player_button1 -------------------------------------------------
case 13: // player_button2 -------------------------------------------------
case 14: // player_start_pause ---------------------------------------------
case 15: // player_reset ---------------------------------------------------
{
const int map_idx = INPUT_MAP_DIGITAL_UP + var_idx - 8;
t_input_map_entry* map = &input_src->Map[map_idx];
// FIXME: ???
//if (MapIdx >= INPUT_MAP_DIGITAL_UP && MapIdx <= INPUT_MAP_DOWN && !(input_src->Result_Type & DIGITAL))
// return MEKA_ERR_INCOHERENT;
if (!strcmp(w, "key"))
{
const t_key_info *key_info;
if (input_src->type != INPUT_SRC_TYPE_KEYBOARD)
return MEKA_ERR_INCOHERENT;
//if (!Parse_LineGet (&w, &s))
// return MEKA_ERR_SYNTAX;
parse_skip_spaces(&s);
if (StrIsNull(s))
return MEKA_ERR_SYNTAX;
key_info = KeyInfo_FindByName(s);
if (key_info != NULL)
{
map->type = INPUT_MAP_TYPE_KEY;
map->hw_index = key_info->scancode;
}
return MEKA_ERR_OK;
}
if (!strcmp(w, "joy"))
{
int stick, axis, dir;
if (input_src->type != INPUT_SRC_TYPE_JOYPAD)
return MEKA_ERR_INCOHERENT;
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE) || strcmp(w, "stick") || !parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_SYNTAX;
stick = atoi(w);
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE) || strcmp(w, "axis") || !parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_SYNTAX;
axis = atoi(w);
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE) || strcmp(w, "dir") || !parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_SYNTAX;
dir = atoi(w);
map->type = INPUT_MAP_TYPE_JOY_AXIS;
map->hw_index = stick;
map->hw_axis = axis;
map->hw_direction = dir;
return MEKA_ERR_OK;
}
if (!strcmp(w, "joy_button"))
{
if (input_src->type != INPUT_SRC_TYPE_JOYPAD)
return MEKA_ERR_INCOHERENT;
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_SYNTAX;
map->type = INPUT_MAP_TYPE_JOY_BUTTON;
map->hw_index = atoi(w);
return MEKA_ERR_OK;
}
if (!strcmp(w, "mouse_button"))
{
if (input_src->type != INPUT_SRC_TYPE_MOUSE)
return MEKA_ERR_INCOHERENT;
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_SYNTAX;
map->type = INPUT_MAP_TYPE_MOUSE_BUTTON;
map->hw_index = atoi(w);
return MEKA_ERR_OK;
}
return MEKA_ERR_SYNTAX;
}
case 16: // player_x_axis --------------------------------------------------
case 17: // player_y_axis --------------------------------------------------
{
const int map_idx = INPUT_MAP_ANALOG_AXIS_X + var_idx - 16;
t_input_map_entry* map = &input_src->Map[map_idx];
if (!(input_src->flags & INPUT_SRC_FLAGS_ANALOG))
return MEKA_ERR_INCOHERENT;
if (!strcmp(w, "mouse_axis"))
{
if (input_src->type != INPUT_SRC_TYPE_MOUSE)
return MEKA_ERR_INCOHERENT;
if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE))
return MEKA_ERR_SYNTAX;
map->type = input_src->Map[map_idx + 2].type = INPUT_MAP_TYPE_MOUSE_AXIS;
map->hw_index = input_src->Map[map_idx + 2].hw_index = atoi(w);
return MEKA_ERR_OK;
}
return MEKA_ERR_SYNTAX;
}
case 18: // mouse_speed_x --------------------------------------------------
case 19: // mouse_speed_y --------------------------------------------------
return MEKA_ERR_OK;
case 20: // cabinet_mode ---------------------------------------------------
{
Inputs.Cabinet_Mode = atoi(w);
return MEKA_ERR_OK;
}
}
return MEKA_ERR_SYNTAX;
}
void Load_Inputs_Src_List()
{
t_input_src * input_src = NULL;
// Open and read file
ConsolePrint(Msg_Get(MSG_Inputs_Src_Loading));
t_tfile* tf = tfile_read (Inputs.FileName);
if (tf == NULL)
Quit_Msg("%s", meka_strerror());
ConsolePrint("\n");
// Parse each line
int line_cnt = 0;
for (t_list* lines = tf->data_lines; lines; lines = lines->next)
{
char* line = (char*) lines->elem;
line_cnt += 1;
if (StrIsNull(line))
continue;
if (line[0] == '[' && line[strlen(line) - 1] == ']')
{
input_src = Inputs_Sources_Add(StrNDup(line + 1, strlen(line) - 2));
// ConsolePrintf ("new source --> %s <--\n", CurSrc->Name);
continue;
}
char w[256];
StrLower(line);
if (!parse_getword(w, sizeof(w), &line, "=", ';', PARSE_FLAGS_NONE))
continue;
for (int i = 0; Inputs_Src_List_KeyWords[i]; i++)
{
if (strcmp(w, Inputs_Src_List_KeyWords[i]) == 0)
{
// FIXME: this is ugly
if (input_src == NULL
&& strcmp(w, "mouse_speed_x") != 0
&& strcmp(w, "mouse_speed_y") != 0
&& strcmp(w, "cabinet_mode") != 0)
{
tfile_free(tf);
Quit_Msg(Msg_Get(MSG_Inputs_Src_Missing), line_cnt);
}
parse_skip_spaces(&line);
if (!parse_getword(w, sizeof(w), &line, "", ';', PARSE_FLAGS_NONE))
{
tfile_free(tf);
Quit_Msg(Msg_Get(MSG_Inputs_Src_Equal), line_cnt);
}
switch (Load_Inputs_Src_Parse_Var(i, w, input_src))
{
case MEKA_ERR_SYNTAX:
tfile_free(tf);
Quit_Msg(Msg_Get(MSG_Inputs_Src_Syntax_Param), line_cnt);
case MEKA_ERR_INCOHERENT :
tfile_free(tf);
Quit_Msg(Msg_Get(MSG_Inputs_Src_Inconsistency), line_cnt);
break;
// FIXME: EMPTY is not handled there
}
break;
}
if (!Inputs_Src_List_KeyWords [i])
{
tfile_free(tf);
Quit_Msg(Msg_Get(MSG_Inputs_Src_Unrecognized), line_cnt, w);
}
}
}
// Free file data
tfile_free(tf);
// Verify that we have enough inputs sources
if (Inputs.Sources_Max == 0)
Quit_Msg("%s", Msg_Get(MSG_Inputs_Src_Not_Enough));
}
void Write_Inputs_Src_List()
{
if (!(INP_File = fopen(Inputs.FileName, "wt")))
return;
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("; " MEKA_NAME " " MEKA_VERSION " - Inputs Configuration");
INP_Write_Line ("; This file is automatically updated and rewritten when quitting");
INP_Write_Line ("; Feel free to edit this file manually if you feel the need to.");
INP_Write_Line ("; However, any comment you may manually add will be deleted!");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("; Links:");
INP_Write_Line ("; Using a SMS/DB-9 controller on your computer:");
INP_Write_Line ("; - Read the TECH.TXT file at first!");
INP_Write_Line ("; - SmsCardPad");
INP_Write_Line ("; http://www.smspower.org/smscartpad/");
INP_Write_Line ("; - PPJoy joystick driver for Windows 2000/XP");
INP_Write_Line ("; Download mirror: http://www.zophar.net/joy/ppjoy.html");
INP_Write_Line ("; Obsolete official website: http://web.archive.org/web/20021018045524/http://www.geocities.com/deonvdw/");
INP_Write_Line ("; - ArcadeWereld.nl usb controller board");
INP_Write_Line ("; http://www.smspower.org/forums/15321-SMSDB9ControllerOnPcUsingUSB");
INP_Write_Line ("; Schematics and drivers for various console controllers adapters:");
INP_Write_Line ("; - Direct Pad Pro");
INP_Write_Line ("; http://www.arcadecontrols.com/Mirrors/www.ziplabel.com/dpadpro/");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("; Miscellaneous features:");
INP_Write_Line (";");
INP_Write_Line ("; Invert ESC (switch screens) and F10 (quit) keys. Arcade cabinet owners");
INP_Write_Line ("; often have the ESC key mapped to a certain button they want to quit with.");
INP_Write_Int ("cabinet_mode ", Inputs.Cabinet_Mode);
INP_Write_Line (";");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("; Template for creating new input sources:");
INP_Write_Line (";");
INP_Write_Line ("; [Name]");
INP_Write_Line ("; type = keyboard (digital) | joypad (digital) | mouse (analog)");
INP_Write_Line ("; Select the type of input device");
INP_Write_Line ("; enabled = yes | no");
INP_Write_Line ("; Set to no in order to tell MEKA to ignore input from this device");
INP_Write_Line ("; player = 1 | 2");
INP_Write_Line ("; Player number");
INP_Write_Line ("; connection = <number>");
INP_Write_Line ("; Joypad only. Select connection to use: 1 = first pad, 2 = second pad..");
INP_Write_Line ("; emulate_digital");
INP_Write_Line ("; Mouse only. Enable support for digital devices (such as SMS joypad),");
INP_Write_Line ("; to play games with the mouse. Recommended with shooters mainly.");
INP_Write_Line ("; digital_falloff (between 0 and 1, default being 0.8)");
INP_Write_Line ("; Mouse only, when digital emulation is enabled. Reduce to increase");
INP_Write_Line ("; precision, but most games will be harder to play.");
INP_Write_Line (";-----------------------------------------------------------------------------");
INP_Write_Line ("");
for (int i = 0; i < Inputs.Sources_Max; i++)
{
char s [256], s2 [256];
t_input_src *input_src = Inputs.Sources[i];
sprintf(s, "[%s]", input_src->name);
INP_Write_Line(s);
switch (input_src->type)
{
case INPUT_SRC_TYPE_KEYBOARD: sprintf(s, "keyboard"); break;
case INPUT_SRC_TYPE_JOYPAD: sprintf(s, "joypad"); break;
case INPUT_SRC_TYPE_MOUSE: sprintf(s, "mouse"); break;
}
INP_Write_Str ("type ", s);
if (input_src->type == INPUT_SRC_TYPE_JOYPAD)
INP_Write_Int ("connection ", input_src->Connection_Port + 1);
INP_Write_Str ("enabled ", input_src->enabled ? "yes" : "no");
INP_Write_Int ("player ", input_src->player + 1);
for (int j = 0; j < INPUT_MAP_MAX; j++)
{
const t_input_map_entry* map = &input_src->Map[j];
if (map->hw_index == -1)
continue;
s[0] = EOSTR;
if (input_src->flags & INPUT_SRC_FLAGS_DIGITAL)
{
switch (j)
{
case INPUT_MAP_DIGITAL_UP: strcpy(s, "player_up "); break;
case INPUT_MAP_DIGITAL_DOWN: strcpy(s, "player_down "); break;
case INPUT_MAP_DIGITAL_LEFT: strcpy(s, "player_left "); break;
case INPUT_MAP_DIGITAL_RIGHT: strcpy(s, "player_right "); break;
}
}
if (input_src->flags & INPUT_SRC_FLAGS_ANALOG)
{
switch (j)
{
case INPUT_MAP_ANALOG_AXIS_X: strcpy(s, "player_x_axis "); break;
case INPUT_MAP_ANALOG_AXIS_Y: strcpy(s, "player_y_axis "); break;
}
}
if (StrIsNull(s))
{
switch (j)
{
case INPUT_MAP_BUTTON1: strcpy(s, "player_button1 "); break;
case INPUT_MAP_BUTTON2: strcpy(s, "player_button2 "); break;
case INPUT_MAP_PAUSE_START: strcpy(s, "player_start_pause "); break;
case INPUT_MAP_RESET: strcpy(s, "player_reset "); break;
}
}
if (StrIsNull(s))
continue;
switch (input_src->type)
{
// Keyboard -----------------------------------------------------------
case INPUT_SRC_TYPE_KEYBOARD:
{
// Handle special case of the ; key that has to be backslashed
// Removed because... colon is actually ':', not ';' :)
// if (n == KEY_COLON)
// sprintf(s2, "key \\;");
//else
{
const t_key_info *key_info = KeyInfo_FindByScancode(map->hw_index);
const char *key_name = key_info ? key_info->name : "error";
char *key_name_escaped = parse_escape_string(key_name, NULL);
sprintf(s2, "key %s", key_name_escaped ? key_name_escaped : key_name);
}
break;
}
// Joypad -------------------------------------------------------------
case INPUT_SRC_TYPE_JOYPAD:
switch (map->type)
{
case INPUT_MAP_TYPE_JOY_BUTTON:
sprintf(s2, "joy_button %i", map->hw_index);
break;
case INPUT_MAP_TYPE_JOY_AXIS:
sprintf(s2, "joy stick %i axis %i dir %i", map->hw_index, map->hw_axis, map->hw_direction);
break;
}
break;
// Mouse --------------------------------------------------------------
case INPUT_SRC_TYPE_MOUSE:
switch (map->type)
{
case INPUT_MAP_TYPE_MOUSE_BUTTON:
sprintf(s2, "mouse_button %i", map->hw_index);
break;
case INPUT_MAP_TYPE_MOUSE_AXIS:
sprintf(s2, "mouse_axis %i", map->hw_index);
break;
}
break;
}
if (!StrIsNull(s2))
INP_Write_Str(s, s2);
}
// Not yet implemented
// if (input_src->Result_Type == DIGITAL)
// INP_Write_Str ("emulate_analog ", (input_src->flags & INPUT_SRC_FLAGS_EMULATE_ANALOG) ? "yes" : "no");
if (input_src->flags & INPUT_SRC_FLAGS_ANALOG)
{
INP_Write_Str ("emulate_digital ", (input_src->flags & INPUT_SRC_FLAGS_EMULATE_DIGITAL) ? "yes" : "no");
INP_Write_Float ("digital_falloff ", input_src->Analog_to_Digital_FallOff);
}
INP_Write_Line ("");
}
INP_Write_Line (";-----------------------------------------------------------------------------");
fclose (INP_File);
}
//-----------------------------------------------------------------------------
| {
"pile_set_name": "Github"
} |
## What are Engines?
[Ember Engines](http://ember-engines.com/) allow multiple logical applications to be composed together into a single application from the user's perspective, that provide functionality to their host applications. Engines are isolated, `composable applications`, they have almost all the same features as normal Ember applications, except an [Engine](https://api.emberjs.com/ember/3.14/classes/Engine) requires a host application to boot it and provide a Router instance.
## Why use Engines?
Large organizations often use Ember.js to power sophisticated web applications. These apps may require collaboration among several teams, sometimes distributed around the world. Typically, responsibility is shared by dividing the application into one or more "sections". How this division is actually implemented varies from team to team.
Maintaining large monolithic applications poses the following challenges:
* `Side effects` - if you change something, it may be unclear how it could affect the rest of platform.
* `Coordination` - when you develop a new feature or make big changes, many teams may need to be in sync to approve it.
* `Complexity` - with a huge dependency tree and many layers of abstraction, developers cannot iterate quickly, and features suffer as a result.
* `Killing Innovation` - a/b testing a cutting-edge feature is hard to do without disrupting the rest of the app and the teams working on it.
* `Slow Onboarding` - new people coming into the team are overwhelmed.
Engines provide an antidote to these problems by allowing for distributed development, testing, and packaging of logically-grouped pieces of an application.
Engines are good for organizations that have multiple teams, where each team has their own area that is clearly separated from the others. The isolation is good when it matches organizational boundaries, but adds unnecessary complexity when there is not a good match.
Engines are used by a number of large organizations to power sites with million of users.
If you are considering splitting up your application into engines just to reduce the amount of data that needs to be initially downloaded and increase the performance, Engines are not the right solution. Please check out the section on tree shaking and code splitting in projects like [Embroider](https://github.com/embroider-build/embroider).
| {
"pile_set_name": "Github"
} |
// Copyright © 2014 Steve Francia <spf@spf13.com>.
//
// 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 mem
type Dir interface {
Len() int
Names() []string
Files() []*FileData
Add(*FileData)
Remove(*FileData)
}
func RemoveFromMemDir(dir *FileData, f *FileData) {
dir.memDir.Remove(f)
}
func AddToMemDir(dir *FileData, f *FileData) {
dir.memDir.Add(f)
}
func InitializeDir(d *FileData) {
if d.memDir == nil {
d.dir = true
d.memDir = &DirMap{}
}
}
| {
"pile_set_name": "Github"
} |
@* #form-myfield *@
@(elements: helper.FieldElements)
<div class="@if(elements.hasErrors) {error}">
<label for="@elements.id">@elements.label</label>
<div class="input">
@elements.input
<span class="errors">@elements.errors.mkString(", ")</span>
<span class="help">@elements.infos.mkString(", ")</span>
</div>
</div>
@* #form-myfield *@
--foo--
the above is here so the tests can check this field constructor was used.
| {
"pile_set_name": "Github"
} |
/**
* Copyright 2007 DFKI GmbH.
* All Rights Reserved. Use is subject to license terms.
* <p/>
* This file is part of MARY TTS.
* <p/>
* MARY TTS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 3 of the License.
* <p/>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
* <p/>
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package marytts.signalproc.adaptation.smoothing;
import java.io.FileNotFoundException;
import java.io.IOException;
import marytts.util.io.FileUtils;
import marytts.util.io.MaryRandomAccessFile;
/**
* @author Oytun Türk
*/
public class SmoothingFile {
public static final int NOT_OPENED = 0;
public static final int OPEN_FOR_WRITE = 1;
public static final int OPEN_FOR_READ = 2;
public int status;
public int smoothingMethod;
private MaryRandomAccessFile stream;
private int totalEntries;
public SmoothingFile(String filename, int desiredStatus) {
this(filename, desiredStatus, SmoothingDefinitions.NO_SMOOTHING);
}
public SmoothingFile(String filename, int desiredStatus, int smoothingMethodIn) //smoothingMethod only effective when writing to file
{
status = NOT_OPENED;
stream = null;
totalEntries = 0;
smoothingMethod = smoothingMethodIn;
if (desiredStatus == OPEN_FOR_READ) {
status = desiredStatus;
try {
stream = new MaryRandomAccessFile(filename, "r");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (desiredStatus == OPEN_FOR_WRITE) {
FileUtils.delete(filename);
status = desiredStatus;
try {
stream = new MaryRandomAccessFile(filename, "rw");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void writeHeader() {
if (status == OPEN_FOR_WRITE) {
try {
stream.seek(0);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
stream.writeInt(totalEntries);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
stream.writeInt(smoothingMethod);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void readHeader() {
if (status == OPEN_FOR_READ) {
try {
stream.seek(0);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
totalEntries = stream.readInt();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
smoothingMethod = stream.readInt();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void writeSingle(double[] x) {
writeSingle(x, x.length);
}
public void writeSingle(double[] x, int len) {
try {
stream.writeInt(Math.min(x.length, len));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
stream.writeDouble(x, 0, Math.min(x.length, len));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
incrementTotalEntries();
}
public void writeAll(double[][] x) {
totalEntries = 0;
writeHeader();
for (int i = 0; i < x.length; i++)
writeSingle(x[i]);
close();
}
public void incrementTotalEntries() {
if (status == OPEN_FOR_WRITE) {
try {
long currentPos = stream.getFilePointer();
stream.seek(0);
totalEntries = stream.readInt();
totalEntries++;
//System.out.println(String.valueOf(totalEntries));
stream.seek(0);
stream.writeInt(totalEntries);
stream.seek(currentPos);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public double[] readSingle() {
double[] x = null;
if (status == OPEN_FOR_READ) {
int len = 0;
try {
len = stream.readInt();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
if (len > 0) {
try {
x = stream.readDouble(len);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return x;
}
public double[][] readAll() {
double[][] x = null;
if (status == OPEN_FOR_READ) {
readHeader();
if (totalEntries > 0) {
x = new double[totalEntries][];
for (int i = 0; i < totalEntries; i++)
x[i] = readSingle();
}
close();
}
return x;
}
public void close() {
if (status != NOT_OPENED) {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
stream = null;
status = NOT_OPENED;
}
}
}
| {
"pile_set_name": "Github"
} |
#import <Foundation/Foundation.h>
@interface PodsDummy_RxCocoa : NSObject
@end
@implementation PodsDummy_RxCocoa
@end
| {
"pile_set_name": "Github"
} |
// Copyright 2013 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.
#ifndef UTIL_BTREE_BTREE_CONTAINER_H__
#define UTIL_BTREE_BTREE_CONTAINER_H__
#include <iosfwd>
#include <utility>
#include "btree.h"
namespace btree {
// A common base class for btree_set, btree_map, btree_multiset and
// btree_multimap.
template <typename Tree>
class btree_container {
typedef btree_container<Tree> self_type;
public:
typedef typename Tree::params_type params_type;
typedef typename Tree::key_type key_type;
typedef typename Tree::value_type value_type;
typedef typename Tree::key_compare key_compare;
typedef typename Tree::allocator_type allocator_type;
typedef typename Tree::pointer pointer;
typedef typename Tree::const_pointer const_pointer;
typedef typename Tree::reference reference;
typedef typename Tree::const_reference const_reference;
typedef typename Tree::size_type size_type;
typedef typename Tree::difference_type difference_type;
typedef typename Tree::iterator iterator;
typedef typename Tree::const_iterator const_iterator;
typedef typename Tree::reverse_iterator reverse_iterator;
typedef typename Tree::const_reverse_iterator const_reverse_iterator;
public:
// Default constructor.
btree_container(const key_compare &comp, const allocator_type &alloc)
: tree_(comp, alloc) {
}
// Copy constructor.
btree_container(const self_type &x)
: tree_(x.tree_) {
}
// Iterator routines.
iterator begin() {
return tree_.begin();
}
const_iterator begin() const {
return tree_.begin();
}
iterator end() {
return tree_.end();
}
const_iterator end() const {
return tree_.end();
}
reverse_iterator rbegin() {
return tree_.rbegin();
}
const_reverse_iterator rbegin() const {
return tree_.rbegin();
}
reverse_iterator rend() {
return tree_.rend();
}
const_reverse_iterator rend() const {
return tree_.rend();
}
// Lookup routines.
iterator lower_bound(const key_type &key) {
return tree_.lower_bound(key);
}
const_iterator lower_bound(const key_type &key) const {
return tree_.lower_bound(key);
}
iterator upper_bound(const key_type &key) {
return tree_.upper_bound(key);
}
const_iterator upper_bound(const key_type &key) const {
return tree_.upper_bound(key);
}
std::pair<iterator,iterator> equal_range(const key_type &key) {
return tree_.equal_range(key);
}
std::pair<const_iterator,const_iterator> equal_range(const key_type &key) const {
return tree_.equal_range(key);
}
// Utility routines.
void clear() {
tree_.clear();
}
void swap(self_type &x) {
tree_.swap(x.tree_);
}
void dump(std::ostream &os) const {
tree_.dump(os);
}
void verify() const {
tree_.verify();
}
// Size routines.
size_type size() const {
return tree_.size();
}
size_type max_size() const {
return tree_.max_size();
}
bool empty() const {
return tree_.empty();
}
size_type height() const {
return tree_.height();
}
size_type internal_nodes() const {
return tree_.internal_nodes();
}
size_type leaf_nodes() const {
return tree_.leaf_nodes();
}
size_type nodes() const {
return tree_.nodes();
}
size_type bytes_used() const {
return tree_.bytes_used();
}
static double average_bytes_per_value() {
return Tree::average_bytes_per_value();
}
double fullness() const {
return tree_.fullness();
}
double overhead() const {
return tree_.overhead();
}
bool operator==(const self_type& x) const {
if (size() != x.size()) {
return false;
}
for (const_iterator i = begin(), xi = x.begin(); i != end(); ++i, ++xi) {
if (*i != *xi) {
return false;
}
}
return true;
}
bool operator!=(const self_type& other) const {
return !operator==(other);
}
protected:
Tree tree_;
};
template <typename T>
inline std::ostream& operator<<(std::ostream &os, const btree_container<T> &b) {
b.dump(os);
return os;
}
// A common base class for btree_set and safe_btree_set.
template <typename Tree>
class btree_unique_container : public btree_container<Tree> {
typedef btree_unique_container<Tree> self_type;
typedef btree_container<Tree> super_type;
public:
typedef typename Tree::key_type key_type;
typedef typename Tree::value_type value_type;
typedef typename Tree::size_type size_type;
typedef typename Tree::key_compare key_compare;
typedef typename Tree::allocator_type allocator_type;
typedef typename Tree::iterator iterator;
typedef typename Tree::const_iterator const_iterator;
public:
// Default constructor.
btree_unique_container(const key_compare &comp = key_compare(),
const allocator_type &alloc = allocator_type())
: super_type(comp, alloc) {
}
// Copy constructor.
btree_unique_container(const self_type &x)
: super_type(x) {
}
// Range constructor.
template <class InputIterator>
btree_unique_container(InputIterator b, InputIterator e,
const key_compare &comp = key_compare(),
const allocator_type &alloc = allocator_type())
: super_type(comp, alloc) {
insert(b, e);
}
// Lookup routines.
iterator find(const key_type &key) {
return this->tree_.find_unique(key);
}
const_iterator find(const key_type &key) const {
return this->tree_.find_unique(key);
}
size_type count(const key_type &key) const {
return this->tree_.count_unique(key);
}
// Insertion routines.
std::pair<iterator,bool> insert(const value_type &x) {
return this->tree_.insert_unique(x);
}
iterator insert(iterator position, const value_type &x) {
return this->tree_.insert_unique(position, x);
}
template <typename InputIterator>
void insert(InputIterator b, InputIterator e) {
this->tree_.insert_unique(b, e);
}
// Deletion routines.
int erase(const key_type &key) {
return this->tree_.erase_unique(key);
}
// Erase the specified iterator from the btree. The iterator must be valid
// (i.e. not equal to end()). Return an iterator pointing to the node after
// the one that was erased (or end() if none exists).
iterator erase(const iterator &iter) {
return this->tree_.erase(iter);
}
void erase(const iterator &first, const iterator &last) {
this->tree_.erase(first, last);
}
};
// A common base class for btree_map and safe_btree_map.
template <typename Tree>
class btree_map_container : public btree_unique_container<Tree> {
typedef btree_map_container<Tree> self_type;
typedef btree_unique_container<Tree> super_type;
public:
typedef typename Tree::key_type key_type;
typedef typename Tree::data_type data_type;
typedef typename Tree::value_type value_type;
typedef typename Tree::mapped_type mapped_type;
typedef typename Tree::key_compare key_compare;
typedef typename Tree::allocator_type allocator_type;
private:
// A pointer-like object which only generates its value when
// dereferenced. Used by operator[] to avoid constructing an empty data_type
// if the key already exists in the map.
struct generate_value {
generate_value(const key_type &k)
: key(k) {
}
value_type operator*() const {
return std::make_pair(key, data_type());
}
const key_type &key;
};
public:
// Default constructor.
btree_map_container(const key_compare &comp = key_compare(),
const allocator_type &alloc = allocator_type())
: super_type(comp, alloc) {
}
// Copy constructor.
btree_map_container(const self_type &x)
: super_type(x) {
}
// Range constructor.
template <class InputIterator>
btree_map_container(InputIterator b, InputIterator e,
const key_compare &comp = key_compare(),
const allocator_type &alloc = allocator_type())
: super_type(b, e, comp, alloc) {
}
// Insertion routines.
data_type& operator[](const key_type &key) {
return this->tree_.insert_unique(key, generate_value(key)).first->second;
}
};
// A common base class for btree_multiset and btree_multimap.
template <typename Tree>
class btree_multi_container : public btree_container<Tree> {
typedef btree_multi_container<Tree> self_type;
typedef btree_container<Tree> super_type;
public:
typedef typename Tree::key_type key_type;
typedef typename Tree::value_type value_type;
typedef typename Tree::size_type size_type;
typedef typename Tree::key_compare key_compare;
typedef typename Tree::allocator_type allocator_type;
typedef typename Tree::iterator iterator;
typedef typename Tree::const_iterator const_iterator;
public:
// Default constructor.
btree_multi_container(const key_compare &comp = key_compare(),
const allocator_type &alloc = allocator_type())
: super_type(comp, alloc) {
}
// Copy constructor.
btree_multi_container(const self_type &x)
: super_type(x) {
}
// Range constructor.
template <class InputIterator>
btree_multi_container(InputIterator b, InputIterator e,
const key_compare &comp = key_compare(),
const allocator_type &alloc = allocator_type())
: super_type(comp, alloc) {
insert(b, e);
}
// Lookup routines.
iterator find(const key_type &key) {
return this->tree_.find_multi(key);
}
const_iterator find(const key_type &key) const {
return this->tree_.find_multi(key);
}
size_type count(const key_type &key) const {
return this->tree_.count_multi(key);
}
// Insertion routines.
iterator insert(const value_type &x) {
return this->tree_.insert_multi(x);
}
iterator insert(iterator position, const value_type &x) {
return this->tree_.insert_multi(position, x);
}
template <typename InputIterator>
void insert(InputIterator b, InputIterator e) {
this->tree_.insert_multi(b, e);
}
// Deletion routines.
int erase(const key_type &key) {
return this->tree_.erase_multi(key);
}
// Erase the specified iterator from the btree. The iterator must be valid
// (i.e. not equal to end()). Return an iterator pointing to the node after
// the one that was erased (or end() if none exists).
iterator erase(const iterator &iter) {
return this->tree_.erase(iter);
}
void erase(const iterator &first, const iterator &last) {
this->tree_.erase(first, last);
}
};
} // namespace btree
#endif // UTIL_BTREE_BTREE_CONTAINER_H__
| {
"pile_set_name": "Github"
} |
<?php
namespace Silber\Bouncer\Contracts;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
interface Scope
{
/**
* Append the tenant ID to the given cache key.
*
* @param string $key
* @return string
*/
public function appendToCacheKey($key);
/**
* Scope the given model to the current tenant.
*
* @param \Illuminate\Database\Eloquent\Model $model
* @return \Illuminate\Database\Eloquent\Model
*/
public function applyToModel(Model $model);
/**
* Scope the given model query to the current tenant.
*
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query
* @param string|null $table
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
*/
public function applyToModelQuery($query, $table = null);
/**
* Scope the given relationship query to the current tenant.
*
* @param \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder $query
* @param string $table
* @return \Illuminate\Database\Query\Builder|\Illuminate\Database\Eloquent\Builder
*/
public function applyToRelationQuery($query, $table);
/**
* Scope the given relation to the current tenant.
*
* @param \Illuminate\Database\Eloquent\Relations\BelongsToMany $relation
* @return \Illuminate\Database\Eloquent\Relations\BelongsToMany
*/
public function applyToRelation(BelongsToMany $relation);
/**
* Get the current scope value.
*
* @return mixed
*/
public function get();
/**
* Get the additional attributes for pivot table records.
*
* @param string|null $authority
* @return array
*/
public function getAttachAttributes($authority = null);
/**
* Run the given callback with the given temporary scope.
*
* @param mixed $scope
* @param callable $callback
* @return mixed
*/
public function onceTo($scope, callable $callback);
/**
* Remove the scope completely.
*
* @return $this
*/
public function remove();
/**
* Run the given callback without the scope applied.
*
* @param callable $callback
* @return mixed
*/
public function removeOnce(callable $callback);
}
| {
"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.cordova;
import java.util.ArrayList;
import java.util.Locale;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.Activity;
import android.app.AlertDialog;
import android.annotation.SuppressLint;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.media.AudioManager;
import android.os.Build;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.webkit.WebViewClient;
import android.widget.FrameLayout;
/**
* This class is the main Android activity that represents the Cordova
* application. It should be extended by the user to load the specific
* html file that contains the application.
*
* As an example:
*
* <pre>
* package org.apache.cordova.examples;
*
* import android.os.Bundle;
* import org.apache.cordova.*;
*
* public class Example extends CordovaActivity {
* @Override
* public void onCreate(Bundle savedInstanceState) {
* super.onCreate(savedInstanceState);
* super.init();
* // Load your application
* loadUrl(launchUrl);
* }
* }
* </pre>
*
* Cordova xml configuration: Cordova uses a configuration file at
* res/xml/config.xml to specify its settings. See "The config.xml File"
* guide in cordova-docs at http://cordova.apache.org/docs for the documentation
* for the configuration. The use of the set*Property() methods is
* deprecated in favor of the config.xml file.
*
*/
public class CordovaActivity extends Activity {
public static String TAG = "CordovaActivity";
// The webview for our app
protected CordovaWebView appView;
private static int ACTIVITY_STARTING = 0;
private static int ACTIVITY_RUNNING = 1;
private static int ACTIVITY_EXITING = 2;
// Keep app running when pause is received. (default = true)
// If true, then the JavaScript and native code continue to run in the background
// when another application (activity) is started.
protected boolean keepRunning = true;
// Flag to keep immersive mode if set to fullscreen
protected boolean immersiveMode;
// Read from config.xml:
protected CordovaPreferences preferences;
protected String launchUrl;
protected ArrayList<PluginEntry> pluginEntries;
protected CordovaInterfaceImpl cordovaInterface;
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
// need to activate preferences before super.onCreate to avoid "requestFeature() must be called before adding content" exception
loadConfig();
String logLevel = preferences.getString("loglevel", "ERROR");
LOG.setLogLevel(logLevel);
LOG.i(TAG, "Apache Cordova native platform version " + CordovaWebView.CORDOVA_VERSION + " is starting");
LOG.d(TAG, "CordovaActivity.onCreate()");
if (!preferences.getBoolean("ShowTitle", false)) {
getWindow().requestFeature(Window.FEATURE_NO_TITLE);
}
if (preferences.getBoolean("SetFullscreen", false)) {
LOG.d(TAG, "The SetFullscreen configuration is deprecated in favor of Fullscreen, and will be removed in a future version.");
preferences.set("Fullscreen", true);
}
if (preferences.getBoolean("Fullscreen", false)) {
// NOTE: use the FullscreenNotImmersive configuration key to set the activity in a REAL full screen
// (as was the case in previous cordova versions)
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) && !preferences.getBoolean("FullscreenNotImmersive", false)) {
immersiveMode = true;
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
} else {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
}
super.onCreate(savedInstanceState);
cordovaInterface = makeCordovaInterface();
if (savedInstanceState != null) {
cordovaInterface.restoreInstanceState(savedInstanceState);
}
}
protected void init() {
appView = makeWebView();
createViews();
if (!appView.isInitialized()) {
appView.init(cordovaInterface, pluginEntries, preferences);
}
cordovaInterface.onCordovaInit(appView.getPluginManager());
// Wire the hardware volume controls to control media if desired.
String volumePref = preferences.getString("DefaultVolumeStream", "");
if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
setVolumeControlStream(AudioManager.STREAM_MUSIC);
}
}
@SuppressWarnings("deprecation")
protected void loadConfig() {
ConfigXmlParser parser = new ConfigXmlParser();
parser.parse(this);
preferences = parser.getPreferences();
preferences.setPreferencesBundle(getIntent().getExtras());
launchUrl = parser.getLaunchUrl();
pluginEntries = parser.getPluginEntries();
Config.parser = parser;
}
//Suppressing warnings in AndroidStudio
@SuppressWarnings({"deprecation", "ResourceType"})
protected void createViews() {
//Why are we setting a constant as the ID? This should be investigated
appView.getView().setId(100);
appView.getView().setLayoutParams(new FrameLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
setContentView(appView.getView());
if (preferences.contains("BackgroundColor")) {
try {
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
// Background of activity:
appView.getView().setBackgroundColor(backgroundColor);
}
catch (NumberFormatException e){
e.printStackTrace();
}
}
appView.getView().requestFocusFromTouch();
}
/**
* Construct the default web view object.
* <p/>
* Override this to customize the webview that is used.
*/
protected CordovaWebView makeWebView() {
return new CordovaWebViewImpl(makeWebViewEngine());
}
protected CordovaWebViewEngine makeWebViewEngine() {
return CordovaWebViewImpl.createEngine(this, preferences);
}
protected CordovaInterfaceImpl makeCordovaInterface() {
return new CordovaInterfaceImpl(this) {
@Override
public Object onMessage(String id, Object data) {
// Plumb this to CordovaActivity.onMessage for backwards compatibility
return CordovaActivity.this.onMessage(id, data);
}
};
}
/**
* Load the url into the webview.
*/
public void loadUrl(String url) {
if (appView == null) {
init();
}
// If keepRunning
this.keepRunning = preferences.getBoolean("KeepRunning", true);
appView.loadUrlIntoView(url, true);
}
/**
* Called when the system is about to start resuming a previous activity.
*/
@Override
protected void onPause() {
super.onPause();
LOG.d(TAG, "Paused the activity.");
if (this.appView != null) {
// CB-9382 If there is an activity that started for result and main activity is waiting for callback
// result, we shoudn't stop WebView Javascript timers, as activity for result might be using them
boolean keepRunning = this.keepRunning || this.cordovaInterface.activityResultCallback != null;
this.appView.handlePause(keepRunning);
}
}
/**
* Called when the activity receives a new intent
*/
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
//Forward to plugins
if (this.appView != null)
this.appView.onNewIntent(intent);
}
/**
* Called when the activity will start interacting with the user.
*/
@Override
protected void onResume() {
super.onResume();
LOG.d(TAG, "Resumed the activity.");
if (this.appView == null) {
return;
}
// Force window to have focus, so application always
// receive user input. Workaround for some devices (Samsung Galaxy Note 3 at least)
this.getWindow().getDecorView().requestFocus();
this.appView.handleResume(this.keepRunning);
}
/**
* Called when the activity is no longer visible to the user.
*/
@Override
protected void onStop() {
super.onStop();
LOG.d(TAG, "Stopped the activity.");
if (this.appView == null) {
return;
}
this.appView.handleStop();
}
/**
* Called when the activity is becoming visible to the user.
*/
@Override
protected void onStart() {
super.onStart();
LOG.d(TAG, "Started the activity.");
if (this.appView == null) {
return;
}
this.appView.handleStart();
}
/**
* The final call you receive before your activity is destroyed.
*/
@Override
public void onDestroy() {
LOG.d(TAG, "CordovaActivity.onDestroy()");
super.onDestroy();
if (this.appView != null) {
appView.handleDestroy();
}
}
/**
* Called when view focus is changed
*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus && immersiveMode) {
final int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
getWindow().getDecorView().setSystemUiVisibility(uiOptions);
}
}
@SuppressLint("NewApi")
@Override
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
// Capture requestCode here so that it is captured in the setActivityResultCallback() case.
cordovaInterface.setActivityResultRequestCode(requestCode);
super.startActivityForResult(intent, requestCode, options);
}
/**
* Called when an activity you launched exits, giving you the requestCode you started it with,
* the resultCode it returned, and any additional data from it.
*
* @param requestCode The request code originally supplied to startActivityForResult(),
* allowing you to identify who this result came from.
* @param resultCode The integer result code returned by the child activity through its setResult().
* @param intent An Intent, which can return result data to the caller (various data can be attached to Intent "extras").
*/
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
LOG.d(TAG, "Incoming Result. Request code = " + requestCode);
super.onActivityResult(requestCode, resultCode, intent);
cordovaInterface.onActivityResult(requestCode, resultCode, intent);
}
/**
* Report an error to the host application. These errors are unrecoverable (i.e. the main resource is unavailable).
* The errorCode parameter corresponds to one of the ERROR_* constants.
*
* @param errorCode The error code corresponding to an ERROR_* value.
* @param description A String describing the error.
* @param failingUrl The url that failed to load.
*/
public void onReceivedError(final int errorCode, final String description, final String failingUrl) {
final CordovaActivity me = this;
// If errorUrl specified, then load it
final String errorUrl = preferences.getString("errorUrl", null);
if ((errorUrl != null) && (!failingUrl.equals(errorUrl)) && (appView != null)) {
// Load URL on UI thread
me.runOnUiThread(new Runnable() {
public void run() {
me.appView.showWebPage(errorUrl, false, true, null);
}
});
}
// If not, then display error dialog
else {
final boolean exit = !(errorCode == WebViewClient.ERROR_HOST_LOOKUP);
me.runOnUiThread(new Runnable() {
public void run() {
if (exit) {
me.appView.getView().setVisibility(View.GONE);
me.displayError("Application Error", description + " (" + failingUrl + ")", "OK", exit);
}
}
});
}
}
/**
* Display an error dialog and optionally exit application.
*/
public void displayError(final String title, final String message, final String button, final boolean exit) {
final CordovaActivity me = this;
me.runOnUiThread(new Runnable() {
public void run() {
try {
AlertDialog.Builder dlg = new AlertDialog.Builder(me);
dlg.setMessage(message);
dlg.setTitle(title);
dlg.setCancelable(false);
dlg.setPositiveButton(button,
new AlertDialog.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
if (exit) {
finish();
}
}
});
dlg.create();
dlg.show();
} catch (Exception e) {
finish();
}
}
});
}
/*
* Hook in Cordova for menu plugins
*/
@Override
public boolean onCreateOptionsMenu(Menu menu) {
if (appView != null) {
appView.getPluginManager().postMessage("onCreateOptionsMenu", menu);
}
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
if (appView != null) {
appView.getPluginManager().postMessage("onPrepareOptionsMenu", menu);
}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (appView != null) {
appView.getPluginManager().postMessage("onOptionsItemSelected", item);
}
return true;
}
/**
* Called when a message is sent to plugin.
*
* @param id The message id
* @param data The message data
* @return Object or null
*/
public Object onMessage(String id, Object data) {
if ("onReceivedError".equals(id)) {
JSONObject d = (JSONObject) data;
try {
this.onReceivedError(d.getInt("errorCode"), d.getString("description"), d.getString("url"));
} catch (JSONException e) {
e.printStackTrace();
}
} else if ("exit".equals(id)) {
finish();
}
return null;
}
protected void onSaveInstanceState(Bundle outState) {
cordovaInterface.onSaveInstanceState(outState);
super.onSaveInstanceState(outState);
}
/**
* Called by the system when the device configuration changes while your activity is running.
*
* @param newConfig The new device configuration
*/
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
if (this.appView == null) {
return;
}
PluginManager pm = this.appView.getPluginManager();
if (pm != null) {
pm.onConfigurationChanged(newConfig);
}
}
/**
* Called by the system when the user grants permissions
*
* @param requestCode
* @param permissions
* @param grantResults
*/
@Override
public void onRequestPermissionsResult(int requestCode, String permissions[],
int[] grantResults) {
try
{
cordovaInterface.onRequestPermissionResult(requestCode, permissions, grantResults);
}
catch (JSONException e)
{
LOG.d(TAG, "JSONException: Parameters fed into the method are not valid");
e.printStackTrace();
}
}
}
| {
"pile_set_name": "Github"
} |
/*
* Copyright (c) 2005 Jakub Jermar
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* - The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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.
*/
/** @addtogroup kernel_sparc64
* @{
*/
/** @file
*/
#ifndef KERN_sparc64_sun4u_CPU_H_
#define KERN_sparc64_sun4u_CPU_H_
#define MANUF_FUJITSU 0x04
#define MANUF_ULTRASPARC 0x17 /**< UltraSPARC I, UltraSPARC II */
#define MANUF_SUN 0x3e
#define IMPL_ULTRASPARCI 0x10
#define IMPL_ULTRASPARCII 0x11
#define IMPL_ULTRASPARCII_I 0x12
#define IMPL_ULTRASPARCII_E 0x13
#define IMPL_ULTRASPARCIII 0x14
#define IMPL_ULTRASPARCIII_PLUS 0x15
#define IMPL_ULTRASPARCIII_I 0x16
#define IMPL_ULTRASPARCIV 0x18
#define IMPL_ULTRASPARCIV_PLUS 0x19
#define IMPL_SPARC64V 0x5
#ifndef __ASSEMBLER__
#include <arch/register.h>
#include <arch/regdef.h>
#include <arch/asm.h>
#include <arch/arch.h>
#include <stdint.h>
#include <trace.h>
typedef struct {
/** Processor ID as read from UPA_CONFIG/FIREPLANE_CONFIG. */
uint32_t mid;
ver_reg_t ver;
/** Processor frequency in Hz. */
uint32_t clock_frequency;
/** Next clock interrupt should be generated when the TICK register
* matches this value.
*/
uint64_t next_tick_cmpr;
} cpu_arch_t;
/** Read the module ID (agent ID/CPUID) of the current CPU.
*
*/
_NO_TRACE static inline uint32_t read_mid(void)
{
uint64_t icbus_config = asi_u64_read(ASI_ICBUS_CONFIG, 0);
icbus_config = icbus_config >> ICBUS_CONFIG_MID_SHIFT;
#if defined (US)
return icbus_config & 0x1f;
#elif defined (US3)
if (((ver_reg_t) ver_read()).impl == IMPL_ULTRASPARCIII_I)
return icbus_config & 0x1f;
else
return icbus_config & 0x3ff;
#endif
}
#endif
#endif
/** @}
*/
| {
"pile_set_name": "Github"
} |
/*
* DateJS Culture String File
* Country Code: nn-NO
* Name: Norwegian, Nynorsk (Norway)
* Format: "key" : "value"
* Key is the en-US term, Value is the Key in the current language.
*/
Date.CultureStrings = Date.CultureStrings || {};
Date.CultureStrings["nn-NO"] = {
"name": "nn-NO",
"englishName": "Norwegian, Nynorsk (Norway)",
"nativeName": "norsk, nynorsk (Noreg)",
"Sunday": "søndag",
"Monday": "måndag",
"Tuesday": "tysdag",
"Wednesday": "onsdag",
"Thursday": "torsdag",
"Friday": "fredag",
"Saturday": "laurdag",
"Sun": "sø",
"Mon": "må",
"Tue": "ty",
"Wed": "on",
"Thu": "to",
"Fri": "fr",
"Sat": "la",
"Su": "sø",
"Mo": "må",
"Tu": "ty",
"We": "on",
"Th": "to",
"Fr": "fr",
"Sa": "la",
"S_Sun_Initial": "s",
"M_Mon_Initial": "m",
"T_Tue_Initial": "t",
"W_Wed_Initial": "o",
"T_Thu_Initial": "t",
"F_Fri_Initial": "f",
"S_Sat_Initial": "l",
"January": "januar",
"February": "februar",
"March": "mars",
"April": "april",
"May": "mai",
"June": "juni",
"July": "juli",
"August": "august",
"September": "september",
"October": "oktober",
"November": "november",
"December": "desember",
"Jan_Abbr": "jan",
"Feb_Abbr": "feb",
"Mar_Abbr": "mar",
"Apr_Abbr": "apr",
"May_Abbr": "mai",
"Jun_Abbr": "jun",
"Jul_Abbr": "jul",
"Aug_Abbr": "aug",
"Sep_Abbr": "sep",
"Oct_Abbr": "okt",
"Nov_Abbr": "nov",
"Dec_Abbr": "des",
"AM": "",
"PM": "",
"firstDayOfWeek": 1,
"twoDigitYearMax": 2029,
"mdy": "dmy",
"M/d/yyyy": "dd.MM.yyyy",
"dddd, MMMM dd, yyyy": "d. MMMM yyyy",
"h:mm tt": "HH:mm",
"h:mm:ss tt": "HH:mm:ss",
"dddd, MMMM dd, yyyy h:mm:ss tt": "d. MMMM yyyy HH:mm:ss",
"yyyy-MM-ddTHH:mm:ss": "yyyy-MM-ddTHH:mm:ss",
"yyyy-MM-dd HH:mm:ssZ": "yyyy-MM-dd HH:mm:ssZ",
"ddd, dd MMM yyyy HH:mm:ss": "ddd, dd MMM yyyy HH:mm:ss",
"MMMM dd": "d. MMMM",
"MMMM, yyyy": "MMMM yyyy",
"/jan(uary)?/": "jan(uar)?",
"/feb(ruary)?/": "feb(ruar)?",
"/mar(ch)?/": "mar(s)?",
"/apr(il)?/": "apr(il)?",
"/may/": "mai",
"/jun(e)?/": "jun(i)?",
"/jul(y)?/": "jul(i)?",
"/aug(ust)?/": "aug(ust)?",
"/sep(t(ember)?)?/": "sep(t(ember)?)?",
"/oct(ober)?/": "okt(ober)?",
"/nov(ember)?/": "nov(ember)?",
"/dec(ember)?/": "des(ember)?",
"/^su(n(day)?)?/": "^søndag",
"/^mo(n(day)?)?/": "^måndag",
"/^tu(e(s(day)?)?)?/": "^tysdag",
"/^we(d(nesday)?)?/": "^onsdag",
"/^th(u(r(s(day)?)?)?)?/": "^torsdag",
"/^fr(i(day)?)?/": "^fredag",
"/^sa(t(urday)?)?/": "^laurdag",
"/^next/": "^next",
"/^last|past|prev(ious)?/": "^last|past|prev(ious)?",
"/^(\\+|aft(er)?|from|hence)/": "^(\\+|aft(er)?|from|hence)",
"/^(\\-|bef(ore)?|ago)/": "^(\\-|bef(ore)?|ago)",
"/^yes(terday)?/": "^yes(terday)?",
"/^t(od(ay)?)?/": "^t(od(ay)?)?",
"/^tom(orrow)?/": "^tom(orrow)?",
"/^n(ow)?/": "^n(ow)?",
"/^ms|milli(second)?s?/": "^ms|milli(second)?s?",
"/^sec(ond)?s?/": "^sec(ond)?s?",
"/^mn|min(ute)?s?/": "^mn|min(ute)?s?",
"/^h(our)?s?/": "^h(our)?s?",
"/^w(eek)?s?/": "^w(eek)?s?",
"/^m(onth)?s?/": "^m(onth)?s?",
"/^d(ay)?s?/": "^d(ay)?s?",
"/^y(ear)?s?/": "^y(ear)?s?",
"/^(a|p)/": "^(a|p)",
"/^(a\\.?m?\\.?|p\\.?m?\\.?)/": "^(a\\.?m?\\.?|p\\.?m?\\.?)",
"/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)/": "^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\\s*(\\+|\\-)\\s*\\d\\d\\d\\d?)|gmt|utc)",
"/^\\s*(st|nd|rd|th)/": "^\\s*(st|nd|rd|th)",
"/^\\s*(\\:|a(?!u|p)|p)/": "^\\s*(\\:|a(?!u|p)|p)",
"LINT": "LINT",
"TOT": "TOT",
"CHAST": "CHAST",
"NZST": "NZST",
"NFT": "NFT",
"SBT": "SBT",
"AEST": "AEST",
"ACST": "ACST",
"JST": "JST",
"CWST": "CWST",
"CT": "CT",
"ICT": "ICT",
"MMT": "MMT",
"BIOT": "BST",
"NPT": "NPT",
"IST": "IST",
"PKT": "PKT",
"AFT": "AFT",
"MSK": "MSK",
"IRST": "IRST",
"FET": "FET",
"EET": "EET",
"CET": "CET",
"UTC": "UTC",
"GMT": "GMT",
"CVT": "CVT",
"GST": "GST",
"BRT": "BRT",
"NST": "NST",
"AST": "AST",
"EST": "EST",
"CST": "CST",
"MST": "MST",
"PST": "PST",
"AKST": "AKST",
"MIT": "MIT",
"HST": "HST",
"SST": "SST",
"BIT": "BIT",
"CHADT": "CHADT",
"NZDT": "NZDT",
"AEDT": "AEDT",
"ACDT": "ACDT",
"AZST": "AZST",
"IRDT": "IRDT",
"EEST": "EEST",
"CEST": "CEST",
"BST": "BST",
"PMDT": "PMDT",
"ADT": "ADT",
"NDT": "NDT",
"EDT": "EDT",
"CDT": "CDT",
"MDT": "MDT",
"PDT": "PDT",
"AKDT": "AKDT",
"HADT": "HADT"
};
Date.CultureStrings.lang = "nn-NO";
| {
"pile_set_name": "Github"
} |
// mksysnum_openbsd.pl
// MACHINE GENERATED BY THE ABOVE COMMAND; DO NOT EDIT
// +build amd64,openbsd
package unix
const (
SYS_EXIT = 1 // { void sys_exit(int rval); }
SYS_FORK = 2 // { int sys_fork(void); }
SYS_READ = 3 // { ssize_t sys_read(int fd, void *buf, size_t nbyte); }
SYS_WRITE = 4 // { ssize_t sys_write(int fd, const void *buf, \
SYS_OPEN = 5 // { int sys_open(const char *path, \
SYS_CLOSE = 6 // { int sys_close(int fd); }
SYS___TFORK = 8 // { int sys___tfork(const struct __tfork *param, \
SYS_LINK = 9 // { int sys_link(const char *path, const char *link); }
SYS_UNLINK = 10 // { int sys_unlink(const char *path); }
SYS_WAIT4 = 11 // { pid_t sys_wait4(pid_t pid, int *status, \
SYS_CHDIR = 12 // { int sys_chdir(const char *path); }
SYS_FCHDIR = 13 // { int sys_fchdir(int fd); }
SYS_MKNOD = 14 // { int sys_mknod(const char *path, mode_t mode, \
SYS_CHMOD = 15 // { int sys_chmod(const char *path, mode_t mode); }
SYS_CHOWN = 16 // { int sys_chown(const char *path, uid_t uid, \
SYS_OBREAK = 17 // { int sys_obreak(char *nsize); } break
SYS_GETDTABLECOUNT = 18 // { int sys_getdtablecount(void); }
SYS_GETRUSAGE = 19 // { int sys_getrusage(int who, \
SYS_GETPID = 20 // { pid_t sys_getpid(void); }
SYS_MOUNT = 21 // { int sys_mount(const char *type, const char *path, \
SYS_UNMOUNT = 22 // { int sys_unmount(const char *path, int flags); }
SYS_SETUID = 23 // { int sys_setuid(uid_t uid); }
SYS_GETUID = 24 // { uid_t sys_getuid(void); }
SYS_GETEUID = 25 // { uid_t sys_geteuid(void); }
SYS_PTRACE = 26 // { int sys_ptrace(int req, pid_t pid, caddr_t addr, \
SYS_RECVMSG = 27 // { ssize_t sys_recvmsg(int s, struct msghdr *msg, \
SYS_SENDMSG = 28 // { ssize_t sys_sendmsg(int s, \
SYS_RECVFROM = 29 // { ssize_t sys_recvfrom(int s, void *buf, size_t len, \
SYS_ACCEPT = 30 // { int sys_accept(int s, struct sockaddr *name, \
SYS_GETPEERNAME = 31 // { int sys_getpeername(int fdes, struct sockaddr *asa, \
SYS_GETSOCKNAME = 32 // { int sys_getsockname(int fdes, struct sockaddr *asa, \
SYS_ACCESS = 33 // { int sys_access(const char *path, int flags); }
SYS_CHFLAGS = 34 // { int sys_chflags(const char *path, u_int flags); }
SYS_FCHFLAGS = 35 // { int sys_fchflags(int fd, u_int flags); }
SYS_SYNC = 36 // { void sys_sync(void); }
SYS_KILL = 37 // { int sys_kill(int pid, int signum); }
SYS_STAT = 38 // { int sys_stat(const char *path, struct stat *ub); }
SYS_GETPPID = 39 // { pid_t sys_getppid(void); }
SYS_LSTAT = 40 // { int sys_lstat(const char *path, struct stat *ub); }
SYS_DUP = 41 // { int sys_dup(int fd); }
SYS_FSTATAT = 42 // { int sys_fstatat(int fd, const char *path, \
SYS_GETEGID = 43 // { gid_t sys_getegid(void); }
SYS_PROFIL = 44 // { int sys_profil(caddr_t samples, size_t size, \
SYS_KTRACE = 45 // { int sys_ktrace(const char *fname, int ops, \
SYS_SIGACTION = 46 // { int sys_sigaction(int signum, \
SYS_GETGID = 47 // { gid_t sys_getgid(void); }
SYS_SIGPROCMASK = 48 // { int sys_sigprocmask(int how, sigset_t mask); }
SYS_GETLOGIN = 49 // { int sys_getlogin(char *namebuf, u_int namelen); }
SYS_SETLOGIN = 50 // { int sys_setlogin(const char *namebuf); }
SYS_ACCT = 51 // { int sys_acct(const char *path); }
SYS_SIGPENDING = 52 // { int sys_sigpending(void); }
SYS_FSTAT = 53 // { int sys_fstat(int fd, struct stat *sb); }
SYS_IOCTL = 54 // { int sys_ioctl(int fd, \
SYS_REBOOT = 55 // { int sys_reboot(int opt); }
SYS_REVOKE = 56 // { int sys_revoke(const char *path); }
SYS_SYMLINK = 57 // { int sys_symlink(const char *path, \
SYS_READLINK = 58 // { int sys_readlink(const char *path, char *buf, \
SYS_EXECVE = 59 // { int sys_execve(const char *path, \
SYS_UMASK = 60 // { mode_t sys_umask(mode_t newmask); }
SYS_CHROOT = 61 // { int sys_chroot(const char *path); }
SYS_GETFSSTAT = 62 // { int sys_getfsstat(struct statfs *buf, size_t bufsize, \
SYS_STATFS = 63 // { int sys_statfs(const char *path, \
SYS_FSTATFS = 64 // { int sys_fstatfs(int fd, struct statfs *buf); }
SYS_FHSTATFS = 65 // { int sys_fhstatfs(const fhandle_t *fhp, \
SYS_VFORK = 66 // { int sys_vfork(void); }
SYS_GETTIMEOFDAY = 67 // { int sys_gettimeofday(struct timeval *tp, \
SYS_SETTIMEOFDAY = 68 // { int sys_settimeofday(const struct timeval *tv, \
SYS_SETITIMER = 69 // { int sys_setitimer(int which, \
SYS_GETITIMER = 70 // { int sys_getitimer(int which, \
SYS_SELECT = 71 // { int sys_select(int nd, fd_set *in, fd_set *ou, \
SYS_KEVENT = 72 // { int sys_kevent(int fd, \
SYS_MUNMAP = 73 // { int sys_munmap(void *addr, size_t len); }
SYS_MPROTECT = 74 // { int sys_mprotect(void *addr, size_t len, \
SYS_MADVISE = 75 // { int sys_madvise(void *addr, size_t len, \
SYS_UTIMES = 76 // { int sys_utimes(const char *path, \
SYS_FUTIMES = 77 // { int sys_futimes(int fd, \
SYS_MINCORE = 78 // { int sys_mincore(void *addr, size_t len, \
SYS_GETGROUPS = 79 // { int sys_getgroups(int gidsetsize, \
SYS_SETGROUPS = 80 // { int sys_setgroups(int gidsetsize, \
SYS_GETPGRP = 81 // { int sys_getpgrp(void); }
SYS_SETPGID = 82 // { int sys_setpgid(pid_t pid, int pgid); }
SYS_UTIMENSAT = 84 // { int sys_utimensat(int fd, const char *path, \
SYS_FUTIMENS = 85 // { int sys_futimens(int fd, \
SYS_CLOCK_GETTIME = 87 // { int sys_clock_gettime(clockid_t clock_id, \
SYS_CLOCK_SETTIME = 88 // { int sys_clock_settime(clockid_t clock_id, \
SYS_CLOCK_GETRES = 89 // { int sys_clock_getres(clockid_t clock_id, \
SYS_DUP2 = 90 // { int sys_dup2(int from, int to); }
SYS_NANOSLEEP = 91 // { int sys_nanosleep(const struct timespec *rqtp, \
SYS_FCNTL = 92 // { int sys_fcntl(int fd, int cmd, ... void *arg); }
SYS___THRSLEEP = 94 // { int sys___thrsleep(const volatile void *ident, \
SYS_FSYNC = 95 // { int sys_fsync(int fd); }
SYS_SETPRIORITY = 96 // { int sys_setpriority(int which, id_t who, int prio); }
SYS_SOCKET = 97 // { int sys_socket(int domain, int type, int protocol); }
SYS_CONNECT = 98 // { int sys_connect(int s, const struct sockaddr *name, \
SYS_GETDENTS = 99 // { int sys_getdents(int fd, void *buf, size_t buflen); }
SYS_GETPRIORITY = 100 // { int sys_getpriority(int which, id_t who); }
SYS_SIGRETURN = 103 // { int sys_sigreturn(struct sigcontext *sigcntxp); }
SYS_BIND = 104 // { int sys_bind(int s, const struct sockaddr *name, \
SYS_SETSOCKOPT = 105 // { int sys_setsockopt(int s, int level, int name, \
SYS_LISTEN = 106 // { int sys_listen(int s, int backlog); }
SYS_PPOLL = 109 // { int sys_ppoll(struct pollfd *fds, \
SYS_PSELECT = 110 // { int sys_pselect(int nd, fd_set *in, fd_set *ou, \
SYS_SIGSUSPEND = 111 // { int sys_sigsuspend(int mask); }
SYS_GETSOCKOPT = 118 // { int sys_getsockopt(int s, int level, int name, \
SYS_READV = 120 // { ssize_t sys_readv(int fd, \
SYS_WRITEV = 121 // { ssize_t sys_writev(int fd, \
SYS_FCHOWN = 123 // { int sys_fchown(int fd, uid_t uid, gid_t gid); }
SYS_FCHMOD = 124 // { int sys_fchmod(int fd, mode_t mode); }
SYS_SETREUID = 126 // { int sys_setreuid(uid_t ruid, uid_t euid); }
SYS_SETREGID = 127 // { int sys_setregid(gid_t rgid, gid_t egid); }
SYS_RENAME = 128 // { int sys_rename(const char *from, const char *to); }
SYS_FLOCK = 131 // { int sys_flock(int fd, int how); }
SYS_MKFIFO = 132 // { int sys_mkfifo(const char *path, mode_t mode); }
SYS_SENDTO = 133 // { ssize_t sys_sendto(int s, const void *buf, \
SYS_SHUTDOWN = 134 // { int sys_shutdown(int s, int how); }
SYS_SOCKETPAIR = 135 // { int sys_socketpair(int domain, int type, \
SYS_MKDIR = 136 // { int sys_mkdir(const char *path, mode_t mode); }
SYS_RMDIR = 137 // { int sys_rmdir(const char *path); }
SYS_ADJTIME = 140 // { int sys_adjtime(const struct timeval *delta, \
SYS_SETSID = 147 // { int sys_setsid(void); }
SYS_QUOTACTL = 148 // { int sys_quotactl(const char *path, int cmd, \
SYS_NFSSVC = 155 // { int sys_nfssvc(int flag, void *argp); }
SYS_GETFH = 161 // { int sys_getfh(const char *fname, fhandle_t *fhp); }
SYS_SYSARCH = 165 // { int sys_sysarch(int op, void *parms); }
SYS_PREAD = 173 // { ssize_t sys_pread(int fd, void *buf, \
SYS_PWRITE = 174 // { ssize_t sys_pwrite(int fd, const void *buf, \
SYS_SETGID = 181 // { int sys_setgid(gid_t gid); }
SYS_SETEGID = 182 // { int sys_setegid(gid_t egid); }
SYS_SETEUID = 183 // { int sys_seteuid(uid_t euid); }
SYS_PATHCONF = 191 // { long sys_pathconf(const char *path, int name); }
SYS_FPATHCONF = 192 // { long sys_fpathconf(int fd, int name); }
SYS_SWAPCTL = 193 // { int sys_swapctl(int cmd, const void *arg, int misc); }
SYS_GETRLIMIT = 194 // { int sys_getrlimit(int which, \
SYS_SETRLIMIT = 195 // { int sys_setrlimit(int which, \
SYS_MMAP = 197 // { void *sys_mmap(void *addr, size_t len, int prot, \
SYS_LSEEK = 199 // { off_t sys_lseek(int fd, int pad, off_t offset, \
SYS_TRUNCATE = 200 // { int sys_truncate(const char *path, int pad, \
SYS_FTRUNCATE = 201 // { int sys_ftruncate(int fd, int pad, off_t length); }
SYS___SYSCTL = 202 // { int sys___sysctl(const int *name, u_int namelen, \
SYS_MLOCK = 203 // { int sys_mlock(const void *addr, size_t len); }
SYS_MUNLOCK = 204 // { int sys_munlock(const void *addr, size_t len); }
SYS_GETPGID = 207 // { pid_t sys_getpgid(pid_t pid); }
SYS_UTRACE = 209 // { int sys_utrace(const char *label, const void *addr, \
SYS_SEMGET = 221 // { int sys_semget(key_t key, int nsems, int semflg); }
SYS_MSGGET = 225 // { int sys_msgget(key_t key, int msgflg); }
SYS_MSGSND = 226 // { int sys_msgsnd(int msqid, const void *msgp, size_t msgsz, \
SYS_MSGRCV = 227 // { int sys_msgrcv(int msqid, void *msgp, size_t msgsz, \
SYS_SHMAT = 228 // { void *sys_shmat(int shmid, const void *shmaddr, \
SYS_SHMDT = 230 // { int sys_shmdt(const void *shmaddr); }
SYS_MINHERIT = 250 // { int sys_minherit(void *addr, size_t len, \
SYS_POLL = 252 // { int sys_poll(struct pollfd *fds, \
SYS_ISSETUGID = 253 // { int sys_issetugid(void); }
SYS_LCHOWN = 254 // { int sys_lchown(const char *path, uid_t uid, gid_t gid); }
SYS_GETSID = 255 // { pid_t sys_getsid(pid_t pid); }
SYS_MSYNC = 256 // { int sys_msync(void *addr, size_t len, int flags); }
SYS_PIPE = 263 // { int sys_pipe(int *fdp); }
SYS_FHOPEN = 264 // { int sys_fhopen(const fhandle_t *fhp, int flags); }
SYS_PREADV = 267 // { ssize_t sys_preadv(int fd, \
SYS_PWRITEV = 268 // { ssize_t sys_pwritev(int fd, \
SYS_KQUEUE = 269 // { int sys_kqueue(void); }
SYS_MLOCKALL = 271 // { int sys_mlockall(int flags); }
SYS_MUNLOCKALL = 272 // { int sys_munlockall(void); }
SYS_GETRESUID = 281 // { int sys_getresuid(uid_t *ruid, uid_t *euid, \
SYS_SETRESUID = 282 // { int sys_setresuid(uid_t ruid, uid_t euid, \
SYS_GETRESGID = 283 // { int sys_getresgid(gid_t *rgid, gid_t *egid, \
SYS_SETRESGID = 284 // { int sys_setresgid(gid_t rgid, gid_t egid, \
SYS_MQUERY = 286 // { void *sys_mquery(void *addr, size_t len, int prot, \
SYS_CLOSEFROM = 287 // { int sys_closefrom(int fd); }
SYS_SIGALTSTACK = 288 // { int sys_sigaltstack(const struct sigaltstack *nss, \
SYS_SHMGET = 289 // { int sys_shmget(key_t key, size_t size, int shmflg); }
SYS_SEMOP = 290 // { int sys_semop(int semid, struct sembuf *sops, \
SYS_FHSTAT = 294 // { int sys_fhstat(const fhandle_t *fhp, \
SYS___SEMCTL = 295 // { int sys___semctl(int semid, int semnum, int cmd, \
SYS_SHMCTL = 296 // { int sys_shmctl(int shmid, int cmd, \
SYS_MSGCTL = 297 // { int sys_msgctl(int msqid, int cmd, \
SYS_SCHED_YIELD = 298 // { int sys_sched_yield(void); }
SYS_GETTHRID = 299 // { pid_t sys_getthrid(void); }
SYS___THRWAKEUP = 301 // { int sys___thrwakeup(const volatile void *ident, \
SYS___THREXIT = 302 // { void sys___threxit(pid_t *notdead); }
SYS___THRSIGDIVERT = 303 // { int sys___thrsigdivert(sigset_t sigmask, \
SYS___GETCWD = 304 // { int sys___getcwd(char *buf, size_t len); }
SYS_ADJFREQ = 305 // { int sys_adjfreq(const int64_t *freq, \
SYS_SETRTABLE = 310 // { int sys_setrtable(int rtableid); }
SYS_GETRTABLE = 311 // { int sys_getrtable(void); }
SYS_FACCESSAT = 313 // { int sys_faccessat(int fd, const char *path, \
SYS_FCHMODAT = 314 // { int sys_fchmodat(int fd, const char *path, \
SYS_FCHOWNAT = 315 // { int sys_fchownat(int fd, const char *path, \
SYS_LINKAT = 317 // { int sys_linkat(int fd1, const char *path1, int fd2, \
SYS_MKDIRAT = 318 // { int sys_mkdirat(int fd, const char *path, \
SYS_MKFIFOAT = 319 // { int sys_mkfifoat(int fd, const char *path, \
SYS_MKNODAT = 320 // { int sys_mknodat(int fd, const char *path, \
SYS_OPENAT = 321 // { int sys_openat(int fd, const char *path, int flags, \
SYS_READLINKAT = 322 // { ssize_t sys_readlinkat(int fd, const char *path, \
SYS_RENAMEAT = 323 // { int sys_renameat(int fromfd, const char *from, \
SYS_SYMLINKAT = 324 // { int sys_symlinkat(const char *path, int fd, \
SYS_UNLINKAT = 325 // { int sys_unlinkat(int fd, const char *path, \
SYS___SET_TCB = 329 // { void sys___set_tcb(void *tcb); }
SYS___GET_TCB = 330 // { void *sys___get_tcb(void); }
)
| {
"pile_set_name": "Github"
} |
[gd_scene load_steps=2 format=2]
[ext_resource path="res://addons/godot-haskell-plugin/Simula.gdns" type="Script" id=1]
[node name="Root" type="Node"]
script = ExtResource( 1 )
| {
"pile_set_name": "Github"
} |
#
# ***************************************************************************
# Copyright (c) 2010 Qcadoo Limited
# Project: Qcadoo MES
# Version: 1.4
#
# This file is part of Qcadoo.
#
# Qcadoo is free software; you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation; either version 3 of the License,
# or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# ***************************************************************************
#
### MENU
qcadooView.menu.calculations = Berechnungen
lineChangeoverNorms.menu.calculations.description = Prognosen, die auf Basis von im System festgelegten Normen und Prozessen berechnet werden.
lineChangeoverNorms.menu.technology.lineChangeoverNorms = Normen für die Umrüstungen
lineChangeoverNorms.menu.calculations.matchingChangeoverNorms = die Umrüstung anpassen
### MODEL
lineChangeoverNorms.lineChangeoverNorms.productionLine.label = Für die Fertigungsstraße typisch
lineChangeoverNorms.lineChangeoverNorms.changeoverType.label = Typ
lineChangeoverNorms.lineChangeoverNorms.fromTechnology.label = Aus der Technik
lineChangeoverNorms.lineChangeoverNorms.number.label = Nummer
lineChangeoverNorms.lineChangeoverNorms.name.label = Name
lineChangeoverNorms.lineChangeoverNorms.fromTechnologyGroup.label = Aus der Gruppe
lineChangeoverNorms.lineChangeoverNorms.toTechnology.label = Zur Technik
lineChangeoverNorms.lineChangeoverNorms.toTechnologyGroup.label = Zur Gruppe
lineChangeoverNorms.lineChangeoverNorms.duration.label = Laufzeit
lineChangeoverNorms.lineChangeoverNorms.changeoverType.value.01forTechnology = für die Einzeltechnik
lineChangeoverNorms.lineChangeoverNorms.changeoverType.value.02forTechnologyGroup = für die ganzen Gruppen
### VIEW
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingChangeoverNormLabel= Am besten geeignet für
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchNormsLabel = Die anngepasste Norm
lineChangeoverNorms.lineChangeoverNormsList.window.mainTab.lineChangeoverNormsList.header = Liste der Umrüstungen
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.headerNew = Norm für die Umrüstung
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.headerEdit = Norm für die Umrüstung
lineChangeoverNorms.lineChangeoverNorms.fromTechnology.label.focus = eine Technik wählen
lineChangeoverNorms.lineChangeoverNorms.toTechnology.label.focus = eine Technik wählen
lineChangeoverNorms.lineChangeoverNorms.toTechnologyGroup.label.focus = eine Gruppe der Techniken wählen
lineChangeoverNorms.lineChangeoverNorms.fromTechnologyGroup.label.focus = eine Gruppe der Techniken wählen
lineChangeoverNorms.lineChangeoverNorms.productionLine.label.focus = eine Fertigungsstraße wählen
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.toTechnology.lookup.window.grid.header = Techniken
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.fromTechnology.lookup.window.grid.header = Techniken
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.fromTechnologyGroup.lookup.window.grid.header = Gruppen der Techniken
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.toTechnologyGroup.lookup.window.grid.header = Gruppen der Techniken
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.productionLine.lookup.window.grid.header = Fertigungsstraßen
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingFromTechnology.label = Umrüstungen mit der Technik
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingToTechnology.label = zu
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingProductionLine.label = in der Fertigungsstraße
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingFromTechnology.lookup.window.grid.header = Techniken
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingToTechnology.lookup.window.grid.header = Techniken
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingProductionLine.lookup.window.grid.header = Fertigungsstraßen
lineChangeoverNorms.matchingChangeoverNormsDetails.window.mainTab.matchingChangeoverNormsDetails.matchingNormNotFound.label = Keine Ergebisse, die zu den Kriterien passen
lineChangeoverNorms.lineChangeoverNormsDetails.window.mainTab.lineChangeoverNormsDetails.number.description = Das Feld wird nach der Dateneingabe automatisch ausgefüllt
### RIBBON
lineChangeoverNorms.matchingChangeoverNormsDetails.window.ribbon.matching = Normen für die Umrüstung
lineChangeoverNorms.matchingChangeoverNormsDetails.window.ribbon.matching.matchingChangeoverNorm = Anpassen
lineChangeoverNorms.matchingChangeoverNormsDetails.window.ribbon.editing.edit = Bearbeiten
lineChangeoverNorms.matchingChangeoverNormsDetails.window.ribbon.editing = Bearbeitung
### ERROR
lineChangeoverNorms.lineChangeoverNorm.notUnique = Die gleiche Norm existiert schon im System. Norm: {0}
lineChangeoverNorms.lineChangeoverNorm.fieldIsRequired = Das Feld ist erforderlich | {
"pile_set_name": "Github"
} |
import backend as F
import numpy as np
import scipy as sp
import dgl
from dgl import utils
from dgl.contrib import KVServer
from dgl.contrib import KVClient
from numpy.testing import assert_array_equal
import os
import time
num_entries = 10
dim_size = 3
server_namebook = {0:[0, '127.0.0.1', 30070, 1]}
data_0 = F.zeros((num_entries, dim_size), F.float32, F.cpu())
g2l_0 = F.arange(0, num_entries)
partition_0 = F.zeros(num_entries, F.int64, F.cpu())
data_1 = F.zeros((num_entries*2, dim_size), F.float32, F.cpu())
g2l_1 = F.arange(0, num_entries*2)
partition_1 = F.zeros(num_entries*2, F.int64, F.cpu())
data_3 = F.zeros((num_entries, dim_size), F.int64, F.cpu())
data_4 = F.zeros((num_entries, dim_size), F.float64, F.cpu())
data_5 = F.zeros((num_entries, dim_size), F.int32, F.cpu())
def start_server():
my_server = KVServer(server_id=0, server_namebook=server_namebook, num_client=1)
my_server.set_global2local(name='data_0', global2local=g2l_0)
my_server.set_global2local(name='data_1', global2local=g2l_1)
my_server.set_global2local(name='data_3', global2local=g2l_0)
my_server.set_global2local(name='data_4', global2local=g2l_0)
my_server.set_global2local(name='data_5', global2local=g2l_0)
my_server.set_partition_book(name='data_0', partition_book=partition_0)
my_server.set_partition_book(name='data_1', partition_book=partition_1)
my_server.set_partition_book(name='data_3', partition_book=partition_0)
my_server.set_partition_book(name='data_4', partition_book=partition_0)
my_server.set_partition_book(name='data_5', partition_book=partition_0)
my_server.init_data(name='data_0', data_tensor=data_0)
my_server.init_data(name='data_1', data_tensor=data_1)
my_server.init_data(name='data_3', data_tensor=data_3)
my_server.init_data(name='data_4', data_tensor=data_4)
my_server.init_data(name='data_5', data_tensor=data_5)
my_server.start()
def start_client():
my_client = KVClient(server_namebook=server_namebook)
my_client.connect()
my_client.init_data(name='data_2', shape=(num_entries, dim_size), dtype=F.float32, target_name='data_0')
print("Init data from client..")
name_list = my_client.get_data_name_list()
assert len(name_list) == 6
assert 'data_0' in name_list
assert 'data_1' in name_list
assert 'data_2' in name_list
assert 'data_3' in name_list
assert 'data_4' in name_list
assert 'data_5' in name_list
meta_0 = my_client.get_data_meta('data_0')
assert meta_0[0] == F.float32
assert meta_0[1] == tuple(F.shape(data_0))
assert_array_equal(meta_0[2], partition_0)
meta_1 = my_client.get_data_meta('data_1')
assert meta_1[0] == F.float32
assert meta_1[1] == tuple(F.shape(data_1))
assert_array_equal(meta_1[2], partition_1)
meta_2 = my_client.get_data_meta('data_2')
assert meta_2[0] == F.float32
assert meta_2[1] == tuple(F.shape(data_0))
assert_array_equal(meta_2[2], partition_0)
meta_3 = my_client.get_data_meta('data_3')
assert meta_3[0] == F.int64
assert meta_3[1] == tuple(F.shape(data_3))
assert_array_equal(meta_3[2], partition_0)
meta_4 = my_client.get_data_meta('data_4')
assert meta_4[0] == F.float64
assert meta_4[1] == tuple(F.shape(data_4))
assert_array_equal(meta_3[2], partition_0)
meta_5 = my_client.get_data_meta('data_5')
assert meta_5[0] == F.int32
assert meta_5[1] == tuple(F.shape(data_5))
assert_array_equal(meta_3[2], partition_0)
my_client.push(name='data_0', id_tensor=F.tensor([0, 1, 2]), data_tensor=F.tensor([[1.,1.,1.],[2.,2.,2.],[3.,3.,3.]]))
my_client.push(name='data_2', id_tensor=F.tensor([0, 1, 2]), data_tensor=F.tensor([[1.,1.,1.],[2.,2.,2.],[3.,3.,3.]]))
my_client.push(name='data_3', id_tensor=F.tensor([0, 1, 2]), data_tensor=F.tensor([[1,1,1],[2,2,2],[3,3,3]]))
my_client.push(name='data_4', id_tensor=F.tensor([0, 1, 2]), data_tensor=F.tensor([[1.,1.,1.],[2.,2.,2.],[3.,3.,3.]], F.float64))
my_client.push(name='data_5', id_tensor=F.tensor([0, 1, 2]), data_tensor=F.tensor([[1,1,1],[2,2,2],[3,3,3]], F.int32))
target = F.tensor([[1.,1.,1.],[2.,2.,2.],[3.,3.,3.]])
res = my_client.pull(name='data_0', id_tensor=F.tensor([0, 1, 2]))
assert_array_equal(res, target)
res = my_client.pull(name='data_2', id_tensor=F.tensor([0, 1, 2]))
assert_array_equal(res, target)
target = F.tensor([[1,1,1],[2,2,2],[3,3,3]])
res = my_client.pull(name='data_3', id_tensor=F.tensor([0, 1, 2]))
assert_array_equal(res, target)
target = F.tensor([[1.,1.,1.],[2.,2.,2.],[3.,3.,3.]], F.float64)
res = my_client.pull(name='data_4', id_tensor=F.tensor([0, 1, 2]))
assert_array_equal(res, target)
target = F.tensor([[1,1,1],[2,2,2],[3,3,3]], F.int32)
res = my_client.pull(name='data_5', id_tensor=F.tensor([0, 1, 2]))
assert_array_equal(res, target)
my_client.shut_down()
if __name__ == '__main__':
pid = os.fork()
if pid == 0:
start_server()
else:
time.sleep(2) # wait trainer start
start_client()
| {
"pile_set_name": "Github"
} |
/* Sticky footer styles
-------------------------------------------------- */
html {
position: relative;
min-height: 100%;
}
body {
margin-bottom: 60px; /* Margin bottom by footer height */
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
height: 60px; /* Set the fixed height of the footer here */
line-height: 60px; /* Vertically center the text there */
background-color: #f5f5f5;
}
/* Custom page CSS
-------------------------------------------------- */
/* Not required for template or sticky footer method. */
.container {
width: auto;
max-width: 680px;
padding: 0 15px;
}
| {
"pile_set_name": "Github"
} |
/*-
* Copyright (c) 2005 David Schultz <das@FreeBSD.ORG>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <machine/asm.h>
__FBSDID("$FreeBSD: src/lib/msun/ia64/s_fma.S,v 1.1 2005/01/22 09:53:18 das Exp $")
ENTRY(fma, 3)
{
fma.d f8 = f8, f9, f10
br.ret.sptk b0
}
| {
"pile_set_name": "Github"
} |
{
"images": [
{
"filename": "ic_navigation.png",
"idiom": "universal",
"scale": "1x"
},
{
"filename": "ic_navigation_2x.png",
"idiom": "universal",
"scale": "2x"
},
{
"filename": "ic_navigation_3x.png",
"idiom": "universal",
"scale": "3x"
}
],
"info": {
"author": "xcode",
"version": 1
}
}
| {
"pile_set_name": "Github"
} |
import { bold, underline } from 'chalk';
import { isPlainObject, intersection, get, update, union } from 'lodash';
import { RAW } from '../../../configuration/addRaw';
import buildList from './buildList';
// Returns an updated meta object
export default function processConfig(name, extension, state) {
const {
extensionConfigPaths,
extensionMetaPaths,
stateConfigPaths,
} = validateConfig(name, extension, state);
return updateStateMeta(
name,
state,
extensionConfigPaths,
extensionMetaPaths,
stateConfigPaths
);
}
export function validateConfig(name, extension, state) {
const extensionConfigPaths = getKeys(extension.config, true);
const extensionMetaPaths = getKeys(extension.meta);
const stateConfigPaths = getKeys(state.config, true);
const stateMetaPaths = getKeys(state.meta);
validateMetaStructure(
name,
intersection(
extensionMetaPaths.paths,
stateMetaPaths.paths
),
stateConfigPaths,
extension.meta,
state.meta
);
validateConfigurationStructure(
name,
intersection(
extensionConfigPaths.paths,
stateConfigPaths.paths
),
extensionConfigPaths,
stateConfigPaths,
extension.meta,
state.meta
);
return {
extensionConfigPaths,
extensionMetaPaths,
stateConfigPaths,
stateMetaPaths,
};
}
/* eslint-disable no-param-reassign */
function getKeys(obj = {}, flag = false, oldPath = '', allKeys = [], allGroups = []) {
let isValue = true;
Object.keys(obj).forEach((key) => {
const value = obj[key];
const newPath = oldPath + key;
if (isPlainObject(value) && key !== RAW && key !== '__meta') {
isValue = true;
if (newPath !== 'settings') {
allGroups.push(true);
allKeys.push(newPath);
}
const keys = getKeys(value, flag, `${newPath}.`, allKeys, allGroups);
// If nothing was changed we where in a value, not a group
if (keys.value) {
allGroups[allGroups.length - 1] = false;
}
} else if (flag && key !== '__meta') {
allKeys.push(newPath);
allGroups.push(false);
}
});
return {
paths: allKeys,
groups: allGroups,
value: isValue,
};
}
/* eslint-enable */
function getGroup(obj, path) {
return !!obj.groups[obj.paths.indexOf(path)];
}
function notInExtensions(extensions, extension) {
if (Array.isArray(extension)) {
return !extension.some((e) => extensions.indexOf(e) !== -1);
}
return extensions.indexOf(extension) === -1;
}
function validateMetaStructure(name, intersections, stateConfigPaths, extensionMeta, stateMeta) {
intersections.forEach((intersect) => {
const wasGroup = getGroup(stateConfigPaths, intersect);
if (!wasGroup || get(extensionMeta, `${intersect}.__meta`)) {
const stateExtensions = get(stateMeta, intersect).__extensions || [];
const extensionExtensions = get(extensionMeta, intersect).__extensions || [];
// If it is a group the override info will be on __meta and if not it will be directly on the object
const override = (get(extensionMeta, intersect, {}).__meta || {}).override ||
get(extensionMeta, intersect, {}).override;
if (
notInExtensions(stateExtensions, name) &&
override !== true &&
notInExtensions(stateExtensions, override) &&
notInExtensions(stateExtensions, extensionExtensions)
) {
// Fail early, might be more errors after this
// + This gives a better/more concise error for the project developer
// + We do not waste computation when we already know there is an error
// - The extension developer will not know the entire picture, just one of potentially several errors
const overrideMessage = !override ?
'No override value was specified, it should probably be one of the extensions above.\n' :
`The override did not match the possible values, it was: ${override}\n`;
throw new Error(
'Meta structure was changed without specifying override.\n' + // eslint-disable-line
`Meta for ${bold(intersect)} was changed in ${name} and has been altered before by:\n` +
buildList(stateExtensions) +
overrideMessage +
`Contact the developer of ${underline(name)} for help.`
);
}
}
});
}
function validateConfigurationStructure(
name, intersections, extensionConfigPaths, stateConfigPaths, extensionMeta, stateMeta
) {
intersections.forEach((intersect) => {
const wasGroup = getGroup(stateConfigPaths, intersect);
const isGroup = getGroup(extensionConfigPaths, intersect);
if (wasGroup !== isGroup) {
const stateExtensions = get(stateMeta, intersect).__extensions || [];
const extensionExtensions = get(extensionMeta, intersect, {}).__extensions || [];
// If it is a group the override info will be on __meta and if not it will be directly on the object
const override = (get(extensionMeta, intersect, {}).__meta || {}).override ||
get(extensionMeta, intersect, {}).override;
if (
notInExtensions(stateExtensions, name) &&
override !== true &&
notInExtensions(stateExtensions, override) &&
notInExtensions(stateExtensions, extensionExtensions)
) {
// Fail early, might be more errors after this
// + This gives a better/more concise error for the project developer
// + We do not waste computation when we already know there is an error
// - The extension developer will not know the entire picture, just one of potentially several errors
throw new Error(
'Configuration structure was changed without specifying override in meta.\n' +
`Was ${wasGroup ? 'an object' : 'a value'} and is now ${isGroup ? 'an object' : 'a value'}.\n` +
`The setting is question is: ${bold(intersect)}\n` +
`Contact the developer of ${underline(name)} for help.`
);
}
}
});
}
function updateStateMeta(name, state, extensionConfigPaths, extensionMetaPaths, stateConfigPaths) {
const newState = { ...state };
// Defining meta for something means that the __extensions should be updated
// Might be the case that the value has changed and in that case the old value will be replaced in the next loop
extensionMetaPaths.paths.forEach((path) =>
update(newState.meta, path, (previous = {}) =>
({
...previous,
__extensions: union(previous.__extensions || [], [name]),
})
)
);
extensionConfigPaths.paths.forEach((path, index) => {
const changed = getGroup(stateConfigPaths, path) !== extensionConfigPaths.groups[index];
update(newState.meta, path, (previous = {}) => {
// If it has changed we will reset it
const newValue = changed ?
{} :
previous;
const newExtensions = changed ?
[] :
previous.__extensions || [];
return {
...newValue,
__extensions: union(newExtensions, [name]),
};
});
});
return newState.meta;
}
export function validateConfigAndCleanMetaData(name, extension, state) {
const {
extensionConfigPaths,
stateConfigPaths,
} = validateConfig(name, extension, state);
extensionConfigPaths.paths.forEach((path, index) => {
// Only process settings
if (/^settings/.test(path)) {
const changed = getGroup(stateConfigPaths, path) !== extensionConfigPaths.groups[index];
update(state.meta, path, (previous = {}) => {
if (changed) {
return {
__extensions: union(previous.__extensions || [], [name]),
};
} else if (!previous.__extensions) {
return undefined;
}
return previous;
});
}
});
return removeUndefined(state.meta);
}
function removeUndefined(meta) {
Object.keys(meta).forEach((key) => {
if (meta[key] === undefined) {
delete meta[key]; // eslint-disable-line
} else if (isPlainObject(meta[key])) {
removeUndefined(meta[key]);
}
});
return meta;
}
| {
"pile_set_name": "Github"
} |
# Broadcom 802.11abg Networking Device Driver Configuration file
#
# Copyright (C) 2014, Broadcom Corporation. All Rights Reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
# OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# $Id: wlconfig_lx_wl_stadef,v 1.18 2010-02-25 07:23:32 $
#
# src/wl/linux driver config file
# get common
include $(WLCFGDIR)/wl_default
include $(WLCFGDIR)/wl_hnd
# features
STA=1
WLDPT=1
BCMSUP_PSK=1
BCMAUTH_PSK=1
WL_MONITOR=1
WLEXTLOG=1
BCMASSERT_LOG=1
BCMNVRAMW=1
SAMPLE_COLLECT=1
CCA_STATS=1
BCM_DCS=1
| {
"pile_set_name": "Github"
} |
/*****************************************************************************
* auth.h - PPP Authentication and phase control header file.
*
* Copyright (c) 2003 by Marc Boucher, Services Informatiques (MBSI) inc.
* portions Copyright (c) 1998 Global Election Systems Inc.
*
* The authors hereby grant permission to use, copy, modify, distribute,
* and license this software and its documentation for any purpose, provided
* that existing copyright notices are retained in all copies and that this
* notice and the following disclaimer are included verbatim in any
* distributions. No written agreement, license, or royalty fee is required
* for any of the authorized uses.
*
* THIS SOFTWARE IS PROVIDED BY THE 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 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.
*
******************************************************************************
* REVISION HISTORY
*
* 03-01-01 Marc Boucher <marc@mbsi.ca>
* Ported to lwIP.
* 97-12-04 Guy Lancaster <lancasterg@acm.org>, Global Election Systems Inc.
* Original derived from BSD pppd.h.
*****************************************************************************/
/*
* pppd.h - PPP daemon global declarations.
*
* Copyright (c) 1989 Carnegie Mellon University.
* All rights reserved.
*
* Redistribution and use in source and binary forms are permitted
* provided that the above copyright notice and this paragraph are
* duplicated in all such forms and that any documentation,
* advertising materials, and other materials related to such
* distribution and use acknowledge that the software was developed
* by Carnegie Mellon University. The name of the
* University may not be used to endorse or promote products derived
* from this software without specific prior written permission.
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
*/
#ifndef AUTH_H
#define AUTH_H
/***********************
*** PUBLIC FUNCTIONS ***
***********************/
/* we are starting to use the link */
void link_required (int);
/* we are finished with the link */
void link_terminated (int);
/* the LCP layer has left the Opened state */
void link_down (int);
/* the link is up; authenticate now */
void link_established (int);
/* a network protocol has come up */
void np_up (int, u16_t);
/* a network protocol has gone down */
void np_down (int, u16_t);
/* a network protocol no longer needs link */
void np_finished (int, u16_t);
/* peer failed to authenticate itself */
void auth_peer_fail (int, u16_t);
/* peer successfully authenticated itself */
void auth_peer_success (int, u16_t, char *, int);
/* we failed to authenticate ourselves */
void auth_withpeer_fail (int, u16_t);
/* we successfully authenticated ourselves */
void auth_withpeer_success (int, u16_t);
/* check authentication options supplied */
void auth_check_options (void);
/* check what secrets we have */
void auth_reset (int);
/* Check peer-supplied username/password */
u_char check_passwd (int, char *, int, char *, int, char **, int *);
/* get "secret" for chap */
int get_secret (int, char *, char *, char *, int *, int);
/* check if IP address is authorized */
int auth_ip_addr (int, u32_t);
/* check if IP address is unreasonable */
int bad_ip_adrs (u32_t);
#endif /* AUTH_H */
| {
"pile_set_name": "Github"
} |
{
"id": "navigation-6dc2dc2172",
"items": [
{
"id": "navigation-6dc2dc2172-item-2edead38ee",
"path": "/content/navigation",
"children": [
{
"id": "navigation-6dc2dc2172-item-b318e48feb",
"path": "/content/navigation-redirect/navigation-1",
"children": [
{
"id": "navigation-6dc2dc2172-item-ac16cd4d84",
"path": "/content/navigation-redirect/navigation-1/navigation-1-1",
"children": [
{
"id": "navigation-6dc2dc2172-item-b11a580818",
"path": "/content/navigation/navigation-1/navigation-1-1/navigation-1-1-2",
"children": [],
"level": 3,
"active": false,
"url": "/core/content/navigation/navigation-1/navigation-1-1/navigation-1-1-2.html",
"title": "Navigation 1.1.2",
"dataLayer": {
"navigation-6dc2dc2172-item-b11a580818": {
"xdm:linkURL": "/core/content/navigation/navigation-1/navigation-1-1/navigation-1-1-2.html",
"@type": "cq:PageContent",
"dc:title": "Navigation 1.1.2"
}
},
":type": "cq:PageContent"
},
{
"id": "navigation-6dc2dc2172-item-954ef7fd94",
"path": "/content/navigation/navigation-1/navigation-1-1/navigation-1-1-1",
"children": [
{
"id": "navigation-6dc2dc2172-item-aeb4fe9af3",
"path": "/content/navigation/navigation-1/navigation-1-1/navigation-1-1-2/navigation-1-1-2-2/navigation-1-1-2-2-1",
"children": [],
"level": 4,
"active": false,
"url": "/core/content/navigation/navigation-1/navigation-1-1/navigation-1-1-2/navigation-1-1-2-2/navigation-1-1-2-2-1.html",
"title": "Navigation 1.1.2.2.1",
"dataLayer": {
"navigation-6dc2dc2172-item-aeb4fe9af3": {
"xdm:linkURL": "/core/content/navigation/navigation-1/navigation-1-1/navigation-1-1-2/navigation-1-1-2-2/navigation-1-1-2-2-1.html",
"@type": "cq:PageContent",
"dc:title": "Navigation 1.1.2.2.1"
}
},
":type": "cq:PageContent"
},
{
"id": "navigation-6dc2dc2172-item-2be095a6e4",
"path": "/content/navigation-redirect/navigation-1/navigation-1-1/navigation-1-1-2/navigation-1-1-2-3",
"children": [],
"level": 4,
"active": false,
"url": "/core/content/navigation-redirect/navigation-1/navigation-1-1/navigation-1-1-2/navigation-1-1-2-3.html",
"title": "Navigation 1.1.2.3",
"dataLayer": {
"navigation-6dc2dc2172-item-2be095a6e4": {
"xdm:linkURL": "/core/content/navigation-redirect/navigation-1/navigation-1-1/navigation-1-1-2/navigation-1-1-2-3.html",
"@type": "cq:PageContent",
"dc:title": "Navigation 1.1.2.3"
}
},
":type": "cq:PageContent"
}
],
"level": 3,
"active": false,
"url": "/core/content/navigation/navigation-1/navigation-1-1/navigation-1-1-1.html",
"title": "Navigation 1.1.1",
"dataLayer": {
"navigation-6dc2dc2172-item-954ef7fd94": {
"xdm:linkURL": "/core/content/navigation/navigation-1/navigation-1-1/navigation-1-1-1.html",
"@type": "cq:PageContent",
"dc:title": "Navigation 1.1.1"
}
},
":type": "cq:PageContent"
}
],
"level": 2,
"active": false,
"url": "/core/content/navigation-redirect/navigation-1/navigation-1-1.html",
"title": "Navigation 1.1",
"dataLayer": {
"navigation-6dc2dc2172-item-ac16cd4d84": {
"xdm:linkURL": "/core/content/navigation-redirect/navigation-1/navigation-1-1.html",
"@type": "cq:PageContent",
"dc:title": "Navigation 1.1"
}
},
":type": "cq:PageContent"
}
],
"level": 1,
"active": false,
"url": "/core/navigation-1-vanity",
"title": "Navigation 1",
"dataLayer": {
"navigation-6dc2dc2172-item-b318e48feb": {
"xdm:linkURL": "/core/navigation-1-vanity",
"@type": "cq:PageContent",
"dc:title": "Navigation 1"
}
},
":type": "cq:PageContent"
},
{
"id": "navigation-6dc2dc2172-item-531a950bc2",
"path": "/content/navigation-redirect/navigation-2",
"children": [],
"level": 1,
"active": false,
"url": "/core/content/navigation-redirect/navigation-2.html",
"title": "Navigation 2",
"dataLayer": {
"navigation-6dc2dc2172-item-531a950bc2": {
"xdm:linkURL": "/core/content/navigation-redirect/navigation-2.html",
"@type": "cq:PageContent",
"dc:title": "Navigation 2"
}
},
":type": "cq:PageContent"
}
],
"level": 0,
"active": true,
"url": "/core/content/navigation.html",
"title": "Navigation",
"dataLayer": {
"navigation-6dc2dc2172-item-2edead38ee": {
"xdm:linkURL": "/core/content/navigation.html",
"@type": "cq:PageContent",
"dc:title": "Navigation"
}
},
":type": "cq:PageContent"
}
],
"dataLayer": {
"navigation-6dc2dc2172": {
"@type": "core/wcm/components/navigation/v1/navigation"
}
},
":type": "core/wcm/components/navigation/v1/navigation"
} | {
"pile_set_name": "Github"
} |
module Liquid
class TableRow < Block
Syntax = /(\w+)\s+in\s+(#{AllowedVariableCharacters}+)/
def initialize(markup, tokens)
super
if markup =~ Syntax
@variable_name = $1
@collection_name = $2
@attributes = {}
markup.scan(TagAttributes) do |key, value|
@attributes[key] = value
end
else
raise SyntaxError.new("Syntax Error in 'table_row loop' - Valid syntax: table_row [item] in [collection] cols=3")
end
end
def render(context)
collection = context[@collection_name] or return ''
if @attributes['limit'] or @attributes['offset']
limit = context[@attributes['limit']] || -1
offset = context[@attributes['offset']] || 0
collection = collection[offset.to_i..(limit.to_i + offset.to_i - 1)]
end
length = collection.length
cols = context[@attributes['cols']].to_i
row = 1
col = 0
result = ["<tr class=\"row1\">\n"]
context.stack do
collection.each_with_index do |item, index|
context[@variable_name] = item
context['tablerowloop'] = {
'length' => length,
'index' => index + 1,
'index0' => index,
'rindex' => length - index,
'rindex0' => length - index -1,
'first' => (index == 0),
'last' => (index == length - 1) }
result << ["<td class=\"col#{col += 1}\">"] + render_all(@nodelist, context) + ['</td>']
if col == cols and not (index == length - 1)
col = 0
result << ["</tr>\n<tr class=\"row#{row += 1}\">"]
end
end
end
result + ["</tr>\n"]
end
end
Template.register_tag('tablerow', TableRow)
end | {
"pile_set_name": "Github"
} |
/*
* $Id$
*
* Copyright (C) 2003-2015 JNode.org
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library; If not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package org.jnode.test.shell.syntax;
import org.jnode.shell.CommandLine;
import org.jnode.shell.NoTokensAvailableException;
import org.jnode.shell.syntax.CommandSyntaxException;
import org.jnode.shell.syntax.MuAlternation;
import org.jnode.shell.syntax.MuBackReference;
import org.jnode.shell.syntax.MuParser;
import org.jnode.shell.syntax.MuSequence;
import org.jnode.shell.syntax.MuSymbol;
import org.jnode.shell.syntax.MuSyntax;
import org.jnode.shell.syntax.SyntaxFailureException;
import org.junit.Assert;
import org.junit.Test;
@SuppressWarnings("deprecation")
public class MuParserTest {
@Test
public void testInstantiation() {
new MuParser();
}
@Test
public void testStatelessParsing1() throws NoTokensAvailableException, CommandSyntaxException {
// <start> ::= 'a'
MuSyntax syntax = new MuSymbol("a");
MuParser parser = new MuParser();
CommandLine cl;
cl = new CommandLine(new String[] {"a"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("parse didn't fail");
} catch (CommandSyntaxException ex) {
// expected
}
try {
cl = new CommandLine(new String[] {"a", "a"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("parse didn't fail");
} catch (CommandSyntaxException ex) {
// expected
}
}
@Test
public void testStatelessParsing2() throws NoTokensAvailableException, CommandSyntaxException {
// <start> ::= 'a' 'b'
MuSyntax syntax = new MuSequence(new MuSymbol("a"), new MuSymbol("b"));
MuParser parser = new MuParser();
CommandLine cl;
cl = new CommandLine(new String[] {"a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"a"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("parse didn't fail");
} catch (CommandSyntaxException ex) {
// expected
}
try {
cl = new CommandLine(new String[] {"a"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("parse didn't fail");
} catch (CommandSyntaxException ex) {
// expected
}
}
@Test
public void testStatelessParsing3() throws NoTokensAvailableException, CommandSyntaxException {
// <start> :: = 'a' | 'b'
MuSyntax syntax = new MuAlternation(new MuSymbol("a"), new MuSymbol("b"));
MuParser parser = new MuParser();
CommandLine cl;
cl = new CommandLine(new String[] {"a"});
parser.parse(syntax, null, cl.tokenIterator(), null);
cl = new CommandLine(new String[] {"b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"c"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("parse didn't fail");
} catch (CommandSyntaxException ex) {
// expected
}
}
@Test
public void testStatelessParsing4() throws NoTokensAvailableException, CommandSyntaxException {
// <root> ::= 'b' | ( 'a' <root> )
MuSyntax syntax =
new MuAlternation("root", new MuSymbol("b"), new MuSequence(new MuSymbol("a"),
new MuBackReference("root")));
MuParser parser = new MuParser();
CommandLine cl;
cl = new CommandLine(new String[] {"b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("expected SFE");
} catch (SyntaxFailureException ex) {
// expected
}
syntax.resolveBackReferences();
cl = new CommandLine(new String[] {"a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
cl = new CommandLine(new String[] {"a", "a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"a", "a", "c"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("expected SEE");
} catch (CommandSyntaxException ex) {
// expected
}
}
@Test
public void testStatelessParsing5() throws NoTokensAvailableException, CommandSyntaxException {
// <root> ::= ( 'a' <root> ) | 'b'
MuSyntax syntax =
new MuAlternation("root", new MuSequence(new MuSymbol("a"), new MuBackReference(
"root")), new MuSymbol("b"));
MuParser parser = new MuParser();
CommandLine cl;
syntax.resolveBackReferences();
cl = new CommandLine(new String[] {"b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
syntax.resolveBackReferences();
cl = new CommandLine(new String[] {"a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
cl = new CommandLine(new String[] {"a", "a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"a", "a", "c"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("expected SEE");
} catch (CommandSyntaxException ex) {
// expected
}
}
@Test
public void testStatelessParsing6() throws NoTokensAvailableException, CommandSyntaxException {
// <root> ::= ( ( 'a' <root> ) | ( 'b' 'c' ) ) | ( ( 'a' <root> ) | 'b'
// ) )
MuSyntax syntax = new MuAlternation("root", new MuAlternation(new MuSequence(new MuSymbol("a"),
new MuBackReference("root")), new MuSequence(new MuSymbol("b"), new MuSymbol("c"))),
new MuAlternation(new MuSequence(new MuSymbol("a"), new MuBackReference("root")), new MuSymbol("b")));
MuParser parser = new MuParser();
CommandLine cl;
syntax.resolveBackReferences();
cl = new CommandLine(new String[] {"b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
syntax.resolveBackReferences();
cl = new CommandLine(new String[] {"a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
cl = new CommandLine(new String[] {"a", "a", "b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
cl = new CommandLine(new String[] {"a", "a", "b", "c"});
parser.parse(syntax, null, cl.tokenIterator(), null);
try {
cl = new CommandLine(new String[] {"a", "a", "c"});
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("expected SEE");
} catch (CommandSyntaxException ex) {
// expected
}
}
@Test
public void testPathological() throws NoTokensAvailableException, CommandSyntaxException {
// Pathological grammar.
// <root> ::= 'b' | ( <root> <root> )
MuSyntax syntax =
new MuAlternation("root", new MuSymbol("b"), new MuSequence(new MuBackReference(
"root"), new MuBackReference("root")));
MuParser parser = new MuParser();
CommandLine cl;
syntax.resolveBackReferences();
// This doesn't hit the infinite loop ...
cl = new CommandLine(new String[] {"b"});
parser.parse(syntax, null, cl.tokenIterator(), null);
// But this does ...
cl = new CommandLine(new String[] {"a"});
try {
parser.parse(syntax, null, cl.tokenIterator(), null);
Assert.fail("expected SFE");
} catch (SyntaxFailureException ex) {
Assert.assertEquals(
"Parse exceeded the step limit (" + MuParser.DEFAULT_STEP_LIMIT + "). " +
"Either the command line is too large, or the syntax is too complex (or pathological)",
ex.getMessage());
}
}
}
| {
"pile_set_name": "Github"
} |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/**
* CharacterEscape :: c ControlLetter
*
* @path ch15/15.10/15.10.2/15.10.2.10/S15.10.2.10_A2.1_T1.js
* @description ControlLetter :: A - Z
*/
//CHECK#0041-005A
var result = true;
for (alpha = 0x0041; alpha <= 0x005A; alpha++) {
str = String.fromCharCode(alpha % 32);
arr = (new RegExp("\\c" + String.fromCharCode(alpha))).exec(str);
if ((arr === null) || (arr[0] !== str)) {
result = false;
}
}
if (result !== true) {
$ERROR('#1: CharacterEscape :: c A - Z');
}
| {
"pile_set_name": "Github"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.