content
stringlengths 4
1.04M
| lang
stringclasses 358
values | score
int64 0
5
| repo_name
stringlengths 5
114
| repo_path
stringlengths 4
229
| repo_licenses
listlengths 1
8
|
---|---|---|---|---|---|
#!/bin/bash
set -e
# Make sure we don't introduce accidental references to PATENTS.
EXPECTED='scripts/circleci/check_license.sh'
ACTUAL=$(git grep -l PATENTS)
if [ "$EXPECTED" != "$ACTUAL" ]; then
echo "PATENTS crept into some new files?"
diff -u <(echo "$EXPECTED") <(echo "$ACTUAL") || true
exit 1
fi
| Shell | 4 | vegYY/react | scripts/circleci/check_license.sh | [
"MIT"
]
|
<table class="ui celled table">
<thead>
<tr>
<th>Week of</th>
<th>Slot 1</th>
<th>Slot 2</th>
<th>Slot 3</th>
<th>Slot 4</th>
</tr>
</thead>
<tbody>
<% this_week = Timex.beginning_of_week(Timex.today) %>
<%= for week <- @weeks do %>
<% sponsorships = sponsorships_for_week(week) %>
<tr class="<%= schedule_row_class(this_week, week) %>">
<td><%= TimeView.week_start_end(week) %></td>
<% sponsorship = Enum.at(sponsorships, 0, nil) %>
<td class="<%= schedule_cell_class(this_week, week, sponsorship) %>">
<%= schedule_cell_content(this_week, week, sponsorship) %>
</td>
<% sponsorship = Enum.at(sponsorships, 1, nil) %>
<td class="<%= schedule_cell_class(this_week, week, sponsorship) %>">
<%= schedule_cell_content(this_week, week, sponsorship) %>
</td>
<% sponsorship = Enum.at(sponsorships, 2, nil) %>
<td class="<%= schedule_cell_class(this_week, week, sponsorship) %>">
<%= schedule_cell_content(this_week, week, sponsorship) %>
</td>
<% sponsorship = Enum.at(sponsorships, 3, nil) %>
<td class="<%= schedule_cell_class(this_week, week, sponsorship) %>">
<%= schedule_cell_content(this_week, week, sponsorship) %>
</td>
</tr>
<% end %>
</tbody>
</table>
| HTML+EEX | 3 | PsOverflow/changelog.com | lib/changelog_web/templates/admin/news_sponsorship/_schedule.html.eex | [
"MIT"
]
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
package com.facebook.react.modules.network;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.text.TextUtils;
import android.webkit.CookieManager;
import android.webkit.ValueCallback;
import androidx.annotation.Nullable;
import com.facebook.react.bridge.Callback;
import com.facebook.react.bridge.GuardedAsyncTask;
import com.facebook.react.bridge.ReactContext;
import java.io.IOException;
import java.net.CookieHandler;
import java.net.URI;
import java.util.Collections;
import java.util.List;
import java.util.Map;
/**
* Cookie handler that forwards all cookies to the WebView CookieManager.
*
* <p>This class relies on CookieManager to persist cookies to disk so cookies may be lost if the
* application is terminated before it syncs.
*/
public class ForwardingCookieHandler extends CookieHandler {
private static final String VERSION_ZERO_HEADER = "Set-cookie";
private static final String VERSION_ONE_HEADER = "Set-cookie2";
private static final String COOKIE_HEADER = "Cookie";
private final CookieSaver mCookieSaver;
private final ReactContext mContext;
private @Nullable CookieManager mCookieManager;
public ForwardingCookieHandler(ReactContext context) {
mContext = context;
mCookieSaver = new CookieSaver();
}
@Override
public Map<String, List<String>> get(URI uri, Map<String, List<String>> headers)
throws IOException {
CookieManager cookieManager = getCookieManager();
if (cookieManager == null) return Collections.emptyMap();
String cookies = cookieManager.getCookie(uri.toString());
if (TextUtils.isEmpty(cookies)) {
return Collections.emptyMap();
}
return Collections.singletonMap(COOKIE_HEADER, Collections.singletonList(cookies));
}
@Override
public void put(URI uri, Map<String, List<String>> headers) throws IOException {
String url = uri.toString();
for (Map.Entry<String, List<String>> entry : headers.entrySet()) {
String key = entry.getKey();
if (key != null && isCookieHeader(key)) {
addCookies(url, entry.getValue());
}
}
}
public void clearCookies(final Callback callback) {
clearCookiesAsync(callback);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void clearCookiesAsync(final Callback callback) {
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.removeAllCookies(
new ValueCallback<Boolean>() {
@Override
public void onReceiveValue(Boolean value) {
mCookieSaver.onCookiesModified();
callback.invoke(value);
}
});
}
}
public void destroy() {}
public void addCookies(final String url, final List<String> cookies) {
final CookieManager cookieManager = getCookieManager();
if (cookieManager == null) return;
for (String cookie : cookies) {
addCookieAsync(url, cookie);
}
cookieManager.flush();
mCookieSaver.onCookiesModified();
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void addCookieAsync(String url, String cookie) {
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.setCookie(url, cookie, null);
}
}
private static boolean isCookieHeader(String name) {
return name.equalsIgnoreCase(VERSION_ZERO_HEADER) || name.equalsIgnoreCase(VERSION_ONE_HEADER);
}
private void runInBackground(final Runnable runnable) {
new GuardedAsyncTask<Void, Void>(mContext) {
@Override
protected void doInBackgroundGuarded(Void... params) {
runnable.run();
}
}.execute();
}
/**
* Instantiating CookieManager will load the Chromium task taking a 100ish ms so we do it lazily
* to make sure it's done on a background thread as needed.
*/
private @Nullable CookieManager getCookieManager() {
if (mCookieManager == null) {
possiblyWorkaroundSyncManager(mContext);
try {
mCookieManager = CookieManager.getInstance();
} catch (IllegalArgumentException ex) {
// https://bugs.chromium.org/p/chromium/issues/detail?id=559720
return null;
} catch (Exception exception) {
String message = exception.getMessage();
// We cannot catch MissingWebViewPackageException as it is in a private / system API
// class. This validates the exception's message to ensure we are only handling this
// specific exception.
// https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/webkit/WebViewFactory.java#348
if (message != null
&& exception.getClass().getCanonicalName().contains("MissingWebViewPackageException")) {
return null;
} else {
throw exception;
}
}
}
return mCookieManager;
}
private static void possiblyWorkaroundSyncManager(Context context) {}
/**
* Responsible for flushing cookies to disk. Flushes to disk with a maximum delay of 30 seconds.
* This class is only active if we are on API < 21.
*/
private class CookieSaver {
private static final int MSG_PERSIST_COOKIES = 1;
private static final int TIMEOUT = 30 * 1000; // 30 seconds
private final Handler mHandler;
public CookieSaver() {
mHandler =
new Handler(
Looper.getMainLooper(),
new Handler.Callback() {
@Override
public boolean handleMessage(Message msg) {
if (msg.what == MSG_PERSIST_COOKIES) {
persistCookies();
return true;
} else {
return false;
}
}
});
}
public void onCookiesModified() {}
public void persistCookies() {
mHandler.removeMessages(MSG_PERSIST_COOKIES);
runInBackground(
new Runnable() {
@Override
public void run() {
flush();
}
});
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void flush() {
CookieManager cookieManager = getCookieManager();
if (cookieManager != null) {
cookieManager.flush();
}
}
}
}
| Java | 5 | nicofuccella/expo | android/ReactAndroid/src/main/java/com/facebook/react/modules/network/ForwardingCookieHandler.java | [
"MIT"
]
|
build:
docker build -t huginn/huginn .
| Makefile | 3 | yutiansut/huginn | docker/multi-process/Makefile | [
"MIT"
]
|
@echo off
rem Used by the buildbot "clean" step.
setlocal
set root=%~dp0..\..
set pcbuild=%root%\PCbuild
echo Deleting build
call "%pcbuild%\build.bat" -t Clean -k %*
call "%pcbuild%\build.bat" -t Clean -k -d %*
echo Deleting .pyc/.pyo files ...
del /s "%root%\Lib\*.pyc" "%root%\Lib\*.pyo"
echo Deleting test leftovers ...
rmdir /s /q "%root%\build"
del /s "%pcbuild%\python*.zip"
| Batchfile | 4 | shawwn/cpython | Tools/buildbot/clean.bat | [
"0BSD"
]
|
discard """
output: '''
I
AM
GROOT
'''
"""
import streams
var s = newStringStream("I\nAM\nGROOT")
doAssert s.peekStr(1) == "I"
doAssert s.peekChar() == 'I'
for line in s.lines:
echo line
s.close
var s2 = newStringStream("abc")
doAssert s2.readAll == "abc"
s2.write("def")
doAssert s2.data == "abcdef"
s2.close
| Nimrod | 3 | JohnAD/Nim | tests/js/tstreams.nim | [
"MIT"
]
|
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EventType } from 'vs/base/browser/dom';
import { localize } from 'vs/nls';
import { IQuickInputService, IQuickPickItem, IQuickPickSeparator } from 'vs/platform/quickinput/common/quickInput';
import { IDetectedLinks } from 'vs/workbench/contrib/terminal/browser/links/terminalLinkManager';
import { TerminalLinkQuickPickEvent } from 'vs/workbench/contrib/terminal/browser/terminal';
import { ILink } from 'xterm';
export class TerminalLinkQuickpick {
constructor(
@IQuickInputService private readonly _quickInputService: IQuickInputService
) { }
async show(links: IDetectedLinks): Promise<void> {
const wordPicks = links.wordLinks ? await this._generatePicks(links.wordLinks) : undefined;
const filePicks = links.fileLinks ? await this._generatePicks(links.fileLinks) : undefined;
const webPicks = links.webLinks ? await this._generatePicks(links.webLinks) : undefined;
const options = {
placeHolder: localize('terminal.integrated.openDetectedLink', "Select the link to open"),
canPickMany: false
};
const picks: LinkQuickPickItem[] = [];
if (webPicks) {
picks.push({ type: 'separator', label: localize('terminal.integrated.urlLinks', "Url") });
picks.push(...webPicks);
}
if (filePicks) {
picks.push({ type: 'separator', label: localize('terminal.integrated.localFileLinks', "Local File") });
picks.push(...filePicks);
}
if (wordPicks) {
picks.push({ type: 'separator', label: localize('terminal.integrated.searchLinks', "Workspace Search") });
picks.push(...wordPicks);
}
const pick = await this._quickInputService.pick(picks, options);
if (!pick) {
return;
}
const event = new TerminalLinkQuickPickEvent(EventType.CLICK);
pick.link.activate(event, pick.label);
return;
}
private async _generatePicks(links: ILink[]): Promise<ITerminalLinkQuickPickItem[] | undefined> {
if (!links) {
return;
}
const linkKeys: Set<string> = new Set();
const picks: ITerminalLinkQuickPickItem[] = [];
for (const link of links) {
const label = link.text;
if (!linkKeys.has(label)) {
linkKeys.add(label);
picks.push({ label, link });
}
}
return picks.length > 0 ? picks : undefined;
}
}
export interface ITerminalLinkQuickPickItem extends IQuickPickItem {
link: ILink;
}
type LinkQuickPickItem = ITerminalLinkQuickPickItem | IQuickPickSeparator;
| TypeScript | 4 | sbj42/vscode | src/vs/workbench/contrib/terminal/browser/links/terminalLinkQuickpick.ts | [
"MIT"
]
|
% Abstract Refinements
Abstract Refinements
--------------------
\begin{code}
module AbstractRefinements where
\end{code}
Abstract Refinements
--------------------
<br>
\begin{code} Consider the following function
maxInt :: Int -> Int -> Int
maxInt x y = if x <= y then y else x
\end{code}
<br>
\begin{code} We can give `maxInt` many (incomparable) refinement types:
maxInt :: Nat -> Nat -> Nat
maxInt :: Even -> Even -> Even
maxInt :: Prime -> Prime -> Prime
\end{code}
But **which** is the **right** type?
Parametric Invariants
---------------------
`maxInt` returns *one of* its two inputs `x` and `y`.
- **If** *both inputs* satisfy a property
- **Then** *output* must satisfy that property
This holds, **regardless of what that property was!**
- That is, we can **abstract over refinements**
- Or, **parameterize** a type over its refinements.
Parametric Invariants
---------------------
\begin{code}
{-@ maxInt :: forall <p :: Int -> Prop>. Int<p> -> Int<p> -> Int<p> @-}
maxInt :: Int -> Int -> Int
maxInt x y = if x <= y then y else x
\end{code}
Where
- `Int<p>` is just an abbreviation for `{v:Int | (p v)}`
This type states explicitly:
- **For any property** `p`, that is a property of `Int`,
- `maxInt` takes two **inputs** of which satisfy `p`,
- `maxInt` returns an **output** that satisfies `p`.
Parametric Invariants via Abstract Refinements
----------------------------------------------
\begin{code} We type `maxInt` as
maxInt :: forall <p :: Int -> Prop>. Int<p> -> Int<p> -> Int<p>
\end{code}
We call `p` an an **abstract refinement** <br>
In the refinement logic,
- abstract refinements are **uninterpreted function symbols**
- which (only) satisfy the *congruence axiom*: forall x, y. x = y => (p x) = (p y)
Using Abstract Refinements
--------------------------
- **If** we call `maxInt` with two `Int`s with the same concrete refinement,
- **Then** the `p` will be instantiated with that concrete refinement,
- **The output** of the call will also enjoy the concrete refinement.
For example, the refinement is instantiated with `\v -> v >= 0` <br>
\begin{code}
{-@ maxNat :: Nat @-}
maxNat :: Int
maxNat = maxInt 2 5
\end{code}
Using Abstract Refinements
--------------------------
- **If** we call `maxInt` with two `Int`s with the same concrete refinement,
- **Then** the `p` will be instantiated with that concrete refinement,
- **The output** of the call will also enjoy the concrete refinement.
Or any other property <br>
\begin{code}
{-@ type RGB = {v: Int | ((0 <= v) && (v < 256)) } @-}
\end{code}
<br> to verify <br>
\begin{code}
{-@ maxRGB :: RGB @-}
maxRGB :: Int
maxRGB = maxInt 56 8
\end{code}
| Literate Haskell | 5 | curiousleo/liquidhaskell | docs/slides/plpv14/hopa/AbstractRefinements.lhs | [
"MIT",
"BSD-3-Clause"
]
|
@app
wtfjs
@domain
wtfjs.com
@static
staging wtfjs-staging
production wtfjs-production
@aws
profile personal
region us-west-1
@html
get /
get /about
get /license
get /wtfs
get /wtfs/:wtfID
| Arc | 3 | shaedrich/wtfjs | .arc | [
"WTFPL"
]
|
<!DOCTYPE html><html lang="en"><head>
<meta charset="utf-8">
<title>Loading a .GLTF File</title>
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@threejs">
<meta name="twitter:title" content="Three.js – Loading a .GLTF File">
<meta property="og:image" content="https://threejs.org/files/share.png">
<link rel="shortcut icon" href="/files/favicon_white.ico" media="(prefers-color-scheme: dark)">
<link rel="shortcut icon" href="/files/favicon.ico" media="(prefers-color-scheme: light)">
<link rel="stylesheet" href="/manual/resources/lesson.css">
<link rel="stylesheet" href="/manual/resources/lang.css">
</head>
<body>
<div class="container">
<div class="lesson-title">
<h1>Loading a .GLTF File</h1>
</div>
<div class="lesson">
<div class="lesson-main">
<p>In a previous lesson we <a href="load-obj.html">loaded an .OBJ file</a>. If
you haven't read it you might want to check it out first.</p>
<p>As pointed out over there the .OBJ file format is very old and fairly
simple. It provides no scene graph so everything loaded is one large
mesh. It was designed mostly as a simple way to pass data between
3D editors.</p>
<p><a href="https://github.com/KhronosGroup/glTF">The gLTF format</a> is actually
a format designed from the ground up for be used for displaying
graphics. 3D formats can be divided into 3 or 4 basic types.</p>
<ul>
<li><p>3D Editor Formats</p>
<p>This are formats specific to a single app. .blend (Blender), .max (3d Studio Max),
.mb and .ma (Maya), etc...</p>
</li>
<li><p>Exchange formats</p>
<p>These are formats like .OBJ, .DAE (Collada), .FBX. They are designed to help exchange
information between 3D editors. As such they are usually much larger than needed with
extra info used only inside 3d editors</p>
</li>
<li><p>App formats</p>
<p>These are usually specific to certain apps, usually games.</p>
</li>
<li><p>Transmission formats</p>
<p>gLTF might be the first true transmission format. I suppose VRML might be considered
one but VRML was actually a pretty poor format.</p>
<p>gLTF is designed to do some things well that all those other formats don't do</p>
<ol>
<li><p>Be small for transmission</p>
<p>For example this means much of their large data, like vertices, is stored in
binary. When you download a .gLTF file that data can be uploaded to the GPU
with zero processing. It's ready as is. This is in contrast to say VRML, .OBJ,
or .DAE where vertices are stored as text and have to be parsed. Text vertex
positions can easily be 3x to 5x larger than binary.</p>
</li>
<li><p>Be ready to render</p>
<p>This again is different from other formats except maybe App formats. The data
in a glTF file is mean to be rendered, not edited. Data that's not important to
rendering has generally been removed. Polygons have been converted to triangles.
Materials have known values that are supposed to work everywhere.</p>
</li>
</ol>
</li>
</ul>
<p>gLTF was specifically designed so you should be able to download a glTF file and
display it with a minimum of trouble. Let's cross our fingers that's truly the case
as none of the other formats have been able to do this.</p>
<p>I wasn't really sure what I should show. At some level loading and displaying a gLTF file
is simpler than an .OBJ file. Unlike a .OBJ file materials are directly part of the format.
That said I thought I should at least load one up and I think going over the issues I ran
into might provide some good info.</p>
<p>Searching the net I found <a href="https://sketchfab.com/models/edd1c604e1e045a0a2a552ddd9a293e6">this low-poly city</a>
by <a href="https://sketchfab.com/antonmoek">antonmoek</a> which seemed like if we're lucky
might make a good example.</p>
<div class="threejs_center"><img src="../resources/images/cartoon_lowpoly_small_city_free_pack.jpg"></div>
<p>Starting with <a href="load-obj.html">an example from the .OBJ article</a> I removed the code
for loading .OBJ and replaced it with code for loading .GLTF</p>
<p>The old .OBJ code was</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">const mtlLoader = new MTLLoader();
mtlLoader.loadMtl('resources/models/windmill/windmill-fixed.mtl', (mtl) => {
mtl.preload();
mtl.materials.Material.side = THREE.DoubleSide;
objLoader.setMaterials(mtl);
objLoader.load('resources/models/windmill/windmill.obj', (event) => {
const root = event.detail.loaderRootNode;
scene.add(root);
...
});
});
</pre>
<p>The new .GLTF code is</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">{
const gltfLoader = new GLTFLoader();
const url = 'resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf';
gltfLoader.load(url, (gltf) => {
const root = gltf.scene;
scene.add(root);
...
});
</pre>
<p>I kept the auto framing code as before</p>
<p>We also need to include the <a href="/docs/#examples/loaders/GLTFLoader"><code class="notranslate" translate="no">GLTFLoader</code></a> and we can get rid of the <a href="/docs/#examples/loaders/OBJLoader"><code class="notranslate" translate="no">OBJLoader</code></a>.</p>
<pre class="prettyprint showlinemods notranslate lang-html" translate="no">-import {LoaderSupport} from '/examples/jsm/loaders/LoaderSupport.js';
-import {OBJLoader} from '/examples/jsm/loaders/OBJLoader.js';
-import {MTLLoader} from '/examples/jsm/loaders/MTLLoader.js';
+import {GLTFLoader} from '/examples/jsm/loaders/GLTFLoader.js';
</pre>
<p>And running that we get</p>
<p></p><div translate="no" class="threejs_example_container notranslate">
<div><iframe class="threejs_example notranslate" translate="no" style=" " src="/manual/examples/resources/editor.html?url=/manual/examples/load-gltf.html"></iframe></div>
<a class="threejs_center" href="/manual/examples/load-gltf.html" target="_blank">click here to open in a separate window</a>
</div>
<p></p>
<p>Magic! It just works, textures and all.</p>
<p>Next I wanted to see if I could animate the cars driving around so
I needed to check if the scene had the cars as separate entities
and if they were setup in a way I could use them.</p>
<p>I wrote some code to dump put the scenegraph to the <a href="debugging-javascript.html">JavaScript
console</a>.</p>
<p>Here's the code to print out the scenegraph.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">function dumpObject(obj, lines = [], isLast = true, prefix = '') {
const localPrefix = isLast ? '└─' : '├─';
lines.push(`${prefix}${prefix ? localPrefix : ''}${obj.name || '*no-name*'} [${obj.type}]`);
const newPrefix = prefix + (isLast ? ' ' : '│ ');
const lastNdx = obj.children.length - 1;
obj.children.forEach((child, ndx) => {
const isLast = ndx === lastNdx;
dumpObject(child, lines, isLast, newPrefix);
});
return lines;
}
</pre>
<p>And I just called it right after loading the scene.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">const gltfLoader = new GLTFLoader();
gltfLoader.load('resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf', (gltf) => {
const root = gltf.scene;
scene.add(root);
console.log(dumpObject(root).join('\n'));
</pre>
<p><a href="../examples/load-gltf-dump-scenegraph.html">Running that</a> I got this listing</p>
<pre class="prettyprint showlinemods notranslate lang-text" translate="no">OSG_Scene [Scene]
└─RootNode_(gltf_orientation_matrix) [Object3D]
└─RootNode_(model_correction_matrix) [Object3D]
└─4d4100bcb1c640e69699a87140df79d7fbx [Object3D]
└─RootNode [Object3D]
│ ...
├─Cars [Object3D]
│ ├─CAR_03_1 [Object3D]
│ │ └─CAR_03_1_World_ap_0 [Mesh]
│ ├─CAR_03 [Object3D]
│ │ └─CAR_03_World_ap_0 [Mesh]
│ ├─Car_04 [Object3D]
│ │ └─Car_04_World_ap_0 [Mesh]
│ ├─CAR_03_2 [Object3D]
│ │ └─CAR_03_2_World_ap_0 [Mesh]
│ ├─Car_04_1 [Object3D]
│ │ └─Car_04_1_World_ap_0 [Mesh]
│ ├─Car_04_2 [Object3D]
│ │ └─Car_04_2_World_ap_0 [Mesh]
│ ├─Car_04_3 [Object3D]
│ │ └─Car_04_3_World_ap_0 [Mesh]
│ ├─Car_04_4 [Object3D]
│ │ └─Car_04_4_World_ap_0 [Mesh]
│ ├─Car_08_4 [Object3D]
│ │ └─Car_08_4_World_ap8_0 [Mesh]
│ ├─Car_08_3 [Object3D]
│ │ └─Car_08_3_World_ap9_0 [Mesh]
│ ├─Car_04_1_2 [Object3D]
│ │ └─Car_04_1_2_World_ap_0 [Mesh]
│ ├─Car_08_2 [Object3D]
│ │ └─Car_08_2_World_ap11_0 [Mesh]
│ ├─CAR_03_1_2 [Object3D]
│ │ └─CAR_03_1_2_World_ap_0 [Mesh]
│ ├─CAR_03_2_2 [Object3D]
│ │ └─CAR_03_2_2_World_ap_0 [Mesh]
│ ├─Car_04_2_2 [Object3D]
│ │ └─Car_04_2_2_World_ap_0 [Mesh]
...
</pre>
<p>From that we can see all the cars happen to be under a parent
called <code class="notranslate" translate="no">"Cars"</code></p>
<pre class="prettyprint showlinemods notranslate lang-text" translate="no">* ├─Cars [Object3D]
│ ├─CAR_03_1 [Object3D]
│ │ └─CAR_03_1_World_ap_0 [Mesh]
│ ├─CAR_03 [Object3D]
│ │ └─CAR_03_World_ap_0 [Mesh]
│ ├─Car_04 [Object3D]
│ │ └─Car_04_World_ap_0 [Mesh]
</pre>
<p>So as a simple test I thought I would just try rotating
all the children of the "Cars" node around their Y axis.</p>
<p>I looked up the "Cars" node after loading the scene
and saved the result.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">+let cars;
{
const gltfLoader = new GLTFLoader();
gltfLoader.load('resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf', (gltf) => {
const root = gltf.scene;
scene.add(root);
+ cars = root.getObjectByName('Cars');
</pre>
<p>Then in the <code class="notranslate" translate="no">render</code> function we can just set the rotation
of each child of <code class="notranslate" translate="no">cars</code>.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">+function render(time) {
+ time *= 0.001; // convert to seconds
if (resizeRendererToDisplaySize(renderer)) {
const canvas = renderer.domElement;
camera.aspect = canvas.clientWidth / canvas.clientHeight;
camera.updateProjectionMatrix();
}
+ if (cars) {
+ for (const car of cars.children) {
+ car.rotation.y = time;
+ }
+ }
renderer.render(scene, camera);
requestAnimationFrame(render);
}
</pre>
<p>And we get</p>
<p></p><div translate="no" class="threejs_example_container notranslate">
<div><iframe class="threejs_example notranslate" translate="no" style=" " src="/manual/examples/resources/editor.html?url=/manual/examples/load-gltf-rotate-cars.html"></iframe></div>
<a class="threejs_center" href="/manual/examples/load-gltf-rotate-cars.html" target="_blank">click here to open in a separate window</a>
</div>
<p></p>
<p>Hmmm, it looks like unfortunately this scene wasn't designed to
animate the cars as their origins are not setup for that purpose.
The trucks are rotating in the wrong direction.</p>
<p>This brings up an important point which is if you're going to
do something in 3D you need to plan ahead and design your assets
so they have their origins in the correct places, so they are
the correct scale, etc.</p>
<p>Since I'm not an artist and I don't know blender that well I
will hack this example. We'll take each car and parent it to
another <a href="/docs/#api/en/core/Object3D"><code class="notranslate" translate="no">Object3D</code></a>. We will then move those <a href="/docs/#api/en/core/Object3D"><code class="notranslate" translate="no">Object3D</code></a> objects
to move the cars but separately we can set the car's original
<a href="/docs/#api/en/core/Object3D"><code class="notranslate" translate="no">Object3D</code></a> to re-orient it so it's about where we really need it.</p>
<p>Looking back at the scene graph listing it looks like there
are really only 3 types of cars, "Car_08", "CAR_03", and "Car_04".
Hopefully each type of car will work with the same adjustments.</p>
<p>I wrote this code to go through each car, parent it to a new
<a href="/docs/#api/en/core/Object3D"><code class="notranslate" translate="no">Object3D</code></a>, parent that new <a href="/docs/#api/en/core/Object3D"><code class="notranslate" translate="no">Object3D</code></a> to the scene, and apply
some per car <em>type</em> settings to fix its orientation, and add
the new <a href="/docs/#api/en/core/Object3D"><code class="notranslate" translate="no">Object3D</code></a> a <code class="notranslate" translate="no">cars</code> array.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">-let cars;
+const cars = [];
{
const gltfLoader = new GLTFLoader();
gltfLoader.load('resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf', (gltf) => {
const root = gltf.scene;
scene.add(root);
- cars = root.getObjectByName('Cars');
+ const loadedCars = root.getObjectByName('Cars');
+ const fixes = [
+ { prefix: 'Car_08', rot: [Math.PI * .5, 0, Math.PI +* .5], },
+ { prefix: 'CAR_03', rot: [0, Math.PI, 0], },
+ { prefix: 'Car_04', rot: [0, Math.PI, 0], },
+ ];
+
+ root.updateMatrixWorld();
+ for (const car of loadedCars.children.slice()) {
+ const fix = fixes.find(fix => car.name.startsWith(fix.prefix));
+ const obj = new THREE.Object3D();
+ car.getWorldPosition(obj.position);
+ car.position.set(0, 0, 0);
+ car.rotation.set(...fix.rot);
+ obj.add(car);
+ scene.add(obj);
+ cars.push(obj);
+ }
...
</pre>
<p>This fixes the orientation of the cars. </p>
<p></p><div translate="no" class="threejs_example_container notranslate">
<div><iframe class="threejs_example notranslate" translate="no" style=" " src="/manual/examples/resources/editor.html?url=/manual/examples/load-gltf-rotate-cars-fixed.html"></iframe></div>
<a class="threejs_center" href="/manual/examples/load-gltf-rotate-cars-fixed.html" target="_blank">click here to open in a separate window</a>
</div>
<p></p>
<p>Now let's drive them around.</p>
<p>Making even a simple driving system is too much for this post but
it seems instead we could just make one convoluted path that
drives down all the roads and then put the cars on the path.
Here's a picture from Blender about half way through building
the path.</p>
<div class="threejs_center"><img src="../resources/images/making-path-for-cars.jpg" style="width: 1094px"></div>
<p>I needed a way to get the data for that path out of Blender.
Fortunately I was able to select just my path and export .OBJ checking "write nurbs".</p>
<div class="threejs_center"><img src="../resources/images/blender-export-obj-write-nurbs.jpg" style="width: 498px"></div>
<p>Opening the .OBJ file I was able to get a list of points
which I formatted into this</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">const controlPoints = [
[1.118281, 5.115846, -3.681386],
[3.948875, 5.115846, -3.641834],
[3.960072, 5.115846, -0.240352],
[3.985447, 5.115846, 4.585005],
[-3.793631, 5.115846, 4.585006],
[-3.826839, 5.115846, -14.736200],
[-14.542292, 5.115846, -14.765865],
[-14.520929, 5.115846, -3.627002],
[-5.452815, 5.115846, -3.634418],
[-5.467251, 5.115846, 4.549161],
[-13.266233, 5.115846, 4.567083],
[-13.250067, 5.115846, -13.499271],
[4.081842, 5.115846, -13.435463],
[4.125436, 5.115846, -5.334928],
[-14.521364, 5.115846, -5.239871],
[-14.510466, 5.115846, 5.486727],
[5.745666, 5.115846, 5.510492],
[5.787942, 5.115846, -14.728308],
[-5.423720, 5.115846, -14.761919],
[-5.373599, 5.115846, -3.704133],
[1.004861, 5.115846, -3.641834],
];
</pre>
<p>THREE.js has some curve classes. The <a href="/docs/#api/en/extras/curves/CatmullRomCurve3"><code class="notranslate" translate="no">CatmullRomCurve3</code></a> seemed
like it might work. The thing about that kind of curve is
it tries to make a smooth curve going through the points.</p>
<p>In fact putting those points in directly will generate
a curve like this</p>
<div class="threejs_center"><img src="../resources/images/car-curves-before.png" style="width: 400px"></div>
<p>but we want a sharper corners. It seemed like if we computed
some extra points we could get what we want. For each pair
of points we'll compute a point 10% of the way between
the 2 points and another 90% of the way between the 2 points
and pass the result to <a href="/docs/#api/en/extras/curves/CatmullRomCurve3"><code class="notranslate" translate="no">CatmullRomCurve3</code></a>.</p>
<p>This will give us a curve like this</p>
<div class="threejs_center"><img src="../resources/images/car-curves-after.png" style="width: 400px"></div>
<p>Here's the code to make the curve </p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">let curve;
let curveObject;
{
const controlPoints = [
[1.118281, 5.115846, -3.681386],
[3.948875, 5.115846, -3.641834],
[3.960072, 5.115846, -0.240352],
[3.985447, 5.115846, 4.585005],
[-3.793631, 5.115846, 4.585006],
[-3.826839, 5.115846, -14.736200],
[-14.542292, 5.115846, -14.765865],
[-14.520929, 5.115846, -3.627002],
[-5.452815, 5.115846, -3.634418],
[-5.467251, 5.115846, 4.549161],
[-13.266233, 5.115846, 4.567083],
[-13.250067, 5.115846, -13.499271],
[4.081842, 5.115846, -13.435463],
[4.125436, 5.115846, -5.334928],
[-14.521364, 5.115846, -5.239871],
[-14.510466, 5.115846, 5.486727],
[5.745666, 5.115846, 5.510492],
[5.787942, 5.115846, -14.728308],
[-5.423720, 5.115846, -14.761919],
[-5.373599, 5.115846, -3.704133],
[1.004861, 5.115846, -3.641834],
];
const p0 = new THREE.Vector3();
const p1 = new THREE.Vector3();
curve = new THREE.CatmullRomCurve3(
controlPoints.map((p, ndx) => {
p0.set(...p);
p1.set(...controlPoints[(ndx + 1) % controlPoints.length]);
return [
(new THREE.Vector3()).copy(p0),
(new THREE.Vector3()).lerpVectors(p0, p1, 0.1),
(new THREE.Vector3()).lerpVectors(p0, p1, 0.9),
];
}).flat(),
true,
);
{
const points = curve.getPoints(250);
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({color: 0xff0000});
curveObject = new THREE.Line(geometry, material);
scene.add(curveObject);
}
}
</pre>
<p>The first part of that code makes a curve.
The second part of that code generates 250 points
from the curve and then creates an object to display
the lines made by connecting those 250 points.</p>
<p>Running <a href="../examples/load-gltf-car-path.html">the example</a> I didn't see
the curve. To make it visible I made it ignore the depth test and
render last</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no"> curveObject = new THREE.Line(geometry, material);
+ material.depthTest = false;
+ curveObject.renderOrder = 1;
</pre>
<p>And that's when I discovered it was way too small.</p>
<div class="threejs_center"><img src="../resources/images/car-curves-too-small.png" style="width: 498px"></div>
<p>Checking the hierarchy in Blender I found out that the artist had
scaled the node all the cars are parented to.</p>
<div class="threejs_center"><img src="../resources/images/cars-scale-0.01.png" style="width: 342px;"></div>
<p>Scaling is bad for real time 3D apps. It causes all kinds of
issues and ends up being no end of frustration when doing
real time 3D. Artists often don't know this because it's so
easy to scale an entire scene in a 3D editing program but
if you decide to make a real time 3D app I suggest you request your
artists to never scale anything. If they change the scale
they should find a way to apply that scale to the vertices
so that when it ends up making it to your app you can ignore
scale.</p>
<p>And, not just scale, in this case the cars are rotated and offset
by their parent, the <code class="notranslate" translate="no">Cars</code> node. This will make it hard at runtime
to move the cars around in world space. To be clear, in this case
we want cars to drive around in world space which is why these
issues are coming up. If something that is meant to be manipulated
in a local space, like the moon revolving around the earth this
is less of an issue.</p>
<p>Going back to the function we wrote above to dump the scene graph,
let's dump the position, rotation, and scale of each node.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">+function dumpVec3(v3, precision = 3) {
+ return `${v3.x.toFixed(precision)}, ${v3.y.toFixed(precision)}, ${v3.z.toFixed(precision)}`;
+}
function dumpObject(obj, lines, isLast = true, prefix = '') {
const localPrefix = isLast ? '└─' : '├─';
lines.push(`${prefix}${prefix ? localPrefix : ''}${obj.name || '*no-name*'} [${obj.type}]`);
+ const dataPrefix = obj.children.length
+ ? (isLast ? ' │ ' : '│ │ ')
+ : (isLast ? ' ' : '│ ');
+ lines.push(`${prefix}${dataPrefix} pos: ${dumpVec3(obj.position)}`);
+ lines.push(`${prefix}${dataPrefix} rot: ${dumpVec3(obj.rotation)}`);
+ lines.push(`${prefix}${dataPrefix} scl: ${dumpVec3(obj.scale)}`);
const newPrefix = prefix + (isLast ? ' ' : '│ ');
const lastNdx = obj.children.length - 1;
obj.children.forEach((child, ndx) => {
const isLast = ndx === lastNdx;
dumpObject(child, lines, isLast, newPrefix);
});
return lines;
}
</pre>
<p>And the result from <a href="../examples/load-gltf-dump-scenegraph-extra.html">running it</a></p>
<pre class="prettyprint showlinemods notranslate lang-text" translate="no">OSG_Scene [Scene]
│ pos: 0.000, 0.000, 0.000
│ rot: 0.000, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─RootNode_(gltf_orientation_matrix) [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: -1.571, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─RootNode_(model_correction_matrix) [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: 0.000, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─4d4100bcb1c640e69699a87140df79d7fbx [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: 1.571, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─RootNode [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: 0.000, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
├─Cars [Object3D]
* │ │ pos: -369.069, -90.704, -920.159
* │ │ rot: 0.000, 0.000, 0.000
* │ │ scl: 1.000, 1.000, 1.000
│ ├─CAR_03_1 [Object3D]
│ │ │ pos: 22.131, 14.663, -475.071
│ │ │ rot: -3.142, 0.732, 3.142
│ │ │ scl: 1.500, 1.500, 1.500
│ │ └─CAR_03_1_World_ap_0 [Mesh]
│ │ pos: 0.000, 0.000, 0.000
│ │ rot: 0.000, 0.000, 0.000
│ │ scl: 1.000, 1.000, 1.000
</pre>
<p>This shows us that <code class="notranslate" translate="no">Cars</code> in the original scene has had its rotation and scale
removed and applied to its children. That suggests either whatever exporter was
used to create the .GLTF file did some special work here or more likely the
artist exported a different version of the file than the corresponding .blend
file, which is why things don't match.</p>
<p>The moral of that is I should have probably downloaded the .blend
file and exported myself. Before exporting I should have inspected
all the major nodes and removed any transformations.</p>
<p>All these nodes at the top</p>
<pre class="prettyprint showlinemods notranslate lang-text" translate="no">OSG_Scene [Scene]
│ pos: 0.000, 0.000, 0.000
│ rot: 0.000, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─RootNode_(gltf_orientation_matrix) [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: -1.571, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─RootNode_(model_correction_matrix) [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: 0.000, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
└─4d4100bcb1c640e69699a87140df79d7fbx [Object3D]
│ pos: 0.000, 0.000, 0.000
│ rot: 1.571, 0.000, 0.000
│ scl: 1.000, 1.000, 1.000
</pre>
<p>are also a waste.</p>
<p>Ideally the scene would consist of a single "root" node with no position,
rotation, or scale. At runtime I could then pull all the children out of that
root and parent them to the scene itself. There might be children of the root
like "Cars" which would help me find all the cars but ideally it would also have
no translation, rotation, or scale so I could re-parent the cars to the scene
with the minimal amount of work.</p>
<p>In any case the quickest though maybe not the best fix is to just
adjust the object we're using to view the curve.</p>
<p>Here's what I ended up with.</p>
<p>First I adjusted the position of the curve and found values
that seemed to work. I then hid it.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">{
const points = curve.getPoints(250);
const geometry = new THREE.BufferGeometry().setFromPoints(points);
const material = new THREE.LineBasicMaterial({color: 0xff0000});
curveObject = new THREE.Line(geometry, material);
+ curveObject.scale.set(100, 100, 100);
+ curveObject.position.y = -621;
+ curveObject.visible = false;
material.depthTest = false;
curveObject.renderOrder = 1;
scene.add(curveObject);
}
</pre>
<p>Then I wrote code to move the cars along the curve. For each car we pick a
position from 0 to 1 along the curve and compute a point in world space using
the <code class="notranslate" translate="no">curveObject</code> to transform the point. We then pick another point slightly
further down the curve. We set the car's orientation using <code class="notranslate" translate="no">lookAt</code> and put the
car at the mid point between the 2 points.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">// create 2 Vector3s we can use for path calculations
const carPosition = new THREE.Vector3();
const carTarget = new THREE.Vector3();
function render(time) {
...
- for (const car of cars) {
- car.rotation.y = time;
- }
+ {
+ const pathTime = time * .01;
+ const targetOffset = 0.01;
+ cars.forEach((car, ndx) => {
+ // a number between 0 and 1 to evenly space the cars
+ const u = pathTime + ndx / cars.length;
+
+ // get the first point
+ curve.getPointAt(u % 1, carPosition);
+ carPosition.applyMatrix4(curveObject.matrixWorld);
+
+ // get a second point slightly further down the curve
+ curve.getPointAt((u + targetOffset) % 1, carTarget);
+ carTarget.applyMatrix4(curveObject.matrixWorld);
+
+ // put the car at the first point (temporarily)
+ car.position.copy(carPosition);
+ // point the car the second point
+ car.lookAt(carTarget);
+
+ // put the car between the 2 points
+ car.position.lerpVectors(carPosition, carTarget, 0.5);
+ });
+ }
</pre>
<p>and when I ran it I found out for each type of car, their height above their origins
are not consistently set and so I needed to offset each one
a little.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">const loadedCars = root.getObjectByName('Cars');
const fixes = [
- { prefix: 'Car_08', rot: [Math.PI * .5, 0, Math.PI * .5], },
- { prefix: 'CAR_03', rot: [0, Math.PI, 0], },
- { prefix: 'Car_04', rot: [0, Math.PI, 0], },
+ { prefix: 'Car_08', y: 0, rot: [Math.PI * .5, 0, Math.PI * .5], },
+ { prefix: 'CAR_03', y: 33, rot: [0, Math.PI, 0], },
+ { prefix: 'Car_04', y: 40, rot: [0, Math.PI, 0], },
];
root.updateMatrixWorld();
for (const car of loadedCars.children.slice()) {
const fix = fixes.find(fix => car.name.startsWith(fix.prefix));
const obj = new THREE.Object3D();
car.getWorldPosition(obj.position);
- car.position.set(0, 0, 0);
+ car.position.set(0, fix.y, 0);
car.rotation.set(...fix.rot);
obj.add(car);
scene.add(obj);
cars.push(obj);
}
</pre>
<p>And the result.</p>
<p></p><div translate="no" class="threejs_example_container notranslate">
<div><iframe class="threejs_example notranslate" translate="no" style=" " src="/manual/examples/resources/editor.html?url=/manual/examples/load-gltf-animated-cars.html"></iframe></div>
<a class="threejs_center" href="/manual/examples/load-gltf-animated-cars.html" target="_blank">click here to open in a separate window</a>
</div>
<p></p>
<p>Not bad for a few minutes work.</p>
<p>The last thing I wanted to do is turn on shadows.</p>
<p>To do this I grabbed all the GUI code from the <a href="/docs/#api/en/lights/DirectionalLight"><code class="notranslate" translate="no">DirectionalLight</code></a> shadows
example in <a href="shadows.html">the article on shadows</a> and pasted it
into our latest code.</p>
<p>Then, after loading, we need to turn on shadows on all the objects.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">{
const gltfLoader = new GLTFLoader();
gltfLoader.load('resources/models/cartoon_lowpoly_small_city_free_pack/scene.gltf', (gltf) => {
const root = gltf.scene;
scene.add(root);
+ root.traverse((obj) => {
+ if (obj.castShadow !== undefined) {
+ obj.castShadow = true;
+ obj.receiveShadow = true;
+ }
+ });
</pre>
<p>I then spent nearly 4 hours trying to figure out why the shadow helpers
were not working. It was because I forgot to enable shadows with</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">renderer.shadowMap.enabled = true;
</pre>
<p>😭</p>
<p>I then adjusted the values until our <code class="notranslate" translate="no">DirectionLight</code>'s shadow camera
had a frustum that covered the entire scene. These are the settings
I ended up with.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">{
const color = 0xFFFFFF;
const intensity = 1;
const light = new THREE.DirectionalLight(color, intensity);
+ light.castShadow = true;
* light.position.set(-250, 800, -850);
* light.target.position.set(-550, 40, -450);
+ light.shadow.bias = -0.004;
+ light.shadow.mapSize.width = 2048;
+ light.shadow.mapSize.height = 2048;
scene.add(light);
scene.add(light.target);
+ const cam = light.shadow.camera;
+ cam.near = 1;
+ cam.far = 2000;
+ cam.left = -1500;
+ cam.right = 1500;
+ cam.top = 1500;
+ cam.bottom = -1500;
...
</pre>
<p>and I set the background color to light blue.</p>
<pre class="prettyprint showlinemods notranslate lang-js" translate="no">const scene = new THREE.Scene();
-scene.background = new THREE.Color('black');
+scene.background = new THREE.Color('#DEFEFF');
</pre>
<p>And ... shadows</p>
<p></p><div translate="no" class="threejs_example_container notranslate">
<div><iframe class="threejs_example notranslate" translate="no" style=" " src="/manual/examples/resources/editor.html?url=/manual/examples/load-gltf-shadows.html"></iframe></div>
<a class="threejs_center" href="/manual/examples/load-gltf-shadows.html" target="_blank">click here to open in a separate window</a>
</div>
<p></p>
<p>I hope walking through this project was useful and showed some
good examples of working though some of the issues of loading
a file with a scenegraph.</p>
<p>One interesting thing is that comparing the .blend file to the .gltf
file, the .blend file has several lights but they are not lights
after being loaded into the scene. A .GLTF file is just a JSON
file so you can easily look inside. It consists of several
arrays of things and each item in an array is referenced by index
else where. While there are extensions in the works they point
to a problem with almost all 3d formats. <strong>They can never cover every
case</strong>.</p>
<p>There is always a need for more data. For example we manually exported
a path for the cars to follow. Ideally that info could have been in
the .GLTF file but to do that we'd need to write our own exporter
and some how mark nodes for how we want them exported or use a
naming scheme or something along those lines to get data from
whatever tool we're using to create the data into our app.</p>
<p>All of that is left as an exercise to the reader.</p>
</div>
</div>
</div>
<script src="/manual/resources/prettify.js"></script>
<script src="/manual/resources/lesson.js"></script>
</body></html> | HTML | 5 | yangmengwei925/3d | manual/en/load-gltf.html | [
"MIT"
]
|
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
ClassCount=1
ResourceCount=1
NewFileInclude1=#include "stdafx.h"
Class1=CPortView
LastClass=CPortView
LastTemplate=CFormView
Resource1=IDD_NODEVIEW
[DLG:IDD_NODEVIEW]
Type=1
Class=CPortView
ControlCount=19
Control1=IDC_X,edit,1350631552
Control2=IDC_SPINX,msctls_updown32,1342177312
Control3=IDC_Y,edit,1350631552
Control4=IDC_SPINY,msctls_updown32,1342177312
Control5=IDC_Z,edit,1350631552
Control6=IDC_SPINZ,msctls_updown32,1342177312
Control7=IDC_STATIC,static,1342308352
Control8=IDC_PITCH,edit,1350631552
Control9=IDC_SPINPITCH,msctls_updown32,1342177312
Control10=IDC_YAW,edit,1350631552
Control11=IDC_SPINYAW,msctls_updown32,1342177312
Control12=IDC_ROLL,edit,1350631552
Control13=IDC_SPINROLL,msctls_updown32,1342177312
Control14=IDC_STATIC,static,1342308352
Control15=IDC_STATIC,static,1342308352
Control16=IDC_STATIC,static,1342308352
Control17=IDC_STATIC,static,1342308352
Control18=IDC_STATIC,static,1342308352
Control19=IDC_STATIC,button,1342210823
[CLS:CPortView]
Type=0
HeaderFile=PortView.h
ImplementationFile=PortView.cpp
BaseClass=CFormView
Filter=D
LastObject=CPortView
| Clarion | 3 | CarysT/medusa | Tools/NodePortWizard/Template/root.clw | [
"MIT"
]
|
--TEST--
Simple If/ElseIf/Else Test
--FILE--
<?php
$a=1;
if($a==0) {
echo "bad";
} elseif($a==3) {
echo "bad";
} else {
echo "good";
}
?>
--EXPECT--
good
| PHP | 4 | thiagooak/php-src | tests/lang/005.phpt | [
"PHP-3.01"
]
|
<%= partial_name_local_variable %>
| HTML+ERB | 0 | mdesantis/rails | actionview/test/fixtures/test/_partial_name_local_variable.erb | [
"MIT"
]
|
--TEST--
Accessing self::FOO in a free function
--FILE--
<?php
function test() {
var_dump(self::FOO);
}
?>
--EXPECTF--
Fatal error: Cannot use "self" when no class scope is active in %s on line %d
| PHP | 2 | thiagooak/php-src | Zend/tests/self_class_const_outside_class.phpt | [
"PHP-3.01"
]
|
sleep 2
t app key record
<<<<<<< HEAD
sleep 107
t app key record
sleep 1
deletedir d:\pastloopedrecordings\8minbefore
mkdir d:\pastloopedrecordings\8minbefore
mv d:\pastloopedrecordings\6minbefore\* d:\pastloopedrecordings\8minbefore\
deletedir d:\pastloopedrecordings\6minbefore
mkdir d:\pastloopedrecordings\6minbefore
mv d:\pastloopedrecordings\4minbefore\* d:\pastloopedrecordings\6minbefore\
deletedir d:\pastloopedrecordings\4minbefore
mkdir d:\pastloopedrecordings\4minbefore
mv d:\pastloopedrecordings\2minbefore\* d:\pastloopedrecordings\4minbefore\
deletedir d:\pastloopedrecordings\2minbefore
mkdir d:\pastloopedrecordings\2minbefore
mv d:\DCIM\* d:\pastloopedrecordings\2minbefore\
sleep 10
=======
deletedir d:\DCIM\8minbefore
mkdir d:\DCIM\8minbefore
mv d:\DCIM\6minbefore\* d:\DCIM\8minbefore\
sleep 5
deletedir d:\DCIM\6minbefore
mkdir d:\DCIM\6minbefore
mv d:\DCIM\4minbefore\* d:\DCIM\6minbefore\
sleep 5
deletedir d:\DCIM\4minbefore
mkdir d:\DCIM\4minbefore
mv d:\DCIM\2minbefore\* d:\DCIM\4minbefore\
sleep 5
deletedir d:\DCIM\2minbefore
mkdir d:\DCIM\2minbefore
sleep 105
t app key record
sleep 1
mv d:\DCIM\100GOPRO\* d:\DCIM\2minbefore\
sleep 5
>>>>>>> 69af0a09336ebaff3f23235f01f8d0fa4434dc07
reboot yes
| AGS Script | 2 | waltersgrey/autoexechack | HERO/LoopVideo/2Min/autoexec.ash | [
"MIT"
]
|
#include "share/atspre_staload.hats"
#include "share/HATS/atslib_staload_libats_libc.hats"
#include "DATS/shared.dats"
#include "$PATSHOMELOCS/edit-distance-0.5.0/DATS/edit-distance.dats"
#include "DATS/utils.dats"
#include "DATS/error.dats"
#include "DATS/html.dats"
implement main0 (argc, argv) =
let
val cli = @{ version = false
, help = false
, no_table = false
, html = false
, no_parallel = false
, no_colorize = false
, skip_links = false
, verbose = false
, excludes = list_nil()
, includes = list_nil()
} : command_line
val parsed = get_cli(argc, argv, 0, false, cli)
val () = check_cli(parsed)
in
if parsed.help then
(help() ; exit(0))
else
if parsed.version then
(version() ; exit(0))
else
let
var result = if length(parsed.includes) > 0 then
let
var x = empty_contents()
val () = map_stream(x, parsed.includes, parsed.excludes, parsed.verbose)
in
x
end
else
let
var x = empty_contents()
val () = map_stream(x, list_cons(".", list_nil()), parsed.excludes, parsed.verbose)
in
x
end
in
if parsed.no_table then
print(make_output(result, not(cli.no_colorize)))
else
if parsed.html then
print(make_html(result))
else
print(make_table(result, not(cli.no_colorize)))
end
end
| ATS | 3 | lambdaxymox/polyglot | src/compat.dats | [
"BSD-3-Clause"
]
|
"""The tests for marytts tts platforms."""
| Python | 0 | domwillcode/home-assistant | tests/components/marytts/__init__.py | [
"Apache-2.0"
]
|
import org.springframework.boot.gradle.tasks.bundling.BootJar
import org.springframework.boot.gradle.tasks.bundling.BootBuildImage
plugins {
java
id("org.springframework.boot") version "{gradle-project-version}"
}
tasks.getByName<BootJar>("bootJar") {
mainClass.set("com.example.ExampleApplication")
}
// tag::builder[]
tasks.getByName<BootBuildImage>("bootBuildImage") {
builder = "mine/java-cnb-builder"
runImage = "mine/java-cnb-run"
}
// end::builder[]
tasks.register("bootBuildImageBuilder") {
doFirst {
println("builder=${tasks.getByName<BootBuildImage>("bootBuildImage").builder}")
println("runImage=${tasks.getByName<BootBuildImage>("bootBuildImage").runImage}")
}
}
| Kotlin | 4 | techAi007/spring-boot | spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/gradle/packaging/boot-build-image-builder.gradle.kts | [
"Apache-2.0"
]
|
100 5 0 0
0 1 4 4 1 2 3 [0] [0] [0] [0]
1 1 1 14 [15]
2 1 1 100 [10]
3 1 1 79 [10]
4 1 1 44 [5]
5 1 1 70 [12]
6 1 1 57 [12]
7 1 1 32 [15]
8 1 1 95 [9]
9 1 1 20 [12]
10 1 1 47 [7]
11 1 2 63 90 [7] [7]
12 1 2 41 63 [10] [10]
13 1 1 82 [6]
14 1 1 49 [5]
15 1 1 54 [9]
16 1 2 3 11 [-91] [7]
17 1 1 98 [12]
18 1 1 56 [9]
19 1 1 86 [15]
20 1 2 67 60 [14] [14]
21 1 1 59 [12]
22 1 1 30 [12]
23 1 1 97 [8]
24 1 2 69 47 [8] [8]
25 1 2 24 6 [15] [-36]
26 1 3 46 65 87 [14] [-105] [14]
27 1 1 25 [9]
28 1 1 50 [6]
29 1 1 72 [7]
30 1 1 91 [5]
31 1 1 43 [12]
32 1 2 62 92 [8] [-44]
33 1 2 71 59 [8] [-23]
34 1 2 91 40 [6] [6]
35 1 2 66 80 [13] [13]
36 1 2 45 56 [10] [10]
37 1 1 93 [14]
38 1 1 96 [10]
39 1 1 99 [10]
40 1 2 12 64 [7] [7]
41 1 1 64 [6]
42 1 1 94 [11]
43 1 2 96 10 [14] [14]
44 1 3 67 18 13 [11] [11] [11]
45 1 1 18 [13]
46 1 1 83 [5]
47 1 1 38 [11]
48 1 1 37 [6]
49 1 1 76 [8]
50 1 1 29 [14]
51 1 2 38 31 [15] [15]
52 1 1 9 [5]
53 1 1 16 [7]
54 1 2 81 15 [6] [-9]
55 1 1 22 [13]
56 1 1 17 [10]
57 1 1 27 [15]
58 1 1 84 [13]
59 1 1 87 [8]
60 1 1 77 [9]
61 1 1 19 [13]
62 1 1 42 [12]
63 1 3 42 64 92 [13] [13] [13]
64 1 1 7 [15]
65 1 1 28 [7]
66 1 1 51 [15]
67 1 1 6 [14]
68 1 1 35 [12]
69 1 1 68 [6]
70 1 1 85 [15]
71 1 1 80 [15]
72 1 1 58 [10]
73 1 3 46 21 83 [-11] [11] [-9]
74 1 1 52 [13]
75 1 1 5 [5]
76 1 1 65 [8]
77 1 1 23 [14]
78 1 2 40 89 [15] [15]
79 1 1 78 [11]
80 1 1 60 [5]
81 1 1 8 [8]
82 1 1 88 [13]
83 1 1 73 [6]
84 1 1 75 [8]
85 1 1 26 [8]
86 1 2 15 19 [14] [-15]
87 1 1 33 [15]
88 1 1 74 [13]
89 1 1 48 [15]
90 1 1 34 [9]
91 1 1 36 [9]
92 1 1 41 [8]
93 1 2 53 90 [13] [13]
94 1 2 61 18 [14] [14]
95 1 3 55 100 81 [12] [12] [-17]
96 1 1 39 [6]
97 1 1 101 [9]
98 1 1 101 [12]
99 1 1 101 [11]
100 1 1 101 [11]
101 1 0
0 1 0 0 0 0 0 0
1 1 15 3 1 0 2 3
2 1 10 3 0 2 2 3
3 1 10 3 3 0 2 3
4 1 5 0 2 2 1 2
5 1 12 2 2 3 0 3
6 1 12 2 3 3 2 0
7 1 15 1 0 2 1 0
8 1 9 1 1 1 0 2
9 1 12 3 0 1 2 1
10 1 7 2 3 2 0 1
11 1 7 1 2 3 2 2
12 1 10 2 1 1 0 1
13 1 6 0 1 3 2 1
14 1 5 2 0 1 1 1
15 1 9 1 1 3 2 0
16 1 7 3 0 3 3 2
17 1 12 3 1 2 0 2
18 1 9 2 0 2 2 2
19 1 15 1 2 3 0 2
20 1 14 2 2 0 3 3
21 1 12 1 1 2 3 0
22 1 12 0 1 0 1 3
23 1 8 1 3 1 3 3
24 1 8 2 3 2 1 3
25 1 15 2 3 1 3 3
26 1 14 2 3 2 1 3
27 1 9 0 3 3 2 1
28 1 6 1 1 0 3 3
29 1 7 3 3 1 2 1
30 1 5 1 1 1 1 2
31 1 12 3 3 3 3 3
32 1 8 3 1 2 1 2
33 1 8 2 2 3 3 0
34 1 6 2 3 0 3 1
35 1 13 2 1 1 2 0
36 1 10 2 2 3 3 2
37 1 14 0 2 3 3 2
38 1 10 0 2 1 3 1
39 1 10 0 3 3 1 0
40 1 7 2 3 1 0 3
41 1 6 3 0 3 2 1
42 1 11 1 2 2 0 1
43 1 14 0 2 2 1 1
44 1 11 3 2 0 1 1
45 1 13 0 3 3 0 3
46 1 5 1 3 1 1 1
47 1 11 1 0 1 2 2
48 1 6 2 2 1 3 0
49 1 8 0 2 1 2 2
50 1 14 2 2 1 1 0
51 1 15 0 1 3 3 2
52 1 5 1 0 3 3 2
53 1 7 1 1 0 3 2
54 1 6 3 2 1 2 0
55 1 13 2 2 1 1 1
56 1 10 1 3 0 0 2
57 1 15 3 1 0 3 2
58 1 13 1 0 2 1 2
59 1 8 3 0 3 2 2
60 1 9 3 2 2 1 1
61 1 13 3 1 1 1 1
62 1 12 3 2 1 0 3
63 1 13 2 3 2 2 2
64 1 15 3 2 3 1 0
65 1 7 3 0 3 1 0
66 1 15 3 3 3 1 0
67 1 14 1 3 3 0 2
68 1 12 0 2 3 1 3
69 1 6 3 1 2 0 3
70 1 15 2 3 3 2 3
71 1 15 3 1 0 3 1
72 1 10 3 3 1 3 0
73 1 11 2 0 2 3 2
74 1 13 2 3 2 2 1
75 1 5 0 2 2 1 3
76 1 8 2 1 1 2 1
77 1 14 2 1 1 1 0
78 1 15 3 1 3 2 3
79 1 11 2 1 2 2 1
80 1 5 3 2 1 1 3
81 1 8 2 1 0 3 2
82 1 13 0 1 1 1 0
83 1 6 1 3 1 0 1
84 1 8 2 2 1 1 2
85 1 8 2 3 1 3 3
86 1 14 2 0 1 2 3
87 1 15 1 1 0 2 3
88 1 13 2 2 1 0 1
89 1 15 0 3 3 2 3
90 1 9 0 0 1 1 1
91 1 9 1 2 0 1 3
92 1 8 1 2 0 1 3
93 1 13 1 0 3 3 2
94 1 14 1 3 0 1 1
95 1 12 3 1 3 3 1
96 1 6 3 2 1 1 0
97 1 9 2 2 2 0 3
98 1 12 1 1 1 0 2
99 1 11 2 0 3 3 3
100 1 11 2 1 1 1 3
101 1 0 0 0 0 0 0
5 4 4 4 5
| Eagle | 0 | klorel/or-tools | examples/data/rcpsp/single_mode_max_delay/testsetd/psp157.sch | [
"Apache-2.0"
]
|
/* Cydia Substrate - Powerful Code Insertion Platform
* Copyright (C) 2008-2015 Jay Freeman (saurik)
*/
(function(exports) {
var libcycript = dlopen("/usr/lib/libcycript.dylib", RTLD_NOLOAD);
if (libcycript == null) {
exports.error = dlerror();
return;
}
var CYHandleServer = dlsym(libcycript, "CYHandleServer");
if (CYHandleServer == null) {
exports.error = dlerror();
return;
}
var info = new Dl_info;
if (dladdr(CYHandleServer, info) == 0) {
exports.error = dlerror();
return;
}
var path = info->dli_fname;
var slash = path.lastIndexOf('/');
if (slash == -1)
return;
var libsubstrate = dlopen(path.substr(0, slash) + "/libsubstrate.dylib", RTLD_GLOBAL | RTLD_LAZY);
if (libsubstrate == null) {
exports.error = dlerror();
return;
}
extern "C" void *MSGetImageByName(const char *);
extern "C" void *MSFindSymbol(void *, const char *);
extern "C" void MSHookFunction(void *, void *, void **);
extern "C" void MSHookMessageEx(Class, SEL, void *, void **);
var slice = Array.prototype.slice;
exports.getImageByName = MSGetImageByName;
exports.findSymbol = MSFindSymbol;
exports.hookFunction = function(func, hook, old) {
var type = typeid(func);
var pointer;
if (old == null || typeof old === "undefined")
pointer = null;
else {
pointer = new (typedef void **);
*old = function() { return type(*pointer).apply(null, arguments); };
}
MSHookFunction(func.valueOf(), type(hook), pointer);
};
exports.hookMessage = function(isa, sel, imp, old) {
var type = sel.type(isa);
var pointer;
if (old == null || typeof old === "undefined")
pointer = null;
else {
pointer = new (typedef void **);
*old = function() { return type(*pointer).apply(null, [this, sel].concat(slice.call(arguments))); };
}
MSHookMessageEx(isa, sel, type(function(self, sel) { return imp.apply(self, slice.call(arguments, 2)); }), pointer);
};
})(exports);
| Cycript | 3 | pipihi/nx | cycript/Cycript.lib/cycript0.9/com/saurik/substrate/MS.cy | [
"MIT"
]
|
package ini
import "fmt"
const (
// ErrCodeParseError is returned when a parsing error
// has occurred.
ErrCodeParseError = "INIParseError"
)
// ParseError is an error which is returned during any part of
// the parsing process.
type ParseError struct {
msg string
}
// NewParseError will return a new ParseError where message
// is the description of the error.
func NewParseError(message string) *ParseError {
return &ParseError{
msg: message,
}
}
// Code will return the ErrCodeParseError
func (err *ParseError) Code() string {
return ErrCodeParseError
}
// Message returns the error's message
func (err *ParseError) Message() string {
return err.msg
}
// OrigError return nothing since there will never be any
// original error.
func (err *ParseError) OrigError() error {
return nil
}
func (err *ParseError) Error() string {
return fmt.Sprintf("%s: %s", err.Code(), err.Message())
}
| Go | 4 | t12g/terraform-validator | vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go | [
"Apache-2.0"
]
|
default.doesnt.match.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] ne correspond pas au pattern [{3}]
default.invalid.url.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] n'est pas une URL valide
default.invalid.creditCard.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] n'est pas un numéro de carte de crédit valide
default.invalid.email.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] n'est pas une adresse e-mail valide
default.invalid.range.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] n'est pas contenue dans l'intervalle [{3}] à [{4}]
default.invalid.size.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] n'est pas contenue dans l'intervalle [{3}] à [{4}]
default.invalid.max.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] est supérieure à la valeur maximum [{3}]
default.invalid.min.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] est inférieure à la valeur minimum [{3}]
default.invalid.max.size.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] est supérieure à la valeur maximum [{3}]
default.invalid.min.size.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] est inférieure à la valeur minimum [{3}]
default.invalid.validator.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] n'est pas valide
default.not.inlist.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] ne fait pas partie de la liste [{3}]
default.blank.message=La propriété [{0}] de la classe [{1}] ne peut pas être vide
default.not.equal.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] ne peut pas être égale à [{3}]
default.null.message=La propriété [{0}] de la classe [{1}] ne peut pas être nulle
default.not.unique.message=La propriété [{0}] de la classe [{1}] avec la valeur [{2}] doit être unique
default.paginate.prev=Précédent
default.paginate.next=Suivant
| INI | 2 | xsoheilalizadeh/FrameworkBenchmarks | frameworks/Groovy/grails/grails-app/i18n/messages_fr.properties | [
"BSD-3-Clause"
]
|
label cca0018:
call gl(0,"bgcc0008a")
call vsp(0,1)
call vsp(1,0)
with wipeleft
play bgm "bgm/bgm002.ogg"
voice "vmcca0018yki000"
友貴 "「太一ー」"
"廊下を歩いていると、呼び止められた。"
太一 "「お、まだいたの?」"
call gl(1,"TCST0000b|TCST0000")
call gp(1,t=center)
call vsp(1,1)
with Dissolve(500.0/1000.0)
voice "vmcca0018yki001"
友貴 "「そっちこそ」"
"友貴の顔が能面のようだった。"
"微妙な距離を置いて、ふたり。"
太一 "「部活だったんだよ」"
太一 "「最近部活に出てる」"
call gl(1,"TCST0004b|TCST0004")
call vsp(1,1)
with dissolve
voice "vmcca0018yki002"
友貴 "「……どうしてまた?」"
太一 "「いや、目的があっていいじゃないか」"
voice "vmcca0018yki003"
友貴 "「部活って、例の与太話?」"
"群青学院放送局の開局。"
太一 "「与太じゃないよ、たぶん」"
call gl(1,"TCST0005b|TCST0004")
call vsp(1,1)
with dissolve
voice "vmcca0018yki004"
友貴 "「太一がそういうことするのは……なんか、まあ、理由あってのことだろうけど」"
call gl(1,"TCST0000b|TCST0000")
call vsp(1,1)
with dissolve
voice "vmcca0018yki005"
友貴 "「他に誰が参加してんの?」"
太一 "「部長」"
voice "vmcca0018yki006"
友貴 "「……だけ?」"
太一 "「そう」"
call gl(1,"TCST0000b|TCST0000")
call vsp(1,1)
with dissolve
voice "vmcca0018yki007"
友貴 "「それ部活じゃない……」"
太一 "「部活と思えば自慰だって部活だ」"
call gl(1,"TCST0005b|TCST0004")
call vsp(1,1)
with dissolve
voice "vmcca0018yki008"
友貴 "「……最近、いろいろと動いてるのは知ってたけど、部活とはね」"
"肩をすくめた。"
太一 "「そっちこそ。今なにやってんだ?」"
call gl(1,"TCST0004b|TCST0004")
call vsp(1,1)
with dissolve
voice "vmcca0018yki009"
友貴 "「部活」"
太一 "「わはは」"
太一 "「……え、意味わからん?」"
call gl(1,"TCST0003b|TCST0000")
call vsp(1,1)
with dissolve
voice "vmcca0018yki010"
友貴 "「本物の部活」"
call gl(1,"TCST0000b|TCST0000")
call vsp(1,1)
with dissolve
voice "vmcca0018yki011"
友貴 "「暇だったら参加してくれよな」"
stop bgm
太一 "「そりゃいいけど……」"
call gl(1,"TCST0004b|TCST0004")
call vsp(1,1)
with dissolve
voice "vmcca0018yki012"
友貴 "「……裏切られるぞ」"
"ぽつ、と言う。"
太一 "「誰に?」"
voice "vmcca0018yki013"
友貴 "「部長に」"
play bgm "bgm/bgm007.ogg"
太一 "「なぜ?」"
voice "vmcca0018yki014"
友貴 "「だから、あまり親しくしない方がいい」"
hide pic1
with dissolve
"背を向けて、友貴は立ち去る。"
"様子が変だったな。"
"どうしたんだろう?"
stop bgm
play bgm "bgm/bgm004.ogg"
play se "se001"
call gl(0,"bgcc0005a")
call vsp(0,1)
with wipeleft
pause (500.0/1000.0)
"帰路。"
"大人しかった蝉たちが、再びじわじわと鳴きはじめる。"
call gl(1,"TCSY0000b|tcsy")
call gp(1,t=center)
call vsp(1,1)
with dissolve
voice "vmcca0018shi000"
新川 "「ちょいーす」"
太一 "「ん……おお、谷崎!」"
call gl(1,"TCSY0001b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi001"
新川 "「鴻巣! 元気だったか」"
太一 "「ああ、この鴻巣太一、たとえ免停になっても元気だけが取り柄だ」"
voice "vmcca0018shi002"
新川 "「それを言うならこの谷崎豊だってそうだぜ?」"
太一 "「数日ぶりだな、谷崎」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi003"
新川 "「ああ、鴻巣」"
太一 "「谷崎は学校いつから来んの?」"
voice "vmcca0018shi004"
新川 "「いちおー、明日になった、鴻巣」"
"手にしたA4封筒をひらひらと振る。"
"学校関係の書類だろう。"
太一 "「お、うちのクラスに転入してこいよ谷崎」"
voice "vmcca0018shi005"
新川 "「鴻巣、無茶言うなよ。自分じゃ決められないってーの」"
太一 "「わはは」"
call gl(1,"TCSY0001b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi006"
新川 "「わはは」"
"二人でげはげは笑う。"
太一 "「だけどさ谷崎―――」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi007"
新川 "「……OKギブアップだ! 新川豊です、すいませんでした黒須さん」"
太一 "「ああ、やめとく?」"
voice "vmcca0018shi008"
新川 "「果てしなく続きそうだったから」"
太一 "「もう帰り?」"
voice "vmcca0018shi009"
新川 "「ああ」"
太一 "「どうする、うち寄ってくか?」"
voice "vmcca0018shi010"
新川 "「近いのか?」"
太一 "「こっから十分くらいかな」"
voice "vmcca0018shi011"
新川 "「いいトコ住んでるなぁ。けど悪い。今度にするわ」"
call gl(1,"TCSY0001b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi012"
新川 "「姪がさー、やっぱ群青行くんだけどさ、いろいろ教えてやらんと」"
"俺の耳、"
"そういう情報、"
"逃さない(ぐっ)。"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi013"
新川 "「なに親指立ててるよ?」"
太一 "「ヘイ、そこのガイ」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi014"
新川 "「な、なんだよ?」"
太一 "「マジごめん。姪、とか聞こえちゃった」"
voice "vmcca0018shi015"
新川 "「そう言ったっちゅーねん」"
太一 "「歳は?」"
voice "vmcca0018shi016"
新川 "「俺の一個下」"
太一 "「写真持ってる?」"
call gl(1,"TCSY0002b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi017"
新川 "「……黒須?」"
太一 "「ああ、いや、なんでもない。忘れてくれ」"
太一 "「しかしあれだ、一つ違いだと可愛いだろう」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi018"
新川 "「んー、ま、ルックスだけはな」"
太一 "「全てじゃねぇか」"
"自然と声が低くなった。"
"ある種のやっかみと嫉妬と……憎悪と。"
call gl(1,"TCSY0002b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi019"
新川 "「は?」"
太一 "「いや、気にしないで」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi020"
新川 "「……つうても、ちょっと男っぽいからさ」"
voice "vmcca0018shi021"
新川 "「最初に言っておくと、そういう感情はないぞ。なんかそういう目で見ようとしても気色悪いだけだし」"
太一 "「うそダーッ!」"
call gl(1,"TCSY0002b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi022"
新川 "「わ、どうしたいきなり」"
太一 "「そんなのうそだーっ! おまえはうそつきだ! 可愛い年下の親族がいるんだぞ? 意識しないはずないじゃないか!"
" おまえは仏国書院の一冊も読まないのか!? ありえねー! 解せねー! よっておまえがうそつきだと証明された!」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi023"
新川 "「黒須……かわいそうだが、マジなんだ」"
太一 "「いやっ、聞きたくない!」"
voice "vmcca0018shi024"
新川 "「本気で、妹みたいなもんなんだよ。同居してるし」"
"同棲っ!?"
"同じベッドッ!?"
"異性のぬくもりっ!!??"
太一 "「お、おい、そのロケーションには途轍もない何者かの意志が介在しているぞ」"
voice "vmcca0018shi025"
新川 "「……また都合の良い勘違いをしてるんだろうなー」"
voice "vmcca0018shi026"
新川 "「そいつの家族に、俺が引き取ってもらってるんだよ」"
voice "vmcca0018shi027"
新川 "「だからまあ、兄妹みたいなもんだ」"
voice "vmcca0018shi028"
新川 "「今回、家ぐるみで引っ越してきたんだよ。俺の足のこともあるけど、そいつもちょっとアレでさ」"
太一 "「ああ……」"
"そういうことか。"
"一発で納得だ。"
"それで二人して群青に通う、か。"
太一 "「あれ、そうするとチミは、姪子ちゃんのためにつきあいで転入みたいなもの?」"
voice "vmcca0018shi029"
新川 "「そうなるかな。いや、俺だって障害持ちですが」"
voice "vmcca0018shi030"
新川 "「そして姪子ちゃんでもねぇけど……」"
太一 "「優しいお兄ちゃんだな、オイ」"
call gl(1,"TCSY0002b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi031"
新川 "「あの、姪の話になってから絡みっぱなしなんですけど?」"
太一 "「羨望を集めるってのはそういうことだ」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi032"
新川 "「そうかあ~? ずっと暮らしてるとさー、生理的なこととか見えてきてけっこうアレなんだぜ?」"
太一 "「アレ?」"
voice "vmcca0018shi033"
新川 "「外見はいいとこもあるんだろうけど、欠点がバリバリ見えるから、たいしてきれいなモンにゃ思えないって感じか?」"
voice "vmcca0018shi034"
新川 "「食うものは食うし、出すものは―――」"
太一 "「あ、その先はいいや。夢は大事にしたい」"
call gl(1,"TCSY0002b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi035"
新川 "「……おまえの夢って」"
太一 "「ぜひおまえとチェンジして姪子ちゃんとイチャイチャしたいものだ」"
call gl(1,"TCSY0000b|tcsy")
call vsp(1,1)
with dissolve
voice "vmcca0018shi036"
新川 "「うわ-、想像させるな気持ち悪い」"
太一 "「現実は駄目だ……」"
"本気で気持ち悪がってるよ、この人。"
"エロ小説万歳。"
太一 "「じゃまた今度にでも遊びに来てくれ」"
voice "vmcca0018shi037"
新川 "「おー、姪のことも紹介してやるよ」"
太一 "「マジか?」"
"俺はわなわな震えた。"
voice "vmcca0018shi038a"
新川 "「……たいしたもんじゃないんだけどな……あんま期待すんなよ?」"
stop se
hide pic1
with dissolve
stop bgm
"たいしたものじゃない。"
"そう言ったやつの目がテポドン級の節穴であることが、後に明らかになるのである。"
return
# | Ren'Py | 3 | fossabot/cross-channel_chinese-localization_project | AllPlatforms/scripts/cca/cca0018.rpy | [
"Apache-2.0"
]
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This file is part of Logtalk <https://logtalk.org/>
% Copyright (c) 2010, Victor Lagerkvist
% SPDX-License-Identifier: BSD-3-Clause
%
% 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 the copyright holder nor the names of its
% contributors may be used to endorse or promote products derived from
% this software without specific prior written permission.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
% AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
% IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
% DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
% FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
% SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
% CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
% OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
% OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
:- object(bench_puzzle,
implements(databasep)).
:- info([
version is 1:0:0,
author is 'Victor Lagerkvist',
date is 2010-06-13,
comment is 'A simple database for solving the mu-puzzle from GEB.'
]).
append([], Ys, Ys) if true.
append([X|Xs], Ys, [X|Zs]) if
append(Xs, Ys, Zs).
theorem(_, [m, i]) if true.
theorem(_, []) if fail.
theorem(Depth, R) if
Depth > 0 and
D is Depth - 1 and
theorem(D, S) and
rules(S, R).
rules(S, R) if rule1(S, R).
rules(S, R) if rule2(S, R).
rules(S, R) if rule3(S, R).
rules(S, R) if rule4(S, R).
rule1(S, R) if
append(X, [i], S) and
append(X, [i,u], R).
rule2([m|T], [m|R]) if
append(T, T, R).
rule3([], _) if
fail.
rule3(R, T) if
append([i,i,i], S, R),
append([u], S, T).
rule3([H|T], [H|R]) if
rule3(T, R).
rule4([], _) if
{fail}.
rule4(R, T) if
append([u,u], T, R).
rule4([H|T], [H|R]) if
rule4(T, R).
test_theorem([m, i, u, i, u, i, u, i, u, i, u, i, u, i, u, i, u]).
test_non_theorem([m, i, u, i, u, i, u, i, u, i, u, i, u, i, u, x, u]).
bench_goal(theorem(4, T)) :- test_theorem(T).
bench_goal(theorem(4, T)) :- test_non_theorem(T).
:- end_object.
| Logtalk | 4 | PaulBrownMagic/logtalk3 | contributions/verdi_neruda/bench_puzzle.lgt | [
"Apache-2.0"
]
|
// MIR for `f_unit` before PreCodegen
fn f_unit() -> () {
let mut _0: (); // return place in scope 0 at $DIR/lower_intrinsics.rs:33:17: 33:17
let mut _1: (); // in scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18
scope 1 (inlined f_dispatch::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19
debug t => _1; // in scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
let _2: (); // in scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
scope 2 (inlined std::mem::size_of::<()>) { // at $DIR/lower_intrinsics.rs:34:5: 34:19
}
}
bb0: {
StorageLive(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:16: 34:18
StorageLive(_2); // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
_2 = f_zst::<()>(const ()) -> bb1; // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
// mir::Constant
// + span: $DIR/lower_intrinsics.rs:34:5: 34:19
// + literal: Const { ty: fn(()) {f_zst::<()>}, val: Value(Scalar(<ZST>)) }
}
bb1: {
StorageDead(_2); // scope 1 at $DIR/lower_intrinsics.rs:34:5: 34:19
StorageDead(_1); // scope 0 at $DIR/lower_intrinsics.rs:34:18: 34:19
return; // scope 0 at $DIR/lower_intrinsics.rs:35:2: 35:2
}
}
| Mirah | 2 | mbc-git/rust | src/test/mir-opt/lower_intrinsics.f_unit.PreCodegen.before.mir | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
]
|
USING: help.markup help.syntax ;
IN: math.continued-fractions
HELP: approx
{ $values { "epsilon" "a positive floating point number representing the absolute acceptable error" } { "float" "a positive floating point number to approximate" } { "a/b" "a fractional number containing the approximation" } }
{ $description "Give a rational approximation of " { $snippet "float" } " with a precision of " { $snippet "epsilon" } " using the smallest possible denominator." } ;
HELP: >ratio
{ $values { "seq" "a sequence representing a continued fraction" } { "a/b" "a fractional number" } }
{ $description "Transform " { $snippet "seq" } " into its rational representation." } ;
HELP: next-approx
{ $values { "seq" "a mutable sequence" } }
{ $description "Compute the next step in continued fraction calculation." } ;
| Factor | 4 | alex-ilin/factor | extra/math/continued-fractions/continued-fractions-docs.factor | [
"BSD-2-Clause"
]
|
a ~ b {} | CSS | 0 | mengxy/swc | crates/swc_css_parser/tests/fixture/esbuild/misc/XVtQeQIEHAyQlpmKRigHcg/input.css | [
"Apache-2.0"
]
|
#include <cstdio>
int main(int argc, char ** argv)
{
(void) argc;
(void) argv;
printf("hello world @(package_name) package\n");
return 0;
}
| EmberScript | 3 | sunbo57123/ros2cli_common_extension | ros2pkg/ros2pkg/resource/cpp/main.cpp.em | [
"Apache-2.0"
]
|
// aux-build:issue-29265.rs
// check-pass
extern crate issue_29265 as lib;
static _UNUSED: &'static lib::SomeType = &lib::SOME_VALUE;
fn main() {
vec![0u8; lib::SOME_VALUE.some_member];
}
| Rust | 4 | Eric-Arellano/rust | src/test/ui/issues/issue-29265.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
]
|
#pragma once
#include <ATen/ATen.h>
namespace at {
namespace native {
namespace vulkan {
Tensor convolution_prepack_weights(const at::Tensor& weight);
Tensor convolution_prepacked(
const at::Tensor& input, // Vulkan
IntArrayRef weightSizes,
const at::Tensor& weight_prepacked_vulkan, // Vulkan
const c10::optional<at::Tensor>& bias, // Vulkan|CPU
IntArrayRef padding,
IntArrayRef stride,
IntArrayRef dilation,
int64_t groups,
const float output_min,
const float output_max);
} // namespace vulkan
} // namespace native
} // namespace at
| C | 4 | Hacky-DH/pytorch | aten/src/ATen/native/vulkan/VulkanAten.h | [
"Intel"
]
|
defmodule PartitionSupervisor do
@moduledoc """
A supervisor that starts multiple partitions of the same child.
Certain processes may become bottlenecks in large systems.
If those processes can have their state trivially partitioned,
in a way there is no dependency between them, then they can use
the `PartitionSupervisor` to create multiple isolated and
independent partitions.
Once the `PartitionSupervisor` starts, you can dispatch to its
children using `{:via, PartitionSupervisor, {name, key}}`, where
`name` is the name of the `PartitionSupervisor` and key is used
for routing.
## Example
The `DynamicSupervisor` is a single process responsible for starting
other processes. In some applications, the `DynamicSupervisor` may
become a bottleneck. To address this, you can start multiple instances
of the `DynamicSupervisor` and then pick a "random" instance to start
the child on.
Instead of:
children = [
{DynamicSupervisor, name: MyApp.DynamicSupervisor}
]
Supervisor.start_link(children, strategy: :one_for_one)
and:
DynamicSupervisor.start_child(MyApp.DynamicSupervisor, {Agent, fn -> %{} end})
You can do this:
children = [
{PartitionSupervisor,
child_spec: DynamicSupervisor,
name: MyApp.DynamicSupervisors}
]
Supervisor.start_link(children, strategy: :one_for_one)
and then:
DynamicSupervisor.start_child(
{:via, PartitionSupervisor, {MyApp.DynamicSupervisors, self()}},
{Agent, fn -> %{} end}
)
In the code above, we start a partition supervisor that will by default
start a dynamic supervisor for each core in your machine. Then, instead
of calling the `DynamicSupervisor` by name, you call it through the
partition supervisor using the `{:via, PartitionSupervisor, {name, key}}`
format. We picked `self()` as the routing key, which means each process
will be assigned one of the existing dynamic supervisors. See `start_link/1`
to see all options supported by the `PartitionSupervisor`.
## Implementation notes
The `PartitionSupervisor` requires a name as an atom to be given on start,
as it uses an ETS table to keep all of the partitions. Under the hood,
the `PartitionSupervisor` generates a child spec for each partition and
then act as a regular supervisor. The id of each child spec is the
partition number.
For routing, two strategies are used. If `key` is an integer, it is routed
using `rem(abs(key), partitions)`. Otherwise it uses `:erlang.phash2(key, partitions)`.
The particular routing may change in the future, and therefore cannot
be relied on. If you want to retrieve a particular PID for a certain key,
you can use `GenServer.whereis({:via, PartitionSupervisor, {name, key}})`.
"""
@behaviour Supervisor
@type name :: atom()
@doc false
def child_spec(opts) when is_list(opts) do
%{
id: Keyword.get(opts, :name, PartitionSupervisor),
start: {PartitionSupervisor, :start_link, [opts]},
type: :supervisor
}
end
@doc """
Starts a partition supervisor with the given options.
This function is typically not invoked directly, instead it is invoked
when using a `PartitionSupervisor` as a child of another supervisor:
children = [
{PartitionSupervisor, child_spec: SomeChild, name: MyPartitionSupervisor}
]
If the supervisor is successfully spawned, this function returns
`{:ok, pid}`, where `pid` is the PID of the supervisor. If the given name
for the partition supervisor is already assigned to a process,
the function returns `{:error, {:already_started, pid}}`, where `pid`
is the PID of that process.
Note that a supervisor started with this function is linked to the parent
process and exits not only on crashes but also if the parent process exits
with `:normal` reason.
## Options
* `:name` - an atom representing the name of the partition supervisor.
* `:partitions` - a positive integer with the number of partitions.
Defaults to `System.schedulers_online()` (typically the number of cores).
* `:strategy` - the restart strategy option, defaults to `:one_for_one`.
You can learn more about strategies in the `Supervisor` module docs.
* `:max_restarts` - the maximum number of restarts allowed in
a time frame. Defaults to `3`.
* `:max_seconds` - the time frame in which `:max_restarts` applies.
Defaults to `5`.
* `:with_arguments` - a two-argument anonymous function that allows
the partition to be given to the child starting function. See the
`:with_arguments` section below.
## `:with_arguments`
Sometimes you want each partition to know their partition assigned number.
This can be done with the `:with_arguments` option. This function receives
the list of arguments of the child specification with the partition and
it must return a new list of arguments.
For example, most processes are started by calling `start_link(opts)`,
where `opts` is a keyword list. You could attach the partition to the
keyword list like this:
with_arguments: fn [opts], partition ->
[Keyword.put(opts, :partition, partition)]
end
"""
def start_link(opts) do
name = opts[:name]
unless name && is_atom(name) do
raise ArgumentError,
"the :name option must be given to PartitionSupervisor as an atom, got: #{inspect(name)}"
end
{child_spec, opts} = Keyword.pop(opts, :child_spec)
unless child_spec do
raise ArgumentError, "the :child_spec option must be given to PartitionSupervisor"
end
{partitions, opts} = Keyword.pop(opts, :partitions, System.schedulers_online())
unless is_integer(partitions) and partitions >= 1 do
raise ArgumentError,
"the :partitions option must be a positive integer, got: #{inspect(partitions)}"
end
{with_arguments, opts} = Keyword.pop(opts, :with_arguments, fn args, _partition -> args end)
unless is_function(with_arguments, 2) do
raise ArgumentError,
"the :with_arguments option must be a function that receives two arguments, " <>
"the current call arguments and the partition, got: #{inspect(with_arguments)}"
end
%{start: {mod, fun, args}} = map = Supervisor.child_spec(child_spec, [])
modules = map[:modules] || [mod]
children =
for partition <- 0..(partitions - 1) do
args = with_arguments.(args, partition)
unless is_list(args) do
raise "the call to the function in :with_arguments must return a list, got: #{inspect(args)}"
end
start = {__MODULE__, :start_child, [mod, fun, args, name, partition]}
Map.merge(map, %{id: partition, start: start, modules: modules})
end
{init_opts, start_opts} = Keyword.split(opts, [:strategy, :max_seconds, :max_restarts])
Supervisor.start_link(__MODULE__, {name, partitions, children, init_opts}, start_opts)
end
@doc false
def start_child(mod, fun, args, name, partition) do
case apply(mod, fun, args) do
{:ok, pid} ->
:ets.insert(name, {partition, pid})
{:ok, pid}
{:ok, pid, info} ->
:ets.insert(name, {partition, pid})
{:ok, pid, info}
other ->
other
end
end
@impl true
def init({name, partitions, children, init_opts}) do
:ets.new(name, [:set, :named_table, :protected, read_concurrency: true])
:ets.insert(name, {:partitions, partitions})
Supervisor.init(children, Keyword.put_new(init_opts, :strategy, :one_for_one))
end
@doc """
Returns the number of partitions for the partition supervisor.
"""
@doc since: "1.14.0"
@spec partitions(name()) :: pos_integer()
def partitions(supervisor) when is_atom(supervisor) do
:ets.lookup_element(supervisor, :partitions, 2)
end
@doc """
Returns a list with information about all children.
This function returns a list of tuples containing:
* `id` - the partition number
* `child` - the PID of the corresponding child process or the
atom `:restarting` if the process is about to be restarted
* `type` - `:worker` or `:supervisor` as defined in the child
specification
* `modules` - as defined in the child specification
"""
@doc since: "1.14.0"
@spec which_children(name()) :: [
# Inlining [module()] | :dynamic here because :supervisor.modules() is not exported
{:undefined, pid | :restarting, :worker | :supervisor, [module()] | :dynamic}
]
def which_children(supervisor) when is_atom(supervisor) do
Supervisor.which_children(supervisor)
end
@doc """
Returns a map containing count values for the supervisor.
The map contains the following keys:
* `:specs` - the number of partitions (children processes)
* `:active` - the count of all actively running child processes managed by
this supervisor
* `:supervisors` - the count of all supervisors whether or not the child
process is still alive
* `:workers` - the count of all workers, whether or not the child process
is still alive
"""
@doc since: "1.14.0"
@spec count_children(name()) :: %{
specs: non_neg_integer,
active: non_neg_integer,
supervisors: non_neg_integer,
workers: non_neg_integer
}
def count_children(supervisor) when is_atom(supervisor) do
Supervisor.count_children(supervisor)
end
@doc """
Synchronously stops the given partition supervisor with the given `reason`.
It returns `:ok` if the supervisor terminates with the given
reason. If it terminates with another reason, the call exits.
This function keeps OTP semantics regarding error reporting.
If the reason is any other than `:normal`, `:shutdown` or
`{:shutdown, _}`, an error report is logged.
"""
@doc since: "1.14.0"
@spec stop(name(), reason :: term, timeout) :: :ok
def stop(supervisor, reason \\ :normal, timeout \\ :infinity) when is_atom(supervisor) do
Supervisor.stop(supervisor, reason, timeout)
end
## Via callbacks
@doc false
def whereis_name({name, key}) when is_atom(name) do
partitions = partitions(name)
partition =
if is_integer(key), do: rem(abs(key), partitions), else: :erlang.phash2(key, partitions)
:ets.lookup_element(name, partition, 2)
end
@doc false
def send(name_key, msg) do
Kernel.send(whereis_name(name_key), msg)
end
@doc false
def register_name(_, _) do
raise "{:via, PartitionSupervisor, _} cannot be given on registration"
end
@doc false
def unregister_name(_, _) do
raise "{:via, PartitionSupervisor, _} cannot be given on unregistration"
end
end
| Elixir | 5 | doughsay/elixir | lib/elixir/lib/partition_supervisor.ex | [
"Apache-2.0"
]
|
{
"code": "../unicorn/examples/font/font.py",
"data": "../unicorn/examples/font/font.duc"
}
| UnrealScript | 2 | Gogopex/UnicornConsole | unicorn-examples/font/font.uc | [
"MIT"
]
|
--TEST--
GC can cleanup cycle when fiber result references fiber
--FILE--
<?php
$fiber = null;
$fiber = new Fiber(function () use (&$fiber) {
return new class($fiber) {
private $fiber;
public function __construct($fiber) {
$this->fiber = $fiber;
}
public function __destruct() {
var_dump('DTOR');
}
};
});
$fiber->start();
var_dump('COLLECT CYCLES');
gc_collect_cycles();
var_dump('DONE');
var_dump($fiber->isTerminated());
unset($fiber);
var_dump('COLLECT CYCLES');
gc_collect_cycles();
var_dump('DONE');
?>
--EXPECT--
string(14) "COLLECT CYCLES"
string(4) "DONE"
bool(true)
string(14) "COLLECT CYCLES"
string(4) "DTOR"
string(4) "DONE"
| PHP | 3 | NathanFreeman/php-src | Zend/tests/fibers/gc-cycle-result.phpt | [
"PHP-3.01"
]
|
<!DOCTYPE html>
<html>
<head><title>Form</title></head>
<body>
<form method="GET" action="form.html">
<input type="submit" value="cool" name="cyber">
<input type="text" value="hello_friends" name="greeting">
</form>
</body>
</html>
| HTML | 3 | r00ster91/serenity | Base/res/html/misc/form.html | [
"BSD-2-Clause"
]
|
quiet
very x is y
loud
| Dogescript | 0 | erinkeith/dogescript | test/spec/quiet/commented-djs/source.djs | [
"MIT"
]
|
#[
We can't merge this test inside a `when defined(cpp)` because some bug that was
fixed would not trigger in that case.
]#
import std/compilesettings
static:
## bugfix 1: this used to CT error with: Error: unhandled exception: mimportcpp.nim(6, 18) `defined(cpp)`
doAssert defined(cpp)
doAssert querySetting(backend) == "cpp"
## checks that `--backend:c` has no side effect (ie, can be overridden by subsequent commands)
doAssert not defined(c)
doAssert not defined(js)
doAssert not defined(js)
type
std_exception {.importcpp: "std::exception", header: "<exception>".} = object
proc what(s: std_exception): cstring {.importcpp: "((char *)#.what())".}
var isThrown = false
try:
## bugfix 2: this used to CT error with: Error: only a 'ref object' can be raised
raise std_exception()
except std_exception as ex:
doAssert ex.what().len > 0
isThrown = true
doAssert isThrown
| Nimrod | 4 | JohnAD/Nim | tests/misc/mbackend.nim | [
"MIT"
]
|
module org-openroadm-network {
namespace "http://org/openroadm/network";
prefix org-openroadm-network;
import org-openroadm-roadm {
prefix org-openroadm-roadm;
}
import org-openroadm-external-pluggable {
prefix org-openroadm-external-pluggable;
}
import org-openroadm-xponder {
prefix org-openroadm-xponder;
}
organization
"OPEN ROADM MSA";
contact
"www.OpenROADM.org.";
description
"Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016,
AT&T Intellectual Property. All other 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 Members of the Open ROADM MSA Agreement 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 MEMBERS OF THE OPEN ROADM MSA AGREEMENT ''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 THE MEMBERS OF THE OPEN ROADM MSA AGREEMENT 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 2016-10-14 {
description
"Version 1.2";
}
container network {
uses org-openroadm-roadm:open-roadm;
uses org-openroadm-external-pluggable:external-pluggable;
uses org-openroadm-xponder:xponder;
}
}
| YANG | 3 | meodaiduoi/onos | models/openroadm/src/main/yang/[email protected] | [
"Apache-2.0"
]
|
/**
* This file is part of the Phalcon Framework.
*
* (c) Phalcon Team <[email protected]>
*
* For the full copyright and license information, please view the LICENSE.txt
* file that was distributed with this source code.
*/
namespace Phalcon\Filter;
use Phalcon\Filter;
class FilterFactory
{
/**
* Returns a Locator object with all the helpers defined in anonymous
* functions
*/
public function newInstance() -> <FilterInterface>
{
return new Filter(
this->getAdapters()
);
}
protected function getAdapters() -> array
{
return [
Filter::FILTER_ABSINT : "Phalcon\\Filter\\Sanitize\\AbsInt",
Filter::FILTER_ALNUM : "Phalcon\\Filter\\Sanitize\\Alnum",
Filter::FILTER_ALPHA : "Phalcon\\Filter\\Sanitize\\Alpha",
Filter::FILTER_BOOL : "Phalcon\\Filter\\Sanitize\\BoolVal",
Filter::FILTER_EMAIL : "Phalcon\\Filter\\Sanitize\\Email",
Filter::FILTER_FLOAT : "Phalcon\\Filter\\Sanitize\\FloatVal",
Filter::FILTER_INT : "Phalcon\\Filter\\Sanitize\\IntVal",
Filter::FILTER_LOWER : "Phalcon\\Filter\\Sanitize\\Lower",
Filter::FILTER_LOWERFIRST : "Phalcon\\Filter\\Sanitize\\LowerFirst",
Filter::FILTER_REGEX : "Phalcon\\Filter\\Sanitize\\Regex",
Filter::FILTER_REMOVE : "Phalcon\\Filter\\Sanitize\\Remove",
Filter::FILTER_REPLACE : "Phalcon\\Filter\\Sanitize\\Replace",
Filter::FILTER_SPECIAL : "Phalcon\\Filter\\Sanitize\\Special",
Filter::FILTER_SPECIALFULL: "Phalcon\\Filter\\Sanitize\\SpecialFull",
Filter::FILTER_STRING : "Phalcon\\Filter\\Sanitize\\StringVal",
Filter::FILTER_STRIPTAGS : "Phalcon\\Filter\\Sanitize\\Striptags",
Filter::FILTER_TRIM : "Phalcon\\Filter\\Sanitize\\Trim",
Filter::FILTER_UPPER : "Phalcon\\Filter\\Sanitize\\Upper",
Filter::FILTER_UPPERFIRST : "Phalcon\\Filter\\Sanitize\\UpperFirst",
Filter::FILTER_UPPERWORDS : "Phalcon\\Filter\\Sanitize\\UpperWords",
Filter::FILTER_URL : "Phalcon\\Filter\\Sanitize\\Url"
];
}
}
| Zephir | 4 | chipco/cphalcon | phalcon/Filter/FilterFactory.zep | [
"BSD-3-Clause"
]
|
{
By: Kwabena W. Agyeman - 9/27/2013
}
CON
_clkfreq = 80_000_000
_clkmode = xtal1 + pll16x
rx = 31
tx = 30
lPin = 26
rPin = 27
doPin = 22
clkPin = 23
diPin = 24
csPin = 25
wpPin = -1
cdPin = -1
milshotMs = 10
silencedMs = 10
OBJ
ser: "FullDuplexSerial.spin"
wav: "V2-WAV_DACEngine.spin"
PUB main
ser.Start(rx, tx, 0, 115200)
waitcnt((clkfreq * 5) + cnt)
if(wav.begin(lPin, rPin, doPin, clkPin, diPin, csPin, wpPin, cdPin))
ser.Str(string("Start: Success", 10))
else
ser.Str(string("Start: Failure", 10))
repeat
result := \wav.play(string("milshot.wav"))
if(wav.playErrorNum)
ser.Str(string("WAV Error: "))
ser.Str(result)
ser.Tx(10)
repeat
repeat 9
result := \wav.play(string("milshot.wav"))
if(wav.playErrorNum)
ser.Str(string("WAV Error: "))
ser.Str(result)
ser.Tx(10)
repeat
waitcnt(((clkfreq / 1000) * milshotMs) + cnt)
wav.overrideSong(true)
result := \wav.play(string("reloadf.wav"))
if(wav.playErrorNum)
ser.Str(string("WAV Error: "))
ser.Str(result)
ser.Tx(10)
repeat
waitcnt(((clkfreq / 1000) * milshotMs) + cnt)
wav.overrideSong(true)
result := \wav.play(string("silenced.wav"))
if(wav.playErrorNum)
ser.Str(string("WAV Error: "))
ser.Str(result)
ser.Tx(10)
repeat
repeat 9
result := \wav.play(string("silenced.wav"))
if(wav.playErrorNum)
ser.Str(string("WAV Error: "))
ser.Str(result)
ser.Tx(10)
repeat
waitcnt(((clkfreq / 1000) * silencedMs) + cnt)
wav.overrideSong(true)
result := \wav.play(string("reloadf.wav"))
if(wav.playErrorNum)
ser.Str(string("WAV Error: "))
ser.Str(result)
ser.Tx(10)
repeat
waitcnt(((clkfreq / 1000) * silencedMs) + cnt)
wav.overrideSong(true)
| Propeller Spin | 3 | deets/propeller | libraries/community/p1/All/KISS WAV Player Driver/V2-WAV/gun.spin | [
"MIT"
]
|
@font-face {
font-family: "Roobert";
font-weight: 400;
font-style: normal;
src: url("../fonts/Roobert-Regular.woff2") format("woff2");
}
@font-face {
font-family: "Roobert";
font-weight: 400;
font-style: italic;
src: url("../fonts/Roobert-Regular.woff2") format("woff2");
}
@font-face {
font-family: "Roobert";
font-weight: 600;
font-style: normal;
src: url("../fonts/Roobert-SemiBold.woff2") format("woff2");
}
@font-face {
font-family: "Roobert";
font-weight: 600;
font-style: italic;
src: url("../fonts/Roobert-SemiBoldItalic.woff2") format("woff2");
}
@font-face {
font-family: "InputMono";
src: url("../fonts/InputMono-Regular.woff2") format("woff2"),
url("../fonts/InputMono-Regular.woff") format("woff");
font-weight: normal;
font-style: normal;
}
@font-face {
font-family: "InputMono";
src: url("../fonts/InputMono-Bold.woff2") format("woff2"),
url("../fonts/InputMono-Bold.woff") format("woff");
font-weight: bold;
font-style: normal;
}
@font-face {
font-family: "InputMono";
src: url("../fonts/InputMono-BoldItalic.woff2") format("woff2"),
url("../fonts/InputMono-BoldItalic.woff") format("woff");
font-weight: bold;
font-style: italic;
}
@font-face {
font-family: "InputMono";
src: url("../fonts/InputMono-Italic.woff2") format("woff2"),
url("../fonts/InputMono-Italic.woff") format("woff");
font-weight: normal;
font-style: italic;
}
*, *:before, *:after {
box-sizing: border-box;
margin: 0;
padding: 0;
border: 0;
font: inherit;
vertical-align: baseline;
}
html,
body {
background-color: #252423;
color: #F6F4F2;
}
body {
font-family: Roobert, Helvetica Neue, Helvetica, Arial, sans-serif;
font-weight: 400;
font-feature-settings:"tnum" 1, "ss03" 1;
-webkit-font-smoothing: antialiased;
}
h1, h2 {
font-weight: 600;
}
input {
font-family: Roobert, Helvetica Neue, Helvetica, Arial, sans-serif;
font-variant-numeric: tabular-nums;
}
sup {
vertical-align: super;
font-size: .625em;
}
strong {
font-weight: 600;
}
.color-white { color: #F6F4F2; } /* White */
.color-black { color: #2E2C2C; } /* Black */
.color-red, .color-targets { color: #FF4B4B; }/* red: */
.color-orange, .color-properties { color: #FF8F42; }/* orange: */
.color-lightorange, .color-prop-params { color: #FFC730; }/* lightorange: */
.color-yellow, .color-anim-params { color: #F6FF56; }/* yellow: */
.color-citrus, .color-values { color: #A4FF4F; }/* citrus: */
.color-green, .color-keyframes { color: #18FF74; }/* green: */
.color-darkgreen, .color-staggering { color: #00D672; }/* darkgreen: */
.color-turquoise, .color-tl { color: #3CFFEC; }/* turquoise: */
.color-skyblue, .color-controls { color: #61C3FF; }/* skyblue: */
.color-kingblue, .color-callbacks { color: #5A87FF; }/* kingblue: */
.color-lavender, .color-svg { color: #8453E3; }/* lavender: */
.color-purple, .color-easings { color: #C26EFF; }/* purple: */
.color-pink, .color-helpers { color: #FB89FB; }/* pink: */
.anime-mini-logo {
width: 100px;
height: 24px;
transform: scaleY(.5);
} | CSS | 4 | HJ959/anime | documentation/assets/css/animejs.css | [
"MIT"
]
|
#pragma once
#include <common/hooks/WinHookEvent.h>
#include <functional>
interface IWorkArea;
interface IFancyZonesSettings;
interface IZoneSet;
struct WinHookEvent;
interface __declspec(uuid("{50D3F0F5-736E-4186-BDF4-3D6BEE150C3A}")) IFancyZones : public IUnknown
{
/**
* Start and initialize FancyZones.
*/
IFACEMETHOD_(void, Run)
() = 0;
/**
* Stop FancyZones and do the clean up.
*/
IFACEMETHOD_(void, Destroy)
() = 0;
};
/**
* Core FancyZones functionality.
*/
interface __declspec(uuid("{2CB37E8F-87E6-4AEC-B4B2-E0FDC873343F}")) IFancyZonesCallback : public IUnknown
{
/**
* Inform FancyZones that user has switched between virtual desktops.
*/
IFACEMETHOD_(void, VirtualDesktopChanged)
() = 0;
/**
* Callback from WinEventHook to FancyZones
*
* @param data Handle of window being moved or resized.
*/
IFACEMETHOD_(void, HandleWinHookEvent)
(const WinHookEvent* data) = 0;
/**
* Process keyboard event.
*
* @param info Information about low level keyboard event.
* @returns Boolean indicating if this event should be passed on further to other applications
* in event chain, or should it be suppressed.
*/
IFACEMETHOD_(bool, OnKeyDown)
(PKBDLLHOOKSTRUCT info) = 0;
};
winrt::com_ptr<IFancyZones> MakeFancyZones(HINSTANCE hinstance, const winrt::com_ptr<IFancyZonesSettings>& settings, std::function<void()> disableCallback) noexcept;
| C | 5 | tameemzabalawi/PowerToys | src/modules/fancyzones/FancyZonesLib/FancyZones.h | [
"MIT"
]
|
# Copyright 2016-2019 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
# in the file LICENSE in the source distribution or at
# https://www.openssl.org/source/license.html
use strict;
package TLSProxy::ServerKeyExchange;
use vars '@ISA';
push @ISA, 'TLSProxy::Message';
sub new
{
my $class = shift;
my ($server,
$data,
$records,
$startoffset,
$message_frag_lens) = @_;
my $self = $class->SUPER::new(
$server,
TLSProxy::Message::MT_SERVER_KEY_EXCHANGE,
$data,
$records,
$startoffset,
$message_frag_lens);
#DHE
$self->{p} = "";
$self->{g} = "";
$self->{pub_key} = "";
$self->{sigalg} = -1;
$self->{sig} = "";
return $self;
}
sub parse
{
my $self = shift;
my $sigalg = -1;
#Minimal SKE parsing. Only supports one known DHE ciphersuite at the moment
return if TLSProxy::Proxy->ciphersuite()
!= TLSProxy::Message::CIPHER_ADH_AES_128_SHA
&& TLSProxy::Proxy->ciphersuite()
!= TLSProxy::Message::CIPHER_DHE_RSA_AES_128_SHA;
my $p_len = unpack('n', $self->data);
my $ptr = 2;
my $p = substr($self->data, $ptr, $p_len);
$ptr += $p_len;
my $g_len = unpack('n', substr($self->data, $ptr));
$ptr += 2;
my $g = substr($self->data, $ptr, $g_len);
$ptr += $g_len;
my $pub_key_len = unpack('n', substr($self->data, $ptr));
$ptr += 2;
my $pub_key = substr($self->data, $ptr, $pub_key_len);
$ptr += $pub_key_len;
#We assume its signed
my $record = ${$self->records}[0];
if (TLSProxy::Proxy->is_tls13()
|| $record->version() == TLSProxy::Record::VERS_TLS_1_2) {
$sigalg = unpack('n', substr($self->data, $ptr));
$ptr += 2;
}
my $sig = "";
if (defined $sigalg) {
my $sig_len = unpack('n', substr($self->data, $ptr));
if (defined $sig_len) {
$ptr += 2;
$sig = substr($self->data, $ptr, $sig_len);
$ptr += $sig_len;
}
}
$self->p($p);
$self->g($g);
$self->pub_key($pub_key);
$self->sigalg($sigalg) if defined $sigalg;
$self->signature($sig);
}
#Reconstruct the on-the-wire message data following changes
sub set_message_contents
{
my $self = shift;
my $data;
$data = pack('n', length($self->p));
$data .= $self->p;
$data .= pack('n', length($self->g));
$data .= $self->g;
$data .= pack('n', length($self->pub_key));
$data .= $self->pub_key;
$data .= pack('n', $self->sigalg) if ($self->sigalg != -1);
if (length($self->signature) > 0) {
$data .= pack('n', length($self->signature));
$data .= $self->signature;
}
$self->data($data);
}
#Read/write accessors
#DHE
sub p
{
my $self = shift;
if (@_) {
$self->{p} = shift;
}
return $self->{p};
}
sub g
{
my $self = shift;
if (@_) {
$self->{g} = shift;
}
return $self->{g};
}
sub pub_key
{
my $self = shift;
if (@_) {
$self->{pub_key} = shift;
}
return $self->{pub_key};
}
sub sigalg
{
my $self = shift;
if (@_) {
$self->{sigalg} = shift;
}
return $self->{sigalg};
}
sub signature
{
my $self = shift;
if (@_) {
$self->{sig} = shift;
}
return $self->{sig};
}
1;
| Perl | 5 | xumia/debian-openssl | util/perl/TLSProxy/ServerKeyExchange.pm | [
"OpenSSL"
]
|
prefix ex: <http://www.example.org/schema#>
prefix in: <http://www.example.org/instance#>
select ?x where {
graph ?g {in:a ex:p1/ex:p2 ?x}
} | SPARQL | 4 | alpano-unibz/ontop | test/sparql-compliance/src/test/resources/testcases-dawg-sparql-1.1/property-path/pp06.rq | [
"Apache-2.0"
]
|
<html>
<head>
<title>useragent_quirks_test</title>
<script src="test_bootstrap.js"></script>
<script type="text/javascript">
goog.require('bot.userAgent');
goog.require('goog.dom');
goog.require('goog.testing.jsunit');
goog.require('goog.userAgent');
goog.require('goog.userAgent.product');
</script>
<script src="useragent_test.js" type="text/javascript"></script>
</head>
</html>
| HTML | 3 | weilandia/selenium | javascript/atoms/test/useragent_quirks_test.html | [
"Apache-2.0"
]
|
module audiostreamerscrobbler.utils.RequestUtils
import nl.vincentvanderleun.utils.exceptions.HttpRequestException
import java.net.HttpURLConnection
import java.net.URL
function doHttpGetRequest = |url, timeout, requestProperties, inputStreamHandlerCallback| {
let conn = URL(url): openConnection()
conn: setRequestMethod("GET")
requestProperties: entrySet(): each(|p| -> conn: setRequestProperty(p: key(), p: value()))
conn: setConnectTimeout(timeout * 1000)
conn: setReadTimeout(timeout * 1000)
let responseCode = conn: getResponseCode()
if (responseCode != HttpURLConnection.HTTP_OK()) {
throw HttpRequestException(responseCode)
}
let inputStream = conn: getInputStream()
try {
return inputStreamHandlerCallback(inputStream)
} finally {
inputStream: close()
}
}
function doHttpPostRequest = |url, timeout, requestProperties, outputStreamHandlerCallback, inputStreamHandlerCallback| {
let conn = URL(url): openConnection()
conn: setRequestMethod("POST")
requestProperties: entrySet(): each(|p| -> conn: setRequestProperty(p: key(), p: value()))
conn: setConnectTimeout(timeout * 1000)
conn: setReadTimeout(timeout * 1000)
conn: doOutput(true)
let outputStream = conn: getOutputStream()
try {
outputStreamHandlerCallback(outputStream)
} finally {
outputStream: close()
}
let responseCode = conn: getResponseCode()
if (responseCode != HttpURLConnection.HTTP_OK()) {
throw HttpRequestException(responseCode)
}
let inputStream = conn: getInputStream()
try {
return inputStreamHandlerCallback(inputStream)
} finally {
inputStream: close()
}
} | Golo | 4 | vvdleun/audiostreamerscrobbler | src/main/golo/include/utils/RequestUtils.golo | [
"MIT"
]
|
struct Foo<const NAME: &'static str>; //~ ERROR `&'static str` is forbidden
fn main() {}
| Rust | 3 | mbc-git/rust | src/test/ui/feature-gates/feature-gate-adt_const_params.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
]
|
ruleset org.sovrin.agency_agent {
meta {
use module io.picolabs.subscription alias subs
shares __testing
}
global {
__testing = { "queries":
[ { "name": "__testing" }
//, { "name": "entry", "args": [ "key" ] }
] , "events":
[ { "domain": "agency_agent", "type": "name_fixed", "attrs": [ "name" ] }
//, { "domain": "d2", "type": "t2", "attrs": [ "a1", "a2" ] }
]
}
login_channel_spec = {"name":"login", "type":"secret"}
}
rule initialize_agency_agent {
select when wrangler ruleset_added where event:attr("rids") >< meta:rid
pre {
rs_attrs = event:attr("rs_attrs")
subs_eci = event:attr("subs_eci") || rs_attrs{"subs_eci"}
name = event:attr("name") || rs_attrs{"name"}
}
fired {
raise wrangler event "subscription" attributes {
"wellKnown_Tx": subs_eci,
"Rx_role": "agent",
"Tx_role": "agency",
"name": name,
"channel_type": "subscription"
};
ent:name := name;
raise wrangler event "channel_creation_requested"
attributes login_channel_spec;
}
}
rule save_login_did {
select when wrangler channel_created
name re#^login$# type re#^secret$#
pre {
channel = event:attr("channel").klog("channel")
}
fired {
ent:saved_eci := channel{"id"}
}
}
rule fix_name {
select when agency_agent name_fixed
pre {
fixed_name = event:attr("name")
}
if fixed_name && fixed_name != ent:name then noop()
fired {
raise agency_agent event "name_fix_applied" attributes {
"original_name": ent:name,
"fixed_name": fixed_name
};
ent:name := fixed_name
}
}
rule communicate_login_did {
select when wrangler outbound_pending_subscription_approved
event:send({"eci":event:attr("Tx"),
"domain": "agent", "type": "new_login_did",
"attrs": {"name": ent:name, "did": ent:saved_eci}
})
}
}
| KRL | 4 | Picolab/G2S | krl/org.sovrin.agency_agent.krl | [
"MIT"
]
|
module.exports = [[module.id, "body { color: red; }"]];
| CSS | 2 | fourstash/webpack | test/configCases/entry/depend-on-non-js/b.css | [
"MIT"
]
|
{
"@context": {
"schema": "http://schema.org/",
"meta": "http://meta.schema.org/"
},
"@id": "http://meta.schema.org",
"@graph": [
{
"@id": "http://schema.org/Class",
"@type": "rdfs:Class",
"rdfs:comment": "A class, also often called a 'Type'; equivalent to rdfs:Class.",
"rdfs:label": "Class",
"rdfs:subClassOf": "http://schema.org/Intangible",
"schema:isPartOf": "http://meta.schema.org"
},
{
"@id": "http://schema.org/Property",
"@type": "rdfs:Class",
"rdfs:comment": "A property, used to indicate attributes and relationships of some Thing; equivalent to rdf:Property.",
"rdfs:label": "Property",
"rdfs:subClassOf": "http://schema.org/Intangible",
"schema:isPartOf": "http://meta.schema.org"
},
{
"@id": "http://schema.org/domainIncludes",
"@type": "rdf:Property",
"rdfs:comment": "Relates a property to a class that is (one of) the type(s) the property is expected to be used on.",
"rdfs:label": "domainIncludes",
"schema:domainIncludes": "http://schema.org/Property",
"schema:isPartOf": "http://meta.schema.org",
"schema:rangeIncludes": "http://schema.org/Class"
},
{
"@id": "http://schema.org/supersededBy",
"@type": "rdf:Property",
"rdfs:comment": "Relates a term (i.e. a property, class or enumeration) to one that supersedes it.",
"rdfs:label": "supersededBy",
"schema:domainIncludes": [
"http://schema.org/Enumeration",
"http://schema.org/Class",
"http://schema.org/Property"
],
"schema:isPartOf": "http://meta.schema.org",
"schema:rangeIncludes": [
"http://schema.org/Enumeration",
"http://schema.org/Class",
"http://schema.org/Property"
]
},
{
"@id": "http://schema.org/inverseOf",
"@type": "rdf:Property",
"rdfs:comment": "Relates a property to a property that is its inverse. Inverse properties relate the same pairs of items to each other, but in reversed direction. For example, the 'alumni' and 'alumniOf' properties are inverseOf each other. Some properties don't have explicit inverses; in these situations RDFa and JSON-LD syntax for reverse properties can be used.",
"rdfs:label": "inverseOf",
"schema:domainIncludes": "http://schema.org/Property",
"schema:isPartOf": "http://meta.schema.org",
"schema:rangeIncludes": "http://schema.org/Property"
},
{
"@id": "http://schema.org/rangeIncludes",
"@type": "rdf:Property",
"rdfs:comment": "Relates a property to a class that constitutes (one of) the expected type(s) for values of the property.",
"rdfs:label": "rangeIncludes",
"schema:domainIncludes": "http://schema.org/Property",
"schema:isPartOf": "http://meta.schema.org",
"schema:rangeIncludes":"http://schema.org/Class"
},
{
"@id": "http://schema.org/category",
"@type": "rdf:Property",
"schema:domainIncludes": [
"http://schema.org/Property",
"http://schema.org/Class"
]
}
]
}
| JSONLD | 5 | DmPo/Schemaorg_CivicOS | data/ext/meta/meta.jsonld | [
"Apache-2.0"
]
|
:Namespace each_tests
I←{⍬≡⍴⍵:⍵ ⋄ ⊃((⎕DR ⍵)323)⎕DR ⍵}¯5000+?100⍴10000
F←100÷⍨?100⍴10000
B←?10⍴2
each∆dpii_TEST←'each∆R1'#.util.MK∆T2 I I
each∆dpiis_TEST←'each∆R1'#.util.MK∆T2 4 5
each∆dpff_TEST←'each∆R1'#.util.MK∆T2 F F
each∆dpif_TEST←'each∆R1'#.util.MK∆T2 I F
each∆dpfi_TEST←'each∆R1'#.util.MK∆T2 F I
each∆duffs_TEST←'each∆R2'#.util.MK∆T2 5.5 3.1
each∆duii_TEST←'each∆R2'#.util.MK∆T2 I I
each∆duff_TEST←'each∆R2'#.util.MK∆T2 F F
each∆duif_TEST←'each∆R2'#.util.MK∆T2 I F
each∆dufi_TEST←'each∆R2'#.util.MK∆T2 F I
each∆mui_TEST←'each∆R3'#.util.MK∆T2 I (I~0)
each∆muf_TEST←'each∆R3'#.util.MK∆T2 F F
each∆mub_TEST←'each∆R6'#.util.MK∆T2 B B
each∆mpi_TEST←'each∆R4'#.util.MK∆T2 I (I~0)
:EndNamespace | APL | 3 | nvuillam/jscpd | fixtures/apl/file2.apl | [
"MIT"
]
|
/* This generated file is for internal use. Do not include it from headers. */
#ifndef SOURCEKIT_CONFIG_H
#define SOURCEKIT_CONFIG_H
/* Define to 1 if you have the 'dispatch_block_create' function in <dispatch/dispatch.h> */
#cmakedefine HAVE_DISPATCH_BLOCK_CREATE ${HAVE_DISPATCH_BLOCK_CREATE}
#endif
| CMake | 2 | lwhsu/swift | tools/SourceKit/include/SourceKit/Config/config.h.cmake | [
"Apache-2.0"
]
|
# This script will print a table 8 rows by 36 columns
# of background colors using ansi index coloring
# This prints the column headers
let nl = (char newline)
let plus = $"($nl) + "
let cols = (seq 0 35 | each { |col| $"($col)" | str lpad -c ' ' -l 3 } | str collect)
$"($plus)($cols)"
let ansi_bg = (ansi -e '48;5;')
let ansi_reset = (ansi reset)
$"($nl)($nl)"
# This prints the row headers
let row_header = ' 0 '
let row_data = (seq 0 15 | each { |row|
$"($ansi_bg)($row)m ($ansi_reset)"
} | str collect)
$"($row_header)($row_data)($nl)($nl)"
# This is the meat of the script that prints the little squares of color
seq 0 6 | each { |row_idx|
let r = ($"($row_idx) * 36 + 16" | math eval)
let row_header = (echo $r | into string -d 0 | str lpad -c ' ' -l 4)
let row_data = (seq 0 35 | each { |row|
let val = ($"($r + $row)" | math eval | into string -d 0)
$"($ansi_bg)($val)m (ansi -e 'm') "
} | str collect)
$"($row_header) ($row_data)($nl)($nl)"
} | str collect
| Nu | 4 | x3rAx/nu_scripts | coloring/ref_table.nu | [
"MIT"
]
|
#! /bin/sh /usr/share/dpatch/dpatch-run
## 02_libnet_1.1.dpatch by Faidon Liambotis <[email protected]>
##
## DP: Use libnet v1.1 instead of v1.0
@DPATCH@
diff -urNad dsniff-2.4b1/arpspoof.c /tmp/dpep.4ezzqC/dsniff-2.4b1/arpspoof.c
--- dsniff-2.4b1/arpspoof.c 2006-06-09 13:35:29.000000000 +0300
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/arpspoof.c 2006-06-09 13:35:29.000000000 +0300
@@ -27,7 +27,7 @@
extern char *ether_ntoa(struct ether_addr *);
-static struct libnet_link_int *llif;
+static libnet_t *l;
static struct ether_addr spoof_mac, target_mac;
static in_addr_t spoof_ip, target_ip;
static char *intf;
@@ -41,47 +41,49 @@
}
static int
-arp_send(struct libnet_link_int *llif, char *dev,
- int op, u_char *sha, in_addr_t spa, u_char *tha, in_addr_t tpa)
+arp_send(libnet_t *l, int op, u_int8_t *sha,
+ in_addr_t spa, u_int8_t *tha, in_addr_t tpa)
{
- char ebuf[128];
- u_char pkt[60];
-
+ int retval;
+
if (sha == NULL &&
- (sha = (u_char *)libnet_get_hwaddr(llif, dev, ebuf)) == NULL) {
+ (sha = (u_int8_t *)libnet_get_hwaddr(l)) == NULL) {
return (-1);
}
if (spa == 0) {
- if ((spa = libnet_get_ipaddr(llif, dev, ebuf)) == 0)
+ if ((spa = libnet_get_ipaddr4(l)) == -1)
return (-1);
- spa = htonl(spa); /* XXX */
}
if (tha == NULL)
tha = "\xff\xff\xff\xff\xff\xff";
- libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, pkt);
+ libnet_autobuild_arp(op, sha, (u_int8_t *)&spa,
+ tha, (u_int8_t *)&tpa, l);
+ libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, l, 0);
- libnet_build_arp(ARPHRD_ETHER, ETHERTYPE_IP, ETHER_ADDR_LEN, 4,
- op, sha, (u_char *)&spa, tha, (u_char *)&tpa,
- NULL, 0, pkt + ETH_H);
-
fprintf(stderr, "%s ",
ether_ntoa((struct ether_addr *)sha));
if (op == ARPOP_REQUEST) {
fprintf(stderr, "%s 0806 42: arp who-has %s tell %s\n",
ether_ntoa((struct ether_addr *)tha),
- libnet_host_lookup(tpa, 0),
- libnet_host_lookup(spa, 0));
+ libnet_addr2name4(tpa, LIBNET_DONT_RESOLVE),
+ libnet_addr2name4(spa, LIBNET_DONT_RESOLVE));
}
else {
fprintf(stderr, "%s 0806 42: arp reply %s is-at ",
ether_ntoa((struct ether_addr *)tha),
- libnet_host_lookup(spa, 0));
+ libnet_addr2name4(spa, LIBNET_DONT_RESOLVE));
fprintf(stderr, "%s\n",
ether_ntoa((struct ether_addr *)sha));
}
- return (libnet_write_link_layer(llif, dev, pkt, sizeof(pkt)) == sizeof(pkt));
+ retval = libnet_write(l);
+ if (retval)
+ fprintf(stderr, "%s", libnet_geterror(l));
+
+ libnet_clear_packet(l);
+
+ return retval;
}
#ifdef __linux__
@@ -119,7 +121,7 @@
/* XXX - force the kernel to arp. feh. */
arp_force(ip);
#else
- arp_send(llif, intf, ARPOP_REQUEST, NULL, 0, NULL, ip);
+ arp_send(l, ARPOP_REQUEST, NULL, 0, NULL, ip);
#endif
sleep(1);
}
@@ -136,9 +138,9 @@
if (arp_find(spoof_ip, &spoof_mac)) {
for (i = 0; i < 3; i++) {
/* XXX - on BSD, requires ETHERSPOOF kernel. */
- arp_send(llif, intf, ARPOP_REPLY,
- (u_char *)&spoof_mac, spoof_ip,
- (target_ip ? (u_char *)&target_mac : NULL),
+ arp_send(l, ARPOP_REPLY,
+ (u_int8_t *)&spoof_mac, spoof_ip,
+ (target_ip ? (u_int8_t *)&target_mac : NULL),
target_ip);
sleep(1);
}
@@ -151,7 +153,8 @@
{
extern char *optarg;
extern int optind;
- char ebuf[PCAP_ERRBUF_SIZE];
+ char pcap_ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
int c;
intf = NULL;
@@ -163,7 +166,7 @@
intf = optarg;
break;
case 't':
- if ((target_ip = libnet_name_resolve(optarg, 1)) == -1)
+ if ((target_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
usage();
break;
default:
@@ -176,26 +179,26 @@
if (argc != 1)
usage();
- if ((spoof_ip = libnet_name_resolve(argv[0], 1)) == -1)
+ if ((spoof_ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
usage();
- if (intf == NULL && (intf = pcap_lookupdev(ebuf)) == NULL)
- errx(1, "%s", ebuf);
+ if (intf == NULL && (intf = pcap_lookupdev(pcap_ebuf)) == NULL)
+ errx(1, "%s", pcap_ebuf);
- if ((llif = libnet_open_link_interface(intf, ebuf)) == 0)
- errx(1, "%s", ebuf);
+ if ((l = libnet_init(LIBNET_LINK, intf, libnet_ebuf)) == NULL)
+ errx(1, "%s", libnet_ebuf);
if (target_ip != 0 && !arp_find(target_ip, &target_mac))
errx(1, "couldn't arp for host %s",
- libnet_host_lookup(target_ip, 0));
+ libnet_addr2name4(target_ip, LIBNET_DONT_RESOLVE));
signal(SIGHUP, cleanup);
signal(SIGINT, cleanup);
signal(SIGTERM, cleanup);
for (;;) {
- arp_send(llif, intf, ARPOP_REPLY, NULL, spoof_ip,
- (target_ip ? (u_char *)&target_mac : NULL),
+ arp_send(l, ARPOP_REPLY, NULL, spoof_ip,
+ (target_ip ? (u_int8_t *)&target_mac : NULL),
target_ip);
sleep(2);
}
diff -urNad dsniff-2.4b1/dnsspoof.c /tmp/dpep.4ezzqC/dsniff-2.4b1/dnsspoof.c
--- dsniff-2.4b1/dnsspoof.c 2001-03-15 10:33:03.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/dnsspoof.c 2006-06-09 13:35:29.000000000 +0300
@@ -38,7 +38,7 @@
pcap_t *pcap_pd = NULL;
int pcap_off = -1;
-int lnet_sock = -1;
+libnet_t *l;
u_long lnet_ip = -1;
static void
@@ -90,19 +90,18 @@
dns_init(char *dev, char *filename)
{
FILE *f;
- struct libnet_link_int *llif;
+ libnet_t *l;
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
struct dnsent *de;
char *ip, *name, buf[1024];
- if ((llif = libnet_open_link_interface(dev, buf)) == NULL)
- errx(1, "%s", buf);
+ if ((l = libnet_init(LIBNET_LINK, dev, libnet_ebuf)) == NULL)
+ errx(1, "%s", libnet_ebuf);
- if ((lnet_ip = libnet_get_ipaddr(llif, dev, buf)) == -1)
- errx(1, "%s", buf);
+ if ((lnet_ip = libnet_get_ipaddr4(l)) == -1)
+ errx(1, "%s", libnet_geterror(l));
- lnet_ip = htonl(lnet_ip);
-
- libnet_close_link_interface(llif);
+ libnet_destroy(l);
SLIST_INIT(&dns_entries);
@@ -180,7 +179,7 @@
static void
dns_spoof(u_char *u, const struct pcap_pkthdr *pkthdr, const u_char *pkt)
{
- struct libnet_ip_hdr *ip;
+ struct libnet_ipv4_hdr *ip;
struct libnet_udp_hdr *udp;
HEADER *dns;
char name[MAXHOSTNAMELEN];
@@ -189,7 +188,7 @@
in_addr_t dst;
u_short type, class;
- ip = (struct libnet_ip_hdr *)(pkt + pcap_off);
+ ip = (struct libnet_ipv4_hdr *)(pkt + pcap_off);
udp = (struct libnet_udp_hdr *)(pkt + pcap_off + (ip->ip_hl * 4));
dns = (HEADER *)(udp + 1);
p = (u_char *)(dns + 1);
@@ -212,7 +211,7 @@
if (class != C_IN)
return;
- p = buf + IP_H + UDP_H + dnslen;
+ p = buf + dnslen;
if (type == T_A) {
if ((dst = dns_lookup_a(name)) == -1)
@@ -234,38 +233,38 @@
anslen += 12;
}
else return;
-
- libnet_build_ip(UDP_H + dnslen + anslen, 0, libnet_get_prand(PRu16),
- 0, 64, IPPROTO_UDP, ip->ip_dst.s_addr,
- ip->ip_src.s_addr, NULL, 0, buf);
-
- libnet_build_udp(ntohs(udp->uh_dport), ntohs(udp->uh_sport),
- NULL, dnslen + anslen, buf + IP_H);
- memcpy(buf + IP_H + UDP_H, (u_char *)dns, dnslen);
+ memcpy(buf, (u_char *)dns, dnslen);
- dns = (HEADER *)(buf + IP_H + UDP_H);
+ dns = (HEADER *)buf;
dns->qr = dns->ra = 1;
if (type == T_PTR) dns->aa = 1;
dns->ancount = htons(1);
dnslen += anslen;
+
+ libnet_clear_packet(l);
+ libnet_build_udp(ntohs(udp->uh_dport), ntohs(udp->uh_sport),
+ LIBNET_UDP_H + dnslen, 0,
+ (u_int8_t *)buf, dnslen, l, 0);
+
+ libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_UDP_H + dnslen, 0,
+ libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_UDP, 0,
+ ip->ip_dst.s_addr, ip->ip_src.s_addr, NULL, 0, l, 0);
- libnet_do_checksum(buf, IPPROTO_UDP, UDP_H + dnslen);
-
- if (libnet_write_ip(lnet_sock, buf, IP_H + UDP_H + dnslen) < 0)
+ if (libnet_write(l) < 0)
warn("write");
fprintf(stderr, "%s.%d > %s.%d: %d+ %s? %s\n",
- libnet_host_lookup(ip->ip_src.s_addr, 0), ntohs(udp->uh_sport),
- libnet_host_lookup(ip->ip_dst.s_addr, 0), ntohs(udp->uh_dport),
+ libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(udp->uh_sport),
+ libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(udp->uh_dport),
ntohs(dns->id), type == T_A ? "A" : "PTR", name);
}
static void
cleanup(int sig)
{
- libnet_close_raw_sock(lnet_sock);
+ libnet_destroy(l);
pcap_close(pcap_pd);
exit(0);
}
@@ -276,6 +275,7 @@
extern char *optarg;
extern int optind;
char *p, *dev, *hosts, buf[1024];
+ char ebuf[LIBNET_ERRBUF_SIZE];
int i;
dev = hosts = NULL;
@@ -306,7 +306,7 @@
strlcpy(buf, p, sizeof(buf));
}
else snprintf(buf, sizeof(buf), "udp dst port 53 and not src %s",
- libnet_host_lookup(lnet_ip, 0));
+ libnet_addr2name4(lnet_ip, LIBNET_DONT_RESOLVE));
if ((pcap_pd = pcap_init(dev, buf, 128)) == NULL)
errx(1, "couldn't initialize sniffing");
@@ -314,10 +314,10 @@
if ((pcap_off = pcap_dloff(pcap_pd)) < 0)
errx(1, "couldn't determine link layer offset");
- if ((lnet_sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
+ if ((l = libnet_init(LIBNET_RAW4, dev, ebuf)) == NULL)
errx(1, "couldn't initialize sending");
- libnet_seed_prand();
+ libnet_seed_prand(l);
signal(SIGHUP, cleanup);
signal(SIGINT, cleanup);
diff -urNad dsniff-2.4b1/filesnarf.c /tmp/dpep.4ezzqC/dsniff-2.4b1/filesnarf.c
--- dsniff-2.4b1/filesnarf.c 2006-06-09 13:35:29.000000000 +0300
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/filesnarf.c 2006-06-09 13:35:29.000000000 +0300
@@ -134,8 +134,8 @@
int fd;
warnx("%s.%d > %s.%d: %s (%d@%d)",
- libnet_host_lookup(addr->daddr, 0), addr->dest,
- libnet_host_lookup(addr->saddr, 0), addr->source,
+ libnet_addr2name4(addr->daddr, LIBNET_DONT_RESOLVE), addr->dest,
+ libnet_addr2name4(addr->saddr, LIBNET_DONT_RESOLVE), addr->source,
ma->filename, len, ma->offset);
if ((fd = open(ma->filename, O_WRONLY|O_CREAT, 0644)) >= 0) {
@@ -353,7 +353,7 @@
}
static void
-decode_udp_nfs(struct libnet_ip_hdr *ip)
+decode_udp_nfs(struct libnet_ipv4_hdr *ip)
{
static struct tuple4 addr;
struct libnet_udp_hdr *udp;
diff -urNad dsniff-2.4b1/macof.c /tmp/dpep.4ezzqC/dsniff-2.4b1/macof.c
--- dsniff-2.4b1/macof.c 2001-03-15 10:33:04.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/macof.c 2006-06-09 13:35:29.000000000 +0300
@@ -48,8 +48,8 @@
static void
gen_mac(u_char *mac)
{
- *((in_addr_t *)mac) = libnet_get_prand(PRu32);
- *((u_short *)(mac + 4)) = libnet_get_prand(PRu16);
+ *((in_addr_t *)mac) = libnet_get_prand(LIBNET_PRu32);
+ *((u_short *)(mac + 4)) = libnet_get_prand(LIBNET_PRu16);
}
int
@@ -59,22 +59,23 @@
extern int optind;
int c, i;
struct libnet_link_int *llif;
- char ebuf[PCAP_ERRBUF_SIZE];
+ char pcap_ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
u_char sha[ETHER_ADDR_LEN], tha[ETHER_ADDR_LEN];
in_addr_t src, dst;
u_short sport, dport;
u_int32_t seq;
- u_char pkt[ETH_H + IP_H + TCP_H];
+ libnet_t *l;
while ((c = getopt(argc, argv, "vs:d:e:x:y:i:n:h?V")) != -1) {
switch (c) {
case 'v':
break;
case 's':
- Src = libnet_name_resolve(optarg, 0);
+ Src = libnet_name2addr4(l, optarg, 0);
break;
case 'd':
- Dst = libnet_name_resolve(optarg, 0);
+ Dst = libnet_name2addr4(l, optarg, 0);
break;
case 'e':
Tha = (u_char *)ether_aton(optarg);
@@ -101,13 +102,13 @@
if (argc != 0)
usage();
- if (!Intf && (Intf = pcap_lookupdev(ebuf)) == NULL)
- errx(1, "%s", ebuf);
+ if (!Intf && (Intf = pcap_lookupdev(pcap_ebuf)) == NULL)
+ errx(1, "%s", pcap_ebuf);
- if ((llif = libnet_open_link_interface(Intf, ebuf)) == 0)
- errx(1, "%s", ebuf);
+ if ((l = libnet_init(LIBNET_LINK, Intf, libnet_ebuf)) == NULL)
+ errx(1, "%s", libnet_ebuf);
- libnet_seed_prand();
+ libnet_seed_prand(l);
for (i = 0; i != Repeat; i++) {
@@ -117,39 +118,39 @@
else memcpy(tha, Tha, sizeof(tha));
if (Src != 0) src = Src;
- else src = libnet_get_prand(PRu32);
+ else src = libnet_get_prand(LIBNET_PRu32);
if (Dst != 0) dst = Dst;
- else dst = libnet_get_prand(PRu32);
+ else dst = libnet_get_prand(LIBNET_PRu32);
if (Sport != 0) sport = Sport;
- else sport = libnet_get_prand(PRu16);
+ else sport = libnet_get_prand(LIBNET_PRu16);
if (Dport != 0) dport = Dport;
- else dport = libnet_get_prand(PRu16);
+ else dport = libnet_get_prand(LIBNET_PRu16);
- seq = libnet_get_prand(PRu32);
-
- libnet_build_ethernet(tha, sha, ETHERTYPE_IP, NULL, 0, pkt);
-
- libnet_build_ip(TCP_H, 0, libnet_get_prand(PRu16), 0, 64,
- IPPROTO_TCP, src, dst, NULL, 0, pkt + ETH_H);
+ seq = libnet_get_prand(LIBNET_PRu32);
libnet_build_tcp(sport, dport, seq, 0, TH_SYN, 512,
- 0, NULL, 0, pkt + ETH_H + IP_H);
+ 0, 0, LIBNET_TCP_H, NULL, 0, l, 0);
- libnet_do_checksum(pkt + ETH_H, IPPROTO_IP, IP_H);
- libnet_do_checksum(pkt + ETH_H, IPPROTO_TCP, TCP_H);
+ libnet_build_ipv4(LIBNET_TCP_H, 0,
+ libnet_get_prand(LIBNET_PRu16), 0, 64,
+ IPPROTO_TCP, 0, src, dst, NULL, 0, l, 0);
- if (libnet_write_link_layer(llif, Intf, pkt, sizeof(pkt)) < 0)
+ libnet_build_ethernet(tha, sha, ETHERTYPE_IP, NULL, 0, l, 0);
+
+ if (libnet_write(l) < 0)
errx(1, "write");
+ libnet_clear_packet(l);
+
fprintf(stderr, "%s ",
ether_ntoa((struct ether_addr *)sha));
fprintf(stderr, "%s %s.%d > %s.%d: S %u:%u(0) win 512\n",
ether_ntoa((struct ether_addr *)tha),
- libnet_host_lookup(Src, 0), sport,
- libnet_host_lookup(Dst, 0), dport, seq, seq);
+ libnet_addr2name4(Src, 0), sport,
+ libnet_addr2name4(Dst, 0), dport, seq, seq);
}
exit(0);
}
diff -urNad dsniff-2.4b1/record.c /tmp/dpep.4ezzqC/dsniff-2.4b1/record.c
--- dsniff-2.4b1/record.c 2001-03-15 10:33:04.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/record.c 2006-06-09 13:35:29.000000000 +0300
@@ -65,8 +65,8 @@
tm = localtime(&rec->time);
strftime(tstr, sizeof(tstr), "%x %X", tm);
- srcp = libnet_host_lookup(rec->src, Opt_dns);
- dstp = libnet_host_lookup(rec->dst, Opt_dns);
+ srcp = libnet_addr2name4(rec->src, Opt_dns);
+ dstp = libnet_addr2name4(rec->dst, Opt_dns);
if ((pr = getprotobynumber(rec->proto)) == NULL)
protop = "unknown";
diff -urNad dsniff-2.4b1/sshmitm.c /tmp/dpep.4ezzqC/dsniff-2.4b1/sshmitm.c
--- dsniff-2.4b1/sshmitm.c 2001-03-15 10:33:04.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/sshmitm.c 2006-06-09 13:35:29.000000000 +0300
@@ -389,7 +389,7 @@
if (argc < 1)
usage();
- if ((ip = libnet_name_resolve(argv[0], 1)) == -1)
+ if ((ip = libnet_name2addr4(NULL, argv[0], LIBNET_RESOLVE)) == -1)
usage();
if (argc == 2 && (rport = atoi(argv[1])) == 0)
diff -urNad dsniff-2.4b1/tcpkill.c /tmp/dpep.4ezzqC/dsniff-2.4b1/tcpkill.c
--- dsniff-2.4b1/tcpkill.c 2001-03-17 10:10:43.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/tcpkill.c 2006-06-09 13:35:29.000000000 +0300
@@ -39,17 +39,18 @@
static void
tcp_kill_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
{
- struct libnet_ip_hdr *ip;
+ struct libnet_ipv4_hdr *ip;
struct libnet_tcp_hdr *tcp;
- u_char ctext[64], buf[IP_H + TCP_H];
+ u_char ctext[64];
u_int32_t seq, win;
- int i, *sock, len;
+ int i, len;
+ libnet_t *l;
- sock = (int *)user;
+ l = (libnet_t *)user;
pkt += pcap_off;
len = pcap->caplen - pcap_off;
- ip = (struct libnet_ip_hdr *)pkt;
+ ip = (struct libnet_ipv4_hdr *)pkt;
if (ip->ip_p != IPPROTO_TCP)
return;
@@ -57,34 +58,31 @@
if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST))
return;
- libnet_build_ip(TCP_H, 0, 0, 0, 64, IPPROTO_TCP,
- ip->ip_dst.s_addr, ip->ip_src.s_addr,
- NULL, 0, buf);
-
- libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
- 0, 0, TH_RST, 0, 0, NULL, 0, buf + IP_H);
-
seq = ntohl(tcp->th_ack);
win = ntohs(tcp->th_win);
snprintf(ctext, sizeof(ctext), "%s:%d > %s:%d:",
- libnet_host_lookup(ip->ip_src.s_addr, 0),
+ libnet_addr2name4(ip->ip_src.s_addr, LIBNET_DONT_RESOLVE),
ntohs(tcp->th_sport),
- libnet_host_lookup(ip->ip_dst.s_addr, 0),
+ libnet_addr2name4(ip->ip_dst.s_addr, LIBNET_DONT_RESOLVE),
ntohs(tcp->th_dport));
- ip = (struct libnet_ip_hdr *)buf;
- tcp = (struct libnet_tcp_hdr *)(ip + 1);
-
for (i = 0; i < Opt_severity; i++) {
- ip->ip_id = libnet_get_prand(PRu16);
seq += (i * win);
- tcp->th_seq = htonl(seq);
- libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
+ libnet_clear_packet(l);
- if (libnet_write_ip(*sock, buf, sizeof(buf)) < 0)
- warn("write_ip");
+ libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
+ seq, 0, TH_RST, 0, 0, 0, LIBNET_TCP_H,
+ NULL, 0, l, 0);
+
+ libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_TCP_H, 0,
+ libnet_get_prand(LIBNET_PRu16), 0, 64,
+ IPPROTO_TCP, 0, ip->ip_dst.s_addr,
+ ip->ip_src.s_addr, NULL, 0, l, 0);
+
+ if (libnet_write(l) < 0)
+ warn("write");
fprintf(stderr, "%s R %lu:%lu(0) win 0\n", ctext, seq, seq);
}
@@ -95,8 +93,10 @@
{
extern char *optarg;
extern int optind;
- int c, sock;
+ int c;
char *p, *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ libnet_t *l;
pcap_t *pd;
intf = NULL;
@@ -136,14 +136,14 @@
if ((pcap_off = pcap_dloff(pd)) < 0)
errx(1, "couldn't determine link layer offset");
- if ((sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
+ if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
errx(1, "couldn't initialize sending");
- libnet_seed_prand();
+ libnet_seed_prand(l);
warnx("listening on %s [%s]", intf, filter);
- pcap_loop(pd, -1, tcp_kill_cb, (u_char *)&sock);
+ pcap_loop(pd, -1, tcp_kill_cb, (u_char *)l);
/* NOTREACHED */
diff -urNad dsniff-2.4b1/tcpnice.c /tmp/dpep.4ezzqC/dsniff-2.4b1/tcpnice.c
--- dsniff-2.4b1/tcpnice.c 2001-03-17 09:41:51.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/tcpnice.c 2006-06-09 13:35:29.000000000 +0300
@@ -41,107 +41,106 @@
}
static void
-send_tcp_window_advertisement(int sock, struct libnet_ip_hdr *ip,
+send_tcp_window_advertisement(libnet_t *l, struct libnet_ipv4_hdr *ip,
struct libnet_tcp_hdr *tcp)
{
int len;
ip->ip_hl = 5;
- ip->ip_len = htons(IP_H + TCP_H);
- ip->ip_id = libnet_get_prand(PRu16);
- memcpy(buf, (u_char *)ip, IP_H);
+ ip->ip_len = htons(LIBNET_IPV4_H + LIBNET_TCP_H);
+ ip->ip_id = libnet_get_prand(LIBNET_PRu16);
+ memcpy(buf, (u_char *)ip, LIBNET_IPV4_H);
tcp->th_off = 5;
tcp->th_win = htons(MIN_WIN);
- memcpy(buf + IP_H, (u_char *)tcp, TCP_H);
+ memcpy(buf + LIBNET_IPV4_H, (u_char *)tcp, LIBNET_TCP_H);
- libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
+ libnet_do_checksum(l, buf, IPPROTO_TCP, LIBNET_TCP_H);
- len = IP_H + TCP_H;
+ len = LIBNET_IPV4_H + LIBNET_TCP_H;
- if (libnet_write_ip(sock, buf, len) != len)
+ if (libnet_write_raw_ipv4(l, buf, len) != len)
warn("write");
fprintf(stderr, "%s:%d > %s:%d: . ack %lu win %d\n",
- libnet_host_lookup(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
- libnet_host_lookup(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
+ libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
+ libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
ntohl(tcp->th_ack), 1);
}
static void
-send_icmp_source_quench(int sock, struct libnet_ip_hdr *ip)
+send_icmp_source_quench(libnet_t *l, struct libnet_ipv4_hdr *ip)
{
- struct libnet_icmp_hdr *icmp;
+ struct libnet_icmpv4_hdr *icmp;
int len;
len = (ip->ip_hl * 4) + 8;
- libnet_build_ip(ICMP_ECHO_H + len, 0, libnet_get_prand(PRu16),
- 0, 64, IPPROTO_ICMP, ip->ip_dst.s_addr,
- ip->ip_src.s_addr, NULL, 0, buf);
-
- icmp = (struct libnet_icmp_hdr *)(buf + IP_H);
+ icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
icmp->icmp_type = ICMP_SOURCEQUENCH;
icmp->icmp_code = 0;
- memcpy((u_char *)icmp + ICMP_ECHO_H, (u_char *)ip, len);
+ memcpy((u_char *)icmp + LIBNET_ICMPV4_ECHO_H, (u_char *)ip, len);
- libnet_do_checksum(buf, IPPROTO_ICMP, ICMP_ECHO_H + len);
+ len += LIBNET_ICMPV4_ECHO_H;
- len += (IP_H + ICMP_ECHO_H);
+ libnet_build_ipv4(LIBNET_IPV4_H + len, 0,
+ libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
+ 0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
+ (u_int8_t *) icmp, len, l, 0);
- if (libnet_write_ip(sock, buf, len) != len)
+ if (libnet_write(l) != len)
warn("write");
fprintf(stderr, "%s > %s: icmp: source quench\n",
- libnet_host_lookup(ip->ip_dst.s_addr, 0),
- libnet_host_lookup(ip->ip_src.s_addr, 0));
+ libnet_addr2name4(ip->ip_dst.s_addr, 0),
+ libnet_addr2name4(ip->ip_src.s_addr, 0));
}
static void
-send_icmp_frag_needed(int sock, struct libnet_ip_hdr *ip)
+send_icmp_frag_needed(libnet_t *l, struct libnet_ipv4_hdr *ip)
{
- struct libnet_icmp_hdr *icmp;
+ struct libnet_icmpv4_hdr *icmp;
int len;
len = (ip->ip_hl * 4) + 8;
- libnet_build_ip(ICMP_MASK_H + len, 4, libnet_get_prand(PRu16),
- 0, 64, IPPROTO_ICMP, ip->ip_dst.s_addr,
- ip->ip_src.s_addr, NULL, 0, buf);
-
- icmp = (struct libnet_icmp_hdr *)(buf + IP_H);
+ icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
icmp->icmp_type = ICMP_UNREACH;
icmp->icmp_code = ICMP_UNREACH_NEEDFRAG;
icmp->hun.frag.pad = 0;
icmp->hun.frag.mtu = htons(MIN_MTU);
- memcpy((u_char *)icmp + ICMP_MASK_H, (u_char *)ip, len);
+ memcpy((u_char *)icmp + LIBNET_ICMPV4_MASK_H, (u_char *)ip, len);
- libnet_do_checksum(buf, IPPROTO_ICMP, ICMP_MASK_H + len);
-
- len += (IP_H + ICMP_MASK_H);
+ len += LIBNET_ICMPV4_MASK_H;
+
+ libnet_build_ipv4(LIBNET_IPV4_H + len, 4,
+ libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
+ 0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
+ (u_int8_t *) icmp, len, l, 0);
- if (libnet_write_ip(sock, buf, len) != len)
+ if (libnet_write(l) != len)
warn("write");
fprintf(stderr, "%s > %s: icmp: ",
- libnet_host_lookup(ip->ip_dst.s_addr, 0),
- libnet_host_lookup(ip->ip_src.s_addr, 0));
+ libnet_addr2name4(ip->ip_dst.s_addr, 0),
+ libnet_addr2name4(ip->ip_src.s_addr, 0));
fprintf(stderr, "%s unreachable - need to frag (mtu %d)\n",
- libnet_host_lookup(ip->ip_src.s_addr, 0), MIN_MTU);
+ libnet_addr2name4(ip->ip_src.s_addr, 0), MIN_MTU);
}
static void
tcp_nice_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
{
- struct libnet_ip_hdr *ip;
+ struct libnet_ipv4_hdr *ip;
struct libnet_tcp_hdr *tcp;
- int *sock, len;
+ int len;
+ libnet_t *l;
- sock = (int *)user;
+ l = (libnet_t *)user;
pkt += pcap_off;
len = pcap->caplen - pcap_off;
- ip = (struct libnet_ip_hdr *)pkt;
+ ip = (struct libnet_ipv4_hdr *)pkt;
if (ip->ip_p != IPPROTO_TCP)
return;
@@ -151,11 +150,11 @@
if (ntohs(ip->ip_len) > (ip->ip_hl << 2) + (tcp->th_off << 2)) {
if (Opt_icmp)
- send_icmp_source_quench(*sock, ip);
+ send_icmp_source_quench(l, ip);
if (Opt_win)
- send_tcp_window_advertisement(*sock, ip, tcp);
+ send_tcp_window_advertisement(l, ip, tcp);
if (Opt_pmtu)
- send_icmp_frag_needed(*sock, ip);
+ send_icmp_frag_needed(l, ip);
}
}
@@ -164,8 +163,10 @@
{
extern char *optarg;
extern int optind;
- int c, sock;
+ int c;
char *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ libnet_t *l;
pcap_t *pd;
intf = NULL;
@@ -209,14 +210,14 @@
if ((pcap_off = pcap_dloff(pd)) < 0)
errx(1, "couldn't determine link layer offset");
- if ((sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
+ if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
errx(1, "couldn't initialize sending");
- libnet_seed_prand();
+ libnet_seed_prand(l);
warnx("listening on %s [%s]", intf, filter);
- pcap_loop(pd, -1, tcp_nice_cb, (u_char *)&sock);
+ pcap_loop(pd, -1, tcp_nice_cb, (u_char *)l);
/* NOTREACHED */
diff -urNad dsniff-2.4b1/tcp_raw.c /tmp/dpep.4ezzqC/dsniff-2.4b1/tcp_raw.c
--- dsniff-2.4b1/tcp_raw.c 2001-03-15 10:33:04.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/tcp_raw.c 2006-06-09 13:35:29.000000000 +0300
@@ -119,7 +119,7 @@
}
struct iovec *
-tcp_raw_input(struct libnet_ip_hdr *ip, struct libnet_tcp_hdr *tcp, int len)
+tcp_raw_input(struct libnet_ipv4_hdr *ip, struct libnet_tcp_hdr *tcp, int len)
{
struct tha tha;
struct tcp_conn *conn;
@@ -131,7 +131,7 @@
/* Verify TCP checksum. */
cksum = tcp->th_sum;
- libnet_do_checksum((u_char *) ip, IPPROTO_TCP, len);
+ libnet_do_checksum(NULL, (u_char *) ip, IPPROTO_TCP, len);
if (cksum != tcp->th_sum)
return (NULL);
diff -urNad dsniff-2.4b1/tcp_raw.h /tmp/dpep.4ezzqC/dsniff-2.4b1/tcp_raw.h
--- dsniff-2.4b1/tcp_raw.h 2001-03-15 10:33:06.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/tcp_raw.h 2006-06-09 13:35:29.000000000 +0300
@@ -15,7 +15,7 @@
u_short sport, u_short dport,
u_char *buf, int len);
-struct iovec *tcp_raw_input(struct libnet_ip_hdr *ip,
+struct iovec *tcp_raw_input(struct libnet_ipv4_hdr *ip,
struct libnet_tcp_hdr *tcp, int len);
void tcp_raw_timeout(int timeout, tcp_raw_callback_t callback);
diff -urNad dsniff-2.4b1/trigger.c /tmp/dpep.4ezzqC/dsniff-2.4b1/trigger.c
--- dsniff-2.4b1/trigger.c 2001-03-15 10:33:05.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/trigger.c 2006-06-09 13:35:29.000000000 +0300
@@ -276,7 +276,7 @@
}
void
-trigger_ip(struct libnet_ip_hdr *ip)
+trigger_ip(struct libnet_ipv4_hdr *ip)
{
struct trigger *t, tr;
u_char *buf;
@@ -305,7 +305,7 @@
/* libnids needs a nids_register_udp()... */
void
-trigger_udp(struct libnet_ip_hdr *ip)
+trigger_udp(struct libnet_ipv4_hdr *ip)
{
struct trigger *t, tr;
struct libnet_udp_hdr *udp;
@@ -437,7 +437,7 @@
}
void
-trigger_tcp_raw(struct libnet_ip_hdr *ip)
+trigger_tcp_raw(struct libnet_ipv4_hdr *ip)
{
struct trigger *t, tr;
struct libnet_tcp_hdr *tcp;
diff -urNad dsniff-2.4b1/trigger.h /tmp/dpep.4ezzqC/dsniff-2.4b1/trigger.h
--- dsniff-2.4b1/trigger.h 2001-03-15 10:33:06.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/trigger.h 2006-06-09 13:35:29.000000000 +0300
@@ -24,10 +24,10 @@
int trigger_set_tcp(int port, char *name);
int trigger_set_rpc(int program, char *name);
-void trigger_ip(struct libnet_ip_hdr *ip);
-void trigger_udp(struct libnet_ip_hdr *ip);
+void trigger_ip(struct libnet_ipv4_hdr *ip);
+void trigger_udp(struct libnet_ipv4_hdr *ip);
void trigger_tcp(struct tcp_stream *ts, void **conn_save);
-void trigger_tcp_raw(struct libnet_ip_hdr *ip);
+void trigger_tcp_raw(struct libnet_ipv4_hdr *ip);
void trigger_tcp_raw_timeout(int signal);
void trigger_rpc(int program, int proto, int port);
diff -urNad dsniff-2.4b1/urlsnarf.c /tmp/dpep.4ezzqC/dsniff-2.4b1/urlsnarf.c
--- dsniff-2.4b1/urlsnarf.c 2006-06-09 13:35:29.000000000 +0300
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/urlsnarf.c 2006-06-09 13:35:29.000000000 +0300
@@ -145,14 +145,14 @@
if (user == NULL)
user = "-";
if (vhost == NULL)
- vhost = libnet_host_lookup(addr->daddr, Opt_dns);
+ vhost = libnet_addr2name4(addr->daddr, Opt_dns);
if (referer == NULL)
referer = "-";
if (agent == NULL)
agent = "-";
printf("%s - %s [%s] \"%s http://%s%s\" - - \"%s\" \"%s\"\n",
- libnet_host_lookup(addr->saddr, Opt_dns),
+ libnet_addr2name4(addr->saddr, Opt_dns),
user, timestamp(), req, vhost, uri, referer, agent);
}
fflush(stdout);
diff -urNad dsniff-2.4b1/webmitm.c /tmp/dpep.4ezzqC/dsniff-2.4b1/webmitm.c
--- dsniff-2.4b1/webmitm.c 2001-03-17 10:35:05.000000000 +0200
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/webmitm.c 2006-06-09 13:35:29.000000000 +0300
@@ -242,7 +242,7 @@
word = buf_tok(&msg, "/", 1);
vhost = buf_strdup(word);
}
- ssin.sin_addr.s_addr = libnet_name_resolve(vhost, 1);
+ ssin.sin_addr.s_addr = libnet_name2addr4(NULL, vhost, 1);
free(vhost);
if (ssin.sin_addr.s_addr == ntohl(INADDR_LOOPBACK) ||
@@ -510,7 +510,7 @@
argv += optind;
if (argc == 1) {
- if ((static_host = libnet_name_resolve(argv[0], 1)) == -1)
+ if ((static_host = libnet_name2addr4(NULL, argv[0], 1)) == -1)
usage();
}
else if (argc != 0) usage();
diff -urNad dsniff-2.4b1/webspy.c /tmp/dpep.4ezzqC/dsniff-2.4b1/webspy.c
--- dsniff-2.4b1/webspy.c 2006-06-09 13:35:29.000000000 +0300
+++ /tmp/dpep.4ezzqC/dsniff-2.4b1/webspy.c 2006-06-09 13:35:29.000000000 +0300
@@ -126,7 +126,7 @@
if (auth == NULL)
auth = "";
if (vhost == NULL)
- vhost = libnet_host_lookup(addr->daddr, 0);
+ vhost = libnet_addr2name4(addr->daddr, 0);
snprintf(cmd, sizeof(cmd), "openURL(http://%s%s%s%s)",
auth, *auth ? "@" : "", vhost, uri);
@@ -205,7 +205,7 @@
cmdtab[0] = cmd;
cmdtab[1] = NULL;
- if ((host = libnet_name_resolve(argv[0], 1)) == -1)
+ if ((host = libnet_name2addr4(NULL, argv[0], 1)) == -1)
errx(1, "unknown host");
if ((dpy = XOpenDisplay(NULL)) == NULL)
| Darcs Patch | 4 | acheong08/dsniff | debian/patches/07_libnet_1.1.dpatch | [
"BSD-3-Clause"
]
|
frequency,raw
20.00,-10.21
20.20,-10.12
20.40,-10.03
20.61,-9.93
20.81,-9.84
21.02,-9.75
21.23,-9.65
21.44,-9.56
21.66,-9.46
21.87,-9.37
22.09,-9.27
22.31,-9.17
22.54,-9.07
22.76,-8.97
22.99,-8.87
23.22,-8.77
23.45,-8.67
23.69,-8.57
23.92,-8.47
24.16,-8.37
24.40,-8.27
24.65,-8.17
24.89,-8.07
25.14,-7.97
25.39,-7.87
25.65,-7.76
25.91,-7.66
26.16,-7.55
26.43,-7.45
26.69,-7.34
26.96,-7.24
27.23,-7.13
27.50,-7.03
27.77,-6.92
28.05,-6.82
28.33,-6.71
28.62,-6.60
28.90,-6.50
29.19,-6.39
29.48,-6.28
29.78,-6.18
30.08,-6.07
30.38,-5.97
30.68,-5.87
30.99,-5.77
31.30,-5.67
31.61,-5.56
31.93,-5.46
32.24,-5.35
32.57,-5.25
32.89,-5.15
33.22,-5.05
33.55,-4.94
33.89,-4.83
34.23,-4.72
34.57,-4.61
34.92,-4.51
35.27,-4.40
35.62,-4.29
35.97,-4.18
36.33,-4.06
36.70,-3.95
37.06,-3.83
37.43,-3.71
37.81,-3.60
38.19,-3.48
38.57,-3.37
38.95,-3.25
39.34,-3.14
39.74,-3.03
40.14,-2.91
40.54,-2.79
40.94,-2.68
41.35,-2.56
41.76,-2.44
42.18,-2.32
42.60,-2.21
43.03,-2.09
43.46,-1.98
43.90,-1.87
44.33,-1.76
44.78,-1.65
45.23,-1.53
45.68,-1.42
46.13,-1.31
46.60,-1.20
47.06,-1.09
47.53,-0.98
48.01,-0.88
48.49,-0.77
48.97,-0.66
49.46,-0.54
49.96,-0.43
50.46,-0.31
50.96,-0.20
51.47,-0.09
51.99,0.03
52.51,0.14
53.03,0.25
53.56,0.36
54.10,0.47
54.64,0.57
55.18,0.68
55.74,0.78
56.29,0.88
56.86,0.98
57.42,1.07
58.00,1.16
58.58,1.24
59.16,1.32
59.76,1.41
60.35,1.48
60.96,1.55
61.57,1.62
62.18,1.69
62.80,1.76
63.43,1.83
64.07,1.90
64.71,1.96
65.35,2.02
66.01,2.08
66.67,2.14
67.33,2.19
68.01,2.24
68.69,2.30
69.37,2.35
70.07,2.39
70.77,2.44
71.48,2.48
72.19,2.53
72.91,2.57
73.64,2.62
74.38,2.66
75.12,2.71
75.87,2.74
76.63,2.78
77.40,2.80
78.17,2.83
78.95,2.85
79.74,2.86
80.54,2.88
81.35,2.90
82.16,2.91
82.98,2.93
83.81,2.95
84.65,2.95
85.50,2.95
86.35,2.95
87.22,2.94
88.09,2.93
88.97,2.93
89.86,2.93
90.76,2.93
91.66,2.93
92.58,2.93
93.51,2.93
94.44,2.93
95.39,2.94
96.34,2.95
97.30,2.95
98.28,2.94
99.26,2.92
100.25,2.90
101.25,2.88
102.27,2.86
103.29,2.84
104.32,2.82
105.37,2.78
106.42,2.75
107.48,2.72
108.56,2.69
109.64,2.67
110.74,2.64
111.85,2.60
112.97,2.57
114.10,2.54
115.24,2.51
116.39,2.50
117.55,2.48
118.73,2.45
119.92,2.41
121.12,2.38
122.33,2.36
123.55,2.33
124.79,2.29
126.03,2.25
127.29,2.22
128.57,2.19
129.85,2.16
131.15,2.13
132.46,2.12
133.79,2.09
135.12,2.06
136.48,2.04
137.84,2.00
139.22,1.98
140.61,1.94
142.02,1.88
143.44,1.86
144.87,1.82
146.32,1.81
147.78,1.78
149.26,1.77
150.75,1.74
152.26,1.70
153.78,1.66
155.32,1.62
156.88,1.57
158.44,1.54
160.03,1.50
161.63,1.48
163.24,1.47
164.88,1.44
166.53,1.42
168.19,1.39
169.87,1.34
171.57,1.29
173.29,1.25
175.02,1.21
176.77,1.17
178.54,1.15
180.32,1.14
182.13,1.12
183.95,1.09
185.79,1.05
187.65,1.03
189.52,0.99
191.42,0.95
193.33,0.91
195.27,0.88
197.22,0.85
199.19,0.83
201.18,0.81
203.19,0.78
205.23,0.76
207.28,0.73
209.35,0.69
211.44,0.65
213.56,0.62
215.69,0.58
217.85,0.54
220.03,0.53
222.23,0.51
224.45,0.48
226.70,0.44
228.96,0.42
231.25,0.40
233.57,0.38
235.90,0.33
238.26,0.31
240.64,0.28
243.05,0.26
245.48,0.23
247.93,0.20
250.41,0.18
252.92,0.14
255.45,0.12
258.00,0.10
260.58,0.07
263.19,0.04
265.82,0.00
268.48,-0.03
271.16,-0.06
273.87,-0.09
276.61,-0.12
279.38,-0.14
282.17,-0.17
284.99,-0.20
287.84,-0.24
290.72,-0.27
293.63,-0.29
296.57,-0.31
299.53,-0.31
302.53,-0.32
305.55,-0.32
308.61,-0.32
311.69,-0.33
314.81,-0.34
317.96,-0.36
321.14,-0.39
324.35,-0.43
327.59,-0.47
330.87,-0.49
334.18,-0.53
337.52,-0.57
340.90,-0.59
344.30,-0.62
347.75,-0.63
351.23,-0.65
354.74,-0.65
358.28,-0.64
361.87,-0.63
365.49,-0.63
369.14,-0.64
372.83,-0.65
376.56,-0.69
380.33,-0.71
384.13,-0.74
387.97,-0.78
391.85,-0.81
395.77,-0.84
399.73,-0.88
403.72,-0.91
407.76,-0.94
411.84,-0.97
415.96,-0.99
420.12,-1.01
424.32,-1.00
428.56,-0.99
432.85,-0.96
437.18,-0.93
441.55,-0.90
445.96,-0.87
450.42,-0.83
454.93,-0.80
459.48,-0.76
464.07,-0.74
468.71,-0.71
473.40,-0.69
478.13,-0.67
482.91,-0.65
487.74,-0.64
492.62,-0.62
497.55,-0.61
502.52,-0.59
507.55,-0.56
512.62,-0.54
517.75,-0.50
522.93,-0.47
528.16,-0.43
533.44,-0.40
538.77,-0.37
544.16,-0.34
549.60,-0.32
555.10,-0.30
560.65,-0.29
566.25,-0.29
571.92,-0.30
577.64,-0.31
583.41,-0.32
589.25,-0.32
595.14,-0.32
601.09,-0.32
607.10,-0.32
613.17,-0.32
619.30,-0.32
625.50,-0.32
631.75,-0.32
638.07,-0.32
644.45,-0.32
650.89,-0.32
657.40,-0.32
663.98,-0.32
670.62,-0.32
677.32,-0.32
684.10,-0.32
690.94,-0.32
697.85,-0.32
704.83,-0.32
711.87,-0.32
718.99,-0.32
726.18,-0.32
733.44,-0.32
740.78,-0.32
748.19,-0.32
755.67,-0.32
763.23,-0.32
770.86,-0.32
778.57,-0.32
786.35,-0.32
794.22,-0.32
802.16,-0.32
810.18,-0.32
818.28,-0.33
826.46,-0.34
834.73,-0.34
843.08,-0.33
851.51,-0.31
860.02,-0.29
868.62,-0.27
877.31,-0.24
886.08,-0.21
894.94,-0.17
903.89,-0.14
912.93,-0.10
922.06,-0.07
931.28,-0.04
940.59,-0.01
950.00,0.01
959.50,0.03
969.09,0.03
978.78,0.03
988.57,0.02
998.46,0.01
1008.44,-0.01
1018.53,-0.01
1028.71,0.00
1039.00,0.01
1049.39,0.03
1059.88,0.05
1070.48,0.08
1081.19,0.11
1092.00,0.14
1102.92,0.18
1113.95,0.21
1125.09,0.23
1136.34,0.26
1147.70,0.28
1159.18,0.32
1170.77,0.35
1182.48,0.38
1194.30,0.41
1206.25,0.44
1218.31,0.46
1230.49,0.48
1242.80,0.51
1255.22,0.53
1267.78,0.56
1280.45,0.60
1293.26,0.65
1306.19,0.69
1319.25,0.72
1332.45,0.75
1345.77,0.78
1359.23,0.80
1372.82,0.83
1386.55,0.88
1400.41,0.93
1414.42,0.98
1428.56,1.04
1442.85,1.09
1457.28,1.14
1471.85,1.18
1486.57,1.21
1501.43,1.24
1516.45,1.26
1531.61,1.29
1546.93,1.31
1562.40,1.32
1578.02,1.33
1593.80,1.33
1609.74,1.33
1625.84,1.33
1642.10,1.33
1658.52,1.33
1675.10,1.31
1691.85,1.29
1708.77,1.28
1725.86,1.26
1743.12,1.24
1760.55,1.21
1778.15,1.16
1795.94,1.11
1813.90,1.05
1832.03,1.00
1850.36,0.94
1868.86,0.88
1887.55,0.84
1906.42,0.81
1925.49,0.77
1944.74,0.74
1964.19,0.72
1983.83,0.69
2003.67,0.65
2023.71,0.60
2043.94,0.56
2064.38,0.51
2085.03,0.45
2105.88,0.39
2126.94,0.33
2148.20,0.26
2169.69,0.18
2191.38,0.08
2213.30,-0.03
2235.43,-0.13
2257.78,-0.23
2280.36,-0.33
2303.17,-0.44
2326.20,-0.56
2349.46,-0.66
2372.95,-0.78
2396.68,-0.88
2420.65,-0.95
2444.86,-1.03
2469.31,-1.07
2494.00,-1.09
2518.94,-1.08
2544.13,-1.06
2569.57,-1.01
2595.27,-0.94
2621.22,-0.85
2647.43,-0.76
2673.90,-0.66
2700.64,-0.56
2727.65,-0.44
2754.93,-0.32
2782.48,-0.22
2810.30,-0.12
2838.40,-0.03
2866.79,0.06
2895.46,0.15
2924.41,0.24
2953.65,0.34
2983.19,0.42
3013.02,0.50
3043.15,0.59
3073.58,0.67
3104.32,0.73
3135.36,0.80
3166.72,0.87
3198.38,0.93
3230.37,0.99
3262.67,1.05
3295.30,1.10
3328.25,1.16
3361.53,1.26
3395.15,1.37
3429.10,1.52
3463.39,1.69
3498.03,1.92
3533.01,2.22
3568.34,2.59
3604.02,3.01
3640.06,3.51
3676.46,4.08
3713.22,4.75
3750.36,5.45
3787.86,6.23
3825.74,7.05
3864.00,7.87
3902.64,8.71
3941.66,9.54
3981.08,10.35
4020.89,11.13
4061.10,11.88
4101.71,12.57
4142.73,13.23
4184.15,13.82
4226.00,14.35
4268.26,14.82
4310.94,15.24
4354.05,15.62
4397.59,15.96
4441.56,16.25
4485.98,16.50
4530.84,16.72
4576.15,16.93
4621.91,17.10
4668.13,17.25
4714.81,17.37
4761.96,17.50
4809.58,17.62
4857.67,17.74
4906.25,17.85
4955.31,17.99
5004.87,18.14
5054.91,18.33
5105.46,18.53
5156.52,18.77
5208.08,19.03
5260.16,19.31
5312.77,19.63
5365.89,19.95
5419.55,20.27
5473.75,20.61
5528.49,20.96
5583.77,21.29
5639.61,21.58
5696.00,21.83
5752.96,22.06
5810.49,22.24
5868.60,22.39
5927.28,22.50
5986.56,22.57
6046.42,22.60
6106.89,22.61
6167.96,22.57
6229.64,22.51
6291.93,22.40
6354.85,22.26
6418.40,22.11
6482.58,21.90
6547.41,21.62
6612.88,21.28
6679.01,20.86
6745.80,20.35
6813.26,19.73
6881.39,19.02
6950.21,18.24
7019.71,17.38
7089.91,16.48
7160.81,15.50
7232.41,14.49
7304.74,13.45
7377.79,12.39
7451.56,11.34
7526.08,10.34
7601.34,9.40
7677.35,8.56
7754.13,7.85
7831.67,7.28
7909.98,6.84
7989.08,6.53
8068.98,6.34
8149.67,6.28
8231.16,6.35
8313.47,6.55
8396.61,6.87
8480.57,7.29
8565.38,7.79
8651.03,8.34
8737.54,8.92
8824.92,9.50
8913.17,10.08
9002.30,10.64
9092.32,11.16
9183.25,11.65
9275.08,12.08
9367.83,12.47
9461.51,12.80
9556.12,13.09
9651.68,13.32
9748.20,13.49
9845.68,13.60
9944.14,13.67
10043.58,13.71
10144.02,13.72
10245.46,13.70
10347.91,13.67
10451.39,13.60
10555.91,13.51
10661.46,13.40
10768.08,13.27
10875.76,13.11
10984.52,12.91
11094.36,12.67
11205.31,12.41
11317.36,12.13
11430.53,11.84
11544.84,11.54
11660.29,11.25
11776.89,10.97
11894.66,10.72
12013.60,10.48
12133.74,10.27
12255.08,10.07
12377.63,9.91
12501.41,9.77
12626.42,9.65
12752.68,9.53
12880.21,9.41
13009.01,9.28
13139.10,9.13
13270.49,8.97
13403.20,8.78
13537.23,8.58
13672.60,8.38
13809.33,8.15
13947.42,7.91
14086.90,7.67
14227.77,7.43
14370.04,7.18
14513.74,6.94
14658.88,6.70
14805.47,6.44
14953.52,6.16
15103.06,5.88
15254.09,5.57
15406.63,5.23
15560.70,4.84
15716.30,4.41
15873.47,3.95
16032.20,3.45
16192.52,2.93
16354.45,2.38
16517.99,1.83
16683.17,1.24
16850.01,0.64
17018.51,0.03
17188.69,-0.58
17360.58,-1.20
17534.18,-1.83
17709.53,-2.46
17886.62,-3.11
18065.49,-3.75
18246.14,-4.40
18428.60,-5.04
18612.89,-5.70
18799.02,-6.35
18987.01,-7.02
19176.88,-7.69
19368.65,-8.37
19562.33,-9.05
19757.96,-9.74
19955.54,-10.43
| CSV | 2 | vinzmc/AutoEq | measurements/referenceaudioanalyzer/data/onear/HDM-X/Grado SR325i (G earpads)/Grado SR325i (G earpads).csv | [
"MIT"
]
|
import createSvgIcon from './utils/createSvgIcon';
import { jsx as _jsx } from "react/jsx-runtime";
export default createSvgIcon( /*#__PURE__*/_jsx("path", {
d: "M21 5.47 12 12 7.62 7.62 3 11V8.52L7.83 5l4.38 4.38L21 3v2.47zM21 15h-4.7l-4.17 3.34L6 12.41l-3 2.13V17l2.8-2 6.2 6 5-4h4v-2z"
}), 'SsidChartOutlined'); | JavaScript | 3 | dany-freeman/material-ui | packages/mui-icons-material/lib/esm/SsidChartOutlined.js | [
"MIT"
]
|
const entryModuleToFlatten = [
'BottomNavigation',
'BottomNavigationAction',
'Card',
'CardActions',
'CardContent',
'CardHeader',
'CardMedia',
'CircularProgress',
'ClickAwayListener',
'Collapse',
'Dialog',
'DialogActions',
'DialogContent',
'DialogContentText',
'DialogTitle',
'ExpansionPanel',
'ExpansionPanelActions',
'ExpansionPanelDetails',
'ExpansionPanelSummary',
'Fade',
'Form',
'FormControl',
'FormControlLabel',
'FormGroup',
'FormHelperText',
'FormLabel',
'GridList',
'GridListTile',
'Grow',
'Input',
'InputLabel',
'LinearProgress',
'List',
'ListItem',
'ListItemAvatar',
'ListItemIcon',
'ListItemSecondaryAction',
'ListItemText',
'ListSubheader',
'Menu',
'MenuItem',
'Progress',
'Radio',
'RadioGroup',
'Slide',
'Step',
'StepButton',
'StepContent',
'Stepper',
'Stepper',
'Tab',
'Table',
'TableBody',
'TableCell',
'TableFooter',
'TableHead',
'TablePagination',
'TableRow',
'Tabs',
'withWidth',
'Zoom',
];
const keepSpecifiers = ['withWidth'];
export default function transformer(fileInfo, api, options) {
const j = api.jscodeshift;
let hasModifications = false;
const printOptions = options.printOptions || {
quote: 'single',
trailingComma: true,
};
const importModule = options.importModule || '@material-ui/core';
const targetModule = options.targetModule || '@material-ui/core';
const root = j(fileInfo.source);
const importRegExp = new RegExp(`^${importModule}/(.+)$`);
root.find(j.ImportDeclaration).forEach((path) => {
const importPath = path.value.source.value;
let entryModule = importPath.match(importRegExp);
// Remove non-MUI imports
if (!entryModule) {
return;
}
entryModule = entryModule[1].split('/');
entryModule = entryModule[entryModule.length - 1];
// No need to flatten
if (!entryModuleToFlatten.includes(entryModule)) {
return;
}
hasModifications = true;
if (keepSpecifiers.includes(entryModule)) {
path.value.source.value = `${targetModule}/${entryModule}`;
return;
}
path.node.specifiers.forEach((specifier) => {
const localName = specifier.local.name;
const importedName = specifier.imported ? specifier.imported.name : null;
if (!importedName) {
const importStatement = j.importDeclaration(
[j.importDefaultSpecifier(j.identifier(localName))],
j.literal(`${targetModule}/${entryModule}`),
);
j(path).insertBefore(importStatement);
} else {
const importStatement = j.importDeclaration(
[j.importDefaultSpecifier(j.identifier(localName))],
j.literal(`${targetModule}/${importedName}`),
);
j(path).insertBefore(importStatement);
}
});
path.prune();
});
return hasModifications ? root.toSource(printOptions) : null;
}
| JavaScript | 3 | dany-freeman/material-ui | packages/mui-codemod/src/v1.0.0/import-path.js | [
"MIT"
]
|
(ns lt.objs.notifos
"Provide fns for displaying messages and spinner in bottom statusbar"
(:require [lt.object :as object]
[lt.objs.statusbar :as statusbar]
[lt.objs.command :as cmd]
[lt.util.js :refer [wait]]
[singultus.binding :refer [map-bound bound deref?]])
(:require-macros [lt.macros :refer [behavior defui]]))
(def ^:private standard-timeout 10000)
(defn- msg* [m & [opts]]
(let [m (if (string? m)
m
(pr-str m))]
(object/merge! statusbar/statusbar-loader (merge {:message m :class ""} opts))))
(def ^:private cur-timeout)
(defn set-msg!
"Display message in bottom statusbar. Takes map of options with following keys:
* :class - css class for message. Use 'error' to display error message
* :timeout - Number of ms before message times out. Default is 10000 (10s)"
([msg]
(msg* msg)
(js/clearTimeout cur-timeout)
(set! cur-timeout (wait standard-timeout #(msg* ""))))
([msg opts]
(msg* msg opts)
(js/clearTimeout cur-timeout)
(set! cur-timeout (wait (or (:timeout opts)
standard-timeout) #(msg* "")))))
(defn working
"Display working spinner with optional statusbar message"
([] (working nil))
([msg]
(when msg
(set-msg! msg))
(statusbar/loader-inc)))
(defn done-working
"Hide working spinner with optional statusbar message"
([]
(statusbar/loader-dec))
([msg]
(set-msg! msg)
(statusbar/loader-dec)))
(cmd/command {:command :reset-working
:desc "Status Bar: Reset working indicator"
:exec (fn []
(statusbar/loader-set)
)})
| Clojure | 5 | luigigubello/LightTable | src/lt/objs/notifos.cljs | [
"MIT"
]
|
package com.taobao.arthas.core.distribution;
import com.taobao.arthas.core.command.model.ResultModel;
/**
* Command result distributor, sending results to consumers who joins in the same session.
* @author gongdewei 2020-03-26
*/
public interface ResultDistributor {
/**
* Append the phased result to queue
* @param result a phased result of the command
*/
void appendResult(ResultModel result);
/**
* Close result distribtor, release resources
*/
void close();
}
| Java | 4 | weihubeats/arthas | core/src/main/java/com/taobao/arthas/core/distribution/ResultDistributor.java | [
"Apache-2.0"
]
|
<a href="{{ site.sponsor-url }}" class="card card-sponsor" target="_blank" rel="noopener" style="background-image: url({{ site.base }}/static/sponsor-banner-homepage.svg)" aria-label="Sponsor Tabler!">
<div class="card-body"></div>
</a> | HTML | 3 | muhginanjar/tabler | src/pages/_includes/cards/sponsor.html | [
"MIT"
]
|
{{
Sony_Send_Test.spin
Tom Doyle
9 March 2007
Counter A is used to send Sony TV remote codes to an IR led
(Parallax #350-00017).
The test program uses a Panasonic IR Receiver (Parallax #350-00014)
to receive and decode the signals. Due to the power of multiple cogs
in the Propeller the receive object runs in its own cog waiting for
a code to be received. When a code is received it is written into the
IRcode variable and processed by the main program. The code is read
by the receive object in a cog as it is transmitted by another cog.
This works fine at the relatively low data rates used by Sony TV remote.
A Parallax LCD display is used to display the received codes as the
Propeller talks to itself.
See Sony_Send.spin and IR_Remote.spin for more information.
}}
CON
_CLKMODE = XTAL1 + PLL16X ' 80 Mhz clock
_XINFREQ = 5_000_000
IRdetPin = 23 ' IR Receiver - Propeller Pin
IRledPin = 22 ' IR Led - Propeller Pin
OBJ
irTx : "Sony_Send"
irRx : "IR_Remote"
lcd : "Serial_Lcd"
num : "simple_numbers"
time : "Timing"
VAR
byte IRcode ' keycode from IR Receiver
PUB Init | freq, index, rxCog, txCog, lcode
if lcd.start(0, 9600, 4)
lcd.cls
lcd.putc(lcd#LcdOn1) ' setup screen
lcd.backlight(1)
lcd.str(string("Sony Send"))
' start IR receiver using a new cog
rxCog := irRx.Start(IRdetPin, @IRcode) ' pin connected to the IR receiver, address of variable
time.pause1ms(60) ' wait for IR Receiver to start
index := 0
repeat
irTx.SendSonyCode(IRledPin, index) ' send a code
If IRcode <> irRx#NoNewCode ' check for a new code
lcode := IRcode
irRx.Start(IRdetPin, @IRcode) ' set up for next code
lcd.gotoxy(0,1)
lcd.str(num.bin(lcode, 7))
lcd.str(string(" "))
lcd.str(num.dec(lcode))
lcd.str(string(" "))
case lcode
irRx#one : lcd.str(string("<1> "))
irRx#two : lcd.str(string("<2> "))
irRx#three : lcd.str(string("<3> "))
irRx#four : lcd.str(string("<4> "))
irRx#five : lcd.str(string("<5> "))
irRx#six : lcd.str(string("<6> "))
irRx#seven : lcd.str(string("<7> "))
irRx#eight : lcd.str(string("<8> "))
irRx#nine : lcd.str(string("<9> "))
irRx#zero : lcd.str(string("<0> "))
irRx#chUp : lcd.str(string("chUp "))
irRx#chDn : lcd.str(string("chDn "))
irRx#volUp : lcd.str(string("volUp"))
irRx#volDn : lcd.str(string("volDn"))
irRx#mute : lcd.str(string("mute "))
irRx#power : lcd.str(string("power"))
irRx#last : lcd.str(string("last "))
other : lcd.str(string(" "))
waitcnt((clkfreq / 2000) * 1500 + cnt)
index := index + 1
if index > 9
index := 0
| Propeller Spin | 5 | deets/propeller | libraries/community/p1/All/IR Transmit/Sony_Send_Test.spin | [
"MIT"
]
|
{{
Capacitive sensing test
lights up an LED on the demo board when the switch is activated
}}
CON
_clkmode = xtal1+pll16x
_clkfreq = 80_000_000
switch_pin = 2
threshold = $04
OBJ
switch: "capswitch"
pc : "PC_Text"
VAR
long avg ' for debugging and threshold adjustment
long current ' for debugging and threshold adjustment
PUB start
switch.start(switch_pin, @avg, @current, threshold)
pc.start(pc#TXPIN)
pc.out($00)
dira[16]~~
outa[16]~~
waitcnt(clkfreq/2 + cnt)
outa[16]~
repeat
waitcnt(clkfreq/50 + cnt)
pc.out($01)
pc.str(STRING(" AVG:"))
pc.hex(avg,8)
pc.out($0D)
pc.str(STRING("CURR:"))
pc.hex(current,8)
if switch.state
outa[16]~~
else
outa[16]~ | Propeller Spin | 4 | deets/propeller | libraries/community/p1/All/Capacitive Touch Switch/capswitch_test.spin | [
"MIT"
]
|
%!PS-Adobe-3.0
statusdict /setduplexmode known {
statusdict begin true setduplexmode end
} if
| PostScript | 2 | newluhux/plan9port | postscript/prologues/duplex.ps | [
"MIT"
]
|
/******************************************************************************
* Copyright 2018 The Apollo Authors. 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.
*****************************************************************************/
// SAMPLE CODE:
//
// class DefaultDetector : public BaseDetector {
// public:
// DefaultDetector() : BaseDetector() {}
// virtual ~DefaultDetector() {}
//
// virtual bool Init() override {
// // Do something.
// return true;
// }
//
// virtual bool Detect(
// const drivers::ContiRadar& corrected_obstacles,
// const DetectorOptions& options,
// base::FramePtr detected_frame) override {
// // Do something.
// return true;
// }
//
// virtual std::string Name() const override {
// return "DefaultDetector";
// }
//
// };
//
// // Register plugin.
// PERCEPTION_REGISTER_DETECTOR(DefaultDetector);
////////////////////////////////////////////////////////
// USING CODE:
//
// BaseDetector* detector =
// BaseDetectorRegisterer::GetInstanceByName("DefaultDetector");
// using detector to do somethings.
// ////////////////////////////////////////////////////
#pragma once
#include <string>
#include "Eigen/Core"
#include "cyber/common/log.h"
#include "cyber/common/macros.h"
#include "modules/drivers/proto/conti_radar.pb.h"
#include "modules/perception/base/frame.h"
#include "modules/perception/common/geometry/roi_filter.h"
#include "modules/perception/lib/config_manager/config_manager.h"
#include "modules/perception/lib/registerer/registerer.h"
#include "modules/perception/radar/common/types.h"
namespace apollo {
namespace perception {
namespace radar {
struct DetectorOptions {
Eigen::Matrix4d* radar2world_pose = nullptr;
Eigen::Matrix4d* radar2novatel_trans = nullptr;
Eigen::Vector3f car_linear_speed = Eigen::Vector3f::Zero();
Eigen::Vector3f car_angular_speed = Eigen::Vector3f::Zero();
base::HdmapStructPtr roi = nullptr;
};
class BaseDetector {
public:
BaseDetector() = default;
virtual ~BaseDetector() = default;
virtual bool Init() = 0;
// @brief: detect the objects from the corrected obstacles
// @param [in]: corrected obstacles.
// @param [in]: options.
// @param [out]: detected objects.
virtual bool Detect(const drivers::ContiRadar& corrected_obstacles,
const DetectorOptions& options,
base::FramePtr detected_frame) = 0;
virtual std::string Name() const = 0;
private:
DISALLOW_COPY_AND_ASSIGN(BaseDetector);
};
PERCEPTION_REGISTER_REGISTERER(BaseDetector);
#define PERCEPTION_REGISTER_DETECTOR(name) \
PERCEPTION_REGISTER_CLASS(BaseDetector, name)
} // namespace radar
} // namespace perception
} // namespace apollo
| C | 4 | seeclong/apollo | modules/perception/radar/lib/interface/base_detector.h | [
"Apache-2.0"
]
|
<i18n lang="yaml">
en:
hello: "hello world!"
ja:
hello: "こんにちは、世界!"
</i18n>
| Vue | 3 | tumido/prettier | tests/format/vue/custom_block/yaml.vue | [
"MIT"
]
|
/*
* 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 entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
*
* @author lukas
*/
@Entity
@Table(name = "PERSON")
public class Person implements java.io.Serializable {
private String id;
private String lastName;
private String firstName;
/**
* Creates a new instance of Person
*/
public Person() {
}
public Person(String id, String firstName, String lastName) {
this.id = id;
this.firstName = firstName;
this.lastName = lastName;
}
@Column(name = "ID")
@Id
public String getId() {
return this.id;
}
@Column(name = "LASTNAME")
public String getLastName() {
return this.lastName;
}
@Column(name = "FIRSTNAME")
public String getFirstName() {
return this.firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public void setId(String id) {
this.id = id;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
| Grammatical Framework | 4 | timfel/netbeans | enterprise/websvc.restkit/test/qa-functional/data/resources/Person.java.gf | [
"Apache-2.0"
]
|
2016-03-16 11:24:24 > anon (whoami@MKFS-8C9751DE) has joined #theden
2016-03-16 11:24:24 - Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-16 11:24:26 - Channel created on Wed, 16 Mar 2016 11:24:24
2016-03-16 11:30:34 - irc: disconnected from server
2016-03-16 11:30:42 > anon (whoami@MKFS-8C9751DE) has joined #theden
2016-03-16 11:30:42 - Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-16 11:30:44 - Channel created on Wed, 16 Mar 2016 11:30:41
2016-03-16 11:39:12 - irc: disconnected from server
2016-03-16 11:39:19 > anon (whoami@MKFS-8C9751DE) has joined #theden
2016-03-16 11:39:19 - Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-16 11:39:23 - Channel created on Wed, 16 Mar 2016 11:39:19
2016-03-16 11:41:45 - anon has changed topic for #theden to ""Welcome Dan and Phil.. Does this feel retro?""
2016-03-16 11:43:39 - irc: disconnected from server
2016-03-16 11:43:43 > anon ([email protected]) has joined #theden
2016-03-16 11:43:43 - Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-16 11:43:47 - Channel created on Wed, 16 Mar 2016 11:43:42
2016-03-16 11:58:13 - anon has changed topic for #theden to ""rah rah rah rah""
2016-03-16 13:25:34 > yodah ([email protected]) has joined #theden
2016-03-16 13:25:57 yodah [o.O]
2016-03-16 13:30:20 @anon haha
2016-03-16 13:30:23 @anon how are things
2016-03-16 13:30:32 @anon hopefully you can get through the day
2016-03-16 13:45:51 yodah yeah i'll be right. Hopefully it stays quiet
2016-03-16 13:48:02 @anon :)
2016-03-16 13:48:07 @anon im considering leaving early
2016-03-16 13:48:09 @anon just cause i'm bored
2016-03-16 14:03:43 yodah haha
2016-03-16 14:03:51 @anon its gonna be one of those weeks
2016-03-16 14:03:56 yodah do you still get paid for the full day?
2016-03-16 14:19:05 @anon i do indeed sir
2016-03-16 14:22:49 yodah nice
2016-03-16 14:33:37 @anon so damn quiet though
2016-03-16 14:33:47 @anon might have a nap on the couch
2016-03-16 14:33:48 @anon haha
2016-03-16 15:10:31 yodah haha jealous
2016-03-16 15:12:59 @anon haha.. id rather be working.. im goina little crazy
2016-03-16 15:57:07 @anon off to home i go.. lazy evening i think
2016-03-16 16:29:52 yodah yeah i'm contemplating going but i've made it this far haha
2016-03-16 17:43:36 yodah i'm out!
2016-03-16 17:43:39 < yodah ([email protected]) has quit (Quit: WeeChat 0.3.8)
2016-03-16 20:28:26 - irc: disconnected from server
2016-03-16 20:28:33 > anon ([email protected]) has joined #theden
2016-03-16 20:28:33 - Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-16 20:28:37 - Channel created on Wed, 16 Mar 2016 20:28:33
2016-03-16 20:36:41 - irc: disconnected from server
2016-03-17 02:36:26 > anon ([email protected]) has joined #theden
2016-03-17 02:36:26 - Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-17 02:36:30 - Channel created on Thu, 17 Mar 2016 02:36:26
2016-03-17 10:10:24 > yodah ([email protected]) has joined #theden
2016-03-17 10:12:25 @anon hey
2016-03-17 10:12:36 yodah yo
2016-03-17 10:12:43 @anon im workin' from home today
2016-03-17 10:12:49 @anon thats how lazy i am ;)
2016-03-17 10:12:55 yodah hahaha
2016-03-17 10:13:23 yodah what if the boss comes into work and it's all closed? :)
2016-03-17 10:14:55 yodah or if a server needs a hard reboot, you're fucked haha
2016-03-17 10:15:06 @anon if a server needs a hard reboot, then i go into work dont i. haha
2016-03-17 10:15:22 @anon its not like i dont tell anyone im not working from home though
2016-03-17 10:54:43 yodah thats good you can do that
2016-03-17 13:29:39 > turtletoe ([email protected]) has joined #theden
2016-03-17 13:29:50 turtletoe Hi
2016-03-17 14:04:06 > turtl3to3 ([email protected]) has joined #theden
2016-03-17 14:06:49 < turtletoe ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-17 14:35:29 < turtl3to3 ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-17 14:46:40 > turtl3to3 ([email protected]) has joined #theden
2016-03-17 15:40:24 < turtl3to3 ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-17 15:50:33 - irc: disconnected from server
2016-03-17 19:44:28 > anon ([email protected]) has joined #theden
2016-03-17 19:44:28 - Channel #theden: 3 nicks (0 ops, 0 halfops, 0 voices, 3 normals)
2016-03-17 19:44:32 - Channel created on Thu, 17 Mar 2016 02:36:26
2016-03-17 20:10:19 < turtl3to3 ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-17 21:21:27 > turtl3to3 ([email protected]) has joined #theden
2016-03-17 21:44:57 < turtl3to3 ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-17 21:48:50 > turtl3to3 ([email protected]) has joined #theden
2016-03-18 00:51:59 < turtl3to3 ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-18 01:02:14 < yodah ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-18 02:02:15 > yodah ([email protected]) has joined #theden
2016-03-18 11:08:20 yodah what awesome weather today haha
2016-03-18 16:33:57 anon yeah i know
2016-03-18 16:34:03 anon so fuuuuuckin wonderful
2016-03-18 20:03:55 - irc: disconnected from server
2016-03-19 07:19:29 > anon ([email protected]) has joined #theden
2016-03-19 07:19:29 - Topic for #theden is ".,:!$$!:,.;!$$!:,. _{o.O}-{} .,;!$$!:,.,;!$$!:,."
2016-03-19 07:19:29 - Topic set by yodah on Fri, 18 Mar 2016 20:33:20
2016-03-19 07:19:29 - Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-03-19 07:19:33 - Channel created on Fri, 18 Mar 2016 20:30:43
2016-03-19 08:27:29 > anon ([email protected]) has joined #theden
2016-03-19 08:27:29 - Topic for #theden is ".,:!$$!:,.;!$$!:,. _{o.O}-{} .,;!$$!:,.,;!$$!:,."
2016-03-19 08:27:29 - Topic set by yodah on Fri, 18 Mar 2016 20:33:20
2016-03-19 08:27:29 - Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-03-19 08:27:33 - Channel created on Fri, 18 Mar 2016 20:30:43
2016-03-19 21:36:25 - Mode #theden [+o anon] by yodah
2016-03-20 13:26:05 < yodah ([email protected]) has quit (Ping timeout: 180 seconds)
2016-03-20 13:40:47 > yodah ([email protected]) has joined #theden
2016-03-21 07:15:57 - irc: disconnected from server
2016-03-21 07:55:26 > anon ([email protected]) has joined #theden
2016-03-21 07:55:26 - Topic for #theden is ".,:!$$!:,.;!$$!:,. _{o.O}-{} .,;!$$!:,.,;!$$!:,."
2016-03-21 07:55:26 - Topic set by yodah on Fri, 18 Mar 2016 20:33:20
2016-03-21 07:55:26 - Channel #theden: 2 nicks (0 ops, 0 halfops, 0 voices, 2 normals)
2016-03-21 07:55:30 - Channel created on Fri, 18 Mar 2016 20:30:43
2016-03-24 00:11:04 > anon ([email protected]) has joined #theden
2016-03-24 00:11:04 - Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-03-24 00:11:08 - Channel created on Wed, 23 Mar 2016 07:59:33
2016-03-24 05:22:29 > anon ([email protected]) has joined #theden
2016-03-24 05:22:29 - Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-03-24 05:22:33 - Channel created on Wed, 23 Mar 2016 07:59:33
2016-03-24 05:31:50 - irc: disconnected from server
2016-03-30 12:06:06 - anon ([email protected]) has joined #theden
2016-03-30 12:06:06 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-03-30 12:06:10 Channel created on Wed, 30 Mar 2016 12:06:05
2016-03-30 18:34:06 irc: disconnected from server
2016-04-06 11:36:33 - anon ([email protected]) has joined #theden
2016-04-06 11:36:33 [11:36]
2016-04-06 11:36:33 Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-04-06 11:36:37 Channel created on Wed, 06 Apr 2016 00:02:26
2016-04-06 11:42:00 [11:36]
2016-04-06 16:41:19 irc: disconnected from server
2016-04-07 06:58:09 - anon ([email protected]) has joined #theden
2016-04-07 06:58:09 [06:58]
2016-04-07 06:58:09 Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-04-07 06:58:13 Channel created on Wed, 06 Apr 2016 20:46:52
2016-04-07 07:04:00 [06:58]
2016-04-07 07:34:37 irc: disconnected from server
2016-04-07 07:56:53 - anon ([email protected]) has joined #theden
2016-04-07 07:56:53 [07:56]
2016-04-07 07:56:53 Channel #theden: 2 nicks (1 op, 0 halfops, 0 voices, 1 normal)
2016-04-07 07:56:57 Channel created on Wed, 06 Apr 2016 20:46:52
2016-04-07 08:02:00 [07:56]
2016-04-07 08:48:02 yodah ([email protected]) has quit (Ping timeout: 180 seconds)
2016-04-07 08:48:02 [08:48]
2016-04-07 09:02:24 - yodah ([email protected]) has joined #theden
2016-04-07 09:08:00 [09:02]
2016-04-07 09:11:20 irc: disconnected from server
2016-04-07 09:37:01 - anon ([email protected]) has joined #theden
2016-04-07 09:37:01 [09:37]
2016-04-07 09:37:01 Channel #theden: 2 nicks (0 ops, 0 halfops, 0 voices, 2 normals)
2016-04-07 09:37:05 Channel created on Wed, 06 Apr 2016 20:46:52
2016-04-07 09:43:00 [09:37]
2016-04-07 10:36:51 - anon ([email protected]) has joined #theden
2016-04-07 10:36:51 [10:36]
2016-04-07 10:36:51 Channel #theden: 2 nicks (0 ops, 0 halfops, 0 voices, 2 normals)
2016-04-07 10:36:55 Channel created on Wed, 06 Apr 2016 20:46:52
2016-04-07 10:42:00 [10:36]
2016-04-07 18:31:59 - anon ([email protected]) has joined #theden
2016-04-07 18:31:59 [18:31]
2016-04-07 18:31:59 Channel #theden: 2 nicks (0 ops, 0 halfops, 0 voices, 2 normals)
2016-04-07 18:32:03 Channel created on Wed, 06 Apr 2016 20:46:52
2016-04-07 18:38:00 [18:32]
2016-04-07 18:39:55 irc: disconnected from server
2016-04-07 22:03:21 - anon ([email protected]) has joined #theden
2016-04-07 22:03:21 [22:03]
2016-04-07 22:03:21 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-07 22:03:25 Channel created on Thu, 07 Apr 2016 22:04:21
2016-04-07 22:09:00 [22:03]
2016-04-07 22:17:50 irc: disconnected from server
2016-04-07 23:09:10 - anon ([email protected]) has joined #theden
2016-04-07 23:09:10 [23:09]
2016-04-07 23:09:10 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-07 23:09:14 Channel created on Thu, 07 Apr 2016 23:10:10
2016-04-07 23:15:00 [23:09]
2016-04-08 13:40:51 irc: disconnected from server
2016-04-08 17:53:07 - anon ([email protected]) has joined #theden
2016-04-08 17:53:07 [17:53]
2016-04-08 17:53:07 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-08 17:53:11 Channel created on Fri, 08 Apr 2016 17:54:06
2016-04-08 17:59:00 [17:53]
2016-04-09 00:49:23 - anon ([email protected]) has joined #theden
2016-04-09 00:49:23 [00:49]
2016-04-09 00:49:23 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-09 00:49:27 Channel created on Sat, 09 Apr 2016 00:50:22
2016-04-09 00:55:00 [00:49]
2016-04-09 19:55:58 irc: disconnected from server
2016-04-11 10:21:39 - anon ([email protected]) has joined #theden
2016-04-11 10:21:39 [10:21]
2016-04-11 10:21:39 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-11 10:21:43 Channel created on Mon, 11 Apr 2016 10:22:33
2016-04-11 10:27:00 [10:21]
2016-04-11 20:55:11 irc: disconnected from server
2016-04-11 21:51:11 - anon ([email protected]) has joined #theden
2016-04-11 21:51:11 [21:51]
2016-04-11 21:51:11 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-11 21:51:15 Channel created on Mon, 11 Apr 2016 21:52:04
2016-04-11 21:57:00 [21:51]
2016-04-11 22:33:53 irc: disconnected from server
2016-04-11 22:33:53 [22:33]
2016-04-11 22:34:07 - anon ([email protected]) has joined #theden
2016-04-11 22:34:07 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-11 22:34:11 Channel created on Mon, 11 Apr 2016 22:35:00
2016-04-11 22:40:00 [22:34]
2016-04-12 13:24:55 irc: disconnected from server
2016-04-12 13:24:55 [13:24]
2016-04-12 13:25:09 - anon ([email protected]) has joined #theden
2016-04-12 13:25:09 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-12 13:25:13 Channel created on Tue, 12 Apr 2016 13:26:01
2016-04-12 13:31:00 [13:25]
2016-04-12 18:32:41 irc: disconnected from server
2016-04-12 18:32:41 [18:32]
2016-04-12 18:34:15 - anon ([email protected]) has joined #theden
2016-04-12 18:34:15 Channel #theden: 1 nick (1 op, 0 halfops, 0 voices, 0 normals)
2016-04-12 18:34:19 Channel created on Tue, 12 Apr 2016 18:35:06
2016-04-12 18:40:00 [18:34]
| IRC log | 0 | 0x4b1dN/2016-dots | misc/weechat/logs/irc.mkfs.#theden.weechatlog | [
"MIT"
]
|
Note 0
Copyright (C) 2018 Jonathan Hough. All rights reserved.
)
NB. Symbolic regression
Note 'References'
[0] A Greedy Search Tree Heuristic for Symbolic Regression, Fabricio Olivetti de Franca
link: https://arxiv.org/pdf/1801.01807.pdf
[1] Genetic Programming for Symbolic Regression, Chi Zhang
link: https://pdfs.semanticscholar.org/e5ee/ddd04b8344fd4f39a5836be686886c80df13.pdf
Of interest...
[2] Learning Optimal Control of Synchronization in Networks of Coupled Oscillators using Genetic Programming-based Symbolic Regression, Gout, J. et al.
link: https://arxiv.org/pdf/1612.05276.pdf
)
NB. Symbolic Regressor
NB. Symbolic Regressor uses primitive operators, placed in sequence,
NB. which allows J to turn into function by `:6. The placement in sequence
NB. of each operator may be arbitrary, and the Genetic Programming Solver
NB. is tasked with finding some order that gives an accurate result,
NB. as measured by the cost (fitness) function.
coclass 'SymReg'
coinsert 'GenObj'
NB. primitive functions
'sin cos tan sinh cosh tanh'=: <"0 (1&o.@:])`(2&o.@:])`(3&o.@:])`(5&o.@:])`(6&o.@:])`(7&o.@:])
'arcsin arccos arctan arcsinh arccosh arctanh'=:<"0 (_1&o.@:])`(_2&o.@:])`(_3&o.@:])`(_5&o.@:])`(_6&o.@:])`(_7&o.@:])
'exp log log10'=:<"0 ([:^])`([:^.])`(10&^.@:])
'pow square cube quart quint sext sept'=: <"0 ^`(*:@:])`((^&3)@:])`((^&4)@:])`((^&5)@:])`((^&6)@:])`((^&7)@:])
'sqr root'=: <"0 ([:%:])`%:
'gamma combos'=:<"0 ([:!])`!
'plus mult sub neg div self left kill'=: <"0 +`*`-`([:-])`%`]`[`[:
'abs mod inc dec floor ciel sign'=:<"0 ([:|])`|`([:>:])`([:<:])`([: <. ])`([: >. ])`([: * ])
'mul2 mul1p5 mul3 mul5 mul7 mul11 mul13 mul10'=: <"0 ([:+:])`(1.5&*@:])`(3&*@:])`(5&*@:])`(7&*@:])`(11&*@:])`(13&*@:])`(10&*@:])
'div2 div3 div5 div7'=: <"0 ([:-:])`(0.3333&*@:])`(0.2&*@:])`(0.142857&*@:])
NB. add constants
'add1r2 add1r3 add2 add3 add4 add5 add6 add7 add8 add9 add10'=:<"0 (0.5&+@:])`(1.5&+@:])`(2&+@:])`(3&+@:])`(4&+@:])`(5&+@:])`(6&+@:])`(7&+@:])`(8&+@:])`(9&+@:])`(10&+@:])
rTerminators=:left
lTerminators=:sin,cos,tan,sinh,cosh,tanh,arcsin,arccos,arctan,arcsinh,arccosh,arctanh
lTerminators=:lTerminators,sqr,gamma,neg,self,abs,inc,dec,floor,ciel,sign
lTerminators=:lTerminators,mul2,mul3,mul5,mul7,mul10,mul11,mul13,div2,div3,div5,div7
lTerminators=:lTerminators,add1r2,add1r3,add2,add3,add4,add5,add6,add7,add8,add9,add10
NB. FOR MULTDIMENSIONAL INPUTS
sumM=: ([: (+/) ])`''
prodM=: ([: (*/) ])`''
subM=: ([: (-/) ])`''
select=: 3 : 0"0
(y&{"1@:])`''
)
setAllowedOperators=: 3 : 0
ops=. tolower y
all=: ''
frq=:''
if. 'b' e. ops do.
all=: all,sub,plus,div,mult,neg,self,left,kill
frq=: frq, 2, 2, 2, 2, 2, 2, 2, 4
all=: all,mul2,mul3,mul5,mul7,mul10,mul11,mul13
frq=: frq,1, 1, 1, 1, 1, 1, 1
all=: all,div2,div3,div5,div7
frq=: frq,1 ,1 ,1 ,1
all=: all,inc,dec,add1r2,add1r3,add2,add3,add4,add5,add6,add7,add8,add9,add10
frq=: frq,1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
end.
if. 't' e. ops do.
all=: all,sin,cos,tan
frq=: frq,2,2,2
end.
if. 'T' e. ops do.
all=: all,arcsin,arccos,arctan
frq=:frq,1,1,1
end.
if. 'h' e. ops do.
all=: all,sinh,cosh,tanh
frq=: frq,1,1,1
end.
if. 'H' e. ops do.
all=: all,arcsinh,arccosh,arctanh
frq=: frq,1,1,1
end.
if. 'g' e. ops do.
all=: all,gamma
frq=:frq,1
end.
if. 'p' e. ops do.
all=: all,pow,square,cube,quart,quint,sext,sept
frq=: frq,2,2,2,1,1,1,1
end.
if. 'e' e. ops do.
all=: all,exp
frq=: frq,2
end.
if. 'l' e. ops do.
all=: all, log
frq=: frq,1
end.
if. 'L' e. ops do.
all=: all, log10
frq=: frq,1
end.
if. 'a' e. ops do.
all=: all,abs
frq=: frq,2
end.
if. 'r' e. ops do.
all=: all,sqr,root
frq=: frq,2,1
end.
if. 'm' e. ops do.
all=: all,mod
frq=: frq,1
end.
if. 'i' e. ops do.
all=: all,floor,ciel,sign
frq=: frq,1,1,1
end.
if. all-:''do.
throw. 'There are no allowed operators.'
end.
if. dims > 1 do.
all=: all,sumM,prodM,subM
frq=: frq,4,3,4
NB.all=: all,,select i. dims
NB.frq=: frq,,
end.
all
)
NB. Creates a Symbolic Regressor instance.
NB. Parameters:
NB. 0: input values.
NB. 1: target values. The fitness (cost) function
NB. will be measured against these values.
NB. 2: Population size, the number of chromsomes to
NB. use in the algorithm.
NB. 3: chromosome length. This is the number of operators
NB. per chromosome.
NB. 4: operators. Allowed operators. THis should be
NB. a stirng literal containing some of:
NB. 'b': to allow basic operations +-*%
NB. 't': to allow basic trig ops sin,cos,tan
NB. 'T': to allow inverse trig ops asin,acos,atan
NB. 'h': to allow hyp trig ops sinh,cosh,tanh
NB. 'H': to allow inv hyp trig ops asinh,acosh,atanh
NB. 'g': to allow gamma (factorial) op !
NB. 'p': to allow power ops ^2,^3,^4,..
NB. 'e': to allow exponential op (base e) ^
NB. 'l': to allow natural log ops ^.
NB. 'L': to allow base10 log ops 10^.
NB. 'a': to allow absolute op |
NB. 'r': to allow root ops %:
NB. 'm': to allow mod op |
NB. 'i': to allow integer ops, floor, cieling,sign <:>:*
create=: 3 : 0
'input targets popSize cLen operators'=: y
g=. ?@:(cLen&#)"0 0@:(popSize&#)@:# { (i.@:#)
if. 1=#$input do.
dims=: 1
else.
dims=: {:$ input
end.
all=: setAllowedOperators operators
chromo=: ;/g all=:frq # all
)
chromosomes=: 3 : 0
chromo
)
populationSize=: 3 : 0
popSize
)
chromosomeLength=: 3 : 0
cLen
)
elongateChromosomes=: 3 : 0
alen=. #all
select=: 3 : '?alen[y'
chromo=: (,select)&.> chromo
)
requestChange=: 3 : 0
g=. ?@:(cLen&#)"0 0@:(popSize&#)@:# { (i.@:#)
newChromo=: ;/g all
hp=. i.>.-:popSize
chromo=: (y{~hp) hp}newChromo
chromo
)
newSequence=: 3 : 0
g=. ?@:(cLen&#)"0 0@:(popSize&#)@:# { (i.@:#)
chromo=: ;/g all
chromo
)
NB. Cost function runs on individual chromosomes
NB. of the current solution set. Each chromosome
NB. is transformed into a verb and run on the input
NB. data. The absolute difference between target
NB. and input is returned.
NB. Positive Infinity (_) can be returned in case of
NB. a thrown exception or, if the dimensionality of
NB. the input set is greater than 1 and the output
NB. value is not a single value. If the returned
NB. value is 'complex' then infinity is also returned.
NB. Parameters:
NB. 0: single chromosome, boxed list of integers, where
NB. each integer is the index of the corresponding
NB. verb in the gerund list.
NB. returns:
NB. cost function, in range (0,_). (0 is best)
cost=: 3 : 0"0
f=: all{~ >y
func=: f`:6
diff=. _
try.
res=. func"1 input
if. 0 < +/ 1e200 < res do.
diff=. _
else.
diff=. | (,targets) -res
if. 1< #$ diff do.
diff=. _
elseif.
'complex' -: datatype res do.
diff=. _
end.
end.
catch.
diff=. _
catcht.
diff=. _
catchd.
diff=. _
end.
if. 1 e. ~:~ diff do. diff=. _ end. NB. in case of _.
(+/ % #) diff
)
destroy=: codestroy
Note 'todo'
(I.@:(6&=) {. ])&:>best NB. (here 6 is the index in all that [`'' has)
) | J | 4 | jonghough/jlearn | genetic/symreg.ijs | [
"MIT"
]
|
interface IStringDictionary<V> {
[name: string]: V;
}
interface INumberDictionary<V> {
[idx: number]: V;
}
declare function forEach<T>(from: IStringDictionary<T> | INumberDictionary<T>, callback: (entry: { key: any; value: T; }, remove: () => void) => any);
let count = 0;
forEach({ toString: 123 }, () => count++);
| TypeScript | 3 | monciego/TypeScript | tests/cases/compiler/unionExcessPropertyCheckNoApparentPropTypeMismatchErrors.ts | [
"Apache-2.0"
]
|
From 5c53f32b401baffb4c6dc896ca07beff2add2a42 Mon Sep 17 00:00:00 2001
From: Ali Mohammad Pur <[email protected]>
Date: Fri, 9 Jul 2021 05:32:00 +0430
Subject: [PATCH 7/7] build: Add platform-specific stubs and implementations
---
CMakeLists.txt | 2 +
src/unix/serenity-core.c | 137 +++++++++++++++++++++++++++++++++++++++
2 files changed, 139 insertions(+)
create mode 100644 src/unix/serenity-core.c
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f30ec26..6f0bf0c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -365,9 +365,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "SerenityOS")
src/unix/posix-poll.c
src/unix/no-fsevents.c
src/unix/no-proctitle.c
+ src/unix/serenity-core.c
)
list(APPEND uv_libraries
dl
+ pthread
)
endif()
diff --git a/src/unix/serenity-core.c b/src/unix/serenity-core.c
new file mode 100644
index 0000000..821cf37
--- /dev/null
+++ b/src/unix/serenity-core.c
@@ -0,0 +1,137 @@
+#include "uv.h"
+#include "internal.h"
+
+#include <errno.h>
+#include <stddef.h>
+
+#include <net/if.h>
+#include <unistd.h>
+
+static int uv__ifaddr_exclude(void *ent, int exclude_type) {
+ return 1;
+}
+
+int uv_interface_addresses(uv_interface_address_t** addresses, int* count) {
+ *count = 0;
+ *addresses = NULL;
+ return UV_ENOSYS;
+}
+
+
+void uv_free_interface_addresses(uv_interface_address_t* addresses,
+ int count) {
+ int i;
+
+ for (i = 0; i < count; i++) {
+ uv__free(addresses[i].name);
+ }
+
+ uv__free(addresses);
+}
+
+static int uv__slurp(const char* filename, char* buf, size_t len) {
+ ssize_t n;
+ int fd;
+
+ assert(len > 0);
+
+ fd = uv__open_cloexec(filename, O_RDONLY);
+ if (fd < 0)
+ return fd;
+
+ do
+ n = read(fd, buf, len - 1);
+ while (n == -1 && errno == EINTR);
+
+ if (uv__close_nocheckstdio(fd))
+ abort();
+
+ if (n < 0)
+ return UV__ERR(errno);
+
+ buf[n] = '\0';
+
+ return 0;
+}
+
+
+static uint64_t uv__read_proc_memstat(const char* what) {
+ uint64_t rc;
+ char* p;
+ char buf[4096]; /* Large enough to hold all of /proc/memstat. */
+
+ if (uv__slurp("/proc/memstat", buf, sizeof(buf)))
+ return 0;
+
+ p = strstr(buf, what);
+
+ if (p == NULL)
+ return 0;
+
+ p += strlen(what);
+
+ rc = 0;
+ sscanf(p, "%" PRIu64, &rc);
+
+ return rc;
+}
+
+uint64_t uv_get_free_memory(void) {
+ return uv__read_proc_memstat("user_physical_available\":") * PAGE_SIZE;
+}
+
+
+uint64_t uv_get_total_memory(void) {
+ return (uv__read_proc_memstat("user_physical_allocated\":") + uv__read_proc_memstat("user_physical_available\":")) * PAGE_SIZE;
+}
+
+void uv_loadavg(double avg[3]) {
+ avg[0] = 0.0f;
+ avg[1] = 0.0f;
+ avg[2] = 0.0f;
+}
+
+int uv_uptime(double* uptime) {
+ char buf[128];
+ struct timespec now;
+ int r;
+
+ /* Try /proc/uptime first, then fallback to clock_gettime(). */
+
+ if (0 == uv__slurp("/proc/uptime", buf, sizeof(buf)))
+ if (1 == sscanf(buf, "%lf", uptime))
+ return 0;
+
+ r = clock_gettime(CLOCK_MONOTONIC, &now);
+ if (r)
+ return UV__ERR(errno);
+
+ *uptime = now.tv_sec;
+ return 0;
+}
+
+uint64_t uv_get_constrained_memory(void) {
+ return 0;
+}
+
+int uv_cpu_info(uv_cpu_info_t** cpu_infos, int* count) {
+ *cpu_infos = NULL;
+ *count = 0;
+ return 0;
+}
+
+int uv_exepath(char* buffer, size_t* size) {
+ if (buffer == NULL || size == NULL || *size == 0)
+ return UV_EINVAL;
+
+ int rc = readlink("/proc/self/exe", buffer, *size);
+ if (rc < 0)
+ return UV__ERR(errno);
+ *size = rc;
+ return 0;
+}
+
+int uv_resident_set_memory(size_t* rss) {
+ *rss = 0;
+ return 0;
+}
--
2.32.0
| Diff | 4 | r00ster91/serenity | Ports/libuv/patches/0007-build-Add-platform-specific-stubs-and-implementation.patch | [
"BSD-2-Clause"
]
|
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import "RCTLogBox.h"
#import <FBReactNativeSpec/FBReactNativeSpec.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTLog.h>
#import <React/RCTRedBoxSetEnabled.h>
#import <React/RCTSurface.h>
#import "CoreModulesPlugins.h"
#if RCT_DEV_MENU
@interface RCTLogBox () <NativeLogBoxSpec, RCTBridgeModule>
@end
@implementation RCTLogBox {
RCTLogBoxView *_view;
}
@synthesize bridge = _bridge;
RCT_EXPORT_MODULE()
+ (BOOL)requiresMainQueueSetup
{
return YES;
}
RCT_EXPORT_METHOD(show)
{
if (RCTRedBoxGetEnabled()) {
__weak RCTLogBox *weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
__strong RCTLogBox *strongSelf = weakSelf;
if (!strongSelf) {
return;
}
if (strongSelf->_view) {
[strongSelf->_view show];
return;
}
if (strongSelf->_bridge) {
if (strongSelf->_bridge.valid) {
strongSelf->_view = [[RCTLogBoxView alloc] initWithFrame:[UIScreen mainScreen].bounds
bridge:strongSelf->_bridge];
[strongSelf->_view show];
}
} else {
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:strongSelf, @"logbox", nil];
[[NSNotificationCenter defaultCenter] postNotificationName:@"CreateLogBoxSurface" object:nil userInfo:userInfo];
}
});
}
}
RCT_EXPORT_METHOD(hide)
{
if (RCTRedBoxGetEnabled()) {
__weak RCTLogBox *weakSelf = self;
dispatch_async(dispatch_get_main_queue(), ^{
__strong RCTLogBox *strongSelf = weakSelf;
if (!strongSelf) {
return;
}
[strongSelf->_view setHidden:YES];
strongSelf->_view = nil;
});
}
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return std::make_shared<facebook::react::NativeLogBoxSpecJSI>(params);
}
- (void)setRCTLogBoxView:(RCTLogBoxView *)view
{
self->_view = view;
}
@end
#else // Disabled
@interface RCTLogBox () <NativeLogBoxSpec>
@end
@implementation RCTLogBox
+ (NSString *)moduleName
{
return nil;
}
- (void)show
{
// noop
}
- (void)hide
{
// noop
}
- (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
(const facebook::react::ObjCTurboModule::InitParams &)params
{
return std::make_shared<facebook::react::NativeLogBoxSpecJSI>(params);
}
@end
#endif
Class RCTLogBoxCls(void)
{
return RCTLogBox.class;
}
| Objective-C++ | 4 | MikeyAlmighty/react-native | React/CoreModules/RCTLogBox.mm | [
"CC-BY-4.0",
"MIT"
]
|
open import Agda.Primitive
f : ∀ {a b c} → Set a → Set b → Set c → Set {!!} -- WAS solution: (a ⊔ (b ⊔ c))
f A B C = A → B → C -- NOW: (a ⊔ b ⊔ c)
| Agda | 3 | cruhland/agda | test/interaction/Issue3441.agda | [
"MIT"
]
|
// space robacks
// background hsv(210,255,255)
palette $f
50 red
25 orange
25 yellow
end
color red
move -4,-4,-10
scale 0.5
DECAY: 0.05
//rotate map(wave(1000),0,1,80,110), 0,1,0
rotate 270, 0,1,0
for i: 0 to 10 step 1
push
z: map(wave(5000), 0,1, -30,0)
noise_y: noise(i,1)
noise_z: noise(i,2)
spread: map(wave(2000), 0,1, 10,30)
move 0,noise_y*(spread/4)+2,(noise_z*spread) + z
noise_w1: noise(i, 5)
noise_w2: noise(i, 6)
noise_w3: noise(i, 7)
w1: map(noise_w1, 0,1, 1000,4000)
w2: map(noise_w2, 0,1, 50,300)
w3: map(noise_w3, 0,1, 700,1500)
move (wave(w1)*10),wave(w2) + ((wave(w3)*6) - 3)
particle 0.5
color hsv(map(HEALTH,1,0, 100,200), 255, map(HEALTH, 0,1, 0,200))
ball HEALTH*0.5
end
pop
end
| Cycript | 3 | marcinbiegun/creativecoding-sketches | Cyril/data/code_horizon/7.cy | [
"MIT"
]
|
/*
* 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.
*/
/*
* Copyright (c) 2020, OPEN AI LAB
* Author: [email protected]
*/
#include "../../precomp.hpp"
#include <iostream>
#include <vector>
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/core/utils/logger.hpp>
#include "../include/tengine_graph_convolution.hpp"
#ifdef HAVE_TENGINE
#include "tengine_c_api.h"
namespace cv
{
namespace dnn
{
static int create_input_node(teng_graph_t graph, const char* node_name, int inch, int in_h, int in_w)
{
node_t node = teng_create_graph_node(graph, node_name, "InputOp");
tensor_t tensor = teng_create_graph_tensor(graph, node_name, TENGINE_DT_FP32);
teng_set_node_output_tensor(node, 0, tensor, TENSOR_TYPE_INPUT);
int dims[4] = {1, inch, in_h, in_w};
teng_set_tensor_shape(tensor, dims, 4);
teng_release_graph_tensor(tensor);
teng_release_graph_node(node);
return 0;
}
static int create_conv_node(teng_graph_t graph, const char* node_name, const char* input_name, int in_h, int in_w, int out_h, int out_w,
int kernel_h, int kernel_w, int stride_h, int stride_w, int pad_h, int pad_w, int inch, int outch, int group,
int dilation_h, int dilation_w, int activation, std::string padMode)
{
node_t conv_node = teng_create_graph_node(graph, node_name, "Convolution");
tensor_t input_tensor = teng_get_graph_tensor(graph, input_name);
if (input_tensor == NULL)
{
CV_LOG_WARNING(NULL,"Tengine: input_tensor is NULL." );
return -1;
}
teng_set_node_input_tensor(conv_node, 0, input_tensor);
teng_release_graph_tensor(input_tensor);
/* output */
tensor_t output_tensor = teng_create_graph_tensor(graph, node_name, TENGINE_DT_FP32);
teng_set_node_output_tensor(conv_node, 0, output_tensor, TENSOR_TYPE_VAR);
teng_release_graph_tensor(output_tensor);
/* weight */
std::string weight_name(node_name);
weight_name += "/weight";
node_t w_node = teng_create_graph_node(graph, weight_name.c_str(), "Const");
tensor_t w_tensor = teng_create_graph_tensor(graph, weight_name.c_str(), TENGINE_DT_FP32);
teng_set_node_output_tensor(w_node, 0, w_tensor, TENSOR_TYPE_CONST);
teng_set_node_input_tensor(conv_node, 1, w_tensor);
int w_dims[] = {outch, inch / group, kernel_h, kernel_w};
teng_set_tensor_shape(w_tensor, w_dims, 4);
teng_release_graph_node(w_node);
teng_release_graph_tensor(w_tensor);
/* bias */
std::string bias_name(node_name);
bias_name += "/bias";
node_t b_node = teng_create_graph_node(graph, bias_name.c_str(), "Const");
tensor_t b_tensor = teng_create_graph_tensor(graph, bias_name.c_str(), TENGINE_DT_FP32);
teng_set_node_output_tensor(b_node, 0, b_tensor, TENSOR_TYPE_CONST);
int b_dims[] = {outch};
teng_set_tensor_shape(b_tensor, b_dims, 1);
teng_set_node_input_tensor(conv_node, 2, b_tensor);
teng_release_graph_node(b_node);
teng_release_graph_tensor(b_tensor);
int pad_h1 = pad_h;
int pad_w1 = pad_w;
if (!padMode.empty())
{
if (padMode == "SAME")
{
int out_h_temp = (in_h-kernel_h + 2*pad_h)/stride_h + 1;
int out_w_temp = (in_w-kernel_w + 2*pad_w)/stride_w + 1;
if (out_h_temp < out_h)
pad_h1 += 1;
if (out_w_temp < out_w)
pad_w1 += 1;
}
}
/* attr */
teng_set_node_attr_int(conv_node, "kernel_h", &kernel_h);
teng_set_node_attr_int(conv_node, "kernel_w", &kernel_w);
teng_set_node_attr_int(conv_node, "stride_h", &stride_h);
teng_set_node_attr_int(conv_node, "stride_w", &stride_w);
teng_set_node_attr_int(conv_node, "pad_h0", &pad_h);
teng_set_node_attr_int(conv_node, "pad_w0", &pad_w);
teng_set_node_attr_int(conv_node, "pad_h1", &pad_h1);
teng_set_node_attr_int(conv_node, "pad_w1", &pad_w1);
teng_set_node_attr_int(conv_node, "output_channel", &outch);
teng_set_node_attr_int(conv_node, "input_channel", &inch);
teng_set_node_attr_int(conv_node, "group", &group);
teng_set_node_attr_int(conv_node, "dilation_h", &dilation_h);
teng_set_node_attr_int(conv_node, "dilation_w", &dilation_w);
// set_node_attr_int(conv_node, "activation", &activation);
teng_release_graph_node(conv_node);
return 0;
}
static teng_graph_t create_conv_graph(const char* layer_name, float* input_data, int inch, int group, int in_h, int in_w,
float* output_data, int outch, int out_h, int out_w,
int kernel_h, int kernel_w,
int stride_h,int stride_w,
int pad_h, int pad_w, int dilation_h, int dilation_w, int activation,
float* teg_weight, float* teg_bias, std::string padMode, int nstripes)
{
node_t conv_node = NULL;
tensor_t input_tensor = NULL;
tensor_t output_tensor = NULL;
tensor_t weight_tensor = NULL;
tensor_t bias_tensor = NULL;
/* create graph for convolution */
int in_size = in_h * in_w * inch;
int out_size = out_h * out_w * outch;
int weight_size = outch * (inch / group) * kernel_w * kernel_h;
int bias_size = outch;
int buf_size = 0;
int input_num = 0;
/* create graph */
teng_graph_t graph = teng_create_graph(NULL, NULL, NULL);
bool ok = true;
if(graph == NULL)
{
CV_LOG_WARNING(NULL,"Tengine: create_graph failed." );
ok = false;
}
const char* input_name = "data";
const char* conv_name = layer_name;
if (ok && create_input_node(graph, input_name, inch, in_h, in_w) < 0)
{
CV_LOG_WARNING(NULL,"Tengine: create_input_node failed." );
ok = false;
}
if (ok && create_conv_node(graph, conv_name, input_name, in_h, in_w, out_h, out_w, kernel_h, kernel_w,
stride_h, stride_w, pad_h, pad_w, inch, outch, group, dilation_h, dilation_w, activation, padMode) < 0)
{
CV_LOG_WARNING(NULL,"Tengine: create conv node failed." );
ok = false;
}
/* set input/output node */
const char* inputs_name[] = {input_name};
const char* outputs_name[] = {conv_name};
if (ok && teng_set_graph_input_node(graph, inputs_name, sizeof(inputs_name) / sizeof(char*)) < 0)
{
CV_LOG_WARNING(NULL,"Tengine: set inputs failed." );
ok = false;
}
if (ok && teng_set_graph_output_node(graph, outputs_name, sizeof(outputs_name) / sizeof(char*)) < 0)
{
CV_LOG_WARNING(NULL,"Tengine: set outputs failed." );
ok = false;
}
/* set input data */
if (ok)
{
input_tensor = teng_get_graph_input_tensor(graph, 0, 0);
buf_size = teng_get_tensor_buffer_size(input_tensor);
if (buf_size != in_size * FLOAT_TO_REALSIZE)
{
CV_LOG_WARNING(NULL,"Tengine: Input data size check failed.");
ok = false;
}
}
if (ok)
{
teng_set_tensor_buffer(input_tensor, (float *)input_data, buf_size);
teng_release_graph_tensor(input_tensor);
/* create convolution node */
/* set weight node */
conv_node = teng_get_graph_node(graph, conv_name);
weight_tensor = teng_get_node_input_tensor(conv_node, 1);
buf_size = teng_get_tensor_buffer_size(weight_tensor);
if (buf_size != weight_size * FLOAT_TO_REALSIZE)
{
CV_LOG_WARNING(NULL,"Tengine: Input weight size check failed.");
ok = false;
}
}
if (ok)
{
teng_set_tensor_buffer(weight_tensor, teg_weight, buf_size);
/* set bias node */
input_num = teng_get_node_input_number(conv_node);
if (input_num > 2)
{
bias_tensor = teng_get_node_input_tensor(conv_node, 2);
buf_size = teng_get_tensor_buffer_size(bias_tensor);
if (buf_size != bias_size * FLOAT_TO_REALSIZE)
{
CV_LOG_WARNING(NULL,"Tengine: Input bias size check failed.");
ok = false;
}
else teng_set_tensor_buffer(bias_tensor, teg_bias, buf_size);
}
}
/* prerun */
if (ok && teng_prerun_graph_multithread(graph, TENGINE_CLUSTER_BIG, nstripes) < 0)
{
CV_LOG_WARNING(NULL, "Tengine: prerun_graph failed.");
ok = false;
}
if (ok)
{
/* set output data */
output_tensor = teng_get_node_output_tensor(conv_node, 0);
int ret = teng_set_tensor_buffer(output_tensor, output_data, out_size * FLOAT_TO_REALSIZE);
if(ret)
{
CV_LOG_WARNING(NULL,"Tengine: Set output tensor buffer failed." );
ok = false;
}
}
if (false == ok)
{
teng_destroy_graph(graph) ;
return NULL ;
}
return graph;
}
static bool tengine_init_flag = false;
teng_graph_t tengine_init(const char* layer_name, float* input_, int inch, int group, int in_h, int in_w,
float *output_, int out_b, int outch, int out_h, int out_w,
float *kernel_, int kernel_s ,int kernel_h, int kernel_w,
float *teg_bias, int stride_h,int stride_w,
int pad_h, int pad_w, int dilation_h, int dilation_w,
size_t wstep, const std::string padMode, teng_graph_t &graph, int nstripes)
{
std::vector<float> teg_weight_vec;
float *teg_weight = NULL;
int kernel_inwh = (inch / group) * kernel_w * kernel_h;
// Do not using the activation fuse mode, just convolution only.
int activation = -1;
if (!(kernel_s == 2 && kernel_h == kernel_w && pad_h == pad_w
&& dilation_h == dilation_w && stride_h == stride_w
&& out_b == 1 && pad_h < 10)) // just for Conv2D
{
// printf("return : just for Conv2D\n");
return NULL;
}
{
/* printf("Tengine(%s): input (1 x %d x %d x %d),output (%d x %d x %d x %d), kernel (%d x %d), stride (%d x %d), dilation (%d x %d), pad (%d x %d).\n",
layer_name, inch, in_h, in_w,
out_b, outch, out_h, out_w,
kernel_w, kernel_h,
stride_w, stride_h,
dilation_w, dilation_h,
pad_w, pad_h);
*/
// weight
if (kernel_inwh != wstep)
{
teg_weight_vec.resize(kernel_inwh * outch);
teg_weight = &teg_weight_vec[0];
for (int i=0; i<outch; i++)
{
memcpy(teg_weight+i*kernel_inwh, kernel_+i*wstep, kernel_inwh*FLOAT_TO_REALSIZE);
}
}
else
{
teg_weight = kernel_;
}
/* initial the resoruce of tengine */
if(false == tengine_init_flag)
{
init_tengine();
tengine_init_flag = true;
}
/* create the convolution graph */
graph = create_conv_graph(layer_name, input_, inch, group, in_h, in_w,
output_, outch, out_h, out_w,
kernel_h, kernel_w, stride_h,stride_w,
pad_h, pad_w, dilation_h, dilation_w, activation,
teg_weight, teg_bias, padMode, nstripes);
if(NULL == graph )
{
return NULL;
}
}
return graph ;
}
bool tengine_forward(teng_graph_t &graph)
{
/* run */
if(teng_run_graph(graph, 1) < 0)
{
CV_LOG_WARNING(NULL,"Tengine: run_graph failed.");
return false ;
}
return true;
}
bool tengine_release(teng_graph_t &graph)
{
teng_postrun_graph(graph);
teng_destroy_graph(graph);
return true;
}
}
}
#endif
| C++ | 5 | lefatoum2/opencv | modules/dnn/src/tengine4dnn/src/tengine_graph_convolution.cpp | [
"Apache-2.0"
]
|
// Copyright (c) 2019 The BFE Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Copyright 2013 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
%{
package parser
import (
"fmt"
"go/token"
)
%}
%union {
Node Node
str string
}
%token IDENT LAND LOR LPAREN RPAREN NOT SEMICOLON BASICLIT COMMA BOOL STRING INT FLOAT IMAG COMMENT ILLEGAL
%left LAND
%left LOR
%right NOT
%%
top:
expr
{
parseNode = $1.Node
}
expr:
LPAREN expr RPAREN
{
$$.Node = &ParenExpr{$2.Node.(Expr)}
}
| expr LAND expr
{
$$.Node = &BinaryExpr{$1.Node.(Expr), LAND, $3.Node.(Expr)}
}
| expr LOR expr
{
$$.Node = &BinaryExpr{$1.Node.(Expr), LOR, $3.Node.(Expr)}
}
| NOT expr
{
$$.Node = &UnaryExpr{$2.Node.(Expr), NOT, lastTokenPos}
}
| callExpr
{
$$.Node = $1.Node
}
| IDENT
{
$$.Node = $1.Node
}
callExpr:
IDENT LPAREN paramlist RPAREN
{
$$.Node = &CallExpr{$1.Node.(*Ident), $3.Node.(BasicLitList), lastPos}
}
| IDENT LPAREN RPAREN
{
$$.Node = &CallExpr{$1.Node.(*Ident), nil, lastPos}
}
paramlist:
BASICLIT
{
$$.Node = BasicLitList{$1.Node.(*BasicLit)}
}
| paramlist COMMA BASICLIT
{
$$.Node = append($1.Node.(BasicLitList), $3.Node.(*BasicLit))
}
%%
// The parser expects the lexer to return 0 on EOF. Give it a name
// for clarity.
const EOF = 0
var (
parseNode Node // save parse node
lastPos token.Pos
lastTokenPos token.Pos
)
// The parser uses the type <prefix>Lex as a lexer. It must provide
// the methods Lex(*<prefix>SymType) int and Error(string).
type condLex struct {
s *Scanner
err ErrorHandler
}
// The parser calls this method to get each new token.
func (x *condLex) Lex(yylval *condSymType) int {
for {
pos, tok, lit := x.s.Scan()
lastPos = pos
// fmt.Printf("got token %s %s\n", tok, lit)
switch tok {
case EOF:
return EOF
case IDENT:
yylval.Node = &Ident{Name:lit, NamePos: pos}
return IDENT
case BOOL, STRING, INT:
yylval.Node = &BasicLit{Kind:tok, Value:lit, ValuePos: pos}
return BASICLIT
case LPAREN, RPAREN, LAND, LOR, SEMICOLON, COMMA, NOT:
lastTokenPos = pos
return int(tok)
default:
x.Error(fmt.Sprintf("unrecognized token %d", tok))
return EOF
}
}
}
// The parser calls this method on a parse error.
func (x *condLex) Error(s string) {
if x.err != nil {
x.err(lastPos, s)
}
}
| Yacc | 5 | blinkbean/bfe | bfe_basic/condition/parser/cond.y | [
"Apache-2.0"
]
|
### Compilation failed:
error: 1: variables of type 'sampler' must be global
1 error
| Metal | 0 | vibeus/skia | tests/sksl/metal/OpaqueTypeInInterfaceBlock.metal | [
"BSD-3-Clause"
]
|
.INITVAL_00($sformatf("0x%05120x", permute_init(INIT[0 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_01($sformatf("0x%05120x", permute_init(INIT[1 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_02($sformatf("0x%05120x", permute_init(INIT[2 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_03($sformatf("0x%05120x", permute_init(INIT[3 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_04($sformatf("0x%05120x", permute_init(INIT[4 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_05($sformatf("0x%05120x", permute_init(INIT[5 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_06($sformatf("0x%05120x", permute_init(INIT[6 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_07($sformatf("0x%05120x", permute_init(INIT[7 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_08($sformatf("0x%05120x", permute_init(INIT[8 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_09($sformatf("0x%05120x", permute_init(INIT[9 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_0A($sformatf("0x%05120x", permute_init(INIT[10 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_0B($sformatf("0x%05120x", permute_init(INIT[11 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_0C($sformatf("0x%05120x", permute_init(INIT[12 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_0D($sformatf("0x%05120x", permute_init(INIT[13 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_0E($sformatf("0x%05120x", permute_init(INIT[14 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_0F($sformatf("0x%05120x", permute_init(INIT[15 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_10($sformatf("0x%05120x", permute_init(INIT[16 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_11($sformatf("0x%05120x", permute_init(INIT[17 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_12($sformatf("0x%05120x", permute_init(INIT[18 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_13($sformatf("0x%05120x", permute_init(INIT[19 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_14($sformatf("0x%05120x", permute_init(INIT[20 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_15($sformatf("0x%05120x", permute_init(INIT[21 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_16($sformatf("0x%05120x", permute_init(INIT[22 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_17($sformatf("0x%05120x", permute_init(INIT[23 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_18($sformatf("0x%05120x", permute_init(INIT[24 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_19($sformatf("0x%05120x", permute_init(INIT[25 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_1A($sformatf("0x%05120x", permute_init(INIT[26 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_1B($sformatf("0x%05120x", permute_init(INIT[27 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_1C($sformatf("0x%05120x", permute_init(INIT[28 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_1D($sformatf("0x%05120x", permute_init(INIT[29 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_1E($sformatf("0x%05120x", permute_init(INIT[30 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_1F($sformatf("0x%05120x", permute_init(INIT[31 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_20($sformatf("0x%05120x", permute_init(INIT[32 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_21($sformatf("0x%05120x", permute_init(INIT[33 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_22($sformatf("0x%05120x", permute_init(INIT[34 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_23($sformatf("0x%05120x", permute_init(INIT[35 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_24($sformatf("0x%05120x", permute_init(INIT[36 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_25($sformatf("0x%05120x", permute_init(INIT[37 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_26($sformatf("0x%05120x", permute_init(INIT[38 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_27($sformatf("0x%05120x", permute_init(INIT[39 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_28($sformatf("0x%05120x", permute_init(INIT[40 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_29($sformatf("0x%05120x", permute_init(INIT[41 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_2A($sformatf("0x%05120x", permute_init(INIT[42 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_2B($sformatf("0x%05120x", permute_init(INIT[43 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_2C($sformatf("0x%05120x", permute_init(INIT[44 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_2D($sformatf("0x%05120x", permute_init(INIT[45 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_2E($sformatf("0x%05120x", permute_init(INIT[46 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_2F($sformatf("0x%05120x", permute_init(INIT[47 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_30($sformatf("0x%05120x", permute_init(INIT[48 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_31($sformatf("0x%05120x", permute_init(INIT[49 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_32($sformatf("0x%05120x", permute_init(INIT[50 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_33($sformatf("0x%05120x", permute_init(INIT[51 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_34($sformatf("0x%05120x", permute_init(INIT[52 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_35($sformatf("0x%05120x", permute_init(INIT[53 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_36($sformatf("0x%05120x", permute_init(INIT[54 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_37($sformatf("0x%05120x", permute_init(INIT[55 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_38($sformatf("0x%05120x", permute_init(INIT[56 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_39($sformatf("0x%05120x", permute_init(INIT[57 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_3A($sformatf("0x%05120x", permute_init(INIT[58 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_3B($sformatf("0x%05120x", permute_init(INIT[59 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_3C($sformatf("0x%05120x", permute_init(INIT[60 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_3D($sformatf("0x%05120x", permute_init(INIT[61 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_3E($sformatf("0x%05120x", permute_init(INIT[62 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_3F($sformatf("0x%05120x", permute_init(INIT[63 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_40($sformatf("0x%05120x", permute_init(INIT[64 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_41($sformatf("0x%05120x", permute_init(INIT[65 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_42($sformatf("0x%05120x", permute_init(INIT[66 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_43($sformatf("0x%05120x", permute_init(INIT[67 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_44($sformatf("0x%05120x", permute_init(INIT[68 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_45($sformatf("0x%05120x", permute_init(INIT[69 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_46($sformatf("0x%05120x", permute_init(INIT[70 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_47($sformatf("0x%05120x", permute_init(INIT[71 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_48($sformatf("0x%05120x", permute_init(INIT[72 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_49($sformatf("0x%05120x", permute_init(INIT[73 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_4A($sformatf("0x%05120x", permute_init(INIT[74 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_4B($sformatf("0x%05120x", permute_init(INIT[75 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_4C($sformatf("0x%05120x", permute_init(INIT[76 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_4D($sformatf("0x%05120x", permute_init(INIT[77 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_4E($sformatf("0x%05120x", permute_init(INIT[78 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_4F($sformatf("0x%05120x", permute_init(INIT[79 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_50($sformatf("0x%05120x", permute_init(INIT[80 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_51($sformatf("0x%05120x", permute_init(INIT[81 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_52($sformatf("0x%05120x", permute_init(INIT[82 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_53($sformatf("0x%05120x", permute_init(INIT[83 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_54($sformatf("0x%05120x", permute_init(INIT[84 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_55($sformatf("0x%05120x", permute_init(INIT[85 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_56($sformatf("0x%05120x", permute_init(INIT[86 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_57($sformatf("0x%05120x", permute_init(INIT[87 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_58($sformatf("0x%05120x", permute_init(INIT[88 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_59($sformatf("0x%05120x", permute_init(INIT[89 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_5A($sformatf("0x%05120x", permute_init(INIT[90 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_5B($sformatf("0x%05120x", permute_init(INIT[91 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_5C($sformatf("0x%05120x", permute_init(INIT[92 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_5D($sformatf("0x%05120x", permute_init(INIT[93 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_5E($sformatf("0x%05120x", permute_init(INIT[94 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_5F($sformatf("0x%05120x", permute_init(INIT[95 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_60($sformatf("0x%05120x", permute_init(INIT[96 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_61($sformatf("0x%05120x", permute_init(INIT[97 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_62($sformatf("0x%05120x", permute_init(INIT[98 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_63($sformatf("0x%05120x", permute_init(INIT[99 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_64($sformatf("0x%05120x", permute_init(INIT[100 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_65($sformatf("0x%05120x", permute_init(INIT[101 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_66($sformatf("0x%05120x", permute_init(INIT[102 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_67($sformatf("0x%05120x", permute_init(INIT[103 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_68($sformatf("0x%05120x", permute_init(INIT[104 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_69($sformatf("0x%05120x", permute_init(INIT[105 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_6A($sformatf("0x%05120x", permute_init(INIT[106 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_6B($sformatf("0x%05120x", permute_init(INIT[107 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_6C($sformatf("0x%05120x", permute_init(INIT[108 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_6D($sformatf("0x%05120x", permute_init(INIT[109 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_6E($sformatf("0x%05120x", permute_init(INIT[110 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_6F($sformatf("0x%05120x", permute_init(INIT[111 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_70($sformatf("0x%05120x", permute_init(INIT[112 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_71($sformatf("0x%05120x", permute_init(INIT[113 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_72($sformatf("0x%05120x", permute_init(INIT[114 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_73($sformatf("0x%05120x", permute_init(INIT[115 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_74($sformatf("0x%05120x", permute_init(INIT[116 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_75($sformatf("0x%05120x", permute_init(INIT[117 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_76($sformatf("0x%05120x", permute_init(INIT[118 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_77($sformatf("0x%05120x", permute_init(INIT[119 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_78($sformatf("0x%05120x", permute_init(INIT[120 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_79($sformatf("0x%05120x", permute_init(INIT[121 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_7A($sformatf("0x%05120x", permute_init(INIT[122 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_7B($sformatf("0x%05120x", permute_init(INIT[123 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_7C($sformatf("0x%05120x", permute_init(INIT[124 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_7D($sformatf("0x%05120x", permute_init(INIT[125 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_7E($sformatf("0x%05120x", permute_init(INIT[126 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
.INITVAL_7F($sformatf("0x%05120x", permute_init(INIT[127 * INIT_CHUNK_SIZE +: INIT_CHUNK_SIZE]))),
| SystemVerilog | 3 | gudeh/yosys | techlibs/nexus/lrams_init.vh | [
"ISC"
]
|
/********************************************************************************
* Copyright (c) {date} Red Hat Inc. and/or its affiliates and others
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* http://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
import com.intellij.psi {
PsiElement
}
import org.eclipse.ceylon.compiler.typechecker.tree {
Node
}
import java.lang {
Class,
Types
}
import org.eclipse.ceylon.ide.intellij.psi {
CeylonCompositeElement,
CeylonPsiVisitor
}
shared class FindMatchingPsiNodeVisitor(Node node, klass)
extends CeylonPsiVisitor(true) {
Class<out CeylonCompositeElement> klass;
variable CeylonCompositeElement? result = null;
shared CeylonCompositeElement? psi => result;
shared actual void visitElement(PsiElement element) {
super.visitElement(element);
if (element.textRange.equalsToRange(node.startIndex.intValue(), node.endIndex.intValue()),
klass.isAssignableFrom(Types.classForInstance(element))) {
assert (is CeylonCompositeElement element);
result = element;
}
}
}
| Ceylon | 4 | Kopilov/ceylon-ide-intellij | source/org/eclipse/ceylon/ide/intellij/resolve/FindMatchingPsiNodeVisitor.ceylon | [
"Apache-2.0"
]
|
import QtQuick 2.6
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
Window {
id: root
visible: true
width: 640
height: 480
title: qsTr("Hello World")
Button {
text: "Ok"
onClicked: {
root.color = Qt.rgba(Math.random(), Math.random(), Math.random(), 1);
}
}
}
| QML | 3 | tritao/xmake | xmake/templates/c++/qt.quickapp_static/project/src/main.qml | [
"Apache-2.0"
]
|
<?xml version='1.0' encoding='UTF-8'?>
<Project Type="Project" LVVersion="13008000">
<Property Name="NI.LV.All.SourceOnly" Type="Bool">true</Property>
<Property Name="NI.Project.Description" Type="Str"></Property>
<Item Name="My Computer" Type="My Computer">
<Property Name="server.app.propertiesEnabled" Type="Bool">true</Property>
<Property Name="server.control.propertiesEnabled" Type="Bool">true</Property>
<Property Name="server.tcp.enabled" Type="Bool">false</Property>
<Property Name="server.tcp.port" Type="Int">0</Property>
<Property Name="server.tcp.serviceName" Type="Str">My Computer/VI Server</Property>
<Property Name="server.tcp.serviceName.default" Type="Str">My Computer/VI Server</Property>
<Property Name="server.vi.callsEnabled" Type="Bool">true</Property>
<Property Name="server.vi.propertiesEnabled" Type="Bool">true</Property>
<Property Name="specify.custom.address" Type="Bool">false</Property>
<Item Name="Advanced Plotting Toolkit.lvlib" Type="Library" URL="../Advanced Plotting Toolkit.lvlib"/>
<Item Name="LICENSE.txt" Type="Document" URL="../LICENSE.txt"/>
<Item Name="ThirdPartyAgreements.txt" Type="Document" URL="../ThirdPartyAgreements.txt"/>
<Item Name="Dependencies" Type="Dependencies">
<Item Name="vi.lib" Type="Folder">
<Item Name="Check if File or Folder Exists.vi" Type="VI" URL="/<vilib>/Utility/libraryn.llb/Check if File or Folder Exists.vi"/>
<Item Name="Clear Errors.vi" Type="VI" URL="/<vilib>/Utility/error.llb/Clear Errors.vi"/>
<Item Name="Color to RGB.vi" Type="VI" URL="/<vilib>/Utility/colorconv.llb/Color to RGB.vi"/>
<Item Name="Create Directory Recursive.vi" Type="VI" URL="/<vilib>/Utility/libraryn.llb/Create Directory Recursive.vi"/>
<Item Name="Draw 1-Bit Pixmap.vi" Type="VI" URL="/<vilib>/picture/picture.llb/Draw 1-Bit Pixmap.vi"/>
<Item Name="Draw 4-Bit Pixmap.vi" Type="VI" URL="/<vilib>/picture/picture.llb/Draw 4-Bit Pixmap.vi"/>
<Item Name="Draw 8-Bit Pixmap.vi" Type="VI" URL="/<vilib>/picture/picture.llb/Draw 8-Bit Pixmap.vi"/>
<Item Name="Draw Flattened Pixmap.vi" Type="VI" URL="/<vilib>/picture/picture.llb/Draw Flattened Pixmap.vi"/>
<Item Name="Draw True-Color Pixmap.vi" Type="VI" URL="/<vilib>/picture/picture.llb/Draw True-Color Pixmap.vi"/>
<Item Name="Draw Unflattened Pixmap.vi" Type="VI" URL="/<vilib>/picture/picture.llb/Draw Unflattened Pixmap.vi"/>
<Item Name="Error Cluster From Error Code.vi" Type="VI" URL="/<vilib>/Utility/error.llb/Error Cluster From Error Code.vi"/>
<Item Name="ex_CorrectErrorChain.vi" Type="VI" URL="/<vilib>/express/express shared/ex_CorrectErrorChain.vi"/>
<Item Name="FixBadRect.vi" Type="VI" URL="/<vilib>/picture/pictutil.llb/FixBadRect.vi"/>
<Item Name="Flatten Pixmap.vi" Type="VI" URL="/<vilib>/picture/pixmap.llb/Flatten Pixmap.vi"/>
<Item Name="Get System Directory.vi" Type="VI" URL="/<vilib>/Utility/sysdir.llb/Get System Directory.vi"/>
<Item Name="imagedata.ctl" Type="VI" URL="/<vilib>/picture/picture.llb/imagedata.ctl"/>
<Item Name="NI_FileType.lvlib" Type="Library" URL="/<vilib>/Utility/lvfile.llb/NI_FileType.lvlib"/>
<Item Name="NI_PackedLibraryUtility.lvlib" Type="Library" URL="/<vilib>/Utility/LVLibp/NI_PackedLibraryUtility.lvlib"/>
<Item Name="NI_Unzip.lvlib" Type="Library" URL="/<vilib>/zip/NI_Unzip.lvlib"/>
<Item Name="Path To Command Line String.vi" Type="VI" URL="/<vilib>/AdvancedString/Path To Command Line String.vi"/>
<Item Name="PathToUNIXPathString.vi" Type="VI" URL="/<vilib>/Platform/CFURL.llb/PathToUNIXPathString.vi"/>
<Item Name="subFile Dialog.vi" Type="VI" URL="/<vilib>/express/express input/FileDialogBlock.llb/subFile Dialog.vi"/>
<Item Name="System Directory Type.ctl" Type="VI" URL="/<vilib>/Utility/sysdir.llb/System Directory Type.ctl"/>
<Item Name="System Exec.vi" Type="VI" URL="/<vilib>/Platform/system.llb/System Exec.vi"/>
</Item>
<Item Name="kernel32.dll" Type="Document" URL="kernel32.dll">
<Property Name="NI.PreserveRelativePath" Type="Bool">true</Property>
</Item>
</Item>
<Item Name="Build Specifications" Type="Build"/>
</Item>
</Project>
| LabVIEW | 1 | advancedplotting/aplot | labview/aplot.lvproj | [
"BSD-3-Clause"
]
|
@load base/protocols/http
@load base/protocols/ftp
redef HTTP::default_capture_password = T;
redef FTP::default_capture_password = T;
| Bro | 1 | uovo/docker-zeek | scripts/log-passwords.bro | [
"MIT"
]
|
// The Great Computer Language Shootout
// contributed by Isaac Gouy (Clean novice)
implementation module Heapsort
import StdEnv //, StdArrayExtensions
// Heapsort implementation adapted from:
//
// "The Implementation and Efficiency of Arrays in Clean 1.1"
// John H. G. van Groningen
// volume 1268 of Lecture Notes in Computer Science,
// pages 105--124. Springer-Verlag, 1997
// http://www.cs.kun.nl/~clean/publications.html#1997
heapsort :: !*{#Real} -> .{#Real}
heapsort a0
| n<2 = a
= sort_heap (n-1) (mkheap (n>>1) (n-1) a)
where
(n,a) = usize a0
mkheap (-1) m a = a
mkheap i m a=:{[i]=ai}
= mkheap (i-1) m (add_to_heap i ((i<<1)+1) m ai a)
sort_heap i a=:{[i]=ai, [0]=a0}
| i==1 = {a & [0]=ai, [i]=a0}
# b = (add_to_heap 0 1 deci ai {a & [i]=a0})
= sort_heap deci ( b)
with deci = i-1
add_to_heap i j m ai a
| j >= m
= if (j>m)
{a & [i] = ai}
(if (ai<aj)
{a` & [i] = aj, [j]=ai}
{a` & [i] = ai}
)
with (aj, a`) = uselect a j
add_to_heap i j m ai a=:{[j]=aj}
# j1 = j+1
#! aj1 = a.[j1]
| aj<aj1
= if (ai<aj1)
(add_to_heap j1 ((j1<<1)+1) m ai {a & [i]=aj1})
{a & [i]=ai}
= if (ai<aj)
(add_to_heap j ((j<<1)+1) m ai {a & [i]=aj})
{a & [i]=ai}
| Clean | 5 | kragen/shootout | bench/Include/clean/Heapsort.icl | [
"BSD-3-Clause"
]
|
-module(binref).
-export([compile_pattern/1,match/2,match/3,matches/2,matches/3,
split/2,split/3,replace/3,replace/4,first/1,last/1,at/2,
part/2,part/3,copy/1,copy/2,encode_unsigned/1,encode_unsigned/2,
decode_unsigned/1,decode_unsigned/2,referenced_byte_size/1,
longest_common_prefix/1,longest_common_suffix/1,bin_to_list/1,
bin_to_list/2,bin_to_list/3,list_to_bin/1]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% compile_pattern, a dummy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
compile_pattern(Pattern) when is_binary(Pattern) ->
{[Pattern]};
compile_pattern(Pattern) ->
try
[ true = is_binary(P) || P <- Pattern ],
{Pattern}
catch
_:_ ->
erlang:error(badarg)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% match and matches
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
match(H,N) ->
match(H,N,[]).
match(Haystack,Needle,Options) when is_binary(Needle) ->
match(Haystack,[Needle],Options);
match(Haystack,{Needles},Options) ->
match(Haystack,Needles,Options);
match(Haystack,Needles,Options) ->
try
true = is_binary(Haystack) and is_list(Needles), % badarg, not function_clause
case get_opts_match(Options,nomatch) of
nomatch ->
mloop(Haystack,Needles);
{A,B} when B > 0 ->
<<_:A/binary,SubStack:B/binary,_/binary>> = Haystack,
mloop(SubStack,Needles,A,B+A);
{A,B} when B < 0 ->
Start = A + B,
Len = -B,
<<_:Start/binary,SubStack:Len/binary,_/binary>> = Haystack,
mloop(SubStack,Needles,Start,Len+Start);
_ ->
nomatch
end
catch
_:_ ->
erlang:error(badarg)
end.
matches(H,N) ->
matches(H,N,[]).
matches(Haystack,Needle,Options) when is_binary(Needle) ->
matches(Haystack,[Needle],Options);
matches(Haystack,{Needles},Options) ->
matches(Haystack,Needles,Options);
matches(Haystack,Needles,Options) ->
try
true = is_binary(Haystack) and is_list(Needles), % badarg, not function_clause
case get_opts_match(Options,nomatch) of
nomatch ->
msloop(Haystack,Needles);
{A,B} when B > 0 ->
<<_:A/binary,SubStack:B/binary,_/binary>> = Haystack,
msloop(SubStack,Needles,A,B+A);
{A,B} when B < 0 ->
Start = A + B,
Len = -B,
<<_:Start/binary,SubStack:Len/binary,_/binary>> = Haystack,
msloop(SubStack,Needles,Start,Len+Start);
_ ->
[]
end
catch
_:_ ->
erlang:error(badarg)
end.
mloop(Haystack,Needles) ->
mloop(Haystack,Needles,0,byte_size(Haystack)).
mloop(_Haystack,_Needles,N,M) when N >= M ->
nomatch;
mloop(Haystack,Needles,N,M) ->
case mloop2(Haystack,Needles,N,nomatch) of
nomatch ->
%% Not found
<<_:8,NewStack/binary>> = Haystack,
mloop(NewStack,Needles,N+1,M);
{N,Len} ->
{N,Len}
end.
msloop(Haystack,Needles) ->
msloop(Haystack,Needles,0,byte_size(Haystack)).
msloop(_Haystack,_Needles,N,M) when N >= M ->
[];
msloop(Haystack,Needles,N,M) ->
case mloop2(Haystack,Needles,N,nomatch) of
nomatch ->
%% Not found
<<_:8,NewStack/binary>> = Haystack,
msloop(NewStack,Needles,N+1,M);
{N,Len} ->
NewN = N+Len,
if
NewN >= M ->
[{N,Len}];
true ->
<<_:Len/binary,NewStack/binary>> = Haystack,
[{N,Len} | msloop(NewStack,Needles,NewN,M)]
end
end.
mloop2(_Haystack,[],_N,Res) ->
Res;
mloop2(Haystack,[Needle|Tail],N,Candidate) ->
NS = byte_size(Needle),
case Haystack of
<<Needle:NS/binary,_/binary>> ->
NewCandidate = case Candidate of
nomatch ->
{N,NS};
{N,ONS} when ONS < NS ->
{N,NS};
Better ->
Better
end,
mloop2(Haystack,Tail,N,NewCandidate);
_ ->
mloop2(Haystack,Tail,N,Candidate)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% split
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
split(H,N) ->
split(H,N,[]).
split(Haystack,{Needles},Options) ->
split(Haystack, Needles, Options);
split(Haystack,Needles0,Options) ->
try
Needles = if
is_list(Needles0) ->
Needles0;
is_binary(Needles0) ->
[Needles0];
true ->
exit(badtype)
end,
{Part,Global,Trim,TrimAll} =
get_opts_split(Options,{nomatch,false,false,false}),
{Start,End,NewStack} =
case Part of
nomatch ->
{0,byte_size(Haystack),Haystack};
{A,B} when B >= 0 ->
<<_:A/binary,SubStack:B/binary,_/binary>> = Haystack,
{A,A+B,SubStack};
{A,B} when B < 0 ->
S = A + B,
L = -B,
<<_:S/binary,SubStack:L/binary,_/binary>> = Haystack,
{S,S+L,SubStack}
end,
MList = if
Global ->
msloop(NewStack,Needles,Start,End);
true ->
case mloop(NewStack,Needles,Start,End) of
nomatch ->
[];
X ->
[X]
end
end,
do_split(Haystack,MList,0,Trim,TrimAll)
catch
_:_ ->
erlang:error(badarg)
end.
do_split(H,[],N,true,_) when N >= byte_size(H) ->
[];
do_split(H,[],N,_,true) when N >= byte_size(H) ->
[];
do_split(H,[],N,_,_) ->
[part(H,{N,byte_size(H)-N})];
do_split(H,[{A,B}|T],N,Trim,TrimAll) ->
case part(H,{N,A-N}) of
<<>> when TrimAll == true ->
do_split(H,T,A+B,Trim,TrimAll);
<<>> ->
Rest = do_split(H,T,A+B,Trim,TrimAll),
case {Trim, Rest} of
{true,[]} ->
[];
_ ->
[<<>> | Rest]
end;
Oth ->
[Oth | do_split(H,T,A+B,Trim,TrimAll)]
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% replace
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
replace(H,N,R) ->
replace(H,N,R,[]).
replace(Haystack,{Needles},Replacement,Options) ->
replace(Haystack,Needles,Replacement,Options);
replace(Haystack,Needles0,Replacement,Options) ->
try
Needles = if
is_list(Needles0) ->
Needles0;
is_binary(Needles0) ->
[Needles0];
true ->
exit(badtype)
end,
true = is_binary(Replacement), % Make badarg instead of function clause
{Part,Global,Insert} = get_opts_replace(Options,{nomatch,false,[]}),
{Start,End,NewStack} =
case Part of
nomatch ->
{0,byte_size(Haystack),Haystack};
{A,B} when B >= 0 ->
<<_:A/binary,SubStack:B/binary,_/binary>> = Haystack,
{A,A+B,SubStack};
{A,B} when B < 0 ->
S = A + B,
L = -B,
<<_:S/binary,SubStack:L/binary,_/binary>> = Haystack,
{S,S+L,SubStack}
end,
MList = if
Global ->
msloop(NewStack,Needles,Start,End);
true ->
case mloop(NewStack,Needles,Start,End) of
nomatch ->
[];
X ->
[X]
end
end,
ReplList = case Insert of
[] ->
Replacement;
Y when is_integer(Y) ->
splitat(Replacement,0,[Y]);
Li when is_list(Li) ->
splitat(Replacement,0,lists:sort(Li))
end,
erlang:iolist_to_binary(do_replace(Haystack,MList,ReplList,0))
catch
_:_ ->
erlang:error(badarg)
end.
do_replace(H,[],_,N) ->
[part(H,{N,byte_size(H)-N})];
do_replace(H,[{A,B}|T],Replacement,N) ->
[part(H,{N,A-N}),
if
is_list(Replacement) ->
do_insert(Replacement, part(H,{A,B}));
true ->
Replacement
end
| do_replace(H,T,Replacement,A+B)].
do_insert([X],_) ->
[X];
do_insert([H|T],R) ->
[H,R|do_insert(T,R)].
splitat(H,N,[]) ->
[part(H,{N,byte_size(H)-N})];
splitat(H,N,[I|T]) ->
[part(H,{N,I-N})|splitat(H,I,T)].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% first, last and at
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
first(Subject) ->
try
<<A:8,_/binary>> = Subject,
A
catch
_:_ ->
erlang:error(badarg)
end.
last(Subject) ->
try
N = byte_size(Subject) - 1,
<<_:N/binary,A:8>> = Subject,
A
catch
_:_ ->
erlang:error(badarg)
end.
at(Subject,X) ->
try
<<_:X/binary,A:8,_/binary>> = Subject,
A
catch
_:_ ->
erlang:error(badarg)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% bin_to_list
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bin_to_list(Subject) ->
try
binary_to_list(Subject)
catch
_:_ ->
erlang:error(badarg)
end.
bin_to_list(Subject,T) ->
try
{A0,B0} = T,
{A,B} = if
B0 < 0 ->
{A0+B0,-B0};
true ->
{A0,B0}
end,
binary_to_list(Subject,A+1,A+B)
catch
_:_ ->
erlang:error(badarg)
end.
bin_to_list(Subject,A,B) ->
try
bin_to_list(Subject,{A,B})
catch
_:_ ->
erlang:error(badarg)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% list_to_bin
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
list_to_bin(List) ->
try
erlang:list_to_binary(List)
catch
_:_ ->
erlang:error(badarg)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% longest_common_prefix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
longest_common_prefix(LB) ->
try
true = is_list(LB) and (length(LB) > 0), % Make badarg instead of function clause
do_longest_common_prefix(LB,0)
catch
_:_ ->
erlang:error(badarg)
end.
do_longest_common_prefix(LB,X) ->
case do_lcp(LB,X,no) of
true ->
do_longest_common_prefix(LB,X+1);
false ->
X
end.
do_lcp([],_,_) ->
true;
do_lcp([Bin|_],X,_) when byte_size(Bin) =< X ->
false;
do_lcp([Bin|T],X,no) ->
Ch = at(Bin,X),
do_lcp(T,X,Ch);
do_lcp([Bin|T],X,Ch) ->
Ch2 = at(Bin,X),
if
Ch =:= Ch2 ->
do_lcp(T,X,Ch);
true ->
false
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% longest_common_suffix
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
longest_common_suffix(LB) ->
try
true = is_list(LB) and (length(LB) > 0), % Make badarg instead of function clause
do_longest_common_suffix(LB,0)
catch
_:_ ->
erlang:error(badarg)
end.
do_longest_common_suffix(LB,X) ->
case do_lcs(LB,X,no) of
true ->
do_longest_common_suffix(LB,X+1);
false ->
X
end.
do_lcs([],_,_) ->
true;
do_lcs([Bin|_],X,_) when byte_size(Bin) =< X ->
false;
do_lcs([Bin|T],X,no) ->
Ch = at(Bin,byte_size(Bin) - 1 - X),
do_lcs(T,X,Ch);
do_lcs([Bin|T],X,Ch) ->
Ch2 = at(Bin,byte_size(Bin) - 1 - X),
if
Ch =:= Ch2 ->
do_lcs(T,X,Ch);
true ->
false
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% part
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
part(Subject,Part) ->
try
do_part(Subject,Part)
catch
_:_ ->
erlang:error(badarg)
end.
part(Subject,Pos,Len) ->
part(Subject,{Pos,Len}).
do_part(Bin,{A,B}) when B >= 0 ->
<<_:A/binary,Sub:B/binary,_/binary>> = Bin,
Sub;
do_part(Bin,{A,B}) when B < 0 ->
S = A + B,
L = -B,
<<_:S/binary,Sub:L/binary,_/binary>> = Bin,
Sub.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% copy
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
copy(Subject) ->
copy(Subject,1).
copy(Subject,N) ->
try
true = is_integer(N) and (N >= 0) and is_binary(Subject), % Badarg, not function clause
erlang:list_to_binary(lists:duplicate(N,Subject))
catch
_:_ ->
erlang:error(badarg)
end.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% encode_unsigned
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
encode_unsigned(Unsigned) ->
encode_unsigned(Unsigned,big).
encode_unsigned(Unsigned,Endian) ->
try
true = is_integer(Unsigned) and (Unsigned >= 0),
if
Unsigned =:= 0 ->
<<0>>;
true ->
case Endian of
big ->
list_to_binary(do_encode(Unsigned,[]));
little ->
list_to_binary(do_encode_r(Unsigned))
end
end
catch
_:_ ->
erlang:error(badarg)
end.
do_encode(0,L) ->
L;
do_encode(N,L) ->
Byte = N band 255,
NewN = N bsr 8,
do_encode(NewN,[Byte|L]).
do_encode_r(0) ->
[];
do_encode_r(N) ->
Byte = N band 255,
NewN = N bsr 8,
[Byte|do_encode_r(NewN)].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% decode_unsigned
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
decode_unsigned(Subject) ->
decode_unsigned(Subject,big).
decode_unsigned(Subject,Endian) ->
try
true = is_binary(Subject),
case Endian of
big ->
do_decode(Subject,0);
little ->
do_decode_r(Subject,0)
end
catch
_:_ ->
erlang:error(badarg)
end.
do_decode(<<>>,N) ->
N;
do_decode(<<X:8,Bin/binary>>,N) ->
do_decode(Bin,(N bsl 8) bor X).
do_decode_r(<<>>,N) ->
N;
do_decode_r(Bin,N) ->
Sz = byte_size(Bin) - 1,
<<NewBin:Sz/binary,X>> = Bin,
do_decode_r(NewBin, (N bsl 8) bor X).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% referenced_byte_size cannot
%% be implemented in pure
%% erlang
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
referenced_byte_size(Bin) when is_binary(Bin) ->
erlang:error(not_implemented);
referenced_byte_size(_) ->
erlang:error(badarg).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Simple helper functions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Option "parsing"
get_opts_match([],Part) ->
Part;
get_opts_match([{scope,{A,B}} | T],_Part) ->
get_opts_match(T,{A,B});
get_opts_match(_,_) ->
throw(badopt).
get_opts_split([],{Part,Global,Trim,TrimAll}) ->
{Part,Global,Trim,TrimAll};
get_opts_split([{scope,{A,B}} | T],{_Part,Global,Trim,TrimAll}) ->
get_opts_split(T,{{A,B},Global,Trim,TrimAll});
get_opts_split([global | T],{Part,_Global,Trim,TrimAll}) ->
get_opts_split(T,{Part,true,Trim,TrimAll});
get_opts_split([trim | T],{Part,Global,_Trim,TrimAll}) ->
get_opts_split(T,{Part,Global,true,TrimAll});
get_opts_split([trim_all | T],{Part,Global,Trim,_TrimAll}) ->
get_opts_split(T,{Part,Global,Trim,true});
get_opts_split(_,_) ->
throw(badopt).
get_opts_replace([],{Part,Global,Insert}) ->
{Part,Global,Insert};
get_opts_replace([{scope,{A,B}} | T],{_Part,Global,Insert}) ->
get_opts_replace(T,{{A,B},Global,Insert});
get_opts_replace([global | T],{Part,_Global,Insert}) ->
get_opts_replace(T,{Part,true,Insert});
get_opts_replace([{insert_replaced,N} | T],{Part,Global,_Insert}) ->
get_opts_replace(T,{Part,Global,N});
get_opts_replace(_,_) ->
throw(badopt).
| Erlang | 4 | jjhoo/otp | lib/stdlib/test/binref.erl | [
"Apache-2.0"
]
|
#+TITLE: lang/rest
#+DATE: March 17, 2017
#+SINCE: v1.3
#+STARTUP: inlineimages nofold
* Table of Contents :TOC_3:noexport:
- [[#description][Description]]
- [[#maintainers][Maintainers]]
- [[#module-flags][Module Flags]]
- [[#plugins][Plugins]]
- [[#hacks][Hacks]]
- [[#prerequisites][Prerequisites]]
- [[#features][Features]]
- [[#configuration][Configuration]]
- [[#troubleshooting][Troubleshooting]]
* Description
This module adds [[https://en.wikipedia.org/wiki/Representational_state_transfer][REST]] support.
+ Code-completion (~company-restclient~)
+ Code evaluation
+ Imenu support for ~restclient-mode~
+ org-mode: babel support (~ob-restclient~)
#+begin_quote
~restclient-mode~ is tremendously useful for automated or quick testing REST
APIs. My workflow is to open an ~org-mode~ buffer, create a restclient source
block and hack away. ~restclient-mode~ and ~company-restclient~ power this
arcane wizardry.
#+end_quote
** Maintainers
This module has no dedicated maintainers.
** Module Flags
This module provides no flags.
** Plugins
+ [[https://github.com/pashky/restclient.el][restclient]]
+ =:completion company=
+ [[https://github.com/iquiw/company-restclient][company-restclient]]
** Hacks
+ restclient has been modified not to silently reject self-signed or invalid
certificates.
+ Adds imenu support to ~restclient-mode~.
* Prerequisites
This module has no prerequisites.
* Features
# An in-depth list of features, how to use them, and their dependencies.
* Configuration
# How to configure this module, including common problems and how to address them.
* Troubleshooting
# Common issues and their solution, or places to look for help.
| Org | 3 | leezu/doom-emacs | modules/lang/rest/README.org | [
"MIT"
]
|
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc < %s -mtriple=x86_64-darwin -mattr=+mmx,+sse2 | FileCheck %s
define i64 @t0(x86_mmx* %p) {
; CHECK-LABEL: t0:
; CHECK: ## %bb.0:
; CHECK-NEXT: movq (%rdi), %mm0
; CHECK-NEXT: paddq %mm0, %mm0
; CHECK-NEXT: movq %mm0, %rax
; CHECK-NEXT: retq
%t = load x86_mmx, x86_mmx* %p
%u = tail call x86_mmx @llvm.x86.mmx.padd.q(x86_mmx %t, x86_mmx %t)
%s = bitcast x86_mmx %u to i64
ret i64 %s
}
define i64 @t1(x86_mmx* %p) {
; CHECK-LABEL: t1:
; CHECK: ## %bb.0:
; CHECK-NEXT: movq (%rdi), %mm0
; CHECK-NEXT: paddd %mm0, %mm0
; CHECK-NEXT: movq %mm0, %rax
; CHECK-NEXT: retq
%t = load x86_mmx, x86_mmx* %p
%u = tail call x86_mmx @llvm.x86.mmx.padd.d(x86_mmx %t, x86_mmx %t)
%s = bitcast x86_mmx %u to i64
ret i64 %s
}
define i64 @t2(x86_mmx* %p) {
; CHECK-LABEL: t2:
; CHECK: ## %bb.0:
; CHECK-NEXT: movq (%rdi), %mm0
; CHECK-NEXT: paddw %mm0, %mm0
; CHECK-NEXT: movq %mm0, %rax
; CHECK-NEXT: retq
%t = load x86_mmx, x86_mmx* %p
%u = tail call x86_mmx @llvm.x86.mmx.padd.w(x86_mmx %t, x86_mmx %t)
%s = bitcast x86_mmx %u to i64
ret i64 %s
}
define i64 @t3(x86_mmx* %p) {
; CHECK-LABEL: t3:
; CHECK: ## %bb.0:
; CHECK-NEXT: movq (%rdi), %mm0
; CHECK-NEXT: paddb %mm0, %mm0
; CHECK-NEXT: movq %mm0, %rax
; CHECK-NEXT: retq
%t = load x86_mmx, x86_mmx* %p
%u = tail call x86_mmx @llvm.x86.mmx.padd.b(x86_mmx %t, x86_mmx %t)
%s = bitcast x86_mmx %u to i64
ret i64 %s
}
@R = external global x86_mmx
define void @t4(<1 x i64> %A, <1 x i64> %B) {
; CHECK-LABEL: t4:
; CHECK: ## %bb.0: ## %entry
; CHECK-NEXT: movq %rdi, %mm0
; CHECK-NEXT: movq %rsi, %mm1
; CHECK-NEXT: paddusw %mm0, %mm1
; CHECK-NEXT: movq _R@{{.*}}(%rip), %rax
; CHECK-NEXT: movq %mm1, (%rax)
; CHECK-NEXT: emms
; CHECK-NEXT: retq
entry:
%tmp2 = bitcast <1 x i64> %A to x86_mmx
%tmp3 = bitcast <1 x i64> %B to x86_mmx
%tmp7 = tail call x86_mmx @llvm.x86.mmx.paddus.w(x86_mmx %tmp2, x86_mmx %tmp3)
store x86_mmx %tmp7, x86_mmx* @R
tail call void @llvm.x86.mmx.emms()
ret void
}
define i64 @t5(i32 %a, i32 %b) nounwind readnone {
; CHECK-LABEL: t5:
; CHECK: ## %bb.0:
; CHECK-NEXT: movd %esi, %xmm0
; CHECK-NEXT: movd %edi, %xmm1
; CHECK-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
; CHECK-NEXT: movq %xmm1, %rax
; CHECK-NEXT: retq
%v0 = insertelement <2 x i32> undef, i32 %a, i32 0
%v1 = insertelement <2 x i32> %v0, i32 %b, i32 1
%conv = bitcast <2 x i32> %v1 to i64
ret i64 %conv
}
declare x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx, i32)
define <1 x i64> @t6(i64 %t) {
; CHECK-LABEL: t6:
; CHECK: ## %bb.0:
; CHECK-NEXT: movq %rdi, %mm0
; CHECK-NEXT: psllq $48, %mm0
; CHECK-NEXT: movq %mm0, %rax
; CHECK-NEXT: retq
%t1 = insertelement <1 x i64> undef, i64 %t, i32 0
%t0 = bitcast <1 x i64> %t1 to x86_mmx
%t2 = tail call x86_mmx @llvm.x86.mmx.pslli.q(x86_mmx %t0, i32 48)
%t3 = bitcast x86_mmx %t2 to <1 x i64>
ret <1 x i64> %t3
}
declare x86_mmx @llvm.x86.mmx.paddus.w(x86_mmx, x86_mmx)
declare x86_mmx @llvm.x86.mmx.padd.b(x86_mmx, x86_mmx)
declare x86_mmx @llvm.x86.mmx.padd.w(x86_mmx, x86_mmx)
declare x86_mmx @llvm.x86.mmx.padd.d(x86_mmx, x86_mmx)
declare x86_mmx @llvm.x86.mmx.padd.q(x86_mmx, x86_mmx)
declare void @llvm.x86.mmx.emms()
| LLVM | 3 | medismailben/llvm-project | llvm/test/CodeGen/X86/mmx-bitcast.ll | [
"Apache-2.0"
]
|
package com.baeldung.oop;
public class Car extends Vehicle {
private String type;
private String color;
private int speed;
private int numberOfGears;
public Car(String type, String model, String color) {
super(4, model);
this.type = type;
this.color = color;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public int getSpeed() {
return speed;
}
public void setSpeed(int speed) {
this.speed = speed;
}
public int increaseSpeed(int increment) {
if (increment > 0) {
this.speed += increment;
} else {
System.out.println("Increment can't be negative.");
}
return this.speed;
}
public int decreaseSpeed(int decrement) {
if (decrement > 0 && decrement <= this.speed) {
this.speed -= decrement;
} else {
System.out.println("Decrement can't be negative or greater than current speed.");
}
return this.speed;
}
public void openDoors() {
// process to open the doors
}
@Override
public void honk() {
// produces car-specific honk
}
}
| Java | 4 | DBatOWL/tutorials | core-java-modules/core-java-lang-oop-others/src/main/java/com/baeldung/oop/Car.java | [
"MIT"
]
|
from cpython.ref cimport PyObject
from folly cimport cFollyTry
cdef extern from "folly/python/fibers.h" namespace "folly::python":
void bridgeFibers "folly::python::bridgeFibers"[T](
T(*)(),
void(*)(cFollyTry[T]&&, PyObject*),
PyObject* pyFuture
)
| Cython | 3 | facebookxx/folly | folly/python/fibers.pxd | [
"Apache-2.0"
]
|
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="*">
<html>
<body>
<script>
if (window.testRunner)
testRunner.dumpAsText();
</script>
FAIL: Forbidden XML stylesheet did run.
</body>
</html>
</xsl:template>
</xsl:stylesheet>
| XSLT | 1 | zealoussnow/chromium | third_party/blink/web_tests/http/tests/security/resources/forbidden-stylesheet.xsl | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
]
|
-- Model: vgg-face.def.lua
-- Description: VGG Face's network:
-- http://www.robots.ox.ac.uk/~vgg/publications/2015/Parkhi15/parkhi15.pdf
--
-- Input size: 3x224x224
-- Number of Parameters from net:getParameters() with embSize=128: 118003648
-- Components: Mostly `nn`
-- Devices: CPU and CUDA
--
-- Brandon Amos <http://bamos.github.io>
-- 2016-06-08
--
-- Copyright 2016 Carnegie Mellon University
--
-- 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.
imgDim = 224
local conv = nn.SpatialConvolutionMM
local relu = nn.ReLU
local mp = nn.SpatialMaxPooling
function createModel()
local net = nn.Sequential()
net:add(conv(3, 64, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(64, 64, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(mp(2,2, 2,2))
net:add(conv(64, 128, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(128, 128, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(mp(2,2, 2,2))
net:add(conv(128, 256, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(256, 256, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(256, 256, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(mp(2,2, 2,2))
net:add(conv(256, 512, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(512, 512, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(512, 512, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(mp(2,2, 2,2))
net:add(conv(512, 512, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(512, 512, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(conv(512, 512, 3,3, 1,1, 1,1))
net:add(relu(true))
net:add(mp(2,2, 2,2))
-- Validate shape with:
-- net:add(nn.Reshape(25088))
net:add(nn.View(25088))
net:add(nn.Linear(25088, 4096))
net:add(relu(true))
net:add(nn.Linear(4096, opt.embSize))
net:add(nn.Normalize(2))
return net
end
| Lua | 4 | ammogcoder/openface | models/openface/vgg-face.def.lua | [
"Apache-2.0"
]
|
frequency,raw
20.00,-9.66
20.20,-9.63
20.40,-9.63
20.61,-9.65
20.81,-9.68
21.02,-9.73
21.23,-9.78
21.44,-9.87
21.66,-9.97
21.87,-10.08
22.09,-10.20
22.31,-10.33
22.54,-10.45
22.76,-10.54
22.99,-10.59
23.22,-10.61
23.45,-10.58
23.69,-10.50
23.92,-10.39
24.16,-10.26
24.40,-10.14
24.65,-10.04
24.89,-9.95
25.14,-9.88
25.39,-9.83
25.65,-9.78
25.91,-9.73
26.16,-9.66
26.43,-9.56
26.69,-9.44
26.96,-9.31
27.23,-9.17
27.50,-9.05
27.77,-8.91
28.05,-8.78
28.33,-8.65
28.62,-8.52
28.90,-8.38
29.19,-8.24
29.48,-8.09
29.78,-7.97
30.08,-7.85
30.38,-7.77
30.68,-7.70
30.99,-7.64
31.30,-7.60
31.61,-7.55
31.93,-7.50
32.24,-7.45
32.57,-7.37
32.89,-7.30
33.22,-7.22
33.55,-7.14
33.89,-7.05
34.23,-6.97
34.57,-6.88
34.92,-6.80
35.27,-6.72
35.62,-6.63
35.97,-6.55
36.33,-6.46
36.70,-6.40
37.06,-6.33
37.43,-6.26
37.81,-6.21
38.19,-6.13
38.57,-6.06
38.95,-5.98
39.34,-5.88
39.74,-5.79
40.14,-5.69
40.54,-5.58
40.94,-5.47
41.35,-5.36
41.76,-5.24
42.18,-5.14
42.60,-5.04
43.03,-4.95
43.46,-4.86
43.90,-4.76
44.33,-4.68
44.78,-4.60
45.23,-4.50
45.68,-4.41
46.13,-4.31
46.60,-4.20
47.06,-4.09
47.53,-3.98
48.01,-3.86
48.49,-3.74
48.97,-3.62
49.46,-3.50
49.96,-3.37
50.46,-3.24
50.96,-3.12
51.47,-3.00
51.99,-2.88
52.51,-2.76
53.03,-2.64
53.56,-2.52
54.10,-2.39
54.64,-2.28
55.18,-2.15
55.74,-2.03
56.29,-1.91
56.86,-1.79
57.42,-1.67
58.00,-1.56
58.58,-1.45
59.16,-1.34
59.76,-1.25
60.35,-1.16
60.96,-1.07
61.57,-0.99
62.18,-0.90
62.80,-0.82
63.43,-0.75
64.07,-0.69
64.71,-0.61
65.35,-0.55
66.01,-0.48
66.67,-0.42
67.33,-0.36
68.01,-0.31
68.69,-0.26
69.37,-0.22
70.07,-0.18
70.77,-0.14
71.48,-0.10
72.19,-0.07
72.91,-0.04
73.64,-0.01
74.38,0.01
75.12,0.04
75.87,0.06
76.63,0.08
77.40,0.10
78.17,0.11
78.95,0.13
79.74,0.14
80.54,0.15
81.35,0.17
82.16,0.17
82.98,0.18
83.81,0.19
84.65,0.19
85.50,0.20
86.35,0.20
87.22,0.19
88.09,0.20
88.97,0.20
89.86,0.20
90.76,0.19
91.66,0.19
92.58,0.18
93.51,0.18
94.44,0.18
95.39,0.17
96.34,0.16
97.30,0.15
98.28,0.14
99.26,0.13
100.25,0.12
101.25,0.11
102.27,0.09
103.29,0.08
104.32,0.06
105.37,0.05
106.42,0.02
107.48,0.00
108.56,-0.02
109.64,-0.04
110.74,-0.06
111.85,-0.09
112.97,-0.11
114.10,-0.14
115.24,-0.16
116.39,-0.19
117.55,-0.23
118.73,-0.26
119.92,-0.29
121.12,-0.32
122.33,-0.35
123.55,-0.39
124.79,-0.42
126.03,-0.45
127.29,-0.48
128.57,-0.52
129.85,-0.54
131.15,-0.58
132.46,-0.61
133.79,-0.64
135.12,-0.68
136.48,-0.71
137.84,-0.74
139.22,-0.77
140.61,-0.80
142.02,-0.83
143.44,-0.86
144.87,-0.89
146.32,-0.91
147.78,-0.94
149.26,-0.97
150.75,-1.00
152.26,-1.02
153.78,-1.05
155.32,-1.07
156.88,-1.10
158.44,-1.13
160.03,-1.15
161.63,-1.18
163.24,-1.20
164.88,-1.22
166.53,-1.24
168.19,-1.27
169.87,-1.30
171.57,-1.32
173.29,-1.35
175.02,-1.37
176.77,-1.40
178.54,-1.42
180.32,-1.45
182.13,-1.48
183.95,-1.51
185.79,-1.53
187.65,-1.56
189.52,-1.59
191.42,-1.61
193.33,-1.65
195.27,-1.68
197.22,-1.71
199.19,-1.74
201.18,-1.77
203.19,-1.80
205.23,-1.83
207.28,-1.85
209.35,-1.88
211.44,-1.90
213.56,-1.92
215.69,-1.95
217.85,-1.97
220.03,-1.99
222.23,-2.01
224.45,-2.03
226.70,-2.05
228.96,-2.07
231.25,-2.09
233.57,-2.11
235.90,-2.12
238.26,-2.13
240.64,-2.15
243.05,-2.16
245.48,-2.18
247.93,-2.20
250.41,-2.22
252.92,-2.26
255.45,-2.30
258.00,-2.34
260.58,-2.38
263.19,-2.43
265.82,-2.47
268.48,-2.50
271.16,-2.53
273.87,-2.57
276.61,-2.59
279.38,-2.61
282.17,-2.63
284.99,-2.65
287.84,-2.67
290.72,-2.68
293.63,-2.70
296.57,-2.72
299.53,-2.75
302.53,-2.77
305.55,-2.80
308.61,-2.82
311.69,-2.84
314.81,-2.87
317.96,-2.90
321.14,-2.93
324.35,-2.96
327.59,-2.99
330.87,-3.03
334.18,-3.06
337.52,-3.09
340.90,-3.12
344.30,-3.16
347.75,-3.19
351.23,-3.22
354.74,-3.26
358.28,-3.30
361.87,-3.33
365.49,-3.36
369.14,-3.40
372.83,-3.43
376.56,-3.45
380.33,-3.48
384.13,-3.51
387.97,-3.54
391.85,-3.56
395.77,-3.58
399.73,-3.60
403.72,-3.63
407.76,-3.65
411.84,-3.67
415.96,-3.68
420.12,-3.70
424.32,-3.71
428.56,-3.72
432.85,-3.74
437.18,-3.74
441.55,-3.75
445.96,-3.76
450.42,-3.76
454.93,-3.78
459.48,-3.78
464.07,-3.78
468.71,-3.79
473.40,-3.79
478.13,-3.78
482.91,-3.79
487.74,-3.78
492.62,-3.78
497.55,-3.77
502.52,-3.77
507.55,-3.77
512.62,-3.76
517.75,-3.75
522.93,-3.74
528.16,-3.73
533.44,-3.72
538.77,-3.71
544.16,-3.70
549.60,-3.68
555.10,-3.67
560.65,-3.66
566.25,-3.64
571.92,-3.62
577.64,-3.61
583.41,-3.59
589.25,-3.56
595.14,-3.54
601.09,-3.52
607.10,-3.49
613.17,-3.46
619.30,-3.43
625.50,-3.39
631.75,-3.36
638.07,-3.32
644.45,-3.28
650.89,-3.23
657.40,-3.18
663.98,-3.13
670.62,-3.07
677.32,-3.00
684.10,-2.94
690.94,-2.87
697.85,-2.80
704.83,-2.74
711.87,-2.68
718.99,-2.62
726.18,-2.57
733.44,-2.52
740.78,-2.49
748.19,-2.46
755.67,-2.42
763.23,-2.39
770.86,-2.36
778.57,-2.32
786.35,-2.28
794.22,-2.22
802.16,-2.14
810.18,-2.06
818.28,-1.95
826.46,-1.83
834.73,-1.70
843.08,-1.55
851.51,-1.39
860.02,-1.24
868.62,-1.07
877.31,-0.91
886.08,-0.74
894.94,-0.58
903.89,-0.44
912.93,-0.30
922.06,-0.17
931.28,-0.07
940.59,0.02
950.00,0.09
959.50,0.13
969.09,0.15
978.78,0.14
988.57,0.10
998.46,0.02
1008.44,-0.10
1018.53,-0.24
1028.71,-0.42
1039.00,-0.64
1049.39,-0.88
1059.88,-1.16
1070.48,-1.46
1081.19,-1.78
1092.00,-2.11
1102.92,-2.45
1113.95,-2.77
1125.09,-3.09
1136.34,-3.37
1147.70,-3.63
1159.18,-3.88
1170.77,-4.10
1182.48,-4.32
1194.30,-4.52
1206.25,-4.74
1218.31,-4.96
1230.49,-5.20
1242.80,-5.45
1255.22,-5.70
1267.78,-5.96
1280.45,-6.22
1293.26,-6.48
1306.19,-6.74
1319.25,-6.99
1332.45,-7.23
1345.77,-7.48
1359.23,-7.72
1372.82,-7.95
1386.55,-8.18
1400.41,-8.40
1414.42,-8.64
1428.56,-8.85
1442.85,-9.07
1457.28,-9.28
1471.85,-9.49
1486.57,-9.70
1501.43,-9.91
1516.45,-10.14
1531.61,-10.38
1546.93,-10.63
1562.40,-10.90
1578.02,-11.19
1593.80,-11.48
1609.74,-11.77
1625.84,-12.05
1642.10,-12.29
1658.52,-12.50
1675.10,-12.59
1691.85,-12.62
1708.77,-12.57
1725.86,-12.41
1743.12,-12.19
1760.55,-11.91
1778.15,-11.57
1795.94,-11.20
1813.90,-10.80
1832.03,-10.41
1850.36,-10.01
1868.86,-9.62
1887.55,-9.25
1906.42,-8.92
1925.49,-8.61
1944.74,-8.33
1964.19,-8.13
1983.83,-7.97
2003.67,-7.85
2023.71,-7.77
2043.94,-7.72
2064.38,-7.69
2085.03,-7.68
2105.88,-7.68
2126.94,-7.67
2148.20,-7.67
2169.69,-7.67
2191.38,-7.68
2213.30,-7.69
2235.43,-7.72
2257.78,-7.75
2280.36,-7.79
2303.17,-7.83
2326.20,-7.84
2349.46,-7.85
2372.95,-7.79
2396.68,-7.70
2420.65,-7.56
2444.86,-7.33
2469.31,-7.04
2494.00,-6.69
2518.94,-6.30
2544.13,-5.87
2569.57,-5.46
2595.27,-5.05
2621.22,-4.69
2647.43,-4.38
2673.90,-4.12
2700.64,-3.94
2727.65,-3.80
2754.93,-3.70
2782.48,-3.64
2810.30,-3.61
2838.40,-3.59
2866.79,-3.59
2895.46,-3.60
2924.41,-3.62
2953.65,-3.65
2983.19,-3.71
3013.02,-3.79
3043.15,-3.87
3073.58,-3.99
3104.32,-4.12
3135.36,-4.27
3166.72,-4.44
3198.38,-4.61
3230.37,-4.80
3262.67,-5.00
3295.30,-5.21
3328.25,-5.41
3361.53,-5.62
3395.15,-5.80
3429.10,-5.98
3463.39,-6.14
3498.03,-6.28
3533.01,-6.41
3568.34,-6.51
3604.02,-6.57
3640.06,-6.62
3676.46,-6.66
3713.22,-6.69
3750.36,-6.71
3787.86,-6.74
3825.74,-6.78
3864.00,-6.82
3902.64,-6.88
3941.66,-6.95
3981.08,-7.03
4020.89,-7.13
4061.10,-7.21
4101.71,-7.32
4142.73,-7.42
4184.15,-7.53
4226.00,-7.69
4268.26,-7.87
4310.94,-8.08
4354.05,-8.38
4397.59,-8.73
4441.56,-9.12
4485.98,-9.58
4530.84,-10.10
4576.15,-10.63
4621.91,-11.15
4668.13,-11.59
4714.81,-11.91
4761.96,-12.12
4809.58,-12.07
4857.67,-11.86
4906.25,-11.49
4955.31,-10.85
5004.87,-10.06
5054.91,-9.18
5105.46,-8.17
5156.52,-7.14
5208.08,-6.13
5260.16,-5.16
5312.77,-4.26
5365.89,-3.41
5419.55,-2.64
5473.75,-1.99
5528.49,-1.40
5583.77,-0.89
5639.61,-0.49
5696.00,-0.13
5752.96,0.17
5810.49,0.40
5868.60,0.57
5927.28,0.68
5986.56,0.70
6046.42,0.64
6106.89,0.54
6167.96,0.36
6229.64,0.10
6291.93,-0.21
6354.85,-0.57
6418.40,-1.00
6482.58,-1.44
6547.41,-1.92
6612.88,-2.41
6679.01,-2.89
6745.80,-3.36
6813.26,-3.78
6881.39,-4.17
6950.21,-4.53
7019.71,-4.81
7089.91,-5.03
7160.81,-5.18
7232.41,-5.27
7304.74,-5.28
7377.79,-5.24
7451.56,-5.14
7526.08,-4.96
7601.34,-4.76
7677.35,-4.54
7754.13,-4.27
7831.67,-4.01
7909.98,-3.76
7989.08,-3.52
8068.98,-3.27
8149.67,-3.05
8231.16,-2.80
8313.47,-2.56
8396.61,-2.30
8480.57,-2.03
8565.38,-1.78
8651.03,-1.57
8737.54,-1.41
8824.92,-1.39
8913.17,-1.50
9002.30,-1.71
9092.32,-2.14
9183.25,-2.72
9275.08,-3.40
9367.83,-4.19
9461.51,-5.05
9556.12,-5.93
9651.68,-6.80
9748.20,-7.66
9845.68,-8.47
9944.14,-9.26
10043.58,-9.89
10144.02,-10.40
10245.46,-10.79
10347.91,-10.92
10451.39,-10.87
10555.91,-10.65
10661.46,-10.19
10768.08,-9.55
10875.76,-8.80
10984.52,-7.91
11094.36,-7.02
11205.31,-6.15
11317.36,-5.34
11430.53,-4.71
11544.84,-4.24
11660.29,-3.93
11776.89,-3.93
11894.66,-4.07
12013.60,-4.37
12133.74,-4.81
12255.08,-5.28
12377.63,-5.73
12501.41,-6.10
12626.42,-6.32
12752.68,-6.45
12880.21,-6.41
13009.01,-6.27
13139.10,-6.10
13270.49,-5.95
13403.20,-5.94
13537.23,-6.07
13672.60,-6.37
13809.33,-6.98
13947.42,-7.77
14086.90,-8.72
14227.77,-9.85
14370.04,-10.99
14513.74,-12.08
14658.88,-13.04
14805.47,-13.71
14953.52,-14.17
15103.06,-14.37
15254.09,-14.32
15406.63,-14.17
15560.70,-13.96
15716.30,-13.78
15873.47,-13.71
16032.20,-13.73
16192.52,-14.00
16354.45,-14.44
16517.99,-15.02
16683.17,-15.75
16850.01,-16.49
17018.51,-17.20
17188.69,-17.85
17360.58,-18.42
17534.18,-18.96
17709.53,-19.43
17886.62,-19.89
18065.49,-20.33
18246.14,-20.74
18428.60,-21.18
18612.89,-21.58
18799.02,-21.97
18987.01,-22.33
19176.88,-22.58
19368.65,-22.73
19562.33,-22.84
19757.96,-22.93
19955.54,-23.04
| CSV | 0 | vinzmc/AutoEq | measurements/rtings/data/onear/TaoTronics TT-BH060/TaoTronics TT-BH060.csv | [
"MIT"
]
|
Red/System [
Title: "camera device"
Author: "bitbegin"
File: %camera-dev.reds
Tabs: 4
Rights: "Copyright (C) 2020 Red Foundation. All rights reserved."
License: {
Distributed under the Boost Software License, Version 1.0.
See https://github.com/red/red/blob/master/BSL-License.txt
}
]
camera-dev: context [
#include %v4l2.reds
open: func [
name [c-string!]
w [integer!]
h [integer!]
cfg [int-ptr!]
return: [logic!]
/local
config [v4l2-config!]
hr [integer!]
][
config: as v4l2-config! allocate size? v4l2-config!
cfg/1: as integer! config
config/name: name
config/width: w
config/height: h
hr: v4l2/open config
if hr = 0 [return true]
free as byte-ptr! config
cfg/1: 0
false
]
close: func [
cfg [integer!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
v4l2/close config
free as byte-ptr! cfg
]
attach: func [
cfg [integer!]
widget [int-ptr!]
cb [int-ptr!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
v4l2/attach config widget cb
]
start: func [
cfg [integer!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
v4l2/start config
]
get-data: func [
cfg [integer!]
data [int-ptr!]
dlen [int-ptr!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
data/1: as integer! config/buffer
dlen/1: config/bused
]
get-widget: func [
cfg [integer!]
return: [int-ptr!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
config/widget
]
signal: func [
cfg [integer!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
v4l2/signal config
]
trylock: func [
cfg [integer!]
return: [integer!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
v4l2/trylock config
]
unlock: func [
cfg [integer!]
/local
config [v4l2-config!]
][
config: as v4l2-config! cfg
v4l2/unlock config
]
collect: func [
cb [int-ptr!]
return: [integer!]
][
v4l2/collect cb
]
]
| Red | 4 | GalenIvanov/red | modules/view/backends/gtk3/camera-dev.reds | [
"BSL-1.0",
"BSD-3-Clause"
]
|
mod m {
pub fn r#for() {}
}
fn main() {
m::for();
//~^ ERROR expected identifier, found keyword `for`
}
| Rust | 1 | Eric-Arellano/rust | src/test/ui/issues/issue-57198.rs | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
]
|
/******************************************************************************
* Copyright 2017 The Apollo Authors. 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.
*****************************************************************************/
#include "modules/common/configs/vehicle_config_helper.h"
#include <cmath>
#include <string>
#include "gmock/gmock.h"
#include "gtest/gtest.h"
namespace apollo {
namespace common {
class VehicleConfigHelperTest : public ::testing::Test {
public:
void SetUp() {
config_.mutable_vehicle_param()->set_front_edge_to_center(2.0);
config_.mutable_vehicle_param()->set_back_edge_to_center(1.0);
config_.mutable_vehicle_param()->set_left_edge_to_center(1.0);
config_.mutable_vehicle_param()->set_right_edge_to_center(1.0);
config_.mutable_vehicle_param()->set_min_turn_radius(5.0);
}
VehicleConfig config_;
};
TEST_F(VehicleConfigHelperTest, MinSafeTurnRadius) {
config_.mutable_vehicle_param()->set_right_edge_to_center(0.5);
config_.mutable_vehicle_param()->set_front_edge_to_center(3.0);
VehicleConfigHelper::Init(config_);
auto min_radius = VehicleConfigHelper::MinSafeTurnRadius();
EXPECT_DOUBLE_EQ(min_radius, sqrt(36.0 + 9.0));
}
} // namespace common
} // namespace apollo
| C++ | 4 | seeclong/apollo | modules/common/configs/vehicle_config_helper_test.cc | [
"Apache-2.0"
]
|
// @module: system
// @isolatedModules: true
import {alias} from "foo";
import cls = alias.Class;
export import cls2 = alias.Class;
let x = new alias.Class();
let y = new cls();
let z = new cls2();
module M {
export import cls = alias.Class;
let x = new alias.Class();
let y = new cls();
let z = new cls2();
} | TypeScript | 2 | nilamjadhav/TypeScript | tests/cases/compiler/aliasesInSystemModule2.ts | [
"Apache-2.0"
]
|
// Copyright 2015 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include "p.h"
#include "libgo.h"
extern int install_handler();
extern int check_handler();
int main(void) {
int32_t res;
int r1 = install_handler();
if (r1!=0) {
return r1;
}
if (!DidInitRun()) {
fprintf(stderr, "ERROR: buildmode=c-archive init should run\n");
return 2;
}
if (DidMainRun()) {
fprintf(stderr, "ERROR: buildmode=c-archive should not run main\n");
return 2;
}
int r2 = check_handler();
if (r2!=0) {
return r2;
}
res = FromPkg();
if (res != 1024) {
fprintf(stderr, "ERROR: FromPkg()=%d, want 1024\n", res);
return 2;
}
CheckArgs();
fprintf(stderr, "PASS\n");
return 0;
}
| C | 4 | Havoc-OS/androidprebuilts_go_linux-x86 | misc/cgo/testcarchive/main.c | [
"BSD-3-Clause"
]
|
source ./test-functions.sh
install_service
mkdir /test-service/pid
echo 'PID_FOLDER=pid' > /test-service/spring-boot-app.conf
start_service
echo "PID: $(cat /test-service/pid/spring-boot-app/spring-boot-app.pid)"
await_app
curl -s http://127.0.0.1:8080/
status_service
stop_service
| Shell | 3 | Martin-real/spring-boot-2.1.0.RELEASE | spring-boot-tests/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/resources/scripts/launch-with-relative-pid-folder.sh | [
"Apache-2.0"
]
|
#include <c10/test/util/complex_test_common.h>
| C++ | 0 | Hacky-DH/pytorch | c10/test/util/complex_test.cpp | [
"Intel"
]
|
/* Copyright (c) 2017-2019 Netronome Systems, Inc. All rights reserved.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
;TEST_INIT_EXEC nfp-reg mereg:i32.me0.XferIn_32=0x12b51c00
;TEST_INIT_EXEC nfp-reg mereg:i32.me0.XferIn_33=0xdeadbeef
;TEST_INIT_EXEC nfp-mem i32.ctm:0x80 0x00000000 0x00000000 0x00154d0e 0x04a50800
;TEST_INIT_EXEC nfp-mem i32.ctm:0x90 0x273d254e 0x81000065 0x81000258 0x08004500
;TEST_INIT_EXEC nfp-mem i32.ctm:0xa0 0x003c18f1 0x00008001 0x9e7cc0a8 0x0101c0a8
;TEST_INIT_EXEC nfp-mem i32.ctm:0xb0 0x01020800 0x2b5c0200 0x20006162 0x63646566
;TEST_INIT_EXEC nfp-mem i32.ctm:0xc0 0x6768696a 0x6b6c6d6e 0x6f707172 0x73747576
;TEST_INIT_EXEC nfp-mem i32.ctm:0xd0 0x77616263 0x64656667 0x68690000
#define NFD_CFG_CLASS_VERSION 0
#define NFD_CFG_CLASS_DEFAULT 0
#include <pkt_io.uc>
#include <single_ctx_test.uc>
#include <actions.uc>
#include <bitfields.uc>
#include <config.h>
#include <gro_cfg.uc>
#include <global.uc>
#include <pv.uc>
#include <stdmac.uc>
.reg protocol
.reg volatile write $nbi_desc[(NBI_IN_META_SIZE_LW + (MAC_PREPEND_BYTES / 4))]
.xfer_order $nbi_desc
.reg addr
.sig s
.reg o_l3_offset
.reg o_l4_offset
.reg i_l3_offset
.reg i_l4_offset
.reg proto
.reg expected_o_l3_offset
.reg expected_o_l4_offset
.reg expected_i_l3_offset
.reg expected_i_l4_offset
.reg expected_proto
.reg pkt_num
move(pkt_num, 0)
.while(pkt_num < 0x100)
pkt_buf_free_ctm_buffer(--, pkt_num)
alu[pkt_num, pkt_num, +, 1]
.endw
pkt_buf_alloc_ctm(pkt_num, 3, --, test_fail)
test_assert_equal(pkt_num, 0)
move(addr, 0x200)
move(expected_i_l3_offset, (14 + 4 + 4))
move(expected_i_l4_offset, 0)
move(expected_o_l3_offset, (14 + 4 + 4))
move(expected_o_l4_offset,0)
move(expected_proto, 6)
#define pkt_vec *l$index1
move(pkt_vec[4], 0x3fc0)
//set up CATAMARAN vector
.reg tmp
move(tmp, ((0x52<<BF_L(CAT_PKT_LEN_bf)) | 0<<BF_L(CAT_BLS_bf)))
alu[$nbi_desc[0], tmp, OR, pkt_num, <<16]
move($nbi_desc[1], 0)
move(tmp, ((1 << BF_L(PV_CTM_ALLOCATED_bf)) | (0x88 << BF_L(PV_OFFSET_bf)))]
alu[$nbi_desc[2], tmp, OR, pkt_num, <<16]
move($nbi_desc[3], (CAT_L3_TYPE_IP<<BF_L(CAT_L3_TYPE_bf)))
move($nbi_desc[4], 0)
move($nbi_desc[5], 0)
move($nbi_desc[6], 0)
move($nbi_desc[7], (0x0<<BF_L(MAC_PARSE_L3_bf) | 0x0 << BF_L(MAC_PARSE_STS_bf) | 0x2<<BF_L(MAC_PARSE_VLAN_bf)))
mem[write32, $nbi_desc[0], 0, <<8, addr, (NBI_IN_META_SIZE_LW + (MAC_PREPEND_BYTES / 4))], ctx_swap[s]
mem[read32, $__pkt_io_nbi_desc[0], 0, <<8, addr, (NBI_IN_META_SIZE_LW + (MAC_PREPEND_BYTES / 4))], ctx_swap[s]
local_csr_wr[T_INDEX, (32 * 4)]
immed[__actions_t_idx, (32 * 4)]
nop
nop
__actions_rx_wire(pkt_vec)
test_assert_equal(*$index, 0xdeadbeef)
bitfield_extract__sz1(proto, BF_AML(pkt_vec, PV_PROTO_bf))
bitfield_extract__sz1(i_l4_offset, BF_AML(pkt_vec, PV_HEADER_OFFSET_INNER_L4_bf))
bitfield_extract__sz1(i_l3_offset, BF_AML(pkt_vec, PV_HEADER_OFFSET_INNER_IP_bf))
bitfield_extract__sz1(o_l4_offset, BF_AML(pkt_vec, PV_HEADER_OFFSET_OUTER_L4_bf))
bitfield_extract__sz1(o_l3_offset, BF_AML(pkt_vec, PV_HEADER_OFFSET_OUTER_IP_bf))
test_assert_equal(proto, expected_proto)
test_assert_equal(i_l3_offset, expected_i_l3_offset)
test_assert_equal(i_l4_offset, expected_i_l4_offset)
test_assert_equal(o_l3_offset, expected_o_l3_offset)
test_assert_equal(o_l4_offset, expected_o_l4_offset)
test_pass()
PV_HDR_PARSE_SUBROUTINE#:
pv_hdr_parse_subroutine(pkt_vec)
PV_SEEK_SUBROUTINE#:
pv_seek_subroutine(pkt_vec)
| UnrealScript | 3 | pcasconnetronome/nic-firmware | test/datapath/actions_rx_wire_ipv4_unknown_test.uc | [
"BSD-2-Clause"
]
|
#lang scribble/manual
@begin[(require "../utils.rkt" scribble/example)
(require (for-label (only-meta-in 0 [except-in typed/racket for])))]
@(define the-top-eval (make-base-eval #:lang 'typed/racket))
@(define-syntax-rule (ex . args)
(examples #:eval the-top-eval . args))
@title{Experimental Features}
These features are currently experimental and subject to change.
@defform[(declare-refinement id)]{Declares @racket[id] to be usable in
@racket[Refinement] types.}
@defform[(Refinement id)]{Includes values that have been tested with the
predicate @racket[id], which must have been specified with
@racket[declare-refinement]. These predicate-based refinements are distinct
from Typed Racket's more general @racket[Refine] form.}
@defform[(define-typed-struct/exec forms ...)]{Defines an executable structure.}
@defform[(define-new-subtype name (constructor t))]{
Defines a new type @racket[name] that is a subtype of @racket[t].
The @racket[constructor] is defined as a function that takes a value of type
@racket[t] and produces a value of the new type @racket[name].
A @racket[define-new-subtype] definition is only allowed at the top level of a
file or module.
This is purely a type-level distinction, with no way to distinguish the new type
from the base type at runtime. Predicates made by @racket[make-predicate]
won't be able to distinguish them properly, so they will return true for all values
that the base type's predicate would return true for. This is usually not what
you want, so you shouldn't use @racket[make-predicate] with these types.
@ex[(module m typed/racket
(provide Radians radians f)
(define-new-subtype Radians (radians Real))
(: f : [Radians -> Real])
(define (f a)
(sin a)))
(require 'm)
(radians 0)
(f (radians 0))]
}
@section{Logical Refinements and Linear Integer Reasoning}
Typed Racket allows types to be `refined' or `constrained'
by logical propositions. These propositions can mention
certain program terms, allowing a program's types to depend
on the values of terms.
@defform[#:literals (Refine : Top Bot ! and or when
unless if < <= = > >= car cdr
vector-length + *)
(Refine [id : type] proposition)
#:grammar
([proposition Top
Bot
(: symbolic-object type)
(! symbolic-object type)
(and proposition ...)
(or proposition ...)
(when proposition proposition)
(unless proposition proposition)
(if proposition proposition proposition)
(linear-comp symbolic-object symbolic-object)]
[linear-comp < <= = >= >]
[symbolic-object exact-integer
symbolic-path
(+ symbolic-object ...)
(- symbolic-object ...)
(* exact-integer symbolic-object)]
[symbolic-path id
(path-elem symbolic-path)]
[path-elem car
cdr
vector-length])]{@racket[(Refine [v : t] p)] is a
refinement of type @racket[t] with logical proposition
@racket[p], or in other words it describes any value
@racket[v] of type @racket[t] for which the logical
proposition @racket[p] holds.
@ex[(ann 42 (Refine [n : Integer] (= n 42)))]
Note: The identifier in a refinement type is in scope
inside the proposition, but not the type.
}
@racket[(: o t)] used as a proposition holds when symbolic object @racket[o]
is of type @racket[t.]
@defform[(! sym-obj type)]{This is the dual of @racket[(: o t)], holding
when @racket[o] is not of type @racket[t].}
Propositions can also describe linear inequalities (e.g. @racket[(<= x 42)]
holds when @racket[x] is less than or equal to @racket[42]), using any
of the following relations: @racket[<=], @racket[<], @racket[=],
@racket[>=], @racket[>].
The following logical combinators hold as one would expect
depending on which of their subcomponents hold:
@racket[and], @racket[or], @racket[if], @racket[not].
@racket[(when p q)] is equivalent to @racket[(or (not p) (and p q))].
@racket[(unless p q)] is equivalent to @racket[(or p q)].
In addition to reasoning about propositions regarding types
(i.e. something is or is not of some particular type), Typed
Racket is equipped with a linear integer arithmetic solver
that can prove linear constraints when necessary. To turn on
this solver (and some other refinement reasoning), you must add
the @racket[#:with-refinements] keyword when
specifying the language of your program:
@racketmod[typed/racket #:with-refinements]
With this language option on, type checking the following
primitives will produce more specific logical info (when they are being
applied to 2 or 3 arguments): @racket[*], @racket[+], @racket[-],
@racket[<], @racket[<=], @racket[=], @racket[>=], @racket[>],
and @racket[make-vector].
This allows code such as the following to type check:
@racketblock[(if (< 5 4)
(+ "Luke," "I am your father")
"that's impossible!")]
i.e. with refinement reasoning enabled, Typed Racket
detects that the comparison is guaranteed to produce
@racket[#f], and thus the clearly ill-typed `then'-branch is
ignored by the type checker since it is guaranteed to be
dead code.
@section{Dependent Function Types}
Typed Racket supports explicitly dependent function types:
@defform*/subs[#:link-target? #f #:id -> #:literals (:)
[(-> ([id : opt-deps arg-type] ...)
opt-pre
range-type
opt-props)]
([opt-deps (code:line) (id ...)]
[opt-pre (code:line)
(code:line #:pre (id ...) prop)]
[opt-props (code:line)
(code:line opt-pos-prop opt-neg-prop opt-obj)]
[opt-pos-prop (code:line)
(code:line #:+ prop)]
[opt-neg-prop (code:line)
(code:line #:- prop)]
[opt-obj (code:line)
(code:line #:object obj)])]
The syntax is similar to Racket's dependent contracts syntax
(i.e. @racket[->i]).
Each function argument has a name, an optional list of
identifiers it depends on, an argument type. An
argument's type can mention (i.e. depend on) other arguments
by name if they appear in its list of dependencies.
Dependencies cannot be cyclic.
A function may have also have a precondition. The
precondition is introduced with the @racket[#:pre] keyword
followed by the list of arguments on which it depends
and the proposition which describes the precondition.
A function's range may depend on any of its arguments.
The grammar of supported propositions and symbolic objects
(i.e. @racket[prop] and @racket[obj]) is the same as
the @racket[proposition] and @racket[symbolic-object] grammars
from @racket[Refine]'s syntax.
For example, here is a dependently typed version of
Racket's @racket[vector-ref] which eliminates vector
bounds errors during type checking instead of at run time:
@ex[#:label #f
(require racket/unsafe/ops)
(: safe-ref1 (All (A) (-> ([v : (Vectorof A)]
[n : (v) (Refine [i : Natural]
(< i (vector-length v)))])
A)))
(define (safe-ref1 v n) (unsafe-vector-ref v n))
(safe-ref1 (vector "safe!") 0)
(eval:error (safe-ref1 (vector "not safe!") 1))]
Here is an equivalent type that uses a precondition instead of a
refinement type:
@ex[#:label #f
(: safe-ref2 (All (A) (-> ([v : (Vectorof A)]
[n : Natural])
#:pre (v n) (< n (vector-length v))
A)))
(define (safe-ref2 v n) (unsafe-vector-ref v n))
(safe-ref2 (vector "safe!") 0)
(eval:error (safe-ref2 (vector "not safe!") 1))]
Using preconditions can provide more detailed type checker
error messages, i.e. they can indicate when the arguments
were of the correct type but the precondition could not
be proven.
| Racket | 5 | SnapCracklePopGone/typed-racket | typed-racket-doc/typed-racket/scribblings/reference/experimental.scrbl | [
"Apache-2.0",
"MIT"
]
|
-- Copyright 2018 The Howl Developers
-- License: MIT (see LICENSE.md at the top-level directory of the distribution)
{:app, :config, :mode} = howl
{:ActionBuffer, :BufferPopup, :highlight, :List} = howl.ui
{:Preview} = howl.interactions.util
highlight.define_default 'list_visited',
type: highlight.STRIKE_TROUGH
foreground: 'darkgray'
line_width: 1
line_type: 'solid'
ListMode = {
default_config:
cursor_line_highlighted: false
line_wrapping: 'none'
line_numbers: false
edge_column: 0
on_cursor_changed: (editor, cursor) =>
list = editor.buffer.list
list.selection = list\item_at editor.cursor.pos
keymap: {
editor: {
return: (ed) ->
ed.buffer\choose ed
space: (ed) ->
ed.buffer\toggle_chosen!
p: (ed) ->
ed.buffer\toggle_preview!
escape: (ed) ->
ed.buffer\cancel_preview!
}
}
}
class ListBuffer extends ActionBuffer
new: (list, @opts={}) =>
super!
@list = List list.matcher, on_selection_change: self\_on_selection_change
@title = opts.title or "#{#@list.items} items"
@mode = mode.by_name 'list'
@chosen = {}
pos = 1
@list.max_rows = @opts.max_rows or 1000
@list\insert @, pos
@list\draw!
@modified = false
@read_only = true
choose: (editor) =>
if @opts.on_submit
sel = @list.selection
if sel
unless @chosen[sel]
@mark_chosen!
@opts.on_submit sel, @
toggle_chosen: =>
sel = @list.selection
return if not sel
if @chosen[sel]
line = @lines[@list.selected_idx]
highlight.remove_in_range 'list_visited', @, line.start_pos, line.end_pos
@chosen[sel] = nil
else
@mark_chosen!
mark_chosen: =>
sel = @list.selection
return if not sel or @chosen[sel]
line = @lines[@list.selected_idx]
highlight.apply 'list_visited', @, line.start_pos, line.stripped.ulen
@chosen[sel] = true
toggle_preview: =>
if @_preview
@_preview = false
else
@show_preview!
show_preview: =>
item = @list.selection
return unless item
@_preview = true
if @opts.show_preview
@opts.show_preview item, @
return
preview_buf = @_get_preview item
if preview_buf
ed = app\editor_for_buffer @
if ed
highlight.remove_all 'search', preview_buf
popup = BufferPopup(preview_buf, show_lines: 10, show_line_numbers: true)
ed\show_popup popup
popup.view.middle_visible_line = item.line_nr
popup\resize!
if item.highlights
for hl in *item.highlights
start_p, end_p = preview_buf\resolve_span hl, item.line_nr
highlight.apply 'search', preview_buf, start_p, end_p - start_p
return
@cancel_preview!
cancel_preview: =>
@_preview = false
_get_preview: (item) =>
return unless config.preview_files
file = item.file
return unless file and file.exists
@preview or= Preview only_previews: true
@preview\get_buffer file, item.line_nr
_on_selection_change: (item) =>
@show_preview! if @_preview
howl.mode.register {
name: 'list'
create: -> ListMode
}
ListBuffer
| MoonScript | 4 | jasperpilgrim/howl | lib/howl/ui/list_buffer.moon | [
"MIT"
]
|
#
# undefined elements can't appear in XML
#
# @expect=org.quattor.pan.exceptions.ValidationException ".*element at /x is undefined.*"
#
object template undef1;
"/x" = undef;
| Pan | 4 | aka7/pan | panc/src/test/pan/Functionality/undef/undef1.pan | [
"Apache-2.0"
]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.